Merge branch 'master' into metalstuff

This commit is contained in:
lachwright 2019-10-26 16:07:59 +08:00
commit e89948ce71
9 changed files with 140 additions and 67 deletions

View file

@ -4258,6 +4258,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
// CA_GLIDEANDCLIMB // CA_GLIDEANDCLIMB
"S_PLAY_GLIDE", "S_PLAY_GLIDE",
"S_PLAY_GLIDE_LANDING",
"S_PLAY_CLING", "S_PLAY_CLING",
"S_PLAY_CLIMB", "S_PLAY_CLIMB",

View file

@ -968,8 +968,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
forcefullinput = true; forcefullinput = true;
if (twodlevel if (twodlevel
|| (player->mo && (player->mo->flags2 & MF2_TWOD)) || (player->mo && (player->mo->flags2 & MF2_TWOD))
|| (!demoplayback && (player->climbing || (!demoplayback && ((player->powers[pw_carry] == CR_NIGHTSMODE)
|| (player->powers[pw_carry] == CR_NIGHTSMODE)
|| (player->pflags & (PF_SLIDING|PF_FORCESTRAFE))))) // Analog || (player->pflags & (PF_SLIDING|PF_FORCESTRAFE))))) // Analog
forcestrafe = true; forcestrafe = true;
if (forcestrafe) if (forcestrafe)
@ -1150,8 +1149,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics)
if (!mouseaiming && cv_mousemove.value) if (!mouseaiming && cv_mousemove.value)
forward += mousey; forward += mousey;
if ((!demoplayback && (player->climbing if ((!demoplayback && (player->pflags & PF_SLIDING))) // Analog for mouse
|| (player->pflags & PF_SLIDING)))) // Analog for mouse
side += mousex*2; side += mousex*2;
else if (cv_analog.value) else if (cv_analog.value)
{ {

View file

@ -533,6 +533,7 @@ char spr2names[NUMPLAYERSPRITES][5] =
"TIRE", "TIRE",
"GLID", "GLID",
"LAND",
"CLNG", "CLNG",
"CLMB", "CLMB",
@ -540,7 +541,6 @@ char spr2names[NUMPLAYERSPRITES][5] =
"FRUN", "FRUN",
"BNCE", "BNCE",
"BLND",
"FIRE", "FIRE",
@ -636,6 +636,7 @@ playersprite_t spr2defaults[NUMPLAYERSPRITES] = {
0, // SPR2_TIRE, (conditional, will never be referenced) 0, // SPR2_TIRE, (conditional, will never be referenced)
SPR2_FLY , // SPR2_GLID, SPR2_FLY , // SPR2_GLID,
SPR2_ROLL, // SPR2_LAND,
SPR2_CLMB, // SPR2_CLNG, SPR2_CLMB, // SPR2_CLNG,
SPR2_ROLL, // SPR2_CLMB, SPR2_ROLL, // SPR2_CLMB,
@ -643,7 +644,6 @@ playersprite_t spr2defaults[NUMPLAYERSPRITES] = {
SPR2_RUN , // SPR2_FRUN, SPR2_RUN , // SPR2_FRUN,
SPR2_FALL, // SPR2_BNCE, SPR2_FALL, // SPR2_BNCE,
SPR2_ROLL, // SPR2_BLND,
0, // SPR2_FIRE, 0, // SPR2_FIRE,
@ -766,6 +766,7 @@ state_t states[NUMSTATES] =
// CA_GLIDEANDCLIMB // CA_GLIDEANDCLIMB
{SPR_PLAY, SPR2_GLID, 2, {NULL}, 0, 0, S_PLAY_GLIDE}, // S_PLAY_GLIDE {SPR_PLAY, SPR2_GLID, 2, {NULL}, 0, 0, S_PLAY_GLIDE}, // S_PLAY_GLIDE
{SPR_PLAY, SPR2_LAND, 9, {NULL}, 0, 0, S_PLAY_STND}, // S_PLAY_GLIDE_LANDING
{SPR_PLAY, SPR2_CLNG|FF_ANIMATE, -1, {NULL}, 0, 4, S_NULL}, // S_PLAY_CLING {SPR_PLAY, SPR2_CLNG|FF_ANIMATE, -1, {NULL}, 0, 4, S_NULL}, // S_PLAY_CLING
{SPR_PLAY, SPR2_CLMB, 5, {NULL}, 0, 0, S_PLAY_CLIMB}, // S_PLAY_CLIMB {SPR_PLAY, SPR2_CLMB, 5, {NULL}, 0, 0, S_PLAY_CLIMB}, // S_PLAY_CLIMB
@ -775,7 +776,7 @@ state_t states[NUMSTATES] =
// CA_BOUNCE // CA_BOUNCE
{SPR_PLAY, SPR2_BNCE|FF_ANIMATE, -1, {NULL}, 0, 0, S_NULL}, // S_PLAY_BOUNCE {SPR_PLAY, SPR2_BNCE|FF_ANIMATE, -1, {NULL}, 0, 0, S_NULL}, // S_PLAY_BOUNCE
{SPR_PLAY, SPR2_BLND|FF_SPR2ENDSTATE, 2, {NULL}, S_PLAY_BOUNCE, 0, S_PLAY_BOUNCE_LANDING}, // S_PLAY_BOUNCE_LANDING {SPR_PLAY, SPR2_LAND|FF_SPR2ENDSTATE, 2, {NULL}, S_PLAY_BOUNCE, 0, S_PLAY_BOUNCE_LANDING}, // S_PLAY_BOUNCE_LANDING
// CA2_GUNSLINGER // CA2_GUNSLINGER
{SPR_PLAY, SPR2_FIRE|FF_SPR2ENDSTATE, 2, {NULL}, S_PLAY_FIRE_FINISH, 0, S_PLAY_FIRE}, // S_PLAY_FIRE {SPR_PLAY, SPR2_FIRE|FF_SPR2ENDSTATE, 2, {NULL}, S_PLAY_FIRE_FINISH, 0, S_PLAY_FIRE}, // S_PLAY_FIRE

View file

@ -796,6 +796,7 @@ typedef enum playersprite
SPR2_TIRE, // tired SPR2_TIRE, // tired
SPR2_GLID, // glide SPR2_GLID, // glide
SPR2_LAND, // landing after glide/bounce
SPR2_CLNG, // cling SPR2_CLNG, // cling
SPR2_CLMB, // climb SPR2_CLMB, // climb
@ -803,7 +804,6 @@ typedef enum playersprite
SPR2_FRUN, // float run SPR2_FRUN, // float run
SPR2_BNCE, // bounce SPR2_BNCE, // bounce
SPR2_BLND, // bounce landing
SPR2_FIRE, // fire SPR2_FIRE, // fire
@ -931,6 +931,7 @@ typedef enum state
// CA_GLIDEANDCLIMB // CA_GLIDEANDCLIMB
S_PLAY_GLIDE, S_PLAY_GLIDE,
S_PLAY_GLIDE_LANDING,
S_PLAY_CLING, S_PLAY_CLING,
S_PLAY_CLIMB, S_PLAY_CLIMB,

View file

@ -477,7 +477,15 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
toucher->momy = -toucher->momy; toucher->momy = -toucher->momy;
if (player->charability == CA_FLY && player->panim == PA_ABILITY) if (player->charability == CA_FLY && player->panim == PA_ABILITY)
toucher->momz = -toucher->momz/2; toucher->momz = -toucher->momz/2;
if (player->dashmode >= DASHMODE_THRESHOLD && (player->charflags & (SF_DASHMODE|SF_MACHINE)) == (SF_DASHMODE|SF_MACHINE) else if (player->pflags & PF_GLIDING && !P_IsObjectOnGround(toucher))
{
player->pflags &= ~(PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE);
P_SetPlayerMobjState(toucher, S_PLAY_FALL);
toucher->momz += P_MobjFlip(toucher) * (player->speed >> 3);
toucher->momx = 7*toucher->momx>>3;
toucher->momy = 7*toucher->momy>>3;
}
else if (player->dashmode >= DASHMODE_THRESHOLD && (player->charflags & (SF_DASHMODE|SF_MACHINE)) == (SF_DASHMODE|SF_MACHINE)
&& player->panim == PA_DASH) && player->panim == PA_DASH)
P_DoPlayerPain(player, special, special); P_DoPlayerPain(player, special, special);
} }
@ -1521,10 +1529,13 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
toucher->momx = P_ReturnThrustX(special, angle, touchspeed); toucher->momx = P_ReturnThrustX(special, angle, touchspeed);
toucher->momy = P_ReturnThrustY(special, angle, touchspeed); toucher->momy = P_ReturnThrustY(special, angle, touchspeed);
toucher->momz = -toucher->momz; toucher->momz = -toucher->momz;
if (player->pflags & PF_GLIDING) if (player->pflags & PF_GLIDING && !P_IsObjectOnGround(toucher))
{ {
player->pflags &= ~(PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE); player->pflags &= ~(PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE);
P_SetPlayerMobjState(toucher, S_PLAY_FALL); P_SetPlayerMobjState(toucher, S_PLAY_FALL);
toucher->momz += P_MobjFlip(toucher) * (player->speed >> 3);
toucher->momx = 7*toucher->momx>>3;
toucher->momy = 7*toucher->momy>>3;
} }
player->homing = 0; player->homing = 0;
@ -1569,10 +1580,13 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
toucher->momx = P_ReturnThrustX(special, special->angle, touchspeed); toucher->momx = P_ReturnThrustX(special, special->angle, touchspeed);
toucher->momy = P_ReturnThrustY(special, special->angle, touchspeed); toucher->momy = P_ReturnThrustY(special, special->angle, touchspeed);
toucher->momz = -toucher->momz; toucher->momz = -toucher->momz;
if (player->pflags & PF_GLIDING) if (player->pflags & PF_GLIDING && !P_IsObjectOnGround(toucher))
{ {
player->pflags &= ~(PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE); player->pflags &= ~(PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE);
P_SetPlayerMobjState(toucher, S_PLAY_FALL); P_SetPlayerMobjState(toucher, S_PLAY_FALL);
toucher->momz += P_MobjFlip(toucher) * (player->speed >> 3);
toucher->momx = 7*toucher->momx>>3;
toucher->momy = 7*toucher->momy>>3;
} }
player->homing = 0; player->homing = 0;

View file

@ -3484,13 +3484,13 @@ isblocking:
&& canclimb) && canclimb)
{ {
slidemo->angle = climbangle; slidemo->angle = climbangle;
if (!demoplayback || P_AnalogMove(slidemo->player)) /*if (!demoplayback || P_AnalogMove(slidemo->player))
{ {
if (slidemo->player == &players[consoleplayer]) if (slidemo->player == &players[consoleplayer])
localangle = slidemo->angle; localangle = slidemo->angle;
else if (slidemo->player == &players[secondarydisplayplayer]) else if (slidemo->player == &players[secondarydisplayplayer])
localangle2 = slidemo->angle; localangle2 = slidemo->angle;
} }*/
if (!slidemo->player->climbing) if (!slidemo->player->climbing)
{ {

View file

@ -7976,7 +7976,7 @@ void P_MobjThinker(mobj_t *mobj)
INT32 strength; INT32 strength;
++mobj->movedir; ++mobj->movedir;
mobj->frame &= ~FF_TRANSMASK; mobj->frame &= ~FF_TRANSMASK;
strength = min(mobj->fuse, mobj->movedir)*3; strength = min(mobj->fuse, (INT32)mobj->movedir)*3;
if (strength < 10) if (strength < 10)
mobj->frame |= ((10-strength)<<(FF_TRANSSHIFT)); mobj->frame |= ((10-strength)<<(FF_TRANSSHIFT));
} }

View file

@ -2263,6 +2263,18 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff)
else if (!player->skidtime) else if (!player->skidtime)
player->pflags &= ~PF_GLIDING; player->pflags &= ~PF_GLIDING;
} }
else if (player->charability == CA_GLIDEANDCLIMB && player->pflags & PF_THOKKED && (~player->pflags) & PF_SHIELDABILITY)
{
if (player->mo->state-states != S_PLAY_GLIDE_LANDING)
{
P_ResetPlayer(player);
P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE_LANDING);
S_StartSound(player->mo, sfx_s3k4c);
player->pflags |= PF_STASIS;
player->mo->momx = ((player->mo->momx - player->cmomx)/3) + player->cmomx;
player->mo->momy = ((player->mo->momy - player->cmomy)/3) + player->cmomy;
}
}
else if (player->charability2 == CA2_MELEE else if (player->charability2 == CA2_MELEE
&& ((player->panim == PA_ABILITY2) || (player->charability == CA_TWINSPIN && player->panim == PA_ABILITY && player->cmd.buttons & (BT_JUMP|BT_USE)))) && ((player->panim == PA_ABILITY2) || (player->charability == CA_TWINSPIN && player->panim == PA_ABILITY && player->cmd.buttons & (BT_JUMP|BT_USE))))
{ {
@ -3080,7 +3092,6 @@ static void P_DoClimbing(player_t *player)
glidesector = R_IsPointInSubsector(player->mo->x + platx, player->mo->y + platy); glidesector = R_IsPointInSubsector(player->mo->x + platx, player->mo->y + platy);
if (!glidesector || glidesector->sector != player->mo->subsector->sector)
{ {
boolean floorclimb = false; boolean floorclimb = false;
boolean thrust = false; boolean thrust = false;
@ -3464,9 +3475,13 @@ static void P_DoClimbing(player_t *player)
if (!floorclimb) if (!floorclimb)
{ {
if (boostup) if (boostup)
{
P_SetObjectMomZ(player->mo, 2*FRACUNIT, true); P_SetObjectMomZ(player->mo, 2*FRACUNIT, true);
if (cmd->forwardmove)
P_SetObjectMomZ(player->mo, 2*player->mo->momz/3, false);
}
if (thrust) if (thrust)
P_InstaThrust(player->mo, player->mo->angle, FixedMul(4*FRACUNIT, player->mo->scale)); // Lil' boost up. P_Thrust(player->mo, player->mo->angle, FixedMul(4*FRACUNIT, player->mo->scale)); // Lil' boost up.
player->climbing = 0; player->climbing = 0;
player->pflags |= P_GetJumpFlags(player); player->pflags |= P_GetJumpFlags(player);
@ -3480,12 +3495,6 @@ static void P_DoClimbing(player_t *player)
P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); P_SetPlayerMobjState(player->mo, S_PLAY_JUMP);
} }
} }
else
{
player->climbing = 0;
player->pflags |= P_GetJumpFlags(player);
P_SetPlayerMobjState(player->mo, S_PLAY_JUMP);
}
if (cmd->sidemove != 0 || cmd->forwardmove != 0) if (cmd->sidemove != 0 || cmd->forwardmove != 0)
climb = true; climb = true;
@ -3504,15 +3513,28 @@ static void P_DoClimbing(player_t *player)
player->pflags |= P_GetJumpFlags(player); player->pflags |= P_GetJumpFlags(player);
P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); P_SetPlayerMobjState(player->mo, S_PLAY_JUMP);
P_SetObjectMomZ(player->mo, 4*FRACUNIT, false); P_SetObjectMomZ(player->mo, 4*FRACUNIT, false);
P_InstaThrust(player->mo, player->mo->angle, FixedMul(-4*FRACUNIT, player->mo->scale)); P_Thrust(player->mo, player->mo->angle, FixedMul(-4*FRACUNIT, player->mo->scale));
} }
#define CLIMBCONEMAX FixedAngle(90*FRACUNIT)
if (!demoplayback || P_AnalogMove(player)) if (!demoplayback || P_AnalogMove(player))
{ {
if (player == &players[consoleplayer]) if (player == &players[consoleplayer])
localangle = player->mo->angle; {
angle_t angdiff = localangle - player->mo->angle;
if (angdiff < ANGLE_180 && angdiff > CLIMBCONEMAX)
localangle = player->mo->angle + CLIMBCONEMAX;
else if (angdiff > ANGLE_180 && angdiff < InvAngle(CLIMBCONEMAX))
localangle = player->mo->angle - CLIMBCONEMAX;
}
else if (player == &players[secondarydisplayplayer]) else if (player == &players[secondarydisplayplayer])
localangle2 = player->mo->angle; {
angle_t angdiff = localangle2 - player->mo->angle;
if (angdiff < ANGLE_180 && angdiff > CLIMBCONEMAX)
localangle2 = player->mo->angle + CLIMBCONEMAX;
else if (angdiff > ANGLE_180 && angdiff < InvAngle(CLIMBCONEMAX))
localangle2 = player->mo->angle - CLIMBCONEMAX;
}
} }
if (player->climbing == 0) if (player->climbing == 0)
@ -4500,7 +4522,8 @@ static void P_DoSpinDashDust(player_t *player)
static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd) static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
{ {
boolean canstand = true; // can we stand on the ground? (mostly relevant for slopes) boolean canstand = true; // can we stand on the ground? (mostly relevant for slopes)
if (player->pflags & PF_STASIS) if (player->pflags & PF_STASIS
&& (player->pflags & PF_JUMPSTASIS || player->mo->state-states != S_PLAY_GLIDE_LANDING))
return; return;
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
@ -4524,7 +4547,7 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd)
{ {
case CA2_SPINDASH: // Spinning and Spindashing case CA2_SPINDASH: // Spinning and Spindashing
// Start revving // Start revving
if ((cmd->buttons & BT_USE) && player->speed < FixedMul(5<<FRACBITS, player->mo->scale) if ((cmd->buttons & BT_USE) && (player->speed < FixedMul(5<<FRACBITS, player->mo->scale) || player->mo->state - states == S_PLAY_GLIDE_LANDING)
&& !player->mo->momz && onground && !(player->pflags & (PF_USEDOWN|PF_SPINNING)) && !player->mo->momz && onground && !(player->pflags & (PF_USEDOWN|PF_SPINNING))
&& canstand) && canstand)
{ {
@ -5286,7 +5309,8 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd)
player->glidetime = 0; player->glidetime = 0;
P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE); P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE);
P_InstaThrust(player->mo, player->mo->angle, FixedMul(glidespeed, player->mo->scale)); if (player->speed < glidespeed)
P_Thrust(player->mo, player->mo->angle, glidespeed - player->speed);
player->pflags &= ~(PF_SPINNING|PF_STARTDASH); player->pflags &= ~(PF_SPINNING|PF_STARTDASH);
} }
break; break;
@ -5729,7 +5753,7 @@ static void P_2dMovement(player_t *player)
if (player->climbing) if (player->climbing)
{ {
if (cmd->forwardmove != 0) if (cmd->forwardmove != 0)
P_SetObjectMomZ(player->mo, FixedDiv(cmd->forwardmove*FRACUNIT,10*FRACUNIT), false); P_SetObjectMomZ(player->mo, FixedDiv(cmd->forwardmove*FRACUNIT, 15*FRACUNIT>>1), false);
player->mo->momx = 0; player->mo->momx = 0;
} }
@ -5946,7 +5970,7 @@ static void P_3dMovement(player_t *player)
if (player->climbing) if (player->climbing)
{ {
if (cmd->forwardmove) if (cmd->forwardmove)
P_SetObjectMomZ(player->mo, FixedDiv(cmd->forwardmove*FRACUNIT, 10*FRACUNIT), false); P_SetObjectMomZ(player->mo, FixedDiv(cmd->forwardmove*FRACUNIT, 15*FRACUNIT>>1), false);
} }
else if (!analogmove else if (!analogmove
&& cmd->forwardmove != 0 && !(player->pflags & PF_GLIDING || player->exiting && cmd->forwardmove != 0 && !(player->pflags & PF_GLIDING || player->exiting
@ -5980,7 +6004,7 @@ static void P_3dMovement(player_t *player)
} }
// Sideways movement // Sideways movement
if (player->climbing) if (player->climbing)
P_InstaThrust(player->mo, player->mo->angle-ANGLE_90, FixedMul(FixedDiv(cmd->sidemove*FRACUNIT, 10*FRACUNIT), player->mo->scale)); P_InstaThrust(player->mo, player->mo->angle-ANGLE_90, FixedDiv(cmd->sidemove*player->mo->scale, 15*FRACUNIT>>1));
// Analog movement control // Analog movement control
else if (analogmove) else if (analogmove)
{ {
@ -7679,15 +7703,17 @@ static void P_SkidStuff(player_t *player)
{ {
player->skidtime = 0; player->skidtime = 0;
player->pflags &= ~(PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE); player->pflags &= ~(PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE);
player->pflags |= PF_THOKKED; // nice try, speedrunners (but for real this is just behavior from S3K)
P_SetPlayerMobjState(player->mo, S_PLAY_FALL); P_SetPlayerMobjState(player->mo, S_PLAY_FALL);
} }
// Get up and brush yourself off, idiot. // Get up and brush yourself off, idiot.
else if (player->glidetime > 15) else if (player->glidetime > 15 || !(player->cmd.buttons & BT_JUMP))
{ {
P_ResetPlayer(player); P_ResetPlayer(player);
P_SetPlayerMobjState(player->mo, S_PLAY_STND); P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE_LANDING);
player->mo->momx = player->cmomx; player->pflags |= PF_STASIS;
player->mo->momy = player->cmomy; player->mo->momx = ((player->mo->momx - player->cmomx)/3) + player->cmomx;
player->mo->momy = ((player->mo->momy - player->cmomy)/3) + player->cmomy;
} }
// Didn't stop yet? Skid FOREVER! // Didn't stop yet? Skid FOREVER!
else if (player->skidtime == 1) else if (player->skidtime == 1)
@ -7695,7 +7721,8 @@ static void P_SkidStuff(player_t *player)
// Spawn a particle every 3 tics. // Spawn a particle every 3 tics.
else if (!(player->skidtime % 3)) else if (!(player->skidtime % 3))
{ {
mobj_t *particle = P_SpawnMobjFromMobj(player->mo, P_RandomRange(-player->mo->radius, player->mo->radius), P_RandomRange(-player->mo->radius, player->mo->radius), 0, MT_SPINDUST); fixed_t radius = player->mo->radius >> FRACBITS;
mobj_t *particle = P_SpawnMobjFromMobj(player->mo, P_RandomRange(-radius, radius) << FRACBITS, P_RandomRange(-radius, radius) << FRACBITS, 0, MT_SPINDUST);
particle->tics = 10; particle->tics = 10;
particle->destscale = (2*player->mo->scale)/3; particle->destscale = (2*player->mo->scale)/3;
@ -7793,6 +7820,12 @@ static void P_MovePlayer(player_t *player)
if (!(player->powers[pw_nocontrol] & (1<<15))) if (!(player->powers[pw_nocontrol] & (1<<15)))
player->pflags |= PF_JUMPSTASIS; player->pflags |= PF_JUMPSTASIS;
} }
if (player->charability == CA_GLIDEANDCLIMB && player->mo->state-states == S_PLAY_GLIDE_LANDING)
{
player->pflags |= PF_STASIS;
}
// note: don't unset stasis here // note: don't unset stasis here
if (!player->spectator && G_TagGametype()) if (!player->spectator && G_TagGametype())
@ -8052,10 +8085,13 @@ static void P_MovePlayer(player_t *player)
// AKA my own gravity. =) // AKA my own gravity. =)
if (player->pflags & PF_GLIDING) if (player->pflags & PF_GLIDING)
{ {
mobj_t *mo = player->mo; // seriously why isn't this at the top of the function hngngngng
fixed_t leeway; fixed_t leeway;
fixed_t glidespeed = player->actionspd; fixed_t glidespeed = player->actionspd;
fixed_t momx = mo->momx - player->cmomx, momy = mo->momy - player->cmomy;
angle_t angle, moveangle = R_PointToAngle2(0, 0, momx, momy);
if (player->powers[pw_super]) if (player->powers[pw_super] || player->powers[pw_sneakers])
glidespeed *= 2; glidespeed *= 2;
if (player->mo->eflags & MFE_VERTICALFLIP) if (player->mo->eflags & MFE_VERTICALFLIP)
@ -8070,22 +8106,46 @@ static void P_MovePlayer(player_t *player)
} }
// Strafing while gliding. // Strafing while gliding.
leeway = FixedAngle(cmd->sidemove*(FRACUNIT/2)); leeway = FixedAngle(cmd->sidemove*(FRACUNIT));
angle = mo->angle - leeway;
if (player->skidtime) // ground gliding if (!player->skidtime) // TODO: make sure this works in 2D!
{ {
fixed_t speed = FixedMul(glidespeed, FRACUNIT - (FRACUNIT>>2)); fixed_t speed, scale = mo->scale;
if (player->mo->eflags & MFE_UNDERWATER) fixed_t newMagnitude, oldMagnitude = R_PointToDist2(momx, momy, 0, 0);
speed >>= 1; fixed_t accelfactor = 4*FRACUNIT - 3*FINECOSINE(((angle-moveangle) >> ANGLETOFINESHIFT) & FINEMASK); // mamgic number BAD but this feels right
speed = FixedMul(speed - player->glidetime*FRACUNIT, player->mo->scale);
if (speed < 0) if (mo->eflags & MFE_UNDERWATER)
speed = 0; speed = FixedMul((glidespeed>>1) + player->glidetime*750, scale);
P_InstaThrust(player->mo, player->mo->angle-leeway, speed); else
speed = FixedMul(glidespeed + player->glidetime*1500, scale);
P_Thrust(mo, angle, FixedMul(accelfactor, scale));
newMagnitude = R_PointToDist2(player->mo->momx - player->cmomx, player->mo->momy - player->cmomy, 0, 0);
if (newMagnitude > speed)
{
fixed_t tempmomx, tempmomy;
if (oldMagnitude > speed)
{
if (newMagnitude > oldMagnitude)
{
tempmomx = FixedMul(FixedDiv(player->mo->momx - player->cmomx, newMagnitude), oldMagnitude);
tempmomy = FixedMul(FixedDiv(player->mo->momy - player->cmomy, newMagnitude), oldMagnitude);
player->mo->momx = tempmomx + player->cmomx;
player->mo->momy = tempmomy + player->cmomy;
}
// else do nothing
}
else
{
tempmomx = FixedMul(FixedDiv(player->mo->momx - player->cmomx, newMagnitude), speed);
tempmomy = FixedMul(FixedDiv(player->mo->momy - player->cmomy, newMagnitude), speed);
player->mo->momx = tempmomx + player->cmomx;
player->mo->momy = tempmomy + player->cmomy;
}
}
} }
else if (player->mo->eflags & MFE_UNDERWATER)
P_InstaThrust(player->mo, player->mo->angle-leeway, FixedMul((glidespeed>>1) + player->glidetime*750, player->mo->scale));
else
P_InstaThrust(player->mo, player->mo->angle-leeway, FixedMul(glidespeed + player->glidetime*1500, player->mo->scale));
player->glidetime++; player->glidetime++;
@ -8110,18 +8170,9 @@ static void P_MovePlayer(player_t *player)
} }
else if (player->climbing) // 'Deceleration' for climbing on walls. else if (player->climbing) // 'Deceleration' for climbing on walls.
{ {
if (player->mo->momz > 0)
{ if (!player->cmd.forwardmove)
player->mo->momz -= FixedMul(FRACUNIT/2, player->mo->scale); player->mo->momz = 0;
if (player->mo->momz < 0)
player->mo->momz = 0;
}
else if (player->mo->momz < 0)
{
player->mo->momz += FixedMul(FRACUNIT/2, player->mo->scale);
if (player->mo->momz > 0)
player->mo->momz = 0;
}
} }
else if (player->pflags & PF_BOUNCING) else if (player->pflags & PF_BOUNCING)
{ {
@ -11411,8 +11462,7 @@ void P_PlayerThink(player_t *player)
|| player->powers[pw_carry] == CR_NIGHTSMODE) || player->powers[pw_carry] == CR_NIGHTSMODE)
; ;
else if (!(player->pflags & PF_DIRECTIONCHAR) else if (!(player->pflags & PF_DIRECTIONCHAR)
|| (player->climbing // stuff where the direction is forced at all times || (player->climbing) // stuff where the direction is forced at all times
|| (player->pflags & PF_GLIDING))
|| (P_AnalogMove(player) || twodlevel || player->mo->flags2 & MF2_TWOD) // keep things synchronised up there, since the camera IS seperate from player motion when that happens || (P_AnalogMove(player) || twodlevel || player->mo->flags2 & MF2_TWOD) // keep things synchronised up there, since the camera IS seperate from player motion when that happens
|| G_RingSlingerGametype()) // no firing rings in directions your player isn't aiming || G_RingSlingerGametype()) // no firing rings in directions your player isn't aiming
player->drawangle = player->mo->angle; player->drawangle = player->mo->angle;
@ -11468,7 +11518,15 @@ void P_PlayerThink(player_t *player)
; ;
else else
{ {
if (player->pflags & PF_SLIDING) if (player->pflags & PF_GLIDING)
{
if (player->speed < player->mo->scale)
diff = player->mo->angle - player->drawangle;
else
diff = (R_PointToAngle2(0, 0, player->rmomx, player->rmomy) - player->drawangle);
factor = 4;
}
else if (player->pflags & PF_SLIDING)
{ {
#if 0 // fun hydrocity style horizontal spin #if 0 // fun hydrocity style horizontal spin
if (player->mo->eflags & MFE_TOUCHWATER || player->powers[pw_flashing] > (flashingtics/4)*3) if (player->mo->eflags & MFE_TOUCHWATER || player->powers[pw_flashing] > (flashingtics/4)*3)

View file

@ -118,8 +118,8 @@ consvar_t cv_gamemidimusic = {"midimusic", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_O
consvar_t cv_gamesounds = {"sounds", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, GameSounds_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_gamesounds = {"sounds", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, GameSounds_OnChange, 0, NULL, NULL, 0, 0, NULL};
// Window focus sound sytem toggles // Window focus sound sytem toggles
consvar_t cv_playmusicifunfocused = {"playmusicifunfocused", "No", CV_SAVE, CV_YesNo}; consvar_t cv_playmusicifunfocused = {"playmusicifunfocused", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_playsoundsifunfocused = {"playsoundsifunfocused", "No", CV_SAVE, CV_YesNo}; consvar_t cv_playsoundsifunfocused = {"playsoundsifunfocused", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
#ifdef HAVE_OPENMPT #ifdef HAVE_OPENMPT
static CV_PossibleValue_t interpolationfilter_cons_t[] = {{0, "Default"}, {1, "None"}, {2, "Linear"}, {4, "Cubic"}, {8, "Windowed sinc"}, {0, NULL}}; static CV_PossibleValue_t interpolationfilter_cons_t[] = {{0, "Default"}, {1, "None"}, {2, "Linear"}, {4, "Cubic"}, {8, "Windowed sinc"}, {0, NULL}};