changeset 218:40a701e77564

Слияние
author Ritor1
date Sun, 17 Feb 2013 01:45:25 +0600
parents 484f6020dfde (current diff) 1527f66fd81b (diff)
children f7c268995788
files
diffstat 5 files changed, 55 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/GUIFont.cpp	Sun Feb 17 01:45:17 2013 +0600
+++ b/GUIFont.cpp	Sun Feb 17 01:45:25 2013 +0600
@@ -1,4 +1,6 @@
 #include <string>
+#include <assert.h>
+
 #include "LOD.h"
 #include "GUIFont.h"
 #include "GUIWindow.h"
@@ -23,11 +25,11 @@
 
 char temp_string[2048];
 
-char pTmpBuf3[2048];
+char pTmpBuf3[10000];
 
 //----- (0044C448) --------------------------------------------------------
 GUIFont *LoadFont(const char *pFontFile, const char *pFontPalette, ...)
-	{
+{
 	
 	int pallete_index; // eax@3
 	GUIFont *pFont;
@@ -348,6 +350,8 @@
   v8 = strlen(pString);
   v9 = v8;
   v39 = v8;
+
+  assert(strlen(v6) < sizeof(pTmpBuf3));
   strcpy(pTmpBuf3, v6);
   v10 = a5;
   v11 = v35;
--- a/GUIWindow.cpp	Sun Feb 17 01:45:17 2013 +0600
+++ b/GUIWindow.cpp	Sun Feb 17 01:45:25 2013 +0600
@@ -1796,7 +1796,6 @@
   int uWidtha; // [sp+14h] [bp+4h]@66
   int a4a; // [sp+20h] [bp+10h]@15
 
-  uNextFreeWindowID = 0;
   for (uNextFreeWindowID = 0; uNextFreeWindowID < 20; ++uNextFreeWindowID)
   {
     if (pWindowList[uNextFreeWindowID].eWindowType == WINDOW_null)
--- a/GUIWindow.h	Sun Feb 17 01:45:17 2013 +0600
+++ b/GUIWindow.h	Sun Feb 17 01:45:25 2013 +0600
@@ -94,6 +94,12 @@
 #pragma pack(push, 1)
 struct GUIWindow
 {
+  inline GUIWindow()
+  {
+    pControlsHead = pControlsTail = nullptr;
+    eWindowType = WINDOW_null;
+  }
+
   GUIButton *CreateButton(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, int a6, int a7, 
 	         unsigned int uControlID, unsigned int uControlParam, unsigned __int8 uHotkey, const char *pName, Texture *pTextures, ...);
   void DrawFlashingInputCursor(signed int a3, int a4, struct GUIFont *a2);
@@ -222,8 +228,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	Sun Feb 17 01:45:17 2013 +0600
+++ b/mm7_5.cpp	Sun Feb 17 01:45:25 2013 +0600
@@ -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 )
             {
--- a/mm7_data.h	Sun Feb 17 01:45:17 2013 +0600
+++ b/mm7_data.h	Sun Feb 17 01:45:25 2013 +0600
@@ -1372,7 +1372,7 @@
 extern int dword_5C35D4; // weak
 extern char *aAMPMNames[2];
 extern char byte_5C45AF[]; // weak
-extern char pTmpBuf3[2048];
+extern char pTmpBuf3[];
 extern char pFinalMessage[4096]; // idb
 extern char pTmpBuf[2000];
 extern char pTmpBuf2[2000];