World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Outdoor.h
См. документацию.
1 #pragma once
2 
3 #include <vector>
4 
6 
9 
10 #define DAY_ATTRIB_FOG 1
11 
12 #pragma pack(push, 1)
13 struct ODMHeader {
15  char pMagic[4];
18 };
19 #pragma pack(pop)
20 
21 #pragma pack(push, 1)
25 };
26 #pragma pack(pop)
27 
28 #pragma pack(push, 1)
29 struct DMap {
32 };
33 #pragma pack(pop)
34 
35 /* 79 */
36 #pragma pack(push, 1)
38  //----- (0047C794) --------------------------------------------------------
40  pHeightmap = nullptr;
41  pTilemap = nullptr;
42  pAttributemap = nullptr;
43  pDmap = nullptr;
44  this->field_10 = 0;
45  this->field_12 = 0;
46  }
47 
48  void _47C7A9();
49  void Release();
50  void FillDMap(int X, int Y, int W, int Z);
51  int _47CB57(unsigned char *pixels_8bit, int a2, int num_pixels);
52  bool ZeroLandscape();
53  bool Initialize();
54 
58  struct DMap *pDmap;
63  int field_18;
64  int field_1C;
65 };
66 #pragma pack(pop)
67 
70  void subconstuctor();
71  // int New_SKY_NIGHT_ID;
72  void ExecDraw(unsigned int bRedraw);
73  void PrepareActorsDrawList();
74  void CreateDebugLocation();
75  void Release();
76  bool Load(const String &filename, int days_played,
77  int respawn_interval_days, int *thisa);
78  int GetTileIdByTileMapId(signed int a2);
79  int _47ED83(signed int a2, signed int a3);
80  int ActuallyGetSomeOtherTileInfo(signed int uX, signed int uY);
81  int DoGetHeightOnTerrain(signed int sX, signed int sZ);
82  int GetSoundIdByPosition(signed int X_pos, signed int Y_pos, int a4);
83  int UpdateDiscoveredArea(int a2, int a3, int a4);
84  bool IsMapCellFullyRevealed(signed int a2, signed int a3);
85  bool IsMapCellPartiallyRevealed(signed int a2, signed int a3);
86  bool _47F0E2();
87  bool PrepareDecorations();
88  void ArrangeSpriteObjects();
89  bool InitalizeActors(int a1);
90  bool LoadRoadTileset();
91  bool LoadTileGroupIds();
92  double GetFogDensityByTime();
93  int GetSomeOtherTileInfo(int sX, int sY);
94  TileDesc *GetTile(int sX, int sZ);
95  TileDesc *DoGetTile(int uX, int uZ);
96  int GetHeightOnTerrain(int sX, int sZ);
97  bool Initialize(const String &filename, int days_played,
98  int respawn_interval_days, int *thisa);
99  // bool Release2();
100  bool GetTravelDestination(signed int sPartyX, signed int sPartyZ,
101  char *pOut, signed int a5);
102  void MessWithLUN();
103  void UpdateSunlightVectors();
104  void UpdateFog();
105  int GetNumFoodRequiredToRestInCurrentPos(int x, signed int y, int z);
106  void SetFog();
107  void Draw();
108 
109  static void LoadActualSkyFrame();
110 
116  OutdoorLocationTileType pTileTypes[4]; // [3] road tileset
118  void *pCmap;
120  unsigned int numFaceIDListElems;
122  unsigned int *pOMAP;
123  Texture *sky_texture; // signed int sSky_TextureID;
124  Texture *main_tile_texture; // signed int sMainTile_BitmapID;
127  int field_F4;
128  char field_F8[968];
129  unsigned int uNumSpawnPoints;
133  unsigned char
134  uFullyRevealedCellOnMap[88][11]; // 968 the inner array is 11
135  // bytes long, because every bit is
136  // used for a separate cell, so in the
137  // end it's 11 * 8 bits = 88 values
138  unsigned char uPartiallyRevealedCellOnMap[88][11]; // [968]
142  unsigned int pSpriteIDs_LUN[8];
143  unsigned int uSpriteID_LUNFULL;
145  unsigned int uSpriteID_LUN3_4_cp;
147  unsigned int uSpriteID_LUN1_2_cp;
149  unsigned int uSpriteID_LUN1_4_cp;
163  Vec3_int_ vSunlight;
169  float field_D50;
175  char field_D68[111900];
176  float fFogDensity;
178 
179  Log *log = nullptr;
183 };
184 
185 extern OutdoorLocation *pOutdoor;
186 
188 int ODM_GetFloorLevel(int X, signed int Y, int Z, int, bool *pOnWater,
189  int *bmodel_pid, int bWaterWalk);
190 int GetCeilingHeight(int Party_X, signed int Party_Y, int Party_ZHeight,
191  int pFaceID);
192 void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out);
193 void UpdateActors_ODM();
196 void SetUnderwaterFog();
197 void ODM_Project(unsigned int uNumVertices);
198 void sub_487DA9();
199 void ODM_LoadAndInitialize(const String &pLevelFilename,
200  struct ODMRenderParams *thisa);
201 unsigned int GetLevelFogColor();
202 int sub_47C3D7_get_fog_specular(int a1, int a2, float a3);
203 unsigned int WorldPosToGridCellX(int);
204 unsigned int WorldPosToGridCellZ(int);
205 int GridCellToWorldPosX(int);
206 int GridCellToWorldPosZ(int);
208 bool IsTerrainSlopeTooHigh(int pos_x, int pos_y);
209 int GetTerrainHeightsAroundParty2(int a1, int a2, bool *a3, int a4);
uint16_t
unsigned __int16 uint16_t
Definition: SDL_config.h:37
OutdoorLocationTerrain::ZeroLandscape
bool ZeroLandscape()
Definition: Outdoor.cpp:875
OutdoorLocationTerrain::pHeightmap
uint8_t * pHeightmap
Definition: Outdoor.h:55
OutdoorLocation::uSpriteID_LUN1_4_cp
unsigned int uSpriteID_LUN1_4_cp
Definition: Outdoor.h:149
DMap::field0
uint8_t field0
Definition: Outdoor.h:30
OutdoorLocation::uNumSpawnPoints
unsigned int uNumSpawnPoints
Definition: Outdoor.h:129
int16_t
signed __int16 int16_t
Definition: SDL_config.h:36
Tileset
Tileset
Definition: TileFrameTable.h:25
OutdoorLocation::pOMAP
unsigned int * pOMAP
Definition: Outdoor.h:122
OutdoorLocation::field_D68
char field_D68[111900]
Definition: Outdoor.h:175
OutdoorLocation::PrepareDecorations
bool PrepareDecorations()
Definition: Outdoor.cpp:1583
WorldPosToGridCellX
unsigned int WorldPosToGridCellX(int)
Definition: Outdoor.cpp:3955
pOutdoor
OutdoorLocation * pOutdoor
Definition: Outdoor.cpp:48
OutdoorLocation::inv_sunlight_y
int inv_sunlight_y
Definition: Outdoor.h:158
DMap
Definition: Outdoor.h:29
OutdoorLocation::pBModels
BSPModelList pBModels
Definition: Outdoor.h:119
OutdoorLocation::IsMapCellPartiallyRevealed
bool IsMapCellPartiallyRevealed(signed int a2, signed int a3)
Definition: Outdoor.cpp:1559
OutdoorLocation::GetNumFoodRequiredToRestInCurrentPos
int GetNumFoodRequiredToRestInCurrentPos(int x, signed int y, int z)
Definition: Outdoor.cpp:457
OutdoorLocation::GetFogDensityByTime
double GetFogDensityByTime()
Definition: Outdoor.cpp:172
OutdoorLocationTerrain::Initialize
bool Initialize()
Definition: Outdoor.cpp:890
OutdoorLocation::field_D44
int field_D44
Definition: Outdoor.h:166
OutdoorLocation::field_D64
int field_D64
Definition: Outdoor.h:174
OutdoorLocation::uFullyRevealedCellOnMap
unsigned char uFullyRevealedCellOnMap[88][11]
Definition: Outdoor.h:134
OutdoorLocation::inv_sunlight_z
int inv_sunlight_z
Definition: Outdoor.h:159
z
GLdouble GLdouble z
Definition: SDL_opengl_glext.h:407
OutdoorLocation::sky_texture
Texture * sky_texture
Definition: Outdoor.h:123
OutdoorLocationTileType::tileset
Tileset tileset
Definition: Outdoor.h:23
OutdoorLocation::MessWithLUN
void MessWithLUN()
Definition: Outdoor.cpp:389
GridCellToWorldPosZ
int GridCellToWorldPosZ(int)
Definition: Outdoor.cpp:3972
Texture
Definition: Texture.h:4
OutdoorLocation::PrepareActorsDrawList
void PrepareActorsDrawList()
Definition: Outdoor.cpp:1722
OutdoorLocationTerrain::pAttributemap
uint8_t * pAttributemap
Definition: Outdoor.h:57
OutdoorLocation::field_D58
int field_D58
Definition: Outdoor.h:171
OutdoorLocation::uSpriteID_LUNFULL
unsigned int uSpriteID_LUNFULL
Definition: Outdoor.h:143
OutdoorLocation::field_CE8
int field_CE8
Definition: Outdoor.h:144
OutdoorLocation::OutdoorLocation
OutdoorLocation()
Definition: Outdoor.cpp:2158
OutdoorLocation::decal_builder
DecalBuilder * decal_builder
Definition: Outdoor.h:180
SpawnPointMM7
Definition: Indoor.h:304
IsTerrainSlopeTooHigh
bool IsTerrainSlopeTooHigh(int pos_x, int pos_y)
Definition: Outdoor.cpp:3976
OutdoorLocation::fFogDensity
float fFogDensity
Definition: Outdoor.h:176
Log
Definition: Log.h:3
OutdoorLocation::IsMapCellFullyRevealed
bool IsMapCellFullyRevealed(signed int a2, signed int a3)
Definition: Outdoor.cpp:1549
OutdoorLocation::UpdateFog
void UpdateFog()
Definition: Outdoor.cpp:453
OutdoorLocation::UpdateSunlightVectors
void UpdateSunlightVectors()
Definition: Outdoor.cpp:429
OutdoorLocation::field_F4
int field_F4
Definition: Outdoor.h:127
SetUnderwaterFog
void SetUnderwaterFog()
Definition: Outdoor.cpp:3382
sub_481ED9_MessWithODMRenderParams
void sub_481ED9_MessWithODMRenderParams()
OutdoorLocation::DoGetTile
TileDesc * DoGetTile(int uX, int uZ)
Definition: Outdoor.cpp:1389
OutdoorLocation::inv_sunlight_x
int inv_sunlight_x
Definition: Outdoor.h:157
OutdoorLocation::ground_tileset
String ground_tileset
Definition: Outdoor.h:115
OutdoorLocation::field_D4C
int field_D4C
Definition: Outdoor.h:168
OutdoorLocation::LoadTileGroupIds
bool LoadTileGroupIds()
Definition: Outdoor.cpp:1713
OutdoorLocationTerrain::field_18
int field_18
Definition: Outdoor.h:63
OutdoorLocation::main_tile_texture
Texture * main_tile_texture
Definition: Outdoor.h:124
ODMHeader::uCompressedSize
uint32_t uCompressedSize
Definition: Outdoor.h:16
OutdoorLocation::pCmap
void * pCmap
Definition: Outdoor.h:118
OutdoorLocation::uPartiallyRevealedCellOnMap
unsigned char uPartiallyRevealedCellOnMap[88][11]
Definition: Outdoor.h:138
ODMRenderParams
Definition: IRender.h:55
y
EGLSurface EGLint EGLint y
Definition: SDL_egl.h:1596
OutdoorLocation::ActuallyGetSomeOtherTileInfo
int ActuallyGetSomeOtherTileInfo(signed int uX, signed int uY)
Definition: Outdoor.cpp:1459
OutdoorLocation::GetSomeOtherTileInfo
int GetSomeOtherTileInfo(int sX, int sY)
Definition: Outdoor.cpp:197
OutdoorLocation::pSpriteIDs_LUN
unsigned int pSpriteIDs_LUN[8]
Definition: Outdoor.h:142
ODM_UpdateUserInputAndOther
void ODM_UpdateUserInputAndOther()
Definition: Outdoor.cpp:2115
OutdoorLocation::pFaceIDLIST
uint16_t * pFaceIDLIST
Definition: Outdoor.h:121
OutdoorLocation::ExecDraw
void ExecDraw(unsigned int bRedraw)
Definition: Outdoor.cpp:84
OutdoorLocation::log
Log * log
Definition: Outdoor.h:179
ODMHeader::pMagic
char pMagic[4]
Definition: Outdoor.h:15
LightmapBuilder
Definition: LightmapBuilder.h:33
OutdoorLocation::uLastSunlightUpdateMinute
int uLastSunlightUpdateMinute
Definition: Outdoor.h:177
OutdoorLocation::uSpriteID_LUN_SUN
uint16_t uSpriteID_LUN_SUN
Definition: Outdoor.h:151
OutdoorLocation::_47F0E2
bool _47F0E2()
Definition: Outdoor.cpp:1569
BSPModelList
Definition: BSPModel.h:195
OutdoorLocation::location_filename
String location_filename
Definition: Outdoor.h:112
OutdoorLocation::lightmap_builder
LightmapBuilder * lightmap_builder
Definition: Outdoor.h:182
OutdoorLocation::field_D50
float field_D50
Definition: Outdoor.h:169
TileFrameTable.h
OutdoorLocation::field_F8
char field_F8[968]
Definition: Outdoor.h:128
OutdoorLocation::loc_time
LocationTime_stru1 loc_time
Definition: Outdoor.h:132
x
EGLSurface EGLint x
Definition: SDL_egl.h:1596
OutdoorLocation
Definition: Outdoor.h:68
OutdoorLocationTerrain::_47CB57
int _47CB57(unsigned char *pixels_8bit, int a2, int num_pixels)
Definition: Outdoor.cpp:784
OutdoorLocation::field_D5C
int field_D5C
Definition: Outdoor.h:172
sub_487DA9
void sub_487DA9()
Definition: Outdoor.cpp:3388
GetCeilingHeight
int GetCeilingHeight(int Party_X, signed int Party_Y, int Party_ZHeight, int pFaceID)
Definition: Outdoor.cpp:3254
ODM_GetTerrainNormalAt
void ODM_GetTerrainNormalAt(int pos_x, int pos_z, Vec3_int_ *out)
Definition: Outdoor.cpp:2052
GridCellToWorldPosX
int GridCellToWorldPosX(int)
Definition: Outdoor.cpp:3969
OutdoorLocation::field_D0C
int field_D0C
Definition: Outdoor.h:154
Indoor.h
OutdoorLocationTerrain::pDmap
struct DMap * pDmap
Definition: Outdoor.h:58
TileDesc
Definition: TileFrameTable.h:43
ODMHeader
Definition: Outdoor.h:13
OutdoorLocation::location_file_description
String location_file_description
Definition: Outdoor.h:113
OutdoorLocation::field_CB8
int field_CB8
Definition: Outdoor.h:139
OutdoorLocation::uSpriteID_LUN3_4_cp
unsigned int uSpriteID_LUN3_4_cp
Definition: Outdoor.h:145
OutdoorLocationTerrain::Release
void Release()
Definition: Outdoor.cpp:609
OutdoorLocation::Load
bool Load(const String &filename, int days_played, int respawn_interval_days, int *thisa)
Definition: Outdoor.cpp:980
OutdoorLocation::field_CF8
int field_CF8
Definition: Outdoor.h:148
sub_47C3D7_get_fog_specular
int sub_47C3D7_get_fog_specular(int a1, int a2, float a3)
Definition: Outdoor.cpp:3898
UpdateActors_ODM
void UpdateActors_ODM()
Definition: Outdoor.cpp:3393
OutdoorLocation::field_D06
int16_t field_D06
Definition: Outdoor.h:152
ODM_ProcessPartyActions
void ODM_ProcessPartyActions()
Definition: Outdoor.cpp:2221
OutdoorLocation::field_F2
int16_t field_F2
Definition: Outdoor.h:126
OutdoorLocation::uSpriteID_LUN1_2_cp
unsigned int uSpriteID_LUN1_2_cp
Definition: Outdoor.h:147
OutdoorLocation::field_D14
int field_D14
Definition: Outdoor.h:156
OutdoorLocationTerrain::field_12
int16_t field_12
Definition: Outdoor.h:60
DDM_DLV_Header
Definition: Indoor.h:82
ODM_Project
void ODM_Project(unsigned int uNumVertices)
Definition: Outdoor.cpp:2180
OutdoorLocation::field_D54
int field_D54
Definition: Outdoor.h:170
ODM_GetFloorLevel
int ODM_GetFloorLevel(int X, signed int Y, int Z, int, bool *pOnWater, int *bmodel_pid, int bWaterWalk)
Definition: Outdoor.cpp:1877
OutdoorLocation::field_F0
int16_t field_F0
Definition: Outdoor.h:125
OutdoorLocationTerrain::field_1C
int field_1C
Definition: Outdoor.h:64
OutdoorLocation::GetHeightOnTerrain
int GetHeightOnTerrain(int sX, int sZ)
Definition: Outdoor.cpp:228
OutdoorLocationTerrain::FillDMap
void FillDMap(int X, int Y, int W, int Z)
Definition: Outdoor.cpp:623
GetLevelFogColor
unsigned int GetLevelFogColor()
Definition: Outdoor.cpp:3871
OutdoorLocation::GetTileIdByTileMapId
int GetTileIdByTileMapId(signed int a2)
Definition: Outdoor.cpp:1368
OutdoorLocation::vSunlight
Vec3_int_ vSunlight
Definition: Outdoor.h:163
OutdoorLocation::sky_texture_filename
String sky_texture_filename
Definition: Outdoor.h:114
OutdoorLocation::field_D40
int field_D40
Definition: Outdoor.h:165
BSPModel.h
OutdoorLocationTerrain::pTilemap
uint8_t * pTilemap
Definition: Outdoor.h:56
Is_out15odm_underwater
char Is_out15odm_underwater()
Definition: Outdoor.cpp:3377
OutdoorLocation::field_D60
int field_D60
Definition: Outdoor.h:173
OutdoorLocation::max_terrain_dimming_level
int max_terrain_dimming_level
Definition: Outdoor.h:140
OutdoorLocation::ddm
struct DDM_DLV_Header ddm
Definition: Outdoor.h:131
OutdoorLocation::field_D08
int field_D08
Definition: Outdoor.h:153
OutdoorLocation::SetFog
void SetFog()
Definition: Outdoor.cpp:483
OutdoorLocation::field_CC0
int field_CC0
Definition: Outdoor.h:141
DMap::field1
uint8_t field1
Definition: Outdoor.h:31
OutdoorLocationTileType
Definition: Outdoor.h:22
OutdoorLocationTerrain::field_14
int16_t field_14
Definition: Outdoor.h:61
OutdoorLocation::pSpawnPoints
struct SpawnPointMM7 * pSpawnPoints
Definition: Outdoor.h:130
OutdoorLocationTerrain::field_10
int16_t field_10
Definition: Outdoor.h:59
ODMHeader::uDecompressedSize
uint32_t uDecompressedSize
Definition: Outdoor.h:17
uint8_t
unsigned __int8 uint8_t
Definition: SDL_config.h:35
OutdoorLocation::spell_fx_renderer
SpellFxRenderer * spell_fx_renderer
Definition: Outdoor.h:181
OutdoorLocationTerrain::_47C7A9
void _47C7A9()
Definition: Outdoor.cpp:599
SpellFxRenderer
Definition: SpellFxRenderer.h:97
OutdoorLocation::numFaceIDListElems
unsigned int numFaceIDListElems
Definition: Outdoor.h:120
OutdoorLocation::Release
void Release()
Definition: Outdoor.cpp:952
GetTerrainHeightsAroundParty2
int GetTerrainHeightsAroundParty2(int a1, int a2, bool *a3, int a4)
Definition: Outdoor.cpp:4044
OutdoorLocationTerrain::field_16
int16_t field_16
Definition: Outdoor.h:62
OutdoorLocation::field_D2C
int field_D2C
Definition: Outdoor.h:162
WorldPosToGridCellZ
unsigned int WorldPosToGridCellZ(int)
Definition: Outdoor.cpp:3962
OutdoorLocationTerrain
Definition: Outdoor.h:37
OutdoorLocation::pTileTypes
OutdoorLocationTileType pTileTypes[4]
Definition: Outdoor.h:116
OutdoorLocation::InitalizeActors
bool InitalizeActors(int a1)
Definition: Outdoor.cpp:1641
OutdoorLocation::pTerrain
struct OutdoorLocationTerrain pTerrain
Definition: Outdoor.h:117
OutdoorLocation::subconstuctor
void subconstuctor()
Definition: Outdoor.cpp:2168
OutdoorLocation::LoadRoadTileset
bool LoadRoadTileset()
Definition: Outdoor.cpp:1705
OutdoorLocation::field_D48
int field_D48
Definition: Outdoor.h:167
OutdoorLocation::field_D24
int field_D24
Definition: Outdoor.h:160
OutdoorLocation::LoadActualSkyFrame
static void LoadActualSkyFrame()
Definition: Outdoor.cpp:2143
OutdoorLocation::UpdateDiscoveredArea
int UpdateDiscoveredArea(int a2, int a3, int a4)
Definition: Outdoor.cpp:1527
OutdoorLocation::GetTravelDestination
bool GetTravelDestination(signed int sPartyX, signed int sPartyZ, char *pOut, signed int a5)
Definition: Outdoor.cpp:330
OutdoorLocation::CreateDebugLocation
void CreateDebugLocation()
Definition: Outdoor.cpp:902
OutdoorLocation::GetSoundIdByPosition
int GetSoundIdByPosition(signed int X_pos, signed int Y_pos, int a4)
Definition: Outdoor.cpp:1482
OutdoorLocation::_47ED83
int _47ED83(signed int a2, signed int a3)
Definition: Outdoor.cpp:1451
OutdoorLocation::field_D00
int field_D00
Definition: Outdoor.h:150
OutdoorLocation::level_filename
String level_filename
Definition: Outdoor.h:111
OutdoorLocation::Initialize
bool Initialize(const String &filename, int days_played, int respawn_interval_days, int *thisa)
Definition: Outdoor.cpp:246
ODM_LoadAndInitialize
void ODM_LoadAndInitialize(const String &pLevelFilename, struct ODMRenderParams *thisa)
Definition: Outdoor.cpp:3788
OutdoorLocation::field_D28
int field_D28
Definition: Outdoor.h:161
LocationTime_stru1
Definition: Indoor.h:273
OutdoorLocation::field_D10
int field_D10
Definition: Outdoor.h:155
OutdoorLocation::field_CF0
int field_CF0
Definition: Outdoor.h:146
OutdoorLocation::ArrangeSpriteObjects
void ArrangeSpriteObjects()
Definition: Outdoor.cpp:1616
OutdoorLocation::DoGetHeightOnTerrain
int DoGetHeightOnTerrain(signed int sX, signed int sZ)
Definition: Outdoor.cpp:1474
OutdoorLocationTileType::uTileID
uint16_t uTileID
Definition: Outdoor.h:24
uint32_t
unsigned __int32 uint32_t
Definition: SDL_config.h:39
OutdoorLocation::Draw
void Draw()
Definition: Outdoor.cpp:160
OutdoorLocationTerrain::OutdoorLocationTerrain
OutdoorLocationTerrain()
Definition: Outdoor.h:39
String
std::string String
Definition: Strings.h:10
OutdoorLocation::GetTile
TileDesc * GetTile(int sX, int sZ)
Definition: Outdoor.cpp:216
ODMHeader::uVersion
uint32_t uVersion
Definition: Outdoor.h:14
DecalBuilder
Definition: DecalBuilder.h:123
OutdoorLocation::field_D3C
int field_D3C
Definition: Outdoor.h:164