mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- Rewrote a bunch of things for stability.
This commit is contained in:
parent
160ded99a9
commit
93ca8502dd
7 changed files with 117 additions and 17 deletions
|
@ -983,8 +983,8 @@ public:
|
|||
|
||||
FNameNoInit PainType;
|
||||
FNameNoInit DeathType;
|
||||
FNameNoInit TeleFogSourceType;
|
||||
FNameNoInit TeleFogDestType;
|
||||
const PClass *TeleFogSourceType;
|
||||
const PClass *TeleFogDestType;
|
||||
|
||||
FState *SpawnState;
|
||||
FState *SeeState;
|
||||
|
|
|
@ -4438,6 +4438,8 @@ enum EACSFunctions
|
|||
ACSF_PickActor,
|
||||
ACSF_IsPointerEqual,
|
||||
ACSF_CanRaiseActor,
|
||||
ACSF_SetActorTeleFog, // 86
|
||||
ACSF_SwapActorTeleFog,
|
||||
|
||||
/* Zandronum's - these must be skipped when we reach 99!
|
||||
-100:ResetMap(0),
|
||||
|
@ -4749,6 +4751,72 @@ static void SetActorPitch(AActor *activator, int tid, int angle, bool interpolat
|
|||
}
|
||||
}
|
||||
|
||||
static void SetActorTeleFog(AActor *activator, int tid, FName telefogsrc, FName telefogdest)
|
||||
{
|
||||
//Simply put, if it doesn't exist, it won't change. One can use "" in this scenario.
|
||||
const PClass *check;
|
||||
if (tid == 0)
|
||||
{
|
||||
if (activator != NULL)
|
||||
{
|
||||
check = PClass::FindClass(telefogsrc);
|
||||
if (check != NULL)
|
||||
activator->TeleFogSourceType = check;
|
||||
check = PClass::FindClass(telefogdest);
|
||||
if (check != NULL)
|
||||
activator->TeleFogDestType = check;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FActorIterator iterator(tid);
|
||||
AActor *actor;
|
||||
|
||||
while ((actor = iterator.Next()))
|
||||
{
|
||||
check = PClass::FindClass(telefogsrc);
|
||||
if (check != NULL)
|
||||
activator->TeleFogSourceType = check;
|
||||
check = PClass::FindClass(telefogdest);
|
||||
if (check != NULL)
|
||||
activator->TeleFogDestType = check;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int SwapActorTeleFog(AActor *activator, int tid)
|
||||
{
|
||||
int count = 0;
|
||||
if (tid == 0)
|
||||
{
|
||||
if ((activator == NULL) || (activator->TeleFogSourceType = activator->TeleFogDestType))
|
||||
return 0; //Does nothing if they're the same.
|
||||
else
|
||||
{
|
||||
const PClass *temp = activator->TeleFogSourceType;
|
||||
activator->TeleFogSourceType = activator->TeleFogDestType;
|
||||
activator->TeleFogDestType = temp;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FActorIterator iterator(tid);
|
||||
AActor *actor;
|
||||
|
||||
while ((actor = iterator.Next()))
|
||||
{
|
||||
if (activator->TeleFogSourceType == activator->TeleFogDestType)
|
||||
continue; //They're the same. Save the effort.
|
||||
const PClass *temp = activator->TeleFogSourceType;
|
||||
activator->TeleFogSourceType = activator->TeleFogDestType;
|
||||
activator->TeleFogDestType = temp;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args, const SDWORD *stack, int stackdepth)
|
||||
|
@ -5662,7 +5730,18 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
|
|||
SetActorPitch(activator, args[0], args[1], argCount > 2 ? !!args[2] : false);
|
||||
}
|
||||
break;
|
||||
|
||||
case ACSF_SetActorTeleFog:
|
||||
if (argCount >= 3)
|
||||
{
|
||||
SetActorTeleFog(activator, args[0], FBehavior::StaticLookupString(args[1]), FBehavior::StaticLookupString(args[2]));
|
||||
}
|
||||
break;
|
||||
case ACSF_SwapActorTeleFog:
|
||||
if (argCount >= 1)
|
||||
{
|
||||
return SwapActorTeleFog(activator, args[0]);
|
||||
}
|
||||
break;
|
||||
case ACSF_PickActor:
|
||||
if (argCount >= 5)
|
||||
{
|
||||
|
|
|
@ -333,7 +333,11 @@ void AActor::Serialize (FArchive &arc)
|
|||
{
|
||||
arc << FriendPlayer;
|
||||
}
|
||||
|
||||
if (SaveVersion >= 4518)
|
||||
{
|
||||
arc << TeleFogSourceType
|
||||
<< TeleFogDestType;
|
||||
}
|
||||
{
|
||||
FString tagstr;
|
||||
if (arc.IsStoring() && Tag != NULL && Tag->Len() > 0) tagstr = *Tag;
|
||||
|
|
|
@ -77,15 +77,13 @@ void ATeleportFog::PostBeginPlay ()
|
|||
void P_SpawnTeleportFog(AActor *mobj, fixed_t x, fixed_t y, fixed_t z, bool beforeTele, bool setTarget)
|
||||
{
|
||||
AActor *mo;
|
||||
FNameNoInit tf = (beforeTele ? mobj->TeleFogSourceType : mobj->TeleFogDestType);
|
||||
|
||||
if (!tf) //If the actor doesn't have one, initialize the original.
|
||||
if ((beforeTele ? mobj->TeleFogSourceType : mobj->TeleFogDestType) == NULL) //If the actor doesn't have one, initialize the original.
|
||||
{
|
||||
mo = Spawn<ATeleportFog>(x, y, z, ALLOW_REPLACE);
|
||||
}
|
||||
else
|
||||
{
|
||||
mo = Spawn(tf, x, y, z, ALLOW_REPLACE);
|
||||
mo = Spawn((beforeTele ? mobj->TeleFogSourceType : mobj->TeleFogDestType), x, y, z, ALLOW_REPLACE);
|
||||
}
|
||||
|
||||
if (mo != NULL && setTarget)
|
||||
|
|
|
@ -5385,6 +5385,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Remove)
|
|||
//
|
||||
// Sets the teleport fog(s) for the calling actor.
|
||||
// Takes a name of the classes for te source and destination.
|
||||
// Can set both at the same time. Use "" to retain the previous fog without
|
||||
// changing it.
|
||||
//===========================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTeleFog)
|
||||
|
@ -5392,11 +5394,28 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTeleFog)
|
|||
ACTION_PARAM_START(2);
|
||||
ACTION_PARAM_NAME(oldpos, 0);
|
||||
ACTION_PARAM_NAME(newpos, 1);
|
||||
const PClass *check = PClass::FindClass(oldpos);
|
||||
if (check != NULL)
|
||||
self->TeleFogSourceType = check;
|
||||
|
||||
if (oldpos)
|
||||
self->TeleFogSourceType = oldpos;
|
||||
if (newpos)
|
||||
self->TeleFogDestType = newpos;
|
||||
check = PClass::FindClass(newpos);
|
||||
if (check != NULL)
|
||||
self->TeleFogDestType = check;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// A_SwapTeleFog
|
||||
//
|
||||
// Switches the source and dest telefogs around.
|
||||
//===========================================================================
|
||||
|
||||
DEFINE_ACTION_FUNCTION(AActor, A_SwapTeleFog)
|
||||
{
|
||||
if ((self->TeleFogSourceType != self->TeleFogDestType)) //Does nothing if they're the same.
|
||||
{
|
||||
const PClass *temp = self->TeleFogSourceType;
|
||||
self->TeleFogSourceType = self->TeleFogDestType;
|
||||
self->TeleFogDestType = temp;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1422,8 +1422,8 @@ DEFINE_PROPERTY(stamina, I, Actor)
|
|||
DEFINE_PROPERTY(telefogsourcetype, S, Actor)
|
||||
{
|
||||
PROP_STRING_PARM(str, 0);
|
||||
if (str == NULL || *str == 0 || (!stricmp(str,""))) defaults->TeleFogSourceType = "TeleportFog";
|
||||
else defaults->TeleFogSourceType = str;
|
||||
if (!stricmp(str,"") || *str == 0) defaults->TeleFogSourceType = PClass::FindClass("TeleportFog");
|
||||
else defaults->TeleFogSourceType = FindClassTentative(str,"TeleportFog");
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -1432,8 +1432,8 @@ DEFINE_PROPERTY(telefogsourcetype, S, Actor)
|
|||
DEFINE_PROPERTY(telefogdesttype, S, Actor)
|
||||
{
|
||||
PROP_STRING_PARM(str, 0);
|
||||
if (str == NULL || *str == 0 || (!stricmp(str, ""))) defaults->TeleFogDestType = "TeleportFog";
|
||||
else defaults->TeleFogDestType = str;
|
||||
if (!stricmp(str, "") || *str == 0) defaults->TeleFogDestType = PClass::FindClass("TeleportFog");
|
||||
else defaults->TeleFogDestType = FindClassTentative(str, "TeleportFog");
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -76,7 +76,7 @@ const char *GetVersionString();
|
|||
|
||||
// Use 4500 as the base git save version, since it's higher than the
|
||||
// SVN revision ever got.
|
||||
#define SAVEVER 4516
|
||||
#define SAVEVER 4518
|
||||
|
||||
#define SAVEVERSTRINGIFY2(x) #x
|
||||
#define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)
|
||||
|
|
Loading…
Reference in a new issue