Skip to content

Commit

Permalink
Heretic: Adding A11Y Features: Weapon Flash Lighting & Sprite, Palett…
Browse files Browse the repository at this point in the history
…e Changes, Invul Colormap, Extra Lighting (#1258)

* Heretic: Adding A11Y Extra Lighting

based upon doom solution.

* Heretic: Adding A11Y Weapon Flash Lighting

* Heretic: Adding A11Y Weapon Sprite

* Heretic: Adding A11Y Palette Changes

* Heretic: Adding A11Y Invulnerability Colormap

* Heretic: Fixing Whitespaces

* Heretic: A11Y Setting Colormap to Infrared when no Invul active.

* Heretic: Fixing Whitespaces

* Heretic: Add comments to colormap A11Y overwrite

* Heretic: Change comments and variable for drawing weapon base frames.
  • Loading branch information
Noseey authored Jan 13, 2025
1 parent b0ce5af commit cd6c427
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 27 deletions.
5 changes: 5 additions & 0 deletions src/heretic/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,11 @@ void D_BindVariables(void)
M_BindIntVariable("screenblocks", &screenblocks);
M_BindIntVariable("snd_channels", &snd_Channels);
M_BindIntVariable("a11y_sector_lighting", &a11y_sector_lighting);
M_BindIntVariable("a11y_extra_lighting", &a11y_extra_lighting);
M_BindIntVariable("a11y_weapon_flash", &a11y_weapon_flash);
M_BindIntVariable("a11y_weapon_pspr", &a11y_weapon_pspr);
M_BindIntVariable("a11y_palette_changes", &a11y_palette_changes);
M_BindIntVariable("a11y_invul_colormap", &a11y_invul_colormap);
M_BindIntVariable("vanilla_savegame_limit", &vanilla_savegame_limit);
M_BindIntVariable("vanilla_demo_limit", &vanilla_demo_limit);
M_BindIntVariable("show_endoom", &show_endoom);
Expand Down
21 changes: 20 additions & 1 deletion src/heretic/r_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "r_local.h"
#include "tables.h"
#include "v_video.h" // [crispy] V_DrawFilledBox for HOM detector
#include "a11y.h" // [crispy] A11Y

int viewangleoffset;

Expand Down Expand Up @@ -913,6 +914,7 @@ void R_SetupFrame(player_t * player)
int tableAngle;
int tempCentery;
int pitch; // [crispy]
int tmpColormap; // [crispy] to overwrite colormap

//drawbsp = 1;
viewplayer = player;
Expand Down Expand Up @@ -966,7 +968,16 @@ void R_SetupFrame(player_t * player)
viewy += player->chickenPeck * finesine[tableAngle];
}

// [crispy] A11Y
if (a11y_weapon_flash)
{
extralight = player->extralight;
}
else
extralight = 0;
// [crispy] A11Y
extralight += a11y_extra_lighting;

// [crispy] apply new yslope[] whenever "lookdir", "detailshift" or
// "screenblocks" change
tempCentery = viewheight / 2 + (pitch * (1 << crispy->hires)) *
Expand All @@ -982,7 +993,15 @@ void R_SetupFrame(player_t * player)
sscount = 0;
if (player->fixedcolormap)
{
fixedcolormap = colormaps + player->fixedcolormap
tmpColormap = player->fixedcolormap;
// [crispy] A11Y - overwrite to disable invul-colormap or torch flickering
if ((!a11y_invul_colormap && player->powers[pw_invulnerability]) ||
(!a11y_weapon_flash && player->powers[pw_infrared] && !player->powers[pw_invulnerability]))
{
tmpColormap = 1; // [crispy] A11Y - static infrared map
}

fixedcolormap = colormaps + tmpColormap
* (NUMCOLORMAPS / 32) // [crispy] smooth diminishing lighting
* 256 /* * sizeof(lighttable_t)*/;
walllights = scalelightfixed;
Expand Down
32 changes: 18 additions & 14 deletions src/heretic/r_things.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "r_bmaps.h"
#include "r_local.h"
#include "v_trans.h" // [crispy] blending functions
#include "a11y.h" // [crispy] A11Y

typedef struct
{
Expand Down Expand Up @@ -949,7 +950,7 @@ void R_DrawPSprite(pspdef_t * psp, int psyoffset, int translucent) // [crispy] y
void R_DrawPlayerSprites(void)
{
int i, lightnum;
int tmpframe, offset, translucent = 0; // [crispy] temps for drawing translucent psrites
int tmpframe, offset, drawbase = 0; // [crispy] for drawing base frames
pspdef_t *psp;

//
Expand Down Expand Up @@ -977,11 +978,12 @@ void R_DrawPlayerSprites(void)
{
if (psp->state)
{
// [crispy] Draw offset base frame and translucent current frame
if (crispy->translucency & TRANSLUCENCY_ITEM &&
!(viewplayer->powers[pw_invisibility] > 4*32 || viewplayer->powers[pw_invisibility] & 8))
// [crispy] draw base frame for transparent or deactivated weapon flashes
if (!a11y_weapon_pspr ||
(crispy->translucency & TRANSLUCENCY_ITEM &&
!(viewplayer->powers[pw_invisibility] > 4*32 || viewplayer->powers[pw_invisibility] & 8)))
{
translucent = 1;
drawbase = 1;
tmpframe = psp->state->frame;

switch (psp->state->sprite)
Expand All @@ -996,7 +998,7 @@ void R_DrawPlayerSprites(void)
if (tmpframe == 3)
offset = spriteoffsets[SPR_GWND_F3].offset;
else
translucent = 0;
drawbase = 0;
break;
case SPR_BLSR:
if (tmpframe == 1)
Expand All @@ -1008,7 +1010,7 @@ void R_DrawPlayerSprites(void)
if (tmpframe == 3)
offset = spriteoffsets[SPR_BLSR_F3].offset;
else
translucent = 0;
drawbase = 0;
break;
case SPR_HROD:
if (tmpframe == 1)
Expand All @@ -1020,7 +1022,7 @@ void R_DrawPlayerSprites(void)
if (tmpframe == 6)
offset = spriteoffsets[SPR_HROD_F6].offset;
else
translucent = 0;
drawbase = 0;
break;
case SPR_PHNX:
if (tmpframe == 1)
Expand All @@ -1032,21 +1034,23 @@ void R_DrawPlayerSprites(void)
if (tmpframe == 3)
offset = spriteoffsets[SPR_PHNX_F3].offset;
else
translucent = 0;
drawbase = 0;
break;
default:
offset = 0x0;
translucent = 0;
drawbase = 0;
break;
}
if (translucent && psp->state->sprite != SPR_GAUN)
if (drawbase && psp->state->sprite != SPR_GAUN)
{
psp->state->frame = 0; // draw base frame
psp->state->frame = 0; // set base frame
R_DrawPSprite(psp, offset, 0);
psp->state->frame = tmpframe; // restore frame
psp->state->frame = tmpframe; // restore attack frame
}
}
R_DrawPSprite(psp, 0x0, translucent);
if (!a11y_weapon_pspr && drawbase)
continue; // [crispy] A11Y no weapon flash, use base instead
R_DrawPSprite(psp, 0x0, drawbase); // [crispy] translucent when base was drawn
}
}
}
Expand Down
8 changes: 7 additions & 1 deletion src/heretic/sb_bar.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#ifdef CRISPY_TRUECOLOR
#include "v_trans.h" // [crispy] I_BlendDark()
#endif
#include "a11y.h" // [crispy] A11Y

// Types

Expand Down Expand Up @@ -816,7 +817,12 @@ void SB_PaletteFlash(void)

CPlayer = &players[consoleplayer];

if (CPlayer->damagecount)
// [crispy] A11Y
if (!a11y_palette_changes)
{
palette = 0;
}
else if (CPlayer->damagecount)
{
palette = (CPlayer->damagecount + 7) >> 3;
if (palette >= NUMREDPALS)
Expand Down
17 changes: 6 additions & 11 deletions src/setup/accessibility.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,10 @@ void AccessibilitySettings(TXT_UNCAST_ARG(widget), void *user_data)
TXT_SetWindowHelpURL(window, WINDOW_HELP_URL);

if (gamemission == doom || gamemission == heretic)
{
TXT_AddWidget(window,
TXT_NewCheckBox("Flickering Sector Lighting",
&a11y_sector_lighting));
}

if (gamemission == doom)
{
TXT_AddWidgets(window,
TXT_NewCheckBox("Flickering Sector Lighting",
&a11y_sector_lighting),
TXT_NewCheckBox("Weapon Flash Lighting",
&a11y_weapon_flash),
TXT_NewCheckBox("Weapon Flash Sprite",
Expand All @@ -63,12 +58,12 @@ void AccessibilitySettings(TXT_UNCAST_ARG(widget), void *user_data)

TXT_SetTableColumns(window, 2);

if (gamemission == doom)
if (gamemission == doom || gamemission == heretic)
{
TXT_AddWidgets(window,
TXT_NewLabel("Extra Lighting"),
TXT_NewSpinControl(&a11y_extra_lighting, 0, 8),
NULL);
TXT_NewLabel("Extra Lighting"),
TXT_NewSpinControl(&a11y_extra_lighting, 0, 8),
NULL);
}

}
Expand Down

0 comments on commit cd6c427

Please sign in to comment.