I am looking into making my mod (usually only playable on Doom 2 and Doom 2 derived IWADs and PWADs) compatible with Doom 1, but in order to do that I want to set it up so no enemies who drop Doom 2 or above weapons (SSG, Quad Shotgun) are not in the spawn list.
Is there someway I could code my mod to remove SuperShotgunners and QuadShotgunZombies from spawning when it detects it's being played on Doom 1?
I know I could make a patch file, I was just curious there was a way to do it internally.
IWAD detecting code?
- HellBlade64
- Forum Regular
- Posts: 115
- Joined: Mon Aug 13, 2012 9:03 pm
- Contact:
Re: IWAD detecting code?
There's reliable ways to detect the game (Doom, Hexen, Heretic or Strife) but no real easy way to detect Doom 1 or Doom 2 specifically. The only way I can think off the top of my head, would be using an ACS OPEN script with Stricmp, StrMid and StrParam to get and compare the map lump name to the ExMx format, set a map variable and another script that sets this map var as it's result value. The check itself is separate so as to reduce the performance impact of doing it every time a monster needs to use it.
Like this:
Note that the monsters should wait one tic before using CallACS, or else the map var may not be set (I think OPEN runs before any actor's spawn state is set, but just in case!).
Like this:
Code: Select all
bool IsDoom1; //starts as false, set by "Setup_CheckIfDoom1"
Script "Setup_CheckIfDoom1" OPEN
{
str name = StrParam(n:PRINTNAME_LEVEL);
if(StrLen(name) == 4) //ExMx will always be 4 characters long
{
str 1stChar = StrLeft(name,1);
str 2ndChar = StrMid(name,2,1);
if( (StriCmp(1stChar, "E") == 0) &&
(StriCmp(2ndChar, "M") == 0) ) //if first and third chars are E, and M
{
IsDoom1 = TRUE; //it is Doom1
}
}
}
//Use in DECORATE as ACS_NamedExecuteWithResult("IsDoom1"), like
//A_JumpIf(ACS_NamedExecuteWithResult("IsDoom1") == TRUE, "stateifdoom1")
//or
//A_JumpIf(CallACS("IsDoom1") == TRUE, "stateifdoom1") for brevity
Script "IsDoom1" (void)
{
SetResultValue(IsDoom1);
}
Where can I go from Your Spirit? Or where can I flee from Your presence? If I ascend to heaven, You are there; If I make my bed in Sheol, behold, You are there. (Psalms 139:7-8, NASB)
My Discord tag is @tdrr, and it's my preferred contact method. I also check PMs here from time to time.
I also have a Discord server for my projects.
My Discord tag is @tdrr, and it's my preferred contact method. I also check PMs here from time to time.
I also have a Discord server for my projects.
- Combinebobnt
- Retired Staff / Community Team Member
- Posts: 1907
- Joined: Mon Jun 04, 2012 3:37 am
- Location: Earth
- Contact:
Re: IWAD detecting code?
big bump batman
https://zdoom.org/w/index.php?title=Lump_filtering doesn't work for me in Zandronum, but that's the better way to do it in UZDoom
In Zan 3.2.1+, we have ACS technology:TDRR wrote: ↑Fri Sep 18, 2020 9:22 pmThere's reliable ways to detect the game (Doom, Hexen, Heretic or Strife) but no real easy way to detect Doom 1 or Doom 2 specifically. The only way I can think off the top of my head, would be using an ACS OPEN script with Stricmp, StrMid and StrParam to get and compare the map lump name to the ExMx format, set a map variable and another script that sets this map var as it's result value. The check itself is separate so as to reduce the performance impact of doing it every time a monster needs to use it.
Code: Select all
int lump_index = LumpOpen("DEMO4", 0);
if(lump_index >= 0 && LumpGetInfo(lump_index, LUMP_INFO_SIZE) == 3286)
{
LumpClose(lump_index);
log(s:"It's Ultimate DOOM time.");
}
