Add generic warning when loading other weapon mods.

(Plus small tweaks to the anti-BD script)
This commit is contained in:
Mari the Deer 2025-02-06 11:51:14 +01:00
commit 8526c2ffb0
4 changed files with 129 additions and 35 deletions

View file

@ -14,7 +14,6 @@ Class SWWMStaticHandler : StaticEventHandler
ui int timer, msgpick;
// broccoli doccoli
bool isbd;
String bdname;
// versioning
bool tainted;
String taintver;
@ -129,6 +128,74 @@ Class SWWMStaticHandler : StaticEventHandler
SaveAchievements();
}
private bool CheckOtherMods()
{
// this should cover as much ground as possible, just checking for any custom player classes that are not
// part of the vanilla set (excluding ones such as, for example, morph targets)
foreach ( cls:AllActorClasses )
{
if ( !(cls is 'PlayerPawn') ) continue;
if ( cls is 'PlayerChunk' ) continue;
switch ( cls.GetClassName() )
{
case 'PlayerPawn':
case 'DoomPlayer':
case 'ChexPlayer':
case 'HereticPlayer':
case 'ChickenPlayer':
case 'FighterPlayer':
case 'ClericPlayer':
case 'MagePlayer':
case 'PigPlayer':
case 'StrifePlayer':
case 'Demolitionist':
case 'SWWMVoodooDoll':
// do nothing
break;
default:
let def = GetDefaultByType((Class<PlayerPawn>)(cls));
// if this class has a morph weapon defined, skip it
if ( def.MorphWeapon )
{
Console.Printf("skip me: %s",cls.GetClassName());
break;
}
// we have to check if there are any discrepancies between this class's start item list and
// its parents
let pdef = GetDefaultByType((Class<PlayerPawn>)(cls.GetParentClass()));
let di = def.GetDropItems();
let pdi = pdef.GetDropItems();
// no items, just skip
if ( !di )
{
Console.Printf("skip me: %s",cls.GetClassName());
break;
}
do
{
// list sizes don't match
if ( (di && !pdi) || (!di && pdi) )
{
Console.Printf("match me: %s",cls.GetClassName());
return true;
}
// mismatch in item names
if ( di.name != pdi.name )
{
Console.Printf("match me: %s",cls.GetClassName());
return true;
}
di = di.next;
pdi = pdi.next;
}
while ( di || pdi );
Console.Printf("skip me: %s",cls.GetClassName());
break;
}
}
return false;
}
override void OnRegister()
{
// fix voice type cvar
@ -174,15 +241,28 @@ Class SWWMStaticHandler : StaticEventHandler
Console.Printf("\cgWARNING:\c- Multiplayer is no longer supported, desyncs and other issues WILL happen. You are on your own.");
S_StartSound("compat/warn",CHAN_YABLEWIT,CHANF_UI|CHANF_NOPAUSE|CHANF_OVERLAP,1,ATTN_NONE);
}
bool checked = CheckOtherMods();
if ( checked )
{
// warn for combining with other weapon mods
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,
"\cx┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\c-\n"
"\cx┃ \cr[\cgWARNING\cr]\cx ┃\c-\n"
"\cx┃ \cjYou appear to be loading this alongside another weapon mod.\cx ┃\c-\n"
"\cx┃ \cjIssues are \cfVERY LIKELY\cj to happen.\cx ┃\c-\n"
"\cx┃ \cr[\cgYOU ARE ON YOUR OWN\cr]\cx ┃\c-\n"
"\cx┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\c-");
S_StartSound("compat/warn",CHAN_YABLEWIT,CHANF_UI|CHANF_NOPAUSE|CHANF_OVERLAP,1,ATTN_NONE);
}
// warning for unsupported
if ( Wads.FindLumpFullName("swwmgamesupported",0,true) != -1 ) return;
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,
"\cx┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\c-\n"
"\cx┃ \cr[\cgWARNING\cr] \cx┃\c-\n"
"\cx┃ \chSWWM \czGZ \cjis \cfNOT\cj compatible with the loaded IWAD. \cx┃\c-\n"
"\cx┃ \cjOnly \cfDoom\cj, \cfHeretic\cj and \cfHexen\cj are supported. \cx┃\c-\n"
"\cx┃ \cjIssues \cfCAN\cj and \cfWILL\cj happen. \cx┃\c-\n"
"\cx┃ \cr[\cgYOU ARE ON YOUR OWN\cr] \cx┃\c-\n"
"\cx┃ \cr[\cgWARNING\cr]\cx ┃\c-\n"
"\cx┃ \chSWWM \czGZ \cjis \cfNOT\cj compatible with the loaded IWAD.\cx ┃\c-\n"
"\cx┃ \cjOnly \cfDoom\cj, \cfHeretic\cj and \cfHexen\cj are supported.\cx ┃\c-\n"
"\cx┃ \cjIssues \cfCAN\cj and \cfWILL\cj happen.\cx ┃\c-\n"
"\cx┃ \cr[\cgYOU ARE ON YOUR OWN\cr]\cx ┃\c-\n"
"\cx┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\c-");
S_StartSound("compat/warn",CHAN_YABLEWIT,CHANF_UI|CHANF_NOPAUSE|CHANF_OVERLAP,1,ATTN_NONE);
}
@ -695,7 +775,7 @@ Class SWWMStaticHandler : StaticEventHandler
}
else if ( timer == 140 )
{
if ( isbd ) Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"\cfYou shouldn't have tried running this with "..bdname..".\c-");
if ( isbd ) Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"\cfYou shouldn't have tried running this with Brutal Doom.\c-");
else Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"\cfYou should probably screenshot this error and show it to Marisa.\c-");
Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"\cfLoaded Version:\n \cj%s\c-",StringTable.Localize("$SWWM_SHORTVER"));
if ( tainted ) Console.PrintfEx(PRINT_HIGH|PRINT_NONOTIFY,"\cfSavegame Version:\n \cj%s\c-",taintver);