comparison Arcomage.cpp @ 1185:24454b5c9268

more on acromage
author Gloval
date Fri, 07 Jun 2013 01:32:17 +0400
parents a90dc4aee8f4
children 569216b4f54d
comparison
equal deleted inserted replaced
1184:a90dc4aee8f4 1185:24454b5c9268
24 24
25 25
26 void sub_409BE8(); 26 void sub_409BE8();
27 27
28 28
29 char __cdecl am_409FE9(); 29 void am_409FE9();
30 char __cdecl am_40A198(); 30 char __cdecl am_40A198();
31 void am_40A255(); 31 void am_40A255();
32 void am_40A283(int a1); 32 void am_40A283(int a1);
33 signed int __fastcall am_40A324(int a1); 33 int GetEmptyCardSlotIndex(int player_num);
34 void am_40A346(int player_num); 34 void am_40A346(int player_num);
35 void __cdecl am_40A383(); 35 void __cdecl am_40A383();
36 bool am_40A514(); 36 bool am_40A514();
37 char __thiscall am_40A560(unsigned int _this); 37 char __thiscall am_40A560(unsigned int _this);
38 void __thiscall am_blts(int a1); // idb 38 void am_blts(int a1); // idb
39 void __cdecl am_40AA4E(); 39 void am_40AA4E();
40 void __cdecl am_chroma_blts(); 40 void __cdecl am_chroma_blts();
41 void __cdecl am_DrawUI(); 41 void __cdecl am_DrawUI();
42 void __fastcall am_40B102(int a1, char *a2, POINT *pXY); // idb 42 void __fastcall am_40B102(int a1, char *a2, POINT *pXY); // idb
43 void am_40B17E(int a1, char* a2, POINT *pXY); // idb 43 void am_40B17E(int a1, char* a2, POINT *pXY); // idb
44 void am_40B1F3(int a1, char* a2, POINT* a3); 44 void am_40B1F3(int a1, char* a2, POINT* a3);
45 void am_40B268(int a1, char *a2, POINT *pXY); // idb 45 void am_40B268(int a1, char *a2, POINT *pXY); // idb
46 void __cdecl am_chroma_and_copy_blts(); 46 void __cdecl am_chroma_and_copy_blts();
47 void __cdecl am_chroma_blt(); 47 void __cdecl am_chroma_blt();
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 __fastcall am_40BB49(int a1); 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 __fastcall am_40BE0E(int a1, signed int a2);
54 bool __fastcall am_40BF15(int a1, int a2); 54 bool am_40BF15(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 __fastcall am_40D2B4(POINT*, int); // 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 am_40D444();
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);
64 void __cdecl am_EndScene(); 64 void __cdecl am_EndScene();
65 void __fastcall DrawRect(RECT *pXYZW, unsigned __int16 uColor, char bSolidFill); // idb 65 void __fastcall DrawRect(RECT *pXYZW, unsigned __int16 uColor, char bSolidFill); // idb
66 void SetPixel(POINT *pTargetXY, unsigned __int16 uColor);
66 int __fastcall rand_interval(int a, int b); // idb 67 int __fastcall rand_interval(int a, int b); // idb
67 char *__fastcall inv_strcat(const char *Source, char *Dest); 68 char *__fastcall inv_strcat(const char *Source, char *Dest);
68 char *__fastcall inv_strcpy(const char *Source, char *Dest); 69 char *__fastcall inv_strcpy(const char *Source, char *Dest);
69 void __fastcall intToString(int val, char *pOut); 70 void __fastcall intToString(int val, char *pOut);
70 71
111 112
112 Acromage_st1 struct_st1[10]; 113 Acromage_st1 struct_st1[10];
113 114
114 stru272 array_4FABD0[10]; 115 stru272 array_4FABD0[10];
115 116
116 117 int dword_505554[108];
118 char byte_5054E8[108];
117 119
118 /* 267 */ 120 /* 267 */
119 #pragma pack(push, 1) 121 #pragma pack(push, 1)
120 struct stru273 122 struct stru273
121 { 123 {
122 bool _40DD2F(); 124 bool _40DD2F();
123 bool Inside(Vec4_int_ *pXYZW); 125 bool Inside(RECT*pXYZW);
124 126
125 int x; 127 int x;
126 int y; 128 int y;
127 char field_8; 129 char field_8;
128 char field_9; 130 char field_9;
129 char field_A; 131 char field_A;
130 char field_B; 132 char field_B;
131 }; 133 };
132 #pragma pack(pop) 134 #pragma pack(pop)
133 135
134 136 char am_byte_4E185D; // weak
135 137
136 int dword_4E1884 = 50; // weak 138 int amuint_4E1860; // weak
137 int dword_4E1888 = 100 ; // weak 139 int amuint_4E1864; // weak
140 int amuint_4E1868; // weak
141 int amuint_4E186C; // weak
142 int amuint_4E1870; // weak
143
138 144
139 int dword_4E1874 = 5; // weak 145 int dword_4E1874 = 5; // weak
140
141 int dword_4E1878 = 1; // weak 146 int dword_4E1878 = 1; // weak
142 int dword_4E187C = 1; // weak 147 int dword_4E187C = 1; // weak
143 int dword_4E1880 = 1; // weak 148 int dword_4E1880 = 1; // weak
149 int dword_4E1884 = 50; // weak
150 int dword_4E1888 = 100 ; // weak
151
152 int dword_4DF3A4; // weak
153
154 char byte_4FAA2C; // weak
155 int amuint_4FAA6C; // idb
156 char am_byte_4FAA77; // weak
157
158
159 unsigned int amuint_4FABC0; // idb
144 160
145 161
146 162
147 //----- (0040DD2F) -------------------------------------------------------- 163 //----- (0040DD2F) --------------------------------------------------------
148 bool stru273::_40DD2F() 164 bool stru273::_40DD2F()
150 166
151 this->x = pArcomageGame->mouse_x; 167 this->x = pArcomageGame->mouse_x;
152 this->y = pArcomageGame->mouse_y; 168 this->y = pArcomageGame->mouse_y;
153 this->field_8 = pArcomageGame->mouse_left; 169 this->field_8 = pArcomageGame->mouse_left;
154 this->field_9 = pArcomageGame->mouse_left == pArcomageGame->field_F7; 170 this->field_9 = pArcomageGame->mouse_left == pArcomageGame->field_F7;
155 this->field_8 = pArcomageGame->mouse_left; 171 this->field_A = pArcomageGame->mouse_right;
156 this->field_B = pArcomageGame->mouse_right == pArcomageGame->field_F8; 172 this->field_B = pArcomageGame->mouse_right == pArcomageGame->field_F8;
157 pArcomageGame->field_F7 = pArcomageGame->mouse_left; 173 pArcomageGame->field_F7 = pArcomageGame->mouse_left;
158 pArcomageGame->field_F8 = pArcomageGame->mouse_right; 174 pArcomageGame->field_F8 = pArcomageGame->mouse_right;
159 return true; 175 return true;
160 } 176 }
161 177
162 //----- (0040DD93) -------------------------------------------------------- 178 //----- (0040DD93) --------------------------------------------------------
163 bool stru273::Inside(Vec4_int_ *pXYZW) 179 bool stru273::Inside(RECT*pXYZW )
164 { 180 {
165 int v2; // eax@3 181
166 182 return (x >= pXYZW->left) && (x <= pXYZW->right) &&
167 auto a1 = this; 183 (y>= pXYZW->top) && (y <= pXYZW->bottom);
168 return a1->x >= pXYZW->x && a1->x <= pXYZW->z && (v2 = a1->y, v2 >= pXYZW->y) && v2 <= pXYZW->w;
169 } 184 }
170 185
171 //----- (0040DFD1) -------------------------------------------------------- 186 //----- (0040DFD1) --------------------------------------------------------
172 void stru272_stru0::_40DFD1(stru272_stru0 *a1) 187 void stru272_stru0::_40DFD1(stru272_stru0 *a1)
173 { 188 {
197 } 212 }
198 213
199 //----- (0040E01A) -------------------------------------------------------- 214 //----- (0040E01A) --------------------------------------------------------
200 int stru272_stru0::_40E01A(int a2) 215 int stru272_stru0::_40E01A(int a2)
201 { 216 {
202 signed int result; // eax@2
203
204 auto a1 = this; 217 auto a1 = this;
205 if ( a1->signature == SIG_trpg ) 218 if ( a1->signature == SIG_trpg )
206 { 219 {
207 a1->field_4 = *(int *)(a2 + 32); 220 a1->field_4 = *(int *)(a2 + 32);
208 a1->field_C = *(int *)a2 << 16; 221 a1->field_C = *(int *)a2 << 16;
218 a1->field_38 = (signed __int64)(*(float *)(a2 + 44) * 65536.0); 231 a1->field_38 = (signed __int64)(*(float *)(a2 + 44) * 65536.0);
219 a1->field_3C = *(int *)(a2 + 48); 232 a1->field_3C = *(int *)(a2 + 48);
220 a1->field_40 = *(int *)(a2 + 52); 233 a1->field_40 = *(int *)(a2 + 52);
221 // a1->field_54 = *(int *)(a2 + 56); 234 // a1->field_54 = *(int *)(a2 + 56);
222 a1->field_59 = 1; 235 a1->field_59 = 1;
223 result = 0; 236 return 0;
224 } 237 }
225 else 238 else
226 { 239 return 2;
227 result = 2;
228 }
229 return result;
230 } 240 }
231 241
232 //----- (0040E0F5) -------------------------------------------------------- 242 //----- (0040E0F5) --------------------------------------------------------
233 int stru272_stru0::_40E0F5(char a2, char a3) 243 int stru272_stru0::_40E0F5(char a2, char a3)
234 { 244 {
235 signed int result; // eax@2 245 if ( signature == SIG_trpg)
236 int v4; // edx@7
237 int v5; // eax@7
238
239 auto a1 = this;
240 if ( a1->signature == SIG_trpg)
241 { 246 {
242 if ( a2 ) 247 if ( a2 )
243 { 248 {
244 a1->field_8 = 0; 249 field_8 = 0;
245 a1->field_30 = 0.0; 250 field_30 = 0.0;
246 } 251 }
247 if ( a1->field_59 && a3 ) 252 if ( field_59 && a3 )
248 { 253 {
249 v4 = a1->field_4; 254
250 // v5 = a1->field_54; 255 for (int i=0; i<field_4; ++i)
251 do 256 field_54[i].field_0 = 0;
252 { 257 field_58 = 0;
253 *(int *)v5 = 0;
254 v5 += 28;
255 --v4;
256 }
257 while ( v4 );
258 a1->field_58 = 0;
259 } 258 }
260 result = 0; 259 return 0;
261 } 260 }
262 else 261 else
263 { 262 return 2;
264 result = 2;
265 }
266 return result;
267 } 263 }
268 264
269 //----- (0040E133) -------------------------------------------------------- 265 //----- (0040E133) --------------------------------------------------------
270 int stru272_stru0::_40E133() 266 int stru272_stru0::_40E133()
271 { 267 {
349 } 345 }
350 346
351 //----- (0040E2A7) -------------------------------------------------------- 347 //----- (0040E2A7) --------------------------------------------------------
352 int stru272_stru0::_40E2A7() 348 int stru272_stru0::_40E2A7()
353 { 349 {
354 int result; // eax@2 350
355 351 if (signature == SIG_trpg )
356 if ( this->signature == SIG_trpg )
357 { 352 {
358 if ( this->field_8 <= 0 ) 353 if ( field_8 <= 0 )
359 result = this->field_58 != 0 ? 2 : 0; 354 return field_58 != 0 ? 2 : 0;
360 else 355 else
361 result = 1; 356 return 1;
362 } 357 }
363 else 358 else
364 { 359 return 3;
365 result = 3;
366 }
367 return result;
368 } 360 }
369 361
370 362
371 //----- (0040DFAF) -------------------------------------------------------- 363 //----- (0040DFAF) --------------------------------------------------------
372 void ArcomageGame::OnMouseClick(char right_left, bool bDown) 364 void ArcomageGame::OnMouseClick(char right_left, bool bDown)
888 // return result != 0; 880 // return result != 0;
889 // v64 = a1; 881 // v64 = a1;
890 // v145 = &stru_505708[a1]; 882 // v145 = &stru_505708[a1];
891 // v130 = a1; 883 // v130 = a1;
892 // v143 = &stru_505708[(a1 + 1) % 2]; 884 // v143 = &stru_505708[(a1 + 1) % 2];
893 // v136 = am_40BB49(a1); 885 // v136 = GetPlayerHandCardCount(a1);
894 // v65 = 0; 886 // v65 = 0;
895 // do 887 // do
896 // { 888 // {
897 // if ( v65 >= v136 ) 889 // if ( v65 >= v136 )
898 // { 890 // {
1191 // } 1183 // }
1192 // v9 = a1; 1184 // v9 = a1;
1193 // v144 = &stru_505708[a1]; 1185 // v144 = &stru_505708[a1];
1194 // v129 = a1; 1186 // v129 = a1;
1195 // v142 = &stru_505708[(a1 + 1) % 2]; 1187 // v142 = &stru_505708[(a1 + 1) % 2];
1196 // v135 = am_40BB49(a1); 1188 // v135 = GetPlayerHandCardCount(a1);
1197 // v10 = 0; 1189 // v10 = 0;
1198 // do 1190 // do
1199 // { 1191 // {
1200 // if ( v10 >= v135 ) 1192 // if ( v10 >= v135 )
1201 // { 1193 // {
1484 // v3 = 0; 1476 // v3 = 0;
1485 // v4 = a1; 1477 // v4 = a1;
1486 // if ( am_byte_4FAA77 ) 1478 // if ( am_byte_4FAA77 )
1487 // { 1479 // {
1488 //LABEL_11: 1480 //LABEL_11:
1489 // v7 = am_40BB49(v4); 1481 // v7 = GetPlayerHandCardCount(v4);
1490 // v8 = rand_interval(0, v7 - 1); 1482 // v8 = rand_interval(0, v7 - 1);
1491 // result = am_40BCFB(v4, v8); 1483 // result = am_40BCFB(v4, v8);
1492 // } 1484 // }
1493 // else 1485 // else
1494 // { 1486 // {
1495 // while ( 1 ) 1487 // while ( 1 )
1496 // { 1488 // {
1497 // v5 = am_40BB49(v4); 1489 // v5 = GetPlayerHandCardCount(v4);
1498 // v6 = rand_interval(0, v5 - 1); 1490 // v6 = rand_interval(0, v5 - 1);
1499 // if ( am_40BF15(v4, v6) ) 1491 // if ( am_40BF15(v4, v6) )
1500 // break; 1492 // break;
1501 // ++v3; 1493 // ++v3;
1502 // if ( v3 >= 10 ) 1494 // if ( v3 >= 10 )
1530 pArcomageGame->field_F6 = 1; 1522 pArcomageGame->field_F6 = 1;
1531 byte_4FAA24 = 1; 1523 byte_4FAA24 = 1;
1532 am_40A346(amuint_4FAA6C); 1524 am_40A346(amuint_4FAA6C);
1533 Sleep(10000); 1525 Sleep(10000);
1534 LABEL_8: 1526 LABEL_8:
1535 /* while ( byte_4FAA24 ) 1527 while ( byte_4FAA24 )
1536 { 1528 {
1537 amuint_4FABC0 = -1; 1529 amuint_4FABC0 = -1;
1538 am_40A283(amuint_4FAA6C); 1530 am_40A283(amuint_4FAA6C);
1539 while ( 1 ) 1531 while ( 1 )
1540 { 1532 {
1541 byte_4FAA24 = am_40A560(amuint_4FAA6C); 1533 byte_4FAA24 = am_40A560(amuint_4FAA6C);
1542 if ( am_40BB49(amuint_4FAA6C) <= dword_4E1874 ) 1534 if ( GetPlayerHandCardCount(amuint_4FAA6C) <= dword_4E1874 )
1543 break; 1535 break;
1544 am_byte_4FAA77 = 1; 1536 am_byte_4FAA77 = 1;
1545 if ( pArcomageGame->field_F4 ) 1537 if ( pArcomageGame->field_F4 )
1546 goto LABEL_8; 1538 goto LABEL_8;
1547 } 1539 }
1548 am_byte_4FAA77 = 0; 1540 am_byte_4FAA77 = 0;
1549 }*/ 1541 }
1550 pArcomageGame->field_F5 = am_40A514(); 1542 pArcomageGame->field_F5 = am_40A514();
1551 if ( !pArcomageGame->field_F5 ) 1543 if ( !pArcomageGame->field_F5 )
1552 am_40A383(); 1544 am_40A383();
1553 if ( pArcomageGame->field_F4 ) 1545 if ( pArcomageGame->field_F4 )
1554 pArcomageGame->field_F5 = 1; 1546 pArcomageGame->field_F5 = 1;
1586 1578
1587 1579
1588 1580
1589 1581
1590 //----- (00409FE9) -------------------------------------------------------- 1582 //----- (00409FE9) --------------------------------------------------------
1591 char __cdecl am_409FE9() 1583 void am_409FE9()
1592 { 1584 {
1593 signed int v0; // edi@1 1585 signed int v0; // edi@1
1594 signed int v1; // esi@4 1586 signed int v1; // esi@4
1595 int *v2; // ecx@7 1587 int *v2; // ecx@7
1596 int *v3; // eax@7 1588 int *v3; // eax@7
1597 signed int v4; // edx@7 1589 signed int v4; // edx@7
1599 signed int v6; // ecx@13 1591 signed int v6; // ecx@13
1600 signed int v7; // eax@13 1592 signed int v7; // eax@13
1601 1593
1602 amuint_4FAA6C = dword_505890; 1594 amuint_4FAA6C = dword_505890;
1603 sub_409BE8(); 1595 sub_409BE8();
1604 v0 = 0; 1596 for(v0=0; v0<2; ++v0 )
1605 do
1606 { 1597 {
1607 if ( v0 ) 1598 if ( v0 )
1608 { 1599 {
1609 v1 = v0; 1600 inv_strcpy(pArcomageGame->pPlayer2Name, am_Players[1].pPlayerName);
1610 inv_strcpy(pArcomageGame->pPlayer2Name, am_Players[v0].pPlayerName);
1611 if ( byte_4E185C ) 1601 if ( byte_4E185C )
1612 LOBYTE(am_Players[v1].field_20) = 0; 1602 am_Players[1].field_20 = 0;
1613 else 1603 else
1614 LOBYTE(am_Players[v1].field_20) = 1; 1604 am_Players[1].field_20 = 1;
1615 } 1605 }
1616 else 1606 else
1617 { 1607 {
1618 inv_strcpy(pArcomageGame->pPlayer1Name, (char *)am_Players); 1608 inv_strcpy(pArcomageGame->pPlayer1Name, am_Players[0].pPlayerName);
1619 LOBYTE(am_Players[0].field_20) = 1; 1609 am_Players[0].field_20 = 1;
1620 } 1610 }
1621 am_Players[v0].field_24 = amuint_4E1860; 1611 am_Players[v0].field_24 = amuint_4E1860;
1622 am_Players[v0].field_28 = amuint_4E1864; 1612 am_Players[v0].field_28 = amuint_4E1864;
1623 am_Players[v0].field_2C = amuint_4E1868; 1613 am_Players[v0].field_2C = amuint_4E1868;
1624 am_Players[v0].field_30 = amuint_4E186C; 1614 am_Players[v0].field_30 = amuint_4E186C;
1625 am_Players[v0].field_34 = amuint_4E1870; 1615 am_Players[v0].field_34 = amuint_4E1870;
1626 am_Players[v0].field_38 = amuint_505884; 1616 am_Players[v0].field_38 = amuint_505884;
1627 am_Players[v0].field_3C = amuint_505888; 1617 am_Players[v0].field_3C = amuint_505888;
1628 am_Players[v0].field_40 = amuint_50588C; 1618 am_Players[v0].field_40 = amuint_50588C;
1629 v2 = &am_Players[v0].arr_6C[0][1]; 1619
1630 v3 = am_Players[v0].cards_at_hand; 1620 for (v4=0; v4<10; ++v4 )
1631 v4 = 10; 1621 {
1632 do 1622 am_Players[v0].cards_at_hand[v4] = -1;
1633 {
1634 *v3 = -1;
1635 if ( am_byte_4E185D ) 1623 if ( am_byte_4E185D )
1636 { 1624 {
1637 *(v2 - 1) = -1; 1625 am_Players[v0].arr_6C[v4].field_0 = -1;
1638 *v2 = -1; 1626 am_Players[v0].arr_6C[v4].field_4 = -1;
1639 } 1627 }
1640 else 1628 else
1641 { 1629 {
1642 *(v2 - 1) = 0; 1630 am_Players[v0].arr_6C[v4].field_0 = 0;
1643 *v2 = 0; 1631 am_Players[v0].arr_6C[v4].field_4 = 0;
1644 } 1632 }
1645 ++v3;
1646 v2 += 2;
1647 --v4;
1648 } 1633 }
1649 while ( v4 ); 1634
1650 ++v0;
1651 } 1635 }
1652 while ( v0 < 2 ); 1636
1637
1653 inv_strcpy(pDeckMaster, byte_5054C8); 1638 inv_strcpy(pDeckMaster, byte_5054C8);
1654 v5 = 0; 1639 for (v6=0, v7=-2, v5=0; v6<108; ++v6, ++v7)
1655 v6 = (signed int)dword_505554; 1640 {
1656 v7 = -2; 1641 byte_5054E8[v6] = 0;
1657 do 1642 dword_505554[v6] =v5;
1658 { 1643 switch ( v7 )
1659 byte_5054E8[v7 + 2] = 0; 1644 {
1660 *(unsigned int *)v6 = v5;
1661 switch ( v7 )
1662 {
1663 default:
1664 ++v5;
1665 break;
1666 case 0: 1645 case 0:
1667 case 2: 1646 case 2:
1668 case 6: 1647 case 6:
1669 case 9: 1648 case 9:
1670 case 13: 1649 case 13:
1682 case 75: 1661 case 75:
1683 case 79: 1662 case 79:
1684 case 81: 1663 case 81:
1685 case 84: 1664 case 84:
1686 case 89: 1665 case 89:
1687 break; 1666 break;
1688 } 1667 default:
1689 v6 += 4; 1668 ++v5;
1690 ++v7; 1669 }
1691 } 1670 }
1692 while ( v6 < (signed int)&unk_505704 ); 1671
1693 return am_40A198(); 1672 am_40A198();
1694 } 1673 }
1695 // 4E185C: using guessed type char byte_4E185C; 1674 // 4E185C: using guessed type char byte_4E185C;
1696 // 4E185D: using guessed type char am_byte_4E185D; 1675 // 4E185D: using guessed type char am_byte_4E185D;
1697 // 4E1860: using guessed type int amuint_4E1860; 1676 // 4E1860: using guessed type int amuint_4E1860;
1698 // 4E1864: using guessed type int amuint_4E1864; 1677 // 4E1864: using guessed type int amuint_4E1864;
1776 // 40A198: using guessed type char var_6C[108]; 1755 // 40A198: using guessed type char var_6C[108];
1777 1756
1778 //----- (0040A255) -------------------------------------------------------- 1757 //----- (0040A255) --------------------------------------------------------
1779 void am_40A255() 1758 void am_40A255()
1780 { 1759 {
1781
1782 for (int i = 0; i < dword_4E1874; ++i ) 1760 for (int i = 0; i < dword_4E1874; ++i )
1783 { 1761 {
1784 am_40A283(0); 1762 am_40A283(0);
1785 am_40A283(1); 1763 am_40A283(1);
1786 } 1764 }
1818 ++v2; 1796 ++v2;
1819 dword_4FABC8 = v2; 1797 dword_4FABC8 = v2;
1820 } 1798 }
1821 while ( !v5 ); 1799 while ( !v5 );
1822 ArcomageGame::PlaySound(0x15u); 1800 ArcomageGame::PlaySound(0x15u);
1823 result = am_40A324(v4); 1801 result = GetEmptyCardSlotIndex(v4);
1824 if ( result != -1 ) 1802 if ( result != -1 )
1825 { 1803 {
1826 amuint_4FAA4C = result; 1804 amuint_4FAA4C = result;
1827 am_Players[0].cards_at_hand[result + 47 * v4] = v3; 1805 am_Players[0].cards_at_hand[result + 47 * v4] = v3;
1828 v7 = 188 * v4 + 8 * result; 1806 v7 = 188 * v4 + 8 * result;
1829 *(int *)((char *)am_Players[0].arr_6C[0] + v7) = rand_interval(-4, 4); 1807 // *(int *)((char *)am_Players[0].arr_6C[0] + v7) = rand_interval(-4, 4);
1830 result = rand_interval(-4, 4); 1808 result = rand_interval(-4, 4);
1831 *(int *)((char *)&am_Players[0].arr_6C[0][1] + v7) = result; 1809 // *(int *)((char *)&am_Players[0].arr_6C[0][1] + v7) = result;
1832 pArcomageGame->field_F6 = 1; 1810 pArcomageGame->field_F6 = 1;
1833 byte_4FAA2D = 1; 1811 byte_4FAA2D = 1;
1834 } 1812 }
1835 1813
1836 } 1814 }
1838 // 4FAA4C: using guessed type int amuint_4FAA4C; 1816 // 4FAA4C: using guessed type int amuint_4FAA4C;
1839 // 4FABC8: using guessed type int dword_4FABC8; 1817 // 4FABC8: using guessed type int dword_4FABC8;
1840 // 505314: using guessed type int dword_505314[]; 1818 // 505314: using guessed type int dword_505314[];
1841 1819
1842 //----- (0040A324) -------------------------------------------------------- 1820 //----- (0040A324) --------------------------------------------------------
1843 signed int __fastcall am_40A324(int a1) 1821 int GetEmptyCardSlotIndex( int player_num )
1844 { 1822 {
1845 signed int result; // eax@1 1823 int i;
1846 signed int v2; // edx@1 1824 for (i=0; i<10; ++i )
1847 char *v3; // ecx@1 1825 {
1848 1826 if (am_Players[player_num].cards_at_hand[i]==-1)
1849 result = -1; 1827 break;
1850 v2 = 0; 1828 }
1851 v3 = (char *)am_Players[a1].cards_at_hand; 1829 if ( i >= 10 )
1852 while ( *(unsigned int *)v3 != -1 ) 1830 return -1;
1853 { 1831 else
1854 ++v2; 1832 return i;
1855 v3 += 4;
1856 if ( v2 >= 10 )
1857 return result;
1858 }
1859 return v2;
1860 } 1833 }
1861 1834
1862 //----- (0040A346) -------------------------------------------------------- 1835 //----- (0040A346) --------------------------------------------------------
1863 void am_40A346( int player_num ) 1836 void am_40A346( int player_num )
1864 { 1837 {
1865 int v1; // ecx@1 1838 am_Players[player_num].field_38 += dword_4E1878 + am_Players[player_num].field_2C;
1866 1839 am_Players[player_num].field_3C += dword_4E187C + am_Players[player_num].field_30;
1867 v1 = player_num; 1840 am_Players[player_num].field_40 += dword_4E1880 + am_Players[player_num].field_34;
1868 am_Players[v1].field_38 += dword_4E1878 + am_Players[v1].field_2C;
1869 am_Players[v1].field_3C += dword_4E187C + am_Players[v1].field_30;
1870 am_Players[v1].field_40 += dword_4E1880 + am_Players[v1].field_34;
1871 } 1841 }
1872 1842
1873 1843
1874 //----- (0040A383) -------------------------------------------------------- 1844 //----- (0040A383) --------------------------------------------------------
1875 void __cdecl am_40A383() 1845 void __cdecl am_40A383()
2042 case 2: 2012 case 2:
2043 if ( a2.field_4 == 129 && a2.field_8 == 1 ) 2013 if ( a2.field_4 == 129 && a2.field_8 == 1 )
2044 { 2014 {
2045 pAudioPlayer->StopChannels(-1, -1); 2015 pAudioPlayer->StopChannels(-1, -1);
2046 dword_4FAA68 = 0; 2016 dword_4FAA68 = 0;
2047 goto LABEL_16; 2017 v16 = 1;
2018 pArcomageGame->field_F4 = 1;
2048 } 2019 }
2049 break; 2020 break;
2050 case 9: 2021 case 9:
2051 pArcomageGame->field_F6 = 1; 2022 pArcomageGame->field_F6 = 1;
2052 break; 2023 break;
2053 case 0xA: 2024 case 0xA:
2054 pAudioPlayer->StopChannels(-1, -1); 2025 pAudioPlayer->StopChannels(-1, -1);
2055 byte_4FAA74 = 1; 2026 byte_4FAA74 = 1;
2056 LABEL_16:
2057 v16 = 1; 2027 v16 = 1;
2058 pArcomageGame->field_F4 = 1; 2028 pArcomageGame->field_F4 = 1;
2059 break; 2029 break;
2060 } 2030 }
2061 v4 = amuint_4FAA6C; 2031 v4 = amuint_4FAA6C;
2110 if ( am_byte_4FAA75 ) 2080 if ( am_byte_4FAA75 )
2111 am_byte_4FAA76 = 1; 2081 am_byte_4FAA76 = 1;
2112 if ( dword_4FAA64 > 0 ) 2082 if ( dword_4FAA64 > 0 )
2113 { 2083 {
2114 --dword_4FAA64; 2084 --dword_4FAA64;
2115 am_byte_4FAA77 = am_40BB49(a1) > dword_4E1874; 2085 am_byte_4FAA77 = GetPlayerHandCardCount(a1) > dword_4E1874;
2116 } 2086 }
2117 byte_4FAA2E = 1; 2087 byte_4FAA2E = 1;
2118 } 2088 }
2119 if ( a2.field_0 == 8 && am_40BCFB(a1, dword_4FABBC) ) 2089 if ( a2.field_0 == 8 && am_40BCFB(a1, dword_4FABBC) )
2120 { 2090 {
2121 if ( am_byte_4FAA75 ) 2091 if ( am_byte_4FAA75 )
2122 am_byte_4FAA76 = 1; 2092 am_byte_4FAA76 = 1;
2123 if ( dword_4FAA64 > 0 ) 2093 if ( dword_4FAA64 > 0 )
2124 { 2094 {
2125 --dword_4FAA64; 2095 --dword_4FAA64;
2126 am_byte_4FAA77 = am_40BB49(a1) > dword_4E1874; 2096 am_byte_4FAA77 = GetPlayerHandCardCount(a1) > dword_4E1874;
2127 } 2097 }
2128 byte_4FAA2E = 1; 2098 byte_4FAA2E = 1;
2129 } 2099 }
2130 } 2100 }
2131 else 2101 else
2229 // 4FAA76: using guessed type char am_byte_4FAA76; 2199 // 4FAA76: using guessed type char am_byte_4FAA76;
2230 // 4FAA77: using guessed type char am_byte_4FAA77; 2200 // 4FAA77: using guessed type char am_byte_4FAA77;
2231 // 4FABB8: using guessed type int dword_4FABB8; 2201 // 4FABB8: using guessed type int dword_4FABB8;
2232 2202
2233 //----- (0040A9AF) -------------------------------------------------------- 2203 //----- (0040A9AF) --------------------------------------------------------
2234 void __thiscall am_blts(int a1) 2204 void am_blts( int a1 )
2235 { 2205 {
2236 int v1; // esi@1 2206
2237 stru272_stru0 **v2; // esi@1
2238
2239 v1 = a1;
2240 am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1); 2207 am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1);
2241 am_chroma_blts(); 2208 am_chroma_blts();
2242 am_EndScene(); 2209 am_EndScene();
2243 am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1); 2210 am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1);
2244 am_40B4B9(); 2211 am_40B4B9();
2245 am_chroma_and_copy_blts(); 2212 am_chroma_and_copy_blts();
2246 am_chroma_blt(); 2213 am_chroma_blt();
2247 am_DrawUI(); 2214 am_DrawUI();
2248 am_EndScene(); 2215 am_EndScene();
2249 am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1); 2216 am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1);
2250 am_40B76F(v1); 2217 am_40B76F(a1);
2251 v2 = (stru272_stru0 **)array_4FABD0; 2218
2252 do 2219 for( int i=0; i<10; ++i)
2253 { 2220 {
2254 if ( *((unsigned char *)v2 - 64) ) 2221 if (array_4FABD0[i].field_0)
2255 (*v2)->_40E133(); 2222 array_4FABD0[i].field_40->_40E133();
2256 v2 += 1067; 2223 }
2257 }
2258 while ( (signed int)v2 < (signed int)&unk_5052C8 );
2259 dword_4FABBC = am_40BB67(amuint_4FAA6C); 2224 dword_4FABBC = am_40BB67(amuint_4FAA6C);
2260 am_40AA4E(); 2225 am_40AA4E();
2261 am_EndScene(); 2226 am_EndScene();
2262 } 2227 }
2263 2228
2264 //----- (0040AA4E) -------------------------------------------------------- 2229 //----- (0040AA4E) --------------------------------------------------------
2265 void __cdecl am_40AA4E() 2230 void am_40AA4E()
2266 { 2231 {
2267 signed int v0; // ebx@1
2268 char v1; // ch@2@3
2269 char *v2; // esi@4
2270 signed int v3; // edi@6
2271 int *v4; // esi@6
2272 int v5; // [sp-4h] [bp-2Ch]@4 2232 int v5; // [sp-4h] [bp-2Ch]@4
2273 int v6; // [sp+Ch] [bp-1Ch]@10 2233 unsigned int v7;
2274 int v7; // [sp+10h] [bp-18h]@10
2275 int v8; // [sp+14h] [bp-14h]@10 2234 int v8; // [sp+14h] [bp-14h]@10
2276 int v9; // [sp+18h] [bp-10h]@10 2235 int v9; // [sp+18h] [bp-10h]@10
2277 int v10; // [sp+1Ch] [bp-Ch]@6 2236 RECT pXYZW;
2278 char v11; // [sp+20h] [bp-8h]@1 2237
2279 char v12; // [sp+21h] [bp-7h]@1 2238 v9 = 0x0000FF00;
2280 char v13; // [sp+22h] [bp-6h]@1 2239 v8 = 0x000000FF;
2281 char v14; // [sp+24h] [bp-4h]@1 2240
2282 char v15; // [sp+25h] [bp-3h]@1 2241 for (int i=0; i<10; ++i)
2283 char v16; // [sp+26h] [bp-2h]@1
2284
2285 v14 = 0;
2286 v15 = -1;
2287 v16 = 0;
2288 v11 = -1;
2289 v12 = 0;
2290 v13 = 0;
2291 v0 = (signed int)byte_4FABD1;
2292 do
2293 {
2294 if ( *(unsigned char *)(v0 - 1) && (*(stru272_stru0 **)(v0 + 63))->_40E2A7() == 2 )
2295 {
2296 BYTE3(v5) = v1;
2297 v2 = &v14;
2298 if ( !*(unsigned char *)v0 )
2299 v2 = &v11;
2300 LOWORD(v5) = *(_WORD *)v2;
2301 BYTE2(v5) = v2[2];
2302 v10 = (unsigned __int16)R8G8B8_to_TargetFormat(v5);
2303 v3 = 0;
2304 v4 = (int *)(v0 + 71);
2305 do
2306 { 2242 {
2307 if ( *(v4 - 1) > 0 ) 2243 if(array_4FABD0[i].field_0 && (array_4FABD0[i].field_40->_40E2A7()==2))
2308 { 2244 {
2309 if ( v3 % 2 ) 2245
2310 { 2246 v5 = v9;
2311 Render::SetPixel((Vec2_int_ *)v4, v10); 2247 if ( !array_4FABD0[i].field_1 )
2312 } 2248 v5 = v8;
2313 else 2249
2314 { 2250 v7 = R8G8B8_to_TargetFormat(v5);
2315 v6 = *v4; 2251 for(int j=0; j<150; ++j )
2316 v8 = v6 + 2; 2252 {
2317 v7 = v4[1]; 2253 if (array_4FABD0[i].field_44[j].field_0 > 0)
2318 v9 = v7 + 2; 2254 {
2319 // DrawRect(&v6, v10, 1); 2255 if (j%2)
2320 } 2256 SetPixel(&array_4FABD0[i].field_44[j].field_4, v7);
2321 } 2257 else
2322 ++v3; 2258 {
2323 v4 += 7; 2259 pXYZW.left = array_4FABD0[i].field_44[j].field_4.x;
2260 pXYZW.right = pXYZW.left + 2;
2261 pXYZW.top = array_4FABD0[i].field_44[j].field_4.y;
2262 pXYZW.bottom = pXYZW.top + 2;
2263 DrawRect(&pXYZW, v7, 1);
2264 }
2265 }
2266 }
2267 }
2324 } 2268 }
2325 while ( v3 < 150 ); 2269
2326 }
2327 v0 += 4268;
2328 }
2329 while ( v0 < 1);//(signed int)&array_4FABD0[9].field_4[4201] );
2330 } 2270 }
2331 2271
2332 //----- (0040AB0A) -------------------------------------------------------- 2272 //----- (0040AB0A) --------------------------------------------------------
2333 void __cdecl am_chroma_blts() 2273 void __cdecl am_chroma_blts()
2334 { 2274 {
2839 // int v21; // [sp-4h] [bp-2Ch]@8 2779 // int v21; // [sp-4h] [bp-2Ch]@8
2840 // int pSrcXYZW[4]; // [sp+Ch] [bp-1Ch]@8 2780 // int pSrcXYZW[4]; // [sp+Ch] [bp-1Ch]@8
2841 // int pTargetXY[2]; // [sp+1Ch] [bp-Ch]@1 2781 // int pTargetXY[2]; // [sp+1Ch] [bp-Ch]@1
2842 // int v24; // [sp+24h] [bp-4h]@1 2782 // int v24; // [sp+24h] [bp-4h]@1
2843 // 2783 //
2844 // v0 = am_40BB49(amuint_4FAA6C); 2784 // v0 = GetPlayerHandCardCount(amuint_4FAA6C);
2845 // v1 = 0; 2785 // v1 = 0;
2846 // v2 = 0; 2786 // v2 = 0;
2847 // pTargetXY[1] = 327; 2787 // pTargetXY[1] = 327;
2848 // v24 = (640 - 96 * v0) / (v0 + 1); 2788 // v24 = (640 - 96 * v0) / (v0 + 1);
2849 // pTargetXY[0] = (640 - 96 * v0) / (v0 + 1); 2789 // pTargetXY[0] = (640 - 96 * v0) / (v0 + 1);
3023 // { 2963 // {
3024 // if ( amuint_4FAA38 >= 9 ) 2964 // if ( amuint_4FAA38 >= 9 )
3025 // { 2965 // {
3026 // am_uint_4FAA44_blt_xy[1] = 18; 2966 // am_uint_4FAA44_blt_xy[1] = 18;
3027 // am_uint_4FAA44_blt_xy[0] = 120; 2967 // am_uint_4FAA44_blt_xy[0] = 120;
3028 // v1 = am_40BB49(amuint_4FAA6C); 2968 // v1 = GetPlayerHandCardCount(amuint_4FAA6C);
3029 // v2 = (640 - 96 * v1) / v1 + 96; 2969 // v2 = (640 - 96 * v1) / v1 + 96;
3030 // if ( am_byte_4E185D ) 2970 // if ( am_byte_4E185D )
3031 // { 2971 // {
3032 // v3 = 188 * amuint_4FAA6C + 8 * amuint_4FAA4C; 2972 // v3 = 188 * amuint_4FAA6C + 8 * amuint_4FAA4C;
3033 // amuint_4FAA3C_blt_xy[0] = (amuint_4FAA4C * v2 + *(int *)((char *)stru_505708[0].arr_6C[0] + v3) - 120) / 10; 2973 // amuint_4FAA3C_blt_xy[0] = (amuint_4FAA4C * v2 + *(int *)((char *)stru_505708[0].arr_6C[0] + v3) - 120) / 10;
3218 pCardRect->bottom = v4 + 128; 3158 pCardRect->bottom = v4 + 128;
3219 pCardRect->right = 96 * v3 + 96; 3159 pCardRect->right = 96 * v3 + 96;
3220 } 3160 }
3221 3161
3222 //----- (0040BB49) -------------------------------------------------------- 3162 //----- (0040BB49) --------------------------------------------------------
3223 int __fastcall am_40BB49(int a1) 3163 int GetPlayerHandCardCount( int player_num )
3224 { 3164 {
3225 int result; // eax@1 3165 int card_count; // eax@1
3226 char *v2; // ecx@1 3166
3227 signed int v3; // edx@1 3167 card_count = 0;
3228 3168 for(int i=0; i<10; ++i)
3229 result = 0; 3169 {
3230 v2 = (char *)am_Players[a1].cards_at_hand; 3170 if (am_Players[player_num].cards_at_hand[i]!=-1)
3231 v3 = 10; 3171 ++card_count;
3232 do 3172 }
3233 { 3173 return card_count;
3234 if ( *(unsigned int *)v2 != -1 ) 3174
3235 ++result;
3236 v2 += 4;
3237 --v3;
3238 }
3239 while ( v3 );
3240 return result;
3241 } 3175 }
3242 3176
3243 //----- (0040BB67) -------------------------------------------------------- 3177 //----- (0040BB67) --------------------------------------------------------
3244 signed int __fastcall am_40BB67(int a1) 3178 signed int __fastcall am_40BB67(int a1)
3245 { 3179 {
3286 v28 = -1; 3220 v28 = -1;
3287 if ( !v4 ) 3221 if ( !v4 )
3288 { 3222 {
3289 if ( v26._40DD2F() ) 3223 if ( v26._40DD2F() )
3290 { 3224 {
3291 v5 = am_40BB49(v1); 3225 v5 = GetPlayerHandCardCount(v1);
3292 a2 = 0; 3226 a2 = 0;
3293 v25 = v5; 3227 v25 = v5;
3294 pXYZW[1] = 327; 3228 pXYZW[1] = 327;
3295 pXYZW[3] = 455; 3229 pXYZW[3] = 455;
3296 pXYZW[0] = (640 - 96 * v5) / (v5 + 1); 3230 pXYZW[0] = (640 - 96 * v5) / (v5 + 1);
3314 v30 = v7; 3248 v30 = v7;
3315 } 3249 }
3316 if ( am_byte_4E185D ) 3250 if ( am_byte_4E185D )
3317 { 3251 {
3318 v9 = v3 + 8 * v7; 3252 v9 = v3 + 8 * v7;
3319 v10 = *(int *)((char *)am_Players[0].arr_6C[0] + v9); 3253 // v10 = *(int *)((char *)am_Players[0].arr_6C[0] + v9);
3320 v11 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v9); 3254 // v11 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v9);
3321 pXYZW[0] += v10; 3255 pXYZW[0] += v10;
3322 pXYZW[2] += v10; 3256 pXYZW[2] += v10;
3323 pXYZW[1] += v11; 3257 pXYZW[1] += v11;
3324 pXYZW[3] += v11; 3258 pXYZW[3] += v11;
3325 } 3259 }
3326 if ( v26.Inside((Vec4_int_ *)pXYZW) ) 3260 if ( true)//v26.Inside(pXYZW) )
3327 break; 3261 break;
3328 v31 = 0; 3262 v31 = 0;
3329 v32 = 0; 3263 v32 = 0;
3330 v33 = 0; 3264 v33 = 0;
3331 BYTE3(v13) = v12; 3265 BYTE3(v13) = v12;
3336 pXYZW[0] += var18; 3270 pXYZW[0] += var18;
3337 pXYZW[2] += var18; 3271 pXYZW[2] += var18;
3338 if ( am_byte_4E185D ) 3272 if ( am_byte_4E185D )
3339 { 3273 {
3340 v15 = v3 + 8 * v30; 3274 v15 = v3 + 8 * v30;
3341 v16 = *(int *)((char *)am_Players[0].arr_6C[0] + v15); 3275 // v16 = *(int *)((char *)am_Players[0].arr_6C[0] + v15);
3342 v17 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v15); 3276 // v17 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v15);
3343 pXYZW[0] -= v16; 3277 pXYZW[0] -= v16;
3344 pXYZW[2] -= v16; 3278 pXYZW[2] -= v16;
3345 pXYZW[1] -= v17; 3279 pXYZW[1] -= v17;
3346 pXYZW[3] -= v17; 3280 pXYZW[3] -= v17;
3347 } 3281 }
3416 v6 = 4 * v5 + 5265228; 3350 v6 = 4 * v5 + 5265228;
3417 if ( BYTE3(pCards[am_Players[0].cards_at_hand[v5]].field_28) ) 3351 if ( BYTE3(pCards[am_Players[0].cards_at_hand[v5]].field_28) )
3418 { 3352 {
3419 ArcomageGame::PlaySound(0x16u); 3353 ArcomageGame::PlaySound(0x16u);
3420 v7 = amuint_4FAA6C; 3354 v7 = amuint_4FAA6C;
3421 v8 = am_40BB49(amuint_4FAA6C); 3355 v8 = GetPlayerHandCardCount(amuint_4FAA6C);
3422 v9 = 188 * v7 + 8 * v3; 3356 v9 = 188 * v7 + 8 * v3;
3423 v10 = 96 * v3 + *(int *)((char *)am_Players[0].arr_6C[0] + v9) + (640 - 96 * v8) / (v8 + 1); 3357 // v10 = 96 * v3 + *(int *)((char *)am_Players[0].arr_6C[0] + v9) + (640 - 96 * v8) / (v8 + 1);
3424 v11 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v9) + 327; 3358 // v11 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v9) + 327;
3425 amuint_4FAA5C_blt_xy[0] = v10; 3359 amuint_4FAA5C_blt_xy[0] = v10;
3426 amuint_4FAA5C_blt_xy[1] = v11; 3360 amuint_4FAA5C_blt_xy[1] = v11;
3427 v12 = 0; 3361 v12 = 0;
3428 if ( !am_byte_4FAA75 ) 3362 if ( !am_byte_4FAA75 )
3429 { 3363 {
3501 result = am_40BF15(v3, v6); 3435 result = am_40BF15(v3, v6);
3502 if ( result ) 3436 if ( result )
3503 { 3437 {
3504 ArcomageGame::PlaySound(0x17u); 3438 ArcomageGame::PlaySound(0x17u);
3505 v8 = amuint_4FAA6C; 3439 v8 = amuint_4FAA6C;
3506 v9 = am_40BB49(amuint_4FAA6C); 3440 v9 = GetPlayerHandCardCount(amuint_4FAA6C);
3507 v10 = 188 * v8 + 8 * v6; 3441 v10 = 188 * v8 + 8 * v6;
3508 v11 = v6 + 47 * v3; 3442 v11 = v6 + 47 * v3;
3509 amuint_4FAA54_blt_xy[1] = -30; 3443 amuint_4FAA54_blt_xy[1] = -30;
3510 pArcomageGame->field_F6 = 1; 3444 pArcomageGame->field_F6 = 1;
3511 v12 = 96 * v6 + *(int *)((char *)am_Players[0].arr_6C[0] + v10) + (640 - 96 * v9) / (v9 + 1); 3445 //v12 = 96 * v6 + *(int *)((char *)am_Players[0].arr_6C[0] + v10) + (640 - 96 * v9) / (v9 + 1);
3512 v13 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v10) + 327; 3446 // v13 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v10) + 327;
3513 amuint_4FAA5C_blt_xy[0] = v12; 3447 amuint_4FAA5C_blt_xy[0] = v12;
3514 amuint_4FAA5C_blt_xy[1] = v13; 3448 amuint_4FAA5C_blt_xy[1] = v13;
3515 amuint_4FAA54_blt_xy[0] = (272 - v12) / 5; 3449 amuint_4FAA54_blt_xy[0] = (272 - v12) / 5;
3516 v14 = &pCards[v5->cards_at_hand[v6]]; 3450 v14 = &pCards[v5->cards_at_hand[v6]];
3517 v5->field_38 -= LOBYTE(v14->field_28); 3451 v5->field_38 -= LOBYTE(v14->field_28);
3531 } 3465 }
3532 return result; 3466 return result;
3533 } 3467 }
3534 3468
3535 //----- (0040BF15) -------------------------------------------------------- 3469 //----- (0040BF15) --------------------------------------------------------
3536 bool __fastcall am_40BF15(int a1, int a2) 3470 bool am_40BF15( int player_num, int hand_card_indx )
3537 { 3471 {
3538 ArcomagePlayer *v2; // esi@1
3539 bool result; // eax@1 3472 bool result; // eax@1
3540 ArcomageCard *v4; // ecx@1 3473 ArcomageCard *v4; // ecx@1
3541 3474 ArcomagePlayer *v2; // esi@1
3542 v2 = &am_Players[a1]; 3475
3543 LOBYTE(result) = 1; 3476 v2 = &am_Players[player_num];
3544 v4 = &pCards[v2->cards_at_hand[a2]]; 3477 result = true;
3545 if ( SBYTE1(v4->field_24) > v2->field_2C ) 3478 v4 = &pCards[am_Players[player_num].cards_at_hand[hand_card_indx]];
3546 LOBYTE(result) = 0; 3479 if ( v4->field_25 > v2->field_2C )
3547 if ( SBYTE2(v4->field_24) > v2->field_30 ) 3480 result = false;
3548 LOBYTE(result) = 0; 3481 if ( v4->field_26 > v2->field_30 )
3549 if ( SBYTE3(v4->field_24) > v2->field_34 ) 3482 result = false;
3550 LOBYTE(result) = 0; 3483 if ( v4->field_27 > v2->field_34 )
3551 if ( SLOBYTE(v4->field_28) > v2->field_38 ) 3484 result = false;
3552 LOBYTE(result) = 0; 3485 if ( v4->field_28 > v2->field_38 )
3553 if ( SBYTE1(v4->field_28) > v2->field_3C ) 3486 result = false;
3554 LOBYTE(result) = 0; 3487 if ( v4->field_29 > v2->field_3C )
3555 if ( SBYTE2(v4->field_28) > v2->field_40 ) 3488 result = false;
3556 LOBYTE(result) = 0; 3489 if ( v4->field_2A > v2->field_40 )
3490 result = false;
3557 return result; 3491 return result;
3558 } 3492 }
3559 3493
3560 3494
3561 3495
3910 // ++v25; 3844 // ++v25;
3911 // } 3845 // }
3912 // while ( v25 < SBYTE1(pCard->field_30) ); 3846 // while ( v25 < SBYTE1(pCard->field_30) );
3913 // } 3847 // }
3914 // v26 = pCard; 3848 // v26 = pCard;
3915 // am_byte_4FAA77 = am_40BB49(v193) > dword_4E1874; 3849 // am_byte_4FAA77 = GetPlayerHandCardCount(v193) > dword_4E1874;
3916 // LOBYTE(v27) = BYTE2(pCard->field_30); 3850 // LOBYTE(v27) = BYTE2(pCard->field_30);
3917 // if ( (_BYTE)v27 ) 3851 // if ( (_BYTE)v27 )
3918 // { 3852 // {
3919 // if ( (_BYTE)v27 == 99 ) 3853 // if ( (_BYTE)v27 == 99 )
3920 // { 3854 // {
4560 // ++v106; 4494 // ++v106;
4561 // } 4495 // }
4562 // while ( v106 < pCard->field_48[6] ); 4496 // while ( v106 < pCard->field_48[6] );
4563 // } 4497 // }
4564 // v107 = pCard; 4498 // v107 = pCard;
4565 // am_byte_4FAA77 = am_40BB49(v193) > dword_4E1874; 4499 // am_byte_4FAA77 = GetPlayerHandCardCount(v193) > dword_4E1874;
4566 // LOBYTE(v108) = pCard->field_48[7]; 4500 // LOBYTE(v108) = pCard->field_48[7];
4567 // if ( (_BYTE)v108 ) 4501 // if ( (_BYTE)v108 )
4568 // { 4502 // {
4569 // if ( (_BYTE)v108 == 99 ) 4503 // if ( (_BYTE)v108 == 99 )
4570 // { 4504 // {
5516 5450
5517 5451
5518 5452
5519 5453
5520 //----- (0040D2B4) -------------------------------------------------------- 5454 //----- (0040D2B4) --------------------------------------------------------
5521 int __fastcall am_40D2B4(Vec2_int_ *a1, int a2) 5455 int am_40D2B4( POINT* a1, int a2 )
5522 { 5456 {
5523 int v2; // ebp@1 5457 int v2; // ebp@1
5524 Vec2_int_ *v3; // edi@1 5458 POINT *v3; // edi@1
5525 char *v4; // ebx@1 5459 char *v4; // ebx@1
5526 int result; // eax@3 5460 int result; // eax@3
5527 unsigned int v6; // esi@7 5461 unsigned int v6; // esi@7
5528 stru272_stru0 *v7; // ecx@10 5462 stru272_stru0 *v7; // ecx@10
5529 stru272_stru0 *v8; // ecx@12 5463 stru272_stru0 *v8; // ecx@12
5533 stru272_stru0 **v12; // [sp+14h] [bp-4h]@1 5467 stru272_stru0 **v12; // [sp+14h] [bp-4h]@1
5534 5468
5535 v11 = 0; 5469 v11 = 0;
5536 v2 = a2; 5470 v2 = a2;
5537 v3 = a1; 5471 v3 = a1;
5538 v4 = byte_4FABD0; 5472 while ( array_4FABD0[v11].field_0 )
5539 v12 = (stru272_stru0 **)array_4FABD0; 5473 {
5540 while ( *v4 ) 5474 result = array_4FABD0[v11].field_40->_40E2A7();
5541 { 5475 if ( !result )
5542 result = (*v12)->_40E2A7(); 5476 {
5543 if ( !result ) 5477 array_4FABD0[v11].field_0 = 0;
5544 { 5478 --v11;
5545 *v4 = 0; 5479 }
5546 --v11; 5480 ++v11;
5547 v12 -= 1067; 5481 if ( v11 >= 10 )
5548 v4 -= 4268; 5482 return result;
5549 } 5483 }
5550 ++v11; 5484 v6 = v11;
5551 v12 += 1067; 5485 array_4FABD0[v11].field_0 = 1;
5552 v4 += 4268;
5553 if ( v11 >= 10 )
5554 return result;
5555 }
5556 v6 = 4268 * v11;
5557 byte_4FABD0[4268 * v11] = 1;
5558 if ( v2 <= 0 ) 5486 if ( v2 <= 0 )
5559 { 5487 {
5560 byte_4FABD1[v6] = 0; 5488 array_4FABD0[v6].field_1 = 0;
5561 v2 = -v2; 5489 v2 = -v2;
5562 } 5490 }
5563 else 5491 else
5564 { 5492 {
5565 byte_4FABD1[v6] = 1; 5493 array_4FABD0[v6].field_1 = 1;
5566 } 5494 }
5567 *(unsigned int *)((char *)&unk_4FABD4 + v6) = v3->x - 20; 5495 array_4FABD0[v6].field_4 = v3->x - 20;
5568 dword_4FABDC[v6 / 4] = v3->x + 20; 5496 array_4FABD0[v6].field_C = v3->x + 20;
5569 dword_4FABD8[v6 / 4] = v3->y - 20; 5497 array_4FABD0[v6].field_8 = v3->y - 20;
5570 dword_4FABE0[v6 / 4] = v3->y + 20; 5498 array_4FABD0[v6].field_10 = v3->y + 20;
5571 // v7 = array_4FABD0[v6 / 0x10AC] 5499 array_4FABD0[v6].field_14 = -60;
5572 dword_4FABE4[v6 / 4] = -60; 5500 array_4FABD0[v6].field_18 = 60;
5573 dword_4FABE8[v6 / 4] = 60; 5501 array_4FABD0[v6].field_1C = 180;
5574 dword_4FABEC[v6 / 4] = 180; 5502 array_4FABD0[v6].field_20f = 0.5;
5575 dword_4FABF0[v6 / 4] = 0x3F000000u; 5503 array_4FABD0[v6].field_24 = 150;
5576 dword_4FABF4[v6 / 4] = 150; 5504 array_4FABD0[v6].field_28f = 50.0;
5577 dword_4FABF8[v6 / 4] = 0x42480000u; 5505 array_4FABD0[v6].field_2Cf = 3.0;
5578 dword_4FABFC[v6 / 4] = 0x40400000u; 5506 array_4FABD0[v6].field_30f = 8.0;
5579 dword_4FAC00[v6 / 4] = 0x41000000u; 5507 array_4FABD0[v6].field_34 = 5;
5580 dword_4FAC04[v6 / 4] = 5; 5508 array_4FABD0[v6].field_38 = 15;
5581 dword_4FAC08[v6 / 4] = 15; 5509 array_4FABD0[v6].field_3C = &array_4FABD0[v6].field_44[0];
5582 dword_4FAC0C[v6 / 4] = (int)array_4FABD0[v6 / 0x10AC].field_4; 5510 v8 = array_4FABD0[v6].field_40;
5583 v7->_40E01A((int)((char *)&unk_4FABD4 + v6)); 5511 v8->_40E01A(array_4FABD0[v6].field_4);
5584 if ( 10 * v2 > 150 ) 5512 if ( 10 * v2 > 150 )
5585 v2 = 15; 5513 v2 = 15;
5586 // v8 = array_4FABD0[v6 / 0x10AC].ptr_0; 5514
5587 if ( v8->signature != SIG_trpg ) 5515 if ( v8->signature != SIG_trpg )
5588 return 2; 5516 return 2;
5589 if ( !v8->field_59 ) 5517 if ( !v8->field_59 )
5590 return 3; 5518 return 3;
5591 v8->field_8 = 10 * v2; 5519 v8->field_8 = 10 * v2;
5592 v9 = v8->field_4;
5593 v8->field_30 = 0.0; 5520 v8->field_30 = 0.0;
5594 v8->field_58 = 0; 5521 v8->field_58 = 0;
5595 v8->field_44 = 0; 5522 v8->field_44 = 0;
5596 v8->field_4C = 0; 5523 v8->field_4C = 0;
5597 v8->field_48 = 0; 5524 v8->field_48 = 0;
5598 v8->field_50 = 0; 5525 v8->field_50 = 0;
5599 /*v10 = v8->field_54; 5526 for (int i=0; i<v8->field_4; ++i)
5600 do 5527 v8->field_54[i].field_0=0;
5601 {
5602 *(unsigned int *)v10 = 0;
5603 v10 += 28;
5604 --v9;
5605 }*/
5606 while ( v9 );
5607 return 0; 5528 return 0;
5608 } 5529 }
5609 // 40D2B4: using guessed type int __fastcall am_40D2B4(uint, uint); 5530
5610 // 4FABD8: using guessed type int dword_4FABD8[];
5611 // 4FABDC: using guessed type int dword_4FABDC[];
5612 // 4FABE0: using guessed type int dword_4FABE0[];
5613 // 4FABE4: using guessed type int dword_4FABE4[];
5614 // 4FABE8: using guessed type int dword_4FABE8[];
5615 // 4FABEC: using guessed type int dword_4FABEC[];
5616 // 4FABF0: using guessed type int dword_4FABF0[];
5617 // 4FABF4: using guessed type int dword_4FABF4[];
5618 // 4FABF8: using guessed type int dword_4FABF8[];
5619 // 4FABFC: using guessed type int dword_4FABFC[];
5620 // 4FAC00: using guessed type int dword_4FAC00[];
5621 // 4FAC04: using guessed type int dword_4FAC04[];
5622 // 4FAC08: using guessed type int dword_4FAC08[];
5623 // 4FAC0C: using guessed type int dword_4FAC0C[];
5624 5531
5625 //----- (0040D402) -------------------------------------------------------- 5532 //----- (0040D402) --------------------------------------------------------
5626 int __fastcall am_40D402(int a1, int a2) 5533 int __fastcall am_40D402(int a1, int a2)
5627 { 5534 {
5628 ArcomagePlayer *v2; // ecx@1 5535 ArcomagePlayer *v2; // ecx@1
5968 5875
5969 5876
5970 5877
5971 5878
5972 //----- (00409BE8) -------------------------------------------------------- 5879 //----- (00409BE8) --------------------------------------------------------
5973 void __cdecl sub_409BE8() 5880 void sub_409BE8()
5974 { 5881 {
5975 void *v0; // eax@1
5976 stru348 *v1; // eax@1 5882 stru348 *v1; // eax@1
5977 int v2; // ecx@1 5883
5978 int v3; // eax@1 5884 v1 = &stru_4E1890[window_SpeakInHouse->par1C - 108];
5979
5980 v0 = window_SpeakInHouse->ptr_1C;
5981 dword_4E1874 = 5;
5982 v1 = &stru_4E1890[(int)((char *)v0 - 108)];
5983 amuint_4E1860 = v1->field_4; 5885 amuint_4E1860 = v1->field_4;
5984 amuint_4E1864 = v1->field_6; 5886 amuint_4E1864 = v1->field_6;
5985 amuint_4E1868 = v1->field_8 - 1; 5887 amuint_4E1868 = v1->field_8 - 1;
5986 amuint_4E186C = v1->field_A - 1; 5888 amuint_4E186C = v1->field_A - 1;
5987 amuint_4E1870 = v1->field_C - 1; 5889 amuint_4E1870 = v1->field_C - 1;
5988 amuint_505884 = v1->field_E; 5890 dword_4E1874 = 5;
5989 amuint_505888 = v1->field_10;
5990 amuint_50588C = v1->field_12;
5991 dword_4E1878 = 1; 5891 dword_4E1878 = 1;
5992 dword_4E187C = 1; 5892 dword_4E187C = 1;
5993 dword_4E1880 = 1; 5893 dword_4E1880 = 1;
5994 dword_4E1884 = v1->field_0; 5894 dword_4E1884 = v1->field_0;
5995 v2 = v1->field_2; 5895 dword_4E1888 = v1->field_2;
5996 v3 = v1->field_14; 5896
5997 dword_4E1888 = v2; 5897 dword_4DF3A4 = v1->field_14;
5998 dword_4DF3A4 = v3; 5898
5899 amuint_505884 = v1->field_E;
5900 amuint_505888 = v1->field_10;
5901 amuint_50588C = v1->field_12;
5902
5999 } 5903 }
6000 5904
6001 5905
6002 //----- (0040D75D) -------------------------------------------------------- 5906 //----- (0040D75D) --------------------------------------------------------
6003 void pPrimaryWindow_draws_text( int a1, const char *pText, POINT *pXY ) 5907 void pPrimaryWindow_draws_text( int a1, const char *pText, POINT *pXY )
6007 pPrimaryWindow->DrawText( pFontComic, pXY->x, pXY->y - (v4 >> 1) + 3, 0, pText, 0, 0, 0); 5911 pPrimaryWindow->DrawText( pFontComic, pXY->x, pXY->y - (v4 >> 1) + 3, 0, pText, 0, 0, 0);
6008 } 5912 }
6009 5913
6010 5914
6011 //----- (0040DB27) -------------------------------------------------------- 5915 //----- (0040DB27) --------------------------------------------------------
6012 void __fastcall DrawRect(Vec4_int_ *pXYZW, unsigned __int16 uColor, char bSolidFill) 5916 void __fastcall DrawRect(RECT *pXYZW, unsigned __int16 uColor, char bSolidFill)
6013 { 5917 {
6014 Vec4_int_ *v3; // esi@1 5918 RECT *v3; // esi@1
6015 unsigned __int16 v4; // bp@1
6016 unsigned int i; // ebx@3
6017 5919
6018 v3 = pXYZW; 5920 v3 = pXYZW;
6019 v4 = uColor;
6020 pRenderer->BeginScene(); 5921 pRenderer->BeginScene();
6021 pRenderer->SetRasterClipRect(0, 0, 639u, 479u); 5922 pRenderer->SetRasterClipRect(0, 0, 639u, 479u);
6022 if ( bSolidFill ) 5923 if ( bSolidFill )
6023 { 5924 {
6024 for ( i = v3->y; (signed int)i <= v3->w; ++i ) 5925 for ( int i = v3->top; i <= v3->bottom; ++i )
6025 pRenderer->RasterLine2D(v3->x, i, v3->z, i, v4); 5926 pRenderer->RasterLine2D(v3->left, i, v3->right, i, uColor);
6026 } 5927 }
6027 else 5928 else
6028 { 5929 {
6029 pRenderer->RasterLine2D(v3->x, v3->y, v3->z, v3->y, v4); 5930 pRenderer->RasterLine2D(v3->left, v3->top, v3->right, v3->top, uColor);
6030 pRenderer->RasterLine2D(v3->z, v3->y, v3->z, v3->w, v4); 5931 pRenderer->RasterLine2D(v3->right, v3->top, v3->right, v3->bottom, uColor);
6031 pRenderer->RasterLine2D(v3->z, v3->w, v3->x, v3->w, v4); 5932 pRenderer->RasterLine2D(v3->right, v3->bottom, v3->left, v3->bottom, uColor);
6032 pRenderer->RasterLine2D(v3->x, v3->w, v3->x, v3->y, v4); 5933 pRenderer->RasterLine2D(v3->left, v3->bottom, v3->left, v3->top, uColor);
6033 } 5934 }
6034 pRenderer->EndScene(); 5935 pRenderer->EndScene();
6035 } 5936 }
6036 5937
5938
5939 //----- (0040DBD3) --------------------------------------------------------
5940 void SetPixel( POINT *pTargetXY, unsigned __int16 uColor )
5941 {
5942 pRenderer->BeginScene();
5943 if ( pRenderer->uNumSceneBegins )
5944 {
5945 int xVal = pTargetXY->x;
5946 int yVal = pTargetXY->y;
5947 if ( xVal >= 0 && xVal <= 639 && yVal >= 0 && yVal <= 479)
5948 {
5949 pRenderer->pTargetSurface[xVal + pRenderer->uTargetSurfacePitch * yVal] = uColor;
5950 }
5951 pRenderer->EndScene();
5952 }
5953 }
5954
5955
6037 //----- (0040DDB1) -------------------------------------------------------- 5956 //----- (0040DDB1) --------------------------------------------------------
6038 int __fastcall rand_interval(int a, int b) 5957 int __fastcall rand_interval(int a, int b)
6039 { 5958 {
6040 return a + rand() % (b - a + 1); 5959 return a + rand() % (b - a + 1);
6041 } 5960 }