mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-22 02:42:20 +00:00
Swimming animation! Since I know we want it for Smiles eventually.
Also, I guess CA_SWIM isn't forced into running on water anymore.
This commit is contained in:
parent
c2aba46298
commit
824458a5ff
6 changed files with 26 additions and 8 deletions
|
@ -3783,8 +3783,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
|
|||
"S_PLAY_EDGE",
|
||||
"S_PLAY_RIDE",
|
||||
|
||||
// CA_FLY
|
||||
// CA_FLY/SWIM
|
||||
"S_PLAY_FLY",
|
||||
"S_PLAY_SWIM",
|
||||
"S_PLAY_FLY_TIRED",
|
||||
|
||||
// CA_GLIDEANDCLIMB
|
||||
|
|
|
@ -78,6 +78,7 @@ char spr2names[NUMPLAYERSPRITES][5] =
|
|||
"LIFE",
|
||||
|
||||
"FLY_",
|
||||
"SWIM",
|
||||
"TIRE",
|
||||
|
||||
"GLID",
|
||||
|
@ -146,6 +147,7 @@ state_t states[NUMSTATES] =
|
|||
|
||||
// Tails abilities
|
||||
{SPR_PLAY, SPR2_FLY , 2, {NULL}, 0, 0, S_PLAY_FLY}, // S_PLAY_FLY
|
||||
{SPR_PLAY, SPR2_SWIM, 2, {NULL}, 0, 0, S_PLAY_SWIM}, // S_PLAY_SWIM
|
||||
{SPR_PLAY, SPR2_TIRE, 12, {NULL}, 0, 0, S_PLAY_FLY_TIRED}, // S_PLAY_FLY_TIRED
|
||||
|
||||
// Knuckles abilities
|
||||
|
|
|
@ -597,6 +597,7 @@ enum playersprite
|
|||
SPR2_LIFE,
|
||||
|
||||
SPR2_FLY ,
|
||||
SPR2_SWIM,
|
||||
SPR2_TIRE,
|
||||
|
||||
SPR2_GLID,
|
||||
|
@ -659,6 +660,7 @@ typedef enum state
|
|||
|
||||
// CA_FLY
|
||||
S_PLAY_FLY,
|
||||
S_PLAY_SWIM,
|
||||
S_PLAY_FLY_TIRED,
|
||||
|
||||
// CA_GLIDEANDCLIMB
|
||||
|
|
|
@ -254,6 +254,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
|
|||
player->panim = PA_FALL;
|
||||
break;
|
||||
case S_PLAY_FLY:
|
||||
case S_PLAY_SWIM:
|
||||
case S_PLAY_GLIDE:
|
||||
player->panim = PA_ABILITY;
|
||||
break;
|
||||
|
@ -370,9 +371,12 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
|
|||
case SPR2_FLY:
|
||||
spr2 = SPR2_SPNG;
|
||||
break;
|
||||
case SPR2_TIRE:
|
||||
case SPR2_SWIM:
|
||||
spr2 = SPR2_FLY;
|
||||
break;
|
||||
case SPR2_TIRE:
|
||||
spr2 = (player->charability == CA_FLY) ? SPR2_FLY : SPR2_SWIM;
|
||||
break;
|
||||
|
||||
case SPR2_GLID:
|
||||
spr2 = SPR2_FLY;
|
||||
|
@ -3248,7 +3252,7 @@ static boolean P_SceneryZMovement(mobj_t *mo)
|
|||
boolean P_CanRunOnWater(player_t *player, ffloor_t *rover)
|
||||
{
|
||||
if (!(player->pflags & PF_NIGHTSMODE) && !player->homing
|
||||
&& (((player->charability == CA_SWIM) || player->powers[pw_super] || player->charflags & SF_RUNONWATER) && player->mo->ceilingz-*rover->topheight >= player->mo->height)
|
||||
&& ((player->powers[pw_super] || player->charflags & SF_RUNONWATER) && player->mo->ceilingz-*rover->topheight >= player->mo->height)
|
||||
&& (rover->flags & FF_SWIMMABLE) && !(player->pflags & PF_SPINNING) && player->speed > FixedMul(player->runspeed, player->mo->scale)
|
||||
&& !(player->pflags & PF_SLIDING)
|
||||
&& abs(player->mo->z - *rover->topheight) < FixedMul(30*FRACUNIT, player->mo->scale))
|
||||
|
|
17
src/p_user.c
17
src/p_user.c
|
@ -4104,14 +4104,17 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
|
|||
break;
|
||||
|
||||
case CA_FLY:
|
||||
case CA_SWIM: // Swim
|
||||
case CA_SWIM:
|
||||
// If currently in the air from a jump, and you pressed the
|
||||
// button again and have the ability to fly, do so!
|
||||
if (player->charability == CA_SWIM && !(player->mo->eflags & MFE_UNDERWATER))
|
||||
; // Can't do anything if you're a fish out of water!
|
||||
else if (!(player->pflags & PF_THOKKED) && !(player->powers[pw_tailsfly]))
|
||||
{
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_FLY); // Change to the flying animation
|
||||
if (player->mo->eflags & MFE_UNDERWATER)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_SWIM); // Change to the swimming animation
|
||||
else
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_FLY); // Change to the flying animation
|
||||
|
||||
player->powers[pw_tailsfly] = tailsflytics + 1; // Set the fly timer
|
||||
|
||||
|
@ -4121,8 +4124,6 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
|
|||
break;
|
||||
case CA_GLIDEANDCLIMB:
|
||||
// Now Knuckles-type abilities are checked.
|
||||
// If you can turn super and aren't already,
|
||||
// and you don't have a shield, do it!
|
||||
if (!(player->pflags & PF_THOKKED) || player->charability2 == CA2_MULTIABILITY)
|
||||
{
|
||||
INT32 glidespeed = player->actionspd;
|
||||
|
@ -6728,6 +6729,14 @@ static void P_MovePlayer(player_t *player)
|
|||
if (player->panim != PA_ABILITY)
|
||||
player->powers[pw_tailsfly] = 0;
|
||||
|
||||
if (player->charability == CA_FLY || player->charability == CA_SWIM) // Frustratingly has to remain seperate from the below block.
|
||||
{
|
||||
if (player->mo->state-states == S_PLAY_FLY && player->mo->eflags & MFE_UNDERWATER)
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_SWIM); // Change to the swimming animation
|
||||
else if (player->mo->state-states == S_PLAY_SWIM && !(player->mo->eflags & MFE_UNDERWATER))
|
||||
P_SetPlayerMobjState(player->mo, S_PLAY_FLY); // Change to the flying animation
|
||||
}
|
||||
|
||||
if (player->charability == CA_FLY || (player->charability == CA_SWIM && player->mo->eflags & MFE_UNDERWATER))
|
||||
{
|
||||
// Fly counter for Tails.
|
||||
|
|
|
@ -2339,7 +2339,7 @@ void R_InitSkins(void)
|
|||
}
|
||||
|
||||
// returns true if available in circumstances, otherwise nope
|
||||
// warning don't use with an invalid skinnum
|
||||
// warning don't use with an invalid skinnum other than -1 which always returns true
|
||||
boolean R_SkinUnlock(INT32 skinnum)
|
||||
{
|
||||
return ((skinnum == -1) // Simplifies things elsewhere, since there's already plenty of checks for less-than-0...
|
||||
|
|
Loading…
Reference in a new issue