- Added support for automatically loading ACS objects (even for Doom-format

maps). To use it, compile the ACS files as ordinary libraries placed
  between A_START/A_END markers. Then outside the markers, create a lump
  called LOADACS. This is just a plain text lump that lists all the libraries
  you want to autoload with every map. You can do this with as many libraries
  as you want, and LOADACS lumps are also cummulative.

SVN r123 (trunk)
This commit is contained in:
Randy Heit 2006-05-17 01:38:07 +00:00
parent 3e9fbf5616
commit c770d4a99a
6 changed files with 50 additions and 23 deletions

View file

@ -1,4 +1,10 @@
May 16, 2006
-May 16, 2006
- Added support for automatically loading ACS objects (even for Doom-format
maps). To use it, compile the ACS files as ordinary libraries placed
between A_START/A_END markers. Then outside the markers, create a lump
called LOADACS. This is just a plain text lump that lists all the libraries
you want to autoload with every map. You can do this with as many libraries
as you want, and LOADACS lumps are also cummulative.
- Fixed: ApplyActorDefault() must ensure that dataint is non-negative before
calculating a non-NULL state. When compiling with Visual C++, states are
stored in the defaults list as byte values, but when compiling with GCC,

View file

@ -107,7 +107,6 @@
#define LEVEL_CROUCH_YES UCONST64(0x100000000000)
struct acsdefered_s;
class FBehavior;
struct FSpecialAction
{
@ -221,8 +220,6 @@ struct level_locals_s
fixed_t airfriction;
int airsupply;
FBehavior *behavior;
FSectorScrollValues *Scrolls; // NULL if no DScrollers in this level
SBYTE WallVertLight; // Light diffs for vert/horiz walls

View file

@ -62,6 +62,8 @@
#include "w_wad.h"
#include "r_sky.h"
#include "gstrings.h"
#include "gi.h"
#include "sc_man.h"
extern FILE *Logfile;
@ -456,6 +458,38 @@ void DPlaneWatcher::Tick ()
//---- ACS lump manager ----//
// Load user-specified default modules. This must be called after the level's
// own behavior is loaded (if it has one).
void FBehavior::StaticLoadDefaultModules ()
{
// When playing Strife, STRFHELP is always loaded.
if (gameinfo.gametype == GAME_Strife)
{
StaticLoadModule (Wads.CheckNumForName ("STRFHELP", ns_acslibrary));
}
// Scan each LOADACS lump and load the specified modules in order
int lump, lastlump = 0;
while ((lump = Wads.FindLump ("LOADACS", &lastlump)) != -1)
{
SC_OpenLumpNum (lump, "LOADACS");
while (SC_GetString())
{
int acslump = Wads.CheckNumForName (sc_String, ns_acslibrary);
if (acslump >= 0)
{
StaticLoadModule (acslump);
}
else
{
Printf ("Could not find autoloaded ACS library %s\n", sc_String);
}
}
SC_Close ();
}
}
FBehavior *FBehavior::StaticLoadModule (int lumpnum)
{
for (unsigned int i = 0; i < StaticModules.Size(); ++i)

View file

@ -146,6 +146,7 @@ public:
SDWORD *MapVars[NUM_MAPVARS];
static FBehavior *StaticLoadModule (int lumpnum);
static void StaticLoadDefaultModules ();
static void StaticUnloadModules ();
static bool StaticCheckAllGood ();
static FBehavior *StaticGetModule (int lib);

View file

@ -3471,8 +3471,6 @@ void P_SpawnPlayer (mapthing2_t *mthing)
P_PlayerStartStomp (mobj);
// [BC] Do script stuff
if (level.behavior != NULL)
{
if (state == PST_ENTER || (state == PST_LIVE && !savegamerestore))
{
FBehavior::StaticStartTypedScripts (SCRIPT_Enter, p->mo, true);
@ -3482,7 +3480,6 @@ void P_SpawnPlayer (mapthing2_t *mthing)
FBehavior::StaticStartTypedScripts (SCRIPT_Respawn, p->mo, true);
}
}
}
//

View file

@ -2777,12 +2777,11 @@ void P_LoadReject (int lump, bool junk)
//
void P_LoadBehavior (int lumpnum)
{
level.behavior = FBehavior::StaticLoadModule (lumpnum);
FBehavior::StaticLoadModule (lumpnum);
if (!FBehavior::StaticCheckAllGood ())
{
Printf ("ACS scripts unloaded.\n");
FBehavior::StaticUnloadModules ();
level.behavior = NULL;
}
}
@ -2866,7 +2865,6 @@ void P_FreeLevelData ()
level.killed_monsters = level.found_items = level.found_secrets =
wminfo.maxfrags = 0;
FBehavior::StaticUnloadModules ();
level.behavior = NULL;
if (vertexes != NULL)
{
delete[] vertexes;
@ -3092,7 +3090,6 @@ void P_SetupLevel (char *lumpname, int position)
ForceNodeBuild = gennodes;
// [RH] Load in the BEHAVIOR lump
FBehavior::StaticUnloadModules ();
level.behavior = NULL;
if (HasBehavior)
{
P_LoadBehavior (lumpnum+ML_BEHAVIOR);
@ -3106,13 +3103,8 @@ void P_SetupLevel (char *lumpname, int position)
{
level.flags &= ~LEVEL_LAXMONSTERACTIVATION;
}
// FIXME: Also load STRFHELP for Strife maps with their own BEHAVIOR.
// But since none exist right now, I'm not in a big hurry to do it.
if (gameinfo.gametype == GAME_Strife)
{
P_LoadBehavior (Wads.CheckNumForName ("STRFHELP", ns_acslibrary));
}
}
FBehavior::StaticLoadDefaultModules ();
P_LoadStrifeConversations (lumpname);