125 render->DrawOutdoorSkyD3D();
126 render->RenderTerrainD3D();
127 render->DrawBuildingsD3D();
135 engine->PushStationaryLights(-1);
141 engine->SetForceRedraw(
false);
142 if (
render->IsUsingSpecular())
153 render->PrepareDecorationsRenderList_ODM();
155 render->DrawSpriteObjects_ODM();
156 render->TransformBillboardsAndSetPalettesODM();
161 bool redrawWorld =
true;
175 return 60.0 * 0.016666668;
192 return 60.0 * 0.016666668;
211 if (v5 < 0 || v5 > 127 || v4 < 0 || v4 > 127)
return 0;
222 if (v5 < 0 || v5 > 127 || v4 < 0 || v4 > 127)
return nullptr;
238 if (sX < 0 || sX > 127 || sZ < 0 || sZ > 127)
247 int respawn_interval_days,
int *thisa) {
250 if (!filename.empty()) {
256 if (!this->
Load(filename, days_played, respawn_interval_days, thisa)) {
331 signed int sPartyZ,
char *pOut,
333 char *mapNumberAsStr;
335 signed int direction;
336 signed int destinationMap;
341 mapNumberAsStr = strtok(Str,
"out");
342 mapNumberAsStr[2] = 0;
343 mapNumberAsInt = atoi(mapNumberAsStr);
344 if (a5 < 10 || this->
level_filename.length() != 9 || mapNumberAsInt < 1 ||
347 if (sPartyX < -22528)
349 else if (sPartyX > 22528)
351 else if (sPartyZ < -22528)
353 else if (sPartyZ > 22528)
358 if (mapNumberAsInt ==
MAP_AVLEE && direction == 4) {
359 if (
pPlayers[1]->HasUnderwaterSuitEquipped() &&
360 pPlayers[2]->HasUnderwaterSuitEquipped() &&
361 pPlayers[3]->HasUnderwaterSuitEquipped() &&
362 pPlayers[4]->HasUnderwaterSuitEquipped()) {
364 strcpy(pOut,
"out15.odm");
369 }
else if (mapNumberAsInt ==
MAP_SHOALS && direction == 3) {
371 strcpy(pOut,
"out14.odm");
384 sprintf(pOut,
"out%02d.odm", destinationMap);
422 for (
uint i = 0; i < 8; i++)
424 this->pSpriteIDs_LUN[i]);
458 bool is_on_water =
false;
459 int bmodel_standing_on_pid = 0;
461 if (
pParty->
uFlags & 8 || bmodel_standing_on_pid || is_on_water)
491 uint chance = rand() % 100;
524 unsigned int numOfVertices;
547 if (numOfVertices < 3)
return false;
548 currVertex = &a2[numOfVertices - 1];
551 polygon->
flags |= 0x10u;
557 for (
int i = 0; i < numOfVertices; i++) {
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;
581 a3b = v23 * v18 - v22 * v20;
583 a3c = v21 * v20 - v23 * v19;
585 a3d = v22 * v19 - v21 * v18;
634 unsigned __int8 *pMapHeight;
702 for (v13 =
result - 1; v13 <= Z; v13++) {
706 v49 = (v39 - 63) << 9;
707 for (v14 = v39; v14 <= W; v14++) {
708 if (v13 >= 0 &&
result >= -32256 && v13 <= 127 &&
713 v17 = (int)(&pMapHeight[v13 * this->
field_10] + v14);
715 v19 = (64 - v13) << 9;
716 v20 = 32 * *(
char *)v17;
717 v21 = 32 * *(
char *)(v17 + 1);
719 v22 = (v18 + 63) << 9;
721 v23 = (int)(&pMapHeight[this->
field_10 * (v13 + 1)] +
724 v40 = 32 * *(
char *)v23;
725 v42 = 32 * *(
char *)(v23 + 1);
727 v25 = v49 - 512 - v49;
728 v26 = (double)-((v20 - v21) * v24);
730 v27 = (double)-(v25 * (v42 - v21));
732 v28 = (double)(v25 * v24);
734 v29 = sqrt(v28 * v28 + v27 * v27 + v26 * v26);
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);
746 *((
char *)this->
pDmap + v44 + 1) = (
signed __int64)v31;
748 v32 = v49 - (v49 - 512);
749 v33 = (double)-((v42 - v40) * (v19 - v41));
751 v34 = (double)-(v32 * (v20 - v40));
753 v35 = (double)(v32 * (v19 - v41));
755 v36 = sqrt(v35 * v35 + v34 * v34 + v33 * v33);
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;
766 *((
char *)this->
pDmap + v44) = (
signed __int64)v38;
877 memset(this->
pTilemap, 90, 0x4000u);
879 memset(this->
pDmap, 0, 0x8000u);
891 pHeightmap = (
unsigned __int8 *)malloc(0x4000);
892 pTilemap = (
unsigned __int8 *)malloc(0x4000);
920 this->
pCmap = malloc(0x8000);
923 this->
pOMAP = (
unsigned int *)malloc(0x10000);
924 if (this->
pOMAP ==
nullptr) {
928 memset(this->
pOMAP, 0, 0x10000);
981 int respawn_interval_days,
int *thisa) {
982 if (
engine->IsUnderwater()) {
1004 Error(
"Unable to find %s in Games.LOD", filename.c_str());
1007 String minimap_filename = filename.substr(0, filename.length() - 4);
1010 auto odm_filename =
String(filename);
1011 odm_filename.replace(odm_filename.length() - 4, 4,
".odm");
1016 #pragma pack(push, 1)
1026 static_assert(
sizeof(ODMInfo) == 160,
"Wrong type size");
1027 ODMInfo *odm_info = (ODMInfo*)pSrc;
1033 pSrc +=
sizeof(ODMInfo);
1059 pCmap = malloc(0x8000);
1116 pFaceIDLIST = (
unsigned short *)malloc(faceIDListSize);
1119 pSrc += 4 + faceIDListSize;
1126 pOMAP = (
unsigned int *)malloc(0x10000);
1129 memcpy(
pOMAP, pSrc, 65536);
1145 pSrc += 4 + spawnPointsSize;
1152 auto ddm_filename = filename;
1153 ddm_filename = ddm_filename.replace(ddm_filename.length() - 4, 4,
".ddm");
1156 if (pSrcMem !=
nullptr) {
1163 uint actualNumFacesInLevel = 0;
1165 actualNumFacesInLevel += model.pFaces.size();
1181 respawn_interval_days = 0x1BAF800;
1191 memset(Dst, 0, 968);
1192 memset(Src, 0, 968);
1196 memcpy(Dst, pSrc, 968);
1197 memcpy(Src, pSrc + 968, 968);
1224 memcpy(&
face.uAttributes, pSrc, 4);
1229 if (
face.sCogTriggeredID) {
1230 if (
face.HasEventHint()) {
1231 face.uAttributes |= FACE_HAS_EVENT_HINT;
1233 face.uAttributes &= ~FACE_HAS_EVENT_HINT;
1253 assert(
sizeof(
Actor) == 836);
1308 if (rand() % 100 >= 20)
1329 for (
int i = 0; i < 3; ++i) {
1373 v3 = (a2 - 90) / 36;
1374 if (
v3 &&
v3 != 1 &&
v3 != 2) {
1393 if (sX < 0 || sX > 127 || sY < 0 || sY > 127)
1400 36 * ((
v3 - 90) / 36) - 90;
1405 if (
engine->config->seasons_change) {
1414 v3 = 348 + (
v3 - 96);
1452 if (a2 < 0 || a2 > 127 || a3 < 0 || a3 > 127)
1463 if (sX < 0 || sX > 127 || sY < 0 || sY > 127)
1469 36 * ((
v3 - 90) / 36) - 90;
1475 if (sX < 0 || sX > 127 || sZ < 0 || sZ > 127)
1490 if (X_pos < 0 || X_pos > 127 || Y_pos < 0 || Y_pos > 127)
1495 if (running) modif = -39;
1496 if (!v5)
return 92 + modif;
1519 if ((v8 > 9 && v8 <= 17) || (v8 > 21 && v8 <= 27))
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);
1539 if (distanceSquared <= 49)
1551 if (x_pos < 0 || x_pos >= 88 || y_pos < 0 || y_pos >= 88)
1555 (1 << (7 - (x_pos) % 8))) != 0;
1561 if (x_pos < 0 || x_pos >= 88 || y_pos < 0 || y_pos >= 88)
1565 (1 << (7 - (x_pos) % 8))) != 0;
1599 if (v8 && decor->
uCog == 20)
1621 bool bOnWater =
false;
1631 pSpriteObjects[i].containing_item.uEnchantmentType = rand() % 15 + 5;
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)
1655 (
pActors[i].sCurrentHP == 0 ||
1656 pActors[i].pMonsterInfo.uHP == 0))
1662 pActors[i].pMonsterInfo.uHostilityType =
1667 pActors[i].uAttributes |= ACTOR_UNKNOW11;
1669 }
else if (a1 == 0) {
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)
1679 (
pActors[i].sCurrentHP == 0 ||
1680 pActors[i].pMonsterInfo.uHP == 0))
1686 pActors[i].pMonsterInfo.uHostilityType =
1691 pActors[i].uAttributes |= ACTOR_UNKNOW11;
1714 for (
uint i = 0; i < 3; ++i)
1725 unsigned int Angle_To_Cam;
1726 signed int Cur_Action_Time;
1740 pActors[i].uAttributes &= ~ACTOR_VISIBLE;
1752 .pMonsterInfo.uSpecialAbilityDamageDiceSides != 1) {
1753 z += floorf(
pActors[i].uActorHeight * 0.5
f + 0.5
f);
1757 v4 = (1.0 - (double)
pActors[i].uCurrentActionTime /
1758 (
double)
pActors[i].uCurrentActionLength) *
1759 (
double)(2 *
pActors[i].uActorHeight);
1760 z -= floorf(v4 + 0.5
f);
1773 Angle_To_Cam) >> 8) & 7;
1777 Cur_Action_Time =
pActors[i].uCurrentActionTime;
1778 if (
pActors[i].uCurrentActionAnimation == 1)
1781 Cur_Action_Time =
pActors[i].uCurrentActionTime;
1782 if (
pActors[i].uCurrentActionAnimation == 1)
1788 Cur_Action_Time = 0;
1793 pActors[i].pSpriteIDs[
pActors[i].uCurrentActionAnimation], Cur_Action_Time);
1796 pActors[i].pSpriteIDs[
pActors[i].uCurrentActionAnimation], Cur_Action_Time);
1799 if (v14->
icon_name ==
"null")
continue ;
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;
1814 int view_x = 0, view_y = 0, view_z = 0;
1818 if (abs(view_x) >= abs(view_y)) {
1819 int projected_x = 0;
1820 int projected_y = 0;
1828 pActors[i].uAttributes |= ACTOR_VISIBLE;
1878 int *bmodel_pid,
int bWaterWalk) {
1885 int current_floor_level;
1888 bool current_vertices_Y;
1889 bool next_vertices_Y;
1891 int next_floor_level;
1900 if (X <= model.sMaxX && X >= model.
sMinX && Y <= model.
sMaxY &&
1902 if (!model.
pFaces.empty()) {
1905 if (
face.Ethereal()) {
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] +
1919 face.pYInterceptDisplacements[i] +
1922 face.pXInterceptDisplacements[i] +
1927 face.pYInterceptDisplacements[i] +
1937 current_vertices_Y =
1940 if (2 *
face.uNumVertices > 0) {
1941 for (
int i = 0; i < 2 *
face.uNumVertices; ++i) {
1942 if (number_hits >= 2)
break;
1946 if (current_vertices_Y !=
1958 HEXRAYS_LODWORD(v23) =
1962 HEXRAYS_HIDWORD(v23) =
1979 if (v22 >= X) ++number_hits;
1983 current_vertices_Y = next_vertices_Y;
1985 if (number_hits == 1) {
1986 if (v46 >= 20)
break;
2012 current_floor_level = 0;
2018 for (
uint i = 1; i < v46; ++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;
2026 }
else if (next_floor_level < current_floor_level) {
2027 current_floor_level = next_floor_level;
2037 *pIsOnWater =
false;
2066 float side1_dx, side1_dy, side1_dz, side2_dx, side2_dy, side2_dz;
2068 int dx = abs(pos_x - grid_pos_x1), dz = abs(grid_pos_z1 - pos_z);
2070 side2_dx = (double)(grid_pos_x2 - grid_pos_x1);
2073 side2_dy = (double)(x2z2_y - x1z2_y);
2076 side1_dz = (double)(grid_pos_z1 - grid_pos_z2);
2077 side1_dy = (double)(x1z1_y - x1z2_y);
2084 side2_dx = (double)(grid_pos_x1 - grid_pos_x2);
2086 side2_dy = (double)(x1z1_y - x2z1_y);
2089 side1_dz = (double)(grid_pos_z2 - grid_pos_z1);
2090 side1_dy = (double)(x2z2_y - x2z1_y);
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;
2103 if (fabsf(mag) < 1e-6
f) {
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;
2181 for (
uint i = 0; i < uNumVertices; i++) {
2211 v4 = (
signed int)(
v3 /
v2) >> 16;
2262 bool party_running_flag;
2271 bool party_walking_flag;
2289 bool partyAtHighSlope =
2291 party_running_flag =
false;
2292 party_walking_flag =
false;
2299 bFeatherFall =
false;
2300 for (
int i = 0; i < 4; ++i)
2303 bFeatherFall =
true;
2307 bFeatherFall =
true;
2325 int bmodel_standing_on_pid;
2326 bool is_on_water =
false;
2329 &is_on_water, &bmodel_standing_on_pid, bWaterWalk);
2330 int is_not_on_bmodel = bmodel_standing_on_pid == 0;
2341 if (floor_level - party_new_Z > 512 && !bFeatherFall &&
2342 party_new_Z <= v111 + 1) {
2346 for (
int i = 0; i < 4; ++i) {
2360 (
signed __int64)((
double)bonus *
2362 2.133333333333333));
2369 ceiling_height = -1;
2375 on_ground = v111 + 1;
2378 if (party_new_Z <= on_ground) {
2379 ceiling_height = -1;
2384 not_high_fall = party_new_Z - v111 <= 32;
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;
2411 FACE_PRESSURE_PLATE) {
2437 (
signed __int64)((
signed int)(
pParty
2438 ->y_rotation_speed *
2450 if (
engine->IsUnderwater() ||
2454 .sMana > 0 ||
engine->config->debug_all_magic)) {
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;
2466 *(
float *)&v128 = 0.0;
2467 if (v102 && party_new_Z < ceiling_height &&
2491 if (
engine->IsUnderwater() ||
2502 if (party_new_Z <= v111) {
2511 if (
engine->config->turn_speed > 0)
2512 _angle_y +=
engine->config->turn_speed;
2520 if (
engine->config->turn_speed > 0)
2521 _angle_y -=
engine->config->turn_speed;
2529 if (
engine->config->turn_speed > 0)
2530 _angle_y +=
engine->config->turn_speed;
2538 if (
engine->config->turn_speed > 0)
2539 _angle_y -=
engine->config->turn_speed;
2550 float sin_y = sinf(2 * pi_double * _angle_y / 2048.0);
2554 float cos_y = cosf(2 * pi_double * _angle_y / 2048.0);
2559 party_walking_flag =
true;
2566 float sin_y = sinf(2 * pi_double * _angle_y / 2048.0);
2570 float cos_y = cosf(2 * pi_double * _angle_y / 2048.0);
2575 party_walking_flag =
true;
2580 *(
float *)&v128 = _walk_speed;
2582 float sin_y = sinf(2 * pi_double * _angle_y / 2048.0),
2583 cos_y = cosf(2 * pi_double * _angle_y / 2048.0);
2588 if (
engine->config->debug_turbo_speed) {
2597 party_walking_flag =
true;
2602 *(
float *)&v128 = _walk_speed;
2604 float sin_y = sinf(2 * pi_double * _angle_y / 2048.0);
2605 float cos_y = cosf(2 * pi_double * _angle_y / 2048.0);
2615 }
else if (partyAtHighSlope &&
2616 !bmodel_standing_on_pid) {
2621 party_walking_flag =
true;
2631 if (
engine->config->debug_turbo_speed) {
2640 party_running_flag =
true;
2645 *(
float *)&v128 = _walk_speed;
2647 float sin_y = sinf(2 * pi_double * _angle_y / 2048.0);
2648 float cos_y = cosf(2 * pi_double * _angle_y / 2048.0);
2658 party_walking_flag =
true;
2663 float sin_y = sinf(2 * pi_double * _angle_y / 2048.0);
2664 float cos_y = cosf(2 * pi_double * _angle_y / 2048.0);
2680 party_walking_flag =
true;
2691 if (_angle_x > 128) _angle_x = 128;
2699 if (_angle_x < -128) _angle_x = -128;
2705 if ((!partyAtHighSlope || bmodel_standing_on_pid) &&
2733 party_new_Z = v113 + v129;
2734 if (pModel_) party_new_Z = v113;
2740 }
else if (party_new_Z < v111) {
2741 if (is_on_water && fall_speed)
2765 }
else if (!partyAtHighSlope) {
2767 }
else if (!hovering) {
2768 if (!bmodel_standing_on_pid) {
2777 v129 = abs(
v2 * v98.x +
v1 * v98.y + v35 * v98.z) >> 16;
2789 if (!
engine->IsUnderwater() && v34 <= 0) {
2790 if (v34 < -500 && !pParty->bFlying &&
2793 for (
int i = 0; i < 4; ++i) {
2807 if (
v2 *
v2 +
v1 *
v1 < 400 && !partyAtHighSlope) {
2808 *(
float *)&v128 = 0.0;
2818 for (
uint i = 0; i < 100; i++) {
2844 for (
uint actor_id = 0; actor_id < (
signed int)
uNumActors; ++actor_id)
2862 &is_on_water, &bmodel_standing_on_pid, 0);
2864 &is_on_water, &v97, 0);
2866 &is_on_water, &v110, 0);
2869 is_not_on_bmodel =
false;
2871 if (!v97 && !v110 && !bmodel_standing_on_pid) is_not_on_bmodel =
true;
2874 if (
engine->IsUnderwater() || !is_not_on_bmodel) {
2876 if (v43) pY = _angle_y;
2878 if (v42_ && v129 > party_new_Z) v44 = 0;
2879 if (v42 && v119 > party_new_Z) v43 = 0;
2882 if (v43) pY = _angle_y;
2888 &bmodel_standing_on_pid, 0);
2890 new_ <= party_new_Z) {
2893 if (v43) pY = _angle_y;
2898 if (!is_not_on_bmodel) {
2940 if (
engine->IsUnderwater())
2943 if (fall_speed < 0) fall_speed = 0;
2946 if (
v2 *
v2 + v128 * v128 < 400) {
2948 *(
float *)&v128 = 0.0;
3007 if (
v2 *
v2 + v128 * v128 >= 400) {
3016 *(
float *)&v128 = 0.0;
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 &&
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 &&
3063 if (
integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) < 8)
3066 if (!hovering || !not_high_fall)
3080 if (v114_a == pMap_X && v66 == pMap_Y && v122 && v69) v68 = 1;
3081 if (!is_not_on_bmodel)
3089 if (party_new_Z > 8160) {
3104 party_new_Z <= on_ground &&
3105 !
engine->IsUnderwater()) {
3110 for (
uint i = 1; i <= 4; ++i) {
3117 v110 = 20 -
pPlayers[i]->GetParameterBonus(
3118 pPlayers[i]->GetActualEndurance());
3120 (
signed __int64)((double)v110 *
3122 2.133333333333333));
3149 bool party_drowning_flag =
false;
3155 party_drowning_flag =
true;
3179 if (!v122 || !v69) {
3181 v80 = *(
short *)v79;
3183 *(
short *)v79 = v80 & 0xFFFE;
3195 if (party_new_Z > 8160) {
3203 if (party_drowning_flag) {
3204 bool onWater =
false;
3220 party_new_Z <= on_ground &&
3221 !
engine->IsUnderwater()) {
3225 for (
uint i = 1; i <= 4; ++i) {
3226 v110 =
pPlayers[i]->GetMaxHealth();
3229 (
uint64_t)((
double)v110 * 0.1)) / 256,
3231 v110 = 20 -
pPlayers[i]->GetParameterBonus(
3232 pPlayers[i]->GetActualEndurance());
3234 (
signed __int64)((
double)v110 *
3236 2.133333333333333));
3276 if (Party_X <= model.sMaxX && Party_X >= model.
sMinX &&
3277 Party_Y <= model.sMaxY && Party_Y >= model.
sMinY) {
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) {
3287 face.pXInterceptDisplacements[
v] +
3291 face.pXInterceptDisplacements[
v] +
3295 face.pXInterceptDisplacements[
v] +
3300 face.pXInterceptDisplacements[
v] +
3305 v27 = 2 *
face.uNumVertices;
3310 for (
uint v = 0;
v < v27; ++
v) {
3311 if (v37 >= 2)
break;
3321 HEXRAYS_LODWORD(v18) = v17 << 16,
3322 HEXRAYS_HIDWORD(v18) = v17 >> 16,
3335 if (v39 >= 20)
break;
3342 HEXRAYS_HIWORD(
face.zCalc3);
3358 for (v38 = 0; v38 < v39; ++v38) {
3394 if (
engine->config->no_actors)
3397 for (
unsigned int Actor_ITR = 0; Actor_ITR <
uNumActors; ++Actor_ITR) {
3405 pActors[Actor_ITR].uSectorID = 0;
3407 bool uIsFlying =
pActors[Actor_ITR].pMonsterInfo.uFlying;
3408 if (!
pActors[Actor_ITR].CanAct()) uIsFlying = 0;
3411 pActors[Actor_ITR].vPosition.y);
3412 unsigned int Model_On_PID = 0;
3413 bool uIsOnWater =
false;
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;
3420 bool uIsAboveFloor = (
pActors[Actor_ITR].vPosition.z > (Floor_Level + 1));
3422 if (
pActors[Actor_ITR].uAIState ==
Dead && uIsOnWater && !uIsAboveFloor) {
3429 signed int Actor_Speed =
pActors[Actor_ITR].uMovementSpeed;
3431 Actor_Speed = (
int64_t)((double)Actor_Speed * 0.5);
3438 if (Actor_Speed > 1000) Actor_Speed = 1000;
3440 pActors[Actor_ITR].vVelocity.x =
3442 pActors[Actor_ITR].vVelocity.y =
3449 pActors[Actor_ITR].vVelocity.x =
3451 pActors[Actor_ITR].vVelocity.y =
3454 pActors[Actor_ITR].vVelocity.z =
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;
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;
3469 pActors[Actor_ITR].vPosition.y, &Terrain_Norm);
3472 pActors[Actor_ITR].vVelocity.z +=
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;
3480 pActors[Actor_ITR].uYawAngle -= 32;
3484 pActors[Actor_ITR].vVelocity.z -=
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;
3494 pActors[Actor_ITR].uYawAngle += rand() % 32 - 16;
3495 pActors[Actor_ITR].UpdateAnimation();
3499 if (
pActors[Actor_ITR].vVelocity.x *
pActors[Actor_ITR].vVelocity.x +
3500 pActors[Actor_ITR].vVelocity.y *
pActors[Actor_ITR].vVelocity.y <
3503 pActors[Actor_ITR].vVelocity.y = 0;
3504 pActors[Actor_ITR].vVelocity.x = 0;
3509 signed int Act_Radius =
pActors[Actor_ITR].uActorRadius;
3521 for (Model_On_PID = 0; Model_On_PID < 100; ++Model_On_PID) {
3526 int Act_Z_Pos =
pActors[Actor_ITR].vPosition.z;
3553 bool bOnWater =
false;
3554 int Splash_Model_On;
3558 pActors[Actor_ITR].uActorHeight, &bOnWater, &Splash_Model_On, 0);
3560 if (v35 < Splash_Floor + 60) {
3565 int Splash_Z = Floor_Level + 60;
3566 if (Splash_Model_On)
3567 Splash_Z = Splash_Floor + 30;
3586 pActors[Actor_ITR].vPosition.x +=
3589 pActors[Actor_ITR].vPosition.y +=
3592 pActors[Actor_ITR].vPosition.z +=
3597 signed int Coll_Speed;
3604 if (
pActors[Actor_ITR].pMonsterInfo.uHostilityType) {
3613 }
else if (
pActors[v39].pMonsterInfo.uHostilityType ==
3624 if (!
pActors[Actor_ITR].GetActorsRelation(0)) {
3630 pActors[Actor_ITR].vVelocity.y = 0;
3631 pActors[Actor_ITR].vVelocity.x = 0;
3640 pActors[Actor_ITR].vVelocity.x *
pActors[Actor_ITR].vVelocity.x +
3641 pActors[Actor_ITR].vVelocity.y *
pActors[Actor_ITR].vVelocity.y);
3643 pActors[Actor_ITR].vPosition.x -
3645 pActors[Actor_ITR].vPosition.y -
3648 pActors[Actor_ITR].vVelocity.x =
3650 pActors[Actor_ITR].vVelocity.y =
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 =
3661 .pVertices.pVertices[
face->pVertexIDs[0]]
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 <
3669 pActors[Actor_ITR].vVelocity.y = 0;
3670 pActors[Actor_ITR].vVelocity.x = 0;
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) >>
3683 pActors[Actor_ITR].vVelocity.x +=
3685 pActors[Actor_ITR].vVelocity.y +=
3687 pActors[Actor_ITR].vVelocity.z +=
3689 if (
face->uPolygonType != 4) {
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) >>
3701 v46,
face->pFacePlane.vNormal.x);
3703 v46,
face->pFacePlane.vNormal.y);
3705 v46,
face->pFacePlane.vNormal.z);
3708 pActors[Actor_ITR].vVelocity.x,
3709 pActors[Actor_ITR].vVelocity.y);
3716 pActors[Actor_ITR].vVelocity.x =
3718 pActors[Actor_ITR].vVelocity.y =
3720 pActors[Actor_ITR].vVelocity.z =
3735 pActors[Actor_ITR].vVelocity.x),
3737 pActors[Actor_ITR].vVelocity.y) - 1) >>
3740 if (!uIsFlying && Tile_1_Land && !Tile_2_Land) {
3742 if (
pActors[Actor_ITR].CanAct()) {
3743 pActors[Actor_ITR].uYawAngle -= 32;
3744 pActors[Actor_ITR].uCurrentActionTime = 0;
3745 pActors[Actor_ITR].uCurrentActionLength = 128;
3749 if (!uIsFlying && Tile_1_Land == 0 && !uIsAboveFloor && Actor_On_Terrain) {
3751 unsigned int Tile_Test_Land = 0;
3754 for (
int i = Grid_X - 1; i <= Grid_X + 1; i++) {
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) {
3762 if (
pActors[Actor_ITR].CanAct()) {
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;
3773 if (Tile_Test_Land) {
3777 if (!Tile_Test_Land) {
3795 render->ClearZBuffer(0, 479);
3800 unsigned int respawn_interval = 0;
3852 int uViewportWidth =
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;
3862 for (
int i = 0; i < 20000; ++i) {
3872 if (
engine->IsUnderwater()) {
3880 L
"decompilation can be inaccurate, please send savegame to "
3885 return (
v2 & 0xE0E0E1) - 0xE0E0E1;
3890 (((
unsigned int)
v1 | (((
unsigned int)
v1 | 0xFFFFFF00) << 8))
3902 if (
engine->IsUnderwater())
3910 if (a3 == 0.0) v7 = 216;
3912 return (-1 - v7) << 24;
3916 if (a3 == 0.0) v7 = 216;
3918 return (-1 - v7) << 24;
3928 if (a3 == 0.0) v7 = 216;
3930 return (-1 - v7) << 24;
3934 if (a3 == 0.0) v7 = 216;
3936 return (-1 - v7) << 24;
3948 if (a3 == 0.0) v7 = 216;
3951 return (-1 - v7) << 24;
3956 return (sWorldPosX >> 9) +
3963 return 64 - (sWorldPosZ >>
4012 if (party_x1z1_y == party_x2z1_y && party_x2z1_y == party_x2z2_y &&
4013 party_x2z2_y == party_x1z2_y)
4016 int dx = abs(pos_x - party_grid_x1), dz = abs(party_grid_z1 - pos_z);
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;
4091 *pIsOnWater =
false;
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)) {
4110 return v14 + v8 +
fixpoint_mul(v13, (v10 - v8) * 128) +