env_glow: Moved to clientside, added some fancyness to it.
FreeHL/SH: Weapon prediction improvements FreeCS: Added back in basic bullet-penetration/wallbanging. It doesn't do anything but go through 4 layers. I made a testmap on which I'll start document 1.5 wallbanging behaviour.
This commit is contained in:
parent
b1ccc9fbb1
commit
17bb60c221
25 changed files with 174 additions and 79 deletions
|
@ -137,6 +137,11 @@ void CSQC_UpdateView(float w, float h, float focus)
|
|||
setproperty(VF_ACTIVESEAT, (float)s);
|
||||
|
||||
pSeat->ePlayer = self = findfloat(world, entnum, player_localentnum);
|
||||
|
||||
if (!self) {
|
||||
continue;
|
||||
}
|
||||
|
||||
pl = (player)self;
|
||||
|
||||
Predict_PreFrame((player)self);
|
||||
|
@ -204,16 +209,6 @@ void CSQC_UpdateView(float w, float h, float focus)
|
|||
setproperty(VF_DRAWWORLD, 1);
|
||||
renderscene();
|
||||
|
||||
pl.w_attack_next -= clframetime;
|
||||
pl.w_idle_next -= clframetime;
|
||||
|
||||
if (pl.w_attack_next <= 0) {
|
||||
pl.w_attack_next = 0;
|
||||
}
|
||||
if (pl.w_idle_next <= 0) {
|
||||
pl.w_idle_next = 0;
|
||||
}
|
||||
|
||||
View_DropPunchAngle();
|
||||
Fade_Update((int)video_mins[0],(int)video_mins[1], (int)w, (int)h);
|
||||
|
||||
|
@ -683,6 +678,10 @@ float CSQC_Ent_ParseMapEntity(void)
|
|||
eEnt = spawn(env_cubemap);
|
||||
iClass = TRUE;
|
||||
break;
|
||||
case "env_glow":
|
||||
eEnt = spawn(env_glow);
|
||||
iClass = TRUE;
|
||||
break;
|
||||
#ifdef REWOLF
|
||||
case "decore_asteroid":
|
||||
eEnt = spawn(decore_asteroid);
|
||||
|
|
|
@ -22,6 +22,11 @@ void Predict_PreFrame(player pl)
|
|||
pl.netflags = pl.flags;
|
||||
pl.netjumptime = pl.jumptime;
|
||||
pl.netteleport_time = pl.teleport_time;
|
||||
|
||||
#ifdef VALVE
|
||||
pl.net_w_attack_next = pl.w_attack_next;
|
||||
pl.net_w_idle_next = pl.w_idle_next;
|
||||
#endif
|
||||
|
||||
//self.netpmove_flags = self.pmove_flags;
|
||||
|
||||
|
@ -62,6 +67,11 @@ void Predict_PostFrame(player pl)
|
|||
pl.flags = pl.netflags;
|
||||
pl.jumptime = pl.netjumptime;
|
||||
pl.teleport_time = pl.netteleport_time;
|
||||
|
||||
#ifdef VALVE
|
||||
pl.w_attack_next = pl.net_w_attack_next;
|
||||
pl.w_idle_next = pl.net_w_idle_next;
|
||||
#endif
|
||||
|
||||
//self.pmove_flags = self.netpmove_flags;
|
||||
setorigin(pl, pl.origin);
|
||||
|
|
|
@ -42,7 +42,7 @@ void Player_ReadEntity(float flIsNew)
|
|||
pl.a_ammo1 = readbyte();
|
||||
pl.a_ammo2 = readbyte();
|
||||
pl.a_ammo3 = readbyte();
|
||||
//pl.w_attack_next = readfloat();
|
||||
//pl.w_idle_next = readfloat();
|
||||
pl.w_attack_next = readfloat();
|
||||
pl.w_idle_next = readfloat();
|
||||
setorigin( pl, pl.origin );
|
||||
}
|
||||
|
|
|
@ -208,7 +208,7 @@ void View_DrawViewModel(void)
|
|||
if (autocvar_v_lefthanded) {
|
||||
v_right *= -1;
|
||||
eViewModel.renderflags |= RF_USEAXIS;
|
||||
eViewModel.forceshader = SHADER_CULLED;
|
||||
//eViewModel.forceshader = SHADER_CULLED;
|
||||
} else {
|
||||
if (eViewModel.forceshader) {
|
||||
eViewModel.forceshader = 0;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
../gs-entbase/client/sprite.cpp
|
||||
../gs-entbase/client/text.cpp
|
||||
../gs-entbase/client/env_cubemap.cpp
|
||||
../gs-entbase/client/env_glow.cpp
|
||||
../gs-entbase/client/env_sound.cpp
|
||||
../gs-entbase/client/worldspawn.cpp
|
||||
#endlist
|
||||
|
|
110
Source/gs-entbase/client/env_glow.cpp
Normal file
110
Source/gs-entbase/client/env_glow.cpp
Normal file
|
@ -0,0 +1,110 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
class env_glow:CBaseEntity
|
||||
{
|
||||
vector m_vecColor;
|
||||
float m_flAlpha;
|
||||
float m_flMaxAlpha;
|
||||
string m_strSprite;
|
||||
vector m_vecSize;
|
||||
void() env_glow;
|
||||
virtual void() customphysics;
|
||||
virtual float() predraw;
|
||||
virtual void(string, string) SpawnKey;
|
||||
};
|
||||
|
||||
float env_glow::predraw(void)
|
||||
{
|
||||
m_flAlpha = bound(0, m_flAlpha, 1.0f);
|
||||
|
||||
if (m_flAlpha > 0) {
|
||||
vector forg;
|
||||
vector fsize;
|
||||
float falpha;
|
||||
int s = (float)getproperty(VF_ACTIVESEAT);
|
||||
pSeat = &seats[s];
|
||||
|
||||
/* Scale the glow somewhat with the players distance */
|
||||
fsize = m_vecSize;
|
||||
fsize *= vlen(pSeat->vPlayerOrigin - origin) / 256;
|
||||
|
||||
/* Fade out when the player is starting to move away */
|
||||
falpha = 1 - bound(0, vlen(pSeat->vPlayerOrigin - origin) / 1024, 1);
|
||||
falpha *= m_flAlpha;
|
||||
|
||||
/* Clamp the alpha by the glows' renderamt value */
|
||||
falpha = bound(0, falpha, m_flMaxAlpha);
|
||||
makevectors(view_angles);
|
||||
|
||||
/* Nudge this slightly towards the camera */
|
||||
makevectors(vectoangles(origin - pSeat->vPlayerOrigin));
|
||||
forg = origin + (v_forward * -16);
|
||||
|
||||
/* Project it, always facing the player */
|
||||
makevectors(view_angles);
|
||||
R_BeginPolygon(m_strSprite, 1, 0);
|
||||
R_PolygonVertex(forg + v_right * fsize[0] - v_up * fsize[1], [1,1], m_vecColor, falpha);
|
||||
R_PolygonVertex(forg - v_right * fsize[0] - v_up * fsize[1], [0,1], m_vecColor, falpha);
|
||||
R_PolygonVertex(forg - v_right * fsize[0] + v_up * fsize[1], [0,0], m_vecColor, falpha);
|
||||
R_PolygonVertex(forg + v_right * fsize[0] + v_up * fsize[1], [1,0], m_vecColor, falpha);
|
||||
R_EndPolygon();
|
||||
addentity(this);
|
||||
}
|
||||
|
||||
return PREDRAW_NEXT;
|
||||
}
|
||||
|
||||
void env_glow::customphysics(void)
|
||||
{
|
||||
int s = (float)getproperty(VF_ACTIVESEAT);
|
||||
pSeat = &seats[s];
|
||||
|
||||
if (checkpvs(pSeat->vPlayerOrigin, this) == FALSE) {
|
||||
m_flAlpha -= frametime;
|
||||
return;
|
||||
}
|
||||
|
||||
other = world;
|
||||
traceline(this.origin, pSeat->vPlayerOrigin, MOVE_OTHERONLY, this);
|
||||
|
||||
/* If we can't trace against the player, or are two close, fade out */
|
||||
if (trace_fraction < 1.0f || vlen(origin - pSeat->vPlayerOrigin) < 128) {
|
||||
m_flAlpha -= frametime;
|
||||
return;
|
||||
}
|
||||
|
||||
m_flAlpha += frametime;
|
||||
}
|
||||
|
||||
void env_glow::env_glow(void)
|
||||
{
|
||||
m_flMaxAlpha = 1.0f;
|
||||
m_vecColor = [1,1,1];
|
||||
Init();
|
||||
}
|
||||
|
||||
void env_glow::SpawnKey(string strField, string strKey)
|
||||
{
|
||||
switch (strField) {
|
||||
case "model":
|
||||
precache_model(strKey);
|
||||
m_strSprite = sprintf("%s_0.tga", strKey);
|
||||
m_vecSize = drawgetimagesize(m_strSprite) / 2;
|
||||
drawmask = MASK_ENGINE;
|
||||
break;
|
||||
case "rendercolour":
|
||||
m_vecColor = stov(strKey) / 255;
|
||||
case "renderamt":
|
||||
m_flMaxAlpha = stof(strKey) / 255;
|
||||
case "radius":
|
||||
break;
|
||||
default:
|
||||
CBaseEntity::SpawnKey(strField, strKey);
|
||||
}
|
||||
}
|
|
@ -12,7 +12,6 @@
|
|||
../gs-entbase/server/env_spark.cpp
|
||||
../gs-entbase/server/env_explosion.cpp
|
||||
../gs-entbase/server/env_render.cpp
|
||||
../gs-entbase/server/env_glow.cpp
|
||||
../gs-entbase/server/env_shake.cpp
|
||||
../gs-entbase/server/env_message.cpp
|
||||
../gs-entbase/server/game_text.cpp
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
/* https://twhl.info/wiki/page/env_glow_(Half-Life) */
|
||||
|
||||
enumflags
|
||||
{
|
||||
ENVS_STARTON,
|
||||
ENVS_PLAYONCE
|
||||
};
|
||||
|
||||
class env_glow : CBaseEntity
|
||||
{
|
||||
void() env_glow;
|
||||
};
|
||||
|
||||
void env_glow::env_glow(void)
|
||||
{
|
||||
CBaseEntity::CBaseEntity();
|
||||
precache_model(m_oldModel);
|
||||
Respawn();
|
||||
}
|
|
@ -29,3 +29,8 @@ void info_notnull::info_notnull(void)
|
|||
CLASSEXPORT(info_node, info_notnull)
|
||||
CLASSEXPORT(info_target, info_notnull)
|
||||
CLASSEXPORT(env_sound, info_null)
|
||||
|
||||
void env_glow(void)
|
||||
{
|
||||
precache_model(self.model);
|
||||
}
|
||||
|
|
|
@ -27,16 +27,7 @@ void Game_PlayerPreThink(void)
|
|||
}
|
||||
void Game_PlayerPostThink(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
pl.w_attack_next -= input_timelength;
|
||||
pl.w_idle_next -= input_timelength;
|
||||
|
||||
if (pl.w_attack_next <= 0) {
|
||||
pl.w_attack_next = 0;
|
||||
}
|
||||
if (pl.w_idle_next <= 0) {
|
||||
pl.w_idle_next = 0;
|
||||
}
|
||||
self.SendFlags = 1;
|
||||
}
|
||||
void Game_RunClientCommand(void)
|
||||
|
|
|
@ -6,19 +6,16 @@
|
|||
*
|
||||
****/
|
||||
|
||||
int iTotalPenetrations;
|
||||
#ifdef CSTRIKE
|
||||
#define PENETRATION
|
||||
#endif
|
||||
|
||||
#ifdef PENETRATION
|
||||
var int iTotalPenetrations;
|
||||
#endif
|
||||
|
||||
void TraceAttack_FireSingle(vector vPos, vector vAngle, int iDamage)
|
||||
{
|
||||
/*static void TraceAttack_Penetrate(vector vPos, vector vAngle ) {
|
||||
if (iTotalPenetrations > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
TraceAttack_FireSingle(vPos, vAngle, iDamage);
|
||||
iTotalPenetrations = 1;
|
||||
}*/
|
||||
|
||||
#ifdef CSTRIKE
|
||||
traceline(vPos, vPos + (vAngle * wptTable[self.weapon].fRange), MOVE_LAGGED | MOVE_HITMODEL, self);
|
||||
#else
|
||||
|
@ -29,7 +26,7 @@ void TraceAttack_FireSingle(vector vPos, vector vAngle, int iDamage)
|
|||
if (trace_ent.takedamage == DAMAGE_YES) {
|
||||
|
||||
Damage_Apply(trace_ent, self, iDamage, trace_endpos, FALSE);
|
||||
|
||||
|
||||
/*if (trace_ent.health <= 0 && trace_ent.iBleeds == TRUE) {
|
||||
makevectors(self.v_angle);
|
||||
trace_ent.movetype = MOVETYPE_BOUNCE;
|
||||
|
@ -40,11 +37,10 @@ void TraceAttack_FireSingle(vector vPos, vector vAngle, int iDamage)
|
|||
if (trace_ent.iBleeds != TRUE) {
|
||||
string sTexture = getsurfacetexture(trace_ent, getsurfacenearpoint(trace_ent, trace_endpos));
|
||||
|
||||
switch ((float)hash_get(hashMaterials, sTexture)) {
|
||||
switch ((float)hash_get(hashMaterials, sTexture)) {
|
||||
case 'G':
|
||||
case 'V':
|
||||
Effect_Impact(IMPACT_METAL, trace_endpos, trace_plane_normal);
|
||||
//TraceAttack_Penetrate(trace_endpos + (v_forward * 2), vAngle);
|
||||
break;
|
||||
case 'M':
|
||||
case 'P':
|
||||
|
@ -53,20 +49,25 @@ void TraceAttack_FireSingle(vector vPos, vector vAngle, int iDamage)
|
|||
case 'D':
|
||||
case 'W':
|
||||
Effect_Impact(IMPACT_WOOD, trace_endpos, trace_plane_normal);
|
||||
//TraceAttack_Penetrate(trace_endpos + (v_forward * 2), vAngle);
|
||||
break;
|
||||
case 'Y':
|
||||
Effect_Impact(IMPACT_GLASS, trace_endpos, trace_plane_normal);
|
||||
break;
|
||||
case 'N':
|
||||
Effect_Impact(IMPACT_DEFAULT, trace_endpos, trace_plane_normal);
|
||||
//TraceAttack_Penetrate(trace_endpos + (v_forward * 2), vAngle);
|
||||
break;
|
||||
case 'T':
|
||||
default:
|
||||
Effect_Impact(IMPACT_DEFAULT, trace_endpos, trace_plane_normal);
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef PENETRATION
|
||||
if (iTotalPenetrations > 0) {
|
||||
iTotalPenetrations -= 1;
|
||||
TraceAttack_FireSingle(trace_endpos + (v_forward * 2), vAngle, iDamage);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +85,9 @@ void TraceAttack_FireBullets(int iShots, vector vPos, int iDamage, vector vecAcc
|
|||
makevectors(self.v_angle);
|
||||
|
||||
while (iShots > 0) {
|
||||
iTotalPenetrations = 0;
|
||||
#ifdef PENETRATION
|
||||
iTotalPenetrations = 4;
|
||||
#endif
|
||||
vDir = aim(self, 100000) + Math_CRandom()*vecAccuracy[0]*v_right + Math_CRandom()*vecAccuracy[1]*v_up;
|
||||
TraceAttack_FireSingle(vPos, vDir, iDamage);
|
||||
iShots--;
|
||||
|
|
|
@ -29,16 +29,7 @@ void Game_PlayerPreThink(void)
|
|||
}
|
||||
void Game_PlayerPostThink(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
pl.w_attack_next -= input_timelength;
|
||||
pl.w_idle_next -= input_timelength;
|
||||
|
||||
if (pl.w_attack_next <= 0) {
|
||||
pl.w_attack_next = 0;
|
||||
}
|
||||
if (pl.w_idle_next <= 0) {
|
||||
pl.w_idle_next = 0;
|
||||
}
|
||||
self.SendFlags = 1;
|
||||
}
|
||||
void Game_RunClientCommand(void)
|
||||
|
|
|
@ -115,8 +115,8 @@ float Player_SendEntity(entity ePEnt, float fChanged)
|
|||
WriteByte(MSG_ENTITY, pl.a_ammo1);
|
||||
WriteByte(MSG_ENTITY, pl.a_ammo2);
|
||||
WriteByte(MSG_ENTITY, pl.a_ammo3);
|
||||
//WriteFloat(MSG_ENTITY, pl.w_attack_next);
|
||||
//WriteFloat(MSG_ENTITY, pl.w_idle_next);
|
||||
WriteFloat(MSG_ENTITY, pl.w_attack_next);
|
||||
WriteFloat(MSG_ENTITY, pl.w_idle_next);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -700,5 +700,18 @@ void PMove_Run(void)
|
|||
|
||||
touchtriggers();
|
||||
|
||||
#ifdef VALVE
|
||||
player pl = (player)self;
|
||||
pl.w_attack_next -= input_timelength;
|
||||
pl.w_idle_next -= input_timelength;
|
||||
|
||||
if (pl.w_attack_next <= 0) {
|
||||
pl.w_attack_next = 0;
|
||||
}
|
||||
if (pl.w_idle_next <= 0) {
|
||||
pl.w_idle_next = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
Game_Input();
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ void Weapons_Draw(void)
|
|||
player pl = (player)self;
|
||||
int i = pl.activeweapon;
|
||||
|
||||
pl.w_attack_next = Math_Time() + 0.5f;
|
||||
pl.w_idle_next = Math_Time() + 2.5f;
|
||||
pl.w_attack_next = 0.5f;
|
||||
pl.w_idle_next = 2.5f;
|
||||
|
||||
if (g_weapons[i].draw != __NULL__) {
|
||||
g_weapons[i].draw();
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue