diff GUIWindow.cpp @ 423:88c30918eef7

NPC_EventProcessor
author Gloval
date Sat, 23 Feb 2013 23:09:48 +0400
parents c0700eaabeb8
children afad358dc684
line wrap: on
line diff
--- a/GUIWindow.cpp	Sat Feb 23 19:35:32 2013 +0400
+++ b/GUIWindow.cpp	Sat Feb 23 23:09:48 2013 +0400
@@ -1760,26 +1760,20 @@
   //GUIWindow *pWindow; // esi@4
   int v10; // eax@4
   unsigned int v11; // ebx@15
-  NPCData *v12; // ebp@15
-  void *v13; // ecx@18
-  bool v14; // eax@20
-  void *v15; // ecx@23
-  bool v16; // eax@25
-  void *v17; // ecx@28
-  bool v18; // eax@30
-  void *v19; // ecx@33
-  bool v20; // eax@35
-  void *v21; // ecx@38
-  bool v22; // eax@40
-  void *v23; // ecx@43
-  bool v24; // eax@45
+  NPCData *speakingNPC; // ebp@15
+  int v14; // eax@20
+  int v16; // eax@25
+  int v18; // eax@30
+  int v20; // eax@35
+  int v22; // eax@40
+  int v24; // eax@45
   int v25; // eax@65
   unsigned int v26; // ebx@65
   char *v27; // eax@71
   const char *v29; // [sp-8h] [bp-18h]@68
   char *v30; // [sp-4h] [bp-14h]@68
   int uWidtha; // [sp+14h] [bp+4h]@66
-  int a4a; // [sp+20h] [bp+10h]@15
+  int num_menu_buttons; // [sp+20h] [bp+10h]@15
 
   for (uNextFreeWindowID = 0; uNextFreeWindowID < 20; ++uNextFreeWindowID)
   {
@@ -1819,95 +1813,89 @@
                          (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : 0), 0);
           if ( pWindow->ptr_1C != (void *)1 )
           {
-            a4a = 0;
+            num_menu_buttons = 0;
             v11 = LOBYTE(pFontArrus->uFontHeight) - 3;
-            v12 = GetNPCData(uDialogue_SpeakingActorNPC_ID);
+            speakingNPC = GetNPCData(uDialogue_SpeakingActorNPC_ID);
             if ( sub_445C8B(uDialogue_SpeakingActorNPC_ID) == 1 )
             {
-              if ( v12->joins )
+              if ( speakingNPC->joins )
               {
                 pWindow->CreateButton(480, 130, 140, v11, 1, 0, 0x88u, 0xDu, 0, "", 0);
-                a4a = 1;
+                num_menu_buttons = 1;
               }
-              v13 = (void *)v12->evt_A;
-              if ( v13 )
+              if ( speakingNPC->evt_A )
               {
-                if ( a4a < 4 )
+                if ( num_menu_buttons < 4 )
                 {
-                  v14 = sub_4466C4(v13);
+                  v14 = NPC_EventProcessor(speakingNPC->evt_A);
                   if ( v14 == 1 || v14 == 2 )
-                    pWindow->CreateButton(0x1E0u, a4a++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x13u, 0, "", 0);
+                    pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x13u, 0, "", 0);
                 }
               }
-              v15 = (void *)v12->evt_B;
-              if ( v15 )
+              if ( speakingNPC->evt_B )
               {
-                if ( a4a < 4 )
+                if ( num_menu_buttons < 4 )
                 {
-                  v16 = sub_4466C4(v15);
+                  v16 = NPC_EventProcessor(speakingNPC->evt_B);
                   if ( v16 == 1 || v16 == 2 )
-                    pWindow->CreateButton(0x1E0u, a4a++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x14u, 0, "", 0);
+                    pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x14u, 0, "", 0);
                 }
               }
-              v17 = (void *)v12->evt_C;
-              if ( v17 )
+              if ( speakingNPC->evt_C )
               {
-                if ( a4a < 4 )
+                if ( num_menu_buttons < 4 )
                 {
-                  v18 = sub_4466C4(v17);
+                  v18 = NPC_EventProcessor(speakingNPC->evt_C);
                   if ( v18 == 1 || v18 == 2 )
-                    pWindow->CreateButton( 0x1E0u, a4a++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x15u, 0, "", 0);
+                    pWindow->CreateButton( 0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x15u, 0, "", 0);
                 }
               }
-              v19 = (void *)v12->evt_D;
-              if ( v19 )
+              if ( speakingNPC->evt_D )
               {
-                if ( a4a < 4 )
+                if ( num_menu_buttons < 4 )
                 {
-                  v20 = sub_4466C4(v19);
+                  v20 = NPC_EventProcessor(speakingNPC->evt_D);
                   if ( v20 == 1 || v20 == 2 )
-                    pWindow->CreateButton(0x1E0u, a4a++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x16u, 0, "", 0);
+                    pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x16u, 0, "", 0);
                 }
               }
-              v21 = (void *)v12->evt_E;
-              if ( v21 )
+              if ( speakingNPC->evt_E )
               {
-                if ( a4a < 4 )
+                if ( num_menu_buttons < 4 )
                 {
-                  v22 = sub_4466C4(v21);
+                  v22 = NPC_EventProcessor(speakingNPC->evt_E);
                   if ( v22 == 1 || v22 == 2 )
-                    pWindow->CreateButton(0x1E0u, a4a++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x17u, 0, "", 0);
+                    pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x17u, 0, "", 0);
                 }
               }
-              v23 = (void *)v12->evt_F;
-              if ( v23 )
+              if (speakingNPC->evt_F )
               {
-                if ( a4a < 4 )
+                if ( num_menu_buttons < 4 )
                 {
-                  v24 = sub_4466C4(v23);
+                  v24 = NPC_EventProcessor(speakingNPC->evt_F);
                   if ( v24 == 1 || v24 == 2 )
-                    pWindow->CreateButton(0x1E0u, a4a++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x18u, 0, "", 0);
+                    pWindow->CreateButton(0x1E0u, num_menu_buttons++ * v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x18u, 0, "", 0);
                 }
               }
             }
             else
             {
-              if ( v12->joins )
+              if ( speakingNPC->joins )
               {
                 pWindow->CreateButton(0x1E0u, 0x82u, 0x8Cu, v11, 1, 0, 0x88u, 0x4Du, 0, pGlobalTXT_LocalizationStrings[407], 0);//Подробнее
-                if (v12->Hired())
+                if (speakingNPC->Hired())
                 {
-                  sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], v12->pName); //Отпустить
+                  sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], speakingNPC->pName); //Отпустить
                   pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x4Cu, 0, pTmpBuf, 0);
                 }
                 else
                 {
                   pWindow->CreateButton(0x1E0u, v11 + 130, 0x8Cu, v11, 1, 0, 0x88u, 0x4Cu, 0, pGlobalTXT_LocalizationStrings[406], 0);//Нанять
                 }
-                a4a = 2;
+                num_menu_buttons = 2;
               }
             }
-            pWindow->_41D08F(a4a, 1, 0, 1);
+            pWindow->_41D08F(num_menu_buttons, 1, 0, 1);
           }
           break;
         case WINDOW_ChangeLocation:
@@ -1955,7 +1943,7 @@
         if ( v26 + 1 == v25 && uHouse_ExitPic )
         {
           v30 = pMapStats->pInfos[uHouse_ExitPic].pName;
-          v29 = (char*)pGlobalTXT_LocalizationStrings[411];//Войти в ^Pv[%s]
+          v29 = (char*)pGlobalTXT_LocalizationStrings[LOCSTR_ENTER_S];//Войти в ^Pv[%s]
         }
         else
         {
@@ -1965,7 +1953,7 @@
             //v27 = (char *)p2DEvents_minus1_::08[13 * a4];
             v27 = (char *)p2DEvents[pButton - 1].pProprieterName;
           v30 = v27;
-          v29 = (char*)pGlobalTXT_LocalizationStrings[435];//Побеседовать с ^Pt[%s]
+          v29 = (char*)pGlobalTXT_LocalizationStrings[435];// "Converse with %s" Побеседовать с ^Pt[%s]
         }
         sprintf(&byte_591180[100 * v26], v29, v30);
         array_5913D8[v26 + 7] = (NPCData *)pWindow->CreateButton(*(&pNPCPortraits_x + v26 + 6 * uNumDialogueNPCPortraits - 6),