- Allow NULL.

- Instead of reverting the teleport fog back to defaults, if there wasn't a class or if the class failed to be found, set it to NULL.
- P_SpawnTeleportFog will not spawn anything if it's NULL.
- Added "" so it can be used to mean 'don't change anything' for A_SetTeleFog.
This commit is contained in:
MajorCooke 2014-12-18 09:19:39 -06:00
parent a2bb673370
commit dcab57b236
3 changed files with 16 additions and 5 deletions

View File

@ -79,7 +79,8 @@ void P_SpawnTeleportFog(AActor *mobj, fixed_t x, fixed_t y, fixed_t z, bool befo
AActor *mo;
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);
//Do nothing.
mo = NULL;
}
else
{

View File

@ -5395,11 +5395,21 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTeleFog)
ACTION_PARAM_NAME(oldpos, 0);
ACTION_PARAM_NAME(newpos, 1);
const PClass *check = PClass::FindClass(oldpos);
if (check != NULL)
if (check == NULL || !stricmp(oldpos, "none") || !stricmp(oldpos, "null"))
self->TeleFogSourceType = NULL;
else if (!stricmp(oldpos, ""))
{ //Don't change it if it's just ""
}
else
self->TeleFogSourceType = check;
check = PClass::FindClass(newpos);
if (check != NULL)
if (check == NULL || !stricmp(newpos, "none") || !stricmp(newpos, "null"))
self->TeleFogDestType = NULL;
else if (!stricmp(newpos, ""))
{ //Don't change it if it's just ""
}
else
self->TeleFogDestType = check;
}

View File

@ -1422,7 +1422,7 @@ DEFINE_PROPERTY(stamina, I, Actor)
DEFINE_PROPERTY(telefogsourcetype, S, Actor)
{
PROP_STRING_PARM(str, 0);
if (!stricmp(str,"") || *str == 0) defaults->TeleFogSourceType = PClass::FindClass("TeleportFog");
if (!stricmp(str, "") || (!stricmp(str, "none")) || (!stricmp(str, "null")) || *str == 0) 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, "") || *str == 0) defaults->TeleFogDestType = PClass::FindClass("TeleportFog");
if (!stricmp(str, "") || (!stricmp(str, "none")) || (!stricmp(str, "null")) || *str == 0) defaults->TeleFogDestType = NULL;
else defaults->TeleFogDestType = FindClassTentative(str, "TeleportFog");
}