diff Arcomage.cpp @ 1186:569216b4f54d

more on arcomage 2
author Gloval
date Fri, 07 Jun 2013 08:51:31 +0400
parents 24454b5c9268
children f30e67ca6f72
line wrap: on
line diff
--- a/Arcomage.cpp	Fri Jun 07 01:32:17 2013 +0400
+++ b/Arcomage.cpp	Fri Jun 07 08:51:31 2013 +0400
@@ -114,8 +114,17 @@
 
 stru272 array_4FABD0[10];
 
+char byte_5052A8[108];
+int dword_505314[108]; // weak
+
+char byte_5054C8[32]; // idb
+char byte_5054E8[108];
 int dword_505554[108]; 
-char byte_5054E8[108];
+
+char pArcomagePlayer2Name[8];
+char pArcomagePlayer1Name[8];
+char pDeckMaster[12];
+
 
 /*  267 */
 #pragma pack(push, 1)
@@ -133,6 +142,8 @@
 };
 #pragma pack(pop)
 
+
+
 char am_byte_4E185D; // weak
 
 int amuint_4E1860; // weak
@@ -152,12 +163,15 @@
 int dword_4DF3A4; // weak
 
 char byte_4FAA2C; // weak
+char byte_4FAA2D; // weak
+
 int amuint_4FAA6C; // idb
 char am_byte_4FAA77; // weak
 
-
+signed int dword_4FABBC; // idb
 unsigned int amuint_4FABC0; // idb
 
+int dword_4FABC8; // weak
 
 
 //----- (0040DD2F) --------------------------------------------------------
@@ -212,27 +226,28 @@
     }
 
 //----- (0040E01A) --------------------------------------------------------
-int stru272_stru0::_40E01A(int a2)
+int stru272_stru0::_40E01A( stru272_stru2* a2 )
     {
     auto a1 = this;
     if ( a1->signature == SIG_trpg )
         {
-        a1->field_4 = *(int *)(a2 + 32);
-        a1->field_C = *(int *)a2 << 16;
-        a1->field_10 = *(int *)(a2 + 4) << 16;
-        a1->field_14 = *(int *)(a2 + 8) << 16;
-        a1->field_18 = *(int *)(a2 + 12) << 16;
-        a1->field_1C = *(int *)(a2 + 16);
-        a1->field_20 = *(int *)(a2 + 20);
-        a1->field_24 = *(int *)(a2 + 24);
-        a1->field_28 = *(float *)(a2 + 28) * 65536.0;
-        LODWORD(a1->field_2C) = *(int *)(a2 + 36);
-        a1->field_34 = (signed __int64)(*(float *)(a2 + 40) * 65536.0);
-        a1->field_38 = (signed __int64)(*(float *)(a2 + 44) * 65536.0);
-        a1->field_3C = *(int *)(a2 + 48);
-        a1->field_40 = *(int *)(a2 + 52);
-//        a1->field_54 = *(int *)(a2 + 56);
+        a1->field_4 = a2->field_20;
+        a1->field_C = a2->field_0 << 16;
+        a1->field_10 = a2->field_4 << 16;
+        a1->field_14 = a2->field_8 << 16;
+        a1->field_18 = a2->field_C << 16;
+        a1->field_1C = a2->field_10;
+        a1->field_20 = a2->field_14;
+        a1->field_24 = a2->field_18;
+        a1->field_28 = (float)(a2->field_1Cf * 65536.0);
+        a1->field_2C = a2->field_24f;
+        a1->field_34 = (int)(a2->field_28f * 65536.0);
+        a1->field_38 = (int)(a2->field_2Cf * 65536.0);
+        a1->field_3C = a2->field_30;
+        a1->field_40 = a2->field_34;
+        a1->field_54 = a2->field_38;
         a1->field_59 = 1;
+
         return 0;
         }
     else
@@ -265,78 +280,94 @@
 //----- (0040E133) --------------------------------------------------------
 int stru272_stru0::_40E133()
     {
+
     stru272_stru0 *v1; // edi@1
     int v3; // ST18_4@3
     double v4; // st7@3
     double v5; // st6@4
     char v6; // bl@8
-    int v7; // esi@8
+    stru272_stru1 *v7; // esi@8
     int v8; // ecx@10
     signed int v9; // eax@10
     int v10; // ecx@10
     signed int v11; // eax@10
-    signed int v12; // edx@12
-    signed int v13; // edx@12
-    int v14; // [sp+8h] [bp-10h]@8
-    int v15; // [sp+Ch] [bp-Ch]@8
-    float v16; // [sp+14h] [bp-4h]@3
+    int v12; // ebx@12
+    int v13; // ST1C_4@12
+    int v14; // ebx@12
+    int v15; // ST1C_4@12
+    signed int v16; // edx@12
+    int v17; // ebx@12
+    int v18; // ST1C_4@12
+    signed int v19; // edx@12
+    int v20; // [sp+8h] [bp-10h]@8
+    int v21; // [sp+Ch] [bp-Ch]@8
+    float v22; // [sp+14h] [bp-4h]@3
 
     v1 = this;
     if ( this->signature != SIG_trpg )
         return 2;
     v3 = this->field_8;
-    v16 = this->field_30;
-    v4 = (double)v3;
+    v22 = this->field_30;
+    v4 = v3;
     if ( v3 > 0 )
         {
-        v5 = v16 + this->field_2C;
-        v16 = v5;
+        v5 = v22 + this->field_2C;
+        v22 = v5;
         if ( v5 > v4 )
-            v16 = v4;
+            v22 = v4;
         }
-    if ( v16 >= 1.0 || this->field_58 )
+    if ( v22 >= 1.0 || this->field_58 )
         {
         v6 = 0;
-       // v7 = this->field_54;
-        v14 = (signed __int64)this->field_28;
-        v15 = this->field_4;
-        while ( *(int *)v7 <= 0 )
+        v7 = this->field_54;
+        v20 = this->field_28;
+        v21 = this->field_4;
+        while ( v7->field_0 <= 0 )
             {
-            if ( v16 >= 1.0 )
+            if ( v22 >= 1.0 )
                 {
-                *(int *)v7 = v1->field_3C + rand() % (v1->field_40 - v1->field_3C + 1);
-                *(int *)(v7 + 20) = (rand() % 17 - 8) << 16;
-                *(int *)(v7 + 24) = (rand() % 17 - 8) << 16;
-                v12 = v1->field_C + rand() % (v1->field_14 - 1 - v1->field_C + 1);
-                *(int *)(v7 + 12) = v12;
-                *(int *)(v7 + 4) = v12 >> 16;
-                v16 = v16 - 1.0;
-                v13 = v1->field_10 + rand() % (v1->field_18 - 1 - v1->field_10 + 1);
-                *(int *)(v7 + 16) = v13;
-                *(int *)(v7 + 8) = v13 >> 16;
+                v12 = v1->field_40;
+                v13 = v1->field_3C;
+                v7->field_0 = v13 + rand() % (v12 - v13 + 1);
+                v7->field_14 = (rand() % 17 - 8) << 16;
+                v7->field_18 = (rand() % 17 - 8) << 16;
+                v14 = v1->field_14 - 1;
+                v15 = v1->field_C;
+                v16 = v15 + rand() % (v14 - v15 + 1);
+                v7->field_C = v16;
+                v7->field_4.x = v16 >> 16;
+
+                v17 = v1->field_18 - 1;
+                v18 = v1->field_10;
+                v22 = v22 - 1.0;
+                v19 = v18 + rand() % (v17 - v18 + 1);
+                v7->field_10 = v19;
+                v7->field_4.y = v19 >> 16;
                 --v1->field_8;
                 goto LABEL_13;
                 }
 LABEL_14:
-            v7 += 28;
-            --v15;
-            if ( !v15 )
+            ++v7;
+            --v21;
+            if ( !v21 )
                 {
                 v1->field_58 = v6;
-                v1->field_30 = v16;
+                v1->field_30 = v22;
                 return 0;
                 }
             }
-        v8 = *(int *)(v7 + 20);
-        --*(int *)v7;
-        v9 = v8 + *(int *)(v7 + 12);
-        v10 = v14 + *(int *)(v7 + 24);
-        *(int *)(v7 + 12) = v9;
-        *(int *)(v7 + 4) = v9 >> 16;
-        v11 = v10 + *(int *)(v7 + 16);
-        *(int *)(v7 + 24) = v10;
-        *(int *)(v7 + 16) = v11;
-        *(int *)(v7 + 8) = v11 >> 16;
+        v8 = v7->field_14;
+        --v7->field_0;
+        v9 = v8 + v7->field_C;
+
+        v10 = v20 + v7->field_18;
+        v7->field_C = v9;
+        v7->field_4.x = v9 >> 16;
+
+        v11 = v10 + v7->field_10;
+        v7->field_18 = v10;
+        v7->field_10 = v11;
+        v7->field_4.y = v11 >> 16;
 LABEL_13:
         v6 = 1;
         goto LABEL_14;
@@ -1522,7 +1553,6 @@
     pArcomageGame->field_F6 = 1;
     byte_4FAA24 = 1;
     am_40A346(amuint_4FAA6C);
-    Sleep(10000);
 LABEL_8:
     while ( byte_4FAA24 )
     {
@@ -1788,11 +1818,11 @@
       am_40A198();
       v2 = dword_4FABC8;
     }
-    /*if ( !array_4FABD0[9].field_4[v2 + 4232] )
-    {
-      v3 = dword_505314[v2];
-      v5 = 1;
-    }*/
+    if ( !byte_5052A8[v2] )
+        {
+        v3 = dword_505314[v2];
+        v5 = 1;
+        }
     ++v2;
     dword_4FABC8 = v2;
   }
@@ -1802,20 +1832,15 @@
   if ( result != -1 )
   {
     amuint_4FAA4C = result;
-    am_Players[0].cards_at_hand[result + 47 * v4] = v3;
-    v7 = 188 * v4 + 8 * result;
-//    *(int *)((char *)am_Players[0].arr_6C[0] + v7) = rand_interval(-4, 4);
-    result = rand_interval(-4, 4);
-//    *(int *)((char *)&am_Players[0].arr_6C[0][1] + v7) = result;
+    am_Players[a1].cards_at_hand[result] = v3;
+    am_Players[a1].arr_6C[result].field_0 = rand_interval(-4, 4);
+    am_Players[a1].arr_6C[result].field_4 = rand_interval(-4, 4);
     pArcomageGame->field_F6 = 1;
     byte_4FAA2D = 1;
   }
 
 }
-// 4FAA2D: using guessed type char byte_4FAA2D;
-// 4FAA4C: using guessed type int amuint_4FAA4C;
-// 4FABC8: using guessed type int dword_4FABC8;
-// 505314: using guessed type int dword_505314[];
+
 
 //----- (0040A324) --------------------------------------------------------
 int GetEmptyCardSlotIndex( int player_num )
@@ -5492,23 +5517,23 @@
       {
       array_4FABD0[v6].field_1 = 1;
       }
-  array_4FABD0[v6].field_4 = v3->x - 20;
-  array_4FABD0[v6].field_C = v3->x + 20;
-  array_4FABD0[v6].field_8 = v3->y - 20;
-  array_4FABD0[v6].field_10 = v3->y + 20;
-  array_4FABD0[v6].field_14 = -60;
-  array_4FABD0[v6].field_18 = 60;
-  array_4FABD0[v6].field_1C = 180;
-  array_4FABD0[v6].field_20f = 0.5;
-  array_4FABD0[v6].field_24 = 150;
-  array_4FABD0[v6].field_28f = 50.0;
-  array_4FABD0[v6].field_2Cf = 3.0;
-  array_4FABD0[v6].field_30f = 8.0;
-  array_4FABD0[v6].field_34 = 5;
-  array_4FABD0[v6].field_38 = 15;
-  array_4FABD0[v6].field_3C = &array_4FABD0[v6].field_44[0];
+  array_4FABD0[v6].field_4.field_0 = v3->x - 20;
+  array_4FABD0[v6].field_4.field_8 = v3->x + 20;
+  array_4FABD0[v6].field_4.field_4 = v3->y - 20;
+  array_4FABD0[v6].field_4.field_C = v3->y + 20;
+  array_4FABD0[v6].field_4.field_10 = -60;
+  array_4FABD0[v6].field_4.field_14 = 60;
+  array_4FABD0[v6].field_4.field_18 = 180;
+  array_4FABD0[v6].field_4.field_1Cf = 0.5;
+  array_4FABD0[v6].field_4.field_20 = 150;
+  array_4FABD0[v6].field_4.field_24f= 50.0;
+  array_4FABD0[v6].field_4.field_28f = 3.0;
+  array_4FABD0[v6].field_4.field_2Cf = 8.0;
+  array_4FABD0[v6].field_4.field_30 = 5;
+  array_4FABD0[v6].field_4.field_34 = 15;
+  array_4FABD0[v6].field_4.field_38 = &array_4FABD0[v6].field_44[0];
   v8 = array_4FABD0[v6].field_40;
-  v8->_40E01A(array_4FABD0[v6].field_4);
+  v8->_40E01A(&array_4FABD0[v6].field_4);
   if ( 10 * v2 > 150 )
       v2 = 15;