diff mm7_5.cpp @ 1033:3a5c8df8381d

* UI cleans and moves * Deleted many junk global variables.
author Nomad
date Tue, 21 May 2013 23:44:51 +0200
parents f93d17337113
children 306ec23b37df 7f8be9f9769e
line wrap: on
line diff
--- a/mm7_5.cpp	Tue May 21 14:34:14 2013 +0200
+++ b/mm7_5.cpp	Tue May 21 23:44:51 2013 +0200
@@ -275,7 +275,7 @@
     memset(&actor, 0, 0x344u);
     dword_5B65D0_dialogue_actor_npc_id = bDialogueUI_InitializeActor_NPC_ID;
     actor.sNPC_ID = bDialogueUI_InitializeActor_NPC_ID;
-    actor.InitializeDialogue(0);
+    GameUI_InitializeDialogue(&actor, false);
     bDialogueUI_InitializeActor_NPC_ID = 0;
   }
   if ( pMessageQueue_50CBD0->uNumMessages )
@@ -306,7 +306,7 @@
           dword_5B65D0_dialogue_actor_npc_id = pActors[uMessageParam].sNPC_ID;
           pActor = &pActors[uMessageParam];
           //goto _actor_init_dlg;
-          pActor->InitializeDialogue(1);
+          GameUI_InitializeDialogue(pActor, true);
           continue;
         case UIMSG_StartHireling1Dialogue:
         case UIMSG_StartHireling2Dialogue:
@@ -359,7 +359,7 @@
               memset(&actor, 0, 0x344u);
               actor.sNPC_ID += -1 - (unsigned __int8)pParty->field_709 - hireling_idx;
               pActor = &actor;
-              pActor->InitializeDialogue(1);
+              GameUI_InitializeDialogue(&actor, true);
             }
           }
           continue;
@@ -406,7 +406,7 @@
             pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
           pGUIWindow_CurrentMenu->Release();
           pCurrentScreen = SCREEN_LOADGAME;
-          GameUI_DrawLoadMenu(1);
+          LoadUI_Load(1);
           continue;
         case UIMSG_Quit:
           if ( dword_6BE138 == 132 || uMessageParam )
@@ -515,7 +515,7 @@
         case UIMSG_Game_OpenSaveGameDialog:
           pGUIWindow_CurrentMenu->Release();
           pCurrentScreen = SCREEN_SAVEGAME;
-          GameUI_DrawSaveMenu();
+          SaveUI_Load();
           continue;
         case UIMSG_Game_OpenOptionsDialog://Open
           if ( pMessageQueue_50CBD0->uNumMessages )
@@ -2493,7 +2493,7 @@
           continue;
         case UIMSG_RentRoom:
           dword_506F14 = 2;
-          RestUI_Initialize();
+          RestUI_Load();
           v86 = 60 * (_494820_training_time(pParty->uCurrentHour) + 1) - pParty->uCurrentMinute;
           _506F18_num_hours_to_sleep = v86;
           if ( uMessageParam == 111 || uMessageParam == 114 || uMessageParam == 116 )
@@ -2534,7 +2534,7 @@
           }
           if ( !(pParty->uFlags & 0x88) )
           {
-            RestUI_Initialize();
+            RestUI_Load();
             continue;
           }
           if ( pParty->bTurnBasedModeOn == 1 )
@@ -5416,10 +5416,7 @@
   }
   else
   {
-    result = (flt_4E4A80[v2] - *(float *)&aAuthenticamd[4 * v2 + 12])
-           * (v3 - flt_4E4A80[v2 + 4])
-           / (flt_4E4A80[v2 + 5] - flt_4E4A80[v2 + 4])
-           + flt_4E4A80[v2];
+    result = (flt_4E4A80[v2] - flt_4E4A80[v2 - 3]) * (v3 - flt_4E4A80[v2 + 4]) / (flt_4E4A80[v2 + 5] - flt_4E4A80[v2 + 4]) + flt_4E4A80[v2];
   }
   return result;
 }
@@ -10071,7 +10068,7 @@
 void GUI_UpdateWindows() 
 {
   GUIWindow *pWindow; // esi@4
-  unsigned int pWindowType; // eax@4
+  //unsigned int pWindowType; // eax@4
   char *pHint; // edx@66
   GUIButton *pButtonPtr_1C; // ebp@79
   char *pHint1; // edx@80
@@ -10099,7 +10096,6 @@
   for ( i = 1; i <= uNumVisibleWindows; ++i )
   {
     pWindow = &pWindowList[pVisibleWindowsIdxs[i] - 1];
-    pWindowType = pWindow->eWindowType;
     switch (pWindow->eWindowType)
     {
       case WINDOW_OptionsButtons:
@@ -10126,7 +10122,7 @@
       }
       case WINDOW_Dialogue:
       {
-        DrawDialogueUI();
+        GameUI_DrawDialogue();
         continue;
       }
       case WINDOW_QuickReference:
@@ -10151,7 +10147,7 @@
       }
       case WINDOW_GreetingNPC:
       {
-        DrawBranchlessDialogueUI();
+        GameUI_DrawBranchlessDialogue();
         continue;
       }
       case WINDOW_Chest:
@@ -10171,12 +10167,12 @@
       }
       case WINDOW_SaveLoadButtons:
       {
-        sub_4606FE();
+        SaveUI_Draw();
         continue;
       }
       case WINDOW_MainMenu_Load:
       {
-        GameUI_MainMenu_DrawLoad();
+        LoadUI_Draw();
         continue;
       }
       case WINDOW_HouseInterior:
@@ -10439,7 +10435,7 @@
         pButton = (GUIButton *)pWindow->ptr_1C;
         pRenderer->DrawTextureIndexed(pWindow->uFrameY,
                                       pWindow->uFrameX, pButton->pTextures[0]);
-        viewparams->bRedrawGameUI = 1;
+        viewparams->bRedrawGameUI = true;
         continue;
       }
       case WINDOW_CharacterWindow_Inventory:
@@ -10486,7 +10482,7 @@
 }
 
 //----- (00416196) --------------------------------------------------------
-void __cdecl identify_item()
+void identify_item()
 {
   Player *v0; // esi@2
   POINT *v1; // edi@2
@@ -10774,13 +10770,7 @@
       pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0);
 
       pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
-      /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-      {
-        pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
-        pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
-        *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-        ++pMessageQueue_50CBD0->uNumMessages;
-      }*/
+
       v42 = (int *)&a2.y;
       v41 = (int *)&y.y;
       v40 = (int *)&pOut;
@@ -10852,13 +10842,7 @@
       pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0);
 
       pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
-      /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-      {
-        pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
-        pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
-        *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-        ++pMessageQueue_50CBD0->uNumMessages;
-      }*/
+
       v42 = (int *)&a2.y;
       v41 = (int *)&y.y;
       v40 = (int *)&pOut;
@@ -10925,7 +10909,7 @@
 
 
 //----- (00416B01) --------------------------------------------------------
-void __thiscall sub_416B01(void *_this)//PopupWindowForBenefitAndJoinText
+void GameUI_DrawNPCPopup(void *_this)//PopupWindowForBenefitAndJoinText
 {
   int v1; // edi@2
   int v2; // ecx@2