Fix the code to compile against the latest Nuclide SDK

This commit is contained in:
Marco Cawthorne 2021-05-07 13:35:55 +02:00
parent 2e5cbd27e5
commit b2f8e2cca6
7 changed files with 67 additions and 28 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

@ -19,7 +19,6 @@
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,
@ -59,6 +59,12 @@ class player:base_player
int ammo_xencandy; int ammo_xencandy_net;
int ammo_satchel; int ammo_satchel_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;
@ -66,7 +72,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;
@ -142,12 +147,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) {
@ -199,6 +208,12 @@ player::PredictPreFrame(void)
ammo_bolts_net = ammo_bolts;
ammo_xencandy_net = ammo_xencandy;
ammo_satchel_net = ammo_satchel;
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;
}
/*
@ -223,6 +238,12 @@ player::PredictPostFrame(void)
ammo_bolts = ammo_bolts_net;
ammo_xencandy = ammo_xencandy_net;
ammo_satchel = ammo_satchel_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
@ -285,11 +306,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;
old_modelindex = modelindex;
old_origin = origin;
@ -411,10 +438,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, bradnailer_mag);

View File

@ -115,9 +115,9 @@ w_bradnailer_shootnail(void)
setsize(nail, [0,0,0], [0,0,0]);
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_bradnailer.fire");
}

View File

@ -72,12 +72,12 @@ w_nailgun_primary(void)
if (other.takedamage == DAMAGE_YES) {
Damage_Apply(other, self.owner, 15, WEAPON_NAILGUN, DMG_GENERIC);
if (random() < 0.5) {
Weapons_PlaySound(self, CHAN_WEAPON, "weapons/brad_hit1.wav", 1, ATTN_NORM);
sound(self, CHAN_WEAPON, "weapons/brad_hit1.wav", 1, ATTN_NORM);
} else {
Weapons_PlaySound(self, CHAN_WEAPON, "weapons/brad_hit2.wav", 1, ATTN_NORM);
sound(self, CHAN_WEAPON, "weapons/brad_hit2.wav", 1, ATTN_NORM);
}
} else {
Weapons_PlaySound(self, CHAN_WEAPON, "weapons/xbow_hit1.wav", 1, ATTN_NORM);
sound(self, CHAN_WEAPON, "weapons/xbow_hit1.wav", 1, ATTN_NORM);
}
remove(self);
}
@ -96,11 +96,11 @@ w_nailgun_primary(void)
setsize(nail, [0,0,0], [0,0,0]);
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);
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/nailgun.wav", 1, ATTN_NORM);
sound(pl, CHAN_WEAPON, "weapons/nailgun.wav", 1, ATTN_NORM);
#else

View File

@ -124,7 +124,7 @@ void w_shotgun_primary(void)
} else {
TraceAttack_FireBullets(4, pl.origin + pl.view_ofs, 5, [0.08716,0.04362], WEAPON_SHOTGUN);
}
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/dbarrel1.wav", 1, ATTN_NORM);
sound(pl, CHAN_WEAPON, "weapons/dbarrel1.wav", 1, ATTN_NORM);
pl.shotgun_mag--;
Weapons_UpdateAmmo(pl, pl.shotgun_mag, pl.ammo_buckshot, __NULL__);
#else