mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-16 09:42:57 +00:00
Add new spindash animation.
This adds SPR2_DASH, S_PLAY_DASH, and related p_user.c changes to give charging your spindash a unique animation.
This commit is contained in:
parent
b88864c666
commit
e9c1771017
4 changed files with 12 additions and 3 deletions
|
@ -3749,6 +3749,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
|
||||||
"S_PLAY_DEAD",
|
"S_PLAY_DEAD",
|
||||||
"S_PLAY_DRWN",
|
"S_PLAY_DRWN",
|
||||||
"S_PLAY_SPIN",
|
"S_PLAY_SPIN",
|
||||||
|
"S_PLAY_DASH",
|
||||||
"S_PLAY_GASP",
|
"S_PLAY_GASP",
|
||||||
"S_PLAY_JUMP",
|
"S_PLAY_JUMP",
|
||||||
"S_PLAY_FALL",
|
"S_PLAY_FALL",
|
||||||
|
|
|
@ -66,6 +66,7 @@ char spr2names[NUMPLAYERSPRITES][5] =
|
||||||
"DEAD",
|
"DEAD",
|
||||||
"DRWN",
|
"DRWN",
|
||||||
"SPIN",
|
"SPIN",
|
||||||
|
"DASH",
|
||||||
"GASP",
|
"GASP",
|
||||||
"JUMP",
|
"JUMP",
|
||||||
"FALL",
|
"FALL",
|
||||||
|
@ -130,6 +131,7 @@ state_t states[NUMSTATES] =
|
||||||
{SPR_PLAY, SPR2_DEAD, 4, {NULL}, 0, 0, S_PLAY_DEAD}, // S_PLAY_DEAD
|
{SPR_PLAY, SPR2_DEAD, 4, {NULL}, 0, 0, S_PLAY_DEAD}, // S_PLAY_DEAD
|
||||||
{SPR_PLAY, SPR2_DRWN, 4, {NULL}, 0, 0, S_PLAY_DRWN}, // S_PLAY_DRWN
|
{SPR_PLAY, SPR2_DRWN, 4, {NULL}, 0, 0, S_PLAY_DRWN}, // S_PLAY_DRWN
|
||||||
{SPR_PLAY, SPR2_SPIN, 1, {NULL}, 0, 0, S_PLAY_SPIN}, // S_PLAY_SPIN
|
{SPR_PLAY, SPR2_SPIN, 1, {NULL}, 0, 0, S_PLAY_SPIN}, // S_PLAY_SPIN
|
||||||
|
{SPR_PLAY, SPR2_DASH, 2, {NULL}, 0, 0, S_PLAY_DASH}, // S_PLAY_DASH
|
||||||
{SPR_PLAY, SPR2_GASP, 14, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_GASP
|
{SPR_PLAY, SPR2_GASP, 14, {NULL}, 0, 0, S_PLAY_WALK}, // S_PLAY_GASP
|
||||||
{SPR_PLAY, SPR2_JUMP, 2, {NULL}, 0, 0, S_PLAY_JUMP}, // S_PLAY_JUMP
|
{SPR_PLAY, SPR2_JUMP, 2, {NULL}, 0, 0, S_PLAY_JUMP}, // S_PLAY_JUMP
|
||||||
{SPR_PLAY, SPR2_FALL, 2, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_FALL
|
{SPR_PLAY, SPR2_FALL, 2, {NULL}, 0, 0, S_PLAY_FALL}, // S_PLAY_FALL
|
||||||
|
|
|
@ -585,6 +585,7 @@ enum playersprite
|
||||||
SPR2_DEAD,
|
SPR2_DEAD,
|
||||||
SPR2_DRWN,
|
SPR2_DRWN,
|
||||||
SPR2_SPIN,
|
SPR2_SPIN,
|
||||||
|
SPR2_DASH,
|
||||||
SPR2_GASP,
|
SPR2_GASP,
|
||||||
SPR2_JUMP,
|
SPR2_JUMP,
|
||||||
SPR2_FALL,
|
SPR2_FALL,
|
||||||
|
@ -644,6 +645,7 @@ typedef enum state
|
||||||
S_PLAY_DEAD,
|
S_PLAY_DEAD,
|
||||||
S_PLAY_DRWN,
|
S_PLAY_DRWN,
|
||||||
S_PLAY_SPIN,
|
S_PLAY_SPIN,
|
||||||
|
S_PLAY_DASH,
|
||||||
S_PLAY_GASP,
|
S_PLAY_GASP,
|
||||||
S_PLAY_JUMP,
|
S_PLAY_JUMP,
|
||||||
S_PLAY_FALL,
|
S_PLAY_FALL,
|
||||||
|
|
10
src/p_user.c
10
src/p_user.c
|
@ -3436,7 +3436,8 @@ static void P_DoSuperStuff(player_t *player)
|
||||||
|
|
||||||
if (player->mo->health > 0)
|
if (player->mo->health > 0)
|
||||||
{
|
{
|
||||||
if ((player->pflags & PF_JUMPED) || (player->pflags & PF_SPINNING))
|
if ((player->pflags & PF_JUMPED || player->pflags & PF_SPINNING)
|
||||||
|
&& player->mo->state-states != S_PLAY_DASH)
|
||||||
P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
|
P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
|
||||||
else switch (player->mo->state-states)
|
else switch (player->mo->state-states)
|
||||||
{
|
{
|
||||||
|
@ -3699,7 +3700,7 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd)
|
||||||
player->pflags |= PF_STARTDASH|PF_SPINNING;
|
player->pflags |= PF_STARTDASH|PF_SPINNING;
|
||||||
player->dashspeed = FixedMul(FRACUNIT, player->mo->scale);
|
player->dashspeed = FixedMul(FRACUNIT, player->mo->scale);
|
||||||
player->dashtime = 0;
|
player->dashtime = 0;
|
||||||
P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
|
P_SetPlayerMobjState(player->mo, S_PLAY_DASH);
|
||||||
player->pflags |= PF_USEDOWN;
|
player->pflags |= PF_USEDOWN;
|
||||||
}
|
}
|
||||||
else if ((cmd->buttons & BT_USE) && (player->pflags & PF_STARTDASH))
|
else if ((cmd->buttons & BT_USE) && (player->pflags & PF_STARTDASH))
|
||||||
|
@ -3756,6 +3757,7 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd)
|
||||||
player->pflags &= ~PF_STARTDASH;
|
player->pflags &= ~PF_STARTDASH;
|
||||||
if (!((gametype == GT_RACE || gametype == GT_COMPETITION) && leveltime < 4*TICRATE))
|
if (!((gametype == GT_RACE || gametype == GT_COMPETITION) && leveltime < 4*TICRATE))
|
||||||
{
|
{
|
||||||
|
P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
|
||||||
P_InstaThrust(player->mo, player->mo->angle, player->dashspeed); // catapult forward ho!!
|
P_InstaThrust(player->mo, player->mo->angle, player->dashspeed); // catapult forward ho!!
|
||||||
if (!player->spectator)
|
if (!player->spectator)
|
||||||
S_StartSound(player->mo, sfx_zoom);
|
S_StartSound(player->mo, sfx_zoom);
|
||||||
|
@ -3763,7 +3765,9 @@ static void P_DoSpinDash(player_t *player, ticcmd_t *cmd)
|
||||||
player->dashspeed = 0;
|
player->dashspeed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onground && (player->pflags & PF_SPINNING) && !(player->panim == PA_ROLL))
|
if (onground && player->pflags & PF_STARTDASH && player->mo->state-states != S_PLAY_DASH)
|
||||||
|
P_SetPlayerMobjState(player->mo, S_PLAY_DASH);
|
||||||
|
else if (onground && player->pflags & PF_SPINNING && !(player->panim == PA_ROLL))
|
||||||
P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
|
P_SetPlayerMobjState(player->mo, S_PLAY_SPIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue