diff mm7_4.cpp @ 248:37dcbe8f3cca

Dialogue stuff
author Nomad
date Mon, 18 Feb 2013 07:11:43 +0200
parents c879446b4a22
children 9a8d37c07e50
line wrap: on
line diff
--- a/mm7_4.cpp	Mon Feb 18 03:59:31 2013 +0200
+++ b/mm7_4.cpp	Mon Feb 18 07:11:43 2013 +0200
@@ -3519,7 +3519,7 @@
       }
     }
     v44 = 0;
-    if ( sub_476387() == 1 )
+    if (PartyHasDragon())
       v44 = 1;
     v49 = 0;
 LABEL_25:
@@ -4905,11 +4905,14 @@
   v60 = strlen(Str);
   a1[0] = 0;
   pPlayer = &pParty->pPlayers[v6];
-  v59 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
+  v59 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 155);
   v61 = pPlayer;
   memset(pTmpBuf2, 0, 0x7D0u);
   if ( dword_5C35D4 )
+  {
+    __debugbreak(); // fix
     v9 = array_5913D8[(unsigned int)((char *)array_5913D8[6] + -(dword_591080 != 0) - 1)];
+  }
   else
     v9 = GetNPCData(uDialogue_SpeakingActorNPC_ID);
   v65 = v9;
@@ -9404,7 +9407,7 @@
   char *v17; // ecx@63
   char *v18; // eax@65
   const char *v19; // ecx@68
-  unsigned int v20; // eax@69
+  //unsigned int v20; // eax@69
   unsigned int v21; // ecx@70
   char *v22; // [sp-Ch] [bp-18h]@73
   int v23; // [sp-8h] [bp-14h]@49
@@ -9427,7 +9430,7 @@
         ptr_F8B1E8 = (char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession);
         ptr_F8B1E8 = sub_495461((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0);
         sub_4B40E6();
-        byte_F8B1EC = 0;
+        dialogue_show_profession_details = false;
         goto _return;
       }
       switch ( a1 )
@@ -9494,13 +9497,13 @@
     if ( a1 == 77 )
     {
       v16 = v2->uProfession;
-      if ( byte_F8B1EC )
-        v17 = (char *)*(&pNPCStats->field_13A64 + 5 * v16);
+      if (dialogue_show_profession_details)
+        v17 = pNPCStats->pProfessions[v2->uProfession - 1].pJoinText;
       else
-        v17 = (char *)*(&pNPCStats->field_13A5C + 5 * v16);
+        v17 = pNPCStats->pProfessions[v2->uProfession - 1].pBenefits;
       ptr_F8B1E8 = v17;
       v18 = sub_495461(v17, uActiveCharacter - 1, 0, 0, 0, 0);
-      byte_F8B1EC ^= 1u;
+      dialogue_show_profession_details = ~dialogue_show_profession_details;
       ptr_F8B1E8 = v18;
     }
     else
@@ -9616,19 +9619,19 @@
     ShowStatusBarString(v19, 2u);
     goto _return;
   }
-  v20 = v2->uProfession;
-  if ( v20 != 51 )
-  {
-    v21 = *(&pNPCStats->field_13A58 + 5 * v20);
+  //v20 = v2->uProfession;
+  if ( v2->uProfession != 51 )
+  {
+    v21 = pNPCStats->pProfessions[v2->uProfession - 1].uHirePrice;
     if ( pParty->uNumGold < v21 )
     {
       ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
-      byte_F8B1EC = 0;
+      dialogue_show_profession_details = false;
       uDialogueType = 13;
-      ptr_F8B1E8 = (char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession);
+      ptr_F8B1E8 = pNPCStats->pProfessions[v2->uProfession - 1].pJoinText;
       ptr_F8B1E8 = sub_495461((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0);
       if ( uActiveCharacter )
-        pPlayers[uActiveCharacter]->PlaySound(SPEECH_38, 0);
+        pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0);
       v19 = pGlobalTXT_LocalizationStrings[155];
       goto LABEL_77;
     }
@@ -12538,17 +12541,17 @@
 }
 
 //----- (004BC49B) --------------------------------------------------------
-void __thiscall sub_4BC49B(unsigned int _this)
-{
-  unsigned int v1; // esi@1
+void OnSelectDialogueOption(DIALOGUE_TYPE newDialogueType)
+{
+  //unsigned int v1; // esi@1
   NPCData *v2; // ebp@1
-  unsigned int v3; // eax@1
+  //unsigned int v3; // eax@1
   int v4; // ecx@10
   signed int v5; // edi@14
   char *v6; // esi@15
   const char *v7; // ecx@22
   signed int v8; // edi@37
-  unsigned int v9; // eax@56
+  //unsigned int v9; // eax@56
   unsigned int v10; // ecx@57
   void *v11; // [sp-Ch] [bp-1Ch]@46
   int v12; // [sp-8h] [bp-18h]@46
@@ -12556,36 +12559,36 @@
   size_t v14; // [sp-4h] [bp-14h]@46
   const char *v15; // [sp-4h] [bp-14h]@60
 
-  v1 = _this;
+  //v1 = _this;
   v2 = GetNPCData(uDialogue_SpeakingActorNPC_ID);
-  v3 = v1;
-  uDialogueType = v1;
+  //v3 = v1;
+  uDialogueType = newDialogueType;
   if ( !v2->uFlags )
   {
     v2->uFlags = 1;
-    v3 = uDialogueType;
-  }
-  if ( (signed int)v3 > 22 )
-  {
-    if ( v3 == 23 )
+    //v3 = uDialogueType;
+  }
+  if ( (signed int)newDialogueType > 22 )
+  {
+    if ( newDialogueType == DIALOGUE_23 )
     {
       v4 = v2->evte;
       goto LABEL_74;
     }
-    if ( v3 == 24 )
+    if (newDialogueType == DIALOGUE_24)
     {
       v4 = v2->evtf;
       goto LABEL_74;
     }
-    if ( v3 != 76 )
-    {
-      if ( v3 == 77 )
-      {
-        byte_F8B1EC ^= 1u;
+    if (newDialogueType != DIALOGUE_76)
+    {
+      if (newDialogueType == DIALOGUE_PROFESSION_DETAILS)
+      {
+        dialogue_show_profession_details = ~dialogue_show_profession_details;
       }
       else
       {
-        if ( (signed int)v3 > 84 && (signed int)v3 <= 88 )
+        if ( (signed int)newDialogueType > 84 && (signed int)newDialogueType <= 88 )
         {
           ArenaFight();
           return;
@@ -12593,7 +12596,7 @@
       }
       goto LABEL_87;
     }
-    if ( v2->uFlags & 0x80 )
+    if (v2->Hired())
     {
       v8 = 0;
       if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
@@ -12646,17 +12649,17 @@
       ShowStatusBarString(v7, 2u);
       goto LABEL_87;
     }
-    v9 = v2->uProfession;
-    if ( v9 != 51 )
-    {
-      v10 = *(&pNPCStats->field_13A58 + 5 * v9);
+    //v9 = v2->uProfession;
+    if ( v2->uProfession != 51 )
+    {
+      v10 = pNPCStats->pProfessions[v2->uProfession - 1].uHirePrice;
       if ( pParty->uNumGold < v10 )
       {
         ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold"
-        byte_F8B1EC = 0;
+        dialogue_show_profession_details = false;
         uDialogueType = 13;
         if ( uActiveCharacter )
-          pPlayers[uActiveCharacter]->PlaySound(SPEECH_38, 0);
+          pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0);
         v7 = pGlobalTXT_LocalizationStrings[155];
         goto LABEL_64;
       }
@@ -12691,12 +12694,12 @@
       pPlayers[uActiveCharacter]->PlaySound(SPEECH_61, 0);
     goto LABEL_87;
   }
-  if ( v3 == 22 )
+  if (newDialogueType == DIALOGUE_22)
   {
     v4 = v2->evtd;
     goto LABEL_74;
   }
-  if ( v3 == 9 )
+  if (newDialogueType == DIALOGUE_9)
   {
     if ( !sub_4BB756(v2->uProfession) )
     {
@@ -12714,12 +12717,12 @@
     v7 = pGlobalTXT_LocalizationStrings[140];
     goto LABEL_64;
   }
-  if ( v3 == 13 )
-  {
-    if ( !(v2->uFlags & 0x80) )
+  if (newDialogueType == DIALOGUE_13)
+  {
+    if (!v2->Hired())
     {
       sub_4B3E1E();
-      byte_F8B1EC = 0;
+      dialogue_show_profession_details = false;
       goto LABEL_87;
     }
     v5 = 0;
@@ -12739,17 +12742,17 @@
     }
     goto LABEL_44;
   }
-  if ( v3 == 19 )
+  if (newDialogueType == DIALOGUE_19)
   {
     v4 = v2->bDrawSomeAnim;
     goto LABEL_74;
   }
-  if ( v3 == 20 )
+  if (newDialogueType == DIALOGUE_20)
   {
     v4 = v2->_anim_current_time;
     goto LABEL_74;
   }
-  if ( v3 == 21 )
+  if (newDialogueType == DIALOGUE_21)
   {
     v4 = v2->_anim_end_time;
 LABEL_74:
@@ -12778,7 +12781,7 @@
       }
       else
       {
-        dword_F8B1D8 = v3;
+        dword_F8B1D8 = newDialogueType;
         sub_4B3EF0(v4 - 400);
       }
     }