diff --git a/src/gs-entbase/client.src b/src/gs-entbase/client.src index 2fb4e075..81f0a453 100644 --- a/src/gs-entbase/client.src +++ b/src/gs-entbase/client.src @@ -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 diff --git a/src/gs-entbase/client/infodecal.qc b/src/gs-entbase/client/infodecal.qc new file mode 100644 index 00000000..986bd219 --- /dev/null +++ b/src/gs-entbase/client/infodecal.qc @@ -0,0 +1,76 @@ +/* + * 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 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; +} diff --git a/src/gs-entbase/decals.h b/src/gs-entbase/decals.h index 0c0240d5..6c7dfd6c 100644 --- a/src/gs-entbase/decals.h +++ b/src/gs-entbase/decals.h @@ -87,3 +87,6 @@ decal_pickwall(entity dself, vector vpos) } } } + +decal Decals_Next(vector pos); +void Decals_Place(vector pos, string dname); diff --git a/src/gs-entbase/server/infodecal.qc b/src/gs-entbase/server/infodecal.qc index 06caa818..5b1ba99d 100644 --- a/src/gs-entbase/server/infodecal.qc +++ b/src/gs-entbase/server/infodecal.qc @@ -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__; diff --git a/src/gs-entbase/shared/decals.qc b/src/gs-entbase/shared/decals.qc index 84e49ce7..4b1437ea 100644 --- a/src/gs-entbase/shared/decals.qc +++ b/src/gs-entbase/shared/decals.qc @@ -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]); diff --git a/valve/src/shared/w_egon.qc b/valve/src/shared/w_egon.qc index dfaf61d4..80222fa4 100644 --- a/valve/src/shared/w_egon.qc +++ b/valve/src/shared/w_egon.qc @@ -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);