Moved mario global state vars in to struct

This commit is contained in:
jaburns
2020-10-27 15:11:12 -06:00
parent 0c67335112
commit b921cb04bb
15 changed files with 186 additions and 272 deletions
+3 -2
View File
@@ -37,6 +37,7 @@
#include "save_file.h"
// #include "sound_init.h"
// #include "thread6.h"
#include "../../load_anim_data.h"
/**************************************************
@@ -67,7 +68,7 @@ s32 is_anim_past_end(struct MarioState *m) {
s16 set_mario_animation(struct MarioState *m, s32 targetAnimID) {
struct Object *o = m->marioObj;
shim_load_mario_animation(m->animation, targetAnimID);
load_mario_animation(m->animation, targetAnimID);
struct Animation *targetAnim = m->animation->targetAnim;
//if (load_patchable_table(m->animation, targetAnimID)) {
// targetAnim->values = (void *) VIRTUAL_TO_PHYSICAL((u8 *) targetAnim + (uintptr_t) targetAnim->values);
@@ -101,7 +102,7 @@ s16 set_mario_animation(struct MarioState *m, s32 targetAnimID) {
s16 set_mario_anim_with_accel(struct MarioState *m, s32 targetAnimID, s32 accel) {
struct Object *o = m->marioObj;
shim_load_mario_animation(m->animation, targetAnimID);
load_mario_animation(m->animation, targetAnimID);
struct Animation *targetAnim = m->animation->targetAnim;
//if (load_patchable_table(m->animation, targetAnimID)) {
// targetAnim->values = (void *) VIRTUAL_TO_PHYSICAL((u8 *) targetAnim + (uintptr_t) targetAnim->values);
-4
View File
@@ -260,10 +260,6 @@ void bhv_mario_update(void) {
// }
}
void create_transformation_from_matrices(Mat4 a0, Mat4 a1, Mat4 a2) {
f32 spC, sp8, sp4;
+7 -7
View File
@@ -7,8 +7,8 @@
#include "object_stuff.h"
#include "platform_displacement.h"
#include "../shim.h"
struct SurfaceObjectTransform *gMarioPlatform = NULL;
#include "../global_state.h"
#include "../../load_surfaces.h"
#define absfx( x ) ( (x) < 0.0f ? -(x) : (x) )
@@ -47,16 +47,16 @@ void update_mario_platform(void) {
switch (awayFromFloor) {
case 1:
gMarioPlatform = NULL;
g_state->mgMarioPlatform = NULL;
gMarioObject->platform = NULL;
break;
case 0:
if (floor != NULL && floor->object != NULL) {
gMarioPlatform = (struct SurfaceObjectTransform *)floor->object;
g_state->mgMarioPlatform = floor->object;
gMarioObject->platform = floor->object;
} else {
gMarioPlatform = NULL;
g_state->mgMarioPlatform = NULL;
gMarioObject->platform = NULL;
}
break;
@@ -166,7 +166,7 @@ void apply_platform_displacement(u32 isMario, struct SurfaceObjectTransform *pla
* If Mario's platform is not null, apply platform displacement.
*/
void apply_mario_platform_displacement(void) {
struct SurfaceObjectTransform *platform = gMarioPlatform;
struct SurfaceObjectTransform *platform = g_state->mgMarioPlatform;
if (gMarioObject != NULL && platform != NULL) {
apply_platform_displacement(TRUE, platform);
@@ -177,5 +177,5 @@ void apply_mario_platform_displacement(void) {
* Set Mario's platform to NULL.
*/
void clear_mario_platform(void) {
gMarioPlatform = NULL;
g_state->mgMarioPlatform = NULL;
}
+5 -5
View File
@@ -83,7 +83,7 @@ extern u8 gLastCompletedStarNum;
extern s8 sUnusedGotGlobalCoinHiScore;
extern u8 gGotFileCoinHiScore;
extern u8 gCurrCourseStarFlags;
extern u8 gSpecialTripleJump;
//extern u8 gSpecialTripleJump;
extern s8 gLevelToCourseNumTable[];
// game progress flags
@@ -142,10 +142,10 @@ void save_file_collect_star_or_key(s16 coinScore, s16 starIndex);
s32 save_file_exists(s32 fileIndex);
u32 save_file_get_max_coin_score(s32 courseIndex);
s32 save_file_get_course_star_count(s32 fileIndex, s32 courseIndex);
s32 save_file_get_total_star_count(s32 fileIndex, s32 minCourse, s32 maxCourse);
void save_file_set_flags(u32 flags);
void save_file_clear_flags(u32 flags);
u32 save_file_get_flags(void);
//s32 save_file_get_total_star_count(s32 fileIndex, s32 minCourse, s32 maxCourse);
//void save_file_set_flags(u32 flags);
//void save_file_clear_flags(u32 flags);
//u32 save_file_get_flags(void);
u32 save_file_get_star_flags(s32 fileIndex, s32 courseIndex);
void save_file_set_star_flags(s32 fileIndex, s32 courseIndex, u32 starFlags);
s32 save_file_get_course_coin_score(s32 fileIndex, s32 courseIndex);