From b6fd1bffca359783d14cd2000d39cd422ce64eb3 Mon Sep 17 00:00:00 2001 From: Michael Levin Date: Sat, 3 Oct 2009 11:19:54 +0000 Subject: Another bugfix, Lucifer Cannon won't start charging again after an overcharge. --- src/game/bg_pmove.c | 17 ++++++++++++++++- src/game/bg_public.h | 3 ++- src/game/g_active.c | 5 ++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index 78d22689..45cf89e0 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -2971,6 +2971,14 @@ static void PM_Weapon( void ) attack1 = pm->cmd.buttons & BUTTON_ATTACK; attack2 = pm->cmd.buttons & BUTTON_ATTACK2; attack3 = qfalse; + + // Prevent firing of the Lucifer Cannon after an overcharge + if( pm->ps->weaponstate == WEAPON_NEEDS_RESET ) + { + if( attack1 ) + return; + pm->ps->weaponstate = WEAPON_READY; + } if( attack1 || pm->ps->stats[ STAT_MISC ] > 0 ) attack2 = qfalse; @@ -2985,6 +2993,12 @@ static void PM_Weapon( void ) pm->ps->weaponstate = WEAPON_READY; return; } + else + { + // Overcharge + pm->ps->weaponTime = 0; + pm->ps->weaponstate = WEAPON_NEEDS_RESET; + } } if( pm->ps->stats[ STAT_MISC ] > LCANNON_MIN_CHARGE ) @@ -3157,7 +3171,8 @@ static void PM_Weapon( void ) pm->ps->torsoTimer = TIMER_ATTACK; } - pm->ps->weaponstate = WEAPON_FIRING; + if( pm->ps->weaponstate != WEAPON_NEEDS_RESET ) + pm->ps->weaponstate = WEAPON_FIRING; // take an ammo away if not infinite if( !BG_FindInfinteAmmoForWeapon( pm->ps->weapon ) ) diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 858b0740..572430fc 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -124,7 +124,8 @@ typedef enum WEAPON_RAISING, WEAPON_DROPPING, WEAPON_FIRING, - WEAPON_RELOADING + WEAPON_RELOADING, + WEAPON_NEEDS_RESET, } weaponstate_t; // pmove->pm_flags diff --git a/src/game/g_active.c b/src/game/g_active.c index 94a8e8c9..4e7134e2 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -666,8 +666,11 @@ void ClientTimerActions( gentity_t *ent, int msec ) //client is charging up an lcannon if( client->ps.weapon == WP_LUCIFER_CANNON && ( ucmd->buttons & BUTTON_ATTACK ) && - client->ps.stats[ STAT_MISC2 ] <= 0 ) + client->ps.stats[ STAT_MISC2 ] <= 0 && + client->ps.weaponstate != WEAPON_NEEDS_RESET ) { + int ammo; + if( client->ps.stats[ STAT_MISC ] <= 0 ) client->lcannonStartTime = level.time; -- cgit