From 496662bec59f58045ad859f729cb545aaa75fc21 Mon Sep 17 00:00:00 2001 From: Yukita Mayako Date: Fri, 19 Jun 2015 01:30:06 -0400 Subject: [PATCH] Super float animation. When Super Sonic is "walking in the air", he has a unique animation for it now which is similar to how it looked in previous SRB2 versions. --- src/dehacked.c | 1 + src/info.c | 4 +++- src/info.h | 2 ++ src/p_mobj.c | 4 ++++ src/p_user.c | 17 +++++++++++++---- 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 34b1a209c..96d346c1f 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -3779,6 +3779,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_PLAY_SUPER_FALL", "S_PLAY_SUPER_EDGE", "S_PLAY_SUPER_RIDE", + "S_PLAY_SUPER_FLOAT", // SF_SUPER "S_PLAY_SUPERTRANS1", diff --git a/src/info.c b/src/info.c index 3a72f992a..8d7c249ad 100644 --- a/src/info.c +++ b/src/info.c @@ -96,7 +96,8 @@ char spr2names[NUMPLAYERSPRITES][5] = "SJMP", "SFAL", "SEDG", - "SRID" + "SRID", + "SFLT" }; // Doesn't work with g++, needs actionf_p1 (don't modify this comment) @@ -162,6 +163,7 @@ state_t states[NUMSTATES] = {SPR_PLAY, SPR2_SFAL, 2, {NULL}, 0, 0, S_PLAY_SUPER_FALL}, // S_PLAY_SUPER_FALL {SPR_PLAY, SPR2_SEDG, 12, {NULL}, 0, 0, S_PLAY_SUPER_EDGE}, // S_PLAY_SUPER_EDGE {SPR_PLAY, SPR2_SRID, 4, {NULL}, 0, 0, S_PLAY_SUPER_RIDE}, // S_PLAY_SUPER_RIDE + {SPR_PLAY, SPR2_SFLT, 7, {NULL}, 0, 0, S_PLAY_SUPER_FLOAT}, // S_PLAY_SUPER_FLOAT // Transforming into Super {SPR_PLAY, SPR2_TRNS, 4, {NULL}, 0, 0, S_PLAY_SUPER_TRANS2}, // S_PLAY_SUPER_TRANS diff --git a/src/info.h b/src/info.h index 836e87e21..e313526b9 100644 --- a/src/info.h +++ b/src/info.h @@ -616,6 +616,7 @@ enum playersprite SPR2_SFAL, SPR2_SEDG, SPR2_SRID, + SPR2_SFLT, NUMPLAYERSPRITES }; @@ -676,6 +677,7 @@ typedef enum state S_PLAY_SUPER_FALL, S_PLAY_SUPER_EDGE, S_PLAY_SUPER_RIDE, + S_PLAY_SUPER_FLOAT, // SF_SUPER S_PLAY_SUPER_TRANS, diff --git a/src/p_mobj.c b/src/p_mobj.c index 9f8806053..d6ba3866c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -192,6 +192,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) break; case S_PLAY_WALK: case S_PLAY_SUPER_WALK: + case S_PLAY_SUPER_FLOAT: player->panim = PA_WALK; break; case S_PLAY_RUN: @@ -384,6 +385,9 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state) case SPR2_SRID: spr2 = SPR2_RIDE; break; + case SPR2_SFLT: + spr2 = SPR2_SWLK; + break; // Dunno? Just go to standing then. default: diff --git a/src/p_user.c b/src/p_user.c index c359fff5b..acb07a435 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6438,13 +6438,17 @@ static void P_MovePlayer(player_t *player) // MOVEMENT ANIMATIONS // ///////////////////////// - if ((cmd->forwardmove != 0 || cmd->sidemove != 0) || (player->powers[pw_super] && player->mo->z > player->mo->floorz)) + if ((cmd->forwardmove != 0 || cmd->sidemove != 0) || (player->powers[pw_super] && !onground)) { // If the player is moving fast enough, // break into a run! if (player->speed >= runspd && player->panim == PA_WALK && !player->skidtime && (onground || player->powers[pw_super])) P_SetPlayerMobjState (player->mo, S_PLAY_RUN); + // Super floating at slow speeds has its own special animation. + else if (player->powers[pw_super] && player->panim == PA_IDLE && !onground) + P_SetPlayerMobjState (player->mo, S_PLAY_SUPER_FLOAT); + // Otherwise, just walk. else if ((player->rmomx || player->rmomy) && player->panim == PA_IDLE) P_SetPlayerMobjState (player->mo, S_PLAY_WALK); @@ -6453,7 +6457,12 @@ static void P_MovePlayer(player_t *player) // If your running animation is playing, and you're // going too slow, switch back to the walking frames. if (player->panim == PA_RUN && player->speed < runspd) - P_SetPlayerMobjState(player->mo, S_PLAY_WALK); + { + if (!onground && player->powers[pw_super]) + P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_FLOAT); + else + P_SetPlayerMobjState(player->mo, S_PLAY_WALK); + } // If Springing, but travelling DOWNWARD, change back! if (player->panim == PA_JUMP && P_MobjFlip(player->mo)*player->mo->momz < 0) @@ -6824,8 +6833,8 @@ static void P_MovePlayer(player_t *player) if (player->charflags & SF_SUPER && player->powers[pw_super] && player->speed > FixedMul(5<mo->scale) && P_MobjFlip(player->mo)*player->mo->momz <= 0) { - if (player->panim == PA_ROLL || player->mo->state-states == S_PLAY_PAIN) - P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_WALK); + if (player->panim == PA_ROLL || player->mo->state-states == S_PLAY_PAIN || player->panim == PA_WALK) + P_SetPlayerMobjState(player->mo, S_PLAY_SUPER_FLOAT); player->mo->momz = 0; player->pflags &= ~PF_SPINNING;