From 203f9d8c1af8c3e3a088eab91d709b8f8cdb0a6b Mon Sep 17 00:00:00 2001 From: lachwright Date: Sun, 22 Sep 2019 21:11:49 +0800 Subject: [PATCH 01/16] Trying out a new glide --- src/p_user.c | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 43138d2e9..274ea77f2 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -5240,7 +5240,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) player->glidetime = 0; P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE); - P_InstaThrust(player->mo, player->mo->angle, FixedMul(glidespeed, player->mo->scale)); + //P_InstaThrust(player->mo, player->mo->angle, FixedMul(glidespeed, player->mo->scale)); player->pflags &= ~(PF_SPINNING|PF_STARTDASH); } break; @@ -8010,8 +8010,12 @@ static void P_MovePlayer(player_t *player) // AKA my own gravity. =) 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 glidespeed = player->actionspd; + fixed_t glidespeed = player->normalspeed; // TODO: this should be actionspd, but I wanted to play around with making glide less of a flow-killer + fixed_t momx = mo->momx, momy = mo->momy; + angle_t angle = mo->angle; + angle_t moveangle = R_PointToAngle2(0, 0, momx, momy); if (player->powers[pw_super]) glidespeed *= 2; @@ -8038,12 +8042,29 @@ static void P_MovePlayer(player_t *player) speed = FixedMul(speed - player->glidetime*FRACUNIT, player->mo->scale); if (speed < 0) speed = 0; - P_InstaThrust(player->mo, player->mo->angle-leeway, speed); + P_InstaThrust(player->mo, moveangle - leeway, speed); } - 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)); + { + fixed_t speed, glidex, glidey = 0, scale = mo->scale; + fixed_t accelfactor = 4*FRACUNIT - 3*FINECOSINE(abs(((angle >> ANGLETOFINESHIFT) & FINEMASK) - ((moveangle >> ANGLETOFINESHIFT) & FINEMASK))); // mamgic number BAD but this feels right + + if (mo->eflags & MFE_UNDERWATER) + speed = FixedMul((glidespeed>>1) + player->glidetime*750, scale); + else + speed = FixedMul(glidespeed + player->glidetime*1500, scale); + + glidex = P_ReturnThrustX(mo, angle, speed); + + if (!(twodlevel || (mo->flags2 & MF2_TWOD))) + glidey = P_ReturnThrustY(mo, angle, speed); + + P_Thrust(mo, angle, FixedMul(accelfactor, scale)); + if (P_AproxDistance(mo->momx, mo->momy) > speed) + { + P_InstaThrust(mo, R_PointToAngle2(0, 0, mo->momx, mo->momy), speed); + } + } player->glidetime++; @@ -11175,7 +11196,7 @@ void P_PlayerThink(player_t *player) ; else if (!(player->pflags & PF_DIRECTIONCHAR) || (player->climbing // stuff where the direction is forced at all times - || (player->pflags & PF_GLIDING)) + /*|| (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 || G_RingSlingerGametype()) // no firing rings in directions your player isn't aiming player->drawangle = player->mo->angle; @@ -11219,7 +11240,12 @@ void P_PlayerThink(player_t *player) angle_t diff; UINT8 factor; - if (player->pflags & PF_SLIDING) + if (player->pflags & PF_GLIDING) + { + 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 (player->mo->eflags & MFE_TOUCHWATER || player->powers[pw_flashing] > (flashingtics/4)*3) From e9d211d2bccdd325a582982a6aaf9e90347eb7ad Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 23 Sep 2019 00:21:28 +0800 Subject: [PATCH 02/16] reallowed strafe key leeway, increased leeway strength --- src/p_user.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 274ea77f2..979d80de0 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8014,8 +8014,7 @@ static void P_MovePlayer(player_t *player) fixed_t leeway; fixed_t glidespeed = player->normalspeed; // TODO: this should be actionspd, but I wanted to play around with making glide less of a flow-killer fixed_t momx = mo->momx, momy = mo->momy; - angle_t angle = mo->angle; - angle_t moveangle = R_PointToAngle2(0, 0, momx, momy); + angle_t angle, moveangle = R_PointToAngle2(0, 0, momx, momy); if (player->powers[pw_super]) glidespeed *= 2; @@ -8032,7 +8031,8 @@ static void P_MovePlayer(player_t *player) } // Strafing while gliding. - leeway = FixedAngle(cmd->sidemove*(FRACUNIT/2)); + leeway = FixedAngle(cmd->sidemove*(FRACUNIT)); + angle = mo->angle - leeway; if (player->skidtime) // ground gliding { @@ -8042,22 +8042,23 @@ static void P_MovePlayer(player_t *player) speed = FixedMul(speed - player->glidetime*FRACUNIT, player->mo->scale); if (speed < 0) speed = 0; - P_InstaThrust(player->mo, moveangle - leeway, speed); + P_InstaThrust(player->mo, moveangle, speed); } else { - fixed_t speed, glidex, glidey = 0, scale = mo->scale; - fixed_t accelfactor = 4*FRACUNIT - 3*FINECOSINE(abs(((angle >> ANGLETOFINESHIFT) & FINEMASK) - ((moveangle >> ANGLETOFINESHIFT) & FINEMASK))); // mamgic number BAD but this feels right + //fixed_t glidex, glidey = 0; + fixed_t speed, scale = mo->scale; + fixed_t accelfactor = 4*FRACUNIT - 3*FINECOSINE(((angle-moveangle) >> ANGLETOFINESHIFT) & FINEMASK); // mamgic number BAD but this feels right if (mo->eflags & MFE_UNDERWATER) speed = FixedMul((glidespeed>>1) + player->glidetime*750, scale); else speed = FixedMul(glidespeed + player->glidetime*1500, scale); - glidex = P_ReturnThrustX(mo, angle, speed); + /*glidex = P_ReturnThrustX(mo, angle, speed); if (!(twodlevel || (mo->flags2 & MF2_TWOD))) - glidey = P_ReturnThrustY(mo, angle, speed); + glidey = P_ReturnThrustY(mo, angle, speed);*/ P_Thrust(mo, angle, FixedMul(accelfactor, scale)); if (P_AproxDistance(mo->momx, mo->momy) > speed) @@ -11242,7 +11243,10 @@ void P_PlayerThink(player_t *player) if (player->pflags & PF_GLIDING) { - diff = (R_PointToAngle2(0, 0, player->rmomx, player->rmomy) - player->drawangle); + 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) From e897f5df4537a03161d7eaa0a768266377b1a0b9 Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 23 Sep 2019 02:56:01 +0800 Subject: [PATCH 03/16] Sneakers affect max glide speed, changed glideslide behavior --- src/p_user.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 8de99dcd3..7a0b4295b 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8018,7 +8018,7 @@ static void P_MovePlayer(player_t *player) fixed_t momx = mo->momx, momy = mo->momy; 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; if (player->mo->eflags & MFE_VERTICALFLIP) @@ -8036,17 +8036,7 @@ static void P_MovePlayer(player_t *player) leeway = FixedAngle(cmd->sidemove*(FRACUNIT)); angle = mo->angle - leeway; - if (player->skidtime) // ground gliding - { - fixed_t speed = FixedMul(glidespeed, FRACUNIT - (FRACUNIT>>2)); - if (player->mo->eflags & MFE_UNDERWATER) - speed >>= 1; - speed = FixedMul(speed - player->glidetime*FRACUNIT, player->mo->scale); - if (speed < 0) - speed = 0; - P_InstaThrust(player->mo, moveangle, speed); - } - else + if (!player->skidtime) { //fixed_t glidex, glidey = 0; fixed_t speed, scale = mo->scale; From de294d84e7cb23870bf3ddd0f4682927a7e104e7 Mon Sep 17 00:00:00 2001 From: lachwright Date: Tue, 24 Sep 2019 02:17:20 +0800 Subject: [PATCH 04/16] Lots of CA_GLIDEANDCLIMB changes: Glide speed now starts at whatever speed you were traveling at prior. If glide speed is below actionspd, the glide accelerates towards it. When landing from a glide, player now enters a landing animation (SPR2_LAND); they cannot move in this state, but they can jump or start a spindash. Ground-sliding after a glide can now be cancelled into the landing animation by releasing jump, where the same rules apply. Climb speed increased x1.33. --- src/dehacked.c | 1 + src/info.c | 7 +++-- src/info.h | 5 ++-- src/p_user.c | 78 ++++++++++++++++++++++++++++++++++++-------------- 4 files changed, 64 insertions(+), 27 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 8334de61a..bcb199694 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -4183,6 +4183,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit // CA_GLIDEANDCLIMB "S_PLAY_GLIDE", + "S_PLAY_GLIDE_LANDING", "S_PLAY_CLING", "S_PLAY_CLIMB", diff --git a/src/info.c b/src/info.c index da8022cd4..e795b3078 100644 --- a/src/info.c +++ b/src/info.c @@ -511,6 +511,7 @@ char spr2names[NUMPLAYERSPRITES][5] = "TIRE", "GLID", + "LAND", "CLNG", "CLMB", @@ -518,7 +519,6 @@ char spr2names[NUMPLAYERSPRITES][5] = "FRUN", "BNCE", - "BLND", "FIRE", @@ -614,6 +614,7 @@ playersprite_t spr2defaults[NUMPLAYERSPRITES] = { 0, // SPR2_TIRE, (conditional, will never be referenced) SPR2_FLY , // SPR2_GLID, + SPR2_ROLL, // SPR2_LAND, SPR2_CLMB, // SPR2_CLNG, SPR2_ROLL, // SPR2_CLMB, @@ -621,7 +622,6 @@ playersprite_t spr2defaults[NUMPLAYERSPRITES] = { SPR2_RUN , // SPR2_FRUN, SPR2_FALL, // SPR2_BNCE, - SPR2_ROLL, // SPR2_BLND, 0, // SPR2_FIRE, @@ -744,6 +744,7 @@ state_t states[NUMSTATES] = // CA_GLIDEANDCLIMB {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_CLMB, 5, {NULL}, 0, 0, S_PLAY_CLIMB}, // S_PLAY_CLIMB @@ -753,7 +754,7 @@ state_t states[NUMSTATES] = // CA_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 {SPR_PLAY, SPR2_FIRE|FF_SPR2ENDSTATE, 2, {NULL}, S_PLAY_FIRE_FINISH, 0, S_PLAY_FIRE}, // S_PLAY_FIRE diff --git a/src/info.h b/src/info.h index 74e4b87a2..0220e286d 100644 --- a/src/info.h +++ b/src/info.h @@ -764,6 +764,7 @@ typedef enum playersprite SPR2_TIRE, // tired SPR2_GLID, // glide + SPR2_LAND, // landing after glide/bounce SPR2_CLNG, // cling SPR2_CLMB, // climb @@ -771,7 +772,6 @@ typedef enum playersprite SPR2_FRUN, // float run SPR2_BNCE, // bounce - SPR2_BLND, // bounce landing SPR2_FIRE, // fire @@ -893,6 +893,7 @@ typedef enum state // CA_GLIDEANDCLIMB S_PLAY_GLIDE, + S_PLAY_GLIDE_LANDING, S_PLAY_CLING, S_PLAY_CLIMB, @@ -4195,7 +4196,7 @@ typedef enum mobj_type MT_SEAWEED, // DSZ Seaweed MT_WATERDRIP, // Dripping Water source MT_WATERDROP, // Water drop from dripping water - MT_CORAL1, // Coral + MT_CORAL1, // Coral MT_CORAL2, MT_CORAL3, MT_CORAL4, diff --git a/src/p_user.c b/src/p_user.c index 7a0b4295b..2b3bbe7ae 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2249,6 +2249,19 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff) else if (!player->skidtime) 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); + player->pflags &= ~PF_GLIDING; + P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE_LANDING); + S_StartSound(player->mo, sfx_s3k4c); + player->powers[pw_nocontrol] = (player->mo->tics) + (1<<15); + player->mo->momx = player->cmomx; + player->mo->momy = player->cmomy; + } + } else if (player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2) { if (player->mo->state-states != S_PLAY_MELEE_LANDING) @@ -4457,7 +4470,8 @@ static void P_DoSpinDashDust(player_t *player) static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd) { 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; #ifdef HAVE_BLUA @@ -4485,6 +4499,8 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd) && !player->mo->momz && onground && !(player->pflags & (PF_USEDOWN|PF_SPINNING)) && canstand) { + if (player->mo->state - states == S_PLAY_GLIDE_LANDING) // dear lord this is a fuckin hack and a half + player->powers[pw_nocontrol] = 0; player->mo->momx = player->cmomx; player->mo->momy = player->cmomy; player->pflags |= (PF_USEDOWN|PF_STARTDASH|PF_SPINNING); @@ -5132,6 +5148,10 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) // can't jump while in air, can't jump while jumping if (onground || player->climbing || player->powers[pw_carry]) { + if (player->mo->state-states == S_PLAY_GLIDE_LANDING && player->powers[pw_nocontrol] & (1<<15)) + { + player->powers[pw_nocontrol] = 0; + } P_DoJump(player, true); player->secondjump = 0; player->pflags &= ~PF_THOKKED; @@ -5685,7 +5705,7 @@ static void P_2dMovement(player_t *player) if (player->climbing) { 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; } @@ -5909,7 +5929,7 @@ static void P_3dMovement(player_t *player) if (player->climbing) { 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 && cmd->forwardmove != 0 && !(player->pflags & PF_GLIDING || player->exiting @@ -5943,7 +5963,7 @@ static void P_3dMovement(player_t *player) } // Sideways movement 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, FixedMul(FixedDiv(cmd->sidemove*FRACUNIT, 15*FRACUNIT>>1), player->mo->scale)); // Analog movement control else if (analogmove) { @@ -7642,10 +7662,12 @@ static void P_SkidStuff(player_t *player) P_SetPlayerMobjState(player->mo, S_PLAY_FALL); } // 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_SetPlayerMobjState(player->mo, S_PLAY_STND); + player->pflags &= ~PF_GLIDING; + P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE_LANDING); + player->powers[pw_nocontrol] = (player->mo->tics) + (1<<15); player->mo->momx = player->cmomx; player->mo->momy = player->cmomy; } @@ -8014,8 +8036,8 @@ static void P_MovePlayer(player_t *player) { mobj_t *mo = player->mo; // seriously why isn't this at the top of the function hngngngng fixed_t leeway; - fixed_t glidespeed = player->normalspeed; // TODO: this should be actionspd, but I wanted to play around with making glide less of a flow-killer - fixed_t momx = mo->momx, momy = mo->momy; + fixed_t glidespeed = player->actionspd; // TODO: this should be actionspd, but I wanted to play around with making glide less of a flow-killer + 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] || player->powers[pw_sneakers]) @@ -8040,6 +8062,7 @@ static void P_MovePlayer(player_t *player) { //fixed_t glidex, glidey = 0; fixed_t speed, scale = mo->scale; + fixed_t newMagnitude, oldMagnitude = R_PointToDist2(momx, momy, 0, 0); fixed_t accelfactor = 4*FRACUNIT - 3*FINECOSINE(((angle-moveangle) >> ANGLETOFINESHIFT) & FINEMASK); // mamgic number BAD but this feels right if (mo->eflags & MFE_UNDERWATER) @@ -8053,9 +8076,29 @@ static void P_MovePlayer(player_t *player) glidey = P_ReturnThrustY(mo, angle, speed);*/ P_Thrust(mo, angle, FixedMul(accelfactor, scale)); - if (P_AproxDistance(mo->momx, mo->momy) > speed) + + newMagnitude = R_PointToDist2(player->mo->momx - player->cmomx, player->mo->momy - player->cmomy, 0, 0); + if (newMagnitude > speed) { - P_InstaThrust(mo, R_PointToAngle2(0, 0, mo->momx, mo->momy), 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; + } } } @@ -8082,18 +8125,9 @@ static void P_MovePlayer(player_t *player) } else if (player->climbing) // 'Deceleration' for climbing on walls. { - 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->mo->momz < 0) - { - player->mo->momz += FixedMul(FRACUNIT/2, player->mo->scale); - if (player->mo->momz > 0) - player->mo->momz = 0; - } + + if (!player->cmd.forwardmove) + player->mo->momz = 0; } else if (player->pflags & PF_BOUNCING) { From 41d718dabf03a836f7d28498bcb05528bc48512a Mon Sep 17 00:00:00 2001 From: lachwright Date: Tue, 24 Sep 2019 03:10:41 +0800 Subject: [PATCH 05/16] Cleanup --- src/p_user.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 2b3bbe7ae..fd43baebc 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2254,7 +2254,6 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff) if (player->mo->state-states != S_PLAY_GLIDE_LANDING) { P_ResetPlayer(player); - player->pflags &= ~PF_GLIDING; P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE_LANDING); S_StartSound(player->mo, sfx_s3k4c); player->powers[pw_nocontrol] = (player->mo->tics) + (1<<15); @@ -5256,7 +5255,7 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) // Now Knuckles-type abilities are checked. if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) { - INT32 glidespeed = player->actionspd; + //INT32 glidespeed = player->actionspd; player->pflags |= PF_GLIDING|PF_THOKKED; player->glidetime = 0; @@ -5963,7 +5962,7 @@ static void P_3dMovement(player_t *player) } // Sideways movement if (player->climbing) - P_InstaThrust(player->mo, player->mo->angle-ANGLE_90, FixedMul(FixedDiv(cmd->sidemove*FRACUNIT, 15*FRACUNIT>>1), player->mo->scale)); + P_InstaThrust(player->mo, player->mo->angle-ANGLE_90, FixedDiv(cmd->sidemove*player->mo->scale, 15*FRACUNIT>>1), player->mo->scale); // Analog movement control else if (analogmove) { @@ -7665,7 +7664,6 @@ static void P_SkidStuff(player_t *player) else if (player->glidetime > 15 || !(player->cmd.buttons & BT_JUMP)) { P_ResetPlayer(player); - player->pflags &= ~PF_GLIDING; P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE_LANDING); player->powers[pw_nocontrol] = (player->mo->tics) + (1<<15); player->mo->momx = player->cmomx; @@ -8036,7 +8034,7 @@ static void P_MovePlayer(player_t *player) { mobj_t *mo = player->mo; // seriously why isn't this at the top of the function hngngngng fixed_t leeway; - fixed_t glidespeed = player->actionspd; // TODO: this should be actionspd, but I wanted to play around with making glide less of a flow-killer + 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); @@ -8058,9 +8056,8 @@ static void P_MovePlayer(player_t *player) leeway = FixedAngle(cmd->sidemove*(FRACUNIT)); angle = mo->angle - leeway; - if (!player->skidtime) + if (!player->skidtime) // TODO: make sure this works in 2D! { - //fixed_t glidex, glidey = 0; fixed_t speed, scale = mo->scale; fixed_t newMagnitude, oldMagnitude = R_PointToDist2(momx, momy, 0, 0); fixed_t accelfactor = 4*FRACUNIT - 3*FINECOSINE(((angle-moveangle) >> ANGLETOFINESHIFT) & FINEMASK); // mamgic number BAD but this feels right @@ -8070,11 +8067,6 @@ static void P_MovePlayer(player_t *player) else speed = FixedMul(glidespeed + player->glidetime*1500, scale); - /*glidex = P_ReturnThrustX(mo, angle, speed); - - if (!(twodlevel || (mo->flags2 & MF2_TWOD))) - glidey = P_ReturnThrustY(mo, angle, speed);*/ - P_Thrust(mo, angle, FixedMul(accelfactor, scale)); newMagnitude = R_PointToDist2(player->mo->momx - player->cmomx, player->mo->momy - player->cmomy, 0, 0); From 3fdf48f9b062bb32e22d399c28f4ee20eb034bf0 Mon Sep 17 00:00:00 2001 From: lachwright Date: Tue, 24 Sep 2019 03:21:01 +0800 Subject: [PATCH 06/16] Further cleanup --- src/p_user.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index fd43baebc..44421ba7e 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2256,7 +2256,7 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff) P_ResetPlayer(player); P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE_LANDING); S_StartSound(player->mo, sfx_s3k4c); - player->powers[pw_nocontrol] = (player->mo->tics) + (1<<15); + player->pflags |= PF_STASIS; player->mo->momx = player->cmomx; player->mo->momy = player->cmomy; } @@ -4499,7 +4499,7 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd) && canstand) { if (player->mo->state - states == S_PLAY_GLIDE_LANDING) // dear lord this is a fuckin hack and a half - player->powers[pw_nocontrol] = 0; + player->pflags &= ~PF_STASIS; player->mo->momx = player->cmomx; player->mo->momy = player->cmomy; player->pflags |= (PF_USEDOWN|PF_STARTDASH|PF_SPINNING); @@ -5147,9 +5147,9 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) // can't jump while in air, can't jump while jumping if (onground || player->climbing || player->powers[pw_carry]) { - if (player->mo->state-states == S_PLAY_GLIDE_LANDING && player->powers[pw_nocontrol] & (1<<15)) + if (player->mo->state-states == S_PLAY_GLIDE_LANDING && ((~player->pflags) & PF_JUMPSTASIS)) { - player->powers[pw_nocontrol] = 0; + player->pflags &= ~PF_STASIS; } P_DoJump(player, true); player->secondjump = 0; @@ -5962,7 +5962,7 @@ static void P_3dMovement(player_t *player) } // Sideways movement if (player->climbing) - P_InstaThrust(player->mo, player->mo->angle-ANGLE_90, FixedDiv(cmd->sidemove*player->mo->scale, 15*FRACUNIT>>1), player->mo->scale); + P_InstaThrust(player->mo, player->mo->angle-ANGLE_90, FixedDiv(cmd->sidemove*player->mo->scale, 15*FRACUNIT>>1)); // Analog movement control else if (analogmove) { @@ -7665,7 +7665,7 @@ static void P_SkidStuff(player_t *player) { P_ResetPlayer(player); P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE_LANDING); - player->powers[pw_nocontrol] = (player->mo->tics) + (1<<15); + player->pflags |= PF_STASIS; player->mo->momx = player->cmomx; player->mo->momy = player->cmomy; } @@ -7773,6 +7773,9 @@ static void P_MovePlayer(player_t *player) if (!(player->powers[pw_nocontrol] & (1<<15))) player->pflags |= PF_JUMPSTASIS; } + else if (player->charability == CA_GLIDEANDCLIMB && player->mo->state-states == S_PLAY_GLIDE_LANDING) + player->pflags |= PF_STASIS; + // note: don't unset stasis here if (!player->spectator && G_TagGametype()) From 98d0a0d98eed8450fc1bea3b442ae4d0dc183ce4 Mon Sep 17 00:00:00 2001 From: lachwright Date: Tue, 24 Sep 2019 03:54:04 +0800 Subject: [PATCH 07/16] Added bounce-off behavior for multi-hit enemies/bosses --- src/p_inter.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/p_inter.c b/src/p_inter.c index bfdec3e23..7f78fcfc9 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -471,6 +471,11 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) toucher->momy = -toucher->momy; if (player->charability == CA_FLY && player->panim == PA_ABILITY) toucher->momz = -toucher->momz/2; + else if (player->charability == CA_GLIDEANDCLIMB && player->pflags & PF_GLIDING && !P_IsObjectOnGround(player->mo)) + { + player->pflags &= ~(PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE); + P_SetPlayerMobjState(player->mo, S_PLAY_FALL); + } } P_DamageMobj(special, toucher, toucher, 1, 0); if (player->charability == CA_TWINSPIN && player->panim == PA_ABILITY) From c72b5d8a497ea466d720ec90679cb9d8cf726dc3 Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 30 Sep 2019 10:55:57 +0800 Subject: [PATCH 08/16] Allow retention of momentum when climbing off surfaces --- src/p_user.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index d49241c47..4a8f33530 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3074,7 +3074,6 @@ static void P_DoClimbing(player_t *player) glidesector = R_IsPointInSubsector(player->mo->x + platx, player->mo->y + platy); - if (!glidesector || glidesector->sector != player->mo->subsector->sector) { boolean floorclimb = false; boolean thrust = false; @@ -3458,9 +3457,13 @@ static void P_DoClimbing(player_t *player) if (!floorclimb) { if (boostup) + { P_SetObjectMomZ(player->mo, 2*FRACUNIT, true); + if (cmd->forwardmove) + P_SetObjectMomZ(player->mo, 2*player->mo->momz/3, false); + } 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->pflags |= P_GetJumpFlags(player); @@ -3474,12 +3477,6 @@ static void P_DoClimbing(player_t *player) 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) climb = true; @@ -3498,7 +3495,7 @@ static void P_DoClimbing(player_t *player) player->pflags |= P_GetJumpFlags(player); P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); 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)); } if (!demoplayback || P_AnalogMove(player)) From 7d57d53d4578c36fa6b8d822fec551f0e3ad7d21 Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 30 Sep 2019 14:38:58 +0800 Subject: [PATCH 09/16] Allow camera movement while climbing; allow sliding while landing from a glide --- src/g_game.c | 6 ++---- src/p_map.c | 4 ++-- src/p_user.c | 49 +++++++++++++++++++++++++++++++------------------ 3 files changed, 35 insertions(+), 24 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 6c31ce9e3..449591d05 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -966,8 +966,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) forcefullinput = true; if (twodlevel || (player->mo && (player->mo->flags2 & MF2_TWOD)) - || (!demoplayback && (player->climbing - || (player->powers[pw_carry] == CR_NIGHTSMODE) + || (!demoplayback && ((player->powers[pw_carry] == CR_NIGHTSMODE) || (player->pflags & (PF_SLIDING|PF_FORCESTRAFE))))) // Analog forcestrafe = true; if (forcestrafe) @@ -1148,8 +1147,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics) if (!mouseaiming && cv_mousemove.value) forward += mousey; - if ((!demoplayback && (player->climbing - || (player->pflags & PF_SLIDING)))) // Analog for mouse + if ((!demoplayback && (player->pflags & PF_SLIDING))) // Analog for mouse side += mousex*2; else if (cv_analog.value) { diff --git a/src/p_map.c b/src/p_map.c index 8035d64a5..205fa6962 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3334,13 +3334,13 @@ isblocking: && canclimb) { slidemo->angle = climbangle; - if (!demoplayback || P_AnalogMove(slidemo->player)) + /*if (!demoplayback || P_AnalogMove(slidemo->player)) { if (slidemo->player == &players[consoleplayer]) localangle = slidemo->angle; else if (slidemo->player == &players[secondarydisplayplayer]) localangle2 = slidemo->angle; - } + }*/ if (!slidemo->player->climbing) { diff --git a/src/p_user.c b/src/p_user.c index 4a8f33530..ed2b740a4 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2257,8 +2257,8 @@ boolean P_PlayerHitFloor(player_t *player, boolean dorollstuff) P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE_LANDING); S_StartSound(player->mo, sfx_s3k4c); player->pflags |= PF_STASIS; - player->mo->momx = player->cmomx; - 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; } } else if (player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2) @@ -3498,13 +3498,13 @@ static void P_DoClimbing(player_t *player) P_Thrust(player->mo, player->mo->angle, FixedMul(-4*FRACUNIT, player->mo->scale)); } - if (!demoplayback || P_AnalogMove(player)) + /*if (!demoplayback || P_AnalogMove(player)) { if (player == &players[consoleplayer]) localangle = player->mo->angle; else if (player == &players[secondarydisplayplayer]) localangle2 = player->mo->angle; - } + }*/ if (player->climbing == 0) P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); @@ -4491,12 +4491,10 @@ static void P_DoSpinAbility(player_t *player, ticcmd_t *cmd) { case CA2_SPINDASH: // Spinning and Spindashing // Start revving - if ((cmd->buttons & BT_USE) && player->speed < FixedMul(5<mo->scale) + if ((cmd->buttons & BT_USE) && (player->speed < FixedMul(5<mo->scale) || player->mo->state - states == S_PLAY_GLIDE_LANDING) && !player->mo->momz && onground && !(player->pflags & (PF_USEDOWN|PF_SPINNING)) && canstand) { - if (player->mo->state - states == S_PLAY_GLIDE_LANDING) // dear lord this is a fuckin hack and a half - player->pflags &= ~PF_STASIS; player->mo->momx = player->cmomx; player->mo->momy = player->cmomy; player->pflags |= (PF_USEDOWN|PF_STARTDASH|PF_SPINNING); @@ -5144,10 +5142,6 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) // can't jump while in air, can't jump while jumping if (onground || player->climbing || player->powers[pw_carry]) { - if (player->mo->state-states == S_PLAY_GLIDE_LANDING && ((~player->pflags) & PF_JUMPSTASIS)) - { - player->pflags &= ~PF_STASIS; - } P_DoJump(player, true); player->secondjump = 0; player->pflags &= ~PF_THOKKED; @@ -5252,13 +5246,14 @@ static void P_DoJumpStuff(player_t *player, ticcmd_t *cmd) // Now Knuckles-type abilities are checked. if (!(player->pflags & PF_THOKKED) || player->charflags & SF_MULTIABILITY) { - //INT32 glidespeed = player->actionspd; + INT32 glidespeed = player->actionspd; player->pflags |= PF_GLIDING|PF_THOKKED; player->glidetime = 0; 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); } break; @@ -7663,8 +7658,8 @@ static void P_SkidStuff(player_t *player) P_ResetPlayer(player); P_SetPlayerMobjState(player->mo, S_PLAY_GLIDE_LANDING); player->pflags |= PF_STASIS; - player->mo->momx = player->cmomx; - 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! else if (player->skidtime == 1) @@ -7770,8 +7765,27 @@ static void P_MovePlayer(player_t *player) if (!(player->powers[pw_nocontrol] & (1<<15))) player->pflags |= PF_JUMPSTASIS; } - else if (player->charability == CA_GLIDEANDCLIMB && player->mo->state-states == S_PLAY_GLIDE_LANDING) + + if (player->charability == CA_GLIDEANDCLIMB && player->mo->state-states == S_PLAY_GLIDE_LANDING) + { player->pflags |= PF_STASIS; + if ((player->mo->tics + 1) % 3 == 0 && player->speed > 5*player->mo->scale) + { + 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); + particle->tics = 10; + + particle->destscale = (2*player->mo->scale)/3; + P_SetScale(particle, particle->destscale); + P_SetObjectMomZ(particle, FRACUNIT, false); + + if (player->mo->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER)) // overrides fire version + P_SetMobjState(particle, S_SPINDUST_BUBBLE1); + else if (player->powers[pw_shield] == SH_ELEMENTAL) + P_SetMobjState(particle, S_SPINDUST_FIRE1); + + S_StartSound(player->mo, sfx_s3k7e); // the proper "Knuckles eats dirt" sfx. + } + } // note: don't unset stasis here @@ -11284,8 +11298,7 @@ void P_PlayerThink(player_t *player) || player->powers[pw_carry] == CR_NIGHTSMODE) ; else if (!(player->pflags & PF_DIRECTIONCHAR) - || (player->climbing // stuff where the direction is forced at all times - /*|| (player->pflags & PF_GLIDING)*/) + || (player->climbing) // stuff where the direction is forced at all times || (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 player->drawangle = player->mo->angle; From 5bbd56b6fac59219ec8b1c62e2e7facad86e29e1 Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 30 Sep 2019 16:35:05 +0800 Subject: [PATCH 10/16] Improve glide bounces --- src/p_inter.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 845806137..58f72c63d 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -471,10 +471,13 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) toucher->momy = -toucher->momy; if (player->charability == CA_FLY && player->panim == PA_ABILITY) toucher->momz = -toucher->momz/2; - else if (player->charability == CA_GLIDEANDCLIMB && player->pflags & PF_GLIDING && !P_IsObjectOnGround(player->mo)) + else if (player->pflags & PF_GLIDING && !P_IsObjectOnGround(toucher)) { player->pflags &= ~(PF_GLIDING|PF_JUMPED|PF_NOJUMPDAMAGE); - P_SetPlayerMobjState(player->mo, 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; } } P_DamageMobj(special, toucher, toucher, 1, 0); @@ -1514,10 +1517,13 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) toucher->momx = P_ReturnThrustX(special, angle, touchspeed); toucher->momy = P_ReturnThrustY(special, angle, touchspeed); 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); 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; @@ -1562,10 +1568,13 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) toucher->momx = P_ReturnThrustX(special, special->angle, touchspeed); toucher->momy = P_ReturnThrustY(special, special->angle, touchspeed); 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); 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; From c71213155d0d675974172502eef1fecb88c844e2 Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 14 Oct 2019 04:08:07 +0800 Subject: [PATCH 11/16] Unfuck glide slide/landing dust's P_RandomRange parameters --- src/p_user.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index ed2b740a4..b40a02fdf 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7667,7 +7667,8 @@ static void P_SkidStuff(player_t *player) // Spawn a particle every 3 tics. 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->destscale = (2*player->mo->scale)/3; @@ -7769,9 +7770,10 @@ static void P_MovePlayer(player_t *player) if (player->charability == CA_GLIDEANDCLIMB && player->mo->state-states == S_PLAY_GLIDE_LANDING) { player->pflags |= PF_STASIS; - if ((player->mo->tics + 1) % 3 == 0 && player->speed > 5*player->mo->scale) + if ((player->mo->tics + 1) % 3 == 0 && player->speed > 5*player->mo->scale) // Copy of the glide-slide dust effect, for consistency { - 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->destscale = (2*player->mo->scale)/3; From 0836062edd32dcb6e11d1d5e997ef2e18b90870e Mon Sep 17 00:00:00 2001 From: lachwright Date: Tue, 15 Oct 2019 01:19:58 +0800 Subject: [PATCH 12/16] Limit climb camera rotation to a 180 degree cone --- src/p_user.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index b40a02fdf..13c10e2e2 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3498,13 +3498,26 @@ static void P_DoClimbing(player_t *player) P_Thrust(player->mo, player->mo->angle, FixedMul(-4*FRACUNIT, player->mo->scale)); } - /*if (!demoplayback || P_AnalogMove(player)) +#define CLIMBCONEMAX FixedAngle(90*FRACUNIT) + if (!demoplayback || P_AnalogMove(player)) { 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]) - 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) P_SetPlayerMobjState(player->mo, S_PLAY_JUMP); From 2417c5aab23d45f2e415216c7077b17b81464939 Mon Sep 17 00:00:00 2001 From: lachwright Date: Tue, 15 Oct 2019 01:40:56 +0800 Subject: [PATCH 13/16] Remove glide landing dust; put player in landing state after glide-sliding off a ledge --- src/p_user.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 13c10e2e2..36d470666 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7663,6 +7663,7 @@ static void P_SkidStuff(player_t *player) { player->skidtime = 0; 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); } // Get up and brush yourself off, idiot. @@ -7783,23 +7784,6 @@ static void P_MovePlayer(player_t *player) if (player->charability == CA_GLIDEANDCLIMB && player->mo->state-states == S_PLAY_GLIDE_LANDING) { player->pflags |= PF_STASIS; - if ((player->mo->tics + 1) % 3 == 0 && player->speed > 5*player->mo->scale) // Copy of the glide-slide dust effect, for consistency - { - 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->destscale = (2*player->mo->scale)/3; - P_SetScale(particle, particle->destscale); - P_SetObjectMomZ(particle, FRACUNIT, false); - - if (player->mo->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER)) // overrides fire version - P_SetMobjState(particle, S_SPINDUST_BUBBLE1); - else if (player->powers[pw_shield] == SH_ELEMENTAL) - P_SetMobjState(particle, S_SPINDUST_FIRE1); - - S_StartSound(player->mo, sfx_s3k7e); // the proper "Knuckles eats dirt" sfx. - } } // note: don't unset stasis here From 9ef72c0862b820e016a96a21028dc14fd4d44c8e Mon Sep 17 00:00:00 2001 From: lachwright Date: Tue, 15 Oct 2019 02:57:18 +0800 Subject: [PATCH 14/16] Fix directionchar issue from faulty merge conflict resolution --- src/p_user.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 7f93f3021..d740a64d6 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -11379,9 +11379,6 @@ void P_PlayerThink(player_t *player) ; else { - angle_t diff; - UINT8 factor; - if (player->pflags & PF_GLIDING) { if (player->speed < player->mo->scale) From 64e77088323528ed87ecddca56410695f72d42d8 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 25 Oct 2019 21:36:10 -0700 Subject: [PATCH 15/16] I say damn you massive initializer! --- src/s_sound.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/s_sound.c b/src/s_sound.c index 00576ff55..22bc848fe 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -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}; // Window focus sound sytem toggles -consvar_t cv_playmusicifunfocused = {"playmusicifunfocused", "No", CV_SAVE, CV_YesNo}; -consvar_t cv_playsoundsifunfocused = {"playsoundsifunfocused", "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, NULL, 0, NULL, NULL, 0, 0, NULL}; #ifdef HAVE_OPENMPT static CV_PossibleValue_t interpolationfilter_cons_t[] = {{0, "Default"}, {1, "None"}, {2, "Linear"}, {4, "Cubic"}, {8, "Windowed sinc"}, {0, NULL}}; From 634292a5fcb3f5e23fde350a2428ae8bbbca1640 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 25 Oct 2019 21:44:34 -0700 Subject: [PATCH 16/16] Differing signedness comparison --- src/p_mobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index e071f79d8..5735dc27b 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7976,7 +7976,7 @@ void P_MobjThinker(mobj_t *mobj) INT32 strength; ++mobj->movedir; mobj->frame &= ~FF_TRANSMASK; - strength = min(mobj->fuse, mobj->movedir)*3; + strength = min(mobj->fuse, (INT32)mobj->movedir)*3; if (strength < 10) mobj->frame |= ((10-strength)<<(FF_TRANSSHIFT)); }