Base: Get rid of g_eAttacker, which had been replaced by g_dmg_eAttacker.

Go over TraceAttack and make it combine multiple Damage_Apply calls into
one.
This commit is contained in:
Marco Cawthorne 2021-05-10 11:33:31 +02:00
parent a3ecd78f17
commit 1485544b91
66 changed files with 260 additions and 240 deletions

View file

@ -21,33 +21,36 @@ Damage_Apply(entity t, entity c, float dmg, int w, damageType_t type)
base_player tp = (base_player)t;
CGameRules rules = (CGameRules)g_grMode;
if (t.flags & FL_GODMODE) {
/* player god mode */
if (t.flags & FL_CLIENT && t.flags & FL_GODMODE)
return;
}
/* already dead, please avoid recursion */
if (t.health <= 0) {
if (t.health <= 0)
return;
}
/* skip armor */
if not (type & DMG_SKIP_ARMOR)
if (tp.armor && dmg > 0) {
float flArmor;
float flNewDamage;
/* only clients have armor */
if (t.flags & FL_CLIENT) {
/* skip armor */
if not (type & DMG_SKIP_ARMOR)
if (tp.armor && dmg > 0) {
float flArmor;
float flNewDamage;
flNewDamage = dmg * 0.2;
flArmor = (dmg - flNewDamage) * 0.5;
flNewDamage = dmg * 0.2;
flArmor = (dmg - flNewDamage) * 0.5;
if (flArmor > tp.armor) {
flArmor = tp.armor;
flArmor *= (1/0.5);
flNewDamage = dmg - flArmor;
tp.armor = 0;
} else {
tp.armor -= flArmor;
if (flArmor > tp.armor) {
flArmor = tp.armor;
flArmor *= (1/0.5);
flNewDamage = dmg - flArmor;
tp.armor = 0;
} else {
tp.armor -= flArmor;
}
dmg = flNewDamage;
}
dmg = flNewDamage;
}
dmg = rint(dmg);
@ -68,9 +71,6 @@ Damage_Apply(entity t, entity c, float dmg, int w, damageType_t type)
t.health = t.max_health;
}
/* set this global in case we need it later */
g_eAttacker = c;
CBaseEntity s = (CBaseEntity)t;
if (s.health <= 0) {
@ -137,20 +137,16 @@ Damage_Radius(vector org, entity attacker, float dmg, float r, int check, int w)
/* don't bother if it's not anywhere near us */
dist = vlen(org - pos);
if (dist > r) {
if (dist > r)
continue;
}
/* can we physically hit this thing? */
if (Damage_CheckTrace(e, org) == FALSE) {
if (check == TRUE) {
if (check == TRUE)
if (Damage_CheckTrace(e, org) == FALSE)
continue;
}
}
/* calculate new damage values */
diff = vlen(org - pos);
diff = (r - diff) / r;
diff = (r - dist) / r;
new_dmg = rint(dmg * diff);
if (diff > 0) {

View file

@ -19,11 +19,11 @@ Bot_PickName(entity target)
{
int n = 0;
entity pbot = world;
for (int i = 1; (pbot = edict_num(i)); i++) {
if (clienttype(pbot) == CLIENTTYPE_BOT) {
for (int i = 1; (pbot = edict_num(i)); i++)
if (clienttype(pbot) == CLIENTTYPE_BOT)
n++;
}
}
forceinfokey(target, "name", sprintf("Bot %i", n));
forceinfokey(target, "model", "robo");
}
@ -34,7 +34,7 @@ Bot_AddQuick(void)
/* we've got no nodes, so generate some fake waypoints */
if (!g_nodes_present) {
print("^1Bot_AddQuick^7: Can't add bot. No waypoints.\n");
return world;
return (__NULL__);
}
entity newbot;
@ -46,7 +46,7 @@ Bot_AddQuick(void)
if (!self) {
print("^1Bot_AddQuick^7: Can't add bot. Server is full\n");
self = oself;
return world;
return (__NULL__);
}
Bot_PickName(self);
@ -55,5 +55,5 @@ Bot_AddQuick(void)
newbot = self;
self = oself;
return newbot;
return (newbot);
}

View file

@ -25,15 +25,14 @@ int
Route_RoundDistance(float flDist)
{
float r = fabs(flDist) % 2;
if (r == 0) {
return flDist;
}
if (flDist < 0) {
if (r == 0)
return (flDist);
if (flDist < 0)
return -(fabs(flDist) - r);
} else {
return flDist + 2 - r;
}
else
return (flDist + 2 - r);
}
@ -47,7 +46,7 @@ Route_SelectRandom(string sEntname)
{
static entity eLastSpot;
eLastSpot = find(eLastSpot, classname, sEntname);
return eLastSpot;
return (eLastSpot);
}
/*
@ -60,7 +59,7 @@ Route_SelectRandomSpot(void)
{
static entity eLastSpot;
eLastSpot = findfloat(eLastSpot, ::botinfo, BOTINFO_SPAWNPOINT);
return eLastSpot;
return (eLastSpot);
}
void
@ -83,11 +82,11 @@ Route_SelectDestination(bot target)
{
entity dest = world;
// Need health!
if (target.health < 50) {
entity temp;
int bestrange = COST_INFINITE;
int range;
for (temp = world; (temp = findfloat(temp, ::botinfo, BOTINFO_HEALTH));) {
range = vlen(temp.origin - target.origin);
if ((range < bestrange) && (temp.solid == SOLID_TRIGGER)) {
@ -98,11 +97,11 @@ Route_SelectDestination(bot target)
if (dest) {
//dprint("Route: Going for health!");
return dest.origin + '0 0 32';
return (dest.origin + [0,0,32]);
}
}
dest = Route_SelectRandomSpot();
target.m_eDestination = dest;
return dest.origin;
return (dest.origin);
}

View file

@ -94,5 +94,5 @@ CSQC_Parse_Damage(float save, float take, vector abs_pos)
pSeat->m_flDamageAlpha = 1.0f;
}
return TRUE;
return (1);
}

View file

@ -61,7 +61,7 @@ EFX_Load(string efx_file)
int i;
if (!efx_file) {
return 0;
return (0);
}
i = g_efx_count;
@ -81,7 +81,7 @@ EFX_Load(string efx_file)
fh = fopen(strcat("efx/", efx_file, ".efx"), FILE_READ);
if (fh < 0) {
return 0;
return (0);
}
/* cache the name */

View file

@ -40,14 +40,14 @@ Entities_ParseLump(void)
/* when we've reached the end of the lump, initialize the class! */
if (iClass == TRUE) {
eEnt.Init();
return TRUE;
return (1);
}
/* remove if we've found no valid class to go with us */
if (eEnt) {
remove(eEnt);
}
return TRUE;
return (1);
}
strValue = getentitytoken();
@ -76,5 +76,5 @@ Entities_ParseLump(void)
}
}
return FALSE;
return (0);
}

View file

@ -465,7 +465,7 @@ CSQC_InputEvent(float fEventType, float fKey, float fCharacter, float fDeviceID)
}
break;
default:
return TRUE;
return (1);
}
VGUI_Input(fEventType, fKey, fCharacter, fDeviceID);
@ -476,7 +476,7 @@ CSQC_InputEvent(float fEventType, float fKey, float fCharacter, float fDeviceID)
setcursormode(FALSE, "gfx/cursor", [0,0,0], 1.0f);
}
return FALSE;
return (0);
}
/*
@ -810,7 +810,7 @@ CSQC_ConsoleCommand(string sCMD)
default:
return ClientGame_ConsoleCommand();
}
return TRUE;
return (1);
}
void
@ -868,7 +868,7 @@ CSQC_Parse_CenterPrint(string sMessage)
pSeat->m_flCenterprintAlpha = 1;
pSeat->m_flCenterprintTime = time + 3;
return TRUE;
return (1);
}
/*

View file

@ -53,7 +53,7 @@ CBaseNPC::predraw(void)
ProcessWordQue();
addentity(this);
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
void

View file

@ -52,7 +52,7 @@ player::predraw(void)
removeentity(this);
}
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
void

View file

@ -185,5 +185,5 @@ Sentences_GetSamples(string msg)
return g_sentences[i].m_strSamples;
}
}
return "";
return ("");
}

View file

@ -28,12 +28,12 @@ int
VGUI_Draw(void)
{
g_uiDesktop.Draw();
return 1;
return (1);
}
int
VGUI_Input(float flEvType, float flScanX, float flCharY, float flDevID)
{
g_uiDesktop.Input(flEvType, flScanX, flCharY, flDevID);
return 1;
return (1);
}

View file

@ -53,7 +53,7 @@ env_glow::predraw(void)
vecPlayer = pSeat->m_vecPredictedOrigin;
if (checkpvs(vecPlayer, this) == FALSE)
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
other = world;
traceline(this.origin, vecPlayer, MOVE_OTHERONLY, this);
@ -67,7 +67,7 @@ env_glow::predraw(void)
m_flAlpha = bound(0.0f, m_flAlpha, 1.0f);
if (m_flAlpha <= 0.0f)
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
/* Scale the glow somewhat with the players distance */
fsize = m_vecSize * m_flScale;
@ -112,7 +112,7 @@ env_glow::predraw(void)
#endif
addentity(this);
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
void

View file

@ -40,7 +40,7 @@ class env_laser
float env_laser::predraw(void)
{
if (!m_iState)
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
R_BeginPolygon(m_strBeamTex, 0, 0);
R_PolygonVertex(angles, [0,0], [1,1,1], 1.0f);
@ -48,7 +48,7 @@ float env_laser::predraw(void)
R_EndPolygonRibbon(2, [1,0]);
addentity(this);
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
void

View file

@ -35,13 +35,13 @@ Util_IsSky(vector pos)
{
if (serverkeyfloat("*bspversion") == BSPVER_HL)
if (getsurfacetexture(world, getsurfacenearpoint(world, pos)) == "sky") {
return TRUE;
return (1);
}
if (trace_surfaceflagsi & SURF_SKY) {
return TRUE;
return (1);
}
return FALSE;
return (0);
}
class env_sun:CBaseEntity
@ -62,7 +62,7 @@ float
env_sun::predraw(void)
{
addentity(this);
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
void

View file

@ -39,10 +39,10 @@ float
func_dustmotes::predraw(void)
{
if (m_flNexTime > cltime)
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
if (checkpvs(getproperty(VF_ORIGIN), this) == FALSE)
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
for (int i = 0; i < m_iCount; i++) {
vector vecPos;
@ -55,7 +55,7 @@ func_dustmotes::predraw(void)
m_flNexTime = cltime + 3.0f;
addentity(self);
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
void

View file

@ -53,27 +53,27 @@ func_lod::predraw(void)
vecPlayer = pSeat->m_vecPredictedOrigin;
if (checkpvs(vecPlayer, this) == FALSE) {
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
#ifdef DEVELOPER
if (autocvar_dev_loddistance != 0) {
if (vlen(vecPlayer - m_vecTestPos) > autocvar_dev_loddistance) {
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
} else {
if (vlen(vecPlayer - m_vecTestPos) > m_iDisappearDist) {
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
}
#else
if (vlen(vecPlayer - m_vecTestPos) > m_iDisappearDist) {
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
#endif
addentity(self);
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
void

View file

@ -43,7 +43,7 @@ infodecal::predraw(void)
m_decChild.Place(origin, m_strTexture);
remove(this);
}
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
void

View file

@ -75,10 +75,10 @@ PointMessage_Visible(vector p1, vector p2, vector ang)
if (fov > 0.3) {
traceline(p2, p1, TRUE, self);
if (trace_fraction == 1.0) {
return TRUE;
return (1);
}
}
return FALSE;
return (0);
}
void

View file

@ -117,7 +117,7 @@ float prop_rope::predraw(void)
if (checkpvs(getproperty(VF_ORIGIN), this) == FALSE) {
if (checkpvs(getproperty(VF_ORIGIN), x) == FALSE) {
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
}
@ -127,7 +127,7 @@ float prop_rope::predraw(void)
this.classname, target));
#endif
remove(this);
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
/* draw the start/end without segments */
@ -171,7 +171,7 @@ float prop_rope::predraw(void)
/* only drawing one segment. */
if (spawnflags & 1) {
addentity(this);
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
sc = 0;
@ -202,7 +202,7 @@ float prop_rope::predraw(void)
}
addentity(this);
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
void prop_rope::SpawnKey(string strField, string strKey)

View file

@ -70,12 +70,12 @@ float
ambient_generic::SendEntity(entity ePEnt, float fChanged)
{
if (clienttype(ePEnt) != CLIENTTYPE_REAL) {
return FALSE;
return (0);
}
/* only override when we're doing the toggle guff */
if (m_iLoop == FALSE) {
return FALSE;
return (0);
}
WriteByte(MSG_ENTITY, ENT_AMBIENTSOUND);
@ -95,7 +95,7 @@ ambient_generic::SendEntity(entity ePEnt, float fChanged)
WriteString(MSG_ENTITY, m_strActivePath);
}
return TRUE;
return (1);
}
void

View file

@ -17,19 +17,19 @@
int
CBaseMonster::AnimIdle(void)
{
return 0;
return (0);
}
int
CBaseMonster::AnimWalk(void)
{
return 0;
return (0);
}
int
CBaseMonster::AnimRun(void)
{
return 0;
return (0);
}
void
@ -67,11 +67,11 @@ CBaseMonster::IsFriend(int al)
{
if (m_iAlliance == MAL_ROGUE)
return FALSE;
return (0);
else if (al == m_iAlliance)
return TRUE;
return (1);
return FALSE;
return (0);
}
@ -125,9 +125,8 @@ CBaseMonster::AttackThink(void)
if (m_iSequenceState != SEQUENCESTATE_NONE)
return;
if (m_flAttackThink > time) {
if (m_flAttackThink > time)
return;
}
if (!m_eEnemy)
return;
@ -179,14 +178,14 @@ int
CBaseMonster::AttackMelee(void)
{
m_flAttackThink = time + 0.5f;
return FALSE;
return (0);
}
int
CBaseMonster::AttackRanged(void)
{
m_flAttackThink = time + 0.5f;
return FALSE;
return (0);
}
void
@ -255,9 +254,8 @@ CBaseMonster::CheckRoute(void)
float flDist;
vector evenpos;
if (!m_iNodes) {
if (!m_iNodes)
return;
}
/* level out position/node stuff */
if (m_iCurNode < 0) {
@ -351,9 +349,8 @@ CBaseMonster::WalkRoute(void)
endangles = vectoangles(m_eEnemy.origin - origin);
input_movevalues = [m_flChaseSpeed, 0, 0];
m_vecTurnAngle[1] = endangles[1];
} else {
} else
return;
}
/* functional */
input_angles[1] = v_angle[1] = m_vecTurnAngle[1];
@ -479,9 +476,8 @@ CBaseMonster::Physics(void)
void
CBaseMonster::touch(void)
{
if (movetype != MOVETYPE_WALK) {
if (movetype != MOVETYPE_WALK)
return;
}
if (other.movetype == MOVETYPE_WALK) {
velocity = normalize(other.origin - origin) * -128;

View file

@ -44,9 +44,8 @@ CBaseNPC::Sentence(string sentence)
{
string seq = Sentences_GetSamples(sentence);
if (seq == "") {
if (seq == "")
return;
}
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
WriteByte(MSG_MULTICAST, EV_SENTENCE);
@ -74,13 +73,11 @@ CBaseNPC::TalkPlayerGreet(void)
if (m_iSequenceState != SEQUENCESTATE_NONE)
return;
if (m_flNextSentence > time) {
if (m_flNextSentence > time)
return;
}
if (m_iFlags & MONSTER_METPLAYER) {
if (m_iFlags & MONSTER_METPLAYER)
return;
}
for (entity p = world; (p = find(p, ::classname, "player"));) {
/* Find players in a specific radius */
@ -154,13 +151,11 @@ CBaseNPC::TalkPlayerWounded1(void)
if (m_iSequenceState != SEQUENCESTATE_NONE)
return;
if (m_flNextSentence > time) {
if (m_flNextSentence > time)
return;
}
if (base_health < health) {
if (base_health < health)
return;
}
for (entity p = world; (p = find(p, ::classname, "player"));) {
/* Find players in a specific radius */
@ -182,13 +177,11 @@ CBaseNPC::TalkPlayerWounded2(void)
if (m_iSequenceState != SEQUENCESTATE_NONE)
return;
if (m_flNextSentence > time) {
if (m_flNextSentence > time)
return;
}
if ((base_health / 2) < health) {
if ((base_health / 2) < health)
return;
}
for (entity p = world; (p = find(p, ::classname, "player"));) {
/* Find players in a specific radius */
@ -211,9 +204,8 @@ CBaseNPC::TalkPlayerWounded3(void)
if (m_iSequenceState != SEQUENCESTATE_NONE)
return;
if (m_flNextSentence > time) {
if (m_flNextSentence > time)
return;
}
for (entity p = world; (p = find(p, ::classname, "player"));) {
/* Find players in a specific radius */
@ -450,14 +442,12 @@ CBaseNPC::Respawn(void)
void
CBaseNPC::OnPlayerUse(void)
{
if (m_iFlags & MONSTER_FEAR) {
if (m_iFlags & MONSTER_FEAR)
return;
}
/* can't press use any non-allies */
if (!(m_iFlags & MONSTER_CANFOLLOW)) {
if (!(m_iFlags & MONSTER_CANFOLLOW))
return;
}
if ((m_eFollowing == world)) {
if (!(m_iFlags & MONSTER_USED)) {

View file

@ -46,7 +46,7 @@ CBaseTrigger::CreateOutput(string outmsg)
float c;
if (!outmsg)
return "";
return ("");
outname = sprintf("output_%i\n", outcount);
outcount++;
@ -159,7 +159,7 @@ CBaseTrigger::GetMaster(void)
if (!m_strMaster) {
/*dprint(sprintf("^2%s::^3GetMaster^7: No master, return success\n",
this.classname));*/
return TRUE;
return (1);
}
t = (CBaseTrigger)find(world, ::target, m_strMaster);
@ -168,7 +168,7 @@ CBaseTrigger::GetMaster(void)
if (!t) {
/*dprint(sprintf("^2%s::^3GetMaster^7: Invalid master, return success\n",
this.classname));*/
return TRUE;
return (1);
}
/*if (t.GetValue() == 1)

View file

@ -95,10 +95,10 @@ env_global::GlobalPresent(string strName)
{
for (int i = 1; i < (tokenize(cvar_string(CENVGLOBAL_CVAR)) - 1); i += 2) {
if (argv(i) == strName) {
return 1;
return (1);
}
}
return 0;
return (0);
}
void
@ -126,7 +126,7 @@ env_global::GetGlobal(string strName)
return stoi(argv(i+1));
}
}
return 0;
return (0);
}
void

View file

@ -124,7 +124,7 @@ float
env_laser::SendEntity(entity ePEnt, float fChanged)
{
if (clienttype(ePEnt) != CLIENTTYPE_REAL) {
return FALSE;
return (0);
}
WriteByte(MSG_ENTITY, ENT_ENVLASER);
@ -150,7 +150,7 @@ env_laser::SendEntity(entity ePEnt, float fChanged)
WriteByte(MSG_ENTITY, m_iState);
}
return TRUE;
return (1);
}
void

View file

@ -56,14 +56,14 @@ float
env_sprite::SendEntity(entity ePEnt, float flags)
{
if (clienttype(ePEnt) != CLIENTTYPE_REAL)
return FALSE;
return (0);
if (spawnflags & ENVS_PLAYONCE)
return FALSE;
return (0);
/* Delete it on the client. */
if (m_iToggled == FALSE)
return FALSE;
return (0);
WriteByte(MSG_ENTITY, ENT_SPRITE);
WriteFloat(MSG_ENTITY, 666);
@ -88,7 +88,7 @@ env_sprite::SendEntity(entity ePEnt, float flags)
WriteFloat(MSG_ENTITY, alpha);
#endif
return TRUE;
return (1);
}
void

View file

@ -202,7 +202,7 @@ func_breakable::Death(void)
}
health = 0;
eActivator = g_eAttacker;
eActivator = g_dmg_eAttacker;
if (m_strBreakSpawn != "" && isfunction(m_strBreakSpawn)) {
entity unit = spawn();

View file

@ -34,7 +34,7 @@ class func_lod:CBaseEntity
float
func_lod::SendEntity(entity a, float b)
{
return FALSE;
return (0);
}
void

View file

@ -58,7 +58,7 @@ multisource::QueryTargets(void)
} else {
/* exit out immediately as there's no point unless in-dev */
if (tTemp.GetValue() == FALSE) {
return FALSE;
return (0);
}
}
}

View file

@ -75,8 +75,8 @@ trigger_changelevel::IsInside(entity ePlayer, entity eVolume)
ePlayer.absmax[0] < eVolume.absmin[0] ||
ePlayer.absmax[1] < eVolume.absmin[1] ||
ePlayer.absmax[2] < eVolume.absmin[2])
return FALSE;
return TRUE;
return (0);
return (1);
}
void

View file

@ -141,7 +141,7 @@ float
CBaseEntity::predraw(void)
{
if (!modelindex) {
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
#ifdef GS_RENDERFX
@ -180,7 +180,7 @@ CBaseEntity::predraw(void)
if (alpha > 0.0)
addentity(this);
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
void
@ -385,10 +385,10 @@ float
CBaseEntity::SendEntity(entity ePEnt, float fChanged)
{
if (!modelindex)
return FALSE;
return (0);
if (clienttype(ePEnt) != CLIENTTYPE_REAL)
return FALSE;
return (0);
WriteByte(MSG_ENTITY, ENT_ENTITY);
@ -427,7 +427,7 @@ CBaseEntity::SendEntity(entity ePEnt, float fChanged)
/* don't network triggers unless provoked */
/*if (cvar("developer") == 0 && m_iRenderMode == RM_TRIGGER)
return FALSE;*/
return (0);*/
#ifdef GS_RENDERFX
/* let's not waste networking power on certain render-modes where they would
@ -512,7 +512,7 @@ CBaseEntity::SendEntity(entity ePEnt, float fChanged)
}
#endif
return TRUE;
return (1);
}
void

View file

@ -43,10 +43,10 @@ float
decal::SendEntity(entity ePEnt, float changedflags)
{
if (clienttype(ePEnt) != CLIENTTYPE_REAL)
return FALSE;
return (0);
if (!m_strTexture)
return FALSE;
return (0);
WriteByte(MSG_ENTITY, ENT_DECAL);
WriteByte(MSG_ENTITY, changedflags);
@ -66,7 +66,7 @@ decal::SendEntity(entity ePEnt, float changedflags)
if (changedflags & DECALFL_MATERIAL)
WriteString(MSG_ENTITY, m_strTexture);
return TRUE;
return (1);
}
#else
void
@ -116,21 +116,21 @@ decal::predraw(void)
decal dcl = (decal)self;
if (!autocvar_r_drawdecals) {
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
/* skip empty decals */
if (!dcl.m_strShader)
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
/* don't draw us, unnecessary */
if (checkpvs(vecPlayer, this) == FALSE) {
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
adddecal(dcl.m_strShader, dcl.origin, dcl.mins, dcl.maxs, dcl.color, 1.0f);
addentity(dcl);
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
void
@ -241,7 +241,7 @@ decal Decals_Next(vector pos)
/* Check for a tempdecal within a radius of 8 units and overwrite that one
* instead */
for (entity b = world; (b = find(b, ::classname, "tempdecal"));) {
if (vlen(b.origin - pos) < 2) {
if (vlen(b.origin - pos) < 4) {
return b;
}
}

View file

@ -97,7 +97,7 @@ float
env_projectedtexture::predraw(void)
{
if (!m_iState) {
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
/* TODO: We need to handle the second cone light */
@ -108,7 +108,7 @@ env_projectedtexture::predraw(void)
dynamiclight_set(p, LFIELD_STYLESTRING, m_strPattern);
addentity(this);
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
void
@ -197,7 +197,7 @@ float
env_projectedtexture::SendEntity(entity ePEnt, float flFlags)
{
if (clienttype(ePEnt) != CLIENTTYPE_REAL)
return FALSE;
return (0);
WriteByte(MSG_ENTITY, ENT_PROJECTEDTEXTURE);
WriteFloat(MSG_ENTITY, flFlags);
@ -237,7 +237,7 @@ env_projectedtexture::SendEntity(entity ePEnt, float flFlags)
if (flFlags & PRTEXFL_CHANGED_PATTERN)
WriteString(MSG_ENTITY, m_strPattern);
return TRUE;
return (1);
}
void

View file

@ -53,7 +53,7 @@ func_illusionary::SendEntity(entity pvsent, float fl)
if (targetname)
return CBaseTrigger::SendEntity(pvsent, fl);
else
return FALSE;
return (0);
}
void
@ -101,12 +101,12 @@ func_illusionary::predraw(void)
vecPlayer = pSeat->m_vecPredictedOrigin;
if (checkpvs(vecPlayer, this) == FALSE) {
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
CBaseEntity::predraw();
addentity(self);
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
void

View file

@ -171,7 +171,7 @@ float
func_monitor::SendEntity(entity ePEnt, float flFlags)
{
if (clienttype(ePEnt) != CLIENTTYPE_REAL)
return FALSE;
return (0);
WriteByte(MSG_ENTITY, ENT_MONITOR);
WriteFloat(MSG_ENTITY, flFlags);
@ -216,7 +216,7 @@ func_monitor::SendEntity(entity ePEnt, float flFlags)
if (flFlags & MONITORFL_CHANGED_STATUS)
WriteByte(MSG_ENTITY, m_iValue);
return TRUE;
return (1);
}
void

View file

@ -53,7 +53,7 @@ func_wall::SendEntity(entity pvsent, float fl)
if (targetname)
return CBaseTrigger::SendEntity(pvsent, fl);
else
return FALSE;
return (0);
}
void
@ -96,12 +96,12 @@ func_wall::predraw(void)
vecPlayer = pSeat->m_vecPredictedOrigin;
if (checkpvs(vecPlayer, this) == FALSE) {
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
CBaseEntity::predraw();
addentity(self);
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
void

View file

@ -127,7 +127,7 @@ float
info_particle_system::SendEntity(entity ePEnt, float flFlags)
{
if (clienttype(ePEnt) != CLIENTTYPE_REAL)
return FALSE;
return (0);
WriteByte(MSG_ENTITY, ENT_PARTSYSTEM);
WriteFloat(MSG_ENTITY, flFlags);
@ -156,7 +156,7 @@ info_particle_system::SendEntity(entity ePEnt, float flFlags)
if (flFlags & PARTSYSFL_CHANGED_COUNT)
WriteByte(MSG_ENTITY, m_iSpawnCount);
return TRUE;
return (1);
}
void

View file

@ -109,7 +109,7 @@ float
light_dynamic::predraw(void)
{
if (!m_iState) {
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
float p = dynamiclight_add(origin, m_flDistance, m_vecLight, m_flStyle);
@ -119,7 +119,7 @@ light_dynamic::predraw(void)
dynamiclight_set(p, LFIELD_STYLESTRING, m_strPattern);
addentity(this);
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
void
@ -247,7 +247,7 @@ float
light_dynamic::SendEntity(entity ePEnt, float flFlags)
{
if (clienttype(ePEnt) != CLIENTTYPE_REAL)
return FALSE;
return (0);
WriteByte(MSG_ENTITY, ENT_DLIGHT);
WriteFloat(MSG_ENTITY, flFlags);
@ -287,7 +287,7 @@ light_dynamic::SendEntity(entity ePEnt, float flFlags)
if (flFlags & DLIGHTFL_CHANGED_PATTERN)
WriteString(MSG_ENTITY, m_strPattern);
return TRUE;
return (1);
}
void

View file

@ -29,7 +29,7 @@ float
Spray_SendEntity(entity ePEnt, float fChanged)
{
if (clienttype(ePEnt) != CLIENTTYPE_REAL)
return FALSE;
return (0);
WriteByte(MSG_ENTITY, ENT_SPRAY);
WriteCoord(MSG_ENTITY, self.origin[0]);
@ -39,7 +39,7 @@ Spray_SendEntity(entity ePEnt, float fChanged)
WriteCoord(MSG_ENTITY, self.angles[1]);
WriteCoord(MSG_ENTITY, self.angles[2]);
WriteEntity(MSG_ENTITY, self.owner);
return TRUE;
return (1);
}
void
@ -118,7 +118,7 @@ CSpraylogo::predraw(void)
iSize = getplayerkeyblob(m_iOwnerID, "spray", __NULL__, 0);
if (iSize <= 0) {
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
if (m_iInitialized == FALSE) {
@ -147,7 +147,7 @@ CSpraylogo::predraw(void)
adddecal(m_strName, m_vecPosition, width, height, light, 1.0f);
addentity(this);
}
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
void

View file

@ -100,10 +100,10 @@ float
trigger_camera::SendEntity(entity ePEnt, float flFlags)
{
if (clienttype(ePEnt) != CLIENTTYPE_REAL)
return FALSE;
return (0);
if (ePEnt != m_eLooker)
return FALSE;
return (0);
WriteByte(MSG_ENTITY, ENT_OLDCAMERA);
WriteFloat(MSG_ENTITY, flFlags);
@ -124,7 +124,7 @@ trigger_camera::SendEntity(entity ePEnt, float flFlags)
WriteFloat(MSG_ENTITY, m_flWait);
}
return TRUE;
return (1);
}
void

View file

@ -68,7 +68,7 @@ Music_GetPath(int id)
}
}
return "";
return ("");
}
/* EV_MUSICTRACK */

View file

@ -81,7 +81,7 @@ TCP_Receive(tcpinfo_t *in)
{
/* not even open */
if (in.m_fSocket <= 0)
return "";
return ("");
return fgets(in.m_fSocket);
}

View file

@ -214,7 +214,7 @@ string
CListBox::GetSelectedItem(void)
{
if (m_selected == -1) {
return __NULL__;
return (__NULL__);
}
return m_entries[m_selected];
}

View file

@ -183,7 +183,7 @@ CModList::GetSelected(void)
/*string CModList::GetSelectedItem(void)
{
if (m_selected == -1) {
return __NULL__;
return (__NULL__);
}
return m_entries[m_selected];
}*/

View file

@ -148,7 +148,7 @@ string
CServerList::GetSelectedItem(void)
{
if (m_selected == -1) {
return __NULL__;
return (__NULL__);
}
return m_entries[m_selected];
}

View file

@ -225,7 +225,7 @@ CUpdateList::GetSelected(void)
CUpdateList::GetSelectedItem(void)
{
if (m_selected == -1) {
return __NULL__;
return (__NULL__);
}
return m_entries[m_selected];
}*/

View file

@ -166,8 +166,8 @@ float m_consolecommand ( string strCommand )
argv(1)));
break;
default:
return FALSE;
return (0);
}
return TRUE;
return (1);
}

View file

@ -37,7 +37,7 @@ ChatFilter(string cmd)
for (int i = 0; i < g_words; i++)
cmd = strreplace(g_wordlist[i], ChatFilter_CreateWord(i), cmd);
return cmd;
return (cmd);
}
/* plugin hook */
@ -50,7 +50,7 @@ FMX_ParseClientCommand(string cmd)
return ChatFilter(cmd);
break;
}
return cmd;
return (cmd);
}
void

View file

@ -46,13 +46,13 @@ ChatLookUp(string cmd)
for (int c = 0; c < sc; c++) {
if (cmd == argv(c)) {
ChatPlay(i);
return __NULL__;
return (__NULL__);
}
}
}
/* some joker might set it to non 0/1 */
return __NULL__;
return (__NULL__);
}
/* plugin hook */
@ -65,7 +65,7 @@ FMX_ParseClientCommand(string cmd)
return ChatLookUp(strtolower(argv(1)));
break;
}
return cmd;
return (cmd);
}
void

View file

@ -128,7 +128,7 @@ FMX_ParseClientCommand(string cmd)
irc_send(sprintf("PRIVMSG %s :<%s> %s\n", g_irc_channeltarget, self.netname, argv(1)));
break;
}
return cmd;
return (cmd);
}
void

View file

@ -55,7 +55,6 @@ void Game_Input(void);
int Rules_IsTeamPlay(void);
entity eActivator;
entity g_eAttacker;
/* Generic entity fields */
.void(void) PlayerUse;

View file

@ -586,7 +586,7 @@ ConsoleCmd(string cmd)
/* give the game-mode a chance to override us */
if (g_ents_initialized)
if (g_grMode.ConsoleCommand(pl, cmd) == TRUE)
return TRUE;
return (1);
/* time to handle commands that apply to all games */
tokenize(cmd);
@ -615,9 +615,9 @@ ConsoleCmd(string cmd)
break;
#endif
default:
return FALSE;
return (0);
}
return TRUE;
return (1);
}
/*
@ -632,13 +632,13 @@ float
SV_ShouldPause(float newstatus)
{
if (serverkeyfloat("background") == 1)
return FALSE;
return (0);
if (cvar("pausable") == 1)
return TRUE;
return (1);
if (cvar("sv_playerslots") > 1)
return FALSE;
return (0);
return newstatus;
}

View file

@ -30,7 +30,7 @@ CGameRules::FrameStart(void)
float
CGameRules::ConsoleCommand(base_player pl, string cmd)
{
return FALSE;
return (0);
}
/* client */

View file

@ -128,7 +128,7 @@ Plugin_InitEnts(void)
void(void) vFunc;
if (g_plugins_enabled == 0)
return FALSE;
return (0);
for (int i = 0; i < g_plugincount; i++) {
vFunc = externvalue(g_plugindb[i].m_flProgsID, "FMX_InitEnts");
@ -154,7 +154,7 @@ Plugin_RunClientCommand(void)
int(void) vFunc;
if (g_plugins_enabled == 0)
return FALSE;
return (0);
/* rval = final return value, tval = temporary return value.
if at least one of the plugins returns TRUE, then RunClientCommand
@ -188,7 +188,7 @@ Plugin_ParseClientCommand(string msg)
string(string msg) vFunc;
if (g_plugins_enabled == 0)
return FALSE;
return (0);
for (int i = 0; i < g_plugincount; i++) {
vFunc = externvalue(g_plugindb[i].m_flProgsID, "FMX_ParseClientCommand");
@ -221,7 +221,7 @@ Plugin_PlayerConnect(base_player cl)
int(entity) vFunc;
if (g_plugins_enabled == 0)
return FALSE;
return (0);
/* rval = final return value, tval = temporary return value.
if at least one of the plugins returns TRUE, then RunClientCommand
@ -256,7 +256,7 @@ Plugin_PlayerDisconnect(base_player cl)
int(entity) vFunc;
if (g_plugins_enabled == 0)
return FALSE;
return (0);
/* rval = final return value, tval = temporary return value.
if at least one of the plugins returns TRUE, then RunClientCommand
@ -291,7 +291,7 @@ Plugin_PlayerEntered(base_player cl)
int(entity) vFunc;
if (g_plugins_enabled == 0)
return FALSE;
return (0);
/* rval = final return value, tval = temporary return value.
if at least one of the plugins returns TRUE, then RunClientCommand
@ -324,7 +324,7 @@ Plugin_PlayerObituary(entity attk, entity targ, int weapon, bodyType_t body, int
void(entity,entity,int,int,int) vFunc;
if (g_plugins_enabled == 0)
return FALSE;
return (0);
for (int i = 0; i < g_plugincount; i++) {
vFunc = externvalue(g_plugindb[i].m_flProgsID, "FMX_PlayerObituary");

View file

@ -91,7 +91,7 @@ Sentences_GetSamples(string word)
/* you never know what NPCs might do */
if (word == "") {
return "";
return ("");
}
/* check if the word is present at all */
@ -120,5 +120,5 @@ Sentences_GetSamples(string word)
/* we've somehow messed up catastrophically */
print(sprintf("^1ERROR: Invalid sentence keyword %s\n", word));
return "";
return ("");
}

View file

@ -128,7 +128,7 @@ entity Spawn_SelectRandom(string cname)
/* still not found any */
if (spot == __NULL__) {
error(sprintf("Spawn_SelectRandom: no %s on level", cname));
return world;
return (__NULL__);
}
lastspot = spot;

View file

@ -18,7 +18,6 @@
var int iTotalPenetrations;
#endif
void TraceAttack_FireSingle(vector vecPos, vector vAngle, int iDamage, int iWeapon);
void TraceAttack_FireBullets(int iShots, vector vecPos, int iDamage, vector vecSpread, int iWeapon);
#ifdef BULLETPENETRATION

View file

@ -14,24 +14,44 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
entity g_multiDamage_Target;
int g_multiDamage_Value;
static void
TraceAttack_Apply(entity eAttacker, int iWeapon)
{
/* may not be defined yet */
if (g_multiDamage_Target == __NULL__)
return;
if (trace_ent.iBleeds == 1) {
FX_Blood(trace_endpos, [1,0,0]);
}
Damage_Apply(g_multiDamage_Target, self, g_multiDamage_Value, iWeapon, DMG_BULLET);
g_multiDamage_Target = __NULL__;
g_multiDamage_Value = 0;
}
/* cast a single bullet shot */
void
static void
TraceAttack_FireSingle(vector vecPos, vector vAngle, int iDamage, int iWeapon)
{
string tex_name;
vector range;
float surf;
range = (vAngle * 8196);
/* make sure we can gib corpses */
int oldhitcontents = self.hitcontentsmaski;
self.hitcontentsmaski = CONTENTBITS_POINTSOLID | CONTENTBIT_CORPSE;
traceline(vecPos, vecPos + range, MOVE_LAGGED | MOVE_HITMODEL, self);
self.hitcontentsmaski = oldhitcontents;
if (trace_fraction >= 1.0f)
return;
if (trace_ent.takedamage == DAMAGE_YES && trace_ent.iBleeds) {
Sound_Play(trace_ent, CHAN_BODY, "damage_bullet.hit");
FX_Blood(trace_endpos, [1,0,0]);
#ifdef CSTRIKE
player pl = (player)trace_ent;
@ -64,7 +84,13 @@ TraceAttack_FireSingle(vector vecPos, vector vAngle, int iDamage, int iWeapon)
if (trace_surface_id == BODY_HEAD)
iDamage *= 3;
#endif
} else {
}
/* impact per bullet */
if (trace_ent.iBleeds == 0) {
string tex_name;
float surf;
switch (serverkeyfloat("*bspversion")) {
case BSPVER_HL:
surf = getsurfacenearpoint(trace_ent, trace_endpos);
@ -176,8 +202,16 @@ TraceAttack_FireSingle(vector vecPos, vector vAngle, int iDamage, int iWeapon)
}
}
if (trace_ent.takedamage == DAMAGE_YES)
Damage_Apply(trace_ent, self, iDamage, iWeapon, DMG_BULLET);
/* combine them into one single Damage_Apply call later */
if (trace_ent.takedamage == DAMAGE_YES) {
if (trace_ent != g_multiDamage_Target) {
TraceAttack_Apply(self, iWeapon);
g_multiDamage_Target = trace_ent;
g_multiDamage_Value = iDamage;
} else {
g_multiDamage_Value += iDamage;
}
}
#ifdef BULLETPENETRATION
if (iTotalPenetrations > 0) {
@ -194,6 +228,9 @@ TraceAttack_FireBullets(int iShots, vector vecPos, int iDamage, vector vecSpread
vector vDir;
makevectors(self.v_angle);
g_multiDamage_Target = __NULL__;
g_multiDamage_Value = 0;
while (iShots > 0) {
vDir = aim(self, 100000);
#ifndef BULLETPATTERNS
@ -218,6 +255,10 @@ TraceAttack_FireBullets(int iShots, vector vecPos, int iDamage, vector vecSpread
TraceAttack_FireSingle(vecPos, vDir, iDamage, iWeapon);
iShots--;
}
if (g_multiDamage_Target) {
TraceAttack_Apply(self, iWeapon);
}
}
#ifdef BULLETPENETRATION

View file

@ -130,7 +130,7 @@ Weapons_AddItem(base_player pl, int w, int startammo)
/* we're over the slot limit. */
if (c >= maxit) {
self = oldself;
return FALSE;
return (0);
}
}
}

View file

@ -326,6 +326,6 @@ base_player::SendEntity(entity ePEnt, float fChanged)
WriteFloat(MSG_ENTITY, punchangle[1]);
WriteFloat(MSG_ENTITY, punchangle[2]);
return TRUE;
return (1);
}
#endif

View file

@ -255,7 +255,7 @@ QPMove_IsStuck(entity eTarget, vector vOffset, vector vecMins, vector vecMaxs)
vector bound;
if (eTarget.solid != SOLID_SLIDEBOX) {
return FALSE;
return (0);
}
bound = eTarget.origin + vOffset;
@ -576,12 +576,12 @@ PMove_Fix_Origin(void)
tracebox(norg, self.mins, self.maxs, norg, MOVE_NORMAL, self);
if (!trace_startsolid) {
self.origin = norg;
return TRUE;
return (1);
}
}
}
}
return FALSE;
return (0);
}
/* move the player based on the given acceleration */

View file

@ -175,7 +175,7 @@ Sound_Parse(int i, string line, string shader)
dprint("}\n");
braced = FALSE;
t_name = "";
return TRUE;
return (1);
break;
default:
if (braced == TRUE) {
@ -196,7 +196,7 @@ Sound_Parse(int i, string line, string shader)
}
}
}
return FALSE;
return (0);
}
int

View file

@ -43,11 +43,11 @@ float
spectator::SendEntity(entity ePVSent, float flChangedFlags)
{
if (this != ePVSent) {
return FALSE;
return (0);
}
if (clienttype(ePVSent) != CLIENTTYPE_REAL) {
return FALSE;
return (0);
}
WriteByte(MSG_ENTITY, ENT_SPECTATOR);
@ -74,7 +74,7 @@ spectator::SendEntity(entity ePVSent, float flChangedFlags)
if (flChangedFlags & SPECFL_FLAGS)
WriteByte(MSG_ENTITY, spec_flags);
return TRUE;
return (1);
}
void
@ -144,7 +144,7 @@ float
spectator::predraw(void)
{
addentity(this);
return PREDRAW_NEXT;
return (PREDRAW_NEXT);
}
#endif

View file

@ -30,10 +30,10 @@ Util_MouseAbove(vector vecMousePos, vector vecPos, vector vecSize)
{
if (vecMousePos[0] >= vecPos[0] && vecMousePos[0] <= vecPos[0] + vecSize[0]) {
if (vecMousePos[1] >= vecPos[1] && vecMousePos[1] <= vecPos[1] + vecSize[1]) {
return 1;
return (1);
}
}
return 0;
return (0);
}
class CUIWidget

View file

@ -57,9 +57,9 @@ void CUICheckbox::SetTitle (string strName)
int CUICheckbox::GetValue(void)
{
if (m_iFlags & CHECKBOX_CHECKED) {
return TRUE;
return (1);
} else {
return FALSE;
return (0);
}
}
void CUICheckbox::SetValue (int iValue)

View file

@ -59,9 +59,9 @@ void CUIRadio::SetTitle (string strName)
int CUIRadio::GetValue(void)
{
if (m_iFlags & RADIO_ACTIVE) {
return TRUE;
return (1);
} else {
return FALSE;
return (0);
}
}
void CUIRadio::SetValue (int iValue)