Mercurial > mm7
comparison Arcomage.cpp @ 1186:569216b4f54d
more on arcomage 2
author | Gloval |
---|---|
date | Fri, 07 Jun 2013 08:51:31 +0400 |
parents | 24454b5c9268 |
children | f30e67ca6f72 |
comparison
equal
deleted
inserted
replaced
1185:24454b5c9268 | 1186:569216b4f54d |
---|---|
112 | 112 |
113 Acromage_st1 struct_st1[10]; | 113 Acromage_st1 struct_st1[10]; |
114 | 114 |
115 stru272 array_4FABD0[10]; | 115 stru272 array_4FABD0[10]; |
116 | 116 |
117 char byte_5052A8[108]; | |
118 int dword_505314[108]; // weak | |
119 | |
120 char byte_5054C8[32]; // idb | |
121 char byte_5054E8[108]; | |
117 int dword_505554[108]; | 122 int dword_505554[108]; |
118 char byte_5054E8[108]; | 123 |
124 char pArcomagePlayer2Name[8]; | |
125 char pArcomagePlayer1Name[8]; | |
126 char pDeckMaster[12]; | |
127 | |
119 | 128 |
120 /* 267 */ | 129 /* 267 */ |
121 #pragma pack(push, 1) | 130 #pragma pack(push, 1) |
122 struct stru273 | 131 struct stru273 |
123 { | 132 { |
131 char field_A; | 140 char field_A; |
132 char field_B; | 141 char field_B; |
133 }; | 142 }; |
134 #pragma pack(pop) | 143 #pragma pack(pop) |
135 | 144 |
145 | |
146 | |
136 char am_byte_4E185D; // weak | 147 char am_byte_4E185D; // weak |
137 | 148 |
138 int amuint_4E1860; // weak | 149 int amuint_4E1860; // weak |
139 int amuint_4E1864; // weak | 150 int amuint_4E1864; // weak |
140 int amuint_4E1868; // weak | 151 int amuint_4E1868; // weak |
150 int dword_4E1888 = 100 ; // weak | 161 int dword_4E1888 = 100 ; // weak |
151 | 162 |
152 int dword_4DF3A4; // weak | 163 int dword_4DF3A4; // weak |
153 | 164 |
154 char byte_4FAA2C; // weak | 165 char byte_4FAA2C; // weak |
166 char byte_4FAA2D; // weak | |
167 | |
155 int amuint_4FAA6C; // idb | 168 int amuint_4FAA6C; // idb |
156 char am_byte_4FAA77; // weak | 169 char am_byte_4FAA77; // weak |
157 | 170 |
158 | 171 signed int dword_4FABBC; // idb |
159 unsigned int amuint_4FABC0; // idb | 172 unsigned int amuint_4FABC0; // idb |
160 | 173 |
174 int dword_4FABC8; // weak | |
161 | 175 |
162 | 176 |
163 //----- (0040DD2F) -------------------------------------------------------- | 177 //----- (0040DD2F) -------------------------------------------------------- |
164 bool stru273::_40DD2F() | 178 bool stru273::_40DD2F() |
165 { | 179 { |
210 return 2; | 224 return 2; |
211 | 225 |
212 } | 226 } |
213 | 227 |
214 //----- (0040E01A) -------------------------------------------------------- | 228 //----- (0040E01A) -------------------------------------------------------- |
215 int stru272_stru0::_40E01A(int a2) | 229 int stru272_stru0::_40E01A( stru272_stru2* a2 ) |
216 { | 230 { |
217 auto a1 = this; | 231 auto a1 = this; |
218 if ( a1->signature == SIG_trpg ) | 232 if ( a1->signature == SIG_trpg ) |
219 { | 233 { |
220 a1->field_4 = *(int *)(a2 + 32); | 234 a1->field_4 = a2->field_20; |
221 a1->field_C = *(int *)a2 << 16; | 235 a1->field_C = a2->field_0 << 16; |
222 a1->field_10 = *(int *)(a2 + 4) << 16; | 236 a1->field_10 = a2->field_4 << 16; |
223 a1->field_14 = *(int *)(a2 + 8) << 16; | 237 a1->field_14 = a2->field_8 << 16; |
224 a1->field_18 = *(int *)(a2 + 12) << 16; | 238 a1->field_18 = a2->field_C << 16; |
225 a1->field_1C = *(int *)(a2 + 16); | 239 a1->field_1C = a2->field_10; |
226 a1->field_20 = *(int *)(a2 + 20); | 240 a1->field_20 = a2->field_14; |
227 a1->field_24 = *(int *)(a2 + 24); | 241 a1->field_24 = a2->field_18; |
228 a1->field_28 = *(float *)(a2 + 28) * 65536.0; | 242 a1->field_28 = (float)(a2->field_1Cf * 65536.0); |
229 LODWORD(a1->field_2C) = *(int *)(a2 + 36); | 243 a1->field_2C = a2->field_24f; |
230 a1->field_34 = (signed __int64)(*(float *)(a2 + 40) * 65536.0); | 244 a1->field_34 = (int)(a2->field_28f * 65536.0); |
231 a1->field_38 = (signed __int64)(*(float *)(a2 + 44) * 65536.0); | 245 a1->field_38 = (int)(a2->field_2Cf * 65536.0); |
232 a1->field_3C = *(int *)(a2 + 48); | 246 a1->field_3C = a2->field_30; |
233 a1->field_40 = *(int *)(a2 + 52); | 247 a1->field_40 = a2->field_34; |
234 // a1->field_54 = *(int *)(a2 + 56); | 248 a1->field_54 = a2->field_38; |
235 a1->field_59 = 1; | 249 a1->field_59 = 1; |
250 | |
236 return 0; | 251 return 0; |
237 } | 252 } |
238 else | 253 else |
239 return 2; | 254 return 2; |
240 } | 255 } |
263 } | 278 } |
264 | 279 |
265 //----- (0040E133) -------------------------------------------------------- | 280 //----- (0040E133) -------------------------------------------------------- |
266 int stru272_stru0::_40E133() | 281 int stru272_stru0::_40E133() |
267 { | 282 { |
283 | |
268 stru272_stru0 *v1; // edi@1 | 284 stru272_stru0 *v1; // edi@1 |
269 int v3; // ST18_4@3 | 285 int v3; // ST18_4@3 |
270 double v4; // st7@3 | 286 double v4; // st7@3 |
271 double v5; // st6@4 | 287 double v5; // st6@4 |
272 char v6; // bl@8 | 288 char v6; // bl@8 |
273 int v7; // esi@8 | 289 stru272_stru1 *v7; // esi@8 |
274 int v8; // ecx@10 | 290 int v8; // ecx@10 |
275 signed int v9; // eax@10 | 291 signed int v9; // eax@10 |
276 int v10; // ecx@10 | 292 int v10; // ecx@10 |
277 signed int v11; // eax@10 | 293 signed int v11; // eax@10 |
278 signed int v12; // edx@12 | 294 int v12; // ebx@12 |
279 signed int v13; // edx@12 | 295 int v13; // ST1C_4@12 |
280 int v14; // [sp+8h] [bp-10h]@8 | 296 int v14; // ebx@12 |
281 int v15; // [sp+Ch] [bp-Ch]@8 | 297 int v15; // ST1C_4@12 |
282 float v16; // [sp+14h] [bp-4h]@3 | 298 signed int v16; // edx@12 |
299 int v17; // ebx@12 | |
300 int v18; // ST1C_4@12 | |
301 signed int v19; // edx@12 | |
302 int v20; // [sp+8h] [bp-10h]@8 | |
303 int v21; // [sp+Ch] [bp-Ch]@8 | |
304 float v22; // [sp+14h] [bp-4h]@3 | |
283 | 305 |
284 v1 = this; | 306 v1 = this; |
285 if ( this->signature != SIG_trpg ) | 307 if ( this->signature != SIG_trpg ) |
286 return 2; | 308 return 2; |
287 v3 = this->field_8; | 309 v3 = this->field_8; |
288 v16 = this->field_30; | 310 v22 = this->field_30; |
289 v4 = (double)v3; | 311 v4 = v3; |
290 if ( v3 > 0 ) | 312 if ( v3 > 0 ) |
291 { | 313 { |
292 v5 = v16 + this->field_2C; | 314 v5 = v22 + this->field_2C; |
293 v16 = v5; | 315 v22 = v5; |
294 if ( v5 > v4 ) | 316 if ( v5 > v4 ) |
295 v16 = v4; | 317 v22 = v4; |
296 } | 318 } |
297 if ( v16 >= 1.0 || this->field_58 ) | 319 if ( v22 >= 1.0 || this->field_58 ) |
298 { | 320 { |
299 v6 = 0; | 321 v6 = 0; |
300 // v7 = this->field_54; | 322 v7 = this->field_54; |
301 v14 = (signed __int64)this->field_28; | 323 v20 = this->field_28; |
302 v15 = this->field_4; | 324 v21 = this->field_4; |
303 while ( *(int *)v7 <= 0 ) | 325 while ( v7->field_0 <= 0 ) |
304 { | 326 { |
305 if ( v16 >= 1.0 ) | 327 if ( v22 >= 1.0 ) |
306 { | 328 { |
307 *(int *)v7 = v1->field_3C + rand() % (v1->field_40 - v1->field_3C + 1); | 329 v12 = v1->field_40; |
308 *(int *)(v7 + 20) = (rand() % 17 - 8) << 16; | 330 v13 = v1->field_3C; |
309 *(int *)(v7 + 24) = (rand() % 17 - 8) << 16; | 331 v7->field_0 = v13 + rand() % (v12 - v13 + 1); |
310 v12 = v1->field_C + rand() % (v1->field_14 - 1 - v1->field_C + 1); | 332 v7->field_14 = (rand() % 17 - 8) << 16; |
311 *(int *)(v7 + 12) = v12; | 333 v7->field_18 = (rand() % 17 - 8) << 16; |
312 *(int *)(v7 + 4) = v12 >> 16; | 334 v14 = v1->field_14 - 1; |
313 v16 = v16 - 1.0; | 335 v15 = v1->field_C; |
314 v13 = v1->field_10 + rand() % (v1->field_18 - 1 - v1->field_10 + 1); | 336 v16 = v15 + rand() % (v14 - v15 + 1); |
315 *(int *)(v7 + 16) = v13; | 337 v7->field_C = v16; |
316 *(int *)(v7 + 8) = v13 >> 16; | 338 v7->field_4.x = v16 >> 16; |
339 | |
340 v17 = v1->field_18 - 1; | |
341 v18 = v1->field_10; | |
342 v22 = v22 - 1.0; | |
343 v19 = v18 + rand() % (v17 - v18 + 1); | |
344 v7->field_10 = v19; | |
345 v7->field_4.y = v19 >> 16; | |
317 --v1->field_8; | 346 --v1->field_8; |
318 goto LABEL_13; | 347 goto LABEL_13; |
319 } | 348 } |
320 LABEL_14: | 349 LABEL_14: |
321 v7 += 28; | 350 ++v7; |
322 --v15; | 351 --v21; |
323 if ( !v15 ) | 352 if ( !v21 ) |
324 { | 353 { |
325 v1->field_58 = v6; | 354 v1->field_58 = v6; |
326 v1->field_30 = v16; | 355 v1->field_30 = v22; |
327 return 0; | 356 return 0; |
328 } | 357 } |
329 } | 358 } |
330 v8 = *(int *)(v7 + 20); | 359 v8 = v7->field_14; |
331 --*(int *)v7; | 360 --v7->field_0; |
332 v9 = v8 + *(int *)(v7 + 12); | 361 v9 = v8 + v7->field_C; |
333 v10 = v14 + *(int *)(v7 + 24); | 362 |
334 *(int *)(v7 + 12) = v9; | 363 v10 = v20 + v7->field_18; |
335 *(int *)(v7 + 4) = v9 >> 16; | 364 v7->field_C = v9; |
336 v11 = v10 + *(int *)(v7 + 16); | 365 v7->field_4.x = v9 >> 16; |
337 *(int *)(v7 + 24) = v10; | 366 |
338 *(int *)(v7 + 16) = v11; | 367 v11 = v10 + v7->field_10; |
339 *(int *)(v7 + 8) = v11 >> 16; | 368 v7->field_18 = v10; |
369 v7->field_10 = v11; | |
370 v7->field_4.y = v11 >> 16; | |
340 LABEL_13: | 371 LABEL_13: |
341 v6 = 1; | 372 v6 = 1; |
342 goto LABEL_14; | 373 goto LABEL_14; |
343 } | 374 } |
344 return 0; | 375 return 0; |
1520 while ( !pArcomageGame->field_F5 ) | 1551 while ( !pArcomageGame->field_F5 ) |
1521 { | 1552 { |
1522 pArcomageGame->field_F6 = 1; | 1553 pArcomageGame->field_F6 = 1; |
1523 byte_4FAA24 = 1; | 1554 byte_4FAA24 = 1; |
1524 am_40A346(amuint_4FAA6C); | 1555 am_40A346(amuint_4FAA6C); |
1525 Sleep(10000); | |
1526 LABEL_8: | 1556 LABEL_8: |
1527 while ( byte_4FAA24 ) | 1557 while ( byte_4FAA24 ) |
1528 { | 1558 { |
1529 amuint_4FABC0 = -1; | 1559 amuint_4FABC0 = -1; |
1530 am_40A283(amuint_4FAA6C); | 1560 am_40A283(amuint_4FAA6C); |
1786 if ( v2 >= 108 ) | 1816 if ( v2 >= 108 ) |
1787 { | 1817 { |
1788 am_40A198(); | 1818 am_40A198(); |
1789 v2 = dword_4FABC8; | 1819 v2 = dword_4FABC8; |
1790 } | 1820 } |
1791 /*if ( !array_4FABD0[9].field_4[v2 + 4232] ) | 1821 if ( !byte_5052A8[v2] ) |
1792 { | 1822 { |
1793 v3 = dword_505314[v2]; | 1823 v3 = dword_505314[v2]; |
1794 v5 = 1; | 1824 v5 = 1; |
1795 }*/ | 1825 } |
1796 ++v2; | 1826 ++v2; |
1797 dword_4FABC8 = v2; | 1827 dword_4FABC8 = v2; |
1798 } | 1828 } |
1799 while ( !v5 ); | 1829 while ( !v5 ); |
1800 ArcomageGame::PlaySound(0x15u); | 1830 ArcomageGame::PlaySound(0x15u); |
1801 result = GetEmptyCardSlotIndex(v4); | 1831 result = GetEmptyCardSlotIndex(v4); |
1802 if ( result != -1 ) | 1832 if ( result != -1 ) |
1803 { | 1833 { |
1804 amuint_4FAA4C = result; | 1834 amuint_4FAA4C = result; |
1805 am_Players[0].cards_at_hand[result + 47 * v4] = v3; | 1835 am_Players[a1].cards_at_hand[result] = v3; |
1806 v7 = 188 * v4 + 8 * result; | 1836 am_Players[a1].arr_6C[result].field_0 = rand_interval(-4, 4); |
1807 // *(int *)((char *)am_Players[0].arr_6C[0] + v7) = rand_interval(-4, 4); | 1837 am_Players[a1].arr_6C[result].field_4 = rand_interval(-4, 4); |
1808 result = rand_interval(-4, 4); | |
1809 // *(int *)((char *)&am_Players[0].arr_6C[0][1] + v7) = result; | |
1810 pArcomageGame->field_F6 = 1; | 1838 pArcomageGame->field_F6 = 1; |
1811 byte_4FAA2D = 1; | 1839 byte_4FAA2D = 1; |
1812 } | 1840 } |
1813 | 1841 |
1814 } | 1842 } |
1815 // 4FAA2D: using guessed type char byte_4FAA2D; | 1843 |
1816 // 4FAA4C: using guessed type int amuint_4FAA4C; | |
1817 // 4FABC8: using guessed type int dword_4FABC8; | |
1818 // 505314: using guessed type int dword_505314[]; | |
1819 | 1844 |
1820 //----- (0040A324) -------------------------------------------------------- | 1845 //----- (0040A324) -------------------------------------------------------- |
1821 int GetEmptyCardSlotIndex( int player_num ) | 1846 int GetEmptyCardSlotIndex( int player_num ) |
1822 { | 1847 { |
1823 int i; | 1848 int i; |
5490 } | 5515 } |
5491 else | 5516 else |
5492 { | 5517 { |
5493 array_4FABD0[v6].field_1 = 1; | 5518 array_4FABD0[v6].field_1 = 1; |
5494 } | 5519 } |
5495 array_4FABD0[v6].field_4 = v3->x - 20; | 5520 array_4FABD0[v6].field_4.field_0 = v3->x - 20; |
5496 array_4FABD0[v6].field_C = v3->x + 20; | 5521 array_4FABD0[v6].field_4.field_8 = v3->x + 20; |
5497 array_4FABD0[v6].field_8 = v3->y - 20; | 5522 array_4FABD0[v6].field_4.field_4 = v3->y - 20; |
5498 array_4FABD0[v6].field_10 = v3->y + 20; | 5523 array_4FABD0[v6].field_4.field_C = v3->y + 20; |
5499 array_4FABD0[v6].field_14 = -60; | 5524 array_4FABD0[v6].field_4.field_10 = -60; |
5500 array_4FABD0[v6].field_18 = 60; | 5525 array_4FABD0[v6].field_4.field_14 = 60; |
5501 array_4FABD0[v6].field_1C = 180; | 5526 array_4FABD0[v6].field_4.field_18 = 180; |
5502 array_4FABD0[v6].field_20f = 0.5; | 5527 array_4FABD0[v6].field_4.field_1Cf = 0.5; |
5503 array_4FABD0[v6].field_24 = 150; | 5528 array_4FABD0[v6].field_4.field_20 = 150; |
5504 array_4FABD0[v6].field_28f = 50.0; | 5529 array_4FABD0[v6].field_4.field_24f= 50.0; |
5505 array_4FABD0[v6].field_2Cf = 3.0; | 5530 array_4FABD0[v6].field_4.field_28f = 3.0; |
5506 array_4FABD0[v6].field_30f = 8.0; | 5531 array_4FABD0[v6].field_4.field_2Cf = 8.0; |
5507 array_4FABD0[v6].field_34 = 5; | 5532 array_4FABD0[v6].field_4.field_30 = 5; |
5508 array_4FABD0[v6].field_38 = 15; | 5533 array_4FABD0[v6].field_4.field_34 = 15; |
5509 array_4FABD0[v6].field_3C = &array_4FABD0[v6].field_44[0]; | 5534 array_4FABD0[v6].field_4.field_38 = &array_4FABD0[v6].field_44[0]; |
5510 v8 = array_4FABD0[v6].field_40; | 5535 v8 = array_4FABD0[v6].field_40; |
5511 v8->_40E01A(array_4FABD0[v6].field_4); | 5536 v8->_40E01A(&array_4FABD0[v6].field_4); |
5512 if ( 10 * v2 > 150 ) | 5537 if ( 10 * v2 > 150 ) |
5513 v2 = 15; | 5538 v2 = 15; |
5514 | 5539 |
5515 if ( v8->signature != SIG_trpg ) | 5540 if ( v8->signature != SIG_trpg ) |
5516 return 2; | 5541 return 2; |