void ItemMover::OnRightClick(bool up, int x, int y, bool* block) { BnetData* pData = (*p_D2LAUNCH_BnData); UnitAny *unit = D2CLIENT_GetPlayerUnit(); bool shiftState = ((GetKeyState(VK_LSHIFT) & 0x80) || (GetKeyState(VK_RSHIFT) & 0x80)); bool ctrlState = ((GetKeyState(VK_LCONTROL) & 0x80) || (GetKeyState(VK_RCONTROL) & 0x80)); if (up || !pData || !unit || !(shiftState || ctrlState)) { return; } Init(); int xpac = pData->nCharFlags & PLAYER_TYPE_EXPANSION; int inventoryRight = INVENTORY_LEFT + (CELL_SIZE * INVENTORY_WIDTH); int inventoryBottom = INVENTORY_TOP + (CELL_SIZE * INVENTORY_HEIGHT); int stashRight = STASH_LEFT + (CELL_SIZE * STASH_WIDTH); int stashTop = xpac ? LOD_STASH_TOP : CLASSIC_STASH_TOP; int stashHeight = xpac ? LOD_STASH_HEIGHT : CLASSIC_STASH_HEIGHT; int stashBottom = stashTop + (CELL_SIZE * stashHeight); int cubeRight = CUBE_LEFT + (CELL_SIZE * CUBE_WIDTH); int cubeBottom = CUBE_TOP + (CELL_SIZE * CUBE_HEIGHT); int source, sourceX, sourceY; int invUI = D2CLIENT_GetUIState(UI_INVENTORY); int stashUI = D2CLIENT_GetUIState(UI_STASH); int cubeUI = D2CLIENT_GetUIState(UI_CUBE); if ((invUI || stashUI || cubeUI) && x >= INVENTORY_LEFT && x <= inventoryRight && y >= INVENTORY_TOP && y <= inventoryBottom) { source = STORAGE_INVENTORY; sourceX = (x - INVENTORY_LEFT) / CELL_SIZE; sourceY = (y - INVENTORY_TOP) / CELL_SIZE; } else if (stashUI && x >= STASH_LEFT && x <= stashRight && y >= stashTop && y <= stashBottom) { source = STORAGE_STASH; sourceX = (x - STASH_LEFT) / CELL_SIZE; sourceY = (y - stashTop) / CELL_SIZE; } else if (cubeUI && x >= CUBE_LEFT && x <= cubeRight && y >= CUBE_TOP && y <= cubeBottom) { source = STORAGE_CUBE; sourceX = (x - CUBE_LEFT) / CELL_SIZE; sourceY = (y - CUBE_TOP) / CELL_SIZE; } else { return; } bool moveItem = LoadInventory(unit, xpac, source, sourceX, sourceY, shiftState, ctrlState, stashUI, invUI); if (moveItem) { PickUpItem(); } *block = true; }
void GUIManager::StateChange() { if(mCurrentState==MAIN_MENU) sheet->removeChildWindow("mainMenu"); mCurrentState = GAMEENGINE.GetStateManager()->GetCurrentState(); if(GAMEENGINE.GetStateManager()->GetCurrentState() == MAIN_MENU) LoadMainMenu(); if(GAMEENGINE.GetStateManager()->GetCurrentState() == PLAYING_LEVEL) { LoadInventory(); LoadInventorySpaces(); InitializeInventory(); LoadCharacterSheet(); LoadCharacterSheetSlots(); InitializeCharacterSheet(); } }