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