Did a few things with spindashing:

* Fixed bug where being pushed off a platform whilst charging a spindash would leave you in your charging frames instead of your rolling ones when you hit the ground (http://gfycat.com/MassiveThreadbareItalianbrownbear for how it works now, http://gfycat.com/MarvelousEnlightenedAuk is how it used to work)
* Fixed bug where spindashing on top of a bubble spawnpoint led to you being able to move around in spindash frames (no gif since obvious desired behaviour is obvious)
* Spindash animation speeds up the faster you'll shoot off.
* The spin charging mechanism is now scale-independent, and only multiplies by scale when shooting off - less FixedMul calls, and potentially deals with weird quirks of changing scale whilst spindashing that nobody's discovered because there's no place to find that in the main game!

Also:

* Climbing animation defaults to rolling instead of walking, because what.
This commit is contained in:
toasterbabe 2016-08-30 15:00:01 +01:00
parent 8d8be8a7b2
commit 42d527a955
2 changed files with 53 additions and 34 deletions

View file

@ -253,7 +253,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
player->panim = PA_PAIN; player->panim = PA_PAIN;
break; break;
case S_PLAY_SPIN: case S_PLAY_SPIN:
case S_PLAY_DASH: //case S_PLAY_DASH: -- everyone can ROLL thanks to zoom tubes...
case S_PLAY_SUPER_SPIN: case S_PLAY_SUPER_SPIN:
player->panim = PA_ROLL; player->panim = PA_ROLL;
break; break;
@ -275,6 +275,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
case S_PLAY_TWINSPIN: case S_PLAY_TWINSPIN:
player->panim = PA_ABILITY; player->panim = PA_ABILITY;
break; break;
case S_PLAY_DASH: // ...but the act of SPINDASHING is charability2 specific.
case S_PLAY_MELEE: case S_PLAY_MELEE:
case S_PLAY_MELEE_FINISH: case S_PLAY_MELEE_FINISH:
player->panim = PA_ABILITY2; player->panim = PA_ABILITY2;
@ -309,15 +310,8 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
// Adjust the player's animation speed to match their velocity. // Adjust the player's animation speed to match their velocity.
if (!(disableSpeedAdjust || player->charflags & SF_NOSPEEDADJUST)) if (!(disableSpeedAdjust || player->charflags & SF_NOSPEEDADJUST))
{ {
fixed_t speed = FixedDiv(player->speed, mobj->scale); fixed_t speed;// = FixedDiv(player->speed, mobj->scale);
if (player->panim == PA_ROLL || player->panim == PA_JUMP) if (player->panim == PA_FALL)
{
if (speed > 16<<FRACBITS)
mobj->tics = 1;
else
mobj->tics = 2;
}
else if (player->panim == PA_FALL)
{ {
speed = FixedDiv(abs(mobj->momz), mobj->scale); speed = FixedDiv(abs(mobj->momz), mobj->scale);
if (speed < 10<<FRACBITS) if (speed < 10<<FRACBITS)
@ -329,24 +323,45 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
else else
mobj->tics = 1; mobj->tics = 1;
} }
else if (P_IsObjectOnGround(mobj) || player->powers[pw_super]) // Only if on the ground or superflying. else if (player->panim == PA_ABILITY2 && player->charability2 == CA2_SPINDASH)
{ {
if (player->panim == PA_WALK) speed = player->maxdash/3; // We're using dashspeed as the variable to check against, but reusing speed to reduce the number of calculations done.
if (player->dashspeed > 2*speed)
mobj->tics = 1;
else if (player->dashspeed > speed)
mobj->tics = 2;
else
mobj->tics = 3;
}
else
{
speed = FixedDiv(player->speed, mobj->scale);
if (player->panim == PA_ROLL || player->panim == PA_JUMP)
{ {
if (speed > 12<<FRACBITS) if (speed > 16<<FRACBITS)
mobj->tics = 2;
else if (speed > 6<<FRACBITS)
mobj->tics = 3;
else
mobj->tics = 4;
}
else if ((player->panim == PA_RUN) || (player->panim == PA_PEEL))
{
if (speed > 52<<FRACBITS)
mobj->tics = 1; mobj->tics = 1;
else else
mobj->tics = 2; mobj->tics = 2;
} }
else if (P_IsObjectOnGround(mobj) || player->powers[pw_super]) // Only if on the ground or superflying.
{
if (player->panim == PA_WALK)
{
if (speed > 12<<FRACBITS)
mobj->tics = 2;
else if (speed > 6<<FRACBITS)
mobj->tics = 3;
else
mobj->tics = 4;
}
else if ((player->panim == PA_RUN) || (player->panim == PA_PEEL))
{
if (speed > 52<<FRACBITS)
mobj->tics = 1;
else
mobj->tics = 2;
}
}
} }
} }
@ -408,7 +423,7 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
spr2 = SPR2_FLY; spr2 = SPR2_FLY;
break; break;
case SPR2_CLMB: case SPR2_CLMB:
spr2 = SPR2_WALK; spr2 = SPR2_SPIN;
break; break;
case SPR2_CLNG: case SPR2_CLNG:
spr2 = SPR2_CLMB; spr2 = SPR2_CLMB;

View file

@ -900,7 +900,7 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor)
// Useful when you want to kill everything the player is doing. // Useful when you want to kill everything the player is doing.
void P_ResetPlayer(player_t *player) void P_ResetPlayer(player_t *player)
{ {
player->pflags &= ~(PF_ROPEHANG|PF_ITEMHANG|PF_MACESPIN|PF_SPINNING|PF_JUMPED|PF_GLIDING|PF_THOKKED|PF_CARRIED); player->pflags &= ~(PF_ROPEHANG|PF_ITEMHANG|PF_MACESPIN|PF_SPINNING|PF_STARTDASH|PF_JUMPED|PF_GLIDING|PF_THOKKED|PF_CARRIED);
player->jumping = 0; player->jumping = 0;
player->secondjump = 0; player->secondjump = 0;
player->glidetime = 0; player->glidetime = 0;
@ -3727,18 +3727,18 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
player->mo->momx = player->cmomx; player->mo->momx = player->cmomx;
player->mo->momy = player->cmomy; player->mo->momy = player->cmomy;
player->pflags |= PF_STARTDASH|PF_SPINNING; player->pflags |= PF_STARTDASH|PF_SPINNING;
player->dashspeed = FixedMul(FRACUNIT, player->mo->scale); player->dashspeed = FRACUNIT;
player->dashtime = 0; player->dashtime = 0;
P_SetPlayerMobjState(player->mo, S_PLAY_DASH); 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))
{ {
player->dashspeed += FixedMul(FRACUNIT, player->mo->scale); player->dashspeed += FRACUNIT;
if (!(player->dashtime++ % 5)) if (!(player->dashtime++ % 5))
{ {
if (!player->spectator && player->dashspeed < FixedMul(player->maxdash, player->mo->scale)) if (!player->spectator && player->dashspeed < player->maxdash)
S_StartSound(player->mo, sfx_spndsh); // Make the rev sound! S_StartSound(player->mo, sfx_spndsh); // Make the rev sound!
// Now spawn the color thok circle. // Now spawn the color thok circle.
@ -3800,7 +3800,7 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
if (player->dashspeed) if (player->dashspeed)
{ {
P_SetPlayerMobjState(player->mo, S_PLAY_SPIN); 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, FixedMul(player->dashspeed, player->mo->scale)); // catapult forward ho!!
} }
else else
{ {
@ -3815,8 +3815,11 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
player->dashspeed = 0; player->dashspeed = 0;
} }
if (onground && player->pflags & PF_STARTDASH && player->mo->state-states != S_PLAY_DASH) if (onground && player->pflags & PF_STARTDASH)
P_SetPlayerMobjState(player->mo, S_PLAY_DASH); {
if (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)) 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);
@ -3829,6 +3832,7 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
#endif #endif
) )
{ {
P_ResetPlayer(player);
player->mo->z += P_MobjFlip(player->mo); player->mo->z += P_MobjFlip(player->mo);
player->mo->momx = player->cmomx = 0; player->mo->momx = player->cmomx = 0;
player->mo->momy = player->cmomy = 0; player->mo->momy = player->cmomy = 0;
@ -6566,10 +6570,10 @@ static void P_MovePlayer(player_t *player)
// Cap the speed limit on a spindash // Cap the speed limit on a spindash
// Up the 60*FRACUNIT number to boost faster, you speed demon you! // Up the 60*FRACUNIT number to boost faster, you speed demon you!
if (player->dashspeed > FixedMul(player->maxdash, player->mo->scale)) if (player->dashspeed > player->maxdash)
player->dashspeed = FixedMul(player->maxdash, player->mo->scale); player->dashspeed = player->maxdash;
else if (player->dashspeed > 0 && player->dashspeed < FixedMul(player->mindash, player->mo->scale)) else if (player->dashspeed > 0 && player->dashspeed < player->mindash)
player->dashspeed = FixedMul(player->mindash, player->mo->scale); player->dashspeed = player->mindash;
if (!(player->charability == CA_GLIDEANDCLIMB) || player->gotflag) // If you can't glide, then why the heck would you be gliding? if (!(player->charability == CA_GLIDEANDCLIMB) || player->gotflag) // If you can't glide, then why the heck would you be gliding?
{ {