comparison Arcomage.cpp @ 1256:236d39ae8f6e

arcomage playable
author Gloval
date Wed, 12 Jun 2013 12:05:39 +0400
parents fd532497ffab
children 8cf1eb87a44e
comparison
equal deleted inserted replaced
1253:fac7751b2dc9 1256:236d39ae8f6e
30 void FillPlayerDeck(); 30 void FillPlayerDeck();
31 void InitalHandsFill(); 31 void InitalHandsFill();
32 void GetNextCardFromDeck(int player_num); 32 void GetNextCardFromDeck(int player_num);
33 int GetEmptyCardSlotIndex(int player_num); 33 int GetEmptyCardSlotIndex(int player_num);
34 void IncreaseResourcesInTurn(int player_num); 34 void IncreaseResourcesInTurn(int player_num);
35 void __cdecl am_40A383(); 35 void TurnChange();
36 bool IsGameOver(); 36 bool IsGameOver();
37 char __thiscall am_40A560(unsigned int _this); 37 int CalculateCardPower(ArcomagePlayer* player, ArcomagePlayer* enemy, ArcomageCard* pCard, int mastery);
38 char PlayerTurn(int player_num);
38 void DrawGameUI(int a1); // idb 39 void DrawGameUI(int a1); // idb
39 void am_40AA4E(); 40 void am_40AA4E();
40 void DrawRectanglesForText(); 41 void DrawRectanglesForText();
41 void DrawPlayersText(); 42 void DrawPlayersText();
42 void DrawPlayerLevels(int a1, char *text, POINT *pXY); // idb 43 void DrawPlayerLevels(int a1, char *text, POINT *pXY); // idb
47 void DrawPlayersWall(); 48 void DrawPlayersWall();
48 void DrawCards(); 49 void DrawCards();
49 void DrawCardAnimation(int a1); 50 void DrawCardAnimation(int a1);
50 int GetPlayerHandCardCount(int player_num); 51 int GetPlayerHandCardCount(int player_num);
51 signed int DrawCardsRectangles(int player_num); 52 signed int DrawCardsRectangles(int player_num);
52 bool am_40BCFB(int player_num, signed int card_slot_index); 53 bool DiscardCard(int player_num, signed int card_slot_index);
53 bool PlayCard(int player_num, signed int card_slot_num); 54 bool PlayCard(int player_num, signed int card_slot_num);
54 bool CanCardBePlayed(int player_num, int hand_card_indx); 55 bool CanCardBePlayed(int player_num, int hand_card_indx);
55 void ApplyCardToPlayer(int player_num, unsigned int uCardID); // idb 56 void ApplyCardToPlayer(int player_num, unsigned int uCardID); // idb
56 int am_40D2B4(POINT* a1, int a2); // weak 57 int am_40D2B4(POINT* a1, int a2); // weak
57 int ApplyDamageToBuildings(int player_num, int damage); // weak 58 int ApplyDamageToBuildings(int player_num, int damage); // weak
79 __int16 magic_level; 80 __int16 magic_level;
80 __int16 zoo_level; 81 __int16 zoo_level;
81 __int16 bricks_amount; 82 __int16 bricks_amount;
82 __int16 gems_amount; 83 __int16 gems_amount;
83 __int16 beasts_amount; 84 __int16 beasts_amount;
84 int field_14; 85 int mastery_lvl;
85 }; 86 };
86 #pragma pack(pop) 87 #pragma pack(pop)
87 ArcomageStartConditions start_conditions[13] = 88 const ArcomageStartConditions start_conditions[13] =
88 { 89 {
89 { 30, 100, 15, 5, 2, 2, 2, 10, 10, 10, 0}, 90 { 30, 100, 15, 5, 2, 2, 2, 10, 10, 10, 0},
90 { 50, 150, 20, 5, 2, 2, 2, 5, 5, 5, 1}, 91 { 50, 150, 20, 5, 2, 2, 2, 5, 5, 5, 1},
91 { 50, 150, 20, 5, 2, 2, 2, 5, 5, 5, 2}, 92 { 50, 150, 20, 5, 2, 2, 2, 5, 5, 5, 2},
92 { 75, 200, 25, 10, 3, 3, 3, 5, 5, 5, 2}, 93 { 75, 200, 25, 10, 3, 3, 3, 5, 5, 5, 2},
133 char field_B; 134 char field_B;
134 }; 135 };
135 #pragma pack(pop) 136 #pragma pack(pop)
136 137
137 138
139 #pragma pack(push, 1)
140 struct am_2
141 {
142 int slot_index;
143 int card_power;
144 };
145 #pragma pack(pop)
146
147 am_2 stru_4FA9B0[10];
148 std::array<__int16, 12> am_sounds;
149
138 char byte_4E185C = 1; // weak 150 char byte_4E185C = 1; // weak
139 char am_byte_4E185D = 1; // weak 151 char am_byte_4E185D = 1; // weak
140 char byte_4E185E = 1; // weak 152 char byte_4E185E = 1; // weak
141 153
142 int start_tower_height; 154 int start_tower_height;
152 int zoo_bonus = 1; 164 int zoo_bonus = 1;
153 165
154 int max_tower_height = 50; 166 int max_tower_height = 50;
155 int max_resources_amount = 100 ; 167 int max_resources_amount = 100 ;
156 168
157 int dword_4DF3A4; // weak 169 int opponent_mastery = 1 ; // weak
158 170
159 char byte_4FAA2C; // weak 171 char byte_4FAA2C; // weak
160 char byte_4FAA2D; // weak 172 char byte_4FAA2D; // weak
161 173
162 int current_player_num; // idb 174 int current_player_num; // idb
180 int dword_4FAA64; // weak 192 int dword_4FAA64; // weak
181 int dword_4FAA68; // weak 193 int dword_4FAA68; // weak
182 194
183 int dword_4FABB8; // weak 195 int dword_4FABB8; // weak
184 196
197 char byte_4FAA00; // weak
198
199 int amuint_4FAA34; // weak
200 int amuint_4FAA38; // weak
201 int amuint_4FAA4C; // weak
202
203 char byte_4FAA2E; // weak
204
205 int dword_4FAA70; // weak
206 char byte_4FAA74; // weak
207 char am_byte_4FAA75; // weak
208 char am_byte_4FAA76; // weak
209
210 int amuint_4FABC4; // weak
211
212
213 char byte_505880; // weak
214 char byte_505881; // weak
185 215
186 //----- (0040DD2F) -------------------------------------------------------- 216 //----- (0040DD2F) --------------------------------------------------------
187 bool stru273::_40DD2F() 217 bool stru273::_40DD2F()
188 { 218 {
189 219
426 pRenderer->Present(); 456 pRenderer->Present();
427 457
428 pTargetPoint.x = 0; 458 pTargetPoint.x = 0;
429 pTargetPoint.y = 0; 459 pTargetPoint.y = 0;
430 460
431 pSrcRect.left = 0; 461 pSrcRect.left = 0;
432 pSrcRect.right = 640; 462 pSrcRect.top = 0;
433 pSrcRect.top = 0; 463 pSrcRect.right = 640;
434 pSrcRect.bottom = 480; 464 pSrcRect.bottom = 480;
435 465
436 pRenderer->BeginScene(); 466 pRenderer->BeginScene();
437 pArcomageGame->pBlit_Copy_pixels = pPixels; 467 pArcomageGame->pBlit_Copy_pixels = pPixels;
438 Blt_Copy(&pSrcRect, &pTargetPoint, 2); 468 Blt_Copy(&pSrcRect, &pTargetPoint, 2);
756 pArcomageGame->pGameBackground.Load("layout.pcx", 2); 786 pArcomageGame->pGameBackground.Load("layout.pcx", 2);
757 pArcomageGame->pBackgroundPixels = pArcomageGame->pGameBackground.pPixels; 787 pArcomageGame->pBackgroundPixels = pArcomageGame->pGameBackground.pPixels;
758 return true; 788 return true;
759 } 789 }
760 790
791 int CalculateCardPower(ArcomagePlayer* player, ArcomagePlayer* enemy, ArcomageCard* pCard, int mastery)
792 {
793 enum V_INDX{
794 P_TOWER_M10,
795 P_WALL_M10,
796 E_TOWER,
797 E_WALL,
798 E_BUILDINGS,
799 E_QUARRY,
800 E_MAGIC,
801 E_ZOO,
802 E_RES,
803 V_INDEX_MAX
804 };
805
806 const int mastery_coeff[V_INDEX_MAX][2]= {{10, 5}, //P_TOWER_M10
807 {2, 1}, //P_WALL_M10
808 {1, 10}, //E_TOWER
809 {1, 3}, //E_WALL
810 {1, 7}, //E_BUILDINGS
811 {1, 5}, //E_QUARRY
812 {1, 40}, //E_MAGIC
813 {1, 40}, //E_ZOO
814 {1, 2} //E_RES
815 };
816 int card_power= 0;
817 int element_power;
818
819
820 if ( pCard->to_player_tower == 99 || pCard->to_pl_enm_tower == 99||
821 pCard->to_player_tower2 == 99 || pCard->to_pl_enm_tower2 == 99 )
822 element_power = enemy->tower_height - player->tower_height;
823 else
824 element_power = pCard->to_player_tower + pCard->to_pl_enm_tower + pCard->to_player_tower2 + pCard->to_pl_enm_tower2;
825
826 if ( player->tower_height >= 10 )
827 card_power += mastery_coeff[P_TOWER_M10][mastery]*element_power;
828 else
829 card_power += 20*element_power;
830
831
832 if ( pCard->to_player_wall == 99 || pCard->to_pl_enm_wall == 99 ||
833 pCard->to_player_wall2 == 99 || pCard->to_pl_enm_wall2 == 99 )
834 element_power = enemy->wall_height - player->wall_height;
835 else
836 element_power = pCard->to_player_wall + pCard->to_pl_enm_wall +
837 pCard->to_player_wall2 + pCard->to_pl_enm_wall2;
838 if ( player->wall_height >= 10 )
839 card_power += mastery_coeff[P_WALL_M10][mastery]*element_power; //1
840 else
841 card_power += 5*element_power;
842
843
844 card_power += 7 * (pCard->to_player_buildings + pCard->to_pl_enm_buildings +
845 pCard->to_player_buildings2 + pCard->to_pl_enm_buildings2);
846
847 if ( pCard->to_player_quarry_lvl == 99 || pCard->to_pl_enm_quarry_lvl == 99 ||
848 pCard->to_player_quarry_lvl2 == 99 || pCard->to_pl_enm_quarry_lvl2 == 99 )
849 element_power = enemy->quarry_level - player->quarry_level;
850 else
851 element_power = pCard->to_player_quarry_lvl + pCard->to_pl_enm_quarry_lvl +
852 pCard->to_player_quarry_lvl2 + pCard->to_pl_enm_quarry_lvl;
853
854 card_power += 40 * element_power;
855
856 if ( pCard->to_player_magic_lvl == 99 || pCard->to_pl_enm_magic_lvl == 99 ||
857 pCard->to_player_magic_lvl2 == 99 || pCard->to_pl_enm_magic_lvl2 == 99 )
858 element_power = enemy->magic_level - player->magic_level;
859 else
860 element_power = pCard->to_player_magic_lvl + pCard->to_pl_enm_magic_lvl +
861 pCard->to_player_magic_lvl2 + pCard->to_pl_enm_magic_lvl2;
862 card_power += 40 *element_power;
863
864 if ( pCard->to_player_zoo_lvl == 99 || pCard->to_pl_enm_zoo_lvl == 99 ||
865 pCard->to_player_zoo_lvl2 == 99 || pCard->to_pl_enm_zoo_lvl2 == 99 )
866 element_power = enemy->zoo_level - player->zoo_level;
867 else
868 element_power = pCard->to_player_zoo_lvl + pCard->to_pl_enm_zoo_lvl +
869 pCard->to_player_zoo_lvl2 + pCard->to_pl_enm_zoo_lvl2;
870 card_power += 40 *element_power;
871
872 if ( pCard->to_player_bricks == 99 || pCard->to_pl_enm_bricks == 99 ||
873 pCard->to_player_bricks2 == 99 || pCard->to_pl_enm_bricks2 == 99 )
874 element_power = enemy->resource_bricks - player->resource_bricks;
875 else
876 element_power = pCard->to_player_bricks + pCard->to_pl_enm_bricks +
877 pCard->to_player_bricks2 + pCard->to_pl_enm_bricks2;
878 card_power += 2 *element_power;
879
880
881 if ( pCard->to_player_gems == 99 || pCard->to_pl_enm_gems == 99 ||
882 pCard->to_player_gems2 == 99 || pCard->to_pl_enm_gems2 == 99 )
883 element_power = enemy->resource_gems - player->resource_gems;
884 else
885 element_power = pCard->to_player_gems + pCard->to_pl_enm_gems +
886 pCard->to_player_gems2 + pCard->to_pl_enm_gems2;
887 card_power += 2 *element_power;
888
889 if ( pCard->to_player_beasts == 99 || pCard->to_pl_enm_beasts == 99 ||
890 pCard->to_player_beasts2 == 99 || pCard->to_pl_enm_beasts2 == 99 )
891 element_power = enemy->resource_beasts - player->resource_beasts;
892 else
893 element_power = pCard->to_player_beasts + pCard->to_pl_enm_beasts +
894 pCard->to_player_beasts2 + pCard->to_pl_enm_beasts2;
895 card_power += 2 *element_power;
896
897 if ( pCard->to_enemy_tower == 99 || pCard->to_enemy_tower2 == 99 )
898 element_power = player->tower_height - enemy->tower_height;
899 else
900 element_power = -(pCard->to_enemy_tower + pCard->to_enemy_tower2);
901 card_power += mastery_coeff[E_TOWER][mastery]*element_power;
902
903 if ( pCard->to_enemy_wall == 99 || pCard->to_enemy_wall2 == 99 )
904 element_power = player->wall_height - enemy->wall_height;
905 else
906 element_power = -(pCard->to_enemy_wall + pCard->to_enemy_wall2);
907 card_power += mastery_coeff[E_WALL][mastery]*element_power;
908
909 card_power -= mastery_coeff[E_BUILDINGS][mastery]*(pCard->to_enemy_buildings + pCard->to_enemy_buildings2);
910
911 if ( pCard->to_enemy_quarry_lvl == 99 || pCard->to_enemy_quarry_lvl2 == 99 )
912 element_power = player->quarry_level - enemy->quarry_level; //5
913 else
914 element_power = -(pCard->to_enemy_quarry_lvl + pCard->to_enemy_quarry_lvl2); //5
915 card_power += mastery_coeff[E_QUARRY][mastery]*element_power;
916
917 if ( pCard->to_enemy_magic_lvl == 99 || pCard->to_enemy_magic_lvl2 == 99 )
918 element_power = player->magic_level - enemy->magic_level; //40
919 else
920 element_power = -(pCard->to_enemy_magic_lvl + pCard->to_enemy_magic_lvl2);
921 card_power += mastery_coeff[E_MAGIC][mastery]*element_power;
922
923 if ( pCard->to_enemy_zoo_lvl == 99 || pCard->to_enemy_zoo_lvl2 == 99 )
924 element_power = player->zoo_level - enemy->zoo_level; //40
925 else
926 element_power = -(pCard->to_enemy_zoo_lvl + pCard->to_enemy_zoo_lvl2);
927 card_power += mastery_coeff[E_ZOO][mastery]*element_power;
928
929 if ( pCard->to_enemy_bricks == 99 || pCard->to_enemy_bricks2 == 99 )
930 element_power = player->resource_bricks - enemy->resource_bricks; //2
931 else
932 element_power = -(pCard->to_enemy_bricks + pCard->to_enemy_bricks2);
933 card_power += mastery_coeff[E_RES][mastery]*element_power;
934
935 if ( pCard->to_enemy_gems == 99 || pCard->to_enemy_gems2 == 99 )
936 element_power = player->resource_gems - enemy->resource_gems; //2
937 else
938 element_power = -(pCard->to_enemy_gems + pCard->to_enemy_gems2);
939 card_power += mastery_coeff[E_RES][mastery]*element_power;
940
941 if ( pCard->to_enemy_beasts == 99 || pCard->to_enemy_beasts2 == 99 )
942 element_power = player->resource_beasts - enemy->resource_beasts; //2
943 else
944 element_power = -(pCard->to_enemy_beasts + pCard->to_enemy_beasts2);
945 card_power += mastery_coeff[E_RES][mastery]*element_power;
946
947 if ( pCard->field_30 || pCard->field_4D )
948 card_power *= 10;
949
950 if ( pCard->field_24 == 1 )
951 element_power = player->resource_bricks - pCard->needed_bricks;
952 else if ( pCard->field_24 == 2 )
953 element_power = player->resource_gems - pCard->needed_gems;
954 else if (pCard->field_24 == 3)
955 element_power = player->resource_beasts - pCard->needed_beasts;
956 if ( element_power > 3 )
957 element_power = 3;
958 card_power += 5 * element_power;
959
960 if ( enemy->tower_height <= pCard->to_enemy_tower2 + pCard->to_enemy_tower )
961 card_power += 9999;
962
963 if (pCard->to_enemy_tower2 + pCard->to_enemy_tower +
964 pCard->to_enemy_wall + pCard->to_enemy_wall2 +
965 pCard->to_enemy_buildings + pCard->to_enemy_buildings2 >= enemy->wall_height + enemy->tower_height)
966 card_power += 9999;
967
968 if ( (pCard->to_player_tower2 + pCard->to_pl_enm_tower2 +
969 pCard->to_player_tower + pCard->to_pl_enm_tower + player->tower_height) >= max_tower_height )
970 card_power += 9999;
971
972 return card_power;
973 }
974
975
761 //----- (00408BB4) -------------------------------------------------------- 976 //----- (00408BB4) --------------------------------------------------------
762 bool __fastcall am_408BB4(int a1) 977 bool OpponentsAITurn(int player_num)
763 { 978 {
764 // char result; // al@3 979
765 // signed int v3; // ebx@8 980 char result; // al@3
766 // int v4; // esi@8 981 signed int v2; // ebx@8
767 // int v5; // eax@9 982 int v3; // esi@8
768 // int v6; // edi@9 983 int all_player_cards_count; // eax@9
769 // int v7; // eax@11 984 int random_card_slot; // edi@9
770 // signed int v8; // eax@11 985 int v6; // eax@11
771 // int v9; // ebx@5 986 signed int v7; // eax@11
772 // int v10; // eax@5 987 int v8; // ebx@5
773 // int v11; // ecx@18 988 int v9; // eax@5
774 // char v12; // bl@20 989 int v10; // ecx@18
775 // int v13; // eax@20 990 int v11; // eax@20
776 // ArcomageCard *v14; // ecx@20 991 ArcomageCard *v12; // ecx@20
777 // char v15; // dl@20 992 char v13; // dl@20
778 // char v16; // dl@24 993 char v14; // dl@24
779 // int v17; // edx@25 994 int v15; // edx@25
780 // int v18; // edx@27 995 int v16; // edx@27
781 // char v19; // dl@31 996 char v17; // dl@31
782 // int v20; // edx@32 997 int v18; // edx@32
783 // char v21; // dl@35 998 char v19; // dl@35
784 // char v22; // dl@39 999 char v20; // dl@39
785 // int v23; // edx@40 1000 int v21; // edx@40
786 // char v24; // dl@45 1001 char v22; // dl@45
787 // int v25; // edx@46 1002 int v23; // edx@46
788 // char v26; // dl@52 1003 char v24; // dl@52
789 // int v27; // edx@53 1004 int v25; // edx@53
790 // char v28; // dl@58 1005 char v26; // dl@58
791 // int v29; // edx@59 1006 int v27; // edx@59
792 // char v30; // dl@64 1007 char v28; // dl@64
793 // int v31; // edx@65 1008 int v29; // edx@65
794 // char v32; // dl@70 1009 char v30; // dl@70
795 // int v33; // edx@71 1010 int v31; // edx@71
796 // char v34; // dl@76 1011 char v32; // dl@76
797 // int v35; // edx@77 1012 int v33; // edx@77
798 // char v36; // dl@82 1013 char v34; // dl@82
799 // int v37; // edx@83 1014 int v35; // edx@83
800 // char v38; // dl@86 1015 char v36; // dl@86
801 // char v39; // dl@90 1016 char v37; // dl@90
802 // int v40; // edi@93 1017 int v38; // edi@93
803 // char v41; // dl@93 1018 char v39; // dl@93
804 // int v42; // esi@93 1019 int v40; // esi@93
805 // char v43; // bl@94 1020 char v41; // bl@94
806 // int v44; // esi@95 1021 char v42; // dl@98
807 // char v45; // dl@99 1022 char v43; // dl@102
808 // char v46; // dl@103 1023 char v44; // dl@106
809 // char v47; // dl@107 1024 char v45; // dl@110
810 // char v48; // dl@111 1025 char v46; // dl@114
811 // char v49; // dl@115 1026 ArcomagePlayer *v47; // ebx@115
812 // ArcomagePlayer *v50; // ebx@116 1027 ArcomagePlayer *v48; // edx@115
813 // ArcomagePlayer *v51; // edx@116 1028 int v49; // esi@123
814 // int v52; // esi@124 1029 int v50; // edx@123
815 // int v53; // edx@124 1030 int v51; // edx@126
816 // int v54; // edx@127 1031 int v52; // esi@129
817 // int v55; // esi@130 1032 int v53; // edi@137
818 // int v56; // edi@138 1033 int j; // esi@137
819 // int l; // esi@138 1034 am_2 *v55; // eax@139
820 // int v58; // eax@140 1035 int v56; // ecx@141
821 // int v59; // ecx@142 1036 int v57; // edx@141
822 // int v60; // edx@142 1037 int v58; // ebx@141
823 // int v61; // ebx@142 1038 int v59; // eax@144
824 // int v62; // eax@145 1039 int v60; // esi@145
825 // int v63; // esi@146 1040 int v61; // ebx@4
826 // int v64; // ebx@4 1041 int v62; // eax@4
827 // int v65; // eax@4 1042 int v63; // ecx@167
828 // int v66; // ecx@168 1043 int v64; // eax@169
829 // char v67; // bl@170 1044 ArcomageCard *pCard; // ecx@169
830 // int v68; // eax@170 1045 char v66; // dl@169
831 // ArcomageCard *v69; // ecx@170 1046 char v67; // dl@173
832 // char v70; // dl@170 1047 int v68; // edx@174
833 // char v71; // dl@174 1048 int v69; // edx@176
834 // int v72; // edx@175 1049 char v70; // dl@180
835 // int v73; // edx@177 1050 char v71; // dl@183
836 // char v74; // dl@181 1051 char v72; // dl@187
837 // char v75; // dl@184 1052 int v73; // edx@188
838 // char v76; // dl@188 1053 char v74; // dl@193
839 // int v77; // edx@189 1054 char v75; // dl@199
840 // char v78; // dl@194 1055 int v76; // edx@200
841 // char v79; // dl@200 1056 char v77; // dl@205
842 // int v80; // edx@201 1057 int v78; // edx@206
843 // char v81; // dl@206 1058 char v79; // dl@211
844 // int v82; // edx@207 1059 int v80; // edx@212
845 // char v83; // dl@212 1060 char v81; // dl@217
846 // int v84; // edx@213 1061 int v82; // edx@218
847 // char v85; // dl@218 1062 char v83; // dl@223
848 // int v86; // edx@219 1063 int v84; // edx@224
849 // char v87; // dl@224 1064 char v85; // dl@229
850 // int v88; // edx@225 1065 int v86; // edx@230
851 // char v89; // dl@230 1066 char v87; // dl@233
852 // int v90; // edx@231 1067 int v88; // edx@234
853 // char v91; // dl@234 1068 char v89; // dl@237
854 // int v92; // edx@235 1069 int v90; // edx@238
855 // char v93; // dl@238 1070 int v91; // esi@240
856 // int v94; // edx@239 1071 char v92; // dl@240
857 // int v95; // esi@241 1072 int v93; // esi@240
858 // char v96; // dl@241 1073 char v94; // bl@241
859 // int v97; // esi@241 1074 int v95; // edx@243
860 // char v98; // bl@242 1075 int v96; // edi@244
861 // int v99; // edi@243 1076 char v97; // dl@245
862 // int v100; // edx@245 1077 int v98; // edx@246
863 // int v101; // edi@246 1078 char v99; // dl@249
864 // char v102; // dl@247 1079 int v100; // edx@250
865 // int v103; // edx@248 1080 char v101; // dl@253
866 // char v104; // dl@251 1081 int v102; // edx@254
867 // int v105; // edx@252 1082 char v103; // dl@257
868 // char v106; // dl@255 1083 int v104; // edx@258
869 // int v107; // edx@256 1084 char v105; // dl@261
870 // char v108; // dl@259 1085 ArcomagePlayer *v106; // ebx@262
871 // int v109; // edx@260 1086 ArcomagePlayer *v107; // edx@262
872 // char v110; // dl@263 1087 int v108; // esi@270
873 // ArcomagePlayer *v111; // ebx@264 1088 int v109; // edx@270
874 // ArcomagePlayer *v112; // edx@264 1089 int v110; // edx@273
875 // int v113; // esi@272 1090 int v111; // esi@276
876 // int v114; // edx@272 1091 int v112; // edi@284
877 // int v115; // edx@275 1092 // int j; // esi@284
878 // int v116; // esi@278 1093 am_2 *v114; // eax@286
879 // int v117; // edi@286 1094 int v115; // ecx@288
880 // int j; // esi@286 1095 int v116; // edx@288
881 // int v119; // eax@288 1096 int v117; // ebx@288
882 // int v120; // ecx@290 1097 int v118; // eax@291
883 // int v121; // edx@290 1098 int v119; // esi@292
884 // int v122; // ebx@290 1099 int v120; // [sp-28h] [bp-28h]@129
885 // int v123; // eax@293 1100 int v121; // [sp-28h] [bp-28h]@276
886 // int v124; // esi@294 1101 int k; // [sp-24h] [bp-24h]@18
887 // int v125; // [sp-28h] [bp-28h]@130 1102 int i; // [sp-24h] [bp-24h]@167
888 // int v126; // [sp-28h] [bp-28h]@278 1103 int v124; // [sp-20h] [bp-20h]@5
889 // int k; // [sp-24h] [bp-24h]@18 1104 int v125; // [sp-20h] [bp-20h]@4
890 // int i; // [sp-24h] [bp-24h]@168 1105 int v126; // [sp-1Ch] [bp-1Ch]@17
891 // int v129; // [sp-20h] [bp-20h]@5 1106 int v127; // [sp-1Ch] [bp-1Ch]@139
892 // int v130; // [sp-20h] [bp-20h]@4 1107 int v128; // [sp-1Ch] [bp-1Ch]@166
893 // int v131; // [sp-1Ch] [bp-1Ch]@17 1108 int v129; // [sp-1Ch] [bp-1Ch]@286
894 // int v132; // [sp-1Ch] [bp-1Ch]@140 1109 int v130; // [sp-18h] [bp-18h]@5
895 // int v133; // [sp-1Ch] [bp-1Ch]@167 1110 int cards_count; // [sp-18h] [bp-18h]@4
896 // int v134; // [sp-1Ch] [bp-1Ch]@288 1111 int v132; // [sp-14h] [bp-14h]@0
897 // int v135; // [sp-18h] [bp-18h]@5 1112 int v133; // [sp-14h] [bp-14h]@93
898 // int v136; // [sp-18h] [bp-18h]@4 1113 int v134; // [sp-14h] [bp-14h]@129
899 // signed int v137; // [sp-14h] [bp-14h]@0 1114 int v135; // [sp-14h] [bp-14h]@240
900 // int v138; // [sp-14h] [bp-14h]@93 1115 int v136; // [sp-14h] [bp-14h]@276
901 // int v139; // [sp-14h] [bp-14h]@130 1116 ArcomagePlayer *enemy; // [sp-10h] [bp-10h]@5
902 // int v140; // [sp-14h] [bp-14h]@241 1117 ArcomagePlayer *enemy1; // [sp-10h] [bp-10h]@4
903 // int v141; // [sp-14h] [bp-14h]@278 1118 ArcomagePlayer *player; // [sp-Ch] [bp-Ch]@5
904 // ArcomagePlayer *v142; // [sp-10h] [bp-10h]@5 1119 ArcomagePlayer *player1; // [sp-Ch] [bp-Ch]@4
905 // ArcomagePlayer *v143; // [sp-10h] [bp-10h]@4 1120 char v141; // [sp-8h] [bp-8h]@35
906 // ArcomagePlayer *v144; // [sp-Ch] [bp-Ch]@5 1121 char v142; // [sp-8h] [bp-8h]@183
907 // ArcomagePlayer *v145; // [sp-Ch] [bp-Ch]@4 1122 char v143; // [sp-5h] [bp-5h]@20
908 // char v146; // [sp-8h] [bp-8h]@35 1123 char v144; // [sp-5h] [bp-5h]@169
909 // char v147; // [sp-8h] [bp-8h]@184 1124
910 // char v148; // [sp-5h] [bp-5h]@20 1125 byte_4FAA00 = 1;
911 // char v149; // [sp-5h] [bp-5h]@170 1126 if ( opponent_mastery == 0)
912 // 1127 {
913 // byte_4FAA00 = 1; 1128 if ( hand_full==0 ) //am_byte_4FAA77
914 // if ( dword_4DF3A4 ) 1129 {
915 // { 1130 for(int i = 0; i<10 ; ++i )
916 // if ( dword_4DF3A4 != 1 ) 1131 {
917 // { 1132 all_player_cards_count = GetPlayerHandCardCount(player_num);
918 // result = dword_4DF3A4 - 2; 1133 random_card_slot = rand_interval(0, all_player_cards_count - 1);
919 // if ( dword_4DF3A4 != 2 ) 1134 if ( CanCardBePlayed(player_num, random_card_slot) )
920 // return result != 0; 1135 return PlayCard(player_num, random_card_slot);
921 // v64 = a1; 1136 }
922 // v145 = &stru_505708[a1]; 1137 }
923 // v130 = a1; 1138 all_player_cards_count = GetPlayerHandCardCount(player_num);
924 // v143 = &stru_505708[(a1 + 1) % 2]; 1139 random_card_slot= rand_interval(0, all_player_cards_count - 1);
925 // v136 = GetPlayerHandCardCount(a1); 1140 return DiscardCard(player_num, random_card_slot);
926 // v65 = 0; 1141 }
927 // do 1142 else if (( opponent_mastery == 1 )|| ( opponent_mastery == 2 ))
928 // { 1143 {
929 // if ( v65 >= v136 ) 1144 v8 = player_num;
930 // { 1145
931 // dword_4FA9B0[2 * v65] = -1; 1146 v124 = player_num;
932 // dword_4FA9B4[2 * v65] = -9999; 1147 player = &am_Players[player_num];
933 // } 1148 enemy = &am_Players[(player_num + 1) % 2];
934 // else 1149 all_player_cards_count = GetPlayerHandCardCount(player_num);
935 // { 1150 for(int i = 0; i<10 ; ++i )
936 // dword_4FA9B0[2 * v65] = v65; 1151 {
937 // dword_4FA9B4[2 * v65] = 0; 1152 if ( i >= all_player_cards_count )
938 // } 1153 {
939 // ++v65; 1154 stru_4FA9B0[i].slot_index = -1;
940 // } 1155 stru_4FA9B0[i].card_power = -9999;
941 // while ( v65 < 10 ); 1156 }
942 // v133 = 0; 1157 else
943 // if ( v136 > 0 ) 1158 {
944 // { 1159 stru_4FA9B0[i].slot_index = i;
945 // v66 = 47 * v64; 1160 stru_4FA9B0[i].card_power = 0;
946 // for ( i = 47 * v64; ; v66 = i ) 1161 }
947 // { 1162 }
948 // v67 = 99; 1163 for(int i = 0; i< all_player_cards_count ; ++i )
949 // v68 = 2 * v133; 1164 {
950 // v69 = &pCards[stru_505708[0].cards_at_hand[v66 + dword_4FA9B0[2 * v133]]]; 1165 v12 = &pCards[am_Players[player_num].cards_at_hand[stru_4FA9B0[i].slot_index]];
951 // v70 = v69->field_38[2]; 1166 stru_4FA9B0[i].card_power = CalculateCardPower(player, enemy, v12, opponent_mastery-1);
952 // v149 = v69->field_38[2]; 1167 }
953 // if ( v145->field_24 >= 10 ) 1168
954 // { 1169 for (int j = all_player_cards_count - 1; j >= 0; --j )
955 // if ( v70 == 99 1170 {
956 // || v69->field_48[4] == 99 1171 for (int m=0; m<j; ++m )
957 // || v69->field_48[15] == 99 1172 {
958 // || (v74 = BYTE1(v69->field_68), v74 == 99) ) 1173 if ( stru_4FA9B0[m].card_power < stru_4FA9B0[m+1].card_power )
959 // v73 = 5 * (v143->field_24 - v145->field_24); 1174 {
960 // else 1175 v56 = stru_4FA9B0[m].slot_index;
961 // v73 = 5 * (v149 + v69->field_48[4] + v69->field_48[15] + v74); 1176 v57 = stru_4FA9B0[m].card_power;
962 // } 1177 stru_4FA9B0[m].slot_index = stru_4FA9B0[m+1].slot_index;
963 // else 1178 stru_4FA9B0[m].card_power = stru_4FA9B0[m+1].card_power;
964 // { 1179 stru_4FA9B0[m+1].slot_index = v56;
965 // if ( v70 == 99 1180 stru_4FA9B0[m+1].card_power = v57;
966 // || v69->field_48[4] == 99 1181 }
967 // || v69->field_48[15] == 99 1182 }
968 // || (v71 = BYTE1(v69->field_68), v71 == 99) ) 1183 }
969 // v72 = 5 * (v143->field_24 - v145->field_24); 1184 v59 = all_player_cards_count - 1;
970 // else 1185 if ( hand_full )
971 // v72 = 5 * (v149 + v69->field_48[4] + v69->field_48[15] + v71); 1186 {
972 // v73 = 4 * v72; 1187 if ( all_player_cards_count - 1 >= 0 )
973 // } 1188 {
974 // dword_4FA9B4[v68] += v73; 1189 while ( !pCards[am_Players[player_num].cards_at_hand[stru_4FA9B0[v59].slot_index]].attack_or_defence )
975 // v75 = v69->field_38[1]; 1190 {
976 // v147 = v69->field_38[1]; 1191 --v59;
977 // if ( v145->field_28 >= 10 ) 1192 if ( v59 < 0 )
978 // { 1193 return DiscardCard(player_num, v132);
979 // if ( v75 == 99 1194 }
980 // || v69->field_48[3] == 99 1195 v132 = stru_4FA9B0[v59].slot_index;
981 // || v69->field_48[14] == 99 1196 }
982 // || (v78 = LOBYTE(v69->field_68), v78 == 99) ) 1197 }
983 // v77 = v143->field_28 - v145->field_28; 1198 else
984 // else 1199 {
985 // v77 = v147 + v69->field_48[3] + v69->field_48[14] + v78; 1200 v60 = 0;
986 // } 1201 if ( all_player_cards_count - 1 >= 0 )
987 // else 1202 {
988 // { 1203 while ( !pCards[am_Players[player_num].cards_at_hand[stru_4FA9B0[v59].slot_index]].attack_or_defence )
989 // if ( v75 == 99 1204 {
990 // || v69->field_48[3] == 99 1205 --v59;
991 // || v69->field_48[14] == 99 1206 if ( v59 < 0 )
992 // || (v76 = LOBYTE(v69->field_68), v76 == 99) ) 1207 goto LABEL_150;
993 // v77 = 5 * (v143->field_28 - v145->field_28); 1208 }
994 // else 1209 v132 = stru_4FA9B0[v59].slot_index;
995 // v77 = 5 * (v147 + v69->field_48[3] + v69->field_48[14] + v76); 1210 }
996 // } 1211 LABEL_150:
997 // dword_4FA9B4[v68] += v77; 1212 if ( v130 > 0 )
998 // dword_4FA9B4[v68] += 7 * (v69->field_38[0] + v69->field_48[2] + v69->field_48[13] + v69->field_58[15]); 1213 {
999 // if ( BYTE2(v69->field_30) == 99 1214 while ( !CanCardBePlayed(player_num, stru_4FA9B0[v60].slot_index) || stru_4FA9B0[v60].card_power < 0 )
1000 // || v69->field_38[12] == 99 1215 {
1001 // || v69->field_48[7] == 99 1216 ++v60;
1002 // || (v79 = v69->field_58[9], v79 == 99) ) 1217 if ( v60 >= v130 )
1003 // v80 = 5 * (v143->field_2C - v145->field_2C); 1218 return DiscardCard(player_num, v132);
1004 // else 1219 }
1005 // v80 = 5 * (BYTE2(v69->field_30) + v69->field_38[12] + v69->field_48[7] + v79); 1220 return PlayCard(v8, stru_4FA9B0[v60].slot_index);
1006 // dword_4FA9B4[v68] += 8 * v80; 1221 }
1007 // if ( BYTE3(v69->field_30) == 99 1222 }
1008 // || v69->field_38[13] == 99 1223 return DiscardCard(player_num, v132);
1009 // || v69->field_48[8] == 99 1224 }
1010 // || (v81 = v69->field_58[10], v81 == 99) ) 1225
1011 // v82 = 5 * (v143->field_30 - v145->field_30); 1226
1012 // else
1013 // v82 = 5 * (BYTE3(v69->field_30) + v69->field_38[13] + v69->field_48[8] + v81);
1014 // dword_4FA9B4[v68] += 8 * v82;
1015 // if ( LOBYTE(v69->field_34) == 99
1016 // || v69->field_38[14] == 99
1017 // || v69->field_48[9] == 99
1018 // || (v83 = v69->field_58[11], v83 == 99) )
1019 // v84 = 5 * (v143->field_34 - v145->field_34);
1020 // else
1021 // v84 = 5 * (LOBYTE(v69->field_34) + v69->field_38[14] + v69->field_48[9] + v83);
1022 // dword_4FA9B4[v68] += 8 * v84;
1023 // if ( BYTE1(v69->field_34) == 99
1024 // || v69->field_38[15] == 99
1025 // || v69->field_48[10] == 99
1026 // || (v85 = v69->field_58[12], v85 == 99) )
1027 // v86 = v143->field_38 - v145->field_38;
1028 // else
1029 // v86 = BYTE1(v69->field_34) + v69->field_38[15] + v69->field_48[10] + v85;
1030 // dword_4FA9B4[v68] += 2 * v86;
1031 // if ( BYTE2(v69->field_34) == 99
1032 // || v69->field_48[0] == 99
1033 // || v69->field_48[11] == 99
1034 // || (v87 = v69->field_58[13], v87 == 99) )
1035 // v88 = v143->field_3C - v145->field_3C;
1036 // else
1037 // v88 = BYTE2(v69->field_34) + v69->field_48[0] + v69->field_48[11] + v87;
1038 // dword_4FA9B4[v68] += 2 * v88;
1039 // if ( BYTE3(v69->field_34) == 99
1040 // || v69->field_48[1] == 99
1041 // || v69->field_48[12] == 99
1042 // || (v89 = v69->field_58[14], v89 == 99) )
1043 // v90 = v143->field_40 - v145->field_40;
1044 // else
1045 // v90 = BYTE3(v69->field_34) + v69->field_48[1] + v69->field_48[12] + v89;
1046 // dword_4FA9B4[v68] += 2 * v90;
1047 // if ( v69->field_38[11] == 99 || (v91 = v69->field_58[8], v91 == 99) )
1048 // v92 = 10 * (v145->field_24 - v143->field_24);
1049 // else
1050 // v92 = -10 * (v69->field_38[11] + v91);
1051 // dword_4FA9B4[v68] += v92;
1052 // if ( v69->field_38[10] == 99 || (v93 = v69->field_58[7], v93 == 99) )
1053 // v94 = 3 * (v145->field_28 - v143->field_28);
1054 // else
1055 // v94 = -3 * (v69->field_38[10] + v93);
1056 // dword_4FA9B4[v68] += v94;
1057 // v95 = v69->field_38[9];
1058 // v140 = v95;
1059 // v96 = v69->field_38[3];
1060 // dword_4FA9B4[v68] += -7 * (v69->field_58[6] + v95);
1061 // v97 = dword_4FA9B4[v68];
1062 // if ( v96 == 99 )
1063 // goto LABEL_245;
1064 // v98 = v69->field_58[0];
1065 // if ( v98 == 99 )
1066 // break;
1067 // v99 = v96 + v98;
1068 // v67 = 99;
1069 // dword_4FA9B4[v68] = v97 - 5 * v99;
1070 //LABEL_246:
1071 // v101 = v140;
1072 // if ( v69->field_38[4] == v67 || (v102 = v69->field_58[1], v102 == v67) )
1073 // v103 = 5 * (v145->field_30 - v143->field_30);
1074 // else
1075 // v103 = -5 * (v69->field_38[4] + v102);
1076 // dword_4FA9B4[v68] += v103;
1077 // if ( v69->field_38[5] == v67 || (v104 = v69->field_58[2], v104 == v67) )
1078 // v105 = 5 * (v145->field_34 - v143->field_34);
1079 // else
1080 // v105 = -5 * (v69->field_38[5] + v104);
1081 // dword_4FA9B4[v68] += v105;
1082 // if ( v69->field_38[6] == v67 || (v106 = v69->field_58[3], v106 == v67) )
1083 // v107 = v145->field_38 - v143->field_38;
1084 // else
1085 // v107 = -(v69->field_38[6] + v106);
1086 // dword_4FA9B4[v68] += 2 * v107;
1087 // if ( v69->field_38[7] == v67 || (v108 = v69->field_58[4], v108 == v67) )
1088 // v109 = v145->field_3C - v143->field_3C;
1089 // else
1090 // v109 = -(v69->field_38[7] + v108);
1091 // dword_4FA9B4[v68] += 2 * v109;
1092 // if ( v69->field_38[8] == v67 || (v110 = v69->field_58[5], v110 == v67) )
1093 // {
1094 // v112 = v145;
1095 // v111 = v143;
1096 // dword_4FA9B4[v68] += 2 * (v145->field_40 - v143->field_40);
1097 // }
1098 // else
1099 // {
1100 // v111 = v143;
1101 // dword_4FA9B4[v68] += -2 * (v69->field_38[8] + v110);
1102 // v112 = v145;
1103 // }
1104 // if ( LOBYTE(v69->field_30) || v69->field_48[5] )
1105 // dword_4FA9B4[v68] *= 10;
1106 // if ( LOBYTE(v69->field_24) == 1 )
1107 // {
1108 // v113 = LOBYTE(v69->field_28);
1109 // v114 = v112->field_38;
1110 // }
1111 // else
1112 // {
1113 // if ( LOBYTE(v69->field_24) == 2 )
1114 // {
1115 // v113 = BYTE1(v69->field_28);
1116 // v114 = v112->field_3C;
1117 // }
1118 // else
1119 // {
1120 // if ( LOBYTE(v69->field_24) != 3 )
1121 // goto LABEL_278;
1122 // v113 = BYTE2(v69->field_28);
1123 // v114 = v112->field_40;
1124 // }
1125 // }
1126 // v115 = v114 - v113;
1127 // if ( v115 > 3 )
1128 // v115 = 3;
1129 // dword_4FA9B4[v68] += 5 * v115;
1130 //LABEL_278:
1131 // v116 = v69->field_58[8];
1132 // v141 = v111->field_24;
1133 // v126 = v69->field_38[11];
1134 // if ( v141 <= v116 + v126 )
1135 // dword_4FA9B4[v68] += 9999;
1136 // v137 = v111->field_28 + v141;
1137 // if ( v137 <= v116 + v126 + v69->field_58[6] + v69->field_58[7] + v101 + v69->field_38[10] )
1138 // dword_4FA9B4[v68] += 9999;
1139 // if ( v69->field_48[15] + (signed int)BYTE1(v69->field_68) + v145->field_24 + v69->field_48[4] + v149 >= dword_4E1884 )
1140 // dword_4FA9B4[v68] += 9999;
1141 // ++v133;
1142 // if ( v133 >= v136 )
1143 // {
1144 // v64 = v130;
1145 // goto LABEL_286;
1146 // }
1147 // }
1148 // v67 = 99;
1149 //LABEL_245:
1150 // v100 = v145->field_2C - v143->field_2C;
1151 // dword_4FA9B4[v68] = v97 + 4 * v100 + v100;
1152 // goto LABEL_246;
1153 // }
1154 //LABEL_286:
1155 // v117 = v136 - 1;
1156 // for ( j = v136 - 1; j >= 0; --j )
1157 // {
1158 // v137 = 0;
1159 // if ( j > 0 )
1160 // {
1161 // v119 = (int)dword_4FA9B0;
1162 // v134 = j;
1163 // v137 = j;
1164 // do
1165 // {
1166 // if ( *(unsigned int *)(v119 + 4) < *(unsigned int *)(v119 + 12) )
1167 // {
1168 // v120 = *(unsigned int *)v119;
1169 // v121 = *(unsigned int *)(v119 + 4);
1170 // *(unsigned int *)v119 = *(unsigned int *)(v119 + 8);
1171 // v122 = *(unsigned int *)(v119 + 12);
1172 // *(unsigned int *)(v119 + 8) = v120;
1173 // *(unsigned int *)(v119 + 4) = v122;
1174 // v64 = v130;
1175 // *(unsigned int *)(v119 + 12) = v121;
1176 // }
1177 // v119 += 8;
1178 // --v134;
1179 // }
1180 // while ( v134 );
1181 // }
1182 // }
1183 // v123 = v136 - 1;
1184 // if ( am_byte_4FAA77 )
1185 // {
1186 // if ( v117 >= 0 )
1187 // {
1188 // while ( !BYTE3(pCards[stru_505708[0].cards_at_hand[47 * v64 + dword_4FA9B0[2 * v123]]].field_28) )
1189 // {
1190 // --v123;
1191 // if ( v123 < 0 )
1192 // return am_40BCFB(v64, v137) != 0;
1193 // }
1194 // v137 = dword_4FA9B0[2 * v123];
1195 // }
1196 // }
1197 // else
1198 // {
1199 // v124 = 0;
1200 // if ( v117 >= 0 )
1201 // {
1202 // while ( !BYTE3(pCards[stru_505708[0].cards_at_hand[47 * v64 + dword_4FA9B0[2 * v123]]].field_28) )
1203 // {
1204 // --v123;
1205 // if ( v123 < 0 )
1206 // goto LABEL_299;
1207 // }
1208 // v137 = dword_4FA9B0[2 * v123];
1209 // }
1210 //LABEL_299:
1211 // if ( v136 > 0 )
1212 // {
1213 // while ( !am_40BF15(v64, dword_4FA9B0[2 * v124]) || dword_4FA9B4[2 * v124] < 0 )
1214 // {
1215 // ++v124;
1216 // if ( v124 >= v136 )
1217 // return am_40BCFB(v64, v137) != 0;
1218 // }
1219 // return am_40BE0E(v64, dword_4FA9B0[2 * v124]) != 0;
1220 // }
1221 // }
1222 // return am_40BCFB(v64, v137) != 0;
1223 // }
1224 // v9 = a1;
1225 // v144 = &stru_505708[a1];
1226 // v129 = a1;
1227 // v142 = &stru_505708[(a1 + 1) % 2];
1228 // v135 = GetPlayerHandCardCount(a1);
1229 // v10 = 0;
1230 // do
1231 // {
1232 // if ( v10 >= v135 )
1233 // {
1234 // dword_4FA9B0[2 * v10] = -1;
1235 // dword_4FA9B4[2 * v10] = -9999;
1236 // }
1237 // else
1238 // {
1239 // dword_4FA9B0[2 * v10] = v10;
1240 // dword_4FA9B4[2 * v10] = 0;
1241 // }
1242 // ++v10;
1243 // }
1244 // while ( v10 < 10 );
1245 // v131 = 0;
1246 // if ( v135 > 0 )
1247 // {
1248 // v11 = 47 * v9;
1249 // for ( k = 47 * v9; ; v11 = k )
1250 // {
1251 // v12 = 99;
1252 // v13 = 2 * v131;
1253 // v14 = &pCards[stru_505708[0].cards_at_hand[v11 + dword_4FA9B0[2 * v131]]];
1254 // v15 = v14->field_38[2];
1255 // v148 = v14->field_38[2];
1256 // if ( v144->field_24 >= 10 )
1257 // {
1258 // if ( v15 == 99 || v14->field_48[4] == 99 || v14->field_48[15] == 99 || (v19 = BYTE1(v14->field_68), v19 == 99) )
1259 // v20 = 5 * (v142->field_24 - v144->field_24);
1260 // else
1261 // v20 = 5 * (v148 + v14->field_48[4] + v14->field_48[15] + v19);
1262 // v18 = 2 * v20;
1263 // }
1264 // else
1265 // {
1266 // if ( v15 == 99 || v14->field_48[4] == 99 || v14->field_48[15] == 99 || (v16 = BYTE1(v14->field_68), v16 == 99) )
1267 // v17 = 5 * (v142->field_24 - v144->field_24);
1268 // else
1269 // v17 = 5 * (v148 + v14->field_48[4] + v14->field_48[15] + v16);
1270 // v18 = 4 * v17;
1271 // }
1272 // dword_4FA9B4[v13] += v18;
1273 // v21 = v14->field_38[1];
1274 // v146 = v14->field_38[1];
1275 // if ( v144->field_28 >= 10 )
1276 // {
1277 // if ( v21 == 99
1278 // || v14->field_48[3] == 99
1279 // || v14->field_48[14] == 99
1280 // || (v24 = LOBYTE(v14->field_68), v24 == 99) )
1281 // v25 = v142->field_28 - v144->field_28;
1282 // else
1283 // v25 = v146 + v14->field_48[3] + v14->field_48[14] + v24;
1284 // v23 = 2 * v25;
1285 // }
1286 // else
1287 // {
1288 // if ( v21 == 99
1289 // || v14->field_48[3] == 99
1290 // || v14->field_48[14] == 99
1291 // || (v22 = LOBYTE(v14->field_68), v22 == 99) )
1292 // v23 = 5 * (v142->field_28 - v144->field_28);
1293 // else
1294 // v23 = 5 * (v146 + v14->field_48[3] + v14->field_48[14] + v22);
1295 // }
1296 // dword_4FA9B4[v13] += v23;
1297 // dword_4FA9B4[v13] += 7 * (v14->field_38[0] + v14->field_48[2] + v14->field_48[13] + v14->field_58[15]);
1298 // if ( BYTE2(v14->field_30) == 99
1299 // || v14->field_38[12] == 99
1300 // || v14->field_48[7] == 99
1301 // || (v26 = v14->field_58[9], v26 == 99) )
1302 // v27 = 5 * (v142->field_2C - v144->field_2C);
1303 // else
1304 // v27 = 5 * (BYTE2(v14->field_30) + v14->field_38[12] + v14->field_48[7] + v26);
1305 // dword_4FA9B4[v13] += 8 * v27;
1306 // if ( BYTE3(v14->field_30) == 99
1307 // || v14->field_38[13] == 99
1308 // || v14->field_48[8] == 99
1309 // || (v28 = v14->field_58[10], v28 == 99) )
1310 // v29 = 5 * (v142->field_30 - v144->field_30);
1311 // else
1312 // v29 = 5 * (BYTE3(v14->field_30) + v14->field_38[13] + v14->field_48[8] + v28);
1313 // dword_4FA9B4[v13] += 8 * v29;
1314 // if ( LOBYTE(v14->field_34) == 99
1315 // || v14->field_38[14] == 99
1316 // || v14->field_48[9] == 99
1317 // || (v30 = v14->field_58[11], v30 == 99) )
1318 // v31 = 5 * (v142->field_34 - v144->field_34);
1319 // else
1320 // v31 = 5 * (LOBYTE(v14->field_34) + v14->field_38[14] + v14->field_48[9] + v30);
1321 // dword_4FA9B4[v13] += 8 * v31;
1322 // if ( BYTE1(v14->field_34) == 99
1323 // || v14->field_38[15] == 99
1324 // || v14->field_48[10] == 99
1325 // || (v32 = v14->field_58[12], v32 == 99) )
1326 // v33 = v142->field_38 - v144->field_38;
1327 // else
1328 // v33 = BYTE1(v14->field_34) + v14->field_38[15] + v14->field_48[10] + v32;
1329 // dword_4FA9B4[v13] += 2 * v33;
1330 // if ( BYTE2(v14->field_34) == 99
1331 // || v14->field_48[0] == 99
1332 // || v14->field_48[11] == 99
1333 // || (v34 = v14->field_58[13], v34 == 99) )
1334 // v35 = v142->field_3C - v144->field_3C;
1335 // else
1336 // v35 = BYTE2(v14->field_34) + v14->field_48[0] + v14->field_48[11] + v34;
1337 // dword_4FA9B4[v13] += 2 * v35;
1338 // if ( BYTE3(v14->field_34) == 99
1339 // || v14->field_48[1] == 99
1340 // || v14->field_48[12] == 99
1341 // || (v36 = v14->field_58[14], v36 == 99) )
1342 // v37 = v142->field_40 - v144->field_40;
1343 // else
1344 // v37 = BYTE3(v14->field_34) + v14->field_48[1] + v14->field_48[12] + v36;
1345 // dword_4FA9B4[v13] += 2 * v37;
1346 // if ( v14->field_38[11] == 99 || (v38 = v14->field_58[8], v38 == 99) )
1347 // dword_4FA9B4[v13] += v144->field_24 - v142->field_24;
1348 // else
1349 // dword_4FA9B4[v13] -= v14->field_38[11] + v38;
1350 // if ( v14->field_38[10] == 99 || (v39 = v14->field_58[7], v39 == 99) )
1351 // dword_4FA9B4[v13] += v144->field_28 - v142->field_28;
1352 // else
1353 // dword_4FA9B4[v13] -= v14->field_38[10] + v39;
1354 // v40 = v14->field_38[9];
1355 // v138 = v14->field_38[9];
1356 // dword_4FA9B4[v13] -= v40 + v14->field_58[6];
1357 // v41 = v14->field_38[3];
1358 // v42 = dword_4FA9B4[v13];
1359 // if ( v41 == 99 )
1360 // goto LABEL_97;
1361 // v43 = v14->field_58[0];
1362 // if ( v43 == 99 )
1363 // break;
1364 // v44 = v42 - v43;
1365 // v12 = 99;
1366 // dword_4FA9B4[v13] = v44 - v41;
1367 //LABEL_98:
1368 // if ( v14->field_38[4] == v12 || (v45 = v14->field_58[1], v45 == v12) )
1369 // dword_4FA9B4[v13] += v144->field_30 - v142->field_30;
1370 // else
1371 // dword_4FA9B4[v13] -= v14->field_38[4] + v45;
1372 // if ( v14->field_38[5] == v12 || (v46 = v14->field_58[2], v46 == v12) )
1373 // dword_4FA9B4[v13] += v144->field_34 - v142->field_34;
1374 // else
1375 // dword_4FA9B4[v13] -= v14->field_38[5] + v46;
1376 // if ( v14->field_38[6] == v12 || (v47 = v14->field_58[3], v47 == v12) )
1377 // dword_4FA9B4[v13] += v144->field_38 - v142->field_38;
1378 // else
1379 // dword_4FA9B4[v13] -= v14->field_38[6] + v47;
1380 // if ( v14->field_38[7] == v12 || (v48 = v14->field_58[4], v48 == v12) )
1381 // dword_4FA9B4[v13] += v144->field_3C - v142->field_3C;
1382 // else
1383 // dword_4FA9B4[v13] -= v14->field_38[7] + v48;
1384 // if ( v14->field_38[8] == v12 || (v49 = v14->field_58[5], v49 == v12) )
1385 // {
1386 // v51 = v144;
1387 // v50 = v142;
1388 // dword_4FA9B4[v13] += v144->field_40 - v142->field_40;
1389 // }
1390 // else
1391 // {
1392 // v50 = v142;
1393 // dword_4FA9B4[v13] -= v14->field_38[8] + v49;
1394 // v51 = v144;
1395 // }
1396 // if ( LOBYTE(v14->field_30) || v14->field_48[5] )
1397 // dword_4FA9B4[v13] *= 10;
1398 // if ( LOBYTE(v14->field_24) == 1 )
1399 // {
1400 // v52 = LOBYTE(v14->field_28);
1401 // v53 = v51->field_38;
1402 // }
1403 // else
1404 // {
1405 // if ( LOBYTE(v14->field_24) == 2 )
1406 // {
1407 // v52 = BYTE1(v14->field_28);
1408 // v53 = v51->field_3C;
1409 // }
1410 // else
1411 // {
1412 // if ( LOBYTE(v14->field_24) != 3 )
1413 // goto LABEL_130;
1414 // v52 = BYTE2(v14->field_28);
1415 // v53 = v51->field_40;
1416 // }
1417 // }
1418 // v54 = v53 - v52;
1419 // if ( v54 > 3 )
1420 // v54 = 3;
1421 // dword_4FA9B4[v13] += 5 * v54;
1422 //LABEL_130:
1423 // v55 = v14->field_58[8];
1424 // v139 = v50->field_24;
1425 // v125 = v14->field_38[11];
1426 // if ( v139 <= v55 + v125 )
1427 // dword_4FA9B4[v13] += 9999;
1428 // v137 = v50->field_28 + v139;
1429 // if ( v137 <= v55 + v125 + v14->field_58[6] + v14->field_58[7] + v40 + v14->field_38[10] )
1430 // dword_4FA9B4[v13] += 9999;
1431 // if ( v14->field_48[15] + (signed int)BYTE1(v14->field_68) + v144->field_24 + v14->field_48[4] + v148 >= dword_4E1884 )
1432 // dword_4FA9B4[v13] += 9999;
1433 // ++v131;
1434 // if ( v131 >= v135 )
1435 // {
1436 // v9 = v129;
1437 // goto LABEL_138;
1438 // }
1439 // }
1440 // v12 = 99;
1441 //LABEL_97:
1442 // v40 = v138;
1443 // dword_4FA9B4[v13] = v42 + v144->field_2C - v142->field_2C;
1444 // goto LABEL_98;
1445 // }
1446 //LABEL_138:
1447 // v56 = v135 - 1;
1448 // for ( l = v135 - 1; l >= 0; --l )
1449 // {
1450 // v137 = 0;
1451 // if ( l > 0 )
1452 // {
1453 // v58 = (int)dword_4FA9B0;
1454 // v132 = l;
1455 // v137 = l;
1456 // do
1457 // {
1458 // if ( *(unsigned int *)(v58 + 4) < *(unsigned int *)(v58 + 12) )
1459 // {
1460 // v59 = *(unsigned int *)v58;
1461 // v60 = *(unsigned int *)(v58 + 4);
1462 // *(unsigned int *)v58 = *(unsigned int *)(v58 + 8);
1463 // v61 = *(unsigned int *)(v58 + 12);
1464 // *(unsigned int *)(v58 + 8) = v59;
1465 // *(unsigned int *)(v58 + 4) = v61;
1466 // v9 = v129;
1467 // *(unsigned int *)(v58 + 12) = v60;
1468 // }
1469 // v58 += 8;
1470 // --v132;
1471 // }
1472 // while ( v132 );
1473 // }
1474 // }
1475 // v62 = v135 - 1;
1476 // if ( am_byte_4FAA77 )
1477 // {
1478 // if ( v56 >= 0 )
1479 // {
1480 // while ( !BYTE3(pCards[stru_505708[0].cards_at_hand[47 * v9 + dword_4FA9B0[2 * v62]]].field_28) )
1481 // {
1482 // --v62;
1483 // if ( v62 < 0 )
1484 // return am_40BCFB(v9, v137) != 0;
1485 // }
1486 // v137 = dword_4FA9B0[2 * v62];
1487 // }
1488 // }
1489 // else
1490 // {
1491 // v63 = 0;
1492 // if ( v56 >= 0 )
1493 // {
1494 // while ( !BYTE3(pCards[stru_505708[0].cards_at_hand[47 * v9 + dword_4FA9B0[2 * v62]]].field_28) )
1495 // {
1496 // --v62;
1497 // if ( v62 < 0 )
1498 // goto LABEL_151;
1499 // }
1500 // v137 = dword_4FA9B0[2 * v62];
1501 // }
1502 //LABEL_151:
1503 // if ( v135 > 0 )
1504 // {
1505 // while ( !am_40BF15(v9, dword_4FA9B0[2 * v63]) || dword_4FA9B4[2 * v63] < 0 )
1506 // {
1507 // ++v63;
1508 // if ( v63 >= v135 )
1509 // return am_40BCFB(v9, v137) != 0;
1510 // }
1511 // return am_40BE0E(v9, dword_4FA9B0[2 * v63]) != 0;
1512 // }
1513 // }
1514 // return am_40BCFB(v9, v137) != 0;
1515 // }
1516 // v3 = 0;
1517 // v4 = a1;
1518 // if ( am_byte_4FAA77 )
1519 // {
1520 //LABEL_11:
1521 // v7 = GetPlayerHandCardCount(v4);
1522 // v8 = rand_interval(0, v7 - 1);
1523 // result = am_40BCFB(v4, v8);
1524 // }
1525 // else
1526 // {
1527 // while ( 1 )
1528 // {
1529 // v5 = GetPlayerHandCardCount(v4);
1530 // v6 = rand_interval(0, v5 - 1);
1531 // if ( am_40BF15(v4, v6) )
1532 // break;
1533 // ++v3;
1534 // if ( v3 >= 10 )
1535 // goto LABEL_11;
1536 // }
1537 // result = am_40BE0E(v4, v6);
1538 // }
1539 return true;//result != 0; 1227 return true;//result != 0;
1540 } 1228 }
1541 // 408BB4: could not find valid save-restore pair for ebp
1542 // 4DF3A4: using guessed type int dword_4DF3A4;
1543 // 4E1884: using guessed type int dword_4E1884;
1544 // 4FA9B0: using guessed type int dword_4FA9B0[];
1545 // 4FA9B4: using guessed type int dword_4FA9B4[];
1546 // 4FAA00: using guessed type char byte_4FAA00;
1547 // 4FAA77: using guessed type char am_byte_4FAA77;
1548 1229
1549 1230
1550 1231
1551 //----- (00409E6A) -------------------------------------------------------- 1232 //----- (00409E6A) --------------------------------------------------------
1552 void ArcomageGame::Loop() 1233 void ArcomageGame::Loop()
1567 { 1248 {
1568 played_card_id = -1; 1249 played_card_id = -1;
1569 GetNextCardFromDeck(current_player_num); 1250 GetNextCardFromDeck(current_player_num);
1570 while ( 1 ) 1251 while ( 1 )
1571 { 1252 {
1572 byte_4FAA24 = am_40A560(current_player_num); 1253 byte_4FAA24 = PlayerTurn(current_player_num);
1573 if ( GetPlayerHandCardCount(current_player_num) <= minimum_cards_at_hand ) 1254 if ( GetPlayerHandCardCount(current_player_num) <= minimum_cards_at_hand )
1574 break; 1255 break;
1575 hand_full = 1; 1256 hand_full = 1;
1576 if ( pArcomageGame->field_F4 ) 1257 if ( pArcomageGame->field_F4 )
1577 goto LABEL_8; 1258 goto LABEL_8;
1578 } 1259 }
1579 hand_full = 0; 1260 hand_full = 0;
1580 } 1261 }
1581 pArcomageGame->GameOver = IsGameOver(); 1262 pArcomageGame->GameOver = IsGameOver();
1582 if ( !pArcomageGame->GameOver ) 1263 if ( !pArcomageGame->GameOver )
1583 am_40A383(); 1264 TurnChange();
1584 if ( pArcomageGame->field_F4 ) 1265 if ( pArcomageGame->field_F4 )
1585 pArcomageGame->GameOver = 1; 1266 pArcomageGame->GameOver = 1;
1586 } 1267 }
1587 GameResultsApply(); 1268 GameResultsApply();
1588 if ( byte_4FAA2C ) 1269 if ( byte_4FAA2C )
1656 for (j=0; j<10; ++j ) 1337 for (j=0; j<10; ++j )
1657 { 1338 {
1658 am_Players[i].cards_at_hand[j] = -1; 1339 am_Players[i].cards_at_hand[j] = -1;
1659 if ( am_byte_4E185D ) 1340 if ( am_byte_4E185D )
1660 { 1341 {
1661 am_Players[i].arr_6C[j].field_0 = -1; 1342 am_Players[i].card_shift[j].x = -1;
1662 am_Players[i].arr_6C[j].field_4 = -1; 1343 am_Players[i].card_shift[j].y = -1;
1663 } 1344 }
1664 else 1345 else
1665 { 1346 {
1666 am_Players[i].arr_6C[j].field_0 = 0; 1347 am_Players[i].card_shift[j].x = 0;
1667 am_Players[i].arr_6C[j].field_4 = 0; 1348 am_Players[i].card_shift[j].y = 0;
1668 } 1349 }
1669 } 1350 }
1670 1351
1671 } 1352 }
1672 strcpy(deckMaster.name, pDeckMaster); 1353 strcpy(deckMaster.name, pDeckMaster);
1800 card_slot_indx = GetEmptyCardSlotIndex(player_num); 1481 card_slot_indx = GetEmptyCardSlotIndex(player_num);
1801 if ( card_slot_indx != -1 ) 1482 if ( card_slot_indx != -1 )
1802 { 1483 {
1803 amuint_4FAA4C = card_slot_indx; 1484 amuint_4FAA4C = card_slot_indx;
1804 am_Players[player_num].cards_at_hand[card_slot_indx] = new_card_id; 1485 am_Players[player_num].cards_at_hand[card_slot_indx] = new_card_id;
1805 am_Players[player_num].arr_6C[card_slot_indx].field_0 = rand_interval(-4, 4); 1486 am_Players[player_num].card_shift[card_slot_indx].x = rand_interval(-4, 4);
1806 am_Players[player_num].arr_6C[card_slot_indx].field_4 = rand_interval(-4, 4); 1487 am_Players[player_num].card_shift[card_slot_indx].y = rand_interval(-4, 4);
1807 pArcomageGame->field_F6 = 1; 1488 pArcomageGame->field_F6 = 1;
1808 byte_4FAA2D = 1; 1489 byte_4FAA2D = 1;
1809 } 1490 }
1810 1491
1811 } 1492 }
1834 am_Players[player_num].resource_beasts += zoo_bonus + am_Players[player_num].zoo_level; 1515 am_Players[player_num].resource_beasts += zoo_bonus + am_Players[player_num].zoo_level;
1835 } 1516 }
1836 1517
1837 1518
1838 //----- (0040A383) -------------------------------------------------------- 1519 //----- (0040A383) --------------------------------------------------------
1839 void __cdecl am_40A383() 1520 void TurnChange()
1840 { 1521 {
1841 int v0; // eax@4 1522 int v0; // eax@4
1842 int v1; // ecx@4 1523 int v1; // ecx@4
1843 unsigned __int8 v2; // sf@4 1524 unsigned __int8 v2; // sf@4
1844 unsigned __int8 v3; // of@4 1525 unsigned __int8 v3; // of@4
1845 int v4; // eax@6 1526 int v4; // eax@6
1946 return result; 1627 return result;
1947 } 1628 }
1948 1629
1949 1630
1950 //----- (0040A560) -------------------------------------------------------- 1631 //----- (0040A560) --------------------------------------------------------
1951 char am_40A560(unsigned int player_num) 1632 char PlayerTurn( int player_num )
1952 { 1633 {
1953 int v1; // ebp@0 1634 int v1; // ebp@0
1954 unsigned __int64 v2; // qax@3 1635 unsigned __int64 v2; // qax@3
1955 unsigned __int64 v3; // kr00_8@3 1636 unsigned __int64 v3; // kr00_8@3
1956 1637
1957 int v5; // esi@67 1638 int v5; // esi@67
2011 1692
2012 if (am_Players[current_player_num].IsHisTurn != 1 && !byte_4FAA00 && !byte_4FAA2E && !byte_4FAA2D ) 1693 if (am_Players[current_player_num].IsHisTurn != 1 && !byte_4FAA00 && !byte_4FAA2E && !byte_4FAA2D )
2013 { 1694 {
2014 if ( am_byte_4FAA75 ) 1695 if ( am_byte_4FAA75 )
2015 am_byte_4FAA76 = 1; 1696 am_byte_4FAA76 = 1;
2016 am_408BB4(current_player_num); 1697 OpponentsAITurn(current_player_num);
2017 byte_4FAA2E = 1; 1698 byte_4FAA2E = 1;
2018 } 1699 }
2019 if ( amuint_4FAA4C != -1 && amuint_4FAA38 > 10 ) 1700 if ( amuint_4FAA4C != -1 && amuint_4FAA38 > 10 )
2020 amuint_4FAA38 = 10; 1701 amuint_4FAA38 = 10;
2021 if ( byte_4FAA2E || byte_4FAA2D ||am_Players[current_player_num].IsHisTurn != 1 ) 1702 if ( byte_4FAA2E || byte_4FAA2D ||am_Players[current_player_num].IsHisTurn != 1 )
2052 } 1733 }
2053 else 1734 else
2054 { 1735 {
2055 if ( hand_full ) 1736 if ( hand_full )
2056 { 1737 {
2057 if ( a2.field_0 == 7 && am_40BCFB(player_num, current_card_slot_index) ) 1738 if ( a2.field_0 == 7 && DiscardCard(player_num, current_card_slot_index) )
2058 { 1739 {
2059 if ( am_byte_4FAA75 ) 1740 if ( am_byte_4FAA75 )
2060 am_byte_4FAA76 = 1; 1741 am_byte_4FAA76 = 1;
2061 if ( dword_4FAA64 > 0 ) 1742 if ( dword_4FAA64 > 0 )
2062 { 1743 {
2063 --dword_4FAA64; 1744 --dword_4FAA64;
2064 hand_full = GetPlayerHandCardCount(player_num) > minimum_cards_at_hand; 1745 hand_full = GetPlayerHandCardCount(player_num) > minimum_cards_at_hand;
2065 } 1746 }
2066 byte_4FAA2E = 1; 1747 byte_4FAA2E = 1;
2067 } 1748 }
2068 if ( a2.field_0 == 8 && am_40BCFB(player_num, current_card_slot_index) ) 1749 if ( a2.field_0 == 8 && DiscardCard(player_num, current_card_slot_index) )
2069 { 1750 {
2070 if ( am_byte_4FAA75 ) 1751 if ( am_byte_4FAA75 )
2071 am_byte_4FAA76 = 1; 1752 am_byte_4FAA76 = 1;
2072 if ( dword_4FAA64 > 0 ) 1753 if ( dword_4FAA64 > 0 )
2073 { 1754 {
2088 am_byte_4FAA76 = 1; 1769 am_byte_4FAA76 = 1;
2089 } 1770 }
2090 } 1771 }
2091 if ( a2.field_0 == 8 ) 1772 if ( a2.field_0 == 8 )
2092 { 1773 {
2093 if ( am_40BCFB(player_num, current_card_slot_index) ) 1774 if ( DiscardCard(player_num, current_card_slot_index) )
2094 { 1775 {
2095 byte_4FAA2E = 1; 1776 byte_4FAA2E = 1;
2096 if ( am_byte_4FAA75 ) 1777 if ( am_byte_4FAA75 )
2097 am_byte_4FAA76 = 1; 1778 am_byte_4FAA76 = 1;
2098 } 1779 }
2706 { 2387 {
2707 v3 = current_player_num; 2388 v3 = current_player_num;
2708 if ( am_byte_4E185D) 2389 if ( am_byte_4E185D)
2709 { 2390 {
2710 2391
2711 pTargetXY.x += am_Players[current_player_num].arr_6C[v2].field_0 ; 2392 pTargetXY.x += am_Players[current_player_num].card_shift[v2].x ;
2712 pTargetXY.y += am_Players[current_player_num].arr_6C[v2].field_4; 2393 pTargetXY.y += am_Players[current_player_num].card_shift[v2].y;
2713 } 2394 }
2714 v7 = am_Players[current_player_num].cards_at_hand[v2]; 2395 v7 = am_Players[current_player_num].cards_at_hand[v2];
2715 if ( v7 == -1 ) 2396 if ( v7 == -1 )
2716 { 2397 {
2717 ++v0; 2398 ++v0;
2741 v3 = current_player_num; 2422 v3 = current_player_num;
2742 pTargetXY.x += v24 + 96; 2423 pTargetXY.x += v24 + 96;
2743 LABEL_15: 2424 LABEL_15:
2744 if ( am_byte_4E185D ) 2425 if ( am_byte_4E185D )
2745 { 2426 {
2746 pTargetXY.x -= am_Players[current_player_num].arr_6C[v2].field_0 ; 2427 pTargetXY.x -= am_Players[current_player_num].card_shift[v2].x ;
2747 pTargetXY.y -= am_Players[current_player_num].arr_6C[v2].field_4 ; 2428 pTargetXY.y -= am_Players[current_player_num].card_shift[v2].y ;
2748 } 2429 }
2749 ++v2; 2430 ++v2;
2750 } 2431 }
2751 2432
2752 for (v11=0; v11<10; ++v11) 2433 for (v11=0; v11<10; ++v11)
2851 v2 = (640 - 96 * v1) / v1 + 96; 2532 v2 = (640 - 96 * v1) / v1 + 96;
2852 if ( am_byte_4E185D ) 2533 if ( am_byte_4E185D )
2853 { 2534 {
2854 // v3 = 188 * current_player_num + 8 * amuint_4FAA4C; 2535 // v3 = 188 * current_player_num + 8 * amuint_4FAA4C;
2855 // amuint_4FAA3C_blt_xy.x = (amuint_4FAA4C * v2 + *(am_Players[0].arr_6C[0] + v3) - 120) / 10; 2536 // amuint_4FAA3C_blt_xy.x = (amuint_4FAA4C * v2 + *(am_Players[0].arr_6C[0] + v3) - 120) / 10;
2856 amuint_4FAA3C_blt_xy.x=(amuint_4FAA4C * v2 + am_Players[current_player_num].arr_6C[amuint_4FAA4C].field_0-120)/10; 2537 amuint_4FAA3C_blt_xy.x=(amuint_4FAA4C * v2 + am_Players[current_player_num].card_shift[amuint_4FAA4C].x-120)/10;
2857 v4 = (am_Players[current_player_num].arr_6C[amuint_4FAA4C].field_4+309) /10;//(*(&am_Players[0].arr_6C[0][1] + v3) + 309) / 10; 2538 v4 = (am_Players[current_player_num].card_shift[amuint_4FAA4C].y+309) /10;//(*(&am_Players[0].arr_6C[0][1] + v3) + 309) / 10;
2858 } 2539 }
2859 else 2540 else
2860 { 2541 {
2861 amuint_4FAA3C_blt_xy.x = (amuint_4FAA4C * v2 - 120) / 10; 2542 amuint_4FAA3C_blt_xy.x = (amuint_4FAA4C * v2 - 120) / 10;
2862 v4 = 30; 2543 v4 = 30;
3138 v30 = v7; 2819 v30 = v7;
3139 // } 2820 // }
3140 if ( am_byte_4E185D ) 2821 if ( am_byte_4E185D )
3141 { 2822 {
3142 // v9 = v3 + 8 * v7; 2823 // v9 = v3 + 8 * v7;
3143 v10 = am_Players[player_num].arr_6C[v7].field_0;//*(am_player[0].arr_6C[0] + v9); 2824 v10 = am_Players[player_num].card_shift[v7].x;//*(am_player[0].arr_6C[0] + v9);
3144 v11 = am_Players[player_num].arr_6C[v7].field_4;//*(&am_player[0].arr_6C[0][1] + v9); 2825 v11 = am_Players[player_num].card_shift[v7].y;//*(&am_player[0].arr_6C[0][1] + v9);
3145 pXYZW.left += v10; 2826 pXYZW.left += v10;
3146 pXYZW.right += v10; 2827 pXYZW.right += v10;
3147 pXYZW.top += v11; 2828 pXYZW.top += v11;
3148 pXYZW.bottom += v11; 2829 pXYZW.bottom += v11;
3149 } 2830 }
3155 DrawRect(&pXYZW, v14, 0); 2836 DrawRect(&pXYZW, v14, 0);
3156 pXYZW.left += var18; 2837 pXYZW.left += var18;
3157 pXYZW.right += var18; 2838 pXYZW.right += var18;
3158 if ( am_byte_4E185D ) 2839 if ( am_byte_4E185D )
3159 { 2840 {
3160 v16 = am_Players[player_num].arr_6C[v30].field_0;//*(am_player[0].arr_6C[0] + v15); 2841 v16 = am_Players[player_num].card_shift[v30].x;//*(am_player[0].arr_6C[0] + v15);
3161 v17 = am_Players[player_num].arr_6C[v30].field_4;//*(&am_player[0].arr_6C[0][1] + v15); 2842 v17 = am_Players[player_num].card_shift[v30].y;//*(&am_player[0].arr_6C[0][1] + v15);
3162 pXYZW.left -= v16; 2843 pXYZW.left -= v16;
3163 pXYZW.right -= v16; 2844 pXYZW.right -= v16;
3164 pXYZW.top -= v17; 2845 pXYZW.top -= v17;
3165 pXYZW.bottom -= v17; 2846 pXYZW.bottom -= v17;
3166 } 2847 }
3191 2872
3192 } 2873 }
3193 // 4E185D: using guessed type char am_byte_4E185D; 2874 // 4E185D: using guessed type char am_byte_4E185D;
3194 2875
3195 //----- (0040BCFB) -------------------------------------------------------- 2876 //----- (0040BCFB) --------------------------------------------------------
3196 bool am_40BCFB( int player_num, signed int card_slot_index ) 2877 bool DiscardCard( int player_num, signed int card_slot_index )
3197 { 2878 {
3198 int v2; // esi@2 2879 int v2; // esi@2
3199 signed int v3; // edi@2 2880 signed int v3; // edi@2
3200 char *v4; // eax@2 2881 char *v4; // eax@2
3201 int v5; // ecx@7 2882 int v5; // ecx@7
3227 2908
3228 if ( pCards[am_Players[player_num].cards_at_hand[i]].attack_or_defence) 2909 if ( pCards[am_Players[player_num].cards_at_hand[i]].attack_or_defence)
3229 { 2910 {
3230 ArcomageGame::PlaySound(22); 2911 ArcomageGame::PlaySound(22);
3231 v8 = GetPlayerHandCardCount(current_player_num); 2912 v8 = GetPlayerHandCardCount(current_player_num);
3232 v10=am_Players[player_num].arr_6C[i].field_0 + (640 - 96 * v8) / (v8 + 1); 2913 v10=am_Players[player_num].card_shift[i].x + (640 - 96 * v8) / (v8 + 1);
3233 amuint_4FAA5C_blt_xy.x = v10; 2914 amuint_4FAA5C_blt_xy.x = v10;
3234 amuint_4FAA5C_blt_xy.y = am_Players[player_num].arr_6C[i].field_4 + 327;//v11; 2915 amuint_4FAA5C_blt_xy.y = am_Players[player_num].card_shift[i].y + 327;//v11;
3235 v12 = 0; 2916 v12 = 0;
3236 2917
3237 if ( !am_byte_4FAA75 ) 2918 if ( !am_byte_4FAA75 )
3238 { 2919 {
3239 for (v12=0; v12<10; ++v12) 2920 for (v12=0; v12<10; ++v12)
3299 ArcomageGame::PlaySound(23); 2980 ArcomageGame::PlaySound(23);
3300 v9 = GetPlayerHandCardCount(current_player_num); 2981 v9 = GetPlayerHandCardCount(current_player_num);
3301 // v10 = 188 * v8 + 8 * v6; 2982 // v10 = 188 * v8 + 8 * v6;
3302 // v11 = v6 + 47 * v3; 2983 // v11 = v6 + 47 * v3;
3303 pArcomageGame->field_F6 = 1; 2984 pArcomageGame->field_F6 = 1;
3304 v12 = am_Players[player_num].arr_6C[v6].field_0 + (640 - 96 * v9) / (v9 + 1)+ 96 * v6 +(640 - 96 * v9) / (v9 + 1); 2985 v12 = am_Players[player_num].card_shift[v6].x + (640 - 96 * v9) / (v9 + 1)+ 96 * v6 +(640 - 96 * v9) / (v9 + 1);
3305 // v13 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v10) + 327; 2986 // v13 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v10) + 327;
3306 amuint_4FAA5C_blt_xy.x = v12;//v12; 2987 amuint_4FAA5C_blt_xy.x = v12;//v12;
3307 amuint_4FAA5C_blt_xy.y = am_Players[player_num].arr_6C[v6].field_4 + 327;//v13; 2988 amuint_4FAA5C_blt_xy.y = am_Players[player_num].card_shift[v6].y + 327;//v13;
3308 2989
3309 amuint_4FAA54_blt_xy.x = (272 - v12) / 5; 2990 amuint_4FAA54_blt_xy.x = (272 - v12) / 5;
3310 amuint_4FAA54_blt_xy.y = -30; 2991 amuint_4FAA54_blt_xy.y = -30;
3311 2992
3312 v14 = &pCards[am_Players[player_num].cards_at_hand[v6]]; 2993 v14 = &pCards[am_Players[player_num].cards_at_hand[v6]];
4394 4075
4395 4076
4396 //----- (00409BE8) -------------------------------------------------------- 4077 //----- (00409BE8) --------------------------------------------------------
4397 void SetStartConditions() 4078 void SetStartConditions()
4398 { 4079 {
4399 ArcomageStartConditions *st_cond; // eax@1 4080 const ArcomageStartConditions *st_cond; // eax@1
4400 4081
4401 st_cond = &start_conditions[window_SpeakInHouse->par1C - 108]; 4082 st_cond = &start_conditions[window_SpeakInHouse->par1C - 108];
4402 start_tower_height = st_cond->tower_height; 4083 start_tower_height = st_cond->tower_height;
4403 start_wall_height = st_cond->wall_height; 4084 start_wall_height = st_cond->wall_height;
4404 start_quarry_level = st_cond->quarry_level - 1; 4085 start_quarry_level = st_cond->quarry_level - 1;
4409 magic_bonus = 1; 4090 magic_bonus = 1;
4410 zoo_bonus = 1; 4091 zoo_bonus = 1;
4411 max_tower_height = st_cond->max_tower; 4092 max_tower_height = st_cond->max_tower;
4412 max_resources_amount = st_cond->max_resources; 4093 max_resources_amount = st_cond->max_resources;
4413 4094
4414 dword_4DF3A4 = st_cond->field_14; 4095 opponent_mastery = st_cond->mastery_lvl;
4415 4096
4416 start_bricks_amount = st_cond->bricks_amount; 4097 start_bricks_amount = st_cond->bricks_amount;
4417 start_gems_amount = st_cond->gems_amount; 4098 start_gems_amount = st_cond->gems_amount;
4418 start_beasts_amount = st_cond->beasts_amount; 4099 start_beasts_amount = st_cond->beasts_amount;
4419 4100
4421 4102
4422 4103
4423 //----- (0040D75D) -------------------------------------------------------- 4104 //----- (0040D75D) --------------------------------------------------------
4424 void pPrimaryWindow_draws_text( int a1, const char *pText, POINT *pXY ) 4105 void pPrimaryWindow_draws_text( int a1, const char *pText, POINT *pXY )
4425 { 4106 {
4426 int v4; // qax@1 4107 pPrimaryWindow->DrawText( pFontComic, pXY->x, pXY->y - ((pFontComic->uFontHeight - 3) >> 1) + 3, 0, pText, 0, 0, 0);
4427 v4 = pFontComic->uFontHeight - 3;
4428 pPrimaryWindow->DrawText( pFontComic, pXY->x, pXY->y - (v4 >> 1) + 3, 0, pText, 0, 0, 0);
4429 } 4108 }
4430 4109
4431 4110
4432 //----- (0040DB27) -------------------------------------------------------- 4111 //----- (0040DB27) --------------------------------------------------------
4433 void __fastcall DrawRect(RECT *pXYZW, unsigned __int16 uColor, char bSolidFill) 4112 void __fastcall DrawRect(RECT *pXYZW, unsigned __int16 uColor, char bSolidFill)