mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
- Allow for using ACS_NamedExecute and friends with SetLineSpecial.
SVN r3371 (trunk)
This commit is contained in:
parent
9cd0e48ea3
commit
cbf7162e16
3 changed files with 34 additions and 13 deletions
|
@ -1882,14 +1882,14 @@ void FBehavior::StaticStopMyScripts (AActor *actor)
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
// SerializeScriptNumber
|
||||
// P_SerializeACSScriptNumber
|
||||
//
|
||||
// Serializes a script number. If it's negative, it's really a name, so
|
||||
// that will get serialized after it.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
static void SerializeScriptNumber(FArchive &arc, int &scriptnum, bool was2byte)
|
||||
void P_SerializeACSScriptNumber(FArchive &arc, int &scriptnum, bool was2byte)
|
||||
{
|
||||
if (SaveVersion < 3359)
|
||||
{
|
||||
|
@ -1971,7 +1971,7 @@ void DACSThinker::Serialize (FArchive &arc)
|
|||
assert(pair->Value != NULL);
|
||||
arc << pair->Value;
|
||||
scriptnum = pair->Key;
|
||||
SerializeScriptNumber(arc, scriptnum, true);
|
||||
P_SerializeACSScriptNumber(arc, scriptnum, true);
|
||||
}
|
||||
DLevelScript *nilptr = NULL;
|
||||
arc << nilptr;
|
||||
|
@ -1984,7 +1984,7 @@ void DACSThinker::Serialize (FArchive &arc)
|
|||
arc << script;
|
||||
while (script)
|
||||
{
|
||||
SerializeScriptNumber(arc, scriptnum, true);
|
||||
P_SerializeACSScriptNumber(arc, scriptnum, true);
|
||||
RunningScripts[scriptnum] = script;
|
||||
arc << script;
|
||||
}
|
||||
|
@ -2048,7 +2048,7 @@ void DLevelScript::Serialize (FArchive &arc)
|
|||
Super::Serialize (arc);
|
||||
arc << next << prev;
|
||||
|
||||
SerializeScriptNumber(arc, script, false);
|
||||
P_SerializeACSScriptNumber(arc, script, false);
|
||||
|
||||
arc << state
|
||||
<< statedata
|
||||
|
@ -5750,12 +5750,21 @@ int DLevelScript::RunScript ()
|
|||
case PCD_SETLINESPECIAL:
|
||||
{
|
||||
int linenum = -1;
|
||||
int specnum = STACK(6);
|
||||
int arg0 = STACK(5);
|
||||
|
||||
while ((linenum = P_FindLineFromID (STACK(7), linenum)) >= 0) {
|
||||
// Convert named ACS "specials" into real specials.
|
||||
if (specnum >= -ACSF_ACS_NamedExecuteAlways && specnum <= -ACSF_ACS_NamedExecute)
|
||||
{
|
||||
specnum = NamedACSToNormalACS[-specnum - ACSF_ACS_NamedExecute];
|
||||
arg0 = -FName(FBehavior::StaticLookupString(arg0));
|
||||
}
|
||||
|
||||
while ((linenum = P_FindLineFromID (STACK(7), linenum)) >= 0)
|
||||
{
|
||||
line_t *line = &lines[linenum];
|
||||
|
||||
line->special = STACK(6);
|
||||
line->args[0] = STACK(5);
|
||||
line->special = specnum;
|
||||
line->args[0] = arg0;
|
||||
line->args[1] = STACK(4);
|
||||
line->args[2] = STACK(3);
|
||||
line->args[3] = STACK(2);
|
||||
|
@ -7310,7 +7319,7 @@ FArchive &operator<< (FArchive &arc, acsdefered_t *&defertop)
|
|||
arc << more;
|
||||
type = (BYTE)defer->type;
|
||||
arc << type;
|
||||
SerializeScriptNumber(arc, defer->script, false);
|
||||
P_SerializeACSScriptNumber(arc, defer->script, false);
|
||||
arc << defer->playernum << defer->arg0 << defer->arg1 << defer->arg2;
|
||||
defer = defer->next;
|
||||
}
|
||||
|
@ -7327,7 +7336,7 @@ FArchive &operator<< (FArchive &arc, acsdefered_t *&defertop)
|
|||
*defer = new acsdefered_t;
|
||||
arc << more;
|
||||
(*defer)->type = (acsdefered_t::EType)more;
|
||||
SerializeScriptNumber(arc, (*defer)->script, false);
|
||||
P_SerializeACSScriptNumber(arc, (*defer)->script, false);
|
||||
arc << (*defer)->playernum << (*defer)->arg0 << (*defer)->arg1 << (*defer)->arg2;
|
||||
defer = &((*defer)->next);
|
||||
arc << more;
|
||||
|
|
|
@ -72,6 +72,7 @@ extern FWorldGlobalArray ACS_GlobalArrays[NUM_GLOBALVARS];
|
|||
void P_ReadACSVars(PNGHandle *);
|
||||
void P_WriteACSVars(FILE*);
|
||||
void P_ClearACSVars(bool);
|
||||
void P_SerializeACSScriptNumber(FArchive &arc, int &scriptnum, bool was2byte);
|
||||
|
||||
// The in-memory version
|
||||
struct ScriptPtr
|
||||
|
|
|
@ -50,6 +50,8 @@
|
|||
#include "p_setup.h"
|
||||
#include "r_data/colormaps.h"
|
||||
#include "farchive.h"
|
||||
#include "p_lnspec.h"
|
||||
#include "p_acs.h"
|
||||
|
||||
static void CopyPlayer (player_t *dst, player_t *src, const char *name);
|
||||
static void ReadOnePlayer (FArchive &arc, bool skipload);
|
||||
|
@ -393,8 +395,17 @@ void P_SerializeWorld (FArchive &arc)
|
|||
<< li->activation
|
||||
<< li->special
|
||||
<< li->Alpha
|
||||
<< li->id
|
||||
<< li->args[0] << li->args[1] << li->args[2] << li->args[3] << li->args[4];
|
||||
<< li->id;
|
||||
if ((li->special >= ACS_Execute && li->special <= ACS_LockedExecuteDoor) ||
|
||||
li->special == ACS_ExecuteAlways)
|
||||
{
|
||||
P_SerializeACSScriptNumber(arc, li->args[0], false);
|
||||
}
|
||||
else
|
||||
{
|
||||
arc << li->args[0];
|
||||
}
|
||||
arc << li->args[1] << li->args[2] << li->args[3] << li->args[4];
|
||||
|
||||
for (j = 0; j < 2; j++)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue