feat(profile): refactor lua, bc code

This commit is contained in:
phaneron 2026-04-01 17:37:40 -04:00
parent e79ee08905
commit 37db5336e4
40 changed files with 3424 additions and 0 deletions

View file

@ -0,0 +1,20 @@
#ifndef BC_FILE_FILE_INFO_H
#define BC_FILE_FILE_INFO_H
#include "bc/time/types.h"
DECLARE_STRUCT(Blizzard__File__FileInfo);
struct Blizzard__File__FileInfo {
char* path;
uint32_t unk04;
int64_t size; // 08
int32_t attributes;
Blizzard__Time__Timestamp createTime;
Blizzard__Time__Timestamp modTime;
Blizzard__Time__Timestamp accessTime;
int32_t existence;
int32_t regularFile;
};
#endif

View file

@ -0,0 +1,33 @@
#ifndef BC_FILE_INFO_MASK_H
#define BC_FILE_INFO_MASK_H
#if defined(BITFIELDS_SUPPORTED)
DECLARE_UNION(Blizzard__File__FileInfoMask);
union Blizzard__File__FileInfoMask {
struct {
uint32_t path : 1;
uint32_t size : 1;
uint32_t attributes : 1;
uint32_t createTime : 1;
uint32_t modTime : 1;
uint32_t accessTime : 1;
uint32_t existence : 1;
uint32_t regularFile : 1;
uint32_t pad : 24;
};
uint32_t all;
};
#else
DECLARE_STRUCT(Blizzard__File__FileInfoMask);
struct Blizzard__File__FileInfoMask {
uint32_t all;
};
#endif
#endif

View file

@ -0,0 +1,6 @@
#ifndef BC_FILE_INODE_H
#define BC_FILE_INODE_H
typedef int32_t Blizzard__File__INODE;
#endif

View file

@ -0,0 +1,17 @@
#ifndef BC_FILE_STREAMING_INFO_H
#define BC_FILE_STREAMING_INFO_H
DECLARE_STRUCT(Blizzard__File__StreamingInfo);
#include "bc/file/fileinfo.h"
#include "bc/file/inode.h"
#include "bc/storage/storageunithandle.h"
struct Blizzard__File__StreamingInfo {
Blizzard__Storage__StorageUnitHandle storagehandle;
Blizzard__File__INODE inode;
uint32_t streamRefCount;
Blizzard__File__FileInfo streaminginfo;
};
#endif

View file

@ -0,0 +1,24 @@
#ifndef BC_STORAGE_STORAGE_UNIT_H
#define BC_STORAGE_STORAGE_UNIT_H
DECLARE_STRUCT(Blizzard__Storage__StorageUnit);
struct Blizzard__Storage__StorageUnit {
uint32_t unk00;
uint32_t unk04;
uint32_t unk08;
uint32_t unk0C;
uint32_t unk10;
uint32_t unk14;
uint32_t unk18;
uint32_t unk1C;
uint32_t unk20;
uint32_t unk24;
uint32_t unk28;
uint32_t unk2C;
uint32_t unk30;
uint32_t unk34;
uint32_t unk38;
};
#endif

View file

@ -0,0 +1,14 @@
#ifndef BC_STORAGE_STORAGE_UNIT_HANDLE_H
#define BC_STORAGE_STORAGE_UNIT_HANDLE_H
DECLARE_STRUCT(Blizzard__Storage__StorageUnitHandle);
#include "bc/file/inode.h"
#include "bc/storage/storageunit.h"
struct Blizzard__Storage__StorageUnitHandle {
Blizzard__File__INODE mNode;
Blizzard__Storage__StorageUnit* mUnit;
};
#endif

View file

@ -0,0 +1,13 @@
#ifndef BC_STRING_CONVERSION_CODEPAGE_TO_UTF8_H
#define BC_STRING_CONVERSION_CODEPAGE_TO_UTF8_H
DECLARE_STRUCT(Blizzard__StringConversion_CodepageToUTF8__ToNative);
#include "bc/util/buffer.h"
// class Blizzard::CodepageToUTF8::ToNative : Blizzard::Util::Buffer<300, wchar_t>
struct Blizzard__StringConversion_CodePageToUTF8__ToNative {
Blizzard__Util__Buffer_300_char _;
};
#endif

View file

@ -0,0 +1,13 @@
#ifndef BC_STRING_CONVERSION_PASSTHROUGH_H
#define BC_STRING_CONVERSION_PASSTHROUGH_H
DECLARE_STRUCT(Blizzard__StringConversion_Passthrough__ToNative);
#include "bc/util/buffer.h"
// class Blizzard::StringConversion_Passthrough::ToNative : Blizzard::Util::Buffer<300, char>
struct Blizzard__StringConversion__Passthrough__ToNative {
Blizzard__Util__Buffer_300_char _;
};
#endif

View file

@ -0,0 +1,14 @@
#ifndef BC_STRING_CONVERSION_UTF16_TO_UTF8_H
#define BC_STRING_CONVERSION_UTF16_TO_UTF8_H
DECLARE_STRUCT(Blizzard__StringConversion_UTF16ToUTF8__ToNative);
#include "bc/util/buffer.h"
// class Blizzard::UTF16ToUTF8::ToNative : Blizzard::Util::Buffer<300, wchar_t>
struct Blizzard__StringConversion_UTF16ToUTF8__ToNative {
// Never ever use wchar_t!!!
Blizzard__Util__Buffer_300_uint16_t _;
};
#endif

View file

@ -0,0 +1,14 @@
#ifndef BC_SYSTEM_FILE_FILE_FUNC_H
#define BC_SYSTEM_FILE_FILE_FUNC_H
DECLARE_STRUCT(Blizzard__File__Filesystem);
DECLARE_STRUCT(System_File__Stacked__FileParms);
typedef bool (*System_File__Stacked__FileFunc)(
Blizzard__File__Filesystem *fs,
System_File__Stacked__FileParms *parms);
#include "bc/file/filesystem.h"
#include "bc/systemfile/stacked/fileparms.h"
#endif

View file

@ -0,0 +1,46 @@
#ifndef BC_SYSTEM_FILE_STACKED_FILE_PARMS_H
#define BC_SYSTEM_FILE_STACKED_FILE_PARMS_H
DECLARE_STRUCT(System_File__Stacked__FileParms);
#include "bc/file/fileinfo.h"
#include "bc/file/filesystem.h"
#include "bc/file/infomask.h"
#include "bc/file/mode.h"
#include "bc/file/processdir.h"
#include "bc/file/stream.h"
#include "system/types.h"
struct System_File__Stacked__FileParms {
// the offset of the file operation
// inside Blizzard::File::Filesystem
offset_in_Blizzard__File__Functions_to_System_File__Stacked__FileFunc verb; // 0x0
//
char* path; // 0x4 name/path to a file or directory
char* newpath; // 0x8
Blizzard__File__Stream stream; // 0xC
Blizzard__File__FileInfo* info;
uint32_t extra;
Blizzard__File__FileInfo info_;
Blizzard__File__FileInfoMask has;
Blizzard__File__FileInfoMask want;
int32_t mode; // 0x58
void* buffer; //
int32_t amount;
int64_t pos;
int32_t posMode;
char* cwdbuf;
int32_t cwdbuflen;
bool recursive;
bool makeCanonical;
void* cookie;
Blizzard__File__ProcessDirCallback dircallback;
bool sorted; // set to false by Blizzard::File::ProcessDirFast (i suppose it's fast because it doesn't request sorting, though there's
// no underlying code that does this)
bool overwrite;
bool grantEveryone; // something that causes a security descriptor to be generated
bool zeroFillAll;
bool supportsSparseFiles; // extopt not plausible here
};
#endif

View file

@ -0,0 +1,12 @@
// TimeConst::FILETIMETimestampBias
// TimeConst::FILETIMETimestampMax
// TimeConst::FILETIMETimestampMin
// TimeConst::TimestampsPerFILETIME
// TimeConst::TimestampsPerSecond
// TimeConst::TimestampsPerUnixtime
// TimeConst::TimestampUnixBias
// TimeConst::TimestampUnixMax
// TimeConst::TimestampUnixMin
// TimeConst::UnixTime64TimestampMax
// TimeConst::UnixTime64TimestampMin
// TimeConst::UnixTimestampBias

View file

@ -0,0 +1,38 @@
#ifndef BC_TIME_TYPES_H
#define BC_TIME_TYPES_H
// TimeRec
DECLARE_STRUCT(Blizzard__Time__TimeRec);
// TimeRec
struct Blizzard__Time__TimeRec {
int32_t year;
int32_t month;
int32_t day;
int32_t hour;
int32_t minute;
int32_t second;
int32_t nanosecond;
int32_t dayOfWeek;
int32_t dayOfYear;
};
// UnixTime
typedef int32_t Blizzard__Time__UnixTime;
// Timestamp
typedef int64_t Blizzard__Time__Timestamp;
// Second
typedef uint32_t Blizzard__Time__Second;
// Millisecond
typedef uint32_t Bizzard__Time__Millisecond;
// Microsecond
typedef uint64_t Blizzard__Time__Microsecond;
// Nanosecond
typedef uint64_t Blizzard__Time__Nanosecond;
#endif

View file

@ -0,0 +1,20 @@
#ifndef BC_UTIL_BUFFER_H
#define BC_UTIL_BUFFER_H
// Blizzard::Util::Buffer<size_t N, typename T> : Blizzard::Util::BufferData<typename T, size_t N>
#define BC_UTIL_BUFFER(N, T) \
typedef struct Blizzard__Util__Buffer_##N##_##T Blizzard__Util__Buffer_##N##_##T; \
typedef struct Blizzard__Util__BufferData_##T##_##N Blizzard__Util__BufferData_##T##_##N; \
struct Blizzard__Util__BufferData_##T##_##N { \
uint32_t elements; \
T* data; \
T local[N]; \
}; \
struct Blizzard__Util__Buffer_##N##_##T { \
Blizzard__Util__BufferData_##T##_##N _; \
};
BC_UTIL_BUFFER(300, char);
BC_UTIL_BUFFER(300, uint16_t);
#endif

View file

@ -0,0 +1,6 @@
#ifndef BC_UTIL_OFFSET_H
#define BC_UTIL_OFFSET_H
#define BC_OFFSET_INTO(C, T) typedef uintptr_t offset_in_##C##_to_##T
#endif

View file

@ -0,0 +1,73 @@
#ifndef CHARACTER_COMPONENT_H
#define CHARACTER_COMPONENT_H
DECLARE_STRUCT(CCharacterComponent);
DECLARE_STRUCT(ComponentData);
DECLARE_STRUCT(ItemDisplay);
#include "m2/model.h"
#include "system/types.h"
#include "tempest/vector.h"
#include "texture/texture.h"
struct ComponentData {
int32_t raceID;
int32_t sexID;
int32_t classID;
int32_t hairColorID;
int32_t skinID;
int32_t faceID;
int32_t facialHairStyleID;
int32_t hairStyleID;
CM2Model* m2Model;
uint32_t flags;
char npcBakedTexturePath[260];
uint32_t geosets[19];
};
struct ItemDisplay {
void* texture[7];
uint32_t displayID[7];
uint32_t displayFlag;
};
struct CCharacterComponent {
int32_t unk_000;
int32_t unk_004;
int32_t flags;
int32_t sections;
uint32_t objectIndex;
EGxTexFormat texFormat;
ComponentData componentData;
CTexture* characterBaseSkin;
// 0 - use in CreateRequest AL/AU/FO/HA/HL/HU/LL/LU/TL funcs ; use display info index 0, 1, 2,
// 3, 4, 5, 6, 7 3 - use in CreateRequestHL func 4 - use in CreateRequestHU func 6 - use in
// CreateRequestHL func 7 - use in CreateRequestHU func 10 - use in CreateRequestHL func 11 -
// use in CreateRequestHU func 12 - use in CreateRequestLU func 13 - use in CreateRequestTU func
void* m_textureVariation[15];
// 0 - shirt/chest display
// 1 - chest/wrist/arms display
// 2 - arms display
// 3 - shirt/chest/tabard display
// 4 - shirt/chest/tabard display
// 5 - legs/belt display
// 6 - legs/feet display
// 7 - feet display
ItemDisplay itemDisplayInfo[10];
uint32_t itemModels[11];
int32_t unk_454;
int32_t unk_458;
int32_t unk_45C;
int32_t unk_460;
uint32_t unkArray[50];
int32_t unk_52C;
};
#endif

View file

@ -0,0 +1,20 @@
#ifndef LUA_DEBUG_H
#define LUA_DEBUG_H
DECLARE_STRUCT(lua_Debug);
struct lua_Debug {
int32_t event;
char* name;
char* namewhat;
char* what;
char* source;
int32_t currentline;
int32_t nups;
int32_t linedefined;
int32_t lastlinedefined;
char short_src[60];
int32_t i_ci;
};
#endif

View file

@ -0,0 +1,199 @@
#ifndef LUA_OBJECT_H
#define LUA_OBJECT_H
DECLARE_UNION(GCObject);
DECLARE_STRUCT(GCheader);
DECLARE_UNION(Value);
DECLARE_STRUCT(lua_TValue);
typedef lua_TValue TValue;
typedef TValue* StkId;
DECLARE_STRUCT(TString_tsv);
DECLARE_UNION(TString);
DECLARE_STRUCT(Udata_uv);
DECLARE_UNION(Udata);
DECLARE_STRUCT(Proto);
DECLARE_STRUCT(LocVar);
DECLARE_STRUCT(UpVal_u_l);
DECLARE_UNION(UpVal_u);
DECLARE_STRUCT(UpVal);
DECLARE_STRUCT(CClosure);
DECLARE_STRUCT(LClosure);
DECLARE_UNION(Closure);
DECLARE_STRUCT(TKey_nk);
DECLARE_UNION(TKey);
DECLARE_STRUCT(Node);
DECLARE_STRUCT(Table);
#include "lua/types.h"
struct GCheader {
GCObject* next;
lu_byte tt;
lu_byte marked;
};
union Value {
GCObject* gc;
void* p;
lua_Number n;
int32_t b;
};
struct lua_TValue {
Value value;
int32_t tt;
uint32_t tainted; // UC: Added by Blizzard
};
struct TString_tsv {
GCObject* next;
lu_byte tt;
lu_byte marked;
lu_byte reserved;
uint32_t hash;
size_t len;
};
union TString {
L_Umaxalign dummy;
TString_tsv tsv;
};
struct Udata_uv {
GCObject* next;
lu_byte tt;
lu_byte marked;
Table* metatable;
Table* env;
size_t len;
};
union Udata {
L_Umaxalign dummy;
Udata_uv uv;
};
struct Proto {
GCObject* next;
lu_byte tt;
lu_byte marked;
TValue* k;
Instruction* code;
Proto** p;
int32_t* lineinfo;
LocVar* locvars;
TString** upvalues;
TString* source;
int32_t sizeupvalues;
int32_t sizek;
int32_t sizecode;
int32_t sizelineinfo;
int32_t sizep;
int32_t sizelocvars;
int32_t linedefined;
int32_t lastlinedefined;
GCObject* gclist;
lu_byte nups;
lu_byte numparams;
lu_byte is_vararg;
lu_byte maxstacksize;
};
struct LocVar {
TString* varname;
int32_t startpc;
int32_t endpc;
};
struct UpVal_u_l {
UpVal* prev;
UpVal* next;
};
union UpVal_u {
TValue value;
UpVal_u_l l;
};
struct UpVal {
GCObject* next;
lu_byte tt;
lu_byte marked;
TValue* v;
UpVal_u u;
};
struct CClosure {
GCObject* next;
lu_byte tt;
lu_byte marked;
lu_byte isC;
lu_byte nupvalues;
GCObject* gclist;
Table* env;
lua_CFunction f;
TValue upvalue[1];
};
struct LClosure {
GCObject* next;
lu_byte tt;
lu_byte marked;
lu_byte isC;
lu_byte nupvalues;
GCObject* gclist;
Table* env;
Proto* p;
UpVal* upvals[1];
};
union Closure {
CClosure c;
LClosure l;
};
struct TKey_nk {
Value value;
int32_t tt;
Node* next;
};
union TKey {
TKey_nk nk;
TValue tvk;
};
struct Node {
TValue i_val;
TKey i_key;
};
struct Table {
GCObject* next;
lu_byte tt;
lu_byte marked;
lu_byte flags;
lu_byte lsizenode;
Table* metatable;
TValue* array;
Node* node;
Node* lastfree;
GCObject* gclist;
int32_t sizearray;
};
#endif

View file

@ -0,0 +1,99 @@
#ifndef LUA_STATE_H
#define LUA_STATE_H
DECLARE_STRUCT(stringtable);
DECLARE_STRUCT(CallInfo);
DECLARE_STRUCT(global_State);
DECLARE_STRUCT(lua_State);
#include "lua/object.h"
#include "lua/types.h"
struct stringtable {
GCObject** hash;
lu_int32 nuse;
int32_t size;
};
struct CallInfo {
StkId base;
StkId func;
StkId top;
Instruction* savedpc;
int32_t nresults;
int32_t tailcalls;
};
struct global_State {
stringtable strt;
lua_Alloc frealloc;
void* ud;
lu_byte currentwhite;
lu_byte gcstate;
int32_t sweepstrgc;
GCObject* rootgc;
GCObject** sweepgc;
GCObject* gray;
GCObject* grayagain;
GCObject* weak;
GCObject* tmudata;
Mbuffer buff;
lu_mem GCthreshold;
lu_mem totalbytes;
lu_mem estimate;
lu_mem gcdept;
int32_t gcpause;
int32_t gcstepmul;
lua_CFunction panic;
TValue l_registry;
lua_State* mainthread;
UpVal uvhead;
Table* mt[9];
TString* tmname[0];
};
struct lua_State {
GCObject* next;
lu_byte tt;
lu_byte marked;
lu_byte status;
StkId top;
StkId base;
global_State* l_G;
CallInfo* ci;
Instruction* savedpc;
StkId stack_last;
StkId stack;
CallInfo* end_ci;
CallInfo* base_ci;
int32_t stacksize;
int32_t size_ci;
uint16_t nCcalls;
lu_byte hookmask;
lu_byte allowhook;
int32_t basehookcount;
int32_t hookcount;
lua_Hook hook;
TValue l_gt;
TValue env;
GCObject* openupval;
GCObject* gclist;
lua_longjmp* errorJmp;
ptrdiff_t errfunc;
};
union GCObject {
GCheader gch;
TString ts;
Udata u;
Closure cl;
Table h;
Proto p;
UpVal uv;
lua_State th;
};
#endif

View file

@ -0,0 +1,57 @@
#ifndef LUA_TYPES_H
#define LUA_TYPES_H
#define LUA_REGISTRYINDEX -10000
#define LUA_ENVIRONINDEX -10001
#define LUA_GLOBALSINDEX -10002
DECLARE_STRUCT(lua_State);
DECLARE_STRUCT(lua_Debug);
DECLARE_STRUCT(Mbuffer);
DECLARE_UNION(L_Umaxalign);
DECLARE_STRUCT(lua_longjmp);
DECLARE_STRUCT(luaL_Reg);
struct Mbuffer {
char* buffer;
size_t n;
size_t buffsize;
};
typedef void (*lua_Hook)(lua_State*, lua_Debug*);
typedef uint8_t lu_byte;
typedef uint32_t lu_int32;
typedef uint32_t lu_mem;
typedef double lua_Number;
union L_Umaxalign {
double u;
void* s;
long l;
};
/* chain list of long jump buffers */
struct lua_longjmp {
lua_longjmp* previous;
// luai_jmpbuf b;
int b;
volatile int status; /* error code */
};
typedef lu_int32 Instruction;
typedef int32_t (*lua_CFunction)(lua_State*);
typedef void* (*lua_Alloc)(void*, void*, size_t, size_t);
struct luaL_Reg {
const char* name;
lua_CFunction func;
};
#endif

View file

@ -0,0 +1,180 @@
#ifndef MAP_ADT_CHUNKS_H
#define MAP_ADT_CHUNKS_H
DECLARE_STRUCT(SMMapHeader);
DECLARE_STRUCT(SMChunkInfo);
DECLARE_STRUCT(SMDoodadDef);
DECLARE_STRUCT(SMMapObjDef);
DECLARE_STRUCT(SMChunk);
DECLARE_STRUCT(SLVert);
DECLARE_STRUCT(SMLayer);
DECLARE_STRUCT(SLTiles);
DECLARE_STRUCT(SWFlowv);
DECLARE_STRUCT(SOVert);
DECLARE_STRUCT(SMVert);
DECLARE_STRUCT(SWVert);
DECLARE_STRUCT(SMLiquidChunk);
DECLARE_STRUCT(CWSoundEmitter);
#include "tempest/box.h"
#include "tempest/sphere.h"
#include "tempest/vector.h"
struct SMMapHeader {
uint32_t flags;
uint32_t mcin; // MCIN*, Cata+: obviously gone. probably all offsets gone, except mh2o(which
// remains in root file).
uint32_t mtex; // MTEX*
uint32_t mmdx; // MMDX*
uint32_t mmid; // MMID*
uint32_t mwmo; // MWMO*
uint32_t mwid; // MWID*
uint32_t mddf; // MDDF*
uint32_t modf; // MODF*
uint32_t mfbo; // MFBO* this is only set if flags & mhdr_MFBO.
uint32_t mh2o; // MH2O*
uint32_t mtxf; // MTXF*
uint8_t mamp_value; // Cata+, explicit MAMP chunk overrides data
uint8_t padding[3];
uint32_t unused[3];
};
struct SMChunkInfo {
uint32_t offset; // absolute offset.
uint32_t size; // the size of the MCNK chunk, this is refering to.
uint32_t flags; // always 0. only set in the client., FLAG_LOADED = 1
union {
char pad[4];
uint32_t asyncId; // not in the adt file. client use only
};
};
struct SMDoodadDef {
uint32_t nameId; // references an entry in the MMID chunk, specifying the model t // if flag
// mddf_entry_is_filedata_id is set, a file data id instead, ignoring MMID.
uint32_t uniqueId; // this ID should be unique for all ADTs currently loaded. Best, they are
// unique for the whole map. Blizzar // these
// unique for the whole game.
C3Vector position; // This is relative to a corner of the map. Subtract 17066 from the non
// vertical values and you should start t //
// something that makes sense. You'll then likely have to negate one of the
// non vertical values in wha // coordinate
// system you're using to finally move it into place.
C3Vector rotation; // degrees. This is not the same coordinate system orientation like the ADT
// itself! (see history.)
uint16_t scale; // 1024 is the default size equaling 1.0f.
uint16_t flags; // values from enum MDDFFlags.
};
struct SMMapObjDef {
uint32_t nameId; // references an entry in the MWID chunk, specifying the model to use.
uint32_t uniqueId; // this ID should be unique for all ADTs currently loaded. Best, they are
// unique for the whole map.
C3Vector position;
C3Vector rotation; // same as in MDDF.
CAaBox extents; // position plus the transformed wmo bounding box. used for defining if they are
// rendered as well as collision.
uint16_t flags; // values from enum MODFFlags.
uint16_t doodadSet; // which WMO doodad set is used. Traditionally references WMO#MODS_chunk, if
// modf_use_sets_from_mwds is set, references #MWDR_.28Shadowlands.2B.29
uint16_t nameSet; // which WMO name set is used. Used for renaming goldshire inn to northshire
// inn while using the same model.
uint16_t scale; // Legion+: scale, 1024 means 1 (same as MDDF). Padding in 0.5.3 alpha.
};
struct SMChunk {
uint32_t flags;
C2iVector index;
uint32_t nLayers;
uint32_t nDoodadRefs;
uint32_t ofsHeight;
uint32_t ofsNormal;
uint32_t ofsLayer;
uint32_t ofsRefs;
uint32_t ofsAlpha;
uint32_t sizeAlpha;
uint32_t ofsShadow;
uint32_t sizeShadow;
uint32_t areaid;
uint32_t nMapObjRefs;
uint32_t holes;
uint8_t low_quality_texture_map[0x10];
uint32_t predTex;
uint32_t nEffectDoodad;
uint32_t ofsSndEmitters;
uint32_t nSndEmitters;
uint32_t ofsLiquid;
uint32_t sizeLiquid;
C3Vector position;
uint32_t ofsMCCV;
uint32_t unused1;
uint32_t unused2;
};
struct SMLayer {
uint32_t textureId;
uint32_t flags;
uint32_t offsetInMCAL;
uint32_t offectId;
};
struct SWVert {
char depth;
char flow0Pct;
char flow1Pct;
char filler;
float height;
};
struct SOVert {
char depth;
char foam;
char wet;
char filler;
};
struct SMVert {
uint16_t s;
uint16_t t;
float height;
};
struct SLVert {
union {
SWVert waterVert;
SOVert oceanVert;
SMVert magmaVert;
};
};
struct SLTiles {
char tiles[8][8];
};
struct SWFlowv {
CAaSphere sphere;
C3Vector dir;
float velocity;
float amplitude;
float frequency;
};
struct SMLiquidChunk {
float minHeight;
float maxHeight;
SLVert verts[9 * 9];
SLTiles tiles;
uint32_t nFlowvs;
SWFlowv flowvs[2];
};
struct CWSoundEmitter {
uint32_t entry_id;
C3Vector position;
C3Vector size;
};
#endif

View file

@ -0,0 +1,29 @@
#ifndef MAP_CHUNK_GEOM_FACTORY_H
#define MAP_CHUNK_GEOM_FACTORY_H
DECLARE_STRUCT(CChunkGeomFactory);
#include "map/chunkliquid.h"
#include "map/mapchunkbuf.h"
#include "tempest/matrix.h"
struct CChunkGeomFactory {
void** vtable;
uint32_t unk_04;
uint32_t unk_08;
uint32_t unk_0C;
uint32_t unk_10;
CChunkLiquid* liquidChunk;
uint32_t unk_18;
CMapChunkBuf* mapChunkBuf;
uint32_t unk_20;
uint32_t unk_24;
uint32_t unk_28;
uint16_t unk_flags_2C;
uint16_t unk_flags_2E;
uint32_t unk_30;
C44Matrix matrix;
};
#endif

View file

@ -0,0 +1,40 @@
#ifndef MAP_CHUNK_LIQUID_H
#define MAP_CHUNK_LIQUID_H
#include "storm/list.h"
DECLARE_STRUCT(CChunkLiquid);
STORM_TS_LIST(CChunkLiquid);
#include "map/mapchunk.h"
#include "tempest/vector.h"
struct CChunkLiquid {
int32_t objectIndex;
int32_t unk_004;
int32_t unk_008;
C3Vector topLeftCoords;
C3Vector center;
float radius;
C2Vector height;
float resPurgeTimer;
C2iVector tileBegin;
C2iVector tileEnd;
int32_t unk_044;
int32_t unk_048;
int32_t unk_04C;
int32_t unk_050;
uint8_t* tiles;
uint8_t* liquidInstPtr;
CMapChunk* owner;
CChunkLiquid* prev;
CChunkLiquid* next;
int32_t unk_068;
int32_t unk_06C;
int32_t unk_070;
int32_t unk_074;
C3Vector verts[81];
};
#endif

View file

@ -0,0 +1,45 @@
#ifndef MAP_DETAIL_DOODAD_H
#define MAP_DETAIL_DOODAD_H
DECLARE_STRUCT(CDetailDoodadGeomVertex);
DECLARE_STRUCT(CDetailDoodadGeom);
DECLARE_STRUCT(CDetailDoodadInst);
#include "map/mapchunk.h"
#include "storm/array.h"
#include "system/types.h"
#include "tempest/vector.h"
#include "texture/texture.h"
struct CDetailDoodadGeomVertex {
uint16_t unk_00;
uint16_t unk_02;
uint32_t unk_04;
C3Vector pos;
float angle;
float scale;
C3Vector unkVec;
uint32_t color;
};
STORM_TS_GROWABLE_ARRAY(CDetailDoodadGeomVertex);
struct CDetailDoodadGeom {
CTexture* texture;
int32_t unkVertexCount;
int32_t unkIndexCount;
void* unkVertBufStream;
void* unkIdxBufStream;
TSGrowableArray_CDetailDoodadGeomVertex data;
};
struct CDetailDoodadInst {
int32_t objectIndex;
CDetailDoodadGeom geom[4];
int32_t unkCounter;
CMapChunk* mapChunkOwner;
int32_t unk_09C;
int32_t unk_0A0;
};
#endif

View file

@ -0,0 +1,13 @@
#ifndef MAP_LIQUID_PARTICLE_H
#define MAP_LIQUID_PARTICLE_H
DECLARE_STRUCT(LiquidParticle);
#include "tempest/vector.h"
struct LiquidParticle {
C3Vector position;
float size;
};
#endif

View file

@ -0,0 +1,86 @@
#ifndef MAP_MAP_AREA_H
#define MAP_MAP_AREA_H
DECLARE_STRUCT(CMapArea);
DECLARE_STRUCT(CMapAreaTexture);
DECLARE_STRUCT(CMapAreaLink);
DECLARE_STRUCT(CMapAreaChunkLink);
#include "map/adt_chunks.h"
#include "map/mapchunk.h"
#include "storm/array.h"
#include "storm/list.h"
#include "tempest/vector.h"
#include "texture/texture.h"
STORM_TS_GROWABLE_ARRAY(CMapAreaTexture);
struct CMapAreaTexture {
char* textureName;
CTexture* texture;
};
STORM_TS_LIST(CMapAreaLink);
struct CMapAreaLink {
uint32_t objectIndex; // 0x00
CMapArea* owner; // 0x04
void* ref; // 0x08
TSLink_CMapAreaLink refLink; // 0x0C - 0x14
TSLink_CMapAreaLink ownerLink; // 0x14 - 0x1C
};
STORM_TS_LIST(CMapAreaChunkLink);
struct CMapAreaChunkLink {
uint32_t objectIndex; // 0x00
CMapChunk* owner; // 0x04
CMapArea* ref; // 0x08
TSLink_CMapAreaChunkLink refLink; // 0x0C - 0x14
TSLink_CMapAreaChunkLink ownerLink; // 0x14 - 0x1C
};
struct CMapArea {
void** vtable;
uint32_t objectIndex;
uint16_t type;
uint16_t refCount;
uint32_t unk_0C;
CMapArea* prev;
CMapArea* next;
TSExplicitList_CMapAreaLink linkList;
C3Vector bottomRight;
C3Vector topLeft;
C3Vector topLeft2;
C2iVector index;
C2iVector tileChunkIndex;
TSGrowableArray_CMapAreaTexture textures;
SMMapHeader* header;
int32_t unk_6C;
CAsyncObject* asyncObject;
TSExplicitList_CMapAreaChunkLink chunkLinkList;
void* filePtr;
int32_t fileSize;
SMChunkInfo* chunkInfo;
int32_t unk_8C;
SMDoodadDef* doodadDef;
SMMapObjDef* mapObjDef;
int32_t doodadDefCount;
int32_t mapObjDefCount;
char* m2FileNames;
char* wmoFileNames;
uint32_t* modelFilenamesOffsets;
uint32_t* wmoFilenamesOffsets;
int16_t* flyingBbox;
int32_t* textureFlags;
uint8_t* unk_B8; // MH20
CMapChunk* mapChunks[256];
};
#endif

View file

@ -0,0 +1,33 @@
#ifndef MAP_MAP_BASE_OBJ_H
#define MAP_MAP_BASE_OBJ_H
DECLARE_STRUCT(CMapBaseObj);
DECLARE_STRUCT(CMapBaseObjLink);
#include "storm/list.h"
STORM_TS_LIST(CMapBaseObjLink);
struct CMapBaseObjLink {
uint32_t objectIndex; // 0x00
CMapBaseObj* owner; // 0x04
CMapBaseObj* ref; // 0x08
TSLink_CMapBaseObjLink refLink; // 0x0C - 0x14
TSLink_CMapBaseObjLink ownerLink; // 0x14 - 0x1C
};
struct CMapBaseObj {
void** vtable; // 0x00
int32_t objectIndex; // 0x04
uint16_t type; // 0x08
uint16_t refCount; // 0x0A
int32_t unk_C; // 0x0C
CMapBaseObj* prev; // 0x10
CMapBaseObj* next; // 0x14
TSExplicitList_CMapBaseObjLink list; // 0x18 - 0x24
};
#endif

View file

@ -0,0 +1,120 @@
#ifndef MAP_MAP_CHUNK_H
#define MAP_MAP_CHUNK_H
DECLARE_STRUCT(CMapChunk);
DECLARE_STRUCT(CMapChunkLink);
DECLARE_STRUCT(CMapChunkDoodadDefLink);
DECLARE_STRUCT(CMapChunkMapObjDefLink);
#include "map/maparea.h"
#include "map/mapdoodaddef.h"
#include "map/mapobjdef.h"
#include "storm/list.h"
STORM_TS_LIST(CMapChunkLink);
struct CMapChunkLink {
uint32_t objectIndex; // 0x00
CMapChunk* owner; // 0x04
CMapArea* ref; // 0x08
TSLink_CMapChunkLink refLink; // 0x0C - 0x14
TSLink_CMapChunkLink ownerLink; // 0x14 - 0x1C
};
typedef struct CMapChunkDoodadDefLink CMapChunkDoodadDefLink;
STORM_TS_LIST(CMapChunkDoodadDefLink);
struct CMapChunkDoodadDefLink {
uint32_t objectIndex; // 0x00
CMapDoodadDef* owner; // 0x04
CMapChunk* ref; // 0x08
TSLink_CMapChunkDoodadDefLink refLink; // 0x0C - 0x14
TSLink_CMapChunkDoodadDefLink ownerLink; // 0x14 - 0x1C
};
typedef struct CMapChunkMapObjDefLink CMapChunkMapObjDefLink;
STORM_TS_LIST(CMapChunkMapObjDefLink);
struct CMapChunkMapObjDefLink {
uint32_t objectIndex; // 0x00
CMapObjDef* owner; // 0x04
CMapChunk* ref; // 0x08
TSLink_CMapChunkMapObjDefLink refLink; // 0x0C - 0x14
TSLink_CMapChunkMapObjDefLink ownerLink; // 0x14 - 0x1C
};
struct CMapChunk {
void** vtable;
uint32_t objectIndex;
uint16_t type;
uint16_t refCount;
uint32_t unk_0C;
CMapChunk* prev;
CMapChunk* next;
TSExplicitList_CMapChunkLink linkList;
C2iVector aIndex;
C2iVector sOffset;
C2iVector cOffset;
C3Vector center;
float radius;
CAaBox bbox;
C3Vector bottomRight;
C3Vector topLeft;
C3Vector topLeftCoords;
float distToCamera;
CAaBox bbox2;
void* detailDoodadInst;
void* renderChunk;
int32_t unk_AC;
int32_t areaId;
int32_t unk_B4;
int32_t unk_B8;
int32_t unk_BC;
int32_t unk_C0;
TSExplicitList_CMapChunkDoodadDefLink doodadDefLinkList;
TSExplicitList_CMapChunkMapObjDefLink mapObjDefLinkList;
int32_t TSExplicitList__m_linkoffset_DC;
void* TSExplicitList__ptr_E0;
void* TSExplicitList__ptr2_E4;
// Light
int32_t TSExplicitList__m_linkoffset_E8;
void* TSExplicitList__ptr_EC;
void* TSExplicitList__ptr2_F0;
// CMapSoundEmitter
int32_t TSExplicitList__m_linkoffset_F4;
void* TSExplicitList__ptr_F8;
void* TSExplicitList__ptr2_FC;
// CChunkLiquid
TSExplicitList_CChunkLiquid liquidChunkLinkList;
uint8_t* chunkInfoBeginPtr;
SMChunk* header;
uint8_t* lowQualityTexMap;
uint8_t* predTexture;
float* vertices;
uint32_t* vertexShading;
int8_t* normals;
uint8_t* shadowMap;
SMLayer* layers;
uint8_t* additionalShadowmap;
uint8_t* MCRF_ptr;
SMLiquidChunk* liquid;
CWSoundEmitter* soundEmitters;
// liquid related fields
int32_t unk_140;
int32_t unk_144;
int32_t unk_148;
int32_t unk_14C;
int32_t unk_150;
int32_t unk_154;
};
#endif

View file

@ -0,0 +1,23 @@
#ifndef MAP_MAP_CHUNK_BUF_H
#define MAP_MAP_CHUNK_BUF_H
DECLARE_STRUCT(CMapChunkBuf);
#include "gx/buffer.h"
struct CMapChunkBuf {
uint32_t unk_00;
float flushTimer;
uint32_t vertexDataSize;
uint32_t indexDataSize;
CGxBuf* vertexBuf;
CGxBuf* indexBuf;
CGxPool* vertexPool;
CGxPool* indexPool;
uint32_t unk_20;
uint32_t unk_24;
};
#endif

View file

@ -0,0 +1,79 @@
#ifndef MAP_MAP_DOODAD_DEF_H
#define MAP_MAP_DOODAD_DEF_H
DECLARE_STRUCT(CMapDoodadDef);
DECLARE_STRUCT(CMapDoodadDefMapChunkLink);
#include "m2/model.h"
#include "map/maparea.h"
#include "map/mapbaseobj.h"
#include "storm/list.h"
#include "tempest/box.h"
#include "tempest/matrix.h"
#include "tempest/sphere.h"
#include "tempest/vector.h"
STORM_TS_LIST(CMapDoodadDefMapChunkLink);
struct CMapDoodadDefMapChunkLink {
uint32_t objectIndex; // 0x00
CMapDoodadDef* owner; // 0x04
CMapBaseObj* ref; // 0x08 //could be CMapChunk* or CMapObjDefGroup*
TSLink_CMapDoodadDefMapChunkLink refLink; // 0x0C - 0x14
TSLink_CMapDoodadDefMapChunkLink ownerLink; // 0x14 - 0x1C
};
struct CMapDoodadDef {
void** vtable; // 0x00
int32_t objectIndex; // 0x04
uint16_t type; // 0x08
uint16_t refCount; // 0x0A
int32_t unk_C; // 0x0C
CMapDoodadDef* prev; // 0x10
CMapDoodadDef* next; // 0x14
TSExplicitList_CMapDoodadDefMapChunkLink linkList;
// CMapStaticEntity fields
int32_t unk_024; // 0x24
uint32_t unkFlags_28; // 0x28
int32_t unkCounter; // 0x2C
float unk_030; // 0x30
CM2Model* model;
CAaSphere sphere;
CAaBox bboxStaticEntity;
C3Vector vec2;
C3Vector position;
float scale; // 0x78
int32_t unk_07C; // 0x7C
int32_t unk_080; // 0x80
CImVector m2AmbietColor; // 0x84
CImVector m2DiffuseColor; // 0x88
float unk_08C; // 0x8C
// end
// CMapDoodadDef fields
uint32_t unkFlags_090; // 0x90
void* unk_094; // 0x94
void* unk_098; // 0x98
void* prevMapDoodadDef_09C; // 0x9C
void* nextMapDoodadDef_0A0; // 0xA0
int32_t unk_0A4; // 0xA4
int32_t unk_0A8; // 0xA8
int32_t unk_0AC; // 0xAC
int32_t unk_0B0; // 0xB0
int32_t unk_0B4; // 0xB4
int32_t unk_0B8; // 0xB8
int32_t unk_0BC; // 0xBC
CAaBox bboxDoodadDef;
C44Matrix mat;
C44Matrix identity;
int32_t unk_158; // 0x158 sound
int32_t unk_15C; // 0x15C
int32_t unk_160; // 0x160
int32_t unk_164; // 0x164
int32_t unk_168; // 0x168
int32_t unk_16C; // 0x16C
// end
};
#endif

View file

@ -0,0 +1,70 @@
#ifndef MAP_MAP_ENTITY_H
#define MAP_MAP_ENTITY_H
DECLARE_STRUCT(CMapEntityMapChunkLink);
DECLARE_STRUCT(CMapEntity);
#include "m2/model.h"
#include "storm/list.h"
STORM_TS_LIST(CMapEntityMapChunkLink);
struct CMapEntityMapChunkLink {
uint32_t objectIndex; // 0x00
CMapEntity* owner; // 0x04
void* ref; // 0x08 //could be CMapChunk* or CMapObjDefGroup*
TSLink_CMapEntityMapChunkLink refLink; // 0x0C - 0x14
TSLink_CMapEntityMapChunkLink ownerLink; // 0x14 - 0x1C
};
struct CMapEntity {
// CMapBaseObj fields
void** vtable; // 0x00
int32_t objectIndex; // 0x04
uint16_t type; // 0x08
uint16_t refCount; // 0x0A
int32_t unk_C; // 0x0C
CMapEntity* prev; // 0x10
CMapEntity* next; // 0x14
TSExplicitList_CMapEntityMapChunkLink linkList;
// end
// CMapStaticEntity fields
int32_t unk_024; // 0x24
uint32_t unkFlags_28; // 0x28
int32_t unkCounter; // 0x2C
float unk_030; // 0x30
CM2Model* model;
CAaSphere sphere;
CAaBox bboxStaticEntity;
C3Vector vec2;
C3Vector position;
float scale; // 0x78
int32_t unk_07C; // 0x7C
int32_t unk_080; // 0x80
CImVector m2AmbietColor; // 0x84
CImVector m2DiffuseColor; // 0x88
float unk_08C; // 0x8C
// end
// CMapEntity fields
int32_t unk_090; // 0x90
int32_t unk_094; // 0x94
uint64_t guid; // 0x98
int32_t unk_0A0; // 0xA0
int32_t unk_0A4; // 0xA4
int32_t unk_0A8; // 0xA8
int32_t unk_0AC; // 0xAC
int32_t unk_0B0; // 0xB0
int32_t unk_0B4; // 0xB4
int32_t unk_0B8; // 0xB8
int32_t unk_0BC; // 0xBC
CImVector ambientTarget;
float dirLightScaleTarget;
int32_t unk_0C8; // 0xC8
int32_t unk_0CC; // 0xCC
// end
};
#endif

View file

@ -0,0 +1,177 @@
#ifndef MAP_MAP_OBJ_H
#define MAP_MAP_OBJ_H
DECLARE_STRUCT(CMapObjGroup);
DECLARE_STRUCT(CMapObj);
#include "async/object.h"
#include "map/vbb_list.h"
#include "map/wmo_chunks.h"
#include "storm/list.h"
#include "tempest/box.h"
#include "tempest/vector.h"
STORM_TS_LIST(CMapObjGroup);
struct CMapObjGroup {
int32_t objectIndex;
VBBList_Block* vertsBlock;
VBBList_Block* transparencyVertsBlock;
VBBList_Block* indicesBlock;
VBBList_Block* liquidVertsBlock;
VBBList_Block* liquidIndicesBlock;
float timer;
void* unk_1C;
int32_t unk_20;
int32_t unk_24;
int32_t unk_28;
int16_t unk_2C[2];
int32_t flags;
CAaBox bbox;
float distToCamera;
int32_t portalStart;
int32_t portalCount;
int32_t fogs;
uint16_t transparencyBatchesCount;
uint16_t intBatchCount;
int32_t extBatchCount;
void* CAaBspNodePtr1;
void* CAaBspNodePtr2;
uint16_t* nodeFaceIndices;
int32_t bspNodesCount;
int32_t nodeFaceIndicesCount;
int32_t unk_7C;
int32_t unk_80;
int32_t unk_84;
int32_t unk_88;
int32_t unk_8C;
int32_t unk_90;
int32_t unk_94;
int32_t unk_98;
int32_t unk_9C;
int32_t unk_A0;
int32_t unk_A4;
int32_t unk_A8;
int32_t unk_AC;
int32_t unk_B0;
CAaBox bbox2;
int32_t unk_CC;
int32_t unkFlags;
int32_t unk_D4;
int32_t minimapTag;
char* groupName;
SMOPoly* polyList;
uint16_t* indices;
int32_t unk_E8;
C3Vector* vertexList;
C3Vector* normalList;
C2Vector* textureVertexList;
int32_t unk_F8;
SMOBatch* batchList;
int32_t unk_100;
int32_t unk_104;
uint16_t* doodadRefList;
CImVector* colorVertexList;
CImVector* colorVertexListExtra;
int32_t unk_114;
C2iVector liquidVerts;
C2iVector liquidTiles;
C3Vector liquidCorner;
int32_t luquidMaterialId;
SMOLiquidVert* liquidVertexList;
SMOLTile* liquidTileList;
float liquidHeight;
int32_t unk_144;
int32_t unk_148;
int32_t unkFlag;
int32_t unk_150;
int32_t polyListSize;
int32_t indicesCount;
int32_t unk_15C;
int32_t vertexListCount;
int32_t normalListCount;
int32_t textureVertexListCount;
int32_t unk_16C;
int32_t batchListCount;
int32_t unk_174;
int32_t doodadRefListCount;
int32_t colorVertexListSize;
int32_t colorVertexListExtraSize;
int32_t wmoGroupId;
void* filePtr;
int32_t fileSize;
CMapObj* parent;
int32_t unk_194;
CAsyncObject* asyncObjPtr;
int32_t unkLoadedFlag;
int32_t unkIndexMin1;
int32_t unkIndexMax1;
uint16_t unkIndexMin2;
uint16_t unkIndexMax2;
int32_t TSExplicitList__m_linkoffset;
void* TSExplicitList__ptr;
void* TSExplicitList__ptr2;
CMapObjGroup* perv;
CMapObjGroup* next;
};
struct CMapObj {
int32_t objectIndex;
int32_t unk_04;
int32_t unk_08;
CMapObj* mapObjPtr1;
int32_t unk_10;
CMapObj* mapObjPtr2;
int32_t unk_18;
char m_wmoName[260];
SMOHeader* header;
char* textureNameList;
char* groupNameList;
char* skybox;
SMOGroupInfo* groupInfo;
C3Vector* portalVertexList;
SMOPortal* portalList;
SMOPortalRef* portalRefList;
C3Vector* visBlockVertList;
SMOVisibleBlock* visBlockList;
SMOLight* lightList;
SMODoodadSet* doodadSetList;
char* doodadNameList;
SMODoodadDef* doodadDefList;
SMOFog* fogList;
C4Plane* convexVolumePlanes;
SMOMaterial* materialList;
int32_t texturesSize;
int32_t groupNameSize;
int32_t groupInfoCount;
int32_t planeVertCount;
int32_t portalsCount;
int32_t portalRefCount;
int32_t visBlockVertCount;
int32_t visBlockCount;
int32_t ligtsCount;
int32_t doodadSetCount;
int32_t doodadNameSize;
int32_t doodadDefCount;
int32_t fogsCount;
int32_t convexVolumePlaneCount;
int32_t materialsCount;
uint32_t argb_color;
int32_t unk_1A4;
CAaBox bbox;
float distToCamera;
int32_t unk_1C4;
int32_t unk_1C8;
void* pWmoData;
int32_t wmoFileSize;
int32_t refCount;
float flushTimer;
CAsyncObject* asyncObject;
int32_t isGroupLoaded;
int32_t unk_1E4;
TSExplicitList_CMapObjGroup mapObjGroupList;
int32_t mapObjGroupCount;
CMapObjGroup* mapObjGroupArray[512];
};
#endif

View file

@ -0,0 +1,169 @@
#ifndef MAP_MAP_OBJ_DEF_H
#define MAP_MAP_OBJ_DEF_H
DECLARE_STRUCT(CMapObjDef);
DECLARE_STRUCT(CMapObjDefGroup);
DECLARE_STRUCT(CMapObjDefGroupMapObjDefLink);
DECLARE_STRUCT(CMapObjDefMapChunkLink);
DECLARE_STRUCT(CMapObjDefGroupDoodadDefLink);
DECLARE_STRUCT(CMapObjDefGroupMapEntityLink);
DECLARE_STRUCT(CMapObjDefMapObjDefGroupLink);
#include "map/maparea.h"
#include "map/mapdoodaddef.h"
#include "map/mapentity.h"
#include "map/mapobj.h"
#include "storm/array.h"
#include "storm/list.h"
#include "tempest/box.h"
#include "tempest/matrix.h"
#include "tempest/sphere.h"
#include "tempest/vector.h"
STORM_TS_LIST(CMapObjDefMapObjDefGroupLink);
struct CMapObjDefMapObjDefGroupLink {
uint32_t objectIndex; // 0x00
CMapObjDefGroup* owner; // 0x04
CMapObjDef* ref; // 0x08
TSLink_CMapObjDefMapObjDefGroupLink refLink; // 0x0C - 0x14
TSLink_CMapObjDefMapObjDefGroupLink ownerLink; // 0x14 - 0x1C
};
STORM_TS_LIST(CMapObjDefGroupMapObjDefLink);
struct CMapObjDefGroupMapObjDefLink {
uint32_t objectIndex; // 0x00
CMapObjDefGroup* owner; // 0x04
CMapObjDef* ref; // 0x08
TSLink_CMapObjDefGroupMapObjDefLink refLink; // 0x0C - 0x14
TSLink_CMapObjDefGroupMapObjDefLink ownerLink; // 0x14 - 0x1C
};
STORM_TS_LIST(CMapObjDefGroupDoodadDefLink);
struct CMapObjDefGroupDoodadDefLink {
uint32_t objectIndex; // 0x00
CMapDoodadDef* owner; // 0x04
CMapObjDef* ref; // 0x08
TSLink_CMapObjDefGroupDoodadDefLink refLink; // 0x0C - 0x14
TSLink_CMapObjDefGroupDoodadDefLink ownerLink; // 0x14 - 0x1C
};
STORM_TS_LIST(CMapObjDefGroupMapEntityLink);
struct CMapObjDefGroupMapEntityLink {
uint32_t objectIndex; // 0x00
CMapEntity* owner; // 0x04
CMapObjDef* ref; // 0x08
TSLink_CMapObjDefGroupMapEntityLink refLink; // 0x0C - 0x14
TSLink_CMapObjDefGroupMapEntityLink ownerLink; // 0x14 - 0x1C
};
STORM_TS_GROWABLE_ARRAY(CMapObjDefGroup);
struct CMapObjDefGroup {
void* vtable; // 0x00
int32_t objectIndex; // 0x04
uint16_t type; // 0x08
uint16_t refCount; // 0x0A
int32_t unk_C; // 0x0C
CMapObjDefGroup* prev; // 0x10
CMapObjDefGroup* next; // 0x14
TSExplicitList_CMapObjDefGroupMapObjDefLink linkList;
CAaBox bbox;
CAaSphere sphere;
float unk_4C; // 0x4C
uint32_t groupNum; // 0x50
uint32_t unkFlags; // 0x54
int32_t unk_58; // 0x58
uint32_t ambientColor; // 0x5C
int32_t unk_60; // 0x60
int32_t unk_64; // 0x64
int32_t unk_68; // 0x68
// CWFrustum
int32_t TSExplicitList__m_linkoffset_unk_6C; // 0x6C
void* TSExplicitList__m_ptr1_unk_70; // 0x70
void* TSExplicitList__m_ptr2_unk_74; // 0x74
TSExplicitList_CMapObjDefGroupDoodadDefLink doodadDefLinkList;
TSExplicitList_CMapObjDefGroupMapEntityLink mapEntityLinkList;
int32_t TSExplicitList__m_linkoffset_unk_90; // 0x90
void* TSExplicitList__m_ptr1_unk_94; // 0x94
void* TSExplicitList__m_ptr2_unk_98; // 0x98
int32_t TSExplicitList__m_linkoffset_unk_9C; // 0x9C
void* TSExplicitList__m_ptr1_unk_A0; // 0xA0
void* TSExplicitList__m_ptr2_unk_A4; // 0xA4
int32_t unk_A8; // 0xA8
int32_t unk_AC; // 0xAC
int32_t unk_B0; // 0xB0
int32_t unk_B4; // 0xB4
int32_t unk_B8; // 0xB8
int32_t unk_BC; // 0xBC
};
STORM_TS_LIST(CMapObjDefMapChunkLink);
struct CMapObjDefMapChunkLink {
uint32_t objectIndex; // 0x00
CMapObjDef* owner; // 0x04
CMapChunk* ref; // 0x08
TSLink_CMapObjDefMapChunkLink refLink; // 0x0C - 0x14
TSLink_CMapObjDefMapChunkLink ownerLink; // 0x14 - 0x1C
};
struct CMapObjDef {
void** vtable; // 0x00
int32_t objectIndex; // 0x04
uint16_t type; // 0x08
uint16_t refCount; // 0x0A
int32_t unk_C; // 0x0C
CMapObjDef* prev; // 0x10
CMapObjDef* next; // 0x14
TSExplicitList_CMapObjDefMapChunkLink linkList;
void* unk_24; // 0x24
void* unk_28; // 0x28
void* unk_2C; // 0x2C
void* unk_30; // 0x30
void* unk_34; // 0x34
int32_t unk_38; // 0x38
C3Vector position;
CAaBox bbox;
CAaSphere sphere;
C44Matrix mat;
C44Matrix invMat;
int32_t unk_F0; // 0xF0
CMapObj* owner; // 0xF4
int32_t unk_F8; // 0xF8
uint32_t unkFlags; // 0xFC
int32_t unk_100; // 0x100
int32_t unk_104; // 0x104
int32_t unk_108; // 0x108
int32_t unk_10C; // 0x10C
int32_t unk_110; // 0x110
TSExplicitList_CMapObjDefMapObjDefGroupLink mapObjDefGroupLinkList;
TSGrowableArray_CMapObjDefGroup defGroups;
void* unk_130; // 0x130
int32_t TSGrowableArray__m_alloc; // 0x134
int32_t TSGrowableArray__m_count; // 0x138
void* TSGrowableArray__m_data; // 0x13C
int32_t TSGrowableArray__m_chunk; // 0x140
uint32_t argbColor; // 0x144
int32_t unk_148; // 0x148
int32_t unk_14C; // 0x14C
int32_t unk_150; // 0x150
void* unk_154; // 0x154
};
#endif

View file

@ -0,0 +1,53 @@
#ifndef MAP_MAP_RENDER_CHUNK_H
#define MAP_MAP_RENDER_CHUNK_H
DECLARE_STRUCT(CMapRenderChunkLayer);
DECLARE_STRUCT(CMapRenderChunk);
#include "gx/buffer.h"
#include "map/mapchunk.h"
#include "system/types.h"
#include "tempest/vector.h"
#include "texture/texture.h"
struct CMapRenderChunkLayer {
int16_t flags;
int16_t layerIndex;
CTexture* texture;
int32_t unkIndex;
int32_t unkValue;
CMapRenderChunk* owner;
};
struct CMapRenderChunk {
CMapRenderChunk* renderChunkPtr1;
CMapRenderChunk* renderChunkPtr2;
uint8_t unkFlags;
uint8_t layersCount;
int16_t unk_0A;
int32_t unk_0C;
CMapChunk* mapChunkPtr1;
CMapChunk* mapChunkPtr2;
C3Vector vec1;
C3Vector vec2;
float radius;
CMapRenderChunkLayer layers[4];
CTexture* terrainBlendTexture;
CTexture* shadowTexture;
CGxBuf* vertexBuf;
CGxBuf* indicesBuf;
int32_t unk_94;
int32_t unk_98;
int16_t unk_9C;
int16_t unk_9E;
int32_t unk_A0;
int32_t unk_A4;
};
#endif

View file

@ -0,0 +1,52 @@
#ifndef MAP_MAP_STATIC_ENTITY_H
#define MAP_MAP_STATIC_ENTITY_H
DECLARE_STRUCT(CMapStaticEntityMapChunkLink);
DECLARE_STRUCT(CMapStaticEntity);
#include "m2/model.h"
#include "map/mapbaseobj.h"
#include "storm/list.h"
#include "system/types.h"
#include "tempest/box.h"
#include "tempest/sphere.h"
#include "tempest/vector.h"
STORM_TS_LIST(CMapStaticEntityMapChunkLink);
struct CMapStaticEntityMapChunkLink {
uint32_t objectIndex; // 0x00
CMapStaticEntity* owner; // 0x04
void* ref; // 0x08 //could be CMapChunk* or CMapObjDefGroup*
TSLink_CMapStaticEntityMapChunkLink refLink; // 0x0C - 0x14
TSLink_CMapStaticEntityMapChunkLink ownerLink; // 0x14 - 0x1C
};
struct CMapStaticEntity {
void** vtable; // 0x00
int32_t objectIndex; // 0x04
uint16_t type; // 0x08
uint16_t refCount; // 0x0A
int32_t unk_C; // 0x0C
CMapStaticEntity* prev; // 0x10
CMapStaticEntity* next; // 0x14
TSExplicitList_CMapStaticEntityMapChunkLink linkList;
int32_t unk_024; // 0x24
uint32_t unkFlags_28; // 0x28
int32_t unkCounter; // 0x2C
float unk_030; // 0x30
CM2Model* model;
CAaSphere sphere;
CAaBox bbox;
C3Vector vec2;
C3Vector position;
float scale; // 0x78
int32_t unk_07C; // 0x7C
int32_t unk_080; // 0x80
CImVector m2AmbietColor; // 0x84
CImVector m2DiffuseColor; // 0x88
float unk_08C; // 0x8C
};
#endif

View file

@ -0,0 +1,26 @@
#ifndef MAP_PARTICULATE_H
#define MAP_PARTICULATE_H
DECLARE_STRUCT(Particulate);
#include "map/liquidparticle.h"
#include "texture/texture.h"
struct Particulate {
LiquidParticle particles[4000];
uint32_t maxParticles;
C3Vector prevCameraPos;
CTexture* texture;
uint8_t unk_byte;
uint8_t padding[3];
float particleSize;
float spawnAreaSize;
float unk_float1;
uint32_t unkValue; // liquid type of particle type
C3Vector direction;
float speed;
float timer;
float rotationSpeed;
};
#endif

View file

@ -0,0 +1,41 @@
#ifndef MAP_VBB_LIST_H
#define MAP_VBB_LIST_H
DECLARE_STRUCT(VBBList);
DECLARE_STRUCT(VBBList_Block);
#include "gx/buffer.h"
#include "system/types.h"
struct VBBList_Block {
VBBList_Block* next;
VBBList_Block* prev;
EGxPoolUsage poolUsage;
uint32_t offset;
uint32_t capacity;
CGxPool* pool;
CGxBuf* buffer;
VBBList_Block** listHead;
};
struct VBBList {
int32_t singlePool;
EGxPoolTarget target;
EGxPoolUsage usage;
CGxPool* pool;
uint32_t unk_10;
// singlePool == true
VBBList_Block* listHeadA;
VBBList_Block* freeCandidate;
uint32_t unk_1C;
// singlePool == false
VBBList_Block* listHeadB;
VBBList_Block* allBlocks;
};
#endif

View file

@ -0,0 +1,332 @@
#ifndef MAP_WEATHER_H
#define MAP_WEATHER_H
DECLARE_STRUCT(Weather);
DECLARE_STRUCT(Mists);
DECLARE_STRUCT(Rain);
DECLARE_STRUCT(Snow);
DECLARE_STRUCT(Sand);
DECLARE_STRUCT(PacketList_Packet_RainDrop);
DECLARE_STRUCT(Packet_RainDrop);
DECLARE_STRUCT(RainDropParticle);
DECLARE_STRUCT(RainParticleBuffer);
DECLARE_STRUCT(PacketList_Packet_RainPatter);
DECLARE_STRUCT(Packet_RainPatter);
DECLARE_STRUCT(RainPatterParticle);
DECLARE_STRUCT(RainPatterParticleBuffer);
DECLARE_STRUCT(PacketList_Packet_SnowFlake);
DECLARE_STRUCT(Packet_SnowFlake);
DECLARE_STRUCT(SnowFlakeParticle);
DECLARE_STRUCT(SnowFlakeParticleBuffer);
DECLARE_STRUCT(PacketList_Packet_SandGrain);
DECLARE_STRUCT(Packet_SandGrain);
DECLARE_STRUCT(SandGrainParticle);
DECLARE_STRUCT(SandGrainParticleBuffer);
#include "gx/buffer.h"
#include "gx/shader.h"
#include "system/types.h"
#include "tempest/box.h"
#include "tempest/vector.h"
#include "texture/texture.h"
struct Mists {
void** vtable;
C3Vector position;
uint32_t unk_10;
uint32_t unk_14;
uint32_t unk_18;
float scale;
uint32_t unk_20;
float rotationSpeed;
float fadeSpeed;
uint32_t unk_2C;
float opacity;
float lifeTime;
float spawnRate;
uint8_t unk_3C;
uint8_t padding[3];
CTexture* mistTexture;
uint32_t particleCount;
uint32_t unk_48;
uint32_t unk_4C;
uint32_t unk_50;
};
struct SandGrainParticle {
C3Vector position;
C3Vector velocity;
float lifetime;
float size;
};
struct SandGrainParticleBuffer {
uint32_t particleCount;
SandGrainParticle particles[6144];
};
struct Packet_SandGrain {
Packet_SandGrain* prev;
Packet_SandGrain* next;
SandGrainParticleBuffer particlesBuffer;
uint32_t currParticle;
uint32_t packetStartTick;
uint32_t packetEndTick;
float packetBuildTime;
uint32_t field_C007;
uint32_t field_C008;
uint32_t field_C009;
CGxPool* gxPool;
CGxBuf* vertexBufHandle;
};
struct PacketList_Packet_SandGrain {
int32_t unk_00;
Packet_SandGrain* prev;
Packet_SandGrain* next;
int32_t activePacketsCount;
int32_t freePacketsCount;
int32_t unk_14;
Packet_SandGrain* unk_18;
Packet_SandGrain* unk_1C;
};
struct Sand {
int32_t useWeatherShaders;
CAaBox bbox;
Mists mists;
PacketList_Packet_SandGrain sandGrainPacketList;
Packet_SandGrain* sandGrainPacketPtr;
float unk_94;
CGxShader* shader;
float unk_9C;
};
struct SnowFlakeParticle {
C3Vector position;
C3Vector velocity;
float lifetime;
float size;
};
struct SnowFlakeParticleBuffer {
uint32_t particleCount;
SnowFlakeParticle particles[6144];
};
struct Packet_SnowFlake {
Packet_SnowFlake* prev;
Packet_SnowFlake* next;
SnowFlakeParticleBuffer particlesBuffer;
uint32_t currParticle;
uint32_t packetStartTick;
uint32_t packetEndTick;
float packetBuildTime;
uint32_t field_C007;
uint32_t field_C008;
uint32_t field_C009;
CGxPool* gxPool;
CGxBuf* vertexBufHandle;
};
struct PacketList_Packet_SnowFlake {
int32_t unk_00;
Packet_SnowFlake* prev;
Packet_SnowFlake* next;
int32_t activePacketsCount;
int32_t freePacketsCount;
int32_t unk_14;
Packet_SnowFlake* unk_18;
Packet_SnowFlake* unk_1C;
};
struct Snow {
int32_t useWeatherShaders;
CAaBox bbox;
Mists mists;
// PacketList_Packet_SnowFlake snowFlakePacketList;
int32_t unk_70;
void* unk_74;
void* unk_78;
int32_t activePacketsCount;
int32_t freePacketsCount;
int32_t unk_84;
void* unk_88;
void* unk_8C;
// end
Packet_SnowFlake* snowFlakePacketPtr;
float unk_94;
CTexture* snowFlakeTex;
CGxShader* shaderPtr;
int32_t unk_A0;
int32_t unk_A4;
};
struct RainPatterParticle {
C3Vector position;
float lifetime;
float size;
float unk;
};
struct RainPatterParticleBuffer {
uint32_t particleCount;
RainPatterParticle particles[6144];
};
struct Packet_RainPatter {
Packet_RainPatter* prev;
Packet_RainPatter* next;
RainPatterParticleBuffer particlesBuffer;
uint32_t currParticle;
uint32_t packetStartTick;
uint32_t packetEndTick;
float packetBuildTime;
uint32_t field_9007;
uint32_t field_9008;
uint32_t field_9009;
CGxPool* gxPool;
CGxBuf* vertexBufHandle;
};
struct PacketList_Packet_RainPatter {
int32_t unk_00;
Packet_RainPatter* prev;
Packet_RainPatter* next;
int32_t activePacketsCount;
int32_t freePacketsCount;
int32_t unk_14;
Packet_RainPatter* unk_18;
Packet_RainPatter* unk_1C;
};
struct RainDropParticle {
C3Vector position;
C3Vector velocity;
CImVector color;
float size;
float unk;
};
struct RainParticleBuffer {
uint32_t particleCount;
RainDropParticle particles[6144];
};
struct Packet_RainDrop {
Packet_RainDrop* prev;
Packet_RainDrop* next;
RainParticleBuffer particlesBuffer;
uint32_t currParticle;
uint32_t packetStartTick;
uint32_t packetEndTick;
float packetBuildTime;
uint32_t field_D807;
uint32_t field_D808;
uint32_t field_D809;
CGxPool* gxPool;
CGxBuf* vertexBufHandle;
};
struct PacketList_Packet_RainDrop {
int32_t unk_00;
Packet_RainDrop* prev;
Packet_RainDrop* next;
int32_t activePacketsCount;
int32_t freePacketsCount;
int32_t unk_14;
Packet_RainDrop* unk_18;
Packet_RainDrop* unk_1C;
};
struct Rain {
int32_t useWeatherShaders;
CAaBox bbox;
Mists mists;
PacketList_Packet_RainDrop rainDropPacketList;
PacketList_Packet_RainPatter rainPatterPacketList;
Packet_RainDrop* rainDropPacketPtr;
float unk_B4; // particle lifetime?
Packet_RainPatter* rainPatterPacketPtr;
CTexture* rainDropTex;
CGxShader* shaderRain;
CTexture* rainDropSplashTex;
CGxShader* shaderPatter;
float particlesPerFrame;
float intensity;
};
struct Weather {
float intensity;
float lastIntensity;
float currStormItensity;
float targetSkyDark;
float startSkyDark;
float currSkyDark;
uint32_t weatherStartMs;
uint32_t weatherStartMs2;
uint32_t weatherType;
uint32_t abrupt;
float transitionSkyBox;
float transitionSkyBoxNotAbrupt;
float transitionSkyBoxNoWeather;
CImVector color;
char texturePath[260];
Rain* rain;
Snow* snow;
Sand* sand;
void* unkObject;
int32_t unk_14C;
void* unk_ptr_150;
void* unk_ptr_154;
int32_t unk_158;
void* unk_ptr_15C;
void* unk_ptr_160;
C3Vector velocity;
C3Vector unkVec;
C3Vector playerPos;
int32_t unk_188;
float facingAngle;
float moveSpeed;
int32_t unk_194;
};
#endif

View file

@ -0,0 +1,226 @@
#ifndef MAP_WMO_CHUNKS_H
#define MAP_WMO_CHUNKS_H
#include "tempest/box.h"
#include "tempest/plane.h"
#include "tempest/quaternion.h"
DECLARE_STRUCT(SMOHeader);
DECLARE_STRUCT(SMOGroupInfo);
DECLARE_STRUCT(SMOPortal);
DECLARE_STRUCT(SMOPortalRef);
DECLARE_STRUCT(SMOVisibleBlock);
DECLARE_STRUCT(SMOLight);
DECLARE_STRUCT(SMODoodadSet);
DECLARE_STRUCT(SMODoodadDef);
DECLARE_STRUCT(SMOFog);
DECLARE_STRUCT(SMOMaterial);
DECLARE_STRUCT(SMOPoly);
DECLARE_STRUCT(SMOBatch);
DECLARE_STRUCT(SMOLiquidVert);
DECLARE_STRUCT(SMOLTile);
DECLARE_STRUCT(SMOWVert);
DECLARE_STRUCT(SMOMVert);
struct SMOHeader {
uint32_t nTextures;
uint32_t nGroups;
uint32_t nPortals;
uint32_t nLights;
uint32_t nDoodadNames;
uint32_t nDoodadDefs;
uint32_t nDoodadSets;
uint32_t ambColor;
uint32_t wmoID;
CAaBox bounding_box;
#if defined(BITFIELDS_SUPPORTED)
uint16_t flag_do_not_attenuate_vertices_based_on_distance_to_portal : 1;
uint16_t flag_use_unified_render_path : 1;
uint16_t flag_use_liquid_type_dbc_id : 1;
uint16_t flag_do_not_fix_vertex_color_alpha : 1;
uint16_t flag_lod : 1;
uint16_t flag_default_max_lod : 1;
uint16_t : 10;
#else
uint16_t flags;
#endif
uint16_t numLod;
};
struct SMOGroupInfo {
uint32_t flags;
CAaBox bbox;
uint32_t nameOffset;
};
struct SMOPortal {
uint16_t startVertex;
uint16_t count;
C4Plane plane;
};
struct SMOPortalRef {
uint16_t portalIndex;
uint16_t groupIndex;
int16_t side;
uint16_t filler;
};
struct SMOVisibleBlock {
uint16_t firstVertex;
uint16_t count;
};
struct SMOLight {
uint8_t type;
uint8_t atten;
uint8_t pad[2];
CImVector color;
C3Vector position;
float intensity;
C4Quaternion rotation;
float attenStart;
float attenEnd;
};
struct SMODoodadSet {
char name[0x14];
uint32_t startIdx;
uint32_t count;
uint32_t pad;
};
struct SMODoodadDef {
#if defined(BITFIELDS_SUPPORTED)
uint32_t nameIndex : 24;
uint32_t flag_AcceptProjTex : 1;
uint32_t flag_0x2 : 1;
uint32_t flag_0x4 : 1;
uint32_t flag_0x8 : 1;
uint32_t unk : 4;
#else
uint32_t flags;
#endif
C3Vector position;
C4Quaternion orientation;
float scale;
CImVector color;
};
struct SMOFog {
#if defined(BITFIELDS_SUPPORTED)
uint32_t flag_infinite_radius : 1;
uint32_t : 3;
uint32_t flag_0x10 : 1;
uint32_t : 27;
#else
uint32_t flags;
#endif
C3Vector position;
float smallerRadius;
float largerRadius;
float fogEnd;
float fogStartScalar;
CImVector fogColor;
// under water
float uwFogEnd;
float uwFogStartScalar;
CImVector uwFogColor;
};
struct SMOMaterial {
/*uint32_t F_UNLIT : 1;
uint32_t F_UNFOGGED : 1;
uint32_t F_UNCULLED : 1;
uint32_t F_EXTLIGHT : 1;
uint32_t F_SIDN : 1;
uint32_t F_WINDOW : 1;
uint32_t F_CLAMP_S : 1;
uint32_t F_CLAMP_T : 1;
uint32_t flag_0x100 : 1;
uint32_t : 23;*/
uint32_t flags;
uint32_t shader;
uint32_t blendMode;
uint32_t texture1;
CImVector sidnColor;
CImVector frameSidnColor;
uint32_t texture2;
CImVector diffColor;
uint32_t groundType;
uint32_t texture3;
uint32_t color2;
uint32_t flags2;
uint32_t runTimeData[4];
};
struct SMOPoly {
/*uint8_t F_UNK_0x01: 1;
uint8_t F_NOCAMCOLLIDE : 1;
uint8_t F_DETAIL : 1;
uint8_t F_COLLISION : 1;
uint8_t F_HINT : 1;
uint8_t F_RENDER : 1;
uint8_t F_CULL_OBJECTS : 1;
uint8_t F_COLLIDE_HIT : 1;*/
uint8_t flags;
uint8_t materialId;
};
struct SMOBatch {
int8_t unused[12];
uint32_t indexStart;
uint16_t indexCount;
uint16_t vertexStart;
uint16_t vertexEnd;
uint8_t flags;
uint8_t texture;
};
struct SMOWVert {
uint8_t flow1;
uint8_t flow2;
uint8_t flow1Pct;
uint8_t filler;
float height;
};
struct SMOMVert {
int16_t s;
int16_t t;
float height;
};
struct SMOLiquidVert {
union {
SMOWVert waterVert;
SMOMVert magmaVert;
};
};
struct SMOLTile {
#if defined(BITFIELDS_SUPPORTED)
uint8_t legacyLiquidType : 4;
uint8_t unknown1 : 1;
uint8_t unknown2 : 1;
uint8_t fishable : 1;
uint8_t shared : 1;
#else
uint8_t flags;
#endif
};
#endif