Massive refactor

This commit is contained in:
jaburns
2020-10-27 11:07:42 -06:00
parent 48ab192e17
commit fcb6b5b431
85 changed files with 207 additions and 168 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
/src/mario /src/decomp/mario
/build/ /build/
/dist/ /dist/
/test/level.c /test/level.c
+6 -6
View File
@@ -4,7 +4,7 @@ CC := cc
CFLAGS := -g -Wall -fPIC CFLAGS := -g -Wall -fPIC
LDFLAGS := -lm -shared LDFLAGS := -lm -shared
SRC_DIRS := src src/engine src/game src/mario src/tools SRC_DIRS := src src/decomp src/decomp/engine src/decomp/game src/decomp/mario src/decomp/tools
BUILD_DIR := build BUILD_DIR := build
DIST_DIR := dist DIST_DIR := dist
ALL_DIRS := $(addprefix $(BUILD_DIR)/,$(SRC_DIRS)) ALL_DIRS := $(addprefix $(BUILD_DIR)/,$(SRC_DIRS))
@@ -13,7 +13,7 @@ LIB_FILE := $(DIST_DIR)/libsm64.so
LIB_H_FILE := $(DIST_DIR)/include/libsm64.h LIB_H_FILE := $(DIST_DIR)/include/libsm64.h
TEST_FILE := run-test TEST_FILE := run-test
C_IMPORTED := src/mario/geo.inc.c src/mario/model.inc.c C_IMPORTED := src/decomp/mario/geo.inc.c src/decomp/mario/model.inc.c
H_IMPORTED := $(C_IMPORTED:.c=.h) H_IMPORTED := $(C_IMPORTED:.c=.h)
IMPORTED := $(C_IMPORTED) $(H_IMPORTED) IMPORTED := $(C_IMPORTED) $(H_IMPORTED)
@@ -29,11 +29,11 @@ ifeq ($(OS),Windows_NT)
CFLAGS := $(CFLAGS) -DBUILDING_SM64_DLL CFLAGS := $(CFLAGS) -DBUILDING_SM64_DLL
endif endif
DUMMY != mkdir -p $(ALL_DIRS) build/test src/mario $(DIST_DIR)/include DUMMY != mkdir -p $(ALL_DIRS) build/test src/decomp/mario $(DIST_DIR)/include
$(filter-out src/mario/geo.inc.c,$(IMPORTED)): src/mario/geo.inc.c $(filter-out src/decomp/mario/geo.inc.c,$(IMPORTED)): src/decomp/mario/geo.inc.c
src/mario/geo.inc.c: ./import-mario-geo.py src/decomp/mario/geo.inc.c: ./import-mario-geo.py
./import-mario-geo.py ./import-mario-geo.py
$(BUILD_DIR)/%.o: %.c $(IMPORTED) $(BUILD_DIR)/%.o: %.c $(IMPORTED)
@@ -68,6 +68,6 @@ run: test
./$(TEST_FILE) ./$(TEST_FILE)
clean: clean:
rm -rf $(BUILD_DIR) $(DIST_DIR) src/mario test/level.? $(TEST_FILE) rm -rf $(BUILD_DIR) $(DIST_DIR) src/decomp/mario test/level.? $(TEST_FILE)
-include $(DEP_FILES) -include $(DEP_FILES)
+8 -8
View File
@@ -57,8 +57,8 @@ model_inc_h = """
def main(): def main():
global model_inc_h global model_inc_h
shutil.rmtree("src/mario", ignore_errors=True) shutil.rmtree("src/decomp/mario", ignore_errors=True)
os.makedirs("src/mario", exist_ok=True) os.makedirs("src/decomp/mario", exist_ok=True)
print("Downloading " + GEO_URL) print("Downloading " + GEO_URL)
geo_inc_c = urllib.request.urlopen(GEO_URL).read().decode('utf8') geo_inc_c = urllib.request.urlopen(GEO_URL).read().decode('utf8')
@@ -78,21 +78,21 @@ def main():
elif lines[i].startswith("const "): elif lines[i].startswith("const "):
model_inc_h += "\nextern " + lines[i].replace(" = {", ";") model_inc_h += "\nextern " + lines[i].replace(" = {", ";")
lines.insert(0, "#include \"../gfx_macros.h\"") lines.insert(0, "#include \"../../gfx_macros.h\"")
lines.insert(0, "#include \"../load_tex_data.h\"") lines.insert(0, "#include \"../../load_tex_data.h\"")
model_inc_c = "\n".join(lines) model_inc_c = "\n".join(lines)
with open("src/mario/geo.inc.c", "w") as file: with open("src/decomp/mario/geo.inc.c", "w") as file:
file.write(geo_inc_c_header + geo_inc_c + geo_inc_c_footer) file.write(geo_inc_c_header + geo_inc_c + geo_inc_c_footer)
with open("src/mario/model.inc.c", "w") as file: with open("src/decomp/mario/model.inc.c", "w") as file:
file.write(model_inc_c) file.write(model_inc_c)
with open("src/mario/model.inc.h", "w") as file: with open("src/decomp/mario/model.inc.h", "w") as file:
file.write(model_inc_h) file.write(model_inc_h)
with open("src/mario/geo.inc.h", "w") as file: with open("src/decomp/mario/geo.inc.h", "w") as file:
file.write(geo_inc_h) file.write(geo_inc_h)
if __name__ == "__main__": if __name__ == "__main__":
@@ -10,13 +10,9 @@
#include "../shim.h" #include "../shim.h"
// unused Mtx(s) // unused Mtx(s)
s16 identityMtx[4][4] = { { 1, 0, 0, 0 }, { 0, 1, 0, 0 }, { 0, 0, 1, 0 }, { 0, 0, 0, 1 } }; static Vec3f gVec3fZero = { 0.0f, 0.0f, 0.0f };
s16 zeroMtx[4][4] = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 } }; static Vec3s gVec3sZero = { 0, 0, 0 };
static Vec3f gVec3fOne = { 1.0f, 1.0f, 1.0f };
Vec3f gVec3fZero = { 0.0f, 0.0f, 0.0f };
Vec3s gVec3sZero = { 0, 0, 0 };
Vec3f gVec3fOne = { 1.0f, 1.0f, 1.0f };
UNUSED Vec3s gVec3sOne = { 1, 1, 1 };
/** /**
* Initialize a geo node with a given type. Sets all links such that there * Initialize a geo node with a given type. Sets all links such that there
@@ -5,7 +5,7 @@
#include "../include/PR/gbi.h" #include "../include/PR/gbi.h"
#include "../include/types.h" #include "../include/types.h"
#include "../memory.h" #include "../../memory.h"
#define GRAPH_RENDER_ACTIVE (1 << 0) #define GRAPH_RENDER_ACTIVE (1 << 0)
#define GRAPH_RENDER_CHILDREN_FIRST (1 << 1) #define GRAPH_RENDER_CHILDREN_FIRST (1 << 1)
@@ -3,12 +3,11 @@
#include <math.h> #include <math.h>
#include "../shim.h" #include "../shim.h"
#include "../guMtxF2L.h" #include "../../guMtxF2L.h"
#include "../include/sm64.h" #include "../include/sm64.h"
#include "graph_node.h" #include "graph_node.h"
#include "surface_collision.h" #include "surface_collision.h"
// PATCH
static Vec3f gVec3fZero = { 0.0f, 0.0f, 0.0f }; static Vec3f gVec3fZero = { 0.0f, 0.0f, 0.0f };
// Inlined tables // Inlined tables
@@ -3,7 +3,7 @@
#include "../shim.h" #include "../shim.h"
#include "surface_collision.h" #include "surface_collision.h"
#include "../include/surface_terrains.h" #include "../include/surface_terrains.h"
#include "../load_surfaces.h" #include "../../load_surfaces.h"
/** /**
* Iterate through the list of ceilings and find the first ceiling over a given point. * Iterate through the list of ceilings and find the first ceiling over a given point.
@@ -871,11 +871,11 @@ void check_lava_boost(struct MarioState *m) {
} }
void pss_begin_slide(UNUSED struct MarioState *m) { void pss_begin_slide(UNUSED struct MarioState *m) {
if (!(gHudDisplay.flags & HUD_DISPLAY_FLAG_TIMER)) { // if (!(gHudDisplay.flags & HUD_DISPLAY_FLAG_TIMER)) {
level_control_timer(TIMER_CONTROL_SHOW); // level_control_timer(TIMER_CONTROL_SHOW);
level_control_timer(TIMER_CONTROL_START); // level_control_timer(TIMER_CONTROL_START);
sPssSlideStarted = TRUE; // sPssSlideStarted = TRUE;
} // }
} }
void pss_end_slide(struct MarioState *m) { void pss_end_slide(struct MarioState *m) {
+9 -14
View File
@@ -39,9 +39,6 @@
// #include "thread6.h" // #include "thread6.h"
u32 unused80339F10;
s8 filler80339F1C[20];
/************************************************** /**************************************************
* ANIMATIONS * * ANIMATIONS *
**************************************************/ **************************************************/
@@ -1521,14 +1518,14 @@ void update_mario_health(struct MarioState *m) {
* Updates some basic info for camera usage. * Updates some basic info for camera usage.
*/ */
void update_mario_info_for_cam(struct MarioState *m) { void update_mario_info_for_cam(struct MarioState *m) {
m->marioBodyState->action = m->action; // m->marioBodyState->action = m->action;
m->statusForCamera->action = m->action; // m->statusForCamera->action = m->action;
vec3s_copy(m->statusForCamera->faceAngle, m->faceAngle); // vec3s_copy(m->statusForCamera->faceAngle, m->faceAngle);
if (!(m->flags & MARIO_UNKNOWN_25)) { // if (!(m->flags & MARIO_UNKNOWN_25)) {
vec3f_copy(m->statusForCamera->pos, m->pos); // vec3f_copy(m->statusForCamera->pos, m->pos);
} // }
} }
/** /**
@@ -1796,8 +1793,6 @@ void init_mario(void) {
//Vec3s capPos; //Vec3s capPos;
//struct Object *capObject; //struct Object *capObject;
unused80339F10 = 0;
gMarioState->actionTimer = 0; gMarioState->actionTimer = 0;
gMarioState->framesSinceA = 0xFF; gMarioState->framesSinceA = 0xFF;
gMarioState->framesSinceB = 0xFF; gMarioState->framesSinceB = 0xFF;
@@ -1882,7 +1877,7 @@ void init_mario_from_save_file(void) {
gMarioState->flags = 0; gMarioState->flags = 0;
gMarioState->action = 0; gMarioState->action = 0;
gMarioState->spawnInfo = gMarioSpawnInfo; gMarioState->spawnInfo = gMarioSpawnInfo;
gMarioState->statusForCamera = &gPlayerCameraState; // PATCH // gMarioState->statusForCamera = &gPlayerCameraState;
gMarioState->marioBodyState = &gBodyStates[0]; gMarioState->marioBodyState = &gBodyStates[0];
gMarioState->controller = &gController; gMarioState->controller = &gController;
gMarioState->animation = &D_80339D10; gMarioState->animation = &D_80339D10;
@@ -1898,6 +1893,6 @@ void init_mario_from_save_file(void) {
gMarioState->prevNumStarsForDialog = gMarioState->numStars; gMarioState->prevNumStarsForDialog = gMarioState->numStars;
gMarioState->unkB0 = 0xBD; gMarioState->unkB0 = 0xBD;
gHudDisplay.coins = 0; // gHudDisplay.coins = 0;
gHudDisplay.wedges = 8; // gHudDisplay.wedges = 8;
} }
@@ -1663,9 +1663,9 @@ s32 act_jump_kick(struct MarioState *m) {
} }
s32 act_shot_from_cannon(struct MarioState *m) { s32 act_shot_from_cannon(struct MarioState *m) {
if (m->area->camera->mode != CAMERA_MODE_BEHIND_MARIO) { // if (m->area->camera->mode != CAMERA_MODE_BEHIND_MARIO) {
m->statusForCamera->cameraEvent = CAM_EVENT_SHOT_FROM_CANNON; // m->statusForCamera->cameraEvent = CAM_EVENT_SHOT_FROM_CANNON;
} // }
mario_set_forward_vel(m, m->forwardVel); mario_set_forward_vel(m, m->forwardVel);
@@ -524,18 +524,18 @@ void climb_up_ledge(struct MarioState *m) {
} }
void update_ledge_climb_camera(struct MarioState *m) { void update_ledge_climb_camera(struct MarioState *m) {
f32 sp4; // f32 sp4;
if (m->actionTimer < 14) { // if (m->actionTimer < 14) {
sp4 = m->actionTimer; // sp4 = m->actionTimer;
} else { // } else {
sp4 = 14.0f; // sp4 = 14.0f;
} // }
m->statusForCamera->pos[0] = m->pos[0] + sp4 * sins(m->faceAngle[1]); // m->statusForCamera->pos[0] = m->pos[0] + sp4 * sins(m->faceAngle[1]);
m->statusForCamera->pos[2] = m->pos[2] + sp4 * coss(m->faceAngle[1]); // m->statusForCamera->pos[2] = m->pos[2] + sp4 * coss(m->faceAngle[1]);
m->statusForCamera->pos[1] = m->pos[1]; // m->statusForCamera->pos[1] = m->pos[1];
m->actionTimer++; // m->actionTimer++;
m->flags |= MARIO_UNKNOWN_25; // m->flags |= MARIO_UNKNOWN_25;
} }
void update_ledge_climb(struct MarioState *m, s32 animation, u32 endAction) { void update_ledge_climb(struct MarioState *m, s32 animation, u32 endAction) {
@@ -692,8 +692,8 @@ s32 act_in_cannon(struct MarioState *m) {
m->marioObj->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE; m->marioObj->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
m->usedObj->oInteractStatus = INT_STATUS_INTERACTED; m->usedObj->oInteractStatus = INT_STATUS_INTERACTED;
m->statusForCamera->cameraEvent = CAM_EVENT_CANNON; // m->statusForCamera->cameraEvent = CAM_EVENT_CANNON;
m->statusForCamera->usedObj = m->usedObj; // m->statusForCamera->usedObj = m->usedObj;
vec3f_set(m->vel, 0.0f, 0.0f, 0.0f); vec3f_set(m->vel, 0.0f, 0.0f, 0.0f);
@@ -1693,10 +1693,10 @@ static void advance_cutscene_step(struct MarioState *m) {
} }
static void intro_cutscene_hide_hud_and_mario(struct MarioState *m) { static void intro_cutscene_hide_hud_and_mario(struct MarioState *m) {
gHudDisplay.flags = HUD_DISPLAY_NONE; // gHudDisplay.flags = HUD_DISPLAY_NONE;
m->statusForCamera->cameraEvent = CAM_EVENT_START_INTRO; // m->statusForCamera->cameraEvent = CAM_EVENT_START_INTRO;
m->marioObj->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE; // m->marioObj->header.gfx.node.flags &= ~GRAPH_RENDER_ACTIVE;
advance_cutscene_step(m); // advance_cutscene_step(m);
} }
#ifdef VERSION_EU #ifdef VERSION_EU
@@ -1842,29 +1842,29 @@ static s32 act_intro_cutscene(struct MarioState *m) {
// jumbo star cutscene: Mario lands after grabbing the jumbo star // jumbo star cutscene: Mario lands after grabbing the jumbo star
static void jumbo_star_cutscene_falling(struct MarioState *m) { static void jumbo_star_cutscene_falling(struct MarioState *m) {
if (m->actionState == 0) { // if (m->actionState == 0) {
m->input |= INPUT_A_DOWN; // m->input |= INPUT_A_DOWN;
m->flags |= (MARIO_WING_CAP | MARIO_CAP_ON_HEAD); // m->flags |= (MARIO_WING_CAP | MARIO_CAP_ON_HEAD);
m->faceAngle[1] = -0x8000; // m->faceAngle[1] = -0x8000;
m->pos[0] = 0.0f; // m->pos[0] = 0.0f;
m->pos[2] = 0.0f; // m->pos[2] = 0.0f;
mario_set_forward_vel(m, 0.0f); // mario_set_forward_vel(m, 0.0f);
set_mario_animation(m, MARIO_ANIM_GENERAL_FALL); // set_mario_animation(m, MARIO_ANIM_GENERAL_FALL);
if (perform_air_step(m, 1) == AIR_STEP_LANDED) { // if (perform_air_step(m, 1) == AIR_STEP_LANDED) {
play_cutscene_music(SEQUENCE_ARGS(15, SEQ_EVENT_CUTSCENE_VICTORY)); // play_cutscene_music(SEQUENCE_ARGS(15, SEQ_EVENT_CUTSCENE_VICTORY));
play_mario_landing_sound(m, SOUND_ACTION_TERRAIN_LANDING); // play_mario_landing_sound(m, SOUND_ACTION_TERRAIN_LANDING);
m->actionState++; // m->actionState++;
} // }
} else { // } else {
set_mario_animation(m, MARIO_ANIM_GENERAL_LAND); // set_mario_animation(m, MARIO_ANIM_GENERAL_LAND);
if (is_anim_at_end(m)) { // if (is_anim_at_end(m)) {
m->statusForCamera->cameraEvent = CAM_EVENT_START_GRAND_STAR; // m->statusForCamera->cameraEvent = CAM_EVENT_START_GRAND_STAR;
advance_cutscene_step(m); // advance_cutscene_step(m);
} // }
} // }
} }
// jumbo star cutscene: Mario takes off // jumbo star cutscene: Mario takes off
@@ -2031,20 +2031,20 @@ void generate_yellow_sparkles(s16 x, s16 y, s16 z, f32 radius) {
// make Mario fall and soften wing cap gravity // make Mario fall and soften wing cap gravity
static void end_peach_cutscene_mario_falling(struct MarioState *m) { static void end_peach_cutscene_mario_falling(struct MarioState *m) {
if (m->actionTimer == 1) { // if (m->actionTimer == 1) {
m->statusForCamera->cameraEvent = CAM_EVENT_START_ENDING; // m->statusForCamera->cameraEvent = CAM_EVENT_START_ENDING;
} // }
m->input |= INPUT_A_DOWN; // m->input |= INPUT_A_DOWN;
m->flags |= (MARIO_WING_CAP | MARIO_CAP_ON_HEAD); // m->flags |= (MARIO_WING_CAP | MARIO_CAP_ON_HEAD);
set_mario_animation(m, MARIO_ANIM_GENERAL_FALL); // set_mario_animation(m, MARIO_ANIM_GENERAL_FALL);
mario_set_forward_vel(m, 0.0f); // mario_set_forward_vel(m, 0.0f);
if (perform_air_step(m, 0) == AIR_STEP_LANDED) { // if (perform_air_step(m, 0) == AIR_STEP_LANDED) {
play_mario_landing_sound(m, SOUND_ACTION_TERRAIN_LANDING); // play_mario_landing_sound(m, SOUND_ACTION_TERRAIN_LANDING);
advance_cutscene_step(m); // advance_cutscene_step(m);
} // }
} }
// set Mario on the ground, wait and spawn the jumbo star outside the castle. // set Mario on the ground, wait and spawn the jumbo star outside the castle.
@@ -1073,14 +1073,14 @@ s32 act_first_person(struct MarioState *m) {
return set_mario_action(m, ACT_IDLE, 0); return set_mario_action(m, ACT_IDLE, 0);
} }
if (m->floor->type == SURFACE_LOOK_UP_WARP // if (m->floor->type == SURFACE_LOOK_UP_WARP
&& save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1) >= 10) { // && save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1) >= 10) {
s16 sp1A = m->statusForCamera->headRotation[0]; // s16 sp1A = m->statusForCamera->headRotation[0];
s16 sp18 = ((m->statusForCamera->headRotation[1] * 4) / 3) + m->faceAngle[1]; // s16 sp18 = ((m->statusForCamera->headRotation[1] * 4) / 3) + m->faceAngle[1];
if (sp1A == -0x1800 && (sp18 < -0x6FFF || sp18 >= 0x7000)) { // if (sp1A == -0x1800 && (sp18 < -0x6FFF || sp18 >= 0x7000)) {
level_trigger_warp(m, WARP_OP_UNKNOWN_01); // level_trigger_warp(m, WARP_OP_UNKNOWN_01);
} // }
} // }
stationary_ground_step(m); stationary_ground_step(m);
set_mario_animation(m, MARIO_ANIM_FIRST_PERSON); set_mario_animation(m, MARIO_ANIM_FIRST_PERSON);
@@ -79,7 +79,7 @@ static s8 gMarioAttackScaleAnimation[3 * 6] = {
}; };
struct MarioBodyState gBodyStates[2]; // 2nd is never accessed in practice, most likely Luigi related struct MarioBodyState gBodyStates[2]; // 2nd is never accessed in practice, most likely Luigi related
struct GraphNodeObject gMirrorMario; // copy of Mario's geo node for drawing mirror Mario //struct GraphNodeObject gMirrorMario; // copy of Mario's geo node for drawing mirror Mario
// This whole file is weirdly organized. It has to be the same file due // This whole file is weirdly organized. It has to be the same file due
// to rodata boundaries and function aligns, which means the programmer // to rodata boundaries and function aligns, which means the programmer
@@ -594,40 +594,40 @@ Gfx *geo_switch_mario_hand_grab_pos(s32 callContext, struct GraphNode *b, Mat4 *
* a mirror image of the player. * a mirror image of the player.
*/ */
Gfx *geo_render_mirror_mario(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) { Gfx *geo_render_mirror_mario(s32 callContext, struct GraphNode *node, UNUSED Mat4 *c) {
f32 mirroredX; // f32 mirroredX;
struct Object *mario = gMarioState->marioObj; // PATCH gMarioStates[0].marioObj; // struct Object *mario = gMarioState->marioObj; // PATCH gMarioStates[0].marioObj;
switch (callContext) { // switch (callContext) {
case GEO_CONTEXT_CREATE: // case GEO_CONTEXT_CREATE:
init_graph_node_object(NULL, &gMirrorMario, NULL, gVec3fZero, gVec3sZero, gVec3fOne); // init_graph_node_object(NULL, &gMirrorMario, NULL, gVec3fZero, gVec3sZero, gVec3fOne);
break; // break;
case GEO_CONTEXT_AREA_LOAD: // case GEO_CONTEXT_AREA_LOAD:
geo_add_child(node, &gMirrorMario.node); // geo_add_child(node, &gMirrorMario.node);
break; // break;
case GEO_CONTEXT_AREA_UNLOAD: // case GEO_CONTEXT_AREA_UNLOAD:
geo_remove_child(&gMirrorMario.node); // geo_remove_child(&gMirrorMario.node);
break; // break;
case GEO_CONTEXT_RENDER: // case GEO_CONTEXT_RENDER:
if (mario->header.gfx.pos[0] > 1700.0f) { // if (mario->header.gfx.pos[0] > 1700.0f) {
// TODO: Is this a geo layout copy or a graph node copy? // // TODO: Is this a geo layout copy or a graph node copy?
gMirrorMario.sharedChild = mario->header.gfx.sharedChild; // gMirrorMario.sharedChild = mario->header.gfx.sharedChild;
gMirrorMario.areaIndex = mario->header.gfx.areaIndex; // gMirrorMario.areaIndex = mario->header.gfx.areaIndex;
vec3s_copy(gMirrorMario.angle, mario->header.gfx.angle); // vec3s_copy(gMirrorMario.angle, mario->header.gfx.angle);
vec3f_copy(gMirrorMario.pos, mario->header.gfx.pos); // vec3f_copy(gMirrorMario.pos, mario->header.gfx.pos);
vec3f_copy(gMirrorMario.scale, mario->header.gfx.scale); // vec3f_copy(gMirrorMario.scale, mario->header.gfx.scale);
gMirrorMario.animInfo = mario->header.gfx.animInfo; // gMirrorMario.animInfo = mario->header.gfx.animInfo;
mirroredX = MIRROR_X - gMirrorMario.pos[0]; // mirroredX = MIRROR_X - gMirrorMario.pos[0];
gMirrorMario.pos[0] = mirroredX + MIRROR_X; // gMirrorMario.pos[0] = mirroredX + MIRROR_X;
gMirrorMario.angle[1] = -gMirrorMario.angle[1]; // gMirrorMario.angle[1] = -gMirrorMario.angle[1];
gMirrorMario.scale[0] *= -1.0f; // gMirrorMario.scale[0] *= -1.0f;
((struct GraphNode *) &gMirrorMario)->flags |= 1; // ((struct GraphNode *) &gMirrorMario)->flags |= 1;
} else { // } else {
((struct GraphNode *) &gMirrorMario)->flags &= ~1; // ((struct GraphNode *) &gMirrorMario)->flags &= ~1;
} // }
break; // break;
} // }
return NULL; // return NULL;
} }
/** /**
@@ -14,7 +14,7 @@
//#include "shadow.h" //#include "shadow.h"
#include "../include/sm64.h" #include "../include/sm64.h"
#include "../shim.h" #include "../shim.h"
#include "../gfx_adapter.h" #include "../../gfx_adapter.h"
+3
View File
@@ -0,0 +1,3 @@
#include "global_state.h"
struct GlobalState *gState = 0;
+48
View File
@@ -0,0 +1,48 @@
#pragma once
#include "include/types.h"
#include "game/area.h"
struct GlobalState
{
// interaction.c
u8 sDelayInvincTimer;
s16 sInvulnerable;
// mario_actions_moving.c
Mat4 sFloorAlignMatrix;
// mario_actions_submerged.c
s16 sWasAtSurface;
s16 sSwimStrength;
s16 D_80339FD0;
s16 D_80339FD2;
f32 D_80339FD4;
// mario_misc.c
struct MarioBodyState gBodyStates[2];
// platform_displacement.c
void *gMarioPlatform;
// misc
u32 gGlobalTimer;
u8 gSpecialTripleJump;
s16 gCurrLevelNum;
s16 gCameraMovementFlags;
u32 gAudioRandom;
s8 gShowDebugText;
s8 gDebugLevelSelect;
s16 gCurrSaveFileNum;
struct Controller gController;
struct SpawnInfo gMarioSpawnInfoVal;
struct SpawnInfo *gMarioSpawnInfo;
struct Area *gCurrentArea;
struct Object *gCurrentObject;
struct Object *gMarioObject;
struct MarioAnimation D_80339D10;
struct MarioState gMarioStateVal;
struct MarioState *gMarioState;
};
extern struct GlobalState *gState;
@@ -323,7 +323,7 @@ struct MarioState
/*0x88*/ struct Object *marioObj; /*0x88*/ struct Object *marioObj;
/*0x8C*/ struct SpawnInfo *spawnInfo; /*0x8C*/ struct SpawnInfo *spawnInfo;
/*0x90*/ struct Area *area; /*0x90*/ struct Area *area;
/*0x94*/ struct PlayerCameraState *statusForCamera; // /*0x94*/ struct PlayerCameraState *statusForCamera;
/*0x98*/ struct MarioBodyState *marioBodyState; /*0x98*/ struct MarioBodyState *marioBodyState;
/*0x9C*/ struct Controller *controller; /*0x9C*/ struct Controller *controller;
/*0xA0*/ struct MarioAnimation *animation; /*0xA0*/ struct MarioAnimation *animation;
+1 -2
View File
@@ -1,10 +1,9 @@
#include <string.h> #include <string.h>
#include "shim.h" #include "shim.h"
#include "load_anim_data.h" #include "../load_anim_data.h"
u32 gGlobalTimer = 0; u32 gGlobalTimer = 0;
u8 gSpecialTripleJump = FALSE; u8 gSpecialTripleJump = FALSE;
struct HudDisplay gHudDisplay;
s16 gCurrLevelNum = 0; s16 gCurrLevelNum = 0;
s16 gCameraMovementFlags = 0; s16 gCameraMovementFlags = 0;
u32 gAudioRandom = 0; u32 gAudioRandom = 0;
+1 -2
View File
@@ -3,7 +3,7 @@
#include "include/types.h" #include "include/types.h"
#include "game/area.h" #include "game/area.h"
#include "game/level_update.h" #include "game/level_update.h"
#include "libsm64.h" #include "../libsm64.h"
#define COURSE_MIN 0 #define COURSE_MIN 0
#define COURSE_MAX 14 #define COURSE_MAX 14
@@ -44,7 +44,6 @@ struct SurfaceNode
extern u32 gGlobalTimer; extern u32 gGlobalTimer;
extern u8 gSpecialTripleJump; extern u8 gSpecialTripleJump;
extern struct HudDisplay gHudDisplay;
extern s16 gCurrLevelNum; extern s16 gCurrLevelNum;
extern s16 gCameraMovementFlags; extern s16 gCameraMovementFlags;
extern u32 gAudioRandom; extern u32 gAudioRandom;
+1 -1
View File
@@ -2,7 +2,7 @@
#include <string.h> #include <string.h>
#include "libsm64.h" #include "libsm64.h"
#include "engine/math_util.h" #include "decomp/engine/math_util.h"
#include "guMtxF2L.h" #include "guMtxF2L.h"
#include "gfx_adapter.h" #include "gfx_adapter.h"
#include "gfx_adapter_commands.h" #include "gfx_adapter_commands.h"
+1 -1
View File
@@ -1,6 +1,6 @@
#pragma once #pragma once
#include "engine/graph_node.h" #include "decomp/engine/graph_node.h"
#include "libsm64.h" #include "libsm64.h"
// Commented out in gbi.h - Replaced here // Commented out in gbi.h - Replaced here
+1 -1
View File
@@ -1,6 +1,6 @@
#pragma once #pragma once
#include "include/types.h" #include "decomp/include/types.h"
#include "gfx_adapter_commands.h" #include "gfx_adapter_commands.h"
/* /*
+1 -1
View File
@@ -1,6 +1,6 @@
#pragma once #pragma once
#include "include/PR/gbi.h" #include "decomp/include/PR/gbi.h"
extern void guMtxF2L(float mf[4][4], Mtx *m); extern void guMtxF2L(float mf[4][4], Mtx *m);
extern void guMtxL2F(float mf[4][4], Mtx *m); extern void guMtxL2F(float mf[4][4], Mtx *m);
+13 -12
View File
@@ -6,22 +6,23 @@
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include "include/PR/os_cont.h" #include "decomp/include/PR/os_cont.h"
#include "engine/math_util.h" #include "decomp/engine/math_util.h"
#include "include/sm64.h" #include "decomp/include/sm64.h"
#include "shim.h" #include "decomp/shim.h"
#include "game/mario.h" #include "decomp/game/mario.h"
#include "game/object_stuff.h" #include "decomp/game/object_stuff.h"
#include "engine/surface_collision.h" #include "decomp/engine/surface_collision.h"
#include "engine/graph_node.h" #include "decomp/engine/graph_node.h"
#include "engine/geo_layout.h" #include "decomp/engine/geo_layout.h"
#include "game/rendering_graph_node.h" #include "decomp/game/rendering_graph_node.h"
#include "mario/geo.inc.h" #include "decomp/mario/geo.inc.h"
#include "decomp/game/platform_displacement.h"
#include "load_surfaces.h" #include "load_surfaces.h"
#include "gfx_adapter.h" #include "gfx_adapter.h"
#include "load_anim_data.h" #include "load_anim_data.h"
#include "load_tex_data.h" #include "load_tex_data.h"
#include "game/platform_displacement.h"
static struct AllocOnlyPool *s_mario_geo_pool; static struct AllocOnlyPool *s_mario_geo_pool;
static struct GraphNode *s_mario_graph_node; static struct GraphNode *s_mario_graph_node;
-1
View File
@@ -1,5 +1,4 @@
#include "load_anim_data.h" #include "load_anim_data.h"
#include "include/types.h"
#include <stdlib.h> #include <stdlib.h>
+1 -1
View File
@@ -3,7 +3,7 @@
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>
#include "include/types.h" #include "decomp/include/types.h"
extern struct Animation *gLibSm64MarioAnimations; extern struct Animation *gLibSm64MarioAnimations;
+4 -4
View File
@@ -3,10 +3,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "include/types.h" #include "decomp/include/types.h"
#include "include/surface_terrains.h" #include "decomp/include/surface_terrains.h"
#include "engine/math_util.h" #include "decomp/engine/math_util.h"
#include "shim.h" #include "decomp/shim.h"
struct LoadedSurfaceObject struct LoadedSurfaceObject
{ {
+2 -2
View File
@@ -4,8 +4,8 @@
#include <string.h> #include <string.h>
#include "libsm64.h" #include "libsm64.h"
#include "tools/libmio0.h" #include "decomp/tools/libmio0.h"
#include "tools/n64graphics.h" #include "decomp/tools/n64graphics.h"
#define MARIO_TEX_ROM_OFFSET 1132368 #define MARIO_TEX_ROM_OFFSET 1132368
#define ATLAS_WIDTH (NUM_USED_TEXTURES * 64) #define ATLAS_WIDTH (NUM_USED_TEXTURES * 64)
+1 -1
View File
@@ -1,6 +1,6 @@
#pragma once #pragma once
#include "include/types.h" #include "decomp/include/types.h"
struct AllocOnlyPool; struct AllocOnlyPool;