changeset 959:f8dd764fb7d7

ExitCharacterWindow and other
author Ritor1
date Fri, 03 May 2013 17:38:30 +0600
parents 9c2d08e42ed3
children 9a5db2cf999a
files Actor.cpp GUIWindow.h mm7_5.cpp
diffstat 3 files changed, 42 insertions(+), 68 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Thu May 02 17:58:32 2013 +0600
+++ b/Actor.cpp	Fri May 03 17:38:30 2013 +0600
@@ -167,41 +167,22 @@
 //----- (00445D4A) --------------------------------------------------------
 void Actor::InitializeDialogue(int bPlayerSaysHello)
 {
-  Actor *v2; // esi@1
-  signed int v3; // ecx@1
-  NPCData *v4; // eax@1
-  NPCData *v5; // ebp@1
-  unsigned int v6; // eax@1
-  //signed int v7; // eax@3
-  //unsigned int v8; // eax@8
+  NPCData *pNPCInfo; // ebp@1
   int v9; // esi@8
-  int v10; // eax@11
-  GUIWindow *v11; // ecx@19
-  signed int v12; // eax@21
-  //int v13; // [sp-8h] [bp-44h]@34
-  //const char *v14; // [sp-4h] [bp-40h]@4
-  //int v15; // [sp-4h] [bp-40h]@34
-  signed int v16; // [sp-4h] [bp-40h]@35
-  int v17; // [sp+10h] [bp-2Ch]@1
+  int pNumberContacts; // eax@11
   char pContainer[32]; // [sp+14h] [bp-28h]@3
 
-  auto a1 = this;
-  v2 = a1;
-  v17 = bPlayerSaysHello;
   dword_A74CDC = -1;
   dword_AE336C = -1;
   pEventTimer->Pause();
   pMiscTimer->Pause();
   pAudioPlayer->StopChannels(-1, -1);
   uDialogueType = 0;
-  v3 = v2->sNPC_ID;
-  sDialogue_SpeakingActorNPC_ID = v2->sNPC_ID;
-  pDialogue_SpeakingActor = v2;
-  v4 = GetNPCData(v3);
-  v5 = v4;
-  v6 = v4->uFlags;
-  if ( (v6 & 3) != 2 )
-    v5->uFlags = v6 + 1;
+  sDialogue_SpeakingActorNPC_ID = this->sNPC_ID;
+  pDialogue_SpeakingActor = this;
+  pNPCInfo = GetNPCData(this->sNPC_ID);
+  if ( (pNPCInfo->uFlags & 3) != 2 )
+    pNPCInfo->uFlags = pNPCInfo->uFlags + 1;
 
   switch (pParty->alignment)
   {
@@ -213,69 +194,58 @@
   pDialogueNPCCount = 0;
   uNumDialogueNPCPortraits = 1;
   pTexture_Dialogue_Background = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE);
-  sprintf(pContainer, "npc%03u", v5->uPortraitID);
+  sprintf(pContainer, "npc%03u", pNPCInfo->uPortraitID);
   v9 = 0;
   pDialogueNPCPortraits[0] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE);
   dword_591084 = areWeLoadingTexture;
   uTextureID_right_panel_loop = uTextureID_right_panel;
-  if ( !v5->Hired() && v5->Location2D >= 0 )
+  if ( !pNPCInfo->Hired() && pNPCInfo->Location2D >= 0 )
   {
-    if ( (signed int)pParty->GetPartyFame() <= v5->fame
-      || (v10 = v5->uFlags & 0xFFFFFF7F, (v5->uFlags & 0xFFFFFF7F & 0x80000000u) != 0) )
+    if ( (signed int)pParty->GetPartyFame() <= pNPCInfo->fame
+      || (pNumberContacts = pNPCInfo->uFlags & 0xFFFFFF7F, (pNumberContacts & 0x80000000u) != 0) )
     {
       v9 = 1;
     }
 	else
 	{
-		if ( v10 > 1 )
+		if ( pNumberContacts > 1 )
 		{
-		  if ( v10 == 2 )
+		  if ( pNumberContacts == 2 )
 		  {
-			v16 = 3;
-			v9 = v16;
+			v9 = 3;
 		  }
 		  else
 		  {
-			  if ( v10 != 3 )
+			  if ( pNumberContacts != 3 )
 			  {
-				if ( v10 != 4 )
+				if ( pNumberContacts != 4 )
 				  v9 = 1;
 			  }
 			  else
 			  {
-				v16 = 2;
-				v9 = v16;
+				v9 = 2;
 			  }
 		  }
 		}
-		else if ( v5->rep )
+		else if ( pNPCInfo->rep )
 		{
-		  v16 = 2;
-		  v9 = v16;
+		  v9 = 2;
 		}
 	}
   }
   if ( (sDialogue_SpeakingActorNPC_ID & 0x80000000u) != 0 )
     v9 = 4;
-  v11 = GUIWindow::Create(0, 0, 640, 480, WINDOW_Rest, v9, 0);
-  pDialogueWindow = v11;
-  if (v5->Hired())
+  pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, v9, 0);//pNumberContacts = 1, v9 = 0; pNumberContacts = 2, v9 = 3;
+  if (pNPCInfo->Hired())
   {
-    if ( !v5->bHasUsedTheAbility )
+    if ( !pNPCInfo->bHasUsedTheAbility )
     {
-      v12 = v5->uProfession;
-      if ( v12 >= 10 )
+      if ( pNPCInfo->uProfession >= 10 )
       {
-        if ( v12 <= 12 || v12 > 32 && (v12 <= 34 || v12 > 38 && (v12 <= 43 || v12 == 52)) )
+        if ( pNPCInfo->uProfession <= 12 || pNPCInfo->uProfession > 32 && (pNPCInfo->uProfession <= 34 
+             || pNPCInfo->uProfession > 38 && (pNPCInfo->uProfession <= 43 || pNPCInfo->uProfession == 52)) )
         {
-          v11->CreateButton(480, 250, 140, LOBYTE(pFontArrus->uFontHeight) - 3,
-            1,
-            0,
-            UIMSG_SelectNPCDialogueOption,
-            9,
-            0,
-            "",
-            0);
+          pDialogueWindow->CreateButton(480, 250, 140, LOBYTE(pFontArrus->uFontHeight) - 3, 1, 0, UIMSG_SelectNPCDialogueOption, 9, 0, "", 0);
           pDialogueWindow->_41D08F(4, 1, 0, 1);
         }
       }
@@ -287,7 +257,7 @@
   pDialogueWindow->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0);
   pDialogueWindow->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0);
 
-  if (v17 && uActiveCharacter && !v5->Hired())
+  if (bPlayerSaysHello && uActiveCharacter && !pNPCInfo->Hired())
   {
     if (pParty->uCurrentHour < 5 || pParty->uCurrentHour > 21)
       pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodEvening, 0);
--- a/GUIWindow.h	Thu May 02 17:58:32 2013 +0600
+++ b/GUIWindow.h	Fri May 03 17:38:30 2013 +0600
@@ -260,7 +260,7 @@
   WINDOW_Options = 0x6,
   WINDOW_8 = 8,
   WINDOW_Book = 0x9,
-  WINDOW_Dialogue = 0xA,
+  WINDOW_Dialogue = 10,
   WINDOW_QuickReference = 12,
   WINDOW_Rest = 16,
   WINDOW_ChangeLocation = 17,
@@ -283,8 +283,8 @@
   WINDOW_5D = 0x5D,
   WINDOW_5E = 94,
   WINDOW_5F = 0x5F,
-  WINDOW_60 = 96,
-  WINDOW_61 = 0x61,
+  WINDOW_ExitRestWindow = 96,
+  WINDOW_ExitCharacterWindow = 0x61,
   WINDOW_RestWindow = 0x62,
   WINDOW_63 = 99,
   WINDOW_CharacterWindow_Stats = 0x64,
--- a/mm7_5.cpp	Thu May 02 17:58:32 2013 +0600
+++ b/mm7_5.cpp	Fri May 03 17:38:30 2013 +0600
@@ -438,6 +438,7 @@
           stru_506E40.Release();
           continue;
         case UIMSG_80:
+			__debugbreak;
           pIcons_LOD->_40F9C5();
           pIcons_LOD->_4114F2();
           pGUIWindow_CurrentMenu->Release();
@@ -457,7 +458,7 @@
           GUIWindow::Create(215, 323, 17, 17, WINDOW_5A, (int)pBtnDownArrow, 0);
           continue;
         case UIMSG_Cancel:
-          GUIWindow::Create(350, 302, 106, 42, WINDOW_60, (int)pBtnCancel, 0);
+          GUIWindow::Create(350, 302, 106, 42, WINDOW_ExitRestWindow, (int)pBtnCancel, 0);
           continue;
         case UIMSG_LoadSlot:
           GUIWindow::Create(241, 302, 106, 42, WINDOW_5E, (int)pBtnLoadSlot, 0);
@@ -1283,6 +1284,7 @@
                        pIcons_LOD->_4355F7();
                        continue;
                     case SCREEN_E:
+						__debugbreak;
                       pGUIWindow_CurrentMenu->Release();
                       pCurrentScreen = SCREEN_HOUSE;
                       pIcons_LOD->_4114F2();
@@ -10404,7 +10406,7 @@
   unsigned int v29; // eax@111
   GUIFont *pGUIFont; // ST1C_4@115
   int v31; // eax@115
-  void *v32; // ebp@118
+  GUIButton *pButton; // ebp@118
   int v33; // eax@119
   int v34; // eax@120
   int v35; // eax@121
@@ -10440,6 +10442,7 @@
 			break;
 			}
 		case WINDOW_5E: // window that initiates savegame loading
+			__debugbreak;
 			{
 			if (pWindow->Hint != (char *)1)
 				pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
@@ -10537,6 +10540,7 @@
 			}
 		case WINDOW_17:
 			{
+			__debugbreak;
 			sub_4606FE();
 			break;
 			}
@@ -10569,7 +10573,7 @@
 			pGUIWindow2->Release();
 			break;
 			}
-		case WINDOW_60:
+		case WINDOW_ExitRestWindow:
 			{
 			if ( pWindow->Hint != (char *)1 )
 				pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
@@ -10583,16 +10587,16 @@
 			pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
 			break;
 			}
-		case WINDOW_61:
+		case WINDOW_ExitCharacterWindow:
 			{
-			if ( pWindow->Hint != (char *)1 )//pWindowType == WINDOW_61
+			if ( pWindow->Hint != (char *)1 )
 				pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
-			v32 = pWindow->ptr_1C;
-			pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)v32 + 16));
+			pButton = (GUIButton *)pWindow->ptr_1C;
+			pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]);
 			pHint = pWindow->Hint;
 			viewparams->bRedrawGameUI = 1;
 			if ( pHint && pHint != (char *)1 )
-				((GUIButton *)v32)->DrawLabel(pHint, pFontCreate, 0, 0);
+				pButton->DrawLabel(pHint, pFontCreate, 0, 0);
 			pWindow->Release();
 			pNumMessages = pMessageQueue_50CBD0->uNumMessages;
 			pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);