World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Arcomage.cpp
См. документацию.
1 #include "Engine/Engine.h"
2 #include "Engine/Localization.h"
3 #include "Engine/Party.h"
4 #include "Engine/Strings.h"
5 #include "Engine/Time.h"
6 
10 
11 #include "Arcomage/Arcomage.h"
12 
13 #include "GUI/GUIFont.h"
14 #include "GUI/GUIWindow.h"
15 #include "GUI/UI/UIHouses.h"
16 
18 #include "Media/MediaPlayer.h"
19 
20 #include "Platform/Api.h"
21 
22 void SetStartConditions();
23 void SetStartGameData();
24 void FillPlayerDeck();
25 void InitalHandsFill();
26 void GetNextCardFromDeck(int player_num);
27 int GetEmptyCardSlotIndex(int player_num);
28 void IncreaseResourcesInTurn(int player_num);
29 void TurnChange();
30 bool IsGameOver();
32  ArcomageCard *pCard, int mastery);
33 char PlayerTurn(int player_num);
34 void DrawGameUI(int animation_stage);
35 void DrawSparks();
37 void DrawPlayersText();
38 void DrawPlayerLevels(const String &str, Point *pXY);
39 void DrawBricksCount(const String &str, Point *pXY);
40 void DrawGemsCount(const String &str, Point *pXY);
41 void DrawBeastsCount(const String &str, Point *pXY);
42 void DrawPlayersTowers();
43 void DrawPlayersWall();
44 void DrawCards();
45 void DrawCardAnimation(int a1);
46 int GetPlayerHandCardCount(int player_num);
47 int DrawCardsRectangles(int player_num);
48 bool DiscardCard(int player_num, int card_slot_index);
49 bool PlayCard(int player_num, int card_slot_num);
50 bool CanCardBePlayed(int player_num, int hand_card_indx);
51 void ApplyCardToPlayer(int player_num, unsigned int uCardID);
52 int new_explosion_effect(Point *a1, int a2);
53 int ApplyDamageToBuildings(int player_num, int damage);
54 void GameResultsApply();
55 
56 void am_DrawText(const String &str, Point *pXY);
57 void DrawRect(Rect *pXYZW, unsigned __int16 uColor, char bSolidFill);
58 int rand_interval(int min, int max); // idb
59 void am_IntToString(int val, char *pOut);
60 
61 unsigned int R8G8B8_to_TargetFormat(int uColor) {
62  return Color16(uColor & 0xFF, (uColor >> 8) & 0xFF, (uColor >> 16) & 0xFF);
63 }
64 
66  __int16 max_tower;
67  __int16 max_resources;
68  __int16 tower_height;
69  __int16 wall_height;
70  __int16 quarry_level;
71  __int16 magic_level;
72  __int16 zoo_level;
73  __int16 bricks_amount;
74  __int16 gems_amount;
75  __int16 beasts_amount;
77 };
78 
80  {30, 100, 15, 5, 2, 2, 2, 10, 10, 10, 0},
81  {50, 150, 20, 5, 2, 2, 2, 5, 5, 5, 1},
82  {50, 150, 20, 5, 2, 2, 2, 5, 5, 5, 2},
83  {75, 200, 25, 10, 3, 3, 3, 5, 5, 5, 2},
84  {75, 200, 20, 10, 3, 3, 3, 5, 5, 5, 1},
85  {100, 300, 30, 15, 4, 4, 4, 10, 10, 10, 1},
86  {100, 300, 30, 15, 4, 4, 4, 10, 10, 10, 2},
87  {150, 400, 20, 10, 5, 5, 5, 25, 25, 25, 0},
88  {200, 500, 20, 10, 1, 1, 1, 15, 15, 15, 2},
89  {100, 300, 20, 50, 1, 1, 5, 5, 5, 25, 0},
90  {125, 350, 10, 20, 3, 1, 2, 15, 5, 10, 2},
91  {125, 350, 10, 20, 3, 1, 2, 15, 5, 10, 1},
92  {100, 300, 50, 50, 5, 3, 5, 20, 10, 20, 0}};
93 
94 #define SIG_MEMALOC 0x67707274 // memory allocated
95 #define SIG_MEMFREE 0x78787878 // memory free
96 
98 
102 
105 
106 char Player2Name[] = "Enemy";
107 char Player1Name[] = "Player";
108 
112 };
113 
115 
116 bool Player_Gets_First_Turn = 1; // who starts the game
117 bool Player_Cards_Shift = 1; // shifts the cards round at the bottom of the screen so they arent all level
119 
125 
129 
131 int quarry_bonus = 1; // acts as effective min level
132 int magic_bonus = 1;
133 int zoo_bonus = 1;
134 
137 
142 
144 
148 
150 
154 
155 sPoint anim_card_spd_drawncard; // anim card speed draw from deck
156 Point anim_card_pos_drawncard; // anim card pos draw from deck
157 sPoint anim_card_spd_playdiscard; // anim card speeds play/discard
158 Point anim_card_pos_playdiscard; // anim card posisiotn play/discard
159 
167 
169  bool Update();
170  bool Inside(Rect* pXYZW);
171 
172  int x;
173  int y;
178 };
179 
181  this->x = pArcomageGame->mouse_x;
182  this->y = pArcomageGame->mouse_y;
183  this->curr_mouse_left = pArcomageGame->mouse_left;
185  this->curr_mouse_right = pArcomageGame->mouse_right;
189  return true;
190 }
191 
193  return (x >= pXYZW->x) && (x <= pXYZW->z) && (y >= pXYZW->y) && (y <= pXYZW->w);
194 }
195 
196 void ArcomageGame::OnMouseClick(char right_left, bool bDown) {
197  if (right_left)
198  pArcomageGame->mouse_right = bDown;
199  else
200  pArcomageGame->mouse_left = bDown;
201 }
202 
203 void ArcomageGame::OnMouseMove(int x, int y) {
206 }
207 
210  if (v2 == nullptr) {
211  logger->Warning(L"Malloc error");
212  Error("Malloc"); // is this recoverable
213  }
214  v2->mem_signature = SIG_MEMALOC;
215  v2->remaining_sparks_to_init = 0;
216  v2->prev_init_overflow = 0.0;
217  v2->effect_active = 0;
218  v2->params_filled = 0;
219 
220  return v2;
221 }
222 
224  if (this->mem_signature == SIG_MEMALOC) {
225  this->mem_signature = SIG_MEMFREE;
226  free(this);
227  return 0;
228  }
229 
230  return 2;
231 }
232 
234  // fill effect params;
235  if (this->mem_signature == SIG_MEMALOC) {
236  this->spark_array_size = params->spark_array_size;
237  this->start_x_min = params->effect_area.x << 16;
238  this->start_y_max = params->effect_area.y << 16;
239  this->start_x_max = params->effect_area.z << 16;
240  this->start_y_min = params->effect_area.w << 16;
241  this->unused_param_1 = params->unused_param_1;
242  this->unused_param_2 = params->unused_param_2;
243  this->unused_param_3 = params->unused_param_3;
244  this->gravity_unshift = (float)(params->gravity_acc * 65536.0);
245  this->num_init_per_cycle = params->create_per_frame;
246  this->unused_acc_1 = (int)(params->unused_acc_1 * 65536.0);
247  this->unused_acc_1 = (int)(params->unused_acc_1 * 65536.0);
248  this->min_lifespan = params->min_lifespan;
249  this->max_lifespan = params->max_lifespan;
250  this->spark_array_ptr = params->sparks_array;
251  this->params_filled = 1;
252  return 0;
253  }
254 
255  return 2;
256 }
257 
258 int explosion_effect_struct::Clear(char stop_init, char wipe) {
259  if (mem_signature == SIG_MEMALOC) {
260  if (stop_init) {
262  prev_init_overflow = 0.0;
263  }
264  if (params_filled && wipe) {
265  for (int i = 0; i < spark_array_size; ++i) spark_array_ptr[i].spark_remaining_life = 0;
266  effect_active = 0;
267  }
268  return 0;
269  }
270 
271  return 2;
272 }
273 
275  if (this->mem_signature != SIG_MEMALOC) return 2;
276 
277  // calculate how many sparks to initiate
278  float total_to_init = 0;
279  if (this->remaining_sparks_to_init > 0) {
280  total_to_init = this->prev_init_overflow + this->num_init_per_cycle;
281  if (total_to_init > this->remaining_sparks_to_init) total_to_init = this->remaining_sparks_to_init;
282  }
283 
284  // if sparks left to initiate or effect is still active
285  if (total_to_init >= 1.0 || this->effect_active) {
286  bool active_check = 0;
287  spark_point_struct* spark_ptr = this->spark_array_ptr;
288 
289  // cycle through array
290  for (int v21 = this->spark_array_size; v21; v21--) {
291  // spark alive so update
292  if (spark_ptr->spark_remaining_life > 0) {
293  // reduce spark life
294  --spark_ptr->spark_remaining_life;
295 
296  // update x pos
297  spark_ptr->spark_x_unshift += spark_ptr->spark_x_speed;
298  spark_ptr->spark_position.x = spark_ptr->spark_x_unshift >> 16;
299 
300  // update y pos
301  spark_ptr->spark_y_speed += this->gravity_unshift;
302  spark_ptr->spark_y_unshift += spark_ptr->spark_y_speed;
303  spark_ptr->spark_position.y = spark_ptr->spark_y_unshift >> 16;
304 
305  // set effect still active
306  active_check = 1;
307  } else {
308  if (total_to_init >= 1.0) {
309  // spark dead - initialze new spark
310  spark_ptr->spark_remaining_life = rand_interval(this->min_lifespan, this->max_lifespan);
311  spark_ptr->spark_x_speed = (rand() % 17 - 8) << 16;
312  spark_ptr->spark_y_speed = (rand() % 17 - 8) << 16;
313  spark_ptr->spark_x_unshift = rand_interval(this->start_x_min, (this->start_x_max - 1));
314  spark_ptr->spark_position.x = spark_ptr->spark_x_unshift >> 16;
315  spark_ptr->spark_y_unshift = rand_interval((this->start_y_min - 1), this->start_y_max);;
316  spark_ptr->spark_position.y = spark_ptr->spark_y_unshift >> 16;
317  --this->remaining_sparks_to_init;
318  --total_to_init;
319 
320  // set effect still active
321  active_check = 1;
322  }
323  }
324  ++spark_ptr;
325  }
326 
327  this->effect_active = active_check;
328  this->prev_init_overflow = total_to_init;
329  }
330  return 0;
331 }
332 
334  // returns 2 if effect still active - 0/1/3 otherwise
335  if (mem_signature == SIG_MEMALOC) {
336  if (remaining_sparks_to_init <= 0)
337  return effect_active != 0 ? 2 : 0;
338  else
339  return 1;
340  }
341 
342  return 3;
343 }
344 
345 int new_explosion_effect(Point* startXY, int effect_value) {
346  // find first empty effect slot
347  signed int arr_slot = 0;
348  for (arr_slot = 0; arr_slot < 10; arr_slot++) {
349  if (am_effects_array[arr_slot].have_effect) {
350  if (am_effects_array[arr_slot].explosion_eff->IsEffectActive() == 0) {
351  am_effects_array[arr_slot].have_effect = 0;
352  break;
353  }
354  } else {
355  break;
356  }
357  if (arr_slot == 9) return 2;
358  }
359 
360  // set slot active and effect colour
361  am_effects_array[arr_slot].have_effect = 1;
362  if (effect_value <= 0) {
363  am_effects_array[arr_slot].effect_sign = 0;
364  effect_value = -effect_value;
365  } else {
366  am_effects_array[arr_slot].effect_sign = 1;
367  }
368 
369  // fill effect params
370  am_effects_array[arr_slot].eff_params.effect_area.x = startXY->x - 20;
371  am_effects_array[arr_slot].eff_params.effect_area.z = startXY->x + 20;
372  am_effects_array[arr_slot].eff_params.effect_area.y = startXY->y - 20;
373  am_effects_array[arr_slot].eff_params.effect_area.w = startXY->y + 20;
377  am_effects_array[arr_slot].eff_params.gravity_acc = 0.5;
380  am_effects_array[arr_slot].eff_params.unused_acc_1 = 3.0;
381  am_effects_array[arr_slot].eff_params.unused_acc_1 = 8.0;
385 
386  // fill explosion struct
388  if ((explos->StartFill(&am_effects_array[arr_slot].eff_params)) == 2) return 2;
389  if (!explos->params_filled) return 3;
390  if (10 * effect_value > 150) effect_value = 15;
391  explos->remaining_sparks_to_init = 10 * effect_value;
392  explos->prev_init_overflow = 0.0;
393  explos->effect_active = 0;
394 
395  // unused parameters
396  explos->unused_param_4 = 0;
397  explos->unused_param_6 = 0;
398  explos->unused_param_5 = 0;
399  explos->unused_param_7 = 0;
400 
401  // wipe spark array
402  for (int i = 0; i < explos->spark_array_size; ++i) explos->spark_array_ptr[i].spark_remaining_life = 0;
403 
404  return 0;
405 }
406 
407 void DrawSparks() {
408  int rgb_pixel_color;
409 
410  for (int i = 0; i < 10; ++i) {
411  if (am_effects_array[i].have_effect &&
412  (am_effects_array[i].explosion_eff->IsEffectActive() == 2)) {
413  // scan and find extents of spark array
414  bool first = 0;
415  int xmin = -1;
416  int xmax = -1;
417  int ymin = -1;
418  int ymax = -1;
419  for (int j = 0; j < 150; ++j) {
420  if (am_effects_array[i].effect_sparks[j].spark_remaining_life > 0) {
421  if (first == 0) {
422  if (am_effects_array[i].effect_sparks[j].spark_position.x >= 0 && am_effects_array[i].effect_sparks[j].spark_position.y >= 0) {
423  if (am_effects_array[i].effect_sparks[j].spark_position.x <= 639 && am_effects_array[i].effect_sparks[j].spark_position.y <= 479) {
424  xmin = xmax = am_effects_array[i].effect_sparks[j].spark_position.x;
425  ymin = ymax = am_effects_array[i].effect_sparks[j].spark_position.y;
426  first = 1;
427  }
428  }
429  } else {
430  if (am_effects_array[i].effect_sparks[j].spark_position.x >= 0 && am_effects_array[i].effect_sparks[j].spark_position.y >= 0) {
431  if (am_effects_array[i].effect_sparks[j].spark_position.x <= 639 && am_effects_array[i].effect_sparks[j].spark_position.y <= 479) {
432  if (am_effects_array[i].effect_sparks[j].spark_position.x < xmin)
434  if (am_effects_array[i].effect_sparks[j].spark_position.x > xmax)
436  if (am_effects_array[i].effect_sparks[j].spark_position.y < ymin)
438  if (am_effects_array[i].effect_sparks[j].spark_position.y > ymax)
440  }
441  }
442  }
443  }
444  }
445 
446  // increase extents to cover larger square particle drawing
447  xmax +=2;
448  ymax +=2;
449  uint width = xmax - xmin;
450  uint height = ymax - ymin;
451 
452  if (width && height) {
453  // create temp image
455  uint32_t* temppix = (uint32_t*)temp->GetPixels(IMAGE_FORMAT_A8R8G8B8);
456 
457  // set the pixel color
458  rgb_pixel_color = 0xFF00FF00; // green
459  if (!am_effects_array[i].effect_sign) rgb_pixel_color = 0xFFFF0000; // red
460 
461  // draw pixels to image
462  for (int j = 0; j < 150; ++j) {
463  if (am_effects_array[i].effect_sparks[j].spark_remaining_life > 0) {
464  // check limits
465  if (am_effects_array[i].effect_sparks[j].spark_position.x >= 0 && am_effects_array[i].effect_sparks[j].spark_position.y >= 0) {
466  if (am_effects_array[i].effect_sparks[j].spark_position.x <= 639 && am_effects_array[i].effect_sparks[j].spark_position.y <= 479) {
469 
470  if (j % 2) {
471  // draw single pixel
472  temppix[x + y * width] = rgb_pixel_color;
473  } else {
474  // draw square
475  temppix[x + y * width] = rgb_pixel_color;
476  temppix[((x + 1) + y * width)] = rgb_pixel_color;
477  temppix[(x + (y+1) * width)] = rgb_pixel_color;
478  temppix[((x + 1) + (y+1) * width)] = rgb_pixel_color;
479  }
480  }
481  }
482  }
483  }
484 
485  // draw created image to xmin,ymin
486  render->DrawTextureAlphaNew(xmin / 640., ymin / 480., temp);
487  temp->Release();
488  }
489  }
490  }
491 }
492 
493 void ArcomageGame::PlaySound(unsigned int event_id) {
494  SoundID play_sound_id; // eax@10
495 
496  switch (event_id) {
497  case 40:
498  case 43:
499  case 46:
500  play_sound_id = SOUND_bricks_down;
501  break;
502  case 39:
503  case 41:
504  case 42:
505  case 44:
506  case 45:
507  case 47:
508  play_sound_id = SOUND_bricks_up;
509  break;
510  case 0:
511  case 12:
512  case 14:
513  case 15:
514  case 16:
515  case 48:
516  case 50:
517  case 53:
518  play_sound_id = SOUND_damage;
519  break;
520  case 21:
521  case 22:
522  case 23:
523  play_sound_id = SOUND_deal;
524  break;
525  case 56:
526  play_sound_id = SOUND_defeat;
527  break;
528  case 31:
529  case 34:
530  case 37:
531  play_sound_id = SOUND_querry_up;
532  break;
533  case 1:
534  case 30:
535  case 32:
536  case 33:
537  case 35:
538  case 36:
539  case 38:
540  play_sound_id = SOUND_querry_down;
541  break;
542  case 20:
543  play_sound_id = SOUND_shuffle;
544  break;
545  case 3:
546  play_sound_id = SOUND_title;
547  break;
548  case 52:
549  case 54:
550  play_sound_id = SOUND_tower_up;
551  break;
552  case 10:
553  case 11:
554  case 13:
555  play_sound_id = SOUND_typing;
556  break;
557  case 55:
558  play_sound_id = SOUND_victory;
559  break;
560  case 49:
561  case 51:
562  play_sound_id = SOUND_wall_up;
563  break;
564  default:
565  return;
566  }
567  pAudioPlayer->PlaySound(play_sound_id, 0, 0, -1, 0, 0);
568 }
569 
571  void *v2 = a2;
572  pArcomageGame->field_0 = 0;
574 
575  window->PeekSingleMessage();
576 
577  memcpy(v2, &pArcomageGame->stru1, 0xCu);
578  return pArcomageGame->stru1.am_input_type != 0;
579 }
580 
582  // load layout sprite
585  return true;
586 }
587 
589  ArcomageCard *pCard, int mastery) {
590  enum V_IND {
591  P_TOWER_M10,
592  P_WALL_M10,
593  E_TOWER,
594  E_WALL,
595  E_BUILDINGS,
596  E_QUARRY,
597  E_MAGIC,
598  E_ZOO,
599  E_RES,
600  V_INDEX_MAX
601  };
602 
603  // mastery coeffs
604  // base mastery focus on growing walls + tower
605  // second level high priority on resource gen
606  const int mastery_coeff[V_INDEX_MAX][2] = {
607  {10, 5}, // P_TOWER_M10
608  {2, 1}, // P_WALL_M10
609  {1, 10}, // E_TOWER
610  {1, 3}, // E_WALL
611  {1, 7}, // E_BUILDINGS
612  {1, 5}, // E_QUARRY
613  {1, 40}, // E_MAGIC
614  {1, 40}, // E_ZOO
615  {1, 2} // E_RES
616  };
617 
618  int card_power = 0;
619  int element_power = 0;
620 
621  if (pCard->to_player_tower == 99 || pCard->to_pl_enm_tower == 99 ||
622  pCard->to_player_tower2 == 99 || pCard->to_pl_enm_tower2 == 99) {
623  element_power = enemy->tower_height - player->tower_height;
624  } else {
625  element_power = pCard->to_player_tower + pCard->to_pl_enm_tower +
626  pCard->to_player_tower2 + pCard->to_pl_enm_tower2;
627  }
628 
629  if (player->tower_height >= 10) {
630  card_power += mastery_coeff[P_TOWER_M10][mastery] * element_power;
631  } else {
632  card_power += 20 * element_power;
633  }
634 
635  if (pCard->to_player_wall == 99 || pCard->to_pl_enm_wall == 99 ||
636  pCard->to_player_wall2 == 99 || pCard->to_pl_enm_wall2 == 99) {
637  element_power = enemy->wall_height - player->wall_height;
638  } else {
639  element_power = pCard->to_player_wall + pCard->to_pl_enm_wall +
640  pCard->to_player_wall2 + pCard->to_pl_enm_wall2;
641  }
642 
643  if (player->wall_height >= 10) {
644  card_power += mastery_coeff[P_WALL_M10][mastery] * element_power; // 1
645  } else {
646  card_power += 5 * element_power;
647  }
648 
649  card_power +=
650  7 * (pCard->to_player_buildings + pCard->to_pl_enm_buildings +
652 
653  if (pCard->to_player_quarry_lvl == 99 ||
654  pCard->to_pl_enm_quarry_lvl == 99 ||
655  pCard->to_player_quarry_lvl2 == 99 ||
656  pCard->to_pl_enm_quarry_lvl2 == 99) {
657  element_power = enemy->quarry_level - player->quarry_level;
658  } else {
659  element_power =
662  }
663 
664  card_power += 40 * element_power;
665 
666  if (pCard->to_player_magic_lvl == 99 || pCard->to_pl_enm_magic_lvl == 99 ||
667  pCard->to_player_magic_lvl2 == 99 ||
668  pCard->to_pl_enm_magic_lvl2 == 99) {
669  element_power = enemy->magic_level - player->magic_level;
670  } else {
671  element_power =
672  pCard->to_player_magic_lvl + pCard->to_pl_enm_magic_lvl +
674  }
675  card_power += 40 * element_power;
676 
677  if (pCard->to_player_zoo_lvl == 99 || pCard->to_pl_enm_zoo_lvl == 99 ||
678  pCard->to_player_zoo_lvl2 == 99 || pCard->to_pl_enm_zoo_lvl2 == 99) {
679  element_power = enemy->zoo_level - player->zoo_level;
680  } else {
681  element_power = pCard->to_player_zoo_lvl + pCard->to_pl_enm_zoo_lvl +
682  pCard->to_player_zoo_lvl2 + pCard->to_pl_enm_zoo_lvl2;
683  }
684  card_power += 40 * element_power;
685 
686  if (pCard->to_player_bricks == 99 || pCard->to_pl_enm_bricks == 99 ||
687  pCard->to_player_bricks2 == 99 || pCard->to_pl_enm_bricks2 == 99) {
688  element_power = enemy->resource_bricks - player->resource_bricks;
689  } else {
690  element_power = pCard->to_player_bricks + pCard->to_pl_enm_bricks +
691  pCard->to_player_bricks2 + pCard->to_pl_enm_bricks2;
692  }
693  card_power += 2 * element_power;
694 
695  if (pCard->to_player_gems == 99 || pCard->to_pl_enm_gems == 99 ||
696  pCard->to_player_gems2 == 99 || pCard->to_pl_enm_gems2 == 99) {
697  element_power = enemy->resource_gems - player->resource_gems;
698  } else {
699  element_power = pCard->to_player_gems + pCard->to_pl_enm_gems +
700  pCard->to_player_gems2 + pCard->to_pl_enm_gems2;
701  }
702  card_power += 2 * element_power;
703 
704  if (pCard->to_player_beasts == 99 || pCard->to_pl_enm_beasts == 99 ||
705  pCard->to_player_beasts2 == 99 || pCard->to_pl_enm_beasts2 == 99) {
706  element_power = enemy->resource_beasts - player->resource_beasts;
707  } else {
708  element_power = pCard->to_player_beasts + pCard->to_pl_enm_beasts +
709  pCard->to_player_beasts2 + pCard->to_pl_enm_beasts2;
710  }
711  card_power += 2 * element_power;
712 
713  if (pCard->to_enemy_tower == 99 || pCard->to_enemy_tower2 == 99) {
714  element_power = player->tower_height - enemy->tower_height;
715  } else {
716  element_power = -(pCard->to_enemy_tower + pCard->to_enemy_tower2);
717  }
718  card_power += mastery_coeff[E_TOWER][mastery] * element_power;
719 
720  if (pCard->to_enemy_wall == 99 || pCard->to_enemy_wall2 == 99) {
721  element_power = player->wall_height - enemy->wall_height;
722  } else {
723  element_power = -(pCard->to_enemy_wall + pCard->to_enemy_wall2);
724  }
725  card_power += mastery_coeff[E_WALL][mastery] * element_power;
726 
727  card_power -= mastery_coeff[E_BUILDINGS][mastery] *
728  (pCard->to_enemy_buildings + pCard->to_enemy_buildings2);
729 
730  if (pCard->to_enemy_quarry_lvl == 99 || pCard->to_enemy_quarry_lvl2 == 99) {
731  element_power = player->quarry_level - enemy->quarry_level; // 5
732  } else {
733  element_power =
734  -(pCard->to_enemy_quarry_lvl + pCard->to_enemy_quarry_lvl2); // 5
735  }
736  card_power += mastery_coeff[E_QUARRY][mastery] * element_power;
737 
738  if (pCard->to_enemy_magic_lvl == 99 || pCard->to_enemy_magic_lvl2 == 99) {
739  element_power = player->magic_level - enemy->magic_level; // 40
740  } else {
741  element_power =
742  -(pCard->to_enemy_magic_lvl + pCard->to_enemy_magic_lvl2);
743  }
744  card_power += mastery_coeff[E_MAGIC][mastery] * element_power;
745 
746  if (pCard->to_enemy_zoo_lvl == 99 || pCard->to_enemy_zoo_lvl2 == 99) {
747  element_power = player->zoo_level - enemy->zoo_level; // 40
748  } else {
749  element_power = -(pCard->to_enemy_zoo_lvl + pCard->to_enemy_zoo_lvl2);
750  }
751  card_power += mastery_coeff[E_ZOO][mastery] * element_power;
752 
753  if (pCard->to_enemy_bricks == 99 || pCard->to_enemy_bricks2 == 99) {
754  element_power = player->resource_bricks - enemy->resource_bricks; // 2
755  } else {
756  element_power = -(pCard->to_enemy_bricks + pCard->to_enemy_bricks2);
757  }
758  card_power += mastery_coeff[E_RES][mastery] * element_power;
759 
760  if (pCard->to_enemy_gems == 99 || pCard->to_enemy_gems2 == 99) {
761  element_power = player->resource_gems - enemy->resource_gems; // 2
762  } else {
763  element_power = -(pCard->to_enemy_gems + pCard->to_enemy_gems2);
764  }
765  card_power += mastery_coeff[E_RES][mastery] * element_power;
766 
767  if (pCard->to_enemy_beasts == 99 || pCard->to_enemy_beasts2 == 99) {
768  element_power = player->resource_beasts - enemy->resource_beasts; // 2
769  } else {
770  element_power = -(pCard->to_enemy_beasts + pCard->to_enemy_beasts2);
771  }
772  card_power += mastery_coeff[E_RES][mastery] * element_power;
773 
774  if (pCard->field_30 || pCard->field_4D) {
775  card_power *= 10;
776  }
777 
778  if (pCard->card_resource_type == 1) {
779  element_power = player->resource_bricks - pCard->needed_bricks;
780  } else if (pCard->card_resource_type == 2) {
781  element_power = player->resource_gems - pCard->needed_gems;
782  } else if (pCard->card_resource_type == 3) {
783  element_power = player->resource_beasts - pCard->needed_beasts;
784  }
785  if (element_power > 3) {
786  element_power = 3;
787  }
788  card_power += 5 * element_power;
789 
790  if (enemy->tower_height <= pCard->to_enemy_tower2 + pCard->to_enemy_tower) {
791  card_power += 9999;
792  }
793 
794  if (pCard->to_enemy_tower2 + pCard->to_enemy_tower + pCard->to_enemy_wall +
795  pCard->to_enemy_wall2 + pCard->to_enemy_buildings +
796  pCard->to_enemy_buildings2 >=
797  enemy->wall_height + enemy->tower_height) {
798  card_power += 9999;
799  }
800 
801  if ((pCard->to_player_tower2 + pCard->to_pl_enm_tower2 +
802  pCard->to_player_tower + pCard->to_pl_enm_tower +
803  player->tower_height) >= max_tower_height) {
804  card_power += 9999;
805  }
806 
807  return card_power;
808 }
809 
810 bool OpponentsAITurn(int player_num) {
811  if (player_num == 0) __debugbreak();
812 
813  int ai_player_cards_count = GetPlayerHandCardCount(player_num);
814  if (ai_player_cards_count == 0) return true;
815 
816  // opponent_mastery = 2; // testing
817 
818  opponents_turn = 1;
819  if (opponent_mastery == 0) {
820  // select card at random to play
821  int random_card_slot;
822  if (need_to_discard_card == 0) {
823  for (int i = 0; i < 10; ++i) {
824  random_card_slot = rand_interval(0, ai_player_cards_count - 1);
825  if (CanCardBePlayed(player_num, random_card_slot))
826  return PlayCard(player_num, random_card_slot);
827  }
828  }
829 
830  // if that fails discard card at random
831  random_card_slot = rand_interval(0, ai_player_cards_count - 1);
832  return DiscardCard(player_num, random_card_slot);
833 
834  } else if ((opponent_mastery == 1) || (opponent_mastery == 2)) {
835  // apply some cunning
836  ArcomagePlayer* player = &am_Players[player_num];
837  ArcomagePlayer* enemy = &am_Players[(player_num + 1) % 2];
838 
839  // wipe cards power array - set negative for unfilled card slots
840  for (int i = 0; i < 10; ++i) {
841  if (i >= ai_player_cards_count) {
842  cards_power[i].slot_index = -1;
843  cards_power[i].card_power = -9999;
844  } else {
845  cards_power[i].slot_index = i;
846  cards_power[i].card_power = 0;
847  }
848  }
849 
850  // calculate how effective each card would be
851  for (int i = 0; i < ai_player_cards_count; ++i) {
852  ArcomageCard* calc_card = &pCards[am_Players[player_num].cards_at_hand[cards_power[i].slot_index]];
854  CalculateCardPower(player, enemy, calc_card, opponent_mastery - 1);
855  }
856 
857  // bubble sort the card powers in order
858  for (int j = ai_player_cards_count - 1; j >= 0; --j) {
859  for (int m = 0; m < j; ++m) {
860  if (cards_power[m].card_power < cards_power[m + 1].card_power) {
861  int tempslot = cards_power[m].slot_index;
862  int temppow = cards_power[m].card_power;
865  cards_power[m + 1].slot_index = tempslot;
866  cards_power[m + 1].card_power = temppow;
867  }
868  }
869  }
870 
871  // if we have to discard pick the least powerful to chuck
872  int discard_slot = 0;
873  for (int i = ai_player_cards_count - 1; i; --i) {
874  if (i >= 0) {
875  if (pCards[am_Players[player_num].cards_at_hand[cards_power[i].slot_index]].can_be_discarded) {
876  discard_slot = cards_power[i].slot_index;
877  }
878  }
879  }
880 
881  if (!need_to_discard_card) {
882  // try and play most powerful card
883  for (int i = 0; i < ai_player_cards_count - 1; ++i) {
884  if (CanCardBePlayed(player_num, cards_power[i].slot_index) && cards_power[i].card_power) {
885  return PlayCard(player_num, cards_power[i].slot_index);
886  }
887  }
888  }
889 
890  // fall back - have to discard
891  return DiscardCard(player_num, discard_slot);
892  }
893  return true; // result != 0;
894 }
895 
897  bool am_turn_not_finished = 0;
898  while (!pArcomageGame->GameOver) {
900  am_turn_not_finished = 1;
902  // LABEL_8:
903  while (am_turn_not_finished) {
904  played_card_id = -1;
906  while (1) {
907  am_turn_not_finished = PlayerTurn(current_player_num);
911  break;
912  }
914  if (pArcomageGame->force_am_exit) break;
915  }
916  }
920  }
921 
922 
924 
925  if (pArcomageGame->check_exit == 0) {
926  // add in pause till keypress here
928  int frame_quant_time;
929  int cnt = 0;
930  while (1) {
931  // frame limiter apprx 32fps 128 / 32 = 4
932  do {
933  frame_quant_time = (int)pEventTimer->Time() - (int)pArcomageGame->event_timer_time;
934  } while (frame_quant_time < 4);
936 
937  ArcomageGame::MsgLoop(20, &v10);
938  if (v10.am_input_type == 1) {
939  if (v10.field_4) break;
940  continue;
941  }
942  if ((v10.am_input_type == 7) || (v10.am_input_type == 8)) break;
943  if (v10.am_input_type == 10) break;
944 
945  Point explos_coords;
946 
947  cnt++;
948  if (cnt >= 8) {
949  cnt = 0;
950  if (pArcomageGame->uGameWinner == 1) {
951  if (am_Players[1].tower_height > 0) {
952  int div = (am_Players[1].tower_height / 10);
953  if (div == 0) div = 1;
954  am_Players[1].tower_height -= div;
955  explos_coords.x = 514;
956  explos_coords.y = 296;
957  new_explosion_effect(&explos_coords, -div);
958  }
959  if (am_Players[1].wall_height > 0) {
960  int div = (am_Players[1].wall_height / 10);
961  if (div == 0) div = 1;
962  am_Players[1].wall_height -= div;
963  explos_coords.x = 442;
964  explos_coords.y = 296;
965  new_explosion_effect(&explos_coords, -div);
966  }
967  } else {
968  if (am_Players[0].tower_height > 0) {
969  int div = (am_Players[0].tower_height / 10);
970  if (div == 0) div = 1;
971  am_Players[0].tower_height -= div;
972  explos_coords.x = 122;
973  explos_coords.y = 296;
974  new_explosion_effect(&explos_coords, -div);
975  }
976  if (am_Players[0].wall_height > 0) {
977  int div = (am_Players[0].wall_height / 10);
978  if (div == 0) div = 1;
979  am_Players[0].wall_height -= div;
980  explos_coords.x = 180;
981  explos_coords.y = 296;
982  new_explosion_effect(&explos_coords, -div);
983  }
984  }
985  }
986 
987  // draw you lost/ you won + fireworks
988 
989  int rand = rand_interval(0, 38);
990  if (rand == 38) {
991  if (pArcomageGame->uGameWinner == 1) {
992  explos_coords.x = rand_interval(75, 175);
993  explos_coords.y = rand_interval(50, 150);
994  new_explosion_effect(&explos_coords, 5);
995  } else {
996  explos_coords.x = rand_interval(465, 565);
997  explos_coords.y = rand_interval(50, 150);
998  new_explosion_effect(&explos_coords, 5);
999  }
1000  }
1001 
1002 
1003  DrawGameUI(0);
1004  }
1005  }
1006 
1007  for (int i = 0; i < 10; ++i) {
1010  }
1011 
1013  pArcomageGame->pGameBackground = nullptr;
1014 
1016  pArcomageGame->pSprites = nullptr;
1017 
1018  pArcomageGame->bGameInProgress = false;
1019  viewparams->bRedrawGameUI = true;
1020 
1022 }
1023 
1025  signed int j; // edx@7
1026  int card_id_counter; // edx@13
1027  signed int i; // ecx@13
1028  signed int card_dispenser_counter; // eax@13
1029 
1031 
1033  strcpy(am_Players[1].pPlayerName, pArcomageGame->pPlayer2Name);
1034  am_Players[1].IsHisTurn = 0; // !Player_Gets_First_Turn;
1035  strcpy(am_Players[0].pPlayerName, pArcomageGame->pPlayer1Name);
1036  am_Players[0].IsHisTurn = 1; // Player_Gets_First_Turn;
1037 
1038  for (i = 0; i < 2; ++i) {
1047 
1048  for (j = 0; j < 10; ++j) {
1049  am_Players[i].cards_at_hand[j] = -1;
1050  if (Player_Cards_Shift) {
1051  am_Players[i].card_shift[j].x = -1;
1052  am_Players[i].card_shift[j].y = -1;
1053  } else {
1054  am_Players[i].card_shift[j].x = 0;
1055  am_Players[i].card_shift[j].y = 0;
1056  }
1057  }
1058  }
1059  strcpy(deckMaster.name, "Master Deck");
1060  for (i = 0, card_dispenser_counter = -2, card_id_counter = 0; i < DECK_SIZE;
1061  ++i, ++card_dispenser_counter) {
1062  deckMaster.cardsInUse[i] = 0;
1063  deckMaster.cards_IDs[i] = card_id_counter;
1064  switch (card_dispenser_counter) {
1065  case 0:
1066  case 2:
1067  case 6:
1068  case 9:
1069  case 13:
1070  case 18:
1071  case 23:
1072  case 33:
1073  case 36:
1074  case 38:
1075  case 44:
1076  case 46:
1077  case 52:
1078  case 57:
1079  case 69:
1080  case 71:
1081  case 75:
1082  case 79:
1083  case 81:
1084  case 84:
1085  case 89:
1086  break;
1087  default:
1088  ++card_id_counter;
1089  }
1090  }
1091  FillPlayerDeck();
1092 }
1093 
1095  int m;
1096  int rand_deck_pos;
1097  char card_taken_flags[DECK_SIZE];
1098  int i, j;
1099 
1101  memset(deckMaster.cardsInUse, 0, DECK_SIZE);
1102  memset(card_taken_flags, 0, DECK_SIZE);
1103 
1104  for (i = 0; i < 2; ++i) {
1105  for (j = 0; j < 10; ++j) {
1106  if (am_Players[i].cards_at_hand[j] > -1) {
1107  for (m = 0; m < DECK_SIZE; ++m) {
1108  if (deckMaster.cards_IDs[m] ==
1109  am_Players[i].cards_at_hand[j] &&
1110  deckMaster.cardsInUse[m] == 0) {
1111  // mark which cards are already in players hands
1112  deckMaster.cardsInUse[m] = 1;
1113  break;
1114  }
1115  }
1116  }
1117  }
1118  }
1119 
1120  for (i = 0; i < DECK_SIZE; ++i) {
1121  do {
1122  rand_deck_pos = rand() % DECK_SIZE;
1123  } while (card_taken_flags[rand_deck_pos] == 1);
1124 
1125  card_taken_flags[rand_deck_pos] = 1;
1126  playDeck.cards_IDs[i] = deckMaster.cards_IDs[rand_deck_pos];
1127  playDeck.cardsInUse[i] = deckMaster.cardsInUse[rand_deck_pos];
1128  }
1129 
1130  deck_walk_index = 0;
1132 }
1133 
1135  for (int i = 0; i < minimum_cards_at_hand; ++i) {
1136  // GetNextCardFromDeck(0);
1137  // GetNextCardFromDeck(1);
1139  }
1141 }
1142 
1143 void GetNextCardFromDeck(int player_num) {
1144  signed int deck_index; // eax@1
1145  int new_card_id; // edi@1
1146  signed int card_slot_indx; // eax@7
1147 
1148  deck_index = deck_walk_index;
1149  for (;;) {
1150  if (deck_index >= DECK_SIZE) {
1151  FillPlayerDeck();
1152  deck_index = deck_walk_index = 0;
1153  }
1154  if (!playDeck.cardsInUse[deck_index]) {
1155  new_card_id = playDeck.cards_IDs[deck_index];
1156  ++deck_index;
1157  deck_walk_index = deck_index;
1158  break;
1159  }
1160  ++deck_index;
1161  deck_walk_index = deck_index;
1162  }
1163 
1165  card_slot_indx = GetEmptyCardSlotIndex(player_num);
1166  if (card_slot_indx != -1) {
1167  drawn_card_slot_index = card_slot_indx;
1168  am_Players[player_num].cards_at_hand[card_slot_indx] = new_card_id;
1169  am_Players[player_num].card_shift[card_slot_indx].x = rand_interval(-4, 4);
1170  am_Players[player_num].card_shift[card_slot_indx].y = rand_interval(-4, 4);
1173  }
1174 }
1175 
1176 int GetEmptyCardSlotIndex(int player_num) {
1177  // find first empty card slot
1178  for (int i = 0; i < 10; ++i) {
1179  if (am_Players[player_num].cards_at_hand[i] == -1) return i;
1180  }
1181  return -1;
1182 }
1183 
1184 void IncreaseResourcesInTurn(int player_num) {
1185  // increase player resources
1186  am_Players[player_num].resource_bricks +=
1187  quarry_bonus + am_Players[player_num].quarry_level;
1188  am_Players[player_num].resource_gems +=
1189  magic_bonus + am_Players[player_num].magic_level;
1190  am_Players[player_num].resource_beasts +=
1191  zoo_bonus + am_Players[player_num].zoo_level;
1192 }
1193 
1194 void TurnChange() {
1195  char player_name[64]; // [sp+4h] [bp-64h]@4
1196  ArcomageGame_InputMSG v10; // [sp+54h] [bp-14h]@7
1197  Point v11; // [sp+60h] [bp-8h]@4
1198 
1199  if (!pArcomageGame->force_am_exit) {
1200  if (am_Players[0].IsHisTurn != 1 || am_Players[1].IsHisTurn != 1) {
1203  if (current_player_num >= 2) current_player_num = 0;
1204  } else {
1205  // this is never called - pause when switching turns
1206 
1207  // nullsub_1();
1208  // v11.x = 0;
1209  // v11.y = 0;
1210  strcpy(player_name, "The Next Player is: "); //"След"
1211  // v0 = 0;
1212  v11.y = 200;
1213  v11.x = 320; // - 12 * v0 / 2;
1214  am_DrawText(player_name, &v11);
1217  if (current_player_num >= 2) current_player_num = 0;
1218  strcpy(player_name, am_Players[current_player_num].pPlayerName);
1219  // v4 = 0;
1220  v11.y = 260;
1221  v11.x = 320; // - 12 * v4 / 2;
1222  am_DrawText(player_name, &v11);
1223  /* v6.left = 0;
1224  v6.right = 640;
1225  v6.top = 0;
1226  v6.bottom = 480;*/
1227  // nullsub_1();
1228  render->Present();
1229  // nullsub_1();
1230  while (1) {
1231  while (!ArcomageGame::MsgLoop(20, &v10));
1232  if (v10.am_input_type == 1) {
1233  if (v10.field_4) break;
1234  // nullsub_1();
1235  continue;
1236  }
1237  if ((v10.am_input_type > 4) && (v10.am_input_type <= 8)) break;
1238  if (v10.am_input_type == 10) {
1240  // byte_4FAA74 = 1;
1241  break;
1242  }
1243  }
1244  /* v11.x = 0;
1245  v11.y = 0;
1246  v6.left = 0;
1247  v6.right = 640;
1248  v6.top = 0;
1249  v6.bottom = 480;*/
1250  // nullsub_1();
1251  render->Present();
1252  }
1253  }
1254 }
1255 
1256 bool IsGameOver() {
1257  // check if victory conditions have been met
1258  bool result = false;
1259  for (int i = 0; i < 2; ++i) {
1260  if (am_Players[i].tower_height <= 0) result = true;
1261  if (am_Players[i].tower_height >= max_tower_height) result = true;
1262  if (am_Players[i].resource_bricks >= max_resources_amount ||
1263  am_Players[i].resource_gems >= max_resources_amount ||
1264  am_Players[i].resource_beasts >= max_resources_amount)
1265  result = true;
1266  }
1267 
1268  return result;
1269 }
1270 
1271 char PlayerTurn(int player_num) {
1272  Rect pSrcXYZW;
1273  Point pTargetXY;
1274  ArcomageGame_InputMSG get_message;
1275 
1276  // reset player turn
1277  opponents_turn = 0;
1278  num_actions_left = 0;
1279 
1280  // reset animations
1281  int animation_stage = 20;
1282  drawn_card_anim_cnt = 10;
1284  discarded_card_id = -1;
1286 
1287  // timing and loop
1288  int frame_quant_time;
1289  bool break_loop = false;
1290  do {
1291  // frame limiter apprx 32fps 128 / 32 = 4
1292  do {
1293  frame_quant_time = (int)pEventTimer->Time() - (int)pArcomageGame->event_timer_time;
1294  } while (frame_quant_time < 4);
1296 
1297  // get input message
1298  if (pArcomageGame->force_am_exit) break_loop = true;
1299  ArcomageGame::MsgLoop(0, &get_message);
1300  switch (get_message.am_input_type) {
1301  case 2: // unkown ??
1302  if (get_message.field_4 == 129 && get_message.am_input_key == 1) {
1303  pAudioPlayer->StopChannels(-1, -1);
1304  num_actions_left = 0;
1305  break_loop = true;
1307  }
1308  break;
1309  case 9: // toggle fullscreen
1311  break;
1312  case 10: // hit escape key
1313  if (pArcomageGame->check_exit == 1) {
1314  pAudioPlayer->StopChannels(-1, -1);
1315  pArcomageGame->GameOver = 1;
1318  break_loop = true;
1320  } else {
1323  }
1324  break;
1325  }
1326 
1327  // time to start the AIs turn
1328  if (am_Players[current_player_num].IsHisTurn != 1 && !opponents_turn &&
1333  }
1334 
1336 
1338  // player cant act
1340 
1341  // card drawing animation
1342  if (drawn_card_anim_start) {
1344  if (drawn_card_anim_cnt < 0) {
1346  drawn_card_anim_cnt = 10;
1347  break_loop = false;
1350  }
1351  }
1352  }
1353 
1354  // card played/ discarded animation
1355  if (playdiscard_anim_start) {
1356  --animation_stage;
1357  if (animation_stage < 0) {
1358  if (num_actions_left > 1) {
1359  --num_actions_left;
1360  opponents_turn = 0;
1361  } else {
1362  break_loop = true;
1363  }
1365  animation_stage = 20;
1366  }
1367  }
1368  } else {
1369  // can play cards
1370  if (need_to_discard_card) {
1371  // any mouse - try and discard
1372  if ((get_message.am_input_type == 7 || get_message.am_input_type == 8) && DiscardCard(player_num, current_card_slot_index)) {
1374  if (num_cards_to_discard > 0) {
1377  }
1379  }
1380  } else {
1381  if (get_message.am_input_type == 7) {
1382  // left mouse - try and play card
1383  if (PlayCard(player_num, current_card_slot_index)) {
1386  }
1387  }
1388  if (get_message.am_input_type == 8) {
1389  // right mouse - try and discard card
1390  if (DiscardCard(player_num, current_card_slot_index)) {
1393  }
1394  }
1395  }
1396  }
1397 
1398  // if the hover rectangle has moved redraw
1399  if (Card_Hover_Index != DrawCardsRectangles(player_num)) {
1400  Card_Hover_Index = DrawCardsRectangles(player_num);
1402  }
1403 
1404  // do we need to draw
1406  DrawGameUI(animation_stage);
1408  }
1409  } while (!break_loop);
1410 
1411  return num_actions_left > 0;
1412 }
1413 
1414 void DrawGameUI(int animation_stage) {
1415  // set copy image location
1417  // draw background
1418  render->DrawTextureNew(0, 0, pArcomageGame->pGameBackground);
1419 
1420  // draw gui items
1422  DrawCards(); //рисуем карты
1423  DrawPlayersTowers(); //рисуем башню
1424  DrawPlayersWall(); //рисуем стену
1425  DrawPlayersText(); //рисуем текст
1426 
1427  DrawCardAnimation(animation_stage);
1429 
1430  // update explosion effects
1431  for (int i = 0; i < 10; ++i) {
1432  if (am_effects_array[i].have_effect) am_effects_array[i].explosion_eff->UpdateEffect();
1433  }
1434  DrawSparks();
1435 
1436  // draw texts
1437  if (pArcomageGame->check_exit) {
1438  String t = "Are you sure you want to resign?\n Press ESC again to confirm";
1439  Point p(200, 200);
1440  am_DrawText(t, &p);
1441  }
1442  if (pArcomageGame->GameOver) {
1443  String t = "Game Over!";
1444  Point p(270, 200);
1445  am_DrawText(t, &p);
1446  }
1447 
1448  render->Present();
1449 }
1450 
1452  Rect pSrcRect;
1453  Point pTargetXY;
1454 
1455  // resources rectangles
1456  pSrcRect.x = 765;
1457  pSrcRect.y = 0;
1458  pSrcRect.z = 843;
1459  pSrcRect.w = 216;
1460 
1461  pTargetXY.x = 8;
1462  pTargetXY.y = 56;
1463  render->am_Blt_Chroma(&pSrcRect, &pTargetXY, 0, 2);
1464 
1465  pTargetXY.x = 555;
1466  pTargetXY.y = 56;
1467  render->am_Blt_Chroma(&pSrcRect, &pTargetXY, 0, 2);
1468 
1469  // players name rectangle
1470  pSrcRect.x = 283;
1471  pSrcRect.y = 166;
1472  pSrcRect.z = 361;
1473  pSrcRect.w = 190;
1474  pTargetXY.x = 8;
1475  pTargetXY.y = 13;
1476  render->am_Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
1477 
1478  pTargetXY.x = 555;
1479  pTargetXY.y = 13;
1480  render->am_Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
1481 
1482  // tower height rectangle
1483  pSrcRect.x = 234;
1484  pSrcRect.y = 166;
1485  pSrcRect.z = 283;
1486  pSrcRect.w = 190;
1487  pTargetXY.x = 100;
1488  pTargetXY.y = 296;
1489  render->am_Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
1490 
1491  pTargetXY.x = 492;
1492  pTargetXY.y = 296;
1493  render->am_Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
1494 
1495  // wall height rectangle
1496  pSrcRect.x = 192;
1497  pSrcRect.y = 166;
1498  pSrcRect.z = 234;
1499  pSrcRect.w = 190;
1500  pTargetXY.x = 168;
1501  pTargetXY.y = 296;
1502  render->am_Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
1503 
1504  pTargetXY.x = 430;
1505  pTargetXY.y = 296;
1506  render->am_Blt_Chroma(&pSrcRect, &pTargetXY, pArcomageGame->field_54, 2);
1507 }
1508 
1510  int res_value;
1511  char text_buff[32];
1512  Point text_position;
1513 
1514  if (need_to_discard_card) {
1515  // DISCARD A CARD
1516  strcpy(text_buff, localization->GetString(266));
1517  text_position.x = 320 - pArcomageGame->pfntArrus->GetLineWidth(text_buff) / 2;
1518  text_position.y = 306;
1519  am_DrawText(text_buff, &text_position);
1520  }
1521 
1522  // player names
1523  strcpy(text_buff, am_Players[0].pPlayerName);
1524  if (!current_player_num) strcat(text_buff, "***");
1525  text_position.x = 47 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2;
1526  text_position.y = 21;
1527  am_DrawText(text_buff, &text_position);
1528 
1529  strcpy(text_buff, am_Players[1].pPlayerName);
1530  if (current_player_num == 1) strcat(text_buff, "***");
1531  text_position.x = 595 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2;
1532  text_position.y = 21;
1533  am_DrawText(text_buff, &text_position);
1534 
1535  // tower heights
1536  am_IntToString(am_Players[0].tower_height, text_buff);
1537  text_position.x = 123 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2;
1538  text_position.y = 305;
1539  am_DrawText(text_buff, &text_position);
1540 
1541  am_IntToString(am_Players[1].tower_height, text_buff);
1542  text_position.x = 515 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2;
1543  text_position.y = 305;
1544  am_DrawText(text_buff, &text_position);
1545 
1546  // wall heights
1547  am_IntToString(am_Players[0].wall_height, text_buff);
1548  text_position.x = 188 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2;
1549  text_position.y = 305;
1550  am_DrawText(text_buff, &text_position);
1551 
1552  am_IntToString(am_Players[1].wall_height, text_buff);
1553  text_position.x = 451 - pArcomageGame->pfntComic->GetLineWidth(text_buff) / 2;
1554  text_position.y = 305;
1555  am_DrawText(text_buff, &text_position);
1556 
1557  // quarry levels
1558  res_value = am_Players[0].quarry_level;
1559  if (use_start_bonus) res_value = am_Players[0].quarry_level + quarry_bonus;
1560  text_position.x = 14;
1561  text_position.y = 92;
1562  DrawPlayerLevels(StringFromInt(res_value), &text_position);
1563 
1564  res_value = am_Players[1].quarry_level;
1565  if (use_start_bonus) res_value = am_Players[1].quarry_level + quarry_bonus;
1566  text_position.y = 92;
1567  text_position.x = 561;
1568  DrawPlayerLevels(StringFromInt(res_value), &text_position);
1569 
1570  // magic levels
1571  res_value = am_Players[0].magic_level;
1572  if (use_start_bonus) res_value = am_Players[0].magic_level + magic_bonus;
1573  text_position.y = 164;
1574  text_position.x = 14;
1575  DrawPlayerLevels(StringFromInt(res_value), &text_position);
1576 
1577  res_value = am_Players[1].magic_level;
1578  if (use_start_bonus) res_value = am_Players[1].magic_level + magic_bonus;
1579  text_position.y = 164;
1580  text_position.x = 561;
1581  DrawPlayerLevels(StringFromInt(res_value), &text_position);
1582 
1583  // zoo levels
1584  res_value = am_Players[0].zoo_level;
1585  if (use_start_bonus) res_value = am_Players[0].zoo_level + zoo_bonus;
1586  text_position.y = 236;
1587  text_position.x = 14;
1588  DrawPlayerLevels(StringFromInt(res_value), &text_position);
1589 
1590  res_value = am_Players[1].zoo_level;
1591  if (use_start_bonus) res_value = am_Players[1].zoo_level + zoo_bonus;
1592  text_position.y = 236;
1593  text_position.x = 561;
1594  DrawPlayerLevels(StringFromInt(res_value), &text_position);
1595 
1596  // bricks
1597  text_position.y = 114;
1598  text_position.x = 10;
1599  DrawBricksCount(StringFromInt(am_Players[0].resource_bricks), &text_position);
1600 
1601  text_position.x = 557;
1602  text_position.y = 114;
1603  DrawBricksCount(StringFromInt(am_Players[1].resource_bricks), &text_position);
1604 
1605  // gems
1606  text_position.x = 10;
1607  text_position.y = 186;
1608  DrawGemsCount(StringFromInt(am_Players[0].resource_gems), &text_position);
1609 
1610  text_position.x = 557;
1611  text_position.y = 186;
1612  DrawGemsCount(StringFromInt(am_Players[1].resource_gems), &text_position);
1613 
1614  // beasts
1615  text_position.x = 10;
1616  text_position.y = 258;
1617  DrawBeastsCount(StringFromInt(am_Players[0].resource_beasts), &text_position);
1618 
1619  text_position.x = 557;
1620  text_position.y = 258;
1621  DrawBeastsCount(StringFromInt(am_Players[1].resource_beasts), &text_position);
1622 }
1623 
1624 void DrawPlayerLevels(const String &str, Point *pXY) {
1625  Rect pSrcRect;
1626  Point pTargetPoint;
1627 
1628  pTargetPoint.x = pXY->x;
1629  pTargetPoint.y = pXY->y;
1630  for (auto i = str.begin(); i != str.end(); ++i) {
1631  // get each digit
1632  if (*i) {
1633  // calc position in sprite layout
1634  int v7 = 22 * *i;
1635  pSrcRect.z = v7 - 842;
1636  pSrcRect.x = v7 - 864;
1637  pSrcRect.y = 190;
1638  pSrcRect.w = 207;
1639  // draw digit
1640  render->am_Blt_Chroma(&pSrcRect, &pTargetPoint, pArcomageGame->field_54, 1);
1641  pTargetPoint.x += 22;
1642  }
1643  }
1644 }
1645 
1646 void DrawBricksCount(const String &str, Point *pXY) {
1647  Rect pSrcRect;
1648  Point pTargetPoint;
1649 
1650  pTargetPoint.x = pXY->x;
1651  pTargetPoint.y = pXY->y;
1652  for (auto i = str.begin(); i != str.end(); ++i) {
1653  // get each digit
1654  if (*i) {
1655  // calc position in sprite layout
1656  int v7 = 13 * *i;
1657  pSrcRect.x = v7 - 370;
1658  pSrcRect.z = v7 - 357;
1659  pSrcRect.y = 128;
1660  pSrcRect.w = 138;
1661  // draw digit
1662  render->am_Blt_Chroma(&pSrcRect, &pTargetPoint, 0, 2);
1663  pTargetPoint.x += 13;
1664  }
1665  }
1666 }
1667 
1668 void DrawGemsCount(const String &str, Point *pXY) {
1669  Rect pSrcRect;
1670  Point pTargetPoint;
1671 
1672  pTargetPoint.x = pXY->x;
1673  pTargetPoint.y = pXY->y;
1674  for (auto i = str.begin(); i != str.end(); ++i) {
1675  // get each digit
1676  if (*i) {
1677  // calc position in sprite layout
1678  int v7 = 13 * *i;
1679  pSrcRect.x = v7 - 370;
1680  pSrcRect.z = v7 - 357;
1681  pSrcRect.y = 138;
1682  pSrcRect.w = 148;
1683  // draw digit
1684  render->am_Blt_Chroma(&pSrcRect, &pTargetPoint, 0, 2);
1685  pTargetPoint.x += 13;
1686  }
1687  }
1688 }
1689 
1690 void DrawBeastsCount(const String &str, Point *pXY) {
1691  Rect pSrcRect;
1692  Point pTargetPoint;
1693 
1694  pTargetPoint.x = pXY->x;
1695  pTargetPoint.y = pXY->y;
1696  for (auto i = str.begin(); i != str.end(); ++i) {
1697  // get each digit
1698  if (*i) {
1699  // calc position in sprite layout
1700  int x_offset = 13 * *i;
1701  pSrcRect.x = x_offset - 370;
1702  pSrcRect.z = x_offset - 357;
1703  pSrcRect.y = 148;
1704  pSrcRect.w = 158;
1705  // draw digit
1706  render->am_Blt_Chroma(&pSrcRect, &pTargetPoint, 0, 2);
1707  pTargetPoint.x += 13;
1708  }
1709  }
1710 }
1711 
1713  Rect pSrcXYZW;
1714  Point pTargetXY;
1715 
1716  // draw player 0 tower
1717  int tower_height = am_Players[0].tower_height;
1718  // check limits
1719  if (tower_height > max_tower_height) tower_height = max_tower_height;
1720  pSrcXYZW.y = 0;
1721  pSrcXYZW.x = 892;
1722  pSrcXYZW.z = 937;
1723  // calc height ratio
1724  int tower_top = 200 * tower_height / max_tower_height;
1725  pSrcXYZW.w = tower_top;
1726  pTargetXY.x = 102;
1727  pTargetXY.y = 297 - tower_top;
1728  if (tower_height > 0) render->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, 0, 2); //стена башни
1729 
1730  // draw player 0 top
1731  pSrcXYZW.y = 0;
1732  pSrcXYZW.x = 384;
1733  pSrcXYZW.z = 452;
1734  pSrcXYZW.w = 94;
1735  pTargetXY.y = 203 - tower_top;
1736  pTargetXY.x = 91;
1737  render->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2); //верхушка башни
1738 
1739  // draw player 1 tower
1740  tower_height = am_Players[1].tower_height;
1741  // set limits
1742  if (tower_height > max_tower_height) tower_height = max_tower_height;
1743  // calc tower height ratio
1744  tower_top = 200 * tower_height / max_tower_height;
1745  pSrcXYZW.y = 0;
1746  pSrcXYZW.x = 892;
1747  pSrcXYZW.z = 937;
1748  pSrcXYZW.w = tower_top;
1749  pTargetXY.x = 494;
1750  pTargetXY.y = 297 - tower_top;
1751  if (tower_height > 0) render->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, 0, 2);
1752 
1753  // draw tower 1 top
1754  pSrcXYZW.x = 384;
1755  pSrcXYZW.z = 452;
1756  pSrcXYZW.y = 94;
1757  pSrcXYZW.w = 188;
1758  pTargetXY.x = 483;
1759  pTargetXY.y = 203 - tower_top;
1760  render->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2);
1761 }
1762 
1764  Rect pSrcXYZW;
1765  Point pTargetXY;
1766 
1767  // draw player 0 wall
1768  int player_0_h = am_Players[0].wall_height;
1769  // fix limit
1770  if (player_0_h > 100) player_0_h = 100;
1771 
1772  // is there any wall the draw
1773  if (player_0_h > 0) {
1774  pSrcXYZW.y = 0;
1775  pSrcXYZW.x = 843;
1776  // calc ratio of wall to draw
1777  int player_0_pixh = 200 * player_0_h / 100;
1778  pSrcXYZW.z = 867;
1779  pSrcXYZW.w = player_0_pixh;
1780  pTargetXY.x = 177;
1781  pTargetXY.y = 297 - player_0_pixh;
1782  render->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2);
1783  }
1784 
1785  // draw player 1 wall
1786  int player_1_h = am_Players[1].wall_height;
1787  if (player_1_h > 100) player_1_h = 100;
1788  if (player_1_h > 0) {
1789  pSrcXYZW.y = 0;
1790  pSrcXYZW.x = 843;
1791  int player_1_pixh = 200 * player_1_h / 100;
1792  pSrcXYZW.z = 867;
1793  pSrcXYZW.w = player_1_pixh;
1794  pTargetXY.x = 439;
1795  pTargetXY.y = 297 - player_1_pixh;
1796  render->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2);
1797  }
1798 }
1799 
1800 void DrawCards() {
1801  // draw hand of current player and any cards on the table
1802  Rect pSrcXYZW;
1803  Point pTargetXY;
1804 
1805  // draw player hand
1806  int card_count = GetPlayerHandCardCount(current_player_num);
1807  pTargetXY.y = 327;
1808  int card_spacing = (window->GetWidth() - 96 * card_count) / (card_count + 1);
1809  pTargetXY.x = card_spacing;
1810 
1811  for (int card_slot = 0; card_slot < card_count; ++card_slot) {
1812  // shift card pos
1813  if (Player_Cards_Shift) {
1814  pTargetXY.x += am_Players[current_player_num].card_shift[card_slot].x;
1815  pTargetXY.y += am_Players[current_player_num].card_shift[card_slot].y;
1816  }
1817 
1818  if (am_Players[current_player_num].cards_at_hand[card_slot] == -1) {
1819  // need to acess another slot if card sent for animatoin
1820  ++card_count;
1821  } else if (card_slot != drawn_card_slot_index) {
1822  // draw back of card for opponents turn
1823  if (am_Players[current_player_num].IsHisTurn == 0 && See_Opponents_Cards == 0) {
1824  pSrcXYZW.x = 192;
1825  pSrcXYZW.z = 288;
1826  pSrcXYZW.y = 0;
1827  pSrcXYZW.w = 128;
1828  render->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, 0, 2); //рисуется оборотные стороны карт противника
1829  } else {
1830  pArcomageGame->GetCardRect(am_Players[current_player_num].cards_at_hand[card_slot], &pSrcXYZW);
1831  if (!CanCardBePlayed(current_player_num, card_slot)) {
1832  // рисуются неактивные карты - greyed out
1833  render->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, 0, 0);
1834  } else {
1835  render->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, 0, 2); //рисуются активные карты
1836  }
1837  }
1838  }
1839 
1840  // unshift by card pos
1841  if (Player_Cards_Shift) {
1842  pTargetXY.x -= am_Players[current_player_num].card_shift[card_slot].x;
1843  pTargetXY.y -= am_Players[current_player_num].card_shift[card_slot].y;
1844  }
1845 
1846  // shift draw postion along
1847  pTargetXY.x += card_spacing + 96;
1848  }
1849 
1850  // draw shown cards on table
1851  for (int table_cards = 0; table_cards < 10; ++table_cards) {
1852  if (hide_card_anim_runnning == 0) {
1853  // cards stationary
1854  if (shown_cards[table_cards].uCardId != -1) {
1855  // draw card - greyed out
1856  pArcomageGame->GetCardRect(shown_cards[table_cards].uCardId, &pSrcXYZW);
1857  render->am_Blt_Chroma(&pSrcXYZW, &shown_cards[table_cards].hide_anim_pos, 0, 0);
1858  }
1859  if (shown_cards[table_cards].discarded != 0) {
1860  // draw discarded text
1861  pTargetXY.x = shown_cards[table_cards].hide_anim_pos.x + 12;
1862  pTargetXY.y = shown_cards[table_cards].hide_anim_pos.y + 40;
1863  pSrcXYZW.x = 843;
1864  pSrcXYZW.z = 916;
1865  pSrcXYZW.y = 200;
1866  pSrcXYZW.w = 216;
1867  render->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, pArcomageGame->field_54, 2);
1868  }
1869  } else if (hide_card_anim_count <= 0) {
1870  // animation finished
1871  if (table_cards == 9) {
1872  // reset anim at last card
1876  }
1877 
1878  // reset table slot
1879  shown_cards[table_cards].uCardId = -1;
1880  shown_cards[table_cards].hide_anim_pos.x = shown_cards[table_cards].table_pos.x;
1881  shown_cards[table_cards].hide_anim_pos.y = shown_cards[table_cards].table_pos.y;
1882  shown_cards[table_cards].discarded = 0;
1883  } else {
1884  // animation
1885  if (shown_cards[table_cards].uCardId != -1) {
1886  // update position and draw
1887  shown_cards[table_cards].hide_anim_pos.x += shown_cards[table_cards].hide_anim_spd.x;
1888  shown_cards[table_cards].hide_anim_pos.y += shown_cards[table_cards].hide_anim_spd.y;
1889  pArcomageGame->GetCardRect(shown_cards[table_cards].uCardId, &pSrcXYZW);
1890  render->am_Blt_Chroma(&pSrcXYZW, &shown_cards[table_cards].hide_anim_pos, 0, 0);
1891  }
1892  }
1893  }
1894 
1895  // update hide card anim
1897 
1898  // blank deck card
1899  pSrcXYZW.x = 192;
1900  pSrcXYZW.z = 288;
1901  pSrcXYZW.y = 0;
1902  pSrcXYZW.w = 128;
1903  pTargetXY.x = 120;
1904  pTargetXY.y = 18;
1905  render->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, 0, 0);
1906 }
1907 
1908 void DrawCardAnimation(int animation_stage) {
1909  // draws any card currently in animation stage
1910  // draw - discard - play
1911 
1912  Rect pSrcXYZW;
1913  Point pTargetXY;
1914 
1915  // drawing card anim
1916  if (drawn_card_slot_index != -1) {
1917  if (drawn_card_anim_cnt >= 9) {
1918  // animation start so calcualte posiotn and speeds
1920  anim_card_pos_drawncard.x = 120;
1921  int card_count = GetPlayerHandCardCount(current_player_num);
1922  int card_spacing = (window->GetWidth() - (96 * card_count)) / (card_count + 1);
1923 
1924  int targetx = drawn_card_slot_index * (card_spacing + 96) + card_spacing;
1925  int targety = 327;
1926 
1927  if (Player_Cards_Shift) {
1930  }
1931 
1932  anim_card_spd_drawncard.x = (targetx - (signed)anim_card_pos_drawncard.x) / 10;
1933  anim_card_spd_drawncard.y = (targety - (signed)anim_card_pos_drawncard.y) / 10;
1934 
1935  // move the card
1938 
1939  // draw the blank card at animation position
1940  pSrcXYZW.x = 192;
1941  pSrcXYZW.y = 0;
1942  pSrcXYZW.z = 288;
1943  pSrcXYZW.w = 128;
1944  render->am_Blt_Chroma(&pSrcXYZW, &anim_card_pos_drawncard, 0, 2);
1945  } else {
1946  // animation is running - update position and draw
1947  pSrcXYZW.x = 192;
1948  pSrcXYZW.y = 0;
1949  pSrcXYZW.z = 288;
1950  pSrcXYZW.w = 128;
1953  render->am_Blt_Chroma(&pSrcXYZW, &anim_card_pos_drawncard, 0, 2);
1954 
1955  // reset if animation is finished
1957  }
1958  }
1959  // end drawing card from deck anim
1960 
1961  // discard card anim
1962  if (discarded_card_id != -1) {
1963  // anim runs 20 -> 10
1964  if (animation_stage <= 10) {
1965  if (animation_stage == 10) {
1966  // card has reached its destination - find first table slot
1967  int card_slot = 0;
1968  for (card_slot = 0; card_slot < 10; ++card_slot) {
1969  if (shown_cards[card_slot].uCardId == -1) {
1970  // set card to slot
1971  shown_cards[card_slot].uCardId = discarded_card_id;
1972  shown_cards[card_slot].discarded = 1;
1973  break;
1974  }
1975  }
1976 
1977  // update positiona and draw
1979  pTargetXY.x = shown_cards[card_slot].table_pos.x;
1980  pTargetXY.y = shown_cards[card_slot].table_pos.y;
1981  render->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, 0, 0);
1982 
1983  // reset discard anim
1984  discarded_card_id = -1;
1985  }
1986  } else {
1987  // update pos and draw
1991  render->am_Blt_Chroma(&pSrcXYZW, &anim_card_pos_playdiscard, 0, 0);
1992  }
1993  }
1994  // end discard card anim
1995 
1996  // play card anim
1997  if (played_card_id != -1) {
1998  // 20 -> 16 move to play position
1999  if (animation_stage > 15.0) {
2000  // update positiona and draw
2004  render->am_Blt_Chroma(&pSrcXYZW, &anim_card_pos_playdiscard, 0, 2);
2005  return;
2006  }
2007 
2008  // 15 -> 6 hold and play card
2009  if (animation_stage > 5) {
2010  if (animation_stage == 15) {
2011  // card arrived at centre - execute effects
2013  }
2014 
2015  // draw in centre
2017  pTargetXY.x = 272;
2018  pTargetXY.y = 173;
2019  render->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, 0, 2);
2020  return;
2021  }
2022 
2023  // 5 set up move to table positon
2024  if (animation_stage == 5.0) {
2025  // find slots and update speeds
2028  int v17;
2029  for (v17 = 0; v17 < 10; ++v17) {
2030  if (shown_cards[v17].uCardId == -1) break;
2031  }
2032  anim_card_spd_playdiscard.x = ((int)shown_cards[v17].table_pos.x - 272) / 5;
2033  anim_card_spd_playdiscard.y = ((int)shown_cards[v17].table_pos.y - 173) / 5;
2034 
2035  // draw card in position
2037  pTargetXY.x = 272;
2038  pTargetXY.y = 173;
2039  render->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, 0, 2);
2040  return;
2041  }
2042 
2043  // 4-> 1 move to table slot
2044  if (animation_stage > 0) {
2045  // update position and draw
2049  render->am_Blt_Chroma(&pSrcXYZW, &anim_card_pos_playdiscard, 0, 0);
2050  return;
2051  }
2052 
2053  // 0 draw in table pos and reset
2054  if (animation_stage == 0) {
2055  // find free table slot
2056  int v19;
2057  for (v19 = 0; v19 < 10; ++v19) {
2058  if (shown_cards[v19].uCardId == -1) {
2060  break;
2061  }
2062  }
2063 
2064  // update position and draw
2066  pTargetXY.x = shown_cards[v19].table_pos.x;
2067  pTargetXY.y = shown_cards[v19].table_pos.y;
2068  render->am_Blt_Chroma(&pSrcXYZW, &pTargetXY, 0, 0);
2069 
2070  // reset anim
2071  played_card_id = -1;
2072  }
2073  }
2074  // end play card anim
2075 }
2076 
2077 void ArcomageGame::GetCardRect(unsigned int uCardID, Rect *pCardRect) {
2078  // get card image position from layout
2079  // slot encoded as 'YX' eg 76 = yslot 7 and xslot 6
2080  int xslot = pCards[uCardID].slot % 10;
2081  int yslot = pCards[uCardID].slot / 10;
2082  pCardRect->y = 128 * yslot + 220;
2083  pCardRect->x = 96 * xslot;
2084  pCardRect->w = pCardRect->y + 128;
2085  pCardRect->z = pCardRect->x + 96;
2086 }
2087 
2088 int GetPlayerHandCardCount(int player_num) {
2089  int card_count = 0;
2090  for (int i = 0; i < 10; ++i) {
2091  if (am_Players[player_num].cards_at_hand[i] != -1) ++card_count;
2092  }
2093 
2094  return card_count;
2095 }
2096 
2097 signed int DrawCardsRectangles(int player_num) {
2098  // draws the framing rectangle around cards on hover
2099  arcomage_mouse get_mouse;
2100  Rect pXYZW;
2101  int color;
2102 
2103  // only do for the human player
2104  if (am_Players[player_num].IsHisTurn) {
2105  // get the mouse position
2106  if (get_mouse.Update()) {
2107  // calc spacings and first card position
2108  int card_count = GetPlayerHandCardCount(player_num);
2109  int card_spacing = (window->GetWidth() - 96 * card_count) / (card_count + 1);
2110  pXYZW.y = 327;
2111  pXYZW.w = 455;
2112  pXYZW.x = card_spacing;
2113  int card_offset = pXYZW.x + 96;
2114  pXYZW.z = card_offset;
2115 
2116  // loop through hand of cards
2117  for (int hand_index = 0; hand_index < card_count; hand_index++) {
2118  // if there is a card
2119  if (am_Players[player_num].cards_at_hand[hand_index] != -1) {
2120  // shift rectangle co ords
2121  if (Player_Cards_Shift) {
2122  pXYZW.x += am_Players[player_num].card_shift[hand_index].x;
2123  pXYZW.z += am_Players[player_num].card_shift[hand_index].x;
2124  pXYZW.y += am_Players[player_num].card_shift[hand_index].y;
2125  pXYZW.w += am_Players[player_num].card_shift[hand_index].y;
2126  }
2127 
2128  // see if mouse is hovering
2129  if (get_mouse.Inside(&pXYZW)) {
2130  if (CanCardBePlayed(player_num, hand_index))
2131  color = 0x00FFFFFF; //белый цвет - white frame
2132  else
2133  color = 0x000000FF; //красный цвет - red frame
2134 
2135  // draw outline and return
2136  DrawRect(&pXYZW, R8G8B8_to_TargetFormat(color), 0);
2137  return hand_index;
2138  }
2139 
2140  //рамка чёрного цвета - black frame
2141  DrawRect(&pXYZW, R8G8B8_to_TargetFormat(0), 0);
2142 
2143  // unshift rectangle co ords
2144  if (Player_Cards_Shift) {
2145  pXYZW.x -= am_Players[player_num].card_shift[hand_index].x;
2146  pXYZW.z -= am_Players[player_num].card_shift[hand_index].x;
2147  pXYZW.y -= am_Players[player_num].card_shift[hand_index].y;
2148  pXYZW.w -= am_Players[player_num].card_shift[hand_index].y;
2149  }
2150 
2151  // shift offsets along a card width
2152  pXYZW.x += card_offset;
2153  pXYZW.z += card_offset;
2154  }
2155  }
2156  }
2157  }
2158  // no card hovered
2159  return -1;
2160 }
2161 
2162 bool DiscardCard(int player_num, signed int card_slot_index) {
2163  // check for valid card slot
2164  if (card_slot_index <= -1) return false;
2165 
2166  // can the card be discarded
2167  if (pCards[am_Players[player_num].cards_at_hand[card_slot_index]].can_be_discarded) {
2168  // calc animation position and move speed
2169  int card_count = GetPlayerHandCardCount(current_player_num);
2170  int card_spacing = (window->GetWidth() - (96 * card_count)) / (card_count + 1);
2171 
2172  anim_card_pos_playdiscard.x = am_Players[player_num].card_shift[card_slot_index].x + (card_slot_index * (card_spacing + 96) + card_spacing);
2173  anim_card_pos_playdiscard.y = am_Players[player_num].card_shift[card_slot_index].y + 327;
2174 
2175  // find first free table slot
2176  int table_slot = 0;
2177  if (!hide_card_anim_start) {
2178  for (table_slot = 0; table_slot < 10; ++table_slot) {
2179  if (shown_cards[table_slot].uCardId == -1) break;
2180  }
2181  }
2182 
2183  anim_card_spd_playdiscard.x = ((int)shown_cards[table_slot].table_pos.x - (int)anim_card_pos_playdiscard.x) / 10;
2184  anim_card_spd_playdiscard.y = ((int)shown_cards[table_slot].table_pos.y - (int)anim_card_pos_playdiscard.y) / 10;
2185 
2186  // play sound - set anim card and remove from player
2188  discarded_card_id = am_Players[player_num].cards_at_hand[card_slot_index];
2189  am_Players[player_num].cards_at_hand[card_slot_index] = -1;
2192 
2193  return true;
2194  } else {
2195  // cannot make this move
2196  return false;
2197  }
2198 }
2199 
2200 bool PlayCard(int player_num, int card_slot_num) {
2201  // check for valid card slot
2202  if (card_slot_num <= -1) return false;
2203 
2204  // can the card be played
2205  if (CanCardBePlayed(player_num, card_slot_num)) {
2206  // calc animation position and move speed
2207  int cards_at_hand = GetPlayerHandCardCount(current_player_num);
2208  int card_spacing = (window->GetWidth() - (96 * cards_at_hand)) / (cards_at_hand + 1);
2209 
2210  anim_card_pos_playdiscard.x = am_Players[player_num].card_shift[card_slot_num].x + (card_slot_num * (card_spacing + 96) + card_spacing);
2211  anim_card_pos_playdiscard.y = am_Players[player_num].card_shift[card_slot_num].y + 327;
2212 
2214  anim_card_spd_playdiscard.y = -30; // (-150 / 5)
2215 
2216  // play sound and take resource cost
2217  ArcomageCard* pCard = &pCards[am_Players[player_num].cards_at_hand[card_slot_num]];
2219  am_Players[player_num].resource_bricks -= pCard->needed_bricks;
2220  am_Players[player_num].resource_beasts -= pCard->needed_beasts;
2221  am_Players[player_num].resource_gems -= pCard->needed_gems;
2222 
2223  // set anim card and remove from player
2224  played_card_id = am_Players[player_num].cards_at_hand[card_slot_num];
2225  am_Players[player_num].cards_at_hand[card_slot_num] = -1;
2227 
2228  return true;
2229  } else {
2230  // cannot make this move
2231  return false;
2232  }
2233 }
2234 
2235 bool CanCardBePlayed(int player_num, int hand_card_indx) {
2236  bool result = true;
2237  ArcomagePlayer* pPlayer = &am_Players[player_num];
2238  ArcomageCard *test_card = &pCards[pPlayer->cards_at_hand[hand_card_indx]];
2239 
2240  // test card conditions
2241  if (test_card->needed_quarry_level > pPlayer->quarry_level) result = false;
2242  if (test_card->needed_magic_level > pPlayer->magic_level) result = false;
2243  if (test_card->needed_zoo_level > pPlayer->zoo_level) result = false;
2244  if (test_card->needed_bricks > pPlayer->resource_bricks) result = false;
2245  if (test_card->needed_gems > pPlayer->resource_gems) result = false;
2246  if (test_card->needed_beasts > pPlayer->resource_beasts) result = false;
2247 
2248  return result;
2249 }
2250 
2251 void ApplyCardToPlayer(int player_num, unsigned int uCardID) {
2252 #define APPLY_TO_PLAYER(PLAYER, ENEMY, FIELD, VAL, RES) \
2253  if (VAL != 0) { \
2254  if (VAL == 99) { \
2255  if (PLAYER->FIELD < ENEMY->FIELD) { \
2256  PLAYER->FIELD = ENEMY->FIELD; \
2257  RES = ENEMY->FIELD - PLAYER->FIELD; \
2258  } \
2259  } else { \
2260  PLAYER->FIELD += (signed int)(VAL); \
2261  if (PLAYER->FIELD < 0) PLAYER->FIELD = 0; \
2262  RES = (signed int)(VAL); \
2263  } \
2264  }
2265 
2266 #define APPLY_TO_ENEMY(PLAYER, ENEMY, FIELD, VAL, RES) \
2267  APPLY_TO_PLAYER(ENEMY, PLAYER, FIELD, VAL, RES)
2268 
2269 #define APPLY_TO_BOTH(PLAYER, ENEMY, FIELD, VAL, RES_P, RES_E) \
2270  if (VAL != 0) { \
2271  if (VAL == 99) { \
2272  if (PLAYER->FIELD != ENEMY->FIELD) { \
2273  if (PLAYER->FIELD <= ENEMY->FIELD) { \
2274  PLAYER->FIELD = ENEMY->FIELD; \
2275  RES_P = ENEMY->FIELD - PLAYER->FIELD; \
2276  } else { \
2277  ENEMY->FIELD = PLAYER->FIELD; \
2278  RES_E = PLAYER->FIELD - ENEMY->FIELD; \
2279  } \
2280  } \
2281  } else { \
2282  PLAYER->FIELD += (signed int)(VAL); \
2283  ENEMY->FIELD += (signed int)(VAL); \
2284  if (PLAYER->FIELD < 0) { \
2285  PLAYER->FIELD = 0; \
2286  } \
2287  if (ENEMY->FIELD < 0) { \
2288  ENEMY->FIELD = 0; \
2289  } \
2290  RES_P = (signed int)(VAL); \
2291  RES_E = (signed int)(VAL); \
2292  } \
2293  }
2294 
2295  ArcomagePlayer *player = &am_Players[player_num];
2296  int enemy_num = ((player_num + 1) % 2);
2297  ArcomagePlayer *enemy = &am_Players[enemy_num];
2298  ArcomageCard* pCard = &pCards[uCardID];
2299 
2300  int buildings_e = 0;
2301  int buildings_p = 0;
2302  int dmg_e = 0;
2303  int dmg_p = 0;
2304  int tower_e = 0;
2305  int tower_p = 0;
2306  int wall_e = 0;
2307  int wall_p = 0;
2308 
2309  int beasts_e = 0;
2310  int beasts_p = 0;
2311  int gems_e = 0;
2312  int gems_p = 0;
2313  int bricks_e = 0;
2314  int bricks_p = 0;
2315  int zoo_e = 0;
2316  int zoo_p = 0;
2317  int magic_e = 0;
2318  int magic_p = 0;
2319  int quarry_e = 0;
2320  int quarry_p = 0;
2321 
2322  switch (pCard->compare_param) {
2323  case 2:
2324  if (player->quarry_level <
2325  enemy->quarry_level) //если рудники < рудника врага
2326  goto LABEL_26;
2327  goto LABEL_231;
2328  case 3:
2329  if (player->magic_level < enemy->magic_level) goto LABEL_26;
2330  goto LABEL_231;
2331  case 4:
2332  if (player->zoo_level <
2333  enemy->zoo_level) //если зверинец < зверинца врага
2334  goto LABEL_26;
2335  goto LABEL_231;
2336  case 5:
2337  if (player->quarry_level == enemy->quarry_level) goto LABEL_26;
2338  goto LABEL_231;
2339  case 6:
2340  if (player->magic_level == enemy->magic_level) goto LABEL_26;
2341  goto LABEL_231;
2342  case 7:
2343  if (player->zoo_level == enemy->zoo_level) goto LABEL_26;
2344  goto LABEL_231;
2345  case 8:
2346  if (player->quarry_level < enemy->quarry_level) goto LABEL_26;
2347  goto LABEL_231;
2348  case 9:
2349  if (player->magic_level < enemy->magic_level) goto LABEL_26;
2350  goto LABEL_231;
2351  case 10:
2352  if (player->zoo_level < enemy->zoo_level) goto LABEL_26;
2353  goto LABEL_231;
2354  case 11:
2355  if (!player->wall_height) goto LABEL_26;
2356  goto LABEL_231;
2357  case 12:
2358  if (player->wall_height) goto LABEL_26;
2359  goto LABEL_231;
2360  case 13:
2361  if (!enemy->wall_height) goto LABEL_26;
2362  goto LABEL_231;
2363  case 14:
2364  if (enemy->wall_height) goto LABEL_26;
2365  goto LABEL_231;
2366  case 15:
2367  if (player->wall_height < enemy->wall_height) goto LABEL_26;
2368  goto LABEL_231;
2369  case 16:
2370  if (player->tower_height < enemy->tower_height) goto LABEL_26;
2371  goto LABEL_231;
2372  case 17:
2373  if (player->wall_height == enemy->wall_height) goto LABEL_26;
2374  goto LABEL_231;
2375  case 18:
2376  if (player->tower_height == enemy->tower_height) goto LABEL_26;
2377  goto LABEL_231;
2378  case 19:
2379  if (player->wall_height < enemy->wall_height) goto LABEL_26;
2380  goto LABEL_231;
2381  case 20:
2382  if (player->tower_height < enemy->tower_height) goto LABEL_26;
2383  goto LABEL_231;
2384  default:
2385  LABEL_26:
2387  pCard->draw_extra_card_count + (pCard->field_30 == 1);
2389  for (char i = 0; i < pCard->draw_extra_card_count; i++)
2390  GetNextCardFromDeck(player_num);
2391 
2394 
2395  APPLY_TO_PLAYER(player, enemy, quarry_level,
2396  pCard->to_player_quarry_lvl, quarry_p);
2397  APPLY_TO_PLAYER(player, enemy, magic_level,
2398  pCard->to_player_magic_lvl, magic_p);
2399  APPLY_TO_PLAYER(player, enemy, zoo_level, pCard->to_player_zoo_lvl,
2400  zoo_p);
2401  APPLY_TO_PLAYER(player, enemy, resource_bricks,
2402  pCard->to_player_bricks, bricks_p);
2403  APPLY_TO_PLAYER(player, enemy, resource_gems, pCard->to_player_gems,
2404  gems_p);
2405  APPLY_TO_PLAYER(player, enemy, resource_beasts,
2406  pCard->to_player_beasts, beasts_p);
2407  if (pCard->to_player_buildings) {
2408  dmg_p = ApplyDamageToBuildings(
2409  player_num, (signed int)pCard->to_player_buildings);
2410  buildings_p = (signed int)pCard->to_player_buildings - dmg_p;
2411  }
2412  APPLY_TO_PLAYER(player, enemy, wall_height, pCard->to_player_wall,
2413  wall_p);
2414  APPLY_TO_PLAYER(player, enemy, tower_height, pCard->to_player_tower,
2415  tower_p);
2416 
2417  APPLY_TO_ENEMY(player, enemy, quarry_level,
2418  pCard->to_enemy_quarry_lvl, quarry_e);
2419  APPLY_TO_ENEMY(player, enemy, magic_level,
2420  pCard->to_enemy_magic_lvl, magic_e);
2421  APPLY_TO_ENEMY(player, enemy, zoo_level, pCard->to_enemy_zoo_lvl,
2422  zoo_e);
2423  APPLY_TO_ENEMY(player, enemy, resource_bricks,
2424  pCard->to_enemy_bricks, bricks_e);
2425  APPLY_TO_ENEMY(player, enemy, resource_gems, pCard->to_enemy_gems,
2426  gems_e);
2427  APPLY_TO_ENEMY(player, enemy, resource_beasts,
2428  pCard->to_enemy_beasts, beasts_e);
2429  if (pCard->to_enemy_buildings) {
2430  dmg_e = ApplyDamageToBuildings(
2431  enemy_num, (signed int)pCard->to_enemy_buildings);
2432  buildings_e = (signed int)pCard->to_enemy_buildings - dmg_e;
2433  }
2434  APPLY_TO_ENEMY(player, enemy, wall_height, pCard->to_enemy_wall,
2435  wall_e);
2436  APPLY_TO_ENEMY(player, enemy, tower_height, pCard->to_enemy_tower,
2437  tower_e);
2438 
2439  APPLY_TO_BOTH(player, enemy, quarry_level,
2440  pCard->to_pl_enm_quarry_lvl, quarry_p, quarry_e);
2441  APPLY_TO_BOTH(player, enemy, magic_level,
2442  pCard->to_pl_enm_magic_lvl, magic_p, magic_e);
2443  APPLY_TO_BOTH(player, enemy, zoo_level, pCard->to_pl_enm_zoo_lvl,
2444  zoo_p, zoo_e);
2445  APPLY_TO_BOTH(player, enemy, resource_bricks,
2446  pCard->to_pl_enm_bricks, bricks_p, bricks_e);
2447  APPLY_TO_BOTH(player, enemy, resource_gems, pCard->to_pl_enm_gems,
2448  gems_p, gems_e);
2449  APPLY_TO_BOTH(player, enemy, resource_beasts,
2450  pCard->to_pl_enm_beasts, beasts_p, beasts_e);
2451  if (pCard->to_pl_enm_buildings) {
2452  dmg_p = ApplyDamageToBuildings(
2453  player_num, (signed int)pCard->to_pl_enm_buildings);
2454  dmg_e = ApplyDamageToBuildings(
2455  enemy_num, (signed int)pCard->to_pl_enm_buildings);
2456  buildings_p = (signed int)pCard->to_pl_enm_buildings - dmg_p;
2457  buildings_e = (signed int)pCard->to_pl_enm_buildings - dmg_e;
2458  }
2459  APPLY_TO_BOTH(player, enemy, wall_height, pCard->to_pl_enm_wall,
2460  wall_p, wall_e);
2461  APPLY_TO_BOTH(player, enemy, tower_height, pCard->to_pl_enm_tower,
2462  tower_p, tower_e);
2463  break;
2464  case 0:
2465  LABEL_231:
2466  num_actions_left = pCard->can_draw_extra_card2 + (pCard->field_4D == 1);
2468  for (char i = 0; i < pCard->can_draw_extra_card2; i++)
2469  GetNextCardFromDeck(player_num);
2470 
2473 
2474  APPLY_TO_PLAYER(player, enemy, quarry_level,
2475  pCard->to_player_quarry_lvl2, quarry_p);
2476  APPLY_TO_PLAYER(player, enemy, magic_level,
2477  pCard->to_player_magic_lvl2, magic_p);
2478  APPLY_TO_PLAYER(player, enemy, zoo_level, pCard->to_player_zoo_lvl2,
2479  zoo_p);
2480  APPLY_TO_PLAYER(player, enemy, resource_bricks,
2481  pCard->to_player_bricks2, bricks_p);
2482  APPLY_TO_PLAYER(player, enemy, resource_gems,
2483  pCard->to_player_gems2, gems_p);
2484  APPLY_TO_PLAYER(player, enemy, resource_beasts,
2485  pCard->to_player_beasts2, beasts_p);
2486  if (pCard->to_player_buildings2) {
2487  dmg_p = ApplyDamageToBuildings(
2488  player_num, (signed int)pCard->to_player_buildings2);
2489  buildings_p = (signed int)pCard->to_player_buildings2 - dmg_p;
2490  }
2491  APPLY_TO_PLAYER(player, enemy, wall_height, pCard->to_player_wall2,
2492  wall_p);
2493  APPLY_TO_PLAYER(player, enemy, tower_height,
2494  pCard->to_player_tower2, tower_p);
2495 
2496  APPLY_TO_ENEMY(player, enemy, quarry_level,
2497  pCard->to_enemy_quarry_lvl2, quarry_e);
2498  APPLY_TO_ENEMY(player, enemy, magic_level,
2499  pCard->to_enemy_magic_lvl2, magic_e);
2500  APPLY_TO_ENEMY(player, enemy, zoo_level, pCard->to_enemy_zoo_lvl2,
2501  zoo_e);
2502  APPLY_TO_ENEMY(player, enemy, resource_bricks,
2503  pCard->to_enemy_bricks2, bricks_e);
2504  APPLY_TO_ENEMY(player, enemy, resource_gems, pCard->to_enemy_gems2,
2505  gems_e);
2506  APPLY_TO_ENEMY(player, enemy, resource_beasts,
2507  pCard->to_enemy_beasts2, beasts_e);
2508  if (pCard->to_enemy_buildings2) {
2509  dmg_e = ApplyDamageToBuildings(
2510  enemy_num, (signed int)pCard->to_enemy_buildings2);
2511  buildings_e = (signed int)pCard->to_enemy_buildings2 - dmg_e;
2512  }
2513  APPLY_TO_ENEMY(player, enemy, wall_height, pCard->to_enemy_wall2,
2514  wall_e);
2515  APPLY_TO_ENEMY(player, enemy, tower_height, pCard->to_enemy_tower2,
2516  tower_e);
2517 
2518  APPLY_TO_BOTH(player, enemy, quarry_level,
2519  pCard->to_pl_enm_quarry_lvl2, quarry_p, quarry_e);
2520  APPLY_TO_BOTH(player, enemy, magic_level,
2521  pCard->to_pl_enm_magic_lvl2, magic_p, magic_e);
2522  APPLY_TO_BOTH(player, enemy, zoo_level, pCard->to_pl_enm_zoo_lvl2,
2523  zoo_p, zoo_e);
2524  APPLY_TO_BOTH(player, enemy, resource_bricks,
2525  pCard->to_pl_enm_bricks2, bricks_p, bricks_e);
2526  APPLY_TO_BOTH(player, enemy, resource_gems, pCard->to_pl_enm_gems2,
2527  gems_p, gems_e);
2528  APPLY_TO_BOTH(player, enemy, resource_beasts,
2529  pCard->to_pl_enm_beasts2, beasts_p, beasts_e);
2530 
2531  if (pCard->to_pl_enm_buildings2) {
2532  dmg_p = ApplyDamageToBuildings(
2533  player_num, (signed int)pCard->to_pl_enm_buildings2);
2534  dmg_e = ApplyDamageToBuildings(
2535  enemy_num, (signed int)pCard->to_pl_enm_buildings2);
2536  buildings_p = (signed int)pCard->to_pl_enm_buildings2 - dmg_p;
2537  buildings_e = (signed int)pCard->to_pl_enm_buildings2 - dmg_e;
2538  }
2539  APPLY_TO_BOTH(player, enemy, wall_height, pCard->to_pl_enm_wall2,
2540  wall_p, wall_e);
2541  APPLY_TO_BOTH(player, enemy, tower_height, pCard->to_pl_enm_tower2,
2542  tower_p, tower_e);
2543  break;
2544  }
2545  // }
2546 
2547 
2548  // call sound if required
2549  if (quarry_p > 0 || quarry_e > 0) pArcomageGame->PlaySound(30);
2550  if (quarry_p < 0 || quarry_e < 0) pArcomageGame->PlaySound(31);
2551  if (magic_p > 0 || magic_e > 0) pArcomageGame->PlaySound(33);
2552  if (magic_p < 0 || magic_e < 0) pArcomageGame->PlaySound(34);
2553  if (zoo_p > 0 || zoo_e > 0) pArcomageGame->PlaySound(36);
2554  if (zoo_p < 0 || zoo_e < 0) pArcomageGame->PlaySound(37);
2555  if (bricks_p > 0 || bricks_e > 0) pArcomageGame->PlaySound(39);
2556  if (bricks_p < 0 || bricks_e < 0) pArcomageGame->PlaySound(40);
2557  if (gems_p > 0 || gems_e > 0) pArcomageGame->PlaySound(42);
2558  if (gems_p < 0 || gems_e < 0) pArcomageGame->PlaySound(43);
2559  if (beasts_p > 0 || beasts_e > 0) pArcomageGame->PlaySound(45u);
2560  if (beasts_p < 0 || beasts_e < 0) pArcomageGame->PlaySound(46);
2561  if (buildings_p || buildings_e || dmg_p || dmg_e) pArcomageGame->PlaySound(48);
2562  if (wall_p > 0 || wall_e > 0) pArcomageGame->PlaySound(49);
2563  if (wall_p < 0 || wall_e < 0) pArcomageGame->PlaySound(50);
2564  if (tower_p > 0 || tower_e > 0) pArcomageGame->PlaySound(52);
2565  if (tower_p < 0 || tower_e < 0) pArcomageGame->PlaySound(53);
2566 
2567 
2568  // call spark effect if required
2569  Point explos_coords;
2570  if (player_num) {
2571  if (quarry_p) {
2572  explos_coords.x = 573;
2573  explos_coords.y = 92;
2574  new_explosion_effect(&explos_coords, quarry_p);
2575  }
2576  if (quarry_e) {
2577  explos_coords.x = 26;
2578  explos_coords.y = 92;
2579  new_explosion_effect(&explos_coords, quarry_e);
2580  }
2581  if (magic_p) {
2582  explos_coords.x = 573;
2583  explos_coords.y = 164;
2584  new_explosion_effect(&explos_coords, magic_p);
2585  }
2586  if (magic_e) {
2587  explos_coords.x = 26;
2588  explos_coords.y = 164;
2589  new_explosion_effect(&explos_coords, magic_e);
2590  }
2591  if (zoo_p) {
2592  explos_coords.x = 573;
2593  explos_coords.y = 236;
2594  new_explosion_effect(&explos_coords, zoo_p);
2595  }
2596  if (zoo_e) {
2597  explos_coords.x = 26;
2598  explos_coords.y = 236;
2599  new_explosion_effect(&explos_coords, zoo_e);
2600  }
2601  if (bricks_p) {
2602  explos_coords.x = 563;
2603  explos_coords.y = 114;
2604  new_explosion_effect(&explos_coords, bricks_p);
2605  }
2606  if (bricks_e) {
2607  explos_coords.x = 16;
2608  explos_coords.y = 114;
2609  new_explosion_effect(&explos_coords, bricks_e);
2610  }
2611  if (gems_p) {
2612  explos_coords.x = 563;
2613  explos_coords.y = 186;
2614  new_explosion_effect(&explos_coords, gems_p);
2615  }
2616  if (gems_e) {
2617  explos_coords.x = 16;
2618  explos_coords.y = 186;
2619  new_explosion_effect(&explos_coords, gems_e);
2620  }
2621  if (beasts_p) {
2622  explos_coords.x = 563;
2623  explos_coords.y = 258;
2624  new_explosion_effect(&explos_coords, beasts_p);
2625  }
2626  if (beasts_e) {
2627  explos_coords.x = 16;
2628  explos_coords.y = 258;
2629  new_explosion_effect(&explos_coords, beasts_e);
2630  }
2631  if (wall_p) {
2632  explos_coords.x = 442;
2633  explos_coords.y = 296;
2634  new_explosion_effect(&explos_coords, wall_p);
2635  }
2636  if (wall_e) {
2637  explos_coords.x = 180;
2638  explos_coords.y = 296;
2639  new_explosion_effect(&explos_coords, wall_e);
2640  }
2641  if (tower_p) {
2642  explos_coords.x = 514;
2643  explos_coords.y = 296;
2644  new_explosion_effect(&explos_coords, tower_p);
2645  }
2646  if (tower_e) {
2647  explos_coords.x = 122;
2648  explos_coords.y = 296;
2649  new_explosion_effect(&explos_coords, tower_e);
2650  }
2651  if (dmg_p) {
2652  explos_coords.x = 442;
2653  explos_coords.y = 296;
2654  new_explosion_effect(&explos_coords, dmg_p);
2655  }
2656  if (buildings_p) {
2657  explos_coords.x = 514;
2658  explos_coords.y = 296;
2659  new_explosion_effect(&explos_coords, buildings_p);
2660  }
2661  if (dmg_e) {
2662  explos_coords.x = 180;
2663  explos_coords.y = 296;
2664  new_explosion_effect(&explos_coords, dmg_e);
2665  }
2666  if (buildings_e) {
2667  explos_coords.x = 122;
2668  explos_coords.y = 296;
2669  new_explosion_effect(&explos_coords, buildings_e);
2670  }
2671  } else {
2672  if (quarry_p) {
2673  explos_coords.x = 26;
2674  explos_coords.y = 92;
2675  new_explosion_effect(&explos_coords, quarry_p);
2676  }
2677  if (quarry_e) {
2678  explos_coords.x = 573;
2679  explos_coords.y = 92;
2680  new_explosion_effect(&explos_coords, quarry_e);
2681  }
2682  if (magic_p) {
2683  explos_coords.x = 26;
2684  explos_coords.y = 164;
2685  new_explosion_effect(&explos_coords, magic_p);
2686  }
2687  if (magic_e) {
2688  explos_coords.x = 573;
2689  explos_coords.y = 164;
2690  new_explosion_effect(&explos_coords, magic_e);
2691  }
2692  if (zoo_p) {
2693  explos_coords.x = 26;
2694  explos_coords.y = 236;
2695  new_explosion_effect(&explos_coords, zoo_p);
2696  }
2697  if (zoo_e) {
2698  explos_coords.x = 573;
2699  explos_coords.y = 236;
2700  new_explosion_effect(&explos_coords, zoo_e);
2701  }
2702  if (bricks_p) {
2703  explos_coords.x = 16;
2704  explos_coords.y = 114;
2705  new_explosion_effect(&explos_coords, bricks_p);
2706  }
2707  if (bricks_e) {
2708  explos_coords.x = 563;
2709  explos_coords.y = 114;
2710  new_explosion_effect(&explos_coords, bricks_e);
2711  }
2712  if (gems_p) {
2713  explos_coords.x = 16;
2714  explos_coords.y = 186;
2715  new_explosion_effect(&explos_coords, gems_p);
2716  }
2717  if (gems_e) {
2718  explos_coords.x = 563;
2719  explos_coords.y = 186;
2720  new_explosion_effect(&explos_coords, gems_e);
2721  }
2722  if (beasts_p) {
2723  explos_coords.x = 16;
2724  explos_coords.y = 258;
2725  new_explosion_effect(&explos_coords, beasts_p);
2726  }
2727  if (beasts_e) {
2728  explos_coords.x = 563;
2729  explos_coords.y = 258;
2730  new_explosion_effect(&explos_coords, beasts_e);
2731  }
2732  if (wall_p) {
2733  explos_coords.x = 180;
2734  explos_coords.y = 296;
2735  new_explosion_effect(&explos_coords, wall_p);
2736  }
2737  if (wall_e) {
2738  explos_coords.x = 442;
2739  explos_coords.y = 296;
2740  new_explosion_effect(&explos_coords, wall_e);
2741  }
2742  if (tower_p) {
2743  explos_coords.x = 122;
2744  explos_coords.y = 296;
2745  new_explosion_effect(&explos_coords, tower_p);
2746  }
2747  if (tower_e) {
2748  explos_coords.x = 514;
2749  explos_coords.y = 296;
2750  new_explosion_effect(&explos_coords, tower_e);
2751  }
2752  if (dmg_p) {
2753  explos_coords.x = 180;
2754  explos_coords.y = 296;
2755  new_explosion_effect(&explos_coords, dmg_p);
2756  }
2757  if (buildings_p) {
2758  explos_coords.x = 122;
2759  explos_coords.y = 296;
2760  new_explosion_effect(&explos_coords, buildings_p);
2761  }
2762  if (dmg_e) {
2763  explos_coords.x = 442;
2764  explos_coords.y = 296;
2765  new_explosion_effect(&explos_coords, dmg_e);
2766  }
2767  if (buildings_e) {
2768  explos_coords.x = 514;
2769  explos_coords.y = 296;
2770  new_explosion_effect(&explos_coords, buildings_e);
2771  }
2772  }
2773 
2774 #undef APPLY_TO_BOTH
2775 #undef APPLY_TO_ENEMY
2776 #undef APPLY_TO_PLAYER
2777 }
2778 
2779 
2780 
2781 int ApplyDamageToBuildings(int player_num, int damage) {
2782  int wall = am_Players[player_num].wall_height;
2783  int result = 0;
2784 
2785  if (wall >= -damage) { // wall absorbs all damage
2786  result = damage;
2787  am_Players[player_num].wall_height += damage;
2788  } else {
2789  damage += wall; // reduce damage by size of wall
2790  am_Players[player_num].wall_height = 0;
2791  result = -wall;
2792  am_Players[player_num].tower_height += damage; // apply remaining to tower
2793  }
2794 
2795  if (am_Players[player_num].tower_height < 0)
2796  am_Players[player_num].tower_height = 0;
2797 
2798  return result;
2799 }
2800 
2802  int winner; // esi@1
2803  int victory_type; // edi@1
2804  int pl_resource; // edx@25
2805  int en_resource; // eax@28
2806  unsigned int tavern_num; // eax@54
2807 
2808  winner = -1;
2809  victory_type = -1;
2810  // nullsub_1();
2811  /*strcpy(pText, "The Winner is: ");//"Победил: " Ritor1: архаизм
2812  xy.y = 160;
2813  xy.x = 320; //- 12 * v2 / 2;
2814  am_DrawText(-1, pText, &xy);*/
2815 
2816  //проверка построена ли башня
2817  if (am_Players[0].tower_height < max_tower_height &&
2818  am_Players[1].tower_height >=
2819  max_tower_height) { //наша башня не построена, а у врага построена
2820  winner = 2; //победил игрок 2(враг)
2821  victory_type = 0;
2822  } else if (am_Players[0].tower_height >= max_tower_height &&
2823  am_Players[1].tower_height <
2824  max_tower_height) { //наша башня построена, а у врага нет
2825  winner = 1; //победил игрок 1(мы)
2826  victory_type = 0;
2827  } else if (am_Players[0].tower_height >= max_tower_height &&
2828  am_Players[1].tower_height >=
2829  max_tower_height) { //и у нас, и у врага построена
2830  if (am_Players[0].tower_height ==
2831  am_Players[1].tower_height) { //наши башни равны
2832  winner = 0; //никто не победил
2833  victory_type = 4; //ничья
2834  } else { //наши башни не равны
2835  winner =
2837  1; //победил тот, у кого выше
2838  victory_type = 0;
2839  }
2840  }
2841 
2842  //проверка разрушена ли башня
2843  if (am_Players[0].tower_height <= 0 &&
2844  am_Players[1].tower_height > 0) { //наша башня разрушена, а у врага нет
2845  winner = 2; // победил игрок 2(враг)
2846  victory_type = 2; //победил разрушив башню врага
2847  } else if (am_Players[0].tower_height > 0 &&
2848  am_Players[1].tower_height <=
2849  0) { //у врага башня разрушена, а у нас нет
2850  winner = 1; //победил игрок 1(мы)
2851  victory_type = 2; //победил разрушив башню врага
2852  } else if (am_Players[0].tower_height <= 0 &&
2853  am_Players[1].tower_height <=
2854  0) { //наша башня разрушена, и у врага разрушена
2855  if (am_Players[0].tower_height ==
2856  am_Players[1].tower_height) { //если башни равны
2857  if (am_Players[0].wall_height ==
2858  am_Players[1].wall_height) { //если стены равны
2859  winner = 0;
2860  victory_type = 4;
2861  } else { //если стены не равны
2862  winner =
2864  1; //победил тот, у кого стена выше
2865  victory_type = 1; //победа когда больше стена при ничье
2866  }
2867  } else { //башни не равны
2868  winner =
2870  1; // побеждает тот у кого башня больше
2871  victory_type = 2; //победил разрушив башню врага
2872  }
2873  }
2874 
2875  //проверка набраны ли ресурсы
2876  //проверка какого ресурса больше всего у игрока 1(нас)
2877  pl_resource =
2878  am_Players[0].resource_bricks; //кирпичей больше чем др. ресурсов
2879  if (am_Players[0].resource_gems > am_Players[0].resource_bricks &&
2880  am_Players[0].resource_gems >
2881  am_Players[0].resource_beasts) //драг.камней больше всего
2882  pl_resource = am_Players[0].resource_gems;
2883  else if (am_Players[0].resource_beasts > am_Players[0].resource_gems &&
2884  am_Players[0].resource_beasts >
2885  am_Players[0].resource_bricks) //зверей больше всего
2886  pl_resource = am_Players[0].resource_beasts;
2887 
2888  //проверка какого ресурса больше у игрока 2(врага)
2889  en_resource =
2890  am_Players[1].resource_bricks; //кирпичей больше чем др. ресурсов
2891  if (am_Players[1].resource_gems > am_Players[1].resource_bricks &&
2892  am_Players[1].resource_gems >
2893  am_Players[1].resource_beasts) //драг.камней больше всего
2894  en_resource = am_Players[1].resource_gems;
2895  else if (am_Players[1].resource_beasts > am_Players[1].resource_gems &&
2896  am_Players[1].resource_beasts >
2897  am_Players[1].resource_bricks) //зверей больше всего
2898  en_resource = am_Players[1].resource_beasts;
2899 
2900  //сравнение ресурсов игроков
2901  if (winner == -1 && victory_type == -1) { //нет победителя по башням
2902  if (pl_resource < max_resources_amount &&
2903  en_resource >=
2904  max_resources_amount) { //враг набрал нужное количество
2905  winner = 2; // враг победил
2906  victory_type = 3; //победа собрав нужное количество ресурсов
2907  } else if (pl_resource >= max_resources_amount &&
2908  en_resource <
2909  max_resources_amount) { //мы набрали нужное количество
2910  winner = 1; // мы победили
2911  victory_type = 3; //победа собрав нужное количество ресурсов
2912  } else if (pl_resource >= max_resources_amount &&
2913  en_resource >=
2914  max_resources_amount) { //и у нас и у врага нужное
2915  //количество ресурсов
2916  if (pl_resource == en_resource) { // ресурсы равны
2917  winner = 0; //ресурсы равны
2918  victory_type = 4; //ничья
2919  } else {
2920  winner = (pl_resource <= en_resource) +
2921  1; //ресурсы не равны, побеждает тот у кого больше
2922  victory_type = 3; //победа собрав нужное количество ресурсов
2923  }
2924  }
2925  } else if (winner == 0 && victory_type == 4) { // при ничье по башням и стене
2926  if (pl_resource != en_resource) { //ресурсы не равны
2927  winner =
2928  (pl_resource <= en_resource) + 1; //победил тот у кого больше
2929  victory_type =
2930  5; //победа когда при ничье большее количество ресурсов
2931  } else { //ресурсы равны
2932  winner = 0; //нет победителя
2933  victory_type = 4; //ничья
2934  }
2935  }
2936 
2937  //подведение итогов
2938  pArcomageGame->Victory_type = victory_type;
2939  pArcomageGame->uGameWinner = winner;
2940  if (winner == 1) { //победитель игрок 1(мы)
2941  if ((window_SpeakInHouse->par1C >= 108) &&
2942  (window_SpeakInHouse->par1C <= 120)) { //таверны
2947  100.0,
2948  0); //вознаграждение
2949  }
2950  }
2951  //проверка выполнен ли квест по аркомагу
2952  tavern_num = 0;
2953  for (uint i = 108; i <= 120; ++i) {
2954  if (!pParty->pArcomageWins[i - 108]) break;
2955  tavern_num++;
2956  }
2957  if (tavern_num == 13)
2959  1); // 238 - Won all Arcomage games
2960 
2961  for (int i = 0; i < 4; ++i) { //внесение записи в Заслуги
2962  if (!_449B57_test_bit(pParty->pPlayers[i]._achieved_awards_bits, PLAYER_GUILD_BITS__FINED))
2963  _449B7E_toggle_bit(pParty->pPlayers[i]._achieved_awards_bits,
2964  PLAYER_GUILD_BITS__ARCOMAGE_WIN, 1);
2965  }
2967  if (pParty->uNumArcomageWins > 1000000) //ограничение количества побед
2968  pParty->uNumArcomageWins = 1000000;
2969  } else { //проигрыш
2970  for (int i = 0; i < 4; ++i) { //внесение записи в Заслуги
2971  if (!_449B57_test_bit(pParty->pPlayers[i]._achieved_awards_bits, PLAYER_GUILD_BITS__FINED))
2972  _449B7E_toggle_bit(pParty->pPlayers[i]._achieved_awards_bits,
2973  PLAYER_GUILD_BITS__ARCOMAGE_LOSE, 1);
2974  }
2976  if (pParty->uNumArcomageLoses >
2977  1000000) //ограничение количества проигрышей
2978  pParty->uNumArcomageLoses = 1000000;
2979  }
2980 }
2981 
2983  // stop all audio and set player names
2984  pAudioPlayer->StopChannels(-1, -1);
2987 
2988  // load in background pic and render
2990  render->DrawTextureNew(0, 0, pArcomageGame->pGameBackground);
2991  render->Present();
2992 
2993  // load in layout pic containing all AM sprites and set fonts
2997 
2998  // calc and clear shown table card slots
3001  for (int i = 0; i < 10; ++i) {
3002  int xslot = (i + 1) % 4;
3003  int yslot = (i + 1) / 4;
3004  shown_cards[i].uCardId = -1;
3005  shown_cards[i].discarded = 0;
3006  shown_cards[i].table_pos.x = 100 * xslot + 120;
3007  shown_cards[i].table_pos.y = 138 * yslot + 18;
3008  shown_cards[i].hide_anim_spd.x = -100 * xslot / 5;
3009  shown_cards[i].hide_anim_spd.y = -138 * yslot / 5;
3012  }
3013 
3014  // create new explosion effect struct array
3015  for (int i = 0; i < 10; ++i)
3016  am_effects_array[i].explosion_eff = explosion_effect_struct::New();
3017 
3018  // load in start condtions and create initial deck and deal
3019  SetStartGameData();
3020  InitalHandsFill();
3021 
3022  // set card params
3024  drawn_card_slot_index = -1;
3026 
3027  // set exiting params
3030  pArcomageGame->GameOver = 0;
3031 }
3032 
3034  const ArcomageStartConditions *st_cond;
3035  st_cond = &start_conditions[window_SpeakInHouse->par1C - 108];
3036 
3037  // set start conditions
3038  start_tower_height = st_cond->tower_height;
3039  start_wall_height = st_cond->wall_height;
3040  start_quarry_level = st_cond->quarry_level - 1;
3041  start_magic_level = st_cond->magic_level - 1;
3042  start_zoo_level = st_cond->zoo_level - 1;
3044  start_gems_amount = st_cond->gems_amount;
3046  // win conditions
3047  max_tower_height = st_cond->max_tower;
3049  // opponent skill level
3050  opponent_mastery = st_cond->mastery_lvl;
3051 
3052  // bonus acts as min level
3054  quarry_bonus = 1;
3055  magic_bonus = 1;
3056  zoo_bonus = 1;
3057 }
3058 
3059 void am_DrawText(const String &str, Point *pXY) {
3061  pXY->y - ((pFontComic->GetHeight() - 3) / 2) + 3,
3062  0, str, 0, 0, 0);
3063 }
3064 
3065 void DrawRect(Rect *pXYZW, unsigned __int16 uColor, char bSolidFill) {
3066  if (bSolidFill) {
3067  for (int i = pXYZW->y; i <= pXYZW->w; ++i)
3068  render->RasterLine2D(pXYZW->x, i, pXYZW->z, i, uColor);
3069  } else {
3070  render->RasterLine2D(pXYZW->x, pXYZW->y, pXYZW->z, pXYZW->y, uColor);
3071  render->RasterLine2D(pXYZW->z, pXYZW->y, pXYZW->z, pXYZW->w, uColor);
3072  render->RasterLine2D(pXYZW->z, pXYZW->w, pXYZW->x, pXYZW->w, uColor);
3073  render->RasterLine2D(pXYZW->x, pXYZW->w, pXYZW->x, pXYZW->y, uColor);
3074  }
3075 }
3076 
3077 int rand_interval(int min, int max) { return min + rand() % (max - min + 1); }
3078 
3079 void am_IntToString(int val, char *pOut) { sprintf(pOut, "%d", val); }
3080 
3081 void set_stru1_field_8_InArcomage(int inValue) { // what is this meant to be doing??
3082  switch (inValue) {
3083  case 91:
3084  HEXRAYS_LOBYTE(pArcomageGame->stru1.am_input_key) = 123;
3085  break;
3086  case 92:
3087  HEXRAYS_LOBYTE(pArcomageGame->stru1.am_input_key) = 124;
3088  break;
3089  case 93:
3090  HEXRAYS_LOBYTE(pArcomageGame->stru1.am_input_key) = 125;
3091  break;
3092  case 96:
3093  HEXRAYS_LOBYTE(pArcomageGame->stru1.am_input_key) = 126;
3094  break;
3095  case 61:
3096  HEXRAYS_LOBYTE(pArcomageGame->stru1.am_input_key) = 43;
3097  break;
3098  case 55:
3099  HEXRAYS_LOBYTE(pArcomageGame->stru1.am_input_key) = 38;
3100  break;
3101  case 56:
3102  HEXRAYS_LOBYTE(pArcomageGame->stru1.am_input_key) = 42;
3103  break;
3104  case 57:
3105  HEXRAYS_LOBYTE(pArcomageGame->stru1.am_input_key) = 40;
3106  break;
3107  case 59:
3108  HEXRAYS_LOBYTE(pArcomageGame->stru1.am_input_key) = 58;
3109  break;
3110  case 54:
3111  HEXRAYS_LOBYTE(pArcomageGame->stru1.am_input_key) = 94;
3112  break;
3113  case 50:
3114  HEXRAYS_LOBYTE(pArcomageGame->stru1.am_input_key) = 64;
3115  break;
3116  case 51:
3117  HEXRAYS_LOBYTE(pArcomageGame->stru1.am_input_key) = 35;
3118  break;
3119  case 52:
3120  HEXRAYS_LOBYTE(pArcomageGame->stru1.am_input_key) = 36;
3121  break;
3122  case 53:
3123  HEXRAYS_LOBYTE(pArcomageGame->stru1.am_input_key) = 37;
3124  break;
3125  case 49:
3126  HEXRAYS_LOBYTE(pArcomageGame->stru1.am_input_key) = 33;
3127  break;
3128  case 39:
3129  HEXRAYS_LOBYTE(pArcomageGame->stru1.am_input_key) = 34;
3130  break;
3131  case 44:
3132  HEXRAYS_LOBYTE(pArcomageGame->stru1.am_input_key) = 60;
3133  break;
3134  case 46:
3135  HEXRAYS_LOBYTE(pArcomageGame->stru1.am_input_key) = 62;
3136  break;
3137  case 47:
3138  HEXRAYS_LOBYTE(pArcomageGame->stru1.am_input_key) = 63;
3139  break;
3140  case 48:
3141  HEXRAYS_LOBYTE(pArcomageGame->stru1.am_input_key) = 41;
3142  break;
3143  default:
3144  HEXRAYS_LOBYTE(pArcomageGame->stru1.am_input_key) = inValue;
3145  break;
3146  }
3147 }
AcromageCardOnTable
Definition: Arcomage.h:83
ArcomageGame::pSprites
Texture * pSprites
Definition: Arcomage.h:150
Card_Hover_Index
int Card_Hover_Index
Definition: Arcomage.cpp:151
ArcomageGame::mouse_y
int mouse_y
Definition: Arcomage.h:137
GUIWindow::DrawText
void DrawText(GUIFont *font, int x, int y, unsigned short uFontColor, const char *str, bool present_time_transparency=false, int max_text_height=0, int uFontShadowColor=0)
Definition: GUIWindow.cpp:694
ArcomageCard::to_enemy_bricks2
char to_enemy_bricks2
Definition: Arcomage.h:64
start_quarry_level
int start_quarry_level
Definition: Arcomage.cpp:122
ArcomageStartConditions::bricks_amount
__int16 bricks_amount
Definition: Arcomage.cpp:73
ArcomageCard::to_pl_enm_magic_lvl
char to_pl_enm_magic_lvl
Definition: Arcomage.h:42
ArcomageCard::compare_param
int compare_param
Definition: Arcomage.h:20
explosion_effect_struct::num_init_per_cycle
float num_init_per_cycle
Definition: Arcomage.h:213
Localization::GetString
const char * GetString(unsigned int index) const
Definition: Localization.cpp:13
start_magic_level
int start_magic_level
Definition: Arcomage.cpp:123
effect_params_struct::create_per_frame
float create_per_frame
Definition: Arcomage.h:185
explosion_effect_struct::gravity_unshift
float gravity_unshift
Definition: Arcomage.h:212
start_gems_amount
int start_gems_amount
Definition: Arcomage.cpp:127
start_beasts_amount
int start_beasts_amount
Definition: Arcomage.cpp:128
Viewport.h
Timer::Time
uint64_t Time()
Definition: Time.cpp:11
arcomage_mouse::mouse_right_state_changed
char mouse_right_state_changed
Definition: Arcomage.cpp:177
use_start_bonus
char use_start_bonus
Definition: Arcomage.cpp:118
ArcomageCard::to_pl_enm_quarry_lvl2
char to_pl_enm_quarry_lvl2
Definition: Arcomage.h:70
ArcomageCard::to_pl_enm_tower
char to_pl_enm_tower
Definition: Arcomage.h:49
ArcomageStartConditions
Definition: Arcomage.cpp:65
ArcomageGame::force_am_exit
char force_am_exit
Definition: Arcomage.h:156
Rect::x
int x
Definition: Rect.h:4
GetPlayerHandCardCount
int GetPlayerHandCardCount(int player_num)
Definition: Arcomage.cpp:2088
GetEmptyCardSlotIndex
int GetEmptyCardSlotIndex(int player_num)
Definition: Arcomage.cpp:1176
ArcomageCard::to_pl_enm_wall2
char to_pl_enm_wall2
Definition: Arcomage.h:77
effect_params_struct::unused_param_3
int unused_param_3
Definition: Arcomage.h:182
ArcomageGame::OnMouseClick
static void OnMouseClick(char right_left, bool bDown)
Definition: Arcomage.cpp:196
ArcomageCard::to_pl_enm_magic_lvl2
char to_pl_enm_magic_lvl2
Definition: Arcomage.h:71
ArcomageStartConditions::tower_height
__int16 tower_height
Definition: Arcomage.cpp:68
SOUND_typing
@ SOUND_typing
Definition: AudioPlayer.h:66
ArcomageStartConditions::magic_level
__int16 magic_level
Definition: Arcomage.cpp:71
pArcomageGame
ArcomageGame * pArcomageGame
Definition: Arcomage.cpp:97
ArcomageCard::to_enemy_gems
char to_enemy_gems
Definition: Arcomage.h:36
zoo_bonus
int zoo_bonus
Definition: Arcomage.cpp:133
ArcomageCard::to_player_buildings
char to_player_buildings
Definition: Arcomage.h:29
ArcomageCard::to_enemy_zoo_lvl2
char to_enemy_zoo_lvl2
Definition: Arcomage.h:63
Rect::w
int w
Definition: Rect.h:7
ArcomageStartConditions::max_resources
__int16 max_resources
Definition: Arcomage.cpp:67
_449B57_test_bit
bool _449B57_test_bit(unsigned __int8 *a1, __int16 a2)
Definition: Party.cpp:1185
start_tower_height
int start_tower_height
Definition: Arcomage.cpp:120
ArcomageCard::to_player_quarry_lvl2
char to_player_quarry_lvl2
Definition: Arcomage.h:52
ArcomageCard::to_pl_enm_bricks
char to_pl_enm_bricks
Definition: Arcomage.h:44
ArcomageGame::pBlit_Copy_pixels
uint16_t * pBlit_Copy_pixels
Definition: Arcomage.h:144
height
EGLSurface EGLint EGLint EGLint EGLint height
Definition: SDL_egl.h:1596
ArcomageCard::to_enemy_gems2
char to_enemy_gems2
Definition: Arcomage.h:65
PlayCard
bool PlayCard(int player_num, int card_slot_num)
Definition: Arcomage.cpp:2200
ArcomageGame::mouse_left
char mouse_left
Definition: Arcomage.h:138
ArcomageCard::to_enemy_beasts2
char to_enemy_beasts2
Definition: Arcomage.h:66
current_player_num
int current_player_num
Definition: Arcomage.cpp:141
AudioPlayer::PlaySound
void PlaySound(SoundID eSoundID, int pid, unsigned int uNumRepeats, int x, int y, int a7)
Definition: AudioPlayer.cpp:195
spark_point_struct::spark_position
Point spark_position
Definition: Arcomage.h:171
ArcomagePlayer::zoo_level
int zoo_level
Definition: Arcomage.h:98
arcomage_mouse::Inside
bool Inside(Rect *pXYZW)
Definition: Arcomage.cpp:192
ArcomageCard
Definition: Arcomage.h:9
ArcomageCard::to_pl_enm_buildings
char to_pl_enm_buildings
Definition: Arcomage.h:47
sPoint::y
int y
Definition: Point.h:16
hide_card_anim_start
char hide_card_anim_start
Definition: Arcomage.cpp:164
ArcomageCard::needed_quarry_level
char needed_quarry_level
Definition: Arcomage.h:13
Rect::z
int z
Definition: Rect.h:6
GetNextCardFromDeck
void GetNextCardFromDeck(int player_num)
Definition: Arcomage.cpp:1143
ArcomagePlayer::wall_height
int wall_height
Definition: Arcomage.h:95
ArcomageCard::needed_magic_level
char needed_magic_level
Definition: Arcomage.h:14
explosion_effect_struct::max_lifespan
int max_lifespan
Definition: Arcomage.h:218
params
const GLfloat * params
Definition: SDL_opengl_glext.h:374
Party::_quest_bits
unsigned __int8 _quest_bits[64]
Definition: Party.h:291
localization
Localization * localization
Definition: Localization.cpp:11
ArcomageCard::to_player_wall
char to_player_wall
Definition: Arcomage.h:30
magic_bonus
int magic_bonus
Definition: Arcomage.cpp:132
explosion_effect_struct::unused_param_3
int unused_param_3
Definition: Arcomage.h:211
Point::x
unsigned int x
Definition: Point.h:7
ArcomageGame::pPlayer2Name
char pPlayer2Name[32]
Definition: Arcomage.h:155
SOUND_shuffle
@ SOUND_shuffle
Definition: AudioPlayer.h:63
ArcomageCard::to_player_beasts2
char to_player_beasts2
Definition: Arcomage.h:57
current_card_slot_index
int current_card_slot_index
Definition: Arcomage.cpp:145
hide_card_anim_count
int hide_card_anim_count
Definition: Arcomage.cpp:166
ArcomageCard::to_player_tower
char to_player_tower
Definition: Arcomage.h:31
ArcomagePlayer::tower_height
int tower_height
Definition: Arcomage.h:94
sPoint
Definition: Point.h:11
arcomage_mouse::y
int y
Definition: Arcomage.cpp:173
FillPlayerDeck
void FillPlayerDeck()
Definition: Arcomage.cpp:1094
Party::pPlayers
std::array< Player, 4 > pPlayers
Definition: Party.h:310
ArcomageStartConditions::wall_height
__int16 wall_height
Definition: Arcomage.cpp:69
effect_params_struct::unused_param_1
int unused_param_1
Definition: Arcomage.h:180
GUIFont::GetLineWidth
unsigned int GetLineWidth(const String &str)
Definition: GUIFont.cpp:278
cards_power
am_ai_cardpowerstruct cards_power[10]
Definition: Arcomage.cpp:114
AssetsManager::GetImage_PCXFromIconsLOD
Texture * GetImage_PCXFromIconsLOD(const String &name)
Definition: AssetsManager.cpp:81
ArcomageCard::needed_bricks
char needed_bricks
Definition: Arcomage.h:16
ArcomageCard::to_pl_enm_beasts2
char to_pl_enm_beasts2
Definition: Arcomage.h:75
GUIFont.h
effect_params_struct
Definition: Arcomage.h:178
ArcomageCard::needed_beasts
char needed_beasts
Definition: Arcomage.h:18
DrawPlayersText
void DrawPlayersText()
Definition: Arcomage.cpp:1509
ArcomageCard::to_player_wall2
char to_player_wall2
Definition: Arcomage.h:59
pMovie_Track
PMovie pMovie_Track
Definition: MediaPlayer.cpp:44
w
GLubyte GLubyte GLubyte GLubyte w
Definition: SDL_opengl_glext.h:734
ArcomageStartConditions::gems_amount
__int16 gems_amount
Definition: Arcomage.cpp:74
ArcomageCard::to_pl_enm_quarry_lvl
char to_pl_enm_quarry_lvl
Definition: Arcomage.h:41
ArcomageStartConditions::beasts_amount
__int16 beasts_amount
Definition: Arcomage.cpp:75
GUIFont::GetHeight
unsigned int GetHeight() const
Definition: GUIFont.cpp:84
ArcomageGame::Loop
static void Loop()
Definition: Arcomage.cpp:896
PlayerTurn
char PlayerTurn(int player_num)
Definition: Arcomage.cpp:1271
deck_walk_index
int deck_walk_index
Definition: Arcomage.cpp:149
ImageLoader.h
ArcomageGame::Victory_type
int Victory_type
Definition: Arcomage.h:153
explosion_effect_struct::unused_param_6
int unused_param_6
Definition: Arcomage.h:221
ArcomageCard::to_enemy_tower2
char to_enemy_tower2
Definition: Arcomage.h:69
spark_point_struct::spark_y_unshift
int spark_y_unshift
Definition: Arcomage.h:173
ArcomageCard::to_enemy_quarry_lvl2
char to_enemy_quarry_lvl2
Definition: Arcomage.h:61
DrawGemsCount
void DrawGemsCount(const String &str, Point *pXY)
Definition: Arcomage.cpp:1668
ArcomageCard::to_pl_enm_zoo_lvl
char to_pl_enm_zoo_lvl
Definition: Arcomage.h:43
Engine.h
playdiscard_anim_start
char playdiscard_anim_start
Definition: Arcomage.cpp:163
ArcomageStartConditions::max_tower
__int16 max_tower
Definition: Arcomage.cpp:66
effect_params_struct::unused_acc_1
float unused_acc_1
Definition: Arcomage.h:186
ArcomageGame::pfntComic
GUIFont * pfntComic
Definition: Arcomage.h:145
SOUND_wall_up
@ SOUND_wall_up
Definition: AudioPlayer.h:68
p2DEvents
_2devent p2DEvents[525]
Definition: Events.cpp:57
result
GLuint64EXT * result
Definition: SDL_opengl_glext.h:9435
ArcomageGame::pGameBackground
Texture * pGameBackground
Definition: Arcomage.h:149
ArcomageCard::to_player_buildings2
char to_player_buildings2
Definition: Arcomage.h:58
arcomage_mouse::Update
bool Update()
Definition: Arcomage.cpp:180
arcomage_mouse::curr_mouse_left
char curr_mouse_left
Definition: Arcomage.cpp:174
DrawPlayerLevels
void DrawPlayerLevels(const String &str, Point *pXY)
Definition: Arcomage.cpp:1624
max_tower_height
int max_tower_height
Definition: Arcomage.cpp:135
DrawGameUI
void DrawGameUI(int animation_stage)
Definition: Arcomage.cpp:1414
spark_point_struct::spark_remaining_life
int spark_remaining_life
Definition: Arcomage.h:170
StringFromInt
String StringFromInt(int value)
Definition: Strings.cpp:7
DrawRect
void DrawRect(Rect *pXYZW, unsigned __int16 uColor, char bSolidFill)
Definition: Arcomage.cpp:3065
explosion_effect_struct::New
static explosion_effect_struct * New()
Definition: Arcomage.cpp:208
UIHouses.h
IMAGE_FORMAT_A8R8G8B8
@ IMAGE_FORMAT_A8R8G8B8
Definition: Image.h:7
Party::PartyFindsGold
void PartyFindsGold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal)
Definition: Party.cpp:976
am_ai_cardpowerstruct::card_power
int card_power
Definition: Arcomage.cpp:111
ArcomageCard::to_enemy_beasts
char to_enemy_beasts
Definition: Arcomage.h:37
Localization.h
SOUND_deal
@ SOUND_deal
Definition: AudioPlayer.h:59
y
EGLSurface EGLint EGLint y
Definition: SDL_egl.h:1596
max_resources_amount
int max_resources_amount
Definition: Arcomage.cpp:136
ArcomageCard::to_enemy_wall
char to_enemy_wall
Definition: Arcomage.h:39
ArcomageGame::PlaySound
static void PlaySound(unsigned int event_id)
Definition: Arcomage.cpp:493
hide_card_anim_runnning
char hide_card_anim_runnning
Definition: Arcomage.cpp:165
am_effects_struct
Definition: Arcomage.h:238
SOUND_tower_up
@ SOUND_tower_up
Definition: AudioPlayer.h:65
ArcomageDeck::cardsInUse
char cardsInUse[DECK_SIZE]
Definition: Arcomage.h:234
am_effects_struct::have_effect
char have_effect
Definition: Arcomage.h:239
window_SpeakInHouse
GUIWindow * window_SpeakInHouse
Definition: GUIWindow.cpp:51
ArcomageGame::GameOver
char GameOver
Definition: Arcomage.h:157
ArcomageCard::to_player_magic_lvl
char to_player_magic_lvl
Definition: Arcomage.h:24
ArcomagePlayer::cards_at_hand
int cards_at_hand[10]
Definition: Arcomage.h:102
pParty
Party * pParty
Definition: Party.cpp:30
Image
Definition: Image.h:19
ArcomageCard::to_player_zoo_lvl2
char to_player_zoo_lvl2
Definition: Arcomage.h:54
ArcomageGame::MsgLoop
static bool MsgLoop(int a1, ArcomageGame_InputMSG *a2)
Definition: Arcomage.cpp:570
effect_params_struct::spark_array_size
int spark_array_size
Definition: Arcomage.h:184
ArcomageCard::needed_gems
char needed_gems
Definition: Arcomage.h:17
pFontArrus
GUIFont * pFontArrus
Definition: GUIFont.cpp:18
IRender.h
am_effects_struct::eff_params
effect_params_struct eff_params
Definition: Arcomage.h:243
SOUND_damage
@ SOUND_damage
Definition: AudioPlayer.h:58
ArcomageGame::pfntArrus
GUIFont * pfntArrus
Definition: Arcomage.h:146
p
GLfloat GLfloat p
Definition: SDL_opengl_glext.h:11093
DrawCardsRectangles
int DrawCardsRectangles(int player_num)
Definition: Arcomage.cpp:2097
ArcomageStartConditions::mastery_lvl
int mastery_lvl
Definition: Arcomage.cpp:76
ArcomageGame::field_54
int field_54
Definition: Arcomage.h:148
ArcomageGame_InputMSG::field_4
int field_4
Definition: Arcomage.h:108
BackToHouseMenu
void BackToHouseMenu()
Definition: UIHouses.cpp:3991
ArcomageCard::to_pl_enm_gems
char to_pl_enm_gems
Definition: Arcomage.h:45
x
EGLSurface EGLint x
Definition: SDL_egl.h:1596
color
GLuint color
Definition: SDL_opengl_glext.h:1151
am_Players
ArcomagePlayer am_Players[2]
Definition: Arcomage.cpp:99
CalculateCardPower
int CalculateCardPower(ArcomagePlayer *player, ArcomagePlayer *enemy, ArcomageCard *pCard, int mastery)
Definition: Arcomage.cpp:588
AcromageCardOnTable::table_pos
Point table_pos
Definition: Arcomage.h:86
InitalHandsFill
void InitalHandsFill()
Definition: Arcomage.cpp:1134
viewparams
struct ViewingParams * viewparams
Definition: mm7_data.cpp:22
am_ai_cardpowerstruct
Definition: Arcomage.cpp:109
ArcomageGame::prev_mouse_left
char prev_mouse_left
Definition: Arcomage.h:159
ArcomageCard::to_enemy_quarry_lvl
char to_enemy_quarry_lvl
Definition: Arcomage.h:32
ArcomageStartConditions::quarry_level
__int16 quarry_level
Definition: Arcomage.cpp:70
ArcomageCard::to_enemy_magic_lvl
char to_enemy_magic_lvl
Definition: Arcomage.h:33
deckMaster
ArcomageDeck deckMaster
Definition: Arcomage.cpp:104
sPoint::x
int x
Definition: Point.h:15
effect_params_struct::max_lifespan
int max_lifespan
Definition: Arcomage.h:189
IncreaseResourcesInTurn
void IncreaseResourcesInTurn(int player_num)
Definition: Arcomage.cpp:1184
ArcomageCard::to_enemy_buildings2
char to_enemy_buildings2
Definition: Arcomage.h:67
explosion_effect_struct::start_x_min
int start_x_min
Definition: Arcomage.h:205
ArcomageGame::uGameWinner
int uGameWinner
Definition: Arcomage.h:152
IMAGE_FORMAT_R5G6B5
@ IMAGE_FORMAT_R5G6B5
Definition: Image.h:5
ArcomageDeck::name
char name[32]
Definition: Arcomage.h:233
ArcomageCard::to_pl_enm_gems2
char to_pl_enm_gems2
Definition: Arcomage.h:74
ArcomagePlayer::IsHisTurn
int IsHisTurn
Definition: Arcomage.h:93
ArcomageCard::to_player_tower2
char to_player_tower2
Definition: Arcomage.h:60
explosion_effect_struct::unused_param_7
int unused_param_7
Definition: Arcomage.h:222
ArcomageCard::to_enemy_wall2
char to_enemy_wall2
Definition: Arcomage.h:68
ArcomageGame::mouse_right
char mouse_right
Definition: Arcomage.h:140
ArcomageGame::stru1
ArcomageGame_InputMSG stru1
Definition: Arcomage.h:134
width
EGLSurface EGLint EGLint EGLint width
Definition: SDL_egl.h:1596
start_conditions
const ArcomageStartConditions start_conditions[13]
Definition: Arcomage.cpp:79
Log::Warning
void Warning(const wchar_t *pFormat,...)
Definition: Log.cpp:28
SOUND_victory
@ SOUND_victory
Definition: AudioPlayer.h:67
explosion_effect_struct::min_lifespan
int min_lifespan
Definition: Arcomage.h:217
explosion_effect_struct::StartFill
int StartFill(effect_params_struct *params)
Definition: Arcomage.cpp:233
AudioPlayer::StopChannels
void StopChannels(int uStartChannel, int uEndChannel)
Definition: AudioPlayer.cpp:331
ArcomageGame::LoadSprites
static bool LoadSprites()
Definition: Arcomage.cpp:581
drawn_card_slot_index
int drawn_card_slot_index
Definition: Arcomage.cpp:162
MediaPlayer.h
ArcomageCard::slot
int slot
Definition: Arcomage.h:11
ArcomageCard::to_player_zoo_lvl
char to_player_zoo_lvl
Definition: Arcomage.h:25
DrawBricksCount
void DrawBricksCount(const String &str, Point *pXY)
Definition: Arcomage.cpp:1646
ArcomageCard::field_30
char field_30
Definition: Arcomage.h:21
Arcomage.h
Party.h
explosion_effect_struct::Free
int Free()
Definition: Arcomage.cpp:223
effect_params_struct::gravity_acc
float gravity_acc
Definition: Arcomage.h:183
ArcomageGame::event_timer_time
int event_timer_time
Definition: Arcomage.h:151
ArcomageCard::to_pl_enm_wall
char to_pl_enm_wall
Definition: Arcomage.h:48
window
EGLSurface EGLNativeWindowType * window
Definition: SDL_egl.h:1580
ApplyCardToPlayer
void ApplyCardToPlayer(int player_num, unsigned int uCardID)
Definition: Arcomage.cpp:2251
ArcomageGame::prev_mouse_right
char prev_mouse_right
Definition: Arcomage.h:160
ArcomageCard::to_pl_enm_beasts
char to_pl_enm_beasts
Definition: Arcomage.h:46
SOUND_bricks_up
@ SOUND_bricks_up
Definition: AudioPlayer.h:57
arcomage_mouse::x
int x
Definition: Arcomage.cpp:172
ArcomagePlayer::quarry_level
int quarry_level
Definition: Arcomage.h:96
ArcomageCard::to_player_magic_lvl2
char to_player_magic_lvl2
Definition: Arcomage.h:53
effect_params_struct::min_lifespan
int min_lifespan
Definition: Arcomage.h:188
TurnChange
void TurnChange()
Definition: Arcomage.cpp:1194
ArcomageCard::to_pl_enm_bricks2
char to_pl_enm_bricks2
Definition: Arcomage.h:73
am_DrawText
void am_DrawText(const String &str, Point *pXY)
Definition: Arcomage.cpp:3059
DrawCardAnimation
void DrawCardAnimation(int a1)
Definition: Arcomage.cpp:1908
anim_card_pos_playdiscard
Point anim_card_pos_playdiscard
Definition: Arcomage.cpp:158
Rect
Definition: Rect.h:3
ArcomageCard::to_player_bricks
char to_player_bricks
Definition: Arcomage.h:26
DiscardCard
bool DiscardCard(int player_num, int card_slot_index)
Player_Cards_Shift
bool Player_Cards_Shift
Definition: Arcomage.cpp:117
explosion_effect_struct::unused_param_2
int unused_param_2
Definition: Arcomage.h:210
arcomage_mouse
Definition: Arcomage.cpp:168
explosion_effect_struct::start_x_max
int start_x_max
Definition: Arcomage.h:207
ArcomagePlayer::resource_beasts
int resource_beasts
Definition: Arcomage.h:101
am_IntToString
void am_IntToString(int val, char *pOut)
Definition: Arcomage.cpp:3079
ArcomageCard::to_player_gems2
char to_player_gems2
Definition: Arcomage.h:56
SOUND_defeat
@ SOUND_defeat
Definition: AudioPlayer.h:60
num_actions_left
int num_actions_left
Definition: Arcomage.cpp:153
ArcomageCard::to_enemy_magic_lvl2
char to_enemy_magic_lvl2
Definition: Arcomage.h:62
ArcomageCard::to_enemy_tower
char to_enemy_tower
Definition: Arcomage.h:40
AcromageCardOnTable::discarded
int discarded
Definition: Arcomage.h:85
ArcomageGame::OnMouseMove
static void OnMouseMove(int x, int y)
Definition: Arcomage.cpp:203
ArcomagePlayer::card_shift
sPoint card_shift[10]
Definition: Arcomage.h:103
new_explosion_effect
int new_explosion_effect(Point *a1, int a2)
Definition: Arcomage.cpp:345
SetStartGameData
void SetStartGameData()
Definition: Arcomage.cpp:1024
explosion_effect_struct::start_y_min
int start_y_min
Definition: Arcomage.h:208
ArcomageGame::GetCardRect
static void GetCardRect(unsigned int uCardID, Rect *pCardRect)
Definition: Arcomage.cpp:2077
explosion_effect_struct::unused_param_1
int unused_param_1
Definition: Arcomage.h:209
DrawRectanglesForText
void DrawRectanglesForText()
Definition: Arcomage.cpp:1451
am_effects_struct::explosion_eff
explosion_effect_struct * explosion_eff
Definition: Arcomage.h:244
ArcomageCard::to_pl_enm_buildings2
char to_pl_enm_buildings2
Definition: Arcomage.h:76
SOUND_title
@ SOUND_title
Definition: AudioPlayer.h:64
t
GLdouble GLdouble t
Definition: SDL_opengl.h:2071
pFontComic
GUIFont * pFontComic
Definition: GUIFont.cpp:24
quarry_bonus
int quarry_bonus
Definition: Arcomage.cpp:131
am_ai_cardpowerstruct::slot_index
int slot_index
Definition: Arcomage.cpp:110
Party::pArcomageWins
std::array< unsigned __int8, 16 > pArcomageWins
Definition: Party.h:292
am_effects_struct::effect_sparks
spark_point_struct effect_sparks[150]
Definition: Arcomage.h:245
SOUND_querry_up
@ SOUND_querry_up
Definition: AudioPlayer.h:61
explosion_effect_struct::params_filled
char params_filled
Definition: Arcomage.h:225
anim_card_spd_drawncard
sPoint anim_card_spd_drawncard
Definition: Arcomage.cpp:155
first
const GLint * first
Definition: SDL_opengl_glext.h:371
AudioPlayer.h
am_effects_struct::effect_sign
char effect_sign
Definition: Arcomage.h:240
ArcomageCard::to_player_gems
char to_player_gems
Definition: Arcomage.h:27
IsGameOver
bool IsGameOver()
Definition: Arcomage.cpp:1256
spark_point_struct::spark_x_unshift
int spark_x_unshift
Definition: Arcomage.h:172
opponents_turn
char opponents_turn
Definition: Arcomage.cpp:139
ArcomageGame::pSpritesPixels
uint16_t * pSpritesPixels
Definition: Arcomage.h:143
explosion_effect_struct::UpdateEffect
int UpdateEffect()
Definition: Arcomage.cpp:274
ArcomageGame::check_exit
char check_exit
Definition: Arcomage.h:161
ArcomageCard::to_player_quarry_lvl
char to_player_quarry_lvl
Definition: Arcomage.h:23
explosion_effect_struct::mem_signature
int mem_signature
Definition: Arcomage.h:202
ArcomageGame_InputMSG::am_input_type
int am_input_type
Definition: Arcomage.h:107
spark_point_struct
Definition: Arcomage.h:169
ArcomageCard::to_player_bricks2
char to_player_bricks2
Definition: Arcomage.h:55
Point::y
unsigned int y
Definition: Point.h:8
explosion_effect_struct::effect_active
char effect_active
Definition: Arcomage.h:224
SOUND_bricks_down
@ SOUND_bricks_down
Definition: AudioPlayer.h:56
ArcomageGame_InputMSG
Definition: Arcomage.h:106
ArcomageCard::to_enemy_buildings
char to_enemy_buildings
Definition: Arcomage.h:38
spark_point_struct::spark_x_speed
int spark_x_speed
Definition: Arcomage.h:174
Rect::y
int y
Definition: Rect.h:5
ArcomageCard::needed_zoo_level
char needed_zoo_level
Definition: Arcomage.h:15
val
GLuint GLfloat * val
Definition: SDL_opengl_glext.h:1495
arcomage_mouse::curr_mouse_right
char curr_mouse_right
Definition: Arcomage.cpp:176
start_zoo_level
int start_zoo_level
Definition: Arcomage.cpp:124
explosion_effect_struct::start_y_max
int start_y_max
Definition: Arcomage.h:206
Player1Name
char Player1Name[]
Definition: Arcomage.cpp:107
DrawSparks
void DrawSparks()
Definition: Arcomage.cpp:407
Player_Gets_First_Turn
bool Player_Gets_First_Turn
Definition: Arcomage.cpp:116
Image::Create
static Image * Create(unsigned int width, unsigned int height, IMAGE_FORMAT format, const void *pixels=nullptr)
Definition: Image.cpp:243
v2
GLfloat GLfloat GLfloat v2
Definition: SDL_opengl_glext.h:695
ArcomageCard::to_enemy_zoo_lvl
char to_enemy_zoo_lvl
Definition: Arcomage.h:34
arcomage_mouse::mouse_left_state_changed
char mouse_left_state_changed
Definition: Arcomage.cpp:175
assets
AssetsManager * assets
Definition: AssetsManager.cpp:12
ArcomagePlayer::resource_bricks
int resource_bricks
Definition: Arcomage.h:99
uint
unsigned int uint
Definition: MM7.h:4
start_wall_height
int start_wall_height
Definition: Arcomage.cpp:121
ApplyDamageToBuildings
int ApplyDamageToBuildings(int player_num, int damage)
Definition: Arcomage.cpp:2781
Player2Name
char Player2Name[]
Definition: Arcomage.cpp:106
start_bricks_amount
int start_bricks_amount
Definition: Arcomage.cpp:126
_449B7E_toggle_bit
void _449B7E_toggle_bit(unsigned char *pArray, __int16 a2, unsigned __int16 bToggle)
Definition: Party.cpp:1190
ArcomageDeck
Definition: Arcomage.h:232
__debugbreak
void __cdecl __debugbreak(void)
drawn_card_anim_start
char drawn_card_anim_start
Definition: Arcomage.cpp:160
CanCardBePlayed
bool CanCardBePlayed(int player_num, int hand_card_indx)
Definition: Arcomage.cpp:2235
DrawBeastsCount
void DrawBeastsCount(const String &str, Point *pXY)
Definition: Arcomage.cpp:1690
_2devent::fPriceMultiplier
float fPriceMultiplier
Definition: Events2D.h:53
GUIWindow::par1C
unsigned int par1C
Definition: GUIWindow.h:477
ArcomageCard::to_pl_enm_zoo_lvl2
char to_pl_enm_zoo_lvl2
Definition: Arcomage.h:72
ArcomageStartConditions::zoo_level
__int16 zoo_level
Definition: Arcomage.cpp:72
explosion_effect_struct::unused_acc_1
int unused_acc_1
Definition: Arcomage.h:215
R8G8B8_to_TargetFormat
unsigned int R8G8B8_to_TargetFormat(int uColor)
Definition: Arcomage.cpp:61
playDeck
ArcomageDeck playDeck
Definition: Arcomage.cpp:103
DrawPlayersTowers
void DrawPlayersTowers()
Definition: Arcomage.cpp:1712
Image::GetPixels
const void * GetPixels(IMAGE_FORMAT format)
Definition: Image.cpp:270
ArcomageGame::mouse_x
int mouse_x
Definition: Arcomage.h:136
ArcomageGame::field_0
char field_0
Definition: Arcomage.h:129
m
const GLfloat * m
Definition: SDL_opengl_glext.h:6095
ArcomagePlayer::magic_level
int magic_level
Definition: Arcomage.h:97
ViewingParams::bRedrawGameUI
int bRedrawGameUI
Definition: Viewport.h:74
discarded_card_id
int discarded_card_id
Definition: Arcomage.cpp:147
Party::uNumArcomageWins
int uNumArcomageWins
Definition: Party.h:303
spark_point_struct::spark_y_speed
int spark_y_speed
Definition: Arcomage.h:175
ArcomageCard::field_4D
char field_4D
Definition: Arcomage.h:50
SoundID
SoundID
Definition: AudioPlayer.h:10
explosion_effect_struct::prev_init_overflow
float prev_init_overflow
Definition: Arcomage.h:214
shown_cards
AcromageCardOnTable shown_cards[10]
Definition: Arcomage.cpp:100
GameResultsApply
void GameResultsApply()
Definition: Arcomage.cpp:2801
ArcomageDeck::cards_IDs
int cards_IDs[DECK_SIZE]
Definition: Arcomage.h:235
anim_card_spd_playdiscard
sPoint anim_card_spd_playdiscard
Definition: Arcomage.cpp:157
explosion_effect_struct::unused_param_4
int unused_param_4
Definition: Arcomage.h:219
pCards
ArcomageCard pCards[87]
Definition: ArcomageCards.cpp:3
explosion_effect_struct::spark_array_ptr
spark_point_struct * spark_array_ptr
Definition: Arcomage.h:223
pPrimaryWindow
GUIWindow * pPrimaryWindow
Definition: GUIWindow.cpp:48
See_Opponents_Cards
char See_Opponents_Cards
Definition: Arcomage.cpp:140
SetStartConditions
void SetStartConditions()
Definition: Arcomage.cpp:3033
Party::uNumArcomageLoses
int uNumArcomageLoses
Definition: Party.h:304
explosion_effect_struct
Definition: Arcomage.h:193
effect_params_struct::unused_param_2
int unused_param_2
Definition: Arcomage.h:181
pAudioPlayer
AudioPlayer * pAudioPlayer
Definition: AudioPlayer.cpp:20
ArcomageGame::PrepareArcomage
static void PrepareArcomage()
Definition: Arcomage.cpp:2982
GUIWindow.h
Point
Definition: Point.h:3
rand_interval
int rand_interval(int min, int max)
Definition: Arcomage.cpp:3077
logger
Log * logger
Definition: IocContainer.cpp:47
ArcomageCard::card_resource_type
char card_resource_type
Definition: Arcomage.h:12
ArcomageCard::draw_extra_card_count
char draw_extra_card_count
Definition: Arcomage.h:22
OpponentsAITurn
bool OpponentsAITurn(int player_num)
Definition: Arcomage.cpp:810
Color16
uint16_t Color16(uint32_t r, uint32_t g, uint32_t b)
Definition: Engine.cpp:148
minimum_cards_at_hand
int minimum_cards_at_hand
Definition: Arcomage.cpp:130
DrawCards
void DrawCards()
Definition: Arcomage.cpp:1800
num_cards_to_discard
int num_cards_to_discard
Definition: Arcomage.cpp:152
ArcomageGame::bGameInProgress
char bGameInProgress
Definition: Arcomage.h:162
need_to_discard_card
char need_to_discard_card
Definition: Arcomage.cpp:143
ArcomageCard::to_enemy_bricks
char to_enemy_bricks
Definition: Arcomage.h:35
set_stru1_field_8_InArcomage
void set_stru1_field_8_InArcomage(int inValue)
Definition: Arcomage.cpp:3081
ArcomageCard::to_player_beasts
char to_player_beasts
Definition: Arcomage.h:28
uint32_t
unsigned __int32 uint32_t
Definition: SDL_config.h:39
ArcomageGame
Definition: Arcomage.h:114
explosion_effect_struct::remaining_sparks_to_init
int remaining_sparks_to_init
Definition: Arcomage.h:204
ArcomagePlayer
Definition: Arcomage.h:91
effect_params_struct::sparks_array
spark_point_struct * sparks_array
Definition: Arcomage.h:190
opponent_mastery
int opponent_mastery
Definition: Arcomage.cpp:138
ArcomageGame_InputMSG::am_input_key
int am_input_key
Definition: Arcomage.h:109
String
std::string String
Definition: Strings.h:10
explosion_effect_struct::unused_param_5
int unused_param_5
Definition: Arcomage.h:220
pEventTimer
Timer * pEventTimer
Definition: Time.cpp:8
anim_card_pos_drawncard
Point anim_card_pos_drawncard
Definition: Arcomage.cpp:156
explosion_effect_struct::IsEffectActive
int IsEffectActive()
Definition: Arcomage.cpp:333
SOUND_querry_down
@ SOUND_querry_down
Definition: AudioPlayer.h:62
played_card_id
int played_card_id
Definition: Arcomage.cpp:146
AcromageCardOnTable::hide_anim_pos
Point hide_anim_pos
Definition: Arcomage.h:88
AcromageCardOnTable::uCardId
int uCardId
Definition: Arcomage.h:84
Image::Release
bool Release()
Definition: Image.cpp:335
ArcomageCard::to_pl_enm_tower2
char to_pl_enm_tower2
Definition: Arcomage.h:78
ArcomageGame::force_redraw_1
char force_redraw_1
Definition: Arcomage.h:158
Api.h
effect_params_struct::effect_area
Rect effect_area
Definition: Arcomage.h:179
DrawPlayersWall
void DrawPlayersWall()
Definition: Arcomage.cpp:1763
am_effects_array
am_effects_struct am_effects_array[10]
Definition: Arcomage.cpp:101
ArcomagePlayer::resource_gems
int resource_gems
Definition: Arcomage.h:100
AcromageCardOnTable::hide_anim_spd
sPoint hide_anim_spd
Definition: Arcomage.h:87
ArcomageCard::can_draw_extra_card2
char can_draw_extra_card2
Definition: Arcomage.h:51
Time.h
ArcomageGame::pPlayer1Name
char pPlayer1Name[32]
Definition: Arcomage.h:154
explosion_effect_struct::Clear
int Clear(char stop_init, char wipe)
Definition: Arcomage.cpp:258
Strings.h
drawn_card_anim_cnt
int drawn_card_anim_cnt
Definition: Arcomage.cpp:161
explosion_effect_struct::spark_array_size
int spark_array_size
Definition: Arcomage.h:203
render
std::shared_ptr< IRender > render
Definition: RenderOpenGL.cpp:52