diff Actor.cpp @ 959:f8dd764fb7d7

ExitCharacterWindow and other
author Ritor1
date Fri, 03 May 2013 17:38:30 +0600
parents 5a2dbb00c399
children c8a0f6d89c70
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);