Skip to content

Commit

Permalink
JK2 style swing improvements
Browse files Browse the repository at this point in the history
match movement debuf + full speed backwards running
  • Loading branch information
Bucky21659 committed May 16, 2020
1 parent 9813db7 commit 64349df
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 52 deletions.
8 changes: 7 additions & 1 deletion codemp/game/bg_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,10 @@ void PM_SetSaberMove(short newMove);

void PM_SetForceJumpZStart(float value);

void BG_CycleInven(playerState_t *ps, int direction);
void BG_CycleInven(playerState_t *ps, int direction);

#ifdef _GAME
#define JK2SWINGS(ps) (ps && (g_tweakSaber.integer & (1<<5)/*ST_NO_REDCHAIN*/) && !ps->stats[STAT_RACEMODE])
#else
#define JK2SWINGS(ps) (ps && cgs.serverMod == SVMOD_JAPRO && (cgs.jcinfo & (1<<28)/*CINFO_JAPRO_NOREDCHAIN*/) && !ps->stats[STAT_RACEMODE])
#endif
19 changes: 18 additions & 1 deletion codemp/game/bg_panimate.c
Original file line number Diff line number Diff line change
Expand Up @@ -2598,7 +2598,7 @@ void PM_ContinueLegsAnim( int anim ) {
BG_StartLegsAnim( pm->ps, anim );
}

void PM_ForceLegsAnim( int anim) {
void PM_ForceLegsAnim( int anim ) {
if (BG_InSpecialJump(pm->ps->legsAnim) &&
pm->ps->legsTimer > 0 &&
!BG_InSpecialJump(anim))
Expand Down Expand Up @@ -2694,6 +2694,18 @@ void PM_SetTorsoAnimTimer(int time )

void BG_SaberStartTransAnim( int clientNum, int saberAnimLevel, int weapon, int anim, float *animSpeed, int broken )
{
if (JK2SWINGS(pm->ps)) {
if (((anim) >= BOTH_T1_BR__R && (anim) <= BOTH_T1_BL_TL) ||
((anim) >= BOTH_T2_BR__R && (anim) <= BOTH_T2_BL_TL) ||
((anim) >= BOTH_T3_BR__R && (anim) <= BOTH_T3_BL_TL))
{
if (saberAnimLevel == SS_FAST || saberAnimLevel == SS_STRONG) {
animSpeed = 0;
return;
}
}
}

if ( anim >= BOTH_A1_T__B_ && anim <= BOTH_ROLL_STAB )
{
if ( weapon == WP_SABER )
Expand Down Expand Up @@ -2818,6 +2830,11 @@ void BG_SetAnimFinal(playerState_t *ps, animation_t *animations,
{
ps->torsoTimer /= 1.7;
}

if (JK2SWINGS(pm->ps) && editAnimSpeed)
{
pm->ps->torsoTimer /= editAnimSpeed;
}
}
}

Expand Down
36 changes: 13 additions & 23 deletions codemp/game/bg_pmove.c
Original file line number Diff line number Diff line change
Expand Up @@ -1883,12 +1883,12 @@ qboolean PM_AdjustAngleForWallJump( playerState_t *ps, usercmd_t *ucmd, qboolean
ps->legsTimer = ps->torsoTimer = 150;
}
}
#ifdef _CGAME
if (cgs.serverMod == SVMOD_JAPLUS)
PM_UpdateViewAngles(ps, ucmd); //update here for vertical freelook prediction
#endif
}
}
#ifdef _CGAME
if (cgs.serverMod == SVMOD_JAPLUS)
PM_UpdateViewAngles(ps, ucmd); //update here for vertical freelook prediction
#endif
}
else if ( pm->debugMelee )
{//uber-skillz
Expand Down Expand Up @@ -9985,6 +9985,7 @@ qboolean PM_SaberInTransition( int move );
void BG_AdjustClientSpeed(playerState_t *ps, usercmd_t *cmd, int svTime)
{
saberInfo_t *saber;
int fixroll = GetFixRoll(ps);

if (ps->clientNum >= MAX_CLIENTS)
{
Expand Down Expand Up @@ -10014,7 +10015,7 @@ void BG_AdjustClientSpeed(playerState_t *ps, usercmd_t *cmd, int svTime)
}


if ( cmd->forwardmove < 0 && !(cmd->buttons&BUTTON_WALKING) && pm->ps->groundEntityNum != ENTITYNUM_NONE )
if ( cmd->forwardmove < 0 && !(cmd->buttons&BUTTON_WALKING) && pm->ps->groundEntityNum != ENTITYNUM_NONE && !JK2SWINGS(ps) )
{//running backwards is slower than running forwards (like SP)
ps->speed *= 0.75f;
}
Expand Down Expand Up @@ -10092,7 +10093,7 @@ void BG_AdjustClientSpeed(playerState_t *ps, usercmd_t *cmd, int svTime)
}
else if ( BG_SpinningSaberAnim( ps->legsAnim ) )
{
if (ps->fd.saberAnimLevel == FORCE_LEVEL_3)
if (ps->fd.saberAnimLevel == FORCE_LEVEL_3 && !JK2SWINGS(ps))
{
ps->speed *= 0.3f;
}
Expand All @@ -10111,20 +10112,13 @@ void BG_AdjustClientSpeed(playerState_t *ps, usercmd_t *cmd, int svTime)
ps->speed *= 0.85f;
break;
case FORCE_LEVEL_3:
#if _GAME
if (g_tweakSaber.integer & ST_NO_REDCHAIN && !ps->stats[STAT_RACEMODE])
#else
if (cgs.serverMod == SVMOD_JAPRO && cgs.jcinfo & JAPRO_CINFO_NOREDCHAIN && !cg.predictedPlayerState.stats[STAT_RACEMODE])
#endif
ps->speed *= 0.70f;
else
ps->speed *= 0.55f;
ps->speed *= JK2SWINGS(ps) ? 0.70f : 0.55f;
break;
default:
break;
}
}
else if (ps->weapon == WP_SABER && ps->fd.saberAnimLevel == FORCE_LEVEL_3 &&
else if (ps->weapon == WP_SABER && ps->fd.saberAnimLevel == FORCE_LEVEL_3 && !JK2SWINGS(ps) &&
PM_SaberInTransition(ps->saberMove))
{ //Now, we want to even slow down in transitions for level 3 (since it has chains and stuff now)
if (cmd->forwardmove < 0)
Expand All @@ -10146,7 +10140,7 @@ void BG_AdjustClientSpeed(playerState_t *ps, usercmd_t *cmd, int svTime)
*/


if (GetFixRoll(ps) > 2)
if (fixroll > 2)
{
if ( BG_InRoll( ps, ps->legsAnim ) && ps->speed > 50.0f )
{ //can't roll unless you're able to move normally
Expand Down Expand Up @@ -10192,7 +10186,7 @@ void BG_AdjustClientSpeed(playerState_t *ps, usercmd_t *cmd, int svTime)
#endif
*/

else if (GetFixRoll(ps) == 2)
else if (fixroll == 2)
{
if ( BG_InRoll( ps, ps->legsAnim ) && ps->speed > 50 )
{ //can't roll unless you're able to move normally
Expand Down Expand Up @@ -10234,7 +10228,7 @@ void BG_AdjustClientSpeed(playerState_t *ps, usercmd_t *cmd, int svTime)
#endif
*/

else if (GetFixRoll(ps) == 1)
else if (fixroll == 1)
{
if ( BG_InRoll( ps, ps->legsAnim ) && ps->speed > 50 )
{ //can't roll unless you're able to move normally
Expand Down Expand Up @@ -12836,10 +12830,6 @@ void PmoveSingle (pmove_t *pmove) {
pm->ps->eFlags |= EF_JETPACK_FLAMING;
}
*/




}

if (pm->ps->clientNum >= MAX_CLIENTS &&
Expand Down Expand Up @@ -13193,7 +13183,7 @@ void PmoveSingle (pmove_t *pmove) {
//trap->SendServerCommand( -1, va("print \"333? msec: %i\n\"", pml.msec ));
}
#elif _CGAME
else if ((cgs.jcinfo & JAPRO_CINFO_HIGHFPSFIX) && ((pml.msec < 4) || (pml.msec > 25))) {
else if ((cgs.jcinfo & JAPRO_CINFO_HIGHFPSFIX) && (pml.msec < 4 || pml.msec > 25)) {
}
#endif
else if (!pm->pmove_float) {
Expand Down
39 changes: 12 additions & 27 deletions codemp/game/bg_saber.c
Original file line number Diff line number Diff line change
Expand Up @@ -758,11 +758,7 @@ qboolean PM_SaberKataDone(int curmove, int newmove)
}
else if ( pm->ps->fd.saberAnimLevel == FORCE_LEVEL_3 )
{
#ifdef _GAME
if ((pm->ps->saberAttackChainCount >= 1) && !pm->ps->stats[STAT_RACEMODE] && (g_tweakSaber.integer & ST_NO_REDCHAIN))
#else
if (cgs.serverMod == SVMOD_JAPRO && (cgs.jcinfo & JAPRO_CINFO_NOREDCHAIN))
#endif
if (pm->ps->saberAttackChainCount >= 1 && JK2SWINGS(pm->ps))
{
return qtrue;
}
Expand Down Expand Up @@ -1517,11 +1513,10 @@ qboolean PM_SaberInBrokenParry( int move )
{
#ifdef _GAME
if (g_tweakSaber.integer & ST_NO_REDCHAIN)
return qfalse;
#elif _CGAME
if (cgs.jcinfo & JAPRO_CINFO_NOREDCHAIN)
return qfalse;
#else
if (cgs.serverMod == SVMOD_JAPRO && (cgs.jcinfo & JAPRO_CINFO_NOREDCHAIN))
#endif
return qfalse;

if ( move >= LS_V1_BR && move <= LS_V1_B_ )
{
Expand Down Expand Up @@ -1766,6 +1761,10 @@ saberMoveName_t PM_SaberFlipOverAttackMove(void)
else
*/
{

if (JK2SWINGS(pm->ps) && PM_irand_timesync( 0, 1 ))
return LS_A_FLIP_STAB;

return LS_A_FLIP_SLASH;
}
}
Expand Down Expand Up @@ -2785,17 +2784,12 @@ saberMoveName_t PM_SaberAttackForMovement(saberMoveName_t curmove)
//prediction values. Under laggy conditions this will cause the appearance of rapid swing
//sequence changes.

newmove = LS_A_T2B; //decided we don't like random attacks when idle, use an overhead instead.

#if 0
#ifdef _GAME
if (!pm->ps->stats[STAT_RACEMODE] && (g_tweakSaber.integer & ST_NO_REDCHAIN))
#elif _CGAME
if (cgs.serverMod == SVMOD_JAPRO && !cg.predictedPlayerState.stats[STAT_RACEMODE] && (cgs.jcinfo & JAPRO_CINFO_NOREDCHAIN))
#endif
if (JK2SWINGS(pm->ps))
newmove = PM_irand_timesync(LS_A_TL2BR, LS_A_T2B);
else
#endif
newmove = LS_A_T2B; //decided we don't like random attacks when idle, use an overhead instead.
}
}

Expand Down Expand Up @@ -4093,21 +4087,12 @@ void PM_SetSaberMove(short newMove)



#ifdef _GAME
else if ( (pm->ps->stats[STAT_RACEMODE] || !(g_tweakSaber.integer & ST_NO_REDCHAIN)) &&
#else
else if ( (cgs.serverMod != SVMOD_JAPRO || cg.predictedPlayerState.stats[STAT_RACEMODE] || !(cgs.jcinfo & JAPRO_CINFO_NOREDCHAIN)) &&
#endif
if (!JK2SWINGS(pm->ps) &&
pm->ps->fd.saberAnimLevel > FORCE_LEVEL_1 && !BG_SaberInIdle( newMove ) && !PM_SaberInParry( newMove ) && !PM_SaberInKnockaway( newMove ) && !PM_SaberInBrokenParry( newMove ) && !PM_SaberInReflect( newMove ) && !BG_SaberInSpecial(newMove))
{//readies, parries and reflections have only 1 level
anim += (pm->ps->fd.saberAnimLevel-FORCE_LEVEL_1) * SABER_ANIM_GROUP_SIZE;
}

#ifdef _GAME
else if (!pm->ps->stats[STAT_RACEMODE] && (g_tweakSaber.integer & ST_NO_REDCHAIN) &&
#else
else if ((cgs.serverMod == SVMOD_JAPRO && !cg.predictedPlayerState.stats[STAT_RACEMODE] && (cgs.jcinfo & JAPRO_CINFO_NOREDCHAIN)) &&
#endif
else if (JK2SWINGS(pm->ps) &&
pm->ps->fd.saberAnimLevel > FORCE_LEVEL_1 && !BG_SaberInIdle(newMove) && !PM_SaberInParry(newMove) && !PM_SaberInReflect(newMove) && !BG_SaberInSpecial(newMove) && !PM_SaberInTransition(newMove))
{//FIXME: only have level 1 transitions for now
anim += (pm->ps->fd.saberAnimLevel - FORCE_LEVEL_1) * SABER_ANIM_GROUP_SIZE;
Expand Down

0 comments on commit 64349df

Please sign in to comment.