From c76ec161e3a84a48c1bac8dfb075d323f9081c3d Mon Sep 17 00:00:00 2001 From: Richard Allen Date: Mon, 20 May 2002 16:23:44 +0000 Subject: [PATCH] Fixed spec problem when noone is alive. Fixed kicking teammates bug --- reaction/cgame/cg_servercmds.c | 5 +- reaction/game/g_teamplay.c | 11 +++- reaction/game/g_weapon.c | 115 +++++++++------------------------ 3 files changed, 42 insertions(+), 89 deletions(-) diff --git a/reaction/cgame/cg_servercmds.c b/reaction/cgame/cg_servercmds.c index d3b2358b..a5b6dd42 100644 --- a/reaction/cgame/cg_servercmds.c +++ b/reaction/cgame/cg_servercmds.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.41 2002/05/20 16:23:44 jbravo +// Fixed spec problem when noone is alive. Fixed kicking teammates bug +// // Revision 1.40 2002/05/20 04:59:33 jbravo // Lots of small fixes. // @@ -1347,7 +1350,7 @@ void CG_RQ3_Cmd () { case SETWEAPON: i = atoi(CG_Argv(1)); cg.weaponSelect = i; -// cg.snap->ps.stats[STAT_WEAPONS] & ( 1 << i); + cg.weaponSelectTime = cg.time; break; case STUFF: CG_Stuffcmd(); diff --git a/reaction/game/g_teamplay.c b/reaction/game/g_teamplay.c index 1c9231b2..35492019 100644 --- a/reaction/game/g_teamplay.c +++ b/reaction/game/g_teamplay.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.95 2002/05/20 16:23:44 jbravo +// Fixed spec problem when noone is alive. Fixed kicking teammates bug +// // Revision 1.94 2002/05/20 05:11:56 jbravo // Fixed specmodes when nobody is alive // @@ -1068,7 +1071,8 @@ void MakeSpectator(gentity_t *ent) gclient_t *client; client = ent->client; - CopyToBodyQue (ent); + if (ent->s.eType != ET_INVISIBLE) + CopyToBodyQue (ent); client->weaponCount[ent->client->ps.weapon] = 0; client->ps.stats[STAT_WEAPONS] = 0; @@ -1093,7 +1097,10 @@ void MakeSpectator(gentity_t *ent) if (OKtoFollow (ent - g_entities)) { client->sess.spectatorState = client->specMode; } else { + client->ps.pm_flags &= ~PMF_FOLLOW; + client->ps.stats[STAT_RQ3] &= ~RQ3_ZCAM; client->sess.spectatorState = SPECTATOR_FREE; + StopFollowing(ent); } } ClientSpawn(ent); @@ -1115,7 +1122,7 @@ qboolean OKtoFollow(int clientnum) if (level.clients[i].sess.sessionTeam == TEAM_SPECTATOR) { continue; } - if (g_gametype.integer == GT_TEAMPLAY && g_RQ3_limchasecam.integer != 0 && i != clientnum && + if (g_gametype.integer == GT_TEAMPLAY && g_RQ3_limchasecam.integer != 0 && level.clients[i].sess.sessionTeam != level.clients[clientnum].sess.savedTeam) { continue; } diff --git a/reaction/game/g_weapon.c b/reaction/game/g_weapon.c index d9c9c007..478d06e3 100644 --- a/reaction/game/g_weapon.c +++ b/reaction/game/g_weapon.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.58 2002/05/20 16:23:44 jbravo +// Fixed spec problem when noone is alive. Fixed kicking teammates bug +// // Revision 1.57 2002/05/18 14:52:16 makro // Bot stuff. Other stuff. Just... stuff :p // @@ -139,25 +142,20 @@ Because it is a weapon! ====================================================================== */ -qboolean JumpKick( gentity_t *ent ) -{ +qboolean JumpKick (gentity_t *ent) { trace_t tr; vec3_t end; - gentity_t *tent; - gentity_t *traceEnt; - int damage; + gentity_t *tent, *traceEnt; + int damage; //Elder: for kick sound qboolean kickSuccess; - if ( g_gametype.integer == GT_TEAMPLAY && level.lights_camera_action ) { + if (g_gametype.integer == GT_TEAMPLAY && level.lights_camera_action) { return qfalse; // JBravo: No kicking during LCA } //Makro - added - if ( ent == NULL ) { - return qfalse; - } - if ( ent->client == NULL ) { + if (ent == NULL || ent->client == NULL) { return qfalse; } @@ -167,51 +165,32 @@ qboolean JumpKick( gentity_t *ent ) // Elder: AQ2 offset muzzle[2] -= (ent->client->ps.viewheight - 20); VectorMA (muzzle, 25, forward, end); - //VectorMA (muzzle, 32, forward, end); - //VectorCopy( ent->s.origin, muzzle ); - //muzzle[2] += 32; // the muzzle really isn't the right point to test the jumpkick from trap_Trace (&tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT); - //trap_Trace (&tr, ent->s.origin, NULL, NULL, end, ent->s.number, MASK_SHOT); - if ( tr.surfaceFlags & SURF_NOIMPACT ) { + if (tr.surfaceFlags & SURF_NOIMPACT) { return qfalse; } - kickSuccess = DoorKick( &tr, ent, muzzle, forward ); - traceEnt = &g_entities[ tr.entityNum ]; + kickSuccess = DoorKick (&tr, ent, muzzle, forward); + traceEnt = &g_entities[tr.entityNum]; // JBravo: some sanity checks on the traceEnt // Makro - this check made the sound only play when a client is hit -// if (traceEnt == NULL || traceEnt->client == NULL) if (traceEnt == NULL) return qfalse; - if ( !traceEnt->takedamage) { + if (!traceEnt->takedamage) return qfalse; - } //Makro - this was a few lines below damage = 20; - if ( traceEnt->s.eType == ET_BREAKABLE || traceEnt->client) + if (traceEnt->s.eType == ET_BREAKABLE || traceEnt->client) kickSuccess = qtrue; - //Elder: can't hit if crouching but can still hit "dead" bodies :) - if (traceEnt->client && traceEnt->health > 0 && traceEnt->r.maxs[2] < 20) - { - return qfalse; - } - else { - G_Damage( traceEnt, ent, ent, forward, tr.endpos, - damage, DAMAGE_NO_LOCATIONAL, MOD_KICK ); - if (ent->client && level.team_round_going) - ent->client->pers.records[REC_KICKHITS]++; - } - //end Makro - // JBravo: no kicking teammates while rounds are going if (g_gametype.integer == GT_TEAMPLAY) { //Makro - client check here @@ -222,6 +201,15 @@ qboolean JumpKick( gentity_t *ent ) } } } + //Elder: can't hit if crouching but can still hit "dead" bodies :) + if (traceEnt->client && traceEnt->health > 0 && traceEnt->r.maxs[2] < 20) { + return qfalse; + } else { + G_Damage (traceEnt, ent, ent, forward, tr.endpos, damage, DAMAGE_NO_LOCATIONAL, MOD_KICK); + if (ent->client && level.team_round_going) + ent->client->pers.records[REC_KICKHITS]++; + } + //end Makro //Makro - client check if (ent->client) { @@ -235,31 +223,17 @@ qboolean JumpKick( gentity_t *ent ) //Makro - moved some code up by a few lines to allow breakables to be kicked - // send blood impact + event stuff - /* - if ( traceEnt->takedamage && traceEnt->client ) { - //tent = G_TempEntity( tr.endpos, EV_MISSILE_HIT ); - tent = G_TempEntity( tr.endpos, EV_JUMPKICK ); - tent->s.otherEntityNum = traceEnt->s.number; - tent->s.eventParm = DirToByte( tr.plane.normal ); - tent->s.weapon = ent->s.weapon; - } - */ - - if (traceEnt->client != NULL && traceEnt->takedamage) - { - tent = G_TempEntity( tr.endpos, EV_JUMPKICK ); + if (traceEnt->client != NULL && traceEnt->takedamage) { + tent = G_TempEntity (tr.endpos, EV_JUMPKICK); tent->s.otherEntityNum = traceEnt->s.number; tent->s.otherEntityNum2 = ent->s.number; - tent->s.eventParm = DirToByte( tr.plane.normal ); + tent->s.eventParm = DirToByte (tr.plane.normal); tent->s.weapon = 0; - - if (traceEnt->client->uniqueWeapons > 0) - { + if (traceEnt->client->uniqueWeapons > 0) { //Elder: toss a unique weapon if kicked //Need to make sure to cancel any reload attempts - test this - Cmd_Unzoom(traceEnt); + Cmd_Unzoom (traceEnt); traceEnt->client->fastReloads = 0; traceEnt->client->reloadAttempts = 0; traceEnt->client->ps.weaponTime = 0; @@ -272,40 +246,9 @@ qboolean JumpKick( gentity_t *ent ) kickSuccess = qfalse; } - - - //Elder: for the kick - // do our special form of knockback here - /* - VectorMA (self->enemy->absmin, 0.5, self->enemy->size, v); - VectorSubtract (v, point, v); - VectorNormalize (v); - VectorMA (self->enemy->velocity, kick, v, self->enemy->velocity); - if (self->enemy->velocity[2] > 0) - self->enemy->groundentity = NULL; - */ - //Elder: kick knockback for AQ2 -- recall variable kick = 400 - //if (traceEnt->client) - //{ - //Elder: for kick knockback - //vec3_t size, vTemp; - - //Make the "size" vector - hopefully this is right - //VectorSubtract(traceEnt->r.maxs, traceEnt->r.mins, size); - //G_Printf("Size: %s\n", vtos(size)); - - //VectorMA(traceEnt->r.absmin, 0.5, size, vTemp); - //VectorSubtract(vTemp, tr.endpos, vTemp); - //VectorNormalize(vTemp); - //VectorMA(traceEnt->client->ps.velocity, 400, vTemp, traceEnt->client->ps.velocity); - //if (traceEnt->client->ps.velocity[2] > 0) - //traceEnt->s.groundEntityNum = ENTITYNUM_NONE; - //} - //Elder: Our set of locally called sounds - if (kickSuccess) - { - G_AddEvent ( ent, EV_RQ3_SOUND, RQ3_SOUND_KICK); + if (kickSuccess) { + G_AddEvent (ent, EV_RQ3_SOUND, RQ3_SOUND_KICK); } return qtrue;