Player: Streamline networking code by using the new macros Nuclide provides
This commit is contained in:
parent
ab31ae0242
commit
cf50584211
|
@ -124,52 +124,42 @@ player::ReceiveEntity
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
player::ReceiveEntity(float new, float fl)
|
player::ReceiveEntity(float new, float flChanged)
|
||||||
{
|
{
|
||||||
/* the generic client attributes */
|
/* the generic client attributes */
|
||||||
NSClientPlayer::ReceiveEntity(new, fl);
|
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
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_gauss_volume = readbyte();
|
READENTITY_BYTE(ammo_rpg_state, PLAYER_AMMO3)
|
||||||
ammo_rpg_state = readbyte();
|
READENTITY_BYTE(mode_tempstate, PLAYER_AMMO3)
|
||||||
mode_tempstate = readbyte();
|
|
||||||
}
|
|
||||||
|
|
||||||
setorigin(this, origin);
|
setorigin(this, origin);
|
||||||
|
|
||||||
|
@ -179,15 +169,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,90 +413,36 @@ player::EvaluateEntity(void)
|
||||||
/* the generic client attributes */
|
/* the generic client attributes */
|
||||||
NSClientPlayer::EvaluateEntity();
|
NSClientPlayer::EvaluateEntity();
|
||||||
|
|
||||||
/* animation */
|
EVALUATE_FIELD(anim_top, PLAYER_TOPFRAME);
|
||||||
if (ATTR_CHANGED(anim_bottom) || ATTR_CHANGED(anim_bottom_time))
|
EVALUATE_FIELD(anim_top_time, PLAYER_TOPFRAME);
|
||||||
SendFlags |= PLAYER_BOTTOMFRAME;
|
EVALUATE_FIELD(anim_top_delay, PLAYER_TOPFRAME |