Client: add cvar net_debugUpdates, to show which entity updates.
NSSurfacePropEntity: Add method: TimeSinceDeath() Also further improvements to consistency of cvars, etc.
This commit is contained in:
parent
9c3622f59b
commit
1069468be1
|
@ -96,3 +96,4 @@ seta "scr_sshot_type" "tga"
|
||||||
seta "media_repeat "0"
|
seta "media_repeat "0"
|
||||||
|
|
||||||
exec masters.lst
|
exec masters.lst
|
||||||
|
exec cvars.cfg
|
||||||
|
|
|
@ -24,49 +24,70 @@
|
||||||
#include "NSView.h"
|
#include "NSView.h"
|
||||||
#include "crosshair.h"
|
#include "crosshair.h"
|
||||||
|
|
||||||
|
#define PRINTFLAG(x) if (cvar("net_showUpdates")) \
|
||||||
|
print(sprintf("%f %s read update %s\n", time, classname, #x));
|
||||||
|
|
||||||
#define READENTITY_BYTE(field, changedflag) {\
|
#define READENTITY_BYTE(field, changedflag) {\
|
||||||
if (flChanged & changedflag)\
|
if (flChanged & changedflag) {\
|
||||||
field = readbyte();\
|
field = readbyte();\
|
||||||
|
PRINTFLAG(changedflag); \
|
||||||
|
}\
|
||||||
}
|
}
|
||||||
|
|
||||||
#define READENTITY_SHORT(field, changedflag) {\
|
#define READENTITY_SHORT(field, changedflag) {\
|
||||||
if (flChanged & changedflag)\
|
if (flChanged & changedflag) {\
|
||||||
field = readshort();\
|
field = readshort();\
|
||||||
|
PRINTFLAG(changedflag); \
|
||||||
|
}\
|
||||||
}
|
}
|
||||||
|
|
||||||
#define READENTITY_FLOAT(field, changedflag) {\
|
#define READENTITY_FLOAT(field, changedflag) {\
|
||||||
if (flChanged & changedflag)\
|
if (flChanged & changedflag) {\
|
||||||
field = readfloat();\
|
field = readfloat();\
|
||||||
|
PRINTFLAG(changedflag); \
|
||||||
|
}\
|
||||||
}
|
}
|
||||||
|
|
||||||
#define READENTITY_INT(field, changedflag) {\
|
#define READENTITY_INT(field, changedflag) {\
|
||||||
if (flChanged & changedflag)\
|
if (flChanged & changedflag) {\
|
||||||
field = readint();\
|
field = readint();\
|
||||||
|
PRINTFLAG(changedflag); \
|
||||||
|
}\
|
||||||
}
|
}
|
||||||
|
|
||||||
#define READENTITY_STRING(field, changedflag) {\
|
#define READENTITY_STRING(field, changedflag) {\
|
||||||
if (flChanged & changedflag)\
|
if (flChanged & changedflag) {\
|
||||||
field = readstring();\
|
field = readstring();\
|
||||||
|
PRINTFLAG(changedflag); \
|
||||||
|
}\
|
||||||
}
|
}
|
||||||
|
|
||||||
#define READENTITY_COORD(field, changedflag) {\
|
#define READENTITY_COORD(field, changedflag) {\
|
||||||
if (flChanged & changedflag)\
|
if (flChanged & changedflag) {\
|
||||||
field = readcoord();\
|
field = readcoord();\
|
||||||
|
PRINTFLAG(changedflag); \
|
||||||
|
}\
|
||||||
}
|
}
|
||||||
|
|
||||||
#define READENTITY_ANGLE(field, changedflag) {\
|
#define READENTITY_ANGLE(field, changedflag) {\
|
||||||
if (flChanged & changedflag)\
|
if (flChanged & changedflag) {\
|
||||||
field = readshort() / (32767 / 360);\
|
field = readshort() / (32767 / 360);\
|
||||||
|
PRINTFLAG(changedflag); \
|
||||||
|
}\
|
||||||
}
|
}
|
||||||
|
|
||||||
#define READENTITY_ENTITY(field, changedflag) {\
|
#define READENTITY_ENTITY(field, changedflag) {\
|
||||||
if (flChanged & changedflag)\
|
if (flChanged & changedflag) {\
|
||||||
field = findfloat(world, ::entnum, readentitynum());\
|
field = findfloat(world, ::entnum, readentitynum());\
|
||||||
|
PRINTFLAG(changedflag); \
|
||||||
|
}\
|
||||||
}
|
}
|
||||||
|
|
||||||
#define READENTITY_ENTNUM(field, changedflag) {\
|
#define READENTITY_ENTNUM(field, changedflag) {\
|
||||||
if (flChanged & changedflag)\
|
if (flChanged & changedflag) {\
|
||||||
field = readentitynum();\
|
field = readentitynum();\
|
||||||
|
PRINTFLAG(changedflag); \
|
||||||
|
}\
|
||||||
}
|
}
|
||||||
|
|
||||||
/* undocumented printcall types */
|
/* undocumented printcall types */
|
||||||
|
|
|
@ -276,7 +276,7 @@ View_DrawViewModel(void)
|
||||||
m_eMuzzleflash.angles[2] += (random() * 10) - 5;
|
m_eMuzzleflash.angles[2] += (random() * 10) - 5;
|
||||||
|
|
||||||
if (autocvar_cg_muzzleDLight == true)
|
if (autocvar_cg_muzzleDLight == true)
|
||||||
dynamiclight_add(pSeat->m_vecPredictedOrigin + (v_forward * 32), 400, [1,0.45,0]);
|
dynamiclight_add(pSeat->m_vecPredictedOrigin + (v_forward * 32), 256, [1,0.45,0]);
|
||||||
|
|
||||||
setorigin(m_eMuzzleflash, m_eMuzzleflash.origin);
|
setorigin(m_eMuzzleflash, m_eMuzzleflash.origin);
|
||||||
addentity(m_eMuzzleflash);
|
addentity(m_eMuzzleflash);
|
||||||
|
@ -288,7 +288,7 @@ View_DrawViewModel(void)
|
||||||
m_eMuzzleflashL.angles[2] += (random() * 10) - 5;
|
m_eMuzzleflashL.angles[2] += (random() * 10) - 5;
|
||||||
|
|
||||||
if (autocvar_cg_muzzleDLight == true)
|
if (autocvar_cg_muzzleDLight == true)
|
||||||
dynamiclight_add(pSeat->m_vecPredictedOrigin + (v_forward * 32), 400, [1,0.45,0]);
|
dynamiclight_add(pSeat->m_vecPredictedOrigin + (v_forward * 32), 256, [1,0.45,0]);
|
||||||
|
|
||||||
setorigin(m_eMuzzleflashL, m_eMuzzleflashL.origin);
|
setorigin(m_eMuzzleflashL, m_eMuzzleflashL.origin);
|
||||||
addentity(m_eMuzzleflashL);
|
addentity(m_eMuzzleflashL);
|
||||||
|
|
|
@ -345,3 +345,27 @@ TraceAttack_SetPenetrationPower(int power)
|
||||||
g_traceAttack.SetPenetrationMaxThickness((8 * power) * g_traceAttack.m_flRangeModifier);
|
g_traceAttack.SetPenetrationMaxThickness((8 * power) * g_traceAttack.m_flRangeModifier);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* generic function that applies damage, pain and suffering */
|
||||||
|
void
|
||||||
|
Damage_Apply(entity t, entity c, float dmg, int w, damageType_t type)
|
||||||
|
{
|
||||||
|
CGameRules rules = (CGameRules)g_grMode;
|
||||||
|
rules.DamageApply(t, c, dmg, w, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* physical check of whether or not we can trace important parts of an ent */
|
||||||
|
float
|
||||||
|
Damage_CheckTrace(entity t, vector vecHitPos)
|
||||||
|
{
|
||||||
|
CGameRules rules = (CGameRules)g_grMode;
|
||||||
|
return rules.DamageCheckTrace(t, vecHitPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* even more pain and suffering, mostly used for explosives */
|
||||||
|
void
|
||||||
|
Damage_Radius(vector org, entity attacker, float dmg, float r, int check, int w)
|
||||||
|
{
|
||||||
|
CGameRules rules = (CGameRules)g_grMode;
|
||||||
|
rules.DamageRadius(org, attacker, dmg, r, check, w);
|
||||||
|
}
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var bool autocvar_mapcycle_enabled = true;
|
|
||||||
var string autocvar_mapcycle_file = "mapcycle.txt";
|
|
||||||
noref var string g_mapcycle_override = __NULL__;
|
noref var string g_mapcycle_override = __NULL__;
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -65,16 +63,18 @@ Mapcycle_Load(string filename)
|
||||||
void
|
void
|
||||||
Mapcycle_Init(void)
|
Mapcycle_Init(void)
|
||||||
{
|
{
|
||||||
|
string cycleFile = cvar_string("g_mapCycle");
|
||||||
|
|
||||||
/* by default, this will be multiplayer only */
|
/* by default, this will be multiplayer only */
|
||||||
if (g_grMode.IsMultiplayer() == false)
|
if (g_grMode.IsMultiplayer() == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* in case some server admin wants a map to continously loop */
|
/* in case some server admin wants a map to continously loop */
|
||||||
if (autocvar_mapcycle_enabled == false) {
|
if not (cycleFile) {
|
||||||
print("mapcycle disabled via cvar. skipping\n");
|
print("mapcycle disabled via cvar. skipping\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
print("--------- Initializing MapCycle ----------\n");
|
print("--------- Initializing MapCycle ----------\n");
|
||||||
Mapcycle_Load(autocvar_mapcycle_file);
|
Mapcycle_Load(cycleFile);
|
||||||
}
|
}
|
||||||
|
|
|
@ -775,6 +775,7 @@ NSClientPlayer::Death(void)
|
||||||
forceinfokey(this, "*deaths", ftos(deaths));
|
forceinfokey(this, "*deaths", ftos(deaths));
|
||||||
forceinfokey(this, "*dead", "1");
|
forceinfokey(this, "*dead", "1");
|
||||||
forceinfokey(this, "*spectator", "0");
|
forceinfokey(this, "*spectator", "0");
|
||||||
|
m_flDeathTime = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -65,6 +65,8 @@ private:
|
||||||
int m_iPropData;
|
int m_iPropData;
|
||||||
string m_strPropData;
|
string m_strPropData;
|
||||||
|
|
||||||
|
float m_flDeathTime;
|
||||||
|
|
||||||
nonvirtual void _SurfaceDataFinish(void);
|
nonvirtual void _SurfaceDataFinish(void);
|
||||||
nonvirtual void _PropDataFinish(void);
|
nonvirtual void _PropDataFinish(void);
|
||||||
#endif
|
#endif
|
||||||
|
@ -133,6 +135,8 @@ public:
|
||||||
nonvirtual void SetSurfaceData(string);
|
nonvirtual void SetSurfaceData(string);
|
||||||
/** Assigns the prop data of a given description onto this entity. */
|
/** Assigns the prop data of a given description onto this entity. */
|
||||||
nonvirtual void SetPropData(string);
|
nonvirtual void SetPropData(string);
|
||||||
|
/** Returns how many seconds have passed since we died. Will return -1 if not applicable. */
|
||||||
|
nonvirtual float TimeSinceDeath(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CLIENT
|
#ifdef CLIENT
|
||||||
|
|
|
@ -582,6 +582,8 @@ NSSurfacePropEntity::Pain(void)
|
||||||
void
|
void
|
||||||
NSSurfacePropEntity::Death(void)
|
NSSurfacePropEntity::Death(void)
|
||||||
{
|
{
|
||||||
|
m_flDeathTime = time;
|
||||||
|
|
||||||
print(sprintf("%S", m_strOnBreak));
|
print(sprintf("%S", m_strOnBreak));
|
||||||
print("\n");
|
print("\n");
|
||||||
|
|
||||||
|
@ -645,7 +647,19 @@ NSSurfacePropEntity::_PropDataFinish(void)
|
||||||
else
|
else
|
||||||
m_iPropData = -1;
|
m_iPropData = -1;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
|
float
|
||||||
|
NSSurfacePropEntity::TimeSinceDeath(void)
|
||||||
|
{
|
||||||
|
if (IsAlive())
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return time - m_flDeathTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CLIENT
|
||||||
void
|
void
|
||||||
NSSurfacePropEntity::RenderFire(void)
|
NSSurfacePropEntity::RenderFire(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
#ifndef MAX_WEAPONS
|
||||||
#define MAX_WEAPONS 32
|
#define MAX_WEAPONS 32
|
||||||
|
#endif
|
||||||
|
|
||||||
/** This class represents inventory items and weapons that you can directly interact with.
|
/** This class represents inventory items and weapons that you can directly interact with.
|
||||||
|
|
||||||
|
@ -90,8 +92,17 @@ public:
|
||||||
virtual void Reload(void);
|
virtual void Reload(void);
|
||||||
/** Called whenever the no weapon command is called by a client. */
|
/** Called whenever the no weapon command is called by a client. */
|
||||||
virtual void Release(void);
|
virtual void Release(void);
|
||||||
|
|
||||||
|
#ifdef CLIENT
|
||||||
/** Called before 3D world rendering is performed. */
|
/** Called before 3D world rendering is performed. */
|
||||||
virtual void ClientPredraw(void);
|
virtual void ClientPredraw(void);
|
||||||
/** Called after 3D world rendering is performed. */
|
/** Called after 3D world rendering is performed. */
|
||||||
virtual void ClientPostdraw(void);
|
virtual void ClientPostdraw(void);
|
||||||
|
|
||||||
|
virtual void ReceiveEntity(float, float);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SERVER
|
||||||
|
virtual float SendEntity(entity, float);
|
||||||
|
#endif
|
||||||
};
|
};
|
|
@ -40,6 +40,7 @@ NSWeapon::Release(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CLIENT
|
||||||
void
|
void
|
||||||
NSWeapon::ClientPredraw(void)
|
NSWeapon::ClientPredraw(void)
|
||||||
{
|
{
|
||||||
|
@ -50,6 +51,29 @@ NSWeapon::ClientPostdraw(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NSWeapon::ReceiveEntity(float new, float flChanged)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SERVER
|
||||||
|
float
|
||||||
|
NSWeapon::SendEntity(entity ePEnt, float flChanged)
|
||||||
|
{
|
||||||
|
/* if we have a model, assume we're a pickup */
|
||||||
|
if (modelindex) {
|
||||||
|
return super::SendEntity(ePEnt, flChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* don't network to anyone but the owner */
|
||||||
|
if (ePEnt != owner) {
|
||||||
|
return (false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* get */
|
/* get */
|
||||||
string
|
string
|
||||||
NSWeapon::GetPlayerModel(void)
|
NSWeapon::GetPlayerModel(void)
|
||||||
|
|
|
@ -114,31 +114,31 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* if they're undefined by a config, they'll be set by the game/mod default */
|
/* if they're undefined by a config, they'll be set by the game/mod default */
|
||||||
var float autocvar_sv_stepheight = PMOVE_STEPHEIGHT;
|
var float autocvar_pm_stepsize = PMOVE_STEPHEIGHT;
|
||||||
var float autocvar_sv_airstepheight = PMOVE_AIRSTEPHEIGHT;
|
var float autocvar_pm_airstepsize = PMOVE_AIRSTEPHEIGHT;
|
||||||
var float autocvar_sv_friction = PMOVE_FRICTION;
|
var float autocvar_pm_friction = PMOVE_FRICTION;
|
||||||
var float autocvar_sv_edgefriction = PMOVE_EDGEFRICTION;
|
var float autocvar_pm_edgefriction = PMOVE_EDGEFRICTION;
|
||||||
var float autocvar_sv_stopspeed = PMOVE_STOPSPEED;
|
var float autocvar_pm_stopspeed = PMOVE_STOPSPEED;
|
||||||
var float autocvar_sv_gravity = PMOVE_GRAVITY;
|
var float autocvar_pm_airaccelerate = PMOVE_AIRACCELERATE;
|
||||||
var float autocvar_sv_airaccelerate = PMOVE_AIRACCELERATE;
|
var float autocvar_pm_wateraccelerate = PMOVE_WATERACCELERATE;
|
||||||
var float autocvar_sv_wateraccelerate = PMOVE_WATERACCELERATE;
|
var float autocvar_pm_accelerate = PMOVE_ACCELERATE;
|
||||||
var float autocvar_sv_accelerate = PMOVE_ACCELERATE;
|
var float autocvar_pm_maxspeed = PMOVE_MAXSPEED;
|
||||||
var float autocvar_sv_maxspeed = PMOVE_MAXSPEED;
|
var float autocvar_g_gravity = PMOVE_GRAVITY;
|
||||||
|
|
||||||
void
|
void
|
||||||
PMove_Init(void)
|
PMove_Init(void)
|
||||||
{
|
{
|
||||||
#ifdef SERVER
|
#ifdef SERVER
|
||||||
cvar_set("sv_stepheight", ftos(PMOVE_STEPHEIGHT));
|
cvar_set("pm_stepsize", ftos(PMOVE_STEPHEIGHT));
|
||||||
cvar_set("sv_airstepheight", ftos(PMOVE_AIRSTEPHEIGHT));
|
cvar_set("pm_airstepsize", ftos(PMOVE_AIRSTEPHEIGHT));
|
||||||
cvar_set("sv_friction", ftos(PMOVE_FRICTION));
|
cvar_set("pm_friction", ftos(PMOVE_FRICTION));
|
||||||
cvar_set("sv_edgefriction", ftos(PMOVE_EDGEFRICTION));
|
cvar_set("pm_edgefriction", ftos(PMOVE_EDGEFRICTION));
|
||||||
cvar_set("sv_stopspeed", ftos(PMOVE_STOPSPEED));
|
cvar_set("pm_stopspeed", ftos(PMOVE_STOPSPEED));
|
||||||
cvar_set("sv_gravity", ftos(PMOVE_GRAVITY));
|
cvar_set("pm_airaccelerate", ftos(PMOVE_AIRACCELERATE));
|
||||||
cvar_set("sv_airaccelerate", ftos(PMOVE_AIRACCELERATE));
|
cvar_set("pm_wateraccelerate", ftos(PMOVE_WATERACCELERATE));
|
||||||
cvar_set("sv_wateraccelerate", ftos(PMOVE_WATERACCELERATE));
|
cvar_set("pm_accelerate", ftos(PMOVE_ACCELERATE));
|
||||||
cvar_set("sv_accelerate", ftos(PMOVE_ACCELERATE));
|
cvar_set("pm_maxspeed", ftos(PMOVE_MAXSPEED));
|
||||||
cvar_set("sv_maxspeed", ftos(PMOVE_MAXSPEED));
|
cvar_set("g_gravity", ftos(PMOVE_GRAVITY)); /* global */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CUSTOMPLAYERPHYSICS
|
#ifdef CUSTOMPLAYERPHYSICS
|
||||||
|
|
|
@ -35,16 +35,16 @@ PMoveCustom_UpdateVar(string info, string cv)
|
||||||
void
|
void
|
||||||
PMoveCustom_StartFrame(void)
|
PMoveCustom_StartFrame(void)
|
||||||
{
|
{
|
||||||
PMoveCustom_UpdateVar("phy_stepheight", "sv_stepheight");
|
PMoveCustom_UpdateVar("phy_stepheight", "pm_stepsize");
|
||||||
PMoveCustom_UpdateVar("phy_airstepheight", "sv_airstepheight");
|
PMoveCustom_UpdateVar("phy_airstepheight", "pm_airstepsize");
|
||||||
PMoveCustom_UpdateVar("phy_friction", "sv_friction");
|
PMoveCustom_UpdateVar("phy_friction", "pm_friction");
|
||||||
PMoveCustom_UpdateVar("phy_edgefriction", "sv_edgefriction");
|
PMoveCustom_UpdateVar("phy_edgefriction", "pm_edgefriction");
|
||||||
PMoveCustom_UpdateVar("phy_stopspeed", "sv_stopspeed");
|
PMoveCustom_UpdateVar("phy_stopspeed", "pm_stopspeed");
|
||||||
PMoveCustom_UpdateVar("phy_gravity", "sv_gravity");
|
PMoveCustom_UpdateVar("phy_gravity", "g_gravity");
|
||||||
PMoveCustom_UpdateVar("phy_airaccelerate", "sv_airaccelerate");
|
PMoveCustom_UpdateVar("phy_airaccelerate", "pm_airaccelerate");
|
||||||
PMoveCustom_UpdateVar("phy_wateraccelerate", "sv_wateraccelerate");
|
PMoveCustom_UpdateVar("phy_wateraccelerate", "pm_wateraccelerate");
|
||||||
PMoveCustom_UpdateVar("phy_accelerate", "sv_accelerate");
|
PMoveCustom_UpdateVar("phy_accelerate", "pm_accelerate");
|
||||||
PMoveCustom_UpdateVar("phy_maxspeed", "sv_maxspeed");
|
PMoveCustom_UpdateVar("phy_maxspeed", "pm_maxspeed");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ void Weapons_Release(NSClientPlayer);
|
||||||
void Weapons_Primary(NSClientPlayer);
|
void Weapons_Primary(NSClientPlayer);
|
||||||
void Weapons_Secondary(NSClientPlayer);
|
void Weapons_Secondary(NSClientPlayer);
|
||||||
void Weapons_Reload(NSClientPlayer);
|
void Weapons_Reload(NSClientPlayer);
|
||||||
|
void Weapons_PreDraw(NSClientPlayer, bool);
|
||||||
void Weapons_Init(void);
|
void Weapons_Init(void);
|
||||||
string Weapons_GetWorldmodel(int);
|
string Weapons_GetWorldmodel(int);
|
||||||
weapontype_t Weapons_GetType(NSClientPlayer, int);
|
weapontype_t Weapons_GetType(NSClientPlayer, int);
|
||||||
|
|
Loading…
Reference in New Issue