| 1707 | } |
| 1708 | |
| 1709 | void CGameScreen::PrepareContent() |
| 1710 | { |
| 1711 | g_WorldTextRenderer.CalculateWorldPositions(false); |
| 1712 | |
| 1713 | m_GameScreenGump.PrepareContent(); |
| 1714 | |
| 1715 | g_GumpManager.PrepareContent(); |
| 1716 | |
| 1717 | if (g_SelectedObject.Gump != nullptr && |
| 1718 | (g_SelectedObject.Gump->GumpType == GT_STATUSBAR || |
| 1719 | g_SelectedObject.Gump->GumpType == GT_POPUP_MENU) && |
| 1720 | g_SelectedObject.Gump->Serial != g_PlayerSerial) |
| 1721 | { |
| 1722 | g_StatusbarUnderMouse = g_SelectedObject.Gump->Serial; |
| 1723 | } |
| 1724 | else |
| 1725 | { |
| 1726 | g_StatusbarUnderMouse = 0; |
| 1727 | } |
| 1728 | |
| 1729 | //if (g_SelectedObject.Object() != nullptr && g_SelectedObject.Object()->IsGameObject() && g_PressedObject.LeftObject == g_SelectedObject.Object()) |
| 1730 | if (g_PressedObject.LeftObject != nullptr && g_PressedObject.LeftObject->IsGameObject() && |
| 1731 | g_MouseManager.LastLeftButtonClickTimer < g_Ticks) |
| 1732 | { |
| 1733 | CPoint2Di offset = g_MouseManager.LeftDroppedOffset(); |
| 1734 | |
| 1735 | if (CanBeDraggedByOffset(offset) || |
| 1736 | (g_MouseManager.LastLeftButtonClickTimer + g_MouseManager.DoubleClickDelay < g_Ticks)) |
| 1737 | { |
| 1738 | CGameItem *selobj = g_World->FindWorldItem(g_PressedObject.LeftSerial); |
| 1739 | |
| 1740 | if (selobj != nullptr && !g_ObjectInHand.Enabled && !selobj->Locked() && |
| 1741 | GetDistance(g_Player, selobj) <= DRAG_ITEMS_DISTANCE) |
| 1742 | { |
| 1743 | if (selobj->Serial >= 0x40000000 && !g_GrayedPixels) //Item selection |
| 1744 | { |
| 1745 | if (selobj->IsStackable() && selobj->Count > 1 && !g_ShiftPressed) |
| 1746 | { |
| 1747 | CGumpDrag *newgump = new CGumpDrag( |
| 1748 | g_PressedObject.LeftSerial, |
| 1749 | g_MouseManager.Position.X - 80, |
| 1750 | g_MouseManager.Position.Y - 34); |
| 1751 | |
| 1752 | g_GumpManager.AddGump(newgump); |
| 1753 | g_GameWindow.EmulateOnLeftMouseButtonDown(); |
| 1754 | selobj->Dragged = true; |
| 1755 | } |
| 1756 | else if (!g_Target.IsTargeting()) |
| 1757 | { |
| 1758 | g_Game.PickupItem(selobj); |
| 1759 | g_PressedObject.ClearLeft(); //g_LastObjectLeftMouseDown = 0; |
| 1760 | } |
| 1761 | } |
| 1762 | } |
| 1763 | else if (!g_ObjectInHand.Enabled) |
| 1764 | { |
| 1765 | CGameCharacter *selchar = g_World->FindWorldCharacter(g_PressedObject.LeftSerial); |
| 1766 |
nothing calls this directly
no test coverage detected