changeset 1245:e161d8a5a529

acromage - apply card
author Gloval
date Tue, 11 Jun 2013 08:49:04 +0400
parents 6279bf7a4d1a
children 975480e1ce38
files Arcomage.cpp Arcomage.h mm7_data.cpp mm7_data.h
diffstat 4 files changed, 700 insertions(+), 2029 deletions(-) [+]
line wrap: on
line diff
--- a/Arcomage.cpp	Sun Jun 09 23:53:01 2013 +0200
+++ b/Arcomage.cpp	Tue Jun 11 08:49:04 2013 +0400
@@ -54,7 +54,7 @@
 bool CanCardBePlayed(int player_num, int hand_card_indx);
 void ApplyCardToPlayer(int player_num, unsigned int uCardID); // idb
 int  am_40D2B4(POINT* a1, int a2); // weak
-int  am_40D402(int player_num, int damage); // weak
+int  ApplyDamadeToBuildings(int player_num, int damage); // weak
 void GameResultsApply();
 
 void pPrimaryWindow_draws_text(int a1, const char *pText, POINT *pXY);
@@ -160,7 +160,7 @@
 char byte_4FAA2D; // weak
 
 int current_player_num; // idb
-char am_byte_4FAA77; // weak
+char hand_full; // weak
 
 signed int current_card_slot_index; 
 int played_card_id; // idb 4FABC0
@@ -177,7 +177,8 @@
 POINT amuint_4FAA54_blt_xy;
 POINT amuint_4FAA5C_blt_xy;
 
-
+int dword_4FAA64; // weak
+int dword_4FAA68; // weak
 
 int dword_4FABB8; // weak
 
@@ -206,11 +207,11 @@
 }
 
 //----- (0040DFD1) --------------------------------------------------------
-void stru272_stru0::Ctor(stru272_stru0 *a1)
+void stru272_stru0::Ctor(stru272_stru0 **a1)
     {
     stru272_stru0 *v2; // eax@1
     v2 = (stru272_stru0 *)malloc(0x5Cu);
-    a1 = v2;
+    *a1 = v2;
     v2->signature = SIG_trpg;
     v2->field_8 = 0;
     v2->field_30 = 0.0;
@@ -1571,11 +1572,11 @@
         byte_4FAA24 = am_40A560(current_player_num);
         if ( GetPlayerHandCardCount(current_player_num) <= minimum_cards_at_hand )
           break;
-        am_byte_4FAA77 = 1;
+        hand_full = 1;
         if ( pArcomageGame->field_F4 )
           goto LABEL_8;
       }
-      am_byte_4FAA77 = 0;
+      hand_full = 0;
     }
     pArcomageGame->GameOver = IsGameOver();
     if ( !pArcomageGame->GameOver )
@@ -2051,7 +2052,7 @@
     }
     else
     {
-      if ( am_byte_4FAA77 )
+      if ( hand_full )
       {
         if ( a2.field_0 == 7 && am_40BCFB(player_num, current_card_slot_index) )
         {
@@ -2060,7 +2061,7 @@
           if ( dword_4FAA64 > 0 )
           {
             --dword_4FAA64;
-            am_byte_4FAA77 = GetPlayerHandCardCount(player_num) > minimum_cards_at_hand;
+            hand_full = GetPlayerHandCardCount(player_num) > minimum_cards_at_hand;
           }
           byte_4FAA2E = 1;
         }
@@ -2071,7 +2072,7 @@
           if ( dword_4FAA64 > 0 )
           {
             --dword_4FAA64;
-            am_byte_4FAA77 = GetPlayerHandCardCount(player_num) > minimum_cards_at_hand;
+            hand_full = GetPlayerHandCardCount(player_num) > minimum_cards_at_hand;
           }
           byte_4FAA2E = 1;
         }
@@ -2303,7 +2304,7 @@
   char text_buff[32]; // [sp+Ch] [bp-28h]@2
   POINT text_position; // [sp+2Ch] [bp-8h]@2
 
-  if ( am_byte_4FAA77 )
+  if ( hand_full )
   {
     strcpy(text_buff, pGlobalTXT_LocalizationStrings[266]);// DISCARD A CARD
     text_position.x = 320 - pArcomageGame->pfntArrus->GetLineWidth(text_buff) / 2;
@@ -3224,7 +3225,7 @@
     }
   }
 
-  if ( pCards[am_Players[player_num].cards_at_hand[i]].field_2B) 
+  if ( pCards[am_Players[player_num].cards_at_hand[i]].attack_or_defence) 
   {
     ArcomageGame::PlaySound(22);
     v8 = GetPlayerHandCardCount(current_player_num);
@@ -3247,7 +3248,7 @@
 
     uCardID = am_Players[player_num].cards_at_hand[i];
     am_Players[player_num].cards_at_hand[i] = -1;
-    am_byte_4FAA77 = 0;
+    hand_full = 0;
     return true;
   }
   else
@@ -3353,1955 +3354,629 @@
 //----- (0040BF77) --------------------------------------------------------
 void ApplyCardToPlayer( int player_num, unsigned int uCardID )
     {
-//  ArcomagePlayer *v2; // esi@1
-//  int v3; // eax@1
-//  ArcomagePlayer *v4; // edi@1
-//  int v5; // eax@2
-//  char v6; // sf@2
-//  unsigned __int8 v7; // of@2
-//  int v8; // eax@3
-//  int v9; // eax@4
-//  char v10; // zf@5
-//  int v11; // eax@8
-//  unsigned __int8 v12; // zf@8
-//  char v13; // sf@8
-//  unsigned __int8 v14; // of@8
-//  int v15; // eax@9
-//  int v16; // eax@10
-//  char v17; // zf@12
-//  char v18; // al@15
-//  int v19; // eax@16
-//  int v20; // eax@17
-//  int v21; // eax@22
-//  int v22; // eax@23
-//  int v23; // eax@26
-//  int v24; // edx@26
-//  signed int v25; // ebx@26
-//  ArcomageCard *v26; // ebx@28
-//  int v27; // eax@28
-//  int v28; // edx@33
-//  int v29; // eax@33
-//  int v30; // eax@35
-//  int v31; // edx@40
-//  int v32; // eax@40
-//  int v33; // eax@42
-//  int v34; // edx@47
-//  int v35; // eax@47
-//  int v36; // eax@49
-//  int v37; // edx@54
-//  int v38; // eax@54
-//  bool v39; // eax@56
-//  int v40; // edx@61
-//  int v41; // eax@61
-//  int v42; // eax@63
-//  int v43; // edx@68
-//  int v44; // eax@68
-//  char v45; // al@70
-//  int v46; // eax@72
-//  int v47; // edx@77
-//  int v48; // eax@77
-//  int v49; // eax@79
-//  int v50; // edx@84
-//  int v51; // eax@84
-//  int v52; // eax@86
-//  int v53; // eax@91
-//  int v54; // edx@91
-//  int v55; // eax@93
-//  int v56; // eax@98
-//  int v57; // edx@98
-//  int v58; // eax@100
-//  int v59; // eax@105
-//  int v60; // edx@105
-//  int v61; // eax@107
-//  int v62; // eax@112
-//  int v63; // edx@112
-//  int v64; // eax@114
-//  int v65; // eax@119
-//  int v66; // edx@119
-//  int v67; // eax@121
-//  int v68; // eax@126
-//  int v69; // edx@126
-//  char v70; // al@128
-//  int v71; // eax@130
-//  int v72; // eax@135
-//  int v73; // edx@135
-//  int v74; // eax@137
-//  int v75; // eax@142
-//  int v76; // edx@142
-//  int v77; // eax@144
-//  int v78; // eax@151
-//  int v79; // ecx@151
-//  int v80; // eax@155
-//  int v81; // eax@162
-//  int v82; // ecx@162
-//  int v83; // eax@166
-//  int v84; // eax@173
-//  int v85; // ecx@173
-//  int v86; // eax@177
-//  int v87; // eax@184
-//  int v88; // ecx@184
-//  bool v89; // eax@188
-//  int v90; // eax@195
-//  int v91; // ecx@195
-//  int v92; // eax@199
-//  int v93; // eax@206
-//  int v94; // ecx@206
-//  char v95; // al@210
-//  int v96; // eax@211
-//  int v97; // edx@211
-//  int v98; // eax@211
-//  int v99; // eax@211
-//  int v100; // eax@212
-//  int v101; // eax@219
-//  int v102; // ecx@219
-//  int v103; // eax@223
-//  int v104; // eax@231
-//  int v105; // edx@231
-//  signed int v106; // ebx@231
-//  ArcomageCard *v107; // ebx@233
-//  int v108; // eax@233
-//  int v109; // edx@238
-//  int v110; // eax@238
-//  int v111; // eax@240
-//  int v112; // edx@245
-//  int v113; // eax@245
-//  int v114; // eax@247
-//  int v115; // edx@252
-//  int v116; // eax@252
-//  int v117; // eax@254
-//  int v118; // edx@259
-//  int v119; // eax@259
-//  bool v120; // eax@261
-//  int v121; // edx@266
-//  int v122; // eax@266
-//  int v123; // eax@268
-//  int v124; // edx@273
-//  int v125; // eax@273
-//  char v126; // al@275
-//  int v127; // eax@277
-//  int v128; // edx@282
-//  int v129; // eax@282
-//  int v130; // eax@284
-//  int v131; // edx@289
-//  int v132; // eax@289
-//  int v133; // eax@291
-//  int v134; // eax@296
-//  int v135; // edx@296
-//  int v136; // eax@298
-//  int v137; // eax@303
-//  int v138; // edx@303
-//  int v139; // eax@305
-//  int v140; // eax@310
-//  int v141; // edx@310
-//  int v142; // eax@312
-//  int v143; // eax@317
-//  int v144; // edx@317
-//  int v145; // eax@319
-//  int v146; // eax@324
-//  int v147; // edx@324
-//  int v148; // eax@326
-//  int v149; // eax@331
-//  int v150; // edx@331
-//  char v151; // al@333
-//  int v152; // eax@335
-//  int v153; // eax@340
-//  int v154; // edx@340
-//  int v155; // eax@342
-//  int v156; // eax@347
-//  int v157; // edx@347
-//  int v158; // eax@349
-//  int v159; // eax@356
-//  int v160; // ecx@356
-//  int v161; // eax@360
-//  int v162; // eax@367
-//  int v163; // ecx@367
-//  int v164; // eax@371
-//  int v165; // eax@378
-//  int v166; // ecx@378
-//  int v167; // eax@382
-//  int v168; // eax@389
-//  int v169; // ecx@389
-//  bool v170; // eax@393
-//  int v171; // eax@400
-//  int v172; // ecx@400
-//  int v173; // eax@404
-//  int v174; // eax@411
-//  int v175; // ecx@411
-//  char v176; // al@415
-//  int v177; // eax@416
-//  int v178; // edx@416
-//  int v179; // eax@416
-//  int v180; // eax@416
-//  int v181; // eax@417
-//  int v182; // eax@424
-//  int v183; // ecx@424
-//  int v184; // eax@429
-//  int v185; // ecx@429
-//  signed int v186; // esi@511
-//  Vec2_int_ v187; // [sp+Ch] [bp-64h]@488
-//  //int v188; // [sp+10h] [bp-60h]@488
-//  int v189; // [sp+14h] [bp-5Ch]@1
-//  ArcomageCard *pCard; // [sp+18h] [bp-58h]@1
-//  int v191; // [sp+1Ch] [bp-54h]@1
-//  int v192; // [sp+20h] [bp-50h]@1
-//  int v193; // [sp+24h] [bp-4Ch]@1
-//  int v194; // [sp+28h] [bp-48h]@1
-//  int v195; // [sp+2Ch] [bp-44h]@1
-//  int v196; // [sp+30h] [bp-40h]@1
-//  int v197; // [sp+34h] [bp-3Ch]@1
-//  int v198; // [sp+38h] [bp-38h]@1
-//  int v199; // [sp+3Ch] [bp-34h]@1
-//  int v200; // [sp+40h] [bp-30h]@1
-//  int v201; // [sp+44h] [bp-2Ch]@1
-//  int v202; // [sp+48h] [bp-28h]@1
-//  int v203; // [sp+4Ch] [bp-24h]@1
-//  int v204; // [sp+50h] [bp-20h]@1
-//  bool v205; // [sp+54h] [bp-1Ch]@1
-//  int v206; // [sp+58h] [bp-18h]@1
-//  int v207; // [sp+5Ch] [bp-14h]@1
-//  int v208; // [sp+60h] [bp-10h]@1
-//  int v209; // [sp+64h] [bp-Ch]@1
-//  int v210; // [sp+68h] [bp-8h]@1
-//  int v211; // [sp+6Ch] [bp-4h]@1
-//
-//  v194 = 0;
-//  v210 = 0;
-//  v208 = 0;
-//  v197 = 0;
-//  v205 = 0;
-//  v203 = 0;
-//  v201 = 0;
-//  v199 = 0;
-//  v192 = 0;
-//  v196 = 0;
-//  v211 = 0;
-//  v209 = 0;
-//  v207 = 0;
-//  v206 = 0;
-//  v204 = 0;
-//  v202 = 0;
-//  v200 = 0;
-//  v198 = 0;
-//  v191 = 0;
-//  v195 = 0;
-//  v193 = a1;
-//  v2 = &stru_505708[a1];
-//  pCard = &pCards[uCardID];
-//  v3 = pCard->field_2C;
-//  v189 = (a1 + 1) % 2;
-//  v4 = &stru_505708[v189];
-//  switch ( v3 )
-//  {
-//    case 2:
-//      v5 = v2->field_2C;
-//      v7 = __OFSUB__(v5, v4->field_2C);
-//      v6 = v5 - v4->field_2C < 0;
-//      goto LABEL_18;
-//    case 3:
-//      v8 = v2->field_30;
-//      v7 = __OFSUB__(v8, v4->field_30);
-//      v6 = v8 - v4->field_30 < 0;
-//      goto LABEL_18;
-//    case 4:
-//      v9 = v2->field_34;
-//      v7 = __OFSUB__(v9, v4->field_34);
-//      v6 = v9 - v4->field_34 < 0;
-//      goto LABEL_18;
-//    case 5:
-//      v10 = v2->field_2C == v4->field_2C;
-//      goto LABEL_21;
-//    case 6:
-//      v10 = v2->field_30 == v4->field_30;
-//      goto LABEL_21;
-//    case 7:
-//      v10 = v2->field_34 == v4->field_34;
-//      goto LABEL_21;
-//    case 8:
-//      v11 = v2->field_2C;
-//      v14 = __OFSUB__(v11, v4->field_2C);
-//      v12 = v11 == v4->field_2C;
-//      v13 = v11 - v4->field_2C < 0;
-//      goto LABEL_24;
-//    case 9:
-//      v15 = v2->field_30;
-//      v14 = __OFSUB__(v15, v4->field_30);
-//      v12 = v15 == v4->field_30;
-//      v13 = v15 - v4->field_30 < 0;
-//      goto LABEL_24;
-//    case 10:
-//      v16 = v2->field_34;
-//      v14 = __OFSUB__(v16, v4->field_34);
-//      v12 = v16 == v4->field_34;
-//      v13 = v16 - v4->field_34 < 0;
-//      goto LABEL_24;
-//    case 11:
-//      v10 = v2->field_28 == 0;
-//      goto LABEL_21;
-//    case 12:
-//      v17 = v2->field_28 == 0;
-//      goto LABEL_15;
-//    case 13:
-//      v10 = v4->field_28 == 0;
-//      goto LABEL_21;
-//    case 14:
-//      v17 = v4->field_28 == 0;
-//LABEL_15:
-//      v18 = !v17;
-//      goto LABEL_25;
-//    case 15:
-//      v19 = v2->field_28;
-//      v7 = __OFSUB__(v19, v4->field_28);
-//      v6 = v19 - v4->field_28 < 0;
-//      goto LABEL_18;
-//    case 16:
-//      v20 = v2->field_24;
-//      v7 = __OFSUB__(v20, v4->field_24);
-//      v6 = v20 - v4->field_24 < 0;
-//LABEL_18:
-//      v18 = v6 ^ v7;
-//      goto LABEL_25;
-//    case 17:
-//      v10 = v2->field_28 == v4->field_28;
-//      goto LABEL_21;
-//    case 18:
-//      v10 = v2->field_24 == v4->field_24;
-//LABEL_21:
-//      v18 = v10;
-//      goto LABEL_25;
-//    case 19:
-//      v21 = v2->field_28;
-//      v14 = __OFSUB__(v21, v4->field_28);
-//      v12 = v21 == v4->field_28;
-//      v13 = v21 - v4->field_28 < 0;
-//      goto LABEL_24;
-//    case 20:
-//      v22 = v2->field_24;
-//      v14 = __OFSUB__(v22, v4->field_24);
-//      v12 = v22 == v4->field_24;
-//      v13 = v22 - v4->field_24 < 0;
-//LABEL_24:
-//      v18 = !((unsigned __int8)(v13 ^ v14) | v12);
-//LABEL_25:
-//      if ( v18 )
-//        goto LABEL_26;
-//      goto LABEL_231;
-//    default:
-//LABEL_26:
-//      v23 = BYTE1(pCard->field_30);
-//      v24 = v23 + (LOBYTE(pCard->field_30) == 1);
-//      v25 = 0;
-//      dword_4FAA68 = v23 + (LOBYTE(pCard->field_30) == 1);
-//      dword_4FAA64 = v23;
-//      if ( v23 > 0 )
-//      {
-//        do
-//        {
-//          am_40A283(v193, v24);
-//          ++v25;
-//        }
-//        while ( v25 < SBYTE1(pCard->field_30) );
-//      }
-//      v26 = pCard;
-//      am_byte_4FAA77 = GetPlayerHandCardCount(v193) > dword_4E1874;
-//      LOBYTE(v27) = BYTE2(pCard->field_30);
-//      if ( (_BYTE)v27 )
-//      {
-//        if ( (_BYTE)v27 == 99 )
-//        {
-//          v28 = v2->field_2C;
-//          v29 = v4->field_2C;
-//          if ( v28 < v29 )
-//          {
-//            v2->field_2C = v29;
-//            v194 = v29 - v28;
-//          }
-//        }
-//        else
-//        {
-//          v27 = (char)v27;
-//          v6 = (char)v27 + v2->field_2C < 0;
-//          v2->field_2C += (char)v27;
-//          if ( v6 )
-//            v2->field_2C = 0;
-//          v194 = v27;
-//        }
-//      }
-//      LOBYTE(v30) = BYTE3(v26->field_30);
-//      if ( (_BYTE)v30 )
-//      {
-//        if ( (_BYTE)v30 == 99 )
-//        {
-//          v31 = v2->field_30;
-//          v32 = v4->field_30;
-//          if ( v31 < v32 )
-//          {
-//            v2->field_30 = v32;
-//            v210 = v32 - v31;
-//          }
-//        }
-//        else
-//        {
-//          v30 = (char)v30;
-//          v6 = (char)v30 + v2->field_30 < 0;
-//          v2->field_30 += (char)v30;
-//          if ( v6 )
-//            v2->field_30 = 0;
-//          v210 = v30;
-//        }
-//      }
-//      LOBYTE(v33) = LOBYTE(v26->field_34);
-//      if ( (_BYTE)v33 )
-//      {
-//        if ( (_BYTE)v33 == 99 )
-//        {
-//          v34 = v2->field_34;
-//          v35 = v4->field_34;
-//          if ( v34 < v35 )
-//          {
-//            v2->field_34 = v35;
-//            v208 = v35 - v34;
-//          }
-//        }
-//        else
-//        {
-//          v33 = (char)v33;
-//          v6 = (char)v33 + v2->field_34 < 0;
-//          v2->field_34 += (char)v33;
-//          if ( v6 )
-//            v2->field_34 = 0;
-//          v208 = v33;
-//        }
-//      }
-//      LOBYTE(v36) = BYTE1(v26->field_34);
-//      if ( (_BYTE)v36 )
-//      {
-//        if ( (_BYTE)v36 == 99 )
-//        {
-//          v37 = v2->field_38;
-//          v38 = v4->field_38;
-//          if ( v37 < v38 )
-//          {
-//            v2->field_38 = v38;
-//            v197 = v38 - v37;
-//          }
-//        }
-//        else
-//        {
-//          v36 = (char)v36;
-//          v6 = (char)v36 + v2->field_38 < 0;
-//          v2->field_38 += (char)v36;
-//          if ( v6 )
-//            v2->field_38 = 0;
-//          v197 = v36;
-//        }
-//      }
-//      LOBYTE(v39) = BYTE2(v26->field_34);
-//      if ( v39 )
-//      {
-//        if ( v39 == 99 )
-//        {
-//          v40 = v2->field_3C;
-//          v41 = v4->field_3C;
-//          if ( v40 < v41 )
-//          {
-//            v2->field_3C = v41;
-//            v205 = v41 - v40;
-//          }
-//        }
-//        else
-//        {
-//          v39 = v39;
-//          v6 = v39 + v2->field_3C < 0;
-//          v2->field_3C += v39;
-//          if ( v6 )
-//            v2->field_3C = 0;
-//          v205 = v39;
-//        }
-//      }
-//      LOBYTE(v42) = BYTE3(v26->field_34);
-//      if ( (_BYTE)v42 )
-//      {
-//        if ( (_BYTE)v42 == 99 )
-//        {
-//          v43 = v2->field_40;
-//          v44 = v4->field_40;
-//          if ( v43 < v44 )
-//          {
-//            v2->field_40 = v44;
-//            v203 = v44 - v43;
-//          }
-//        }
-//        else
-//        {
-//          v42 = (char)v42;
-//          v6 = (char)v42 + v2->field_40 < 0;
-//          v2->field_40 += (char)v42;
-//          if ( v6 )
-//            v2->field_40 = 0;
-//          v203 = v42;
-//        }
-//      }
-//      v45 = v26->field_38[0];
-//      if ( v45 )
-//      {
-//        v196 = am_40D402(v193, v45);
-//        v192 = v26->field_38[0] - v196;
-//      }
-//      LOBYTE(v46) = v26->field_38[1];
-//      if ( (_BYTE)v46 )
-//      {
-//        if ( (_BYTE)v46 == 99 )
-//        {
-//          v47 = v2->field_28;
-//          v48 = v4->field_28;
-//          if ( v47 < v48 )
-//          {
-//            v2->field_28 = v48;
-//            v201 = v48 - v47;
-//          }
-//        }
-//        else
-//        {
-//          v46 = (char)v46;
-//          v6 = (char)v46 + v2->field_28 < 0;
-//          v2->field_28 += (char)v46;
-//          if ( v6 )
-//            v2->field_28 = 0;
-//          v201 = v46;
-//        }
-//      }
-//      LOBYTE(v49) = v26->field_38[2];
-//      if ( (_BYTE)v49 )
-//      {
-//        if ( (_BYTE)v49 == 99 )
-//        {
-//          v50 = v2->field_24;
-//          v51 = v4->field_24;
-//          if ( v50 < v51 )
-//          {
-//            v2->field_24 = v51;
-//            v199 = v51 - v50;
-//          }
-//        }
-//        else
-//        {
-//          v49 = (char)v49;
-//          v6 = (char)v49 + v2->field_24 < 0;
-//          v2->field_24 += (char)v49;
-//          if ( v6 )
-//            v2->field_24 = 0;
-//          v199 = v49;
-//        }
-//      }
-//      LOBYTE(v52) = v26->field_38[3];
-//      if ( (_BYTE)v52 )
-//      {
-//        if ( (_BYTE)v52 == 99 )
-//        {
-//          v53 = v2->field_2C;
-//          v54 = v4->field_2C;
-//          if ( v53 > v54 )
-//          {
-//            v4->field_2C = v53;
-//            v211 = v53 - v54;
-//          }
-//        }
-//        else
-//        {
-//          v52 = (char)v52;
-//          v6 = (char)v52 + v4->field_2C < 0;
-//          v4->field_2C += (char)v52;
-//          if ( v6 )
-//            v4->field_2C = 0;
-//          v211 = v52;
-//        }
-//      }
-//      LOBYTE(v55) = v26->field_38[4];
-//      if ( (_BYTE)v55 )
-//      {
-//        if ( (_BYTE)v55 == 99 )
-//        {
-//          v56 = v2->field_30;
-//          v57 = v4->field_30;
-//          if ( v56 > v57 )
-//          {
-//            v4->field_30 = v56;
-//            v209 = v56 - v57;
-//          }
-//        }
-//        else
-//        {
-//          v55 = (char)v55;
-//          v6 = (char)v55 + v4->field_30 < 0;
-//          v4->field_30 += (char)v55;
-//          if ( v6 )
-//            v4->field_30 = 0;
-//          v209 = v55;
-//        }
-//      }
-//      LOBYTE(v58) = v26->field_38[5];
-//      if ( (_BYTE)v58 )
-//      {
-//        if ( (_BYTE)v58 == 99 )
-//        {
-//          v59 = v2->field_34;
-//          v60 = v4->field_34;
-//          if ( v59 > v60 )
-//          {
-//            v4->field_34 = v59;
-//            v207 = v59 - v60;
-//          }
-//        }
-//        else
-//        {
-//          v58 = (char)v58;
-//          v6 = (char)v58 + v4->field_34 < 0;
-//          v4->field_34 += (char)v58;
-//          if ( v6 )
-//            v4->field_34 = 0;
-//          v207 = v58;
-//        }
-//      }
-//      LOBYTE(v61) = v26->field_38[6];
-//      if ( (_BYTE)v61 )
-//      {
-//        if ( (_BYTE)v61 == 99 )
-//        {
-//          v62 = v2->field_38;
-//          v63 = v4->field_38;
-//          if ( v62 > v63 )
-//          {
-//            v4->field_38 = v62;
-//            v206 = v62 - v63;
-//          }
-//        }
-//        else
-//        {
-//          v61 = (char)v61;
-//          v6 = (char)v61 + v4->field_38 < 0;
-//          v4->field_38 += (char)v61;
-//          if ( v6 )
-//            v4->field_38 = 0;
-//          v206 = v61;
-//        }
-//      }
-//      LOBYTE(v64) = v26->field_38[7];
-//      if ( (_BYTE)v64 )
-//      {
-//        if ( (_BYTE)v64 == 99 )
-//        {
-//          v65 = v2->field_3C;
-//          v66 = v4->field_3C;
-//          if ( v65 > v66 )
-//          {
-//            v4->field_3C = v65;
-//            v204 = v65 - v66;
-//          }
-//        }
-//        else
-//        {
-//          v64 = (char)v64;
-//          v6 = (char)v64 + v4->field_3C < 0;
-//          v4->field_3C += (char)v64;
-//          if ( v6 )
-//            v4->field_3C = 0;
-//          v204 = v64;
-//        }
-//      }
-//      LOBYTE(v67) = v26->field_38[8];
-//      if ( (_BYTE)v67 )
-//      {
-//        if ( (_BYTE)v67 == 99 )
-//        {
-//          v68 = v2->field_40;
-//          v69 = v4->field_40;
-//          if ( v68 > v69 )
-//          {
-//            v4->field_40 = v68;
-//            v202 = v68 - v69;
-//          }
-//        }
-//        else
-//        {
-//          v67 = (char)v67;
-//          v6 = (char)v67 + v4->field_40 < 0;
-//          v4->field_40 += (char)v67;
-//          if ( v6 )
-//            v4->field_40 = 0;
-//          v202 = v67;
-//        }
-//      }
-//      v70 = v26->field_38[9];
-//      if ( v70 )
-//      {
-//        v195 = am_40D402(v189, v70);
-//        v191 = v26->field_38[9] - v195;
-//      }
-//      LOBYTE(v71) = v26->field_38[10];
-//      if ( (_BYTE)v71 )
-//      {
-//        if ( (_BYTE)v71 == 99 )
-//        {
-//          v72 = v2->field_28;
-//          v73 = v4->field_28;
-//          if ( v72 > v73 )
-//          {
-//            v4->field_28 = v72;
-//            v200 = v72 - v73;
-//          }
-//        }
-//        else
-//        {
-//          v71 = (char)v71;
-//          v6 = (char)v71 + v4->field_28 < 0;
-//          v4->field_28 += (char)v71;
-//          if ( v6 )
-//            v4->field_28 = 0;
-//          v200 = v71;
-//        }
-//      }
-//      LOBYTE(v74) = v26->field_38[11];
-//      if ( (_BYTE)v74 )
-//      {
-//        if ( (_BYTE)v74 == 99 )
-//        {
-//          v75 = v2->field_24;
-//          v76 = v4->field_24;
-//          if ( v75 > v76 )
-//          {
-//            v4->field_24 = v75;
-//            v198 = v75 - v76;
-//          }
-//        }
-//        else
-//        {
-//          v74 = (char)v74;
-//          v6 = (char)v74 + v4->field_24 < 0;
-//          v4->field_24 += (char)v74;
-//          if ( v6 )
-//            v4->field_24 = 0;
-//          v198 = v74;
-//        }
-//      }
-//      LOBYTE(v77) = v26->field_38[12];
-//      if ( (_BYTE)v77 )
-//      {
-//        if ( (_BYTE)v77 == 99 )
-//        {
-//          v78 = v2->field_2C;
-//          v79 = v4->field_2C;
-//          if ( v78 != v79 )
-//          {
-//            if ( v78 <= v79 )
-//            {
-//              v2->field_2C = v79;
-//              v194 = v79 - v78;
-//            }
-//            else
-//            {
-//              v4->field_2C = v78;
-//              v211 = v78 - v79;
-//            }
-//          }
-//        }
-//        else
-//        {
-//          v77 = (char)v77;
-//          v2->field_2C += (char)v77;
-//          v4->field_2C += (char)v77;
-//          if ( v2->field_2C < 0 )
-//            v2->field_2C = 0;
-//          if ( v4->field_2C < 0 )
-//            v4->field_2C = 0;
-//          v194 = v77;
-//          v211 = v77;
-//        }
-//      }
-//      LOBYTE(v80) = v26->field_38[13];
-//      if ( (_BYTE)v80 )
-//      {
-//        if ( (_BYTE)v80 == 99 )
-//        {
-//          v81 = v2->field_30;
-//          v82 = v4->field_30;
-//          if ( v81 != v82 )
-//          {
-//            if ( v81 <= v82 )
-//            {
-//              v2->field_30 = v82;
-//              v210 = v82 - v81;
-//            }
-//            else
-//            {
-//              v4->field_30 = v81;
-//              v209 = v81 - v82;
-//            }
-//          }
-//        }
-//        else
-//        {
-//          v80 = (char)v80;
-//          v2->field_30 += (char)v80;
-//          v4->field_30 += (char)v80;
-//          if ( v2->field_30 < 0 )
-//            v2->field_30 = 0;
-//          if ( v4->field_30 < 0 )
-//            v4->field_30 = 0;
-//          v209 = v80;
-//          v210 = v80;
-//        }
-//      }
-//      LOBYTE(v83) = v26->field_38[14];
-//      if ( (_BYTE)v83 )
-//      {
-//        if ( (_BYTE)v83 == 99 )
-//        {
-//          v84 = v2->field_34;
-//          v85 = v4->field_34;
-//          if ( v84 != v85 )
-//          {
-//            if ( v84 <= v85 )
-//            {
-//              v2->field_34 = v85;
-//              v208 = v85 - v84;
-//            }
-//            else
-//            {
-//              v4->field_34 = v84;
-//              v207 = v84 - v85;
-//            }
-//          }
-//        }
-//        else
-//        {
-//          v83 = (char)v83;
-//          v2->field_34 += (char)v83;
-//          v4->field_34 += (char)v83;
-//          if ( v2->field_34 < 0 )
-//            v2->field_34 = 0;
-//          if ( v4->field_34 < 0 )
-//            v4->field_34 = 0;
-//          v208 = v83;
-//          v207 = v83;
-//        }
-//      }
-//      LOBYTE(v86) = v26->field_38[15];
-//      if ( (_BYTE)v86 )
-//      {
-//        if ( (_BYTE)v86 == 99 )
-//        {
-//          v87 = v2->field_38;
-//          v88 = v4->field_38;
-//          if ( v87 != v88 )
-//          {
-//            if ( v87 <= v88 )
-//            {
-//              v2->field_38 = v88;
-//              v197 = v88 - v87;
-//            }
-//            else
-//            {
-//              v4->field_38 = v87;
-//              v206 = v87 - v88;
-//            }
-//          }
-//        }
-//        else
-//        {
-//          v86 = (char)v86;
-//          v2->field_38 += (char)v86;
-//          v4->field_38 += (char)v86;
-//          if ( v2->field_38 < 0 )
-//            v2->field_38 = 0;
-//          if ( v4->field_38 < 0 )
-//            v4->field_38 = 0;
-//          v197 = v86;
-//          v206 = v86;
-//        }
-//      }
-//      LOBYTE(v89) = v26->field_48[0];
-//      if ( v89 )
-//      {
-//        if ( v89 == 99 )
-//        {
-//          v90 = v2->field_3C;
-//          v91 = v4->field_3C;
-//          if ( v90 != v91 )
-//          {
-//            if ( v90 <= v91 )
-//            {
-//              v205 = v91 > v90;
-//              v2->field_3C = v91;
-//            }
-//            else
-//            {
-//              v204 = 1;
-//              v4->field_3C = v90;
-//            }
-//          }
-//        }
-//        else
-//        {
-//          v89 = v89;
-//          v2->field_3C += v89;
-//          v4->field_3C += v89;
-//          if ( v2->field_3C < 0 )
-//            v2->field_3C = 0;
-//          if ( v4->field_3C < 0 )
-//            v4->field_3C = 0;
-//          v205 = v89;
-//          v204 = v89;
-//        }
-//      }
-//      LOBYTE(v92) = v26->field_48[1];
-//      if ( (_BYTE)v92 )
-//      {
-//        if ( (_BYTE)v92 == 99 )
-//        {
-//          v93 = v2->field_40;
-//          v94 = v4->field_40;
-//          if ( v93 != v94 )
-//          {
-//            if ( v93 <= v94 )
-//            {
-//              v2->field_40 = v94;
-//              v203 = v94 - v93;
-//            }
-//            else
-//            {
-//              v4->field_40 = v93;
-//              v202 = v93 - v94;
-//            }
-//          }
-//        }
-//        else
-//        {
-//          v92 = (char)v92;
-//          v2->field_40 += (char)v92;
-//          v4->field_40 += (char)v92;
-//          if ( v2->field_40 < 0 )
-//            v2->field_40 = 0;
-//          if ( v4->field_40 < 0 )
-//            v4->field_40 = 0;
-//          v203 = v92;
-//          v202 = v92;
-//        }
-//      }
-//      v95 = v26->field_48[2];
-//      if ( v95 )
-//      {
-//        v96 = am_40D402(v193, v95);
-//        v97 = v26->field_48[2];
-//        v196 = v96;
-//        v98 = am_40D402(v189, v97);
-//        v195 = v98;
-//        v99 = v26->field_48[2] - v98;
-//        v192 = v26->field_48[2] - v196;
-//        v191 = v99;
-//      }
-//      LOBYTE(v100) = v26->field_48[3];
-//      if ( (_BYTE)v100 )
-//      {
-//        if ( (_BYTE)v100 == 99 )
-//        {
-//          v101 = v2->field_28;
-//          v102 = v4->field_28;
-//          if ( v101 != v102 )
-//          {
-//            if ( v101 <= v102 )
-//            {
-//              v2->field_28 = v102;
-//              v201 = v102 - v101;
-//            }
-//            else
-//            {
-//              v4->field_28 = v101;
-//              v200 = v101 - v102;
-//            }
-//          }
-//        }
-//        else
-//        {
-//          v100 = (char)v100;
-//          v2->field_28 += (char)v100;
-//          v4->field_28 += (char)v100;
-//          if ( v2->field_28 < 0 )
-//            v2->field_28 = 0;
-//          if ( v4->field_28 < 0 )
-//            v4->field_28 = 0;
-//          v201 = v100;
-//          v200 = v100;
-//        }
-//      }
-//      LOBYTE(v103) = v26->field_48[4];
-//      break;
-//    case 0:
-//LABEL_231:
-//      v104 = pCard->field_48[6];
-//      v105 = v104 + (pCard->field_48[5] == 1);
-//      v106 = 0;
-//      dword_4FAA68 = v104 + (pCard->field_48[5] == 1);
-//      dword_4FAA64 = v104;
-//      if ( v104 > 0 )
-//      {
-//        do
-//        {
-//          am_40A283(v193, v105);
-//          ++v106;
-//        }
-//        while ( v106 < pCard->field_48[6] );
-//      }
-//      v107 = pCard;
-//      am_byte_4FAA77 = GetPlayerHandCardCount(v193) > dword_4E1874;
-//      LOBYTE(v108) = pCard->field_48[7];
-//      if ( (_BYTE)v108 )
-//      {
-//        if ( (_BYTE)v108 == 99 )
-//        {
-//          v109 = v2->field_2C;
-//          v110 = v4->field_2C;
-//          if ( v109 < v110 )
-//          {
-//            v2->field_2C = v110;
-//            v194 = v110 - v109;
-//          }
-//        }
-//        else
-//        {
-//          v108 = (char)v108;
-//          v6 = (char)v108 + v2->field_2C < 0;
-//          v2->field_2C += (char)v108;
-//          if ( v6 )
-//            v2->field_2C = 0;
-//          v194 = v108;
-//        }
-//      }
-//      LOBYTE(v111) = v107->field_48[8];
-//      if ( (_BYTE)v111 )
-//      {
-//        if ( (_BYTE)v111 == 99 )
-//        {
-//          v112 = v2->field_30;
-//          v113 = v4->field_30;
-//          if ( v112 < v113 )
-//          {
-//            v2->field_30 = v113;
-//            v210 = v113 - v112;
-//          }
-//        }
-//        else
-//        {
-//          v111 = (char)v111;
-//          v6 = (char)v111 + v2->field_30 < 0;
-//          v2->field_30 += (char)v111;
-//          if ( v6 )
-//            v2->field_30 = 0;
-//          v210 = v111;
-//        }
-//      }
-//      LOBYTE(v114) = v107->field_48[9];
-//      if ( (_BYTE)v114 )
-//      {
-//        if ( (_BYTE)v114 == 99 )
-//        {
-//          v115 = v2->field_34;
-//          v116 = v4->field_34;
-//          if ( v115 < v116 )
-//          {
-//            v2->field_34 = v116;
-//            v208 = v116 - v115;
-//          }
-//        }
-//        else
-//        {
-//          v114 = (char)v114;
-//          v6 = (char)v114 + v2->field_34 < 0;
-//          v2->field_34 += (char)v114;
-//          if ( v6 )
-//            v2->field_34 = 0;
-//          v208 = v114;
-//        }
-//      }
-//      LOBYTE(v117) = v107->field_48[10];
-//      if ( (_BYTE)v117 )
-//      {
-//        if ( (_BYTE)v117 == 99 )
-//        {
-//          v118 = v2->field_38;
-//          v119 = v4->field_38;
-//          if ( v118 < v119 )
-//          {
-//            v2->field_38 = v119;
-//            v197 = v119 - v118;
-//          }
-//        }
-//        else
-//        {
-//          v117 = (char)v117;
-//          v6 = (char)v117 + v2->field_38 < 0;
-//          v2->field_38 += (char)v117;
-//          if ( v6 )
-//            v2->field_38 = 0;
-//          v197 = v117;
-//        }
-//      }
-//      LOBYTE(v120) = v107->field_48[11];
-//      if ( v120 )
-//      {
-//        if ( v120 == 99 )
-//        {
-//          v121 = v2->field_3C;
-//          v122 = v4->field_3C;
-//          if ( v121 < v122 )
-//          {
-//            v2->field_3C = v122;
-//            v205 = v122 - v121;
-//          }
-//        }
-//        else
-//        {
-//          v120 = v120;
-//          v6 = v120 + v2->field_3C < 0;
-//          v2->field_3C += v120;
-//          if ( v6 )
-//            v2->field_3C = 0;
-//          v205 = v120;
-//        }
-//      }
-//      LOBYTE(v123) = v107->field_48[12];
-//      if ( (_BYTE)v123 )
-//      {
-//        if ( (_BYTE)v123 == 99 )
-//        {
-//          v124 = v2->field_40;
-//          v125 = v4->field_40;
-//          if ( v124 < v125 )
-//          {
-//            v2->field_40 = v125;
-//            v203 = v125 - v124;
-//          }
-//        }
-//        else
-//        {
-//          v123 = (char)v123;
-//          v6 = (char)v123 + v2->field_40 < 0;
-//          v2->field_40 += (char)v123;
-//          if ( v6 )
-//            v2->field_40 = 0;
-//          v203 = v123;
-//        }
-//      }
-//      v126 = v107->field_48[13];
-//      if ( v126 )
-//      {
-//        v196 = am_40D402(v193, v126);
-//        v192 = v107->field_48[13] - v196;
-//      }
-//      LOBYTE(v127) = v107->field_48[14];
-//      if ( (_BYTE)v127 )
-//      {
-//        if ( (_BYTE)v127 == 99 )
-//        {
-//          v128 = v2->field_28;
-//          v129 = v4->field_28;
-//          if ( v128 < v129 )
-//          {
-//            v2->field_28 = v129;
-//            v201 = v129 - v128;
-//          }
-//        }
-//        else
-//        {
-//          v127 = (char)v127;
-//          v6 = (char)v127 + v2->field_28 < 0;
-//          v2->field_28 += (char)v127;
-//          if ( v6 )
-//            v2->field_28 = 0;
-//          v201 = v127;
-//        }
-//      }
-//      LOBYTE(v130) = v107->field_48[15];
-//      if ( (_BYTE)v130 )
-//      {
-//        if ( (_BYTE)v130 == 99 )
-//        {
-//          v131 = v2->field_24;
-//          v132 = v4->field_24;
-//          if ( v131 < v132 )
-//          {
-//            v2->field_24 = v132;
-//            v199 = v132 - v131;
-//          }
-//        }
-//        else
-//        {
-//          v130 = (char)v130;
-//          v6 = (char)v130 + v2->field_24 < 0;
-//          v2->field_24 += (char)v130;
-//          if ( v6 )
-//            v2->field_24 = 0;
-//          v199 = v130;
-//        }
-//      }
-//      LOBYTE(v133) = v107->field_58[0];
-//      if ( (_BYTE)v133 )
-//      {
-//        if ( (_BYTE)v133 == 99 )
-//        {
-//          v134 = v2->field_2C;
-//          v135 = v4->field_2C;
-//          if ( v134 > v135 )
-//          {
-//            v4->field_2C = v134;
-//            v211 = v134 - v135;
-//          }
-//        }
-//        else
-//        {
-//          v133 = (char)v133;
-//          v6 = (char)v133 + v4->field_2C < 0;
-//          v4->field_2C += (char)v133;
-//          if ( v6 )
-//            v4->field_2C = 0;
-//          v211 = v133;
-//        }
-//      }
-//      LOBYTE(v136) = v107->field_58[1];
-//      if ( (_BYTE)v136 )
-//      {
-//        if ( (_BYTE)v136 == 99 )
-//        {
-//          v137 = v2->field_30;
-//          v138 = v4->field_30;
-//          if ( v137 > v138 )
-//          {
-//            v4->field_30 = v137;
-//            v209 = v137 - v138;
-//          }
-//        }
-//        else
-//        {
-//          v136 = (char)v136;
-//          v6 = (char)v136 + v4->field_30 < 0;
-//          v4->field_30 += (char)v136;
-//          if ( v6 )
-//            v4->field_30 = 0;
-//          v209 = v136;
-//        }
-//      }
-//      LOBYTE(v139) = v107->field_58[2];
-//      if ( (_BYTE)v139 )
-//      {
-//        if ( (_BYTE)v139 == 99 )
-//        {
-//          v140 = v2->field_34;
-//          v141 = v4->field_34;
-//          if ( v140 > v141 )
-//          {
-//            v4->field_34 = v140;
-//            v207 = v140 - v141;
-//          }
-//        }
-//        else
-//        {
-//          v139 = (char)v139;
-//          v6 = (char)v139 + v4->field_34 < 0;
-//          v4->field_34 += (char)v139;
-//          if ( v6 )
-//            v4->field_34 = 0;
-//          v207 = v139;
-//        }
-//      }
-//      LOBYTE(v142) = v107->field_58[3];
-//      if ( (_BYTE)v142 )
-//      {
-//        if ( (_BYTE)v142 == 99 )
-//        {
-//          v143 = v2->field_38;
-//          v144 = v4->field_38;
-//          if ( v143 > v144 )
-//          {
-//            v4->field_38 = v143;
-//            v206 = v143 - v144;
-//          }
-//        }
-//        else
-//        {
-//          v142 = (char)v142;
-//          v6 = (char)v142 + v4->field_38 < 0;
-//          v4->field_38 += (char)v142;
-//          if ( v6 )
-//            v4->field_38 = 0;
-//          v206 = v142;
-//        }
-//      }
-//      LOBYTE(v145) = v107->field_58[4];
-//      if ( (_BYTE)v145 )
-//      {
-//        if ( (_BYTE)v145 == 99 )
-//        {
-//          v146 = v2->field_3C;
-//          v147 = v4->field_3C;
-//          if ( v146 > v147 )
-//          {
-//            v4->field_3C = v146;
-//            v204 = v146 - v147;
-//          }
-//        }
-//        else
-//        {
-//          v145 = (char)v145;
-//          v6 = (char)v145 + v4->field_3C < 0;
-//          v4->field_3C += (char)v145;
-//          if ( v6 )
-//            v4->field_3C = 0;
-//          v204 = v145;
-//        }
-//      }
-//      LOBYTE(v148) = v107->field_58[5];
-//      if ( (_BYTE)v148 )
-//      {
-//        if ( (_BYTE)v148 == 99 )
-//        {
-//          v149 = v2->field_40;
-//          v150 = v4->field_40;
-//          if ( v149 > v150 )
-//          {
-//            v4->field_40 = v149;
-//            v202 = v149 - v150;
-//          }
-//        }
-//        else
-//        {
-//          v148 = (char)v148;
-//          v6 = (char)v148 + v4->field_40 < 0;
-//          v4->field_40 += (char)v148;
-//          if ( v6 )
-//            v4->field_40 = 0;
-//          v202 = v148;
-//        }
-//      }
-//      v151 = v107->field_58[6];
-//      if ( v151 )
-//      {
-//        v195 = am_40D402(v189, v151);
-//        v191 = v107->field_58[6] - v195;
-//      }
-//      LOBYTE(v152) = v107->field_58[7];
-//      if ( (_BYTE)v152 )
-//      {
-//        if ( (_BYTE)v152 == 99 )
-//        {
-//          v153 = v2->field_28;
-//          v154 = v4->field_28;
-//          if ( v153 > v154 )
-//          {
-//            v4->field_28 = v153;
-//            v200 = v153 - v154;
-//          }
-//        }
-//        else
-//        {
-//          v152 = (char)v152;
-//          v6 = (char)v152 + v4->field_28 < 0;
-//          v4->field_28 += (char)v152;
-//          if ( v6 )
-//            v4->field_28 = 0;
-//          v200 = v152;
-//        }
-//      }
-//      LOBYTE(v155) = v107->field_58[8];
-//      if ( (_BYTE)v155 )
-//      {
-//        if ( (_BYTE)v155 == 99 )
-//        {
-//          v156 = v2->field_24;
-//          v157 = v4->field_24;
-//          if ( v156 > v157 )
-//          {
-//            v4->field_24 = v156;
-//            v198 = v156 - v157;
-//          }
-//        }
-//        else
-//        {
-//          v155 = (char)v155;
-//          v6 = (char)v155 + v4->field_24 < 0;
-//          v4->field_24 += (char)v155;
-//          if ( v6 )
-//            v4->field_24 = 0;
-//          v198 = v155;
-//        }
-//      }
-//      LOBYTE(v158) = v107->field_58[9];
-//      if ( (_BYTE)v158 )
-//      {
-//        if ( (_BYTE)v158 == 99 )
-//        {
-//          v159 = v2->field_2C;
-//          v160 = v4->field_2C;
-//          if ( v159 != v160 )
-//          {
-//            if ( v159 <= v160 )
-//            {
-//              v2->field_2C = v160;
-//              v194 = v160 - v159;
-//            }
-//            else
-//            {
-//              v4->field_2C = v159;
-//              v211 = v159 - v160;
-//            }
-//          }
-//        }
-//        else
-//        {
-//          v158 = (char)v158;
-//          v2->field_2C += (char)v158;
-//          v4->field_2C += (char)v158;
-//          if ( v2->field_2C < 0 )
-//            v2->field_2C = 0;
-//          if ( v4->field_2C < 0 )
-//            v4->field_2C = 0;
-//          v194 = v158;
-//          v211 = v158;
-//        }
-//      }
-//      LOBYTE(v161) = v107->field_58[10];
-//      if ( (_BYTE)v161 )
-//      {
-//        if ( (_BYTE)v161 == 99 )
-//        {
-//          v162 = v2->field_30;
-//          v163 = v4->field_30;
-//          if ( v162 != v163 )
-//          {
-//            if ( v162 <= v163 )
-//            {
-//              v2->field_30 = v163;
-//              v210 = v163 - v162;
-//            }
-//            else
-//            {
-//              v4->field_30 = v162;
-//              v209 = v162 - v163;
-//            }
-//          }
-//        }
-//        else
-//        {
-//          v161 = (char)v161;
-//          v2->field_30 += (char)v161;
-//          v4->field_30 += (char)v161;
-//          if ( v2->field_30 < 0 )
-//            v2->field_30 = 0;
-//          if ( v4->field_30 < 0 )
-//            v4->field_30 = 0;
-//          v209 = v161;
-//          v210 = v161;
-//        }
-//      }
-//      LOBYTE(v164) = v107->field_58[11];
-//      if ( (_BYTE)v164 )
-//      {
-//        if ( (_BYTE)v164 == 99 )
-//        {
-//          v165 = v2->field_34;
-//          v166 = v4->field_34;
-//          if ( v165 != v166 )
-//          {
-//            if ( v165 <= v166 )
-//            {
-//              v2->field_34 = v166;
-//              v208 = v166 - v165;
-//            }
-//            else
-//            {
-//              v4->field_34 = v165;
-//              v207 = v165 - v166;
-//            }
-//          }
-//        }
-//        else
-//        {
-//          v164 = (char)v164;
-//          v2->field_34 += (char)v164;
-//          v4->field_34 += (char)v164;
-//          if ( v2->field_34 < 0 )
-//            v2->field_34 = 0;
-//          if ( v4->field_34 < 0 )
-//            v4->field_34 = 0;
-//          v208 = v164;
-//          v207 = v164;
-//        }
-//      }
-//      LOBYTE(v167) = v107->field_58[12];
-//      if ( (_BYTE)v167 )
-//      {
-//        if ( (_BYTE)v167 == 99 )
-//        {
-//          v168 = v2->field_38;
-//          v169 = v4->field_38;
-//          if ( v168 != v169 )
-//          {
-//            if ( v168 <= v169 )
-//            {
-//              v2->field_38 = v169;
-//              v197 = v169 - v168;
-//            }
-//            else
-//            {
-//              v4->field_38 = v168;
-//              v206 = v168 - v169;
-//            }
-//          }
-//        }
-//        else
-//        {
-//          v167 = (char)v167;
-//          v2->field_38 += (char)v167;
-//          v4->field_38 += (char)v167;
-//          if ( v2->field_38 < 0 )
-//            v2->field_38 = 0;
-//          if ( v4->field_38 < 0 )
-//            v4->field_38 = 0;
-//          v197 = v167;
-//          v206 = v167;
-//        }
-//      }
-//      LOBYTE(v170) = v107->field_58[13];
-//      if ( v170 )
-//      {
-//        if ( v170 == 99 )
-//        {
-//          v171 = v2->field_3C;
-//          v172 = v4->field_3C;
-//          if ( v171 != v172 )
-//          {
-//            if ( v171 <= v172 )
-//            {
-//              v205 = v172 > v171;
-//              v2->field_3C = v172;
-//            }
-//            else
-//            {
-//              v204 = 1;
-//              v4->field_3C = v171;
-//            }
-//          }
-//        }
-//        else
-//        {
-//          v170 = v170;
-//          v2->field_3C += v170;
-//          v4->field_3C += v170;
-//          if ( v2->field_3C < 0 )
-//            v2->field_3C = 0;
-//          if ( v4->field_3C < 0 )
-//            v4->field_3C = 0;
-//          v205 = v170;
-//          v204 = v170;
-//        }
-//      }
-//      LOBYTE(v173) = v107->field_58[14];
-//      if ( (_BYTE)v173 )
-//      {
-//        if ( (_BYTE)v173 == 99 )
-//        {
-//          v174 = v2->field_40;
-//          v175 = v4->field_40;
-//          if ( v174 != v175 )
-//          {
-//            if ( v174 <= v175 )
-//            {
-//              v2->field_40 = v175;
-//              v203 = v175 - v174;
-//            }
-//            else
-//            {
-//              v4->field_40 = v174;
-//              v202 = v174 - v175;
-//            }
-//          }
-//        }
-//        else
-//        {
-//          v173 = (char)v173;
-//          v2->field_40 += (char)v173;
-//          v4->field_40 += (char)v173;
-//          if ( v2->field_40 < 0 )
-//            v2->field_40 = 0;
-//          if ( v4->field_40 < 0 )
-//            v4->field_40 = 0;
-//          v203 = v173;
-//          v202 = v173;
-//        }
-//      }
-//      v176 = v107->field_58[15];
-//      if ( v176 )
-//      {
-//        v177 = am_40D402(v193, v176);
-//        v178 = v107->field_58[15];
-//        v196 = v177;
-//        v179 = am_40D402(v189, v178);
-//        v195 = v179;
-//        v180 = v107->field_58[15] - v179;
-//        v192 = v107->field_58[15] - v196;
-//        v191 = v180;
-//      }
-//      LOBYTE(v181) = LOBYTE(v107->field_68);
-//      if ( (_BYTE)v181 )
-//      {
-//        if ( (_BYTE)v181 == 99 )
-//        {
-//          v182 = v2->field_28;
-//          v183 = v4->field_28;
-//          if ( v182 != v183 )
-//          {
-//            if ( v182 <= v183 )
-//            {
-//              v2->field_28 = v183;
-//              v201 = v183 - v182;
-//            }
-//            else
-//            {
-//              v4->field_28 = v182;
-//              v200 = v182 - v183;
-//            }
-//          }
-//        }
-//        else
-//        {
-//          v181 = (char)v181;
-//          v2->field_28 += (char)v181;
-//          v4->field_28 += (char)v181;
-//          if ( v2->field_28 < 0 )
-//            v2->field_28 = 0;
-//          if ( v4->field_28 < 0 )
-//            v4->field_28 = 0;
-//          v201 = v181;
-//          v200 = v181;
-//        }
-//      }
-//      LOBYTE(v103) = BYTE1(v107->field_68);
-//      break;
-//  }
-//  if ( (_BYTE)v103 )
-//  {
-//    if ( (_BYTE)v103 == 99 )
-//    {
-//      v184 = v2->field_24;
-//      v185 = v4->field_24;
-//      if ( v184 != v185 )
-//      {
-//        if ( v184 <= v185 )
-//        {
-//          v2->field_24 = v185;
-//          v199 = v185 - v184;
-//        }
-//        else
-//        {
-//          v4->field_24 = v184;
-//          v198 = v184 - v185;
-//        }
-//      }
-//    }
-//    else
-//    {
-//      v103 = (char)v103;
-//      v2->field_24 += (char)v103;
-//      v4->field_24 += (char)v103;
-//      if ( v2->field_24 < 0 )
-//        v2->field_24 = 0;
-//      if ( v4->field_24 < 0 )
-//        v4->field_24 = 0;
-//      v199 = v103;
-//      v198 = v103;
-//    }
-//  }
-//  if ( v194 > 0 || v211 > 0 )
-//    ArcomageGame::PlaySound(0x1Eu);
-//  if ( v194 < 0 || v211 < 0 )
-//    ArcomageGame::PlaySound(0x1Fu);
-//  if ( v210 > 0 || v209 > 0 )
-//    ArcomageGame::PlaySound(0x21u);
-//  if ( v210 < 0 || v209 < 0 )
-//    ArcomageGame::PlaySound(0x22u);
-//  if ( v208 > 0 || v207 > 0 )
-//    ArcomageGame::PlaySound(0x24u);
-//  if ( v208 < 0 || v207 < 0 )
-//    ArcomageGame::PlaySound(0x25u);
-//  if ( v197 > 0 || v206 > 0 )
-//    ArcomageGame::PlaySound(0x27u);
-//  if ( v197 < 0 || v206 < 0 )
-//    ArcomageGame::PlaySound(0x28u);
-//  if ( v205 > 0 || v204 > 0 )
-//    ArcomageGame::PlaySound(0x2Au);
-//  if ( v205 < 0 || v204 < 0 )
-//    ArcomageGame::PlaySound(0x2Bu);
-//  if ( v203 > 0 || v202 > 0 )
-//    ArcomageGame::PlaySound(0x2Du);
-//  if ( v203 < 0 || v202 < 0 )
-//    ArcomageGame::PlaySound(0x2Eu);
-//  if ( v192 || v191 || v196 || v195 )
-//    ArcomageGame::PlaySound(0x30u);
-//  if ( v201 > 0 || v200 > 0 )
-//    ArcomageGame::PlaySound(0x31u);
-//  if ( v201 < 0 || v200 < 0 )
-//    ArcomageGame::PlaySound(0x32u);
-//  if ( v199 > 0 || v198 > 0 )
-//    ArcomageGame::PlaySound(0x34u);
-//  if ( v199 < 0 || v198 < 0 )
-//    ArcomageGame::PlaySound(0x35u);
-//  if ( v193 )
-//  {
-//    if ( v194 )
-//    {
-//      v187.x = 573;
-//      v187.y = 92;
-//      am_40D2B4(&v187, v194);
-//    }
-//    if ( v211 )
-//    {
-//      v187.x = 26;
-//      v187.y = 92;
-//      am_40D2B4(&v187, v211);
-//    }
-//    if ( v210 )
-//    {
-//      v187.x = 573;
-//      v187.y = 164;
-//      am_40D2B4(&v187, v210);
-//    }
-//    if ( v209 )
-//    {
-//      v187.x = 26;
-//      v187.y = 164;
-//      am_40D2B4(&v187, v209);
-//    }
-//    if ( v208 )
-//    {
-//      v187.x = 573;
-//      v187.y = 236;
-//      am_40D2B4(&v187, v208);
-//    }
-//    if ( v207 )
-//    {
-//      v187.x = 26;
-//      v187.y = 236;
-//      am_40D2B4(&v187, v207);
-//    }
-//    if ( v197 )
-//    {
-//      v187.x = 563;
-//      v187.y = 114;
-//      am_40D2B4(&v187, v197);
-//    }
-//    if ( v206 )
-//    {
-//      v187.x = 16;
-//      v187.y = 114;
-//      am_40D2B4(&v187, v206);
-//    }
-//    if ( v205 )
-//    {
-//      v187.x = 563;
-//      v187.y = 186;
-//      am_40D2B4(&v187, v205);
-//    }
-//    if ( v204 )
-//    {
-//      v187.x = 16;
-//      v187.y = 186;
-//      am_40D2B4(&v187, v204);
-//    }
-//    if ( v203 )
-//    {
-//      v187.x = 563;
-//      v187.y = 258;
-//      am_40D2B4(&v187, v203);
-//    }
-//    if ( v202 )
-//    {
-//      v187.x = 16;
-//      v187.y = 258;
-//      am_40D2B4(&v187, v202);
-//    }
-//    v186 = 296;
-//    if ( v201 )
-//    {
-//      v187.x = 442;
-//      v187.y = 296;
-//      am_40D2B4(&v187, v201);
-//    }
-//    if ( v200 )
-//    {
-//      v187.x = 180;
-//      v187.y = 296;
-//      am_40D2B4(&v187, v200);
-//    }
-//    if ( v199 )
-//    {
-//      v187.x = 514;
-//      v187.y = 296;
-//      am_40D2B4(&v187, v199);
-//    }
-//    if ( v198 )
-//    {
-//      v187.x = 122;
-//      v187.y = 296;
-//      am_40D2B4(&v187, v198);
-//    }
-//    if ( v196 )
-//    {
-//      v187.x = 442;
-//      v187.y = 296;
-//      am_40D2B4(&v187, v196);
-//    }
-//    if ( v192 )
-//    {
-//      v187.x = 514;
-//      v187.y = 296;
-//      am_40D2B4(&v187, v192);
-//    }
-//    if ( v195 )
-//    {
-//      v187.x = 180;
-//      v187.y = 296;
-//      am_40D2B4(&v187, v195);
-//    }
-//    if ( v191 )
-//    {
-//      v187.x = 122;
-//      goto LABEL_567;
-//    }
-//  }
-//  else
-//  {
-//    if ( v194 )
-//    {
-//      v187.x = 26;
-//      v187.y = 92;
-//      am_40D2B4(&v187, v194);
-//    }
-//    if ( v211 )
-//    {
-//      v187.x = 573;
-//      v187.y = 92;
-//      am_40D2B4(&v187, v211);
-//    }
-//    if ( v210 )
-//    {
-//      v187.x = 26;
-//      v187.y = 164;
-//      am_40D2B4(&v187, v210);
-//    }
-//    if ( v209 )
-//    {
-//      v187.x = 573;
-//      v187.y = 164;
-//      am_40D2B4(&v187, v209);
-//    }
-//    if ( v208 )
-//    {
-//      v187.x = 26;
-//      v187.y = 236;
-//      am_40D2B4(&v187, v208);
-//    }
-//    if ( v207 )
-//    {
-//      v187.x = 573;
-//      v187.y = 236;
-//      am_40D2B4(&v187, v207);
-//    }
-//    if ( v197 )
-//    {
-//      v187.x = 16;
-//      v187.y = 114;
-//      am_40D2B4(&v187, v197);
-//    }
-//    if ( v206 )
-//    {
-//      v187.x = 563;
-//      v187.y = 114;
-//      am_40D2B4(&v187, v206);
-//    }
-//    if ( v205 )
-//    {
-//      v187.x = 16;
-//      v187.y = 186;
-//      am_40D2B4(&v187, v205);
-//    }
-//    if ( v204 )
-//    {
-//      v187.x = 563;
-//      v187.y = 186;
-//      am_40D2B4(&v187, v204);
-//    }
-//    if ( v203 )
-//    {
-//      v187.x = 16;
-//      v187.y = 258;
-//      am_40D2B4(&v187, v203);
-//    }
-//    if ( v202 )
-//    {
-//      v187.x = 563;
-//      v187.y = 258;
-//      am_40D2B4(&v187, v202);
-//    }
-//    v186 = 296;
-//    if ( v201 )
-//    {
-//      v187.x = 180;
-//      v187.y = 296;
-//      am_40D2B4(&v187, v201);
-//    }
-//    if ( v200 )
-//    {
-//      v187.x = 442;
-//      v187.y = 296;
-//      am_40D2B4(&v187, v200);
-//    }
-//    if ( v199 )
-//    {
-//      v187.x = 122;
-//      v187.y = 296;
-//      am_40D2B4(&v187, v199);
-//    }
-//    if ( v198 )
-//    {
-//      v187.x = 514;
-//      v187.y = 296;
-//      am_40D2B4(&v187, v198);
-//    }
-//    if ( v196 )
-//    {
-//      v187.x = 180;
-//      v187.y = 296;
-//      am_40D2B4(&v187, v196);
-//    }
-//    if ( v192 )
-//    {
-//      v187.x = 122;
-//      v187.y = 296;
-//      am_40D2B4(&v187, v192);
-//    }
-//    if ( v195 )
-//    {
-//      v187.x = 442;
-//      v187.y = 296;
-//      am_40D2B4(&v187, v195);
-//    }
-//    if ( v191 )
-//    {
-//      v187.x = 514;
-//LABEL_567:
-//      v187.y = v186;
-//      am_40D2B4(&v187, v191);
-//      return;
-//    }
-//  }
+
+  
+#define APPLY_TO_PLAYER( PLAYER, ENEMY,FIELD, VAL, RES )\
+        if ((signed int)(VAL) == 99)\
+        {\
+        if ( PLAYER->##FIELD < ENEMY->##FIELD )\
+        {\
+          PLAYER->##FIELD = ENEMY->##FIELD;\
+          RES = ENEMY->##FIELD - PLAYER->##FIELD;\
+        }\
+        }\
+     else if ((signed int)(VAL) != 0)\
+        {\
+        PLAYER->##FIELD += (signed int)(VAL);\
+        if (  PLAYER->##FIELD<0 )\
+            PLAYER->##FIELD= 0;\
+        RES = (signed int)(VAL);\
+        }
+
+#define APPLY_TO_ENEMY( PLAYER, ENEMY,FIELD, VAL, RES ) APPLY_TO_PLAYER(ENEMY, PLAYER, FIELD, VAL, RES)
+
+#define APPLY_TO_BOTH( PLAYER, ENEMY, FIELD, VAL, RES_P, RES_E ) \
+        if ( (signed int)(VAL) == 99 )  { \
+            if ( PLAYER->##FIELD != ENEMY->##FIELD )  { \
+                if ( PLAYER->##FIELD <= ENEMY->##FIELD )  { \
+                    PLAYER->##FIELD = ENEMY->##FIELD; \
+                    RES_P = ENEMY->##FIELD - PLAYER->##FIELD; \
+                }  else { \
+                    ENEMY->##FIELD = PLAYER->##FIELD; \
+                    RES_E = PLAYER->##FIELD - ENEMY->##FIELD; \
+                    } \
+                }\
+            } \
+        else if ((signed int)VAL != 0) { \
+            PLAYER->##FIELD += (signed int)(VAL);\
+            ENEMY->##FIELD  += (signed int)(VAL); if (PLAYER->##FIELD < 0 ) {PLAYER->##FIELD = 0;} \
+            if ( ENEMY->##FIELD < 0 ) {ENEMY->##FIELD = 0;} \
+            RES_P = (signed int)(VAL); \
+            RES_E = (signed int)(VAL); \
+            }
+      
+        ArcomagePlayer *player; // esi@1
+        int v3; // eax@1
+        ArcomagePlayer *enemy; // edi@1
+        int v5; // eax@2
+        char v6; // sf@2
+        unsigned __int8 v7; // of@2
+        int v8; // eax@3
+        int v9; // eax@4
+        char v10; // zf@5
+        int v11; // eax@8
+        unsigned __int8 v12; // zf@8
+        char v13; // sf@8
+        unsigned __int8 v14; // of@8
+        int v15; // eax@9
+        int v16; // eax@10
+        char v17; // zf@12
+        char v18; // al@15
+        int v19; // eax@16
+        int v20; // eax@17
+        int v21; // eax@22
+        int v22; // eax@23
+        int v23; // eax@26
+        signed int v24; // ebx@26
+        int v103;
+        int v104;
+
+        POINT v184; // [sp+Ch] [bp-64h]@488
+        int enemy_num; // [sp+14h] [bp-5Ch]@1
+        ArcomageCard *pCard; // [sp+18h] [bp-58h]@1
+        int buildings_e; // [sp+1Ch] [bp-54h]@1
+        int buildings_p; // [sp+20h] [bp-50h]@1
+        int quarry_p; // [sp+28h] [bp-48h]@1
+        int dmg_e; // [sp+2Ch] [bp-44h]@1
+        int dmg_p; // [sp+30h] [bp-40h]@1
+        int bricks_p; // [sp+34h] [bp-3Ch]@1
+        int tower_e; // [sp+38h] [bp-38h]@1
+        int tower_p; // [sp+3Ch] [bp-34h]@1
+        int wall_e; // [sp+40h] [bp-30h]@1
+        int wall_p; // [sp+44h] [bp-2Ch]@1
+        int beasts_e; // [sp+48h] [bp-28h]@1
+        int beasts_p; // [sp+4Ch] [bp-24h]@1
+        int gems_e; // [sp+50h] [bp-20h]@1
+        int gems_p; // [sp+54h] [bp-1Ch]@1
+        int bricks_e; // [sp+58h] [bp-18h]@1
+        int zoo_e; // [sp+5Ch] [bp-14h]@1
+        int zoo_p; // [sp+60h] [bp-10h]@1
+        int magic_e; // [sp+64h] [bp-Ch]@1
+        int magic_p; // [sp+68h] [bp-8h]@1
+        int quarry_e; // [sp+6Ch] [bp-4h]@1
+
+        quarry_p = 0;
+        magic_p = 0;
+        zoo_p = 0;
+        bricks_p = 0;
+        gems_p = 0;
+        beasts_p = 0;
+        wall_p = 0;
+        tower_p = 0;
+        buildings_p = 0;
+        dmg_p = 0;
+        quarry_e = 0;
+        magic_e = 0;
+        zoo_e = 0;
+        bricks_e = 0;
+        gems_e = 0;
+        beasts_e = 0;
+        wall_e = 0;
+        tower_e = 0;
+        buildings_e = 0;
+        dmg_e = 0;
+
+        player = &am_Players[player_num];
+        pCard = &pCards[uCardID];
+        enemy_num = (player_num + 1) % 2;
+        enemy = &am_Players[enemy_num];
+        switch ( pCard->compare_param )
+            {
+        case 2:
+            v5 = player->quarry_level;
+            v7 = __OFSUB__(v5, enemy->quarry_level);
+            v6 = v5 - enemy->quarry_level < 0;
+            goto LABEL_18;
+        case 3:
+            v8 = player->magic_level;
+            v7 = __OFSUB__(v8, enemy->magic_level);
+            v6 = v8 - enemy->magic_level < 0;
+            goto LABEL_18;
+        case 4:
+            v9 = player->zoo_level;
+            v7 = __OFSUB__(v9, enemy->zoo_level);
+            v6 = v9 - enemy->zoo_level < 0;
+            goto LABEL_18;
+        case 5:
+            v10 = player->quarry_level == enemy->quarry_level;
+            goto LABEL_21;
+        case 6:
+            v10 = player->magic_level == enemy->magic_level;
+            goto LABEL_21;
+        case 7:
+            v10 = player->zoo_level == enemy->zoo_level;
+            goto LABEL_21;
+        case 8:
+            v11 = player->quarry_level;
+            v14 = __OFSUB__(v11, enemy->quarry_level);
+            v12 = v11 == enemy->quarry_level;
+            v13 = v11 - enemy->quarry_level < 0;
+            goto LABEL_24;
+        case 9:
+            v15 = player->magic_level;
+            v14 = __OFSUB__(v15, enemy->magic_level);
+            v12 = v15 == enemy->magic_level;
+            v13 = v15 - enemy->magic_level < 0;
+            goto LABEL_24;
+        case 10:
+            v16 = player->zoo_level;
+            v14 = __OFSUB__(v16, enemy->zoo_level);
+            v12 = v16 == enemy->zoo_level;
+            v13 = v16 - enemy->zoo_level < 0;
+            goto LABEL_24;
+        case 11:
+            v10 = player->wall_height == 0;
+            goto LABEL_21;
+        case 12:
+            v17 = player->wall_height == 0;
+            goto LABEL_15;
+        case 13:
+            v10 = enemy->wall_height == 0;
+            goto LABEL_21;
+        case 14:
+            v17 = enemy->wall_height == 0;
+LABEL_15:
+            v18 = !v17;
+            goto LABEL_25;
+        case 15:
+            v19 = player->wall_height;
+            v7 = __OFSUB__(v19, enemy->wall_height);
+            v6 = v19 - enemy->wall_height < 0;
+            goto LABEL_18;
+        case 16:
+            v20 = player->tower_height;
+            v7 = __OFSUB__(v20, enemy->tower_height);
+            v6 = v20 - enemy->tower_height < 0;
+LABEL_18:
+            v18 = v6 ^ v7;
+            goto LABEL_25;
+        case 17:
+            v10 = player->wall_height == enemy->wall_height;
+            goto LABEL_21;
+        case 18:
+            v10 = player->tower_height == enemy->tower_height;
+LABEL_21:
+            v18 = v10;
+            goto LABEL_25;
+        case 19:
+            v21 = player->wall_height;
+            v14 = __OFSUB__(v21, enemy->wall_height);
+            v12 = v21 == enemy->wall_height;
+            v13 = v21 - enemy->wall_height < 0;
+            goto LABEL_24;
+        case 20:
+            v22 = player->tower_height;
+            v14 = __OFSUB__(v22, enemy->tower_height);
+            v12 = v22 == enemy->tower_height;
+            v13 = v22 - enemy->tower_height < 0;
+LABEL_24:
+            v18 = !((v13 ^ v14) | v12);
+LABEL_25:
+            if ( v18 )
+                goto LABEL_26;
+            goto LABEL_231;
+        default:
+LABEL_26:
+            v23 = pCard->can_draw_extra_card;
+            v24 = 0;
+            dword_4FAA68 = v23 + (pCard->field_30 == 1);
+            dword_4FAA64 = v23;
+            if ( v23 > 0 )
+                {
+                do
+                    {
+                    GetNextCardFromDeck(player_num);
+                    ++v24;
+                    }
+                    while ( v24 < pCard->can_draw_extra_card );
+                }
+
+            hand_full = GetPlayerHandCardCount(player_num) > minimum_cards_at_hand;
+
+
+            APPLY_TO_PLAYER(player, enemy, quarry_level,    pCard->to_player_quarry_lvl, quarry_p);
+            APPLY_TO_PLAYER(player, enemy, magic_level,     pCard->to_player_magic_lvl,  magic_p);
+            APPLY_TO_PLAYER(player, enemy, zoo_level,       pCard->to_player_zoo_lvl,    zoo_p);
+            APPLY_TO_PLAYER(player, enemy, resource_bricks, pCard->to_player_bricks,     bricks_p);
+            APPLY_TO_PLAYER(player, enemy, resource_gems,   pCard->to_player_gems,       gems_p);
+            APPLY_TO_PLAYER(player, enemy, resource_beasts, pCard->to_player_beasts,     beasts_p);
+            if ( (int)pCard->to_player_buildings )
+                {
+                dmg_p = ApplyDamadeToBuildings(player_num, (int)pCard->to_player_buildings);
+                buildings_p = (int)pCard->to_player_buildings - dmg_p;
+                }
+            APPLY_TO_PLAYER(player, enemy, wall_height,  pCard->to_player_wall, wall_p);
+            APPLY_TO_PLAYER(player, enemy, tower_height, pCard->to_player_tower, tower_p);
+
+           APPLY_TO_ENEMY(player, enemy, quarry_level,    pCard->to_enemy_quarry_lvl, quarry_e);
+           APPLY_TO_ENEMY(player, enemy, magic_level,     pCard->to_enemy_magic_lvl,  magic_e);
+           APPLY_TO_ENEMY(player, enemy, zoo_level,       pCard->to_enemy_zoo_lvl,    zoo_e);
+           APPLY_TO_ENEMY(player, enemy, resource_bricks, pCard->to_enemy_bricks,     bricks_e);
+           APPLY_TO_ENEMY(player, enemy, resource_gems,   pCard->to_enemy_gems,       gems_e);
+           APPLY_TO_ENEMY(player, enemy, resource_beasts, pCard->to_enemy_beasts,     beasts_e);
+            if ( pCard->to_enemy_buildings )
+                {
+                dmg_e = ApplyDamadeToBuildings(enemy_num, (int)pCard->to_enemy_buildings);
+                buildings_e = pCard->to_enemy_buildings - dmg_e;
+                }
+            APPLY_TO_ENEMY(player, enemy, wall_height,  pCard->to_enemy_wall,  wall_e);
+            APPLY_TO_ENEMY(player, enemy, tower_height, pCard->to_enemy_tower, tower_e);
+            
+            APPLY_TO_BOTH(player, enemy, quarry_level,    pCard->to_pl_enm_quarry_lvl, quarry_p, quarry_e);
+            APPLY_TO_BOTH(player, enemy, magic_level,     pCard->to_pl_enm_magic_lvl,  magic_p,  magic_e);
+            APPLY_TO_BOTH(player, enemy, zoo_level,       pCard->to_pl_enm_zoo_lvl,    zoo_p,    zoo_e);
+            APPLY_TO_BOTH(player, enemy, resource_bricks, pCard->to_pl_enm_bricks,     bricks_p, bricks_e);
+            APPLY_TO_BOTH(player, enemy, resource_gems,   pCard->to_pl_enm_gems,       gems_p,   gems_e);
+            APPLY_TO_BOTH(player, enemy, resource_beasts, pCard->to_pl_enm_beasts,     beasts_p, beasts_e);
+            if ( pCard->to_pl_enm_buildings )
+                {
+                dmg_p = ApplyDamadeToBuildings(player_num, (int)pCard->to_pl_enm_buildings);
+                dmg_e = ApplyDamadeToBuildings(enemy_num,  (int)pCard->to_pl_enm_buildings);
+                buildings_p = pCard->to_pl_enm_buildings - dmg_p;
+                buildings_e = pCard->to_pl_enm_buildings - dmg_e;
+                }
+            APPLY_TO_BOTH(player, enemy, wall_height, pCard->to_pl_enm_wall, wall_p, wall_e);
+            APPLY_TO_BOTH(player, enemy, tower_height, pCard->to_pl_enm_tower, tower_p, tower_e);
+            break;
+        case 0:
+LABEL_231:
+            v103 = pCard->can_draw_extra_card2;
+            v104 = 0;
+            dword_4FAA68 = v103 + (pCard->field_4D == 1);
+            dword_4FAA64 = v103;
+            if ( v103 > 0 )
+                {
+                do
+                    {
+                    GetNextCardFromDeck(player_num);
+                    ++v104;
+                    }
+                    while ( v104 < pCard->can_draw_extra_card2 );
+                }
+
+            hand_full = GetPlayerHandCardCount(player_num) > minimum_cards_at_hand;
+
+            APPLY_TO_PLAYER(player, enemy, quarry_level,    pCard->to_player_quarry_lvl2, quarry_p);
+            APPLY_TO_PLAYER(player, enemy, magic_level,     pCard->to_player_magic_lvl2,  magic_p);
+            APPLY_TO_PLAYER(player, enemy, zoo_level,       pCard->to_player_zoo_lvl2,    zoo_p);
+            APPLY_TO_PLAYER(player, enemy, resource_bricks, pCard->to_player_bricks2,     bricks_p);
+            APPLY_TO_PLAYER(player, enemy, resource_gems,   pCard->to_player_gems2,       gems_p);
+            APPLY_TO_PLAYER(player, enemy, resource_beasts, pCard->to_player_beasts2,     beasts_p);
+            if ( pCard->to_player_buildings2 )
+                {
+                dmg_p = ApplyDamadeToBuildings(player_num, (int)pCard->to_player_buildings2);
+                buildings_p = (int)pCard->to_player_buildings2 - dmg_p;
+                }
+            APPLY_TO_PLAYER(player, enemy, wall_height,  pCard->to_player_wall2,  wall_p);
+            APPLY_TO_PLAYER(player, enemy, tower_height, pCard->to_player_tower2, tower_p);
+
+            APPLY_TO_ENEMY(player, enemy, quarry_level,    pCard->to_enemy_quarry_lvl2, quarry_e);
+            APPLY_TO_ENEMY(player, enemy, magic_level,     pCard->to_enemy_magic_lvl2,  magic_e);
+            APPLY_TO_ENEMY(player, enemy, zoo_level,       pCard->to_enemy_zoo_lvl2,    zoo_e);
+            APPLY_TO_ENEMY(player, enemy, resource_bricks, pCard->to_enemy_bricks2,     bricks_e);
+            APPLY_TO_ENEMY(player, enemy, resource_gems,   pCard->to_enemy_gems2,       gems_e);
+            APPLY_TO_ENEMY(player, enemy, resource_beasts, pCard->to_enemy_beasts2,     beasts_e);
+            if ( pCard->to_enemy_buildings2 )
+                {
+                dmg_e = ApplyDamadeToBuildings(enemy_num, (int)pCard->to_enemy_buildings2);
+                buildings_e = (int)pCard->to_enemy_buildings2 - dmg_e;
+                }
+            APPLY_TO_ENEMY(player, enemy, wall_height,  pCard->to_enemy_wall2,  wall_e);
+            APPLY_TO_ENEMY(player, enemy, tower_height, pCard->to_enemy_tower2, tower_e);
+
+            APPLY_TO_BOTH(player, enemy, quarry_level,    pCard->to_pl_enm_quarry_lvl2, quarry_p, quarry_e);
+            APPLY_TO_BOTH(player, enemy, magic_level,     pCard->to_pl_enm_magic_lvl2,  magic_p,  magic_e);
+            APPLY_TO_BOTH(player, enemy, zoo_level,       pCard->to_pl_enm_zoo_lvl2,    zoo_p,    zoo_e);
+            APPLY_TO_BOTH(player, enemy, resource_bricks, pCard->to_pl_enm_bricks2,     bricks_p, bricks_e);
+            APPLY_TO_BOTH(player, enemy, resource_gems,   pCard->to_pl_enm_gems2,       gems_p,   gems_e);
+            APPLY_TO_BOTH(player, enemy, resource_beasts, pCard->to_pl_enm_beasts2,     beasts_p, beasts_e);
+
+            if ( pCard->to_pl_enm_buildings2 )
+                {
+                dmg_p = ApplyDamadeToBuildings(player_num, (int)pCard->to_pl_enm_buildings2);
+                dmg_e = ApplyDamadeToBuildings(enemy_num,  (int)pCard->to_pl_enm_buildings2);
+                buildings_p = (int)pCard->to_pl_enm_buildings2 - dmg_p;
+                buildings_e = (int)pCard->to_pl_enm_buildings2 - dmg_e;
+                }
+            APPLY_TO_BOTH(player, enemy, wall_height, pCard->to_pl_enm_wall2, wall_p, wall_e);
+            APPLY_TO_BOTH(player, enemy, tower_height, pCard->to_pl_enm_tower2, tower_p, tower_e);    
+            break;
+            }
+          //  }
+        if ( quarry_p > 0 || quarry_e > 0 )
+            pArcomageGame->PlaySound(30);
+        if ( quarry_p < 0 || quarry_e < 0 )
+            pArcomageGame->PlaySound(31);
+        if ( magic_p > 0 || magic_e > 0 )
+            pArcomageGame->PlaySound(33);
+        if ( magic_p < 0 || magic_e < 0 )
+            pArcomageGame->PlaySound(34);
+        if ( zoo_p > 0 || zoo_e > 0 )
+            pArcomageGame->PlaySound(36);
+        if ( zoo_p < 0 || zoo_e < 0 )
+            pArcomageGame->PlaySound(37);
+        if ( bricks_p > 0 || bricks_e > 0 )
+            pArcomageGame->PlaySound(39);
+        if ( bricks_p < 0 || bricks_e < 0 )
+            pArcomageGame->PlaySound(40);
+        if ( gems_p > 0 || gems_e > 0 )
+            pArcomageGame->PlaySound(42);
+        if ( gems_p < 0 || gems_e < 0 )
+            pArcomageGame->PlaySound(43);
+        if ( beasts_p > 0 || beasts_e > 0 )
+            pArcomageGame->PlaySound(45u);
+        if ( beasts_p < 0 || beasts_e < 0 )
+            pArcomageGame->PlaySound(46);
+        if ( buildings_p || buildings_e || dmg_p || dmg_e )
+            pArcomageGame->PlaySound(48);
+        if ( wall_p > 0 || wall_e > 0 )
+            pArcomageGame->PlaySound(49);
+        if ( wall_p < 0 || wall_e < 0 )
+            pArcomageGame->PlaySound(50);
+        if ( tower_p > 0 || tower_e > 0 )
+            pArcomageGame->PlaySound(52);
+        if ( tower_p < 0 || tower_e < 0 )
+            pArcomageGame->PlaySound(53);
+        if ( player_num )
+            {
+            if ( quarry_p )
+                {
+                v184.x = 573;
+                v184.y = 92;
+                am_40D2B4(&v184, quarry_p);
+                }
+            if ( quarry_e )
+                {
+                v184.x = 26;
+                v184.y = 92;
+                am_40D2B4(&v184, quarry_e);
+                }
+            if ( magic_p )
+                {
+                v184.x = 573;
+                v184.y = 164;
+                am_40D2B4(&v184, magic_p);
+                }
+            if ( magic_e )
+                {
+                v184.x = 26;
+                v184.y = 164;
+                am_40D2B4(&v184, magic_e);
+                }
+            if ( zoo_p )
+                {
+                v184.x = 573;
+                v184.y = 236;
+                am_40D2B4(&v184, zoo_p);
+                }
+            if ( zoo_e )
+                {
+                v184.x = 26;
+                v184.y = 236;
+                am_40D2B4(&v184, zoo_e);
+                }
+            if ( bricks_p )
+                {
+                v184.x = 563;
+                v184.y = 114;
+                am_40D2B4(&v184, bricks_p);
+                }
+            if ( bricks_e )
+                {
+                v184.x = 16;
+                v184.y = 114;
+                am_40D2B4(&v184, bricks_e);
+                }
+            if ( gems_p )
+                {
+                v184.x = 563;
+                v184.y = 186;
+                am_40D2B4(&v184, gems_p);
+                }
+            if ( gems_e )
+                {
+                v184.x = 16;
+                v184.y = 186;
+                am_40D2B4(&v184, gems_e);
+                }
+            if ( beasts_p )
+                {
+                v184.x = 563;
+                v184.y = 258;
+                am_40D2B4(&v184, beasts_p);
+                }
+            if ( beasts_e )
+                {
+                v184.x = 16;
+                v184.y = 258;
+                am_40D2B4(&v184, beasts_e);
+                }
+            if ( wall_p )
+                {
+                v184.x = 442;
+                v184.y = 296;
+                am_40D2B4(&v184, wall_p);
+                }
+            if ( wall_e )
+                {
+                v184.x = 180;
+                v184.y = 296;
+                am_40D2B4(&v184, wall_e);
+                }
+            if ( tower_p )
+                {
+                v184.x = 514;
+                v184.y = 296;
+                am_40D2B4(&v184, tower_p);
+                }
+            if ( tower_e )
+                {
+                v184.x = 122;
+                v184.y = 296;
+                am_40D2B4(&v184, tower_e);
+                }
+            if ( dmg_p )
+                {
+                v184.x = 442;
+                v184.y = 296;
+                am_40D2B4(&v184, dmg_p);
+                }
+            if ( buildings_p )
+                {
+                v184.x = 514;
+                v184.y = 296;
+                am_40D2B4(&v184, buildings_p);
+                }
+            if ( dmg_e )
+                {
+                v184.x = 180;
+                v184.y = 296;
+                am_40D2B4(&v184, dmg_e);
+                }
+            if ( buildings_e )
+                {
+                v184.x = 122;
+                v184.y = 296;
+                am_40D2B4(&v184, buildings_e);
+                }
+            }
+        else
+            {
+            if ( quarry_p )
+                {
+                v184.x = 26;
+                v184.y = 92;
+                am_40D2B4(&v184, quarry_p);
+                }
+            if ( quarry_e )
+                {
+                v184.x = 573;
+                v184.y = 92;
+                am_40D2B4(&v184, quarry_e);
+                }
+            if ( magic_p )
+                {
+                v184.x = 26;
+                v184.y = 164;
+                am_40D2B4(&v184, magic_p);
+                }
+            if ( magic_e )
+                {
+                v184.x = 573;
+                v184.y = 164;
+                am_40D2B4(&v184, magic_e);
+                }
+            if ( zoo_p )
+                {
+                v184.x = 26;
+                v184.y = 236;
+                am_40D2B4(&v184, zoo_p);
+                }
+            if ( zoo_e )
+                {
+                v184.x = 573;
+                v184.y = 236;
+                am_40D2B4(&v184, zoo_e);
+                }
+            if ( bricks_p )
+                {
+                v184.x = 16;
+                v184.y = 114;
+                am_40D2B4(&v184, bricks_p);
+                }
+            if ( bricks_e )
+                {
+                v184.x = 563;
+                v184.y = 114;
+                am_40D2B4(&v184, bricks_e);
+                }
+            if ( gems_p )
+                {
+                v184.x = 16;
+                v184.y = 186;
+                am_40D2B4(&v184, gems_p);
+                }
+            if ( gems_e )
+                {
+                v184.x = 563;
+                v184.y = 186;
+                am_40D2B4(&v184, gems_e);
+                }
+            if ( beasts_p )
+                {
+                v184.x = 16;
+                v184.y = 258;
+                am_40D2B4(&v184, beasts_p);
+                }
+            if ( beasts_e )
+                {
+                v184.x = 563;
+                v184.y = 258;
+                am_40D2B4(&v184, beasts_e);
+                }
+            if ( wall_p )
+                {
+                v184.x = 180;
+                v184.y = 296;
+                am_40D2B4(&v184, wall_p);
+                }
+            if ( wall_e )
+                {
+                v184.x = 442;
+                v184.y = 296;
+                am_40D2B4(&v184, wall_e);
+                }
+            if ( tower_p )
+                {
+                v184.x = 122;
+                v184.y = 296;
+                am_40D2B4(&v184, tower_p);
+                }
+            if ( tower_e )
+                {
+                v184.x = 514;
+                v184.y = 296;
+                am_40D2B4(&v184, tower_e);
+                }
+            if ( dmg_p )
+                {
+                v184.x = 180;
+                v184.y = 296;
+                am_40D2B4(&v184, dmg_p);
+                }
+            if ( buildings_p )
+                {
+                v184.x = 122;
+                v184.y = 296;
+                am_40D2B4(&v184, buildings_p);
+                }
+            if ( dmg_e )
+                {
+                v184.x = 442;
+                v184.y = 296;
+                am_40D2B4(&v184, dmg_e);
+                }
+            if ( buildings_e )
+                {
+                v184.x = 514;
+                v184.y = 296;
+                am_40D2B4(&v184, buildings_e);
+                }
+            }
+#undef APPLY_TO_BOTH
+#undef APPLY_TO_ENEMY        
+#undef APPLY_TO_PLAYER
+
 }
 
 
@@ -5382,7 +4057,7 @@
 
 
 //----- (0040D402) --------------------------------------------------------
-int am_40D402( int player_num, int damage )
+int ApplyDamadeToBuildings( int player_num, int damage )
     {
   ArcomagePlayer *v2; // ecx@1
   int v3; // esi@1
@@ -5689,7 +4364,7 @@
 
 
   for (int i=0; i<10; ++i)
-     array_4FABD0[i].field_40->Ctor(array_4FABD0[i].field_40);
+     array_4FABD0[i].field_40->Ctor(&array_4FABD0[i].field_40);
   
   current_card_slot_index = -1;
   amuint_4FAA4C = -1;
@@ -5698,7 +4373,7 @@
   byte_4FAA2C = 0;
   byte_505880 = 0;
   dword_4FAA70 = 0;
-  am_byte_4FAA77 = 0;
+  hand_full = 0;
   SetStartGameData();
   InitalHandsFill();
   //nullsub_1();
--- a/Arcomage.h	Sun Jun 09 23:53:01 2013 +0200
+++ b/Arcomage.h	Tue Jun 11 08:49:04 2013 +0400
@@ -38,66 +38,66 @@
   char needed_bricks;
   char needed_gems;
   char needed_beasts;
-  char field_2B;
-  int  field_2C;
+  char attack_or_defence;
+  int  compare_param;
   char field_30;
-  char field_31;
-  char field_32;
-  char field_33;
-  char field_34;
-  char field_35;
-  char field_36;
-  char field_37;
-  char field_38;
-  char field_39;
-  char field_3A;
-  char field_3B;
-  char field_3C;
-  char field_3D;
-  char field_3E;
-  char field_3F;
-  char field_40;
-  char field_41;
-  char field_42;
-  char field_43;
-  char field_44;
-  char field_45;
-  char field_46;
-  char field_47;
-  char field_48;
-  char field_49;
-  char field_4A;
-  char field_4B;
-  char field_4C;
+  char can_draw_extra_card;
+  char to_player_quarry_lvl;
+  char to_player_magic_lvl;
+  char to_player_zoo_lvl;
+  char to_player_bricks;
+  char to_player_gems;
+  char to_player_beasts;
+  char to_player_buildings;
+  char to_player_wall;
+  char to_player_tower;
+  char to_enemy_quarry_lvl;
+  char to_enemy_magic_lvl;
+  char to_enemy_zoo_lvl;
+  char to_enemy_bricks;
+  char to_enemy_gems;
+  char to_enemy_beasts;
+  char to_enemy_buildings;
+  char to_enemy_wall;
+  char to_enemy_tower;
+  char to_pl_enm_quarry_lvl;
+  char to_pl_enm_magic_lvl;
+  char to_pl_enm_zoo_lvl;
+  char to_pl_enm_bricks;
+  char to_pl_enm_gems;
+  char to_pl_enm_beasts;
+  char to_pl_enm_buildings;
+  char to_pl_enm_wall;
+  char to_pl_enm_tower;
   char field_4D;
-  char field_4E;
-  char field_4F;
-  char field_50;
-  char field_51;
-  char field_52;
-  char field_53;
-  char field_54;
-  char field_55;
-  char field_56;
-  char field_57;
-  char field_58;
-  char field_59;
-  char field_5A;
-  char field_5B;
-  char field_5C;
-  char field_5D;
-  char field_5E;
-  char field_5F;
-  char field_60;
-  char field_61;
-  char field_62;
-  char field_63;
-  char field_64;
-  char field_65;
-  char field_66;
-  char field_67;
-  char field_68;
-  char field_69;
+  char can_draw_extra_card2;
+  char to_player_quarry_lvl2;
+  char to_player_magic_lvl2;
+  char to_player_zoo_lvl2;
+  char to_player_bricks2;
+  char to_player_gems2;
+  char to_player_beasts2;
+  char to_player_buildings2;
+  char to_player_wall2;
+  char to_player_tower2;
+  char to_enemy_quarry_lvl2;
+  char to_enemy_magic_lvl2;
+  char to_enemy_zoo_lvl2;
+  char to_enemy_bricks2;
+  char to_enemy_gems2;
+  char to_enemy_beasts2;
+  char to_enemy_buildings2;
+  char to_enemy_wall2;
+  char to_enemy_tower2;
+  char to_pl_enm_quarry_lvl2;
+  char to_pl_enm_magic_lvl2;
+  char to_pl_enm_zoo_lvl2;
+  char to_pl_enm_bricks2;
+  char to_pl_enm_gems2;
+  char to_pl_enm_beasts2;
+  char to_pl_enm_buildings2;
+  char to_pl_enm_wall2;
+  char to_pl_enm_tower2;         
   char field_6A;
   char field_6B;
 };
@@ -238,7 +238,7 @@
 #pragma pack(push, 1)
 struct stru272_stru0         // ARCOMAGE stuff
 {
-  static void Ctor(stru272_stru0 *a1);
+  static void Ctor(stru272_stru0 **a1);
   int Dtor();
   int _40E01A(stru272_stru2* a2);
   int Empty(char a2, char a3);
--- a/mm7_data.cpp	Sun Jun 09 23:53:01 2013 +0200
+++ b/mm7_data.cpp	Tue Jun 11 08:49:04 2013 +0400
@@ -908,8 +908,7 @@
 int amuint_4FAA4C; // weak
 
 
-int dword_4FAA64; // weak
-int dword_4FAA68; // weak
+
 
 int dword_4FAA70; // weak
 char byte_4FAA74; // weak
--- a/mm7_data.h	Sun Jun 09 23:53:01 2013 +0200
+++ b/mm7_data.h	Tue Jun 11 08:49:04 2013 +0400
@@ -543,9 +543,6 @@
 extern int amuint_4FAA4C; // weak
 
 
-extern int dword_4FAA64; // weak
-extern int dword_4FAA68; // weak
-
 extern int dword_4FAA70; // weak
 extern char byte_4FAA74; // weak
 extern char am_byte_4FAA75; // weak