Rebase player.qc

This commit is contained in:
Xylemon 2023-04-26 22:33:55 -07:00
parent c545731ac6
commit 095b761a6f

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2016-2023 Marco Cawthorne <marco@icculus.org> * Copyright (c) 2016-2021 Marco Cawthorne <marco@icculus.org>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -97,7 +97,7 @@ string g_pbones[] =
}; };
#endif #endif
/* all potential SendFlags bits we can possibly send */ /* all custom SendFlags bits we can possibly send */
enumflags enumflags
{ {
PLAYER_TOPFRAME = PLAYER_CUSTOMFIELDSTART, PLAYER_TOPFRAME = PLAYER_CUSTOMFIELDSTART,
@ -112,7 +112,16 @@ enumflags
class player:NSClientPlayer class player:NSClientPlayer
{ {
/* Weapon specific */ void(void) player;
/* animation */
PREDICTED_INT(anim_top)
PREDICTED_FLOAT(anim_top_time)
PREDICTED_FLOAT(anim_top_delay)
PREDICTED_INT(anim_bottom)
PREDICTED_FLOAT(anim_bottom_time)
/* ammo 1 */
PREDICTED_INT(glock_mag) PREDICTED_INT(glock_mag)
PREDICTED_INT(mp5_mag) PREDICTED_INT(mp5_mag)
PREDICTED_INT(python_mag) PREDICTED_INT(python_mag)
@ -122,6 +131,7 @@ class player:NSClientPlayer
PREDICTED_INT(satchel_chg) PREDICTED_INT(satchel_chg)
PREDICTED_INT(cannon_mag) PREDICTED_INT(cannon_mag)
/* ammo 2 */
PREDICTED_INT(ammo_9mm) PREDICTED_INT(ammo_9mm)
PREDICTED_INT(ammo_357) PREDICTED_INT(ammo_357)
PREDICTED_INT(ammo_buckshot) PREDICTED_INT(ammo_buckshot)
@ -134,44 +144,45 @@ class player:NSClientPlayer
PREDICTED_INT(ammo_snark) PREDICTED_INT(ammo_snark)
PREDICTED_INT(ammo_hornet) PREDICTED_INT(ammo_hornet)
/* ammo 3 */
PREDICTED_INT(ammo_m203_grenade) PREDICTED_INT(ammo_m203_grenade)
PREDICTED_INT(ammo_shotgun_state)
PREDICTED_INT(ammo_gauss_state)
PREDICTED_INT(ammo_gauss_volume) PREDICTED_INT(ammo_gauss_volume)
PREDICTED_INT(ammo_egon_state)
PREDICTED_INT(ammo_rpg_state) PREDICTED_INT(ammo_rpg_state)
PREDICTED_INT(mode_tempstate) PREDICTED_INT(mode_tempstate)
PREDICTED_INT(ammo_chainsaw_state) PREDICTED_INT(ammo_chainsaw_state)
PREDICTED_INT(ammo_hammer_state) PREDICTED_INT(ammo_hammer_state)
/* insanity */
PREDICTED_FLOAT(sh_insanetime) PREDICTED_FLOAT(sh_insanetime)
PREDICTED_FLOAT(sh_insaneactive) PREDICTED_FLOAT(sh_insaneactive)
PREDICTED_FLOAT(anim_top)
PREDICTED_FLOAT(anim_top_time)
PREDICTED_FLOAT(anim_top_delay)
PREDICTED_FLOAT(anim_bottom)
PREDICTED_FLOAT(anim_bottom_time)
virtual void Physics_Jump(void);
virtual void UpdatePlayerAnimation(float); virtual void UpdatePlayerAnimation(float);
/* insanity overrides */
virtual float Physics_MaxSpeed(void); virtual float Physics_MaxSpeed(void);
virtual void Physics_InputPreMove(void); virtual void Physics_InputPreMove(void);
virtual void Physics_InputPostMove(void); virtual void Physics_InputPostMove(void);
#ifdef CLIENT #ifdef CLIENT
////virtual void(void) draw;
//virtual float() predraw;
//virtual void(void) postdraw;
virtual void UpdatePlayerAttachments(bool); virtual void UpdatePlayerAttachments(bool);
virtual void(float,float) ReceiveEntity; virtual void ReceiveEntity(float,float);
virtual void(void) PredictPreFrame; virtual void PredictPreFrame(void);
virtual void(void) PredictPostFrame; virtual void PredictPostFrame(void);
virtual void UpdateAliveCam(void);
#else #else
virtual void(void) EvaluateEntity; virtual void EvaluateEntity(void);
virtual float(entity, float) SendEntity; virtual float SendEntity(entity, float);
virtual void Save(float);
virtual void Restore(string,string);
int sh_insanecount; int sh_insanecount;
#endif #endif
}; };
void Animation_PlayerUpdate(player); void Animation_PlayerUpdate(player);
void Animation_TimerUpdate(player, float); void Animation_TimerUpdate(player, float);
@ -185,6 +196,39 @@ player::UpdatePlayerAnimation(float timelength)
} }
#ifdef CLIENT #ifdef CLIENT
void Camera_RunPosBob(vector angles, __inout vector camera_pos);
void Camera_StrafeRoll(__inout vector camera_angle);
void Shake_Update(NSClientPlayer);
void
player::UpdateAliveCam(void)
{
vector cam_pos = GetEyePos();
Camera_RunPosBob(view_angles, cam_pos);
g_view.SetCameraOrigin(cam_pos);
Camera_StrafeRoll(view_angles);
g_view.SetCameraAngle(view_angles);
if (vehicle) {
NSVehicle veh = (NSVehicle)vehicle;
if (veh.UpdateView)
veh.UpdateView();
} else if (health) {
if (autocvar_pm_thirdPerson == TRUE) {
makevectors(view_angles);
vector vStart = [pSeat->m_vecPredictedOrigin[0], pSeat->m_vecPredictedOrigin[1], pSeat->m_vecPredictedOrigin[2] + 16] + (v_right * 4);
vector vEnd = vStart + (v_forward * -48) + [0,0,16] + (v_right * 4);
traceline(vStart, vEnd, FALSE, this);
g_view.SetCameraOrigin(trace_endpos + (v_forward * 5));
}
}
Shake_Update(this);
g_view.AddPunchAngle(punchangle);
}
.string oldmodel; .string oldmodel;
string Weapons_GetPlayermodel(player, int); string Weapons_GetPlayermodel(player, int);
@ -275,59 +319,47 @@ player::ReceiveEntity
================= =================
*/ */
void void
player::ReceiveEntity(float new, float fl) player::ReceiveEntity(float new, float flChanged)
{ {
NSClientPlayer::ReceiveEntity(new, fl); /* the generic client attributes */
NSClientPlayer::ReceiveEntity(new, flChanged);
/* animation */ /* animation */
if (fl & PLAYER_TOPFRAME) { READENTITY_BYTE(anim_top, PLAYER_TOPFRAME)
anim_top = readbyte(); READENTITY_FLOAT(anim_top_time, PLAYER_TOPFRAME)
anim_top_time = readfloat(); READENTITY_FLOAT(anim_top_delay, PLAYER_TOPFRAME)
anim_top_delay = readfloat(); READENTITY_BYTE(anim_bottom, PLAYER_BOTTOMFRAME)
} READENTITY_FLOAT(anim_bottom_time, PLAYER_BOTTOMFRAME)
if (fl & PLAYER_BOTTOMFRAME) {
anim_bottom = readbyte();
anim_bottom_time = readfloat();
}
if (fl & PLAYER_AMMO1) { READENTITY_BYTE(glock_mag, PLAYER_AMMO1)
glock_mag = readbyte(); READENTITY_BYTE(mp5_mag, PLAYER_AMMO1)
mp5_mag = readbyte(); READENTITY_BYTE(python_mag, PLAYER_AMMO1)
python_mag = readbyte(); READENTITY_BYTE(shotgun_mag, PLAYER_AMMO1)
shotgun_mag = readbyte(); READENTITY_BYTE(crossbow_mag, PLAYER_AMMO1)
crossbow_mag = readbyte(); READENTITY_BYTE(rpg_mag, PLAYER_AMMO1)
rpg_mag = readbyte(); READENTITY_BYTE(satchel_chg, PLAYER_AMMO1)
satchel_chg = readbyte(); READENTITY_BYTE(cannon_mag, PLAYER_AMMO1)
cannon_mag = readbyte();
}
if (fl & PLAYER_AMMO2) { READENTITY_BYTE(ammo_9mm, PLAYER_AMMO2)
ammo_9mm = readbyte(); READENTITY_BYTE(ammo_357, PLAYER_AMMO2)
ammo_357 = readbyte(); READENTITY_BYTE(ammo_buckshot, PLAYER_AMMO2)
ammo_buckshot = readbyte(); READENTITY_BYTE(ammo_bolt, PLAYER_AMMO2)
ammo_bolt = readbyte(); READENTITY_BYTE(ammo_rocket, PLAYER_AMMO2)
ammo_rocket = readbyte(); READENTITY_BYTE(ammo_uranium, PLAYER_AMMO2)
ammo_uranium = readbyte(); READENTITY_BYTE(ammo_handgrenade, PLAYER_AMMO2)
ammo_handgrenade = readbyte(); READENTITY_BYTE(ammo_satchel, PLAYER_AMMO2)
ammo_satchel = readbyte(); READENTITY_BYTE(ammo_tripmine, PLAYER_AMMO2)
ammo_tripmine = readbyte(); READENTITY_BYTE(ammo_snark, PLAYER_AMMO2)
ammo_snark = readbyte(); READENTITY_BYTE(ammo_hornet, PLAYER_AMMO2)
ammo_hornet = readbyte();
}
if (fl & PLAYER_AMMO3) { READENTITY_BYTE(ammo_m203_grenade, PLAYER_AMMO3)
ammo_m203_grenade = readbyte(); READENTITY_BYTE(ammo_gauss_volume, PLAYER_AMMO3)
ammo_shotgun_state = readbyte(); READENTITY_BYTE(ammo_rpg_state, PLAYER_AMMO3)
ammo_gauss_state = readbyte(); READENTITY_BYTE(mode_tempstate, PLAYER_AMMO3)
ammo_gauss_volume = readbyte(); READENTITY_BYTE(ammo_chainsaw_state, PLAYER_AMMO3)
ammo_egon_state = readbyte(); READENTITY_BYTE(ammo_hammer_state, PLAYER_AMMO3)
ammo_rpg_state = readbyte(); READENTITY_FLOAT(sh_insanetime, PLAYER_AMMO3)
mode_tempstate = readbyte(); READENTITY_FLOAT(sh_insaneactive, PLAYER_AMMO3)
ammo_chainsaw_state = readbyte();
ammo_hammer_state = readbyte();
sh_insanetime = readfloat();
sh_insaneactive = readfloat();
}
setorigin(this, origin); setorigin(this, origin);
@ -337,15 +369,15 @@ player::ReceiveEntity(float new, float fl)
return; return;
/* do not notify us of updates when spawning initially */ /* do not notify us of updates when spawning initially */
if (fl == UPDATE_ALL) if (flChanged == UPDATE_ALL)
PredictPreFrame(); PredictPreFrame();
if (fl & PLAYER_AMMO1 || fl & PLAYER_AMMO2 || fl & PLAYER_AMMO3) { if (flChanged & PLAYER_AMMO1 || flChanged & PLAYER_AMMO2 || flChanged & PLAYER_AMMO3) {
Weapons_AmmoUpdate(this); Weapons_AmmoUpdate(this);
HUD_AmmoNotify_Check(this); HUD_AmmoNotify_Check(this);
} }
if (fl & PLAYER_ITEMS || fl & PLAYER_HEALTH) if (flChanged & PLAYER_ITEMS || flChanged & PLAYER_HEALTH)
HUD_ItemNotify_Check(this); HUD_ItemNotify_Check(this);
} }
@ -360,8 +392,15 @@ so we can roll them back later.
void void
player::PredictPreFrame(void) player::PredictPreFrame(void)
{ {
/* the generic client attributes */
NSClientPlayer::PredictPreFrame(); NSClientPlayer::PredictPreFrame();
SAVE_STATE(anim_top)
SAVE_STATE(anim_top_delay)
SAVE_STATE(anim_top_time)
SAVE_STATE(anim_bottom)
SAVE_STATE(anim_bottom_time)
SAVE_STATE(glock_mag) SAVE_STATE(glock_mag)
SAVE_STATE(mp5_mag) SAVE_STATE(mp5_mag)
SAVE_STATE(python_mag) SAVE_STATE(python_mag)
@ -384,20 +423,11 @@ player::PredictPreFrame(void)
SAVE_STATE(ammo_hornet) SAVE_STATE(ammo_hornet)
SAVE_STATE(ammo_m203_grenade) SAVE_STATE(ammo_m203_grenade)
SAVE_STATE(ammo_shotgun_state)
SAVE_STATE(ammo_gauss_state)
SAVE_STATE(ammo_gauss_volume) SAVE_STATE(ammo_gauss_volume)
SAVE_STATE(ammo_egon_state)
SAVE_STATE(ammo_rpg_state) SAVE_STATE(ammo_rpg_state)
SAVE_STATE(mode_tempstate) SAVE_STATE(mode_tempstate)
SAVE_STATE(ammo_chainsaw_state) SAVE_STATE(ammo_chainsaw_state)
SAVE_STATE(ammo_hammer_state) SAVE_STATE(ammo_hammer_state)
SAVE_STATE(anim_top)
SAVE_STATE(anim_top_time)
SAVE_STATE(anim_top_delay)
SAVE_STATE(anim_bottom)
SAVE_STATE(anim_bottom_time)
} }
/* /*
@ -410,8 +440,15 @@ Where we roll back our values to the ones last sent/verified by the server.
void void
player::PredictPostFrame(void) player::PredictPostFrame(void)
{ {
/* the generic client attributes */
NSClientPlayer::PredictPostFrame(); NSClientPlayer::PredictPostFrame();
ROLL_BACK(anim_top)
ROLL_BACK(anim_top_delay)
ROLL_BACK(anim_top_time)
ROLL_BACK(anim_bottom)
ROLL_BACK(anim_bottom_time)
ROLL_BACK(glock_mag) ROLL_BACK(glock_mag)
ROLL_BACK(mp5_mag) ROLL_BACK(mp5_mag)
ROLL_BACK(python_mag) ROLL_BACK(python_mag)
@ -424,6 +461,7 @@ player::PredictPostFrame(void)
ROLL_BACK(ammo_9mm) ROLL_BACK(ammo_9mm)
ROLL_BACK(ammo_357) ROLL_BACK(ammo_357)
ROLL_BACK(ammo_buckshot) ROLL_BACK(ammo_buckshot)
ROLL_BACK(ammo_m203_grenade)
ROLL_BACK(ammo_bolt) ROLL_BACK(ammo_bolt)
ROLL_BACK(ammo_rocket) ROLL_BACK(ammo_rocket)
ROLL_BACK(ammo_uranium) ROLL_BACK(ammo_uranium)
@ -434,136 +472,210 @@ player::PredictPostFrame(void)
ROLL_BACK(ammo_hornet) ROLL_BACK(ammo_hornet)
ROLL_BACK(ammo_m203_grenade) ROLL_BACK(ammo_m203_grenade)
ROLL_BACK(ammo_shotgun_state)
ROLL_BACK(ammo_gauss_state)
ROLL_BACK(ammo_gauss_volume) ROLL_BACK(ammo_gauss_volume)
ROLL_BACK(ammo_egon_state)
ROLL_BACK(ammo_rpg_state) ROLL_BACK(ammo_rpg_state)
ROLL_BACK(mode_tempstate) ROLL_BACK(mode_tempstate)
ROLL_BACK(ammo_chainsaw_state) ROLL_BACK(ammo_chainsaw_state)
ROLL_BACK(ammo_hammer_state) ROLL_BACK(ammo_hammer_state)
ROLL_BACK(anim_top)
ROLL_BACK(anim_top_time)
ROLL_BACK(anim_top_delay)
ROLL_BACK(anim_bottom)
ROLL_BACK(anim_bottom_time)
} }
#else #else
void
player::Save(float handle)
{
super::Save(handle);
SaveInt(handle, "anim_top", anim_top);
SaveFloat(handle, "anim_top_time", anim_top_time);
SaveFloat(handle, "anim_top_delay", anim_top_delay);
SaveInt(handle, "anim_bottom", anim_bottom);
SaveFloat(handle, "anim_bottom_time", anim_bottom_time);
/* ammo 1 */
SaveInt(handle, "glock_mag", glock_mag);
SaveInt(handle, "mp5_mag", mp5_mag);
SaveInt(handle, "python_mag", python_mag);
SaveInt(handle, "shotgun_mag", shotgun_mag);
SaveInt(handle, "crossbow_mag", crossbow_mag);
SaveInt(handle, "rpg_mag", rpg_mag);
SaveInt(handle, "satchel_chg", satchel_chg);
SaveInt(handle, "cannon_mag", satchel_chg);
/* ammo 2 */
SaveInt(handle, "ammo_9mm", ammo_9mm);
SaveInt(handle, "ammo_357", ammo_357);
SaveInt(handle, "ammo_buckshot", ammo_buckshot);
SaveInt(handle, "ammo_bolt", ammo_bolt);
SaveInt(handle, "ammo_rocket", ammo_rocket);
SaveInt(handle, "ammo_uranium", ammo_uranium);
SaveInt(handle, "ammo_handgrenade", ammo_handgrenade);
SaveInt(handle, "ammo_satchel", ammo_satchel);
SaveInt(handle, "ammo_tripmine", ammo_tripmine);
SaveInt(handle, "ammo_snark", ammo_snark);
SaveInt(handle, "ammo_hornet", ammo_hornet);
/* ammo 3 */
SaveInt(handle, "ammo_m203_grenade", ammo_m203_grenade);
SaveInt(handle, "ammo_gauss_volume", ammo_gauss_volume);
SaveInt(handle, "ammo_rpg_state", ammo_rpg_state);
SaveInt(handle, "mode_tempstate", mode_tempstate);
SaveInt(handle, "ammo_chainsaw_state", ammo_chainsaw_state);
SaveInt(handle, "ammo_hammer_state", ammo_hammer_state);
/* insanity */
SaveFloat(handle, "sh_insanetime", sh_insanetime);
SaveFloat(handle, "sh_insaneactive", sh_insaneactive);
}
void
player::Restore(string strKey, string strValue)
{
switch (strKey) {
case "anim_top":
anim_top = ReadInt(strValue);
break;
case "anim_top_time":
anim_top_time = ReadFloat(strValue);
break;
case "anim_top_delay":
anim_top_delay = ReadFloat(strValue);
break;
case "anim_bottom":
anim_bottom = ReadInt(strValue);
break;
case "anim_bottom_time":
anim_bottom_time = ReadFloat(strValue);
break;
/* AMMO 1 */
case "glock_mag":
glock_mag = ReadInt(strValue);
break;
case "mp5_mag":
mp5_mag = ReadInt(strValue);
break;
case "python_mag":
python_mag = ReadInt(strValue);
break;
case "shotgun_mag":
shotgun_mag = ReadInt(strValue);
break;
case "crossbow_mag":
crossbow_mag = ReadInt(strValue);
break;
case "rpg_mag":
rpg_mag = ReadInt(strValue);
break;
case "satchel_chg":
satchel_chg = ReadInt(strValue);
break;
case "cannon_mag":
satchel_chg = ReadInt(strValue);
break;
/* AMMO 2 */
case "ammo_9mm":
ammo_9mm = ReadInt(strValue);
break;
case "ammo_357":
ammo_357 = ReadInt(strValue);
break;
case "ammo_buckshot":
ammo_buckshot = ReadInt(strValue);
break;
case "ammo_bolt":
ammo_bolt = ReadInt(strValue);
break;
case "ammo_rocket":
ammo_rocket = ReadInt(strValue);
break;
case "ammo_uranium":
ammo_uranium = ReadInt(strValue);
break;
case "ammo_handgrenade":
ammo_handgrenade = ReadInt(strValue);
break;
case "ammo_satchel":
ammo_satchel = ReadInt(strValue);
break;
case "ammo_tripmine":
ammo_tripmine = ReadInt(strValue);
break;
case "ammo_snark":
ammo_snark = ReadInt(strValue);
break;
case "ammo_hornet":
ammo_hornet = ReadInt(strValue);
break;
/* AMMO 3 */
case "ammo_m203_grenade":
ammo_m203_grenade = ReadInt(strValue);
break;
case "ammo_gauss_volume":
ammo_gauss_volume = ReadInt(strValue);
break;
case "ammo_rpg_state":
ammo_rpg_state = ReadInt(strValue);
break;
case "mode_tempstate":
mode_tempstate = ReadInt(strValue);
break;
case "ammo_chainsaw_state":
ammo_chainsaw_state = ReadInt(strValue);
break;
case "ammo_hammer_state":
ammo_hammer_state = ReadInt(strValue);
break;
case "sh_insanetime":
sh_insanetime = ReadFloat(strValue);
break;
case "sh_insaneactive":
sh_insaneactive = ReadFloat(strValue);
break;
default:
super::Restore(strKey, strValue);
}
}
void void
player::EvaluateEntity(void) player::EvaluateEntity(void)
{ {
/* the generic client attributes */
NSClientPlayer::EvaluateEntity(); NSClientPlayer::EvaluateEntity();
/* animation */ EVALUATE_FIELD(anim_top, PLAYER_TOPFRAME)
if (anim_bottom_net != anim_bottom || anim_bottom_time != anim_bottom_time_net) EVALUATE_FIELD(anim_top_time, PLAYER_TOPFRAME)
SendFlags |= PLAYER_BOTTOMFRAME; EVALUATE_FIELD(anim_top_delay, PLAYER_TOPFRAME)
if (anim_top_net != anim_top || anim_top_time != anim_top_time_net || anim_top_delay != anim_top_delay_net) EVALUATE_FIELD(anim_bottom, PLAYER_BOTTOMFRAME)
SendFlags |= PLAYER_TOPFRAME; EVALUATE_FIELD(anim_bottom_time, PLAYER_BOTTOMFRAME)
/* ammo 1 type updates */ EVALUATE_FIELD(glock_mag, PLAYER_AMMO1)
if (ATTR_CHANGED(glock_mag)) EVALUATE_FIELD(mp5_mag, PLAYER_AMMO1)
SendFlags |= PLAYER_AMMO1; EVALUATE_FIELD(python_mag, PLAYER_AMMO1)
else if (ATTR_CHANGED(mp5_mag)) EVALUATE_FIELD(shotgun_mag, PLAYER_AMMO1)
SendFlags |= PLAYER_AMMO1; EVALUATE_FIELD(crossbow_mag, PLAYER_AMMO1)
else if (ATTR_CHANGED(python_mag)) EVALUATE_FIELD(rpg_mag, PLAYER_AMMO1)
SendFlags |= PLAYER_AMMO1; EVALUATE_FIELD(satchel_chg, PLAYER_AMMO1)
else if (ATTR_CHANGED(shotgun_mag)) EVALUATE_FIELD(cannon_mag, PLAYER_AMMO1)
SendFlags |= PLAYER_AMMO1;
else if (ATTR_CHANGED(crossbow_mag))
SendFlags |= PLAYER_AMMO1;
else if (ATTR_CHANGED(rpg_mag))
SendFlags |= PLAYER_AMMO1;
else if (ATTR_CHANGED(satchel_chg))
SendFlags |= PLAYER_AMMO1;
else if (ATTR_CHANGED(cannon_mag))
SendFlags |= PLAYER_AMMO1;
/* ammo 2 type updates */ EVALUATE_FIELD(ammo_9mm, PLAYER_AMMO2)
if (ATTR_CHANGED(ammo_9mm)) EVALUATE_FIELD(ammo_357, PLAYER_AMMO2)
SendFlags |= PLAYER_AMMO2; EVALUATE_FIELD(ammo_buckshot, PLAYER_AMMO2)
else if (ATTR_CHANGED(ammo_357)) EVALUATE_FIELD(ammo_bolt, PLAYER_AMMO2)
SendFlags |= PLAYER_AMMO2; EVALUATE_FIELD(ammo_rocket, PLAYER_AMMO2)
else if (ATTR_CHANGED(ammo_buckshot)) EVALUATE_FIELD(ammo_uranium, PLAYER_AMMO2)
SendFlags |= PLAYER_AMMO2; EVALUATE_FIELD(ammo_handgrenade, PLAYER_AMMO2)
else if (ATTR_CHANGED(ammo_bolt)) EVALUATE_FIELD(ammo_satchel, PLAYER_AMMO2)
SendFlags |= PLAYER_AMMO2; EVALUATE_FIELD(ammo_tripmine, PLAYER_AMMO2)
else if (ATTR_CHANGED(ammo_rocket)) EVALUATE_FIELD(ammo_snark, PLAYER_AMMO2)
SendFlags |= PLAYER_AMMO2; EVALUATE_FIELD(ammo_hornet, PLAYER_AMMO2)
else if (ATTR_CHANGED(ammo_uranium))
SendFlags |= PLAYER_AMMO2;
else if (ATTR_CHANGED(ammo_handgrenade))
SendFlags |= PLAYER_AMMO2;
else if (ATTR_CHANGED(ammo_satchel))
SendFlags |= PLAYER_AMMO2;
else if (ATTR_CHANGED(ammo_tripmine))
SendFlags |= PLAYER_AMMO2;
else if (ATTR_CHANGED(ammo_snark))
SendFlags |= PLAYER_AMMO2;
else if (ATTR_CHANGED(ammo_hornet))
SendFlags |= PLAYER_AMMO2;
/* ammo 3 type updates */ EVALUATE_FIELD(ammo_m203_grenade, PLAYER_AMMO3)
if (ATTR_CHANGED(ammo_m203_grenade)) EVALUATE_FIELD(ammo_gauss_volume, PLAYER_AMMO3)
SendFlags |= PLAYER_AMMO3; EVALUATE_FIELD(ammo_rpg_state, PLAYER_AMMO3)
else if (ATTR_CHANGED(ammo_shotgun_state)) EVALUATE_FIELD(mode_tempstate, PLAYER_AMMO3)
SendFlags |= PLAYER_AMMO3; EVALUATE_FIELD(ammo_chainsaw_state, PLAYER_AMMO3)
else if (ATTR_CHANGED(ammo_gauss_state)) EVALUATE_FIELD(ammo_hammer_state, PLAYER_AMMO3)
SendFlags |= PLAYER_AMMO3; EVALUATE_FIELD(sh_insanetime, PLAYER_AMMO3)
else if (ATTR_CHANGED(ammo_gauss_volume)) EVALUATE_FIELD(sh_insaneactive, PLAYER_AMMO3)
SendFlags |= PLAYER_AMMO3;
else if (ATTR_CHANGED(ammo_egon_state))
SendFlags |= PLAYER_AMMO3;
else if (ATTR_CHANGED(ammo_rpg_state))
SendFlags |= PLAYER_AMMO3;
else if (ATTR_CHANGED(mode_tempstate))
SendFlags |= PLAYER_AMMO3;
else if (ATTR_CHANGED(ammo_chainsaw_state))
SendFlags |= PLAYER_AMMO3;
else if (ATTR_CHANGED(ammo_hammer_state))
SendFlags |= PLAYER_AMMO3;
else if (ATTR_CHANGED(sh_insanetime))
SendFlags |= PLAYER_AMMO3;
else if (ATTR_CHANGED(sh_insaneactive))
SendFlags |= PLAYER_AMMO3;
SAVE_STATE(glock_mag)
SAVE_STATE(mp5_mag)
SAVE_STATE(python_mag)
SAVE_STATE(shotgun_mag)
SAVE_STATE(crossbow_mag)
SAVE_STATE(rpg_mag)
SAVE_STATE(satchel_chg)
SAVE_STATE(cannon_mag)
SAVE_STATE(ammo_9mm)
SAVE_STATE(ammo_357)
SAVE_STATE(ammo_buckshot)
SAVE_STATE(ammo_bolt)
SAVE_STATE(ammo_rocket)
SAVE_STATE(ammo_uranium)
SAVE_STATE(ammo_handgrenade)
SAVE_STATE(ammo_satchel)
SAVE_STATE(ammo_tripmine)
SAVE_STATE(ammo_snark)
SAVE_STATE(ammo_hornet)
SAVE_STATE(ammo_m203_grenade)
SAVE_STATE(ammo_shotgun_state)
SAVE_STATE(ammo_gauss_state)
SAVE_STATE(ammo_gauss_volume)
SAVE_STATE(ammo_egon_state)
SAVE_STATE(ammo_rpg_state)
SAVE_STATE(mode_tempstate)
SAVE_STATE(ammo_chainsaw_state)
SAVE_STATE(ammo_hammer_state)
SAVE_STATE(anim_top)
SAVE_STATE(anim_top_time)
SAVE_STATE(anim_top_delay)
SAVE_STATE(anim_bottom)
SAVE_STATE(anim_bottom_time)
} }
/* /*
@ -585,57 +697,82 @@ player::SendEntity(entity ePEnt, float flChanged)
WriteByte(MSG_ENTITY, ENT_PLAYER); WriteByte(MSG_ENTITY, ENT_PLAYER);
WriteFloat(MSG_ENTITY, flChanged); WriteFloat(MSG_ENTITY, flChanged);
/* the generic client attributes */
NSClientPlayer::SendEntity(ePEnt, flChanged); NSClientPlayer::SendEntity(ePEnt, flChanged);
if (flChanged & PLAYER_TOPFRAME) { SENDENTITY_BYTE(anim_top, PLAYER_TOPFRAME)
WriteByte(MSG_ENTITY, anim_top); SENDENTITY_FLOAT(anim_top_time, PLAYER_TOPFRAME)
WriteFloat(MSG_ENTITY, anim_top_time); SENDENTITY_FLOAT(anim_top_delay, PLAYER_TOPFRAME)
WriteFloat(MSG_ENTITY, anim_top_delay); SENDENTITY_BYTE(anim_bottom, PLAYER_BOTTOMFRAME)
} SENDENTITY_FLOAT(anim_bottom_time, PLAYER_BOTTOMFRAME)
if (flChanged & PLAYER_BOTTOMFRAME) {
WriteByte(MSG_ENTITY, anim_bottom);
WriteFloat(MSG_ENTITY, anim_bottom_time);
}
if (flChanged & PLAYER_AMMO1) { SENDENTITY_BYTE(glock_mag, PLAYER_AMMO1)
WriteByte(MSG_ENTITY, glock_mag); SENDENTITY_BYTE(mp5_mag, PLAYER_AMMO1)
WriteByte(MSG_ENTITY, mp5_mag); SENDENTITY_BYTE(python_mag, PLAYER_AMMO1)
WriteByte(MSG_ENTITY, python_mag); SENDENTITY_BYTE(shotgun_mag, PLAYER_AMMO1)
WriteByte(MSG_ENTITY, shotgun_mag); SENDENTITY_BYTE(crossbow_mag, PLAYER_AMMO1)
WriteByte(MSG_ENTITY, crossbow_mag); SENDENTITY_BYTE(rpg_mag, PLAYER_AMMO1)
WriteByte(MSG_ENTITY, rpg_mag); SENDENTITY_BYTE(satchel_chg, PLAYER_AMMO1)
WriteByte(MSG_ENTITY, satchel_chg); SENDENTITY_BYTE(cannon_mag, PLAYER_AMMO1)
WriteByte(MSG_ENTITY, cannon_mag);
}
if (flChanged & PLAYER_AMMO2) { SENDENTITY_BYTE(ammo_9mm, PLAYER_AMMO2)
WriteByte(MSG_ENTITY, ammo_9mm); SENDENTITY_BYTE(ammo_357, PLAYER_AMMO2)
WriteByte(MSG_ENTITY, ammo_357); SENDENTITY_BYTE(ammo_buckshot, PLAYER_AMMO2)
WriteByte(MSG_ENTITY, ammo_buckshot); SENDENTITY_BYTE(ammo_bolt, PLAYER_AMMO2)
WriteByte(MSG_ENTITY, ammo_bolt); SENDENTITY_BYTE(ammo_rocket, PLAYER_AMMO2)
WriteByte(MSG_ENTITY, ammo_rocket); SENDENTITY_BYTE(ammo_uranium, PLAYER_AMMO2)
WriteByte(MSG_ENTITY, ammo_uranium); SENDENTITY_BYTE(ammo_handgrenade, PLAYER_AMMO2)
WriteByte(MSG_ENTITY, ammo_handgrenade); SENDENTITY_BYTE(ammo_satchel, PLAYER_AMMO2)
WriteByte(MSG_ENTITY, ammo_satchel); SENDENTITY_BYTE(ammo_tripmine, PLAYER_AMMO2)
WriteByte(MSG_ENTITY, ammo_tripmine); SENDENTITY_BYTE(ammo_snark, PLAYER_AMMO2)
WriteByte(MSG_ENTITY, ammo_snark); SENDENTITY_BYTE(ammo_hornet, PLAYER_AMMO2)
WriteByte(MSG_ENTITY, ammo_hornet);
}
if (flChanged & PLAYER_AMMO3) { SENDENTITY_BYTE(ammo_m203_grenade, PLAYER_AMMO3)
WriteByte(MSG_ENTITY, ammo_m203_grenade); SENDENTITY_BYTE(ammo_gauss_volume, PLAYER_AMMO3)
WriteByte(MSG_ENTITY, ammo_shotgun_state); SENDENTITY_BYTE(ammo_rpg_state, PLAYER_AMMO3)
WriteByte(MSG_ENTITY, ammo_gauss_state); SENDENTITY_BYTE(mode_tempstate, PLAYER_AMMO3)
WriteByte(MSG_ENTITY, ammo_gauss_volume); SENDENTITY_BYTE(ammo_chainsaw_state, PLAYER_AMMO3)
WriteByte(MSG_ENTITY, ammo_egon_state); SENDENTITY_BYTE(ammo_hammer_state, PLAYER_AMMO3)
WriteByte(MSG_ENTITY, ammo_rpg_state); SENDENTITY_FLOAT(sh_insanetime, PLAYER_AMMO3)
WriteByte(MSG_ENTITY, mode_tempstate); SENDENTITY_FLOAT(sh_insaneactive, PLAYER_AMMO3)
WriteByte(MSG_ENTITY, ammo_chainsaw_state);
WriteByte(MSG_ENTITY, ammo_hammer_state);
WriteFloat(MSG_ENTITY, sh_insanetime);
WriteFloat(MSG_ENTITY, sh_insaneactive);
}
return (1); return (1);
} }
#endif #endif
void
player::player(void)
{
anim_top = 0;
anim_top_time = 0;
anim_top_delay = 0;
anim_bottom = 0;
anim_bottom_time = 0;
glock_mag = 0;
mp5_mag = 0;
python_mag = 0;
shotgun_mag = 0;
crossbow_mag = 0;
rpg_mag = 0;
satchel_chg = 0;
cannon_mag = 0;
ammo_9mm = 0;
ammo_357 = 0;
ammo_buckshot = 0;
ammo_bolt = 0;
ammo_rocket = 0;
ammo_uranium = 0;
ammo_handgrenade = 0;
ammo_satchel = 0;
ammo_tripmine = 0;
ammo_snark = 0;
ammo_hornet = 0;
ammo_m203_grenade = 0;
ammo_gauss_volume = 0;
ammo_rpg_state = 0;
mode_tempstate = 0;
ammo_chainsaw_state = 0;
ammo_hammer_state = 0;
sh_insanetime = 0;
sh_insaneactive = 0;
}