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