Fix a couple of things with the dreaded crosshair coloration functions. ;)

git-svn-id: https://svn.eduke32.com/eduke32@6995 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-10-07 05:19:45 +00:00
parent 5a5712575a
commit 065bd8df60

View file

@ -96,23 +96,24 @@ void P_SetGamePalette(DukePlayer_t *player, uint32_t palid, int32_t set)
void G_GetCrosshairColor(void) void G_GetCrosshairColor(void)
{ {
// use the brightest color in the original 8-bit tile if (IONMAIDEN)
int32_t bri = 0, j = 0, i; return;
int32_t ii;
char const *ptr = (char const *) waloff[CROSSHAIR];
if (DefaultCrosshairColors.f) if (DefaultCrosshairColors.f)
return; return;
if (waloff[CROSSHAIR] == 0) tileLoad(CROSSHAIR);
{
tileLoad(CROSSHAIR);
ptr = (char const *) waloff[CROSSHAIR];
}
ii = tilesiz[CROSSHAIR].x * tilesiz[CROSSHAIR].y; if (!waloff[CROSSHAIR])
return;
if (ii <= 0) return; char const *ptr = (char const *) waloff[CROSSHAIR];
// find the brightest color in the original 8-bit tile
int32_t ii = tilesiz[CROSSHAIR].x * tilesiz[CROSSHAIR].y;
int32_t bri = 0, j = 0, i;
Bassert(ii > 0);
do do
{ {
@ -134,9 +135,13 @@ void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b)
if (IONMAIDEN) if (IONMAIDEN)
return; return;
int32_t i, ii; if (g_crosshairSum == r+(g<<8)+(b<<16))
return;
if (g_crosshairSum == r+(g<<8)+(b<<16)) return; tileLoad(CROSSHAIR);
if (!waloff[CROSSHAIR])
return;
if (!DefaultCrosshairColors.f) if (!DefaultCrosshairColors.f)
G_GetCrosshairColor(); G_GetCrosshairColor();
@ -148,18 +153,13 @@ void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b)
char *ptr = (char *) waloff[CROSSHAIR]; char *ptr = (char *) waloff[CROSSHAIR];
if (waloff[CROSSHAIR] == 0) int32_t ii = tilesiz[CROSSHAIR].x * tilesiz[CROSSHAIR].y;
{
tileLoad(CROSSHAIR);
ptr = (char *) waloff[CROSSHAIR];
}
ii = tilesiz[CROSSHAIR].x * tilesiz[CROSSHAIR].y; Bassert(ii > 0);
if (ii <= 0) return;
if (videoGetRenderMode() == REND_CLASSIC) int32_t i = (videoGetRenderMode() == REND_CLASSIC)
i = paletteGetClosestColor(CrosshairColors.r, CrosshairColors.g, CrosshairColors.b); ? paletteGetClosestColor(CrosshairColors.r, CrosshairColors.g, CrosshairColors.b)
else i = paletteGetClosestColor(255, 255, 255); // use white in GL so we can tint it to the right color : paletteGetClosestColor(255, 255, 255); // use white in GL so we can tint it to the right color
do do
{ {