Unbreak env_sprite rendermodes.

This commit is contained in:
Marco Cawthorne 2020-05-02 06:38:02 +02:00
parent c1e4070b61
commit d4c97c639b
8 changed files with 63 additions and 45 deletions

View file

@ -85,7 +85,6 @@
../cstrike/player.c
../cstrike/entities.c
../entities.c
../fx_gunsmoke.c
../cstrike/cmds.c
../cstrike/game_event.c
../events.c

View file

@ -1,21 +0,0 @@
/*
* 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.
*/
void
FX_Gunsmoke(vector inworldpos)
{
}

View file

@ -80,7 +80,6 @@ init.c
../valve/player.c
entities.c
../entities.c
../fx_gunsmoke.c
../valve/cmds.c
../valve/game_event.c

View file

@ -73,7 +73,40 @@ CBaseEntity::RenderFXPass(void)
case RM_TEXTURE:
break;
case RM_GLOW:
effects = EF_FULLBRIGHT;
int s = (float)getproperty(VF_ACTIVESEAT);
pSeat = &g_seats[s];
vector vecPlayer = pSeat->m_vecPredictedOrigin;
if (checkpvs(vecPlayer, this) == FALSE) {
alpha -= clframetime;
}
other = world;
traceline(this.origin, vecPlayer, MOVE_OTHERONLY, this);
/* If we can't trace against the player, or are two close, fade out */
if (trace_fraction < 1.0f || vlen(origin - vecPlayer) < 128) {
alpha -= clframetime;
} else {
alpha += clframetime;
}
alpha = bound(0, alpha, 1.0f);
effects = EF_ADDITIVE | EF_FULLBRIGHT;
if (alpha > 0) {
float falpha;
/* Scale the glow somewhat with the players distance */
scale = bound(1, vlen(vecPlayer - origin) / 256, 4);
/* Fade out when the player is starting to move away */
falpha = 1 - bound(0, vlen(vecPlayer - origin) / 1024, 1);
falpha *= alpha;
/* Clamp the alpha by the glows' renderamt value */
alpha = bound(0, falpha, m_flRenderAmt);
}
break;
case RM_SOLID:
break;

View file

@ -32,6 +32,7 @@ class env_glow:CBaseEntity
string m_strSprite;
vector m_vecSize;
float m_flScale;
void(void) env_glow;
virtual void(void) customphysics;
virtual float() predraw;
@ -141,6 +142,7 @@ void env_glow::SpawnKey(string strField, string strKey)
break;
case "sprite":
case "model":
precache_model(strKey);
m_strSprite = sprintf("%s_0.tga", strKey);
m_vecSize = drawgetimagesize(m_strSprite) / 2;
break;

View file

@ -49,11 +49,14 @@ void env_sprite::ReadEntity(float flChanged)
modelindex = readfloat();
framerate = readfloat();
scale = readfloat();
alpha = readfloat();
effects = readfloat();
colormod[0] = readfloat();
colormod[1] = readfloat();
colormod[2] = readfloat();
m_iRenderFX = readbyte();
m_iRenderMode = readbyte();
m_vecRenderColor[0] = readfloat();
m_vecRenderColor[1] = readfloat();
m_vecRenderColor[2] = readfloat();
m_flRenderAmt = readfloat();
drawmask = MASK_ENGINE;
nextthink = time + (1 / framerate);
maxframe = modelframecount(modelindex);
@ -81,11 +84,12 @@ void EnvSprite_ParseEvent(void)
spr.modelindex = readfloat();
spr.framerate = readfloat();
spr.scale = readfloat();
spr.alpha = readfloat();
spr.effects = readfloat();
spr.colormod[0] = readfloat();
spr.colormod[1] = readfloat();
spr.colormod[2] = readfloat();
spr.m_iRenderFX = readbyte();
spr.m_iRenderMode = readbyte();
spr.m_vecRenderColor[0] = readfloat();
spr.m_vecRenderColor[1] = readfloat();
spr.m_vecRenderColor[2] = readfloat();
spr.m_flRenderAmt = readfloat();
spr.drawmask = MASK_ENGINE;
spr.nextthink = time + (1 / spr.framerate);
spr.maxframe = modelframecount(spr.modelindex);

View file

@ -62,11 +62,12 @@ float env_sprite::Network(entity pvsent, float flags)
WriteFloat(MSG_ENTITY, modelindex);
WriteFloat(MSG_ENTITY, m_flFramerate);
WriteFloat(MSG_ENTITY, m_flScale);
WriteFloat(MSG_ENTITY, alpha);
WriteFloat(MSG_ENTITY, effects);
WriteFloat(MSG_ENTITY, colormod[0]);
WriteFloat(MSG_ENTITY, colormod[1]);
WriteFloat(MSG_ENTITY, colormod[2]);
WriteByte(MSG_ENTITY, m_iRenderFX);
WriteByte(MSG_ENTITY, m_iRenderMode);
WriteFloat(MSG_ENTITY, m_vecRenderColor[0]);
WriteFloat(MSG_ENTITY, m_vecRenderColor[1]);
WriteFloat(MSG_ENTITY, m_vecRenderColor[2]);
WriteFloat(MSG_ENTITY, m_flRenderAmt);
return TRUE;
}
@ -80,11 +81,12 @@ void env_sprite::NetworkOnce(void)
WriteFloat(MSG_MULTICAST, modelindex);
WriteFloat(MSG_MULTICAST, m_flFramerate);
WriteFloat(MSG_MULTICAST, m_flScale);
WriteFloat(MSG_MULTICAST, alpha);
WriteFloat(MSG_MULTICAST, effects);
WriteFloat(MSG_MULTICAST, colormod[0]);
WriteFloat(MSG_MULTICAST, colormod[1]);
WriteFloat(MSG_MULTICAST, colormod[2]);
WriteByte(MSG_ENTITY, m_iRenderFX);
WriteByte(MSG_ENTITY, m_iRenderMode);
WriteFloat(MSG_ENTITY, m_vecRenderColor[0]);
WriteFloat(MSG_ENTITY, m_vecRenderColor[1]);
WriteFloat(MSG_ENTITY, m_vecRenderColor[2]);
WriteFloat(MSG_ENTITY, m_flRenderAmt);
msg_entity = this;
multicast(origin, MULTICAST_PVS);
}

View file

@ -55,7 +55,7 @@ SHMultiplayerRules::PlayerDeath(player pl)
pl.think = PutClientInServer;
pl.nextthink = time + 4.0f;
sound(pl, CHAN_AUTO, "fvox/flatline.wav", 1.0, ATTN_NORM);
Sound_Play(pl, CHAN_AUTO, "player.die");
if (pl.health < -50) {
pl.health = 0;