From 046697c4b9369c02e730f1e16617e09876619864 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Sun, 27 Nov 2005 00:00:16 +0000 Subject: * Fixed death by poison MOD s/antitox/medkit/ * Fixed Marauders momentarily disappearing when wall jumping * Fixed a potential crash bug involving the use of generic1 * Fixed being able to build multiple coincident repeaters if there is no reactor * Fixed incorrect message when invoking "buy ammo" with an energy weapon and no reactor present * Fixed invoking "reload" during a weapon reload causing an unnecessary reload * Fixed aliens having the wrong blood colour when shot with a las gun * Fixed hovel causing invisible builders --- src/cgame/cg_weapons.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/cgame/cg_weapons.c') diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index f47f75ab..7297c518 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -787,6 +787,9 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent weaponNum = cent->currentState.weapon; weaponMode = cent->currentState.generic1; + if( weaponMode <= WPM_NONE || weaponMode >= WPM_NUM_WEAPONMODES ) + weaponMode = WPM_PRIMARY; + if( ( ( cent->currentState.eFlags & EF_FIRING ) && weaponMode == WPM_PRIMARY ) || ( ( cent->currentState.eFlags & EF_FIRING2 ) && weaponMode == WPM_SECONDARY ) || ( ( cent->currentState.eFlags & EF_FIRING3 ) && weaponMode == WPM_TERTIARY ) ) @@ -970,6 +973,9 @@ void CG_AddViewWeapon( playerState_t *ps ) weapon_t weapon = ps->weapon; weaponMode_t weaponMode = ps->generic1; + if( weaponMode <= WPM_NONE || weaponMode >= WPM_NUM_WEAPONMODES ) + weaponMode = WPM_PRIMARY; + CG_RegisterWeapon( weapon ); wi = &cg_weapons[ weapon ]; cent = &cg.predictedPlayerEntity; // &cg_entities[cg.snap->ps.clientNum]; @@ -1432,6 +1438,9 @@ void CG_FireWeapon( centity_t *cent, weaponMode_t weaponMode ) if( weaponNum == WP_NONE ) return; + if( weaponMode <= WPM_NONE || weaponMode >= WPM_NUM_WEAPONMODES ) + weaponMode = WPM_PRIMARY; + if( weaponNum >= WP_NUM_WEAPONS ) { CG_Error( "CG_FireWeapon: ent->weapon >= WP_NUM_WEAPONS" ); @@ -1483,6 +1492,9 @@ void CG_MissileHitWall( weapon_t weaponNum, weaponMode_t weaponMode, int clientN float radius = 1.0f; weaponInfo_t *weapon = &cg_weapons[ weaponNum ]; + if( weaponMode <= WPM_NONE || weaponMode >= WPM_NUM_WEAPONMODES ) + weaponMode = WPM_PRIMARY; + mark = weapon->wim[ weaponMode ].impactMark; radius = weapon->wim[ weaponMode ].impactMarkSize; ps = weapon->wim[ weaponMode ].impactParticleSystem; @@ -1557,6 +1569,9 @@ void CG_MissileHitPlayer( weapon_t weaponNum, weaponMode_t weaponMode, CG_Bleed( origin, normal, entityNum ); + if( weaponMode <= WPM_NONE || weaponMode >= WPM_NUM_WEAPONMODES ) + weaponMode = WPM_PRIMARY; + if( weapon->wim[ weaponMode ].alwaysImpact ) CG_MissileHitWall( weaponNum, weaponMode, 0, origin, dir, IMPACTSOUND_FLESH ); } -- cgit