mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-31 04:20:34 +00:00
- Let puke and pukename take up to four script parameters.
- Pass ACS_ExecuteWithResult's fifth argument as a fourth script parameter. - Simplify P_StartScript()'s usage. SVN r3394 (trunk)
This commit is contained in:
parent
3fae0e3906
commit
1e21ebad5d
10 changed files with 117 additions and 89 deletions
|
@ -82,7 +82,7 @@ DEFINE_SPECIAL(ACS_Execute, 80, 1, 5, 5)
|
|||
DEFINE_SPECIAL(ACS_Suspend, 81, 2, 2, 2)
|
||||
DEFINE_SPECIAL(ACS_Terminate, 82, 2, 2, 2)
|
||||
DEFINE_SPECIAL(ACS_LockedExecute, 83, 5, 5, 5)
|
||||
DEFINE_SPECIAL(ACS_ExecuteWithResult, 84, 1, 4, 4)
|
||||
DEFINE_SPECIAL(ACS_ExecuteWithResult, 84, 1, 5, 5)
|
||||
DEFINE_SPECIAL(ACS_LockedExecuteDoor, 85, 5, 5, 5)
|
||||
DEFINE_SPECIAL(Polyobj_MoveToSpot, 86, 3, 3, 3)
|
||||
DEFINE_SPECIAL(Polyobj_Stop, 87, 1, 1, 1)
|
||||
|
|
|
@ -451,9 +451,9 @@ CCMD (puke)
|
|||
{
|
||||
int argc = argv.argc();
|
||||
|
||||
if (argc < 2 || argc > 5)
|
||||
if (argc < 2 || argc > 6)
|
||||
{
|
||||
Printf ("Usage: puke <script> [arg1] [arg2] [arg3]\n");
|
||||
Printf ("Usage: puke <script> [arg1] [arg2] [arg3] [arg4]\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -463,8 +463,8 @@ CCMD (puke)
|
|||
{ // Script 0 is reserved for Strife support. It is not pukable.
|
||||
return;
|
||||
}
|
||||
int arg[3] = { 0, 0, 0 };
|
||||
int argn = MIN (argc - 2, 3), i;
|
||||
int arg[4] = { 0, 0, 0, 0 };
|
||||
int argn = MIN<int>(argc - 2, countof(arg)), i;
|
||||
|
||||
for (i = 0; i < argn; ++i)
|
||||
{
|
||||
|
@ -493,15 +493,15 @@ CCMD (pukename)
|
|||
{
|
||||
int argc = argv.argc();
|
||||
|
||||
if (argc < 2 || argc > 6)
|
||||
if (argc < 2 || argc > 7)
|
||||
{
|
||||
Printf ("Usage: pukename \"<script>\" [\"always\"] [arg1] [arg2] [arg3]\n");
|
||||
Printf ("Usage: pukename \"<script>\" [\"always\"] [arg1] [arg2] [arg3] [arg4]\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
bool always = false;
|
||||
int argstart = 2;
|
||||
int arg[3] = { 0, 0, 0 };
|
||||
int arg[4] = { 0, 0, 0, 0 };
|
||||
int argn = 0, i;
|
||||
|
||||
if (argc > 2)
|
||||
|
@ -511,7 +511,7 @@ CCMD (pukename)
|
|||
always = true;
|
||||
argstart = 3;
|
||||
}
|
||||
argn = MIN(argc - argstart, 3);
|
||||
argn = MIN<int>(argc - argstart, countof(arg));
|
||||
for (i = 0; i < argn; ++i)
|
||||
{
|
||||
arg[i] = atoi(argv[argstart + i]);
|
||||
|
|
|
@ -59,11 +59,9 @@
|
|||
#include "m_argv.h"
|
||||
#include "p_lnspec.h"
|
||||
#include "v_video.h"
|
||||
#include "p_spec.h"
|
||||
#include "intermission/intermission.h"
|
||||
|
||||
int P_StartScript (AActor *who, line_t *where, int script, char *map, bool backSide,
|
||||
int arg0, int arg1, int arg2, int always, bool wantResultCode, bool net);
|
||||
|
||||
EXTERN_CVAR (Int, disableautosave)
|
||||
EXTERN_CVAR (Int, autosavecount)
|
||||
|
||||
|
@ -122,7 +120,7 @@ void G_BuildTiccmd (ticcmd_t *cmd);
|
|||
void D_DoAdvanceDemo (void);
|
||||
|
||||
static void SendSetup (DWORD playersdetected[MAXNETNODES], BYTE gotsetup[MAXNETNODES], int len);
|
||||
static void RunScript(BYTE **stream, APlayerPawn *pawn, int snum, int argn, bool always);
|
||||
static void RunScript(BYTE **stream, APlayerPawn *pawn, int snum, int argn, int always);
|
||||
|
||||
int reboundpacket;
|
||||
BYTE reboundstore[MAX_MSGLEN];
|
||||
|
@ -2317,7 +2315,7 @@ void Net_DoCommand (int type, BYTE **stream, int player)
|
|||
int snum = ReadWord (stream);
|
||||
int argn = ReadByte (stream);
|
||||
|
||||
RunScript(stream, players[player].mo, snum, argn, type == DEM_RUNSCRIPT2);
|
||||
RunScript(stream, players[player].mo, snum, argn, (type == DEM_RUNSCRIPT2) ? ACS_ALWAYS : 0);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -2326,7 +2324,7 @@ void Net_DoCommand (int type, BYTE **stream, int player)
|
|||
char *sname = ReadString(stream);
|
||||
int argn = ReadByte(stream);
|
||||
|
||||
RunScript(stream, players[player].mo, -FName(sname), argn & 127, !!(argn & 128));
|
||||
RunScript(stream, players[player].mo, -FName(sname), argn & 127, (argn & 128) ? ACS_ALWAYS : 0);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -2472,9 +2470,9 @@ void Net_DoCommand (int type, BYTE **stream, int player)
|
|||
}
|
||||
|
||||
// Used by DEM_RUNSCRIPT, DEM_RUNSCRIPT2, and DEM_RUNNAMEDSCRIPT
|
||||
static void RunScript(BYTE **stream, APlayerPawn *pawn, int snum, int argn, bool always)
|
||||
static void RunScript(BYTE **stream, APlayerPawn *pawn, int snum, int argn, int always)
|
||||
{
|
||||
int arg[3] = { 0, 0, 0 };
|
||||
int arg[4] = { 0, 0, 0, 0 };
|
||||
int i;
|
||||
|
||||
for (i = 0; i < argn; ++i)
|
||||
|
@ -2485,8 +2483,7 @@ static void RunScript(BYTE **stream, APlayerPawn *pawn, int snum, int argn, bool
|
|||
arg[i] = argval;
|
||||
}
|
||||
}
|
||||
P_StartScript (pawn, NULL, snum, level.mapname, false,
|
||||
arg[0], arg[1], arg[2], always, false, true);
|
||||
P_StartScript(pawn, NULL, snum, level.mapname, arg, MIN<int>(countof(arg), argn), ACS_NET);
|
||||
}
|
||||
|
||||
void Net_SkipCommand (int type, BYTE **stream)
|
||||
|
|
|
@ -88,7 +88,7 @@ void AHeresiarch::Die (AActor *source, AActor *inflictor)
|
|||
|
||||
if (script != 0)
|
||||
{
|
||||
P_StartScript (this, NULL, script, level.mapname, 0, 0, 0, 0, 0, false);
|
||||
P_StartScript (this, NULL, script, level.mapname, NULL, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxChase)
|
|||
P_Teleport (self, spot->x, spot->y, ONFLOORZ, spot->angle, true, true, false);
|
||||
}
|
||||
|
||||
P_StartScript (self, NULL, 249, NULL, 0, 0, 0, 0, 0, false);
|
||||
P_StartScript (self, NULL, 249, NULL, NULL, 0, 0);
|
||||
self->special2 = 1; // Don't run again
|
||||
|
||||
return;
|
||||
|
@ -160,7 +160,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxBonePop)
|
|||
if (mo) KSpiritInit (mo, self);
|
||||
}
|
||||
|
||||
P_StartScript (self, NULL, 255, NULL, 0, 0, 0, 0, false, false); // Death script
|
||||
P_StartScript (self, NULL, 255, NULL, NULL, 0, 0); // Death script
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
@ -270,8 +270,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KoraxCommand)
|
|||
numcommands = 4;
|
||||
}
|
||||
|
||||
P_StartScript (self, NULL, 250+(pr_koraxcommand()%numcommands),
|
||||
NULL, 0, 0, 0, 0, false, false);
|
||||
P_StartScript (self, NULL, 250+(pr_koraxcommand()%numcommands), NULL, NULL, 0, 0);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
|
|
@ -124,7 +124,8 @@ struct CallReturn
|
|||
};
|
||||
|
||||
static DLevelScript *P_GetScriptGoing (AActor *who, line_t *where, int num, const ScriptPtr *code, FBehavior *module,
|
||||
bool lineSide, int arg0, int arg1, int arg2, int always);
|
||||
const int *args, int argcount, int flags);
|
||||
|
||||
|
||||
struct FBehavior::ArrayInfo
|
||||
{
|
||||
|
@ -1855,7 +1856,7 @@ void FBehavior::StartTypedScripts (WORD type, AActor *activator, bool always, in
|
|||
if (ptr->Type == type)
|
||||
{
|
||||
DLevelScript *runningScript = P_GetScriptGoing (activator, NULL, ptr->Number,
|
||||
ptr, this, 0, arg1, 0, 0, always);
|
||||
ptr, this, &arg1, 1, always ? ACS_ALWAYS : 0);
|
||||
if (runNow)
|
||||
{
|
||||
runningScript->RunScript ();
|
||||
|
@ -7095,12 +7096,12 @@ int DLevelScript::RunScript ()
|
|||
#undef PushtoStack
|
||||
|
||||
static DLevelScript *P_GetScriptGoing (AActor *who, line_t *where, int num, const ScriptPtr *code, FBehavior *module,
|
||||
bool backSide, int arg0, int arg1, int arg2, int always)
|
||||
const int *args, int argcount, int flags)
|
||||
{
|
||||
DACSThinker *controller = DACSThinker::ActiveThinker;
|
||||
DLevelScript **running;
|
||||
|
||||
if (controller && !always && (running = controller->RunningScripts.CheckKey(num)) != NULL)
|
||||
if (controller && !(flags & ACS_ALWAYS) && (running = controller->RunningScripts.CheckKey(num)) != NULL)
|
||||
{
|
||||
if ((*running)->GetState() == DLevelScript::SCRIPT_Suspended)
|
||||
{
|
||||
|
@ -7110,11 +7111,11 @@ static DLevelScript *P_GetScriptGoing (AActor *who, line_t *where, int num, cons
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return new DLevelScript (who, where, num, code, module, backSide, arg0, arg1, arg2, always);
|
||||
return new DLevelScript (who, where, num, code, module, args, argcount, flags);
|
||||
}
|
||||
|
||||
DLevelScript::DLevelScript (AActor *who, line_t *where, int num, const ScriptPtr *code, FBehavior *module,
|
||||
bool backside, int arg0, int arg1, int arg2, int always)
|
||||
const int *args, int argcount, int flags)
|
||||
: activeBehavior (module)
|
||||
{
|
||||
if (DACSThinker::ActiveThinker == NULL)
|
||||
|
@ -7124,23 +7125,15 @@ DLevelScript::DLevelScript (AActor *who, line_t *where, int num, const ScriptPtr
|
|||
assert(code->VarCount >= code->ArgCount);
|
||||
numlocalvars = code->VarCount;
|
||||
localvars = new SDWORD[code->VarCount];
|
||||
if (code->VarCount > 0)
|
||||
memset(localvars, 0, code->VarCount * sizeof(SDWORD));
|
||||
for (int i = 0; i < MIN<int>(argcount, code->ArgCount); ++i)
|
||||
{
|
||||
localvars[0] = arg0;
|
||||
if (code->VarCount > 1)
|
||||
{
|
||||
localvars[1] = arg1;
|
||||
if (code->VarCount > 2)
|
||||
{
|
||||
localvars[2] = arg2;
|
||||
}
|
||||
}
|
||||
localvars[i] = args[i];
|
||||
}
|
||||
memset (localvars+code->ArgCount, 0, (code->VarCount-code->ArgCount)*sizeof(SDWORD));
|
||||
pc = module->GetScriptAddress (code);
|
||||
pc = module->GetScriptAddress(code);
|
||||
activator = who;
|
||||
activationline = where;
|
||||
backSide = backside;
|
||||
backSide = flags & ACS_BACKSIDE;
|
||||
activefont = SmallFont;
|
||||
hudwidth = hudheight = 0;
|
||||
state = SCRIPT_Running;
|
||||
|
@ -7150,17 +7143,17 @@ DLevelScript::DLevelScript (AActor *who, line_t *where, int num, const ScriptPtr
|
|||
// set in an editor. If an open script sets them, it looks dumb if a second
|
||||
// goes by while they're in their default state.
|
||||
|
||||
if (!always)
|
||||
if (!(flags & ACS_ALWAYS))
|
||||
DACSThinker::ActiveThinker->RunningScripts[num] = this;
|
||||
|
||||
Link ();
|
||||
Link();
|
||||
|
||||
if (level.flags2 & LEVEL2_HEXENHACK)
|
||||
{
|
||||
PutLast();
|
||||
}
|
||||
|
||||
DPrintf ("Script %d started.\n", num);
|
||||
DPrintf("Script %d started.\n", num);
|
||||
}
|
||||
|
||||
static void SetScriptState (int script, DLevelScript::EScriptState state)
|
||||
|
@ -7196,8 +7189,8 @@ void P_DoDeferedScripts ()
|
|||
playeringame[def->playernum] ? players[def->playernum].mo : NULL,
|
||||
NULL, def->script,
|
||||
scriptdata, module,
|
||||
0, def->arg0, def->arg1, def->arg2,
|
||||
def->type == acsdefered_t::defexealways);
|
||||
def->args, 3,
|
||||
def->type == acsdefered_t::defexealways ? ACS_ALWAYS : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -7207,12 +7200,12 @@ void P_DoDeferedScripts ()
|
|||
|
||||
case acsdefered_t::defsuspend:
|
||||
SetScriptState (def->script, DLevelScript::SCRIPT_Suspended);
|
||||
DPrintf ("Defered suspend of script %d\n", def->script);
|
||||
DPrintf ("Deferred suspend of script %d\n", def->script);
|
||||
break;
|
||||
|
||||
case acsdefered_t::defterminate:
|
||||
SetScriptState (def->script, DLevelScript::SCRIPT_PleaseRemove);
|
||||
DPrintf ("Defered terminate of script %d\n", def->script);
|
||||
DPrintf ("Deferred terminate of script %d\n", def->script);
|
||||
break;
|
||||
}
|
||||
delete def;
|
||||
|
@ -7221,18 +7214,24 @@ void P_DoDeferedScripts ()
|
|||
level.info->defered = NULL;
|
||||
}
|
||||
|
||||
static void addDefered (level_info_t *i, acsdefered_t::EType type, int script, int arg0, int arg1, int arg2, AActor *who)
|
||||
static void addDefered (level_info_t *i, acsdefered_t::EType type, int script, const int *args, int argcount, AActor *who)
|
||||
{
|
||||
if (i)
|
||||
{
|
||||
acsdefered_t *def = new acsdefered_t;
|
||||
int j;
|
||||
|
||||
def->next = i->defered;
|
||||
def->type = type;
|
||||
def->script = script;
|
||||
def->arg0 = arg0;
|
||||
def->arg1 = arg1;
|
||||
def->arg2 = arg2;
|
||||
for (j = 0; j < countof(def->args) && j < argcount; ++j)
|
||||
{
|
||||
def->args[j] = args[j];
|
||||
}
|
||||
while (j < countof(def->args))
|
||||
{
|
||||
def->args[j++] = 0;
|
||||
}
|
||||
if (who != NULL && who->player != NULL)
|
||||
{
|
||||
def->playernum = int(who->player - players);
|
||||
|
@ -7242,14 +7241,13 @@ static void addDefered (level_info_t *i, acsdefered_t::EType type, int script, i
|
|||
def->playernum = -1;
|
||||
}
|
||||
i->defered = def;
|
||||
DPrintf ("Script %d on map %s defered\n", script, i->mapname);
|
||||
DPrintf ("Script %d on map %s deferred\n", script, i->mapname);
|
||||
}
|
||||
}
|
||||
|
||||
EXTERN_CVAR (Bool, sv_cheats)
|
||||
|
||||
int P_StartScript (AActor *who, line_t *where, int script, char *map, bool backSide,
|
||||
int arg0, int arg1, int arg2, int always, bool wantResultCode, bool net)
|
||||
int P_StartScript (AActor *who, line_t *where, int script, const char *map, const int *args, int argcount, int flags)
|
||||
{
|
||||
if (map == NULL || 0 == strnicmp (level.mapname, map, 8))
|
||||
{
|
||||
|
@ -7258,24 +7256,29 @@ int P_StartScript (AActor *who, line_t *where, int script, char *map, bool backS
|
|||
|
||||
if ((scriptdata = FBehavior::StaticFindScript (script, module)) != NULL)
|
||||
{
|
||||
if (net && netgame && !sv_cheats)
|
||||
if ((flags & ACS_NET) && netgame && !sv_cheats)
|
||||
{
|
||||
// If playing multiplayer and cheats are disallowed, check to
|
||||
// make sure only net scripts are run.
|
||||
if (!(scriptdata->Flags & SCRIPTF_Net))
|
||||
{
|
||||
Printf (PRINT_BOLD, "%s tried to puke script %d (%d, %d, %d)\n",
|
||||
who->player->userinfo.netname, script, arg0, arg1, arg2);
|
||||
Printf(PRINT_BOLD, "%s tried to puke script %d (\n",
|
||||
who->player->userinfo.netname, script);
|
||||
for (int i = 0; i < argcount; ++i)
|
||||
{
|
||||
Printf(PRINT_BOLD, "%d%s", args[i], i == argcount-1 ? "" : ", ");
|
||||
}
|
||||
Printf(PRINT_BOLD, ")\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
DLevelScript *runningScript = P_GetScriptGoing (who, where, script,
|
||||
scriptdata, module, backSide, arg0, arg1, arg2, always);
|
||||
scriptdata, module, args, argcount, flags);
|
||||
if (runningScript != NULL)
|
||||
{
|
||||
if (wantResultCode)
|
||||
if (flags & ACS_WANTRESULT)
|
||||
{
|
||||
return runningScript->RunScript ();
|
||||
return runningScript->RunScript();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -7283,17 +7286,17 @@ int P_StartScript (AActor *who, line_t *where, int script, char *map, bool backS
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!net || (who && who->player == &players[consoleplayer]))
|
||||
if (!(flags & ACS_NET) || (who && who->player == &players[consoleplayer]))
|
||||
{
|
||||
Printf ("P_StartScript: Unknown script %d\n", script);
|
||||
Printf("P_StartScript: Unknown script %d\n", script);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
addDefered (FindLevelInfo (map),
|
||||
always ? acsdefered_t::defexealways : acsdefered_t::defexecute,
|
||||
script, arg0, arg1, arg2, who);
|
||||
(flags & ACS_ALWAYS) ? acsdefered_t::defexealways : acsdefered_t::defexecute,
|
||||
script, args, argcount, who);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -7302,7 +7305,7 @@ int P_StartScript (AActor *who, line_t *where, int script, char *map, bool backS
|
|||
void P_SuspendScript (int script, char *map)
|
||||
{
|
||||
if (strnicmp (level.mapname, map, 8))
|
||||
addDefered (FindLevelInfo (map), acsdefered_t::defsuspend, script, 0, 0, 0, NULL);
|
||||
addDefered (FindLevelInfo (map), acsdefered_t::defsuspend, script, NULL, 0, NULL);
|
||||
else
|
||||
SetScriptState (script, DLevelScript::SCRIPT_Suspended);
|
||||
}
|
||||
|
@ -7310,7 +7313,7 @@ void P_SuspendScript (int script, char *map)
|
|||
void P_TerminateScript (int script, char *map)
|
||||
{
|
||||
if (strnicmp (level.mapname, map, 8))
|
||||
addDefered (FindLevelInfo (map), acsdefered_t::defterminate, script, 0, 0, 0, NULL);
|
||||
addDefered (FindLevelInfo (map), acsdefered_t::defterminate, script, NULL, 0, NULL);
|
||||
else
|
||||
SetScriptState (script, DLevelScript::SCRIPT_PleaseRemove);
|
||||
}
|
||||
|
@ -7330,7 +7333,7 @@ FArchive &operator<< (FArchive &arc, acsdefered_t *&defertop)
|
|||
type = (BYTE)defer->type;
|
||||
arc << type;
|
||||
P_SerializeACSScriptNumber(arc, defer->script, false);
|
||||
arc << defer->playernum << defer->arg0 << defer->arg1 << defer->arg2;
|
||||
arc << defer->playernum << defer->args[0] << defer->args[1] << defer->args[2];
|
||||
defer = defer->next;
|
||||
}
|
||||
more = 0;
|
||||
|
@ -7347,7 +7350,7 @@ FArchive &operator<< (FArchive &arc, acsdefered_t *&defertop)
|
|||
arc << more;
|
||||
(*defer)->type = (acsdefered_t::EType)more;
|
||||
P_SerializeACSScriptNumber(arc, (*defer)->script, false);
|
||||
arc << (*defer)->playernum << (*defer)->arg0 << (*defer)->arg1 << (*defer)->arg2;
|
||||
arc << (*defer)->playernum << (*defer)->args[0] << (*defer)->args[1] << (*defer)->args[2];
|
||||
defer = &((*defer)->next);
|
||||
arc << more;
|
||||
}
|
||||
|
|
|
@ -678,7 +678,7 @@ public:
|
|||
};
|
||||
|
||||
DLevelScript (AActor *who, line_t *where, int num, const ScriptPtr *code, FBehavior *module,
|
||||
bool backSide, int arg0, int arg1, int arg2, int always);
|
||||
const int *args, int argcount, int flags);
|
||||
~DLevelScript ();
|
||||
|
||||
void Serialize (FArchive &arc);
|
||||
|
@ -775,7 +775,7 @@ struct acsdefered_t
|
|||
defterminate
|
||||
} type;
|
||||
int script;
|
||||
int arg0, arg1, arg2;
|
||||
int args[3];
|
||||
int playernum;
|
||||
};
|
||||
|
||||
|
|
|
@ -1617,24 +1617,46 @@ FUNC(LS_ACS_Execute)
|
|||
// ACS_Execute (script, map, s_arg1, s_arg2, s_arg3)
|
||||
{
|
||||
level_info_t *info;
|
||||
const char *mapname = NULL;
|
||||
int args[3] = { arg2, arg3, arg4 };
|
||||
int flags = (backSide ? ACS_BACKSIDE : 0);
|
||||
|
||||
if (arg1 == 0)
|
||||
return P_StartScript (it, ln, arg0, level.mapname, backSide, arg2, arg3, arg4, false, false);
|
||||
else if ((info = FindLevelByNum (arg1)) )
|
||||
return P_StartScript (it, ln, arg0, info->mapname, backSide, arg2, arg3, arg4, false, false);
|
||||
else return false;
|
||||
{
|
||||
mapname = level.mapname;
|
||||
}
|
||||
else if ((info = FindLevelByNum(arg1)) != NULL)
|
||||
{
|
||||
mapname = info->mapname;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return P_StartScript(it, ln, arg0, mapname, args, 3, flags);
|
||||
}
|
||||
|
||||
FUNC(LS_ACS_ExecuteAlways)
|
||||
// ACS_ExecuteAlways (script, map, s_arg1, s_arg2, s_arg3)
|
||||
{
|
||||
level_info_t *info;
|
||||
const char *mapname = NULL;
|
||||
int args[3] = { arg2, arg3, arg4 };
|
||||
int flags = (backSide ? ACS_BACKSIDE : 0) | ACS_ALWAYS;
|
||||
|
||||
if (arg1 == 0)
|
||||
return P_StartScript (it, ln, arg0, level.mapname, backSide, arg2, arg3, arg4, true, false);
|
||||
else if ((info = FindLevelByNum (arg1)) )
|
||||
return P_StartScript (it, ln, arg0, info->mapname, backSide, arg2, arg3, arg4, true, false);
|
||||
else return false;
|
||||
{
|
||||
mapname = level.mapname;
|
||||
}
|
||||
else if ((info = FindLevelByNum(arg1)) != NULL)
|
||||
{
|
||||
mapname = info->mapname;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return P_StartScript(it, ln, arg0, mapname, args, 3, flags);
|
||||
}
|
||||
|
||||
FUNC(LS_ACS_LockedExecute)
|
||||
|
@ -1656,12 +1678,15 @@ FUNC(LS_ACS_LockedExecuteDoor)
|
|||
}
|
||||
|
||||
FUNC(LS_ACS_ExecuteWithResult)
|
||||
// ACS_ExecuteWithResult (script, s_arg1, s_arg2, s_arg3)
|
||||
// ACS_ExecuteWithResult (script, s_arg1, s_arg2, s_arg3, s_arg4)
|
||||
{
|
||||
// This is like ACS_ExecuteAlways, except the script is always run on
|
||||
// the current map, and the return value is whatever the script sets
|
||||
// with SetResultValue.
|
||||
return P_StartScript (it, ln, arg0, level.mapname, backSide, arg1, arg2, arg3, true, true);
|
||||
int args[4] = { arg1, arg2, arg3, arg4 };
|
||||
int flags = (backSide ? ACS_BACKSIDE : 0) | ACS_ALWAYS | ACS_WANTRESULT;
|
||||
|
||||
return P_StartScript (it, ln, arg0, level.mapname, args, 4, flags);
|
||||
}
|
||||
|
||||
FUNC(LS_ACS_Suspend)
|
||||
|
|
|
@ -4281,8 +4281,8 @@ bool P_UsePuzzleItem (AActor *PuzzleItemUser, int PuzzleItemType)
|
|||
{ // Item type doesn't match
|
||||
return false;
|
||||
}
|
||||
P_StartScript (PuzzleItemUser, in->d.line, in->d.line->args[1], NULL, 0,
|
||||
in->d.line->args[2], in->d.line->args[3], in->d.line->args[4], true, false);
|
||||
int args[3] = { in->d.line->args[2], in->d.line->args[3], in->d.line->args[4] };
|
||||
P_StartScript (PuzzleItemUser, in->d.line, in->d.line->args[1], NULL, args, 3, ACS_ALWAYS);
|
||||
in->d.line->special = 0;
|
||||
return true;
|
||||
}
|
||||
|
@ -4296,8 +4296,8 @@ bool P_UsePuzzleItem (AActor *PuzzleItemUser, int PuzzleItemType)
|
|||
{ // Item type doesn't match
|
||||
continue;
|
||||
}
|
||||
P_StartScript (PuzzleItemUser, NULL, mobj->args[1], NULL, 0,
|
||||
mobj->args[2], mobj->args[3], mobj->args[4], true, false);
|
||||
int args[3] = { mobj->args[2], mobj->args[3], mobj->args[4] };
|
||||
P_StartScript (PuzzleItemUser, NULL, mobj->args[1], NULL, args, 3, ACS_ALWAYS);
|
||||
mobj->special = 0;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -889,8 +889,12 @@ bool EV_TeleportSector (int tag, int source_tid, int dest_tid, bool fog, int gro
|
|||
// [RH] ACS (see also p_acs.h)
|
||||
//
|
||||
|
||||
int P_StartScript (AActor *who, line_t *where, int script, char *map, bool backSide,
|
||||
int arg0, int arg1, int arg2, int always, bool wantResultCode, bool net=false);
|
||||
#define ACS_BACKSIDE 1
|
||||
#define ACS_ALWAYS 2
|
||||
#define ACS_WANTRESULT 4
|
||||
#define ACS_NET 8
|
||||
|
||||
int P_StartScript (AActor *who, line_t *where, int script, const char *map, const int *args, int argcount, int flags);
|
||||
void P_SuspendScript (int script, char *map);
|
||||
void P_TerminateScript (int script, char *map);
|
||||
void P_DoDeferedScripts (void);
|
||||
|
|
Loading…
Reference in a new issue