From 425dad951bd5220cca1e3ba77b7cddc5c378449a Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Sat, 29 Aug 2020 03:15:43 +0200 Subject: [PATCH] Seperated info_null and info_notnull into their own files. People can enable a flag that'll warn about info_null's being used in the maps, etc. --- src/gs-entbase/server.src | 2 + src/gs-entbase/server/info_notnull.cpp | 40 +++++++++++++++ src/gs-entbase/server/info_null.cpp | 71 ++++++++++++++++++++++++++ src/gs-entbase/server/infodecal.cpp | 2 +- src/gs-entbase/server/stubs.cpp | 22 -------- 5 files changed, 114 insertions(+), 23 deletions(-) create mode 100644 src/gs-entbase/server/info_notnull.cpp create mode 100644 src/gs-entbase/server/info_null.cpp diff --git a/src/gs-entbase/server.src b/src/gs-entbase/server.src index 244ccab8..52e9c800 100644 --- a/src/gs-entbase/server.src +++ b/src/gs-entbase/server.src @@ -12,6 +12,8 @@ server/basemonster.cpp server/basenpc.cpp server/basephysics.cpp server/basevehicle.cpp +server/info_null.cpp +server/info_notnull.cpp server/button_target.cpp server/ambient_generic.cpp server/cycler.cpp diff --git a/src/gs-entbase/server/info_notnull.cpp b/src/gs-entbase/server/info_notnull.cpp new file mode 100644 index 00000000..ef6ea7d3 --- /dev/null +++ b/src/gs-entbase/server/info_notnull.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2016-2020 Marco Hladik + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER + * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + +/*QUAKED info_notnull (1 0 0) (-8 -8 -8) (8 8 8) +"targetname" Name + +Helper entity for the game-logic its vast array of entities. +It is most commonly used to aim active in-game entities towards a specific +location. + +For tasks such as aiming static/lightmapped light sources during the compiling +process, please use info_null instead as it'll get removed after it has served +its purpose. +*/ + + +class info_notnull:CBaseTrigger +{ + void(void) info_notnull; +}; + +void +info_notnull::info_notnull(void) +{ + CBaseTrigger::CBaseTrigger(); +} diff --git a/src/gs-entbase/server/info_null.cpp b/src/gs-entbase/server/info_null.cpp new file mode 100644 index 00000000..0c4ce9e3 --- /dev/null +++ b/src/gs-entbase/server/info_null.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2016-2020 Marco Hladik + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER + * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/*QUAKED info_null (1 0 0) (-8 -8 -8) (8 8 8) +"targetname" Name + +Helper entity for the map creation process only. +It is supposed to be removed after compilation of a .bsp file. + +If you're pointing any active game-logic entities to this entity, +prepare to crash. +*/ + +class info_null:CBaseEntity +{ + void(void) info_null; + +#ifdef DEBUG_INFONULL + virtual void(void) WarnDeveloper; + virtual void(void) Respawn; +#endif +}; + +#ifdef DEBUG_INFONULL +void +info_null::WarnDeveloper(void) +{ + if (!m_strTargetName) + return; + + for (entity f = world; (f = find(f, CBaseEntity::m_strTarget, m_strTargetName));) { + CBaseEntity enty = (CBaseTrigger)f; + if (enty.gflags == GF_CANRESPAWN) + if (enty.m_strTarget == m_strTargetName) { + print(sprintf("^1info_null::WarnDeveloper^7: " \ + "%s (%s) is targetting an info_null called %s\n", + enty.m_strTargetName, enty.classname, m_strTargetName)); + } + } +} + +void +info_null::Respawn(void) +{ + nextthink = time + 0.1f; + think = WarnDeveloper; +} +#endif + +void +info_null::info_null(void) +{ +#ifdef DEBUG_INFONULL + CBaseEntity::CBaseEntity(); +#else + remove(self); +#endif +} diff --git a/src/gs-entbase/server/infodecal.cpp b/src/gs-entbase/server/infodecal.cpp index f1409a01..29ba7866 100644 --- a/src/gs-entbase/server/infodecal.cpp +++ b/src/gs-entbase/server/infodecal.cpp @@ -14,7 +14,7 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/*QUAKED infodecal (1 0 0) (-2 -2 -2) (2 2 2) +/*QUAKED infodecal (1 0 0) (-8 -8 -8) (8 8 8) "targetname" Name "texture" Name of the texture inside decals.wad it projects onto a surface. diff --git a/src/gs-entbase/server/stubs.cpp b/src/gs-entbase/server/stubs.cpp index 23801d77..2d1d8170 100644 --- a/src/gs-entbase/server/stubs.cpp +++ b/src/gs-entbase/server/stubs.cpp @@ -14,28 +14,6 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -class info_null -{ - void(void) info_null; -}; - -void -info_null::info_null(void) -{ - remove(self); -} - -class info_notnull:CBaseTrigger -{ - void(void) info_notnull; -}; - -void -info_notnull::info_notnull(void) -{ - CBaseTrigger::CBaseTrigger(); -} - CLASSEXPORT(info_node, info_notnull) CLASSEXPORT(info_target, info_notnull) CLASSEXPORT(env_sound, info_null)