diff --git a/include/QF/screen.h b/include/QF/screen.h index b55c74dff..b031009f9 100644 --- a/include/QF/screen.h +++ b/include/QF/screen.h @@ -36,7 +36,7 @@ void SCR_Init_Cvars (void); void SCR_Init (void); -void SCR_UpdateScreen (void); +void SCR_UpdateScreen (double realtime); void SCR_UpdateWholeScreen (void); void SCR_SizeUp (void); diff --git a/include/r_shared.h b/include/r_shared.h index d2da772a8..92ef73d6a 100644 --- a/include/r_shared.h +++ b/include/r_shared.h @@ -138,6 +138,8 @@ extern void R_MakeSky (void); extern int ubasestep, errorterm, erroradjustup, erroradjustdown; +extern double r_realtime; + // flags in finalvert_t.flags #define ALIAS_LEFT_CLIP 0x0001 #define ALIAS_TOP_CLIP 0x0002 diff --git a/nq/source/Makefile.am b/nq/source/Makefile.am index 2e6b65521..4c4f3d077 100644 --- a/nq/source/Makefile.am +++ b/nq/source/Makefile.am @@ -73,7 +73,7 @@ client_LIBS= -L. -lqfnet $(qf_client_LIBS) $(NET_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 \ - 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 server_SOURCES= host.c host_cmd.c pr_cmds.c sv_cvar.c sv_main.c \ diff --git a/nq/source/gl_dyn_fires.c b/nq/source/gl_dyn_fires.c index 202a52bd7..4b0f3b5ee 100644 --- a/nq/source/gl_dyn_fires.c +++ b/nq/source/gl_dyn_fires.c @@ -40,9 +40,10 @@ #include "QF/cmd.h" #include "QF/console.h" +#include "QF/render.h" -#include "client.h" #include "glquake.h" +#include "r_shared.h" #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 (start, f->owner); f->size = 10; - f->die = cl.time + 0.5; + f->die = r_realtime + 0.5; f->decay = 1; VectorCopy (r_firecolor->vec, f->color); } @@ -109,7 +110,7 @@ R_AllocFire (int key) f = r_fires; // no match, look for a free spot for (i = 0; i < MAX_FIRES; i++, f++) { - if (f->die < cl.time) { + if (f->die < r_realtime) { memset (f, 0, sizeof (*f)); f->key = key; return f; @@ -197,7 +198,7 @@ R_UpdateFires (void) f = r_fires; for (i = 0; i < MAX_FIRES; i++, f++) { - if (f->die < cl.time || !f->size) + if (f->die < r_realtime || !f->size) continue; f->size += f->decay; R_DrawFire (f); diff --git a/nq/source/gl_dyn_part.c b/nq/source/gl_dyn_part.c index ae53efeb3..e54f02c09 100644 --- a/nq/source/gl_dyn_part.c +++ b/nq/source/gl_dyn_part.c @@ -176,7 +176,7 @@ R_ReadPointFile_f (void) int c; char name[MAX_OSPATH], *mapname, *t1; - mapname = strdup (cl.worldmodel->name); + mapname = strdup (r_worldentity.model->name); if (!mapname) Sys_Error ("Can't duplicate mapname!"); t1 = strrchr (mapname, '.'); @@ -223,7 +223,7 @@ R_ParticleExplosion (vec3_t org) return; 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)); } @@ -238,7 +238,7 @@ R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength) return; 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++; } } @@ -254,12 +254,12 @@ R_BlobExplosion (vec3_t org) for (i = 0; i < 512; i++) { 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); } for (i = 0; i < 512; i++) { 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); } } @@ -272,11 +272,11 @@ R_RunSparkEffect (vec3_t org, int count, int ofuzz) return; 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); while (count--) 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)); } @@ -306,7 +306,7 @@ R_BloodPuff (vec3_t org, int count) return; 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); } @@ -352,7 +352,7 @@ R_RunParticleEffect (vec3_t org, int color, int count) porg[j] = org[j] + scale * ((rand () & 15) - 8); } 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); } } @@ -402,7 +402,7 @@ R_LavaSplash (vec3_t org) vel = 50 + (rand () & 63); VectorScale (dir, vel, 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); } } @@ -434,7 +434,7 @@ R_TeleportSplash (vec3_t org) vel = 50 + (rand () & 63); VectorScale (dir, vel, 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); } } @@ -463,7 +463,7 @@ R_RocketTrail (int type, entity_t *ent) VectorCopy (vec3_origin, up); VectorCopy (vec3_origin, right); VectorCopy (vec3_origin, pvel); - pdie = cl.time + 2; + pdie = r_realtime + 2; ptype = pt_static; ptex = part_tex_dot; palpha = 255; @@ -473,7 +473,7 @@ R_RocketTrail (int type, entity_t *ent) switch (type) { case 0: // rocket trail - pdie = cl.time + 60; + pdie = r_realtime + 60; // ptype = pt_smokering; // Mercury's Rings ptype = pt_smoke; pscale = lhrandom (6, 8); @@ -512,7 +512,7 @@ R_RocketTrail (int type, entity_t *ent) pcolor = 9 * 16 + 8 + (rand () & 3); ptype = pt_static; pscale = lhrandom (.75, 1.5); - pdie = cl.time + 0.3; + pdie = r_realtime + 0.3; for (j = 0; j < 3; j++) porg[j] = ent->old_origin[j] + lhrandom (-8, 8); break; @@ -522,7 +522,7 @@ R_RocketTrail (int type, entity_t *ent) static int tracercount; dist = 3; - pdie = cl.time + 0.5; + pdie = r_realtime + 0.5; ptype = pt_static; pscale = lhrandom (1.5, 3); if (type == 3) @@ -592,7 +592,7 @@ R_DrawParticles (void) // LordHavoc: this is probably no longer necessary, as it is // checked at the end, but could still happen on weird particle // effects, left for safety... - if (part->die <= cl.time) { + if (part->die <= r_realtime) { freeparticles[j++] = part; continue; } @@ -735,14 +735,14 @@ R_DrawParticles (void) // LordHavoc: immediate removal of unnecessary particles (must // be done to ensure compactor below operates properly in all // cases) - if (part->die <= cl.time) + if (part->die <= r_realtime) freeparticles[j++] = part; } k = 0; while (maxparticle >= activeparticles) { *freeparticles[k++] = particles[maxparticle--]; while (maxparticle >= activeparticles && - particles[maxparticle].die <= cl.time) + particles[maxparticle].die <= r_realtime) maxparticle--; } numparticles = activeparticles; diff --git a/nq/source/gl_rlight.c b/nq/source/gl_rlight.c index c1b9d4c85..ddb861536 100644 --- a/nq/source/gl_rlight.c +++ b/nq/source/gl_rlight.c @@ -51,7 +51,7 @@ R_AnimateLight (void) // light animations // '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++) { if (!cl_lightstyle[j].length) { d_lightstylevalue[j] = 256; @@ -169,7 +169,7 @@ R_RenderDlights (void) l = cl_dlights; for (i = 0; i < MAX_DLIGHTS; i++, l++) { - if (l->die < cl.time || !l->radius) + if (l->die < r_realtime || !l->radius) continue; R_RenderDlight (l); } @@ -294,7 +294,7 @@ R_PushDlights (vec3_t entorigin) l = cl_dlights; for (i = 0; i < MAX_DLIGHTS; i++, l++) { - if (l->die < cl.time || !l->radius) + if (l->die < r_realtime || !l->radius) continue; VectorSubtract (l->origin, entorigin, lightorigin); R_MarkLights (lightorigin, l, 1 << i, cl.worldmodel->nodes); diff --git a/nq/source/gl_rmain.c b/nq/source/gl_rmain.c index d6c425a4b..79e28c7da 100644 --- a/nq/source/gl_rmain.c +++ b/nq/source/gl_rmain.c @@ -151,7 +151,7 @@ R_GetSpriteFrame (entity_t *currententity) numframes = pspritegroup->numframes; fullinterval = pintervals[numframes - 1]; - time = cl.time + currententity->syncbase; + time = r_realtime + currententity->syncbase; // when loading in Mod_LoadSpriteGroup, we guaranteed all interval // values @@ -466,7 +466,7 @@ GL_DrawAliasBlendedShadow (aliashdr_t *paliashdr, int pose1, int pose2, entity_t int *order, count; 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); lerp = 1 - blend; @@ -535,7 +535,7 @@ R_SetupAliasFrame (int frame, aliashdr_t *paliashdr, qboolean fb) if (numposes > 1) { interval = paliashdr->frames[frame].interval; - pose += (int) (cl.time / interval) % numposes; + pose += (int) (r_realtime / interval) % numposes; } GL_DrawAliasFrame (paliashdr, pose, fb); @@ -558,7 +558,7 @@ R_SetupAliasBlendedFrame (int frame, aliashdr_t *paliashdr, entity_t *e, qboolea if (numposes > 1) { e->frame_interval = paliashdr->frames[frame].interval; - pose += (int) (cl.time / e->frame_interval) % numposes; + pose += (int) (r_realtime / e->frame_interval) % numposes; } else { /* 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) { - e->frame_start_time = cl.time; + e->frame_start_time = r_realtime; if (e->pose2 == -1) { e->pose1 = pose; } else { @@ -581,7 +581,7 @@ R_SetupAliasBlendedFrame (int frame, aliashdr_t *paliashdr, entity_t *e, qboolea e->pose2 = pose; blend = 0; } 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 @@ -639,7 +639,7 @@ R_DrawAliasModel (entity_t *e) shadelight = max (shadelight, 24); 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, dist); add = (cl_dlights[lnum].radius * cl_dlights[lnum].radius * 8) / @@ -696,7 +696,7 @@ R_DrawAliasModel (entity_t *e) paliashdr->mdl.scale[2]); } - anim = (int) (cl.time * 10) & 3; + anim = (int) (r_realtime * 10) & 3; skinnum = currententity->skinnum; if ((skinnum >= paliashdr->mdl.numskins) || (skinnum < 0)) { @@ -790,7 +790,7 @@ R_ShowNearestLoc (void) dl = CL_AllocDlight (4096); VectorCopy (nearloc->loc, dl->origin); dl->radius = 200; - dl->die = cl.time + 0.1; + dl->die = r_realtime + 0.1; dl->color[0] = 0; dl->color[1] = 1; dl->color[2] = 0; @@ -1118,7 +1118,6 @@ R_Mirror (void) R_RenderScene (); R_DrawWaterSurfaces (); - gldepthmin = 0; gldepthmax = 1;//XXX 0.5; glDepthRange (gldepthmin, gldepthmax); diff --git a/nq/source/gl_rsurf.c b/nq/source/gl_rsurf.c index a0ed9c1d5..d395d40e4 100644 --- a/nq/source/gl_rsurf.c +++ b/nq/source/gl_rsurf.c @@ -51,7 +51,6 @@ qboolean r_cache_thrash; -extern double realtime; int skytexturenum; extern vec3_t shadecolor; // Ender (Extend) Colormod @@ -335,7 +334,7 @@ R_TextureAnimation (texture_t *base) if (!base->anim_total) return base; - relative = (int) (cl.time * 10) % base->anim_total; + relative = (int) (r_realtime * 10) % base->anim_total; count = 0; while (base->anim_min > relative || base->anim_max <= relative) { @@ -723,7 +722,7 @@ R_DrawBrushModel (entity_t *e) vec3_t lightorigin; 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; VectorSubtract (cl_dlights[k].origin, e->origin, lightorigin); diff --git a/nq/source/gl_screen.c b/nq/source/gl_screen.c index 3811929b1..cefc493b0 100644 --- a/nq/source/gl_screen.c +++ b/nq/source/gl_screen.c @@ -165,7 +165,7 @@ SCR_CenterPrint (char *str) { strncpy (scr_centerstring, str, sizeof (scr_centerstring) - 1); scr_centertime_off = scr_centertime->value; - scr_centertime_start = cl.time; + scr_centertime_start = r_realtime; // count the number of lines for centering scr_center_lines = 1; @@ -188,7 +188,7 @@ SCR_DrawCenterString (void) // the finale prints the characters one at a time if (cl.intermission) - remaining = scr_printspeed->value * (cl.time - scr_centertime_start); + remaining = scr_printspeed->value * (r_realtime - scr_centertime_start); else remaining = 9999; @@ -424,7 +424,7 @@ SCR_DrawNet (void) { // if (cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged < // UPDATE_BACKUP - 1) - if (realtime - cl.last_received_message < 0.3) + if (r_realtime - cl.last_received_message < 0.3) return; if (cls.demoplayback) return; @@ -876,7 +876,7 @@ extern cvar_t *brightness; needs almost the entire 256k of stack space! */ void -SCR_UpdateScreen (void) +SCR_UpdateScreen (double realtime) { double time1 = 0, time2; float f; @@ -884,13 +884,15 @@ SCR_UpdateScreen (void) if (block_drawing) return; + r_realtime = realtime; + vid.numpages = 2 + gl_triplebuffer->int_val; scr_copytop = 0; scr_copyeverything = 0; if (scr_disabled_for_loading) { - if (realtime - scr_disabled_time > 60) { + if (r_realtime - scr_disabled_time > 60) { scr_disabled_for_loading = false; Con_Printf ("load failed.\n"); } else { diff --git a/nq/source/gl_skin.c b/nq/source/gl_skin.c index 337138959..6818b679b 100644 --- a/nq/source/gl_skin.c +++ b/nq/source/gl_skin.c @@ -32,11 +32,11 @@ #include "QF/compat.h" #include "QF/console.h" +#include "QF/render.h" #include "QF/skin.h" #include "QF/texture.h" #include "glquake.h" -#include "QF/render.h" static byte translate[256]; static unsigned int translate32[256]; diff --git a/nq/source/gl_sky.c b/nq/source/gl_sky.c index 2ccfd6412..e15764726 100644 --- a/nq/source/gl_sky.c +++ b/nq/source/gl_sky.c @@ -39,14 +39,14 @@ #include "QF/compat.h" #include "QF/console.h" #include "QF/quakefs.h" +#include "QF/render.h" #include "QF/tga.h" #include "QF/vid.h" #include "glquake.h" -#include "QF/render.h" +#include "r_shared.h" #include "view.h" -extern double realtime; extern model_t *loadmodel; extern int skytexturenum; @@ -240,7 +240,7 @@ R_DrawSkyDome (void) domescale[0] = 512; domescale[1] = 512; domescale[2] = 128; - speedscale = realtime * 8; + speedscale = r_realtime * 8; speedscale -= (int) speedscale & ~127; R_DrawSkyLayer (speedscale); glEnable (GL_BLEND); @@ -251,7 +251,7 @@ R_DrawSkyDome (void) domescale[0] = 512; domescale[1] = 512; domescale[2] = 128; - speedscale = realtime * 16; + speedscale = r_realtime * 16; speedscale -= (int) speedscale & ~127; R_DrawSkyLayer (speedscale); } diff --git a/nq/source/gl_sky_clip.c b/nq/source/gl_sky_clip.c index 1bbc9693a..fc80bc118 100644 --- a/nq/source/gl_sky_clip.c +++ b/nq/source/gl_sky_clip.c @@ -39,6 +39,7 @@ #include #include "QF/console.h" +#include "QF/render.h" #include "QF/sys.h" #include "client.h" diff --git a/nq/source/gl_warp.c b/nq/source/gl_warp.c index c2ecd3180..f7ba77b88 100644 --- a/nq/source/gl_warp.c +++ b/nq/source/gl_warp.c @@ -34,8 +34,8 @@ #include "QF/sys.h" #include "glquake.h" +#include "r_shared.h" -extern double realtime; extern model_t *loadmodel; extern qboolean lighthalf; @@ -212,18 +212,18 @@ EmitWaterPolys (msurface_t *fa) os = v[3]; 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); - 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); glTexCoord2f (s, t); VectorCopy (v, nv); nv[2] += r_waterripple->value - * turbsin[(int) ((v[3] * 0.125 + realtime) * TURBSCALE) & 255] - * turbsin[(int) ((v[4] * 0.125 + realtime) * TURBSCALE) & 255] + * turbsin[(int) ((v[3] * 0.125 + r_realtime) * TURBSCALE) & 255] + * turbsin[(int) ((v[4] * 0.125 + r_realtime) * TURBSCALE) & 255] * (1.0 / 64.0); glVertex3fv (nv); diff --git a/nq/source/host.c b/nq/source/host.c index 332e8aabd..231d7411a 100644 --- a/nq/source/host.c +++ b/nq/source/host.c @@ -705,7 +705,7 @@ _Host_Frame (float time) if (host_speeds->int_val) time1 = Sys_DoubleTime (); - SCR_UpdateScreen (); + SCR_UpdateScreen (realtime); if (host_speeds->int_val) time2 = Sys_DoubleTime (); @@ -1001,7 +1001,7 @@ Host_Init (quakeparms_t *parms) Sys_Printf ("========Quake Initialized=========\n"); - SCR_UpdateScreen (); + SCR_UpdateScreen (realtime); } diff --git a/nq/source/keys.c b/nq/source/keys.c index 70befd4f1..c4d4c8813 100644 --- a/nq/source/keys.c +++ b/nq/source/keys.c @@ -300,7 +300,7 @@ Key_Console (int key) key_lines[edit_line][1] = 0; key_linepos = 1; 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 return; diff --git a/nq/source/net_dgrm.c b/nq/source/net_dgrm.c index ea4f246f1..c82ffda3c 100644 --- a/nq/source/net_dgrm.c +++ b/nq/source/net_dgrm.c @@ -1297,7 +1297,7 @@ _Datagram_Connect (char *host) // send the connection request Con_Printf ("trying...\n"); - SCR_UpdateScreen (); + SCR_UpdateScreen (realtime); start_time = net_time; for (reps = 0; reps < 3; reps++) { @@ -1325,7 +1325,7 @@ _Datagram_Connect (char *host) Con_Printf ("wrong reply address\n"); Con_Printf ("Expected: %s\n", StrAddr (&sendaddr)); Con_Printf ("Received: %s\n", StrAddr (&readaddr)); - SCR_UpdateScreen (); + SCR_UpdateScreen (realtime); #endif ret = 0; continue; @@ -1359,7 +1359,7 @@ _Datagram_Connect (char *host) if (ret) break; Con_Printf ("still trying...\n"); - SCR_UpdateScreen (); + SCR_UpdateScreen (realtime); start_time = SetNetTime (); } diff --git a/nq/source/r_main.c b/nq/source/r_main.c new file mode 100644 index 000000000..276766c57 --- /dev/null +++ b/nq/source/r_main.c @@ -0,0 +1 @@ +double r_realtime; diff --git a/nq/source/screen.c b/nq/source/screen.c index b405d1404..8e53a8c1f 100644 --- a/nq/source/screen.c +++ b/nq/source/screen.c @@ -448,7 +448,7 @@ SCR_DrawNet (void) { // if (cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged < // UPDATE_BACKUP - 1) - if (realtime - cl.last_received_message < 0.3) + if (r_realtime - cl.last_received_message < 0.3) return; if (cls.demoplayback) return; @@ -873,7 +873,7 @@ SCR_DrawNotifyString (void) needs almost the entire 256k of stack space! */ void -SCR_UpdateScreen (void) +SCR_UpdateScreen (double realtime) { static int oldscr_viewsize; vrect_t vrect; @@ -893,6 +893,8 @@ SCR_UpdateScreen (void) } #endif + r_realtime = realtime; + scr_copytop = 0; scr_copyeverything = 0; @@ -1017,8 +1019,8 @@ SCR_UpdateScreen (void) void -SCR_UpdateWholeScreen (void) +SCR_UpdateWholeScreen (double realtime) { scr_fullupdate = 0; - SCR_UpdateScreen (); + SCR_UpdateScreen (realtime); } diff --git a/nq/source/sw_ralias.c b/nq/source/sw_ralias.c index ca2b66e8a..831bdc21c 100644 --- a/nq/source/sw_ralias.c +++ b/nq/source/sw_ralias.c @@ -539,7 +539,7 @@ R_AliasSetupSkin (void) numskins = paliasskingroup->numskins; fullskininterval = pskinintervals[numskins - 1]; - skintime = cl.time + currententity->syncbase; + skintime = r_realtime + currententity->syncbase; // when loading in Mod_LoadAliasSkinGroup, we guaranteed all interval // values are positive, so we don't have to worry about division by 0 @@ -622,7 +622,7 @@ R_AliasSetupFrame (void) numframes = paliasgroup->numframes; fullinterval = pintervals[numframes - 1]; - time = cl.time + currententity->syncbase; + time = r_realtime + currententity->syncbase; // when loading in Mod_LoadAliasGroup, we guaranteed all interval values // are positive, so we don't have to worry about division by 0 diff --git a/nq/source/sw_rlight.c b/nq/source/sw_rlight.c index b8d62d420..5ce5a0380 100644 --- a/nq/source/sw_rlight.c +++ b/nq/source/sw_rlight.c @@ -43,7 +43,7 @@ R_AnimateLight (void) // light animations // '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++) { if (!cl_lightstyle[j].length) { d_lightstylevalue[j] = 256; @@ -111,7 +111,7 @@ R_PushDlights (vec3_t entorigin) l = cl_dlights; for (i = 0; i < MAX_DLIGHTS; i++, l++) { - if (l->die < cl.time || !l->radius) + if (l->die < r_realtime || !l->radius) continue; VectorSubtract (l->origin, entorigin, lightorigin); R_MarkLights (lightorigin, l, 1 << i, cl.worldmodel->nodes); diff --git a/nq/source/sw_rmain.c b/nq/source/sw_rmain.c index 8fcc1f4c4..0140696be 100644 --- a/nq/source/sw_rmain.c +++ b/nq/source/sw_rmain.c @@ -468,7 +468,7 @@ R_ShowNearestLoc (void) dl = CL_AllocDlight (4096); VectorCopy (nearloc->loc, dl->origin); dl->radius = 200; - dl->die = cl.time + 0.1; + dl->die = r_realtime + 0.1; dl->color[1]=1; VectorCopy(nearloc->loc,trueloc); @@ -526,7 +526,7 @@ R_DrawEntitiesOnList (void) lighting.plightvec = lightvec; 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, dist); add = cl_dlights[lnum].radius - Length (dist); @@ -602,7 +602,7 @@ R_DrawViewModel (void) continue; if (!dl->radius) continue; - if (dl->die < cl.time) + if (dl->die < r_realtime) continue; VectorSubtract (currententity->origin, dl->origin, dist); @@ -728,7 +728,7 @@ R_DrawBEntitiesOnList (void) vec3_t lightorigin; 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; VectorSubtract (cl_dlights[k].origin, diff --git a/nq/source/sw_rpart.c b/nq/source/sw_rpart.c index 019e67938..cbcce024d 100644 --- a/nq/source/sw_rpart.c +++ b/nq/source/sw_rpart.c @@ -211,7 +211,7 @@ R_ParticleExplosion (vec3_t org) p->next = active_particles; active_particles = p; - p->die = cl.time + 5; + p->die = r_realtime + 5; p->color = ramp1[0]; p->ramp = rand () & 3; if (i & 1) { @@ -247,7 +247,7 @@ R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength) p->next = active_particles; active_particles = p; - p->die = cl.time + 0.3; + p->die = r_realtime + 0.3; p->color = colorStart + (colorMod % colorLength); colorMod++; @@ -278,7 +278,7 @@ R_BlobExplosion (vec3_t org) p->next = active_particles; active_particles = p; - p->die = cl.time + 1 + (rand () & 8) * 0.05; + p->die = r_realtime + 1 + (rand () & 8) * 0.05; if (i & 1) { p->type = pt_blob; @@ -324,7 +324,7 @@ R_RunParticleEffect (vec3_t org, int color, int count) p->next = active_particles; 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->type = pt_grav; for (j = 0; j < 3; j++) { @@ -356,7 +356,7 @@ R_LavaSplash (vec3_t org) p->next = active_particles; 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->type = pt_grav; @@ -396,7 +396,7 @@ R_TeleportSplash (vec3_t org) p->next = active_particles; 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->type = pt_grav; @@ -439,7 +439,7 @@ R_RocketTrail (int type, entity_t *ent) active_particles = p; VectorCopy (vec3_origin, p->vel); - p->die = cl.time + 2; + p->die = r_realtime + 2; if (type == 4) { // slight blood p->type = pt_slowgrav; @@ -455,7 +455,7 @@ R_RocketTrail (int type, entity_t *ent) } else if (type == 6) { // voor trail p->color = 9 * 16 + 8 + (rand () & 3); p->type = pt_static; - p->die = cl.time + 0.3; + p->die = r_realtime + 0.3; for (j = 0; j < 3; j++) p->org[j] = ent->old_origin[j] + ((rand () & 15) - 8); } else if (type == 1) { // smoke smoke @@ -473,7 +473,7 @@ R_RocketTrail (int type, entity_t *ent) } else if (type == 3 || type == 5) { // tracer static int tracercount; - p->die = cl.time + 0.5; + p->die = r_realtime + 0.5; p->type = pt_static; if (type == 3) p->color = 52 + ((tracercount & 4) << 1); @@ -523,7 +523,7 @@ R_DrawParticles (void) dvel = 4 * frametime; for (particle = &active_particles; *particle;) { - if ((*particle)->die < cl.time) { + if ((*particle)->die < r_realtime) { p = (*particle)->next; (*particle)->next = free_particles; free_particles = (*particle); diff --git a/nq/source/sw_rsky.c b/nq/source/sw_rsky.c index f9aeaa06e..c3fedc3c3 100644 --- a/nq/source/sw_rsky.c +++ b/nq/source/sw_rsky.c @@ -30,7 +30,6 @@ # include "config.h" #endif -#include "client.h" #include "r_local.h" @@ -241,7 +240,7 @@ R_SetSkyFrame (void) s2 = iskyspeed2 / g; temp = SKYSIZE * s1 * s2; - skytime = cl.time - ((int) (cl.time / temp) * temp); + skytime = r_realtime - ((int) (r_realtime / temp) * temp); r_skymade = 0; } diff --git a/nq/source/sw_rsprite.c b/nq/source/sw_rsprite.c index 168f9608a..ce75d8e11 100644 --- a/nq/source/sw_rsprite.c +++ b/nq/source/sw_rsprite.c @@ -39,9 +39,9 @@ #include #include "QF/console.h" +#include "QF/render.h" #include "QF/sys.h" -#include "client.h" #include "r_local.h" static int clip_current; @@ -256,7 +256,7 @@ R_GetSpriteframe (msprite_t *psprite) numframes = pspritegroup->numframes; fullinterval = pintervals[numframes - 1]; - time = cl.time + currententity->syncbase; + time = r_realtime + currententity->syncbase; // when loading in Mod_LoadSpriteGroup, we guaranteed all interval // values are positive, so we don't have to worry about division by 0 diff --git a/nq/source/sw_rsurf.c b/nq/source/sw_rsurf.c index d48853d44..e7f24fc86 100644 --- a/nq/source/sw_rsurf.c +++ b/nq/source/sw_rsurf.c @@ -199,7 +199,7 @@ R_TextureAnimation (texture_t *base) if (!base->anim_total) return base; - reletive = (int) (cl.time * 10) % base->anim_total; + reletive = (int) (r_realtime * 10) % base->anim_total; count = 0; 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; byte *pd; - turb = sintable + ((int) (cl.time * SPEED) & (CYCLE - 1)); + turb = sintable + ((int) (r_realtime * SPEED) & (CYCLE - 1)); pd = (byte *) pdest; for (i = 0; i < TILE_SIZE; i++) { @@ -545,7 +545,7 @@ R_GenTurbTile16 (pixel_t *pbasetex, void *pdest) int i, j, s, t; unsigned short *pd; - turb = sintable + ((int) (cl.time * SPEED) & (CYCLE - 1)); + turb = sintable + ((int) (r_realtime * SPEED) & (CYCLE - 1)); pd = (unsigned short *) pdest; for (i = 0; i < TILE_SIZE; i++) { diff --git a/qw/source/Makefile.am b/qw/source/Makefile.am index 5a1b81ce1..7ae57f466 100644 --- a/qw/source/Makefile.am +++ b/qw/source/Makefile.am @@ -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 \ 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 \ - 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 # diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index 0353b62e8..648585fd7 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -1481,7 +1481,7 @@ Host_Frame (float time) if (host_speeds->int_val) time1 = Sys_DoubleTime (); - SCR_UpdateScreen (); + SCR_UpdateScreen (realtime); if (host_speeds->int_val) time2 = Sys_DoubleTime (); @@ -1676,7 +1676,7 @@ Host_Init (void) Con_Printf (" %s initialized \n", PROGRAM); - SCR_UpdateScreen (); + SCR_UpdateScreen (realtime); } diff --git a/qw/source/cl_parse.c b/qw/source/cl_parse.c index f2f3ecb78..53945b5cf 100644 --- a/qw/source/cl_parse.c +++ b/qw/source/cl_parse.c @@ -256,7 +256,7 @@ Model_NextDownload (void) if (cls.downloadnumber == 0) { Con_Printf ("Checking models...\n"); - SCR_UpdateScreen (); + SCR_UpdateScreen (realtime); cls.downloadnumber = 1; } @@ -317,7 +317,7 @@ Sound_NextDownload (void) if (cls.downloadnumber == 0) { Con_Printf ("Checking sounds...\n"); - SCR_UpdateScreen (); + SCR_UpdateScreen (realtime); cls.downloadnumber = 1; } diff --git a/qw/source/cl_skin.c b/qw/source/cl_skin.c index 2d5eaf5c2..c9b6e446e 100644 --- a/qw/source/cl_skin.c +++ b/qw/source/cl_skin.c @@ -64,7 +64,7 @@ Skin_NextDownload (void) if (cls.downloadnumber == 0) { Con_Printf ("Checking skins...\n"); - SCR_UpdateScreen (); + SCR_UpdateScreen (realtime); } cls.downloadtype = dl_skin; diff --git a/qw/source/d_scan.c b/qw/source/d_scan.c index 177645ebc..4c2f7bd2a 100644 --- a/qw/source/d_scan.c +++ b/qw/source/d_scan.c @@ -30,7 +30,7 @@ # include "config.h" #endif -#include "client.h" +//#include "client.h" #include "d_local.h" #include "r_local.h" #include "QF/render.h" @@ -78,7 +78,7 @@ D_WarpScreen (void) (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; 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 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_tstep = 0; // ditto diff --git a/qw/source/gl_dyn_fires.c b/qw/source/gl_dyn_fires.c index deeb2705e..4b0f3b5ee 100644 --- a/qw/source/gl_dyn_fires.c +++ b/qw/source/gl_dyn_fires.c @@ -40,9 +40,10 @@ #include "QF/cmd.h" #include "QF/console.h" +#include "QF/render.h" -#include "cl_main.h" #include "glquake.h" +#include "r_shared.h" #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 (start, f->owner); f->size = 10; - f->die = cl.time + 0.5; + f->die = r_realtime + 0.5; f->decay = 1; VectorCopy (r_firecolor->vec, f->color); } @@ -109,7 +110,7 @@ R_AllocFire (int key) f = r_fires; // no match, look for a free spot for (i = 0; i < MAX_FIRES; i++, f++) { - if (f->die < cl.time) { + if (f->die < r_realtime) { memset (f, 0, sizeof (*f)); f->key = key; return f; @@ -197,7 +198,7 @@ R_UpdateFires (void) f = r_fires; for (i = 0; i < MAX_FIRES; i++, f++) { - if (f->die < cl.time || !f->size) + if (f->die < r_realtime || !f->size) continue; f->size += f->decay; R_DrawFire (f); diff --git a/qw/source/gl_dyn_part.c b/qw/source/gl_dyn_part.c index ae53efeb3..e54f02c09 100644 --- a/qw/source/gl_dyn_part.c +++ b/qw/source/gl_dyn_part.c @@ -176,7 +176,7 @@ R_ReadPointFile_f (void) int c; char name[MAX_OSPATH], *mapname, *t1; - mapname = strdup (cl.worldmodel->name); + mapname = strdup (r_worldentity.model->name); if (!mapname) Sys_Error ("Can't duplicate mapname!"); t1 = strrchr (mapname, '.'); @@ -223,7 +223,7 @@ R_ParticleExplosion (vec3_t org) return; 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)); } @@ -238,7 +238,7 @@ R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength) return; 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++; } } @@ -254,12 +254,12 @@ R_BlobExplosion (vec3_t org) for (i = 0; i < 512; i++) { 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); } for (i = 0; i < 512; i++) { 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); } } @@ -272,11 +272,11 @@ R_RunSparkEffect (vec3_t org, int count, int ofuzz) return; 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); while (count--) 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)); } @@ -306,7 +306,7 @@ R_BloodPuff (vec3_t org, int count) return; 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); } @@ -352,7 +352,7 @@ R_RunParticleEffect (vec3_t org, int color, int count) porg[j] = org[j] + scale * ((rand () & 15) - 8); } 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); } } @@ -402,7 +402,7 @@ R_LavaSplash (vec3_t org) vel = 50 + (rand () & 63); VectorScale (dir, vel, 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); } } @@ -434,7 +434,7 @@ R_TeleportSplash (vec3_t org) vel = 50 + (rand () & 63); VectorScale (dir, vel, 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); } } @@ -463,7 +463,7 @@ R_RocketTrail (int type, entity_t *ent) VectorCopy (vec3_origin, up); VectorCopy (vec3_origin, right); VectorCopy (vec3_origin, pvel); - pdie = cl.time + 2; + pdie = r_realtime + 2; ptype = pt_static; ptex = part_tex_dot; palpha = 255; @@ -473,7 +473,7 @@ R_RocketTrail (int type, entity_t *ent) switch (type) { case 0: // rocket trail - pdie = cl.time + 60; + pdie = r_realtime + 60; // ptype = pt_smokering; // Mercury's Rings ptype = pt_smoke; pscale = lhrandom (6, 8); @@ -512,7 +512,7 @@ R_RocketTrail (int type, entity_t *ent) pcolor = 9 * 16 + 8 + (rand () & 3); ptype = pt_static; pscale = lhrandom (.75, 1.5); - pdie = cl.time + 0.3; + pdie = r_realtime + 0.3; for (j = 0; j < 3; j++) porg[j] = ent->old_origin[j] + lhrandom (-8, 8); break; @@ -522,7 +522,7 @@ R_RocketTrail (int type, entity_t *ent) static int tracercount; dist = 3; - pdie = cl.time + 0.5; + pdie = r_realtime + 0.5; ptype = pt_static; pscale = lhrandom (1.5, 3); if (type == 3) @@ -592,7 +592,7 @@ R_DrawParticles (void) // LordHavoc: this is probably no longer necessary, as it is // checked at the end, but could still happen on weird particle // effects, left for safety... - if (part->die <= cl.time) { + if (part->die <= r_realtime) { freeparticles[j++] = part; continue; } @@ -735,14 +735,14 @@ R_DrawParticles (void) // LordHavoc: immediate removal of unnecessary particles (must // be done to ensure compactor below operates properly in all // cases) - if (part->die <= cl.time) + if (part->die <= r_realtime) freeparticles[j++] = part; } k = 0; while (maxparticle >= activeparticles) { *freeparticles[k++] = particles[maxparticle--]; while (maxparticle >= activeparticles && - particles[maxparticle].die <= cl.time) + particles[maxparticle].die <= r_realtime) maxparticle--; } numparticles = activeparticles; diff --git a/qw/source/gl_rlight.c b/qw/source/gl_rlight.c index c1b9d4c85..ddb861536 100644 --- a/qw/source/gl_rlight.c +++ b/qw/source/gl_rlight.c @@ -51,7 +51,7 @@ R_AnimateLight (void) // light animations // '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++) { if (!cl_lightstyle[j].length) { d_lightstylevalue[j] = 256; @@ -169,7 +169,7 @@ R_RenderDlights (void) l = cl_dlights; for (i = 0; i < MAX_DLIGHTS; i++, l++) { - if (l->die < cl.time || !l->radius) + if (l->die < r_realtime || !l->radius) continue; R_RenderDlight (l); } @@ -294,7 +294,7 @@ R_PushDlights (vec3_t entorigin) l = cl_dlights; for (i = 0; i < MAX_DLIGHTS; i++, l++) { - if (l->die < cl.time || !l->radius) + if (l->die < r_realtime || !l->radius) continue; VectorSubtract (l->origin, entorigin, lightorigin); R_MarkLights (lightorigin, l, 1 << i, cl.worldmodel->nodes); diff --git a/qw/source/gl_rmain.c b/qw/source/gl_rmain.c index fd6b6fe2f..629411ccd 100644 --- a/qw/source/gl_rmain.c +++ b/qw/source/gl_rmain.c @@ -152,7 +152,7 @@ R_GetSpriteFrame (entity_t *currententity) numframes = pspritegroup->numframes; fullinterval = pintervals[numframes - 1]; - time = cl.time + currententity->syncbase; + time = r_realtime + currententity->syncbase; // when loading in Mod_LoadSpriteGroup, we guaranteed all interval // values @@ -467,7 +467,7 @@ GL_DrawAliasBlendedShadow (aliashdr_t *paliashdr, int pose1, int pose2, entity_t int *order, count; 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); lerp = 1 - blend; @@ -536,7 +536,7 @@ R_SetupAliasFrame (int frame, aliashdr_t *paliashdr, qboolean fb) if (numposes > 1) { interval = paliashdr->frames[frame].interval; - pose += (int) (cl.time / interval) % numposes; + pose += (int) (r_realtime / interval) % numposes; } GL_DrawAliasFrame (paliashdr, pose, fb); @@ -559,7 +559,7 @@ R_SetupAliasBlendedFrame (int frame, aliashdr_t *paliashdr, entity_t *e, qboolea if (numposes > 1) { e->frame_interval = paliashdr->frames[frame].interval; - pose += (int) (cl.time / e->frame_interval) % numposes; + pose += (int) (r_realtime / e->frame_interval) % numposes; } else { /* 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) { - e->frame_start_time = realtime; + e->frame_start_time = r_realtime; if (e->pose2 == -1) { e->pose1 = pose; } else { @@ -582,7 +582,7 @@ R_SetupAliasBlendedFrame (int frame, aliashdr_t *paliashdr, entity_t *e, qboolea e->pose2 = pose; blend = 0; } 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 @@ -640,7 +640,7 @@ R_DrawAliasModel (entity_t *e) shadelight = max (shadelight, 24); 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, dist); add = (cl_dlights[lnum].radius * cl_dlights[lnum].radius * 8) / @@ -697,7 +697,7 @@ R_DrawAliasModel (entity_t *e) paliashdr->mdl.scale[2]); } - anim = (int) (cl.time * 10) & 3; + anim = (int) (r_realtime * 10) & 3; skinnum = currententity->skinnum; if ((skinnum >= paliashdr->mdl.numskins) || (skinnum < 0)) { @@ -804,7 +804,7 @@ R_ShowNearestLoc (void) dl = CL_AllocDlight (4096); VectorCopy (nearloc->loc, dl->origin); dl->radius = 200; - dl->die = cl.time + 0.1; + dl->die = r_realtime + 0.1; dl->color[0] = 0; dl->color[1] = 1; dl->color[2] = 0; diff --git a/qw/source/gl_rsurf.c b/qw/source/gl_rsurf.c index a0ed9c1d5..d395d40e4 100644 --- a/qw/source/gl_rsurf.c +++ b/qw/source/gl_rsurf.c @@ -51,7 +51,6 @@ qboolean r_cache_thrash; -extern double realtime; int skytexturenum; extern vec3_t shadecolor; // Ender (Extend) Colormod @@ -335,7 +334,7 @@ R_TextureAnimation (texture_t *base) if (!base->anim_total) return base; - relative = (int) (cl.time * 10) % base->anim_total; + relative = (int) (r_realtime * 10) % base->anim_total; count = 0; while (base->anim_min > relative || base->anim_max <= relative) { @@ -723,7 +722,7 @@ R_DrawBrushModel (entity_t *e) vec3_t lightorigin; 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; VectorSubtract (cl_dlights[k].origin, e->origin, lightorigin); diff --git a/qw/source/gl_screen.c b/qw/source/gl_screen.c index 2f20152a5..fc53d79a0 100644 --- a/qw/source/gl_screen.c +++ b/qw/source/gl_screen.c @@ -166,7 +166,7 @@ SCR_CenterPrint (char *str) { strncpy (scr_centerstring, str, sizeof (scr_centerstring) - 1); scr_centertime_off = scr_centertime->value; - scr_centertime_start = cl.time; + scr_centertime_start = r_realtime; // count the number of lines for centering scr_center_lines = 1; @@ -189,7 +189,7 @@ SCR_DrawCenterString (void) // the finale prints the characters one at a time if (cl.intermission) - remaining = scr_printspeed->value * (cl.time - scr_centertime_start); + remaining = scr_printspeed->value * (r_realtime - scr_centertime_start); else remaining = 9999; @@ -874,7 +874,7 @@ extern cvar_t *brightness; needs almost the entire 256k of stack space! */ void -SCR_UpdateScreen (void) +SCR_UpdateScreen (double realtime) { double time1 = 0, time2; float f; @@ -882,13 +882,15 @@ SCR_UpdateScreen (void) if (block_drawing) return; + r_realtime = realtime; + vid.numpages = 2 + gl_triplebuffer->int_val; scr_copytop = 0; scr_copyeverything = 0; if (scr_disabled_for_loading) { - if (realtime - scr_disabled_time > 60) { + if (r_realtime - scr_disabled_time > 60) { scr_disabled_for_loading = false; Con_Printf ("load failed.\n"); } else { diff --git a/qw/source/gl_skin.c b/qw/source/gl_skin.c index 337138959..6818b679b 100644 --- a/qw/source/gl_skin.c +++ b/qw/source/gl_skin.c @@ -32,11 +32,11 @@ #include "QF/compat.h" #include "QF/console.h" +#include "QF/render.h" #include "QF/skin.h" #include "QF/texture.h" #include "glquake.h" -#include "QF/render.h" static byte translate[256]; static unsigned int translate32[256]; diff --git a/qw/source/gl_sky.c b/qw/source/gl_sky.c index 2ccfd6412..e15764726 100644 --- a/qw/source/gl_sky.c +++ b/qw/source/gl_sky.c @@ -39,14 +39,14 @@ #include "QF/compat.h" #include "QF/console.h" #include "QF/quakefs.h" +#include "QF/render.h" #include "QF/tga.h" #include "QF/vid.h" #include "glquake.h" -#include "QF/render.h" +#include "r_shared.h" #include "view.h" -extern double realtime; extern model_t *loadmodel; extern int skytexturenum; @@ -240,7 +240,7 @@ R_DrawSkyDome (void) domescale[0] = 512; domescale[1] = 512; domescale[2] = 128; - speedscale = realtime * 8; + speedscale = r_realtime * 8; speedscale -= (int) speedscale & ~127; R_DrawSkyLayer (speedscale); glEnable (GL_BLEND); @@ -251,7 +251,7 @@ R_DrawSkyDome (void) domescale[0] = 512; domescale[1] = 512; domescale[2] = 128; - speedscale = realtime * 16; + speedscale = r_realtime * 16; speedscale -= (int) speedscale & ~127; R_DrawSkyLayer (speedscale); } diff --git a/qw/source/gl_sky_clip.c b/qw/source/gl_sky_clip.c index 1bbc9693a..fc80bc118 100644 --- a/qw/source/gl_sky_clip.c +++ b/qw/source/gl_sky_clip.c @@ -39,6 +39,7 @@ #include #include "QF/console.h" +#include "QF/render.h" #include "QF/sys.h" #include "client.h" diff --git a/qw/source/gl_warp.c b/qw/source/gl_warp.c index c2ecd3180..f7ba77b88 100644 --- a/qw/source/gl_warp.c +++ b/qw/source/gl_warp.c @@ -34,8 +34,8 @@ #include "QF/sys.h" #include "glquake.h" +#include "r_shared.h" -extern double realtime; extern model_t *loadmodel; extern qboolean lighthalf; @@ -212,18 +212,18 @@ EmitWaterPolys (msurface_t *fa) os = v[3]; 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); - 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); glTexCoord2f (s, t); VectorCopy (v, nv); nv[2] += r_waterripple->value - * turbsin[(int) ((v[3] * 0.125 + realtime) * TURBSCALE) & 255] - * turbsin[(int) ((v[4] * 0.125 + realtime) * TURBSCALE) & 255] + * turbsin[(int) ((v[3] * 0.125 + r_realtime) * TURBSCALE) & 255] + * turbsin[(int) ((v[4] * 0.125 + r_realtime) * TURBSCALE) & 255] * (1.0 / 64.0); glVertex3fv (nv); diff --git a/qw/source/keys.c b/qw/source/keys.c index a9b95d5b4..f392069de 100644 --- a/qw/source/keys.c +++ b/qw/source/keys.c @@ -300,7 +300,7 @@ Key_Console (int key) key_lines[edit_line][1] = 0; key_linepos = 1; 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 return; diff --git a/qw/source/r_main.c b/qw/source/r_main.c new file mode 100644 index 000000000..276766c57 --- /dev/null +++ b/qw/source/r_main.c @@ -0,0 +1 @@ +double r_realtime; diff --git a/qw/source/screen.c b/qw/source/screen.c index 306df83b8..6c08dcd24 100644 --- a/qw/source/screen.c +++ b/qw/source/screen.c @@ -872,7 +872,7 @@ SCR_DrawNotifyString (void) needs almost the entire 256k of stack space! */ void -SCR_UpdateScreen (void) +SCR_UpdateScreen (double realtime) { static int oldscr_viewsize; vrect_t vrect; @@ -892,6 +892,8 @@ SCR_UpdateScreen (void) } #endif + r_realtime = realtime; + scr_copytop = 0; scr_copyeverything = 0; @@ -1016,8 +1018,8 @@ SCR_UpdateScreen (void) void -SCR_UpdateWholeScreen (void) +SCR_UpdateWholeScreen (double realtime) { scr_fullupdate = 0; - SCR_UpdateScreen (); + SCR_UpdateScreen (realtime); } diff --git a/qw/source/sw_ralias.c b/qw/source/sw_ralias.c index 3beea74e9..cb866c441 100644 --- a/qw/source/sw_ralias.c +++ b/qw/source/sw_ralias.c @@ -539,7 +539,7 @@ R_AliasSetupSkin (void) numskins = paliasskingroup->numskins; fullskininterval = pskinintervals[numskins - 1]; - skintime = cl.time + currententity->syncbase; + skintime = r_realtime + currententity->syncbase; // when loading in Mod_LoadAliasSkinGroup, we guaranteed all interval // values are positive, so we don't have to worry about division by 0 @@ -635,7 +635,7 @@ R_AliasSetupFrame (void) numframes = paliasgroup->numframes; fullinterval = pintervals[numframes - 1]; - time = cl.time + currententity->syncbase; + time = r_realtime + currententity->syncbase; // when loading in Mod_LoadAliasGroup, we guaranteed all interval values // are positive, so we don't have to worry about division by 0 diff --git a/qw/source/sw_rlight.c b/qw/source/sw_rlight.c index b8d62d420..5ce5a0380 100644 --- a/qw/source/sw_rlight.c +++ b/qw/source/sw_rlight.c @@ -43,7 +43,7 @@ R_AnimateLight (void) // light animations // '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++) { if (!cl_lightstyle[j].length) { d_lightstylevalue[j] = 256; @@ -111,7 +111,7 @@ R_PushDlights (vec3_t entorigin) l = cl_dlights; for (i = 0; i < MAX_DLIGHTS; i++, l++) { - if (l->die < cl.time || !l->radius) + if (l->die < r_realtime || !l->radius) continue; VectorSubtract (l->origin, entorigin, lightorigin); R_MarkLights (lightorigin, l, 1 << i, cl.worldmodel->nodes); diff --git a/qw/source/sw_rmain.c b/qw/source/sw_rmain.c index e2843d37d..f2c782d55 100644 --- a/qw/source/sw_rmain.c +++ b/qw/source/sw_rmain.c @@ -469,7 +469,7 @@ R_ShowNearestLoc (void) dl = CL_AllocDlight (4096); VectorCopy (nearloc->loc, dl->origin); dl->radius = 200; - dl->die = cl.time + 0.1; + dl->die = r_realtime + 0.1; dl->color[1]=1; VectorCopy(nearloc->loc,trueloc); @@ -520,7 +520,7 @@ R_DrawEntitiesOnList (void) lighting.plightvec = lightvec; 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, dist); add = cl_dlights[lnum].radius - Length (dist); @@ -594,7 +594,7 @@ R_DrawViewModel (void) continue; if (!dl->radius) continue; - if (dl->die < cl.time) + if (dl->die < r_realtime) continue; VectorSubtract (currententity->origin, dl->origin, dist); @@ -720,7 +720,7 @@ R_DrawBEntitiesOnList (void) vec3_t lightorigin; 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; VectorSubtract (cl_dlights[k].origin, diff --git a/qw/source/sw_rpart.c b/qw/source/sw_rpart.c index 019e67938..cbcce024d 100644 --- a/qw/source/sw_rpart.c +++ b/qw/source/sw_rpart.c @@ -211,7 +211,7 @@ R_ParticleExplosion (vec3_t org) p->next = active_particles; active_particles = p; - p->die = cl.time + 5; + p->die = r_realtime + 5; p->color = ramp1[0]; p->ramp = rand () & 3; if (i & 1) { @@ -247,7 +247,7 @@ R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength) p->next = active_particles; active_particles = p; - p->die = cl.time + 0.3; + p->die = r_realtime + 0.3; p->color = colorStart + (colorMod % colorLength); colorMod++; @@ -278,7 +278,7 @@ R_BlobExplosion (vec3_t org) p->next = active_particles; active_particles = p; - p->die = cl.time + 1 + (rand () & 8) * 0.05; + p->die = r_realtime + 1 + (rand () & 8) * 0.05; if (i & 1) { p->type = pt_blob; @@ -324,7 +324,7 @@ R_RunParticleEffect (vec3_t org, int color, int count) p->next = active_particles; 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->type = pt_grav; for (j = 0; j < 3; j++) { @@ -356,7 +356,7 @@ R_LavaSplash (vec3_t org) p->next = active_particles; 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->type = pt_grav; @@ -396,7 +396,7 @@ R_TeleportSplash (vec3_t org) p->next = active_particles; 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->type = pt_grav; @@ -439,7 +439,7 @@ R_RocketTrail (int type, entity_t *ent) active_particles = p; VectorCopy (vec3_origin, p->vel); - p->die = cl.time + 2; + p->die = r_realtime + 2; if (type == 4) { // slight blood p->type = pt_slowgrav; @@ -455,7 +455,7 @@ R_RocketTrail (int type, entity_t *ent) } else if (type == 6) { // voor trail p->color = 9 * 16 + 8 + (rand () & 3); p->type = pt_static; - p->die = cl.time + 0.3; + p->die = r_realtime + 0.3; for (j = 0; j < 3; j++) p->org[j] = ent->old_origin[j] + ((rand () & 15) - 8); } else if (type == 1) { // smoke smoke @@ -473,7 +473,7 @@ R_RocketTrail (int type, entity_t *ent) } else if (type == 3 || type == 5) { // tracer static int tracercount; - p->die = cl.time + 0.5; + p->die = r_realtime + 0.5; p->type = pt_static; if (type == 3) p->color = 52 + ((tracercount & 4) << 1); @@ -523,7 +523,7 @@ R_DrawParticles (void) dvel = 4 * frametime; for (particle = &active_particles; *particle;) { - if ((*particle)->die < cl.time) { + if ((*particle)->die < r_realtime) { p = (*particle)->next; (*particle)->next = free_particles; free_particles = (*particle); diff --git a/qw/source/sw_rsky.c b/qw/source/sw_rsky.c index f9aeaa06e..c3fedc3c3 100644 --- a/qw/source/sw_rsky.c +++ b/qw/source/sw_rsky.c @@ -30,7 +30,6 @@ # include "config.h" #endif -#include "client.h" #include "r_local.h" @@ -241,7 +240,7 @@ R_SetSkyFrame (void) s2 = iskyspeed2 / g; temp = SKYSIZE * s1 * s2; - skytime = cl.time - ((int) (cl.time / temp) * temp); + skytime = r_realtime - ((int) (r_realtime / temp) * temp); r_skymade = 0; } diff --git a/qw/source/sw_rsprite.c b/qw/source/sw_rsprite.c index 168f9608a..ce75d8e11 100644 --- a/qw/source/sw_rsprite.c +++ b/qw/source/sw_rsprite.c @@ -39,9 +39,9 @@ #include #include "QF/console.h" +#include "QF/render.h" #include "QF/sys.h" -#include "client.h" #include "r_local.h" static int clip_current; @@ -256,7 +256,7 @@ R_GetSpriteframe (msprite_t *psprite) numframes = pspritegroup->numframes; fullinterval = pintervals[numframes - 1]; - time = cl.time + currententity->syncbase; + time = r_realtime + currententity->syncbase; // when loading in Mod_LoadSpriteGroup, we guaranteed all interval // values are positive, so we don't have to worry about division by 0 diff --git a/qw/source/sw_rsurf.c b/qw/source/sw_rsurf.c index d48853d44..e7f24fc86 100644 --- a/qw/source/sw_rsurf.c +++ b/qw/source/sw_rsurf.c @@ -199,7 +199,7 @@ R_TextureAnimation (texture_t *base) if (!base->anim_total) return base; - reletive = (int) (cl.time * 10) % base->anim_total; + reletive = (int) (r_realtime * 10) % base->anim_total; count = 0; 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; byte *pd; - turb = sintable + ((int) (cl.time * SPEED) & (CYCLE - 1)); + turb = sintable + ((int) (r_realtime * SPEED) & (CYCLE - 1)); pd = (byte *) pdest; for (i = 0; i < TILE_SIZE; i++) { @@ -545,7 +545,7 @@ R_GenTurbTile16 (pixel_t *pbasetex, void *pdest) int i, j, s, t; unsigned short *pd; - turb = sintable + ((int) (cl.time * SPEED) & (CYCLE - 1)); + turb = sintable + ((int) (r_realtime * SPEED) & (CYCLE - 1)); pd = (unsigned short *) pdest; for (i = 0; i < TILE_SIZE; i++) {