Major code refactoring. SWWMHandler could still use some more, though.

This commit is contained in:
Mari the Deer 2021-02-27 23:59:40 +01:00
commit c5abe83831
94 changed files with 17859 additions and 17678 deletions

View file

@ -0,0 +1,291 @@
// level compatibility scripts
// sometimes shit breaks because of old and wrong scripting
// usually stuff that uses CheckInventory to look for keys, instead of, y'know,
// using ACS_LockedExecute
Class SWWMLevelCompatibility : LevelPostProcessor
{
private void EquinoxBossBrainHandle( uint lineno, int sectortag )
{
// don't spawn boss brains until it's time to crush them
for ( int i=0; i<GetThingCount(); i++ )
{
if ( GetThingEdNum(i) != 88 ) continue;
SetThingEdNum(i,9001);
SetThingID(i,666);
}
// change the crusher line
SetLineSpecial(lineno,ACS_Execute,-Int('EQUINOX_BRAINCRUSH'),0,sectortag);
}
protected void Apply( Name checksum, String mapname )
{
int numcol = 6;
int ncellsa = 0, ncellsb = 0;
int nbackpack = 0;
switch ( checksum )
{
case 'none':
return;
// ZPack E1M2
case 'BA13454A41D931685B6A4B28E6946B6B':
// script uses checkinventory for red key
SetLineSpecial(225,ACS_LockedExecuteDoor,-Int('ZPACK_E1M2_SCRIPT6'),0,0,0,1);
SetLineSpecial(228,ACS_LockedExecuteDoor,-Int('ZPACK_E1M2_SCRIPT6'),0,0,0,1);
break;
// ZPack E3M2
case '17BD38E0B2FB8E760885FE46325DFF3A':
// script uses checkinventory for red skull
SetLineSpecial(5913,ACS_LockedExecute,-Int('ZPACK_E3M2_SCRIPT9'),0,0,0,4);
break;
// ZPack E3M8
case '13C5952A04014122271F50134DB4521F':
// script uses checkinventory for yellow skull
SetLineSpecial(22610,ACS_LockedExecute,-Int('ZPACK_E3M8_SCRIPT15'),0,0,0,6);
break;
// okuplok
case 'F7F353146676920238935A8D0D1B6E8E':
// add 7 more backpacks on top of existing one, for a full embiggening
// (players will need it)
for ( int i=0; i<7; i++ ) AddThing(8,(11808,-2016,384));
break;
// holy hell revealed
case '83569A062B5261C6BB4A034BA8245D24':
// remove boss brain and re-spawn it when end is reached, prevents cheesing the map with the ynykron
SetThingEdNum(50183,9001);
SetThingID(50183,666);
SetLineSpecial(21964,ACS_Execute,-Int('HHR_BRAINWALL'));
break;
// NRFTL MAP08
case '7EB864A03948C3F918F9223B2D1F8911':
// prevent easy cheesing of the exit teleporter
AddSectorTag(155,24);
OffsetSectorPlane(155,1,-80.);
SetLineSpecial(652,ACS_Execute,-Int('NERVE_EXITOPEN'));
break;
// Doom E1M8
case '97079958C7E89C1908890730B8B9FEB7':
// 1.1-1.2
level.nextsecretmap = level.nextmap; // so the handler can detect this
level.nextmap = "E2M1";
// no damage in exit sector
SetSectorSpecial(13,0);
// teleport sequence
for ( int i=299; i<=306; i++ )
SetLineSpecial(i,ACS_Execute,-Int('E1M8_KNOCKOUT'));
// remove enemies
for ( int i=106; i<=112; i++ )
SetThingEdNum(i,0);
for ( int i=118; i<=125; i++ )
SetThingEdNum(i,0);
break;
case '058FB092EA1B70DA1E3CBF501C4A91A1':
// 1.666-1.9
level.nextsecretmap = level.nextmap; // so the handler can detect this
level.nextmap = "E2M1";
// no damage in exit sector
SetSectorSpecial(66,0);
// teleport sequence
for ( int i=299; i<=306; i++ )
SetLineSpecial(i,ACS_Execute,-Int('E1M8_KNOCKOUT'));
// remove enemies
for ( int i=106; i<=112; i++ )
SetThingEdNum(i,0);
for ( int i=118; i<=125; i++ )
SetThingEdNum(i,0);
break;
// Doom E2M8
case 'EFFE91DF41AD41F6973C06F0AD67DDB9':
level.nextsecretmap = level.nextmap; // so the handler can detect this
level.nextmap = "E3M1";
break;
// Doom E3M8
case 'EF128313112110ED6C1549AF96AF26C9':
level.nextsecretmap = level.nextmap; // so the handler can detect this
if ( Wads.FindLump("M_EPI4",0,1) != -1 ) level.nextmap = "E4M1";
else if ( Wads.FindLump("M_HELL",0,1) != -1 ) level.nextmap = "MAP01";
break;
// Doom E4M8
case '2DC939E508AB8EB68AF79D5B60568711':
level.nextsecretmap = level.nextmap; // so the handler can detect this
if ( Wads.FindLump("M_EPI5",0,1) != -1 ) level.nextmap = "E5M1";
else if ( Wads.FindLump("M_HELL",0,1) != -1 ) level.nextmap = "MAP01";
break;
// SIGIL E5M8
case '6EAD80DA1F30B4B3546FA294EEF9F87C':
level.nextsecretmap = level.nextmap; // so the handler can detect this
if ( Wads.FindLump("M_HELL",0,1) != -1 ) level.nextmap = "MAP01";
break;
// Heretic E1M8
case '27639D04F8090D57A47D354992435893':
level.nextsecretmap = level.nextmap; // so the handler can detect this
level.nextmap = "E2M1";
break;
// Heretic E2M8
case '5158C22A0F30CE5E558FD2A05D67685E':
level.nextsecretmap = level.nextmap; // so the handler can detect this
level.nextmap = "E3M1";
break;
// Heretic E3M8
case '4719C2C71EF28F52310B889DD5A9778B':
level.nextsecretmap = level.nextmap; // so the handler can detect this
if ( Wads.FindLump("EXTENDED",0,1) != -1 ) level.nextmap = "E4M1";
break;
// Heretic E4M8
case '30D1480A6D4F3A3153739D4CCF659C4E':
level.nextsecretmap = level.nextmap; // so the handler can detect this
level.nextmap = "E5M1";
break;
// Micro Slaughter Community Project MAP13
case 'E45AA3BE411845AA0DEE7CA5DAAB65FE':
// reduce OBSCENELY EXCESSIVE number of cell packs in voodoo doll conveyors (400), which will cause immense lag when replaced with mod ammo
// unsurprisingly, this actually makes the map go from completely unplayable to having perfectly smooth performance (gee, I wonder why)
for ( int i=0; i<GetThingCount(); i++ )
{
if ( GetThingEdNum(i) != 17 ) continue;
Vector3 pos = GetThingPos(i);
if ( pos.y != 480. ) continue;
if ( pos.x == -5472. )
{
ncellsa++;
if ( ncellsa > 20 ) SetThingEdNum(i,0);
}
else if ( pos.x == -5344. )
{
ncellsb++;
if ( ncellsb > 20 ) SetThingEdNum(i,0);
}
}
break;
// Equinox MAP04
case 'E66BCCFAD7AC40EFB21E2A19131E1522':
EquinoxBossBrainHandle(2406,27);
// raise floor by 10 units so its untextured lower lines don't glitch out at eye level
OffsetSectorPlane(248,0,10.);
break;
// Equinox MAP07
case 'A0B6B83DC8BD50FC84170572840DE585':
EquinoxBossBrainHandle(3423,31);
break;
// Equinox MAP10
case 'F91E3FE225F10EECBE21486E1BB14834':
EquinoxBossBrainHandle(2813,29);
break;
// Equinox MAP13
case '3805A661D5C4523AFF7BF86991071043':
EquinoxBossBrainHandle(4106,60);
break;
// Doom Vacation MAP01 (1.4)
case 'F286BABF0D152259CD6B996E8920CA70':
// Doom Vacation MAP01 (1.5)
case 'A52BD2038CF814101AAB7D9C78F9ACE2':
// two girls shouldn't be headpattable, as they have use lines around them
SetThingArgument(314,0,1);
SetThingArgument(315,0,1);
SetThingID(314,666);
SetThingID(315,667);
// unfortunately the line special wrangling has to be done one tic after map load
// because fuck absolutely everything about how ACS works
break;
// Doom 2 MAP07
case '291F24417FB3DD411339AE82EF9B3597':
// remove excess backpacks (there's 10 of them for fuck's sake)
for ( int i=0; i<GetThingCount(); i++ )
{
if ( GetThingID(i) != 8 ) continue;
if ( nbackpack ) SetThingID(i,0);
nbackpack++;
}
break;
// Kinsie's Test Map (HERETIC)
case '0EADB2F82732A968B8513E4DC6138439':
numcol = 7;
// Kinsie's Test Map (HEXEN)
case 'D70250F93C6B6072DA39D9672B37F236':
numcol = 11;
// Kinsie's Test Map (DOOM)
case '959A613006CC3AA912C4A22908B7566A':
for ( int i=0; i<numcol; i++ )
AddThing(4206900+i,(1472+64*i,640,0));
break;
}
switch ( checksum )
{
// ALL of Equinox
case '9705315427A2F951A538B23C39199236':
case '54E9953A3C1A88641E00AA353BAF46E9':
case 'DD3986E184829DAB73160F4C122155F9':
case 'B3E6CAE9983EA1DC4D9544DA26118569':
case '3E4DFC55EAE85A7FE02DD21ED33AABCA':
case 'ECCB69F1BBF91D8F67D8583EA2546863':
case 'E66BCCFAD7AC40EFB21E2A19131E1522':
case 'A0B6B83DC8BD50FC84170572840DE585':
case '9BA1ACB72D878AFA3CB22B810D6CCD9A':
case 'A26749D9B9CD70ECED5C7B6BAB6D859E':
case '3805A661D5C4523AFF7BF86991071043':
case 'F91E3FE225F10EECBE21486E1BB14834':
case '838BA30EB0B003C070414093BFDFA72A':
// replace certain animated flats with duplicates
// this avoids unintended TERRAIN defs from applying to them
level.ReplaceTextures("SLIME01","EQNXSL01",0);
level.ReplaceTextures("SLIME02","EQNXSL02",0);
level.ReplaceTextures("SLIME03","EQNXSL03",0);
level.ReplaceTextures("SLIME04","EQNXSL04",0);
level.ReplaceTextures("SLIME09","EQNXSL09",0);
level.ReplaceTextures("SLIME10","EQNXSL10",0);
level.ReplaceTextures("SLIME11","EQNXSL11",0);
level.ReplaceTextures("SLIME12","EQNXSL12",0);
level.ReplaceTextures("BLOOD1","EQNXBLD1",0);
level.ReplaceTextures("BLOOD2","EQNXBLD2",0);
level.ReplaceTextures("BLOOD3","EQNXBLD3",0);
level.ReplaceTextures("RROCK05","EQNXRR05",0);
level.ReplaceTextures("RROCK06","EQNXRR06",0);
level.ReplaceTextures("RROCK07","EQNXRR07",0);
level.ReplaceTextures("RROCK08","EQNXRR08",0);
break;
// ALL of Doom Vacation
case 'D07842872226058F93D0957EA46ED782':
case 'F286BABF0D152259CD6B996E8920CA70':
case '7E2707328B6BCF0ACDC2E80049E21167':
case '8AA3E9B8E816E72A04368404402DD8E3':
case '8B28736D01492F3701CCD736C97EF125':
case '10D3C12050518E806801B12057437403':
case '48A7FC1AF2D1CCBFE7C6EFB4EEE97A50':
case '73B317A0DA2C75BD903E895A27EEEDB9':
case '62158F76FC56B62007C1F167A7921304':
case '0D33878E4C8164A792AECCDA56F08D60':
case 'A52BD2038CF814101AAB7D9C78F9ACE2':
case 'F6413AFAEB73B3848A82F70C2A01E47D':
case 'F8CBDC96A7E08CAFC5D7C0E711551E40':
case '3E821CC90C38B7D71DDEB0324D3900CC':
case '05D0AA06742B3C7DCD79E5F659267656':
case '8F6710E3570C2056FDCA591EF89B31A9':
case '382E99BBFA9301110630CD5F8F8056DA':
case '480F6AD2D2E266DA745FD8FA75EC327D':
case '968D97F5952E55DB2464274A8EE5F529':
case '5669E396BEDDEA6D90EF5AF5EC892811':
// get rid of these dumb skulltag ctf actors
for ( int i=0; i<GetThingCount(); i++ )
{
int ednum = GetThingEdNum(i);
if ( (ednum == 5130) || (ednum == 5131)
|| (ednum == 5080) || (ednum == 5081) )
SetThingEdNum(i,0);
}
// get rid of moan switches
level.ReplaceTextures("SW1ZIM","-noflat-",0);
level.ReplaceTextures("SW1TEK","-noflat-",0);
break;
}
// [Hexen] force Mystic Ambit Incants to spawn outside coop
if ( gameinfo.gametype&GAME_Hexen )
{
for ( int i=0; i<GetThingCount(); i++ )
{
if ( GetThingEdNum(i) != 10120 ) continue;
uint flg = GetThingFlags(i);
SetThingFlags(i,flg|MTF_SINGLE);
}
}
}
}