diff 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
line wrap: on
line diff
--- a/GUI/UI/UiGame.cpp	Sun May 10 03:21:14 2015 +0200
+++ b/GUI/UI/UiGame.cpp	Mon May 11 09:51:04 2015 +0200
@@ -88,7 +88,7 @@
     viewparams->bRedrawGameUI = true;
     if ( uActiveCharacter == uPlayerID )
     {
-      pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
+        current_character_screen_window = WINDOW_CharacterWindow_Inventory;
       current_screen_type = SCREEN_CHEST_INVENTORY;
       uActiveCharacter = uPlayerID;
       return;
@@ -109,14 +109,14 @@
     {
       viewparams->bRedrawGameUI = true;
       uActiveCharacter = uPlayerID;
-      if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 102 )
+      if (current_character_screen_window == WINDOW_CharacterWindow_Awards)
         FillAwardsData();
       return;
     }
     viewparams->bRedrawGameUI = true;
     if ( uActiveCharacter == uPlayerID )
     {
-      pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
+        current_character_screen_window = WINDOW_CharacterWindow_Inventory;
       current_screen_type = SCREEN_CHEST_INVENTORY;
       uActiveCharacter = uPlayerID;
       return;
@@ -137,7 +137,7 @@
   if (dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD || dialog_menu_id == HOUSE_DIALOGUE_SHOP_6)
   {
     __debugbreak(); // fix indexing
-    pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
+    current_character_screen_window = WINDOW_CharacterWindow_Inventory;
     pGUIWindow_CurrentMenu = CharacterUI_Initialize(SCREEN_E);
     return;
   }
@@ -318,7 +318,7 @@
   }
   if (sDialogue_SpeakingActorNPC_ID < 0)
     v9 = 4;
-  pDialogueWindow = GUIWindow::Create(0, 0, window->GetWidth(),  window->GetHeight(), WINDOW_Dialogue, 3, 0);//pNumberContacts = 1, v9 = 0; pNumberContacts = 2, v9 = 3;
+  pDialogueWindow = new GUIWindow_Dialogue(0, 0, window->GetWidth(), window->GetHeight(), 3, 0);//pNumberContacts = 1, v9 = 0; pNumberContacts = 2, v9 = 3;
   if (pNPCInfo->Hired() && !pNPCInfo->bHasUsedTheAbility)
   {
     if (pNPCInfo->uProfession == 10 ||    //Healer
@@ -1315,7 +1315,7 @@
   {    
     for (int i = uNumVisibleWindows; i > 0; --i)
     {
-      pWindow = &pWindowList[pVisibleWindowsIdxs[i] - 1];
+      pWindow = pWindowList[pVisibleWindowsIdxs[i] - 1];
       if ( (signed int)pX >= (signed int)pWindow->uFrameX && (signed int)pX <= (signed int)pWindow->uFrameZ
         && (signed int)pY >= (signed int)pWindow->uFrameY && (signed int)pY <= (signed int)pWindow->uFrameW )
       {
@@ -1436,10 +1436,10 @@
       return;
     }
   }
-  if ( (signed int)pX >= (signed int)pWindowList[0].uFrameX && (signed int)pX <= (signed int)pWindowList[0].uFrameZ
-    && (signed int)pY >= (signed int)pWindowList[0].uFrameY && (signed int)pY <= (signed int)pWindowList[0].uFrameW )
+  if ( (signed int)pX >= (signed int)pWindowList[0]->uFrameX && (signed int)pX <= (signed int)pWindowList[0]->uFrameZ
+    && (signed int)pY >= (signed int)pWindowList[0]->uFrameY && (signed int)pY <= (signed int)pWindowList[0]->uFrameW )
   {
-    for ( pButton = pWindowList[0].pControlsHead; pButton != nullptr; pButton = pButton->pNext )
+    for ( pButton = pWindowList[0]->pControlsHead; pButton != nullptr; pButton = pButton->pNext )
     {
       switch (pButton->uButtonType)
       {