diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2015-04-12 16:35:30 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2015-04-12 16:35:30 +0200 |
commit | 7555c06c51090eea7a90254d35f5c376992605aa (patch) | |
tree | adb9fa15977fe9af2363cc963feef3707648ddbd /src/game | |
parent | 0acd120b36b4eac1d55646d09745bb39c15dd0fc (diff) |
Add a delay to Rocket Launcher shots.
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_pmove.c | 44 | ||||
-rw-r--r-- | src/game/bg_public.h | 3 | ||||
-rw-r--r-- | src/game/tremulous.h | 3 |
3 files changed, 37 insertions, 13 deletions
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index b19dd68..051f6e6 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -2892,13 +2892,18 @@ static void PM_BeginWeaponChange( int weapon ) if( pm->ps->weaponstate == WEAPON_DROPPING ) return; + // prevent storing a primed rocket launcher + if( pm->ps->weapon == WP_ROCKET_LAUNCHER && + pm->ps->stats[ STAT_MISC ] > 0 ) + return; + // cancel a reload pm->ps->pm_flags &= ~PMF_WEAPON_RELOAD; if( pm->ps->weaponstate == WEAPON_RELOADING ) pm->ps->weaponTime = 0; //special case to prevent storing a charged up lcannon - if( (pm->ps->weapon == WP_LUCIFER_CANNON || pm->ps->weapon == WP_FLAMER) ) + if( (pm->ps->weapon == WP_LUCIFER_CANNON || pm->ps->weapon == WP_FLAMER ) ) pm->ps->stats[ STAT_MISC ] = 0; pm->ps->weaponstate = WEAPON_DROPPING; @@ -3120,6 +3125,19 @@ static void PM_Weapon( void ) pm->ps->eFlags |= EF_WARN_CHARGE; } + if( pm->ps->weapon == WP_ROCKET_LAUNCHER ) + { + if( ( ( !pm->ps->weaponTime && ( pm->cmd.buttons & BUTTON_ATTACK ) ) + || pm->ps->stats[ STAT_MISC ] > 0 ) && pm->ps->ammo ) + { + if( pm->ps->stats[ STAT_MISC ] == 0 ) + PM_AddEvent( EV_ROCKETL_PRIME ); + + pm->ps->stats[ STAT_MISC ] += pml.msec; + pm->ps->eFlags |= EF_WARN_CHARGE; + } + } + // don't allow attack until all buttons are up if( pm->ps->pm_flags & PMF_RESPAWNED ) return; @@ -3412,16 +3430,7 @@ static void PM_Weapon( void ) case WP_MASS_DRIVER: - { - if(pm->ps->ammo > 6 && attack3) - { - attack3 = attack2 = qtrue; - } - else - attack2 = attack3 = qfalse; - } - //attack2 is handled on the client for zooming (cg_view.c) - + //attack2 is handled on the client for zooming (cg_view.c) if( !attack1 ) { pm->ps->weaponTime = 0; @@ -3430,6 +3439,19 @@ static void PM_Weapon( void ) } break; + case WP_ROCKET_LAUNCHER: + if( pm->ps->stats[ STAT_MISC ] > ROCKETL_DELAY ) + { + attack1 = qtrue; + pm->ps->stats[ STAT_MISC ] = 0; + } + else + { + pm->ps->weaponTime = 0; + pm->ps->weaponstate = WEAPON_READY; + return; + } + default: if( !attack1 && !attack2 && !attack3 ) { diff --git a/src/game/bg_public.h b/src/game/bg_public.h index ba7c701..d839cec 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -578,7 +578,8 @@ typedef enum EV_MGTURRET_SPINUP, // turret spinup sound should play EV_RPTUSE_SOUND, // trigger a sound EV_LEV2_ZAP, - EV_ACIDBOMB_BOUNCE + EV_ACIDBOMB_BOUNCE, + EV_ROCKETL_PRIME } entity_event_t; typedef enum diff --git a/src/game/tremulous.h b/src/game/tremulous.h index 321512b..a3ffc69 100644 --- a/src/game/tremulous.h +++ b/src/game/tremulous.h @@ -547,13 +547,14 @@ TREMULOUS EDGE MOD SRC FILE #define ROCKETL_AMMO 20 #define ROCKETL_CLIPS 0 #define ROCKETL_RELOAD 0 -#define ROCKETL_REPEAT 1000 +#define ROCKETL_REPEAT ( 1000 - ROCKETL_DELAY ) #define ROCKETL_K_SCALE 1.0f #define ROCKETL_DAMAGE HDM(88) // DPS: 88 #define ROCKETL_SPLASHDAMAGE ( ROCKETL_DAMAGE / 2 ) #define ROCKETL_RADIUS 120 #define ROCKETL_SIZE 5 #define ROCKETL_SPEED 700 +#define ROCKETL_DELAY 600 #define HBUILD_PRICE 0 #define HBUILD_REPEAT 1000 |