Skip to content

Commit

Permalink
game: Fix for weapons like lightning gun spreading too much when addi…
Browse files Browse the repository at this point in the history
…ng weaponTime is out of control
  • Loading branch information
LegendaryGuard committed Oct 23, 2024
1 parent 8a890e3 commit 479b1e8
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions source/game/g_active.c
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,9 @@ static void KiAttackWeaponHandling( gentity_t *ent, usercmd_t *ucmd, pmove_t *pm
break;
}

client->ps.weaponTime += addTime;
if ( client->ps.weaponTime <= 0 ) {
client->ps.weaponTime += addTime;
}
}
break;
// BFP - NOTE: The beam is triggering until pressing the attack key again after holded, using ki charge or blocking
Expand Down Expand Up @@ -1082,6 +1084,23 @@ static void KiAttackWeaponHandling( gentity_t *ent, usercmd_t *ucmd, pmove_t *pm
case WEAPON_STUN:
break;
}

// debug print about weapon states and weapon time
#if 0
switch( client->ps.weaponstate ) {
case WEAPON_FIRING: Com_Printf( "WEAPON_FIRING\n" ); break;
case WEAPON_BEAMFIRING: Com_Printf( "WEAPON_BEAMFIRING\n" ); break;
case WEAPON_CHARGING: Com_Printf( "WEAPON_CHARGING\n" ); break;
case WEAPON_DIVIDINGKIBALLFIRING: Com_Printf( "WEAPON_DIVIDINGKIBALLFIRING\n" ); break;
case WEAPON_READY: Com_Printf( "WEAPON_READY\n" ); break;
case WEAPON_EXPLODING_KIBALLFIRING: Com_Printf( "WEAPON_EXPLODING_KIBALLFIRING\n" ); break;
case WEAPON_RAISING: Com_Printf( "WEAPON_RAISING\n" ); break;
case WEAPON_KIEXPLOSIONWAVE: Com_Printf( "WEAPON_KIEXPLOSIONWAVE\n" ); break;
case WEAPON_DROPPING: Com_Printf( "WEAPON_DROPPING\n" ); break;
case WEAPON_STUN: Com_Printf( "WEAPON_STUN\n" ); break;
}
Com_Printf( "weaponTime: %d\n", client->ps.weaponTime );
#endif
}
#undef KI_CONSUME
#undef CHARGE_KI_ATTACK_STATE
Expand Down Expand Up @@ -1255,7 +1274,6 @@ void ClientThink_real( gentity_t *ent ) {
if ( client->ps.powerups[PW_FLIGHT] > 0 ) { // BFP - Flight speed
client->ps.speed *= 2;
}
// BFP - TODO: When charging a ki attack like beam wave, consult FlyingThink and SpectatorThink if that's the case

// BFP - Enable flight
FlyingThink( ent, ucmd ); // prevents client-server side issues when there's other client in-game
Expand Down

0 comments on commit 479b1e8

Please sign in to comment.