changeset 1183:fa30ea497e94

arcomage refactoring started
author Gloval
date Thu, 06 Jun 2013 00:58:07 +0400
parents 64cda98b739c
children a90dc4aee8f4
files Arcomage.cpp Arcomage.h AudioPlayer.h GUIWindow.h Render.cpp mm7_5.cpp mm7_data.cpp mm7_data.h
diffstat 8 files changed, 4115 insertions(+), 4174 deletions(-) [+]
line wrap: on
line diff
--- a/Arcomage.cpp	Wed Jun 05 15:45:59 2013 +0200
+++ b/Arcomage.cpp	Thu Jun 06 00:58:07 2013 +0400
@@ -19,13 +19,54 @@
 #include "Events2D.h"
 #include "VectorTypes.h"
 #include "texts.h"
+#include <windef.h>
 
 
 
 void sub_409BE8();
 
 
-
+char __cdecl am_409FE9();
+char __cdecl am_40A198();
+void am_40A255();
+void  am_40A283(int a1);
+signed int __fastcall am_40A324(int a1);
+void am_40A346(int player_num);
+void __cdecl am_40A383();
+bool  am_40A514();
+char __thiscall am_40A560(unsigned int _this);
+void __thiscall am_blts(int a1); // idb
+void __cdecl am_40AA4E();
+void __cdecl am_chroma_blts();
+void __cdecl am_DrawUI();
+void __fastcall am_40B102(int a1, char *a2, POINT *pXY); // idb
+void  am_40B17E(int a1, char* a2, POINT *pXY); // idb
+void am_40B1F3(int a1, char* a2, POINT* a3);
+void  am_40B268(int a1, char *a2, POINT *pXY); // idb
+void __cdecl am_chroma_and_copy_blts();
+void __cdecl am_chroma_blt();
+void __cdecl am_40B4B9();
+void __fastcall am_40B76F(int a1);
+int __fastcall am_40BB49(int a1);
+signed int __fastcall am_40BB67(int a1);
+char __fastcall am_40BCFB(int a1, signed int a2);
+bool __fastcall am_40BE0E(int a1, signed int a2);
+bool __fastcall am_40BF15(int a1, int a2);
+void __fastcall am_40BF77(int a1, unsigned int uCardID); // idb
+int __fastcall am_40D2B4(POINT*, int); // weak
+int __fastcall am_40D402(int, int); // weak
+int __cdecl am_40D444();
+
+void pPrimaryWindow_draws_text(int a1, const char *pText, POINT *pXY);
+void __thiscall am_BeginScene(unsigned __int16 *pPcxPixels, int a2, int a3); // idb
+void __fastcall Blt_Chroma(RECT  *pSrcXYZW, POINT *pTargetXY, int a3, int a4);
+void  Blt_Copy(RECT *pSrcRect, POINT *pTargetXY, int a3);
+void __cdecl am_EndScene();
+void __fastcall DrawRect(RECT *pXYZW, unsigned __int16 uColor, char bSolidFill); // idb
+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 */
 #pragma pack(push, 1)
@@ -66,9 +107,9 @@
 
 ArcomageGame *pArcomageGame = new ArcomageGame;
 ArcomageCard pCards[87];
-ArcomageGame_stru0 stru_505708[2];
-
-
+ArcomagePlayer am_Players[2];
+
+Acromage_st1 struct_st1[10];
 
 stru272 array_4FAC10[10];
 
@@ -92,18 +133,22 @@
 
 
 
-
-
+int dword_4E1884 = 50; // weak
+int dword_4E1888 = 100 ; // weak
+
+int dword_4E1874  = 5; // weak
+
+int dword_4E1878  = 1; // weak
+int dword_4E187C  = 1; // weak
+int dword_4E1880  = 1; // weak
 
 
 
 //----- (0040DD2F) --------------------------------------------------------
 bool stru273::_40DD2F()
 {
-  bool result; // eax@1
 
   this->x = pArcomageGame->mouse_x;
-  result = pArcomageGame->mouse_y;
   this->y = pArcomageGame->mouse_y;
   this->field_8 = pArcomageGame->mouse_left;
   this->field_9 = pArcomageGame->mouse_left == pArcomageGame->field_F7;
@@ -111,8 +156,7 @@
   this->field_B = pArcomageGame->mouse_right == pArcomageGame->field_F8;
   pArcomageGame->field_F7 = pArcomageGame->mouse_left;
   pArcomageGame->field_F8 = pArcomageGame->mouse_right;
-  LOBYTE(result) = 1;
-  return result;
+  return true;
 }
 
 //----- (0040DD93) --------------------------------------------------------
@@ -147,107 +191,104 @@
 //----- (0040DF47) --------------------------------------------------------
 void DoBlt_Copy(unsigned __int16 *pPixels)
 {
-  unsigned __int16 *v1; // ebx@1
-  ArcomageRect rect; // [sp+Ch] [bp-18h]@1
-  int pTargetXY[2]; // [sp+1Ch] [bp-8h]@1
-
-  v1 = pPixels;
+  RECT pSrcRect;
+  POINT pTargetPoint; // [sp+1Ch] [bp-8h]@1
+
   pRenderer->Present();
-  pTargetXY[0] = 0;
-  pTargetXY[1] = 0;
-  rect.x = 0;
-  rect.z = 640;
-  rect.y = 0;
-  rect.w = 480;
+
+  pTargetPoint.x = 0;
+  pTargetPoint.y = 0;
+
+  pSrcRect.left = 0;
+  pSrcRect.right = 640;
+  pSrcRect.top = 0;
+  pSrcRect.bottom = 480;
+
   pRenderer->BeginScene();
-  pArcomageGame->pBlit_Copy_pixels = v1;
-  Blt_Copy(&rect, pTargetXY, 2);
+  pArcomageGame->pBlit_Copy_pixels = pPixels;
+  Blt_Copy(&pSrcRect, &pTargetPoint, 2);
   pRenderer->EndScene();
   pArcomageGame->pBlit_Copy_pixels = 0;
 }
 
 //----- (0040DDC9) --------------------------------------------------------
-void __thiscall ArcomageGame::PlaySound(unsigned int a1)
-{
-  SoundID v1; // eax@10
-  signed int v2; // [sp-4h] [bp-4h]@2
-
-  switch ( a1 )
-  {
-    case 0x28u:
-    case 0x2Bu:
-    case 0x2Eu:
-      v2 = SOUND_Arcomage_LoseResources;
-      goto LABEL_10;
-    case 0x27u:
-    case 0x29u:
-    case 0x2Au:
-    case 0x2Cu:
-    case 0x2Du:
-    case 0x2Fu:
-      v2 = SOUND_Arcomage_AddResources;
-      goto LABEL_10;
-    case 0u:
-    case 0xCu:
-    case 0xEu:
-    case 0xFu:
-    case 0x10u:
-    case 0x30u:
-    case 0x32u:
-    case 0x35u:
-      v2 = SOUND_Arcomage_TowerWallDamage;
-      goto LABEL_10;
-    case 0x15u:
-    case 0x16u:
-    case 0x17u:
-      v2 = SOUND_Arcomage_DrawCard;
-      goto LABEL_10;
-    case 0x38u:
-      v2 = 124;
-      goto LABEL_10;
-    case 0x1Fu:
-    case 0x22u:
-    case 0x25u:
-      v2 = SOUND_Arcomage_ProductionDamage;
-      goto LABEL_10;
-    case 1u:
-    case 0x1Eu:
-    case 0x20u:
-    case 0x21u:
-    case 0x23u:
-    case 0x24u:
-    case 0x26u:
-      v2 = SOUND_Arcomage_ProductionUpgrade;
-      goto LABEL_10;
-    case 0x14u:
-      v2 = SOUND_Arcomage_127;
-LABEL_10:
-      v1 = (SoundID)v2;
-      goto LABEL_16;
-    case 3u:
-      v1 = SOUND_Arcomage_128;
-      goto LABEL_16;
-    case 0x34u:
-    case 0x36u:
-      v1 = SOUND_Arcomage_TowerUpgrade;
-      goto LABEL_16;
-    case 0xAu:
-    case 0xBu:
-    case 0xDu:
-      v1 = (SoundID)130;
-      goto LABEL_16;
-    case 0x37u:
-      v1 = (SoundID)131;
-      goto LABEL_16;
-    case 0x31u:
-    case 0x33u:
-      v1 = SOUND_Arcomage_WallUpgrade;
-LABEL_16:
-      pAudioPlayer->PlaySound(v1, 0, 0, -1, 0, 0, 0, 0);
+void ArcomageGame::PlaySound( unsigned int event_id )
+    {
+  SoundID play_sound_id; // eax@10
+
+  switch ( event_id )
+      {
+  case 40:
+  case 43:
+  case 46:
+      play_sound_id = SOUND_Arcomage_LoseResources;
+      break;
+  case 39:
+  case 41:
+  case 42:
+  case 44:
+  case 45:
+  case 47:
+      play_sound_id = SOUND_Arcomage_AddResources;
+      break;
+  case 0:
+  case 12:
+  case 14:
+  case 15:
+  case 16:
+  case 48:
+  case 50:
+  case 53:
+      play_sound_id = SOUND_Arcomage_TowerWallDamage;
+      break;
+  case 21:
+  case 22:
+  case 23:
+      play_sound_id = SOUND_Arcomage_DrawCard;
+      break;
+  case 56:
+      play_sound_id = SOUND_Arcomage_124;
       break;
-    default:
+  case 31:
+  case 34:
+  case 37:
+      play_sound_id = SOUND_Arcomage_ProductionDamage;
+      break;
+  case 1:
+  case 30:
+  case 32:
+  case 33:
+  case 35:
+  case 36:
+  case 38:
+      play_sound_id = SOUND_Arcomage_ProductionUpgrade;
+     break;
+  case 20:
+      play_sound_id = SOUND_Arcomage_127;
+      break;
+  case 3:
+      play_sound_id = SOUND_Arcomage_128;
+      break;
+  case 52:
+  case 54:
+      play_sound_id = SOUND_Arcomage_TowerUpgrade;
+      break;
+  case 10:
+  case 11:
+  case 13:
+      play_sound_id = SOUND_Arcomage_130;
+      break;
+  case 55u:
+      play_sound_id = SOUND_Arcomage_131;
+      break;
+  case 49:
+  case 51:
+      play_sound_id = SOUND_Arcomage_WallUpgrade;
+      break;
+  default:
       return;
-  }
+      }
+  pAudioPlayer->PlaySound(play_sound_id, 0, 0, -1, 0, 0, 0, 0);
 }
 
 //----- (0040DC2D) --------------------------------------------------------
@@ -255,10 +296,10 @@
 {
   void *v2; // ebp@1
   BOOL v3; // eax@1
-  int v4; // edx@6
-  int v5; // edx@6
-  int v6; // eax@6
-  int v7; // edx@7
+  //int v4; // edx@6
+  //int v5; // edx@6
+  //int v6; // eax@6
+  //int v7; // edx@7
 
   v2 = a2;
   pArcomageGame->field_0 = 0;
@@ -310,1056 +351,963 @@
 //----- (0040D7D5) --------------------------------------------------------
 void am_BeginScene(unsigned __int16 *pPcxPixels, int a2, int a3)
 {
-  unsigned __int16 *v3; // esi@1
-
-  v3 = pPcxPixels;
   pRenderer->BeginScene();
-  pArcomageGame->pBlit_Copy_pixels = v3;
+  pArcomageGame->pBlit_Copy_pixels = pPcxPixels;
 }
 
 //----- (0040D7EC) --------------------------------------------------------
-void __fastcall Blt_Chroma(ArcomageRect *pSrcXYZW, int *pTargetXY, int a3, int a4)
+void __fastcall Blt_Chroma(RECT *pSrcRect, POINT *pTargetPoint, int a3, int blend_mode)
 {
-  ArcomageRect *pSrcXYZW_; // esi@1
-  int x; // ecx@1
-  int y; // edx@1
-  unsigned __int16 *pSrc; // eax@2
-  unsigned __int16 *v8; // edi@3
-  int uSrcTotalWidth; // ecx@4
-  unsigned int v10; // esi@9
-  int v11; // ebx@11
-  unsigned __int16 *v12; // edx@11
-  char v13; // zf@17
-  unsigned __int16 *v14; // ebx@20
-  int v15; // eax@20
-  unsigned __int16 *v16; // ecx@20
-  unsigned int v17; // eax@23
-  std::string v18; // [sp-18h] [bp-3Ch]@8
-  const char *v19; // [sp-8h] [bp-2Ch]@8
-  int v20; // [sp-4h] [bp-28h]@8
-  std::string *v21; // [sp+Ch] [bp-18h]@8
-  unsigned __int16 *v22; // [sp+10h] [bp-14h]@9
-  int v23; // [sp+14h] [bp-10h]@3
-  int v24; // [sp+18h] [bp-Ch]@3
-  int uSrcPitch; // [sp+1Ch] [bp-8h]@5
-  int a3a; // [sp+23h] [bp-1h]@8
-  int v27; // [sp+30h] [bp+Ch]@13
-
-  pSrcXYZW_ = pSrcXYZW;
-  x = *pTargetXY;
-  y = pTargetXY[1];
-  if ( !pRenderer->uNumSceneBegins || (pSrc = pArcomageGame->pBlit_Copy_pixels) == 0 )
+
+unsigned __int16 *pSrc; // eax@2
+unsigned __int16 *dest_surf_pos; // edi@3
+int uSrcTotalWidth; // ecx@4
+unsigned int v10; // esi@9
+int v21; // [sp+Ch] [bp-18h]@8
+unsigned __int16 *src_surf_pos; // [sp+10h] [bp-14h]@9
+__int32 src_width; // [sp+14h] [bp-10h]@3
+__int32 src_height; // [sp+18h] [bp-Ch]@3
+int uSrcPitch; // [sp+1Ch] [bp-8h]@5
+
+
+if ( !pRenderer->uNumSceneBegins )
+    return;
+if ( !pArcomageGame->pBlit_Copy_pixels )
     return;
-  v8 = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch];
-  v23 = pSrcXYZW_->z - pSrcXYZW_->x;
-  v24 = pSrcXYZW_->w - pSrcXYZW_->y;
-  if ( pArcomageGame->pBlit_Copy_pixels == pArcomageGame->pBackgroundPixels )
-  {
-    uSrcTotalWidth = (signed __int16)pArcomageGame->pGameBackground.uWidth;
-LABEL_5:
-    uSrcPitch = uSrcTotalWidth;
-    goto LABEL_9;
-  }
-  if ( pArcomageGame->pBlit_Copy_pixels == pArcomageGame->pSpritesPixels )
-  {
-    uSrcTotalWidth = (signed __int16)pArcomageGame->pSprites.uWidth;
-    goto LABEL_5;
-  }
-      MessageBoxW(nullptr, L"Problem in Blit_Chroma", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\am_nw.cpp:157", 0);
-  pSrc = pArcomageGame->pBlit_Copy_pixels;
-LABEL_9:
-  v22 = &pSrc[pSrcXYZW_->x + uSrcPitch * pSrcXYZW_->y];
-  v10 = 0xFFu >> (8 - LOBYTE(pRenderer->uTargetBBits));
-  v21 = (std::string *)((((pRenderer->uTargetGBits != 6) - 1) & 0x4A00) + 12783);
-  if ( a4 == 2 )
-  {
-    if ( v24 > 0 )
+
+dest_surf_pos = &pRenderer->pTargetSurface[pTargetPoint->x + pTargetPoint->y * pRenderer->uTargetSurfacePitch];
+src_width = pSrcRect->right - pSrcRect->left;
+src_height = pSrcRect->bottom - pSrcRect->top;
+
+if ( pArcomageGame->pBlit_Copy_pixels == pArcomageGame->pBackgroundPixels )
+    uSrcTotalWidth = pArcomageGame->pGameBackground.uWidth;
+else if ( pArcomageGame->pBlit_Copy_pixels == pArcomageGame->pSpritesPixels )
+    uSrcTotalWidth = pArcomageGame->pSprites.uWidth;
+
+//v20 = 157;
+//v19 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\am_nw.cpp";
+//v21 = &v18;
+//std__string_char_40E2C8(&v18, "Problem in Blit_Chroma", &a3a);
+//466D09_xcpt_string(&v21, v18, v19, v20);
+//pSrc = pArcomageGame.pBlit_Copy_pixels;
+//LABEL_9:
+pSrc = pArcomageGame->pBlit_Copy_pixels;
+uSrcPitch = uSrcTotalWidth;
+
+src_surf_pos = &pSrc[pSrcRect->left + uSrcPitch * pSrcRect->top];
+v10 = 0xFFu >> (8 - (unsigned __int8)pRenderer->uTargetBBits);
+v21 = (pRenderer->uTargetGBits != 6 ? 0x31EF : 0x7BEF);
+
+
+if ( blend_mode == 2 )
     {
-      v11 = v23;
-      v12 = v22;
-      uSrcPitch = 2 * (uSrcPitch - v23);
-      do
-      {
-        if ( v11 > 0 )
-        {
-          v27 = v11;
-          do
-          {
-            if ( *v12 != v10 )
-              *v8 = *v12;
-            ++v8;
-            ++v12;
-            --v27;
-          }
-          while ( v27 );
-        }
-        v12 = (unsigned __int16 *)((char *)v12 + uSrcPitch);
-        v13 = v24-- == 1;
-        v8 += pRenderer->uTargetSurfacePitch - v11;
-      }
-      while ( !v13 );
+        uSrcPitch = 2 * (uSrcPitch - src_width);
+        for (int i=0; i< src_height; ++i)
+            {
+            for (int j=0; j< src_width; ++j)
+                {
+                if ( *src_surf_pos != v10 )
+                    *dest_surf_pos = *src_surf_pos;
+                ++dest_surf_pos;
+                ++src_surf_pos;
+                }
+            src_surf_pos+=uSrcPitch;
+            dest_surf_pos += pRenderer->uTargetSurfacePitch - src_width;
+            }
     }
-  }
-  else
-  {
-    if ( v24 > 0 )
+else 
     {
-      v14 = (unsigned __int16 *)v23;
-      v15 = uSrcPitch - v23;
-      v23 = v24;
-      v16 = v22;
-      uSrcPitch = 2 * v15;
-      do
-      {
-        if ( (signed int)v14 > 0 )
+    uSrcPitch = 2 * (uSrcPitch - src_width);
+    for (int i=0; i< src_height; ++i)
         {
-          v22 = v14;
-          do
-          {
-            v17 = *v16;
-            if ( v17 != v10 )
+        for (int j=0; j< src_width; ++j)
             {
-              v24 = *v8;
-              *v8 = ((unsigned __int16)v21 & ((unsigned int)v24 >> 1)) + ((unsigned __int16)v21 & (v17 >> 1));
+            if ( *src_surf_pos != v10 )
+                *dest_surf_pos = (v21 & (*dest_surf_pos >> 1)) + (v21 & (*src_surf_pos >> 1));
+            ++dest_surf_pos;
+            ++src_surf_pos;
             }
-            ++v8;
-            ++v16;
-            v22 = (unsigned __int16 *)((char *)v22 - 1);
-          }
-          while ( v22 );
+        src_surf_pos+=uSrcPitch;
+        dest_surf_pos += pRenderer->uTargetSurfacePitch - src_width;
         }
-        v16 = (unsigned __int16 *)((char *)v16 + uSrcPitch);
-        v13 = v23-- == 1;
-        v8 += pRenderer->uTargetSurfacePitch - (uint)v14;
-      }
-      while ( !v13 );
     }
-  }
+
 }
 
 //----- (0040D9B1) --------------------------------------------------------
-void __fastcall Blt_Copy(ArcomageRect *pSrcXYZW, int *pTargetXY, int a3)
-{
-  ArcomageRect *pSrcXYZW_; // esi@1
-  int x; // ecx@1
-  int y; // edx@1
-  unsigned __int16 *v6; // eax@2
-  unsigned __int16 *v7; // edi@3
-  int uSrcRegionWidth; // ebx@3
-  int uSrcTotalWidth; // ecx@4
-  unsigned __int16 *pSrc; // esi@8
-  int v11; // edx@9
-  int v12; // eax@12
-  int v13; // ecx@19
-  char v14; // zf@21
-  std::string v15; // [sp-18h] [bp-38h]@7
-  const char *v16; // [sp-8h] [bp-28h]@7
-  int v17; // [sp-4h] [bp-24h]@7
-  unsigned int v18; // [sp+Ch] [bp-14h]@7
-  int v19; // [sp+10h] [bp-10h]@8
-  int v20; // [sp+14h] [bp-Ch]@17
-  int uSrcRegionHeight; // [sp+18h] [bp-8h]@3
-  int a3a; // [sp+1Fh] [bp-1h]@7
-
-  pSrcXYZW_ = pSrcXYZW;
-  x = *pTargetXY;
-  y = pTargetXY[1];
-  if ( pRenderer->uNumSceneBegins )
-  {
-    v6 = pArcomageGame->pBlit_Copy_pixels;
-    if ( pArcomageGame->pBlit_Copy_pixels )
+void Blt_Copy( RECT *pSrcRect, POINT *pTargetPoint, int blend_mode )
     {
-      v7 = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch];
-      uSrcRegionWidth = pSrcXYZW_->z - pSrcXYZW_->x;
-      uSrcRegionHeight = pSrcXYZW_->w - pSrcXYZW_->y;
-      if ( pArcomageGame->pBlit_Copy_pixels == pArcomageGame->pBackgroundPixels )
-      {
-        uSrcTotalWidth = (signed __int16)pArcomageGame->pGameBackground.uWidth;
-      }
-      else
-      {
-        if ( pArcomageGame->pBlit_Copy_pixels == pArcomageGame->pSpritesPixels )
+
+    unsigned __int16 *pSrc; // eax@2
+    unsigned __int16 *dest_surf_pos; // edi@3
+    int uSrcTotalWidth; // ecx@4
+    int v21; // [sp+Ch] [bp-18h]@8
+    unsigned __int16 *src_surf_pos; // [sp+10h] [bp-14h]@9
+    __int32 src_width; // [sp+14h] [bp-10h]@3
+    __int32 src_height; // [sp+18h] [bp-Ch]@3
+    int uSrcPitch; // [sp+1Ch] [bp-8h]@5
+
+    if ( !pRenderer->uNumSceneBegins )
+        return;
+    if ( !pArcomageGame->pBlit_Copy_pixels )
+        return;
+
+    dest_surf_pos = &pRenderer->pTargetSurface[pTargetPoint->x + pTargetPoint->y * pRenderer->uTargetSurfacePitch];
+    src_width = pSrcRect->right - pSrcRect->left;
+    src_height = pSrcRect->bottom - pSrcRect->top;
+
+    if ( pArcomageGame->pBlit_Copy_pixels == pArcomageGame->pBackgroundPixels )
+        uSrcTotalWidth = pArcomageGame->pGameBackground.uWidth;
+    else if ( pArcomageGame->pBlit_Copy_pixels == pArcomageGame->pSpritesPixels )
+        uSrcTotalWidth = pArcomageGame->pSprites.uWidth;
+
+    //v20 = 157;
+    //v19 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\am_nw.cpp";
+    //v21 = &v18;
+    //std__string_char_40E2C8(&v18, "Problem in Blit_Chroma", &a3a);
+    //466D09_xcpt_string(&v21, v18, v19, v20);
+    //pSrc = pArcomageGame.pBlit_Copy_pixels;
+    //LABEL_9:
+    pSrc = pArcomageGame->pBlit_Copy_pixels;
+    uSrcPitch = uSrcTotalWidth;
+
+    src_surf_pos = &pSrc[pSrcRect->left + uSrcPitch * pSrcRect->top];
+    v21 = (pRenderer->uTargetGBits != 6 ? 0x31EF : 0x7BEF);
+
+    if ( blend_mode == 2 )
         {
-          uSrcTotalWidth = (signed __int16)pArcomageGame->pSprites.uWidth;
-        }
-        else
-        {
-      MessageBoxW(nullptr, L"Problem in Blit_Copy", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\am_nw.cpp:246", 0);
-          uSrcTotalWidth = a3;
-          v6 = pArcomageGame->pBlit_Copy_pixels;
+        uSrcPitch = 2 * (uSrcPitch - src_width);
+        for (int i=0; i< src_height; ++i)
+            {
+            for (int j=0; j< src_width; ++j)
+                {    
+                *dest_surf_pos = *src_surf_pos;
+                ++dest_surf_pos;
+                ++src_surf_pos;
+                }
+            src_surf_pos+=uSrcPitch;
+            dest_surf_pos += pRenderer->uTargetSurfacePitch - src_width;
+            }
         }
-      }
-      pSrc = &v6[pSrcXYZW_->x + uSrcTotalWidth * pSrcXYZW_->y];
-      v19 = (((pRenderer->uTargetGBits != 6) - 1) & 0x4A00) + 0x31EF;
-      if ( a3 == 2 )
-      {
-        v11 = uSrcRegionHeight;
-        if ( uSrcRegionHeight > 0 )
+    else 
         {
-          uSrcRegionHeight = 2 * (uSrcTotalWidth - uSrcRegionWidth);
-          do
-          {
-            if ( uSrcRegionWidth > 0 )
+        uSrcPitch = 2 * (uSrcPitch - src_width);
+        for (int i=0; i< src_height; ++i)
             {
-              v12 = uSrcRegionWidth;
-              do
-              {
-                *v7 = *pSrc;
-                ++v7;
-                ++pSrc;
-                --v12;
-              }
-              while ( v12 );
+            for (int j=0; j< src_width; ++j)
+                {
+                 *dest_surf_pos = (v21 & (*dest_surf_pos >> 1)) + (v21 & (*src_surf_pos >> 1));
+                ++dest_surf_pos;
+                ++src_surf_pos;
+                }
+            src_surf_pos+=uSrcPitch;
+            dest_surf_pos += pRenderer->uTargetSurfacePitch - src_width;
             }
-            pSrc = (unsigned __int16 *)((char *)pSrc + uSrcRegionHeight);
-            --v11;
-            v7 += pRenderer->uTargetSurfacePitch - uSrcRegionWidth;
-          }
-          while ( v11 );
         }
-      }
-      else
-      {
-        if ( uSrcRegionHeight > 0 )
-        {
-          v20 = uSrcRegionHeight;
-          uSrcRegionHeight = 2 * (uSrcTotalWidth - uSrcRegionWidth);
-          do
-          {
-            if ( uSrcRegionWidth > 0 )
-            {
-              v13 = uSrcRegionWidth;
-              do
-              {
-                v18 = *v7;
-                *v7 = (v19 & (v18 >> 1)) + (v19 & ((unsigned int)*pSrc >> 1));
-                ++v7;
-                ++pSrc;
-                --v13;
-              }
-              while ( v13 );
-            }
-            pSrc = (unsigned __int16 *)((char *)pSrc + uSrcRegionHeight);
-            v14 = v20-- == 1;
-            v7 += pRenderer->uTargetSurfacePitch - uSrcRegionWidth;
-          }
-          while ( !v14 );
-        }
-      }
-    }
-  }
 }
 
 //----- (0040DB10) --------------------------------------------------------
-void __cdecl am_EndScene()
+void  am_EndScene()
 {
   pRenderer->EndScene();
-  pArcomageGame->pBlit_Copy_pixels = 0;
+  pArcomageGame->pBlit_Copy_pixels = NULL;
 }
 
 //----- (0040D7B7) --------------------------------------------------------
 bool ArcomageGame::LoadSprites()
 {
-  bool result; // eax@1
-
   pArcomageGame->pSprites.Load("sprites.pcx", 2);
-  result = (bool)pArcomageGame->pSprites.pPixels;
   pArcomageGame->pSpritesPixels = pArcomageGame->pSprites.pPixels;
-  LOBYTE(result) = 1;
-  return result;
+  return true;
 }
 
 //----- (0040D799) --------------------------------------------------------
 bool ArcomageGame::LoadBackground()
 {
-  bool result; // eax@1
-
   pArcomageGame->pGameBackground.Load("layout.pcx", 2);
-  result = (bool)pArcomageGame->pGameBackground.pPixels;
   pArcomageGame->pBackgroundPixels = pArcomageGame->pGameBackground.pPixels;
-  LOBYTE(result) = 1;
-  return result;
+  return true;
 }
 
 //----- (00408BB4) --------------------------------------------------------
 bool __fastcall am_408BB4(int a1)
 {
-  char result; // al@3
-  signed int v3; // ebx@8
-  int v4; // esi@8
-  int v5; // eax@9
-  int v6; // edi@9
-  int v7; // eax@11
-  signed int v8; // eax@11
-  int v9; // ebx@5
-  int v10; // eax@5
-  int v11; // ecx@18
-  char v12; // bl@20
-  int v13; // eax@20
-  ArcomageCard *v14; // ecx@20
-  char v15; // dl@20
-  char v16; // dl@24
-  int v17; // edx@25
-  int v18; // edx@27
-  char v19; // dl@31
-  int v20; // edx@32
-  char v21; // dl@35
-  char v22; // dl@39
-  int v23; // edx@40
-  char v24; // dl@45
-  int v25; // edx@46
-  char v26; // dl@52
-  int v27; // edx@53
-  char v28; // dl@58
-  int v29; // edx@59
-  char v30; // dl@64
-  int v31; // edx@65
-  char v32; // dl@70
-  int v33; // edx@71
-  char v34; // dl@76
-  int v35; // edx@77
-  char v36; // dl@82
-  int v37; // edx@83
-  char v38; // dl@86
-  char v39; // dl@90
-  int v40; // edi@93
-  char v41; // dl@93
-  int v42; // esi@93
-  char v43; // bl@94
-  int v44; // esi@95
-  char v45; // dl@99
-  char v46; // dl@103
-  char v47; // dl@107
-  char v48; // dl@111
-  char v49; // dl@115
-  ArcomageGame_stru0 *v50; // ebx@116
-  ArcomageGame_stru0 *v51; // edx@116
-  int v52; // esi@124
-  int v53; // edx@124
-  int v54; // edx@127
-  int v55; // esi@130
-  int v56; // edi@138
-  int l; // esi@138
-  int v58; // eax@140
-  int v59; // ecx@142
-  int v60; // edx@142
-  int v61; // ebx@142
-  int v62; // eax@145
-  int v63; // esi@146
-  int v64; // ebx@4
-  int v65; // eax@4
-  int v66; // ecx@168
-  char v67; // bl@170
-  int v68; // eax@170
-  ArcomageCard *v69; // ecx@170
-  char v70; // dl@170
-  char v71; // dl@174
-  int v72; // edx@175
-  int v73; // edx@177
-  char v74; // dl@181
-  char v75; // dl@184
-  char v76; // dl@188
-  int v77; // edx@189
-  char v78; // dl@194
-  char v79; // dl@200
-  int v80; // edx@201
-  char v81; // dl@206
-  int v82; // edx@207
-  char v83; // dl@212
-  int v84; // edx@213
-  char v85; // dl@218
-  int v86; // edx@219
-  char v87; // dl@224
-  int v88; // edx@225
-  char v89; // dl@230
-  int v90; // edx@231
-  char v91; // dl@234
-  int v92; // edx@235
-  char v93; // dl@238
-  int v94; // edx@239
-  int v95; // esi@241
-  char v96; // dl@241
-  int v97; // esi@241
-  char v98; // bl@242
-  int v99; // edi@243
-  int v100; // edx@245
-  int v101; // edi@246
-  char v102; // dl@247
-  int v103; // edx@248
-  char v104; // dl@251
-  int v105; // edx@252
-  char v106; // dl@255
-  int v107; // edx@256
-  char v108; // dl@259
-  int v109; // edx@260
-  char v110; // dl@263
-  ArcomageGame_stru0 *v111; // ebx@264
-  ArcomageGame_stru0 *v112; // edx@264
-  int v113; // esi@272
-  int v114; // edx@272
-  int v115; // edx@275
-  int v116; // esi@278
-  int v117; // edi@286
-  int j; // esi@286
-  int v119; // eax@288
-  int v120; // ecx@290
-  int v121; // edx@290
-  int v122; // ebx@290
-  int v123; // eax@293
-  int v124; // esi@294
-  int v125; // [sp-28h] [bp-28h]@130
-  int v126; // [sp-28h] [bp-28h]@278
-  int k; // [sp-24h] [bp-24h]@18
-  int i; // [sp-24h] [bp-24h]@168
-  int v129; // [sp-20h] [bp-20h]@5
-  int v130; // [sp-20h] [bp-20h]@4
-  int v131; // [sp-1Ch] [bp-1Ch]@17
-  int v132; // [sp-1Ch] [bp-1Ch]@140
-  int v133; // [sp-1Ch] [bp-1Ch]@167
-  int v134; // [sp-1Ch] [bp-1Ch]@288
-  int v135; // [sp-18h] [bp-18h]@5
-  int v136; // [sp-18h] [bp-18h]@4
-  signed int v137; // [sp-14h] [bp-14h]@0
-  int v138; // [sp-14h] [bp-14h]@93
-  int v139; // [sp-14h] [bp-14h]@130
-  int v140; // [sp-14h] [bp-14h]@241
-  int v141; // [sp-14h] [bp-14h]@278
-  ArcomageGame_stru0 *v142; // [sp-10h] [bp-10h]@5
-  ArcomageGame_stru0 *v143; // [sp-10h] [bp-10h]@4
-  ArcomageGame_stru0 *v144; // [sp-Ch] [bp-Ch]@5
-  ArcomageGame_stru0 *v145; // [sp-Ch] [bp-Ch]@4
-  char v146; // [sp-8h] [bp-8h]@35
-  char v147; // [sp-8h] [bp-8h]@184
-  char v148; // [sp-5h] [bp-5h]@20
-  char v149; // [sp-5h] [bp-5h]@170
-
-  byte_4FAA00 = 1;
-  if ( dword_4DF3A4 )
-  {
-    if ( dword_4DF3A4 != 1 )
-    {
-      result = dword_4DF3A4 - 2;
-      if ( dword_4DF3A4 != 2 )
-        return result != 0;
-      v64 = a1;
-      v145 = &stru_505708[a1];
-      v130 = a1;
-      v143 = &stru_505708[(a1 + 1) % 2];
-      v136 = am_40BB49(a1);
-      v65 = 0;
-      do
-      {
-        if ( v65 >= v136 )
-        {
-          dword_4FA9B0[2 * v65] = -1;
-          dword_4FA9B4[2 * v65] = -9999;
-        }
-        else
-        {
-          dword_4FA9B0[2 * v65] = v65;
-          dword_4FA9B4[2 * v65] = 0;
-        }
-        ++v65;
-      }
-      while ( v65 < 10 );
-      v133 = 0;
-      if ( v136 > 0 )
-      {
-        v66 = 47 * v64;
-        for ( i = 47 * v64; ; v66 = i )
-        {
-          v67 = 99;
-          v68 = 2 * v133;
-          v69 = &pCards[stru_505708[0].arr_44[v66 + dword_4FA9B0[2 * v133]]];
-          v70 = v69->field_38[2];
-          v149 = v69->field_38[2];
-          if ( v145->field_24 >= 10 )
-          {
-            if ( v70 == 99
-              || v69->field_48[4] == 99
-              || v69->field_48[15] == 99
-              || (v74 = BYTE1(v69->field_68), v74 == 99) )
-              v73 = 5 * (v143->field_24 - v145->field_24);
-            else
-              v73 = 5 * (v149 + v69->field_48[4] + v69->field_48[15] + v74);
-          }
-          else
-          {
-            if ( v70 == 99
-              || v69->field_48[4] == 99
-              || v69->field_48[15] == 99
-              || (v71 = BYTE1(v69->field_68), v71 == 99) )
-              v72 = 5 * (v143->field_24 - v145->field_24);
-            else
-              v72 = 5 * (v149 + v69->field_48[4] + v69->field_48[15] + v71);
-            v73 = 4 * v72;
-          }
-          dword_4FA9B4[v68] += v73;
-          v75 = v69->field_38[1];
-          v147 = v69->field_38[1];
-          if ( v145->field_28 >= 10 )
-          {
-            if ( v75 == 99
-              || v69->field_48[3] == 99
-              || v69->field_48[14] == 99
-              || (v78 = LOBYTE(v69->field_68), v78 == 99) )
-              v77 = v143->field_28 - v145->field_28;
-            else
-              v77 = v147 + v69->field_48[3] + v69->field_48[14] + v78;
-          }
-          else
-          {
-            if ( v75 == 99
-              || v69->field_48[3] == 99
-              || v69->field_48[14] == 99
-              || (v76 = LOBYTE(v69->field_68), v76 == 99) )
-              v77 = 5 * (v143->field_28 - v145->field_28);
-            else
-              v77 = 5 * (v147 + v69->field_48[3] + v69->field_48[14] + v76);
-          }
-          dword_4FA9B4[v68] += v77;
-          dword_4FA9B4[v68] += 7 * (v69->field_38[0] + v69->field_48[2] + v69->field_48[13] + v69->field_58[15]);
-          if ( BYTE2(v69->field_30) == 99
-            || v69->field_38[12] == 99
-            || v69->field_48[7] == 99
-            || (v79 = v69->field_58[9], v79 == 99) )
-            v80 = 5 * (v143->field_2C - v145->field_2C);
-          else
-            v80 = 5 * (BYTE2(v69->field_30) + v69->field_38[12] + v69->field_48[7] + v79);
-          dword_4FA9B4[v68] += 8 * v80;
-          if ( BYTE3(v69->field_30) == 99
-            || v69->field_38[13] == 99
-            || v69->field_48[8] == 99
-            || (v81 = v69->field_58[10], v81 == 99) )
-            v82 = 5 * (v143->field_30 - v145->field_30);
-          else
-            v82 = 5 * (BYTE3(v69->field_30) + v69->field_38[13] + v69->field_48[8] + v81);
-          dword_4FA9B4[v68] += 8 * v82;
-          if ( LOBYTE(v69->field_34) == 99
-            || v69->field_38[14] == 99
-            || v69->field_48[9] == 99
-            || (v83 = v69->field_58[11], v83 == 99) )
-            v84 = 5 * (v143->field_34 - v145->field_34);
-          else
-            v84 = 5 * (LOBYTE(v69->field_34) + v69->field_38[14] + v69->field_48[9] + v83);
-          dword_4FA9B4[v68] += 8 * v84;
-          if ( BYTE1(v69->field_34) == 99
-            || v69->field_38[15] == 99
-            || v69->field_48[10] == 99
-            || (v85 = v69->field_58[12], v85 == 99) )
-            v86 = v143->field_38 - v145->field_38;
-          else
-            v86 = BYTE1(v69->field_34) + v69->field_38[15] + v69->field_48[10] + v85;
-          dword_4FA9B4[v68] += 2 * v86;
-          if ( BYTE2(v69->field_34) == 99
-            || v69->field_48[0] == 99
-            || v69->field_48[11] == 99
-            || (v87 = v69->field_58[13], v87 == 99) )
-            v88 = v143->field_3C - v145->field_3C;
-          else
-            v88 = BYTE2(v69->field_34) + v69->field_48[0] + v69->field_48[11] + v87;
-          dword_4FA9B4[v68] += 2 * v88;
-          if ( BYTE3(v69->field_34) == 99
-            || v69->field_48[1] == 99
-            || v69->field_48[12] == 99
-            || (v89 = v69->field_58[14], v89 == 99) )
-            v90 = v143->field_40 - v145->field_40;
-          else
-            v90 = BYTE3(v69->field_34) + v69->field_48[1] + v69->field_48[12] + v89;
-          dword_4FA9B4[v68] += 2 * v90;
-          if ( v69->field_38[11] == 99 || (v91 = v69->field_58[8], v91 == 99) )
-            v92 = 10 * (v145->field_24 - v143->field_24);
-          else
-            v92 = -10 * (v69->field_38[11] + v91);
-          dword_4FA9B4[v68] += v92;
-          if ( v69->field_38[10] == 99 || (v93 = v69->field_58[7], v93 == 99) )
-            v94 = 3 * (v145->field_28 - v143->field_28);
-          else
-            v94 = -3 * (v69->field_38[10] + v93);
-          dword_4FA9B4[v68] += v94;
-          v95 = v69->field_38[9];
-          v140 = v95;
-          v96 = v69->field_38[3];
-          dword_4FA9B4[v68] += -7 * (v69->field_58[6] + v95);
-          v97 = dword_4FA9B4[v68];
-          if ( v96 == 99 )
-            goto LABEL_245;
-          v98 = v69->field_58[0];
-          if ( v98 == 99 )
-            break;
-          v99 = v96 + v98;
-          v67 = 99;
-          dword_4FA9B4[v68] = v97 - 5 * v99;
-LABEL_246:
-          v101 = v140;
-          if ( v69->field_38[4] == v67 || (v102 = v69->field_58[1], v102 == v67) )
-            v103 = 5 * (v145->field_30 - v143->field_30);
-          else
-            v103 = -5 * (v69->field_38[4] + v102);
-          dword_4FA9B4[v68] += v103;
-          if ( v69->field_38[5] == v67 || (v104 = v69->field_58[2], v104 == v67) )
-            v105 = 5 * (v145->field_34 - v143->field_34);
-          else
-            v105 = -5 * (v69->field_38[5] + v104);
-          dword_4FA9B4[v68] += v105;
-          if ( v69->field_38[6] == v67 || (v106 = v69->field_58[3], v106 == v67) )
-            v107 = v145->field_38 - v143->field_38;
-          else
-            v107 = -(v69->field_38[6] + v106);
-          dword_4FA9B4[v68] += 2 * v107;
-          if ( v69->field_38[7] == v67 || (v108 = v69->field_58[4], v108 == v67) )
-            v109 = v145->field_3C - v143->field_3C;
-          else
-            v109 = -(v69->field_38[7] + v108);
-          dword_4FA9B4[v68] += 2 * v109;
-          if ( v69->field_38[8] == v67 || (v110 = v69->field_58[5], v110 == v67) )
-          {
-            v112 = v145;
-            v111 = v143;
-            dword_4FA9B4[v68] += 2 * (v145->field_40 - v143->field_40);
-          }
-          else
-          {
-            v111 = v143;
-            dword_4FA9B4[v68] += -2 * (v69->field_38[8] + v110);
-            v112 = v145;
-          }
-          if ( LOBYTE(v69->field_30) || v69->field_48[5] )
-            dword_4FA9B4[v68] *= 10;
-          if ( LOBYTE(v69->field_24) == 1 )
-          {
-            v113 = LOBYTE(v69->field_28);
-            v114 = v112->field_38;
-          }
-          else
-          {
-            if ( LOBYTE(v69->field_24) == 2 )
-            {
-              v113 = BYTE1(v69->field_28);
-              v114 = v112->field_3C;
-            }
-            else
-            {
-              if ( LOBYTE(v69->field_24) != 3 )
-                goto LABEL_278;
-              v113 = BYTE2(v69->field_28);
-              v114 = v112->field_40;
-            }
-          }
-          v115 = v114 - v113;
-          if ( v115 > 3 )
-            v115 = 3;
-          dword_4FA9B4[v68] += 5 * v115;
-LABEL_278:
-          v116 = v69->field_58[8];
-          v141 = v111->field_24;
-          v126 = v69->field_38[11];
-          if ( v141 <= v116 + v126 )
-            dword_4FA9B4[v68] += 9999;
-          v137 = v111->field_28 + v141;
-          if ( v137 <= v116 + v126 + v69->field_58[6] + v69->field_58[7] + v101 + v69->field_38[10] )
-            dword_4FA9B4[v68] += 9999;
-          if ( v69->field_48[15] + (signed int)BYTE1(v69->field_68) + v145->field_24 + v69->field_48[4] + v149 >= dword_4E1884 )
-            dword_4FA9B4[v68] += 9999;
-          ++v133;
-          if ( v133 >= v136 )
-          {
-            v64 = v130;
-            goto LABEL_286;
-          }
-        }
-        v67 = 99;
-LABEL_245:
-        v100 = v145->field_2C - v143->field_2C;
-        dword_4FA9B4[v68] = v97 + 4 * v100 + v100;
-        goto LABEL_246;
-      }
-LABEL_286:
-      v117 = v136 - 1;
-      for ( j = v136 - 1; j >= 0; --j )
-      {
-        v137 = 0;
-        if ( j > 0 )
-        {
-          v119 = (int)dword_4FA9B0;
-          v134 = j;
-          v137 = j;
-          do
-          {
-            if ( *(unsigned int *)(v119 + 4) < *(unsigned int *)(v119 + 12) )
-            {
-              v120 = *(unsigned int *)v119;
-              v121 = *(unsigned int *)(v119 + 4);
-              *(unsigned int *)v119 = *(unsigned int *)(v119 + 8);
-              v122 = *(unsigned int *)(v119 + 12);
-              *(unsigned int *)(v119 + 8) = v120;
-              *(unsigned int *)(v119 + 4) = v122;
-              v64 = v130;
-              *(unsigned int *)(v119 + 12) = v121;
-            }
-            v119 += 8;
-            --v134;
-          }
-          while ( v134 );
-        }
-      }
-      v123 = v136 - 1;
-      if ( am_byte_4FAA77 )
-      {
-        if ( v117 >= 0 )
-        {
-          while ( !BYTE3(pCards[stru_505708[0].arr_44[47 * v64 + dword_4FA9B0[2 * v123]]].field_28) )
-          {
-            --v123;
-            if ( v123 < 0 )
-              return am_40BCFB(v64, v137) != 0;
-          }
-          v137 = dword_4FA9B0[2 * v123];
-        }
-      }
-      else
-      {
-        v124 = 0;
-        if ( v117 >= 0 )
-        {
-          while ( !BYTE3(pCards[stru_505708[0].arr_44[47 * v64 + dword_4FA9B0[2 * v123]]].field_28) )
-          {
-            --v123;
-            if ( v123 < 0 )
-              goto LABEL_299;
-          }
-          v137 = dword_4FA9B0[2 * v123];
-        }
-LABEL_299:
-        if ( v136 > 0 )
-        {
-          while ( !am_40BF15(v64, dword_4FA9B0[2 * v124]) || dword_4FA9B4[2 * v124] < 0 )
-          {
-            ++v124;
-            if ( v124 >= v136 )
-              return am_40BCFB(v64, v137) != 0;
-          }
-          return am_40BE0E(v64, dword_4FA9B0[2 * v124]) != 0;
-        }
-      }
-      return am_40BCFB(v64, v137) != 0;
-    }
-    v9 = a1;
-    v144 = &stru_505708[a1];
-    v129 = a1;
-    v142 = &stru_505708[(a1 + 1) % 2];
-    v135 = am_40BB49(a1);
-    v10 = 0;
-    do
-    {
-      if ( v10 >= v135 )
-      {
-        dword_4FA9B0[2 * v10] = -1;
-        dword_4FA9B4[2 * v10] = -9999;
-      }
-      else
-      {
-        dword_4FA9B0[2 * v10] = v10;
-        dword_4FA9B4[2 * v10] = 0;
-      }
-      ++v10;
-    }
-    while ( v10 < 10 );
-    v131 = 0;
-    if ( v135 > 0 )
-    {
-      v11 = 47 * v9;
-      for ( k = 47 * v9; ; v11 = k )
-      {
-        v12 = 99;
-        v13 = 2 * v131;
-        v14 = &pCards[stru_505708[0].arr_44[v11 + dword_4FA9B0[2 * v131]]];
-        v15 = v14->field_38[2];
-        v148 = v14->field_38[2];
-        if ( v144->field_24 >= 10 )
-        {
-          if ( v15 == 99 || v14->field_48[4] == 99 || v14->field_48[15] == 99 || (v19 = BYTE1(v14->field_68), v19 == 99) )
-            v20 = 5 * (v142->field_24 - v144->field_24);
-          else
-            v20 = 5 * (v148 + v14->field_48[4] + v14->field_48[15] + v19);
-          v18 = 2 * v20;
-        }
-        else
-        {
-          if ( v15 == 99 || v14->field_48[4] == 99 || v14->field_48[15] == 99 || (v16 = BYTE1(v14->field_68), v16 == 99) )
-            v17 = 5 * (v142->field_24 - v144->field_24);
-          else
-            v17 = 5 * (v148 + v14->field_48[4] + v14->field_48[15] + v16);
-          v18 = 4 * v17;
-        }
-        dword_4FA9B4[v13] += v18;
-        v21 = v14->field_38[1];
-        v146 = v14->field_38[1];
-        if ( v144->field_28 >= 10 )
-        {
-          if ( v21 == 99
-            || v14->field_48[3] == 99
-            || v14->field_48[14] == 99
-            || (v24 = LOBYTE(v14->field_68), v24 == 99) )
-            v25 = v142->field_28 - v144->field_28;
-          else
-            v25 = v146 + v14->field_48[3] + v14->field_48[14] + v24;
-          v23 = 2 * v25;
-        }
-        else
-        {
-          if ( v21 == 99
-            || v14->field_48[3] == 99
-            || v14->field_48[14] == 99
-            || (v22 = LOBYTE(v14->field_68), v22 == 99) )
-            v23 = 5 * (v142->field_28 - v144->field_28);
-          else
-            v23 = 5 * (v146 + v14->field_48[3] + v14->field_48[14] + v22);
-        }
-        dword_4FA9B4[v13] += v23;
-        dword_4FA9B4[v13] += 7 * (v14->field_38[0] + v14->field_48[2] + v14->field_48[13] + v14->field_58[15]);
-        if ( BYTE2(v14->field_30) == 99
-          || v14->field_38[12] == 99
-          || v14->field_48[7] == 99
-          || (v26 = v14->field_58[9], v26 == 99) )
-          v27 = 5 * (v142->field_2C - v144->field_2C);
-        else
-          v27 = 5 * (BYTE2(v14->field_30) + v14->field_38[12] + v14->field_48[7] + v26);
-        dword_4FA9B4[v13] += 8 * v27;
-        if ( BYTE3(v14->field_30) == 99
-          || v14->field_38[13] == 99
-          || v14->field_48[8] == 99
-          || (v28 = v14->field_58[10], v28 == 99) )
-          v29 = 5 * (v142->field_30 - v144->field_30);
-        else
-          v29 = 5 * (BYTE3(v14->field_30) + v14->field_38[13] + v14->field_48[8] + v28);
-        dword_4FA9B4[v13] += 8 * v29;
-        if ( LOBYTE(v14->field_34) == 99
-          || v14->field_38[14] == 99
-          || v14->field_48[9] == 99
-          || (v30 = v14->field_58[11], v30 == 99) )
-          v31 = 5 * (v142->field_34 - v144->field_34);
-        else
-          v31 = 5 * (LOBYTE(v14->field_34) + v14->field_38[14] + v14->field_48[9] + v30);
-        dword_4FA9B4[v13] += 8 * v31;
-        if ( BYTE1(v14->field_34) == 99
-          || v14->field_38[15] == 99
-          || v14->field_48[10] == 99
-          || (v32 = v14->field_58[12], v32 == 99) )
-          v33 = v142->field_38 - v144->field_38;
-        else
-          v33 = BYTE1(v14->field_34) + v14->field_38[15] + v14->field_48[10] + v32;
-        dword_4FA9B4[v13] += 2 * v33;
-        if ( BYTE2(v14->field_34) == 99
-          || v14->field_48[0] == 99
-          || v14->field_48[11] == 99
-          || (v34 = v14->field_58[13], v34 == 99) )
-          v35 = v142->field_3C - v144->field_3C;
-        else
-          v35 = BYTE2(v14->field_34) + v14->field_48[0] + v14->field_48[11] + v34;
-        dword_4FA9B4[v13] += 2 * v35;
-        if ( BYTE3(v14->field_34) == 99
-          || v14->field_48[1] == 99
-          || v14->field_48[12] == 99
-          || (v36 = v14->field_58[14], v36 == 99) )
-          v37 = v142->field_40 - v144->field_40;
-        else
-          v37 = BYTE3(v14->field_34) + v14->field_48[1] + v14->field_48[12] + v36;
-        dword_4FA9B4[v13] += 2 * v37;
-        if ( v14->field_38[11] == 99 || (v38 = v14->field_58[8], v38 == 99) )
-          dword_4FA9B4[v13] += v144->field_24 - v142->field_24;
-        else
-          dword_4FA9B4[v13] -= v14->field_38[11] + v38;
-        if ( v14->field_38[10] == 99 || (v39 = v14->field_58[7], v39 == 99) )
-          dword_4FA9B4[v13] += v144->field_28 - v142->field_28;
-        else
-          dword_4FA9B4[v13] -= v14->field_38[10] + v39;
-        v40 = v14->field_38[9];
-        v138 = v14->field_38[9];
-        dword_4FA9B4[v13] -= v40 + v14->field_58[6];
-        v41 = v14->field_38[3];
-        v42 = dword_4FA9B4[v13];
-        if ( v41 == 99 )
-          goto LABEL_97;
-        v43 = v14->field_58[0];
-        if ( v43 == 99 )
-          break;
-        v44 = v42 - v43;
-        v12 = 99;
-        dword_4FA9B4[v13] = v44 - v41;
-LABEL_98:
-        if ( v14->field_38[4] == v12 || (v45 = v14->field_58[1], v45 == v12) )
-          dword_4FA9B4[v13] += v144->field_30 - v142->field_30;
-        else
-          dword_4FA9B4[v13] -= v14->field_38[4] + v45;
-        if ( v14->field_38[5] == v12 || (v46 = v14->field_58[2], v46 == v12) )
-          dword_4FA9B4[v13] += v144->field_34 - v142->field_34;
-        else
-          dword_4FA9B4[v13] -= v14->field_38[5] + v46;
-        if ( v14->field_38[6] == v12 || (v47 = v14->field_58[3], v47 == v12) )
-          dword_4FA9B4[v13] += v144->field_38 - v142->field_38;
-        else
-          dword_4FA9B4[v13] -= v14->field_38[6] + v47;
-        if ( v14->field_38[7] == v12 || (v48 = v14->field_58[4], v48 == v12) )
-          dword_4FA9B4[v13] += v144->field_3C - v142->field_3C;
-        else
-          dword_4FA9B4[v13] -= v14->field_38[7] + v48;
-        if ( v14->field_38[8] == v12 || (v49 = v14->field_58[5], v49 == v12) )
-        {
-          v51 = v144;
-          v50 = v142;
-          dword_4FA9B4[v13] += v144->field_40 - v142->field_40;
-        }
-        else
-        {
-          v50 = v142;
-          dword_4FA9B4[v13] -= v14->field_38[8] + v49;
-          v51 = v144;
-        }
-        if ( LOBYTE(v14->field_30) || v14->field_48[5] )
-          dword_4FA9B4[v13] *= 10;
-        if ( LOBYTE(v14->field_24) == 1 )
-        {
-          v52 = LOBYTE(v14->field_28);
-          v53 = v51->field_38;
-        }
-        else
-        {
-          if ( LOBYTE(v14->field_24) == 2 )
-          {
-            v52 = BYTE1(v14->field_28);
-            v53 = v51->field_3C;
-          }
-          else
-          {
-            if ( LOBYTE(v14->field_24) != 3 )
-              goto LABEL_130;
-            v52 = BYTE2(v14->field_28);
-            v53 = v51->field_40;
-          }
-        }
-        v54 = v53 - v52;
-        if ( v54 > 3 )
-          v54 = 3;
-        dword_4FA9B4[v13] += 5 * v54;
-LABEL_130:
-        v55 = v14->field_58[8];
-        v139 = v50->field_24;
-        v125 = v14->field_38[11];
-        if ( v139 <= v55 + v125 )
-          dword_4FA9B4[v13] += 9999;
-        v137 = v50->field_28 + v139;
-        if ( v137 <= v55 + v125 + v14->field_58[6] + v14->field_58[7] + v40 + v14->field_38[10] )
-          dword_4FA9B4[v13] += 9999;
-        if ( v14->field_48[15] + (signed int)BYTE1(v14->field_68) + v144->field_24 + v14->field_48[4] + v148 >= dword_4E1884 )
-          dword_4FA9B4[v13] += 9999;
-        ++v131;
-        if ( v131 >= v135 )
-        {
-          v9 = v129;
-          goto LABEL_138;
-        }
-      }
-      v12 = 99;
-LABEL_97:
-      v40 = v138;
-      dword_4FA9B4[v13] = v42 + v144->field_2C - v142->field_2C;
-      goto LABEL_98;
-    }
-LABEL_138:
-    v56 = v135 - 1;
-    for ( l = v135 - 1; l >= 0; --l )
-    {
-      v137 = 0;
-      if ( l > 0 )
-      {
-        v58 = (int)dword_4FA9B0;
-        v132 = l;
-        v137 = l;
-        do
-        {
-          if ( *(unsigned int *)(v58 + 4) < *(unsigned int *)(v58 + 12) )
-          {
-            v59 = *(unsigned int *)v58;
-            v60 = *(unsigned int *)(v58 + 4);
-            *(unsigned int *)v58 = *(unsigned int *)(v58 + 8);
-            v61 = *(unsigned int *)(v58 + 12);
-            *(unsigned int *)(v58 + 8) = v59;
-            *(unsigned int *)(v58 + 4) = v61;
-            v9 = v129;
-            *(unsigned int *)(v58 + 12) = v60;
-          }
-          v58 += 8;
-          --v132;
-        }
-        while ( v132 );
-      }
-    }
-    v62 = v135 - 1;
-    if ( am_byte_4FAA77 )
-    {
-      if ( v56 >= 0 )
-      {
-        while ( !BYTE3(pCards[stru_505708[0].arr_44[47 * v9 + dword_4FA9B0[2 * v62]]].field_28) )
-        {
-          --v62;
-          if ( v62 < 0 )
-            return am_40BCFB(v9, v137) != 0;
-        }
-        v137 = dword_4FA9B0[2 * v62];
-      }
-    }
-    else
-    {
-      v63 = 0;
-      if ( v56 >= 0 )
-      {
-        while ( !BYTE3(pCards[stru_505708[0].arr_44[47 * v9 + dword_4FA9B0[2 * v62]]].field_28) )
-        {
-          --v62;
-          if ( v62 < 0 )
-            goto LABEL_151;
-        }
-        v137 = dword_4FA9B0[2 * v62];
-      }
-LABEL_151:
-      if ( v135 > 0 )
-      {
-        while ( !am_40BF15(v9, dword_4FA9B0[2 * v63]) || dword_4FA9B4[2 * v63] < 0 )
-        {
-          ++v63;
-          if ( v63 >= v135 )
-            return am_40BCFB(v9, v137) != 0;
-        }
-        return am_40BE0E(v9, dword_4FA9B0[2 * v63]) != 0;
-      }
-    }
-    return am_40BCFB(v9, v137) != 0;
-  }
-  v3 = 0;
-  v4 = a1;
-  if ( am_byte_4FAA77 )
-  {
-LABEL_11:
-    v7 = am_40BB49(v4);
-    v8 = rand_interval(0, v7 - 1);
-    result = am_40BCFB(v4, v8);
-  }
-  else
-  {
-    while ( 1 )
-    {
-      v5 = am_40BB49(v4);
-      v6 = rand_interval(0, v5 - 1);
-      if ( am_40BF15(v4, v6) )
-        break;
-      ++v3;
-      if ( v3 >= 10 )
-        goto LABEL_11;
-    }
-    result = am_40BE0E(v4, v6);
-  }
-  return result != 0;
+//  char result; // al@3
+//  signed int v3; // ebx@8
+//  int v4; // esi@8
+//  int v5; // eax@9
+//  int v6; // edi@9
+//  int v7; // eax@11
+//  signed int v8; // eax@11
+//  int v9; // ebx@5
+//  int v10; // eax@5
+//  int v11; // ecx@18
+//  char v12; // bl@20
+//  int v13; // eax@20
+//  ArcomageCard *v14; // ecx@20
+//  char v15; // dl@20
+//  char v16; // dl@24
+//  int v17; // edx@25
+//  int v18; // edx@27
+//  char v19; // dl@31
+//  int v20; // edx@32
+//  char v21; // dl@35
+//  char v22; // dl@39
+//  int v23; // edx@40
+//  char v24; // dl@45
+//  int v25; // edx@46
+//  char v26; // dl@52
+//  int v27; // edx@53
+//  char v28; // dl@58
+//  int v29; // edx@59
+//  char v30; // dl@64
+//  int v31; // edx@65
+//  char v32; // dl@70
+//  int v33; // edx@71
+//  char v34; // dl@76
+//  int v35; // edx@77
+//  char v36; // dl@82
+//  int v37; // edx@83
+//  char v38; // dl@86
+//  char v39; // dl@90
+//  int v40; // edi@93
+//  char v41; // dl@93
+//  int v42; // esi@93
+//  char v43; // bl@94
+//  int v44; // esi@95
+//  char v45; // dl@99
+//  char v46; // dl@103
+//  char v47; // dl@107
+//  char v48; // dl@111
+//  char v49; // dl@115
+//  ArcomagePlayer *v50; // ebx@116
+//  ArcomagePlayer *v51; // edx@116
+//  int v52; // esi@124
+//  int v53; // edx@124
+//  int v54; // edx@127
+//  int v55; // esi@130
+//  int v56; // edi@138
+//  int l; // esi@138
+//  int v58; // eax@140
+//  int v59; // ecx@142
+//  int v60; // edx@142
+//  int v61; // ebx@142
+//  int v62; // eax@145
+//  int v63; // esi@146
+//  int v64; // ebx@4
+//  int v65; // eax@4
+//  int v66; // ecx@168
+//  char v67; // bl@170
+//  int v68; // eax@170
+//  ArcomageCard *v69; // ecx@170
+//  char v70; // dl@170
+//  char v71; // dl@174
+//  int v72; // edx@175
+//  int v73; // edx@177
+//  char v74; // dl@181
+//  char v75; // dl@184
+//  char v76; // dl@188
+//  int v77; // edx@189
+//  char v78; // dl@194
+//  char v79; // dl@200
+//  int v80; // edx@201
+//  char v81; // dl@206
+//  int v82; // edx@207
+//  char v83; // dl@212
+//  int v84; // edx@213
+//  char v85; // dl@218
+//  int v86; // edx@219
+//  char v87; // dl@224
+//  int v88; // edx@225
+//  char v89; // dl@230
+//  int v90; // edx@231
+//  char v91; // dl@234
+//  int v92; // edx@235
+//  char v93; // dl@238
+//  int v94; // edx@239
+//  int v95; // esi@241
+//  char v96; // dl@241
+//  int v97; // esi@241
+//  char v98; // bl@242
+//  int v99; // edi@243
+//  int v100; // edx@245
+//  int v101; // edi@246
+//  char v102; // dl@247
+//  int v103; // edx@248
+//  char v104; // dl@251
+//  int v105; // edx@252
+//  char v106; // dl@255
+//  int v107; // edx@256
+//  char v108; // dl@259
+//  int v109; // edx@260
+//  char v110; // dl@263
+//  ArcomagePlayer *v111; // ebx@264
+//  ArcomagePlayer *v112; // edx@264
+//  int v113; // esi@272
+//  int v114; // edx@272
+//  int v115; // edx@275
+//  int v116; // esi@278
+//  int v117; // edi@286
+//  int j; // esi@286
+//  int v119; // eax@288
+//  int v120; // ecx@290
+//  int v121; // edx@290
+//  int v122; // ebx@290
+//  int v123; // eax@293
+//  int v124; // esi@294
+//  int v125; // [sp-28h] [bp-28h]@130
+//  int v126; // [sp-28h] [bp-28h]@278
+//  int k; // [sp-24h] [bp-24h]@18
+//  int i; // [sp-24h] [bp-24h]@168
+//  int v129; // [sp-20h] [bp-20h]@5
+//  int v130; // [sp-20h] [bp-20h]@4
+//  int v131; // [sp-1Ch] [bp-1Ch]@17
+//  int v132; // [sp-1Ch] [bp-1Ch]@140
+//  int v133; // [sp-1Ch] [bp-1Ch]@167
+//  int v134; // [sp-1Ch] [bp-1Ch]@288
+//  int v135; // [sp-18h] [bp-18h]@5
+//  int v136; // [sp-18h] [bp-18h]@4
+//  signed int v137; // [sp-14h] [bp-14h]@0
+//  int v138; // [sp-14h] [bp-14h]@93
+//  int v139; // [sp-14h] [bp-14h]@130
+//  int v140; // [sp-14h] [bp-14h]@241
+//  int v141; // [sp-14h] [bp-14h]@278
+//  ArcomagePlayer *v142; // [sp-10h] [bp-10h]@5
+//  ArcomagePlayer *v143; // [sp-10h] [bp-10h]@4
+//  ArcomagePlayer *v144; // [sp-Ch] [bp-Ch]@5
+//  ArcomagePlayer *v145; // [sp-Ch] [bp-Ch]@4
+//  char v146; // [sp-8h] [bp-8h]@35
+//  char v147; // [sp-8h] [bp-8h]@184
+//  char v148; // [sp-5h] [bp-5h]@20
+//  char v149; // [sp-5h] [bp-5h]@170
+//
+//  byte_4FAA00 = 1;
+//  if ( dword_4DF3A4 )
+//  {
+//    if ( dword_4DF3A4 != 1 )
+//    {
+//      result = dword_4DF3A4 - 2;
+//      if ( dword_4DF3A4 != 2 )
+//        return result != 0;
+//      v64 = a1;
+//      v145 = &stru_505708[a1];
+//      v130 = a1;
+//      v143 = &stru_505708[(a1 + 1) % 2];
+//      v136 = am_40BB49(a1);
+//      v65 = 0;
+//      do
+//      {
+//        if ( v65 >= v136 )
+//        {
+//          dword_4FA9B0[2 * v65] = -1;
+//          dword_4FA9B4[2 * v65] = -9999;
+//        }
+//        else
+//        {
+//          dword_4FA9B0[2 * v65] = v65;
+//          dword_4FA9B4[2 * v65] = 0;
+//        }
+//        ++v65;
+//      }
+//      while ( v65 < 10 );
+//      v133 = 0;
+//      if ( v136 > 0 )
+//      {
+//        v66 = 47 * v64;
+//        for ( i = 47 * v64; ; v66 = i )
+//        {
+//          v67 = 99;
+//          v68 = 2 * v133;
+//          v69 = &pCards[stru_505708[0].cards_at_hand[v66 + dword_4FA9B0[2 * v133]]];
+//          v70 = v69->field_38[2];
+//          v149 = v69->field_38[2];
+//          if ( v145->field_24 >= 10 )
+//          {
+//            if ( v70 == 99
+//              || v69->field_48[4] == 99
+//              || v69->field_48[15] == 99
+//              || (v74 = BYTE1(v69->field_68), v74 == 99) )
+//              v73 = 5 * (v143->field_24 - v145->field_24);
+//            else
+//              v73 = 5 * (v149 + v69->field_48[4] + v69->field_48[15] + v74);
+//          }
+//          else
+//          {
+//            if ( v70 == 99
+//              || v69->field_48[4] == 99
+//              || v69->field_48[15] == 99
+//              || (v71 = BYTE1(v69->field_68), v71 == 99) )
+//              v72 = 5 * (v143->field_24 - v145->field_24);
+//            else
+//              v72 = 5 * (v149 + v69->field_48[4] + v69->field_48[15] + v71);
+//            v73 = 4 * v72;
+//          }
+//          dword_4FA9B4[v68] += v73;
+//          v75 = v69->field_38[1];
+//          v147 = v69->field_38[1];
+//          if ( v145->field_28 >= 10 )
+//          {
+//            if ( v75 == 99
+//              || v69->field_48[3] == 99
+//              || v69->field_48[14] == 99
+//              || (v78 = LOBYTE(v69->field_68), v78 == 99) )
+//              v77 = v143->field_28 - v145->field_28;
+//            else
+//              v77 = v147 + v69->field_48[3] + v69->field_48[14] + v78;
+//          }
+//          else
+//          {
+//            if ( v75 == 99
+//              || v69->field_48[3] == 99
+//              || v69->field_48[14] == 99
+//              || (v76 = LOBYTE(v69->field_68), v76 == 99) )
+//              v77 = 5 * (v143->field_28 - v145->field_28);
+//            else
+//              v77 = 5 * (v147 + v69->field_48[3] + v69->field_48[14] + v76);
+//          }
+//          dword_4FA9B4[v68] += v77;
+//          dword_4FA9B4[v68] += 7 * (v69->field_38[0] + v69->field_48[2] + v69->field_48[13] + v69->field_58[15]);
+//          if ( BYTE2(v69->field_30) == 99
+//            || v69->field_38[12] == 99
+//            || v69->field_48[7] == 99
+//            || (v79 = v69->field_58[9], v79 == 99) )
+//            v80 = 5 * (v143->field_2C - v145->field_2C);
+//          else
+//            v80 = 5 * (BYTE2(v69->field_30) + v69->field_38[12] + v69->field_48[7] + v79);
+//          dword_4FA9B4[v68] += 8 * v80;
+//          if ( BYTE3(v69->field_30) == 99
+//            || v69->field_38[13] == 99
+//            || v69->field_48[8] == 99
+//            || (v81 = v69->field_58[10], v81 == 99) )
+//            v82 = 5 * (v143->field_30 - v145->field_30);
+//          else
+//            v82 = 5 * (BYTE3(v69->field_30) + v69->field_38[13] + v69->field_48[8] + v81);
+//          dword_4FA9B4[v68] += 8 * v82;
+//          if ( LOBYTE(v69->field_34) == 99
+//            || v69->field_38[14] == 99
+//            || v69->field_48[9] == 99
+//            || (v83 = v69->field_58[11], v83 == 99) )
+//            v84 = 5 * (v143->field_34 - v145->field_34);
+//          else
+//            v84 = 5 * (LOBYTE(v69->field_34) + v69->field_38[14] + v69->field_48[9] + v83);
+//          dword_4FA9B4[v68] += 8 * v84;
+//          if ( BYTE1(v69->field_34) == 99
+//            || v69->field_38[15] == 99
+//            || v69->field_48[10] == 99
+//            || (v85 = v69->field_58[12], v85 == 99) )
+//            v86 = v143->field_38 - v145->field_38;
+//          else
+//            v86 = BYTE1(v69->field_34) + v69->field_38[15] + v69->field_48[10] + v85;
+//          dword_4FA9B4[v68] += 2 * v86;
+//          if ( BYTE2(v69->field_34) == 99
+//            || v69->field_48[0] == 99
+//            || v69->field_48[11] == 99
+//            || (v87 = v69->field_58[13], v87 == 99) )
+//            v88 = v143->field_3C - v145->field_3C;
+//          else
+//            v88 = BYTE2(v69->field_34) + v69->field_48[0] + v69->field_48[11] + v87;
+//          dword_4FA9B4[v68] += 2 * v88;
+//          if ( BYTE3(v69->field_34) == 99
+//            || v69->field_48[1] == 99
+//            || v69->field_48[12] == 99
+//            || (v89 = v69->field_58[14], v89 == 99) )
+//            v90 = v143->field_40 - v145->field_40;
+//          else
+//            v90 = BYTE3(v69->field_34) + v69->field_48[1] + v69->field_48[12] + v89;
+//          dword_4FA9B4[v68] += 2 * v90;
+//          if ( v69->field_38[11] == 99 || (v91 = v69->field_58[8], v91 == 99) )
+//            v92 = 10 * (v145->field_24 - v143->field_24);
+//          else
+//            v92 = -10 * (v69->field_38[11] + v91);
+//          dword_4FA9B4[v68] += v92;
+//          if ( v69->field_38[10] == 99 || (v93 = v69->field_58[7], v93 == 99) )
+//            v94 = 3 * (v145->field_28 - v143->field_28);
+//          else
+//            v94 = -3 * (v69->field_38[10] + v93);
+//          dword_4FA9B4[v68] += v94;
+//          v95 = v69->field_38[9];
+//          v140 = v95;
+//          v96 = v69->field_38[3];
+//          dword_4FA9B4[v68] += -7 * (v69->field_58[6] + v95);
+//          v97 = dword_4FA9B4[v68];
+//          if ( v96 == 99 )
+//            goto LABEL_245;
+//          v98 = v69->field_58[0];
+//          if ( v98 == 99 )
+//            break;
+//          v99 = v96 + v98;
+//          v67 = 99;
+//          dword_4FA9B4[v68] = v97 - 5 * v99;
+//LABEL_246:
+//          v101 = v140;
+//          if ( v69->field_38[4] == v67 || (v102 = v69->field_58[1], v102 == v67) )
+//            v103 = 5 * (v145->field_30 - v143->field_30);
+//          else
+//            v103 = -5 * (v69->field_38[4] + v102);
+//          dword_4FA9B4[v68] += v103;
+//          if ( v69->field_38[5] == v67 || (v104 = v69->field_58[2], v104 == v67) )
+//            v105 = 5 * (v145->field_34 - v143->field_34);
+//          else
+//            v105 = -5 * (v69->field_38[5] + v104);
+//          dword_4FA9B4[v68] += v105;
+//          if ( v69->field_38[6] == v67 || (v106 = v69->field_58[3], v106 == v67) )
+//            v107 = v145->field_38 - v143->field_38;
+//          else
+//            v107 = -(v69->field_38[6] + v106);
+//          dword_4FA9B4[v68] += 2 * v107;
+//          if ( v69->field_38[7] == v67 || (v108 = v69->field_58[4], v108 == v67) )
+//            v109 = v145->field_3C - v143->field_3C;
+//          else
+//            v109 = -(v69->field_38[7] + v108);
+//          dword_4FA9B4[v68] += 2 * v109;
+//          if ( v69->field_38[8] == v67 || (v110 = v69->field_58[5], v110 == v67) )
+//          {
+//            v112 = v145;
+//            v111 = v143;
+//            dword_4FA9B4[v68] += 2 * (v145->field_40 - v143->field_40);
+//          }
+//          else
+//          {
+//            v111 = v143;
+//            dword_4FA9B4[v68] += -2 * (v69->field_38[8] + v110);
+//            v112 = v145;
+//          }
+//          if ( LOBYTE(v69->field_30) || v69->field_48[5] )
+//            dword_4FA9B4[v68] *= 10;
+//          if ( LOBYTE(v69->field_24) == 1 )
+//          {
+//            v113 = LOBYTE(v69->field_28);
+//            v114 = v112->field_38;
+//          }
+//          else
+//          {
+//            if ( LOBYTE(v69->field_24) == 2 )
+//            {
+//              v113 = BYTE1(v69->field_28);
+//              v114 = v112->field_3C;
+//            }
+//            else
+//            {
+//              if ( LOBYTE(v69->field_24) != 3 )
+//                goto LABEL_278;
+//              v113 = BYTE2(v69->field_28);
+//              v114 = v112->field_40;
+//            }
+//          }
+//          v115 = v114 - v113;
+//          if ( v115 > 3 )
+//            v115 = 3;
+//          dword_4FA9B4[v68] += 5 * v115;
+//LABEL_278:
+//          v116 = v69->field_58[8];
+//          v141 = v111->field_24;
+//          v126 = v69->field_38[11];
+//          if ( v141 <= v116 + v126 )
+//            dword_4FA9B4[v68] += 9999;
+//          v137 = v111->field_28 + v141;
+//          if ( v137 <= v116 + v126 + v69->field_58[6] + v69->field_58[7] + v101 + v69->field_38[10] )
+//            dword_4FA9B4[v68] += 9999;
+//          if ( v69->field_48[15] + (signed int)BYTE1(v69->field_68) + v145->field_24 + v69->field_48[4] + v149 >= dword_4E1884 )
+//            dword_4FA9B4[v68] += 9999;
+//          ++v133;
+//          if ( v133 >= v136 )
+//          {
+//            v64 = v130;
+//            goto LABEL_286;
+//          }
+//        }
+//        v67 = 99;
+//LABEL_245:
+//        v100 = v145->field_2C - v143->field_2C;
+//        dword_4FA9B4[v68] = v97 + 4 * v100 + v100;
+//        goto LABEL_246;
+//      }
+//LABEL_286:
+//      v117 = v136 - 1;
+//      for ( j = v136 - 1; j >= 0; --j )
+//      {
+//        v137 = 0;
+//        if ( j > 0 )
+//        {
+//          v119 = (int)dword_4FA9B0;
+//          v134 = j;
+//          v137 = j;
+//          do
+//          {
+//            if ( *(unsigned int *)(v119 + 4) < *(unsigned int *)(v119 + 12) )
+//            {
+//              v120 = *(unsigned int *)v119;
+//              v121 = *(unsigned int *)(v119 + 4);
+//              *(unsigned int *)v119 = *(unsigned int *)(v119 + 8);
+//              v122 = *(unsigned int *)(v119 + 12);
+//              *(unsigned int *)(v119 + 8) = v120;
+//              *(unsigned int *)(v119 + 4) = v122;
+//              v64 = v130;
+//              *(unsigned int *)(v119 + 12) = v121;
+//            }
+//            v119 += 8;
+//            --v134;
+//          }
+//          while ( v134 );
+//        }
+//      }
+//      v123 = v136 - 1;
+//      if ( am_byte_4FAA77 )
+//      {
+//        if ( v117 >= 0 )
+//        {
+//          while ( !BYTE3(pCards[stru_505708[0].cards_at_hand[47 * v64 + dword_4FA9B0[2 * v123]]].field_28) )
+//          {
+//            --v123;
+//            if ( v123 < 0 )
+//              return am_40BCFB(v64, v137) != 0;
+//          }
+//          v137 = dword_4FA9B0[2 * v123];
+//        }
+//      }
+//      else
+//      {
+//        v124 = 0;
+//        if ( v117 >= 0 )
+//        {
+//          while ( !BYTE3(pCards[stru_505708[0].cards_at_hand[47 * v64 + dword_4FA9B0[2 * v123]]].field_28) )
+//          {
+//            --v123;
+//            if ( v123 < 0 )
+//              goto LABEL_299;
+//          }
+//          v137 = dword_4FA9B0[2 * v123];
+//        }
+//LABEL_299:
+//        if ( v136 > 0 )
+//        {
+//          while ( !am_40BF15(v64, dword_4FA9B0[2 * v124]) || dword_4FA9B4[2 * v124] < 0 )
+//          {
+//            ++v124;
+//            if ( v124 >= v136 )
+//              return am_40BCFB(v64, v137) != 0;
+//          }
+//          return am_40BE0E(v64, dword_4FA9B0[2 * v124]) != 0;
+//        }
+//      }
+//      return am_40BCFB(v64, v137) != 0;
+//    }
+//    v9 = a1;
+//    v144 = &stru_505708[a1];
+//    v129 = a1;
+//    v142 = &stru_505708[(a1 + 1) % 2];
+//    v135 = am_40BB49(a1);
+//    v10 = 0;
+//    do
+//    {
+//      if ( v10 >= v135 )
+//      {
+//        dword_4FA9B0[2 * v10] = -1;
+//        dword_4FA9B4[2 * v10] = -9999;
+//      }
+//      else
+//      {
+//        dword_4FA9B0[2 * v10] = v10;
+//        dword_4FA9B4[2 * v10] = 0;
+//      }
+//      ++v10;
+//    }
+//    while ( v10 < 10 );
+//    v131 = 0;
+//    if ( v135 > 0 )
+//    {
+//      v11 = 47 * v9;
+//      for ( k = 47 * v9; ; v11 = k )
+//      {
+//        v12 = 99;
+//        v13 = 2 * v131;
+//        v14 = &pCards[stru_505708[0].cards_at_hand[v11 + dword_4FA9B0[2 * v131]]];
+//        v15 = v14->field_38[2];
+//        v148 = v14->field_38[2];
+//        if ( v144->field_24 >= 10 )
+//        {
+//          if ( v15 == 99 || v14->field_48[4] == 99 || v14->field_48[15] == 99 || (v19 = BYTE1(v14->field_68), v19 == 99) )
+//            v20 = 5 * (v142->field_24 - v144->field_24);
+//          else
+//            v20 = 5 * (v148 + v14->field_48[4] + v14->field_48[15] + v19);
+//          v18 = 2 * v20;
+//        }
+//        else
+//        {
+//          if ( v15 == 99 || v14->field_48[4] == 99 || v14->field_48[15] == 99 || (v16 = BYTE1(v14->field_68), v16 == 99) )
+//            v17 = 5 * (v142->field_24 - v144->field_24);
+//          else
+//            v17 = 5 * (v148 + v14->field_48[4] + v14->field_48[15] + v16);
+//          v18 = 4 * v17;
+//        }
+//        dword_4FA9B4[v13] += v18;
+//        v21 = v14->field_38[1];
+//        v146 = v14->field_38[1];
+//        if ( v144->field_28 >= 10 )
+//        {
+//          if ( v21 == 99
+//            || v14->field_48[3] == 99
+//            || v14->field_48[14] == 99
+//            || (v24 = LOBYTE(v14->field_68), v24 == 99) )
+//            v25 = v142->field_28 - v144->field_28;
+//          else
+//            v25 = v146 + v14->field_48[3] + v14->field_48[14] + v24;
+//          v23 = 2 * v25;
+//        }
+//        else
+//        {
+//          if ( v21 == 99
+//            || v14->field_48[3] == 99
+//            || v14->field_48[14] == 99
+//            || (v22 = LOBYTE(v14->field_68), v22 == 99) )
+//            v23 = 5 * (v142->field_28 - v144->field_28);
+//          else
+//            v23 = 5 * (v146 + v14->field_48[3] + v14->field_48[14] + v22);
+//        }
+//        dword_4FA9B4[v13] += v23;
+//        dword_4FA9B4[v13] += 7 * (v14->field_38[0] + v14->field_48[2] + v14->field_48[13] + v14->field_58[15]);
+//        if ( BYTE2(v14->field_30) == 99
+//          || v14->field_38[12] == 99
+//          || v14->field_48[7] == 99
+//          || (v26 = v14->field_58[9], v26 == 99) )
+//          v27 = 5 * (v142->field_2C - v144->field_2C);
+//        else
+//          v27 = 5 * (BYTE2(v14->field_30) + v14->field_38[12] + v14->field_48[7] + v26);
+//        dword_4FA9B4[v13] += 8 * v27;
+//        if ( BYTE3(v14->field_30) == 99
+//          || v14->field_38[13] == 99
+//          || v14->field_48[8] == 99
+//          || (v28 = v14->field_58[10], v28 == 99) )
+//          v29 = 5 * (v142->field_30 - v144->field_30);
+//        else
+//          v29 = 5 * (BYTE3(v14->field_30) + v14->field_38[13] + v14->field_48[8] + v28);
+//        dword_4FA9B4[v13] += 8 * v29;
+//        if ( LOBYTE(v14->field_34) == 99
+//          || v14->field_38[14] == 99
+//          || v14->field_48[9] == 99
+//          || (v30 = v14->field_58[11], v30 == 99) )
+//          v31 = 5 * (v142->field_34 - v144->field_34);
+//        else
+//          v31 = 5 * (LOBYTE(v14->field_34) + v14->field_38[14] + v14->field_48[9] + v30);
+//        dword_4FA9B4[v13] += 8 * v31;
+//        if ( BYTE1(v14->field_34) == 99
+//          || v14->field_38[15] == 99
+//          || v14->field_48[10] == 99
+//          || (v32 = v14->field_58[12], v32 == 99) )
+//          v33 = v142->field_38 - v144->field_38;
+//        else
+//          v33 = BYTE1(v14->field_34) + v14->field_38[15] + v14->field_48[10] + v32;
+//        dword_4FA9B4[v13] += 2 * v33;
+//        if ( BYTE2(v14->field_34) == 99
+//          || v14->field_48[0] == 99
+//          || v14->field_48[11] == 99
+//          || (v34 = v14->field_58[13], v34 == 99) )
+//          v35 = v142->field_3C - v144->field_3C;
+//        else
+//          v35 = BYTE2(v14->field_34) + v14->field_48[0] + v14->field_48[11] + v34;
+//        dword_4FA9B4[v13] += 2 * v35;
+//        if ( BYTE3(v14->field_34) == 99
+//          || v14->field_48[1] == 99
+//          || v14->field_48[12] == 99
+//          || (v36 = v14->field_58[14], v36 == 99) )
+//          v37 = v142->field_40 - v144->field_40;
+//        else
+//          v37 = BYTE3(v14->field_34) + v14->field_48[1] + v14->field_48[12] + v36;
+//        dword_4FA9B4[v13] += 2 * v37;
+//        if ( v14->field_38[11] == 99 || (v38 = v14->field_58[8], v38 == 99) )
+//          dword_4FA9B4[v13] += v144->field_24 - v142->field_24;
+//        else
+//          dword_4FA9B4[v13] -= v14->field_38[11] + v38;
+//        if ( v14->field_38[10] == 99 || (v39 = v14->field_58[7], v39 == 99) )
+//          dword_4FA9B4[v13] += v144->field_28 - v142->field_28;
+//        else
+//          dword_4FA9B4[v13] -= v14->field_38[10] + v39;
+//        v40 = v14->field_38[9];
+//        v138 = v14->field_38[9];
+//        dword_4FA9B4[v13] -= v40 + v14->field_58[6];
+//        v41 = v14->field_38[3];
+//        v42 = dword_4FA9B4[v13];
+//        if ( v41 == 99 )
+//          goto LABEL_97;
+//        v43 = v14->field_58[0];
+//        if ( v43 == 99 )
+//          break;
+//        v44 = v42 - v43;
+//        v12 = 99;
+//        dword_4FA9B4[v13] = v44 - v41;
+//LABEL_98:
+//        if ( v14->field_38[4] == v12 || (v45 = v14->field_58[1], v45 == v12) )
+//          dword_4FA9B4[v13] += v144->field_30 - v142->field_30;
+//        else
+//          dword_4FA9B4[v13] -= v14->field_38[4] + v45;
+//        if ( v14->field_38[5] == v12 || (v46 = v14->field_58[2], v46 == v12) )
+//          dword_4FA9B4[v13] += v144->field_34 - v142->field_34;
+//        else
+//          dword_4FA9B4[v13] -= v14->field_38[5] + v46;
+//        if ( v14->field_38[6] == v12 || (v47 = v14->field_58[3], v47 == v12) )
+//          dword_4FA9B4[v13] += v144->field_38 - v142->field_38;
+//        else
+//          dword_4FA9B4[v13] -= v14->field_38[6] + v47;
+//        if ( v14->field_38[7] == v12 || (v48 = v14->field_58[4], v48 == v12) )
+//          dword_4FA9B4[v13] += v144->field_3C - v142->field_3C;
+//        else
+//          dword_4FA9B4[v13] -= v14->field_38[7] + v48;
+//        if ( v14->field_38[8] == v12 || (v49 = v14->field_58[5], v49 == v12) )
+//        {
+//          v51 = v144;
+//          v50 = v142;
+//          dword_4FA9B4[v13] += v144->field_40 - v142->field_40;
+//        }
+//        else
+//        {
+//          v50 = v142;
+//          dword_4FA9B4[v13] -= v14->field_38[8] + v49;
+//          v51 = v144;
+//        }
+//        if ( LOBYTE(v14->field_30) || v14->field_48[5] )
+//          dword_4FA9B4[v13] *= 10;
+//        if ( LOBYTE(v14->field_24) == 1 )
+//        {
+//          v52 = LOBYTE(v14->field_28);
+//          v53 = v51->field_38;
+//        }
+//        else
+//        {
+//          if ( LOBYTE(v14->field_24) == 2 )
+//          {
+//            v52 = BYTE1(v14->field_28);
+//            v53 = v51->field_3C;
+//          }
+//          else
+//          {
+//            if ( LOBYTE(v14->field_24) != 3 )
+//              goto LABEL_130;
+//            v52 = BYTE2(v14->field_28);
+//            v53 = v51->field_40;
+//          }
+//        }
+//        v54 = v53 - v52;
+//        if ( v54 > 3 )
+//          v54 = 3;
+//        dword_4FA9B4[v13] += 5 * v54;
+//LABEL_130:
+//        v55 = v14->field_58[8];
+//        v139 = v50->field_24;
+//        v125 = v14->field_38[11];
+//        if ( v139 <= v55 + v125 )
+//          dword_4FA9B4[v13] += 9999;
+//        v137 = v50->field_28 + v139;
+//        if ( v137 <= v55 + v125 + v14->field_58[6] + v14->field_58[7] + v40 + v14->field_38[10] )
+//          dword_4FA9B4[v13] += 9999;
+//        if ( v14->field_48[15] + (signed int)BYTE1(v14->field_68) + v144->field_24 + v14->field_48[4] + v148 >= dword_4E1884 )
+//          dword_4FA9B4[v13] += 9999;
+//        ++v131;
+//        if ( v131 >= v135 )
+//        {
+//          v9 = v129;
+//          goto LABEL_138;
+//        }
+//      }
+//      v12 = 99;
+//LABEL_97:
+//      v40 = v138;
+//      dword_4FA9B4[v13] = v42 + v144->field_2C - v142->field_2C;
+//      goto LABEL_98;
+//    }
+//LABEL_138:
+//    v56 = v135 - 1;
+//    for ( l = v135 - 1; l >= 0; --l )
+//    {
+//      v137 = 0;
+//      if ( l > 0 )
+//      {
+//        v58 = (int)dword_4FA9B0;
+//        v132 = l;
+//        v137 = l;
+//        do
+//        {
+//          if ( *(unsigned int *)(v58 + 4) < *(unsigned int *)(v58 + 12) )
+//          {
+//            v59 = *(unsigned int *)v58;
+//            v60 = *(unsigned int *)(v58 + 4);
+//            *(unsigned int *)v58 = *(unsigned int *)(v58 + 8);
+//            v61 = *(unsigned int *)(v58 + 12);
+//            *(unsigned int *)(v58 + 8) = v59;
+//            *(unsigned int *)(v58 + 4) = v61;
+//            v9 = v129;
+//            *(unsigned int *)(v58 + 12) = v60;
+//          }
+//          v58 += 8;
+//          --v132;
+//        }
+//        while ( v132 );
+//      }
+//    }
+//    v62 = v135 - 1;
+//    if ( am_byte_4FAA77 )
+//    {
+//      if ( v56 >= 0 )
+//      {
+//        while ( !BYTE3(pCards[stru_505708[0].cards_at_hand[47 * v9 + dword_4FA9B0[2 * v62]]].field_28) )
+//        {
+//          --v62;
+//          if ( v62 < 0 )
+//            return am_40BCFB(v9, v137) != 0;
+//        }
+//        v137 = dword_4FA9B0[2 * v62];
+//      }
+//    }
+//    else
+//    {
+//      v63 = 0;
+//      if ( v56 >= 0 )
+//      {
+//        while ( !BYTE3(pCards[stru_505708[0].cards_at_hand[47 * v9 + dword_4FA9B0[2 * v62]]].field_28) )
+//        {
+//          --v62;
+//          if ( v62 < 0 )
+//            goto LABEL_151;
+//        }
+//        v137 = dword_4FA9B0[2 * v62];
+//      }
+//LABEL_151:
+//      if ( v135 > 0 )
+//      {
+//        while ( !am_40BF15(v9, dword_4FA9B0[2 * v63]) || dword_4FA9B4[2 * v63] < 0 )
+//        {
+//          ++v63;
+//          if ( v63 >= v135 )
+//            return am_40BCFB(v9, v137) != 0;
+//        }
+//        return am_40BE0E(v9, dword_4FA9B0[2 * v63]) != 0;
+//      }
+//    }
+//    return am_40BCFB(v9, v137) != 0;
+//  }
+//  v3 = 0;
+//  v4 = a1;
+//  if ( am_byte_4FAA77 )
+//  {
+//LABEL_11:
+//    v7 = am_40BB49(v4);
+//    v8 = rand_interval(0, v7 - 1);
+//    result = am_40BCFB(v4, v8);
+//  }
+//  else
+//  {
+//    while ( 1 )
+//    {
+//      v5 = am_40BB49(v4);
+//      v6 = rand_interval(0, v5 - 1);
+//      if ( am_40BF15(v4, v6) )
+//        break;
+//      ++v3;
+//      if ( v3 >= 10 )
+//        goto LABEL_11;
+//    }
+//    result = am_40BE0E(v4, v6);
+//  }
+  return true;//result != 0;
 }
 // 408BB4: could not find valid save-restore pair for ebp
 // 4DF3A4: using guessed type int dword_4DF3A4;
@@ -1385,11 +1333,12 @@
     pArcomageGame->field_F6 = 1;
     byte_4FAA24 = 1;
     am_40A346(amuint_4FAA6C);
+    Sleep(10000);
 LABEL_8:
-    while ( byte_4FAA24 )
+   /* while ( byte_4FAA24 )
     {
       amuint_4FABC0 = -1;
-      am_40A283(amuint_4FAA6C, v0);
+      am_40A283(amuint_4FAA6C);
       while ( 1 )
       {
         byte_4FAA24 = am_40A560(amuint_4FAA6C);
@@ -1400,7 +1349,7 @@
           goto LABEL_8;
       }
       am_byte_4FAA77 = 0;
-    }
+    }*/
     pArcomageGame->field_F5 = am_40A514();
     if ( !pArcomageGame->field_F5 )
       am_40A383();
@@ -1410,23 +1359,25 @@
   am_40D444();
   if ( byte_4FAA2C )
   {
-    v2 = retzero_sub_40DFA7((int)dword_4FAA28);
-    v1 = 1000;
-    dword_4FAA70 = v2 / 1000;
+   // v2 = retzero_sub_40DFA7((int)dword_4FAA28);
+   // v1 = 1000;
+   // dword_4FAA70 = v2 / 1000;
+     dword_4FAA70 = 0;
   }
   else
   {
     dword_4FAA70 = -1;
   }
   pVideoPlayer->BinkUpdatePalette(dword_4FAA28);
-  v3 = array_4FAC10;
+
+  /*v3 = array_4FAC10;
   do
   {
     v3->ptr_0->_40E0F5(1, 1);
     v3->ptr_0->_40DFFE();
     ++v3;
   }
-  while ( (signed int)v3 < (signed int)&unk_5052C8 );
+  while ( (signed int)v3 < (signed int)&unk_5052C8 );*/
 
   pArcomageGame->pGameBackground.Release();
   pArcomageGame->pSprites.Release();
@@ -1434,13 +1385,9 @@
   viewparams->bRedrawGameUI = 1;
   if ( pVideoPlayer->AnyMovieLoaded() )
     pVideoPlayer->_4BF5B2();
-  v4 = am_sounds;
-  do
-  {
-    pSoundList->UnloadSound((unsigned __int16)*v4, 1);
-    ++v4;
-  }
-  while ( (signed int)v4 <= (signed int)&unk_4FAA20 );
+  for(int i=0; i<12; ++i)
+    pSoundList->UnloadSound(am_sounds[i], 1);
+
 }
 
 
@@ -1466,27 +1413,27 @@
     if ( v0 )
     {
       v1 = v0;
-      inv_strcpy(pArcomageGame->pPlayer2Name, stru_505708[v0].pPlayerName);
+      inv_strcpy(pArcomageGame->pPlayer2Name, am_Players[v0].pPlayerName);
       if ( byte_4E185C )
-        LOBYTE(stru_505708[v1].field_20) = 0;
+        LOBYTE(am_Players[v1].field_20) = 0;
       else
-        LOBYTE(stru_505708[v1].field_20) = 1;
+        LOBYTE(am_Players[v1].field_20) = 1;
     }
     else
     {
-      inv_strcpy(pArcomageGame->pPlayer1Name, (char *)stru_505708);
-      LOBYTE(stru_505708[0].field_20) = 1;
+      inv_strcpy(pArcomageGame->pPlayer1Name, (char *)am_Players);
+      LOBYTE(am_Players[0].field_20) = 1;
     }
-    stru_505708[v0].field_24 = amuint_4E1860;
-    stru_505708[v0].field_28 = amuint_4E1864;
-    stru_505708[v0].field_2C = amuint_4E1868;
-    stru_505708[v0].field_30 = amuint_4E186C;
-    stru_505708[v0].field_34 = amuint_4E1870;
-    stru_505708[v0].field_38 = amuint_505884;
-    stru_505708[v0].field_3C = amuint_505888;
-    stru_505708[v0].field_40 = amuint_50588C;
-    v2 = &stru_505708[v0].arr_6C[0][1];
-    v3 = stru_505708[v0].arr_44;
+    am_Players[v0].field_24 = amuint_4E1860;
+    am_Players[v0].field_28 = amuint_4E1864;
+    am_Players[v0].field_2C = amuint_4E1868;
+    am_Players[v0].field_30 = amuint_4E186C;
+    am_Players[v0].field_34 = amuint_4E1870;
+    am_Players[v0].field_38 = amuint_505884;
+    am_Players[v0].field_3C = amuint_505888;
+    am_Players[v0].field_40 = amuint_50588C;
+    v2 = &am_Players[v0].arr_6C[0][1];
+    v3 = am_Players[v0].cards_at_hand;
     v4 = 10;
     do
     {
@@ -1581,7 +1528,7 @@
   ArcomageGame::PlaySound(0x14u);
   memset(byte_5054E8, 0, sizeof(byte_5054E8));
   memset(v9, 0, sizeof(v9));
-  v0 = stru_505708[0].arr_44;//variable incorrect
+  v0 = am_Players[0].cards_at_hand;//variable incorrect
   do
   {
     v1 = v0;
@@ -1635,27 +1582,22 @@
 // 40A198: using guessed type char var_6C[108];
 
 //----- (0040A255) --------------------------------------------------------
-int __fastcall am_40A255(int a1, int a2)
-{
-  int i; // edi@1
-  signed int v3; // esi@2
-  int result; // eax@3
-
-  for ( i = 0; i < dword_4E1874; ++i )
+void am_40A255()
+    {
+
+  for (int i = 0; i < dword_4E1874; ++i )
   {
-    v3 = 0;
-    do
-      result = am_40A283(v3++, a2);
-    while ( v3 < 2 );
+      am_40A283(0);
+      am_40A283(1);
   }
   pArcomageGame->field_F6 = 1;
-  return result;
+
 }
 // 4E1874: using guessed type int dword_4E1874;
 
 //----- (0040A283) --------------------------------------------------------
-signed int __fastcall am_40A283(int a1, int a2)
-{
+void am_40A283( int a1 )
+    {
   signed int v2; // eax@1
   int v3; // edi@1
   int v4; // esi@1
@@ -1688,15 +1630,15 @@
   if ( result != -1 )
   {
     amuint_4FAA4C = result;
-    stru_505708[0].arr_44[result + 47 * v4] = v3;
+    am_Players[0].cards_at_hand[result + 47 * v4] = v3;
     v7 = 188 * v4 + 8 * result;
-    *(int *)((char *)stru_505708[0].arr_6C[0] + v7) = rand_interval(-4, 4);
+    *(int *)((char *)am_Players[0].arr_6C[0] + v7) = rand_interval(-4, 4);
     result = rand_interval(-4, 4);
-    *(int *)((char *)&stru_505708[0].arr_6C[0][1] + v7) = result;
+    *(int *)((char *)&am_Players[0].arr_6C[0][1] + v7) = result;
     pArcomageGame->field_F6 = 1;
     byte_4FAA2D = 1;
   }
-  return result;
+
 }
 // 4FAA2D: using guessed type char byte_4FAA2D;
 // 4FAA4C: using guessed type int amuint_4FAA4C;
@@ -1712,7 +1654,7 @@
 
   result = -1;
   v2 = 0;
-  v3 = (char *)stru_505708[a1].arr_44;
+  v3 = (char *)am_Players[a1].cards_at_hand;
   while ( *(unsigned int *)v3 != -1 )
   {
     ++v2;
@@ -1724,21 +1666,16 @@
 }
 
 //----- (0040A346) --------------------------------------------------------
-int __fastcall am_40A346(int a1)
-{
+void am_40A346( int player_num )
+    {
   int v1; // ecx@1
-  int result; // eax@1
-
-  v1 = a1;
-  stru_505708[v1].field_38 += dword_4E1878 + stru_505708[v1].field_2C;
-  stru_505708[v1].field_3C += dword_4E187C + stru_505708[v1].field_30;
-  result = dword_4E1880 + stru_505708[v1].field_34;
-  stru_505708[v1].field_40 += result;
-  return result;
+
+  v1 = player_num;
+  am_Players[v1].field_38 += dword_4E1878 + am_Players[v1].field_2C;
+  am_Players[v1].field_3C += dword_4E187C + am_Players[v1].field_30;
+  am_Players[v1].field_40 += dword_4E1880 + am_Players[v1].field_34;
 }
-// 4E1878: using guessed type int dword_4E1878;
-// 4E187C: using guessed type int dword_4E187C;
-// 4E1880: using guessed type int dword_4E1880;
+
 
 //----- (0040A383) --------------------------------------------------------
 void __cdecl am_40A383()
@@ -1758,7 +1695,7 @@
 
   if ( !pArcomageGame->field_F4 )
   {
-    if ( LOBYTE(stru_505708[0].field_20) != 1 || LOBYTE(stru_505708[1].field_20) != 1 )
+    if ( LOBYTE(am_Players[0].field_20) != 1 || LOBYTE(am_Players[1].field_20) != 1 )
     {
       ++amuint_4FAA6C;
       am_byte_4FAA75 = 1;
@@ -1774,7 +1711,7 @@
       v0 = 0;
       v11[1] = 200;
       v11[0] = 320 - 12 * v0 / 2;
-      pPrimaryWindow_draws_text(-1, Dest, v11);
+    //  pPrimaryWindow_draws_text(-1, Dest, v11);
       am_byte_4FAA75 = 1;
       v1 = amuint_4FAA6C + 1;
       v3 = __OFSUB__(amuint_4FAA6C + 1, 2);
@@ -1784,11 +1721,11 @@
         v1 = 0;
         amuint_4FAA6C = 0;
       }
-      inv_strcpy(stru_505708[v1].pPlayerName, Dest);
+      inv_strcpy(am_Players[v1].pPlayerName, Dest);
       v4 = 0;
       v11[1] = 260;
       v11[0] = 320 - 12 * v4 / 2;
-      pPrimaryWindow_draws_text(-1, Dest, v11);
+     // pPrimaryWindow_draws_text(-1, Dest, v11);
       v6 = 0;
       v8 = 640;
       v7 = 0;
@@ -1833,26 +1770,23 @@
 
 
 //----- (0040A514) --------------------------------------------------------
-bool __cdecl am_40A514()
-{
+bool am_40A514()
+    {
   bool result; // eax@1
-  char *v1; // ecx@1
-
-  LOBYTE(result) = 0;
-  v1 = (char *)&stru_505708[0].field_24;
-  do
+
+  result = false;
+  for(int i=0; i<2; ++i)
   {
-    if ( *(unsigned int *)v1 <= 0 )
-      LOBYTE(result) = 1;
-    if ( *(unsigned int *)v1 >= dword_4E1884 )
-      LOBYTE(result) = 1;
-    if ( *((unsigned int *)v1 + 5) >= dword_4E1888
-      || *((unsigned int *)v1 + 6) >= dword_4E1888
-      || *((unsigned int *)v1 + 7) >= dword_4E1888 )
-      LOBYTE(result) = 1;
-    v1 += 188;
+    if ( am_Players[i].field_24 <= 0 )
+       result  = true;
+    if ( am_Players[i].field_24 >= dword_4E1884 )
+      result  = true;
+    if (  am_Players[i].field_38 >= dword_4E1888
+      ||  am_Players[i].field_3C >= dword_4E1888
+      ||  am_Players[i].field_40 >= dword_4E1888 )
+      result  = true;
   }
-  while ( (signed int)v1 < (signed int)&pArcomageGame->stru1.field_4 );
+ 
   if ( result )
     byte_4FAA2C = 1;
   return result;
@@ -1931,7 +1865,7 @@
         break;
     }
     v4 = amuint_4FAA6C;
-    if ( LOBYTE(stru_505708[amuint_4FAA6C].field_20) != 1 && !byte_4FAA00 && !byte_4FAA2E && !byte_4FAA2D )
+    if ( LOBYTE(am_Players[amuint_4FAA6C].field_20) != 1 && !byte_4FAA00 && !byte_4FAA2E && !byte_4FAA2D )
     {
       if ( am_byte_4FAA75 )
         am_byte_4FAA76 = 1;
@@ -1941,7 +1875,7 @@
     }
     if ( amuint_4FAA4C != -1 && amuint_4FAA38 > 10 )
       amuint_4FAA38 = 10;
-    if ( byte_4FAA2E || byte_4FAA2D || LOBYTE(stru_505708[v4].field_20) != 1 )
+    if ( byte_4FAA2E || byte_4FAA2D || LOBYTE(am_Players[v4].field_20) != 1 )
     {
       pArcomageGame->field_F6 = 1;
       if ( byte_4FAA2D )
@@ -2076,7 +2010,7 @@
       pSrcXYZW[1] = 0;
       pSrcXYZW[3] = 480;
       am_BeginScene(pArcomageGame->pBackgroundPixels, -1, 1);
-      Blt_Copy((ArcomageRect *)pSrcXYZW, pTargetXY, 2);
+    //  Blt_Copy(pSrcXYZW, pTargetXY, 2);
       am_EndScene();
       am_blts(v13);
       pRenderer->Present();
@@ -2188,7 +2122,7 @@
             v8 = v6 + 2;
             v7 = v4[1];
             v9 = v7 + 2;
-            DrawRect((Vec4_int_ *)&v6, v10, 1);
+           // DrawRect(&v6, v10, 1);
           }
         }
         ++v3;
@@ -2204,61 +2138,60 @@
 //----- (0040AB0A) --------------------------------------------------------
 void __cdecl am_chroma_blts()
 {
-  int v0; // eax@1
-  int v1; // eax@1
-  int v2; // eax@1
-  int v3; // eax@1
-  int v4; // eax@1
-  int v5; // eax@1
-  int pSrcXYZW[4]; // [sp+Ch] [bp-18h]@1
-  int pTargetXY[2]; // [sp+1Ch] [bp-8h]@1
-
-  pSrcXYZW[1] = 0;
-  pSrcXYZW[0] = 765;
-  pSrcXYZW[2] = 843;
-  pSrcXYZW[3] = 216;
-  pTargetXY[0] = 8;
-  pTargetXY[1] = 56;
-  Blt_Copy((ArcomageRect *)pSrcXYZW, pTargetXY, 2);
-  pTargetXY[0] = 555;
-  pTargetXY[1] = 56;
-  Blt_Copy((ArcomageRect *)pSrcXYZW, pTargetXY, 2);
-  LOWORD(v0) = pArcomageGame->field_54;
-  pTargetXY[0] = 8;
-  pSrcXYZW[0] = 283;
-  pSrcXYZW[2] = 361;
-  pSrcXYZW[1] = 166;
-  pSrcXYZW[3] = 190;
-  pTargetXY[1] = 13;
-  Blt_Chroma((ArcomageRect *)pSrcXYZW, pTargetXY, v0, 2);
-  LOWORD(v1) = pArcomageGame->field_54;
-  pTargetXY[0] = 555;
-  pTargetXY[1] = 13;
-  Blt_Chroma((ArcomageRect *)pSrcXYZW, pTargetXY, v1, 2);
-  LOWORD(v2) = pArcomageGame->field_54;
-  pSrcXYZW[0] = 234;
-  pSrcXYZW[2] = 283;
-  pSrcXYZW[1] = 166;
-  pSrcXYZW[3] = 190;
-  pTargetXY[0] = 100;
-  pTargetXY[1] = 296;
-  Blt_Chroma((ArcomageRect *)pSrcXYZW, pTargetXY, v2, 2);
-  LOWORD(v3) = pArcomageGame->field_54;
-  pTargetXY[0] = 492;
-  pTargetXY[1] = 296;
-  Blt_Chroma((ArcomageRect *)pSrcXYZW, pTargetXY, v3, 2);
-  LOWORD(v4) = pArcomageGame->field_54;
-  pSrcXYZW[0] = 192;
-  pSrcXYZW[2] = 234;
-  pSrcXYZW[1] = 166;
-  pSrcXYZW[3] = 190;
-  pTargetXY[0] = 168;
-  pTargetXY[1] = 296;
-  Blt_Chroma((ArcomageRect *)pSrcXYZW, pTargetXY, v4, 2);
-  pTargetXY[0] = 430;
-  LOWORD(v5) = pArcomageGame->field_54;
-  pTargetXY[1] = 296;
-  Blt_Chroma((ArcomageRect *)pSrcXYZW, pTargetXY, v5, 2);
+ 
+  RECT pSrcRect; // [sp+Ch] [bp-18h]@1
+  POINT pTargetXY; // [sp+1Ch] [bp-8h]@1
+
+  pSrcRect.top     = 0;
+  pSrcRect.left    = 765;
+  pSrcRect.right   = 843;
+  pSrcRect.bottom  = 216;
+
+  pTargetXY.x = 8;
+  pTargetXY.y = 56;
+  Blt_Copy(&pSrcRect, &pTargetXY, 2);
+
+  pTargetXY.x = 555;
+  pTargetXY.y = 56;
+  Blt_Copy(&pSrcRect, &pTargetXY, 2);
+
+  pSrcRect.left   = 283;
+  pSrcRect.right  = 361;
+  pSrcRect.top    = 166;
+  pSrcRect.bottom = 190;
+  pTargetXY.x = 8;
+  pTargetXY.y = 13;
+  Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
+
+  pTargetXY.x = 555;
+  pTargetXY.y = 13;
+  Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
+
+  pSrcRect.left   = 234;
+  pSrcRect.right  = 283;
+  pSrcRect.top    = 166;
+  pSrcRect.bottom = 190;
+  pTargetXY.x = 100;
+  pTargetXY.y = 296;
+  Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
+
+
+  pTargetXY.x = 492;
+  pTargetXY.y = 296;
+  Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
+
+
+  pSrcRect.left   = 192;
+  pSrcRect.right  = 234;
+  pSrcRect.top    = 166;
+  pSrcRect.bottom = 190;
+  pTargetXY.x = 168;
+  pTargetXY.y = 296;
+  Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
+
+  pTargetXY.x = 430;
+  pTargetXY.y = 296;
+  Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
 }
 
 //----- (0040AC5F) --------------------------------------------------------
@@ -2276,115 +2209,132 @@
   int v9; // ecx@18
   int v10; // eax@20
   char Dest[32]; // [sp+Ch] [bp-28h]@2
-  int v12[2]; // [sp+2Ch] [bp-8h]@2
+  POINT v12; // [sp+2Ch] [bp-8h]@2
 
   if ( am_byte_4FAA77 )
   {
     inv_strcpy(pGlobalTXT_LocalizationStrings[266], Dest);// DISCARD A CARD
-    v12[0] = 320 - pArcomageGame->pFont2->GetLineWidth(Dest) / 2;
-    v12[1] = 306;
-    pPrimaryWindow_draws_text(-1, Dest, v12);
+    v12.x = 320 - pArcomageGame->pfntArrus->GetLineWidth(Dest) / 2;
+    v12.y = 306;
+    pPrimaryWindow_draws_text(-1, Dest, &v12);
   }
-  inv_strcpy((const char *)stru_505708, Dest);
+  inv_strcpy(am_Players[0].pPlayerName, Dest);
   if ( !amuint_4FAA6C )
     inv_strcat("***", Dest);
-  v12[0] = 47 - pArcomageGame->pFont1->GetLineWidth(Dest) / 2;
-  v12[1] = 21;
-  pPrimaryWindow_draws_text(-1, Dest, v12);
-  inv_strcpy(stru_505708[1].pPlayerName, Dest);
+  v12.x = 47 - pArcomageGame->pfntComic->GetLineWidth(Dest) / 2;
+  v12.y = 21;
+  pPrimaryWindow_draws_text(-1, Dest, &v12);
+
+  inv_strcpy(am_Players[1].pPlayerName, Dest);
   if ( amuint_4FAA6C == 1 )
     inv_strcat("***", Dest);
-  v12[0] = 595 - pArcomageGame->pFont1->GetLineWidth(Dest) / 2;
-  v12[1] = 21;
-  pPrimaryWindow_draws_text(-1, Dest, v12);
-  intToString(stru_505708[0].field_24, Dest);
-  v12[0] = 123 - pArcomageGame->pFont1->GetLineWidth(Dest) / 2;
-  v12[1] = 305;
-  pPrimaryWindow_draws_text(-1, Dest, v12);
-  intToString(stru_505708[1].field_24, Dest);
-  v12[0] = 515 - pArcomageGame->pFont1->GetLineWidth(Dest) / 2;
-  v12[1] = 305;
-  pPrimaryWindow_draws_text(-1, Dest, v12);
-  intToString(stru_505708[0].field_28, Dest);
-  v12[0] = 188 - pArcomageGame->pFont1->GetLineWidth(Dest) / 2;
-  v12[1] = 305;
-  pPrimaryWindow_draws_text(-1, Dest, v12);
-  intToString(stru_505708[1].field_28, Dest);
-  v12[0] = 451 - pArcomageGame->pFont1->GetLineWidth(Dest) / 2;
-  v12[1] = 305;
-  pPrimaryWindow_draws_text(-1, Dest, v12);
-  v0 = stru_505708[0].field_2C;
+  v12.x = 595 - pArcomageGame->pfntComic->GetLineWidth(Dest) / 2;
+  v12.y = 21;
+  pPrimaryWindow_draws_text(-1, Dest, &v12);
+
+  intToString(am_Players[0].field_24, Dest);
+  v12.x = 123 - pArcomageGame->pfntComic->GetLineWidth(Dest) / 2;
+  v12.y = 305;
+  pPrimaryWindow_draws_text(-1, Dest, &v12);
+
+  intToString(am_Players[1].field_24, Dest);
+  v12.x = 515 - pArcomageGame->pfntComic->GetLineWidth(Dest) / 2;
+  v12.y = 305;
+  pPrimaryWindow_draws_text(-1, Dest, &v12);
+
+  intToString(am_Players[0].field_28, Dest);
+  v12.x = 188 - pArcomageGame->pfntComic->GetLineWidth(Dest) / 2;
+  v12.y = 305;
+  pPrimaryWindow_draws_text(-1, Dest, &v12);
+
+  intToString(am_Players[1].field_28, Dest);
+  v12.x = 451 - pArcomageGame->pfntComic->GetLineWidth(Dest) / 2;
+  v12.y = 305;
+  pPrimaryWindow_draws_text(-1, Dest, &v12);
+
+  v0 = am_Players[0].field_2C;
   if ( byte_4E185E )
-    v0 = dword_4E1878 + stru_505708[0].field_2C;
+    v0 = dword_4E1878 + am_Players[0].field_2C;
   intToString(v0, Dest);
-  v12[0] = 14 - 6 * 0 / 2;
-  v12[1] = 92;
-  am_40B102(-1, Dest, v12);
-  v1 = stru_505708[1].field_2C;
+  v12.x = 14 - 6 * 0 / 2;
+  v12.y = 92;
+  am_40B102(-1, Dest, &v12);
+
+  v1 = am_Players[1].field_2C;
   if ( byte_4E185E )
-    v1 = dword_4E1878 + stru_505708[1].field_2C;
+    v1 = dword_4E1878 + am_Players[1].field_2C;
   intToString(v1, Dest);
   v2 = 0;
-  v12[1] = 92;
-  v12[0] = 561 - 6 * v2 / 2;
-  am_40B102(-1, Dest, v12);
+  v12.y = 92;
+  v12.x = 561 - 6 * v2 / 2;
+  am_40B102(-1, Dest, &v12);
+
   if ( byte_4E185E )
-    v3 = stru_505708[0].field_30 + dword_4E187C;
+    v3 = am_Players[0].field_30 + dword_4E187C;
   else
-    v3 = stru_505708[0].field_30;
+    v3 = am_Players[0].field_30;
   intToString(v3, Dest);
   v4 = 0;
-  v12[1] = 164;
-  v12[0] = 14 - 6 * v4 / 2;
-  am_40B102(-1, Dest, v12);
-  v5 = stru_505708[1].field_30;
+  v12.y = 164;
+  v12.x = 14 - 6 * v4 / 2;
+  am_40B102(-1, Dest, &v12);
+
+  v5 = am_Players[1].field_30;
   if ( byte_4E185E )
-    v5 = dword_4E187C + stru_505708[1].field_30;
+    v5 = dword_4E187C + am_Players[1].field_30;
   intToString(v5, Dest);
   v6 = 0;
-  v12[1] = 164;
-  v12[0] = 561 - 6 * v6 / 2;
-  am_40B102(-1, Dest, v12);
-  v7 = stru_505708[0].field_34;
+  v12.y = 164;
+  v12.x = 561 - 6 * v6 / 2;
+  am_40B102(-1, Dest, &v12);
+
+  v7 = am_Players[0].field_34;
   if ( byte_4E185E )
-    v7 = dword_4E1880 + stru_505708[0].field_34;
+    v7 = dword_4E1880 + am_Players[0].field_34;
   intToString(v7, Dest);
   v8 = 0;
-  v12[1] = 236;
-  v12[0] = 14 - 6 * v8 / 2;
-  am_40B102(-1, Dest, v12);
-  v9 = stru_505708[1].field_34;
+  v12.y = 236;
+  v12.x = 14 - 6 * v8 / 2;
+  am_40B102(-1, Dest, &v12);
+
+  v9 = am_Players[1].field_34;
   if ( byte_4E185E )
-    v9 = dword_4E1880 + stru_505708[1].field_34;
+    v9 = dword_4E1880 + am_Players[1].field_34;
   intToString(v9, Dest);
   v10 = 0;
-  v12[1] = 236;
-  v12[0] = 561 - 6 * v10 / 2;
-  am_40B102(-1, Dest, v12);
-  intToString(stru_505708[0].field_38, Dest);
-  v12[1] = 114;
-  v12[0] = 10;
-  am_40B17E(-1, (int)Dest, v12);
-  intToString(stru_505708[1].field_38, Dest);
-  v12[0] = 557;
-  v12[1] = 114;
-  am_40B17E(-1, (int)Dest, v12);
-  intToString(stru_505708[0].field_3C, Dest);
-  v12[0] = 10;
-  v12[1] = 186;
-  am_40B1F3(-1, (int)Dest, (int)v12);
-  intToString(stru_505708[1].field_3C, Dest);
-  v12[0] = 557;
-  v12[1] = 186;
-  am_40B1F3(-1, (int)Dest, (int)v12);
-  intToString(stru_505708[0].field_40, Dest);
-  v12[0] = 10;
-  v12[1] = 258;
-  am_40B268(-1, Dest, v12);
-  intToString(stru_505708[1].field_40, Dest);
-  v12[0] = 557;
-  v12[1] = 258;
-  am_40B268(-1, Dest, v12);
+  v12.y = 236;
+  v12.x = 561 - 6 * v10 / 2;
+  am_40B102(-1, Dest, &v12);
+
+  intToString(am_Players[0].field_38, Dest);
+  v12.y = 114;
+  v12.x = 10;
+  am_40B17E(-1, Dest, &v12);
+
+  intToString(am_Players[1].field_38, Dest);
+  v12.x = 557;
+  v12.y = 114;
+  am_40B17E(-1, Dest, &v12);
+
+  intToString(am_Players[0].field_3C, Dest);
+  v12.x = 10;
+  v12.y = 186;
+  am_40B1F3(-1, Dest, &v12);
+
+  intToString(am_Players[1].field_3C, Dest);
+  v12.x = 557;
+  v12.y = 186;
+  am_40B1F3(-1, Dest, &v12);
+
+  intToString(am_Players[0].field_40, Dest);
+  v12.x = 10;
+  v12.y = 258;
+  am_40B268(-1, Dest, &v12);
+
+  intToString(am_Players[1].field_40, Dest);
+  v12.x = 557;
+  v12.y = 258;
+  am_40B268(-1, Dest, &v12);
 }
 // 4E185E: using guessed type char byte_4E185E;
 // 4E1878: using guessed type int dword_4E1878;
@@ -2393,441 +2343,441 @@
 // 4FAA77: using guessed type char am_byte_4FAA77;
 
 //----- (0040B102) --------------------------------------------------------
-void __fastcall am_40B102(int a1, char *a2, int *pXY)
-{
-  char *v3; // esi@1
-  int v4; // eax@1
-  unsigned __int8 v5; // bl@2
-  char v6; // zf@2
-  int v7; // eax@3
-  int v8; // ecx@3
-  int v9; // [sp+8h] [bp-18h]@3
-  int v10; // [sp+Ch] [bp-14h]@3
-  int v11; // [sp+10h] [bp-10h]@3
-  int v12; // [sp+14h] [bp-Ch]@3
-  int v13; // [sp+18h] [bp-8h]@1
-  int v14; // [sp+1Ch] [bp-4h]@1
-
-  v3 = a2;
-  am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1);
-  v4 = pXY[1];
-  v13 = *pXY;
-  v14 = v4;
-  do
-  {
-    v5 = *v3++;
-    v6 = v5 == 0;
-    if ( v5 )
+void __fastcall am_40B102( int a1, char *a2, POINT *pXY )
     {
-      v7 = 22 * v5;
-      v8 = v7 - 864;
-      v7 -= 842;
-      v11 = v7;
-      LOWORD(v7) = pArcomageGame->field_54;
-      v9 = v8;
-      v10 = 190;
-      v12 = 207;
-      Blt_Chroma((ArcomageRect *)&v9, &v13, v7, 1);
-      v13 += 22;
-      v6 = v5 == 0;
-    }
-  }
-  while ( !v6 );
-  am_EndScene();
+  //char *v3; // esi@1
+  //int v4; // eax@1
+  //unsigned __int8 v5; // bl@2
+  //char v6; // zf@2
+  //int v7; // eax@3
+  //int v8; // ecx@3
+  //int v9; // [sp+8h] [bp-18h]@3
+  //int v10; // [sp+Ch] [bp-14h]@3
+  //int v11; // [sp+10h] [bp-10h]@3
+  //int v12; // [sp+14h] [bp-Ch]@3
+  //int v13; // [sp+18h] [bp-8h]@1
+  //int v14; // [sp+1Ch] [bp-4h]@1
+
+  //v3 = a2;
+  //am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1);
+  //v4 = pXY[1];
+  //v13 = *pXY;
+  //v14 = v4;
+  //do
+  //{
+  //  v5 = *v3++;
+  //  v6 = v5 == 0;
+  //  if ( v5 )
+  //  {
+  //    v7 = 22 * v5;
+  //    v8 = v7 - 864;
+  //    v7 -= 842;
+  //    v11 = v7;
+  //    LOWORD(v7) = pArcomageGame->field_54;
+  //    v9 = v8;
+  //    v10 = 190;
+  //    v12 = 207;
+  //    Blt_Chroma(&v9, &v13, v7, 1);
+  //    v13 += 22;
+  //    v6 = v5 == 0;
+  //  }
+  //}
+  //while ( !v6 );
+  //am_EndScene();
 }
 
 //----- (0040B17E) --------------------------------------------------------
-void __fastcall am_40B17E(int a1, int a2, int *pXY)
-{
-  int v3; // esi@1
-  int v4; // eax@1
-  unsigned __int8 v5; // bl@2
-  char v6; // zf@2
-  int v7; // eax@3
-  int v8; // [sp+8h] [bp-18h]@3
-  int v9; // [sp+Ch] [bp-14h]@3
-  int v10; // [sp+10h] [bp-10h]@3
-  int v11; // [sp+14h] [bp-Ch]@3
-  int v12; // [sp+18h] [bp-8h]@1
-  int v13; // [sp+1Ch] [bp-4h]@1
-
-  v3 = a2;
-  am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1);
-  v4 = pXY[1];
-  v12 = *pXY;
-  v13 = v4;
-  do
-  {
-    v5 = *(unsigned char *)v3++;
-    v6 = v5 == 0;
-    if ( v5 )
+void am_40B17E( int a1, char* a2, POINT *pXY )
     {
-      v7 = 13 * v5;
-      v8 = v7 - 370;
-      v10 = v7 - 357;
-      v9 = 128;
-      v11 = 138;
-      Blt_Copy((ArcomageRect *)&v8, &v12, 2);
-      v12 += 13;
-      v6 = v5 == 0;
-    }
-  }
-  while ( !v6 );
-  am_EndScene();
+  //int v3; // esi@1
+  //int v4; // eax@1
+  //unsigned __int8 v5; // bl@2
+  //char v6; // zf@2
+  //int v7; // eax@3
+  //int v8; // [sp+8h] [bp-18h]@3
+  //int v9; // [sp+Ch] [bp-14h]@3
+  //int v10; // [sp+10h] [bp-10h]@3
+  //int v11; // [sp+14h] [bp-Ch]@3
+  //int v12; // [sp+18h] [bp-8h]@1
+  //int v13; // [sp+1Ch] [bp-4h]@1
+
+  //v3 = a2;
+  //am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1);
+  //v4 = pXY[1];
+  //v12 = *pXY;
+  //v13 = v4;
+  //do
+  //{
+  //  v5 = *(unsigned char *)v3++;
+  //  v6 = v5 == 0;
+  //  if ( v5 )
+  //  {
+  //    v7 = 13 * v5;
+  //    v8 = v7 - 370;
+  //    v10 = v7 - 357;
+  //    v9 = 128;
+  //    v11 = 138;
+  //    Blt_Copy(&v8, &v12, 2);
+  //    v12 += 13;
+  //    v6 = v5 == 0;
+  //  }
+  //}
+  //while ( !v6 );
+  //am_EndScene();
 }
 
 //----- (0040B1F3) --------------------------------------------------------
-void __fastcall am_40B1F3(int a1, int a2, int a3)
-{
-  int v3; // esi@1
-  int v4; // eax@1
-  unsigned __int8 v5; // bl@2
-  char v6; // zf@2
-  int v7; // eax@3
-  int v8; // [sp+8h] [bp-18h]@3
-  int v9; // [sp+Ch] [bp-14h]@3
-  int v10; // [sp+10h] [bp-10h]@3
-  int v11; // [sp+14h] [bp-Ch]@3
-  int v12; // [sp+18h] [bp-8h]@1
-  int v13; // [sp+1Ch] [bp-4h]@1
-
-  v3 = a2;
-  am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1);
-  v4 = *(unsigned int *)(a3 + 4);
-  v12 = *(unsigned int *)a3;
-  v13 = v4;
-  do
-  {
-    v5 = *(unsigned char *)v3++;
-    v6 = v5 == 0;
-    if ( v5 )
+void am_40B1F3( int a1, char* a2, POINT* a3 )
     {
-      v7 = 13 * v5;
-      v8 = v7 - 370;
-      v10 = v7 - 357;
-      v9 = 138;
-      v11 = 148;
-      Blt_Copy((ArcomageRect *)&v8, &v12, 2);
-      v12 += 13;
-      v6 = v5 == 0;
-    }
-  }
-  while ( !v6 );
-  am_EndScene();
+  //int v3; // esi@1
+  //int v4; // eax@1
+  //unsigned __int8 v5; // bl@2
+  //char v6; // zf@2
+  //int v7; // eax@3
+  //int v8; // [sp+8h] [bp-18h]@3
+  //int v9; // [sp+Ch] [bp-14h]@3
+  //int v10; // [sp+10h] [bp-10h]@3
+  //int v11; // [sp+14h] [bp-Ch]@3
+  //int v12; // [sp+18h] [bp-8h]@1
+  //int v13; // [sp+1Ch] [bp-4h]@1
+
+  //v3 = a2;
+  //am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1);
+  //v4 = *(unsigned int *)(a3 + 4);
+  //v12 = *(unsigned int *)a3;
+  //v13 = v4;
+  //do
+  //{
+  //  v5 = *(unsigned char *)v3++;
+  //  v6 = v5 == 0;
+  //  if ( v5 )
+  //  {
+  //    v7 = 13 * v5;
+  //    v8 = v7 - 370;
+  //    v10 = v7 - 357;
+  //    v9 = 138;
+  //    v11 = 148;
+  //    Blt_Copy(&v8, &v12, 2);
+  //    v12 += 13;
+  //    v6 = v5 == 0;
+  //  }
+  //}
+  //while ( !v6 );
+  //am_EndScene();
 }
 
 //----- (0040B268) --------------------------------------------------------
-void __fastcall am_40B268(int a1, char *a2, int *pXY)
-{
-  char *v3; // esi@1
-  int v4; // eax@1
-  unsigned __int8 v5; // bl@2
-  char v6; // zf@2
-  int v7; // eax@3
-  int v8; // [sp+8h] [bp-18h]@3
-  int v9; // [sp+Ch] [bp-14h]@3
-  int v10; // [sp+10h] [bp-10h]@3
-  int v11; // [sp+14h] [bp-Ch]@3
-  int v12; // [sp+18h] [bp-8h]@1
-  int v13; // [sp+1Ch] [bp-4h]@1
-
-  v3 = a2;
-  am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1);
-  v4 = pXY[1];
-  v12 = *pXY;
-  v13 = v4;
-  do
-  {
-    v5 = *v3++;
-    v6 = v5 == 0;
-    if ( v5 )
+void am_40B268( int a1, char *a2, POINT *pXY )
     {
-      v7 = 13 * v5;
-      v8 = v7 - 370;
-      v10 = v7 - 357;
-      v9 = 148;
-      v11 = 158;
-      Blt_Copy((ArcomageRect *)&v8, &v12, 2);
-      v12 += 13;
-      v6 = v5 == 0;
-    }
-  }
-  while ( !v6 );
-  am_EndScene();
+  //char *v3; // esi@1
+  //int v4; // eax@1
+  //unsigned __int8 v5; // bl@2
+  //char v6; // zf@2
+  //int v7; // eax@3
+  //int v8; // [sp+8h] [bp-18h]@3
+  //int v9; // [sp+Ch] [bp-14h]@3
+  //int v10; // [sp+10h] [bp-10h]@3
+  //int v11; // [sp+14h] [bp-Ch]@3
+  //int v12; // [sp+18h] [bp-8h]@1
+  //int v13; // [sp+1Ch] [bp-4h]@1
+
+  //v3 = a2;
+  //am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1);
+  //v4 = pXY[1];
+  //v12 = *pXY;
+  //v13 = v4;
+  //do
+  //{
+  //  v5 = *v3++;
+  //  v6 = v5 == 0;
+  //  if ( v5 )
+  //  {
+  //    v7 = 13 * v5;
+  //    v8 = v7 - 370;
+  //    v10 = v7 - 357;
+  //    v9 = 148;
+  //    v11 = 158;
+  //    Blt_Copy(&v8, &v12, 2);
+  //    v12 += 13;
+  //    v6 = v5 == 0;
+  //  }
+  //}
+  //while ( !v6 );
+  //am_EndScene();
 }
 
 //----- (0040B2DD) --------------------------------------------------------
 void __cdecl am_chroma_and_copy_blts()
 {
-  int v0; // eax@1
-  int v1; // esi@3
-  int v2; // eax@3
-  int v3; // eax@3
-  int v4; // esi@5
-  int v5; // eax@5
-  int pSrcXYZW[4]; // [sp+0h] [bp-18h]@3
-  int v7; // [sp+4h] [bp-14h]@3
-  int v8; // [sp+8h] [bp-10h]@3
-  int v9; // [sp+Ch] [bp-Ch]@3
-  int pTargetXY[2]; // [sp+10h] [bp-8h]@3
-
-  v0 = stru_505708[0].field_24;
-  if ( stru_505708[0].field_24 > dword_4E1884 )
-    v0 = dword_4E1884;
-  v7 = 0;
-  pSrcXYZW[0] = 892;
-  v8 = 937;
-  pTargetXY[0] = 102;
-  v1 = 200 * v0 / dword_4E1884;
-  v9 = v1;
-  pTargetXY[1] = 297 - v1;
-  Blt_Copy((ArcomageRect *)pSrcXYZW, pTargetXY, 2);
-  v7 = 0;
-  v2 = 203 - v1;
-  pTargetXY[1] = 203 - v1;
-  LOWORD(v2) = pArcomageGame->field_54;
-  pSrcXYZW[0] = 384;
-  v8 = 452;
-  v9 = 94;
-  pTargetXY[0] = 91;
-  Blt_Chroma((ArcomageRect *)pSrcXYZW, pTargetXY, v2, 2);
-  v3 = stru_505708[1].field_24;
-  if ( stru_505708[1].field_24 > dword_4E1884 )
-    v3 = dword_4E1884;
-  v7 = 0;
-  pSrcXYZW[0] = 892;
-  v8 = 937;
-  pTargetXY[0] = 494;
-  v4 = 200 * v3 / dword_4E1884;
-  v9 = v4;
-  pTargetXY[1] = 297 - v4;
-  Blt_Copy((ArcomageRect *)pSrcXYZW, pTargetXY, 2);
-  LOWORD(v5) = pArcomageGame->field_54;
-  pSrcXYZW[0] = 384;
-  v8 = 452;
-  v7 = 94;
-  v9 = 188;
-  pTargetXY[0] = 483;
-  pTargetXY[1] = 203 - v4;
-  Blt_Chroma((ArcomageRect *)pSrcXYZW, pTargetXY, v5, 2);
+  //int v0; // eax@1
+  //int v1; // esi@3
+  //int v2; // eax@3
+  //int v3; // eax@3
+  //int v4; // esi@5
+  //int v5; // eax@5
+  //int pSrcXYZW[4]; // [sp+0h] [bp-18h]@3
+  //int v7; // [sp+4h] [bp-14h]@3
+  //int v8; // [sp+8h] [bp-10h]@3
+  //int v9; // [sp+Ch] [bp-Ch]@3
+  //int pTargetXY[2]; // [sp+10h] [bp-8h]@3
+
+  //v0 = stru_505708[0].field_24;
+  //if ( stru_505708[0].field_24 > dword_4E1884 )
+  //  v0 = dword_4E1884;
+  //v7 = 0;
+  //pSrcXYZW[0] = 892;
+  //v8 = 937;
+  //pTargetXY[0] = 102;
+  //v1 = 200 * v0 / dword_4E1884;
+  //v9 = v1;
+  //pTargetXY[1] = 297 - v1;
+  //Blt_Copy(pSrcXYZW, pTargetXY, 2);
+  //v7 = 0;
+  //v2 = 203 - v1;
+  //pTargetXY[1] = 203 - v1;
+  //LOWORD(v2) = pArcomageGame->field_54;
+  //pSrcXYZW[0] = 384;
+  //v8 = 452;
+  //v9 = 94;
+  //pTargetXY[0] = 91;
+  //Blt_Chroma(pSrcXYZW, pTargetXY, v2, 2);
+  //v3 = stru_505708[1].field_24;
+  //if ( stru_505708[1].field_24 > dword_4E1884 )
+  //  v3 = dword_4E1884;
+  //v7 = 0;
+  //pSrcXYZW[0] = 892;
+  //v8 = 937;
+  //pTargetXY[0] = 494;
+  //v4 = 200 * v3 / dword_4E1884;
+  //v9 = v4;
+  //pTargetXY[1] = 297 - v4;
+  //Blt_Copy(pSrcXYZW, pTargetXY, 2);
+  //LOWORD(v5) = pArcomageGame->field_54;
+  //pSrcXYZW[0] = 384;
+  //v8 = 452;
+  //v7 = 94;
+  //v9 = 188;
+  //pTargetXY[0] = 483;
+  //pTargetXY[1] = 203 - v4;
+  //Blt_Chroma(pSrcXYZW, pTargetXY, v5, 2);
 }
 // 4E1884: using guessed type int dword_4E1884;
 
 //----- (0040B400) --------------------------------------------------------
 void __cdecl am_chroma_blt()
 {
-  int v0; // eax@1
-  int v1; // eax@4
-  int v2; // ecx@4
-  int v3; // eax@5
-  int v4; // eax@8
-  int v5; // esi@8
-  int pSrcXYZW[4]; // [sp+4h] [bp-18h]@4
-  int pTargetXY[2]; // [sp+14h] [bp-8h]@4
-
-  v0 = stru_505708[0].field_28;
-  if ( stru_505708[0].field_28 <= 100 )
-  {
-    if ( stru_505708[0].field_28 <= 0 )
-      goto LABEL_5;
-  }
-  else
-  {
-    v0 = 100;
-  }
-  pSrcXYZW[1] = 0;
-  pSrcXYZW[0] = 843;
-  v1 = 200 * v0 / 100;
-  pSrcXYZW[2] = 867;
-  pTargetXY[0] = 177;
-  pSrcXYZW[3] = v1;
-  v2 = 297 - v1;
-  LOWORD(v1) = pArcomageGame->field_54;
-  pTargetXY[1] = v2;
-  Blt_Chroma((ArcomageRect *)pSrcXYZW, pTargetXY, v1, 2);
-LABEL_5:
-  v3 = stru_505708[1].field_28;
-  if ( stru_505708[1].field_28 <= 100 )
-  {
-    if ( stru_505708[1].field_28 <= 0 )
-      return;
-  }
-  else
-  {
-    v3 = 100;
-  }
-  pSrcXYZW[1] = 0;
-  pSrcXYZW[0] = 843;
-  v4 = 200 * v3 / 100;
-  pSrcXYZW[2] = 867;
-  pTargetXY[0] = 439;
-  pSrcXYZW[3] = v4;
-  v5 = 297 - v4;
-  LOWORD(v4) = pArcomageGame->field_54;
-  pTargetXY[1] = v5;
-  Blt_Chroma((ArcomageRect *)pSrcXYZW, pTargetXY, v4, 2);
+//  int v0; // eax@1
+//  int v1; // eax@4
+//  int v2; // ecx@4
+//  int v3; // eax@5
+//  int v4; // eax@8
+//  int v5; // esi@8
+//  int pSrcXYZW[4]; // [sp+4h] [bp-18h]@4
+//  int pTargetXY[2]; // [sp+14h] [bp-8h]@4
+//
+//  v0 = stru_505708[0].field_28;
+//  if ( stru_505708[0].field_28 <= 100 )
+//  {
+//    if ( stru_505708[0].field_28 <= 0 )
+//      goto LABEL_5;
+//  }
+//  else
+//  {
+//    v0 = 100;
+//  }
+//  pSrcXYZW[1] = 0;
+//  pSrcXYZW[0] = 843;
+//  v1 = 200 * v0 / 100;
+//  pSrcXYZW[2] = 867;
+//  pTargetXY[0] = 177;
+//  pSrcXYZW[3] = v1;
+//  v2 = 297 - v1;
+//  LOWORD(v1) = pArcomageGame->field_54;
+//  pTargetXY[1] = v2;
+//  Blt_Chroma(pSrcXYZW, pTargetXY, v1, 2);
+//LABEL_5:
+//  v3 = stru_505708[1].field_28;
+//  if ( stru_505708[1].field_28 <= 100 )
+//  {
+//    if ( stru_505708[1].field_28 <= 0 )
+//      return;
+//  }
+//  else
+//  {
+//    v3 = 100;
+//  }
+//  pSrcXYZW[1] = 0;
+//  pSrcXYZW[0] = 843;
+//  v4 = 200 * v3 / 100;
+//  pSrcXYZW[2] = 867;
+//  pTargetXY[0] = 439;
+//  pSrcXYZW[3] = v4;
+//  v5 = 297 - v4;
+//  LOWORD(v4) = pArcomageGame->field_54;
+//  pTargetXY[1] = v5;
+//  Blt_Chroma(pSrcXYZW, pTargetXY, v4, 2);
 }
 
 //----- (0040B4B9) --------------------------------------------------------
 void __cdecl am_40B4B9()
 {
-  int v0; // esi@1
-  int v1; // ebx@1
-  int v2; // edi@1
-  int v3; // edx@2
-  int v4; // eax@3
-  int v5; // ecx@3
-  int v6; // eax@3
-  unsigned int v7; // ecx@4
-  int v8; // eax@16
-  int v9; // ecx@16
-  int v10; // eax@16
-  signed int v11; // edi@18
-  int v12; // esi@20
-  unsigned int v13; // ecx@20
-  int v14; // eax@23
-  unsigned int v15; // eax@25
-  unsigned int v16; // ecx@25
-  int *v17; // esi@26
-  unsigned int v18; // eax@29
-  int *v19; // ecx@29
-  int v20; // ecx@31
-  int v21; // [sp-4h] [bp-2Ch]@8
-  int pSrcXYZW[4]; // [sp+Ch] [bp-1Ch]@8
-  int pTargetXY[2]; // [sp+1Ch] [bp-Ch]@1
-  int v24; // [sp+24h] [bp-4h]@1
-
-  v0 = am_40BB49(amuint_4FAA6C);
-  v1 = 0;
-  v2 = 0;
-  pTargetXY[1] = 327;
-  v24 = (640 - 96 * v0) / (v0 + 1);
-  pTargetXY[0] = (640 - 96 * v0) / (v0 + 1);
-  while ( v2 < v0 )
-  {
-    v3 = amuint_4FAA6C;
-    if ( am_byte_4E185D != (_BYTE)v1 )
-    {
-      v4 = 188 * amuint_4FAA6C + 8 * v2;
-      v5 = *(int *)((char *)stru_505708[0].arr_6C[0] + v4);
-      v6 = *(int *)((char *)&stru_505708[0].arr_6C[0][1] + v4);
-      pTargetXY[0] += v5;
-      pTargetXY[1] += v6;
-    }
-    v7 = stru_505708[0].arr_44[v2 + 47 * amuint_4FAA6C];
-    if ( v7 == -1 )
-    {
-      ++v0;
-      goto LABEL_15;
-    }
-    if ( v2 != amuint_4FAA4C )
-    {
-      if ( LOBYTE(stru_505708[amuint_4FAA6C].field_20) == (_BYTE)v1 && byte_505881 == (_BYTE)v1 )
-      {
-        pSrcXYZW[0] = 192;
-        pSrcXYZW[2] = 288;
-        pSrcXYZW[1] = v1;
-        pSrcXYZW[3] = 128;
-        v21 = 2;
-LABEL_12:
-        Blt_Copy((ArcomageRect *)pSrcXYZW, pTargetXY, v21);
-        goto LABEL_13;
-      }
-      ArcomageGame::GetCardRect(v7, (ArcomageRect *)pSrcXYZW);
-      if ( !am_40BF15(amuint_4FAA6C, v2) )
-      {
-        v1 = 0;
-        v21 = 0;
-        goto LABEL_12;
-      }
-      Blt_Copy((ArcomageRect *)pSrcXYZW, pTargetXY, 2);
-      v1 = 0;
-    }
-LABEL_13:
-    v3 = amuint_4FAA6C;
-    pTargetXY[0] += v24 + 96;
-LABEL_15:
-    if ( am_byte_4E185D != (_BYTE)v1 )
-    {
-      v8 = 188 * v3 + 8 * v2;
-      v9 = *(int *)((char *)stru_505708[0].arr_6C[0] + v8);
-      v10 = *(int *)((char *)&stru_505708[0].arr_6C[0][1] + v8);
-      pTargetXY[0] -= v9;
-      pTargetXY[1] -= v10;
-    }
-    ++v2;
-  }
-  v11 = 0;
-  do
-  {
-    if ( am_byte_4FAA76 == (_BYTE)v1 )
-    {
-      v12 = 4 * v11;
-      v13 = amuint_4FAA78[8 * v11];
-      if ( v13 != -1 )
-      {
-        ArcomageGame::GetCardRect(v13, (ArcomageRect *)pSrcXYZW);
-        Blt_Copy((ArcomageRect *)pSrcXYZW, amuint_4FAA90[v12], v1);
-      }
-      if ( am_byte_4FAA7C[v12 * 8] != (_BYTE)v1 )
-      {
-        pTargetXY[0] = amuint_4FAA90[v12][0] + 12;
-        v14 = amuint_4FAA90[v12][1] + 40;
-        pTargetXY[1] = amuint_4FAA90[v12][1] + 40;
-        LOWORD(v14) = pArcomageGame->field_54;
-        pSrcXYZW[0] = 843;
-        pSrcXYZW[2] = 916;
-        pSrcXYZW[1] = 200;
-        pSrcXYZW[3] = 216;
-        Blt_Chroma((ArcomageRect *)pSrcXYZW, pTargetXY, v14, 2);
-      }
-    }
-    else
-    {
-      if ( amuint_4FAA34 <= v1 )
-      {
-        if ( v11 == 9 )
-        {
-          am_byte_4FAA76 = v1;
-          am_byte_4FAA75 = v1;
-          amuint_4FAA34 = 5;
-        }
-        v18 = 32 * v11;
-        v19 = &amuint_4FAA78[8 * v11];
-        if ( *v19 != -1 )
-          amuint_4FABC4 = *v19;
-        *v19 = -1;
-        amuint_4FAA90[v18 / 8][0] = amuint_4FAA80[v18 / 4];
-        v20 = amuint_4FAA84[v18 / 4];
-        am_byte_4FAA7C[v18] = v1;
-        amuint_4FAA90[v18 / 8][1] = v20;
-      }
-      else
-      {
-        v15 = 32 * v11;
-        v16 = amuint_4FAA78[8 * v11];
-        if ( v16 != -1 )
-        {
-          v17 = amuint_4FAA90[v15 / 8];
-          *v17 += amuint_4FAA88[v15 / 4];
-          amuint_4FAA90[v15 / 8][1] += amuint_4FAA8C[v15 / 4];
-          ArcomageGame::GetCardRect(v16, (ArcomageRect *)pSrcXYZW);
-          Blt_Copy((ArcomageRect *)pSrcXYZW, v17, v1);
-        }
-      }
-    }
-    ++v11;
-  }
-  while ( v11 < 10 );
-  if ( am_byte_4FAA76 != (_BYTE)v1 )
-    --amuint_4FAA34;
-  pSrcXYZW[0] = 192;
-  pSrcXYZW[2] = 288;
-  pSrcXYZW[1] = v1;
-  pSrcXYZW[3] = 128;
-  pTargetXY[0] = 120;
-  pTargetXY[1] = 18;
-  Blt_Copy((ArcomageRect *)pSrcXYZW, pTargetXY, v1);
+//  int v0; // esi@1
+//  int v1; // ebx@1
+//  int v2; // edi@1
+//  int v3; // edx@2
+//  int v4; // eax@3
+//  int v5; // ecx@3
+//  int v6; // eax@3
+//  unsigned int v7; // ecx@4
+//  int v8; // eax@16
+//  int v9; // ecx@16
+//  int v10; // eax@16
+//  signed int v11; // edi@18
+//  int v12; // esi@20
+//  unsigned int v13; // ecx@20
+//  int v14; // eax@23
+//  unsigned int v15; // eax@25
+//  unsigned int v16; // ecx@25
+//  int *v17; // esi@26
+//  unsigned int v18; // eax@29
+//  int *v19; // ecx@29
+//  int v20; // ecx@31
+//  int v21; // [sp-4h] [bp-2Ch]@8
+//  int pSrcXYZW[4]; // [sp+Ch] [bp-1Ch]@8
+//  int pTargetXY[2]; // [sp+1Ch] [bp-Ch]@1
+//  int v24; // [sp+24h] [bp-4h]@1
+//
+//  v0 = am_40BB49(amuint_4FAA6C);
+//  v1 = 0;
+//  v2 = 0;
+//  pTargetXY[1] = 327;
+//  v24 = (640 - 96 * v0) / (v0 + 1);
+//  pTargetXY[0] = (640 - 96 * v0) / (v0 + 1);
+//  while ( v2 < v0 )
+//  {
+//    v3 = amuint_4FAA6C;
+//    if ( am_byte_4E185D != (_BYTE)v1 )
+//    {
+//      v4 = 188 * amuint_4FAA6C + 8 * v2;
+//      v5 = *(int *)((char *)stru_505708[0].arr_6C[0] + v4);
+//      v6 = *(int *)((char *)&stru_505708[0].arr_6C[0][1] + v4);
+//      pTargetXY[0] += v5;
+//      pTargetXY[1] += v6;
+//    }
+//    v7 = stru_505708[0].cards_at_hand[v2 + 47 * amuint_4FAA6C];
+//    if ( v7 == -1 )
+//    {
+//      ++v0;
+//      goto LABEL_15;
+//    }
+//    if ( v2 != amuint_4FAA4C )
+//    {
+//      if ( LOBYTE(stru_505708[amuint_4FAA6C].field_20) == (_BYTE)v1 && byte_505881 == (_BYTE)v1 )
+//      {
+//        pSrcXYZW[0] = 192;
+//        pSrcXYZW[2] = 288;
+//        pSrcXYZW[1] = v1;
+//        pSrcXYZW[3] = 128;
+//        v21 = 2;
+//LABEL_12:
+//        Blt_Copy(pSrcXYZW, pTargetXY, v21);
+//        goto LABEL_13;
+//      }
+//      ArcomageGame::GetCardRect(v7, pSrcXYZW);
+//      if ( !am_40BF15(amuint_4FAA6C, v2) )
+//      {
+//        v1 = 0;
+//        v21 = 0;
+//        goto LABEL_12;
+//      }
+//      Blt_Copy(pSrcXYZW, pTargetXY, 2);
+//      v1 = 0;
+//    }
+//LABEL_13:
+//    v3 = amuint_4FAA6C;
+//    pTargetXY[0] += v24 + 96;
+//LABEL_15:
+//    if ( am_byte_4E185D != (_BYTE)v1 )
+//    {
+//      v8 = 188 * v3 + 8 * v2;
+//      v9 = *(int *)((char *)stru_505708[0].arr_6C[0] + v8);
+//      v10 = *(int *)((char *)&stru_505708[0].arr_6C[0][1] + v8);
+//      pTargetXY[0] -= v9;
+//      pTargetXY[1] -= v10;
+//    }
+//    ++v2;
+//  }
+//  v11 = 0;
+//  do
+//  {
+//    if ( am_byte_4FAA76 == (_BYTE)v1 )
+//    {
+//      v12 = 4 * v11;
+//      v13 = amuint_4FAA78[8 * v11];
+//      if ( v13 != -1 )
+//      {
+//        ArcomageGame::GetCardRect(v13, pSrcXYZW);
+//        Blt_Copy((ArcomageRect *)pSrcXYZW, amuint_4FAA90[v12], v1);
+//      }
+//      if ( am_byte_4FAA7C[v12 * 8] != (_BYTE)v1 )
+//      {
+//        pTargetXY[0] = amuint_4FAA90[v12][0] + 12;
+//        v14 = amuint_4FAA90[v12][1] + 40;
+//        pTargetXY[1] = amuint_4FAA90[v12][1] + 40;
+//        LOWORD(v14) = pArcomageGame->field_54;
+//        pSrcXYZW[0] = 843;
+//        pSrcXYZW[2] = 916;
+//        pSrcXYZW[1] = 200;
+//        pSrcXYZW[3] = 216;
+//        Blt_Chroma(pSrcXYZW, pTargetXY, v14, 2);
+//      }
+//    }
+//    else
+//    {
+//      if ( amuint_4FAA34 <= v1 )
+//      {
+//        if ( v11 == 9 )
+//        {
+//          am_byte_4FAA76 = v1;
+//          am_byte_4FAA75 = v1;
+//          amuint_4FAA34 = 5;
+//        }
+//        v18 = 32 * v11;
+//        v19 = &amuint_4FAA78[8 * v11];
+//        if ( *v19 != -1 )
+//          amuint_4FABC4 = *v19;
+//        *v19 = -1;
+//        amuint_4FAA90[v18 / 8][0] = amuint_4FAA80[v18 / 4];
+//        v20 = amuint_4FAA84[v18 / 4];
+//        am_byte_4FAA7C[v18] = v1;
+//        amuint_4FAA90[v18 / 8][1] = v20;
+//      }
+//      else
+//      {
+//        v15 = 32 * v11;
+//        v16 = amuint_4FAA78[8 * v11];
+//        if ( v16 != -1 )
+//        {
+//          v17 = amuint_4FAA90[v15 / 8];
+//          *v17 += amuint_4FAA88[v15 / 4];
+//          amuint_4FAA90[v15 / 8][1] += amuint_4FAA8C[v15 / 4];
+//          ArcomageGame::GetCardRect(v16, pSrcXYZW);
+//          Blt_Copy(pSrcXYZW, v17, v1);
+//        }
+//      }
+//    }
+//    ++v11;
+//  }
+//  while ( v11 < 10 );
+//  if ( am_byte_4FAA76 != (_BYTE)v1 )
+//    --amuint_4FAA34;
+//  pSrcXYZW[0] = 192;
+//  pSrcXYZW[2] = 288;
+//  pSrcXYZW[1] = v1;
+//  pSrcXYZW[3] = 128;
+//  pTargetXY[0] = 120;
+//  pTargetXY[1] = 18;
+//  Blt_Copy(pSrcXYZW, pTargetXY, v1);
 }
 // 4E185D: using guessed type char am_byte_4E185D;
 // 4FAA34: using guessed type int amuint_4FAA34;
@@ -2847,212 +2797,211 @@
 //----- (0040B76F) --------------------------------------------------------
 void __fastcall am_40B76F(int a1)
 {
-  int v1; // eax@3
-  int v2; // eax@3
-  int v3; // esi@4
-  int v4; // eax@4
-  int *v5; // edx@6
-  int *v6; // ecx@6
-  signed int v7; // ebx@11
-  int v8; // eax@15
-  signed int v9; // ecx@15
-  int v10; // eax@20
-  int v11; // ecx@20
-  int v12; // eax@20
-  unsigned int v13; // ecx@21
-  double v14; // st7@22
-  int *v15; // edx@23
-  int v16; // eax@32
-  char v17; // zf@37
-  int v18; // eax@41
-  int v19; // eax@46
-  int v20; // ecx@46
-  int v21; // eax@46
-  int v22; // [sp-4h] [bp-2Ch]@6
-  int v23; // [sp-4h] [bp-2Ch]@28
-  int pSrcXYZW[4]; // [sp+Ch] [bp-1Ch]@6
-  int pTargetXY[2]; // [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[1] = 18;
-      am_uint_4FAA44_blt_xy[0] = 120;
-      v1 = am_40BB49(amuint_4FAA6C);
-      v2 = (640 - 96 * v1) / v1 + 96;
-      if ( am_byte_4E185D )
-      {
-        v3 = 188 * amuint_4FAA6C + 8 * amuint_4FAA4C;
-        amuint_4FAA3C_blt_xy[0] = (amuint_4FAA4C * v2 + *(int *)((char *)stru_505708[0].arr_6C[0] + v3) - 120) / 10;
-        v4 = (*(int *)((char *)&stru_505708[0].arr_6C[0][1] + v3) + 309) / 10;
-      }
-      else
-      {
-        amuint_4FAA3C_blt_xy[0] = (amuint_4FAA4C * v2 - 120) / 10;
-        v4 = 30;
-      }
-      am_uint_4FAA44_blt_xy[1] += v4;
-      am_uint_4FAA44_blt_xy[0] += amuint_4FAA3C_blt_xy[0];
-      pSrcXYZW[1] = 0;
-      amuint_4FAA3C_blt_xy[1] = v4;
-      pSrcXYZW[0] = 192;
-      pSrcXYZW[2] = 288;
-      pSrcXYZW[3] = 128;
-      v22 = 2;
-      v5 = am_uint_4FAA44_blt_xy;
-      v6 = pSrcXYZW;
-      goto LABEL_7;
-    }
-    pSrcXYZW[1] = 0;
-    v6 = pSrcXYZW;
-    v5 = am_uint_4FAA44_blt_xy;
-    v22 = 2;
-    pSrcXYZW[3] = 128;
-    pSrcXYZW[2] = 288;
-    pSrcXYZW[0] = 192;
-    if ( amuint_4FAA38 )
-    {
-      am_uint_4FAA44_blt_xy[0] += amuint_4FAA3C_blt_xy[0];
-      am_uint_4FAA44_blt_xy[1] += amuint_4FAA3C_blt_xy[1];
-LABEL_7:
-      Blt_Copy((ArcomageRect *)v6, v5, v22);
-      goto LABEL_11;
-    }
-    am_uint_4FAA44_blt_xy[0] += amuint_4FAA3C_blt_xy[0];
-    am_uint_4FAA44_blt_xy[1] += amuint_4FAA3C_blt_xy[1];
-    Blt_Copy((ArcomageRect *)pSrcXYZW, am_uint_4FAA44_blt_xy, 2);
-    amuint_4FAA4C = -1;
-  }
-LABEL_11:
-  v7 = (signed int)amuint_4FAA78;
-  if ( uCardID != -1 )
-  {
-    if ( v26 <= 10 )
-    {
-      if ( v26 == 10 )
-      {
-        ArcomageGame::GetCardRect(uCardID, (ArcomageRect *)pSrcXYZW);
-        v8 = 0;
-        v9 = (signed int)amuint_4FAA78;
-        while ( *(unsigned int *)v9 != -1 )
-        {
-          v9 += 32;
-          ++v8;
-          if ( v9 >= (signed int)&dword_4FABB8 )
-            goto LABEL_20;
-        }
-        amuint_4FAA78[8 * v8] = uCardID;
-        am_byte_4FAA7C[32 * v8] = 1;
-LABEL_20:
-        v10 = 8 * v8;
-        v11 = amuint_4FAA80[v10];
-        v12 = amuint_4FAA84[v10];
-        pTargetXY[0] = v11;
-        pTargetXY[1] = v12;
-        Blt_Copy((ArcomageRect *)pSrcXYZW, pTargetXY, 0);
-        uCardID = -1;
-      }
-    }
-    else
-    {
-      ArcomageGame::GetCardRect(uCardID, (ArcomageRect *)pSrcXYZW);
-      amuint_4FAA5C_blt_xy[0] += amuint_4FAA54_blt_xy[0];
-      amuint_4FAA5C_blt_xy[1] += amuint_4FAA54_blt_xy[1];
-      Blt_Copy((ArcomageRect *)pSrcXYZW, amuint_4FAA5C_blt_xy, 0);
-    }
-  }
-  v13 = amuint_4FABC0;
-  if ( amuint_4FABC0 != -1 )
-  {
-    v14 = (double)v26;
-    if ( v14 > 15.0 )
-    {
-      ArcomageGame::GetCardRect(amuint_4FABC0, (ArcomageRect *)pSrcXYZW);
-      v15 = amuint_4FAA5C_blt_xy;
-      amuint_4FAA5C_blt_xy[0] += amuint_4FAA54_blt_xy[0];
-      amuint_4FAA5C_blt_xy[1] += amuint_4FAA54_blt_xy[1];
-LABEL_28:
-      v23 = 2;
-LABEL_29:
-      Blt_Copy((ArcomageRect *)pSrcXYZW, v15, v23);
-      return;
-    }
-    if ( v14 == 15.0 )
-    {
-      am_40BF77(amuint_4FAA6C, amuint_4FABC0);
-      v13 = amuint_4FABC0;
-      goto LABEL_26;
-    }
-    if ( v14 == 5.0 )
-    {
-      amuint_4FAA5C_blt_xy[0] = 272;
-      amuint_4FAA5C_blt_xy[1] = 173;
-      v16 = 0;
-      do
-      {
-        if ( *(unsigned int *)v7 == -1 )
-          break;
-        v7 += 32;
-        ++v16;
-      }
-      while ( v7 < (signed int)&dword_4FABB8 );
-      v26 = 32 * v16;
-      amuint_4FAA54_blt_xy[0] = (amuint_4FAA80[8 * v16] - 272) / 5;
-      amuint_4FAA54_blt_xy[1] = (amuint_4FAA84[8 * v16] - 173) / 5;
-      ArcomageGame::GetCardRect(amuint_4FABC0, (ArcomageRect *)pSrcXYZW);
-      pTargetXY[0] = 272;
-      pTargetXY[1] = 173;
-      goto LABEL_27;
-    }
-    if ( v14 >= 5.0 )
-    {
-      v17 = v26 == 0;
-    }
-    else
-    {
-      v17 = v26 == 0;
-      if ( v26 > 0 )
-      {
-        ArcomageGame::GetCardRect(amuint_4FABC0, (ArcomageRect *)pSrcXYZW);
-        v15 = amuint_4FAA5C_blt_xy;
-        amuint_4FAA5C_blt_xy[0] += amuint_4FAA54_blt_xy[0];
-        amuint_4FAA5C_blt_xy[1] += amuint_4FAA54_blt_xy[1];
-        v23 = 0;
-        goto LABEL_29;
-      }
-    }
-    if ( !v17 )
-    {
-LABEL_26:
-      ArcomageGame::GetCardRect(v13, (ArcomageRect *)pSrcXYZW);
-      pTargetXY[0] = 272;
-      pTargetXY[1] = 173;
-LABEL_27:
-      v15 = pTargetXY;
-      goto LABEL_28;
-    }
-    ArcomageGame::GetCardRect(amuint_4FABC0, (ArcomageRect *)pSrcXYZW);
-    v18 = 0;
-    while ( *(unsigned int *)v7 != -1 )
-    {
-      v7 += 32;
-      ++v18;
-      if ( v7 >= (signed int)&dword_4FABB8 )
-        goto LABEL_46;
-    }
-    amuint_4FAA78[8 * v18] = amuint_4FABC0;
-LABEL_46:
-    v19 = 8 * v18;
-    v20 = amuint_4FAA80[v19];
-    v21 = amuint_4FAA84[v19];
-    pTargetXY[0] = v20;
-    pTargetXY[1] = v21;
-    Blt_Copy((ArcomageRect *)pSrcXYZW, pTargetXY, 0);
-    amuint_4FABC0 = -1;
-  }
+//  int v1; // eax@3
+//  int v2; // eax@3
+//  int v3; // esi@4
+//  int v4; // eax@4
+//  int *v5; // edx@6
+//  int *v6; // ecx@6
+//  signed int v7; // ebx@11
+//  int v8; // eax@15
+//  signed int v9; // ecx@15
+//  int v10; // eax@20
+//  int v11; // ecx@20
+//  int v12; // eax@20
+//  unsigned int v13; // ecx@21
+//  double v14; // st7@22
+//  int *v15; // edx@23
+//  int v16; // eax@32
+//  char v17; // zf@37
+//  int v18; // eax@41
+//  int v19; // eax@46
+//  int v20; // ecx@46
+//  int v21; // eax@46
+//  int v22; // [sp-4h] [bp-2Ch]@6
+//  int v23; // [sp-4h] [bp-2Ch]@28
+//  int pSrcXYZW[4]; // [sp+Ch] [bp-1Ch]@6
+//  int pTargetXY[2]; // [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[1] = 18;
+//      am_uint_4FAA44_blt_xy[0] = 120;
+//      v1 = am_40BB49(amuint_4FAA6C);
+//      v2 = (640 - 96 * v1) / v1 + 96;
+//      if ( am_byte_4E185D )
+//      {
+//        v3 = 188 * amuint_4FAA6C + 8 * amuint_4FAA4C;
+//        amuint_4FAA3C_blt_xy[0] = (amuint_4FAA4C * v2 + *(int *)((char *)stru_505708[0].arr_6C[0] + v3) - 120) / 10;
+//        v4 = (*(int *)((char *)&stru_505708[0].arr_6C[0][1] + v3) + 309) / 10;
+//      }
+//      else
+//      {
+//        amuint_4FAA3C_blt_xy[0] = (amuint_4FAA4C * v2 - 120) / 10;
+//        v4 = 30;
+//      }
+//      am_uint_4FAA44_blt_xy[1] += v4;
+//      am_uint_4FAA44_blt_xy[0] += amuint_4FAA3C_blt_xy[0];
+//      pSrcXYZW[1] = 0;
+//      amuint_4FAA3C_blt_xy[1] = v4;
+//      pSrcXYZW[0] = 192;
+//      pSrcXYZW[2] = 288;
+//      pSrcXYZW[3] = 128;
+//      v5 = am_uint_4FAA44_blt_xy;
+//      v6 = pSrcXYZW;
+//      goto LABEL_7;
+//    }
+//    pSrcXYZW[1] = 0;
+//    v6 = pSrcXYZW;
+//    v5 = am_uint_4FAA44_blt_xy;
+//
+//    pSrcXYZW[3] = 128;
+//    pSrcXYZW[2] = 288;
+//    pSrcXYZW[0] = 192;
+//    if ( amuint_4FAA38 )
+//    {
+//      am_uint_4FAA44_blt_xy[0] += amuint_4FAA3C_blt_xy[0];
+//      am_uint_4FAA44_blt_xy[1] += amuint_4FAA3C_blt_xy[1];
+//LABEL_7:
+//      Blt_Copy(v6, v5, 2);
+//      goto LABEL_11;
+//    }
+//    am_uint_4FAA44_blt_xy[0] += amuint_4FAA3C_blt_xy[0];
+//    am_uint_4FAA44_blt_xy[1] += amuint_4FAA3C_blt_xy[1];
+//    Blt_Copy(pSrcXYZW, am_uint_4FAA44_blt_xy, 2);
+//    amuint_4FAA4C = -1;
+//  }
+//LABEL_11:
+//  v7 = (signed int)amuint_4FAA78;
+//  if ( uCardID != -1 )
+//  {
+//    if ( v26 <= 10 )
+//    {
+//      if ( v26 == 10 )
+//      {
+//        ArcomageGame::GetCardRect(uCardID, pSrcXYZW);
+//        v8 = 0;
+//        v9 = (signed int)amuint_4FAA78;
+//        while ( *(unsigned int *)v9 != -1 )
+//        {
+//          v9 += 32;
+//          ++v8;
+//          if ( v9 >= (signed int)&dword_4FABB8 )
+//            goto LABEL_20;
+//        }
+//        amuint_4FAA78[8 * v8] = uCardID;
+//        am_byte_4FAA7C[32 * v8] = 1;
+//LABEL_20:
+//        v10 = 8 * v8;
+//        v11 = amuint_4FAA80[v10];
+//        v12 = amuint_4FAA84[v10];
+//        pTargetXY[0] = v11;
+//        pTargetXY[1] = v12;
+//        Blt_Copy((ArcomageRect *)pSrcXYZW, pTargetXY, 0);
+//        uCardID = -1;
+//      }
+//    }
+//    else
+//    {
+//      ArcomageGame::GetCardRect(uCardID, pSrcXYZW);
+//      amuint_4FAA5C_blt_xy[0] += amuint_4FAA54_blt_xy[0];
+//      amuint_4FAA5C_blt_xy[1] += amuint_4FAA54_blt_xy[1];
+//      Blt_Copy(pSrcXYZW, amuint_4FAA5C_blt_xy, 0);
+//    }
+//  }
+//  v13 = amuint_4FABC0;
+//  if ( amuint_4FABC0 != -1 )
+//  {
+//    v14 = (double)v26;
+//    if ( v14 > 15.0 )
+//    {
+//      ArcomageGame::GetCardRect(amuint_4FABC0, pSrcXYZW);
+//      v15 = amuint_4FAA5C_blt_xy;
+//      amuint_4FAA5C_blt_xy[0] += amuint_4FAA54_blt_xy[0];
+//      amuint_4FAA5C_blt_xy[1] += amuint_4FAA54_blt_xy[1];
+//LABEL_28:
+//      v23 = 2;
+//LABEL_29:
+//      Blt_Copy(pSrcXYZW, v15, v23);
+//      return;
+//    }
+//    if ( v14 == 15.0 )
+//    {
+//      am_40BF77(amuint_4FAA6C, amuint_4FABC0);
+//      v13 = amuint_4FABC0;
+//      goto LABEL_26;
+//    }
+//    if ( v14 == 5.0 )
+//    {
+//      amuint_4FAA5C_blt_xy[0] = 272;
+//      amuint_4FAA5C_blt_xy[1] = 173;
+//      v16 = 0;
+//      do
+//      {
+//        if ( *(unsigned int *)v7 == -1 )
+//          break;
+//        v7 += 32;
+//        ++v16;
+//      }
+//      while ( v7 < (signed int)&dword_4FABB8 );
+//      v26 = 32 * v16;
+//      amuint_4FAA54_blt_xy[0] = (amuint_4FAA80[8 * v16] - 272) / 5;
+//      amuint_4FAA54_blt_xy[1] = (amuint_4FAA84[8 * v16] - 173) / 5;
+//      ArcomageGame::GetCardRect(amuint_4FABC0, pSrcXYZW);
+//      pTargetXY[0] = 272;
+//      pTargetXY[1] = 173;
+//      goto LABEL_27;
+//    }
+//    if ( v14 >= 5.0 )
+//    {
+//      v17 = v26 == 0;
+//    }
+//    else
+//    {
+//      v17 = v26 == 0;
+//      if ( v26 > 0 )
+//      {
+//        ArcomageGame::GetCardRect(amuint_4FABC0, pSrcXYZW);
+//        v15 = amuint_4FAA5C_blt_xy;
+//        amuint_4FAA5C_blt_xy[0] += amuint_4FAA54_blt_xy[0];
+//        amuint_4FAA5C_blt_xy[1] += amuint_4FAA54_blt_xy[1];
+//        v23 = 0;
+//        goto LABEL_29;
+//      }
+//    }
+//    if ( !v17 )
+//    {
+//LABEL_26:
+//      ArcomageGame::GetCardRect(v13, pSrcXYZW);
+//      pTargetXY[0] = 272;
+//      pTargetXY[1] = 173;
+//LABEL_27:
+//      v15 = pTargetXY;
+//      goto LABEL_28;
+//    }
+//    ArcomageGame::GetCardRect(amuint_4FABC0, pSrcXYZW);
+//    v18 = 0;
+//    while ( *(unsigned int *)v7 != -1 )
+//    {
+//      v7 += 32;
+//      ++v18;
+//      if ( v7 >= (signed int)&dword_4FABB8 )
+//        goto LABEL_46;
+//    }
+//    amuint_4FAA78[8 * v18] = amuint_4FABC0;
+//LABEL_46:
+//    v19 = 8 * v18;
+//    v20 = amuint_4FAA80[v19];
+//    v21 = amuint_4FAA84[v19];
+//    pTargetXY[0] = v20;
+//    pTargetXY[1] = v21;
+//    Blt_Copy((ArcomageRect *)pSrcXYZW, pTargetXY, 0);
+//    amuint_4FABC0 = -1;
+//  }
 }
 // 4E185D: using guessed type char am_byte_4E185D;
 // 4FAA38: using guessed type int amuint_4FAA38;
@@ -3063,19 +3012,17 @@
 // 4FABB8: using guessed type int dword_4FABB8;
 
 //----- (0040BB12) --------------------------------------------------------
-void ArcomageGame::GetCardRect(unsigned int uCardID, ArcomageRect *pCardRect)
+void ArcomageGame::GetCardRect(unsigned int uCardID, RECT *pCardRect)
 {
-  ArcomageRect *pXYZW; // esi@1
   int v3; // edx@1
   int v4; // ecx@1
 
-  pXYZW = pCardRect;
   v3 = pCards[uCardID].slot % 10;
   v4 = (pCards[uCardID].slot / 10 << 7) + 220;
-  pXYZW->y = v4;
-  pXYZW->x = 96 * v3;
-  pXYZW->w = v4 + 128;
-  pXYZW->z = 96 * v3 + 96;
+  pCardRect->top = v4;
+  pCardRect->left = 96 * v3;
+  pCardRect->bottom = v4 + 128;
+  pCardRect->right = 96 * v3 + 96;
 }
 
 //----- (0040BB49) --------------------------------------------------------
@@ -3086,7 +3033,7 @@
   signed int v3; // edx@1
 
   result = 0;
-  v2 = (char *)stru_505708[a1].arr_44;
+  v2 = (char *)am_Players[a1].cards_at_hand;
   v3 = 10;
   do
   {
@@ -3141,7 +3088,7 @@
   result = -1;
   v3 = 188 * a1;
   a1a = a1;
-  v4 = LOBYTE(stru_505708[a1].field_20) == 0;
+  v4 = LOBYTE(am_Players[a1].field_20) == 0;
   v28 = -1;
   if ( !v4 )
   {
@@ -3161,7 +3108,7 @@
         for ( i = 47 * v1; ; v6 = i )
         {
           v7 = v30;
-          v8 = (char *)&stru_505708[0].arr_44[v30 + v6];
+          v8 = (char *)&am_Players[0].cards_at_hand[v30 + v6];
           if ( *(unsigned int *)v8 == -1 )
           {
             do
@@ -3175,8 +3122,8 @@
           if ( am_byte_4E185D )
           {
             v9 = v3 + 8 * v7;
-            v10 = *(int *)((char *)stru_505708[0].arr_6C[0] + v9);
-            v11 = *(int *)((char *)&stru_505708[0].arr_6C[0][1] + v9);
+            v10 = *(int *)((char *)am_Players[0].arr_6C[0] + v9);
+            v11 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v9);
             pXYZW[0] += v10;
             pXYZW[2] += v10;
             pXYZW[1] += v11;
@@ -3191,14 +3138,14 @@
           LOWORD(v13) = *(_WORD *)&v31;
           BYTE2(v13) = 0;
           v14 = R8G8B8_to_TargetFormat(v13);
-          DrawRect((Vec4_int_ *)pXYZW, v14, 0);
+       //   DrawRect(pXYZW, v14, 0);
           pXYZW[0] += var18;
           pXYZW[2] += var18;
           if ( am_byte_4E185D )
           {
             v15 = v3 + 8 * v30;
-            v16 = *(int *)((char *)stru_505708[0].arr_6C[0] + v15);
-            v17 = *(int *)((char *)&stru_505708[0].arr_6C[0][1] + v15);
+            v16 = *(int *)((char *)am_Players[0].arr_6C[0] + v15);
+            v17 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v15);
             pXYZW[0] -= v16;
             pXYZW[2] -= v16;
             pXYZW[1] -= v17;
@@ -3226,7 +3173,7 @@
         LOWORD(v20) = *(_WORD *)&v31;
         BYTE2(v20) = v33;
         v21 = R8G8B8_to_TargetFormat(v20);
-        DrawRect((Vec4_int_ *)pXYZW, v21, 0);
+       // DrawRect(pXYZW, v21, 0);
       }
     }
 LABEL_20:
@@ -3258,7 +3205,7 @@
     goto LABEL_16;
   v2 = 0;
   v3 = 0;
-  v4 = (char *)stru_505708[a1].arr_44;
+  v4 = (char *)am_Players[a1].cards_at_hand;
   do
   {
     if ( *(unsigned int *)v4 != -1 )
@@ -3273,14 +3220,14 @@
   while ( v3 < 10 );
   v5 = v3 + 47 * a1;
   v6 = 4 * v5 + 5265228;
-  if ( BYTE3(pCards[stru_505708[0].arr_44[v5]].field_28) )
+  if ( BYTE3(pCards[am_Players[0].cards_at_hand[v5]].field_28) )
   {
     ArcomageGame::PlaySound(0x16u);
     v7 = amuint_4FAA6C;
     v8 = am_40BB49(amuint_4FAA6C);
     v9 = 188 * v7 + 8 * v3;
-    v10 = 96 * v3 + *(int *)((char *)stru_505708[0].arr_6C[0] + v9) + (640 - 96 * v8) / (v8 + 1);
-    v11 = *(int *)((char *)&stru_505708[0].arr_6C[0][1] + v9) + 327;
+    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;
     v12 = 0;
@@ -3325,7 +3272,7 @@
   bool result; // eax@0
   int v3; // ebp@1
   int v4; // ecx@2
-  ArcomageGame_stru0 *v5; // esi@2
+  ArcomagePlayer *v5; // esi@2
   int v6; // edi@2
   int v7; // eax@2
   int v8; // ebx@8
@@ -3342,9 +3289,9 @@
   if ( a2 <= -1 )
     goto LABEL_12;
   v4 = 0;
-  v5 = &stru_505708[v3];
+  v5 = &am_Players[v3];
   v6 = 0;
-  v7 = (int)v5->arr_44;
+  v7 = (int)v5->cards_at_hand;
   do
   {
     if ( *(unsigned int *)v7 != -1 )
@@ -3367,19 +3314,19 @@
     v11 = v6 + 47 * v3;
     amuint_4FAA54_blt_xy[1] = -30;
     pArcomageGame->field_F6 = 1;
-    v12 = 96 * v6 + *(int *)((char *)stru_505708[0].arr_6C[0] + v10) + (640 - 96 * v9) / (v9 + 1);
-    v13 = *(int *)((char *)&stru_505708[0].arr_6C[0][1] + v10) + 327;
+    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;
-    v14 = &pCards[v5->arr_44[v6]];
+    v14 = &pCards[v5->cards_at_hand[v6]];
     v5->field_38 -= LOBYTE(v14->field_28);
     v15 = BYTE1(v14->field_28);
     v5->field_40 -= BYTE2(v14->field_28);
     v5->field_3C -= v15;
     result = 4 * v11 + 5265228;
-    v16 = stru_505708[0].arr_44[v11];
-    stru_505708[0].arr_44[v11] = -1;
+    v16 = am_Players[0].cards_at_hand[v11];
+    am_Players[0].cards_at_hand[v11] = -1;
     amuint_4FABC0 = v16;
     LOBYTE(result) = 1;
   }
@@ -3394,13 +3341,13 @@
 //----- (0040BF15) --------------------------------------------------------
 bool __fastcall am_40BF15(int a1, int a2)
 {
-  ArcomageGame_stru0 *v2; // esi@1
+  ArcomagePlayer *v2; // esi@1
   bool result; // eax@1
   ArcomageCard *v4; // ecx@1
 
-  v2 = &stru_505708[a1];
+  v2 = &am_Players[a1];
   LOBYTE(result) = 1;
-  v4 = &pCards[v2->arr_44[a2]];
+  v4 = &pCards[v2->cards_at_hand[a2]];
   if ( SBYTE1(v4->field_24) > v2->field_2C )
     LOBYTE(result) = 0;
   if ( SBYTE2(v4->field_24) > v2->field_30 )
@@ -3422,1955 +3369,1955 @@
 //----- (0040BF77) --------------------------------------------------------
 void __fastcall am_40BF77(int a1, unsigned int uCardID)
 {
-  ArcomageGame_stru0 *v2; // esi@1
-  int v3; // eax@1
-  ArcomageGame_stru0 *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 = am_40BB49(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 = am_40BB49(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;
-    }
-  }
+//  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 = am_40BB49(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 = am_40BB49(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;
+//    }
+//  }
 }
 
 
@@ -5484,11 +5431,11 @@
 //----- (0040D402) --------------------------------------------------------
 int __fastcall am_40D402(int a1, int a2)
 {
-  ArcomageGame_stru0 *v2; // ecx@1
+  ArcomagePlayer *v2; // ecx@1
   int v3; // esi@1
   int result; // eax@3
 
-  v2 = &stru_505708[a1];
+  v2 = &am_Players[a1];
   v3 = v2->field_28;
   if ( v3 <= 0 )
   {
@@ -5543,60 +5490,60 @@
   v2 = 0;
   xy[1] = 160;
   xy[0] = 320 - 12 * v2 / 2;
-  pPrimaryWindow_draws_text(-1, pText, xy);
-  if ( stru_505708[0].field_24 < dword_4E1884 )
+//  pPrimaryWindow_draws_text(-1, pText, xy);
+  if ( am_Players[0].field_24 < dword_4E1884 )
   {
-    if ( stru_505708[1].field_24 < dword_4E1884 )
+    if ( am_Players[1].field_24 < dword_4E1884 )
       goto LABEL_10;
     v0 = 2;
   }
   else
   {
-    if ( stru_505708[1].field_24 < dword_4E1884 )
+    if ( am_Players[1].field_24 < dword_4E1884 )
     {
       v0 = 1;
     }
     else
     {
-      if ( stru_505708[0].field_24 == stru_505708[1].field_24 )
+      if ( am_Players[0].field_24 == am_Players[1].field_24 )
       {
         v0 = 0;
         v1 = 4;
         goto LABEL_10;
       }
-      v0 = (stru_505708[0].field_24 <= stru_505708[1].field_24) + 1;
+      v0 = (am_Players[0].field_24 <= am_Players[1].field_24) + 1;
     }
   }
   v1 = 0;
 LABEL_10:
-  if ( stru_505708[0].field_24 <= 0 )
+  if ( am_Players[0].field_24 <= 0 )
   {
-    if ( stru_505708[1].field_24 > 0 )
+    if ( am_Players[1].field_24 > 0 )
     {
       v0 = 2;
     }
     else
     {
-      if ( stru_505708[0].field_24 == stru_505708[1].field_24 )
+      if ( am_Players[0].field_24 == am_Players[1].field_24 )
       {
 LABEL_20:
-        if ( stru_505708[0].field_28 == stru_505708[1].field_28 )
+        if ( am_Players[0].field_28 == am_Players[1].field_28 )
         {
           v0 = 0;
           v1 = 4;
         }
         else
         {
-          v0 = (stru_505708[0].field_28 <= stru_505708[1].field_28) + 1;
+          v0 = (am_Players[0].field_28 <= am_Players[1].field_28) + 1;
           v1 = 1;
         }
         goto LABEL_23;
       }
-      v0 = (stru_505708[0].field_24 <= stru_505708[1].field_24) + 1;
+      v0 = (am_Players[0].field_24 <= am_Players[1].field_24) + 1;
     }
     goto LABEL_17;
   }
-  if ( stru_505708[1].field_24 <= 0 )
+  if ( am_Players[1].field_24 <= 0 )
   {
     v0 = 1;
 LABEL_17:
@@ -5605,35 +5552,35 @@
   if ( !v0 && v1 == 4 )
     goto LABEL_20;
 LABEL_23:
-  v3 = stru_505708[0].field_38;
-  if ( stru_505708[0].field_38 <= stru_505708[0].field_3C )
+  v3 = am_Players[0].field_38;
+  if ( am_Players[0].field_38 <= am_Players[0].field_3C )
   {
-    v3 = stru_505708[0].field_40;
-    v4 = stru_505708[0].field_3C;
-    if ( stru_505708[0].field_3C > stru_505708[0].field_40 )
+    v3 = am_Players[0].field_40;
+    v4 = am_Players[0].field_3C;
+    if ( am_Players[0].field_3C > am_Players[0].field_40 )
       goto LABEL_28;
   }
   else
   {
-    if ( stru_505708[0].field_38 <= stru_505708[0].field_40 )
+    if ( am_Players[0].field_38 <= am_Players[0].field_40 )
     {
-      v4 = stru_505708[0].field_40;
+      v4 = am_Players[0].field_40;
       goto LABEL_28;
     }
   }
   v4 = v3;
 LABEL_28:
-  v5 = stru_505708[1].field_38;
-  v6 = stru_505708[1].field_3C;
-  if ( stru_505708[1].field_38 <= stru_505708[1].field_3C )
+  v5 = am_Players[1].field_38;
+  v6 = am_Players[1].field_3C;
+  if ( am_Players[1].field_38 <= am_Players[1].field_3C )
   {
-    v5 = stru_505708[1].field_40;
-    if ( stru_505708[1].field_3C > stru_505708[1].field_40 )
+    v5 = am_Players[1].field_40;
+    if ( am_Players[1].field_3C > am_Players[1].field_40 )
       goto LABEL_33;
     goto LABEL_32;
   }
-  v6 = stru_505708[1].field_40;
-  if ( stru_505708[1].field_38 > stru_505708[1].field_40 )
+  v6 = am_Players[1].field_40;
+  if ( am_Players[1].field_38 > am_Players[1].field_40 )
 LABEL_32:
     v6 = v5;
 LABEL_33:
@@ -5693,7 +5640,7 @@
           *v9 = 1;
 
           //auto _a = (signed __int64)(p2DEvents_minus1__20[13 * (unsigned int)v7->ptr_1C] * 100.0);
-          auto _a = (signed __int64)(p2DEvents[(unsigned int)v7->ptr_1C - 1].fPriceMultiplier * 100.0);
+          auto _a = (signed int)(p2DEvents[(unsigned int)v7->ptr_1C - 1].fPriceMultiplier * 100.0);
           party_finds_gold(_a, 0);
         }
       }
@@ -5745,13 +5692,13 @@
   int v0; // ecx@3
   signed __int64 v1; // qax@4
   int v2; // esi@4
-  __int16 *v3; // esi@5
+  int v3; // esi@5
   signed int v4; // edi@5
   stru272 *v5; // esi@7
   int v6; // edx@9
   int v7; // ecx@9
-  int pXYZW[4]; // [sp+8h] [bp-1Ch]@5
-  int pXY[2]; // [sp+18h] [bp-Ch]@5
+  RECT pXYZW; // [sp+8h] [bp-1Ch]@5
+  POINT pXY; // [sp+18h] [bp-Ch]@5
   int v10; // [sp+20h] [bp-4h]@3
 
   pAudioPlayer->StopChannels(-1, -1);
@@ -5759,53 +5706,47 @@
   strcpy(pArcomageGame->pPlayer2Name, pArcomagePlayer2Name);
   am_byte_4FAA76 = 0;
   am_byte_4FAA75 = 0;
-  v10 = 1;
-  v0 = (int)am_byte_4FAA7C;
-  do
-  {
-    v1 = v10;
-    *(int *)(v0 - 4) = -1;
-    *(char *)v0 = 0;
-    v0 += 32;
-    v2 = 138 * (unsigned __int64)(v1 / 4) + 18;
-    HIDWORD(v1) = 100 * (unsigned __int64)(v1 % 4) + 120;
-    *(int *)(v0 - 28) = HIDWORD(v1);
-    *(int *)(v0 - 24) = v2;
-    *(int *)(v0 - 20) = (120 - HIDWORD(v1)) / 5;
-    ++v10;
-    *(int *)(v0 - 16) = (18 - v2) / 5;
-    *(int *)(v0 - 12) = *(int *)(v0 - 28);
-    *(int *)(v0 - 8) = *(int *)(v0 - 24);
-  }
-  while ( v10 - 1 < 10 );
-  pXY[0] = 0;
-  pXY[1] = 0;
+
+  for (int i=0; i<10; ++i)
+      {
+      v2 = (i+1) % 4;
+      v3 = (i+1) / 4;
+      struct_st1[i].uCardId = -1;
+      struct_st1[i].field_4 = 0;
+      struct_st1[i].field_8.x = 100 * v2 + 120;
+      struct_st1[i].field_8.y = 138 * v3 + 18;
+      struct_st1[i].field_10_xplus = -100 * v2 / 5;
+      struct_st1[i].field_14_y_plus = -138 * v3 / 5;
+      struct_st1[i].field_18_point.x = struct_st1[i].field_8.x;
+      struct_st1[i].field_18_point.y = struct_st1[i].field_8.y;
+      }
+
+  pXY.x = 0;
+  pXY.y = 0;
   ArcomageGame::LoadBackground();
-  pXYZW[0] = 0;
-  pXYZW[2] = 640;
-  pXYZW[1] = 0;
-  pXYZW[3] = 480;
+  pXYZW.left = 0;
+  pXYZW.right = 640;
+  pXYZW.top = 0;
+  pXYZW.bottom = 480;
   am_BeginScene(pArcomageGame->pBackgroundPixels, -1, 1);
-  Blt_Copy((ArcomageRect *)pXYZW, pXY, 2);
+  Blt_Copy(&pXYZW, &pXY, 2);
   am_EndScene();
   pRenderer->Present();
   ArcomageGame::LoadSprites();
   CallRenderPresent();
-  v3 = am_sounds;
+
   v4 = 120;
-  do
-  {
-    *v3 = pSoundList->LoadSound(v4++, 0);
-    ++v3;
-  }
-  while ( (signed int)v3 <= (signed int)&unk_4FAA20 );
-  v5 = array_4FAC10;
-  do
-  {
-    v5->_40DFD1();
-    ++v5;
-  }
-  while ( (signed int)v5 < 10 );//(signed int)&unk_5052C8 );
+  for (int i=0; i<12; ++i)
+    am_sounds[i] = pSoundList->LoadSound(v4++, 0);
+
+  //v5 = array_4FAC10;
+  //do
+  //{
+  //  v5->_40DFD1();
+  //  ++v5;
+  //}
+  //while ( (signed int)v5 < 10 );//(signed int)&unk_5052C8 );
+
   dword_4FABBC = -1;
   amuint_4FAA4C = -1;
   byte_4FAA74 = 0;
@@ -5814,26 +5755,23 @@
   byte_505880 = 0;
   dword_4FAA70 = 0;
   am_byte_4FAA77 = 0;
-  am_409FE9();
-  am_40A255(v7, v6);
+ // am_409FE9();
+  am_40A255();
   //nullsub_1();
   pArcomageGame->field_F5 = 0;
-  pArcomageGame->pFont1 = pFontComic;
-  pArcomageGame->pFont2 = pFontArrus;
+  pArcomageGame->pfntComic = pFontComic;
+  pArcomageGame->pfntArrus = pFontArrus;
 }
 
 
 //----- (0040D711) --------------------------------------------------------
 ArcomageGame::ArcomageGame()
 {
-  ArcomageGame *v1; // esi@1
-
-  v1 = this;
-  this->field_4 = 0;
+  field_4 = 0;
   //RGBTexture::RGBTexture(&this->pGameBackground);
   //RGBTexture::RGBTexture(&v1->pSprites);
-  v1->bGameInProgress = 0;
-  v1->field_F9 = 0;
+  bGameInProgress = 0;
+  field_F9 = 0;
 }
 
 
@@ -5868,4 +5806,64 @@
   v3 = v1->field_14;
   dword_4E1888 = v2;
   dword_4DF3A4 = v3;
-}
\ No newline at end of file
+}
+
+
+//----- (0040D75D) --------------------------------------------------------
+void pPrimaryWindow_draws_text( int a1, const char *pText, POINT *pXY )
+    {
+    int v4; // qax@1
+    v4 = pFontComic->uFontHeight - 3;
+    pPrimaryWindow->DrawText( pFontComic, pXY->x, pXY->y - (v4 >> 1) + 3, 0, pText, 0, 0, 0);
+    }
+
+
+//----- (0040DB27) --------------------------------------------------------
+void __fastcall DrawRect(Vec4_int_ *pXYZW, unsigned __int16 uColor, char bSolidFill)
+    {
+    Vec4_int_ *v3; // esi@1
+    unsigned __int16 v4; // bp@1
+    unsigned int i; // ebx@3
+
+    v3 = pXYZW;
+    v4 = uColor;
+    pRenderer->BeginScene();
+    pRenderer->SetRasterClipRect(0, 0, 639u, 479u);
+    if ( bSolidFill )
+        {
+        for ( i = v3->y; (signed int)i <= v3->w; ++i )
+            pRenderer->RasterLine2D(v3->x, i, v3->z, i, v4);
+        }
+    else
+        {
+        pRenderer->RasterLine2D(v3->x, v3->y, v3->z, v3->y, v4);
+        pRenderer->RasterLine2D(v3->z, v3->y, v3->z, v3->w, v4);
+        pRenderer->RasterLine2D(v3->z, v3->w, v3->x, v3->w, v4);
+        pRenderer->RasterLine2D(v3->x, v3->w, v3->x, v3->y, v4);
+        }
+    pRenderer->EndScene();
+    }
+
+//----- (0040DDB1) --------------------------------------------------------
+int __fastcall rand_interval(int a, int b)
+    {
+    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)
+    {
+    sprintf(pOut, "%d", val);
+    }
--- a/Arcomage.h	Wed Jun 05 15:45:59 2013 +0200
+++ b/Arcomage.h	Thu Jun 06 00:58:07 2013 +0400
@@ -5,43 +5,109 @@
 
 
 
+/*  401 */
 #pragma pack(push, 1)
-struct ArcomageRect
-{
-  int x;
-  int y;
-  int z;
-  int w;
-};
+struct Acromage_st1
+    {
+    int uCardId;
+    int field_4;
+    POINT field_8;
+    int field_10_xplus;
+    int field_14_y_plus;
+    POINT field_18_point;
+    };
 #pragma pack(pop)
 
 
 /*  272 */
 #pragma pack(push, 1)
 struct ArcomageCard
-{
-  char pCardName[20];
-  int field_14;
-  int field_18;
-  int field_1C;
-  int slot;
-  int field_24;
-  int field_28;
-  int field_2C;
-  float field_30;
-  int field_34;
-  char field_38[16];
-  char field_48[16];
-  char field_58[16];
-  int field_68;
-};
+    {
+    char pCardName[20];
+    int field_14;
+    int field_18;
+    int field_1C;
+    int slot;
+    char field_24;
+    char field_25;
+    char field_26;
+    char field_27;
+    char field_28;
+    char field_29;
+    char field_2A;
+    char field_2B;
+    char field_2C;
+    char field_2D;
+    char field_2E;
+    char field_2F;
+    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 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 field_6A;
+    char field_6B;
+    };
 #pragma pack(pop)
 
 
 
 
 #pragma pack(push, 1)
-struct ArcomageGame_stru0
+struct ArcomagePlayer
 {
   char pPlayerName[32];
   int field_20;
@@ -53,7 +119,7 @@
   int field_38;
   int field_3C;
   int field_40;
-  int arr_44[10];
+  int cards_at_hand[10];
   int arr_6C[10][2];
 };
 #pragma pack(pop)
@@ -80,10 +146,10 @@
   static bool LoadBackground();
   static bool LoadSprites();
   static bool MsgLoop(int a1, ArcomageGame_stru1 *a2);
-  static void PlaySound(unsigned int a1);
+  static void PlaySound(unsigned int event_id);
   static void OnMouseClick(char right_left, bool bDown);
   static void OnMouseMove(POINT *pXY);
-  static void GetCardRect(unsigned int uCardID, ArcomageRect *pCardRect);
+  static void GetCardRect(unsigned int uCardID, RECT *pCardRect);
 
   static void Loop();
 
@@ -103,8 +169,8 @@
   unsigned __int16 *pBackgroundPixels;
   unsigned __int16 *pSpritesPixels;
   unsigned __int16 *pBlit_Copy_pixels;
-  struct GUIFont *pFont1;//ptr_48;
-  struct GUIFont *pFont2;//ptr_4C;
+  struct GUIFont *pfntComic;//ptr_48;
+  struct GUIFont *pfntArrus;//ptr_4C;
   int field_50;
   __int16 field_54;
   __int16 field_56;
@@ -130,19 +196,7 @@
 
 extern ArcomageGame *pArcomageGame;
 extern ArcomageCard pCards[87];
-extern ArcomageGame_stru0 stru_505708[2];
-
-
-
-
-
-
-
-
-
-
-
-
+extern ArcomagePlayer am_Players[2];
 
 
 
--- a/AudioPlayer.h	Wed Jun 05 15:45:59 2013 +0200
+++ b/AudioPlayer.h	Thu Jun 06 00:58:07 2013 +0400
@@ -92,11 +92,14 @@
   SOUND_Arcomage_AddResources = 0x79,
   SOUND_Arcomage_TowerWallDamage = 0x7A,
   SOUND_Arcomage_DrawCard = 0x7B,
+  SOUND_Arcomage_124 = 0x7C,
   SOUND_Arcomage_ProductionDamage = 0x7D,
   SOUND_Arcomage_ProductionUpgrade = 0x7E,
   SOUND_Arcomage_127 = 0x7F,
   SOUND_Arcomage_128 = 0x80,
   SOUND_Arcomage_TowerUpgrade = 0x81,
+  SOUND_Arcomage_130 = 0x82,
+  SOUND_Arcomage_131 = 0x83,
   SOUND_Arcomage_WallUpgrade = 0x84,
   SOUND_GoldReceived = 0xC8,
   SOUND_OpenChest = 208,
--- a/GUIWindow.h	Wed Jun 05 15:45:59 2013 +0200
+++ b/GUIWindow.h	Thu Jun 06 00:58:07 2013 +0400
@@ -463,7 +463,7 @@
 
 
 
-
+void ModalWindow(const char *pStr, int a4);
 
 
 
--- a/Render.cpp	Wed Jun 05 15:45:59 2013 +0200
+++ b/Render.cpp	Thu Jun 06 00:58:07 2013 +0400
@@ -9,7 +9,7 @@
 #include "Mouse.h"
 #include "GammaControl.h"
 #include "stru6.h"
-
+#include "GUIWindow.h"
 #include "DecalBuilder.h"
 #include "ParticleEngine.h"
 #include "Render.h"
--- a/mm7_5.cpp	Wed Jun 05 15:45:59 2013 +0200
+++ b/mm7_5.cpp	Thu Jun 06 00:58:07 2013 +0400
@@ -9004,74 +9004,8 @@
 }
 
 
-//----- (0040D75D) --------------------------------------------------------
-void pPrimaryWindow_draws_text( int a1, const char *pText, int *pXY )
-    {
-  const char *v3; // ST0C_4@1
-  __int64 v4; // qax@1
-
-  v3 = pText;
-  v4 = LOBYTE(pFontComic->uFontHeight) - 3;
-  pPrimaryWindow->DrawText(
-           pFontComic,
-           *pXY,
-           pXY[1] - (((signed int)v4 - HIDWORD(v4)) >> 1) + 3,
-           0,
-           v3,
-           0,
-           0,
-           0);
-}
-
-//----- (0040DB27) --------------------------------------------------------
-void __fastcall DrawRect(Vec4_int_ *pXYZW, unsigned __int16 uColor, char bSolidFill)
-{
-  Vec4_int_ *v3; // esi@1
-  unsigned __int16 v4; // bp@1
-  unsigned int i; // ebx@3
-
-  v3 = pXYZW;
-  v4 = uColor;
-  pRenderer->BeginScene();
-  pRenderer->SetRasterClipRect(0, 0, 639u, 479u);
-  if ( bSolidFill )
-  {
-    for ( i = v3->y; (signed int)i <= v3->w; ++i )
-      pRenderer->RasterLine2D(v3->x, i, v3->z, i, v4);
-  }
-  else
-  {
-    pRenderer->RasterLine2D(v3->x, v3->y, v3->z, v3->y, v4);
-    pRenderer->RasterLine2D(v3->z, v3->y, v3->z, v3->w, v4);
-    pRenderer->RasterLine2D(v3->z, v3->w, v3->x, v3->w, v4);
-    pRenderer->RasterLine2D(v3->x, v3->w, v3->x, v3->y, v4);
-  }
-  pRenderer->EndScene();
-}
-
-//----- (0040DDB1) --------------------------------------------------------
-int __fastcall rand_interval(int a, int b)
-{
-  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)
-{
-  sprintf(pOut, "%d", val);
-}
+
+
 
 //----- (0040DEDB) --------------------------------------------------------
 unsigned int __stdcall R8G8B8_to_TargetFormat(int uColor)
--- a/mm7_data.cpp	Wed Jun 05 15:45:59 2013 +0200
+++ b/mm7_data.cpp	Thu Jun 06 00:58:07 2013 +0400
@@ -371,13 +371,9 @@
 int amuint_4E1868; // weak
 int amuint_4E186C; // weak
 int amuint_4E1870; // weak
-int dword_4E1874; // weak
-int dword_4E1878; // weak
+
+
 float flt_4D84E8 = 0.0f;
-int dword_4E187C; // weak
-int dword_4E1880; // weak
-int dword_4E1884; // weak
-int dword_4E1888; // weak
 char pArcomagePlayer2Name[8];
 char pArcomagePlayer1Name[8];
 char pDeckMaster[12];
--- a/mm7_data.h	Wed Jun 05 15:45:59 2013 +0200
+++ b/mm7_data.h	Thu Jun 06 00:58:07 2013 +0400
@@ -321,13 +321,9 @@
 extern int amuint_4E1868; // weak
 extern int amuint_4E186C; // weak
 extern int amuint_4E1870; // weak
-extern int dword_4E1874; // weak
-extern int dword_4E1878; // weak
+
 extern float flt_4D84E8;
-extern int dword_4E187C; // weak
-extern int dword_4E1880; // weak
-extern int dword_4E1884; // weak
-extern int dword_4E1888; // weak
+
 extern char pArcomagePlayer2Name[8];
 extern char pArcomagePlayer1Name[8];
 extern char pDeckMaster[12];
@@ -1169,47 +1165,7 @@
 unsigned int __fastcall SearchActorByGroup(unsigned int *pTotalActors, unsigned int uGroup);
 unsigned int __fastcall SearchActorByID(unsigned int *pTotalActors, unsigned int a2);
 void __cdecl PrepareArcomage();
-char __cdecl am_409FE9();
-char __cdecl am_40A198();
-int __fastcall am_40A255(int a1, int a2);
-int __fastcall am_40A283(int a1, int a2);
-signed int __fastcall am_40A324(int a1);
-int __fastcall am_40A346(int a1);
-void __cdecl am_40A383();
-bool __cdecl am_40A514();
-char __thiscall am_40A560(unsigned int _this);
-void __thiscall am_blts(int a1); // idb
-void __cdecl am_40AA4E();
-void __cdecl am_chroma_blts();
-void __cdecl am_DrawUI();
-void __fastcall am_40B102(int a1, char *a2, int *pXY); // idb
-void __fastcall am_40B17E(int a1, int a2, int *pXY); // idb
-void __fastcall am_40B1F3(int a1, int a2, int a3);
-void __fastcall am_40B268(int a1, char *a2, int *pXY); // idb
-void __cdecl am_chroma_and_copy_blts();
-void __cdecl am_chroma_blt();
-void __cdecl am_40B4B9();
-void __fastcall am_40B76F(int a1);
-int __fastcall am_40BB49(int a1);
-signed int __fastcall am_40BB67(int a1);
-char __fastcall am_40BCFB(int a1, signed int a2);
-bool __fastcall am_40BE0E(int a1, signed int a2);
-bool __fastcall am_40BF15(int a1, int a2);
-void __fastcall am_40BF77(int a1, unsigned int uCardID); // idb
-int __fastcall am_40D2B4(struct Vec2_int_ *, int); // weak
-int __fastcall am_40D402(int, int); // weak
-int __cdecl am_40D444();
-void ModalWindow(const char *pStr, int a4);
-void  pPrimaryWindow_draws_text(int a1, const char *pText, int *pXY);
-void __thiscall am_BeginScene(unsigned __int16 *pPcxPixels, int a2, int a3); // idb
-void __fastcall Blt_Chroma(struct ArcomageRect *pSrcXYZW, int *pTargetXY, int a3, int a4);
-void __fastcall Blt_Copy(struct ArcomageRect *pSrcXYZW, int *pTargetXY, int a3);
-void __cdecl am_EndScene();
-void __fastcall DrawRect(struct Vec4_int_ *pXYZW, unsigned __int16 uColor, char bSolidFill); // idb
-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);
+
 // int __cdecl crt_retnull_sub();
 unsigned int __stdcall R8G8B8_to_TargetFormat(int uColor); // idb
 unsigned short TargetColor(unsigned __int16 r, unsigned __int16 g, unsigned __int16 b); // idb