World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Outdoor.cpp
См. документацию.
2 
3 #include <algorithm>
4 
5 #include "Engine/Engine.h"
6 #include "Engine/Events.h"
7 #include "Engine/LOD.h"
8 #include "Engine/Objects/Actor.h"
9 #include "Engine/Objects/Chest.h"
12 #include "Engine/OurMath.h"
13 #include "Engine/Party.h"
14 #include "Engine/SpellFxRenderer.h"
16 #include "Engine/Time.h"
18 #include "Engine/ZlibWrapper.h"
19 #include "Engine/stru123.h"
20 
22 
24 
25 #include "Platform/Api.h"
26 
27 #include "DecorationList.h"
28 #include "Level/Decoration.h"
29 #include "LightmapBuilder.h"
30 #include "Lights.h"
31 #include "PaletteManager.h"
32 #include "ParticleEngine.h"
33 #include "Sprites.h"
34 #include "Viewport.h"
35 #include "Weather.h"
36 
37 #include "GUI/GUIProgressBar.h"
38 #include "GUI/GUIWindow.h"
39 #include "GUI/UI/UIRest.h"
40 #include "GUI/UI/UITransition.h"
41 
43 
45 
47 
50 
52 std::array<struct Polygon, 2000 + 18000> array_77EC08;
53 
55  unsigned char small_fog_chance;
56  unsigned char average_fog_chance;
57  unsigned char dense_fog_chance;
58  unsigned char __unused__;
59 } fog_probability_table[15] = {
60  {20, 10, 5, 0}, // MAP_EMERALD_ISLE
61  {20, 10, 5, 0}, // MAP_HARMONDALE
62  {20, 10, 5, 0}, // MAP_STEADWICK
63  {20, 10, 5, 0}, // MAP_PIERPONT
64  {20, 10, 5, 0}, // MAP_DEYJA
65  {10, 5, 0, 0}, // MAP_BRAKADA_DESERT
66  {0, 0, 0, 0}, // MAP_CELESTIA
67  {0, 0, 0, 0}, // MAP_THE_PIT
68  {20, 30, 50, 0}, // MAP_EVENMORN_ISLE
69  {30, 20, 10, 0}, // MAP_MOUNT_NIGHON
70  {10, 5, 0, 0}, // MAP_BARROW_DOWNS
71  {20, 10, 5, 0}, // MAP_LAND_OF_GIANTS
72  {20, 10, 5, 0}, // MAP_TATALIA
73  {20, 10, 5, 0}, // MAP_AVLEE
74  {0, 100, 0, 0} // MAP_SHOALS
75 };
76 
77 // for future sky textures?
78 std::array<int, 9> dword_4EC268 = {{3, 3, 3, 3, 3, 3, 3, 3, 3}};
79 std::array<int, 7> dword_4EC28C = {{3, 3, 3, 3, 3, 3, 3}};
80 int dword_4EC2A8 = 9;
81 int dword_4EC2AC = 7;
82 
83 //----- (0047A59E) --------------------------------------------------------
84 void OutdoorLocation::ExecDraw(unsigned int bRedraw) {
87  pIndoorCameraD3D->debug_flags |= ODM_RENDER_DRAW_D3D_OUTLINES;
88 
89  // if (bRedraw || true /*render->pRenderD3D*/) {
90  // pODMRenderParams->RotationToInts();
91  // sub_481ED9_MessWithODMRenderParams();
92 
93  // inlined
94 
95  //----- (00481ED9) --------------------------------------------------------
96  // void sub_481ED9_MessWithODMRenderParams() {
98  // pODMRenderParams->uNumEdges = 0;
99  // pODMRenderParams->uNumSpans = 0;
100  // pODMRenderParams->uNumSurfs = 0;
102  // pODMRenderParams->field_44 = 0;
103  //}
104 
105  //}
106 
109 
111 
112  // if (bRedraw) {
113  // sub_487DA9(); // wipes poly array feild 108 doesnt do anything
114  //}
115 
118 
119  pOutdoor->UpdateFog();
120  // pIndoorCameraD3D->sr_Reset_list_0037C();
121 
122  // if (render->pRenderD3D) // d3d - redraw always
123  {
124  SkyBillboard.CalcSkyFrustumVec(65536, 0, 0, 0, 65536, 0); // sky box frustum
125  render->DrawOutdoorSkyD3D();
126  render->RenderTerrainD3D();
127  render->DrawBuildingsD3D();
128 
129  // render->DrawBezierTerrain();
130  }
131 
134 
135  engine->PushStationaryLights(-1);
136  // engine->PrepareBloodsplats(); // not used?
137  if (bRedraw)
140  1);
141  engine->SetForceRedraw(false);
142  if (render->IsUsingSpecular())
143  lightmap_builder->uFlags |= LIGHTMAP_FLAGS_USE_SPECULAR;
144  else
145  lightmap_builder->uFlags &= ~LIGHTMAP_FLAGS_USE_SPECULAR;
146 
150 
153  render->PrepareDecorationsRenderList_ODM();
154 
155  render->DrawSpriteObjects_ODM();
156  render->TransformBillboardsAndSetPalettesODM();
157 }
158 
159 //----- (00441CFF) --------------------------------------------------------
161  bool redrawWorld = true;
162  if (!(pParty->uFlags & 2) && !engine->config->ForceRedraw())
163  redrawWorld = false;
164  pOutdoor->ExecDraw(redrawWorld);
165 
166  engine->DrawParticles();
167  // pWeather->Draw();//если раскомментировать скорость снега быстрее
169 }
170 
171 //----- (00488E23) --------------------------------------------------------
173  if (pParty->uCurrentHour < 5) { // ночь
174  pWeather->bNight = true;
175  return 60.0 * 0.016666668;
176  } else if (pParty->uCurrentHour >= 5 && pParty->uCurrentHour < 6) { // рассвет
177  pWeather->bNight = false;
178  return (60.0 - (double)(60 * pParty->uCurrentHour +
179  pParty->uCurrentMinute - 300)) *
180  0.016666668;
181  } else if (pParty->uCurrentHour >= 6 && pParty->uCurrentHour < 20) { // день
182  pWeather->bNight = false;
183  return 0.0;
184  } else if (pParty->uCurrentHour >= 20 &&
185  pParty->uCurrentHour < 21) { // сумерки
186  pWeather->bNight = false;
187  return ((double)(pParty->uCurrentHour - 20) * 60.0 +
188  (double)(signed int)pParty->uCurrentMinute) *
189  0.016666668;
190  } else { // ночь
191  pWeather->bNight = true;
192  return 60.0 * 0.016666668;
193  }
194 }
195 
196 //----- (00488EB1) --------------------------------------------------------
198  // OutdoorLocation *v3; // esi@1
199  unsigned int v4; // edi@1
200  unsigned int v5; // eax@1
201  // int result; // eax@5
202 
203  /* v3 = this;
204  v4 = WorldPosToGridCellZ(sY);
205  v5 = WorldPosToGridCellX(sX);
206  if ( (v5 & 0x80000000u) != 0 || (signed int)v5 > 127 || (v4 & 0x80000000u)
207  != 0 || (signed int)v4 > 127 ) result = 0; else result =
208  ActuallyGetSomeOtherTileInfo(v5, v4); return result;*/
209  v4 = WorldPosToGridCellZ(sY);
210  v5 = WorldPosToGridCellX(sX);
211  if (v5 < 0 || v5 > 127 || v4 < 0 || v4 > 127) return 0;
212  return ActuallyGetSomeOtherTileInfo(v5, v4);
213 }
214 
215 //----- (00488EEF) --------------------------------------------------------
216 TileDesc *OutdoorLocation::GetTile(signed int sX, signed int sY) {
217  signed int v4; // edi@1
218  signed int v5; // eax@1
219 
220  v4 = WorldPosToGridCellZ(sY);
221  v5 = WorldPosToGridCellX(sX);
222  if (v5 < 0 || v5 > 127 || v4 < 0 || v4 > 127) return nullptr;
223 
224  return this->DoGetTile(v5, v4);
225 }
226 
227 //----- (00488F2E) --------------------------------------------------------
229 /* Функция предоставляет возможность перемещать камеру таким образом, чтобы она
230 имитировала ходьбу по ландшафту. То есть нам надо менять высоту камеры
231 (координату Y) в зависимости от того, в каком месте ландшафта мы находимся. Для
232 этого мы сначала должны определить по координатам X и Z камеры квадрат ландшафта
233 в котором мы находимся. Все это делает функция Terrain::getHeight; в своих
234 параметрах она получает координаты X и Z камеры и возвращает высоту,
235 на которой должна быть расположена камера, чтобы она оказалась над ландшафтом.*/
236  int result; // eax@5
237 
238  if (sX < 0 || sX > 127 || sZ < 0 || sZ > 127)
239  result = 0;
240  else
241  result = DoGetHeightOnTerrain(sX, sZ);
242  return result;
243 }
244 
245 //----- (00488F5C) --------------------------------------------------------
246 bool OutdoorLocation::Initialize(const String &filename, int days_played,
247  int respawn_interval_days, int *thisa) {
248  decal_builder->Reset(0);
249 
250  if (!filename.empty()) {
251  Release();
255 
256  if (!this->Load(filename, days_played, respawn_interval_days, thisa)) {
257  logger->Warning(L"Couldn't Load Map!");
259  }
260 
266 
267  return true;
268  }
269 
270  return false;
271 }
272 
274  // north south east west from
275  {MAP_INVALID, MAP_INVALID, MAP_INVALID, MAP_INVALID}, // MAP_EMERALD_ISLE
278  {MAP_AVLEE, MAP_HARMONDALE, MAP_INVALID, MAP_DEYJA}, // MAP_PIERPONT
280  {MAP_STEADWICK, MAP_INVALID, MAP_BARROW_DOWNS, MAP_INVALID}, // MAP_BRAKADA_DESERT
281  {MAP_INVALID, MAP_INVALID, MAP_INVALID, MAP_INVALID}, // MAP_CELESTIA
282  {MAP_INVALID, MAP_INVALID, MAP_INVALID, MAP_INVALID}, // MAP_THE_PIT
283  {MAP_INVALID, MAP_INVALID, MAP_INVALID, MAP_INVALID}, // MAP_EVENMORN_ISLE
284  {MAP_INVALID, MAP_INVALID, MAP_INVALID, MAP_INVALID}, // MAP_MOUNT_NIGHON
286  {MAP_INVALID, MAP_INVALID, MAP_INVALID, MAP_INVALID}, // MAP_LAND_OF_GIANTS
287  {MAP_INVALID, MAP_INVALID, MAP_STEADWICK, MAP_INVALID}, // MAP_TATALIA
290 };
291 unsigned char foot_travel_times[15][4] = {
292  // north south east west from
293  {0, 0, 0, 0}, // MAP_EMERALD_ISLE
294  {5, 5, 7, 5}, // MAP_HARMONDALE
295  {5, 5, 5, 5}, // MAP_STEADWICK
296  {5, 5, 0, 5}, // MAP_PIERPONT
297  {7, 5, 5, 4}, // MAP_DEYJA
298  {5, 0, 5, 0}, // MAP_BRAKADA_DESERT
299  {0, 0, 0, 0}, // MAP_CELESTIA
300  {0, 0, 0, 0}, // MAP_THE_PIT
301  {0, 0, 0, 0}, // MAP_EVENMORN_ISLE
302  {0, 0, 0, 0}, // MAP_MOUNT_NIGHON
303  {5, 7, 7, 5}, // MAP_BARROW_DOWNS
304  {0, 0, 0, 0}, // MAP_LAND_OF_GIANTS
305  {0, 0, 5, 0}, // MAP_TATALIA
306  {0, 7, 5, 0}, // MAP_AVLEE
307  {0, 0, 0, 0}, // MAP_SHOALS
308 };
309 
311  // north south east west from
327 };
328 
329 //----- (0048902E) --------------------------------------------------------
331  signed int sPartyZ, char *pOut,
332  signed int a5) {
333  char *mapNumberAsStr; // eax@3
334  int mapNumberAsInt; // eax@3
335  signed int direction; // esi@7
336  signed int destinationMap; // eax@23
337  char Str[140]; // [sp+8h] [bp-78h]@3
338 
339  strcpy(Str, this->level_filename.c_str());
340  _strlwr(Str);
341  mapNumberAsStr = strtok(Str, "out");
342  mapNumberAsStr[2] = 0;
343  mapNumberAsInt = atoi(mapNumberAsStr);
344  if (a5 < 10 || this->level_filename.length() != 9 || mapNumberAsInt < 1 ||
345  mapNumberAsInt > 15) //длина .odm и количество локаций
346  return 0;
347  if (sPartyX < -22528) //граница карты
348  direction = 4;
349  else if (sPartyX > 22528)
350  direction = 3;
351  else if (sPartyZ < -22528)
352  direction = 2;
353  else if (sPartyZ > 22528)
354  direction = 1;
355  else
356  return false;
357 
358  if (mapNumberAsInt == MAP_AVLEE && direction == 4) { // to Shoals
359  if (pPlayers[1]->HasUnderwaterSuitEquipped() &&
360  pPlayers[2]->HasUnderwaterSuitEquipped() &&
361  pPlayers[3]->HasUnderwaterSuitEquipped() &&
362  pPlayers[4]->HasUnderwaterSuitEquipped()) {
364  strcpy(pOut, "out15.odm"); // Shoals
366  HEXRAYS_LOWORD(pParty->uFlags) &= 0xFD7Bu;
367  return true;
368  }
369  } else if (mapNumberAsInt == MAP_SHOALS && direction == 3) { // from Shoals
371  strcpy(pOut, "out14.odm"); // Avlee
373  HEXRAYS_LOWORD(pParty->uFlags) &= 0xFD7Bu;
374  return true;
375  }
376  destinationMap = foot_travel_destinations[mapNumberAsInt - 1][direction - 1];
377  if (destinationMap == MAP_INVALID)
378  return false;
379 
380  assert(destinationMap <= MAP_SHOALS);
381 
382  uDefaultTravelTime_ByFoot = foot_travel_times[mapNumberAsInt - 1][direction - 1];
383  uLevel_StartingPointType = foot_travel_arrival_points[mapNumberAsInt - 1][direction - 1];
384  sprintf(pOut, "out%02d.odm", destinationMap); //локация направления
385  return true;
386 }
387 
388 //----- (0048917E) --------------------------------------------------------
390  this->pSpriteIDs_LUN[0] = -1;
391  this->pSpriteIDs_LUN[1] = 0;
392  this->pSpriteIDs_LUN[2] = pSpriteFrameTable->FastFindSprite("LUN1-4");
393  this->pSpriteIDs_LUN[3] = 0;
394  this->pSpriteIDs_LUN[4] = pSpriteFrameTable->FastFindSprite("LUN1-2");
395  this->pSpriteIDs_LUN[5] = 0;
396  this->pSpriteIDs_LUN[6] = pSpriteFrameTable->FastFindSprite("LUN3-4");
397  this->pSpriteIDs_LUN[7] = 0;
402  this->field_D60 = -1;
403  this->field_CF0 = 4;
404  this->field_CF8 = 4;
405  this->field_D00 = 4;
406  this->field_CE8 = 0;
407  this->field_D3C = (int)this->pSpriteIDs_LUN;
408  this->field_D40 = 0;
409  this->field_D44 = 0;
410  this->field_D48 = 0;
411  this->field_D4C = 131072;
412  this->field_D5C = 0;
413  this->field_D64 = 0;
414  this->field_D28 = -1;
415  this->field_D08 = 0;
416  this->field_D0C = 0;
417  this->field_D10 = 0;
418  this->field_D24 = 0;
419  this->field_D2C = 0;
421  this->field_D14 = -131072;
422  for (uint i = 0; i < 8; i++)
424  this->pSpriteIDs_LUN[i]); // v2 += 2;
426 }
427 
428 //----- (004892E6) --------------------------------------------------------
430  unsigned int v3; // edi@3
431  double v8; // st7@4
432 
433  if (pParty->uCurrentHour >= 5 && pParty->uCurrentHour < 21) {
434  v3 = pParty->uCurrentMinute + 60 * (pParty->uCurrentHour - 5);
435  this->inv_sunlight_y = 0;
436  this->inv_sunlight_x =
437  stru_5C6E00->Cos((v3 * stru_5C6E00->uIntegerPi) / 960);
438  this->inv_sunlight_z =
439  stru_5C6E00->Sin((v3 * stru_5C6E00->uIntegerPi) / 960);
440  this->vSunlight.x = -this->inv_sunlight_x;
441  this->vSunlight.y = -this->inv_sunlight_y;
442  this->vSunlight.z = -this->inv_sunlight_z;
443  if (v3 >= 480)
444  v8 = 960 - v3;
445  else
446  v8 = v3;
447  this->max_terrain_dimming_level = (int)(20.0 - v8 / 480.0 * 20.0);
449  }
450 }
451 
452 //----- (004893C1) --------------------------------------------------------
455 }
456 
458  bool is_on_water = false;
459  int bmodel_standing_on_pid = 0;
460  ODM_GetFloorLevel(x, y, z, pParty->uDefaultPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0);
461  if (pParty->uFlags & 8 || bmodel_standing_on_pid || is_on_water) // на bmodel, и или на воде
462  return 2;
465  switch (pTileTable->pTiles[GetTileIdByTileMapId(v7)].tileset) {
466  case Tileset_Grass: // на траве
467  return 1;
468  case Tileset_Snow: // на снегу
469  return 3;
470  case Tilset_Desert: // на песке
471  return 5;
472  case Tileset_CooledLava:
473  case Tileset_Dirt: // на грязи
474  return 4;
475  case Tileset_Water: // on water (на воде)
476  return 3; // еденицы еды
477  default:
478  return 2;
479  }
480 }
481 
482 //----- (00489487) --------------------------------------------------------
485 
487  if (map_id == MAP_INVALID || map_id == MAP_CELESTIA ||
488  map_id == MAP_THE_PIT || map_id > MAP_SHOALS)
489  return;
490 
491  uint chance = rand() % 100;
492 
493  if (chance < fog_probability_table[map_id - 1].small_fog_chance) {
494  ::day_fogrange_1 = 4096;
495  ::day_fogrange_2 = 8192;
496  ::day_attrib |= DAY_ATTRIB_FOG;
497  } else if (chance <
498  fog_probability_table[map_id - 1].small_fog_chance +
499  fog_probability_table[map_id - 1].average_fog_chance) {
500  ::day_fogrange_2 = 4096;
501  ::day_fogrange_1 = 0;
502  ::day_attrib |= DAY_ATTRIB_FOG;
503  } else if (fog_probability_table[map_id - 1].dense_fog_chance &&
504  chance <
505  fog_probability_table[map_id - 1].small_fog_chance +
506  fog_probability_table[map_id - 1].average_fog_chance +
507  fog_probability_table[map_id - 1].dense_fog_chance) {
508  ::day_fogrange_2 = 2048;
509  ::day_fogrange_1 = 0;
510  ::day_attrib |= DAY_ATTRIB_FOG;
511  } else {
512  ::day_attrib &= ~DAY_ATTRIB_FOG;
513  }
514 
519 }
520 
521 //----- (00482170) --------------------------------------------------------
523  struct Polygon *polygon) {
524  unsigned int numOfVertices; // edx@1
525  RenderVertexSoft *currVertex; // ecx@2
526  double v7; // st7@5
527  double v8; // st6@5
528  double v9; // st5@5
529  float v18; // [sp+8h] [bp-38h]@5
530  float v19; // [sp+10h] [bp-30h]@5
531  float v20; // [sp+14h] [bp-2Ch]@5
532  float v21; // [sp+18h] [bp-28h]@5
533  float v22; // [sp+1Ch] [bp-24h]@5
534  float v23; // [sp+24h] [bp-1Ch]@5
535  float v24; // [sp+28h] [bp-18h]@5
536  float v25; // [sp+30h] [bp-10h]@5
537  float v26; // [sp+34h] [bp-Ch]@5
538  float v27; // [sp+38h] [bp-8h]@5
539  float v28; // [sp+3Ch] [bp-4h]@5
540  float a3a; // [sp+48h] [bp+8h]@5
541  float a3b; // [sp+48h] [bp+8h]@17
542  float a3c; // [sp+48h] [bp+8h]@17
543  float a3d; // [sp+48h] [bp+8h]@17
544  float a3e; // [sp+48h] [bp+8h]@17
545 
546  numOfVertices = polygon->uNumVertices;
547  if (numOfVertices < 3) return false;
548  currVertex = &a2[numOfVertices - 1];
549  if (a2->vWorldPosition.z == a2[1].vWorldPosition.z &&
550  a2[1].vWorldPosition.z == currVertex->vWorldPosition.z)
551  polygon->flags |= 0x10u;
552 
553  v28 = a2[1].vWorldPosition.x - a2->vWorldPosition.x;
554  v27 = a2[1].vWorldPosition.y - a2->vWorldPosition.y;
555  a3a = a2[1].vWorldPosition.z - a2->vWorldPosition.z;
556 
557  for (int i = 0; i < numOfVertices; i++) {
558  v7 = currVertex->vWorldPosition.x - a2->vWorldPosition.x;
559  v8 = currVertex->vWorldPosition.y - a2->vWorldPosition.y;
560  v9 = currVertex->vWorldPosition.z - a2->vWorldPosition.z;
561  v26 = v27 * v9 - v8 * a3a;
562  v24 = v7 * a3a - v9 * v28;
563  v25 = v8 * v28 - v7 * v27;
564  if (v24 != 0.0 || v25 != 0.0 || v26 != 0.0) break;
565  currVertex--;
566  }
567 
568  if (((double)pIndoorCameraD3D->vPartyPos.x - a2->vWorldPosition.x) * v26 +
569  ((double)pIndoorCameraD3D->vPartyPos.z - a2->vWorldPosition.z) *
570  v25 +
571  ((double)pIndoorCameraD3D->vPartyPos.y - a2->vWorldPosition.y) *
572  v24 >
573  0.0) {
574  v19 = a2[1].vWorldViewPosition.x - a2->vWorldViewPosition.x;
575  v18 = a2[1].vWorldViewPosition.y - a2->vWorldViewPosition.y;
576  v20 = a2[1].vWorldViewPosition.z - a2->vWorldViewPosition.z;
577  v21 = currVertex->vWorldViewPosition.x - a2->vWorldViewPosition.x;
578  v22 = currVertex->vWorldViewPosition.y - a2->vWorldViewPosition.y;
579  v23 = currVertex->vWorldViewPosition.z - a2->vWorldViewPosition.z;
580 
581  a3b = v23 * v18 - v22 * v20;
582  polygon->v_18.x = bankersRounding(a3b);
583  a3c = v21 * v20 - v23 * v19;
584  polygon->v_18.y = bankersRounding(a3c);
585  a3d = v22 * v19 - v21 * v18;
586  polygon->v_18.z = bankersRounding(a3d);
587  polygon->_normalize_v_18();
588  a3e = -((double)polygon->v_18.x * a2->vWorldViewPosition.x) -
589  (double)polygon->v_18.y * a2->vWorldViewPosition.y -
590  (double)polygon->v_18.z * a2->vWorldViewPosition.z;
591  polygon->field_24 = bankersRounding(a3e);
592  return true;
593  } else {
594  return false;
595  }
596 }
597 
598 //----- (0047C7A9) --------------------------------------------------------
600  this->field_10 = 0;
601  this->field_12 = 0;
602  this->field_16 = 0;
603  this->field_14 = 0;
604  this->field_1C = 0;
605  this->field_18 = 0;
606 }
607 
608 //----- (0047C7C2) --------------------------------------------------------
609 void OutdoorLocationTerrain::Release() { // очистить локацию
610  free(this->pHeightmap);
611  pHeightmap = nullptr;
612  free(pTilemap);
613  pTilemap = nullptr;
614  free(pAttributemap);
615  pAttributemap = nullptr;
616  free(pDmap);
617  pDmap = nullptr;
618 
619  _47C7A9();
620 }
621 
622 //----- (0047C80A) --------------------------------------------------------
623 void OutdoorLocationTerrain::FillDMap(int X, int Y, int W, int Z) {
624  double v6; // st7@1
625  double v7; // st7@2
626  double v8; // st7@2
627  int result; // eax@3
628  int v10; // eax@4
629  int v11; // ecx@5
630  int v12; // ecx@6
631  int v13; // edi@7
632  int v14; // edx@9
633  // int v15; // eax@15
634  unsigned __int8 *pMapHeight; // ebx@15
635  int v17; // eax@15
636  int v18; // ecx@15
637  int v19; // esi@15
638  int v20; // edi@15
639  int v21; // edx@15
640  int v22; // ecx@15
641  int v23; // ebx@15
642  int v24; // ecx@15
643  int v25; // ST28_4@15
644  double v26; // st7@15
645  double v27; // st6@15
646  double v28; // st5@15
647  double v29; // st7@15
648  double v30; // st7@16
649  double v31; // st7@17
650  int v32; // eax@21
651  double v33; // st7@21
652  double v34; // st6@21
653  double v35; // st5@21
654  double v36; // st7@21
655  double v37; // st7@22
656  double v38; // st7@23
657  int v39; // [sp+14h] [bp-34h]@8
658  int v40; // [sp+18h] [bp-30h]@15
659  int v41; // [sp+1Ch] [bp-2Ch]@15
660  int v42; // [sp+20h] [bp-28h]@15
661  int v44; // [sp+28h] [bp-20h]@21
662  float v45; // [sp+2Ch] [bp-1Ch]@1
663  float v46; // [sp+30h] [bp-18h]@1
664  float v47; // [sp+34h] [bp-14h]@1
665  // int v48; // [sp+38h] [bp-10h]@7
666  int v49; // [sp+3Ch] [bp-Ch]@10
667  int v50; // [sp+40h] [bp-8h]@9
668  float v51; // [sp+44h] [bp-4h]@15
669  float v52; // [sp+44h] [bp-4h]@21
670  float v53; // [sp+50h] [bp+8h]@15
671  float v54; // [sp+50h] [bp+8h]@21
672  // int v55; // [sp+54h] [bp+Ch]@15
673  float v56; // [sp+54h] [bp+Ch]@15
674  float v57; // [sp+54h] [bp+Ch]@21
675 
676  v46 = -64.0;
677  v47 = -64.0;
678  v45 = 64.0;
679  v6 = sqrt(12288.0);
680  if (v6 != 0.0) {
681  v7 = 1.0 / v6;
682  v45 = 64.0 * v7;
683  v8 = v7 * -64.0;
684  v46 = v8;
685  v47 = v8;
686  }
687  result = Y;
688  if (Y > Z) {
689  v10 = Z ^ Y;
690  Z ^= Y ^ Z;
691  result = Z ^ v10;
692  }
693  v11 = X;
694  if (X > W) {
695  v12 = W ^ X;
696  W ^= X ^ W;
697  v11 = W ^ v12;
698  }
699  // v48 = result - 1;
700  if (result - 1 <= Z) {
701  v39 = v11 - 1;
702  for (v13 = result - 1; v13 <= Z; v13++) {
703  v50 = v39;
704  if (v39 <= W) {
705  result = (v39 - 63) << 9;
706  v49 = (v39 - 63) << 9;
707  for (v14 = v39; v14 <= W; v14++) {
708  if (v13 >= 0 && result >= -32256 && v13 <= 127 &&
709  result <= 32768) {
710  // v15 = pOutLocTerrain->field_10;
711  // v55 = pOutLocTerrain->field_10;
712  pMapHeight = this->pHeightmap;
713  v17 = (int)(&pMapHeight[v13 * this->field_10] + v14);
714  v18 = -v13;
715  v19 = (64 - v13) << 9;
716  v20 = 32 * *(char *)v17;
717  v21 = 32 * *(char *)(v17 + 1);
718 
719  v22 = (v18 + 63) << 9;
720  v41 = v22;
721  v23 = (int)(&pMapHeight[this->field_10 * (v13 + 1)] +
722  v14);
723  v24 = v22 - v19;
724  v40 = 32 * *(char *)v23;
725  v42 = 32 * *(char *)(v23 + 1);
726 
727  v25 = v49 - 512 - v49;
728  v26 = (double)-((v20 - v21) * v24);
729  v51 = v26;
730  v27 = (double)-(v25 * (v42 - v21));
731  v53 = v27;
732  v28 = (double)(v25 * v24);
733  v56 = v28;
734  v29 = sqrt(v28 * v28 + v27 * v27 + v26 * v26);
735  if (v29 != 0.0) {
736  v30 = 1.0 / v29;
737  v51 = v51 * v30;
738  v53 = v53 * v30;
739  v56 = v30 * v56;
740  }
741  v31 = (v56 * v47 + v53 * v46 + v51 * v45) * 31.0;
742  if (v31 < 0.0) v31 = 0.0;
743  if (v31 > 31.0) v31 = 31.0;
744  v44 = 2 * (v14 + v13 * this->field_10);
745  // pOutLocTerrain = pOutLocTerrain2;
746  *((char *)this->pDmap + v44 + 1) = (signed __int64)v31;
747 
748  v32 = v49 - (v49 - 512);
749  v33 = (double)-((v42 - v40) * (v19 - v41));
750  v52 = v33;
751  v34 = (double)-(v32 * (v20 - v40));
752  v54 = v34;
753  v35 = (double)(v32 * (v19 - v41));
754  v57 = v35;
755  v36 = sqrt(v35 * v35 + v34 * v34 + v33 * v33);
756  if (v36 != 0.0) {
757  v37 = 1.0 / v36;
758  v52 = v52 * v37;
759  v54 = v54 * v37;
760  v57 = v37 * v57;
761  }
762  v38 = (v57 * v47 + v54 * v46 + v52 * v45) * 31.0;
763  if (v38 < 0.0) v38 = 0.0;
764  if (v38 > 31.0) v38 = 31.0;
765  // v13 = v48;
766  *((char *)this->pDmap + v44) = (signed __int64)v38;
767  // v14 = v50;
768  result = v49;
769  }
770  // ++v14;
771  result += 512;
772  // v50 = v14;
773  v49 = result;
774  }
775  }
776  // ++v13;
777  // v48 = v13;
778  }
779  // while ( v13 <= Z );
780  }
781 }
782 
783 //----- (0047CB57) --------------------------------------------------------
784 int OutdoorLocationTerrain::_47CB57(unsigned char *pixels_8bit, int a2,
785  int num_pixels) {
786  int result; // eax@2
787  // unsigned __int16 *v5; // edx@3
788  // double v6; // st7@3
789  // int v8; // eax@3
790  // int v9; // eax@4
791  // int v10; // eax@5
792  // double v11; // st6@7
793  // signed int v12; // edi@7
794  // int v13; // esi@9
795  // char *v14; // esi@10
796  // signed int v15; // ecx@10
797  // char v16[256]; // [sp+4h] [bp-124h]@9
798  // unsigned __int16 *v17; // [sp+104h] [bp-24h]@3
799  // float v22; // [sp+118h] [bp-10h]@3
800  // float v23; // [sp+11Ch] [bp-Ch]@3
801  // int i; // [sp+120h] [bp-8h]@3
802  // unsigned int v25; // [sp+124h] [bp-4h]@5
803  // signed int a2a; // [sp+134h] [bp+Ch]@3
804  // unsigned int a2b; // [sp+134h] [bp+Ch]@7
805  // float a3a; // [sp+138h] [bp+10h]@7
806  // int a3b; // [sp+138h] [bp+10h]@9
807 
808  int num_r_bits = 5;
809  int num_g_bits = 6;
810  int num_b_bits = 5;
811 
812  int r_mask = 0xF800;
813  int g_mask = 0x7E0;
814  int b_mask = 0x1F;
815 
816  // if ( render->pRenderD3D )
817  result = 0;
818  /*else
819  {
820  __debugbreak();
821  v5 = PaletteManager::Get_Dark_or_Red_LUT(a2, 0, 1);
822  v6 = 0.0;
823  v22 = 0.0;
824  v8 = 0;
825  v17 = v5;
826  v23 = 0.0;
827  a2a = 0;
828  for ( i = 0; i < num_pixels; ++i )
829  {
830  v9 = *(char *)(v8 + pixels_8bit);
831  if ( v9 )
832  {
833  v10 = v5[v9];
834  v6 = v6 + (double)((signed int)(r_mask & v10) >> (num_b_bits +
835  num_g_bits));
836  ++a2a;
837  v25 = b_mask & v10;
838  v22 = (double)((signed int)(g_mask & v10) >> num_b_bits) + v22;
839  v23 = (double)(signed int)(b_mask & v10) + v23;
840  }
841  v8 = i + 1;
842  }
843  v11 = 1.0 / (double)a2a;
844  a3a = v11;
845  v25 = (signed __int64)(a3a * v22);
846  i = (signed __int64)(a3a * v23);
847  v12 = 0;
848  a2b = num_b_bits + num_g_bits;
849  while ( 1 )
850  {
851  v13 = v17[v12];
852  a3b = abs((__int64)(signed __int64)(v11 * v6) - ((signed int)(r_mask &
853  v17[v12]) >> a2b)); BYTE3(a3b) = abs((signed)v25 - ((signed int)(g_mask &
854  v13) >> num_b_bits)) + a3b; v16[v12++] = abs((signed)i - (signed)(b_mask &
855  v13)) + BYTE3(a3b); if ( v12 >= 256 ) break;
856  }
857  result = 0;
858  v14 = (char *)&pPaletteManager->field_D1600[42][23][116];
859  v15 = 0;
860  do
861  {
862  if ( (unsigned __int8)v16[v15] < (signed int)v14 )
863  {
864  v14 = (char *)(unsigned __int8)v16[v15];
865  result = v15;
866  }
867  ++v15;
868  }
869  while ( v15 < 256 );
870  }*/
871  return result;
872 }
873 
874 //----- (0047CCE2) --------------------------------------------------------
876  memset(this->pHeightmap, 0, 0x4000u);
877  memset(this->pTilemap, 90, 0x4000u);
878  memset(this->pAttributemap, 0, 0x4000u);
879  memset(this->pDmap, 0, 0x8000u);
880  this->field_12 = 128;
881  this->field_10 = 128;
882  this->field_16 = 7;
883  this->field_14 = 7;
884  this->field_1C = 127;
885  this->field_18 = 127;
886  return true;
887 }
888 
889 //----- (0047CD44) --------------------------------------------------------
891  pHeightmap = (unsigned __int8 *)malloc(0x4000); // height map
892  pTilemap = (unsigned __int8 *)malloc(0x4000); // tile map
893  pAttributemap = (unsigned __int8 *)malloc(0x4000); //карта атрибутов
894  pDmap = (struct DMap *)malloc(0x8000);
895  if (pHeightmap && pTilemap && pAttributemap && pDmap)
896  return true;
897  else
898  return false;
899 }
900 
901 //----- (0047CDE2) --------------------------------------------------------
903  this->level_filename = "blank";
904  this->location_filename = "i6.odm";
905  this->location_file_description = "MM6 Outdoor v1.00";
906 
907  this->pTileTypes[0].tileset = Tileset_Grass;
908  this->pTileTypes[1].tileset = Tileset_Water;
911  this->LoadTileGroupIds();
912  this->LoadRoadTileset();
913  free(this->pSpawnPoints);
914  this->pSpawnPoints = 0;
915  this->pTerrain.Initialize();
916  this->pTerrain.ZeroLandscape();
917  this->pTerrain.FillDMap(0, 0, 128, 128);
918 
919  free(this->pCmap);
920  this->pCmap = malloc(0x8000);
921 
922  free(this->pOMAP);
923  this->pOMAP = (unsigned int *)malloc(0x10000);
924  if (this->pOMAP == nullptr) {
925  log->Warning(L"Malloc error - pOMAP");
926  __debugbreak();
927  } else {
928  memset(this->pOMAP, 0, 0x10000);
929  }
930 
931  this->numFaceIDListElems = 0;
932 
933  free(this->pFaceIDLIST);
934  this->pFaceIDLIST = (unsigned __int16 *)malloc(2);
935  if (this->pFaceIDLIST == nullptr) {
936  logger->Warning(L"Malloc fail - pfaceidlist");
937  __debugbreak();
938  } else {
939  this->pFaceIDLIST[0] = 0;
940  }
941 
944 
946  // this->sMainTile_BitmapID =
947  // pBitmaps_LOD->LoadTexture(this->ground_tileset.c_str());
949 }
950 
951 //----- (0047CF9C) --------------------------------------------------------
953  this->level_filename = "blank";
954  this->location_filename = "default.odm";
955  this->location_file_description = "MM6 Outdoor v1.00";
956  this->sky_texture_filename = "sky043";
957  this->ground_tileset = "hm005";
958 
959  while (!pBModels.empty()) {
960  pBModels.back().Release();
961  pBModels.pop_back();
962  }
963 
964  free(pSpawnPoints);
965  pSpawnPoints = nullptr;
966  uNumSpawnPoints = 0;
967 
968  pTerrain.Release();
969 
970  free(pCmap);
971  pCmap = nullptr;
972  free(pOMAP);
973  pOMAP = nullptr;
974  free(pFaceIDLIST);
975  pFaceIDLIST = nullptr;
976  free(pTerrainNormals);
977  pTerrainNormals = nullptr;
978 }
979 
980 bool OutdoorLocation::Load(const String &filename, int days_played,
981  int respawn_interval_days, int *thisa) {
982  if (engine->IsUnderwater()) {
986  pPaletteManager->SetMistColor(37, 143, 92);
987  } else {
991  if (pPaletteManager->pPalette_mistColor[0] != 0x80 ||
992  pPaletteManager->pPalette_mistColor[1] != 0x80 ||
993  pPaletteManager->pPalette_mistColor[2] != 0x80) {
994  pPaletteManager->SetMistColor(128, 128, 128);
996  }
997  }
998 
1000 
1001  assert(sizeof(BSPModelData) == 188);
1002 
1003  if (!pGames_LOD->DoesContainerExist(filename)) {
1004  Error("Unable to find %s in Games.LOD", filename.c_str());
1005  }
1006 
1007  String minimap_filename = filename.substr(0, filename.length() - 4);
1008  viewparams->location_minimap = assets->GetImage_Solid(minimap_filename);
1009 
1010  auto odm_filename = String(filename);
1011  odm_filename.replace(odm_filename.length() - 4, 4, ".odm");
1012 
1013  void *pSrcMem = pGames_LOD->LoadCompressed(odm_filename);
1014  uint8_t *pSrc = (uint8_t*)pSrcMem;
1015 
1016 #pragma pack(push, 1)
1017  struct ODMInfo {
1018  char level_filename[32];
1019  char location_filename[32];
1020  char location_file_description[32];
1021  char sky_texture_filename[32];
1022  char ground_tileset[32];
1023  };
1024 #pragma pack(pop)
1025 
1026  static_assert(sizeof(ODMInfo) == 160, "Wrong type size");
1027  ODMInfo *odm_info = (ODMInfo*)pSrc;
1028  this->level_filename = String(odm_info->level_filename, 32);
1029  this->location_filename = String(odm_info->level_filename, 32);
1030  this->location_file_description = String(odm_info->location_file_description, 32);
1031  this->sky_texture_filename = String(odm_info->sky_texture_filename, 32);
1032  this->ground_tileset = String(odm_info->ground_tileset, 32);
1033  pSrc += sizeof(ODMInfo);
1034 
1035  static_assert(sizeof(OutdoorLocationTileType) == 4, "Wrong type size");
1036  memcpy(pTileTypes, pSrc, sizeof(pTileTypes));
1037  pSrc += sizeof(pTileTypes);
1038 
1039  LoadTileGroupIds();
1040  LoadRoadTileset();
1041  this->ground_tileset = "grastyl";
1042 
1043  pGameLoadingUI_ProgressBar->Progress(); // прогресс загрузки
1044 
1045  // *******************Terrain**************************//
1046  pTerrain.Initialize();
1047  memcpy(pTerrain.pHeightmap, pSrc, 0x4000); // карта высот
1048  pSrc += 0x4000;
1049 
1050  memcpy(pTerrain.pTilemap, pSrc, 0x4000); // карта тайлов
1051  pSrc += 0x4000;
1052 
1053  memcpy(pTerrain.pAttributemap, pSrc, 0x4000); // карта аттрибутов
1054  pSrc += 0x4000;
1055 
1056  // v43 = (char *)v43 + 16384;
1057  // v108 = (int)ptr_D4;
1058  free(pCmap);
1059  pCmap = malloc(0x8000);
1060  pTerrain.FillDMap(0, 0, 128, 128); //
1061 
1062  pGameLoadingUI_ProgressBar->Progress(); // прогресс загрузки
1063 
1064  memcpy(&uNumTerrainNormals, pSrc, 4); // количество нормалей
1065  pSrc += 4;
1066  memcpy(pTerrainSomeOtherData.data(), pSrc, 0x20000);
1067  pSrc += 0x20000;
1068 
1069  memcpy(pTerrainNormalIndices.data(), pSrc, 0x10000); //индексы нормалей
1070  pSrc += 0x10000;
1071 
1072  pTerrainNormals = (Vec3_float_ *)malloc(
1073  sizeof(Vec3_float_) * uNumTerrainNormals); //карта нормалей
1074  memcpy(pTerrainNormals, pSrc, 12 * uNumTerrainNormals);
1075  pSrc += 12 * uNumTerrainNormals;
1076 
1077  pGameLoadingUI_ProgressBar->Progress(); // прогресс загрузки
1078 
1079  // ************BModels************************//
1080  pSrc = pBModels.Load(pSrc);
1081  pGameLoadingUI_ProgressBar->Progress(); // прогресс загрузки
1082 
1083  // ******************Decorations**********************//
1084  memcpy(&uNumLevelDecorations, pSrc, 4);
1085  // uSourceLen = (char *)uSourceLen + 4;
1086  if (uNumLevelDecorations > 3000) logger->Warning(L"Can't load file! Too many decorations");
1087 
1088  assert(sizeof(LevelDecoration) == 32);
1089  // pFilename = (char *)(32 * uNumLevelDecorations);
1090  memcpy(pLevelDecorations.data(), pSrc + 4,
1092  pSrc += 4 + sizeof(LevelDecoration) * uNumLevelDecorations;
1093 
1095 
1096  // v151 = 0;
1097  // uSourceLen = (char *)uSourceLen + (int)pFilename;
1098  for (uint i = 0; i < uNumLevelDecorations; ++i) {
1099  char name[256];
1100  memcpy(name, pSrc, sizeof(LevelDecoration));
1101  pSrc += sizeof(LevelDecoration);
1102  pLevelDecorations[i].uDecorationDescID =
1104  }
1105 
1106  pGameLoadingUI_ProgressBar->Progress(); // прогресс загрузки
1107 
1108  memcpy(&numFaceIDListElems, pSrc, 4);
1109 
1110  // uSourceLen = (char *)uSourceLen + 4;
1111  // v108 = (int)pFaceIDLIST;
1112  free(pFaceIDLIST);
1113  pFaceIDLIST = nullptr;
1114 
1115  uint faceIDListSize = 2 * numFaceIDListElems;
1116  pFaceIDLIST = (unsigned short *)malloc(faceIDListSize);
1117 
1118  memcpy(pFaceIDLIST, pSrc + 4, faceIDListSize);
1119  pSrc += 4 + faceIDListSize;
1120 
1121  // uSourceLen = (char *)uSourceLen + (int)pFilename;
1122  pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
1123 
1124  free(pOMAP);
1125  // v69 = malloc(0, 0x10000u, "OMAP");
1126  pOMAP = (unsigned int *)malloc(0x10000);
1127  // v108 = 65536;
1128  // pOMAP = (unsigned int *)v69;
1129  memcpy(pOMAP, pSrc, 65536);
1130  pSrc += 65536;
1131 
1132  // uSourceLen = (char *)uSourceLen + 65536;
1134 
1135  memcpy(&uNumSpawnPoints, pSrc, 4);
1136  // uSourceLen = (char *)uSourceLen + 4;
1137  pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
1138 
1139  assert(sizeof(SpawnPointMM7) == 24);
1140  uint spawnPointsSize = uNumSpawnPoints * sizeof(SpawnPointMM7);
1141  pSpawnPoints = (SpawnPointMM7 *)malloc(spawnPointsSize);
1142  // v72 = uNumSpawnPoints;
1143  // pSpawnPoints = v71;
1144  memcpy(pSpawnPoints, pSrc + 4, spawnPointsSize);
1145  pSrc += 4 + spawnPointsSize;
1146 
1147  pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
1148 
1149  // ****************.ddm file*********************//
1150  free(pSrcMem);
1151 
1152  auto ddm_filename = filename;
1153  ddm_filename = ddm_filename.replace(ddm_filename.length() - 4, 4, ".ddm");
1154  pSrcMem = pNew_LOD->LoadCompressed(ddm_filename);
1155 
1156  if (pSrcMem != nullptr) {
1157  pSrc = (uint8_t*)pSrcMem;
1158 
1159  static_assert(sizeof(DDM_DLV_Header) == 40, "Wrong type size");
1160  memcpy(&ddm, pSrc, sizeof(DDM_DLV_Header));
1161  pSrc += sizeof(DDM_DLV_Header);
1162  }
1163  uint actualNumFacesInLevel = 0;
1164  for (BSPModel &model : pBModels) {
1165  actualNumFacesInLevel += model.pFaces.size();
1166  }
1167 
1168  bool Str2 = false;
1169  if (ddm.uNumFacesInBModels) {
1170  if (ddm.uNumBModels) {
1171  if (ddm.uNumDecorations) {
1172  if (ddm.uNumFacesInBModels != actualNumFacesInLevel ||
1173  ddm.uNumBModels != pBModels.size() ||
1175  Str2 = true;
1176  }
1177  }
1178  }
1179 
1180  if (dword_6BE364_game_settings_1 & GAME_SETTINGS_2000) {
1181  respawn_interval_days = 0x1BAF800;
1182  }
1183 
1184  char Src[968];
1185  char Dst[968];
1186  int v108;
1187 
1188  if (Str2 || days_played - ddm.uLastRepawnDay >= respawn_interval_days ||
1189  !ddm.uLastRepawnDay) {
1190  if (Str2) {
1191  memset(Dst, 0, 968);
1192  memset(Src, 0, 968);
1193  }
1194  if (days_played - ddm.uLastRepawnDay >= respawn_interval_days ||
1195  !ddm.uLastRepawnDay) {
1196  memcpy(Dst, pSrc, 968);
1197  memcpy(Src, pSrc + 968, 968);
1198  }
1199  free(pSrcMem);
1200 
1201  ddm.uLastRepawnDay = days_played;
1202  if (Str2 == 0) ++ddm.uNumRespawns;
1203  v108 = 0;
1204  *thisa = 1;
1205  pSrcMem = pGames_LOD->LoadCompressed(ddm_filename);
1206  pSrc = (uint8_t*)pSrcMem;
1207  pSrc += sizeof(DDM_DLV_Header);
1208  } else {
1209  *thisa = 0;
1210  }
1211  memcpy(uFullyRevealedCellOnMap, pSrc, 968);
1212  memcpy(uPartiallyRevealedCellOnMap, pSrc + 968, 968);
1213  pSrc += 2 * 968;
1214 
1215  pGameLoadingUI_ProgressBar->Progress(); // прогресс загрузки
1216 
1217  if (*thisa) {
1218  memcpy(uFullyRevealedCellOnMap, Dst, 968);
1219  memcpy(uPartiallyRevealedCellOnMap, Src, 968);
1220  }
1221 
1222  for (BSPModel &model : pBModels) {
1223  for (ODMFace &face : model.pFaces) {
1224  memcpy(&face.uAttributes, pSrc, 4);
1225  pSrc += 4;
1226  }
1227 
1228  for (ODMFace &face : model.pFaces) {
1229  if (face.sCogTriggeredID) {
1230  if (face.HasEventHint()) {
1231  face.uAttributes |= FACE_HAS_EVENT_HINT;
1232  } else {
1233  face.uAttributes &= ~FACE_HAS_EVENT_HINT; // ~0x00001000
1234  }
1235  }
1236  }
1237  }
1238 
1239  pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
1240 
1241  for (uint i = 0; i < uNumLevelDecorations; ++i) {
1242  memcpy(&pLevelDecorations[i].uFlags, pSrc, 2);
1243  pSrc += 2;
1244  }
1245 
1246  pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
1247 
1248  memcpy(&uNumActors, pSrc, 4);
1249  if (uNumActors > 500) logger->Warning(L"Can't load file!");
1250 
1251  pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
1252 
1253  assert(sizeof(Actor) == 836);
1254  // pFilename = (char *)(836 * uNumActors);
1255  memcpy(pActors.data(), pSrc + 4, uNumActors * sizeof(Actor));
1256  pSrc += 4 + uNumActors * sizeof(Actor);
1257  // v92 = (char *)v91 + (int)pFilename;
1258  pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
1259 
1260  memcpy(&uNumSpriteObjects, pSrc, 4);
1261  assert(uNumSpriteObjects <= 1000 && "Too many objects");
1262  assert(sizeof(SpriteObject) == 112);
1263 
1264  pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
1265 
1266  // pFilename = (char *)(112 * uNumSpriteObjects);
1267  memcpy(pSpriteObjects.data(), pSrc + 4,
1268  uNumSpriteObjects * sizeof(SpriteObject));
1269  pSrc += 4 + uNumSpriteObjects * sizeof(SpriteObject);
1270 
1271  // v94 = (char *)v93 + (int)pFilename;
1272  pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
1273 
1274  pSrc = (uint8_t*)ChestsDeserialize((char*)pSrc);
1275 
1276  pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
1277 
1278  memcpy(&stru_5E4C90_MapPersistVars, pSrc, 0xC8);
1279  pSrc += 0xC8;
1280 
1281  pGameLoadingUI_ProgressBar->Progress(); //прогресс загрузки
1282  memcpy(&loc_time, pSrc, 0x38u);
1283 
1284  free(pSrcMem);
1285 
1293  TileDesc *v98 = pTileTable->GetTileById(pTileTypes[0].uTileID);
1294 
1295  main_tile_texture = v98->GetTexture();
1296  // sMainTile_BitmapID = pBitmaps_LOD->LoadTexture(v98->pTileName,
1297  // TEXTURE_DEFAULT); if (sMainTile_BitmapID != -1)
1298  // pBitmaps_LOD->pTextures[sMainTile_BitmapID].palette_id2 =
1299  // pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[sMainTile_BitmapID].palette_id1);
1300 
1301  _47F0E2();
1302 
1303  // LABEL_150:
1304  if (pWeather->bRenderSnow) { // Ritor1: it's include for snow
1305  strcpy(loc_time.sky_texture_name, "sky19");
1306  } else if (loc_time.last_visit) {
1308  if (rand() % 100 >= 20)
1309  v108 = dword_4EC268[rand() % dword_4EC2A8];
1310  else
1311  v108 = dword_4EC28C[rand() % dword_4EC2AC];
1312  sprintf(loc_time.sky_texture_name, "plansky%d", v108);
1313  }
1314  } else {
1315  strcpy(loc_time.sky_texture_name, "plansky3");
1316  }
1317 
1319 
1321  // pSoundList->LoadSound(SOUND_RunDirt, 0); //For Dirt
1322  // tyle(для звука хождения по грязи)
1323  // pSoundList->LoadSound(SOUND_WalkDirt, 0); //для
1324  // бега
1325  // pSoundList->LoadSound(SOUND_RunRoad, 0); //для звука
1326  // хождения по дороге pSoundList->LoadSound(SOUND_WalkRoad, 0);
1327  // pSoundList->LoadSound(SOUND_RunWood, 0); //для звука
1328  // хождения по дереву pSoundList->LoadSound(SOUND_WalkWood, 0);
1329  for (int i = 0; i < 3; ++i) {
1330  switch (pTileTypes[i].tileset) {
1331  case Tileset_Grass:
1332  // pSoundList->LoadSound(SOUND_RunGrass, 0); //для
1333  // звука хождения по траве
1334  // pSoundList->LoadSound(SOUND_WalkGrass, 0);
1335  break;
1336  case Tileset_Snow:
1337  // pSoundList->LoadSound(SOUND_RunSnow, 0); //по
1338  // снегу pSoundList->LoadSound(SOUND_WalkSnow, 0);
1339  break;
1340  case Tilset_Desert:
1341  // pSoundList->LoadSound(SOUND_RunDesert, 0); //по
1342  // пустыне pSoundList->LoadSound(SOUND_WalkDesert,
1343  // 0);
1344  break;
1345  case Tileset_CooledLava:
1346  // pSoundList->LoadSound(SOUND_RunCooledLava, 0);//по
1347  // лаве pSoundList->LoadSound(SOUND_WalkCooledLava,
1348  // 0);
1349  break;
1350  case Tileset_Water:
1351  // pSoundList->LoadSound(SOUND_RunWater, 0); //по
1352  // воде pSoundList->LoadSound(SOUND_WalkWater, 0);
1353  break;
1354  case Tileset_Badlands:
1355  // pSoundList->LoadSound(SOUND_RunBadlands, 0);
1356  // //для звука ходьбы по бесплодным землям
1357  // pSoundList->LoadSound(SOUND_WalkBadlands, 0);
1358  break;
1359  case Tileset_Swamp:
1360  // pSoundList->LoadSound(SOUND_RunSwamp, 0); //по
1361  // болоту pSoundList->LoadSound(SOUND_WalkSwamp, 0);
1362  break;
1363  }
1364  }
1365  return true;
1366 }
1367 
1369  int result; // eax@2
1370  int v3; // eax@3
1371 
1372  if (a2 >= 90) {
1373  v3 = (a2 - 90) / 36;
1374  if (v3 && v3 != 1 && v3 != 2) {
1375  if (v3 == Tileset_CooledLava)
1376  result = this->pTileTypes[3].uTileID;
1377  else
1378  result = a2;
1379  } else {
1380  result = this->pTileTypes[v3].uTileID;
1381  }
1382  } else {
1383  result = 0;
1384  }
1385  return result;
1386 }
1387 
1388 //----- (0047ED08) --------------------------------------------------------
1390  int v3; // esi@5
1391  // unsigned int result; // eax@9
1392 
1393  if (sX < 0 || sX > 127 || sY < 0 || sY > 127)
1394  return 0;
1395 
1396  v3 = this->pTerrain.pTilemap[sY * 128 + sX];
1397  if (v3 < 198) { // < Tileset_3
1398  if (v3 >= 90)
1399  v3 = v3 + this->pTileTypes[(v3 - 90) / 36].uTileID -
1400  36 * ((v3 - 90) / 36) - 90;
1401  } else {
1402  v3 = v3 + this->pTileTypes[3].uTileID - 198;
1403  }
1404 
1405  if (engine->config->seasons_change) {
1406  switch (pParty->uCurrentMonth) {
1407  case 11:
1408  case 0:
1409  case 1: // winter
1410  if (v3 >= 90) { // Tileset_Grass begins at TileID = 90
1411  if (v3 <= 95) // some grastyl entries
1412  v3 = 348;
1413  else if (v3 <= 113) // rest of grastyl & all grdrt*
1414  v3 = 348 + (v3 - 96);
1415  }
1416  /*switch (v3)
1417  {
1418  case 102: v3 = 354; break; // grdrtNE -> SNdrtne
1419  case 104: v3 = 356; break; // grdrtNW -> SNdrtnw
1420  case 108: v3 = 360; break; // grdrtN -> SNdrtn
1421  }*/
1422  break;
1423 
1424  case 2:
1425  case 3:
1426  case 4: // spring
1427  case 8:
1428  case 9:
1429  case 10: // autumn
1430  if (v3 >= 90 &&
1431  v3 <= 113) // just convert all Tileset_Grass to dirt
1432  v3 = 1;
1433  break;
1434 
1435  case 5:
1436  case 6:
1437  case 7: // summer
1438  // all tiles are green grass by default
1439  break;
1440 
1441  default:
1442  assert(pParty->uCurrentMonth >= 0 &&
1443  pParty->uCurrentMonth < 12);
1444  }
1445  }
1446 
1447  return &pTileTable->pTiles[v3];
1448 }
1449 
1450 //----- (0047ED83) --------------------------------------------------------
1451 int OutdoorLocation::_47ED83(signed int a2, signed int a3) {
1452  if (a2 < 0 || a2 > 127 || a3 < 0 || a3 > 127)
1453  return 0;
1454 
1455  return *(&this->pTerrain.pTilemap[128 * a3] + a2);
1456 }
1457 
1458 //----- (0047EDB3) --------------------------------------------------------
1460  signed int sY) {
1461  int v3; // esi@5
1462 
1463  if (sX < 0 || sX > 127 || sY < 0 || sY > 127)
1464  return 0;
1465 
1466  v3 = this->pTerrain.pTilemap[sY * 128 + sX];
1467  if (v3 >= 90)
1468  v3 = v3 + this->pTileTypes[(v3 - 90) / 36].uTileID -
1469  36 * ((v3 - 90) / 36) - 90;
1470  return pTileTable->pTiles[v3].uAttributes;
1471 }
1472 
1473 //----- (0047EE16) --------------------------------------------------------
1474 int OutdoorLocation::DoGetHeightOnTerrain(signed int sX, signed int sZ) {
1475  if (sX < 0 || sX > 127 || sZ < 0 || sZ > 127)
1476  return 0;
1477 
1478  return 32 * pTerrain.pHeightmap[sZ * 128 + sX];
1479 }
1480 
1481 //----- (0047EE49) --------------------------------------------------------
1482 int OutdoorLocation::GetSoundIdByPosition(signed int X_pos, signed int Y_pos,
1483  int running) {
1484  signed int v4; // eax@5
1485  signed int v5; // eax@7
1486  // int v6; // eax@8
1487  signed int v8; // eax@9
1488  int modif = 0;
1489 
1490  if (X_pos < 0 || X_pos > 127 || Y_pos < 0 || Y_pos > 127)
1491  v4 = 0;
1492  else
1493  v4 = this->pTerrain.pTilemap[128 * Y_pos + X_pos];
1494  v5 = GetTileIdByTileMapId(v4);
1495  if (running) modif = -39;
1496  if (!v5) return 92 + modif;
1497 
1498  switch (pTileTable->pTiles[v5].tileset) {
1499  case 0:
1500  return 93 + modif;
1501  case 1:
1502  return 97 + modif;
1503  case 2:
1504  return 91 + modif;
1505  case 3:
1506  return 90 + modif;
1507  case 4:
1508  return 101 + modif;
1509  case 5:
1510  return 95 + modif;
1511  case 6:
1512  return 88 + modif;
1513  case 7:
1514  return 100 + modif;
1515  case 8:
1516  return 93 + modif;
1517  default:
1518  v8 = pTileTable->pTiles[v5].tileset;
1519  if ((v8 > 9 && v8 <= 17) || (v8 > 21 && v8 <= 27))
1520  return 96 + modif;
1521  else
1522  return 95 + modif;
1523  }
1524 }
1525 
1526 //----- (0047EF60) --------------------------------------------------------
1527 int OutdoorLocation::UpdateDiscoveredArea(int X_grid_pos, int Y_grid_poa,
1528  int a4) {
1529  for (int i = -10; i < 10; i++) {
1530  int currYpos = Y_grid_poa + i - 20;
1531  for (int j = -10; j < 10; j++) {
1532  int currXpos = X_grid_pos + j - 20;
1533  int distanceSquared = i * i + j * j;
1534  if (distanceSquared <= 100 && currYpos >= 0 && currYpos <= 87 &&
1535  currXpos >= 0 && currXpos <= 87) {
1536  unsigned char v13 = 1 << (7 - currXpos % 8);
1537  this->uPartiallyRevealedCellOnMap[currYpos][currXpos / 8] |=
1538  v13;
1539  if (distanceSquared <= 49)
1540  this->uFullyRevealedCellOnMap[currYpos][currXpos / 8] |=
1541  v13;
1542  }
1543  }
1544  }
1545  return 1;
1546 }
1547 
1548 //----- (0047F04C) --------------------------------------------------------
1550  signed int y_pos) {
1551  if (x_pos < 0 || x_pos >= 88 || y_pos < 0 || y_pos >= 88)
1552  return false;
1553  else
1554  return (uFullyRevealedCellOnMap[y_pos][x_pos / 8] &
1555  (1 << (7 - (x_pos) % 8))) != 0;
1556 }
1557 
1558 //----- (0047F097) --------------------------------------------------------
1560  signed int y_pos) {
1561  if (x_pos < 0 || x_pos >= 88 || y_pos < 0 || y_pos >= 88)
1562  return false;
1563  else
1564  return (uPartiallyRevealedCellOnMap[y_pos][x_pos / 8] &
1565  (1 << (7 - (x_pos) % 8))) != 0;
1566 }
1567 
1568 //----- (0047F0E2) --------------------------------------------------------
1570  for (uint i = 0; i < (signed int)pBitmaps_LOD->uNumLoadedFiles; ++i) {
1571  // if ( i != -1 ? (int)&pBitmaps_LOD->pTextures[i] : 0 )
1573  this->pTerrain._47CB57(
1578  }
1579  return 1;
1580 }
1581 
1582 //----- (0047F138) --------------------------------------------------------
1584  int v1 = 0;
1585  int v8 = 0;
1586  if (pCurrentMapName == "out09.odm") {
1587  v8 = 1;
1588  }
1589 
1590  for (uint i = 0; i < uNumLevelDecorations; ++i) {
1591  LevelDecoration *decor = &pLevelDecorations[i];
1592 
1595  if (decoration->uSoundID && _6807E0_num_decorations_with_sounds_6807B8 < 9) {
1596  // pSoundList->LoadSound(decoration.uSoundID, 0);
1598  }
1599  if (v8 && decor->uCog == 20)
1601  if (!decor->uEventID) {
1602  if (decor->IsInteractive()) {
1603  if (v1 < 124) {
1604  decor->_idx_in_stru123 = v1 + 75;
1607  }
1608  }
1609  }
1610  }
1611 
1613  return true;
1614 }
1615 
1617  if ((int)uNumSpriteObjects > 0) {
1618  for (int i = 0; i < (signed int)uNumSpriteObjects; ++i) {
1619  if (pSpriteObjects[i].uObjectDescID) {
1620  if (!(pSpriteObjects[i].uAttributes & 8) && !pSpriteObjects[i].IsUnpickable()) {
1621  bool bOnWater = false;
1622  pSpriteObjects[i].vPosition.z =
1624  pSpriteObjects[i].vPosition.x,
1625  pSpriteObjects[i].vPosition.y, &bOnWater, 0);
1626  }
1627  if (pSpriteObjects[i].containing_item.uItemID) {
1628  if (pSpriteObjects[i].containing_item.uItemID != 220 &&
1629  pItemsTable->pItems[pSpriteObjects[i].containing_item.uItemID].uEquipType == EQUIP_POTION &&
1630  !pSpriteObjects[i].containing_item.uEnchantmentType)
1631  pSpriteObjects[i].containing_item.uEnchantmentType = rand() % 15 + 5;
1632  pItemsTable->SetSpecialBonus(&pSpriteObjects[i].containing_item);
1633  }
1634  }
1635  }
1636  }
1638 }
1639 
1640 //----- (0047F2D3) --------------------------------------------------------
1642  int alert_status; // [sp+348h] [bp-8h]@1
1643  // int v9; // [sp+34Ch] [bp-4h]@1
1644 
1645  alert_status = 0;
1646  for (int i = 0; i < uNumActors; ++i) {
1647  if (!(pActors[i].uAttributes & ACTOR_UNKNOW7)) {
1648  if (alert_status != 1) {
1649  pActors[i].uCurrentActionTime = 0;
1650  pActors[i].uCurrentActionLength = 0;
1651  if (pActors[i].uAttributes & ACTOR_UNKNOW11)
1652  pActors[i].uAIState = AIState::Disabled;
1653  if (pActors[i].uAIState != AIState::Removed &&
1654  pActors[i].uAIState != AIState::Disabled &&
1655  (pActors[i].sCurrentHP == 0 ||
1656  pActors[i].pMonsterInfo.uHP == 0))
1657  pActors[i].uAIState = AIState::Dead;
1658  pActors[i].vVelocity.x = 0;
1659  pActors[i].vVelocity.y = 0;
1660  pActors[i].vVelocity.z = 0;
1661  pActors[i].UpdateAnimation();
1662  pActors[i].pMonsterInfo.uHostilityType =
1664  pActors[i].PrepareSprites(0);
1665  } else {
1666  pActors[i].uAIState = AIState::Disabled;
1667  pActors[i].uAttributes |= ACTOR_UNKNOW11;
1668  }
1669  } else if (a1 == 0) {
1670  pActors[i].uAIState = AIState::Disabled;
1671  pActors[i].uAttributes |= ACTOR_UNKNOW11;
1672  } else if (alert_status != 0) {
1673  pActors[i].uCurrentActionTime = 0;
1674  pActors[i].uCurrentActionLength = 0;
1675  if (pActors[i].uAttributes & ACTOR_UNKNOW11)
1676  pActors[i].uAIState = AIState::Disabled;
1677  if (pActors[i].uAIState != AIState::Removed &&
1678  pActors[i].uAIState != AIState::Disabled &&
1679  (pActors[i].sCurrentHP == 0 ||
1680  pActors[i].pMonsterInfo.uHP == 0))
1681  pActors[i].uAIState = AIState::Dead;
1682  pActors[i].vVelocity.x = 0;
1683  pActors[i].vVelocity.y = 0;
1684  pActors[i].vVelocity.z = 0;
1685  pActors[i].UpdateAnimation();
1686  pActors[i].pMonsterInfo.uHostilityType =
1688  pActors[i].PrepareSprites(0);
1689  } else {
1690  pActors[i].uAIState = AIState::Disabled;
1691  pActors[i].uAttributes |= ACTOR_UNKNOW11;
1692  alert_status = GetAlertStatus();
1693  }
1694  }
1695 
1697  // no use for this
1698  // Actor thisa;
1699  // thisa.pMonsterInfo.uID = 45;
1700  // thisa.PrepareSprites(0);
1701  return 1;
1702 }
1703 
1704 //----- (0047F3EA) --------------------------------------------------------
1706  pTileTypes[3].uTileID =
1709  return 1;
1710 }
1711 
1712 //----- (0047F420) --------------------------------------------------------
1714  for (uint i = 0; i < 3; ++i)
1715  pTileTypes[i].uTileID =
1717 
1718  return true;
1719 }
1720 
1721 //----- (0047B42C) --------------------------------------------------------
1723  int z; // esi@5
1724  float v4; // ST48_4@8
1725  unsigned int Angle_To_Cam; // eax@11
1726  signed int Cur_Action_Time; // eax@16
1727  SpriteFrame *v14; // eax@24
1728  SpriteFrame *v15; // ebx@25
1729  // int v22; // ecx@41
1730  // int v23; // ST5C_4@43
1731  int Sprite_Octant; // [sp+24h] [bp-3Ch]@11
1732  // int v48; // [sp+30h] [bp-30h]@41
1733  signed int v49; // [sp+34h] [bp-2Ch]@5
1734  // int v51; // [sp+34h] [bp-2Ch]@41
1735  int y; // [sp+40h] [bp-20h]@5
1736  int x; // [sp+44h] [bp-1Ch]@5
1737  __int16 v62; // [sp+5Ch] [bp-4h]@25
1738 
1739  for (int i = 0; i < uNumActors; ++i) {
1740  pActors[i].uAttributes &= ~ACTOR_VISIBLE;
1741  if (pActors[i].uAIState == Removed || pActors[i].uAIState == Disabled) {
1742  continue;
1743  }
1744 
1745  z = pActors[i].vPosition.z;
1746  v49 = 0;
1747  x = pActors[i].vPosition.x;
1748  y = pActors[i].vPosition.y;
1749  if (pActors[i].uAIState == Summoned) {
1750  if (PID_TYPE(pActors[i].uSummonerID) != OBJECT_Actor ||
1751  pActors[PID_ID(pActors[i].uSummonerID)]
1752  .pMonsterInfo.uSpecialAbilityDamageDiceSides != 1) {
1753  z += floorf(pActors[i].uActorHeight * 0.5f + 0.5f);
1754  } else {
1755  v49 = 1;
1756  spell_fx_renderer->_4A7F74(pActors[i].vPosition.x, pActors[i].vPosition.y, z);
1757  v4 = (1.0 - (double)pActors[i].uCurrentActionTime /
1758  (double)pActors[i].uCurrentActionLength) *
1759  (double)(2 * pActors[i].uActorHeight);
1760  z -= floorf(v4 + 0.5f);
1761  if (z > pActors[i].vPosition.z) z = pActors[i].vPosition.z;
1762  }
1763  }
1764 
1765  Angle_To_Cam = stru_5C6E00->Atan2(
1766  pActors[i].vPosition.x - pIndoorCameraD3D->vPartyPos.x,
1767  pActors[i].vPosition.y - pIndoorCameraD3D->vPartyPos.y);
1768 
1769  // int v9 = 0;
1770  // HEXRAYS_LOWORD(v9) = pActors[i].uYawAngle;
1771  Sprite_Octant = ((signed int)(stru_5C6E00->uIntegerPi +
1772  ((signed int)stru_5C6E00->uIntegerPi >> 3) + pActors[i].uYawAngle -
1773  Angle_To_Cam) >> 8) & 7;
1774 
1775 
1776  if (pParty->bTurnBasedModeOn) {
1777  Cur_Action_Time = pActors[i].uCurrentActionTime;
1778  if (pActors[i].uCurrentActionAnimation == 1)
1779  Cur_Action_Time = 32 * i + pMiscTimer->uTotalGameTimeElapsed;
1780  } else {
1781  Cur_Action_Time = pActors[i].uCurrentActionTime;
1782  if (pActors[i].uCurrentActionAnimation == 1)
1783  Cur_Action_Time = 32 * i + pEventTimer->uTotalGameTimeElapsed;
1784  }
1785 
1786  if (pActors[i].pActorBuffs[ACTOR_BUFF_STONED].Active() ||
1787  pActors[i].pActorBuffs[ACTOR_BUFF_PARALYZED].Active())
1788  Cur_Action_Time = 0;
1789  if (pActors[i].uAIState == Summoned && !v49)
1790  v14 = pSpriteFrameTable->GetFrame(uSpriteID_Spell11, Cur_Action_Time);
1791  else if (pActors[i].uAIState == Resurrected)
1793  pActors[i].pSpriteIDs[pActors[i].uCurrentActionAnimation], Cur_Action_Time);
1794  else
1795  v14 = pSpriteFrameTable->GetFrame(
1796  pActors[i].pSpriteIDs[pActors[i].uCurrentActionAnimation], Cur_Action_Time);
1797 
1798  // no sprite frame to draw
1799  if (v14->icon_name == "null") continue /* __debugbreak()*/;
1800  if (v14->hw_sprites[0] == nullptr) __debugbreak();
1801 
1802  v62 = 0;
1803  v15 = v14;
1804  // v16 = (int *)v14->uFlags;
1805  if (v14->uFlags & 2) v62 = 2;
1806  if (v14->uFlags & 0x40000) v62 |= 0x40;
1807  if (v14->uFlags & 0x20000) v62 |= 0x80;
1808  if ((256 << Sprite_Octant) & v14->uFlags) v62 |= 4;
1809  if (v15->uGlowRadius) {
1810  pMobileLightsStack->AddLight(x, y, z, 0, v15->uGlowRadius, 0xFFu,
1811  0xFFu, 0xFFu, _4E94D3_light_type);
1812  }
1813 
1814  int view_x = 0, view_y = 0, view_z = 0;
1815  bool visible = pIndoorCameraD3D->ViewClip(x, y, z, &view_x, &view_y, &view_z);
1816 
1817  if (visible) {
1818  if (abs(view_x) >= abs(view_y)) {
1819  int projected_x = 0;
1820  int projected_y = 0;
1821  pIndoorCameraD3D->Project(view_x, view_y, view_z, &projected_x,
1822  &projected_y);
1823 
1824  if (uNumBillboardsToDraw >= 500) return;
1827 
1828  pActors[i].uAttributes |= ACTOR_VISIBLE;
1829  pBillboardRenderList[uNumBillboardsToDraw - 1].hwsprite = v15->hw_sprites[Sprite_Octant];
1830 
1831  if (v15->hw_sprites[Sprite_Octant]->texture->GetHeight() == 0 || v15->hw_sprites[Sprite_Octant]->texture->GetWidth() == 0)
1832  __debugbreak();
1833 
1836 
1838  fixed::FromInt(view_x);
1841 
1842  if (pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].Active() &&
1843  pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uPower > 0) {
1845  .screenspace_projection_factor_y = 1.0f / pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uPower *
1848  } else if (pActors[i].pActorBuffs[ACTOR_BUFF_MASS_DISTORTION].Active()) {
1852  }
1853 
1863 
1867  pMonsterList->pMonsters[pActors[i].pMonsterInfo.uID - 1].sTintColor; // *((int *)&v35[v36] - 36);
1868  if (pActors[i].pActorBuffs[ACTOR_BUFF_STONED].Active()) {
1870  v62 | 0x200;
1871  }
1872  }
1873  }
1874  }
1875 }
1876 
1877 int ODM_GetFloorLevel(int X, signed int Y, int Z, int __unused, bool *pIsOnWater,
1878  int *bmodel_pid, int bWaterWalk) {
1879  int v18; // edx@26
1880  int v19; // eax@28
1881  int v22; // edx@30
1882  __int64 v23; // qtt@30
1883  int v24; // eax@36
1884  int v25; // ecx@38
1885  int current_floor_level; // ecx@43
1886  int v29; // edx@44
1887  int v39; // [sp+20h] [bp-20h]@9
1888  bool current_vertices_Y; // [sp+30h] [bp-10h]@22
1889  bool next_vertices_Y; // [sp+34h] [bp-Ch]@24
1890  int number_hits; // [sp+58h] [bp+18h]@22
1891  int next_floor_level; // [sp+58h] [bp+18h]@43
1892 
1893  int v46 = 1;
1894  current_BModel_id[0] = -1;
1895  current_Face_id[0] = -1;
1896  odm_floor_level[0] =
1897  GetTerrainHeightsAroundParty2(X, Y, pIsOnWater, bWaterWalk);
1898 
1899  for (BSPModel &model : pOutdoor->pBModels) {
1900  if (X <= model.sMaxX && X >= model.sMinX && Y <= model.sMaxY &&
1901  Y >= model.sMinY) {
1902  if (!model.pFaces.empty()) {
1903  v39 = 0;
1904  for (ODMFace &face : model.pFaces) {
1905  if (face.Ethereal()) {
1906  continue;
1907  }
1908  if ((face.uPolygonType == POLYGON_Floor ||
1909  face.uPolygonType == POLYGON_InBetweenFloorAndWall) &&
1910  X <= face.pBoundingBox.x2 &&
1911  X >= face.pBoundingBox.x1 &&
1912  Y <= face.pBoundingBox.y2 &&
1913  Y >= face.pBoundingBox.y1) {
1914  for (uint i = 0; i < face.uNumVertices; ++i) {
1916  face.pXInterceptDisplacements[i] +
1917  model.pVertices.pVertices[face.pVertexIDs[i]].x;
1919  face.pYInterceptDisplacements[i] +
1920  model.pVertices.pVertices[face.pVertexIDs[i]].y;
1921  odm_floor_face_vert_coord_X[2 * i + 1] =
1922  face.pXInterceptDisplacements[i] +
1923  model.pVertices
1924  .pVertices[face.pVertexIDs[i + 1]]
1925  .x;
1926  odm_floor_face_vert_coord_Y[2 * i + 1] =
1927  face.pYInterceptDisplacements[i] +
1928  model.pVertices
1929  .pVertices[face.pVertexIDs[i + 1]]
1930  .y;
1931  }
1932  odm_floor_face_vert_coord_X[2 * face.uNumVertices] =
1934  odm_floor_face_vert_coord_Y[2 * face.uNumVertices] =
1936 
1937  current_vertices_Y =
1939  number_hits = 0;
1940  if (2 * face.uNumVertices > 0) {
1941  for (int i = 0; i < 2 * face.uNumVertices; ++i) {
1942  if (number_hits >= 2) break;
1943  // v36 = odm_floor_face_vert_coord_Y[i + 1];
1944  next_vertices_Y =
1945  odm_floor_face_vert_coord_Y[i + 1] >= Y;
1946  if (current_vertices_Y !=
1947  next_vertices_Y) { // проверка по Y
1948  v18 =
1949  odm_floor_face_vert_coord_X[i + 1] >= X
1950  ? 0
1951  : 2;
1952  v19 = v18 |
1953  (odm_floor_face_vert_coord_X[i] < X);
1954  if (v19 != 3) {
1955  if (!v19) {
1956  ++number_hits;
1957  } else {
1958  HEXRAYS_LODWORD(v23) =
1959  (Y -
1961  << 16;
1962  HEXRAYS_HIDWORD(v23) =
1964  [i]) >>
1965  16;
1966  v22 =
1968  [i + 1] -
1970  [i]) *
1971  v23 /
1973  [i + 1] -
1975  [i])) >>
1976  16) +
1978  [i]);
1979  if (v22 >= X) ++number_hits;
1980  }
1981  }
1982  }
1983  current_vertices_Y = next_vertices_Y;
1984  }
1985  if (number_hits == 1) {
1986  if (v46 >= 20) break;
1987  if (face.uPolygonType == POLYGON_Floor) {
1988  v24 = model.pVertices
1989  .pVertices[face.pVertexIDs[0]]
1990  .z;
1991  } else {
1992  int a = fixpoint_mul(face.zCalc1, X);
1993  int b = fixpoint_mul(face.zCalc2, Y);
1994  int c = ((int64_t)face.zCalc3 >> 16);
1995  v24 = a + b + c;
1996  }
1997  v25 = v46++;
1998  odm_floor_level[v25] = v24;
1999  current_BModel_id[v25] = model.index;
2000  current_Face_id[v25] = face.index;
2001  }
2002  }
2003  }
2004  }
2005  }
2006  }
2007  }
2008  if (v46 == 1) {
2009  *bmodel_pid = 0;
2010  return odm_floor_level[0];
2011  }
2012  current_floor_level = 0;
2013  v29 = 0;
2014  if (v46 <= 1) {
2015  *bmodel_pid = 0;
2016  } else {
2017  current_floor_level = odm_floor_level[0];
2018  for (uint i = 1; i < v46; ++i) {
2019  next_floor_level = odm_floor_level[i];
2020  if (current_floor_level <= Z + 5) {
2021  if (next_floor_level >= current_floor_level &&
2022  next_floor_level <= Z + 5) {
2023  current_floor_level = next_floor_level;
2024  v29 = i;
2025  }
2026  } else if (next_floor_level < current_floor_level) {
2027  current_floor_level = next_floor_level;
2028  v29 = i;
2029  }
2030  }
2031  if (!v29)
2032  *bmodel_pid = 0;
2033  else
2034  *bmodel_pid = current_Face_id[v29] | (current_BModel_id[v29] << 6);
2035  }
2036  if (v29) {
2037  *pIsOnWater = false;
2039  .pFaces[current_Face_id[v29]]
2040  .Fluid())
2041  *pIsOnWater = true;
2042  }
2043  if (odm_floor_level[v29] >= odm_floor_level[0])
2044  odm_floor_level[0] = odm_floor_level[v29];
2045  return odm_floor_level[0];
2046 }
2047 
2048 // not sure if right- or left-handed coordinate space assumed, so this could be
2049 // normal of inverse normal
2050 // for a right-handed system, that would be an inverse normal
2051 //----- (0046DCC8) --------------------------------------------------------
2052 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out) {
2053  uint grid_x = WorldPosToGridCellX(pos_x);
2054  uint grid_z = WorldPosToGridCellZ(pos_z) - 1;
2055 
2056  int grid_pos_x1 = GridCellToWorldPosX(grid_x);
2057  int grid_pos_x2 = GridCellToWorldPosX(grid_x + 1);
2058  int grid_pos_z1 = GridCellToWorldPosZ(grid_z);
2059  int grid_pos_z2 = GridCellToWorldPosZ(grid_z + 1);
2060 
2061  int x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z);
2062  int x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z);
2063  int x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1);
2064  int x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1);
2065 
2066  float side1_dx, side1_dy, side1_dz, side2_dx, side2_dy, side2_dz;
2067 
2068  int dx = abs(pos_x - grid_pos_x1), dz = abs(grid_pos_z1 - pos_z);
2069  if (dz >= dx) {
2070  side2_dx = (double)(grid_pos_x2 - grid_pos_x1);
2071  side2_dz =
2072  0.0; // (double)(grid_pos_z2 - grid_pos_z2); // bug? z2 - z2
2073  side2_dy = (double)(x2z2_y - x1z2_y);
2074 
2075  side1_dx = 0.0; // (double)(grid_pos_x1 - grid_pos_x1);
2076  side1_dz = (double)(grid_pos_z1 - grid_pos_z2); // z1 - z2 yes
2077  side1_dy = (double)(x1z1_y - x1z2_y);
2078  // logger->Warning(L"%S %S %u\n", __FILE__, __FUNCTION__, __LINE__);
2079  /* |\
2080  side1 | \
2081  |____\
2082  side 2 */
2083  } else {
2084  side2_dx = (double)(grid_pos_x1 - grid_pos_x2);
2085  side2_dz = 0.0; // (double)(grid_pos_z1 - grid_pos_z1);
2086  side2_dy = (double)(x1z1_y - x2z1_y);
2087 
2088  side1_dx = 0.0; // (double)(grid_pos_x2 - grid_pos_x1);
2089  side1_dz = (double)(grid_pos_z2 - grid_pos_z1);
2090  side1_dy = (double)(x2z2_y - x2z1_y);
2091  /* side 2
2092  _____
2093  \ |
2094  \ | side 1
2095  \| */
2096  }
2097 
2098  float nx = side1_dy * side2_dz - side1_dz * side2_dy;
2099  float ny = side1_dx * side2_dy - side1_dy * side2_dx;
2100  float nz = side1_dz * side2_dx - side1_dx * side2_dz;
2101 
2102  float mag = sqrt(nx * nx + ny * ny + nz * nz);
2103  if (fabsf(mag) < 1e-6f) {
2104  out->y = 0;
2105  out->x = 0;
2106  out->z = 65536;
2107  } else {
2108  float invmag = 1.0 / mag;
2109  out->x = invmag * nx * 65536.0;
2110  out->y = invmag * ny * 65536.0;
2111  out->z = invmag * nz * 65536.0;
2112  }
2113 }
2114 //----- (0046BE0A) --------------------------------------------------------
2116  bool v0; // eax@5
2117  char pOut[32]; // [sp+8h] [bp-20h]@5
2118 
2119  UpdateObjects();
2121  if (pParty->vPosition.x < -22528 || pParty->vPosition.x > 22528 ||
2122  pParty->vPosition.y < -22528 || pParty->vPosition.y > 22528) {
2125  pParty->vPosition.y, pOut, 32);
2126  if (!engine->IsUnderwater() && (pParty->uFlags & (PARTY_FLAGS_1_STANDING_ON_WATER |
2127  PARTY_FLAGS_1_FALLING | 0x04) ||
2128  pParty->uFlags & 0x0200 || pParty->bFlying) ||
2129  !v0) {
2130  if (pParty->vPosition.x < -22528) pParty->vPosition.x = -22528;
2131  if (pParty->vPosition.x > 22528) pParty->vPosition.x = 22528;
2132  if (pParty->vPosition.y < -22528) pParty->vPosition.y = -22528;
2133  if (pParty->vPosition.y > 22528) pParty->vPosition.y = 22528;
2134  } else {
2135  pAudioPlayer->StopChannels(-1, -1);
2136  pDialogueWindow = new GUIWindow_Travel(); // TravelUI_Load();
2137  }
2138  }
2139  UpdateActors_ODM();
2141 }
2142 //----- (0041F54A) --------------------------------------------------------
2146  rest_ui_sky_frame_current = nullptr;
2147  }
2151  }
2152 
2154  StringPrintf("TERRA%03d", pParty->uCurrentMinute / 6 + 10 * pParty->uCurrentHour),
2155  0x7FF);
2156 }
2157 
2159  this->log = EngineIoc::ResolveLogger();
2163 
2164  subconstuctor();
2166 }
2167 
2169  // OutdoorLocationTerrain::OutdoorLocationTerrain(&this->pTerrain);
2170  field_F0 = 0;
2171  field_F4 = 0x40000000u;
2172  // DLVHeader::DLVHeader(&v1->ddm);
2173  pSpawnPoints = 0;
2174  pCmap = 0;
2175  pFaceIDLIST = 0;
2176  pOMAP = 0;
2177 }
2178 
2179 //----- (00481E55) --------------------------------------------------------
2180 void ODM_Project(unsigned int uNumVertices) {
2181  for (uint i = 0; i < uNumVertices; i++) {
2182  memcpy(&VertexRenderList[i], &array_507D30[i],
2183  sizeof(VertexRenderList[i]));
2185  (double)pViewport->uScreenCenterX -
2186  ((double)pODMRenderParams->int_fov_rad * array_507D30[i]._rhw) *
2187  array_507D30[i].vWorldViewPosition.y;
2189  (double)pViewport->uScreenCenterY -
2190  ((double)pODMRenderParams->int_fov_rad * array_507D30[i]._rhw) *
2192  }
2193 }
2194 
2195 //----- (00485F64) --------------------------------------------------------
2196 void ODMRenderParams::Initialize() { // this seems to be called several times during loading
2197  int v1; // eax@1
2198  int v2; // eax@2
2199  signed __int64 v3; // qtt@4
2200  int v4; // eax@4
2201 
2202  this->uCameraFovInDegrees = 75;
2203 
2204  v1 = stru_5C6E00->uPiMask & 0xD5;
2205  if (v1 >= (signed int)stru_5C6E00->uIntegerHalfPi)
2207  else
2208  v2 = stru_5C6E00->pTanTable[v1];
2209  HEXRAYS_LODWORD(v3) = (viewparams->uSomeZ - viewparams->uSomeX) << 31;
2210  HEXRAYS_HIDWORD(v3) = (viewparams->uSomeZ - viewparams->uSomeX) << 15 >> 16;
2211  v4 = (signed int)(v3 / v2) >> 16;
2212  this->int_fov_rad = v4;
2213  this->field_4C = 360000;
2214  this->int_fov_rad_inv = 65536 / v4;
2215  this->field_50 = 115;
2216  // sr_6BE060[1] = 1;
2217  // RotationToInts();
2218 }
2219 
2220 //----- (00473893) --------------------------------------------------------
2222  int v1; // edi@1
2223  int v2; // ebx@1
2224  int floor_level; // eax@14
2225  int v34; // esi@143
2226  int v35; // esi@147
2227  int v36; // eax@155
2228  int v40; // esi@162
2229  bool v42; // eax@180
2230  signed int v43; // ecx@184
2231  signed int v44; // edx@184
2232  int v45; // ecx@200
2233  BSPModel *pModel; // eax@203
2234  bool pModel_;
2235  ODMFace *pODMFace; // esi@203
2236  int v48; // eax@203
2237  int v54; // eax@215
2238  int v55; // eax@217
2239  unsigned int v66; // esi@263
2240  signed int v68; // ecx@263
2241  int v69; // eax@263
2242  bool v77; // edx@297
2243  bool v78; // ecx@303
2244  int v79; // ecx@314
2245  __int16 v80; // dx@317
2246  int pTerrainHeight; // eax@321
2247  int v87; // [sp-20h] [bp-B4h]@248
2248  int v97; // [sp+Ch] [bp-88h]@180
2249  Vec3_int_ v98;
2250  bool not_high_fall; // [sp+1Ch] [bp-78h]@33
2251  int v102; // [sp+20h] [bp-74h]@1
2252  int trigger_id = 0; // [sp+24h] [bp-70h]@1
2253  bool bFeatherFall; // [sp+28h] [bp-6Ch]@4
2254  int bonus;
2255  int on_ground; // [sp+2Ch] [bp-68h]@24
2256  bool bWaterWalk; // [sp+30h] [bp-64h]@1
2257  int ceiling_height; // [sp+3Ch] [bp-58h]@28
2258  int v110; // [sp+40h] [bp-54h]@180
2259  int v111; // [sp+44h] [bp-50h]@14
2260  bool hovering; // [sp+48h] [bp-4Ch]@1
2261  int v113; // [sp+4Ch] [bp-48h]@1
2262  bool party_running_flag; // [sp+50h] [bp-44h]@1
2263  int _walk_speed; // [sp+54h] [bp-40h]@48
2264  int pX; // [sp+58h] [bp-3Ch]@1
2265  int pY; // [sp+5Ch] [bp-38h]@1
2266  int party_new_Z; // [sp+74h] [bp-20h]@1
2267  int v118; // [sp+60h] [bp-34h]@1
2268  int _angle_x; // [sp+68h] [bp-2Ch]@48
2269  unsigned int v122; // [sp+70h] [bp-24h]@180
2270 
2271  bool party_walking_flag; // [sp+78h] [bp-1Ch]@1
2272  int _angle_y; // [sp+7Ch] [bp-18h]@48
2273  int v128; // [sp+88h] [bp-Ch]@1
2274  int v129; // [sp+8Ch] [bp-8h]@92
2275 
2276  v1 = 0;
2277  v2 = 0;
2278  // *(float *)&v128 = 0.0;
2279  int fall_speed = pParty->uFallSpeed;
2280  v128 = 0;
2281  v129 = 0;
2282 
2283  pX = pParty->vPosition.x;
2284  pY = pParty->vPosition.y;
2285  party_new_Z = pParty->vPosition.z;
2286 
2287  v113 = pParty->field_6F0;
2288  hovering = false;
2289  bool partyAtHighSlope =
2291  party_running_flag = false;
2292  party_walking_flag = false;
2293  v102 = 0;
2294  pModel_ = false;
2295  bWaterWalk = false;
2296  //************************************
2297  //Проверка падение пера
2298  if (!pParty->FeatherFallActive()) {
2299  bFeatherFall = false;
2300  for (int i = 0; i < 4; ++i)
2301  if (pParty->pPlayers[i].WearsItemAnyWhere(
2302  ITEM_ARTIFACT_LADYS_ESCORT)) { // seems like flying boots
2303  bFeatherFall = true;
2304  break;
2305  }
2306  } else {
2307  bFeatherFall = true;
2308  }
2309  //************************************
2310  //Проверка хождения по воде
2312  if (pParty->WaterWalkActive()) {
2313  bWaterWalk = true;
2315  [20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID +
2316  119] |= 1;
2317  if (!(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) &&
2318  pParty->pPlayers
2319  [pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster - 1]
2320  .sMana <= 0)
2321  bWaterWalk = false;
2322  }
2323  //*************************************
2324  //определение уровня пола
2325  int bmodel_standing_on_pid; //данные 3D model'и
2326  bool is_on_water = false; //на воду
2327  floor_level =
2328  ODM_GetFloorLevel(pX, pY, party_new_Z, pParty->uPartyHeight,
2329  &is_on_water, &bmodel_standing_on_pid, bWaterWalk);
2330  int is_not_on_bmodel = bmodel_standing_on_pid == 0; //не на 3D model
2331 
2332  v111 = floor_level; //???
2333  //************************************
2334  //определение высоты падения
2335  if (bFeatherFall) //падение пера
2336  pParty->uFallStartY = floor_level;
2337  else
2338  floor_level = pParty->uFallStartY;
2339  //*************************************
2340  //падение на 3D Model
2341  if (floor_level - party_new_Z > 512 && !bFeatherFall &&
2342  party_new_Z <= v111 + 1) {
2345  } else {
2346  for (int i = 0; i < 4; ++i) { // receive falling damage
2347  if (!pParty->pPlayers[i].HasEnchantedItemEquipped(72) &&
2349  EQUIP_BOOTS)) {
2350  pParty->pPlayers[i].ReceiveDamage(
2351  (int)((pParty->uFallStartY - party_new_Z) *
2352  (uint64_t)(pParty->pPlayers[i]
2353  .GetMaxHealth() /
2354  10)) /
2355  256,
2356  DMGT_PHISYCAL);
2357  bonus = 20 - pParty->pPlayers[i].GetParameterBonus(
2358  pParty->pPlayers[i].GetActualEndurance());
2359  pParty->pPlayers[i].SetRecoveryTime(
2360  (signed __int64)((double)bonus *
2362  2.133333333333333));
2363  }
2364  }
2365  }
2366  }
2367  //*********************************
2368  //определение высоты потолка
2369  ceiling_height = -1;
2370  if (pParty->bFlying) //в полёте
2371  ceiling_height =
2372  GetCeilingHeight(pX, pY, party_new_Z + pParty->uPartyHeight,
2373  (int)&v102); //высота потолка
2374  // v107 = bmodel_standing_on_pid == 0;
2375  on_ground = v111 + 1; //на земле
2376  //**************************************
2377 
2378  if (party_new_Z <= on_ground) { //полёт: посадка
2379  ceiling_height = -1;
2380  pParty->bFlying = false;
2381  } else {
2382  hovering = true;
2383  }
2384  not_high_fall = party_new_Z - v111 <= 32;
2385  //****************************************
2386  // timer update(обновить таймер звука ходьбы)
2387  if (!engine->config->NoWalkSound() && pParty->walk_sound_timer) {
2390  else
2391  pParty->walk_sound_timer = 0;
2392  }
2393 
2394  //****************************************
2395  // check if we should be flying
2396  if (!engine->IsUnderwater() && !pParty->pPartyBuffs[PARTY_BUFF_FLY].Active())
2397  pParty->bFlying = false;
2398 
2399  //*****************************************
2400  // установить на чём стоит группа
2401  if (!hovering) { // не в воздухе
2402  if (pParty->floor_face_pid !=
2403  PID(OBJECT_BModel, bmodel_standing_on_pid)) {
2404  if (bmodel_standing_on_pid) {
2405  int BModel_id = bmodel_standing_on_pid >> 6;
2406  if (BModel_id < pOutdoor->pBModels.size()) {
2407  int face_id = bmodel_standing_on_pid & 0x3F;
2408  if (pOutdoor->pBModels[BModel_id]
2409  .pFaces[face_id]
2410  .uAttributes &
2411  FACE_PRESSURE_PLATE) {
2413  PID(OBJECT_BModel, bmodel_standing_on_pid);
2414  trigger_id =
2415  pOutdoor->pBModels[BModel_id]
2416  .pFaces[face_id]
2417  .sCogTriggeredID; // EVT, панель имеет событие
2418  }
2419  }
2420  }
2421  }
2423  PID(OBJECT_BModel, bmodel_standing_on_pid); // 6 - на земле
2424  }
2425  //***********************************************
2426  _walk_speed = pParty->uWalkSpeed;
2427  _angle_y = pParty->sRotationY;
2428  _angle_x = pParty->sRotationX;
2429  // v126 = pEventTimer->dt_in_some_format;
2430  /*v119 = (Player **)((unsigned __int64)(pEventTimer->dt_in_some_format
2431  * (signed __int64)((signed
2432  int)(pParty->field_20_prolly_turn_speed
2433  *
2434  stru_5C6E00->uIntegerPi) / 180)) >> 16);*/
2435  __int64 dturn =
2436  (unsigned __int64)(pEventTimer->dt_in_some_format *
2437  (signed __int64)((signed int)(pParty
2438  ->y_rotation_speed *
2439  stru_5C6E00
2440  ->uIntegerPi) /
2441  180)) >>
2442  16;
2443  while (pPartyActionQueue->uNumActions) {
2444  switch (pPartyActionQueue->Next()) {
2445  case PARTY_FlyUp: //полёт вверх
2446  {
2447  if (!pParty->FlyActive() && !engine->IsUnderwater()) break;
2448 
2449  pParty->bFlying = false;
2450  if (engine->IsUnderwater() ||
2451  pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1 ||
2452  (pParty->pPlayers
2453  [pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1]
2454  .sMana > 0 || engine->config->debug_all_magic)) {
2455  if (pParty->vPosition.z < engine->config->max_flight_height || hovering) {
2456  party_new_Z += 30;
2457  v113 += 30;
2458  pParty->bFlying = true;
2459  if (party_new_Z > engine->config->max_flight_height) {
2460  party_new_Z = engine->config->max_flight_height;
2461  v113 = engine->config->max_flight_height;
2462  }
2463  v1 = 0;
2464  v2 = 0;
2465  fall_speed = 0;
2466  *(float *)&v128 = 0.0;
2467  if (v102 && party_new_Z < ceiling_height &&
2468  (signed int)(pParty->uPartyHeight + party_new_Z) >=
2469  ceiling_height) { // столкновение с потолком
2470  pParty->field_6E0 = 0;
2471  pParty->field_6E4 = 0;
2474  pParty->vPosition.z =
2475  ceiling_height - pParty->uPartyHeight - 31;
2476  pParty->field_6F0 = party_new_Z;
2477  pParty->bFlying = false;
2478  party_new_Z =
2479  ceiling_height - pParty->uPartyHeight - 31;
2480  v113 = pParty->field_6F0;
2481  }
2482  pParty->uFallSpeed = 0;
2483  pModel_ = true;
2484  }
2485  }
2486  } break;
2487 
2488  case PARTY_FlyDown: //полёт вниз
2489  if (pParty->FlyActive() || engine->IsUnderwater()) {
2490  pParty->bFlying = false;
2491  if (engine->IsUnderwater() ||
2492  pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1 ||
2493  pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0) {
2494  // *(int *)&pParty->pArtifactsFound[6972 *
2495  // pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster + 10] > 0 )
2496  party_new_Z -= 30;
2497  v113 -= 30;
2498  pParty->uFallSpeed = 0;
2499  fall_speed = 0;
2500  pParty->bFlying = true;
2501  pModel_ = true;
2502  if (party_new_Z <= v111) {
2503  pParty->bFlying = false;
2505  }
2506  }
2507  }
2508  break;
2509 
2510  case PARTY_TurnLeft: //поворот влево
2511  if (engine->config->turn_speed > 0)
2512  _angle_y += engine->config->turn_speed; // descrete turn
2513  else
2514  _angle_y += dturn * fTurnSpeedMultiplier; // time-based smooth turn
2515 
2516  _angle_y &= stru_5C6E00->uDoublePiMask;
2517  break;
2518 
2519  case PARTY_TurnRight: //поворот вправо
2520  if (engine->config->turn_speed > 0)
2521  _angle_y -= engine->config->turn_speed;
2522  else
2523  _angle_y -= dturn * fTurnSpeedMultiplier;
2524 
2525  _angle_y &= stru_5C6E00->uDoublePiMask;
2526  break;
2527 
2528  case PARTY_FastTurnLeft: //быстрый поворот влево
2529  if (engine->config->turn_speed > 0)
2530  _angle_y += engine->config->turn_speed;
2531  else
2532  _angle_y += 2.0f * fTurnSpeedMultiplier * (double)dturn;
2533 
2534  _angle_y &= stru_5C6E00->uDoublePiMask;
2535  break;
2536 
2537  case PARTY_FastTurnRight: //быстрый поворот вправо
2538  if (engine->config->turn_speed > 0)
2539  _angle_y -= engine->config->turn_speed;
2540  else
2541  _angle_y -= 2.0f * fTurnSpeedMultiplier * (double)dturn;
2542 
2543  _angle_y &= stru_5C6E00->uDoublePiMask;
2544  break;
2545 
2546  case PARTY_StrafeLeft: //хождение боком в влево
2547  {
2548  *(float *)&v128 = pParty->uWalkSpeed;
2549 
2550  float sin_y = sinf(2 * pi_double * _angle_y / 2048.0);
2551  int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
2552  v2 -= 3 * dx / 4;
2553 
2554  float cos_y = cosf(2 * pi_double * _angle_y / 2048.0);
2555  int dy = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
2556  v1 += 3 * dy / 4;
2557 
2558  v128 = v1;
2559  party_walking_flag = true;
2560  } break;
2561 
2562  case PARTY_StrafeRight: //хождение боком в вправо
2563  {
2564  *(float *)&v128 = pParty->uWalkSpeed;
2565 
2566  float sin_y = sinf(2 * pi_double * _angle_y / 2048.0);
2567  int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
2568  v2 += 3 * dx / 4;
2569 
2570  float cos_y = cosf(2 * pi_double * _angle_y / 2048.0);
2571  int dy = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
2572  v1 -= 3 * dy / 4;
2573 
2574  v128 = v1;
2575  party_walking_flag = true;
2576  } break;
2577 
2578  case PARTY_WalkForward: // идти вперёд
2579  {
2580  *(float *)&v128 = _walk_speed;
2581 
2582  float sin_y = sinf(2 * pi_double * _angle_y / 2048.0),
2583  cos_y = cosf(2 * pi_double * _angle_y / 2048.0);
2584 
2585  int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
2586  int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
2587 
2588  if (engine->config->debug_turbo_speed) {
2589  v2 += dx * 12;
2590  v1 += dy * 12;
2591  } else {
2592  v2 += dx;
2593  v1 += dy;
2594  }
2595 
2596  v128 = v1;
2597  party_walking_flag = true;
2598  } break;
2599 
2600  case PARTY_RunForward: //бежать вперёд
2601  {
2602  *(float *)&v128 = _walk_speed;
2603 
2604  float sin_y = sinf(2 * pi_double * _angle_y / 2048.0);
2605  float cos_y = cosf(2 * pi_double * _angle_y / 2048.0);
2606 
2607  int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
2608  int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
2609 
2610  if (pParty->bFlying) { // лететь вперёд
2611  v2 += 4 * dx;
2612  v1 += 4 * dy;
2613 
2614  v128 = v1;
2615  } else if (partyAtHighSlope &&
2616  !bmodel_standing_on_pid) { // сбегание со склона
2617  v2 += dx;
2618  v1 += dy;
2619 
2620  v128 = v1;
2621  party_walking_flag = true;
2622  } else {
2623  /*v2 += (unsigned __int64)(stru_5C6E00->Cos(_angle_y)
2624  * (signed __int64)(signed int)(2 *
2625  (unsigned __int64)(signed __int64)((double)_walk_speed *
2626  fWalkSpeedMultiplier))) >> 16; v1 += (unsigned
2627  __int64)((signed int)stru_5C6E00->Sin(_angle_y)
2628  * (signed __int64)(signed int)(2 *
2629  (unsigned __int64)(signed __int64)((double)_walk_speed *
2630  fWalkSpeedMultiplier))) >> 16;*/
2631  if (engine->config->debug_turbo_speed) {
2632  v2 += dx * 12;
2633  v1 += dy * 12;
2634  } else {
2635  v2 += 2 * dx;
2636  v1 += 2 * dy;
2637  }
2638 
2639  v128 = v1;
2640  party_running_flag = true;
2641  }
2642  } break;
2643 
2644  case PARTY_WalkBackward: { // идти назад
2645  *(float *)&v128 = _walk_speed;
2646 
2647  float sin_y = sinf(2 * pi_double * _angle_y / 2048.0);
2648  float cos_y = cosf(2 * pi_double * _angle_y / 2048.0);
2649 
2650  int dx = cos_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier;
2651  v2 -= dx;
2652 
2653  int dy =
2655  v1 -= dy;
2656 
2657  v128 = v1;
2658  party_walking_flag = true;
2659  } break;
2660 
2661  case PARTY_RunBackward: //бежать назад
2662  {
2663  float sin_y = sinf(2 * pi_double * _angle_y / 2048.0);
2664  float cos_y = cosf(2 * pi_double * _angle_y / 2048.0);
2665 
2666  int dx =
2668  int dy =
2670 
2671  if (pParty->bFlying) {
2672  v2 -= 4 * dx;
2673  v1 -= 4 * dy;
2674  v128 = v1;
2675  } else {
2676  v2 -= dx;
2677  v1 -= dy;
2678 
2679  v128 = v1;
2680  party_walking_flag = true;
2681  }
2682  } break;
2683 
2684  case PARTY_CenterView: //смотреть прямо
2685  _angle_x = 0;
2686  break;
2687 
2688  case PARTY_LookDown: //смотреть вниз
2689  _angle_x +=
2690  (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0);
2691  if (_angle_x > 128) _angle_x = 128;
2692  if (uActiveCharacter)
2693  pPlayers[uActiveCharacter]->PlaySound(SPEECH_63, 0);
2694  break;
2695 
2696  case PARTY_LookUp: //смотреть вверх
2697  _angle_x +=
2698  (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0);
2699  if (_angle_x < -128) _angle_x = -128;
2700  if (uActiveCharacter)
2701  pPlayers[uActiveCharacter]->PlaySound(SPEECH_64, 0);
2702  break;
2703 
2704  case PARTY_Jump: //прыжок
2705  if ((!partyAtHighSlope || bmodel_standing_on_pid) &&
2706  !hovering && pParty->field_24 && !(pParty->uFlags & 4) &&
2707  !(pParty->uFlags & 0x200)) {
2708  // v126 = pParty->field_24 << 6;
2709  hovering = true;
2710  fall_speed += pParty->field_24 * 96;
2711  }
2712  break;
2713 
2714  case PARTY_Land: //приземление(клавиша Home)
2715  if (pParty->bFlying) {
2717  pParty->uFallSpeed = 0;
2718  }
2719  pParty->bFlying = false;
2721  break;
2722 
2723  default:
2724  assert(false);
2725  }
2726  }
2727 
2728  pParty->sRotationY = _angle_y;
2729  pParty->sRotationX = _angle_x;
2730  //-------------------------------------------
2731  if (pParty->bFlying) {
2732  v129 = fixpoint_mul(4, stru_5C6E00->Cos(OS_GetTime()));
2733  party_new_Z = v113 + v129;
2734  if (pModel_) party_new_Z = v113;
2735  if (pParty->FlyActive())
2737  [20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &=
2738  0xFE;
2739  pParty->uFallStartY = party_new_Z;
2740  } else if (party_new_Z < v111) {
2741  if (is_on_water && fall_speed)
2742  SpriteObject::Create_Splash_Object(pX, pY, v111);
2743  fall_speed = 0;
2744  party_new_Z = v111;
2745  pParty->uFallStartY = v111;
2746  v113 = party_new_Z;
2747  if (pParty->FlyActive())
2749  [20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |=
2750  1;
2751  } else {
2752  v113 = party_new_Z;
2753  if (pParty->FlyActive())
2755  [20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |=
2756  1;
2757  }
2758  //------------------------------------------
2759  if (hovering && !pParty->bFlying) { // расчёт скорости падения
2760  // v33 = -(pEventTimer->uTimeElapsed * GetGravityStrength());
2761  v34 = fall_speed +
2763  fall_speed += (-(pEventTimer->uTimeElapsed * GetGravityStrength())
2764  << 1); // y(t) = 2*gt
2765  } else if (!partyAtHighSlope) {
2766  v34 = fall_speed;
2767  } else if (!hovering) {
2768  if (!bmodel_standing_on_pid) {
2769  // rolling down the hill
2770  // how it's done: you get a little bit pushed in the air along
2771  // terrain normal, getting in the air and falling to the gravity,
2772  // gradually sliding downwards. nice trick
2773  party_new_Z = v111;
2774  ODM_GetTerrainNormalAt(pX, pY, &v98);
2775  v35 = fall_speed +
2777  v129 = abs(v2 * v98.x + v1 * v98.y + v35 * v98.z) >> 16;
2778  v2 += fixpoint_mul(v129, v98.x);
2779  v1 += fixpoint_mul(v129, v98.y);
2780  v34 = v35 + fixpoint_mul(v129, v98.z);
2781  v128 = v1;
2782  fall_speed = v34;
2783  }
2784  } else {
2785  v34 = fall_speed;
2786  }
2787 
2788  if (hovering) { // блок для крика падения
2789  if (!engine->IsUnderwater() && v34 <= 0) {
2790  if (v34 < -500 && !pParty->bFlying &&
2791  pParty->vPosition.z - v111 > 1000 &&
2792  !pParty->FeatherFallActive()) { // falling scream
2793  for (int i = 0; i < 4; ++i) {
2794  if (!pParty->pPlayers[i].HasEnchantedItemEquipped(72) &&
2795  !pParty->pPlayers[i].WearsItem(
2797  pParty->pPlayers[i].CanAct())
2798  pParty->pPlayers[i].PlaySound(SPEECH_Falling_scream,
2799  0); //крик падения
2800  }
2801  }
2802  }
2803  } else {
2804  pParty->uFallStartY = party_new_Z;
2805  }
2806 
2807  if (v2 * v2 + v1 * v1 < 400 && !partyAtHighSlope) {
2808  *(float *)&v128 = 0.0;
2809  v2 = 0;
2810  }
2811  //--(столкновения)-------------------------------------------------------------------
2812  stru_721530.field_84 = -1;
2813  stru_721530.field_70 = 0;
2816  stru_721530.field_0 = 1;
2818  for (uint i = 0; i < 100; i++) {
2819  stru_721530.position.x = pX;
2820  stru_721530.position.y = pY;
2821  stru_721530.position.z = stru_721530.height + party_new_Z + 1;
2822 
2823  stru_721530.normal.x = pX;
2824  stru_721530.normal.y = pY;
2825  stru_721530.normal.z = stru_721530.prolly_normal_d + party_new_Z + 1;
2826 
2827  stru_721530.velocity.x = v2;
2828  stru_721530.velocity.y = v128;
2829  stru_721530.velocity.z = fall_speed;
2830 
2831  stru_721530.uSectorID = 0;
2832  v36 = 0;
2834  v36 = 13312;
2835  }
2836  if (stru_721530.CalcMovementExtents(v36)) break;
2838  // v37 = WorldPosToGridCellZ(pParty->vPosition.y);
2839  // v38 = WorldPosToGridCellX(pParty->vPosition.x);
2844  for (uint actor_id = 0; actor_id < (signed int)uNumActors; ++actor_id)
2847  _angle_x = stru_721530.normal2.x;
2848  _angle_y = stru_721530.normal2.y;
2850  } else {
2851  _angle_x = pX + fixpoint_mul(stru_721530.field_7C,
2853  _angle_y = pY + fixpoint_mul(stru_721530.field_7C,
2855  // pModel = (BSPModel *)fixpoint_mul(stru_721530.field_7C,
2856  // stru_721530.direction.z);
2858  party_new_Z;
2859  }
2860  v122 = v40;
2861  ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight,
2862  &is_on_water, &bmodel_standing_on_pid, 0);
2863  v129 = ODM_GetFloorLevel(_angle_x, pY, v40, pParty->uPartyHeight,
2864  &is_on_water, &v97, 0);
2865  int v119 = ODM_GetFloorLevel(pX, _angle_y, v40, pParty->uPartyHeight,
2866  &is_on_water, &v110, 0);
2867  bool v42_ = (BSPModel *)IsTerrainSlopeTooHigh(_angle_x, pY);
2868  v42 = IsTerrainSlopeTooHigh(pX, _angle_y);
2869  is_not_on_bmodel = false;
2870  // v118 = v42;
2871  if (!v97 && !v110 && !bmodel_standing_on_pid) is_not_on_bmodel = true;
2872  v43 = 1;
2873  v44 = 1;
2874  if (engine->IsUnderwater() || !is_not_on_bmodel) {
2875  pX = _angle_x;
2876  if (v43) pY = _angle_y;
2877  } else {
2878  if (v42_ && v129 > party_new_Z) v44 = 0;
2879  if (v42 && v119 > party_new_Z) v43 = 0;
2880  if (v44) {
2881  pX = _angle_x;
2882  if (v43) pY = _angle_y;
2883  } else if (v43) {
2884  pY = _angle_y;
2885  } else {
2886  int new_ = ODM_GetFloorLevel(_angle_x, _angle_y, v40,
2887  pParty->uPartyHeight, &is_on_water,
2888  &bmodel_standing_on_pid, 0);
2889  if (IsTerrainSlopeTooHigh(_angle_x, _angle_y) &&
2890  new_ <= party_new_Z) {
2891  v43 = 1;
2892  pX = _angle_x;
2893  if (v43) pY = _angle_y;
2894  }
2895  }
2896  }
2898  if (!is_not_on_bmodel) {
2899  pX = stru_721530.normal2.x;
2900  pY = stru_721530.normal2.y;
2901  }
2902  party_new_Z =
2904  break;
2905  }
2907  pX = _angle_x;
2908  pY = _angle_y;
2909  v45 = stru_721530.pid;
2910  party_new_Z = v40;
2911 
2912  if (PID_TYPE(stru_721530.pid) == OBJECT_Actor) {
2913  if (pParty->Invisible())
2915  viewparams->bRedrawGameUI = true;
2916  }
2917 
2918  if (PID_TYPE(stru_721530.pid) == OBJECT_Decoration) {
2919  v129 = stru_5C6E00->Atan2(
2920  _angle_x - pLevelDecorations[(signed int)stru_721530.pid >> 3]
2921  .vPosition.x,
2922  _angle_y - pLevelDecorations[(signed int)stru_721530.pid >> 3]
2923  .vPosition.y);
2924  v2 = fixpoint_mul(stru_5C6E00->Cos(v129),
2925  integer_sqrt(v2 * v2 + v128 * v128));
2926  v122 = fixpoint_mul(stru_5C6E00->Sin(v129),
2927  integer_sqrt(v2 * v2 + v128 * v128));
2928  v128 = fixpoint_mul(stru_5C6E00->Sin(v129),
2929  integer_sqrt(v2 * v2 + v128 * v128));
2930  }
2931 
2932  if (PID_TYPE(stru_721530.pid) == OBJECT_BModel) {
2933  pParty->bFlying = false;
2934  pModel = &pOutdoor->pBModels[(signed int)stru_721530.pid >> 9];
2935  pODMFace =
2936  &pModel->pFaces[((signed int)stru_721530.pid >> 3) & 0x3F];
2937  v48 = pODMFace->pBoundingBox.z2 - pODMFace->pBoundingBox.z1;
2938  v129 = v48 <= 32;
2939  v119 = pODMFace->pFacePlane.vNormal.z < 46378;
2940  if (engine->IsUnderwater())
2941  v119 = 0;
2942  if (pODMFace->uPolygonType == POLYGON_Floor) {
2943  if (fall_speed < 0) fall_speed = 0;
2944  party_new_Z =
2945  pModel->pVertices.pVertices[pODMFace->pVertexIDs[0]].z + 1;
2946  if (v2 * v2 + v128 * v128 < 400) {
2947  v2 = 0;
2948  *(float *)&v128 = 0.0;
2949  }
2950  if (pParty->floor_face_pid != v45 &&
2951  pODMFace->Pressure_Plate()) {
2952  pParty->floor_face_pid = v45;
2953  trigger_id =
2954  pODMFace->sCogTriggeredID; // this one triggers tour
2955  // events??
2956  }
2957  }
2958  if (!v129 &&
2960  v119)) { // упёрся в столб
2961  v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y +
2962  fall_speed * pODMFace->pFacePlane.vNormal.z +
2963  v2 * pODMFace->pFacePlane.vNormal.x) >>
2964  16;
2965  if ((stru_721530.speed >> 3) > v118)
2966  v118 = stru_721530.speed >> 3;
2967  v2 += fixpoint_mul(v118, pODMFace->pFacePlane.vNormal.x);
2968  v128 += fixpoint_mul(v118, pODMFace->pFacePlane.vNormal.y);
2969  v54 = 0;
2970  if (!v119)
2971  v54 = fixpoint_mul(v118, pODMFace->pFacePlane.vNormal.z);
2972  pParty->uFallSpeed += v54;
2973  v55 =
2975  ((signed int)(pODMFace->pFacePlane.dist +
2976  v122 * pODMFace->pFacePlane.vNormal.z +
2977  _angle_y * pODMFace->pFacePlane.vNormal.y +
2978  _angle_x * pODMFace->pFacePlane.vNormal.x) >>
2979  16);
2980  if (v55 > 0) {
2981  pX = _angle_x +
2982  fixpoint_mul(pODMFace->pFacePlane.vNormal.x, v55);
2983  pY = _angle_y +
2984  fixpoint_mul(pODMFace->pFacePlane.vNormal.y, v55);
2985  if (!v119)
2986  party_new_Z =
2987  v122 +
2988  fixpoint_mul(pODMFace->pFacePlane.vNormal.z, v55);
2989  }
2991  pODMFace->Pressure_Plate()) {
2993  trigger_id = pODMFace->sCogTriggeredID; //
2994  }
2995  }
2996  if (pODMFace->uPolygonType == POLYGON_InBetweenFloorAndWall) {
2997  v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y +
2998  fall_speed * pODMFace->pFacePlane.vNormal.z +
2999  v2 * pODMFace->pFacePlane.vNormal.x) >>
3000  16;
3001  if ((stru_721530.speed >> 3) > v118)
3002  v118 = stru_721530.speed >> 3;
3003  v2 += fixpoint_mul(v118, pODMFace->pFacePlane.vNormal.x);
3004  v128 += fixpoint_mul(v118, pODMFace->pFacePlane.vNormal.y);
3005  fall_speed +=
3006  fixpoint_mul(v118, pODMFace->pFacePlane.vNormal.z);
3007  if (v2 * v2 + v128 * v128 >= 400) {
3009  pODMFace->Pressure_Plate()) {
3011  trigger_id = pODMFace->sCogTriggeredID; //
3012  }
3013  } else {
3014  v2 = 0;
3015  fall_speed = 0;
3016  *(float *)&v128 = 0.0;
3017  }
3018  }
3019  }
3020  v2 = fixpoint_mul(58500, v2);
3021  v128 = fixpoint_mul(58500, v128);
3022  v122 = fixpoint_mul(58500, v122);
3023  fall_speed = fixpoint_mul(58500, fall_speed);
3024  }
3025 
3026  //Воспроизведение звуков ходьбы/бега------------------------
3027  uint pX_ = abs(pParty->vPosition.x - pX);
3028  uint pY_ = abs(pParty->vPosition.y - pY);
3029  uint pZ_ = abs(pParty->vPosition.z - party_new_Z);
3030  if (!engine->config->NoWalkSound() && pParty->walk_sound_timer <= 0) {
3031  pAudioPlayer->StopAll(804); // stop sound
3032  if (party_running_flag && (!hovering || not_high_fall)) {
3033  if (integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) >= 16) {
3034  if (!is_not_on_bmodel &&
3036  .pFaces[(pParty->floor_face_pid >> 3) & 0x3F].Visible()) {
3037  pAudioPlayer->PlaySound(SOUND_RunWood, -1 /*804*/, 1, -1, 0, 0); //бег на 3D Modelи
3038  } else {
3041  WorldPosToGridCellZ(pParty->vPosition.y) - 1, 1);
3042  pAudioPlayer->PlaySound((SoundID)v87, -1 /*804*/, 1, -1, 0, 0); //бег по земле 56
3043  }
3044  pParty->walk_sound_timer = 96; // таймер для бега
3045  }
3046  } else if (party_walking_flag && (!hovering || not_high_fall)) {
3047  if (integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) >= 8) {
3048  if (!is_not_on_bmodel &&
3050  .pFaces[(pParty->floor_face_pid >> 3) & 0x3F].Visible()) {
3051  pAudioPlayer->PlaySound(SOUND_WalkWood, -1 /*804*/, 1, -1, 0, 0); // хождение на 3D Modelи
3052  } else {
3055  WorldPosToGridCellZ(pParty->vPosition.y) - 1, 0);
3056  pAudioPlayer->PlaySound((SoundID)v87, -1 /*804*/, 1, -1, 0, 0); // хождение по земле
3057  }
3058  pParty->walk_sound_timer = 144; // таймер для ходьбы
3059  }
3060  }
3061  }
3062 
3063  if (integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) < 8) //отключить звук ходьбы при остановке
3064  pAudioPlayer->StopAll(804);
3065  //------------------------------------------------------------------------
3066  if (!hovering || !not_high_fall) // или не высокое падение
3068  else
3070  int pMap_X = WorldPosToGridCellX(pParty->vPosition.x);
3071  int pMap_Y = WorldPosToGridCellZ(pParty->vPosition.y) - 1;
3072  unsigned int v114_a = WorldPosToGridCellX(pX);
3073  v66 = WorldPosToGridCellZ(pY) - 1;
3074  unsigned int v122_a = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(pMap_X, pMap_Y) / 2) & 1;
3075  v122 = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(v114_a, pMap_Y) / 2) & 1;
3076  v69 = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(pMap_X, v66) / 2) & 1;
3077 
3078  //-(обновление координат группы)---------------------------------------
3079  v68 = 0;
3080  if (v114_a == pMap_X && v66 == pMap_Y && v122 && v69) v68 = 1;
3081  if (!is_not_on_bmodel) // на bmodel,и
3082  v68 = 1;
3083  if (v68) {
3084  pParty->vPosition.x = pX;
3085  pParty->vPosition.y = pY;
3086  pParty->vPosition.z = party_new_Z;
3087  pParty->field_6F0 = v113;
3088  pParty->uFallSpeed = fall_speed;
3089  if (party_new_Z > 8160) { // ограничение высоты
3090  party_new_Z = 8160;
3091  pParty->uFallStartY = 8160;
3092  pParty->vPosition.z = 8160;
3093  }
3094 
3095  if (!trigger_id //падение на землю
3096  || (EventProcessor(trigger_id, 0, 1), pParty->vPosition.x == pX) &&
3097  pParty->vPosition.y == pY &&
3098  pParty->vPosition.z == party_new_Z) {
3099  if (pParty->vPosition.z < v111) {
3100  pParty->uFallSpeed = 0;
3101  // v73 = v105;
3102  pParty->vPosition.z = on_ground;
3103  if (pParty->uFallStartY - party_new_Z > 512 && !bFeatherFall &&
3104  party_new_Z <= on_ground &&
3105  !engine->IsUnderwater()) { // Fall to the ground(падение на землю с
3106  // высоты)
3109  } else {
3110  for (uint i = 1; i <= 4; ++i) {
3111  pPlayers[i]->ReceiveDamage(
3112  (int)((pParty->uFallStartY -
3113  party_new_Z) *
3114  (uint64_t)((double)pPlayers[i]->GetMaxHealth() * 0.1)) /
3115  256,
3116  DMGT_PHISYCAL);
3117  v110 = 20 - pPlayers[i]->GetParameterBonus(
3118  pPlayers[i]->GetActualEndurance());
3119  pPlayers[i]->SetRecoveryTime(
3120  (signed __int64)((double)v110 *
3122  2.133333333333333));
3123  }
3124  // v73 = pParty->vPosition.z;
3125  }
3126  }
3127  pParty->uFallStartY = party_new_Z;
3128  }
3129  if (v102 && pParty->vPosition.z < ceiling_height) {
3130  if ((signed int)(pParty->uPartyHeight + pParty->vPosition.z) >=
3131  ceiling_height) {
3132  pParty->vPosition.z =
3133  ceiling_height - pParty->uPartyHeight - 1;
3134  pParty->field_6F0 =
3135  ceiling_height - pParty->uPartyHeight - 1;
3136  }
3137  }
3138  pParty->uFlags &= ~0x204;
3139  }
3140  return;
3141  }
3142  //-----------------------------------------------------------------
3143  // v76 = pParty->bFlying;
3144  if (pParty->bFlying || !not_high_fall || bWaterWalk ||
3145  !v122_a) // полёт или высокое падение или хождение по воде или
3146  v77 = 1;
3147  else
3148  v77 = v122 != 0;
3149  bool party_drowning_flag = false;
3150  if (!pParty->bFlying && not_high_fall &&
3151  !bWaterWalk) { // не полёт и не высокое падение и не хождение по воде
3152  if (v122_a) {
3153  v78 = v69 != 0;
3154  } else {
3155  party_drowning_flag = true; //утопление
3156  v78 = true;
3157  }
3158  } else {
3159  v78 = true;
3160  }
3161 
3162  if (v77) pParty->vPosition.x = pX;
3163  if (v78) pParty->vPosition.y = pY;
3164 
3165  if (v78 || v77) {
3166  if (bWaterWalk) {
3168  // v79 = 20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID
3169  // + 6180178;
3170  // *(short *)&stru_5E4C90._decor_events[20 *
3171  // pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |=
3172  // 1u;
3173  v79 =
3175  [20 *
3177  119];
3178  *(short *)v79 |= 1;
3179  if (!v122 || !v69) {
3180  if (!pParty->bFlying) {
3181  v80 = *(short *)v79;
3183  *(short *)v79 = v80 & 0xFFFE;
3184  }
3185  }
3186  }
3187  } else if (!engine->config->NoWalkSound() && pParty->walk_sound_timer <= 0) {
3188  pAudioPlayer->StopAll(804);
3189  pParty->walk_sound_timer = 64;
3190  }
3191 
3192  // v81 = pZ;
3193  // v82 = pZ;
3194  pParty->vPosition.z = party_new_Z;
3195  if (party_new_Z > 8160) { // опять ограничение высоты
3196  // v82 = 8160;
3197  pParty->uFallStartY = 8160;
3198  pParty->vPosition.z = 8160;
3199  }
3200  HEXRAYS_LOWORD(pParty->uFlags) &= 0xFDFBu;
3201  pParty->uFallSpeed = fall_speed;
3202  pParty->field_6F0 = v113;
3203  if (party_drowning_flag) { // группа тонет
3204  bool onWater = false;
3205  pTerrainHeight = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &onWater, 1);
3206  if (pParty->vPosition.z <= pTerrainHeight + 1) { //положение группы всегда +1
3208  }
3209  }
3210 
3211  if (!trigger_id //падение на воду
3212  ||
3213  (EventProcessor(trigger_id, 0, 1), pParty->vPosition.x == pX) &&
3214  pParty->vPosition.y == pY && pParty->vPosition.z == party_new_Z) {
3215  if (pParty->vPosition.z < v111) {
3216  // v82 = on_ground;
3217  pParty->uFallSpeed = 0;
3218  pParty->vPosition.z = on_ground;
3219  if (pParty->uFallStartY - party_new_Z > 512 && !bFeatherFall &&
3220  party_new_Z <= on_ground &&
3221  !engine->IsUnderwater()) { // Fall to the water(падение на воду с высоты)
3224  } else {
3225  for (uint i = 1; i <= 4; ++i) {
3226  v110 = pPlayers[i]->GetMaxHealth();
3227  pPlayers[i]->ReceiveDamage(
3228  (int)((pParty->uFallStartY - party_new_Z) *
3229  (uint64_t)((double)v110 * 0.1)) / 256,
3230  DMGT_PHISYCAL);
3231  v110 = 20 - pPlayers[i]->GetParameterBonus(
3232  pPlayers[i]->GetActualEndurance());
3233  pPlayers[i]->SetRecoveryTime(
3234  (signed __int64)((double)v110 *
3236  2.133333333333333));
3237  }
3238  // v82 = pParty->vPosition.z;
3239  }
3240  }
3241  pParty->uFallStartY = party_new_Z;
3242  }
3243  if (v102 && pParty->vPosition.z < ceiling_height &&
3244  (signed int)(pParty->uPartyHeight + pParty->vPosition.z) >=
3245  ceiling_height) {
3246  pParty->vPosition.z =
3247  pParty->vPosition.z + pParty->uPartyHeight - ceiling_height + 1;
3248  pParty->field_6F0 =
3249  pParty->vPosition.z + pParty->uPartyHeight - ceiling_height + 1;
3250  }
3251  }
3252 }
3253 
3254 int GetCeilingHeight(int Party_X, signed int Party_Y, int Party_ZHeight,
3255  int pFaceID) {
3256  int v13; // eax@25
3257  int v14; // edx@27
3258  int v16; // ST18_4@29
3259  int v17; // edx@29
3260  int64_t v18; // qtt@29
3261  int v19; // eax@35
3262  int v20; // ecx@37
3263  int v22; // ebx@42
3264  int v27; // [sp+10h] [bp-34h]@21
3265  bool v34; // [sp+30h] [bp-14h]@21
3266  bool v35; // [sp+34h] [bp-10h]@23
3267  int v37; // [sp+38h] [bp-Ch]@21
3268  int v38; // [sp+38h] [bp-Ch]@42
3269  int v39; // [sp+3Ch] [bp-8h]@1
3270 
3271  dword_720ED0[0] = -1;
3272  dword_720E80[0] = -1;
3273  v39 = 1;
3274  ceiling_height_level[0] = 10000; //нет потолка
3275  for (BSPModel &model : pOutdoor->pBModels) {
3276  if (Party_X <= model.sMaxX && Party_X >= model.sMinX &&
3277  Party_Y <= model.sMaxY && Party_Y >= model.sMinY) {
3278  for (ODMFace &face : model.pFaces) {
3279  if ((face.uPolygonType == POLYGON_Ceiling ||
3280  face.uPolygonType == POLYGON_InBetweenCeilingAndWall) &&
3281  !face.Ethereal() && Party_X <= face.pBoundingBox.x2 &&
3282  Party_X >= face.pBoundingBox.x1 &&
3283  Party_Y <= face.pBoundingBox.y2 &&
3284  Party_Y >= face.pBoundingBox.y1) {
3285  for (uint v = 0; v < face.uNumVertices; v++) {
3286  word_720DB0_xs[2 * v] =
3287  face.pXInterceptDisplacements[v] +
3288  (short)model.pVertices.pVertices[face.pVertexIDs[v]]
3289  .x;
3290  word_720CE0_ys[2 * v] =
3291  face.pXInterceptDisplacements[v] +
3292  (short)model.pVertices.pVertices[face.pVertexIDs[v]]
3293  .y;
3294  word_720DB0_xs[2 * v + 1] =
3295  face.pXInterceptDisplacements[v] +
3296  (short)model.pVertices
3297  .pVertices[face.pVertexIDs[v + 1]]
3298  .x;
3299  word_720CE0_ys[2 * v + 1] =
3300  face.pXInterceptDisplacements[v] +
3301  (short)model.pVertices
3302  .pVertices[face.pVertexIDs[v + 1]]
3303  .y;
3304  }
3305  v27 = 2 * face.uNumVertices;
3306  word_720DB0_xs[2 * face.uNumVertices] = word_720DB0_xs[0];
3307  word_720CE0_ys[2 * face.uNumVertices] = word_720CE0_ys[0];
3308  v34 = word_720CE0_ys[0] >= Party_Y;
3309  v37 = 0;
3310  for (uint v = 0; v < v27; ++v) {
3311  if (v37 >= 2) break;
3312  v35 = word_720CE0_ys[v + 1] >= Party_Y;
3313  if (v34 != v35) {
3314  v13 = word_720DB0_xs[v + 1] >= Party_X ? 0 : 2;
3315  v14 = v13 | (word_720DB0_xs[v] < Party_X);
3316  if (v14 != 3) {
3317  if (!v14 ||
3318  (v16 = word_720CE0_ys[v + 1] -
3319  word_720CE0_ys[v],
3320  v17 = Party_Y - word_720CE0_ys[v],
3321  HEXRAYS_LODWORD(v18) = v17 << 16,
3322  HEXRAYS_HIDWORD(v18) = v17 >> 16,
3323  (int)(((uint64_t)(
3324  ((int)word_720DB0_xs[v + 1] -
3325  (int)word_720DB0_xs[v]) *
3326  v18 / v16) >>
3327  16) +
3328  word_720DB0_xs[v]) >= Party_X))
3329  ++v37;
3330  }
3331  }
3332  v34 = v35;
3333  }
3334  if (v37 == 1) {
3335  if (v39 >= 20) break;
3336  if (face.uPolygonType == POLYGON_Ceiling)
3337  v19 =
3338  model.pVertices.pVertices[face.pVertexIDs[0]].z;
3339  else
3340  v19 = fixpoint_mul(face.zCalc1, Party_X) +
3341  fixpoint_mul(face.zCalc2, Party_Y) +
3342  HEXRAYS_HIWORD(face.zCalc3);
3343  v20 = v39++;
3344  ceiling_height_level[v20] = v19;
3345  dword_720ED0[v20] = model.index;
3346  dword_720E80[v20] = face.index;
3347  }
3348  }
3349  }
3350  }
3351  }
3352 
3353  if (!v39) {
3354  pFaceID = 0;
3355  return ceiling_height_level[0];
3356  }
3357  v22 = 0;
3358  for (v38 = 0; v38 < v39; ++v38) {
3360  v22 = v38;
3361  else if (ceiling_height_level[v38] < ceiling_height_level[0] &&
3362  ceiling_height_level[0] > Party_ZHeight + 15)
3363  v22 = v38;
3364  else if (ceiling_height_level[v38] > ceiling_height_level[0] &&
3365  ceiling_height_level[v38] <= Party_ZHeight + 15)
3366  v22 = v38;
3367  }
3368  if (v22) {
3369  *(int *)pFaceID = dword_720E80[v22] | (dword_720ED0[v22] << 6);
3370  return ceiling_height_level[v22]; //если есть преграда
3371  }
3372  pFaceID = 0;
3373  return ceiling_height_level[v22]; // нет никакой преграды
3374 }
3375 
3376 //----- (00464839) --------------------------------------------------------
3378  return (pCurrentMapName == "out15.odm");
3379 }
3380 
3381 //----- (00464851) --------------------------------------------------------
3383  day_fogrange_1 = 50;
3384  day_fogrange_2 = 5000;
3385 }
3386 
3387 //----- (00487DA9) --------------------------------------------------------
3388 void sub_487DA9() {
3389  // for (int i = 0; i < 20000; ++i) array_77EC08[i].field_108 = 0;
3390 }
3391 
3392 //----- (004706C6) --------------------------------------------------------
3394  if (engine->config->no_actors)
3395  return; // uNumActors = 0;
3396 
3397  for (unsigned int Actor_ITR = 0; Actor_ITR < uNumActors; ++Actor_ITR) {
3398  if (pActors[Actor_ITR].uAIState == Removed || pActors[Actor_ITR].uAIState == Disabled ||
3399  pActors[Actor_ITR].uAIState == Summoned || !pActors[Actor_ITR].uMovementSpeed)
3400  continue;
3401 
3402  bool Water_Walk = MonsterStats::BelongsToSupertype(pActors[Actor_ITR].pMonsterInfo.uID,
3404 
3405  pActors[Actor_ITR].uSectorID = 0;
3406 
3407  bool uIsFlying = pActors[Actor_ITR].pMonsterInfo.uFlying;
3408  if (!pActors[Actor_ITR].CanAct()) uIsFlying = 0;
3409 
3410  bool Slope_High = IsTerrainSlopeTooHigh(pActors[Actor_ITR].vPosition.x,
3411  pActors[Actor_ITR].vPosition.y);
3412  unsigned int Model_On_PID = 0;
3413  bool uIsOnWater = false;
3414  int Floor_Level = ODM_GetFloorLevel(
3415  pActors[Actor_ITR].vPosition.x, pActors[Actor_ITR].vPosition.y,
3416  pActors[Actor_ITR].vPosition.z, pActors[Actor_ITR].uActorHeight, &uIsOnWater,
3417  (int *)&Model_On_PID, Water_Walk);
3418  bool Actor_On_Terrain = Model_On_PID == 0;
3419 
3420  bool uIsAboveFloor = (pActors[Actor_ITR].vPosition.z > (Floor_Level + 1));
3421 
3422  if (pActors[Actor_ITR].uAIState == Dead && uIsOnWater && !uIsAboveFloor) {
3423  pActors[Actor_ITR].uAIState = Removed;
3424  continue;
3425  }
3426 
3427  // MOVEMENT
3428  if (pActors[Actor_ITR].uCurrentActionAnimation == ANIM_Walking) {
3429  signed int Actor_Speed = pActors[Actor_ITR].uMovementSpeed;
3430  if (pActors[Actor_ITR].pActorBuffs[ACTOR_BUFF_SLOWED].Active())
3431  Actor_Speed = (int64_t)((double)Actor_Speed * 0.5);
3432  if (pActors[Actor_ITR].uAIState == Fleeing ||
3433  pActors[Actor_ITR].uAIState == Pursuing)
3434  Actor_Speed *= 2;
3436  Actor_Speed *= flt_6BE3AC_debug_recmod1_x_1_6;
3437  }
3438  if (Actor_Speed > 1000) Actor_Speed = 1000;
3439 
3440  pActors[Actor_ITR].vVelocity.x =
3441  fixpoint_mul(stru_5C6E00->Cos(pActors[Actor_ITR].uYawAngle), Actor_Speed);
3442  pActors[Actor_ITR].vVelocity.y =
3443  fixpoint_mul(stru_5C6E00->Sin(pActors[Actor_ITR].uYawAngle), Actor_Speed);
3444  if (uIsFlying) {
3445  pActors[Actor_ITR].vVelocity.z = fixpoint_mul(
3446  stru_5C6E00->Sin(pActors[Actor_ITR].uPitchAngle), Actor_Speed);
3447  }
3448  } else {
3449  pActors[Actor_ITR].vVelocity.x =
3450  fixpoint_mul(55000, pActors[Actor_ITR].vVelocity.x);
3451  pActors[Actor_ITR].vVelocity.y =
3452  fixpoint_mul(55000, pActors[Actor_ITR].vVelocity.y);
3453  if (uIsFlying)
3454  pActors[Actor_ITR].vVelocity.z =
3455  fixpoint_mul(55000, pActors[Actor_ITR].vVelocity.z);
3456  }
3457 
3458  // BELOW FLOOR - POP UPWARDS
3459  if (pActors[Actor_ITR].vPosition.z < Floor_Level) {
3460  pActors[Actor_ITR].vPosition.z = Floor_Level;
3461  pActors[Actor_ITR].vVelocity.z = uIsFlying != 0 ? 0x14 : 0;
3462  }
3463  // GRAVITY
3464  if (!uIsAboveFloor || uIsFlying) {
3465  if (Slope_High && !uIsAboveFloor && Actor_On_Terrain) {
3466  Vec3_int_ Terrain_Norm;
3467  pActors[Actor_ITR].vPosition.z = Floor_Level;
3468  ODM_GetTerrainNormalAt(pActors[Actor_ITR].vPosition.x,
3469  pActors[Actor_ITR].vPosition.y, &Terrain_Norm);
3470  uint16_t Gravity = GetGravityStrength();
3471 
3472  pActors[Actor_ITR].vVelocity.z +=
3473  -16 * (short)pEventTimer->uTimeElapsed * Gravity;
3474  int v73 = abs(Terrain_Norm.x * pActors[Actor_ITR].vVelocity.x +
3475  Terrain_Norm.z * pActors[Actor_ITR].vVelocity.z +
3476  Terrain_Norm.y * pActors[Actor_ITR].vVelocity.y) >> 15;
3477 
3478  pActors[Actor_ITR].vVelocity.x += fixpoint_mul(v73, Terrain_Norm.x);
3479  pActors[Actor_ITR].vVelocity.y += fixpoint_mul(v73, Terrain_Norm.y);
3480  pActors[Actor_ITR].uYawAngle -= 32;
3481  // pActors[Actor_ITR].vVelocity.z += fixpoint_mul(v73, Terrain_Norm.z);
3482  }
3483  } else {
3484  pActors[Actor_ITR].vVelocity.z -=
3486  }
3487 
3488  // ARMAGEDDON PANIC
3489  if (pParty->armageddon_timer != 0 && pActors[Actor_ITR].CanAct()) {
3490  pActors[Actor_ITR].vVelocity.x += rand() % 100 - 50;
3491  pActors[Actor_ITR].vVelocity.y += rand() % 100 - 50;
3492  pActors[Actor_ITR].vVelocity.z += rand() % 100 - 20;
3493  pActors[Actor_ITR].uAIState = Stunned;
3494  pActors[Actor_ITR].uYawAngle += rand() % 32 - 16;
3495  pActors[Actor_ITR].UpdateAnimation();
3496  }
3497 
3498  // MOVING TOO SLOW
3499  if (pActors[Actor_ITR].vVelocity.x * pActors[Actor_ITR].vVelocity.x +
3500  pActors[Actor_ITR].vVelocity.y * pActors[Actor_ITR].vVelocity.y <
3501  400 &&
3502  Slope_High == 0) {
3503  pActors[Actor_ITR].vVelocity.y = 0;
3504  pActors[Actor_ITR].vVelocity.x = 0;
3505  }
3506 
3507 
3508  // COLLISIONS
3509  signed int Act_Radius = pActors[Actor_ITR].uActorRadius;
3510  if (!uIsFlying)
3511  Act_Radius = 40;
3512 
3513 
3514  stru_721530.field_0 = 1;
3515  stru_721530.field_84 = -1;
3516  stru_721530.field_8_radius = Act_Radius;
3517  stru_721530.prolly_normal_d = Act_Radius;
3518  stru_721530.height = pActors[Actor_ITR].uActorHeight;
3519  stru_721530.field_70 = 0;
3520 
3521  for (Model_On_PID = 0; Model_On_PID < 100; ++Model_On_PID) {
3522  stru_721530.position.x = pActors[Actor_ITR].vPosition.x;
3524  stru_721530.position.y = pActors[Actor_ITR].vPosition.y;
3526  int Act_Z_Pos = pActors[Actor_ITR].vPosition.z;
3527  stru_721530.normal.z = Act_Z_Pos + Act_Radius + 1;
3528  stru_721530.position.z = Act_Z_Pos - Act_Radius + stru_721530.height - 1;
3530  stru_721530.position.z = Act_Z_Pos + Act_Radius + 1;
3531  stru_721530.velocity.x = pActors[Actor_ITR].vVelocity.x;
3532  stru_721530.uSectorID = 0;
3533  stru_721530.velocity.y = pActors[Actor_ITR].vVelocity.y;
3534  stru_721530.velocity.z = pActors[Actor_ITR].vVelocity.z;
3535  if (stru_721530.CalcMovementExtents(0)) break;
3537  _46E26D_collide_against_sprites(WorldPosToGridCellX(pActors[Actor_ITR].vPosition.x), WorldPosToGridCellZ(pActors[Actor_ITR].vPosition.y));
3540  int v31 = 0;
3541  signed int i;
3542  for (i = 0; v31 < ai_arrays_size; ++v31) {
3543  unsigned int v33 = ai_near_actors_ids[v31];
3544  if (v33 != Actor_ITR && Actor::_46DF1A_collide_against_actor(v33, 40))
3545  ++i;
3546  }
3547  int v71 = i > 1;
3549  Slope_High =
3551  // v34 = 0;
3552  int v35 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
3553  bool bOnWater = false;
3554  int Splash_Model_On;
3555  int Splash_Floor = ODM_GetFloorLevel(
3558  pActors[Actor_ITR].uActorHeight, &bOnWater, &Splash_Model_On, 0);
3559  if (uIsOnWater) {
3560  if (v35 < Splash_Floor + 60) {
3561  if (pActors[Actor_ITR].uAIState == Dead ||
3562  pActors[Actor_ITR].uAIState == Dying ||
3563  pActors[Actor_ITR].uAIState == Removed ||
3564  pActors[Actor_ITR].uAIState == Disabled) {
3565  int Splash_Z = Floor_Level + 60;
3566  if (Splash_Model_On)
3567  Splash_Z = Splash_Floor + 30;
3568 
3570  pActors[Actor_ITR].vPosition.x, pActors[Actor_ITR].vPosition.y,
3571  Splash_Z);
3572  pActors[Actor_ITR].uAIState = Removed;
3573  return;
3574  }
3575  }
3576  }
3578  pActors[Actor_ITR].vPosition.x = (short)stru_721530.normal2.x;
3579  pActors[Actor_ITR].vPosition.y = (short)stru_721530.normal2.y;
3580  pActors[Actor_ITR].vPosition.z = (short)stru_721530.normal2.z -
3581  (short)stru_721530.prolly_normal_d -
3582  1;
3583  break;
3584  }
3585 
3586  pActors[Actor_ITR].vPosition.x +=
3588 
3589  pActors[Actor_ITR].vPosition.y +=
3591 
3592  pActors[Actor_ITR].vPosition.z +=
3595  unsigned int v39 = PID_ID(stru_721530.pid);
3596  int Angle_To_Decor;
3597  signed int Coll_Speed;
3598  switch (PID_TYPE(stru_721530.pid)) {
3599  case OBJECT_Actor:
3602  // if(pParty->bTurnBasedModeOn)
3603  // v34 = 0;
3604  if (pActors[Actor_ITR].pMonsterInfo.uHostilityType) {
3605  if (v71 == 0)
3606  Actor::AI_Flee(Actor_ITR, stru_721530.pid, 0,
3607  (AIDirection *)0);
3608  else
3609  Actor::AI_StandOrBored(Actor_ITR, 4, 0,
3610  (AIDirection *)0);
3611  } else if (v71) {
3612  Actor::AI_StandOrBored(Actor_ITR, 4, 0, (AIDirection *)0);
3613  } else if (pActors[v39].pMonsterInfo.uHostilityType ==
3615  Actor::AI_Flee(Actor_ITR, stru_721530.pid, 0,
3616  (AIDirection *)0);
3617  } else {
3618  Actor::AI_FaceObject(Actor_ITR, stru_721530.pid, 0,
3619  (AIDirection *)0);
3620  }
3621  }
3622  break;
3623  case OBJECT_Player:
3624  if (!pActors[Actor_ITR].GetActorsRelation(0)) {
3625  Actor::AI_FaceObject(Actor_ITR, stru_721530.pid, 0,
3626  (AIDirection *)0);
3627  break;
3628  }
3629 
3630  pActors[Actor_ITR].vVelocity.y = 0;
3631  pActors[Actor_ITR].vVelocity.x = 0;
3632 
3633  if (pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Active()) {
3635  }
3637  break;
3638  case OBJECT_Decoration:
3639  Coll_Speed = integer_sqrt(
3640  pActors[Actor_ITR].vVelocity.x * pActors[Actor_ITR].vVelocity.x +
3641  pActors[Actor_ITR].vVelocity.y * pActors[Actor_ITR].vVelocity.y);
3642  Angle_To_Decor = stru_5C6E00->Atan2(
3643  pActors[Actor_ITR].vPosition.x -
3644  pLevelDecorations[v39].vPosition.x,
3645  pActors[Actor_ITR].vPosition.y -
3646  pLevelDecorations[v39].vPosition.y);
3647 
3648  pActors[Actor_ITR].vVelocity.x =
3649  fixpoint_mul(stru_5C6E00->Cos(Angle_To_Decor), Coll_Speed);
3650  pActors[Actor_ITR].vVelocity.y =
3651  fixpoint_mul(stru_5C6E00->Sin(Angle_To_Decor), Coll_Speed);
3652  break;
3653  case OBJECT_BModel:
3655  .pFaces[v39 & 0x3F];
3656  if (!face->Ethereal()) {
3657  if (face->uPolygonType == 3) {
3658  pActors[Actor_ITR].vVelocity.z = 0;
3659  pActors[Actor_ITR].vPosition.z =
3660  (short)pOutdoor->pBModels[stru_721530.pid >> 9]
3661  .pVertices.pVertices[face->pVertexIDs[0]]
3662  .z +
3663  1;
3664  if (pActors[Actor_ITR].vVelocity.x *
3665  pActors[Actor_ITR].vVelocity.x +
3666  pActors[Actor_ITR].vVelocity.y *
3667  pActors[Actor_ITR].vVelocity.y <
3668  400) {
3669  pActors[Actor_ITR].vVelocity.y = 0;
3670  pActors[Actor_ITR].vVelocity.x = 0;
3671  }
3672  } else {
3673  int v72b = abs(face->pFacePlane.vNormal.y *
3674  pActors[Actor_ITR].vVelocity.y +
3675  face->pFacePlane.vNormal.z *
3676  pActors[Actor_ITR].vVelocity.z +
3677  face->pFacePlane.vNormal.x *
3678  pActors[Actor_ITR].vVelocity.x) >>
3679  16;
3680  if ((stru_721530.speed >> 3) > v72b)
3681  v72b = stru_721530.speed >> 3;
3682 
3683  pActors[Actor_ITR].vVelocity.x +=
3684  fixpoint_mul(v72b, face->pFacePlane.vNormal.x);
3685  pActors[Actor_ITR].vVelocity.y +=
3686  fixpoint_mul(v72b, face->pFacePlane.vNormal.y);
3687  pActors[Actor_ITR].vVelocity.z +=
3688  fixpoint_mul(v72b, face->pFacePlane.vNormal.z);
3689  if (face->uPolygonType != 4) {
3690  int v46 = stru_721530.prolly_normal_d -
3691  ((face->pFacePlane.dist +
3692  face->pFacePlane.vNormal.x *
3693  pActors[Actor_ITR].vPosition.x +
3694  face->pFacePlane.vNormal.y *
3695  pActors[Actor_ITR].vPosition.y +
3696  face->pFacePlane.vNormal.z *
3697  pActors[Actor_ITR].vPosition.z) >>
3698  16);
3699  if (v46 > 0) {
3700  pActors[Actor_ITR].vPosition.x += fixpoint_mul(
3701  v46, face->pFacePlane.vNormal.x);
3702  pActors[Actor_ITR].vPosition.y += fixpoint_mul(
3703  v46, face->pFacePlane.vNormal.y);
3704  pActors[Actor_ITR].vPosition.z += fixpoint_mul(
3705  v46, face->pFacePlane.vNormal.z);
3706  }
3707  pActors[Actor_ITR].uYawAngle = stru_5C6E00->Atan2(
3708  pActors[Actor_ITR].vVelocity.x,
3709  pActors[Actor_ITR].vVelocity.y);
3710  }
3711  }
3712  }
3713  break;
3714  }
3715 
3716  pActors[Actor_ITR].vVelocity.x =
3717  fixpoint_mul(58500, pActors[Actor_ITR].vVelocity.x);
3718  pActors[Actor_ITR].vVelocity.y =
3719  fixpoint_mul(58500, pActors[Actor_ITR].vVelocity.y);
3720  pActors[Actor_ITR].vVelocity.z =
3721  fixpoint_mul(58500, pActors[Actor_ITR].vVelocity.z);
3722 
3723  Act_Radius = stru_721530.prolly_normal_d;
3724  }
3725 
3726  // WATER TILE CHECKING
3727  if (!Water_Walk) {
3728  // tile on (1) tile heading (2)
3729  unsigned int Tile_1_Land = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(
3730  WorldPosToGridCellX(pActors[Actor_ITR].vPosition.x),
3731  WorldPosToGridCellZ(pActors[Actor_ITR].vPosition.y) - 1) >>
3732  1) & 1;
3733  unsigned int Tile_2_Land = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(
3734  WorldPosToGridCellX(pActors[Actor_ITR].vPosition.x +
3735  pActors[Actor_ITR].vVelocity.x),
3736  WorldPosToGridCellZ(pActors[Actor_ITR].vPosition.y +
3737  pActors[Actor_ITR].vVelocity.y) - 1) >>
3738  1) & 1;
3739 
3740  if (!uIsFlying && Tile_1_Land && !Tile_2_Land) {
3741  // approaching water - turn away
3742  if (pActors[Actor_ITR].CanAct()) {
3743  pActors[Actor_ITR].uYawAngle -= 32;
3744  pActors[Actor_ITR].uCurrentActionTime = 0;
3745  pActors[Actor_ITR].uCurrentActionLength = 128;
3746  pActors[Actor_ITR].uAIState = Fleeing;
3747  }
3748  }
3749  if (!uIsFlying && Tile_1_Land == 0 && !uIsAboveFloor && Actor_On_Terrain) {
3750  // on water and shouldnt be
3751  unsigned int Tile_Test_Land = 0; // reset land found
3752  int Grid_X = WorldPosToGridCellX(pActors[Actor_ITR].vPosition.x);
3753  int Grid_Z = WorldPosToGridCellZ(pActors[Actor_ITR].vPosition.y);
3754  for (int i = Grid_X - 1; i <= Grid_X + 1; i++) {
3755  // scan surrounding cells for land
3756  for (int j = Grid_Z - 1; j <= Grid_Z + 1; j++) {
3757  Tile_Test_Land = ((unsigned int)~pOutdoor->
3758  ActuallyGetSomeOtherTileInfo(i, j - 1) >> 1) & 1;
3759  if (Tile_Test_Land) { // found land
3760  int target_x = GridCellToWorldPosX(i);
3761  int target_y = GridCellToWorldPosZ(j - 1);
3762  if (pActors[Actor_ITR].CanAct()) { // head to land
3763  pActors[Actor_ITR].uYawAngle = stru_5C6E00->Atan2(target_x -
3764  pActors[Actor_ITR].vPosition.x, target_y -
3765  pActors[Actor_ITR].vPosition.y);
3766  pActors[Actor_ITR].uCurrentActionTime = 0;
3767  pActors[Actor_ITR].uCurrentActionLength = 128;
3768  pActors[Actor_ITR].uAIState = Fleeing;
3769  break;
3770  }
3771  }
3772  }
3773  if (Tile_Test_Land) { // break out nested loop
3774  break;
3775  }
3776  }
3777  if (!Tile_Test_Land) {
3778  // no land found so drowning damage
3779  // pActors[Actor_ITR].sCurrentHP -= 1;
3780  // logger->Warning(L"DROWNING");
3781  }
3782  }
3783  }
3784  }
3785 }
3786 
3787 //----- (0047A384) --------------------------------------------------------
3788 void ODM_LoadAndInitialize(const String &pFilename, ODMRenderParams *thisa) {
3789  MapInfo *v4; // edi@4
3790  // size_t v7; // eax@19
3791 
3792  // thisa->AllocSoftwareDrawBuffers();
3794  pWeather->bRenderSnow = false;
3795  render->ClearZBuffer(0, 479);
3796  // thisa = (ODMRenderParams *)1;
3797  GetAlertStatus();
3800  unsigned int respawn_interval = 0;
3801  if (v2) {
3802  v4 = &pMapStats->pInfos[v2];
3803  respawn_interval = v4->uRespawnIntervalDays;
3804  } else {
3805  v4 = (MapInfo*)1;
3806  }
3807  day_attrib &= ~DAY_ATTRIB_FOG;
3809  int v;
3810  pOutdoor->Initialize(pFilename, pParty->GetPlayingTime().GetDays() + 1, respawn_interval, &v);
3811  if (!(dword_6BE364_game_settings_1 & GAME_SETTINGS_2000)) {
3814  }
3815  dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_2000;
3816  // v5 = 0;
3817  if (!v2) v = 0;
3818  if (v == 1) {
3819  // v13 = 0;
3820  for (uint i = 0; i < pOutdoor->uNumSpawnPoints; ++i) {
3821  SpawnPointMM7 *spawn = pOutdoor->pSpawnPoints + i;
3822 
3823  if (spawn->IsMonsterSpawn())
3824  SpawnEncounter(v4, spawn, 0, 0, 0);
3825  else
3826  v4->SpawnRandomTreasure(spawn);
3827  }
3829  }
3833  pOutdoor->MessWithLUN();
3834  pOutdoor->level_filename = pFilename;
3835  pWeather->Initialize();
3838  // pODMRenderParams->RotationToInts();
3840 
3841  float fov_rad;
3842  float fov_rad_inv;
3843  //----- (0042394D) --------------------------------------------------------
3844  // void IndoorCamera::Initialize(int degFov, unsigned int uViewportWidth,
3845  // unsigned int uViewportHeight)
3846  {
3847  // pIndoorCamera->Initialize(65, viewparams->uScreen_BttmR_X -
3848  // viewparams->uScreen_topL_X + 1,
3849  // viewparams->uScreen_BttmR_Y -
3850  // viewparams->uScreen_topL_Y + 1);
3851 
3852  int uViewportWidth =
3854 
3855  extern float _calc_fov(int viewport_width, int angle_degree);
3856  fov_rad = _calc_fov(uViewportWidth, 65);
3857  fov_rad_inv = 65536.0 / fov_rad;
3858  }
3859  pODMRenderParams->int_fov_rad = (signed __int64)fov_rad;
3860  pODMRenderParams->int_fov_rad_inv = (signed __int64)fov_rad_inv;
3861 
3862  for (int i = 0; i < 20000; ++i) {
3863  array_77EC08[i].ptr_38 = &SkyBillboard;
3864 
3865  array_77EC08[i].ptr_48 = nullptr;
3866  }
3867 
3869 }
3870 
3871 unsigned int GetLevelFogColor() {
3872  if (engine->IsUnderwater()) {
3873  return 0xFF258F5C;
3874  }
3875 
3876  if (day_attrib & DAY_ATTRIB_FOG) {
3877  if (pWeather->bNight) { // night-time fog
3878  if (false) {
3879  logger->Warning(
3880  L"decompilation can be inaccurate, please send savegame to "
3881  L"Nomad");
3882  __debugbreak();
3883  }
3884  int v2 = -(pWeather->bNight != 1);
3885  return (v2 & 0xE0E0E1) - 0xE0E0E1;
3886  } else {
3887  __int64 v1 = (__int64)((1.0 - pOutdoor->fFogDensity) * 200.0 +
3888  pOutdoor->fFogDensity * 31.0);
3889  return v1 |
3890  (((unsigned int)v1 | (((unsigned int)v1 | 0xFFFFFF00) << 8))
3891  << 8);
3892  }
3893  }
3894 
3895  return 0;
3896 }
3897 
3898 int sub_47C3D7_get_fog_specular(int a1, int a2, float a3) {
3899  int v7;
3900 
3901  int v3 = pWeather->bNight;
3902  if (engine->IsUnderwater())
3903  v3 = 0;
3904  if (pParty->armageddon_timer ||
3905  !(day_attrib & DAY_ATTRIB_FOG) && !engine->IsUnderwater())
3906  return 0xFF000000;
3907  if (v3) {
3908  if (a3 < (double)day_fogrange_1) {
3909  v7 = 0;
3910  if (a3 == 0.0) v7 = 216;
3911  if (a2) v7 = 248;
3912  return (-1 - v7) << 24;
3913  } else {
3914  if (a3 > (double)day_fogrange_2) {
3915  v7 = 216;
3916  if (a3 == 0.0) v7 = 216;
3917  if (a2) v7 = 248;
3918  return (-1 - v7) << 24;
3919  }
3920  v7 = (signed __int64)((a3 - (double)day_fogrange_1) /
3921  ((double)day_fogrange_2 -
3922  (double)day_fogrange_1) *
3923  216.0);
3924  }
3925  } else {
3926  if (a3 < (double)day_fogrange_1) {
3927  v7 = 0;
3928  if (a3 == 0.0) v7 = 216;
3929  if (a2) v7 = 248;
3930  return (-1 - v7) << 24;
3931  } else {
3932  if (a3 > (double)day_fogrange_2) {
3933  v7 = 216;
3934  if (a3 == 0.0) v7 = 216;
3935  if (a2) v7 = 248;
3936  return (-1 - v7) << 24;
3937  } else {
3938  v7 =
3939  floorf(((a3 - (double)day_fogrange_1) * 216.0 /
3940  ((double)day_fogrange_2 - (double)day_fogrange_1)) +
3941  0.5f);
3942  }
3943  }
3944  }
3945  if (v7 > 216) {
3946  v7 = 216;
3947  } else {
3948  if (a3 == 0.0) v7 = 216;
3949  }
3950  if (a2) v7 = 248;
3951  return (-1 - v7) << 24;
3952 }
3953 
3954 //----- (0047F44B) --------------------------------------------------------
3955 unsigned int WorldPosToGridCellX(int sWorldPosX) {
3956  return (sWorldPosX >> 9) +
3957  64; // sar is in original exe, resulting -880 / 512 = -1
3958  // and -880 sar 9 = -2
3959 }
3960 
3961 //----- (0047F458) --------------------------------------------------------
3962 unsigned int WorldPosToGridCellZ(int sWorldPosZ) {
3963  return 64 - (sWorldPosZ >>
3964  9); // sar is in original exe, resulting -880 / 512 = -1
3965  // and -880 sar 9 = -2
3966 }
3967 
3968 //----- (0047F469) --------------------------------------------------------
3969 int GridCellToWorldPosX(int a1) { return (a1 - 64) << 9; }
3970 
3971 //----- (0047F476) --------------------------------------------------------
3972 int GridCellToWorldPosZ(int a1) { return (64 - a1) << 9; }
3973 
3974 
3975 //----- (004823F4) --------------------------------------------------------
3976 bool IsTerrainSlopeTooHigh(int pos_x, int pos_z) {
3977  // unsigned int v2; // ebx@1
3978  // unsigned int v3; // edi@1
3979  // int v4; // eax@1
3980  // int v6; // esi@5
3981  // int v7; // ecx@6
3982  // int v8; // edx@6
3983  // int v9; // eax@6
3984  // int y_min; // esi@10
3985  // int v11; // [sp+14h] [bp-8h]@1
3986  // int v12; // [sp+18h] [bp-4h]@1
3987 
3988  // v12 = a1;
3989  // v11 = a2;
3990  unsigned int grid_x = WorldPosToGridCellX(pos_x);
3991  unsigned int grid_z = WorldPosToGridCellZ(pos_z) - 1;
3992 
3993  int party_grid_x1 = GridCellToWorldPosX(grid_x);
3994  // dword_76D56C_terrain_cell_world_pos_around_party_x =
3995  // GridCellToWorldPosX(grid_x + 1);
3996  // dword_76D570_terrain_cell_world_pos_around_party_x =
3997  // GridCellToWorldPosX(grid_x + 1);
3998  // dword_76D574_terrain_cell_world_pos_around_party_x =
3999  // GridCellToWorldPosX(grid_x);
4000  int party_grid_z1 = GridCellToWorldPosZ(grid_z);
4001  // dword_76D55C_terrain_cell_world_pos_around_party_z =
4002  // GridCellToWorldPosZ(grid_z);
4003  // dword_76D560_terrain_cell_world_pos_around_party_z =
4004  // GridCellToWorldPosZ(grid_z + 1);
4005  // dword_76D564_terrain_cell_world_pos_around_party_z =
4006  // GridCellToWorldPosZ(grid_z + 1);
4007  int party_x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z);
4008  int party_x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z);
4009  int party_x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1);
4010  int party_x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1);
4011  // dword_76D554_terrain_cell_world_pos_around_party_y = v4;
4012  if (party_x1z1_y == party_x2z1_y && party_x2z1_y == party_x2z2_y &&
4013  party_x2z2_y == party_x1z2_y)
4014  return false;
4015 
4016  int dx = abs(pos_x - party_grid_x1), dz = abs(party_grid_z1 - pos_z);
4017 
4018  int y1, y2, y3;
4019  if (dz >= dx) {
4020  y1 = party_x1z2_y;
4021  y2 = party_x2z2_y;
4022  y3 = party_x1z1_y;
4023  /* lower-left triangle
4024  y3 | \
4025  | \
4026  | \
4027  |______ \
4028  y1 y2 */
4029  } else {
4030  y1 = party_x2z1_y; // upper-right
4031  y2 = party_x1z1_y; // y2_______ y1
4032  y3 = party_x2z2_y; // \ |
4033  /* \ |
4034  \ |
4035  y3 */
4036  }
4037 
4038  int y_min = std::min(y1, std::min(y2, y3)); // не верно при подъёме на склон
4039  int y_max = std::max(y1, std::max(y2, y3));
4040  return (y_max - y_min) > 512;
4041 }
4042 
4043 //----- (0048257A) --------------------------------------------------------
4044 int GetTerrainHeightsAroundParty2(int a1, int a2, bool *pIsOnWater, int bFloatAboveWater) {
4045  // int result; // eax@9
4046  int v8; // ebx@11
4047  int v9; // eax@11
4048  int v10; // ecx@11
4049  int v13; // [sp+10h] [bp-8h]@11
4050  signed int v14; // [sp+14h] [bp-4h]@3
4051  int v15; // [sp+24h] [bp+Ch]@11
4052 
4053  unsigned int grid_x = WorldPosToGridCellX(a1);
4054  unsigned int grid_z = WorldPosToGridCellZ(a2) - 1;
4055 
4056  int grid_x1 = GridCellToWorldPosX(grid_x),
4057  grid_x2 = GridCellToWorldPosX(grid_x + 1);
4058  int grid_z1 = GridCellToWorldPosZ(grid_z),
4059  grid_z2 = GridCellToWorldPosZ(grid_z + 1);
4060 
4061  int y_x1z1 = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z),
4062  y_x2z1 = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z),
4063  y_x2z2 = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1),
4064  y_x1z2 = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1);
4065  // v4 = WorldPosToGridCellX(a1);
4066  // v5 = WorldPosToGridCellZ(v12) - 1;
4067  // dword_76D538_terrain_cell_world_pos_around_party_x =
4068  // GridCellToWorldPosX(v4);
4069  // dword_76D53C_terrain_cell_world_pos_around_party_x =
4070  // GridCellToWorldPosX(v4 + 1);
4071  // dword_76D540_terrain_cell_world_pos_around_party_x =
4072  // GridCellToWorldPosX(v4 + 1);
4073  // dword_76D544_terrain_cell_world_pos_around_party_x =
4074  // GridCellToWorldPosX(v4);
4075  // dword_76D528_terrain_cell_world_pos_around_party_z =
4076  // GridCellToWorldPosZ(v5);
4077  // dword_76D52C_terrain_cell_world_pos_around_party_z =
4078  // GridCellToWorldPosZ(v5);
4079  // dword_76D530_terrain_cell_world_pos_around_party_z =
4080  // GridCellToWorldPosZ(v5 + 1);
4081  // dword_76D534_terrain_cell_world_pos_around_party_z =
4082  // GridCellToWorldPosZ(v5 + 1);
4083  // dword_76D518_terrain_cell_world_pos_around_party_y =
4084  // pOutdoor->DoGetHeightOnTerrain(v4, v5);
4085  // dword_76D51C_terrain_cell_world_pos_around_party_y =
4086  // pOutdoor->DoGetHeightOnTerrain(v4 + 1, v5);
4087  // dword_76D520_terrain_cell_world_pos_around_party_y =
4088  // pOutdoor->DoGetHeightOnTerrain(v4 + 1, v5 + 1);
4089  // dword_76D524_terrain_cell_world_pos_around_party_y =
4090  // pOutdoor->DoGetHeightOnTerrain(v4, v5 + 1);
4091  *pIsOnWater = false;
4092  if (pOutdoor->ActuallyGetSomeOtherTileInfo(grid_x, grid_z) & 2)
4093  *pIsOnWater = true;
4094  v14 = 0;
4095  if (!bFloatAboveWater && *pIsOnWater) v14 = -60;
4096  if (y_x1z1 != y_x2z1 || y_x2z1 != y_x2z2 || y_x2z2 != y_x1z2) {
4097  if (abs(grid_z1 - a2) >= abs(a1 - grid_x1)) {
4098  v8 = y_x1z2;
4099  v9 = y_x2z2;
4100  v10 = y_x1z1;
4101  v15 = a1 - grid_x1;
4102  v13 = a2 - grid_z2;
4103  } else {
4104  v8 = y_x2z1;
4105  v9 = y_x1z1;
4106  v10 = y_x2z2;
4107  v15 = grid_x2 - a1;
4108  v13 = grid_z1 - a2;
4109  }
4110  return v14 + v8 + fixpoint_mul(v13, (v10 - v8) * 128) +
4111  fixpoint_mul(v15, (v9 - v8) * 128);
4112  } else {
4113  return y_x1z1;
4114  }
4115 }
Tileset_Snow
@ Tileset_Snow
Definition: TileFrameTable.h:27
current_BModel_id
std::array< int, 20 > current_BModel_id
Definition: mm7_data.cpp:735
SpriteFrameTable::GetFrameBy_x
SpriteFrame * GetFrameBy_x(unsigned int uSpriteID, signed int a3)
Definition: Sprites.cpp:304
uint16_t
unsigned __int16 uint16_t
Definition: SDL_config.h:37
SpriteObject
Definition: SpriteObject.h:189
PARTY_FLAGS_1_FALLING
@ PARTY_FLAGS_1_FALLING
Definition: Party.h:58
OutdoorLocationTerrain::ZeroLandscape
bool ZeroLandscape()
Definition: Outdoor.cpp:875
TE_MOVEMENT
@ TE_MOVEMENT
Definition: TurnEngine.h:22
LightsStack_StationaryLight_::uNumLightsActive
unsigned int uNumLightsActive
Definition: Lights.h:65
OutdoorLocationTerrain::pHeightmap
uint8_t * pHeightmap
Definition: Outdoor.h:55
OutdoorLocation::uSpriteID_LUN1_4_cp
unsigned int uSpriteID_LUN1_4_cp
Definition: Outdoor.h:149
fWalkSpeedMultiplier
float fWalkSpeedMultiplier
Definition: mm7_data.cpp:706
Vec3_float_
Definition: VectorTypes.h:74
ParticleEngine.h
TE_ATTACK
@ TE_ATTACK
Definition: TurnEngine.h:21
uNumActors
size_t uNumActors
Definition: Actor.cpp:39
TileTable::InitializeTileset
void InitializeTileset(Tileset tileset)
Definition: TileTable.cpp:27
DMGT_PHISYCAL
@ DMGT_PHISYCAL
Definition: Items.h:15
Party::vPosition
Vec3_int_ vPosition
Definition: Party.h:250
Engine_::IocContainer
Definition: IocContainer.h:15
BSPModel::pVertices
struct BSPVertexBuffer pVertices
Definition: BSPModel.h:189
face
GLenum GLuint GLint GLenum face
Definition: SDL_opengl_glext.h:3022
pNew_LOD
LOD::WriteableFile * pNew_LOD
Definition: LOD.cpp:24
OutdoorLocation::uNumSpawnPoints
unsigned int uNumSpawnPoints
Definition: Outdoor.h:129
Tileset_Swamp
@ Tileset_Swamp
Definition: TileFrameTable.h:33
odm_floor_face_vert_coord_X
std::array< __int16, 104 > odm_floor_face_vert_coord_X
Definition: mm7_data.cpp:733
uSpriteID_Spell11
int uSpriteID_Spell11
Definition: mm7_data.cpp:577
SpriteFrame::hw_sprites
Sprite * hw_sprites[8]
Definition: Sprites.h:46
array_507D30
RenderVertexSoft array_507D30[50]
Definition: RenderOpenGL.cpp:58
pLevelDecorations
std::array< LevelDecoration, 3000 > pLevelDecorations
Definition: Decoration.cpp:8
RenderBillboard::hwsprite
Sprite * hwsprite
Definition: IRender.h:32
Party::uFallSpeed
int uFallSpeed
Definition: Party.h:259
Dying
@ Dying
Definition: Actor.h:79
OutdoorLocation::pOMAP
unsigned int * pOMAP
Definition: Outdoor.h:122
Viewport.h
ceiling_height_level
std::array< int, 20 > ceiling_height_level
Definition: mm7_data.cpp:731
Timer::uTimeElapsed
unsigned int uTimeElapsed
Definition: Time.h:133
TrailParticleGenerator::UpdateParticles
void UpdateParticles()
Definition: ParticleEngine.cpp:37
Party::field_24
int field_24
Definition: Party.h:245
IndoorCameraD3D::sRotationY
int sRotationY
Definition: IndoorCameraD3D.h:247
v
const GLdouble * v
Definition: SDL_opengl.h:2064
OutdoorLocation::PrepareDecorations
bool PrepareDecorations()
Definition: Outdoor.cpp:1583
Party::uCurrentMonth
unsigned int uCurrentMonth
Definition: Party.h:272
MapStats::pInfos
MapInfo pInfos[77]
Definition: MapInfo.h:79
stru141_actor_collision_object::field_6C
int field_6C
Definition: Indoor.h:168
LOD.h
Image::GetHeight
unsigned int GetHeight()
Definition: Image.cpp:230
Party::GetPlayingTime
GameTime & GetPlayingTime()
Definition: Party.h:230
DecorationList::GetDecoration
DecorationDesc * GetDecoration(unsigned int index)
Definition: DecorationList.h:65
RenderBillboard::screen_space_x
int16_t screen_space_x
Definition: IRender.h:39
stru193_math::uDoublePiMask
static const unsigned int uDoublePiMask
Definition: OurMath.h:91
Actor::AI_StandOrBored
static void AI_StandOrBored(unsigned int uActorID, signed int uObjID, int uActionLength, struct AIDirection *a4)
Definition: Actor.cpp:1100
GameTime::GetDays
int GetDays() const
Definition: Time.h:32
PARTY_StrafeLeft
@ PARTY_StrafeLeft
Definition: Party.h:98
MapStartPoint
MapStartPoint
Definition: MapInfo.h:27
Vec2::x
T x
Definition: VectorTypes.h:12
dword_720E80
std::array< int, 20 > dword_720E80
Definition: mm7_data.cpp:729
SpriteFrame::uGlowRadius
int uGlowRadius
Definition: Sprites.h:49
ODMRenderParams::uNumBillboards
unsigned int uNumBillboards
Definition: IRender.h:90
AssetsManager::GetImage_Solid
Texture * GetImage_Solid(const String &name)
Definition: AssetsManager.cpp:51
DecorationList.h
fTurnSpeedMultiplier
float fTurnSpeedMultiplier
Definition: mm7_data.cpp:708
Party::uCurrentMinute
unsigned int uCurrentMinute
Definition: Party.h:276
SpriteFrame::icon_name
String icon_name
Definition: Sprites.h:43
OutdoorLocation::inv_sunlight_y
int inv_sunlight_y
Definition: Outdoor.h:158
SPEECH_63
@ SPEECH_63
Definition: Player.h:109
DMap
Definition: Outdoor.h:29
pSpriteFrameTable
struct SpriteFrameTable * pSpriteFrameTable
Definition: Sprites.cpp:22
OutdoorLocation::pBModels
BSPModelList pBModels
Definition: Outdoor.h:119
pSpriteObjects
std::array< SpriteObject, MAX_SPRITE_OBJECTS > pSpriteObjects
Definition: SpriteObject.cpp:34
OutdoorLocation::IsMapCellPartiallyRevealed
bool IsMapCellPartiallyRevealed(signed int a2, signed int a3)
Definition: Outdoor.cpp:1559
stru141_actor_collision_object::speed
int speed
Definition: Indoor.h:166
PARTY_LookDown
@ PARTY_LookDown
Definition: Party.h:103
pSprites_LOD
LODFile_Sprites * pSprites_LOD
Definition: LOD.cpp:20
LODFile_IconsBitmaps::uNumLoadedFiles
unsigned int uNumLoadedFiles
Definition: LOD.h:159
RenderBillboard::uIndoorSectorID
int16_t uIndoorSectorID
Definition: IRender.h:34
Polygon
Definition: Polygon.h:14
MAP_CELESTIA
@ MAP_CELESTIA
Definition: MapInfo.h:13
ai_arrays_size
int ai_arrays_size
Definition: mm7_data.cpp:503
Tileset_Grass
@ Tileset_Grass
Definition: TileFrameTable.h:26
Vec3_float_::x
float x
Definition: VectorTypes.h:89
SkyBillboardStruct
Definition: IRender.h:465
BSPModel::index
unsigned int index
Definition: BSPModel.h:167
uNumBillboardsToDraw
unsigned int uNumBillboardsToDraw
Definition: RenderOpenGL.cpp:55
OutdoorLocation::GetNumFoodRequiredToRestInCurrentPos
int GetNumFoodRequiredToRestInCurrentPos(int x, signed int y, int z)
Definition: Outdoor.cpp:457
uNumTerrainNormals
uint32_t uNumTerrainNormals
Definition: mm7_data.cpp:755
ItemsTable::SetSpecialBonus
void SetSpecialBonus(ItemGen *pItem)
Definition: Items.cpp:472
OutdoorLocation::GetFogDensityByTime
double GetFogDensityByTime()
Definition: Outdoor.cpp:172
stru141_actor_collision_object::uSectorID
unsigned int uSectorID
Definition: Indoor.h:170
OutdoorLocationTerrain::Initialize
bool Initialize()
Definition: Outdoor.cpp:890
OutdoorLocation::field_D44
int field_D44
Definition: Outdoor.h:166
OutdoorLocation::field_D64
int field_D64
Definition: Outdoor.h:174
OutdoorLocation::uFullyRevealedCellOnMap
unsigned char uFullyRevealedCellOnMap[88][11]
Definition: Outdoor.h:134
Weather::bRenderSnow
bool bRenderSnow
Definition: Weather.h:18
Party::sRotationX
int sRotationX
Definition: Party.h:252
day_fogrange_2
int day_fogrange_2
Definition: mm7_data.cpp:699
LegacyImages.h
ViewingParams::location_minimap
class Image * location_minimap
Definition: Viewport.h:73
Tileset_CooledLava
@ Tileset_CooledLava
Definition: TileFrameTable.h:29
TileDesc::tileset
Tileset tileset
Definition: TileFrameTable.h:49
OutdoorLocation::inv_sunlight_z
int inv_sunlight_z
Definition: Outdoor.h:159
_4E94D3_light_type
char _4E94D3_light_type
Definition: mm7_data.cpp:307
z
GLdouble GLdouble z
Definition: SDL_opengl_glext.h:407
Engine_::IocContainer::ResolveLogger
static Log * ResolveLogger()
Definition: IocContainer.cpp:51
Party::FeatherFallActive
bool FeatherFallActive()
Definition: Party.h:214
ODMRenderParams::bDoNotRenderDecorations
unsigned int bDoNotRenderDecorations
Definition: IRender.h:97
ODM_Project
void ODM_Project(unsigned int uNumVertices)
Definition: Outdoor.cpp:2180
ODMRenderParams::uNumPolygons
int uNumPolygons
Definition: IRender.h:86
MapStats::GetMapInfo
MAP_TYPE GetMapInfo(const String &Str2)
Definition: MapInfo.cpp:225
ODMRenderParams::uMapGridCellX
unsigned int uMapGridCellX
Definition: IRender.h:105
MAP_TATALIA
@ MAP_TATALIA
Definition: MapInfo.h:19
Actor
Definition: Actor.h:151
OutdoorLocation::sky_texture
Texture * sky_texture
Definition: Outdoor.h:123
uDefaultTravelTime_ByFoot
int uDefaultTravelTime_ByFoot
Definition: mm7_data.cpp:696
LightmapBuilder::uFlags
int uFlags
Definition: LightmapBuilder.h:97
AudioPlayer::PlaySound
void PlaySound(SoundID eSoundID, int pid, unsigned int uNumRepeats, int x, int y, int a7)
Definition: AudioPlayer.cpp:195
OutdoorLocationTileType::tileset
Tileset tileset
Definition: Outdoor.h:23
POLYGON_InBetweenFloorAndWall
@ POLYGON_InBetweenFloorAndWall
Definition: Indoor.h:221
SpriteObject.h
MonsterInfo::Hostility_Friendly
@ Hostility_Friendly
Definition: Monsters.h:111
BSPModelData
Definition: BSPModel.h:58
day_attrib
int day_attrib
Definition: mm7_data.cpp:697
OutdoorLocation::MessWithLUN
void MessWithLUN()
Definition: Outdoor.cpp:389
WorldPosToGridCellX
unsigned int WorldPosToGridCellX(int sWorldPosX)
Definition: Outdoor.cpp:3955
engine
std::shared_ptr< Engine > engine
Definition: Engine.cpp:130
word_720CE0_ys
std::array< __int16, 777 > word_720CE0_ys
Definition: mm7_data.cpp:727
SpriteFrame::scale
fixed scale
Definition: Sprites.h:47
LevelDecoration::IsInteractive
bool IsInteractive()
Definition: Decoration.cpp:345
AssetsManager::ReleaseAllImages
bool ReleaseAllImages()
Definition: AssetsManager.cpp:14
OutdoorLocation::PrepareActorsDrawList
void PrepareActorsDrawList()
Definition: Outdoor.cpp:1722
stru193_math::uIntegerHalfPi
static const unsigned int uIntegerHalfPi
Definition: OurMath.h:89
day_fogrange_1
int day_fogrange_1
Definition: mm7_data.cpp:698
RenderBillboard::dimming_level
uint16_t dimming_level
Definition: IRender.h:43
OutdoorLocationTerrain::pAttributemap
uint8_t * pAttributemap
Definition: Outdoor.h:57
Party::uDefaultPartyHeight
unsigned int uDefaultPartyHeight
Definition: Party.h:238
Actor::AI_FaceObject
static void AI_FaceObject(unsigned int uActorID, unsigned int uObjID, int UNUSED, struct AIDirection *Dir_In)
Definition: Actor.cpp:1072
ViewingParams::draw_d3d_outlines
int draw_d3d_outlines
Definition: Viewport.h:78
LOD::File::DoesContainerExist
bool DoesContainerExist(const String &filename)
Definition: LOD.cpp:833
Party::FlyActive
bool FlyActive()
Definition: Party.h:202
PARTY_BUFF_WATER_WALK
@ PARTY_BUFF_WATER_WALK
Definition: Party.h:89
IndoorCameraD3D::sRotationX
int sRotationX
Definition: IndoorCameraD3D.h:248
SetUnderwaterFog
void SetUnderwaterFog()
Definition: Outdoor.cpp:3382
UIRest.h
Party::uCurrentHour
unsigned int uCurrentHour
Definition: Party.h:275
PARTY_WalkForward
@ PARTY_WalkForward
Definition: Party.h:100
PaletteManager.h
LightmapBuilder.h
RenderBillboard::screen_space_z
int16_t screen_space_z
Definition: IRender.h:41
UpdateObjects
void UpdateObjects()
Definition: Render.cpp:4955
OutdoorLocation::uSpriteID_LUNFULL
unsigned int uSpriteID_LUNFULL
Definition: Outdoor.h:143
stru141_actor_collision_object::normal
Vec3_int_ normal
Definition: Indoor.h:159
int64_t
__int64 int64_t
Definition: alext.h:31
Party::pPlayers
std::array< Player, 4 > pPlayers
Definition: Party.h:310
OutdoorLocation::field_CE8
int field_CE8
Definition: Outdoor.h:144
OutdoorLocation::OutdoorLocation
OutdoorLocation()
Definition: Outdoor.cpp:2158
RenderBillboard::world_z
int16_t world_z
Definition: IRender.h:38
LevelDecoration::uEventID
uint16_t uEventID
Definition: Decoration.h:31
ODMFace::sCogTriggeredID
int16_t sCogTriggeredID
Definition: BSPModel.h:147
OutdoorLocation::decal_builder
DecalBuilder * decal_builder
Definition: Outdoor.h:180
SpriteFrame::uPaletteIndex
int uPaletteIndex
Definition: Sprites.h:51
SpawnPointMM7
Definition: Indoor.h:304
OutdoorLocation::fFogDensity
float fFogDensity
Definition: Outdoor.h:176
ODMFace::uPolygonType
uint8_t uPolygonType
Definition: BSPModel.h:156
ACTOR_BUFF_SLOWED
@ ACTOR_BUFF_SLOWED
Definition: Actor.h:45
SpellFxRenderer::_4A7F74
void _4A7F74(int x, int y, int z)
Definition: SpellFxRenderer.cpp:611
SpellFxRenderer.h
Tileset_Water
@ Tileset_Water
Definition: TileFrameTable.h:31
MAP_PIERPONT
@ MAP_PIERPONT
Definition: MapInfo.h:10
dword_4EC2AC
int dword_4EC2AC
Definition: Outdoor.cpp:81
POLYGON_Floor
@ POLYGON_Floor
Definition: Indoor.h:220
OBJECT_Decoration
@ OBJECT_Decoration
Definition: Actor.h:69
BSPModelList::Load
uint8_t * Load(uint8_t *data)
Definition: BSPModel.cpp:45
OutdoorLocation::IsMapCellFullyRevealed
bool IsMapCellFullyRevealed(signed int a2, signed int a3)
Definition: Outdoor.cpp:1549
WorldPosToGridCellZ
unsigned int WorldPosToGridCellZ(int sWorldPosZ)
Definition: Outdoor.cpp:3962
Sprite::texture
Texture * texture
Definition: Sprites.h:28
MAP_STEADWICK
@ MAP_STEADWICK
Definition: MapInfo.h:9
OutdoorLocation::UpdateFog
void UpdateFog()
Definition: Outdoor.cpp:453
RenderBillboard::pSpriteFrame
SpriteFrame * pSpriteFrame
Definition: IRender.h:45
Vec3_float_::y
float y
Definition: VectorTypes.h:90
Vec3_float_::z
float z
Definition: VectorTypes.h:91
uint64_t
unsigned __int64 uint64_t
Definition: alext.h:32
pPlayers
NZIArray< struct Player *, 5 > pPlayers
Definition: Player.cpp:46
RenderVertexSoft::vWorldViewProjY
float vWorldViewProjY
Definition: IRender.h:119
Party::field_6F0
int field_6F0
Definition: Party.h:261
Texture_MM7::paletted_pixels
uint8_t * paletted_pixels
Definition: Image.h:102
DecorationList::GetDecorIdByName
uint16_t GetDecorIdByName(const char *pName)
Definition: DecorationList.cpp:60
TurnEngine.h
TileTable::pTiles
TileDesc * pTiles
Definition: TileFrameTable.h:91
BBox_short_::z2
int16_t z2
Definition: VectorTypes.h:119
GetCeilingHeight
int GetCeilingHeight(int Party_X, signed int Party_Y, int Party_ZHeight, int pFaceID)
Definition: Outdoor.cpp:3254
OutdoorLocation::UpdateSunlightVectors
void UpdateSunlightVectors()
Definition: Outdoor.cpp:429
SPEECH_Falling_scream
@ SPEECH_Falling_scream
Definition: Player.h:112
Actor::_46DF1A_collide_against_actor
static bool _46DF1A_collide_against_actor(int a1, int a2)
Definition: Actor.cpp:2699
Chest.h
Engine.h
Lights.h
OutdoorLocation::field_F4
int field_F4
Definition: Outdoor.h:127
MAP_HARMONDALE
@ MAP_HARMONDALE
Definition: MapInfo.h:8
Plane_int_::vNormal
Vec3_int_ vNormal
Definition: VectorTypes.h:107
pTurnEngine
struct stru262_TurnBased * pTurnEngine
Definition: TurnEngine.cpp:21
Dead
@ Dead
Definition: Actor.h:80
Resurrected
@ Resurrected
Definition: Actor.h:91
ACTOR_BUFF_SHRINK
@ ACTOR_BUFF_SHRINK
Definition: Actor.h:41
MapStartPoint_North
@ MapStartPoint_North
Definition: MapInfo.h:29
result
GLuint64EXT * result
Definition: SDL_opengl_glext.h:9435
pMapStats
struct MapStats * pMapStats
Definition: mm7_data.cpp:20
AIDirection
Definition: Actor.h:126
Party::pPartyBuffs
std::array< SpellBuff, 20 > pPartyBuffs
Definition: Party.h:309
Polygon::field_24
int field_24
Definition: Polygon.h:32
AudioPlayer::StopAll
void StopAll(int sample_id)
Definition: AudioPlayer.cpp:189
PARTY_FlyUp
@ PARTY_FlyUp
Definition: Party.h:108
MAP_AVLEE
@ MAP_AVLEE
Definition: MapInfo.h:20
OutdoorLocation::DoGetTile
TileDesc * DoGetTile(int uX, int uZ)
Definition: Outdoor.cpp:1389
FogProbabilityTableEntry::__unused__
unsigned char __unused__
Definition: Outdoor.cpp:58
OBJECT_Actor
@ OBJECT_Actor
Definition: Actor.h:67
RenderBillboard::field_1E
int16_t field_1E
Definition: IRender.h:35
Events.h
Party::uFallStartY
int uFallStartY
Definition: Party.h:265
trail_particle_generator
TrailParticleGenerator trail_particle_generator
Definition: ParticleEngine.cpp:13
OutdoorLocation::inv_sunlight_x
int inv_sunlight_x
Definition: Outdoor.h:157
fixed::FromInt
static fixed FromInt(int value)
Definition: OurMath.h:29
OutdoorLocation::ground_tileset
String ground_tileset
Definition: Outdoor.h:115
Party::uPartyHeight
unsigned int uPartyHeight
Definition: Party.h:237
OutdoorLocation::field_D4C
int field_D4C
Definition: Outdoor.h:168
OutdoorLocation::LoadTileGroupIds
bool LoadTileGroupIds()
Definition: Outdoor.cpp:1713
Actor.h
OutdoorLocationTerrain::field_18
int field_18
Definition: Outdoor.h:63
ViewingParams::uScreen_BttmR_X
unsigned int uScreen_BttmR_X
Definition: Viewport.h:62
OutdoorLocation::main_tile_texture
Texture * main_tile_texture
Definition: Outdoor.h:124
ODMFace::pBoundingBox
struct BBox_short_ pBoundingBox
Definition: BSPModel.h:145
OutdoorLocation::pCmap
void * pCmap
Definition: Outdoor.h:118
OutdoorLocation::uPartiallyRevealedCellOnMap
unsigned char uPartiallyRevealedCellOnMap[88][11]
Definition: Outdoor.h:138
ny
GLfixed ny
Definition: SDL_opengl_glext.h:4523
PARTY_FLAGS_1_STANDING_ON_WATER
@ PARTY_FLAGS_1_STANDING_ON_WATER
Definition: Party.h:61
pItemsTable
struct ItemsTable * pItemsTable
Definition: Items.cpp:37
TileDesc::GetTexture
Texture * GetTexture()
Definition: TileFrameTable.h:53
GUIWindow_Travel
Definition: UITransition.h:5
Tilset_Desert
@ Tilset_Desert
Definition: TileFrameTable.h:28
MAP_BARROW_DOWNS
@ MAP_BARROW_DOWNS
Definition: MapInfo.h:17
RenderVertexSoft::vWorldViewPosition
Vec3_float_ vWorldViewPosition
Definition: IRender.h:117
PARTY_FLAGS_1_LANDING
@ PARTY_FLAGS_1_LANDING
Definition: Party.h:62
ODMRenderParams
Definition: IRender.h:55
GetAlertStatus
int GetAlertStatus()
Definition: Indoor.cpp:5287
ODMRenderParams::int_fov_rad_inv
int int_fov_rad_inv
Definition: IRender.h:80
FogProbabilityTableEntry::dense_fog_chance
unsigned char dense_fog_chance
Definition: Outdoor.cpp:57
Texture_MM7::header
TextureHeader header
Definition: Image.h:101
MapInfo::SpawnRandomTreasure
int SpawnRandomTreasure(struct SpawnPointMM7 *a2)
Definition: MapInfo.cpp:240
pWeather
Weather * pWeather
Definition: Weather.cpp:8
MAP_INVALID
@ MAP_INVALID
Definition: MapInfo.h:6
y
EGLSurface EGLint EGLint y
Definition: SDL_egl.h:1596
DecalBuilder::Reset
void Reset(bool bPreserveBloodsplats)
Definition: DecalBuilder.cpp:58
OutdoorLocation::ActuallyGetSomeOtherTileInfo
int ActuallyGetSomeOtherTileInfo(signed int uX, signed int uY)
Definition: Outdoor.cpp:1459
Image::GetWidth
unsigned int GetWidth()
Definition: Image.cpp:217
OutdoorLocation::GetSomeOtherTileInfo
int GetSomeOtherTileInfo(int sX, int sY)
Definition: Outdoor.cpp:197
rest_ui_hourglass_frame_current
Image * rest_ui_hourglass_frame_current
Definition: UIRest.cpp:32
PARTY_LookUp
@ PARTY_LookUp
Definition: Party.h:102
IndoorCameraD3D::vPartyPos
Vec3< int > vPartyPos
Definition: IndoorCameraD3D.h:253
Tileset_Badlands
@ Tileset_Badlands
Definition: TileFrameTable.h:32
OutdoorLocation::pSpriteIDs_LUN
unsigned int pSpriteIDs_LUN[8]
Definition: Outdoor.h:142
FogProbabilityTableEntry::average_fog_chance
unsigned char average_fog_chance
Definition: Outdoor.cpp:56
Vec2::y
T y
Definition: VectorTypes.h:13
MapStartPoint_East
@ MapStartPoint_East
Definition: MapInfo.h:31
OutdoorLocation::pFaceIDLIST
uint16_t * pFaceIDLIST
Definition: Outdoor.h:121
BSPModel::sMinY
int32_t sMinY
Definition: BSPModel.h:175
OutdoorLocation::ExecDraw
void ExecDraw(unsigned int bRedraw)
Definition: Outdoor.cpp:84
stru141_actor_collision_object::field_0
int field_0
Definition: Indoor.h:151
ViewingParams::uScreen_topL_X
unsigned int uScreen_topL_X
Definition: Viewport.h:60
pParty
Party * pParty
Definition: Party.cpp:30
OutdoorLocation::log
Log * log
Definition: Outdoor.h:179
DDM_DLV_Header::uNumFacesInBModels
unsigned int uNumFacesInBModels
Definition: Indoor.h:98
bankersRounding
int bankersRounding(const FloatType &value)
Definition: OurMath.h:98
OutdoorLocation::uLastSunlightUpdateMinute
int uLastSunlightUpdateMinute
Definition: Outdoor.h:177
DDM_DLV_Header::uNumRespawns
int uNumRespawns
Definition: Indoor.h:94
flt_6BE3AC_debug_recmod1_x_1_6
float flt_6BE3AC_debug_recmod1_x_1_6
Definition: mm7_data.cpp:718
PaletteManager::pPalette_mistColor
uint8_t pPalette_mistColor[3]
Definition: PaletteManager.h:35
OutdoorLocation::uSpriteID_LUN_SUN
uint16_t uSpriteID_LUN_SUN
Definition: Outdoor.h:151
_46ED8A_collide_against_sprite_objects
void _46ED8A_collide_against_sprite_objects(unsigned int _this)
Definition: Render.cpp:4732
RenderVertexSoft::vWorldViewProjX
float vWorldViewProjX
Definition: IRender.h:118
ODMFace::pVertexIDs
uint16_t pVertexIDs[20]
Definition: BSPModel.h:136
OutdoorLocation::_47F0E2
bool _47F0E2()
Definition: Outdoor.cpp:1569
dword_4EC268
std::array< int, 9 > dword_4EC268
Definition: Outdoor.cpp:78
Polygon::uNumVertices
unsigned int uNumVertices
Definition: Polygon.h:30
stru141_actor_collision_object::field_8_radius
int field_8_radius
Definition: Indoor.h:153
PARTY_Land
@ PARTY_Land
Definition: Party.h:110
odm_floor_level
std::array< int, 20 > odm_floor_level
Definition: mm7_data.cpp:736
LEVEL_DECORATION_INVISIBLE
@ LEVEL_DECORATION_INVISIBLE
Definition: Decoration.h:14
RenderBillboard::uPalette
int16_t uPalette
Definition: IRender.h:33
Party::bFlying
unsigned int bFlying
Definition: Party.h:266
LocationTime_stru1::last_visit
GameTime last_visit
Definition: Indoor.h:274
OutdoorLocation::location_filename
String location_filename
Definition: Outdoor.h:112
OutdoorLocation::lightmap_builder
LightmapBuilder * lightmap_builder
Definition: Outdoor.h:182
nz
GLfixed GLfixed nz
Definition: SDL_opengl_glext.h:4523
TileTable::GetTileForTerrainType
int GetTileForTerrainType(signed int a1, bool a2)
Definition: TileTable.cpp:40
RenderBillboard::object_pid
uint16_t object_pid
Definition: IRender.h:42
ACTOR_BUFF_PARALYZED
@ ACTOR_BUFF_PARALYZED
Definition: Actor.h:44
FogProbabilityTableEntry
Definition: Outdoor.cpp:54
GetGravityStrength
unsigned int GetGravityStrength()
Definition: Engine.cpp:1500
pTerrainNormals
struct Vec3_float_ * pTerrainNormals
Definition: mm7_data.cpp:756
ACTOR_BUFF_MASS_DISTORTION
@ ACTOR_BUFF_MASS_DISTORTION
Definition: Actor.h:48
stru141_actor_collision_object::normal2
Vec3_int_ normal2
Definition: Indoor.h:161
ITEM_ARTIFACT_LADYS_ESCORT
@ ITEM_ARTIFACT_LADYS_ESCORT
Definition: Items.h:189
ZlibWrapper.h
ITEM_ARTIFACT_HERMES_SANDALS
@ ITEM_ARTIFACT_HERMES_SANDALS
Definition: Items.h:182
OBJECT_BModel
@ OBJECT_BModel
Definition: Actor.h:70
TileFrameTable.h
OutdoorLocation::loc_time
LocationTime_stru1 loc_time
Definition: Outdoor.h:132
x
EGLSurface EGLint x
Definition: SDL_egl.h:1596
OutdoorLocation
Definition: Outdoor.h:68
pDefaultSkyTexture
std::array< char, 777 > pDefaultSkyTexture
Definition: mm7_data.cpp:701
stru193_math::pTanTable
int pTanTable[520]
Definition: OurMath.h:85
SkyBillboardStruct::CalcSkyFrustumVec
void CalcSkyFrustumVec(int a2, int a3, int a4, int a5, int a6, int a7)
Definition: RenderOpenGL.cpp:62
ODM_GetTerrainNormalAt
void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out)
Definition: Outdoor.cpp:2052
stru141_actor_collision_object::field_7C
int field_7C
Definition: Indoor.h:172
SpriteFrameTable::GetFrame
SpriteFrame * GetFrame(unsigned int uSpriteID, unsigned int uTime)
Definition: Sprites.cpp:277
pGameLoadingUI_ProgressBar
GUIProgressBar * pGameLoadingUI_ProgressBar
Definition: GUIProgressBar.cpp:14
viewparams
struct ViewingParams * viewparams
Definition: mm7_data.cpp:22
OutdoorLocationTerrain::_47CB57
int _47CB57(unsigned char *pixels_8bit, int a2, int num_pixels)
Definition: Outdoor.cpp:784
OS_GetTime
unsigned int OS_GetTime()
Definition: Lin.cpp:12
Disabled
@ Disabled
Definition: Actor.h:94
OutdoorLocation::field_D5C
int field_D5C
Definition: Outdoor.h:172
MAP_SHOALS
@ MAP_SHOALS
Definition: MapInfo.h:21
PARTY_FlyDown
@ PARTY_FlyDown
Definition: Party.h:109
PARTY_FastTurnRight
@ PARTY_FastTurnRight
Definition: Party.h:114
Weather::Initialize
void Initialize()
Definition: Weather.cpp:41
Polygon::v_18
Vec3_int_ v_18
Definition: Polygon.h:31
ODMRenderParams::uCameraFovInDegrees
unsigned int uCameraFovInDegrees
Definition: IRender.h:78
SpriteFrameTable::ResetSomeSpriteFlags
void ResetSomeSpriteFlags()
Definition: Sprites.cpp:32
MM7Initialization
void MM7Initialization()
Definition: Engine.cpp:1287
stru123.h
_46E889_collide_against_bmodels
void _46E889_collide_against_bmodels(unsigned int ecx0)
Definition: Render.cpp:4516
PARTY_TurnRight
@ PARTY_TurnRight
Definition: Party.h:97
UpdateActors_ODM
void UpdateActors_ODM()
Definition: Outdoor.cpp:3393
check_event_triggers
void check_event_triggers()
Definition: Events.cpp:1215
OutdoorLocation::field_D0C
int field_D0C
Definition: Outdoor.h:154
PARTY_CenterView
@ PARTY_CenterView
Definition: Party.h:104
PARTY_RunBackward
@ PARTY_RunBackward
Definition: Party.h:112
Engine_::IocContainer::ResolveDecalBuilder
static DecalBuilder * ResolveDecalBuilder()
Definition: IocContainer.cpp:60
AssetsManager::GetImage_ColorKey
Texture * GetImage_ColorKey(const String &name, uint16_t colorkey)
Definition: AssetsManager.cpp:34
stru123::_decor_events
std::array< unsigned char, 125 > _decor_events
Definition: stru123.h:8
Timer::dt_in_some_format
int dt_in_some_format
Definition: Time.h:134
OutdoorLocationTerrain::pDmap
struct DMap * pDmap
Definition: Outdoor.h:58
IndoorCameraD3D::ViewClip
bool ViewClip(int x, int y, int z, int *transformed_x, int *transformed_y, int *transformed_z, bool dont_show=false)
Definition: IndoorCameraD3D.cpp:172
_strlwr
void _strlwr(char *src)
Definition: PlatformLinux.h:8
v1
GLfloat GLfloat v1
Definition: SDL_opengl_glext.h:694
Polygon::_normalize_v_18
void _normalize_v_18()
Definition: Render.cpp:5598
TileDesc
Definition: TileFrameTable.h:43
Log::Warning
void Warning(const wchar_t *pFormat,...)
Definition: Log.cpp:28
MAP_THE_PIT
@ MAP_THE_PIT
Definition: MapInfo.h:14
OutdoorLocation::location_file_description
String location_file_description
Definition: Outdoor.h:113
DDM_DLV_Header::uNumDecorations
unsigned int uNumDecorations
Definition: Indoor.h:99
TileDesc::uAttributes
uint16_t uAttributes
Definition: TileFrameTable.h:51
IndoorCameraD3D::Project
void Project(int x, int y, int z, int *screenspace_x, int *screenspace_y)
Definition: IndoorCameraD3D.cpp:1137
LevelDecoration::uFlags
uint16_t uFlags
Definition: Decoration.h:27
OutdoorLocation::uSpriteID_LUN3_4_cp
unsigned int uSpriteID_LUN3_4_cp
Definition: Outdoor.h:145
sub_487DA9
void sub_487DA9()
Definition: Outdoor.cpp:3388
OutdoorLocationTerrain::Release
void Release()
Definition: Outdoor.cpp:609
OutdoorLocation::Load
bool Load(const String &filename, int days_played, int respawn_interval_days, int *thisa)
Definition: Outdoor.cpp:980
stru141_actor_collision_object::field_70
int field_70
Definition: Indoor.h:169
OutdoorLocation::field_CF8
int field_CF8
Definition: Outdoor.h:148
AudioPlayer::StopChannels
void StopChannels(int uStartChannel, int uEndChannel)
Definition: AudioPlayer.cpp:331
DDM_DLV_Header::uLastRepawnDay
int uLastRepawnDay
Definition: Indoor.h:95
fixpoint_mul
__int64 fixpoint_mul(int a1, int a2)
Definition: OurMath.cpp:138
stru141_actor_collision_object::height
int height
Definition: Indoor.h:154
pActors
std::array< Actor, 500 > pActors
Definition: Actor.cpp:38
nx
GLbyte nx
Definition: SDL_opengl_glext.h:5716
BSPModel::sMinX
int32_t sMinX
Definition: BSPModel.h:174
Party.h
LocationTime_stru1::day_fogrange_1
int day_fogrange_1
Definition: Indoor.h:277
ODM_LoadAndInitialize
void ODM_LoadAndInitialize(const String &pFilename, ODMRenderParams *thisa)
Definition: Outdoor.cpp:3788
ODM_ProcessPartyActions
void ODM_ProcessPartyActions()
Definition: Outdoor.cpp:2221
SPEECH_64
@ SPEECH_64
Definition: Player.h:110
MapStartPoint_South
@ MapStartPoint_South
Definition: MapInfo.h:30
uNumLevelDecorations
size_t uNumLevelDecorations
Definition: Decoration.cpp:9
ActionQueue::Next
PartyAction Next()
Definition: Party.cpp:1204
Party::uFlags
unsigned int uFlags
Definition: Party.h:313
f
GLfloat f
Definition: SDL_opengl_glext.h:1873
_46EF01_collision_chech_player
int _46EF01_collision_chech_player(int a1)
Definition: Render.cpp:4790
Party::field_6E0
int field_6E0
Definition: Party.h:257
SpellFxRenderer::_4A806F_get_mass_distortion_value
float _4A806F_get_mass_distortion_value(struct Actor *pActor)
Definition: SpellFxRenderer.cpp:648
Weather.h
EQUIP_POTION
@ EQUIP_POTION
Definition: Items.h:241
pTileTable
struct TileTable * pTileTable
Definition: mm7_data.cpp:700
Party::uWalkSpeed
unsigned int uWalkSpeed
Definition: Party.h:243
OutdoorLocation::uSpriteID_LUN1_2_cp
unsigned int uSpriteID_LUN1_2_cp
Definition: Outdoor.h:147
OutdoorLocation::field_D14
int field_D14
Definition: Outdoor.h:156
OutdoorLocationTerrain::field_12
int16_t field_12
Definition: Outdoor.h:60
TextureHeader::uDecompressedSize
uint32_t uDecompressedSize
Definition: Image.h:90
fog_probability_table
struct FogProbabilityTableEntry fog_probability_table[15]
DDM_DLV_Header
Definition: Indoor.h:82
rest_ui_sky_frame_current
Image * rest_ui_sky_frame_current
Definition: UIRest.cpp:31
Viewport::uScreenCenterY
int uScreenCenterY
Definition: Viewport.h:29
_46E26D_collide_against_sprites
void _46E26D_collide_against_sprites(int a1, int a2)
Definition: Sprites.cpp:447
PARTY_FLAGS_1_WATER_DAMAGE
@ PARTY_FLAGS_1_WATER_DAMAGE
Definition: Party.h:57
AssetsManager::GetBitmap
Texture * GetBitmap(const String &name)
Definition: AssetsManager.cpp:126
GridCellToWorldPosZ
int GridCellToWorldPosZ(int a1)
Definition: Outdoor.cpp:3972
pPartyActionQueue
struct ActionQueue * pPartyActionQueue
Definition: Party.cpp:32
ODMFace::IsBackfaceNotCulled
static bool IsBackfaceNotCulled(struct RenderVertexSoft *a2, struct Polygon *polygon)
Definition: Outdoor.cpp:522
ViewingParams::uSomeZ
int uSomeZ
Definition: Viewport.h:57
MapInfo
Definition: MapInfo.h:35
OutdoorLocation::field_F0
int16_t field_F0
Definition: Outdoor.h:125
pGames_LOD
LOD::File * pGames_LOD
Definition: LOD.cpp:25
OutdoorLocationTerrain::field_1C
int field_1C
Definition: Outdoor.h:64
OutdoorLocation::GetHeightOnTerrain
int GetHeightOnTerrain(int sX, int sZ)
Definition: Outdoor.cpp:228
TE_WAIT
@ TE_WAIT
Definition: TurnEngine.h:20
LevelDecoration
Definition: Decoration.h:20
OutdoorLocationTerrain::FillDMap
void FillDMap(int X, int Y, int W, int Z)
Definition: Outdoor.cpp:623
_6BE134_odm_main_tile_group
int _6BE134_odm_main_tile_group
Definition: mm7_data.cpp:703
pCurrentMapName
String pCurrentMapName
Definition: mm7_data.cpp:712
LEVEL_DECORATION_OBELISK_CHEST
@ LEVEL_DECORATION_OBELISK_CHEST
Definition: Decoration.h:15
Removed
@ Removed
Definition: Actor.h:86
dword_4EC2A8
int dword_4EC2A8
Definition: Outdoor.cpp:80
pPaletteManager
PaletteManager * pPaletteManager
Definition: PaletteManager.cpp:7
OutdoorLocation::GetTileIdByTileMapId
int GetTileIdByTileMapId(signed int a2)
Definition: Outdoor.cpp:1368
GetTerrainHeightsAroundParty2
int GetTerrainHeightsAroundParty2(int a1, int a2, bool *pIsOnWater, int bFloatAboveWater)
Definition: Outdoor.cpp:4044
OutdoorLocation::vSunlight
Vec3_int_ vSunlight
Definition: Outdoor.h:163
OutdoorLocation::sky_texture_filename
String sky_texture_filename
Definition: Outdoor.h:114
LocationTime_stru1::day_fogrange_2
int day_fogrange_2
Definition: Indoor.h:278
OutdoorLocation::field_D40
int field_D40
Definition: Outdoor.h:165
LocationTime_stru1::sky_texture_name
char sky_texture_name[12]
Definition: Indoor.h:275
ViewingParams::uSomeX
int uSomeX
Definition: Viewport.h:55
LevelDecoration::uCog
uint16_t uCog
Definition: Decoration.h:30
OutdoorLocationTerrain::pTilemap
uint8_t * pTilemap
Definition: Outdoor.h:56
TextureHeader::uTextureWidth
uint16_t uTextureWidth
Definition: Image.h:82
SpriteObject::InitializeSpriteObjects
static void InitializeSpriteObjects()
Definition: SpriteObject.cpp:898
pMiscTimer
Timer * pMiscTimer
Definition: Time.cpp:7
OutdoorLocation::field_D60
int field_D60
Definition: Outdoor.h:173
SpriteFrameTable::InitializeSprite
void InitializeSprite(signed int uSpriteID)
Definition: Sprites.cpp:46
OutdoorLocation::max_terrain_dimming_level
int max_terrain_dimming_level
Definition: Outdoor.h:140
TileTable::GetTileById
TileDesc * GetTileById(unsigned int uTileID)
Definition: TileTable.cpp:21
RenderBillboard::screenspace_projection_factor_y
float screenspace_projection_factor_y
Definition: IRender.h:28
Outdoor.h
LevelDecoration::uDecorationDescID
uint16_t uDecorationDescID
Definition: Decoration.h:26
OutdoorLocation::ddm
struct DDM_DLV_Header ddm
Definition: Outdoor.h:131
MAP_DEYJA
@ MAP_DEYJA
Definition: MapInfo.h:11
Plane_int_::dist
int dist
Definition: VectorTypes.h:108
_6807E0_num_decorations_with_sounds_6807B8
int _6807E0_num_decorations_with_sounds_6807B8
Definition: mm7_data.cpp:686
PARTY_TurnLeft
@ PARTY_TurnLeft
Definition: Party.h:96
OutdoorLocation::field_D08
int field_D08
Definition: Outdoor.h:153
OutdoorLocation::SetFog
void SetFog()
Definition: Outdoor.cpp:483
RenderBillboard::screen_space_y
int16_t screen_space_y
Definition: IRender.h:40
AudioPlayer.h
ODMFace::Pressure_Plate
bool Pressure_Plate() const
Definition: BSPModel.h:111
OBJECT_Player
@ OBJECT_Player
Definition: Actor.h:68
SkyBillboard
SkyBillboardStruct SkyBillboard
Definition: Outdoor.cpp:51
Party::bTurnBasedModeOn
bool bTurnBasedModeOn
Definition: Party.h:305
pViewport
struct Viewport * pViewport
Definition: mm7_data.cpp:21
Summoned
@ Summoned
Definition: Actor.h:92
TextureHeader::uTextureHeight
uint16_t uTextureHeight
Definition: Image.h:83
OutdoorLocationTileType
Definition: Outdoor.h:22
OutdoorLocationTerrain::field_14
int16_t field_14
Definition: Outdoor.h:61
MonsterStats::BelongsToSupertype
static bool BelongsToSupertype(unsigned int uMonsterInfoID, enum MONSTER_SUPERTYPE eSupertype)
Definition: Monsters.cpp:1200
PaletteManager::RecalculateAll
void RecalculateAll()
Definition: PaletteManager.cpp:784
Party::field_6E4
int field_6E4
Definition: Party.h:258
SpriteFrameTable::FastFindSprite
int FastFindSprite(const char *pSpriteName)
Definition: Sprites.cpp:243
stru193_math::uPiMask
static const unsigned int uPiMask
Definition: OurMath.h:92
OutdoorLocation::pSpawnPoints
struct SpawnPointMM7 * pSpawnPoints
Definition: Outdoor.h:130
uNumDecorationsDrawnThisFrame
int uNumDecorationsDrawnThisFrame
Definition: RenderOpenGL.cpp:53
PARTY_BUFF_INVISIBILITY
@ PARTY_BUFF_INVISIBILITY
Definition: Party.h:82
Weather::bNight
bool bNight
Definition: Weather.h:17
OutdoorLocationTerrain::field_10
int16_t field_10
Definition: Outdoor.h:59
Party::armageddon_timer
int armageddon_timer
Definition: Party.h:320
BSPModel::sMaxY
int32_t sMaxY
Definition: BSPModel.h:178
uint8_t
unsigned __int8 uint8_t
Definition: SDL_config.h:35
Party::uCurrentDayOfMonth
unsigned int uCurrentDayOfMonth
Definition: Party.h:274
OutdoorLocation::spell_fx_renderer
SpellFxRenderer * spell_fx_renderer
Definition: Outdoor.h:181
LightsStack_MobileLight_::uNumLightsActive
unsigned int uNumLightsActive
Definition: Lights.h:88
GetLevelFogColor
unsigned int GetLevelFogColor()
Definition: Outdoor.cpp:3871
MonsterList::pMonsters
struct MonsterDesc * pMonsters
Definition: Monsters.h:237
dword_4EC28C
std::array< int, 7 > dword_4EC28C
Definition: Outdoor.cpp:79
Polygon::flags
__int16 flags
Definition: Polygon.h:35
GridCellToWorldPosX
int GridCellToWorldPosX(int a1)
Definition: Outdoor.cpp:3969
uNumSpriteObjects
size_t uNumSpriteObjects
Definition: SpriteObject.cpp:33
OutdoorLocationTerrain::_47C7A9
void _47C7A9()
Definition: Outdoor.cpp:599
LOD::File::LoadCompressed
void * LoadCompressed(const String &pContainer, size_t *data_size=nullptr)
Definition: LOD.cpp:965
ActionQueue::uNumActions
unsigned int uNumActions
Definition: Party.h:128
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1112
odm_floor_face_vert_coord_Y
std::array< __int16, 104 > odm_floor_face_vert_coord_Y
Definition: mm7_data.cpp:732
stru193_math::Atan2
unsigned int Atan2(int x, int y)
Definition: OurMath.cpp:46
Tileset_Dirt
@ Tileset_Dirt
Definition: TileFrameTable.h:30
MapStartPoint_West
@ MapStartPoint_West
Definition: MapInfo.h:32
OutdoorLocation::numFaceIDListElems
unsigned int numFaceIDListElems
Definition: Outdoor.h:120
VertexRenderList
RenderVertexSoft VertexRenderList[50]
Definition: Render.cpp:52
stru141_actor_collision_object::field_84
int field_84
Definition: Indoor.h:174
name
EGLImageKHR EGLint * name
Definition: SDL_egl.h:1497
OutdoorLocation::Release
void Release()
Definition: Outdoor.cpp:952
RenderBillboard::world_y
int16_t world_y
Definition: IRender.h:37
pODMRenderParams
ODMRenderParams * pODMRenderParams
Definition: Outdoor.cpp:49
ODMRenderParams::field_50
int field_50
Definition: IRender.h:95
RenderBillboard::field_14_actor_id
int field_14_actor_id
Definition: IRender.h:31
Party::field_14_radius
int field_14_radius
Definition: Party.h:241
MAP_TYPE
MAP_TYPE
Definition: MapInfo.h:5
stru141_actor_collision_object::prolly_normal_d
int prolly_normal_d
Definition: Indoor.h:152
PaletteManager::SetMistColor
void SetMistColor(unsigned char r, unsigned char g, unsigned char b)
Definition: PaletteManager.cpp:776
TextureHeader::palette_id2
int16_t palette_id2
Definition: Image.h:89
Viewport::uScreenCenterX
int uScreenCenterX
Definition: Viewport.h:28
ACTOR_BUFF_STONED
@ ACTOR_BUFF_STONED
Definition: Actor.h:43
pTerrainSomeOtherData
std::array< unsigned int, 128 *128 *2 > pTerrainSomeOtherData
Definition: mm7_data.cpp:758
pMonsterList
struct MonsterList * pMonsterList
Definition: Monsters.cpp:9
flt_6BE150_look_up_down_dangle
float flt_6BE150_look_up_down_dangle
Definition: mm7_data.cpp:709
LevelDecoration::_idx_in_stru123
int16_t _idx_in_stru123
Definition: Decoration.h:34
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11096
OutdoorLocationTerrain::field_16
int16_t field_16
Definition: Outdoor.h:62
DecorationDesc_mm6::uSoundID
int16_t uSoundID
Definition: DecorationList.h:45
OutdoorLocation::field_D2C
int field_D2C
Definition: Outdoor.h:162
v2
GLfloat GLfloat GLfloat v2
Definition: SDL_opengl_glext.h:695
ODMRenderParams::uMapGridCellZ
unsigned int uMapGridCellZ
Definition: IRender.h:106
flt_6BE3A4_debug_recmod1
float flt_6BE3A4_debug_recmod1
Definition: mm7_data.cpp:716
SpriteFrame
Definition: Sprites.h:39
assets
AssetsManager * assets
Definition: AssetsManager.cpp:12
ANIM_Walking
@ ANIM_Walking
Definition: Actor.h:100
integer_sqrt
int integer_sqrt(int val)
Definition: OurMath.cpp:164
RenderVertexSoft::_rhw
float _rhw
Definition: IRender.h:120
SOUND_RunWood
@ SOUND_RunWood
Definition: AudioPlayer.h:33
uint
unsigned int uint
Definition: MM7.h:4
array_77EC08
std::array< struct Polygon, 2000+18000 > array_77EC08
Definition: Outdoor.cpp:52
UITransition.h
uActiveCharacter
unsigned int uActiveCharacter
Definition: mm7_data.cpp:555
v3
GLfloat GLfloat GLfloat GLfloat v3
Definition: SDL_opengl_glext.h:696
OutdoorLocation::pTileTypes
OutdoorLocationTileType pTileTypes[4]
Definition: Outdoor.h:116
pStationaryLightsStack
LightsStack_StationaryLight_ * pStationaryLightsStack
Definition: LightmapBuilder.cpp:11
OutdoorLocation::InitalizeActors
bool InitalizeActors(int a1)
Definition: Outdoor.cpp:1641
__debugbreak
void __cdecl __debugbreak(void)
IndoorCameraD3D::debug_flags
int debug_flags
Definition: IndoorCameraD3D.h:255
Fleeing
@ Fleeing
Definition: Actor.h:82
Actor::AI_Flee
static void AI_Flee(unsigned int uActorID, signed int edx0, int uActionLength, struct AIDirection *a4)
Definition: Actor.cpp:2070
y1
GLfixed y1
Definition: SDL_opengl_glext.h:4586
OutdoorLocation::pTerrain
struct OutdoorLocationTerrain pTerrain
Definition: Outdoor.h:117
fixed::GetFloat
float GetFloat() const
Definition: OurMath.h:37
OutdoorLocation::subconstuctor
void subconstuctor()
Definition: Outdoor.cpp:2168
OutdoorLocation::LoadRoadTileset
bool LoadRoadTileset()
Definition: Outdoor.cpp:1705
OutdoorLocation::field_D48
int field_D48
Definition: Outdoor.h:167
LODFile_Sprites::DeleteSomeOtherSprites
void DeleteSomeOtherSprites()
Definition: LOD.cpp:232
OutdoorLocation::field_D24
int field_D24
Definition: Outdoor.h:160
OutdoorLocation::LoadActualSkyFrame
static void LoadActualSkyFrame()
Definition: Outdoor.cpp:2143
BSPModel::pFaces
std::vector< ODMFace > pFaces
Definition: BSPModel.h:190
RenderVertexSoft::vWorldPosition
Vec3_float_ vWorldPosition
Definition: IRender.h:116
OutdoorLocation::UpdateDiscoveredArea
int UpdateDiscoveredArea(int a2, int a3, int a4)
Definition: Outdoor.cpp:1527
current_Face_id
std::array< int, 20 > current_Face_id
Definition: mm7_data.cpp:734
ODMFace
Definition: BSPModel.h:93
stru141_actor_collision_object::direction
Vec3_int_ direction
Definition: Indoor.h:165
PARTY_BUFF_FLY
@ PARTY_BUFF_FLY
Definition: Party.h:78
pBitmaps_LOD
LODFile_IconsBitmaps * pBitmaps_LOD
Definition: LOD.cpp:16
foot_travel_destinations
char foot_travel_destinations[15][4]
Definition: Outdoor.cpp:273
OutdoorLocation::GetTravelDestination
bool GetTravelDestination(signed int sPartyX, signed int sPartyZ, char *pOut, signed int a5)
Definition: Outdoor.cpp:330
OutdoorLocation::CreateDebugLocation
void CreateDebugLocation()
Definition: Outdoor.cpp:902
y2
GLfixed GLfixed GLfixed y2
Definition: SDL_opengl_glext.h:4586
DecorationList::InitializeDecorationSprite
void InitializeDecorationSprite(unsigned int uDecID)
Definition: DecorationList.cpp:45
uNumSpritesDrawnThisFrame
int uNumSpritesDrawnThisFrame
Definition: RenderOpenGL.cpp:56
stru193_math::Cos
int Cos(int angle)
Definition: OurMath.cpp:28
OutdoorLocation::GetSoundIdByPosition
int GetSoundIdByPosition(signed int X_pos, signed int Y_pos, int a4)
Definition: Outdoor.cpp:1482
ChestsDeserialize
char * ChestsDeserialize(char *pData)
Definition: Chest.cpp:500
byte_6BE124_cfg_textures_DefaultGroundTexture
std::array< char, 16 > byte_6BE124_cfg_textures_DefaultGroundTexture
Definition: mm7_data.cpp:702
Decoration.h
stru_5C6E00
struct stru193_math * stru_5C6E00
Definition: mm7_data.cpp:19
ODM_GetFloorLevel
int ODM_GetFloorLevel(int X, signed int Y, int Z, int __unused, bool *pIsOnWater, int *bmodel_pid, int bWaterWalk)
Definition: Outdoor.cpp:1877
Party::walk_sound_timer
int walk_sound_timer
Definition: Party.h:263
ViewingParams::bRedrawGameUI
int bRedrawGameUI
Definition: Viewport.h:74
OutdoorLocation::_47ED83
int _47ED83(signed int a2, signed int a3)
Definition: Outdoor.cpp:1451
ODMFace::pFacePlane
struct Plane_int_ pFacePlane
Definition: BSPModel.h:131
ODM_UpdateUserInputAndOther
void ODM_UpdateUserInputAndOther()
Definition: Outdoor.cpp:2115
BSPVertexBuffer::pVertices
Vec3_int_ * pVertices
Definition: BSPModel.h:53
OutdoorLocation::field_D00
int field_D00
Definition: Outdoor.h:150
dword_6BE364_game_settings_1
int dword_6BE364_game_settings_1
Definition: mm7_data.cpp:714
OutdoorLocation::level_filename
String level_filename
Definition: Outdoor.h:111
foot_travel_times
unsigned char foot_travel_times[15][4]
Definition: Outdoor.cpp:291
DecorationDesc
Definition: DecorationList.h:49
OutdoorLocation::Initialize
bool Initialize(const String &filename, int days_played, int respawn_interval_days, int *thisa)
Definition: Outdoor.cpp:246
SoundID
SoundID
Definition: AudioPlayer.h:10
sub_47C3D7_get_fog_specular
int sub_47C3D7_get_fog_specular(int a1, int a2, float a3)
Definition: Outdoor.cpp:3898
OurMath.h
EventProcessor
void EventProcessor(int uEventID, int targetObj, int canShowMessages, int entry_line)
Definition: Events.cpp:260
pBillboardRenderList
RenderBillboard pBillboardRenderList[500]
Definition: RenderOpenGL.cpp:54
PARTY_Jump
@ PARTY_Jump
Definition: Party.h:107
POLYGON_InBetweenCeilingAndWall
@ POLYGON_InBetweenCeilingAndWall
Definition: Indoor.h:223
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1112
pTerrainNormalIndices
std::array< unsigned short, 128 *128 *2 > pTerrainNormalIndices
Definition: mm7_data.cpp:757
ODMRenderParams::int_fov_rad
int int_fov_rad
Definition: IRender.h:79
stru_721530
stru141_actor_collision_object stru_721530
Definition: Indoor.cpp:58
Is_out15odm_underwater
char Is_out15odm_underwater()
Definition: Outdoor.cpp:3377
SpriteObject::Create_Splash_Object
static void Create_Splash_Object(int x, int y, int z)
Definition: SpriteObject.cpp:993
OutdoorLocation::field_D28
int field_D28
Definition: Outdoor.h:161
uLevel_StartingPointType
MapStartPoint uLevel_StartingPointType
Definition: Outdoor.cpp:46
RenderBillboard::screenspace_projection_factor_x
float screenspace_projection_factor_x
Definition: IRender.h:27
stru193_math::Sin
int Sin(int angle)
Definition: OurMath.cpp:133
MAP_BRAKADA_DESERT
@ MAP_BRAKADA_DESERT
Definition: MapInfo.h:12
pAudioPlayer
AudioPlayer * pAudioPlayer
Definition: AudioPlayer.cpp:20
v0
GLfloat v0
Definition: SDL_opengl_glext.h:693
SpawnEncounter
void SpawnEncounter(MapInfo *pMapInfo, SpawnPointMM7 *spawn, int a3, int a4, int a5)
Definition: Actor.cpp:5063
stru141_actor_collision_object::CalcMovementExtents
int CalcMovementExtents(int a2)
Definition: Indoor.cpp:5697
_calc_fov
float _calc_fov(int viewport_width, int angle_degree)
Definition: IndoorCameraD3D.cpp:17
BSPModel
Definition: BSPModel.h:163
SpawnPointMM7::IsMonsterSpawn
bool IsMonsterSpawn() const
Definition: Indoor.h:321
GUIWindow.h
RenderVertexSoft
Definition: IRender.h:113
Party::floor_face_pid
int floor_face_pid
Definition: Party.h:262
MONSTER_SUPERTYPE_WATER_ELEMENTAL
@ MONSTER_SUPERTYPE_WATER_ELEMENTAL
Definition: Monsters.h:74
ObjectList.h
logger
Log * logger
Definition: IocContainer.cpp:47
pMobileLightsStack
LightsStack_MobileLight_ * pMobileLightsStack
Definition: LightmapBuilder.cpp:14
stru_5E4C90_MapPersistVars
stru123 stru_5E4C90_MapPersistVars
Definition: mm7_data.cpp:23
OutdoorLocation::field_D10
int field_D10
Definition: Outdoor.h:155
ODMRenderParams::Initialize
void Initialize()
Definition: Outdoor.cpp:2196
RespawnGlobalDecorations
void RespawnGlobalDecorations()
Definition: DecorationList.cpp:70
Engine_::IocContainer::ResolveSpellFxRenderer
static SpellFxRenderer * ResolveSpellFxRenderer()
Definition: IocContainer.cpp:74
pDialogueWindow
GUIWindow * pDialogueWindow
Definition: GUIWindow.cpp:50
LocationTime_stru1::day_attrib
int day_attrib
Definition: Indoor.h:276
OutdoorLocation::field_CF0
int field_CF0
Definition: Outdoor.h:146
pOutdoor
OutdoorLocation * pOutdoor
Definition: Outdoor.cpp:48
SOUND_WalkWood
@ SOUND_WalkWood
Definition: AudioPlayer.h:55
dword_720ED0
std::array< int, 20 > dword_720ED0
Definition: mm7_data.cpp:730
GUIProgressBar::Progress
void Progress()
Definition: GUIProgressBar.cpp:83
PaletteManager::pPalette_tintColor
unsigned char pPalette_tintColor[3]
Definition: PaletteManager.h:36
MapInfo::uRespawnIntervalDays
unsigned int uRespawnIntervalDays
Definition: MapInfo.h:45
LODFile_IconsBitmaps::pTextures
Texture_MM7 pTextures[MAX_LOD_TEXTURES]
Definition: LOD.h:158
word_720DB0_xs
std::array< __int16, 777 > word_720DB0_xs
Definition: mm7_data.cpp:728
Engine_::IocContainer::ResolveLightmapBuilder
static LightmapBuilder * ResolveLightmapBuilder()
Definition: IocContainer.cpp:81
DDM_DLV_Header::uNumBModels
unsigned int uNumBModels
Definition: Indoor.h:100
_A750D8_player_speech_timer
int64_t _A750D8_player_speech_timer
Definition: mm7_data.cpp:763
BBox_short_::z1
int16_t z1
Definition: VectorTypes.h:118
OutdoorLocation::ArrangeSpriteObjects
void ArrangeSpriteObjects()
Definition: Outdoor.cpp:1616
pIndoorCameraD3D
IndoorCameraD3D * pIndoorCameraD3D
Definition: IndoorCameraD3D.cpp:21
ai_near_actors_ids
std::array< unsigned int, 500 > ai_near_actors_ids
Definition: mm7_data.cpp:505
IsTerrainSlopeTooHigh
bool IsTerrainSlopeTooHigh(int pos_x, int pos_z)
Definition: Outdoor.cpp:3976
stru141_actor_collision_object::position
Vec3_int_ position
Definition: Indoor.h:160
OutdoorLocation::DoGetHeightOnTerrain
int DoGetHeightOnTerrain(signed int sX, signed int sZ)
Definition: Outdoor.cpp:1474
_6807B8_level_decorations_ids
std::array< int, 777 > _6807B8_level_decorations_ids
Definition: mm7_data.cpp:685
OutdoorLocationTileType::uTileID
uint16_t uTileID
Definition: Outdoor.h:24
StringPrintf
String StringPrintf(const char *fmt,...)
Definition: Strings.cpp:9
GUIProgressBar.h
PARTY_WalkBackward
@ PARTY_WalkBackward
Definition: Party.h:101
MonsterDesc::sTintColor
unsigned int sTintColor
Definition: Monsters.h:218
PARTY_FastTurnLeft
@ PARTY_FastTurnLeft
Definition: Party.h:113
stru141_actor_collision_object::velocity
Vec3_int_ velocity
Definition: Indoor.h:158
OutdoorLocation::Draw
void Draw()
Definition: Outdoor.cpp:160
foot_travel_arrival_points
MapStartPoint foot_travel_arrival_points[15][4]
Definition: Outdoor.cpp:310
Party::sRotationY
int sRotationY
Definition: Party.h:251
stru262_TurnBased::turn_stage
int turn_stage
Definition: TurnEngine.h:75
Timer::uTotalGameTimeElapsed
unsigned int uTotalGameTimeElapsed
Definition: Time.h:135
stru193_math::uIntegerPi
static const unsigned int uIntegerPi
Definition: OurMath.h:88
DecalBuilder.h
EQUIP_BOOTS
@ EQUIP_BOOTS
Definition: Items.h:236
String
std::string String
Definition: Strings.h:10
OutdoorLocation::GetTile
TileDesc * GetTile(int sX, int sZ)
Definition: Outdoor.cpp:216
LightsStack_MobileLight_::AddLight
bool AddLight(int16_t x, int16_t y, int16_t z, int16_t uSectorID, int uRadius, uint8_t r, uint8_t g, uint8_t b, char a10)
Definition: LightsStack.cpp:6
Tileset_RoadGrassCobble
@ Tileset_RoadGrassCobble
Definition: TileFrameTable.h:36
POLYGON_Ceiling
@ POLYGON_Ceiling
Definition: Indoor.h:222
pEventTimer
Timer * pEventTimer
Definition: Time.cpp:8
PARTY_RunForward
@ PARTY_RunForward
Definition: Party.h:111
Pursuing
@ Pursuing
Definition: Actor.h:81
Sprites.h
RenderBillboard::world_x
int16_t world_x
Definition: IRender.h:36
MapStartPoint_Party
@ MapStartPoint_Party
Definition: MapInfo.h:28
Stunned
@ Stunned
Definition: Actor.h:83
SpriteFrame::uFlags
int uFlags
Definition: Sprites.h:48
Actor::InitializeActors
static void InitializeActors()
Definition: Actor.cpp:3334
dword_6BE13C_uCurrentlyLoadedLocationID
int dword_6BE13C_uCurrentlyLoadedLocationID
Definition: mm7_data.cpp:705
Vec3::z
T z
Definition: VectorTypes.h:27
Image::Release
bool Release()
Definition: Image.cpp:335
Party::WaterWalkActive
bool WaterWalkActive()
Definition: Party.h:205
Party::Invisible
bool Invisible()
Definition: Party.h:217
RenderBillboard::sTintColor
unsigned int sTintColor
Definition: IRender.h:44
FogProbabilityTableEntry::small_fog_chance
unsigned char small_fog_chance
Definition: Outdoor.cpp:55
ItemsTable::pItems
NZIArray< ItemDesc, 800 > pItems
Definition: Items.h:460
PARTY_StrafeRight
@ PARTY_StrafeRight
Definition: Party.h:99
Api.h
pDecorationList
struct DecorationList * pDecorationList
Definition: DecorationList.cpp:11
fBackwardWalkSpeedMultiplier
float fBackwardWalkSpeedMultiplier
Definition: mm7_data.cpp:707
ODMRenderParams::field_4C
int field_4C
Definition: IRender.h:94
stru141_actor_collision_object::pid
unsigned int pid
Definition: Indoor.h:171
Time.h
OutdoorLocation::field_D3C
int field_D3C
Definition: Outdoor.h:164
render
std::shared_ptr< IRender > render
Definition: RenderOpenGL.cpp:52