Skip to content

Commit

Permalink
Merge branch 'fabiangreffrath:master' into a11y_Flickering_Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Noseey authored Jan 2, 2025
2 parents afb7c68 + ccdea7c commit d216b00
Show file tree
Hide file tree
Showing 9 changed files with 304 additions and 102 deletions.
1 change: 1 addition & 0 deletions src/heretic/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,7 @@ void D_BindVariables(void)
M_BindIntVariable("crispy_secretmessage", &crispy->secretmessage);
M_BindIntVariable("crispy_smoothlight", &crispy->smoothlight);
M_BindIntVariable("crispy_soundmono", &crispy->soundmono);
M_BindIntVariable("crispy_translucency", &crispy->translucency);
#ifdef CRISPY_TRUECOLOR
M_BindIntVariable("crispy_truecolor", &crispy->truecolor);
#endif
Expand Down
1 change: 1 addition & 0 deletions src/heretic/doomdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ typedef struct

#define MF_TRANSLATION 0xc000000 // if 0x4 0x8 or 0xc, use a translation
#define MF_TRANSSHIFT 26 // table for player colormaps
#define MF_TRANSLUCENT 0x80000000 // [crispy] translucent sprite

// --- mobj.flags2 ---

Expand Down
132 changes: 66 additions & 66 deletions src/heretic/info.c

Large diffs are not rendered by default.

110 changes: 81 additions & 29 deletions src/heretic/mn_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ typedef enum
MENU_MOUSE,
MENU_CRISPNESS1,
MENU_CRISPNESS2,
MENU_CRISPNESS3,
MENU_NONE
} MenuType_t;

Expand Down Expand Up @@ -133,6 +134,7 @@ static boolean CrispySmoothing(int option);
static boolean CrispyBrightmaps(int option);
static boolean CrispySmoothLighting(int option);
static boolean CrispySoundMono(int option);
static boolean CrispyTranslucency(int option);
static boolean CrispySndChannels(int option);
static boolean CrispyAutomapStats(int option);
static boolean CrispyLevelTime(int option);
Expand Down Expand Up @@ -163,6 +165,7 @@ static void DrawMouseMenu(void);
static void DrawCrispness(void);
static void DrawCrispness1(void);
static void DrawCrispness2(void);
static void DrawCrispness3(void);
void MN_LoadSlotText(void);

// External Functions
Expand Down Expand Up @@ -359,7 +362,7 @@ static Menu_t Options2Menu = {

static int crispnessmenupage;

#define NUM_CRISPNESS_MENUS 2
#define NUM_CRISPNESS_MENUS 3

static MenuItem_t Crispness1Items[] = {
{ITT_LRFUNC2, "HIGH RESOLUTION RENDERING:", CrispyHires, 0, MENU_NONE},
Expand All @@ -372,54 +375,80 @@ static MenuItem_t Crispness1Items[] = {
{ITT_EMPTY, NULL, NULL, 0, MENU_NONE},
{ITT_LRFUNC2, "APPLY BRIGHTMAPS TO:", CrispyBrightmaps, 0, MENU_NONE},
{ITT_LRFUNC2, "SMOOTH DIMINISHING LIGHTING:", CrispySmoothLighting, 0, MENU_NONE},
{ITT_EMPTY, NULL, NULL, 0, MENU_NONE},
{ITT_EMPTY, NULL, NULL, 0, MENU_NONE},
{ITT_LRFUNC2, "MONO SFX:", CrispySoundMono, 0, MENU_NONE},
{ITT_LRFUNC2, "SOUND CHANNELS:", CrispySndChannels, 0, MENU_NONE},
{ITT_LRFUNC2, "ENABLE TRANSLUCENCY:", CrispyTranslucency, 0, MENU_NONE},
{ITT_EMPTY, NULL, NULL, 0, MENU_NONE},
{ITT_EFUNC, "NEXT PAGE", CrispyNextPage, 0, MENU_NONE},
{ITT_EFUNC, "LAST PAGE", CrispyPrevPage, 0, MENU_NONE},
};

static Menu_t Crispness1Menu = {
68, 35,
DrawCrispness,
16, Crispness1Items,
14, Crispness1Items,
0,
MENU_OPTIONS
};

static MenuItem_t Crispness2Items[] = {
{ITT_LRFUNC2, "MONO SFX:", CrispySoundMono, 0, MENU_NONE},
{ITT_LRFUNC2, "SOUND CHANNELS:", CrispySndChannels, 0, MENU_NONE},
{ITT_EMPTY, NULL, NULL, 0, MENU_NONE},
{ITT_EMPTY, NULL, NULL, 0, MENU_NONE},
{ITT_LRFUNC2, "SHOW LEVEL STATS:", CrispyAutomapStats, 0, MENU_NONE},
{ITT_LRFUNC2, "SHOW LEVEL TIME:", CrispyLevelTime, 0, MENU_NONE},
{ITT_LRFUNC2, "SHOW PLAYER COORDS:", CrispyPlayerCoords, 0, MENU_NONE},
{ITT_LRFUNC2, "REPORT REVEALED SECRETS:", CrispySecretMessage, 0, MENU_NONE},
{ITT_EMPTY, NULL, NULL, 0, MENU_NONE},
{ITT_EMPTY, NULL, NULL, 0, MENU_NONE},
{ITT_EMPTY, NULL, NULL, 0, MENU_NONE},
{ITT_EMPTY, NULL, NULL, 0, MENU_NONE},
{ITT_EFUNC, "NEXT PAGE", CrispyNextPage, 0, MENU_NONE},
{ITT_EFUNC, "PREV PAGE", CrispyPrevPage, 0, MENU_NONE},
};

static Menu_t Crispness2Menu = {
68, 35,
DrawCrispness,
14, Crispness2Items,
0,
MENU_OPTIONS
};

static MenuItem_t Crispness3Items[] = {
{ITT_LRFUNC2, "FREELOOK MODE:", CrispyFreelook, 0, MENU_NONE},
{ITT_LRFUNC2, "PERMANENT MOUSELOOK:", CrispyMouselook, 0, MENU_NONE},
{ITT_LRFUNC2, "PLAYER VIEW/WEAPON BOBBING:", CrispyBobfactor, 0, MENU_NONE},
{ITT_LRFUNC2, "WEAPON ATTACK ALIGNMENT:", CrispyCenterWeapon, 0, MENU_NONE},
{ITT_LRFUNC2, "DEFAULT DIFFICULTY:", CrispyDefaultskill, 0, MENU_NONE},
{ITT_EMPTY, NULL, NULL, 0, MENU_NONE},
{ITT_EMPTY, NULL, NULL, 0, MENU_NONE},
{ITT_EMPTY, NULL, NULL, 0, MENU_NONE},
{ITT_EMPTY, NULL, NULL, 0, MENU_NONE},
{ITT_EMPTY, NULL, NULL, 0, MENU_NONE},
{ITT_EMPTY, NULL, NULL, 0, MENU_NONE},
{ITT_EMPTY, NULL, NULL, 0, MENU_NONE},
{ITT_EFUNC, "FIRST PAGE", CrispyNextPage, 0, MENU_NONE},
{ITT_EFUNC, "PREV PAGE", CrispyPrevPage, 0, MENU_NONE},
};

static Menu_t Crispness2Menu = {
static Menu_t Crispness3Menu = {
68, 35,
DrawCrispness,
13, Crispness2Items,
14, Crispness3Items,
0,
MENU_OPTIONS
};

static void (*CrispnessMenuDrawers[])(void) = {
&DrawCrispness1,
&DrawCrispness2,
&DrawCrispness3,
};

static MenuType_t CrispnessMenus[] = {
MENU_CRISPNESS1,
MENU_CRISPNESS2,
MENU_CRISPNESS3,
};

static const multiitem_t multiitem_bobfactor[NUM_BOBFACTORS] =
Expand Down Expand Up @@ -483,6 +512,14 @@ static const multiitem_t multiitem_difficulties[NUM_SKILLS] =
{SKILL_HNTR, "YELLOWBELLIES"},
};

multiitem_t multiitem_translucency[NUM_TRANSLUCENCY] =
{
{TRANSLUCENCY_OFF, "OFF"},
{TRANSLUCENCY_MISSILE, "PROJECTILES"},
{TRANSLUCENCY_ITEM, "WEAPON FLASHES"},
{TRANSLUCENCY_BOTH, "BOTH"},
};

static const multiitem_t multiitem_sndchannels[3] =
{
{8, "8"},
Expand All @@ -502,6 +539,7 @@ static Menu_t *Menus[] = {
&MouseMenu,
&Crispness1Menu,
&Crispness2Menu,
&Crispness3Menu,
};

// [crispy] gamma correction messages
Expand Down Expand Up @@ -1735,6 +1773,12 @@ static boolean CrispySoundMono(int option)
return true;
}

static boolean CrispyTranslucency(int choice)
{
ChangeSettingEnum(&crispy->translucency, choice, NUM_TRANSLUCENCY);
return true;
}

static boolean CrispySndChannels(int option)
{
S_UpdateSndChannels(option);
Expand Down Expand Up @@ -2980,7 +3024,7 @@ static void DrawCrispnessNumericItem(int item, int x, int y, const char *zero,

static void DrawCrispness1(void)
{
DrawCrispnessHeader("CRISPNESS 1/2");
DrawCrispnessHeader("CRISPNESS 1/3");

DrawCrispnessSubheader("RENDERING", 25);

Expand Down Expand Up @@ -3010,47 +3054,55 @@ static void DrawCrispness1(void)
// Smooth Diminishing Lighting
DrawCrispnessItem(crispy->smoothlight, 257, 125);

DrawCrispnessSubheader("AUDIBLE", 145);

// Mono SFX
DrawCrispnessItem(crispy->soundmono, 137, 155);

// Sound Channels
DrawCrispnessMultiItem(snd_Channels >> 4, 181, 165, multiitem_sndchannels, false);
// Translucency
DrawCrispnessMultiItem(crispy->translucency, 218, 135, multiitem_translucency, false);
}

static void DrawCrispness2(void)
{
DrawCrispnessHeader("CRISPNESS 2/2");
DrawCrispnessHeader("CRISPNESS 2/3");

DrawCrispnessSubheader("AUDIBLE", 25);

// Mono SFX
DrawCrispnessItem(crispy->soundmono, 137, 35);

DrawCrispnessSubheader("NAVIGATIONAL", 25);
// Sound Channels
DrawCrispnessMultiItem(snd_Channels >> 4, 181, 45, multiitem_sndchannels, false);

DrawCrispnessSubheader("NAVIGATIONAL", 65);

// Show level stats
DrawCrispnessMultiItem(crispy->automapstats, 190, 35, multiitem_widgets, false);
DrawCrispnessMultiItem(crispy->automapstats, 190, 75, multiitem_widgets, false);

// Show level time
DrawCrispnessMultiItem(crispy->leveltime, 179, 45, multiitem_widgets, false);
DrawCrispnessMultiItem(crispy->leveltime, 179, 85, multiitem_widgets, false);
// Show player coords
DrawCrispnessMultiItem(crispy->playercoords, 211, 55, multiitem_widgets, false);
DrawCrispnessMultiItem(crispy->playercoords, 211, 95, multiitem_widgets, false);

// Show secret message
DrawCrispnessMultiItem(crispy->secretmessage, 250, 65, multiitem_secretmessage, false);
DrawCrispnessMultiItem(crispy->secretmessage, 250, 105, multiitem_secretmessage, false);
}

DrawCrispnessSubheader("TACTICAL", 85);
static void DrawCrispness3(void)
{
DrawCrispnessHeader("CRISPNESS 3/3");

DrawCrispnessSubheader("TACTICAL", 25);

// Freelook
DrawCrispnessMultiItem(crispy->freelook_hh, 175, 95, multiitem_freelook_hh, false);
DrawCrispnessMultiItem(crispy->freelook_hh, 175, 35, multiitem_freelook_hh, false);

// Mouselook
DrawCrispnessItem(crispy->mouselook, 220, 105);
DrawCrispnessItem(crispy->mouselook, 220, 45);

// Bobfactor
DrawCrispnessMultiItem(crispy->bobfactor, 265, 115, multiitem_bobfactor, false);
DrawCrispnessMultiItem(crispy->bobfactor, 265, 55, multiitem_bobfactor, false);

// Weapon attack alignment
DrawCrispnessMultiItem(crispy->centerweapon, 245, 125, multiitem_centerweapon,
DrawCrispnessMultiItem(crispy->centerweapon, 245, 65, multiitem_centerweapon,
crispy->bobfactor == BOBFACTOR_OFF);

// Default difficulty
DrawCrispnessMultiItem(crispy->defaultskill, 200, 135, multiitem_difficulties, false);
}
DrawCrispnessMultiItem(crispy->defaultskill, 200, 75, multiitem_difficulties, false);
}
16 changes: 15 additions & 1 deletion src/heretic/p_enemy.c
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,11 @@ void A_Look(mobj_t *actor, player_t *player, pspdef_t *psp)
else
goto seeyou;
}

// [crispy] Undo Mummyleader translucency
if (actor->type == MT_MUMMYLEADER)
{
actor->flags &= ~MF_TRANSLUCENT;
}

if (!P_LookForPlayers(actor, false))
return;
Expand Down Expand Up @@ -701,6 +705,11 @@ void A_Chase(mobj_t *actor, player_t *player, pspdef_t *psp)
actor->tics = 3;
}
}
// [crispy] Undo Mummyleader translucency
if (actor->type == MT_MUMMYLEADER)
{
actor->flags &= ~MF_TRANSLUCENT;
}

//
// turn towards movement direction if not there yet
Expand Down Expand Up @@ -822,6 +831,11 @@ void A_FaceTarget(mobj_t *actor, player_t *player, pspdef_t *psp)
{ // Target is a ghost
actor->angle += P_SubRandom() << 21;
}
// [crispy] Charging-up Mummyleaders are translucent in that state (blinking)
if (actor->type == MT_MUMMYLEADER)
{
actor->flags |= MF_TRANSLUCENT;
}
}

//----------------------------------------------------------------------------
Expand Down
9 changes: 9 additions & 0 deletions src/heretic/p_inter.c
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,15 @@ void P_KillMobj(mobj_t * source, mobj_t * target)
return;
}
}

// [crispy] Exploding Goo-Pods are translucent
if (target->type == MT_POD)
target->flags |= MF_TRANSLUCENT;

// [crispy] Undo Mummyleader translucency
if (target->type == MT_MUMMYLEADER)
target->flags &= ~MF_TRANSLUCENT;

if (target->health < -(target->info->spawnhealth >> 1)
&& target->info->xdeathstate)
{ // Extreme death
Expand Down
Loading

0 comments on commit d216b00

Please sign in to comment.