Mercurial > mm7
annotate Outdoor.cpp @ 1391:cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
stru148 -> struct Polygon
author | Nomad |
---|---|
date | Thu, 18 Jul 2013 14:42:54 +0200 |
parents | 9749edd941c6 |
children | 38df78aba732 |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1141
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1141
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1141
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1141
diff
changeset
|
4 |
0 | 5 #include <assert.h> |
6 | |
1016 | 7 #include "stru6.h" |
1323 | 8 #include "Weather.h" |
1016 | 9 #include "Sprites.h" |
10 #include "LightmapBuilder.h" | |
0 | 11 #include "Outdoor.h" |
1277 | 12 #include "Outdoor_stuff.h" |
0 | 13 #include "Party.h" |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
14 #include "SpriteObject.h" |
0 | 15 #include "LOD.h" |
16 #include "Allocator.h" | |
17 #include "PaletteManager.h" | |
18 #include "GUIProgressBar.h" | |
19 #include "AudioPlayer.h" | |
20 #include "IndoorCamera.h" | |
21 #include "DecorationList.h" | |
22 #include "Math.h" | |
23 #include "ObjectList.h" | |
24 #include "Game.h" | |
25 #include "Actor.h" | |
26 #include "Chest.h" | |
27 #include "stru123.h" | |
28 #include "Time.h" | |
29 #include "Viewport.h" | |
30 #include "Events.h" | |
31 | |
32 #include "mm7_data.h" | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
813
diff
changeset
|
33 #include "MM7.h" |
1262 | 34 #include "Lights.h" |
0 | 35 |
36 | |
1016 | 37 #include "MapInfo.h" |
38 #include "OutdoorCamera.h" | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
39 #include "Outdoor_stuff.h" |
1016 | 40 #include "BSPModel.h" |
1297 | 41 #include "GUIWindow.h" |
0 | 42 |
783 | 43 MapStartPoint uLevel_StartingPointType; // weak |
44 | |
0 | 45 OutdoorLocation *pOutdoor = new OutdoorLocation; |
46 OutdoorCamera *pOutdoorCamera; | |
47 | |
48 | |
49 stru149 stru_8019C8; | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
50 std::array<struct Polygon, 2000 + 18000> array_77EC08; |
0 | 51 Surf stru_80C980; |
52 Edge defaultEdge; // weak | |
53 Edge stru_80C9A4; | |
54 Edge stru_80C9D8; | |
55 | |
767 | 56 |
57 struct FogProbabilityTableEntry | |
58 { | |
59 unsigned char small_fog_chance; | |
60 unsigned char average_fog_chance; | |
61 unsigned char dense_fog_chance; | |
62 unsigned char __unused; | |
63 } fog_probability_table[15] = | |
64 { | |
65 { 20, 10, 5, 0}, // MAP_EMERALD_ISLE | |
66 { 20, 10, 5, 0}, // MAP_HARMONDALE | |
67 { 20, 10, 5, 0}, // MAP_STEADWICK | |
68 { 20, 10, 5, 0}, // MAP_PIERPONT | |
69 { 20, 10, 5, 0}, // MAP_DEYJA | |
70 { 10, 5, 0, 0}, // MAP_BRAKADA_DESERT | |
71 { 0, 0, 0, 0}, // MAP_CELESTIA | |
72 { 0, 0, 0, 0}, // MAP_THE_PIT | |
73 { 20, 30, 50, 0}, // MAP_EVENMORN_ISLE | |
74 { 30, 20, 10, 0}, // MAP_MOUNT_NIGHON | |
75 { 10, 5, 0, 0}, // MAP_BARROW_DOWNS | |
76 { 20, 10, 5, 0}, // MAP_LAND_OF_GIANTS | |
77 { 20, 10, 5, 0}, // MAP_TATALIA | |
78 { 20, 10, 5, 0}, // MAP_AVLEE | |
79 { 0, 100, 0, 0} // MAP_SHOALS | |
80 }; | |
81 | |
760 | 82 //for future sky textures? |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
83 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
|
84 std::array<int, 7> dword_4EC28C={{3,3,3,3,3,3,3}}; // weak |
760 | 85 int dword_4EC2A8=9; // weak |
86 int dword_4EC2AC=7; // weak | |
630 | 87 |
88 | |
89 | |
0 | 90 //----- (0047A59E) -------------------------------------------------------- |
91 void OutdoorLocation::ExecDraw(unsigned int bRedraw) | |
92 { | |
121 | 93 //unsigned int v2; // ebx@1 |
0 | 94 int v3; // ST18_4@3 |
95 int v4; // ST04_4@19 | |
96 int v5; // eax@19 | |
97 | |
186 | 98 pIndoorCamera->flags = 0; |
99 if (viewparams->draw_d3d_outlines) | |
100 pIndoorCamera->flags |= INDOOR_CAMERA_DRAW_D3D_OUTLINES; | |
791 | 101 //INDOOR_CAMERA_DRAW_TERRAIN_OUTLINES |
186 | 102 |
0 | 103 pIndoorCamera->sRotationX = pParty->sRotationX; |
104 pIndoorCamera->sRotationY = pParty->sRotationY; | |
871 | 105 pIndoorCamera->pos.x = pParty->vPosition.x - fixpoint_sub0(stru_5C6E00->Cos(pParty->sRotationY), pParty->y_rotation_granularity); |
106 pIndoorCamera->pos.y = pParty->vPosition.y - fixpoint_sub0(stru_5C6E00->Sin(pParty->sRotationY), pParty->y_rotation_granularity); | |
0 | 107 pIndoorCamera->pos.z = pParty->vPosition.z + pParty->sEyelevel; |
121 | 108 if (bRedraw || pRenderer->pRenderD3D) |
0 | 109 { |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
110 ResetPolygons(); |
0 | 111 pOutdoorCamera->RotationToInts(); |
112 sub_481ED9_MessWithOutdoorCamera(); | |
113 } | |
762 | 114 |
0 | 115 pIndoorCamera->uMapGridCellX = WorldPosToGridCellX(pParty->vPosition.x); |
116 pIndoorCamera->uMapGridCellZ = WorldPosToGridCellZ(pParty->vPosition.y); | |
762 | 117 assert(pIndoorCamera->uMapGridCellX <= 127 && pIndoorCamera->uMapGridCellZ <= 127); |
118 | |
121 | 119 if (bRedraw) |
0 | 120 { |
121 Software_ResetNewEdges(); | |
122 sub_487DA9(); | |
123 ptr_80C97C_Surfs = pSurfs; | |
124 ptr_80C978_Edges = pEdges; | |
125 } | |
126 if ( pParty->uCurrentMinute != pOutdoor->uLastSunlightUpdateMinute ) | |
127 pOutdoor->UpdateSunlightVectors(); | |
128 pOutdoor->UpdateFog(); | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
129 //pGame->pIndoorCameraD3D->sr_Reset_list_0037C(); |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
130 |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
131 if (pRenderer->pRenderD3D) // d3d - redraw always |
0 | 132 { |
133 pRenderer->DrawSkyD3D(); | |
134 pRenderer->DrawBuildingsD3D(); | |
985 | 135 pRenderer->RenderTerrainD3D(); |
0 | 136 } |
83 | 137 else |
138 { | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
139 __debugbreak(); // no SW Rendering |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
140 /*if (!bRedraw) |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
141 pRenderer->OnOutdoorRedrawSW(); |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
142 else |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
143 { |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
144 pRenderer->DrawBuildingsSW(); |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
145 pRenderer->DrawBezierTerrain(); |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
146 sr_sub_486F92_MessWithEdgesAndSpans(); |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
147 pOutdoorCamera->_487355(); |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
148 }*/ |
83 | 149 } |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
150 |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
151 |
0 | 152 pMobileLightsStack->uNumLightsActive = 0; |
153 pStationaryLightsStack->uNumLightsActive = 0; | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
154 /*if ( !pRenderer->pRenderD3D ) |
0 | 155 { |
156 pRenderer->ExecOutdoorDrawSW(); | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
157 pGame->pIndoorCameraD3D->sr_438240_draw_lits(); |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
158 }*/ |
0 | 159 pGame->PushStationaryLights(-1); |
160 pGame->PrepareBloodsplats(); | |
121 | 161 if (bRedraw) |
0 | 162 { |
163 v4 = WorldPosToGridCellZ(pParty->vPosition.y); | |
164 v5 = WorldPosToGridCellX(pParty->vPosition.x); | |
752 | 165 pOutdoor->UpdateDiscoveredArea(v5, v4, 1); |
0 | 166 } |
167 pGame->uFlags2 &= 0xFFFFFFFEu; | |
142 | 168 if (pRenderer->pRenderD3D && pRenderer->bUsingSpecular) |
0 | 169 pGame->pLightmapBuilder->uFlags |= 1u; |
170 else | |
171 pGame->pLightmapBuilder->uFlags &= 0xFFFFFFFEu; | |
142 | 172 |
0 | 173 uNumDecorationsDrawnThisFrame = 0; |
174 _unused000 = 0; | |
175 uNumSpritesDrawnThisFrame = 0; | |
176 uNumBillboardsToDraw = 0; | |
142 | 177 |
432 | 178 PrepareActorsDrawList(); |
142 | 179 if (!pOutdoorCamera->bDoNotRenderDecorations) |
432 | 180 pRenderer->PrepareDecorationsRenderList_ODM(); |
142 | 181 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
182 pRenderer->DrawSpriteObjects_ODM(); |
161 | 183 pRenderer->TransformBillboardsAndSetPalettesODM(); |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
184 //sr_485F53((Vec2_int_ *)sr_6BE060.data()); |
0 | 185 } |
186 | |
187 | |
188 //----- (00441CFF) -------------------------------------------------------- | |
189 void OutdoorLocation::Draw() | |
190 { | |
121 | 191 bool redrawWorld = true; |
192 if ( !(pParty->uFlags & 2) && !(pGame->uFlags2 & 1) ) | |
193 redrawWorld = false; | |
194 pOutdoor->ExecDraw(redrawWorld); | |
0 | 195 |
196 pGame->DrawParticles(); | |
197 pWeather->Draw(); | |
198 array_5118E8._440F07(); | |
199 } | |
200 | |
201 //----- (00488E23) -------------------------------------------------------- | |
202 double OutdoorLocation::GetFogDensityByTime() | |
203 { | |
204 int v1; // eax@3 | |
205 double v2; // st7@3 | |
206 | |
207 if ( pParty->uCurrentHour < 5 ) | |
208 goto LABEL_9; | |
209 if ( pParty->uCurrentHour >= 6 ) | |
210 { | |
211 if ( pParty->uCurrentHour < 0x14 ) | |
212 { | |
750 | 213 pWeather->bNight = 0; |
0 | 214 v2 = 0.0; |
215 return v2 * 0.016666668; | |
216 } | |
217 if ( pParty->uCurrentHour < 0x15 ) | |
218 { | |
219 v1 = 0; | |
220 v2 = (double)(pParty->uCurrentHour - 20) * 60.0 + (double)(signed int)pParty->uCurrentMinute; | |
221 goto LABEL_4; | |
222 } | |
223 LABEL_9: | |
224 v2 = 60.0; | |
750 | 225 pWeather->bNight = 1; |
0 | 226 return v2 * 0.016666668; |
227 } | |
228 v1 = 0; | |
229 v2 = 60.0 - (double)(60 * pParty->uCurrentHour + pParty->uCurrentMinute - 300); | |
230 LABEL_4: | |
750 | 231 pWeather->bNight = v1; |
0 | 232 return v2 * 0.016666668; |
233 } | |
234 | |
235 //----- (00488EB1) -------------------------------------------------------- | |
236 int OutdoorLocation::GetSomeOtherTileInfo(int sX, int sY) | |
237 { | |
67 | 238 //OutdoorLocation *v3; // esi@1 |
0 | 239 unsigned int v4; // edi@1 |
240 unsigned int v5; // eax@1 | |
241 int result; // eax@5 | |
242 | |
67 | 243 /* v3 = this; |
0 | 244 v4 = WorldPosToGridCellZ(sY); |
245 v5 = WorldPosToGridCellX(sX); | |
246 if ( (v5 & 0x80000000u) != 0 || (signed int)v5 > 127 || (v4 & 0x80000000u) != 0 || (signed int)v4 > 127 ) | |
247 result = 0; | |
248 else | |
249 result = ActuallyGetSomeOtherTileInfo(v5, v4); | |
67 | 250 return result;*/ |
251 v4 = WorldPosToGridCellZ(sY); | |
252 v5 = WorldPosToGridCellX(sX); | |
253 if ( v5 < 0 || v5 > 127 || v4 < 0 || v4 > 127 ) | |
254 return 0; | |
255 return ActuallyGetSomeOtherTileInfo(v5, v4); | |
0 | 256 } |
257 // 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int); | |
258 // 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int); | |
259 | |
260 //----- (00488EEF) -------------------------------------------------------- | |
67 | 261 unsigned int OutdoorLocation::GetTileTexture(int sX, int sY) |
0 | 262 { |
67 | 263 //OutdoorLocation *v3; // esi@1 |
0 | 264 unsigned int v4; // edi@1 |
265 unsigned int v5; // eax@1 | |
67 | 266 // unsigned int result; // eax@5 |
0 | 267 |
67 | 268 /*v3 = this; |
0 | 269 v4 = WorldPosToGridCellZ(sZ); |
270 v5 = WorldPosToGridCellX(sX); | |
67 | 271 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 | 272 result = -1; |
273 else | |
274 result = DoGetTileTexture(v5, v4); | |
67 | 275 return result;*/ |
276 v4 = WorldPosToGridCellZ(sY); | |
277 v5 = WorldPosToGridCellX(sX); | |
278 if ( v5 < 0 || v5 > 127 || v4 < 0 || v4 > 127 ) | |
279 return -1; | |
280 return DoGetTileTexture(v5, v4); | |
0 | 281 } |
282 // 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int); | |
283 // 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int); | |
284 | |
285 //----- (00488F2E) -------------------------------------------------------- | |
286 int OutdoorLocation::GetHeightOnTerrain(int sX, int sZ) | |
49 | 287 /* Ôóíêöèÿ ïðåäîñòàâëÿåò âîçìîæíîñòü ïåðåìåùàòü êàìåðó òàêèì îáðàçîì, ÷òîáû îíà èìèòèðîâàëà õîäüáó ïî ëàíäøàôòó. |
288 Òî åñòü íàì íàäî ìåíÿòü âûñîòó êàìåðû (êîîðäèíàòó Y) â çàâèñèìîñòè îò òîãî, â êàêîì ìåñòå ëàíäøàôòà ìû íàõîäèìñÿ. | |
289 Äëÿ ýòîãî ìû ñíà÷àëà äîëæíû îïðåäåëèòü ïî êîîðäèíàòàì X è Z êàìåðû êâàäðàò ëàíäøàôòà â êîòîðîì ìû íàõîäèìñÿ. | |
290 Âñå ýòî äåëàåò ôóíêöèÿ Terrain::getHeight; â ñâîèõ ïàðàìåòðàõ îíà ïîëó÷àåò êîîðäèíàòû X è Z êàìåðû è âîçâðàùàåò âûñîòó, | |
291 íà êîòîðîé äîëæíà áûòü ðàñïîëîæåíà êàìåðà, ÷òîáû îíà îêàçàëàñü íàä ëàíäøàôòîì.*/ | |
0 | 292 { |
293 int result; // eax@5 | |
294 | |
295 if ( sX < 0 || sX > 127 || sZ < 0 || sZ > 127 ) | |
296 result = 0; | |
297 else | |
298 result = DoGetHeightOnTerrain(sX, sZ); | |
299 return result; | |
300 } | |
301 | |
302 //----- (00488F5C) -------------------------------------------------------- | |
303 bool OutdoorLocation::Initialize(const char *pFilename, int File, size_t uRespawnInterval, int thisa) | |
304 { | |
305 OutdoorLocation *v5; // esi@1 | |
306 bool result; // eax@2 | |
307 | |
308 v5 = this; | |
309 if ( pFilename ) | |
310 { | |
311 Release(); | |
312 pBitmaps_LOD->ReleaseAll2(); | |
313 pSprites_LOD->DeleteSomeOtherSprites(); | |
314 pSpriteFrameTable->ResetSomeSpriteFlags(); | |
315 pIcons_LOD->ReleaseAll2(); | |
316 sub_46080D(); | |
317 TryLoadLevelFromLOD(); | |
119 | 318 if ( !Load(pFilename, (ODMFace *)File, uRespawnInterval, thisa) ) |
0 | 319 { |
320 MessageBoxA(0, "Error!", "Couldn't Load Map!", 0); | |
321 CreateDebugLocation(); | |
322 } | |
810 | 323 ::day_attrib = v5->loc_time.day_attrib; |
324 ::day_fogrange_1 = v5->loc_time.day_fogrange_1; | |
325 ::day_fogrange_2 = v5->loc_time.day_fogrange_2; | |
0 | 326 if ( Is_out15odm_underwater() ) |
327 SetUnderwaterFog(); | |
630 | 328 _6BE134_odm_main_tile_group = v5->pTileTypes[0].tileset; |
0 | 329 result = 1; |
330 } | |
331 else | |
332 { | |
333 result = 0; | |
334 } | |
335 return result; | |
336 } | |
337 | |
338 //----- (0048901B) -------------------------------------------------------- | |
339 bool OutdoorLocation::Release2() | |
340 { | |
341 Release(); | |
342 pOutdoorCamera->ReleaseSoftwareDrawBuffers(); | |
343 return true; | |
344 } | |
345 | |
783 | 346 |
347 | |
348 char foot_travel_destinations[15][4] = | |
349 { | |
350 // north south east west from | |
351 {MAP_INVALID, MAP_INVALID, MAP_INVALID, MAP_INVALID}, // MAP_EMERALD_ISLE | |
352 {MAP_PIERPONT, MAP_BARROW_DOWNS, MAP_PIERPONT, MAP_STEADWICK}, // MAP_HARMONDALE | |
353 {MAP_DEYJA, MAP_BRAKADA_DESERT, MAP_HARMONDALE, MAP_TATALIA}, // MAP_STEADWICK | |
354 {MAP_AVLEE, MAP_HARMONDALE, MAP_INVALID, MAP_DEYJA}, // MAP_PIERPONT | |
355 {MAP_PIERPONT, MAP_STEADWICK, MAP_PIERPONT, MAP_STEADWICK}, // MAP_DEYJA | |
356 {MAP_STEADWICK, MAP_INVALID, MAP_BARROW_DOWNS, MAP_INVALID}, // MAP_BRAKADA_DESERT | |
357 {MAP_INVALID, MAP_INVALID, MAP_INVALID, MAP_INVALID}, // MAP_CELESTIA | |
358 {MAP_INVALID, MAP_INVALID, MAP_INVALID, MAP_INVALID}, // MAP_THE_PIT | |
359 {MAP_INVALID, MAP_INVALID, MAP_INVALID, MAP_INVALID}, // MAP_EVENMORN_ISLE | |
360 {MAP_INVALID, MAP_INVALID, MAP_INVALID, MAP_INVALID}, // MAP_MOUNT_NIGHON | |
361 {MAP_HARMONDALE, MAP_BRAKADA_DESERT, MAP_HARMONDALE, MAP_BRAKADA_DESERT}, // MAP_BARROW_DOWNS | |
362 {MAP_INVALID, MAP_INVALID, MAP_INVALID, MAP_INVALID}, // MAP_LAND_OF_GIANTS | |
363 {MAP_INVALID, MAP_INVALID, MAP_STEADWICK, MAP_INVALID}, // MAP_TATALIA | |
364 {MAP_INVALID, MAP_PIERPONT, MAP_PIERPONT, MAP_INVALID}, // MAP_AVLEE | |
365 {MAP_INVALID, MAP_INVALID, MAP_INVALID, MAP_INVALID} // MAP_SHOALS | |
366 }; | |
367 unsigned char foot_travel_times[15][4] = | |
368 { | |
369 // north south east west from | |
370 {0, 0, 0, 0}, // MAP_EMERALD_ISLE | |
371 {5, 5, 7, 5}, // MAP_HARMONDALE | |
372 {5, 5, 5, 5}, // MAP_STEADWICK | |
373 {5, 5, 0, 5}, // MAP_PIERPONT | |
374 {7, 5, 5, 4}, // MAP_DEYJA | |
375 {5, 0, 5, 0}, // MAP_BRAKADA_DESERT | |
376 {0, 0, 0, 0}, // MAP_CELESTIA | |
377 {0, 0, 0, 0}, // MAP_THE_PIT | |
378 {0, 0, 0, 0}, // MAP_EVENMORN_ISLE | |
379 {0, 0, 0, 0}, // MAP_MOUNT_NIGHON | |
380 {5, 7, 7, 5}, // MAP_BARROW_DOWNS | |
381 {0, 0, 0, 0}, // MAP_LAND_OF_GIANTS | |
382 {0, 0, 5, 0}, // MAP_TATALIA | |
383 {0, 7, 5, 0}, // MAP_AVLEE | |
384 {0, 0, 0, 0}, // MAP_SHOALS | |
385 }; | |
386 | |
387 | |
388 MapStartPoint foot_travel_arrival_points[15][4] = | |
389 { | |
390 // north south east west from | |
391 {MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party}, // MAP_EMERALD_ISLE | |
392 {MapStartPoint_South, MapStartPoint_North, MapStartPoint_South, MapStartPoint_East}, // MAP_HARMONDALE | |
393 {MapStartPoint_South, MapStartPoint_North, MapStartPoint_West, MapStartPoint_East}, // MAP_STEADWICK | |
394 {MapStartPoint_East, MapStartPoint_North, MapStartPoint_Party, MapStartPoint_East}, // MAP_PIERPONT | |
395 {MapStartPoint_West, MapStartPoint_North, MapStartPoint_West, MapStartPoint_North}, // MAP_DEYJA | |
396 {MapStartPoint_South, MapStartPoint_Party, MapStartPoint_West, MapStartPoint_Party}, // MAP_BRAKADA_DESERT | |
397 {MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party}, // MAP_CELESTIA | |
398 {MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party}, // MAP_THE_PIT | |
399 {MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party}, // MAP_EVENMORN_ISLE | |
400 {MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party}, // MAP_MOUNT_NIGHON | |
401 {MapStartPoint_South, MapStartPoint_East, MapStartPoint_South, MapStartPoint_East}, // MAP_BARROW_DOWNS | |
402 {MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party}, // MAP_LAND_OF_GIANTS | |
403 {MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_West, MapStartPoint_Party}, // MAP_TATALIA | |
404 {MapStartPoint_Party, MapStartPoint_North, MapStartPoint_North, MapStartPoint_Party}, // MAP_AVLEE | |
405 {MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party, MapStartPoint_Party}, // MAP_SHOALS | |
406 }; | |
407 | |
408 | |
0 | 409 //----- (0048902E) -------------------------------------------------------- |
410 bool OutdoorLocation::GetTravelDestination(signed int sPartyX, signed int sPartyZ, char *pOut, signed int a5) | |
411 { | |
412 OutdoorLocation *v5; // esi@1 | |
413 char *v6; // eax@3 | |
414 int v7; // eax@3 | |
783 | 415 //int v8; // edx@3 |
0 | 416 signed int v9; // esi@7 |
783 | 417 //int v10; // esi@23 |
0 | 418 signed int v11; // eax@23 |
783 | 419 //int v12; // ST14_4@25 |
0 | 420 signed int v14; // [sp-4h] [bp-84h]@6 |
138 | 421 char Str[140]; // [sp+8h] [bp-78h]@3 |
783 | 422 //int a5a; // [sp+94h] [bp+14h]@3 |
0 | 423 |
424 auto Source = this; | |
425 | |
426 v5 = Source; | |
427 if ( a5 < 10 | |
428 || strlen(Source->pLevelFilename) != 9 | |
138 | 429 || (strcpy(Str, v5->pLevelFilename), |
430 _strlwr(Str), | |
431 v6 = strtok(Str, "out"), | |
0 | 432 v6[2] = 0, |
433 v7 = atoi(v6), | |
783 | 434 //v8 = v7, |
435 //a5a = v7, | |
0 | 436 v7 < 1) |
437 || v7 > 15 ) | |
438 return 0; | |
439 if ( sPartyX < -22528 ) | |
440 { | |
441 v14 = 4; | |
442 LABEL_7: | |
443 v9 = v14; | |
444 goto LABEL_14; | |
445 } | |
446 if ( sPartyX > 22528 ) | |
447 { | |
448 v14 = 3; | |
449 goto LABEL_7; | |
450 } | |
451 if ( sPartyZ < -22528 ) | |
452 { | |
453 v14 = 2; | |
454 goto LABEL_7; | |
455 } | |
456 if ( sPartyZ <= 22528 ) | |
457 return 0; | |
458 v9 = 1; | |
459 LABEL_14: | |
460 if ( v7 == 14 ) | |
461 { | |
783 | 462 if ( v9 == 4 ) // to & from Shoals |
0 | 463 { |
464 if ( sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(0) ) | |
465 { | |
466 uDefaultTravelTime_ByFoot = 1; | |
467 strcpy(pOut, "out15.odm"); | |
783 | 468 uLevel_StartingPointType = MapStartPoint_East; |
0 | 469 LABEL_18: |
470 LOWORD(pParty->uFlags) &= 0xFD7Bu; | |
471 return 1; | |
472 } | |
783 | 473 //v8 = v7; |
0 | 474 } |
475 } | |
476 else | |
477 { | |
478 if ( v7 == 15 && v9 == 3 ) | |
479 { | |
480 uDefaultTravelTime_ByFoot = 1; | |
481 strcpy(pOut, "out14.odm"); | |
783 | 482 uLevel_StartingPointType = MapStartPoint_West; |
0 | 483 goto LABEL_18; |
484 } | |
485 } | |
783 | 486 //v10 = v9 + 4 * v7; |
487 //v11 = (unsigned __int8)aTiletableLoadU[v10 + 39]; | |
488 v11 = foot_travel_destinations[v7 - 1][v9 - 1]; | |
489 if (v11 == MAP_INVALID) | |
490 return false; | |
491 | |
492 assert(v11 <= MAP_SHOALS); | |
493 | |
494 uDefaultTravelTime_ByFoot = foot_travel_times[v7 - 1][v9 - 1]; | |
495 uLevel_StartingPointType = foot_travel_arrival_points[v7 - 1][v9 - 1]; | |
496 sprintf(pOut, "out%02d.odm", v11); | |
497 return 1; | |
498 //} | |
499 //return 0; | |
0 | 500 } |
501 // 6BD07C: using guessed type int uDefaultTravelTime_ByFoot; | |
502 // 6BE35C: using guessed type int uLevel_StartingPointType; | |
503 | |
504 //----- (0048917E) -------------------------------------------------------- | |
505 void OutdoorLocation::MessWithLUN() | |
506 { | |
507 OutdoorLocation *v1; // esi@1 | |
508 unsigned int *v2; // ebp@1 | |
509 unsigned int v3; // eax@1 | |
510 unsigned __int16 v4; // ax@1 | |
511 signed int v5; // ebx@1 | |
512 | |
513 v1 = this; | |
514 v2 = this->pSpriteIDs_LUN; | |
515 this->pSpriteIDs_LUN[0] = -1; | |
516 this->pSpriteIDs_LUN[2] = pSpriteFrameTable->FastFindSprite("LUN1-4"); | |
517 v1->pSpriteIDs_LUN[4] = pSpriteFrameTable->FastFindSprite("LUN1-2"); | |
518 v1->pSpriteIDs_LUN[6] = pSpriteFrameTable->FastFindSprite("LUN3-4"); | |
519 v1->uSpriteID_LUNFULL = pSpriteFrameTable->FastFindSprite("LUNFULL"); | |
520 v1->uSpriteID_LUN3_4_cp = pSpriteFrameTable->FastFindSprite("LUN3-4"); | |
521 v1->uSpriteID_LUN1_2_cp = pSpriteFrameTable->FastFindSprite("LUN1-2"); | |
522 v3 = pSpriteFrameTable->FastFindSprite("LUN1-4"); | |
523 v1->field_D60 = -1; | |
524 v1->uSpriteID_LUN1_4_cp = v3; | |
525 v1->field_CF0 = 4; | |
526 v1->field_CF8 = 4; | |
527 v1->field_D00 = 4; | |
528 LOWORD(v3) = *(short *)v2; | |
529 v1->pSpriteIDs_LUN[1] = 0; | |
530 v1->pSpriteIDs_LUN[3] = 0; | |
531 v1->pSpriteIDs_LUN[5] = 0; | |
532 v1->pSpriteIDs_LUN[7] = 0; | |
533 v1->field_CE8 = 0; | |
534 LOWORD(v1->field_D3C) = v3; | |
535 v1->field_D40 = 0; | |
536 v1->field_D44 = 0; | |
537 v1->field_D48 = 0; | |
538 v1->field_D4C = 131072; | |
539 v1->field_D5C = 0; | |
540 v1->field_D64 = 0; | |
541 v4 = pSpriteFrameTable->FastFindSprite("LUN-SUN"); | |
542 v1->field_D28 = -1; | |
543 v1->field_D08 = 0; | |
544 v1->field_D0C = 0; | |
545 v1->field_D10 = 0; | |
546 v1->field_D24 = 0; | |
547 v1->field_D2C = 0; | |
548 v1->uSpriteID_LUN_SUN = v4; | |
549 v1->field_D14 = -131072; | |
550 v5 = 8; | |
551 do | |
552 { | |
553 pSpriteFrameTable->InitializeSprite(*v2); | |
554 v2 += 2; | |
555 --v5; | |
556 } | |
557 while ( v5 ); | |
558 pSpriteFrameTable->InitializeSprite(v1->uSpriteID_LUN_SUN); | |
559 } | |
560 | |
561 //----- (004892E6) -------------------------------------------------------- | |
762 | 562 void OutdoorLocation::UpdateSunlightVectors() |
0 | 563 { |
762 | 564 //unsigned int result; // eax@1 |
0 | 565 OutdoorLocation *v2; // esi@1 |
566 unsigned int v3; // edi@3 | |
638 | 567 //int v4; // ebx@3 |
0 | 568 int v5; // eax@3 |
638 | 569 //int v6; // eax@3 |
570 //int v7; // ecx@3 | |
0 | 571 double v8; // st7@4 |
572 | |
573 v2 = this; | |
638 | 574 if ( pParty->uCurrentHour >= 5 && pParty->uCurrentHour < 21 ) |
0 | 575 { |
576 v3 = pParty->uCurrentMinute + 60 * (pParty->uCurrentHour - 5); | |
638 | 577 //v4 = (signed int)(v3 * stru_5C6E00->uIntegerPi) / 960; |
323 | 578 v5 = stru_5C6E00->Cos((signed int)(v3 * stru_5C6E00->uIntegerPi) / 960); |
638 | 579 v2->inv_sunlight_y = 0; |
580 v2->inv_sunlight_x = v5; | |
581 //v6 = stru_5C6E00->Sin(v4); | |
582 //v7 = v2->field_D18; | |
583 v2->inv_sunlight_z = stru_5C6E00->Sin((signed int)(v3 * stru_5C6E00->uIntegerPi) / 960); | |
584 v2->vSunlight.x = -v2->inv_sunlight_x; | |
585 v2->vSunlight.y = -v2->inv_sunlight_y; | |
586 v2->vSunlight.z = -v2->inv_sunlight_z; | |
0 | 587 if ( (signed int)v3 >= 480 ) |
588 v8 = (double)(signed int)(960 - v3); | |
589 else | |
590 v8 = (double)(signed int)v3; | |
638 | 591 v2->max_terrain_dimming_level = (signed __int64)(20.0 - v8 / 480.0 * 20.0); |
0 | 592 v2->uLastSunlightUpdateMinute = pParty->uCurrentMinute; |
593 } | |
594 } | |
595 | |
596 //----- (004893C1) -------------------------------------------------------- | |
597 void OutdoorLocation::UpdateFog() | |
598 { | |
599 fFogDensity = GetFogDensityByTime(); | |
600 } | |
601 | |
602 //----- (004893CF) -------------------------------------------------------- | |
603 int OutdoorLocation::GetNumFoodRequiredToRestInCurrentPos(int x, signed int y, int z) | |
604 { | |
605 OutdoorLocation *v4; // ebx@1 | |
606 signed int v5; // edi@4 | |
607 int v6; // eax@4 | |
608 int v7; // eax@4 | |
609 int v8; // eax@4 | |
610 int v9; // eax@5 | |
611 int v10; // eax@6 | |
612 int v11; // eax@7 | |
613 int v12; // eax@8 | |
614 int v15; // [sp+8h] [bp-8h]@2 | |
615 int v16; // [sp+Ch] [bp-4h]@2 | |
616 | |
617 v4 = this; | |
618 if ( pParty->uFlags & 8 | |
619 || (v15 = 0, | |
620 v16 = 0, | |
723 | 621 ODM_GetFloorLevel(x, y, z, pParty->uDefaultPartyHeight, &v15, &v16, 0), |
0 | 622 v16) |
623 || v15 ) | |
624 return 2; | |
625 v5 = WorldPosToGridCellX(pParty->vPosition.x); | |
626 v6 = WorldPosToGridCellZ(pParty->vPosition.y); | |
627 v7 = _47ED83(v5, v6 - 1); | |
764 | 628 v8 = pTileTable->pTiles[GetTileIdByTileMapId(v7)].tileset; |
0 | 629 if ( v8 ) |
630 { | |
631 v9 = v8 - 1; | |
632 if ( !v9 ) | |
633 return 3; | |
634 v10 = v9 - 1; | |
635 if ( !v10 ) | |
636 return 5; | |
637 v11 = v10 - 1; | |
638 if ( !v11 || (v12 = v11 - 3) == 0 ) | |
639 return 4; | |
640 if ( v12 == 1 ) | |
641 return 3; | |
642 return 2; | |
643 } | |
644 return 1; | |
645 } | |
767 | 646 |
0 | 647 |
648 //----- (00489487) -------------------------------------------------------- | |
767 | 649 void OutdoorLocation::SetFog() |
0 | 650 { |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
651 strcpy(pOutdoor->pLevelFilename, pCurrentMapName.data()); |
0 | 652 |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
653 auto map_id = pMapStats->GetMapInfo(pCurrentMapName.data()); |
767 | 654 if (map_id == MAP_INVALID || map_id == MAP_CELESTIA || map_id == MAP_THE_PIT || map_id > MAP_SHOALS) |
655 return; | |
656 | |
657 uint chance = rand() % 100; | |
658 | |
659 if (chance < fog_probability_table[map_id - 1].small_fog_chance) | |
0 | 660 { |
767 | 661 ::day_fogrange_1 = 4096; |
662 ::day_fogrange_2 = 8192; | |
663 ::day_attrib |= DAY_ATTRIB_FOG; | |
0 | 664 } |
767 | 665 else if (chance < fog_probability_table[map_id - 1].small_fog_chance + |
666 fog_probability_table[map_id - 1].average_fog_chance) | |
0 | 667 { |
767 | 668 ::day_fogrange_2 = 4096; |
669 ::day_fogrange_1 = 0; | |
670 ::day_attrib |= DAY_ATTRIB_FOG; | |
0 | 671 } |
767 | 672 else if (fog_probability_table[map_id - 1].dense_fog_chance && |
673 chance < fog_probability_table[map_id - 1].small_fog_chance + | |
674 fog_probability_table[map_id - 1].average_fog_chance + | |
675 fog_probability_table[map_id - 1].dense_fog_chance) | |
0 | 676 { |
767 | 677 ::day_fogrange_2 = 2048; |
678 ::day_fogrange_1 = 0; | |
679 ::day_attrib |= DAY_ATTRIB_FOG; | |
0 | 680 } |
767 | 681 else |
682 ::day_attrib &= ~DAY_ATTRIB_FOG; | |
683 | |
0 | 684 if ( Is_out15odm_underwater() ) |
685 SetUnderwaterFog(); | |
810 | 686 pOutdoor->loc_time.day_fogrange_1 = ::day_fogrange_1; |
687 pOutdoor->loc_time.day_fogrange_2 = ::day_fogrange_2; | |
688 pOutdoor->loc_time.day_attrib = ::day_attrib; | |
0 | 689 } |
690 | |
691 //----- (00482170) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
692 bool ODMFace::IsBackfaceCulled(ODMFace *a1, RenderVertexSoft *a2, struct Polygon *a3) |
0 | 693 { |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1338
diff
changeset
|
694 struct Polygon *v3; // edi@1 |
0 | 695 RenderVertexSoft *v4; // esi@1 |
696 unsigned int v5; // edx@1 | |
697 RenderVertexSoft *v6; // ecx@2 | |
698 double v7; // st7@5 | |
699 double v8; // st6@5 | |
700 double v9; // st5@5 | |
701 double v10; // st6@9 | |
702 double v11; // st5@9 | |
703 double v12; // st4@9 | |
704 bool result; // eax@16 | |
705 double v14; // ST2C_8@17 | |
706 double v15; // ST20_8@17 | |
707 double v16; // ST0C_8@17 | |
708 double v17; // ST0C_8@17 | |
709 float v18; // [sp+8h] [bp-38h]@5 | |
710 float v19; // [sp+10h] [bp-30h]@5 | |
711 float v20; // [sp+14h] [bp-2Ch]@5 | |
712 float v21; // [sp+18h] [bp-28h]@5 | |
713 float v22; // [sp+1Ch] [bp-24h]@5 | |
714 float v23; // [sp+24h] [bp-1Ch]@5 | |
715 float v24; // [sp+28h] [bp-18h]@5 | |
716 float v25; // [sp+30h] [bp-10h]@5 | |
717 float v26; // [sp+34h] [bp-Ch]@5 | |
718 float v27; // [sp+38h] [bp-8h]@5 | |
719 float v28; // [sp+3Ch] [bp-4h]@5 | |
720 float a3a; // [sp+48h] [bp+8h]@5 | |
721 float a3b; // [sp+48h] [bp+8h]@17 | |
722 float a3c; // [sp+48h] [bp+8h]@17 | |
723 float a3d; // [sp+48h] [bp+8h]@17 | |
724 float a3e; // [sp+48h] [bp+8h]@17 | |
725 | |
726 v3 = a3; | |
727 v4 = a2; | |
728 v5 = a3->uNumVertices; | |
729 if ( (signed int)v5 < 3 ) | |
730 goto LABEL_20; | |
731 v6 = &v4[v5 - 1]; | |
732 if ( v4->vWorldPosition.z == v4[1].vWorldPosition.z && v4[1].vWorldPosition.z == v6->vWorldPosition.z ) | |
733 *(int *)&a3->flags |= 0x10u; | |
734 v19 = v4[1].vWorldViewPosition.x - v4->vWorldViewPosition.x; | |
735 v18 = v4[1].vWorldViewPosition.y - v4->vWorldViewPosition.y; | |
736 v20 = v4[1].vWorldViewPosition.z - v4->vWorldViewPosition.z; | |
737 v21 = v6->vWorldViewPosition.x - v4->vWorldViewPosition.x; | |
738 v22 = v6->vWorldViewPosition.y - v4->vWorldViewPosition.y; | |
739 v23 = v6->vWorldViewPosition.z - v4->vWorldViewPosition.z; | |
740 v28 = v4[1].vWorldPosition.x - v4->vWorldPosition.x; | |
741 v27 = v4[1].vWorldPosition.y - v4->vWorldPosition.y; | |
742 a3a = v4[1].vWorldPosition.z - v4->vWorldPosition.z; | |
743 v7 = v6->vWorldPosition.x - v4->vWorldPosition.x; | |
744 v8 = v6->vWorldPosition.y - v4->vWorldPosition.y; | |
745 v9 = v6->vWorldPosition.z - v4->vWorldPosition.z; | |
746 v26 = v27 * v9 - v8 * a3a; | |
747 v24 = v7 * a3a - v9 * v28; | |
748 v25 = v8 * v28 - v7 * v27; | |
749 if ( v26 == 0.0 && v24 == 0.0 && v25 == 0.0 ) | |
750 { | |
751 while ( 1 ) | |
752 { | |
753 --v5; | |
754 if ( (signed int)v5 < 2 ) | |
755 break; | |
756 v10 = v6->vWorldPosition.x - v4->vWorldPosition.x; | |
757 v11 = v6->vWorldPosition.y - v4->vWorldPosition.y; | |
758 v12 = v6->vWorldPosition.z - v4->vWorldPosition.z; | |
759 v26 = v27 * v12 - v11 * a3a; | |
760 v24 = v10 * a3a - v12 * v28; | |
761 v25 = v11 * v28 - v10 * v27; | |
762 if ( v26 != 0.0 ) | |
763 break; | |
764 if ( v24 != 0.0 || v25 != 0.0 ) | |
765 break; | |
766 --v6; | |
767 } | |
768 v21 = v6->vWorldViewPosition.x - v4->vWorldViewPosition.x; | |
769 v22 = v6->vWorldViewPosition.y - v4->vWorldViewPosition.y; | |
770 v23 = v6->vWorldViewPosition.z - v4->vWorldViewPosition.z; | |
771 } | |
772 if ( ((double)pIndoorCamera->pos.x - v4->vWorldPosition.x) * v26 | |
773 + ((double)pIndoorCamera->pos.z - v4->vWorldPosition.z) * v25 | |
774 + ((double)pIndoorCamera->pos.y - v4->vWorldPosition.y) * v24 > 0.0 ) | |
775 { | |
776 a3b = v23 * v18 - v22 * v20; | |
777 v14 = a3b + 6.7553994e15; | |
778 v3->v_18.x = LODWORD(v14); | |
779 a3c = v21 * v20 - v23 * v19; | |
780 v15 = a3c + 6.7553994e15; | |
781 v3->v_18.y = LODWORD(v15); | |
782 a3d = v22 * v19 - v21 * v18; | |
783 v16 = a3d + 6.7553994e15; | |
784 v3->v_18.z = LODWORD(v16); | |
785 v3->_486089_normalize_v_18(); | |
786 a3e = -((double)v3->v_18.x * v4->vWorldViewPosition.x) | |
787 - (double)v3->v_18.y * v4->vWorldViewPosition.y | |
788 - (double)v3->v_18.z * v4->vWorldViewPosition.z; | |
789 v17 = a3e + 6.7553994e15; | |
790 v3->field_24 = LODWORD(v17); | |
791 result = 1; | |
792 } | |
793 else | |
794 { | |
795 LABEL_20: | |
796 result = 0; | |
797 } | |
798 return result; | |
799 } | |
800 | |
801 | |
802 //----- (0047C7A9) -------------------------------------------------------- | |
803 void OutdoorLocationTerrain::_47C7A9() | |
804 { | |
805 this->field_10 = 0; | |
806 this->field_12 = 0; | |
807 this->field_16 = 0; | |
808 this->field_14 = 0; | |
809 this->field_1C = 0; | |
810 this->field_18 = 0; | |
811 } | |
812 | |
813 //----- (0047C7C2) -------------------------------------------------------- | |
49 | 814 void OutdoorLocationTerrain::Release()//î÷èñòèòü ëîêàöèþ |
0 | 815 { |
816 if (pHeightmap) | |
817 { | |
818 pAllocator->FreeChunk(this->pHeightmap); | |
819 pHeightmap = nullptr; | |
820 } | |
821 if (pTilemap) | |
822 { | |
823 pAllocator->FreeChunk(pTilemap); | |
824 pTilemap = nullptr; | |
825 } | |
826 if (pAttributemap) | |
827 { | |
828 pAllocator->FreeChunk(pAttributemap); | |
829 pAttributemap = nullptr; | |
830 } | |
760 | 831 if (pDmap) |
0 | 832 { |
760 | 833 pAllocator->FreeChunk(pDmap); |
834 pDmap = nullptr; | |
0 | 835 } |
836 | |
837 _47C7A9(); | |
838 } | |
839 | |
840 //----- (0047C80A) -------------------------------------------------------- | |
760 | 841 void OutdoorLocationTerrain::FillDMap( int X, int Y, int W, int Z ) |
842 { | |
49 | 843 OutdoorLocationTerrain *pOutLocTerrain; // ebx@1 |
0 | 844 double v6; // st7@1 |
845 double v7; // st7@2 | |
846 double v8; // st7@2 | |
847 int result; // eax@3 | |
848 int v10; // eax@4 | |
849 int v11; // ecx@5 | |
850 int v12; // ecx@6 | |
851 int v13; // edi@7 | |
852 int v14; // edx@9 | |
853 int v15; // eax@15 | |
49 | 854 unsigned __int8 *pMapHeight; // ebx@15 |
0 | 855 int v17; // eax@15 |
856 int v18; // ecx@15 | |
857 int v19; // esi@15 | |
858 int v20; // edi@15 | |
859 int v21; // edx@15 | |
860 int v22; // ecx@15 | |
861 int v23; // ebx@15 | |
862 int v24; // ecx@15 | |
863 int v25; // ST28_4@15 | |
864 double v26; // st7@15 | |
865 double v27; // st6@15 | |
866 double v28; // st5@15 | |
867 double v29; // st7@15 | |
868 double v30; // st7@16 | |
869 double v31; // st7@17 | |
870 int v32; // eax@21 | |
871 double v33; // st7@21 | |
872 double v34; // st6@21 | |
873 double v35; // st5@21 | |
874 double v36; // st7@21 | |
875 double v37; // st7@22 | |
876 double v38; // st7@23 | |
877 int v39; // [sp+14h] [bp-34h]@8 | |
878 int v40; // [sp+18h] [bp-30h]@15 | |
879 int v41; // [sp+1Ch] [bp-2Ch]@15 | |
880 int v42; // [sp+20h] [bp-28h]@15 | |
49 | 881 OutdoorLocationTerrain *pOutLocTerrain2; // [sp+24h] [bp-24h]@1 |
0 | 882 int v44; // [sp+28h] [bp-20h]@21 |
883 float v45; // [sp+2Ch] [bp-1Ch]@1 | |
884 float v46; // [sp+30h] [bp-18h]@1 | |
885 float v47; // [sp+34h] [bp-14h]@1 | |
886 int v48; // [sp+38h] [bp-10h]@7 | |
887 int v49; // [sp+3Ch] [bp-Ch]@10 | |
888 int v50; // [sp+40h] [bp-8h]@9 | |
889 float v51; // [sp+44h] [bp-4h]@15 | |
890 float v52; // [sp+44h] [bp-4h]@21 | |
891 float v53; // [sp+50h] [bp+8h]@15 | |
892 float v54; // [sp+50h] [bp+8h]@21 | |
893 int v55; // [sp+54h] [bp+Ch]@15 | |
894 float v56; // [sp+54h] [bp+Ch]@15 | |
895 float v57; // [sp+54h] [bp+Ch]@21 | |
896 | |
897 v46 = -64.0; | |
898 v47 = -64.0; | |
49 | 899 pOutLocTerrain = this; |
0 | 900 v45 = 64.0; |
49 | 901 pOutLocTerrain2 = this; |
0 | 902 v6 = sqrt(12288.0); |
903 if ( v6 != 0.0 ) | |
904 { | |
905 v7 = 1.0 / v6; | |
906 v45 = 64.0 * v7; | |
907 v8 = v7 * -64.0; | |
908 v46 = v8; | |
909 v47 = v8; | |
910 } | |
760 | 911 result = Y; |
912 if ( Y > Z ) | |
0 | 913 { |
760 | 914 v10 = Z ^ Y; |
915 Z ^= Y ^ Z; | |
916 result = Z ^ v10; | |
0 | 917 } |
760 | 918 v11 = X; |
919 if ( X > W ) | |
0 | 920 { |
760 | 921 v12 = W ^ X; |
922 W ^= X ^ W; | |
923 v11 = W ^ v12; | |
0 | 924 } |
925 v13 = result - 1; | |
926 v48 = result - 1; | |
760 | 927 if ( result - 1 <= Z ) |
0 | 928 { |
929 v39 = v11 - 1; | |
930 do | |
931 { | |
932 v14 = v39; | |
933 v50 = v39; | |
760 | 934 if ( v39 <= W ) |
0 | 935 { |
936 result = (v39 - 63) << 9; | |
937 v49 = (v39 - 63) << 9; | |
938 do | |
939 { | |
940 if ( v13 >= 0 && result >= -32256 && v13 <= 127 && result <= 32768 ) | |
941 { | |
49 | 942 v15 = pOutLocTerrain->field_10; |
0 | 943 v55 = v15; |
49 | 944 pMapHeight = pOutLocTerrain->pHeightmap; |
945 v17 = (int)(&pMapHeight[v13 * v15] + v14); | |
0 | 946 v18 = -v13; |
947 v19 = (64 - v13) << 9; | |
948 v20 = 32 * *(char *)v17; | |
949 v21 = 32 * *(char *)(v17 + 1); | |
950 v22 = (v18 + 63) << 9; | |
951 v41 = v22; | |
49 | 952 v23 = (int)(&pMapHeight[v55 * (v48 + 1)] + v50); |
0 | 953 v24 = v22 - v19; |
954 v40 = 32 * *(char *)v23; | |
955 v42 = 32 * *(char *)(v23 + 1); | |
760 | 956 |
957 | |
0 | 958 v25 = v49 - 512 - v49; |
959 v26 = (double)-((v20 - v21) * v24); | |
960 v51 = v26; | |
961 v27 = (double)-(v25 * (v42 - v21)); | |
962 v53 = v27; | |
963 v28 = (double)(v25 * v24); | |
964 v56 = v28; | |
965 v29 = sqrt(v28 * v28 + v27 * v27 + v26 * v26); | |
966 if ( v29 != 0.0 ) | |
967 { | |
968 v30 = 1.0 / v29; | |
969 v51 = v51 * v30; | |
970 v53 = v53 * v30; | |
971 v56 = v30 * v56; | |
972 } | |
973 v31 = (v56 * v47 + v53 * v46 + v51 * v45) * 31.0; | |
974 if ( v31 < 0.0 ) | |
975 v31 = 0.0; | |
976 if ( v31 > 31.0 ) | |
977 v31 = 31.0; | |
49 | 978 v44 = 2 * (v50 + v48 * pOutLocTerrain2->field_10); |
979 pOutLocTerrain = pOutLocTerrain2; | |
760 | 980 *((char *)pOutLocTerrain2->pDmap + v44 + 1) = (signed __int64)v31; |
981 | |
0 | 982 v32 = v49 - (v49 - 512); |
983 v33 = (double)-((v42 - v40) * (v19 - v41)); | |
984 v52 = v33; | |
985 v34 = (double)-(v32 * (v20 - v40)); | |
986 v54 = v34; | |
987 v35 = (double)(v32 * (v19 - v41)); | |
988 v57 = v35; | |
989 v36 = sqrt(v35 * v35 + v34 * v34 + v33 * v33); | |
990 if ( v36 != 0.0 ) | |
991 { | |
992 v37 = 1.0 / v36; | |
993 v52 = v52 * v37; | |
994 v54 = v54 * v37; | |
995 v57 = v37 * v57; | |
996 } | |
997 v38 = (v57 * v47 + v54 * v46 + v52 * v45) * 31.0; | |
998 if ( v38 < 0.0 ) | |
999 v38 = 0.0; | |
1000 if ( v38 > 31.0 ) | |
1001 v38 = 31.0; | |
1002 v13 = v48; | |
760 | 1003 *((char *)pOutLocTerrain2->pDmap + v44) = (signed __int64)v38; |
0 | 1004 v14 = v50; |
1005 result = v49; | |
1006 } | |
1007 ++v14; | |
1008 result += 512; | |
1009 v50 = v14; | |
1010 v49 = result; | |
1011 } | |
760 | 1012 while ( v14 <= W ); |
0 | 1013 } |
1014 ++v13; | |
1015 v48 = v13; | |
1016 } | |
760 | 1017 while ( v13 <= Z ); |
0 | 1018 } |
1019 } | |
1020 | |
1021 //----- (0047CB57) -------------------------------------------------------- | |
1022 int OutdoorLocationTerrain::_47CB57(int a1, int a2, int a3) | |
1023 { | |
1024 signed int result; // eax@2 | |
1025 unsigned __int16 *v5; // edx@3 | |
1026 double v6; // st7@3 | |
1027 char v7; // bl@3 | |
1028 int v8; // eax@3 | |
1029 int v9; // eax@4 | |
1030 int v10; // eax@5 | |
1031 double v11; // st6@7 | |
1032 signed int v12; // edi@7 | |
1033 int v13; // esi@9 | |
1034 char *v14; // esi@10 | |
1035 signed int v15; // ecx@10 | |
1036 char v16[256]; // [sp+4h] [bp-124h]@9 | |
1037 unsigned __int16 *v17; // [sp+104h] [bp-24h]@3 | |
1038 unsigned int v18; // [sp+108h] [bp-20h]@3 | |
1039 unsigned int v19; // [sp+10Ch] [bp-1Ch]@3 | |
1040 unsigned int v20; // [sp+110h] [bp-18h]@3 | |
1041 unsigned int v21; // [sp+114h] [bp-14h]@3 | |
1042 float v22; // [sp+118h] [bp-10h]@3 | |
1043 float v23; // [sp+11Ch] [bp-Ch]@3 | |
1044 int i; // [sp+120h] [bp-8h]@3 | |
1045 unsigned int v25; // [sp+124h] [bp-4h]@5 | |
1046 signed int a2a; // [sp+134h] [bp+Ch]@3 | |
1047 unsigned int a2b; // [sp+134h] [bp+Ch]@7 | |
1048 float a3a; // [sp+138h] [bp+10h]@7 | |
1049 int a3b; // [sp+138h] [bp+10h]@9 | |
1050 | |
1051 if ( pRenderer->pRenderD3D ) | |
1052 { | |
1053 result = 0; | |
1054 } | |
1055 else | |
1056 { | |
1057 v5 = PaletteManager::Get_Dark_or_Red_LUT(a2, 0, 1); | |
1058 v6 = 0.0; | |
1059 v7 = LOBYTE(pRenderer->uTargetBBits); | |
1060 v19 = pRenderer->uTargetRMask; | |
1061 v21 = pRenderer->uTargetGMask; | |
1062 v22 = 0.0; | |
1063 v20 = pRenderer->uTargetBMask; | |
1064 v8 = 0; | |
1065 v17 = v5; | |
1066 v23 = 0.0; | |
1067 v18 = pRenderer->uTargetBBits; | |
1068 a2a = 0; | |
1069 for ( i = 0; i < a3; ++i ) | |
1070 { | |
1071 v9 = *(char *)(v8 + a1); | |
1072 if ( v9 ) | |
1073 { | |
1074 v10 = v5[v9]; | |
1075 v6 = v6 + (double)((signed int)(v19 & v10) >> (LOBYTE(pRenderer->uTargetBBits) + LOBYTE(pRenderer->uTargetGBits))); | |
1076 ++a2a; | |
1077 v25 = v20 & v10; | |
1078 v22 = (double)((signed int)(v21 & v10) >> SLOBYTE(pRenderer->uTargetBBits)) + v22; | |
1079 v23 = (double)(signed int)(v20 & v10) + v23; | |
1080 } | |
1081 v8 = i + 1; | |
1082 } | |
1083 v11 = 1.0 / (double)a2a; | |
1084 a3a = v11; | |
1085 v25 = (signed __int64)(a3a * v22); | |
1086 i = (signed __int64)(a3a * v23); | |
1087 v12 = 0; | |
1088 a2b = pRenderer->uTargetBBits + pRenderer->uTargetGBits; | |
1089 while ( 1 ) | |
1090 { | |
1091 v13 = v17[v12]; | |
1092 a3b = abs((__int64)(signed __int64)(v11 * v6) - ((signed int)(v19 & v17[v12]) >> a2b)); | |
1093 BYTE3(a3b) = abs((signed)v25 - ((signed int)(v21 & v13) >> v7)) + a3b; | |
1094 v16[v12++] = abs((signed)i - (signed)(v20 & v13)) + BYTE3(a3b); | |
1095 if ( v12 >= 256 ) | |
1096 break; | |
1097 v7 = v18; | |
1098 } | |
1099 result = 0; | |
1100 v14 = (char *)&pPaletteManager->field_D1600[42][23][116]; | |
1101 v15 = 0; | |
1102 do | |
1103 { | |
1104 if ( (unsigned __int8)v16[v15] < (signed int)v14 ) | |
1105 { | |
1106 v14 = (char *)(unsigned __int8)v16[v15]; | |
1107 result = v15; | |
1108 } | |
1109 ++v15; | |
1110 } | |
1111 while ( v15 < 256 ); | |
1112 } | |
1113 return result; | |
1114 } | |
1115 // 47CB57: using guessed type char var_124[256]; | |
1116 | |
1117 //----- (0047CCE2) -------------------------------------------------------- | |
1118 bool OutdoorLocationTerrain::ZeroLandscape() | |
1119 { | |
1120 OutdoorLocationTerrain *v1; // esi@1 | |
1121 | |
1122 v1 = this; | |
1123 memset(this->pHeightmap, 0, 0x4000u); | |
1124 memset(v1->pTilemap, 90, 0x4000u); | |
1125 memset(v1->pAttributemap, 0, 0x4000u); | |
760 | 1126 memset(v1->pDmap, 0, 0x8000u); |
0 | 1127 v1->field_12 = 128; |
1128 v1->field_10 = 128; | |
1129 v1->field_16 = 7; | |
1130 v1->field_14 = 7; | |
1131 v1->field_1C = 127; | |
1132 v1->field_18 = 127; | |
1133 return 1; | |
1134 } | |
1135 | |
1136 //----- (0047CD44) -------------------------------------------------------- | |
1137 bool OutdoorLocationTerrain::Initialize() | |
1138 { | |
1139 | |
760 | 1140 pHeightmap= (unsigned __int8 *)pAllocator->AllocNamedChunk(pHeightmap, 0x4000u, "HMAP");//height map |
1141 pTilemap = (unsigned __int8 *)pAllocator->AllocNamedChunk(pTilemap, 0x4000u, "TMAP");//tile map | |
1142 pAttributemap = (unsigned __int8 *)pAllocator->AllocNamedChunk(pAttributemap, 0x4000u, "AMAP");//êàðòà àòðèáóòîâ | |
1143 pDmap=(struct DMap *)pAllocator->AllocNamedChunk(pDmap, 0x8000u, "DMAP"); | |
1338 | 1144 if ( pHeightmap && pTilemap && pAttributemap && pDmap ) |
760 | 1145 return true; |
0 | 1146 else |
760 | 1147 return false; |
0 | 1148 } |
1149 | |
1150 //----- (0047CDE2) -------------------------------------------------------- | |
1151 void OutdoorLocation::CreateDebugLocation() | |
1152 { | |
1153 OutdoorLocation *v1; // esi@1 | |
1154 void *v2; // eax@1 | |
1155 void *v3; // ST14_4@1 | |
1156 void *v4; // eax@1 | |
1157 void *v5; // ST14_4@1 | |
1158 void *v6; // eax@1 | |
1159 unsigned int v7; // eax@1 | |
1160 char v8; // zf@1 | |
1161 | |
1162 v1 = this; | |
1163 strcpy(this->pLevelFilename, "blank"); | |
1164 strcpy(v1->pLocationFileName, "i6.odm"); | |
1165 strcpy(v1->pLocationFileDescription, "MM6 Outdoor v1.00"); | |
1166 v1->uNumBModels = 0; | |
630 | 1167 v1->pTileTypes[0].tileset = Tileset_Grass; |
1168 v1->pTileTypes[1].tileset = Tileset_Water; | |
1169 v1->pTileTypes[2].tileset = Tileset_6; | |
1170 v1->pTileTypes[3].tileset = Tileset_RoadGrassCobble; | |
0 | 1171 v1->LoadTileGroupIds(); |
630 | 1172 v1->LoadRoadTileset(); |
0 | 1173 pAllocator->FreeChunk(v1->pBModels); |
1174 pAllocator->FreeChunk(v1->pSpawnPoints); | |
1175 v1->pBModels = 0; | |
1176 v1->pSpawnPoints = 0; | |
1177 v1->pTerrain.Initialize(); | |
1178 v1->pTerrain.ZeroLandscape(); | |
760 | 1179 v1->pTerrain.FillDMap(0, 0, 128, 128); |
1180 pAllocator->FreeChunk(v1->pCmap); | |
1181 v1->pCmap = 0; | |
0 | 1182 v2 = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP"); |
1183 v3 = v1->pOMAP; | |
760 | 1184 v1->pCmap = v2; |
0 | 1185 pAllocator->FreeChunk(v3); |
1186 v1->pOMAP = 0; | |
1187 v4 = pAllocator->AllocNamedChunk(0, 0x10000u, "OMAP"); | |
1188 v1->pOMAP = (unsigned int *)v4; | |
1189 memset(v4, 0, 0x10000u); | |
1190 v5 = v1->pFaceIDLIST; | |
1191 v1->numFaceIDListElems = 0; | |
1192 pAllocator->FreeChunk(v5); | |
1193 v1->pFaceIDLIST = 0; | |
1194 v6 = pAllocator->AllocNamedChunk(0, 2u, "IDLIST"); | |
1195 v1->pFaceIDLIST = (unsigned __int16 *)v6; | |
1196 *(short *)v6 = 0; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1197 strcpy(v1->pSkyTextureName, pDefaultSkyTexture.data()); |
0 | 1198 v1->uSky_TextureID = pBitmaps_LOD->LoadTexture(v1->pSkyTextureName); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1199 strcpy(v1->pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture.data()); |
0 | 1200 v7 = pBitmaps_LOD->LoadTexture(v1->pGroundTileset); |
1201 v8 = v1->uSky_TextureID == -1; | |
1202 v1->uMainTile_BitmapID = v7; | |
1203 if ( v8 ) | |
1204 Abortf("Invalid Sky Tex Handle"); | |
1205 if ( v1->uMainTile_BitmapID == -1 ) | |
1206 Abortf("Invalid Ground Tex Handle"); | |
1207 } | |
1208 | |
1209 | |
1210 | |
1211 //----- (0047CF9C) -------------------------------------------------------- | |
1212 void OutdoorLocation::Release() | |
1213 { | |
1214 //OutdoorLocation *v1; // esi@1 | |
1215 //signed int v2; // edi@1 | |
1216 //int v3; // ebx@2 | |
1217 //void *v4; // ST24_4@4 | |
1218 //char *v5; // ebx@4 | |
1219 //void **v6; // esi@4 | |
1220 | |
1221 //v1 = this; | |
1222 strcpy(pLevelFilename, "blank"); | |
1223 strcpy(pLocationFileName, "default.odm"); | |
1224 strcpy(pLocationFileDescription, "MM6 Outdoor v1.00"); | |
1225 strcpy(pSkyTextureName, "sky043"); | |
1226 strcpy(pGroundTileset, "hm005"); | |
1227 | |
1228 if (pBModels) | |
1229 { | |
1230 for (uint i = 0; i < uNumBModels; ++i) | |
1231 pBModels[i].Release(); | |
1232 | |
1233 pAllocator->FreeChunk(pBModels); | |
1234 pBModels = nullptr; | |
1235 uNumBModels = 0; | |
1236 } | |
1237 | |
1238 if (pSpawnPoints) | |
1239 { | |
1240 pAllocator->FreeChunk(pSpawnPoints); | |
1241 pSpawnPoints = nullptr; | |
1242 } | |
1243 uNumSpawnPoints = 0; | |
1244 | |
1245 pTerrain.Release(); | |
1246 | |
760 | 1247 if (pCmap) |
0 | 1248 { |
760 | 1249 pAllocator->FreeChunk(pCmap); |
1250 pCmap = nullptr; | |
0 | 1251 } |
1252 if (pOMAP) | |
1253 { | |
1254 pAllocator->FreeChunk(pOMAP); | |
1255 pOMAP = nullptr; | |
1256 } | |
1257 if (pFaceIDLIST) | |
1258 { | |
1259 pAllocator->FreeChunk(pFaceIDLIST); | |
1260 pFaceIDLIST = nullptr; | |
1261 } | |
1262 if (pTerrainNormals) | |
1263 { | |
1264 pAllocator->FreeChunk(pTerrainNormals); | |
1265 pTerrainNormals = nullptr; | |
1266 } | |
1267 } | |
1268 | |
1269 //----- (0047D0A6) -------------------------------------------------------- | |
119 | 1270 bool OutdoorLocation::Load(const char *pFilename, ODMFace *File, size_t pNumItems, int thisa)//çàãðóçêà ëîêàöèè |
0 | 1271 { |
1272 //OutdoorLocation *pOutdoorLocation; // esi@1 | |
1273 /*bool result; // eax@9 | |
1274 bool v7; // ebx@9 | |
1275 size_t v8; // eax@10 | |
1276 void *v9; // eax@10 | |
1277 void *v10; // eax@10 | |
1278 void *v11; // eax@10 | |
1279 int v12; // ebx@11 | |
1280 BSPModel *v13; // eax@12 | |
1281 void *v14; // eax@12 | |
1282 BSPModel *v15; // ecx@12 | |
1283 void *v16; // eax@12 | |
1284 BSPModel *v17; // ecx@12 | |
1285 BSPModel *v18; // eax@12 | |
1286 __int16 v19; // ax@15 | |
1287 __int16 v20; // ax@16 | |
1288 int v21; // ecx@16 | |
1289 ODMFace *v22; // ebx@26 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
1290 SpriteObject *pItems; // ecx@27 |
0 | 1291 unsigned int v24; // eax@28 |
1292 //unsigned __int8 v25; // zf@28 | |
1293 //unsigned __int8 v26; // sf@28 | |
1294 ODMFace *v27; // eax@28 | |
1295 const char *i; // edx@29 | |
1296 unsigned __int16 v29; // ax@33 | |
1297 unsigned __int16 v30; // ax@37 | |
1298 int v31; // ecx@37 | |
1299 int v32; // eax@38 | |
1300 void *v33; // eax@38 | |
1301 TileDesc *v34; // eax@43 | |
1302 unsigned int v35; // eax@43 | |
1303 unsigned int v36; // edi@43 | |
1304 unsigned int v37; // edi@45*/ | |
1305 //size_t v38; // eax@50 | |
1306 FILE *v39; // eax@50 | |
1307 //unsigned int v40; // edi@56 | |
1308 //void *v41; // eax@56 | |
1309 //void *v42; // ebx@56 | |
1310 //const void *v43; // ebx@59 | |
1311 //const void *v44; // ebx@59 | |
1312 //unsigned int v45; // eax@59 | |
1313 //BSPModel *v46; // eax@59 | |
1314 //unsigned int v47; // ecx@59 | |
1315 //int v48; // ebx@60 | |
1316 //BSPModel *v49; // eax@61 | |
1317 //BSPModel *v50; // eax@61 | |
1318 //BSPModel *v51; // eax@61 | |
1319 //BSPModel *v52; // eax@61 | |
1320 //BSPModel *v53; // eax@61 | |
1321 //BSPModel *v54; // ecx@61 | |
1322 //BSPModel *v55; // ecx@61 | |
1323 //BSPModel *v56; // ecx@61 | |
1324 //void *v57; // ST24_4@61 | |
1325 //BSPModel *v58; // ecx@61 | |
1326 //void *v59; // ST18_4@61 | |
1327 //BSPModel *v60; // eax@61 | |
1328 //__int16 v61; // ax@64 | |
1329 unsigned __int16 v62; // ax@65 | |
1330 //ODMFace *v63; // ecx@65 | |
1331 //unsigned __int16 v64; // ax@80 | |
1332 //const char *v65; // ecx@80 | |
1333 //int v66; // eax@81 | |
1334 //void *v67; // eax@81 | |
1335 //int v68; // ecx@81 | |
1336 //void *v69; // eax@81 | |
1337 //unsigned int v70; // eax@81 | |
1338 //SpawnPointMM7 *v71; // eax@81 | |
1339 //unsigned int v72; // ecx@81 | |
1340 //size_t v73; // eax@81 | |
1341 //int v74; // edi@87 | |
1342 //void *v75; // edi@88 | |
1343 //unsigned int v76; // edx@94 | |
1344 //int v77; // ecx@94 | |
1345 //char *v78; // eax@95 | |
1346 //unsigned int v79; // edx@97 | |
1347 //unsigned int v80; // eax@99 | |
1348 //int v81; // eax@107 | |
1349 //void *v82; // edi@114 | |
1350 //size_t v83; // eax@120 | |
1351 //const void *v84; // edi@120 | |
1352 //const void *v85; // edi@120 | |
1353 //BSPModel *v86; // eax@124 | |
1354 //unsigned int v87; // eax@124 | |
1355 //BSPModel *v88; // eax@126 | |
1356 //BSPModel *v89; // eax@127 | |
1357 //ODMFace *v90; // eax@129 | |
1358 //const void *v91; // edi@138 | |
1359 //const void *v92; // edi@141 | |
1360 //const void *v93; // edi@141 | |
1361 //const void *v94; // edi@144 | |
1362 //const void *v95; // edi@144 | |
1363 //const char *v96; // edi@147 | |
1364 //unsigned int v97; // eax@147 | |
1365 //TileDesc *v98; // eax@147 | |
1366 //unsigned int v99; // eax@147 | |
1367 //int v100; // ecx@150 | |
1368 //unsigned int v101; // eax@157 | |
1369 int v102; // edi@159 | |
1370 //void *v103; // [sp-14h] [bp-B94h]@55 | |
1371 //void *v104; // [sp-10h] [bp-B90h]@59 | |
1372 //size_t v105; // [sp-Ch] [bp-B8Ch]@59 | |
1373 //char *v106; // [sp-8h] [bp-B88h]@59 | |
1374 int v107; // [sp-4h] [bp-B84h]@12 | |
1375 int v108; // [sp+0h] [bp-B80h]@10 | |
1376 char Src[968]; // [sp+10h] [bp-B70h]@110 | |
1377 char Dst[968]; // [sp+3D8h] [bp-7A8h]@50 | |
1378 char Str[256]; // [sp+7A0h] [bp-3E0h]@50 | |
1379 /*char DstBuf; // [sp+8A0h] [bp-2E0h]@10 | |
1380 __int32 Offset; // [sp+8A4h] [bp-2DCh]@10 | |
1381 __int32 v114; // [sp+8B0h] [bp-2D0h]@10 | |
1382 __int32 v115; // [sp+8BCh] [bp-2C4h]@10 | |
1383 __int32 v116; // [sp+8C8h] [bp-2B8h]@10 | |
1384 __int32 v117; // [sp+8D4h] [bp-2ACh]@10 | |
1385 __int32 v118; // [sp+8E0h] [bp-2A0h]@10 | |
1386 __int32 v119; // [sp+8ECh] [bp-294h]@10 | |
1387 __int32 v120; // [sp+8F8h] [bp-288h]@10 | |
1388 __int32 v121; // [sp+904h] [bp-27Ch]@10 | |
1389 __int32 v122; // [sp+910h] [bp-270h]@10 | |
1390 __int32 v123; // [sp+91Ch] [bp-264h]@10 | |
1391 __int32 v124; // [sp+928h] [bp-258h]@26 | |
1392 __int32 v125; // [sp+934h] [bp-24Ch]@35 | |
1393 __int32 v126; // [sp+940h] [bp-240h]@38 | |
1394 __int32 v127; // [sp+94Ch] [bp-234h]@38 | |
1395 __int32 v128; // [sp+958h] [bp-228h]@38 | |
1396 __int32 v129; // [sp+964h] [bp-21Ch]@38 | |
1397 __int32 v130; // [sp+970h] [bp-210h]@38 | |
1398 __int32 v131; // [sp+97Ch] [bp-204h]@38 | |
1399 __int32 v132; // [sp+988h] [bp-1F8h]@38 | |
1400 __int32 v133; // [sp+994h] [bp-1ECh]@38 | |
1401 __int32 v134; // [sp+9A0h] [bp-1E0h]@38 | |
1402 __int32 v135; // [sp+9ACh] [bp-1D4h]@38 | |
1403 __int32 v136; // [sp+9D0h] [bp-1B0h]@10*/ | |
1404 //char FileName[8]; // [sp+A20h] [bp-160h]@8 | |
1405 //char v138; // [sp+A28h] [bp-158h]@12 | |
1406 //int v139; // [sp+B1Ch] [bp-64h]@10 | |
1407 //char pContainer[32]; // [sp+B20h] [bp-60h]@1 | |
1408 //int *v141; // [sp+B40h] [bp-40h]@50 | |
1409 //__int64 v142; // [sp+B44h] [bp-3Ch]@55 | |
1410 //size_t pSource; // [sp+B4Ch] [bp-34h]@56 | |
1411 //int v144; // [sp+B50h] [bp-30h]@61 | |
1412 //int v145; // [sp+B54h] [bp-2Ch]@68 | |
1413 ODMHeader header; // [sp+B58h] [bp-28h]@50 | |
1414 //unsigned int pDestLen; // [sp+B68h] [bp-18h]@13 | |
1415 //FILE *ptr; // [sp+B6Ch] [bp-14h]@12 | |
1416 //void *v149; // [sp+B70h] [bp-10h]@19 | |
1417 char *Str2; // [sp+B74h] [bp-Ch]@12 | |
1418 //int v151; // [sp+B78h] [bp-8h]@59 | |
1419 //void *uSourceLen; // [sp+B7Ch] [bp-4h]@59 | |
1420 | |
1421 //pOutdoorLocation = this; | |
1422 //strcpy(pContainer, pFilename); | |
1423 | |
1424 if (bUnderwater) | |
1425 { | |
1426 pPaletteManager->pPalette_tintColor[0] = 0x10; | |
1427 pPaletteManager->pPalette_tintColor[1] = 0xC2; | |
1428 pPaletteManager->pPalette_tintColor[2] = 0x99; | |
762 | 1429 pPaletteManager->SetMistColor(37, 143, 92); |
0 | 1430 } |
1431 else | |
1432 { | |
1433 pPaletteManager->pPalette_tintColor[0] = 0; | |
1434 pPaletteManager->pPalette_tintColor[1] = 0; | |
1435 pPaletteManager->pPalette_tintColor[2] = 0; | |
1436 if (pPaletteManager->pPalette_mistColor[0] != 0x80 || | |
1437 pPaletteManager->pPalette_mistColor[1] != 0x80 || | |
1438 pPaletteManager->pPalette_mistColor[2] != 0x80) | |
1439 { | |
762 | 1440 pPaletteManager->SetMistColor(128, 128, 128); |
0 | 1441 pPaletteManager->RecalculateAll(); |
1442 } | |
1443 } | |
1444 | |
1445 _6807E0_num_decorations_with_sounds_6807B8 = 0; | |
1446 /*sprintf(FileName, "levels\\%s", pContainer); | |
1447 if ( GetFileAttributesA(FileName) != -1 ) | |
1448 { | |
1449 result = (bool)fopen(FileName, "rb"); | |
1450 v7 = result; | |
1451 File = (ODMFace *)result; | |
1452 if ( !result ) | |
1453 return result; | |
1454 *(int *)thisa = 1; | |
1455 v8 = strlen(pContainer); | |
1456 v108 = 2; | |
1457 *((char *)&v139 + v8) = 0; | |
1458 viewparams->uTextureID_LocationMap = pIcons_LOD->LoadTexture(pContainer, (enum TEXTURE_TYPE)v108); | |
1459 fread(&DstBuf, 0x180u, 1u, (FILE *)v7); | |
1460 fseek((FILE *)v7, Offset, 0); | |
1461 fread(this, 0xB0u, 1u, (FILE *)v7); | |
1462 LoadTileGroupIds(); | |
630 | 1463 LoadRoadTileset(); |
0 | 1464 strcpy(pGroundTileset, "grastyl"); |
1465 fseek((FILE *)v7, v114, 0); | |
1466 fread(&uNumBModels, 4u, 1u, (FILE *)v7); | |
1467 fseek((FILE *)v7, v115, 0); | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
1468 fread(&uNumSpriteObjects, 4u, 1u, (FILE *)v7); |
0 | 1469 fseek((FILE *)v7, v116, 0); |
1470 fread(&uNumLevelDecorations, 4u, 1u, (FILE *)v7); | |
1471 fseek((FILE *)v7, v117, 0); | |
1472 fread(&uNumActors, 4u, 1u, (FILE *)v7); | |
1473 fseek((FILE *)v7, v118, 0); | |
1474 fread(&uNumChests, 4u, 1u, (FILE *)v7); | |
1475 pTerrain.Initialize(); | |
1476 fseek((FILE *)v7, v119, 0); | |
1477 fread(pTerrain.pHeightmap, 1u, 0x4000u, (FILE *)v7); | |
1478 fseek((FILE *)v7, v120, 0); | |
1479 fread(pTerrain.pTilemap, 1u, 0x4000u, (FILE *)v7); | |
1480 fseek((FILE *)v7, v121, 0); | |
1481 fread(pTerrain.pAttributemap, 1u, 0x4000u, (FILE *)v7); | |
1482 pTerrain._47C80A(0, 0, 128, 128); | |
1483 pAllocator->FreeChunk(ptr_D4); | |
1484 ptr_D4 = 0; | |
1485 v9 = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP"); | |
1486 v108 = (int)pOMAP; | |
1487 ptr_D4 = v9; | |
1488 pAllocator->FreeChunk((void *)v108); | |
1489 pOMAP = 0; | |
1490 v10 = pAllocator->AllocNamedChunk(0, 0x10000u, "OMAP"); | |
1491 v108 = 0; | |
1492 pOMAP = (unsigned int *)v10; | |
1493 fseek((FILE *)v7, v136, v108); | |
1494 fread(&uNumTerrainNormals, 4u, 1u, (FILE *)v7); | |
1495 fread(pTerrainSomeOtherData, 1u, 0x20000u, (FILE *)v7); | |
1496 fread(pTerrainNormalIndices, 1u, 0x10000u, (FILE *)v7); | |
1497 pTerrainNormals = (Vec3_float_ *)pAllocator->AllocNamedChunk(pTerrainNormals, 12 * uNumTerrainNormals, "TerNorm"); | |
1498 fread(pTerrainNormals, 1u, 12 * uNumTerrainNormals, (FILE *)v7); | |
1499 v11 = pAllocator->AllocNamedChunk(pBModels, 188 * uNumBModels, "BDdata"); | |
1500 v108 = 0; | |
1501 pBModels = (BSPModel *)v11; | |
1502 fseek((FILE *)v7, v122, v108); | |
1503 fread(pBModels, 0xBCu, uNumBModels, (FILE *)v7); | |
1504 fseek((FILE *)v7, v123, 0); | |
1505 pNumItems = 0; | |
1506 if ( (signed int)uNumBModels > 0 ) | |
1507 { | |
1508 v12 = 0; | |
1509 while ( 1 ) | |
1510 { | |
1511 pBModels[v12].pVertices.pVertices = 0; | |
1512 pBModels[v12].pFaces = 0; | |
1513 pBModels[v12].pFacesOrdering = 0; | |
1514 pBModels[v12].pNodes = 0; | |
1515 FileName[0] = 0; | |
1516 v108 = (int)&pBModels[v12]; | |
1517 sprintfex(FileName, "%s", v108); | |
1518 v13 = pBModels; | |
1519 v138 = 0; | |
1520 pBModels[v12].pVertices.pVertices = (Vec3_int_ *)pAllocator->AllocNamedChunk(v13[v12].pVertices.pVertices, 12 * v13[v12].pVertices.uNumVertices, | |
1521 FileName); | |
1522 pBModels[v12].pFaces = (ODMFace *)pAllocator->AllocNamedChunk(pBModels[v12].pFaces, 308 * pBModels[v12].uNumFaces, | |
1523 FileName); | |
1524 pBModels[v12].pFacesOrdering = (unsigned __int16 *)pAllocator->AllocNamedChunk(pBModels[v12].pFacesOrdering, | |
1525 2 * pBModels[v12].uNumFaces, FileName); | |
1526 v14 = pAllocator->AllocNamedChunk(pBModels[v12].pNodes, 8 * pBModels[v12].uNumNodes, FileName); | |
1527 v15 = pBModels; | |
1528 v108 = (int)File; | |
1529 v15[v12].pNodes = (BSPNode *)v14; | |
1530 fread(pBModels[v12].pVertices.pVertices, 0xCu, pBModels[v12].pVertices.uNumVertices, (FILE *)v108); | |
1531 fread(pBModels[v12].pFaces, 0x134u, pBModels[v12].uNumFaces, (FILE *)File); | |
1532 fread(pBModels[v12].pFacesOrdering, 2u, pBModels[v12].uNumFaces, (FILE *)File); | |
1533 fread(pBModels[v12].pNodes, 8u, pBModels[v12].uNumNodes, (FILE *)File); | |
1534 v16 = malloc(10 * pBModels[v12].uNumFaces); | |
1535 v107 = (int)File; | |
1536 v17 = pBModels; | |
1537 ptr = (FILE *)v16; | |
1538 fread(v16, 0xAu, v17[v12].uNumFaces, (FILE *)File); | |
1539 v18 = pBModels; | |
1540 Str2 = 0; | |
1541 if ( (signed int)v18[v12].uNumFaces > 0 ) | |
1542 break; | |
1543 LABEL_25: | |
1544 free(ptr); | |
1545 ++pNumItems; | |
1546 ++v12; | |
1547 if ( (signed int)pNumItems >= (signed int)uNumBModels ) | |
1548 goto LABEL_26; | |
1549 } | |
1550 pDestLen = 0; | |
1551 pFilename = (char *)ptr; | |
1552 while ( 1 ) | |
1553 { | |
1554 thisa = (int)((char *)v18[v12].pFaces + pDestLen); | |
1555 if ( !(*(char *)(thisa + 29) & 0x40) ) | |
1556 break; | |
1557 v19 = pTextureFrameTable->FindTextureByName(pFilename); | |
1558 *(short *)(thisa + 272) = v19; | |
1559 if ( !v19 ) | |
1560 { | |
1561 v20 = pBitmaps_LOD->LoadTexture(pFilename); | |
1562 v21 = thisa; | |
1563 *(char *)(v21 + 29) &= 0xBFu; | |
1564 LABEL_19: | |
1565 *(short *)(v21 + 272) = v20; | |
1566 v149 = (void *)(v20 != -1 ? &pBitmaps_LOD->pTextures[v20] : 0); | |
1567 auto pTex = (Texture *)v149; | |
1568 if (pTex) | |
1569 pTex->palette_id2 = pPaletteManager->LoadPalette(pTex->palette_id1); | |
1570 goto LABEL_20; | |
1571 } | |
1572 pTextureFrameTable->LoadAnimationSequenceAndPalettes(*(unsigned __int16 *)((char *)&pBModels[v12].pFaces->uTextureID + pDestLen)); | |
1573 LABEL_20: | |
1574 if ( *(short *)(thisa + 292) ) | |
1575 { | |
1576 if ( ((ODMFace *)thisa)->HasEventHint() ) | |
1577 *(char *)(thisa + 30) |= 0x10u; | |
1578 else | |
1579 *(char *)(thisa + 30) &= 0xEFu; | |
1580 } | |
1581 ++Str2; | |
1582 v18 = pBModels; | |
1583 pDestLen += 308; | |
1584 pFilename += 10; | |
1585 if ( (signed int)Str2 >= (signed int)v18[v12].uNumFaces ) | |
1586 goto LABEL_25; | |
1587 } | |
1588 v20 = pBitmaps_LOD->LoadTexture(pFilename); | |
1589 v21 = thisa; | |
1590 goto LABEL_19; | |
1591 } | |
1592 LABEL_26: | |
1593 v22 = File; | |
1594 fseek((FILE *)File, v124, 0); | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
1595 fread(pSpriteObjects, 0x70u, uNumSpriteObjects, (FILE *)v22); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
1596 if ( (signed int)uNumSpriteObjects > 0 ) |
0 | 1597 { |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
1598 pItems = pSpriteObjects; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
1599 pNumItems = uNumSpriteObjects; |
0 | 1600 do |
1601 { | |
1602 v24 = pItems->stru_24.uItemID; | |
1603 thisa = 0; | |
1604 v27 = (ODMFace *)(48 * v24); | |
1605 v25 = pObjectList->uNumObjects == 0; | |
1606 v26 = (pObjectList->uNumObjects & 0x80000000u) != 0; | |
1607 LOWORD(v27) = *(short *)((char *)&v27->pFacePlane.vNormal.x + (int)((char *)&pItemsTable + 24)); | |
1608 File = v27; | |
1609 pItems->uItemType = (unsigned __int16)v27; | |
1610 if ( v26 | v25 ) | |
1611 { | |
1612 LABEL_33: | |
1613 v29 = 0; | |
1614 } | |
1615 else | |
1616 { | |
1617 for ( i = (const char *)&pObjectList->pObjects->uObjectID; (short)v27 != *(short *)i; i = pFilename ) | |
1618 { | |
1619 ++thisa; | |
1620 pFilename = (char *)i + 56; | |
1621 if ( thisa >= (signed int)pObjectList->uNumObjects ) | |
1622 goto LABEL_33; | |
1623 LOWORD(v27) = (short)File; | |
1624 } | |
1625 v29 = thisa; | |
1626 } | |
1627 pItems->uObjectDescID = v29; | |
1628 ++pItems; | |
1629 --pNumItems; | |
1630 } | |
1631 while ( pNumItems ); | |
1632 } | |
1633 fseek((FILE *)v22, v125, 0); | |
1634 fread(pLevelDecorations, 0x20u, uNumLevelDecorations, (FILE *)v22); | |
1635 pNumItems = 0; | |
1636 if ( (signed int)uNumLevelDecorations > 0 ) | |
1637 { | |
1638 thisa = (int)pLevelDecorations; | |
1639 do | |
1640 { | |
1641 fread(FileName, 1u, 0x20u, (FILE *)v22); | |
1642 v30 = pDecorationList->GetDecorIdByName(FileName); | |
1643 v31 = thisa; | |
1644 ++pNumItems; | |
1645 thisa += 32; | |
1646 *(short *)v31 = v30; | |
1647 } | |
1648 while ( (signed int)pNumItems < (signed int)uNumLevelDecorations ); | |
1649 } | |
1650 fseek((FILE *)v22, v126, 0); | |
1651 fread(pActors, 0x344u, uNumActors, (FILE *)v22); | |
1652 fseek((FILE *)v22, v127, 0); | |
1653 fread(pChests, 0x14CCu, uNumChests, (FILE *)v22); | |
1654 fseek((FILE *)v22, v128, 0); | |
1655 fread(&field_DC, 4u, 1u, (FILE *)v22); | |
1656 pAllocator->FreeChunk(pFaceIDLIST); | |
1657 v32 = field_DC; | |
1658 pFaceIDLIST = 0; | |
1659 v33 = pAllocator->AllocNamedChunk(0, 2 * v32, "IDLIST"); | |
1660 v108 = (int)v22; | |
1661 pFaceIDLIST = (unsigned __int16 *)v33; | |
1662 fread(v33, 2u, field_DC, (FILE *)v108); | |
1663 fseek((FILE *)v22, v129, 0); | |
1664 fread(pOMAP, 4u, 0x4000u, (FILE *)v22); | |
1665 fseek((FILE *)v22, v130, 0); | |
1666 fread(&uNumSpawnPoints, 4u, 1u, (FILE *)v22); | |
1667 pSpawnPoints = (SpawnPointMM7 *)pAllocator->AllocNamedChunk(pSpawnPoints, 24 * uNumSpawnPoints, "Spawn"); | |
1668 fseek((FILE *)v22, v131, 0); | |
1669 fread(pSpawnPoints, 0x18u, uNumSpawnPoints, (FILE *)v22); | |
1670 fseek((FILE *)v22, v132, 0); | |
1671 fread(&ddm, 0x28u, 1u, (FILE *)v22); | |
1672 fseek((FILE *)v22, v133, 0); | |
1673 fread(&stru_5E4C90, 1u, 0xC8u, (FILE *)v22); | |
1674 fseek((FILE *)v22, v134, 0); | |
1675 fread(&uLastVisitDay, 1u, 0x38u, (FILE *)v22); | |
1676 fseek((FILE *)v22, v135, 0); | |
1677 fread(&uLastVisitDay, 1u, 4u, (FILE *)v22); | |
1678 thisa = (int)pTileTypes; | |
1679 pTileTable->InitializeTileset(4); | |
1680 pTileTable->InitializeTileset(pTileTypes[0].uTileGroup); | |
1681 pTileTable->InitializeTileset(pTileTypes[1].uTileGroup); | |
1682 pTileTable->InitializeTileset(pTileTypes[2].uTileGroup); | |
1683 pTileTable->InitializeTileset(pTileTypes[3].uTileGroup); | |
1684 if ( this != (OutdoorLocation *)-96 && pSkyTextureName[0] ) | |
1685 { | |
1686 v108 = 0; | |
1687 v107 = (int)pSkyTextureName; | |
1688 } | |
1689 else | |
1690 { | |
1691 v108 = 0; | |
1692 v107 = (int)pDefaultSkyTexture; | |
1693 } | |
1694 uSky_TextureID = pBitmaps_LOD->LoadTexture((const char *)v107, (enum TEXTURE_TYPE)v108); | |
1695 strcpy(pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture); | |
1696 v34 = pTileTable->GetTileById(pTileTypes[0].uTileID); | |
1697 v35 = pBitmaps_LOD->LoadTexture(v34->pTileName); | |
1698 v36 = uSky_TextureID; | |
1699 uMainTile_BitmapID = v35; | |
1700 if ( v36 != -1 ) | |
1701 pBitmaps_LOD->pTextures[v36].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v36].palette_id1); | |
1702 | |
1703 v37 = uMainTile_BitmapID; | |
1704 if ( v37 != -1 ) | |
1705 pBitmaps_LOD->pTextures[v37].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v37].palette_id1); | |
1706 | |
1707 _47F0E2(); | |
1708 pGameLoadingUI_ProgressBar->Progress(); | |
1709 fclose((FILE *)v22); | |
1710 goto LABEL_150; | |
1711 }*/ | |
1712 | |
1713 assert(sizeof(BSPModel) == 188); | |
1714 | |
1715 if (!pGames_LOD->DoesContainerExist(pFilename)) | |
1716 Abortf("Unable to find %s in Games.LOD", pFilename); | |
1717 | |
119 | 1718 |
1719 char pMinimapTextureFilename[1024]; | |
1720 strcpy(pMinimapTextureFilename, pFilename); | |
1721 pMinimapTextureFilename[strlen(pMinimapTextureFilename) - 4] = 0; | |
1722 viewparams->uTextureID_LocationMap = pIcons_LOD->LoadTexture(pMinimapTextureFilename, TEXTURE_16BIT_PALETTE); | |
1723 | |
0 | 1724 //strcpy(FileName, pContainer); |
1725 strcpy(Str, pFilename); | |
1726 strcpy(Str + strlen(Str) - 4, ".odm"); | |
1727 //v141 = &v139; | |
1728 //v38 = strlen(pFilename); | |
1729 //strcpy((char *)&v139 + v38, ".odm"); | |
1730 v39 = pGames_LOD->FindContainer(Str, 1); | |
1731 //Str[strlen(Str) - 4] = 0; | |
1732 | |
1733 header.uCompressedSize = 0; | |
1734 header.uDecompressedSize = 0; | |
1735 //ptr = v39; | |
1736 header.uVersion = 91969; | |
1737 header.pMagic[0] = 'm'; | |
1738 header.pMagic[1] = 'v'; | |
1739 header.pMagic[2] = 'i'; | |
1740 header.pMagic[3] = 'i'; | |
1741 fread(&header, 0x10u, 1u, v39); | |
1742 if (header.uVersion != 91969 || | |
1743 header.pMagic[0] != 'm' || | |
1744 header.pMagic[1] != 'v' || | |
1745 header.pMagic[2] != 'i' || | |
1746 header.pMagic[3] != 'i') | |
1747 { | |
1748 MessageBoxW(nullptr, L"Can't load file!", | |
1749 L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:507", 0); | |
1750 } | |
1751 //v40 = header.uCompressedSize; | |
1752 //pSource = header.uDecompressedSize; | |
1753 //v41 = malloc(header.uDecompressedSize); | |
1754 auto pSrcMem = (unsigned char *)malloc(header.uDecompressedSize); | |
1755 auto pSrc = pSrcMem; | |
1756 //v42 = v41; | |
1757 //HIDWORD(v142) = (uint32)pSrc; | |
1758 if (header.uCompressedSize < header.uDecompressedSize) | |
1759 { | |
1760 auto pComressedSrc = (char *)malloc(header.uCompressedSize); | |
1761 fread(pComressedSrc, header.uCompressedSize, 1, v39); | |
1762 | |
1763 uint actualDecompressedSize = header.uDecompressedSize; | |
1764 zlib::MemUnzip(pSrc, &actualDecompressedSize, pComressedSrc, header.uCompressedSize); | |
1765 free(pComressedSrc); | |
1766 } | |
1767 else | |
1768 { | |
1769 fread(pSrc, header.uDecompressedSize, 1, v39); | |
1770 } | |
1771 | |
1772 memcpy(pLevelFilename, pSrc, 0x20); | |
1773 memcpy(pLocationFileName, pSrc + 0x20, 0x20); | |
1774 memcpy(pLocationFileDescription, pSrc + 0x40, 0x20); | |
67 | 1775 memcpy(pSkyTextureName, pSrc + 3 * 32, 32); |
0 | 1776 memcpy(pGroundTileset, pSrc + 0x80, 0x20); |
1777 memcpy(pTileTypes, pSrc + 0xA0, 0x10); | |
1778 pSrc += 0xB0; | |
1779 | |
1780 //v43 = (char *)pSrc + 176; | |
1781 LoadTileGroupIds(); | |
630 | 1782 LoadRoadTileset(); |
0 | 1783 strcpy(pGroundTileset, "grastyl"); |
1784 pGameLoadingUI_ProgressBar->Progress(); | |
1785 pTerrain.Initialize(); | |
1786 //v108 = 16384; | |
1787 //v107 = (int)v43; | |
1788 //v106 = (char *)pTerrain.pHeightmap; | |
1789 memcpy(pTerrain.pHeightmap, pSrc, 0x4000); | |
1790 pSrc += 0x4000; | |
1791 | |
1792 //v43 = (char *)v43 + 16384; | |
1793 //v105 = 16384; | |
1794 //v104 = (void *)v43; | |
1795 //v103 = pTerrain.pTilemap; | |
1796 memcpy(pTerrain.pTilemap, pSrc, 0x4000); | |
1797 pSrc += 0x4000; | |
1798 | |
1799 //v43 = (char *)v43 + 16384; | |
1800 memcpy(pTerrain.pAttributemap, pSrc, 0x4000); | |
1801 pSrc += 0x4000; | |
1802 | |
1803 //v43 = (char *)v43 + 16384; | |
1804 //v108 = (int)ptr_D4; | |
760 | 1805 if (pCmap) |
0 | 1806 { |
760 | 1807 pAllocator->FreeChunk(pCmap); |
1808 pCmap = nullptr; | |
0 | 1809 } |
760 | 1810 pCmap = pAllocator->AllocNamedChunk(0, 0x8000u, "CMAP"); |
1811 pTerrain.FillDMap(0, 0, 128, 128); | |
0 | 1812 |
1813 pGameLoadingUI_ProgressBar->Progress(); | |
1814 memcpy(&uNumTerrainNormals, pSrc, 4); | |
1815 //v43 = (char *)v43 + 4; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1816 memcpy(pTerrainSomeOtherData.data(), pSrc + 4, 0x20000); |
0 | 1817 pSrc += 4 + 0x20000; |
1818 //v43 = (char *)v43 + 131072; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
1819 memcpy(pTerrainNormalIndices.data(), pSrc, 0x10000); |
0 | 1820 pSrc += 0x10000; |
1821 //v43 = (char *)v43 + 65536; | |
1822 | |
1823 //pFilename = (char *)(12 * uNumTerrainNormals); | |
1824 pTerrainNormals = (Vec3_float_ *)pAllocator->AllocNamedChunk(pTerrainNormals, 12 * uNumTerrainNormals, "TerNorm"); | |
1825 memcpy(pTerrainNormals, pSrc, 12 * uNumTerrainNormals); | |
1826 pSrc += 12 * uNumTerrainNormals; | |
1827 //v44 = (char *)v43 + (int)pFilename; | |
1828 //v44 = (char *)v44 + 4; | |
1829 //v45 = uNumBModels; | |
1830 //v108 = (int)"BDdata"; | |
1831 | |
1832 pGameLoadingUI_ProgressBar->Progress(); | |
1833 | |
1834 //v107 = 188 * v45; | |
1835 //v106 = (char *)pBModels; | |
1836 //v46 = (BSPModel *)pAllocator->AllocNamedChunk(v106, 188 * v45, "BDdata"); | |
1837 //v47 = uNumBModels; | |
1838 memcpy(&uNumBModels, pSrc, 4); | |
1839 pBModels = (BSPModel *)pAllocator->AllocNamedChunk(pBModels, 188 * uNumBModels, "BDdata"); | |
1840 //pFilename = (char *)(188 * v47); | |
1841 memcpy(pBModels, pSrc + 4, 188 * uNumBModels); | |
1842 pSrc += 4 + 188 * uNumBModels; | |
1843 | |
1844 pGameLoadingUI_ProgressBar->Progress(); | |
1845 | |
1846 //uSourceLen = (char *)v44 + (int)pFilename; | |
1847 //v151 = 0; | |
1848 for (uint i = 0; i < uNumBModels; ++i) | |
1849 { | |
1850 //v48 = 0; | |
80 | 1851 auto model = &pBModels[i]; |
0 | 1852 |
1853 model->pVertices.pVertices = nullptr; | |
1854 model->pFaces = nullptr; | |
1855 model->pFacesOrdering = nullptr; | |
1856 model->pNodes = nullptr; | |
1857 //FileName[0] = 0; | |
1858 //v108 = (int)&pBModels[i]; | |
1859 //sprintf(FileName, "%s", v108); | |
1860 //v49 = pBModels; | |
1861 //v138 = 0; | |
1862 //v50 = &pBModels[v48]; | |
1863 //v108 = (int)FileName; | |
1864 //v107 = 12 * v50->pVertices.uNumVertices; | |
1865 //v106 = (char *)v50->pVertices.pVertices; | |
1866 assert(sizeof(Vec3_int_) == 12); | |
1867 uint verticesSize = model->pVertices.uNumVertices * sizeof(Vec3_int_); | |
1868 model->pVertices.pVertices = (Vec3_int_ *)pAllocator->AllocNamedChunk(model->pVertices.pVertices, verticesSize, ""); | |
1869 memcpy(model->pVertices.pVertices, pSrc, verticesSize); | |
1870 pSrc += verticesSize; | |
1871 //v51 = &pBModels[v48]; | |
1872 //v108 = (int)FileName; | |
1873 //v107 = 308 * v51->uNumFaces; | |
1874 //v106 = (char *)v51->pFaces; | |
1875 assert(sizeof(ODMFace) == 308); | |
1876 uint facesSize = model->uNumFaces * sizeof(ODMFace); | |
1877 model->pFaces = (ODMFace *)pAllocator->AllocNamedChunk(model->pFaces, facesSize, ""); | |
1878 memcpy(model->pFaces, pSrc, facesSize); | |
1879 pSrc += facesSize; | |
1880 //v52 = &pBModels[v48]; | |
1881 //v108 = (int)FileName; | |
1882 //v107 = 2 * v52->uNumFaces; | |
1883 //v106 = (char *)v52->pFacesOrdering; | |
1884 uint facesOrderingSize = model->uNumFaces * sizeof(short); | |
1885 model->pFacesOrdering = (unsigned __int16 *)pAllocator->AllocNamedChunk(model->pFacesOrdering, facesOrderingSize, ""); | |
1886 memcpy(model->pFacesOrdering, pSrc, facesOrderingSize); | |
1887 pSrc += facesOrderingSize; | |
1888 //v53 = &pBModels[v48]; | |
1889 //v108 = (int)FileName; | |
1890 //v107 = 8 * v53->uNumNodes; | |
1891 //v106 = (char *)v53->pNodes; | |
1892 assert(sizeof(BSPNode) == 8); | |
1893 uint nodesSize = model->uNumNodes * sizeof(BSPNode); | |
1894 model->pNodes = (BSPNode *)pAllocator->AllocNamedChunk(model->pNodes, nodesSize, ""); | |
1895 memcpy(model->pNodes, pSrc, nodesSize); | |
1896 pSrc += nodesSize; | |
1897 //v54 = &pBModels[v48]; | |
1898 //v108 = 12 * v54->pVertices.uNumVertices; | |
1899 //pFilename = (char *)v108; | |
1900 //v107 = (int)uSourceLen; | |
1901 //v106 = (char *)v54->pVertices.pVertices; | |
1902 //memcpy(v106, uSourceLen, v108); | |
1903 //uSourceLen = (char *)uSourceLen + (int)pFilename; | |
1904 //v55 = &pBModels[v48]; | |
1905 //v105 = 308 * v55->uNumFaces; | |
1906 //v104 = uSourceLen; | |
1907 //v103 = v55->pFaces; | |
1908 //pFilename = (char *)v105; | |
1909 //memcpy(v103, uSourceLen, v105); | |
1910 //v56 = &pBModels[v48]; | |
1911 //uSourceLen = (char *)uSourceLen + (int)pFilename; | |
1912 //v57 = v56->pFacesOrdering; | |
1913 //pFilename = (char *)(2 * v56->uNumFaces); | |
1914 //memcpy(v57, uSourceLen, (size_t)pFilename); | |
1915 //v58 = &pBModels[v48]; | |
1916 //uSourceLen = (char *)uSourceLen + (int)pFilename; | |
1917 //v59 = v58->pNodes; | |
1918 //pFilename = (char *)(8 * v58->uNumNodes); | |
1919 //memcpy(v59, uSourceLen, (size_t)pFilename); | |
1920 //uSourceLen = (char *)uSourceLen + (int)pFilename; | |
1921 //ptr = (FILE *)malloc(10 * model->uNumFaces); | |
1922 auto textureFilenames = (const char *)malloc(10 * model->uNumFaces); | |
1923 //pFilename = (char *)(10 * pBModels[v48].uNumFaces); | |
1924 memcpy((char *)textureFilenames, pSrc, 10 * model->uNumFaces); | |
1925 pSrc += 10 * model->uNumFaces; | |
1926 //v144 = 0; | |
1927 //uSourceLen = (char *)uSourceLen + (int)pFilename; | |
1928 //v60 = pBModels; | |
1929 for (uint j = 0; j < model->uNumFaces; ++j) | |
1930 { | |
1931 auto texFilename = textureFilenames + j * 10; | |
1932 //v149 = 0; | |
1933 //Str2 = (char *)ptr; | |
1934 | |
80 | 1935 auto *face = &model->pFaces[j]; |
0 | 1936 //pFilename = (char *)v149 + (unsigned int)v60[v48].pFaces; |
1030 | 1937 if (~face->uAttributes & FACE_DONT_CACHE_TEXTURE) |
0 | 1938 { |
1939 v62 = pBitmaps_LOD->LoadTexture(texFilename); | |
1940 // v63 = (ODMFace *)pFilename; | |
1941 goto LABEL_68; | |
1942 } | |
1943 //v61 = pTextureFrameTable->FindTextureByName(texFilename); | |
1944 face->uTextureID = pTextureFrameTable->FindTextureByName(texFilename); | |
1945 if (!face->uTextureID) | |
1946 { | |
1947 v62 = pBitmaps_LOD->LoadTexture(texFilename); | |
1948 //v63 = (ODMFace *)pFilename; | |
1030 | 1949 face->uAttributes &= ~FACE_DONT_CACHE_TEXTURE; |
0 | 1950 LABEL_68: |
1951 face->uTextureID = v62; | |
1952 //v145 = (signed __int16)v62 != -1 ? &pBitmaps_LOD->pTextures[(signed __int16)v62] : 0; | |
1953 //v108 = ((signed __int16)v62 != -1 ? pBitmaps_LOD->pTextures[(signed __int16)v62].palette_id1 : 36); | |
1954 if ((signed __int16)v62 != -1) | |
1955 pBitmaps_LOD->pTextures[v62].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v62].palette_id1); | |
1956 goto LABEL_69; | |
1957 } | |
1958 pTextureFrameTable->LoadAnimationSequenceAndPalettes(face->uTextureID); | |
1959 LABEL_69: | |
1960 if (face->sCogTriggeredID) | |
1961 { | |
1962 if (face->HasEventHint()) | |
1030 | 1963 face->uAttributes |= 0x1000; |
0 | 1964 else |
1030 | 1965 face->uAttributes &= ~0x1000; |
0 | 1966 } |
1967 //++v144; | |
1968 //v60 = pBModels; | |
1969 //v149 = (char *)v149 + 308; | |
1970 //Str2 += 10; | |
1971 //if ( v144 >= (signed int)v60[v48].uNumFaces ) | |
1972 //goto LABEL_74; | |
1973 } | |
1974 | |
1975 //LABEL_74: | |
1976 free((void *)textureFilenames); | |
1977 // ++v151; | |
1978 // ++v48; | |
1979 // if ( v151 >= (signed int)uNumBModels ) | |
1980 // goto LABEL_75; | |
1981 } | |
1982 //LABEL_75: | |
1983 pGameLoadingUI_ProgressBar->Progress(); | |
1984 | |
1985 memcpy(&uNumLevelDecorations, pSrc, 4u); | |
1986 //uSourceLen = (char *)uSourceLen + 4; | |
1987 if (uNumLevelDecorations > 3000) | |
1988 MessageBoxW(nullptr, L"Can't load file!", | |
1989 L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:678", 0); | |
1990 | |
1991 assert(sizeof(LevelDecoration) == 32); | |
1992 //pFilename = (char *)(32 * uNumLevelDecorations); | |
1202 | 1993 memcpy(pLevelDecorations.data(), pSrc + 4, uNumLevelDecorations * sizeof(LevelDecoration)); |
760 | 1994 pSrc += 4 + sizeof(LevelDecoration) * uNumLevelDecorations; |
0 | 1995 |
1996 pGameLoadingUI_ProgressBar->Progress(); | |
1997 | |
1998 //v151 = 0; | |
1999 //uSourceLen = (char *)uSourceLen + (int)pFilename; | |
2000 for (uint i = 0; i < uNumLevelDecorations; ++i) | |
2001 { | |
2002 char name[256]; | |
760 | 2003 memcpy(name, pSrc, sizeof(LevelDecoration)); |
2004 pSrc += sizeof(LevelDecoration); | |
0 | 2005 |
2006 pLevelDecorations[i].uDecorationDescID = pDecorationList->GetDecorIdByName(name); | |
2007 } | |
2008 | |
2009 pGameLoadingUI_ProgressBar->Progress(); | |
2010 | |
2011 memcpy(&numFaceIDListElems, pSrc, 4); | |
2012 | |
2013 //uSourceLen = (char *)uSourceLen + 4; | |
2014 //v108 = (int)pFaceIDLIST; | |
2015 if (pFaceIDLIST) | |
2016 { | |
2017 pAllocator->FreeChunk(pFaceIDLIST); | |
2018 pFaceIDLIST = nullptr; | |
2019 } | |
2020 //v66 = field_DC; | |
2021 //pFaceIDLIST = 0; | |
2022 //v67 = pAllocator->AllocNamedChunk(0, 2 * v66, "IDLIST"); | |
2023 uint faceIDListSize = 2 * numFaceIDListElems; | |
2024 pFaceIDLIST = (unsigned short *)pAllocator->AllocNamedChunk(0, faceIDListSize, "IDLIST"); | |
2025 //v68 = field_DC; | |
2026 //pFaceIDLIST = (unsigned __int16 *)v67; | |
2027 //pFilename = (char *)(2 * v68); | |
2028 memcpy(pFaceIDLIST, pSrc + 4, faceIDListSize); | |
2029 pSrc += 4 + faceIDListSize; | |
2030 | |
2031 //uSourceLen = (char *)uSourceLen + (int)pFilename; | |
2032 pGameLoadingUI_ProgressBar->Progress(); | |
2033 | |
2034 //v108 = (int)pOMAP; | |
2035 //pAllocator->FreeChunk((void *)v108); | |
2036 //pOMAP = 0; | |
2037 if (pOMAP) | |
2038 { | |
2039 pAllocator->FreeChunk(pOMAP); | |
2040 pOMAP = nullptr; | |
2041 } | |
2042 //v69 = pAllocator->AllocNamedChunk(0, 0x10000u, "OMAP"); | |
2043 pOMAP = (unsigned int *)pAllocator->AllocNamedChunk(0, 0x10000, "OMAP"); | |
2044 //v108 = 65536; | |
2045 //pOMAP = (unsigned int *)v69; | |
2046 memcpy(pOMAP, pSrc, 65536); | |
2047 pSrc += 65536; | |
2048 | |
2049 //uSourceLen = (char *)uSourceLen + 65536; | |
2050 pGameLoadingUI_ProgressBar->Progress(); | |
2051 | |
2052 memcpy(&uNumSpawnPoints, pSrc, 4); | |
2053 //uSourceLen = (char *)uSourceLen + 4; | |
2054 pGameLoadingUI_ProgressBar->Progress(); | |
2055 //v70 = uNumSpawnPoints; | |
2056 //v108 = (int)"Spawn"; | |
2057 //v107 = 24 * v70; | |
2058 //v106 = (char *)pSpawnPoints; | |
2059 assert(sizeof(SpawnPointMM7) == 24); | |
2060 uint spawnPointsSize = uNumSpawnPoints * sizeof(SpawnPointMM7); | |
2061 pSpawnPoints = (SpawnPointMM7 *)pAllocator->AllocNamedChunk(pSpawnPoints, spawnPointsSize, "Spawn"); | |
2062 //v72 = uNumSpawnPoints; | |
2063 //pSpawnPoints = v71; | |
2064 memcpy(pSpawnPoints, pSrc + 4, spawnPointsSize); | |
2065 pSrc += 4 + spawnPointsSize; | |
2066 | |
2067 pGameLoadingUI_ProgressBar->Progress(); | |
2068 | |
2069 free(pSrcMem); | |
2070 | |
2071 //v108 = (int)".ddm"; | |
2072 //v73 = strlen(pContainer); | |
2073 strcpy(Str + strlen(Str) - 4, ".ddm"); | |
2074 //strcpy((char *)v141 + v73, (const char *)v108); | |
2075 v39 = pNew_LOD->FindContainer(Str, 1);// | |
2076 fread(&header, 0x10u, 1u, v39); | |
2077 Str2 = 0; | |
2078 if (header.uVersion != 91969 || | |
2079 header.pMagic[0] != 'm' || | |
2080 header.pMagic[1] != 'v' || | |
2081 header.pMagic[2] != 'i' || | |
2082 header.pMagic[3] != 'i' ) | |
2083 { | |
187 | 2084 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:746", 0); |
0 | 2085 Str2 = (char *)1; |
2086 } | |
2087 //v74 = 0; | |
2088 //pFilename = (char *)header.uCompressedSize; | |
2089 //v149 = 0; | |
2090 //pDestLen = header.uDecompressedSize; | |
2091 if ( !Str2 ) | |
2092 { | |
2093 pSrcMem = (unsigned char *)malloc(header.uDecompressedSize); | |
2094 pSrc = pSrcMem; | |
2095 //v149 = v75; | |
2096 if (header.uCompressedSize == header.uDecompressedSize) | |
2097 fread(pSrc, header.uDecompressedSize, 1u, v39); | |
2098 else if (header.uCompressedSize < header.uDecompressedSize) | |
2099 { | |
2100 auto compressedMem = malloc(header.uCompressedSize); | |
2101 fread(compressedMem, header.uCompressedSize, 1, v39); | |
2102 | |
2103 uint actualDecompressedSize = header.uDecompressedSize; | |
2104 zlib::MemUnzip(pSrc, &actualDecompressedSize, compressedMem, header.uCompressedSize); | |
2105 free(compressedMem); | |
2106 } | |
2107 else | |
2108 MessageBoxW(nullptr, L"Can't load file!", | |
2109 L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:765", 0); | |
2110 | |
2111 assert(sizeof(DDM_DLV_Header) == 0x28); | |
2112 memcpy(&ddm, pSrc, sizeof(DDM_DLV_Header)); | |
2113 pSrc += sizeof(DDM_DLV_Header); | |
2114 //v74 = (int)((char *)v75 + 40); | |
2115 } | |
2116 //v76 = uNumBModels; | |
2117 //v77 = actualNumFacesInLevel = 0; | |
2118 uint actualNumFacesInLevel = 0; | |
2119 for (uint i = 0; i < uNumBModels; ++i) | |
80 | 2120 actualNumFacesInLevel += pBModels[i].uNumFaces; |
0 | 2121 |
2122 //v79 = ddm.uNumFacesInBModels; | |
2123 if (ddm.uNumFacesInBModels) | |
2124 { | |
2125 if ( ddm.uNumBModels ) | |
2126 { | |
2127 //v80 = ddm.uNumDecorations; | |
2128 if (ddm.uNumDecorations) | |
2129 { | |
2130 if (ddm.uNumFacesInBModels != actualNumFacesInLevel || | |
2131 ddm.uNumBModels != uNumBModels || | |
2132 ddm.uNumDecorations != uNumLevelDecorations ) | |
2133 Str2 = (char *)1; | |
2134 } | |
2135 } | |
2136 } | |
2137 | |
2138 if ( BYTE1(dword_6BE364_game_settings_1) & 0x20 ) | |
2139 pNumItems = 29030400; | |
2140 if ( Str2 ) | |
2141 { | |
2142 memset(Dst, 0, 0x3C8u); | |
2143 memset(Src, 0, 0x3C8u); | |
2144 goto LABEL_112; | |
2145 } | |
2146 //v81 = ddm.uLastRepawnDay; | |
2147 if ((unsigned int)((char *)File - ddm.uLastRepawnDay) >= pNumItems || !ddm.uLastRepawnDay) | |
2148 { | |
2149 memcpy(Dst, pSrc, 0x3C8u); | |
2150 memcpy(Src, pSrc + 968, 0x3C8u); | |
2151 LABEL_112: | |
2152 free(pSrcMem); | |
2153 | |
2154 ddm.uLastRepawnDay = (int)File; | |
2155 if (Str2 == 0) | |
2156 ++ddm.uNumRespawns; | |
2157 v108 = 0; | |
2158 *(int *)thisa = 1; | |
2159 v39 = pGames_LOD->FindContainer(Str, 0); | |
2160 fread(&header, 0x10, 1u, v39); | |
2161 //pFilename = (char *)header.uCompressedSize; | |
2162 //pDestLen = header.uDecompressedSize; | |
2163 //v82 = malloc(header.uDecompressedSize); | |
2164 pSrcMem = (unsigned char *)malloc(header.uDecompressedSize); | |
2165 //v149 = v82; | |
2166 if (header.uCompressedSize == header.uDecompressedSize) | |
2167 fread(pSrcMem, header.uDecompressedSize, 1, v39); | |
2168 else if (header.uCompressedSize < header.uDecompressedSize) | |
2169 { | |
2170 auto compressedMem = malloc(header.uCompressedSize); | |
2171 fread(compressedMem, header.uCompressedSize, 1u, v39); | |
2172 | |
2173 uint actualDecompressedSize = header.uDecompressedSize; | |
2174 zlib::MemUnzip(pSrcMem, &actualDecompressedSize, compressedMem, header.uCompressedSize); | |
2175 free(compressedMem); | |
2176 } | |
2177 else | |
2178 MessageBoxW(nullptr, L"Can't load file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:857", 0); | |
2179 | |
2180 pSrc = pSrcMem + 40; | |
2181 goto LABEL_120; | |
2182 | |
2183 } | |
2184 *(int *)thisa = 0; | |
2185 LABEL_120: | |
2186 //v108 = (int)".odm"; | |
2187 //v83 = strlen(pContainer); | |
2188 //strcpy((char *)v141 + v83, (const char *)v108); | |
752 | 2189 memcpy(uUndiscoveredArea, pSrc, 0x3C8); |
0 | 2190 //v84 = (const void *)(v74 + 968); |
752 | 2191 memcpy(uDicovered_area, pSrc + 0x3C8, 0x3C8); |
0 | 2192 pSrc += 2 * 0x3C8; |
2193 //v85 = (char *)v84 + 968; | |
2194 | |
2195 pGameLoadingUI_ProgressBar->Progress(); | |
2196 | |
2197 if ( *(int *)thisa ) | |
2198 { | |
752 | 2199 memcpy(uUndiscoveredArea, Dst, 0x3C8u); |
2200 memcpy(uDicovered_area, Src, 0x3C8u); | |
0 | 2201 } |
2202 | |
2203 //v25 = uNumBModels == 0; | |
2204 //v26 = (uNumBModels & 0x80000000u) != 0; | |
2205 //v151 = 0; | |
2206 for (uint i = 0; i < uNumBModels; ++i) | |
2207 { | |
79 | 2208 auto model = pBModels[i]; |
0 | 2209 //pNumItems = 0; |
2210 //do | |
2211 //{ | |
2212 //v86 = pBModels; | |
2213 //thisa = 0; | |
2214 //v87 = (unsigned int)((char *)v86 + pNumItems); | |
79 | 2215 for (uint j = 0; j < model.uNumFaces; ++j) |
0 | 2216 { |
79 | 2217 auto face = model.pFaces[j]; |
0 | 2218 |
2219 //if ( *(int *)(v87 + 76) > 0 ) | |
2220 //{ | |
2221 //File = 0; | |
2222 //do | |
2223 //{ | |
2224 //v106 = (char *)&File->uAttributes + *(int *)(v87 + 84); | |
79 | 2225 memcpy(&face.uAttributes, pSrc, 4); |
0 | 2226 pSrc += 4; |
2227 //v88 = pBModels; | |
2228 //++File; | |
2229 //v85 = (char *)v85 + 4; | |
2230 //++thisa; | |
2231 //v87 = (unsigned int)((char *)v88 + pNumItems); | |
2232 //} | |
2233 //while ( thisa < *(int *)(v87 + 76) ); | |
2234 } | |
2235 | |
2236 //v89 = pBModels; | |
2237 //thisa = 0; | |
79 | 2238 for (uint j = 0; j < model.uNumFaces; ++j) |
0 | 2239 { |
79 | 2240 auto face = model.pFaces[j]; |
0 | 2241 //pFilename = 0; |
2242 //do | |
2243 //{ | |
2244 //v90 = (ODMFace *)&pFilename[*(unsigned int *)((char *)&v89->pFaces + pNumItems)]; | |
2245 //File = v90; | |
79 | 2246 if (face.sCogTriggeredID) |
0 | 2247 { |
79 | 2248 if (face.HasEventHint()) |
760 | 2249 face.uAttributes |= 0x1000u; |
0 | 2250 else |
1062 | 2251 face.uAttributes &= 0xFFFFEFFFu; |
0 | 2252 } |
2253 //++thisa; | |
2254 //v89 = pBModels; | |
2255 //pFilename += 308; | |
2256 //} | |
2257 //while ( thisa < *(signed int *)((char *)&v89->uNumFaces + pNumItems) ); | |
2258 } | |
2259 //++v151; | |
2260 //pNumItems += 188; | |
2261 //} | |
2262 //while ( v151 < (signed int)uNumBModels ); | |
2263 } | |
2264 | |
2265 pGameLoadingUI_ProgressBar->Progress(); | |
2266 | |
2267 //v151 = 0; | |
2268 for (uint i = 0; i < uNumLevelDecorations; ++i) | |
2269 { | |
2270 //thisa = (int)&pLevelDecorations[0].field_2; | |
2271 //do | |
2272 //{ | |
2273 memcpy(&pLevelDecorations[i].field_2, pSrc, 2); | |
2274 pSrc += 2; | |
2275 //thisa += 32; | |
2276 //v85 = (char *)v85 + 2; | |
2277 //++v151; | |
2278 //} | |
2279 //while ( v151 < (signed int)uNumLevelDecorations ); | |
2280 } | |
2281 | |
2282 pGameLoadingUI_ProgressBar->Progress(); | |
2283 | |
2284 memcpy(&uNumActors, pSrc, 4); | |
2285 //v91 = (char *)v85 + 4; | |
2286 if (uNumActors > 500) | |
2287 MessageBoxW(nullptr, L"Can't load file!", | |
2288 L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:939", 0); | |
2289 | |
2290 pGameLoadingUI_ProgressBar->Progress(); | |
2291 | |
2292 assert(sizeof(Actor) == 836); | |
2293 //pFilename = (char *)(836 * uNumActors); | |
1202 | 2294 memcpy(pActors.data(), pSrc + 4, uNumActors * sizeof(Actor)); |
0 | 2295 pSrc += 4 + uNumActors * sizeof(Actor); |
2296 //v92 = (char *)v91 + (int)pFilename; | |
2297 pGameLoadingUI_ProgressBar->Progress(); | |
2298 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
2299 memcpy(&uNumSpriteObjects, pSrc, 4); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
2300 assert(uNumSpriteObjects <= 1000 && "Too many objects"); |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
2301 assert(sizeof(SpriteObject) == 112); |
0 | 2302 |
2303 pGameLoadingUI_ProgressBar->Progress(); | |
2304 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
2305 //pFilename = (char *)(112 * uNumSpriteObjects); |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
2306 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
|
2307 pSrc += 4 + uNumSpriteObjects * sizeof(SpriteObject); |
0 | 2308 |
2309 //v94 = (char *)v93 + (int)pFilename; | |
2310 pGameLoadingUI_ProgressBar->Progress(); | |
2311 | |
2312 memcpy(&uNumChests, pSrc, 4); | |
2313 //v95 = (char *)v94 + 4; | |
2314 if (uNumChests > 20) | |
2315 MessageBoxW(nullptr, L"Can't load file!", | |
2316 L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:968", 0); | |
2317 | |
2318 pGameLoadingUI_ProgressBar->Progress(); | |
2319 | |
2320 assert(sizeof(Chest) == 5324); | |
2321 //pFilename = (char *)(5324 * uNumChests); | |
1202 | 2322 memcpy(pChests.data(), pSrc + 4 , uNumChests * sizeof(Chest)); |
0 | 2323 pSrc += 4 + uNumChests * sizeof(Chest); |
2324 //v96 = (char *)v95 + (int)pFilename; | |
2325 pGameLoadingUI_ProgressBar->Progress(); | |
2326 | |
2327 memcpy(&stru_5E4C90, pSrc, 0xC8); | |
2328 pSrc += 0xC8; | |
2329 | |
2330 pGameLoadingUI_ProgressBar->Progress(); | |
810 | 2331 memcpy(&loc_time, pSrc, 0x38u); |
0 | 2332 |
2333 free(pSrcMem); | |
2334 | |
630 | 2335 pTileTable->InitializeTileset(Tileset_Dirt); |
2336 pTileTable->InitializeTileset(Tileset_Snow); | |
0 | 2337 //v108 = pTileTypes[0].uTileGroup; |
630 | 2338 pTileTable->InitializeTileset(pTileTypes[0].tileset); |
0 | 2339 //v108 = pTileTypes[1].uTileGroup; |
630 | 2340 pTileTable->InitializeTileset(pTileTypes[1].tileset); |
0 | 2341 //v108 = pTileTypes[2].uTileGroup; |
630 | 2342 pTileTable->InitializeTileset(pTileTypes[2].tileset); |
0 | 2343 //v108 = pTileTypes[3].uTileGroup; |
630 | 2344 pTileTable->InitializeTileset(pTileTypes[3].tileset); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2345 strcpy(pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture.data()); |
0 | 2346 //v97 = pTileTypes[0].uTileID; |
2347 //v108 = 0; | |
2348 auto v98 = pTileTable->GetTileById(pTileTypes[0].uTileID); | |
2349 //v99 = pBitmaps_LOD->LoadTexture(v98->pTileName, TEXTURE_DEFAULT); | |
2350 uMainTile_BitmapID = pBitmaps_LOD->LoadTexture(v98->pTileName, TEXTURE_DEFAULT); | |
2351 if (uMainTile_BitmapID != -1) | |
2352 pBitmaps_LOD->pTextures[uMainTile_BitmapID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[uMainTile_BitmapID].palette_id1); | |
2353 | |
2354 _47F0E2(); | |
2355 | |
2356 LABEL_150: | |
2357 //v100 = HIDWORD(uLastVisitDay); | |
2358 //LODWORD(v142) = LODWORD(uLastVisitDay); | |
2359 //HIDWORD(v142) = v100; | |
810 | 2360 if (loc_time.uLastVisitDay) |
0 | 2361 { |
810 | 2362 if ( (signed int)((signed int)(signed __int64)((double)loc_time.uLastVisitDay * 0.234375) / 60 / 60 / 24) % 28 != pParty->uDaysPlayed ) |
0 | 2363 { |
2364 if ( rand() % 100 >= 20 ) | |
2365 v108 = dword_4EC268[rand() % dword_4EC2A8]; | |
2366 else | |
2367 v108 = dword_4EC28C[rand() % dword_4EC2AC]; | |
810 | 2368 sprintf(loc_time.sky_texture_name, "plansky%d", v108); |
0 | 2369 } |
2370 } | |
2371 else | |
2372 { | |
810 | 2373 strcpy(loc_time.sky_texture_name, "plansky3"); |
0 | 2374 } |
2375 //v101 = pBitmaps_LOD->LoadTexture(field_4F8); | |
810 | 2376 uSky_TextureID = pBitmaps_LOD->LoadTexture(loc_time.sky_texture_name); |
0 | 2377 if (uSky_TextureID != -1) |
2378 pBitmaps_LOD->pTextures[uSky_TextureID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[uSky_TextureID].palette_id1); | |
2379 | |
2380 pPaletteManager->RecalculateAll(); | |
2381 pSoundList->LoadSound(53, 0); | |
2382 pSoundList->LoadSound(92, 0); | |
2383 pSoundList->LoadSound(57, 0); | |
2384 pSoundList->LoadSound(96, 0); | |
2385 pSoundList->LoadSound(64, 0); | |
2386 pSoundList->LoadSound(103, 0); | |
760 | 2387 for (int i=0; i<3;++i) |
0 | 2388 { |
760 | 2389 |
2390 switch ( pTileTypes[i].tileset ) | |
0 | 2391 { |
760 | 2392 case Tileset_Grass: |
2393 pSoundList->LoadSound(54, 0); | |
2394 pSoundList->LoadSound(93, 0); | |
2395 break; | |
2396 case Tileset_Snow: | |
0 | 2397 pSoundList->LoadSound(58, 0); |
760 | 2398 pSoundList->LoadSound(97, 0); |
0 | 2399 break; |
760 | 2400 case Tileset_2: |
0 | 2401 pSoundList->LoadSound(52, 0); |
760 | 2402 pSoundList->LoadSound(91, 0); |
0 | 2403 break; |
760 | 2404 case Tileset_3: |
0 | 2405 pSoundList->LoadSound(51, 0); |
760 | 2406 pSoundList->LoadSound(90, 0); |
0 | 2407 break; |
760 | 2408 case Tileset_Water: |
0 | 2409 pSoundList->LoadSound(62, 0); |
760 | 2410 pSoundList->LoadSound(101, 0); |
0 | 2411 break; |
760 | 2412 case Tileset_6: |
0 | 2413 pSoundList->LoadSound(49, 0); |
760 | 2414 pSoundList->LoadSound(88, 0); |
0 | 2415 break; |
760 | 2416 case Tileset_Swamp: |
2417 pSoundList->LoadSound(61, 0); | |
2418 pSoundList->LoadSound(100, 0); | |
2419 break; | |
2420 } | |
0 | 2421 } |
2422 return true; | |
2423 } | |
2424 | |
2425 //----- (0047ECC1) -------------------------------------------------------- | |
764 | 2426 int OutdoorLocation::GetTileIdByTileMapId(signed int a2) |
0 | 2427 { |
2428 signed int result; // eax@2 | |
2429 int v3; // eax@3 | |
2430 | |
2431 if ( a2 >= 90 ) | |
2432 { | |
2433 v3 = (a2 - 90) / 36; | |
2434 if ( v3 && v3 != 1 && v3 != 2 ) | |
2435 { | |
2436 if ( v3 == 3 ) | |
2437 result = this->pTileTypes[3].uTileID; | |
2438 else | |
2439 result = a2; | |
2440 } | |
2441 else | |
2442 { | |
2443 result = this->pTileTypes[v3].uTileID; | |
2444 } | |
2445 } | |
2446 else | |
2447 { | |
2448 result = 0; | |
2449 } | |
2450 return result; | |
2451 } | |
2452 | |
2453 //----- (0047ED08) -------------------------------------------------------- | |
67 | 2454 unsigned int OutdoorLocation::DoGetTileTexture(unsigned int uX, unsigned int uY) |
0 | 2455 { |
2456 int v3; // esi@5 | |
2457 unsigned int result; // eax@9 | |
2458 | |
630 | 2459 assert(uX < 128 && uY < 128); |
67 | 2460 |
2461 v3 = this->pTerrain.pTilemap[uY * 128 + uX]; | |
630 | 2462 if (v3 < 198) // < Tileset_3 |
67 | 2463 { |
2464 if (v3 >= 90) | |
185 | 2465 v3 = v3 + this->pTileTypes[(v3 - 90) / 36].uTileID - 36 * ((v3 - 90) / 36) - 90; |
67 | 2466 } |
2467 else | |
2468 v3 = v3 + this->pTileTypes[3].uTileID - 198; | |
2469 | |
635 | 2470 #pragma region "New: seasons change" |
2471 extern bool change_seasons; | |
2472 if (change_seasons) | |
2473 switch (pParty->uCurrentMonth) | |
2474 { | |
2475 case 11: case 0: case 1: // winter | |
2476 if (v3 >= 90) // Tileset_Grass begins at TileID = 90 | |
2477 { | |
2478 if (v3 <= 95) // some grastyl entries | |
2479 v3 = 348; | |
2480 else if (v3 <= 113) // rest of grastyl & all grdrt* | |
2481 v3 = 348 + (v3 - 96); | |
2482 } | |
630 | 2483 /*switch (v3) |
2484 { | |
2485 case 102: v3 = 354; break; // grdrtNE -> SNdrtne | |
2486 case 104: v3 = 356; break; // grdrtNW -> SNdrtnw | |
2487 case 108: v3 = 360; break; // grdrtN -> SNdrtn | |
2488 }*/ | |
635 | 2489 break; |
2490 | |
2491 case 2: case 3: case 4: // spring | |
2492 case 8: case 9: case 10: // autumn | |
2493 if (v3 >= 90 && v3 <= 113) // just convert all Tileset_Grass to dirt | |
2494 v3 = 1; | |
2495 break; | |
630 | 2496 |
635 | 2497 case 5: case 6: case 7: // summer |
2498 //all tiles are green grass by default | |
2499 break; | |
630 | 2500 |
635 | 2501 default: assert(pParty->uCurrentMonth >= 0 && pParty->uCurrentMonth < 12); |
2502 } | |
2503 #pragma endregion | |
630 | 2504 |
67 | 2505 return pTileTable->pTiles[v3].uBitmapID; |
0 | 2506 } |
2507 | |
2508 //----- (0047ED83) -------------------------------------------------------- | |
2509 int OutdoorLocation::_47ED83(signed int a2, signed int a3) | |
2510 { | |
812 | 2511 assert(a2 < 128 && a3 < 128); |
0 | 2512 |
812 | 2513 return *(&this->pTerrain.pTilemap[128 * a3] + a2); |
0 | 2514 } |
2515 | |
2516 //----- (0047EDB3) -------------------------------------------------------- | |
2517 int OutdoorLocation::ActuallyGetSomeOtherTileInfo(unsigned int uX, unsigned int uY) | |
2518 { | |
812 | 2519 assert(uX < 128 && uY < 128); |
0 | 2520 int v3; // esi@5 |
2521 | |
812 | 2522 v3 = this->pTerrain.pTilemap[uY * 128 + uX]; |
2523 if ( v3 >= 90 ) | |
2524 v3 = v3 + this->pTileTypes[(v3 - 90) / 36].uTileID - 36 * ((v3 - 90) / 36) - 90; | |
67 | 2525 return pTileTable->pTiles[v3].uAttributes; |
0 | 2526 } |
2527 | |
2528 //----- (0047EE16) -------------------------------------------------------- | |
2529 int OutdoorLocation::DoGetHeightOnTerrain(unsigned int uX, unsigned int uZ) | |
2530 { | |
812 | 2531 assert(uX < 128 && uZ < 128); |
0 | 2532 |
812 | 2533 return 32 * pTerrain.pHeightmap[uZ * 128 + uX]; |
0 | 2534 } |
2535 | |
2536 //----- (0047EE49) -------------------------------------------------------- | |
764 | 2537 int OutdoorLocation::GetSoundIdByPosition( signed int X_pos, signed int Y_pos, int running ) |
2538 { | |
0 | 2539 signed int v4; // eax@5 |
2540 signed int v5; // eax@7 | |
2541 int v6; // eax@8 | |
2542 signed int v8; // eax@9 | |
764 | 2543 int modif=0; |
0 | 2544 |
764 | 2545 if ( X_pos < 0 || X_pos > 127 || Y_pos < 0 || Y_pos > 127 ) |
0 | 2546 v4 = 0; |
2547 else | |
764 | 2548 v4 = this->pTerrain.pTilemap[128 * Y_pos + X_pos]; |
2549 v5 = GetTileIdByTileMapId(v4); | |
2550 if (running) | |
2551 modif=-39; | |
0 | 2552 if ( !v5 ) |
764 | 2553 return 92+modif; |
2554 | |
2555 switch (pTileTable->pTiles[v5].tileset) | |
0 | 2556 { |
764 | 2557 case 0: return 93+ modif; |
2558 case 1: return 97+ modif; | |
2559 case 2: return 91+ modif; | |
2560 case 3: return 90+ modif; | |
2561 case 4: return 101+ modif; | |
2562 case 5: return 95+ modif; | |
2563 case 6: return 88+ modif; | |
2564 case 7: return 100+ modif; | |
2565 case 8: return 93+ modif; | |
2566 default: | |
2567 v8=pTileTable->pTiles[v5].tileset; | |
2568 if ( (v8 > 9 && v8 <= 17) || (v8 > 21 && v8 <= 27) ) | |
2569 return 96+ modif; | |
2570 else | |
2571 return 95+ modif; | |
0 | 2572 } |
764 | 2573 |
0 | 2574 } |
2575 | |
2576 //----- (0047EF60) -------------------------------------------------------- | |
752 | 2577 int OutdoorLocation::UpdateDiscoveredArea(int X_grid_pos, int Y_grid_poa, int a4) |
0 | 2578 { |
2579 int v4; // ecx@1 | |
2580 int v5; // edx@2 | |
2581 int v6; // edi@2 | |
2582 int v7; // esi@2 | |
2583 int v8; // eax@4 | |
2584 int v9; // ebx@4 | |
2585 int v10; // eax@5 | |
2586 int v11; // eax@7 | |
2587 int v12; // esi@12 | |
2588 char v13; // al@12 | |
2589 int v15; // [sp+4h] [bp-14h]@7 | |
2590 int v16; // [sp+8h] [bp-10h]@5 | |
2591 int v17; // [sp+Ch] [bp-Ch]@2 | |
2592 OutdoorLocation *v18; // [sp+10h] [bp-8h]@1 | |
2593 int v19; // [sp+14h] [bp-4h]@2 | |
2594 int i; // [sp+24h] [bp+Ch]@5 | |
2595 | |
2596 v18 = this; | |
752 | 2597 v4 = Y_grid_poa - 10; |
2598 if ( Y_grid_poa - 10 < Y_grid_poa + 10 ) | |
0 | 2599 { |
752 | 2600 v5 = v4 - Y_grid_poa; |
2601 v6 = (Y_grid_poa - 30); | |
2602 v7 = X_grid_pos; | |
2603 v19 = v4 - Y_grid_poa; | |
2604 v17 = Y_grid_poa + 10 - v4; | |
0 | 2605 while ( 1 ) |
2606 { | |
2607 v8 = abs(v5); | |
2608 v9 = v7 - 10; | |
2609 if ( v7 - 10 < v7 + 10 ) | |
2610 { | |
2611 v16 = v8 * v8; | |
2612 v10 = v9 - v7; | |
2613 for ( i = v9 - v7; ; v10 = i ) | |
2614 { | |
2615 v11 = abs(v10); | |
2616 v15 = v11 * v11 + v16; | |
752 | 2617 if ( v15 <= 100 && v9 >= 20 && v9 <= 107 && v6 >= 0 && v6 <= 87 ) |
0 | 2618 { |
752 | 2619 v13 = 1 << (7 - (v9 - 20) % 8); |
2620 v18->uDicovered_area[v6][(v9 - 20)/8] |= v13; | |
0 | 2621 if ( v15 <= 49 ) |
752 | 2622 v18->uUndiscoveredArea[v6][(v9 - 20)/8] |= v13; |
2623 v7 = X_grid_pos; | |
0 | 2624 } |
2625 ++v9; | |
2626 ++i; | |
2627 if ( v9 >= v7 + 10 ) | |
2628 break; | |
2629 } | |
2630 } | |
752 | 2631 ++v6 ; |
0 | 2632 ++v19; |
2633 --v17; | |
2634 if ( !v17 ) | |
2635 break; | |
2636 v5 = v19; | |
2637 } | |
2638 } | |
2639 return 1; | |
2640 } | |
2641 | |
2642 //----- (0047F04C) -------------------------------------------------------- | |
752 | 2643 bool OutdoorLocation::_47F04C(signed int x_pos, signed int y_pos) |
0 | 2644 { |
2645 bool result; // eax@5 | |
2646 | |
752 | 2647 if ( x_pos < 0 || x_pos >= 88 || y_pos < 0 || y_pos >= 88 ) |
0 | 2648 result = 0; |
2649 else | |
752 | 2650 result = (uUndiscoveredArea[y_pos][x_pos/8] & (unsigned __int8)(1 << (7 - (x_pos) % 8))) != 0; |
0 | 2651 return result; |
2652 } | |
2653 | |
2654 //----- (0047F097) -------------------------------------------------------- | |
752 | 2655 bool OutdoorLocation::_47F097(signed int x_pos, signed int y_pos) |
0 | 2656 { |
2657 bool result; // eax@5 | |
2658 | |
752 | 2659 if ( x_pos < 0 || x_pos >= 88 || y_pos < 0 || y_pos >= 88 ) |
0 | 2660 result = 0; |
2661 else | |
752 | 2662 result = (uDicovered_area[y_pos][x_pos/8] & (unsigned __int8)(1 << (7 - (x_pos) % 8))) != 0; |
0 | 2663 return result; |
2664 } | |
2665 | |
2666 //----- (0047F0E2) -------------------------------------------------------- | |
2667 bool OutdoorLocation::_47F0E2() | |
2668 { | |
2669 signed int v1; // edi@1 | |
2670 OutdoorLocation *v2; // ebx@1 | |
2671 Texture *v3; // ebp@2 | |
2672 | |
2673 v1 = 0; | |
2674 v2 = this; | |
2675 if ( (signed int)pBitmaps_LOD->uNumLoadedFiles > 0 ) | |
2676 { | |
2677 v3 = pBitmaps_LOD->pTextures; | |
2678 do | |
2679 { | |
2680 if ( v1 != -1 ? (int)v3 : 0 ) | |
710 | 2681 v3->uDecompressedSize = v2->pTerrain._47CB57((int)v3->pLevelOfDetail0_prolly_alpha_mask, |
0 | 2682 v3->palette_id2, |
2683 v3->uTextureWidth * v3->uTextureHeight); | |
2684 ++v1; | |
2685 ++v3; | |
2686 } | |
2687 while ( v1 < (signed int)pBitmaps_LOD->uNumLoadedFiles ); | |
2688 } | |
2689 return 1; | |
2690 } | |
2691 | |
2692 //----- (0047F138) -------------------------------------------------------- | |
2693 bool OutdoorLocation::PrepareDecorations() | |
2694 { | |
2695 signed int v1; // ebx@1 | |
2696 __int16 v4; // ax@5 | |
2697 int v5; // eax@7 | |
2698 __int16 v6; // ax@14 | |
2699 signed int v8; // [sp+Ch] [bp-4h]@1 | |
2700 | |
2701 v1 = 0; | |
2702 v8 = 0; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
2703 if ( !_stricmp(pCurrentMapName.data(), "out09.odm") ) |
0 | 2704 v8 = 1; |
2705 | |
2706 for (uint i = 0; i < uNumLevelDecorations; ++i) | |
2707 { | |
1202 | 2708 auto decor = &pLevelDecorations[i]; |
0 | 2709 |
2710 pDecorationList->InitializeDecorationSprite(decor->uDecorationDescID); | |
2711 v4 = pDecorationList->pDecorations[decor->uDecorationDescID].uSoundID; | |
2712 if ( v4 && _6807E0_num_decorations_with_sounds_6807B8 < 9 ) | |
2713 { | |
2714 pSoundList->LoadSound(v4, 0); | |
2715 v5 = _6807E0_num_decorations_with_sounds_6807B8++; | |
2716 _6807B8_level_decorations_ids[v5] = i; | |
2717 } | |
2718 if ( v8 && decor->uCog == 20 ) | |
764 | 2719 decor->field_2 |= 0x0040u; |
0 | 2720 if ( !decor->field_16_event_id ) |
2721 { | |
2722 if ( decor->IsInteractive() ) | |
2723 { | |
2724 if ( v1 < 124 ) | |
2725 { | |
2726 v6 = v1 + 75; | |
2727 decor->_idx_in_stru123 = v6; | |
2728 if ( !stru_5E4C90._decor_events[v1++] ) | |
764 | 2729 decor->field_2 |= 0x0020u; |
0 | 2730 } |
2731 } | |
2732 } | |
2733 } | |
2734 | |
2735 pGameLoadingUI_ProgressBar->Progress(); | |
2736 return true; | |
2737 } | |
2738 // 6807E0: using guessed type int _6807E0_num_decorations_6807B8; | |
2739 | |
2740 //----- (0047F223) -------------------------------------------------------- | |
2741 int OutdoorLocation::_47F223_LooksLikeGenerateMonsterLoot() | |
2742 { | |
2743 signed int v1; // ebx@1 | |
2744 char *v2; // esi@2 | |
2745 int v3; // eax@7 | |
2746 OutdoorLocation *v5; // [sp+0h] [bp-4h]@1 | |
2747 | |
2748 v5 = this; | |
2749 v1 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
2750 if ( (signed int)uNumSpriteObjects > 0 ) |
0 | 2751 { |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
2752 v2 = (char *)&pSpriteObjects[0].uObjectDescID; |
0 | 2753 do |
2754 { | |
2755 if ( *(short *)v2 ) | |
2756 { | |
2757 if ( !(v2[24] & 8) && !(pObjectList->pObjects[*(short *)v2].uFlags & 0x10) ) | |
2758 *(int *)(v2 + 10) = GetTerrainHeightsAroundParty2(*(int *)(v2 + 2), *(int *)(v2 + 6), (int *)&v5, 0); | |
2759 v3 = *(int *)(v2 + 34); | |
2760 if ( v3 ) | |
2761 { | |
2762 if ( v3 != 220 && pItemsTable->pItems[v3].uEquipType == 14 && !*(int *)(v2 + 38) ) | |
2763 *(int *)(v2 + 38) = rand() % 15 + 5; | |
2764 pItemsTable->SetSpecialBonus((ItemGen *)(v2 + 34)); | |
2765 } | |
2766 } | |
2767 ++v1; | |
2768 v2 += 112; | |
2769 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
432
diff
changeset
|
2770 while ( v1 < (signed int)uNumSpriteObjects ); |
0 | 2771 } |
2772 pGameLoadingUI_ProgressBar->Progress(); | |
2773 return 1; | |
2774 } | |
2775 | |
2776 //----- (0047F2D3) -------------------------------------------------------- | |
2777 bool OutdoorLocation::InitalizeActors(int a1) | |
2778 { | |
82 | 2779 Actor *v3; // esi@2 |
0 | 2780 int v4; // eax@3 |
2781 __int16 v5; // ax@11 | |
760 | 2782 int alert_status; // [sp+348h] [bp-8h]@1 |
0 | 2783 int v9; // [sp+34Ch] [bp-4h]@1 |
2784 | |
760 | 2785 alert_status = 0; |
2786 for(int i=0; i<uNumActors; ++i) | |
2787 { | |
2788 v4 = pActors[i].uAttributes; | |
82 | 2789 if ( !(v4 & 0x100000) ) |
760 | 2790 { |
2791 if ( alert_status != 1 ) | |
2792 { | |
2793 pActors[i].uCurrentActionTime = 0; | |
2794 pActors[i].uCurrentActionLength = 0; | |
2795 if ( v4 & 0x10000 ) | |
2796 pActors[i].uAIState = AIState::Disabled; | |
2797 if ( pActors[i].uAIState != AIState::Removed && pActors[i].uAIState != AIState::Disabled && | |
2798 (pActors[i].sCurrentHP == 0 || pActors[i].pMonsterInfo.uHP == 0) ) | |
2799 pActors[i].uAIState = AIState::Dead; | |
2800 pActors[i].vVelocity.x = 0; | |
2801 pActors[i].vVelocity.y = 0; | |
2802 pActors[i].vVelocity.z = 0; | |
2803 pActors[i].UpdateAnimation(); | |
864 | 2804 pActors[i].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; |
760 | 2805 pActors[i].PrepareSprites(0); |
2806 } | |
2807 else | |
2808 { | |
2809 pActors[i].uAIState = AIState::Disabled; | |
2810 pActors[i].uAttributes = v4 | 0x10000; | |
2811 } | |
2812 } | |
2813 else if ( a1 == 0 ) | |
2814 { | |
2815 pActors[i].uAIState = AIState::Disabled; | |
2816 pActors[i].uAttributes = v4 | 0x10000; | |
2817 } | |
2818 else if ( alert_status != 0 ) | |
2819 { | |
2820 pActors[i].uCurrentActionTime = 0; | |
2821 pActors[i].uCurrentActionLength = 0; | |
2822 if ( v4 & 0x10000 ) | |
2823 pActors[i].uAIState = AIState::Disabled; | |
2824 v5 = pActors[i].uAIState; | |
2825 if ( pActors[i].uAIState != AIState::Removed && pActors[i].uAIState != AIState::Disabled && | |
2826 (pActors[i].sCurrentHP == 0 || pActors[i].pMonsterInfo.uHP == 0) ) | |
2827 pActors[i].uAIState = AIState::Dead; | |
2828 pActors[i].vVelocity.x = 0; | |
2829 pActors[i].vVelocity.y = 0; | |
2830 pActors[i].vVelocity.z = 0; | |
2831 pActors[i].UpdateAnimation(); | |
864 | 2832 pActors[i].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; |
760 | 2833 pActors[i].PrepareSprites(0); |
2834 } | |
2835 else | |
2836 { | |
2837 pActors[i].uAIState = AIState::Disabled; | |
2838 pActors[i].uAttributes = v4 | 0x10000; | |
2839 alert_status = GetAlertStatus(); | |
2840 } | |
2841 } | |
2842 | |
0 | 2843 pGameLoadingUI_ProgressBar->Progress(); |
760 | 2844 //no use for this |
2845 // Actor thisa; | |
2846 // thisa.pMonsterInfo.uID = 45; | |
2847 // thisa.PrepareSprites(0); | |
0 | 2848 return 1; |
2849 } | |
2850 | |
2851 //----- (0047F3EA) -------------------------------------------------------- | |
630 | 2852 bool OutdoorLocation::LoadRoadTileset() |
0 | 2853 { |
760 | 2854 pTileTypes[3].uTileID = pTileTable->GetTileForTerrainType(pTileTypes[3].tileset, 1); |
2855 pTileTable->InitializeTileset(pTileTypes[3].tileset); | |
0 | 2856 return 1; |
2857 } | |
2858 | |
2859 //----- (0047F420) -------------------------------------------------------- | |
2860 bool OutdoorLocation::LoadTileGroupIds() | |
2861 { | |
2862 for (uint i = 0; i < 3; ++i) | |
760 | 2863 pTileTypes[i].uTileID = pTileTable->GetTileForTerrainType(pTileTypes[i].tileset, 1); |
0 | 2864 |
2865 return true; | |
2866 } | |
2867 | |
2868 //----- (0047B42C) -------------------------------------------------------- | |
142 | 2869 void OutdoorLocation::PrepareActorsDrawList() |
0 | 2870 { |
2871 unsigned int result; // eax@1 | |
142 | 2872 //Actor *v1; // edi@2 |
2873 //__int16 v2; // ax@3 | |
2874 int z; // esi@5 | |
0 | 2875 float v4; // ST48_4@8 |
142 | 2876 //double v5; // ST38_8@8 |
2877 //float v6; // ST48_4@10 | |
2878 //double v7; // ST30_8@10 | |
0 | 2879 unsigned int v8; // eax@11 |
2880 int v9; // edx@11 | |
2881 __int16 v10; // dx@11 | |
2882 unsigned int v11; // eax@13 | |
2883 signed int v12; // eax@16 | |
2884 __int16 v13; // cx@21 | |
2885 SpriteFrame *v14; // eax@24 | |
2886 SpriteFrame *v15; // ebx@25 | |
2887 //int *v16; // eax@25 | |
2888 int v17; // eax@35 | |
2889 int v18; // ST78_4@36 | |
2890 int v19; // eax@36 | |
2891 int v20; // ecx@38 | |
2892 int v21; // eax@38 | |
2893 int v22; // ecx@41 | |
2894 int v23; // ST5C_4@43 | |
2895 int v24; // esi@44 | |
2896 signed __int64 v25; // qtt@45 | |
2897 int v26; // ST54_4@45 | |
2898 int v27; // ecx@45 | |
2899 RenderBillboard *v28; // esi@45 | |
142 | 2900 //__int16 v29; // ax@46 |
0 | 2901 unsigned __int8 v30; // zf@46 |
2902 unsigned __int8 v31; // sf@46 | |
2903 signed __int16 v32; // ax@49 | |
2904 signed int v33; // ecx@50 | |
2905 int v34; // ecx@54 | |
2906 MonsterDesc *v35; // edx@54 | |
2907 int v36; // ecx@54 | |
142 | 2908 //unsigned __int8 v37; // zf@54 |
2909 //unsigned __int8 v38; // sf@54 | |
0 | 2910 unsigned int v39; // [sp-8h] [bp-68h]@23 |
2911 unsigned int v40; // [sp-4h] [bp-64h]@23 | |
2912 int v41; // [sp+24h] [bp-3Ch]@11 | |
2913 int v42; // [sp+28h] [bp-38h]@38 | |
2914 int v43; // [sp+28h] [bp-38h]@45 | |
2915 int v44; // [sp+2Ch] [bp-34h]@36 | |
2916 int v45; // [sp+2Ch] [bp-34h]@44 | |
2917 int v46; // [sp+2Ch] [bp-34h]@45 | |
2918 int v47; // [sp+30h] [bp-30h]@36 | |
2919 int v48; // [sp+30h] [bp-30h]@41 | |
2920 signed int v49; // [sp+34h] [bp-2Ch]@5 | |
2921 int v50; // [sp+34h] [bp-2Ch]@36 | |
2922 int v51; // [sp+34h] [bp-2Ch]@41 | |
2923 int v52; // [sp+34h] [bp-2Ch]@50 | |
2924 int v53; // [sp+38h] [bp-28h]@36 | |
142 | 2925 //int v54; // [sp+3Ch] [bp-24h]@2 |
0 | 2926 int y; // [sp+40h] [bp-20h]@5 |
2927 int x; // [sp+44h] [bp-1Ch]@5 | |
2928 int v57; // [sp+48h] [bp-18h]@45 | |
2929 int v58; // [sp+4Ch] [bp-14h]@45 | |
142 | 2930 //signed int v59; // [sp+50h] [bp-10h]@1 |
0 | 2931 int X; // [sp+54h] [bp-Ch]@36 |
142 | 2932 //__int16 v61; // [sp+58h] [bp-8h]@5 |
0 | 2933 signed __int16 v62; // [sp+5Ch] [bp-4h]@25 |
2934 | |
142 | 2935 //result = 0; |
2936 //v59 = 0; | |
2937 for (int i = 0; i < uNumActors; ++i) | |
0 | 2938 { |
142 | 2939 //v54 = 0; |
2940 //v1 = pActors;//[0].vPosition.z; | |
2941 //do | |
2942 //{ | |
1202 | 2943 auto actor = &pActors[i]; |
142 | 2944 //v2 = actor->uAIState; |
2945 | |
2946 actor->uAttributes &= 0xFFFFFFF7u; | |
2947 if (actor->uAIState == Removed || actor->uAIState == Disabled) | |
2948 continue; | |
2949 | |
2950 z = actor->vPosition.z; | |
0 | 2951 v49 = 0; |
142 | 2952 x = actor->vPosition.x; |
2953 y = actor->vPosition.y; | |
2954 if (actor->uAIState == Summoned) | |
0 | 2955 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
813
diff
changeset
|
2956 if (PID_TYPE(actor->uSummonerID) != OBJECT_Actor || |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
813
diff
changeset
|
2957 pActors[PID_ID(actor->uSummonerID)].pMonsterInfo.uSpecialAbilityDamageDiceSides != 1 ) |
0 | 2958 { |
142 | 2959 z += floorf(actor->uActorHeight * 0.5f + 0.5f); |
0 | 2960 } |
2961 else | |
2962 { | |
2963 v49 = 1; | |
142 | 2964 pGame->pStru6Instance->_4A7F74(actor->vPosition.x, actor->vPosition.y, z); |
2965 v4 = (1.0 - (double)actor->uCurrentActionTime / (double)actor->uCurrentActionLength) * | |
2966 (double)(2 * actor->uActorHeight); | |
2967 z -= floorf(v4 + 0.5f); | |
2968 if ( z > actor->vPosition.z ) | |
2969 z = actor->vPosition.z; | |
0 | 2970 } |
2971 } | |
142 | 2972 v8 = stru_5C6E00->Atan2(actor->vPosition.x - pIndoorCamera->pos.x, |
2973 actor->vPosition.y - pIndoorCamera->pos.y); | |
2974 LOWORD(v9) = actor->uYawAngle; | |
0 | 2975 v41 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v9 - v8) >> 8) & 7; |
142 | 2976 v10 = actor->uCurrentActionAnimation; |
0 | 2977 if ( pParty->bTurnBasedModeOn ) |
2978 { | |
2979 if ( v10 != 1 ) | |
2980 { | |
2981 LABEL_17: | |
142 | 2982 v12 = actor->uCurrentActionTime; |
0 | 2983 goto LABEL_18; |
2984 } | |
2985 v11 = pMiscTimer->uTotalGameTimeElapsed; | |
2986 } | |
2987 else | |
2988 { | |
2989 if ( v10 != 1 ) | |
2990 goto LABEL_17; | |
2991 v11 = pEventTimer->uTotalGameTimeElapsed; | |
2992 } | |
142 | 2993 v12 = 32 * i + v11; |
0 | 2994 LABEL_18: |
142 | 2995 if ( (signed __int64)actor->pActorBuffs[5].uExpireTime > 0 || (signed __int64)actor->pActorBuffs[6].uExpireTime > 0 ) |
0 | 2996 v12 = 0; |
142 | 2997 v13 = actor->uAIState; |
0 | 2998 if ( v13 == 17 && !v49 ) |
2999 { | |
3000 v40 = v12; | |
3001 v39 = uSpriteID_Spell11; | |
3002 LABEL_24: | |
3003 v14 = pSpriteFrameTable->GetFrame(v39, v40); | |
3004 goto LABEL_25; | |
3005 } | |
3006 v40 = v12; | |
142 | 3007 v39 = actor->pSpriteIDs[v10]; |
0 | 3008 if ( v13 != 16 ) |
3009 goto LABEL_24; | |
3010 v14 = pSpriteFrameTable->GetFrameBy_x(v39, v12); | |
3011 LABEL_25: | |
3012 v62 = 0; | |
3013 v15 = v14; | |
3014 //v16 = (int *)v14->uFlags; | |
3015 if (v14->uFlags & 2) | |
3016 v62 = 2; | |
3017 if (v14->uFlags & 0x40000) | |
3018 v62 |= 0x40u; | |
3019 if (v14->uFlags & 0x20000) | |
3020 LOBYTE(v62) = v62 | 0x80; | |
3021 if ((256 << v41) & v14->uFlags) | |
3022 v62 |= 4u; | |
3023 if ( v15->uGlowRadius ) | |
3024 { | |
3025 //LOBYTE(v16) = byte_4E94D3; | |
142 | 3026 pMobileLightsStack->AddLight(x, y, z, 0, v15->uGlowRadius, 0xFFu, 0xFFu, 0xFFu, byte_4E94D3); |
0 | 3027 } |
3028 v17 = (x - pIndoorCamera->pos.x) << 16; | |
3029 if ( pIndoorCamera->sRotationX ) | |
3030 { | |
3031 v18 = (y - pIndoorCamera->pos.y) << 16; | |
3032 v47 = ((unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) | |
3033 + ((unsigned __int64)(v18 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16); | |
3034 v50 = (unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; | |
3035 v53 = (unsigned __int64)(v18 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; | |
142 | 3036 v44 = (z - pIndoorCamera->pos.z) << 16; |
0 | 3037 v19 = ((unsigned __int64)(v44 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16) |
3038 + ((unsigned __int64)(v47 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16); | |
3039 X = ((unsigned __int64)(v44 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16) | |
3040 + ((unsigned __int64)(v47 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16); | |
3041 if ( v19 < 262144 || v19 > pOutdoorCamera->shading_dist_mist << 16 ) | |
142 | 3042 continue; |
0 | 3043 v20 = v53 - v50; |
3044 v42 = v53 - v50; | |
3045 v21 = ((unsigned __int64)(v44 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16) | |
3046 - ((unsigned __int64)(v47 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16); | |
3047 } | |
3048 else | |
3049 { | |
3050 v48 = (y - pIndoorCamera->pos.y) << 16; | |
3051 v51 = (unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16; | |
3052 v22 = (unsigned __int64)(v48 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; | |
3053 X = v22 + v51; | |
3054 if ( v22 + v51 < 262144 || v22 + v51 > pOutdoorCamera->shading_dist_mist << 16 ) | |
142 | 3055 continue; |
0 | 3056 v23 = (unsigned __int64)(((x - pIndoorCamera->pos.x) << 16) |
3057 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; | |
3058 v20 = ((unsigned __int64)(v48 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - v23; | |
3059 v42 = ((unsigned __int64)(v48 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - v23; | |
142 | 3060 v21 = (z - pIndoorCamera->pos.z) << 16; |
0 | 3061 } |
3062 v45 = v21; | |
3063 v24 = abs(v20); | |
3064 if ( abs(X) >= v24 ) | |
3065 { | |
3066 LODWORD(v25) = 0; | |
3067 HIDWORD(v25) = SLOWORD(pOutdoorCamera->int_fov_rad); | |
3068 v58 = v25 / X; | |
3069 v26 = v25 / X; | |
3070 LODWORD(v25) = 0; | |
3071 HIDWORD(v25) = SLOWORD(pOutdoorCamera->int_fov_rad); | |
3072 v57 = v25 / X; | |
3073 v27 = pViewport->uScreenCenterX | |
3074 - ((signed int)(((unsigned __int64)(v26 * (signed __int64)v42) >> 16) + 32768) >> 16); | |
3075 v43 = pViewport->uScreenCenterX | |
3076 - ((signed int)(((unsigned __int64)(v26 * (signed __int64)v42) >> 16) + 32768) >> 16); | |
3077 v46 = pViewport->uScreenCenterY - ((signed int)(((unsigned __int64)(v25 / X * v45) >> 16) + 32768) >> 16); | |
3078 result = uNumBillboardsToDraw; | |
3079 v28 = &pBillboardRenderList[uNumBillboardsToDraw]; | |
142 | 3080 if (uNumBillboardsToDraw >= 500) |
3081 return; | |
0 | 3082 ++uNumBillboardsToDraw; |
3083 ++uNumSpritesDrawnThisFrame; | |
142 | 3084 actor->uAttributes |= 8u; |
0 | 3085 v28->uHwSpriteID = v15->pHwSpriteIDs[v41]; |
3086 v28->uIndoorSectorID = 0; | |
142 | 3087 v28->uPalette = v15->uPaletteIndex; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
3088 v28->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v15->scale * (signed __int64)v58) >> 16; |
142 | 3089 v30 = HIDWORD(actor->pActorBuffs[3].uExpireTime) == 0; |
3090 v31 = SHIDWORD(actor->pActorBuffs[3].uExpireTime) < 0; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
3091 v28->_screenspace_y_scaler_packedfloat = (unsigned __int64)(v15->scale * (signed __int64)v57) >> 16; |
142 | 3092 if ( v31 || v31 | v30 && LODWORD(actor->pActorBuffs[3].uExpireTime) <= 0u ) |
0 | 3093 { |
142 | 3094 if ( (signed __int64)actor->pActorBuffs[10].uExpireTime > 0i64 ) |
0 | 3095 { |
142 | 3096 v52 = (unsigned __int64)(pGame->pStru6Instance->_4A806F(actor) |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
3097 * (signed __int64)v28->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 3098 LABEL_53: |
3099 LOWORD(v27) = v43; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
3100 v28->_screenspace_y_scaler_packedfloat = v52; |
0 | 3101 } |
3102 } | |
3103 else | |
3104 { | |
142 | 3105 v32 = actor->pActorBuffs[3].uPower; |
0 | 3106 if ( v32 ) |
3107 { | |
142 | 3108 v33 = actor->pActorBuffs[3].uPower; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
3109 v28->_screenspace_x_scaler_packedfloat = (unsigned __int64)(65536 / (unsigned __int16)v32 * (signed __int64)v28->_screenspace_x_scaler_packedfloat) >> 16; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
3110 v52 = (unsigned __int64)(65536 / v33 * (signed __int64)v28->_screenspace_y_scaler_packedfloat) >> 16; |
0 | 3111 goto LABEL_53; |
3112 } | |
3113 } | |
3114 v28->uScreenSpaceX = v27; | |
142 | 3115 v28->uScreenSpaceY = v46; |
430 | 3116 v28->world_x = x; |
3117 v28->world_y = y; | |
3118 v28->world_z = z; | |
0 | 3119 HIWORD(v34) = HIWORD(X); |
3120 LOWORD(v34) = 0; | |
657 | 3121 v28->dimming_level = 0; |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
813
diff
changeset
|
3122 v28->sZValue = v34 + PID(OBJECT_Actor, i); |
142 | 3123 v28->field_14_actor_id = i; |
0 | 3124 v35 = pMonsterList->pMonsters; |
142 | 3125 v36 = actor->pMonsterInfo.uID; |
0 | 3126 v28->field_1E = v62 | 0x200; |
3127 v28->pSpriteFrame = v15; | |
698 | 3128 v28->uTintColor = pMonsterList->pMonsters[actor->pMonsterInfo.uID-1].uTintColor;//*((int *)&v35[v36] - 36); |
657 | 3129 if (actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) |
0 | 3130 v28->field_1E = v62 | 0x200; |
3131 } | |
142 | 3132 //LABEL_58: |
3133 //++v59; | |
3134 //v54 += 32; | |
3135 //result = v59; | |
3136 //++v1; | |
3137 //} | |
3138 //while ( v59 < (signed int)uNumActors ); | |
0 | 3139 } |
142 | 3140 //return result; |
0 | 3141 } |
3142 // 4E94D3: using guessed type char byte_4E94D3; | |
3143 // 5187E4: using guessed type int uNumSpritesDrawnThisFrame; | |
3144 | |
3145 //----- (0044C1E8) -------------------------------------------------------- | |
3146 bool ODMFace::HasEventHint() | |
3147 { | |
428 | 3148 signed int event_index; // eax@1 |
3149 _evt_raw* start_evt; | |
3150 _evt_raw* end_evt; | |
0 | 3151 |
428 | 3152 event_index = 0; |
3153 if ( (uLevelEVT_NumEvents - 1) <= 0 ) | |
3154 return false; | |
3155 while ( pLevelEVT_Index[event_index].uEventID != this->sCogTriggeredID ) | |
0 | 3156 { |
428 | 3157 ++event_index; |
3158 if ( event_index >= (signed int)(uLevelEVT_NumEvents - 1) ) | |
3159 return false; | |
0 | 3160 } |
428 | 3161 end_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index+1].uEventOffsetInEVT]; |
3162 start_evt=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[event_index].uEventOffsetInEVT]; | |
3163 if ( (end_evt->_e_type != EVENT_Exit) || (start_evt->_e_type!= EVENT_MouseOver) ) | |
3164 return false; | |
0 | 3165 else |
428 | 3166 return true; |
1295 | 3167 } |
3168 //----- (0046D49E) -------------------------------------------------------- | |
3169 int __fastcall ODM_GetFloorLevel(int X, signed int Y, int Z, int __unused, int *pIsOnWater, int *a6, int bWaterWalk) | |
3170 { | |
3171 BSPModel *pBModel; // esi@4 | |
3172 ODMFace *pFace; // ecx@11 | |
3173 int v14; // edx@20 | |
3174 signed int v18; // edx@26 | |
3175 int v19; // eax@28 | |
3176 int v20; // edx@30 | |
3177 int v21; // ST1C_4@30 | |
3178 signed int v22; // edx@30 | |
3179 signed __int64 v23; // qtt@30 | |
3180 int v24; // eax@36 | |
3181 signed int v25; // ecx@38 | |
3182 int result; // eax@42 | |
3183 signed int v27; // ecx@43 | |
3184 int v28; // edi@44 | |
3185 signed int v29; // edx@44 | |
3186 int v30; // esi@45 | |
3187 int v31; // eax@45 | |
3188 ODMFace *v32; // eax@57 | |
3189 int v33; // ecx@59 | |
3190 int v36; // [sp+14h] [bp-2Ch]@24 | |
3191 int v38; // [sp+1Ch] [bp-24h]@2 | |
3192 int v39; // [sp+20h] [bp-20h]@9 | |
3193 signed int pBModelNum; // [sp+28h] [bp-18h]@1 | |
3194 int pFaceNum; // [sp+2Ch] [bp-14h]@8 | |
3195 bool v43; // [sp+30h] [bp-10h]@22 | |
3196 bool v44; // [sp+34h] [bp-Ch]@24 | |
3197 signed int v46; // [sp+3Ch] [bp-4h]@1 | |
3198 signed int v48; // [sp+58h] [bp+18h]@22 | |
3199 signed int v49; // [sp+58h] [bp+18h]@43 | |
3200 | |
3201 v46 = 1; | |
3202 dword_721160[0] = -1; | |
3203 dword_721110[0] = -1; | |
3204 odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, pIsOnWater, bWaterWalk); | |
3205 | |
3206 for ( pBModelNum = 0; pBModelNum < pOutdoor->uNumBModels; ++pBModelNum ) | |
3207 { | |
3208 pBModel = &pOutdoor->pBModels[pBModelNum]; | |
3209 if ( X <= pBModel->sMaxX && X >= pBModel->sMinX && | |
3210 Y <= pBModel->sMaxY && Y >= pBModel->sMinY ) | |
3211 { | |
3212 if ( pBModel->uNumFaces > 0 ) | |
3213 { | |
3214 v39 = 0; | |
3215 for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum ) | |
3216 { | |
3217 pFace = &pBModel->pFaces[pFaceNum]; | |
3218 if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall) | |
3219 && !(pFace->uAttributes & 0x20000000) | |
3220 && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1 | |
3221 && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 ) | |
3222 { | |
3223 | |
3224 for ( uint i = 0; i < pFace->uNumVertices; ++i) | |
3225 { | |
3226 word_721040[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x; | |
3227 word_720F70[2 * i] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y; | |
3228 word_721040[2 * i + 1] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; | |
3229 word_720F70[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; | |
3230 } | |
3231 word_721040[2 * pFace->uNumVertices] = word_721040[0]; | |
3232 word_720F70[2 * pFace->uNumVertices] = word_720F70[0]; | |
3233 v43 = word_720F70[0] >= Y; | |
3234 v48 = 0; | |
3235 if ( 2 * pFace->uNumVertices > 0 ) | |
3236 { | |
3237 for ( int i = 0; i < 2 * pFace->uNumVertices; ++i ) | |
3238 { | |
3239 if ( v48 >= 2 ) | |
3240 break; | |
3241 v36 = word_720F70[i + 1]; | |
3242 v44 = word_720F70[i + 1] >= Y; | |
3243 if ( v43 != v44 ) | |
3244 { | |
3245 v18 = word_721040[i + 1] >= X ? 0 : 2; | |
3246 v19 = v18 | (word_721040[i] < X); | |
3247 if ( v19 != 3 ) | |
3248 { | |
3249 if ( !v19 ) | |
3250 ++v48; | |
3251 else | |
3252 { | |
3253 LODWORD(v23) = (Y - word_720F70[i]) << 16; | |
3254 HIDWORD(v23) = (Y - word_720F70[i]) >> 16; | |
3255 v22 = ((((word_721040[i + 1] - word_721040[i]) * v23 / (v36 - word_720F70[i])) >> 16) + word_721040[i]); | |
3256 if ( v22 >= X) | |
3257 ++v48; | |
3258 } | |
3259 } | |
3260 } | |
3261 v43 = v44; | |
3262 } | |
3263 if ( v48 == 1 ) | |
3264 { | |
3265 if ( v46 >= 20 ) | |
3266 break; | |
3267 if ( pFace->uPolygonType == POLYGON_Floor ) | |
3268 v24 = pBModel->pVertices.pVertices[pFace->pVertexIDs[0]].z; | |
3269 else | |
3270 v24 = ((unsigned __int64)(pFace->zCalc1 * (signed __int64)X) >> 16) + ((unsigned __int64)(pFace->zCalc2 * (signed __int64)Y) >> 16) | |
3271 + HIWORD(pFace->zCalc3); | |
3272 v25 = v46++; | |
3273 odm_floor_level[v25] = v24; | |
3274 dword_721160[v25] = pBModelNum; | |
3275 dword_721110[v25] = pFaceNum; | |
3276 } | |
3277 } | |
3278 } | |
3279 | |
3280 } | |
3281 } | |
3282 } | |
3283 } | |
3284 if ( v46 == 1 ) | |
3285 { | |
3286 *a6 = 0; | |
3287 return odm_floor_level[0]; | |
3288 } | |
3289 v27 = 0; | |
3290 if ( v46 <= 1 ) | |
3291 *a6 = 0; | |
3292 else | |
3293 { | |
3294 //v29 = 1; | |
3295 for ( v49 = 1; v49 < v46; ++v49 ) | |
3296 { | |
3297 if ( odm_floor_level[v49] == odm_floor_level[0] ) | |
3298 { | |
3299 v27 = v49; | |
3300 //++v29; | |
3301 break; | |
3302 } | |
3303 if ( odm_floor_level[0] > Z + 5 ) | |
3304 { | |
3305 if ( odm_floor_level[v49] >= odm_floor_level[0] ) | |
3306 { | |
3307 //++v29; | |
3308 break; | |
3309 } | |
3310 v27 = v49; | |
3311 //++v29; | |
3312 break; | |
3313 } | |
3314 if ( odm_floor_level[v49] > odm_floor_level[0] && odm_floor_level[v49] <= Z + 5 ) | |
3315 { | |
3316 v27 = v49; | |
3317 //++v29; | |
3318 } | |
3319 } | |
3320 if ( !v27 ) | |
3321 *a6 = 0; | |
3322 else | |
3323 *a6 = dword_721110[v27] | (dword_721160[v27] << 6); | |
3324 } | |
3325 if ( v27 ) | |
3326 { | |
3327 v32 = &pOutdoor->pBModels[dword_721160[v27]].pFaces[dword_721110[v27]]; | |
3328 *pIsOnWater = false; | |
3329 if ( v32->Fluid()) | |
3330 *pIsOnWater = true; | |
3331 } | |
3332 if ( odm_floor_level[v27] >= odm_floor_level[0] ) | |
3333 odm_floor_level[0] = odm_floor_level[v27]; | |
3334 return odm_floor_level[0]; | |
3335 } | |
3336 //not sure if right- or left-handed coordinate space assumed, so this could be normal of inverse normal | |
3337 // for a right-handed system, that would be an inverse normal | |
3338 //----- (0046DCC8) -------------------------------------------------------- | |
3339 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out) | |
3340 { | |
3341 auto grid_x = WorldPosToGridCellX(pos_x); | |
3342 auto grid_z = WorldPosToGridCellZ(pos_z) - 1; | |
3343 | |
3344 auto grid_pos_x1 = GridCellToWorldPosX(grid_x); | |
3345 auto grid_pos_x2 = GridCellToWorldPosX(grid_x + 1); | |
3346 auto grid_pos_z1 = GridCellToWorldPosZ(grid_z); | |
3347 auto grid_pos_z2 = GridCellToWorldPosZ(grid_z + 1); | |
3348 | |
3349 auto x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z); | |
3350 auto x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z); | |
3351 auto x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1); | |
3352 auto x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
3353 | |
3354 float side1_dx, side1_dy, side1_dz, | |
3355 side2_dx, side2_dy, side2_dz; | |
3356 | |
3357 auto dx = abs(pos_x - grid_pos_x1), | |
3358 dz = abs(grid_pos_z1 - pos_z); | |
3359 if (dz >= dx) | |
3360 { | |
3361 side1_dy = (double)(x1z1_y - x1z2_y); | |
3362 side2_dy = (double)(x2z2_y - x1z2_y); | |
3363 side2_dx = (double)(grid_pos_x2 - grid_pos_x1); | |
3364 side1_dx = (double)(grid_pos_x1 - grid_pos_x2); | |
3365 side2_dz = 0.0;//(double)(grid_pos_z2 - grid_pos_z2); // bug? z2 - z2 | |
3366 side1_dz = (double)(grid_pos_z1 - grid_pos_z2); // z1 - z2 yes | |
3367 //Log::Warning(L"%S %S %u\n", __FILE__, __FUNCTION__, __LINE__); | |
3368 /* |\ | |
3369 side1 | \ | |
3370 |____\ | |
3371 side 2 */ | |
3372 } | |
3373 else | |
3374 { | |
3375 side1_dy = (double)(x2z2_y - x2z1_y); | |
3376 side2_dy = (double)(x1z1_y - x2z1_y); | |
3377 side2_dx = (double)(grid_pos_x1 - grid_pos_x2); | |
3378 side1_dx = (double)(grid_pos_x2 - grid_pos_x1); | |
3379 side2_dz = 0.0;//(double)(grid_pos_z1 - grid_pos_z1); | |
3380 side1_dz = (double)(grid_pos_z2 - grid_pos_z1); | |
3381 | |
3382 /* side 2 | |
3383 _____ | |
3384 \ | | |
3385 \ | side 1 | |
3386 \| */ | |
3387 } | |
3388 | |
3389 float nx = side1_dy * side2_dz - side1_dz * side2_dy; | |
3390 float ny = side1_dx * side2_dy - side1_dy * side2_dx; | |
3391 float nz = side1_dz * side2_dx - side1_dx * side2_dz; | |
3392 | |
3393 float mag = sqrt(nx * nx + ny * ny + nz * nz); | |
3394 if (fabsf(mag) < 1e-6f) | |
3395 { | |
3396 out->y = 0; | |
3397 out->x = 0; | |
3398 out->z = 65536; | |
3399 } | |
3400 else | |
3401 { | |
3402 float invmag = 1.0 / mag; | |
3403 out->x = invmag * nx * 65536.0; | |
3404 out->y = invmag * ny * 65536.0; | |
3405 out->z = invmag * nz * 65536.0; | |
3406 } | |
3407 } | |
3408 //----- (004014E6) -------------------------------------------------------- | |
3409 void MakeActorAIList_ODM() | |
3410 { | |
3411 int v1; // eax@4 | |
3412 int v2; // ebx@4 | |
3413 unsigned int v3; // ecx@4 | |
3414 int v4; // edx@5 | |
3415 int v5; // edx@7 | |
3416 unsigned int v6; // edx@9 | |
3417 unsigned int v7; // ST20_4@10 | |
3418 int v9; // edi@10 | |
3419 int v10; // ebx@14 | |
3420 int v21; // [sp+Ch] [bp-14h]@4 | |
3421 int v22; // [sp+10h] [bp-10h]@4 | |
3422 | |
3423 pParty->uFlags &= 0xFFFFFFCFu; | |
3424 | |
3425 ai_arrays_size = 0; | |
3426 for (uint i = 0; i < uNumActors; ++i) | |
3427 { | |
3428 auto actor = &pActors[i]; | |
3429 | |
3430 actor->uAttributes &= 0xFFFFFBFF; | |
3431 if (!actor->CanAct()) | |
3432 { | |
3433 actor->uAttributes &= 0xFFFFBFFF; | |
3434 continue; | |
3435 } | |
3436 | |
3437 v22 = abs(pParty->vPosition.z - actor->vPosition.z); | |
3438 v21 = abs(pParty->vPosition.y - actor->vPosition.y); | |
3439 v1 = abs(pParty->vPosition.x - actor->vPosition.x); | |
3440 v2 = v21; | |
3441 v3 = v22; | |
3442 if ( v1 < v21 ) | |
3443 { | |
3444 v4 = v1; | |
3445 v1 = v21; | |
3446 v2 = v4; | |
3447 } | |
3448 if ( v1 < v22 ) | |
3449 { | |
3450 v5 = v1; | |
3451 v1 = v22; | |
3452 v3 = v5; | |
3453 } | |
3454 if ( v2 < (signed int)v3 ) | |
3455 { | |
3456 v6 = v3; | |
3457 v3 = v2; | |
3458 v2 = v6; | |
3459 } | |
3460 v7 = ((unsigned int)(11 * v2) >> 5) + (v3 >> 2) + v1; | |
3461 //v8 = actor->uActorRadius; | |
3462 v9 = v7 - actor->uActorRadius; | |
3463 //v23 = v7 - v8; | |
3464 if ( v9 < 0 ) | |
3465 { | |
3466 v9 = 0; | |
3467 //v23 = 0; | |
3468 } | |
3469 | |
3470 if (v9 < 5632) | |
3471 { | |
3472 v10 = actor->uAttributes & 0xFEFFFFFF; | |
3473 actor->uAttributes = v10; | |
3474 if ( v10 & 0x80000 || actor->GetActorsRelation(0) ) | |
3475 { | |
3476 //v11 = (pParty->uFlags & 0x10) == 0; | |
3477 actor->uAttributes = v10 | 0x1000000; | |
3478 if (v9 < 5120 ) | |
3479 pParty->SetYellowAlert(); | |
3480 if (v9 < 307) | |
3481 pParty->SetRedAlert(); | |
3482 } | |
3483 actor->uAttributes |= 0x00004000; | |
3484 ai_near_actors_distances[ai_arrays_size] = v9; | |
3485 ai_near_actors_ids[ai_arrays_size++] = i; | |
3486 } | |
3487 else | |
3488 actor->uAttributes &= 0xFFFFBFFF; | |
3489 } | |
3490 | |
3491 /* | |
3492 result = v27; | |
3493 if ( v27 > 0 ) | |
3494 { | |
3495 v14 = 0; | |
3496 v15 = 1; | |
3497 v26 = 1; | |
3498 do | |
3499 { | |
3500 while ( 1 ) | |
3501 { | |
3502 v24 = v15; | |
3503 if ( v15 >= result ) | |
3504 break; | |
3505 v16 = ai_near_actors_distances[v14]; | |
3506 if ( v16 > ai_near_actors_distances[v15] ) | |
3507 { | |
3508 v17 = &ai_near_actors_ids[v15]; | |
3509 v18 = ai_near_actors_ids[v14]; | |
3510 ai_near_actors_ids[v14] = *v17; | |
3511 *v17 = v18; | |
3512 v15 = v24; | |
3513 ai_near_actors_distances[v14] = ai_near_actors_distances[v24]; | |
3514 ai_near_actors_distances[v24] = v16; | |
3515 } | |
3516 result = v27; | |
3517 ++v15; | |
3518 } | |
3519 ++v14; | |
3520 v15 = v26 + 1; | |
3521 v26 = v15; | |
3522 } | |
3523 while ( v15 - 1 < result ); | |
3524 }*/ | |
3525 | |
3526 for (uint i = 0; i < ai_arrays_size; ++i) | |
3527 for (uint j = 0; j < i; ++j) | |
3528 if (ai_near_actors_distances[j] > ai_near_actors_distances[i]) | |
3529 { | |
3530 int tmp = ai_near_actors_distances[j]; | |
3531 ai_near_actors_distances[j] = ai_near_actors_distances[i]; | |
3532 ai_near_actors_distances[i] = tmp; | |
3533 | |
3534 tmp = ai_near_actors_ids[j]; | |
3535 ai_near_actors_ids[j] = ai_near_actors_ids[i]; | |
3536 ai_near_actors_ids[i] = tmp; | |
3537 } | |
3538 | |
3539 | |
3540 if (ai_arrays_size > 30) | |
3541 ai_arrays_size = 30; | |
3542 | |
3543 for (uint i = 0; i < ai_arrays_size; ++i) | |
3544 pActors[ai_near_actors_ids[i]].uAttributes |= 0x0400; | |
1297 | 3545 } |
3546 //----- (0046BE0A) -------------------------------------------------------- | |
3547 void __cdecl ODM_UpdateUserInputAndOther() | |
3548 { | |
3549 bool v0; // eax@5 | |
3550 char pOut[32]; // [sp+8h] [bp-20h]@5 | |
3551 | |
3552 UpdateObjects(); | |
3553 ODM_ProcessPartyActions(); | |
3554 if ( pParty->vPosition.x < -22528 | |
3555 || pParty->vPosition.x > 22528 | |
3556 || pParty->vPosition.y < -22528 | |
3557 || pParty->vPosition.y > 22528 ) | |
3558 { | |
3559 strcpy(pOutdoor->pLevelFilename, pCurrentMapName.data()); | |
3560 v0 = pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 32); | |
3561 if ( !bUnderwater && (pParty->uFlags & (PARTY_FLAGS_1_STANDING_ON_WATER | PARTY_FLAGS_1_FALLING | 0x04) || pParty->uFlags & 0x0200 || pParty->bFlying) || !v0 ) | |
3562 { | |
3563 if ( pParty->vPosition.x < -22528 ) | |
3564 pParty->vPosition.x = -22528; | |
3565 if ( pParty->vPosition.x > 22528 ) | |
3566 pParty->vPosition.x = 22528; | |
3567 if ( pParty->vPosition.y < -22528 ) | |
3568 pParty->vPosition.y = -22528; | |
3569 if ( pParty->vPosition.y > 22528 ) | |
3570 pParty->vPosition.y = 22528; | |
3571 } | |
3572 else | |
3573 { | |
3574 pAudioPlayer->StopChannels(-1, -1); | |
3575 TravelUI_Load(); | |
3576 } | |
3577 } | |
3578 UpdateActors_ODM(); | |
3579 check_event_triggers(); | |
3580 } | |
3581 //----- (0041F54A) -------------------------------------------------------- | |
3582 void __cdecl LoadActualSkyFrame() | |
3583 { | |
3584 if ( pTexture_RestUI_CurrentSkyFrame ) | |
3585 pTexture_RestUI_CurrentSkyFrame->Release(); | |
3586 if ( pTexture_RestUI_CurrentHourglassFrame ) | |
3587 pTexture_RestUI_CurrentHourglassFrame->Release(); | |
3588 pIcons_LOD->SyncLoadedFilesCount(); | |
3589 sprintf(pTmpBuf.data(), "TERRA%03d", pParty->uCurrentMinute / 6 + 10 * pParty->uCurrentHour); | |
3590 pTexture_RestUI_CurrentSkyFrame = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); | |
1323 | 3591 } |
3592 | |
3593 | |
3594 //----- (004626BA) -------------------------------------------------------- | |
3595 OutdoorLocation::OutdoorLocation() | |
3596 { | |
3597 subconstuctor(); | |
3598 uLastSunlightUpdateMinute = 0; | |
3599 | |
3600 uNumBModels = 0; | |
3601 pBModels = nullptr; | |
3602 } | |
3603 | |
3604 //----- (004626CD) -------------------------------------------------------- | |
3605 void OutdoorLocation::subconstuctor() | |
3606 { | |
3607 //OutdoorLocationTerrain::OutdoorLocationTerrain(&this->pTerrain); | |
3608 field_F0 = 0; | |
3609 field_F4 = 0x40000000u; | |
3610 //DLVHeader::DLVHeader(&v1->ddm); | |
3611 pSpawnPoints = 0; | |
3612 pBModels = 0; | |
3613 pCmap = 0; | |
3614 pFaceIDLIST = 0; | |
3615 pOMAP = 0; | |
3616 } | |
3617 |