Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TrueColor: add ingame toggler #1225

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/doom/m_crispy.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,29 @@ void M_CrispyToggleTranslucency(int choice)
ChangeSettingEnum(&crispy->translucency, choice, NUM_TRANSLUCENCY);
}

#ifdef CRISPY_TRUECOLOR
static void M_CrispyToggleTrueColorHook (void)
{
crispy->truecolor = !crispy->truecolor;

// [crispy] re-calculate amount of colormaps and light tables
R_InitColormaps();
// [crispy] re-calculate the zlight[][] array
R_InitLightTables();
// [crispy] re-calculate the scalelight[][] array
R_ExecuteSetViewSize();
// [crispy] re-calculate fake contrast
P_SegLengths(true);
}

void M_CrispyToggleTrueColor(int choice)
{
choice = 0;

crispy->post_rendering_hook = M_CrispyToggleTrueColorHook;
}
#endif

void M_CrispyToggleUncapped(int choice)
{
choice = 0;
Expand Down
1 change: 1 addition & 0 deletions src/doom/m_crispy.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ extern void M_CrispyToggleSoundfixes(int choice);
extern void M_CrispyToggleSoundMono(int choice);
extern void M_CrispyToggleStatsFormat(int choice);
extern void M_CrispyToggleTranslucency(int choice);
extern void M_CrispyToggleTrueColor(int choice);
extern void M_CrispyToggleUncapped(int choice);
extern void M_CrispyToggleVsync(int choice);
extern void M_CrispyToggleWidescreen(int choice);
Expand Down
17 changes: 9 additions & 8 deletions src/doom/m_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,13 +462,15 @@ static menu_t MouseDef =
enum
{
crispness_sep_rendering,
#ifdef CRISPY_TRUECOLOR
crispness_truecolor,
#endif
crispness_hires,
crispness_widescreen,
crispness_uncapped,
crispness_fpslimit,
crispness_vsync,
crispness_smoothscaling,
crispness_sep_rendering_,

crispness_sep_visual,
crispness_coloredhud,
Expand All @@ -487,14 +489,16 @@ enum
static menuitem_t Crispness1Menu[]=
{
{-1,"",0,'\0'},
#ifdef CRISPY_TRUECOLOR
{3,"", M_CrispyToggleTrueColor,'t'},
#endif
{3,"", M_CrispyToggleHires,'h'},
{3,"", M_CrispyToggleWidescreen,'w'},
{3,"", M_CrispyToggleUncapped,'u'},
{4,"", M_CrispyToggleFpsLimit,'f'},
{3,"", M_CrispyToggleVsync,'v'},
{3,"", M_CrispyToggleSmoothScaling,'s'},
{-1,"",0,'\0'},
{-1,"",0,'\0'},
{3,"", M_CrispyToggleColoredhud,'c'},
{3,"", M_CrispyToggleTranslucency,'e'},
{3,"", M_CrispyToggleSmoothLighting,'s'},
Expand Down Expand Up @@ -523,7 +527,6 @@ enum
crispness_soundfix,
crispness_sndchannels,
crispness_soundmono,
crispness_sep_audible_,

crispness_sep_navigational,
crispness_extautomap,
Expand All @@ -548,7 +551,6 @@ static menuitem_t Crispness2Menu[]=
{3,"", M_CrispyToggleSndChannels,'s'},
{3,"", M_CrispyToggleSoundMono,'m'},
{-1,"",0,'\0'},
{-1,"",0,'\0'},
{3,"", M_CrispyToggleExtAutomap,'e'},
{3,"", M_CrispyToggleSmoothMap,'m'},
{3,"", M_CrispyToggleAutomapstats,'s'},
Expand Down Expand Up @@ -581,7 +583,6 @@ enum
crispness_pitch,
crispness_neghealth,
crispness_defaultskill,
crispness_sep_tactical_,

crispness_sep_crosshair,
crispness_crosshair,
Expand All @@ -606,7 +607,6 @@ static menuitem_t Crispness3Menu[]=
{3,"", M_CrispyToggleNeghealth,'n'},
{3,"", M_CrispyToggleDefaultSkill,'d'},
{-1,"",0,'\0'},
{-1,"",0,'\0'},
{3,"", M_CrispyToggleCrosshair,'d'},
{3,"", M_CrispyToggleCrosshairtype,'c'},
{3,"", M_CrispyToggleCrosshairHealth,'c'},
Expand All @@ -632,7 +632,6 @@ enum
crispness_freeaim,
crispness_jumping,
crispness_overunder,
crispness_sep_physical_,

crispness_sep_demos,
crispness_demotimer,
Expand All @@ -654,7 +653,6 @@ static menuitem_t Crispness4Menu[]=
{3,"", M_CrispyToggleJumping,'a'},
{3,"", M_CrispyToggleOverunder,'w'},
{-1,"",0,'\0'},
{-1,"",0,'\0'},
{3,"", M_CrispyToggleDemoTimer,'v'},
{3,"", M_CrispyToggleDemoTimerDir,'a'},
{3,"", M_CrispyToggleDemoBar,'w'},
Expand Down Expand Up @@ -1564,6 +1562,9 @@ static void M_DrawCrispness1(void)
M_DrawCrispnessHeader("Crispness 1/4");

M_DrawCrispnessSeparator(crispness_sep_rendering, "Rendering");
#ifdef CRISPY_TRUECOLOR
M_DrawCrispnessItem(crispness_truecolor, "TrueColor Rendering", crispy->truecolor, true);
#endif
M_DrawCrispnessItem(crispness_hires, "High Resolution Rendering", crispy->hires, true);
M_DrawCrispnessMultiItem(crispness_widescreen, "Aspect Ratio", multiitem_widescreen, crispy->widescreen, aspect_ratio_correct == 1);
M_DrawCrispnessItem(crispness_uncapped, "Uncapped Framerate", crispy->uncapped, true);
Expand Down
90 changes: 65 additions & 25 deletions src/heretic/mn_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#define LEFT_DIR 0
#define RIGHT_DIR 1
#define ENTER_NUMBER 2 // [crispy] numeric entry
#define ITEM_HEIGHT_SML 10 // [crispy] smaller vertical spacing for small font
#define ITEM_HEIGHT 20
#define SELECTOR_XOFFSET (-28)
#define SELECTOR_YOFFSET (-1)
Expand Down Expand Up @@ -127,6 +128,9 @@ static boolean SCSaveGame(int option);
static boolean SCMessages(int option);
static boolean SCEndGame(int option);
static boolean SCInfo(int option);
#ifdef CRISPY_TRUECOLOR
static boolean CrispyTrueColor(int option);
#endif
static boolean CrispyHires(int option);
static boolean CrispyToggleWidescreen(int option);
static boolean CrispySmoothing(int option);
Expand Down Expand Up @@ -361,19 +365,26 @@ static int crispnessmenupage;

#define NUM_CRISPNESS_MENUS 2

#ifndef CRISPY_TRUECOLOR
#define NUM_CRISPNESS1_ITEMS 14
#else
#define NUM_CRISPNESS1_ITEMS 15
#endif

static MenuItem_t Crispness1Items[] = {
#ifdef CRISPY_TRUECOLOR
{ITT_LRFUNC2, "TRUECOLOR RENDERING:", CrispyTrueColor, 0, MENU_NONE},
#endif
{ITT_LRFUNC2, "HIGH RESOLUTION RENDERING:", CrispyHires, 0, MENU_NONE},
{ITT_LRFUNC2, "ASPECT RATIO:", CrispyToggleWidescreen, 0, MENU_NONE},
{ITT_LRFUNC2, "SMOOTH PIXEL SCALING:", CrispySmoothing, 0, MENU_NONE},
{ITT_LRFUNC2, "UNCAPPED FRAMERATE:", CrispyUncapped, 0, MENU_NONE},
{ITT_NUMFUNC, "FRAMERATE LIMIT:", CrispyFpsLimit, 0, MENU_NONE},
{ITT_LRFUNC2, "ENABLE VSYNC:", CrispyVsync, 0, MENU_NONE},
{ITT_EMPTY, NULL, NULL, 0, MENU_NONE},
{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_EMPTY, NULL, NULL, 0, MENU_NONE},
Expand All @@ -383,7 +394,7 @@ static MenuItem_t Crispness1Items[] = {
static Menu_t Crispness1Menu = {
68, 35,
DrawCrispness,
16, Crispness1Items,
NUM_CRISPNESS1_ITEMS, Crispness1Items,
0,
MENU_OPTIONS
};
Expand All @@ -394,7 +405,6 @@ static MenuItem_t Crispness2Items[] = {
{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_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},
Expand All @@ -407,7 +417,7 @@ static MenuItem_t Crispness2Items[] = {
static Menu_t Crispness2Menu = {
68, 35,
DrawCrispness,
13, Crispness2Items,
12, Crispness2Items,
0,
MENU_OPTIONS
};
Expand Down Expand Up @@ -873,7 +883,7 @@ void MN_Drawer(void)
if (CurrentMenu->drawFunc == DrawCrispness)
{
// [JN] Crispness menu: use 10px vertical spacing for small font
y += ITEM_HEIGHT/2;
y += ITEM_HEIGHT_SML;
}
else
{
Expand All @@ -885,7 +895,7 @@ void MN_Drawer(void)
{
// [JN] Crispness menu: use small blue gem instead of big red arrow.
// Blinks a bit faster and shifted right, closer to the text.
y = CurrentMenu->y + (CurrentItPos * (ITEM_HEIGHT/2)) + SELECTOR_YOFFSET;
y = CurrentMenu->y + (CurrentItPos * (ITEM_HEIGHT_SML)) + SELECTOR_YOFFSET;
selName = DEH_String(MenuTime & 8 ? "INVGEMR1" : "INVGEMR2");
V_DrawPatch(x + (SELECTOR_XOFFSET/2), y,
W_CacheLumpName(selName, PU_CACHE));
Expand Down Expand Up @@ -1581,6 +1591,28 @@ static void ChangeSettingEnum(int *setting, int option, int num_values)
*setting %= num_values;
}

#ifdef CRISPY_TRUECOLOR
static void CrispyTrueColorHook(void)
{
crispy->truecolor = !crispy->truecolor;
// [crispy] re-calculate amount of colormaps and light tables
R_InitColormaps();
// [crispy] re-calculate the zlight[][] array
R_InitLightTables();
// [crispy] re-calculate the scalelight[][] array
R_ExecuteSetViewSize();
// [crispy] re-calculate fake contrast
P_SegLengths(true);
}

static boolean CrispyTrueColor(int option)
{
crispy->post_rendering_hook = CrispyTrueColorHook;

return true;
}
#endif

static void CrispyHiresHook(void)
{
crispy->hires = !crispy->hires;
Expand Down Expand Up @@ -2980,43 +3012,51 @@ static void DrawCrispnessNumericItem(int item, int x, int y, const char *zero,

static void DrawCrispness1(void)
{
int line_shift = 0;

DrawCrispnessHeader("CRISPNESS 1/2");

DrawCrispnessSubheader("RENDERING", 25);

#ifdef CRISPY_TRUECOLOR
// TrueColor rendering
DrawCrispnessItem(crispy->truecolor, 217, 35);
line_shift += ITEM_HEIGHT_SML;
#endif

// Hires rendering
DrawCrispnessItem(crispy->hires, 254, 35);
DrawCrispnessItem(crispy->hires, 254, 35 + line_shift);

// Widescreen
DrawCrispnessMultiItem(crispy->widescreen, 164, 45, multiitem_widescreen, false);
DrawCrispnessMultiItem(crispy->widescreen, 164, 45 + line_shift, multiitem_widescreen, false);

// Smooth pixel scaling
DrawCrispnessItem(crispy->smoothscaling, 216, 55);
DrawCrispnessItem(crispy->smoothscaling, 216, 55 + line_shift);

// Uncapped framerate
DrawCrispnessItem(crispy->uncapped, 217, 65);
DrawCrispnessItem(crispy->uncapped, 217, 65 + line_shift);

// Framerate limit
DrawCrispnessNumericItem(crispy->fpslimit, 181, 75, "NONE", !crispy->uncapped, "35");
DrawCrispnessNumericItem(crispy->fpslimit, 181, 75 + line_shift, "NONE", !crispy->uncapped, "35");

// Vsync
DrawCrispnessItem(crispy->vsync, 167, 85);
DrawCrispnessItem(crispy->vsync, 167, 85 + line_shift);

DrawCrispnessSubheader("VISUAL", 105);
DrawCrispnessSubheader("VISUAL", 95 + line_shift);

// Brightmaps
DrawCrispnessMultiItem(crispy->brightmaps, 213, 115, multiitem_brightmaps, false);
DrawCrispnessMultiItem(crispy->brightmaps, 213, 105 + line_shift, multiitem_brightmaps, false);

// Smooth Diminishing Lighting
DrawCrispnessItem(crispy->smoothlight, 257, 125);
DrawCrispnessItem(crispy->smoothlight, 257, 115 + line_shift);

DrawCrispnessSubheader("AUDIBLE", 145);
DrawCrispnessSubheader("AUDIBLE", 125 + line_shift);

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

// Sound Channels
DrawCrispnessMultiItem(snd_Channels >> 4, 181, 165, multiitem_sndchannels, false);
DrawCrispnessMultiItem(snd_Channels >> 4, 181, 145 + line_shift, multiitem_sndchannels, false);
}

static void DrawCrispness2(void)
Expand All @@ -3036,21 +3076,21 @@ static void DrawCrispness2(void)
// Show secret message
DrawCrispnessMultiItem(crispy->secretmessage, 250, 65, multiitem_secretmessage, false);

DrawCrispnessSubheader("TACTICAL", 85);
DrawCrispnessSubheader("TACTICAL", 75);

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

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

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

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

// Default difficulty
DrawCrispnessMultiItem(crispy->defaultskill, 200, 135, multiitem_difficulties, false);
DrawCrispnessMultiItem(crispy->defaultskill, 200, 125, multiitem_difficulties, false);
}
Loading
Loading