mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Merge branch 'nights-hotfix' into 'next'
NiGHTS hotfix Fixes the following issues relating to playing as NiGHTS Super Sonic that apparently popped up between 2.1.14 and next (mostly due to the changes to SRB2's trig stuff it seems): * Super Sonic drifts to the side at some angles around an axis, and is unable to go directly upwards or downwards as a result * Drilling to the side when on the ground causes the drill sound to constantly restart * CEZS's start not actually being lined up properly with the first axis means the player is not able to go backwards along the track (because the player is not actually aligned with the track properly, preventing you from touching the attached line transfer) * trying to hug some walls such as the tall wall before the library section of CEZS allows Super Sonic to go through them These fixes needs proper testing before this branch can be merged in, in case they accidentally break other things as a result or something. See merge request !71
This commit is contained in:
commit
ab7af594d9
2 changed files with 52 additions and 14 deletions
38
src/p_mobj.c
38
src/p_mobj.c
|
@ -1900,6 +1900,9 @@ void P_XYMovement(mobj_t *mo)
|
|||
if (player && player->homing) // no friction for homing
|
||||
return;
|
||||
|
||||
if (player && player->pflags & PF_NIGHTSMODE)
|
||||
return; // no friction for NiGHTS players
|
||||
|
||||
#ifdef ESLOPE
|
||||
if ((mo->type == MT_BIGTUMBLEWEED || mo->type == MT_LITTLETUMBLEWEED)
|
||||
&& (mo->standingslope && abs(mo->standingslope->zdelta) > FRACUNIT>>8)) // Special exception for tumbleweeds on slopes
|
||||
|
@ -2656,11 +2659,16 @@ static void P_PlayerZMovement(mobj_t *mo)
|
|||
|
||||
if (mo->player->pflags & PF_NIGHTSMODE)
|
||||
{
|
||||
if (mo->player->flyangle < 90 || mo->player->flyangle >= 270)
|
||||
mo->player->flyangle += P_MobjFlip(mo)*90;
|
||||
else
|
||||
mo->player->flyangle -= P_MobjFlip(mo)*90;
|
||||
mo->player->speed = FixedMul(mo->player->speed, 4*FRACUNIT/5);
|
||||
// bounce off floor if you were flying towards it
|
||||
if ((mo->eflags & MFE_VERTICALFLIP && mo->player->flyangle > 0 && mo->player->flyangle < 180)
|
||||
|| (!(mo->eflags & MFE_VERTICALFLIP) && mo->player->flyangle > 180 && mo->player->flyangle <= 359))
|
||||
{
|
||||
if (mo->player->flyangle < 90 || mo->player->flyangle >= 270)
|
||||
mo->player->flyangle += P_MobjFlip(mo)*90;
|
||||
else
|
||||
mo->player->flyangle -= P_MobjFlip(mo)*90;
|
||||
mo->player->speed = FixedMul(mo->player->speed, 4*FRACUNIT/5);
|
||||
}
|
||||
goto nightsdone;
|
||||
}
|
||||
// Get up if you fell.
|
||||
|
@ -2851,12 +2859,17 @@ nightsdone:
|
|||
|
||||
if (mo->player->pflags & PF_NIGHTSMODE)
|
||||
{
|
||||
if (mo->player->flyangle < 90 || mo->player->flyangle >= 270)
|
||||
mo->player->flyangle -= P_MobjFlip(mo)*90;
|
||||
else
|
||||
mo->player->flyangle += P_MobjFlip(mo)*90;
|
||||
mo->player->flyangle %= 360;
|
||||
mo->player->speed = FixedMul(mo->player->speed, 4*FRACUNIT/5);
|
||||
// bounce off ceiling if you were flying towards it
|
||||
if ((mo->eflags & MFE_VERTICALFLIP && mo->player->flyangle > 180 && mo->player->flyangle <= 359)
|
||||
|| (!(mo->eflags & MFE_VERTICALFLIP) && mo->player->flyangle > 0 && mo->player->flyangle < 180))
|
||||
{
|
||||
if (mo->player->flyangle < 90 || mo->player->flyangle >= 270)
|
||||
mo->player->flyangle -= P_MobjFlip(mo)*90;
|
||||
else
|
||||
mo->player->flyangle += P_MobjFlip(mo)*90;
|
||||
mo->player->flyangle %= 360;
|
||||
mo->player->speed = FixedMul(mo->player->speed, 4*FRACUNIT/5);
|
||||
}
|
||||
}
|
||||
|
||||
// Check for "Mario" blocks to hit and bounce them
|
||||
|
@ -3719,7 +3732,8 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
|
|||
}
|
||||
else
|
||||
{
|
||||
mobj->player->jumping = 0;
|
||||
if (!(mobj->player->pflags & PF_NIGHTSMODE)) // "jumping" is used for drilling
|
||||
mobj->player->jumping = 0;
|
||||
mobj->player->pflags &= ~PF_JUMPED;
|
||||
if (mobj->player->secondjump || mobj->player->powers[pw_tailsfly])
|
||||
{
|
||||
|
|
28
src/p_user.c
28
src/p_user.c
|
@ -4952,8 +4952,9 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad
|
|||
else
|
||||
{
|
||||
const angle_t fa = player->angle_pos>>ANGLETOFINESHIFT;
|
||||
player->mo->momx = player->mo->target->x + FixedMul(FINECOSINE(fa),radius) - player->mo->x;
|
||||
player->mo->momy = player->mo->target->y + FixedMul(FINESINE(fa),radius) - player->mo->y;
|
||||
const angle_t faold = player->old_angle_pos>>ANGLETOFINESHIFT;
|
||||
player->mo->momx = FixedMul(FINECOSINE(fa),radius) - FixedMul(FINECOSINE(faold),radius);
|
||||
player->mo->momy = FixedMul(FINESINE(fa),radius) - FixedMul(FINESINE(faold),radius);
|
||||
}
|
||||
|
||||
if (player->exiting)
|
||||
|
@ -5660,6 +5661,29 @@ static void P_NiGHTSMovement(player_t *player)
|
|||
if (player->mo->eflags & MFE_VERTICALFLIP)
|
||||
cmd->forwardmove = (SINT8)(-cmd->forwardmove);
|
||||
|
||||
if (!(player->pflags & PF_TRANSFERTOCLOSEST))
|
||||
{
|
||||
fixed_t realdist = R_PointToDist2(player->mo->x, player->mo->y, player->mo->target->x, player->mo->target->y);
|
||||
// teleport player to correct radius if neccessary
|
||||
if (realdist>>FRACBITS != radius>>FRACBITS)
|
||||
{
|
||||
CONS_Debug(DBG_NIGHTS, "Aligning player with axis\n");
|
||||
P_UnsetThingPosition(player->mo);
|
||||
if (realdist == 0) // other method won't work if we're exactly on the target lol
|
||||
{
|
||||
const angle_t fa = player->old_angle_pos>>ANGLETOFINESHIFT;
|
||||
player->mo->x = player->mo->target->x + FixedMul(FINECOSINE(fa), radius);
|
||||
player->mo->y = player->mo->target->y + FixedMul(FINESINE(fa), radius);
|
||||
}
|
||||
else
|
||||
{
|
||||
player->mo->x = player->mo->target->x + FixedMul(FixedDiv(player->mo->x - player->mo->target->x, realdist), radius);
|
||||
player->mo->y = player->mo->target->y + FixedMul(FixedDiv(player->mo->y - player->mo->target->y, realdist), radius);
|
||||
}
|
||||
P_SetThingPosition(player->mo);
|
||||
}
|
||||
}
|
||||
|
||||
// Currently reeling from being hit.
|
||||
if (player->powers[pw_flashing] > (2*flashingtics)/3)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue