-
Notifications
You must be signed in to change notification settings - Fork 37
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
support BRGHTMPS lump from Doom Retro #846
Conversation
Thanks for starting the work on this! I wonder if we should parametrize our internal default values in a similar way? |
Add |
I'm not convinced of using the autoload folder for such features. Think of all the I think we should handle it as we do for colored blood. Provide an internal default and if a PWAD provides its own, use this without asking. |
That's why we have
This is how it works in the current PR. Maybe we should somehow reorganize the data in |
Hm, true.
That's exactly what I wanted to suggest in the first place. 😁 |
You can still disable the feature even if the lump is provided. I think this is handled different for blood color and thing translucency.
Not sure if this works for anything else than texture brightmaps, though. |
Could you try this? diff --git a/src/m_menu.c b/src/m_menu.c
index cd203da..19c5ec1 100644
--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -4030,12 +4030,13 @@ enum {
static void M_UpdateStrictModeItems(void)
{
extern boolean deh_set_blood_color;
+ boolean wad_set_brightmaps = (W_CheckNumForName("BRGHTMPS") >= 0);
// map_player_coords
DISABLE_STRICT(auto_settings1[auto1_coords]);
DISABLE_ITEM(strictmode || deh_set_blood_color, enem_settings1[enem1_colored_blood]);
DISABLE_STRICT(enem_settings1[enem1_flipcorpses]);
DISABLE_STRICT(gen_settings4[gen4_realtic]);
- DISABLE_STRICT(gen_settings2[gen2_brightmaps]);
+ DISABLE_ITEM(strictmode || wad_set_brightmaps, gen_settings2[gen2_brightmaps]);
DISABLE_STRICT(gen_settings3[gen3_level_brightness]);
DISABLE_ITEM(strictmode && demo_compatibility, gen_settings1[gen1_trans]);
DISABLE_STRICT(gen_settings3[gen3_palette_changes]);
diff --git a/src/m_misc.c b/src/m_misc.c
index 7527c1e..c9f678d 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -106,7 +106,7 @@ extern int opl_gain;
extern int midi_player_menu;
extern boolean demobar;
extern boolean smoothlight;
-extern boolean brightmaps;
+extern boolean default_brightmaps;
extern boolean r_swirl;
extern int death_use_action;
extern boolean palette_changes;
@@ -260,7 +260,7 @@ default_t defaults[] = {
{
"brightmaps",
- (config_t *) &brightmaps, NULL,
+ (config_t *) &default_brightmaps, NULL,
{0}, {0,1}, number, ss_gen, wad_yes,
"1 to enable brightmaps for textures and sprites"
},
diff --git a/src/r_bmaps.c b/src/r_bmaps.c
index cfd234c..76ff7b1 100644
--- a/src/r_bmaps.c
+++ b/src/r_bmaps.c
@@ -26,7 +26,7 @@
#include "m_misc2.h"
#include "u_scanner.h"
-int brightmaps;
+int brightmaps, default_brightmaps;
// [crispy] brightmap data
@@ -1093,6 +1093,9 @@ static const byte *R_BrightmapForTexName_Lump(const char *texname)
void R_InitBrightmaps ()
{
int lump = W_CheckNumForName("BRGHTMPS");
+
+ brightmaps = default_brightmaps;
+
if (lump >= 0)
{
const char *data = W_CacheLumpNum(lump, PU_CACHE);
@@ -1104,6 +1107,9 @@ void R_InitBrightmaps ()
R_BrightmapForSprite = R_BrightmapForSprite_None;
R_BrightmapForFlatNum = R_BrightmapForFlatNum_None;
R_BrightmapForState = R_BrightmapForState_None;
+
+ brightmaps = true;
+
return;
} |
Wait, no, there must be some bug in the patch, without it the switch works fine. I have a feeling we have already redesigned the |
Oh, right. We should improve on that. |
No, without a patch it seems to work fine. I suggest we defer the "bloodcolor-like" logic after we revisit the |
Well, okay. |
@bradharding, @rfomin yours attention is needed, It happens same way in DR too. If I have this lump structure, it works just fine:
Hovewer, if game version is omitted, i.e.:
Only the first one brightmap is working: Also, current implementation supports only wall textures, not sprites/states (STbar weapons)/flats? |
I guess that's because in the second case the first line is already fully processed after the
Yes. Textures are processed differently from sprites/states/flats. We have an array of size |
Yep, fixed in b694f5a So should we add sprites/states/flats to |
Sounds more like Doom Retro's problem than ours. 😁 |
Test lump:
Not sure what to do with weapon states, how should we name them? |
Well, why not just |
I meant how to name the states themselves. For example, we have a |
Yes, C-style comments (both |
Perfect! |
How do we proceed here? |
I'll work on this tomorrow, wanted to finish the vcpkg stuff first. |
For Doom Retro compatibility
autoload/doom.wad/brghtmps.lmp
Outdated
@@ -0,0 +1 @@ | |||
TEXTURE SW2STON2 REDONLY |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer if we could have an optional fourth parameter on each line to indicate if a brightmap applies to Doom 1 or 2 (no such parameter would imply "both"). This way we would (1) keep our format compatible to Doom Retro's (which is the purpose of this change, c.f. PR title) and (2) have less external files to rely on which in turn rely on the IWAD file names themselves (remember my concerns regarding bfgdoom.wad, udoom.wad, freedoom1.wad, d2.wad, etc.).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternative approach: How about we support autoload directories based on the internal gamemission name (i.e. doom, doom2, pack_tnt, pack_plut, etc.)? Then we'd end up with only one pack_rekkr directory for example and would be independent of the actual IWAD file name - because game mission is detected based on content if in doubt (c.f. CheckIWAD()
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point, we can make a zip/wad resource file with all the optional content and identify everything by hash. But I like the current system, I think the cases of udoom.wad d2.wad are very rare.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there anything that speaks against supporting the fourth field in the BRGHTMPS lump lines to differentiate between Doom 1 and 2? We could have a single brghtmps.lmp in autoload/doom-all and let the parser do the rest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, we can get rid of the brghtmps.lmp
files in the doom.wad
and doom2.wad
directories, but we'll keep the rest of the files, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, yes. Though, we could also get rid of the file in the tnt.wad directory and merge it into the one in doom-all. The textures which get assigned a brightmap in this file do not even exist in any other IWAD.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added DOOM
, DOOM2
and DOOM|DOOM2
optional fields. I believe this PR is complete.
autoload/chex.wad/brghtmps.lmp
Outdated
BRIGHTMAP CHEXREDGREEN 45,112-118,174-177 | ||
|
||
TEXTURE BIGDOOR1 GREENONLY3 | ||
// {"BIGDOOR4", DOOM1AND2, greenonly3}, // C1: some stray green pixels, C2: many stray green pixels |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer if these were converted from C syntax to the actual BRGHTMPS lump format, so that in theory it would be sufficient to just uncomment these lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about Chex 2, is it Doom 2 or Doom 1? I will check later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Chex 2 is a PWAD to Chex 1, i.e. Doom 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, in the context of brightmap parsing, calling Chex 2 as Doom 2 to differentiate it from Chex 1 is unambigious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make chex-all
, chex.wad
and chex2.wad
folders? 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could. But, since chex2.wad is always loaded after chex.wad, its BRGHTMPS entries should override the ones for chex.wad anyway, right? Or, we could introduce a CHEX1|CHEX2
field in the BRGHTMPS spec if you don't like misusing the DOOM1|DOOM2
namespace. 😉
Tested on this lump: https://github.com/bradharding/doomretro/blob/master/res/BRGHTMPS
I used
u_scanner.c
but I think we could use it in Crispy too? (potential support for UMAPINFO).