diff --git a/src/shared/include.src b/src/shared/include.src index 3d8901d..8b1ab51 100644 --- a/src/shared/include.src +++ b/src/shared/include.src @@ -12,7 +12,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 diff --git a/src/shared/player.qc b/src/shared/player.qc index 84e66b8..05f969d 100644 --- a/src/shared/player.qc +++ b/src/shared/player.qc @@ -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, @@ -42,45 +42,6 @@ enumflags PLAYER_UNUSED2 }; -/* ammo 1 type updates */ -enumflags -{ - AMMO1_GLOCK, - AMMO1_MP5, - AMMO1_PYTHON, - AMMO1_SHOTGUN, - AMMO1_CROSSBOW, - AMMO1_RPG, - AMMO1_SATCHEL -}; - -/* ammo 2 type updates */ -enumflags -{ - AMMO2_9MM, - AMMO2_357, - AMMO2_BUCKSHOT, - AMMO2_BOLT, - AMMO2_ROCKET, - AMMO2_URANIUM, - AMMO2_HANDGRENADE, - AMMO2_SATCHEL, - AMMO2_TRIPMINE, - AMMO2_SNARK, - AMMO2_HORNET, -}; - -enumflags -{ - AMMO3_M203_GRENADE, - AMMO3_SHOTGUN_STATE, - AMMO3_GAUSS_STATE, - AMMO3_GAUSS_VOLUME, - AMMO3_EGON_STATE, - AMMO3_RPG_STATE, - AMMO3_HANDGRENADE_STATE -}; - noref int input_sequence; class player:base_player { @@ -152,6 +113,12 @@ class player:base_player int ammo_gas; int ammo_gas_net; int mode_silencer; int mode_silencer_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; @@ -159,7 +126,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; @@ -235,12 +201,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) { @@ -350,6 +320,12 @@ player::PredictPreFrame(void) ammo_gas_net = ammo_gas; mode_silencer_net = mode_silencer; + + 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; } /* @@ -404,6 +380,12 @@ player::PredictPostFrame(void) ammo_gas = ammo_gas_net; mode_silencer = mode_silencer_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 @@ -466,11 +448,11 @@ player::EvaluateEntity(void) if (old_viewofs != view_ofs[2]) SendFlags |= PLAYER_VIEWOFS; - if (old_baseframe != baseframe) - SendFlags |= PLAYER_BASEFRAME; - - if (old_frame != frame) - SendFlags |= PLAYER_FRAME; + /* 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; /* ammo 1 type updates */ if (glock_mag != glock_mag_net) { @@ -635,6 +617,12 @@ player::EvaluateEntity(void) ammo_medkit_net = ammo_medkit; ammo_gas_net = ammo_gas; mode_silencer_net= mode_silencer; + + 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; } /* @@ -703,10 +691,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, glock_mag); diff --git a/src/shared/w_ap9.qc b/src/shared/w_ap9.qc index 5f217ac..3ffd98d 100644 --- a/src/shared/w_ap9.qc +++ b/src/shared/w_ap9.qc @@ -137,9 +137,9 @@ w_ap9_primary(void) Sound_Play(pl, CHAN_WEAPON, "weapon_ap9.fire"); if (self.flags & FL_CROUCHING) - Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f); + Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.45f); else - Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f); + Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.45f); #endif pl.w_attack_next = 0.15f; @@ -182,9 +182,9 @@ w_ap9_secondary(void) Sound_Play(pl, CHAN_WEAPON, "weapon_ap9.fire"); if (self.flags & FL_CROUCHING) - Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f); + Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.45f); else - Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f); + Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.45f); #endif pl.w_attack_next = 1.0f; diff --git a/src/shared/w_medkit.qc b/src/shared/w_medkit.qc index 869ee24..44f3cb8 100644 --- a/src/shared/w_medkit.qc +++ b/src/shared/w_medkit.qc @@ -117,9 +117,9 @@ w_medkit_primary(void) Damage_Apply(pl, pl, -15, WEAPON_MEDKIT, DMG_GENERIC); if (self.flags & FL_CROUCHING) - Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f); + Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.45f); else - Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f); + Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.45f); Sound_Play(pl, CHAN_WEAPON, "weapon_medkit.heal"); #endif diff --git a/src/shared/w_shovel.qc b/src/shared/w_shovel.qc index 6449470..6b8f949 100644 --- a/src/shared/w_shovel.qc +++ b/src/shared/w_shovel.qc @@ -130,9 +130,9 @@ w_shovel_primary(void) } if (pl.flags & FL_CROUCHING) { - Animation_PlayerTopTemp(ANIM_SHOOTCROWBAR, 0.5f); + Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f); } else { - Animation_PlayerTopTemp(ANIM_CR_SHOOTCROWBAR, 0.42f); + Animation_PlayerTop(pl, ANIM_CR_SHOOTCROWBAR, 0.42f); } #ifdef SERVER diff --git a/src/shared/w_silencer.qc b/src/shared/w_silencer.qc index 35a5333..6e2bdff 100644 --- a/src/shared/w_silencer.qc +++ b/src/shared/w_silencer.qc @@ -135,9 +135,9 @@ w_silencer_primary(void) } if (self.flags & FL_CROUCHING) - Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f); + Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.45f); else - Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f); + Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.45f); #endif /* Fires faster without silencer */ diff --git a/src/shared/w_spanner.qc b/src/shared/w_spanner.qc index fd85326..f06a917 100644 --- a/src/shared/w_spanner.qc +++ b/src/shared/w_spanner.qc @@ -104,9 +104,9 @@ w_spanner_primary(void) } #else if (pl.flags & FL_CROUCHING) { - Animation_PlayerTopTemp(ANIM_SHOOTCROWBAR, 0.5f); + Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f); } else { - Animation_PlayerTopTemp(ANIM_CR_SHOOTCROWBAR, 0.42f); + Animation_PlayerTop(pl, ANIM_CR_SHOOTCROWBAR, 0.42f); } Sound_Play(self, CHAN_WEAPON, "weapon_crowbar.miss"); diff --git a/src/shared/w_taurus.qc b/src/shared/w_taurus.qc index 58e50cb..3f84d23 100644 --- a/src/shared/w_taurus.qc +++ b/src/shared/w_taurus.qc @@ -132,9 +132,9 @@ w_taurus_primary(void) Sound_Play(pl, CHAN_WEAPON, "weapon_taurus.fire"); if (self.flags & FL_CROUCHING) - Animation_PlayerTopTemp(ANIM_SHOOT1HAND, 0.45f); + Animation_PlayerTop(pl, ANIM_SHOOT1HAND, 0.45f); else - Animation_PlayerTopTemp(ANIM_CR_SHOOT1HAND, 0.45f); + Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.45f); #endif pl.w_attack_next = 0.25f;