changeset 1233:be76a797780e

Слияние
author Ritor1
date Sun, 09 Jun 2013 16:39:08 +0600
parents 8eb865b584db (current diff) 8ff88e39e097 (diff)
children 6c55c6bd67e0
files mm7_4.cpp mm7_data.h
diffstat 6 files changed, 529 insertions(+), 338 deletions(-) [+]
line wrap: on
line diff
--- a/Arcomage.cpp	Sun Jun 09 16:38:54 2013 +0600
+++ b/Arcomage.cpp	Sun Jun 09 16:39:08 2013 +0600
@@ -43,9 +43,9 @@
 void DrawBricksCount(int a1, char* text, POINT *pXY); // idb
 void DrawGemsCount(int a1, char* text, POINT* pXY);
 void DrawBeastsCount(int a1, char *text, POINT *pXY); // idb
-void  DrawPlayersTowers();
-void  DrawPlayersWall();
-void __cdecl am_40B4B9();
+void DrawPlayersTowers();
+void DrawPlayersWall();
+void DrawCards();
 void __fastcall am_40B76F(int a1);
 int GetPlayerHandCardCount(int player_num);
 signed int  DrawCardsRectangles(int player_num);
@@ -65,8 +65,6 @@
 void __fastcall DrawRect(RECT *pXYZW, unsigned __int16 uColor, char bSolidFill); // idb
 void  SetPixel(POINT *pTargetXY, unsigned __int16 uColor);
 int __fastcall rand_interval(int a, int b); // idb
-char *__fastcall inv_strcat(const char *Source, char *Dest);
-char *__fastcall inv_strcpy(const char *Source, char *Dest);
 void __fastcall intToString(int val, char *pOut);
 
 /*  388 */
@@ -109,7 +107,7 @@
 ArcomageGame *pArcomageGame = new ArcomageGame;
 
 ArcomagePlayer am_Players[2];
-Acromage_st1 shown_cards[10];
+Acromage_st1 shown_cards[10]; //amuint_4FAA78; // weak
 
 stru272 array_4FABD0[10];
 
@@ -165,7 +163,8 @@
 char am_byte_4FAA77; // weak
 
 signed int current_card_slot_index; 
-unsigned int played_card_id; // idb
+int played_card_id; // idb 4FABC0
+int uCardID; // idb 4FAA50
 
 int deck_walk_index; 
 
@@ -173,6 +172,15 @@
 int start_gems_amount; 
 int start_beasts_amount; 
 
+POINT amuint_4FAA3C_blt_xy;
+POINT am_uint_4FAA44_blt_xy;
+POINT amuint_4FAA54_blt_xy;
+POINT amuint_4FAA5C_blt_xy;
+
+
+
+int dword_4FABB8; // weak
+
 
 //----- (0040DD2F) --------------------------------------------------------
 bool stru273::_40DD2F()
@@ -1660,7 +1668,6 @@
     }
    
   }
- // inv_strcpy(pDeckMaster, byte_5054C8);
   strcpy(deckMaster.name, pDeckMaster);
   for (i=0, card_dispenser_counter=-2, card_id_counter=0; i<DECK_SIZE; ++i, ++card_dispenser_counter)
       {
@@ -1855,7 +1862,7 @@
       //nullsub_1();
       v11.x = 0;
       v11.y = 0;
-      inv_strcpy("", Dest);
+   //   inv_strcpy("", Dest);
       v0 = 0;
       v11.y = 200;
       v11.x = 320 - 12 * v0 / 2;
@@ -1869,7 +1876,7 @@
         v1 = 0;
         current_player_num = 0;
       }
-      inv_strcpy(am_Players[v1].pPlayerName, Dest);
+      strcpy(Dest, am_Players[v1].pPlayerName);
       v4 = 0;
       v11.y = 260;
       v11.x = 320 - 12 * v4 / 2;
@@ -2111,8 +2118,8 @@
     {
       //nullsub_1();
       //nullsub_1();
-      assert(false && "Invalid strcpy params");
-      inv_strcpy(nullptr, Dest);
+     // assert(false && "Invalid strcpy params");
+     // inv_strcpy(nullptr, Dest);
       v5 = 0;//unk::const_0(&unk_4E19FC, 0);
       //nullsub_1();
       if ( v5 == 1 )
@@ -2128,11 +2135,11 @@
       v10[3] = 480;*/
       //nullsub_1();
     }
-    /* if ( dword_4FABB8 != am_40BB67(a1) )
+    if ( dword_4FABB8 != DrawCardsRectangles(player_num) )
     {
-    dword_4FABB8 = am_40BB67(a1);
+    dword_4FABB8 = DrawCardsRectangles(player_num);
     pArcomageGame->field_F6 = 1;
-    }*/
+    }
     if ( pArcomageGame->field_F6 )
     {
       DrawGameUI(v13);
@@ -2169,7 +2176,7 @@
   am_EndScene();
 
   am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1);
-  am_40B4B9();
+  DrawCards();
   DrawPlayersTowers();
   DrawPlayersWall();
   DrawPlayersText();
@@ -2301,21 +2308,21 @@
 
   if ( am_byte_4FAA77 )
   {
-    inv_strcpy(pGlobalTXT_LocalizationStrings[266], text_buff);// DISCARD A CARD
+    strcpy(text_buff, pGlobalTXT_LocalizationStrings[266]);// DISCARD A CARD
     text_position.x = 320 - pArcomageGame->pfntArrus->GetLineWidth(text_buff) / 2;
     text_position.y = 306;
     pPrimaryWindow_draws_text(-1, text_buff, &text_position);
   }
-  inv_strcpy(am_Players[0].pPlayerName, text_buff);
+  strcpy( text_buff, am_Players[0].pPlayerName);
   if ( !current_player_num )
-    inv_strcat("***", text_buff);
+    strcat(text_buff, "***");
   text_position.x = 47 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2;
   text_position.y = 21;
   pPrimaryWindow_draws_text(-1, text_buff, &text_position);
 
-  inv_strcpy(am_Players[1].pPlayerName, text_buff);
+  strcpy(text_buff, am_Players[1].pPlayerName);
   if ( current_player_num == 1 )
-    inv_strcat("***", text_buff);
+    strcat(text_buff, "***" );
   text_position.x = 595 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2;
   text_position.y = 21;
   pPrimaryWindow_draws_text(-1, text_buff, &text_position);
@@ -2667,8 +2674,8 @@
 }
 
 //----- (0040B4B9) --------------------------------------------------------
-void __cdecl am_40B4B9()
-{
+void DrawCards()
+    {
 
 int v0; // esi@1
 char v1; // bl@1
@@ -2811,6 +2818,234 @@
 //----- (0040B76F) --------------------------------------------------------
 void __fastcall am_40B76F(int a1)
 {
+
+int v1; // eax@3
+int v2; // eax@3
+int v3; // esi@4
+int v4; // eax@4
+POINT *v5; // edx@6
+RECT *v6; // ecx@6
+Acromage_st1 *v7; // ebx@11
+int v8; // eax@15
+Acromage_st1 *v9; // ecx@15
+int v10; // ecx@19
+int v11; // eax@20
+int v12; // ecx@20
+int v13; // eax@20
+unsigned int v14; // ecx@21
+double v15; // st7@22
+POINT *v16; // edx@23
+int v17; // eax@32
+char v18; // zf@37
+int v19; // eax@41
+int v20; // eax@46
+int v21; // ecx@46
+int v22; // eax@46
+int v23; // [sp-4h] [bp-2Ch]@28
+RECT pSrcXYZW; // [sp+Ch] [bp-1Ch]@6
+POINT pTargetXY; // [sp+1Ch] [bp-Ch]@20
+int v26; // [sp+24h] [bp-4h]@1
+
+v26 = a1;
+if ( amuint_4FAA4C != -1 )
+    {
+    if ( amuint_4FAA38 >= 9 )
+        {
+        am_uint_4FAA44_blt_xy.y = 18;
+        am_uint_4FAA44_blt_xy.x = 120;
+        v1 = GetPlayerHandCardCount(current_player_num);
+        v2 = (640 - 96 * v1) / v1 + 96;
+        if ( am_byte_4E185D )
+            {
+           // v3 = 188 * current_player_num + 8 * amuint_4FAA4C;
+           // amuint_4FAA3C_blt_xy.x = (amuint_4FAA4C * v2 + *(am_Players[0].arr_6C[0] + v3) - 120) / 10;
+            amuint_4FAA3C_blt_xy.x=(amuint_4FAA4C * v2 + am_Players[current_player_num].arr_6C[amuint_4FAA4C].field_0-120)/10;
+            v4 = (am_Players[current_player_num].arr_6C[amuint_4FAA4C].field_4+309) /10;//(*(&am_Players[0].arr_6C[0][1] + v3) + 309) / 10;
+            }
+        else
+            {
+            amuint_4FAA3C_blt_xy.x = (amuint_4FAA4C * v2 - 120) / 10;
+            v4 = 30;
+            }
+        am_uint_4FAA44_blt_xy.y += v4;
+        am_uint_4FAA44_blt_xy.x += amuint_4FAA3C_blt_xy.x;
+        pSrcXYZW.top = 0;
+        amuint_4FAA3C_blt_xy.y = v4;
+        pSrcXYZW.left = 192;
+        pSrcXYZW.right = 288;
+        pSrcXYZW.bottom = 128;
+        v5 = &am_uint_4FAA44_blt_xy;
+        v6 = &pSrcXYZW;
+        Blt_Copy(v6, v5, 2);
+        goto LABEL_11;
+        }
+    pSrcXYZW.top = 0;
+    v6 = &pSrcXYZW;
+    v5 = &am_uint_4FAA44_blt_xy;
+    pSrcXYZW.bottom = 128;
+    pSrcXYZW.right = 288;
+    pSrcXYZW.left = 192;
+    if ( amuint_4FAA38 )
+        {
+        am_uint_4FAA44_blt_xy.x += amuint_4FAA3C_blt_xy.x;
+        am_uint_4FAA44_blt_xy.y += amuint_4FAA3C_blt_xy.y;
+        Blt_Copy(v6, v5, 2);
+        goto LABEL_11;
+        }
+    am_uint_4FAA44_blt_xy.x += amuint_4FAA3C_blt_xy.x;
+    am_uint_4FAA44_blt_xy.y += amuint_4FAA3C_blt_xy.y;
+    Blt_Copy(&pSrcXYZW, &am_uint_4FAA44_blt_xy, 2);
+    amuint_4FAA4C = -1;
+    }
+LABEL_11:
+v7 = shown_cards;
+if ( uCardID != -1 )
+    {
+    if ( v26 <= 10 )
+        {
+        if ( v26 == 10 )
+            {
+            pArcomageGame->GetCardRect(uCardID, &pSrcXYZW);
+          //  v8 = 0;
+            for (v8=0; v8<10; ++v8)
+                {
+                if (shown_cards[v8].uCardId==-1)
+                    {
+                    shown_cards[v8].uCardId = uCardID;
+                    shown_cards[v8].field_4 = 1;
+                    break;
+                    }
+                }
+            /* v9 = shown_cards;
+            while ( v9->uCardId != -1 )
+            {
+            ++v9;
+            ++v8;
+            if ( v9 >= &dword_4FABB8 )
+            goto LABEL_20;
+            }
+
+            v10 = v8;
+            shown_cards[v10].uCardId = uCardID;
+            shown_cards[v10].field_4 = 1;*/
+//LABEL_20:
+            pTargetXY.x = shown_cards[v8].field_8.x;
+            pTargetXY.y = shown_cards[v8].field_8.y;
+            Blt_Copy(&pSrcXYZW, &pTargetXY, 0);
+            uCardID = -1;
+            }
+        }
+    else
+        {
+        pArcomageGame->GetCardRect(uCardID, &pSrcXYZW);
+        amuint_4FAA5C_blt_xy.x += amuint_4FAA54_blt_xy.x;
+        amuint_4FAA5C_blt_xy.y += amuint_4FAA54_blt_xy.y;
+        Blt_Copy(&pSrcXYZW, &amuint_4FAA5C_blt_xy, 0);
+        }
+    }
+v14 = played_card_id;
+if ( played_card_id != -1 )
+    {
+    v15 = v26;
+    if ( v15 > 15.0 )
+        {
+        pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW);
+        v16 = &amuint_4FAA5C_blt_xy;
+        amuint_4FAA5C_blt_xy.x += amuint_4FAA54_blt_xy.x;
+        amuint_4FAA5C_blt_xy.y += amuint_4FAA54_blt_xy.y;
+        Blt_Copy(&pSrcXYZW, v16, 2);
+        return;
+        }
+    if ( v15 == 15.0 )
+        {
+        am_40BF77(current_player_num, played_card_id);
+        pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW);
+        pTargetXY.x = 272;
+        pTargetXY.y = 173;
+        Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
+        return;
+        }
+    if ( v15 == 5.0 )
+        {
+        amuint_4FAA5C_blt_xy.x = 272;
+        amuint_4FAA5C_blt_xy.y = 173;
+        for (v17=0; v17<10; ++v17)
+            {
+            if (shown_cards[v17].uCardId==-1)
+                break;
+            }
+        /* v17 = 0;
+        do
+        {
+        if ( v7->uCardId == -1 )
+        break;
+        ++v7;
+        ++v17;
+        }
+        while ( v7 < &dword_4FABB8 );*/
+           // v26 = 32 * v17;
+
+            amuint_4FAA54_blt_xy.x = (shown_cards[v17].field_8.x - 272) / 5;
+            amuint_4FAA54_blt_xy.y = (shown_cards[v17].field_8.y - 173) / 5;
+            pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW);
+            pTargetXY.x = 272;
+            pTargetXY.y = 173;
+            Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
+            return;
+        }
+    if ( v15 >= 5.0 )
+        {
+        v18 = v26 == 0;
+        }
+    else
+        {
+        v18 = v26 == 0;
+        if ( v26 > 0 )
+            {
+            pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW);
+            amuint_4FAA5C_blt_xy.x += amuint_4FAA54_blt_xy.x;
+            amuint_4FAA5C_blt_xy.y += amuint_4FAA54_blt_xy.y;
+            Blt_Copy(&pSrcXYZW, &amuint_4FAA5C_blt_xy, 0);
+            return;
+            }
+        }
+    if ( !v18 )
+        {
+
+        pArcomageGame->GetCardRect(v14, &pSrcXYZW);
+        pTargetXY.x = 272;
+        pTargetXY.y = 173;
+        Blt_Copy(&pSrcXYZW, &pTargetXY, 2);
+        return;
+        }
+    pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW);
+    for (v19=0; v19<10; ++v19)
+        {
+        if (shown_cards[v19].uCardId==-1)
+            {
+            shown_cards[v19].uCardId = played_card_id;
+            break;
+            }
+           
+        }
+    /*  v19 = 0;
+    while ( v7->uCardId != -1 )
+    {
+    ++v7;
+    ++v19;
+    if ( v7 >= &dword_4FABB8 )
+    goto LABEL_46;
+    }
+    shown_cards[v19].uCardId = played_card_id;
+    LABEL_46:*/
+
+    pTargetXY.x = shown_cards[v19].field_8.x;
+    pTargetXY.y = shown_cards[v19].field_8.y;
+    Blt_Copy(&pSrcXYZW, &pTargetXY, 0);
+    played_card_id = -1;
+    }
+
+
 //  int v1; // eax@3
 //  int v2; // eax@3
 //  int v3; // esi@4
@@ -3342,9 +3577,8 @@
   int i;
 
   if ( card_slot_index <= -1 )
-    return 0;
+    return false;
   v2 = 0;
-  v3 = 0;
 
   for(i=0; i<10; ++i)
   {
@@ -3358,42 +3592,32 @@
 
   if ( pCards[am_Players[player_num].cards_at_hand[i]].field_2B) 
   {
-    ArcomageGame::PlaySound(0x16u);
-    v7 = current_player_num;
+    ArcomageGame::PlaySound(22);
     v8 = GetPlayerHandCardCount(current_player_num);
-    v9 = 188 * v7 + 8 * v3;
-//    v10 = 96 * v3 + *(int *)((char *)am_Players[0].arr_6C[0] + v9) + (640 - 96 * v8) / (v8 + 1);
-   // v11 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v9) + 327;
-    amuint_4FAA5C_blt_xy[0] = v10;
-    amuint_4FAA5C_blt_xy[1] = v11;
+    v10=am_Players[player_num].arr_6C[i].field_0 + (640 - 96 * v8) / (v8 + 1);
+    amuint_4FAA5C_blt_xy.x = v10;
+    amuint_4FAA5C_blt_xy.y = am_Players[player_num].arr_6C[i].field_4 + 327;//v11;
     v12 = 0;
+
     if ( !am_byte_4FAA75 )
     {
-      v13 = (signed int)amuint_4FAA78.data();
-      do
-      {
-        if ( *(unsigned int *)v13 == -1 )
-          break;
-        v13 += 32;
-        ++v12;
-      }
-      while ( v13 < (signed int)&dword_4FABB8 );
+      for (v12=0; v12<10; ++v12)
+          {
+           if (shown_cards[v12].uCardId== -1)
+               break;
+          }
     }
     pArcomageGame->field_F6 = 1;
-    amuint_4FAA54_blt_xy[0] = (amuint_4FAA80[8 * v12] - v10) / 10;
-    amuint_4FAA54_blt_xy[1] = (amuint_4FAA84[8 * v12] - 327) / 10;
-    v14 = *(unsigned int *)v6;
-    *(unsigned int *)v6 = -1;
+    amuint_4FAA54_blt_xy.x = (shown_cards[v12].field_8.x - v10) / 10;
+    amuint_4FAA54_blt_xy.y = (shown_cards[v12].field_8.y - 327) / 10;
+
+    uCardID = am_Players[player_num].cards_at_hand[i];
+    am_Players[player_num].cards_at_hand[i] = -1;
     am_byte_4FAA77 = 0;
-    uCardID = v14;
-    result = 1;
+    return true;
   }
   else
-  {
-
-    result = 0;
-  }
-  return result;
+    return false;
 }
 // 4FAA75: using guessed type char am_byte_4FAA75;
 // 4FAA77: using guessed type char am_byte_4FAA77;
@@ -3421,42 +3645,35 @@
   int v15; // ecx@8
   int v16; // ecx@8
 
-  v3 = player_num;
   if ( card_slot_num <= -1 )
     return false;
   v4 = 0;
-  v5 = &am_Players[v3];
-  v6 = 0;
-  v7 = (int)v5->cards_at_hand;
-  do
+
+  for (v6=0; v6<10; ++v6)
   {
-    if ( *(unsigned int *)v7 != -1 )
+    if ( am_Players[player_num].cards_at_hand[v6] != -1 )
     {
       if ( card_slot_num == v4 )
         break;
       ++v4;
     }
-    ++v6;
-    v7 += 4;
   }
-  while ( v6 < 10 );
+
   result = CanCardBePlayed(player_num, v6);
   if ( result )
   {
-    ArcomageGame::PlaySound(0x17u);
-    v8 = current_player_num;
+    ArcomageGame::PlaySound(23);
     v9 = GetPlayerHandCardCount(current_player_num);
-    v10 = 188 * v8 + 8 * v6;
-    v11 = v6 + 47 * v3;
-    
+  //  v10 = 188 * v8 + 8 * v6;
+  //  v11 = v6 + 47 * v3;
     pArcomageGame->field_F6 = 1;
     //v12 = 96 * v6 + *(int *)((char *)am_Players[0].arr_6C[0] + v10) + (640 - 96 * v9) / (v9 + 1);
   //  v13 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v10) + 327;
-    amuint_4FAA5C_blt_xy[0] = v12;
-    amuint_4FAA5C_blt_xy[1] = v13;
-
-    amuint_4FAA54_blt_xy[0] = (272 - v12) / 5;
-    amuint_4FAA54_blt_xy[1] = -30;
+    amuint_4FAA5C_blt_xy.x = am_Players[player_num].arr_6C[v6].field_0 + (640 - 96 * v9) / (v9 + 1);//v12;
+    amuint_4FAA5C_blt_xy.y = am_Players[player_num].arr_6C[v6].field_4 + 327;//v13;
+
+    amuint_4FAA54_blt_xy.x = (272 - v12) / 5;
+    amuint_4FAA54_blt_xy.y = -30;
 
     v14 = &pCards[v5->cards_at_hand[v6]];
     v5->resource_bricks -= v14->needed_bricks;
@@ -5549,14 +5766,17 @@
     {
       result = a2;
       v2->wall_height = a2 + v3;
-      goto LABEL_7;
+
     }
+    else
+        {      
     a2 += v3;
     result = -v3;
     v2->wall_height = 0;
+    v2->tower_height += a2;
+        }
   }
-  v2->tower_height += a2;
-LABEL_7:
+
   if ( v2->tower_height < 0 )
     v2->tower_height = 0;
   return result;
@@ -5588,7 +5808,7 @@
   //nullsub_1();
   xy[0] = 0;
   xy[1] = 0;
-  inv_strcpy("", pText);
+ // inv_strcpy("", pText);
   v2 = 0;
   xy[1] = 160;
   xy[0] = 320 - 12 * v2 / 2;
@@ -5956,17 +6176,6 @@
     return a + rand() % (b - a + 1);
     }
 
-//----- (0040DEB4) --------------------------------------------------------
-char *__fastcall inv_strcat(const char *Source, char *Dest)
-    {
-    return strcat(Dest, Source);
-    }
-
-//----- (0040DEBE) --------------------------------------------------------
-char *__fastcall inv_strcpy(const char *Source, char *Dest)
-    {
-    return strcpy(Dest, Source);
-    }
 
 //----- (0040DEC8) --------------------------------------------------------
 void __fastcall intToString(int val, char *pOut)
--- a/GUIWindow.cpp	Sun Jun 09 16:38:54 2013 +0600
+++ b/GUIWindow.cpp	Sun Jun 09 16:39:08 2013 +0600
@@ -159,34 +159,19 @@
   v1 = toupper(uHotkey);
   v2 = uNumVisibleWindows;
   v3 = v1;
-  if ( uNumVisibleWindows >= 0 )
+  for( v2 = uNumVisibleWindows; v2 >= 0 && pVisibleWindowsIdxs[v2] > 0; v2-- )
   {
-    while ( 2 )
-    {
-      v4 = &pWindowList[pVisibleWindowsIdxs[v2] - 1];
-      for ( result = v4->pControlsHead; result; result = result->pNext )
-      {
-        if ( result->uHotkey == v3 )
-        {
-          pMessageQueue_50CBD0->AddMessage(result->msg, result->msg_param, 0);
-          /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-          {
-            pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)result->uControlID;
-            pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v6;
-            *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-            ++pMessageQueue_50CBD0->uNumMessages;
-          }*/
-          return result;
-        }
-      }
-      if ( v4->uFrameX || v4->uFrameY || !(v4->uFrameWidth == 640 && v4->uFrameHeight == 480) )
-      {
-        --v2;
-        if ( v2 >= 0 )
-          continue;
-      }
-      break;
-    }
+	v4 = &pWindowList[pVisibleWindowsIdxs[v2] - 1];
+	for ( result = v4->pControlsHead; result; result = result->pNext )
+	{
+	  if ( result->uHotkey == v3 )
+	  {
+		pMessageQueue_50CBD0->AddMessage(result->msg, result->msg_param, 0);
+		return result;
+	  }
+	}
+	if ( !v4->uFrameX && !v4->uFrameY && (v4->uFrameWidth == 640 && v4->uFrameHeight == 480) )
+	  break;
   }
   return 0;
 }
--- a/UIHouses.cpp	Sun Jun 09 16:38:54 2013 +0600
+++ b/UIHouses.cpp	Sun Jun 09 16:39:08 2013 +0600
@@ -6090,3 +6090,212 @@
   }
   return;
 }
+
+
+//----- (004B6478) --------------------------------------------------------
+void sub_4B6478()
+    {
+  GUIWindow *v0; // ebx@1
+  Player *v1; // edi@1
+  unsigned int v2; // eax@1
+  signed int v3; // esi@1
+  int v4; // ebx@1
+  unsigned int v5; // esi@5
+  int v6; // edi@6
+  int result; // eax@13
+  GUIWindow *v8; // ebx@17
+  int v9; // eax@17
+  int v10; // ecx@17
+  unsigned int v11; // ecx@18
+  int v12; // eax@20
+  int v13; // eax@21
+  GUIButton *v14; // esi@27
+  int v15; // ecx@27
+  unsigned int v16; // eax@28
+  const char *v17; // ebx@29
+  int v18; // eax@29
+  unsigned int v19; // ecx@29
+  int v20; // eax@29
+  unsigned __int16 v21; // ax@29
+  unsigned __int16 v22; // ST14_2@36
+  int v23; // eax@36
+  const char *v24; // ST18_4@37
+  unsigned __int16 v25; // ST14_2@37
+  int v26; // eax@37
+  int v27; // [sp-4h] [bp-80h]@8
+  GUIWindow v28; // [sp+Ch] [bp-70h]@1
+  GUIWindow *v29; // [sp+60h] [bp-1Ch]@17
+  unsigned int v30; // [sp+64h] [bp-18h]@1
+  int v31; // [sp+68h] [bp-14h]@1
+  int v32; // [sp+6Ch] [bp-10h]@1
+  int v33; // [sp+70h] [bp-Ch]@17
+  int v34; // [sp+74h] [bp-8h]@17
+  int v35; // [sp+78h] [bp-4h]@17
+
+  v0 = window_SpeakInHouse;
+  memcpy(&v28, window_SpeakInHouse, sizeof(v28));
+  v1 = pPlayers[uActiveCharacter];
+  v28.uFrameX = 483;
+  v28.uFrameWidth = 148;
+  v28.uFrameZ = 334;
+  v30 = TargetColor(0xFFu, 0xFFu, 0xFFu);
+  v31 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
+  v2 = 52 * (unsigned int)v0->ptr_1C;
+  //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100;
+  v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100;
+  //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]);
+  v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier);
+  v4 = v3 * (100 - v1->GetMerchant()) / 100;
+  v32 = v4;
+  if ( v4 < v3 / 3 )
+  {
+    v4 = v3 / 3;
+    v32 = v3 / 3;
+  }
+  if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN)
+  {
+    if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
+    {
+      v5 = 0;
+
+      __debugbreak();
+      //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
+      // or
+      //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36]
+      // or
+      //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
+      __debugbreak(); // whacky condition - fix
+      if (false
+      //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C)
+        || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) )
+      {
+        pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
+      }
+      else
+      {
+        if ( pParty->uNumGold < v4 )
+        {
+          ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
+          v27 = 4;
+        }
+        else
+        {
+          Party::TakeGold(v4);
+          *(short *)v6 = 1;
+          v27 = 2;
+        }
+        PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27);
+      }
+    }
+    else
+    {
+      v5 = 0;
+    }
+    /*result = pMessageQueue_50CBD0->uNumMessages;
+    if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
+    {
+      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
+      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
+      result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
+      *(&pMessageQueue_50CBD0->uNumMessages + result) = v5;
+      ++pMessageQueue_50CBD0->uNumMessages;
+    }*/
+    pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5);
+    return; // void func
+  }
+  if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) )
+  {
+    v24 = pNPCTopics[171].pText;
+    v25 = v31;
+    v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0);
+    v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u);
+    pDialogueWindow->pNumPresenceButton = 0;
+    return ;
+  }
+
+  if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
+    return;
+  v8 = pDialogueWindow;
+  v33 = 0;
+  v34 = 0;
+  v29 = pDialogueWindow;
+  v9 = pDialogueWindow->pStartingPosActiveItem;
+  v10 = v9 + pDialogueWindow->pNumPresenceButton;
+  v35 = pDialogueWindow->pStartingPosActiveItem;
+  if ( v9 >= v10 )
+    goto LABEL_40;
+  do
+  {
+    v11 = v8->GetControl(v35)->msg_param - 36;
+    if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] )
+    {
+      v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0);
+      v33 += v12;
+      ++v34;
+    }
+    v13 = v8->pStartingPosActiveItem;
+    ++v35;
+  }
+  while ( v35 < v8->pNumPresenceButton + v13 );
+  if ( !v34 )
+  {
+LABEL_40:
+    sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]);
+    strcat(pTmpBuf.data(), "\n \n");
+    strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
+    v22 = v31;
+    v23 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v28, 0, 0);
+    v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf.data(), 3u);
+    return; 
+  }
+  sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v32);
+  v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u);
+  v32 = (149 - v33) / v34;
+  if ( (149 - v33) / v34 > 32 )
+    v32 = 32;
+
+  v35 = v8->pStartingPosActiveItem;
+  v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162;
+  if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton )
+  {
+    v33 = 2;
+    do
+    {
+      v14 = v8->GetControl(v35);
+      v15 = v14->msg_param - 36;
+      if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] )
+      {
+        v16 = 0;
+        if ( !v1->pActiveSkills[v15] )
+        {
+          v17 = pSkillNames[v15];
+          v14->uY = v32 + v34;
+          v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0);
+          v19 = v14->uY;
+          v14->uHeight = v18;
+          v20 = v19 + v18 - 1;
+          v14->uW = v20;
+          v34 = v20;
+          v21 = v31;
+          if ( pDialogueWindow->pCurrentPosActiveItem != v33 )
+            v21 = v30;
+          v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u);
+          goto LABEL_34;
+        }
+      }
+      else
+      {
+        v16 = 0;
+      }
+      v14->uW = v16;
+      v14->uHeight = v16;
+      v14->uY = v16;
+LABEL_34:
+      v8 = v29;
+      ++v35;
+      ++v33;
+    }
+    while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem );
+  }
+  return;
+}
\ No newline at end of file
--- a/mm7_4.cpp	Sun Jun 09 16:38:54 2013 +0600
+++ b/mm7_4.cpp	Sun Jun 09 16:39:08 2013 +0600
@@ -8240,213 +8240,7 @@
 */
 }
 
-//----- (004B6478) --------------------------------------------------------
-void sub_4B6478()
-    {
-  GUIWindow *v0; // ebx@1
-  Player *v1; // edi@1
-  unsigned int v2; // eax@1
-  signed int v3; // esi@1
-  int v4; // ebx@1
-  unsigned int v5; // esi@5
-  int v6; // edi@6
-  int result; // eax@13
-  GUIWindow *v8; // ebx@17
-  int v9; // eax@17
-  int v10; // ecx@17
-  unsigned int v11; // ecx@18
-  int v12; // eax@20
-  int v13; // eax@21
-  GUIButton *v14; // esi@27
-  int v15; // ecx@27
-  unsigned int v16; // eax@28
-  const char *v17; // ebx@29
-  int v18; // eax@29
-  unsigned int v19; // ecx@29
-  int v20; // eax@29
-  unsigned __int16 v21; // ax@29
-  unsigned __int16 v22; // ST14_2@36
-  int v23; // eax@36
-  const char *v24; // ST18_4@37
-  unsigned __int16 v25; // ST14_2@37
-  int v26; // eax@37
-  int v27; // [sp-4h] [bp-80h]@8
-  GUIWindow v28; // [sp+Ch] [bp-70h]@1
-  GUIWindow *v29; // [sp+60h] [bp-1Ch]@17
-  unsigned int v30; // [sp+64h] [bp-18h]@1
-  int v31; // [sp+68h] [bp-14h]@1
-  int v32; // [sp+6Ch] [bp-10h]@1
-  int v33; // [sp+70h] [bp-Ch]@17
-  int v34; // [sp+74h] [bp-8h]@17
-  int v35; // [sp+78h] [bp-4h]@17
-
-  v0 = window_SpeakInHouse;
-  memcpy(&v28, window_SpeakInHouse, sizeof(v28));
-  v1 = pPlayers[uActiveCharacter];
-  v28.uFrameX = 483;
-  v28.uFrameWidth = 148;
-  v28.uFrameZ = 334;
-  v30 = TargetColor(0xFFu, 0xFFu, 0xFFu);
-  v31 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
-  v2 = 52 * (unsigned int)v0->ptr_1C;
-  //v32 = (unsigned __int8)(((p2DEvents_minus1___00[v2 / 2] != 18) - 1) & 0x96) + 100;
-  v32 = (unsigned __int8)(((p2DEvents[(unsigned int)v0->ptr_1C - 1].uType != 18) - 1) & 0x96) + 100;
-  //v3 = (signed __int64)((double)v32 * p2DEvents_minus1__20[v2 / 4]);
-  v3 = (signed __int64)((double)v32 * p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier);
-  v4 = v3 * (100 - v1->GetMerchant()) / 100;
-  v32 = v4;
-  if ( v4 < v3 / 3 )
-  {
-    v4 = v3 / 3;
-    v32 = v3 / 3;
-  }
-  if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN)
-  {
-    if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
-    {
-      v5 = 0;
-
-      __debugbreak();
-      //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23]
-      // or
-      //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass][v23 - 36]
-      // or
-      //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1]
-      __debugbreak(); // whacky condition - fix
-      if (false
-      //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C)
-        || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) )
-      {
-        pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
-      }
-      else
-      {
-        if ( pParty->uNumGold < v4 )
-        {
-          ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
-          v27 = 4;
-        }
-        else
-        {
-          Party::TakeGold(v4);
-          *(short *)v6 = 1;
-          v27 = 2;
-        }
-        PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v27);
-      }
-    }
-    else
-    {
-      v5 = 0;
-    }
-    /*result = pMessageQueue_50CBD0->uNumMessages;
-    if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-    {
-      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
-      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
-      result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
-      *(&pMessageQueue_50CBD0->uNumMessages + result) = v5;
-      ++pMessageQueue_50CBD0->uNumMessages;
-    }*/
-    pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5);
-    return; // void func
-  }
-  if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->_guilds_member_bits, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) )
-  {
-    v24 = pNPCTopics[171].pText;
-    v25 = v31;
-    v26 = pFontArrus->CalcTextHeight(pNPCTopics[171].pText, &v28, 0, 0);
-    v28.DrawTitleText(pFontArrus, 0, (212 - v26) / 2 + 101, v25, v24, 3u);
-    pDialogueWindow->pNumPresenceButton = 0;
-    return ;
-  }
-
-  if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
-    return;
-  v8 = pDialogueWindow;
-  v33 = 0;
-  v34 = 0;
-  v29 = pDialogueWindow;
-  v9 = pDialogueWindow->pStartingPosActiveItem;
-  v10 = v9 + pDialogueWindow->pNumPresenceButton;
-  v35 = pDialogueWindow->pStartingPosActiveItem;
-  if ( v9 >= v10 )
-    goto LABEL_40;
-  do
-  {
-    v11 = v8->GetControl(v35)->msg_param - 36;
-    if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v11] && !v1->pActiveSkills[v11] )
-    {
-      v12 = pFontArrus->CalcTextHeight(pSkillNames[v11], &v28, 0, 0);
-      v33 += v12;
-      ++v34;
-    }
-    v13 = v8->pStartingPosActiveItem;
-    ++v35;
-  }
-  while ( v35 < v8->pNumPresenceButton + v13 );
-  if ( !v34 )
-  {
-LABEL_40:
-    sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]);
-    strcat(pTmpBuf.data(), "\n \n");
-    strcat(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[528]);
-    v22 = v31;
-    v23 = pFontArrus->CalcTextHeight(pTmpBuf.data(), &v28, 0, 0);
-    v28.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf.data(), 3u);
-    return; 
-  }
-  sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[401], v32);
-  v28.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u);
-  v32 = (149 - v33) / v34;
-  if ( (149 - v33) / v34 > 32 )
-    v32 = 32;
-
-  v35 = v8->pStartingPosActiveItem;
-  v34 = (149 - v34 * v32 - v33) / 2 - v32 / 2 + 162;
-  if ( v8->pStartingPosActiveItem < v8->pStartingPosActiveItem+ v8->pNumPresenceButton )
-  {
-    v33 = 2;
-    do
-    {
-      v14 = v8->GetControl(v35);
-      v15 = v14->msg_param - 36;
-      if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType / 3][v15] )
-      {
-        v16 = 0;
-        if ( !v1->pActiveSkills[v15] )
-        {
-          v17 = pSkillNames[v15];
-          v14->uY = v32 + v34;
-          v18 = pFontArrus->CalcTextHeight(v17, &v28, 0, 0);
-          v19 = v14->uY;
-          v14->uHeight = v18;
-          v20 = v19 + v18 - 1;
-          v14->uW = v20;
-          v34 = v20;
-          v21 = v31;
-          if ( pDialogueWindow->pCurrentPosActiveItem != v33 )
-            v21 = v30;
-          v28.DrawTitleText(pFontArrus, 0, v19, v21, v17, 3u);
-          goto LABEL_34;
-        }
-      }
-      else
-      {
-        v16 = 0;
-      }
-      v14->uW = v16;
-      v14->uHeight = v16;
-      v14->uY = v16;
-LABEL_34:
-      v8 = v29;
-      ++v35;
-      ++v33;
-    }
-    while ( v35 <v29->pNumPresenceButton + v29->pStartingPosActiveItem );
-  }
-  return;
-}
+
 
 //----- (00405CFF) --------------------------------------------------------
 void stru262_TurnBased::End(bool bPlaySound)
--- a/mm7_data.cpp	Sun Jun 09 16:38:54 2013 +0600
+++ b/mm7_data.cpp	Sun Jun 09 16:39:08 2013 +0600
@@ -904,12 +904,10 @@
 char byte_4FAA2E; // weak
 int amuint_4FAA34; // weak
 int amuint_4FAA38; // weak
-int amuint_4FAA3C_blt_xy[2];
-int am_uint_4FAA44_blt_xy[2];
+
 int amuint_4FAA4C; // weak
-unsigned int uCardID; // idb
-std::array<int, 2> amuint_4FAA54_blt_xy;
-std::array<int, 2> amuint_4FAA5C_blt_xy;
+
+
 int dword_4FAA64; // weak
 int dword_4FAA68; // weak
 
@@ -918,14 +916,13 @@
 char am_byte_4FAA75; // weak
 char am_byte_4FAA76; // weak
 
-std::array<int, 777> amuint_4FAA78; // weak
+
 char am_byte_4FAA7C[777]; // weak
-std::array<int, 777> amuint_4FAA80; // weak
-std::array<int, 777> amuint_4FAA84; // weak
+
 int amuint_4FAA88[777]; // weak
 int amuint_4FAA8C[777]; // weak
 int amuint_4FAA90[777][2];
-int dword_4FABB8; // weak
+
 
 
 int amuint_4FABC4; // weak
--- a/mm7_data.h	Sun Jun 09 16:38:54 2013 +0600
+++ b/mm7_data.h	Sun Jun 09 16:39:08 2013 +0600
@@ -543,12 +543,10 @@
 extern char byte_4FAA2E; // weak
 extern int amuint_4FAA34; // weak
 extern int amuint_4FAA38; // weak
-extern int amuint_4FAA3C_blt_xy[2];
-extern int am_uint_4FAA44_blt_xy[2];
+
 extern int amuint_4FAA4C; // weak
-extern unsigned int uCardID; // idb
-extern std::array<int, 2> amuint_4FAA54_blt_xy;
-extern std::array<int, 2> amuint_4FAA5C_blt_xy;
+
+
 extern int dword_4FAA64; // weak
 extern int dword_4FAA68; // weak
 
@@ -557,14 +555,13 @@
 extern char am_byte_4FAA75; // weak
 extern char am_byte_4FAA76; // weak
 
-extern std::array<int, 777> amuint_4FAA78; // weak
+
 extern char am_byte_4FAA7C[777]; // weak
-extern std::array<int, 777> amuint_4FAA80; // weak
-extern std::array<int, 777> amuint_4FAA84; // weak
+
 extern int amuint_4FAA88[777]; // weak
 extern int amuint_4FAA8C[777]; // weak
 extern int amuint_4FAA90[777][2];
-extern int dword_4FABB8; // weak
+
 
 
 extern int amuint_4FABC4; // weak