mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
rename Area's unk04 to root and fix lookup error
This commit is contained in:
parent
9e87ce10c0
commit
dcc9090ac0
10 changed files with 19 additions and 20 deletions
|
|
@ -71,7 +71,6 @@ struct LuaObjectField* smlua_get_object_field_autogen(u16 lot, const char* key);
|
|||
"""
|
||||
|
||||
override_field_names = {
|
||||
"Area": {"unk04": "root"}
|
||||
}
|
||||
|
||||
override_field_types = {
|
||||
|
|
@ -117,7 +116,7 @@ override_field_immutable = {
|
|||
"GlobalObjectAnimations": [ "*"],
|
||||
"SpawnParticlesInfo": [ "model" ],
|
||||
"MarioBodyState": [ "updateTorsoTime" ],
|
||||
"Area": [ "localAreaTimer", "nextSyncID", "unk04", "objectSpawnInfos", "paintingWarpNodes", "warpNodes" ],
|
||||
"Area": [ "localAreaTimer", "nextSyncID", "objectSpawnInfos", "paintingWarpNodes", "warpNodes" ],
|
||||
"Mod": [ "*" ],
|
||||
"ModFile": [ "*" ],
|
||||
"Painting": [ "id", "imageCount", "textureType", "textureWidth", "textureHeight" ],
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@
|
|||
--- @field public numSecrets integer
|
||||
--- @field public objectSpawnInfos SpawnInfo
|
||||
--- @field public paintingWarpNodes WarpNode
|
||||
--- @field public root GraphNodeRoot
|
||||
--- @field public surfaceRooms Pointer_integer
|
||||
--- @field public terrainData Pointer_integer
|
||||
--- @field public terrainType integer
|
||||
--- @field public root GraphNodeRoot
|
||||
--- @field public warpNodes ObjectWarpNode
|
||||
--- @field public whirlpools Whirlpool[]
|
||||
|
||||
|
|
|
|||
|
|
@ -191,10 +191,10 @@
|
|||
| numSecrets | `integer` | |
|
||||
| objectSpawnInfos | [SpawnInfo](structs.md#SpawnInfo) | read-only |
|
||||
| paintingWarpNodes | [WarpNode](structs.md#WarpNode) | read-only |
|
||||
| root | [GraphNodeRoot](structs.md#GraphNodeRoot) | |
|
||||
| surfaceRooms | `Pointer` <`integer`> | read-only |
|
||||
| terrainData | `Pointer` <`integer`> | read-only |
|
||||
| terrainType | `integer` | |
|
||||
| root | [GraphNodeRoot](structs.md#GraphNodeRoot) | |
|
||||
| warpNodes | [ObjectWarpNode](structs.md#ObjectWarpNode) | read-only |
|
||||
| whirlpools | `Array` <`Whirlpool`> | |
|
||||
|
||||
|
|
|
|||
|
|
@ -374,7 +374,7 @@ static void level_reset_globals(void) {
|
|||
|
||||
// clear area's level pool pointers
|
||||
for (int i = 0; i < MAX_AREAS; i++) {
|
||||
gAreas[i].unk04 = NULL;
|
||||
gAreas[i].root = NULL;
|
||||
}
|
||||
|
||||
// reset mariostate spawninfo pointers
|
||||
|
|
@ -439,7 +439,7 @@ static void level_cmd_begin_area(void) {
|
|||
|
||||
sCurrAreaIndex = areaIndex;
|
||||
screenArea->areaIndex = areaIndex;
|
||||
gAreas[areaIndex].unk04 = screenArea;
|
||||
gAreas[areaIndex].root = screenArea;
|
||||
gAreas[areaIndex].numRedCoins = 0;
|
||||
gAreas[areaIndex].numSecrets = 0;
|
||||
gAreas[areaIndex].nextSyncID = 10;
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ void clear_areas(void) {
|
|||
gAreaData[i].index = i;
|
||||
gAreaData[i].flags = 0;
|
||||
gAreaData[i].terrainType = 0;
|
||||
gAreaData[i].unk04 = NULL;
|
||||
gAreaData[i].root = NULL;
|
||||
gAreaData[i].terrainData = NULL;
|
||||
gAreaData[i].surfaceRooms = NULL;
|
||||
gAreaData[i].macroObjects = NULL;
|
||||
|
|
@ -255,21 +255,21 @@ void clear_areas(void) {
|
|||
|
||||
void clear_area_graph_nodes(void) {
|
||||
if (gCurrentArea != NULL) {
|
||||
geo_call_global_function_nodes(&gCurrentArea->unk04->node, GEO_CONTEXT_AREA_UNLOAD);
|
||||
geo_call_global_function_nodes(&gCurrentArea->root->node, GEO_CONTEXT_AREA_UNLOAD);
|
||||
gCurrentArea = NULL;
|
||||
gWarpTransition.isActive = FALSE;
|
||||
}
|
||||
|
||||
for (s32 i = 0; i < MAX_AREAS; i++) {
|
||||
if (gAreaData[i].unk04 != NULL) {
|
||||
geo_call_global_function_nodes(&gAreaData[i].unk04->node, GEO_CONTEXT_AREA_INIT);
|
||||
gAreaData[i].unk04 = NULL;
|
||||
if (gAreaData[i].root != NULL) {
|
||||
geo_call_global_function_nodes(&gAreaData[i].root->node, GEO_CONTEXT_AREA_INIT);
|
||||
gAreaData[i].root = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void load_area(s32 index) {
|
||||
if (gCurrentArea == NULL && gAreaData[index].unk04 != NULL) {
|
||||
if (gCurrentArea == NULL && gAreaData[index].root != NULL) {
|
||||
gCurrentArea = &gAreaData[index];
|
||||
gCurrentArea->localAreaTimer = 0;
|
||||
if (gCurrentArea->objectSpawnInfos) {
|
||||
|
|
@ -287,7 +287,7 @@ void load_area(s32 index) {
|
|||
}
|
||||
|
||||
load_obj_warp_nodes();
|
||||
geo_call_global_function_nodes(&gCurrentArea->unk04->node, GEO_CONTEXT_AREA_LOAD);
|
||||
geo_call_global_function_nodes(&gCurrentArea->root->node, GEO_CONTEXT_AREA_LOAD);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -301,7 +301,7 @@ void unload_area(void) {
|
|||
sync_objects_clear();
|
||||
if (gCurrentArea != NULL) {
|
||||
unload_objects_from_area(0, gCurrentArea->index);
|
||||
geo_call_global_function_nodes(&gCurrentArea->unk04->node, GEO_CONTEXT_AREA_UNLOAD);
|
||||
geo_call_global_function_nodes(&gCurrentArea->root->node, GEO_CONTEXT_AREA_UNLOAD);
|
||||
|
||||
gCurrentArea->flags = 0;
|
||||
gCurrentArea = NULL;
|
||||
|
|
@ -442,7 +442,7 @@ void play_transition_after_delay(s16 transType, s16 time, u8 red, u8 green, u8 b
|
|||
void render_game(void) {
|
||||
dynos_update_gfx();
|
||||
if (gCurrentArea != NULL && !gWarpTransition.pauseRendering) {
|
||||
geo_process_root(gCurrentArea->unk04, D_8032CE74, D_8032CE78, gFBSetColor);
|
||||
geo_process_root(gCurrentArea->root, D_8032CE74, D_8032CE78, gFBSetColor);
|
||||
|
||||
gSPViewport(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&D_8032CF00));
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ struct Area
|
|||
/*0x00*/ s8 index;
|
||||
/*0x01*/ s8 flags; // Only has 1 flag: 0x01 = Is this the active area?
|
||||
/*0x02*/ u16 terrainType; // default terrain of the level (set from level script cmd 0x31)
|
||||
/*0x04*/ struct GraphNodeRoot *unk04; // geometry layout data
|
||||
/*0x04*/ struct GraphNodeRoot *root; // geometry layout data
|
||||
/*0x08*/ s16 *terrainData; // collision data (set from level script cmd 0x2E)
|
||||
/*0x0C*/ s8 *surfaceRooms; // (set from level script cmd 0x2F)
|
||||
/*0x10*/ s16 *macroObjects; // Macro Objects Ptr (set from level script cmd 0x39)
|
||||
|
|
|
|||
|
|
@ -183,10 +183,10 @@ static struct LuaObjectField sAreaFields[LUA_AREA_FIELD_COUNT] = {
|
|||
{ "numSecrets", LVT_U8, offsetof(struct Area, numSecrets), false, LOT_NONE, 1, sizeof(u8) },
|
||||
{ "objectSpawnInfos", LVT_COBJECT_P, offsetof(struct Area, objectSpawnInfos), true, LOT_SPAWNINFO, 1, sizeof(struct SpawnInfo*) },
|
||||
{ "paintingWarpNodes", LVT_COBJECT_P, offsetof(struct Area, paintingWarpNodes), true, LOT_WARPNODE, 1, sizeof(struct WarpNode*) },
|
||||
{ "root", LVT_COBJECT_P, offsetof(struct Area, root), false, LOT_GRAPHNODEROOT, 1, sizeof(struct GraphNodeRoot*) },
|
||||
{ "surfaceRooms", LVT_S8_P, offsetof(struct Area, surfaceRooms), true, LOT_POINTER, 1, sizeof(s8*) },
|
||||
{ "terrainData", LVT_S16_P, offsetof(struct Area, terrainData), true, LOT_POINTER, 1, sizeof(s16*) },
|
||||
{ "terrainType", LVT_U16, offsetof(struct Area, terrainType), false, LOT_NONE, 1, sizeof(u16) },
|
||||
{ "root", LVT_COBJECT_P, offsetof(struct Area, unk04), false, LOT_GRAPHNODEROOT, 1, sizeof(struct GraphNodeRoot*) },
|
||||
// { "unused28", LVT_COBJECT_P, offsetof(struct Area, unused28), false, LOT_???, 1, sizeof(struct UnusedArea28*) }, <--- UNIMPLEMENTED
|
||||
{ "warpNodes", LVT_COBJECT_P, offsetof(struct Area, warpNodes), true, LOT_OBJECTWARPNODE, 1, sizeof(struct ObjectWarpNode*) },
|
||||
{ "whirlpools", LVT_COBJECT_P, offsetof(struct Area, whirlpools), false, LOT_WHIRLPOOL, 2, sizeof(struct Whirlpool*) },
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ void smlua_level_util_reset(void) {
|
|||
}
|
||||
|
||||
void smlua_level_util_change_area(s32 areaIndex) {
|
||||
if (areaIndex >= MIN_AREA_INDEX && areaIndex < MAX_AREAS && gAreas[areaIndex].unk04 != NULL) {
|
||||
if (areaIndex >= MIN_AREA_INDEX && areaIndex < MAX_AREAS && gAreas[areaIndex].root != NULL) {
|
||||
change_area(areaIndex);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ static struct Object* get_object_matching_respawn_info(s16* respawnInfo) {
|
|||
static void network_send_level_macro_area(struct NetworkPlayer* destNp, u8 areaIndex) {
|
||||
// check that the area is active
|
||||
struct Area* area = &gAreaData[areaIndex];
|
||||
if (area->unk04 == NULL) { return; }
|
||||
if (area->root == NULL) { return; }
|
||||
|
||||
if (destNp == NULL || !destNp->connected) {
|
||||
LOG_ERROR("network_send_level_macro: dest np is invalid");
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ static struct Object* get_object_matching_respawn_info(u32* respawnInfo) {
|
|||
static void network_send_level_spawn_info_area(struct NetworkPlayer* destNp, u8 areaIndex) {
|
||||
// check that the area is active
|
||||
struct Area* area = &gAreaData[areaIndex];
|
||||
if (area->unk04 == NULL) { return; }
|
||||
if (area->root == NULL) { return; }
|
||||
|
||||
if (destNp == NULL || !destNp->connected) {
|
||||
LOG_ERROR("network_send_level_spawn_info_area: dest np is invalid");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue