Conform to the latest upstream changes in FreeHL and Nuclide regarding

animation and sound calls
This commit is contained in:
Marco Cawthorne 2021-04-07 19:01:32 +02:00
parent cd687f48d8
commit 9678955694
9 changed files with 69 additions and 37 deletions

View file

@ -21,7 +21,6 @@ var int autocvar_sv_playerkeepalive = TRUE;
void void
HLGameRules::PlayerPostFrame(base_player pp) HLGameRules::PlayerPostFrame(base_player pp)
{ {
Animation_PlayerUpdate();
} }
void void

View file

@ -12,7 +12,7 @@ player.qc
../../../valve/src/shared/fx_breakmodel.qc ../../../valve/src/shared/fx_breakmodel.qc
../../../valve/src/shared/fx_explosion.qc ../../../valve/src/shared/fx_explosion.qc
../../../valve/src/shared/fx_gibhuman.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 ../../../valve/src/shared/fx_impact.qc
items.h items.h

View file

@ -33,8 +33,8 @@ enumflags
PLAYER_ARMOR, PLAYER_ARMOR,
PLAYER_MOVETYPE, PLAYER_MOVETYPE,
PLAYER_VIEWOFS, PLAYER_VIEWOFS,
PLAYER_BASEFRAME, PLAYER_TOPFRAME,
PLAYER_FRAME, PLAYER_BOTTOMFRAME,
PLAYER_AMMO1, PLAYER_AMMO1,
PLAYER_AMMO2, PLAYER_AMMO2,
PLAYER_AMMO3, PLAYER_AMMO3,
@ -154,6 +154,12 @@ class player:base_player
int mode_sporelauncher; int mode_sporelauncher_net; int mode_sporelauncher; int mode_sporelauncher_net;
int mode_m249; int mode_m249_net; int mode_m249; int mode_m249_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 #ifdef CLIENT
/* External model */ /* External model */
entity p_model; entity p_model;
@ -161,7 +167,6 @@ class player:base_player
int p_model_bone; int p_model_bone;
float lastweapon; float lastweapon;
virtual void(void) gun_offset;
virtual void(void) draw; virtual void(void) draw;
virtual float() predraw; virtual float() predraw;
virtual void(void) postdraw; virtual void(void) postdraw;
@ -237,12 +242,16 @@ player::ReceiveEntity(float new)
movetype = readbyte(); movetype = readbyte();
if (fl & PLAYER_VIEWOFS) if (fl & PLAYER_VIEWOFS)
view_ofs[2] = readfloat(); view_ofs[2] = readfloat();
if (fl & PLAYER_BASEFRAME)
baseframe = readbyte(); /* animation */
if (fl & PLAYER_FRAME) { if (fl & PLAYER_TOPFRAME) {
frame = readbyte(); anim_top = readbyte();
frame1time = 0.0f; anim_top_time = readfloat();
frame2time = 0.0f; anim_top_delay = readfloat();
}
if (fl & PLAYER_BOTTOMFRAME) {
anim_bottom = readbyte();
anim_bottom_time = readfloat();
} }
if (fl & PLAYER_AMMO1) { if (fl & PLAYER_AMMO1) {
@ -358,6 +367,12 @@ player::PredictPreFrame(void)
mode_wrench_net = mode_wrench; mode_wrench_net = mode_wrench;
mode_sporelauncher_net = mode_sporelauncher; mode_sporelauncher_net = mode_sporelauncher;
mode_m249_net = mode_m249; mode_m249_net = mode_m249;
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;
} }
/* /*
@ -413,6 +428,12 @@ player::PredictPostFrame(void)
mode_wrench = mode_wrench_net; mode_wrench = mode_wrench_net;
mode_sporelauncher = mode_sporelauncher_net; mode_sporelauncher = mode_sporelauncher_net;
mode_m249 = mode_m249_net; mode_m249 = mode_m249_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 #else
@ -475,11 +496,11 @@ player::EvaluateEntity(void)
if (old_viewofs != view_ofs[2]) if (old_viewofs != view_ofs[2])
SendFlags |= PLAYER_VIEWOFS; SendFlags |= PLAYER_VIEWOFS;
if (old_baseframe != baseframe) /* animation */
SendFlags |= PLAYER_BASEFRAME; if (anim_bottom_net != anim_bottom || anim_bottom_time != anim_bottom_time_net)
SendFlags |= PLAYER_BOTTOMFRAME;
if (old_frame != frame) if (anim_top_net != anim_top || anim_top_time != anim_top_time_net || anim_top_delay != anim_top_delay_net)
SendFlags |= PLAYER_FRAME; SendFlags |= PLAYER_TOPFRAME;
/* ammo 1 type updates */ /* ammo 1 type updates */
if (glock_mag != glock_mag_net) { if (glock_mag != glock_mag_net) {
@ -650,6 +671,12 @@ player::EvaluateEntity(void)
mode_wrench_net = mode_wrench; mode_wrench_net = mode_wrench;
mode_sporelauncher_net = mode_sporelauncher; mode_sporelauncher_net = mode_sporelauncher;
mode_m249_net = mode_m249; mode_m249_net = mode_m249;
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;
} }
/* /*
@ -718,10 +745,16 @@ player::SendEntity(entity ePEnt, float fChanged)
WriteByte(MSG_ENTITY, movetype); WriteByte(MSG_ENTITY, movetype);
if (fChanged & PLAYER_VIEWOFS) if (fChanged & PLAYER_VIEWOFS)
WriteFloat(MSG_ENTITY, view_ofs[2]); WriteFloat(MSG_ENTITY, view_ofs[2]);
if (fChanged & PLAYER_BASEFRAME)
WriteByte(MSG_ENTITY, baseframe); if (fChanged & PLAYER_TOPFRAME) {
if (fChanged & PLAYER_FRAME) WriteByte(MSG_ENTITY, anim_top);
WriteByte(MSG_ENTITY, frame); 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) { if (fChanged & PLAYER_AMMO1) {
WriteByte(MSG_ENTITY, glock_mag); WriteByte(MSG_ENTITY, glock_mag);

View file

@ -120,7 +120,7 @@ w_displacer_teleport(entity target)
#ifdef SERVER #ifdef SERVER
player pl = (player)target; player pl = (player)target;
/* TODO, 250 damage */ /* TODO, 250 damage */
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/displacer_teleport.wav", 1, ATTN_NORM); sound(pl, CHAN_WEAPON, "weapons/displacer_teleport.wav", 1, ATTN_NORM);
/* FIXME: This will teleport upon your standard spawn positions /* FIXME: This will teleport upon your standard spawn positions
* in other game modes, such as CTF (your team spawns), no clue * in other game modes, such as CTF (your team spawns), no clue
@ -235,7 +235,7 @@ w_displacer_primary(void)
#ifdef CLIENT #ifdef CLIENT
Weapons_ViewAnimation(DISP_SPINUP); Weapons_ViewAnimation(DISP_SPINUP);
#else #else
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/displacer_spin.wav", 1, ATTN_NORM); sound(pl, CHAN_WEAPON, "weapons/displacer_spin.wav", 1, ATTN_NORM);
#endif #endif
pl.w_idle_next = pl.w_attack_next = 1.0f; pl.w_idle_next = pl.w_attack_next = 1.0f;
} }
@ -264,7 +264,7 @@ w_displacer_secondary(void)
#ifdef CLIENT #ifdef CLIENT
Weapons_ViewAnimation(DISP_SPINUP); Weapons_ViewAnimation(DISP_SPINUP);
#else #else
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/displacer_spin2.wav", 1, ATTN_NORM); sound(pl, CHAN_WEAPON, "weapons/displacer_spin2.wav", 1, ATTN_NORM);
#endif #endif
pl.w_idle_next = pl.w_attack_next = 1.0f; pl.w_idle_next = pl.w_attack_next = 1.0f;
} }

View file

@ -116,7 +116,6 @@ w_knife_primary(void)
} }
pl.w_idle_next = 2.5f; pl.w_idle_next = 2.5f;
#ifdef CLIENT
r = (float)input_sequence % 3; r = (float)input_sequence % 3;
switch (r) { switch (r) {
case 0: case 0:
@ -129,13 +128,14 @@ w_knife_primary(void)
anim = trace_fraction >= 1 ? KNIFE_ATTACK3MISS:KNIFE_ATTACK3HIT; anim = trace_fraction >= 1 ? KNIFE_ATTACK3MISS:KNIFE_ATTACK3HIT;
} }
Weapons_ViewAnimation(anim); Weapons_ViewAnimation(anim);
#else
if (pl.flags & FL_CROUCHING) { if (pl.flags & FL_CROUCHING) {
Animation_PlayerTopTemp(ANIM_SHOOTCROWBAR, 0.5f); Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f);
} else { } else {
Animation_PlayerTopTemp(ANIM_CR_SHOOTCROWBAR, 0.42f); Animation_PlayerTop(pl, ANIM_CR_SHOOTCROWBAR, 0.42f);
} }
#ifdef SERVER
r = (float)input_sequence % 3; r = (float)input_sequence % 3;
switch (r) { switch (r) {
case 0: case 0:

View file

@ -185,13 +185,13 @@ w_m249_primary(void)
int r = (float)input_sequence % 3; int r = (float)input_sequence % 3;
switch (r) { switch (r) {
case 0: case 0:
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/saw_fire1.wav", 1, ATTN_NORM); sound(pl, CHAN_WEAPON, "weapons/saw_fire1.wav", 1, ATTN_NORM);
break; break;
case 1: case 1:
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/saw_fire2.wav", 1, ATTN_NORM); sound(pl, CHAN_WEAPON, "weapons/saw_fire2.wav", 1, ATTN_NORM);
break; break;
default: default:
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/saw_fire3.wav", 1, ATTN_NORM); sound(pl, CHAN_WEAPON, "weapons/saw_fire3.wav", 1, ATTN_NORM);
} }
pl.m249_mag--; pl.m249_mag--;

View file

@ -124,7 +124,6 @@ w_pipewrench_primary(void)
} }
pl.w_idle_next = 2.5f; pl.w_idle_next = 2.5f;
#ifdef CLIENT
int r = (float)input_sequence % 3; int r = (float)input_sequence % 3;
switch (r) { switch (r) {
case 0: case 0:
@ -137,13 +136,14 @@ w_pipewrench_primary(void)
anim = trace_fraction >= 1 ? PIPE_ATTACK3MISS:PIPE_ATTACK3HIT; anim = trace_fraction >= 1 ? PIPE_ATTACK3MISS:PIPE_ATTACK3HIT;
} }
Weapons_ViewAnimation(anim); Weapons_ViewAnimation(anim);
#else
if (pl.flags & FL_CROUCHING) { if (pl.flags & FL_CROUCHING) {
Animation_PlayerTopTemp(ANIM_SHOOTCROWBAR, 0.5f); Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f);
} else { } else {
Animation_PlayerTopTemp(ANIM_CR_SHOOTCROWBAR, 0.42f); Animation_PlayerTop(pl, ANIM_CR_SHOOTCROWBAR, 0.42f);
} }
#ifdef SERVER
sound(pl, CHAN_WEAPON, "weapons/pwrench_miss1.wav", 1, ATTN_NORM); sound(pl, CHAN_WEAPON, "weapons/pwrench_miss1.wav", 1, ATTN_NORM);
if (trace_fraction >= 1.0) { if (trace_fraction >= 1.0) {
@ -252,7 +252,7 @@ w_pipewrench_release(void)
snd = "weapons/pwrench_big_hit1.wav"; snd = "weapons/pwrench_big_hit1.wav";
break; break;
} }
Weapons_PlaySound(pl, CHAN_WEAPON, snd, 1.0f, ATTN_NORM); sound(pl, CHAN_WEAPON, snd, 1.0f, ATTN_NORM);
#endif #endif
pl.w_attack_next = 1.0f; pl.w_attack_next = 1.0f;
pl.w_idle_next = 10.0f; pl.w_idle_next = 10.0f;

View file

@ -185,7 +185,7 @@ w_shockrifle_primary(void)
#ifdef SERVER #ifdef SERVER
w_shockrifle_shoothornet(); w_shockrifle_shoothornet();
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/shock_fire.wav", 1, ATTN_NORM); sound(pl, CHAN_WEAPON, "weapons/shock_fire.wav", 1, ATTN_NORM);
pl.ammo_shock--; pl.ammo_shock--;
Weapons_UpdateAmmo(pl, -1, pl.ammo_shock, -1); Weapons_UpdateAmmo(pl, -1, pl.ammo_shock, -1);

View file

@ -131,7 +131,7 @@ w_sniperrifle_primary(void)
/* Actual firing */ /* Actual firing */
#ifdef SERVER #ifdef SERVER
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 40, [0.00873, 0.00873], WEAPON_SNIPERRIFLE); TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 40, [0.00873, 0.00873], WEAPON_SNIPERRIFLE);
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/sniper_fire.wav", 1, ATTN_NORM); sound(pl, CHAN_WEAPON, "weapons/sniper_fire.wav", 1, ATTN_NORM);
pl.sniper_mag--; pl.sniper_mag--;
Weapons_UpdateAmmo(pl, pl.sniper_mag, pl.ammo_762, __NULL__); Weapons_UpdateAmmo(pl, pl.sniper_mag, pl.ammo_762, __NULL__);