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