Made specialTripleJump a field of MarioState instead of a global

This commit is contained in:
MysterD 2022-04-23 00:35:49 -07:00
parent 58282f7752
commit 71105833c5
10 changed files with 11 additions and 9 deletions

View file

@ -665,6 +665,7 @@
--- @field public slideVelZ number --- @field public slideVelZ number
--- @field public slideYaw integer --- @field public slideYaw integer
--- @field public spawnInfo SpawnInfo --- @field public spawnInfo SpawnInfo
--- @field public specialTripleJump integer
--- @field public splineKeyframeFraction number --- @field public splineKeyframeFraction number
--- @field public splineState integer --- @field public splineState integer
--- @field public squishTimer integer --- @field public squishTimer integer

View file

@ -956,6 +956,7 @@
| slideVelZ | `number` | | | slideVelZ | `number` | |
| slideYaw | `integer` | | | slideYaw | `integer` | |
| spawnInfo | [SpawnInfo](structs.md#SpawnInfo) | | | spawnInfo | [SpawnInfo](structs.md#SpawnInfo) | |
| specialTripleJump | `integer` | |
| splineKeyframeFraction | `number` | | | splineKeyframeFraction | `number` | |
| splineState | `integer` | | | splineState | `integer` | |
| squishTimer | `integer` | | | squishTimer | `integer` | |

View file

@ -385,6 +385,7 @@ struct MarioState
/*????*/ f32 minimumBoneY; /*????*/ f32 minimumBoneY;
/*????*/ f32 curAnimOffset; /*????*/ f32 curAnimOffset;
/*????*/ u8 knockbackTimer; /*????*/ u8 knockbackTimer;
/*????*/ u8 specialTripleJump;
}; };
struct TextureInfo struct TextureInfo

View file

@ -150,7 +150,7 @@ void yoshi_give_present_loop(void) {
if (gHudDisplay.lives == 100) { if (gHudDisplay.lives == 100) {
play_sound(SOUND_GENERAL_COLLECT_1UP, gGlobalSoundSource); play_sound(SOUND_GENERAL_COLLECT_1UP, gGlobalSoundSource);
gSpecialTripleJump = TRUE; gMarioStates[0].specialTripleJump = true;
o->oAction = YOSHI_ACT_WALK_JUMP_OFF_ROOF; o->oAction = YOSHI_ACT_WALK_JUMP_OFF_ROOF;
return; return;
} }
@ -226,7 +226,7 @@ void bhv_yoshi_loop(void) {
if (sYoshiTalkingState > 2) { if (sYoshiTalkingState > 2) {
if (gHudDisplay.lives >= 100) { if (gHudDisplay.lives >= 100) {
gSpecialTripleJump = 1; gMarioStates[0].specialTripleJump = true;
sYoshiTalkingState = 3; sYoshiTalkingState = 3;
} else if ((gGlobalTimer & 0x03) == 0) { } else if ((gGlobalTimer & 0x03) == 0) {
play_sound(SOUND_MENU_YOSHI_GAIN_LIVES, gGlobalSoundSource); play_sound(SOUND_MENU_YOSHI_GAIN_LIVES, gGlobalSoundSource);

View file

@ -1282,7 +1282,7 @@ static u8 resolve_player_collision(struct MarioState* m, struct MarioState* m2)
velY = fmax(fmin(55.0f, 15.0f + fabs(m->vel[1])), 35.0f); velY = fmax(fmin(55.0f, 15.0f + fabs(m->vel[1])), 35.0f);
} else if (m->action == ACT_DOUBLE_JUMP) { } else if (m->action == ACT_DOUBLE_JUMP) {
mario_stop_riding_and_holding(m); mario_stop_riding_and_holding(m);
set_mario_action(m, (gSpecialTripleJump && m->playerIndex == 0) ? ACT_SPECIAL_TRIPLE_JUMP : ACT_TRIPLE_JUMP, 0); set_mario_action(m, (m->specialTripleJump && m->playerIndex == 0) ? ACT_SPECIAL_TRIPLE_JUMP : ACT_TRIPLE_JUMP, 0);
velY = fmax(fmin(60.0f, 20.0f + fabs(m->vel[1])), 40.0f); velY = fmax(fmin(60.0f, 20.0f + fabs(m->vel[1])), 40.0f);
} else { } else {
mario_stop_riding_and_holding(m); mario_stop_riding_and_holding(m);

View file

@ -1503,7 +1503,7 @@ s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum) {
gCurrCourseNum = COURSE_NONE; gCurrCourseNum = COURSE_NONE;
gSavedCourseNum = COURSE_NONE; gSavedCourseNum = COURSE_NONE;
gCurrCreditsEntry = NULL; gCurrCreditsEntry = NULL;
gSpecialTripleJump = FALSE; gMarioStates[0].specialTripleJump = FALSE;
init_mario_from_save_file(); init_mario_from_save_file();
disable_warp_checkpoint(); disable_warp_checkpoint();
@ -1570,7 +1570,7 @@ void fake_lvl_init_from_save_file(void) {
if (gNetworkType == NT_NONE) { gNeverEnteredCastle = true; } if (gNetworkType == NT_NONE) { gNeverEnteredCastle = true; }
gCurrCreditsEntry = NULL; gCurrCreditsEntry = NULL;
gSpecialTripleJump = 0; gMarioStates[0].specialTripleJump = false;
init_mario_from_save_file(); init_mario_from_save_file();
disable_warp_checkpoint(); disable_warp_checkpoint();

View file

@ -483,7 +483,7 @@ s32 act_double_jump(struct MarioState *m) {
} }
s32 act_triple_jump(struct MarioState *m) { s32 act_triple_jump(struct MarioState *m) {
if (m == &gMarioStates[0] && gSpecialTripleJump) { if (m == &gMarioStates[0] && m->specialTripleJump) {
return set_mario_action(m, ACT_SPECIAL_TRIPLE_JUMP, 0); return set_mario_action(m, ACT_SPECIAL_TRIPLE_JUMP, 0);
} }

View file

@ -36,7 +36,6 @@ s8 sUnusedGotGlobalCoinHiScore = 0;
u8 gGotFileCoinHiScore = FALSE; u8 gGotFileCoinHiScore = FALSE;
u8 gCurrCourseStarFlags = 0; u8 gCurrCourseStarFlags = 0;
u8 gSpecialTripleJump = FALSE;
u8 gSaveFileUsingBackupSlot = FALSE; u8 gSaveFileUsingBackupSlot = FALSE;
#define STUB_LEVEL(_0, _1, courseenum, _3, _4, _5, _6, _7, _8) courseenum, #define STUB_LEVEL(_0, _1, courseenum, _3, _4, _5, _6, _7, _8) courseenum,

View file

@ -79,7 +79,6 @@ extern u8 gLastCompletedStarNum;
extern s8 sUnusedGotGlobalCoinHiScore; extern s8 sUnusedGotGlobalCoinHiScore;
extern u8 gGotFileCoinHiScore; extern u8 gGotFileCoinHiScore;
extern u8 gCurrCourseStarFlags; extern u8 gCurrCourseStarFlags;
extern u8 gSpecialTripleJump;
extern s8 gLevelToCourseNumTable[]; extern s8 gLevelToCourseNumTable[];
// game progress flags // game progress flags

View file

@ -713,7 +713,7 @@ static struct LuaObjectField sMarioBodyStateFields[LUA_MARIO_BODY_STATE_FIELD_CO
{ "wingFlutter", LVT_S8, offsetof(struct MarioBodyState, wingFlutter), false, LOT_NONE }, { "wingFlutter", LVT_S8, offsetof(struct MarioBodyState, wingFlutter), false, LOT_NONE },
}; };
#define LUA_MARIO_STATE_FIELD_COUNT 73 #define LUA_MARIO_STATE_FIELD_COUNT 74
static struct LuaObjectField sMarioStateFields[LUA_MARIO_STATE_FIELD_COUNT] = { static struct LuaObjectField sMarioStateFields[LUA_MARIO_STATE_FIELD_COUNT] = {
{ "action", LVT_U32, offsetof(struct MarioState, action), false, LOT_NONE }, { "action", LVT_U32, offsetof(struct MarioState, action), false, LOT_NONE },
{ "actionArg", LVT_U32, offsetof(struct MarioState, actionArg), false, LOT_NONE }, { "actionArg", LVT_U32, offsetof(struct MarioState, actionArg), false, LOT_NONE },
@ -774,6 +774,7 @@ static struct LuaObjectField sMarioStateFields[LUA_MARIO_STATE_FIELD_COUNT] = {
{ "slideVelZ", LVT_F32, offsetof(struct MarioState, slideVelZ), false, LOT_NONE }, { "slideVelZ", LVT_F32, offsetof(struct MarioState, slideVelZ), false, LOT_NONE },
{ "slideYaw", LVT_S16, offsetof(struct MarioState, slideYaw), false, LOT_NONE }, { "slideYaw", LVT_S16, offsetof(struct MarioState, slideYaw), false, LOT_NONE },
{ "spawnInfo", LVT_COBJECT_P, offsetof(struct MarioState, spawnInfo), false, LOT_SPAWNINFO }, { "spawnInfo", LVT_COBJECT_P, offsetof(struct MarioState, spawnInfo), false, LOT_SPAWNINFO },
{ "specialTripleJump", LVT_U8, offsetof(struct MarioState, specialTripleJump), false, LOT_NONE },
// { "splineKeyframe", LVT_???, offsetof(struct MarioState, splineKeyframe), false, LOT_??? }, <--- UNIMPLEMENTED // { "splineKeyframe", LVT_???, offsetof(struct MarioState, splineKeyframe), false, LOT_??? }, <--- UNIMPLEMENTED
{ "splineKeyframeFraction", LVT_F32, offsetof(struct MarioState, splineKeyframeFraction), false, LOT_NONE }, { "splineKeyframeFraction", LVT_F32, offsetof(struct MarioState, splineKeyframeFraction), false, LOT_NONE },
{ "splineState", LVT_S32, offsetof(struct MarioState, splineState), false, LOT_NONE }, { "splineState", LVT_S32, offsetof(struct MarioState, splineState), false, LOT_NONE },