X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=cl_main.c;h=e77ea64aef7e77f3b105a9274ec6bc0776996bf1;hb=c3de890275f4840c3f4edf9a5ab047b7dd9b2a37;hp=6dd9cdc44a52574228360eb23d3f14489b9c244b;hpb=8b04cb6b66ce0cad559895cd9f7e743194752d88;p=xonotic%2Fdarkplaces.git diff --git a/cl_main.c b/cl_main.c index 6dd9cdc4..e77ea64a 100644 --- a/cl_main.c +++ b/cl_main.c @@ -49,6 +49,9 @@ cvar_t m_side = {CVAR_SAVE, "m_side","0.8","mouse side speed multiplier"}; cvar_t freelook = {CVAR_SAVE, "freelook", "1","mouse controls pitch instead of forward/back"}; +cvar_t cl_autodemo = {0, "cl_autodemo", "0", "records every game played, using the date/time and map name to name the demo file" }; +cvar_t cl_autodemo_nameformat = {0, "cl_autodemo_nameformat", "%Y-%m-%d_%H-%M", "The format of the cl_autodemo filename, followed by the map name" }; + cvar_t r_draweffects = {0, "r_draweffects", "1","renders temporary sprite effects"}; cvar_t cl_explosions_alpha_start = {CVAR_SAVE, "cl_explosions_alpha_start", "1.5","starting alpha of an explosion shell"}; @@ -61,8 +64,9 @@ cvar_t cl_stainmaps = {CVAR_SAVE, "cl_stainmaps", "1","stains lightmaps, much fa cvar_t cl_stainmaps_clearonload = {CVAR_SAVE, "cl_stainmaps_clearonload", "1","clear stainmaps on map restart"}; cvar_t cl_beams_polygons = {CVAR_SAVE, "cl_beams_polygons", "1","use beam polygons instead of models"}; -cvar_t cl_beams_relative = {CVAR_SAVE, "cl_beams_relative", "1","beams are relative to owner (smooth sweeps)"}; -cvar_t cl_beams_lightatend = {CVAR_SAVE, "cl_beams_lightatend", "0","make a light at the end of the beam"}; +cvar_t cl_beams_quakepositionhack = {CVAR_SAVE, "cl_beams_quakepositionhack", "1", "makes your lightning gun appear to fire from your waist (as in Quake and QuakeWorld)"}; +cvar_t cl_beams_instantaimhack = {CVAR_SAVE, "cl_beams_instantaimhack", "1", "makes your lightning gun aiming update instantly"}; +cvar_t cl_beams_lightatend = {CVAR_SAVE, "cl_beams_lightatend", "0", "make a light at the end of the beam"}; cvar_t cl_noplayershadow = {CVAR_SAVE, "cl_noplayershadow", "0","hide player shadow"}; @@ -198,6 +202,53 @@ void CL_ClearState(void) CL_Screen_NewMap(); } +void CL_SetInfo(const char *key, const char *value, qboolean send, qboolean allowstarkey, qboolean allowmodel, qboolean quiet) +{ + if (strchr(key, '\"') || strchr(value, '\"') || (!allowstarkey && key[0] == '*') || (!allowmodel && (!strcasecmp(Cmd_Argv(1), "pmodel") || !strcasecmp(Cmd_Argv(1), "emodel")))) + { + if (!quiet) + Con_Printf("Can't setinfo \"%s\" \"%s\"\n"); + return; + } + InfoString_SetValue(cls.userinfo, sizeof(cls.userinfo), key, value); + if (cls.state == ca_connected && cls.netcon) + { + if (cls.protocol == PROTOCOL_QUAKEWORLD) + { + MSG_WriteByte(&cls.netcon->message, qw_clc_stringcmd); + MSG_WriteString(&cls.netcon->message, va("setinfo \"%s\" \"%s\"", key, value)); + } + else if (!strcasecmp(key, "name")) + { + MSG_WriteByte(&cls.netcon->message, clc_stringcmd); + MSG_WriteString(&cls.netcon->message, va("name \"%s\"", value)); + } + else if (!strcasecmp(key, "playermodel")) + { + MSG_WriteByte(&cls.netcon->message, clc_stringcmd); + MSG_WriteString(&cls.netcon->message, va("playermodel \"%s\"", value)); + } + else if (!strcasecmp(key, "playerskin")) + { + MSG_WriteByte(&cls.netcon->message, clc_stringcmd); + MSG_WriteString(&cls.netcon->message, va("playerskin \"%s\"", value)); + } + else if (!strcasecmp(key, "topcolor")) + { + // don't send anything, the combined color code will be updated manually + } + else if (!strcasecmp(key, "bottomcolor")) + { + // don't send anything, the combined color code will be updated manually + } + else if (!strcasecmp(key, "rate")) + { + MSG_WriteByte(&cls.netcon->message, clc_stringcmd); + MSG_WriteString(&cls.netcon->message, va("rate \"%s\"", value)); + } + } +} + void CL_ExpandEntities(int num) { int i, oldmaxentities; @@ -236,7 +287,7 @@ void CL_ExpandCSQCEntities(int num) oldmaxentities = cl.max_csqcentities; oldentities = cl.csqcentities; cl.max_csqcentities = (num & ~255) + 256; - cl.csqcentities = Mem_Alloc(cls.levelmempool, cl.max_csqcentities * sizeof(entity_t)); + cl.csqcentities = (entity_t *)Mem_Alloc(cls.levelmempool, cl.max_csqcentities * sizeof(entity_t)); memcpy(cl.csqcentities, oldentities, oldmaxentities * sizeof(entity_t)); Mem_Free(oldentities); for (i = oldmaxentities;i < cl.max_csqcentities;i++) @@ -402,44 +453,45 @@ static void CL_PrintEntities_f(void) //static const vec3_t nomodelmaxs = {16, 16, 16}; void CL_BoundingBoxForEntity(entity_render_t *ent) { - if (ent->model) + model_t *model = ent->model; + if (model) { //if (ent->angles[0] || ent->angles[2]) if (ent->matrix.m[2][0] != 0 || ent->matrix.m[2][1] != 0) { // pitch or roll - ent->mins[0] = ent->matrix.m[0][3] + ent->model->rotatedmins[0]; - ent->mins[1] = ent->matrix.m[1][3] + ent->model->rotatedmins[1]; - ent->mins[2] = ent->matrix.m[2][3] + ent->model->rotatedmins[2]; - ent->maxs[0] = ent->matrix.m[0][3] + ent->model->rotatedmaxs[0]; - ent->maxs[1] = ent->matrix.m[1][3] + ent->model->rotatedmaxs[1]; - ent->maxs[2] = ent->matrix.m[2][3] + ent->model->rotatedmaxs[2]; - //VectorAdd(ent->origin, ent->model->rotatedmins, ent->mins); - //VectorAdd(ent->origin, ent->model->rotatedmaxs, ent->maxs); + ent->mins[0] = ent->matrix.m[0][3] + model->rotatedmins[0]; + ent->mins[1] = ent->matrix.m[1][3] + model->rotatedmins[1]; + ent->mins[2] = ent->matrix.m[2][3] + model->rotatedmins[2]; + ent->maxs[0] = ent->matrix.m[0][3] + model->rotatedmaxs[0]; + ent->maxs[1] = ent->matrix.m[1][3] + model->rotatedmaxs[1]; + ent->maxs[2] = ent->matrix.m[2][3] + model->rotatedmaxs[2]; + //VectorAdd(ent->origin, model->rotatedmins, ent->mins); + //VectorAdd(ent->origin, model->rotatedmaxs, ent->maxs); } //else if (ent->angles[1]) else if (ent->matrix.m[0][1] != 0 || ent->matrix.m[1][0] != 0) { // yaw - ent->mins[0] = ent->matrix.m[0][3] + ent->model->yawmins[0]; - ent->mins[1] = ent->matrix.m[1][3] + ent->model->yawmins[1]; - ent->mins[2] = ent->matrix.m[2][3] + ent->model->yawmins[2]; - ent->maxs[0] = ent->matrix.m[0][3] + ent->model->yawmaxs[0]; - ent->maxs[1] = ent->matrix.m[1][3] + ent->model->yawmaxs[1]; - ent->maxs[2] = ent->matrix.m[2][3] + ent->model->yawmaxs[2]; - //VectorAdd(ent->origin, ent->model->yawmins, ent->mins); - //VectorAdd(ent->origin, ent->model->yawmaxs, ent->maxs); + ent->mins[0] = ent->matrix.m[0][3] + model->yawmins[0]; + ent->mins[1] = ent->matrix.m[1][3] + model->yawmins[1]; + ent->mins[2] = ent->matrix.m[2][3] + model->yawmins[2]; + ent->maxs[0] = ent->matrix.m[0][3] + model->yawmaxs[0]; + ent->maxs[1] = ent->matrix.m[1][3] + model->yawmaxs[1]; + ent->maxs[2] = ent->matrix.m[2][3] + model->yawmaxs[2]; + //VectorAdd(ent->origin, model->yawmins, ent->mins); + //VectorAdd(ent->origin, model->yawmaxs, ent->maxs); } else { - ent->mins[0] = ent->matrix.m[0][3] + ent->model->normalmins[0]; - ent->mins[1] = ent->matrix.m[1][3] + ent->model->normalmins[1]; - ent->mins[2] = ent->matrix.m[2][3] + ent->model->normalmins[2]; - ent->maxs[0] = ent->matrix.m[0][3] + ent->model->normalmaxs[0]; - ent->maxs[1] = ent->matrix.m[1][3] + ent->model->normalmaxs[1]; - ent->maxs[2] = ent->matrix.m[2][3] + ent->model->normalmaxs[2]; - //VectorAdd(ent->origin, ent->model->normalmins, ent->mins); - //VectorAdd(ent->origin, ent->model->normalmaxs, ent->maxs); + ent->mins[0] = ent->matrix.m[0][3] + model->normalmins[0]; + ent->mins[1] = ent->matrix.m[1][3] + model->normalmins[1]; + ent->mins[2] = ent->matrix.m[2][3] + model->normalmins[2]; + ent->maxs[0] = ent->matrix.m[0][3] + model->normalmaxs[0]; + ent->maxs[1] = ent->matrix.m[1][3] + model->normalmaxs[1]; + ent->maxs[2] = ent->matrix.m[2][3] + model->normalmaxs[2]; + //VectorAdd(ent->origin, model->normalmins, ent->mins); + //VectorAdd(ent->origin, model->normalmaxs, ent->maxs); } } else @@ -660,7 +712,7 @@ void CL_UpdateLights(void) l = (i-1) % cl.lightstyle[j].length; k = cl.lightstyle[j].map[k] - 'a'; l = cl.lightstyle[j].map[l] - 'a'; - r_refdef.lightstylevalue[j] = ((k*frac)+(l*(1-frac)))*22; + r_refdef.lightstylevalue[j] = (unsigned short)(((k*frac)+(l*(1-frac)))*22); } } @@ -739,8 +791,9 @@ void CL_LinkNetworkEntity(entity_t *e) { matrix4x4_t *matrix, blendmatrix, tempmatrix, matrix2; //matrix4x4_t dlightmatrix; - int j, k, l, trailtype, temp; - float origin[3], angles[3], delta[3], lerp, dlightcolor[3], dlightradius, mins[3], maxs[3], v2[3], d; + int j, k, l; + effectnameindex_t trailtype; + float origin[3], angles[3], delta[3], lerp, dlightcolor[3], dlightradius, v2[3], d; entity_t *t; model_t *model; trace_t trace; @@ -798,7 +851,7 @@ void CL_LinkNetworkEntity(entity_t *e) e->render.skinnum = e->state_current.skin; if (e->render.flags & RENDER_VIEWMODEL && !e->state_current.tagentity) { - if (!r_drawviewmodel.integer || chase_active.integer || envmap)// || csqc_loaded) + if (!r_drawviewmodel.integer || chase_active.integer || r_refdef.envmap)// || csqc_loaded) return; if (!e->csqc) { @@ -860,9 +913,9 @@ void CL_LinkNetworkEntity(entity_t *e) // movement lerp // if it's the player entity, update according to client movement - if (e == cl.entities + cl.playerentity && cl.movement)// && !e->csqc) + if (e == cl.entities + cl.playerentity && cl.movement_predicted)// && !e->csqc) { - lerp = (cl.time - cl.mtime[1]) / (cl.mtime[0] - cl.mtime[1]); + lerp = (cl.time - cl.movement_time[1]) / (cl.movement_time[0] - cl.movement_time[1]); lerp = bound(0, lerp, 1); VectorLerp(cl.movement_oldorigin, lerp, cl.movement_origin, origin); VectorSet(angles, 0, cl.viewangles[1], 0); @@ -957,7 +1010,7 @@ void CL_LinkNetworkEntity(entity_t *e) origin[1] = e->render.matrix.m[1][3]; origin[2] = e->render.matrix.m[2][3]; } - trailtype = -1; + trailtype = EFFECT_NONE; dlightradius = 0; dlightcolor[0] = 0; dlightcolor[1] = 0; @@ -968,13 +1021,7 @@ void CL_LinkNetworkEntity(entity_t *e) if (e->render.effects & EF_BRIGHTFIELD) { if (gamemode == GAME_NEXUIZ) - { - dlightradius = max(dlightradius, 200); - dlightcolor[0] += 0.75f; - dlightcolor[1] += 1.50f; - dlightcolor[2] += 3.00f; - trailtype = 8; - } + trailtype = EFFECT_TR_NEXUIZPLASMA; else CL_EntityParticles(e); } @@ -1010,38 +1057,9 @@ void CL_LinkNetworkEntity(entity_t *e) dlightcolor[2] += 1.50f; } if (e->render.effects & EF_FLAME) - { - mins[0] = origin[0] - 16.0f; - mins[1] = origin[1] - 16.0f; - mins[2] = origin[2] - 16.0f; - maxs[0] = origin[0] + 16.0f; - maxs[1] = origin[1] + 16.0f; - maxs[2] = origin[2] + 16.0f; - // how many flames to make - temp = (int) (cl.time * 300) - (int) (cl.oldtime * 300); - CL_FlameCube(mins, maxs, temp); - d = lhrandom(0.75f, 1); - dlightradius = max(dlightradius, 200); - dlightcolor[0] += d * 2.0f; - dlightcolor[1] += d * 1.5f; - dlightcolor[2] += d * 0.5f; - } + CL_ParticleEffect(EFFECT_EF_FLAME, cl.time - cl.oldtime, origin, origin, vec3_origin, vec3_origin, NULL, 0); if (e->render.effects & EF_STARDUST) - { - mins[0] = origin[0] - 16.0f; - mins[1] = origin[1] - 16.0f; - mins[2] = origin[2] - 16.0f; - maxs[0] = origin[0] + 16.0f; - maxs[1] = origin[1] + 16.0f; - maxs[2] = origin[2] + 16.0f; - // how many particles to make - temp = (int) (cl.time * 200) - (int) (cl.oldtime * 200); - CL_Stardust(mins, maxs, temp); - dlightradius = max(dlightradius, 200); - dlightcolor[0] += 1.0f; - dlightcolor[1] += 0.7f; - dlightcolor[2] += 0.3f; - } + CL_ParticleEffect(EFFECT_EF_STARDUST, cl.time - cl.oldtime, origin, origin, vec3_origin, vec3_origin, NULL, 0); if (e->render.effects & (EF_FLAG1QW | EF_FLAG2QW)) { // these are only set on player entities @@ -1058,62 +1076,28 @@ void CL_LinkNetworkEntity(entity_t *e) tempmatrix.m[1][3] = trace.endpos[1]; tempmatrix.m[2][3] = trace.endpos[2]; CL_AllocDlight(NULL, &tempmatrix, 100, e->persistent.muzzleflash, e->persistent.muzzleflash, e->persistent.muzzleflash, 0, 0, 0, -1, true, 0, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE); - e->persistent.muzzleflash -= cl.frametime * 10; + e->persistent.muzzleflash -= (cl.time - cl.oldtime) * 10; } // LordHavoc: if the model has no flags, don't check each if (e->render.model && e->render.model->flags && (!e->state_current.tagentity && !(e->render.flags & RENDER_VIEWMODEL))) { if (e->render.model->flags & EF_GIB) - trailtype = 2; + trailtype = EFFECT_TR_BLOOD; else if (e->render.model->flags & EF_ZOMGIB) - trailtype = 4; + trailtype = EFFECT_TR_SLIGHTBLOOD; else if (e->render.model->flags & EF_TRACER) - { - trailtype = 3; - //dlightradius = max(dlightradius, 100); - //dlightcolor[0] += 0.25f; - //dlightcolor[1] += 1.00f; - //dlightcolor[2] += 0.25f; - } + trailtype = EFFECT_TR_WIZSPIKE; else if (e->render.model->flags & EF_TRACER2) - { - trailtype = 5; - //dlightradius = max(dlightradius, 100); - //dlightcolor[0] += 1.00f; - //dlightcolor[1] += 0.60f; - //dlightcolor[2] += 0.20f; - } + trailtype = EFFECT_TR_KNIGHTSPIKE; else if (e->render.model->flags & EF_ROCKET) - { - trailtype = 0; - dlightradius = max(dlightradius, 200); - dlightcolor[0] += 3.00f; - dlightcolor[1] += 1.50f; - dlightcolor[2] += 0.50f; - } + trailtype = EFFECT_TR_ROCKET; else if (e->render.model->flags & EF_GRENADE) { // LordHavoc: e->render.alpha == -1 is for Nehahra dem compatibility (cigar smoke) - trailtype = e->render.alpha == -1 ? 7 : 1; + trailtype = e->render.alpha == -1 ? EFFECT_TR_NEHAHRASMOKE : EFFECT_TR_GRENADE; } else if (e->render.model->flags & EF_TRACER3) - { - trailtype = 6; - if (gamemode == GAME_PRYDON) - { - dlightradius = max(dlightradius, 100); - dlightcolor[0] += 0.30f; - dlightcolor[1] += 0.60f; - dlightcolor[2] += 1.20f; - } - else - { - dlightradius = max(dlightradius, 200); - dlightcolor[0] += 1.20f; - dlightcolor[1] += 0.50f; - dlightcolor[2] += 1.00f; - } - } + trailtype = EFFECT_TR_VORESPIKE; } // LordHavoc: customizable glow if (e->state_current.glowsize) @@ -1147,9 +1131,18 @@ void CL_LinkNetworkEntity(entity_t *e) } // do trails if (e->render.flags & RENDER_GLOWTRAIL) - trailtype = 9; - if (trailtype >= 0) - CL_RocketTrail(e->persistent.trail_origin, origin, trailtype, e->state_current.glowcolor, e); + trailtype = EFFECT_TR_GLOWTRAIL; + if (trailtype) + { + float len; + vec3_t vel; + VectorSubtract(e->state_current.origin, e->state_previous.origin, vel); + len = e->state_current.time - e->state_previous.time; + if (len > 0) + len = 1.0f / len; + VectorScale(vel, len, vel); + CL_ParticleEffect(trailtype, 1, e->persistent.trail_origin, origin, vel, vel, e, e->state_current.glowcolor); + } VectorCopy(origin, e->persistent.trail_origin); // tenebrae's sprites are all additive mode (weird) if (gamemode == GAME_TENEBRAE && e->render.model && e->render.model->type == mod_sprite) @@ -1341,7 +1334,7 @@ static void CL_RelinkEffects(void) if (e->active) { frame = (cl.time - e->starttime) * e->framerate + e->startframe; - intframe = frame; + intframe = (int)frame; if (intframe < 0 || intframe >= e->endframe) { memset(e, 0, sizeof(*e)); @@ -1389,11 +1382,44 @@ static void CL_RelinkEffects(void) } } +void CL_Beam_CalculatePositions(const beam_t *b, vec3_t start, vec3_t end) +{ + VectorCopy(b->start, start); + VectorCopy(b->end, end); + + // if coming from the player, update the start position + if (b->entity == cl.viewentity) + { + if (cl_beams_quakepositionhack.integer && !chase_active.integer) + { + // LordHavoc: this is a stupid hack from Quake that makes your + // lightning appear to come from your waist and cover less of your + // view + // in Quake this hack was applied to all players (causing the + // infamous crotch-lightning), but in darkplaces and QuakeWorld it + // only applies to your own lightning, and only in first person + Matrix4x4_OriginFromMatrix(&cl.entities[cl.viewentity].render.matrix, start); + } + if (cl_beams_instantaimhack.integer) + { + vec3_t dir, localend; + vec_t len; + // LordHavoc: this updates the beam direction to match your + // viewangles + VectorSubtract(end, start, dir); + len = VectorLength(dir); + VectorNormalize(dir); + VectorSet(localend, len, 0, 0); + Matrix4x4_Transform(&r_view.matrix, localend, end); + } + } +} + void CL_RelinkBeams(void) { int i; beam_t *b; - vec3_t dist, org; + vec3_t dist, org, start, end; float d; entity_t *ent; float yaw, pitch; @@ -1410,24 +1436,14 @@ void CL_RelinkBeams(void) continue; } - // if coming from the player, update the start position - //if (b->entity == cl.viewentity) - // Matrix4x4_OriginFromMatrix(&cl.entities[cl.viewentity].render.matrix, b->start); - if (cl_beams_relative.integer && b->entity && cl.entities[b->entity].state_current.active && b->relativestartvalid) - { - entity_render_t *r = &cl.entities[b->entity].render; - //Matrix4x4_OriginFromMatrix(&r->matrix, origin); - //Matrix4x4_CreateFromQuakeEntity(&matrix, r->origin[0], r->origin[1], r->origin[2] + 16, r->angles[0], r->angles[1], r->angles[2], 1); - Matrix4x4_Transform(&r->matrix, b->relativestart, b->start); - Matrix4x4_Transform(&r->matrix, b->relativeend, b->end); - } + CL_Beam_CalculatePositions(b, start, end); if (b->lightning) { if (cl_beams_lightatend.integer) { // FIXME: create a matrix from the beam start/end orientation - Matrix4x4_CreateTranslate(&tempmatrix, b->end[0], b->end[1], b->end[2]); + Matrix4x4_CreateTranslate(&tempmatrix, end[0], end[1], end[2]); CL_AllocDlight (NULL, &tempmatrix, 200, 0.3, 0.7, 1, 0, 0, 0, -1, true, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE); } if (cl_beams_polygons.integer) @@ -1435,8 +1451,8 @@ void CL_RelinkBeams(void) } // calculate pitch and yaw - VectorSubtract (b->end, b->start, dist); - + // (this is similar to the QuakeC builtin function vectoangles) + VectorSubtract(end, start, dist); if (dist[1] == 0 && dist[0] == 0) { yaw = 0; @@ -1458,7 +1474,7 @@ void CL_RelinkBeams(void) } // add new entities for the lightning - VectorCopy (b->start, org); + VectorCopy (start, org); d = VectorNormalizeLength(dist); while (d > 0) { @@ -1515,7 +1531,6 @@ static void CL_RelinkQWNails(void) void CL_LerpPlayer(float frac) { int i; - float d; cl.viewzoom = cl.mviewzoom[1] + frac * (cl.mviewzoom[0] - cl.mviewzoom[1]); for (i = 0;i < 3;i++) @@ -1524,24 +1539,11 @@ void CL_LerpPlayer(float frac) cl.punchvector[i] = cl.mpunchvector[1][i] + frac * (cl.mpunchvector[0][i] - cl.mpunchvector[1][i]); cl.velocity[i] = cl.mvelocity[1][i] + frac * (cl.mvelocity[0][i] - cl.mvelocity[1][i]); } - - if (cls.demoplayback) - { - // interpolate the angles - for (i = 0;i < 3;i++) - { - d = cl.mviewangles[0][i] - cl.mviewangles[1][i]; - if (d > 180) - d -= 360; - else if (d < -180) - d += 360; - cl.viewangles[i] = cl.mviewangles[1][i] + frac * d; - } - } } void CSQC_RelinkAllEntities (int drawmask) { + cl.num_brushmodel_entities = 0; CL_RelinkNetworkEntities(drawmask); if(drawmask & ENTMASK_ENGINE) { @@ -1579,8 +1581,7 @@ int CL_ReadFromServer(void) r_refdef.time = cl.time; r_refdef.extraupdate = !r_speeds.integer; r_refdef.numentities = 0; - r_refdef.viewentitymatrix = identitymatrix; - cl.num_brushmodel_entities = 0; + r_view.matrix = identitymatrix; if (cls.state == ca_connected && cls.signon == SIGNONS) { @@ -1595,6 +1596,7 @@ int CL_ReadFromServer(void) CL_ClientMovement_Replay(); if(!csqc_loaded) //[515]: csqc { + cl.num_brushmodel_entities = 0; CL_RelinkNetworkEntities(65535); // move particles @@ -1616,6 +1618,9 @@ int CL_ReadFromServer(void) // update view blend V_CalcViewBlend(); + + // update the r_refdef time again because cl.time may have changed + r_refdef.time = cl.time; } return 0; @@ -1640,13 +1645,13 @@ static void CL_Fog_f (void) { if (Cmd_Argc () == 1) { - Con_Printf("\"fog\" is \"%f %f %f %f\"\n", fog_density, fog_red, fog_green, fog_blue); + Con_Printf("\"fog\" is \"%f %f %f %f\"\n", r_refdef.fog_density, r_refdef.fog_red, r_refdef.fog_green, r_refdef.fog_blue); return; } - fog_density = atof(Cmd_Argv(1)); - fog_red = atof(Cmd_Argv(2)); - fog_green = atof(Cmd_Argv(3)); - fog_blue = atof(Cmd_Argv(4)); + r_refdef.fog_density = atof(Cmd_Argv(1)); + r_refdef.fog_red = atof(Cmd_Argv(2)); + r_refdef.fog_green = atof(Cmd_Argv(3)); + r_refdef.fog_blue = atof(Cmd_Argv(4)); } /* @@ -1668,7 +1673,7 @@ static void CL_TimeRefresh_f (void) timestart = Sys_DoubleTime(); for (i = 0;i < 128;i++) { - Matrix4x4_CreateFromQuakeEntity(&r_refdef.viewentitymatrix, r_vieworigin[0], r_vieworigin[1], r_vieworigin[2], 0, i / 128.0 * 360.0, 0, 1); + Matrix4x4_CreateFromQuakeEntity(&r_view.matrix, r_view.origin[0], r_view.origin[1], r_view.origin[2], 0, i / 128.0 * 360.0, 0, 1); CL_UpdateScreen(); } timedelta = Sys_DoubleTime() - timestart; @@ -1744,6 +1749,9 @@ void CL_Init (void) Cmd_AddCommand ("playdemo", CL_PlayDemo_f, "watch a demo file"); Cmd_AddCommand ("timedemo", CL_TimeDemo_f, "play back a demo as fast as possible and save statistics to benchmark.log"); + Cvar_RegisterVariable (&cl_autodemo); + Cvar_RegisterVariable (&cl_autodemo_nameformat); + Cmd_AddCommand ("fog", CL_Fog_f, "set global fog parameters (density red green blue)"); // LordHavoc: added pausedemo @@ -1758,7 +1766,8 @@ void CL_Init (void) Cvar_RegisterVariable(&cl_stainmaps); Cvar_RegisterVariable(&cl_stainmaps_clearonload); Cvar_RegisterVariable(&cl_beams_polygons); - Cvar_RegisterVariable(&cl_beams_relative); + Cvar_RegisterVariable(&cl_beams_quakepositionhack); + Cvar_RegisterVariable(&cl_beams_instantaimhack); Cvar_RegisterVariable(&cl_beams_lightatend); Cvar_RegisterVariable(&cl_noplayershadow);