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.

This commit is contained in:
Marco Cawthorne 2020-08-29 03:15:43 +02:00
parent 348052dd76
commit 425dad951b
5 changed files with 114 additions and 23 deletions

View file

@ -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

View file

@ -0,0 +1,40 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
*
* 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();
}

View file

@ -0,0 +1,71 @@
/*
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
*
* 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
}

View file

@ -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.

View file

@ -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)