comparison GUI/UI/UiGame.cpp @ 2544:c674d547cc7c

GUIWindow switch logic refactored into behaviour classes
author a.parshin
date Mon, 11 May 2015 09:51:04 +0200
parents a902abdfc7f2
children 4087cbc62706
comparison
equal deleted inserted replaced
2543:b6140dfeac27 2544:c674d547cc7c
86 if ( current_screen_type == SCREEN_CHEST ) 86 if ( current_screen_type == SCREEN_CHEST )
87 { 87 {
88 viewparams->bRedrawGameUI = true; 88 viewparams->bRedrawGameUI = true;
89 if ( uActiveCharacter == uPlayerID ) 89 if ( uActiveCharacter == uPlayerID )
90 { 90 {
91 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; 91 current_character_screen_window = WINDOW_CharacterWindow_Inventory;
92 current_screen_type = SCREEN_CHEST_INVENTORY; 92 current_screen_type = SCREEN_CHEST_INVENTORY;
93 uActiveCharacter = uPlayerID; 93 uActiveCharacter = uPlayerID;
94 return; 94 return;
95 } 95 }
96 if ( pPlayers[uPlayerID]->uTimeToRecovery ) 96 if ( pPlayers[uPlayerID]->uTimeToRecovery )
107 } 107 }
108 if ( current_screen_type != SCREEN_CHEST_INVENTORY ) 108 if ( current_screen_type != SCREEN_CHEST_INVENTORY )
109 { 109 {
110 viewparams->bRedrawGameUI = true; 110 viewparams->bRedrawGameUI = true;
111 uActiveCharacter = uPlayerID; 111 uActiveCharacter = uPlayerID;
112 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 102 ) 112 if (current_character_screen_window == WINDOW_CharacterWindow_Awards)
113 FillAwardsData(); 113 FillAwardsData();
114 return; 114 return;
115 } 115 }
116 viewparams->bRedrawGameUI = true; 116 viewparams->bRedrawGameUI = true;
117 if ( uActiveCharacter == uPlayerID ) 117 if ( uActiveCharacter == uPlayerID )
118 { 118 {
119 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; 119 current_character_screen_window = WINDOW_CharacterWindow_Inventory;
120 current_screen_type = SCREEN_CHEST_INVENTORY; 120 current_screen_type = SCREEN_CHEST_INVENTORY;
121 uActiveCharacter = uPlayerID; 121 uActiveCharacter = uPlayerID;
122 return; 122 return;
123 } 123 }
124 if ( pPlayers[uPlayerID]->uTimeToRecovery ) 124 if ( pPlayers[uPlayerID]->uTimeToRecovery )
135 return; 135 return;
136 } 136 }
137 if (dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD || dialog_menu_id == HOUSE_DIALOGUE_SHOP_6) 137 if (dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD || dialog_menu_id == HOUSE_DIALOGUE_SHOP_6)
138 { 138 {
139 __debugbreak(); // fix indexing 139 __debugbreak(); // fix indexing
140 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; 140 current_character_screen_window = WINDOW_CharacterWindow_Inventory;
141 pGUIWindow_CurrentMenu = CharacterUI_Initialize(SCREEN_E); 141 pGUIWindow_CurrentMenu = CharacterUI_Initialize(SCREEN_E);
142 return; 142 return;
143 } 143 }
144 } 144 }
145 145
316 } 316 }
317 } 317 }
318 } 318 }
319 if (sDialogue_SpeakingActorNPC_ID < 0) 319 if (sDialogue_SpeakingActorNPC_ID < 0)
320 v9 = 4; 320 v9 = 4;
321 pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_Dialogue, 3, 0);//pNumberContacts = 1, v9 = 0; pNumberContacts = 2, v9 = 3; 321 pDialogueWindow = new GUIWindow_Dialogue(0, 0, window->GetWidth(), window->GetHeight(), 3, 0);//pNumberContacts = 1, v9 = 0; pNumberContacts = 2, v9 = 3;
322 if (pNPCInfo->Hired() && !pNPCInfo->bHasUsedTheAbility) 322 if (pNPCInfo->Hired() && !pNPCInfo->bHasUsedTheAbility)
323 { 323 {
324 if (pNPCInfo->uProfession == 10 || //Healer 324 if (pNPCInfo->uProfession == 10 || //Healer
325 pNPCInfo->uProfession == 11 || //Expert Healer 325 pNPCInfo->uProfession == 11 || //Expert Healer
326 pNPCInfo->uProfession == 12 || //Master Healer 326 pNPCInfo->uProfession == 12 || //Master Healer
1313 } 1313 }
1314 else 1314 else
1315 { 1315 {
1316 for (int i = uNumVisibleWindows; i > 0; --i) 1316 for (int i = uNumVisibleWindows; i > 0; --i)
1317 { 1317 {
1318 pWindow = &pWindowList[pVisibleWindowsIdxs[i] - 1]; 1318 pWindow = pWindowList[pVisibleWindowsIdxs[i] - 1];
1319 if ( (signed int)pX >= (signed int)pWindow->uFrameX && (signed int)pX <= (signed int)pWindow->uFrameZ 1319 if ( (signed int)pX >= (signed int)pWindow->uFrameX && (signed int)pX <= (signed int)pWindow->uFrameZ
1320 && (signed int)pY >= (signed int)pWindow->uFrameY && (signed int)pY <= (signed int)pWindow->uFrameW ) 1320 && (signed int)pY >= (signed int)pWindow->uFrameY && (signed int)pY <= (signed int)pWindow->uFrameW )
1321 { 1321 {
1322 for ( pButton = pWindow->pControlsHead; pButton != nullptr; pButton = pButton->pNext ) 1322 for ( pButton = pWindow->pControlsHead; pButton != nullptr; pButton = pButton->pNext )
1323 { 1323 {
1434 bForceDrawFooter = 1; 1434 bForceDrawFooter = 1;
1435 uLastPointedObjectID = 0; 1435 uLastPointedObjectID = 0;
1436 return; 1436 return;
1437 } 1437 }
1438 } 1438 }
1439 if ( (signed int)pX >= (signed int)pWindowList[0].uFrameX && (signed int)pX <= (signed int)pWindowList[0].uFrameZ 1439 if ( (signed int)pX >= (signed int)pWindowList[0]->uFrameX && (signed int)pX <= (signed int)pWindowList[0]->uFrameZ
1440 && (signed int)pY >= (signed int)pWindowList[0].uFrameY && (signed int)pY <= (signed int)pWindowList[0].uFrameW ) 1440 && (signed int)pY >= (signed int)pWindowList[0]->uFrameY && (signed int)pY <= (signed int)pWindowList[0]->uFrameW )
1441 { 1441 {
1442 for ( pButton = pWindowList[0].pControlsHead; pButton != nullptr; pButton = pButton->pNext ) 1442 for ( pButton = pWindowList[0]->pControlsHead; pButton != nullptr; pButton = pButton->pNext )
1443 { 1443 {
1444 switch (pButton->uButtonType) 1444 switch (pButton->uButtonType)
1445 { 1445 {
1446 case 1: 1446 case 1:
1447 if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ 1447 if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ