diff --git a/include/QF/render.h b/include/QF/render.h index 36ca2379e..9c155feaf 100644 --- a/include/QF/render.h +++ b/include/QF/render.h @@ -170,6 +170,9 @@ void R_DrawWaterSurfaces (void); */ extern int reinit_surfcache; // if 1, surface cache is currently empty extern qboolean r_cache_thrash; // set if thrashing the surface cache +extern qboolean r_inhibit_viewmodel; +extern qboolean r_force_fullscreen; +extern entity_t *r_view_model; void *D_SurfaceCacheAddress (void); int D_SurfaceCacheForRes (int width, int height); diff --git a/include/d_iface.h b/include/d_iface.h index 3d405e403..3af3b96aa 100644 --- a/include/d_iface.h +++ b/include/d_iface.h @@ -240,6 +240,8 @@ extern drawsurf_t r_drawsurf; void R_DrawSurface (void); void R_GenTile (msurface_t *psurf, void *pdest); +// !!! if this is changed, it must be changed in d_iface.h too !!! +#define CACHE_SIZE 32 // used to align key data structures // !!! if this is changed, it must be changed in d_ifacea.h too !!! #define TURB_TEX_SIZE 64 // base turbulent texture size diff --git a/include/d_ifacea.h b/include/d_ifacea.h index d7335a74f..2dd45dfed 100644 --- a/include/d_ifacea.h +++ b/include/d_ifacea.h @@ -46,7 +46,7 @@ // !!! if this is changed, it must be changed in r_shared.h too !!! #define MAXHEIGHT 1024 -// !!! if this is changed, it must be changed in quakedef.h too !!! +// !!! if this is changed, it must be changed in d_iface.h too !!! #define CACHE_SIZE 32 // used to align key data structures // particle_t structure diff --git a/nq/include/game.h b/nq/include/game.h index 6ab374c57..17bec69ad 100644 --- a/nq/include/game.h +++ b/nq/include/game.h @@ -56,9 +56,6 @@ #define UNALIGNED_OK 0 #endif -// !!! if this is changed, it must be changed in d_ifacea.h too !!! -#define CACHE_SIZE 32 // used to align key data structures - #define MINIMUM_MEMORY 0x550000 #define MINIMUM_MEMORY_LEVELPAK (MINIMUM_MEMORY + 0x100000) diff --git a/nq/source/host.c b/nq/source/host.c index 4fa3842ae..471744175 100644 --- a/nq/source/host.c +++ b/nq/source/host.c @@ -705,6 +705,12 @@ _Host_Frame (float time) if (host_speeds->int_val) time1 = Sys_DoubleTime (); + r_inhibit_viewmodel = (chase_active->int_val + || (cl.stats[STAT_ITEMS] & IT_INVISIBILITY) + || cl.stats[STAT_HEALTH] <= 0); + r_force_fullscreen = cl.intermission; + r_view_model = &cl.viewent; + SCR_UpdateScreen (cl.time); if (host_speeds->int_val) diff --git a/nq/source/r_main.c b/nq/source/r_main.c index ac81ed25f..27520b19f 100644 --- a/nq/source/r_main.c +++ b/nq/source/r_main.c @@ -1,9 +1,13 @@ +#include "QF/qtypes.h" #include "QF/render.h" #include "r_local.h" -double r_realtime; +qboolean r_inhibit_viewmodel; +qboolean r_force_fullscreen; +double r_realtime; dlight_t r_dlights[MAX_DLIGHTS]; +entity_t *r_view_model; dlight_t * R_AllocDlight (int key) diff --git a/nq/source/screen.c b/nq/source/screen.c index 8e53a8c1f..c5d3cb068 100644 --- a/nq/source/screen.c +++ b/nq/source/screen.c @@ -347,7 +347,7 @@ SCR_CalcRefdef (void) vrect.width = vid.width; vrect.height = vid.height; - R_SetVrect (&vrect, &scr_vrect, sb_lines); + R_SetVrect (&vrect, &scr_vrect, cl_sbar->int_val ? sb_lines : 0); // guard against going from one mode to another that's less than half the // vertical resolution @@ -355,7 +355,7 @@ SCR_CalcRefdef (void) scr_con_current = vid.height; // notify the refresh of the change - R_ViewChanged (&vrect, sb_lines, vid.aspect); + R_ViewChanged (&vrect, cl_sbar->int_val ? sb_lines : 0, vid.aspect); } diff --git a/nq/source/sw_rmain.c b/nq/source/sw_rmain.c index bfc0e860f..ee62049dc 100644 --- a/nq/source/sw_rmain.c +++ b/nq/source/sw_rmain.c @@ -42,12 +42,12 @@ #include "QF/console.h" #include "QF/locs.h" #include "QF/mathlib.h" +#include "QF/render.h" #include "QF/screen.h" #include "QF/sound.h" #include "QF/sys.h" -#include "chase.h" -#include "client.h" +#include "d_iface.h" #include "r_cvar.h" #include "r_dynamic.h" #include "r_local.h" @@ -251,17 +251,15 @@ R_SetVrect (vrect_t *pvrectin, vrect_t *pvrect, int lineadj) size = scr_viewsize->int_val; } - if (cl.intermission) { + if (r_force_fullscreen) { full = true; size = 100.0; - lineadj = 0; } size /= 100.0; + if (full) + lineadj = 0; - if (!cl_sbar->int_val && full) - h = pvrectin->height; - else - h = pvrectin->height - lineadj; + h = pvrectin->height - lineadj; if (full) { pvrect->width = pvrectin->width; @@ -276,13 +274,8 @@ R_SetVrect (vrect_t *pvrectin, vrect_t *pvrect, int lineadj) pvrect->width &= ~7; pvrect->height = pvrectin->height * size; - if (cl_sbar->int_val || !full) { - if (pvrect->height > pvrectin->height - lineadj) - pvrect->height = pvrectin->height - lineadj; - } else { - if (pvrect->height > pvrectin->height) - pvrect->height = pvrectin->height; - } + if (pvrect->height > pvrectin->height - lineadj) + pvrect->height = pvrectin->height - lineadj; pvrect->height &= ~1; @@ -497,13 +490,6 @@ R_DrawEntitiesOnList (void) for (i = 0; i < r_numvisedicts; i++) { currententity = r_visedicts[i]; - if (currententity == &cl_entities[cl.viewentity]) { - if (!chase_active->int_val) - continue; // don't draw the player - else - currententity->angles[PITCH] *= 0.3; - } - switch (currententity->model->type) { case mod_sprite: VectorCopy (currententity->origin, r_entorigin); @@ -565,20 +551,12 @@ R_DrawViewModel (void) float add; dlight_t *dl; - if (!r_drawviewmodel->int_val + if (r_inhibit_viewmodel + || !r_drawviewmodel->int_val || !r_drawentities->int_val) return; - if (chase_active->int_val) - return; - - if (cl.stats[STAT_ITEMS] & IT_INVISIBILITY) - return; - - if (cl.stats[STAT_HEALTH] <= 0) - return; - - currententity = &cl.viewent; + currententity = r_view_model; if (!currententity->model) return; diff --git a/nq/source/sw_rmisc.c b/nq/source/sw_rmisc.c index 5d8c5ea1d..948a7aa8a 100644 --- a/nq/source/sw_rmisc.c +++ b/nq/source/sw_rmisc.c @@ -484,7 +484,7 @@ R_SetupFrame (void) vrect.width = vid.width; vrect.height = vid.height; - R_ViewChanged (&vrect, sb_lines, vid.aspect); + R_ViewChanged (&vrect, cl_sbar->int_val ? sb_lines : 0, vid.aspect); } else { w = vid.width; h = vid.height; @@ -505,7 +505,7 @@ R_SetupFrame (void) vrect.height = (int) h; R_ViewChanged (&vrect, - (int) ((float) sb_lines * + (int) ((float) (cl_sbar->int_val ? sb_lines : 0) * (h / (float) vid.height)), vid.aspect * (h / w) * ((float) vid.width / (float) vid.height)); @@ -516,7 +516,7 @@ R_SetupFrame (void) vrect.width = vid.width; vrect.height = vid.height; - R_ViewChanged (&vrect, sb_lines, vid.aspect); + R_ViewChanged (&vrect, cl_sbar->int_val ? sb_lines : 0, vid.aspect); } r_viewchanged = false; diff --git a/qw/include/bothdefs.h b/qw/include/bothdefs.h index 241f43836..fb91221e3 100644 --- a/qw/include/bothdefs.h +++ b/qw/include/bothdefs.h @@ -35,9 +35,6 @@ # define UNALIGNED_OK 0 #endif -// !!! if this is changed, it must be changed in d_ifacea.h too !!! -#define CACHE_SIZE 32 // used to align key data structures - #define UNUSED(x) (x = x) // for pesky compiler / lint warnings // Error out if we get less than 4MB diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index e762c52e0..9184abbc4 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -1480,6 +1480,12 @@ Host_Frame (float time) if (host_speeds->int_val) time1 = Sys_DoubleTime (); + r_inhibit_viewmodel = (!Cam_DrawViewModel () + || (cl.stats[STAT_ITEMS] & IT_INVISIBILITY) + || cl.stats[STAT_HEALTH] <= 0); + r_force_fullscreen = cl.intermission; + r_view_model = &cl.viewent; + SCR_UpdateScreen (realtime); if (host_speeds->int_val) diff --git a/qw/source/r_main.c b/qw/source/r_main.c index ac81ed25f..27520b19f 100644 --- a/qw/source/r_main.c +++ b/qw/source/r_main.c @@ -1,9 +1,13 @@ +#include "QF/qtypes.h" #include "QF/render.h" #include "r_local.h" -double r_realtime; +qboolean r_inhibit_viewmodel; +qboolean r_force_fullscreen; +double r_realtime; dlight_t r_dlights[MAX_DLIGHTS]; +entity_t *r_view_model; dlight_t * R_AllocDlight (int key) diff --git a/qw/source/screen.c b/qw/source/screen.c index 6c08dcd24..f8b86483e 100644 --- a/qw/source/screen.c +++ b/qw/source/screen.c @@ -347,7 +347,7 @@ SCR_CalcRefdef (void) vrect.width = vid.width; vrect.height = vid.height; - R_SetVrect (&vrect, &scr_vrect, sb_lines); + R_SetVrect (&vrect, &scr_vrect, cl_sbar->int_val ? sb_lines : 0); // guard against going from one mode to another that's less than half the // vertical resolution @@ -355,7 +355,7 @@ SCR_CalcRefdef (void) scr_con_current = vid.height; // notify the refresh of the change - R_ViewChanged (&vrect, sb_lines, vid.aspect); + R_ViewChanged (&vrect, cl_sbar->int_val ? sb_lines : 0, vid.aspect); } diff --git a/qw/source/sw_rmain.c b/qw/source/sw_rmain.c index b1751458e..ee62049dc 100644 --- a/qw/source/sw_rmain.c +++ b/qw/source/sw_rmain.c @@ -47,9 +47,7 @@ #include "QF/sound.h" #include "QF/sys.h" -#include "bothdefs.h" -#include "cl_cam.h" -#include "cl_main.h" +#include "d_iface.h" #include "r_cvar.h" #include "r_dynamic.h" #include "r_local.h" @@ -253,17 +251,15 @@ R_SetVrect (vrect_t *pvrectin, vrect_t *pvrect, int lineadj) size = scr_viewsize->int_val; } - if (cl.intermission) { + if (r_force_fullscreen) { full = true; size = 100.0; - lineadj = 0; } size /= 100.0; + if (full) + lineadj = 0; - if (!cl_sbar->int_val && full) - h = pvrectin->height; - else - h = pvrectin->height - lineadj; + h = pvrectin->height - lineadj; if (full) { pvrect->width = pvrectin->width; @@ -278,13 +274,8 @@ R_SetVrect (vrect_t *pvrectin, vrect_t *pvrect, int lineadj) pvrect->width &= ~7; pvrect->height = pvrectin->height * size; - if (cl_sbar->int_val || !full) { - if (pvrect->height > pvrectin->height - lineadj) - pvrect->height = pvrectin->height - lineadj; - } else { - if (pvrect->height > pvrectin->height) - pvrect->height = pvrectin->height; - } + if (pvrect->height > pvrectin->height - lineadj) + pvrect->height = pvrectin->height - lineadj; pvrect->height &= ~1; @@ -560,18 +551,12 @@ R_DrawViewModel (void) float add; dlight_t *dl; - if (!r_drawviewmodel->int_val - || !Cam_DrawViewModel () + if (r_inhibit_viewmodel + || !r_drawviewmodel->int_val || !r_drawentities->int_val) return; - if (cl.stats[STAT_ITEMS] & IT_INVISIBILITY) - return; - - if (cl.stats[STAT_HEALTH] <= 0) - return; - - currententity = &cl.viewent; + currententity = r_view_model; if (!currententity->model) return; diff --git a/qw/source/sw_rmisc.c b/qw/source/sw_rmisc.c index 89dfb247b..52b7a65f3 100644 --- a/qw/source/sw_rmisc.c +++ b/qw/source/sw_rmisc.c @@ -482,7 +482,7 @@ R_SetupFrame (void) vrect.width = vid.width; vrect.height = vid.height; - R_ViewChanged (&vrect, sb_lines, vid.aspect); + R_ViewChanged (&vrect, cl_sbar->int_val ? sb_lines : 0, vid.aspect); } else { w = vid.width; h = vid.height; @@ -503,7 +503,7 @@ R_SetupFrame (void) vrect.height = (int) h; R_ViewChanged (&vrect, - (int) ((float) sb_lines * + (int) ((float) (cl_sbar->int_val ? sb_lines : 0) * (h / (float) vid.height)), vid.aspect * (h / w) * ((float) vid.width / (float) vid.height)); @@ -514,7 +514,7 @@ R_SetupFrame (void) vrect.width = vid.width; vrect.height = vid.height; - R_ViewChanged (&vrect, sb_lines, vid.aspect); + R_ViewChanged (&vrect, cl_sbar->int_val ? sb_lines : 0, vid.aspect); } r_viewchanged = false;