From dcab57b236d79fd40229e6feb90c8bc9d360ad70 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Thu, 18 Dec 2014 09:19:39 -0600 Subject: [PATCH] - 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. --- src/p_teleport.cpp | 3 ++- src/thingdef/thingdef_codeptr.cpp | 14 ++++++++++++-- src/thingdef/thingdef_properties.cpp | 4 ++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/p_teleport.cpp b/src/p_teleport.cpp index a73ff75e7..762cd01fe 100644 --- a/src/p_teleport.cpp +++ b/src/p_teleport.cpp @@ -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(x, y, z, ALLOW_REPLACE); + //Do nothing. + mo = NULL; } else { diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index aa643de8c..9eda64a81 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -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; } diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index 0c4ec25cb..b6a2937ae 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -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"); }