diff mm7_4.cpp @ 473:7f1b00901cf7

Skill learning menu in shops
author Gloval
date Tue, 26 Feb 2013 02:09:56 +0400
parents c43f156a95c9
children 77430756f06a
line wrap: on
line diff
--- a/mm7_4.cpp	Mon Feb 25 23:33:15 2013 +0400
+++ b/mm7_4.cpp	Tue Feb 26 02:09:56 2013 +0400
@@ -9080,9 +9080,9 @@
   int v18; // [sp+48h] [bp-4h]@5
 
   //v0 = pPlayers[uActiveCharacter];
-  if ( dword_F8B198 <= 0 )
+  if ( in_current_bilding_type <= 0 )
     return;
-  if ( dword_F8B198 <= 4 )
+  if ( in_current_bilding_type <= 4 )
   {
     if ( dword_F8B19C != 2 )
     {
@@ -9116,7 +9116,7 @@
 		v7 =&pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5];
     goto LABEL_15;
   }
-  if ( dword_F8B198 <= 16 && dword_F8B19C == 18 )
+  if ( in_current_bilding_type <= 16 && dword_F8B19C == 18 )
   {
     v1 = pMouse->GetCursorPos(&a2);
     v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v16)->y];
@@ -9180,19 +9180,19 @@
   int v6; // esi@20
   int v7[4]; // [sp+Ch] [bp-10h]@12
 
-  if ( dword_F8B198 > 0 )
+  if ( in_current_bilding_type > 0 )
   {
     v0 = 3;
-    if ( dword_F8B198 > 3 )
-    {
-      if ( dword_F8B198 == 22 )
+    if ( in_current_bilding_type > 3 )
+    {
+      if ( in_current_bilding_type == 22 )
       {
         if ( !dword_F8B1E4 )
           return;
       }
       else
       {
-        if ( dword_F8B198 != 23 )
+        if ( in_current_bilding_type != 23 )
           return;
       }
       v1 = (unsigned int)window_SpeakInHouse->ptr_1C;
@@ -10349,94 +10349,61 @@
 
 
 //----- (004B36CC) --------------------------------------------------------
-GUIButton *__fastcall sub_4B36CC(int a1, unsigned int a2)
-{
-  return pDialogueWindow->CreateButton(
-           0x1E0u,
-           30 * a1 + 146,
-           0x8Cu,
-           0x1Eu,
-           1,
-           0,
-           0x195u,
-           a2,
-           0,
-           "",
-           0);
+void CreateButtonInColumn( int column_pos, unsigned int control_id )
+	{
+     pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30,  1,  0, 0x195u,  control_id,  0,   "",   0);
 }
 
 
 
 //----- (004B3A72) --------------------------------------------------------
-int __thiscall sub_4B3A72(int a1)
-{
-  int v1; // esi@1
-  int result; // eax@4
-
-  v1 = 0;
+void sub_4B3A72( int a1 )
+	{
+  int num_buttons; // esi@1
+
+  num_buttons = 0;
   if ( a1 == 21 )
   {
-    sub_4B36CC(0, 0x66u);
-    v1 = 2;
-    sub_4B36CC(1, 0x67u);
-    if ( pParty->HasItem(0x28Bu) )
-    {
-      v1 = 3;
-      sub_4B36CC(2, 0x68u);
-    }
-  }
-  pDialogueWindow->_41D08F(v1, 1, 0, 2);
-  result = pDialogueWindow->pNumPresenceButton;
+    CreateButtonInColumn(0, 0x66u);
+    num_buttons = 2;
+    CreateButtonInColumn(1, 0x67u);
+	if ( pParty->HasItem(651) ) //Arcomage Deck
+    {
+      num_buttons = 3;
+      CreateButtonInColumn(2, 0x68u);
+    }
+  }
+  pDialogueWindow->_41D08F(num_buttons, 1, 0, 2);
   dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
-  return result;
 }
 // F8B1E0: using guessed type int dword_F8B1E0;
 
 //----- (004B3AD4) --------------------------------------------------------
-int __fastcall sub_4B3AD4(signed int a1)
-{
-  int result; // eax@7
-  int v2; // [sp-10h] [bp-10h]@4
-  int v3; // [sp-Ch] [bp-Ch]@4
-  int v4; // [sp-8h] [bp-8h]@4
-  int v5; // [sp-4h] [bp-4h]@4
-
+void sub_4B3AD4( signed int a1 )
+	{
   if ( a1 > 0 )
   {
     if ( a1 <= 3 )
     {
-      sub_4B36CC(0, 3u);
-      sub_4B36CC(1, 4u);
-      sub_4B36CC(2, 5u);
-      v5 = 2;
-      v4 = 0;
-      v3 = 1;
-      v2 = 3;
-      goto LABEL_6;
+      CreateButtonInColumn(0, 3u);
+      CreateButtonInColumn(1, 4u);
+      CreateButtonInColumn(2, 5u);
+       pDialogueWindow->_41D08F(3, 1, 0, 2);
     }
     if ( a1 == 4 )
     {
-      sub_4B36CC(0, 3u);
-      sub_4B36CC(1, 4u);
-      v5 = 2;
-      v4 = 0;
-      v3 = 1;
-      v2 = 2;
-LABEL_6:
-      pDialogueWindow->_41D08F(v2, v3, v4, v5);
-      goto LABEL_7;
-    }
-  }
-LABEL_7:
-  result = pDialogueWindow->pNumPresenceButton;
+      CreateButtonInColumn(0, 3u);
+      CreateButtonInColumn(1, 4u);
+      pDialogueWindow->_41D08F(2, 1, 0, 2);
+    }
+  }
   dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
-  return result;
 }
 // F8B1E0: using guessed type int dword_F8B1E0;
 
 //----- (004B3B42) --------------------------------------------------------
-int __fastcall sub_4B3B42(signed int a1)
-{
+void sub_4B3B42( signed int a1 )
+	{
   int v1; // ecx@18
   int v2; // ecx@19
   int v3; // ecx@20
@@ -10461,11 +10428,11 @@
     {
       if ( a1 == 23 )
       {
-        sub_4B36CC(0, 0xAu);
-        sub_4B36CC(1, 0xBu);
+        CreateButtonInColumn(0, 0xAu);
+        CreateButtonInColumn(1, 0xBu);
         v14 = 96;
 LABEL_41:
-        sub_4B36CC(2, v14);
+        CreateButtonInColumn(2, v14);
         v17 = 2;
         v11 = 0;
         v10 = 1;
@@ -10478,31 +10445,31 @@
       {
         if ( a1 != 30 )
           goto LABEL_43;
-        sub_4B36CC(0, 0x11u);
+        CreateButtonInColumn(0, 0x11u);
         v16 = 96;
         goto LABEL_37;
       }
-      sub_4B36CC(0, 0x69u);
-      sub_4B36CC(1, 0x6Au);
-      sub_4B36CC(2, 0x6Bu);
+      CreateButtonInColumn(0, 0x69u);
+      CreateButtonInColumn(1, 0x6Au);
+      CreateButtonInColumn(2, 0x6Bu);
       v12 = 108;
     }
     else
     {
       if ( a1 == 22 )
       {
-        sub_4B36CC(0, 7u);
+        CreateButtonInColumn(0, 7u);
         v16 = 8;
         goto LABEL_37;
       }
       v1 = a1 - 14;
       if ( !v1 )
       {
-        sub_4B36CC(0, 0x12u);
-        sub_4B36CC(1, 0x30u);
-        sub_4B36CC(2, 0x31u);
-        sub_4B36CC(3, 0x32u);
-        sub_4B36CC(4, 0x33u);
+        CreateButtonInColumn(0, 0x12u);
+        CreateButtonInColumn(1, 0x30u);
+        CreateButtonInColumn(2, 0x31u);
+        CreateButtonInColumn(3, 0x32u);
+        CreateButtonInColumn(4, 0x33u);
         v17 = 2;
         v11 = 0;
         v10 = 1;
@@ -10517,10 +10484,10 @@
         {
           if ( v3 != 4 )
             goto LABEL_43;
-          sub_4B36CC(0, 0xFu);
-          sub_4B36CC(1, 0x10u);
+          CreateButtonInColumn(0, 0xFu);
+          CreateButtonInColumn(1, 0x10u);
           v4 = 3;
-          sub_4B36CC(2, 0x60u);
+          CreateButtonInColumn(2, 0x60u);
           v5 = (signed int)window_SpeakInHouse->ptr_1C;
           if ( v5 < 108 || v5 > 120 )
             goto LABEL_28;
@@ -10531,7 +10498,7 @@
         else
         {
           v4 = 1;
-          sub_4B36CC(0, 0x63u);
+          CreateButtonInColumn(0, 0x63u);
           if ( !pParty->uFine )
           {
 LABEL_28:
@@ -10547,16 +10514,16 @@
           v7 = 1;
           v6 = 100;
         }
-        sub_4B36CC(v7, v6);
+        CreateButtonInColumn(v7, v6);
         goto LABEL_28;
       }
-      sub_4B36CC(0, 0x12u);
-      sub_4B36CC(1, 0x34u);
-      sub_4B36CC(2, 0x35u);
+      CreateButtonInColumn(0, 0x12u);
+      CreateButtonInColumn(1, 0x34u);
+      CreateButtonInColumn(2, 0x35u);
       v12 = 54;
     }
 LABEL_39:
-    sub_4B36CC(3, v12);
+    CreateButtonInColumn(3, v12);
     v17 = 2;
     v11 = 0;
     v10 = 1;
@@ -10565,10 +10532,10 @@
   }
   if ( a1 == 13 )
   {
-    sub_4B36CC(0, 0x12u);
+    CreateButtonInColumn(0, 0x12u);
     v16 = 56;
 LABEL_37:
-    sub_4B36CC(1, v16);
+    CreateButtonInColumn(1, v16);
     v17 = 2;
     v11 = 0;
     v10 = 1;
@@ -10581,56 +10548,54 @@
     case 2:
     case 3:
     case 4:
-      sub_4B36CC(0, 2u);
-      sub_4B36CC(1, 0x5Fu);
-      sub_4B36CC(2, 0x5Eu);
+      CreateButtonInColumn(0, 2u);
+      CreateButtonInColumn(1, 0x5Fu);
+      CreateButtonInColumn(2, 0x5Eu);
       v12 = 96;
       goto LABEL_39;
     case 5:
-      sub_4B36CC(0, 0x12u);
+      CreateButtonInColumn(0, 0x12u);
       v13 = 48;
       goto LABEL_9;
     case 6:
-      sub_4B36CC(0, 0x12u);
+      CreateButtonInColumn(0, 0x12u);
       v13 = 49;
       goto LABEL_9;
     case 7:
-      sub_4B36CC(0, 0x12u);
+      CreateButtonInColumn(0, 0x12u);
       v13 = 50;
       goto LABEL_9;
     case 8:
-      sub_4B36CC(0, 0x12u);
+      CreateButtonInColumn(0, 0x12u);
       v13 = 51;
 LABEL_9:
-      sub_4B36CC(1, v13);
+      CreateButtonInColumn(1, v13);
       v14 = 72;
       goto LABEL_41;
     case 9:
-      sub_4B36CC(0, 0x12u);
+      CreateButtonInColumn(0, 0x12u);
       v15 = 52;
       goto LABEL_13;
     case 10:
-      sub_4B36CC(0, 0x12u);
+      CreateButtonInColumn(0, 0x12u);
       v15 = 53;
       goto LABEL_13;
     case 11:
-      sub_4B36CC(0, 0x12u);
+      CreateButtonInColumn(0, 0x12u);
       v15 = 54;
 LABEL_13:
-      sub_4B36CC(1, v15);
+      CreateButtonInColumn(1, v15);
       v14 = 61;
       goto LABEL_41;
     case 12:
-      sub_4B36CC(0, 0x12u);
+      CreateButtonInColumn(0, 0x12u);
       v16 = 55;
       goto LABEL_37;
     default:
       break;
   }
 LABEL_43:
-  result = pDialogueWindow->pNumPresenceButton;
   dword_F8B1E0 = pDialogueWindow->pNumPresenceButton;
-  return result;
 }
 // F8B1E0: using guessed type int dword_F8B1E0;
 
@@ -10815,7 +10780,7 @@
     pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", 0);
     if ( pDialogueNPCCount == 1 && dword_591080 )
     {
-      sub_4B3B42(dword_F8B198);
+      sub_4B3B42(in_current_bilding_type);
     }
     else
     {
@@ -14472,8 +14437,8 @@
       pAudioPlayer->StopChannels(-1, -1);
     //uCurrentHouse_Animation = p2DEvents_minus1___02[v2];
     uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID;
-    dword_F8B198 = LOBYTE(pAnimatedRooms[uCurrentHouse_Animation].field_C);
-    if ( dword_F8B198 == 20 && pParty->uFine )   // going 2 jail
+    in_current_bilding_type = LOBYTE(pAnimatedRooms[uCurrentHouse_Animation].field_C);
+    if ( in_current_bilding_type == 20 && pParty->uFine )   // going 2 jail
     {
       uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID;
       //v25 = HOUSE_187;
@@ -14482,7 +14447,7 @@
       LODWORD(pParty->uTimePlayed) += 0x7620000u;
       v14 = LOBYTE(pAnimatedRooms[(signed __int16)p2DEvents[HOUSE_186].uAnimationID].field_C);
       pParty->uTimePlayed = __PAIR__(HIDWORD(pParty->uTimePlayed), v12) + 0x7620000;
-      dword_F8B198 = v14;
+      in_current_bilding_type = v14;
       //v13 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay;
       //do
       ++pParty->uNumPrisonTerms;