Add mapcompat global (AKA fix remapping on palette texture skyboxes)

Rather than setting udmf earlier in P_SetupLevel and continuing to awkwardly
check udmf everywhere, I'm adding a new global solely for compat purposes.

For now, have it mirror udmf to avoid supporting two binary formats.
(still keeping the 2.2 conversion code tho?)
This commit is contained in:
GenericHeroGuy 2025-02-19 21:58:12 +01:00
parent 72a1ba7080
commit 37969a3415
9 changed files with 27 additions and 12 deletions

View file

@ -46,6 +46,7 @@ extern UINT8 mapmusrng;
// Use other bits if necessary.
extern UINT32 maptol;
extern boolean mapcompat;
extern INT32 cursaveslot;
//extern INT16 lastmapsaved;

View file

@ -92,6 +92,7 @@ UINT8 mapmusrng; // Random selection result
INT16 gamemap = 1;
UINT32 maptol;
boolean mapcompat = false;
preciptype_t globalweather = PRECIP_NONE;
preciptype_t curWeather = PRECIP_NONE;

View file

@ -401,6 +401,9 @@ int LUA_PushGlobals(lua_State *L, const char *word)
} else if (fastcmp(word, "compatmode")) {
lua_pushboolean(L, lua_compatmode);
return 1;
} else if (fastcmp(word, "mapcompat")) {
lua_pushboolean(L, mapcompat);
return 1;
}
return 0;

View file

@ -1805,7 +1805,7 @@ static floormove_t *CreateFloorThinker(sector_t *sec)
}
dofloor = Z_Calloc(sizeof (*dofloor), PU_LEVSPEC, NULL);
P_AddThinker(udmf ? THINK_MAIN : THINK_FLOORS, &dofloor->thinker);
P_AddThinker(mapcompat ? THINK_FLOORS : THINK_MAIN, &dofloor->thinker);
// make sure another floor thinker won't get started over this one
sec->floordata = dofloor;

View file

@ -11094,7 +11094,7 @@ static boolean P_SetupMace(mapthing_t *mthing, mobj_t *mobj, boolean *doangle)
mnumspokes = mthing->args[1] + 1;
mspokeangle = FixedAngle((360*FRACUNIT)/mnumspokes) >> ANGLETOFINESHIFT;
mwidth = max(0, mthing->args[2]);
mspeed = abs(mthing->args[3] << (udmf ? 4 : 0));
mspeed = abs(mthing->args[3] << (mapcompat ? 0 : 4));
mphase = mthing->args[4] % 360;
mpinch = mthing->args[5] % 360;
mnumnospokes = mthing->args[6];
@ -12007,7 +12007,7 @@ static boolean P_SetupSpawnedMapThing(mapthing_t *mthing, mobj_t *mobj, boolean
case MT_YELLOWSPRING:
case MT_INVISSPRING:
{
if (!udmf)
if (mapcompat)
mobj->flags ^= MF_NOGRAVITY;
}
default:

View file

@ -5235,7 +5235,7 @@ static void P_ConvertBinaryLinedefTypes(void)
//Alpha
if (lines[i].special == 141 || lines[i].special == 142 || lines[i].special == 144 || lines[i].special == 145)
{
if (udmf && lines[i].flags & ML_NOCLIMB)
if (!mapcompat && lines[i].flags & ML_NOCLIMB)
lines[i].args[3] |= TMFA_INSIDES;
P_SetBinaryFOFAlpha(&lines[i]);
@ -7220,7 +7220,7 @@ static void P_ConvertBinaryThingTypes(void)
break;
}
if (udmf)
if (!mapcompat)
{
mapthings[i].angle = lines[j].frontsector->ceilingheight >> FRACBITS;
mapthings[i].pitch = lines[j].frontsector->floorheight >> FRACBITS;
@ -7341,7 +7341,7 @@ static void P_ConvertBinaryThingTypes(void)
mapthings[i].args[0] = mapthings[i].angle >> 13;
mapthings[i].args[1] = (mapthings[i].angle >> 10) & 7;
mapthings[i].args[3] = !!(mapthings[i].options & MTF_AMBUSH);
if (udmf)
if (!mapcompat)
{
mapthings[i].args[0] = mapthings[i].args[0]*TICRATE/2;
mapthings[i].args[1] = mapthings[i].args[1]*TICRATE/2;
@ -7638,6 +7638,13 @@ static void P_MakeMapMD5(virtres_t *virt, void *dest)
M_Memcpy(dest, &resmd5, 16);
}
static void P_SetMapCompat(void)
{
// choose wisely...
mapcompat = vres_Find(curmapvirt, "TEXTMAP") == NULL;
//mapcompat = wadfiles[WADFILENUM(mapheaderinfo[gamemap-1]->lumpnum)]->compatmode;
}
static boolean P_LoadMapFromFile(void)
{
virtlump_t *textmap = vres_Find(curmapvirt, "TEXTMAP");
@ -8464,6 +8471,9 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
curmapvirt = vres_GetMap(lastloadedmaplumpnum);
// set this as early as possible, to fix palette texture skyboxes
P_SetMapCompat();
if (mapheaderinfo[gamemap-1])
{
encoreLump = vres_Find(curmapvirt, encoremode ? "ENCORE" : "TWEAKMAP");

View file

@ -862,7 +862,7 @@ void P_SpawnSlopes(const boolean fromsave) {
// end of jart
// in kart, copied slopes are created AFTER spawning mapthings
if (!udmf)
if (mapcompat)
return;
/// Copies slopes from tagged sectors via line specials.

View file

@ -1412,15 +1412,15 @@ static boolean P_CheckRaceLapSpecial(line_t *triggerline, player_t *player)
{
lap = P_FindLowestLap();
if (udmf && lap <= lastLowestLap)
if (!mapcompat && lap <= lastLowestLap)
{
// Need to be able to search for E4 linedefs
// Need to be able to search for MIDSOLID linedefs
return false;
}
}
// kart laps are zero-based
if (lap && !udmf)
if (lap && mapcompat)
lap--;
UINT16 threshold = sides[triggerline->sidenum[0]].textureoffset >> FRACBITS;
@ -7853,7 +7853,7 @@ void P_SpawnSpecialsThatRequireObjects(boolean fromnetsave)
for (i = 0; i < numlines; i++)
{
if (!udmf && lines[i].special == 720)
if (mapcompat && lines[i].special == 720)
P_CopySectorSlope(&lines[i]);
if (P_IsLineDisabled(&lines[i]))

View file

@ -2033,7 +2033,7 @@ void R_ParseTEXTURESLump(UINT16 wadNum, UINT16 lumpNum, INT32 *texindex)
static void PaletteTextureHack(const char **name)
{
static char uberhack[5];
if (!udmf)
if (mapcompat)
{
unsigned num;
if (sscanf(*name, "~%03u", &num) && num < 256)