Mercurial > mm7
changeset 1200:c42f255ce1dc
Cards drawn
author | Gloval |
---|---|
date | Sun, 09 Jun 2013 00:57:17 +0400 |
parents | 9ddeeb7dfe64 |
children | 601c085deff7 |
files | Arcomage.cpp Arcomage.h |
diffstat | 2 files changed, 267 insertions(+), 307 deletions(-) [+] |
line wrap: on
line diff
--- a/Arcomage.cpp Sat Jun 08 22:48:38 2013 +0400 +++ b/Arcomage.cpp Sun Jun 09 00:57:17 2013 +0400 @@ -28,14 +28,14 @@ void SetStartGameData(); void FillPlayerDeck(); -void am_40A255(); -void am_40A283(int a1); +void InitalHandsFill(); +void GetNextCardFromDeck(int player_num); int GetEmptyCardSlotIndex(int player_num); void IncreaseResourcesInTurn(int player_num); void __cdecl am_40A383(); bool IsGameOver(); char __thiscall am_40A560(unsigned int _this); -void DrawGameUI(int a1); // idb +void DrawGameUI(int a1); // idb void am_40AA4E(); void DrawRectanglesForText(); void DrawPlayersText(); @@ -48,10 +48,10 @@ void __cdecl am_40B4B9(); void __fastcall am_40B76F(int a1); int GetPlayerHandCardCount(int player_num); -signed int __fastcall am_40BB67(int a1); -char __fastcall am_40BCFB(int a1, signed int a2); +signed int DrawCardsRectangles(int player_num); +bool am_40BCFB(int player_num, signed int card_slot_index); bool PlayCard(int player_num, signed int card_slot_num); -bool CanCardBePlayed(int player_num, int hand_card_indx); +bool CanCardBePlayed(int player_num, int hand_card_indx); void __fastcall am_40BF77(int a1, unsigned int uCardID); // idb int am_40D2B4(POINT* a1, int a2); // weak int __fastcall am_40D402(int, int); // weak @@ -79,7 +79,7 @@ __int16 wall_height; __int16 quarry_level; __int16 magic_level; - __int16 might_level; + __int16 zoo_level; __int16 bricks_amount; __int16 gems_amount; __int16 beasts_amount; @@ -110,7 +110,7 @@ ArcomagePlayer am_Players[2]; -Acromage_st1 struct_st1[10]; +Acromage_st1 shown_cards[10]; stru272 array_4FABD0[10]; @@ -153,10 +153,10 @@ int start_wall_height; // weak int start_quarry_level; // weak int start_magic_level; // weak -int start_might_level; // weak - - -int dword_4E1874 = 5; // weak +int start_zoo_level; // weak + + +int minimum_cards_at_hand = 5; // weak int quarry_bonus = 1; // weak int magic_bonus = 1; // weak int might_bonus = 1; // weak @@ -172,10 +172,10 @@ int current_player_num; // idb char am_byte_4FAA77; // weak -signed int dword_4FABBC; // idb -unsigned int amuint_4FABC0; // idb - -int dword_4FABC8; // weak +signed int current_card_slot_index; // idb +unsigned int played_card_id; // idb + +int deck_walk_index; // weak int start_bricks_amount; // weak int start_gems_amount; // weak @@ -206,7 +206,7 @@ } //----- (0040DFD1) -------------------------------------------------------- -void stru272_stru0::_40DFD1(stru272_stru0 *a1) +void stru272_stru0::Ctor(stru272_stru0 *a1) { stru272_stru0 *v2; // eax@1 v2 = (stru272_stru0 *)malloc(0x5Cu); @@ -219,7 +219,7 @@ } //----- (0040DFFE) -------------------------------------------------------- -int stru272_stru0::_40DFFE() +int stru272_stru0::Dtor() { if ( this->signature == SIG_trpg ) @@ -263,7 +263,7 @@ } //----- (0040E0F5) -------------------------------------------------------- -int stru272_stru0::_40E0F5(char a2, char a3) +int stru272_stru0::Empty(char a2, char a3) { if ( signature == SIG_trpg) { @@ -1564,12 +1564,12 @@ LABEL_8: while ( byte_4FAA24 ) { - amuint_4FABC0 = -1; - am_40A283(current_player_num); + played_card_id = -1; + GetNextCardFromDeck(current_player_num); while ( 1 ) { byte_4FAA24 = am_40A560(current_player_num); - if ( GetPlayerHandCardCount(current_player_num) <= dword_4E1874 ) + if ( GetPlayerHandCardCount(current_player_num) <= minimum_cards_at_hand ) break; am_byte_4FAA77 = 1; if ( pArcomageGame->field_F4 ) @@ -1599,8 +1599,8 @@ for(int i=0; i<10; ++i) { - array_4FABD0[i].field_40->_40E0F5(1,1); - array_4FABD0[i].field_40->_40DFFE(); + array_4FABD0[i].field_40->Empty(1,1); + array_4FABD0[i].field_40->Dtor(); } pArcomageGame->pGameBackground.Release(); @@ -1643,11 +1643,11 @@ strcpy(am_Players[0].pPlayerName, pArcomageGame->pPlayer1Name); am_Players[0].IsHisTurn = 1; } - am_Players[i].tower_height = start_tower_height; - am_Players[i].wall_height = start_wall_height; - am_Players[i].quarry_level = start_quarry_level; - am_Players[i].magic_level = start_magic_level; - am_Players[i].might_level = start_might_level; + am_Players[i].tower_height = start_tower_height; + am_Players[i].wall_height = start_wall_height; + am_Players[i].quarry_level = start_quarry_level; + am_Players[i].magic_level = start_magic_level; + am_Players[i].zoo_level = start_zoo_level; am_Players[i].resource_bricks = start_bricks_amount; am_Players[i].resource_gems = start_gems_amount; am_Players[i].resource_beasts = start_beasts_amount; @@ -1751,19 +1751,19 @@ playDeck.cardsInUse[i] = deckMaster.cardsInUse[v6]; } - dword_4FABC8 = 0; + deck_walk_index = 0; amuint_4FABC4 = -1; pArcomageGame->field_F6 = 1; } //----- (0040A255) -------------------------------------------------------- -void am_40A255() +void InitalHandsFill() { - for (int i = 0; i < dword_4E1874; ++i ) + for (int i = 0; i < minimum_cards_at_hand; ++i ) { - am_40A283(0); - am_40A283(1); + GetNextCardFromDeck(0); + GetNextCardFromDeck(1); } pArcomageGame->field_F6 = 1; @@ -1771,44 +1771,39 @@ // 4E1874: using guessed type int dword_4E1874; //----- (0040A283) -------------------------------------------------------- -void am_40A283( int a1 ) +void GetNextCardFromDeck( int player_num ) { - signed int v2; // eax@1 - int v3; // edi@1 - int v4; // esi@1 - bool v5; // bl@1 - signed int result; // eax@7 - int v7; // esi@8 - - v2 = dword_4FABC8; - v3 = a1; - v4 = a1; - v5 = false; - do + signed int deck_index; // eax@1 + int new_card_id; // edi@1 + signed int card_slot_indx; // eax@7 + + deck_index = deck_walk_index; + for(;;) { - if ( v2 >= DECK_SIZE ) + if ( deck_index >= DECK_SIZE ) { FillPlayerDeck(); - v2 = dword_4FABC8; + deck_index = deck_walk_index; } - if ( !playDeck.cardsInUse[v2] ) + if ( !playDeck.cardsInUse[deck_index] ) { - v3 = playDeck.cards_IDs[v2]; - v5 = true; + new_card_id = playDeck.cards_IDs[deck_index]; + ++deck_index; + deck_walk_index = deck_index; + break; } - ++v2; - dword_4FABC8 = v2; + ++deck_index; + deck_walk_index = deck_index; } - while ( !v5 ); - + ArcomageGame::PlaySound(21); - result = GetEmptyCardSlotIndex(v4); - if ( result != -1 ) + card_slot_indx = GetEmptyCardSlotIndex(player_num); + if ( card_slot_indx != -1 ) { - amuint_4FAA4C = result; - am_Players[a1].cards_at_hand[result] = v3; - am_Players[a1].arr_6C[result].field_0 = rand_interval(-4, 4); - am_Players[a1].arr_6C[result].field_4 = rand_interval(-4, 4); + amuint_4FAA4C = card_slot_indx; + am_Players[player_num].cards_at_hand[card_slot_indx] = new_card_id; + am_Players[player_num].arr_6C[card_slot_indx].field_0 = rand_interval(-4, 4); + am_Players[player_num].arr_6C[card_slot_indx].field_4 = rand_interval(-4, 4); pArcomageGame->field_F6 = 1; byte_4FAA2D = 1; } @@ -1836,7 +1831,7 @@ { am_Players[player_num].resource_bricks += quarry_bonus + am_Players[player_num].quarry_level; am_Players[player_num].resource_gems += magic_bonus + am_Players[player_num].magic_level; - am_Players[player_num].resource_beasts += might_bonus + am_Players[player_num].might_level; + am_Players[player_num].resource_beasts += might_bonus + am_Players[player_num].zoo_level; } @@ -1955,7 +1950,7 @@ //----- (0040A560) -------------------------------------------------------- -char am_40A560(unsigned int _this) +char am_40A560(unsigned int player_num) { int v1; // ebp@0 unsigned __int64 v2; // qax@3 @@ -1969,12 +1964,10 @@ POINT pTargetXY; // [sp+90h] [bp-20h]@75 ArcomageGame_stru1 a2; // [sp+98h] [bp-18h]@8 int v13; // [sp+A4h] [bp-Ch]@1 - int a1; // [sp+A8h] [bp-8h]@1 char v15; // [sp+AEh] [bp-2h]@63 char v16; // [sp+AFh] [bp-1h]@1 uCardID = -1; - a1 = _this; v16 = 0; v13 = 20; byte_4FAA00 = 0; @@ -2064,25 +2057,25 @@ { if ( am_byte_4FAA77 ) { - if ( a2.field_0 == 7 && am_40BCFB(a1, dword_4FABBC) ) + if ( a2.field_0 == 7 && am_40BCFB(player_num, current_card_slot_index) ) { if ( am_byte_4FAA75 ) am_byte_4FAA76 = 1; if ( dword_4FAA64 > 0 ) { --dword_4FAA64; - am_byte_4FAA77 = GetPlayerHandCardCount(a1) > dword_4E1874; + am_byte_4FAA77 = GetPlayerHandCardCount(player_num) > minimum_cards_at_hand; } byte_4FAA2E = 1; } - if ( a2.field_0 == 8 && am_40BCFB(a1, dword_4FABBC) ) + if ( a2.field_0 == 8 && am_40BCFB(player_num, current_card_slot_index) ) { if ( am_byte_4FAA75 ) am_byte_4FAA76 = 1; if ( dword_4FAA64 > 0 ) { --dword_4FAA64; - am_byte_4FAA77 = GetPlayerHandCardCount(a1) > dword_4E1874; + am_byte_4FAA77 = GetPlayerHandCardCount(player_num) > minimum_cards_at_hand; } byte_4FAA2E = 1; } @@ -2091,7 +2084,7 @@ { if ( a2.field_0 == 7 ) { - if ( PlayCard(a1, dword_4FABBC) ) + if ( PlayCard(player_num, current_card_slot_index) ) { byte_4FAA2E = 1; if ( am_byte_4FAA75 ) @@ -2100,7 +2093,7 @@ } if ( a2.field_0 == 8 ) { - if ( am_40BCFB(a1, dword_4FABBC) ) + if ( am_40BCFB(player_num, current_card_slot_index) ) { byte_4FAA2E = 1; if ( am_byte_4FAA75 ) @@ -2198,7 +2191,7 @@ if (array_4FABD0[i].field_0) array_4FABD0[i].field_40->_40E133(); } - dword_4FABBC = am_40BB67(current_player_num); + current_card_slot_index = DrawCardsRectangles(current_player_num); am_40AA4E(); am_EndScene(); } @@ -2390,18 +2383,18 @@ text_position.x = 561; //- 6 * v6 / 2; DrawPlayerLevels(-1, text_buff, &text_position); - res_value = am_Players[0].might_level; + res_value = am_Players[0].zoo_level; if ( byte_4E185E ) - res_value = am_Players[0].might_level + might_bonus; + res_value = am_Players[0].zoo_level + might_bonus; intToString(res_value, text_buff); // v8 = 0; text_position.y = 236; text_position.x = 14;// - 6 * v8 / 2; DrawPlayerLevels(-1, text_buff, &text_position); - res_value = am_Players[1].might_level; + res_value = am_Players[1].zoo_level; if ( byte_4E185E ) - res_value = am_Players[1].might_level + might_bonus; + res_value = am_Players[1].zoo_level + might_bonus; intToString(res_value, text_buff); // v10 = 0; text_position.y = 236; @@ -2684,177 +2677,143 @@ //----- (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 = GetPlayerHandCardCount(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); + +int v0; // esi@1 +char v1; // bl@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 +signed int v12; // esi@20 +int v13; // ecx@20 +int v14; // eax@23 +signed int v15; // eax@25 +int v16; // ecx@25 +POINT *v17; // esi@26 +signed int v18; // eax@29 +Acromage_st1 *v19; // ecx@29 +int v20; // ecx@31 +int v21; // [sp-4h] [bp-2Ch]@8 +RECT pSrcXYZW; // [sp+Ch] [bp-1Ch]@8 +POINT pTargetXY; // [sp+1Ch] [bp-Ch]@1 +int v24; // [sp+24h] [bp-4h]@1 + +v0 = GetPlayerHandCardCount(current_player_num); +v2 = 0; +pTargetXY.y = 327; +v24 = (640 - 96 * v0) / (v0 + 1); +pTargetXY.x = (640 - 96 * v0) / (v0 + 1); +while ( v2 < v0 ) + { + v3 = current_player_num; + if ( am_byte_4E185D != 0 ) + { + + pTargetXY.x += am_Players[current_player_num].arr_6C[v2].field_0 ; + pTargetXY.y += am_Players[current_player_num].arr_6C[v2].field_4; + } + v7 = am_Players[current_player_num].cards_at_hand[v2]; + if ( v7 == -1 ) + { + ++v0; + goto LABEL_15; + } + if ( v2 != amuint_4FAA4C ) + { + if ( am_Players[current_player_num].IsHisTurn == 0 && byte_505881 == 0 ) + { + pSrcXYZW.left = 192; + pSrcXYZW.right = 288; + pSrcXYZW.top = 0; + pSrcXYZW.bottom = 128; + Blt_Copy(&pSrcXYZW, &pTargetXY, 2); + goto LABEL_13; + } + pArcomageGame->GetCardRect(v7, &pSrcXYZW); + if ( !CanCardBePlayed(current_player_num, v2) ) + { + Blt_Copy(&pSrcXYZW, &pTargetXY, 0); + goto LABEL_13; + } + Blt_Copy(&pSrcXYZW, &pTargetXY, 2); + + } +LABEL_13: + v3 = current_player_num; + pTargetXY.x += v24 + 96; +LABEL_15: + if ( am_byte_4E185D != 0 ) + { + pTargetXY.x -= am_Players[current_player_num].arr_6C[v2].field_0 ; + pTargetXY.y -= am_Players[current_player_num].arr_6C[v2].field_4 ; + } + ++v2; + } + +for (v11=0; v11<10; ++v11) + { + if ( am_byte_4FAA76 == 0 ) + { + if ( shown_cards[v11].uCardId != -1 ) + { + pArcomageGame->GetCardRect(shown_cards[v11].uCardId, &pSrcXYZW); + Blt_Copy(&pSrcXYZW, &shown_cards[v11].field_18_point, 0); + } + if ( shown_cards[v11].field_4 != 0 ) + { + pTargetXY.x = shown_cards[v11].field_18_point.x + 12; + pTargetXY.y = shown_cards[v11].field_18_point.y + 40; + pSrcXYZW.left = 843; + pSrcXYZW.right = 916; + pSrcXYZW.top = 200; + pSrcXYZW.bottom = 216; + Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2); + } + } + else if ( amuint_4FAA34 <= 0 ) + { + if ( v11 == 9 ) + { + am_byte_4FAA76 = 0; + am_byte_4FAA75 = 0; + amuint_4FAA34 = 5; + } + if ( shown_cards[v11].uCardId != -1 ) + amuint_4FABC4 = shown_cards[v11].uCardId; + shown_cards[v11].uCardId = -1; + shown_cards[v11].field_18_point.x = shown_cards[v11].field_8.x; + shown_cards[v11].field_18_point.y = shown_cards[v11].field_8.y; + shown_cards[v11].field_4 = 0; + } + else + { + if ( shown_cards[v11].uCardId != -1 ) + { + shown_cards[v11].field_18_point.x += shown_cards[v11].field_10_xplus; + shown_cards[v11].field_18_point.y += shown_cards[v11].field_14_y_plus; + pArcomageGame->GetCardRect(shown_cards[v11].uCardId, &pSrcXYZW); + Blt_Copy(&pSrcXYZW, &shown_cards[v11].field_18_point, 0); + } + } + } + if ( am_byte_4FAA76 != 0 ) + --amuint_4FAA34; + + pSrcXYZW.left = 192; + pSrcXYZW.right = 288; + pSrcXYZW.top = 0; + pSrcXYZW.bottom = 128; + pTargetXY.x = 120; + pTargetXY.y = 18; + Blt_Copy(&pSrcXYZW, &pTargetXY, 0); + } -// 4E185D: using guessed type char am_byte_4E185D; -// 4FAA34: using guessed type int amuint_4FAA34; -// 4FAA4C: using guessed type int amuint_4FAA4C; -// 4FAA75: using guessed type char am_byte_4FAA75; -// 4FAA76: using guessed type char am_byte_4FAA76; -// 4FAA78: using guessed type int amuint_4FAA78[]; -// 4FAA80: using guessed type int amuint_4FAA80[]; -// 4FAA84: using guessed type int amuint_4FAA84[]; -// 4FAA88: using guessed type int amuint_4FAA88[]; -// 4FAA8C: using guessed type int amuint_4FAA8C[]; -// 4FABC4: using guessed type int amuint_4FABC4; -// 505881: using guessed type char byte_505881; - //----- (0040B76F) -------------------------------------------------------- @@ -3104,11 +3063,11 @@ } //----- (0040BB67) -------------------------------------------------------- -signed int __fastcall am_40BB67(int a1) -{ - - -int v1; // esi@1 +signed int DrawCardsRectangles( int player_num ) + { + + +//int v1; // esi@1 signed int result; // eax@1 int v3; // ebx@1 char v4; // zf@1 @@ -3131,7 +3090,6 @@ unsigned __int16 v21; // ax@19 RECT pXYZW; // [sp+Ch] [bp-3Ch]@3 stru273 v26; // [sp+1Ch] [bp-2Ch]@2 -int player_num; // [sp+28h] [bp-20h]@1 int v25; // [sp+2Ch] [bp-1Ch]@3 __int32 var18; // [sp+30h] [bp-18h]@3 int i; // [sp+34h] [bp-14h]@4 @@ -3142,18 +3100,18 @@ char v32; // [sp+45h] [bp-3h]@12 char v33; // [sp+46h] [bp-2h]@12 -v1 = a1; + v30 = 0; result = -1; //v3 = 188 * a1; -player_num = a1; + //v4 = LOBYTE(am_Players[a1].field_20) == 0; v28 = -1; -if ( am_Players[a1].IsHisTurn ) +if ( am_Players[player_num].IsHisTurn ) { if ( v26._40DD2F() ) { - v5 = GetPlayerHandCardCount(v1); + v5 = GetPlayerHandCardCount(player_num); hand_index = 0; v25 = v5; pXYZW.top = 327; @@ -3164,14 +3122,15 @@ if ( v5 > 0 ) { // v6 = 47 * v1; - for ( i = 47 * v1; ; v6 = i ) + // for ( i = player_num; ; v6 = i ) + for(;;) { v7 = v30; // v8 = &am_Players[0].cards_at_hand[v30 + v6]; for (v7=0; v7<10; ++v7) { - if (am_Players[v1].cards_at_hand[v7]!= -1 ) + if (am_Players[player_num].cards_at_hand[v7]!= -1 ) break; } //if ( *v8 ) @@ -3187,8 +3146,8 @@ if ( am_byte_4E185D ) { // v9 = v3 + 8 * v7; - v10 = am_Players[v1].arr_6C[v7].field_0;//*(am_player[0].arr_6C[0] + v9); - v11 = am_Players[v1].arr_6C[v7].field_4;//*(&am_player[0].arr_6C[0][1] + v9); + v10 = am_Players[player_num].arr_6C[v7].field_0;//*(am_player[0].arr_6C[0] + v9); + v11 = am_Players[player_num].arr_6C[v7].field_4;//*(&am_player[0].arr_6C[0][1] + v9); pXYZW.left += v10; pXYZW.right += v10; pXYZW.top += v11; @@ -3204,8 +3163,8 @@ pXYZW.right += var18; if ( am_byte_4E185D ) { - v16 = am_Players[v1].arr_6C[v30].field_0;//*(am_player[0].arr_6C[0] + v15); - v17 = am_Players[v1].arr_6C[v30].field_4;//*(&am_player[0].arr_6C[0][1] + v15); + v16 = am_Players[player_num].arr_6C[v30].field_0;//*(am_player[0].arr_6C[0] + v15); + v17 = am_Players[player_num].arr_6C[v30].field_4;//*(&am_player[0].arr_6C[0][1] + v15); pXYZW.left -= v16; pXYZW.right -= v16; pXYZW.top -= v17; @@ -3372,8 +3331,8 @@ // 4E185D: using guessed type char am_byte_4E185D; //----- (0040BCFB) -------------------------------------------------------- -char __fastcall am_40BCFB(int a1, signed int a2) -{ +bool am_40BCFB( int player_num, signed int card_slot_index ) + { int v2; // esi@2 signed int v3; // edi@2 char *v4; // eax@2 @@ -3390,22 +3349,22 @@ char result; // al@12 int i; - if ( a2 <= -1 ) + if ( card_slot_index <= -1 ) return 0; v2 = 0; v3 = 0; for(i=0; i<10; ++i) { - if ( am_Players[a1].cards_at_hand[i] != -1 ) + if ( am_Players[player_num].cards_at_hand[i] != -1 ) { - if ( a2 == v2 ) + if ( card_slot_index == v2 ) break; ++v2; } } - if ( pCards[am_Players[a1].cards_at_hand[i]].field_2B) + if ( pCards[am_Players[player_num].cards_at_hand[i]].field_2B) { ArcomageGame::PlaySound(0x16u); v7 = current_player_num; @@ -3489,7 +3448,7 @@ v7 += 4; } while ( v6 < 10 ); - result = CanCardBePlayed(v3, v6); + result = CanCardBePlayed(player_num, v6); if ( result ) { ArcomageGame::PlaySound(0x17u); @@ -3497,21 +3456,22 @@ v9 = GetPlayerHandCardCount(current_player_num); v10 = 188 * v8 + 8 * v6; v11 = v6 + 47 * v3; - amuint_4FAA54_blt_xy[1] = -30; + pArcomageGame->field_F6 = 1; //v12 = 96 * v6 + *(int *)((char *)am_Players[0].arr_6C[0] + v10) + (640 - 96 * v9) / (v9 + 1); // v13 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v10) + 327; amuint_4FAA5C_blt_xy[0] = v12; amuint_4FAA5C_blt_xy[1] = v13; + amuint_4FAA54_blt_xy[0] = (272 - v12) / 5; + amuint_4FAA54_blt_xy[1] = -30; + v14 = &pCards[v5->cards_at_hand[v6]]; v5->resource_bricks -= v14->needed_bricks; v5->resource_beasts -= v14->needed_beasts; v5->resource_gems -= v14->needed_gems; - result = 4 * v11 + 5265228; - v16 = am_Players[0].cards_at_hand[v11]; - am_Players[0].cards_at_hand[v11] = -1; - amuint_4FABC0 = v16; + played_card_id = am_Players[player_num].cards_at_hand[v6]; + am_Players[player_num].cards_at_hand[v6] = -1; return true;; } else @@ -3533,7 +3493,7 @@ result = false; if ( test_card->needed_magic_level > pPlayer->magic_level ) result = false; - if ( test_card->needed_might_level > pPlayer->might_level ) + if ( test_card->needed_might_level > pPlayer->zoo_level ) result = false; if ( test_card->needed_bricks > pPlayer->resource_bricks ) result = false; @@ -5857,14 +5817,14 @@ { 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; + shown_cards[i].uCardId = -1; + shown_cards[i].field_4 = 0; + shown_cards[i].field_8.x = 100 * v2 + 120; + shown_cards[i].field_8.y = 138 * v3 + 18; + shown_cards[i].field_10_xplus = -100 * v2 / 5; + shown_cards[i].field_14_y_plus = -138 * v3 / 5; + shown_cards[i].field_18_point.x = shown_cards[i].field_8.x; + shown_cards[i].field_18_point.y = shown_cards[i].field_8.y; } pXY.x = 0; @@ -5887,9 +5847,9 @@ for (int i=0; i<10; ++i) - array_4FABD0[i].field_40->_40DFD1(array_4FABD0[i].field_40); + array_4FABD0[i].field_40->Ctor(array_4FABD0[i].field_40); - dword_4FABBC = -1; + current_card_slot_index = -1; amuint_4FAA4C = -1; byte_4FAA74 = 0; pArcomageGame->field_F4 = 0; @@ -5898,7 +5858,7 @@ dword_4FAA70 = 0; am_byte_4FAA77 = 0; SetStartGameData(); - am_40A255(); + InitalHandsFill(); //nullsub_1(); pArcomageGame->GameOver = 0; pArcomageGame->pfntComic = pFontComic; @@ -5924,26 +5884,26 @@ //----- (00409BE8) -------------------------------------------------------- void SetStartConditions() { - ArcomageStartConditions *v1; // eax@1 + ArcomageStartConditions *st_cond; // eax@1 - v1 = &start_conditions[window_SpeakInHouse->par1C - 108]; - start_tower_height = v1->tower_height; - start_wall_height = v1->wall_height; - start_quarry_level = v1->quarry_level - 1; - start_magic_level = v1->magic_level - 1; - start_might_level = v1->might_level - 1; - dword_4E1874 = 5; + st_cond = &start_conditions[window_SpeakInHouse->par1C - 108]; + start_tower_height = st_cond->tower_height; + start_wall_height = st_cond->wall_height; + start_quarry_level = st_cond->quarry_level - 1; + start_magic_level = st_cond->magic_level - 1; + start_zoo_level = st_cond->zoo_level - 1; + minimum_cards_at_hand = 5; quarry_bonus = 1; magic_bonus = 1; might_bonus = 1; - max_tower_height = v1->max_tower; - max_resources_amount = v1->max_resources; - - dword_4DF3A4 = v1->field_14; - - start_bricks_amount = v1->bricks_amount; - start_gems_amount = v1->gems_amount; - start_beasts_amount = v1->beasts_amount; + max_tower_height = st_cond->max_tower; + max_resources_amount = st_cond->max_resources; + + dword_4DF3A4 = st_cond->field_14; + + start_bricks_amount = st_cond->bricks_amount; + start_gems_amount = st_cond->gems_amount; + start_beasts_amount = st_cond->beasts_amount; }
--- a/Arcomage.h Sat Jun 08 22:48:38 2013 +0400 +++ b/Arcomage.h Sun Jun 09 00:57:17 2013 +0400 @@ -118,7 +118,7 @@ int wall_height; int quarry_level; int magic_level; - int might_level; + int zoo_level; int resource_bricks; int resource_gems; int resource_beasts; @@ -241,10 +241,10 @@ #pragma pack(push, 1) struct stru272_stru0 // ARCOMAGE stuff { - static void _40DFD1(stru272_stru0 *a1); - int _40DFFE(); + static void Ctor(stru272_stru0 *a1); + int Dtor(); int _40E01A(stru272_stru2* a2); - int _40E0F5(char a2, char a3); + int Empty(char a2, char a3); int _40E133(); int _40E2A7();