Mercurial > mm7
changeset 1239:7f4d7597fa2d
Слияние
author | Ritor1 |
---|---|
date | Mon, 10 Jun 2013 00:37:21 +0600 |
parents | 77ea5c5f2c0b (current diff) 85bdbaa539f4 (diff) |
children | 353cb3ad9725 |
files | mm7_data.h |
diffstat | 3 files changed, 147 insertions(+), 520 deletions(-) [+] |
line wrap: on
line diff
--- a/Arcomage.cpp Mon Jun 10 00:37:03 2013 +0600 +++ b/Arcomage.cpp Mon Jun 10 00:37:21 2013 +0600 @@ -46,16 +46,16 @@ void DrawPlayersTowers(); void DrawPlayersWall(); void DrawCards(); -void __fastcall am_40B76F(int a1); +void DrawCardAnimation(int a1); int GetPlayerHandCardCount(int player_num); 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); -void __fastcall am_40BF77(int a1, unsigned int uCardID); // idb +void ApplyCardToPlayer(int player_num, unsigned int uCardID); // idb int am_40D2B4(POINT* a1, int a2); // weak -int __fastcall am_40D402(int, int); // weak -int __cdecl GameResultsApply(); +int am_40D402(int player_num, int damage); // weak +void GameResultsApply(); void pPrimaryWindow_draws_text(int a1, const char *pText, POINT *pXY); void __thiscall am_BeginScene(unsigned __int16 *pPcxPixels, int a2, int a3); // idb @@ -135,8 +135,9 @@ #pragma pack(pop) - -char am_byte_4E185D; // weak +char byte_4E185C = 1; // weak +char am_byte_4E185D = 1; // weak +char byte_4E185E = 1; // weak int start_tower_height; int start_wall_height; @@ -1714,7 +1715,7 @@ char card_taken_flags[DECK_SIZE]; // [sp+8h] [bp-6Ch]@1 int i,j; - ArcomageGame::PlaySound(0x14u); + ArcomageGame::PlaySound(20); memset(deckMaster.cardsInUse, 0,DECK_SIZE ); memset(card_taken_flags, 0, DECK_SIZE); @@ -1859,26 +1860,24 @@ else { //nullsub_1(); - v11.x = 0; - v11.y = 0; - // inv_strcpy("", Dest); - v0 = 0; + // v11.x = 0; + // v11.y = 0; + strcpy(Dest,"The Next Player is: ");//"" + // v0 = 0; v11.y = 200; - v11.x = 320 - 12 * v0 / 2; + v11.x = 320; // - 12 * v0 / 2; pPrimaryWindow_draws_text(-1, Dest, &v11); am_byte_4FAA75 = 1; - v1 = current_player_num + 1; - v3 = __OFSUB__(current_player_num + 1, 2); - v2 = current_player_num++ - 1 < 0; - if ( !(v2 ^ v3) ) + v1 = ++current_player_num; + if ( v1 >= 2 ) { v1 = 0; current_player_num = 0; } strcpy(Dest, am_Players[v1].pPlayerName); - v4 = 0; + // v4 = 0; v11.y = 260; - v11.x = 320 - 12 * v4 / 2; + v11.x = 320;// - 12 * v4 / 2; pPrimaryWindow_draws_text(-1, Dest, &v11); /* v6.left = 0; v6.right = 640; @@ -1953,7 +1952,7 @@ int v1; // ebp@0 unsigned __int64 v2; // qax@3 unsigned __int64 v3; // kr00_8@3 - int v4; // ecx@17 + int v5; // esi@67 char Dest[100]; // [sp+8h] [bp-A8h]@67 int v8; // [sp+6Ch] [bp-44h]@3 @@ -2008,18 +2007,17 @@ pArcomageGame->field_F4 = 1; break; } - v4 = current_player_num; + if (am_Players[current_player_num].IsHisTurn != 1 && !byte_4FAA00 && !byte_4FAA2E && !byte_4FAA2D ) { if ( am_byte_4FAA75 ) am_byte_4FAA76 = 1; am_408BB4(current_player_num); - v4 = current_player_num; byte_4FAA2E = 1; } if ( amuint_4FAA4C != -1 && amuint_4FAA38 > 10 ) amuint_4FAA38 = 10; - if ( byte_4FAA2E || byte_4FAA2D ||am_Players[v4].IsHisTurn != 1 ) + if ( byte_4FAA2E || byte_4FAA2D ||am_Players[current_player_num].IsHisTurn != 1 ) { pArcomageGame->field_F6 = 1; if ( byte_4FAA2D ) @@ -2101,39 +2099,39 @@ } } //nullsub_1(); - if ( false ) - { - if ( !v15 ) - { - //nullsub_1(); - v15 = 1; - } - } - else - { - v15 = 0; - } - if ( false ) - { - //nullsub_1(); - //nullsub_1(); - // assert(false && "Invalid strcpy params"); - // inv_strcpy(nullptr, Dest); - v5 = 0;//unk::const_0(&unk_4E19FC, 0); - //nullsub_1(); - if ( v5 == 1 ) - { - pAudioPlayer->StopChannels(-1, -1); - v16 = 1; - pArcomageGame->field_F4 = 1; - dword_4FAA68 = 0; - } - /*v10[0] = 0; - v10[2] = 640; - v10[1] = 0; - v10[3] = 480;*/ - //nullsub_1(); - } + //if ( false ) + //{ + // if ( !v15 ) + // { + // //nullsub_1(); + // v15 = 1; + // } + //} + //else + //{ + // v15 = 0; + // } + //if ( false ) + //{ + // //nullsub_1(); + // //nullsub_1(); + // // assert(false && "Invalid strcpy params"); + // // inv_strcpy(nullptr, Dest); + // v5 = 0;//unk::const_0(&unk_4E19FC, 0); + // //nullsub_1(); + // if ( v5 == 1 ) + // { + // pAudioPlayer->StopChannels(-1, -1); + // v16 = 1; + // pArcomageGame->field_F4 = 1; + // dword_4FAA68 = 0; + // } + // /*v10[0] = 0; + // v10[2] = 640; + // v10[1] = 0; + // v10[3] = 480;*/ + // //nullsub_1(); + //} if ( dword_4FABB8 != DrawCardsRectangles(player_num) ) { dword_4FABB8 = DrawCardsRectangles(player_num); @@ -2182,7 +2180,7 @@ am_EndScene(); am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1); - am_40B76F(a1); + DrawCardAnimation(a1); for( int i=0; i<10; ++i) { @@ -2632,15 +2630,13 @@ POINT pTargetXY; // [sp+14h] [bp-8h]@4 v0 = am_Players[0].wall_height; -if ( am_Players[0].wall_height <= 100 ) - { - if ( am_Players[0].wall_height <= 0 ) - goto LABEL_5; - } -else - { + +if ( am_Players[0].wall_height > 100 ) v0 = 100; - } + +if ( am_Players[0].wall_height > 0 ) + { + pSrcXYZW.top = 0; pSrcXYZW.left = 843; v1 = 200 * v0 / 100; @@ -2649,18 +2645,16 @@ pTargetXY.x = 177; pTargetXY.y = 297 - v1; Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2); - -LABEL_5: + } + v3 = am_Players[1].wall_height; -if ( am_Players[1].wall_height <= 100 ) - { +if ( am_Players[1].wall_height > 100 ) + v3 = 100; + + if ( am_Players[1].wall_height <= 0 ) - return; - } -else - { - v3 = 100; - } + { + pSrcXYZW.top = 0; pSrcXYZW.left = 843; v4 = 200 * v3 / 100; @@ -2669,7 +2663,7 @@ pTargetXY.x = 439; pTargetXY.y = 297 - v4; Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2); - + } } //----- (0040B4B9) -------------------------------------------------------- @@ -2815,8 +2809,8 @@ //----- (0040B76F) -------------------------------------------------------- -void __fastcall am_40B76F(int a1) -{ +void DrawCardAnimation( int animation_stage ) + { int v1; // eax@3 int v2; // eax@3 @@ -2824,7 +2818,7 @@ int v4; // eax@4 POINT *v5; // edx@6 RECT *v6; // ecx@6 -Acromage_st1 *v7; // ebx@11 + int v8; // eax@15 Acromage_st1 *v9; // ecx@15 int v10; // ecx@19 @@ -2845,7 +2839,7 @@ POINT pTargetXY; // [sp+1Ch] [bp-Ch]@20 int v26; // [sp+24h] [bp-4h]@1 -v26 = a1; +v26 = animation_stage; if ( amuint_4FAA4C != -1 ) { if ( amuint_4FAA38 >= 9 ) @@ -2868,36 +2862,35 @@ } am_uint_4FAA44_blt_xy.y += v4; am_uint_4FAA44_blt_xy.x += amuint_4FAA3C_blt_xy.x; - pSrcXYZW.top = 0; + amuint_4FAA3C_blt_xy.y = v4; + pSrcXYZW.left = 192; + pSrcXYZW.top = 0; pSrcXYZW.right = 288; pSrcXYZW.bottom = 128; - v5 = &am_uint_4FAA44_blt_xy; - v6 = &pSrcXYZW; - Blt_Copy(v6, v5, 2); - goto LABEL_11; + Blt_Copy(&pSrcXYZW, &am_uint_4FAA44_blt_xy, 2); } - pSrcXYZW.top = 0; - v6 = &pSrcXYZW; - v5 = &am_uint_4FAA44_blt_xy; + else + { + + + pSrcXYZW.left = 192; + pSrcXYZW.top = 0; + pSrcXYZW.right = 288; pSrcXYZW.bottom = 128; - pSrcXYZW.right = 288; - pSrcXYZW.left = 192; - if ( amuint_4FAA38 ) - { - am_uint_4FAA44_blt_xy.x += amuint_4FAA3C_blt_xy.x; - am_uint_4FAA44_blt_xy.y += amuint_4FAA3C_blt_xy.y; - Blt_Copy(v6, v5, 2); - goto LABEL_11; - } am_uint_4FAA44_blt_xy.x += amuint_4FAA3C_blt_xy.x; am_uint_4FAA44_blt_xy.y += amuint_4FAA3C_blt_xy.y; Blt_Copy(&pSrcXYZW, &am_uint_4FAA44_blt_xy, 2); + if ( !amuint_4FAA38 ) + { + amuint_4FAA4C = -1; + } + } } LABEL_11: -v7 = shown_cards; + if ( uCardID != -1 ) { if ( v26 <= 10 ) @@ -2942,22 +2935,21 @@ Blt_Copy(&pSrcXYZW, &amuint_4FAA5C_blt_xy, 0); } } -v14 = played_card_id; + if ( played_card_id != -1 ) { v15 = v26; if ( v15 > 15.0 ) { pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW); - v16 = &amuint_4FAA5C_blt_xy; amuint_4FAA5C_blt_xy.x += amuint_4FAA54_blt_xy.x; amuint_4FAA5C_blt_xy.y += amuint_4FAA54_blt_xy.y; - Blt_Copy(&pSrcXYZW, v16, 2); + Blt_Copy(&pSrcXYZW, &amuint_4FAA5C_blt_xy, 2); return; } if ( v15 == 15.0 ) { - am_40BF77(current_player_num, played_card_id); + ApplyCardToPlayer(current_player_num, played_card_id); pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW); pTargetXY.x = 272; pTargetXY.y = 173; @@ -3011,12 +3003,13 @@ if ( !v18 ) { - pArcomageGame->GetCardRect(v14, &pSrcXYZW); + pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW); pTargetXY.x = 272; pTargetXY.y = 173; Blt_Copy(&pSrcXYZW, &pTargetXY, 2); return; } + pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW); for (v19=0; v19<10; ++v19) { @@ -3024,240 +3017,14 @@ { shown_cards[v19].uCardId = played_card_id; break; - } - + } } - /* v19 = 0; - while ( v7->uCardId != -1 ) - { - ++v7; - ++v19; - if ( v7 >= &dword_4FABB8 ) - goto LABEL_46; - } - shown_cards[v19].uCardId = played_card_id; - LABEL_46:*/ - - pTargetXY.x = shown_cards[v19].field_8.x; + pTargetXY.x = shown_cards[v19].field_8.x; pTargetXY.y = shown_cards[v19].field_8.y; Blt_Copy(&pSrcXYZW, &pTargetXY, 0); played_card_id = -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 = GetPlayerHandCardCount(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; -// 4FAA4C: using guessed type int amuint_4FAA4C; -// 4FAA78: using guessed type int amuint_4FAA78[]; -// 4FAA80: using guessed type int amuint_4FAA80[]; -// 4FAA84: using guessed type int amuint_4FAA84[]; -// 4FABB8: using guessed type int dword_4FABB8; //----- (0040BB12) -------------------------------------------------------- void ArcomageGame::GetCardRect(unsigned int uCardID, RECT *pCardRect) @@ -3421,138 +3188,6 @@ return result; - -// int v1; // esi@1 -// signed int result; // eax@1 -// int v3; // ebx@1 -// char v4; // zf@1 -// int v5; // eax@3 -// int v6; // eax@4 -// int v7; // ecx@6 -// char *v8; // eax@6 -// int v9; // eax@10 -// int v10; // ecx@10 -// int v11; // eax@10 -// char v12; // ch@2@11 -// int v13; // ST00_4@12 -// unsigned __int16 v14; // ax@12 -// int v15; // eax@13 -// int v16; // ecx@13 -// int v17; // eax@13 -// char v18; // al@16 -// char v19; // ch@2@16 -// int v20; // ST00_4@19 -// unsigned __int16 v21; // ax@19 -// int pXYZW[4]; // [sp+Ch] [bp-3Ch]@3 -// stru273 v26; // [sp+1Ch] [bp-2Ch]@2 -// int a1a; // [sp+28h] [bp-20h]@1 -// int v25; // [sp+2Ch] [bp-1Ch]@3 -// int var18; // [sp+30h] [bp-18h]@3 -// int i; // [sp+34h] [bp-14h]@4 -// int v28; // [sp+38h] [bp-10h]@1 -// int a2; // [sp+3Ch] [bp-Ch]@3 -// int v30; // [sp+40h] [bp-8h]@1 -// char v31; // [sp+44h] [bp-4h]@12 -// char v32; // [sp+45h] [bp-3h]@12 -// char v33; // [sp+46h] [bp-2h]@12 -// -// v1 = a1; -// v30 = 0; -// result = -1; -// v3 = 188 * a1; -// a1a = a1; -// v4 = LOBYTE(am_Players[a1].field_20) == 0; -// v28 = -1; -// if ( !v4 ) -// { -// if ( v26._40DD2F() ) -// { -// v5 = GetPlayerHandCardCount(v1); -// a2 = 0; -// v25 = v5; -// pXYZW[1] = 327; -// pXYZW[3] = 455; -// pXYZW[0] = (640 - 96 * v5) / (v5 + 1); -// var18 = pXYZW[0] + 96; -// pXYZW[2] = pXYZW[0] + 96; -// if ( v5 > 0 ) -// { -// v6 = 47 * v1; -// for ( i = 47 * v1; ; v6 = i ) -// { -// v7 = v30; -// v8 = (char *)&am_Players[0].cards_at_hand[v30 + v6]; -// if ( *(unsigned int *)v8 == -1 ) -// { -// do -// { -// v8 += 4; -// ++v7; -// } -// while ( *(unsigned int *)v8 == -1 ); -// v30 = v7; -// } -// if ( am_byte_4E185D ) -// { -// v9 = v3 + 8 * v7; -// // 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; -// pXYZW[3] += v11; -// } -// if ( true)//v26.Inside(pXYZW) ) -// break; -// v31 = 0; -// v32 = 0; -// v33 = 0; -// BYTE3(v13) = v12; -// LOWORD(v13) = *(_WORD *)&v31; -// BYTE2(v13) = 0; -// v14 = R8G8B8_to_TargetFormat(v13); -// // DrawRect(pXYZW, v14, 0); -// pXYZW[0] += var18; -// pXYZW[2] += var18; -// if ( am_byte_4E185D ) -// { -// v15 = v3 + 8 * v30; -// // 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; -// pXYZW[3] -= v17; -// } -// ++v30; -// ++a2; -// if ( a2 >= v25 ) -// goto LABEL_20; -// } -// v28 = a2; -// v18 = am_40BF15(a1a, a2); -// v31 = -1; -// if ( v18 ) -// { -// v32 = -1; -// v33 = -1; -// } -// else -// { -// v32 = 0; -// v33 = 0; -// } -// BYTE3(v20) = v19; -// LOWORD(v20) = *(_WORD *)&v31; -// BYTE2(v20) = v33; -// v21 = R8G8B8_to_TargetFormat(v20); -// // DrawRect(pXYZW, v21, 0); -// } -// } -//LABEL_20: -// result = v28; -// } -// return result; } // 4E185D: using guessed type char am_byte_4E185D; @@ -3666,18 +3301,18 @@ // v10 = 188 * v8 + 8 * v6; // v11 = v6 + 47 * v3; pArcomageGame->field_F6 = 1; - //v12 = 96 * v6 + *(int *)((char *)am_Players[0].arr_6C[0] + v10) + (640 - 96 * v9) / (v9 + 1); + v12 = am_Players[player_num].arr_6C[v6].field_0 + (640 - 96 * v9) / (v9 + 1)+ 96 * v6 +(640 - 96 * v9) / (v9 + 1); // v13 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v10) + 327; - amuint_4FAA5C_blt_xy.x = am_Players[player_num].arr_6C[v6].field_0 + (640 - 96 * v9) / (v9 + 1);//v12; + amuint_4FAA5C_blt_xy.x = v12;//v12; amuint_4FAA5C_blt_xy.y = am_Players[player_num].arr_6C[v6].field_4 + 327;//v13; amuint_4FAA54_blt_xy.x = (272 - v12) / 5; amuint_4FAA54_blt_xy.y = -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; + v14 = &pCards[am_Players[player_num].cards_at_hand[v6]]; + am_Players[player_num].resource_bricks -= v14->needed_bricks; + am_Players[player_num].resource_beasts -= v14->needed_beasts; + am_Players[player_num].resource_gems -= v14->needed_gems; played_card_id = am_Players[player_num].cards_at_hand[v6]; am_Players[player_num].cards_at_hand[v6] = -1; return true;; @@ -3716,8 +3351,8 @@ //----- (0040BF77) -------------------------------------------------------- -void __fastcall am_40BF77(int a1, unsigned int uCardID) -{ +void ApplyCardToPlayer( int player_num, unsigned int uCardID ) + { // ArcomagePlayer *v2; // esi@1 // int v3; // eax@1 // ArcomagePlayer *v4; // edi@1 @@ -5747,44 +5382,44 @@ //----- (0040D402) -------------------------------------------------------- -int __fastcall am_40D402(int a1, int a2) -{ +int am_40D402( int player_num, int damage ) + { ArcomagePlayer *v2; // ecx@1 int v3; // esi@1 int result; // eax@3 - v2 = &am_Players[a1]; - v3 = v2->wall_height; + + v3 = am_Players[player_num].wall_height; if ( v3 <= 0 ) { result = 0; } else { - if ( v3 >= -a2 ) + if ( v3 >= -damage ) { - result = a2; - v2->wall_height = a2 + v3; + result = damage; + am_Players[player_num].wall_height += damage; } else { - a2 += v3; + damage += v3; result = -v3; - v2->wall_height = 0; - v2->tower_height += a2; + am_Players[player_num].wall_height = 0; + am_Players[player_num].tower_height += damage; } } - if ( v2->tower_height < 0 ) - v2->tower_height = 0; + if ( am_Players[player_num].tower_height < 0 ) + am_Players[player_num].tower_height = 0; return result; } // 40D402: using guessed type int __fastcall am_40D402(uint, uint); //----- (0040D444) -------------------------------------------------------- -int __cdecl GameResultsApply() -{ +void GameResultsApply() + { int v0; // esi@1 int v1; // edi@1 int v2; // eax@1 @@ -5794,23 +5429,23 @@ int v6; // eax@28 GUIWindow *v7; // ecx@50 signed int v8; // eax@50 - char *v9; // eax@52 + char v9; // eax@52 signed int v10; // eax@54 char *v11; // esi@59 char *v12; // esi@65 signed int v14; // [sp-4h] [bp-58h]@46 char pText[64]; // [sp+Ch] [bp-48h]@1 - int xy[2]; // [sp+4Ch] [bp-8h]@1 + POINT xy; // [sp+4Ch] [bp-8h]@1 v0 = -1; v1 = -1; //nullsub_1(); - xy[0] = 0; - xy[1] = 0; - // inv_strcpy("", pText); - v2 = 0; - xy[1] = 160; - xy[0] = 320 - 12 * v2 / 2; + xy.x = 0; + xy.y = 0; + strcpy(pText, "The Winner is: ");//"" + // v2 = 0; + xy.y = 160; + xy.x = 320; //- 12 * v2 / 2; // pPrimaryWindow_draws_text(-1, pText, xy); if ( am_Players[0].tower_height < max_tower_height ) { @@ -5949,60 +5584,56 @@ pArcomageGame->uGameResult = v0; if ( v0 == 1 ) { - v7 = window_SpeakInHouse; + v8 = (signed int)window_SpeakInHouse->par1C; - if ( v8 >= 108 ) + if (( v8 >= 108 )&&( v8 <= 120 )) { - if ( v8 <= 120 ) - { - v9 = (char *)&pParty->uNumGoldInBank + v8 + 1; - if ( !*v9 ) + if ( !pParty->pArcomageWins[v8-108] ) { - *v9 = 1; - - //auto _a = (signed __int64)(p2DEvents_minus1__20[13 * (unsigned int)v7->ptr_1C] * 100.0); - auto _a = (signed int)(p2DEvents[(unsigned int)v7->par1C - 1].fPriceMultiplier * 100.0); + pParty->pArcomageWins[v8-108] = 1; + auto _a = (signed int)(p2DEvents[ window_SpeakInHouse->par1C - 1].fPriceMultiplier * 100.0); party_finds_gold(_a, 0); } - } + } v10 = 108; do { - if ( !*((unsigned char *)&pParty->uNumGoldInBank + v10 + 1) ) + if ( !pParty->pArcomageWins[v10-108] ) break; ++v10; } while ( v10 <= 120 ); + if ( v10 == 121 ) _449B7E_toggle_bit(pParty->_quest_bits, 238, 1u); - v11 = (char *)pParty->pPlayers[0]._guilds_member_bits; - do + + + for (int i=0; i<4; ++i ) { + v11 = (char *)&pParty->pPlayers[i]._guilds_member_bits; if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v11, 1) ) _449B7E_toggle_bit((unsigned char *)v11, PLAYER_GUILD_BITS__ARCOMAGE_WIN, 1); - v11 += 6972; + } - while ( (signed int)v11 < (signed int)((char *)&pParty->StandartItemsInShops[36] + 2) ); + ++pParty->uNumArcomageWins; if ( pParty->uNumArcomageWins > 1000000 ) pParty->uNumArcomageWins = 1000000; } else { - v12 = (char *)pParty->pPlayers[0]._guilds_member_bits; - do - { + for (int i=0; i<4; ++i ) + { + v12 = (char *)&pParty->pPlayers[i]._guilds_member_bits; if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v12, 1) ) _449B7E_toggle_bit((unsigned char *)v12, PLAYER_GUILD_BITS__ARCOMAGE_LOSE, 1); - v12 += 6972; } - while ( (signed int)v12 < (signed int)((char *)&pParty->StandartItemsInShops[36] + 2) ); + ++pParty->uNumArcomageLoses; if ( pParty->uNumArcomageLoses > 1000000 ) pParty->uNumArcomageLoses = 1000000; } - return 0; }