mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 05:25:14 +00:00
Added vanilla lvl cols to level gen, changed how pointer offsets are saved
This commit is contained in:
parent
8085f53e5a
commit
2fda92a8de
9 changed files with 407 additions and 65 deletions
|
@ -461,6 +461,7 @@ struct GfxData : NoCopy {
|
|||
s32 mModIndex = 0;
|
||||
SysPath mPackFolder;
|
||||
Array<void *> mPointerList;
|
||||
Array<Pair<const void*, const void*>> mPointerOffsetList;
|
||||
Array<void *> mLuaPointerList;
|
||||
Array<String> mLuaTokenList;
|
||||
GfxContext mGfxContext;
|
||||
|
@ -749,6 +750,8 @@ const void* DynOS_Mgr_VanillaScriptPtr_GetFromName(const char* aDataName);
|
|||
const char* DynOS_Mgr_VanillaScriptPtr_GetFromData(const void* aData);
|
||||
const GeoLayout* DynOS_Mgr_VanillaLvlGeo_GetFromName(const char* aDataName);
|
||||
const char* DynOS_Mgr_VanillaLvlGeo_GetFromData(const GeoLayout* aData);
|
||||
const Collision* DynOS_Mgr_VanillaLvlCol_GetFromName(const char* aDataName);
|
||||
const char* DynOS_Mgr_VanillaLvlCol_GetFromData(const Collision* aData);
|
||||
const Texture* DynOS_Mgr_VanillaTex_GetFromName(const char* aDataName);
|
||||
const char* DynOS_Mgr_VanillaTex_GetFromData(const Texture* aData);
|
||||
|
||||
|
|
|
@ -160,6 +160,7 @@ static void DynOS_Actor_Generate(const SysPath &aPackFolder, Array<Pair<u64, Str
|
|||
_GfxData->mModelIdentifier = _GeoNode->mModelIdentifier;
|
||||
_GfxData->mPackFolder = aPackFolder;
|
||||
_GfxData->mPointerList = { NULL }; // The NULL pointer is needed, so we add it here
|
||||
_GfxData->mPointerOffsetList = { };
|
||||
_GfxData->mLuaPointerList = { };
|
||||
_GfxData->mLuaTokenList = { };
|
||||
_GfxData->mGfxContext.mCurrentTexture = NULL;
|
||||
|
@ -213,6 +214,10 @@ static void DynOS_Actor_Generate(const SysPath &aPackFolder, Array<Pair<u64, Str
|
|||
ClearGfxDataNodes(_GfxData->mDisplayLists);
|
||||
ClearGfxDataNodes(_GfxData->mGeoLayouts);
|
||||
ClearGfxDataNodes(_GfxData->mCollisions);
|
||||
_GfxData->mPointerList.Clear();
|
||||
_GfxData->mPointerOffsetList.Clear();
|
||||
_GfxData->mLuaPointerList.Clear();
|
||||
_GfxData->mLuaTokenList.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,15 +22,9 @@ void ClearGfxDataNodes(DataNodes<T> &aDataNodes) {
|
|||
#define COLLISION_SIZE_PER_TOKEN 4
|
||||
|
||||
#define col_constant(x) if (_Arg == #x) { return (s16) (x); }
|
||||
static s16 ParseColSymbolArg(GfxData* aGfxData, DataNode<Collision>* aNode, u64& aTokenIndex) {
|
||||
const String& _Arg = aNode->mTokens[aTokenIndex++];
|
||||
|
||||
// Integers
|
||||
bool integerFound = false;
|
||||
s64 integerValue = DynOS_Misc_ParseInteger(_Arg, &integerFound);
|
||||
if (integerFound) {
|
||||
return integerValue;
|
||||
}
|
||||
static s64 DynOS_Col_ParseConstants(const String& _Arg, bool* found) {
|
||||
*found = true;
|
||||
|
||||
// Surface constants
|
||||
col_constant(SURFACE_DEFAULT);
|
||||
|
@ -278,8 +272,33 @@ static s16 ParseColSymbolArg(GfxData* aGfxData, DataNode<Collision>* aNode, u64&
|
|||
col_constant(special_key_door);
|
||||
col_constant(special_null_end);
|
||||
|
||||
// Other constants
|
||||
col_constant(NULL);
|
||||
*found = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static s16 ParseColSymbolArg(GfxData* aGfxData, DataNode<Collision>* aNode, u64& aTokenIndex) {
|
||||
const String& _Arg = aNode->mTokens[aTokenIndex++];
|
||||
|
||||
// Integers
|
||||
bool integerFound = false;
|
||||
s64 integerValue = DynOS_Misc_ParseInteger(_Arg, &integerFound);
|
||||
if (integerFound) {
|
||||
return integerValue;
|
||||
}
|
||||
|
||||
// Constants
|
||||
bool constantFound = false;
|
||||
s64 constantValue = DynOS_Col_ParseConstants(_Arg, &constantFound);
|
||||
if (constantFound) {
|
||||
return constantValue;
|
||||
}
|
||||
|
||||
// Recursive descent parsing
|
||||
bool rdSuccess = false;
|
||||
s64 rdValue = DynOS_RecursiveDescent_Parse(_Arg.begin(), &rdSuccess, DynOS_Col_ParseConstants);
|
||||
if (rdSuccess) {
|
||||
return rdValue;
|
||||
}
|
||||
|
||||
// Unknown
|
||||
PrintError(" ERROR: Unknown col arg: %s", _Arg.begin());
|
||||
|
|
|
@ -393,7 +393,12 @@ static s64 ParseGfxSymbolArg(GfxData* aGfxData, DataNode<Gfx>* aNode, u64* pToke
|
|||
// Vertex arrays
|
||||
for (auto& _Node : aGfxData->mVertices) {
|
||||
if (_Arg == _Node->mName) {
|
||||
return (s64) (DynOS_Vtx_Parse(aGfxData, _Node)->mData + _Offset);
|
||||
auto base = DynOS_Vtx_Parse(aGfxData, _Node)->mData;
|
||||
auto data = base + _Offset;
|
||||
if (_Offset != 0) {
|
||||
aGfxData->mPointerOffsetList.Add({ (const void*)data, (const void*)base });
|
||||
}
|
||||
return (s64) data;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1404,7 +1404,7 @@ s64 DynOS_Lvl_ParseLevelScriptConstants(const String& _Arg, bool* found) {
|
|||
}
|
||||
|
||||
static LevelScript ParseLevelScriptSymbolArgInternal(GfxData* aGfxData, DataNode<LevelScript>* aNode, u64& aTokenIndex, bool* found) {
|
||||
const String& _Arg = aNode->mTokens[aTokenIndex++];
|
||||
String _Arg = aNode->mTokens[aTokenIndex++];
|
||||
|
||||
// Integers
|
||||
bool integerFound = false;
|
||||
|
@ -1413,6 +1413,14 @@ static LevelScript ParseLevelScriptSymbolArgInternal(GfxData* aGfxData, DataNode
|
|||
return integerValue;
|
||||
}
|
||||
|
||||
// Offset
|
||||
s32 _Offset = 0;
|
||||
s32 _Plus = _Arg.Find('+');
|
||||
if (_Plus != -1) {
|
||||
_Offset = _Arg.SubString(_Plus + 1).ParseInt();
|
||||
_Arg = _Arg.SubString(0, _Plus);
|
||||
}
|
||||
|
||||
// Lvl functions
|
||||
void *_LvlFunctionPtr = DynOS_Lvl_GetFunctionPointerFromName(_Arg);
|
||||
if (_LvlFunctionPtr != NULL) {
|
||||
|
@ -1428,7 +1436,12 @@ static LevelScript ParseLevelScriptSymbolArgInternal(GfxData* aGfxData, DataNode
|
|||
// Level Scripts
|
||||
for (auto& _Node : aGfxData->mLevelScripts) {
|
||||
if (_Arg == _Node->mName) {
|
||||
return (LevelScript) DynOS_Lvl_Parse(aGfxData, _Node, false)->mData;
|
||||
auto base = DynOS_Lvl_Parse(aGfxData, _Node, false)->mData;
|
||||
auto data = base + _Offset;
|
||||
if (_Offset != 0) {
|
||||
aGfxData->mPointerOffsetList.Add({ data, base });
|
||||
}
|
||||
return (LevelScript) data;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1496,6 +1509,12 @@ static LevelScript ParseLevelScriptSymbolArgInternal(GfxData* aGfxData, DataNode
|
|||
return (LevelScript)vanillaGeo;
|
||||
}
|
||||
|
||||
// Vanilla Lvl Cols
|
||||
auto vanillaCol = DynOS_Mgr_VanillaLvlCol_GetFromName(_Arg.begin());
|
||||
if (vanillaCol != NULL) {
|
||||
return (LevelScript)vanillaCol;
|
||||
}
|
||||
|
||||
// Recursive descent parsing
|
||||
bool rdSuccess = false;
|
||||
s64 rdValue = DynOS_RecursiveDescent_Parse(_Arg.begin(), &rdSuccess, DynOS_Lvl_ParseLevelScriptConstants);
|
||||
|
@ -1609,10 +1628,13 @@ static LevelScript ParseLevelScriptSymbolArg(GfxData* aGfxData, DataNode<LevelSc
|
|||
return; \
|
||||
}
|
||||
|
||||
#define lvl_symbol_noop(symb, skipCount) \
|
||||
if (_Symbol == #symb) { \
|
||||
aTokenIndex += skipCount; \
|
||||
return; \
|
||||
#define lvl_symbol_noop_3(symb) \
|
||||
if (_Symbol == #symb) { \
|
||||
aTokenIndex += 3; \
|
||||
LevelScript _Ls[] = { symb(0, 0, 0) }; \
|
||||
memcpy(aHead, _Ls, sizeof(_Ls)); \
|
||||
aHead += (sizeof(_Ls) / sizeof(_Ls[0])); \
|
||||
return; \
|
||||
}
|
||||
|
||||
static void ParseLevelScriptSymbol(GfxData* aGfxData, DataNode<LevelScript>* aNode, LevelScript*& aHead, u64& aTokenIndex, Array<u64>& aSwitchNodes) {
|
||||
|
@ -1650,10 +1672,10 @@ static void ParseLevelScriptSymbol(GfxData* aGfxData, DataNode<LevelScript>* aNo
|
|||
lvl_symbol_0(PUSH_POOL);
|
||||
lvl_symbol_0(POP_POOL);
|
||||
lvl_symbol_3(FIXED_LOAD, 1, 2, 3);
|
||||
lvl_symbol_noop(LOAD_RAW, 3);
|
||||
lvl_symbol_noop(LOAD_MIO0, 3);
|
||||
lvl_symbol_noop_3(LOAD_RAW);
|
||||
lvl_symbol_noop_3(LOAD_MIO0);
|
||||
lvl_symbol_1(LOAD_MARIO_HEAD, 0);
|
||||
lvl_symbol_noop(LOAD_MIO0_TEXTURE, 3);
|
||||
lvl_symbol_noop_3(LOAD_MIO0_TEXTURE);
|
||||
|
||||
// levels
|
||||
lvl_symbol_0(INIT_LEVEL);
|
||||
|
@ -1968,6 +1990,13 @@ static DataNode<LevelScript>* DynOS_Lvl_Load(FILE *aFile, GfxData *aGfxData) {
|
|||
// Data
|
||||
_Node->mSize = ReadBytes<u32>(aFile);
|
||||
_Node->mData = New<LevelScript>(_Node->mSize);
|
||||
|
||||
// Add it
|
||||
if (aGfxData != NULL) {
|
||||
aGfxData->mLevelScripts.Add(_Node);
|
||||
}
|
||||
|
||||
// Read it
|
||||
for (u32 i = 0; i != _Node->mSize; ++i) {
|
||||
u32 _Value = ReadBytes<u32>(aFile);
|
||||
void *_Ptr = DynOS_Pointer_Load(aFile, aGfxData, _Value, true);
|
||||
|
@ -1978,11 +2007,6 @@ static DataNode<LevelScript>* DynOS_Lvl_Load(FILE *aFile, GfxData *aGfxData) {
|
|||
}
|
||||
}
|
||||
|
||||
// Add it
|
||||
if (aGfxData != NULL) {
|
||||
aGfxData->mLevelScripts.Add(_Node);
|
||||
}
|
||||
|
||||
return _Node;
|
||||
}
|
||||
|
||||
|
@ -2048,6 +2072,7 @@ static bool DynOS_Lvl_GeneratePack_Internal(const SysPath &aPackFolder, Array<Pa
|
|||
_GfxData->mModelIdentifier = _LvlRoot->mModelIdentifier;
|
||||
_GfxData->mPackFolder = aPackFolder;
|
||||
_GfxData->mPointerList = { NULL }; // The NULL pointer is needed, so we add it here
|
||||
_GfxData->mPointerOffsetList = { };
|
||||
_GfxData->mLuaPointerList = { };
|
||||
_GfxData->mLuaTokenList = { };
|
||||
_GfxData->mGfxContext.mCurrentTexture = NULL;
|
||||
|
@ -2097,6 +2122,10 @@ static bool DynOS_Lvl_GeneratePack_Internal(const SysPath &aPackFolder, Array<Pa
|
|||
ClearLvlDataNodes(_GfxData->mRooms);
|
||||
ClearLvlDataNodes(_GfxData->mGenerateGeoLayouts);
|
||||
ClearLvlDataNodes(_GfxData->mGenerateLevelScripts);
|
||||
_GfxData->mPointerList.Clear();
|
||||
_GfxData->mPointerOffsetList.Clear();
|
||||
_GfxData->mLuaPointerList.Clear();
|
||||
_GfxData->mLuaTokenList.Clear();
|
||||
generated = true;
|
||||
}
|
||||
return generated;
|
||||
|
|
|
@ -78,13 +78,6 @@ static PointerData GetDataFromPointer(const void* aPtr, GfxData* aGfxData) {
|
|||
}
|
||||
}
|
||||
|
||||
// Level scripts
|
||||
for (auto& _Node : aGfxData->mLevelScripts) {
|
||||
if (_Node->mData == aPtr) {
|
||||
return { _Node->mName, 0 };
|
||||
}
|
||||
}
|
||||
|
||||
// Macro objects
|
||||
for (auto& _Node : aGfxData->mMacroObjects) {
|
||||
if (_Node->mData == aPtr) {
|
||||
|
@ -141,6 +134,12 @@ static PointerData GetDataFromPointer(const void* aPtr, GfxData* aGfxData) {
|
|||
return { vanillaGeo, 0 };
|
||||
}
|
||||
|
||||
// Vanilla Lvl Cols
|
||||
auto vanillaCol = DynOS_Mgr_VanillaLvlCol_GetFromData((const Collision*)aPtr);
|
||||
if (vanillaCol != NULL) {
|
||||
return { vanillaCol, 0 };
|
||||
}
|
||||
|
||||
// Vanilla Script Pointers
|
||||
auto vanillaScriptPtr = DynOS_Mgr_VanillaScriptPtr_GetFromData(aPtr);
|
||||
if (vanillaScriptPtr != NULL) {
|
||||
|
@ -153,21 +152,35 @@ static PointerData GetDataFromPointer(const void* aPtr, GfxData* aGfxData) {
|
|||
return { vanillaTex, 0 };
|
||||
}
|
||||
|
||||
// the ones below use a saved offset
|
||||
|
||||
s32 _Offset = 0;
|
||||
for (auto& pair : aGfxData->mPointerOffsetList) {
|
||||
if (pair.first == aPtr) {
|
||||
_Offset = (s32)((const LevelScript*)pair.first - (const LevelScript*)pair.second);
|
||||
aPtr = pair.second;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Level scripts
|
||||
for (auto& _Node : aGfxData->mLevelScripts) {
|
||||
if (_Node->mData == aPtr) {
|
||||
return { _Node->mName, _Offset };
|
||||
}
|
||||
}
|
||||
|
||||
// Vertices
|
||||
String _VtxArrayName = "";
|
||||
uintptr_t _VtxArrayStart = 0;
|
||||
for (auto& _Node : aGfxData->mVertices) {
|
||||
if (_Node->mData == aPtr) {
|
||||
return { _Node->mName, 0 };
|
||||
}
|
||||
if ((uintptr_t)_Node->mData <= (uintptr_t)aPtr &&
|
||||
(uintptr_t)_Node->mData >= _VtxArrayStart) {
|
||||
_VtxArrayName = _Node->mName;
|
||||
_VtxArrayStart = (uintptr_t)_Node->mData;
|
||||
return { _Node->mName, _Offset };
|
||||
}
|
||||
}
|
||||
return { _VtxArrayName, (u32)((const Vtx*)aPtr - (const Vtx*)_VtxArrayStart) };
|
||||
|
||||
PrintError("Unable to find pointer!");
|
||||
return { "", 0 };
|
||||
}
|
||||
|
||||
void DynOS_Pointer_Lua_Write(FILE* aFile, u32 index, GfxData* aGfxData) {
|
||||
|
@ -311,7 +324,7 @@ static void *GetPointerFromData(GfxData *aGfxData, const String &aPtrName, u32 a
|
|||
// Level scripts
|
||||
for (auto &_Node : aGfxData->mLevelScripts) {
|
||||
if (_Node->mName == aPtrName) {
|
||||
return (void *) _Node->mData;
|
||||
return (void *) (_Node->mData + aPtrData);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -371,6 +384,12 @@ static void *GetPointerFromData(GfxData *aGfxData, const String &aPtrName, u32 a
|
|||
return (void*)vanillaGeo;
|
||||
}
|
||||
|
||||
// Vanilla Lvl Cols
|
||||
auto vanillaCol = DynOS_Mgr_VanillaLvlCol_GetFromName(aPtrName.begin());
|
||||
if (vanillaCol != NULL) {
|
||||
return (void*)vanillaCol;
|
||||
}
|
||||
|
||||
// Vanilla Script Pointers
|
||||
auto vanillaScriptPtr = DynOS_Mgr_VanillaScriptPtr_GetFromName(aPtrName.begin());
|
||||
if (vanillaScriptPtr != NULL) {
|
||||
|
|
|
@ -5,13 +5,42 @@
|
|||
//////////
|
||||
|
||||
s64 DynOS_Misc_ParseInteger(const String& _Arg, bool* found) {
|
||||
s32 x;
|
||||
if ((_Arg[1] == 'x' && sscanf(_Arg.begin(), "%x", &x) == 1) || (sscanf(_Arg.begin(), "%d", &x) == 1)) {
|
||||
*found = true;
|
||||
return (s64) x;
|
||||
const char* argStr = _Arg.begin();
|
||||
if (argStr[0] == '0' && argStr[1] == 'x') {
|
||||
// is a hex number
|
||||
argStr += 2;
|
||||
while(*argStr != '\0') {
|
||||
if (*argStr >= '0' && *argStr <= '9') {
|
||||
// good
|
||||
} else if (*argStr >= 'a' && *argStr <= 'f') {
|
||||
// good
|
||||
} else if (*argStr >= 'A' && *argStr <= 'F') {
|
||||
// good
|
||||
} else {
|
||||
// bad character
|
||||
*found = false;
|
||||
return 0;
|
||||
}
|
||||
argStr++;
|
||||
}
|
||||
} else {
|
||||
// is a decimal number
|
||||
while(*argStr != '\0') {
|
||||
if (*argStr >= '0' && *argStr <= '9') {
|
||||
// good
|
||||
} else if (*argStr == '-' || *argStr == '+') {
|
||||
// good
|
||||
} else {
|
||||
// bad character
|
||||
*found = false;
|
||||
return 0;
|
||||
}
|
||||
argStr++;
|
||||
}
|
||||
}
|
||||
*found = false;
|
||||
return 0;
|
||||
|
||||
*found = true;
|
||||
return _Arg.ParseInt();
|
||||
}
|
||||
|
||||
void DynOS_Gfx_Free(GfxData* aGfxData) {
|
||||
|
@ -146,18 +175,32 @@ static s64 ParseNumeric() {
|
|||
String numeric = "";
|
||||
char* c = sRdString;
|
||||
|
||||
// check for hex
|
||||
if (*c == '0' && *(c+1) == 'x') {
|
||||
// is hex
|
||||
numeric.Add(*c);
|
||||
c++;
|
||||
numeric.Add(*c);
|
||||
c++;
|
||||
}
|
||||
|
||||
// continue adding to string
|
||||
while (*c >= '0' && *c <= '9') {
|
||||
numeric.Add(*c);
|
||||
c++;
|
||||
while (true) {
|
||||
if (*c >= '0' && *c <= '9') {
|
||||
// good
|
||||
} else if (*c >= 'a' && *c <= 'f') {
|
||||
// good
|
||||
} else if (*c >= 'A' && *c <= 'F') {
|
||||
// good
|
||||
} else {
|
||||
// bad
|
||||
break;
|
||||
}
|
||||
numeric.Add(*c);
|
||||
c++;
|
||||
}
|
||||
} else {
|
||||
// is decimal
|
||||
while (*c >= '0' && *c <= '9') {
|
||||
numeric.Add(*c);
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
||||
// advance parsing
|
||||
|
|
|
@ -17,6 +17,7 @@ extern "C" {
|
|||
#include "levels/castle_grounds/header.h"
|
||||
#include "levels/castle_inside/header.h"
|
||||
#include "levels/ccm/header.h"
|
||||
#include "levels/cotmc/header.h"
|
||||
#include "levels/ddd/header.h"
|
||||
#include "levels/hmc/header.h"
|
||||
#include "levels/jrb/header.h"
|
||||
|
@ -260,6 +261,7 @@ static const void* sDynosVanillaLvlGeos[] = {
|
|||
define_vanilla_lvl_geo(ccm_geo_0004E4),
|
||||
define_vanilla_lvl_geo(ccm_geo_00051C),
|
||||
define_vanilla_lvl_geo(ccm_geo_0005E8),
|
||||
define_vanilla_lvl_geo(cotmc_geo_0001A0),
|
||||
define_vanilla_lvl_geo(ddd_geo_000450),
|
||||
define_vanilla_lvl_geo(ddd_geo_000478),
|
||||
define_vanilla_lvl_geo(ddd_geo_0004A0),
|
||||
|
@ -575,6 +577,224 @@ const char* DynOS_Mgr_VanillaLvlGeo_GetFromData(const GeoLayout* aData) {
|
|||
MGR_FIND_NAME(sDynosVanillaLvlGeos);
|
||||
}
|
||||
|
||||
////////////////
|
||||
// Level Cols //
|
||||
////////////////
|
||||
|
||||
#define define_vanilla_lvl_col(col) (const void*) #col, (const void*) col
|
||||
static const void* sDynosVanillaLvlCols[] = {
|
||||
define_vanilla_lvl_col(bbh_seg7_collision_07026B1C),
|
||||
define_vanilla_lvl_col(bbh_seg7_collision_coffin),
|
||||
define_vanilla_lvl_col(bbh_seg7_collision_haunted_bookshelf),
|
||||
define_vanilla_lvl_col(bbh_seg7_collision_level),
|
||||
define_vanilla_lvl_col(bbh_seg7_collision_merry_go_round),
|
||||
define_vanilla_lvl_col(bbh_seg7_collision_mesh_elevator),
|
||||
define_vanilla_lvl_col(bbh_seg7_collision_staircase_step),
|
||||
define_vanilla_lvl_col(bbh_seg7_collision_tilt_floor_platform),
|
||||
define_vanilla_lvl_col(bitdw_seg7_collision_0700F688),
|
||||
define_vanilla_lvl_col(bitdw_seg7_collision_0700F70C),
|
||||
define_vanilla_lvl_col(bitdw_seg7_collision_0700F7F0),
|
||||
define_vanilla_lvl_col(bitdw_seg7_collision_0700F898),
|
||||
define_vanilla_lvl_col(bitdw_seg7_collision_0700F91C),
|
||||
define_vanilla_lvl_col(bitdw_seg7_collision_0700FA3C),
|
||||
define_vanilla_lvl_col(bitdw_seg7_collision_0700FB5C),
|
||||
define_vanilla_lvl_col(bitdw_seg7_collision_0700FC7C),
|
||||
define_vanilla_lvl_col(bitdw_seg7_collision_0700FD9C),
|
||||
define_vanilla_lvl_col(bitdw_seg7_collision_level),
|
||||
define_vanilla_lvl_col(bitdw_seg7_collision_moving_pyramid),
|
||||
define_vanilla_lvl_col(bitfs_seg7_collision_07015124),
|
||||
define_vanilla_lvl_col(bitfs_seg7_collision_07015288),
|
||||
define_vanilla_lvl_col(bitfs_seg7_collision_07015714),
|
||||
define_vanilla_lvl_col(bitfs_seg7_collision_07015768),
|
||||
define_vanilla_lvl_col(bitfs_seg7_collision_070157E0),
|
||||
define_vanilla_lvl_col(bitfs_seg7_collision_07015928),
|
||||
define_vanilla_lvl_col(bitfs_seg7_collision_inverted_pyramid),
|
||||
define_vanilla_lvl_col(bitfs_seg7_collision_level),
|
||||
define_vanilla_lvl_col(bitfs_seg7_collision_sinking_cage_platform),
|
||||
define_vanilla_lvl_col(bitfs_seg7_collision_sinking_platform),
|
||||
define_vanilla_lvl_col(bitfs_seg7_collision_squishable_platform),
|
||||
define_vanilla_lvl_col(bits_seg7_collision_0701A9A0),
|
||||
define_vanilla_lvl_col(bits_seg7_collision_0701AA0C),
|
||||
define_vanilla_lvl_col(bits_seg7_collision_0701AA84),
|
||||
define_vanilla_lvl_col(bits_seg7_collision_0701AC28),
|
||||
define_vanilla_lvl_col(bits_seg7_collision_0701ACAC),
|
||||
define_vanilla_lvl_col(bits_seg7_collision_0701AD54),
|
||||
define_vanilla_lvl_col(bits_seg7_collision_0701ADD8),
|
||||
define_vanilla_lvl_col(bits_seg7_collision_0701AE5C),
|
||||
define_vanilla_lvl_col(bits_seg7_collision_0701B0D4),
|
||||
define_vanilla_lvl_col(bits_seg7_collision_0701B26C),
|
||||
define_vanilla_lvl_col(bits_seg7_collision_0701B404),
|
||||
define_vanilla_lvl_col(bits_seg7_collision_0701B59C),
|
||||
define_vanilla_lvl_col(bits_seg7_collision_0701B734),
|
||||
define_vanilla_lvl_col(bits_seg7_collision_level),
|
||||
define_vanilla_lvl_col(bob_seg7_collision_bridge),
|
||||
define_vanilla_lvl_col(bob_seg7_collision_chain_chomp_gate),
|
||||
define_vanilla_lvl_col(bob_seg7_collision_gate),
|
||||
define_vanilla_lvl_col(bob_seg7_collision_level),
|
||||
define_vanilla_lvl_col(bowser_1_seg7_collision_level),
|
||||
define_vanilla_lvl_col(bowser_2_seg7_collision_lava),
|
||||
define_vanilla_lvl_col(bowser_2_seg7_collision_tilting_platform),
|
||||
define_vanilla_lvl_col(bowser_3_seg7_collision_07004B94),
|
||||
define_vanilla_lvl_col(bowser_3_seg7_collision_07004C18),
|
||||
define_vanilla_lvl_col(bowser_3_seg7_collision_07004C9C),
|
||||
define_vanilla_lvl_col(bowser_3_seg7_collision_07004D20),
|
||||
define_vanilla_lvl_col(bowser_3_seg7_collision_07004DA4),
|
||||
define_vanilla_lvl_col(bowser_3_seg7_collision_07004E28),
|
||||
define_vanilla_lvl_col(bowser_3_seg7_collision_07004EAC),
|
||||
define_vanilla_lvl_col(bowser_3_seg7_collision_07004F30),
|
||||
define_vanilla_lvl_col(bowser_3_seg7_collision_07004FB4),
|
||||
define_vanilla_lvl_col(bowser_3_seg7_collision_07005038),
|
||||
define_vanilla_lvl_col(bowser_3_seg7_collision_level),
|
||||
define_vanilla_lvl_col(castle_courtyard_seg7_collision),
|
||||
define_vanilla_lvl_col(castle_grounds_seg7_collision_cannon_grill),
|
||||
define_vanilla_lvl_col(castle_grounds_seg7_collision_level),
|
||||
define_vanilla_lvl_col(castle_grounds_seg7_collision_moat_grills),
|
||||
define_vanilla_lvl_col(ccm_seg7_area_1_collision),
|
||||
define_vanilla_lvl_col(ccm_seg7_area_2_collision),
|
||||
define_vanilla_lvl_col(ccm_seg7_collision_070163F8),
|
||||
define_vanilla_lvl_col(cotmc_seg7_collision_level),
|
||||
define_vanilla_lvl_col(ddd_seg7_area_1_collision),
|
||||
define_vanilla_lvl_col(ddd_seg7_area_2_collision),
|
||||
define_vanilla_lvl_col(ddd_seg7_collision_bowser_sub_door),
|
||||
define_vanilla_lvl_col(ddd_seg7_collision_submarine),
|
||||
define_vanilla_lvl_col(hmc_seg7_collision_0702B65C),
|
||||
define_vanilla_lvl_col(hmc_seg7_collision_controllable_platform_sub),
|
||||
define_vanilla_lvl_col(hmc_seg7_collision_controllable_platform),
|
||||
define_vanilla_lvl_col(hmc_seg7_collision_elevator),
|
||||
define_vanilla_lvl_col(hmc_seg7_collision_level),
|
||||
define_vanilla_lvl_col(inside_castle_seg7_area_1_collision),
|
||||
define_vanilla_lvl_col(inside_castle_seg7_area_2_collision),
|
||||
define_vanilla_lvl_col(inside_castle_seg7_area_3_collision),
|
||||
define_vanilla_lvl_col(inside_castle_seg7_collision_ddd_warp_2),
|
||||
define_vanilla_lvl_col(inside_castle_seg7_collision_ddd_warp),
|
||||
define_vanilla_lvl_col(inside_castle_seg7_collision_floor_trap),
|
||||
define_vanilla_lvl_col(inside_castle_seg7_collision_star_door),
|
||||
define_vanilla_lvl_col(inside_castle_seg7_collision_water_level_pillar),
|
||||
define_vanilla_lvl_col(jrb_seg7_area_1_collision),
|
||||
define_vanilla_lvl_col(jrb_seg7_area_2_collision),
|
||||
define_vanilla_lvl_col(jrb_seg7_collision_0700CEF0),
|
||||
define_vanilla_lvl_col(jrb_seg7_collision_0700D1DC),
|
||||
define_vanilla_lvl_col(jrb_seg7_collision_floating_box),
|
||||
define_vanilla_lvl_col(jrb_seg7_collision_floating_platform),
|
||||
define_vanilla_lvl_col(jrb_seg7_collision_in_sunken_ship_2),
|
||||
define_vanilla_lvl_col(jrb_seg7_collision_in_sunken_ship_3),
|
||||
define_vanilla_lvl_col(jrb_seg7_collision_in_sunken_ship),
|
||||
define_vanilla_lvl_col(jrb_seg7_collision_pillar_base),
|
||||
define_vanilla_lvl_col(jrb_seg7_collision_rock_solid),
|
||||
define_vanilla_lvl_col(lll_seg7_area_1_collision),
|
||||
define_vanilla_lvl_col(lll_seg7_area_2_collision),
|
||||
define_vanilla_lvl_col(lll_seg7_collision_0701D21C),
|
||||
define_vanilla_lvl_col(lll_seg7_collision_drawbridge),
|
||||
define_vanilla_lvl_col(lll_seg7_collision_falling_wall),
|
||||
define_vanilla_lvl_col(lll_seg7_collision_floating_block),
|
||||
define_vanilla_lvl_col(lll_seg7_collision_hexagonal_platform),
|
||||
define_vanilla_lvl_col(lll_seg7_collision_inverted_pyramid),
|
||||
define_vanilla_lvl_col(lll_seg7_collision_octagonal_moving_platform),
|
||||
define_vanilla_lvl_col(lll_seg7_collision_pitoune),
|
||||
define_vanilla_lvl_col(lll_seg7_collision_puzzle_piece),
|
||||
define_vanilla_lvl_col(lll_seg7_collision_rotating_fire_bars),
|
||||
define_vanilla_lvl_col(lll_seg7_collision_rotating_platform),
|
||||
define_vanilla_lvl_col(lll_seg7_collision_sinking_pyramids),
|
||||
define_vanilla_lvl_col(lll_seg7_collision_slow_tilting_platform),
|
||||
define_vanilla_lvl_col(lll_seg7_collision_wood_piece),
|
||||
define_vanilla_lvl_col(pss_seg7_collision),
|
||||
define_vanilla_lvl_col(rr_seg7_collision_07029038),
|
||||
define_vanilla_lvl_col(rr_seg7_collision_07029508),
|
||||
define_vanilla_lvl_col(rr_seg7_collision_070295F8),
|
||||
define_vanilla_lvl_col(rr_seg7_collision_0702967C),
|
||||
define_vanilla_lvl_col(rr_seg7_collision_07029750),
|
||||
define_vanilla_lvl_col(rr_seg7_collision_07029858),
|
||||
define_vanilla_lvl_col(rr_seg7_collision_07029924),
|
||||
define_vanilla_lvl_col(rr_seg7_collision_07029C1C),
|
||||
define_vanilla_lvl_col(rr_seg7_collision_07029FA4),
|
||||
define_vanilla_lvl_col(rr_seg7_collision_0702A32C),
|
||||
define_vanilla_lvl_col(rr_seg7_collision_0702A6B4),
|
||||
define_vanilla_lvl_col(rr_seg7_collision_donut_platform),
|
||||
define_vanilla_lvl_col(rr_seg7_collision_elevator_platform),
|
||||
define_vanilla_lvl_col(rr_seg7_collision_level),
|
||||
define_vanilla_lvl_col(rr_seg7_collision_pendulum),
|
||||
define_vanilla_lvl_col(rr_seg7_collision_rotating_platform_with_fire),
|
||||
define_vanilla_lvl_col(sa_seg7_collision),
|
||||
define_vanilla_lvl_col(sl_seg7_area_1_collision),
|
||||
define_vanilla_lvl_col(sl_seg7_area_2_collision),
|
||||
define_vanilla_lvl_col(sl_seg7_collision_pound_explodes),
|
||||
define_vanilla_lvl_col(sl_seg7_collision_sliding_snow_mound),
|
||||
define_vanilla_lvl_col(ssl_seg7_area_1_collision),
|
||||
define_vanilla_lvl_col(ssl_seg7_area_2_collision),
|
||||
define_vanilla_lvl_col(ssl_seg7_area_3_collision),
|
||||
define_vanilla_lvl_col(ssl_seg7_collision_0702808C),
|
||||
define_vanilla_lvl_col(ssl_seg7_collision_07028274),
|
||||
define_vanilla_lvl_col(ssl_seg7_collision_070282F8),
|
||||
define_vanilla_lvl_col(ssl_seg7_collision_07028370),
|
||||
define_vanilla_lvl_col(ssl_seg7_collision_070284B0),
|
||||
define_vanilla_lvl_col(ssl_seg7_collision_grindel),
|
||||
define_vanilla_lvl_col(ssl_seg7_collision_pyramid_elevator),
|
||||
define_vanilla_lvl_col(ssl_seg7_collision_pyramid_top),
|
||||
define_vanilla_lvl_col(ssl_seg7_collision_spindel),
|
||||
define_vanilla_lvl_col(ssl_seg7_collision_tox_box),
|
||||
define_vanilla_lvl_col(thi_seg7_area_1_collision),
|
||||
define_vanilla_lvl_col(thi_seg7_area_2_collision),
|
||||
define_vanilla_lvl_col(thi_seg7_area_3_collision),
|
||||
define_vanilla_lvl_col(thi_seg7_collision_top_trap),
|
||||
define_vanilla_lvl_col(totwc_seg7_collision),
|
||||
define_vanilla_lvl_col(ttc_seg7_collision_07014F70),
|
||||
define_vanilla_lvl_col(ttc_seg7_collision_07015008),
|
||||
define_vanilla_lvl_col(ttc_seg7_collision_070152B4),
|
||||
define_vanilla_lvl_col(ttc_seg7_collision_070153E0),
|
||||
define_vanilla_lvl_col(ttc_seg7_collision_07015584),
|
||||
define_vanilla_lvl_col(ttc_seg7_collision_07015650),
|
||||
define_vanilla_lvl_col(ttc_seg7_collision_07015754),
|
||||
define_vanilla_lvl_col(ttc_seg7_collision_070157D8),
|
||||
define_vanilla_lvl_col(ttc_seg7_collision_clock_main_rotation),
|
||||
define_vanilla_lvl_col(ttc_seg7_collision_clock_pendulum),
|
||||
define_vanilla_lvl_col(ttc_seg7_collision_clock_platform),
|
||||
define_vanilla_lvl_col(ttc_seg7_collision_level),
|
||||
define_vanilla_lvl_col(ttc_seg7_collision_rotating_clock_platform2),
|
||||
define_vanilla_lvl_col(ttc_seg7_collision_sliding_surface),
|
||||
define_vanilla_lvl_col(ttm_seg7_area_1_collision),
|
||||
define_vanilla_lvl_col(ttm_seg7_area_2_collision),
|
||||
define_vanilla_lvl_col(ttm_seg7_area_3_collision),
|
||||
define_vanilla_lvl_col(ttm_seg7_area_4_collision),
|
||||
define_vanilla_lvl_col(ttm_seg7_collision_pitoune_2),
|
||||
define_vanilla_lvl_col(ttm_seg7_collision_podium_warp),
|
||||
define_vanilla_lvl_col(ttm_seg7_collision_ukiki_cage),
|
||||
define_vanilla_lvl_col(vcutm_seg7_collision_0700AC44),
|
||||
define_vanilla_lvl_col(vcutm_seg7_collision),
|
||||
define_vanilla_lvl_col(wdw_seg7_area_1_collision),
|
||||
define_vanilla_lvl_col(wdw_seg7_area_2_collision),
|
||||
define_vanilla_lvl_col(wdw_seg7_collision_070184C8),
|
||||
define_vanilla_lvl_col(wdw_seg7_collision_07018528),
|
||||
define_vanilla_lvl_col(wdw_seg7_collision_070186B4),
|
||||
define_vanilla_lvl_col(wdw_seg7_collision_arrow_lift),
|
||||
define_vanilla_lvl_col(wdw_seg7_collision_express_elevator_platform),
|
||||
define_vanilla_lvl_col(wdw_seg7_collision_rect_floating_platform),
|
||||
define_vanilla_lvl_col(wdw_seg7_collision_square_floating_platform),
|
||||
define_vanilla_lvl_col(wf_seg7_collision_070102D8),
|
||||
define_vanilla_lvl_col(wf_seg7_collision_breakable_wall_2),
|
||||
define_vanilla_lvl_col(wf_seg7_collision_breakable_wall),
|
||||
define_vanilla_lvl_col(wf_seg7_collision_bullet_bill_cannon),
|
||||
define_vanilla_lvl_col(wf_seg7_collision_clocklike_rotation),
|
||||
define_vanilla_lvl_col(wf_seg7_collision_kickable_board),
|
||||
define_vanilla_lvl_col(wf_seg7_collision_large_bomp),
|
||||
define_vanilla_lvl_col(wf_seg7_collision_platform),
|
||||
define_vanilla_lvl_col(wf_seg7_collision_rotating_platform),
|
||||
define_vanilla_lvl_col(wf_seg7_collision_sliding_brick_platform),
|
||||
define_vanilla_lvl_col(wf_seg7_collision_small_bomp),
|
||||
define_vanilla_lvl_col(wf_seg7_collision_tower_door),
|
||||
define_vanilla_lvl_col(wf_seg7_collision_tower),
|
||||
define_vanilla_lvl_col(wf_seg7_collision_trapezoid),
|
||||
define_vanilla_lvl_col(wf_seg7_collision_tumbling_bridge),
|
||||
define_vanilla_lvl_col(wmotr_seg7_collision),
|
||||
};
|
||||
|
||||
const Collision* DynOS_Mgr_VanillaLvlCol_GetFromName(const char* aDataName) {
|
||||
MGR_FIND_DATA(sDynosVanillaLvlCols, (const Collision*));
|
||||
}
|
||||
|
||||
const char* DynOS_Mgr_VanillaLvlCol_GetFromData(const Collision* aData) {
|
||||
MGR_FIND_NAME(sDynosVanillaLvlCols);
|
||||
}
|
||||
|
||||
//////////////
|
||||
// Textures //
|
||||
//////////////
|
||||
|
|
|
@ -558,31 +558,30 @@ void alloc_surface_pools(void) {
|
|||
/**
|
||||
* Get the size of the terrain data, to get the correct size when copying later.
|
||||
*/
|
||||
u32 get_area_terrain_size(s16 *data) {
|
||||
s16 *startPos = data;
|
||||
u32 get_area_terrain_size(s16 *terrainData) {
|
||||
s16 *startPos = terrainData;
|
||||
s32 end = FALSE;
|
||||
s16 terrainLoadType;
|
||||
s32 numVertices;
|
||||
s32 numRegions;
|
||||
s32 numSurfaces;
|
||||
s16 hasForce;
|
||||
|
||||
while (!end) {
|
||||
terrainLoadType = *data++;
|
||||
terrainLoadType = *terrainData++;
|
||||
|
||||
switch (terrainLoadType) {
|
||||
case TERRAIN_LOAD_VERTICES:
|
||||
numVertices = *data++;
|
||||
data += 3 * numVertices;
|
||||
numVertices = *terrainData++;
|
||||
terrainData += 3 * numVertices;
|
||||
break;
|
||||
|
||||
case TERRAIN_LOAD_OBJECTS:
|
||||
data += get_special_objects_size(data);
|
||||
terrainData += get_special_objects_size(terrainData);
|
||||
break;
|
||||
|
||||
case TERRAIN_LOAD_ENVIRONMENT:
|
||||
numRegions = *data++;
|
||||
data += 6 * numRegions;
|
||||
numRegions = *terrainData++;
|
||||
terrainData += 6 * numRegions;
|
||||
break;
|
||||
|
||||
case TERRAIN_LOAD_CONTINUE:
|
||||
|
@ -593,14 +592,14 @@ u32 get_area_terrain_size(s16 *data) {
|
|||
break;
|
||||
|
||||
default:
|
||||
numSurfaces = *data++;
|
||||
numSurfaces = *terrainData++;
|
||||
hasForce = surface_has_force(terrainLoadType);
|
||||
data += (3 + hasForce) * numSurfaces;
|
||||
terrainData += (3 + hasForce) * numSurfaces;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return data - startPos;
|
||||
return terrainData - startPos;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue