diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 5bf1fe581..f778dc3e4 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,9 @@ +December 18, 2009 (Changes by Graf Zahl) +- added all known maps requiring inverted sprite sorting to compatibility.txt. +- added compatibility option to invert sprite sorting. Apparently Doom.exe + originally sorted them differently than most source port and on some maps + which depends on this it doesn't look right (e.g. Strain MAP13) + December 17, 2009 - Fixed: Using Transfer_Heights with the SECF_UNDERWATER and SECF_FAKEFLOORONLY flags applied the water effect to the ceiling and not diff --git a/src/compatibility.cpp b/src/compatibility.cpp index 059a8a4b7..f4fbaa529 100644 --- a/src/compatibility.cpp +++ b/src/compatibility.cpp @@ -105,6 +105,7 @@ static FCompatOption Options[] = { "mbfmonstermove", COMPATF_MBFMONSTERMOVE, 0 }, { "corpsegibs", COMPATF_CORPSEGIBS, 0 }, { "noblockfriends", COMPATF_NOBLOCKFRIENDS, 0 }, + { "spritesort", COMPATF_SPRITESORT, 0 }, { NULL, 0, 0 } }; diff --git a/src/d_main.cpp b/src/d_main.cpp index 0aa0b1baf..656875941 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -492,12 +492,12 @@ CUSTOM_CVAR(Int, compatmode, 0, CVAR_ARCHIVE|CVAR_NOINITCALL) break; case 1: // Doom2.exe compatible with a few relaxed settings - v = COMPATF_SHORTTEX|COMPATF_STAIRINDEX|COMPATF_USEBLOCKING|COMPATF_NODOORLIGHT| + v = COMPATF_SHORTTEX|COMPATF_STAIRINDEX|COMPATF_USEBLOCKING|COMPATF_NODOORLIGHT|COMPATF_SPRITESORT| COMPATF_TRACE|COMPATF_MISSILECLIP|COMPATF_SOUNDTARGET|COMPATF_DEHHEALTH|COMPATF_CROSSDROPOFF; break; case 2: // same as 1 but stricter (NO_PASSMOBJ and INVISIBILITY are also set) - v = COMPATF_SHORTTEX|COMPATF_STAIRINDEX|COMPATF_USEBLOCKING|COMPATF_NODOORLIGHT| + v = COMPATF_SHORTTEX|COMPATF_STAIRINDEX|COMPATF_USEBLOCKING|COMPATF_NODOORLIGHT|COMPATF_SPRITESORT| COMPATF_TRACE|COMPATF_MISSILECLIP|COMPATF_SOUNDTARGET|COMPATF_NO_PASSMOBJ|COMPATF_LIMITPAIN| COMPATF_DEHHEALTH|COMPATF_INVISIBILITY|COMPATF_CROSSDROPOFF|COMPATF_CORPSEGIBS; break; @@ -546,6 +546,7 @@ CVAR (Flag, compat_mushroom, compatflags, COMPATF_MUSHROOM); CVAR (Flag, compat_mbfmonstermove,compatflags, COMPATF_MBFMONSTERMOVE); CVAR (Flag, compat_corpsegibs, compatflags, COMPATF_CORPSEGIBS); CVAR (Flag, compat_noblockfriends,compatflags,COMPATF_NOBLOCKFRIENDS); +CVAR (Flag, compat_spritesort, compatflags,COMPATF_SPRITESORT); //========================================================================== // diff --git a/src/doomdef.h b/src/doomdef.h index 868479faa..485f15a5e 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -324,6 +324,7 @@ enum COMPATF_MBFMONSTERMOVE = 1 << 24, // Monsters are affected by friction and pushers/pullers. COMPATF_CORPSEGIBS = 1 << 25, // Crushed monsters are turned into gibs, rather than replaced by gibs. COMPATF_NOBLOCKFRIENDS = 1 << 26, // Friendly monsters aren't blocked by monster-blocking lines. + COMPATF_SPRITESORT = 1 << 27, // Invert sprite sorting order for sprites of equal distance }; // Emulate old bugs for select maps. These are not exposed by a cvar diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index eeb222361..800fa8957 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -1359,6 +1359,7 @@ MapFlagHandlers[] = { "compat_mbfmonstermove", MITYPE_COMPATFLAG, COMPATF_MBFMONSTERMOVE}, { "compat_corpsegibs", MITYPE_COMPATFLAG, COMPATF_CORPSEGIBS}, { "compat_noblockfriends", MITYPE_COMPATFLAG, COMPATF_NOBLOCKFRIENDS}, + { "compat_spritesort", MITYPE_COMPATFLAG, COMPATF_SPRITESORT}, { "cd_start_track", MITYPE_EATNEXT, 0, 0 }, { "cd_end1_track", MITYPE_EATNEXT, 0, 0 }, { "cd_end2_track", MITYPE_EATNEXT, 0, 0 }, diff --git a/src/m_options.cpp b/src/m_options.cpp index ac297a2f2..313d0d602 100644 --- a/src/m_options.cpp +++ b/src/m_options.cpp @@ -1112,6 +1112,7 @@ static menuitem_t CompatibilityItems[] = { { bitflag, "Monster movement is affected by effects", {&compatflags}, {0}, {0}, {0}, {(value_t *)COMPATF_MBFMONSTERMOVE} }, { bitflag, "Crushed monsters can be resurrected", {&compatflags}, {0}, {0}, {0}, {(value_t *)COMPATF_CORPSEGIBS} }, { bitflag, "Friendly monsters aren't blocked", {&compatflags}, {0}, {0}, {0}, {(value_t *)COMPATF_NOBLOCKFRIENDS} }, + { bitflag, "Invert sprite sorting", {&compatflags}, {0}, {0}, {0}, {(value_t *)COMPATF_SPRITESORT} }, { discrete, "Interpolate monster movement", {&nomonsterinterpolation}, {2.0}, {0.0}, {0.0}, {NoYes} }, }; diff --git a/src/r_things.cpp b/src/r_things.cpp index a3a466b4e..a2f18de5f 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -2047,9 +2047,22 @@ void R_SortVisSprites (bool (*compare)(vissprite_t *, vissprite_t *), size_t fir spritesortersize = MaxVisSprites; } - for (i = 0, spr = firstvissprite; i < vsprcount; i++, spr++) + if (!(i_compatflags & COMPATF_SPRITESORT)) { - spritesorter[i] = *spr; + for (i = 0, spr = firstvissprite; i < vsprcount; i++, spr++) + { + spritesorter[i] = *spr; + } + } + else + { + // If the compatibility option is on sprites of equal distance need to + // be sorted in inverse order. This is most easily achieved by + // filling the sort array backwards before the sort. + for (i = 0, spr = firstvissprite + vsprcount-1; i < vsprcount; i++, spr--) + { + spritesorter[i] = *spr; + } } std::stable_sort(&spritesorter[0], &spritesorter[vsprcount], compare); diff --git a/wadsrc/static/compatibility.txt b/wadsrc/static/compatibility.txt index b2a168ce7..a4fd90659 100644 --- a/wadsrc/static/compatibility.txt +++ b/wadsrc/static/compatibility.txt @@ -91,3 +91,35 @@ F84AB4557464A383E93F37CD3A82AC48 // MM2 map03 corpsegibs vileghosts } + +// invert the sorting order of overlapping sprites at the same spot +551D6B416EB3324790BC0F0F74B49600 // Strain map13 +2F49C29691F8565F0B99B27FCF2627E6 // Astrostein 1 MAP01 +55A741F9C2955C2B06F2387E45ED6C62 // MAP02 +4E7286B735671A942C54FAC6CB52A8C3 // MAP03 +825772094FF3569FC3722145F82F820A // MAP04 +CB6CF6BE0EA4A6AB9830FBB7F9192B80 // MAP05 +AB24CCF84C2FE1A543FE033589BD1FBC // MAP06 +6BE0908B4DAFF53AA0A7493C04A608A4 // MAP07 +305275E5E07755E17AAB064981279295 // MAP08 +A8FBF3600088E79D02283C40D12B7F26 // MAP09 +A8FBF3600088E79D02283C40D12B7F26 // MAP09 +F0C95C76237DF617560577767EC21E1C // MAP10 +2A2AF2CDAB7E7A66D28AFC3AA6243DCC // Astrostein 2 map01 +0667DA831EB293D3387579565C11F0DD // map02 +76DA72420EBE0A53D861373D7123DE33 // map03 +5A4F8186580FFE41BCD80960B7F19CA8 // map04 +E3A1EE2A0A2FB27496074057E3FA82F0 // map05 +1CA60DE4062F41DC1A39396228913882 // map06 +DABC3033A734DEF402A8FEF6C2FEDCC2 // map07 +2E8211EA051EA8C3241859D1854386D6 // map08 +EAD27C506AFC856BE07DDDDED20D7ED0 // map09 +7DA47B044E2D5D17EAE2960BBFAEDE1A // Astrostein 3 map10 +46E0F4529E8E396DEDC8DB83443078A7 // map13 +2742D556921FBE753C16175F0C980091 // map14 +AB1A6C1D3898D4259C0645306939374C // map15 +0599F0D0CC1F41F52B7E8214D0348EEA // map17 +CA267398C9B3A8F79349D3394F8B2106 // map20 +{ + spritesort +}