[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.
This commit is contained in:
Bill Currie 2022-02-28 16:55:12 +09:00
parent 7d059a0b56
commit 2477a44d15
5 changed files with 12 additions and 12 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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

View file

@ -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