From 2477a44d15abae9afcbbdee9533481cfa072ec73 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 28 Feb 2022 16:55:12 +0900 Subject: [PATCH] [client] Move cshift info from viddef to viewstate It makes much more sense for cshift state to be in viewstate because it is very much an effect rather than anything specific to a renderer. --- include/QF/vid.h | 2 -- include/client/view.h | 2 ++ libs/client/cl_view.c | 16 ++++++++-------- nq/source/cl_screen.c | 2 +- qw/source/cl_screen.c | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/QF/vid.h b/include/QF/vid.h index 499989f20..c5fd95751 100644 --- a/include/QF/vid.h +++ b/include/QF/vid.h @@ -53,8 +53,6 @@ typedef struct { unsigned height; int numpages; qboolean recalc_refdef; // if true, recalc vid-based stuff - qboolean cshift_changed; - quat_t cshift_color; struct view_s *conview; struct vid_internal_s *vid_internal; diff --git a/include/client/view.h b/include/client/view.h index ea7712a31..9cf2d8ed7 100644 --- a/include/client/view.h +++ b/include/client/view.h @@ -61,6 +61,8 @@ typedef struct viewstate_s { int powerup_index; cshift_t cshifts[NUM_CSHIFTS]; // Color shifts for damage, powerups cshift_t prev_cshifts[NUM_CSHIFTS]; // and content types + quat_t cshift_color; + qboolean cshift_changed; // pitch drifting vars float idealpitch; diff --git a/libs/client/cl_view.c b/libs/client/cl_view.c index 6eb3c20d8..139e2d8fb 100644 --- a/libs/client/cl_view.c +++ b/libs/client/cl_view.c @@ -414,10 +414,10 @@ V_CalcBlend (viewstate_t *vs) b *= a2; } - r_data->vid->cshift_color[0] = min (r, 255.0) / 255.0; - r_data->vid->cshift_color[1] = min (g, 255.0) / 255.0; - r_data->vid->cshift_color[2] = min (b, 255.0) / 255.0; - r_data->vid->cshift_color[3] = bound (0.0, a, 1.0); + vs->cshift_color[0] = min (r, 255.0) / 255.0; + vs->cshift_color[1] = min (g, 255.0) / 255.0; + vs->cshift_color[2] = min (b, 255.0) / 255.0; + vs->cshift_color[3] = bound (0.0, a, 1.0); } static void @@ -443,17 +443,17 @@ V_PrepBlend (viewstate_t *vs) || (vs->force_cshifts & INFO_CSHIFT_POWERUP)) V_CalcPowerupCshift (vs); - r_data->vid->cshift_changed = false; + vs->cshift_changed = false; for (i = 0; i < NUM_CSHIFTS; i++) { if (vs->cshifts[i].percent != vs->prev_cshifts[i].percent) { - r_data->vid->cshift_changed = true; + vs->cshift_changed = true; vs->prev_cshifts[i].percent = vs->cshifts[i].percent; } for (j = 0; j < 3; j++) { if (vs->cshifts[i].destcolor[j] != vs->prev_cshifts[i].destcolor[j]) { - r_data->vid->cshift_changed = true; + vs->cshift_changed = true; vs->prev_cshifts[i].destcolor[j] = vs->cshifts[i].destcolor[j]; } } @@ -464,7 +464,7 @@ V_PrepBlend (viewstate_t *vs) // drop the bonus value V_DropCShift (&vs->cshifts[CSHIFT_BONUS], vs->time, 100); - if (!r_data->vid->cshift_changed && !r_data->vid->recalc_refdef) + if (!vs->cshift_changed && !r_data->vid->recalc_refdef) return; V_CalcBlend (vs); diff --git a/nq/source/cl_screen.c b/nq/source/cl_screen.c index 214f764a4..01188572e 100644 --- a/nq/source/cl_screen.c +++ b/nq/source/cl_screen.c @@ -81,7 +81,7 @@ SCR_CShift (void) contents = leaf->contents; } V_SetContentsColor (&cl.viewstate, contents); - r_funcs->Draw_BlendScreen (r_data->vid->cshift_color); + r_funcs->Draw_BlendScreen (cl.viewstate.cshift_color); } static void diff --git a/qw/source/cl_screen.c b/qw/source/cl_screen.c index ff4006437..8bf09229a 100644 --- a/qw/source/cl_screen.c +++ b/qw/source/cl_screen.c @@ -83,7 +83,7 @@ SCR_CShift (void) contents = leaf->contents; } V_SetContentsColor (&cl.viewstate, contents); - r_funcs->Draw_BlendScreen (r_data->vid->cshift_color); + r_funcs->Draw_BlendScreen (cl.viewstate.cshift_color); } static void