Fixed how DynOS writes lua variables into level scripts, added all level geos

This commit is contained in:
MysterD 2022-04-05 00:22:09 -07:00
parent 395541ce10
commit 8646b50ae5
8 changed files with 581 additions and 129 deletions

View file

@ -450,6 +450,7 @@ struct GfxData : NoCopy {
// Generate // Generate
Array<DataNode<GeoLayout> *> mGenerateGeoLayouts; Array<DataNode<GeoLayout> *> mGenerateGeoLayouts;
Array<DataNode<LevelScript> *> mGenerateLevelScripts;
// Current // Current
u64 mLoadIndex = 0; u64 mLoadIndex = 0;
@ -458,7 +459,8 @@ struct GfxData : NoCopy {
s32 mModIndex = 0; s32 mModIndex = 0;
SysPath mPackFolder; SysPath mPackFolder;
Array<void *> mPointerList; Array<void *> mPointerList;
Array<String> mPointerTokenList; Array<void *> mLuaPointerList;
Array<String> mLuaTokenList;
GfxContext mGfxContext; GfxContext mGfxContext;
Array<GfxContext> mGeoNodeStack; Array<GfxContext> mGeoNodeStack;
}; };
@ -744,8 +746,11 @@ Collision* DynOS_Col_Get(const char* collisionName);
// Bin // Bin
// //
typedef s64 (*RDConstantFunc)(const String& _Arg, bool* found);
u32 DynOS_Lua_RememberVariable(GfxData* aGfxData, void* aPtr, String& token);
void DynOS_Gfx_GeneratePacks(const char* directory); void DynOS_Gfx_GeneratePacks(const char* directory);
s64 DynOS_RecursiveDescent_Parse(const char* expr, bool* success); s64 DynOS_RecursiveDescent_Parse(const char* expr, bool* success, RDConstantFunc func);
void DynOS_Read_Source(GfxData *aGfxData, const SysPath &aFilename); void DynOS_Read_Source(GfxData *aGfxData, const SysPath &aFilename);
char *DynOS_Read_Buffer(FILE* aFile, GfxData* aGfxData); char *DynOS_Read_Buffer(FILE* aFile, GfxData* aGfxData);
@ -768,6 +773,7 @@ void DynOS_Geo_Load(FILE *aFile, GfxData *aGfxData);
DataNode<Gfx>* DynOS_Gfx_Parse(GfxData* aGfxData, DataNode<Gfx>* aNode); DataNode<Gfx>* DynOS_Gfx_Parse(GfxData* aGfxData, DataNode<Gfx>* aNode);
void DynOS_Gfx_Write(FILE *aFile, GfxData *aGfxData, DataNode<Gfx> *aNode); void DynOS_Gfx_Write(FILE *aFile, GfxData *aGfxData, DataNode<Gfx> *aNode);
void DynOS_Gfx_Load(FILE *aFile, GfxData *aGfxData); void DynOS_Gfx_Load(FILE *aFile, GfxData *aGfxData);
s64 DynOS_Gfx_ParseGfxConstants(const String& _Arg, bool* found);
DataNode<Lights1>* DynOS_Lights_Parse(GfxData* aGfxData, DataNode<Lights1>* aNode); DataNode<Lights1>* DynOS_Lights_Parse(GfxData* aGfxData, DataNode<Lights1>* aNode);
void DynOS_Lights_Write(FILE* aFile, GfxData* aGfxData, DataNode<Lights1> *aNode); void DynOS_Lights_Write(FILE* aFile, GfxData* aGfxData, DataNode<Lights1> *aNode);
@ -810,6 +816,7 @@ DataNode<Vtx>* DynOS_Vtx_Parse(GfxData* aGfxData, DataNode<Vtx>* aNode);
void DynOS_Vtx_Write(FILE* aFile, GfxData* aGfxData, DataNode<Vtx> *aNode); void DynOS_Vtx_Write(FILE* aFile, GfxData* aGfxData, DataNode<Vtx> *aNode);
void DynOS_Vtx_Load(FILE *aFile, GfxData *aGfxData); void DynOS_Vtx_Load(FILE *aFile, GfxData *aGfxData);
void DynOS_Pointer_Lua_Write(FILE* aFile, u32 index, GfxData* aGfxData);
void DynOS_Pointer_Write(FILE* aFile, const void* aPtr, GfxData* aGfxData); void DynOS_Pointer_Write(FILE* aFile, const void* aPtr, GfxData* aGfxData);
void *DynOS_Pointer_Load(FILE *aFile, GfxData *aGfxData, u32 aValue, bool isLvl); void *DynOS_Pointer_Load(FILE *aFile, GfxData *aGfxData, u32 aValue, bool isLvl);

View file

@ -154,7 +154,8 @@ static void DynOS_Actor_Generate(const SysPath &aPackFolder, Array<Pair<u64, Str
_GfxData->mModelIdentifier = _GeoNode->mModelIdentifier; _GfxData->mModelIdentifier = _GeoNode->mModelIdentifier;
_GfxData->mPackFolder = aPackFolder; _GfxData->mPackFolder = aPackFolder;
_GfxData->mPointerList = { NULL }; // The NULL pointer is needed, so we add it here _GfxData->mPointerList = { NULL }; // The NULL pointer is needed, so we add it here
_GfxData->mPointerTokenList = { }; _GfxData->mLuaPointerList = { };
_GfxData->mLuaTokenList = { };
_GfxData->mGfxContext.mCurrentTexture = NULL; _GfxData->mGfxContext.mCurrentTexture = NULL;
_GfxData->mGfxContext.mCurrentPalette = NULL; _GfxData->mGfxContext.mCurrentPalette = NULL;
_GfxData->mGeoNodeStack.Clear(); _GfxData->mGeoNodeStack.Clear();
@ -228,9 +229,34 @@ void DynOS_Actor_GeneratePack(const SysPath &aPackFolder) {
SysPath _Folder = fstring("%s/%s", aPackFolder.c_str(), _PackEnt->d_name); SysPath _Folder = fstring("%s/%s", aPackFolder.c_str(), _PackEnt->d_name);
if (fs_sys_dir_exists(_Folder.c_str())) { if (fs_sys_dir_exists(_Folder.c_str())) {
_GfxData->mModelIdentifier = 0; _GfxData->mModelIdentifier = 0;
// Remember the geo layout count
s32 prevGeoLayoutCount = _GfxData->mGeoLayouts.Count();
DynOS_Read_Source(_GfxData, fstring("%s/model.inc.c", _Folder.c_str())); DynOS_Read_Source(_GfxData, fstring("%s/model.inc.c", _Folder.c_str()));
DynOS_Read_Source(_GfxData, fstring("%s/geo.inc.c", _Folder.c_str())); DynOS_Read_Source(_GfxData, fstring("%s/geo.inc.c", _Folder.c_str()));
DynOS_Read_Source(_GfxData, fstring("%s/collision.inc.c", _Folder.c_str())); DynOS_Read_Source(_GfxData, fstring("%s/collision.inc.c", _Folder.c_str()));
// Figure out which geo layouts to generate
s32 geoLayoutCount = _GfxData->mGeoLayouts.Count();
if (geoLayoutCount > prevGeoLayoutCount) {
// find actors to generate
bool foundActor = false;
for (s32 i = prevGeoLayoutCount; i < geoLayoutCount; i++) {
String _GeoRootName = _GfxData->mGeoLayouts[i]->mName;
const void* actor = DynOS_Geo_GetActorLayoutFromName(_GeoRootName.begin());
if (actor != NULL) {
foundActor = true;
_GfxData->mGenerateGeoLayouts.Add(_GfxData->mGeoLayouts[i]);
}
}
// if we haven't found an actor, just add the last geo layout found
if (!foundActor) {
_GfxData->mGenerateGeoLayouts.Add(_GfxData->mGeoLayouts[geoLayoutCount - 1]);
}
}
if (_GfxData->mModelIdentifier != 0) { if (_GfxData->mModelIdentifier != 0) {
_ActorsFolders.Add({ _GfxData->mModelIdentifier, String(_PackEnt->d_name) }); _ActorsFolders.Add({ _GfxData->mModelIdentifier, String(_PackEnt->d_name) });
} }

View file

@ -15,18 +15,9 @@ extern "C" {
///////////// /////////////
#define gfx_constant(x) if (_Arg == #x) { return (s64) (x); } #define gfx_constant(x) if (_Arg == #x) { return (s64) (x); }
static s64 ParseGfxSymbolArg(GfxData* aGfxData, DataNode<Gfx>* aNode, u64* pTokenIndex, const char *aPrefix) {
assert(aPrefix != NULL);
String _Token = (pTokenIndex != NULL ? aNode->mTokens[(*pTokenIndex)++] : "");
String _Arg("%s%s", aPrefix, _Token.begin());
// Offset s64 DynOS_Gfx_ParseGfxConstants(const String& _Arg, bool* found) {
s32 _Offset = 0; *found = true;
s32 _Plus = _Arg.Find('+');
if (_Plus != -1) {
_Offset = _Arg.SubString(_Plus + 1).ParseInt();
_Arg = _Arg.SubString(0, _Plus);
}
// Constants // Constants
gfx_constant(NULL); gfx_constant(NULL);
@ -123,10 +114,6 @@ static s64 ParseGfxSymbolArg(GfxData* aGfxData, DataNode<Gfx>* aNode, u64* pToke
gfx_constant(G_TX_CLAMP); gfx_constant(G_TX_CLAMP);
gfx_constant(G_TX_NOMASK); gfx_constant(G_TX_NOMASK);
gfx_constant(G_TX_NOLOD); gfx_constant(G_TX_NOLOD);
gfx_constant(G_TX_WRAP|G_TX_NOMIRROR);
gfx_constant(G_TX_WRAP|G_TX_MIRROR);
gfx_constant(G_TX_CLAMP|G_TX_NOMIRROR);
gfx_constant(G_TX_CLAMP|G_TX_MIRROR);
// Render modes // Render modes
gfx_constant(G_RM_AA_ZB_OPA_SURF); gfx_constant(G_RM_AA_ZB_OPA_SURF);
@ -239,14 +226,6 @@ static s64 ParseGfxSymbolArg(GfxData* aGfxData, DataNode<Gfx>* aNode, u64* pToke
gfx_constant(G_TEXTURE_GEN_LINEAR); gfx_constant(G_TEXTURE_GEN_LINEAR);
gfx_constant(G_LOD); gfx_constant(G_LOD);
gfx_constant(G_CLIPPING); gfx_constant(G_CLIPPING);
gfx_constant(G_FOG|G_TEXTURE_GEN);
gfx_constant(G_LIGHTING|G_CULL_BACK);
gfx_constant(G_LIGHTING|G_SHADING_SMOOTH);
gfx_constant(G_CULL_BACK|G_SHADING_SMOOTH);
gfx_constant(G_LIGHTING|G_CULL_BACK|G_SHADING_SMOOTH);
gfx_constant(G_TEXTURE_GEN|G_SHADING_SMOOTH);
gfx_constant(G_TEXTURE_GEN|G_LIGHTING|G_CULL_BACK);
gfx_constant(G_TEXTURE_GEN|G_CULL_BACK|G_SHADING_SMOOTH);
// Alpha modes // Alpha modes
gfx_constant(G_AC_NONE); gfx_constant(G_AC_NONE);
@ -318,14 +297,13 @@ static s64 ParseGfxSymbolArg(GfxData* aGfxData, DataNode<Gfx>* aNode, u64* pToke
gfx_constant(G_MW_FOG); gfx_constant(G_MW_FOG);
gfx_constant(G_MW_LIGHTCOL); gfx_constant(G_MW_LIGHTCOL);
// Texture/scale/rotate constants
gfx_constant(G_TEXTURE_IMAGE_FRAC);
gfx_constant(G_TEXTURE_SCALE_FRAC);
gfx_constant(G_SCALE_FRAC);
gfx_constant(G_ROTATE_FRAC);
// Common values // Common values
gfx_constant((4-1)<<G_TEXTURE_IMAGE_FRAC);
gfx_constant((8-1)<<G_TEXTURE_IMAGE_FRAC);
gfx_constant((16-1)<<G_TEXTURE_IMAGE_FRAC);
gfx_constant((32-1)<<G_TEXTURE_IMAGE_FRAC);
gfx_constant((64-1)<<G_TEXTURE_IMAGE_FRAC);
gfx_constant((128-1)<<G_TEXTURE_IMAGE_FRAC);
gfx_constant((256-1)<<G_TEXTURE_IMAGE_FRAC);
gfx_constant(CALC_DXT(4,G_IM_SIZ_4b_BYTES)); gfx_constant(CALC_DXT(4,G_IM_SIZ_4b_BYTES));
gfx_constant(CALC_DXT(8,G_IM_SIZ_4b_BYTES)); gfx_constant(CALC_DXT(8,G_IM_SIZ_4b_BYTES));
gfx_constant(CALC_DXT(16,G_IM_SIZ_4b_BYTES)); gfx_constant(CALC_DXT(16,G_IM_SIZ_4b_BYTES));
@ -354,7 +332,29 @@ static s64 ParseGfxSymbolArg(GfxData* aGfxData, DataNode<Gfx>* aNode, u64* pToke
gfx_constant(CALC_DXT(64,G_IM_SIZ_32b_BYTES)); gfx_constant(CALC_DXT(64,G_IM_SIZ_32b_BYTES));
gfx_constant(CALC_DXT(128,G_IM_SIZ_32b_BYTES)); gfx_constant(CALC_DXT(128,G_IM_SIZ_32b_BYTES));
gfx_constant(CALC_DXT(256,G_IM_SIZ_32b_BYTES)); gfx_constant(CALC_DXT(256,G_IM_SIZ_32b_BYTES));
gfx_constant(G_CULL_BACK|G_LIGHTING);
*found = false;
return 0;
}
static s64 ParseGfxSymbolArg(GfxData* aGfxData, DataNode<Gfx>* aNode, u64* pTokenIndex, const char *aPrefix) {
assert(aPrefix != NULL);
String _Token = (pTokenIndex != NULL ? aNode->mTokens[(*pTokenIndex)++] : "");
String _Arg("%s%s", aPrefix, _Token.begin());
bool constantFound = false;
s64 constantValue = DynOS_Gfx_ParseGfxConstants(_Arg, &constantFound);
if (constantFound) {
return constantValue;
}
// Offset
s32 _Offset = 0;
s32 _Plus = _Arg.Find('+');
if (_Plus != -1) {
_Offset = _Arg.SubString(_Plus + 1).ParseInt();
_Arg = _Arg.SubString(0, _Plus);
}
// Lights // Lights
for (auto& _Node : aGfxData->mLights) { for (auto& _Node : aGfxData->mLights) {
@ -447,6 +447,13 @@ static s64 ParseGfxSymbolArg(GfxData* aGfxData, DataNode<Gfx>* aNode, u64* pToke
return (s64) x; return (s64) x;
} }
// Recursive descent parsing
bool rdSuccess = false;
s64 rdValue = DynOS_RecursiveDescent_Parse(_Arg.begin(), &rdSuccess, DynOS_Gfx_ParseGfxConstants);
if (rdSuccess) {
return (LevelScript)rdValue;
}
// Unknown // Unknown
PrintError(" ERROR: Unknown gfx arg: %s", _Arg.begin()); PrintError(" ERROR: Unknown gfx arg: %s", _Arg.begin());
return 0; return 0;

View file

@ -65,8 +65,6 @@ void *DynOS_Lvl_GetFunctionPointerFromIndex(s32 aIndex) {
#define lvl_constant(x) if (_Arg == #x) { return (LevelScript) (x); } #define lvl_constant(x) if (_Arg == #x) { return (LevelScript) (x); }
// TODO: this was made so that recursive descent can parse the constants...
// but RD should really use any function pointer passed to it
s64 DynOS_Lvl_ParseLevelScriptConstants(const String& _Arg, bool* found) { s64 DynOS_Lvl_ParseLevelScriptConstants(const String& _Arg, bool* found) {
*found = true; *found = true;
@ -1391,6 +1389,10 @@ s64 DynOS_Lvl_ParseLevelScriptConstants(const String& _Arg, bool* found) {
lvl_constant(WARP_TRANSITION_FADE_FROM_BOWSER); lvl_constant(WARP_TRANSITION_FADE_FROM_BOWSER);
lvl_constant(WARP_TRANSITION_FADE_INTO_BOWSER); lvl_constant(WARP_TRANSITION_FADE_INTO_BOWSER);
// Other constants
lvl_constant(NULL);
lvl_constant(FALSE);
// vanilla actors // vanilla actors
s32 actorCount = DynOS_Geo_GetActorCount(); s32 actorCount = DynOS_Geo_GetActorCount();
for (s32 i = 0; i < actorCount; i++) { for (s32 i = 0; i < actorCount; i++) {
@ -1427,10 +1429,6 @@ static LevelScript ParseLevelScriptSymbolArgInternal(GfxData* aGfxData, DataNode
return (LevelScript) constantValue; return (LevelScript) constantValue;
} }
// Other constants
lvl_constant(NULL);
lvl_constant(FALSE);
// Level Scripts // Level Scripts
for (auto& _Node : aGfxData->mLevelScripts) { for (auto& _Node : aGfxData->mLevelScripts) {
if (_Arg == _Node->mName) { if (_Arg == _Node->mName) {
@ -1495,7 +1493,7 @@ static LevelScript ParseLevelScriptSymbolArgInternal(GfxData* aGfxData, DataNode
// Recursive descent parsing // Recursive descent parsing
bool rdSuccess = false; bool rdSuccess = false;
s64 rdValue = DynOS_RecursiveDescent_Parse(_Arg.begin(), &rdSuccess); s64 rdValue = DynOS_RecursiveDescent_Parse(_Arg.begin(), &rdSuccess, DynOS_Lvl_ParseLevelScriptConstants);
if (rdSuccess) { if (rdSuccess) {
return (LevelScript)rdValue; return (LevelScript)rdValue;
} }
@ -1726,20 +1724,9 @@ static void ParseLevelScriptSymbol(GfxData* aGfxData, DataNode<LevelScript>* aNo
memcpy(aHead, _Ls, sizeof(_Ls)); memcpy(aHead, _Ls, sizeof(_Ls));
aHead += (sizeof(_Ls) / sizeof(_Ls[0])); aHead += (sizeof(_Ls) / sizeof(_Ls[0]));
} else { } else {
// remember model/beh as pointer u32 modelIndex = DynOS_Lua_RememberVariable(aGfxData, aHead + 5, aNode->mTokens[topTokenIndex + 0]);
aGfxData->mPointerList.Add(aHead + 5); u32 behIndex = DynOS_Lua_RememberVariable(aGfxData, aHead + 6, aNode->mTokens[topTokenIndex + 8]);
aGfxData->mPointerList.Add(aHead + 6); LevelScript _Ls[] = { OBJECT_EXT(modelIndex, posX, posY, posZ, angleX, angleY, angleZ, behParam, behIndex) };
// add model/beh tokens
u32 tokenListIndex = aGfxData->mPointerTokenList.Count();
aGfxData->mPointerTokenList.Add(aNode->mTokens[topTokenIndex + 0]);
aGfxData->mPointerTokenList.Add(aNode->mTokens[topTokenIndex + 8]);
// get model/beh tokens
String& modelToken = aGfxData->mPointerTokenList[tokenListIndex + 0];
String& behToken = aGfxData->mPointerTokenList[tokenListIndex + 1];
LevelScript _Ls[] = { OBJECT_EXT(modelToken.begin(), posX, posY, posZ, angleX, angleY, angleZ, behParam, behToken.begin()) };
memcpy(aHead, _Ls, sizeof(_Ls)); memcpy(aHead, _Ls, sizeof(_Ls));
aHead += (sizeof(_Ls) / sizeof(_Ls[0])); aHead += (sizeof(_Ls) / sizeof(_Ls[0]));
} }
@ -1761,7 +1748,7 @@ static void ParseLevelScriptSymbol(GfxData* aGfxData, DataNode<LevelScript>* aNo
LevelScript angleZ = ParseLevelScriptSymbolArg(aGfxData, aNode, aTokenIndex); LevelScript angleZ = ParseLevelScriptSymbolArg(aGfxData, aNode, aTokenIndex);
LevelScript behParam = ParseLevelScriptSymbolArg(aGfxData, aNode, aTokenIndex); LevelScript behParam = ParseLevelScriptSymbolArg(aGfxData, aNode, aTokenIndex);
LevelScript beh = ParseLevelScriptSymbolArgInternal(aGfxData, aNode, aTokenIndex, &foundBeh); LevelScript beh = ParseLevelScriptSymbolArgInternal(aGfxData, aNode, aTokenIndex, &foundBeh);
LevelScript acts = ParseLevelScriptSymbolArg(aGfxData, aNode, aTokenIndex); LevelScript acts = ParseLevelScriptSymbolArg(aGfxData, aNode, aTokenIndex);
if (foundModel && foundBeh) { if (foundModel && foundBeh) {
aGfxData->mPointerList.Add(aHead + 5); aGfxData->mPointerList.Add(aHead + 5);
@ -1769,20 +1756,9 @@ static void ParseLevelScriptSymbol(GfxData* aGfxData, DataNode<LevelScript>* aNo
memcpy(aHead, _Ls, sizeof(_Ls)); memcpy(aHead, _Ls, sizeof(_Ls));
aHead += (sizeof(_Ls) / sizeof(_Ls[0])); aHead += (sizeof(_Ls) / sizeof(_Ls[0]));
} else { } else {
// remember model/beh as pointer u32 modelIndex = DynOS_Lua_RememberVariable(aGfxData, aHead + 5, aNode->mTokens[topTokenIndex + 0]);
aGfxData->mPointerList.Add(aHead + 5); u32 behIndex = DynOS_Lua_RememberVariable(aGfxData, aHead + 6, aNode->mTokens[topTokenIndex + 8]);
aGfxData->mPointerList.Add(aHead + 6); LevelScript _Ls[] = { OBJECT_WITH_ACTS_EXT(modelIndex, posX, posY, posZ, angleX, angleY, angleZ, behParam, behIndex, acts) };
// add model/beh tokens
u32 tokenListIndex = aGfxData->mPointerTokenList.Count();
aGfxData->mPointerTokenList.Add(aNode->mTokens[topTokenIndex + 0]);
aGfxData->mPointerTokenList.Add(aNode->mTokens[topTokenIndex + 8]);
// get model/beh tokens
String& modelToken = aGfxData->mPointerTokenList[tokenListIndex + 0];
String& behToken = aGfxData->mPointerTokenList[tokenListIndex + 1];
LevelScript _Ls[] = { OBJECT_WITH_ACTS_EXT(modelToken.begin(), posX, posY, posZ, angleX, angleY, angleZ, behParam, behToken.begin(), acts) };
memcpy(aHead, _Ls, sizeof(_Ls)); memcpy(aHead, _Ls, sizeof(_Ls));
aHead += (sizeof(_Ls) / sizeof(_Ls[0])); aHead += (sizeof(_Ls) / sizeof(_Ls[0]));
} }
@ -1836,6 +1812,8 @@ static void DynOS_Lvl_Write(FILE* aFile, GfxData* aGfxData, DataNode<LevelScript
LevelScript *_Head = &aNode->mData[i]; LevelScript *_Head = &aNode->mData[i];
if (aGfxData->mPointerList.Find((void *) _Head) != -1) { if (aGfxData->mPointerList.Find((void *) _Head) != -1) {
DynOS_Pointer_Write(aFile, (const void *) (*_Head), aGfxData); DynOS_Pointer_Write(aFile, (const void *) (*_Head), aGfxData);
} else if (aGfxData->mLuaPointerList.Find((void *) _Head) != -1) {
DynOS_Pointer_Lua_Write(aFile, *(u32 *)_Head, aGfxData);
} else { } else {
WriteBytes<u32>(aFile, *((u32 *) _Head)); WriteBytes<u32>(aFile, *((u32 *) _Head));
} }
@ -2012,9 +1990,16 @@ static bool DynOS_Lvl_GeneratePack_Internal(const SysPath &aPackFolder, Array<Pa
} }
// Init // Init
_GfxData->mErrorCount = 0; _GfxData->mLoadIndex = 0;
_GfxData->mLoadIndex = 0; _GfxData->mErrorCount = 0;
_GfxData->mPackFolder = aPackFolder; _GfxData->mModelIdentifier = _LvlRoot->mModelIdentifier;
_GfxData->mPackFolder = aPackFolder;
_GfxData->mPointerList = { NULL }; // The NULL pointer is needed, so we add it here
_GfxData->mLuaPointerList = { };
_GfxData->mLuaTokenList = { };
_GfxData->mGfxContext.mCurrentTexture = NULL;
_GfxData->mGfxContext.mCurrentPalette = NULL;
_GfxData->mGeoNodeStack.Clear();
// Parse data // Parse data
PrintNoNewLine("%s.lvl: Model identifier: %X - Processing... ", _LvlRootName.begin(), _GfxData->mModelIdentifier); PrintNoNewLine("%s.lvl: Model identifier: %X - Processing... ", _LvlRootName.begin(), _GfxData->mModelIdentifier);

View file

@ -183,6 +183,12 @@ static PointerData GetDataFromPointer(const void* aPtr, GfxData* aGfxData) {
return { _VtxArrayName, (u32)((const Vtx*)aPtr - (const Vtx*)_VtxArrayStart) }; return { _VtxArrayName, (u32)((const Vtx*)aPtr - (const Vtx*)_VtxArrayStart) };
} }
void DynOS_Pointer_Lua_Write(FILE* aFile, u32 index, GfxData* aGfxData) {
String& token = aGfxData->mLuaTokenList[index];
WriteBytes<u32>(aFile, LUA_VAR_CODE);
token.Write(aFile);
}
void DynOS_Pointer_Write(FILE* aFile, const void* aPtr, GfxData* aGfxData) { void DynOS_Pointer_Write(FILE* aFile, const void* aPtr, GfxData* aGfxData) {
// NULL // NULL
@ -191,6 +197,17 @@ void DynOS_Pointer_Write(FILE* aFile, const void* aPtr, GfxData* aGfxData) {
return; return;
} }
// Lua variable
for (s32 i = 0; i < aGfxData->mLuaPointerList.Count(); i++) {
if (aPtr == aGfxData->mLuaPointerList[i]) {
u32 index = *((u32*)aPtr);
String& token = aGfxData->mLuaTokenList[index];
WriteBytes<u32>(aFile, LUA_VAR_CODE);
token.Write(aFile);
return;
}
}
// Geo function // Geo function
s32 _GeoFunctionIndex = DynOS_Geo_GetFunctionIndex(aPtr); s32 _GeoFunctionIndex = DynOS_Geo_GetFunctionIndex(aPtr);
if (_GeoFunctionIndex != -1) { if (_GeoFunctionIndex != -1) {
@ -207,21 +224,8 @@ void DynOS_Pointer_Write(FILE* aFile, const void* aPtr, GfxData* aGfxData) {
return; return;
} }
// Lua variable
for (s32 i = 0; i < aGfxData->mPointerTokenList.Count(); i++) {
if (aPtr == aGfxData->mPointerTokenList[i].begin()) {
String& token = aGfxData->mPointerTokenList[i];
WriteBytes<u32>(aFile, LUA_VAR_CODE);
token.Write(aFile);
return;
}
}
// Pointer // Pointer
PointerData _PtrData = GetDataFromPointer(aPtr, aGfxData); PointerData _PtrData = GetDataFromPointer(aPtr, aGfxData);
if (strlen(_PtrData.first.begin()) == 0) {
_PtrData = _PtrData; // DO NOT COMMIT
}
WriteBytes<u32>(aFile, POINTER_CODE); WriteBytes<u32>(aFile, POINTER_CODE);
_PtrData.first.Write(aFile); _PtrData.first.Write(aFile);
WriteBytes<u32>(aFile, _PtrData.second); WriteBytes<u32>(aFile, _PtrData.second);
@ -390,6 +394,14 @@ static void *GetPointerFromData(GfxData *aGfxData, const String &aPtrName, u32 a
void *DynOS_Pointer_Load(FILE *aFile, GfxData *aGfxData, u32 aValue, bool isLvl) { void *DynOS_Pointer_Load(FILE *aFile, GfxData *aGfxData, u32 aValue, bool isLvl) {
// LUAV
if (aValue == LUA_VAR_CODE) {
String token; token.Read(aFile);
u32 index = aGfxData->mLuaTokenList.Count();
aGfxData->mLuaTokenList.Add(token);
return aGfxData->mLuaTokenList[index].begin();
}
// FUNC // FUNC
if (aValue == FUNCTION_CODE) { if (aValue == FUNCTION_CODE) {
s32 _FunctionIndex = ReadBytes<s32>(aFile); s32 _FunctionIndex = ReadBytes<s32>(aFile);
@ -398,14 +410,6 @@ void *DynOS_Pointer_Load(FILE *aFile, GfxData *aGfxData, u32 aValue, bool isLvl)
: DynOS_Geo_GetFunctionPointerFromIndex(_FunctionIndex); : DynOS_Geo_GetFunctionPointerFromIndex(_FunctionIndex);
} }
// LUAV
if (aValue == LUA_VAR_CODE) {
String token; token.Read(aFile);
u32 index = aGfxData->mPointerTokenList.Count();
aGfxData->mPointerTokenList.Add(token);
return aGfxData->mPointerTokenList[index].begin();
}
// PNTR // PNTR
if (aValue == POINTER_CODE) { if (aValue == POINTER_CODE) {
String _PtrName; _PtrName.Read(aFile); String _PtrName; _PtrName.Read(aFile);

View file

@ -121,9 +121,6 @@ void DynOS_Read_Source(GfxData *aGfxData, const SysPath &aFilename) {
FILE *_File = fopen(aFilename.c_str(), "rb"); FILE *_File = fopen(aFilename.c_str(), "rb");
if (!_File) return; if (!_File) return;
// Remember the geo layout count
s32 prevGeoLayoutCount = aGfxData->mGeoLayouts.Count();
// Load file into a buffer while removing all comments // Load file into a buffer while removing all comments
char *_FileBuffer = DynOS_Read_Buffer(_File, aGfxData); char *_FileBuffer = DynOS_Read_Buffer(_File, aGfxData);
fclose(_File); fclose(_File);
@ -281,26 +278,6 @@ void DynOS_Read_Source(GfxData *aGfxData, const SysPath &aFilename) {
} }
} }
// Figure out which geo layouts to generate
s32 geoLayoutCount = aGfxData->mGeoLayouts.Count();
if (geoLayoutCount > prevGeoLayoutCount) {
// find actors to generate
bool foundActor = false;
for (s32 i = prevGeoLayoutCount; i < geoLayoutCount; i++) {
String _GeoRootName = aGfxData->mGeoLayouts[i]->mName;
const void* actor = DynOS_Geo_GetActorLayoutFromName(_GeoRootName.begin());
if (actor != NULL) {
foundActor = true;
aGfxData->mGenerateGeoLayouts.Add(aGfxData->mGeoLayouts[i]);
}
}
// if we haven't found an actor, just add the last geo layout found
if (!foundActor) {
aGfxData->mGenerateGeoLayouts.Add(aGfxData->mGeoLayouts[geoLayoutCount - 1]);
}
}
Delete(_FileBuffer); Delete(_FileBuffer);
Print("Data read from file \"%s\"", aFilename.c_str()); Print("Data read from file \"%s\"", aFilename.c_str());
} }

View file

@ -70,12 +70,29 @@ void DynOS_Gfx_Free(GfxData* aGfxData) {
} }
} }
u32 DynOS_Lua_RememberVariable(GfxData* aGfxData, void* aPtr, String& token) {
// remember as lua pointer
aGfxData->mLuaPointerList.Add(aPtr);
// find existing token
for (u32 i = 0; i < aGfxData->mLuaTokenList.Count(); i++) {
if (aGfxData->mLuaTokenList[i] == token) {
return i;
}
}
// add token
aGfxData->mLuaTokenList.Add(token);
return aGfxData->mLuaTokenList.Count() - 1;
}
/////////////////////// ///////////////////////
// Recursive Descent // // Recursive Descent //
/////////////////////// ///////////////////////
static char* sRdString = NULL; static char* sRdString = NULL;
static bool sRdError = false; static bool sRdError = false;
static RDConstantFunc sRdConstantFunc = NULL;
static s64 ParseExpression(); static s64 ParseExpression();
@ -176,13 +193,13 @@ static s64 ParseFactor() {
cTmp++; cTmp++;
} }
// TODO: this was made so that recursive descent can parse the constants... if (sRdConstantFunc != NULL) {
// but RD should really use any function pointer passed to it bool constantFound = false;
bool constantFound = false; s64 constantValue = sRdConstantFunc(identifier, &constantFound);
s64 constantValue = DynOS_Lvl_ParseLevelScriptConstants(identifier, &constantFound); if (constantFound) {
if (constantFound) { sRdString = cTmp;
sRdString = cTmp; return constantValue;
return constantValue; }
} }
} }
@ -262,9 +279,10 @@ static s64 ParseExpression() {
return ParseBitOrExpression(); return ParseBitOrExpression();
} }
s64 DynOS_RecursiveDescent_Parse(const char* expr, bool* success) { s64 DynOS_RecursiveDescent_Parse(const char* expr, bool* success, RDConstantFunc func) {
sRdString = (char*)expr; sRdString = (char*)expr;
sRdError = false; sRdError = false;
sRdConstantFunc = func;
s64 value = ParseExpression(); s64 value = ParseExpression();
sRdString = NULL; sRdString = NULL;
*success = !sRdError; *success = !sRdError;

View file

@ -36,7 +36,27 @@ extern "C" {
#include "actors/group17.h" #include "actors/group17.h"
#include "actors/custom0.h" #include "actors/custom0.h"
#include "actors/zcustom0.h" #include "actors/zcustom0.h"
#include "levels/bbh/header.h"
#include "levels/bitdw/header.h"
#include "levels/bitfs/header.h"
#include "levels/bits/header.h"
#include "levels/bob/header.h" #include "levels/bob/header.h"
#include "levels/bowser_2/header.h"
#include "levels/bowser_3/header.h"
#include "levels/castle_grounds/header.h"
#include "levels/castle_inside/header.h"
#include "levels/ccm/header.h"
#include "levels/ddd/header.h"
#include "levels/hmc/header.h"
#include "levels/jrb/header.h"
#include "levels/lll/header.h"
#include "levels/rr/header.h"
#include "levels/sl/header.h"
#include "levels/ssl/header.h"
#include "levels/thi/header.h"
#include "levels/ttc/header.h"
#include "levels/ttm/header.h"
#include "levels/wdw/header.h"
#include "levels/wf/header.h" #include "levels/wf/header.h"
} }
@ -609,6 +629,417 @@ Collision* DynOS_Col_Get(const char* collisionName) {
#define define_lvl_geo(geo) (const void *) #geo, (const void *) geo #define define_lvl_geo(geo) (const void *) #geo, (const void *) geo
static const void *sDynosLevelGeos[] = { static const void *sDynosLevelGeos[] = {
define_lvl_geo(geo_bbh_0005B0),
define_lvl_geo(geo_bbh_0005C8),
define_lvl_geo(geo_bbh_0005E0),
define_lvl_geo(geo_bbh_0005F8),
define_lvl_geo(geo_bbh_000610),
define_lvl_geo(geo_bbh_000628),
define_lvl_geo(geo_bbh_000640),
define_lvl_geo(geo_bbh_000658),
define_lvl_geo(geo_bbh_000670),
define_lvl_geo(geo_bbh_0006B0),
define_lvl_geo(geo_bbh_0006E8),
define_lvl_geo(geo_bbh_000730),
define_lvl_geo(geo_bbh_000750),
define_lvl_geo(geo_bbh_000768),
define_lvl_geo(geo_bbh_0007B0),
define_lvl_geo(geo_bbh_0007D0),
define_lvl_geo(geo_bbh_000800),
define_lvl_geo(geo_bbh_000828),
define_lvl_geo(geo_bbh_000860),
define_lvl_geo(geo_bbh_000888),
define_lvl_geo(geo_bbh_0008B0),
define_lvl_geo(geo_bbh_0008E8),
define_lvl_geo(geo_bbh_000950),
define_lvl_geo(geo_bbh_0009C8),
define_lvl_geo(geo_bbh_000A18),
define_lvl_geo(geo_bbh_000A60),
define_lvl_geo(geo_bbh_000AD8),
define_lvl_geo(geo_bbh_000B28),
define_lvl_geo(geo_bbh_000B88),
define_lvl_geo(geo_bbh_000BF0),
define_lvl_geo(geo_bbh_000C38),
define_lvl_geo(geo_bbh_000C88),
define_lvl_geo(geo_bbh_000CE8),
define_lvl_geo(geo_bbh_000D20),
define_lvl_geo(geo_bbh_000D68),
define_lvl_geo(geo_bbh_000DB0),
define_lvl_geo(geo_bbh_000DF0),
define_lvl_geo(geo_bbh_000E40),
define_lvl_geo(geo_bbh_000E80),
define_lvl_geo(geo_bbh_000EB0),
define_lvl_geo(geo_bbh_000F00),
define_lvl_geo(geo_bitdw_0003C0),
define_lvl_geo(geo_bitdw_0003D8),
define_lvl_geo(geo_bitdw_0003F0),
define_lvl_geo(geo_bitdw_000408),
define_lvl_geo(geo_bitdw_000420),
define_lvl_geo(geo_bitdw_000438),
define_lvl_geo(geo_bitdw_000450),
define_lvl_geo(geo_bitdw_000468),
define_lvl_geo(geo_bitdw_000480),
define_lvl_geo(geo_bitdw_000498),
define_lvl_geo(geo_bitdw_0004B0),
define_lvl_geo(geo_bitdw_0004C8),
define_lvl_geo(geo_bitdw_0004E0),
define_lvl_geo(geo_bitdw_0004F8),
define_lvl_geo(geo_bitdw_000510),
define_lvl_geo(geo_bitdw_000528),
define_lvl_geo(geo_bitdw_000540),
define_lvl_geo(geo_bitdw_000558),
define_lvl_geo(geo_bitdw_000570),
define_lvl_geo(geo_bitdw_000588),
define_lvl_geo(geo_bitdw_0005A0),
define_lvl_geo(geo_bitdw_0005B8),
define_lvl_geo(geo_bitdw_0005D0),
define_lvl_geo(geo_bitdw_0005E8),
define_lvl_geo(geo_bitdw_000600),
define_lvl_geo(geo_bitdw_000618),
define_lvl_geo(bitfs_geo_0004B0),
define_lvl_geo(bitfs_geo_0004C8),
define_lvl_geo(bitfs_geo_0004E0),
define_lvl_geo(bitfs_geo_0004F8),
define_lvl_geo(bitfs_geo_000510),
define_lvl_geo(bitfs_geo_000528),
define_lvl_geo(bitfs_geo_000540),
define_lvl_geo(bitfs_geo_000558),
define_lvl_geo(bitfs_geo_000570),
define_lvl_geo(bitfs_geo_000588),
define_lvl_geo(bitfs_geo_0005A0),
define_lvl_geo(bitfs_geo_0005B8),
define_lvl_geo(bitfs_geo_0005D0),
define_lvl_geo(bitfs_geo_0005E8),
define_lvl_geo(bitfs_geo_000600),
define_lvl_geo(bitfs_geo_000618),
define_lvl_geo(bitfs_geo_000630),
define_lvl_geo(bitfs_geo_000648),
define_lvl_geo(bitfs_geo_000660),
define_lvl_geo(bitfs_geo_000678),
define_lvl_geo(bitfs_geo_000690),
define_lvl_geo(bitfs_geo_0006A8),
define_lvl_geo(bitfs_geo_0006C0),
define_lvl_geo(bitfs_geo_0006D8),
define_lvl_geo(bitfs_geo_0006F0),
define_lvl_geo(bitfs_geo_000708),
define_lvl_geo(bitfs_geo_000728),
define_lvl_geo(bitfs_geo_000740),
define_lvl_geo(bitfs_geo_000758),
define_lvl_geo(bitfs_geo_000770),
define_lvl_geo(bitfs_geo_000788),
define_lvl_geo(bitfs_geo_0007A0),
define_lvl_geo(bits_geo_000430),
define_lvl_geo(bits_geo_000448),
define_lvl_geo(bits_geo_000460),
define_lvl_geo(bits_geo_000478),
define_lvl_geo(bits_geo_000490),
define_lvl_geo(bits_geo_0004A8),
define_lvl_geo(bits_geo_0004C0),
define_lvl_geo(bits_geo_0004D8),
define_lvl_geo(bits_geo_0004F0),
define_lvl_geo(bits_geo_000508),
define_lvl_geo(bits_geo_000520),
define_lvl_geo(bits_geo_000538),
define_lvl_geo(bits_geo_000550),
define_lvl_geo(bits_geo_000568),
define_lvl_geo(bits_geo_000580),
define_lvl_geo(bits_geo_000598),
define_lvl_geo(bits_geo_0005B0),
define_lvl_geo(bits_geo_0005C8),
define_lvl_geo(bits_geo_0005E0),
define_lvl_geo(bits_geo_0005F8),
define_lvl_geo(bits_geo_000610),
define_lvl_geo(bits_geo_000628),
define_lvl_geo(bits_geo_000640),
define_lvl_geo(bits_geo_000658),
define_lvl_geo(bits_geo_000670),
define_lvl_geo(bits_geo_000688),
define_lvl_geo(bits_geo_0006A0),
define_lvl_geo(bits_geo_0006B8),
define_lvl_geo(bits_geo_0006D0),
define_lvl_geo(bits_geo_0006E8),
define_lvl_geo(bits_geo_000700),
define_lvl_geo(bits_geo_000718),
define_lvl_geo(bob_geo_000440),
define_lvl_geo(bob_geo_000458),
define_lvl_geo(bob_geo_000470),
define_lvl_geo(bob_geo_000488),
define_lvl_geo(bowser_2_geo_000170),
define_lvl_geo(bowser_2_geo_000188),
define_lvl_geo(bowser_3_geo_000290),
define_lvl_geo(bowser_3_geo_0002A8),
define_lvl_geo(bowser_3_geo_0002C0),
define_lvl_geo(bowser_3_geo_0002D8),
define_lvl_geo(bowser_3_geo_0002F0),
define_lvl_geo(bowser_3_geo_000308),
define_lvl_geo(bowser_3_geo_000320),
define_lvl_geo(bowser_3_geo_000338),
define_lvl_geo(bowser_3_geo_000350),
define_lvl_geo(bowser_3_geo_000368),
define_lvl_geo(bowser_3_geo_000380),
define_lvl_geo(bowser_3_geo_000398),
define_lvl_geo(castle_grounds_geo_000660),
define_lvl_geo(castle_grounds_geo_0006F4),
define_lvl_geo(castle_grounds_geo_00070C),
define_lvl_geo(castle_grounds_geo_000724),
define_lvl_geo(castle_grounds_geo_00073C),
define_lvl_geo(castle_geo_000F00),
define_lvl_geo(castle_geo_000F18),
define_lvl_geo(castle_geo_000F30),
define_lvl_geo(castle_geo_000F70),
define_lvl_geo(castle_geo_000F88),
define_lvl_geo(castle_geo_000FA8),
define_lvl_geo(castle_geo_000FD0),
define_lvl_geo(castle_geo_001000),
define_lvl_geo(castle_geo_001038),
define_lvl_geo(castle_geo_001088),
define_lvl_geo(castle_geo_0010C8),
define_lvl_geo(castle_geo_001110),
define_lvl_geo(castle_geo_001158),
define_lvl_geo(castle_geo_0011A8),
define_lvl_geo(castle_geo_001200),
define_lvl_geo(castle_geo_001260),
define_lvl_geo(castle_geo_0012C8),
define_lvl_geo(castle_geo_001348),
define_lvl_geo(castle_geo_0013B8),
define_lvl_geo(castle_geo_001400),
define_lvl_geo(castle_geo_001518),
define_lvl_geo(castle_geo_001530),
define_lvl_geo(castle_geo_001548),
define_lvl_geo(castle_geo_001560),
define_lvl_geo(castle_geo_001578),
define_lvl_geo(castle_geo_0015B8),
define_lvl_geo(castle_geo_0015F8),
define_lvl_geo(castle_geo_001628),
define_lvl_geo(castle_geo_001668),
define_lvl_geo(castle_geo_001690),
define_lvl_geo(castle_geo_0016D8),
define_lvl_geo(castle_geo_001740),
define_lvl_geo(castle_geo_001798),
define_lvl_geo(castle_geo_001800),
define_lvl_geo(castle_geo_001858),
define_lvl_geo(castle_geo_001940),
define_lvl_geo(castle_geo_001958),
define_lvl_geo(castle_geo_001980),
define_lvl_geo(castle_geo_0019C8),
define_lvl_geo(castle_geo_0019F8),
define_lvl_geo(castle_geo_001A30),
define_lvl_geo(castle_geo_001A58),
define_lvl_geo(castle_geo_001AB8),
define_lvl_geo(castle_geo_001AF8),
define_lvl_geo(castle_geo_001B48),
define_lvl_geo(castle_geo_001BB0),
define_lvl_geo(castle_geo_001C10),
define_lvl_geo(ccm_geo_0003D0),
define_lvl_geo(ccm_geo_0003F0),
define_lvl_geo(ccm_geo_00040C),
define_lvl_geo(ccm_geo_00042C),
define_lvl_geo(ccm_geo_00045C),
define_lvl_geo(ccm_geo_000494),
define_lvl_geo(ccm_geo_0004BC),
define_lvl_geo(ccm_geo_0004E4),
define_lvl_geo(ccm_geo_00051C),
define_lvl_geo(ccm_geo_0005E8),
define_lvl_geo(ddd_geo_000450),
define_lvl_geo(ddd_geo_000478),
define_lvl_geo(ddd_geo_0004A0),
define_lvl_geo(ddd_geo_0004C0),
define_lvl_geo(ddd_geo_000570),
define_lvl_geo(hmc_geo_000530),
define_lvl_geo(hmc_geo_000548),
define_lvl_geo(hmc_geo_000570),
define_lvl_geo(hmc_geo_000588),
define_lvl_geo(hmc_geo_0005A0),
define_lvl_geo(hmc_geo_0005B8),
define_lvl_geo(hmc_geo_0005D0),
define_lvl_geo(hmc_geo_0005E8),
define_lvl_geo(hmc_geo_000618),
define_lvl_geo(hmc_geo_000658),
define_lvl_geo(hmc_geo_0006A8),
define_lvl_geo(hmc_geo_0006E0),
define_lvl_geo(hmc_geo_000700),
define_lvl_geo(hmc_geo_000748),
define_lvl_geo(hmc_geo_000770),
define_lvl_geo(hmc_geo_000798),
define_lvl_geo(hmc_geo_0007F8),
define_lvl_geo(hmc_geo_000850),
define_lvl_geo(hmc_geo_0008D0),
define_lvl_geo(hmc_geo_000938),
define_lvl_geo(hmc_geo_000998),
define_lvl_geo(hmc_geo_000A18),
define_lvl_geo(hmc_geo_000A88),
define_lvl_geo(hmc_geo_000AE8),
define_lvl_geo(hmc_geo_000B48),
define_lvl_geo(hmc_geo_000B90),
define_lvl_geo(jrb_geo_000900),
define_lvl_geo(jrb_geo_000918),
define_lvl_geo(jrb_geo_000930),
define_lvl_geo(jrb_geo_000948),
define_lvl_geo(jrb_geo_000960),
define_lvl_geo(jrb_geo_000978),
define_lvl_geo(jrb_geo_000990),
define_lvl_geo(jrb_geo_0009B0),
define_lvl_geo(jrb_geo_0009C8),
define_lvl_geo(jrb_geo_0009E8),
define_lvl_geo(jrb_geo_000A00),
define_lvl_geo(jrb_geo_000A18),
define_lvl_geo(jrb_geo_000AFC),
define_lvl_geo(lll_geo_0009E0),
define_lvl_geo(lll_geo_0009F8),
define_lvl_geo(lll_geo_000A10),
define_lvl_geo(lll_geo_000A28),
define_lvl_geo(lll_geo_000A40),
define_lvl_geo(lll_geo_000A60),
define_lvl_geo(lll_geo_000A78),
define_lvl_geo(lll_geo_000A90),
define_lvl_geo(lll_geo_000AA8),
define_lvl_geo(lll_geo_000AC0),
define_lvl_geo(lll_geo_000AD8),
define_lvl_geo(lll_geo_000AF0),
define_lvl_geo(lll_geo_000B08),
define_lvl_geo(lll_geo_000B20),
define_lvl_geo(lll_geo_000B38),
define_lvl_geo(lll_geo_000B50),
define_lvl_geo(lll_geo_000B68),
define_lvl_geo(lll_geo_000B80),
define_lvl_geo(lll_geo_000B98),
define_lvl_geo(lll_geo_000BB0),
define_lvl_geo(lll_geo_000BC8),
define_lvl_geo(lll_geo_000BE0),
define_lvl_geo(lll_geo_000BF8),
define_lvl_geo(lll_geo_000C10),
define_lvl_geo(lll_geo_000C30),
define_lvl_geo(lll_geo_000C50),
define_lvl_geo(lll_geo_000C70),
define_lvl_geo(lll_geo_000C90),
define_lvl_geo(lll_geo_000CB0),
define_lvl_geo(lll_geo_000CD0),
define_lvl_geo(lll_geo_000CF0),
define_lvl_geo(lll_geo_000D10),
define_lvl_geo(lll_geo_000D30),
define_lvl_geo(lll_geo_000D50),
define_lvl_geo(lll_geo_000D70),
define_lvl_geo(lll_geo_000D90),
define_lvl_geo(lll_geo_000DB0),
define_lvl_geo(lll_geo_000DD0),
define_lvl_geo(lll_geo_000DE8),
define_lvl_geo(lll_geo_000E00),
define_lvl_geo(lll_geo_000EA8),
define_lvl_geo(lll_geo_000EC0),
define_lvl_geo(rr_geo_000660),
define_lvl_geo(rr_geo_000678),
define_lvl_geo(rr_geo_000690),
define_lvl_geo(rr_geo_0006A8),
define_lvl_geo(rr_geo_0006C0),
define_lvl_geo(rr_geo_0006D8),
define_lvl_geo(rr_geo_0006F0),
define_lvl_geo(rr_geo_000708),
define_lvl_geo(rr_geo_000720),
define_lvl_geo(rr_geo_000738),
define_lvl_geo(rr_geo_000758),
define_lvl_geo(rr_geo_000770),
define_lvl_geo(rr_geo_000788),
define_lvl_geo(rr_geo_0007A0),
define_lvl_geo(rr_geo_0007B8),
define_lvl_geo(rr_geo_0007D0),
define_lvl_geo(rr_geo_0007E8),
define_lvl_geo(rr_geo_000800),
define_lvl_geo(rr_geo_000818),
define_lvl_geo(rr_geo_000830),
define_lvl_geo(rr_geo_000848),
define_lvl_geo(rr_geo_000860),
define_lvl_geo(rr_geo_000878),
define_lvl_geo(rr_geo_000890),
define_lvl_geo(rr_geo_0008A8),
define_lvl_geo(rr_geo_0008C0),
define_lvl_geo(rr_geo_0008D8),
define_lvl_geo(rr_geo_0008F0),
define_lvl_geo(rr_geo_000908),
define_lvl_geo(rr_geo_000920),
define_lvl_geo(rr_geo_000940),
define_lvl_geo(rr_geo_000958),
define_lvl_geo(rr_geo_000970),
define_lvl_geo(rr_geo_000988),
define_lvl_geo(rr_geo_0009A0),
define_lvl_geo(rr_geo_0009B8),
define_lvl_geo(rr_geo_0009D0),
define_lvl_geo(sl_geo_000360),
define_lvl_geo(sl_geo_000378),
define_lvl_geo(sl_geo_000390),
define_lvl_geo(sl_geo_0003A8),
define_lvl_geo(sl_geo_000484),
define_lvl_geo(ssl_geo_0005C0),
define_lvl_geo(ssl_geo_0005D8),
define_lvl_geo(ssl_geo_000618),
define_lvl_geo(ssl_geo_000630),
define_lvl_geo(ssl_geo_000648),
define_lvl_geo(ssl_geo_000734),
define_lvl_geo(ssl_geo_000764),
define_lvl_geo(ssl_geo_000794),
define_lvl_geo(ssl_geo_0007AC),
define_lvl_geo(ssl_geo_0007CC),
define_lvl_geo(ssl_geo_00088C),
define_lvl_geo(thi_geo_0005B0),
define_lvl_geo(thi_geo_0005C8),
define_lvl_geo(thi_geo_0005F0),
define_lvl_geo(thi_geo_000608),
define_lvl_geo(thi_geo_0006D4),
define_lvl_geo(thi_geo_00079C),
define_lvl_geo(ttc_geo_000240),
define_lvl_geo(ttc_geo_000258),
define_lvl_geo(ttc_geo_000270),
define_lvl_geo(ttc_geo_000288),
define_lvl_geo(ttc_geo_0002A8),
define_lvl_geo(ttc_geo_0002C8),
define_lvl_geo(ttc_geo_0002E0),
define_lvl_geo(ttc_geo_0002F8),
define_lvl_geo(ttc_geo_000310),
define_lvl_geo(ttc_geo_000328),
define_lvl_geo(ttc_geo_000340),
define_lvl_geo(ttc_geo_000358),
define_lvl_geo(ttc_geo_000370),
define_lvl_geo(ttc_geo_000388),
define_lvl_geo(ttc_geo_0003A0),
define_lvl_geo(ttc_geo_0003B8),
define_lvl_geo(ttm_geo_000710),
define_lvl_geo(ttm_geo_000730),
define_lvl_geo(ttm_geo_000748),
define_lvl_geo(ttm_geo_000778),
define_lvl_geo(ttm_geo_0007A8),
define_lvl_geo(ttm_geo_0007D8),
define_lvl_geo(ttm_geo_000808),
define_lvl_geo(ttm_geo_000830),
define_lvl_geo(ttm_geo_000858),
define_lvl_geo(ttm_geo_000880),
define_lvl_geo(ttm_geo_0008A8),
define_lvl_geo(ttm_geo_0008D0),
define_lvl_geo(ttm_geo_0008F8),
define_lvl_geo(ttm_geo_000920),
define_lvl_geo(ttm_geo_000948),
define_lvl_geo(ttm_geo_000970),
define_lvl_geo(ttm_geo_000990),
define_lvl_geo(ttm_geo_0009C0),
define_lvl_geo(ttm_geo_0009F0),
define_lvl_geo(ttm_geo_000A18),
define_lvl_geo(ttm_geo_000A40),
define_lvl_geo(ttm_geo_000A70),
define_lvl_geo(ttm_geo_000B5C),
define_lvl_geo(ttm_geo_000BEC),
define_lvl_geo(ttm_geo_000C84),
define_lvl_geo(ttm_geo_000D14),
define_lvl_geo(ttm_geo_000D4C),
define_lvl_geo(ttm_geo_000D84),
define_lvl_geo(ttm_geo_000DBC),
define_lvl_geo(ttm_geo_000DF4),
define_lvl_geo(wdw_geo_000580),
define_lvl_geo(wdw_geo_000598),
define_lvl_geo(wdw_geo_0005C0),
define_lvl_geo(wdw_geo_0005E8),
define_lvl_geo(wdw_geo_000610),
define_lvl_geo(wdw_geo_000628),
define_lvl_geo(wdw_geo_000640),
define_lvl_geo(wdw_geo_000658),
define_lvl_geo(wdw_geo_000724),
define_lvl_geo(wf_geo_0007E0), define_lvl_geo(wf_geo_0007E0),
define_lvl_geo(wf_geo_000820), define_lvl_geo(wf_geo_000820),
define_lvl_geo(wf_geo_000860), define_lvl_geo(wf_geo_000860),
@ -640,10 +1071,6 @@ static const void *sDynosLevelGeos[] = {
define_lvl_geo(wf_geo_000BC8), define_lvl_geo(wf_geo_000BC8),
define_lvl_geo(wf_geo_000BE0), define_lvl_geo(wf_geo_000BE0),
define_lvl_geo(wf_geo_000BF8), define_lvl_geo(wf_geo_000BF8),
define_lvl_geo(bob_geo_000440),
define_lvl_geo(bob_geo_000458),
define_lvl_geo(bob_geo_000470),
define_lvl_geo(bob_geo_000488),
}; };
s32 DynOS_Lvl_GetGeoCount() { s32 DynOS_Lvl_GetGeoCount() {
@ -707,6 +1134,7 @@ LevelScript* DynOS_Lvl_Get(const char* levelName) {
static u32 index = 0; // DO NOT COMMIT static u32 index = 0; // DO NOT COMMIT
index = (index + 1) % sDynosCustomLevelScripts.Count(); // DO NOT COMMIT index = (index + 1) % sDynosCustomLevelScripts.Count(); // DO NOT COMMIT
auto& scripts = sDynosCustomLevelScripts[index].second->mLevelScripts; // DO NOT COMMIT auto& scripts = sDynosCustomLevelScripts[index].second->mLevelScripts; // DO NOT COMMIT
Print("Going to level: %s\n", scripts[scripts.Count() - 1]->mName); // DO NOT COMMIT
return scripts[scripts.Count() - 1]->mData; // DO NOT COMMIT return scripts[scripts.Count() - 1]->mData; // DO NOT COMMIT
for (s32 i = 0; i < sDynosCustomLevelScripts.Count(); ++i) { for (s32 i = 0; i < sDynosCustomLevelScripts.Count(); ++i) {