Mercurial > mm7
annotate Outdoor.cpp @ 2222:66bd74aa9f5e
smk video draw
author | Ritor1 |
---|---|
date | Tue, 18 Feb 2014 19:43:54 +0600 |
parents | 0b2eea6f80c9 |
children | 5944810e88e2 |
rev | line source |
---|---|
1016 | 1 #include "stru6.h" |
1323 | 2 #include "Weather.h" |
1016 | 3 #include "Sprites.h" |
4 #include "LightmapBuilder.h" | |
0 | 5 #include "Outdoor.h" |
1277 | 6 #include "Outdoor_stuff.h" |
0 | 7 #include "Party.h" |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
8 #include "SpriteObject.h" |
0 | 9 #include "LOD.h" |
10 #include "PaletteManager.h" | |
11 #include "GUIProgressBar.h" | |
12 #include "AudioPlayer.h" | |
13 #include "DecorationList.h" | |
2037
7a9477135943
Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents:
2006
diff
changeset
|
14 #include "OurMath.h" |
0 | 15 #include "ObjectList.h" |
16 #include "Game.h" | |
17 #include "Actor.h" | |
18 #include "Chest.h" | |
19 #include "stru123.h" | |
2044 | 20 #include "Timer.h" |
0 | 21 #include "Viewport.h" |
22 #include "Events.h" | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1391
diff
changeset
|
23 #include "ParticleEngine.h" |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
24 #include "TurnEngine.h" |
0 | 25 |
26 #include "mm7_data.h" | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
813
diff
changeset
|
27 #include "MM7.h" |
1262 | 28 #include "Lights.h" |
0 | 29 |
30 | |
1016 | 31 #include "MapInfo.h" |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
32 #include "Outdoor_stuff.h" |
1016 | 33 #include "BSPModel.h" |
1297 | 34 #include "GUIWindow.h" |
1828
35c1e4ff6ba7
party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents:
1736
diff
changeset
|
35 #include "Level/Decoration.h" |
2207 | 36 #include "OurMath.h" |
0 | 37 |
783 | 38 MapStartPoint uLevel_StartingPointType; // weak |
39 | |
0 | 40 OutdoorLocation *pOutdoor = new OutdoorLocation; |
1637 | 41 ODMRenderParams *pODMRenderParams; |
0 | 42 |
43 | |
44 stru149 stru_8019C8; | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
45 std::array<struct Polygon, 2000 + 18000> array_77EC08; |
0 | 46 |
767 | 47 |
48 struct FogProbabilityTableEntry | |
49 { | |
50 unsigned char small_fog_chance; | |
51 unsigned char average_fog_chance; | |
52 unsigned char dense_fog_chance; | |
53 unsigned char __unused; | |
54 } fog_probability_table[15] = | |
55 { | |
56 { 20, 10, 5, 0}, // MAP_EMERALD_ISLE | |
57 { 20, 10, 5, 0}, // MAP_HARMONDALE | |
58 { 20, 10, 5, 0}, // MAP_STEADWICK | |
59 { 20, 10, 5, 0}, // MAP_PIERPONT | |
60 { 20, 10, 5, 0}, // MAP_DEYJA | |
61 { 10, 5, 0, 0}, // MAP_BRAKADA_DESERT | |
62 { 0, 0, 0, 0}, // MAP_CELESTIA | |
63 { 0, 0, 0, 0}, // MAP_THE_PIT | |
64 { 20, 30, 50, 0}, // MAP_EVENMORN_ISLE | |
65 { 30, 20, 10, 0}, // MAP_MOUNT_NIGHON | |
66 { 10, 5, 0, 0}, // MAP_BARROW_DOWNS | |
67 { 20, 10, 5, 0}, // MAP_LAND_OF_GIANTS | |
68 { 20, 10, 5, 0}, // MAP_TATALIA | |
69 { 20, 10, 5, 0}, // MAP_AVLEE | |
70 { 0, 100, 0, 0} // MAP_SHOALS | |
71 }; | |
72 | |
760 | 73 //for future sky textures? |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
74 std::array<int, 9> dword_4EC268={{3,3,3,3,3,3,3,3,3}}; // weak |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
75 std::array<int, 7> dword_4EC28C={{3,3,3,3,3,3,3}}; // weak |
760 | 76 int dword_4EC2A8=9; // weak |
77 int dword_4EC2AC=7; // weak | |
630 | 78 |
79 | |
80 | |
0 | 81 //----- (0047A59E) -------------------------------------------------------- |
82 void OutdoorLocation::ExecDraw(unsigned int bRedraw) | |
83 { | |
84 | |
1642 | 85 pGame->pIndoorCameraD3D->debug_flags = 0; |
186 | 86 if (viewparams->draw_d3d_outlines) |
1642 | 87 pGame->pIndoorCameraD3D->debug_flags |= ODM_RENDER_DRAW_D3D_OUTLINES; |
186 | 88 |
2153 | 89 if (bRedraw || true/*pRenderer->pRenderD3D*/) |
0 | 90 { |
1642 | 91 //pODMRenderParams->RotationToInts(); |
1637 | 92 sub_481ED9_MessWithODMRenderParams(); |
0 | 93 } |
762 | 94 |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
95 pODMRenderParams->uMapGridCellX = WorldPosToGridCellX(pParty->vPosition.x); |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
96 pODMRenderParams->uMapGridCellZ = WorldPosToGridCellZ(pParty->vPosition.y); |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
97 assert(pODMRenderParams->uMapGridCellX <= 127 && pODMRenderParams->uMapGridCellZ <= 127); |
762 | 98 |
121 | 99 if (bRedraw) |
0 | 100 { |
101 sub_487DA9(); | |
102 } | |
103 if ( pParty->uCurrentMinute != pOutdoor->uLastSunlightUpdateMinute ) | |
104 pOutdoor->UpdateSunlightVectors(); | |
105 pOutdoor->UpdateFog(); | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
106 //pGame->pIndoorCameraD3D->sr_Reset_list_0037C(); |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
107 |
2153 | 108 //if (pRenderer->pRenderD3D) // d3d - redraw always |
0 | 109 { |
1923 | 110 pRenderer->DrawOutdoorSkyD3D(); |
0 | 111 pRenderer->DrawBuildingsD3D(); |
985 | 112 pRenderer->RenderTerrainD3D(); |
0 | 113 } |
2153 | 114 /*else |
83 | 115 { |
2153 | 116 if (!bRedraw) |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
117 pRenderer->OnOutdoorRedrawSW(); |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
118 else |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
119 { |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
120 pRenderer->DrawBuildingsSW(); |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
121 pRenderer->DrawBezierTerrain(); |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
122 sr_sub_486F92_MessWithEdgesAndSpans(); |
1637 | 123 pODMRenderParams->ApplyLightmapsSW(); |
2153 | 124 } |
125 }*/ | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
126 |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
127 |
0 | 128 pMobileLightsStack->uNumLightsActive = 0; |
129 pStationaryLightsStack->uNumLightsActive = 0; | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
130 /*if ( !pRenderer->pRenderD3D ) |
0 | 131 { |
132 pRenderer->ExecOutdoorDrawSW(); | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
133 pGame->pIndoorCameraD3D->sr_438240_draw_lits(); |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
134 }*/ |
0 | 135 pGame->PushStationaryLights(-1); |
136 pGame->PrepareBloodsplats(); | |
121 | 137 if (bRedraw) |
2166 | 138 pOutdoor->UpdateDiscoveredArea(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y), 1); |
0 | 139 pGame->uFlags2 &= 0xFFFFFFFEu; |
2153 | 140 if (/*pRenderer->pRenderD3D*/true && pRenderer->bUsingSpecular) |
2166 | 141 pGame->pLightmapBuilder->uFlags |= 1; |
0 | 142 else |
143 pGame->pLightmapBuilder->uFlags &= 0xFFFFFFFEu; | |
142 | 144 |
0 | 145 uNumDecorationsDrawnThisFrame = 0; |
146 uNumSpritesDrawnThisFrame = 0; | |
147 uNumBillboardsToDraw = 0; | |
142 | 148 |
432 | 149 PrepareActorsDrawList(); |
1637 | 150 if (!pODMRenderParams->bDoNotRenderDecorations) |
432 | 151 pRenderer->PrepareDecorationsRenderList_ODM(); |
142 | 152 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
153 pRenderer->DrawSpriteObjects_ODM(); |
161 | 154 pRenderer->TransformBillboardsAndSetPalettesODM(); |
0 | 155 } |
156 | |
157 | |
158 //----- (00441CFF) -------------------------------------------------------- | |
159 void OutdoorLocation::Draw() | |
160 { | |
121 | 161 bool redrawWorld = true; |
162 if ( !(pParty->uFlags & 2) && !(pGame->uFlags2 & 1) ) | |
163 redrawWorld = false; | |
164 pOutdoor->ExecDraw(redrawWorld); | |
0 | 165 |
166 pGame->DrawParticles(); | |
2121 | 167 //pWeather->Draw();//если раскомментировать скорость снега быстрее |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1391
diff
changeset
|
168 trail_particle_generator.UpdateParticles(); |
0 | 169 } |
170 | |
171 //----- (00488E23) -------------------------------------------------------- | |
172 double OutdoorLocation::GetFogDensityByTime() | |
173 { | |
2166 | 174 if ( pParty->uCurrentHour < 5 )//ночь |
175 { | |
176 pWeather->bNight = true; | |
177 return 60.0 * 0.016666668; | |
178 } | |
179 else if ( pParty->uCurrentHour >= 5 && pParty->uCurrentHour < 6 )//рассвет | |
180 { | |
181 pWeather->bNight = false; | |
182 return (60.0 - (double)(60 * pParty->uCurrentHour + pParty->uCurrentMinute - 300)) * 0.016666668; | |
183 } | |
184 else if ( pParty->uCurrentHour >= 6 && pParty->uCurrentHour < 20 )//день | |
0 | 185 { |
2166 | 186 pWeather->bNight = false; |
187 return 0.0; | |
0 | 188 } |
2166 | 189 else if ( pParty->uCurrentHour >= 20 && pParty->uCurrentHour < 21 )//сумерки |
190 { | |
191 pWeather->bNight = false; | |
192 return ((double)(pParty->uCurrentHour - 20) * 60.0 + (double)(signed int)pParty->uCurrentMinute) * 0.016666668; | |
193 } | |
194 else//ночь | |
195 { | |
196 pWeather->bNight = true; | |
197 return 60.0 * 0.016666668; | |
198 } | |
0 | 199 } |
200 | |
201 //----- (00488EB1) -------------------------------------------------------- | |
202 int OutdoorLocation::GetSomeOtherTileInfo(int sX, int sY) | |
203 { | |
67 | 204 //OutdoorLocation *v3; // esi@1 |
0 | 205 unsigned int v4; // edi@1 |
206 unsigned int v5; // eax@1 | |
207 int result; // eax@5 | |
208 | |
67 | 209 /* v3 = this; |
0 | 210 v4 = WorldPosToGridCellZ(sY); |
211 v5 = WorldPosToGridCellX(sX); | |
212 if ( (v5 & 0x80000000u) != 0 || (signed int)v5 > 127 || (v4 & 0x80000000u) != 0 || (signed int)v4 > 127 ) | |
213 result = 0; | |
214 else | |
215 result = ActuallyGetSomeOtherTileInfo(v5, v4); | |
67 | 216 return result;*/ |
217 v4 = WorldPosToGridCellZ(sY); | |
218 v5 = WorldPosToGridCellX(sX); | |
219 if ( v5 < 0 || v5 > 127 || v4 < 0 || v4 > 127 ) | |
220 return 0; | |
221 return ActuallyGetSomeOtherTileInfo(v5, v4); | |
0 | 222 } |
223 // 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int); | |
224 // 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int); | |
225 | |
226 //----- (00488EEF) -------------------------------------------------------- | |
2003 | 227 unsigned int OutdoorLocation::GetTileTexture(signed int sX, signed int sY) |
0 | 228 { |
67 | 229 //OutdoorLocation *v3; // esi@1 |
2003 | 230 signed int v4; // edi@1 |
231 signed int v5; // eax@1 | |
67 | 232 // unsigned int result; // eax@5 |
0 | 233 |
67 | 234 /*v3 = this; |
0 | 235 v4 = WorldPosToGridCellZ(sZ); |
236 v5 = WorldPosToGridCellX(sX); | |
67 | 237 if ( v5< 0 || (signed int)v5 > 127 || v4 < 0 || (signed int)v4 > 127 )//if ( (v5 & 0x80000000u) != 0 || (signed int)v5 > 127 || (v4 & 0x80000000u) != 0 || (signed int)v4 > 127 ) |
0 | 238 result = -1; |
239 else | |
240 result = DoGetTileTexture(v5, v4); | |
67 | 241 return result;*/ |
242 v4 = WorldPosToGridCellZ(sY); | |
243 v5 = WorldPosToGridCellX(sX); | |
244 if ( v5 < 0 || v5 > 127 || v4 < 0 || v4 > 127 ) | |
245 return -1; | |
246 return DoGetTileTexture(v5, v4); | |
0 | 247 } |
248 // 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int); | |
249 // 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int); | |
250 | |
251 //----- (00488F2E) -------------------------------------------------------- | |
252 int OutdoorLocation::GetHeightOnTerrain(int sX, int sZ) | |
49 | 253 /* Функция предоставляет возможность перемещать камеру таким образом, чтобы она имитировала ходьбу по ландшафту. |
254 То есть нам надо менять высоту камеры (координату Y) в зависимости от того, в каком месте ландшафта мы находимся. | |
255 Для этого мы сначала должны определить по координатам X и Z камеры квадрат ландшафта в котором мы находимся. | |
256 Все это делает функция Terrain::getHeight; в своих параметрах она получает координаты X и Z камеры и возвращает высоту, | |
257 на которой должна быть расположена камера, чтобы она оказалась над ландшафтом.*/ | |
0 | 258 { |
259 int result; // eax@5 | |
260 | |
261 if ( sX < 0 || sX > 127 || sZ < 0 || sZ > 127 ) | |
262 result = 0; | |
263 else | |
264 result = DoGetHeightOnTerrain(sX, sZ); | |
265 return result; | |
266 } | |
267 | |
268 //----- (00488F5C) -------------------------------------------------------- | |
269 bool OutdoorLocation::Initialize(const char *pFilename, int File, size_t uRespawnInterval, int thisa) | |
270 { | |
271 OutdoorLocation *v5; // esi@1 | |
272 bool result; // eax@2 | |
273 | |
274 v5 = this; | |
275 if ( pFilename ) | |
276 { | |
277 Release(); | |
278 pBitmaps_LOD->ReleaseAll2(); | |
279 pSprites_LOD->DeleteSomeOtherSprites(); | |
280 pSpriteFrameTable->ResetSomeSpriteFlags(); | |
281 pIcons_LOD->ReleaseAll2(); | |
2152 | 282 |
119 | 283 if ( !Load(pFilename, (ODMFace *)File, uRespawnInterval, thisa) ) |
0 | 284 { |
285 MessageBoxA(0, "Error!", "Couldn't Load Map!", 0); | |
286 CreateDebugLocation(); | |
287 } | |
810 | 288 ::day_attrib = v5->loc_time.day_attrib; |
289 ::day_fogrange_1 = v5->loc_time.day_fogrange_1; | |
290 ::day_fogrange_2 = v5->loc_time.day_fogrange_2; | |
0 | 291 if ( Is_out15odm_underwater() ) |
292 SetUnderwaterFog(); | |
630 | 293 _6BE134_odm_main_tile_group = v5->pTileTypes[0].tileset; |
0 | 294 result = 1; |
295 } | |
296 else | |
297 { | |
298 result = 0; | |
299 } | |
300 return result; | |
301 } | |
302 | |
783 | 303 |
304 | |
305 char foot_travel_destinations[15][4] = | |
306 { | |
307 // north south east west from | |
308 {MAP_INVALID, MAP_INVALID, MAP_INVALID, MAP_INVALID}, // MAP_EMERALD_ISLE | |
309 {MAP_PIERPONT, MAP_BARROW_DOWNS, MAP_PIERPONT, MAP_STEADWICK}, // MAP_HARMONDALE | |
310 {MAP_DEYJA, MAP_BRAKADA_DESERT, MAP_HARMONDALE, MAP_TATALIA}, // MAP_STEADWICK | |
311 {MAP_AVLEE, MAP_HARMONDALE, MAP_INVALID, MAP_DEYJA}, // MAP_PIERPONT | |
312 {MAP_PIERPONT, MAP_STEADWICK, MAP_PIERPONT, MAP_STEADWICK}, // MAP_DEYJA | |
313 {MAP_STEADWICK, MAP_INVALID, MAP_BARROW_DOWNS, MAP_INVALID}, // MAP_BRAKADA_DESERT | |
314 {MAP_INVALID, MAP_INVALID, MAP_INVALID, MAP_INVALID}, // MAP_CELESTIA | |
315 {MAP_INVALID, MAP_INVALID, MAP_INVALID, MAP_INVALID}, // MAP_THE_PIT | |
316 {MAP_INVALID, MAP_INVALID, MAP_INVALID, MAP_INVALID}, // MAP_EVENMORN_ISLE | |
317 {MAP_INVALID, MAP_INVALID, MAP_INVALID, MAP_INVALID}, // MAP_MOUNT_NIGHON | |
318 {MAP_HARMONDALE, MAP_BRAKADA_DESERT, MAP_HARMONDALE, MAP_BRAKADA_DESERT}, // MAP_BARROW_DOWNS | |
319 {MAP_INVALID, MAP_INVALID, MAP_INVALID, MAP_INVALID}, // MAP_LAND_OF_GIANTS | |
320 {MAP_INVALID, MAP_INVALID, MAP_STEADWICK, MAP_INVALID}, // MAP_TATALIA | |
321 {MAP_INVALID, MAP_PIERPONT, MAP_PIERPONT, MAP_INVALID}, // MAP_AVLEE | |
322 {MAP_INVALID, MAP_INVALID, MAP_INVALID, MAP_INVALID} // MAP_SHOALS | |
323 }; | |
324 unsigned char foot_travel_times[15][4] = | |
325 { | |
326 // north south east west from | |
327 {0, 0, 0, 0}, // MAP_EMERALD_ISLE | |
328 {5, 5, 7, 5}, // MAP_HARMONDALE | |
329 {5, 5, 5, 5}, // MAP_STEADWICK | |
330 {5, 5, 0, 5}, // MAP_PIERPONT | |
331 {7, 5, 5, 4}, // MAP_DEYJA | |
332 {5, 0, 5, 0}, // MAP_BRAKADA_DESERT | |
333 {0, 0, 0, 0}, // MAP_CELESTIA | |
334 {0, 0, 0, 0}, // MAP_THE_PIT | |
335 {0, 0, 0, 0}, // MAP_EVENMORN_ISLE | |
336 {0, 0, 0, 0}, // MAP_MOUNT_NIGHON | |
337 {5, 7, 7, 5}, // MAP_BARROW_DOWNS | |
338 {0, 0, 0, 0}, // MAP_LAND_OF_GIANTS | |
339 {0, 0, 5, 0}, // MAP_TATALIA | |
340 {0, 7, 5, 0}, // MAP_AVLEE | |
341 {0, 0, 0, 0}, // MAP_SHOALS | |
342 }; | |
343 | |
344 | |
345 MapStartPoint foot_travel_arrival_points[15][4] = | |
346 { | |
347 // north south east west from | |
348 {MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party}, // MAP_EMERALD_ISLE | |
349 {MapStartPoint_South, MapStartPoint_North, MapStartPoint_South, MapStartPoint_East}, // MAP_HARMONDALE | |
350 {MapStartPoint_South, MapStartPoint_North, MapStartPoint_West, MapStartPoint_East}, // MAP_STEADWICK | |
351 {MapStartPoint_East, MapStartPoint_North, MapStartPoint_Party, MapStartPoint_East}, // MAP_PIERPONT | |
352 {MapStartPoint_West, MapStartPoint_North, MapStartPoint_West, MapStartPoint_North}, // MAP_DEYJA | |
353 {MapStartPoint_South, MapStartPoint_Party, MapStartPoint_West, MapStartPoint_Party}, // MAP_BRAKADA_DESERT | |
354 {MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party}, // MAP_CELESTIA | |
355 {MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party}, // MAP_THE_PIT | |
356 {MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party}, // MAP_EVENMORN_ISLE | |
357 {MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party}, // MAP_MOUNT_NIGHON | |
358 {MapStartPoint_South, MapStartPoint_East, MapStartPoint_South, MapStartPoint_East}, // MAP_BARROW_DOWNS | |
359 {MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party}, // MAP_LAND_OF_GIANTS | |
360 {MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_West, MapStartPoint_Party}, // MAP_TATALIA | |
361 {MapStartPoint_Party, MapStartPoint_North, MapStartPoint_North, MapStartPoint_Party}, // MAP_AVLEE | |
362 {MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party}, // MAP_SHOALS | |
363 }; | |
364 | |
365 | |
0 | 366 //----- (0048902E) -------------------------------------------------------- |
367 bool OutdoorLocation::GetTravelDestination(signed int sPartyX, signed int sPartyZ, char *pOut, signed int a5) | |
368 { | |
369 char *v6; // eax@3 | |
370 int v7; // eax@3 | |
783 | 371 //int v8; // edx@3 |
0 | 372 signed int v9; // esi@7 |
783 | 373 //int v10; // esi@23 |
0 | 374 signed int v11; // eax@23 |
783 | 375 //int v12; // ST14_4@25 |
2169 | 376 //signed int v14; // [sp-4h] [bp-84h]@6 |
138 | 377 char Str[140]; // [sp+8h] [bp-78h]@3 |
783 | 378 //int a5a; // [sp+94h] [bp+14h]@3 |
0 | 379 |
2169 | 380 strcpy(Str, this->pLevelFilename);//настоящая локация |
381 _strlwr(Str); | |
382 v6 = strtok(Str, "out"); | |
383 v6[2] = 0; | |
384 v7 = atoi(v6); | |
385 if ( a5 < 10 || strlen(this->pLevelFilename) != 9 || v7 < 1 || v7 > 15 ) //длина .odm и количество локаций | |
0 | 386 return 0; |
387 v9 = 1; | |
2169 | 388 if ( sPartyX < -22528 )//граница карты |
389 v9 = 4; | |
390 else if ( sPartyX > 22528 ) | |
391 v9 = 3; | |
392 else if ( sPartyZ < -22528 ) | |
393 v9 = 2; | |
394 else if ( sPartyZ <= 22528 ) | |
395 return 0; | |
396 | |
0 | 397 if ( v7 == 14 ) |
398 { | |
783 | 399 if ( v9 == 4 ) // to & from Shoals |
0 | 400 { |
1620
61ea994a1812
sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped to Player::HasUnderwaterSuitEquipped, sub_43EDB9_get_some_race_sex_relation_2 to ShouldLoadTexturesForRaceAndGender, Player_has_item to Player::HasItem
Grumpy7
parents:
1583
diff
changeset
|
401 if ( pPlayers[1]->HasUnderwaterSuitEquipped() && |
61ea994a1812
sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped to Player::HasUnderwaterSuitEquipped, sub_43EDB9_get_some_race_sex_relation_2 to ShouldLoadTexturesForRaceAndGender, Player_has_item to Player::HasItem
Grumpy7
parents:
1583
diff
changeset
|
402 pPlayers[2]->HasUnderwaterSuitEquipped() && |
61ea994a1812
sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped to Player::HasUnderwaterSuitEquipped, sub_43EDB9_get_some_race_sex_relation_2 to ShouldLoadTexturesForRaceAndGender, Player_has_item to Player::HasItem
Grumpy7
parents:
1583
diff
changeset
|
403 pPlayers[3]->HasUnderwaterSuitEquipped() && |
61ea994a1812
sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped to Player::HasUnderwaterSuitEquipped, sub_43EDB9_get_some_race_sex_relation_2 to ShouldLoadTexturesForRaceAndGender, Player_has_item to Player::HasItem
Grumpy7
parents:
1583
diff
changeset
|
404 pPlayers[4]->HasUnderwaterSuitEquipped()) |
0 | 405 { |
406 uDefaultTravelTime_ByFoot = 1; | |
407 strcpy(pOut, "out15.odm"); | |
783 | 408 uLevel_StartingPointType = MapStartPoint_East; |
0 | 409 LOWORD(pParty->uFlags) &= 0xFD7Bu; |
410 return 1; | |
411 } | |
783 | 412 //v8 = v7; |
0 | 413 } |
414 } | |
415 else | |
416 { | |
417 if ( v7 == 15 && v9 == 3 ) | |
418 { | |
419 uDefaultTravelTime_ByFoot = 1; | |
2169 | 420 strcpy(pOut, "out14.odm");//Авли |
783 | 421 uLevel_StartingPointType = MapStartPoint_West; |
2169 | 422 LOWORD(pParty->uFlags) &= 0xFD7Bu; |
423 return 1; | |
0 | 424 } |
425 } | |
783 | 426 //v10 = v9 + 4 * v7; |
427 //v11 = (unsigned __int8)aTiletableLoadU[v10 + 39]; | |
428 v11 = foot_travel_destinations[v7 - 1][v9 - 1]; | |
429 if (v11 == MAP_INVALID) | |
430 return false; | |
431 | |
432 assert(v11 <= MAP_SHOALS); | |
433 | |
434 uDefaultTravelTime_ByFoot = foot_travel_times[v7 - 1][v9 - 1]; | |
435 uLevel_StartingPointType = foot_travel_arrival_points[v7 - 1][v9 - 1]; | |
2169 | 436 sprintf(pOut, "out%02d.odm", v11); //локация направления |
783 | 437 return 1; |
438 //} | |
439 //return 0; | |
0 | 440 } |
441 // 6BD07C: using guessed type int uDefaultTravelTime_ByFoot; | |
442 // 6BE35C: using guessed type int uLevel_StartingPointType; | |
443 | |
444 //----- (0048917E) -------------------------------------------------------- | |
445 void OutdoorLocation::MessWithLUN() | |
446 { | |
447 this->pSpriteIDs_LUN[0] = -1; | |
2169 | 448 this->pSpriteIDs_LUN[1] = 0; |
0 | 449 this->pSpriteIDs_LUN[2] = pSpriteFrameTable->FastFindSprite("LUN1-4"); |
2169 | 450 this->pSpriteIDs_LUN[3] = 0; |
451 this->pSpriteIDs_LUN[4] = pSpriteFrameTable->FastFindSprite("LUN1-2"); | |
452 this->pSpriteIDs_LUN[5] = 0; | |
453 this->pSpriteIDs_LUN[6] = pSpriteFrameTable->FastFindSprite("LUN3-4"); | |
454 this->pSpriteIDs_LUN[7] = 0; | |
455 this->uSpriteID_LUNFULL = pSpriteFrameTable->FastFindSprite("LUNFULL"); | |
456 this->uSpriteID_LUN1_2_cp = pSpriteFrameTable->FastFindSprite("LUN1-2"); | |
457 this->uSpriteID_LUN1_4_cp = pSpriteFrameTable->FastFindSprite("LUN1-4"); | |
458 this->uSpriteID_LUN3_4_cp = pSpriteFrameTable->FastFindSprite("LUN3-4"); | |
459 this->field_D60 = -1; | |
460 this->field_CF0 = 4; | |
461 this->field_CF8 = 4; | |
462 this->field_D00 = 4; | |
463 this->field_CE8 = 0; | |
464 this->field_D3C = (int)this->pSpriteIDs_LUN; | |
465 this->field_D40 = 0; | |
466 this->field_D44 = 0; | |
467 this->field_D48 = 0; | |
468 this->field_D4C = 131072; | |
469 this->field_D5C = 0; | |
470 this->field_D64 = 0; | |
471 this->field_D28 = -1; | |
472 this->field_D08 = 0; | |
473 this->field_D0C = 0; | |
474 this->field_D10 = 0; | |
475 this->field_D24 = 0; | |
476 this->field_D2C = 0; | |
477 this->uSpriteID_LUN_SUN = pSpriteFrameTable->FastFindSprite("LUN-SUN"); | |
478 this->field_D14 = -131072; | |
479 for ( uint i = 0; i < 8; i++ ) | |
480 pSpriteFrameTable->InitializeSprite(this->pSpriteIDs_LUN[i]);//v2 += 2; | |
481 pSpriteFrameTable->InitializeSprite(this->uSpriteID_LUN_SUN); | |
0 | 482 } |
483 | |
484 //----- (004892E6) -------------------------------------------------------- | |
762 | 485 void OutdoorLocation::UpdateSunlightVectors() |
0 | 486 { |
487 unsigned int v3; // edi@3 | |
488 double v8; // st7@4 | |
489 | |
638 | 490 if ( pParty->uCurrentHour >= 5 && pParty->uCurrentHour < 21 ) |
0 | 491 { |
492 v3 = pParty->uCurrentMinute + 60 * (pParty->uCurrentHour - 5); | |
2169 | 493 this->inv_sunlight_y = 0; |
494 this->inv_sunlight_x = stru_5C6E00->Cos((signed int)(v3 * stru_5C6E00->uIntegerPi) / 960); | |
495 this->inv_sunlight_z = stru_5C6E00->Sin((signed int)(v3 * stru_5C6E00->uIntegerPi) / 960); | |
496 this->vSunlight.x = -this->inv_sunlight_x; | |
497 this->vSunlight.y = -this->inv_sunlight_y; | |
498 this->vSunlight.z = -this->inv_sunlight_z; | |
0 | 499 if ( (signed int)v3 >= 480 ) |
500 v8 = (double)(signed int)(960 - v3); | |
501 else | |
502 v8 = (double)(signed int)v3; | |
2169 | 503 this->max_terrain_dimming_level = (signed __int64)(20.0 - v8 / 480.0 * 20.0); |
504 this->uLastSunlightUpdateMinute = pParty->uCurrentMinute; | |
0 | 505 } |
506 } | |
507 | |
508 //----- (004893C1) -------------------------------------------------------- | |
509 void OutdoorLocation::UpdateFog() | |
510 { | |
511 fFogDensity = GetFogDensityByTime(); | |
512 } | |
513 | |
514 //----- (004893CF) -------------------------------------------------------- | |
515 int OutdoorLocation::GetNumFoodRequiredToRestInCurrentPos(int x, signed int y, int z) | |
516 { | |
517 int v7; // eax@4 | |
2166 | 518 int is_on_water; // [sp+8h] [bp-8h]@2 |
519 int bmodel_standing_on_pid; // [sp+Ch] [bp-4h]@2 | |
520 | |
521 is_on_water = 0; | |
522 bmodel_standing_on_pid = 0; | |
523 ODM_GetFloorLevel(x, y, z, pParty->uDefaultPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0); | |
524 if ( pParty->uFlags & 8 || bmodel_standing_on_pid || is_on_water )//на bmodel,и или на воде | |
0 | 525 return 2; |
2166 | 526 v7 = _47ED83(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1); |
527 switch ( pTileTable->pTiles[GetTileIdByTileMapId(v7)].tileset ) | |
0 | 528 { |
2166 | 529 case Tileset_Grass://на траве |
530 return 1; | |
531 case Tileset_Snow://на снегу | |
0 | 532 return 3; |
2166 | 533 case Tilset_Desert://на песке |
0 | 534 return 5; |
2166 | 535 case Tileset_3: |
536 case Tileset_Dirt:// на грязи | |
0 | 537 return 4; |
2166 | 538 case Tileset_Water:// on water(на воде) |
539 return 3;//еденицы еды | |
540 default: | |
541 return 2; | |
0 | 542 } |
543 } | |
767 | 544 |
0 | 545 //----- (00489487) -------------------------------------------------------- |
767 | 546 void OutdoorLocation::SetFog() |
0 | 547 { |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1458
diff
changeset
|
548 strcpy(pOutdoor->pLevelFilename, pCurrentMapName); |
0 | 549 |
1980 | 550 MAP_TYPE map_id = pMapStats->GetMapInfo(pCurrentMapName); |
767 | 551 if (map_id == MAP_INVALID || map_id == MAP_CELESTIA || map_id == MAP_THE_PIT || map_id > MAP_SHOALS) |
552 return; | |
553 | |
554 uint chance = rand() % 100; | |
555 | |
556 if (chance < fog_probability_table[map_id - 1].small_fog_chance) | |
0 | 557 { |
767 | 558 ::day_fogrange_1 = 4096; |
559 ::day_fogrange_2 = 8192; | |
560 ::day_attrib |= DAY_ATTRIB_FOG; | |
0 | 561 } |
767 | 562 else if (chance < fog_probability_table[map_id - 1].small_fog_chance + |
563 fog_probability_table[map_id - 1].average_fog_chance) | |
0 | 564 { |
767 | 565 ::day_fogrange_2 = 4096; |
566 ::day_fogrange_1 = 0; | |
567 ::day_attrib |= DAY_ATTRIB_FOG; | |
0 | 568 } |
767 | 569 else if (fog_probability_table[map_id - 1].dense_fog_chance && |
570 chance < fog_probability_table[map_id - 1].small_fog_chance + | |
571 fog_probability_table[map_id - 1].average_fog_chance + | |
572 fog_probability_table[map_id - 1].dense_fog_chance) | |
0 | 573 { |
767 | 574 ::day_fogrange_2 = 2048; |
575 ::day_fogrange_1 = 0; | |
576 ::day_attrib |= DAY_ATTRIB_FOG; | |
0 | 577 } |
767 | 578 else |
579 ::day_attrib &= ~DAY_ATTRIB_FOG; | |
580 | |
0 | 581 if ( Is_out15odm_underwater() ) |
582 SetUnderwaterFog(); | |
810 | 583 pOutdoor->loc_time.day_fogrange_1 = ::day_fogrange_1; |
584 pOutdoor->loc_time.day_fogrange_2 = ::day_fogrange_2; | |
585 pOutdoor->loc_time.day_attrib = ::day_attrib; | |
0 | 586 } |
587 | |
588 //----- (00482170) -------------------------------------------------------- | |
2169 | 589 bool ODMFace::IsBackfaceCulled(RenderVertexSoft *a2, struct Polygon *polygon) |
0 | 590 { |
591 unsigned int v5; // edx@1 | |
592 RenderVertexSoft *v6; // ecx@2 | |
593 double v7; // st7@5 | |
594 double v8; // st6@5 | |
595 double v9; // st5@5 | |
596 double v10; // st6@9 | |
597 double v11; // st5@9 | |
598 double v12; // st4@9 | |
599 double v14; // ST2C_8@17 | |
600 double v15; // ST20_8@17 | |
601 double v16; // ST0C_8@17 | |
602 double v17; // ST0C_8@17 | |
603 float v18; // [sp+8h] [bp-38h]@5 | |
604 float v19; // [sp+10h] [bp-30h]@5 | |
605 float v20; // [sp+14h] [bp-2Ch]@5 | |
606 float v21; // [sp+18h] [bp-28h]@5 | |
607 float v22; // [sp+1Ch] [bp-24h]@5 | |
608 float v23; // [sp+24h] [bp-1Ch]@5 | |
609 float v24; // [sp+28h] [bp-18h]@5 | |
610 float v25; // [sp+30h] [bp-10h]@5 | |
611 float v26; // [sp+34h] [bp-Ch]@5 | |
612 float v27; // [sp+38h] [bp-8h]@5 | |
613 float v28; // [sp+3Ch] [bp-4h]@5 | |
614 float a3a; // [sp+48h] [bp+8h]@5 | |
615 float a3b; // [sp+48h] [bp+8h]@17 | |
616 float a3c; // [sp+48h] [bp+8h]@17 | |
617 float a3d; // [sp+48h] [bp+8h]@17 | |
618 float a3e; // [sp+48h] [bp+8h]@17 | |
619 | |
2169 | 620 v5 = polygon->uNumVertices; |
0 | 621 if ( (signed int)v5 < 3 ) |
2169 | 622 return false; |
623 v6 = &a2[v5 - 1]; | |
624 if ( a2->vWorldPosition.z == a2[1].vWorldPosition.z && a2[1].vWorldPosition.z == v6->vWorldPosition.z ) | |
625 *(int *)&polygon->flags |= 0x10u; | |
626 v19 = a2[1].vWorldViewPosition.x - a2->vWorldViewPosition.x; | |
627 v18 = a2[1].vWorldViewPosition.y - a2->vWorldViewPosition.y; | |
628 v20 = a2[1].vWorldViewPosition.z - a2->vWorldViewPosition.z; | |
629 v21 = v6->vWorldViewPosition.x - a2->vWorldViewPosition.x; | |
630 v22 = v6->vWorldViewPosition.y - a2->vWorldViewPosition.y; | |
631 v23 = v6->vWorldViewPosition.z - a2->vWorldViewPosition.z; | |
632 v28 = a2[1].vWorldPosition.x - a2->vWorldPosition.x; | |
633 v27 = a2[1].vWorldPosition.y - a2->vWorldPosition.y; | |
634 a3a = a2[1].vWorldPosition.z - a2->vWorldPosition.z; | |
635 v7 = v6->vWorldPosition.x - a2->vWorldPosition.x; | |
636 v8 = v6->vWorldPosition.y - a2->vWorldPosition.y; | |
637 v9 = v6->vWorldPosition.z - a2->vWorldPosition.z; | |
0 | 638 v26 = v27 * v9 - v8 * a3a; |
639 v24 = v7 * a3a - v9 * v28; | |
640 v25 = v8 * v28 - v7 * v27; | |
641 if ( v26 == 0.0 && v24 == 0.0 && v25 == 0.0 ) | |
642 { | |
643 while ( 1 ) | |
644 { | |
645 --v5; | |
646 if ( (signed int)v5 < 2 ) | |
647 break; | |
2169 | 648 v10 = v6->vWorldPosition.x - a2->vWorldPosition.x; |
649 v11 = v6->vWorldPosition.y - a2->vWorldPosition.y; | |
650 v12 = v6->vWorldPosition.z - a2->vWorldPosition.z; | |
0 | 651 v26 = v27 * v12 - v11 * a3a; |
652 v24 = v10 * a3a - v12 * v28; | |
653 v25 = v11 * v28 - v10 * v27; | |
654 if ( v26 != 0.0 ) | |
655 break; | |
656 if ( v24 != 0.0 || v25 != 0.0 ) | |
657 break; | |
658 --v6; | |
659 } | |
2169 | 660 v21 = v6->vWorldViewPosition.x - a2->vWorldViewPosition.x; |
661 v22 = v6->vWorldViewPosition.y - a2->vWorldViewPosition.y; | |
662 v23 = v6->vWorldViewPosition.z - a2->vWorldViewPosition.z; | |
0 | 663 } |
2169 | 664 if ( ((double)pGame->pIndoorCameraD3D->vPartyPos.x - a2->vWorldPosition.x) * v26 |
665 + ((double)pGame->pIndoorCameraD3D->vPartyPos.z - a2->vWorldPosition.z) * v25 | |
666 + ((double)pGame->pIndoorCameraD3D->vPartyPos.y - a2->vWorldPosition.y) * v24 > 0.0 ) | |
0 | 667 { |
668 a3b = v23 * v18 - v22 * v20; | |
669 v14 = a3b + 6.7553994e15; | |
2169 | 670 polygon->v_18.x = LODWORD(v14); |
0 | 671 a3c = v21 * v20 - v23 * v19; |
672 v15 = a3c + 6.7553994e15; | |
2169 | 673 polygon->v_18.y = LODWORD(v15); |
0 | 674 a3d = v22 * v19 - v21 * v18; |
675 v16 = a3d + 6.7553994e15; | |
2169 | 676 polygon->v_18.z = LODWORD(v16); |
677 polygon->_normalize_v_18(); | |
678 a3e = -((double)polygon->v_18.x * a2->vWorldViewPosition.x) | |
679 - (double)polygon->v_18.y * a2->vWorldViewPosition.y | |
680 - (double)polygon->v_18.z * a2->vWorldViewPosition.z; | |
0 | 681 v17 = a3e + 6.7553994e15; |
2169 | 682 polygon->field_24 = LODWORD(v17); |
683 return true; | |
0 | 684 } |
685 else | |
2169 | 686 return false; |
0 | 687 } |
688 | |
689 //----- (0047C7A9) -------------------------------------------------------- | |
690 void OutdoorLocationTerrain::_47C7A9() | |
691 { | |
692 this->field_10 = 0; | |
693 this->field_12 = 0; | |
694 this->field_16 = 0; | |
695 this->field_14 = 0; | |
696 this->field_1C = 0; | |
697 this->field_18 = 0; | |
698 } | |
699 | |
700 //----- (0047C7C2) -------------------------------------------------------- | |
49 | 701 void OutdoorLocationTerrain::Release()//очистить локацию |
0 | 702 { |
703 if (pHeightmap) | |
704 { | |
1583 | 705 free(this->pHeightmap); |
0 | 706 pHeightmap = nullptr; |
707 } | |
708 if (pTilemap) | |
709 { | |
1583 | 710 free(pTilemap); |
0 | 711 pTilemap = nullptr; |
712 } | |
713 if (pAttributemap) | |
714 { | |
1583 | 715 free(pAttributemap); |
0 | 716 pAttributemap = nullptr; |
717 } | |
760 | 718 if (pDmap) |
0 | 719 { |
1583 | 720 free(pDmap); |
760 | 721 pDmap = nullptr; |
0 | 722 } |
723 | |
724 _47C7A9(); | |
725 } | |
726 | |
727 //----- (0047C80A) -------------------------------------------------------- | |
760 | 728 void OutdoorLocationTerrain::FillDMap( int X, int Y, int W, int Z ) |
2169 | 729 { |
0 | 730 double v6; // st7@1 |
731 double v7; // st7@2 | |
732 double v8; // st7@2 | |
733 int result; // eax@3 | |
734 int v10; // eax@4 | |
735 int v11; // ecx@5 | |
736 int v12; // ecx@6 | |
737 int v13; // edi@7 | |
738 int v14; // edx@9 | |
739 int v15; // eax@15 | |
49 | 740 unsigned __int8 *pMapHeight; // ebx@15 |
0 | 741 int v17; // eax@15 |
742 int v18; // ecx@15 | |
743 int v19; // esi@15 | |
744 int v20; // edi@15 | |
745 int v21; // edx@15 | |
746 int v22; // ecx@15 | |
747 int v23; // ebx@15 | |
748 int v24; // ecx@15 | |
749 int v25; // ST28_4@15 | |
750 double v26; // st7@15 | |
751 double v27; // st6@15 | |
752 double v28; // st5@15 | |
753 double v29; // st7@15 | |
754 double v30; // st7@16 | |
755 double v31; // st7@17 | |
756 int v32; // eax@21 | |
757 double v33; // st7@21 | |
758 double v34; // st6@21 | |
759 double v35; // st5@21 | |
760 double v36; // st7@21 | |
761 double v37; // st7@22 | |
762 double v38; // st7@23 | |
763 int v39; // [sp+14h] [bp-34h]@8 | |
764 int v40; // [sp+18h] [bp-30h]@15 | |
765 int v41; // [sp+1Ch] [bp-2Ch]@15 | |
766 int v42; // [sp+20h] [bp-28h]@15 | |
767 int v44; // [sp+28h] [bp-20h]@21 | |
768 float v45; // [sp+2Ch] [bp-1Ch]@1 | |
769 float v46; // [sp+30h] [bp-18h]@1 | |
770 float v47; // [sp+34h] [bp-14h]@1 | |
2169 | 771 //int v48; // [sp+38h] [bp-10h]@7 |
0 | 772 int v49; // [sp+3Ch] [bp-Ch]@10 |
773 int v50; // [sp+40h] [bp-8h]@9 | |
774 float v51; // [sp+44h] [bp-4h]@15 | |
775 float v52; // [sp+44h] [bp-4h]@21 | |
776 float v53; // [sp+50h] [bp+8h]@15 | |
777 float v54; // [sp+50h] [bp+8h]@21 | |
778 int v55; // [sp+54h] [bp+Ch]@15 | |
779 float v56; // [sp+54h] [bp+Ch]@15 | |
780 float v57; // [sp+54h] [bp+Ch]@21 | |
781 | |
782 v46 = -64.0; | |
783 v47 = -64.0; | |
784 v45 = 64.0; | |
785 v6 = sqrt(12288.0); | |
786 if ( v6 != 0.0 ) | |
787 { | |
788 v7 = 1.0 / v6; | |
789 v45 = 64.0 * v7; | |
790 v8 = v7 * -64.0; | |
791 v46 = v8; | |
792 v47 = v8; | |
793 } | |
760 | 794 result = Y; |
795 if ( Y > Z ) | |
0 | 796 { |
760 | 797 v10 = Z ^ Y; |
798 Z ^= Y ^ Z; | |
799 result = Z ^ v10; | |
0 | 800 } |
760 | 801 v11 = X; |
802 if ( X > W ) | |
0 | 803 { |
760 | 804 v12 = W ^ X; |
805 W ^= X ^ W; | |
806 v11 = W ^ v12; | |
0 | 807 } |
2169 | 808 //v48 = result - 1; |
760 | 809 if ( result - 1 <= Z ) |
0 | 810 { |
811 v39 = v11 - 1; | |
2169 | 812 for ( v13 = result - 1; v13 <= Z; v13++ ) |
0 | 813 { |
814 v50 = v39; | |
760 | 815 if ( v39 <= W ) |
0 | 816 { |
817 result = (v39 - 63) << 9; | |
818 v49 = (v39 - 63) << 9; | |
2169 | 819 for ( v14 = v39; v14 <= W; v14++ ) |
0 | 820 { |
821 if ( v13 >= 0 && result >= -32256 && v13 <= 127 && result <= 32768 ) | |
822 { | |
2169 | 823 //v15 = pOutLocTerrain->field_10; |
824 //v55 = pOutLocTerrain->field_10; | |
825 pMapHeight = this->pHeightmap; | |
826 v17 = (int)(&pMapHeight[v13 * this->field_10] + v14); | |
0 | 827 v18 = -v13; |
828 v19 = (64 - v13) << 9; | |
829 v20 = 32 * *(char *)v17; | |
830 v21 = 32 * *(char *)(v17 + 1); | |
2169 | 831 |
0 | 832 v22 = (v18 + 63) << 9; |
833 v41 = v22; | |
2169 | 834 v23 = (int)(&pMapHeight[this->field_10 * (v13 + 1)] + v14); |
0 | 835 v24 = v22 - v19; |
836 v40 = 32 * *(char *)v23; | |
837 v42 = 32 * *(char *)(v23 + 1); | |
760 | 838 |
0 | 839 v25 = v49 - 512 - v49; |
840 v26 = (double)-((v20 - v21) * v24); | |
841 v51 = v26; | |
842 v27 = (double)-(v25 * (v42 - v21)); | |
843 v53 = v27; | |
844 v28 = (double)(v25 * v24); | |
845 v56 = v28; | |
846 v29 = sqrt(v28 * v28 + v27 * v27 + v26 * v26); | |
847 if ( v29 != 0.0 ) | |
848 { | |
849 v30 = 1.0 / v29; | |
850 v51 = v51 * v30; | |
851 v53 = v53 * v30; | |
852 v56 = v30 * v56; | |
853 } | |
854 v31 = (v56 * v47 + v53 * v46 + v51 * v45) * 31.0; | |
855 if ( v31 < 0.0 ) | |
856 v31 = 0.0; | |
857 if ( v31 > 31.0 ) | |
858 v31 = 31.0; | |
2169 | 859 v44 = 2 * (v14 + v13 * this->field_10); |
860 //pOutLocTerrain = pOutLocTerrain2; | |
861 *((char *)this->pDmap + v44 + 1) = (signed __int64)v31; | |
760 | 862 |
0 | 863 v32 = v49 - (v49 - 512); |
864 v33 = (double)-((v42 - v40) * (v19 - v41)); | |
865 v52 = v33; | |
866 v34 = (double)-(v32 * (v20 - v40)); | |
867 v54 = v34; | |
868 v35 = (double)(v32 * (v19 - v41)); | |
869 v57 = v35; | |
870 v36 = sqrt(v35 * v35 + v34 * v34 + v33 * v33); | |
871 if ( v36 != 0.0 ) | |
872 { | |
873 v37 = 1.0 / v36; | |
874 v52 = v52 * v37; | |
875 v54 = v54 * v37; | |
876 v57 = v37 * v57; | |
877 } | |
878 v38 = (v57 * v47 + v54 * v46 + v52 * v45) * 31.0; | |
879 if ( v38 < 0.0 ) | |
880 v38 = 0.0; | |
881 if ( v38 > 31.0 ) | |
882 v38 = 31.0; | |
2169 | 883 //v13 = v48; |
884 *((char *)this->pDmap + v44) = (signed __int64)v38; | |
885 //v14 = v50; | |
0 | 886 result = v49; |
887 } | |
2169 | 888 //++v14; |
0 | 889 result += 512; |
2169 | 890 //v50 = v14; |
0 | 891 v49 = result; |
892 } | |
893 } | |
2169 | 894 //++v13; |
895 //v48 = v13; | |
0 | 896 } |
2169 | 897 //while ( v13 <= Z ); |
0 | 898 } |
899 } | |
900 | |
901 //----- (0047CB57) -------------------------------------------------------- | |
902 int OutdoorLocationTerrain::_47CB57(int a1, int a2, int a3) | |
903 { | |
904 signed int result; // eax@2 | |
905 unsigned __int16 *v5; // edx@3 | |
906 double v6; // st7@3 | |
907 int v8; // eax@3 | |
908 int v9; // eax@4 | |
909 int v10; // eax@5 | |
910 double v11; // st6@7 | |
911 signed int v12; // edi@7 | |
912 int v13; // esi@9 | |
913 char *v14; // esi@10 | |
914 signed int v15; // ecx@10 | |
915 char v16[256]; // [sp+4h] [bp-124h]@9 | |
916 unsigned __int16 *v17; // [sp+104h] [bp-24h]@3 | |
917 float v22; // [sp+118h] [bp-10h]@3 | |
918 float v23; // [sp+11Ch] [bp-Ch]@3 | |
919 int i; // [sp+120h] [bp-8h]@3 | |
920 unsigned int v25; // [sp+124h] [bp-4h]@5 | |
921 signed int a2a; // [sp+134h] [bp+Ch]@3 | |
922 unsigned int a2b; // [sp+134h] [bp+Ch]@7 | |
923 float a3a; // [sp+138h] [bp+10h]@7 | |
924 int a3b; // [sp+138h] [bp+10h]@9 | |
925 | |
2132 | 926 int num_r_bits = 5; |
927 int num_g_bits = 6; | |
928 int num_b_bits = 5; | |
929 | |
930 int r_mask = 0xF800; | |
931 int g_mask = 0x7E0; | |
932 int b_mask = 0x1F; | |
933 | |
2154 | 934 //if ( pRenderer->pRenderD3D ) |
0 | 935 result = 0; |
2154 | 936 /*else |
0 | 937 { |
2132 | 938 __debugbreak(); |
0 | 939 v5 = PaletteManager::Get_Dark_or_Red_LUT(a2, 0, 1); |
940 v6 = 0.0; | |
941 v22 = 0.0; | |
942 v8 = 0; | |
943 v17 = v5; | |
944 v23 = 0.0; | |
945 a2a = 0; | |
946 for ( i = 0; i < a3; ++i ) | |
947 { | |
948 v9 = *(char *)(v8 + a1); | |
949 if ( v9 ) | |
950 { | |
951 v10 = v5[v9]; | |
2132 | 952 v6 = v6 + (double)((signed int)(r_mask & v10) >> (num_b_bits + num_g_bits)); |
0 | 953 ++a2a; |
2132 | 954 v25 = b_mask & v10; |
955 v22 = (double)((signed int)(g_mask & v10) >> num_b_bits) + v22; | |
956 v23 = (double)(signed int)(b_mask & v10) + v23; | |
0 | 957 } |
958 v8 = i + 1; | |
959 } | |
960 v11 = 1.0 / (double)a2a; | |
961 a3a = v11; | |
962 v25 = (signed __int64)(a3a * v22); | |
963 i = (signed __int64)(a3a * v23); | |
964 v12 = 0; | |
2132 | 965 a2b = num_b_bits + num_g_bits; |
0 | 966 while ( 1 ) |
967 { | |
968 v13 = v17[v12]; | |
2132 | 969 a3b = abs((__int64)(signed __int64)(v11 * v6) - ((signed int)(r_mask & v17[v12]) >> a2b)); |
970 BYTE3(a3b) = abs((signed)v25 - ((signed int)(g_mask & v13) >> num_b_bits)) + a3b; | |
971 v16[v12++] = abs((signed)i - (signed)(b_mask & v13)) + BYTE3(a3b); | |
0 | 972 if ( v12 >= 256 ) |
973 break; | |
974 } | |
975 result = 0; | |
976 v14 = (char *)&pPaletteManager->field_D1600[42][23][116]; | |
977 v15 = 0; | |
978 do | |
979 { | |
980 if ( (unsigned __int8)v16[v15] < (signed int)v14 ) | |
981 { | |
982 v14 = (char *)(unsigned __int8)v16[v15]; | |
983 result = v15; | |
984 } | |
985 ++v15; | |
986 } | |
987 while ( v15 < 256 ); | |
2154 | 988 }*/ |
0 | 989 return result; |
990 } | |
991 | |
992 //----- (0047CCE2) -------------------------------------------------------- | |
993 bool OutdoorLocationTerrain::ZeroLandscape() | |
994 { | |
995 memset(this->pHeightmap, 0, 0x4000u); | |
2166 | 996 memset(this->pTilemap, 90, 0x4000u); |
997 memset(this->pAttributemap, 0, 0x4000u); | |
998 memset(this->pDmap, 0, 0x8000u); | |
999 this->field_12 = 128; | |
1000 this->field_10 = 128; | |
1001 this->field_16 = 7; | |
1002 this->field_14 = 7; | |
1003 this->field_1C = 127; | |
1004 this->field_18 = 127; | |
1005 return true; | |
0 | 1006 } |
1007 | |
1008 //----- (0047CD44) -------------------------------------------------------- | |
1009 bool OutdoorLocationTerrain::Initialize() | |
1010 { | |
1583 | 1011 pHeightmap = (unsigned __int8 *)malloc(0x4000u);//height map |
1012 pTilemap = (unsigned __int8 *)malloc(0x4000u);//tile map | |
1013 pAttributemap = (unsigned __int8 *)malloc(0x4000u);//карта атрибутов | |
1014 pDmap = (struct DMap *)malloc(0x8000u); | |
1015 if (pHeightmap && pTilemap && pAttributemap && pDmap ) | |
760 | 1016 return true; |
0 | 1017 else |
760 | 1018 return false; |
0 | 1019 } |
1020 | |
1021 //----- (0047CDE2) -------------------------------------------------------- | |
1022 void OutdoorLocation::CreateDebugLocation() | |
1023 { | |
2123 | 1024 //OutdoorLocation *v1; // esi@1 |
0 | 1025 void *v2; // eax@1 |
1026 void *v3; // ST14_4@1 | |
1027 void *v4; // eax@1 | |
1028 void *v5; // ST14_4@1 | |
1029 void *v6; // eax@1 | |
2123 | 1030 //unsigned int v7; // eax@1 |
1545 | 1031 //char v8; // zf@1 |
0 | 1032 |
2123 | 1033 //v1 = this; |
0 | 1034 strcpy(this->pLevelFilename, "blank"); |
2123 | 1035 strcpy(this->pLocationFileName, "i6.odm"); |
1036 strcpy(this->pLocationFileDescription, "MM6 Outdoor v1.00"); | |
1037 this->uNumBModels = 0; | |
1038 this->pTileTypes[0].tileset = Tileset_Grass; | |
1039 this->pTileTypes[1].tileset = Tileset_Water; | |
1040 this->pTileTypes[2].tileset = Tileset_6; | |
1041 this->pTileTypes[3].tileset = Tileset_RoadGrassCobble; | |
1042 this->LoadTileGroupIds(); | |
1043 this->LoadRoadTileset(); | |
1044 free(this->pBModels); | |
1045 free(this->pSpawnPoints); | |
1046 this->pBModels = 0; | |
1047 this->pSpawnPoints = 0; | |
1048 this->pTerrain.Initialize(); | |
1049 this->pTerrain.ZeroLandscape(); | |
1050 this->pTerrain.FillDMap(0, 0, 128, 128); | |
1051 free(this->pCmap); | |
1052 this->pCmap = 0; | |
1583 | 1053 v2 = malloc(0x8000u); |
2123 | 1054 v3 = this->pOMAP; |
1055 this->pCmap = v2; | |
1583 | 1056 free(v3); |
2123 | 1057 this->pOMAP = 0; |
1583 | 1058 v4 = malloc(0x10000u); |
2123 | 1059 this->pOMAP = (unsigned int *)v4; |
0 | 1060 memset(v4, 0, 0x10000u); |
2123 | 1061 v5 = this->pFaceIDLIST; |
1062 this->numFaceIDListElems = 0; | |
1583 | 1063 free(v5); |
2123 | 1064 this->pFaceIDLIST = 0; |
1583 | 1065 v6 = malloc(2); |
2123 | 1066 this->pFaceIDLIST = (unsigned __int16 *)v6; |
0 | 1067 *(short *)v6 = 0; |
2123 | 1068 strcpy(this->pSkyTextureName, pDefaultSkyTexture.data()); |
1069 this->sSky_TextureID = pBitmaps_LOD->LoadTexture(this->pSkyTextureName); | |
1070 strcpy(this->pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture.data()); | |
1071 //v7 = pBitmaps_LOD->LoadTexture(this->pGroundTileset); | |
1072 this->sMainTile_BitmapID = pBitmaps_LOD->LoadTexture(this->pGroundTileset); | |
1073 | |
1074 if ( this->sSky_TextureID == -1 ) | |
1545 | 1075 Error("Invalid Sky Tex Handle"); |
1076 | |
2123 | 1077 if ( this->sMainTile_BitmapID == -1 ) |
1545 | 1078 Error("Invalid Ground Tex Handle"); |
0 | 1079 } |
1080 | |
1081 //----- (0047CF9C) -------------------------------------------------------- | |
1082 void OutdoorLocation::Release() | |
1083 { | |
1084 strcpy(pLevelFilename, "blank"); | |
1085 strcpy(pLocationFileName, "default.odm"); | |
1086 strcpy(pLocationFileDescription, "MM6 Outdoor v1.00"); | |
1087 strcpy(pSkyTextureName, "sky043"); | |
1088 strcpy(pGroundTileset, "hm005"); | |
1089 | |
1090 if (pBModels) | |
1091 { | |
1092 for (uint i = 0; i < uNumBModels; ++i) | |
1093 pBModels[i].Release(); | |
1094 | |
1583 | 1095 free(pBModels); |
0 | 1096 pBModels = nullptr; |
1097 uNumBModels = 0; | |
1098 } | |
1099 | |
1100 if (pSpawnPoints) | |
1101 { | |
1583 | 1102 free(pSpawnPoints); |
0 | 1103 pSpawnPoints = nullptr; |
1104 } | |
1105 uNumSpawnPoints = 0; | |
1106 | |
1107 pTerrain.Release(); | |
1108 | |
760 | 1109 if (pCmap) |
0 | 1110 { |
1583 | 1111 free(pCmap); |
760 | 1112 pCmap = nullptr; |
0 | 1113 } |
1114 if (pOMAP) | |
1115 { | |
1583 | 1116 free(pOMAP); |
0 | 1117 pOMAP = nullptr; |
1118 } | |
1119 if (pFaceIDLIST) | |
1120 { | |
1583 | 1121 free(pFaceIDLIST); |
0 | 1122 pFaceIDLIST = nullptr; |
1123 } | |
1124 if (pTerrainNormals) | |
1125 { | |
1583 | 1126 free(pTerrainNormals); |
0 | 1127 pTerrainNormals = nullptr; |
1128 } | |
1129 } | |
1130 | |
1131 //----- (0047D0A6) -------------------------------------------------------- | |
119 | 1132 bool OutdoorLocation::Load(const char *pFilename, ODMFace *File, size_t pNumItems, int thisa)//загрузка локации |
0 | 1133 { |
1134 //OutdoorLocation *pOutdoorLocation; // esi@1 | |
1135 /*bool result; // eax@9 | |
1136 bool v7; // ebx@9 | |
1137 size_t v8; // eax@10 | |
1138 void *v9; // eax@10 | |
1139 void *v10; // eax@10 | |
1140 void *v11; // eax@10 | |
1141 int v12; // ebx@11 | |
1142 BSPModel *v13; // eax@12 | |
1143 void *v14; // eax@12 | |
1144 BSPModel *v15; // ecx@12 | |
1145 void *v16; // eax@12 | |
1146 BSPModel *v17; // ecx@12 | |
1147 BSPModel *v18; // eax@12 | |
1148 __int16 v19; // ax@15 | |
1149 __int16 v20; // ax@16 | |
1150 int v21; // ecx@16 | |
1151 ODMFace *v22; // ebx@26 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
1152 SpriteObject *pItems; // ecx@27 |
0 | 1153 unsigned int v24; // eax@28 |
1154 //unsigned __int8 v25; // zf@28 | |
1155 //unsigned __int8 v26; // sf@28 | |
1156 ODMFace *v27; // eax@28 | |
1157 const char *i; // edx@29 | |
1158 unsigned __int16 v29; // ax@33 | |
1159 unsigned __int16 v30; // ax@37 | |
1160 int v31; // ecx@37 | |
1161 int v32; // eax@38 | |
1162 void *v33; // eax@38 | |
1163 TileDesc *v34; // eax@43 | |
1164 unsigned int v35; // eax@43 | |
1165 unsigned int v36; // edi@43 | |
1166 unsigned int v37; // edi@45*/ | |
1167 //size_t v38; // eax@50 | |
1168 FILE *v39; // eax@50 | |
1169 //unsigned int v40; // edi@56 | |
1170 //void *v41; // eax@56 | |
1171 //void *v42; // ebx@56 | |
1172 //const void *v43; // ebx@59 | |
1173 //const void *v44; // ebx@59 | |
1174 //unsigned int v45; // eax@59 | |
1175 //BSPModel *v46; // eax@59 | |
1176 //unsigned int v47; // ecx@59 | |
1177 //int v48; // ebx@60 | |
1178 //BSPModel *v49; // eax@61 | |
1179 //BSPModel *v50; // eax@61 | |
1180 //BSPModel *v51; // eax@61 | |
1181 //BSPModel *v52; // eax@61 | |
1182 //BSPModel *v53; // eax@61 | |
1183 //BSPModel *v54; // ecx@61 | |
1184 //BSPModel *v55; // ecx@61 | |
1185 //BSPModel *v56; // ecx@61 | |
1186 //void *v57; // ST24_4@61 | |
1187 //BSPModel *v58; // ecx@61 | |
1188 //void *v59; // ST18_4@61 | |
1189 //BSPModel *v60; // eax@61 | |
1190 //__int16 v61; // ax@64 | |
1191 unsigned __int16 v62; // ax@65 | |
1192 //ODMFace *v63; // ecx@65 | |
1193 //unsigned __int16 v64; // ax@80 | |
1194 //const char *v65; // ecx@80 | |
1195 //int v66; // eax@81 | |
1196 //void *v67; // eax@81 | |
1197 //int v68; // ecx@81 | |
1198 //void *v69; // eax@81 | |
1199 //unsigned int v70; // eax@81 | |
1200 //SpawnPointMM7 *v71; // eax@81 | |
1201 //unsigned int v72; // ecx@81 | |
1202 //size_t v73; // eax@81 | |
1203 //int v74; // edi@87 | |
1204 //void *v75; // edi@88 | |
1205 //unsigned int v76; // edx@94 | |
1206 //int v77; // ecx@94 | |
1207 //char *v78; // eax@95 | |
1208 //unsigned int v79; // edx@97 | |
1209 //unsigned int v80; // eax@99 | |
1210 //int v81; // eax@107 | |
1211 //void *v82; // edi@114 | |
1212 //size_t v83; // eax@120 | |
1213 //const void *v84; // edi@120 | |
1214 //const void *v85; // edi@120 | |
1215 //BSPModel *v86; // eax@124 | |
1216 //unsigned int v87; // eax@124 | |
1217 //BSPModel *v88; // eax@126 | |
1218 //BSPModel *v89; // eax@127 | |
1219 //ODMFace *v90; // eax@129 | |
1220 //const void *v91; // edi@138 | |
1221 //const void *v92; // edi@141 | |
1222 //const void *v93; // edi@141 | |
1223 //const void *v94; // edi@144 | |
1224 //const void *v95; // edi@144 | |
1225 //const char *v96; // edi@147 | |
1226 //unsigned int v97; // eax@147 | |
1227 //TileDesc *v98; // eax@147 | |
1228 //unsigned int v99; // eax@147 | |
1229 //int v100; // ecx@150 | |
1230 //unsigned int v101; // eax@157 | |
1231 int v102; // edi@159 | |
1232 //void *v103; // [sp-14h] [bp-B94h]@55 | |
1233 //void *v104; // [sp-10h] [bp-B90h]@59 | |
1234 //size_t v105; // [sp-Ch] [bp-B8Ch]@59 | |
1235 //char *v106; // [sp-8h] [bp-B88h]@59 | |
1236 int v107; // [sp-4h] [bp-B84h]@12 | |
1237 int v108; // [sp+0h] [bp-B80h]@10 | |
1238 char Src[968]; // [sp+10h] [bp-B70h]@110 | |
1239 char Dst[968]; // [sp+3D8h] [bp-7A8h]@50 | |
1240 char Str[256]; // [sp+7A0h] [bp-3E0h]@50 | |
1241 /*char DstBuf; // [sp+8A0h] [bp-2E0h]@10 | |
1242 __int32 Offset; // [sp+8A4h] [bp-2DCh]@10 | |
1243 __int32 v114; // [sp+8B0h] [bp-2D0h]@10 | |
1244 __int32 v115; // [sp+8BCh] [bp-2C4h]@10 | |
1245 __int32 v116; // [sp+8C8h] [bp-2B8h]@10 | |
1246 __int32 v117; // [sp+8D4h] [bp-2ACh]@10 | |
1247 __int32 v118; // [sp+8E0h] [bp-2A0h]@10 | |
1248 __int32 v119; // [sp+8ECh] [bp-294h]@10 | |
1249 __int32 v120; // [sp+8F8h] [bp-288h]@10 | |
1250 __int32 v121; // [sp+904h] [bp-27Ch]@10 | |
1251 __int32 v122; // [sp+910h] [bp-270h]@10 | |
1252 __int32 v123; // [sp+91Ch] [bp-264h]@10 | |
1253 __int32 v124; // [sp+928h] [bp-258h]@26 | |
1254 __int32 v125; // [sp+934h] [bp-24Ch]@35 | |
1255 __int32 v126; // [sp+940h] [bp-240h]@38 | |
1256 __int32 v127; // [sp+94Ch] [bp-234h]@38 | |
1257 __int32 v128; // [sp+958h] [bp-228h]@38 | |
1258 __int32 v129; // [sp+964h] [bp-21Ch]@38 | |
1259 __int32 v130; // [sp+970h] [bp-210h]@38 | |
1260 __int32 v131; // [sp+97Ch] [bp-204h]@38 | |
1261 __int32 v132; // [sp+988h] [bp-1F8h]@38 | |
1262 __int32 v133; // [sp+994h] [bp-1ECh]@38 | |
1263 __int32 v134; // [sp+9A0h] [bp-1E0h]@38 | |
1264 __int32 v135; // [sp+9ACh] [bp-1D4h]@38 | |
1265 __int32 v136; // [sp+9D0h] [bp-1B0h]@10*/ | |
1266 //char FileName[8]; // [sp+A20h] [bp-160h]@8 | |
1267 //char v138; // [sp+A28h] [bp-158h]@12 | |
1268 //int v139; // [sp+B1Ch] [bp-64h]@10 | |
1269 //char pContainer[32]; // [sp+B20h] [bp-60h]@1 | |
1270 //int *v141; // [sp+B40h] [bp-40h]@50 | |
1271 //__int64 v142; // [sp+B44h] [bp-3Ch]@55 | |
1272 //size_t pSource; // [sp+B4Ch] [bp-34h]@56 | |
1273 //int v144; // [sp+B50h] [bp-30h]@61 | |
1274 //int v145; // [sp+B54h] [bp-2Ch]@68 | |
1275 ODMHeader header; // [sp+B58h] [bp-28h]@50 | |
1276 //unsigned int pDestLen; // [sp+B68h] [bp-18h]@13 | |
1277 //FILE *ptr; // [sp+B6Ch] [bp-14h]@12 | |
1278 //void *v149; // [sp+B70h] [bp-10h]@19 | |
1279 char *Str2; // [sp+B74h] [bp-Ch]@12 | |
1280 //int v151; // [sp+B78h] [bp-8h]@59 | |
1281 //void *uSourceLen; // [sp+B7Ch] [bp-4h]@59 | |
1282 | |
1283 //pOutdoorLocation = this; | |
1284 //strcpy(pContainer, pFilename); | |
1285 | |
1286 if (bUnderwater) | |
1287 { | |
1288 pPaletteManager->pPalette_tintColor[0] = 0x10; | |
1289 pPaletteManager->pPalette_tintColor[1] = 0xC2; | |
1290 pPaletteManager->pPalette_tintColor[2] = 0x99; | |
762 | 1291 pPaletteManager->SetMistColor(37, 143, 92); |
0 | 1292 } |
1293 else | |
1294 { | |
1295 pPaletteManager->pPalette_tintColor[0] = 0; | |
1296 pPaletteManager->pPalette_tintColor[1] = 0; | |
1297 pPaletteManager->pPalette_tintColor[2] = 0; | |
1298 if (pPaletteManager->pPalette_mistColor[0] != 0x80 || | |
1299 pPaletteManager->pPalette_mistColor[1] != 0x80 || | |
1300 pPaletteManager->pPalette_mistColor[2] != 0x80) | |
1301 { | |
762 | 1302 pPaletteManager->SetMistColor(128, 128, 128); |
0 | 1303 pPaletteManager->RecalculateAll(); |
1304 } | |
1305 } | |
1306 | |
1307 _6807E0_num_decorations_with_sounds_6807B8 = 0; | |
1308 /*sprintf(FileName, "levels\\%s", pContainer); | |
1309 if ( GetFileAttributesA(FileName) != -1 ) | |
1310 { | |
1311 result = (bool)fopen(FileName, "rb"); | |
1312 v7 = result; | |
1313 File = (ODMFace *)result; | |
1314 if ( !result ) | |
1315 return result; | |
1316 *(int *)thisa = 1; | |
1317 v8 = strlen(pContainer); | |
1318 v108 = 2; | |
1319 *((char *)&v139 + v8) = 0; | |
1320 viewparams->uTextureID_LocationMap = pIcons_LOD->LoadTexture(pContainer, (enum TEXTURE_TYPE)v108); | |
1321 fread(&DstBuf, 0x180u, 1u, (FILE *)v7); | |
1322 fseek((FILE *)v7, Offset, 0); | |
1323 fread(this, 0xB0u, 1u, (FILE *)v7); | |
1324 LoadTileGroupIds(); | |
630 | 1325 LoadRoadTileset(); |
0 | 1326 strcpy(pGroundTileset, "grastyl"); |
1327 fseek((FILE *)v7, v114, 0); | |
1328 fread(&uNumBModels, 4u, 1u, (FILE *)v7); | |
1329 fseek((FILE *)v7, v115, 0); | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
1330 fread(&uNumSpriteObjects, 4u, 1u, (FILE *)v7); |
0 | 1331 fseek((FILE *)v7, v116, 0); |
1332 fread(&uNumLevelDecorations, 4u, 1u, (FILE *)v7); | |
1333 fseek((FILE *)v7, v117, 0); | |
1334 fread(&uNumActors, 4u, 1u, (FILE *)v7); | |
1335 fseek((FILE *)v7, v118, 0); | |
1336 fread(&uNumChests, 4u, 1u, (FILE *)v7); | |
1337 pTerrain.Initialize(); | |
1338 fseek((FILE *)v7, v119, 0); | |
1339 fread(pTerrain.pHeightmap, 1u, 0x4000u, (FILE *)v7); | |
1340 fseek((FILE *)v7, v120, 0); | |
1341 fread(pTerrain.pTilemap, 1u, 0x4000u, (FILE *)v7); | |
1342 fseek((FILE *)v7, v121, 0); | |
1343 fread(pTerrain.pAttributemap, 1u, 0x4000u, (FILE *)v7); | |
1344 pTerrain._47C80A(0, 0, 128, 128); | |
1583 | 1345 free(ptr_D4); |
0 | 1346 ptr_D4 = 0; |
1583 | 1347 v9 = malloc(0, 0x8000u, "CMAP"); |
0 | 1348 v108 = (int)pOMAP; |
1349 ptr_D4 = v9; | |
1583 | 1350 free((void *)v108); |
0 | 1351 pOMAP = 0; |
1583 | 1352 v10 = malloc(0, 0x10000u, "OMAP"); |
0 | 1353 v108 = 0; |
1354 pOMAP = (unsigned int *)v10; | |
1355 fseek((FILE *)v7, v136, v108); | |
1356 fread(&uNumTerrainNormals, 4u, 1u, (FILE *)v7); | |
1357 fread(pTerrainSomeOtherData, 1u, 0x20000u, (FILE *)v7); | |
1358 fread(pTerrainNormalIndices, 1u, 0x10000u, (FILE *)v7); | |
1583 | 1359 pTerrainNormals = (Vec3_float_ *)malloc(pTerrainNormals, 12 * uNumTerrainNormals, "TerNorm"); |
0 | 1360 fread(pTerrainNormals, 1u, 12 * uNumTerrainNormals, (FILE *)v7); |
1583 | 1361 v11 = malloc(pBModels, 188 * uNumBModels, "BDdata"); |
0 | 1362 v108 = 0; |
1363 pBModels = (BSPModel *)v11; | |
1364 fseek((FILE *)v7, v122, v108); | |
1365 fread(pBModels, 0xBCu, uNumBModels, (FILE *)v7); | |
1366 fseek((FILE *)v7, v123, 0); | |
1367 pNumItems = 0; | |
1368 if ( (signed int)uNumBModels > 0 ) | |
1369 { | |
1370 v12 = 0; | |
1371 while ( 1 ) | |
1372 { | |
1373 pBModels[v12].pVertices.pVertices = 0; | |
1374 pBModels[v12].pFaces = 0; | |
1375 pBModels[v12].pFacesOrdering = 0; | |
1376 pBModels[v12].pNodes = 0; | |
1377 FileName[0] = 0; | |
1378 v108 = (int)&pBModels[v12]; | |
1379 sprintfex(FileName, "%s", v108); | |
1380 v13 = pBModels; | |
1381 v138 = 0; | |
1583 | 1382 pBModels[v12].pVertices.pVertices = (Vec3_int_ *)malloc(v13[v12].pVertices.pVertices, 12 * v13[v12].pVertices.uNumVertices, |
0 | 1383 FileName); |
1583 | 1384 pBModels[v12].pFaces = (ODMFace *)malloc(pBModels[v12].pFaces, 308 * pBModels[v12].uNumFaces, |
0 | 1385 FileName); |
1583 | 1386 pBModels[v12].pFacesOrdering = (unsigned __int16 *)malloc(pBModels[v12].pFacesOrdering, |
0 | 1387 2 * pBModels[v12].uNumFaces, FileName); |
1583 | 1388 v14 = malloc(pBModels[v12].pNodes, 8 * pBModels[v12].uNumNodes, FileName); |
0 | 1389 v15 = pBModels; |
1390 v108 = (int)File; | |
1391 v15[v12].pNodes = (BSPNode *)v14; | |
1392 fread(pBModels[v12].pVertices.pVertices, 0xCu, pBModels[v12].pVertices.uNumVertices, (FILE *)v108); | |
1393 fread(pBModels[v12].pFaces, 0x134u, pBModels[v12].uNumFaces, (FILE *)File); | |
1394 fread(pBModels[v12].pFacesOrdering, 2u, pBModels[v12].uNumFaces, (FILE *)File); | |
1395 fread(pBModels[v12].pNodes, 8u, pBModels[v12].uNumNodes, (FILE *)File); | |
1396 v16 = malloc(10 * pBModels[v12].uNumFaces); | |
1397 v107 = (int)File; | |
1398 v17 = pBModels; | |
1399 ptr = (FILE *)v16; | |
1400 fread(v16, 0xAu, v17[v12].uNumFaces, (FILE *)File); | |
1401 v18 = pBModels; | |
1402 Str2 = 0; | |
1403 if ( (signed int)v18[v12].uNumFaces > 0 ) | |
1404 break; | |
1405 LABEL_25: | |
1406 free(ptr); | |
1407 ++pNumItems; | |
1408 ++v12; | |
1409 if ( (signed int)pNumItems >= (signed int)uNumBModels ) | |
1410 goto LABEL_26; | |
1411 } | |
1412 pDestLen = 0; | |
1413 pFilename = (char *)ptr; | |
1414 while ( 1 ) | |
1415 { | |
1416 thisa = (int)((char *)v18[v12].pFaces + pDestLen); | |
1417 if ( !(*(char *)(thisa + 29) & 0x40) ) | |
1418 break; | |
1419 v19 = pTextureFrameTable->FindTextureByName(pFilename); | |
1420 *(short *)(thisa + 272) = v19; | |
1421 if ( !v19 ) | |
1422 { | |
1423 v20 = pBitmaps_LOD->LoadTexture(pFilename); | |
1424 v21 = thisa; | |
1425 *(char *)(v21 + 29) &= 0xBFu; | |
1426 LABEL_19: | |
1427 *(short *)(v21 + 272) = v20; | |
1428 v149 = (void *)(v20 != -1 ? &pBitmaps_LOD->pTextures[v20] : 0); | |
1429 auto pTex = (Texture *)v149; | |
1430 if (pTex) | |
1431 pTex->palette_id2 = pPaletteManager->LoadPalette(pTex->palette_id1); | |
1432 goto LABEL_20; | |
1433 } | |
1434 pTextureFrameTable->LoadAnimationSequenceAndPalettes(*(unsigned __int16 *)((char *)&pBModels[v12].pFaces->uTextureID + pDestLen)); | |
1435 LABEL_20: | |
1436 if ( *(short *)(thisa + 292) ) | |
1437 { | |
1438 if ( ((ODMFace *)thisa)->HasEventHint() ) | |
1439 *(char *)(thisa + 30) |= 0x10u; | |
1440 else | |
1441 *(char *)(thisa + 30) &= 0xEFu; | |
1442 } | |
1443 ++Str2; | |
1444 v18 = pBModels; | |
1445 pDestLen += 308; | |
1446 pFilename += 10; | |
1447 if ( (signed int)Str2 >= (signed int)v18[v12].uNumFaces ) | |
1448 goto LABEL_25; | |
1449 } | |
1450 v20 = pBitmaps_LOD->LoadTexture(pFilename); | |
1451 v21 = thisa; | |
1452 goto LABEL_19; | |
1453 } | |
1454 LABEL_26: | |
1455 v22 = File; | |
1456 fseek((FILE *)File, v124, 0); | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
1457 fread(pSpriteObjects, 0x70u, uNumSpriteObjects, (FILE *)v22); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
1458 if ( (signed int)uNumSpriteObjects > 0 ) |
0 | 1459 { |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
1460 pItems = pSpriteObjects; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
1461 pNumItems = uNumSpriteObjects; |
0 | 1462 do |
1463 { | |
1464 v24 = pItems->stru_24.uItemID; | |
1465 thisa = 0; | |
1466 v27 = (ODMFace *)(48 * v24); | |
1467 v25 = pObjectList->uNumObjects == 0; | |
1468 v26 = (pObjectList->uNumObjects & 0x80000000u) != 0; | |
1469 LOWORD(v27) = *(short *)((char *)&v27->pFacePlane.vNormal.x + (int)((char *)&pItemsTable + 24)); | |
1470 File = v27; | |
1471 pItems->uItemType = (unsigned __int16)v27; | |
1472 if ( v26 | v25 ) | |
1473 { | |
1474 LABEL_33: | |
1475 v29 = 0; | |
1476 } | |
1477 else | |
1478 { | |
1479 for ( i = (const char *)&pObjectList->pObjects->uObjectID; (short)v27 != *(short *)i; i = pFilename ) | |
1480 { | |
1481 ++thisa; | |
1482 pFilename = (char *)i + 56; | |
1483 if ( thisa >= (signed int)pObjectList->uNumObjects ) | |
1484 goto LABEL_33; | |
1485 LOWORD(v27) = (short)File; | |
1486 } | |
1487 v29 = thisa; | |
1488 } | |
1489 pItems->uObjectDescID = v29; | |
1490 ++pItems; | |
1491 --pNumItems; | |
1492 } | |
1493 while ( pNumItems ); | |
1494 } | |
1495 fseek((FILE *)v22, v125, 0); | |
1496 fread(pLevelDecorations, 0x20u, uNumLevelDecorations, (FILE *)v22); | |
1497 pNumItems = 0; | |
1498 if ( (signed int)uNumLevelDecorations > 0 ) | |
1499 { | |
1500 thisa = (int)pLevelDecorations; | |
1501 do | |
1502 { | |
1503 fread(FileName, 1u, 0x20u, (FILE *)v22); | |
1504 v30 = pDecorationList->GetDecorIdByName(FileName); | |
1505 v31 = thisa; | |
1506 ++pNumItems; | |
1507 thisa += 32; | |
1508 *(short *)v31 = v30; | |
1509 } | |
1510 while ( (signed int)pNumItems < (signed int)uNumLevelDecorations ); | |
1511 } | |
1512 fseek((FILE *)v22, v126, 0); | |
1513 fread(pActors, 0x344u, uNumActors, (FILE *)v22); | |
1514 fseek((FILE *)v22, v127, 0); | |
1515 fread(pChests, 0x14CCu, uNumChests, (FILE *)v22); | |
1516 fseek((FILE *)v22, v128, 0); | |
1517 fread(&field_DC, 4u, 1u, (FILE *)v22); | |
1583 | 1518 free(pFaceIDLIST); |
0 | 1519 v32 = field_DC; |
1520 pFaceIDLIST = 0; | |
1583 | 1521 v33 = malloc(0, 2 * v32, "IDLIST"); |
0 | 1522 v108 = (int)v22; |
1523 pFaceIDLIST = (unsigned __int16 *)v33; | |
1524 fread(v33, 2u, field_DC, (FILE *)v108); | |
1525 fseek((FILE *)v22, v129, 0); | |
1526 fread(pOMAP, 4u, 0x4000u, (FILE *)v22); | |
1527 fseek((FILE *)v22, v130, 0); | |
1528 fread(&uNumSpawnPoints, 4u, 1u, (FILE *)v22); | |
1583 | 1529 pSpawnPoints = (SpawnPointMM7 *)malloc(pSpawnPoints, 24 * uNumSpawnPoints, "Spawn"); |
0 | 1530 fseek((FILE *)v22, v131, 0); |
1531 fread(pSpawnPoints, 0x18u, uNumSpawnPoints, (FILE *)v22); | |
1532 fseek((FILE *)v22, v132, 0); | |
1533 fread(&ddm, 0x28u, 1u, (FILE *)v22); | |
1534 fseek((FILE *)v22, v133, 0); | |
1535 fread(&stru_5E4C90, 1u, 0xC8u, (FILE *)v22); | |
1536 fseek((FILE *)v22, v134, 0); | |
1537 fread(&uLastVisitDay, 1u, 0x38u, (FILE *)v22); | |
1538 fseek((FILE *)v22, v135, 0); | |
1539 fread(&uLastVisitDay, 1u, 4u, (FILE *)v22); | |
1540 thisa = (int)pTileTypes; | |
1541 pTileTable->InitializeTileset(4); | |
1542 pTileTable->InitializeTileset(pTileTypes[0].uTileGroup); | |
1543 pTileTable->InitializeTileset(pTileTypes[1].uTileGroup); | |
1544 pTileTable->InitializeTileset(pTileTypes[2].uTileGroup); | |
1545 pTileTable->InitializeTileset(pTileTypes[3].uTileGroup); | |
1546 if ( this != (OutdoorLocation *)-96 && pSkyTextureName[0] ) | |
1547 { | |
1548 v108 = 0; | |
1549 v107 = (int)pSkyTextureName; | |
1550 } | |
1551 else | |
1552 { | |
1553 v108 = 0; | |
1554 v107 = (int)pDefaultSkyTexture; | |
1555 } | |
2006 | 1556 sSky_TextureID = pBitmaps_LOD->LoadTexture((const char *)v107, (enum TEXTURE_TYPE)v108); |
0 | 1557 strcpy(pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture); |
1558 v34 = pTileTable->GetTileById(pTileTypes[0].uTileID); | |
1559 v35 = pBitmaps_LOD->LoadTexture(v34->pTileName); | |
2006 | 1560 v36 = sSky_TextureID; |
1561 sMainTile_BitmapID = v35; | |
0 | 1562 if ( v36 != -1 ) |
1563 pBitmaps_LOD->pTextures[v36].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v36].palette_id1); | |
1564 | |
2006 | 1565 v37 = sMainTile_BitmapID; |
0 | 1566 if ( v37 != -1 ) |
1567 pBitmaps_LOD->pTextures[v37].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v37].palette_id1); | |
1568 | |
1569 _47F0E2(); | |
1570 pGameLoadingUI_ProgressBar->Progress(); | |
1571 fclose((FILE *)v22); | |
1572 goto LABEL_150; | |
1573 }*/ | |
1574 | |
1575 assert(sizeof(BSPModel) == 188); | |
1576 | |
1577 if (!pGames_LOD->DoesContainerExist(pFilename)) | |
1545 | 1578 Error("Unable to find %s in Games.LOD", pFilename); |
0 | 1579 |
119 | 1580 |
1581 char pMinimapTextureFilename[1024]; | |
1582 strcpy(pMinimapTextureFilename, pFilename); | |
1583 pMinimapTextureFilename[strlen(pMinimapTextureFilename) - 4] = 0; | |
1584 viewparams->uTextureID_LocationMap = pIcons_LOD->LoadTexture(pMinimapTextureFilename, TEXTURE_16BIT_PALETTE); | |
1585 | |
0 | 1586 //strcpy(FileName, pContainer); |
1587 strcpy(Str, pFilename); | |
1588 strcpy(Str + strlen(Str) - 4, ".odm"); | |
1589 //v141 = &v139; | |
1590 //v38 = strlen(pFilename); | |
1591 //strcpy((char *)&v139 + v38, ".odm"); | |
1592 v39 = pGames_LOD->FindContainer(Str, 1); | |
1593 //Str[strlen(Str) - 4] = 0; | |
1594 | |
1595 header.uCompressedSize = 0; | |
1596 header.uDecompressedSize = 0; | |
1597 //ptr = v39; | |
1598 header.uVersion = 91969; | |
1599 header.pMagic[0] = 'm'; | |
1600 header.pMagic[1] = 'v'; | |
1601 header.pMagic[2] = 'i'; | |
1602 header.pMagic[3] = 'i'; | |
1603 fread(&header, 0x10u, 1u, v39); | |
1604 if (header.uVersion != 91969 || | |
1605 header.pMagic[0] != 'm' || | |
1606 header.pMagic[1] != 'v' || | |
1607 header.pMagic[2] != 'i' || | |
1608 header.pMagic[3] != 'i') | |
1609 { | |
1610 MessageBoxW(nullptr, L"Can't load file!", | |
1611 L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:507", 0); | |
1612 } | |
1613 //v40 = header.uCompressedSize; | |
1614 //pSource = header.uDecompressedSize; | |
1615 //v41 = malloc(header.uDecompressedSize); | |
1980 | 1616 uchar* pSrcMem = (unsigned char *)malloc(header.uDecompressedSize); |
1617 uchar* pSrc = pSrcMem; | |
0 | 1618 //v42 = v41; |
1619 //HIDWORD(v142) = (uint32)pSrc; | |
1620 if (header.uCompressedSize < header.uDecompressedSize) | |
1621 { | |
1980 | 1622 char* pComressedSrc = (char *)malloc(header.uCompressedSize); |
0 | 1623 fread(pComressedSrc, header.uCompressedSize, 1, v39); |
1624 | |
1625 uint actualDecompressedSize = header.uDecompressedSize; | |
1626 zlib::MemUnzip(pSrc, &actualDecompressedSize, pComressedSrc, header.uCompressedSize); | |
1627 free(pComressedSrc); | |
1628 } | |
1629 else | |
1630 { | |
1631 fread(pSrc, header.uDecompressedSize, 1, v39); | |
1632 } | |
1633 | |
1634 memcpy(pLevelFilename, pSrc, 0x20); | |
1635 memcpy(pLocationFileName, pSrc + 0x20, 0x20); | |
1636 memcpy(pLocationFileDescription, pSrc + 0x40, 0x20); | |
67 | 1637 memcpy(pSkyTextureName, pSrc + 3 * 32, 32); |
0 | 1638 memcpy(pGroundTileset, pSrc + 0x80, 0x20); |
1639 memcpy(pTileTypes, pSrc + 0xA0, 0x10); | |
1640 pSrc += 0xB0; | |
1641 | |
1642 //v43 = (char *)pSrc + 176; | |
1643 LoadTileGroupIds(); | |
630 | 1644 LoadRoadTileset(); |
0 | 1645 strcpy(pGroundTileset, "grastyl"); |
1646 pGameLoadingUI_ProgressBar->Progress(); | |
1647 pTerrain.Initialize(); | |
1648 //v108 = 16384; | |
1649 //v107 = (int)v43; | |
1650 //v106 = (char *)pTerrain.pHeightmap; | |
1651 memcpy(pTerrain.pHeightmap, pSrc, 0x4000); | |
1652 pSrc += 0x4000; | |
1653 | |
1654 //v43 = (char *)v43 + 16384; | |
1655 //v105 = 16384; | |
1656 //v104 = (void *)v43; | |
1657 //v103 = pTerrain.pTilemap; | |
1658 memcpy(pTerrain.pTilemap, pSrc, 0x4000); | |
1659 pSrc += 0x4000; | |
1660 | |
1661 //v43 = (char *)v43 + 16384; | |
1662 memcpy(pTerrain.pAttributemap, pSrc, 0x4000); | |
1663 pSrc += 0x4000; | |
1664 | |
1665 //v43 = (char *)v43 + 16384; | |
1666 //v108 = (int)ptr_D4; | |
760 | 1667 if (pCmap) |
0 | 1668 { |
1583 | 1669 free(pCmap); |
760 | 1670 pCmap = nullptr; |
0 | 1671 } |
1583 | 1672 pCmap = malloc(0x8000); |
760 | 1673 pTerrain.FillDMap(0, 0, 128, 128); |
0 | 1674 |
1675 pGameLoadingUI_ProgressBar->Progress(); | |
1676 memcpy(&uNumTerrainNormals, pSrc, 4); | |
1677 //v43 = (char *)v43 + 4; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1678 memcpy(pTerrainSomeOtherData.data(), pSrc + 4, 0x20000); |
0 | 1679 pSrc += 4 + 0x20000; |
1680 //v43 = (char *)v43 + 131072; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1681 memcpy(pTerrainNormalIndices.data(), pSrc, 0x10000); |
0 | 1682 pSrc += 0x10000; |
1683 //v43 = (char *)v43 + 65536; | |
1684 | |
1685 //pFilename = (char *)(12 * uNumTerrainNormals); | |
1583 | 1686 pTerrainNormals = (Vec3_float_ *)malloc(sizeof(Vec3_float_) * uNumTerrainNormals); |
0 | 1687 memcpy(pTerrainNormals, pSrc, 12 * uNumTerrainNormals); |
1688 pSrc += 12 * uNumTerrainNormals; | |
1689 //v44 = (char *)v43 + (int)pFilename; | |
1690 //v44 = (char *)v44 + 4; | |
1691 //v45 = uNumBModels; | |
1692 //v108 = (int)"BDdata"; | |
1693 | |
1694 pGameLoadingUI_ProgressBar->Progress(); | |
1695 | |
1696 //v107 = 188 * v45; | |
1697 //v106 = (char *)pBModels; | |
1583 | 1698 //v46 = (BSPModel *)malloc(v106, 188 * v45, "BDdata"); |
0 | 1699 //v47 = uNumBModels; |
1700 memcpy(&uNumBModels, pSrc, 4); | |
1583 | 1701 pBModels = (BSPModel *)malloc(188 * uNumBModels); |
0 | 1702 //pFilename = (char *)(188 * v47); |
1703 memcpy(pBModels, pSrc + 4, 188 * uNumBModels); | |
1704 pSrc += 4 + 188 * uNumBModels; | |
1705 | |
1706 pGameLoadingUI_ProgressBar->Progress(); | |
1707 | |
1708 //uSourceLen = (char *)v44 + (int)pFilename; | |
1709 //v151 = 0; | |
1710 for (uint i = 0; i < uNumBModels; ++i) | |
1711 { | |
1712 //v48 = 0; | |
2143 | 1713 //BSPModel* model = &pBModels[i]; |
1714 | |
1715 pBModels[i].pVertices.pVertices = nullptr; | |
1716 pBModels[i].pFaces = nullptr; | |
1717 pBModels[i].pFacesOrdering = nullptr; | |
1718 pBModels[i].pNodes = nullptr; | |
0 | 1719 //FileName[0] = 0; |
1720 //v108 = (int)&pBModels[i]; | |
1721 //sprintf(FileName, "%s", v108); | |
1722 //v49 = pBModels; | |
1723 //v138 = 0; | |
1724 //v50 = &pBModels[v48]; | |
1725 //v108 = (int)FileName; | |
1726 //v107 = 12 * v50->pVertices.uNumVertices; | |
1727 //v106 = (char *)v50->pVertices.pVertices; | |
1728 assert(sizeof(Vec3_int_) == 12); | |
2143 | 1729 uint verticesSize = pBModels[i].pVertices.uNumVertices * sizeof(Vec3_int_); |
1730 pBModels[i].pVertices.pVertices = (Vec3_int_ *)malloc(verticesSize); | |
1731 memcpy(pBModels[i].pVertices.pVertices, pSrc, verticesSize); | |
0 | 1732 pSrc += verticesSize; |
1733 //v51 = &pBModels[v48]; | |
1734 //v108 = (int)FileName; | |
1735 //v107 = 308 * v51->uNumFaces; | |
1736 //v106 = (char *)v51->pFaces; | |
1737 assert(sizeof(ODMFace) == 308); | |
2143 | 1738 uint facesSize = pBModels[i].uNumFaces * sizeof(ODMFace); |
1739 pBModels[i].pFaces = (ODMFace *)malloc(facesSize); | |
1740 memcpy(pBModels[i].pFaces, pSrc, facesSize); | |
0 | 1741 pSrc += facesSize; |
1742 //v52 = &pBModels[v48]; | |
1743 //v108 = (int)FileName; | |
1744 //v107 = 2 * v52->uNumFaces; | |
1745 //v106 = (char *)v52->pFacesOrdering; | |
2143 | 1746 uint facesOrderingSize = pBModels[i].uNumFaces * sizeof(short); |
1747 pBModels[i].pFacesOrdering = (unsigned __int16 *)malloc(facesOrderingSize); | |
1748 memcpy(pBModels[i].pFacesOrdering, pSrc, facesOrderingSize); | |
0 | 1749 pSrc += facesOrderingSize; |
1750 //v53 = &pBModels[v48]; | |
1751 //v108 = (int)FileName; | |
1752 //v107 = 8 * v53->uNumNodes; | |
1753 //v106 = (char *)v53->pNodes; | |
1754 assert(sizeof(BSPNode) == 8); | |
2143 | 1755 uint nodesSize = pBModels[i].uNumNodes * sizeof(BSPNode); |
1756 pBModels[i].pNodes = (BSPNode *)malloc(nodesSize); | |
1757 memcpy(pBModels[i].pNodes, pSrc, nodesSize); | |
0 | 1758 pSrc += nodesSize; |
1759 //v54 = &pBModels[v48]; | |
1760 //v108 = 12 * v54->pVertices.uNumVertices; | |
1761 //pFilename = (char *)v108; | |
1762 //v107 = (int)uSourceLen; | |
1763 //v106 = (char *)v54->pVertices.pVertices; | |
1764 //memcpy(v106, uSourceLen, v108); | |
1765 //uSourceLen = (char *)uSourceLen + (int)pFilename; | |
1766 //v55 = &pBModels[v48]; | |
1767 //v105 = 308 * v55->uNumFaces; | |
1768 //v104 = uSourceLen; | |
1769 //v103 = v55->pFaces; | |
1770 //pFilename = (char *)v105; | |
1771 //memcpy(v103, uSourceLen, v105); | |
1772 //v56 = &pBModels[v48]; | |
1773 //uSourceLen = (char *)uSourceLen + (int)pFilename; | |
1774 //v57 = v56->pFacesOrdering; | |
1775 //pFilename = (char *)(2 * v56->uNumFaces); | |
1776 //memcpy(v57, uSourceLen, (size_t)pFilename); | |
1777 //v58 = &pBModels[v48]; | |
1778 //uSourceLen = (char *)uSourceLen + (int)pFilename; | |
1779 //v59 = v58->pNodes; | |
1780 //pFilename = (char *)(8 * v58->uNumNodes); | |
1781 //memcpy(v59, uSourceLen, (size_t)pFilename); | |
1782 //uSourceLen = (char *)uSourceLen + (int)pFilename; | |
1783 //ptr = (FILE *)malloc(10 * model->uNumFaces); | |
2143 | 1784 const char* textureFilenames = (const char *)malloc(10 * pBModels[i].uNumFaces); |
0 | 1785 //pFilename = (char *)(10 * pBModels[v48].uNumFaces); |
2143 | 1786 memcpy((char *)textureFilenames, pSrc, 10 * pBModels[i].uNumFaces); |
1787 pSrc += 10 * pBModels[i].uNumFaces; | |
0 | 1788 //v144 = 0; |
1789 //uSourceLen = (char *)uSourceLen + (int)pFilename; | |
1790 //v60 = pBModels; | |
2143 | 1791 for (uint j = 0; j < pBModels[i].uNumFaces; ++j) |
0 | 1792 { |
1980 | 1793 const char* texFilename = &textureFilenames[j * 10]; |
0 | 1794 //v149 = 0; |
1795 //Str2 = (char *)ptr; | |
1796 | |
2143 | 1797 //ODMFace* face = &pBModels[i].pFaces[j]; |
0 | 1798 //pFilename = (char *)v149 + (unsigned int)v60[v48].pFaces; |
2143 | 1799 if ( !(pBModels[i].pFaces[j].uAttributes & FACE_DONT_CACHE_TEXTURE)) |
0 | 1800 { |
1801 v62 = pBitmaps_LOD->LoadTexture(texFilename); | |
1802 // v63 = (ODMFace *)pFilename; | |
1803 goto LABEL_68; | |
1804 } | |
1805 //v61 = pTextureFrameTable->FindTextureByName(texFilename); | |
2143 | 1806 pBModels[i].pFaces[j].uTextureID = pTextureFrameTable->FindTextureByName(texFilename); |
1807 if (!pBModels[i].pFaces[j].uTextureID) | |
0 | 1808 { |
1809 v62 = pBitmaps_LOD->LoadTexture(texFilename); | |
1810 //v63 = (ODMFace *)pFilename; | |
2143 | 1811 pBModels[i].pFaces[j].uAttributes &= ~FACE_DONT_CACHE_TEXTURE; |
0 | 1812 LABEL_68: |
2143 | 1813 pBModels[i].pFaces[j].uTextureID = v62; |
0 | 1814 //v145 = (signed __int16)v62 != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62] : 0; |
1815 //v108 = ((signed __int16)v62 != -1 ? pBitmaps_LOD->pTextures[(signed __int16)v62].palette_id1 : 36); | |
1816 if ((signed __int16)v62 != -1) | |
1817 pBitmaps_LOD->pTextures[v62].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v62].palette_id1); | |
1818 goto LABEL_69; | |
1819 } | |
2143 | 1820 pTextureFrameTable->LoadAnimationSequenceAndPalettes(pBModels[i].pFaces[j].uTextureID); |
0 | 1821 LABEL_69: |
2143 | 1822 if (pBModels[i].pFaces[j].sCogTriggeredID) |
0 | 1823 { |
2143 | 1824 if (pBModels[i].pFaces[j].HasEventHint()) |
2166 | 1825 pBModels[i].pFaces[j].uAttributes |= FACE_UNKNOW; |
0 | 1826 else |
2166 | 1827 pBModels[i].pFaces[j].uAttributes &= ~FACE_UNKNOW; |
0 | 1828 } |
1829 //++v144; | |
1830 //v60 = pBModels; | |
1831 //v149 = (char *)v149 + 308; | |
1832 //Str2 += 10; | |
1833 //if ( v144 >= (signed int)v60[v48].uNumFaces ) | |
1834 //goto LABEL_74; | |
1835 } | |
1836 | |
1837 //LABEL_74: | |
1838 free((void *)textureFilenames); | |
1839 // ++v151; | |
1840 // ++v48; | |
1841 // if ( v151 >= (signed int)uNumBModels ) | |
1842 // goto LABEL_75; | |
1843 } | |
1844 //LABEL_75: | |
1845 pGameLoadingUI_ProgressBar->Progress(); | |
1846 | |
2143 | 1847 memcpy(&uNumLevelDecorations, pSrc, 4); |
0 | 1848 //uSourceLen = (char *)uSourceLen + 4; |
1849 if (uNumLevelDecorations > 3000) | |
1850 MessageBoxW(nullptr, L"Can't load file!", | |
1851 L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:678", 0); | |
1852 | |
1853 assert(sizeof(LevelDecoration) == 32); | |
1854 //pFilename = (char *)(32 * uNumLevelDecorations); | |
1202 | 1855 memcpy(pLevelDecorations.data(), pSrc + 4, uNumLevelDecorations * sizeof(LevelDecoration)); |
760 | 1856 pSrc += 4 + sizeof(LevelDecoration) * uNumLevelDecorations; |
0 | 1857 |
1858 pGameLoadingUI_ProgressBar->Progress(); | |
1859 | |
1860 //v151 = 0; | |
1861 //uSourceLen = (char *)uSourceLen + (int)pFilename; | |
1862 for (uint i = 0; i < uNumLevelDecorations; ++i) | |
1863 { | |
1864 char name[256]; | |
760 | 1865 memcpy(name, pSrc, sizeof(LevelDecoration)); |
1866 pSrc += sizeof(LevelDecoration); | |
0 | 1867 |
1868 pLevelDecorations[i].uDecorationDescID = pDecorationList->GetDecorIdByName(name); | |
1869 } | |
1870 | |
1871 pGameLoadingUI_ProgressBar->Progress(); | |
1872 | |
1873 memcpy(&numFaceIDListElems, pSrc, 4); | |
1874 | |
1875 //uSourceLen = (char *)uSourceLen + 4; | |
1876 //v108 = (int)pFaceIDLIST; | |
1877 if (pFaceIDLIST) | |
1878 { | |
1583 | 1879 free(pFaceIDLIST); |
0 | 1880 pFaceIDLIST = nullptr; |
1881 } | |
1882 //v66 = field_DC; | |
1883 //pFaceIDLIST = 0; | |
1583 | 1884 //v67 = malloc(0, 2 * v66, "IDLIST"); |
0 | 1885 uint faceIDListSize = 2 * numFaceIDListElems; |
1583 | 1886 pFaceIDLIST = (unsigned short *)malloc(faceIDListSize); |
0 | 1887 //v68 = field_DC; |
1888 //pFaceIDLIST = (unsigned __int16 *)v67; | |
1889 //pFilename = (char *)(2 * v68); | |
1890 memcpy(pFaceIDLIST, pSrc + 4, faceIDListSize); | |
1891 pSrc += 4 + faceIDListSize; | |
1892 | |
1893 //uSourceLen = (char *)uSourceLen + (int)pFilename; | |
1894 pGameLoadingUI_ProgressBar->Progress(); | |
1895 | |
1896 //v108 = (int)pOMAP; | |
1583 | 1897 //free((void *)v108); |
0 | 1898 //pOMAP = 0; |
1899 if (pOMAP) | |
1900 { | |
1583 | 1901 free(pOMAP); |
0 | 1902 pOMAP = nullptr; |
1903 } | |
1583 | 1904 //v69 = malloc(0, 0x10000u, "OMAP"); |
1905 pOMAP = (unsigned int *)malloc(0x10000); | |
0 | 1906 //v108 = 65536; |
1907 //pOMAP = (unsigned int *)v69; | |
1908 memcpy(pOMAP, pSrc, 65536); | |
1909 pSrc += 65536; | |
1910 | |
1911 //uSourceLen = (char *)uSourceLen + 65536; | |
1912 pGameLoadingUI_ProgressBar->Progress(); | |
1913 | |
1914 memcpy(&uNumSpawnPoints, pSrc, 4); | |
1915 //uSourceLen = (char *)uSourceLen + 4; | |
1916 pGameLoadingUI_ProgressBar->Progress(); | |
1917 //v70 = uNumSpawnPoints; | |
1918 //v108 = (int)"Spawn"; | |
1919 //v107 = 24 * v70; | |
1920 //v106 = (char *)pSpawnPoints; | |
1921 assert(sizeof(SpawnPointMM7) == 24); | |
1922 uint spawnPointsSize = uNumSpawnPoints * sizeof(SpawnPointMM7); | |
1583 | 1923 pSpawnPoints = (SpawnPointMM7 *)malloc(spawnPointsSize); |
0 | 1924 //v72 = uNumSpawnPoints; |
1925 //pSpawnPoints = v71; | |
1926 memcpy(pSpawnPoints, pSrc + 4, spawnPointsSize); | |
1927 pSrc += 4 + spawnPointsSize; | |
1928 | |
1929 pGameLoadingUI_ProgressBar->Progress(); | |
1930 | |
1931 free(pSrcMem); | |
1932 | |
1933 //v108 = (int)".ddm"; | |
1934 //v73 = strlen(pContainer); | |
1935 strcpy(Str + strlen(Str) - 4, ".ddm"); | |
1936 //strcpy((char *)v141 + v73, (const char *)v108); | |
2088 | 1937 v39 = pNew_LOD->FindContainer(Str, 1);//error |
2166 | 1938 fread(&header, 0x10u, 1, v39); |
0 | 1939 Str2 = 0; |
1940 if (header.uVersion != 91969 || | |
1941 header.pMagic[0] != 'm' || | |
1942 header.pMagic[1] != 'v' || | |
1943 header.pMagic[2] != 'i' || | |
1944 header.pMagic[3] != 'i' ) | |
1945 { | |
187 | 1946 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:746", 0); |
0 | 1947 Str2 = (char *)1; |
1948 } | |
1949 //v74 = 0; | |
1950 //pFilename = (char *)header.uCompressedSize; | |
1951 //v149 = 0; | |
1952 //pDestLen = header.uDecompressedSize; | |
1953 if ( !Str2 ) | |
1954 { | |
1955 pSrcMem = (unsigned char *)malloc(header.uDecompressedSize); | |
1956 pSrc = pSrcMem; | |
1957 //v149 = v75; | |
1958 if (header.uCompressedSize == header.uDecompressedSize) | |
1959 fread(pSrc, header.uDecompressedSize, 1u, v39); | |
1960 else if (header.uCompressedSize < header.uDecompressedSize) | |
1961 { | |
1980 | 1962 void* compressedMem = malloc(header.uCompressedSize); |
0 | 1963 fread(compressedMem, header.uCompressedSize, 1, v39); |
1964 | |
1965 uint actualDecompressedSize = header.uDecompressedSize; | |
1966 zlib::MemUnzip(pSrc, &actualDecompressedSize, compressedMem, header.uCompressedSize); | |
1967 free(compressedMem); | |
1968 } | |
1969 else | |
1970 MessageBoxW(nullptr, L"Can't load file!", | |
1971 L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:765", 0); | |
1972 | |
1973 assert(sizeof(DDM_DLV_Header) == 0x28); | |
1974 memcpy(&ddm, pSrc, sizeof(DDM_DLV_Header)); | |
1975 pSrc += sizeof(DDM_DLV_Header); | |
1976 //v74 = (int)((char *)v75 + 40); | |
1977 } | |
1978 uint actualNumFacesInLevel = 0; | |
1979 for (uint i = 0; i < uNumBModels; ++i) | |
80 | 1980 actualNumFacesInLevel += pBModels[i].uNumFaces; |
0 | 1981 |
1982 //v79 = ddm.uNumFacesInBModels; | |
1983 if (ddm.uNumFacesInBModels) | |
1984 { | |
1985 if ( ddm.uNumBModels ) | |
1986 { | |
1987 //v80 = ddm.uNumDecorations; | |
1988 if (ddm.uNumDecorations) | |
1989 { | |
1990 if (ddm.uNumFacesInBModels != actualNumFacesInLevel || | |
1991 ddm.uNumBModels != uNumBModels || | |
1992 ddm.uNumDecorations != uNumLevelDecorations ) | |
1993 Str2 = (char *)1; | |
1994 } | |
1995 } | |
1996 } | |
1997 | |
2061 | 1998 if (dword_6BE364_game_settings_1 & GAME_SETTINGS_2000) |
1999 pNumItems = 0x1BAF800; | |
0 | 2000 if ( Str2 ) |
2001 { | |
2002 memset(Dst, 0, 0x3C8u); | |
2003 memset(Src, 0, 0x3C8u); | |
2004 goto LABEL_112; | |
2005 } | |
2006 //v81 = ddm.uLastRepawnDay; | |
2007 if ((unsigned int)((char *)File - ddm.uLastRepawnDay) >= pNumItems || !ddm.uLastRepawnDay) | |
2008 { | |
2009 memcpy(Dst, pSrc, 0x3C8u); | |
2010 memcpy(Src, pSrc + 968, 0x3C8u); | |
2011 LABEL_112: | |
2012 free(pSrcMem); | |
2013 | |
2014 ddm.uLastRepawnDay = (int)File; | |
2015 if (Str2 == 0) | |
2016 ++ddm.uNumRespawns; | |
2017 v108 = 0; | |
2018 *(int *)thisa = 1; | |
2019 v39 = pGames_LOD->FindContainer(Str, 0); | |
2020 fread(&header, 0x10, 1u, v39); | |
2021 //pFilename = (char *)header.uCompressedSize; | |
2022 //pDestLen = header.uDecompressedSize; | |
2023 //v82 = malloc(header.uDecompressedSize); | |
2024 pSrcMem = (unsigned char *)malloc(header.uDecompressedSize); | |
2025 //v149 = v82; | |
2026 if (header.uCompressedSize == header.uDecompressedSize) | |
2027 fread(pSrcMem, header.uDecompressedSize, 1, v39); | |
2028 else if (header.uCompressedSize < header.uDecompressedSize) | |
2029 { | |
1980 | 2030 void* compressedMem = malloc(header.uCompressedSize); |
0 | 2031 fread(compressedMem, header.uCompressedSize, 1u, v39); |
2032 | |
2033 uint actualDecompressedSize = header.uDecompressedSize; | |
2034 zlib::MemUnzip(pSrcMem, &actualDecompressedSize, compressedMem, header.uCompressedSize); | |
2035 free(compressedMem); | |
2036 } | |
2037 else | |
2038 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:857", 0); | |
2039 | |
2040 pSrc = pSrcMem + 40; | |
2041 goto LABEL_120; | |
2042 | |
2043 } | |
2044 *(int *)thisa = 0; | |
2045 LABEL_120: | |
2046 //v108 = (int)".odm"; | |
2047 //v83 = strlen(pContainer); | |
2048 //strcpy((char *)v141 + v83, (const char *)v108); | |
752 | 2049 memcpy(uUndiscoveredArea, pSrc, 0x3C8); |
0 | 2050 //v84 = (const void *)(v74 + 968); |
752 | 2051 memcpy(uDicovered_area, pSrc + 0x3C8, 0x3C8); |
0 | 2052 pSrc += 2 * 0x3C8; |
2053 //v85 = (char *)v84 + 968; | |
2054 | |
2055 pGameLoadingUI_ProgressBar->Progress(); | |
2056 | |
2057 if ( *(int *)thisa ) | |
2058 { | |
752 | 2059 memcpy(uUndiscoveredArea, Dst, 0x3C8u); |
2060 memcpy(uDicovered_area, Src, 0x3C8u); | |
0 | 2061 } |
2062 | |
2063 for (uint i = 0; i < uNumBModels; ++i) | |
2064 { | |
1980 | 2065 BSPModel model = pBModels[i]; |
79 | 2066 for (uint j = 0; j < model.uNumFaces; ++j) |
0 | 2067 { |
1980 | 2068 ODMFace face = model.pFaces[j]; |
79 | 2069 memcpy(&face.uAttributes, pSrc, 4); |
0 | 2070 pSrc += 4; |
2071 } | |
2072 | |
79 | 2073 for (uint j = 0; j < model.uNumFaces; ++j) |
0 | 2074 { |
1980 | 2075 ODMFace face = model.pFaces[j]; |
79 | 2076 if (face.sCogTriggeredID) |
0 | 2077 { |
79 | 2078 if (face.HasEventHint()) |
2166 | 2079 face.uAttributes |= FACE_UNKNOW3; |
0 | 2080 else |
1062 | 2081 face.uAttributes &= 0xFFFFEFFFu; |
0 | 2082 } |
2083 } | |
2084 } | |
2085 | |
2086 pGameLoadingUI_ProgressBar->Progress(); | |
2087 | |
2088 for (uint i = 0; i < uNumLevelDecorations; ++i) | |
2089 { | |
1489 | 2090 memcpy(&pLevelDecorations[i].uFlags, pSrc, 2); |
0 | 2091 pSrc += 2; |
2092 } | |
2093 | |
2094 pGameLoadingUI_ProgressBar->Progress(); | |
2095 | |
2096 memcpy(&uNumActors, pSrc, 4); | |
2097 if (uNumActors > 500) | |
2098 MessageBoxW(nullptr, L"Can't load file!", | |
2099 L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:939", 0); | |
2100 | |
2101 pGameLoadingUI_ProgressBar->Progress(); | |
2102 | |
2103 assert(sizeof(Actor) == 836); | |
2104 //pFilename = (char *)(836 * uNumActors); | |
1202 | 2105 memcpy(pActors.data(), pSrc + 4, uNumActors * sizeof(Actor)); |
0 | 2106 pSrc += 4 + uNumActors * sizeof(Actor); |
2107 //v92 = (char *)v91 + (int)pFilename; | |
2108 pGameLoadingUI_ProgressBar->Progress(); | |
2109 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
2110 memcpy(&uNumSpriteObjects, pSrc, 4); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
2111 assert(uNumSpriteObjects <= 1000 && "Too many objects"); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
2112 assert(sizeof(SpriteObject) == 112); |
0 | 2113 |
2114 pGameLoadingUI_ProgressBar->Progress(); | |
2115 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
2116 //pFilename = (char *)(112 * uNumSpriteObjects); |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
2117 memcpy(pSpriteObjects.data(), pSrc + 4, uNumSpriteObjects * sizeof(SpriteObject)); |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
2118 pSrc += 4 + uNumSpriteObjects * sizeof(SpriteObject); |
0 | 2119 |
2120 //v94 = (char *)v93 + (int)pFilename; | |
2121 pGameLoadingUI_ProgressBar->Progress(); | |
2122 | |
2123 memcpy(&uNumChests, pSrc, 4); | |
2124 //v95 = (char *)v94 + 4; | |
2125 if (uNumChests > 20) | |
2126 MessageBoxW(nullptr, L"Can't load file!", | |
2127 L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:968", 0); | |
2128 | |
2129 pGameLoadingUI_ProgressBar->Progress(); | |
2130 | |
2131 assert(sizeof(Chest) == 5324); | |
2132 //pFilename = (char *)(5324 * uNumChests); | |
1202 | 2133 memcpy(pChests.data(), pSrc + 4 , uNumChests * sizeof(Chest)); |
0 | 2134 pSrc += 4 + uNumChests * sizeof(Chest); |
2135 //v96 = (char *)v95 + (int)pFilename; | |
2136 pGameLoadingUI_ProgressBar->Progress(); | |
2137 | |
1736
c6fe09a06712
Player::CompareVariable finished, renamed stru_5E4C90 to stru_5E4C90_MapPersistVars, party::field_4A0 to party::CounterEventValues
Grumpy7
parents:
1642
diff
changeset
|
2138 memcpy(&stru_5E4C90_MapPersistVars, pSrc, 0xC8); |
0 | 2139 pSrc += 0xC8; |
2140 | |
2141 pGameLoadingUI_ProgressBar->Progress(); | |
810 | 2142 memcpy(&loc_time, pSrc, 0x38u); |
0 | 2143 |
2144 free(pSrcMem); | |
2145 | |
630 | 2146 pTileTable->InitializeTileset(Tileset_Dirt); |
2147 pTileTable->InitializeTileset(Tileset_Snow); | |
2148 pTileTable->InitializeTileset(pTileTypes[0].tileset); | |
2149 pTileTable->InitializeTileset(pTileTypes[1].tileset); | |
2150 pTileTable->InitializeTileset(pTileTypes[2].tileset); | |
2151 pTileTable->InitializeTileset(pTileTypes[3].tileset); | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2152 strcpy(pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture.data()); |
1980 | 2153 TileDesc* v98 = pTileTable->GetTileById(pTileTypes[0].uTileID); |
2006 | 2154 sMainTile_BitmapID = pBitmaps_LOD->LoadTexture(v98->pTileName, TEXTURE_DEFAULT); |
2155 if (sMainTile_BitmapID != -1) | |
2156 pBitmaps_LOD->pTextures[sMainTile_BitmapID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[sMainTile_BitmapID].palette_id1); | |
0 | 2157 |
2158 _47F0E2(); | |
2159 | |
2160 LABEL_150: | |
2166 | 2161 if ( pWeather->bRenderSnow ) //Ritor1: it's include for snow |
2123 | 2162 strcpy(loc_time.sky_texture_name, "sky19"); |
2163 else if (loc_time.uLastVisitDay) | |
0 | 2164 { |
810 | 2165 if ( (signed int)((signed int)(signed __int64)((double)loc_time.uLastVisitDay * 0.234375) / 60 / 60 / 24) % 28 != pParty->uDaysPlayed ) |
0 | 2166 { |
2167 if ( rand() % 100 >= 20 ) | |
2168 v108 = dword_4EC268[rand() % dword_4EC2A8]; | |
2169 else | |
2170 v108 = dword_4EC28C[rand() % dword_4EC2AC]; | |
810 | 2171 sprintf(loc_time.sky_texture_name, "plansky%d", v108); |
0 | 2172 } |
2173 } | |
2174 else | |
810 | 2175 strcpy(loc_time.sky_texture_name, "plansky3"); |
2123 | 2176 |
0 | 2177 //v101 = pBitmaps_LOD->LoadTexture(field_4F8); |
2006 | 2178 sSky_TextureID = pBitmaps_LOD->LoadTexture(loc_time.sky_texture_name); |
2179 if (sSky_TextureID != -1) | |
2180 pBitmaps_LOD->pTextures[sSky_TextureID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[sSky_TextureID].palette_id1); | |
0 | 2181 |
2182 pPaletteManager->RecalculateAll(); | |
2183 pSoundList->LoadSound(53, 0); | |
2184 pSoundList->LoadSound(92, 0); | |
2185 pSoundList->LoadSound(57, 0); | |
2186 pSoundList->LoadSound(96, 0); | |
2187 pSoundList->LoadSound(64, 0); | |
2188 pSoundList->LoadSound(103, 0); | |
2123 | 2189 for (int i=0; i < 3;++i) |
0 | 2190 { |
2123 | 2191 switch ( pTileTypes[i].tileset ) |
2192 { | |
2193 case Tileset_Grass: | |
2194 pSoundList->LoadSound(54, 0); | |
2195 pSoundList->LoadSound(93, 0); | |
2196 break; | |
2197 case Tileset_Snow: | |
2198 pSoundList->LoadSound(58, 0); | |
2199 pSoundList->LoadSound(97, 0); | |
2200 break; | |
2166 | 2201 case Tilset_Desert: |
2123 | 2202 pSoundList->LoadSound(52, 0); |
2203 pSoundList->LoadSound(91, 0); | |
2204 break; | |
2205 case Tileset_3: | |
2206 pSoundList->LoadSound(51, 0); | |
2207 pSoundList->LoadSound(90, 0); | |
2208 break; | |
2209 case Tileset_Water: | |
2210 pSoundList->LoadSound(62, 0); | |
2211 pSoundList->LoadSound(101, 0); | |
2212 break; | |
2213 case Tileset_6: | |
2214 pSoundList->LoadSound(49, 0); | |
2215 pSoundList->LoadSound(88, 0); | |
2216 break; | |
2217 case Tileset_Swamp: | |
2218 pSoundList->LoadSound(61, 0); | |
2219 pSoundList->LoadSound(100, 0); | |
2220 break; | |
2221 } | |
0 | 2222 } |
2223 return true; | |
2224 } | |
2225 | |
2226 //----- (0047ECC1) -------------------------------------------------------- | |
764 | 2227 int OutdoorLocation::GetTileIdByTileMapId(signed int a2) |
0 | 2228 { |
2229 signed int result; // eax@2 | |
2230 int v3; // eax@3 | |
2231 | |
2232 if ( a2 >= 90 ) | |
2233 { | |
2234 v3 = (a2 - 90) / 36; | |
2235 if ( v3 && v3 != 1 && v3 != 2 ) | |
2236 { | |
2166 | 2237 if ( v3 == Tileset_3 ) |
0 | 2238 result = this->pTileTypes[3].uTileID; |
2239 else | |
2240 result = a2; | |
2241 } | |
2242 else | |
2243 result = this->pTileTypes[v3].uTileID; | |
2244 } | |
2245 else | |
2246 result = 0; | |
2247 return result; | |
2248 } | |
2249 | |
2250 //----- (0047ED08) -------------------------------------------------------- | |
2006 | 2251 unsigned int OutdoorLocation::DoGetTileTexture(signed int sX, signed int sY) |
0 | 2252 { |
2253 int v3; // esi@5 | |
2254 unsigned int result; // eax@9 | |
2255 | |
2006 | 2256 assert(sX < 128 && sY < 128); |
67 | 2257 |
2006 | 2258 v3 = this->pTerrain.pTilemap[sY * 128 + sX]; |
630 | 2259 if (v3 < 198) // < Tileset_3 |
67 | 2260 { |
2261 if (v3 >= 90) | |
185 | 2262 v3 = v3 + this->pTileTypes[(v3 - 90) / 36].uTileID - 36 * ((v3 - 90) / 36) - 90; |
67 | 2263 } |
2264 else | |
2265 v3 = v3 + this->pTileTypes[3].uTileID - 198; | |
2266 | |
635 | 2267 #pragma region "New: seasons change" |
2268 extern bool change_seasons; | |
2269 if (change_seasons) | |
2270 switch (pParty->uCurrentMonth) | |
2271 { | |
2272 case 11: case 0: case 1: // winter | |
2273 if (v3 >= 90) // Tileset_Grass begins at TileID = 90 | |
2274 { | |
2275 if (v3 <= 95) // some grastyl entries | |
2276 v3 = 348; | |
2277 else if (v3 <= 113) // rest of grastyl & all grdrt* | |
2278 v3 = 348 + (v3 - 96); | |
2279 } | |
630 | 2280 /*switch (v3) |
2281 { | |
2282 case 102: v3 = 354; break; // grdrtNE -> SNdrtne | |
2283 case 104: v3 = 356; break; // grdrtNW -> SNdrtnw | |
2284 case 108: v3 = 360; break; // grdrtN -> SNdrtn | |
2285 }*/ | |
635 | 2286 break; |
2287 | |
2288 case 2: case 3: case 4: // spring | |
2289 case 8: case 9: case 10: // autumn | |
2290 if (v3 >= 90 && v3 <= 113) // just convert all Tileset_Grass to dirt | |
2291 v3 = 1; | |
2292 break; | |
630 | 2293 |
635 | 2294 case 5: case 6: case 7: // summer |
2295 //all tiles are green grass by default | |
2296 break; | |
630 | 2297 |
635 | 2298 default: assert(pParty->uCurrentMonth >= 0 && pParty->uCurrentMonth < 12); |
2299 } | |
2300 #pragma endregion | |
630 | 2301 |
67 | 2302 return pTileTable->pTiles[v3].uBitmapID; |
0 | 2303 } |
2304 | |
2305 //----- (0047ED83) -------------------------------------------------------- | |
2306 int OutdoorLocation::_47ED83(signed int a2, signed int a3) | |
2307 { | |
812 | 2308 assert(a2 < 128 && a3 < 128); |
0 | 2309 |
812 | 2310 return *(&this->pTerrain.pTilemap[128 * a3] + a2); |
0 | 2311 } |
2312 | |
2313 //----- (0047EDB3) -------------------------------------------------------- | |
2006 | 2314 int OutdoorLocation::ActuallyGetSomeOtherTileInfo(signed int sX, signed int sY) |
0 | 2315 { |
2006 | 2316 assert(sX < 128 && sY < 128); |
0 | 2317 int v3; // esi@5 |
2318 | |
2006 | 2319 v3 = this->pTerrain.pTilemap[sY * 128 + sX]; |
812 | 2320 if ( v3 >= 90 ) |
2321 v3 = v3 + this->pTileTypes[(v3 - 90) / 36].uTileID - 36 * ((v3 - 90) / 36) - 90; | |
67 | 2322 return pTileTable->pTiles[v3].uAttributes; |
0 | 2323 } |
2324 | |
2325 //----- (0047EE16) -------------------------------------------------------- | |
2003 | 2326 int OutdoorLocation::DoGetHeightOnTerrain(signed int sX, signed int sZ) |
0 | 2327 { |
2003 | 2328 assert(sX < 128 && sZ < 128); |
0 | 2329 |
2003 | 2330 return 32 * pTerrain.pHeightmap[sZ * 128 + sX]; |
0 | 2331 } |
2332 | |
2333 //----- (0047EE49) -------------------------------------------------------- | |
764 | 2334 int OutdoorLocation::GetSoundIdByPosition( signed int X_pos, signed int Y_pos, int running ) |
2335 { | |
0 | 2336 signed int v4; // eax@5 |
2337 signed int v5; // eax@7 | |
2338 int v6; // eax@8 | |
2339 signed int v8; // eax@9 | |
764 | 2340 int modif=0; |
0 | 2341 |
764 | 2342 if ( X_pos < 0 || X_pos > 127 || Y_pos < 0 || Y_pos > 127 ) |
0 | 2343 v4 = 0; |
2344 else | |
764 | 2345 v4 = this->pTerrain.pTilemap[128 * Y_pos + X_pos]; |
2346 v5 = GetTileIdByTileMapId(v4); | |
2347 if (running) | |
2348 modif=-39; | |
0 | 2349 if ( !v5 ) |
764 | 2350 return 92+modif; |
2351 | |
2352 switch (pTileTable->pTiles[v5].tileset) | |
0 | 2353 { |
764 | 2354 case 0: return 93+ modif; |
2355 case 1: return 97+ modif; | |
2356 case 2: return 91+ modif; | |
2357 case 3: return 90+ modif; | |
2358 case 4: return 101+ modif; | |
2359 case 5: return 95+ modif; | |
2360 case 6: return 88+ modif; | |
2361 case 7: return 100+ modif; | |
2362 case 8: return 93+ modif; | |
2363 default: | |
2364 v8=pTileTable->pTiles[v5].tileset; | |
2365 if ( (v8 > 9 && v8 <= 17) || (v8 > 21 && v8 <= 27) ) | |
2366 return 96+ modif; | |
2367 else | |
2368 return 95+ modif; | |
0 | 2369 } |
764 | 2370 |
0 | 2371 } |
2372 | |
2373 //----- (0047EF60) -------------------------------------------------------- | |
752 | 2374 int OutdoorLocation::UpdateDiscoveredArea(int X_grid_pos, int Y_grid_poa, int a4) |
0 | 2375 { |
2376 int v4; // ecx@1 | |
2377 int v5; // edx@2 | |
2378 int v6; // edi@2 | |
2379 int v9; // ebx@4 | |
2380 int v10; // eax@5 | |
2381 int v12; // esi@12 | |
2382 char v13; // al@12 | |
2383 int v15; // [sp+4h] [bp-14h]@7 | |
2172 | 2384 |
752 | 2385 v4 = Y_grid_poa - 10; |
2172 | 2386 if ( v4 < Y_grid_poa + 10 ) |
0 | 2387 { |
752 | 2388 v5 = v4 - Y_grid_poa; |
2389 v6 = (Y_grid_poa - 30); | |
2172 | 2390 for ( int i = 0; i < Y_grid_poa + 10 - v4; i++) |
0 | 2391 { |
2172 | 2392 v9 = X_grid_pos - 10; |
2393 v10 = v9 - X_grid_pos; | |
2394 for ( v9; v9 < X_grid_pos + 10; ++v9 ) | |
0 | 2395 { |
2172 | 2396 v15 = abs(v10) * abs(v10) + abs(v5) * abs(v5); |
2397 if ( v15 <= 100 && v9 >= 20 && v9 <= 107 && v6 >= 0 && v6 <= 87 ) | |
0 | 2398 { |
2172 | 2399 v13 = 1 << (7 - (v9 - 20) % 8); |
2400 this->uDicovered_area[v6][(v9 - 20)/8] |= v13; | |
2401 if ( v15 <= 49 ) | |
2402 this->uUndiscoveredArea[v6][(v9 - 20)/8] |= v13; | |
0 | 2403 } |
2172 | 2404 ++v10; |
0 | 2405 } |
2172 | 2406 ++v6; |
2407 ++v5; | |
0 | 2408 } |
2409 } | |
2410 return 1; | |
2411 } | |
2412 | |
2413 //----- (0047F04C) -------------------------------------------------------- | |
752 | 2414 bool OutdoorLocation::_47F04C(signed int x_pos, signed int y_pos) |
0 | 2415 { |
2416 bool result; // eax@5 | |
2417 | |
752 | 2418 if ( x_pos < 0 || x_pos >= 88 || y_pos < 0 || y_pos >= 88 ) |
0 | 2419 result = 0; |
2420 else | |
752 | 2421 result = (uUndiscoveredArea[y_pos][x_pos/8] & (unsigned __int8)(1 << (7 - (x_pos) % 8))) != 0; |
0 | 2422 return result; |
2423 } | |
2424 | |
2425 //----- (0047F097) -------------------------------------------------------- | |
752 | 2426 bool OutdoorLocation::_47F097(signed int x_pos, signed int y_pos) |
0 | 2427 { |
2428 bool result; // eax@5 | |
2429 | |
752 | 2430 if ( x_pos < 0 || x_pos >= 88 || y_pos < 0 || y_pos >= 88 ) |
0 | 2431 result = 0; |
2432 else | |
752 | 2433 result = (uDicovered_area[y_pos][x_pos/8] & (unsigned __int8)(1 << (7 - (x_pos) % 8))) != 0; |
0 | 2434 return result; |
2435 } | |
2436 | |
2437 //----- (0047F0E2) -------------------------------------------------------- | |
2438 bool OutdoorLocation::_47F0E2() | |
2439 { | |
2172 | 2440 for ( uint i = 0; i < (signed int)pBitmaps_LOD->uNumLoadedFiles; ++i ) |
0 | 2441 { |
2172 | 2442 //if ( i != -1 ? (int)&pBitmaps_LOD->pTextures[i] : 0 ) |
2443 pBitmaps_LOD->pTextures[i].uDecompressedSize = this->pTerrain._47CB57((int)pBitmaps_LOD->pTextures[i].pLevelOfDetail0_prolly_alpha_mask, | |
2444 pBitmaps_LOD->pTextures[i].palette_id2, | |
2445 pBitmaps_LOD->pTextures[i].uTextureWidth * pBitmaps_LOD->pTextures[i].uTextureHeight); | |
0 | 2446 } |
2447 return 1; | |
2448 } | |
2449 | |
2450 //----- (0047F138) -------------------------------------------------------- | |
2451 bool OutdoorLocation::PrepareDecorations() | |
2452 { | |
2453 signed int v1; // ebx@1 | |
2454 signed int v8; // [sp+Ch] [bp-4h]@1 | |
2455 | |
2456 v1 = 0; | |
2457 v8 = 0; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1458
diff
changeset
|
2458 if ( !_stricmp(pCurrentMapName, "out09.odm") ) |
0 | 2459 v8 = 1; |
2460 | |
2461 for (uint i = 0; i < uNumLevelDecorations; ++i) | |
2462 { | |
1980 | 2463 LevelDecoration* decor = &pLevelDecorations[i]; |
0 | 2464 |
2465 pDecorationList->InitializeDecorationSprite(decor->uDecorationDescID); | |
2179 | 2466 if ( pDecorationList->pDecorations[decor->uDecorationDescID].uSoundID && _6807E0_num_decorations_with_sounds_6807B8 < 9 ) |
0 | 2467 { |
2179 | 2468 pSoundList->LoadSound(pDecorationList->pDecorations[decor->uDecorationDescID].uSoundID, 0); |
2469 _6807B8_level_decorations_ids[_6807E0_num_decorations_with_sounds_6807B8++] = i; | |
0 | 2470 } |
2471 if ( v8 && decor->uCog == 20 ) | |
1489 | 2472 decor->uFlags |= LEVEL_DECORATION_OBELISK_CHEST; |
1514
965af46e8793
Rename LevelDecoration::field_16_event_id to LevelDecoration::uEventID.
yoctozepto
parents:
1489
diff
changeset
|
2473 if ( !decor->uEventID ) |
0 | 2474 { |
2475 if ( decor->IsInteractive() ) | |
2476 { | |
2477 if ( v1 < 124 ) | |
2478 { | |
2179 | 2479 decor->_idx_in_stru123 = v1 + 75; |
1736
c6fe09a06712
Player::CompareVariable finished, renamed stru_5E4C90 to stru_5E4C90_MapPersistVars, party::field_4A0 to party::CounterEventValues
Grumpy7
parents:
1642
diff
changeset
|
2480 if ( !stru_5E4C90_MapPersistVars._decor_events[v1++] ) |
1489 | 2481 decor->uFlags |= LEVEL_DECORATION_INVISIBLE; |
0 | 2482 } |
2483 } | |
2484 } | |
2485 } | |
2486 | |
2487 pGameLoadingUI_ProgressBar->Progress(); | |
2488 return true; | |
2489 } | |
2490 // 6807E0: using guessed type int _6807E0_num_decorations_6807B8; | |
2491 | |
2492 //----- (0047F223) -------------------------------------------------------- | |
2065
87be06553c76
rename int _47F223_LooksLikeGenerateMonsterLoot() to void ArrangeSpriteObjects()
Ritor1
parents:
2061
diff
changeset
|
2493 void OutdoorLocation::ArrangeSpriteObjects() |
0 | 2494 { |
2495 OutdoorLocation *v5; // [sp+0h] [bp-4h]@1 | |
2496 | |
2497 v5 = this; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
2498 if ( (signed int)uNumSpriteObjects > 0 ) |
0 | 2499 { |
2065
87be06553c76
rename int _47F223_LooksLikeGenerateMonsterLoot() to void ArrangeSpriteObjects()
Ritor1
parents:
2061
diff
changeset
|
2500 for ( int i = 0; i < (signed int)uNumSpriteObjects; ++i ) |
0 | 2501 { |
2065
87be06553c76
rename int _47F223_LooksLikeGenerateMonsterLoot() to void ArrangeSpriteObjects()
Ritor1
parents:
2061
diff
changeset
|
2502 if ( pSpriteObjects[i].uObjectDescID ) |
0 | 2503 { |
2172 | 2504 if ( !(pSpriteObjects[i].uAttributes & 8) && !(pObjectList->pObjects[pSpriteObjects[i].uObjectDescID].uFlags & 0x10) ) |
2505 pSpriteObjects[i].vPosition.z = GetTerrainHeightsAroundParty2(pSpriteObjects[i].vPosition.x, pSpriteObjects[i].vPosition.y, (int *)&v5, 0); | |
2065
87be06553c76
rename int _47F223_LooksLikeGenerateMonsterLoot() to void ArrangeSpriteObjects()
Ritor1
parents:
2061
diff
changeset
|
2506 if ( pSpriteObjects[i].stru_24.uItemID ) |
0 | 2507 { |
2065
87be06553c76
rename int _47F223_LooksLikeGenerateMonsterLoot() to void ArrangeSpriteObjects()
Ritor1
parents:
2061
diff
changeset
|
2508 if ( pSpriteObjects[i].stru_24.uItemID != 220 |
87be06553c76
rename int _47F223_LooksLikeGenerateMonsterLoot() to void ArrangeSpriteObjects()
Ritor1
parents:
2061
diff
changeset
|
2509 && pItemsTable->pItems[pSpriteObjects[i].stru_24.uItemID].uEquipType == EQUIP_POTION |
87be06553c76
rename int _47F223_LooksLikeGenerateMonsterLoot() to void ArrangeSpriteObjects()
Ritor1
parents:
2061
diff
changeset
|
2510 && !pSpriteObjects[i].stru_24.uEnchantmentType ) |
87be06553c76
rename int _47F223_LooksLikeGenerateMonsterLoot() to void ArrangeSpriteObjects()
Ritor1
parents:
2061
diff
changeset
|
2511 pSpriteObjects[i].stru_24.uEnchantmentType = rand() % 15 + 5; |
87be06553c76
rename int _47F223_LooksLikeGenerateMonsterLoot() to void ArrangeSpriteObjects()
Ritor1
parents:
2061
diff
changeset
|
2512 pItemsTable->SetSpecialBonus(&pSpriteObjects[i].stru_24); |
0 | 2513 } |
2514 } | |
2515 } | |
2516 } | |
2517 pGameLoadingUI_ProgressBar->Progress(); | |
2518 } | |
2519 | |
2520 //----- (0047F2D3) -------------------------------------------------------- | |
2521 bool OutdoorLocation::InitalizeActors(int a1) | |
2522 { | |
760 | 2523 int alert_status; // [sp+348h] [bp-8h]@1 |
0 | 2524 int v9; // [sp+34Ch] [bp-4h]@1 |
2525 | |
760 | 2526 alert_status = 0; |
2172 | 2527 for( int i = 0; i < uNumActors; ++i ) |
2528 { | |
2529 if ( !(pActors[i].uAttributes & 0x100000) ) | |
2530 { | |
2531 if ( alert_status != 1 ) | |
2532 { | |
2533 pActors[i].uCurrentActionTime = 0; | |
2534 pActors[i].uCurrentActionLength = 0; | |
2535 if ( pActors[i].uAttributes & 0x10000 ) | |
2536 pActors[i].uAIState = AIState::Disabled; | |
2537 if ( pActors[i].uAIState != AIState::Removed && pActors[i].uAIState != AIState::Disabled && | |
2538 (pActors[i].sCurrentHP == 0 || pActors[i].pMonsterInfo.uHP == 0) ) | |
2539 pActors[i].uAIState = AIState::Dead; | |
2540 pActors[i].vVelocity.x = 0; | |
2541 pActors[i].vVelocity.y = 0; | |
2542 pActors[i].vVelocity.z = 0; | |
2543 pActors[i].UpdateAnimation(); | |
2544 pActors[i].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
2545 pActors[i].PrepareSprites(0); | |
2546 } | |
2547 else | |
760 | 2548 { |
2172 | 2549 pActors[i].uAIState = AIState::Disabled; |
2550 pActors[i].uAttributes = pActors[i].uAttributes | 0x10000; | |
760 | 2551 } |
2172 | 2552 } |
2553 else if ( a1 == 0 ) | |
2554 { | |
2555 pActors[i].uAIState = AIState::Disabled; | |
2556 pActors[i].uAttributes = pActors[i].uAttributes | 0x10000; | |
2557 } | |
2558 else if ( alert_status != 0 ) | |
2559 { | |
2560 pActors[i].uCurrentActionTime = 0; | |
2561 pActors[i].uCurrentActionLength = 0; | |
2562 if ( pActors[i].uAttributes & 0x10000 ) | |
2563 pActors[i].uAIState = AIState::Disabled; | |
2564 if ( pActors[i].uAIState != AIState::Removed && pActors[i].uAIState != AIState::Disabled && | |
2565 (pActors[i].sCurrentHP == 0 || pActors[i].pMonsterInfo.uHP == 0) ) | |
2566 pActors[i].uAIState = AIState::Dead; | |
2567 pActors[i].vVelocity.x = 0; | |
2568 pActors[i].vVelocity.y = 0; | |
2569 pActors[i].vVelocity.z = 0; | |
2570 pActors[i].UpdateAnimation(); | |
2571 pActors[i].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | |
2572 pActors[i].PrepareSprites(0); | |
2573 } | |
2574 else | |
2575 { | |
2576 pActors[i].uAIState = AIState::Disabled; | |
2577 pActors[i].uAttributes = pActors[i].uAttributes | 0x10000; | |
2578 alert_status = GetAlertStatus(); | |
2579 } | |
2580 } | |
760 | 2581 |
0 | 2582 pGameLoadingUI_ProgressBar->Progress(); |
760 | 2583 //no use for this |
2584 // Actor thisa; | |
2585 // thisa.pMonsterInfo.uID = 45; | |
2586 // thisa.PrepareSprites(0); | |
0 | 2587 return 1; |
2588 } | |
2589 | |
2590 //----- (0047F3EA) -------------------------------------------------------- | |
630 | 2591 bool OutdoorLocation::LoadRoadTileset() |
0 | 2592 { |
760 | 2593 pTileTypes[3].uTileID = pTileTable->GetTileForTerrainType(pTileTypes[3].tileset, 1); |
2594 pTileTable->InitializeTileset(pTileTypes[3].tileset); | |
0 | 2595 return 1; |
2596 } | |
2597 | |
2598 //----- (0047F420) -------------------------------------------------------- | |
2599 bool OutdoorLocation::LoadTileGroupIds() | |
2600 { | |
2601 for (uint i = 0; i < 3; ++i) | |
760 | 2602 pTileTypes[i].uTileID = pTileTable->GetTileForTerrainType(pTileTypes[i].tileset, 1); |
0 | 2603 |
2604 return true; | |
2605 } | |
2606 | |
2607 //----- (0047B42C) -------------------------------------------------------- | |
142 | 2608 void OutdoorLocation::PrepareActorsDrawList() |
0 | 2609 { |
2610 unsigned int result; // eax@1 | |
142 | 2611 int z; // esi@5 |
0 | 2612 float v4; // ST48_4@8 |
2613 unsigned int v8; // eax@11 | |
2614 int v9; // edx@11 | |
2123 | 2615 //__int16 v10; // dx@11 |
2616 //unsigned int v11; // eax@13 | |
0 | 2617 signed int v12; // eax@16 |
2123 | 2618 //__int16 v13; // cx@21 |
0 | 2619 SpriteFrame *v14; // eax@24 |
2620 SpriteFrame *v15; // ebx@25 | |
2621 //int *v16; // eax@25 | |
2622 int v17; // eax@35 | |
2623 int v18; // ST78_4@36 | |
2624 int v19; // eax@36 | |
2625 int v20; // ecx@38 | |
2626 int v21; // eax@38 | |
2627 int v22; // ecx@41 | |
2628 int v23; // ST5C_4@43 | |
2629 int v24; // esi@44 | |
2630 signed __int64 v25; // qtt@45 | |
2631 int v26; // ST54_4@45 | |
2632 int v27; // ecx@45 | |
2166 | 2633 //RenderBillboard *v28; // esi@45 |
142 | 2634 //__int16 v29; // ax@46 |
0 | 2635 unsigned __int8 v30; // zf@46 |
2636 unsigned __int8 v31; // sf@46 | |
2637 signed __int16 v32; // ax@49 | |
2638 signed int v33; // ecx@50 | |
2639 int v34; // ecx@54 | |
2166 | 2640 //MonsterDesc *v35; // edx@54 |
2641 //int v36; // ecx@54 | |
142 | 2642 //unsigned __int8 v37; // zf@54 |
2643 //unsigned __int8 v38; // sf@54 | |
2123 | 2644 //unsigned int v39; // [sp-8h] [bp-68h]@23 |
2645 //unsigned int v40; // [sp-4h] [bp-64h]@23 | |
0 | 2646 int v41; // [sp+24h] [bp-3Ch]@11 |
2647 int v42; // [sp+28h] [bp-38h]@38 | |
2648 int v43; // [sp+28h] [bp-38h]@45 | |
2649 int v44; // [sp+2Ch] [bp-34h]@36 | |
2650 int v45; // [sp+2Ch] [bp-34h]@44 | |
2651 int v46; // [sp+2Ch] [bp-34h]@45 | |
2652 int v47; // [sp+30h] [bp-30h]@36 | |
2653 int v48; // [sp+30h] [bp-30h]@41 | |
2654 signed int v49; // [sp+34h] [bp-2Ch]@5 | |
2655 int v50; // [sp+34h] [bp-2Ch]@36 | |
2656 int v51; // [sp+34h] [bp-2Ch]@41 | |
2657 int v52; // [sp+34h] [bp-2Ch]@50 | |
2658 int v53; // [sp+38h] [bp-28h]@36 | |
142 | 2659 //int v54; // [sp+3Ch] [bp-24h]@2 |
0 | 2660 int y; // [sp+40h] [bp-20h]@5 |
2661 int x; // [sp+44h] [bp-1Ch]@5 | |
2662 int v57; // [sp+48h] [bp-18h]@45 | |
2663 int v58; // [sp+4Ch] [bp-14h]@45 | |
142 | 2664 //signed int v59; // [sp+50h] [bp-10h]@1 |
0 | 2665 int X; // [sp+54h] [bp-Ch]@36 |
142 | 2666 //__int16 v61; // [sp+58h] [bp-8h]@5 |
0 | 2667 signed __int16 v62; // [sp+5Ch] [bp-4h]@25 |
2668 | |
142 | 2669 //result = 0; |
2670 //v59 = 0; | |
2671 for (int i = 0; i < uNumActors; ++i) | |
0 | 2672 { |
142 | 2673 //v54 = 0; |
2674 //v1 = pActors;//[0].vPosition.z; | |
2675 //do | |
2676 //{ | |
2123 | 2677 //Actor* actor = &pActors[i]; |
142 | 2678 //v2 = actor->uAIState; |
2679 | |
2123 | 2680 pActors[i].uAttributes &= 0xFFFFFFF7u; |
2681 if (pActors[i].uAIState == Removed || pActors[i].uAIState == Disabled) | |
142 | 2682 continue; |
2683 | |
2123 | 2684 z = pActors[i].vPosition.z; |
0 | 2685 v49 = 0; |
2123 | 2686 x = pActors[i].vPosition.x; |
2687 y = pActors[i].vPosition.y; | |
2688 if (pActors[i].uAIState == Summoned) | |
0 | 2689 { |
2123 | 2690 if (PID_TYPE(pActors[i].uSummonerID) != OBJECT_Actor || |
2691 pActors[PID_ID(pActors[i].uSummonerID)].pMonsterInfo.uSpecialAbilityDamageDiceSides != 1 ) | |
0 | 2692 { |
2123 | 2693 z += floorf(pActors[i].uActorHeight * 0.5f + 0.5f); |
0 | 2694 } |
2695 else | |
2696 { | |
2697 v49 = 1; | |
2123 | 2698 pGame->pStru6Instance->_4A7F74(pActors[i].vPosition.x, pActors[i].vPosition.y, z); |
2699 v4 = (1.0 - (double)pActors[i].uCurrentActionTime / (double)pActors[i].uCurrentActionLength) * | |
2700 (double)(2 * pActors[i].uActorHeight); | |
142 | 2701 z -= floorf(v4 + 0.5f); |
2123 | 2702 if ( z > pActors[i].vPosition.z ) |
2703 z = pActors[i].vPosition.z; | |
0 | 2704 } |
2705 } | |
2123 | 2706 v8 = stru_5C6E00->Atan2(pActors[i].vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x, |
2707 pActors[i].vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); | |
2708 LOWORD(v9) = pActors[i].uYawAngle; | |
0 | 2709 v41 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v9 - v8) >> 8) & 7; |
2710 if ( pParty->bTurnBasedModeOn ) | |
2711 { | |
2123 | 2712 v12 = pActors[i].uCurrentActionTime; |
2713 if ( pActors[i].uCurrentActionAnimation == 1 ) | |
2714 v12 = 32 * i + pMiscTimer->uTotalGameTimeElapsed; | |
0 | 2715 } |
2716 else | |
2717 { | |
2123 | 2718 v12 = pActors[i].uCurrentActionTime; |
2719 if ( pActors[i].uCurrentActionAnimation == 1 ) | |
2720 v12 = 32 * i + pEventTimer->uTotalGameTimeElapsed; | |
0 | 2721 } |
2123 | 2722 if ( (signed __int64)pActors[i].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0 || (signed __int64)pActors[i].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0 ) |
0 | 2723 v12 = 0; |
2123 | 2724 if ( pActors[i].uAIState == 17 && !v49 ) |
2725 v14 = pSpriteFrameTable->GetFrame(uSpriteID_Spell11, v12); | |
2726 else if ( pActors[i].uAIState == 16 ) | |
2727 v14 = pSpriteFrameTable->GetFrameBy_x(pActors[i].pSpriteIDs[pActors[i].uCurrentActionAnimation], v12); | |
2728 else | |
2729 v14 = pSpriteFrameTable->GetFrame(pActors[i].pSpriteIDs[pActors[i].uCurrentActionAnimation], v12); | |
0 | 2730 v62 = 0; |
2731 v15 = v14; | |
2732 //v16 = (int *)v14->uFlags; | |
2733 if (v14->uFlags & 2) | |
2734 v62 = 2; | |
2735 if (v14->uFlags & 0x40000) | |
2736 v62 |= 0x40u; | |
2737 if (v14->uFlags & 0x20000) | |
2738 LOBYTE(v62) = v62 | 0x80; | |
2739 if ((256 << v41) & v14->uFlags) | |
2740 v62 |= 4u; | |
2741 if ( v15->uGlowRadius ) | |
2742 { | |
2154 | 2743 //LOBYTE(v16) = _4E94D3_light_type; |
2744 pMobileLightsStack->AddLight(x, y, z, 0, v15->uGlowRadius, 0xFFu, 0xFFu, 0xFFu, _4E94D3_light_type); | |
0 | 2745 } |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2746 v17 = (x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2747 if (pGame->pIndoorCameraD3D->sRotationX) |
0 | 2748 { |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2749 v18 = (y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; |
2166 | 2750 v47 = (fixpoint_mul(v17, pGame->pIndoorCameraD3D->int_cosine_y) + fixpoint_mul(v18, pGame->pIndoorCameraD3D->int_sine_y)); |
2751 v50 = fixpoint_mul(v17, pGame->pIndoorCameraD3D->int_sine_y); | |
2752 v53 = fixpoint_mul(v18, pGame->pIndoorCameraD3D->int_cosine_y); | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2753 v44 = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; |
2166 | 2754 v19 = (fixpoint_mul(v44, pGame->pIndoorCameraD3D->int_sine_x) + fixpoint_mul(v47, pGame->pIndoorCameraD3D->int_cosine_x)); |
2755 X = fixpoint_mul(v44, pGame->pIndoorCameraD3D->int_sine_x) + fixpoint_mul(v47, pGame->pIndoorCameraD3D->int_cosine_x); | |
1637 | 2756 if ( v19 < 262144 || v19 > pODMRenderParams->shading_dist_mist << 16 ) |
142 | 2757 continue; |
0 | 2758 v20 = v53 - v50; |
2759 v42 = v53 - v50; | |
2166 | 2760 v21 = (fixpoint_mul(v44, pGame->pIndoorCameraD3D->int_cosine_x) - fixpoint_mul(v47, pGame->pIndoorCameraD3D->int_sine_x)); |
0 | 2761 } |
2762 else | |
2763 { | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2764 v48 = (y - pGame->pIndoorCameraD3D->vPartyPos.y) << 16; |
2166 | 2765 v51 = fixpoint_mul(v17, pGame->pIndoorCameraD3D->int_cosine_y); |
2766 v22 = fixpoint_mul(v48, pGame->pIndoorCameraD3D->int_sine_y); | |
0 | 2767 X = v22 + v51; |
1637 | 2768 if ( v22 + v51 < 262144 || v22 + v51 > pODMRenderParams->shading_dist_mist << 16 ) |
142 | 2769 continue; |
2166 | 2770 v23 = fixpoint_mul(((x - pGame->pIndoorCameraD3D->vPartyPos.x) << 16), pGame->pIndoorCameraD3D->int_sine_y); |
2771 v20 = fixpoint_mul(v48, pGame->pIndoorCameraD3D->int_cosine_y) - v23; | |
2772 v42 = fixpoint_mul(v48, pGame->pIndoorCameraD3D->int_cosine_y) - v23; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2773 v21 = (z - pGame->pIndoorCameraD3D->vPartyPos.z) << 16; |
0 | 2774 } |
2775 v45 = v21; | |
2776 v24 = abs(v20); | |
2777 if ( abs(X) >= v24 ) | |
2778 { | |
2779 LODWORD(v25) = 0; | |
1637 | 2780 HIDWORD(v25) = SLOWORD(pODMRenderParams->int_fov_rad); |
0 | 2781 v58 = v25 / X; |
2782 v26 = v25 / X; | |
2783 LODWORD(v25) = 0; | |
1637 | 2784 HIDWORD(v25) = SLOWORD(pODMRenderParams->int_fov_rad); |
0 | 2785 v57 = v25 / X; |
2166 | 2786 v27 = pViewport->uScreenCenterX - ((signed int)(fixpoint_mul(v26, v42) + 32768) >> 16); |
2787 v43 = pViewport->uScreenCenterX - ((signed int)(fixpoint_mul(v26, v42) + 32768) >> 16); | |
2788 v46 = pViewport->uScreenCenterY - ((signed int)(fixpoint_mul(v25 / X, v45) + 32768) >> 16); | |
0 | 2789 result = uNumBillboardsToDraw; |
2166 | 2790 //v28 = &pBillboardRenderList[uNumBillboardsToDraw]; |
142 | 2791 if (uNumBillboardsToDraw >= 500) |
2792 return; | |
0 | 2793 ++uNumBillboardsToDraw; |
2794 ++uNumSpritesDrawnThisFrame; | |
2166 | 2795 pActors[i].uAttributes |= 8; |
2796 pBillboardRenderList[uNumBillboardsToDraw - 1].uHwSpriteID = v15->pHwSpriteIDs[v41]; | |
2797 pBillboardRenderList[uNumBillboardsToDraw - 1].uIndoorSectorID = 0; | |
2798 pBillboardRenderList[uNumBillboardsToDraw - 1].uPalette = v15->uPaletteIndex; | |
2799 pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_x_scaler_packedfloat = fixpoint_mul(v15->scale, v58); | |
2800 pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_y_scaler_packedfloat = fixpoint_mul(v15->scale, v57); | |
2801 if ( pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime <= 0 ) | |
0 | 2802 { |
2166 | 2803 if ( pActors[i].pActorBuffs[ACTOR_BUFF_MASS_DISTORTION].uExpireTime > 0 ) |
0 | 2804 { |
2166 | 2805 pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_y_scaler_packedfloat = fixpoint_mul(pGame->pStru6Instance->_4A806F(&pActors[i]), |
2806 pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_y_scaler_packedfloat); | |
0 | 2807 LOWORD(v27) = v43; |
2808 } | |
2809 } | |
2810 else | |
2811 { | |
2166 | 2812 if ( pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uPower ) |
0 | 2813 { |
2166 | 2814 pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_y_scaler_packedfloat = fixpoint_mul(65536 / pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uPower, |
2815 pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_y_scaler_packedfloat); | |
2816 LOWORD(v27) = v43; | |
0 | 2817 } |
2818 } | |
2166 | 2819 pBillboardRenderList[uNumBillboardsToDraw - 1].uScreenSpaceX = v27; |
2820 pBillboardRenderList[uNumBillboardsToDraw - 1].uScreenSpaceY = v46; | |
2821 pBillboardRenderList[uNumBillboardsToDraw - 1].world_x = x; | |
2822 pBillboardRenderList[uNumBillboardsToDraw - 1].world_y = y; | |
2823 pBillboardRenderList[uNumBillboardsToDraw - 1].world_z = z; | |
0 | 2824 HIWORD(v34) = HIWORD(X); |
2825 LOWORD(v34) = 0; | |
2166 | 2826 pBillboardRenderList[uNumBillboardsToDraw - 1].dimming_level = 0; |
2827 pBillboardRenderList[uNumBillboardsToDraw - 1].sZValue = v34 + PID(OBJECT_Actor, i); | |
2828 pBillboardRenderList[uNumBillboardsToDraw - 1].field_14_actor_id = i; | |
2829 //v35 = pMonsterList->pMonsters; | |
2830 //v36 = pActors[i].pMonsterInfo.uID; | |
2831 pBillboardRenderList[uNumBillboardsToDraw - 1].field_1E = v62 | 0x200; | |
2832 pBillboardRenderList[uNumBillboardsToDraw - 1].pSpriteFrame = v15; | |
2833 pBillboardRenderList[uNumBillboardsToDraw - 1].sTintColor = pMonsterList->pMonsters[pActors[i].pMonsterInfo.uID - 1].sTintColor;//*((int *)&v35[v36] - 36); | |
2123 | 2834 if (pActors[i].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) |
2166 | 2835 pBillboardRenderList[uNumBillboardsToDraw - 1].field_1E = v62 | 0x200; |
0 | 2836 } |
142 | 2837 //LABEL_58: |
2838 //++v59; | |
2839 //v54 += 32; | |
2840 //result = v59; | |
2841 //++v1; | |
2842 //} | |
2843 //while ( v59 < (signed int)uNumActors ); | |
0 | 2844 } |
142 | 2845 //return result; |
0 | 2846 } |
2847 | |
2848 //----- (0044C1E8) -------------------------------------------------------- | |
2849 bool ODMFace::HasEventHint() | |
2850 { | |
428 | 2851 signed int event_index; // eax@1 |
2852 _evt_raw* start_evt; | |
2853 _evt_raw* end_evt; | |
0 | 2854 |
428 | 2855 event_index = 0; |
2856 if ( (uLevelEVT_NumEvents - 1) <= 0 ) | |
2857 return false; | |
2858 while ( pLevelEVT_Index[event_index].uEventID != this->sCogTriggeredID ) | |
0 | 2859 { |
428 | 2860 ++event_index; |
2861 if ( event_index >= (signed int)(uLevelEVT_NumEvents - 1) ) | |
2862 return false; | |
0 | 2863 } |
428 | 2864 end_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index+1].uEventOffsetInEVT]; |
2865 start_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; | |
2866 if ( (end_evt->_e_type != EVENT_Exit) || (start_evt->_e_type!= EVENT_MouseOver) ) | |
2867 return false; | |
0 | 2868 else |
428 | 2869 return true; |
1295 | 2870 } |
2871 //----- (0046D49E) -------------------------------------------------------- | |
1413 | 2872 int ODM_GetFloorLevel(int X, signed int Y, int Z, int __unused, int *pIsOnWater, int *bmodel_pid, int bWaterWalk) |
1295 | 2873 { |
2874 BSPModel *pBModel; // esi@4 | |
2875 ODMFace *pFace; // ecx@11 | |
2876 int v14; // edx@20 | |
2877 signed int v18; // edx@26 | |
2878 int v19; // eax@28 | |
2879 int v20; // edx@30 | |
2880 int v21; // ST1C_4@30 | |
2881 signed int v22; // edx@30 | |
2882 signed __int64 v23; // qtt@30 | |
2883 int v24; // eax@36 | |
2884 signed int v25; // ecx@38 | |
2885 int result; // eax@42 | |
2075 | 2886 signed int current_floor_level; // ecx@43 |
1295 | 2887 int v28; // edi@44 |
2888 signed int v29; // edx@44 | |
2889 int v30; // esi@45 | |
2890 int v31; // eax@45 | |
2891 int v33; // ecx@59 | |
2892 int v36; // [sp+14h] [bp-2Ch]@24 | |
2893 int v38; // [sp+1Ch] [bp-24h]@2 | |
2894 int v39; // [sp+20h] [bp-20h]@9 | |
2895 signed int pBModelNum; // [sp+28h] [bp-18h]@1 | |
2896 int pFaceNum; // [sp+2Ch] [bp-14h]@8 | |
2068 | 2897 bool current_vertices_Y; // [sp+30h] [bp-10h]@22 |
2898 bool next_vertices_Y; // [sp+34h] [bp-Ch]@24 | |
1295 | 2899 signed int v46; // [sp+3Ch] [bp-4h]@1 |
2068 | 2900 signed int number_hits; // [sp+58h] [bp+18h]@22 |
2075 | 2901 signed int next_floor_level; // [sp+58h] [bp+18h]@43 |
1295 | 2902 |
2903 v46 = 1; | |
2140
4c0c475917dd
drawing items in the dragon's cave and GetFloorLevel for BModels
Ritor1
parents:
2132
diff
changeset
|
2904 current_BModel_id[0] = -1; |
4c0c475917dd
drawing items in the dragon's cave and GetFloorLevel for BModels
Ritor1
parents:
2132
diff
changeset
|
2905 current_Face_id[0] = -1; |
1295 | 2906 odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, pIsOnWater, bWaterWalk); |
2907 | |
2908 for ( pBModelNum = 0; pBModelNum < pOutdoor->uNumBModels; ++pBModelNum ) | |
2909 { | |
2910 pBModel = &pOutdoor->pBModels[pBModelNum]; | |
2911 if ( X <= pBModel->sMaxX && X >= pBModel->sMinX && | |
2912 Y <= pBModel->sMaxY && Y >= pBModel->sMinY ) | |
2913 { | |
2914 if ( pBModel->uNumFaces > 0 ) | |
2915 { | |
2916 v39 = 0; | |
2917 for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum ) | |
2918 { | |
2919 pFace = &pBModel->pFaces[pFaceNum]; | |
2075 | 2920 if ( pFace->Ethereal() ) |
2921 continue; | |
1295 | 2922 if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall) |
2923 && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1 | |
2924 && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 ) | |
2925 { | |
2144 | 2926 for ( uint i = 0; i < pFace->uNumVertices; ++i) |
2927 { | |
2928 odm_floor_face_vert_coord_X[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x; | |
2929 odm_floor_face_vert_coord_Y[2 * i] = pFace->pYInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y; | |
2930 odm_floor_face_vert_coord_X[2 * i + 1] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; | |
2931 odm_floor_face_vert_coord_Y[2 * i + 1] = pFace->pYInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; | |
2932 } | |
2075 | 2933 odm_floor_face_vert_coord_X[2 * pFace->uNumVertices] = odm_floor_face_vert_coord_X[0]; |
2934 odm_floor_face_vert_coord_Y[2 * pFace->uNumVertices] = odm_floor_face_vert_coord_Y[0]; | |
2935 | |
2936 current_vertices_Y = odm_floor_face_vert_coord_Y[0] >= Y; | |
2068 | 2937 number_hits = 0; |
1295 | 2938 if ( 2 * pFace->uNumVertices > 0 ) |
2939 { | |
2940 for ( int i = 0; i < 2 * pFace->uNumVertices; ++i ) | |
2941 { | |
2068 | 2942 if ( number_hits >= 2 ) |
1295 | 2943 break; |
2075 | 2944 //v36 = odm_floor_face_vert_coord_Y[i + 1]; |
2945 next_vertices_Y = odm_floor_face_vert_coord_Y[i + 1] >= Y; | |
2068 | 2946 if ( current_vertices_Y != next_vertices_Y )//проверка по Y |
1295 | 2947 { |
2075 | 2948 v18 = odm_floor_face_vert_coord_X[i + 1] >= X ? 0 : 2; |
2949 v19 = v18 | (odm_floor_face_vert_coord_X[i] < X); | |
1295 | 2950 if ( v19 != 3 ) |
2951 { | |
2952 if ( !v19 ) | |
2068 | 2953 ++number_hits; |
1295 | 2954 else |
2955 { | |
2075 | 2956 LODWORD(v23) = (Y - odm_floor_face_vert_coord_Y[i]) << 16; |
2957 HIDWORD(v23) = (Y - odm_floor_face_vert_coord_Y[i]) >> 16; | |
2958 v22 = ((((odm_floor_face_vert_coord_X[i + 1] - odm_floor_face_vert_coord_X[i]) * v23 / (odm_floor_face_vert_coord_Y[i + 1] | |
2959 - odm_floor_face_vert_coord_Y[i])) >> 16) + odm_floor_face_vert_coord_X[i]); | |
1295 | 2960 if ( v22 >= X) |
2068 | 2961 ++number_hits; |
1295 | 2962 } |
2963 } | |
2964 } | |
2068 | 2965 current_vertices_Y = next_vertices_Y; |
1295 | 2966 } |
2068 | 2967 if ( number_hits == 1 ) |
1295 | 2968 { |
2969 if ( v46 >= 20 ) | |
2970 break; | |
2971 if ( pFace->uPolygonType == POLYGON_Floor ) | |
2972 v24 = pBModel->pVertices.pVertices[pFace->pVertexIDs[0]].z; | |
2973 else | |
2140
4c0c475917dd
drawing items in the dragon's cave and GetFloorLevel for BModels
Ritor1
parents:
2132
diff
changeset
|
2974 { |
2207 | 2975 int a = fixpoint_mul(pFace->zCalc1, X); |
2976 int b = fixpoint_mul(pFace->zCalc2, Y); | |
2144 | 2977 int c = ((signed __int64)pFace->zCalc3 >> 16); |
2140
4c0c475917dd
drawing items in the dragon's cave and GetFloorLevel for BModels
Ritor1
parents:
2132
diff
changeset
|
2978 v24 = a + b + c; |
4c0c475917dd
drawing items in the dragon's cave and GetFloorLevel for BModels
Ritor1
parents:
2132
diff
changeset
|
2979 } |
1295 | 2980 v25 = v46++; |
2981 odm_floor_level[v25] = v24; | |
2140
4c0c475917dd
drawing items in the dragon's cave and GetFloorLevel for BModels
Ritor1
parents:
2132
diff
changeset
|
2982 current_BModel_id[v25] = pBModelNum; |
4c0c475917dd
drawing items in the dragon's cave and GetFloorLevel for BModels
Ritor1
parents:
2132
diff
changeset
|
2983 current_Face_id[v25] = pFaceNum; |
1295 | 2984 } |
2985 } | |
2986 } | |
2987 | |
2988 } | |
2989 } | |
2990 } | |
2991 } | |
2992 if ( v46 == 1 ) | |
2993 { | |
1413 | 2994 *bmodel_pid = 0; |
1295 | 2995 return odm_floor_level[0]; |
2996 } | |
2075 | 2997 current_floor_level = 0; |
2998 v29 = 0; | |
1295 | 2999 if ( v46 <= 1 ) |
1413 | 3000 *bmodel_pid = 0; |
1295 | 3001 else |
3002 { | |
2075 | 3003 current_floor_level = odm_floor_level[0]; |
3004 for ( uint i = 1; i < v46; ++i ) | |
1295 | 3005 { |
2075 | 3006 next_floor_level = odm_floor_level[i]; |
3007 if ( current_floor_level <= Z + 5 ) | |
1295 | 3008 { |
2075 | 3009 if ( next_floor_level > current_floor_level && next_floor_level <= Z + 5 ) |
1295 | 3010 { |
2075 | 3011 current_floor_level = next_floor_level; |
3012 v29 = i; | |
1295 | 3013 } |
3014 } | |
2075 | 3015 else if ( next_floor_level < current_floor_level ) |
1295 | 3016 { |
2075 | 3017 current_floor_level = next_floor_level; |
3018 v29 = i; | |
1295 | 3019 } |
3020 } | |
2075 | 3021 if ( !v29 ) |
1413 | 3022 *bmodel_pid = 0; |
1295 | 3023 else |
2140
4c0c475917dd
drawing items in the dragon's cave and GetFloorLevel for BModels
Ritor1
parents:
2132
diff
changeset
|
3024 *bmodel_pid = current_Face_id[v29] | (current_BModel_id[v29] << 6); |
1295 | 3025 } |
2075 | 3026 if ( v29 ) |
1295 | 3027 { |
3028 *pIsOnWater = false; | |
2140
4c0c475917dd
drawing items in the dragon's cave and GetFloorLevel for BModels
Ritor1
parents:
2132
diff
changeset
|
3029 if ( pOutdoor->pBModels[current_BModel_id[v29]].pFaces[current_Face_id[v29]].Fluid()) |
1295 | 3030 *pIsOnWater = true; |
3031 } | |
2075 | 3032 if ( odm_floor_level[v29] >= odm_floor_level[0] ) |
3033 odm_floor_level[0] = odm_floor_level[v29]; | |
1295 | 3034 return odm_floor_level[0]; |
3035 } | |
1412 | 3036 |
1295 | 3037 //not sure if right- or left-handed coordinate space assumed, so this could be normal of inverse normal |
3038 // for a right-handed system, that would be an inverse normal | |
3039 //----- (0046DCC8) -------------------------------------------------------- | |
3040 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out) | |
3041 { | |
1980 | 3042 uint grid_x = WorldPosToGridCellX(pos_x); |
3043 uint grid_z = WorldPosToGridCellZ(pos_z) - 1; | |
1295 | 3044 |
1980 | 3045 int grid_pos_x1 = GridCellToWorldPosX(grid_x); |
3046 int grid_pos_x2 = GridCellToWorldPosX(grid_x + 1); | |
3047 int grid_pos_z1 = GridCellToWorldPosZ(grid_z); | |
3048 int grid_pos_z2 = GridCellToWorldPosZ(grid_z + 1); | |
1295 | 3049 |
1980 | 3050 int x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z); |
3051 int x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z); | |
3052 int x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1); | |
3053 int x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
1295 | 3054 |
3055 float side1_dx, side1_dy, side1_dz, | |
3056 side2_dx, side2_dy, side2_dz; | |
3057 | |
1980 | 3058 int dx = abs(pos_x - grid_pos_x1), |
1295 | 3059 dz = abs(grid_pos_z1 - pos_z); |
3060 if (dz >= dx) | |
3061 { | |
2144 | 3062 side2_dx = (double)(grid_pos_x2 - grid_pos_x1); |
3063 side2_dz = 0.0;//(double)(grid_pos_z2 - grid_pos_z2); // bug? z2 - z2 | |
1295 | 3064 side2_dy = (double)(x2z2_y - x1z2_y); |
2144 | 3065 |
3066 side1_dx = 0.0;//(double)(grid_pos_x1 - grid_pos_x1); | |
1295 | 3067 side1_dz = (double)(grid_pos_z1 - grid_pos_z2); // z1 - z2 yes |
2144 | 3068 side1_dy = (double)(x1z1_y - x1z2_y); |
1295 | 3069 //Log::Warning(L"%S %S %u\n", __FILE__, __FUNCTION__, __LINE__); |
3070 /* |\ | |
3071 side1 | \ | |
3072 |____\ | |
3073 side 2 */ | |
3074 } | |
3075 else | |
3076 { | |
2144 | 3077 side2_dx = (double)(grid_pos_x1 - grid_pos_x2); |
3078 side2_dz = 0.0;//(double)(grid_pos_z1 - grid_pos_z1); | |
1295 | 3079 side2_dy = (double)(x1z1_y - x2z1_y); |
2144 | 3080 |
3081 side1_dx = 0.0;//(double)(grid_pos_x2 - grid_pos_x1); | |
1295 | 3082 side1_dz = (double)(grid_pos_z2 - grid_pos_z1); |
2144 | 3083 side1_dy = (double)(x2z2_y - x2z1_y); |
1295 | 3084 /* side 2 |
3085 _____ | |
3086 \ | | |
3087 \ | side 1 | |
3088 \| */ | |
3089 } | |
3090 | |
3091 float nx = side1_dy * side2_dz - side1_dz * side2_dy; | |
3092 float ny = side1_dx * side2_dy - side1_dy * side2_dx; | |
3093 float nz = side1_dz * side2_dx - side1_dx * side2_dz; | |
3094 | |
3095 float mag = sqrt(nx * nx + ny * ny + nz * nz); | |
3096 if (fabsf(mag) < 1e-6f) | |
3097 { | |
3098 out->y = 0; | |
3099 out->x = 0; | |
3100 out->z = 65536; | |
3101 } | |
3102 else | |
3103 { | |
3104 float invmag = 1.0 / mag; | |
3105 out->x = invmag * nx * 65536.0; | |
3106 out->y = invmag * ny * 65536.0; | |
3107 out->z = invmag * nz * 65536.0; | |
3108 } | |
3109 } | |
3110 //----- (004014E6) -------------------------------------------------------- | |
3111 void MakeActorAIList_ODM() | |
3112 { | |
3113 int v1; // eax@4 | |
3114 int v2; // ebx@4 | |
3115 unsigned int v3; // ecx@4 | |
3116 int v4; // edx@5 | |
3117 int v5; // edx@7 | |
3118 unsigned int v6; // edx@9 | |
3119 unsigned int v7; // ST20_4@10 | |
3120 int v9; // edi@10 | |
3121 int v10; // ebx@14 | |
3122 int v21; // [sp+Ch] [bp-14h]@4 | |
3123 int v22; // [sp+10h] [bp-10h]@4 | |
3124 | |
3125 pParty->uFlags &= 0xFFFFFFCFu; | |
3126 | |
3127 ai_arrays_size = 0; | |
3128 for (uint i = 0; i < uNumActors; ++i) | |
3129 { | |
1980 | 3130 Actor* actor = &pActors[i]; |
1295 | 3131 |
3132 actor->uAttributes &= 0xFFFFFBFF; | |
3133 if (!actor->CanAct()) | |
3134 { | |
3135 actor->uAttributes &= 0xFFFFBFFF; | |
3136 continue; | |
3137 } | |
3138 | |
3139 v22 = abs(pParty->vPosition.z - actor->vPosition.z); | |
3140 v21 = abs(pParty->vPosition.y - actor->vPosition.y); | |
3141 v1 = abs(pParty->vPosition.x - actor->vPosition.x); | |
3142 v2 = v21; | |
3143 v3 = v22; | |
3144 if ( v1 < v21 ) | |
3145 { | |
3146 v4 = v1; | |
3147 v1 = v21; | |
3148 v2 = v4; | |
3149 } | |
3150 if ( v1 < v22 ) | |
3151 { | |
3152 v5 = v1; | |
3153 v1 = v22; | |
3154 v3 = v5; | |
3155 } | |
3156 if ( v2 < (signed int)v3 ) | |
3157 { | |
3158 v6 = v3; | |
3159 v3 = v2; | |
3160 v2 = v6; | |
3161 } | |
3162 v7 = ((unsigned int)(11 * v2) >> 5) + (v3 >> 2) + v1; | |
3163 //v8 = actor->uActorRadius; | |
3164 v9 = v7 - actor->uActorRadius; | |
3165 //v23 = v7 - v8; | |
3166 if ( v9 < 0 ) | |
3167 { | |
3168 v9 = 0; | |
3169 //v23 = 0; | |
3170 } | |
3171 | |
3172 if (v9 < 5632) | |
3173 { | |
3174 v10 = actor->uAttributes & 0xFEFFFFFF; | |
3175 actor->uAttributes = v10; | |
3176 if ( v10 & 0x80000 || actor->GetActorsRelation(0) ) | |
3177 { | |
3178 //v11 = (pParty->uFlags & 0x10) == 0; | |
3179 actor->uAttributes = v10 | 0x1000000; | |
3180 if (v9 < 5120 ) | |
3181 pParty->SetYellowAlert(); | |
3182 if (v9 < 307) | |
3183 pParty->SetRedAlert(); | |
3184 } | |
3185 actor->uAttributes |= 0x00004000; | |
3186 ai_near_actors_distances[ai_arrays_size] = v9; | |
3187 ai_near_actors_ids[ai_arrays_size++] = i; | |
3188 } | |
3189 else | |
3190 actor->uAttributes &= 0xFFFFBFFF; | |
3191 } | |
3192 | |
3193 /* | |
3194 result = v27; | |
3195 if ( v27 > 0 ) | |
3196 { | |
3197 v14 = 0; | |
3198 v15 = 1; | |
3199 v26 = 1; | |
3200 do | |
3201 { | |
3202 while ( 1 ) | |
3203 { | |
3204 v24 = v15; | |
3205 if ( v15 >= result ) | |
3206 break; | |
3207 v16 = ai_near_actors_distances[v14]; | |
3208 if ( v16 > ai_near_actors_distances[v15] ) | |
3209 { | |
3210 v17 = &ai_near_actors_ids[v15]; | |
3211 v18 = ai_near_actors_ids[v14]; | |
3212 ai_near_actors_ids[v14] = *v17; | |
3213 *v17 = v18; | |
3214 v15 = v24; | |
3215 ai_near_actors_distances[v14] = ai_near_actors_distances[v24]; | |
3216 ai_near_actors_distances[v24] = v16; | |
3217 } | |
3218 result = v27; | |
3219 ++v15; | |
3220 } | |
3221 ++v14; | |
3222 v15 = v26 + 1; | |
3223 v26 = v15; | |
3224 } | |
3225 while ( v15 - 1 < result ); | |
3226 }*/ | |
3227 | |
3228 for (uint i = 0; i < ai_arrays_size; ++i) | |
3229 for (uint j = 0; j < i; ++j) | |
3230 if (ai_near_actors_distances[j] > ai_near_actors_distances[i]) | |
3231 { | |
3232 int tmp = ai_near_actors_distances[j]; | |
3233 ai_near_actors_distances[j] = ai_near_actors_distances[i]; | |
3234 ai_near_actors_distances[i] = tmp; | |
3235 | |
3236 tmp = ai_near_actors_ids[j]; | |
3237 ai_near_actors_ids[j] = ai_near_actors_ids[i]; | |
3238 ai_near_actors_ids[i] = tmp; | |
3239 } | |
3240 | |
3241 | |
3242 if (ai_arrays_size > 30) | |
3243 ai_arrays_size = 30; | |
3244 | |
3245 for (uint i = 0; i < ai_arrays_size; ++i) | |
3246 pActors[ai_near_actors_ids[i]].uAttributes |= 0x0400; | |
1297 | 3247 } |
3248 //----- (0046BE0A) -------------------------------------------------------- | |
1642 | 3249 void ODM_UpdateUserInputAndOther() |
1297 | 3250 { |
3251 bool v0; // eax@5 | |
3252 char pOut[32]; // [sp+8h] [bp-20h]@5 | |
3253 | |
3254 UpdateObjects(); | |
3255 ODM_ProcessPartyActions(); | |
3256 if ( pParty->vPosition.x < -22528 | |
3257 || pParty->vPosition.x > 22528 | |
3258 || pParty->vPosition.y < -22528 | |
3259 || pParty->vPosition.y > 22528 ) | |
3260 { | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1458
diff
changeset
|
3261 strcpy(pOutdoor->pLevelFilename, pCurrentMapName); |
1297 | 3262 v0 = pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 32); |
3263 if ( !bUnderwater && (pParty->uFlags & (PARTY_FLAGS_1_STANDING_ON_WATER | PARTY_FLAGS_1_FALLING | 0x04) || pParty->uFlags & 0x0200 || pParty->bFlying) || !v0 ) | |
3264 { | |
3265 if ( pParty->vPosition.x < -22528 ) | |
3266 pParty->vPosition.x = -22528; | |
3267 if ( pParty->vPosition.x > 22528 ) | |
3268 pParty->vPosition.x = 22528; | |
3269 if ( pParty->vPosition.y < -22528 ) | |
3270 pParty->vPosition.y = -22528; | |
3271 if ( pParty->vPosition.y > 22528 ) | |
3272 pParty->vPosition.y = 22528; | |
3273 } | |
3274 else | |
3275 { | |
3276 pAudioPlayer->StopChannels(-1, -1); | |
3277 TravelUI_Load(); | |
3278 } | |
3279 } | |
3280 UpdateActors_ODM(); | |
3281 check_event_triggers(); | |
3282 } | |
3283 //----- (0041F54A) -------------------------------------------------------- | |
1642 | 3284 void LoadActualSkyFrame() |
1297 | 3285 { |
3286 if ( pTexture_RestUI_CurrentSkyFrame ) | |
3287 pTexture_RestUI_CurrentSkyFrame->Release(); | |
3288 if ( pTexture_RestUI_CurrentHourglassFrame ) | |
3289 pTexture_RestUI_CurrentHourglassFrame->Release(); | |
3290 pIcons_LOD->SyncLoadedFilesCount(); | |
3291 sprintf(pTmpBuf.data(), "TERRA%03d", pParty->uCurrentMinute / 6 + 10 * pParty->uCurrentHour); | |
3292 pTexture_RestUI_CurrentSkyFrame = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); | |
1323 | 3293 } |
3294 | |
3295 | |
3296 //----- (004626BA) -------------------------------------------------------- | |
3297 OutdoorLocation::OutdoorLocation() | |
3298 { | |
3299 subconstuctor(); | |
3300 uLastSunlightUpdateMinute = 0; | |
3301 | |
3302 uNumBModels = 0; | |
3303 pBModels = nullptr; | |
3304 } | |
3305 | |
3306 //----- (004626CD) -------------------------------------------------------- | |
3307 void OutdoorLocation::subconstuctor() | |
3308 { | |
3309 //OutdoorLocationTerrain::OutdoorLocationTerrain(&this->pTerrain); | |
3310 field_F0 = 0; | |
3311 field_F4 = 0x40000000u; | |
3312 //DLVHeader::DLVHeader(&v1->ddm); | |
3313 pSpawnPoints = 0; | |
3314 pBModels = 0; | |
3315 pCmap = 0; | |
3316 pFaceIDLIST = 0; | |
3317 pOMAP = 0; | |
3318 } | |
3319 | |
1637 | 3320 //----- (00481E55) -------------------------------------------------------- |
3321 void ODM_Project(unsigned int uNumVertices) | |
3322 { | |
2169 | 3323 for ( uint i = 0; i < uNumVertices; i++ ) |
3324 { | |
3325 memcpy(&array_50AC10[i], &array_507D30[i], sizeof(array_50AC10[i])); | |
3326 array_50AC10[i].vWorldViewProjX = (double)pViewport->uScreenCenterX | |
3327 - ((double)pODMRenderParams->int_fov_rad * array_507D30[i]._rhw) * array_507D30[i].vWorldViewPosition.y; | |
3328 array_50AC10[i].vWorldViewProjY = (double)pViewport->uScreenCenterY | |
3329 - ((double)pODMRenderParams->int_fov_rad * array_507D30[i]._rhw) * array_507D30[i].vWorldViewPosition.z; | |
3330 } | |
3331 } | |
1637 | 3332 //----- (00485F64) -------------------------------------------------------- |
3333 void ODMRenderParams::Initialize() | |
3334 { | |
3335 int v1; // eax@1 | |
3336 int v2; // eax@2 | |
3337 signed __int64 v3; // qtt@4 | |
3338 int v4; // eax@4 | |
3339 | |
3340 this->uCameraFovInDegrees = 75; | |
3341 v1 = stru_5C6E00->uPiMask & 0xD5; | |
3342 if ( v1 >= (signed int)stru_5C6E00->uIntegerHalfPi ) | |
3343 v2 = -stru_5C6E00->pTanTable[stru_5C6E00->uIntegerPi - v1]; | |
3344 else | |
3345 v2 = stru_5C6E00->pTanTable[v1]; | |
3346 LODWORD(v3) = (viewparams->uSomeZ - viewparams->uSomeX) << 31; | |
3347 HIDWORD(v3) = (viewparams->uSomeZ - viewparams->uSomeX) << 15 >> 16; | |
3348 v4 = (signed int)(v3 / v2) >> 16; | |
3349 this->int_fov_rad = v4; | |
3350 this->field_4C = 360000; | |
3351 this->int_fov_rad_inv = 65536 / v4; | |
3352 this->field_50 = 115; | |
3353 //sr_6BE060[1] = 1; | |
1642 | 3354 //RotationToInts(); |
1637 | 3355 } |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3356 //----- (00473893) -------------------------------------------------------- |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3357 void ODM_ProcessPartyActions() |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3358 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3359 int v1; // edi@1 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3360 int v2; // ebx@1 |
2085 | 3361 int floor_level; // eax@14 |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3362 int v6; // esi@45 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3363 ODMFace *face; // ecx@45 |
2167 | 3364 //signed int v33; // eax@143 |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3365 int v34; // esi@143 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3366 int v35; // esi@147 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3367 int v36; // eax@155 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3368 signed int v37; // esi@159 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3369 signed int v38; // eax@159 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3370 signed int i; // esi@159 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3371 int v40; // esi@162 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3372 bool v42; // eax@180 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3373 signed int v43; // ecx@184 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3374 signed int v44; // edx@184 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3375 int v45; // ecx@200 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3376 BSPModel *pModel; // eax@203 |
2167 | 3377 bool pModel_; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3378 ODMFace *pODMFace; // esi@203 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3379 int v48; // eax@203 |
2163 | 3380 int v54; // eax@215 |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3381 int v55; // eax@217 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3382 BSPModel *v58; // eax@228 |
2147 | 3383 //unsigned __int64 v59; // qax@228 |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3384 BSPModel *v60; // eax@228 |
2147 | 3385 //unsigned __int64 v61; // qax@228 |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3386 int v62; // eax@241 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3387 unsigned int v66; // esi@263 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3388 signed int v68; // ecx@263 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3389 int v69; // eax@263 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3390 unsigned int v76; // edi@293 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3391 bool v77; // edx@297 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3392 bool v78; // ecx@303 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3393 int v79; // ecx@314 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3394 __int16 v80; // dx@317 |
2148 | 3395 //int v81; // ebx@318 |
3396 //int v82; // ecx@318 | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3397 int pTerrainHeight; // eax@321 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3398 int v86; // [sp-20h] [bp-B4h]@246 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3399 int v87; // [sp-20h] [bp-B4h]@248 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3400 signed int v88; // [sp-1Ch] [bp-B0h]@246 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3401 unsigned int v89; // [sp-18h] [bp-ACh]@246 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3402 signed int v90; // [sp-14h] [bp-A8h]@246 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3403 signed int v91; // [sp-10h] [bp-A4h]@246 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3404 int v92; // [sp-Ch] [bp-A0h]@246 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3405 unsigned int v94; // [sp-8h] [bp-9Ch]@246 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3406 int v96; // [sp-4h] [bp-98h]@246 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3407 int v97; // [sp+Ch] [bp-88h]@180 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3408 Vec3_int_ v98; |
2208 | 3409 bool not_high_fall; // [sp+1Ch] [bp-78h]@33 |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3410 int v102; // [sp+20h] [bp-74h]@1 |
2148 | 3411 int trigger_id; // [sp+24h] [bp-70h]@1 |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3412 bool bFeatherFall; // [sp+28h] [bp-6Ch]@4 |
2148 | 3413 int bonus; |
3414 int on_ground; // [sp+2Ch] [bp-68h]@24 | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3415 bool bWaterWalk; // [sp+30h] [bp-64h]@1 |
2085 | 3416 int ceiling_height; // [sp+3Ch] [bp-58h]@28 |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3417 int v110; // [sp+40h] [bp-54h]@180 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3418 int v111; // [sp+44h] [bp-50h]@14 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3419 bool hovering; // [sp+48h] [bp-4Ch]@1 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3420 int v113; // [sp+4Ch] [bp-48h]@1 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3421 bool party_running_flag; // [sp+50h] [bp-44h]@1 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3422 int _walk_speed; // [sp+54h] [bp-40h]@48 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3423 int pX; // [sp+58h] [bp-3Ch]@1 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3424 int pY; // [sp+5Ch] [bp-38h]@1 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3425 int v118; // [sp+60h] [bp-34h]@1 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3426 int _angle_x; // [sp+68h] [bp-2Ch]@48 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3427 unsigned int v122; // [sp+70h] [bp-24h]@180 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3428 int pZ; // [sp+74h] [bp-20h]@1 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3429 bool party_walking_flag; // [sp+78h] [bp-1Ch]@1 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3430 int _angle_y; // [sp+7Ch] [bp-18h]@48 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3431 int v128; // [sp+88h] [bp-Ch]@1 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3432 int v129; // [sp+8Ch] [bp-8h]@92 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3433 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3434 v1 = 0; |
2148 | 3435 trigger_id = 0; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3436 v2 = 0; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3437 //*(float *)&v128 = 0.0; |
2163 | 3438 int fall_speed = pParty->uFallSpeed; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3439 v128 = 0; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3440 v129 = 0; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3441 pX = pParty->vPosition.x; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3442 pY = pParty->vPosition.y; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3443 pZ = pParty->vPosition.z; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3444 v113 = pParty->field_6F0; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3445 hovering = false; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3446 bool partyAtHighSlope = IsTerrainSlopeTooHigh(pParty->vPosition.x, pParty->vPosition.y); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3447 party_running_flag = false; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3448 party_walking_flag = false; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3449 v102 = 0; |
2167 | 3450 pModel_ = false; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3451 bWaterWalk = false; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3452 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3453 if (!pParty->FeatherFallActive())//Проверка падение пера |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3454 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3455 bFeatherFall = false; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3456 for (int i = 0; i < 4; ++i) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3457 if (pParty->pPlayers[i].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT)) // seems like flying boots |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3458 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3459 bFeatherFall = true; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3460 break; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3461 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3462 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3463 else |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3464 bFeatherFall = true; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3465 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3466 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3467 if (pParty->WaterWalkActive())//Проверка хождения по воде |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3468 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3469 //LOBYTE(pParty->uFlags) &= 0x7Fu; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3470 bWaterWalk = true; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3471 *(short *)&stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1u; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3472 if (!(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) && |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3473 pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster - 1].sMana <= 0 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3474 bWaterWalk = false; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3475 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3476 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3477 int bmodel_standing_on_pid; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3478 int is_on_water = false; |
2085 | 3479 floor_level = ODM_GetFloorLevel(pX, pY, pZ, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, bWaterWalk); |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3480 int is_not_on_bmodel = bmodel_standing_on_pid == 0; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3481 |
2085 | 3482 v111 = floor_level; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3483 if ( bFeatherFall ) |
2085 | 3484 pParty->uFallStartY = floor_level; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3485 else |
2085 | 3486 floor_level = pParty->uFallStartY; |
3487 | |
3488 if ( floor_level - pZ > 512 && !bFeatherFall && pZ <= v111 + 1 )//падение на 3D Model | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3489 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3490 if (pParty->uFlags & PARTY_FLAGS_1_LANDING) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3491 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3492 else for (int i = 0; i < 4; ++i) // receive falling damage |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3493 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3494 if ( !pParty->pPlayers[i].HasEnchantedItemEquipped(72) && !pParty->pPlayers[i].WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3495 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3496 pParty->pPlayers[i].ReceiveDamage( |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3497 (signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(pParty->pPlayers[i].GetMaxHealth() / 10)) / 256, DMGT_PHISYCAL); |
2148 | 3498 bonus = 20 - pParty->pPlayers[i].GetParameterBonus(pParty->pPlayers[i].GetActualEndurance()); |
3499 pParty->pPlayers[i].SetRecoveryTime((signed __int64)((double)bonus * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3500 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3501 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3502 } |
2085 | 3503 |
3504 ceiling_height = -1; | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3505 if ( pParty->bFlying ) |
2085 | 3506 ceiling_height = GetCeilingHeight(pX, pY, pZ + pParty->uPartyHeight, (int)&v102);//высота потолка |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3507 //v107 = bmodel_standing_on_pid == 0; |
2148 | 3508 on_ground = v111 + 1; |
3509 if ( pZ <= on_ground )//полёт: посадка | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3510 { |
2085 | 3511 ceiling_height = -1; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3512 pParty->bFlying = false; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3513 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3514 else |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3515 hovering = true; |
2208 | 3516 not_high_fall = pZ - v111 <= 32; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3517 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3518 if ( bWalkSound && pParty->walk_sound_timer)//timer update |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3519 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3520 if (pParty->walk_sound_timer >= pEventTimer->uTimeElapsed) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3521 pParty->walk_sound_timer -= pEventTimer->uTimeElapsed; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3522 else |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3523 pParty->walk_sound_timer = 0; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3524 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3525 |
2148 | 3526 if (!bUnderwater && pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime <= 0)// конец действия полёта |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3527 pParty->bFlying = false; |
2148 | 3528 |
3529 if (!hovering)// | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3530 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3531 if ( pParty->floor_face_pid != PID(OBJECT_BModel, bmodel_standing_on_pid) ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3532 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3533 if (bmodel_standing_on_pid) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3534 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3535 if ( (bmodel_standing_on_pid >> 6) < pOutdoor->uNumBModels ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3536 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3537 face = pOutdoor->pBModels[bmodel_standing_on_pid >> 6].pFaces; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3538 v6 = bmodel_standing_on_pid & 0x3F; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3539 /*if ( *(char *)(v7->pFacePlane.vNormal.x + 308 * v6 + 31) & 4 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3540 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3541 pParty->field_6F4_packedid = PID(OBJECT_BModel,v108); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3542 v103 = *(short *)(v7->pFacePlane.vNormal.x + 308 * v6 + 292); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3543 }*/ |
2147 | 3544 if ( face[v6].uAttributes & FACE_PRESSURE_PLATE ) |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3545 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3546 pParty->floor_face_pid = PID(OBJECT_BModel, bmodel_standing_on_pid); |
2148 | 3547 trigger_id = face[v6].sCogTriggeredID; // |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3548 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3549 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3550 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3551 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3552 pParty->floor_face_pid = PID(OBJECT_BModel, bmodel_standing_on_pid); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3553 } |
2148 | 3554 |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3555 _walk_speed = pParty->uWalkSpeed; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3556 _angle_y = pParty->sRotationY; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3557 _angle_x = pParty->sRotationX; |
2085 | 3558 //v126 = pEventTimer->dt_in_some_format; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3559 /*v119 = (Player **)((unsigned __int64)(pEventTimer->dt_in_some_format |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3560 * (signed __int64)((signed int)(pParty->field_20_prolly_turn_speed |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3561 * stru_5C6E00->uIntegerPi) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3562 / 180)) >> 16);*/ |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3563 __int64 dturn = (unsigned __int64)(pEventTimer->dt_in_some_format * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi) / 180)) >> 16; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3564 while (pPartyActionQueue->uNumActions) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3565 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3566 switch (pPartyActionQueue->Next()) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3567 { |
2160 | 3568 case PARTY_FlyUp://полёт вверх |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3569 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3570 if (!pParty->FlyActive() && !bUnderwater) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3571 break; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3572 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3573 pParty->bFlying = false; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3574 if (bUnderwater || |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3575 pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1 || |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3576 pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0 ) |
2167 | 3577 { |
3578 extern int max_flight_height; | |
3579 if ( pParty->vPosition.z < max_flight_height || hovering ) | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3580 { |
2167 | 3581 pZ += 30; |
3582 v113 += 30; | |
3583 pParty->bFlying = true; | |
3584 if ( pZ > max_flight_height ) | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3585 { |
2167 | 3586 pZ = max_flight_height; |
3587 v113 = max_flight_height; | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3588 } |
2167 | 3589 v1 = 0; |
3590 v2 = 0; | |
3591 fall_speed = 0; | |
3592 *(float *)&v128 = 0.0; | |
3593 if ( v102 && pZ < ceiling_height && (signed int)(pParty->uPartyHeight + pZ) >= ceiling_height )//столкновение с потолком | |
3594 { | |
3595 pParty->field_6E0 = 0; | |
3596 pParty->field_6E4 = 0; | |
3597 pPartyActionQueue->uNumActions = 0; | |
3598 pParty->uFlags |= PARTY_FLAGS_1_LANDING; | |
3599 pParty->vPosition.z = ceiling_height - pParty->uPartyHeight - 31; | |
3600 pParty->field_6F0 = pZ; | |
3601 pParty->bFlying = false; | |
3602 pZ = ceiling_height - pParty->uPartyHeight - 31; | |
3603 v113 = pParty->field_6F0; | |
3604 } | |
3605 pParty->uFallSpeed = 0; | |
3606 pModel_ = true; | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3607 } |
2167 | 3608 } |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3609 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3610 break; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3611 |
2160 | 3612 case PARTY_FlyDown://полёт вниз |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3613 if (pParty->FlyActive() || bUnderwater) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3614 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3615 pParty->bFlying = false; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3616 if ( bUnderwater |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3617 || pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3618 || pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster + 10] > 0 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3619 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3620 pZ -= 30; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3621 v113 -= 30; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3622 pParty->uFallSpeed = 0; |
2163 | 3623 fall_speed = 0; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3624 pParty->bFlying = true; |
2167 | 3625 pModel_ = true; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3626 if ( pZ <= v111 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3627 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3628 pParty->bFlying = false; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3629 pPartyActionQueue->uNumActions = 0; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3630 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3631 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3632 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3633 break; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3634 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3635 case PARTY_TurnLeft: |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3636 if (uTurnSpeed) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3637 _angle_y += uTurnSpeed; //descrete turn |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3638 else |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3639 _angle_y += dturn * fTurnSpeedMultiplier; // time-based smooth turn |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3640 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3641 _angle_y &= stru_5C6E00->uDoublePiMask; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3642 break; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3643 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3644 case PARTY_TurnRight: |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3645 if (uTurnSpeed) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3646 _angle_y -= uTurnSpeed; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3647 else |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3648 _angle_y -= dturn * fTurnSpeedMultiplier; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3649 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3650 _angle_y &= stru_5C6E00->uDoublePiMask; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3651 break; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3652 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3653 case PARTY_FastTurnLeft: |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3654 if (uTurnSpeed) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3655 _angle_y += uTurnSpeed; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3656 else |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3657 _angle_y += 2.0f * fTurnSpeedMultiplier * (double)dturn; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3658 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3659 _angle_y &= stru_5C6E00->uDoublePiMask; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3660 break; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3661 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3662 case PARTY_FastTurnRight: |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3663 if (!uTurnSpeed) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3664 _angle_y -= 2.0f * fTurnSpeedMultiplier * (double)dturn; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3665 else |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3666 _angle_y -= uTurnSpeed; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3667 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3668 _angle_y &= stru_5C6E00->uDoublePiMask; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3669 break; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3670 |
2160 | 3671 case PARTY_StrafeLeft://хождение боком в влево |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3672 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3673 *(float *)&v128 = pParty->uWalkSpeed; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3674 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3675 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3676 int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3677 v2 -= 3 * dx / 4; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3678 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3679 float cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3680 int dy = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3681 v1 += 3 * dy / 4; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3682 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3683 v128 = v1; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3684 party_walking_flag = true; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3685 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3686 break; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3687 |
2160 | 3688 case PARTY_StrafeRight://хождение боком в вправо |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3689 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3690 *(float *)&v128 = pParty->uWalkSpeed; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3691 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3692 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3693 int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3694 v2 += 3 * dx / 4; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3695 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3696 float cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3697 int dy = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3698 v1 -= 3 * dy / 4; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3699 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3700 v128 = v1; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3701 party_walking_flag = true; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3702 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3703 break; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3704 |
2160 | 3705 case PARTY_WalkForward:// идти вперёд |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3706 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3707 *(float *)&v128 = _walk_speed; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3708 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3709 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0), |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3710 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3711 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3712 int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3713 int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3714 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3715 extern bool new_speed; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3716 if ( new_speed ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3717 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3718 v2 += dx * 12; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3719 v1 += dy * 12; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3720 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3721 else |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3722 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3723 v2 += dx; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3724 v1 += dy; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3725 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3726 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3727 v128 = v1; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3728 party_walking_flag = true; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3729 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3730 break; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3731 |
2160 | 3732 case PARTY_RunForward://бежать вперёд |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3733 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3734 *(float *)&v128 = _walk_speed; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3735 |
2162 | 3736 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0); |
3737 float cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3738 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3739 int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3740 int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3741 |
2162 | 3742 if (pParty->bFlying)//лететь вперёд |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3743 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3744 v2 += 4 * dx; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3745 v1 += 4 * dy; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3746 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3747 v128 = v1; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3748 } |
2162 | 3749 else if (partyAtHighSlope && !bmodel_standing_on_pid)//сбегание со склона |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3750 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3751 v2 += dx; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3752 v1 += dy; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3753 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3754 v128 = v1; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3755 party_walking_flag = true; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3756 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3757 else |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3758 { |
2164 | 3759 /*v2 += (unsigned __int64)(stru_5C6E00->Cos(_angle_y) |
2162 | 3760 * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)_walk_speed * fWalkSpeedMultiplier))) >> 16; |
3761 v1 += (unsigned __int64)((signed int)stru_5C6E00->Sin(_angle_y) | |
2164 | 3762 * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)_walk_speed * fWalkSpeedMultiplier))) >> 16;*/ |
3763 | |
3764 v2 += 2 * dx; | |
3765 v1 += 2 * dy; | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3766 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3767 v128 = v1; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3768 party_running_flag = true; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3769 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3770 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3771 break; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3772 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3773 |
2160 | 3774 case PARTY_WalkBackward://идти назад |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3775 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3776 *(float *)&v128 = _walk_speed; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3777 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3778 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0), |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3779 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3780 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3781 int dx = cos_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3782 v2 -= dx; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3783 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3784 int dy = sin_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3785 v1 -= dy; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3786 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3787 v128 = v1; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3788 party_walking_flag = true; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3789 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3790 break; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3791 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3792 |
2160 | 3793 case PARTY_RunBackward://бежать назад |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3794 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3795 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0), |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3796 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3797 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3798 int dx = cos_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3799 int dy = sin_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3800 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3801 if (pParty->bFlying) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3802 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3803 v2 -= 4 * dx; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3804 v1 -= 4 * dy; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3805 v128 = v1; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3806 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3807 else |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3808 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3809 v2 -= dx; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3810 v1 -= dy; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3811 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3812 v128 = v1; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3813 party_walking_flag = true; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3814 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3815 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3816 break; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3817 |
2160 | 3818 case PARTY_CenterView://смотреть прямо |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3819 _angle_x = 0; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3820 break; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3821 |
2160 | 3822 case PARTY_LookUp://смотреть вверх |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3823 _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3824 if ( _angle_x > 128 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3825 _angle_x = 128; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3826 if (uActiveCharacter) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3827 pPlayers[uActiveCharacter]->PlaySound(SPEECH_63, 0); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3828 break; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3829 |
2160 | 3830 case PARTY_LookDown://смотреть вниз |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3831 _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3832 if ( _angle_x < -128 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3833 _angle_x = -128; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3834 if (uActiveCharacter) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3835 pPlayers[uActiveCharacter]->PlaySound(SPEECH_64, 0); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3836 break; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3837 |
2160 | 3838 case PARTY_Jump://прыжок |
3839 if ( (!partyAtHighSlope || bmodel_standing_on_pid) && !hovering && pParty->field_24 && !(pParty->uFlags & 4) && !(pParty->uFlags & 0x200) ) | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3840 { |
2085 | 3841 //v126 = pParty->field_24 << 6; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3842 hovering = true; |
2163 | 3843 fall_speed = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)fall_speed); |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3844 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3845 break; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3846 |
2160 | 3847 case PARTY_Land://приземление(клавиша Home) |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3848 if (pParty->bFlying) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3849 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3850 pParty->uFlags |= PARTY_FLAGS_1_LANDING; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3851 pParty->uFallSpeed = 0; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3852 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3853 pParty->bFlying = false; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3854 pPartyActionQueue->uNumActions = 0; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3855 break; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3856 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3857 default: |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3858 assert(false); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3859 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3860 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3861 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3862 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3863 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3864 pParty->sRotationY = _angle_y; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3865 pParty->sRotationX = _angle_x; |
2167 | 3866 //------------------------------------------- |
3867 if ( pParty->bFlying ) | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3868 { |
2167 | 3869 v129 = fixpoint_mul(4, stru_5C6E00->Cos(GetTickCount())); |
3870 pZ = v113 + v129; | |
3871 if ( pModel_ ) | |
3872 pZ = v113; //взлетание выше | |
3873 if (pParty->FlyActive()) | |
3874 stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &= 0xFE; | |
3875 pParty->uFallStartY = pZ; | |
3876 } | |
3877 else if ( pZ < v111 )// подъём в горку | |
3878 { | |
3879 if ( is_on_water && fall_speed ) | |
3880 sub_42F960_create_object(pX, pY, v111); | |
3881 fall_speed = 0; | |
3882 pZ = v111; | |
3883 pParty->uFallStartY = v111; | |
3884 v113 = pZ; | |
3885 if (pParty->FlyActive()) | |
3886 stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1; | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3887 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3888 else |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3889 { |
2148 | 3890 v113 = pZ; |
3891 if (pParty->FlyActive()) | |
3892 stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1; | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3893 } |
2167 | 3894 //------------------------------------------ |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3895 if (hovering && !pParty->bFlying)//расчёт скорости падения |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3896 { |
2167 | 3897 //v33 = -(pEventTimer->uTimeElapsed * GetGravityStrength()); |
3898 v34 = fall_speed + 2 * -(pEventTimer->uTimeElapsed * GetGravityStrength()); | |
3899 fall_speed += 2 * -(pEventTimer->uTimeElapsed * GetGravityStrength()); | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3900 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3901 else if (!partyAtHighSlope) |
2163 | 3902 v34 = fall_speed; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3903 else if (!hovering) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3904 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3905 if ( !bmodel_standing_on_pid ) |
2148 | 3906 { |
2167 | 3907 // rolling down the hill |
3908 // how it's done: you get a little bit pushed in the air along terrain normal, getting in the air | |
3909 // and falling to the gravity, gradually sliding downwards. nice trick | |
3910 pZ = v111; | |
3911 ODM_GetTerrainNormalAt(pX, pY, &v98); | |
3912 v35 = fall_speed + (8 * -(pEventTimer->uTimeElapsed * GetGravityStrength())); | |
3913 v129 = abs(v2 * v98.x + v1 * v98.y + v35 * v98.z) >> 16; | |
3914 v2 += fixpoint_mul(v129, v98.x); | |
3915 v1 += fixpoint_mul(v129, v98.y); | |
3916 v34 = v35 + fixpoint_mul(v129, v98.z); | |
3917 v128 = v1; | |
3918 fall_speed = v34; | |
2148 | 3919 } |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3920 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3921 else |
2163 | 3922 v34 = fall_speed; |
2148 | 3923 |
2167 | 3924 if ( hovering )//блок для крика падения |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3925 { |
2167 | 3926 if ( !bUnderwater && v34 <= 0) |
3927 { | |
3928 if ( v34 < -500 && !pParty->bFlying && pParty->vPosition.z - v111 > 1000 && !pParty->FeatherFallActive()) | |
3929 { // falling scream | |
3930 for (int i = 0; i < 4; ++i) | |
3931 { | |
3932 if (!pParty->pPlayers[i].HasEnchantedItemEquipped(72) | |
3933 && !pParty->pPlayers[i].WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) | |
3934 && pParty->pPlayers[i].CanAct()) | |
3935 pParty->pPlayers[i].PlaySound(SPEECH_Falling_scream, 0);//крик падения | |
3936 } | |
3937 } | |
3938 } | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3939 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3940 else |
2084 | 3941 pParty->uFallStartY = pZ; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3942 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3943 if ( v2 * v2 + v1 * v1 < 400 && !partyAtHighSlope ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3944 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3945 *(float *)&v128 = 0.0; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3946 v2 = 0; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3947 } |
2167 | 3948 //--(столкновения)------------------------------------------------------------------- |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3949 stru_721530.field_84 = -1; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3950 stru_721530.field_70 = 0; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3951 stru_721530.prolly_normal_d = pParty->field_14_radius; |
2156 | 3952 stru_721530.field_8_radius = pParty->field_14_radius / 2; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3953 stru_721530.field_0 = 1; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3954 stru_721530.height = pParty->uPartyHeight - 32; |
2085 | 3955 for ( uint i = 0; i < 100; i++ ) |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3956 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3957 stru_721530.position.x = pX; |
2085 | 3958 stru_721530.position.y = pY; |
3959 stru_721530.position.z = stru_721530.height + pZ + 1; | |
3960 | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3961 stru_721530.normal.x = pX; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3962 stru_721530.normal.y = pY; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3963 stru_721530.normal.z = stru_721530.prolly_normal_d + pZ + 1; |
2085 | 3964 |
3965 stru_721530.velocity.x = v2; | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3966 stru_721530.velocity.y = v128; |
2163 | 3967 stru_721530.velocity.z = fall_speed; |
2085 | 3968 |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3969 stru_721530.uSectorID = 0; |
2085 | 3970 v36 = 0; |
3971 if ( pParty->bTurnBasedModeOn == true && pTurnEngine->turn_stage == 3 ) | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3972 v36 = 13312; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3973 if ( stru_721530._47050A(v36) ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3974 break; |
2084 | 3975 _46E889_collide_against_bmodels(1); |
2101 | 3976 //v37 = WorldPosToGridCellZ(pParty->vPosition.y); |
3977 //v38 = WorldPosToGridCellX(pParty->vPosition.x); | |
3978 _46E26D_collide_against_sprites(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y)); | |
2085 | 3979 _46ED8A_collide_against_sprite_objects(4); |
2163 | 3980 for ( uint actor_id = 0; actor_id < (signed int)uNumActors; ++actor_id ) |
3981 Actor::_46DF1A_collide_against_actor(actor_id, 0); | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3982 if ( stru_721530.field_7C >= stru_721530.field_6C ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3983 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3984 _angle_x = stru_721530.normal2.x; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3985 _angle_y = stru_721530.normal2.y; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3986 v40 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3987 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3988 else |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3989 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3990 _angle_x = pX + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3991 _angle_y = pY + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y); |
2167 | 3992 //pModel = (BSPModel *)fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z); |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3993 v40 = fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z) + pZ; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3994 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3995 v122 = v40; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3996 ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3997 v129 = ODM_GetFloorLevel(_angle_x, pY, v40, pParty->uPartyHeight, &is_on_water, &v97, 0); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
3998 int v119 = ODM_GetFloorLevel(pX, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &v110, 0); |
2167 | 3999 bool v42_ = (BSPModel *)IsTerrainSlopeTooHigh(_angle_x, pY); |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4000 v42 = IsTerrainSlopeTooHigh(pX, _angle_y); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4001 is_not_on_bmodel = false; |
2085 | 4002 //v118 = v42; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4003 if ( !v97 && !v110 && !bmodel_standing_on_pid ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4004 is_not_on_bmodel = true; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4005 v43 = 1; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4006 v44 = 1; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4007 if ( bUnderwater || !is_not_on_bmodel ) |
2085 | 4008 { |
4009 pX = _angle_x; | |
4010 if ( v43 ) | |
4011 pY = _angle_y; | |
4012 } | |
4013 else | |
4014 { | |
2167 | 4015 if ( v42_ && v129 > pZ ) |
2085 | 4016 v44 = 0; |
4017 if ( v42 && v119 > pZ ) | |
4018 v43 = 0; | |
4019 if ( v44 ) | |
4020 { | |
4021 pX = _angle_x; | |
4022 if ( v43 ) | |
4023 pY = _angle_y; | |
4024 } | |
4025 else if ( v43 ) | |
4026 pY = _angle_y; | |
4027 else | |
4028 { | |
2167 | 4029 int new_ = ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0); |
4030 if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && new_ <= pZ ) | |
2085 | 4031 { |
4032 v43 = 1; | |
4033 pX = _angle_x; | |
4034 if ( v43 ) | |
4035 pY = _angle_y; | |
4036 } | |
4037 } | |
4038 } | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4039 if ( stru_721530.field_7C >= stru_721530.field_6C ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4040 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4041 if ( !is_not_on_bmodel ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4042 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4043 pX = stru_721530.normal2.x; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4044 pY = stru_721530.normal2.y; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4045 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4046 pZ = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4047 break; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4048 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4049 stru_721530.field_70 += stru_721530.field_7C; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4050 pX = _angle_x; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4051 pY = _angle_y; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4052 v45 = stru_721530.uFaceID; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4053 pZ = v40; |
2164 | 4054 |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4055 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4056 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4057 if (pParty->Invisible()) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4058 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4059 viewparams->bRedrawGameUI = true; |
2085 | 4060 } |
2164 | 4061 |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4062 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4063 { |
2085 | 4064 v129 = stru_5C6E00->Atan2(_angle_x - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.x, |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4065 _angle_y - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.y); |
2164 | 4066 v2 = fixpoint_mul(stru_5C6E00->Cos(v129), integer_sqrt(v2 * v2 + v128 * v128)); |
4067 v122 = fixpoint_mul(stru_5C6E00->Sin(v129), integer_sqrt(v2 * v2 + v128 * v128)); | |
4068 v128 = fixpoint_mul(stru_5C6E00->Sin(v129), integer_sqrt(v2 * v2 + v128 * v128)); | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4069 } |
2164 | 4070 |
4071 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel) | |
4072 { | |
4073 pParty->bFlying = false; | |
4074 pModel = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9]; | |
4075 pODMFace = &pModel->pFaces[((signed int)stru_721530.uFaceID >> 3) & 0x3F]; | |
4076 v48 = pODMFace->pBoundingBox.z2 - pODMFace->pBoundingBox.z1; | |
4077 v129 = v48 <= 32; | |
4078 v119 = pODMFace->pFacePlane.vNormal.z < 46378; | |
4079 if ( bUnderwater == 1 ) | |
4080 v119 = 0; | |
4081 if ( pODMFace->uPolygonType == POLYGON_Floor ) | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4082 { |
2164 | 4083 if ( fall_speed < 0 ) |
4084 fall_speed = 0; | |
4085 pZ = pModel->pVertices.pVertices[pODMFace->pVertexIDs[0]].z + 1; | |
4086 if ( v2 * v2 + v128 * v128 < 400 ) | |
4087 { | |
4088 v2 = 0; | |
4089 *(float *)&v128 = 0.0; | |
4090 } | |
4091 if ( pParty->floor_face_pid != v45 && pODMFace->Pressure_Plate() ) | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4092 { |
2164 | 4093 pParty->floor_face_pid = v45; |
4094 trigger_id = pODMFace->sCogTriggeredID; | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4095 } |
2164 | 4096 } |
4097 if ( !v129 && (pODMFace->uPolygonType != POLYGON_InBetweenFloorAndWall || v119) )// упёрся в столб | |
4098 { | |
4099 v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y + fall_speed * pODMFace->pFacePlane.vNormal.z | |
4100 + v2 * pODMFace->pFacePlane.vNormal.x) >> 16; | |
4101 if ((stru_721530.speed >> 3) > v118 ) | |
4102 v118 = stru_721530.speed >> 3; | |
4103 v2 += fixpoint_mul(v118, pODMFace->pFacePlane.vNormal.x); | |
4104 v128 += fixpoint_mul(v118, pODMFace->pFacePlane.vNormal.y); | |
4105 v54 = 0; | |
4106 if ( !v119 ) | |
4107 v54 = fixpoint_mul(v118, pODMFace->pFacePlane.vNormal.z); | |
4108 pParty->uFallSpeed += v54; | |
4109 v55 = stru_721530.prolly_normal_d - ((signed int)(pODMFace->pFacePlane.dist + v122 * pODMFace->pFacePlane.vNormal.z | |
4110 + _angle_y * pODMFace->pFacePlane.vNormal.y + _angle_x * pODMFace->pFacePlane.vNormal.x) >> 16); | |
4111 if ( v55 > 0 ) | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4112 { |
2164 | 4113 pX = _angle_x + fixpoint_mul(pODMFace->pFacePlane.vNormal.x, v55); |
4114 pY = _angle_y + fixpoint_mul(pODMFace->pFacePlane.vNormal.y, v55); | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4115 if ( !v119 ) |
2164 | 4116 pZ = v122 + fixpoint_mul(pODMFace->pFacePlane.vNormal.z, v55); |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4117 } |
2164 | 4118 if ( pParty->floor_face_pid != stru_721530.uFaceID && pODMFace->Pressure_Plate() ) |
4119 { | |
4120 pParty->floor_face_pid = stru_721530.uFaceID; | |
4121 trigger_id = pODMFace->sCogTriggeredID; // | |
4122 } | |
4123 } | |
4124 if ( pODMFace->uPolygonType == POLYGON_InBetweenFloorAndWall ) | |
4125 { | |
2085 | 4126 v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y |
2163 | 4127 + fall_speed * pODMFace->pFacePlane.vNormal.z + v2 * pODMFace->pFacePlane.vNormal.x) >> 16; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4128 if ((stru_721530.speed >> 3) > v118 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4129 v118 = stru_721530.speed >> 3; |
2164 | 4130 v2 += fixpoint_mul(v118, pODMFace->pFacePlane.vNormal.x); |
4131 v128 += fixpoint_mul(v118, pODMFace->pFacePlane.vNormal.y); | |
4132 fall_speed += fixpoint_mul(v118, pODMFace->pFacePlane.vNormal.z); | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4133 if ( v2 * v2 + v128 * v128 >= 400 ) |
2085 | 4134 { |
2092 | 4135 if ( pParty->floor_face_pid != stru_721530.uFaceID && pODMFace->Pressure_Plate() ) |
2085 | 4136 { |
4137 pParty->floor_face_pid = stru_721530.uFaceID; | |
2148 | 4138 trigger_id = pODMFace->sCogTriggeredID; // |
2085 | 4139 } |
2164 | 4140 } |
4141 else | |
4142 { | |
4143 v2 = 0; | |
4144 fall_speed = 0; | |
4145 *(float *)&v128 = 0.0; | |
2085 | 4146 } |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4147 } |
2164 | 4148 } |
2167 | 4149 v2 = fixpoint_mul(58500, v2); |
4150 v128 = fixpoint_mul(58500, v128); | |
4151 v122 = fixpoint_mul(58500, v122); | |
4152 fall_speed = fixpoint_mul(58500, fall_speed); | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4153 } |
2084 | 4154 |
4155 //Воспроизведение звуков ходьбы/бега------------------------ | |
2208 | 4156 uint pX_ = abs(pParty->vPosition.x - pX); |
2085 | 4157 uint pY_ = abs(pParty->vPosition.y - pY); |
2208 | 4158 uint pZ_ = abs(pParty->vPosition.z - pZ); |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4159 if ( bWalkSound && pParty->walk_sound_timer <= 0 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4160 { |
2084 | 4161 pAudioPlayer->_4AA258(804);//stop sound |
2208 | 4162 if ( party_running_flag && (!hovering || not_high_fall) ) |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4163 { |
2208 | 4164 if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) >= 16 ) |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4165 { |
2166 | 4166 if ( !is_not_on_bmodel && pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].Visible() ) |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4167 pAudioPlayer->PlaySound(SOUND_RunAlong3DModel, 804, 1, -1, 0, 0, 0, 0);//бег на 3D Modelи |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4168 else |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4169 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4170 v87 = pOutdoor->GetSoundIdByPosition(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1, 1); |
2199 | 4171 pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0);//бег по земле 56 |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4172 } |
2084 | 4173 pParty->walk_sound_timer = 96;//таймер для бега |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4174 } |
2082 | 4175 } |
2208 | 4176 else if( party_walking_flag && (!hovering || not_high_fall) ) |
2082 | 4177 { |
2208 | 4178 if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) >= 8 ) |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4179 { |
2166 | 4180 if ( !is_not_on_bmodel && pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].Visible() ) |
4181 pAudioPlayer->PlaySound(SOUND_WalkAlong3DModel, 804, 1, -1, 0, 0, 0, 0);// хождение на 3D Modelи | |
4182 else | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4183 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4184 v87 = pOutdoor->GetSoundIdByPosition(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1, 0); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4185 pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0);// хождение по земле |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4186 } |
2084 | 4187 pParty->walk_sound_timer = 144;//таймер для ходьбы |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4188 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4189 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4190 } |
2208 | 4191 if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) < 8 )//отключить звук ходьбы при остановке |
2084 | 4192 pAudioPlayer->_4AA258(804); |
4193 //------------------------------------------------------------------------ | |
2208 | 4194 if ( !hovering || !not_high_fall )// или не высокое падение |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4195 pParty->uFlags &= ~PARTY_FLAGS_1_FALLING; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4196 else |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4197 pParty->uFlags |= PARTY_FLAGS_1_FALLING; |
2085 | 4198 int pMap_X = WorldPosToGridCellX(pParty->vPosition.x); |
4199 int pMap_Y = WorldPosToGridCellZ(pParty->vPosition.y) - 1; | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4200 unsigned int v114_a = WorldPosToGridCellX(pX); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4201 v66 = WorldPosToGridCellZ(pY) - 1; |
2167 | 4202 unsigned int v122_a = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(pMap_X, pMap_Y) / 2) & 1; |
4203 v122 = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(v114_a, pMap_Y) / 2) & 1; | |
4204 v69 = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(pMap_X, v66) / 2) & 1; | |
4205 | |
4206 //-(обновление координат группы)--------------------------------------- | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4207 v68 = 0; |
2085 | 4208 if ( v114_a == pMap_X && v66 == pMap_Y && v122 && v69 ) |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4209 v68 = 1; |
2167 | 4210 if ( !is_not_on_bmodel ) // на bmodel,и |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4211 v68 = 1; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4212 if ( v68 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4213 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4214 pParty->vPosition.x = pX; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4215 pParty->vPosition.y = pY; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4216 pParty->vPosition.z = pZ; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4217 pParty->field_6F0 = v113; |
2163 | 4218 pParty->uFallSpeed = fall_speed; |
2167 | 4219 if ( pZ > 8160 ) //ограничение высоты |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4220 { |
2085 | 4221 pZ = 8160; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4222 pParty->uFallStartY = 8160; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4223 pParty->vPosition.z = 8160; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4224 } |
2167 | 4225 |
2148 | 4226 if ( !trigger_id //падение на землю |
4227 || (EventProcessor(trigger_id, 0, 1), | |
4228 pParty->vPosition.x == pX) | |
2085 | 4229 && pParty->vPosition.y == pY |
4230 && pParty->vPosition.z == pZ ) | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4231 { |
2085 | 4232 if ( pParty->vPosition.z < v111 ) |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4233 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4234 pParty->uFallSpeed = 0; |
2085 | 4235 //v73 = v105; |
2148 | 4236 pParty->vPosition.z = on_ground; |
4237 if ( pParty->uFallStartY - pZ > 512 && !bFeatherFall && pZ <= on_ground && !bUnderwater )//Fall to the ground(падение на землю с высоты) | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4238 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4239 if ( pParty->uFlags & PARTY_FLAGS_1_LANDING ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4240 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4241 else |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4242 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4243 for ( uint i = 1; i <= 4; ++i ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4244 { |
2112 | 4245 pPlayers[i]->ReceiveDamage((signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(signed __int64)((double)pPlayers[i]->GetMaxHealth() * 0.1)) / 256, |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4246 DMGT_PHISYCAL); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4247 v110 = 20 - pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualEndurance()); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4248 pPlayers[i]->SetRecoveryTime((signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4249 } |
2085 | 4250 //v73 = pParty->vPosition.z; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4251 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4252 } |
2085 | 4253 pParty->uFallStartY = pZ; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4254 } |
2085 | 4255 if ( v102 && pParty->vPosition.z < ceiling_height ) |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4256 { |
2085 | 4257 if ( (signed int)(pParty->uPartyHeight + pParty->vPosition.z) >= ceiling_height ) |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4258 { |
2085 | 4259 pParty->vPosition.z = ceiling_height - pParty->uPartyHeight - 1; |
4260 pParty->field_6F0 = ceiling_height - pParty->uPartyHeight - 1; | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4261 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4262 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4263 pParty->uFlags &= ~0x204; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4264 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4265 return; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4266 } |
2167 | 4267 //----------------------------------------------------------------- |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4268 //v76 = pParty->bFlying; |
2208 | 4269 if ( pParty->bFlying || !not_high_fall || bWaterWalk || !v122_a )// полёт или высокое падение или хождение по воде или |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4270 v77 = 1; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4271 else |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4272 v77 = v122 != 0; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4273 bool party_drowning_flag = false; |
2208 | 4274 if ( !pParty->bFlying && not_high_fall && !bWaterWalk ) //не полёт и не высокое падение и не хождение по воде |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4275 { |
2167 | 4276 if ( v122_a ) |
2085 | 4277 v78 = v69 != 0; |
4278 else | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4279 { |
2167 | 4280 party_drowning_flag = true;//утопление |
2085 | 4281 v78 = true; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4282 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4283 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4284 else |
2085 | 4285 v78 = true; |
2084 | 4286 |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4287 if ( v77 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4288 pParty->vPosition.x = pX; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4289 if ( v78 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4290 pParty->vPosition.y = pY; |
2084 | 4291 |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4292 if ( v78 || v77) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4293 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4294 if ( bWaterWalk ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4295 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4296 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4297 //v79 = 20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 6180178; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4298 //*(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1u; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4299 v79 = (int)&stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119]; |
2167 | 4300 *(short *)v79 |= 1; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4301 if ( !v122 || !v69 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4302 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4303 if ( !pParty->bFlying ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4304 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4305 v80 = *(short *)v79; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4306 pParty->uFlags |= PARTY_FLAGS_1_STANDING_ON_WATER; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4307 *(short *)v79 = v80 & 0xFFFE; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4308 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4309 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4310 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4311 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4312 else if ( bWalkSound && pParty->walk_sound_timer <= 0 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4313 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4314 pAudioPlayer->_4AA258(804); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4315 pParty->walk_sound_timer = 64; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4316 } |
2084 | 4317 |
2148 | 4318 //v81 = pZ; |
4319 //v82 = pZ; | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4320 pParty->vPosition.z = pZ; |
2167 | 4321 if ( pZ > 8160 )//опять ограничение высоты |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4322 { |
2148 | 4323 //v82 = 8160; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4324 pParty->uFallStartY = 8160; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4325 pParty->vPosition.z = 8160; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4326 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4327 LOWORD(pParty->uFlags) &= 0xFDFBu; |
2163 | 4328 pParty->uFallSpeed = fall_speed; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4329 pParty->field_6F0 = v113; |
2167 | 4330 if ( party_drowning_flag )//группа тонет |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4331 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4332 pTerrainHeight = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v110, 1); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4333 if ( pParty->vPosition.z <= pTerrainHeight + 1 )//положение группы всегда +1 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4334 pParty->uFlags |= PARTY_FLAGS_1_WATER_DAMAGE; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4335 } |
2084 | 4336 |
2148 | 4337 if ( !trigger_id//падение на воду |
4338 || (EventProcessor(trigger_id, 0, 1), | |
4339 pParty->vPosition.x == pX) | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4340 && pParty->vPosition.y == pY |
2148 | 4341 && pParty->vPosition.z == pZ ) |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4342 { |
2085 | 4343 if ( pParty->vPosition.z < v111 ) |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4344 { |
2148 | 4345 //v82 = on_ground; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4346 pParty->uFallSpeed = 0; |
2148 | 4347 pParty->vPosition.z = on_ground; |
4348 if ( pParty->uFallStartY - pZ > 512 && !bFeatherFall && pZ <= on_ground && !bUnderwater )//Fall to the water(падение на воду с высоты) | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4349 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4350 if ( pParty->uFlags & PARTY_FLAGS_1_LANDING ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4351 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4352 else |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4353 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4354 for ( uint i = 1; i <= 4; ++i ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4355 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4356 v110 = pPlayers[i]->GetMaxHealth(); |
2148 | 4357 pPlayers[i]->ReceiveDamage((signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(signed __int64)((double)v110 * 0.1)) / 256, |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4358 DMGT_PHISYCAL); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4359 v110 = 20 - pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualEndurance()); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4360 pPlayers[i]->SetRecoveryTime((signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4361 } |
2148 | 4362 //v82 = pParty->vPosition.z; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4363 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4364 } |
2148 | 4365 pParty->uFallStartY = pZ; |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4366 } |
2148 | 4367 if ( v102 && pParty->vPosition.z < ceiling_height && (signed int)(pParty->uPartyHeight + pParty->vPosition.z) >= ceiling_height ) |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4368 { |
2148 | 4369 pParty->vPosition.z = pParty->vPosition.z + pParty->uPartyHeight - ceiling_height + 1; |
4370 pParty->field_6F0 = pParty->vPosition.z + pParty->uPartyHeight - ceiling_height + 1; | |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4371 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4372 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4373 } |
2156 | 4374 |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4375 //----- (0046D8E3) -------------------------------------------------------- |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4376 int GetCeilingHeight(int Party_X, signed int Party_Y, int Party_ZHeight, int pFaceID) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4377 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4378 signed int v13; // eax@25 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4379 int v14; // edx@27 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4380 int v16; // ST18_4@29 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4381 signed int v17; // edx@29 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4382 signed __int64 v18; // qtt@29 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4383 int v19; // eax@35 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4384 signed int v20; // ecx@37 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4385 signed int v22; // ebx@42 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4386 int v24; // edx@44 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4387 int v25; // eax@44 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4388 int v27; // [sp+10h] [bp-34h]@21 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4389 bool v34; // [sp+30h] [bp-14h]@21 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4390 bool v35; // [sp+34h] [bp-10h]@23 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4391 signed int v37; // [sp+38h] [bp-Ch]@21 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4392 signed int v38; // [sp+38h] [bp-Ch]@42 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4393 signed int v39; // [sp+3Ch] [bp-8h]@1 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4394 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4395 dword_720ED0[0] = -1; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4396 dword_720E80[0] = -1; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4397 v39 = 1; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4398 ceiling_height_level[0] = 10000;//нет потолка |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4399 for ( uint i = 0; i < (signed int)pOutdoor->uNumBModels; ++i ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4400 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4401 if ( Party_X <= pOutdoor->pBModels[i].sMaxX && Party_X >= pOutdoor->pBModels[i].sMinX |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4402 && Party_Y <= pOutdoor->pBModels[i].sMaxY && Party_Y >= pOutdoor->pBModels[i].sMinY ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4403 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4404 for ( uint j = 0; j < pOutdoor->pBModels[i].uNumFaces; ++j ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4405 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4406 if ( (pOutdoor->pBModels[i].pFaces[j].uPolygonType == POLYGON_Ceiling |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4407 || pOutdoor->pBModels[i].pFaces[j].uPolygonType == POLYGON_InBetweenCeilingAndWall) |
2166 | 4408 && !pOutdoor->pBModels[i].pFaces[j].Ethereal() |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4409 && Party_X <= pOutdoor->pBModels[i].pFaces[j].pBoundingBox.x2 && Party_X >= pOutdoor->pBModels[i].pFaces[j].pBoundingBox.x1 |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4410 && Party_Y <= pOutdoor->pBModels[i].pFaces[j].pBoundingBox.y2 && Party_Y >= pOutdoor->pBModels[i].pFaces[j].pBoundingBox.y1 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4411 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4412 for ( uint v = 0; v < pOutdoor->pBModels[i].pFaces[j].uNumVertices; v++ ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4413 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4414 word_720DB0_xs[2 * v] = pOutdoor->pBModels[i].pFaces[j].pXInterceptDisplacements[v] + LOWORD(pOutdoor->pBModels[i].pVertices.pVertices[pOutdoor->pBModels[i].pFaces[j].pVertexIDs[v]].x); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4415 word_720CE0_ys[2 * v] = pOutdoor->pBModels[i].pFaces[j].pXInterceptDisplacements[v] + LOWORD(pOutdoor->pBModels[i].pVertices.pVertices[pOutdoor->pBModels[i].pFaces[j].pVertexIDs[v]].y); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4416 word_720DB0_xs[2 * v + 1] = pOutdoor->pBModels[i].pFaces[j].pXInterceptDisplacements[v] + LOWORD(pOutdoor->pBModels[i].pVertices.pVertices[pOutdoor->pBModels[i].pFaces[j].pVertexIDs[v + 1]].x); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4417 word_720CE0_ys[2 * v + 1] = pOutdoor->pBModels[i].pFaces[j].pXInterceptDisplacements[v] + LOWORD(pOutdoor->pBModels[i].pVertices.pVertices[pOutdoor->pBModels[i].pFaces[j].pVertexIDs[v + 1]].y); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4418 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4419 v27 = 2 * pOutdoor->pBModels[i].pFaces[j].uNumVertices; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4420 word_720DB0_xs[2 * pOutdoor->pBModels[i].pFaces[j].uNumVertices] = word_720DB0_xs[0]; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4421 word_720CE0_ys[2 * pOutdoor->pBModels[i].pFaces[j].uNumVertices] = word_720CE0_ys[0]; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4422 v34 = word_720CE0_ys[0] >= Party_Y; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4423 v37 = 0; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4424 for ( uint v = 0; v < v27; ++v ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4425 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4426 if ( v37 >= 2 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4427 break; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4428 v35 = word_720CE0_ys[v + 1] >= Party_Y; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4429 if ( v34 != v35 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4430 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4431 v13 = word_720DB0_xs[v + 1] >= Party_X ? 0 : 2; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4432 v14 = v13 | (word_720DB0_xs[v] < Party_X); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4433 if ( v14 != 3 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4434 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4435 if ( !v14 || ( v16 = word_720CE0_ys[v + 1] - word_720CE0_ys[v], |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4436 v17 = Party_Y - word_720CE0_ys[v], |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4437 LODWORD(v18) = v17 << 16, |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4438 HIDWORD(v18) = v17 >> 16, |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4439 (signed int)(((unsigned __int64)(((signed int)word_720DB0_xs[v + 1] |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4440 - (signed int)word_720DB0_xs[v]) * v18 / v16) >> 16) + word_720DB0_xs[v]) >= Party_X) ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4441 ++v37; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4442 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4443 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4444 v34 = v35; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4445 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4446 if ( v37 == 1 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4447 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4448 if ( v39 >= 20 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4449 break; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4450 if ( pOutdoor->pBModels[i].pFaces[j].uPolygonType == POLYGON_Ceiling ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4451 v19 = pOutdoor->pBModels[i].pVertices.pVertices[pOutdoor->pBModels[i].pFaces[j].pVertexIDs[0]].z; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4452 else |
2207 | 4453 v19 = fixpoint_mul(pOutdoor->pBModels[i].pFaces[j].zCalc1, Party_X) + fixpoint_mul(pOutdoor->pBModels[i].pFaces[j].zCalc2, Party_Y) |
2043
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4454 + HIWORD(pOutdoor->pBModels[i].pFaces[j].zCalc3); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4455 v20 = v39++; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4456 ceiling_height_level[v20] = v19; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4457 dword_720ED0[v20] = i; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4458 dword_720E80[v20] = j; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4459 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4460 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4461 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4462 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4463 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4464 if ( !v39 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4465 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4466 pFaceID = 0; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4467 return ceiling_height_level[0]; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4468 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4469 v22 = 0; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4470 for ( v38 = 0; v38 < v39; ++v38 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4471 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4472 if ( ceiling_height_level[v38] == ceiling_height_level[0] ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4473 v22 = v38; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4474 else if ( ceiling_height_level[v38] < ceiling_height_level[0] && ceiling_height_level[0] > Party_ZHeight + 15 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4475 v22 = v38; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4476 else if ( ceiling_height_level[v38] > ceiling_height_level[0] && ceiling_height_level[v38] <= Party_ZHeight + 15 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4477 v22 = v38; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4478 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4479 if ( v22 ) |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4480 { |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4481 *(int *)pFaceID = dword_720E80[v22] | (dword_720ED0[v22] << 6); |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4482 return ceiling_height_level[v22];//если есть преграда |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4483 } |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4484 pFaceID = 0; |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4485 return ceiling_height_level[v22];// нет никакой преграды |
2ccf638342d6
int max_flight_height and GetCeilingHeight function
Ritor1
parents:
2037
diff
changeset
|
4486 } |