redo translucency options (#1496)

* Rename "Enable Translucency"->"Sprite Translucency"

* Instantly enable/disable translucency for things

* Make a thermo for the translucency percentage

* Remove unnecessary macros

* Remove predefined translucency check

* add S_THRM_PCT flag to show % sign
This commit is contained in:
Roman Fomin 2024-02-20 14:20:39 +07:00 committed by GitHub
parent 30db850d43
commit ab2d35ba75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 10 additions and 63 deletions

View File

@ -33,7 +33,6 @@
#include "p_inter.h"
#include "g_game.h"
#include "d_think.h"
#include "d_main.h" // D_DehChangePredefinedTranslucency()
#include "w_wad.h"
#include "memio.h"
@ -1996,7 +1995,6 @@ void deh_procThing(DEHFILE *fpin, FILE* fpout, char *line)
}
mobjinfo[indexnum].flags = value;
D_DehChangePredefinedTranslucency(indexnum);
break;
case DEH_MOBJINFO_INFIGHTING_GROUP:

View File

@ -288,7 +288,7 @@ void D_Display (void)
wipe = false;
// save the current screen if about to wipe
if (gamestate != wipegamestate && NOTSTRICTMODE(screen_melt))
if (gamestate != wipegamestate && (strictmode || screen_melt))
{
wipe = true;
wipe_StartScreen(0, 0, video.unscaledw, SCREENHEIGHT);
@ -1964,49 +1964,6 @@ void D_SetBloodColor(void)
}
}
static const int predefined_translucency[] = {
// MBF
MT_FIRE, MT_SMOKE, MT_FATSHOT, MT_BRUISERSHOT,
MT_SPAWNFIRE, MT_TROOPSHOT, MT_HEADSHOT, MT_PLASMA,
MT_BFG, MT_ARACHPLAZ, MT_PUFF, MT_TFOG,
MT_IFOG, MT_MISC12, MT_INV, MT_INS,
MT_MEGA,
// [Woof!]
MT_PLASMA1, MT_PLASMA2
};
static boolean deh_set_translucency[arrlen(predefined_translucency)] = {false};
void D_DehChangePredefinedTranslucency(int index)
{
int i;
for (i = 0; i < arrlen(predefined_translucency); ++i)
{
if (predefined_translucency[i] == index)
{
deh_set_translucency[i] = true;
break;
}
}
}
void D_SetPredefinedTranslucency(void)
{
int i;
for (i = 0; i < arrlen(predefined_translucency); ++i)
{
if (deh_set_translucency[i])
continue;
if (STRICTMODE_VANILLA(translucency))
mobjinfo[predefined_translucency[i]].flags |= MF_TRANSLUCENT;
else
mobjinfo[predefined_translucency[i]].flags &= ~MF_TRANSLUCENT;
}
}
// killough 2/22/98: Add support for ENDBOOM, which is PC-specific
// killough 8/1/98: change back to ENDOOM

View File

@ -41,8 +41,6 @@ extern boolean clfastparm; // checkparm of -fast
void D_SetMaxHealth(void);
void D_SetBloodColor(void);
void D_SetPredefinedTranslucency(void);
void D_DehChangePredefinedTranslucency(int index);
boolean D_CheckEndDoom(void);

View File

@ -316,12 +316,8 @@ extern boolean strictmode, default_strictmode;
#define STRICTMODE(x) (strictmode ? 0 : (x))
#define NOTSTRICTMODE(x) (strictmode ? 1 : (x))
#define STRICTMODE_COMP(x) (strictmode ? comp[x] : default_comp[x])
#define STRICTMODE_VANILLA(x) (strictmode && demo_compatibility ? 0 : (x))
extern boolean critical;
#define CRITICAL(x) (critical || strictmode ? 0 : (x))

View File

@ -3320,8 +3320,6 @@ void G_ReloadDefaults(boolean keep_demover)
D_SetBloodColor();
D_SetPredefinedTranslucency();
if (!mbf21)
{
// Set new compatibility options

View File

@ -746,7 +746,6 @@ static void cheat_tran()
{
displaymsg( // Ty 03/27/98 - *not* externalized
(translucency = !translucency) ? "Translucency enabled" : "Translucency disabled");
D_SetPredefinedTranslucency();
}
static void cheat_massacre() // jff 2/01/98 kill all monsters

View File

@ -2442,8 +2442,10 @@ static void M_DrawSetting(setup_menu_t *s, int accum_y)
if (strings)
strcpy(menu_buffer, strings[value]);
else if (flags & S_THRM_PCT)
M_snprintf(menu_buffer, sizeof(menu_buffer), "%d%%", value);
else
M_snprintf(menu_buffer, 4, "%d", value);
M_snprintf(menu_buffer, sizeof(menu_buffer), "%d", value);
BlinkingArrowRight(s);
M_DrawMenuStringEx(flags, x + M_THRM_STEP + rect->w, y + M_THRM_TXT_OFFSET, color);
@ -4134,13 +4136,12 @@ setup_menu_t gen_settings5[] = {
{"Smooth Pixel Scaling", S_YESNO, m_null, M_X, M_Y,
{"smooth_scaling"}, 0, M_ResetScreen},
{"Enable Translucency", S_YESNO|S_STRICT, m_null, M_X, M_SPC,
{"translucency"}, 0, M_Trans},
{"Sprite Translucency", S_YESNO|S_STRICT, m_null, M_X, M_SPC, {"translucency"}},
{"Translucency Percent", S_NUM, m_null, M_X, M_SPC,
{"Translucency", S_THERMO|S_ACTION|S_THRM_PCT, m_null, M_X_THRM8, M_SPC,
{"tran_filter_pct"}, 0, M_Trans},
{"", S_SKIP, m_null, M_X, M_SPC},
{"", S_SKIP, m_null, M_X, M_THRM_SPC},
{"Voxels", S_YESNO|S_STRICT, m_null, M_X, M_SPC, {"voxels_rendering"}},
@ -4204,8 +4205,6 @@ setup_menu_t gen_settings6[] = {
void M_Trans(void) // To reset translucency after setting it in menu
{
R_InitTranMap(0);
D_SetPredefinedTranslucency();
}
// Setting up for the General screen. Turn on flags, set pointers,

View File

@ -109,6 +109,7 @@ void M_DisableVoxelsRenderingItem(void);
#define S_ONOFF 0x08000000 // Alias for S_YESNO
#define S_MBF 0x10000000 // Disable if complevel < mbf
#define S_THRM_SIZE4 0x20000000 // Thermo bar size 4
#define S_THRM_PCT 0x40000000 // Show % sign
// S_SHOWDESC = the set of items whose description should be displayed
// S_SHOWSET = the set of items whose setting should be displayed

View File

@ -433,7 +433,8 @@ void R_DrawVisSprite(vissprite_t *vis, int x1, int x2)
((vis->mobjflags & MF_TRANSLATION) >> (MF_TRANSSHIFT-8) );
}
else
if (vis->mobjflags & MF_TRANSLUCENT) // phares
if (translucency && !(strictmode && demo_compatibility)
&& vis->mobjflags & MF_TRANSLUCENT) // phares
{
colfunc = R_DrawTLColumn;
tranmap = main_tranmap; // killough 4/11/98