mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-05 07:51:42 +00:00
Remove PF_SPINNING upon use of any jump ability, so that directionchar works properly
This commit is contained in:
parent
91c9d667e1
commit
4f18f6d3cf
1 changed files with 177 additions and 174 deletions
351
src/p_user.c
351
src/p_user.c
|
@ -5012,7 +5012,7 @@ void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range)
|
||||||
|
|
||||||
static void P_DoTwinSpin(player_t *player)
|
static void P_DoTwinSpin(player_t *player)
|
||||||
{
|
{
|
||||||
player->pflags &= ~PF_NOJUMPDAMAGE;
|
player->pflags &= ~(PF_NOJUMPDAMAGE|PF_SPINNING);
|
||||||
player->pflags |= P_GetJumpFlags(player) | PF_THOKKED;
|
player->pflags |= P_GetJumpFlags(player) | PF_THOKKED;
|
||||||
S_StartSound(player->mo, sfx_s3k42);
|
S_StartSound(player->mo, sfx_s3k42);
|
||||||
player->mo->frame = 0;
|
player->mo->frame = 0;
|
||||||
|
@ -5286,194 +5286,197 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
|
||||||
else if (player->pflags & PF_JUMPED)
|
else if (player->pflags & PF_JUMPED)
|
||||||
{
|
{
|
||||||
if (!LUAh_AbilitySpecial(player))
|
if (!LUAh_AbilitySpecial(player))
|
||||||
switch (player->charability)
|
|
||||||
{
|
{
|
||||||
case CA_THOK:
|
switch (player->charability)
|
||||||
case CA_HOMINGTHOK:
|
{
|
||||||
case CA_JUMPTHOK: // Credit goes to CZ64 and Sryder13 for the original
|
case CA_THOK:
|
||||||
// Now it's Sonic's abilities turn!
|
case CA_HOMINGTHOK:
|
||||||
// THOK!
|
case CA_JUMPTHOK: // Credit goes to CZ64 and Sryder13 for the original
|
||||||
if (!(player->pflags & PF_THOKKED) || (player->charflags & SF_MULTIABILITY))
|
// Now it's Sonic's abilities turn!
|
||||||
{
|
// THOK!
|
||||||
// Catapult the player
|
if (!(player->pflags & PF_THOKKED) || (player->charflags & SF_MULTIABILITY))
|
||||||
fixed_t actionspd = player->actionspd;
|
|
||||||
|
|
||||||
if (player->charflags & SF_DASHMODE)
|
|
||||||
actionspd = max(player->normalspeed, FixedDiv(player->speed, player->mo->scale));
|
|
||||||
|
|
||||||
if (player->mo->eflags & MFE_UNDERWATER)
|
|
||||||
actionspd >>= 1;
|
|
||||||
|
|
||||||
if ((player->charability == CA_JUMPTHOK) && !(player->pflags & PF_THOKKED))
|
|
||||||
{
|
{
|
||||||
player->pflags &= ~PF_JUMPED;
|
// Catapult the player
|
||||||
P_DoJump(player, false);
|
fixed_t actionspd = player->actionspd;
|
||||||
}
|
|
||||||
|
|
||||||
P_InstaThrust(player->mo, player->mo->angle, FixedMul(actionspd, player->mo->scale));
|
if (player->charflags & SF_DASHMODE)
|
||||||
|
actionspd = max(player->normalspeed, FixedDiv(player->speed, player->mo->scale));
|
||||||
|
|
||||||
if (maptol & TOL_2D)
|
if (player->mo->eflags & MFE_UNDERWATER)
|
||||||
{
|
actionspd >>= 1;
|
||||||
player->mo->momx /= 2;
|
|
||||||
player->mo->momy /= 2;
|
|
||||||
}
|
|
||||||
if (player->charability == CA_HOMINGTHOK)
|
|
||||||
{
|
|
||||||
player->mo->momx /= 2;
|
|
||||||
player->mo->momy /= 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player->charability == CA_HOMINGTHOK)
|
if ((player->charability == CA_JUMPTHOK) && !(player->pflags & PF_THOKKED))
|
||||||
{
|
|
||||||
P_SetTarget(&player->mo->target, P_SetTarget(&player->mo->tracer, lockonthok));
|
|
||||||
if (lockonthok)
|
|
||||||
{
|
{
|
||||||
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
|
|
||||||
player->mo->angle = R_PointToAngle2(player->mo->x, player->mo->y, lockonthok->x, lockonthok->y);
|
|
||||||
player->homing = 3*TICRATE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
|
|
||||||
player->pflags &= ~PF_JUMPED;
|
player->pflags &= ~PF_JUMPED;
|
||||||
player->mo->height = P_GetPlayerHeight(player);
|
P_DoJump(player, false);
|
||||||
}
|
}
|
||||||
player->pflags &= ~PF_NOJUMPDAMAGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
player->drawangle = player->mo->angle;
|
P_InstaThrust(player->mo, player->mo->angle, FixedMul(actionspd, player->mo->scale));
|
||||||
|
|
||||||
if (player->mo->info->attacksound && !player->spectator)
|
if (maptol & TOL_2D)
|
||||||
S_StartSound(player->mo, player->mo->info->attacksound); // Play the THOK sound
|
|
||||||
|
|
||||||
P_SpawnThokMobj(player);
|
|
||||||
|
|
||||||
player->pflags &= ~(PF_SPINNING|PF_STARTDASH);
|
|
||||||
player->pflags |= PF_THOKKED;
|
|
||||||
|
|
||||||
// Change localangle to match for simple controls? (P.S. chalupa)
|
|
||||||
// disabled because it seemed to disorient people and Z-targeting exists now
|
|
||||||
/*if (!demoplayback)
|
|
||||||
{
|
|
||||||
if (player == &players[consoleplayer] && cv_cam_turnfacingability[0].value > 0 && !(PLAYER1INPUTDOWN(gc_turnleft) || PLAYER1INPUTDOWN(gc_turnright)))
|
|
||||||
P_SetPlayerAngle(player, player->mo->angle);;
|
|
||||||
else if (player == &players[secondarydisplayplayer] && cv_cam_turnfacingability[1].value > 0 && !(PLAYER2INPUTDOWN(gc_turnleft) || PLAYER2INPUTDOWN(gc_turnright)))
|
|
||||||
P_SetPlayerAngle(player, player->mo->angle);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CA_FLY:
|
|
||||||
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
|
|
||||||
|
|
||||||
player->powers[pw_tailsfly] = tailsflytics + 1; // Set the fly timer
|
|
||||||
|
|
||||||
player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_SPINNING|PF_STARTDASH);
|
|
||||||
if (player->bot == 1)
|
|
||||||
player->pflags |= PF_THOKKED;
|
|
||||||
else
|
|
||||||
player->pflags |= (PF_THOKKED|PF_CANCARRY);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case CA_GLIDEANDCLIMB:
|
|
||||||
// Now Knuckles-type abilities are checked.
|
|
||||||
if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY)
|
|
||||||
{
|
|
||||||
fixed_t glidespeed = FixedMul(player->actionspd, player->mo->scale);
|
|
||||||
fixed_t playerspeed = player->speed;
|
|
||||||
|
|
||||||
if (player->mo->eflags & MFE_UNDERWATER)
|
|
||||||
{
|
|
||||||
glidespeed >>= 1;
|
|
||||||
playerspeed = 2*playerspeed/3;
|
|
||||||
if (!(player->powers[pw_super] || player->powers[pw_sneakers]))
|
|
||||||
{
|
{
|
||||||
player->mo->momx = (2*(player->mo->momx - player->cmomx)/3) + player->cmomx;
|
player->mo->momx /= 2;
|
||||||
player->mo->momy = (2*(player->mo->momy - player->cmomy)/3) + player->cmomy;
|
player->mo->momy /= 2;
|
||||||
}
|
}
|
||||||
|
if (player->charability == CA_HOMINGTHOK)
|
||||||
|
{
|
||||||
|
player->mo->momx /= 2;
|
||||||
|
player->mo->momy /= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player->charability == CA_HOMINGTHOK)
|
||||||
|
{
|
||||||
|
P_SetTarget(&player->mo->target, P_SetTarget(&player->mo->tracer, lockonthok));
|
||||||
|
if (lockonthok)
|
||||||
|
{
|
||||||
|
P_SetPlayerMobjState(player->mo, S_PLAY_ROLL);
|
||||||
|
player->mo->angle = R_PointToAngle2(player->mo->x, player->mo->y, lockonthok->x, lockonthok->y);
|
||||||
|
player->homing = 3*TICRATE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
|
||||||
|
player->pflags &= ~PF_JUMPED;
|
||||||
|
player->mo->height = P_GetPlayerHeight(player);
|
||||||
|
}
|
||||||
|
player->pflags &= ~PF_NOJUMPDAMAGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
player->drawangle = player->mo->angle;
|
||||||
|
|
||||||
|
if (player->mo->info->attacksound && !player->spectator)
|
||||||
|
S_StartSound(player->mo, player->mo->info->attacksound); // Play the THOK sound
|
||||||
|
|
||||||
|
P_SpawnThokMobj(player);
|
||||||
|
|
||||||
|
player->pflags &= ~(PF_STARTDASH);
|
||||||
|
player->pflags |= PF_THOKKED;
|
||||||
|
|
||||||
|
// Change localangle to match for simple controls? (P.S. chalupa)
|
||||||
|
// disabled because it seemed to disorient people and Z-targeting exists now
|
||||||
|
/*if (!demoplayback)
|
||||||
|
{
|
||||||
|
if (player == &players[consoleplayer] && cv_cam_turnfacingability[0].value > 0 && !(PLAYER1INPUTDOWN(gc_turnleft) || PLAYER1INPUTDOWN(gc_turnright)))
|
||||||
|
P_SetPlayerAngle(player, player->mo->angle);;
|
||||||
|
else if (player == &players[secondarydisplayplayer] && cv_cam_turnfacingability[1].value > 0 && !(PLAYER2INPUTDOWN(gc_turnleft) || PLAYER2INPUTDOWN(gc_turnright)))
|
||||||
|
P_SetPlayerAngle(player, player->mo->angle);
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
player->pflags |= PF_GLIDING|PF_THOKKED;
|
case CA_FLY:
|
||||||
player->glidetime = 0;
|
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
|
||||||
|
|
||||||
P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE);
|
player->powers[pw_tailsfly] = tailsflytics + 1; // Set the fly timer
|
||||||
if (playerspeed < glidespeed)
|
|
||||||
P_Thrust(player->mo, player->mo->angle, glidespeed - playerspeed);
|
player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_STARTDASH);
|
||||||
player->pflags &= ~(PF_SPINNING|PF_STARTDASH);
|
if (player->bot == 1)
|
||||||
}
|
player->pflags |= PF_THOKKED;
|
||||||
break;
|
else
|
||||||
case CA_DOUBLEJUMP: // Double-Jump
|
player->pflags |= (PF_THOKKED|PF_CANCARRY);
|
||||||
if (!(player->pflags & PF_THOKKED) || ((player->charflags & SF_MULTIABILITY) && (player->secondjump < (player->actionspd >> FRACBITS))))
|
}
|
||||||
{
|
break;
|
||||||
player->pflags |= PF_THOKKED;
|
case CA_GLIDEANDCLIMB:
|
||||||
player->pflags &= ~PF_JUMPED;
|
// Now Knuckles-type abilities are checked.
|
||||||
P_DoJump(player, true);
|
if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY)
|
||||||
player->secondjump++;
|
{
|
||||||
}
|
fixed_t glidespeed = FixedMul(player->actionspd, player->mo->scale);
|
||||||
break;
|
fixed_t playerspeed = player->speed;
|
||||||
case CA_FLOAT: // Float
|
|
||||||
case CA_SLOWFALL: // Slow descent hover
|
if (player->mo->eflags & MFE_UNDERWATER)
|
||||||
if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY)
|
{
|
||||||
{
|
glidespeed >>= 1;
|
||||||
if (player->charflags & SF_DASHMODE && player->dashmode >= DASHMODE_THRESHOLD)
|
playerspeed = 2*playerspeed/3;
|
||||||
P_SetPlayerMobjState(player->mo, S_PLAY_DASH);
|
if (!(player->powers[pw_super] || player->powers[pw_sneakers]))
|
||||||
else if (player->speed >= FixedMul(player->runspeed, player->mo->scale))
|
{
|
||||||
P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT_RUN);
|
player->mo->momx = (2*(player->mo->momx - player->cmomx)/3) + player->cmomx;
|
||||||
else
|
player->mo->momy = (2*(player->mo->momy - player->cmomy)/3) + player->cmomy;
|
||||||
P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT);
|
}
|
||||||
player->pflags |= PF_THOKKED;
|
}
|
||||||
player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE|PF_SPINNING);
|
|
||||||
player->secondjump = 1;
|
player->pflags |= PF_GLIDING|PF_THOKKED;
|
||||||
}
|
player->glidetime = 0;
|
||||||
break;
|
|
||||||
case CA_TELEKINESIS:
|
P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE);
|
||||||
if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY)
|
if (playerspeed < glidespeed)
|
||||||
{
|
P_Thrust(player->mo, player->mo->angle, glidespeed - playerspeed);
|
||||||
P_Telekinesis(player,
|
player->pflags &= ~(PF_STARTDASH);
|
||||||
FixedMul(player->actionspd, player->mo->scale), // +ve thrust (pushing away from player)
|
}
|
||||||
FixedMul(384*FRACUNIT, player->mo->scale));
|
break;
|
||||||
}
|
case CA_DOUBLEJUMP: // Double-Jump
|
||||||
break;
|
if (!(player->pflags & PF_THOKKED) || ((player->charflags & SF_MULTIABILITY) && (player->secondjump < (player->actionspd >> FRACBITS))))
|
||||||
case CA_FALLSWITCH:
|
{
|
||||||
if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY)
|
player->pflags |= PF_THOKKED;
|
||||||
{
|
player->pflags &= ~PF_JUMPED;
|
||||||
player->mo->momz = -player->mo->momz;
|
P_DoJump(player, true);
|
||||||
P_SpawnThokMobj(player);
|
player->secondjump++;
|
||||||
player->pflags |= PF_THOKKED;
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case CA_FLOAT: // Float
|
||||||
case CA_AIRDRILL:
|
case CA_SLOWFALL: // Slow descent hover
|
||||||
if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY)
|
if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY)
|
||||||
{
|
{
|
||||||
player->flyangle = 56 + (60-(player->actionspd>>FRACBITS))/3;
|
if (player->charflags & SF_DASHMODE && player->dashmode >= DASHMODE_THRESHOLD)
|
||||||
player->pflags |= PF_THOKKED;
|
P_SetPlayerMobjState(player->mo, S_PLAY_DASH);
|
||||||
S_StartSound(player->mo, sfx_spndsh);
|
else if (player->speed >= FixedMul(player->runspeed, player->mo->scale))
|
||||||
}
|
P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT_RUN);
|
||||||
break;
|
else
|
||||||
case CA_BOUNCE:
|
P_SetPlayerMobjState(player->mo, S_PLAY_FLOAT);
|
||||||
if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY)
|
player->pflags |= PF_THOKKED;
|
||||||
{
|
player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE);
|
||||||
P_SetPlayerMobjState(player->mo, S_PLAY_BOUNCE);
|
player->secondjump = 1;
|
||||||
player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE);
|
}
|
||||||
player->pflags |= PF_THOKKED|PF_BOUNCING;
|
break;
|
||||||
player->mo->momx >>= 1;
|
case CA_TELEKINESIS:
|
||||||
player->mo->momy >>= 1;
|
if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY)
|
||||||
player->mo->momz >>= 1;
|
{
|
||||||
}
|
P_Telekinesis(player,
|
||||||
break;
|
FixedMul(player->actionspd, player->mo->scale), // +ve thrust (pushing away from player)
|
||||||
case CA_TWINSPIN:
|
FixedMul(384*FRACUNIT, player->mo->scale));
|
||||||
if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY)
|
}
|
||||||
P_DoTwinSpin(player);
|
break;
|
||||||
break;
|
case CA_FALLSWITCH:
|
||||||
default:
|
if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY)
|
||||||
break;
|
{
|
||||||
|
player->mo->momz = -player->mo->momz;
|
||||||
|
P_SpawnThokMobj(player);
|
||||||
|
player->pflags |= PF_THOKKED;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CA_AIRDRILL:
|
||||||
|
if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY)
|
||||||
|
{
|
||||||
|
player->flyangle = 56 + (60-(player->actionspd>>FRACBITS))/3;
|
||||||
|
player->pflags |= PF_THOKKED;
|
||||||
|
S_StartSound(player->mo, sfx_spndsh);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CA_BOUNCE:
|
||||||
|
if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY)
|
||||||
|
{
|
||||||
|
P_SetPlayerMobjState(player->mo, S_PLAY_BOUNCE);
|
||||||
|
player->pflags &= ~(PF_JUMPED|PF_NOJUMPDAMAGE);
|
||||||
|
player->pflags |= PF_THOKKED|PF_BOUNCING;
|
||||||
|
player->mo->momx >>= 1;
|
||||||
|
player->mo->momy >>= 1;
|
||||||
|
player->mo->momz >>= 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CA_TWINSPIN:
|
||||||
|
if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY)
|
||||||
|
P_DoTwinSpin(player);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
player->pflags &= ~PF_SPINNING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (player->pflags & PF_THOKKED)
|
else if (player->pflags & PF_THOKKED)
|
||||||
|
|
Loading…
Reference in a new issue