summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author/dev/humancontroller <devhc@example.com>2017-04-13 11:30:00 +0000
committer/dev/humancontroller <devhc@example.com>2017-04-15 17:24:18 +0200
commitbfb616d6541e4e0333b7d1ed53b945d16d18fad9 (patch)
tree517f8359df41297daa30a3a0ac716f0d5ab6f4c7
parentf38f646bfc1b9b3904359b92cbd16377cd618308 (diff)
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
-rw-r--r--src/game/g_client.c5
-rw-r--r--src/game/g_cmds.c7
-rw-r--r--src/game/g_combat.c5
-rw-r--r--src/game/g_local.h1
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