mirror of https://github.com/ZDoom/gzdoom.git
Changed the behavior of SetActorTeleFog.
- Don't force "null" to resolve to no actor since "none" is already defined as NULL (via FindClass). (This change also applies to the decorate properties.) - Passing an empty actor name will keep the existing fog since there's otherwise no way set only one fog. Since "none" works to remove the fog, I see no reason not to have this option.
This commit is contained in:
parent
3849cb8623
commit
5f56fb5a16
|
@ -4767,25 +4767,19 @@ static void SetActorRoll(AActor *activator, int tid, int angle, bool interpolate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetActorTeleFog(AActor *activator, int tid, FName telefogsrc, FName telefogdest)
|
static void SetActorTeleFog(AActor *activator, int tid, FString telefogsrc, FString telefogdest)
|
||||||
{
|
{
|
||||||
//Simply put, if it doesn't exist, it won't change. One can use "" in this scenario.
|
// Set the actor's telefog to the specified actor. Handle "" as "don't
|
||||||
const PClass *check;
|
// change" since "None" should work just fine for disabling the fog (given
|
||||||
|
// that it will resolve to NAME_None which is not a valid actor name).
|
||||||
if (tid == 0)
|
if (tid == 0)
|
||||||
{
|
{
|
||||||
if (activator != NULL)
|
if (activator != NULL)
|
||||||
{
|
{
|
||||||
check = PClass::FindClass(telefogsrc);
|
if (telefogsrc.IsNotEmpty())
|
||||||
if (check == NULL || !stricmp(telefogsrc, "none") || !stricmp(telefogsrc, "null"))
|
activator->TeleFogSourceType = PClass::FindClass(telefogsrc);
|
||||||
activator->TeleFogSourceType = NULL;
|
if (telefogdest.IsNotEmpty())
|
||||||
else
|
activator->TeleFogDestType = PClass::FindClass(telefogdest);
|
||||||
activator->TeleFogSourceType = check;
|
|
||||||
|
|
||||||
check = PClass::FindClass(telefogdest);
|
|
||||||
if (check == NULL || !stricmp(telefogdest, "none") || !stricmp(telefogdest, "null"))
|
|
||||||
activator->TeleFogDestType = NULL;
|
|
||||||
else
|
|
||||||
activator->TeleFogDestType = check;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -4793,19 +4787,14 @@ static void SetActorTeleFog(AActor *activator, int tid, FName telefogsrc, FName
|
||||||
FActorIterator iterator(tid);
|
FActorIterator iterator(tid);
|
||||||
AActor *actor;
|
AActor *actor;
|
||||||
|
|
||||||
|
const PClass * const src = telefogsrc.IsNotEmpty() ? PClass::FindClass(telefogsrc) : NULL;
|
||||||
|
const PClass * const dest = telefogdest.IsNotEmpty() ? PClass::FindClass(telefogdest) : NULL;
|
||||||
while ((actor = iterator.Next()))
|
while ((actor = iterator.Next()))
|
||||||
{
|
{
|
||||||
check = PClass::FindClass(telefogsrc);
|
if (telefogsrc.IsNotEmpty())
|
||||||
if (check == NULL || !stricmp(telefogsrc, "none") || !stricmp(telefogsrc, "null"))
|
actor->TeleFogSourceType = src;
|
||||||
actor->TeleFogSourceType = NULL;
|
if (telefogdest.IsNotEmpty())
|
||||||
else
|
actor->TeleFogDestType = dest;
|
||||||
actor->TeleFogSourceType = check;
|
|
||||||
|
|
||||||
check = PClass::FindClass(telefogdest);
|
|
||||||
if (check == NULL || !stricmp(telefogdest, "none") || !stricmp(telefogdest, "null"))
|
|
||||||
actor->TeleFogDestType = NULL;
|
|
||||||
else
|
|
||||||
actor->TeleFogDestType = check;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1422,7 +1422,7 @@ DEFINE_PROPERTY(stamina, I, Actor)
|
||||||
DEFINE_PROPERTY(telefogsourcetype, S, Actor)
|
DEFINE_PROPERTY(telefogsourcetype, S, Actor)
|
||||||
{
|
{
|
||||||
PROP_STRING_PARM(str, 0);
|
PROP_STRING_PARM(str, 0);
|
||||||
if (!stricmp(str, "") || (!stricmp(str, "none")) || (!stricmp(str, "null")) || *str == 0) defaults->TeleFogSourceType = NULL;
|
if (!stricmp(str, "") || !stricmp(str, "none")) defaults->TeleFogSourceType = NULL;
|
||||||
else defaults->TeleFogSourceType = FindClassTentative(str,"TeleportFog");
|
else defaults->TeleFogSourceType = FindClassTentative(str,"TeleportFog");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1432,7 +1432,7 @@ DEFINE_PROPERTY(telefogsourcetype, S, Actor)
|
||||||
DEFINE_PROPERTY(telefogdesttype, S, Actor)
|
DEFINE_PROPERTY(telefogdesttype, S, Actor)
|
||||||
{
|
{
|
||||||
PROP_STRING_PARM(str, 0);
|
PROP_STRING_PARM(str, 0);
|
||||||
if (!stricmp(str, "") || (!stricmp(str, "none")) || (!stricmp(str, "null")) || *str == 0) defaults->TeleFogDestType = NULL;
|
if (!stricmp(str, "") || !stricmp(str, "none")) defaults->TeleFogDestType = NULL;
|
||||||
else defaults->TeleFogDestType = FindClassTentative(str, "TeleportFog");
|
else defaults->TeleFogDestType = FindClassTentative(str, "TeleportFog");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue