Skip to content

Commit

Permalink
Set rdflags and blend for freefloat MVD observers.
Browse files Browse the repository at this point in the history
  • Loading branch information
skullernet authored and res2k committed Jan 25, 2024
1 parent 523d846 commit 4b300e8
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/server/mvd/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,12 +653,35 @@ static void MVD_UpdateClient(mvd_client_t *client)
int i;

if (!target) {
int contents = 0;

// copy stats of the dummy MVD observer
if (mvd->dummy) {
for (i = 0; i < MAX_STATS; i++) {
client->ps.stats[i] = mvd->dummy->ps.stats[i];
}
}

// get contents from world
if (mvd->cm.cache) {
vec3_t vieworg;
VectorMA(client->ps.viewoffset, 0.125f, client->ps.pmove.origin, vieworg);
contents = CM_PointContents(vieworg, mvd->cm.cache->nodes);
}

if (contents & (CONTENTS_LAVA | CONTENTS_SLIME | CONTENTS_WATER))
client->ps.rdflags = RDF_UNDERWATER;
else
client->ps.rdflags = 0;

if (contents & (CONTENTS_SOLID | CONTENTS_LAVA))
Vector4Set(client->ps.blend, 1.0f, 0.3f, 0.0f, 0.6f);
else if (contents & CONTENTS_SLIME)
Vector4Set(client->ps.blend, 0.0f, 0.1f, 0.05f, 0.6f);
else if (contents & CONTENTS_WATER)
Vector4Set(client->ps.blend, 0.5f, 0.3f, 0.2f, 0.4f);
else
Vector4Clear(client->ps.blend);
} else {
// copy entire player state
client->ps = target->ps;
Expand Down

0 comments on commit 4b300e8

Please sign in to comment.