From 5a83bbfe97e2586f73afbc818684f56c847f9990 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Fri, 29 Aug 2003 17:48:38 +0000 Subject: * Buildables now use ANIM_TOGGLEBIT properly * Remaining MOD_s added * Added WP_MGTURRET to split to mgturret from the rifle * Buildable weapons now use weapon lights and flash sounds etc * Fixed turret oscillation bug --- src/cgame/cg_buildable.c | 17 ++++++++++++++--- src/cgame/cg_event.c | 8 +++++++- src/cgame/cg_weapons.c | 20 ++++++++++++++++++-- 3 files changed, 39 insertions(+), 6 deletions(-) (limited to 'src/cgame') diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c index fd362f9d..4c1db197 100644 --- a/src/cgame/cg_buildable.c +++ b/src/cgame/cg_buildable.c @@ -340,7 +340,7 @@ static void CG_SetBuildableLerpFrameAnimation( buildable_t buildable, lerpFrame_ animation_t *anim; lf->animationNumber = newAnimation; - newAnimation &= ~ANIM_TOGGLEBIT; + newAnimation &= ~( ANIM_TOGGLEBIT|ANIM_FORCEBIT ); if( newAnimation < 0 || newAnimation >= MAX_BUILDABLE_ANIMATIONS ) CG_Error( "Bad animation number: %i", newAnimation ); @@ -478,9 +478,9 @@ static void CG_BuildableAnimation( centity_t *cent, int *old, int *now, float *b if( cent->buildableAnim == BANIM_NONE ) cent->buildableAnim = es->torsoAnim; - if( cent->oldBuildableAnim != es->legsAnim ) + if( ( cent->oldBuildableAnim ^ es->legsAnim ) & ANIM_TOGGLEBIT ) { - if( cent->buildableAnim == es->torsoAnim || es->legsAnim & ANIM_TOGGLEBIT ) + if( cent->buildableAnim == es->torsoAnim || es->legsAnim & ANIM_FORCEBIT ) cent->buildableAnim = cent->oldBuildableAnim = es->legsAnim; } @@ -933,6 +933,17 @@ void CG_Buildable( centity_t *cent ) break; } + if( cg.time - cent->muzzleFlashTime > MUZZLE_FLASH_TIME && es->eFlags & EF_FIRING ) + { + weaponInfo_t *weapon = &cg_weapons[ es->weapon ]; + + if( weapon->flashDlightColor[ 0 ] || weapon->flashDlightColor[ 1 ] || weapon->flashDlightColor[ 2 ] ) + { + trap_R_AddLightToScene( cent->lerpOrigin, 300 + ( rand( ) & 31 ), weapon->flashDlightColor[ 0 ], + weapon->flashDlightColor[ 1 ], weapon->flashDlightColor[ 2 ] ); + } + } + //smoke etc for damaged buildables CG_BuildableParticleEffects( cent ); } diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index fe3ebd24..087dafc1 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -96,7 +96,7 @@ static void CG_Obituary( entityState_t *ent ) case MOD_ASPAWN: message = "was melted by the acid blood"; break; - case MOD_MACHINEGUN: + case MOD_MGTURRET: message = "was gunned down by a turret"; break; case MOD_TESLAGEN: @@ -199,6 +199,12 @@ static void CG_Obituary( entityState_t *ent ) case MOD_PRIFLE: message = "was pulse rifled by"; break; + case MOD_MDRIVER: + message = "was mass driven by"; + break; + case MOD_LASGUN: + message = "was lasgunned by"; + break; case MOD_FLAMER: message = "was grilled by"; message2 = "'s flamer"; diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index aeab2db3..343e359d 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -486,6 +486,7 @@ void CG_RegisterWeapon( int weaponNum ) switch( weaponNum ) { case WP_MACHINEGUN: + case WP_MGTURRET: case WP_CHAINGUN: weaponInfo->ejectBrassFunc = CG_MachineGunEjectBrass; break; @@ -1518,7 +1519,20 @@ void CG_FireWeapon( centity_t *cent, int mode ) // do brass ejection if( weap->ejectBrassFunc && cg_brassTime.integer > 0 ) - weap->ejectBrassFunc( cent ); + { + if( ent->eType == ET_BUILDABLE ) + { + //yucko hack to get turret brass ejecting with the barrel instead of the base + vec3_t temp; + + VectorCopy( cent->lerpAngles, temp ); + VectorCopy( ent->angles2, cent->lerpAngles ); + weap->ejectBrassFunc( cent ); + VectorCopy( temp, cent->lerpAngles ); + } + else + weap->ejectBrassFunc( cent ); + } } @@ -1529,7 +1543,8 @@ CG_MissileHitWall Caused by an EV_MISSILE_MISS event, or directly by local bullet tracing ================= */ -void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, impactSound_t soundType, int damage ) { +void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, impactSound_t soundType, int damage ) +{ qhandle_t mod; qhandle_t mark; qhandle_t shader; @@ -1606,6 +1621,7 @@ void CG_MissileHitWall( int weapon, int clientNum, vec3_t origin, vec3_t dir, im break; case WP_MACHINEGUN: + case WP_MGTURRET: case WP_CHAINGUN: case WP_LAS_GUN: mod = cgs.media.bulletFlashModel; -- cgit