mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
[renderer] Update crosshair color on palette changes
This gets the crosshair working in Vulkan (next commit) and fixes issues with changing the palette (though I've never seen a different palette for quate, there's still the change from "all black" to an actual palette).
This commit is contained in:
parent
83ec2be2a6
commit
6b84ae5554
1 changed files with 15 additions and 3 deletions
|
@ -107,12 +107,23 @@ int r_viewsize;
|
|||
|
||||
quat_t crosshair_color;
|
||||
|
||||
static void
|
||||
crosshaircolor_update (void *_var, const viddef_t *vid)
|
||||
{
|
||||
cvar_t *var = _var;
|
||||
byte *color;
|
||||
color = &vid->palette32[bound (0, var->int_val, 255) * 4];
|
||||
QuatScale (color, 1.0 / 255, crosshair_color);
|
||||
}
|
||||
|
||||
static void
|
||||
crosshaircolor_f (cvar_t *var)
|
||||
{
|
||||
byte *color;
|
||||
color = (byte *) &d_8to24table[bound (0, var->int_val, 255)];
|
||||
QuatScale (color, 1.0 / 255, crosshair_color);
|
||||
if (!r_data->vid->palette32) {
|
||||
// palette not initialized yet
|
||||
return;
|
||||
}
|
||||
crosshaircolor_update (var, r_data->vid);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -208,6 +219,7 @@ R_Init_Cvars (void)
|
|||
"type. 0 off, 1 old white, 2 new with colors");
|
||||
crosshaircolor = Cvar_Get ("crosshaircolor", "79", CVAR_ARCHIVE,
|
||||
crosshaircolor_f, "Color of the new crosshair");
|
||||
VID_OnPaletteChange_AddListener (crosshaircolor_update, crosshaircolor);
|
||||
d_mipcap = Cvar_Get ("d_mipcap", "0", CVAR_NONE, NULL,
|
||||
"Detail level. 0 is highest, 3 is lowest.");
|
||||
d_mipscale = Cvar_Get ("d_mipscale", "1", CVAR_NONE, NULL, "Detail level "
|
||||
|
|
Loading…
Reference in a new issue