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:
Braden Obrzut 2015-03-30 21:54:58 -04:00
parent 3849cb8623
commit 5f56fb5a16
2 changed files with 16 additions and 27 deletions

View File

@ -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.
const PClass *check;
// Set the actor's telefog to the specified actor. Handle "" as "don't
// 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 (activator != NULL)
{
check = PClass::FindClass(telefogsrc);
if (check == NULL || !stricmp(telefogsrc, "none") || !stricmp(telefogsrc, "null"))
activator->TeleFogSourceType = NULL;
else
activator->TeleFogSourceType = check;
check = PClass::FindClass(telefogdest);
if (check == NULL || !stricmp(telefogdest, "none") || !stricmp(telefogdest, "null"))
activator->TeleFogDestType = NULL;
else
activator->TeleFogDestType = check;
if (telefogsrc.IsNotEmpty())
activator->TeleFogSourceType = PClass::FindClass(telefogsrc);
if (telefogdest.IsNotEmpty())
activator->TeleFogDestType = PClass::FindClass(telefogdest);
}
}
else
@ -4793,19 +4787,14 @@ static void SetActorTeleFog(AActor *activator, int tid, FName telefogsrc, FName
FActorIterator iterator(tid);
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()))
{
check = PClass::FindClass(telefogsrc);
if (check == NULL || !stricmp(telefogsrc, "none") || !stricmp(telefogsrc, "null"))
actor->TeleFogSourceType = NULL;
else
actor->TeleFogSourceType = check;
check = PClass::FindClass(telefogdest);
if (check == NULL || !stricmp(telefogdest, "none") || !stricmp(telefogdest, "null"))
actor->TeleFogDestType = NULL;
else
actor->TeleFogDestType = check;
if (telefogsrc.IsNotEmpty())
actor->TeleFogSourceType = src;
if (telefogdest.IsNotEmpty())
actor->TeleFogDestType = dest;
}
}
}

View File

@ -1422,7 +1422,7 @@ DEFINE_PROPERTY(stamina, I, Actor)
DEFINE_PROPERTY(telefogsourcetype, S, Actor)
{
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");
}
@ -1432,7 +1432,7 @@ DEFINE_PROPERTY(telefogsourcetype, S, Actor)
DEFINE_PROPERTY(telefogdesttype, S, Actor)
{
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");
}