Mercurial > mm7
comparison Arcomage.cpp @ 1197:2b950844f2d6
mostly arcomage structs renaming.
author | Gloval |
---|---|
date | Sat, 08 Jun 2013 22:41:45 +0400 |
parents | 9baf16113199 |
children | 98a70229c271 |
comparison
equal
deleted
inserted
replaced
1195:1f92c110a4f2 | 1197:2b950844f2d6 |
---|---|
21 #include "texts.h" | 21 #include "texts.h" |
22 #include <windef.h> | 22 #include <windef.h> |
23 | 23 |
24 | 24 |
25 | 25 |
26 void sub_409BE8(); | 26 void SetStartConditions(); |
27 | 27 |
28 | 28 |
29 void am_409FE9(); | 29 void SetStartGameData(); |
30 void am_40A198(); | 30 void FillPlayerDeck(); |
31 void am_40A255(); | 31 void am_40A255(); |
32 void am_40A283(int a1); | 32 void am_40A283(int a1); |
33 int GetEmptyCardSlotIndex(int player_num); | 33 int GetEmptyCardSlotIndex(int player_num); |
34 void am_40A346(int player_num); | 34 void IncreaseResourcesInTurn(int player_num); |
35 void __cdecl am_40A383(); | 35 void __cdecl am_40A383(); |
36 bool am_40A514(); | 36 bool IsGameOver(); |
37 char __thiscall am_40A560(unsigned int _this); | 37 char __thiscall am_40A560(unsigned int _this); |
38 void am_blts(int a1); // idb | 38 void DrawGameUI(int a1); // idb |
39 void am_40AA4E(); | 39 void am_40AA4E(); |
40 void __cdecl am_chroma_blts(); | 40 void DrawRectanglesForText(); |
41 void __cdecl am_DrawUI(); | 41 void DrawPlayersText(); |
42 void am_40B102(int a1, char *text, POINT *pXY); // idb | 42 void DrawPlayerLevels(int a1, char *text, POINT *pXY); // idb |
43 void am_40B17E(int a1, char* text, POINT *pXY); // idb | 43 void DrawBricksCount(int a1, char* text, POINT *pXY); // idb |
44 void am_40B1F3(int a1, char* text, POINT* pXY); | 44 void DrawGemsCount(int a1, char* text, POINT* pXY); |
45 void am_40B268(int a1, char *text, POINT *pXY); // idb | 45 void DrawBeastsCount(int a1, char *text, POINT *pXY); // idb |
46 void __cdecl am_chroma_and_copy_blts(); | 46 void DrawPlayersTowers(); |
47 void __cdecl am_chroma_blt(); | 47 void DrawPlayersWall(); |
48 void __cdecl am_40B4B9(); | 48 void __cdecl am_40B4B9(); |
49 void __fastcall am_40B76F(int a1); | 49 void __fastcall am_40B76F(int a1); |
50 int GetPlayerHandCardCount(int player_num); | 50 int GetPlayerHandCardCount(int player_num); |
51 signed int __fastcall am_40BB67(int a1); | 51 signed int __fastcall am_40BB67(int a1); |
52 char __fastcall am_40BCFB(int a1, signed int a2); | 52 char __fastcall am_40BCFB(int a1, signed int a2); |
53 bool __fastcall am_40BE0E(int a1, signed int a2); | 53 bool PlayCard(int player_num, signed int card_slot_num); |
54 bool am_40BF15(int player_num, int hand_card_indx); | 54 bool CanCardBePlayed(int player_num, int hand_card_indx); |
55 void __fastcall am_40BF77(int a1, unsigned int uCardID); // idb | 55 void __fastcall am_40BF77(int a1, unsigned int uCardID); // idb |
56 int am_40D2B4(POINT* a1, int a2); // weak | 56 int am_40D2B4(POINT* a1, int a2); // weak |
57 int __fastcall am_40D402(int, int); // weak | 57 int __fastcall am_40D402(int, int); // weak |
58 int __cdecl am_40D444(); | 58 int __cdecl GameResultsApply(); |
59 | 59 |
60 void pPrimaryWindow_draws_text(int a1, const char *pText, POINT *pXY); | 60 void pPrimaryWindow_draws_text(int a1, const char *pText, POINT *pXY); |
61 void __thiscall am_BeginScene(unsigned __int16 *pPcxPixels, int a2, int a3); // idb | 61 void __thiscall am_BeginScene(unsigned __int16 *pPcxPixels, int a2, int a3); // idb |
62 void __fastcall Blt_Chroma(RECT *pSrcXYZW, POINT *pTargetXY, int a3, int a4); | 62 void __fastcall Blt_Chroma(RECT *pSrcXYZW, POINT *pTargetXY, int a3, int a4); |
63 void Blt_Copy(RECT *pSrcRect, POINT *pTargetXY, int a3); | 63 void Blt_Copy(RECT *pSrcRect, POINT *pTargetXY, int a3); |
69 char *__fastcall inv_strcpy(const char *Source, char *Dest); | 69 char *__fastcall inv_strcpy(const char *Source, char *Dest); |
70 void __fastcall intToString(int val, char *pOut); | 70 void __fastcall intToString(int val, char *pOut); |
71 | 71 |
72 /* 388 */ | 72 /* 388 */ |
73 #pragma pack(push, 1) | 73 #pragma pack(push, 1) |
74 struct stru348 | 74 struct ArcomageStartConditions |
75 { | 75 { |
76 __int16 field_0; | 76 __int16 max_tower; |
77 __int16 field_2; | 77 __int16 max_resources; |
78 __int16 field_4; | 78 __int16 tower_height; |
79 __int16 field_6; | 79 __int16 wall_height; |
80 __int16 field_8; | 80 __int16 quarry_level; |
81 __int16 field_A; | 81 __int16 magic_level; |
82 __int16 field_C; | 82 __int16 might_level; |
83 __int16 field_E; | 83 __int16 bricks_amount; |
84 __int16 field_10; | 84 __int16 gems_amount; |
85 __int16 field_12; | 85 __int16 beasts_amount; |
86 int field_14; | 86 int field_14; |
87 }; | 87 }; |
88 #pragma pack(pop) | 88 #pragma pack(pop) |
89 stru348 stru_4E1890[13] = | 89 ArcomageStartConditions start_conditions[13] = |
90 { | 90 { |
91 { 30, 100, 15, 5, 2, 2, 2, 10, 10, 10, 0}, | 91 { 30, 100, 15, 5, 2, 2, 2, 10, 10, 10, 0}, |
92 { 50, 150, 20, 5, 2, 2, 2, 5, 5, 5, 1}, | 92 { 50, 150, 20, 5, 2, 2, 2, 5, 5, 5, 1}, |
93 { 50, 150, 20, 5, 2, 2, 2, 5, 5, 5, 2}, | 93 { 50, 150, 20, 5, 2, 2, 2, 5, 5, 5, 2}, |
94 { 75, 200, 25, 10, 3, 3, 3, 5, 5, 5, 2}, | 94 { 75, 200, 25, 10, 3, 3, 3, 5, 5, 5, 2}, |
147 | 147 |
148 | 148 |
149 | 149 |
150 char am_byte_4E185D; // weak | 150 char am_byte_4E185D; // weak |
151 | 151 |
152 int amuint_4E1860; // weak | 152 int start_tower_height; // weak |
153 int amuint_4E1864; // weak | 153 int start_wall_height; // weak |
154 int amuint_4E1868; // weak | 154 int start_quarry_level; // weak |
155 int amuint_4E186C; // weak | 155 int start_magic_level; // weak |
156 int amuint_4E1870; // weak | 156 int start_might_level; // weak |
157 | 157 |
158 | 158 |
159 int dword_4E1874 = 5; // weak | 159 int dword_4E1874 = 5; // weak |
160 int dword_4E1878 = 1; // weak | 160 int quarry_bonus = 1; // weak |
161 int dword_4E187C = 1; // weak | 161 int magic_bonus = 1; // weak |
162 int dword_4E1880 = 1; // weak | 162 int might_bonus = 1; // weak |
163 int dword_4E1884 = 50; // weak | 163 |
164 int dword_4E1888 = 100 ; // weak | 164 int max_tower_height = 50; // weak |
165 int max_resources_amount = 100 ; // weak | |
165 | 166 |
166 int dword_4DF3A4; // weak | 167 int dword_4DF3A4; // weak |
167 | 168 |
168 char byte_4FAA2C; // weak | 169 char byte_4FAA2C; // weak |
169 char byte_4FAA2D; // weak | 170 char byte_4FAA2D; // weak |
170 | 171 |
171 int amuint_4FAA6C; // idb | 172 int current_player_num; // idb |
172 char am_byte_4FAA77; // weak | 173 char am_byte_4FAA77; // weak |
173 | 174 |
174 signed int dword_4FABBC; // idb | 175 signed int dword_4FABBC; // idb |
175 unsigned int amuint_4FABC0; // idb | 176 unsigned int amuint_4FABC0; // idb |
176 | 177 |
177 int dword_4FABC8; // weak | 178 int dword_4FABC8; // weak |
179 | |
180 int start_bricks_amount; // weak | |
181 int start_gems_amount; // weak | |
182 int start_beasts_amount; // weak | |
178 | 183 |
179 | 184 |
180 //----- (0040DD2F) -------------------------------------------------------- | 185 //----- (0040DD2F) -------------------------------------------------------- |
181 bool stru273::_40DD2F() | 186 bool stru273::_40DD2F() |
182 { | 187 { |
1549 int v1; // ecx@14 | 1554 int v1; // ecx@14 |
1550 signed int v2; // eax@15 | 1555 signed int v2; // eax@15 |
1551 stru272 *v3; // esi@17 | 1556 stru272 *v3; // esi@17 |
1552 __int16 *v4; // esi@23 | 1557 __int16 *v4; // esi@23 |
1553 | 1558 |
1554 while ( !pArcomageGame->field_F5 ) | 1559 while ( !pArcomageGame->GameOver ) |
1555 { | 1560 { |
1556 pArcomageGame->field_F6 = 1; | 1561 pArcomageGame->field_F6 = 1; |
1557 byte_4FAA24 = 1; | 1562 byte_4FAA24 = 1; |
1558 am_40A346(amuint_4FAA6C); | 1563 IncreaseResourcesInTurn(current_player_num); |
1559 LABEL_8: | 1564 LABEL_8: |
1560 while ( byte_4FAA24 ) | 1565 while ( byte_4FAA24 ) |
1561 { | 1566 { |
1562 amuint_4FABC0 = -1; | 1567 amuint_4FABC0 = -1; |
1563 am_40A283(amuint_4FAA6C); | 1568 am_40A283(current_player_num); |
1564 while ( 1 ) | 1569 while ( 1 ) |
1565 { | 1570 { |
1566 byte_4FAA24 = am_40A560(amuint_4FAA6C); | 1571 byte_4FAA24 = am_40A560(current_player_num); |
1567 if ( GetPlayerHandCardCount(amuint_4FAA6C) <= dword_4E1874 ) | 1572 if ( GetPlayerHandCardCount(current_player_num) <= dword_4E1874 ) |
1568 break; | 1573 break; |
1569 am_byte_4FAA77 = 1; | 1574 am_byte_4FAA77 = 1; |
1570 if ( pArcomageGame->field_F4 ) | 1575 if ( pArcomageGame->field_F4 ) |
1571 goto LABEL_8; | 1576 goto LABEL_8; |
1572 } | 1577 } |
1573 am_byte_4FAA77 = 0; | 1578 am_byte_4FAA77 = 0; |
1574 } | 1579 } |
1575 pArcomageGame->field_F5 = am_40A514(); | 1580 pArcomageGame->GameOver = IsGameOver(); |
1576 if ( !pArcomageGame->field_F5 ) | 1581 if ( !pArcomageGame->GameOver ) |
1577 am_40A383(); | 1582 am_40A383(); |
1578 if ( pArcomageGame->field_F4 ) | 1583 if ( pArcomageGame->field_F4 ) |
1579 pArcomageGame->field_F5 = 1; | 1584 pArcomageGame->GameOver = 1; |
1580 } | 1585 } |
1581 am_40D444(); | 1586 GameResultsApply(); |
1582 if ( byte_4FAA2C ) | 1587 if ( byte_4FAA2C ) |
1583 { | 1588 { |
1584 // v2 = retzero_sub_40DFA7((int)dword_4FAA28); | 1589 // v2 = retzero_sub_40DFA7((int)dword_4FAA28); |
1585 // v1 = 1000; | 1590 // v1 = 1000; |
1586 // dword_4FAA70 = v2 / 1000; | 1591 // dword_4FAA70 = v2 / 1000; |
1611 | 1616 |
1612 | 1617 |
1613 | 1618 |
1614 | 1619 |
1615 //----- (00409FE9) -------------------------------------------------------- | 1620 //----- (00409FE9) -------------------------------------------------------- |
1616 void am_409FE9() | 1621 void SetStartGameData() |
1617 { | 1622 { |
1618 | 1623 |
1619 signed int j; // edx@7 | 1624 signed int j; // edx@7 |
1620 int card_id_counter; // edx@13 | 1625 int card_id_counter; // edx@13 |
1621 signed int i; // ecx@13 | 1626 signed int i; // ecx@13 |
1622 signed int card_dispenser_counter; // eax@13 | 1627 signed int card_dispenser_counter; // eax@13 |
1623 | 1628 |
1624 amuint_4FAA6C = dword_505890; | 1629 current_player_num = dword_505890; |
1625 sub_409BE8(); | 1630 SetStartConditions(); |
1626 for(i=0; i<2; ++i ) | 1631 for(i=0; i<2; ++i ) |
1627 { | 1632 { |
1628 if ( i ) | 1633 if ( i ) |
1629 { | 1634 { |
1630 strcpy(am_Players[1].pPlayerName, pArcomageGame->pPlayer2Name); | 1635 strcpy(am_Players[1].pPlayerName, pArcomageGame->pPlayer2Name); |
1631 if ( byte_4E185C ) | 1636 if ( byte_4E185C ) |
1632 am_Players[1].field_20 = 0; | 1637 am_Players[1].IsHisTurn = 0; |
1633 else | 1638 else |
1634 am_Players[1].field_20 = 1; | 1639 am_Players[1].IsHisTurn = 1; |
1635 } | 1640 } |
1636 else | 1641 else |
1637 { | 1642 { |
1638 strcpy(am_Players[0].pPlayerName, pArcomageGame->pPlayer1Name); | 1643 strcpy(am_Players[0].pPlayerName, pArcomageGame->pPlayer1Name); |
1639 am_Players[0].field_20 = 1; | 1644 am_Players[0].IsHisTurn = 1; |
1640 } | 1645 } |
1641 am_Players[i].field_24 = amuint_4E1860; | 1646 am_Players[i].tower_height = start_tower_height; |
1642 am_Players[i].field_28 = amuint_4E1864; | 1647 am_Players[i].wall_height = start_wall_height; |
1643 am_Players[i].field_2C = amuint_4E1868; | 1648 am_Players[i].quarry_level = start_quarry_level; |
1644 am_Players[i].field_30 = amuint_4E186C; | 1649 am_Players[i].magic_level = start_magic_level; |
1645 am_Players[i].field_34 = amuint_4E1870; | 1650 am_Players[i].might_level = start_might_level; |
1646 am_Players[i].field_38 = amuint_505884; | 1651 am_Players[i].resource_bricks = start_bricks_amount; |
1647 am_Players[i].field_3C = amuint_505888; | 1652 am_Players[i].resource_gems = start_gems_amount; |
1648 am_Players[i].field_40 = amuint_50588C; | 1653 am_Players[i].resource_beasts = start_beasts_amount; |
1649 | 1654 |
1650 for (j=0; j<10; ++j ) | 1655 for (j=0; j<10; ++j ) |
1651 { | 1656 { |
1652 am_Players[i].cards_at_hand[j] = -1; | 1657 am_Players[i].cards_at_hand[j] = -1; |
1653 if ( am_byte_4E185D ) | 1658 if ( am_byte_4E185D ) |
1696 default: | 1701 default: |
1697 ++card_id_counter; | 1702 ++card_id_counter; |
1698 } | 1703 } |
1699 } | 1704 } |
1700 | 1705 |
1701 am_40A198(); | 1706 FillPlayerDeck(); |
1702 } | 1707 } |
1703 | 1708 |
1704 //----- (0040A198) -------------------------------------------------------- | 1709 //----- (0040A198) -------------------------------------------------------- |
1705 void am_40A198() | 1710 void FillPlayerDeck() |
1706 { | 1711 { |
1707 | 1712 |
1708 signed int v3; // eax@4 | 1713 signed int v3; // eax@4 |
1709 int v6; // edx@13 | 1714 int v6; // edx@13 |
1710 char v7; // eax@13 | 1715 char v7; // eax@13 |
1740 v6 = rand() % DECK_SIZE; | 1745 v6 = rand() % DECK_SIZE; |
1741 v7 = card_taken_flags[v6]; | 1746 v7 = card_taken_flags[v6]; |
1742 } | 1747 } |
1743 while ( v7 == 1 ); | 1748 while ( v7 == 1 ); |
1744 card_taken_flags[v6]=1; | 1749 card_taken_flags[v6]=1; |
1745 playDeck.cards_IDs[i] = deckMaster.cards_IDs[v6]; | 1750 playDeck.cards_IDs[i] = deckMaster.cards_IDs[v6]; |
1746 playDeck.cardsInUse[i] = deckMaster.cardsInUse[v6]; | 1751 playDeck.cardsInUse[i] = deckMaster.cardsInUse[v6]; |
1747 } | 1752 } |
1748 | 1753 |
1749 dword_4FABC8 = 0; | 1754 dword_4FABC8 = 0; |
1750 amuint_4FABC4 = -1; | 1755 amuint_4FABC4 = -1; |
1781 v5 = false; | 1786 v5 = false; |
1782 do | 1787 do |
1783 { | 1788 { |
1784 if ( v2 >= DECK_SIZE ) | 1789 if ( v2 >= DECK_SIZE ) |
1785 { | 1790 { |
1786 am_40A198(); | 1791 FillPlayerDeck(); |
1787 v2 = dword_4FABC8; | 1792 v2 = dword_4FABC8; |
1788 } | 1793 } |
1789 if ( !playDeck.cardsInUse[v2] ) | 1794 if ( !playDeck.cardsInUse[v2] ) |
1790 { | 1795 { |
1791 v3 = playDeck.cards_IDs[v2]; | 1796 v3 = playDeck.cards_IDs[v2]; |
1794 ++v2; | 1799 ++v2; |
1795 dword_4FABC8 = v2; | 1800 dword_4FABC8 = v2; |
1796 } | 1801 } |
1797 while ( !v5 ); | 1802 while ( !v5 ); |
1798 | 1803 |
1799 ArcomageGame::PlaySound(0x15u); | 1804 ArcomageGame::PlaySound(21); |
1800 result = GetEmptyCardSlotIndex(v4); | 1805 result = GetEmptyCardSlotIndex(v4); |
1801 if ( result != -1 ) | 1806 if ( result != -1 ) |
1802 { | 1807 { |
1803 amuint_4FAA4C = result; | 1808 amuint_4FAA4C = result; |
1804 am_Players[a1].cards_at_hand[result] = v3; | 1809 am_Players[a1].cards_at_hand[result] = v3; |
1825 else | 1830 else |
1826 return i; | 1831 return i; |
1827 } | 1832 } |
1828 | 1833 |
1829 //----- (0040A346) -------------------------------------------------------- | 1834 //----- (0040A346) -------------------------------------------------------- |
1830 void am_40A346( int player_num ) | 1835 void IncreaseResourcesInTurn( int player_num ) |
1831 { | 1836 { |
1832 am_Players[player_num].field_38 += dword_4E1878 + am_Players[player_num].field_2C; | 1837 am_Players[player_num].resource_bricks += quarry_bonus + am_Players[player_num].quarry_level; |
1833 am_Players[player_num].field_3C += dword_4E187C + am_Players[player_num].field_30; | 1838 am_Players[player_num].resource_gems += magic_bonus + am_Players[player_num].magic_level; |
1834 am_Players[player_num].field_40 += dword_4E1880 + am_Players[player_num].field_34; | 1839 am_Players[player_num].resource_beasts += might_bonus + am_Players[player_num].might_level; |
1835 } | 1840 } |
1836 | 1841 |
1837 | 1842 |
1838 //----- (0040A383) -------------------------------------------------------- | 1843 //----- (0040A383) -------------------------------------------------------- |
1839 void __cdecl am_40A383() | 1844 void __cdecl am_40A383() |
1849 ArcomageGame_stru1 v10; // [sp+54h] [bp-14h]@7 | 1854 ArcomageGame_stru1 v10; // [sp+54h] [bp-14h]@7 |
1850 POINT v11; // [sp+60h] [bp-8h]@4 | 1855 POINT v11; // [sp+60h] [bp-8h]@4 |
1851 | 1856 |
1852 if ( !pArcomageGame->field_F4 ) | 1857 if ( !pArcomageGame->field_F4 ) |
1853 { | 1858 { |
1854 if ( am_Players[0].field_20 != 1 || am_Players[1].field_20 != 1 ) | 1859 if ( am_Players[0].IsHisTurn != 1 || am_Players[1].IsHisTurn != 1 ) |
1855 { | 1860 { |
1856 ++amuint_4FAA6C; | 1861 ++current_player_num; |
1857 am_byte_4FAA75 = 1; | 1862 am_byte_4FAA75 = 1; |
1858 if ( amuint_4FAA6C >= 2 ) | 1863 if ( current_player_num >= 2 ) |
1859 amuint_4FAA6C = 0; | 1864 current_player_num = 0; |
1860 } | 1865 } |
1861 else | 1866 else |
1862 { | 1867 { |
1863 //nullsub_1(); | 1868 //nullsub_1(); |
1864 v11.x = 0; | 1869 v11.x = 0; |
1867 v0 = 0; | 1872 v0 = 0; |
1868 v11.y = 200; | 1873 v11.y = 200; |
1869 v11.x = 320 - 12 * v0 / 2; | 1874 v11.x = 320 - 12 * v0 / 2; |
1870 pPrimaryWindow_draws_text(-1, Dest, &v11); | 1875 pPrimaryWindow_draws_text(-1, Dest, &v11); |
1871 am_byte_4FAA75 = 1; | 1876 am_byte_4FAA75 = 1; |
1872 v1 = amuint_4FAA6C + 1; | 1877 v1 = current_player_num + 1; |
1873 v3 = __OFSUB__(amuint_4FAA6C + 1, 2); | 1878 v3 = __OFSUB__(current_player_num + 1, 2); |
1874 v2 = amuint_4FAA6C++ - 1 < 0; | 1879 v2 = current_player_num++ - 1 < 0; |
1875 if ( !(v2 ^ v3) ) | 1880 if ( !(v2 ^ v3) ) |
1876 { | 1881 { |
1877 v1 = 0; | 1882 v1 = 0; |
1878 amuint_4FAA6C = 0; | 1883 current_player_num = 0; |
1879 } | 1884 } |
1880 inv_strcpy(am_Players[v1].pPlayerName, Dest); | 1885 inv_strcpy(am_Players[v1].pPlayerName, Dest); |
1881 v4 = 0; | 1886 v4 = 0; |
1882 v11.y = 260; | 1887 v11.y = 260; |
1883 v11.x = 320 - 12 * v4 / 2; | 1888 v11.x = 320 - 12 * v4 / 2; |
1884 pPrimaryWindow_draws_text(-1, Dest, &v11); | 1889 pPrimaryWindow_draws_text(-1, Dest, &v11); |
1885 v6.left = 0; | 1890 /* v6.left = 0; |
1886 v6.right = 640; | 1891 v6.right = 640; |
1887 v6.top = 0; | 1892 v6.top = 0; |
1888 v6.bottom = 480; | 1893 v6.bottom = 480;*/ |
1889 //nullsub_1(); | 1894 //nullsub_1(); |
1890 CallRenderPresent(); | 1895 CallRenderPresent(); |
1891 //nullsub_1(); | 1896 //nullsub_1(); |
1892 while ( 1 ) | 1897 while ( 1 ) |
1893 { | 1898 { |
1910 } | 1915 } |
1911 } | 1916 } |
1912 pArcomageGame->field_F4 = 1; | 1917 pArcomageGame->field_F4 = 1; |
1913 byte_4FAA74 = 1; | 1918 byte_4FAA74 = 1; |
1914 LABEL_13: | 1919 LABEL_13: |
1915 v11.x = 0; | 1920 /* v11.x = 0; |
1916 v11.y = 0; | 1921 v11.y = 0; |
1917 v6.left = 0; | 1922 v6.left = 0; |
1918 v6.right = 640; | 1923 v6.right = 640; |
1919 v6.top = 0; | 1924 v6.top = 0; |
1920 v6.bottom = 480; | 1925 v6.bottom = 480;*/ |
1921 //nullsub_1(); | 1926 //nullsub_1(); |
1922 CallRenderPresent(); | 1927 CallRenderPresent(); |
1923 } | 1928 } |
1924 } | 1929 } |
1925 } | 1930 } |
1926 | 1931 |
1927 | 1932 |
1928 //----- (0040A514) -------------------------------------------------------- | 1933 //----- (0040A514) -------------------------------------------------------- |
1929 bool am_40A514() | 1934 bool IsGameOver() |
1930 { | 1935 { |
1931 bool result; // eax@1 | 1936 bool result; // eax@1 |
1932 | 1937 |
1933 result = false; | 1938 result = false; |
1934 for(int i=0; i<2; ++i) | 1939 for(int i=0; i<2; ++i) |
1935 { | 1940 { |
1936 if ( am_Players[i].field_24 <= 0 ) | 1941 if ( am_Players[i].tower_height <= 0 ) |
1937 result = true; | 1942 result = true; |
1938 if ( am_Players[i].field_24 >= dword_4E1884 ) | 1943 if ( am_Players[i].tower_height >= max_tower_height ) |
1939 result = true; | 1944 result = true; |
1940 if ( am_Players[i].field_38 >= dword_4E1888 | 1945 if ( am_Players[i].resource_bricks >= max_resources_amount |
1941 || am_Players[i].field_3C >= dword_4E1888 | 1946 || am_Players[i].resource_gems >= max_resources_amount |
1942 || am_Players[i].field_40 >= dword_4E1888 ) | 1947 || am_Players[i].resource_beasts >= max_resources_amount ) |
1943 result = true; | 1948 result = true; |
1944 } | 1949 } |
1945 | 1950 |
1946 if ( result ) | 1951 if ( result ) |
1947 byte_4FAA2C = 1; | 1952 byte_4FAA2C = 1; |
1948 return result; | 1953 return result; |
1949 } | 1954 } |
1950 // 4E1884: using guessed type int dword_4E1884; | 1955 |
1951 // 4E1888: using guessed type int dword_4E1888; | |
1952 // 4FAA2C: using guessed type char byte_4FAA2C; | |
1953 | 1956 |
1954 //----- (0040A560) -------------------------------------------------------- | 1957 //----- (0040A560) -------------------------------------------------------- |
1955 char am_40A560(unsigned int _this) | 1958 char am_40A560(unsigned int _this) |
1956 { | 1959 { |
1957 int v1; // ebp@0 | 1960 int v1; // ebp@0 |
2012 byte_4FAA74 = 1; | 2015 byte_4FAA74 = 1; |
2013 v16 = 1; | 2016 v16 = 1; |
2014 pArcomageGame->field_F4 = 1; | 2017 pArcomageGame->field_F4 = 1; |
2015 break; | 2018 break; |
2016 } | 2019 } |
2017 v4 = amuint_4FAA6C; | 2020 v4 = current_player_num; |
2018 if (am_Players[amuint_4FAA6C].field_20 != 1 && !byte_4FAA00 && !byte_4FAA2E && !byte_4FAA2D ) | 2021 if (am_Players[current_player_num].IsHisTurn != 1 && !byte_4FAA00 && !byte_4FAA2E && !byte_4FAA2D ) |
2019 { | 2022 { |
2020 if ( am_byte_4FAA75 ) | 2023 if ( am_byte_4FAA75 ) |
2021 am_byte_4FAA76 = 1; | 2024 am_byte_4FAA76 = 1; |
2022 am_408BB4(amuint_4FAA6C); | 2025 am_408BB4(current_player_num); |
2023 v4 = amuint_4FAA6C; | 2026 v4 = current_player_num; |
2024 byte_4FAA2E = 1; | 2027 byte_4FAA2E = 1; |
2025 } | 2028 } |
2026 if ( amuint_4FAA4C != -1 && amuint_4FAA38 > 10 ) | 2029 if ( amuint_4FAA4C != -1 && amuint_4FAA38 > 10 ) |
2027 amuint_4FAA38 = 10; | 2030 amuint_4FAA38 = 10; |
2028 if ( byte_4FAA2E || byte_4FAA2D ||am_Players[v4].field_20 != 1 ) | 2031 if ( byte_4FAA2E || byte_4FAA2D ||am_Players[v4].IsHisTurn != 1 ) |
2029 { | 2032 { |
2030 pArcomageGame->field_F6 = 1; | 2033 pArcomageGame->field_F6 = 1; |
2031 if ( byte_4FAA2D ) | 2034 if ( byte_4FAA2D ) |
2032 { | 2035 { |
2033 --amuint_4FAA38; | 2036 --amuint_4FAA38; |
2086 } | 2089 } |
2087 else | 2090 else |
2088 { | 2091 { |
2089 if ( a2.field_0 == 7 ) | 2092 if ( a2.field_0 == 7 ) |
2090 { | 2093 { |
2091 if ( am_40BE0E(a1, dword_4FABBC) ) | 2094 if ( PlayCard(a1, dword_4FABBC) ) |
2092 { | 2095 { |
2093 byte_4FAA2E = 1; | 2096 byte_4FAA2E = 1; |
2094 if ( am_byte_4FAA75 ) | 2097 if ( am_byte_4FAA75 ) |
2095 am_byte_4FAA76 = 1; | 2098 am_byte_4FAA76 = 1; |
2096 } | 2099 } |
2145 dword_4FABB8 = am_40BB67(a1); | 2148 dword_4FABB8 = am_40BB67(a1); |
2146 pArcomageGame->field_F6 = 1; | 2149 pArcomageGame->field_F6 = 1; |
2147 }*/ | 2150 }*/ |
2148 if ( pArcomageGame->field_F6 ) | 2151 if ( pArcomageGame->field_F6 ) |
2149 { | 2152 { |
2150 am_blts(v13); | 2153 DrawGameUI(v13); |
2151 DoBlt_Copy(pArcomageGame->pBackgroundPixels); | 2154 DoBlt_Copy(pArcomageGame->pBackgroundPixels); |
2152 pArcomageGame->field_F6 = 0; | 2155 pArcomageGame->field_F6 = 0; |
2153 } | 2156 } |
2154 if ( pArcomageGame->field_F9 ) | 2157 if ( pArcomageGame->field_F9 ) |
2155 { | 2158 { |
2160 pSrcXYZW.top = 0; | 2163 pSrcXYZW.top = 0; |
2161 pSrcXYZW.bottom = 480; | 2164 pSrcXYZW.bottom = 480; |
2162 am_BeginScene(pArcomageGame->pBackgroundPixels, -1, 1); | 2165 am_BeginScene(pArcomageGame->pBackgroundPixels, -1, 1); |
2163 Blt_Copy(&pSrcXYZW, &pTargetXY, 2); | 2166 Blt_Copy(&pSrcXYZW, &pTargetXY, 2); |
2164 am_EndScene(); | 2167 am_EndScene(); |
2165 am_blts(v13); | 2168 DrawGameUI(v13); |
2166 pRenderer->Present(); | 2169 pRenderer->Present(); |
2167 pArcomageGame->field_F9 = 0; | 2170 pArcomageGame->field_F9 = 0; |
2168 } | 2171 } |
2169 } | 2172 } |
2170 while ( !v16 ); | 2173 while ( !v16 ); |
2171 return dword_4FAA68 > 0; | 2174 return dword_4FAA68 > 0; |
2172 } | 2175 } |
2173 | 2176 |
2174 | 2177 |
2175 //----- (0040A9AF) -------------------------------------------------------- | 2178 //----- (0040A9AF) -------------------------------------------------------- |
2176 void am_blts( int a1 ) | 2179 void DrawGameUI( int a1 ) |
2177 { | 2180 { |
2178 | 2181 |
2179 am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1); | 2182 am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1); |
2180 am_chroma_blts(); | 2183 DrawRectanglesForText(); |
2181 am_EndScene(); | 2184 am_EndScene(); |
2185 | |
2182 am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1); | 2186 am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1); |
2183 am_40B4B9(); | 2187 am_40B4B9(); |
2184 am_chroma_and_copy_blts(); | 2188 DrawPlayersTowers(); |
2185 am_chroma_blt(); | 2189 DrawPlayersWall(); |
2186 am_DrawUI(); | 2190 DrawPlayersText(); |
2187 am_EndScene(); | 2191 am_EndScene(); |
2192 | |
2188 am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1); | 2193 am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1); |
2189 am_40B76F(a1); | 2194 am_40B76F(a1); |
2190 | 2195 |
2191 for( int i=0; i<10; ++i) | 2196 for( int i=0; i<10; ++i) |
2192 { | 2197 { |
2193 if (array_4FABD0[i].field_0) | 2198 if (array_4FABD0[i].field_0) |
2194 array_4FABD0[i].field_40->_40E133(); | 2199 array_4FABD0[i].field_40->_40E133(); |
2195 } | 2200 } |
2196 dword_4FABBC = am_40BB67(amuint_4FAA6C); | 2201 dword_4FABBC = am_40BB67(current_player_num); |
2197 am_40AA4E(); | 2202 am_40AA4E(); |
2198 am_EndScene(); | 2203 am_EndScene(); |
2199 } | 2204 } |
2200 | 2205 |
2201 //----- (0040AA4E) -------------------------------------------------------- | 2206 //----- (0040AA4E) -------------------------------------------------------- |
2240 } | 2245 } |
2241 | 2246 |
2242 } | 2247 } |
2243 | 2248 |
2244 //----- (0040AB0A) -------------------------------------------------------- | 2249 //----- (0040AB0A) -------------------------------------------------------- |
2245 void __cdecl am_chroma_blts() | 2250 void DrawRectanglesForText() |
2246 { | 2251 { |
2247 | 2252 |
2248 RECT pSrcRect; // [sp+Ch] [bp-18h]@1 | 2253 RECT pSrcRect; // [sp+Ch] [bp-18h]@1 |
2249 POINT pTargetXY; // [sp+1Ch] [bp-8h]@1 | 2254 POINT pTargetXY; // [sp+1Ch] [bp-8h]@1 |
2250 | 2255 //resources rectangles |
2251 pSrcRect.top = 0; | 2256 pSrcRect.top = 0; |
2252 pSrcRect.left = 765; | 2257 pSrcRect.left = 765; |
2253 pSrcRect.right = 843; | 2258 pSrcRect.right = 843; |
2254 pSrcRect.bottom = 216; | 2259 pSrcRect.bottom = 216; |
2255 | 2260 |
2259 | 2264 |
2260 pTargetXY.x = 555; | 2265 pTargetXY.x = 555; |
2261 pTargetXY.y = 56; | 2266 pTargetXY.y = 56; |
2262 Blt_Copy(&pSrcRect, &pTargetXY, 2); | 2267 Blt_Copy(&pSrcRect, &pTargetXY, 2); |
2263 | 2268 |
2269 //players name rectangle | |
2264 pSrcRect.left = 283; | 2270 pSrcRect.left = 283; |
2265 pSrcRect.right = 361; | 2271 pSrcRect.right = 361; |
2266 pSrcRect.top = 166; | 2272 pSrcRect.top = 166; |
2267 pSrcRect.bottom = 190; | 2273 pSrcRect.bottom = 190; |
2268 pTargetXY.x = 8; | 2274 pTargetXY.x = 8; |
2271 | 2277 |
2272 pTargetXY.x = 555; | 2278 pTargetXY.x = 555; |
2273 pTargetXY.y = 13; | 2279 pTargetXY.y = 13; |
2274 Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2); | 2280 Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2); |
2275 | 2281 |
2282 //tower heigth rectangle | |
2276 pSrcRect.left = 234; | 2283 pSrcRect.left = 234; |
2277 pSrcRect.right = 283; | 2284 pSrcRect.right = 283; |
2278 pSrcRect.top = 166; | 2285 pSrcRect.top = 166; |
2279 pSrcRect.bottom = 190; | 2286 pSrcRect.bottom = 190; |
2280 pTargetXY.x = 100; | 2287 pTargetXY.x = 100; |
2281 pTargetXY.y = 296; | 2288 pTargetXY.y = 296; |
2282 Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2); | 2289 Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2); |
2283 | 2290 |
2284 | |
2285 pTargetXY.x = 492; | 2291 pTargetXY.x = 492; |
2286 pTargetXY.y = 296; | 2292 pTargetXY.y = 296; |
2287 Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2); | 2293 Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2); |
2288 | 2294 |
2289 | 2295 //wall heigth rectangle |
2290 pSrcRect.left = 192; | 2296 pSrcRect.left = 192; |
2291 pSrcRect.right = 234; | 2297 pSrcRect.right = 234; |
2292 pSrcRect.top = 166; | 2298 pSrcRect.top = 166; |
2293 pSrcRect.bottom = 190; | 2299 pSrcRect.bottom = 190; |
2294 pTargetXY.x = 168; | 2300 pTargetXY.x = 168; |
2299 pTargetXY.y = 296; | 2305 pTargetXY.y = 296; |
2300 Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2); | 2306 Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2); |
2301 } | 2307 } |
2302 | 2308 |
2303 //----- (0040AC5F) -------------------------------------------------------- | 2309 //----- (0040AC5F) -------------------------------------------------------- |
2304 void __cdecl am_DrawUI() | 2310 void DrawPlayersText() |
2305 { | 2311 { |
2306 int v0; // ecx@7 | 2312 |
2307 int v1; // ecx@9 | 2313 int res_value; // ecx@18 |
2308 int v2; // eax@11 | 2314 char text_buff[32]; // [sp+Ch] [bp-28h]@2 |
2309 int v3; // ecx@12 | 2315 POINT text_position; // [sp+2Ch] [bp-8h]@2 |
2310 int v4; // eax@14 | |
2311 int v5; // ecx@14 | |
2312 int v6; // eax@16 | |
2313 int v7; // ecx@16 | |
2314 int v8; // eax@18 | |
2315 int v9; // ecx@18 | |
2316 int v10; // eax@20 | |
2317 char Dest[32]; // [sp+Ch] [bp-28h]@2 | |
2318 POINT v12; // [sp+2Ch] [bp-8h]@2 | |
2319 | 2316 |
2320 if ( am_byte_4FAA77 ) | 2317 if ( am_byte_4FAA77 ) |
2321 { | 2318 { |
2322 inv_strcpy(pGlobalTXT_LocalizationStrings[266], Dest);// DISCARD A CARD | 2319 inv_strcpy(pGlobalTXT_LocalizationStrings[266], text_buff);// DISCARD A CARD |
2323 v12.x = 320 - pArcomageGame->pfntArrus->GetLineWidth(Dest) / 2; | 2320 text_position.x = 320 - pArcomageGame->pfntArrus->GetLineWidth(text_buff) / 2; |
2324 v12.y = 306; | 2321 text_position.y = 306; |
2325 pPrimaryWindow_draws_text(-1, Dest, &v12); | 2322 pPrimaryWindow_draws_text(-1, text_buff, &text_position); |
2326 } | 2323 } |
2327 inv_strcpy(am_Players[0].pPlayerName, Dest); | 2324 inv_strcpy(am_Players[0].pPlayerName, text_buff); |
2328 if ( !amuint_4FAA6C ) | 2325 if ( !current_player_num ) |
2329 inv_strcat("***", Dest); | 2326 inv_strcat("***", text_buff); |
2330 v12.x = 47 - pArcomageGame->pfntComic->GetLineWidth(Dest) / 2; | 2327 text_position.x = 47 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2; |
2331 v12.y = 21; | 2328 text_position.y = 21; |
2332 pPrimaryWindow_draws_text(-1, Dest, &v12); | 2329 pPrimaryWindow_draws_text(-1, text_buff, &text_position); |
2333 | 2330 |
2334 inv_strcpy(am_Players[1].pPlayerName, Dest); | 2331 inv_strcpy(am_Players[1].pPlayerName, text_buff); |
2335 if ( amuint_4FAA6C == 1 ) | 2332 if ( current_player_num == 1 ) |
2336 inv_strcat("***", Dest); | 2333 inv_strcat("***", text_buff); |
2337 v12.x = 595 - pArcomageGame->pfntComic->GetLineWidth(Dest) / 2; | 2334 text_position.x = 595 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2; |
2338 v12.y = 21; | 2335 text_position.y = 21; |
2339 pPrimaryWindow_draws_text(-1, Dest, &v12); | 2336 pPrimaryWindow_draws_text(-1, text_buff, &text_position); |
2340 | 2337 |
2341 intToString(am_Players[0].field_24, Dest); | 2338 intToString(am_Players[0].tower_height, text_buff); |
2342 v12.x = 123 - pArcomageGame->pfntComic->GetLineWidth(Dest) / 2; | 2339 text_position.x = 123 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2; |
2343 v12.y = 305; | 2340 text_position.y = 305; |
2344 pPrimaryWindow_draws_text(-1, Dest, &v12); | 2341 pPrimaryWindow_draws_text(-1, text_buff, &text_position); |
2345 | 2342 |
2346 intToString(am_Players[1].field_24, Dest); | 2343 intToString(am_Players[1].tower_height, text_buff); |
2347 v12.x = 515 - pArcomageGame->pfntComic->GetLineWidth(Dest) / 2; | 2344 text_position.x = 515 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2; |
2348 v12.y = 305; | 2345 text_position.y = 305; |
2349 pPrimaryWindow_draws_text(-1, Dest, &v12); | 2346 pPrimaryWindow_draws_text(-1, text_buff, &text_position); |
2350 | 2347 |
2351 intToString(am_Players[0].field_28, Dest); | 2348 intToString(am_Players[0].wall_height, text_buff); |
2352 v12.x = 188 - pArcomageGame->pfntComic->GetLineWidth(Dest) / 2; | 2349 text_position.x = 188 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2; |
2353 v12.y = 305; | 2350 text_position.y = 305; |
2354 pPrimaryWindow_draws_text(-1, Dest, &v12); | 2351 pPrimaryWindow_draws_text(-1, text_buff, &text_position); |
2355 | 2352 |
2356 intToString(am_Players[1].field_28, Dest); | 2353 intToString(am_Players[1].wall_height, text_buff); |
2357 v12.x = 451 - pArcomageGame->pfntComic->GetLineWidth(Dest) / 2; | 2354 text_position.x = 451 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2; |
2358 v12.y = 305; | 2355 text_position.y = 305; |
2359 pPrimaryWindow_draws_text(-1, Dest, &v12); | 2356 pPrimaryWindow_draws_text(-1, text_buff, &text_position); |
2360 | 2357 |
2361 v0 = am_Players[0].field_2C; | 2358 res_value = am_Players[0].quarry_level; |
2362 if ( byte_4E185E ) | 2359 if ( byte_4E185E ) |
2363 v0 = dword_4E1878 + am_Players[0].field_2C; | 2360 res_value =am_Players[0].quarry_level + quarry_bonus; |
2364 intToString(v0, Dest); | 2361 intToString(res_value, text_buff); |
2365 v12.x = 14 - 6 * 0 / 2; | 2362 text_position.x = 14;// - 6 * 0 / 2; |
2366 v12.y = 92; | 2363 text_position.y = 92; |
2367 am_40B102(-1, Dest, &v12); | 2364 DrawPlayerLevels(-1, text_buff, &text_position); |
2368 | 2365 |
2369 v1 = am_Players[1].field_2C; | 2366 res_value = am_Players[1].quarry_level; |
2370 if ( byte_4E185E ) | 2367 if ( byte_4E185E ) |
2371 v1 = dword_4E1878 + am_Players[1].field_2C; | 2368 res_value = am_Players[1].quarry_level + quarry_bonus; |
2372 intToString(v1, Dest); | 2369 intToString(res_value, text_buff); |
2373 v2 = 0; | 2370 // v2 = 0; |
2374 v12.y = 92; | 2371 text_position.y = 92; |
2375 v12.x = 561 - 6 * v2 / 2; | 2372 text_position.x = 561; //- 6 * v2 / 2; |
2376 am_40B102(-1, Dest, &v12); | 2373 DrawPlayerLevels(-1, text_buff, &text_position); |
2377 | 2374 |
2375 res_value = am_Players[0].magic_level; | |
2378 if ( byte_4E185E ) | 2376 if ( byte_4E185E ) |
2379 v3 = am_Players[0].field_30 + dword_4E187C; | 2377 res_value = am_Players[0].magic_level + magic_bonus; |
2380 else | 2378 intToString(res_value, text_buff); |
2381 v3 = am_Players[0].field_30; | 2379 // v4 = 0; |
2382 intToString(v3, Dest); | 2380 text_position.y = 164; |
2383 v4 = 0; | 2381 text_position.x = 14; //- 6 * v4 / 2; |
2384 v12.y = 164; | 2382 DrawPlayerLevels(-1, text_buff, &text_position); |
2385 v12.x = 14 - 6 * v4 / 2; | 2383 |
2386 am_40B102(-1, Dest, &v12); | 2384 res_value = am_Players[1].magic_level; |
2387 | |
2388 v5 = am_Players[1].field_30; | |
2389 if ( byte_4E185E ) | 2385 if ( byte_4E185E ) |
2390 v5 = dword_4E187C + am_Players[1].field_30; | 2386 res_value = am_Players[1].magic_level+magic_bonus; |
2391 intToString(v5, Dest); | 2387 intToString(res_value, text_buff); |
2392 v6 = 0; | 2388 // v6 = 0; |
2393 v12.y = 164; | 2389 text_position.y = 164; |
2394 v12.x = 561 - 6 * v6 / 2; | 2390 text_position.x = 561; //- 6 * v6 / 2; |
2395 am_40B102(-1, Dest, &v12); | 2391 DrawPlayerLevels(-1, text_buff, &text_position); |
2396 | 2392 |
2397 v7 = am_Players[0].field_34; | 2393 res_value = am_Players[0].might_level; |
2398 if ( byte_4E185E ) | 2394 if ( byte_4E185E ) |
2399 v7 = dword_4E1880 + am_Players[0].field_34; | 2395 res_value = am_Players[0].might_level + might_bonus; |
2400 intToString(v7, Dest); | 2396 intToString(res_value, text_buff); |
2401 v8 = 0; | 2397 // v8 = 0; |
2402 v12.y = 236; | 2398 text_position.y = 236; |
2403 v12.x = 14 - 6 * v8 / 2; | 2399 text_position.x = 14;// - 6 * v8 / 2; |
2404 am_40B102(-1, Dest, &v12); | 2400 DrawPlayerLevels(-1, text_buff, &text_position); |
2405 | 2401 |
2406 v9 = am_Players[1].field_34; | 2402 res_value = am_Players[1].might_level; |
2407 if ( byte_4E185E ) | 2403 if ( byte_4E185E ) |
2408 v9 = dword_4E1880 + am_Players[1].field_34; | 2404 res_value = am_Players[1].might_level + might_bonus; |
2409 intToString(v9, Dest); | 2405 intToString(res_value, text_buff); |
2410 v10 = 0; | 2406 // v10 = 0; |
2411 v12.y = 236; | 2407 text_position.y = 236; |
2412 v12.x = 561 - 6 * v10 / 2; | 2408 text_position.x = 561;// - 6 * v10 / 2; |
2413 am_40B102(-1, Dest, &v12); | 2409 DrawPlayerLevels(-1, text_buff, &text_position); |
2414 | 2410 |
2415 intToString(am_Players[0].field_38, Dest); | 2411 intToString(am_Players[0].resource_bricks, text_buff); |
2416 v12.y = 114; | 2412 text_position.y = 114; |
2417 v12.x = 10; | 2413 text_position.x = 10; |
2418 am_40B17E(-1, Dest, &v12); | 2414 DrawBricksCount(-1, text_buff, &text_position); |
2419 | 2415 |
2420 intToString(am_Players[1].field_38, Dest); | 2416 intToString(am_Players[1].resource_bricks, text_buff); |
2421 v12.x = 557; | 2417 text_position.x = 557; |
2422 v12.y = 114; | 2418 text_position.y = 114; |
2423 am_40B17E(-1, Dest, &v12); | 2419 DrawBricksCount(-1, text_buff, &text_position); |
2424 | 2420 |
2425 intToString(am_Players[0].field_3C, Dest); | 2421 intToString(am_Players[0].resource_gems, text_buff); |
2426 v12.x = 10; | 2422 text_position.x = 10; |
2427 v12.y = 186; | 2423 text_position.y = 186; |
2428 am_40B1F3(-1, Dest, &v12); | 2424 DrawGemsCount(-1, text_buff, &text_position); |
2429 | 2425 |
2430 intToString(am_Players[1].field_3C, Dest); | 2426 intToString(am_Players[1].resource_gems, text_buff); |
2431 v12.x = 557; | 2427 text_position.x = 557; |
2432 v12.y = 186; | 2428 text_position.y = 186; |
2433 am_40B1F3(-1, Dest, &v12); | 2429 DrawGemsCount(-1, text_buff, &text_position); |
2434 | 2430 |
2435 intToString(am_Players[0].field_40, Dest); | 2431 intToString(am_Players[0].resource_beasts, text_buff); |
2436 v12.x = 10; | 2432 text_position.x = 10; |
2437 v12.y = 258; | 2433 text_position.y = 258; |
2438 am_40B268(-1, Dest, &v12); | 2434 DrawBeastsCount(-1, text_buff, &text_position); |
2439 | 2435 |
2440 intToString(am_Players[1].field_40, Dest); | 2436 intToString(am_Players[1].resource_beasts, text_buff); |
2441 v12.x = 557; | 2437 text_position.x = 557; |
2442 v12.y = 258; | 2438 text_position.y = 258; |
2443 am_40B268(-1, Dest, &v12); | 2439 DrawBeastsCount(-1, text_buff, &text_position); |
2444 } | 2440 } |
2445 // 4E185E: using guessed type char byte_4E185E; | 2441 |
2446 // 4E1878: using guessed type int dword_4E1878; | |
2447 // 4E187C: using guessed type int dword_4E187C; | |
2448 // 4E1880: using guessed type int dword_4E1880; | |
2449 // 4FAA77: using guessed type char am_byte_4FAA77; | |
2450 | 2442 |
2451 //----- (0040B102) -------------------------------------------------------- | 2443 //----- (0040B102) -------------------------------------------------------- |
2452 void am_40B102( int a1, char *text, POINT *pXY ) | 2444 void DrawPlayerLevels( int a1, char *text, POINT *pXY ) |
2453 { | 2445 { |
2454 char *v3; // esi@1 | 2446 char *v3; // esi@1 |
2455 unsigned char test_char; // bl@2 | 2447 unsigned char test_char; // bl@2 |
2456 int v7; // eax@3 | 2448 int v7; // eax@3 |
2457 RECT pSrcRect; | 2449 RECT pSrcRect; |
2479 while ( test_char!= 0 ); | 2471 while ( test_char!= 0 ); |
2480 am_EndScene(); | 2472 am_EndScene(); |
2481 } | 2473 } |
2482 | 2474 |
2483 //----- (0040B17E) -------------------------------------------------------- | 2475 //----- (0040B17E) -------------------------------------------------------- |
2484 void am_40B17E( int a1, char* text, POINT *pXY ) | 2476 void DrawBricksCount( int a1, char* text, POINT *pXY ) |
2485 { | 2477 { |
2486 | 2478 |
2487 char *v3; // esi@1 | 2479 char *v3; // esi@1 |
2488 unsigned char test_char; // bl@2 | 2480 unsigned char test_char; // bl@2 |
2489 int v7; // eax@3 | 2481 int v7; // eax@3 |
2499 test_char = *v3; | 2491 test_char = *v3; |
2500 ++v3; | 2492 ++v3; |
2501 if ( test_char ) | 2493 if ( test_char ) |
2502 { | 2494 { |
2503 v7 = 13 * test_char; | 2495 v7 = 13 * test_char; |
2504 pSrcRect.right = v7 - 370; | 2496 pSrcRect.left = v7 - 370; |
2505 pSrcRect.left = v7 - 357; | 2497 pSrcRect.right = v7 - 357; |
2506 pSrcRect.top = 128; | 2498 pSrcRect.top = 128; |
2507 pSrcRect.bottom = 138; | 2499 pSrcRect.bottom = 138; |
2508 Blt_Copy(&pSrcRect, &pTargetPoint, 2); | 2500 Blt_Copy(&pSrcRect, &pTargetPoint, 2); |
2509 pTargetPoint.x += 13; | 2501 pTargetPoint.x += 13; |
2510 } | 2502 } |
2513 am_EndScene(); | 2505 am_EndScene(); |
2514 | 2506 |
2515 } | 2507 } |
2516 | 2508 |
2517 //----- (0040B1F3) -------------------------------------------------------- | 2509 //----- (0040B1F3) -------------------------------------------------------- |
2518 void am_40B1F3( int a1, char* text, POINT* pXY ) | 2510 void DrawGemsCount( int a1, char* text, POINT* pXY ) |
2519 { | 2511 { |
2520 | 2512 |
2521 char *v3; // esi@1 | 2513 char *v3; // esi@1 |
2522 unsigned char test_char; // bl@2 | 2514 unsigned char test_char; // bl@2 |
2523 int v7; // eax@3 | 2515 int v7; // eax@3 |
2533 test_char = *v3; | 2525 test_char = *v3; |
2534 ++v3; | 2526 ++v3; |
2535 if ( test_char ) | 2527 if ( test_char ) |
2536 { | 2528 { |
2537 v7 = 13 * test_char; | 2529 v7 = 13 * test_char; |
2538 pSrcRect.right = v7 - 370; | 2530 pSrcRect.left = v7 - 370; |
2539 pSrcRect.left = v7 - 357; | 2531 pSrcRect.right = v7 - 357; |
2540 pSrcRect.top = 138; | 2532 pSrcRect.top = 138; |
2541 pSrcRect.bottom = 148; | 2533 pSrcRect.bottom = 148; |
2542 Blt_Copy(&pSrcRect, &pTargetPoint, 2); | 2534 Blt_Copy(&pSrcRect, &pTargetPoint, 2); |
2543 pTargetPoint.x += 13; | 2535 pTargetPoint.x += 13; |
2544 } | 2536 } |
2547 am_EndScene(); | 2539 am_EndScene(); |
2548 | 2540 |
2549 } | 2541 } |
2550 | 2542 |
2551 //----- (0040B268) -------------------------------------------------------- | 2543 //----- (0040B268) -------------------------------------------------------- |
2552 void am_40B268( int a1, char *text, POINT *pXY ) | 2544 void DrawBeastsCount( int a1, char *text, POINT *pXY ) |
2553 { | 2545 { |
2554 | 2546 |
2555 char *v3; // esi@1 | 2547 char *v3; // esi@1 |
2556 unsigned char test_char; // bl@2 | 2548 unsigned char test_char; // bl@2 |
2557 int v7; // eax@3 | 2549 int v7; // eax@3 |
2567 test_char = *v3; | 2559 test_char = *v3; |
2568 ++v3; | 2560 ++v3; |
2569 if ( test_char ) | 2561 if ( test_char ) |
2570 { | 2562 { |
2571 v7 = 13 * test_char; | 2563 v7 = 13 * test_char; |
2572 pSrcRect.right = v7 - 370; | 2564 pSrcRect.left = v7 - 370; |
2573 pSrcRect.left = v7 - 357; | 2565 pSrcRect.right = v7 - 357; |
2574 pSrcRect.top = 148; | 2566 pSrcRect.top = 148; |
2575 pSrcRect.bottom = 158; | 2567 pSrcRect.bottom = 158; |
2576 Blt_Copy(&pSrcRect, &pTargetPoint, 2); | 2568 Blt_Copy(&pSrcRect, &pTargetPoint, 2); |
2577 pTargetPoint.x += 13; | 2569 pTargetPoint.x += 13; |
2578 } | 2570 } |
2581 am_EndScene(); | 2573 am_EndScene(); |
2582 | 2574 |
2583 } | 2575 } |
2584 | 2576 |
2585 //----- (0040B2DD) -------------------------------------------------------- | 2577 //----- (0040B2DD) -------------------------------------------------------- |
2586 void __cdecl am_chroma_and_copy_blts() | 2578 void DrawPlayersTowers() |
2587 { | 2579 { |
2588 | 2580 int tower_height; // eax@1 |
2589 int v0; // eax@1 | 2581 int tower_top; // esi@3 |
2590 int v1; // esi@3 | |
2591 int v2; // eax@3 | |
2592 int v3; // eax@3 | |
2593 int v4; // esi@5 | |
2594 int v5; // eax@5 | |
2595 RECT pSrcXYZW; // [sp+0h] [bp-18h]@3 | 2582 RECT pSrcXYZW; // [sp+0h] [bp-18h]@3 |
2596 POINT pTargetXY; // [sp+10h] [bp-8h]@3 | 2583 POINT pTargetXY; // [sp+10h] [bp-8h]@3 |
2597 | 2584 |
2598 v0= am_Players[0].field_24; | 2585 tower_height= am_Players[0].tower_height; |
2599 if ( am_Players[0].field_24 > dword_4E1884 ) | 2586 if ( am_Players[0].tower_height > max_tower_height ) |
2600 v0 = dword_4E1884; | 2587 tower_height = max_tower_height; |
2601 pSrcXYZW.top = 0; | 2588 pSrcXYZW.top = 0; |
2602 pSrcXYZW.left = 892; | 2589 pSrcXYZW.left = 892; |
2603 pSrcXYZW.right = 937; | 2590 pSrcXYZW.right = 937; |
2604 v1 = 200 * v0 / dword_4E1884; | 2591 tower_top = 200 * tower_height / max_tower_height; |
2605 pSrcXYZW.bottom = v1; | 2592 pSrcXYZW.bottom = tower_top; |
2606 pTargetXY.x = 102; | 2593 pTargetXY.x = 102; |
2607 pTargetXY.y = 297 - v1; | 2594 pTargetXY.y = 297 - tower_top; |
2608 Blt_Copy(&pSrcXYZW, &pTargetXY, 2); | 2595 Blt_Copy(&pSrcXYZW, &pTargetXY, 2); |
2609 | 2596 |
2610 pSrcXYZW.top = 0; | 2597 pSrcXYZW.top = 0; |
2611 pSrcXYZW.left = 384; | 2598 pSrcXYZW.left = 384; |
2612 pSrcXYZW.right = 452; | 2599 pSrcXYZW.right = 452; |
2613 pSrcXYZW.bottom = 94; | 2600 pSrcXYZW.bottom = 94; |
2614 pTargetXY.y = 203 - v1; | 2601 pTargetXY.y = 203 - tower_top; |
2615 pTargetXY.x = 91; | 2602 pTargetXY.x = 91; |
2616 Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2); | 2603 Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2); |
2617 | 2604 |
2618 v3 = am_Players[1].field_24; | 2605 |
2619 if (am_Players[1].field_24 > dword_4E1884 ) | 2606 tower_height = am_Players[1].tower_height; |
2620 v3 = dword_4E1884; | 2607 if (am_Players[1].tower_height > max_tower_height ) |
2621 pSrcXYZW.top = 0; | 2608 tower_height = max_tower_height; |
2622 pSrcXYZW.left = 892; | 2609 tower_top = 200 * tower_height / max_tower_height; |
2623 pSrcXYZW.right = 937; | 2610 pSrcXYZW.top = 0; |
2624 v4 = 200 * v3 / dword_4E1884; | 2611 pSrcXYZW.left = 892; |
2625 pSrcXYZW.bottom = v4; | 2612 pSrcXYZW.right = 937; |
2613 pSrcXYZW.bottom = tower_top; | |
2614 | |
2626 pTargetXY.x = 494; | 2615 pTargetXY.x = 494; |
2627 pTargetXY.y = 297 - v4; | 2616 pTargetXY.y = 297 - tower_top; |
2628 Blt_Copy(&pSrcXYZW, &pTargetXY, 2); | 2617 Blt_Copy(&pSrcXYZW, &pTargetXY, 2); |
2629 | 2618 //draw tower up cone |
2630 pSrcXYZW.left = 384; | 2619 pSrcXYZW.left = 384; |
2631 pSrcXYZW.right = 452; | 2620 pSrcXYZW.right = 452; |
2632 pSrcXYZW.top = 94; | 2621 pSrcXYZW.top = 94; |
2633 pSrcXYZW.bottom = 188; | 2622 pSrcXYZW.bottom = 188; |
2623 | |
2634 pTargetXY.x = 483; | 2624 pTargetXY.x = 483; |
2635 pTargetXY.y = 203 - v4; | 2625 pTargetXY.y = 203 - tower_top; |
2636 Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2); | 2626 Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2); |
2637 | 2627 |
2638 } | 2628 } |
2639 // 4E1884: using guessed type int dword_4E1884; | 2629 // 4E1884: using guessed type int dword_4E1884; |
2640 | 2630 |
2641 //----- (0040B400) -------------------------------------------------------- | 2631 //----- (0040B400) -------------------------------------------------------- |
2642 void __cdecl am_chroma_blt() | 2632 void DrawPlayersWall() |
2643 { | 2633 { |
2644 int v0; // eax@1 | 2634 int v0; // eax@1 |
2645 int v1; // eax@4 | 2635 int v1; // eax@4 |
2646 LONG v2; // ecx@4 | 2636 LONG v2; // ecx@4 |
2647 int v3; // eax@5 | 2637 int v3; // eax@5 |
2648 int v4; // eax@8 | 2638 int v4; // eax@8 |
2649 LONG v5; // esi@8 | 2639 LONG v5; // esi@8 |
2650 RECT pSrcXYZW; // [sp+4h] [bp-18h]@4 | 2640 RECT pSrcXYZW; // [sp+4h] [bp-18h]@4 |
2651 POINT pTargetXY; // [sp+14h] [bp-8h]@4 | 2641 POINT pTargetXY; // [sp+14h] [bp-8h]@4 |
2652 | 2642 |
2653 v0 = am_Players[0].field_28; | 2643 v0 = am_Players[0].wall_height; |
2654 if ( am_Players[0].field_28 <= 100 ) | 2644 if ( am_Players[0].wall_height <= 100 ) |
2655 { | 2645 { |
2656 if ( am_Players[0].field_28 <= 0 ) | 2646 if ( am_Players[0].wall_height <= 0 ) |
2657 goto LABEL_5; | 2647 goto LABEL_5; |
2658 } | 2648 } |
2659 else | 2649 else |
2660 { | 2650 { |
2661 v0 = 100; | 2651 v0 = 100; |
2668 pTargetXY.x = 177; | 2658 pTargetXY.x = 177; |
2669 pTargetXY.y = 297 - v1; | 2659 pTargetXY.y = 297 - v1; |
2670 Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2); | 2660 Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2); |
2671 | 2661 |
2672 LABEL_5: | 2662 LABEL_5: |
2673 v3 = am_Players[1].field_28; | 2663 v3 = am_Players[1].wall_height; |
2674 if ( am_Players[1].field_28 <= 100 ) | 2664 if ( am_Players[1].wall_height <= 100 ) |
2675 { | 2665 { |
2676 if ( am_Players[1].field_28 <= 0 ) | 2666 if ( am_Players[1].wall_height <= 0 ) |
2677 return; | 2667 return; |
2678 } | 2668 } |
2679 else | 2669 else |
2680 { | 2670 { |
2681 v3 = 100; | 2671 v3 = 100; |
3157 result = -1; | 3147 result = -1; |
3158 //v3 = 188 * a1; | 3148 //v3 = 188 * a1; |
3159 player_num = a1; | 3149 player_num = a1; |
3160 //v4 = LOBYTE(am_Players[a1].field_20) == 0; | 3150 //v4 = LOBYTE(am_Players[a1].field_20) == 0; |
3161 v28 = -1; | 3151 v28 = -1; |
3162 if ( am_Players[a1].field_20 ) | 3152 if ( am_Players[a1].IsHisTurn ) |
3163 { | 3153 { |
3164 if ( v26._40DD2F() ) | 3154 if ( v26._40DD2F() ) |
3165 { | 3155 { |
3166 v5 = GetPlayerHandCardCount(v1); | 3156 v5 = GetPlayerHandCardCount(v1); |
3167 hand_index = 0; | 3157 hand_index = 0; |
3225 ++hand_index; | 3215 ++hand_index; |
3226 if ( hand_index >= v25 ) | 3216 if ( hand_index >= v25 ) |
3227 return v28; | 3217 return v28; |
3228 } | 3218 } |
3229 v28 = hand_index; | 3219 v28 = hand_index; |
3230 v18 = am_40BF15(player_num, hand_index); | 3220 v18 = CanCardBePlayed(player_num, hand_index); |
3231 if ( v18 ) | 3221 if ( v18 ) |
3232 { | 3222 { |
3233 v20=0x00FFFFFF; | 3223 v20=0x00FFFFFF; |
3234 } | 3224 } |
3235 else | 3225 else |
3416 } | 3406 } |
3417 | 3407 |
3418 if ( pCards[am_Players[a1].cards_at_hand[i]].field_2B) | 3408 if ( pCards[am_Players[a1].cards_at_hand[i]].field_2B) |
3419 { | 3409 { |
3420 ArcomageGame::PlaySound(0x16u); | 3410 ArcomageGame::PlaySound(0x16u); |
3421 v7 = amuint_4FAA6C; | 3411 v7 = current_player_num; |
3422 v8 = GetPlayerHandCardCount(amuint_4FAA6C); | 3412 v8 = GetPlayerHandCardCount(current_player_num); |
3423 v9 = 188 * v7 + 8 * v3; | 3413 v9 = 188 * v7 + 8 * v3; |
3424 // v10 = 96 * v3 + *(int *)((char *)am_Players[0].arr_6C[0] + v9) + (640 - 96 * v8) / (v8 + 1); | 3414 // v10 = 96 * v3 + *(int *)((char *)am_Players[0].arr_6C[0] + v9) + (640 - 96 * v8) / (v8 + 1); |
3425 // v11 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v9) + 327; | 3415 // v11 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v9) + 327; |
3426 amuint_4FAA5C_blt_xy[0] = v10; | 3416 amuint_4FAA5C_blt_xy[0] = v10; |
3427 amuint_4FAA5C_blt_xy[1] = v11; | 3417 amuint_4FAA5C_blt_xy[1] = v11; |
3460 // 4FAA80: using guessed type int amuint_4FAA80[]; | 3450 // 4FAA80: using guessed type int amuint_4FAA80[]; |
3461 // 4FAA84: using guessed type int amuint_4FAA84[]; | 3451 // 4FAA84: using guessed type int amuint_4FAA84[]; |
3462 // 4FABB8: using guessed type int dword_4FABB8; | 3452 // 4FABB8: using guessed type int dword_4FABB8; |
3463 | 3453 |
3464 //----- (0040BE0E) -------------------------------------------------------- | 3454 //----- (0040BE0E) -------------------------------------------------------- |
3465 bool __fastcall am_40BE0E(int a1, signed int a2) | 3455 bool PlayCard( int player_num, signed int card_slot_num ) |
3466 { | 3456 { |
3467 bool result; // eax@0 | 3457 bool result; // eax@0 |
3468 int v3; // ebp@1 | 3458 int v3; // ebp@1 |
3469 int v4; // ecx@2 | 3459 int v4; // ecx@2 |
3470 ArcomagePlayer *v5; // esi@2 | 3460 ArcomagePlayer *v5; // esi@2 |
3471 int v6; // edi@2 | 3461 int v6; // edi@2 |
3478 int v13; // eax@8 | 3468 int v13; // eax@8 |
3479 ArcomageCard *v14; // eax@8 | 3469 ArcomageCard *v14; // eax@8 |
3480 int v15; // ecx@8 | 3470 int v15; // ecx@8 |
3481 int v16; // ecx@8 | 3471 int v16; // ecx@8 |
3482 | 3472 |
3483 v3 = a1; | 3473 v3 = player_num; |
3484 if ( a2 <= -1 ) | 3474 if ( card_slot_num <= -1 ) |
3485 goto LABEL_12; | 3475 return false; |
3486 v4 = 0; | 3476 v4 = 0; |
3487 v5 = &am_Players[v3]; | 3477 v5 = &am_Players[v3]; |
3488 v6 = 0; | 3478 v6 = 0; |
3489 v7 = (int)v5->cards_at_hand; | 3479 v7 = (int)v5->cards_at_hand; |
3490 do | 3480 do |
3491 { | 3481 { |
3492 if ( *(unsigned int *)v7 != -1 ) | 3482 if ( *(unsigned int *)v7 != -1 ) |
3493 { | 3483 { |
3494 if ( a2 == v4 ) | 3484 if ( card_slot_num == v4 ) |
3495 break; | 3485 break; |
3496 ++v4; | 3486 ++v4; |
3497 } | 3487 } |
3498 ++v6; | 3488 ++v6; |
3499 v7 += 4; | 3489 v7 += 4; |
3500 } | 3490 } |
3501 while ( v6 < 10 ); | 3491 while ( v6 < 10 ); |
3502 result = am_40BF15(v3, v6); | 3492 result = CanCardBePlayed(v3, v6); |
3503 if ( result ) | 3493 if ( result ) |
3504 { | 3494 { |
3505 ArcomageGame::PlaySound(0x17u); | 3495 ArcomageGame::PlaySound(0x17u); |
3506 v8 = amuint_4FAA6C; | 3496 v8 = current_player_num; |
3507 v9 = GetPlayerHandCardCount(amuint_4FAA6C); | 3497 v9 = GetPlayerHandCardCount(current_player_num); |
3508 v10 = 188 * v8 + 8 * v6; | 3498 v10 = 188 * v8 + 8 * v6; |
3509 v11 = v6 + 47 * v3; | 3499 v11 = v6 + 47 * v3; |
3510 amuint_4FAA54_blt_xy[1] = -30; | 3500 amuint_4FAA54_blt_xy[1] = -30; |
3511 pArcomageGame->field_F6 = 1; | 3501 pArcomageGame->field_F6 = 1; |
3512 //v12 = 96 * v6 + *(int *)((char *)am_Players[0].arr_6C[0] + v10) + (640 - 96 * v9) / (v9 + 1); | 3502 //v12 = 96 * v6 + *(int *)((char *)am_Players[0].arr_6C[0] + v10) + (640 - 96 * v9) / (v9 + 1); |
3513 // v13 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v10) + 327; | 3503 // v13 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v10) + 327; |
3514 amuint_4FAA5C_blt_xy[0] = v12; | 3504 amuint_4FAA5C_blt_xy[0] = v12; |
3515 amuint_4FAA5C_blt_xy[1] = v13; | 3505 amuint_4FAA5C_blt_xy[1] = v13; |
3516 amuint_4FAA54_blt_xy[0] = (272 - v12) / 5; | 3506 amuint_4FAA54_blt_xy[0] = (272 - v12) / 5; |
3517 v14 = &pCards[v5->cards_at_hand[v6]]; | 3507 v14 = &pCards[v5->cards_at_hand[v6]]; |
3518 v5->field_38 -= LOBYTE(v14->field_28); | 3508 v5->resource_bricks -= v14->needed_bricks; |
3519 v15 = BYTE1(v14->field_28); | 3509 v5->resource_beasts -= v14->needed_beasts; |
3520 v5->field_40 -= BYTE2(v14->field_28); | 3510 v5->resource_gems -= v14->needed_gems; |
3521 v5->field_3C -= v15; | |
3522 result = 4 * v11 + 5265228; | 3511 result = 4 * v11 + 5265228; |
3523 v16 = am_Players[0].cards_at_hand[v11]; | 3512 v16 = am_Players[0].cards_at_hand[v11]; |
3524 am_Players[0].cards_at_hand[v11] = -1; | 3513 am_Players[0].cards_at_hand[v11] = -1; |
3525 amuint_4FABC0 = v16; | 3514 amuint_4FABC0 = v16; |
3526 LOBYTE(result) = 1; | 3515 return true;; |
3527 } | 3516 } |
3528 else | 3517 else |
3529 { | 3518 return false; |
3530 LABEL_12: | 3519 |
3531 LOBYTE(result) = 0; | |
3532 } | |
3533 return result; | |
3534 } | 3520 } |
3535 | 3521 |
3536 //----- (0040BF15) -------------------------------------------------------- | 3522 //----- (0040BF15) -------------------------------------------------------- |
3537 bool am_40BF15( int player_num, int hand_card_indx ) | 3523 bool CanCardBePlayed( int player_num, int hand_card_indx ) |
3538 { | 3524 { |
3539 bool result; // eax@1 | 3525 bool result; // eax@1 |
3540 ArcomageCard *v4; // ecx@1 | 3526 ArcomageCard *test_card; // ecx@1 |
3541 ArcomagePlayer *v2; // esi@1 | 3527 ArcomagePlayer *pPlayer; // esi@1 |
3542 | 3528 |
3543 v2 = &am_Players[player_num]; | 3529 pPlayer = &am_Players[player_num]; |
3544 result = true; | 3530 result = true; |
3545 v4 = &pCards[am_Players[player_num].cards_at_hand[hand_card_indx]]; | 3531 test_card = &pCards[am_Players[player_num].cards_at_hand[hand_card_indx]]; |
3546 if ( v4->field_25 > v2->field_2C ) | 3532 if ( test_card->needed_quarry_level > pPlayer->quarry_level ) |
3547 result = false; | 3533 result = false; |
3548 if ( v4->field_26 > v2->field_30 ) | 3534 if ( test_card->needed_magic_level > pPlayer->magic_level ) |
3549 result = false; | 3535 result = false; |
3550 if ( v4->field_27 > v2->field_34 ) | 3536 if ( test_card->needed_might_level > pPlayer->might_level ) |
3551 result = false; | 3537 result = false; |
3552 if ( v4->field_28 > v2->field_38 ) | 3538 if ( test_card->needed_bricks > pPlayer->resource_bricks ) |
3553 result = false; | 3539 result = false; |
3554 if ( v4->field_29 > v2->field_3C ) | 3540 if ( test_card->needed_gems > pPlayer->resource_gems ) |
3555 result = false; | 3541 result = false; |
3556 if ( v4->field_2A > v2->field_40 ) | 3542 if ( test_card->needed_beasts > pPlayer->resource_beasts ) |
3557 result = false; | 3543 result = false; |
3558 return result; | 3544 return result; |
3559 } | 3545 } |
3560 | 3546 |
3561 | 3547 |
5598 ArcomagePlayer *v2; // ecx@1 | 5584 ArcomagePlayer *v2; // ecx@1 |
5599 int v3; // esi@1 | 5585 int v3; // esi@1 |
5600 int result; // eax@3 | 5586 int result; // eax@3 |
5601 | 5587 |
5602 v2 = &am_Players[a1]; | 5588 v2 = &am_Players[a1]; |
5603 v3 = v2->field_28; | 5589 v3 = v2->wall_height; |
5604 if ( v3 <= 0 ) | 5590 if ( v3 <= 0 ) |
5605 { | 5591 { |
5606 result = 0; | 5592 result = 0; |
5607 } | 5593 } |
5608 else | 5594 else |
5609 { | 5595 { |
5610 if ( v3 >= -a2 ) | 5596 if ( v3 >= -a2 ) |
5611 { | 5597 { |
5612 result = a2; | 5598 result = a2; |
5613 v2->field_28 = a2 + v3; | 5599 v2->wall_height = a2 + v3; |
5614 goto LABEL_7; | 5600 goto LABEL_7; |
5615 } | 5601 } |
5616 a2 += v3; | 5602 a2 += v3; |
5617 result = -v3; | 5603 result = -v3; |
5618 v2->field_28 = 0; | 5604 v2->wall_height = 0; |
5619 } | 5605 } |
5620 v2->field_24 += a2; | 5606 v2->tower_height += a2; |
5621 LABEL_7: | 5607 LABEL_7: |
5622 if ( v2->field_24 < 0 ) | 5608 if ( v2->tower_height < 0 ) |
5623 v2->field_24 = 0; | 5609 v2->tower_height = 0; |
5624 return result; | 5610 return result; |
5625 } | 5611 } |
5626 // 40D402: using guessed type int __fastcall am_40D402(uint, uint); | 5612 // 40D402: using guessed type int __fastcall am_40D402(uint, uint); |
5627 | 5613 |
5628 //----- (0040D444) -------------------------------------------------------- | 5614 //----- (0040D444) -------------------------------------------------------- |
5629 int __cdecl am_40D444() | 5615 int __cdecl GameResultsApply() |
5630 { | 5616 { |
5631 int v0; // esi@1 | 5617 int v0; // esi@1 |
5632 int v1; // edi@1 | 5618 int v1; // edi@1 |
5633 int v2; // eax@1 | 5619 int v2; // eax@1 |
5634 int v3; // eax@23 | 5620 int v3; // eax@23 |
5653 inv_strcpy("Победи", pText); | 5639 inv_strcpy("Победи", pText); |
5654 v2 = 0; | 5640 v2 = 0; |
5655 xy[1] = 160; | 5641 xy[1] = 160; |
5656 xy[0] = 320 - 12 * v2 / 2; | 5642 xy[0] = 320 - 12 * v2 / 2; |
5657 // pPrimaryWindow_draws_text(-1, pText, xy); | 5643 // pPrimaryWindow_draws_text(-1, pText, xy); |
5658 if ( am_Players[0].field_24 < dword_4E1884 ) | 5644 if ( am_Players[0].tower_height < max_tower_height ) |
5659 { | 5645 { |
5660 if ( am_Players[1].field_24 < dword_4E1884 ) | 5646 if ( am_Players[1].tower_height < max_tower_height ) |
5661 goto LABEL_10; | 5647 goto LABEL_10; |
5662 v0 = 2; | 5648 v0 = 2; |
5663 } | 5649 } |
5664 else | 5650 else |
5665 { | 5651 { |
5666 if ( am_Players[1].field_24 < dword_4E1884 ) | 5652 if ( am_Players[1].tower_height < max_tower_height ) |
5667 { | 5653 { |
5668 v0 = 1; | 5654 v0 = 1; |
5669 } | 5655 } |
5670 else | 5656 else |
5671 { | 5657 { |
5672 if ( am_Players[0].field_24 == am_Players[1].field_24 ) | 5658 if ( am_Players[0].tower_height == am_Players[1].tower_height ) |
5673 { | 5659 { |
5674 v0 = 0; | 5660 v0 = 0; |
5675 v1 = 4; | 5661 v1 = 4; |
5676 goto LABEL_10; | 5662 goto LABEL_10; |
5677 } | 5663 } |
5678 v0 = (am_Players[0].field_24 <= am_Players[1].field_24) + 1; | 5664 v0 = (am_Players[0].tower_height <= am_Players[1].tower_height) + 1; |
5679 } | 5665 } |
5680 } | 5666 } |
5681 v1 = 0; | 5667 v1 = 0; |
5682 LABEL_10: | 5668 LABEL_10: |
5683 if ( am_Players[0].field_24 <= 0 ) | 5669 if ( am_Players[0].tower_height <= 0 ) |
5684 { | 5670 { |
5685 if ( am_Players[1].field_24 > 0 ) | 5671 if ( am_Players[1].tower_height > 0 ) |
5686 { | 5672 { |
5687 v0 = 2; | 5673 v0 = 2; |
5688 } | 5674 } |
5689 else | 5675 else |
5690 { | 5676 { |
5691 if ( am_Players[0].field_24 == am_Players[1].field_24 ) | 5677 if ( am_Players[0].tower_height == am_Players[1].tower_height ) |
5692 { | 5678 { |
5693 LABEL_20: | 5679 LABEL_20: |
5694 if ( am_Players[0].field_28 == am_Players[1].field_28 ) | 5680 if ( am_Players[0].wall_height == am_Players[1].wall_height ) |
5695 { | 5681 { |
5696 v0 = 0; | 5682 v0 = 0; |
5697 v1 = 4; | 5683 v1 = 4; |
5698 } | 5684 } |
5699 else | 5685 else |
5700 { | 5686 { |
5701 v0 = (am_Players[0].field_28 <= am_Players[1].field_28) + 1; | 5687 v0 = (am_Players[0].wall_height <= am_Players[1].wall_height) + 1; |
5702 v1 = 1; | 5688 v1 = 1; |
5703 } | 5689 } |
5704 goto LABEL_23; | 5690 goto LABEL_23; |
5705 } | 5691 } |
5706 v0 = (am_Players[0].field_24 <= am_Players[1].field_24) + 1; | 5692 v0 = (am_Players[0].tower_height <= am_Players[1].tower_height) + 1; |
5707 } | 5693 } |
5708 goto LABEL_17; | 5694 goto LABEL_17; |
5709 } | 5695 } |
5710 if ( am_Players[1].field_24 <= 0 ) | 5696 if ( am_Players[1].tower_height <= 0 ) |
5711 { | 5697 { |
5712 v0 = 1; | 5698 v0 = 1; |
5713 LABEL_17: | 5699 LABEL_17: |
5714 v1 = 2; | 5700 v1 = 2; |
5715 } | 5701 } |
5716 if ( !v0 && v1 == 4 ) | 5702 if ( !v0 && v1 == 4 ) |
5717 goto LABEL_20; | 5703 goto LABEL_20; |
5718 LABEL_23: | 5704 LABEL_23: |
5719 v3 = am_Players[0].field_38; | 5705 v3 = am_Players[0].resource_bricks; |
5720 if ( am_Players[0].field_38 <= am_Players[0].field_3C ) | 5706 if ( am_Players[0].resource_bricks <= am_Players[0].resource_gems ) |
5721 { | 5707 { |
5722 v3 = am_Players[0].field_40; | 5708 v3 = am_Players[0].resource_beasts; |
5723 v4 = am_Players[0].field_3C; | 5709 v4 = am_Players[0].resource_gems; |
5724 if ( am_Players[0].field_3C > am_Players[0].field_40 ) | 5710 if ( am_Players[0].resource_gems > am_Players[0].resource_beasts ) |
5725 goto LABEL_28; | 5711 goto LABEL_28; |
5726 } | 5712 } |
5727 else | 5713 else |
5728 { | 5714 { |
5729 if ( am_Players[0].field_38 <= am_Players[0].field_40 ) | 5715 if ( am_Players[0].resource_bricks <= am_Players[0].resource_beasts ) |
5730 { | 5716 { |
5731 v4 = am_Players[0].field_40; | 5717 v4 = am_Players[0].resource_beasts; |
5732 goto LABEL_28; | 5718 goto LABEL_28; |
5733 } | 5719 } |
5734 } | 5720 } |
5735 v4 = v3; | 5721 v4 = v3; |
5736 LABEL_28: | 5722 LABEL_28: |
5737 v5 = am_Players[1].field_38; | 5723 v5 = am_Players[1].resource_bricks; |
5738 v6 = am_Players[1].field_3C; | 5724 v6 = am_Players[1].resource_gems; |
5739 if ( am_Players[1].field_38 <= am_Players[1].field_3C ) | 5725 if ( am_Players[1].resource_bricks <= am_Players[1].resource_gems ) |
5740 { | 5726 { |
5741 v5 = am_Players[1].field_40; | 5727 v5 = am_Players[1].resource_beasts; |
5742 if ( am_Players[1].field_3C > am_Players[1].field_40 ) | 5728 if ( am_Players[1].resource_gems > am_Players[1].resource_beasts ) |
5743 goto LABEL_33; | 5729 goto LABEL_33; |
5744 goto LABEL_32; | 5730 goto LABEL_32; |
5745 } | 5731 } |
5746 v6 = am_Players[1].field_40; | 5732 v6 = am_Players[1].resource_beasts; |
5747 if ( am_Players[1].field_38 > am_Players[1].field_40 ) | 5733 if ( am_Players[1].resource_bricks > am_Players[1].resource_beasts ) |
5748 LABEL_32: | 5734 LABEL_32: |
5749 v6 = v5; | 5735 v6 = v5; |
5750 LABEL_33: | 5736 LABEL_33: |
5751 if ( v0 == -1 ) | 5737 if ( v0 == -1 ) |
5752 { | 5738 { |
5753 if ( v1 != -1 ) | 5739 if ( v1 != -1 ) |
5754 goto LABEL_49; | 5740 goto LABEL_49; |
5755 if ( v4 < dword_4E1888 ) | 5741 if ( v4 < max_resources_amount ) |
5756 { | 5742 { |
5757 if ( v6 < dword_4E1888 ) | 5743 if ( v6 < max_resources_amount ) |
5758 goto LABEL_49; | 5744 goto LABEL_49; |
5759 v0 = 2; | 5745 v0 = 2; |
5760 } | 5746 } |
5761 else | 5747 else |
5762 { | 5748 { |
5763 if ( v6 < dword_4E1888 ) | 5749 if ( v6 < max_resources_amount ) |
5764 { | 5750 { |
5765 v0 = 1; | 5751 v0 = 1; |
5766 } | 5752 } |
5767 else | 5753 else |
5768 { | 5754 { |
5791 pArcomageGame->field_B0 = v1; | 5777 pArcomageGame->field_B0 = v1; |
5792 pArcomageGame->uGameResult = v0; | 5778 pArcomageGame->uGameResult = v0; |
5793 if ( v0 == 1 ) | 5779 if ( v0 == 1 ) |
5794 { | 5780 { |
5795 v7 = window_SpeakInHouse; | 5781 v7 = window_SpeakInHouse; |
5796 v8 = (signed int)window_SpeakInHouse->ptr_1C; | 5782 v8 = (signed int)window_SpeakInHouse->par1C; |
5797 if ( v8 >= 108 ) | 5783 if ( v8 >= 108 ) |
5798 { | 5784 { |
5799 if ( v8 <= 120 ) | 5785 if ( v8 <= 120 ) |
5800 { | 5786 { |
5801 v9 = (char *)&pParty->uNumGoldInBank + v8 + 1; | 5787 v9 = (char *)&pParty->uNumGoldInBank + v8 + 1; |
5802 if ( !*v9 ) | 5788 if ( !*v9 ) |
5803 { | 5789 { |
5804 *v9 = 1; | 5790 *v9 = 1; |
5805 | 5791 |
5806 //auto _a = (signed __int64)(p2DEvents_minus1__20[13 * (unsigned int)v7->ptr_1C] * 100.0); | 5792 //auto _a = (signed __int64)(p2DEvents_minus1__20[13 * (unsigned int)v7->ptr_1C] * 100.0); |
5807 auto _a = (signed int)(p2DEvents[(unsigned int)v7->ptr_1C - 1].fPriceMultiplier * 100.0); | 5793 auto _a = (signed int)(p2DEvents[(unsigned int)v7->par1C - 1].fPriceMultiplier * 100.0); |
5808 party_finds_gold(_a, 0); | 5794 party_finds_gold(_a, 0); |
5809 } | 5795 } |
5810 } | 5796 } |
5811 } | 5797 } |
5812 v10 = 108; | 5798 v10 = 108; |
5849 } | 5835 } |
5850 | 5836 |
5851 | 5837 |
5852 | 5838 |
5853 //----- (00409C8B) -------------------------------------------------------- | 5839 //----- (00409C8B) -------------------------------------------------------- |
5854 void __cdecl PrepareArcomage() | 5840 void PrepareArcomage() |
5855 { | 5841 { |
5856 signed __int64 v1; // qax@4 | 5842 signed __int64 v1; // qax@4 |
5857 int v2; // esi@4 | 5843 int v2; // esi@4 |
5858 int v3; // esi@5 | 5844 int v3; // esi@5 |
5859 signed int v4; // edi@5 | 5845 signed int v4; // edi@5 |
5860 int v6; // edx@9 | 5846 int v6; // edx@9 |
5909 pArcomageGame->field_F4 = 0; | 5895 pArcomageGame->field_F4 = 0; |
5910 byte_4FAA2C = 0; | 5896 byte_4FAA2C = 0; |
5911 byte_505880 = 0; | 5897 byte_505880 = 0; |
5912 dword_4FAA70 = 0; | 5898 dword_4FAA70 = 0; |
5913 am_byte_4FAA77 = 0; | 5899 am_byte_4FAA77 = 0; |
5914 am_409FE9(); | 5900 SetStartGameData(); |
5915 am_40A255(); | 5901 am_40A255(); |
5916 //nullsub_1(); | 5902 //nullsub_1(); |
5917 pArcomageGame->field_F5 = 0; | 5903 pArcomageGame->GameOver = 0; |
5918 pArcomageGame->pfntComic = pFontComic; | 5904 pArcomageGame->pfntComic = pFontComic; |
5919 pArcomageGame->pfntArrus = pFontArrus; | 5905 pArcomageGame->pfntArrus = pFontArrus; |
5920 } | 5906 } |
5921 | 5907 |
5922 | 5908 |
5934 | 5920 |
5935 | 5921 |
5936 | 5922 |
5937 | 5923 |
5938 //----- (00409BE8) -------------------------------------------------------- | 5924 //----- (00409BE8) -------------------------------------------------------- |
5939 void sub_409BE8() | 5925 void SetStartConditions() |
5940 { | 5926 { |
5941 stru348 *v1; // eax@1 | 5927 ArcomageStartConditions *v1; // eax@1 |
5942 | 5928 |
5943 v1 = &stru_4E1890[window_SpeakInHouse->par1C - 108]; | 5929 v1 = &start_conditions[window_SpeakInHouse->par1C - 108]; |
5944 amuint_4E1860 = v1->field_4; | 5930 start_tower_height = v1->tower_height; |
5945 amuint_4E1864 = v1->field_6; | 5931 start_wall_height = v1->wall_height; |
5946 amuint_4E1868 = v1->field_8 - 1; | 5932 start_quarry_level = v1->quarry_level - 1; |
5947 amuint_4E186C = v1->field_A - 1; | 5933 start_magic_level = v1->magic_level - 1; |
5948 amuint_4E1870 = v1->field_C - 1; | 5934 start_might_level = v1->might_level - 1; |
5949 dword_4E1874 = 5; | 5935 dword_4E1874 = 5; |
5950 dword_4E1878 = 1; | 5936 quarry_bonus = 1; |
5951 dword_4E187C = 1; | 5937 magic_bonus = 1; |
5952 dword_4E1880 = 1; | 5938 might_bonus = 1; |
5953 dword_4E1884 = v1->field_0; | 5939 max_tower_height = v1->max_tower; |
5954 dword_4E1888 = v1->field_2; | 5940 max_resources_amount = v1->max_resources; |
5955 | 5941 |
5956 dword_4DF3A4 = v1->field_14; | 5942 dword_4DF3A4 = v1->field_14; |
5957 | 5943 |
5958 amuint_505884 = v1->field_E; | 5944 start_bricks_amount = v1->bricks_amount; |
5959 amuint_505888 = v1->field_10; | 5945 start_gems_amount = v1->gems_amount; |
5960 amuint_50588C = v1->field_12; | 5946 start_beasts_amount = v1->beasts_amount; |
5961 | 5947 |
5962 } | 5948 } |
5963 | 5949 |
5964 | 5950 |
5965 //----- (0040D75D) -------------------------------------------------------- | 5951 //----- (0040D75D) -------------------------------------------------------- |