Fix compile errors against upstream Nuclide.
This commit is contained in:
parent
fa43448853
commit
ea87d19317
6 changed files with 13 additions and 218 deletions
|
@ -46,8 +46,8 @@ ClientGame_PreDraw(void)
|
|||
////////////////////////////////////////////////////////////////////
|
||||
setproperty(VF_AFOV, cvar("fov") * pl.viewzoom);
|
||||
|
||||
if (autocvar_zoom_sensitivity && pl.viewzoom < 1.0f) {
|
||||
setsensitivityscaler(pl.viewzoom * autocvar_zoom_sensitivity);
|
||||
if (autocvar_in_zoomSensitivity && pl.viewzoom < 1.0f) {
|
||||
setsensitivityscaler(pl.viewzoom * autocvar_in_zoomSensitivity);
|
||||
} else {
|
||||
setsensitivityscaler(pl.viewzoom);
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ Custom_LatePreDraw(void)
|
|||
|
||||
TS_View_DrawCustom(pl);
|
||||
|
||||
int thirdperson = (autocvar_cl_thirdperson == TRUE || pl.entnum != player_localentnum);
|
||||
int thirdperson = (autocvar_pm_thirdPerson == TRUE || pl.entnum != player_localentnum);
|
||||
TS_View_DrawExtraEffects(pl, thirdperson);
|
||||
|
||||
// restore.
|
||||
|
|
|
@ -283,7 +283,7 @@ TS_View_DrawCustom(player pl){
|
|||
if (pl.health <= 0) {
|
||||
return;
|
||||
}
|
||||
if (cvar("r_drawviewmodel") == 0 || autocvar_cl_thirdperson == TRUE) {
|
||||
if (cvar("r_drawviewmodel") == 0 || autocvar_pm_thirdPerson == TRUE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -484,7 +484,7 @@ TS_View_DrawExtraEffects(player pl, int thirdperson)
|
|||
|
||||
|
||||
|
||||
//int thirdperson = (autocvar_cl_thirdperson == TRUE || this.entnum != player_localentnum);
|
||||
//int thirdperson = (autocvar_pm_thirdPerson == TRUE || this.entnum != player_localentnum);
|
||||
//NSClientPlayer pp = (NSClientPlayer)this;
|
||||
|
||||
BOOL canRenderFlashlight = FALSE;
|
||||
|
@ -543,7 +543,7 @@ TS_View_DrawExtraEffects(player pl, int thirdperson)
|
|||
|
||||
|
||||
// TAGGG - QUESTION: Is it better to use the bool "thirdperson"
|
||||
// (see check below involving cl_thirdperson)
|
||||
// (see check below involving pm_thirdPerson)
|
||||
// OR a raw "pl.entnum != player_localentnum" check?
|
||||
// The former is a more concrete check for, "Am I the local player
|
||||
// looking in 1st person, yes or no?".
|
||||
|
@ -554,8 +554,8 @@ TS_View_DrawExtraEffects(player pl, int thirdperson)
|
|||
// valve/src/client/flashlight.qc uses the latter way. Why?
|
||||
|
||||
// thirdperson
|
||||
// True IF (autocvar_cl_thirdperson == TRUE || this.entnum != player_localentnum)
|
||||
// False IF (autocvar_cl_thirdperson == FALSE && this.entnum == player_localentnum)
|
||||
// True IF (autocvar_pm_thirdPerson == TRUE || this.entnum != player_localentnum)
|
||||
// False IF (autocvar_pm_thirdPerson == FALSE && this.entnum == player_localentnum)
|
||||
if(!thirdperson){
|
||||
|
||||
//TAGGG - Old way!
|
||||
|
|
|
@ -134,8 +134,8 @@ Viewmodel_CalcBob(void)
|
|||
// bounds from Valve, does it make sense here?
|
||||
//pViewBob->m_flBob = bound(-7, flBob, 4);
|
||||
|
||||
// And the r_viewmodelscale from Valve. I think this is safe.
|
||||
pViewBob->m_flBob *= autocvar_r_viewmodelscale;
|
||||
// And the cg_viewmodelScale from Valve. I think this is safe.
|
||||
pViewBob->m_flBob *= autocvar_cg_viewmodelScale;
|
||||
|
||||
setVCam();
|
||||
}
|
||||
|
@ -150,9 +150,9 @@ Viewmodel_ApplyBob(entity gun)
|
|||
player pl = (player)pSeat->m_ePlayer;
|
||||
gun.origin = pSeat->m_vecPredictedOrigin + pl.view_ofs;
|
||||
gun.origin += [0,0,-1];
|
||||
gun.origin += v_forward * (0.75 + autocvar_v_gunofs[0] + pViewBob->m_flBob * (-0.68 + -0.112 * fabs(sin(pViewBob->m_flBobCycle)) ) + 0.98 * pViewBob->m_vCam[0] );
|
||||
gun.origin += v_right * (autocvar_v_gunofs[1] + (pViewBob->m_flBob * (-0.2 + 0.308 * sin(pViewBob->m_flBobCycle)) ) + 0.98 * pViewBob->m_vCam[1] );
|
||||
gun.origin += v_up * (0.5 + autocvar_v_gunofs[2] + (pViewBob->m_flBob * (-0.48 + 0.196 * fabs(sin(pViewBob->m_flBobCycle)) )) + 0.98 * pViewBob->m_vCam[2] );
|
||||
gun.origin += v_forward * (0.75 + autocvar_cg_viewmodelOffset[0] + pViewBob->m_flBob * (-0.68 + -0.112 * fabs(sin(pViewBob->m_flBobCycle)) ) + 0.98 * pViewBob->m_vCam[0] );
|
||||
gun.origin += v_right * (autocvar_cg_viewmodelOffset[1] + (pViewBob->m_flBob * (-0.2 + 0.308 * sin(pViewBob->m_flBobCycle)) ) + 0.98 * pViewBob->m_vCam[1] );
|
||||
gun.origin += v_up * (0.5 + autocvar_cg_viewmodelOffset[2] + (pViewBob->m_flBob * (-0.48 + 0.196 * fabs(sin(pViewBob->m_flBobCycle)) )) + 0.98 * pViewBob->m_vCam[2] );
|
||||
|
||||
//TAGGG - mock-event
|
||||
// WARNING! This place is called by Nuclide only if in first-person, not reliable.
|
||||
|
|
|
@ -30,26 +30,6 @@ Game_RunClientCommand(void)
|
|||
pl.Physics_Run();
|
||||
}
|
||||
|
||||
/* custom chat packet */
|
||||
void
|
||||
SV_SendChat(entity sender, string msg, entity eEnt, float fType)
|
||||
{
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, fType == 0 ? EV_CHAT:EV_CHAT_TEAM);
|
||||
WriteByte(MSG_MULTICAST, num_for_edict(sender) - 1);
|
||||
WriteByte(MSG_MULTICAST, sender.team);
|
||||
WriteString(MSG_MULTICAST, msg);
|
||||
|
||||
if (eEnt) {
|
||||
msg_entity = eEnt;
|
||||
multicast([0,0,0], MULTICAST_ONE);
|
||||
} else {
|
||||
multicast([0,0,0], MULTICAST_ALL);
|
||||
}
|
||||
|
||||
localcmd(sprintf("echo [SERVER] %s: %s\n", sender.netname, msg));
|
||||
}
|
||||
|
||||
/* client cmd overrides happen here */
|
||||
void
|
||||
Game_ParseClientCommand(string cmd)
|
||||
|
@ -67,18 +47,5 @@ Game_ParseClientCommand(string cmd)
|
|||
return;
|
||||
}
|
||||
|
||||
if (argv(0) == "say") {
|
||||
SV_SendChat(self, argv(1), world, 0);
|
||||
return;
|
||||
} else if (argv(0) == "say_team") {
|
||||
entity a;
|
||||
for (a = world; (a = find(a, ::classname, "player"));) {
|
||||
if (a.team == self.team) {
|
||||
SV_SendChat(self, argv(1), a, 1);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
clientcommand(self, cmd);
|
||||
}
|
||||
|
|
|
@ -1,168 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Cawthorne <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.
|
||||
*/
|
||||
|
||||
|
||||
//TAGGG - NOTE! Identical to base/src/server/damage.qc.
|
||||
// Deviate from it if needed, if not by the end, including that and wiping
|
||||
// this file will do.
|
||||
|
||||
|
||||
/* generic function that applies damage, pain and suffering */
|
||||
void
|
||||
Damage_Apply(entity t, entity c, float dmg, int w, damageType_t type)
|
||||
{
|
||||
NSClientPlayer tp = (NSClientPlayer)t;
|
||||
|
||||
CGameRules rules = (CGameRules)g_grMode;
|
||||
|
||||
/* player god mode */
|
||||
if (t.flags & FL_CLIENT && t.flags & FL_GODMODE)
|
||||
return;
|
||||
|
||||
/* already dead, please avoid recursion */
|
||||
if (t.health <= 0)
|
||||
return;
|
||||
|
||||
/* 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;
|
||||
|
||||
if (flArmor > tp.armor) {
|
||||
flArmor = tp.armor;
|
||||
flArmor *= (1/0.5);
|
||||
flNewDamage = dmg - flArmor;
|
||||
tp.armor = 0;
|
||||
} else {
|
||||
tp.armor -= flArmor;
|
||||
}
|
||||
dmg = flNewDamage;
|
||||
}
|
||||
}
|
||||
|
||||
dmg = rint(dmg);
|
||||
t.health -= dmg;
|
||||
|
||||
/* the globals... */
|
||||
g_dmg_eAttacker = c;
|
||||
g_dmg_eTarget = t;
|
||||
g_dmg_iDamage = dmg;
|
||||
g_dmg_iHitBody = trace_surface_id;
|
||||
g_dmg_iFlags = type;
|
||||
g_dmg_iWeapon = w;
|
||||
|
||||
if (dmg > 0) {
|
||||
t.dmg_take = dmg;
|
||||
t.dmg_inflictor = c;
|
||||
} 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) {
|
||||
rules.PlayerDeath((player)s);
|
||||
} else {
|
||||
s.Death();
|
||||
}
|
||||
} else {
|
||||
if (s.flags & FL_CLIENT) {
|
||||
rules.PlayerPain((player)s);
|
||||
} else {
|
||||
s.Pain();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* physical check of whether or not we can trace important parts of an ent */
|
||||
float
|
||||
Damage_CheckTrace(entity t, vector vecHitPos)
|
||||
{
|
||||
/* We're lazy. Who cares */
|
||||
if (t.solid == SOLID_BSP) {
|
||||
return (1);
|
||||
}
|
||||
|
||||
traceline(vecHitPos, t.origin, 1, self);
|
||||
if (trace_fraction == 1) {
|
||||
return (1);
|
||||
}
|
||||
traceline(vecHitPos, t.origin + [15,15,0], 1, self);
|
||||
if (trace_fraction == 1) {
|
||||
return (1);
|
||||
}
|
||||
traceline(vecHitPos, t.origin + [-15,-15,0], 1, self);
|
||||
if (trace_fraction == 1) {
|
||||
return (1);
|
||||
}
|
||||
traceline(vecHitPos, t.origin + [-15,15,0], 1, self);
|
||||
if (trace_fraction == 1) {
|
||||
return (1);
|
||||
}
|
||||
traceline(vecHitPos, t.origin + [15,-15,0], 1, self);
|
||||
if (trace_fraction == 1) {
|
||||
return (1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* even more pain and suffering, mostly used for explosives */
|
||||
void
|
||||
Damage_Radius(vector org, entity attacker, float dmg, float r, int check, int w)
|
||||
{
|
||||
float new_dmg;
|
||||
float dist;
|
||||
float diff;
|
||||
vector pos;
|
||||
|
||||
for (entity e = world; (e = findfloat(e, ::takedamage, DAMAGE_YES));) {
|
||||
pos[0] = e.absmin[0] + (0.5 * (e.absmax[0] - e.absmin[0]));
|
||||
pos[1] = e.absmin[1] + (0.5 * (e.absmax[1] - e.absmin[1]));
|
||||
pos[2] = e.absmin[2] + (0.5 * (e.absmax[2] - e.absmin[2]));
|
||||
|
||||
/* don't bother if it's not anywhere near us */
|
||||
dist = vlen(org - pos);
|
||||
if (dist > r)
|
||||
continue;
|
||||
|
||||
/* can we physically hit this thing? */
|
||||
if (check == TRUE)
|
||||
if (Damage_CheckTrace(e, org) == FALSE)
|
||||
continue;
|
||||
|
||||
/* calculate new damage values */
|
||||
diff = (r - dist) / r;
|
||||
new_dmg = rint(dmg * diff);
|
||||
|
||||
if (diff > 0) {
|
||||
Damage_Apply(e, attacker, new_dmg, w, DMG_EXPLODE);
|
||||
|
||||
/* approximate, feel free to tweak */
|
||||
if (e.movetype == MOVETYPE_WALK) {
|
||||
makevectors(vectoangles(e.origin - org));
|
||||
e.velocity += v_forward * (new_dmg * 5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -134,10 +134,6 @@ gamerules_multiplayer.qc
|
|||
client.qc
|
||||
init.qc
|
||||
|
||||
// NOPE! Using our own copy now
|
||||
//../../../base/src/server/damage.qc
|
||||
damage.qc
|
||||
|
||||
../../../base/src/server/modelevent.qc
|
||||
|
||||
spawn.qc
|
||||
|
|
Loading…
Reference in a new issue