From bf0acb6cbec0a3580f21454a27cd935b97113487 Mon Sep 17 00:00:00 2001 From: Arceveti <73617174+Arceveti@users.noreply.github.com> Date: Mon, 20 Sep 2021 16:25:58 -0700 Subject: [PATCH] Name a bunch of stuff --- include/object_fields.h | 10 +- include/sm64.h | 75 +++++----- include/types.h | 51 +++++-- src/boot/main.c | 2 +- src/engine/geo_layout.c | 5 - src/engine/geo_layout.h | 7 - src/engine/graph_node.c | 4 +- src/engine/level_script.c | 6 +- src/game/area.c | 42 +++--- src/game/area.h | 4 +- src/game/behavior_actions.c | 11 +- .../behaviors/animated_floor_switch.inc.c | 6 +- src/game/behaviors/chuckya.inc.c | 18 +-- src/game/behaviors/eyerok.inc.c | 4 +- src/game/behaviors/fire_piranha_plant.inc.c | 7 +- .../lll_octagonal_rotating_mesh.inc.c | 117 +++++++++------ src/game/behaviors/metal_box.inc.c | 2 +- src/game/behaviors/mr_blizzard.inc.c | 19 ++- src/game/behaviors/purple_switch.inc.c | 2 +- src/game/behaviors/tox_box.inc.c | 24 ++-- src/game/behaviors/treasure_chest.inc.c | 2 +- src/game/behaviors/water_pillar.inc.c | 2 +- .../behaviors/water_splashes_and_waves.inc.c | 2 +- src/game/behaviors/wdw_water_level.inc.c | 2 +- src/game/debug.c | 11 +- src/game/envfx_bubbles.c | 3 - src/game/envfx_snow.c | 7 +- src/game/envfx_snow.h | 1 - src/game/interaction.c | 6 +- src/game/level_geo.h | 7 - src/game/level_update.c | 19 ++- src/game/level_update.h | 67 +++++---- src/game/macro_special_objects.c | 3 +- src/game/main.h | 26 ++-- src/game/mario.c | 39 +++-- src/game/mario_actions_airborne.c | 18 +-- src/game/mario_actions_automatic.c | 8 +- src/game/mario_actions_cutscene.c | 76 +++++----- src/game/mario_actions_cutscene.h | 2 +- src/game/mario_actions_moving.c | 16 +-- src/game/mario_actions_submerged.c | 4 +- src/game/mario_misc.c | 7 +- src/game/mario_step.c | 8 +- src/game/object_helpers.c | 34 ++--- src/game/object_helpers.h | 27 ++-- src/game/object_list_processor.c | 1 - src/game/object_list_processor.h | 1 - src/game/platform_displacement.c | 5 - src/game/rendering_graph_node.c | 4 +- src/game/rumble_init.c | 136 +++++++++--------- src/game/rumble_init.h | 8 +- src/goddard/gd_types.h | 86 +++++------ src/menu/file_select.c | 8 +- src/menu/intro_geo.c | 4 +- src/menu/star_select.c | 2 +- src/menu/title_screen.c | 4 +- 56 files changed, 541 insertions(+), 531 deletions(-) diff --git a/include/object_fields.h b/include/object_fields.h index 922abb14..3390c6a3 100644 --- a/include/object_fields.h +++ b/include/object_fields.h @@ -579,11 +579,11 @@ #define /*0x110*/ oHootMarioReleaseTime OBJECT_FIELD_S32(0x22) /* Horizontal Movement */ -#define /*0x0F4*/ oHorizontalMovementUnkF4 OBJECT_FIELD_S32(0x1B) -#define /*0x0F8*/ oHorizontalMovementUnkF8 OBJECT_FIELD_S32(0x1C) -#define /*0x100*/ oHorizontalMovementUnk100 OBJECT_FIELD_F32(0x1E) -#define /*0x104*/ oHorizontalMovementUnk104 OBJECT_FIELD_S32(0x1F) -#define /*0x108*/ oHorizontalMovementUnk108 OBJECT_FIELD_F32(0x20) +#define /*0x0F4*/ oLllOctMeshWaveTimer OBJECT_FIELD_S32(0x1B) +#define /*0x0F8*/ oLllOctMeshActionOffset OBJECT_FIELD_S32(0x1C) +#define /*0x100*/ oLllOctMeshWaveOffset1 OBJECT_FIELD_F32(0x1E) +#define /*0x104*/ oLllOctMeshStandTimer OBJECT_FIELD_S32(0x1F) +#define /*0x108*/ oLllOctMeshWaveOffset2 OBJECT_FIELD_F32(0x20) /* Kickable Board */ #define /*0x0F4*/ oKickableBoardF4 OBJECT_FIELD_S32(0x1B) diff --git a/include/sm64.h b/include/sm64.h index 44d6093a..c0c32b7d 100644 --- a/include/sm64.h +++ b/include/sm64.h @@ -89,22 +89,22 @@ #define LAYER_FIRST_NON_ZB (LAYER_ZB_LAST + 1) #define LAYER_LAST_ALL LAYER_TRANSPARENT_INTER -#define INPUT_NONZERO_ANALOG 0x0001 -#define INPUT_A_PRESSED 0x0002 -#define INPUT_OFF_FLOOR 0x0004 -#define INPUT_ABOVE_SLIDE 0x0008 -#define INPUT_FIRST_PERSON 0x0010 -#define INPUT_UNKNOWN_5 0x0020 -#define INPUT_SQUISHED 0x0040 -#define INPUT_A_DOWN 0x0080 -#define INPUT_IN_POISON_GAS 0x0100 -#define INPUT_IN_WATER 0x0200 -#define INPUT_STOMPED 0x0400 -#define INPUT_INTERACT_OBJ_GRABBABLE 0x0800 -#define INPUT_UNKNOWN_12 0x1000 -#define INPUT_B_PRESSED 0x2000 -#define INPUT_Z_DOWN 0x4000 -#define INPUT_Z_PRESSED 0x8000 +#define INPUT_NONZERO_ANALOG /* 0x0001 */ (1 << 0) +#define INPUT_A_PRESSED /* 0x0002 */ (1 << 1) +#define INPUT_OFF_FLOOR /* 0x0004 */ (1 << 2) +#define INPUT_ABOVE_SLIDE /* 0x0008 */ (1 << 3) +#define INPUT_FIRST_PERSON /* 0x0010 */ (1 << 4) +#define INPUT_UNKNOWN_5 /* 0x0020 */ (1 << 5) +#define INPUT_SQUISHED /* 0x0040 */ (1 << 6) +#define INPUT_A_DOWN /* 0x0080 */ (1 << 7) +#define INPUT_IN_POISON_GAS /* 0x0100 */ (1 << 8) +#define INPUT_IN_WATER /* 0x0200 */ (1 << 9) +#define INPUT_STOMPED /* 0x0400 */ (1 << 10) +#define INPUT_INTERACT_OBJ_GRABBABLE /* 0x0800 */ (1 << 11) +#define INPUT_UNKNOWN_12 /* 0x1000 */ (1 << 12) +#define INPUT_B_PRESSED /* 0x2000 */ (1 << 13) +#define INPUT_Z_DOWN /* 0x4000 */ (1 << 14) +#define INPUT_Z_PRESSED /* 0x8000 */ (1 << 15) #define GROUND_STEP_LEFT_GROUND 0 #define GROUND_STEP_NONE 1 @@ -150,28 +150,29 @@ #define PARTICLE_TRIANGLE /* 0x00040000 */ (1 << 18) #define PARTICLE_19 /* 0x00080000 */ (1 << 19) -#define MODEL_STATE_NOISE_ALPHA 0x180 -#define MODEL_STATE_METAL 0x200 +#define MODEL_STATE_ALPHA (1 << 8) // 0x100 +#define MODEL_STATE_NOISE_ALPHA ((1 << 7) | MODEL_STATE_ALPHA) // (0x080 | MODEL_STATE_ALPHA) +#define MODEL_STATE_METAL (1 << 9) // 0x200 -#define MARIO_NORMAL_CAP 0x00000001 -#define MARIO_VANISH_CAP 0x00000002 -#define MARIO_METAL_CAP 0x00000004 -#define MARIO_WING_CAP 0x00000008 -#define MARIO_CAP_ON_HEAD 0x00000010 -#define MARIO_CAP_IN_HAND 0x00000020 -#define MARIO_METAL_SHOCK 0x00000040 -#define MARIO_TELEPORTING 0x00000080 -#define MARIO_UNKNOWN_08 0x00000100 -#define MARIO_UNKNOWN_13 0x00002000 -#define MARIO_ACTION_SOUND_PLAYED 0x00010000 -#define MARIO_MARIO_SOUND_PLAYED 0x00020000 -#define MARIO_UNKNOWN_18 0x00040000 -#define MARIO_PUNCHING 0x00100000 -#define MARIO_KICKING 0x00200000 -#define MARIO_TRIPPING 0x00400000 -#define MARIO_UNKNOWN_25 0x02000000 -#define MARIO_UNKNOWN_30 0x40000000 -#define MARIO_UNKNOWN_31 0x80000000 +#define MARIO_NORMAL_CAP /* 0x00000001 */ (1 << 0) +#define MARIO_VANISH_CAP /* 0x00000002 */ (1 << 1) +#define MARIO_METAL_CAP /* 0x00000004 */ (1 << 2) +#define MARIO_WING_CAP /* 0x00000008 */ (1 << 3) +#define MARIO_CAP_ON_HEAD /* 0x00000010 */ (1 << 4) +#define MARIO_CAP_IN_HAND /* 0x00000020 */ (1 << 5) +#define MARIO_METAL_SHOCK /* 0x00000040 */ (1 << 6) +#define MARIO_TELEPORTING /* 0x00000080 */ (1 << 7) +#define MARIO_JUMPING /* 0x00000100 */ (1 << 8) +#define MARIO_NO_PURPLE_SWITCH /* 0x00002000 */ (1 << 13) +#define MARIO_ACTION_SOUND_PLAYED /* 0x00010000 */ (1 << 16) +#define MARIO_MARIO_SOUND_PLAYED /* 0x00020000 */ (1 << 17) +#define MARIO_FALL_SOUND_PLAYED /* 0x00040000 */ (1 << 18) +#define MARIO_PUNCHING /* 0x00100000 */ (1 << 20) +#define MARIO_KICKING /* 0x00200000 */ (1 << 21) +#define MARIO_TRIPPING /* 0x00400000 */ (1 << 22) +#define MARIO_LEDGE_CLIMB_CAMERA /* 0x02000000 */ (1 << 25) +#define MARIO_AIR_HIT_WALL /* 0x40000000 */ (1 << 30) +#define MARIO_PUSHING /* 0x80000000 */ (1 << 31) #define MARIO_SPECIAL_CAPS (MARIO_VANISH_CAP | MARIO_METAL_CAP | MARIO_WING_CAP) #define MARIO_CAPS (MARIO_NORMAL_CAP | MARIO_SPECIAL_CAPS) diff --git a/include/types.h b/include/types.h index b1219968..ca0094e9 100644 --- a/include/types.h +++ b/include/types.h @@ -44,13 +44,37 @@ struct Controller #endif }; +// -- Booleans -- + +typedef u8 Bool8; +typedef u16 Bool16; +typedef u32 Bool32; + +// -- Vectors -- + +typedef u8 Vec2uc[2]; +typedef s8 Vec2c[2]; +typedef s16 Vec2s[2]; +typedef s32 Vec2i[2]; typedef f32 Vec2f[2]; -typedef f32 Vec3f[3]; // X, Y, Z, where Y is up +typedef f64 Vec2d[2]; + +typedef u8 Vec3uc[3]; +typedef s8 Vec3c[3]; typedef s16 Vec3s[3]; typedef s32 Vec3i[3]; -typedef f32 Vec4f[4]; -typedef s16 Vec4s[4]; +typedef f32 Vec3f[3]; // X, Y, Z, where Y is up +typedef f64 Vec3d[3]; +typedef u8 Vec4uc[4]; +typedef s8 Vec4c[4]; +typedef s16 Vec4s[4]; +typedef s32 Vec4i[4]; +typedef f32 Vec4f[4]; +typedef f64 Vec4d[4]; + +typedef f32 Mat2[2][2]; +typedef f32 Mat3[3][3]; typedef f32 Mat4[4][4]; typedef uintptr_t GeoLayout; @@ -67,6 +91,13 @@ typedef COLLISION_DATA_TYPE TerrainData; typedef ROOM_DATA_TYPE RoomData; typedef TerrainData Vec3t[3]; +// -- Angle -- + +typedef s16 Angle; +typedef u16 UAngle; +typedef s32 Angle32; +typedef Angle Vec3a[3]; + enum SpTaskState { SPTASK_STATE_NOT_STARTED, SPTASK_STATE_RUNNING, @@ -91,12 +122,12 @@ struct VblankHandler #define ANIM_FLAG_NOLOOP (1 << 0) // 0x01 #define ANIM_FLAG_FORWARD (1 << 1) // 0x02 -#define ANIM_FLAG_2 (1 << 2) // 0x04 +#define ANIM_FLAG_NO_ACCEL (1 << 2) // 0x04 #define ANIM_FLAG_HOR_TRANS (1 << 3) // 0x08 #define ANIM_FLAG_VERT_TRANS (1 << 4) // 0x10 -#define ANIM_FLAG_5 (1 << 5) // 0x20 -#define ANIM_FLAG_6 (1 << 6) // 0x40 -#define ANIM_FLAG_7 (1 << 7) // 0x80 +#define ANIM_FLAG_DISABLED (1 << 5) // 0x20 +#define ANIM_FLAG_NO_TRANS (1 << 6) // 0x40 +#define ANIM_FLAG_UNUSED (1 << 7) // 0x80 struct Animation { /*0x00*/ s16 flags; @@ -295,7 +326,7 @@ struct MarioBodyState struct MarioState { - /*0x00*/ u16 unk00; + /*0x00*/ u16 playerID; /*0x02*/ u16 input; /*0x04*/ u32 flags; /*0x08*/ u32 particleFlags; @@ -345,7 +376,7 @@ struct MarioState /*0xAC*/ s8 numKeys; // Unused key mechanic /*0xAD*/ s8 numLives; /*0xAE*/ s16 health; - /*0xB0*/ s16 unkB0; + /*0xB0*/ s16 animYTrans; /*0xB2*/ u8 hurtCounter; /*0xB3*/ u8 healCounter; /*0xB4*/ u8 squishTimer; @@ -354,7 +385,7 @@ struct MarioState /*0xB8*/ s16 prevNumStarsForDialog; /*0xBC*/ f32 peakHeight; /*0xC0*/ f32 quicksandDepth; - /*0xC4*/ f32 unkC4; + /*0xC4*/ f32 windGravity; }; #endif // TYPES_H diff --git a/src/boot/main.c b/src/boot/main.c index 7cbabe21..02c0ecd6 100644 --- a/src/boot/main.c +++ b/src/boot/main.c @@ -28,7 +28,7 @@ #define MESG_START_GFX_SPTASK 103 #define MESG_NMI_REQUEST 104 -OSThread D_80339210; // unused? +OSThread gUnkThread; // unused? OSThread gIdleThread; OSThread gMainThread; OSThread gGameLoopThread; diff --git a/src/engine/geo_layout.c b/src/engine/geo_layout.c index c97081c3..7b179750 100644 --- a/src/engine/geo_layout.c +++ b/src/engine/geo_layout.c @@ -48,8 +48,6 @@ struct GraphNode gObjParentGraphNode; struct AllocOnlyPool *gGraphNodePool; struct GraphNode *gCurRootGraphNode; -UNUSED s32 D_8038BCA8; - /* The gGeoViews array is a mysterious one. Some background: * * If there are e.g. multiple Goombas, the multiple Goomba objects share one @@ -96,12 +94,9 @@ uintptr_t gGeoLayoutStack[16]; struct GraphNode *gCurGraphNodeList[32]; s16 gCurGraphNodeIndex; s16 gGeoLayoutStackIndex; // similar to SP register in MIPS -UNUSED s16 D_8038BD7C; s16 gGeoLayoutReturnIndex; // similar to RA register in MIPS u8 *gGeoLayoutCommand; -u32 unused_8038B894[3] = { 0 }; - /* 0x00: Branch and store return address cmd+0x04: void *branchTarget diff --git a/src/engine/geo_layout.h b/src/engine/geo_layout.h index a0818c61..9397f792 100644 --- a/src/engine/geo_layout.h +++ b/src/engine/geo_layout.h @@ -31,23 +31,16 @@ extern struct AllocOnlyPool *gGraphNodePool; extern struct GraphNode *gCurRootGraphNode; -extern UNUSED s32 D_8038BCA8; extern struct GraphNode **gGeoViews; extern u16 gGeoNumViews; extern uintptr_t gGeoLayoutStack[]; extern struct GraphNode *gCurGraphNodeList[]; extern s16 gCurGraphNodeIndex; extern s16 gGeoLayoutStackIndex; -extern UNUSED s16 D_8038BD7C; extern s16 gGeoLayoutReturnIndex; extern u8 *gGeoLayoutCommand; extern struct GraphNode gObjParentGraphNode; -extern struct AllocOnlyPool *D_8038BCA0; -extern struct GraphNode *D_8038BCA4; -extern s16 D_8038BD78; -extern struct GraphNode *D_8038BCF8[]; - void geo_layout_cmd_branch_and_link(void); void geo_layout_cmd_end(void); void geo_layout_cmd_branch(void); diff --git a/src/engine/graph_node.c b/src/engine/graph_node.c index a9889e9a..2f360ab5 100644 --- a/src/engine/graph_node.c +++ b/src/engine/graph_node.c @@ -741,7 +741,7 @@ void geo_obj_init_spawninfo(struct GraphNodeObject *graphNode, struct SpawnInfo graphNode->areaIndex = spawn->areaIndex; graphNode->activeAreaIndex = spawn->activeAreaIndex; - graphNode->sharedChild = spawn->unk18; + graphNode->sharedChild = spawn->modelNode; graphNode->unk4C = spawn; graphNode->throwMatrix = NULL; graphNode->animInfo.curAnim = 0; @@ -817,7 +817,7 @@ s16 geo_update_animation_frame(struct AnimInfo *obj, s32 *accelAssist) { anim = obj->curAnim; - if (obj->animTimer == gAreaUpdateCounter || anim->flags & ANIM_FLAG_2) { + if (obj->animTimer == gAreaUpdateCounter || anim->flags & ANIM_FLAG_NO_ACCEL) { if (accelAssist != NULL) { accelAssist[0] = obj->animFrameAccelAssist; } diff --git a/src/engine/level_script.c b/src/engine/level_script.c index 7940c50e..739e6756 100644 --- a/src/engine/level_script.c +++ b/src/engine/level_script.c @@ -397,7 +397,7 @@ static void level_cmd_begin_area(void) { sCurrAreaIndex = areaIndex; screenArea->areaIndex = areaIndex; - gAreas[areaIndex].unk04 = screenArea; + gAreas[areaIndex].graphNode = screenArea; if (node != NULL) { gAreas[areaIndex].camera = (struct Camera *) node->config.camera; @@ -468,7 +468,7 @@ static void level_cmd_init_mario(void) { gMarioSpawnInfo->areaIndex = 0; gMarioSpawnInfo->behaviorArg = CMD_GET(u32, 4); gMarioSpawnInfo->behaviorScript = CMD_GET(void *, 8); - gMarioSpawnInfo->unk18 = gLoadedGraphNodes[CMD_GET(ModelID, 0x2)]; + gMarioSpawnInfo->modelNode = gLoadedGraphNodes[CMD_GET(ModelID, 0x2)]; gMarioSpawnInfo->next = NULL; sCurrentCmd = CMD_NEXT; @@ -496,7 +496,7 @@ static void level_cmd_place_object(void) { spawnInfo->behaviorArg = CMD_GET(u32, 16); spawnInfo->behaviorScript = CMD_GET(void *, 20); - spawnInfo->unk18 = gLoadedGraphNodes[model]; + spawnInfo->modelNode = gLoadedGraphNodes[model]; spawnInfo->next = gAreas[sCurrAreaIndex].objectSpawnInfos; gAreas[sCurrAreaIndex].objectSpawnInfos = spawnInfo; diff --git a/src/game/area.c b/src/game/area.c index 1eaa2c66..f2baf989 100644 --- a/src/game/area.c +++ b/src/game/area.c @@ -44,8 +44,8 @@ struct GraphNode **gLoadedGraphNodes = gGraphNodePointers; struct Area *gAreas = gAreaData; struct Area *gCurrentArea = NULL; struct CreditsEntry *gCurrCreditsEntry = NULL; -Vp *D_8032CE74 = NULL; -Vp *D_8032CE78 = NULL; +Vp *gViewportOverride = NULL; +Vp *gViewportClip = NULL; s16 gWarpTransDelay = 0; u32 gFBSetColor = 0; u32 gWarpTransFBSetColor = 0; @@ -78,7 +78,7 @@ u8 sSpawnTypeFromWarpBhv[] = { MARIO_SPAWN_AIRBORNE_STAR_COLLECT, MARIO_SPAWN_AIRBORNE_DEATH, MARIO_SPAWN_LAUNCH_STAR_COLLECT, MARIO_SPAWN_LAUNCH_DEATH, }; -Vp D_8032CF00 = { { +Vp gViewport = { { { 640, 480, 511, 0 }, { 640, 480, 511, 0 }, } }; @@ -95,8 +95,8 @@ void override_viewport_and_clip(Vp *a, Vp *b, u8 c, u8 d, u8 e) { u16 sp6 = ((c >> 3) << 11) | ((d >> 3) << 6) | ((e >> 3) << 1) | 1; gFBSetColor = (sp6 << 16) | sp6; - D_8032CE74 = a; - D_8032CE78 = b; + gViewportOverride = a; + gViewportClip = b; } void set_warp_transition_rgb(u8 red, u8 green, u8 blue) { @@ -188,7 +188,7 @@ void clear_areas(void) { gAreaData[i].index = i; gAreaData[i].flags = 0; gAreaData[i].terrainType = 0; - gAreaData[i].unk04 = NULL; + gAreaData[i].graphNode = NULL; gAreaData[i].terrainData = NULL; gAreaData[i].surfaceRooms = NULL; gAreaData[i].macroObjects = NULL; @@ -211,21 +211,21 @@ void clear_area_graph_nodes(void) { s32 i; if (gCurrentArea != NULL) { - geo_call_global_function_nodes(&gCurrentArea->unk04->node, GEO_CONTEXT_AREA_UNLOAD); + geo_call_global_function_nodes(&gCurrentArea->graphNode->node, GEO_CONTEXT_AREA_UNLOAD); gCurrentArea = NULL; gWarpTransition.isActive = FALSE; } for (i = 0; i < 8; 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].graphNode != NULL) { + geo_call_global_function_nodes(&gAreaData[i].graphNode->node, GEO_CONTEXT_AREA_INIT); + gAreaData[i].graphNode = NULL; } } } void load_area(s32 index) { - if (gCurrentArea == NULL && gAreaData[index].unk04 != NULL) { + if (gCurrentArea == NULL && gAreaData[index].graphNode != NULL) { gCurrentArea = &gAreaData[index]; gCurrAreaIndex = gCurrentArea->index; @@ -239,14 +239,14 @@ 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->graphNode->node, GEO_CONTEXT_AREA_LOAD); } } void unload_area(void) { 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->graphNode->node, GEO_CONTEXT_AREA_UNLOAD); gCurrentArea->flags = 0; gCurrentArea = NULL; @@ -370,9 +370,9 @@ void play_transition_after_delay(s16 transType, s16 time, u8 red, u8 green, u8 b void render_game(void) { if (gCurrentArea != NULL && !gWarpTransition.pauseRendering) { - geo_process_root(gCurrentArea->unk04, D_8032CE74, D_8032CE78, gFBSetColor); + geo_process_root(gCurrentArea->graphNode, gViewportOverride, gViewportClip, gFBSetColor); - gSPViewport(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&D_8032CF00)); + gSPViewport(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gViewport)); gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, gBorderHeight, SCREEN_WIDTH, SCREEN_HEIGHT - gBorderHeight); @@ -390,8 +390,8 @@ void render_game(void) { gSaveOptSelectIndex = gMenuOptSelectIndex; } - if (D_8032CE78 != NULL) { - make_viewport_clip_rect(D_8032CE78); + if (gViewportClip != NULL) { + make_viewport_clip_rect(gViewportClip); } else gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, gBorderHeight, SCREEN_WIDTH, SCREEN_HEIGHT - gBorderHeight); @@ -413,8 +413,8 @@ void render_game(void) { } } else { render_text_labels(); - if (D_8032CE78 != NULL) { - clear_viewport(D_8032CE78, gWarpTransFBSetColor); + if (gViewportClip != NULL) { + clear_viewport(gViewportClip, gWarpTransFBSetColor); } else { clear_frame_buffer(gWarpTransFBSetColor); } @@ -425,6 +425,6 @@ void render_game(void) { puppyprint_render_profiler(); #endif - D_8032CE74 = NULL; - D_8032CE78 = NULL; + gViewportOverride = NULL; + gViewportClip = NULL; } diff --git a/src/game/area.h b/src/game/area.h index 262a5f1a..c8f073c4 100644 --- a/src/game/area.h +++ b/src/game/area.h @@ -41,7 +41,7 @@ struct SpawnInfo /*0x0D*/ s8 activeAreaIndex; /*0x10*/ u32 behaviorArg; /*0x14*/ void *behaviorScript; - /*0x18*/ struct GraphNode *unk18; + /*0x18*/ struct GraphNode *modelNode; /*0x1C*/ struct SpawnInfo *next; }; @@ -65,7 +65,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 *graphNode; // 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) diff --git a/src/game/behavior_actions.c b/src/game/behavior_actions.c index 7ae7ffec..4a4cb087 100644 --- a/src/game/behavior_actions.c +++ b/src/game/behavior_actions.c @@ -180,18 +180,19 @@ Gfx *geo_move_mario_part_from_parent(s32 run, UNUSED struct GraphNode *node, Mat #include "behaviors/jumping_box.inc.c" #include "behaviors/boo_cage.inc.c" +static s16 sSpawnSparkleParticleAngle = 0x0; + // not in behavior file // n is the number of objects to spawn, r if the rate of change of phase (frequency?) -void spawn_sparkle_particles(s32 n, s32 a1, s32 a2, s32 r) { - static s16 D_8035FF10; +void spawn_sparkle_particles(s32 n, s32 radius, s32 height, s32 r) { s32 i; s16 separation = 0x10000 / n; // Evenly spread around a circle for (i = 0; i < n; i++) { - spawn_object_relative(0, sins(D_8035FF10 + i * separation) * a1, (i + 1) * a2, - coss(D_8035FF10 + i * separation) * a1, o, MODEL_NONE, bhvSparkleSpawn); + spawn_object_relative(0, sins(sSpawnSparkleParticleAngle + i * separation) * radius, (i + 1) * height, + coss(sSpawnSparkleParticleAngle + i * separation) * radius, o, MODEL_NONE, bhvSparkleSpawn); } - D_8035FF10 += r * 0x100; + sSpawnSparkleParticleAngle += r * 0x100; } #include "behaviors/beta_boo_key.inc.c" diff --git a/src/game/behaviors/animated_floor_switch.inc.c b/src/game/behaviors/animated_floor_switch.inc.c index 853bc8fc..49f5392c 100644 --- a/src/game/behaviors/animated_floor_switch.inc.c +++ b/src/game/behaviors/animated_floor_switch.inc.c @@ -2,7 +2,7 @@ struct FloorSwitchTriggeredAnimationFrame { const void *collisionDataPtr; - s16 model; + ModelID model; }; struct FloorSwitchTriggeredAnimationFrame sFloorSwitchTriggeredAnimationFrames[][5] = { @@ -29,7 +29,7 @@ struct FloorSwitchTriggeredAnimationFrame sFloorSwitchTriggeredAnimationFrames[] }, }; -s16 D_80331ACC[] = { 250, 200, 200 }; +s16 sAnimatesOnFloorSwitchPressTimers[] = { 250, 200, 200 }; void bhv_animates_on_floor_switch_press_init(void) { o->parentObj = cur_obj_nearest_object_with_behavior(bhvFloorSwitchAnimatesObject); @@ -42,7 +42,7 @@ void bhv_animates_on_floor_switch_press_loop(void) { } if (o->oFloorSwitchPressAnimationUnkFC != 0) { - o->oFloorSwitchPressAnimationUnkF4 = D_80331ACC[o->oBehParams2ndByte]; + o->oFloorSwitchPressAnimationUnkF4 = sAnimatesOnFloorSwitchPressTimers[o->oBehParams2ndByte]; } else { o->oFloorSwitchPressAnimationUnkF4 = 0; } diff --git a/src/game/behaviors/chuckya.inc.c b/src/game/behaviors/chuckya.inc.c index d9f0f4e3..a4e5eb0a 100644 --- a/src/game/behaviors/chuckya.inc.c +++ b/src/game/behaviors/chuckya.inc.c @@ -67,15 +67,15 @@ s32 unknown_chuckya_function(s32 sp20, f32 sp24, f32 sp28, s32 sp2C) { return sp1C; } -s32 approach_forward_vel(f32 *arr, f32 spC, f32 sp10) { - if (arr[0] > spC) { - arr[0] -= sp10; - if (arr[0] < spC) - arr[0] = spC; - } else if (arr[0] < spC) { - arr[0] += sp10; - if (arr[0] > spC) - arr[0] = spC; +s32 approach_forward_vel(f32 *arr, f32 target, f32 inc) { + if (arr[0] > target) { + arr[0] -= inc; + if (arr[0] < target) + arr[0] = target; + } else if (arr[0] < target) { + arr[0] += inc; + if (arr[0] > target) + arr[0] = target; } else { return TRUE; } diff --git a/src/game/behaviors/eyerok.inc.c b/src/game/behaviors/eyerok.inc.c index 17e77a86..46d750b1 100644 --- a/src/game/behaviors/eyerok.inc.c +++ b/src/game/behaviors/eyerok.inc.c @@ -10,7 +10,7 @@ struct ObjectHitbox sEyerokHitbox = { /* hurtboxHeight: */ 1, }; -s8 D_80331BA4[] = { 0, 1, 3, 2, 1, 0 }; +s8 sEyerokAnimStatesList[] = { 0, 1, 3, 2, 1, 0 }; static s32 eyerok_check_mario_relative_z(s32 arg0) { if (gMarioObject->oPosZ - o->oHomeZ < arg0) { @@ -277,7 +277,7 @@ static void eyerok_hand_act_show_eye(void) { if (o->oEyerokHandUnkFC != 0) { o->oEyerokHandUnkFC -= 1; } - o->oAnimState = D_80331BA4[o->oEyerokHandUnkFC]; + o->oAnimState = sEyerokAnimStatesList[o->oEyerokHandUnkFC]; } else { o->oEyerokHandUnkFC = 5; o->oEyerokHandUnk100 = random_linear_offset(20, 50); diff --git a/src/game/behaviors/fire_piranha_plant.inc.c b/src/game/behaviors/fire_piranha_plant.inc.c index c4b1bc56..19df9db0 100644 --- a/src/game/behaviors/fire_piranha_plant.inc.c +++ b/src/game/behaviors/fire_piranha_plant.inc.c @@ -10,11 +10,6 @@ struct ObjectHitbox sFirePiranhaPlantHitbox = { /* hurtboxHeight: */ 150, }; -f32 D_80331B5C[] = { - 0.5f, - 2.0f, -}; - struct ObjectHitbox sPiranhaPlantFireHitbox = { /* interactType: */ INTERACT_FLAME, /* downOffset: */ 10, @@ -31,7 +26,7 @@ s32 sNumActiveFirePiranhaPlants; s32 sNumKilledFirePiranhaPlants; void bhv_fire_piranha_plant_init(void) { - o->oFirePiranhaPlantNeutralScale = D_80331B5C[(u16)(o->oBehParams >> 16)]; + o->oFirePiranhaPlantNeutralScale = (((u16)(o->oBehParams >> 16)) ? 2.0f : 0.5f); obj_set_hitbox(o, &sFirePiranhaPlantHitbox); if ((u16)(o->oBehParams >> 16) != 0) { diff --git a/src/game/behaviors/lll_octagonal_rotating_mesh.inc.c b/src/game/behaviors/lll_octagonal_rotating_mesh.inc.c index 7fc4936f..195d41e0 100644 --- a/src/game/behaviors/lll_octagonal_rotating_mesh.inc.c +++ b/src/game/behaviors/lll_octagonal_rotating_mesh.inc.c @@ -1,59 +1,96 @@ // lll_octagonal_rotating_mesh.c.inc -s16 D_8032F860[] = { 2, 30, 0x4000, 0, 1, 220, 900, 30, 1, 30, 0, -30, 2, - 30, -0x4000, 0, 1, 220, 900, 30, 1, 30, 0, -30, 3, 0 }; -s16 D_8032F894[] = { 4, 0, 0, 0, 1, 475, 900, 30, 1, 30, 0, -30, 2, - 30, 0x8000, 0, 1, 475, 900, 30, 1, 30, 0, -30, 3, 0 }; -s16 *D_8032F8C8[] = { D_8032F860, D_8032F894 }; +enum { + LLL_OCTMESH_CHANGE_DIR = 1, // 1 + LLL_OCTMESH_LINEAR_MOVE, // 2 + LLL_OCTMESH_RESET, // 3 + LLL_OCTMESH_WAIT_FOR_MARIO // 4 +}; +//! Note: useless zero at the reset instruction, there's no accesses beyond that anyway -s32 lll_octagonal_mesh_move(s16 *a0, s32 a1) { - switch (a0[a1]) { - case 4: - o->oMoveAngleYaw = a0[a1 + 2]; - o->oForwardVel = a0[a1 + 3] / 100.0f; +struct LllOctagonalMeshAction { + s16 instruction; + s16 time; + Angle moveAngle; + s16 forwardVel; +}; + +// Path for big bullies platforms +static struct LllOctagonalMeshAction gLllOctagonalMeshAction0[] = { + // instruction time moveAngle forwardVel + { LLL_OCTMESH_LINEAR_MOVE, 30, 0x4000, 0 }, // 90 degrees + { LLL_OCTMESH_CHANGE_DIR, 220, 900, 30 }, + { LLL_OCTMESH_CHANGE_DIR, 30, 0, -30 }, + { LLL_OCTMESH_LINEAR_MOVE, 30, -0x4000, 0 }, // 90 degrees + { LLL_OCTMESH_CHANGE_DIR, 220, 900, 30 }, + { LLL_OCTMESH_CHANGE_DIR, 30, 0, -30 }, + { LLL_OCTMESH_RESET, 0, 0, 0 } +}; + +// Path for rolling log +static struct LllOctagonalMeshAction gLllOctagonalMeshAction1[] = { + // instruction time moveAngle forwardVel + { LLL_OCTMESH_WAIT_FOR_MARIO, 0, 0, 0 }, + { LLL_OCTMESH_CHANGE_DIR, 475, 900, 30 }, + { LLL_OCTMESH_CHANGE_DIR, 30, 0, -30 }, + { LLL_OCTMESH_LINEAR_MOVE, 30, 0x8000, 0 }, // 180 degrees + { LLL_OCTMESH_CHANGE_DIR, 475, 900, 30 }, + { LLL_OCTMESH_CHANGE_DIR, 30, 0, -30 }, + { LLL_OCTMESH_RESET, 0, 0, 0 } +}; + +// picked by oBehParams2ndByte +static struct LllOctagonalMeshAction *gLllOctagonalMeshActionList[] = { gLllOctagonalMeshAction0, gLllOctagonalMeshAction1 }; + +s32 lll_octagonal_mesh_move(struct LllOctagonalMeshAction *actionTable, s32 actionOffset) { + struct LllOctagonalMeshAction *action = &(actionTable[actionOffset]); + switch (action->instruction) { + case LLL_OCTMESH_WAIT_FOR_MARIO: + o->oMoveAngleYaw = action->moveAngle; + o->oForwardVel = action->forwardVel / 100.0f; if (cur_obj_is_mario_on_platform()) { - a1 += 4; + actionOffset += 4; o->oTimer = 0; } break; - case 2: - o->oMoveAngleYaw = a0[a1 + 2]; - o->oForwardVel = a0[a1 + 3] / 100.0f; - if (o->oTimer > a0[a1 + 1]) { - a1 += 4; + case LLL_OCTMESH_LINEAR_MOVE: + o->oMoveAngleYaw = action->moveAngle; + o->oForwardVel = action->forwardVel / 100.0f; + if (o->oTimer > action->time) { + actionOffset += 4; o->oTimer = 0; } break; - case 1: - approach_f32_signed(&o->oForwardVel, a0[a1 + 2] / 100.0f, a0[a1 + 3] / 100.0f); - if (o->oTimer > a0[a1 + 1]) { - a1 += 4; + case LLL_OCTMESH_CHANGE_DIR: + approach_f32_signed(&o->oForwardVel, action->moveAngle / 100.0f, action->forwardVel / 100.0f); + if (o->oTimer > action->time) { + actionOffset += 4; o->oTimer = 0; } break; - case 3: + case LLL_OCTMESH_RESET: o->oForwardVel = 0.0f; - a1 = 0; + actionOffset = 0; break; } - return a1; + return actionOffset; } -s32 lll_octagonal_mesh_find_y_offset(s32 *a0, f32 *a1, s32 a2, s32 a3) { +s32 lll_octagonal_mesh_find_y_offset(s32 *standTimer, f32 *posOffset, s32 standTimerInc, s32 moveDownAmount) { if (cur_obj_is_mario_on_platform()) { - if (a0[0] < 0x4000) - a0[0] += a2; + if (standTimer[0] < 0x4000) + standTimer[0] += standTimerInc; else - a0[0] = 0x4000; + standTimer[0] = 0x4000; } else { - if (a0[0] > 0) - a0[0] -= a2; + if (standTimer[0] > 0) + standTimer[0] -= standTimerInc; else - a0[0] = 0; + standTimer[0] = 0; } - a1[0] = sins(a0[0]) * a3; - if (a0[0] == 0 || a0[0] == 0x4000) + posOffset[0] = sins(standTimer[0]) * moveDownAmount; + if (standTimer[0] == 0 || standTimer[0] == 0x4000) return 1; else return 0; @@ -61,16 +98,16 @@ s32 lll_octagonal_mesh_find_y_offset(s32 *a0, f32 *a1, s32 a2, s32 a3) { void bhv_lll_moving_octagonal_mesh_platform_loop(void) { if (o->oAction == 0) { - o->oHorizontalMovementUnkF8 = 0; + o->oLllOctMeshActionOffset = 0; o->oAction++; } else - o->oHorizontalMovementUnkF8 = - lll_octagonal_mesh_move(D_8032F8C8[o->oBehParams2ndByte], o->oHorizontalMovementUnkF8); - print_debug_top_down_objectinfo("number %d\n", o->oHorizontalMovementUnkF8); + o->oLllOctMeshActionOffset = + lll_octagonal_mesh_move(gLllOctagonalMeshActionList[o->oBehParams2ndByte], o->oLllOctMeshActionOffset); + print_debug_top_down_objectinfo("number %d\n", o->oLllOctMeshActionOffset); cur_obj_move_using_fvel_and_gravity(); - if (lll_octagonal_mesh_find_y_offset(&o->oHorizontalMovementUnk104, &o->oHorizontalMovementUnk108, 0x400, -80)) { - o->oHorizontalMovementUnkF4 += 0x800; - o->oHorizontalMovementUnk100 -= sins(o->oHorizontalMovementUnkF4) * 2; + if (lll_octagonal_mesh_find_y_offset(&o->oLllOctMeshStandTimer, &o->oLllOctMeshWaveOffset2, 0x400, -80)) { + o->oLllOctMeshWaveTimer += 0x800; + o->oLllOctMeshWaveOffset1 -= sins(o->oLllOctMeshWaveTimer) * 2; } - o->oPosY = o->oHorizontalMovementUnk100 + o->oHomeY + o->oHorizontalMovementUnk108; + o->oPosY = o->oLllOctMeshWaveOffset1 + o->oHomeY + o->oLllOctMeshWaveOffset2; } diff --git a/src/game/behaviors/metal_box.inc.c b/src/game/behaviors/metal_box.inc.c index b839c708..fc9731a1 100644 --- a/src/game/behaviors/metal_box.inc.c +++ b/src/game/behaviors/metal_box.inc.c @@ -28,7 +28,7 @@ void bhv_pushable_loop(void) { s16 angleToMario; obj_set_hitbox(o, &sMetalBoxHitbox); o->oForwardVel = 0.0f; - if (obj_check_if_collided_with_object(o, gMarioObject) && gMarioStates[0].flags & MARIO_UNKNOWN_31) { + if (obj_check_if_collided_with_object(o, gMarioObject) && gMarioStates[0].flags & MARIO_PUSHING) { angleToMario = obj_angle_to_object(o, gMarioObject); if (abs_angle_diff(angleToMario, gMarioObject->oMoveAngleYaw) > 0x4000) { o->oMoveAngleYaw = (s16)((gMarioObject->oMoveAngleYaw + 0x2000) & 0xc000); diff --git a/src/game/behaviors/mr_blizzard.inc.c b/src/game/behaviors/mr_blizzard.inc.c index c8630a69..c761d34e 100644 --- a/src/game/behaviors/mr_blizzard.inc.c +++ b/src/game/behaviors/mr_blizzard.inc.c @@ -11,10 +11,7 @@ struct ObjectHitbox sMrBlizzardHitbox = { /* hurtboxHeight: */ 170, }; -// Mr. Blizzard particle spawner. -void mr_blizzard_spawn_white_particles(s8 count, s8 offsetY, s8 forwardVelBase, s8 velYBase, - s8 sizeBase) { - static struct SpawnParticlesInfo D_80331A00 = { +static struct SpawnParticlesInfo sMrBlizzardParticlesInfo = { /* behParam: */ 0, /* count: */ 6, /* model: */ MODEL_WHITE_PARTICLE, @@ -29,12 +26,14 @@ void mr_blizzard_spawn_white_particles(s8 count, s8 offsetY, s8 forwardVelBase, /* sizeRange: */ 5.0f, }; - D_80331A00.count = count; - D_80331A00.offsetY = offsetY; - D_80331A00.forwardVelBase = forwardVelBase; - D_80331A00.velYBase = velYBase; - D_80331A00.sizeBase = sizeBase; - cur_obj_spawn_particles(&D_80331A00); +// Mr. Blizzard particle spawner. +void mr_blizzard_spawn_white_particles(s8 count, s8 offsetY, s8 forwardVelBase, s8 velYBase, s8 sizeBase) { + sMrBlizzardParticlesInfo.count = count; + sMrBlizzardParticlesInfo.offsetY = offsetY; + sMrBlizzardParticlesInfo.forwardVelBase = forwardVelBase; + sMrBlizzardParticlesInfo.velYBase = velYBase; + sMrBlizzardParticlesInfo.sizeBase = sizeBase; + cur_obj_spawn_particles(&sMrBlizzardParticlesInfo); } /** diff --git a/src/game/behaviors/purple_switch.inc.c b/src/game/behaviors/purple_switch.inc.c index a90483aa..0a548b87 100644 --- a/src/game/behaviors/purple_switch.inc.c +++ b/src/game/behaviors/purple_switch.inc.c @@ -16,7 +16,7 @@ void bhv_purple_switch_loop(void) { case PURPLE_SWITCH_IDLE: cur_obj_set_model(MODEL_PURPLE_SWITCH); cur_obj_scale(1.5f); - if (gMarioObject->platform == o && !(gMarioStates[0].action & MARIO_UNKNOWN_13)) { + if (gMarioObject->platform == o && !(gMarioStates[0].action & MARIO_NO_PURPLE_SWITCH)) { if (lateral_dist_between_objects(o, gMarioObject) < 127.5) { o->oAction = PURPLE_SWITCH_PRESSED; } diff --git a/src/game/behaviors/tox_box.inc.c b/src/game/behaviors/tox_box.inc.c index 1b50d26e..1055c1e7 100644 --- a/src/game/behaviors/tox_box.inc.c +++ b/src/game/behaviors/tox_box.inc.c @@ -1,20 +1,20 @@ // tox_box.c.inc -s8 D_8032F8F0[] = { 4, 1, 4, 1, 6, 1, 6, 1, 5, 1, 5, 1, 6, 1, 6, 1, 5, 1, 2, 4, 1, 4, 1, 4, 1, 2, - 5, 1, 5, 1, 7, 1, 7, 1, 4, 1, 4, 1, 7, 1, 7, 1, 5, 1, 5, 1, 5, 1, 2, 4, 1, -1 }; -s8 D_8032F924[] = { 4, 1, 4, 1, 7, 1, 7, 1, 7, 1, 2, 6, 1, 6, 1, 6, 1, 5, - 1, 5, 1, 6, 1, 5, 1, 5, 1, 2, 4, 1, 4, 1, 7, 1, -1 }; -s8 D_8032F948[] = { 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 2, 5, 1, 5, 1, 5, 1, 5, - 1, 5, 1, 7, 1, 2, 6, 1, 6, 1, 5, 1, 2, 4, 1, 7, 1, -1 }; -s8 *D_8032F96C[] = { D_8032F8F0, D_8032F924, D_8032F948 }; +s8 sToxBoxDirectionPattern1[] = { 4, 1, 4, 1, 6, 1, 6, 1, 5, 1, 5, 1, 6, 1, 6, 1, 5, 1, 2, 4, 1, 4, 1, 4, 1, 2, + 5, 1, 5, 1, 7, 1, 7, 1, 4, 1, 4, 1, 7, 1, 7, 1, 5, 1, 5, 1, 5, 1, 2, 4, 1, -1 }; +s8 sToxBoxDirectionPattern2[] = { 4, 1, 4, 1, 7, 1, 7, 1, 7, 1, 2, 6, 1, 6, 1, 6, 1, 5, + 1, 5, 1, 6, 1, 5, 1, 5, 1, 2, 4, 1, 4, 1, 7, 1, -1 }; +s8 sToxBoxDirectionPattern3[] = { 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 2, 5, 1, 5, 1, 5, 1, 5, + 1, 5, 1, 7, 1, 2, 6, 1, 6, 1, 5, 1, 2, 4, 1, 7, 1, -1 }; +s8 *sToxBoxDirectionPatterns[] = { sToxBoxDirectionPattern1, sToxBoxDirectionPattern2, sToxBoxDirectionPattern3 }; void tox_box_shake_screen(void) { - if (o->oDistanceToMario < 3000.0f) + if (o->oDistanceToMario < 3000.0f) { cur_obj_shake_screen(SHAKE_POS_SMALL); + } } -void tox_box_move(f32 forwardVel, f32 a1, s16 deltaPitch, s16 deltaRoll) -{ +void tox_box_move(f32 forwardVel, f32 a1, s16 deltaPitch, s16 deltaRoll) { o->oPosY = 99.41124 * sins((f32)(o->oTimer + 1) / 8 * 0x8000) + o->oHomeY + 3.0f; o->oForwardVel = forwardVel; o->oUpVel = a1; @@ -66,8 +66,8 @@ void tox_box_act_3(void) { } void tox_box_act_0(void) { - s8 *sp1C = D_8032F96C[o->oBehParams2ndByte]; - o->oAction = cur_obj_set_direction_table(sp1C); + s8 *pattern = sToxBoxDirectionPatterns[o->oBehParams2ndByte]; + o->oAction = cur_obj_set_direction_table(pattern); } void (*sToxBoxActions[])(void) = { tox_box_act_0, tox_box_act_1, tox_box_act_2, tox_box_act_3, diff --git a/src/game/behaviors/treasure_chest.inc.c b/src/game/behaviors/treasure_chest.inc.c index de38ca81..afc718e6 100644 --- a/src/game/behaviors/treasure_chest.inc.c +++ b/src/game/behaviors/treasure_chest.inc.c @@ -137,7 +137,7 @@ void bhv_treasure_chest_ship_loop(void) { o->activeFlags = ACTIVE_FLAG_DEACTIVATED; } #if ENABLE_RUMBLE - reset_rumble_timers_2(2); + reset_rumble_timers_vibrate(2); #endif } break; diff --git a/src/game/behaviors/water_pillar.inc.c b/src/game/behaviors/water_pillar.inc.c index bd414724..c537e977 100644 --- a/src/game/behaviors/water_pillar.inc.c +++ b/src/game/behaviors/water_pillar.inc.c @@ -41,7 +41,7 @@ void water_level_pillar_undrained(void) { gEnvironmentLevels[0] = (s32) approach_f32_symmetric(gEnvironmentLevels[0], -2450.0f, 5.0f); #if ENABLE_RUMBLE - reset_rumble_timers_2(2); + reset_rumble_timers_vibrate(2); #endif } else o->oAction++; diff --git a/src/game/behaviors/water_splashes_and_waves.inc.c b/src/game/behaviors/water_splashes_and_waves.inc.c index de512d51..8c328772 100644 --- a/src/game/behaviors/water_splashes_and_waves.inc.c +++ b/src/game/behaviors/water_splashes_and_waves.inc.c @@ -35,7 +35,7 @@ struct WaterDropletParams sWaterDropletFishParams = { // Water droplets from Mario running in shallow water. struct WaterDropletParams gShallowWaterWaveDropletParams = { - /* Flags */ WATER_DROPLET_FLAG_RAND_ANGLE_INCR_PLUS_8000 | WATER_DROPLET_FLAG_RAND_ANGLE | WATER_DROPLET_FLAG_SET_Y_TO_WATER_LEVEL, + /* Flags */ WATER_DROPLET_FLAG_RAND_ANGLE_INCR_BACKWARD | WATER_DROPLET_FLAG_RAND_ANGLE | WATER_DROPLET_FLAG_SET_Y_TO_WATER_LEVEL, /* Model */ MODEL_WHITE_PARTICLE_SMALL, /* Behavior */ bhvWaterDroplet, /* Move angle range */ 0x6000, diff --git a/src/game/behaviors/wdw_water_level.inc.c b/src/game/behaviors/wdw_water_level.inc.c index c077ee2c..54469211 100644 --- a/src/game/behaviors/wdw_water_level.inc.c +++ b/src/game/behaviors/wdw_water_level.inc.c @@ -50,7 +50,7 @@ void bhv_water_level_diamond_loop(void) { } o->oAngleVelYaw = 0x800; #if ENABLE_RUMBLE - reset_rumble_timers_2(2); + reset_rumble_timers_vibrate(2); #endif } break; diff --git a/src/game/debug.c b/src/game/debug.c index 27a57710..d8d32dda 100644 --- a/src/game/debug.c +++ b/src/game/debug.c @@ -324,7 +324,6 @@ void reset_debug_objectinfo(void) { gUnknownWallCount = 0; gObjectCounter = 0; sDebugStringArrPrinted = FALSE; - D_8035FEE2 = 0; gDoorRenderingTimer = 0; set_print_state_info(gDebugPrintState1, 20, 185, 40, 200, -15); @@ -396,15 +395,15 @@ UNUSED static void try_change_debug_page(void) { UNUSED static #endif void try_modify_debug_controls(void) { - s32 sp4; + s32 modifier; if (gPlayer1Controller->buttonPressed & Z_TRIG) { sNoExtraDebug ^= 1; } if (!(gPlayer1Controller->buttonDown & (L_TRIG | R_TRIG)) && !sNoExtraDebug) { - sp4 = 1; + modifier = 1; if (gPlayer1Controller->buttonDown & B_BUTTON) { - sp4 = 100; + modifier = 100; } if (sDebugInfoDPadMask & U_JPAD) { @@ -429,12 +428,12 @@ void try_modify_debug_controls(void) { gDebugInfo[sDebugPage][sDebugSysCursor] = gDebugInfoOverwrite[sDebugPage][sDebugSysCursor]; } else { - gDebugInfo[sDebugPage][sDebugSysCursor] = gDebugInfo[sDebugPage][sDebugSysCursor] - sp4; + gDebugInfo[sDebugPage][sDebugSysCursor] = gDebugInfo[sDebugPage][sDebugSysCursor] - modifier; } } if (sDebugInfoDPadMask & R_JPAD) { - gDebugInfo[sDebugPage][sDebugSysCursor] = gDebugInfo[sDebugPage][sDebugSysCursor] + sp4; + gDebugInfo[sDebugPage][sDebugSysCursor] = gDebugInfo[sDebugPage][sDebugSysCursor] + modifier; } } } diff --git a/src/game/envfx_bubbles.c b/src/game/envfx_bubbles.c index b6b7020a..b313f9f2 100644 --- a/src/game/envfx_bubbles.c +++ b/src/game/envfx_bubbles.c @@ -25,9 +25,6 @@ static Gfx *sGfxCursor; // points to end of display list for bubble particles static s32 sBubbleParticleCount; static s32 sBubbleParticleMaxCount; -UNUSED s32 D_80330690 = 0; -UNUSED s32 D_80330694 = 0; - /// Template for a bubble particle triangle Vtx_t gBubbleTempVtx[3] = { { { 0, 0, 0 }, 0, { 1544, 964 }, { 0xFF, 0xFF, 0xFF, 0xFF } }, diff --git a/src/game/envfx_snow.c b/src/game/envfx_snow.c index 5686da78..11cc0945 100644 --- a/src/game/envfx_snow.c +++ b/src/game/envfx_snow.c @@ -39,12 +39,11 @@ s16 gSnowParticleMaxCount; /* DATA */ s8 gEnvFxMode = 0; -UNUSED s32 D_80330644 = 0; /// Template for a snow particle triangle -Vtx gSnowTempVtx[3] = { { { { -5, 5, 0 }, 0, { 0, 0 }, { 0x7F, 0x7F, 0x7F, 0xFF } } }, - { { { -5, -5, 0 }, 0, { 0, 960 }, { 0x7F, 0x7F, 0x7F, 0xFF } } }, - { { { 5, 5, 0 }, 0, { 960, 0 }, { 0x7F, 0x7F, 0x7F, 0xFF } } } }; +Vtx gSnowTempVtx[3] = { { { { -5, 5, 0 }, 0, { 0, 0 }, { 0x7F, 0x7F, 0x7F, 0xFF } } }, + { { { -5, -5, 0 }, 0, { 0, 960 }, { 0x7F, 0x7F, 0x7F, 0xFF } } }, + { { { 5, 5, 0 }, 0, { 960, 0 }, { 0x7F, 0x7F, 0x7F, 0xFF } } } }; // Change these to make snowflakes smaller or bigger struct SnowFlakeVertex gSnowFlakeVertex1 = { -5, 5, 0 }; diff --git a/src/game/envfx_snow.h b/src/game/envfx_snow.h index 7a83b536..a8e1e9cb 100644 --- a/src/game/envfx_snow.h +++ b/src/game/envfx_snow.h @@ -29,7 +29,6 @@ struct EnvFxParticle { }; extern s8 gEnvFxMode; -extern UNUSED s32 D_80330644; extern struct EnvFxParticle *gEnvFxBuffer; extern Vec3i gSnowCylinderLastPos; diff --git a/src/game/interaction.c b/src/game/interaction.c index 800ad0fb..72eeec15 100644 --- a/src/game/interaction.c +++ b/src/game/interaction.c @@ -517,7 +517,7 @@ void bounce_off_object(struct MarioState *m, struct Object *o, f32 velY) { m->pos[1] = o->oPosY + o->hitboxHeight; m->vel[1] = velY; - m->flags &= ~MARIO_UNKNOWN_08; + m->flags &= ~MARIO_JUMPING; play_sound(SOUND_ACTION_BOUNCE_OFF_OBJECT, m->marioObj->header.gfx.cameraToObject); } @@ -1158,7 +1158,7 @@ u32 interact_strong_wind(struct MarioState *m, UNUSED u32 interactType, struct O m->usedObj = o; m->faceAngle[1] = o->oMoveAngleYaw + 0x8000; - m->unkC4 = 0.4f; + m->windGravity = 0.4f; m->forwardVel = -24.0f; m->vel[1] = 12.0f; @@ -1837,7 +1837,7 @@ void mario_process_interactions(struct MarioState *m) { void check_death_barrier(struct MarioState *m) { if (m->pos[1] < m->floorHeight + 2048.0f) { - if (level_trigger_warp(m, WARP_OP_WARP_FLOOR) == 20 && !(m->flags & MARIO_UNKNOWN_18)) { + if (level_trigger_warp(m, WARP_OP_WARP_FLOOR) == 20 && !(m->flags & MARIO_FALL_SOUND_PLAYED)) { play_sound(SOUND_MARIO_WAAAOOOW, m->marioObj->header.gfx.cameraToObject); } } diff --git a/src/game/level_geo.h b/src/game/level_geo.h index a99f9ddd..e4b4016c 100644 --- a/src/game/level_geo.h +++ b/src/game/level_geo.h @@ -4,13 +4,6 @@ #include #include -struct Struct802761D0 -{ - u16 unk0; - s16 unk2; - u8 filler4[0x18-0x4]; -}; - Gfx *geo_envfx_main(s32 callContext, struct GraphNode *node, Mat4 mtxf); Gfx *geo_skybox_main(s32 callContext, struct GraphNode *node, UNUSED Mat4 *mtx); diff --git a/src/game/level_update.c b/src/game/level_update.c index 5570d28f..91253bb7 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -169,11 +169,10 @@ struct CreditsEntry sCreditsSequence[] = { struct MarioState gMarioStates[1]; struct HudDisplay gHudDisplay; s16 sCurrPlayMode; -u16 D_80339ECA; s16 sTransitionTimer; void (*sTransitionUpdate)(s16 *); struct WarpDest sWarpDest; -s16 D_80339EE0; +s16 sSpecialWarpDest; s16 sDelayedWarpOp; s16 sDelayedWarpTimer; s16 sSourceWarpNodeId; @@ -230,13 +229,11 @@ u32 pressed_pause(void) { void set_play_mode(s16 playMode) { sCurrPlayMode = playMode; - D_80339ECA = 0; } void warp_special(s32 arg) { sCurrPlayMode = PLAY_MODE_CHANGE_LEVEL; - D_80339ECA = 0; - D_80339EE0 = arg; + sSpecialWarpDest = arg; } void fade_into_special_warp(u32 arg, u32 color) { @@ -426,7 +423,7 @@ void init_mario_after_warp(void) { case MARIO_SPAWN_SPIN_AIRBORNE_CIRCLE: play_transition(WARP_TRANSITION_FADE_FROM_CIRCLE, 0x10, 0x00, 0x00, 0x00); break; - case MARIO_SPAWN_UNKNOWN_27: + case MARIO_SPAWN_FADE_FROM_BLACK: play_transition(WARP_TRANSITION_FADE_FROM_COLOR, 0x10, 0x00, 0x00, 0x00); break; default: @@ -725,7 +722,7 @@ void initiate_painting_warp(void) { fadeout_music(398); #if ENABLE_RUMBLE queue_rumble_data(80, 70); - func_sh_8024C89C(1); + queue_rumble_decay(1); #endif } } @@ -906,7 +903,7 @@ void initiate_delayed_warp(void) { sound_banks_disable(SEQ_PLAYER_SFX, SOUND_BANKS_ALL); gCurrCreditsEntry += 1; - gCurrActNum = gCurrCreditsEntry->unk02 & 0x07; + gCurrActNum = gCurrCreditsEntry->actNum & 0x07; if ((gCurrCreditsEntry + 1)->levelNum == LEVEL_NONE) { destWarpNode = WARP_NODE_CREDITS_END; } else { @@ -1153,7 +1150,7 @@ s32 play_mode_change_level(void) { if (sWarpDest.type != WARP_TYPE_NOT_WARPING) { return sWarpDest.levelNum; } else { - return D_80339EE0; + return sSpecialWarpDest; } } @@ -1170,7 +1167,7 @@ UNUSED static s32 play_mode_unused(void) { if (sWarpDest.type != WARP_TYPE_NOT_WARPING) { return sWarpDest.levelNum; } else { - return D_80339EE0; + return sSpecialWarpDest; } } @@ -1216,7 +1213,7 @@ s32 init_level(void) { sDelayedWarpOp = WARP_OP_NONE; sTransitionTimer = 0; - D_80339EE0 = 0; + sSpecialWarpDest = 0; if (gCurrCreditsEntry == NULL) { gHudDisplay.flags = HUD_DISPLAY_DEFAULT; diff --git a/src/game/level_update.h b/src/game/level_update.h index 8080d2dc..1d31bb2a 100644 --- a/src/game/level_update.h +++ b/src/game/level_update.h @@ -6,28 +6,28 @@ #include "types.h" -#define TIMER_CONTROL_SHOW 0 -#define TIMER_CONTROL_START 1 -#define TIMER_CONTROL_STOP 2 -#define TIMER_CONTROL_HIDE 3 +#define TIMER_CONTROL_SHOW 0x00 +#define TIMER_CONTROL_START 0x01 +#define TIMER_CONTROL_STOP 0x02 +#define TIMER_CONTROL_HIDE 0x03 -#define WARP_OP_NONE 0x00 -#define WARP_OP_UNKNOWN_01 0x01 -#define WARP_OP_UNKNOWN_02 0x02 -#define WARP_OP_WARP_DOOR 0x03 -#define WARP_OP_WARP_OBJECT 0x04 -#define WARP_OP_TELEPORT 0x05 -#define WARP_OP_STAR_EXIT 0x11 -#define WARP_OP_DEATH 0x12 -#define WARP_OP_WARP_FLOOR 0x13 -#define WARP_OP_GAME_OVER 0x14 -#define WARP_OP_CREDITS_END 0x15 -#define WARP_OP_DEMO_NEXT 0x16 -#define WARP_OP_CREDITS_START 0x17 -#define WARP_OP_CREDITS_NEXT 0x18 -#define WARP_OP_DEMO_END 0x19 +#define WARP_OP_NONE 0x00 +#define WARP_OP_UNKNOWN_01 0x01 +#define WARP_OP_UNKNOWN_02 0x02 +#define WARP_OP_WARP_DOOR 0x03 +#define WARP_OP_WARP_OBJECT 0x04 +#define WARP_OP_TELEPORT 0x05 +#define WARP_OP_STAR_EXIT 0x11 +#define WARP_OP_DEATH 0x12 +#define WARP_OP_WARP_FLOOR 0x13 +#define WARP_OP_GAME_OVER 0x14 +#define WARP_OP_CREDITS_END 0x15 +#define WARP_OP_DEMO_NEXT 0x16 +#define WARP_OP_CREDITS_START 0x17 +#define WARP_OP_CREDITS_NEXT 0x18 +#define WARP_OP_DEMO_END 0x19 -#define WARP_OP_TRIGGERS_LEVEL_SELECT 0x10 +#define WARP_OP_TRIGGERS_LEVEL_SELECT 0x10 #define MARIO_SPAWN_DOOR_WARP 0x01 #define MARIO_SPAWN_UNKNOWN_02 0x02 @@ -47,17 +47,17 @@ #define MARIO_SPAWN_AIRBORNE_DEATH 0x23 #define MARIO_SPAWN_LAUNCH_STAR_COLLECT 0x24 #define MARIO_SPAWN_LAUNCH_DEATH 0x25 -#define MARIO_SPAWN_UNKNOWN_27 0x27 +#define MARIO_SPAWN_FADE_FROM_BLACK 0x27 struct CreditsEntry { /*0x00*/ u8 levelNum; /*0x01*/ u8 areaIndex; - /*0x02*/ u8 unk02; + /*0x02*/ u8 actNum; /*0x03*/ s8 marioAngle; /*0x04*/ Vec3s marioPos; - /*0x0C*/ const char **unk0C; + /*0x0C*/ const char **string; }; extern struct CreditsEntry *gCurrCreditsEntry; @@ -66,7 +66,6 @@ extern struct MarioState gMarioStates[]; extern struct MarioState *gMarioState; extern s16 sCurrPlayMode; -extern u16 D_80339ECA; extern s16 sTransitionTimer; extern void (*sTransitionUpdate)(s16 *); extern u8 unused3[4]; @@ -82,7 +81,7 @@ struct WarpDest { extern struct WarpDest sWarpDest; -extern s16 D_80339EE0; +extern s16 sSpecialWarpDest; extern s16 sDelayedWarpOp; extern s16 sDelayedWarpTimer; extern s16 sSourceWarpNodeId; @@ -104,16 +103,16 @@ extern struct HudDisplay gHudDisplay; extern s8 gNeverEnteredCastle; enum HUDDisplayFlag { - HUD_DISPLAY_FLAG_LIVES = 0x0001, - HUD_DISPLAY_FLAG_COIN_COUNT = 0x0002, - HUD_DISPLAY_FLAG_STAR_COUNT = 0x0004, - HUD_DISPLAY_FLAG_CAMERA_AND_POWER = 0x0008, - HUD_DISPLAY_FLAG_KEYS = 0x0010, - HUD_DISPLAY_FLAG_UNKNOWN_0020 = 0x0020, - HUD_DISPLAY_FLAG_TIMER = 0x0040, - HUD_DISPLAY_FLAG_EMPHASIZE_POWER = 0x8000, + HUD_DISPLAY_FLAG_LIVES = (1 << 0), // 0x0001 + HUD_DISPLAY_FLAG_COIN_COUNT = (1 << 1), // 0x0002 + HUD_DISPLAY_FLAG_STAR_COUNT = (1 << 2), // 0x0004 + HUD_DISPLAY_FLAG_CAMERA_AND_POWER = (1 << 3), // 0x0008 + HUD_DISPLAY_FLAG_KEYS = (1 << 4), // 0x0010 + HUD_DISPLAY_FLAG_UNKNOWN_0020 = (1 << 5), // 0x0020 + HUD_DISPLAY_FLAG_TIMER = (1 << 6), // 0x0040 + HUD_DISPLAY_FLAG_EMPHASIZE_POWER = (1 << 15), // 0x8000 - HUD_DISPLAY_NONE = 0x0000, + HUD_DISPLAY_NONE = (0 << 0), // 0x0000 HUD_DISPLAY_DEFAULT = HUD_DISPLAY_FLAG_LIVES | HUD_DISPLAY_FLAG_COIN_COUNT | HUD_DISPLAY_FLAG_STAR_COUNT | HUD_DISPLAY_FLAG_CAMERA_AND_POWER | HUD_DISPLAY_FLAG_KEYS | HUD_DISPLAY_FLAG_UNKNOWN_0020 }; diff --git a/src/game/macro_special_objects.c b/src/game/macro_special_objects.c index 94dbac9a..f3ccee83 100644 --- a/src/game/macro_special_objects.c +++ b/src/game/macro_special_objects.c @@ -68,8 +68,7 @@ void spawn_macro_abs_yrot_param1(s32 model, const BehaviorScript *behavior, s16 * Spawns an object at an absolute location with currently 3 unknown variables that get converted to * floats. Oddly enough, this function doesn't care if 'behavior' is NULL or not. */ -void spawn_macro_abs_special(s32 model, const BehaviorScript *behavior, s16 x, s16 y, s16 z, s16 unkA, s16 unkB, - s16 unkC) { +void spawn_macro_abs_special(s32 model, const BehaviorScript *behavior, s16 x, s16 y, s16 z, s16 unkA, s16 unkB, s16 unkC) { struct Object *newObj = spawn_object_abs_with_rot(&gMacroObjectDefaultParent, 0, model, behavior, x, y, z, 0, 0, 0); diff --git a/src/game/main.h b/src/game/main.h index ab3396e3..e175a768 100644 --- a/src/game/main.h +++ b/src/game/main.h @@ -4,25 +4,25 @@ #include "config.h" struct RumbleData { - u8 unk00; // comm - u8 unk01; // level - s16 unk02; // time - s16 unk04; // decay + u8 comm; + u8 level; + s16 time; + s16 decay; }; struct RumbleSettings { - s16 unk00; // event - s16 unk02; // level - s16 unk04; // timer - s16 unk06; // count - s16 unk08; // start - s16 unk0A; // slip - s16 unk0C; // vibrate - s16 unk0E; // decay + s16 event; + s16 level; + s16 timer; + s16 count; + s16 start; + s16 slip; + s16 vibrate; + s16 decay; }; extern struct Config gConfig; -extern OSThread D_80339210; +extern OSThread gUnkThread; extern OSThread gIdleThread; extern OSThread gMainThread; extern OSThread gGameLoopThread; diff --git a/src/game/mario.c b/src/game/mario.c index 948db0dc..a45dba16 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -74,9 +74,9 @@ s16 set_mario_animation(struct MarioState *m, s32 targetAnimID) { o->header.gfx.animInfo.animID = targetAnimID; o->header.gfx.animInfo.curAnim = targetAnim; o->header.gfx.animInfo.animAccel = 0; - o->header.gfx.animInfo.animYTrans = m->unkB0; + o->header.gfx.animInfo.animYTrans = m->animYTrans; - if (targetAnim->flags & ANIM_FLAG_2) { + if (targetAnim->flags & ANIM_FLAG_NO_ACCEL) { o->header.gfx.animInfo.animFrame = targetAnim->startFrame; } else { if (targetAnim->flags & ANIM_FLAG_FORWARD) { @@ -106,9 +106,9 @@ s16 set_mario_anim_with_accel(struct MarioState *m, s32 targetAnimID, s32 accel) if (o->header.gfx.animInfo.animID != targetAnimID) { o->header.gfx.animInfo.animID = targetAnimID; o->header.gfx.animInfo.curAnim = targetAnim; - o->header.gfx.animInfo.animYTrans = m->unkB0; + o->header.gfx.animInfo.animYTrans = m->animYTrans; - if (targetAnim->flags & ANIM_FLAG_2) { + if (targetAnim->flags & ANIM_FLAG_NO_ACCEL) { o->header.gfx.animInfo.animFrameAccelAssist = (targetAnim->startFrame << 0x10); } else { if (targetAnim->flags & ANIM_FLAG_FORWARD) { @@ -210,12 +210,12 @@ void update_mario_pos_for_anim(struct MarioState *m) { flags = find_mario_anim_flags_and_translation(m->marioObj, m->faceAngle[1], translation); - if (flags & (ANIM_FLAG_HOR_TRANS | ANIM_FLAG_6)) { + if (flags & (ANIM_FLAG_HOR_TRANS | ANIM_FLAG_NO_TRANS)) { m->pos[0] += (f32) translation[0]; m->pos[2] += (f32) translation[2]; } - if (flags & (ANIM_FLAG_VERT_TRANS | ANIM_FLAG_6)) { + if (flags & (ANIM_FLAG_VERT_TRANS | ANIM_FLAG_NO_TRANS)) { m->pos[1] += (f32) translation[1]; } } @@ -855,7 +855,7 @@ static u32 set_mario_action_airborne(struct MarioState *m, u32 action, u32 actio } m->peakHeight = m->pos[1]; - m->flags |= MARIO_UNKNOWN_08; + m->flags |= MARIO_JUMPING; return action; } @@ -969,7 +969,7 @@ u32 set_mario_action(struct MarioState *m, u32 action, u32 actionArg) { m->flags &= ~(MARIO_ACTION_SOUND_PLAYED | MARIO_MARIO_SOUND_PLAYED); if (!(m->action & ACT_FLAG_AIR)) { - m->flags &= ~MARIO_UNKNOWN_18; + m->flags &= ~MARIO_FALL_SOUND_PLAYED; } // Initialize the action information. @@ -1533,7 +1533,7 @@ void update_mario_info_for_cam(struct MarioState *m) { vec3s_copy(m->statusForCamera->faceAngle, m->faceAngle); - if (!(m->flags & MARIO_UNKNOWN_25)) { + if (!(m->flags & MARIO_LEDGE_CLIMB_CAMERA)) { vec3f_copy(m->statusForCamera->pos, m->pos); } } @@ -1668,7 +1668,7 @@ void mario_update_hitbox_and_cap_model(struct MarioState *m) { if ((m->flags & MARIO_TELEPORTING) && (m->fadeWarpOpacity != 0xFF)) { bodyState->modelState &= ~0xFF; - bodyState->modelState |= (0x100 | m->fadeWarpOpacity); + bodyState->modelState |= (MODEL_STATE_ALPHA | m->fadeWarpOpacity); } } @@ -1702,7 +1702,7 @@ void func_sh_8025574C(void) { queue_rumble_data(5, 80); } if (gMarioState->heldObj && gMarioState->heldObj->behavior == segmented_to_virtual(bhvBobomb)) { - reset_rumble_timers(); + reset_rumble_timers_slip(); } } #endif @@ -1814,9 +1814,7 @@ void init_mario(void) { gMarioState->invincTimer = 0; - if (save_file_get_flags() - & (SAVE_FLAG_CAP_ON_GROUND | SAVE_FLAG_CAP_ON_KLEPTO | SAVE_FLAG_CAP_ON_UKIKI - | SAVE_FLAG_CAP_ON_MR_BLIZZARD)) { + if (save_file_get_flags() & (SAVE_FLAG_CAP_ON_GROUND | SAVE_FLAG_CAP_ON_KLEPTO | SAVE_FLAG_CAP_ON_UKIKI | SAVE_FLAG_CAP_ON_MR_BLIZZARD)) { gMarioState->flags = 0; } else { gMarioState->flags = (MARIO_NORMAL_CAP | MARIO_CAP_ON_HEAD); @@ -1835,8 +1833,7 @@ void init_mario(void) { gMarioState->riddenObj = NULL; gMarioState->usedObj = NULL; - gMarioState->waterLevel = - find_water_level(gMarioSpawnInfo->startPos[0], gMarioSpawnInfo->startPos[2]); + gMarioState->waterLevel = find_water_level(gMarioSpawnInfo->startPos[0], gMarioSpawnInfo->startPos[2]); gMarioState->area = gCurrentArea; gMarioState->marioObj = gMarioObject; @@ -1845,8 +1842,7 @@ void init_mario(void) { vec3s_set(gMarioState->angleVel, 0, 0, 0); vec3s_to_vec3f(gMarioState->pos, gMarioSpawnInfo->startPos); vec3f_set(gMarioState->vel, 0, 0, 0); - gMarioState->floorHeight = - find_floor(gMarioState->pos[0], gMarioState->pos[1], gMarioState->pos[2], &gMarioState->floor); + gMarioState->floorHeight = find_floor(gMarioState->pos[0], gMarioState->pos[1], gMarioState->pos[2], &gMarioState->floor); if (gMarioState->pos[1] < gMarioState->floorHeight) { gMarioState->pos[1] = gMarioState->floorHeight; @@ -1886,7 +1882,7 @@ void init_mario(void) { } void init_mario_from_save_file(void) { - gMarioState->unk00 = 0; + gMarioState->playerID = 0; gMarioState->flags = 0; gMarioState->action = 0; gMarioState->spawnInfo = &gPlayerSpawnInfos[0]; @@ -1896,15 +1892,14 @@ void init_mario_from_save_file(void) { gMarioState->animList = &gMarioAnimsBuf; gMarioState->numCoins = 0; - gMarioState->numStars = - save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1); + gMarioState->numStars = save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1); gMarioState->numKeys = 0; gMarioState->numLives = 4; gMarioState->health = 0x880; gMarioState->prevNumStarsForDialog = gMarioState->numStars; - gMarioState->unkB0 = 0xBD; + gMarioState->animYTrans = 0xBD; gHudDisplay.coins = 0; gHudDisplay.wedges = 8; diff --git a/src/game/mario_actions_airborne.c b/src/game/mario_actions_airborne.c index c037e87a..218f1cb8 100644 --- a/src/game/mario_actions_airborne.c +++ b/src/game/mario_actions_airborne.c @@ -26,10 +26,10 @@ void play_flip_sounds(struct MarioState *m, s16 frame1, s16 frame2, s16 frame3) void play_far_fall_sound(struct MarioState *m) { u32 action = m->action; if (!(action & ACT_FLAG_INVULNERABLE) && action != ACT_TWIRLING && action != ACT_FLYING - && !(m->flags & MARIO_UNKNOWN_18)) { + && !(m->flags & MARIO_FALL_SOUND_PLAYED)) { if (m->peakHeight - m->pos[1] > 1150.0f) { play_sound(SOUND_MARIO_WAAAOOOW, m->marioObj->header.gfx.cameraToObject); - m->flags |= MARIO_UNKNOWN_18; + m->flags |= MARIO_FALL_SOUND_PLAYED; } } } @@ -726,7 +726,7 @@ s32 act_twirling(struct MarioState *m) { m->marioObj->header.gfx.angle[1] += m->twirlYaw; #if ENABLE_RUMBLE - reset_rumble_timers(); + reset_rumble_timers_slip(); #endif return FALSE; } @@ -1012,7 +1012,7 @@ s32 act_burning_jump(struct MarioState *m) { m->health = 0xFF; } #if ENABLE_RUMBLE - reset_rumble_timers(); + reset_rumble_timers_slip(); #endif return FALSE; } @@ -1034,7 +1034,7 @@ s32 act_burning_fall(struct MarioState *m) { m->health = 0xFF; } #if ENABLE_RUMBLE - reset_rumble_timers(); + reset_rumble_timers_slip(); #endif return FALSE; } @@ -1280,8 +1280,8 @@ s32 act_getting_blown(struct MarioState *m) { m->forwardVel += 0.8f; } - if (m->vel[1] < 0.0f && m->unkC4 < 4.0f) { - m->unkC4 += 0.05f; + if (m->vel[1] < 0.0f && m->windGravity < 4.0f) { + m->windGravity += 0.05f; } } @@ -1586,7 +1586,7 @@ s32 act_lava_boost(struct MarioState *m) { m->marioBodyState->eyeState = MARIO_EYES_DEAD; #if ENABLE_RUMBLE - reset_rumble_timers(); + reset_rumble_timers_slip(); #endif return FALSE; } @@ -1732,7 +1732,7 @@ s32 act_shot_from_cannon(struct MarioState *m) { m->particleFlags |= PARTICLE_DUST; } #if ENABLE_RUMBLE - reset_rumble_timers(); + reset_rumble_timers_slip(); #endif return FALSE; } diff --git a/src/game/mario_actions_automatic.c b/src/game/mario_actions_automatic.c index e61cef20..d049e8b0 100644 --- a/src/game/mario_actions_automatic.c +++ b/src/game/mario_actions_automatic.c @@ -174,7 +174,7 @@ s32 act_holding_pole(struct MarioState *m) { } play_climbing_sounds(m, 2); #if ENABLE_RUMBLE - reset_rumble_timers(); + reset_rumble_timers_slip(); #endif set_sound_moving_speed(SOUND_BANK_MOVING, marioObj->oMarioPoleYawVel / 0x100 * 2); } else { @@ -536,7 +536,7 @@ void update_ledge_climb_camera(struct MarioState *m) { m->statusForCamera->pos[2] = m->pos[2] + dist * coss(m->faceAngle[1]); m->statusForCamera->pos[1] = m->pos[1]; m->actionTimer++; - m->flags |= MARIO_UNKNOWN_25; + m->flags |= MARIO_LEDGE_CLIMB_CAMERA; } void update_ledge_climb(struct MarioState *m, s32 animation, u32 endAction) { @@ -761,7 +761,7 @@ s32 act_in_cannon(struct MarioState *m) { } else if (m->faceAngle[0] != startFacePitch || m->faceAngle[1] != startFaceYaw) { play_sound(SOUND_MOVING_AIM_CANNON, m->marioObj->header.gfx.cameraToObject); #if ENABLE_RUMBLE - reset_rumble_timers_2(0); + reset_rumble_timers_vibrate(0); #endif } } @@ -848,7 +848,7 @@ s32 act_tornado_twirling(struct MarioState *m) { vec3f_copy(m->marioObj->header.gfx.pos, m->pos); vec3s_set(m->marioObj->header.gfx.angle, 0, m->faceAngle[1] + m->twirlYaw, 0); #if ENABLE_RUMBLE - reset_rumble_timers(); + reset_rumble_timers_slip(); #endif return FALSE; diff --git a/src/game/mario_actions_cutscene.c b/src/game/mario_actions_cutscene.c index 634ab10d..d4f2775f 100644 --- a/src/game/mario_actions_cutscene.c +++ b/src/game/mario_actions_cutscene.c @@ -42,9 +42,9 @@ static Vp sEndCutsceneVp = { { { 640, 480, 511, 0 }, { 640, 480, 511, 0 } } }; static struct CreditsEntry *sDispCreditsEntry = NULL; // related to peach gfx? -static s8 D_8032CBE4 = 0; -static s8 D_8032CBE8 = 0; -static s8 D_8032CBEC[7] = { 2, 3, 2, 1, 2, 3, 2 }; +static s8 sPeachManualBlinkTime = 0; +static s8 sPeachIsBlinking = 0; +static s8 sPeachBlinkTimes[7] = { 2, 3, 2, 1, 2, 3, 2 }; static u8 sStarsNeededForDialog[] = { 1, 3, 8, 30, 50, 70 }; @@ -116,11 +116,11 @@ void print_displaying_credits_entry(void) { #endif if (sDispCreditsEntry != NULL) { - currStrPtr = (char **) sDispCreditsEntry->unk0C; + currStrPtr = (char **) sDispCreditsEntry->string; titleStr = *currStrPtr++; numLines = *titleStr++ - '0'; - strY = (sDispCreditsEntry->unk02 & 0x20 ? 28 : 172) + (numLines == 1) * 16; + strY = (sDispCreditsEntry->actNum & 0x20 ? 28 : 172) + (numLines == 1) * 16; #ifndef VERSION_JP lineHeight = 16; #endif @@ -193,24 +193,24 @@ void bhv_end_toad_loop(void) { } // Geo switch case function for controlling Peach's eye state. -s32 geo_switch_peach_eyes(s32 run, struct GraphNode *node, UNUSED s32 a2) { +Gfx *geo_switch_peach_eyes(s32 callContext, struct GraphNode *node, UNUSED s32 context) { struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *) node; s16 timer; - if (run == TRUE) { - if (D_8032CBE4 == 0) { + if (callContext == GEO_CONTEXT_RENDER) { + if (sPeachManualBlinkTime == 0) { timer = (gAreaUpdateCounter + 0x20) >> 1 & 0x1F; if (timer < 7) { - switchCase->selectedCase = D_8032CBE8 * 4 + D_8032CBEC[timer]; + switchCase->selectedCase = sPeachIsBlinking * 4 + sPeachBlinkTimes[timer]; } else { - switchCase->selectedCase = D_8032CBE8 * 4 + 1; + switchCase->selectedCase = sPeachIsBlinking * 4 + 1; } } else { - switchCase->selectedCase = D_8032CBE8 * 4 + D_8032CBE4 - 1; + switchCase->selectedCase = sPeachIsBlinking * 4 + sPeachManualBlinkTime - 1; } } - return 0; + return NULL; } // unused @@ -1315,7 +1315,7 @@ s32 act_bbh_enter_spin(struct MarioState *m) { play_sound(SOUND_ACTION_SPIN, m->marioObj->header.gfx.cameraToObject); } - m->flags &= ~MARIO_UNKNOWN_08; + m->flags &= ~MARIO_JUMPING; perform_air_step(m, 0); if (m->vel[1] <= 0) { m->actionState = 2; @@ -1327,7 +1327,7 @@ s32 act_bbh_enter_spin(struct MarioState *m) { case 3: m->faceAngle[1] = atan2s(cageDZ, cageDX); mario_set_forward_vel(m, forwardVel); - m->flags &= ~MARIO_UNKNOWN_08; + m->flags &= ~MARIO_JUMPING; if (perform_air_step(m, 0) == AIR_STEP_LANDED) { level_trigger_warp(m, WARP_OP_UNKNOWN_02); #if ENABLE_RUMBLE @@ -1379,7 +1379,7 @@ s32 act_bbh_enter_jump(struct MarioState *m) { m->faceAngle[1] = atan2s(cageDZ, cageDX); mario_set_forward_vel(m, cageDist / 20.0f); - m->flags &= ~MARIO_UNKNOWN_08; + m->flags &= ~MARIO_JUMPING; m->actionState = 1; } @@ -1401,7 +1401,7 @@ s32 act_teleport_fade_out(struct MarioState *m) { #if ENABLE_RUMBLE if (m->actionTimer == 0) { queue_rumble_data(30, 70); - func_sh_8024C89C(2); + queue_rumble_decay(2); } #endif @@ -1427,7 +1427,7 @@ s32 act_teleport_fade_in(struct MarioState *m) { #if ENABLE_RUMBLE if (m->actionTimer == 0) { queue_rumble_data(30, 70); - func_sh_8024C89C(2); + queue_rumble_decay(2); } #endif @@ -2088,7 +2088,7 @@ static void end_peach_cutscene_spawn_peach(struct MarioState *m) { sEndRightToadObj->oOpacity = 255; sEndLeftToadObj->oOpacity = 255; - D_8032CBE4 = 4; + sPeachManualBlinkTime = 4; sEndPeachAnimation = 4; sEndToadAnims[0] = 4; @@ -2198,7 +2198,7 @@ static void end_peach_cutscene_dialog_1(struct MarioState *m) { #else case 81: #endif - D_8032CBE4 = 3; + sPeachManualBlinkTime = 3; break; #ifdef VERSION_SH @@ -2206,7 +2206,7 @@ static void end_peach_cutscene_dialog_1(struct MarioState *m) { #else case 145: #endif - D_8032CBE4 = 2; + sPeachManualBlinkTime = 2; break; #ifdef VERSION_SH @@ -2214,8 +2214,8 @@ static void end_peach_cutscene_dialog_1(struct MarioState *m) { #else case 228: #endif - D_8032CBE4 = 1; - D_8032CBE8 = 1; + sPeachManualBlinkTime = 1; + sPeachIsBlinking = 1; break; #ifdef VERSION_SH @@ -2235,8 +2235,8 @@ static void end_peach_cutscene_dialog_1(struct MarioState *m) { #else case 275: #endif - D_8032CBE4 = 0; - D_8032CBE8 = 0; + sPeachManualBlinkTime = 0; + sPeachIsBlinking = 0; break; #ifdef VERSION_SH @@ -2295,7 +2295,7 @@ static void end_peach_cutscene_dialog_2(struct MarioState *m) { #else case 45: #endif - D_8032CBE8 = 1; + sPeachIsBlinking = 1; break; #ifdef VERSION_SH @@ -2344,15 +2344,15 @@ static void end_peach_cutscene_kiss_from_peach(struct MarioState *m) { switch (m->actionTimer) { case 8: - D_8032CBE8 = 0; + sPeachIsBlinking = 0; break; case 10: - D_8032CBE4 = 3; + sPeachManualBlinkTime = 3; break; case 50: - D_8032CBE4 = 4; + sPeachManualBlinkTime = 4; break; case 75: @@ -2364,11 +2364,11 @@ static void end_peach_cutscene_kiss_from_peach(struct MarioState *m) { break; case 100: - D_8032CBE4 = 3; + sPeachManualBlinkTime = 3; break; case 136: - D_8032CBE4 = 0; + sPeachManualBlinkTime = 0; break; case 140: @@ -2396,19 +2396,19 @@ static void end_peach_cutscene_star_dance(struct MarioState *m) { switch (m->actionTimer) { case 70: - D_8032CBE4 = 1; + sPeachManualBlinkTime = 1; break; case 86: - D_8032CBE4 = 2; + sPeachManualBlinkTime = 2; break; case 90: - D_8032CBE4 = 3; + sPeachManualBlinkTime = 3; break; case 120: - D_8032CBE4 = 0; + sPeachManualBlinkTime = 0; break; case 140: @@ -2440,7 +2440,7 @@ static void end_peach_cutscene_dialog_3(struct MarioState *m) { sEndPeachAnimation = 0; sEndToadAnims[0] = 0; sEndToadAnims[1] = 2; - D_8032CBE8 = 1; + sPeachIsBlinking = 1; set_cutscene_message(160, 227, 5, 30); #ifndef VERSION_JP play_sound(SOUND_PEACH_BAKE_A_CAKE, sEndPeachObj->header.gfx.cameraToObject); @@ -2611,9 +2611,9 @@ static s32 act_credits_cutscene(struct MarioState *m) { sEndCutsceneVp.vp.vscale[0] = 640 - width; sEndCutsceneVp.vp.vscale[1] = 480 - height; sEndCutsceneVp.vp.vtrans[0] = - (gCurrCreditsEntry->unk02 & 0x10 ? width : -width) * 56 / 100 + 640; + (gCurrCreditsEntry->actNum & 0x10 ? width : -width) * 56 / 100 + 640; sEndCutsceneVp.vp.vtrans[1] = - (gCurrCreditsEntry->unk02 & 0x20 ? height : -height) * 66 / 100 + 480; + (gCurrCreditsEntry->actNum & 0x20 ? height : -height) * 66 / 100 + 480; override_viewport_and_clip(&sEndCutsceneVp, 0, 0, 0, 0); } @@ -2630,7 +2630,7 @@ static s32 act_credits_cutscene(struct MarioState *m) { level_trigger_warp(m, WARP_OP_CREDITS_NEXT); } - m->marioObj->header.gfx.angle[1] += (gCurrCreditsEntry->unk02 & 0xC0) << 8; + m->marioObj->header.gfx.angle[1] += (gCurrCreditsEntry->actNum & 0xC0) << 8; return FALSE; } diff --git a/src/game/mario_actions_cutscene.h b/src/game/mario_actions_cutscene.h index 31a8b5d3..ff42031d 100644 --- a/src/game/mario_actions_cutscene.h +++ b/src/game/mario_actions_cutscene.h @@ -20,7 +20,7 @@ void print_displaying_credits_entry(void); void bhv_end_peach_loop(void); void bhv_end_toad_loop(void); -s32 geo_switch_peach_eyes(s32 run, struct GraphNode *node, UNUSED s32 a2); +Gfx *geo_switch_peach_eyes(s32 callContext, struct GraphNode *node, UNUSED s32 context); s32 mario_ready_to_speak(void); s32 set_mario_npc_dialog(s32 actionArg); s32 mario_execute_cutscene_action(struct MarioState *m); diff --git a/src/game/mario_actions_moving.c b/src/game/mario_actions_moving.c index b95f4f66..b4cac3da 100644 --- a/src/game/mario_actions_moving.c +++ b/src/game/mario_actions_moving.c @@ -17,7 +17,7 @@ struct LandingAction { s16 numFrames; - s16 unk02; + s16 doubleJumpTimer; u32 verySteepAction; u32 endAction; u32 aPressedAction; @@ -89,8 +89,8 @@ void play_step_sound(struct MarioState *m, s16 frame1, s16 frame2) { void align_with_floor(struct MarioState *m) { m->pos[1] = m->floorHeight; - mtxf_align_terrain_triangle(sFloorAlignMatrix[m->unk00], m->pos, m->faceAngle[1], 40.0f); - m->marioObj->header.gfx.throwMatrix = &sFloorAlignMatrix[m->unk00]; + mtxf_align_terrain_triangle(sFloorAlignMatrix[m->playerID], m->pos, m->faceAngle[1], 40.0f); + m->marioObj->header.gfx.throwMatrix = &sFloorAlignMatrix[m->playerID]; } s32 begin_walking_action(struct MarioState *m, f32 forwardVel, u32 action, u32 actionArg) { @@ -710,7 +710,7 @@ void push_or_sidle_wall(struct MarioState *m, Vec3f startPos) { } if (m->wall == NULL || dWallAngle <= -0x71C8 || dWallAngle >= 0x71C8) { - m->flags |= MARIO_UNKNOWN_31; + m->flags |= MARIO_PUSHING; set_mario_animation(m, MARIO_ANIM_PUSHING); play_step_sound(m, 6, 18); } else { @@ -1263,7 +1263,7 @@ s32 act_riding_shell_ground(struct MarioState *m) { adjust_sound_for_speed(m); #if ENABLE_RUMBLE - reset_rumble_timers(); + reset_rumble_timers_slip(); #endif return FALSE; } @@ -1370,7 +1370,7 @@ s32 act_burning_ground(struct MarioState *m) { m->marioBodyState->eyeState = MARIO_EYES_DEAD; #if ENABLE_RUMBLE - reset_rumble_timers(); + reset_rumble_timers_slip(); #endif return FALSE; } @@ -1388,7 +1388,7 @@ void common_slide_action(struct MarioState *m, u32 endAction, u32 airAction, s32 play_sound(SOUND_MOVING_TERRAIN_SLIDE + m->terrainSoundAddend, m->marioObj->header.gfx.cameraToObject); #if ENABLE_RUMBLE - reset_rumble_timers(); + reset_rumble_timers_slip(); #endif adjust_sound_for_speed(m); @@ -1789,7 +1789,7 @@ s32 common_landing_cancels(struct MarioState *m, struct LandingAction *landingAc return mario_push_off_steep_floor(m, landingAction->verySteepAction, 0); } - m->doubleJumpTimer = landingAction->unk02; + m->doubleJumpTimer = landingAction->doubleJumpTimer; if (should_begin_sliding(m)) { return set_mario_action(m, landingAction->slideAction, 0); diff --git a/src/game/mario_actions_submerged.c b/src/game/mario_actions_submerged.c index 1414241e..84c2df9a 100644 --- a/src/game/mario_actions_submerged.c +++ b/src/game/mario_actions_submerged.c @@ -561,7 +561,7 @@ static s32 act_breaststroke(struct MarioState *m) { #if ENABLE_RUMBLE if (m->actionTimer < 6) { - func_sh_8024CA04(); + queue_rumble_submerged(); } #endif @@ -1093,7 +1093,7 @@ static s32 act_caught_in_whirlpool(struct MarioState *m) { vec3f_copy(m->marioObj->header.gfx.pos, m->pos); vec3s_set(m->marioObj->header.gfx.angle, 0, m->faceAngle[1], 0); #if ENABLE_RUMBLE - reset_rumble_timers(); + reset_rumble_timers_slip(); #endif return FALSE; diff --git a/src/game/mario_misc.c b/src/game/mario_misc.c index 6eab1b69..c8cd5b31 100644 --- a/src/game/mario_misc.c +++ b/src/game/mario_misc.c @@ -333,18 +333,15 @@ static Gfx *make_gfx_mario_alpha(struct GraphNodeGenerated *node, s16 alpha) { * Sets the correct blend mode and color for mirror Mario. */ Gfx *geo_mirror_mario_set_alpha(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) { - UNUSED u8 unused1[4]; Gfx *gfx = NULL; struct GraphNodeGenerated *asGenerated = (struct GraphNodeGenerated *) node; struct MarioBodyState *bodyState = &gBodyStates[asGenerated->parameter]; s16 alpha; - UNUSED u8 unused2[4]; if (callContext == GEO_CONTEXT_RENDER) { - alpha = (bodyState->modelState & 0x100) ? (bodyState->modelState & 0xFF) : 255; + alpha = (bodyState->modelState & MODEL_STATE_ALPHA) ? (bodyState->modelState & 0xFF) : 0xFF; #ifdef PUPPYCAM - if (alpha > gPuppyCam.opacity) - { + if (alpha > gPuppyCam.opacity) { alpha = gPuppyCam.opacity; bodyState->modelState |= MODEL_STATE_NOISE_ALPHA; } diff --git a/src/game/mario_step.c b/src/game/mario_step.c index 1f03992a..b500f5d5 100644 --- a/src/game/mario_step.c +++ b/src/game/mario_step.c @@ -420,14 +420,14 @@ s32 bonk_or_hit_lava_wall(struct MarioState *m, struct WallCollisionData *wallDa return AIR_STEP_HIT_LAVA_WALL; } - //Update wall reference (bonked wall) only if the new wall has a better facing angle + // Update wall reference (bonked wall) only if the new wall has a better facing angle absWallDYaw = wallDYaw < 0 ? -wallDYaw : wallDYaw; if (absWallDYaw > oldWallDYaw) { oldWallDYaw = absWallDYaw; m->wall = wallData->walls[i]; if (wallDYaw < -0x6000 || wallDYaw > 0x6000) { - m->flags |= MARIO_UNKNOWN_30; + m->flags |= MARIO_AIR_HIT_WALL; result = AIR_STEP_HIT_WALL; } } @@ -585,7 +585,7 @@ void apply_twirl_gravity(struct MarioState *m) { } u32 should_strengthen_gravity_for_jump_ascent(struct MarioState *m) { - if (!(m->flags & MARIO_UNKNOWN_08)) { + if (!(m->flags & MARIO_JUMPING)) { return FALSE; } @@ -620,7 +620,7 @@ void apply_gravity(struct MarioState *m) { m->vel[1] = -65.0f; } } else if (m->action == ACT_GETTING_BLOWN) { - m->vel[1] -= m->unkC4; + m->vel[1] -= m->windGravity; if (m->vel[1] < -75.0f) { m->vel[1] = -75.0f; } diff --git a/src/game/object_helpers.c b/src/game/object_helpers.c index 9e81bd8d..79fe1bae 100644 --- a/src/game/object_helpers.c +++ b/src/game/object_helpers.c @@ -487,12 +487,12 @@ struct Object *spawn_water_droplet(struct Object *parent, struct WaterDropletPar newObj->oMoveAngleYaw = random_u16(); } - if (params->flags & WATER_DROPLET_FLAG_RAND_ANGLE_INCR_PLUS_8000) { + if (params->flags & WATER_DROPLET_FLAG_RAND_ANGLE_INCR_BACKWARD) { newObj->oMoveAngleYaw = (s16)(newObj->oMoveAngleYaw + 0x8000) + (s16) random_f32_around_zero(params->moveAngleRange); } - if (params->flags & WATER_DROPLET_FLAG_RAND_ANGLE_INCR) { + if (params->flags & WATER_DROPLET_FLAG_RAND_ANGLE_INCR_FORWARD) { newObj->oMoveAngleYaw = (s16) newObj->oMoveAngleYaw + (s16) random_f32_around_zero(params->moveAngleRange); } @@ -954,13 +954,13 @@ void cur_obj_set_vel_from_mario_vel(f32 min, f32 mul) { } } -BAD_RETURN(s16) cur_obj_reverse_animation(void) { +void cur_obj_reverse_animation(void) { if (o->header.gfx.animInfo.animFrame >= 0) { o->header.gfx.animInfo.animFrame--; } } -BAD_RETURN(s32) cur_obj_extend_animation_if_at_end(void) { +void cur_obj_extend_animation_if_at_end(void) { s32 animFrame = o->header.gfx.animInfo.animFrame; s32 nearLoopEnd = o->header.gfx.animInfo.curAnim->loopEnd - 2; @@ -1015,15 +1015,15 @@ s32 cur_obj_check_anim_frame_in_range(s32 startFrame, s32 rangeLength) { } } -s32 cur_obj_check_frame_prior_current_frame(s16 *a0) { - s16 sp6 = o->header.gfx.animInfo.animFrame; +s32 cur_obj_check_frame_prior_current_frame(s16 *frame) { + s16 animFrame = o->header.gfx.animInfo.animFrame; - while (*a0 != -1) { - if (*a0 == sp6) { + while (*frame != -1) { + if (*frame == animFrame) { return TRUE; } - a0++; + frame++; } return FALSE; @@ -2501,17 +2501,17 @@ Gfx *geo_offset_klepto_held_object(s32 callContext, struct GraphNode *node, UNUS return NULL; } -s32 geo_offset_klepto_debug(s32 callContext, struct GraphNode *a1, UNUSED s32 sp8) { +Gfx *geo_offset_klepto_debug(s32 callContext, struct GraphNode *node, UNUSED s32 context) { if (callContext == GEO_CONTEXT_RENDER) { - ((struct GraphNode_802A45E4 *) a1->next)->unk18 = gDebugInfo[4][0]; - ((struct GraphNode_802A45E4 *) a1->next)->unk1A = gDebugInfo[4][1]; - ((struct GraphNode_802A45E4 *) a1->next)->unk1C = gDebugInfo[4][2]; - ((struct GraphNode_802A45E4 *) a1->next)->unk1E = gDebugInfo[4][3]; - ((struct GraphNode_802A45E4 *) a1->next)->unk20 = gDebugInfo[4][4]; - ((struct GraphNode_802A45E4 *) a1->next)->unk22 = gDebugInfo[4][5]; + ((struct GraphNode_802A45E4 *) node->next)->unk18 = gDebugInfo[4][0]; + ((struct GraphNode_802A45E4 *) node->next)->unk1A = gDebugInfo[4][1]; + ((struct GraphNode_802A45E4 *) node->next)->unk1C = gDebugInfo[4][2]; + ((struct GraphNode_802A45E4 *) node->next)->unk1E = gDebugInfo[4][3]; + ((struct GraphNode_802A45E4 *) node->next)->unk20 = gDebugInfo[4][4]; + ((struct GraphNode_802A45E4 *) node->next)->unk22 = gDebugInfo[4][5]; } - return 0; + return NULL; } s32 obj_is_hidden(struct Object *obj) { diff --git a/src/game/object_helpers.h b/src/game/object_helpers.h index 3cd8b8b6..768f3ff8 100644 --- a/src/game/object_helpers.h +++ b/src/game/object_helpers.h @@ -17,12 +17,13 @@ struct ChainSegment s16 roll; }; -#define WATER_DROPLET_FLAG_RAND_ANGLE 0x02 -#define WATER_DROPLET_FLAG_RAND_OFFSET_XZ 0x04 // Unused -#define WATER_DROPLET_FLAG_RAND_OFFSET_XYZ 0x08 // Unused -#define WATER_DROPLET_FLAG_SET_Y_TO_WATER_LEVEL 0x20 -#define WATER_DROPLET_FLAG_RAND_ANGLE_INCR_PLUS_8000 0x40 -#define WATER_DROPLET_FLAG_RAND_ANGLE_INCR 0x80 // Unused +#define WATER_DROPLET_FLAG_RAND_ANGLE (1 << 1) // 0x02 +#define WATER_DROPLET_FLAG_RAND_OFFSET_XZ (1 << 2) // 0x04 // Unused +#define WATER_DROPLET_FLAG_RAND_OFFSET_XYZ (1 << 3) // 0x08 // Unused +#define WATER_DROPLET_FLAG_UNUSED (1 << 4) // 0x10 // Unused +#define WATER_DROPLET_FLAG_SET_Y_TO_WATER_LEVEL (1 << 5) // 0x20 +#define WATER_DROPLET_FLAG_RAND_ANGLE_INCR_BACKWARD (1 << 6) // 0x40 +#define WATER_DROPLET_FLAG_RAND_ANGLE_INCR_FORWARD (1 << 7) // 0x80 // Unused // Call spawn_water_droplet with this struct to spawn an object. struct WaterDropletParams @@ -40,16 +41,6 @@ struct WaterDropletParams f32 randSizeScale; }; -struct struct802A1230 { - /*0x00*/ s16 unk00; - /*0x02*/ s16 unk02; -}; - -struct Struct802A272C { - Vec3f vecF; - Vec3s vecS; -}; - // TODO: Field names struct SpawnParticlesInfo { @@ -97,7 +88,7 @@ struct Object *spawn_object_abs_with_rot(struct Object *parent, s16 uselessArg, s16 x, s16 y, s16 z, s16 rx, s16 ry, s16 rz); struct Object *spawn_object_rel_with_rot(struct Object *parent, u32 model, const BehaviorScript *behavior, s16 xOff, s16 yOff, s16 zOff, s16 rx, s16 ry, UNUSED s16 rz); -struct Object *spawn_obj_with_transform_flags(struct Object *sp20, s32 model, const BehaviorScript *sp28); +struct Object *spawn_obj_with_transform_flags(struct Object *sp20, s32 model, const BehaviorScript *behavior); struct Object *spawn_water_droplet(struct Object *parent, struct WaterDropletParams *params); struct Object *spawn_object_at_origin(struct Object *, s32, u32, const BehaviorScript *); struct Object *spawn_object_at_origin(struct Object *parent, UNUSED s32 unusedArg, u32 model, const BehaviorScript *behavior); @@ -266,7 +257,7 @@ void obj_set_collision_data(struct Object *obj, const void *segAddr); void cur_obj_if_hit_wall_bounce_away(void); s32 cur_obj_hide_if_mario_far_away_y(f32 distY); Gfx *geo_offset_klepto_held_object(s32 callContext, struct GraphNode *node, UNUSED Mat4 mtx); -s32 geo_offset_klepto_debug(s32 a0, struct GraphNode *a1, UNUSED s32 sp8); +Gfx *geo_offset_klepto_debug(s32 callContext, struct GraphNode *node, UNUSED s32 context); s32 obj_is_hidden(struct Object *obj); void enable_time_stop(void); void disable_time_stop(void); diff --git a/src/game/object_list_processor.c b/src/game/object_list_processor.c index 596e71a3..c57d304f 100644 --- a/src/game/object_list_processor.c +++ b/src/game/object_list_processor.c @@ -152,7 +152,6 @@ TerrainData *gEnvironmentRegions; s32 gEnvironmentLevels[20]; RoomData gDoorAdjacentRooms[60][2]; s16 gMarioCurrentRoom; -s16 D_8035FEE2; s16 gDoorRenderingTimer; s16 gTHIWaterDrained; s16 gTTCSpeedSetting; diff --git a/src/game/object_list_processor.h b/src/game/object_list_processor.h index 0564c30e..38c02aa3 100644 --- a/src/game/object_list_processor.h +++ b/src/game/object_list_processor.h @@ -104,7 +104,6 @@ extern TerrainData *gEnvironmentRegions; extern s32 gEnvironmentLevels[20]; extern RoomData gDoorAdjacentRooms[60][2]; extern s16 gMarioCurrentRoom; -extern s16 D_8035FEE2; extern s16 gDoorRenderingTimer; extern s16 gTHIWaterDrained; extern s16 gTTCSpeedSetting; diff --git a/src/game/platform_displacement.c b/src/game/platform_displacement.c index d2556960..63e39354 100644 --- a/src/game/platform_displacement.c +++ b/src/game/platform_displacement.c @@ -13,10 +13,6 @@ #include "config.h" -u16 D_8032FEC0 = 0; - -u32 unused_8032FEC4[4] = { 0 }; - struct Object *gMarioPlatform = NULL; /** @@ -256,7 +252,6 @@ void apply_platform_displacement(u32 isMario, struct Object *platform) { rotation[2] = platform->oAngleVelRoll; if (isMario) { - D_8032FEC0 = 0; get_mario_pos(&x, &y, &z); } else { x = gCurrentObject->oPosX; diff --git a/src/game/rendering_graph_node.c b/src/game/rendering_graph_node.c index 30f7eabb..d080044d 100644 --- a/src/game/rendering_graph_node.c +++ b/src/game/rendering_graph_node.c @@ -882,14 +882,14 @@ void geo_set_animation_globals(struct AnimInfo *node, s32 hasAnimation) { gCurAnimType = ANIM_TYPE_VERTICAL_TRANSLATION; } else if (anim->flags & ANIM_FLAG_VERT_TRANS) { gCurAnimType = ANIM_TYPE_LATERAL_TRANSLATION; - } else if (anim->flags & ANIM_FLAG_6) { + } else if (anim->flags & ANIM_FLAG_NO_TRANS) { gCurAnimType = ANIM_TYPE_NO_TRANSLATION; } else { gCurAnimType = ANIM_TYPE_TRANSLATION; } gCurrAnimFrame = node->animFrame; - gCurAnimEnabled = (anim->flags & ANIM_FLAG_5) == 0; + gCurAnimEnabled = (anim->flags & ANIM_FLAG_DISABLED) == 0; gCurrAnimAttribute = segmented_to_virtual((void *) anim->index); gCurAnimData = segmented_to_virtual((void *) anim->values); diff --git a/src/game/rumble_init.c b/src/game/rumble_init.c index fc697465..49f2bef9 100644 --- a/src/game/rumble_init.c +++ b/src/game/rumble_init.c @@ -79,161 +79,161 @@ static void update_rumble_pak(void) { return; } - if (gCurrRumbleSettings.unk08 > 0) { - gCurrRumbleSettings.unk08--; + if (gCurrRumbleSettings.start > 0) { + gCurrRumbleSettings.start--; start_rumble(); - } else if (gCurrRumbleSettings.unk04 > 0) { - gCurrRumbleSettings.unk04--; + } else if (gCurrRumbleSettings.timer > 0) { + gCurrRumbleSettings.timer--; - gCurrRumbleSettings.unk02 -= gCurrRumbleSettings.unk0E; - if (gCurrRumbleSettings.unk02 < 0) { - gCurrRumbleSettings.unk02 = 0; + gCurrRumbleSettings.level -= gCurrRumbleSettings.decay; + if (gCurrRumbleSettings.level < 0) { + gCurrRumbleSettings.level = 0; } - if (gCurrRumbleSettings.unk00 == 1) { + if (gCurrRumbleSettings.event == 1) { start_rumble(); - } else if (gCurrRumbleSettings.unk06 >= 0x100) { - gCurrRumbleSettings.unk06 -= 0x100; + } else if (gCurrRumbleSettings.count >= 0x100) { + gCurrRumbleSettings.count -= 0x100; start_rumble(); } else { - gCurrRumbleSettings.unk06 += - ((gCurrRumbleSettings.unk02 * gCurrRumbleSettings.unk02 * gCurrRumbleSettings.unk02) / (1 << 9)) + 4; + gCurrRumbleSettings.count += + ((gCurrRumbleSettings.level * gCurrRumbleSettings.level * gCurrRumbleSettings.level) / (1 << 9)) + 4; stop_rumble(); } } else { - gCurrRumbleSettings.unk04 = 0; + gCurrRumbleSettings.timer = 0; - if (gCurrRumbleSettings.unk0A >= 5) { + if (gCurrRumbleSettings.slip >= 5) { start_rumble(); - } else if ((gCurrRumbleSettings.unk0A >= 2) && (gNumVblanks % gCurrRumbleSettings.unk0C == 0)) { + } else if ((gCurrRumbleSettings.slip >= 2) && (gNumVblanks % gCurrRumbleSettings.vibrate == 0)) { start_rumble(); } else { stop_rumble(); } } - if (gCurrRumbleSettings.unk0A > 0) { - gCurrRumbleSettings.unk0A--; + if (gCurrRumbleSettings.slip > 0) { + gCurrRumbleSettings.slip--; } } static void update_rumble_data_queue(void) { - if (gRumbleDataQueue[0].unk00) { - gCurrRumbleSettings.unk06 = 0; - gCurrRumbleSettings.unk08 = 4; - gCurrRumbleSettings.unk00 = gRumbleDataQueue[0].unk00; - gCurrRumbleSettings.unk04 = gRumbleDataQueue[0].unk02; - gCurrRumbleSettings.unk02 = gRumbleDataQueue[0].unk01; - gCurrRumbleSettings.unk0E = gRumbleDataQueue[0].unk04; + if (gRumbleDataQueue[0].comm) { + gCurrRumbleSettings.count = 0; + gCurrRumbleSettings.start = 4; + gCurrRumbleSettings.comm = gRumbleDataQueue[0].comm; + gCurrRumbleSettings.timer = gRumbleDataQueue[0].time; + gCurrRumbleSettings.level = gRumbleDataQueue[0].level; + gCurrRumbleSettings.decay = gRumbleDataQueue[0].decay; } gRumbleDataQueue[0] = gRumbleDataQueue[1]; gRumbleDataQueue[1] = gRumbleDataQueue[2]; - gRumbleDataQueue[2].unk00 = 0; + gRumbleDataQueue[2].comm = 0; } -void queue_rumble_data(s16 a0, s16 a1) { +void queue_rumble_data(s16 time, s16 level) { if (gCurrDemoInput != NULL) { return; } - if (a1 > 70) { - gRumbleDataQueue[2].unk00 = 1; + if (level > 70) { + gRumbleDataQueue[2].comm = 1; } else { - gRumbleDataQueue[2].unk00 = 2; + gRumbleDataQueue[2].comm = 2; } - gRumbleDataQueue[2].unk01 = a1; - gRumbleDataQueue[2].unk02 = a0; - gRumbleDataQueue[2].unk04 = 0; + gRumbleDataQueue[2].level = level; + gRumbleDataQueue[2].time = time; + gRumbleDataQueue[2].decay = 0; } -void func_sh_8024C89C(s16 a0) { - gRumbleDataQueue[2].unk04 = a0; +void queue_rumble_decay(s16 decay) { + gRumbleDataQueue[2].decay = decay; } u8 is_rumble_finished_and_queue_empty(void) { - if (gCurrRumbleSettings.unk08 + gCurrRumbleSettings.unk04 >= 4) { + if (gCurrRumbleSettings.start + gCurrRumbleSettings.timer >= 4) { return FALSE; } - if (gRumbleDataQueue[0].unk00 != 0) { + if (gRumbleDataQueue[0].comm != 0) { return FALSE; } - if (gRumbleDataQueue[1].unk00 != 0) { + if (gRumbleDataQueue[1].comm != 0) { return FALSE; } - if (gRumbleDataQueue[2].unk00 != 0) { + if (gRumbleDataQueue[2].comm != 0) { return FALSE; } return TRUE; } -void reset_rumble_timers(void) { +void reset_rumble_timers_slip(void) { if (gCurrDemoInput != NULL) { return; } - if (gCurrRumbleSettings.unk0A == 0) { - gCurrRumbleSettings.unk0A = 7; + if (gCurrRumbleSettings.slip == 0) { + gCurrRumbleSettings.slip = 7; } - if (gCurrRumbleSettings.unk0A < 4) { - gCurrRumbleSettings.unk0A = 4; + if (gCurrRumbleSettings.slip < 4) { + gCurrRumbleSettings.slip = 4; } - gCurrRumbleSettings.unk0C = 7; + gCurrRumbleSettings.vibrate = 7; } -void reset_rumble_timers_2(s32 a0) { +void reset_rumble_timers_vibrate(s32 level) { if (gCurrDemoInput != NULL) { return; } - if (gCurrRumbleSettings.unk0A == 0) { - gCurrRumbleSettings.unk0A = 7; + if (gCurrRumbleSettings.slip == 0) { + gCurrRumbleSettings.slip = 7; } - if (gCurrRumbleSettings.unk0A < 4) { - gCurrRumbleSettings.unk0A = 4; + if (gCurrRumbleSettings.slip < 4) { + gCurrRumbleSettings.slip = 4; } - if (a0 == 4) { - gCurrRumbleSettings.unk0C = 1; + if (level == 4) { + gCurrRumbleSettings.vibrate = 1; } - if (a0 == 3) { - gCurrRumbleSettings.unk0C = 2; + if (level == 3) { + gCurrRumbleSettings.vibrate = 2; } - if (a0 == 2) { - gCurrRumbleSettings.unk0C = 3; + if (level == 2) { + gCurrRumbleSettings.vibrate = 3; } - if (a0 == 1) { - gCurrRumbleSettings.unk0C = 4; + if (level == 1) { + gCurrRumbleSettings.vibrate = 4; } - if (a0 == 0) { - gCurrRumbleSettings.unk0C = 5; + if (level == 0) { + gCurrRumbleSettings.vibrate = 5; } } -void func_sh_8024CA04(void) { +void queue_rumble_submerged(void) { if (gCurrDemoInput != NULL) { return; } - gCurrRumbleSettings.unk0A = 4; - gCurrRumbleSettings.unk0C = 4; + gCurrRumbleSettings.slip = 4; + gCurrRumbleSettings.vibrate = 4; } -static void thread6_rumble_loop(UNUSED void *a0) { +static void thread6_rumble_loop(UNUSED void *arg) { OSMesg msg; osSyncPrintf("start motor thread\n"); @@ -271,12 +271,12 @@ void cancel_rumble(void) { osMotorStop(&gRumblePakPfs); } - gRumbleDataQueue[0].unk00 = 0; - gRumbleDataQueue[1].unk00 = 0; - gRumbleDataQueue[2].unk00 = 0; + gRumbleDataQueue[0].comm = 0; + gRumbleDataQueue[1].comm = 0; + gRumbleDataQueue[2].comm = 0; - gCurrRumbleSettings.unk04 = 0; - gCurrRumbleSettings.unk0A = 0; + gCurrRumbleSettings.timer = 0; + gCurrRumbleSettings.slip = 0; gRumblePakTimer = 0; } diff --git a/src/game/rumble_init.h b/src/game/rumble_init.h index cc47d75b..3938a15f 100644 --- a/src/game/rumble_init.h +++ b/src/game/rumble_init.h @@ -13,11 +13,11 @@ void init_rumble_pak_scheduler_queue(void); void block_until_rumble_pak_free(void); void release_rumble_pak_control(void); void queue_rumble_data(s16 a0, s16 a1); -void func_sh_8024C89C(s16 a0); +void queue_rumble_decay(s16 a0); u8 is_rumble_finished_and_queue_empty(void); -void reset_rumble_timers(void); -void reset_rumble_timers_2(s32 a0); -void func_sh_8024CA04(void); +void reset_rumble_timers_slip(void); +void reset_rumble_timers_vibrate(s32 a0); +void queue_rumble_submerged(void); void cancel_rumble(void); void create_thread_6(void); void rumble_thread_update_vi(void); diff --git a/src/goddard/gd_types.h b/src/goddard/gd_types.h index a0213d44..7603796d 100644 --- a/src/goddard/gd_types.h +++ b/src/goddard/gd_types.h @@ -47,28 +47,28 @@ struct DynList { /* Goddard Code Object Structs */ /* Object Type Flags */ enum ObjTypeFlag { - OBJ_TYPE_GROUPS = 0x00000001, - OBJ_TYPE_BONES = 0x00000002, - OBJ_TYPE_JOINTS = 0x00000004, - OBJ_TYPE_PARTICLES = 0x00000008, - OBJ_TYPE_SHAPES = 0x00000010, - OBJ_TYPE_NETS = 0x00000020, - OBJ_TYPE_PLANES = 0x00000040, - OBJ_TYPE_FACES = 0x00000080, - OBJ_TYPE_VERTICES = 0x00000100, - OBJ_TYPE_CAMERAS = 0x00000200, - // 0x400 was not used - OBJ_TYPE_MATERIALS = 0x00000800, - OBJ_TYPE_WEIGHTS = 0x00001000, - OBJ_TYPE_GADGETS = 0x00002000, - OBJ_TYPE_VIEWS = 0x00004000, - OBJ_TYPE_LABELS = 0x00008000, - OBJ_TYPE_ANIMATORS = 0x00010000, - OBJ_TYPE_VALPTRS = 0x00020000, - // 0x40000 was not used - OBJ_TYPE_LIGHTS = 0x00080000, - OBJ_TYPE_ZONES = 0x00100000, - OBJ_TYPE_UNK200000 = 0x00200000 + OBJ_TYPE_GROUPS = (1 << 0), // 0x00000001 + OBJ_TYPE_BONES = (1 << 1), // 0x00000002 // unused + OBJ_TYPE_JOINTS = (1 << 2), // 0x00000004 + OBJ_TYPE_PARTICLES = (1 << 3), // 0x00000008 + OBJ_TYPE_SHAPES = (1 << 4), // 0x00000010 + OBJ_TYPE_NETS = (1 << 5), // 0x00000020 + OBJ_TYPE_PLANES = (1 << 6), // 0x00000040 // unused + OBJ_TYPE_FACES = (1 << 7), // 0x00000080 + OBJ_TYPE_VERTICES = (1 << 8), // 0x00000100 + OBJ_TYPE_CAMERAS = (1 << 9), // 0x00000200 + OBJ_TYPE_UNUSED_10 = (1 << 10), // 0x00000400 // unused + OBJ_TYPE_MATERIALS = (1 << 11), // 0x00000800 + OBJ_TYPE_WEIGHTS = (1 << 12), // 0x00001000 + OBJ_TYPE_GADGETS = (1 << 13), // 0x00002000 // unused + OBJ_TYPE_VIEWS = (1 << 14), // 0x00004000 + OBJ_TYPE_LABELS = (1 << 15), // 0x00008000 + OBJ_TYPE_ANIMATORS = (1 << 16), // 0x00010000 + OBJ_TYPE_VALPTRS = (1 << 17), // 0x00020000 + OBJ_TYPE_UNUSED_18 = (1 << 18), // 0x00040000 // unused + OBJ_TYPE_LIGHTS = (1 << 19), // 0x00080000 + OBJ_TYPE_ZONES = (1 << 20), // 0x00100000 // unused + OBJ_TYPE_UNK200000 = (1 << 21), // 0x00200000 // unused }; /* This constant seems to be used to indicate the type of any or all objects */ #define OBJ_TYPE_ALL 0x00FFFFFF @@ -78,11 +78,11 @@ enum ObjTypeFlag { typedef void (*drawmethod_t)(void *); /// Flags for the drawFlags field of an GdObj enum ObjDrawingFlags { - OBJ_DRAW_UNK01 = 0x01, - OBJ_INVISIBLE = 0x02, ///< This `GdObj` shouldn't be drawn when updating a scene - OBJ_PICKED = 0x04, ///< This `GdObj` is held by the cursor - OBJ_IS_GRABBALE = 0x08, ///< This `GdObj` can be grabbed/picked by the cursor - OBJ_HIGHLIGHTED = 0x10 + OBJ_DRAW_UNK01 = (1 << 0), // 0x01 + OBJ_INVISIBLE = (1 << 1), // 0x02 ///< This `GdObj` shouldn't be drawn when updating a scene + OBJ_PICKED = (1 << 2), // 0x04 ///< This `GdObj` is held by the cursor + OBJ_IS_GRABBALE = (1 << 3), // 0x08 ///< This `GdObj` can be grabbed/picked by the cursor + OBJ_HIGHLIGHTED = (1 << 4) // 0x10 }; /** @@ -481,22 +481,22 @@ struct ObjGadget { }; /* sizeof = 0x60 */ enum GdViewFlags { - VIEW_2_COL_BUF = 0x000008, - VIEW_ALLOC_ZBUF = 0x000010, - VIEW_SAVE_TO_GLOBAL = 0x000040, - VIEW_DEFAULT_PARENT = 0x000100, - VIEW_BORDERED = 0x000400, - VIEW_UPDATE = 0x000800, - VIEW_UNK_1000 = 0x001000, // used in setup_view_buffers - VIEW_UNK_2000 = 0x002000, // only see together with 0x4000 - VIEW_UNK_4000 = 0x004000, - VIEW_COLOUR_BUF = 0x008000, - VIEW_Z_BUF = 0x010000, - VIEW_1_CYCLE = 0x020000, - VIEW_MOVEMENT = 0x040000, - VIEW_DRAW = 0x080000, - VIEW_WAS_UPDATED = 0x100000, - VIEW_LIGHT = 0x200000 + VIEW_2_COL_BUF = (1 << 3), // 0x000008 + VIEW_ALLOC_ZBUF = (1 << 4), // 0x000010 + VIEW_SAVE_TO_GLOBAL = (1 << 6), // 0x000040 + VIEW_DEFAULT_PARENT = (1 << 8), // 0x000100 + VIEW_BORDERED = (1 << 10), // 0x000400 + VIEW_UPDATE = (1 << 11), // 0x000800 + VIEW_UNK_1000 = (1 << 12), // 0x001000 // used in setup_view_buffers + VIEW_UNK_2000 = (1 << 13), // 0x002000 // only see together with 0x4000 + VIEW_UNK_4000 = (1 << 14), // 0x004000 + VIEW_COLOUR_BUF = (1 << 15), // 0x008000 + VIEW_Z_BUF = (1 << 16), // 0x010000 + VIEW_1_CYCLE = (1 << 17), // 0x020000 + VIEW_MOVEMENT = (1 << 18), // 0x040000 + VIEW_DRAW = (1 << 19), // 0x080000 + VIEW_WAS_UPDATED = (1 << 20), // 0x100000 + VIEW_LIGHT = (1 << 21) // 0x200000 }; struct ObjView { diff --git a/src/menu/file_select.c b/src/menu/file_select.c index aa9f2a44..ad235103 100644 --- a/src/menu/file_select.c +++ b/src/menu/file_select.c @@ -1286,28 +1286,28 @@ void check_main_menu_clicked_buttons(void) { play_sound(SAVE_FILE_SOUND, gGlobalSoundSource); #if ENABLE_RUMBLE queue_rumble_data(60, 70); - func_sh_8024C89C(1); + queue_rumble_decay(1); #endif break; case MENU_BUTTON_PLAY_FILE_B: play_sound(SAVE_FILE_SOUND, gGlobalSoundSource); #if ENABLE_RUMBLE queue_rumble_data(60, 70); - func_sh_8024C89C(1); + queue_rumble_decay(1); #endif break; case MENU_BUTTON_PLAY_FILE_C: play_sound(SAVE_FILE_SOUND, gGlobalSoundSource); #if ENABLE_RUMBLE queue_rumble_data(60, 70); - func_sh_8024C89C(1); + queue_rumble_decay(1); #endif break; case MENU_BUTTON_PLAY_FILE_D: play_sound(SAVE_FILE_SOUND, gGlobalSoundSource); #if ENABLE_RUMBLE queue_rumble_data(60, 70); - func_sh_8024C89C(1); + queue_rumble_decay(1); #endif break; // Play sound of the button clicked and render buttons of that menu. diff --git a/src/menu/intro_geo.c b/src/menu/intro_geo.c index 48d53f8b..50c2574d 100644 --- a/src/menu/intro_geo.c +++ b/src/menu/intro_geo.c @@ -24,7 +24,7 @@ struct GraphNodeMore { /*0x00*/ struct GraphNode node; /*0x14*/ void *todo; - /*0x18*/ u32 unk18; + /*0x18*/ u32 bgTableID; }; // intro geo bss @@ -193,7 +193,7 @@ static s8 *introBackgroundTables[] = { introBackgroundIndexTable }; */ Gfx *geo_intro_regular_backdrop(s32 state, struct GraphNode *node, UNUSED void *context) { struct GraphNodeMore *graphNode = (struct GraphNodeMore *) node; - s32 index = graphNode->unk18 & 0xff; // TODO: word at offset 0x18 of struct GraphNode (always ends up being 0) + s32 index = graphNode->bgTableID & 0xff; // TODO: word at offset 0x18 of struct GraphNode (always ends up being 0) s8 *backgroundTable = introBackgroundTables[index]; Gfx *dl = NULL; Gfx *dlIter = NULL; diff --git a/src/menu/star_select.c b/src/menu/star_select.c index 624ff5c8..dfa46ea1 100644 --- a/src/menu/star_select.c +++ b/src/menu/star_select.c @@ -453,7 +453,7 @@ s32 lvl_update_obj_and_load_act_button_actions(UNUSED s32 arg, UNUSED s32 unused #endif #if ENABLE_RUMBLE queue_rumble_data(60, 70); - func_sh_8024C89C(1); + queue_rumble_decay(1); #endif if (sInitSelectedActNum >= sSelectedActIndex + 1) { sLoadedActNum = sSelectedActIndex + 1; diff --git a/src/menu/title_screen.c b/src/menu/title_screen.c index e3192e6b..9ba6aade 100644 --- a/src/menu/title_screen.c +++ b/src/menu/title_screen.c @@ -172,7 +172,7 @@ s32 intro_regular(void) { play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource); #if ENABLE_RUMBLE queue_rumble_data(60, 70); - func_sh_8024C89C(1); + queue_rumble_decay(1); #endif // calls level ID 100 (or 101 adding level select bool value) // defined in level_intro_mario_head_regular JUMP_IF commands @@ -204,7 +204,7 @@ s32 intro_game_over(void) { play_sound(SOUND_MENU_STAR_SOUND, gGlobalSoundSource); #if ENABLE_RUMBLE queue_rumble_data(60, 70); - func_sh_8024C89C(1); + queue_rumble_decay(1); #endif // same criteria as intro_regular level = 100 + gDebugLevelSelect;