Skip to content

Commit 3c96cb7

Browse files
committed
swimstop pitch snapping
1 parent f2e91f0 commit 3c96cb7

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎src/game/mario_actions_submerged.c‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,18 @@ static void update_swimming_yaw(struct MarioState *m, s32 arg) {
217217
}
218218

219219
static void update_swimming_pitch(struct MarioState *m, s32 arg) {
220+
// arg on previous frame (there is probably a better implementation)
221+
static s32 prevArg = 0;
222+
220223
// Targets pitch 0 if Mario is going into idle
221224
s16 targetPitch = arg == 0 ? -(s16) (252.0f * m->controller->stickY) : 0;
222-
223225
s16 pitchVel;
226+
227+
// Seen in bad influence s4e14 9:40 - mario snaps to max pitch if swimstop activates beyond 3/4 rotation
228+
if (arg == 1 && prevArg == 0) {
229+
if (m->faceAngle[0] > 0x3000) m->faceAngle[0] = 0x4000;
230+
}
231+
224232
if (m->faceAngle[0] < 0 && arg == 0) {
225233
pitchVel = 0x100; // Slower velocity only happens if Mario is swimming downwards and isn't going into idle
226234
} else {
@@ -236,6 +244,8 @@ static void update_swimming_pitch(struct MarioState *m, s32 arg) {
236244
m->faceAngle[0] = targetPitch;
237245
}
238246
}
247+
248+
prevArg = arg;
239249
}
240250

241251
static void common_idle_step(struct MarioState *m, s32 animation, s32 arg) {

0 commit comments

Comments
 (0)