From bfb616d6541e4e0333b7d1ed53b945d16d18fad9 Mon Sep 17 00:00:00 2001 From: /dev/humancontroller Date: Thu, 13 Apr 2017 11:30:00 +0000 Subject: fix noclipping players affecting other players notably, other players were able to stand on the "center" of a noclipped player set no r.contents flags for noclipping clients, keeping the saved r.contents value in the new ent->client->pers.cliprcontents field --- src/game/g_client.c | 5 ++++- src/game/g_cmds.c | 7 +++++++ src/game/g_combat.c | 5 ++++- src/game/g_local.h | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/game/g_client.c b/src/game/g_client.c index c18af19..4b37a64 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -1808,7 +1808,10 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles ent->takedamage = qtrue; ent->inuse = qtrue; ent->classname = "player"; - ent->r.contents = CONTENTS_BODY; + if( client->noclip ) + client->pers.cliprcontents = CONTENTS_BODY; + else + ent->r.contents = CONTENTS_BODY; ent->clipmask = MASK_PLAYERSOLID; ent->die = player_die; ent->waterlevel = 0; diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index ec2b7db..9ebb659 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -527,9 +527,16 @@ void Cmd_Noclip_f( gentity_t *ent ) if( !g_devmapNoGod.integer ) { if( ent->client->noclip ) + { msg = "noclip OFF\n"; + ent->r.contents = ent->client->pers.cliprcontents; + } else + { msg = "noclip ON\n"; + ent->client->pers.cliprcontents = ent->r.contents; + ent->r.contents = 0; + } ent->client->noclip = !ent->client->noclip; } diff --git a/src/game/g_combat.c b/src/game/g_combat.c index a992c17..111d2ea 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -658,7 +658,10 @@ finish_dying: // from MOD_SLAP self->takedamage = qfalse; // can still be gibbed self->s.weapon = WP_NONE; - self->r.contents = CONTENTS_CORPSE; + if( self->client->noclip ) + self->client->pers.cliprcontents = CONTENTS_CORPSE; + else + self->r.contents = CONTENTS_CORPSE; self->s.angles[ PITCH ] = 0; self->s.angles[ ROLL ] = 0; diff --git a/src/game/g_local.h b/src/game/g_local.h index 5ca1f96..c8e5806 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -383,6 +383,7 @@ typedef struct qboolean initialSpawn; // the first spawn should be at a cool location qboolean predictItemPickup; // based on cg_predictItems userinfo qboolean pmoveFixed; // + int cliprcontents; char netname[ MAX_NETNAME ]; int maxHealth; // for handicapping int enterTime; // level.time the client entered the game -- cgit