Apply the new animation attributes to our Rewolf player class

This commit is contained in:
Marco Cawthorne 2021-05-07 13:34:31 +02:00
parent c2b342e6bb
commit 7d5c9e3e28
4 changed files with 58 additions and 19 deletions

View file

@ -24,3 +24,10 @@ ClientGame_EntityUpdate(float id, float new)
return TRUE;
}
void
ClientGame_EntityRemove(void)
{
if (self.classname == "player")
Player_DestroyWeaponModel((base_player) self);
}

View file

@ -114,7 +114,6 @@ HLGameRules::LevelNewParms(void)
void
HLGameRules::PlayerPostFrame(base_player pp)
{
Animation_PlayerUpdate();
}
void

View file

@ -11,7 +11,7 @@ player.qc
../../../valve/src/shared/fx_breakmodel.qc
../../../valve/src/shared/fx_explosion.qc
../../../valve/src/shared/fx_gibhuman.qc
../../../valve/src/shared/fx_spark.qc
../../../base/src/shared/fx_spark.qc
../../../valve/src/shared/fx_impact.qc
items.h

View file

@ -33,8 +33,8 @@ enumflags
PLAYER_ARMOR,
PLAYER_MOVETYPE,
PLAYER_VIEWOFS,
PLAYER_BASEFRAME,
PLAYER_FRAME,
PLAYER_TOPFRAME,
PLAYER_BOTTOMFRAME,
PLAYER_AMMO1,
PLAYER_AMMO2,
PLAYER_AMMO3,
@ -75,6 +75,12 @@ class player:base_player
int menu_active; int menu_active_net;
int dml_state; int dml_state_net;
float anim_top; float anim_top_net;
float anim_top_time; float anim_top_time_net;
float anim_top_delay; float anim_top_delay_net;
float anim_bottom; float anim_bottom_net;
float anim_bottom_time; float anim_bottom_time_net;
#ifdef CLIENT
/* External model */
entity p_model;
@ -82,7 +88,6 @@ class player:base_player
int p_model_bone;
float lastweapon;
virtual void(void) gun_offset;
virtual void(void) draw;
virtual float() predraw;
virtual void(void) postdraw;
@ -158,12 +163,16 @@ player::ReceiveEntity(float new)
movetype = readbyte();
if (fl & PLAYER_VIEWOFS)
view_ofs[2] = readfloat();
if (fl & PLAYER_BASEFRAME)
baseframe = readbyte();
if (fl & PLAYER_FRAME) {
frame = readbyte();
frame1time = 0.0f;
frame2time = 0.0f;
/* animation */
if (fl & PLAYER_TOPFRAME) {
anim_top = readbyte();
anim_top_time = readfloat();
anim_top_delay = readfloat();
}
if (fl & PLAYER_BOTTOMFRAME) {
anim_bottom = readbyte();
anim_bottom_time = readfloat();
}
if (fl & PLAYER_AMMO1) {
@ -244,6 +253,12 @@ player::PredictPreFrame(void)
gren_payload_net = gren_payload; /* cluster, explosive */
menu_active_net = menu_active;
dml_state_net = dml_state;
anim_top_net = anim_top;
anim_top_delay_net = anim_top_delay;
anim_top_time_net = anim_top_time;
anim_bottom_net = anim_bottom;
anim_bottom_time_net = anim_bottom_time;
}
/*
@ -282,6 +297,12 @@ player::PredictPostFrame(void)
gren_detonate = gren_detonate_net; /* when tripped (tripmine), timed, on impact */
gren_payload = gren_payload_net; /* cluster, explosive */
menu_active = menu_active_net;
anim_top = anim_top_net;
anim_top_delay = anim_top_delay_net;
anim_top_time = anim_top_time_net;
anim_bottom = anim_bottom_net;
anim_bottom_time = anim_bottom_time_net;
}
#else
@ -344,11 +365,17 @@ player::EvaluateEntity(void)
if (old_viewofs != view_ofs[2])
SendFlags |= PLAYER_VIEWOFS;
if (old_baseframe != baseframe)
SendFlags |= PLAYER_BASEFRAME;
/* animation */
if (anim_bottom_net != anim_bottom || anim_bottom_time != anim_bottom_time_net)
SendFlags |= PLAYER_BOTTOMFRAME;
if (anim_top_net != anim_top || anim_top_time != anim_top_time_net || anim_top_delay != anim_top_delay_net)
SendFlags |= PLAYER_TOPFRAME;
if (old_frame != frame)
SendFlags |= PLAYER_FRAME;
anim_top_net = anim_top;
anim_top_delay_net = anim_top_delay;
anim_top_time_net = anim_top_time;
anim_bottom_net = anim_bottom;
anim_bottom_time_net = anim_bottom_time;
/* ammo 1 type updates */
if (ammo_battery_net == ammo_battery)
@ -515,10 +542,16 @@ player::SendEntity(entity ePEnt, float fChanged)
WriteByte(MSG_ENTITY, movetype);
if (fChanged & PLAYER_VIEWOFS)
WriteFloat(MSG_ENTITY, view_ofs[2]);
if (fChanged & PLAYER_BASEFRAME)
WriteByte(MSG_ENTITY, baseframe);
if (fChanged & PLAYER_FRAME)
WriteByte(MSG_ENTITY, frame);
if (fChanged & PLAYER_TOPFRAME) {
WriteByte(MSG_ENTITY, anim_top);
WriteFloat(MSG_ENTITY, anim_top_time);
WriteFloat(MSG_ENTITY, anim_top_delay);
}
if (fChanged & PLAYER_BOTTOMFRAME) {
WriteByte(MSG_ENTITY, anim_bottom);
WriteFloat(MSG_ENTITY, anim_bottom_time);
}
if (fChanged & PLAYER_AMMO1) {
WriteByte(MSG_ENTITY, ammo_battery);