Clean up some misc warnings, switch over to internal bool type for some methods
in NSSurfacePropEntity, added Get/Set functions for MaxHealth. Also bump BUILD_ENGINEREVISION to 6224 (minor crash fix upstream)
This commit is contained in:
parent
09c399c66c
commit
60e4853549
7 changed files with 73 additions and 39 deletions
|
@ -5,7 +5,7 @@
|
|||
BUILD_SDL2=1
|
||||
|
||||
# Build the engine with debug information
|
||||
BUILD_DEBUG=0
|
||||
BUILD_DEBUG=1
|
||||
|
||||
# Clean compile, removing old object files
|
||||
BUILD_CLEAN=0
|
||||
|
@ -17,7 +17,7 @@ BUILD_ENGINE_DEPENDENCIES=1
|
|||
BUILD_SOURCE=1
|
||||
|
||||
# Build the Open Dynamics Engine physics simulator. More feature complete.
|
||||
BUILD_ODE=0
|
||||
BUILD_ODE=1
|
||||
|
||||
# Build the Bullet physics simulator, still WiP
|
||||
BUILD_BULLET=0
|
||||
|
@ -32,7 +32,7 @@ BUILD_IQMTOOL=1
|
|||
BUILD_IMGTOOL=1
|
||||
|
||||
# Specify which engine revision to build, these are considered 'stable'; 0 = latest
|
||||
BUILD_ENGINEREVISION=6223
|
||||
BUILD_ENGINEREVISION=6224
|
||||
|
||||
# Whether or not to run 'git pull' or 'svn up' before building a component
|
||||
BUILD_UPDATE=1
|
||||
|
|
|
@ -39,7 +39,7 @@ font_s FONT_16;
|
|||
font_s FONT_20;
|
||||
font_s FONT_CON;
|
||||
|
||||
var string g_shellchrome;
|
||||
//var string g_shellchrome;
|
||||
var float g_shellchromeshader;
|
||||
|
||||
/* clientside cvars */
|
||||
|
|
|
@ -45,7 +45,7 @@ class NSSurfacePropEntity:NSRenderableEntity
|
|||
|
||||
nonvirtual void(entity, float, int) Ignite;
|
||||
nonvirtual void(void) Extinguish;
|
||||
nonvirtual int(void) IsOnFire;
|
||||
nonvirtual bool(void) IsOnFire;
|
||||
|
||||
/* life, death */
|
||||
float m_oldHealth;
|
||||
|
@ -53,16 +53,19 @@ class NSSurfacePropEntity:NSRenderableEntity
|
|||
virtual void(void) Death;
|
||||
|
||||
/* Generic Damage */
|
||||
virtual void(float) SetTakedamage;
|
||||
virtual void(float) SetHealth;
|
||||
nonvirtual void(float) SetTakedamage;
|
||||
nonvirtual void(float) SetHealth;
|
||||
nonvirtual void(float) SetMaxHealth;
|
||||
nonvirtual float(void) GetHealth;
|
||||
nonvirtual float(void) GetMaxHealth;
|
||||
|
||||
/* Surface/PropKit */
|
||||
int m_iMaterial;
|
||||
int m_iPropData;
|
||||
nonvirtual float(void) GetSpawnHealth;
|
||||
nonvirtual int(void) HasPropData;
|
||||
nonvirtual bool(void) HasPropData;
|
||||
nonvirtual __variant(int) GetPropData;
|
||||
nonvirtual int(void) HasSurfaceData;
|
||||
nonvirtual bool(void) HasSurfaceData;
|
||||
nonvirtual __variant(int) GetSurfaceData;
|
||||
|
||||
string m_strSurfData;
|
||||
|
|
|
@ -24,19 +24,40 @@ NSSurfacePropEntity::SetTakedamage(float type)
|
|||
void
|
||||
NSSurfacePropEntity::SetHealth(float new_health)
|
||||
{
|
||||
health = new_health;
|
||||
if (max_health > 0)
|
||||
health = min(new_health, max_health);
|
||||
else
|
||||
health = new_health;
|
||||
}
|
||||
|
||||
void
|
||||
NSSurfacePropEntity::SetMaxHealth(float new_health)
|
||||
{
|
||||
max_health = new_health;
|
||||
health = min(health, max_health);
|
||||
}
|
||||
|
||||
|
||||
float
|
||||
NSSurfacePropEntity::GetHealth(void)
|
||||
{
|
||||
return health;
|
||||
}
|
||||
float
|
||||
NSSurfacePropEntity::GetMaxHealth(void)
|
||||
{
|
||||
return max_health;
|
||||
}
|
||||
float
|
||||
NSSurfacePropEntity::GetSpawnHealth(void)
|
||||
{
|
||||
return m_oldHealth;
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
NSSurfacePropEntity::HasPropData(void)
|
||||
{
|
||||
return (m_iPropData != -1) ? TRUE : FALSE;
|
||||
return (m_iPropData != -1) ? true : false;
|
||||
}
|
||||
|
||||
__variant
|
||||
|
@ -45,10 +66,10 @@ NSSurfacePropEntity::GetPropData(int type)
|
|||
return Prop_GetInfo(m_iPropData, type);
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
NSSurfacePropEntity::HasSurfaceData(void)
|
||||
{
|
||||
return (m_iMaterial != -1) ? TRUE : FALSE;
|
||||
return (m_iMaterial != -1) ? true : false;
|
||||
}
|
||||
|
||||
__variant
|
||||
|
@ -94,10 +115,10 @@ NSSurfacePropEntity::Extinguish(void)
|
|||
m_flBurnTime = 0;
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
NSSurfacePropEntity::IsOnFire(void)
|
||||
{
|
||||
return (flags & FL_ONFIRE) ? TRUE : FALSE;
|
||||
return (flags & FL_ONFIRE) ? true : false;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -107,7 +128,7 @@ NSSurfacePropEntity::Respawn(void)
|
|||
NSRenderableEntity::Respawn();
|
||||
|
||||
/* only use spawndata's health if we aren't overriding it */
|
||||
if (HasPropData() == TRUE && sh <= 0) {
|
||||
if (HasPropData() == false && sh <= 0) {
|
||||
health = (float)GetPropData(PROPINFO_HEALTH);
|
||||
} else {
|
||||
health = sh;
|
||||
|
@ -227,7 +248,7 @@ NSSurfacePropEntity::Death(void)
|
|||
{
|
||||
UseOutput(g_dmg_eAttacker, m_strOnBreak);
|
||||
|
||||
if (HasPropData() == FALSE)
|
||||
if (HasPropData() == false)
|
||||
return;
|
||||
|
||||
if (GetPropData(PROPINFO_SKIN) != 0) {
|
||||
|
@ -310,7 +331,7 @@ NSSurfacePropEntity::SetModel(string newModel)
|
|||
NSRenderableEntity::SetModel(newModel);
|
||||
|
||||
#ifdef SERVER
|
||||
if (model && m_iPropData == -1) {
|
||||
if (model && HasPropData() == false) {
|
||||
m_iPropData = PropData_ForModel(model);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -129,17 +129,18 @@ env_fog_controller::StartToBias(void)
|
|||
return 0.025;
|
||||
else if (m_flFogStart < 4096)
|
||||
return 0.0175;
|
||||
else
|
||||
return 0.05;
|
||||
}
|
||||
|
||||
/* this is mainly for the 'blended' fog. Which is more expensive. */
|
||||
float
|
||||
env_fog_controller::FogRender(void)
|
||||
{
|
||||
vector vecNewColor;
|
||||
vector p1, p2;
|
||||
|
||||
if (!m_iFogActive)
|
||||
return;
|
||||
return (PREDRAW_NEXT);
|
||||
|
||||
CSQC_UpdateSeat();
|
||||
|
||||
|
@ -152,12 +153,14 @@ env_fog_controller::FogRender(void)
|
|||
|
||||
/* cache so we don't call 'fog' every frame */
|
||||
if (delta == m_flLastDelta)
|
||||
return;
|
||||
return (PREDRAW_NEXT);
|
||||
|
||||
m_flLastDelta = delta;
|
||||
|
||||
/* we also only need to call this maybe once every second... */
|
||||
if (m_flNextDraw > cltime)
|
||||
return;
|
||||
return (PREDRAW_NEXT);
|
||||
|
||||
m_flNextDraw = cltime + 1.0f;
|
||||
|
||||
/* apply the fog. wish there was a builtin for this instead... */
|
||||
|
|
|
@ -196,25 +196,31 @@ void
|
|||
CGameRules::DamageApply(entity t, entity c, float dmg, int w, damageType_t type)
|
||||
{
|
||||
/* Damage */
|
||||
base_player tp = (base_player)t;
|
||||
NSSurfacePropEntity eTarget = (NSSurfacePropEntity)t;
|
||||
|
||||
/* sanity check */
|
||||
if (t.takedamage == DAMAGE_NO)
|
||||
return;
|
||||
|
||||
/* for armor damage */
|
||||
float flArmor = 0;
|
||||
float flNewDamage = 0;
|
||||
|
||||
/* player god mode */
|
||||
if (t.flags & FL_CLIENT && t.flags & FL_GODMODE)
|
||||
if (eTarget.flags & FL_CLIENT && eTarget.flags & FL_GODMODE)
|
||||
return;
|
||||
|
||||
/* already dead, please avoid recursion */
|
||||
if (t.health <= 0)
|
||||
if (eTarget.GetHealth() <= 0)
|
||||
return;
|
||||
|
||||
/* before any calculation is done... */
|
||||
g_dmg_iRealDamage = dmg;
|
||||
|
||||
/* only clients have armor */
|
||||
if (t.flags & FL_CLIENT) {
|
||||
if (eTarget.flags & FL_CLIENT) {
|
||||
base_player tp = (base_player)t;
|
||||
|
||||
/* skip armor */
|
||||
if not (type & DMG_SKIP_ARMOR)
|
||||
if (tp.armor && dmg > 0) {
|
||||
|
@ -235,7 +241,7 @@ CGameRules::DamageApply(entity t, entity c, float dmg, int w, damageType_t type)
|
|||
}
|
||||
|
||||
dmg = rint(dmg);
|
||||
t.health -= dmg;
|
||||
eTarget.SetHealth(eTarget.GetHealth() - dmg);
|
||||
|
||||
/* the globals... */
|
||||
g_dmg_eAttacker = c;
|
||||
|
@ -262,23 +268,20 @@ CGameRules::DamageApply(entity t, entity c, float dmg, int w, damageType_t type)
|
|||
WriteInt(MSG_MULTICAST, g_dmg_iFlags);
|
||||
msg_entity = g_dmg_eTarget;
|
||||
multicast([0,0,0], MULTICAST_ONE_R);
|
||||
} else if (t.max_health && t.health > t.max_health) {
|
||||
t.health = t.max_health;
|
||||
}
|
||||
|
||||
NSSurfacePropEntity s = (NSSurfacePropEntity)t;
|
||||
|
||||
if (s.health <= 0) {
|
||||
if (s.flags & FL_CLIENT) {
|
||||
PlayerDeath((player)s);
|
||||
/* they died */
|
||||
if (eTarget.GetHealth() <= 0) {
|
||||
if (eTarget.flags & FL_CLIENT) {
|
||||
PlayerDeath((player)eTarget);
|
||||
} else {
|
||||
s.Death();
|
||||
eTarget.Death();
|
||||
}
|
||||
} else {
|
||||
if (s.flags & FL_CLIENT) {
|
||||
PlayerPain((player)s);
|
||||
if (eTarget.flags & FL_CLIENT) {
|
||||
PlayerPain((player)eTarget);
|
||||
} else {
|
||||
s.Pain();
|
||||
eTarget.Pain();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,11 @@
|
|||
class
|
||||
base_player:spectator
|
||||
{
|
||||
#ifdef SERVER
|
||||
PREDICTED_INT_N(weaponframe);
|
||||
#else
|
||||
PREDICTED_INT(weaponframe);
|
||||
#endif
|
||||
PREDICTED_FLOAT(health);
|
||||
PREDICTED_FLOAT(armor);
|
||||
|
||||
|
|
Loading…
Reference in a new issue