bool GameMapGump::DraggingItem(Item* item, int mx, int my) { // determine target location and set dragging_x/y/z int dox, doy; GUIApp::get_instance()->getDraggingOffset(dox, doy); dragging_shape = item->getShape(); dragging_frame = item->getFrame(); dragging_flags = item->getFlags(); display_dragging = true; // determine if item can be dropped here ObjId trace = TraceCoordinates(mx, my, dragging_pos, dox, doy, item); if (!trace) return false; MainActor* avatar = getMainActor(); if (trace == 1) { // dropping on self ObjId bp = avatar->getEquip(7); // !! constant Container* backpack = getContainer(bp); return backpack->CanAddItem(item, true); } bool throwing = false; if (!avatar->canReach(item, 128, // CONSTANT! dragging_pos[0], dragging_pos[1], dragging_pos[2])) { // can't reach, so see if we can throw int throwrange = item->getThrowRange(); if (throwrange && avatar->canReach(item, throwrange, dragging_pos[0], dragging_pos[1], dragging_pos[2])) { int speed = 64 - item->getTotalWeight() + avatar->getStr(); if (speed < 1) speed = 1; sint32 ax,ay,az; avatar->getLocation(ax,ay,az); MissileTracker t(item, ax, ay, az, dragging_pos[0], dragging_pos[1], dragging_pos[2], speed, 4); if (t.isPathClear()) throwing = true; else return false; } else { return false; } } if (!item->canExistAt(dragging_pos[0], dragging_pos[1], dragging_pos[2])) return false; if (throwing) GUIApp::get_instance()->setMouseCursor(GUIApp::MOUSE_TARGET); return true; }