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_event.c | 3 +-- src/cgame/cg_local.h | 2 +- src/cgame/cg_players.c | 15 ++++++++++----- src/cgame/cg_trails.c | 9 ++++++--- src/cgame/cg_view.c | 6 +++--- src/cgame/cg_weapons.c | 15 +++++++++++++++ src/game/bg_misc.c | 6 ++++++ src/game/g_active.c | 2 +- src/game/g_buildable.c | 22 +++++++++++++++++++++- src/game/g_cmds.c | 31 +++++++++++++++++++------------ src/game/g_combat.c | 9 ++------- src/game/g_weapon.c | 1 - 12 files changed, 85 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c index 459d45f2..f2d64601 100644 --- a/src/cgame/cg_event.c +++ b/src/cgame/cg_event.c @@ -293,7 +293,7 @@ static void CG_Obituary( entityState_t *ent ) break; case MOD_POISON: - message = "should have used antitox against"; + message = "should have used a medkit against"; message2 = "'s poison"; break; case MOD_LEVEL1_PCLOUD: @@ -840,7 +840,6 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) DEBUGNAME( "EV_BUILD_DELAY" ); if( clientNum == cg.predictedPlayerState.clientNum ) { - //FIXME: change to "negative" sound trap_S_StartLocalSound( cgs.media.buildableRepairedSound, CHAN_LOCAL_SOUND ); cg.lastBuildAttempt = cg.time; } diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 908cd1b3..f1bc15d6 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -694,7 +694,7 @@ typedef struct qboolean infoValid; char name[ MAX_QPATH ]; - team_t team; + pTeam_t team; int botSkill; // 0 = not bot, 1-5 = bot diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index d1a361d8..fd186145 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -1351,7 +1351,9 @@ static void CG_PlayerWWSmoothing( centity_t *cent, vec3_t in[ 3 ], vec3_t out[ 3 vec3_t inAxis[ 3 ], lastAxis[ 3 ], outAxis[ 3 ]; //set surfNormal - if( !( es->eFlags & EF_WALLCLIMBCEILING ) ) + if( !(es->eFlags & EF_WALLCLIMB ) ) + VectorCopy( refNormal, surfNormal ); + else if( !( es->eFlags & EF_WALLCLIMBCEILING ) ) VectorCopy( es->angles2, surfNormal ); else VectorCopy( ceilingNormal, surfNormal ); @@ -2274,10 +2276,13 @@ void CG_Player( centity_t *cent ) // // add the gun / barrel / flash // - if( !ci->nonsegmented ) - CG_AddPlayerWeapon( &torso, NULL, cent ); - else - CG_AddPlayerWeapon( &legs, NULL, cent ); + if( es->weapon != WP_NONE ) + { + if( !ci->nonsegmented ) + CG_AddPlayerWeapon( &torso, NULL, cent ); + else + CG_AddPlayerWeapon( &legs, NULL, cent ); + } CG_PlayerUpgrades( cent, &torso ); diff --git a/src/cgame/cg_trails.c b/src/cgame/cg_trails.c index c745b2bb..3ef19f00 100644 --- a/src/cgame/cg_trails.c +++ b/src/cgame/cg_trails.c @@ -637,10 +637,13 @@ static void CG_UpdateBeam( trailBeam_t *tb ) } } - if( !CG_AttachmentPoint( &ts->frontAttachment, tb->nodes->refPosition ) ) - CG_DestroyTrailSystem( &ts ); + if( tb->nodes ) + { + if( !CG_AttachmentPoint( &ts->frontAttachment, tb->nodes->refPosition ) ) + CG_DestroyTrailSystem( &ts ); - VectorCopy( tb->nodes->refPosition, tb->nodes->position ); + VectorCopy( tb->nodes->refPosition, tb->nodes->position ); + } } CG_ApplyJitters( tb ); diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c index 89a072ab..95c0de7b 100644 --- a/src/cgame/cg_view.c +++ b/src/cgame/cg_view.c @@ -286,8 +286,8 @@ static void CG_OffsetThirdPersonView( void ) // if dead, look at killer if( cg.predictedPlayerState.stats[ STAT_HEALTH ] <= 0 ) { - focusAngles[ YAW ] = cg.predictedPlayerState.generic1; - cg.refdefViewAngles[ YAW ] = cg.predictedPlayerState.generic1; + focusAngles[ YAW ] = cg.predictedPlayerState.stats[ STAT_VIEWLOCK ]; + cg.refdefViewAngles[ YAW ] = cg.predictedPlayerState.stats[ STAT_VIEWLOCK ]; } //if ( focusAngles[PITCH] > 45 ) { @@ -430,7 +430,7 @@ static void CG_OffsetFirstPersonView( void ) { angles[ ROLL ] = 40; angles[ PITCH ] = -15; - angles[ YAW ] = cg.snap->ps.generic1; + angles[ YAW ] = cg.snap->ps.stats[ STAT_VIEWLOCK ]; origin[ 2 ] += cg.predictedPlayerState.viewheight; return; } 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 ); } diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 10bb419b..579137fe 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -4589,6 +4589,9 @@ void BG_PlayerStateToEntityState( playerState_t *ps, entityState_t *s, qboolean s->loopSound = ps->loopSound; s->generic1 = ps->generic1; + + if( s->generic1 <= WPM_NONE || s->generic1 >= WPM_NUM_WEAPONMODES ) + s->generic1 = WPM_PRIMARY; } @@ -4696,6 +4699,9 @@ void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s s->loopSound = ps->loopSound; s->generic1 = ps->generic1; + + if( s->generic1 <= WPM_NONE || s->generic1 >= WPM_NUM_WEAPONMODES ) + s->generic1 = WPM_PRIMARY; } /* diff --git a/src/game/g_active.c b/src/game/g_active.c index ca9c7db4..846397db 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -1103,7 +1103,7 @@ void ClientThink_real( gentity_t *ent ) { int lastWeapon = ent->s.weapon; - //remove anti toxin + //remove grenade BG_DeactivateUpgrade( UP_GRENADE, client->ps.stats ); BG_RemoveUpgradeFromInventory( UP_GRENADE, client->ps.stats ); diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index d83e76b7..5d014a22 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -1227,6 +1227,7 @@ void AHovel_Die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int //prevent lerping builder->client->ps.eFlags ^= EF_TELEPORT_BIT; + builder->client->ps.eFlags &= ~EF_NODRAW; G_SetOrigin( builder, newOrigin ); VectorCopy( newOrigin, builder->client->ps.origin ); @@ -2545,7 +2546,26 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance } if( i >= level.num_entities ) - reason = IBE_RPTWARN; + { + //no reactor present + + //check for other nearby repeaters + for ( i = 1, tempent = g_entities + i; i < level.num_entities; i++, tempent++ ) + { + if( tempent->s.eType != ET_BUILDABLE ) + continue; + + if( tempent->s.modelindex == BA_H_REPEATER && + Distance( tempent->s.origin, entity_origin ) < REPEATER_BASESIZE ) + { + reason = IBE_RPTWARN2; + break; + } + } + + if( reason == IBE_NONE ) + reason = IBE_RPTWARN; + } else if( G_isPower( entity_origin ) ) reason = IBE_RPTWARN2; } diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 840fc3bb..4491cd77 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1503,20 +1503,26 @@ void Cmd_Buy_f( gentity_t *ent ) //special case to keep norf happy if( weapon == WP_NONE && upgrade == UP_AMMO ) + buyingEnergyAmmo = BG_FindUsesEnergyForWeapon( ent->client->ps.weapon ); + + if( buyingEnergyAmmo ) { - //if we're buying ammo, there is a reactor/repeater in range and - //our current weapon uses energy - if( ( G_BuildableRange( ent->client->ps.origin, 100, BA_H_REACTOR ) || - G_BuildableRange( ent->client->ps.origin, 100, BA_H_REPEATER ) ) && - BG_FindUsesEnergyForWeapon( ent->client->ps.weapon ) ) - buyingEnergyAmmo = qtrue; + //no armoury nearby + if( ( !G_BuildableRange( ent->client->ps.origin, 100, BA_H_REACTOR ) && + !G_BuildableRange( ent->client->ps.origin, 100, BA_H_REPEATER ) ) ) + { + G_SendCommandFromServer( ent-g_entities, va( "print \"You must be near a reactor or repeater\n\"" ) ); + return; + } } - - //no armoury nearby - if( !G_BuildableRange( ent->client->ps.origin, 100, BA_H_ARMOURY ) && !buyingEnergyAmmo ) + else { - G_SendCommandFromServer( ent-g_entities, va( "print \"You must be near a powered armoury\n\"" ) ); - return; + //no armoury nearby + if( !G_BuildableRange( ent->client->ps.origin, 100, BA_H_ARMOURY ) ) + { + G_SendCommandFromServer( ent-g_entities, va( "print \"You must be near a powered armoury\n\"" ) ); + return; + } } if( weapon != WP_NONE ) @@ -1918,7 +1924,8 @@ Cmd_Reload_f */ void Cmd_Reload_f( gentity_t *ent ) { - ent->client->ps.pm_flags |= PMF_WEAPON_RELOAD; + if( ent->client->ps.weaponstate != WEAPON_RELOADING ) + ent->client->ps.pm_flags |= PMF_WEAPON_RELOAD; } /* diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 732e50f2..e869c046 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -51,7 +51,6 @@ LookAtKiller void LookAtKiller( gentity_t *self, gentity_t *inflictor, gentity_t *attacker ) { vec3_t dir; - vec3_t angles; if ( attacker && attacker != self ) VectorSubtract( attacker->s.pos.trBase, self->s.pos.trBase, dir ); @@ -59,15 +58,11 @@ void LookAtKiller( gentity_t *self, gentity_t *inflictor, gentity_t *attacker ) VectorSubtract( inflictor->s.pos.trBase, self->s.pos.trBase, dir ); else { - self->client->ps.generic1 = self->s.angles[ YAW ]; + self->client->ps.stats[ STAT_VIEWLOCK ] = self->s.angles[ YAW ]; return; } - self->client->ps.generic1 = vectoyaw( dir ); - - angles[ YAW ] = vectoyaw( dir ); - angles[ PITCH ] = 0; - angles[ ROLL ] = 0; + self->client->ps.stats[ STAT_VIEWLOCK ] = vectoyaw( dir ); } // these are just for logging, the client prints its own messages diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 3f523071..8f204ef5 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -494,7 +494,6 @@ void lasGunFire( gentity_t *ent ) tent->s.weapon = ent->s.weapon; tent->s.generic1 = ent->s.generic1; //weaponMode } - tent->s.otherEntityNum = ent->s.number; if( traceEnt->takedamage ) G_Damage( traceEnt, ent, ent, forward, tr.endpos, LASGUN_DAMAGE, 0, MOD_LASGUN ); -- cgit