changeset 199:66db86fa4ed2

Hireling dialogues
author Nomad
date Sat, 16 Feb 2013 22:20:51 +0200
parents e6e348d66a75
children 1527f66fd81b
files GUIWindow.h mm7_5.cpp
diffstat 2 files changed, 42 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.h	Sat Feb 16 21:46:07 2013 +0200
+++ b/GUIWindow.h	Sat Feb 16 22:20:51 2013 +0200
@@ -222,8 +222,8 @@
   UIMSG_SetGraphicsMode = 0x83,
   UIMSG_Quit = 0x84,
   UIMSG_85 = 0x85,
-  UIMSG_86 = 0x86,
-  UIMSG_87 = 0x87,
+  UIMSG_StartHireling1Dialogue = 0x86,
+  UIMSG_StartHireling2Dialogue = 0x87,
   UIMSG_88 = 0x88,
   UIMSG_8C = 0x8C,
   UIMSG_8D = 0x8D,
--- a/mm7_5.cpp	Sat Feb 16 21:46:07 2013 +0200
+++ b/mm7_5.cpp	Sat Feb 16 22:20:51 2013 +0200
@@ -69,9 +69,9 @@
   unsigned int v2; // edx@7
   Actor *pActor; // ecx@13
   int v4; // ecx@18
-  NPCData *pNPCData0; // eax@18
-  int v6; // edx@20
-  int v7; // ecx@29
+  //NPCData *pNPCData0; // eax@18
+  //int v6; // edx@20
+  //int v7; // ecx@29
   unsigned int v8; // edx@59
   unsigned int v9; // ecx@60
   unsigned int v10; // ecx@73
@@ -244,7 +244,7 @@
   const char *v177; // [sp+0h] [bp-5FCh]@629
   char *v178; // [sp+0h] [bp-5FCh]@637
   int v179; // [sp+4h] [bp-5F8h]@0
-  signed int _this; // [sp+14h] [bp-5E8h]@22
+  //signed int _this; // [sp+14h] [bp-5E8h]@22
   signed int thisa; // [sp+14h] [bp-5E8h]@251
   signed int thisb; // [sp+14h] [bp-5E8h]@272
   Player *pPlayer7; // [sp+14h] [bp-5E8h]@373
@@ -333,44 +333,49 @@
           //goto _actor_init_dlg;
           pActor->InitializeDialogue(v0);
           continue;
-        case UIMSG_86:
-        case UIMSG_87:
-          if ( bNoNPCHiring != 1 && !pCurrentScreen )
-          {
+        case UIMSG_StartHireling1Dialogue:
+        case UIMSG_StartHireling2Dialogue:
+        {
+          if (bNoNPCHiring || pCurrentScreen)
+            continue;
+
             if ( pMessageQueue_50CBD0->uNumMessages )
               pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
             uAction = 0;
             uNumSeconds = uMessage - 134;
             v4 = 0;
-            pNPCData0 = pParty->pHirelings;
-            do
-            {
-              if ( pNPCData0->pName )
-              {
-                v6 = uAction++;
-                pTmpBuf[v6] = v4;
-              }
-              ++pNPCData0;
-              ++v4;
-            }
-            while ( (signed int)pNPCData0 < (signed int)&pParty->pPickedItem );
-            _this = 0;
-            if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
-            {
-              pNPCData4 = pNPCStats->pNewNPCData;
-              do
-              {
-                if ( pNPCData4->uFlags & 0x80
-                  && (!pParty->pHirelings[0].pName || strcmp(pNPCData4->pName, pParty->pHirelings[0].pName))
-                  && (!pParty->pHirelings[1].pName || strcmp(pNPCData4->pName, pParty->pHirelings[1].pName)) )
+
+            for (uint i = 0; i < 2; ++i)
+            //pNPCData0 = pParty->pHirelings;
+            //do
+            {
+              if (pParty->pHirelings[i].pName)
+              //{
+                //v6 = uAction++;
+                pTmpBuf[uAction++] = i;
+              //}
+              //++pNPCData0;
+              //++v4;
+            }
+            //while ( (signed int)pNPCData0 < (signed int)&pParty->pPickedItem );
+
+            //_this = 0;
+            for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i)
+            {
+              auto npc = pNPCStats->pNewNPCData + i;
+              //do
+              //{
+                if (npc->uFlags & 0x80 &&
+                    (!pParty->pHirelings[0].pName || strcmp(npc->pName, pParty->pHirelings[0].pName)) &&
+                    (!pParty->pHirelings[1].pName || strcmp(npc->pName, pParty->pHirelings[1].pName)) )
                 {
-                  v7 = uAction++;
-                  pTmpBuf[v7] = _this + 2;
+                  //v7 =;
+                  pTmpBuf[uAction++] = i + 2;
                 }
-                ++_this;
-                ++pNPCData4;
-              }
-              while ( _this < (signed int)pNPCStats->uNumNewNPCs );
+                //++_this;
+                //++pNPCData4;
+              //}
+              //while ( _this < (signed int)pNPCStats->uNumNewNPCs );
             }
             if ( (signed int)(uNumSeconds + (unsigned __int8)pParty->field_709) < uAction )
             {