more cl*.h dependency cleanups realtime and cl.time are no longer reffed

This commit is contained in:
Bill Currie 2001-05-20 03:54:55 +00:00
parent 844ed4a41e
commit daca64ed04
50 changed files with 190 additions and 179 deletions

View file

@ -36,7 +36,7 @@
void SCR_Init_Cvars (void); void SCR_Init_Cvars (void);
void SCR_Init (void); void SCR_Init (void);
void SCR_UpdateScreen (void); void SCR_UpdateScreen (double realtime);
void SCR_UpdateWholeScreen (void); void SCR_UpdateWholeScreen (void);
void SCR_SizeUp (void); void SCR_SizeUp (void);

View file

@ -138,6 +138,8 @@ extern void R_MakeSky (void);
extern int ubasestep, errorterm, erroradjustup, erroradjustdown; extern int ubasestep, errorterm, erroradjustup, erroradjustdown;
extern double r_realtime;
// flags in finalvert_t.flags // flags in finalvert_t.flags
#define ALIAS_LEFT_CLIP 0x0001 #define ALIAS_LEFT_CLIP 0x0001
#define ALIAS_TOP_CLIP 0x0002 #define ALIAS_TOP_CLIP 0x0002

View file

@ -73,7 +73,7 @@ client_LIBS= -L. -lqfnet $(qf_client_LIBS) $(NET_LIBS)
client_LIB_DEPS= libqfnet.a $(qf_client_LIBS) client_LIB_DEPS= libqfnet.a $(qf_client_LIBS)
client_SOURCES= cl_cam.c cl_cmd.c cl_demo.c cl_input.c cl_main.c cl_parse.c \ client_SOURCES= cl_cam.c cl_cmd.c cl_demo.c cl_input.c cl_main.c cl_parse.c \
cl_tent.c console.c keys.c sbar.c r_cvar.c r_efrag.c r_ent.c r_part.c r_view.c \ cl_tent.c console.c keys.c sbar.c r_cvar.c r_efrag.c r_ent.c r_main.c r_part.c r_view.c \
nonintel.c locs.c pcx.c tga.c nonintel.c locs.c pcx.c tga.c
server_SOURCES= host.c host_cmd.c pr_cmds.c sv_cvar.c sv_main.c \ server_SOURCES= host.c host_cmd.c pr_cmds.c sv_cvar.c sv_main.c \

View file

@ -40,9 +40,10 @@
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/render.h"
#include "client.h"
#include "glquake.h" #include "glquake.h"
#include "r_shared.h"
#define MAX_FIRES 128 // rocket flames #define MAX_FIRES 128 // rocket flames
@ -77,7 +78,7 @@ R_AddFire (vec3_t start, vec3_t end, entity_t *ent)
VectorCopy (end, f->origin); VectorCopy (end, f->origin);
VectorCopy (start, f->owner); VectorCopy (start, f->owner);
f->size = 10; f->size = 10;
f->die = cl.time + 0.5; f->die = r_realtime + 0.5;
f->decay = 1; f->decay = 1;
VectorCopy (r_firecolor->vec, f->color); VectorCopy (r_firecolor->vec, f->color);
} }
@ -109,7 +110,7 @@ R_AllocFire (int key)
f = r_fires; // no match, look for a free spot f = r_fires; // no match, look for a free spot
for (i = 0; i < MAX_FIRES; i++, f++) { for (i = 0; i < MAX_FIRES; i++, f++) {
if (f->die < cl.time) { if (f->die < r_realtime) {
memset (f, 0, sizeof (*f)); memset (f, 0, sizeof (*f));
f->key = key; f->key = key;
return f; return f;
@ -197,7 +198,7 @@ R_UpdateFires (void)
f = r_fires; f = r_fires;
for (i = 0; i < MAX_FIRES; i++, f++) { for (i = 0; i < MAX_FIRES; i++, f++) {
if (f->die < cl.time || !f->size) if (f->die < r_realtime || !f->size)
continue; continue;
f->size += f->decay; f->size += f->decay;
R_DrawFire (f); R_DrawFire (f);

View file

@ -176,7 +176,7 @@ R_ReadPointFile_f (void)
int c; int c;
char name[MAX_OSPATH], *mapname, *t1; char name[MAX_OSPATH], *mapname, *t1;
mapname = strdup (cl.worldmodel->name); mapname = strdup (r_worldentity.model->name);
if (!mapname) if (!mapname)
Sys_Error ("Can't duplicate mapname!"); Sys_Error ("Can't duplicate mapname!");
t1 = strrchr (mapname, '.'); t1 = strrchr (mapname, '.');
@ -223,7 +223,7 @@ R_ParticleExplosion (vec3_t org)
return; return;
particle_new_random (pt_smokecloud, part_tex_smoke[rand () & 7], org, 4, 30, particle_new_random (pt_smokecloud, part_tex_smoke[rand () & 7], org, 4, 30,
8, cl.time + 5, (rand () & 7) + 8, 8, r_realtime + 5, (rand () & 7) + 8,
128 + (rand () & 63)); 128 + (rand () & 63));
} }
@ -238,7 +238,7 @@ R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
return; return;
for (i = 0; i < 512; i++) { for (i = 0; i < 512; i++) {
particle_new_random (pt_blob, part_tex_dot, org, 16, 2, 256, (cl.time + 0.3), (colorStart + (colorMod % colorLength)), 255); particle_new_random (pt_blob, part_tex_dot, org, 16, 2, 256, (r_realtime + 0.3), (colorStart + (colorMod % colorLength)), 255);
colorMod++; colorMod++;
} }
} }
@ -254,12 +254,12 @@ R_BlobExplosion (vec3_t org)
for (i = 0; i < 512; i++) { for (i = 0; i < 512; i++) {
particle_new_random (pt_blob, part_tex_dot, org, 12, 2, 256, particle_new_random (pt_blob, part_tex_dot, org, 12, 2, 256,
(cl.time + 1 + (rand () & 8) * 0.05), (r_realtime + 1 + (rand () & 8) * 0.05),
(66 + rand () % 6), 255); (66 + rand () % 6), 255);
} }
for (i = 0; i < 512; i++) { for (i = 0; i < 512; i++) {
particle_new_random (pt_blob2, part_tex_dot, org, 12, 2, 256, particle_new_random (pt_blob2, part_tex_dot, org, 12, 2, 256,
(cl.time + 1 + (rand () & 8) * 0.05), (r_realtime + 1 + (rand () & 8) * 0.05),
(150 + rand () % 6), 255); (150 + rand () % 6), 255);
} }
} }
@ -272,11 +272,11 @@ R_RunSparkEffect (vec3_t org, int count, int ofuzz)
return; return;
particle_new (pt_smokecloud, part_tex_smoke[rand () & 7], org, particle_new (pt_smokecloud, part_tex_smoke[rand () & 7], org,
(ofuzz / 8) * .75, vec3_origin, cl.time + 99, (ofuzz / 8) * .75, vec3_origin, r_realtime + 99,
12 + (rand () & 3), 96, vec3_origin, vec3_origin); 12 + (rand () & 3), 96, vec3_origin, vec3_origin);
while (count--) while (count--)
particle_new_random (pt_fallfadespark, part_tex_spark, org, ofuzz * .75, particle_new_random (pt_fallfadespark, part_tex_spark, org, ofuzz * .75,
1, 96, cl.time + 5, ramp[rand () % 6], 1, 96, r_realtime + 5, ramp[rand () % 6],
lhrandom (0, 255)); lhrandom (0, 255));
} }
@ -306,7 +306,7 @@ R_BloodPuff (vec3_t org, int count)
return; return;
particle_new (pt_bloodcloud, part_tex_smoke[rand () & 7], org, 9, particle_new (pt_bloodcloud, part_tex_smoke[rand () & 7], org, 9,
vec3_origin, cl.time + 99, 68 + (rand () & 3), 128, vec3_origin, r_realtime + 99, 68 + (rand () & 3), 128,
vec3_origin, vec3_origin); vec3_origin, vec3_origin);
} }
@ -352,7 +352,7 @@ R_RunParticleEffect (vec3_t org, int color, int count)
porg[j] = org[j] + scale * ((rand () & 15) - 8); porg[j] = org[j] + scale * ((rand () & 15) - 8);
} }
particle_new (pt_grav, part_tex_dot, porg, 1.5, vec3_origin, particle_new (pt_grav, part_tex_dot, porg, 1.5, vec3_origin,
(cl.time + 0.1 * (rand () % 5)), (r_realtime + 0.1 * (rand () % 5)),
(color & ~7) + (rand () & 7), 255, vec3_origin, vec3_origin); (color & ~7) + (rand () & 7), 255, vec3_origin, vec3_origin);
} }
} }
@ -402,7 +402,7 @@ R_LavaSplash (vec3_t org)
vel = 50 + (rand () & 63); vel = 50 + (rand () & 63);
VectorScale (dir, vel, pvel); VectorScale (dir, vel, pvel);
particle_new (pt_grav, part_tex_dot, porg, 3, pvel, particle_new (pt_grav, part_tex_dot, porg, 3, pvel,
(cl.time + 2 + (rand () & 31) * 0.02), (r_realtime + 2 + (rand () & 31) * 0.02),
(224 + (rand () & 7)), 193, vec3_origin, vec3_origin); (224 + (rand () & 7)), 193, vec3_origin, vec3_origin);
} }
} }
@ -434,7 +434,7 @@ R_TeleportSplash (vec3_t org)
vel = 50 + (rand () & 63); vel = 50 + (rand () & 63);
VectorScale (dir, vel, pvel); VectorScale (dir, vel, pvel);
particle_new (pt_grav, part_tex_spark, porg, 0.6, pvel, particle_new (pt_grav, part_tex_spark, porg, 0.6, pvel,
(cl.time + 0.2 + (rand () & 7) * 0.02), (r_realtime + 0.2 + (rand () & 7) * 0.02),
(7 + (rand () & 7)), 255, vec3_origin, vec3_origin); (7 + (rand () & 7)), 255, vec3_origin, vec3_origin);
} }
} }
@ -463,7 +463,7 @@ R_RocketTrail (int type, entity_t *ent)
VectorCopy (vec3_origin, up); VectorCopy (vec3_origin, up);
VectorCopy (vec3_origin, right); VectorCopy (vec3_origin, right);
VectorCopy (vec3_origin, pvel); VectorCopy (vec3_origin, pvel);
pdie = cl.time + 2; pdie = r_realtime + 2;
ptype = pt_static; ptype = pt_static;
ptex = part_tex_dot; ptex = part_tex_dot;
palpha = 255; palpha = 255;
@ -473,7 +473,7 @@ R_RocketTrail (int type, entity_t *ent)
switch (type) { switch (type) {
case 0: // rocket trail case 0: // rocket trail
pdie = cl.time + 60; pdie = r_realtime + 60;
// ptype = pt_smokering; // Mercury's Rings // ptype = pt_smokering; // Mercury's Rings
ptype = pt_smoke; ptype = pt_smoke;
pscale = lhrandom (6, 8); pscale = lhrandom (6, 8);
@ -512,7 +512,7 @@ R_RocketTrail (int type, entity_t *ent)
pcolor = 9 * 16 + 8 + (rand () & 3); pcolor = 9 * 16 + 8 + (rand () & 3);
ptype = pt_static; ptype = pt_static;
pscale = lhrandom (.75, 1.5); pscale = lhrandom (.75, 1.5);
pdie = cl.time + 0.3; pdie = r_realtime + 0.3;
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
porg[j] = ent->old_origin[j] + lhrandom (-8, 8); porg[j] = ent->old_origin[j] + lhrandom (-8, 8);
break; break;
@ -522,7 +522,7 @@ R_RocketTrail (int type, entity_t *ent)
static int tracercount; static int tracercount;
dist = 3; dist = 3;
pdie = cl.time + 0.5; pdie = r_realtime + 0.5;
ptype = pt_static; ptype = pt_static;
pscale = lhrandom (1.5, 3); pscale = lhrandom (1.5, 3);
if (type == 3) if (type == 3)
@ -592,7 +592,7 @@ R_DrawParticles (void)
// LordHavoc: this is probably no longer necessary, as it is // LordHavoc: this is probably no longer necessary, as it is
// checked at the end, but could still happen on weird particle // checked at the end, but could still happen on weird particle
// effects, left for safety... // effects, left for safety...
if (part->die <= cl.time) { if (part->die <= r_realtime) {
freeparticles[j++] = part; freeparticles[j++] = part;
continue; continue;
} }
@ -735,14 +735,14 @@ R_DrawParticles (void)
// LordHavoc: immediate removal of unnecessary particles (must // LordHavoc: immediate removal of unnecessary particles (must
// be done to ensure compactor below operates properly in all // be done to ensure compactor below operates properly in all
// cases) // cases)
if (part->die <= cl.time) if (part->die <= r_realtime)
freeparticles[j++] = part; freeparticles[j++] = part;
} }
k = 0; k = 0;
while (maxparticle >= activeparticles) { while (maxparticle >= activeparticles) {
*freeparticles[k++] = particles[maxparticle--]; *freeparticles[k++] = particles[maxparticle--];
while (maxparticle >= activeparticles && while (maxparticle >= activeparticles &&
particles[maxparticle].die <= cl.time) particles[maxparticle].die <= r_realtime)
maxparticle--; maxparticle--;
} }
numparticles = activeparticles; numparticles = activeparticles;

View file

@ -51,7 +51,7 @@ R_AnimateLight (void)
// light animations // light animations
// 'm' is normal light, 'a' is no light, 'z' is double bright // 'm' is normal light, 'a' is no light, 'z' is double bright
i = (int) (cl.time * 10); i = (int) (r_realtime * 10);
for (j = 0; j < MAX_LIGHTSTYLES; j++) { for (j = 0; j < MAX_LIGHTSTYLES; j++) {
if (!cl_lightstyle[j].length) { if (!cl_lightstyle[j].length) {
d_lightstylevalue[j] = 256; d_lightstylevalue[j] = 256;
@ -169,7 +169,7 @@ R_RenderDlights (void)
l = cl_dlights; l = cl_dlights;
for (i = 0; i < MAX_DLIGHTS; i++, l++) { for (i = 0; i < MAX_DLIGHTS; i++, l++) {
if (l->die < cl.time || !l->radius) if (l->die < r_realtime || !l->radius)
continue; continue;
R_RenderDlight (l); R_RenderDlight (l);
} }
@ -294,7 +294,7 @@ R_PushDlights (vec3_t entorigin)
l = cl_dlights; l = cl_dlights;
for (i = 0; i < MAX_DLIGHTS; i++, l++) { for (i = 0; i < MAX_DLIGHTS; i++, l++) {
if (l->die < cl.time || !l->radius) if (l->die < r_realtime || !l->radius)
continue; continue;
VectorSubtract (l->origin, entorigin, lightorigin); VectorSubtract (l->origin, entorigin, lightorigin);
R_MarkLights (lightorigin, l, 1 << i, cl.worldmodel->nodes); R_MarkLights (lightorigin, l, 1 << i, cl.worldmodel->nodes);

View file

@ -151,7 +151,7 @@ R_GetSpriteFrame (entity_t *currententity)
numframes = pspritegroup->numframes; numframes = pspritegroup->numframes;
fullinterval = pintervals[numframes - 1]; fullinterval = pintervals[numframes - 1];
time = cl.time + currententity->syncbase; time = r_realtime + currententity->syncbase;
// when loading in Mod_LoadSpriteGroup, we guaranteed all interval // when loading in Mod_LoadSpriteGroup, we guaranteed all interval
// values // values
@ -466,7 +466,7 @@ GL_DrawAliasBlendedShadow (aliashdr_t *paliashdr, int pose1, int pose2, entity_t
int *order, count; int *order, count;
float height, lheight, blend; float height, lheight, blend;
blend = (cl.time - e->frame_start_time) / e->frame_interval; blend = (r_realtime - e->frame_start_time) / e->frame_interval;
blend = min (blend, 1); blend = min (blend, 1);
lerp = 1 - blend; lerp = 1 - blend;
@ -535,7 +535,7 @@ R_SetupAliasFrame (int frame, aliashdr_t *paliashdr, qboolean fb)
if (numposes > 1) { if (numposes > 1) {
interval = paliashdr->frames[frame].interval; interval = paliashdr->frames[frame].interval;
pose += (int) (cl.time / interval) % numposes; pose += (int) (r_realtime / interval) % numposes;
} }
GL_DrawAliasFrame (paliashdr, pose, fb); GL_DrawAliasFrame (paliashdr, pose, fb);
@ -558,7 +558,7 @@ R_SetupAliasBlendedFrame (int frame, aliashdr_t *paliashdr, entity_t *e, qboolea
if (numposes > 1) { if (numposes > 1) {
e->frame_interval = paliashdr->frames[frame].interval; e->frame_interval = paliashdr->frames[frame].interval;
pose += (int) (cl.time / e->frame_interval) % numposes; pose += (int) (r_realtime / e->frame_interval) % numposes;
} else { } else {
/* /*
One tenth of a second is good for most Quake animations. If the One tenth of a second is good for most Quake animations. If the
@ -572,7 +572,7 @@ R_SetupAliasBlendedFrame (int frame, aliashdr_t *paliashdr, entity_t *e, qboolea
} }
if (e->pose2 != pose) { if (e->pose2 != pose) {
e->frame_start_time = cl.time; e->frame_start_time = r_realtime;
if (e->pose2 == -1) { if (e->pose2 == -1) {
e->pose1 = pose; e->pose1 = pose;
} else { } else {
@ -581,7 +581,7 @@ R_SetupAliasBlendedFrame (int frame, aliashdr_t *paliashdr, entity_t *e, qboolea
e->pose2 = pose; e->pose2 = pose;
blend = 0; blend = 0;
} else { } else {
blend = (cl.time - e->frame_start_time) / e->frame_interval; blend = (r_realtime - e->frame_start_time) / e->frame_interval;
} }
// wierd things start happening if blend passes 1 // wierd things start happening if blend passes 1
@ -639,7 +639,7 @@ R_DrawAliasModel (entity_t *e)
shadelight = max (shadelight, 24); shadelight = max (shadelight, 24);
for (lnum = 0; lnum < MAX_DLIGHTS; lnum++) { for (lnum = 0; lnum < MAX_DLIGHTS; lnum++) {
if (cl_dlights[lnum].die >= cl.time) { if (cl_dlights[lnum].die >= r_realtime) {
VectorSubtract (currententity->origin, cl_dlights[lnum].origin, VectorSubtract (currententity->origin, cl_dlights[lnum].origin,
dist); dist);
add = (cl_dlights[lnum].radius * cl_dlights[lnum].radius * 8) / add = (cl_dlights[lnum].radius * cl_dlights[lnum].radius * 8) /
@ -696,7 +696,7 @@ R_DrawAliasModel (entity_t *e)
paliashdr->mdl.scale[2]); paliashdr->mdl.scale[2]);
} }
anim = (int) (cl.time * 10) & 3; anim = (int) (r_realtime * 10) & 3;
skinnum = currententity->skinnum; skinnum = currententity->skinnum;
if ((skinnum >= paliashdr->mdl.numskins) || (skinnum < 0)) { if ((skinnum >= paliashdr->mdl.numskins) || (skinnum < 0)) {
@ -790,7 +790,7 @@ R_ShowNearestLoc (void)
dl = CL_AllocDlight (4096); dl = CL_AllocDlight (4096);
VectorCopy (nearloc->loc, dl->origin); VectorCopy (nearloc->loc, dl->origin);
dl->radius = 200; dl->radius = 200;
dl->die = cl.time + 0.1; dl->die = r_realtime + 0.1;
dl->color[0] = 0; dl->color[0] = 0;
dl->color[1] = 1; dl->color[1] = 1;
dl->color[2] = 0; dl->color[2] = 0;
@ -1118,7 +1118,6 @@ R_Mirror (void)
R_RenderScene (); R_RenderScene ();
R_DrawWaterSurfaces (); R_DrawWaterSurfaces ();
gldepthmin = 0; gldepthmin = 0;
gldepthmax = 1;//XXX 0.5; gldepthmax = 1;//XXX 0.5;
glDepthRange (gldepthmin, gldepthmax); glDepthRange (gldepthmin, gldepthmax);

View file

@ -51,7 +51,6 @@
qboolean r_cache_thrash; qboolean r_cache_thrash;
extern double realtime;
int skytexturenum; int skytexturenum;
extern vec3_t shadecolor; // Ender (Extend) Colormod extern vec3_t shadecolor; // Ender (Extend) Colormod
@ -335,7 +334,7 @@ R_TextureAnimation (texture_t *base)
if (!base->anim_total) if (!base->anim_total)
return base; return base;
relative = (int) (cl.time * 10) % base->anim_total; relative = (int) (r_realtime * 10) % base->anim_total;
count = 0; count = 0;
while (base->anim_min > relative || base->anim_max <= relative) { while (base->anim_min > relative || base->anim_max <= relative) {
@ -723,7 +722,7 @@ R_DrawBrushModel (entity_t *e)
vec3_t lightorigin; vec3_t lightorigin;
for (k = 0; k < MAX_DLIGHTS; k++) { for (k = 0; k < MAX_DLIGHTS; k++) {
if ((cl_dlights[k].die < cl.time) || (!cl_dlights[k].radius)) if ((cl_dlights[k].die < r_realtime) || (!cl_dlights[k].radius))
continue; continue;
VectorSubtract (cl_dlights[k].origin, e->origin, lightorigin); VectorSubtract (cl_dlights[k].origin, e->origin, lightorigin);

View file

@ -165,7 +165,7 @@ SCR_CenterPrint (char *str)
{ {
strncpy (scr_centerstring, str, sizeof (scr_centerstring) - 1); strncpy (scr_centerstring, str, sizeof (scr_centerstring) - 1);
scr_centertime_off = scr_centertime->value; scr_centertime_off = scr_centertime->value;
scr_centertime_start = cl.time; scr_centertime_start = r_realtime;
// count the number of lines for centering // count the number of lines for centering
scr_center_lines = 1; scr_center_lines = 1;
@ -188,7 +188,7 @@ SCR_DrawCenterString (void)
// the finale prints the characters one at a time // the finale prints the characters one at a time
if (cl.intermission) if (cl.intermission)
remaining = scr_printspeed->value * (cl.time - scr_centertime_start); remaining = scr_printspeed->value * (r_realtime - scr_centertime_start);
else else
remaining = 9999; remaining = 9999;
@ -424,7 +424,7 @@ SCR_DrawNet (void)
{ {
// if (cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged < // if (cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged <
// UPDATE_BACKUP - 1) // UPDATE_BACKUP - 1)
if (realtime - cl.last_received_message < 0.3) if (r_realtime - cl.last_received_message < 0.3)
return; return;
if (cls.demoplayback) if (cls.demoplayback)
return; return;
@ -876,7 +876,7 @@ extern cvar_t *brightness;
needs almost the entire 256k of stack space! needs almost the entire 256k of stack space!
*/ */
void void
SCR_UpdateScreen (void) SCR_UpdateScreen (double realtime)
{ {
double time1 = 0, time2; double time1 = 0, time2;
float f; float f;
@ -884,13 +884,15 @@ SCR_UpdateScreen (void)
if (block_drawing) if (block_drawing)
return; return;
r_realtime = realtime;
vid.numpages = 2 + gl_triplebuffer->int_val; vid.numpages = 2 + gl_triplebuffer->int_val;
scr_copytop = 0; scr_copytop = 0;
scr_copyeverything = 0; scr_copyeverything = 0;
if (scr_disabled_for_loading) { if (scr_disabled_for_loading) {
if (realtime - scr_disabled_time > 60) { if (r_realtime - scr_disabled_time > 60) {
scr_disabled_for_loading = false; scr_disabled_for_loading = false;
Con_Printf ("load failed.\n"); Con_Printf ("load failed.\n");
} else { } else {

View file

@ -32,11 +32,11 @@
#include "QF/compat.h" #include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/render.h"
#include "QF/skin.h" #include "QF/skin.h"
#include "QF/texture.h" #include "QF/texture.h"
#include "glquake.h" #include "glquake.h"
#include "QF/render.h"
static byte translate[256]; static byte translate[256];
static unsigned int translate32[256]; static unsigned int translate32[256];

View file

@ -39,14 +39,14 @@
#include "QF/compat.h" #include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/quakefs.h" #include "QF/quakefs.h"
#include "QF/render.h"
#include "QF/tga.h" #include "QF/tga.h"
#include "QF/vid.h" #include "QF/vid.h"
#include "glquake.h" #include "glquake.h"
#include "QF/render.h" #include "r_shared.h"
#include "view.h" #include "view.h"
extern double realtime;
extern model_t *loadmodel; extern model_t *loadmodel;
extern int skytexturenum; extern int skytexturenum;
@ -240,7 +240,7 @@ R_DrawSkyDome (void)
domescale[0] = 512; domescale[0] = 512;
domescale[1] = 512; domescale[1] = 512;
domescale[2] = 128; domescale[2] = 128;
speedscale = realtime * 8; speedscale = r_realtime * 8;
speedscale -= (int) speedscale & ~127; speedscale -= (int) speedscale & ~127;
R_DrawSkyLayer (speedscale); R_DrawSkyLayer (speedscale);
glEnable (GL_BLEND); glEnable (GL_BLEND);
@ -251,7 +251,7 @@ R_DrawSkyDome (void)
domescale[0] = 512; domescale[0] = 512;
domescale[1] = 512; domescale[1] = 512;
domescale[2] = 128; domescale[2] = 128;
speedscale = realtime * 16; speedscale = r_realtime * 16;
speedscale -= (int) speedscale & ~127; speedscale -= (int) speedscale & ~127;
R_DrawSkyLayer (speedscale); R_DrawSkyLayer (speedscale);
} }

View file

@ -39,6 +39,7 @@
#include <stdarg.h> #include <stdarg.h>
#include "QF/console.h" #include "QF/console.h"
#include "QF/render.h"
#include "QF/sys.h" #include "QF/sys.h"
#include "client.h" #include "client.h"

View file

@ -34,8 +34,8 @@
#include "QF/sys.h" #include "QF/sys.h"
#include "glquake.h" #include "glquake.h"
#include "r_shared.h"
extern double realtime;
extern model_t *loadmodel; extern model_t *loadmodel;
extern qboolean lighthalf; extern qboolean lighthalf;
@ -212,18 +212,18 @@ EmitWaterPolys (msurface_t *fa)
os = v[3]; os = v[3];
ot = v[4]; ot = v[4];
s = os + turbsin[(int) ((ot * 0.125 + realtime) * TURBSCALE) & 255]; s = os + turbsin[(int) ((ot * 0.125 + r_realtime) * TURBSCALE) & 255];
s *= (1.0 / 64); s *= (1.0 / 64);
t = ot + turbsin[(int) ((os * 0.125 + realtime) * TURBSCALE) & 255]; t = ot + turbsin[(int) ((os * 0.125 + r_realtime) * TURBSCALE) & 255];
t *= (1.0 / 64); t *= (1.0 / 64);
glTexCoord2f (s, t); glTexCoord2f (s, t);
VectorCopy (v, nv); VectorCopy (v, nv);
nv[2] += r_waterripple->value nv[2] += r_waterripple->value
* turbsin[(int) ((v[3] * 0.125 + realtime) * TURBSCALE) & 255] * turbsin[(int) ((v[3] * 0.125 + r_realtime) * TURBSCALE) & 255]
* turbsin[(int) ((v[4] * 0.125 + realtime) * TURBSCALE) & 255] * turbsin[(int) ((v[4] * 0.125 + r_realtime) * TURBSCALE) & 255]
* (1.0 / 64.0); * (1.0 / 64.0);
glVertex3fv (nv); glVertex3fv (nv);

View file

@ -705,7 +705,7 @@ _Host_Frame (float time)
if (host_speeds->int_val) if (host_speeds->int_val)
time1 = Sys_DoubleTime (); time1 = Sys_DoubleTime ();
SCR_UpdateScreen (); SCR_UpdateScreen (realtime);
if (host_speeds->int_val) if (host_speeds->int_val)
time2 = Sys_DoubleTime (); time2 = Sys_DoubleTime ();
@ -1001,7 +1001,7 @@ Host_Init (quakeparms_t *parms)
Sys_Printf ("========Quake Initialized=========\n"); Sys_Printf ("========Quake Initialized=========\n");
SCR_UpdateScreen (); SCR_UpdateScreen (realtime);
} }

View file

@ -300,7 +300,7 @@ Key_Console (int key)
key_lines[edit_line][1] = 0; key_lines[edit_line][1] = 0;
key_linepos = 1; key_linepos = 1;
if (cls.state == ca_disconnected) if (cls.state == ca_disconnected)
SCR_UpdateScreen (); // force an update, because the SCR_UpdateScreen (realtime); // force an update, because the
// command may take some time // command may take some time
return; return;

View file

@ -1297,7 +1297,7 @@ _Datagram_Connect (char *host)
// send the connection request // send the connection request
Con_Printf ("trying...\n"); Con_Printf ("trying...\n");
SCR_UpdateScreen (); SCR_UpdateScreen (realtime);
start_time = net_time; start_time = net_time;
for (reps = 0; reps < 3; reps++) { for (reps = 0; reps < 3; reps++) {
@ -1325,7 +1325,7 @@ _Datagram_Connect (char *host)
Con_Printf ("wrong reply address\n"); Con_Printf ("wrong reply address\n");
Con_Printf ("Expected: %s\n", StrAddr (&sendaddr)); Con_Printf ("Expected: %s\n", StrAddr (&sendaddr));
Con_Printf ("Received: %s\n", StrAddr (&readaddr)); Con_Printf ("Received: %s\n", StrAddr (&readaddr));
SCR_UpdateScreen (); SCR_UpdateScreen (realtime);
#endif #endif
ret = 0; ret = 0;
continue; continue;
@ -1359,7 +1359,7 @@ _Datagram_Connect (char *host)
if (ret) if (ret)
break; break;
Con_Printf ("still trying...\n"); Con_Printf ("still trying...\n");
SCR_UpdateScreen (); SCR_UpdateScreen (realtime);
start_time = SetNetTime (); start_time = SetNetTime ();
} }

1
nq/source/r_main.c Normal file
View file

@ -0,0 +1 @@
double r_realtime;

View file

@ -448,7 +448,7 @@ SCR_DrawNet (void)
{ {
// if (cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged < // if (cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged <
// UPDATE_BACKUP - 1) // UPDATE_BACKUP - 1)
if (realtime - cl.last_received_message < 0.3) if (r_realtime - cl.last_received_message < 0.3)
return; return;
if (cls.demoplayback) if (cls.demoplayback)
return; return;
@ -873,7 +873,7 @@ SCR_DrawNotifyString (void)
needs almost the entire 256k of stack space! needs almost the entire 256k of stack space!
*/ */
void void
SCR_UpdateScreen (void) SCR_UpdateScreen (double realtime)
{ {
static int oldscr_viewsize; static int oldscr_viewsize;
vrect_t vrect; vrect_t vrect;
@ -893,6 +893,8 @@ SCR_UpdateScreen (void)
} }
#endif #endif
r_realtime = realtime;
scr_copytop = 0; scr_copytop = 0;
scr_copyeverything = 0; scr_copyeverything = 0;
@ -1017,8 +1019,8 @@ SCR_UpdateScreen (void)
void void
SCR_UpdateWholeScreen (void) SCR_UpdateWholeScreen (double realtime)
{ {
scr_fullupdate = 0; scr_fullupdate = 0;
SCR_UpdateScreen (); SCR_UpdateScreen (realtime);
} }

View file

@ -539,7 +539,7 @@ R_AliasSetupSkin (void)
numskins = paliasskingroup->numskins; numskins = paliasskingroup->numskins;
fullskininterval = pskinintervals[numskins - 1]; fullskininterval = pskinintervals[numskins - 1];
skintime = cl.time + currententity->syncbase; skintime = r_realtime + currententity->syncbase;
// when loading in Mod_LoadAliasSkinGroup, we guaranteed all interval // when loading in Mod_LoadAliasSkinGroup, we guaranteed all interval
// values are positive, so we don't have to worry about division by 0 // values are positive, so we don't have to worry about division by 0
@ -622,7 +622,7 @@ R_AliasSetupFrame (void)
numframes = paliasgroup->numframes; numframes = paliasgroup->numframes;
fullinterval = pintervals[numframes - 1]; fullinterval = pintervals[numframes - 1];
time = cl.time + currententity->syncbase; time = r_realtime + currententity->syncbase;
// when loading in Mod_LoadAliasGroup, we guaranteed all interval values // when loading in Mod_LoadAliasGroup, we guaranteed all interval values
// are positive, so we don't have to worry about division by 0 // are positive, so we don't have to worry about division by 0

View file

@ -43,7 +43,7 @@ R_AnimateLight (void)
// light animations // light animations
// 'm' is normal light, 'a' is no light, 'z' is double bright // 'm' is normal light, 'a' is no light, 'z' is double bright
i = (int) (cl.time * 10); i = (int) (r_realtime * 10);
for (j = 0; j < MAX_LIGHTSTYLES; j++) { for (j = 0; j < MAX_LIGHTSTYLES; j++) {
if (!cl_lightstyle[j].length) { if (!cl_lightstyle[j].length) {
d_lightstylevalue[j] = 256; d_lightstylevalue[j] = 256;
@ -111,7 +111,7 @@ R_PushDlights (vec3_t entorigin)
l = cl_dlights; l = cl_dlights;
for (i = 0; i < MAX_DLIGHTS; i++, l++) { for (i = 0; i < MAX_DLIGHTS; i++, l++) {
if (l->die < cl.time || !l->radius) if (l->die < r_realtime || !l->radius)
continue; continue;
VectorSubtract (l->origin, entorigin, lightorigin); VectorSubtract (l->origin, entorigin, lightorigin);
R_MarkLights (lightorigin, l, 1 << i, cl.worldmodel->nodes); R_MarkLights (lightorigin, l, 1 << i, cl.worldmodel->nodes);

View file

@ -468,7 +468,7 @@ R_ShowNearestLoc (void)
dl = CL_AllocDlight (4096); dl = CL_AllocDlight (4096);
VectorCopy (nearloc->loc, dl->origin); VectorCopy (nearloc->loc, dl->origin);
dl->radius = 200; dl->radius = 200;
dl->die = cl.time + 0.1; dl->die = r_realtime + 0.1;
dl->color[1]=1; dl->color[1]=1;
VectorCopy(nearloc->loc,trueloc); VectorCopy(nearloc->loc,trueloc);
@ -526,7 +526,7 @@ R_DrawEntitiesOnList (void)
lighting.plightvec = lightvec; lighting.plightvec = lightvec;
for (lnum = 0; lnum < MAX_DLIGHTS; lnum++) { for (lnum = 0; lnum < MAX_DLIGHTS; lnum++) {
if (cl_dlights[lnum].die >= cl.time) { if (cl_dlights[lnum].die >= r_realtime) {
VectorSubtract (currententity->origin, VectorSubtract (currententity->origin,
cl_dlights[lnum].origin, dist); cl_dlights[lnum].origin, dist);
add = cl_dlights[lnum].radius - Length (dist); add = cl_dlights[lnum].radius - Length (dist);
@ -602,7 +602,7 @@ R_DrawViewModel (void)
continue; continue;
if (!dl->radius) if (!dl->radius)
continue; continue;
if (dl->die < cl.time) if (dl->die < r_realtime)
continue; continue;
VectorSubtract (currententity->origin, dl->origin, dist); VectorSubtract (currententity->origin, dl->origin, dist);
@ -728,7 +728,7 @@ R_DrawBEntitiesOnList (void)
vec3_t lightorigin; vec3_t lightorigin;
for (k = 0; k < MAX_DLIGHTS; k++) { for (k = 0; k < MAX_DLIGHTS; k++) {
if ((cl_dlights[k].die < cl.time) || if ((cl_dlights[k].die < r_realtime) ||
(!cl_dlights[k].radius)) continue; (!cl_dlights[k].radius)) continue;
VectorSubtract (cl_dlights[k].origin, VectorSubtract (cl_dlights[k].origin,

View file

@ -211,7 +211,7 @@ R_ParticleExplosion (vec3_t org)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->die = cl.time + 5; p->die = r_realtime + 5;
p->color = ramp1[0]; p->color = ramp1[0];
p->ramp = rand () & 3; p->ramp = rand () & 3;
if (i & 1) { if (i & 1) {
@ -247,7 +247,7 @@ R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->die = cl.time + 0.3; p->die = r_realtime + 0.3;
p->color = colorStart + (colorMod % colorLength); p->color = colorStart + (colorMod % colorLength);
colorMod++; colorMod++;
@ -278,7 +278,7 @@ R_BlobExplosion (vec3_t org)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->die = cl.time + 1 + (rand () & 8) * 0.05; p->die = r_realtime + 1 + (rand () & 8) * 0.05;
if (i & 1) { if (i & 1) {
p->type = pt_blob; p->type = pt_blob;
@ -324,7 +324,7 @@ R_RunParticleEffect (vec3_t org, int color, int count)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->die = cl.time + 0.1 * (rand () % 5); p->die = r_realtime + 0.1 * (rand () % 5);
p->color = (color & ~7) + (rand () & 7); p->color = (color & ~7) + (rand () & 7);
p->type = pt_grav; p->type = pt_grav;
for (j = 0; j < 3; j++) { for (j = 0; j < 3; j++) {
@ -356,7 +356,7 @@ R_LavaSplash (vec3_t org)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->die = cl.time + 2 + (rand () & 31) * 0.02; p->die = r_realtime + 2 + (rand () & 31) * 0.02;
p->color = 224 + (rand () & 7); p->color = 224 + (rand () & 7);
p->type = pt_grav; p->type = pt_grav;
@ -396,7 +396,7 @@ R_TeleportSplash (vec3_t org)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->die = cl.time + 0.2 + (rand () & 7) * 0.02; p->die = r_realtime + 0.2 + (rand () & 7) * 0.02;
p->color = 7 + (rand () & 7); p->color = 7 + (rand () & 7);
p->type = pt_grav; p->type = pt_grav;
@ -439,7 +439,7 @@ R_RocketTrail (int type, entity_t *ent)
active_particles = p; active_particles = p;
VectorCopy (vec3_origin, p->vel); VectorCopy (vec3_origin, p->vel);
p->die = cl.time + 2; p->die = r_realtime + 2;
if (type == 4) { // slight blood if (type == 4) { // slight blood
p->type = pt_slowgrav; p->type = pt_slowgrav;
@ -455,7 +455,7 @@ R_RocketTrail (int type, entity_t *ent)
} else if (type == 6) { // voor trail } else if (type == 6) { // voor trail
p->color = 9 * 16 + 8 + (rand () & 3); p->color = 9 * 16 + 8 + (rand () & 3);
p->type = pt_static; p->type = pt_static;
p->die = cl.time + 0.3; p->die = r_realtime + 0.3;
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
p->org[j] = ent->old_origin[j] + ((rand () & 15) - 8); p->org[j] = ent->old_origin[j] + ((rand () & 15) - 8);
} else if (type == 1) { // smoke smoke } else if (type == 1) { // smoke smoke
@ -473,7 +473,7 @@ R_RocketTrail (int type, entity_t *ent)
} else if (type == 3 || type == 5) { // tracer } else if (type == 3 || type == 5) { // tracer
static int tracercount; static int tracercount;
p->die = cl.time + 0.5; p->die = r_realtime + 0.5;
p->type = pt_static; p->type = pt_static;
if (type == 3) if (type == 3)
p->color = 52 + ((tracercount & 4) << 1); p->color = 52 + ((tracercount & 4) << 1);
@ -523,7 +523,7 @@ R_DrawParticles (void)
dvel = 4 * frametime; dvel = 4 * frametime;
for (particle = &active_particles; *particle;) { for (particle = &active_particles; *particle;) {
if ((*particle)->die < cl.time) { if ((*particle)->die < r_realtime) {
p = (*particle)->next; p = (*particle)->next;
(*particle)->next = free_particles; (*particle)->next = free_particles;
free_particles = (*particle); free_particles = (*particle);

View file

@ -30,7 +30,6 @@
# include "config.h" # include "config.h"
#endif #endif
#include "client.h"
#include "r_local.h" #include "r_local.h"
@ -241,7 +240,7 @@ R_SetSkyFrame (void)
s2 = iskyspeed2 / g; s2 = iskyspeed2 / g;
temp = SKYSIZE * s1 * s2; temp = SKYSIZE * s1 * s2;
skytime = cl.time - ((int) (cl.time / temp) * temp); skytime = r_realtime - ((int) (r_realtime / temp) * temp);
r_skymade = 0; r_skymade = 0;
} }

View file

@ -39,9 +39,9 @@
#include <math.h> #include <math.h>
#include "QF/console.h" #include "QF/console.h"
#include "QF/render.h"
#include "QF/sys.h" #include "QF/sys.h"
#include "client.h"
#include "r_local.h" #include "r_local.h"
static int clip_current; static int clip_current;
@ -256,7 +256,7 @@ R_GetSpriteframe (msprite_t *psprite)
numframes = pspritegroup->numframes; numframes = pspritegroup->numframes;
fullinterval = pintervals[numframes - 1]; fullinterval = pintervals[numframes - 1];
time = cl.time + currententity->syncbase; time = r_realtime + currententity->syncbase;
// when loading in Mod_LoadSpriteGroup, we guaranteed all interval // when loading in Mod_LoadSpriteGroup, we guaranteed all interval
// values are positive, so we don't have to worry about division by 0 // values are positive, so we don't have to worry about division by 0

View file

@ -199,7 +199,7 @@ R_TextureAnimation (texture_t *base)
if (!base->anim_total) if (!base->anim_total)
return base; return base;
reletive = (int) (cl.time * 10) % base->anim_total; reletive = (int) (r_realtime * 10) % base->anim_total;
count = 0; count = 0;
while (base->anim_min > reletive || base->anim_max <= reletive) { while (base->anim_min > reletive || base->anim_max <= reletive) {
@ -525,7 +525,7 @@ R_GenTurbTile (pixel_t *pbasetex, void *pdest)
int i, j, s, t; int i, j, s, t;
byte *pd; byte *pd;
turb = sintable + ((int) (cl.time * SPEED) & (CYCLE - 1)); turb = sintable + ((int) (r_realtime * SPEED) & (CYCLE - 1));
pd = (byte *) pdest; pd = (byte *) pdest;
for (i = 0; i < TILE_SIZE; i++) { for (i = 0; i < TILE_SIZE; i++) {
@ -545,7 +545,7 @@ R_GenTurbTile16 (pixel_t *pbasetex, void *pdest)
int i, j, s, t; int i, j, s, t;
unsigned short *pd; unsigned short *pd;
turb = sintable + ((int) (cl.time * SPEED) & (CYCLE - 1)); turb = sintable + ((int) (r_realtime * SPEED) & (CYCLE - 1));
pd = (unsigned short *) pdest; pd = (unsigned short *) pdest;
for (i = 0; i < TILE_SIZE; i++) { for (i = 0; i < TILE_SIZE; i++) {

View file

@ -98,7 +98,7 @@ client_LIB_DEPS= libqfnet.a $(qf_client_LIBS)
client_SOURCES= cl_cam.c cl_cmd.c cl_cvar.c cl_demo.c cl_ents.c cl_input.c \ client_SOURCES= cl_cam.c cl_cmd.c cl_cvar.c cl_demo.c cl_ents.c cl_input.c \
cl_main.c cl_misc.c cl_parse.c cl_pred.c cl_skin.c cl_slist.c \ cl_main.c cl_misc.c cl_parse.c cl_pred.c cl_skin.c cl_slist.c \
cl_tent.c console.c keys.c locs.c nonintel.c \ cl_tent.c console.c keys.c locs.c nonintel.c \
pcx.c r_cvar.c r_efrag.c r_ent.c r_view.c sbar.c skin.c teamplay.c tga.c wad.c cl_math.S $(syscl_SRC) pcx.c r_cvar.c r_efrag.c r_ent.c r_main.c r_view.c sbar.c skin.c teamplay.c tga.c wad.c cl_math.S $(syscl_SRC)
# Software-rendering clients # Software-rendering clients
# #

View file

@ -1481,7 +1481,7 @@ Host_Frame (float time)
if (host_speeds->int_val) if (host_speeds->int_val)
time1 = Sys_DoubleTime (); time1 = Sys_DoubleTime ();
SCR_UpdateScreen (); SCR_UpdateScreen (realtime);
if (host_speeds->int_val) if (host_speeds->int_val)
time2 = Sys_DoubleTime (); time2 = Sys_DoubleTime ();
@ -1676,7 +1676,7 @@ Host_Init (void)
Con_Printf ("<EFBFBD><EFBFBD> %s initialized €<><E282AC>\n", PROGRAM); Con_Printf ("<EFBFBD><EFBFBD> %s initialized €<><E282AC>\n", PROGRAM);
SCR_UpdateScreen (); SCR_UpdateScreen (realtime);
} }

View file

@ -256,7 +256,7 @@ Model_NextDownload (void)
if (cls.downloadnumber == 0) { if (cls.downloadnumber == 0) {
Con_Printf ("Checking models...\n"); Con_Printf ("Checking models...\n");
SCR_UpdateScreen (); SCR_UpdateScreen (realtime);
cls.downloadnumber = 1; cls.downloadnumber = 1;
} }
@ -317,7 +317,7 @@ Sound_NextDownload (void)
if (cls.downloadnumber == 0) { if (cls.downloadnumber == 0) {
Con_Printf ("Checking sounds...\n"); Con_Printf ("Checking sounds...\n");
SCR_UpdateScreen (); SCR_UpdateScreen (realtime);
cls.downloadnumber = 1; cls.downloadnumber = 1;
} }

View file

@ -64,7 +64,7 @@ Skin_NextDownload (void)
if (cls.downloadnumber == 0) { if (cls.downloadnumber == 0) {
Con_Printf ("Checking skins...\n"); Con_Printf ("Checking skins...\n");
SCR_UpdateScreen (); SCR_UpdateScreen (realtime);
} }
cls.downloadtype = dl_skin; cls.downloadtype = dl_skin;

View file

@ -30,7 +30,7 @@
# include "config.h" # include "config.h"
#endif #endif
#include "client.h" //#include "client.h"
#include "d_local.h" #include "d_local.h"
#include "r_local.h" #include "r_local.h"
#include "QF/render.h" #include "QF/render.h"
@ -78,7 +78,7 @@ D_WarpScreen (void)
(int) ((float) u * wratio * w / (w + AMP2 * 2)); (int) ((float) u * wratio * w / (w + AMP2 * 2));
} }
turb = intsintable + ((int) (cl.time * SPEED) & (CYCLE - 1)); turb = intsintable + ((int) (r_realtime * SPEED) & (CYCLE - 1));
dest = vid.buffer + scr_vrect.y * vid.rowbytes + scr_vrect.x; dest = vid.buffer + scr_vrect.y * vid.rowbytes + scr_vrect.x;
for (v = 0; v < scr_vrect.height; v++, dest += vid.rowbytes) { for (v = 0; v < scr_vrect.height; v++, dest += vid.rowbytes) {
@ -123,7 +123,7 @@ Turbulent8 (espan_t *pspan)
float sdivz, tdivz, zi, z, du, dv, spancountminus1; float sdivz, tdivz, zi, z, du, dv, spancountminus1;
float sdivz16stepu, tdivz16stepu, zi16stepu; float sdivz16stepu, tdivz16stepu, zi16stepu;
r_turb_turb = sintable + ((int) (cl.time * SPEED) & (CYCLE - 1)); r_turb_turb = sintable + ((int) (r_realtime * SPEED) & (CYCLE - 1));
r_turb_sstep = 0; // keep compiler happy r_turb_sstep = 0; // keep compiler happy
r_turb_tstep = 0; // ditto r_turb_tstep = 0; // ditto

View file

@ -40,9 +40,10 @@
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/render.h"
#include "cl_main.h"
#include "glquake.h" #include "glquake.h"
#include "r_shared.h"
#define MAX_FIRES 128 // rocket flames #define MAX_FIRES 128 // rocket flames
@ -77,7 +78,7 @@ R_AddFire (vec3_t start, vec3_t end, entity_t *ent)
VectorCopy (end, f->origin); VectorCopy (end, f->origin);
VectorCopy (start, f->owner); VectorCopy (start, f->owner);
f->size = 10; f->size = 10;
f->die = cl.time + 0.5; f->die = r_realtime + 0.5;
f->decay = 1; f->decay = 1;
VectorCopy (r_firecolor->vec, f->color); VectorCopy (r_firecolor->vec, f->color);
} }
@ -109,7 +110,7 @@ R_AllocFire (int key)
f = r_fires; // no match, look for a free spot f = r_fires; // no match, look for a free spot
for (i = 0; i < MAX_FIRES; i++, f++) { for (i = 0; i < MAX_FIRES; i++, f++) {
if (f->die < cl.time) { if (f->die < r_realtime) {
memset (f, 0, sizeof (*f)); memset (f, 0, sizeof (*f));
f->key = key; f->key = key;
return f; return f;
@ -197,7 +198,7 @@ R_UpdateFires (void)
f = r_fires; f = r_fires;
for (i = 0; i < MAX_FIRES; i++, f++) { for (i = 0; i < MAX_FIRES; i++, f++) {
if (f->die < cl.time || !f->size) if (f->die < r_realtime || !f->size)
continue; continue;
f->size += f->decay; f->size += f->decay;
R_DrawFire (f); R_DrawFire (f);

View file

@ -176,7 +176,7 @@ R_ReadPointFile_f (void)
int c; int c;
char name[MAX_OSPATH], *mapname, *t1; char name[MAX_OSPATH], *mapname, *t1;
mapname = strdup (cl.worldmodel->name); mapname = strdup (r_worldentity.model->name);
if (!mapname) if (!mapname)
Sys_Error ("Can't duplicate mapname!"); Sys_Error ("Can't duplicate mapname!");
t1 = strrchr (mapname, '.'); t1 = strrchr (mapname, '.');
@ -223,7 +223,7 @@ R_ParticleExplosion (vec3_t org)
return; return;
particle_new_random (pt_smokecloud, part_tex_smoke[rand () & 7], org, 4, 30, particle_new_random (pt_smokecloud, part_tex_smoke[rand () & 7], org, 4, 30,
8, cl.time + 5, (rand () & 7) + 8, 8, r_realtime + 5, (rand () & 7) + 8,
128 + (rand () & 63)); 128 + (rand () & 63));
} }
@ -238,7 +238,7 @@ R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
return; return;
for (i = 0; i < 512; i++) { for (i = 0; i < 512; i++) {
particle_new_random (pt_blob, part_tex_dot, org, 16, 2, 256, (cl.time + 0.3), (colorStart + (colorMod % colorLength)), 255); particle_new_random (pt_blob, part_tex_dot, org, 16, 2, 256, (r_realtime + 0.3), (colorStart + (colorMod % colorLength)), 255);
colorMod++; colorMod++;
} }
} }
@ -254,12 +254,12 @@ R_BlobExplosion (vec3_t org)
for (i = 0; i < 512; i++) { for (i = 0; i < 512; i++) {
particle_new_random (pt_blob, part_tex_dot, org, 12, 2, 256, particle_new_random (pt_blob, part_tex_dot, org, 12, 2, 256,
(cl.time + 1 + (rand () & 8) * 0.05), (r_realtime + 1 + (rand () & 8) * 0.05),
(66 + rand () % 6), 255); (66 + rand () % 6), 255);
} }
for (i = 0; i < 512; i++) { for (i = 0; i < 512; i++) {
particle_new_random (pt_blob2, part_tex_dot, org, 12, 2, 256, particle_new_random (pt_blob2, part_tex_dot, org, 12, 2, 256,
(cl.time + 1 + (rand () & 8) * 0.05), (r_realtime + 1 + (rand () & 8) * 0.05),
(150 + rand () % 6), 255); (150 + rand () % 6), 255);
} }
} }
@ -272,11 +272,11 @@ R_RunSparkEffect (vec3_t org, int count, int ofuzz)
return; return;
particle_new (pt_smokecloud, part_tex_smoke[rand () & 7], org, particle_new (pt_smokecloud, part_tex_smoke[rand () & 7], org,
(ofuzz / 8) * .75, vec3_origin, cl.time + 99, (ofuzz / 8) * .75, vec3_origin, r_realtime + 99,
12 + (rand () & 3), 96, vec3_origin, vec3_origin); 12 + (rand () & 3), 96, vec3_origin, vec3_origin);
while (count--) while (count--)
particle_new_random (pt_fallfadespark, part_tex_spark, org, ofuzz * .75, particle_new_random (pt_fallfadespark, part_tex_spark, org, ofuzz * .75,
1, 96, cl.time + 5, ramp[rand () % 6], 1, 96, r_realtime + 5, ramp[rand () % 6],
lhrandom (0, 255)); lhrandom (0, 255));
} }
@ -306,7 +306,7 @@ R_BloodPuff (vec3_t org, int count)
return; return;
particle_new (pt_bloodcloud, part_tex_smoke[rand () & 7], org, 9, particle_new (pt_bloodcloud, part_tex_smoke[rand () & 7], org, 9,
vec3_origin, cl.time + 99, 68 + (rand () & 3), 128, vec3_origin, r_realtime + 99, 68 + (rand () & 3), 128,
vec3_origin, vec3_origin); vec3_origin, vec3_origin);
} }
@ -352,7 +352,7 @@ R_RunParticleEffect (vec3_t org, int color, int count)
porg[j] = org[j] + scale * ((rand () & 15) - 8); porg[j] = org[j] + scale * ((rand () & 15) - 8);
} }
particle_new (pt_grav, part_tex_dot, porg, 1.5, vec3_origin, particle_new (pt_grav, part_tex_dot, porg, 1.5, vec3_origin,
(cl.time + 0.1 * (rand () % 5)), (r_realtime + 0.1 * (rand () % 5)),
(color & ~7) + (rand () & 7), 255, vec3_origin, vec3_origin); (color & ~7) + (rand () & 7), 255, vec3_origin, vec3_origin);
} }
} }
@ -402,7 +402,7 @@ R_LavaSplash (vec3_t org)
vel = 50 + (rand () & 63); vel = 50 + (rand () & 63);
VectorScale (dir, vel, pvel); VectorScale (dir, vel, pvel);
particle_new (pt_grav, part_tex_dot, porg, 3, pvel, particle_new (pt_grav, part_tex_dot, porg, 3, pvel,
(cl.time + 2 + (rand () & 31) * 0.02), (r_realtime + 2 + (rand () & 31) * 0.02),
(224 + (rand () & 7)), 193, vec3_origin, vec3_origin); (224 + (rand () & 7)), 193, vec3_origin, vec3_origin);
} }
} }
@ -434,7 +434,7 @@ R_TeleportSplash (vec3_t org)
vel = 50 + (rand () & 63); vel = 50 + (rand () & 63);
VectorScale (dir, vel, pvel); VectorScale (dir, vel, pvel);
particle_new (pt_grav, part_tex_spark, porg, 0.6, pvel, particle_new (pt_grav, part_tex_spark, porg, 0.6, pvel,
(cl.time + 0.2 + (rand () & 7) * 0.02), (r_realtime + 0.2 + (rand () & 7) * 0.02),
(7 + (rand () & 7)), 255, vec3_origin, vec3_origin); (7 + (rand () & 7)), 255, vec3_origin, vec3_origin);
} }
} }
@ -463,7 +463,7 @@ R_RocketTrail (int type, entity_t *ent)
VectorCopy (vec3_origin, up); VectorCopy (vec3_origin, up);
VectorCopy (vec3_origin, right); VectorCopy (vec3_origin, right);
VectorCopy (vec3_origin, pvel); VectorCopy (vec3_origin, pvel);
pdie = cl.time + 2; pdie = r_realtime + 2;
ptype = pt_static; ptype = pt_static;
ptex = part_tex_dot; ptex = part_tex_dot;
palpha = 255; palpha = 255;
@ -473,7 +473,7 @@ R_RocketTrail (int type, entity_t *ent)
switch (type) { switch (type) {
case 0: // rocket trail case 0: // rocket trail
pdie = cl.time + 60; pdie = r_realtime + 60;
// ptype = pt_smokering; // Mercury's Rings // ptype = pt_smokering; // Mercury's Rings
ptype = pt_smoke; ptype = pt_smoke;
pscale = lhrandom (6, 8); pscale = lhrandom (6, 8);
@ -512,7 +512,7 @@ R_RocketTrail (int type, entity_t *ent)
pcolor = 9 * 16 + 8 + (rand () & 3); pcolor = 9 * 16 + 8 + (rand () & 3);
ptype = pt_static; ptype = pt_static;
pscale = lhrandom (.75, 1.5); pscale = lhrandom (.75, 1.5);
pdie = cl.time + 0.3; pdie = r_realtime + 0.3;
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
porg[j] = ent->old_origin[j] + lhrandom (-8, 8); porg[j] = ent->old_origin[j] + lhrandom (-8, 8);
break; break;
@ -522,7 +522,7 @@ R_RocketTrail (int type, entity_t *ent)
static int tracercount; static int tracercount;
dist = 3; dist = 3;
pdie = cl.time + 0.5; pdie = r_realtime + 0.5;
ptype = pt_static; ptype = pt_static;
pscale = lhrandom (1.5, 3); pscale = lhrandom (1.5, 3);
if (type == 3) if (type == 3)
@ -592,7 +592,7 @@ R_DrawParticles (void)
// LordHavoc: this is probably no longer necessary, as it is // LordHavoc: this is probably no longer necessary, as it is
// checked at the end, but could still happen on weird particle // checked at the end, but could still happen on weird particle
// effects, left for safety... // effects, left for safety...
if (part->die <= cl.time) { if (part->die <= r_realtime) {
freeparticles[j++] = part; freeparticles[j++] = part;
continue; continue;
} }
@ -735,14 +735,14 @@ R_DrawParticles (void)
// LordHavoc: immediate removal of unnecessary particles (must // LordHavoc: immediate removal of unnecessary particles (must
// be done to ensure compactor below operates properly in all // be done to ensure compactor below operates properly in all
// cases) // cases)
if (part->die <= cl.time) if (part->die <= r_realtime)
freeparticles[j++] = part; freeparticles[j++] = part;
} }
k = 0; k = 0;
while (maxparticle >= activeparticles) { while (maxparticle >= activeparticles) {
*freeparticles[k++] = particles[maxparticle--]; *freeparticles[k++] = particles[maxparticle--];
while (maxparticle >= activeparticles && while (maxparticle >= activeparticles &&
particles[maxparticle].die <= cl.time) particles[maxparticle].die <= r_realtime)
maxparticle--; maxparticle--;
} }
numparticles = activeparticles; numparticles = activeparticles;

View file

@ -51,7 +51,7 @@ R_AnimateLight (void)
// light animations // light animations
// 'm' is normal light, 'a' is no light, 'z' is double bright // 'm' is normal light, 'a' is no light, 'z' is double bright
i = (int) (cl.time * 10); i = (int) (r_realtime * 10);
for (j = 0; j < MAX_LIGHTSTYLES; j++) { for (j = 0; j < MAX_LIGHTSTYLES; j++) {
if (!cl_lightstyle[j].length) { if (!cl_lightstyle[j].length) {
d_lightstylevalue[j] = 256; d_lightstylevalue[j] = 256;
@ -169,7 +169,7 @@ R_RenderDlights (void)
l = cl_dlights; l = cl_dlights;
for (i = 0; i < MAX_DLIGHTS; i++, l++) { for (i = 0; i < MAX_DLIGHTS; i++, l++) {
if (l->die < cl.time || !l->radius) if (l->die < r_realtime || !l->radius)
continue; continue;
R_RenderDlight (l); R_RenderDlight (l);
} }
@ -294,7 +294,7 @@ R_PushDlights (vec3_t entorigin)
l = cl_dlights; l = cl_dlights;
for (i = 0; i < MAX_DLIGHTS; i++, l++) { for (i = 0; i < MAX_DLIGHTS; i++, l++) {
if (l->die < cl.time || !l->radius) if (l->die < r_realtime || !l->radius)
continue; continue;
VectorSubtract (l->origin, entorigin, lightorigin); VectorSubtract (l->origin, entorigin, lightorigin);
R_MarkLights (lightorigin, l, 1 << i, cl.worldmodel->nodes); R_MarkLights (lightorigin, l, 1 << i, cl.worldmodel->nodes);

View file

@ -152,7 +152,7 @@ R_GetSpriteFrame (entity_t *currententity)
numframes = pspritegroup->numframes; numframes = pspritegroup->numframes;
fullinterval = pintervals[numframes - 1]; fullinterval = pintervals[numframes - 1];
time = cl.time + currententity->syncbase; time = r_realtime + currententity->syncbase;
// when loading in Mod_LoadSpriteGroup, we guaranteed all interval // when loading in Mod_LoadSpriteGroup, we guaranteed all interval
// values // values
@ -467,7 +467,7 @@ GL_DrawAliasBlendedShadow (aliashdr_t *paliashdr, int pose1, int pose2, entity_t
int *order, count; int *order, count;
float height, lheight, blend; float height, lheight, blend;
blend = (realtime - e->frame_start_time) / e->frame_interval; blend = (r_realtime - e->frame_start_time) / e->frame_interval;
blend = min (blend, 1); blend = min (blend, 1);
lerp = 1 - blend; lerp = 1 - blend;
@ -536,7 +536,7 @@ R_SetupAliasFrame (int frame, aliashdr_t *paliashdr, qboolean fb)
if (numposes > 1) { if (numposes > 1) {
interval = paliashdr->frames[frame].interval; interval = paliashdr->frames[frame].interval;
pose += (int) (cl.time / interval) % numposes; pose += (int) (r_realtime / interval) % numposes;
} }
GL_DrawAliasFrame (paliashdr, pose, fb); GL_DrawAliasFrame (paliashdr, pose, fb);
@ -559,7 +559,7 @@ R_SetupAliasBlendedFrame (int frame, aliashdr_t *paliashdr, entity_t *e, qboolea
if (numposes > 1) { if (numposes > 1) {
e->frame_interval = paliashdr->frames[frame].interval; e->frame_interval = paliashdr->frames[frame].interval;
pose += (int) (cl.time / e->frame_interval) % numposes; pose += (int) (r_realtime / e->frame_interval) % numposes;
} else { } else {
/* /*
One tenth of a second is good for most Quake animations. If the One tenth of a second is good for most Quake animations. If the
@ -573,7 +573,7 @@ R_SetupAliasBlendedFrame (int frame, aliashdr_t *paliashdr, entity_t *e, qboolea
} }
if (e->pose2 != pose) { if (e->pose2 != pose) {
e->frame_start_time = realtime; e->frame_start_time = r_realtime;
if (e->pose2 == -1) { if (e->pose2 == -1) {
e->pose1 = pose; e->pose1 = pose;
} else { } else {
@ -582,7 +582,7 @@ R_SetupAliasBlendedFrame (int frame, aliashdr_t *paliashdr, entity_t *e, qboolea
e->pose2 = pose; e->pose2 = pose;
blend = 0; blend = 0;
} else { } else {
blend = (realtime - e->frame_start_time) / e->frame_interval; blend = (r_realtime - e->frame_start_time) / e->frame_interval;
} }
// wierd things start happening if blend passes 1 // wierd things start happening if blend passes 1
@ -640,7 +640,7 @@ R_DrawAliasModel (entity_t *e)
shadelight = max (shadelight, 24); shadelight = max (shadelight, 24);
for (lnum = 0; lnum < MAX_DLIGHTS; lnum++) { for (lnum = 0; lnum < MAX_DLIGHTS; lnum++) {
if (cl_dlights[lnum].die >= cl.time) { if (cl_dlights[lnum].die >= r_realtime) {
VectorSubtract (currententity->origin, cl_dlights[lnum].origin, VectorSubtract (currententity->origin, cl_dlights[lnum].origin,
dist); dist);
add = (cl_dlights[lnum].radius * cl_dlights[lnum].radius * 8) / add = (cl_dlights[lnum].radius * cl_dlights[lnum].radius * 8) /
@ -697,7 +697,7 @@ R_DrawAliasModel (entity_t *e)
paliashdr->mdl.scale[2]); paliashdr->mdl.scale[2]);
} }
anim = (int) (cl.time * 10) & 3; anim = (int) (r_realtime * 10) & 3;
skinnum = currententity->skinnum; skinnum = currententity->skinnum;
if ((skinnum >= paliashdr->mdl.numskins) || (skinnum < 0)) { if ((skinnum >= paliashdr->mdl.numskins) || (skinnum < 0)) {
@ -804,7 +804,7 @@ R_ShowNearestLoc (void)
dl = CL_AllocDlight (4096); dl = CL_AllocDlight (4096);
VectorCopy (nearloc->loc, dl->origin); VectorCopy (nearloc->loc, dl->origin);
dl->radius = 200; dl->radius = 200;
dl->die = cl.time + 0.1; dl->die = r_realtime + 0.1;
dl->color[0] = 0; dl->color[0] = 0;
dl->color[1] = 1; dl->color[1] = 1;
dl->color[2] = 0; dl->color[2] = 0;

View file

@ -51,7 +51,6 @@
qboolean r_cache_thrash; qboolean r_cache_thrash;
extern double realtime;
int skytexturenum; int skytexturenum;
extern vec3_t shadecolor; // Ender (Extend) Colormod extern vec3_t shadecolor; // Ender (Extend) Colormod
@ -335,7 +334,7 @@ R_TextureAnimation (texture_t *base)
if (!base->anim_total) if (!base->anim_total)
return base; return base;
relative = (int) (cl.time * 10) % base->anim_total; relative = (int) (r_realtime * 10) % base->anim_total;
count = 0; count = 0;
while (base->anim_min > relative || base->anim_max <= relative) { while (base->anim_min > relative || base->anim_max <= relative) {
@ -723,7 +722,7 @@ R_DrawBrushModel (entity_t *e)
vec3_t lightorigin; vec3_t lightorigin;
for (k = 0; k < MAX_DLIGHTS; k++) { for (k = 0; k < MAX_DLIGHTS; k++) {
if ((cl_dlights[k].die < cl.time) || (!cl_dlights[k].radius)) if ((cl_dlights[k].die < r_realtime) || (!cl_dlights[k].radius))
continue; continue;
VectorSubtract (cl_dlights[k].origin, e->origin, lightorigin); VectorSubtract (cl_dlights[k].origin, e->origin, lightorigin);

View file

@ -166,7 +166,7 @@ SCR_CenterPrint (char *str)
{ {
strncpy (scr_centerstring, str, sizeof (scr_centerstring) - 1); strncpy (scr_centerstring, str, sizeof (scr_centerstring) - 1);
scr_centertime_off = scr_centertime->value; scr_centertime_off = scr_centertime->value;
scr_centertime_start = cl.time; scr_centertime_start = r_realtime;
// count the number of lines for centering // count the number of lines for centering
scr_center_lines = 1; scr_center_lines = 1;
@ -189,7 +189,7 @@ SCR_DrawCenterString (void)
// the finale prints the characters one at a time // the finale prints the characters one at a time
if (cl.intermission) if (cl.intermission)
remaining = scr_printspeed->value * (cl.time - scr_centertime_start); remaining = scr_printspeed->value * (r_realtime - scr_centertime_start);
else else
remaining = 9999; remaining = 9999;
@ -874,7 +874,7 @@ extern cvar_t *brightness;
needs almost the entire 256k of stack space! needs almost the entire 256k of stack space!
*/ */
void void
SCR_UpdateScreen (void) SCR_UpdateScreen (double realtime)
{ {
double time1 = 0, time2; double time1 = 0, time2;
float f; float f;
@ -882,13 +882,15 @@ SCR_UpdateScreen (void)
if (block_drawing) if (block_drawing)
return; return;
r_realtime = realtime;
vid.numpages = 2 + gl_triplebuffer->int_val; vid.numpages = 2 + gl_triplebuffer->int_val;
scr_copytop = 0; scr_copytop = 0;
scr_copyeverything = 0; scr_copyeverything = 0;
if (scr_disabled_for_loading) { if (scr_disabled_for_loading) {
if (realtime - scr_disabled_time > 60) { if (r_realtime - scr_disabled_time > 60) {
scr_disabled_for_loading = false; scr_disabled_for_loading = false;
Con_Printf ("load failed.\n"); Con_Printf ("load failed.\n");
} else { } else {

View file

@ -32,11 +32,11 @@
#include "QF/compat.h" #include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/render.h"
#include "QF/skin.h" #include "QF/skin.h"
#include "QF/texture.h" #include "QF/texture.h"
#include "glquake.h" #include "glquake.h"
#include "QF/render.h"
static byte translate[256]; static byte translate[256];
static unsigned int translate32[256]; static unsigned int translate32[256];

View file

@ -39,14 +39,14 @@
#include "QF/compat.h" #include "QF/compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/quakefs.h" #include "QF/quakefs.h"
#include "QF/render.h"
#include "QF/tga.h" #include "QF/tga.h"
#include "QF/vid.h" #include "QF/vid.h"
#include "glquake.h" #include "glquake.h"
#include "QF/render.h" #include "r_shared.h"
#include "view.h" #include "view.h"
extern double realtime;
extern model_t *loadmodel; extern model_t *loadmodel;
extern int skytexturenum; extern int skytexturenum;
@ -240,7 +240,7 @@ R_DrawSkyDome (void)
domescale[0] = 512; domescale[0] = 512;
domescale[1] = 512; domescale[1] = 512;
domescale[2] = 128; domescale[2] = 128;
speedscale = realtime * 8; speedscale = r_realtime * 8;
speedscale -= (int) speedscale & ~127; speedscale -= (int) speedscale & ~127;
R_DrawSkyLayer (speedscale); R_DrawSkyLayer (speedscale);
glEnable (GL_BLEND); glEnable (GL_BLEND);
@ -251,7 +251,7 @@ R_DrawSkyDome (void)
domescale[0] = 512; domescale[0] = 512;
domescale[1] = 512; domescale[1] = 512;
domescale[2] = 128; domescale[2] = 128;
speedscale = realtime * 16; speedscale = r_realtime * 16;
speedscale -= (int) speedscale & ~127; speedscale -= (int) speedscale & ~127;
R_DrawSkyLayer (speedscale); R_DrawSkyLayer (speedscale);
} }

View file

@ -39,6 +39,7 @@
#include <stdarg.h> #include <stdarg.h>
#include "QF/console.h" #include "QF/console.h"
#include "QF/render.h"
#include "QF/sys.h" #include "QF/sys.h"
#include "client.h" #include "client.h"

View file

@ -34,8 +34,8 @@
#include "QF/sys.h" #include "QF/sys.h"
#include "glquake.h" #include "glquake.h"
#include "r_shared.h"
extern double realtime;
extern model_t *loadmodel; extern model_t *loadmodel;
extern qboolean lighthalf; extern qboolean lighthalf;
@ -212,18 +212,18 @@ EmitWaterPolys (msurface_t *fa)
os = v[3]; os = v[3];
ot = v[4]; ot = v[4];
s = os + turbsin[(int) ((ot * 0.125 + realtime) * TURBSCALE) & 255]; s = os + turbsin[(int) ((ot * 0.125 + r_realtime) * TURBSCALE) & 255];
s *= (1.0 / 64); s *= (1.0 / 64);
t = ot + turbsin[(int) ((os * 0.125 + realtime) * TURBSCALE) & 255]; t = ot + turbsin[(int) ((os * 0.125 + r_realtime) * TURBSCALE) & 255];
t *= (1.0 / 64); t *= (1.0 / 64);
glTexCoord2f (s, t); glTexCoord2f (s, t);
VectorCopy (v, nv); VectorCopy (v, nv);
nv[2] += r_waterripple->value nv[2] += r_waterripple->value
* turbsin[(int) ((v[3] * 0.125 + realtime) * TURBSCALE) & 255] * turbsin[(int) ((v[3] * 0.125 + r_realtime) * TURBSCALE) & 255]
* turbsin[(int) ((v[4] * 0.125 + realtime) * TURBSCALE) & 255] * turbsin[(int) ((v[4] * 0.125 + r_realtime) * TURBSCALE) & 255]
* (1.0 / 64.0); * (1.0 / 64.0);
glVertex3fv (nv); glVertex3fv (nv);

View file

@ -300,7 +300,7 @@ Key_Console (int key)
key_lines[edit_line][1] = 0; key_lines[edit_line][1] = 0;
key_linepos = 1; key_linepos = 1;
if (cls.state == ca_disconnected) if (cls.state == ca_disconnected)
SCR_UpdateScreen (); // force an update, because the SCR_UpdateScreen (realtime); // force an update, because the
// command may take some time // command may take some time
return; return;

1
qw/source/r_main.c Normal file
View file

@ -0,0 +1 @@
double r_realtime;

View file

@ -872,7 +872,7 @@ SCR_DrawNotifyString (void)
needs almost the entire 256k of stack space! needs almost the entire 256k of stack space!
*/ */
void void
SCR_UpdateScreen (void) SCR_UpdateScreen (double realtime)
{ {
static int oldscr_viewsize; static int oldscr_viewsize;
vrect_t vrect; vrect_t vrect;
@ -892,6 +892,8 @@ SCR_UpdateScreen (void)
} }
#endif #endif
r_realtime = realtime;
scr_copytop = 0; scr_copytop = 0;
scr_copyeverything = 0; scr_copyeverything = 0;
@ -1016,8 +1018,8 @@ SCR_UpdateScreen (void)
void void
SCR_UpdateWholeScreen (void) SCR_UpdateWholeScreen (double realtime)
{ {
scr_fullupdate = 0; scr_fullupdate = 0;
SCR_UpdateScreen (); SCR_UpdateScreen (realtime);
} }

View file

@ -539,7 +539,7 @@ R_AliasSetupSkin (void)
numskins = paliasskingroup->numskins; numskins = paliasskingroup->numskins;
fullskininterval = pskinintervals[numskins - 1]; fullskininterval = pskinintervals[numskins - 1];
skintime = cl.time + currententity->syncbase; skintime = r_realtime + currententity->syncbase;
// when loading in Mod_LoadAliasSkinGroup, we guaranteed all interval // when loading in Mod_LoadAliasSkinGroup, we guaranteed all interval
// values are positive, so we don't have to worry about division by 0 // values are positive, so we don't have to worry about division by 0
@ -635,7 +635,7 @@ R_AliasSetupFrame (void)
numframes = paliasgroup->numframes; numframes = paliasgroup->numframes;
fullinterval = pintervals[numframes - 1]; fullinterval = pintervals[numframes - 1];
time = cl.time + currententity->syncbase; time = r_realtime + currententity->syncbase;
// when loading in Mod_LoadAliasGroup, we guaranteed all interval values // when loading in Mod_LoadAliasGroup, we guaranteed all interval values
// are positive, so we don't have to worry about division by 0 // are positive, so we don't have to worry about division by 0

View file

@ -43,7 +43,7 @@ R_AnimateLight (void)
// light animations // light animations
// 'm' is normal light, 'a' is no light, 'z' is double bright // 'm' is normal light, 'a' is no light, 'z' is double bright
i = (int) (cl.time * 10); i = (int) (r_realtime * 10);
for (j = 0; j < MAX_LIGHTSTYLES; j++) { for (j = 0; j < MAX_LIGHTSTYLES; j++) {
if (!cl_lightstyle[j].length) { if (!cl_lightstyle[j].length) {
d_lightstylevalue[j] = 256; d_lightstylevalue[j] = 256;
@ -111,7 +111,7 @@ R_PushDlights (vec3_t entorigin)
l = cl_dlights; l = cl_dlights;
for (i = 0; i < MAX_DLIGHTS; i++, l++) { for (i = 0; i < MAX_DLIGHTS; i++, l++) {
if (l->die < cl.time || !l->radius) if (l->die < r_realtime || !l->radius)
continue; continue;
VectorSubtract (l->origin, entorigin, lightorigin); VectorSubtract (l->origin, entorigin, lightorigin);
R_MarkLights (lightorigin, l, 1 << i, cl.worldmodel->nodes); R_MarkLights (lightorigin, l, 1 << i, cl.worldmodel->nodes);

View file

@ -469,7 +469,7 @@ R_ShowNearestLoc (void)
dl = CL_AllocDlight (4096); dl = CL_AllocDlight (4096);
VectorCopy (nearloc->loc, dl->origin); VectorCopy (nearloc->loc, dl->origin);
dl->radius = 200; dl->radius = 200;
dl->die = cl.time + 0.1; dl->die = r_realtime + 0.1;
dl->color[1]=1; dl->color[1]=1;
VectorCopy(nearloc->loc,trueloc); VectorCopy(nearloc->loc,trueloc);
@ -520,7 +520,7 @@ R_DrawEntitiesOnList (void)
lighting.plightvec = lightvec; lighting.plightvec = lightvec;
for (lnum = 0; lnum < MAX_DLIGHTS; lnum++) { for (lnum = 0; lnum < MAX_DLIGHTS; lnum++) {
if (cl_dlights[lnum].die >= cl.time) { if (cl_dlights[lnum].die >= r_realtime) {
VectorSubtract (currententity->origin, VectorSubtract (currententity->origin,
cl_dlights[lnum].origin, dist); cl_dlights[lnum].origin, dist);
add = cl_dlights[lnum].radius - Length (dist); add = cl_dlights[lnum].radius - Length (dist);
@ -594,7 +594,7 @@ R_DrawViewModel (void)
continue; continue;
if (!dl->radius) if (!dl->radius)
continue; continue;
if (dl->die < cl.time) if (dl->die < r_realtime)
continue; continue;
VectorSubtract (currententity->origin, dl->origin, dist); VectorSubtract (currententity->origin, dl->origin, dist);
@ -720,7 +720,7 @@ R_DrawBEntitiesOnList (void)
vec3_t lightorigin; vec3_t lightorigin;
for (k = 0; k < MAX_DLIGHTS; k++) { for (k = 0; k < MAX_DLIGHTS; k++) {
if ((cl_dlights[k].die < cl.time) || if ((cl_dlights[k].die < r_realtime) ||
(!cl_dlights[k].radius)) continue; (!cl_dlights[k].radius)) continue;
VectorSubtract (cl_dlights[k].origin, VectorSubtract (cl_dlights[k].origin,

View file

@ -211,7 +211,7 @@ R_ParticleExplosion (vec3_t org)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->die = cl.time + 5; p->die = r_realtime + 5;
p->color = ramp1[0]; p->color = ramp1[0];
p->ramp = rand () & 3; p->ramp = rand () & 3;
if (i & 1) { if (i & 1) {
@ -247,7 +247,7 @@ R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->die = cl.time + 0.3; p->die = r_realtime + 0.3;
p->color = colorStart + (colorMod % colorLength); p->color = colorStart + (colorMod % colorLength);
colorMod++; colorMod++;
@ -278,7 +278,7 @@ R_BlobExplosion (vec3_t org)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->die = cl.time + 1 + (rand () & 8) * 0.05; p->die = r_realtime + 1 + (rand () & 8) * 0.05;
if (i & 1) { if (i & 1) {
p->type = pt_blob; p->type = pt_blob;
@ -324,7 +324,7 @@ R_RunParticleEffect (vec3_t org, int color, int count)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->die = cl.time + 0.1 * (rand () % 5); p->die = r_realtime + 0.1 * (rand () % 5);
p->color = (color & ~7) + (rand () & 7); p->color = (color & ~7) + (rand () & 7);
p->type = pt_grav; p->type = pt_grav;
for (j = 0; j < 3; j++) { for (j = 0; j < 3; j++) {
@ -356,7 +356,7 @@ R_LavaSplash (vec3_t org)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->die = cl.time + 2 + (rand () & 31) * 0.02; p->die = r_realtime + 2 + (rand () & 31) * 0.02;
p->color = 224 + (rand () & 7); p->color = 224 + (rand () & 7);
p->type = pt_grav; p->type = pt_grav;
@ -396,7 +396,7 @@ R_TeleportSplash (vec3_t org)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->die = cl.time + 0.2 + (rand () & 7) * 0.02; p->die = r_realtime + 0.2 + (rand () & 7) * 0.02;
p->color = 7 + (rand () & 7); p->color = 7 + (rand () & 7);
p->type = pt_grav; p->type = pt_grav;
@ -439,7 +439,7 @@ R_RocketTrail (int type, entity_t *ent)
active_particles = p; active_particles = p;
VectorCopy (vec3_origin, p->vel); VectorCopy (vec3_origin, p->vel);
p->die = cl.time + 2; p->die = r_realtime + 2;
if (type == 4) { // slight blood if (type == 4) { // slight blood
p->type = pt_slowgrav; p->type = pt_slowgrav;
@ -455,7 +455,7 @@ R_RocketTrail (int type, entity_t *ent)
} else if (type == 6) { // voor trail } else if (type == 6) { // voor trail
p->color = 9 * 16 + 8 + (rand () & 3); p->color = 9 * 16 + 8 + (rand () & 3);
p->type = pt_static; p->type = pt_static;
p->die = cl.time + 0.3; p->die = r_realtime + 0.3;
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
p->org[j] = ent->old_origin[j] + ((rand () & 15) - 8); p->org[j] = ent->old_origin[j] + ((rand () & 15) - 8);
} else if (type == 1) { // smoke smoke } else if (type == 1) { // smoke smoke
@ -473,7 +473,7 @@ R_RocketTrail (int type, entity_t *ent)
} else if (type == 3 || type == 5) { // tracer } else if (type == 3 || type == 5) { // tracer
static int tracercount; static int tracercount;
p->die = cl.time + 0.5; p->die = r_realtime + 0.5;
p->type = pt_static; p->type = pt_static;
if (type == 3) if (type == 3)
p->color = 52 + ((tracercount & 4) << 1); p->color = 52 + ((tracercount & 4) << 1);
@ -523,7 +523,7 @@ R_DrawParticles (void)
dvel = 4 * frametime; dvel = 4 * frametime;
for (particle = &active_particles; *particle;) { for (particle = &active_particles; *particle;) {
if ((*particle)->die < cl.time) { if ((*particle)->die < r_realtime) {
p = (*particle)->next; p = (*particle)->next;
(*particle)->next = free_particles; (*particle)->next = free_particles;
free_particles = (*particle); free_particles = (*particle);

View file

@ -30,7 +30,6 @@
# include "config.h" # include "config.h"
#endif #endif
#include "client.h"
#include "r_local.h" #include "r_local.h"
@ -241,7 +240,7 @@ R_SetSkyFrame (void)
s2 = iskyspeed2 / g; s2 = iskyspeed2 / g;
temp = SKYSIZE * s1 * s2; temp = SKYSIZE * s1 * s2;
skytime = cl.time - ((int) (cl.time / temp) * temp); skytime = r_realtime - ((int) (r_realtime / temp) * temp);
r_skymade = 0; r_skymade = 0;
} }

View file

@ -39,9 +39,9 @@
#include <math.h> #include <math.h>
#include "QF/console.h" #include "QF/console.h"
#include "QF/render.h"
#include "QF/sys.h" #include "QF/sys.h"
#include "client.h"
#include "r_local.h" #include "r_local.h"
static int clip_current; static int clip_current;
@ -256,7 +256,7 @@ R_GetSpriteframe (msprite_t *psprite)
numframes = pspritegroup->numframes; numframes = pspritegroup->numframes;
fullinterval = pintervals[numframes - 1]; fullinterval = pintervals[numframes - 1];
time = cl.time + currententity->syncbase; time = r_realtime + currententity->syncbase;
// when loading in Mod_LoadSpriteGroup, we guaranteed all interval // when loading in Mod_LoadSpriteGroup, we guaranteed all interval
// values are positive, so we don't have to worry about division by 0 // values are positive, so we don't have to worry about division by 0

View file

@ -199,7 +199,7 @@ R_TextureAnimation (texture_t *base)
if (!base->anim_total) if (!base->anim_total)
return base; return base;
reletive = (int) (cl.time * 10) % base->anim_total; reletive = (int) (r_realtime * 10) % base->anim_total;
count = 0; count = 0;
while (base->anim_min > reletive || base->anim_max <= reletive) { while (base->anim_min > reletive || base->anim_max <= reletive) {
@ -525,7 +525,7 @@ R_GenTurbTile (pixel_t *pbasetex, void *pdest)
int i, j, s, t; int i, j, s, t;
byte *pd; byte *pd;
turb = sintable + ((int) (cl.time * SPEED) & (CYCLE - 1)); turb = sintable + ((int) (r_realtime * SPEED) & (CYCLE - 1));
pd = (byte *) pdest; pd = (byte *) pdest;
for (i = 0; i < TILE_SIZE; i++) { for (i = 0; i < TILE_SIZE; i++) {
@ -545,7 +545,7 @@ R_GenTurbTile16 (pixel_t *pbasetex, void *pdest)
int i, j, s, t; int i, j, s, t;
unsigned short *pd; unsigned short *pd;
turb = sintable + ((int) (cl.time * SPEED) & (CYCLE - 1)); turb = sintable + ((int) (r_realtime * SPEED) & (CYCLE - 1));
pd = (unsigned short *) pdest; pd = (unsigned short *) pdest;
for (i = 0; i < TILE_SIZE; i++) { for (i = 0; i < TILE_SIZE; i++) {