Mercurial > mm7
annotate Arcomage.cpp @ 2181:17b3e40daedc
_427E01_cast_spell continue
author | Ritor1 |
---|---|
date | Thu, 23 Jan 2014 00:18:05 +0600 |
parents | 9bd7522cdbbb |
children | 3664342f5d93 |
rev | line source |
---|---|
0 | 1 #include <string> |
2 | |
1254 | 3 #include "Render.h" |
0 | 4 #include "Arcomage.h" |
5 #include "VideoPlayer.h" | |
6 #include "AudioPlayer.h" | |
7 #include "Mouse.h" | |
8 #include "Game.h" | |
9 #include "Viewport.h" | |
2044 | 10 #include "Timer.h" |
0 | 11 #include "GUIFont.h" |
12 #include "Party.h" | |
13 #include "GUIWindow.h" | |
14 #include "Events2D.h" | |
15 #include "VectorTypes.h" | |
189 | 16 #include "texts.h" |
1183 | 17 #include <windef.h> |
1262 | 18 #include "mm7_data.h" |
0 | 19 |
20 | |
21 | |
1197 | 22 void SetStartConditions(); |
23 void SetStartGameData(); | |
24 void FillPlayerDeck(); | |
1200 | 25 void InitalHandsFill(); |
26 void GetNextCardFromDeck(int player_num); | |
1185 | 27 int GetEmptyCardSlotIndex(int player_num); |
1197 | 28 void IncreaseResourcesInTurn(int player_num); |
1263 | 29 void TurnChange(); |
1256 | 30 bool IsGameOver(); |
31 int CalculateCardPower(ArcomagePlayer* player, ArcomagePlayer* enemy, ArcomageCard* pCard, int mastery); | |
32 char PlayerTurn(int player_num); | |
1263 | 33 void DrawGameUI(int animation_stage); |
34 void DrawSparks(); | |
1197 | 35 void DrawRectanglesForText(); |
36 void DrawPlayersText(); | |
1263 | 37 void DrawPlayerLevels(int a1, char *text, POINT *pXY); |
38 void DrawBricksCount(int a1, char* text, POINT *pXY); | |
1197 | 39 void DrawGemsCount(int a1, char* text, POINT* pXY); |
1263 | 40 void DrawBeastsCount(int a1, char *text, POINT *pXY); |
1209 | 41 void DrawPlayersTowers(); |
42 void DrawPlayersWall(); | |
43 void DrawCards(); | |
1218 | 44 void DrawCardAnimation(int a1); |
1185 | 45 int GetPlayerHandCardCount(int player_num); |
1679 | 46 int DrawCardsRectangles(int player_num); |
47 bool DiscardCard(int player_num, int card_slot_index); | |
48 bool PlayCard(int player_num, int card_slot_num); | |
1200 | 49 bool CanCardBePlayed(int player_num, int hand_card_indx); |
1263 | 50 void ApplyCardToPlayer(int player_num, unsigned int uCardID); |
1185 | 51 int am_40D2B4(POINT* a1, int a2); // weak |
1246 | 52 int ApplyDamageToBuildings(int player_num, int damage); // weak |
1218 | 53 void GameResultsApply(); |
1183 | 54 |
1679 | 55 void am_DrawText(int a1, const char *pText, POINT *pXY); |
2154 | 56 void am_BeginScene(unsigned __int16 *pPcxPixels, int a2, int a3); // idb |
57 void am_EndScene(); | |
1263 | 58 void DrawRect(RECT *pXYZW, unsigned __int16 uColor, char bSolidFill); |
1679 | 59 void DrawSquare( POINT *pTargetXY, unsigned __int16 uColor ); |
60 void DrawPixel(POINT *pTargetXY, unsigned __int16 uColor); | |
1263 | 61 int rand_interval(int min, int max); // idb |
1679 | 62 void __fastcall am_IntToString(int val, char *pOut); |
938 | 63 |
1393 | 64 //----- (0040DEDB) -------------------------------------------------------- |
65 unsigned int R8G8B8_to_TargetFormat(int uColor) | |
66 { | |
2069 | 67 return Color16(LOBYTE(uColor), BYTE1(uColor), BYTE2(uColor)); |
1393 | 68 } |
69 | |
938 | 70 /* 388 */ |
71 #pragma pack(push, 1) | |
1197 | 72 struct ArcomageStartConditions |
938 | 73 { |
1197 | 74 __int16 max_tower; |
75 __int16 max_resources; | |
76 __int16 tower_height; | |
77 __int16 wall_height; | |
78 __int16 quarry_level; | |
79 __int16 magic_level; | |
1200 | 80 __int16 zoo_level; |
1197 | 81 __int16 bricks_amount; |
82 __int16 gems_amount; | |
83 __int16 beasts_amount; | |
1256 | 84 int mastery_lvl; |
938 | 85 }; |
86 #pragma pack(pop) | |
1256 | 87 const ArcomageStartConditions start_conditions[13] = |
938 | 88 { |
89 { 30, 100, 15, 5, 2, 2, 2, 10, 10, 10, 0}, | |
90 { 50, 150, 20, 5, 2, 2, 2, 5, 5, 5, 1}, | |
91 { 50, 150, 20, 5, 2, 2, 2, 5, 5, 5, 2}, | |
92 { 75, 200, 25, 10, 3, 3, 3, 5, 5, 5, 2}, | |
93 { 75, 200, 20, 10, 3, 3, 3, 5, 5, 5, 1}, | |
94 {100, 300, 30, 15, 4, 4, 4, 10, 10, 10, 1}, | |
95 {100, 300, 30, 15, 4, 4, 4, 10, 10, 10, 2}, | |
96 {150, 400, 20, 10, 5, 5, 5, 25, 25, 25, 0}, | |
97 {200, 500, 20, 10, 1, 1, 1, 15, 15, 15, 2}, | |
98 {100, 300, 20, 50, 1, 1, 5, 5, 5, 25, 0}, | |
99 {125, 350, 10, 20, 3, 1, 2, 15, 5, 10, 2}, | |
100 {125, 350, 10, 20, 3, 1, 2, 15, 5, 10, 1}, | |
101 {100, 300, 50, 50, 5, 3, 5, 20, 10, 20, 0} | |
102 }; | |
103 | |
1184 | 104 #define SIG_trpg 0x67707274 |
105 #define SIG_xxxx 0x78787878 | |
0 | 106 |
107 ArcomageGame *pArcomageGame = new ArcomageGame; | |
1194 | 108 |
1679 | 109 ArcomagePlayer am_Players[2]; // 00505708 |
110 AcromageCardOnTable shown_cards[10]; // 004FAA78 | |
111 stru272 array_4FABD0[10]; // 4FABD0 | |
112 | |
113 | |
114 ArcomageDeck playDeck; // 00505288 | |
115 ArcomageDeck deckMaster; // 005054C8 | |
1201 | 116 |
117 char Player2Name[] = "Enemy"; | |
118 char Player1Name[] = "Player"; | |
0 | 119 |
120 /* 267 */ | |
121 #pragma pack(push, 1) | |
122 struct stru273 | |
123 { | |
124 bool _40DD2F(); | |
1185 | 125 bool Inside(RECT*pXYZW); |
0 | 126 |
127 int x; | |
128 int y; | |
1263 | 129 char curr_mouse_left; |
130 char mouse_left_state_changed; | |
131 char curr_mouse_right; | |
132 char mouse_right_state_changed; | |
0 | 133 }; |
134 #pragma pack(pop) | |
135 | |
1186 | 136 |
1256 | 137 #pragma pack(push, 1) |
138 struct am_2 | |
139 { | |
140 int slot_index; | |
141 int card_power; | |
142 }; | |
143 #pragma pack(pop) | |
144 | |
1263 | 145 am_2 cards_power[10]; |
1256 | 146 std::array<__int16, 12> am_sounds; |
147 | |
1218 | 148 char byte_4E185C = 1; // weak |
149 char am_byte_4E185D = 1; // weak | |
1263 | 150 char use_start_bonus = 1; // weak |
1185 | 151 |
1201 | 152 int start_tower_height; |
153 int start_wall_height; | |
154 int start_quarry_level; | |
155 int start_magic_level; | |
156 int start_zoo_level; | |
157 | |
158 | |
1679 | 159 int minimum_cards_at_hand = 5; // 004E1874 |
1201 | 160 int quarry_bonus = 1; |
161 int magic_bonus = 1; | |
162 int zoo_bonus = 1; | |
163 | |
164 int max_tower_height = 50; | |
165 int max_resources_amount = 100 ; | |
1185 | 166 |
1256 | 167 int opponent_mastery = 1 ; // weak |
1185 | 168 |
1679 | 169 bool am_gameover; // 004FAA2C |
1186 | 170 char byte_4FAA2D; // weak |
171 | |
2154 | 172 int am_default_starting_player = 0; // 505890 |
1679 | 173 int current_player_num; // 004FAA6C |
174 char need_to_discard_card; // 04FAA77 | |
175 | |
176 int current_card_slot_index; // 004FABBC | |
177 int played_card_id; // 4FABC0 | |
178 int uCardID; // 4FAA50 | |
179 | |
180 int deck_walk_index; // 004FABC8 | |
1201 | 181 |
182 int start_bricks_amount; | |
183 int start_gems_amount; | |
184 int start_beasts_amount; | |
1197 | 185 |
1209 | 186 POINT amuint_4FAA3C_blt_xy; |
187 POINT am_uint_4FAA44_blt_xy; | |
188 POINT amuint_4FAA54_blt_xy; | |
189 POINT amuint_4FAA5C_blt_xy; | |
190 | |
1245 | 191 int dword_4FAA64; // weak |
192 int dword_4FAA68; // weak | |
1209 | 193 |
194 int dword_4FABB8; // weak | |
195 | |
1256 | 196 char byte_4FAA00; // weak |
197 | |
198 int amuint_4FAA34; // weak | |
199 int amuint_4FAA38; // weak | |
200 int amuint_4FAA4C; // weak | |
201 | |
202 char byte_4FAA2E; // weak | |
203 | |
204 int dword_4FAA70; // weak | |
205 char byte_4FAA74; // weak | |
206 char am_byte_4FAA75; // weak | |
207 char am_byte_4FAA76; // weak | |
208 | |
209 int amuint_4FABC4; // weak | |
210 | |
211 | |
212 char byte_505880; // weak | |
213 char byte_505881; // weak | |
0 | 214 |
215 //----- (0040DD2F) -------------------------------------------------------- | |
216 bool stru273::_40DD2F() | |
217 { | |
218 | |
219 this->x = pArcomageGame->mouse_x; | |
220 this->y = pArcomageGame->mouse_y; | |
1263 | 221 this->curr_mouse_left = pArcomageGame->mouse_left; |
222 this->mouse_left_state_changed = pArcomageGame->mouse_left == pArcomageGame->prev_mouse_left; | |
223 this->curr_mouse_right = pArcomageGame->mouse_right; | |
224 this->mouse_right_state_changed = pArcomageGame->mouse_right == pArcomageGame->prev_mouse_right; | |
225 pArcomageGame->prev_mouse_left = pArcomageGame->mouse_left; | |
226 pArcomageGame->prev_mouse_right = pArcomageGame->mouse_right; | |
1183 | 227 return true; |
0 | 228 } |
229 | |
230 //----- (0040DD93) -------------------------------------------------------- | |
1185 | 231 bool stru273::Inside(RECT*pXYZW ) |
232 { | |
233 | |
234 return (x >= pXYZW->left) && (x <= pXYZW->right) && | |
235 (y>= pXYZW->top) && (y <= pXYZW->bottom); | |
0 | 236 } |
237 | |
1184 | 238 //----- (0040DFD1) -------------------------------------------------------- |
1679 | 239 stru272_stru0 *stru272_stru0::New() |
240 { | |
241 stru272_stru0 *v2 = (stru272_stru0 *)malloc(0x5Cu); | |
1184 | 242 v2->signature = SIG_trpg; |
1263 | 243 v2->position_in_sparks_arr = 0; |
1184 | 244 v2->field_30 = 0.0; |
245 v2->field_58 = 0; | |
246 v2->field_59 = 0; | |
1679 | 247 |
248 return v2; | |
249 } | |
1184 | 250 |
251 //----- (0040DFFE) -------------------------------------------------------- | |
1679 | 252 int stru272_stru0::Free() |
1184 | 253 { |
254 | |
255 if ( this->signature == SIG_trpg ) | |
256 { | |
257 this->signature = SIG_xxxx; | |
258 free(this); | |
259 return 0; | |
260 } | |
261 else | |
262 return 2; | |
263 | |
264 } | |
265 | |
266 //----- (0040E01A) -------------------------------------------------------- | |
1263 | 267 int stru272_stru0::StartFill( stru272_stru2* a2 ) |
1184 | 268 { |
1980 | 269 stru272_stru0* a1 = this; |
1184 | 270 if ( a1->signature == SIG_trpg ) |
271 { | |
1186 | 272 a1->field_4 = a2->field_20; |
1263 | 273 a1->field_C = a2->effect_area.left << 16; |
274 a1->field_10 = a2->effect_area.top << 16; | |
275 a1->field_14 = a2->effect_area.right << 16; | |
276 a1->field_18 = a2->effect_area.bottom << 16; | |
1186 | 277 a1->field_1C = a2->field_10; |
278 a1->field_20 = a2->field_14; | |
279 a1->field_24 = a2->field_18; | |
280 a1->field_28 = (float)(a2->field_1Cf * 65536.0); | |
281 a1->field_2C = a2->field_24f; | |
282 a1->field_34 = (int)(a2->field_28f * 65536.0); | |
283 a1->field_38 = (int)(a2->field_2Cf * 65536.0); | |
284 a1->field_3C = a2->field_30; | |
285 a1->field_40 = a2->field_34; | |
1263 | 286 a1->field_54 = a2->sparks_array; |
1184 | 287 a1->field_59 = 1; |
1186 | 288 |
1185 | 289 return 0; |
1184 | 290 } |
291 else | |
1185 | 292 return 2; |
1184 | 293 } |
294 | |
295 //----- (0040E0F5) -------------------------------------------------------- | |
1679 | 296 int stru272_stru0::Clear(char a2, char a3) |
1184 | 297 { |
1185 | 298 if ( signature == SIG_trpg) |
1184 | 299 { |
300 if ( a2 ) | |
301 { | |
1263 | 302 position_in_sparks_arr = 0; |
1185 | 303 field_30 = 0.0; |
1184 | 304 } |
1185 | 305 if ( field_59 && a3 ) |
1184 | 306 { |
1185 | 307 |
308 for (int i=0; i<field_4; ++i) | |
1263 | 309 field_54[i].have_spark = 0; |
1185 | 310 field_58 = 0; |
1184 | 311 } |
1185 | 312 return 0; |
1184 | 313 } |
314 else | |
1185 | 315 return 2; |
1184 | 316 } |
317 | |
318 //----- (0040E133) -------------------------------------------------------- | |
1263 | 319 int stru272_stru0::DrawEffect() |
1184 | 320 { |
1186 | 321 |
1184 | 322 stru272_stru0 *v1; // edi@1 |
323 int v3; // ST18_4@3 | |
324 double v4; // st7@3 | |
325 double v5; // st6@4 | |
326 char v6; // bl@8 | |
1186 | 327 stru272_stru1 *v7; // esi@8 |
1184 | 328 int v8; // ecx@10 |
329 signed int v9; // eax@10 | |
330 int v10; // ecx@10 | |
331 signed int v11; // eax@10 | |
1186 | 332 int v12; // ebx@12 |
333 int v13; // ST1C_4@12 | |
334 int v14; // ebx@12 | |
335 int v15; // ST1C_4@12 | |
336 signed int v16; // edx@12 | |
337 int v17; // ebx@12 | |
338 int v18; // ST1C_4@12 | |
339 signed int v19; // edx@12 | |
340 int v20; // [sp+8h] [bp-10h]@8 | |
341 int v21; // [sp+Ch] [bp-Ch]@8 | |
342 float v22; // [sp+14h] [bp-4h]@3 | |
1184 | 343 |
344 v1 = this; | |
345 if ( this->signature != SIG_trpg ) | |
346 return 2; | |
1263 | 347 v3 = this->position_in_sparks_arr; |
1186 | 348 v22 = this->field_30; |
349 v4 = v3; | |
1184 | 350 if ( v3 > 0 ) |
351 { | |
1186 | 352 v5 = v22 + this->field_2C; |
353 v22 = v5; | |
1184 | 354 if ( v5 > v4 ) |
1186 | 355 v22 = v4; |
1184 | 356 } |
1186 | 357 if ( v22 >= 1.0 || this->field_58 ) |
1184 | 358 { |
359 v6 = 0; | |
1186 | 360 v7 = this->field_54; |
361 v20 = this->field_28; | |
362 v21 = this->field_4; | |
1263 | 363 while ( v7->have_spark <= 0 ) |
1184 | 364 { |
1186 | 365 if ( v22 >= 1.0 ) |
1184 | 366 { |
1186 | 367 v12 = v1->field_40; |
368 v13 = v1->field_3C; | |
1263 | 369 v7->have_spark = rand_interval(v13,v12); |
1186 | 370 v7->field_14 = (rand() % 17 - 8) << 16; |
371 v7->field_18 = (rand() % 17 - 8) << 16; | |
1263 | 372 |
1186 | 373 v14 = v1->field_14 - 1; |
374 v15 = v1->field_C; | |
1263 | 375 v16 = rand_interval(v15,v14); |
1186 | 376 v7->field_C = v16; |
1263 | 377 v7->spark_position.x = v16 >> 16; |
1186 | 378 |
379 v17 = v1->field_18 - 1; | |
380 v18 = v1->field_10; | |
1263 | 381 v19 = rand_interval(v17, v18); |
1186 | 382 v7->field_10 = v19; |
1263 | 383 v7->spark_position.y = v19 >> 16; |
384 --v1->position_in_sparks_arr; | |
385 v22 = v22 - 1.0; | |
1184 | 386 goto LABEL_13; |
387 } | |
388 LABEL_14: | |
1186 | 389 ++v7; |
390 --v21; | |
391 if ( !v21 ) | |
1184 | 392 { |
393 v1->field_58 = v6; | |
1186 | 394 v1->field_30 = v22; |
1184 | 395 return 0; |
396 } | |
397 } | |
1186 | 398 v8 = v7->field_14; |
1263 | 399 --v7->have_spark; |
1186 | 400 v9 = v8 + v7->field_C; |
401 | |
402 v10 = v20 + v7->field_18; | |
403 v7->field_C = v9; | |
1263 | 404 v7->spark_position.x = v9 >> 16; |
1186 | 405 |
406 v11 = v10 + v7->field_10; | |
407 v7->field_18 = v10; | |
408 v7->field_10 = v11; | |
1263 | 409 v7->spark_position.y = v11 >> 16; |
1184 | 410 LABEL_13: |
411 v6 = 1; | |
412 goto LABEL_14; | |
413 } | |
414 return 0; | |
415 } | |
416 | |
417 //----- (0040E2A7) -------------------------------------------------------- | |
418 int stru272_stru0::_40E2A7() | |
419 { | |
1185 | 420 |
421 if (signature == SIG_trpg ) | |
1184 | 422 { |
1263 | 423 if ( position_in_sparks_arr <= 0 ) |
1185 | 424 return field_58 != 0 ? 2 : 0; |
1184 | 425 else |
1185 | 426 return 1; |
1184 | 427 } |
428 else | |
1185 | 429 return 3; |
1184 | 430 } |
0 | 431 |
432 | |
433 //----- (0040DFAF) -------------------------------------------------------- | |
434 void ArcomageGame::OnMouseClick(char right_left, bool bDown) | |
435 { | |
436 if ( right_left ) | |
437 pArcomageGame->mouse_right = bDown; | |
438 else | |
439 pArcomageGame->mouse_left = bDown; | |
440 } | |
441 | |
442 //----- (0040DFC1) -------------------------------------------------------- | |
1532 | 443 void ArcomageGame::OnMouseMove(int x, int y) |
0 | 444 { |
1532 | 445 pArcomageGame->mouse_x = x; |
446 pArcomageGame->mouse_y = y; | |
0 | 447 } |
448 | |
449 | |
450 //----- (0040DF47) -------------------------------------------------------- | |
451 void DoBlt_Copy(unsigned __int16 *pPixels) | |
452 { | |
1183 | 453 RECT pSrcRect; |
454 POINT pTargetPoint; // [sp+1Ch] [bp-8h]@1 | |
455 | |
0 | 456 pRenderer->Present(); |
1183 | 457 |
458 pTargetPoint.x = 0; | |
459 pTargetPoint.y = 0; | |
460 | |
1256 | 461 pSrcRect.left = 0; |
462 pSrcRect.top = 0; | |
463 pSrcRect.right = 640; | |
1183 | 464 pSrcRect.bottom = 480; |
465 | |
0 | 466 pRenderer->BeginScene(); |
1183 | 467 pArcomageGame->pBlit_Copy_pixels = pPixels; |
2154 | 468 pRenderer->am_Blt_Copy(&pSrcRect, &pTargetPoint, 2); |
0 | 469 pRenderer->EndScene(); |
470 pArcomageGame->pBlit_Copy_pixels = 0; | |
471 } | |
472 | |
473 //----- (0040DDC9) -------------------------------------------------------- | |
1183 | 474 void ArcomageGame::PlaySound( unsigned int event_id ) |
475 { | |
476 SoundID play_sound_id; // eax@10 | |
477 | |
478 switch ( event_id ) | |
479 { | |
480 case 40: | |
481 case 43: | |
482 case 46: | |
483 play_sound_id = SOUND_Arcomage_LoseResources; | |
484 break; | |
485 case 39: | |
486 case 41: | |
487 case 42: | |
488 case 44: | |
489 case 45: | |
490 case 47: | |
491 play_sound_id = SOUND_Arcomage_AddResources; | |
492 break; | |
493 case 0: | |
494 case 12: | |
495 case 14: | |
496 case 15: | |
497 case 16: | |
498 case 48: | |
499 case 50: | |
500 case 53: | |
501 play_sound_id = SOUND_Arcomage_TowerWallDamage; | |
502 break; | |
503 case 21: | |
504 case 22: | |
505 case 23: | |
506 play_sound_id = SOUND_Arcomage_DrawCard; | |
507 break; | |
508 case 56: | |
509 play_sound_id = SOUND_Arcomage_124; | |
0 | 510 break; |
1183 | 511 case 31: |
512 case 34: | |
513 case 37: | |
514 play_sound_id = SOUND_Arcomage_ProductionDamage; | |
515 break; | |
516 case 1: | |
517 case 30: | |
518 case 32: | |
519 case 33: | |
520 case 35: | |
521 case 36: | |
522 case 38: | |
523 play_sound_id = SOUND_Arcomage_ProductionUpgrade; | |
524 break; | |
525 case 20: | |
526 play_sound_id = SOUND_Arcomage_127; | |
527 break; | |
528 case 3: | |
529 play_sound_id = SOUND_Arcomage_128; | |
530 break; | |
531 case 52: | |
532 case 54: | |
533 play_sound_id = SOUND_Arcomage_TowerUpgrade; | |
534 break; | |
535 case 10: | |
536 case 11: | |
537 case 13: | |
538 play_sound_id = SOUND_Arcomage_130; | |
539 break; | |
540 case 55u: | |
541 play_sound_id = SOUND_Arcomage_131; | |
542 break; | |
543 case 49: | |
544 case 51: | |
545 play_sound_id = SOUND_Arcomage_WallUpgrade; | |
546 break; | |
547 default: | |
0 | 548 return; |
1183 | 549 } |
550 pAudioPlayer->PlaySound(play_sound_id, 0, 0, -1, 0, 0, 0, 0); | |
0 | 551 } |
552 | |
553 //----- (0040DC2D) -------------------------------------------------------- | |
554 bool ArcomageGame::MsgLoop(int a1, ArcomageGame_stru1 *a2) | |
555 { | |
556 void *v2; // ebp@1 | |
557 BOOL v3; // eax@1 | |
1183 | 558 //int v4; // edx@6 |
559 //int v5; // edx@6 | |
560 //int v6; // eax@6 | |
561 //int v7; // edx@7 | |
0 | 562 |
563 v2 = a2; | |
564 pArcomageGame->field_0 = 0; | |
565 pArcomageGame->stru1.field_0 = 0; | |
566 v3 = PeekMessageA(&pArcomageGame->msg, 0, 0, 0, PM_REMOVE); | |
567 if ( pArcomageGame->msg.message == WM_QUIT ) | |
568 Game_DeinitializeAndTerminate(0); | |
569 if ( v3 > 0 ) | |
570 { | |
571 TranslateMessage(&pArcomageGame->msg); | |
572 DispatchMessageA(&pArcomageGame->msg); | |
573 } | |
1038 | 574 /*if (pAsyncMouse) |
0 | 575 { |
576 EnterCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse); | |
577 v4 = *((unsigned int *)pAsyncMouse + 7); | |
578 pArcomageGame->mouse_x = *((unsigned int *)pAsyncMouse + 6); | |
579 pArcomageGame->mouse_y = v4; | |
580 v5 = *((unsigned int *)pAsyncMouse + 27); | |
581 v6 = *(unsigned int *)v5; | |
582 if ( *(unsigned int *)v5 != v5 ) | |
583 { | |
584 do | |
585 { | |
586 v7 = *(unsigned int *)(v6 + 20); | |
587 if ( v7 & 1 ) | |
588 { | |
589 pArcomageGame->stru1.field_0 = 7; | |
590 } | |
591 else | |
592 { | |
593 if ( v7 & 2 ) | |
594 pArcomageGame->stru1.field_0 = 8; | |
595 } | |
596 v6 = *(unsigned int *)v6; | |
597 } | |
598 while ( v6 != *((unsigned int *)pAsyncMouse + 27) ); | |
599 } | |
600 pAsyncMouse->_46B944(); | |
601 if ( !*((unsigned char *)pAsyncMouse + 90) ) | |
602 pArcomageGame->field_F6 = 1; | |
603 LeaveCriticalSection(&pGame->pThreadWardInstance->csAsyncMouse); | |
1038 | 604 }*/ |
0 | 605 memcpy(v2, &pArcomageGame->stru1, 0xCu); |
606 return pArcomageGame->stru1.field_0 != 0; | |
607 } | |
608 | |
609 | |
610 //----- (0040D7D5) -------------------------------------------------------- | |
611 void am_BeginScene(unsigned __int16 *pPcxPixels, int a2, int a3) | |
612 { | |
613 pRenderer->BeginScene(); | |
1183 | 614 pArcomageGame->pBlit_Copy_pixels = pPcxPixels; |
0 | 615 } |
616 | |
617 //----- (0040D7EC) -------------------------------------------------------- | |
2154 | 618 void Render::am_Blt_Chroma(RECT *pSrcRect, POINT *pTargetPoint, int a3, int blend_mode) |
0 | 619 { |
1183 | 620 |
621 unsigned __int16 *pSrc; // eax@2 | |
2069 | 622 //unsigned __int16 *dest_surf_pos; // edi@3 |
1183 | 623 int uSrcTotalWidth; // ecx@4 |
624 unsigned int v10; // esi@9 | |
625 int v21; // [sp+Ch] [bp-18h]@8 | |
626 unsigned __int16 *src_surf_pos; // [sp+10h] [bp-14h]@9 | |
627 __int32 src_width; // [sp+14h] [bp-10h]@3 | |
628 __int32 src_height; // [sp+18h] [bp-Ch]@3 | |
629 int uSrcPitch; // [sp+1Ch] [bp-8h]@5 | |
630 | |
631 | |
2154 | 632 if ( !uNumSceneBegins ) |
1183 | 633 return; |
634 if ( !pArcomageGame->pBlit_Copy_pixels ) | |
0 | 635 return; |
1183 | 636 |
2069 | 637 //dest_surf_pos = &pRenderer->pTargetSurface[pTargetPoint->x + pTargetPoint->y * pRenderer->uTargetSurfacePitch]; |
1183 | 638 src_width = pSrcRect->right - pSrcRect->left; |
639 src_height = pSrcRect->bottom - pSrcRect->top; | |
640 | |
641 if ( pArcomageGame->pBlit_Copy_pixels == pArcomageGame->pBackgroundPixels ) | |
642 uSrcTotalWidth = pArcomageGame->pGameBackground.uWidth; | |
643 else if ( pArcomageGame->pBlit_Copy_pixels == pArcomageGame->pSpritesPixels ) | |
644 uSrcTotalWidth = pArcomageGame->pSprites.uWidth; | |
645 | |
646 //v20 = 157; | |
647 //v19 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\am_nw.cpp"; | |
648 //v21 = &v18; | |
649 //std__string_char_40E2C8(&v18, "Problem in Blit_Chroma", &a3a); | |
650 //466D09_xcpt_string(&v21, v18, v19, v20); | |
651 //pSrc = pArcomageGame.pBlit_Copy_pixels; | |
652 //LABEL_9: | |
653 pSrc = pArcomageGame->pBlit_Copy_pixels; | |
654 uSrcPitch = uSrcTotalWidth; | |
655 | |
656 src_surf_pos = &pSrc[pSrcRect->left + uSrcPitch * pSrcRect->top]; | |
2154 | 657 v10 = 0xFFu >> (8 - (unsigned __int8)uTargetBBits); |
658 v21 = (uTargetGBits != 6 ? 0x31EF : 0x7BEF); | |
1183 | 659 |
660 | |
661 if ( blend_mode == 2 ) | |
0 | 662 { |
1194 | 663 uSrcPitch = (uSrcPitch - src_width); |
1183 | 664 for (int i=0; i< src_height; ++i) |
665 { | |
666 for (int j=0; j< src_width; ++j) | |
667 { | |
668 if ( *src_surf_pos != v10 ) | |
2154 | 669 WritePixel16(pTargetPoint->x + j, pTargetPoint->y + i, *src_surf_pos); |
2069 | 670 //*dest_surf_pos = *src_surf_pos; |
671 //++dest_surf_pos; | |
1183 | 672 ++src_surf_pos; |
673 } | |
674 src_surf_pos+=uSrcPitch; | |
2069 | 675 //dest_surf_pos += pRenderer->uTargetSurfacePitch - src_width; |
1183 | 676 } |
0 | 677 } |
1183 | 678 else |
0 | 679 { |
1194 | 680 uSrcPitch = (uSrcPitch - src_width); |
1183 | 681 for (int i=0; i< src_height; ++i) |
0 | 682 { |
1183 | 683 for (int j=0; j< src_width; ++j) |
0 | 684 { |
1183 | 685 if ( *src_surf_pos != v10 ) |
2154 | 686 WritePixel16(pTargetPoint->x + j, pTargetPoint->y + i, (v21 & (ReadPixel16(pTargetPoint->x + j, pTargetPoint->y + i) >> 1)) + (v21 & (*src_surf_pos >> 1))); |
2069 | 687 //*dest_surf_pos = (v21 & (*dest_surf_pos >> 1)) + (v21 & (*src_surf_pos >> 1)); |
688 //++dest_surf_pos; | |
1183 | 689 ++src_surf_pos; |
0 | 690 } |
1183 | 691 src_surf_pos+=uSrcPitch; |
2069 | 692 //dest_surf_pos += pRenderer->uTargetSurfacePitch - src_width; |
0 | 693 } |
694 } | |
1183 | 695 |
0 | 696 } |
697 | |
698 //----- (0040D9B1) -------------------------------------------------------- | |
2154 | 699 void Render::am_Blt_Copy( RECT *pSrcRect, POINT *pTargetPoint, int blend_mode ) |
0 | 700 { |
1183 | 701 |
702 unsigned __int16 *pSrc; // eax@2 | |
2069 | 703 //unsigned __int16 *dest_surf_pos; // edi@3 |
1183 | 704 int uSrcTotalWidth; // ecx@4 |
705 int v21; // [sp+Ch] [bp-18h]@8 | |
706 unsigned __int16 *src_surf_pos; // [sp+10h] [bp-14h]@9 | |
707 __int32 src_width; // [sp+14h] [bp-10h]@3 | |
708 __int32 src_height; // [sp+18h] [bp-Ch]@3 | |
709 int uSrcPitch; // [sp+1Ch] [bp-8h]@5 | |
710 | |
2154 | 711 if ( !uNumSceneBegins ) |
1183 | 712 return; |
713 if ( !pArcomageGame->pBlit_Copy_pixels ) | |
714 return; | |
715 | |
2069 | 716 //dest_surf_pos = &pRenderer->pTargetSurface[pTargetPoint->x + pTargetPoint->y * pRenderer->uTargetSurfacePitch]; |
1183 | 717 src_width = pSrcRect->right - pSrcRect->left; |
718 src_height = pSrcRect->bottom - pSrcRect->top; | |
719 | |
720 if ( pArcomageGame->pBlit_Copy_pixels == pArcomageGame->pBackgroundPixels ) | |
721 uSrcTotalWidth = pArcomageGame->pGameBackground.uWidth; | |
722 else if ( pArcomageGame->pBlit_Copy_pixels == pArcomageGame->pSpritesPixels ) | |
723 uSrcTotalWidth = pArcomageGame->pSprites.uWidth; | |
724 | |
725 //v20 = 157; | |
726 //v19 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\am_nw.cpp"; | |
727 //v21 = &v18; | |
728 //std__string_char_40E2C8(&v18, "Problem in Blit_Chroma", &a3a); | |
729 //466D09_xcpt_string(&v21, v18, v19, v20); | |
730 //pSrc = pArcomageGame.pBlit_Copy_pixels; | |
731 //LABEL_9: | |
732 pSrc = pArcomageGame->pBlit_Copy_pixels; | |
733 uSrcPitch = uSrcTotalWidth; | |
734 | |
735 src_surf_pos = &pSrc[pSrcRect->left + uSrcPitch * pSrcRect->top]; | |
2154 | 736 v21 = (uTargetGBits != 6 ? 0x31EF : 0x7BEF); |
1183 | 737 |
738 if ( blend_mode == 2 ) | |
0 | 739 { |
1194 | 740 uSrcPitch = (uSrcPitch - src_width); |
1183 | 741 for (int i=0; i< src_height; ++i) |
742 { | |
743 for (int j=0; j< src_width; ++j) | |
2069 | 744 { |
2154 | 745 WritePixel16(pTargetPoint->x + j, pTargetPoint->y + i, *src_surf_pos); |
2069 | 746 //*dest_surf_pos = *src_surf_pos; |
747 //++dest_surf_pos; | |
1183 | 748 ++src_surf_pos; |
749 } | |
750 src_surf_pos+=uSrcPitch; | |
2069 | 751 //dest_surf_pos += pRenderer->uTargetSurfacePitch - src_width; |
1183 | 752 } |
0 | 753 } |
1183 | 754 else |
0 | 755 { |
1194 | 756 uSrcPitch = (uSrcPitch - src_width); |
1183 | 757 for (int i=0; i< src_height; ++i) |
0 | 758 { |
1183 | 759 for (int j=0; j< src_width; ++j) |
760 { | |
2069 | 761 //*dest_surf_pos = (v21 & (*dest_surf_pos >> 1)) + (v21 & (*src_surf_pos >> 1)); |
762 //++dest_surf_pos; | |
2154 | 763 WritePixel16(pTargetPoint->x + j, pTargetPoint->y + i, (v21 & (ReadPixel16(pTargetPoint->x + j, pTargetPoint->y + i) >> 1)) + (v21 & (*src_surf_pos >> 1))); |
1183 | 764 ++src_surf_pos; |
765 } | |
766 src_surf_pos+=uSrcPitch; | |
2069 | 767 //dest_surf_pos += pRenderer->uTargetSurfacePitch - src_width; |
0 | 768 } |
769 } | |
770 } | |
771 | |
772 //----- (0040DB10) -------------------------------------------------------- | |
2154 | 773 void am_EndScene() |
0 | 774 { |
775 pRenderer->EndScene(); | |
1183 | 776 pArcomageGame->pBlit_Copy_pixels = NULL; |
0 | 777 } |
778 | |
779 //----- (0040D7B7) -------------------------------------------------------- | |
780 bool ArcomageGame::LoadSprites() | |
781 { | |
782 pArcomageGame->pSprites.Load("sprites.pcx", 2); | |
783 pArcomageGame->pSpritesPixels = pArcomageGame->pSprites.pPixels; | |
1183 | 784 return true; |
0 | 785 } |
786 | |
787 //----- (0040D799) -------------------------------------------------------- | |
788 bool ArcomageGame::LoadBackground() | |
789 { | |
790 pArcomageGame->pGameBackground.Load("layout.pcx", 2); | |
791 pArcomageGame->pBackgroundPixels = pArcomageGame->pGameBackground.pPixels; | |
1183 | 792 return true; |
0 | 793 } |
794 | |
1256 | 795 int CalculateCardPower(ArcomagePlayer* player, ArcomagePlayer* enemy, ArcomageCard* pCard, int mastery) |
796 { | |
797 enum V_INDX{ | |
798 P_TOWER_M10, | |
799 P_WALL_M10, | |
800 E_TOWER, | |
801 E_WALL, | |
802 E_BUILDINGS, | |
803 E_QUARRY, | |
804 E_MAGIC, | |
805 E_ZOO, | |
806 E_RES, | |
807 V_INDEX_MAX | |
808 }; | |
809 | |
810 const int mastery_coeff[V_INDEX_MAX][2]= {{10, 5}, //P_TOWER_M10 | |
811 {2, 1}, //P_WALL_M10 | |
812 {1, 10}, //E_TOWER | |
813 {1, 3}, //E_WALL | |
814 {1, 7}, //E_BUILDINGS | |
815 {1, 5}, //E_QUARRY | |
816 {1, 40}, //E_MAGIC | |
817 {1, 40}, //E_ZOO | |
818 {1, 2} //E_RES | |
819 }; | |
820 int card_power= 0; | |
821 int element_power; | |
822 | |
823 | |
824 if ( pCard->to_player_tower == 99 || pCard->to_pl_enm_tower == 99|| | |
825 pCard->to_player_tower2 == 99 || pCard->to_pl_enm_tower2 == 99 ) | |
826 element_power = enemy->tower_height - player->tower_height; | |
827 else | |
828 element_power = pCard->to_player_tower + pCard->to_pl_enm_tower + pCard->to_player_tower2 + pCard->to_pl_enm_tower2; | |
829 | |
830 if ( player->tower_height >= 10 ) | |
831 card_power += mastery_coeff[P_TOWER_M10][mastery]*element_power; | |
832 else | |
833 card_power += 20*element_power; | |
834 | |
835 | |
836 if ( pCard->to_player_wall == 99 || pCard->to_pl_enm_wall == 99 || | |
837 pCard->to_player_wall2 == 99 || pCard->to_pl_enm_wall2 == 99 ) | |
838 element_power = enemy->wall_height - player->wall_height; | |
839 else | |
840 element_power = pCard->to_player_wall + pCard->to_pl_enm_wall + | |
841 pCard->to_player_wall2 + pCard->to_pl_enm_wall2; | |
842 if ( player->wall_height >= 10 ) | |
843 card_power += mastery_coeff[P_WALL_M10][mastery]*element_power; //1 | |
844 else | |
845 card_power += 5*element_power; | |
846 | |
847 | |
848 card_power += 7 * (pCard->to_player_buildings + pCard->to_pl_enm_buildings + | |
849 pCard->to_player_buildings2 + pCard->to_pl_enm_buildings2); | |
850 | |
851 if ( pCard->to_player_quarry_lvl == 99 || pCard->to_pl_enm_quarry_lvl == 99 || | |
852 pCard->to_player_quarry_lvl2 == 99 || pCard->to_pl_enm_quarry_lvl2 == 99 ) | |
853 element_power = enemy->quarry_level - player->quarry_level; | |
854 else | |
855 element_power = pCard->to_player_quarry_lvl + pCard->to_pl_enm_quarry_lvl + | |
856 pCard->to_player_quarry_lvl2 + pCard->to_pl_enm_quarry_lvl; | |
857 | |
858 card_power += 40 * element_power; | |
859 | |
860 if ( pCard->to_player_magic_lvl == 99 || pCard->to_pl_enm_magic_lvl == 99 || | |
861 pCard->to_player_magic_lvl2 == 99 || pCard->to_pl_enm_magic_lvl2 == 99 ) | |
862 element_power = enemy->magic_level - player->magic_level; | |
863 else | |
864 element_power = pCard->to_player_magic_lvl + pCard->to_pl_enm_magic_lvl + | |
865 pCard->to_player_magic_lvl2 + pCard->to_pl_enm_magic_lvl2; | |
866 card_power += 40 *element_power; | |
867 | |
868 if ( pCard->to_player_zoo_lvl == 99 || pCard->to_pl_enm_zoo_lvl == 99 || | |
869 pCard->to_player_zoo_lvl2 == 99 || pCard->to_pl_enm_zoo_lvl2 == 99 ) | |
870 element_power = enemy->zoo_level - player->zoo_level; | |
871 else | |
872 element_power = pCard->to_player_zoo_lvl + pCard->to_pl_enm_zoo_lvl + | |
873 pCard->to_player_zoo_lvl2 + pCard->to_pl_enm_zoo_lvl2; | |
874 card_power += 40 *element_power; | |
875 | |
876 if ( pCard->to_player_bricks == 99 || pCard->to_pl_enm_bricks == 99 || | |
877 pCard->to_player_bricks2 == 99 || pCard->to_pl_enm_bricks2 == 99 ) | |
878 element_power = enemy->resource_bricks - player->resource_bricks; | |
879 else | |
880 element_power = pCard->to_player_bricks + pCard->to_pl_enm_bricks + | |
881 pCard->to_player_bricks2 + pCard->to_pl_enm_bricks2; | |
882 card_power += 2 *element_power; | |
883 | |
884 | |
885 if ( pCard->to_player_gems == 99 || pCard->to_pl_enm_gems == 99 || | |
886 pCard->to_player_gems2 == 99 || pCard->to_pl_enm_gems2 == 99 ) | |
887 element_power = enemy->resource_gems - player->resource_gems; | |
888 else | |
889 element_power = pCard->to_player_gems + pCard->to_pl_enm_gems + | |
890 pCard->to_player_gems2 + pCard->to_pl_enm_gems2; | |
891 card_power += 2 *element_power; | |
892 | |
893 if ( pCard->to_player_beasts == 99 || pCard->to_pl_enm_beasts == 99 || | |
894 pCard->to_player_beasts2 == 99 || pCard->to_pl_enm_beasts2 == 99 ) | |
895 element_power = enemy->resource_beasts - player->resource_beasts; | |
896 else | |
897 element_power = pCard->to_player_beasts + pCard->to_pl_enm_beasts + | |
898 pCard->to_player_beasts2 + pCard->to_pl_enm_beasts2; | |
899 card_power += 2 *element_power; | |
900 | |
901 if ( pCard->to_enemy_tower == 99 || pCard->to_enemy_tower2 == 99 ) | |
902 element_power = player->tower_height - enemy->tower_height; | |
903 else | |
904 element_power = -(pCard->to_enemy_tower + pCard->to_enemy_tower2); | |
905 card_power += mastery_coeff[E_TOWER][mastery]*element_power; | |
906 | |
907 if ( pCard->to_enemy_wall == 99 || pCard->to_enemy_wall2 == 99 ) | |
908 element_power = player->wall_height - enemy->wall_height; | |
909 else | |
910 element_power = -(pCard->to_enemy_wall + pCard->to_enemy_wall2); | |
911 card_power += mastery_coeff[E_WALL][mastery]*element_power; | |
912 | |
913 card_power -= mastery_coeff[E_BUILDINGS][mastery]*(pCard->to_enemy_buildings + pCard->to_enemy_buildings2); | |
914 | |
915 if ( pCard->to_enemy_quarry_lvl == 99 || pCard->to_enemy_quarry_lvl2 == 99 ) | |
916 element_power = player->quarry_level - enemy->quarry_level; //5 | |
917 else | |
918 element_power = -(pCard->to_enemy_quarry_lvl + pCard->to_enemy_quarry_lvl2); //5 | |
919 card_power += mastery_coeff[E_QUARRY][mastery]*element_power; | |
920 | |
921 if ( pCard->to_enemy_magic_lvl == 99 || pCard->to_enemy_magic_lvl2 == 99 ) | |
922 element_power = player->magic_level - enemy->magic_level; //40 | |
923 else | |
924 element_power = -(pCard->to_enemy_magic_lvl + pCard->to_enemy_magic_lvl2); | |
925 card_power += mastery_coeff[E_MAGIC][mastery]*element_power; | |
926 | |
927 if ( pCard->to_enemy_zoo_lvl == 99 || pCard->to_enemy_zoo_lvl2 == 99 ) | |
928 element_power = player->zoo_level - enemy->zoo_level; //40 | |
929 else | |
930 element_power = -(pCard->to_enemy_zoo_lvl + pCard->to_enemy_zoo_lvl2); | |
931 card_power += mastery_coeff[E_ZOO][mastery]*element_power; | |
932 | |
933 if ( pCard->to_enemy_bricks == 99 || pCard->to_enemy_bricks2 == 99 ) | |
934 element_power = player->resource_bricks - enemy->resource_bricks; //2 | |
935 else | |
936 element_power = -(pCard->to_enemy_bricks + pCard->to_enemy_bricks2); | |
937 card_power += mastery_coeff[E_RES][mastery]*element_power; | |
938 | |
939 if ( pCard->to_enemy_gems == 99 || pCard->to_enemy_gems2 == 99 ) | |
940 element_power = player->resource_gems - enemy->resource_gems; //2 | |
941 else | |
942 element_power = -(pCard->to_enemy_gems + pCard->to_enemy_gems2); | |
943 card_power += mastery_coeff[E_RES][mastery]*element_power; | |
944 | |
945 if ( pCard->to_enemy_beasts == 99 || pCard->to_enemy_beasts2 == 99 ) | |
946 element_power = player->resource_beasts - enemy->resource_beasts; //2 | |
947 else | |
948 element_power = -(pCard->to_enemy_beasts + pCard->to_enemy_beasts2); | |
949 card_power += mastery_coeff[E_RES][mastery]*element_power; | |
950 | |
951 if ( pCard->field_30 || pCard->field_4D ) | |
952 card_power *= 10; | |
953 | |
954 if ( pCard->field_24 == 1 ) | |
955 element_power = player->resource_bricks - pCard->needed_bricks; | |
956 else if ( pCard->field_24 == 2 ) | |
957 element_power = player->resource_gems - pCard->needed_gems; | |
958 else if (pCard->field_24 == 3) | |
959 element_power = player->resource_beasts - pCard->needed_beasts; | |
960 if ( element_power > 3 ) | |
961 element_power = 3; | |
962 card_power += 5 * element_power; | |
963 | |
964 if ( enemy->tower_height <= pCard->to_enemy_tower2 + pCard->to_enemy_tower ) | |
965 card_power += 9999; | |
966 | |
967 if (pCard->to_enemy_tower2 + pCard->to_enemy_tower + | |
968 pCard->to_enemy_wall + pCard->to_enemy_wall2 + | |
969 pCard->to_enemy_buildings + pCard->to_enemy_buildings2 >= enemy->wall_height + enemy->tower_height) | |
970 card_power += 9999; | |
971 | |
972 if ( (pCard->to_player_tower2 + pCard->to_pl_enm_tower2 + | |
973 pCard->to_player_tower + pCard->to_pl_enm_tower + player->tower_height) >= max_tower_height ) | |
974 card_power += 9999; | |
975 | |
976 return card_power; | |
977 } | |
978 | |
979 | |
0 | 980 //----- (00408BB4) -------------------------------------------------------- |
1256 | 981 bool OpponentsAITurn(int player_num) |
0 | 982 { |
1256 | 983 char result; // al@3 |
984 signed int v2; // ebx@8 | |
985 int v3; // esi@8 | |
986 int all_player_cards_count; // eax@9 | |
987 int random_card_slot; // edi@9 | |
988 int v6; // eax@11 | |
989 signed int v7; // eax@11 | |
990 int v8; // ebx@5 | |
991 int v9; // eax@5 | |
992 int v10; // ecx@18 | |
993 int v11; // eax@20 | |
994 ArcomageCard *v12; // ecx@20 | |
995 char v13; // dl@20 | |
996 char v14; // dl@24 | |
997 int v15; // edx@25 | |
998 int v16; // edx@27 | |
999 char v17; // dl@31 | |
1000 int v18; // edx@32 | |
1001 char v19; // dl@35 | |
1002 char v20; // dl@39 | |
1003 int v21; // edx@40 | |
1004 char v22; // dl@45 | |
1005 int v23; // edx@46 | |
1006 char v24; // dl@52 | |
1007 int v25; // edx@53 | |
1008 char v26; // dl@58 | |
1009 int v27; // edx@59 | |
1010 char v28; // dl@64 | |
1011 int v29; // edx@65 | |
1012 char v30; // dl@70 | |
1013 int v31; // edx@71 | |
1014 char v32; // dl@76 | |
1015 int v33; // edx@77 | |
1016 char v34; // dl@82 | |
1017 int v35; // edx@83 | |
1018 char v36; // dl@86 | |
1019 char v37; // dl@90 | |
1020 int v38; // edi@93 | |
1021 char v39; // dl@93 | |
1022 int v40; // esi@93 | |
1023 char v41; // bl@94 | |
1024 char v42; // dl@98 | |
1025 char v43; // dl@102 | |
1026 char v44; // dl@106 | |
1027 char v45; // dl@110 | |
1028 char v46; // dl@114 | |
1029 ArcomagePlayer *v47; // ebx@115 | |
1030 ArcomagePlayer *v48; // edx@115 | |
1031 int v49; // esi@123 | |
1032 int v50; // edx@123 | |
1033 int v51; // edx@126 | |
1034 int v52; // esi@129 | |
1035 int v53; // edi@137 | |
1036 int j; // esi@137 | |
1037 am_2 *v55; // eax@139 | |
1038 int v56; // ecx@141 | |
1039 int v57; // edx@141 | |
1040 int v58; // ebx@141 | |
1041 int v59; // eax@144 | |
1042 int v60; // esi@145 | |
1043 int v61; // ebx@4 | |
1044 int v62; // eax@4 | |
1045 int v63; // ecx@167 | |
1046 int v64; // eax@169 | |
1047 ArcomageCard *pCard; // ecx@169 | |
1048 char v66; // dl@169 | |
1049 char v67; // dl@173 | |
1050 int v68; // edx@174 | |
1051 int v69; // edx@176 | |
1052 char v70; // dl@180 | |
1053 char v71; // dl@183 | |
1054 char v72; // dl@187 | |
1055 int v73; // edx@188 | |
1056 char v74; // dl@193 | |
1057 char v75; // dl@199 | |
1058 int v76; // edx@200 | |
1059 char v77; // dl@205 | |
1060 int v78; // edx@206 | |
1061 char v79; // dl@211 | |
1062 int v80; // edx@212 | |
1063 char v81; // dl@217 | |
1064 int v82; // edx@218 | |
1065 char v83; // dl@223 | |
1066 int v84; // edx@224 | |
1067 char v85; // dl@229 | |
1068 int v86; // edx@230 | |
1069 char v87; // dl@233 | |
1070 int v88; // edx@234 | |
1071 char v89; // dl@237 | |
1072 int v90; // edx@238 | |
1073 int v91; // esi@240 | |
1074 char v92; // dl@240 | |
1075 int v93; // esi@240 | |
1076 char v94; // bl@241 | |
1077 int v95; // edx@243 | |
1078 int v96; // edi@244 | |
1079 char v97; // dl@245 | |
1080 int v98; // edx@246 | |
1081 char v99; // dl@249 | |
1082 int v100; // edx@250 | |
1083 char v101; // dl@253 | |
1084 int v102; // edx@254 | |
1085 char v103; // dl@257 | |
1086 int v104; // edx@258 | |
1087 char v105; // dl@261 | |
1088 ArcomagePlayer *v106; // ebx@262 | |
1089 ArcomagePlayer *v107; // edx@262 | |
1090 int v108; // esi@270 | |
1091 int v109; // edx@270 | |
1092 int v110; // edx@273 | |
1093 int v111; // esi@276 | |
1094 int v112; // edi@284 | |
1095 // int j; // esi@284 | |
1096 am_2 *v114; // eax@286 | |
1097 int v115; // ecx@288 | |
1098 int v116; // edx@288 | |
1099 int v117; // ebx@288 | |
1100 int v118; // eax@291 | |
1101 int v119; // esi@292 | |
1102 int v120; // [sp-28h] [bp-28h]@129 | |
1103 int v121; // [sp-28h] [bp-28h]@276 | |
1104 int k; // [sp-24h] [bp-24h]@18 | |
1105 int i; // [sp-24h] [bp-24h]@167 | |
1106 int v124; // [sp-20h] [bp-20h]@5 | |
1107 int v125; // [sp-20h] [bp-20h]@4 | |
1108 int v126; // [sp-1Ch] [bp-1Ch]@17 | |
1109 int v127; // [sp-1Ch] [bp-1Ch]@139 | |
1110 int v128; // [sp-1Ch] [bp-1Ch]@166 | |
1111 int v129; // [sp-1Ch] [bp-1Ch]@286 | |
1112 int v130; // [sp-18h] [bp-18h]@5 | |
1113 int cards_count; // [sp-18h] [bp-18h]@4 | |
1114 int v132; // [sp-14h] [bp-14h]@0 | |
1115 int v133; // [sp-14h] [bp-14h]@93 | |
1116 int v134; // [sp-14h] [bp-14h]@129 | |
1117 int v135; // [sp-14h] [bp-14h]@240 | |
1118 int v136; // [sp-14h] [bp-14h]@276 | |
1119 ArcomagePlayer *enemy; // [sp-10h] [bp-10h]@5 | |
1120 ArcomagePlayer *enemy1; // [sp-10h] [bp-10h]@4 | |
1121 ArcomagePlayer *player; // [sp-Ch] [bp-Ch]@5 | |
1122 ArcomagePlayer *player1; // [sp-Ch] [bp-Ch]@4 | |
1123 char v141; // [sp-8h] [bp-8h]@35 | |
1124 char v142; // [sp-8h] [bp-8h]@183 | |
1125 char v143; // [sp-5h] [bp-5h]@20 | |
1126 char v144; // [sp-5h] [bp-5h]@169 | |
1127 | |
1128 byte_4FAA00 = 1; | |
1129 if ( opponent_mastery == 0) | |
1130 { | |
1263 | 1131 if ( need_to_discard_card==0 ) //am_byte_4FAA77 |
1256 | 1132 { |
1133 for(int i = 0; i<10 ; ++i ) | |
1134 { | |
1135 all_player_cards_count = GetPlayerHandCardCount(player_num); | |
1136 random_card_slot = rand_interval(0, all_player_cards_count - 1); | |
1137 if ( CanCardBePlayed(player_num, random_card_slot) ) | |
1138 return PlayCard(player_num, random_card_slot); | |
1139 } | |
1140 } | |
1141 all_player_cards_count = GetPlayerHandCardCount(player_num); | |
1142 random_card_slot= rand_interval(0, all_player_cards_count - 1); | |
1143 return DiscardCard(player_num, random_card_slot); | |
1144 } | |
1145 else if (( opponent_mastery == 1 )|| ( opponent_mastery == 2 )) | |
1146 { | |
1147 player = &am_Players[player_num]; | |
1148 enemy = &am_Players[(player_num + 1) % 2]; | |
1149 all_player_cards_count = GetPlayerHandCardCount(player_num); | |
1150 for(int i = 0; i<10 ; ++i ) | |
1151 { | |
1152 if ( i >= all_player_cards_count ) | |
1153 { | |
1263 | 1154 cards_power[i].slot_index = -1; |
1155 cards_power[i].card_power = -9999; | |
1256 | 1156 } |
1157 else | |
1158 { | |
1263 | 1159 cards_power[i].slot_index = i; |
1160 cards_power[i].card_power = 0; | |
1256 | 1161 } |
1162 } | |
1163 for(int i = 0; i< all_player_cards_count ; ++i ) | |
1164 { | |
1263 | 1165 v12 = &pCards[am_Players[player_num].cards_at_hand[cards_power[i].slot_index]]; |
1166 cards_power[i].card_power = CalculateCardPower(player, enemy, v12, opponent_mastery-1); | |
1256 | 1167 } |
1168 | |
1169 for (int j = all_player_cards_count - 1; j >= 0; --j ) | |
1170 { | |
1171 for (int m=0; m<j; ++m ) | |
1172 { | |
1263 | 1173 if ( cards_power[m].card_power < cards_power[m+1].card_power ) |
1256 | 1174 { |
1263 | 1175 v56 = cards_power[m].slot_index; |
1176 v57 = cards_power[m].card_power; | |
1177 cards_power[m].slot_index = cards_power[m+1].slot_index; | |
1178 cards_power[m].card_power = cards_power[m+1].card_power; | |
1179 cards_power[m+1].slot_index = v56; | |
1180 cards_power[m+1].card_power = v57; | |
1256 | 1181 } |
1182 } | |
1183 } | |
1184 v59 = all_player_cards_count - 1; | |
1263 | 1185 if ( need_to_discard_card ) |
1256 | 1186 { |
1187 if ( all_player_cards_count - 1 >= 0 ) | |
1188 { | |
1263 | 1189 while ( !pCards[am_Players[player_num].cards_at_hand[cards_power[v59].slot_index]].can_be_discarded ) |
1256 | 1190 { |
1191 --v59; | |
1192 if ( v59 < 0 ) | |
1193 return DiscardCard(player_num, v132); | |
1194 } | |
1263 | 1195 v132 = cards_power[v59].slot_index; |
1256 | 1196 } |
1197 } | |
1198 else | |
1199 { | |
1200 v60 = 0; | |
1201 if ( all_player_cards_count - 1 >= 0 ) | |
1202 { | |
1263 | 1203 while ( !pCards[am_Players[player_num].cards_at_hand[cards_power[v59].slot_index]].can_be_discarded ) |
1256 | 1204 { |
1205 --v59; | |
1206 if ( v59 < 0 ) | |
1207 goto LABEL_150; | |
1208 } | |
1263 | 1209 v132 = cards_power[v59].slot_index; |
1256 | 1210 } |
1211 LABEL_150: | |
1263 | 1212 if ( (all_player_cards_count - 1)> 0 ) |
1256 | 1213 { |
1263 | 1214 while ( !CanCardBePlayed(player_num, cards_power[v60].slot_index) || cards_power[v60].card_power < 0 ) |
1256 | 1215 { |
1216 ++v60; | |
1263 | 1217 if ( v60 >= all_player_cards_count - 1 ) |
1256 | 1218 return DiscardCard(player_num, v132); |
1219 } | |
1263 | 1220 return PlayCard(player_num, cards_power[v60].slot_index); |
1256 | 1221 } |
1222 } | |
1223 return DiscardCard(player_num, v132); | |
1224 } | |
1225 | |
1226 | |
1183 | 1227 return true;//result != 0; |
0 | 1228 } |
1229 | |
1230 | |
1231 | |
1232 //----- (00409E6A) -------------------------------------------------------- | |
1233 void ArcomageGame::Loop() | |
1234 { | |
1235 int v0; // edx@2 | |
1236 int v1; // ecx@14 | |
1237 signed int v2; // eax@15 | |
1238 stru272 *v3; // esi@17 | |
1239 __int16 *v4; // esi@23 | |
1240 | |
1197 | 1241 while ( !pArcomageGame->GameOver ) |
0 | 1242 { |
1243 pArcomageGame->field_F6 = 1; | |
1244 byte_4FAA24 = 1; | |
1197 | 1245 IncreaseResourcesInTurn(current_player_num); |
0 | 1246 LABEL_8: |
1185 | 1247 while ( byte_4FAA24 ) |
0 | 1248 { |
1200 | 1249 played_card_id = -1; |
1250 GetNextCardFromDeck(current_player_num); | |
0 | 1251 while ( 1 ) |
1252 { | |
1256 | 1253 byte_4FAA24 = PlayerTurn(current_player_num); |
1200 | 1254 if ( GetPlayerHandCardCount(current_player_num) <= minimum_cards_at_hand ) |
0 | 1255 break; |
1263 | 1256 need_to_discard_card = 1; |
0 | 1257 if ( pArcomageGame->field_F4 ) |
1258 goto LABEL_8; | |
1259 } | |
1263 | 1260 need_to_discard_card = 0; |
1185 | 1261 } |
1197 | 1262 pArcomageGame->GameOver = IsGameOver(); |
1263 if ( !pArcomageGame->GameOver ) | |
1256 | 1264 TurnChange(); |
0 | 1265 if ( pArcomageGame->field_F4 ) |
1197 | 1266 pArcomageGame->GameOver = 1; |
0 | 1267 } |
1197 | 1268 GameResultsApply(); |
1679 | 1269 if ( am_gameover ) |
0 | 1270 { |
1183 | 1271 dword_4FAA70 = 0; |
0 | 1272 } |
1273 else | |
1274 { | |
1275 dword_4FAA70 = -1; | |
1276 } | |
1183 | 1277 |
1184 | 1278 for(int i=0; i<10; ++i) |
1679 | 1279 { |
1280 array_4FABD0[i].field_40->Clear(1, 1); | |
1281 array_4FABD0[i].field_40->Free(); | |
1282 } | |
1038 | 1283 |
0 | 1284 pArcomageGame->pGameBackground.Release(); |
1285 pArcomageGame->pSprites.Release(); | |
1679 | 1286 pArcomageGame->bGameInProgress = false; |
1287 viewparams->bRedrawGameUI = true; | |
0 | 1288 if ( pVideoPlayer->AnyMovieLoaded() ) |
1289 pVideoPlayer->_4BF5B2(); | |
1183 | 1290 for(int i=0; i<12; ++i) |
1291 pSoundList->UnloadSound(am_sounds[i], 1); | |
0 | 1292 } |
938 | 1293 |
1294 | |
1295 | |
0 | 1296 |
1297 //----- (00409FE9) -------------------------------------------------------- | |
1197 | 1298 void SetStartGameData() |
1679 | 1299 { |
1194 | 1300 signed int j; // edx@7 |
1301 int card_id_counter; // edx@13 | |
1302 signed int i; // ecx@13 | |
1303 signed int card_dispenser_counter; // eax@13 | |
0 | 1304 |
2154 | 1305 current_player_num = am_default_starting_player; |
1197 | 1306 SetStartConditions(); |
1194 | 1307 for(i=0; i<2; ++i ) |
0 | 1308 { |
1194 | 1309 if ( i ) |
0 | 1310 { |
1194 | 1311 strcpy(am_Players[1].pPlayerName, pArcomageGame->pPlayer2Name); |
0 | 1312 if ( byte_4E185C ) |
1197 | 1313 am_Players[1].IsHisTurn = 0; |
0 | 1314 else |
1197 | 1315 am_Players[1].IsHisTurn = 1; |
0 | 1316 } |
1317 else | |
1318 { | |
1194 | 1319 strcpy(am_Players[0].pPlayerName, pArcomageGame->pPlayer1Name); |
1197 | 1320 am_Players[0].IsHisTurn = 1; |
0 | 1321 } |
1200 | 1322 am_Players[i].tower_height = start_tower_height; |
1323 am_Players[i].wall_height = start_wall_height; | |
1324 am_Players[i].quarry_level = start_quarry_level; | |
1325 am_Players[i].magic_level = start_magic_level; | |
1326 am_Players[i].zoo_level = start_zoo_level; | |
1197 | 1327 am_Players[i].resource_bricks = start_bricks_amount; |
1328 am_Players[i].resource_gems = start_gems_amount; | |
1329 am_Players[i].resource_beasts = start_beasts_amount; | |
1194 | 1330 |
1331 for (j=0; j<10; ++j ) | |
0 | 1332 { |
1194 | 1333 am_Players[i].cards_at_hand[j] = -1; |
0 | 1334 if ( am_byte_4E185D ) |
1335 { | |
1256 | 1336 am_Players[i].card_shift[j].x = -1; |
1337 am_Players[i].card_shift[j].y = -1; | |
0 | 1338 } |
1339 else | |
1340 { | |
1256 | 1341 am_Players[i].card_shift[j].x = 0; |
1342 am_Players[i].card_shift[j].y = 0; | |
0 | 1343 } |
1263 | 1344 } |
0 | 1345 } |
1679 | 1346 strcpy(deckMaster.name, "Master Deck"); |
1194 | 1347 for (i=0, card_dispenser_counter=-2, card_id_counter=0; i<DECK_SIZE; ++i, ++card_dispenser_counter) |
1185 | 1348 { |
1194 | 1349 deckMaster.cardsInUse[i] = 0; |
1350 deckMaster.cards_IDs[i] =card_id_counter; | |
1351 switch ( card_dispenser_counter ) | |
1185 | 1352 { |
0 | 1353 case 0: |
1354 case 2: | |
1355 case 6: | |
1356 case 9: | |
1357 case 13: | |
1358 case 18: | |
1359 case 23: | |
1360 case 33: | |
1361 case 36: | |
1362 case 38: | |
1363 case 44: | |
1364 case 46: | |
1365 case 52: | |
1366 case 57: | |
1367 case 69: | |
1368 case 71: | |
1369 case 75: | |
1370 case 79: | |
1371 case 81: | |
1372 case 84: | |
1373 case 89: | |
1185 | 1374 break; |
1375 default: | |
1194 | 1376 ++card_id_counter; |
1185 | 1377 } |
1378 } | |
1379 | |
1197 | 1380 FillPlayerDeck(); |
0 | 1381 } |
1382 | |
1383 //----- (0040A198) -------------------------------------------------------- | |
1197 | 1384 void FillPlayerDeck() |
1194 | 1385 { |
1263 | 1386 signed int m; |
1387 int rand_deck_pos; | |
1388 char card_taken_flags[DECK_SIZE]; | |
1194 | 1389 int i,j; |
0 | 1390 |
1218 | 1391 ArcomageGame::PlaySound(20); |
1194 | 1392 memset(deckMaster.cardsInUse, 0,DECK_SIZE ); |
1393 memset(card_taken_flags, 0, DECK_SIZE); | |
1394 | |
1395 for (i=0; i<2; ++i) | |
0 | 1396 { |
1194 | 1397 for (j=0; j<10; ++j) |
0 | 1398 { |
1194 | 1399 if ( am_Players[i].cards_at_hand[j] > -1 ) |
0 | 1400 { |
1263 | 1401 for (m = 0; m<DECK_SIZE; ++m) |
1194 | 1402 { |
1263 | 1403 if (deckMaster.cards_IDs[m] == am_Players[i].cards_at_hand[j] && deckMaster.cardsInUse[m] == 0) |
1194 | 1404 { |
1263 | 1405 deckMaster.cardsInUse[m] = 1; |
1194 | 1406 break; |
1407 } | |
1408 } | |
0 | 1409 } |
1410 } | |
1411 } | |
1194 | 1412 |
1413 for (i=0; i<DECK_SIZE; ++i) | |
0 | 1414 { |
1415 do | |
1263 | 1416 rand_deck_pos = rand() % DECK_SIZE; |
1417 while (card_taken_flags[rand_deck_pos] == 1 ); | |
1418 | |
1419 card_taken_flags[rand_deck_pos]=1; | |
1420 playDeck.cards_IDs[i] = deckMaster.cards_IDs[rand_deck_pos]; | |
1421 playDeck.cardsInUse[i] = deckMaster.cardsInUse[rand_deck_pos]; | |
0 | 1422 } |
1194 | 1423 |
1200 | 1424 deck_walk_index = 0; |
0 | 1425 amuint_4FABC4 = -1; |
1426 pArcomageGame->field_F6 = 1; | |
1194 | 1427 |
0 | 1428 } |
1429 | |
1430 //----- (0040A255) -------------------------------------------------------- | |
1200 | 1431 void InitalHandsFill() |
1183 | 1432 { |
1200 | 1433 for (int i = 0; i < minimum_cards_at_hand; ++i ) |
0 | 1434 { |
1200 | 1435 GetNextCardFromDeck(0); |
1436 GetNextCardFromDeck(1); | |
0 | 1437 } |
1438 pArcomageGame->field_F6 = 1; | |
1183 | 1439 |
0 | 1440 } |
1441 // 4E1874: using guessed type int dword_4E1874; | |
1442 | |
1443 //----- (0040A283) -------------------------------------------------------- | |
1200 | 1444 void GetNextCardFromDeck( int player_num ) |
1183 | 1445 { |
1200 | 1446 signed int deck_index; // eax@1 |
1447 int new_card_id; // edi@1 | |
1448 signed int card_slot_indx; // eax@7 | |
1449 | |
1450 deck_index = deck_walk_index; | |
1451 for(;;) | |
0 | 1452 { |
1200 | 1453 if ( deck_index >= DECK_SIZE ) |
0 | 1454 { |
1197 | 1455 FillPlayerDeck(); |
1200 | 1456 deck_index = deck_walk_index; |
0 | 1457 } |
1200 | 1458 if ( !playDeck.cardsInUse[deck_index] ) |
1186 | 1459 { |
1200 | 1460 new_card_id = playDeck.cards_IDs[deck_index]; |
1461 ++deck_index; | |
1462 deck_walk_index = deck_index; | |
1463 break; | |
1186 | 1464 } |
1200 | 1465 ++deck_index; |
1466 deck_walk_index = deck_index; | |
0 | 1467 } |
1200 | 1468 |
1197 | 1469 ArcomageGame::PlaySound(21); |
1200 | 1470 card_slot_indx = GetEmptyCardSlotIndex(player_num); |
1471 if ( card_slot_indx != -1 ) | |
0 | 1472 { |
1200 | 1473 amuint_4FAA4C = card_slot_indx; |
1474 am_Players[player_num].cards_at_hand[card_slot_indx] = new_card_id; | |
1256 | 1475 am_Players[player_num].card_shift[card_slot_indx].x = rand_interval(-4, 4); |
1476 am_Players[player_num].card_shift[card_slot_indx].y = rand_interval(-4, 4); | |
0 | 1477 pArcomageGame->field_F6 = 1; |
1478 byte_4FAA2D = 1; | |
1479 } | |
1183 | 1480 |
0 | 1481 } |
1186 | 1482 |
0 | 1483 |
1484 //----- (0040A324) -------------------------------------------------------- | |
1185 | 1485 int GetEmptyCardSlotIndex( int player_num ) |
1486 { | |
1487 int i; | |
1488 for (i=0; i<10; ++i ) | |
1489 { | |
1490 if (am_Players[player_num].cards_at_hand[i]==-1) | |
1491 break; | |
1492 } | |
1493 if ( i >= 10 ) | |
1494 return -1; | |
1495 else | |
1496 return i; | |
0 | 1497 } |
1498 | |
1499 //----- (0040A346) -------------------------------------------------------- | |
1679 | 1500 void IncreaseResourcesInTurn(int player_num) |
1185 | 1501 { |
1197 | 1502 am_Players[player_num].resource_bricks += quarry_bonus + am_Players[player_num].quarry_level; |
1503 am_Players[player_num].resource_gems += magic_bonus + am_Players[player_num].magic_level; | |
1263 | 1504 am_Players[player_num].resource_beasts += zoo_bonus + am_Players[player_num].zoo_level; |
0 | 1505 } |
1183 | 1506 |
0 | 1507 |
1508 //----- (0040A383) -------------------------------------------------------- | |
1256 | 1509 void TurnChange() |
1679 | 1510 { |
1263 | 1511 char player_name[64]; // [sp+4h] [bp-64h]@4 |
1512 // RECT v6; // [sp+44h] [bp-24h]@6 | |
1194 | 1513 |
0 | 1514 ArcomageGame_stru1 v10; // [sp+54h] [bp-14h]@7 |
1194 | 1515 POINT v11; // [sp+60h] [bp-8h]@4 |
0 | 1516 |
1517 if ( !pArcomageGame->field_F4 ) | |
1518 { | |
1197 | 1519 if ( am_Players[0].IsHisTurn != 1 || am_Players[1].IsHisTurn != 1 ) |
0 | 1520 { |
1197 | 1521 ++current_player_num; |
0 | 1522 am_byte_4FAA75 = 1; |
1197 | 1523 if ( current_player_num >= 2 ) |
1524 current_player_num = 0; | |
0 | 1525 } |
1526 else | |
1527 { | |
1528 //nullsub_1(); | |
1218 | 1529 // v11.x = 0; |
1530 // v11.y = 0; | |
1679 | 1531 strcpy(player_name, "The Next Player is: ");//"Ñëåä" |
1218 | 1532 // v0 = 0; |
1194 | 1533 v11.y = 200; |
1218 | 1534 v11.x = 320; // - 12 * v0 / 2; |
1679 | 1535 am_DrawText(-1, player_name, &v11); |
0 | 1536 am_byte_4FAA75 = 1; |
1263 | 1537 ++current_player_num; |
1538 if ( current_player_num >= 2 ) | |
1197 | 1539 current_player_num = 0; |
1263 | 1540 strcpy(player_name, am_Players[current_player_num].pPlayerName); |
1218 | 1541 // v4 = 0; |
1194 | 1542 v11.y = 260; |
1218 | 1543 v11.x = 320;// - 12 * v4 / 2; |
1679 | 1544 am_DrawText(-1, player_name, &v11); |
1197 | 1545 /* v6.left = 0; |
1194 | 1546 v6.right = 640; |
1547 v6.top = 0; | |
1197 | 1548 v6.bottom = 480;*/ |
0 | 1549 //nullsub_1(); |
1679 | 1550 pRenderer->Present(); |
0 | 1551 //nullsub_1(); |
1552 while ( 1 ) | |
1263 | 1553 { |
0 | 1554 while ( !ArcomageGame::MsgLoop(20, &v10) ) |
1555 ; | |
1263 | 1556 if ( v10.field_0 == 1 ) |
1557 { | |
1558 if ( v10.field_4 ) | |
1559 break; | |
1560 //nullsub_1(); | |
1561 continue; | |
1562 } | |
1563 if (( v10.field_0 > 4 )&& ( v10.field_0 <= 8 )) | |
1564 break; | |
1565 if ( v10.field_0 == 10 ) | |
1566 { | |
1567 pArcomageGame->field_F4 = 1; | |
1568 byte_4FAA74 = 1; | |
1569 break; | |
1570 } | |
0 | 1571 } |
1197 | 1572 /* v11.x = 0; |
1194 | 1573 v11.y = 0; |
1574 v6.left = 0; | |
1575 v6.right = 640; | |
1576 v6.top = 0; | |
1197 | 1577 v6.bottom = 480;*/ |
0 | 1578 //nullsub_1(); |
1679 | 1579 pRenderer->Present(); |
0 | 1580 } |
1581 } | |
1582 } | |
1583 | |
1584 | |
1585 //----- (0040A514) -------------------------------------------------------- | |
1197 | 1586 bool IsGameOver() |
1679 | 1587 { |
0 | 1588 bool result; // eax@1 |
1183 | 1589 |
1590 result = false; | |
1591 for(int i=0; i<2; ++i) | |
0 | 1592 { |
1197 | 1593 if ( am_Players[i].tower_height <= 0 ) |
1594 result = true; | |
1595 if ( am_Players[i].tower_height >= max_tower_height ) | |
1183 | 1596 result = true; |
1197 | 1597 if ( am_Players[i].resource_bricks >= max_resources_amount |
1598 || am_Players[i].resource_gems >= max_resources_amount | |
1599 || am_Players[i].resource_beasts >= max_resources_amount ) | |
1183 | 1600 result = true; |
0 | 1601 } |
1679 | 1602 |
1603 return am_gameover = result; | |
0 | 1604 } |
1197 | 1605 |
0 | 1606 |
1607 //----- (0040A560) -------------------------------------------------------- | |
1256 | 1608 char PlayerTurn( int player_num ) |
1609 { | |
0 | 1610 int v1; // ebp@0 |
1611 unsigned __int64 v2; // qax@3 | |
1612 unsigned __int64 v3; // kr00_8@3 | |
1218 | 1613 |
0 | 1614 int v5; // esi@67 |
1615 char Dest[100]; // [sp+8h] [bp-A8h]@67 | |
1616 int v8; // [sp+6Ch] [bp-44h]@3 | |
1194 | 1617 RECT pSrcXYZW; // [sp+70h] [bp-40h]@75 |
0 | 1618 int v10[4]; // [sp+80h] [bp-30h]@69 |
1194 | 1619 POINT pTargetXY; // [sp+90h] [bp-20h]@75 |
0 | 1620 ArcomageGame_stru1 a2; // [sp+98h] [bp-18h]@8 |
1263 | 1621 int animation_stage; // [sp+A4h] [bp-Ch]@1 |
0 | 1622 char v15; // [sp+AEh] [bp-2h]@63 |
1263 | 1623 bool break_loop; // [sp+AFh] [bp-1h]@1 |
0 | 1624 |
1625 uCardID = -1; | |
1263 | 1626 break_loop = false; |
1627 animation_stage = 20; | |
0 | 1628 byte_4FAA00 = 0; |
1629 dword_4FAA68 = 0; | |
1630 amuint_4FAA38 = 10; | |
1631 amuint_4FAA34 = 5; | |
1632 if ( amuint_4FAA4C != -1 ) | |
1633 byte_4FAA2D = 1; | |
1634 do | |
1635 { | |
1194 | 1636 |
0 | 1637 do |
1638 { | |
1194 | 1639 v3 = pEventTimer->Time() - pArcomageGame->event_timer_time; |
0 | 1640 } |
1194 | 1641 while (v3 < 6); |
1642 | |
1679 | 1643 pArcomageGame->event_timer_time = (unsigned int)pEventTimer->Time(); |
0 | 1644 if ( pArcomageGame->field_F4 ) |
1263 | 1645 break_loop = 1; |
0 | 1646 ArcomageGame::MsgLoop(0, &a2); |
1647 switch ( a2.field_0 ) | |
1648 { | |
1649 case 2: | |
1650 if ( a2.field_4 == 129 && a2.field_8 == 1 ) | |
1651 { | |
1652 pAudioPlayer->StopChannels(-1, -1); | |
1653 dword_4FAA68 = 0; | |
1263 | 1654 break_loop = true; |
1185 | 1655 pArcomageGame->field_F4 = 1; |
0 | 1656 } |
1657 break; | |
1658 case 9: | |
1659 pArcomageGame->field_F6 = 1; | |
1660 break; | |
1194 | 1661 case 10: |
0 | 1662 pAudioPlayer->StopChannels(-1, -1); |
1663 byte_4FAA74 = 1; | |
1263 | 1664 break_loop = true; |
0 | 1665 pArcomageGame->field_F4 = 1; |
1666 break; | |
1667 } | |
1218 | 1668 |
1263 | 1669 if (am_Players[current_player_num].IsHisTurn != 1 && |
1670 !byte_4FAA00 && !byte_4FAA2E && !byte_4FAA2D ) | |
0 | 1671 { |
1672 if ( am_byte_4FAA75 ) | |
1673 am_byte_4FAA76 = 1; | |
1256 | 1674 OpponentsAITurn(current_player_num); |
0 | 1675 byte_4FAA2E = 1; |
1676 } | |
1677 if ( amuint_4FAA4C != -1 && amuint_4FAA38 > 10 ) | |
1678 amuint_4FAA38 = 10; | |
1218 | 1679 if ( byte_4FAA2E || byte_4FAA2D ||am_Players[current_player_num].IsHisTurn != 1 ) |
0 | 1680 { |
1681 pArcomageGame->field_F6 = 1; | |
1682 if ( byte_4FAA2D ) | |
1683 { | |
1684 --amuint_4FAA38; | |
1685 if ( amuint_4FAA38 < 0 ) | |
1686 { | |
1687 byte_4FAA2D = 0; | |
1688 amuint_4FAA38 = 10; | |
1263 | 1689 break_loop = false; |
0 | 1690 } |
1691 } | |
1692 if ( byte_4FAA2E ) | |
1693 { | |
1263 | 1694 --animation_stage; |
1695 if ( animation_stage < 0 ) | |
0 | 1696 { |
1697 if ( dword_4FAA68 > 1 ) | |
1698 { | |
1699 --dword_4FAA68; | |
1700 byte_4FAA00 = 0; | |
1701 } | |
1702 else | |
1703 { | |
1263 | 1704 break_loop = true; |
0 | 1705 } |
1706 byte_4FAA2E = 0; | |
1263 | 1707 animation_stage = 20; |
0 | 1708 } |
1709 } | |
1710 } | |
1711 else | |
1712 { | |
1263 | 1713 if ( need_to_discard_card ) |
0 | 1714 { |
1256 | 1715 if ( a2.field_0 == 7 && DiscardCard(player_num, current_card_slot_index) ) |
0 | 1716 { |
1717 if ( am_byte_4FAA75 ) | |
1718 am_byte_4FAA76 = 1; | |
1719 if ( dword_4FAA64 > 0 ) | |
1720 { | |
1721 --dword_4FAA64; | |
1263 | 1722 need_to_discard_card = GetPlayerHandCardCount(player_num) > minimum_cards_at_hand; |
0 | 1723 } |
1724 byte_4FAA2E = 1; | |
1725 } | |
1256 | 1726 if ( a2.field_0 == 8 && DiscardCard(player_num, current_card_slot_index) ) |
0 | 1727 { |
1728 if ( am_byte_4FAA75 ) | |
1729 am_byte_4FAA76 = 1; | |
1730 if ( dword_4FAA64 > 0 ) | |
1731 { | |
1732 --dword_4FAA64; | |
1263 | 1733 need_to_discard_card = GetPlayerHandCardCount(player_num) > minimum_cards_at_hand; |
0 | 1734 } |
1735 byte_4FAA2E = 1; | |
1736 } | |
1737 } | |
1738 else | |
1739 { | |
1740 if ( a2.field_0 == 7 ) | |
1741 { | |
1200 | 1742 if ( PlayCard(player_num, current_card_slot_index) ) |
0 | 1743 { |
1744 byte_4FAA2E = 1; | |
1745 if ( am_byte_4FAA75 ) | |
1746 am_byte_4FAA76 = 1; | |
1747 } | |
1748 } | |
1749 if ( a2.field_0 == 8 ) | |
1750 { | |
1256 | 1751 if ( DiscardCard(player_num, current_card_slot_index) ) |
0 | 1752 { |
1753 byte_4FAA2E = 1; | |
1754 if ( am_byte_4FAA75 ) | |
1755 am_byte_4FAA76 = 1; | |
1756 } | |
1757 } | |
1758 } | |
1759 } | |
1760 //nullsub_1(); | |
1218 | 1761 //if ( false ) |
1762 //{ | |
1763 // if ( !v15 ) | |
1764 // { | |
1765 // //nullsub_1(); | |
1766 // v15 = 1; | |
1767 // } | |
1768 //} | |
1769 //else | |
1770 //{ | |
1771 // v15 = 0; | |
1772 // } | |
1773 //if ( false ) | |
1774 //{ | |
1775 // //nullsub_1(); | |
1776 // //nullsub_1(); | |
1777 // // assert(false && "Invalid strcpy params"); | |
1778 // // inv_strcpy(nullptr, Dest); | |
1779 // v5 = 0;//unk::const_0(&unk_4E19FC, 0); | |
1780 // //nullsub_1(); | |
1781 // if ( v5 == 1 ) | |
1782 // { | |
1783 // pAudioPlayer->StopChannels(-1, -1); | |
1784 // v16 = 1; | |
1785 // pArcomageGame->field_F4 = 1; | |
1786 // dword_4FAA68 = 0; | |
1787 // } | |
1788 // /*v10[0] = 0; | |
1789 // v10[2] = 640; | |
1790 // v10[1] = 0; | |
1791 // v10[3] = 480;*/ | |
1792 // //nullsub_1(); | |
1793 //} | |
1209 | 1794 if ( dword_4FABB8 != DrawCardsRectangles(player_num) ) |
0 | 1795 { |
1263 | 1796 dword_4FABB8 = DrawCardsRectangles(player_num); |
1797 pArcomageGame->field_F6 = 1; | |
1209 | 1798 } |
0 | 1799 if ( pArcomageGame->field_F6 ) |
1800 { | |
1263 | 1801 DrawGameUI(animation_stage); |
0 | 1802 DoBlt_Copy(pArcomageGame->pBackgroundPixels); |
1803 pArcomageGame->field_F6 = 0; | |
1804 } | |
1805 if ( pArcomageGame->field_F9 ) | |
1806 { | |
1194 | 1807 pTargetXY.x = 0; |
1808 pTargetXY.y = 0; | |
1809 pSrcXYZW.left = 0; | |
1810 pSrcXYZW.right = 640; | |
1811 pSrcXYZW.top = 0; | |
1812 pSrcXYZW.bottom = 480; | |
0 | 1813 am_BeginScene(pArcomageGame->pBackgroundPixels, -1, 1); |
2154 | 1814 pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 2); |
0 | 1815 am_EndScene(); |
1263 | 1816 DrawGameUI(animation_stage); |
0 | 1817 pRenderer->Present(); |
1818 pArcomageGame->field_F9 = 0; | |
1819 } | |
1820 } | |
1263 | 1821 while ( !break_loop ); |
0 | 1822 return dword_4FAA68 > 0; |
1823 } | |
1194 | 1824 |
0 | 1825 |
1826 //----- (0040A9AF) -------------------------------------------------------- | |
1263 | 1827 void DrawGameUI( int animation_stage ) |
1679 | 1828 { |
0 | 1829 am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1); |
1197 | 1830 DrawRectanglesForText(); |
0 | 1831 am_EndScene(); |
1197 | 1832 |
0 | 1833 am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1); |
1209 | 1834 DrawCards(); |
1197 | 1835 DrawPlayersTowers(); |
1836 DrawPlayersWall(); | |
1837 DrawPlayersText(); | |
0 | 1838 am_EndScene(); |
1197 | 1839 |
0 | 1840 am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1); |
1263 | 1841 DrawCardAnimation(animation_stage); |
1185 | 1842 |
1843 for( int i=0; i<10; ++i) | |
1844 { | |
1263 | 1845 if (array_4FABD0[i].have_effect) |
1846 array_4FABD0[i].field_40->DrawEffect(); | |
1185 | 1847 } |
1200 | 1848 current_card_slot_index = DrawCardsRectangles(current_player_num); |
1263 | 1849 DrawSparks(); |
0 | 1850 am_EndScene(); |
1851 } | |
1852 | |
1853 //----- (0040AA4E) -------------------------------------------------------- | |
1263 | 1854 void DrawSparks() |
1185 | 1855 { |
1263 | 1856 int rgb_pixel_color; // [sp-4h] [bp-2Ch]@4 |
1857 unsigned int pixel_color; | |
1185 | 1858 |
1859 for (int i=0; i<10; ++i) | |
0 | 1860 { |
1263 | 1861 if(array_4FABD0[i].have_effect && (array_4FABD0[i].field_40->_40E2A7()==2)) |
1185 | 1862 { |
1263 | 1863 rgb_pixel_color = 0x0000FF00; |
1864 if ( !array_4FABD0[i].effect_sign ) | |
1865 rgb_pixel_color = 0x000000FF; | |
1866 | |
1867 pixel_color = R8G8B8_to_TargetFormat(rgb_pixel_color); | |
1185 | 1868 for(int j=0; j<150; ++j ) |
1869 { | |
1263 | 1870 if (array_4FABD0[i].effect_sparks[j].have_spark > 0) |
1185 | 1871 { |
1872 if (j%2) | |
1679 | 1873 DrawPixel(&array_4FABD0[i].effect_sparks[j].spark_position, pixel_color); |
1185 | 1874 else |
1679 | 1875 DrawSquare(&array_4FABD0[i].effect_sparks[j].spark_position, pixel_color); |
1185 | 1876 } |
1877 } | |
1878 } | |
0 | 1879 } |
1185 | 1880 |
0 | 1881 } |
1882 | |
1883 //----- (0040AB0A) -------------------------------------------------------- | |
1197 | 1884 void DrawRectanglesForText() |
1679 | 1885 { |
1183 | 1886 RECT pSrcRect; // [sp+Ch] [bp-18h]@1 |
1887 POINT pTargetXY; // [sp+1Ch] [bp-8h]@1 | |
1679 | 1888 |
1197 | 1889 //resources rectangles |
1263 | 1890 pSrcRect.left = 765; |
1183 | 1891 pSrcRect.top = 0; |
1892 pSrcRect.right = 843; | |
1893 pSrcRect.bottom = 216; | |
1894 | |
1895 pTargetXY.x = 8; | |
1896 pTargetXY.y = 56; | |
2154 | 1897 pRenderer->am_Blt_Copy(&pSrcRect, &pTargetXY, 2); |
1183 | 1898 |
1899 pTargetXY.x = 555; | |
1900 pTargetXY.y = 56; | |
2154 | 1901 pRenderer->am_Blt_Copy(&pSrcRect, &pTargetXY, 2); |
1183 | 1902 |
1197 | 1903 //players name rectangle |
1183 | 1904 pSrcRect.left = 283; |
1263 | 1905 pSrcRect.top = 166; |
1183 | 1906 pSrcRect.right = 361; |
1907 pSrcRect.bottom = 190; | |
1908 pTargetXY.x = 8; | |
1909 pTargetXY.y = 13; | |
2154 | 1910 pRenderer->am_Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2); |
1183 | 1911 |
1912 pTargetXY.x = 555; | |
1913 pTargetXY.y = 13; | |
2154 | 1914 pRenderer->am_Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2); |
1183 | 1915 |
1241 | 1916 //tower height rectangle |
1183 | 1917 pSrcRect.left = 234; |
1263 | 1918 pSrcRect.top = 166; |
1183 | 1919 pSrcRect.right = 283; |
1920 pSrcRect.bottom = 190; | |
1921 pTargetXY.x = 100; | |
1922 pTargetXY.y = 296; | |
2154 | 1923 pRenderer->am_Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2); |
1183 | 1924 |
1925 pTargetXY.x = 492; | |
1926 pTargetXY.y = 296; | |
2154 | 1927 pRenderer->am_Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2); |
1183 | 1928 |
1241 | 1929 //wall height rectangle |
1263 | 1930 pSrcRect.left = 192; |
1931 pSrcRect.top = 166; | |
1183 | 1932 pSrcRect.right = 234; |
1933 pSrcRect.bottom = 190; | |
1934 pTargetXY.x = 168; | |
1935 pTargetXY.y = 296; | |
2154 | 1936 pRenderer->am_Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2); |
1183 | 1937 |
1938 pTargetXY.x = 430; | |
1939 pTargetXY.y = 296; | |
2154 | 1940 pRenderer->am_Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2); |
0 | 1941 } |
1942 | |
1943 //----- (0040AC5F) -------------------------------------------------------- | |
1197 | 1944 void DrawPlayersText() |
1945 { | |
1946 | |
1947 int res_value; // ecx@18 | |
1948 char text_buff[32]; // [sp+Ch] [bp-28h]@2 | |
1949 POINT text_position; // [sp+2Ch] [bp-8h]@2 | |
0 | 1950 |
1263 | 1951 if ( need_to_discard_card ) |
0 | 1952 { |
1209 | 1953 strcpy(text_buff, pGlobalTXT_LocalizationStrings[266]);// DISCARD A CARD |
1197 | 1954 text_position.x = 320 - pArcomageGame->pfntArrus->GetLineWidth(text_buff) / 2; |
1955 text_position.y = 306; | |
1679 | 1956 am_DrawText(-1, text_buff, &text_position); |
0 | 1957 } |
1209 | 1958 strcpy( text_buff, am_Players[0].pPlayerName); |
1197 | 1959 if ( !current_player_num ) |
1209 | 1960 strcat(text_buff, "***"); |
1197 | 1961 text_position.x = 47 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2; |
1962 text_position.y = 21; | |
1679 | 1963 am_DrawText(-1, text_buff, &text_position); |
1197 | 1964 |
1209 | 1965 strcpy(text_buff, am_Players[1].pPlayerName); |
1197 | 1966 if ( current_player_num == 1 ) |
1209 | 1967 strcat(text_buff, "***" ); |
1197 | 1968 text_position.x = 595 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2; |
1969 text_position.y = 21; | |
1679 | 1970 am_DrawText(-1, text_buff, &text_position); |
1971 | |
1972 am_IntToString(am_Players[0].tower_height, text_buff); | |
1197 | 1973 text_position.x = 123 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2; |
1974 text_position.y = 305; | |
1679 | 1975 am_DrawText(-1, text_buff, &text_position); |
1976 | |
1977 am_IntToString(am_Players[1].tower_height, text_buff); | |
1197 | 1978 text_position.x = 515 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2; |
1979 text_position.y = 305; | |
1679 | 1980 am_DrawText(-1, text_buff, &text_position); |
1981 | |
1982 am_IntToString(am_Players[0].wall_height, text_buff); | |
1197 | 1983 text_position.x = 188 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2; |
1984 text_position.y = 305; | |
1679 | 1985 am_DrawText(-1, text_buff, &text_position); |
1986 | |
1987 am_IntToString(am_Players[1].wall_height, text_buff); | |
1197 | 1988 text_position.x = 451 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2; |
1989 text_position.y = 305; | |
1679 | 1990 am_DrawText(-1, text_buff, &text_position); |
1197 | 1991 |
1992 res_value = am_Players[0].quarry_level; | |
1263 | 1993 if ( use_start_bonus ) |
1197 | 1994 res_value =am_Players[0].quarry_level + quarry_bonus; |
1679 | 1995 am_IntToString(res_value, text_buff); |
1197 | 1996 text_position.x = 14;// - 6 * 0 / 2; |
1997 text_position.y = 92; | |
1998 DrawPlayerLevels(-1, text_buff, &text_position); | |
1999 | |
2000 res_value = am_Players[1].quarry_level; | |
1263 | 2001 if ( use_start_bonus ) |
1197 | 2002 res_value = am_Players[1].quarry_level + quarry_bonus; |
1679 | 2003 am_IntToString(res_value, text_buff); |
1197 | 2004 // v2 = 0; |
2005 text_position.y = 92; | |
2006 text_position.x = 561; //- 6 * v2 / 2; | |
2007 DrawPlayerLevels(-1, text_buff, &text_position); | |
2008 | |
2009 res_value = am_Players[0].magic_level; | |
1263 | 2010 if ( use_start_bonus ) |
1197 | 2011 res_value = am_Players[0].magic_level + magic_bonus; |
1679 | 2012 am_IntToString(res_value, text_buff); |
1197 | 2013 // v4 = 0; |
2014 text_position.y = 164; | |
2015 text_position.x = 14; //- 6 * v4 / 2; | |
2016 DrawPlayerLevels(-1, text_buff, &text_position); | |
2017 | |
2018 res_value = am_Players[1].magic_level; | |
1263 | 2019 if ( use_start_bonus ) |
2020 res_value = am_Players[1].magic_level + magic_bonus; | |
1679 | 2021 am_IntToString(res_value, text_buff); |
1197 | 2022 // v6 = 0; |
2023 text_position.y = 164; | |
2024 text_position.x = 561; //- 6 * v6 / 2; | |
2025 DrawPlayerLevels(-1, text_buff, &text_position); | |
2026 | |
1200 | 2027 res_value = am_Players[0].zoo_level; |
1263 | 2028 if ( use_start_bonus ) |
1201 | 2029 res_value = am_Players[0].zoo_level + zoo_bonus; |
1679 | 2030 am_IntToString(res_value, text_buff); |
1197 | 2031 // v8 = 0; |
2032 text_position.y = 236; | |
2033 text_position.x = 14;// - 6 * v8 / 2; | |
2034 DrawPlayerLevels(-1, text_buff, &text_position); | |
2035 | |
1200 | 2036 res_value = am_Players[1].zoo_level; |
1263 | 2037 if ( use_start_bonus ) |
1201 | 2038 res_value = am_Players[1].zoo_level + zoo_bonus; |
1679 | 2039 am_IntToString(res_value, text_buff); |
1197 | 2040 // v10 = 0; |
2041 text_position.y = 236; | |
2042 text_position.x = 561;// - 6 * v10 / 2; | |
2043 DrawPlayerLevels(-1, text_buff, &text_position); | |
2044 | |
1679 | 2045 am_IntToString(am_Players[0].resource_bricks, text_buff); |
1197 | 2046 text_position.y = 114; |
2047 text_position.x = 10; | |
2048 DrawBricksCount(-1, text_buff, &text_position); | |
2049 | |
1679 | 2050 am_IntToString(am_Players[1].resource_bricks, text_buff); |
1197 | 2051 text_position.x = 557; |
2052 text_position.y = 114; | |
2053 DrawBricksCount(-1, text_buff, &text_position); | |
2054 | |
1679 | 2055 am_IntToString(am_Players[0].resource_gems, text_buff); |
1197 | 2056 text_position.x = 10; |
2057 text_position.y = 186; | |
2058 DrawGemsCount(-1, text_buff, &text_position); | |
2059 | |
1679 | 2060 am_IntToString(am_Players[1].resource_gems, text_buff); |
1197 | 2061 text_position.x = 557; |
2062 text_position.y = 186; | |
2063 DrawGemsCount(-1, text_buff, &text_position); | |
2064 | |
1679 | 2065 am_IntToString(am_Players[0].resource_beasts, text_buff); |
1197 | 2066 text_position.x = 10; |
2067 text_position.y = 258; | |
2068 DrawBeastsCount(-1, text_buff, &text_position); | |
2069 | |
1679 | 2070 am_IntToString(am_Players[1].resource_beasts, text_buff); |
1197 | 2071 text_position.x = 557; |
2072 text_position.y = 258; | |
2073 DrawBeastsCount(-1, text_buff, &text_position); | |
0 | 2074 } |
1197 | 2075 |
0 | 2076 |
2077 //----- (0040B102) -------------------------------------------------------- | |
1197 | 2078 void DrawPlayerLevels( int a1, char *text, POINT *pXY ) |
0 | 2079 { |
1194 | 2080 char *v3; // esi@1 |
2081 unsigned char test_char; // bl@2 | |
2082 int v7; // eax@3 | |
2083 RECT pSrcRect; | |
2084 POINT pTargetPoint; | |
2085 | |
2086 v3 = text; | |
2087 am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1); | |
2088 pTargetPoint.x = pXY->x; | |
2089 pTargetPoint.y = pXY->y; | |
2090 do | |
2091 { | |
2092 test_char = *v3; | |
2093 ++v3; | |
2094 if ( test_char ) | |
2095 { | |
2096 v7 = 22 * test_char; | |
2097 pSrcRect.right = v7 - 842; | |
2098 pSrcRect.left = v7 - 864; | |
2099 pSrcRect.top = 190; | |
2100 pSrcRect.bottom = 207; | |
2154 | 2101 pRenderer->am_Blt_Chroma(&pSrcRect, &pTargetPoint, pArcomageGame->field_54, 1); |
1194 | 2102 pTargetPoint.x += 22; |
2103 } | |
2104 } | |
2105 while ( test_char!= 0 ); | |
2106 am_EndScene(); | |
0 | 2107 } |
2108 | |
2109 //----- (0040B17E) -------------------------------------------------------- | |
1197 | 2110 void DrawBricksCount( int a1, char* text, POINT *pXY ) |
0 | 2111 { |
1194 | 2112 |
2113 char *v3; // esi@1 | |
2114 unsigned char test_char; // bl@2 | |
2115 int v7; // eax@3 | |
2116 RECT pSrcRect; | |
2117 POINT pTargetPoint; | |
2118 | |
2119 v3 = text; | |
2120 am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1); | |
2121 pTargetPoint.x = pXY->x; | |
2122 pTargetPoint.y = pXY->y; | |
2123 do | |
2124 { | |
2125 test_char = *v3; | |
2126 ++v3; | |
2127 if ( test_char ) | |
2128 { | |
2129 v7 = 13 * test_char; | |
1197 | 2130 pSrcRect.left = v7 - 370; |
2131 pSrcRect.right = v7 - 357; | |
1194 | 2132 pSrcRect.top = 128; |
2133 pSrcRect.bottom = 138; | |
2154 | 2134 pRenderer->am_Blt_Copy(&pSrcRect, &pTargetPoint, 2); |
1194 | 2135 pTargetPoint.x += 13; |
2136 } | |
2137 } | |
2138 while ( test_char!= 0 ); | |
2139 am_EndScene(); | |
2140 | |
0 | 2141 } |
2142 | |
2143 //----- (0040B1F3) -------------------------------------------------------- | |
1197 | 2144 void DrawGemsCount( int a1, char* text, POINT* pXY ) |
0 | 2145 { |
1194 | 2146 |
2147 char *v3; // esi@1 | |
2148 unsigned char test_char; // bl@2 | |
2149 int v7; // eax@3 | |
2150 RECT pSrcRect; | |
2151 POINT pTargetPoint; | |
2152 | |
2153 v3 = text; | |
2154 am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1); | |
2155 pTargetPoint.x = pXY->x; | |
2156 pTargetPoint.y = pXY->y; | |
2157 do | |
2158 { | |
2159 test_char = *v3; | |
2160 ++v3; | |
2161 if ( test_char ) | |
2162 { | |
2163 v7 = 13 * test_char; | |
1197 | 2164 pSrcRect.left = v7 - 370; |
2165 pSrcRect.right = v7 - 357; | |
1194 | 2166 pSrcRect.top = 138; |
2167 pSrcRect.bottom = 148; | |
2154 | 2168 pRenderer->am_Blt_Copy(&pSrcRect, &pTargetPoint, 2); |
1194 | 2169 pTargetPoint.x += 13; |
2170 } | |
2171 } | |
2172 while ( test_char!= 0 ); | |
2173 am_EndScene(); | |
2174 | |
0 | 2175 } |
2176 | |
2177 //----- (0040B268) -------------------------------------------------------- | |
1197 | 2178 void DrawBeastsCount( int a1, char *text, POINT *pXY ) |
0 | 2179 { |
1194 | 2180 |
2181 char *v3; // esi@1 | |
2182 unsigned char test_char; // bl@2 | |
2183 int v7; // eax@3 | |
2184 RECT pSrcRect; | |
2185 POINT pTargetPoint; | |
2186 | |
2187 v3 = text; | |
2188 am_BeginScene(pArcomageGame->pSpritesPixels, -1, 1); | |
2189 pTargetPoint.x = pXY->x; | |
2190 pTargetPoint.y = pXY->y; | |
2191 do | |
2192 { | |
2193 test_char = *v3; | |
2194 ++v3; | |
2195 if ( test_char ) | |
2196 { | |
2197 v7 = 13 * test_char; | |
1197 | 2198 pSrcRect.left = v7 - 370; |
2199 pSrcRect.right = v7 - 357; | |
1194 | 2200 pSrcRect.top = 148; |
2201 pSrcRect.bottom = 158; | |
2154 | 2202 pRenderer->am_Blt_Copy(&pSrcRect, &pTargetPoint, 2); |
1194 | 2203 pTargetPoint.x += 13; |
2204 } | |
2205 } | |
2206 while ( test_char!= 0 ); | |
2207 am_EndScene(); | |
2208 | |
0 | 2209 } |
2210 | |
2211 //----- (0040B2DD) -------------------------------------------------------- | |
1197 | 2212 void DrawPlayersTowers() |
2213 { | |
2214 int tower_height; // eax@1 | |
2215 int tower_top; // esi@3 | |
1194 | 2216 RECT pSrcXYZW; // [sp+0h] [bp-18h]@3 |
2217 POINT pTargetXY; // [sp+10h] [bp-8h]@3 | |
2218 | |
1197 | 2219 tower_height= am_Players[0].tower_height; |
2220 if ( am_Players[0].tower_height > max_tower_height ) | |
2221 tower_height = max_tower_height; | |
1194 | 2222 pSrcXYZW.top = 0; |
2223 pSrcXYZW.left = 892; | |
2224 pSrcXYZW.right = 937; | |
1197 | 2225 tower_top = 200 * tower_height / max_tower_height; |
2226 pSrcXYZW.bottom = tower_top; | |
1194 | 2227 pTargetXY.x = 102; |
1197 | 2228 pTargetXY.y = 297 - tower_top; |
2154 | 2229 pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 2); |
1194 | 2230 |
2231 pSrcXYZW.top = 0; | |
2232 pSrcXYZW.left = 384; | |
2233 pSrcXYZW.right = 452; | |
2234 pSrcXYZW.bottom = 94; | |
1197 | 2235 pTargetXY.y = 203 - tower_top; |
1194 | 2236 pTargetXY.x = 91; |
2154 | 2237 pRenderer->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2); |
1194 | 2238 |
1197 | 2239 |
2240 tower_height = am_Players[1].tower_height; | |
2241 if (am_Players[1].tower_height > max_tower_height ) | |
2242 tower_height = max_tower_height; | |
2243 tower_top = 200 * tower_height / max_tower_height; | |
2244 pSrcXYZW.top = 0; | |
2245 pSrcXYZW.left = 892; | |
2246 pSrcXYZW.right = 937; | |
2247 pSrcXYZW.bottom = tower_top; | |
2248 | |
1194 | 2249 pTargetXY.x = 494; |
1197 | 2250 pTargetXY.y = 297 - tower_top; |
2154 | 2251 pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 2); |
1197 | 2252 //draw tower up cone |
2253 pSrcXYZW.left = 384; | |
2254 pSrcXYZW.right = 452; | |
2255 pSrcXYZW.top = 94; | |
1194 | 2256 pSrcXYZW.bottom = 188; |
1197 | 2257 |
1194 | 2258 pTargetXY.x = 483; |
1197 | 2259 pTargetXY.y = 203 - tower_top; |
2154 | 2260 pRenderer->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2); |
1194 | 2261 |
0 | 2262 } |
2263 // 4E1884: using guessed type int dword_4E1884; | |
2264 | |
2265 //----- (0040B400) -------------------------------------------------------- | |
1197 | 2266 void DrawPlayersWall() |
2267 { | |
1194 | 2268 int v0; // eax@1 |
2269 int v1; // eax@4 | |
2270 LONG v2; // ecx@4 | |
2271 int v3; // eax@5 | |
2272 int v4; // eax@8 | |
2273 LONG v5; // esi@8 | |
2274 RECT pSrcXYZW; // [sp+4h] [bp-18h]@4 | |
2275 POINT pTargetXY; // [sp+14h] [bp-8h]@4 | |
2276 | |
1197 | 2277 v0 = am_Players[0].wall_height; |
1218 | 2278 |
2279 if ( am_Players[0].wall_height > 100 ) | |
1194 | 2280 v0 = 100; |
1218 | 2281 |
2282 if ( am_Players[0].wall_height > 0 ) | |
2283 { | |
2284 | |
1194 | 2285 pSrcXYZW.top = 0; |
2286 pSrcXYZW.left = 843; | |
2287 v1 = 200 * v0 / 100; | |
2288 pSrcXYZW.right = 867; | |
2289 pSrcXYZW.bottom = v1; | |
2290 pTargetXY.x = 177; | |
2291 pTargetXY.y = 297 - v1; | |
2154 | 2292 pRenderer->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2); |
1218 | 2293 } |
2294 | |
1197 | 2295 v3 = am_Players[1].wall_height; |
1218 | 2296 if ( am_Players[1].wall_height > 100 ) |
2297 v3 = 100; | |
2298 | |
2299 | |
1247 | 2300 if ( am_Players[1].wall_height > 0 ) |
1218 | 2301 { |
2302 | |
1194 | 2303 pSrcXYZW.top = 0; |
2304 pSrcXYZW.left = 843; | |
2305 v4 = 200 * v3 / 100; | |
2306 pSrcXYZW.right = 867; | |
2307 pSrcXYZW.bottom = v4; | |
2308 pTargetXY.x = 439; | |
2309 pTargetXY.y = 297 - v4; | |
2154 | 2310 pRenderer->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2); |
1218 | 2311 } |
0 | 2312 } |
2313 | |
2314 //----- (0040B4B9) -------------------------------------------------------- | |
1209 | 2315 void DrawCards() |
2316 { | |
1200 | 2317 |
2318 int v0; // esi@1 | |
2319 char v1; // bl@1 | |
2320 int v2; // edi@1 | |
2321 int v3; // edx@2 | |
2322 int v4; // eax@3 | |
2323 int v5; // ecx@3 | |
2324 int v6; // eax@3 | |
2325 unsigned int v7; // ecx@4 | |
2326 int v8; // eax@16 | |
2327 int v9; // ecx@16 | |
2328 int v10; // eax@16 | |
2329 signed int v11; // edi@18 | |
2330 signed int v12; // esi@20 | |
2331 int v13; // ecx@20 | |
2332 int v14; // eax@23 | |
2333 signed int v15; // eax@25 | |
2334 int v16; // ecx@25 | |
2335 POINT *v17; // esi@26 | |
2336 signed int v18; // eax@29 | |
1679 | 2337 AcromageCardOnTable *v19; // ecx@29 |
1200 | 2338 int v20; // ecx@31 |
2339 int v21; // [sp-4h] [bp-2Ch]@8 | |
2340 RECT pSrcXYZW; // [sp+Ch] [bp-1Ch]@8 | |
2341 POINT pTargetXY; // [sp+1Ch] [bp-Ch]@1 | |
2342 int v24; // [sp+24h] [bp-4h]@1 | |
2343 | |
2344 v0 = GetPlayerHandCardCount(current_player_num); | |
2345 v2 = 0; | |
2346 pTargetXY.y = 327; | |
2347 v24 = (640 - 96 * v0) / (v0 + 1); | |
2348 pTargetXY.x = (640 - 96 * v0) / (v0 + 1); | |
2349 while ( v2 < v0 ) | |
2350 { | |
2351 v3 = current_player_num; | |
1241 | 2352 if ( am_byte_4E185D) |
1200 | 2353 { |
2354 | |
1256 | 2355 pTargetXY.x += am_Players[current_player_num].card_shift[v2].x ; |
2356 pTargetXY.y += am_Players[current_player_num].card_shift[v2].y; | |
1200 | 2357 } |
2358 v7 = am_Players[current_player_num].cards_at_hand[v2]; | |
2359 if ( v7 == -1 ) | |
2360 { | |
2361 ++v0; | |
2362 goto LABEL_15; | |
2363 } | |
2364 if ( v2 != amuint_4FAA4C ) | |
2365 { | |
2366 if ( am_Players[current_player_num].IsHisTurn == 0 && byte_505881 == 0 ) | |
2367 { | |
2368 pSrcXYZW.left = 192; | |
2369 pSrcXYZW.right = 288; | |
2370 pSrcXYZW.top = 0; | |
2371 pSrcXYZW.bottom = 128; | |
2154 | 2372 pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 2); |
1200 | 2373 goto LABEL_13; |
2374 } | |
2375 pArcomageGame->GetCardRect(v7, &pSrcXYZW); | |
2376 if ( !CanCardBePlayed(current_player_num, v2) ) | |
2377 { | |
2154 | 2378 pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 0); |
1200 | 2379 goto LABEL_13; |
2380 } | |
2154 | 2381 pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 2); |
1200 | 2382 |
2383 } | |
2384 LABEL_13: | |
2385 v3 = current_player_num; | |
2386 pTargetXY.x += v24 + 96; | |
2387 LABEL_15: | |
1241 | 2388 if ( am_byte_4E185D ) |
1200 | 2389 { |
1256 | 2390 pTargetXY.x -= am_Players[current_player_num].card_shift[v2].x ; |
2391 pTargetXY.y -= am_Players[current_player_num].card_shift[v2].y ; | |
1200 | 2392 } |
2393 ++v2; | |
2394 } | |
2395 | |
2396 for (v11=0; v11<10; ++v11) | |
2397 { | |
2398 if ( am_byte_4FAA76 == 0 ) | |
2399 { | |
2400 if ( shown_cards[v11].uCardId != -1 ) | |
2401 { | |
2402 pArcomageGame->GetCardRect(shown_cards[v11].uCardId, &pSrcXYZW); | |
2154 | 2403 pRenderer->am_Blt_Copy(&pSrcXYZW, &shown_cards[v11].field_18_point, 0); |
1200 | 2404 } |
2405 if ( shown_cards[v11].field_4 != 0 ) | |
2406 { | |
2407 pTargetXY.x = shown_cards[v11].field_18_point.x + 12; | |
2408 pTargetXY.y = shown_cards[v11].field_18_point.y + 40; | |
2409 pSrcXYZW.left = 843; | |
2410 pSrcXYZW.right = 916; | |
2411 pSrcXYZW.top = 200; | |
2412 pSrcXYZW.bottom = 216; | |
2154 | 2413 pRenderer->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2); |
1200 | 2414 } |
2415 } | |
2416 else if ( amuint_4FAA34 <= 0 ) | |
2417 { | |
2418 if ( v11 == 9 ) | |
2419 { | |
2420 am_byte_4FAA76 = 0; | |
2421 am_byte_4FAA75 = 0; | |
2422 amuint_4FAA34 = 5; | |
2423 } | |
2424 if ( shown_cards[v11].uCardId != -1 ) | |
2425 amuint_4FABC4 = shown_cards[v11].uCardId; | |
2426 shown_cards[v11].uCardId = -1; | |
2427 shown_cards[v11].field_18_point.x = shown_cards[v11].field_8.x; | |
2428 shown_cards[v11].field_18_point.y = shown_cards[v11].field_8.y; | |
2429 shown_cards[v11].field_4 = 0; | |
2430 } | |
2431 else | |
2432 { | |
2433 if ( shown_cards[v11].uCardId != -1 ) | |
2434 { | |
2435 shown_cards[v11].field_18_point.x += shown_cards[v11].field_10_xplus; | |
2436 shown_cards[v11].field_18_point.y += shown_cards[v11].field_14_y_plus; | |
2437 pArcomageGame->GetCardRect(shown_cards[v11].uCardId, &pSrcXYZW); | |
2154 | 2438 pRenderer->am_Blt_Copy(&pSrcXYZW, &shown_cards[v11].field_18_point, 0); |
1200 | 2439 } |
2440 } | |
2441 } | |
2442 if ( am_byte_4FAA76 != 0 ) | |
2443 --amuint_4FAA34; | |
2444 | |
2445 pSrcXYZW.left = 192; | |
2446 pSrcXYZW.right = 288; | |
2447 pSrcXYZW.top = 0; | |
2448 pSrcXYZW.bottom = 128; | |
2449 pTargetXY.x = 120; | |
2450 pTargetXY.y = 18; | |
2154 | 2451 pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 0); |
1200 | 2452 |
0 | 2453 } |
2454 | |
2455 | |
2456 //----- (0040B76F) -------------------------------------------------------- | |
1218 | 2457 void DrawCardAnimation( int animation_stage ) |
2458 { | |
1209 | 2459 |
2460 int v1; // eax@3 | |
2461 int v2; // eax@3 | |
2462 int v3; // esi@4 | |
2463 int v4; // eax@4 | |
2464 POINT *v5; // edx@6 | |
2465 RECT *v6; // ecx@6 | |
1218 | 2466 |
1209 | 2467 int v8; // eax@15 |
1679 | 2468 AcromageCardOnTable *v9; // ecx@15 |
1209 | 2469 int v10; // ecx@19 |
2470 int v11; // eax@20 | |
2471 int v12; // ecx@20 | |
2472 int v13; // eax@20 | |
2473 unsigned int v14; // ecx@21 | |
2474 double v15; // st7@22 | |
2475 POINT *v16; // edx@23 | |
2476 int v17; // eax@32 | |
2477 char v18; // zf@37 | |
2478 int v19; // eax@41 | |
2479 int v20; // eax@46 | |
2480 int v21; // ecx@46 | |
2481 int v22; // eax@46 | |
2482 int v23; // [sp-4h] [bp-2Ch]@28 | |
2483 RECT pSrcXYZW; // [sp+Ch] [bp-1Ch]@6 | |
2484 POINT pTargetXY; // [sp+1Ch] [bp-Ch]@20 | |
2485 int v26; // [sp+24h] [bp-4h]@1 | |
2486 | |
1218 | 2487 v26 = animation_stage; |
1209 | 2488 if ( amuint_4FAA4C != -1 ) |
2489 { | |
2490 if ( amuint_4FAA38 >= 9 ) | |
2491 { | |
2492 am_uint_4FAA44_blt_xy.y = 18; | |
2493 am_uint_4FAA44_blt_xy.x = 120; | |
2494 v1 = GetPlayerHandCardCount(current_player_num); | |
2495 v2 = (640 - 96 * v1) / v1 + 96; | |
2496 if ( am_byte_4E185D ) | |
2497 { | |
2498 // v3 = 188 * current_player_num + 8 * amuint_4FAA4C; | |
2499 // amuint_4FAA3C_blt_xy.x = (amuint_4FAA4C * v2 + *(am_Players[0].arr_6C[0] + v3) - 120) / 10; | |
1256 | 2500 amuint_4FAA3C_blt_xy.x=(amuint_4FAA4C * v2 + am_Players[current_player_num].card_shift[amuint_4FAA4C].x-120)/10; |
2501 v4 = (am_Players[current_player_num].card_shift[amuint_4FAA4C].y+309) /10;//(*(&am_Players[0].arr_6C[0][1] + v3) + 309) / 10; | |
1209 | 2502 } |
2503 else | |
2504 { | |
2505 amuint_4FAA3C_blt_xy.x = (amuint_4FAA4C * v2 - 120) / 10; | |
2506 v4 = 30; | |
2507 } | |
2508 am_uint_4FAA44_blt_xy.y += v4; | |
2509 am_uint_4FAA44_blt_xy.x += amuint_4FAA3C_blt_xy.x; | |
1218 | 2510 |
1209 | 2511 amuint_4FAA3C_blt_xy.y = v4; |
1218 | 2512 |
1209 | 2513 pSrcXYZW.left = 192; |
1218 | 2514 pSrcXYZW.top = 0; |
1209 | 2515 pSrcXYZW.right = 288; |
2516 pSrcXYZW.bottom = 128; | |
2154 | 2517 pRenderer->am_Blt_Copy(&pSrcXYZW, &am_uint_4FAA44_blt_xy, 2); |
1209 | 2518 } |
1218 | 2519 else |
2520 { | |
2521 | |
2522 | |
2523 pSrcXYZW.left = 192; | |
2524 pSrcXYZW.top = 0; | |
2525 pSrcXYZW.right = 288; | |
1209 | 2526 pSrcXYZW.bottom = 128; |
2527 am_uint_4FAA44_blt_xy.x += amuint_4FAA3C_blt_xy.x; | |
2528 am_uint_4FAA44_blt_xy.y += amuint_4FAA3C_blt_xy.y; | |
2154 | 2529 pRenderer->am_Blt_Copy(&pSrcXYZW, &am_uint_4FAA44_blt_xy, 2); |
1218 | 2530 if ( !amuint_4FAA38 ) |
2531 { | |
2532 | |
1209 | 2533 amuint_4FAA4C = -1; |
1218 | 2534 } |
2535 } | |
1209 | 2536 } |
2537 LABEL_11: | |
1218 | 2538 |
1209 | 2539 if ( uCardID != -1 ) |
2540 { | |
2541 if ( v26 <= 10 ) | |
2542 { | |
2543 if ( v26 == 10 ) | |
2544 { | |
2545 pArcomageGame->GetCardRect(uCardID, &pSrcXYZW); | |
2546 // v8 = 0; | |
2547 for (v8=0; v8<10; ++v8) | |
2548 { | |
2549 if (shown_cards[v8].uCardId==-1) | |
2550 { | |
2551 shown_cards[v8].uCardId = uCardID; | |
2552 shown_cards[v8].field_4 = 1; | |
2553 break; | |
2554 } | |
2555 } | |
2556 /* v9 = shown_cards; | |
2557 while ( v9->uCardId != -1 ) | |
2558 { | |
2559 ++v9; | |
2560 ++v8; | |
2561 if ( v9 >= &dword_4FABB8 ) | |
2562 goto LABEL_20; | |
2563 } | |
2564 | |
2565 v10 = v8; | |
2566 shown_cards[v10].uCardId = uCardID; | |
2567 shown_cards[v10].field_4 = 1;*/ | |
2568 //LABEL_20: | |
2569 pTargetXY.x = shown_cards[v8].field_8.x; | |
2570 pTargetXY.y = shown_cards[v8].field_8.y; | |
2154 | 2571 pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 0); |
1209 | 2572 uCardID = -1; |
2573 } | |
2574 } | |
2575 else | |
2576 { | |
2577 pArcomageGame->GetCardRect(uCardID, &pSrcXYZW); | |
2578 amuint_4FAA5C_blt_xy.x += amuint_4FAA54_blt_xy.x; | |
2579 amuint_4FAA5C_blt_xy.y += amuint_4FAA54_blt_xy.y; | |
2154 | 2580 pRenderer->am_Blt_Copy(&pSrcXYZW, &amuint_4FAA5C_blt_xy, 0); |
1209 | 2581 } |
2582 } | |
1218 | 2583 |
1209 | 2584 if ( played_card_id != -1 ) |
2585 { | |
2586 v15 = v26; | |
2587 if ( v15 > 15.0 ) | |
2588 { | |
2589 pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW); | |
2590 amuint_4FAA5C_blt_xy.x += amuint_4FAA54_blt_xy.x; | |
2591 amuint_4FAA5C_blt_xy.y += amuint_4FAA54_blt_xy.y; | |
2154 | 2592 pRenderer->am_Blt_Copy(&pSrcXYZW, &amuint_4FAA5C_blt_xy, 2); |
1209 | 2593 return; |
2594 } | |
2595 if ( v15 == 15.0 ) | |
2596 { | |
1218 | 2597 ApplyCardToPlayer(current_player_num, played_card_id); |
1209 | 2598 pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW); |
2599 pTargetXY.x = 272; | |
2600 pTargetXY.y = 173; | |
2154 | 2601 pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 2); |
1209 | 2602 return; |
2603 } | |
2604 if ( v15 == 5.0 ) | |
2605 { | |
2606 amuint_4FAA5C_blt_xy.x = 272; | |
2607 amuint_4FAA5C_blt_xy.y = 173; | |
2608 for (v17=0; v17<10; ++v17) | |
2609 { | |
2610 if (shown_cards[v17].uCardId==-1) | |
2611 break; | |
2612 } | |
1263 | 2613 |
1209 | 2614 amuint_4FAA54_blt_xy.x = (shown_cards[v17].field_8.x - 272) / 5; |
2615 amuint_4FAA54_blt_xy.y = (shown_cards[v17].field_8.y - 173) / 5; | |
2616 pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW); | |
2617 pTargetXY.x = 272; | |
2618 pTargetXY.y = 173; | |
2154 | 2619 pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 2); |
1209 | 2620 return; |
2621 } | |
2622 if ( v15 >= 5.0 ) | |
2623 { | |
2624 v18 = v26 == 0; | |
2625 } | |
2626 else | |
2627 { | |
2628 v18 = v26 == 0; | |
2629 if ( v26 > 0 ) | |
2630 { | |
2631 pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW); | |
2632 amuint_4FAA5C_blt_xy.x += amuint_4FAA54_blt_xy.x; | |
2633 amuint_4FAA5C_blt_xy.y += amuint_4FAA54_blt_xy.y; | |
2154 | 2634 pRenderer->am_Blt_Copy(&pSrcXYZW, &amuint_4FAA5C_blt_xy, 0); |
1209 | 2635 return; |
2636 } | |
2637 } | |
2638 if ( !v18 ) | |
2639 { | |
2640 | |
1218 | 2641 pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW); |
1209 | 2642 pTargetXY.x = 272; |
2643 pTargetXY.y = 173; | |
2154 | 2644 pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 2); |
1209 | 2645 return; |
2646 } | |
1218 | 2647 |
1209 | 2648 pArcomageGame->GetCardRect(played_card_id, &pSrcXYZW); |
2649 for (v19=0; v19<10; ++v19) | |
2650 { | |
2651 if (shown_cards[v19].uCardId==-1) | |
2652 { | |
2653 shown_cards[v19].uCardId = played_card_id; | |
2654 break; | |
1218 | 2655 } |
1209 | 2656 } |
1218 | 2657 pTargetXY.x = shown_cards[v19].field_8.x; |
1209 | 2658 pTargetXY.y = shown_cards[v19].field_8.y; |
2154 | 2659 pRenderer->am_Blt_Copy(&pSrcXYZW, &pTargetXY, 0); |
1209 | 2660 played_card_id = -1; |
2661 } | |
0 | 2662 } |
2663 | |
2664 //----- (0040BB12) -------------------------------------------------------- | |
1183 | 2665 void ArcomageGame::GetCardRect(unsigned int uCardID, RECT *pCardRect) |
0 | 2666 { |
2667 int v3; // edx@1 | |
2668 int v4; // ecx@1 | |
2669 | |
2670 v3 = pCards[uCardID].slot % 10; | |
2671 v4 = (pCards[uCardID].slot / 10 << 7) + 220; | |
1183 | 2672 pCardRect->top = v4; |
2673 pCardRect->left = 96 * v3; | |
2674 pCardRect->bottom = v4 + 128; | |
2675 pCardRect->right = 96 * v3 + 96; | |
0 | 2676 } |
2677 | |
2678 //----- (0040BB49) -------------------------------------------------------- | |
1185 | 2679 int GetPlayerHandCardCount( int player_num ) |
2680 { | |
2681 int card_count; // eax@1 | |
2682 | |
2683 card_count = 0; | |
2684 for(int i=0; i<10; ++i) | |
2685 { | |
2686 if (am_Players[player_num].cards_at_hand[i]!=-1) | |
2687 ++card_count; | |
2688 } | |
2689 return card_count; | |
2690 | |
0 | 2691 } |
2692 | |
2693 //----- (0040BB67) -------------------------------------------------------- | |
1200 | 2694 signed int DrawCardsRectangles( int player_num ) |
1679 | 2695 { |
1200 | 2696 //int v1; // esi@1 |
1194 | 2697 signed int result; // eax@1 |
2698 int v3; // ebx@1 | |
2699 char v4; // zf@1 | |
2700 int v5; // eax@3 | |
2701 int v6; // eax@4 | |
2702 int v7; // ecx@6 | |
2703 char *v8; // eax@6 | |
2704 int v9; // eax@10 | |
2705 int v10; // ecx@10 | |
2706 int v11; // eax@10 | |
2707 char v12; // ch@2@11 | |
2708 int v13; // ST00_4@12 | |
2709 unsigned __int16 v14; // ax@12 | |
2710 int v15; // eax@13 | |
2711 int v16; // ecx@13 | |
2712 int v17; // eax@13 | |
2713 char v18; // al@16 | |
2714 char v19; // ch@2@16 | |
2715 int v20; // ST00_4@19 | |
2716 unsigned __int16 v21; // ax@19 | |
2717 RECT pXYZW; // [sp+Ch] [bp-3Ch]@3 | |
2718 stru273 v26; // [sp+1Ch] [bp-2Ch]@2 | |
2719 int v25; // [sp+2Ch] [bp-1Ch]@3 | |
2720 __int32 var18; // [sp+30h] [bp-18h]@3 | |
2721 int i; // [sp+34h] [bp-14h]@4 | |
2722 int v28; // [sp+38h] [bp-10h]@1 | |
2723 int hand_index; // [sp+3Ch] [bp-Ch]@3 | |
2724 int v30; // [sp+40h] [bp-8h]@1 | |
2725 char v31; // [sp+44h] [bp-4h]@12 | |
2726 char v32; // [sp+45h] [bp-3h]@12 | |
2727 char v33; // [sp+46h] [bp-2h]@12 | |
2728 | |
1679 | 2729 __debugbreak(); // need do fix rectangle not fit to card |
1200 | 2730 |
1194 | 2731 v30 = 0; |
2732 result = -1; | |
2733 //v3 = 188 * a1; | |
1200 | 2734 |
1194 | 2735 //v4 = LOBYTE(am_Players[a1].field_20) == 0; |
2736 v28 = -1; | |
1200 | 2737 if ( am_Players[player_num].IsHisTurn ) |
1194 | 2738 { |
0 | 2739 if ( v26._40DD2F() ) |
2740 { | |
1200 | 2741 v5 = GetPlayerHandCardCount(player_num); |
1194 | 2742 hand_index = 0; |
2743 v25 = v5; | |
2744 pXYZW.top = 327; | |
2745 pXYZW.bottom = 455; | |
2746 pXYZW.left = (640 - 96 * v5) / (v5 + 1); | |
2747 var18 = pXYZW.left + 96; | |
2748 pXYZW.right = pXYZW.left + 96; | |
2749 if ( v5 > 0 ) | |
0 | 2750 { |
1194 | 2751 // v6 = 47 * v1; |
1200 | 2752 // for ( i = player_num; ; v6 = i ) |
2753 for(;;) | |
1194 | 2754 { |
2755 v7 = v30; | |
2756 // v8 = &am_Players[0].cards_at_hand[v30 + v6]; | |
2757 | |
2758 for (v7=0; v7<10; ++v7) | |
2759 { | |
1200 | 2760 if (am_Players[player_num].cards_at_hand[v7]!= -1 ) |
1194 | 2761 break; |
2762 } | |
2763 //if ( *v8 ) | |
2764 // { | |
2765 // do | |
2766 // { | |
2767 // //v8 += 4; | |
2768 // ++v7; | |
2769 // } | |
2770 // while ( *v8 == -1 ); | |
2771 v30 = v7; | |
2772 // } | |
2773 if ( am_byte_4E185D ) | |
2774 { | |
2775 // v9 = v3 + 8 * v7; | |
1256 | 2776 v10 = am_Players[player_num].card_shift[v7].x;//*(am_player[0].arr_6C[0] + v9); |
2777 v11 = am_Players[player_num].card_shift[v7].y;//*(&am_player[0].arr_6C[0][1] + v9); | |
1194 | 2778 pXYZW.left += v10; |
2779 pXYZW.right += v10; | |
2780 pXYZW.top += v11; | |
2781 pXYZW.bottom += v11; | |
2782 } | |
2783 if (v26.Inside(&pXYZW) ) | |
2784 break; | |
2785 | |
2786 v13=0; | |
2787 v14 = R8G8B8_to_TargetFormat(v13); | |
2788 DrawRect(&pXYZW, v14, 0); | |
2789 pXYZW.left += var18; | |
2790 pXYZW.right += var18; | |
2791 if ( am_byte_4E185D ) | |
2792 { | |
1256 | 2793 v16 = am_Players[player_num].card_shift[v30].x;//*(am_player[0].arr_6C[0] + v15); |
2794 v17 = am_Players[player_num].card_shift[v30].y;//*(&am_player[0].arr_6C[0][1] + v15); | |
1194 | 2795 pXYZW.left -= v16; |
2796 pXYZW.right -= v16; | |
2797 pXYZW.top -= v17; | |
2798 pXYZW.bottom -= v17; | |
2799 } | |
2800 ++v30; | |
2801 ++hand_index; | |
2802 if ( hand_index >= v25 ) | |
2803 return v28; | |
2804 } | |
2805 v28 = hand_index; | |
1197 | 2806 v18 = CanCardBePlayed(player_num, hand_index); |
1194 | 2807 if ( v18 ) |
2808 { | |
2809 v20=0x00FFFFFF; | |
2810 } | |
2811 else | |
2812 { | |
2813 v20=0x000000FF; | |
2814 } | |
2815 | |
2816 v21 = R8G8B8_to_TargetFormat(v20); | |
2817 DrawRect(&pXYZW, v21, 0); | |
0 | 2818 } |
2819 } | |
1194 | 2820 result = v28; |
0 | 2821 } |
1194 | 2822 return result; |
2823 | |
2824 | |
0 | 2825 } |
2826 // 4E185D: using guessed type char am_byte_4E185D; | |
2827 | |
2828 //----- (0040BCFB) -------------------------------------------------------- | |
1256 | 2829 bool DiscardCard( int player_num, signed int card_slot_index ) |
1200 | 2830 { |
0 | 2831 int v2; // esi@2 |
2832 signed int v3; // edi@2 | |
2833 char *v4; // eax@2 | |
2834 int v5; // ecx@7 | |
2835 int v6; // ebx@7 | |
2836 int v7; // esi@8 | |
2837 int v8; // eax@8 | |
2838 int v9; // esi@8 | |
2839 int v10; // ecx@8 | |
2840 int v11; // eax@8 | |
2841 int v12; // eax@8 | |
2842 signed int v13; // edx@9 | |
2843 unsigned int v14; // eax@12 | |
2844 char result; // al@12 | |
1194 | 2845 int i; |
0 | 2846 |
1200 | 2847 if ( card_slot_index <= -1 ) |
1209 | 2848 return false; |
0 | 2849 v2 = 0; |
1194 | 2850 |
2851 for(i=0; i<10; ++i) | |
0 | 2852 { |
1200 | 2853 if ( am_Players[player_num].cards_at_hand[i] != -1 ) |
0 | 2854 { |
1200 | 2855 if ( card_slot_index == v2 ) |
0 | 2856 break; |
2857 ++v2; | |
2858 } | |
2859 } | |
1194 | 2860 |
1263 | 2861 if ( pCards[am_Players[player_num].cards_at_hand[i]].can_be_discarded) |
0 | 2862 { |
1209 | 2863 ArcomageGame::PlaySound(22); |
1197 | 2864 v8 = GetPlayerHandCardCount(current_player_num); |
1256 | 2865 v10=am_Players[player_num].card_shift[i].x + (640 - 96 * v8) / (v8 + 1); |
1209 | 2866 amuint_4FAA5C_blt_xy.x = v10; |
1256 | 2867 amuint_4FAA5C_blt_xy.y = am_Players[player_num].card_shift[i].y + 327;//v11; |
0 | 2868 v12 = 0; |
1209 | 2869 |
0 | 2870 if ( !am_byte_4FAA75 ) |
2871 { | |
1209 | 2872 for (v12=0; v12<10; ++v12) |
2873 { | |
2874 if (shown_cards[v12].uCardId== -1) | |
2875 break; | |
2876 } | |
0 | 2877 } |
2878 pArcomageGame->field_F6 = 1; | |
1209 | 2879 amuint_4FAA54_blt_xy.x = (shown_cards[v12].field_8.x - v10) / 10; |
2880 amuint_4FAA54_blt_xy.y = (shown_cards[v12].field_8.y - 327) / 10; | |
2881 uCardID = am_Players[player_num].cards_at_hand[i]; | |
2882 am_Players[player_num].cards_at_hand[i] = -1; | |
1263 | 2883 need_to_discard_card = 0; |
1209 | 2884 return true; |
0 | 2885 } |
2886 else | |
1209 | 2887 return false; |
0 | 2888 } |
1263 | 2889 |
0 | 2890 |
2891 //----- (0040BE0E) -------------------------------------------------------- | |
1679 | 2892 bool PlayCard( int player_num, int card_slot_num ) |
2893 { | |
0 | 2894 int v3; // ebp@1 |
2895 int v4; // ecx@2 | |
1183 | 2896 ArcomagePlayer *v5; // esi@2 |
1263 | 2897 int card_index; // edi@2 |
0 | 2898 int v7; // eax@2 |
2899 int v8; // ebx@8 | |
1263 | 2900 int cards_at_hand; // eax@8 |
0 | 2901 int v10; // ebx@8 |
2902 int v11; // ebp@8 | |
2903 int v12; // ecx@8 | |
2904 int v13; // eax@8 | |
1263 | 2905 ArcomageCard *pCard; // eax@8 |
0 | 2906 int v15; // ecx@8 |
2907 int v16; // ecx@8 | |
2908 | |
1197 | 2909 if ( card_slot_num <= -1 ) |
2910 return false; | |
1263 | 2911 |
0 | 2912 v4 = 0; |
1263 | 2913 for (card_index=0; card_index<10; ++card_index) |
0 | 2914 { |
1263 | 2915 if ( am_Players[player_num].cards_at_hand[card_index] != -1 ) |
0 | 2916 { |
1197 | 2917 if ( card_slot_num == v4 ) |
0 | 2918 break; |
2919 ++v4; | |
2920 } | |
2921 } | |
1209 | 2922 |
1263 | 2923 if (CanCardBePlayed(player_num, card_index) ) |
0 | 2924 { |
1209 | 2925 ArcomageGame::PlaySound(23); |
1263 | 2926 cards_at_hand = GetPlayerHandCardCount(current_player_num); |
0 | 2927 pArcomageGame->field_F6 = 1; |
1263 | 2928 v12 = am_Players[player_num].card_shift[card_index].x + |
2929 (640 - 96 * cards_at_hand) / (cards_at_hand + 1)+ | |
2930 96 * card_index ; | |
2931 | |
1185 | 2932 // v13 = *(int *)((char *)&am_Players[0].arr_6C[0][1] + v10) + 327; |
1218 | 2933 amuint_4FAA5C_blt_xy.x = v12;//v12; |
1263 | 2934 amuint_4FAA5C_blt_xy.y = am_Players[player_num].card_shift[card_index].y + 327;//v13; |
1209 | 2935 |
2936 amuint_4FAA54_blt_xy.x = (272 - v12) / 5; | |
2937 amuint_4FAA54_blt_xy.y = -30; | |
1200 | 2938 |
1263 | 2939 pCard = &pCards[am_Players[player_num].cards_at_hand[card_index]]; |
2940 am_Players[player_num].resource_bricks -= pCard->needed_bricks; | |
2941 am_Players[player_num].resource_beasts -= pCard->needed_beasts; | |
2942 am_Players[player_num].resource_gems -= pCard->needed_gems; | |
2943 played_card_id = am_Players[player_num].cards_at_hand[card_index]; | |
2944 am_Players[player_num].cards_at_hand[card_index] = -1; | |
2945 return true; | |
0 | 2946 } |
2947 else | |
1197 | 2948 return false; |
2949 | |
0 | 2950 } |
2951 | |
2952 //----- (0040BF15) -------------------------------------------------------- | |
1679 | 2953 bool CanCardBePlayed(int player_num, int hand_card_indx) |
2954 { | |
0 | 2955 bool result; // eax@1 |
1197 | 2956 ArcomageCard *test_card; // ecx@1 |
2957 ArcomagePlayer *pPlayer; // esi@1 | |
2958 | |
2959 pPlayer = &am_Players[player_num]; | |
1185 | 2960 result = true; |
1197 | 2961 test_card = &pCards[am_Players[player_num].cards_at_hand[hand_card_indx]]; |
2962 if ( test_card->needed_quarry_level > pPlayer->quarry_level ) | |
1185 | 2963 result = false; |
1197 | 2964 if ( test_card->needed_magic_level > pPlayer->magic_level ) |
1185 | 2965 result = false; |
1679 | 2966 if ( test_card->needed_zoo_level > pPlayer->zoo_level ) |
1185 | 2967 result = false; |
1197 | 2968 if ( test_card->needed_bricks > pPlayer->resource_bricks ) |
1185 | 2969 result = false; |
1197 | 2970 if ( test_card->needed_gems > pPlayer->resource_gems ) |
1185 | 2971 result = false; |
1197 | 2972 if ( test_card->needed_beasts > pPlayer->resource_beasts ) |
1185 | 2973 result = false; |
0 | 2974 return result; |
2975 } | |
2976 | |
2977 | |
2978 | |
2979 | |
2980 //----- (0040BF77) -------------------------------------------------------- | |
1218 | 2981 void ApplyCardToPlayer( int player_num, unsigned int uCardID ) |
2982 { | |
1245 | 2983 |
2984 | |
2985 #define APPLY_TO_PLAYER( PLAYER, ENEMY,FIELD, VAL, RES )\ | |
1246 | 2986 if (VAL != 0) {\ |
2987 if (VAL == 99) {\ | |
2988 if ( PLAYER->##FIELD < ENEMY->##FIELD ) {\ | |
2989 PLAYER->##FIELD = ENEMY->##FIELD;\ | |
2990 RES = ENEMY->##FIELD - PLAYER->##FIELD;\ | |
2991 }\ | |
2992 } else {\ | |
2993 PLAYER->##FIELD += (signed int)(VAL);\ | |
2994 if ( PLAYER->##FIELD<0 ) PLAYER->##FIELD= 0;\ | |
2995 RES = (signed int)(VAL);\ | |
1245 | 2996 }\ |
1246 | 2997 } |
1245 | 2998 |
2999 #define APPLY_TO_ENEMY( PLAYER, ENEMY,FIELD, VAL, RES ) APPLY_TO_PLAYER(ENEMY, PLAYER, FIELD, VAL, RES) | |
3000 | |
3001 #define APPLY_TO_BOTH( PLAYER, ENEMY, FIELD, VAL, RES_P, RES_E ) \ | |
1246 | 3002 if ( VAL != 0) {\ |
3003 if ( VAL == 99 ) { \ | |
1245 | 3004 if ( PLAYER->##FIELD != ENEMY->##FIELD ) { \ |
3005 if ( PLAYER->##FIELD <= ENEMY->##FIELD ) { \ | |
3006 PLAYER->##FIELD = ENEMY->##FIELD; \ | |
3007 RES_P = ENEMY->##FIELD - PLAYER->##FIELD; \ | |
3008 } else { \ | |
3009 ENEMY->##FIELD = PLAYER->##FIELD; \ | |
3010 RES_E = PLAYER->##FIELD - ENEMY->##FIELD; \ | |
3011 } \ | |
3012 }\ | |
1246 | 3013 } else { \ |
1245 | 3014 PLAYER->##FIELD += (signed int)(VAL);\ |
3015 ENEMY->##FIELD += (signed int)(VAL); if (PLAYER->##FIELD < 0 ) {PLAYER->##FIELD = 0;} \ | |
3016 if ( ENEMY->##FIELD < 0 ) {ENEMY->##FIELD = 0;} \ | |
1246 | 3017 RES_P = (signed int)(VAL); RES_E = (signed int)(VAL); \ |
3018 }\ | |
3019 } | |
1245 | 3020 ArcomagePlayer *player; // esi@1 |
3021 int v3; // eax@1 | |
3022 ArcomagePlayer *enemy; // edi@1 | |
3023 int v5; // eax@2 | |
3024 char v6; // sf@2 | |
3025 unsigned __int8 v7; // of@2 | |
3026 int v8; // eax@3 | |
3027 int v9; // eax@4 | |
3028 char v10; // zf@5 | |
3029 int v11; // eax@8 | |
3030 unsigned __int8 v12; // zf@8 | |
3031 char v13; // sf@8 | |
3032 unsigned __int8 v14; // of@8 | |
3033 int v15; // eax@9 | |
3034 int v16; // eax@10 | |
3035 char v17; // zf@12 | |
3036 char v18; // al@15 | |
3037 int v19; // eax@16 | |
3038 int v20; // eax@17 | |
3039 int v21; // eax@22 | |
3040 int v22; // eax@23 | |
3041 int v23; // eax@26 | |
3042 signed int v24; // ebx@26 | |
3043 int v103; | |
3044 int v104; | |
3045 | |
3046 POINT v184; // [sp+Ch] [bp-64h]@488 | |
3047 int enemy_num; // [sp+14h] [bp-5Ch]@1 | |
3048 ArcomageCard *pCard; // [sp+18h] [bp-58h]@1 | |
3049 int buildings_e; // [sp+1Ch] [bp-54h]@1 | |
3050 int buildings_p; // [sp+20h] [bp-50h]@1 | |
3051 int quarry_p; // [sp+28h] [bp-48h]@1 | |
3052 int dmg_e; // [sp+2Ch] [bp-44h]@1 | |
3053 int dmg_p; // [sp+30h] [bp-40h]@1 | |
3054 int bricks_p; // [sp+34h] [bp-3Ch]@1 | |
3055 int tower_e; // [sp+38h] [bp-38h]@1 | |
3056 int tower_p; // [sp+3Ch] [bp-34h]@1 | |
3057 int wall_e; // [sp+40h] [bp-30h]@1 | |
3058 int wall_p; // [sp+44h] [bp-2Ch]@1 | |
3059 int beasts_e; // [sp+48h] [bp-28h]@1 | |
3060 int beasts_p; // [sp+4Ch] [bp-24h]@1 | |
3061 int gems_e; // [sp+50h] [bp-20h]@1 | |
3062 int gems_p; // [sp+54h] [bp-1Ch]@1 | |
3063 int bricks_e; // [sp+58h] [bp-18h]@1 | |
3064 int zoo_e; // [sp+5Ch] [bp-14h]@1 | |
3065 int zoo_p; // [sp+60h] [bp-10h]@1 | |
3066 int magic_e; // [sp+64h] [bp-Ch]@1 | |
3067 int magic_p; // [sp+68h] [bp-8h]@1 | |
3068 int quarry_e; // [sp+6Ch] [bp-4h]@1 | |
3069 | |
1246 | 3070 quarry_p = 0; |
3071 magic_p = 0; | |
3072 zoo_p = 0; | |
3073 bricks_p = 0; | |
3074 gems_p = 0; | |
3075 beasts_p = 0; | |
3076 wall_p = 0; | |
3077 tower_p = 0; | |
1245 | 3078 buildings_p = 0; |
1246 | 3079 dmg_p = 0; |
3080 quarry_e = 0; | |
3081 magic_e = 0; | |
3082 zoo_e = 0; | |
3083 bricks_e = 0; | |
3084 gems_e = 0; | |
3085 beasts_e = 0; | |
3086 wall_e = 0; | |
3087 tower_e = 0; | |
1245 | 3088 buildings_e = 0; |
1246 | 3089 dmg_e = 0; |
1245 | 3090 |
3091 player = &am_Players[player_num]; | |
3092 pCard = &pCards[uCardID]; | |
3093 enemy_num = (player_num + 1) % 2; | |
3094 enemy = &am_Players[enemy_num]; | |
3095 switch ( pCard->compare_param ) | |
3096 { | |
3097 case 2: | |
3098 v5 = player->quarry_level; | |
3099 v7 = __OFSUB__(v5, enemy->quarry_level); | |
3100 v6 = v5 - enemy->quarry_level < 0; | |
1263 | 3101 v18 = v6 ^ v7; |
3102 goto LABEL_25; | |
1245 | 3103 case 3: |
3104 v8 = player->magic_level; | |
3105 v7 = __OFSUB__(v8, enemy->magic_level); | |
3106 v6 = v8 - enemy->magic_level < 0; | |
1263 | 3107 v18 = v6 ^ v7; |
3108 goto LABEL_25; | |
1245 | 3109 case 4: |
3110 v9 = player->zoo_level; | |
3111 v7 = __OFSUB__(v9, enemy->zoo_level); | |
3112 v6 = v9 - enemy->zoo_level < 0; | |
1263 | 3113 v18 = v6 ^ v7; |
3114 goto LABEL_25; | |
1245 | 3115 case 5: |
3116 v10 = player->quarry_level == enemy->quarry_level; | |
1263 | 3117 v18 = v10; |
3118 goto LABEL_25; | |
1245 | 3119 case 6: |
3120 v10 = player->magic_level == enemy->magic_level; | |
1263 | 3121 v18 = v10; |
3122 goto LABEL_25; | |
1245 | 3123 case 7: |
3124 v10 = player->zoo_level == enemy->zoo_level; | |
1263 | 3125 v18 = v10; |
3126 goto LABEL_25; | |
1245 | 3127 case 8: |
3128 v11 = player->quarry_level; | |
3129 v14 = __OFSUB__(v11, enemy->quarry_level); | |
3130 v12 = v11 == enemy->quarry_level; | |
3131 v13 = v11 - enemy->quarry_level < 0; | |
1263 | 3132 v18 = !((v13 ^ v14) | v12); |
3133 goto LABEL_25; | |
1245 | 3134 case 9: |
3135 v15 = player->magic_level; | |
3136 v14 = __OFSUB__(v15, enemy->magic_level); | |
3137 v12 = v15 == enemy->magic_level; | |
3138 v13 = v15 - enemy->magic_level < 0; | |
1263 | 3139 v18 = !((v13 ^ v14) | v12); |
3140 goto LABEL_25; | |
1245 | 3141 case 10: |
3142 v16 = player->zoo_level; | |
3143 v14 = __OFSUB__(v16, enemy->zoo_level); | |
3144 v12 = v16 == enemy->zoo_level; | |
3145 v13 = v16 - enemy->zoo_level < 0; | |
1263 | 3146 v18 = !((v13 ^ v14) | v12); |
3147 goto LABEL_25; | |
1245 | 3148 case 11: |
3149 v10 = player->wall_height == 0; | |
1263 | 3150 v18 = v10; |
3151 goto LABEL_25; | |
1245 | 3152 case 12: |
3153 v17 = player->wall_height == 0; | |
1263 | 3154 v18 = !v17; |
3155 goto LABEL_25; | |
1245 | 3156 case 13: |
3157 v10 = enemy->wall_height == 0; | |
1263 | 3158 v18 = v10; |
3159 goto LABEL_25; | |
1245 | 3160 case 14: |
3161 v17 = enemy->wall_height == 0; | |
3162 v18 = !v17; | |
3163 goto LABEL_25; | |
3164 case 15: | |
3165 v19 = player->wall_height; | |
3166 v7 = __OFSUB__(v19, enemy->wall_height); | |
3167 v6 = v19 - enemy->wall_height < 0; | |
1263 | 3168 v18 = v6 ^ v7; |
3169 goto LABEL_25; | |
1245 | 3170 case 16: |
3171 v20 = player->tower_height; | |
3172 v7 = __OFSUB__(v20, enemy->tower_height); | |
3173 v6 = v20 - enemy->tower_height < 0; | |
3174 v18 = v6 ^ v7; | |
3175 goto LABEL_25; | |
3176 case 17: | |
3177 v10 = player->wall_height == enemy->wall_height; | |
1263 | 3178 v18 = v10; |
3179 goto LABEL_25; | |
1245 | 3180 case 18: |
3181 v10 = player->tower_height == enemy->tower_height; | |
3182 v18 = v10; | |
3183 goto LABEL_25; | |
3184 case 19: | |
3185 v21 = player->wall_height; | |
3186 v14 = __OFSUB__(v21, enemy->wall_height); | |
3187 v12 = v21 == enemy->wall_height; | |
3188 v13 = v21 - enemy->wall_height < 0; | |
1263 | 3189 v18 = !((v13 ^ v14) | v12); |
3190 goto LABEL_25; | |
1245 | 3191 case 20: |
3192 v22 = player->tower_height; | |
3193 v14 = __OFSUB__(v22, enemy->tower_height); | |
3194 v12 = v22 == enemy->tower_height; | |
3195 v13 = v22 - enemy->tower_height < 0; | |
3196 v18 = !((v13 ^ v14) | v12); | |
3197 LABEL_25: | |
3198 if ( v18 ) | |
3199 goto LABEL_26; | |
3200 goto LABEL_231; | |
3201 default: | |
3202 LABEL_26: | |
1263 | 3203 v23 = pCard->draw_extra_card_count; |
1245 | 3204 v24 = 0; |
3205 dword_4FAA68 = v23 + (pCard->field_30 == 1); | |
3206 dword_4FAA64 = v23; | |
3207 if ( v23 > 0 ) | |
3208 { | |
3209 do | |
3210 { | |
3211 GetNextCardFromDeck(player_num); | |
3212 ++v24; | |
3213 } | |
1263 | 3214 while ( v24 < pCard->draw_extra_card_count ); |
1245 | 3215 } |
3216 | |
1263 | 3217 need_to_discard_card = GetPlayerHandCardCount(player_num) > minimum_cards_at_hand; |
1245 | 3218 |
3219 | |
3220 APPLY_TO_PLAYER(player, enemy, quarry_level, pCard->to_player_quarry_lvl, quarry_p); | |
3221 APPLY_TO_PLAYER(player, enemy, magic_level, pCard->to_player_magic_lvl, magic_p); | |
3222 APPLY_TO_PLAYER(player, enemy, zoo_level, pCard->to_player_zoo_lvl, zoo_p); | |
3223 APPLY_TO_PLAYER(player, enemy, resource_bricks, pCard->to_player_bricks, bricks_p); | |
3224 APPLY_TO_PLAYER(player, enemy, resource_gems, pCard->to_player_gems, gems_p); | |
3225 APPLY_TO_PLAYER(player, enemy, resource_beasts, pCard->to_player_beasts, beasts_p); | |
1246 | 3226 if ( pCard->to_player_buildings ) |
1245 | 3227 { |
1246 | 3228 dmg_p = ApplyDamageToBuildings(player_num, (signed int)pCard->to_player_buildings); |
3229 buildings_p = (signed int)pCard->to_player_buildings - dmg_p; | |
1245 | 3230 } |
1246 | 3231 APPLY_TO_PLAYER(player, enemy, wall_height, pCard->to_player_wall, wall_p); |
3232 APPLY_TO_PLAYER(player, enemy, tower_height, pCard->to_player_tower, tower_p); | |
1245 | 3233 |
3234 APPLY_TO_ENEMY(player, enemy, quarry_level, pCard->to_enemy_quarry_lvl, quarry_e); | |
3235 APPLY_TO_ENEMY(player, enemy, magic_level, pCard->to_enemy_magic_lvl, magic_e); | |
3236 APPLY_TO_ENEMY(player, enemy, zoo_level, pCard->to_enemy_zoo_lvl, zoo_e); | |
3237 APPLY_TO_ENEMY(player, enemy, resource_bricks, pCard->to_enemy_bricks, bricks_e); | |
3238 APPLY_TO_ENEMY(player, enemy, resource_gems, pCard->to_enemy_gems, gems_e); | |
3239 APPLY_TO_ENEMY(player, enemy, resource_beasts, pCard->to_enemy_beasts, beasts_e); | |
3240 if ( pCard->to_enemy_buildings ) | |
3241 { | |
1246 | 3242 dmg_e = ApplyDamageToBuildings(enemy_num, (signed int)pCard->to_enemy_buildings); |
3243 buildings_e = (signed int)pCard->to_enemy_buildings - dmg_e; | |
1245 | 3244 } |
3245 APPLY_TO_ENEMY(player, enemy, wall_height, pCard->to_enemy_wall, wall_e); | |
3246 APPLY_TO_ENEMY(player, enemy, tower_height, pCard->to_enemy_tower, tower_e); | |
3247 | |
3248 APPLY_TO_BOTH(player, enemy, quarry_level, pCard->to_pl_enm_quarry_lvl, quarry_p, quarry_e); | |
3249 APPLY_TO_BOTH(player, enemy, magic_level, pCard->to_pl_enm_magic_lvl, magic_p, magic_e); | |
3250 APPLY_TO_BOTH(player, enemy, zoo_level, pCard->to_pl_enm_zoo_lvl, zoo_p, zoo_e); | |
3251 APPLY_TO_BOTH(player, enemy, resource_bricks, pCard->to_pl_enm_bricks, bricks_p, bricks_e); | |
3252 APPLY_TO_BOTH(player, enemy, resource_gems, pCard->to_pl_enm_gems, gems_p, gems_e); | |
3253 APPLY_TO_BOTH(player, enemy, resource_beasts, pCard->to_pl_enm_beasts, beasts_p, beasts_e); | |
3254 if ( pCard->to_pl_enm_buildings ) | |
3255 { | |
1246 | 3256 dmg_p = ApplyDamageToBuildings(player_num, (signed int)pCard->to_pl_enm_buildings); |
3257 dmg_e = ApplyDamageToBuildings(enemy_num, (signed int)pCard->to_pl_enm_buildings); | |
3258 buildings_p = (signed int)pCard->to_pl_enm_buildings - dmg_p; | |
3259 buildings_e = (signed int)pCard->to_pl_enm_buildings - dmg_e; | |
1245 | 3260 } |
3261 APPLY_TO_BOTH(player, enemy, wall_height, pCard->to_pl_enm_wall, wall_p, wall_e); | |
3262 APPLY_TO_BOTH(player, enemy, tower_height, pCard->to_pl_enm_tower, tower_p, tower_e); | |
3263 break; | |
3264 case 0: | |
3265 LABEL_231: | |
3266 v103 = pCard->can_draw_extra_card2; | |
3267 v104 = 0; | |
3268 dword_4FAA68 = v103 + (pCard->field_4D == 1); | |
3269 dword_4FAA64 = v103; | |
3270 if ( v103 > 0 ) | |
3271 { | |
3272 do | |
3273 { | |
3274 GetNextCardFromDeck(player_num); | |
3275 ++v104; | |
3276 } | |
3277 while ( v104 < pCard->can_draw_extra_card2 ); | |
3278 } | |
3279 | |
1263 | 3280 need_to_discard_card = GetPlayerHandCardCount(player_num) > minimum_cards_at_hand; |
1245 | 3281 |
3282 APPLY_TO_PLAYER(player, enemy, quarry_level, pCard->to_player_quarry_lvl2, quarry_p); | |
3283 APPLY_TO_PLAYER(player, enemy, magic_level, pCard->to_player_magic_lvl2, magic_p); | |
3284 APPLY_TO_PLAYER(player, enemy, zoo_level, pCard->to_player_zoo_lvl2, zoo_p); | |
3285 APPLY_TO_PLAYER(player, enemy, resource_bricks, pCard->to_player_bricks2, bricks_p); | |
3286 APPLY_TO_PLAYER(player, enemy, resource_gems, pCard->to_player_gems2, gems_p); | |
3287 APPLY_TO_PLAYER(player, enemy, resource_beasts, pCard->to_player_beasts2, beasts_p); | |
3288 if ( pCard->to_player_buildings2 ) | |
3289 { | |
1246 | 3290 dmg_p = ApplyDamageToBuildings(player_num, (signed int)pCard->to_player_buildings2); |
3291 buildings_p = (signed int)pCard->to_player_buildings2 - dmg_p; | |
1245 | 3292 } |
3293 APPLY_TO_PLAYER(player, enemy, wall_height, pCard->to_player_wall2, wall_p); | |
3294 APPLY_TO_PLAYER(player, enemy, tower_height, pCard->to_player_tower2, tower_p); | |
3295 | |
3296 APPLY_TO_ENEMY(player, enemy, quarry_level, pCard->to_enemy_quarry_lvl2, quarry_e); | |
3297 APPLY_TO_ENEMY(player, enemy, magic_level, pCard->to_enemy_magic_lvl2, magic_e); | |
3298 APPLY_TO_ENEMY(player, enemy, zoo_level, pCard->to_enemy_zoo_lvl2, zoo_e); | |
3299 APPLY_TO_ENEMY(player, enemy, resource_bricks, pCard->to_enemy_bricks2, bricks_e); | |
3300 APPLY_TO_ENEMY(player, enemy, resource_gems, pCard->to_enemy_gems2, gems_e); | |
3301 APPLY_TO_ENEMY(player, enemy, resource_beasts, pCard->to_enemy_beasts2, beasts_e); | |
3302 if ( pCard->to_enemy_buildings2 ) | |
3303 { | |
1246 | 3304 dmg_e = ApplyDamageToBuildings(enemy_num, (signed int)pCard->to_enemy_buildings2); |
3305 buildings_e = (signed int)pCard->to_enemy_buildings2 - dmg_e; | |
1245 | 3306 } |
3307 APPLY_TO_ENEMY(player, enemy, wall_height, pCard->to_enemy_wall2, wall_e); | |
3308 APPLY_TO_ENEMY(player, enemy, tower_height, pCard->to_enemy_tower2, tower_e); | |
3309 | |
3310 APPLY_TO_BOTH(player, enemy, quarry_level, pCard->to_pl_enm_quarry_lvl2, quarry_p, quarry_e); | |
3311 APPLY_TO_BOTH(player, enemy, magic_level, pCard->to_pl_enm_magic_lvl2, magic_p, magic_e); | |
3312 APPLY_TO_BOTH(player, enemy, zoo_level, pCard->to_pl_enm_zoo_lvl2, zoo_p, zoo_e); | |
3313 APPLY_TO_BOTH(player, enemy, resource_bricks, pCard->to_pl_enm_bricks2, bricks_p, bricks_e); | |
3314 APPLY_TO_BOTH(player, enemy, resource_gems, pCard->to_pl_enm_gems2, gems_p, gems_e); | |
3315 APPLY_TO_BOTH(player, enemy, resource_beasts, pCard->to_pl_enm_beasts2, beasts_p, beasts_e); | |
3316 | |
3317 if ( pCard->to_pl_enm_buildings2 ) | |
3318 { | |
1246 | 3319 dmg_p = ApplyDamageToBuildings(player_num, (signed int)pCard->to_pl_enm_buildings2); |
3320 dmg_e = ApplyDamageToBuildings(enemy_num, (signed int)pCard->to_pl_enm_buildings2); | |
3321 buildings_p = (signed int)pCard->to_pl_enm_buildings2 - dmg_p; | |
3322 buildings_e = (signed int)pCard->to_pl_enm_buildings2 - dmg_e; | |
1245 | 3323 } |
3324 APPLY_TO_BOTH(player, enemy, wall_height, pCard->to_pl_enm_wall2, wall_p, wall_e); | |
3325 APPLY_TO_BOTH(player, enemy, tower_height, pCard->to_pl_enm_tower2, tower_p, tower_e); | |
3326 break; | |
3327 } | |
3328 // } | |
3329 if ( quarry_p > 0 || quarry_e > 0 ) | |
3330 pArcomageGame->PlaySound(30); | |
3331 if ( quarry_p < 0 || quarry_e < 0 ) | |
3332 pArcomageGame->PlaySound(31); | |
3333 if ( magic_p > 0 || magic_e > 0 ) | |
3334 pArcomageGame->PlaySound(33); | |
3335 if ( magic_p < 0 || magic_e < 0 ) | |
3336 pArcomageGame->PlaySound(34); | |
3337 if ( zoo_p > 0 || zoo_e > 0 ) | |
3338 pArcomageGame->PlaySound(36); | |
3339 if ( zoo_p < 0 || zoo_e < 0 ) | |
3340 pArcomageGame->PlaySound(37); | |
3341 if ( bricks_p > 0 || bricks_e > 0 ) | |
3342 pArcomageGame->PlaySound(39); | |
3343 if ( bricks_p < 0 || bricks_e < 0 ) | |
3344 pArcomageGame->PlaySound(40); | |
3345 if ( gems_p > 0 || gems_e > 0 ) | |
3346 pArcomageGame->PlaySound(42); | |
3347 if ( gems_p < 0 || gems_e < 0 ) | |
3348 pArcomageGame->PlaySound(43); | |
3349 if ( beasts_p > 0 || beasts_e > 0 ) | |
3350 pArcomageGame->PlaySound(45u); | |
3351 if ( beasts_p < 0 || beasts_e < 0 ) | |
3352 pArcomageGame->PlaySound(46); | |
3353 if ( buildings_p || buildings_e || dmg_p || dmg_e ) | |
3354 pArcomageGame->PlaySound(48); | |
3355 if ( wall_p > 0 || wall_e > 0 ) | |
3356 pArcomageGame->PlaySound(49); | |
3357 if ( wall_p < 0 || wall_e < 0 ) | |
3358 pArcomageGame->PlaySound(50); | |
3359 if ( tower_p > 0 || tower_e > 0 ) | |
3360 pArcomageGame->PlaySound(52); | |
3361 if ( tower_p < 0 || tower_e < 0 ) | |
3362 pArcomageGame->PlaySound(53); | |
3363 if ( player_num ) | |
3364 { | |
3365 if ( quarry_p ) | |
3366 { | |
3367 v184.x = 573; | |
3368 v184.y = 92; | |
3369 am_40D2B4(&v184, quarry_p); | |
3370 } | |
3371 if ( quarry_e ) | |
3372 { | |
3373 v184.x = 26; | |
3374 v184.y = 92; | |
3375 am_40D2B4(&v184, quarry_e); | |
3376 } | |
3377 if ( magic_p ) | |
3378 { | |
3379 v184.x = 573; | |
3380 v184.y = 164; | |
3381 am_40D2B4(&v184, magic_p); | |
3382 } | |
3383 if ( magic_e ) | |
3384 { | |
3385 v184.x = 26; | |
3386 v184.y = 164; | |
3387 am_40D2B4(&v184, magic_e); | |
3388 } | |
3389 if ( zoo_p ) | |
3390 { | |
3391 v184.x = 573; | |
3392 v184.y = 236; | |
3393 am_40D2B4(&v184, zoo_p); | |
3394 } | |
3395 if ( zoo_e ) | |
3396 { | |
3397 v184.x = 26; | |
3398 v184.y = 236; | |
3399 am_40D2B4(&v184, zoo_e); | |
3400 } | |
3401 if ( bricks_p ) | |
3402 { | |
3403 v184.x = 563; | |
3404 v184.y = 114; | |
3405 am_40D2B4(&v184, bricks_p); | |
3406 } | |
3407 if ( bricks_e ) | |
3408 { | |
3409 v184.x = 16; | |
3410 v184.y = 114; | |
3411 am_40D2B4(&v184, bricks_e); | |
3412 } | |
3413 if ( gems_p ) | |
3414 { | |
3415 v184.x = 563; | |
3416 v184.y = 186; | |
3417 am_40D2B4(&v184, gems_p); | |
3418 } | |
3419 if ( gems_e ) | |
3420 { | |
3421 v184.x = 16; | |
3422 v184.y = 186; | |
3423 am_40D2B4(&v184, gems_e); | |
3424 } | |
3425 if ( beasts_p ) | |
3426 { | |
3427 v184.x = 563; | |
3428 v184.y = 258; | |
3429 am_40D2B4(&v184, beasts_p); | |
3430 } | |
3431 if ( beasts_e ) | |
3432 { | |
3433 v184.x = 16; | |
3434 v184.y = 258; | |
3435 am_40D2B4(&v184, beasts_e); | |
3436 } | |
3437 if ( wall_p ) | |
3438 { | |
3439 v184.x = 442; | |
3440 v184.y = 296; | |
3441 am_40D2B4(&v184, wall_p); | |
3442 } | |
3443 if ( wall_e ) | |
3444 { | |
3445 v184.x = 180; | |
3446 v184.y = 296; | |
3447 am_40D2B4(&v184, wall_e); | |
3448 } | |
3449 if ( tower_p ) | |
3450 { | |
3451 v184.x = 514; | |
3452 v184.y = 296; | |
3453 am_40D2B4(&v184, tower_p); | |
3454 } | |
3455 if ( tower_e ) | |
3456 { | |
3457 v184.x = 122; | |
3458 v184.y = 296; | |
3459 am_40D2B4(&v184, tower_e); | |
3460 } | |
3461 if ( dmg_p ) | |
3462 { | |
3463 v184.x = 442; | |
3464 v184.y = 296; | |
3465 am_40D2B4(&v184, dmg_p); | |
3466 } | |
3467 if ( buildings_p ) | |
3468 { | |
3469 v184.x = 514; | |
3470 v184.y = 296; | |
3471 am_40D2B4(&v184, buildings_p); | |
3472 } | |
3473 if ( dmg_e ) | |
3474 { | |
3475 v184.x = 180; | |
3476 v184.y = 296; | |
3477 am_40D2B4(&v184, dmg_e); | |
3478 } | |
3479 if ( buildings_e ) | |
3480 { | |
3481 v184.x = 122; | |
3482 v184.y = 296; | |
3483 am_40D2B4(&v184, buildings_e); | |
3484 } | |
3485 } | |
3486 else | |
3487 { | |
3488 if ( quarry_p ) | |
3489 { | |
3490 v184.x = 26; | |
3491 v184.y = 92; | |
3492 am_40D2B4(&v184, quarry_p); | |
3493 } | |
3494 if ( quarry_e ) | |
3495 { | |
3496 v184.x = 573; | |
3497 v184.y = 92; | |
3498 am_40D2B4(&v184, quarry_e); | |
3499 } | |
3500 if ( magic_p ) | |
3501 { | |
3502 v184.x = 26; | |
3503 v184.y = 164; | |
3504 am_40D2B4(&v184, magic_p); | |
3505 } | |
3506 if ( magic_e ) | |
3507 { | |
3508 v184.x = 573; | |
3509 v184.y = 164; | |
3510 am_40D2B4(&v184, magic_e); | |
3511 } | |
3512 if ( zoo_p ) | |
3513 { | |
3514 v184.x = 26; | |
3515 v184.y = 236; | |
3516 am_40D2B4(&v184, zoo_p); | |
3517 } | |
3518 if ( zoo_e ) | |
3519 { | |
3520 v184.x = 573; | |
3521 v184.y = 236; | |
3522 am_40D2B4(&v184, zoo_e); | |
3523 } | |
3524 if ( bricks_p ) | |
3525 { | |
3526 v184.x = 16; | |
3527 v184.y = 114; | |
3528 am_40D2B4(&v184, bricks_p); | |
3529 } | |
3530 if ( bricks_e ) | |
3531 { | |
3532 v184.x = 563; | |
3533 v184.y = 114; | |
3534 am_40D2B4(&v184, bricks_e); | |
3535 } | |
3536 if ( gems_p ) | |
3537 { | |
3538 v184.x = 16; | |
3539 v184.y = 186; | |
3540 am_40D2B4(&v184, gems_p); | |
3541 } | |
3542 if ( gems_e ) | |
3543 { | |
3544 v184.x = 563; | |
3545 v184.y = 186; | |
3546 am_40D2B4(&v184, gems_e); | |
3547 } | |
3548 if ( beasts_p ) | |
3549 { | |
3550 v184.x = 16; | |
3551 v184.y = 258; | |
3552 am_40D2B4(&v184, beasts_p); | |
3553 } | |
3554 if ( beasts_e ) | |
3555 { | |
3556 v184.x = 563; | |
3557 v184.y = 258; | |
3558 am_40D2B4(&v184, beasts_e); | |
3559 } | |
3560 if ( wall_p ) | |
3561 { | |
3562 v184.x = 180; | |
3563 v184.y = 296; | |
3564 am_40D2B4(&v184, wall_p); | |
3565 } | |
3566 if ( wall_e ) | |
3567 { | |
3568 v184.x = 442; | |
3569 v184.y = 296; | |
3570 am_40D2B4(&v184, wall_e); | |
3571 } | |
3572 if ( tower_p ) | |
3573 { | |
3574 v184.x = 122; | |
3575 v184.y = 296; | |
3576 am_40D2B4(&v184, tower_p); | |
3577 } | |
3578 if ( tower_e ) | |
3579 { | |
3580 v184.x = 514; | |
3581 v184.y = 296; | |
3582 am_40D2B4(&v184, tower_e); | |
3583 } | |
3584 if ( dmg_p ) | |
3585 { | |
3586 v184.x = 180; | |
3587 v184.y = 296; | |
3588 am_40D2B4(&v184, dmg_p); | |
3589 } | |
3590 if ( buildings_p ) | |
3591 { | |
3592 v184.x = 122; | |
3593 v184.y = 296; | |
3594 am_40D2B4(&v184, buildings_p); | |
3595 } | |
3596 if ( dmg_e ) | |
3597 { | |
3598 v184.x = 442; | |
3599 v184.y = 296; | |
3600 am_40D2B4(&v184, dmg_e); | |
3601 } | |
3602 if ( buildings_e ) | |
3603 { | |
3604 v184.x = 514; | |
3605 v184.y = 296; | |
3606 am_40D2B4(&v184, buildings_e); | |
3607 } | |
3608 } | |
3609 #undef APPLY_TO_BOTH | |
3610 #undef APPLY_TO_ENEMY | |
3611 #undef APPLY_TO_PLAYER | |
3612 | |
0 | 3613 } |
3614 | |
3615 | |
3616 | |
3617 | |
3618 //----- (0040D2B4) -------------------------------------------------------- | |
1263 | 3619 int am_40D2B4( POINT* startXY, int effect_value ) |
1185 | 3620 { |
0 | 3621 int v2; // ebp@1 |
1185 | 3622 POINT *v3; // edi@1 |
0 | 3623 int result; // eax@3 |
1194 | 3624 int v6; |
0 | 3625 stru272_stru0 *v8; // ecx@12 |
3626 signed int v11; // [sp+10h] [bp-8h]@1 | |
1194 | 3627 |
0 | 3628 |
3629 v11 = 0; | |
1263 | 3630 v2 = effect_value; |
3631 | |
3632 while ( array_4FABD0[v11].have_effect ) | |
1185 | 3633 { |
3634 result = array_4FABD0[v11].field_40->_40E2A7(); | |
3635 if ( !result ) | |
3636 { | |
1263 | 3637 array_4FABD0[v11].have_effect = 0; |
1185 | 3638 --v11; |
3639 } | |
3640 ++v11; | |
3641 if ( v11 >= 10 ) | |
3642 return result; | |
3643 } | |
3644 v6 = v11; | |
1263 | 3645 array_4FABD0[v11].have_effect = 1; |
3646 if ( effect_value <= 0 ) | |
1185 | 3647 { |
1263 | 3648 array_4FABD0[v6].effect_sign = 0; |
3649 effect_value = -effect_value; | |
1185 | 3650 } |
0 | 3651 else |
1185 | 3652 { |
1263 | 3653 array_4FABD0[v6].effect_sign = 1; |
1185 | 3654 } |
1263 | 3655 array_4FABD0[v6].field_4.effect_area.left = startXY->x - 20; |
3656 array_4FABD0[v6].field_4.effect_area.right = startXY->x + 20; | |
3657 array_4FABD0[v6].field_4.effect_area.top = startXY->y - 20; | |
3658 array_4FABD0[v6].field_4.effect_area.bottom = startXY->y + 20; | |
1186 | 3659 array_4FABD0[v6].field_4.field_10 = -60; |
3660 array_4FABD0[v6].field_4.field_14 = 60; | |
3661 array_4FABD0[v6].field_4.field_18 = 180; | |
3662 array_4FABD0[v6].field_4.field_1Cf = 0.5; | |
3663 array_4FABD0[v6].field_4.field_20 = 150; | |
3664 array_4FABD0[v6].field_4.field_24f= 50.0; | |
3665 array_4FABD0[v6].field_4.field_28f = 3.0; | |
3666 array_4FABD0[v6].field_4.field_2Cf = 8.0; | |
3667 array_4FABD0[v6].field_4.field_30 = 5; | |
3668 array_4FABD0[v6].field_4.field_34 = 15; | |
1263 | 3669 array_4FABD0[v6].field_4.sparks_array = &array_4FABD0[v6].effect_sparks[0]; |
1185 | 3670 v8 = array_4FABD0[v6].field_40; |
1263 | 3671 v8->StartFill(&array_4FABD0[v6].field_4); |
3672 if ( 10 * effect_value > 150 ) | |
3673 effect_value = 15; | |
1185 | 3674 |
1184 | 3675 if ( v8->signature != SIG_trpg ) |
0 | 3676 return 2; |
3677 if ( !v8->field_59 ) | |
3678 return 3; | |
1263 | 3679 v8->position_in_sparks_arr = 10 * effect_value; |
0 | 3680 v8->field_30 = 0.0; |
3681 v8->field_58 = 0; | |
3682 v8->field_44 = 0; | |
3683 v8->field_4C = 0; | |
3684 v8->field_48 = 0; | |
3685 v8->field_50 = 0; | |
1185 | 3686 for (int i=0; i<v8->field_4; ++i) |
1263 | 3687 v8->field_54[i].have_spark=0; |
0 | 3688 return 0; |
3689 } | |
1185 | 3690 |
0 | 3691 |
3692 //----- (0040D402) -------------------------------------------------------- | |
1246 | 3693 int ApplyDamageToBuildings( int player_num, int damage ) |
1218 | 3694 { |
1183 | 3695 ArcomagePlayer *v2; // ecx@1 |
0 | 3696 int v3; // esi@1 |
3697 int result; // eax@3 | |
3698 | |
1218 | 3699 |
3700 v3 = am_Players[player_num].wall_height; | |
0 | 3701 if ( v3 <= 0 ) |
3702 { | |
3703 result = 0; | |
3704 } | |
3705 else | |
3706 { | |
1218 | 3707 if ( v3 >= -damage ) |
0 | 3708 { |
1218 | 3709 result = damage; |
3710 am_Players[player_num].wall_height += damage; | |
1209 | 3711 |
0 | 3712 } |
1209 | 3713 else |
3714 { | |
1218 | 3715 damage += v3; |
0 | 3716 result = -v3; |
1218 | 3717 am_Players[player_num].wall_height = 0; |
3718 am_Players[player_num].tower_height += damage; | |
1209 | 3719 } |
0 | 3720 } |
1209 | 3721 |
1218 | 3722 if ( am_Players[player_num].tower_height < 0 ) |
3723 am_Players[player_num].tower_height = 0; | |
0 | 3724 return result; |
3725 } | |
3726 // 40D402: using guessed type int __fastcall am_40D402(uint, uint); | |
3727 | |
3728 //----- (0040D444) -------------------------------------------------------- | |
1218 | 3729 void GameResultsApply() |
3730 { | |
0 | 3731 int v0; // esi@1 |
3732 int v1; // edi@1 | |
3733 int v2; // eax@1 | |
3734 int v3; // eax@23 | |
3735 int v4; // edx@25 | |
3736 int v5; // ecx@28 | |
3737 int v6; // eax@28 | |
3738 GUIWindow *v7; // ecx@50 | |
3739 signed int v8; // eax@50 | |
1218 | 3740 char v9; // eax@52 |
0 | 3741 signed int v10; // eax@54 |
3742 char *v11; // esi@59 | |
3743 char *v12; // esi@65 | |
3744 signed int v14; // [sp-4h] [bp-58h]@46 | |
3745 char pText[64]; // [sp+Ch] [bp-48h]@1 | |
1218 | 3746 POINT xy; // [sp+4Ch] [bp-8h]@1 |
0 | 3747 |
3748 v0 = -1; | |
3749 v1 = -1; | |
3750 //nullsub_1(); | |
1218 | 3751 xy.x = 0; |
3752 xy.y = 0; | |
3753 strcpy(pText, "The Winner is: ");//"Ïîáåäè" | |
3754 // v2 = 0; | |
3755 xy.y = 160; | |
3756 xy.x = 320; //- 12 * v2 / 2; | |
1679 | 3757 // am_DrawText(-1, pText, xy); |
1197 | 3758 if ( am_Players[0].tower_height < max_tower_height ) |
0 | 3759 { |
1197 | 3760 if ( am_Players[1].tower_height < max_tower_height ) |
0 | 3761 goto LABEL_10; |
3762 v0 = 2; | |
3763 } | |
3764 else | |
3765 { | |
1197 | 3766 if ( am_Players[1].tower_height < max_tower_height ) |
0 | 3767 { |
3768 v0 = 1; | |
3769 } | |
3770 else | |
3771 { | |
1197 | 3772 if ( am_Players[0].tower_height == am_Players[1].tower_height ) |
0 | 3773 { |
3774 v0 = 0; | |
3775 v1 = 4; | |
3776 goto LABEL_10; | |
3777 } | |
1197 | 3778 v0 = (am_Players[0].tower_height <= am_Players[1].tower_height) + 1; |
0 | 3779 } |
3780 } | |
3781 v1 = 0; | |
3782 LABEL_10: | |
1197 | 3783 if ( am_Players[0].tower_height <= 0 ) |
0 | 3784 { |
1197 | 3785 if ( am_Players[1].tower_height > 0 ) |
0 | 3786 { |
3787 v0 = 2; | |
3788 } | |
3789 else | |
3790 { | |
1197 | 3791 if ( am_Players[0].tower_height == am_Players[1].tower_height ) |
0 | 3792 { |
3793 LABEL_20: | |
1197 | 3794 if ( am_Players[0].wall_height == am_Players[1].wall_height ) |
0 | 3795 { |
3796 v0 = 0; | |
3797 v1 = 4; | |
3798 } | |
3799 else | |
3800 { | |
1197 | 3801 v0 = (am_Players[0].wall_height <= am_Players[1].wall_height) + 1; |
0 | 3802 v1 = 1; |
3803 } | |
3804 goto LABEL_23; | |
3805 } | |
1197 | 3806 v0 = (am_Players[0].tower_height <= am_Players[1].tower_height) + 1; |
0 | 3807 } |
3808 goto LABEL_17; | |
3809 } | |
1197 | 3810 if ( am_Players[1].tower_height <= 0 ) |
0 | 3811 { |
3812 v0 = 1; | |
3813 LABEL_17: | |
3814 v1 = 2; | |
3815 } | |
3816 if ( !v0 && v1 == 4 ) | |
3817 goto LABEL_20; | |
3818 LABEL_23: | |
1197 | 3819 v3 = am_Players[0].resource_bricks; |
3820 if ( am_Players[0].resource_bricks <= am_Players[0].resource_gems ) | |
0 | 3821 { |
1197 | 3822 v3 = am_Players[0].resource_beasts; |
3823 v4 = am_Players[0].resource_gems; | |
3824 if ( am_Players[0].resource_gems > am_Players[0].resource_beasts ) | |
0 | 3825 goto LABEL_28; |
3826 } | |
3827 else | |
3828 { | |
1197 | 3829 if ( am_Players[0].resource_bricks <= am_Players[0].resource_beasts ) |
0 | 3830 { |
1197 | 3831 v4 = am_Players[0].resource_beasts; |
0 | 3832 goto LABEL_28; |
3833 } | |
3834 } | |
3835 v4 = v3; | |
3836 LABEL_28: | |
1197 | 3837 v5 = am_Players[1].resource_bricks; |
3838 v6 = am_Players[1].resource_gems; | |
3839 if ( am_Players[1].resource_bricks <= am_Players[1].resource_gems ) | |
0 | 3840 { |
1197 | 3841 v5 = am_Players[1].resource_beasts; |
3842 if ( am_Players[1].resource_gems > am_Players[1].resource_beasts ) | |
0 | 3843 goto LABEL_33; |
3844 goto LABEL_32; | |
3845 } | |
1197 | 3846 v6 = am_Players[1].resource_beasts; |
3847 if ( am_Players[1].resource_bricks > am_Players[1].resource_beasts ) | |
0 | 3848 LABEL_32: |
3849 v6 = v5; | |
3850 LABEL_33: | |
3851 if ( v0 == -1 ) | |
3852 { | |
3853 if ( v1 != -1 ) | |
3854 goto LABEL_49; | |
1197 | 3855 if ( v4 < max_resources_amount ) |
0 | 3856 { |
1197 | 3857 if ( v6 < max_resources_amount ) |
0 | 3858 goto LABEL_49; |
3859 v0 = 2; | |
3860 } | |
3861 else | |
3862 { | |
1197 | 3863 if ( v6 < max_resources_amount ) |
0 | 3864 { |
3865 v0 = 1; | |
3866 } | |
3867 else | |
3868 { | |
3869 if ( v4 == v6 ) | |
3870 goto LABEL_46; | |
3871 v0 = (v4 <= v6) + 1; | |
3872 } | |
3873 } | |
3874 v1 = 3; | |
3875 } | |
3876 if ( !v0 && v1 == 4 ) | |
3877 { | |
3878 if ( v4 != v6 ) | |
3879 { | |
3880 v14 = 5; | |
3881 v0 = (v4 <= v6) + 1; | |
3882 goto LABEL_48; | |
3883 } | |
3884 LABEL_46: | |
3885 v0 = 0; | |
3886 v14 = 4; | |
3887 LABEL_48: | |
3888 v1 = v14; | |
3889 } | |
3890 LABEL_49: | |
3891 pArcomageGame->field_B0 = v1; | |
3892 pArcomageGame->uGameResult = v0; | |
3893 if ( v0 == 1 ) | |
3894 { | |
1218 | 3895 |
1197 | 3896 v8 = (signed int)window_SpeakInHouse->par1C; |
1218 | 3897 if (( v8 >= 108 )&&( v8 <= 120 )) |
0 | 3898 { |
1218 | 3899 if ( !pParty->pArcomageWins[v8-108] ) |
0 | 3900 { |
1218 | 3901 pParty->pArcomageWins[v8-108] = 1; |
1980 | 3902 signed int _a = (signed int)(p2DEvents[ window_SpeakInHouse->par1C - 1].fPriceMultiplier * 100.0); |
1828
35c1e4ff6ba7
party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents:
1679
diff
changeset
|
3903 pParty->PartyFindsGold(_a, 0); |
0 | 3904 } |
1218 | 3905 |
0 | 3906 } |
3907 v10 = 108; | |
3908 do | |
3909 { | |
1218 | 3910 if ( !pParty->pArcomageWins[v10-108] ) |
0 | 3911 break; |
3912 ++v10; | |
3913 } | |
3914 while ( v10 <= 120 ); | |
1218 | 3915 |
0 | 3916 if ( v10 == 121 ) |
484 | 3917 _449B7E_toggle_bit(pParty->_quest_bits, 238, 1u); |
1218 | 3918 |
3919 | |
3920 for (int i=0; i<4; ++i ) | |
0 | 3921 { |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1393
diff
changeset
|
3922 v11 = (char *)&pParty->pPlayers[i]._achieved_awards_bits; |
0 | 3923 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v11, 1) ) |
949 | 3924 _449B7E_toggle_bit((unsigned char *)v11, PLAYER_GUILD_BITS__ARCOMAGE_WIN, 1); |
1218 | 3925 |
0 | 3926 } |
1218 | 3927 |
949 | 3928 ++pParty->uNumArcomageWins; |
3929 if ( pParty->uNumArcomageWins > 1000000 ) | |
3930 pParty->uNumArcomageWins = 1000000; | |
0 | 3931 } |
3932 else | |
3933 { | |
1218 | 3934 for (int i=0; i<4; ++i ) |
3935 { | |
1460
ff2118028c71
renaming _guilds_member_bits to _achieved_awards_bits
Gloval
parents:
1393
diff
changeset
|
3936 v12 = (char *)&pParty->pPlayers[i]._achieved_awards_bits; |
0 | 3937 if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v12, 1) ) |
949 | 3938 _449B7E_toggle_bit((unsigned char *)v12, PLAYER_GUILD_BITS__ARCOMAGE_LOSE, 1); |
0 | 3939 } |
1218 | 3940 |
949 | 3941 ++pParty->uNumArcomageLoses; |
3942 if ( pParty->uNumArcomageLoses > 1000000 ) | |
3943 pParty->uNumArcomageLoses = 1000000; | |
0 | 3944 } |
3945 } | |
3946 | |
3947 | |
3948 | |
3949 //----- (00409C8B) -------------------------------------------------------- | |
1197 | 3950 void PrepareArcomage() |
3951 { | |
0 | 3952 signed __int64 v1; // qax@4 |
3953 int v2; // esi@4 | |
1183 | 3954 int v3; // esi@5 |
0 | 3955 signed int v4; // edi@5 |
3956 int v6; // edx@9 | |
1183 | 3957 RECT pXYZW; // [sp+8h] [bp-1Ch]@5 |
3958 POINT pXY; // [sp+18h] [bp-Ch]@5 | |
0 | 3959 |
3960 pAudioPlayer->StopChannels(-1, -1); | |
1201 | 3961 strcpy(pArcomageGame->pPlayer1Name, Player1Name); |
3962 strcpy(pArcomageGame->pPlayer2Name, Player2Name); | |
0 | 3963 am_byte_4FAA76 = 0; |
3964 am_byte_4FAA75 = 0; | |
1183 | 3965 |
3966 for (int i=0; i<10; ++i) | |
3967 { | |
3968 v2 = (i+1) % 4; | |
3969 v3 = (i+1) / 4; | |
1200 | 3970 shown_cards[i].uCardId = -1; |
3971 shown_cards[i].field_4 = 0; | |
3972 shown_cards[i].field_8.x = 100 * v2 + 120; | |
3973 shown_cards[i].field_8.y = 138 * v3 + 18; | |
3974 shown_cards[i].field_10_xplus = -100 * v2 / 5; | |
3975 shown_cards[i].field_14_y_plus = -138 * v3 / 5; | |
3976 shown_cards[i].field_18_point.x = shown_cards[i].field_8.x; | |
3977 shown_cards[i].field_18_point.y = shown_cards[i].field_8.y; | |
1183 | 3978 } |
3979 | |
3980 pXY.x = 0; | |
3981 pXY.y = 0; | |
0 | 3982 ArcomageGame::LoadBackground(); |
1183 | 3983 pXYZW.left = 0; |
3984 pXYZW.right = 640; | |
3985 pXYZW.top = 0; | |
3986 pXYZW.bottom = 480; | |
0 | 3987 am_BeginScene(pArcomageGame->pBackgroundPixels, -1, 1); |
2154 | 3988 pRenderer->am_Blt_Copy(&pXYZW, &pXY, 2); |
0 | 3989 am_EndScene(); |
3990 pRenderer->Present(); | |
3991 ArcomageGame::LoadSprites(); | |
1679 | 3992 pRenderer->Present(); |
1183 | 3993 |
0 | 3994 v4 = 120; |
1183 | 3995 for (int i=0; i<12; ++i) |
3996 am_sounds[i] = pSoundList->LoadSound(v4++, 0); | |
3997 | |
1184 | 3998 for (int i=0; i<10; ++i) |
1679 | 3999 array_4FABD0[i].field_40 = stru272_stru0::New(); |
1184 | 4000 |
1200 | 4001 current_card_slot_index = -1; |
0 | 4002 amuint_4FAA4C = -1; |
4003 byte_4FAA74 = 0; | |
4004 pArcomageGame->field_F4 = 0; | |
1679 | 4005 am_gameover = false; |
0 | 4006 byte_505880 = 0; |
4007 dword_4FAA70 = 0; | |
1263 | 4008 need_to_discard_card = 0; |
1197 | 4009 SetStartGameData(); |
1200 | 4010 InitalHandsFill(); |
0 | 4011 //nullsub_1(); |
1197 | 4012 pArcomageGame->GameOver = 0; |
1183 | 4013 pArcomageGame->pfntComic = pFontComic; |
4014 pArcomageGame->pfntArrus = pFontArrus; | |
0 | 4015 } |
4016 | |
4017 | |
4018 //----- (0040D711) -------------------------------------------------------- | |
4019 ArcomageGame::ArcomageGame() | |
4020 { | |
1183 | 4021 field_4 = 0; |
0 | 4022 //RGBTexture::RGBTexture(&this->pGameBackground); |
4023 //RGBTexture::RGBTexture(&v1->pSprites); | |
1183 | 4024 bGameInProgress = 0; |
4025 field_F9 = 0; | |
0 | 4026 } |
938 | 4027 |
4028 | |
4029 //----- (00409BE8) -------------------------------------------------------- | |
1197 | 4030 void SetStartConditions() |
938 | 4031 { |
1256 | 4032 const ArcomageStartConditions *st_cond; // eax@1 |
1185 | 4033 |
1200 | 4034 st_cond = &start_conditions[window_SpeakInHouse->par1C - 108]; |
4035 start_tower_height = st_cond->tower_height; | |
4036 start_wall_height = st_cond->wall_height; | |
4037 start_quarry_level = st_cond->quarry_level - 1; | |
4038 start_magic_level = st_cond->magic_level - 1; | |
4039 start_zoo_level = st_cond->zoo_level - 1; | |
4040 minimum_cards_at_hand = 5; | |
1197 | 4041 quarry_bonus = 1; |
4042 magic_bonus = 1; | |
1201 | 4043 zoo_bonus = 1; |
1200 | 4044 max_tower_height = st_cond->max_tower; |
4045 max_resources_amount = st_cond->max_resources; | |
4046 | |
1256 | 4047 opponent_mastery = st_cond->mastery_lvl; |
1200 | 4048 |
4049 start_bricks_amount = st_cond->bricks_amount; | |
4050 start_gems_amount = st_cond->gems_amount; | |
4051 start_beasts_amount = st_cond->beasts_amount; | |
1185 | 4052 |
1183 | 4053 } |
4054 | |
4055 | |
4056 //----- (0040D75D) -------------------------------------------------------- | |
1679 | 4057 void am_DrawText( int a1, const char *pText, POINT *pXY ) |
1183 | 4058 { |
1256 | 4059 pPrimaryWindow->DrawText( pFontComic, pXY->x, pXY->y - ((pFontComic->uFontHeight - 3) >> 1) + 3, 0, pText, 0, 0, 0); |
1183 | 4060 } |
4061 | |
4062 | |
4063 //----- (0040DB27) -------------------------------------------------------- | |
1263 | 4064 void DrawRect( RECT *pXYZW, unsigned __int16 uColor, char bSolidFill ) |
1183 | 4065 { |
1185 | 4066 RECT *v3; // esi@1 |
1183 | 4067 |
4068 v3 = pXYZW; | |
4069 pRenderer->BeginScene(); | |
4070 pRenderer->SetRasterClipRect(0, 0, 639u, 479u); | |
4071 if ( bSolidFill ) | |
4072 { | |
1185 | 4073 for ( int i = v3->top; i <= v3->bottom; ++i ) |
4074 pRenderer->RasterLine2D(v3->left, i, v3->right, i, uColor); | |
1183 | 4075 } |
4076 else | |
4077 { | |
1185 | 4078 pRenderer->RasterLine2D(v3->left, v3->top, v3->right, v3->top, uColor); |
4079 pRenderer->RasterLine2D(v3->right, v3->top, v3->right, v3->bottom, uColor); | |
4080 pRenderer->RasterLine2D(v3->right, v3->bottom, v3->left, v3->bottom, uColor); | |
4081 pRenderer->RasterLine2D(v3->left, v3->bottom, v3->left, v3->top, uColor); | |
1183 | 4082 } |
4083 pRenderer->EndScene(); | |
4084 } | |
4085 | |
1679 | 4086 void DrawSquare( POINT *pTargetXY, unsigned __int16 uColor ) |
2069 | 4087 { |
1263 | 4088 pRenderer->BeginScene(); |
2154 | 4089 //if ( uNumSceneBegins ) |
2069 | 4090 { |
4091 pRenderer->WritePixel16(pTargetXY->x, pTargetXY->y, uColor); | |
4092 pRenderer->WritePixel16(pTargetXY->x + 1, pTargetXY->y, uColor); | |
4093 pRenderer->WritePixel16(pTargetXY->x, pTargetXY->y + 1, uColor); | |
4094 pRenderer->WritePixel16(pTargetXY->x + 1, pTargetXY->y + 1, uColor); | |
4095 /*int xVal = pTargetXY->x; | |
1263 | 4096 int yVal = pTargetXY->y; |
4097 if ( xVal >= 0 && xVal <= 639 && yVal >= 0 && yVal <= 479) | |
4098 { | |
4099 pRenderer->pTargetSurface[xVal + pRenderer->uTargetSurfacePitch * yVal] = uColor; | |
4100 pRenderer->pTargetSurface[xVal+1 + pRenderer->uTargetSurfacePitch * yVal] = uColor; | |
4101 pRenderer->pTargetSurface[xVal + pRenderer->uTargetSurfacePitch * (yVal+1)] = uColor; | |
4102 pRenderer->pTargetSurface[xVal+1 + pRenderer->uTargetSurfacePitch * (yVal+1)] = uColor; | |
2069 | 4103 }*/ |
1263 | 4104 pRenderer->EndScene(); |
4105 } | |
2069 | 4106 } |
1185 | 4107 |
4108 //----- (0040DBD3) -------------------------------------------------------- | |
1679 | 4109 void DrawPixel( POINT *pTargetXY, unsigned __int16 uColor ) |
2069 | 4110 { |
1185 | 4111 pRenderer->BeginScene(); |
2154 | 4112 //if ( pRenderer->uNumSceneBegins ) |
1185 | 4113 { |
2069 | 4114 pRenderer->WritePixel16(pTargetXY->x, pTargetXY->y, uColor); |
4115 /*int xVal = pTargetXY->x; | |
1185 | 4116 int yVal = pTargetXY->y; |
4117 if ( xVal >= 0 && xVal <= 639 && yVal >= 0 && yVal <= 479) | |
4118 { | |
4119 pRenderer->pTargetSurface[xVal + pRenderer->uTargetSurfacePitch * yVal] = uColor; | |
2069 | 4120 }*/ |
1185 | 4121 pRenderer->EndScene(); |
4122 } | |
2069 | 4123 } |
1185 | 4124 |
4125 | |
1183 | 4126 //----- (0040DDB1) -------------------------------------------------------- |
1263 | 4127 int rand_interval( int min, int max ) |
1183 | 4128 { |
1263 | 4129 return min + rand() % (max - min + 1); |
1183 | 4130 } |
4131 | |
4132 | |
4133 //----- (0040DEC8) -------------------------------------------------------- | |
1679 | 4134 void __fastcall am_IntToString(int val, char *pOut) |
1183 | 4135 { |
1679 | 4136 sprintfex(pOut, "%d", val); |
1183 | 4137 } |
1303 | 4138 |
4139 void set_stru1_field_8_InArcomage(int inValue) | |
4140 { | |
4141 switch(inValue) | |
4142 { | |
4143 case 91:LOBYTE(pArcomageGame->stru1.field_8) = 123;break; | |
4144 case 92:LOBYTE(pArcomageGame->stru1.field_8) = 124;break; | |
4145 case 93:LOBYTE(pArcomageGame->stru1.field_8) = 125;break; | |
4146 case 96:LOBYTE(pArcomageGame->stru1.field_8) = 126;break; | |
4147 case 61:LOBYTE(pArcomageGame->stru1.field_8) = 43;break; | |
4148 case 55:LOBYTE(pArcomageGame->stru1.field_8) = 38;break; | |
4149 case 56:LOBYTE(pArcomageGame->stru1.field_8) = 42;break; | |
4150 case 57:LOBYTE(pArcomageGame->stru1.field_8) = 40;break; | |
4151 case 59:LOBYTE(pArcomageGame->stru1.field_8) = 58;break; | |
4152 case 54:LOBYTE(pArcomageGame->stru1.field_8) = 94;break; | |
4153 case 50:LOBYTE(pArcomageGame->stru1.field_8) = 64;break; | |
4154 case 51:LOBYTE(pArcomageGame->stru1.field_8) = 35;break; | |
4155 case 52:LOBYTE(pArcomageGame->stru1.field_8) = 36;break; | |
4156 case 53:LOBYTE(pArcomageGame->stru1.field_8) = 37;break; | |
4157 case 49:LOBYTE(pArcomageGame->stru1.field_8) = 33;break; | |
4158 case 39:LOBYTE(pArcomageGame->stru1.field_8) = 34;break; | |
4159 case 44:LOBYTE(pArcomageGame->stru1.field_8) = 60;break; | |
4160 case 46:LOBYTE(pArcomageGame->stru1.field_8) = 62;break; | |
4161 case 47:LOBYTE(pArcomageGame->stru1.field_8) = 63;break; | |
4162 case 48:LOBYTE(pArcomageGame->stru1.field_8) = 41;break; | |
4163 default:LOBYTE(pArcomageGame->stru1.field_8) = inValue;break; | |
4164 } | |
4165 } |