- Merged the GC branch back into the trunk, so now it can receive more
testing from the people who download SVN trunk builds. SVN r795 (trunk)
This commit is contained in:
parent
3bfcc5c09c
commit
f2660dc336
88 changed files with 2541 additions and 1523 deletions
|
|
@ -106,7 +106,7 @@ 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, bool delay);
|
||||
bool lineSide, int arg0, int arg1, int arg2, int always);
|
||||
|
||||
struct FBehavior::ArrayInfo
|
||||
{
|
||||
|
|
@ -456,7 +456,7 @@ private:
|
|||
sector_t *Sector;
|
||||
fixed_t WatchD, LastD;
|
||||
int Special, Arg0, Arg1, Arg2, Arg3, Arg4;
|
||||
AActor *Activator;
|
||||
TObjPtr<AActor> Activator;
|
||||
line_t *Line;
|
||||
bool LineSide;
|
||||
bool bCeiling;
|
||||
|
|
@ -1530,7 +1530,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, true);
|
||||
ptr, this, 0, arg1, 0, 0, always);
|
||||
if (runNow)
|
||||
{
|
||||
runningScript->RunScript ();
|
||||
|
|
@ -1557,7 +1557,10 @@ void FBehavior::StaticStopMyScripts (AActor *actor)
|
|||
|
||||
//---- The ACS Interpreter ----//
|
||||
|
||||
IMPLEMENT_CLASS (DACSThinker)
|
||||
IMPLEMENT_POINTY_CLASS (DACSThinker)
|
||||
DECLARE_POINTER(LastScript)
|
||||
DECLARE_POINTER(Scripts)
|
||||
END_POINTERS
|
||||
|
||||
DACSThinker *DACSThinker::ActiveThinker = NULL;
|
||||
|
||||
|
|
@ -1579,13 +1582,6 @@ DACSThinker::DACSThinker ()
|
|||
|
||||
DACSThinker::~DACSThinker ()
|
||||
{
|
||||
DLevelScript *script = Scripts;
|
||||
while (script)
|
||||
{
|
||||
DLevelScript *next = script->next;
|
||||
script->Destroy ();
|
||||
script = next;
|
||||
}
|
||||
Scripts = NULL;
|
||||
ActiveThinker = NULL;
|
||||
}
|
||||
|
|
@ -1647,7 +1643,9 @@ void DACSThinker::StopScriptsFor (AActor *actor)
|
|||
}
|
||||
|
||||
IMPLEMENT_POINTY_CLASS (DLevelScript)
|
||||
DECLARE_POINTER (activator)
|
||||
DECLARE_POINTER(next)
|
||||
DECLARE_POINTER(prev)
|
||||
DECLARE_POINTER(activator)
|
||||
END_POINTERS
|
||||
|
||||
void DLevelScript::Serialize (FArchive &arc)
|
||||
|
|
@ -1713,13 +1711,25 @@ void DLevelScript::Unlink ()
|
|||
DACSThinker *controller = DACSThinker::ActiveThinker;
|
||||
|
||||
if (controller->LastScript == this)
|
||||
{
|
||||
controller->LastScript = prev;
|
||||
GC::WriteBarrier(controller, prev);
|
||||
}
|
||||
if (controller->Scripts == this)
|
||||
{
|
||||
controller->Scripts = next;
|
||||
GC::WriteBarrier(controller, next);
|
||||
}
|
||||
if (prev)
|
||||
{
|
||||
prev->next = next;
|
||||
GC::WriteBarrier(prev, next);
|
||||
}
|
||||
if (next)
|
||||
{
|
||||
next->prev = prev;
|
||||
GC::WriteBarrier(next, prev);
|
||||
}
|
||||
}
|
||||
|
||||
void DLevelScript::Link ()
|
||||
|
|
@ -1727,12 +1737,19 @@ void DLevelScript::Link ()
|
|||
DACSThinker *controller = DACSThinker::ActiveThinker;
|
||||
|
||||
next = controller->Scripts;
|
||||
GC::WriteBarrier(this, next);
|
||||
if (controller->Scripts)
|
||||
{
|
||||
controller->Scripts->prev = this;
|
||||
GC::WriteBarrier(controller->Scripts, this);
|
||||
}
|
||||
prev = NULL;
|
||||
controller->Scripts = this;
|
||||
GC::WriteBarrier(controller, this);
|
||||
if (controller->LastScript == NULL)
|
||||
{
|
||||
controller->LastScript = this;
|
||||
}
|
||||
}
|
||||
|
||||
void DLevelScript::PutLast ()
|
||||
|
|
@ -4852,9 +4869,9 @@ int DLevelScript::RunScript ()
|
|||
}
|
||||
else
|
||||
{
|
||||
if (activator->IsKindOf (RUNTIME_CLASS(AScriptedMarine)))
|
||||
if (activator != NULL && activator->IsKindOf (RUNTIME_CLASS(AScriptedMarine)))
|
||||
{
|
||||
static_cast<AScriptedMarine *>(activator)->SetWeapon (
|
||||
barrier_cast<AScriptedMarine *>(activator)->SetWeapon (
|
||||
(AScriptedMarine::EMarineWeapon)STACK(1));
|
||||
}
|
||||
}
|
||||
|
|
@ -4879,9 +4896,9 @@ int DLevelScript::RunScript ()
|
|||
}
|
||||
else
|
||||
{
|
||||
if (activator->IsKindOf (RUNTIME_CLASS(AScriptedMarine)))
|
||||
if (activator != NULL && activator->IsKindOf (RUNTIME_CLASS(AScriptedMarine)))
|
||||
{
|
||||
static_cast<AScriptedMarine *>(activator)->SetSprite (type);
|
||||
barrier_cast<AScriptedMarine *>(activator)->SetSprite (type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5114,7 +5131,7 @@ int DLevelScript::RunScript ()
|
|||
|
||||
if (STACK(3) == 0)
|
||||
{
|
||||
state = RUNTIME_TYPE(activator)->ActorInfo->FindState (statelist.Size(), &statelist[0], !!STACK(1));
|
||||
state = activator->GetClass()->ActorInfo->FindState (statelist.Size(), &statelist[0], !!STACK(1));
|
||||
if (state != NULL)
|
||||
{
|
||||
activator->SetState (state);
|
||||
|
|
@ -5133,7 +5150,7 @@ int DLevelScript::RunScript ()
|
|||
|
||||
while ( (actor = iterator.Next ()) )
|
||||
{
|
||||
state = RUNTIME_TYPE(actor)->ActorInfo->FindState (statelist.Size(), &statelist[0], !!STACK(1));
|
||||
state = actor->GetClass()->ActorInfo->FindState (statelist.Size(), &statelist[0], !!STACK(1));
|
||||
if (state != NULL)
|
||||
{
|
||||
actor->SetState (state);
|
||||
|
|
@ -5309,7 +5326,6 @@ int DLevelScript::RunScript ()
|
|||
Unlink ();
|
||||
if (controller->RunningScripts[script] == this)
|
||||
controller->RunningScripts[script] = NULL;
|
||||
this->Destroy ();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -5326,7 +5342,7 @@ 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, bool delay)
|
||||
bool backSide, int arg0, int arg1, int arg2, int always)
|
||||
{
|
||||
DACSThinker *controller = DACSThinker::ActiveThinker;
|
||||
|
||||
|
|
@ -5340,11 +5356,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, delay);
|
||||
return new DLevelScript (who, where, num, code, module, backSide, arg0, arg1, arg2, always);
|
||||
}
|
||||
|
||||
DLevelScript::DLevelScript (AActor *who, line_t *where, int num, const ScriptPtr *code, FBehavior *module,
|
||||
bool backside, int arg0, int arg1, int arg2, int always, bool delay)
|
||||
bool backside, int arg0, int arg1, int arg2, int always)
|
||||
: activeBehavior (module)
|
||||
{
|
||||
if (DACSThinker::ActiveThinker == NULL)
|
||||
|
|
@ -5363,17 +5379,12 @@ DLevelScript::DLevelScript (AActor *who, line_t *where, int num, const ScriptPtr
|
|||
backSide = backside;
|
||||
activefont = SmallFont;
|
||||
hudwidth = hudheight = 0;
|
||||
if (delay)
|
||||
{
|
||||
// From Hexen: Give the world some time to set itself up before running open scripts.
|
||||
//script->state = SCRIPT_Delayed;
|
||||
//script->statedata = TICRATE;
|
||||
state = SCRIPT_Running;
|
||||
}
|
||||
else
|
||||
{
|
||||
state = SCRIPT_Running;
|
||||
}
|
||||
state = SCRIPT_Running;
|
||||
// Hexen waited one second before executing any open scripts. I didn't realize
|
||||
// this when I wrote my ACS implementation. Now that I know, it's still best to
|
||||
// run them right away because there are several map properties that can't be
|
||||
// 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)
|
||||
DACSThinker::ActiveThinker->RunningScripts[num] = this;
|
||||
|
|
@ -5414,7 +5425,7 @@ void P_DoDeferedScripts ()
|
|||
NULL, def->script,
|
||||
scriptdata, module,
|
||||
0, def->arg0, def->arg1, def->arg2,
|
||||
def->type == acsdefered_t::defexealways, true);
|
||||
def->type == acsdefered_t::defexealways);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -5487,7 +5498,7 @@ int P_StartScript (AActor *who, line_t *where, int script, char *map, bool backS
|
|||
}
|
||||
}
|
||||
DLevelScript *runningScript = P_GetScriptGoing (who, where, script,
|
||||
scriptdata, module, backSide, arg0, arg1, arg2, always, false);
|
||||
scriptdata, module, backSide, arg0, arg1, arg2, always);
|
||||
if (runningScript != NULL)
|
||||
{
|
||||
if (wantResultCode)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue