Simplify prediction code with the help from upstream changes.
This commit is contained in:
parent
4dd9923a05
commit
ced4cb5bf8
24 changed files with 263 additions and 474 deletions
|
@ -183,6 +183,6 @@ Player_PreDraw(base_player pl, int thirdperson)
|
|||
}
|
||||
}
|
||||
|
||||
Animation_PlayerUpdate(pl);
|
||||
Animation_PlayerUpdate((player)pl);
|
||||
Player_HandleWeaponModel(pl, thirdperson);
|
||||
}
|
||||
|
|
|
@ -37,10 +37,10 @@ View_UpdateWeapon(entity vm, entity mflash)
|
|||
* thus we need to update all the net variables to
|
||||
* make sure these updates are recognized. this is
|
||||
* vile but it'll have to do for now */
|
||||
pl.net_w_attack_next = pl.w_attack_next;
|
||||
pl.net_w_idle_next = pl.w_idle_next;
|
||||
pl.net_viewzoom = pl.viewzoom;
|
||||
pl.net_weapontime = pl.weapontime;
|
||||
SAVE_STATE(pl.w_attack_next);
|
||||
SAVE_STATE(pl.w_idle_next);
|
||||
SAVE_STATE(pl.viewzoom);
|
||||
SAVE_STATE(pl.weapontime);
|
||||
|
||||
/* figure out when the attachments start. in FTE attachments for
|
||||
* HLMDL are treated as bones. they start at numbones + 1 */
|
||||
|
|
|
@ -52,7 +52,7 @@ void item_ammo::Respawn(void)
|
|||
think = __NULL__;
|
||||
nextthink = -1;
|
||||
|
||||
if (real_owner)
|
||||
if (real_owner && time > 30.0f)
|
||||
Sound_Play(this, CHAN_ITEM, "ammo.respawn");
|
||||
|
||||
droptofloor();
|
||||
|
|
|
@ -16,19 +16,19 @@
|
|||
|
||||
/* generic function that applies damage, pain and suffering */
|
||||
void
|
||||
Damage_Apply(entity t, entity c, float dmg, int w, int type)
|
||||
Damage_Apply(entity t, entity c, float dmg, int w, damageType_t type)
|
||||
{
|
||||
base_player tp = (base_player)t;
|
||||
|
||||
CGameRules rules = (CGameRules)g_grMode;
|
||||
if (t.flags & FL_GODMODE) {
|
||||
|
||||
/* player god mode */
|
||||
if (t.flags & FL_CLIENT && t.flags & FL_GODMODE)
|
||||
return;
|
||||
}
|
||||
|
||||
/* already dead, please avoid recursion */
|
||||
if (t.health <= 0) {
|
||||
if (t.health <= 0)
|
||||
return;
|
||||
}
|
||||
|
||||
/* skip armor */
|
||||
if not (type & DMG_SKIP_ARMOR)
|
||||
|
|
|
@ -75,7 +75,7 @@ void item_battery::Respawn(void)
|
|||
think = __NULL__;
|
||||
nextthink = -1;
|
||||
|
||||
if (!real_owner)
|
||||
if (!real_owner && time > 30.0f)
|
||||
Sound_Play(this, CHAN_ITEM, "item.respawn");
|
||||
|
||||
droptofloor();
|
||||
|
|
|
@ -64,7 +64,7 @@ void item_healthkit::Respawn(void)
|
|||
think = __NULL__;
|
||||
nextthink = -1;
|
||||
|
||||
if (!real_owner)
|
||||
if (!real_owner && time > 30.0f)
|
||||
Sound_Play(this, CHAN_ITEM, "item.respawn");
|
||||
|
||||
droptofloor();
|
||||
|
|
|
@ -78,7 +78,7 @@ item_longjump::Respawn(void)
|
|||
think = __NULL__;
|
||||
nextthink = -1;
|
||||
|
||||
if (!real_owner)
|
||||
if (!real_owner && time > 30.0f)
|
||||
Sound_Play(this, CHAN_ITEM, "item.respawn");
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ item_suit::Respawn(void)
|
|||
think = __NULL__;
|
||||
nextthink = -1;
|
||||
|
||||
if (!real_owner)
|
||||
if (!real_owner && time > 30.0f)
|
||||
Sound_Play(this, CHAN_ITEM, "item.respawn");
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ void item_pickup::Respawn(void)
|
|||
nextthink = -1;
|
||||
|
||||
if (!m_iWasDropped && cvar("sv_playerslots") > 1) {
|
||||
if (!real_owner)
|
||||
if (!real_owner && time > 30.0f)
|
||||
Sound_Play(this, CHAN_ITEM, "item.respawn");
|
||||
|
||||
m_iClip = -1;
|
||||
|
|
|
@ -83,7 +83,7 @@ FX_Impact_Init(void)
|
|||
#endif
|
||||
|
||||
void
|
||||
FX_Impact(int iType, vector vecPos, vector vNormal)
|
||||
FX_Impact(impactType_t iType, vector vecPos, vector vNormal)
|
||||
{
|
||||
#ifdef SERVER
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
|
|
|
@ -45,59 +45,40 @@ enumflags
|
|||
noref int input_sequence;
|
||||
class player:base_player
|
||||
{
|
||||
/* Weapon specific */
|
||||
int glock_mag;
|
||||
int glock_mag_net;
|
||||
int mp5_mag;
|
||||
int mp5_mag_net;
|
||||
int python_mag;
|
||||
int python_mag_net;
|
||||
int shotgun_mag;
|
||||
int shotgun_mag_net;
|
||||
int crossbow_mag;
|
||||
int crossbow_mag_net;
|
||||
int rpg_mag;
|
||||
int rpg_mag_net;
|
||||
int satchel_chg;
|
||||
int satchel_chg_net;
|
||||
/* animation */
|
||||
PREDICTED_INT(anim_top);
|
||||
PREDICTED_FLOAT(anim_top_time);
|
||||
PREDICTED_FLOAT(anim_top_delay);
|
||||
PREDICTED_INT(anim_bottom);
|
||||
PREDICTED_FLOAT(anim_bottom_time);
|
||||
|
||||
int ammo_9mm;
|
||||
int ammo_9mm_net;
|
||||
int ammo_357;
|
||||
int ammo_357_net;
|
||||
int ammo_buckshot;
|
||||
int ammo_buckshot_net;
|
||||
int ammo_bolt;
|
||||
int ammo_bolt_net;
|
||||
int ammo_rocket;
|
||||
int ammo_rocket_net;
|
||||
int ammo_uranium;
|
||||
int ammo_uranium_net;
|
||||
int ammo_handgrenade;
|
||||
int ammo_handgrenade_net;
|
||||
int ammo_satchel;
|
||||
int ammo_satchel_net;
|
||||
int ammo_tripmine;
|
||||
int ammo_tripmine_net;
|
||||
int ammo_snark;
|
||||
int ammo_snark_net;
|
||||
int ammo_hornet;
|
||||
int ammo_hornet_net;
|
||||
/* ammo 1 */
|
||||
PREDICTED_INT(glock_mag);
|
||||
PREDICTED_INT(mp5_mag);
|
||||
PREDICTED_INT(python_mag);
|
||||
PREDICTED_INT(shotgun_mag);
|
||||
PREDICTED_INT(crossbow_mag);
|
||||
PREDICTED_INT(rpg_mag);
|
||||
PREDICTED_INT(satchel_chg);
|
||||
|
||||
int ammo_m203_grenade;
|
||||
int ammo_m203_grenade_net;
|
||||
int ammo_gauss_volume;
|
||||
int ammo_gauss_volume_net;
|
||||
int ammo_rpg_state;
|
||||
int ammo_rpg_state_net;
|
||||
int mode_tempstate;
|
||||
int mode_tempstate_net;
|
||||
/* ammo 2 */
|
||||
PREDICTED_INT(ammo_9mm);
|
||||
PREDICTED_INT(ammo_357);
|
||||
PREDICTED_INT(ammo_buckshot);
|
||||
PREDICTED_INT(ammo_bolt);
|
||||
PREDICTED_INT(ammo_rocket);
|
||||
PREDICTED_INT(ammo_uranium);
|
||||
PREDICTED_INT(ammo_handgrenade);
|
||||
PREDICTED_INT(ammo_satchel);
|
||||
PREDICTED_INT(ammo_tripmine);
|
||||
PREDICTED_INT(ammo_snark);
|
||||
PREDICTED_INT(ammo_hornet);
|
||||
|
||||
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;
|
||||
/* ammo 3 */
|
||||
PREDICTED_INT(ammo_m203_grenade);
|
||||
PREDICTED_INT(ammo_gauss_volume);
|
||||
PREDICTED_INT(ammo_rpg_state);
|
||||
PREDICTED_INT(mode_tempstate);
|
||||
|
||||
#ifdef CLIENT
|
||||
/* External model */
|
||||
|
@ -109,7 +90,7 @@ class player:base_player
|
|||
virtual void(void) draw;
|
||||
virtual float() predraw;
|
||||
virtual void(void) postdraw;
|
||||
virtual void(float) ReceiveEntity;
|
||||
virtual void(float,float) ReceiveEntity;
|
||||
virtual void(void) PredictPreFrame;
|
||||
virtual void(void) PredictPostFrame;
|
||||
#else
|
||||
|
@ -126,61 +107,10 @@ player::ReceiveEntity
|
|||
=================
|
||||
*/
|
||||
void
|
||||
player::ReceiveEntity(float new)
|
||||
player::ReceiveEntity(float new, float fl)
|
||||
{
|
||||
float fl;
|
||||
|
||||
/* seed for our prediction table */
|
||||
sequence = servercommandframe;
|
||||
|
||||
fl = readfloat();
|
||||
|
||||
/* HACK: we need to make this more reliable */
|
||||
if (fl == UPDATE_ALL) {
|
||||
/* we respawned */
|
||||
gravity = __NULL__;
|
||||
}
|
||||
|
||||
if (fl & PLAYER_MODELINDEX)
|
||||
modelindex = readshort();
|
||||
|
||||
if (fl & PLAYER_ORIGIN) {
|
||||
origin[0] = readcoord();
|
||||
origin[1] = readcoord();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_ORIGIN_Z)
|
||||
origin[2] = readcoord();
|
||||
if (fl & PLAYER_ANGLES_X)
|
||||
pitch = readfloat();
|
||||
if (fl & PLAYER_ANGLES_Y)
|
||||
angles[1] = readfloat();
|
||||
if (fl & PLAYER_ANGLES_Z)
|
||||
angles[2] = readfloat();
|
||||
|
||||
if (fl & PLAYER_VELOCITY) {
|
||||
velocity[0] = readcoord();
|
||||
velocity[1] = readcoord();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_VELOCITY_Z)
|
||||
velocity[2] = readcoord();
|
||||
if (fl & PLAYER_FLAGS) {
|
||||
flags = readfloat();
|
||||
gflags = readfloat();
|
||||
}
|
||||
if (fl & PLAYER_WEAPON)
|
||||
activeweapon = readbyte();
|
||||
if (fl & PLAYER_ITEMS)
|
||||
g_items = (__variant)readfloat();
|
||||
if (fl & PLAYER_HEALTH)
|
||||
health = readbyte();
|
||||
if (fl & PLAYER_ARMOR)
|
||||
armor = readbyte();
|
||||
if (fl & PLAYER_MOVETYPE)
|
||||
movetype = readbyte();
|
||||
if (fl & PLAYER_VIEWOFS)
|
||||
view_ofs[2] = readfloat();
|
||||
/* the generic client attributes */
|
||||
base_player::ReceiveEntity(new, fl);
|
||||
|
||||
/* animation */
|
||||
if (fl & PLAYER_TOPFRAME) {
|
||||
|
@ -241,35 +171,39 @@ so we can roll them back later.
|
|||
void
|
||||
player::PredictPreFrame(void)
|
||||
{
|
||||
glock_mag_net = glock_mag;
|
||||
mp5_mag_net = mp5_mag;
|
||||
python_mag_net = python_mag;
|
||||
shotgun_mag_net = shotgun_mag;
|
||||
crossbow_mag_net = crossbow_mag;
|
||||
rpg_mag_net = rpg_mag;
|
||||
satchel_chg_net = satchel_chg;
|
||||
ammo_9mm_net = ammo_9mm;
|
||||
ammo_357_net = ammo_357;
|
||||
ammo_buckshot_net = ammo_buckshot;
|
||||
ammo_bolt_net = ammo_bolt;
|
||||
ammo_rocket_net = ammo_rocket;
|
||||
ammo_uranium_net = ammo_uranium;
|
||||
ammo_handgrenade_net = ammo_handgrenade;
|
||||
ammo_satchel_net = ammo_satchel;
|
||||
ammo_tripmine_net = ammo_tripmine;
|
||||
ammo_snark_net = ammo_snark;
|
||||
ammo_hornet_net = ammo_hornet;
|
||||
/* the generic client attributes */
|
||||
base_player::PredictPreFrame();
|
||||
|
||||
ammo_m203_grenade_net = ammo_m203_grenade;
|
||||
ammo_gauss_volume_net = ammo_gauss_volume;
|
||||
ammo_rpg_state_net = ammo_rpg_state;
|
||||
mode_tempstate_net = mode_tempstate;
|
||||
SAVE_STATE(anim_top);
|
||||
SAVE_STATE(anim_top_delay);
|
||||
SAVE_STATE(anim_top_time);
|
||||
SAVE_STATE(anim_bottom);
|
||||
SAVE_STATE(anim_bottom_time);
|
||||
|
||||
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;
|
||||
SAVE_STATE(glock_mag);
|
||||
SAVE_STATE(mp5_mag);
|
||||
SAVE_STATE(python_mag);
|
||||
SAVE_STATE(shotgun_mag);
|
||||
SAVE_STATE(crossbow_mag);
|
||||
SAVE_STATE(rpg_mag);
|
||||
SAVE_STATE(satchel_chg);
|
||||
|
||||
SAVE_STATE(ammo_9mm);
|
||||
SAVE_STATE(ammo_357);
|
||||
SAVE_STATE(ammo_buckshot);
|
||||
SAVE_STATE(ammo_bolt);
|
||||
SAVE_STATE(ammo_rocket);
|
||||
SAVE_STATE(ammo_uranium);
|
||||
SAVE_STATE(ammo_handgrenade);
|
||||
SAVE_STATE(ammo_satchel);
|
||||
SAVE_STATE(ammo_tripmine);
|
||||
SAVE_STATE(ammo_snark);
|
||||
SAVE_STATE(ammo_hornet);
|
||||
|
||||
SAVE_STATE(ammo_m203_grenade);
|
||||
SAVE_STATE(ammo_gauss_volume);
|
||||
SAVE_STATE(ammo_rpg_state);
|
||||
SAVE_STATE(mode_tempstate);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -282,222 +216,133 @@ Where we roll back our values to the ones last sent/verified by the server.
|
|||
void
|
||||
player::PredictPostFrame(void)
|
||||
{
|
||||
glock_mag = glock_mag_net;
|
||||
mp5_mag = mp5_mag_net;
|
||||
python_mag = python_mag_net;
|
||||
shotgun_mag = shotgun_mag_net;
|
||||
crossbow_mag = crossbow_mag_net;
|
||||
rpg_mag = rpg_mag_net;
|
||||
satchel_chg = satchel_chg_net;
|
||||
ammo_9mm = ammo_9mm_net;
|
||||
ammo_357 = ammo_357_net;
|
||||
ammo_buckshot = ammo_buckshot_net;
|
||||
ammo_m203_grenade = ammo_m203_grenade_net;
|
||||
ammo_bolt = ammo_bolt_net;
|
||||
ammo_rocket = ammo_rocket_net;
|
||||
ammo_uranium = ammo_uranium_net;
|
||||
ammo_handgrenade = ammo_handgrenade_net;
|
||||
ammo_satchel = ammo_satchel_net;
|
||||
ammo_tripmine = ammo_tripmine_net;
|
||||
ammo_snark = ammo_snark_net;
|
||||
ammo_hornet = ammo_hornet_net;
|
||||
/* the generic client attributes */
|
||||
base_player::PredictPostFrame();
|
||||
|
||||
ammo_m203_grenade = ammo_m203_grenade_net;
|
||||
ammo_gauss_volume = ammo_gauss_volume_net;
|
||||
ammo_rpg_state = ammo_rpg_state_net;
|
||||
mode_tempstate = mode_tempstate_net;
|
||||
ROLL_BACK(anim_top);
|
||||
ROLL_BACK(anim_top_delay);
|
||||
ROLL_BACK(anim_top_time);
|
||||
ROLL_BACK(anim_bottom);
|
||||
ROLL_BACK(anim_bottom_time);
|
||||
|
||||
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;
|
||||
ROLL_BACK(glock_mag);
|
||||
ROLL_BACK(mp5_mag);
|
||||
ROLL_BACK(python_mag);
|
||||
ROLL_BACK(shotgun_mag);
|
||||
ROLL_BACK(crossbow_mag);
|
||||
ROLL_BACK(rpg_mag);
|
||||
ROLL_BACK(satchel_chg);
|
||||
|
||||
ROLL_BACK(ammo_9mm);
|
||||
ROLL_BACK(ammo_357);
|
||||
ROLL_BACK(ammo_buckshot);
|
||||
ROLL_BACK(ammo_m203_grenade);
|
||||
ROLL_BACK(ammo_bolt);
|
||||
ROLL_BACK(ammo_rocket);
|
||||
ROLL_BACK(ammo_uranium);
|
||||
ROLL_BACK(ammo_handgrenade);
|
||||
ROLL_BACK(ammo_satchel);
|
||||
ROLL_BACK(ammo_tripmine);
|
||||
ROLL_BACK(ammo_snark);
|
||||
ROLL_BACK(ammo_hornet);
|
||||
|
||||
ROLL_BACK(ammo_m203_grenade);
|
||||
ROLL_BACK(ammo_gauss_volume);
|
||||
ROLL_BACK(ammo_rpg_state);
|
||||
ROLL_BACK(mode_tempstate);
|
||||
}
|
||||
|
||||
#else
|
||||
void
|
||||
player::EvaluateEntity(void)
|
||||
{
|
||||
SendFlags |= PLAYER_KEEPALIVE;
|
||||
|
||||
if (old_modelindex != modelindex)
|
||||
SendFlags |= PLAYER_MODELINDEX;
|
||||
|
||||
if (old_origin[0] != origin[0])
|
||||
SendFlags |= PLAYER_ORIGIN;
|
||||
|
||||
if (old_origin[1] != origin[1])
|
||||
SendFlags |= PLAYER_ORIGIN;
|
||||
|
||||
if (old_origin[2] != origin[2])
|
||||
SendFlags |= PLAYER_ORIGIN_Z;
|
||||
|
||||
if (old_angles[0] != v_angle[0])
|
||||
SendFlags |= PLAYER_ANGLES_X;
|
||||
|
||||
if (old_angles[1] != angles[1])
|
||||
SendFlags |= PLAYER_ANGLES_Y;
|
||||
|
||||
if (old_angles[2] != angles[2])
|
||||
SendFlags |= PLAYER_ANGLES_Z;
|
||||
|
||||
if (old_velocity[0] != velocity[0])
|
||||
SendFlags |= PLAYER_VELOCITY;
|
||||
|
||||
if (old_velocity[1] != velocity[1])
|
||||
SendFlags |= PLAYER_VELOCITY;
|
||||
|
||||
if (old_velocity[2] != velocity[2])
|
||||
SendFlags |= PLAYER_VELOCITY_Z;
|
||||
|
||||
if (old_flags != flags)
|
||||
SendFlags |= PLAYER_FLAGS;
|
||||
|
||||
if (old_gflags != gflags)
|
||||
SendFlags |= PLAYER_FLAGS;
|
||||
|
||||
if (old_activeweapon != activeweapon)
|
||||
SendFlags |= PLAYER_WEAPON;
|
||||
|
||||
if (old_items != g_items)
|
||||
SendFlags |= PLAYER_ITEMS;
|
||||
|
||||
if (old_health != health)
|
||||
SendFlags |= PLAYER_HEALTH;
|
||||
|
||||
if (old_armor != armor)
|
||||
SendFlags |= PLAYER_ARMOR;
|
||||
|
||||
if (old_movetype != movetype)
|
||||
SendFlags |= PLAYER_MOVETYPE;
|
||||
|
||||
if (old_viewofs != view_ofs[2])
|
||||
SendFlags |= PLAYER_VIEWOFS;
|
||||
/* the generic client attributes */
|
||||
base_player::EvaluateEntity();
|
||||
|
||||
/* animation */
|
||||
if (anim_bottom_net != anim_bottom || anim_bottom_time != anim_bottom_time_net)
|
||||
if (ATTR_CHANGED(anim_bottom) || ATTR_CHANGED(anim_bottom_time))
|
||||
SendFlags |= PLAYER_BOTTOMFRAME;
|
||||
if (anim_top_net != anim_top || anim_top_time != anim_top_time_net || anim_top_delay != anim_top_delay_net)
|
||||
if (ATTR_CHANGED(anim_top) || ATTR_CHANGED(anim_top_time) || ATTR_CHANGED(anim_top_delay))
|
||||
SendFlags |= PLAYER_TOPFRAME;
|
||||
|
||||
/* ammo 1 type updates */
|
||||
if (glock_mag != glock_mag_net) {
|
||||
if (ATTR_CHANGED(glock_mag))
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (mp5_mag != mp5_mag_net) {
|
||||
if (ATTR_CHANGED(mp5_mag))
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (python_mag != python_mag_net) {
|
||||
if (ATTR_CHANGED(python_mag))
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (shotgun_mag != shotgun_mag_net) {
|
||||
if (ATTR_CHANGED(shotgun_mag))
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (crossbow_mag != crossbow_mag_net) {
|
||||
if (ATTR_CHANGED(crossbow_mag))
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (rpg_mag != rpg_mag_net) {
|
||||
if (ATTR_CHANGED(rpg_mag))
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (satchel_chg != satchel_chg_net) {
|
||||
if (ATTR_CHANGED(satchel_chg))
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
|
||||
/* ammo 2 type updates */
|
||||
if (ammo_9mm != ammo_9mm_net) {
|
||||
if (ATTR_CHANGED(ammo_9mm))
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_357 != ammo_357_net) {
|
||||
if (ATTR_CHANGED(ammo_357))
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_buckshot != ammo_buckshot_net) {
|
||||
if (ATTR_CHANGED(ammo_buckshot))
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_bolt != ammo_bolt_net) {
|
||||
if (ATTR_CHANGED(ammo_bolt))
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_rocket != ammo_rocket_net) {
|
||||
if (ATTR_CHANGED(ammo_rocket))
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_uranium != ammo_uranium_net) {
|
||||
if (ATTR_CHANGED(ammo_uranium))
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_handgrenade != ammo_handgrenade_net) {
|
||||
if (ATTR_CHANGED(ammo_handgrenade))
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_satchel != ammo_satchel_net) {
|
||||
if (ATTR_CHANGED(ammo_satchel))
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_tripmine != ammo_tripmine_net) {
|
||||
if (ATTR_CHANGED(ammo_tripmine))
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_snark != ammo_snark_net) {
|
||||
if (ATTR_CHANGED(ammo_snark))
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_hornet != ammo_hornet_net) {
|
||||
if (ATTR_CHANGED(ammo_hornet))
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
|
||||
if (ammo_m203_grenade != ammo_m203_grenade_net) {
|
||||
if (ATTR_CHANGED(ammo_m203_grenade))
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_gauss_volume != ammo_gauss_volume_net) {
|
||||
if (ATTR_CHANGED(ammo_gauss_volume))
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_rpg_state != ammo_rpg_state_net) {
|
||||
if (ATTR_CHANGED(ammo_rpg_state))
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (mode_tempstate != mode_tempstate_net) {
|
||||
if (ATTR_CHANGED(mode_tempstate))
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
|
||||
old_modelindex = modelindex;
|
||||
old_origin = origin;
|
||||
old_angles = angles;
|
||||
old_angles[0] = v_angle[0];
|
||||
old_velocity = velocity;
|
||||
old_flags = flags;
|
||||
old_gflags = gflags;
|
||||
old_activeweapon = activeweapon;
|
||||
old_items = g_items;
|
||||
old_health = health;
|
||||
old_armor = armor;
|
||||
old_movetype = movetype;
|
||||
old_viewofs = view_ofs[2];
|
||||
old_baseframe = baseframe;
|
||||
old_frame = frame;
|
||||
SAVE_STATE(glock_mag);
|
||||
SAVE_STATE(mp5_mag);
|
||||
SAVE_STATE(python_mag);
|
||||
SAVE_STATE(shotgun_mag);
|
||||
SAVE_STATE(crossbow_mag);
|
||||
SAVE_STATE(rpg_mag);
|
||||
SAVE_STATE(satchel_chg);
|
||||
SAVE_STATE(ammo_9mm);
|
||||
SAVE_STATE(ammo_357);
|
||||
SAVE_STATE(ammo_buckshot);
|
||||
SAVE_STATE(ammo_bolt);
|
||||
SAVE_STATE(ammo_rocket);
|
||||
SAVE_STATE(ammo_uranium);
|
||||
SAVE_STATE(ammo_handgrenade);
|
||||
SAVE_STATE(ammo_satchel);
|
||||
SAVE_STATE(ammo_tripmine);
|
||||
SAVE_STATE(ammo_snark);
|
||||
SAVE_STATE(ammo_hornet);
|
||||
|
||||
glock_mag_net = glock_mag;
|
||||
mp5_mag_net = mp5_mag;
|
||||
python_mag_net = python_mag;
|
||||
shotgun_mag_net = shotgun_mag;
|
||||
crossbow_mag_net = crossbow_mag;
|
||||
rpg_mag_net = rpg_mag;
|
||||
satchel_chg_net = satchel_chg;
|
||||
SAVE_STATE(ammo_m203_grenade);
|
||||
SAVE_STATE(ammo_gauss_volume);
|
||||
SAVE_STATE(ammo_rpg_state);
|
||||
SAVE_STATE(mode_tempstate);
|
||||
|
||||
ammo_9mm_net = ammo_9mm;
|
||||
ammo_357_net = ammo_357;
|
||||
ammo_buckshot_net = ammo_buckshot;
|
||||
ammo_m203_grenade_net = ammo_m203_grenade;
|
||||
ammo_bolt_net = ammo_bolt;
|
||||
ammo_rocket_net = ammo_rocket;
|
||||
ammo_uranium_net = ammo_uranium;
|
||||
ammo_handgrenade_net = ammo_handgrenade;
|
||||
ammo_satchel_net = ammo_satchel;
|
||||
ammo_tripmine_net = ammo_tripmine;
|
||||
ammo_snark_net = ammo_snark;
|
||||
ammo_hornet_net = ammo_hornet;
|
||||
|
||||
ammo_m203_grenade_net = ammo_m203_grenade;
|
||||
ammo_gauss_volume_net = ammo_gauss_volume;
|
||||
ammo_rpg_state_net = ammo_rpg_state;
|
||||
mode_tempstate_net = mode_tempstate;
|
||||
|
||||
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;
|
||||
SAVE_STATE(anim_top);
|
||||
SAVE_STATE(anim_top_delay);
|
||||
SAVE_STATE(anim_top_time);
|
||||
SAVE_STATE(anim_bottom);
|
||||
SAVE_STATE(anim_bottom_time);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -508,14 +353,17 @@ player::SendEntity
|
|||
float
|
||||
player::SendEntity(entity ePEnt, float fChanged)
|
||||
{
|
||||
/* remove our entity to other clients if we're dead */
|
||||
if (health <= 0 && ePEnt != this) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* target client isn't real, they have no client-side. abandon */
|
||||
if (clienttype(ePEnt) != CLIENTTYPE_REAL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* other players don't need to know about these attributes */
|
||||
if (ePEnt != self) {
|
||||
fChanged &= ~PLAYER_ITEMS;
|
||||
fChanged &= ~PLAYER_HEALTH;
|
||||
|
@ -529,43 +377,8 @@ player::SendEntity(entity ePEnt, float fChanged)
|
|||
WriteByte(MSG_ENTITY, ENT_PLAYER);
|
||||
WriteFloat(MSG_ENTITY, fChanged);
|
||||
|
||||
/* really trying to get our moneys worth with 23 bits of mantissa */
|
||||
if (fChanged & PLAYER_MODELINDEX)
|
||||
WriteShort(MSG_ENTITY, modelindex);
|
||||
if (fChanged & PLAYER_ORIGIN) {
|
||||
WriteCoord(MSG_ENTITY, origin[0]);
|
||||
WriteCoord(MSG_ENTITY, origin[1]);
|
||||
}
|
||||
if (fChanged & PLAYER_ORIGIN_Z)
|
||||
WriteCoord(MSG_ENTITY, origin[2]);
|
||||
if (fChanged & PLAYER_ANGLES_X)
|
||||
WriteFloat(MSG_ENTITY, v_angle[0]);
|
||||
if (fChanged & PLAYER_ANGLES_Y)
|
||||
WriteFloat(MSG_ENTITY, angles[1]);
|
||||
if (fChanged & PLAYER_ANGLES_Z)
|
||||
WriteFloat(MSG_ENTITY, angles[2]);
|
||||
if (fChanged & PLAYER_VELOCITY) {
|
||||
WriteCoord(MSG_ENTITY, velocity[0]);
|
||||
WriteCoord(MSG_ENTITY, velocity[1]);
|
||||
}
|
||||
if (fChanged & PLAYER_VELOCITY_Z)
|
||||
WriteCoord(MSG_ENTITY, velocity[2]);
|
||||
if (fChanged & PLAYER_FLAGS) {
|
||||
WriteFloat(MSG_ENTITY, flags);
|
||||
WriteFloat(MSG_ENTITY, gflags);
|
||||
}
|
||||
if (fChanged & PLAYER_WEAPON)
|
||||
WriteByte(MSG_ENTITY, activeweapon);
|
||||
if (fChanged & PLAYER_ITEMS)
|
||||
WriteFloat(MSG_ENTITY, (__variant)g_items);
|
||||
if (fChanged & PLAYER_HEALTH)
|
||||
WriteByte(MSG_ENTITY, bound(0, health, 255));
|
||||
if (fChanged & PLAYER_ARMOR)
|
||||
WriteByte(MSG_ENTITY, armor);
|
||||
if (fChanged & PLAYER_MOVETYPE)
|
||||
WriteByte(MSG_ENTITY, movetype);
|
||||
if (fChanged & PLAYER_VIEWOFS)
|
||||
WriteFloat(MSG_ENTITY, view_ofs[2]);
|
||||
/* the generic client attributes */
|
||||
base_player::SendEntity(ePEnt, fChanged);
|
||||
|
||||
if (fChanged & PLAYER_TOPFRAME) {
|
||||
WriteByte(MSG_ENTITY, anim_top);
|
||||
|
|
|
@ -45,9 +45,6 @@ void GamePMove_Fall(player target, float impactspeed)
|
|||
|
||||
void GamePMove_Jump(player target)
|
||||
{
|
||||
float flJumptimeDelta;
|
||||
float flChainBonus;
|
||||
|
||||
if (target.waterlevel >= 2) {
|
||||
if (target.watertype == CONTENT_WATER) {
|
||||
target.velocity[2] = 100;
|
||||
|
@ -62,13 +59,7 @@ void GamePMove_Jump(player target)
|
|||
target.velocity = v_forward * 512;
|
||||
target.velocity[2] += 100;
|
||||
}
|
||||
target.velocity[2] += 240;
|
||||
if (target.flags & FL_ONGROUND)
|
||||
target.velocity[2] += 240;
|
||||
}
|
||||
|
||||
if (target.jumptime > 0) {
|
||||
flJumptimeDelta = 0 - (target.jumptime - PHY_JUMP_CHAINWINDOW);
|
||||
flChainBonus = PHY_JUMP_CHAIN - (((PHY_JUMP_CHAINWINDOW - (PHY_JUMP_CHAINWINDOW - flJumptimeDelta)) * 2) * PHY_JUMP_CHAINDECAY);
|
||||
target.velocity[2] += flChainBonus;
|
||||
}
|
||||
target.jumptime = PHY_JUMP_CHAINWINDOW;
|
||||
}
|
||||
|
|
|
@ -148,11 +148,11 @@ void w_egon_draw(void)
|
|||
player pl = (player)self;
|
||||
pl.mode_tempstate = 0;
|
||||
|
||||
/* link the FX class */
|
||||
#ifdef CLIENT
|
||||
Weapons_SetModel("models/v_egon.mdl");
|
||||
Weapons_ViewAnimation(EGON_DRAW);
|
||||
|
||||
/* link the FX class */
|
||||
#ifdef CLIENT
|
||||
entity eold = self;
|
||||
self = pSeat->m_pWeaponFX;
|
||||
spawnfunc_FXEgon();
|
||||
|
@ -181,11 +181,6 @@ void w_egon_primary(void)
|
|||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (Weapons_GetAnimation() == EGON_IDLE1)
|
||||
Weapons_ViewAnimation(EGON_ALTFIREON);
|
||||
else if (Weapons_GetAnimation() == EGON_ALTFIREON)
|
||||
Weapons_ViewAnimation(EGON_ALTFIRECYCLE);
|
||||
|
||||
FXEgon p = (FXEgon)pSeat->m_pWeaponFX;
|
||||
p.m_vecAngle = input_angles;
|
||||
p.m_vecStart = pl.origin + pl.view_ofs;
|
||||
|
@ -207,10 +202,12 @@ void w_egon_primary(void)
|
|||
#endif
|
||||
pl.mode_tempstate = 1;
|
||||
Weapons_ViewPunchAngle([-5,0,0]);
|
||||
pl.w_idle_next = 3.0f;
|
||||
Weapons_ViewAnimation(EGON_ALTFIREON);
|
||||
pl.w_idle_next = 1.5f;
|
||||
} else if not (pl.w_idle_next > 0.0f) {
|
||||
/* wait 3 seconds (idle next) */
|
||||
if (pl.mode_tempstate == 1) {
|
||||
Weapons_ViewAnimation(EGON_ALTFIRECYCLE);
|
||||
#ifdef SERVER
|
||||
sound(pl, CHAN_WEAPON, "weapons/egon_run3.wav", 1, ATTN_NORM, 100);
|
||||
#endif
|
||||
|
|
|
@ -139,18 +139,14 @@ w_glock_pickup(int new, int startammo)
|
|||
void
|
||||
w_glock_draw(void)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Weapons_SetModel("models/v_9mmhandgun.mdl");
|
||||
Weapons_ViewAnimation(GLOCK_DRAW);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_glock_holster(void)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(GLOCK_HOLSTER);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -172,6 +168,12 @@ w_glock_primary(void)
|
|||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_SMALL);
|
||||
View_AddEvent(w_glock_ejectshell, 0.0f);
|
||||
#else
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, Skill_GetValue("plr_9mm_bullet", 8), [0.01,0.01], WEAPON_GLOCK);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_glock.fire");
|
||||
#endif
|
||||
|
||||
Weapons_ViewPunchAngle([-2,0,0]);
|
||||
|
||||
if (pl.glock_mag) {
|
||||
|
@ -180,12 +182,6 @@ w_glock_primary(void)
|
|||
Weapons_ViewAnimation(GLOCK_SHOOT_EMPTY);
|
||||
}
|
||||
|
||||
View_AddEvent(w_glock_ejectshell, 0.0f);
|
||||
#else
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, Skill_GetValue("plr_9mm_bullet", 8), [0.01,0.01], WEAPON_GLOCK);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_glock.fire");
|
||||
#endif
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.2f);
|
||||
else
|
||||
|
@ -213,6 +209,12 @@ w_glock_secondary(void)
|
|||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_SMALL);
|
||||
View_AddEvent(w_glock_ejectshell, 0.0f);
|
||||
#else
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, Skill_GetValue("plr_9mm_bullet", 8), [0.1,0.1], WEAPON_GLOCK);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_glock.fire");
|
||||
#endif
|
||||
|
||||
Weapons_ViewPunchAngle([-2,0,0]);
|
||||
|
||||
if (pl.glock_mag) {
|
||||
|
@ -221,12 +223,6 @@ w_glock_secondary(void)
|
|||
Weapons_ViewAnimation(GLOCK_SHOOT_EMPTY);
|
||||
}
|
||||
|
||||
View_AddEvent(w_glock_ejectshell, 0.0f);
|
||||
#else
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, Skill_GetValue("plr_9mm_bullet", 8), [0.1,0.1], WEAPON_GLOCK);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_glock.fire");
|
||||
#endif
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOT1HAND, 0.2f);
|
||||
else
|
||||
|
|
|
@ -136,10 +136,8 @@ void w_handgrenade_draw(void)
|
|||
player pl = (player)self;
|
||||
pl.mode_tempstate = 0;
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_SetModel("models/v_grenade.mdl");
|
||||
Weapons_ViewAnimation(HANDGRENADE_DRAW);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_handgrenade_holster(void)
|
||||
|
@ -163,9 +161,7 @@ void w_handgrenade_primary(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(HANDGRENADE_PULLPIN);
|
||||
#endif
|
||||
|
||||
pl.mode_tempstate = 1;
|
||||
pl.w_attack_next = 0.5f;
|
||||
|
@ -190,9 +186,8 @@ void w_handgrenade_release(void)
|
|||
}
|
||||
|
||||
if (pl.mode_tempstate == 1) {
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(HANDGRENADE_THROW1);
|
||||
#else
|
||||
#ifdef SERVER
|
||||
w_handgrenade_throw();
|
||||
#endif
|
||||
pl.ammo_handgrenade--;
|
||||
|
@ -205,9 +200,8 @@ void w_handgrenade_release(void)
|
|||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTCROWBAR, 0.5f);
|
||||
} else if (pl.mode_tempstate == 2) {
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(HANDGRENADE_DRAW);
|
||||
#else
|
||||
#ifdef SERVER
|
||||
if (!pl.ammo_handgrenade) {
|
||||
Weapons_RemoveItem(pl, WEAPON_HANDGRENADE);
|
||||
}
|
||||
|
|
|
@ -110,10 +110,8 @@ w_mp5_deathmsg(void)
|
|||
void
|
||||
w_mp5_draw(void)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Weapons_SetModel("models/v_9mmar.mdl");
|
||||
Weapons_ViewAnimation(MP5_DRAW);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -187,10 +185,7 @@ w_mp5_secondary(void)
|
|||
|
||||
pl.ammo_m203_grenade--;
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewPunchAngle([-10,0,0]);
|
||||
Weapons_ViewAnimation(MP5_GRENADE);
|
||||
#else
|
||||
#ifdef SERVER
|
||||
static void Grenade_ExplodeTouch(void) {
|
||||
float dmg = Skill_GetValue("plr_9mmAR_grenade", 100);
|
||||
FX_Explosion(self.origin);
|
||||
|
@ -221,6 +216,9 @@ w_mp5_secondary(void)
|
|||
Sound_Play(pl, CHAN_WEAPON, "weapon_mp5.gl");
|
||||
#endif
|
||||
|
||||
Weapons_ViewPunchAngle([-10,0,0]);
|
||||
Weapons_ViewAnimation(MP5_GRENADE);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTMP5, 0.45f);
|
||||
else
|
||||
|
@ -246,9 +244,9 @@ w_mp5_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(MP5_RELOAD);
|
||||
#else
|
||||
|
||||
#ifdef SERVER
|
||||
Weapons_ReloadWeapon(pl, player::mp5_mag, player::ammo_9mm, 50);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -105,25 +105,22 @@ w_python_deathmsg(void)
|
|||
void
|
||||
w_python_draw(void)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Weapons_SetModel("models/v_357.mdl");
|
||||
|
||||
/* singleplayer doesn't do scope */
|
||||
if (cvar("sv_playerslots") == 1) {
|
||||
if (serverkeyfloat("sv_playerslots") == 1) {
|
||||
Weapons_SetGeomset("geomset 4 1\n");
|
||||
} else {
|
||||
Weapons_SetGeomset("geomset 4 2\n");
|
||||
}
|
||||
|
||||
Weapons_ViewAnimation(PYTHON_DRAW);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
w_python_holster(void)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(PYTHON_HOLSTER);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -145,13 +142,14 @@ w_python_primary(void)
|
|||
/* Actual firing */
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_SMALL);
|
||||
Weapons_ViewPunchAngle([-10,0,0]);
|
||||
Weapons_ViewAnimation(PYTHON_FIRE1);
|
||||
#else
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, Skill_GetValue("plr_357_bullet", 40), [0.008, 0.008], WEAPON_PYTHON);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_357.shoot");
|
||||
#endif
|
||||
|
||||
Weapons_ViewPunchAngle([-10,0,0]);
|
||||
Weapons_ViewAnimation(PYTHON_FIRE1);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTPYTHON, 0.43f);
|
||||
else
|
||||
|
@ -171,7 +169,7 @@ w_python_secondary(void)
|
|||
}
|
||||
|
||||
/* singleplayer doesn't do scope */
|
||||
if (cvar("sv_playerslots") == 1) {
|
||||
if (serverkeyfloat("sv_playerslots") == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -203,9 +201,9 @@ w_python_reload(void)
|
|||
}
|
||||
|
||||
/* Audio-Visual bit */
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(PYTHON_RELOAD);
|
||||
#else
|
||||
|
||||
#ifdef SERVER
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_357.reload");
|
||||
Weapons_ReloadWeapon(pl, player::python_mag, player::ammo_357, 6);
|
||||
#endif
|
||||
|
|
|
@ -87,10 +87,8 @@ int w_rpg_pickup(int new, int startammo)
|
|||
|
||||
void w_rpg_draw(void)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Weapons_SetModel("models/v_rpg.mdl");
|
||||
Weapons_ViewAnimation(RPG_DRAW1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_rpg_holster(void)
|
||||
|
@ -112,10 +110,7 @@ void w_rpg_primary(void)
|
|||
|
||||
pl.rpg_mag--;
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(RPG_FIRE2);
|
||||
Weapons_ViewPunchAngle([-10,0,0]);
|
||||
#else
|
||||
#ifdef SERVER
|
||||
static void Rocket_Touch(void) {
|
||||
float dmg = Skill_GetValue("plr_rpg", 100);
|
||||
FX_Explosion(self.origin);
|
||||
|
@ -162,6 +157,9 @@ void w_rpg_primary(void)
|
|||
Sound_Play(pl, CHAN_WEAPON, "weapon_rpg.shoot");
|
||||
#endif
|
||||
|
||||
Weapons_ViewAnimation(RPG_FIRE2);
|
||||
Weapons_ViewPunchAngle([-10,0,0]);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTRPG, 0.43f);
|
||||
else
|
||||
|
@ -187,10 +185,10 @@ void w_rpg_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
/* Audio-Visual Bit */
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(RPG_RELOAD);
|
||||
#else
|
||||
|
||||
/* Audio-Visual Bit */
|
||||
#ifdef SERVER
|
||||
Weapons_ReloadWeapon(pl, player::rpg_mag, player::ammo_rocket, 1);
|
||||
#endif
|
||||
|
||||
|
@ -215,7 +213,7 @@ void w_rpg_release(void)
|
|||
|
||||
int r = (float)input_sequence % 3;
|
||||
|
||||
if (pl.a_ammo1 > 0) {
|
||||
if (pl.rpg_mag > 0) {
|
||||
if (r == 1) {
|
||||
Weapons_ViewAnimation(RPG_FIDGET);
|
||||
} else {
|
||||
|
|
|
@ -141,7 +141,6 @@ w_satchel_pickup(int new, int startammo)
|
|||
void
|
||||
w_satchel_draw(void)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
if (pl.satchel_chg > 0) {
|
||||
Weapons_SetModel("models/v_satchel_radio.mdl");
|
||||
|
@ -151,7 +150,6 @@ w_satchel_draw(void)
|
|||
Weapons_SetModel("models/v_satchel.mdl");
|
||||
Weapons_ViewAnimation(SATCHEL_DRAW);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -235,14 +233,14 @@ w_satchel_secondary(void)
|
|||
return;
|
||||
}
|
||||
|
||||
Weapons_SetModel("models/v_satchel_radio.mdl");
|
||||
Weapons_ViewAnimation(RADIO_DRAW);
|
||||
|
||||
#ifdef SERVER
|
||||
vector throw;
|
||||
Weapons_MakeVectors();
|
||||
throw = pl.velocity + (v_forward * 274);
|
||||
s_satchel_drop(self, pl.origin, throw);
|
||||
#else
|
||||
Weapons_SetModel("models/v_satchel_radio.mdl");
|
||||
Weapons_ViewAnimation(RADIO_DRAW);
|
||||
#endif
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
|
|
|
@ -143,10 +143,8 @@ w_shotgun_draw(void)
|
|||
player pl = (player)self;
|
||||
pl.mode_tempstate = 0;
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_SetModel("models/v_shotgun.mdl");
|
||||
Weapons_ViewAnimation(SHOTGUN_DRAW);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -177,7 +175,7 @@ w_shotgun_primary(void)
|
|||
|
||||
#ifdef SERVER
|
||||
/* Singleplayer is more accurate */
|
||||
if (cvar("sv_playerslots") == 1) {
|
||||
if (serverkeyfloat("sv_playerslots") == 1) {
|
||||
TraceAttack_FireBullets(6, pl.origin + pl.view_ofs, Skill_GetValue("plr_buckshot", 5), [0.08716,0.08716], WEAPON_SHOTGUN);
|
||||
} else {
|
||||
TraceAttack_FireBullets(4, pl.origin + pl.view_ofs, Skill_GetValue("plr_buckshot", 5), [0.08716,0.04362], WEAPON_SHOTGUN);
|
||||
|
@ -185,11 +183,12 @@ w_shotgun_primary(void)
|
|||
Sound_Play(pl, CHAN_WEAPON, "weapon_shotgun.single");
|
||||
#else
|
||||
View_SetMuzzleflash(MUZZLE_WEIRD);
|
||||
Weapons_ViewAnimation(SHOTGUN_FIRE1);
|
||||
Weapons_ViewPunchAngle([-5,0,0]);
|
||||
View_AddEvent(w_shotgun_ejectshell, 0.5f);
|
||||
#endif
|
||||
|
||||
Weapons_ViewAnimation(SHOTGUN_FIRE1);
|
||||
Weapons_ViewPunchAngle([-5,0,0]);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTSHOTGUN, 0.41f);
|
||||
else
|
||||
|
@ -222,9 +221,17 @@ w_shotgun_secondary(void)
|
|||
return;
|
||||
}
|
||||
|
||||
Weapons_ViewAnimation(SHOTGUN_FIRE2);
|
||||
Weapons_ViewPunchAngle([-10,0,0]);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTSHOTGUN, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTSHOTGUN, 0.5f);
|
||||
|
||||
#ifdef SERVER
|
||||
/* Singleplayer is more accurate */
|
||||
if (cvar("sv_playerslots") == 1) {
|
||||
if (serverkeyfloat("sv_playerslots") == 1) {
|
||||
TraceAttack_FireBullets(12, pl.origin + pl.view_ofs, 5, [0.08716,0.08716], WEAPON_SHOTGUN);
|
||||
} else {
|
||||
TraceAttack_FireBullets(8, pl.origin + pl.view_ofs, 5, [0.17365,0.04362], WEAPON_SHOTGUN);
|
||||
|
@ -232,16 +239,8 @@ w_shotgun_secondary(void)
|
|||
Sound_Play(pl, CHAN_WEAPON, "weapon_shotgun.double");
|
||||
#else
|
||||
View_SetMuzzleflash(MUZZLE_WEIRD);
|
||||
Weapons_ViewAnimation(SHOTGUN_FIRE2);
|
||||
Weapons_ViewPunchAngle([-10,0,0]);
|
||||
View_AddEvent(w_shotgun_ejectshell, 1.0f);
|
||||
#endif
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTSHOTGUN, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTSHOTGUN, 0.5f);
|
||||
|
||||
/* after 1 second, play the cocksound and eject shell */
|
||||
pl.mode_tempstate = SHOTTY_COCKSOUND;
|
||||
pl.w_idle_next = 1.0f;
|
||||
|
|
|
@ -183,9 +183,14 @@ void w_snark_primary(void)
|
|||
pl.ammo_snark--;
|
||||
|
||||
/* Audio-Visual Bit */
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(SNARK_THROW);
|
||||
#else
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTSQUEAK, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTSQUEAK, 0.5f);
|
||||
|
||||
#ifdef SERVER
|
||||
w_snark_deploy();
|
||||
|
||||
if (pl.ammo_snark <= 0) {
|
||||
|
@ -193,11 +198,6 @@ void w_snark_primary(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTSQUEAK, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTSQUEAK, 0.5f);
|
||||
|
||||
pl.w_idle_next = 1.0f;
|
||||
pl.w_attack_next = 0.25f;
|
||||
|
||||
|
@ -214,6 +214,7 @@ void w_snark_release(void)
|
|||
{
|
||||
int r;
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.w_idle_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
@ -234,6 +235,7 @@ void w_snark_release(void)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void w_snark_precache(void)
|
||||
{
|
||||
#ifdef SERVER
|
||||
|
@ -248,24 +250,27 @@ void w_snark_precache(void)
|
|||
precache_model("models/v_squeak.mdl");
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_snark_updateammo(player pl)
|
||||
{
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_snark, -1);
|
||||
}
|
||||
|
||||
string w_snark_wmodel(void)
|
||||
{
|
||||
return "models/w_sqknest.mdl";
|
||||
}
|
||||
|
||||
string w_snark_pmodel(void)
|
||||
{
|
||||
return "models/p_squeak.mdl";
|
||||
}
|
||||
|
||||
string w_snark_deathmsg(void)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
float w_snark_aimanim(void)
|
||||
{
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMSQUEAK : ANIM_AIMSQUEAK;
|
||||
|
|
|
@ -247,10 +247,8 @@ int w_tripmine_pickup(int new, int startammo)
|
|||
|
||||
void w_tripmine_draw(void)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Weapons_SetModel("models/v_tripmine.mdl");
|
||||
Weapons_ViewAnimation(TRIPMINE_DRAW);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_tripmine_holster(void)
|
||||
|
@ -282,9 +280,14 @@ w_tripmine_primary(void)
|
|||
|
||||
pl.ammo_tripmine--;
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(TRIPMINE_FIRE2);
|
||||
#else
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTTRIPMINE, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTTRIPMINE, 0.5f);
|
||||
|
||||
#ifdef SERVER
|
||||
vector ang = vectoangles(trace_plane_normal);
|
||||
monster_tripmine mine = spawn(monster_tripmine, real_owner: pl, angles: ang, spawnflags: MSF_MULTIPLAYER);
|
||||
mine.SetOrigin(trace_endpos - (v_forward * 8));
|
||||
|
@ -293,11 +296,6 @@ w_tripmine_primary(void)
|
|||
Sound_Play(mine, CHAN_WEAPON, "weapon_tripmine.charge");
|
||||
#endif
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTop(pl, ANIM_CR_SHOOTTRIPMINE, 0.41f);
|
||||
else
|
||||
Animation_PlayerTop(pl, ANIM_SHOOTTRIPMINE, 0.5f);
|
||||
|
||||
pl.a_ammo3 = 1;
|
||||
pl.w_attack_next =
|
||||
pl.w_idle_next = 0.5f;
|
||||
|
|
|
@ -56,9 +56,9 @@ int Weapons_IsPresent(player, int);
|
|||
void Weapons_SetModel(string);
|
||||
void Weapons_SetGeomset(string);
|
||||
void Weapons_UpdateAmmo(base_player, int, int, int);
|
||||
int Weapons_GetAnimation(void);
|
||||
|
||||
#ifdef CLIENT
|
||||
string Weapons_GetPlayermodel(int);
|
||||
int Weapons_GetAnimation(void);
|
||||
void Weapons_HUDPic(int, int, vector, float);
|
||||
#endif
|
||||
|
|
|
@ -264,18 +264,22 @@ void Weapons_ViewAnimation(int i)
|
|||
|
||||
#ifdef CLIENT
|
||||
int View_GetAnimation(void);
|
||||
int Weapons_GetAnimation(void)
|
||||
{
|
||||
return View_GetAnimation();
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
Weapons_GetAnimation(void)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
return View_GetAnimation();
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Weapons_ViewPunchAngle(vector add)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
pl.punchangle += add;
|
||||
#endif
|
||||
}
|
||||
|
||||
int Weapons_IsPresent(player pl, int w)
|
||||
|
|
Loading…
Reference in a new issue