Skip to content

Commit

Permalink
Add a delay to Rocket Launcher shots.
Browse files Browse the repository at this point in the history
  • Loading branch information
enneract committed Apr 12, 2015
1 parent 0acd120 commit 7555c06
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 13 deletions.
Binary file added assets/models/weapons/rocketl/prime.wav
Binary file not shown.
4 changes: 4 additions & 0 deletions src/cgame/cg_event.c
Expand Up @@ -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
//
Expand Down
2 changes: 2 additions & 0 deletions src/cgame/cg_local.h
Expand Up @@ -1351,6 +1351,8 @@ typedef struct
qhandle_t lightningImpactPS;

sfxHandle_t hitSounds[ 5 ];

sfxHandle_t rocketlPrimeSound;
} cgMedia_t;

typedef struct
Expand Down
2 changes: 2 additions & 0 deletions src/cgame/cg_main.c
Expand Up @@ -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 );
}


Expand Down
44 changes: 33 additions & 11 deletions src/game/bg_pmove.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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 )
{
Expand Down
3 changes: 2 additions & 1 deletion src/game/bg_public.h
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/game/tremulous.h
Expand Up @@ -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
Expand Down

0 comments on commit 7555c06

Please sign in to comment.