summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2015-04-12 16:35:30 +0200
committerPaweł Redman <pawel.redman@gmail.com>2015-04-12 16:35:30 +0200
commit7555c06c51090eea7a90254d35f5c376992605aa (patch)
treeadb9fa15977fe9af2363cc963feef3707648ddbd
parent0acd120b36b4eac1d55646d09745bb39c15dd0fc (diff)
Add a delay to Rocket Launcher shots.
-rw-r--r--assets/models/weapons/rocketl/prime.wavbin0 -> 58262 bytes
-rw-r--r--src/cgame/cg_event.c4
-rw-r--r--src/cgame/cg_local.h2
-rw-r--r--src/cgame/cg_main.c2
-rw-r--r--src/game/bg_pmove.c44
-rw-r--r--src/game/bg_public.h3
-rw-r--r--src/game/tremulous.h3
7 files changed, 45 insertions, 13 deletions
diff --git a/assets/models/weapons/rocketl/prime.wav b/assets/models/weapons/rocketl/prime.wav
new file mode 100644
index 0000000..883447a
--- /dev/null
+++ b/assets/models/weapons/rocketl/prime.wav
Binary files differ
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index 8ebb5af..1001f46 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -993,6 +993,10 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.acidBombBounceSound2 );
break;
+ case EV_ROCKETL_PRIME:
+ trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.rocketlPrimeSound );
+ break;
+
//
// missile impacts
//
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index dc40f22..b3d6e85 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -1351,6 +1351,8 @@ typedef struct
qhandle_t lightningImpactPS;
sfxHandle_t hitSounds[ 5 ];
+
+ sfxHandle_t rocketlPrimeSound;
} cgMedia_t;
typedef struct
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index f562728..7ac160e 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -765,6 +765,8 @@ static void CG_RegisterSounds( void )
for( i = 0; i < 5; i++ )
cgs.media.hitSounds[ i ] = trap_S_RegisterSound( hit_sounds[ i ], qfalse );
+
+ cgs.media.rocketlPrimeSound = trap_S_RegisterSound( "models/weapons/rocketl/prime.wav", qfalse );
}
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