Skip to content

Commit

Permalink
Experiment with different effect for weapon silhouettes
Browse files Browse the repository at this point in the history
  • Loading branch information
bradharding committed Aug 31, 2024
1 parent 5586d7f commit 0333334
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
4 changes: 1 addition & 3 deletions src/hu_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,6 @@ static bool HU_DefaultPistolSprites(void)
}

if (!result1)
{
for (int i = 0; i < 5; i++)
{
patch_t *patch = patch = W_CacheLumpNum(firstspritelump
Expand All @@ -828,7 +827,6 @@ static bool HU_DefaultPistolSprites(void)
break;
}
}
}

return (result1 || result2);
}
Expand Down Expand Up @@ -1344,7 +1342,7 @@ static void HU_DrawAltHUD(void)
althudfunc(ALTHUD_RIGHT_X, ALTHUD_Y + 13, altrightpatch, WHITE, color, tinttab60);

if ((patch = weaponinfo[weapon].weaponpatch))
althudweaponfunc(ALTHUD_RIGHT_X + 108, weaponinfo[weapon].weapony, patch, color, tinttab60);
althudweaponfunc(ALTHUD_RIGHT_X + 108, weaponinfo[weapon].weapony, patch, color, tinttab70);

for (int i = 1; i <= NUMCARDS; i++)
for (int j = 0; j < NUMCARDS; j++)
Expand Down
2 changes: 2 additions & 0 deletions src/i_colors.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ byte *gold4;
byte *white5;
byte *white25;
byte *white33;
byte *white75;

int FindNearestColor(byte *palette, const byte red, const byte green, const byte blue)
{
Expand Down Expand Up @@ -185,6 +186,7 @@ void FindNearestColors(byte *palette)
white5 = &tinttab5[nearestwhite << 8];
white25 = &tinttab25[nearestwhite << 8];
white33 = &tinttab33[nearestwhite << 8];
white75 = &tinttab75[nearestwhite << 8];
}

int FindBrightDominantColor(patch_t *patch)
Expand Down
1 change: 1 addition & 0 deletions src/i_colors.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ extern byte *gold4;
extern byte *white5;
extern byte *white25;
extern byte *white33;
extern byte *white75;

void I_InitTintTables(byte *palette);
int FindNearestColor(byte *palette, const byte red, const byte green, const byte blue);
Expand Down
26 changes: 16 additions & 10 deletions src/v_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,6 @@ void V_DrawHUDPatch(int x, int y, patch_t *patch, const byte *tinttab)
for (int col = 0; col < width; col++, desttop++)
{
column_t *column = (column_t *)((byte *)patch + LONG(patch->columnoffset[col]));
int yy = y;

// step through the posts in a column
while (column->topdelta != 0xFF)
Expand All @@ -896,9 +895,6 @@ void V_DrawHUDPatch(int x, int y, patch_t *patch, const byte *tinttab)
{
*dest = *source++;
dest += SCREENWIDTH;

if (++yy == SCREENHEIGHT)
break;
}

column = (column_t *)((byte *)column + length + 4);
Expand Down Expand Up @@ -974,7 +970,6 @@ void V_DrawTranslucentHUDPatch(int x, int y, patch_t *patch, const byte *tinttab
for (int col = 0; col < width; col++, desttop++)
{
column_t *column = (column_t *)((byte *)patch + LONG(patch->columnoffset[col]));
int yy = y;

// step through the posts in a column
while (column->topdelta != 0xFF)
Expand All @@ -988,9 +983,6 @@ void V_DrawTranslucentHUDPatch(int x, int y, patch_t *patch, const byte *tinttab
{
*dest = tinttab[(*source++ << 8) + *dest];
dest += SCREENWIDTH;

if (++yy == SCREENHEIGHT)
break;
}

column = (column_t *)((byte *)column + length + 4);
Expand Down Expand Up @@ -1036,21 +1028,28 @@ void V_DrawHUDWeaponPatch(int x, int y, patch_t *patch, int color, const byte *t
for (int col = 0; col < width; col++, desttop--)
{
column_t *column = (column_t *)((byte *)patch + LONG(patch->columnoffset[col]));
int yy = y;

if (x + width - col >= SCREENWIDTH)
continue;

// step through the posts in a column
while (column->topdelta != 0xFF)
{
byte *source = (byte *)column + 3;
byte *dest = &desttop[column->topdelta * SCREENWIDTH];
const byte length = column->length;
byte count = length;

while (count-- > 0)
{
*dest = color;
const byte dot = *source++;

*dest = white75[grays[dot]];
dest += SCREENWIDTH;

if (++yy == SCREENHEIGHT)
break;
}

column = (column_t *)((byte *)column + length + 4);
Expand All @@ -1066,21 +1065,28 @@ void V_DrawTranslucentHUDWeaponPatch(int x, int y, patch_t *patch, int color, co
for (int col = 0; col < width; col++, desttop--)
{
column_t *column = (column_t *)((byte *)patch + LONG(patch->columnoffset[col]));
int yy = y;

if (x + width - col >= SCREENWIDTH)
continue;

// step through the posts in a column
while (column->topdelta != 0xFF)
{
byte *source = (byte *)column + 3;
byte *dest = &desttop[column->topdelta * SCREENWIDTH];
const byte length = column->length;
byte count = length;

while (count-- > 0)
{
*dest = tinttab[(color << 8) + *dest];
const byte dot = *source++;

*dest = tinttab[(white75[grays[dot]] << 8) + *dest];
dest += SCREENWIDTH;

if (++yy == SCREENHEIGHT)
break;
}

column = (column_t *)((byte *)column + length + 4);
Expand Down

0 comments on commit 0333334

Please sign in to comment.