GS-Entbase: Fix hiccup that happens with infodecal entities, we now make

sure to only network them when they are targetname'd.
This commit is contained in:
Marco Cawthorne 2021-02-22 21:41:12 +01:00
parent ef88557fbf
commit d3cfedaab2
6 changed files with 89 additions and 3 deletions

View file

@ -20,6 +20,7 @@ client/env_laser.qc
client/func_lod.qc
client/func_dustmotes.qc
client/light_environment.qc
client/infodecal.qc
client/sky_camera.qc
client/info_notnull.qc
client/point_message.qc

View file

@ -0,0 +1,76 @@
/*
* 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 env_cubemap (0 0 1) (-8 -8 -8) (8 8 8)
"scale" Texture dimension at which to render the cubemap. Default is '32'.
Specifies a location for which a cubemap will be generated when the
buildcubemaps console command is executed.
Trivia:
This entity was introduced in Half-Life 2 (2004).
*/
class
infodecal:CBaseEntity
{
decal m_decChild;
string m_strTexture;
void(void) infodecal;
virtual void(string, string) SpawnKey;
virtual float(void) predraw;
};
float
infodecal::predraw(void)
{
if (!m_decChild) {
m_decChild = spawn(decal);
m_decChild.Place(origin, m_strTexture);
remove(this);
}
return PREDRAW_NEXT;
}
void
infodecal::SpawnKey(string strField, string strKey)
{
switch (strField) {
case "material":
case "texture":
m_strTexture = strtolower(strKey);
break;
case "targetname":
targetname = strKey;
break;
default:
CBaseEntity::SpawnKey(strField, strKey);
}
}
void
infodecal::infodecal(void)
{
Init();
if (targetname) {
remove(this);
return;
}
drawmask = MASK_ENGINE;
}

View file

@ -87,3 +87,6 @@ decal_pickwall(entity dself, vector vpos)
}
}
}
decal Decals_Next(vector pos);
void Decals_Place(vector pos, string dname);

View file

@ -71,8 +71,12 @@ infodecal::Respawn(void)
{
/* this will be invisible by default */
if (!targetname) {
#if 0
/* spawn automatically, remove self */
Trigger(this, TRIG_ON);
#else
remove(this);
#endif
} else {
Trigger(this, TRIG_OFF);
m_decChild = __NULL__;

View file

@ -35,9 +35,11 @@ const string g_decal_shader = \
float
decal::SendEntity(entity ePEnt, float changedflags)
{
if (clienttype(ePEnt) != CLIENTTYPE_REAL) {
if (clienttype(ePEnt) != CLIENTTYPE_REAL)
return FALSE;
if (!m_strTexture)
return FALSE;
}
WriteByte(MSG_ENTITY, ENT_DECAL);
WriteCoord(MSG_ENTITY, origin[0]);

View file

@ -61,7 +61,7 @@ FXEgon::Draw(void)
return;
}
src = gettaginfo(pSeat->m_eViewModel, 0);;
src = gettaginfo(pSeat->m_eViewModel, 0);
makevectors(input_angles);
endpos = src + v_forward * 1024;
traceline(src, endpos, FALSE, pl);