Base, Half-Life, Counter-Strike, Opposing Force and Scientist Hunt have
now been reworked to have fully networked ammo that's also fully affected by rollback netcode. Big diff, mods WILL break. Beware.
This commit is contained in:
parent
71f7e024c9
commit
fc75a1be11
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -14,6 +14,34 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* all potential SendFlags bits we can possibly send */
|
||||
enumflags
|
||||
{
|
||||
PLAYER_KEEPALIVE,
|
||||
PLAYER_MODELINDEX,
|
||||
PLAYER_ORIGIN,
|
||||
PLAYER_ORIGIN_Z,
|
||||
PLAYER_ANGLES_X,
|
||||
PLAYER_ANGLES_Y,
|
||||
PLAYER_ANGLES_Z,
|
||||
PLAYER_VELOCITY,
|
||||
PLAYER_VELOCITY_Z,
|
||||
PLAYER_FLAGS,
|
||||
PLAYER_WEAPON,
|
||||
PLAYER_ITEMS,
|
||||
PLAYER_HEALTH,
|
||||
PLAYER_ARMOR,
|
||||
PLAYER_MOVETYPE,
|
||||
PLAYER_VIEWOFS,
|
||||
PLAYER_BASEFRAME,
|
||||
PLAYER_FRAME,
|
||||
PLAYER_AMMO1,
|
||||
PLAYER_AMMO2,
|
||||
PLAYER_AMMO3,
|
||||
PLAYER_UNUSED1,
|
||||
PLAYER_UNUSED2
|
||||
};
|
||||
|
||||
noref int input_sequence;
|
||||
class player:base_player
|
||||
{
|
||||
|
@ -28,7 +56,312 @@ class player:base_player
|
|||
virtual void(void) draw;
|
||||
virtual float() predraw;
|
||||
virtual void(void) postdraw;
|
||||
virtual void(float) ReceiveEntity;
|
||||
virtual void(void) PredictPreFrame;
|
||||
virtual void(void) PredictPostFrame;
|
||||
#else
|
||||
virtual void(void) EvaluateEntity;
|
||||
virtual float(entity, float) SendEntity;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef CLIENT
|
||||
//void Weapons_AmmoUpdate(entity);
|
||||
/*
|
||||
=================
|
||||
player::ReceiveEntity
|
||||
=================
|
||||
*/
|
||||
void
|
||||
player::ReceiveEntity(float new)
|
||||
{
|
||||
float fl;
|
||||
if (new == FALSE) {
|
||||
/* Go through all the physics code between the last received frame
|
||||
* and the newest frame and keep the changes this time around instead
|
||||
* of rolling back, because we'll apply the new server-verified values
|
||||
* right after anyway. */
|
||||
/* FIXME: splitscreen */
|
||||
if (entnum == player_localentnum) {
|
||||
/* FIXME: splitscreen */
|
||||
pSeat = &g_seats[0];
|
||||
|
||||
for (int i = sequence+1; i <= servercommandframe; i++) {
|
||||
/* ...maybe the input state is too old? */
|
||||
if (!getinputstate(i)) {
|
||||
break;
|
||||
}
|
||||
input_sequence = i;
|
||||
PMove_Run();
|
||||
}
|
||||
|
||||
/* any differences in things that are read below are now
|
||||
* officially from prediction misses. */
|
||||
}
|
||||
}
|
||||
|
||||
/* 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();
|
||||
if (fl & PLAYER_BASEFRAME)
|
||||
baseframe = readbyte();
|
||||
if (fl & PLAYER_FRAME) {
|
||||
frame = readbyte();
|
||||
frame1time = 0.0f;
|
||||
frame2time = 0.0f;
|
||||
}
|
||||
|
||||
if (fl & PLAYER_AMMO1) {
|
||||
}
|
||||
|
||||
if (fl & PLAYER_AMMO2) {
|
||||
}
|
||||
|
||||
if (fl & PLAYER_AMMO3) {
|
||||
}
|
||||
|
||||
//if (fl & PLAYER_AMMO1 || fl & PLAYER_AMMO2 || fl & PLAYER_AMMO3)
|
||||
// Weapons_AmmoUpdate(this);
|
||||
|
||||
setorigin(this, origin);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
player::PredictPostFrame
|
||||
|
||||
Save the last valid server values away in the _net variants of each field
|
||||
so we can roll them back later.
|
||||
=================
|
||||
*/
|
||||
void
|
||||
player::PredictPreFrame(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
player::PredictPostFrame
|
||||
|
||||
Where we roll back our values to the ones last sent/verified by the server.
|
||||
=================
|
||||
*/
|
||||
void
|
||||
player::PredictPostFrame(void)
|
||||
{
|
||||
}
|
||||
|
||||
#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;
|
||||
|
||||
if (old_baseframe != baseframe)
|
||||
SendFlags |= PLAYER_BASEFRAME;
|
||||
|
||||
if (old_frame != frame)
|
||||
SendFlags |= PLAYER_FRAME;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
player::SendEntity
|
||||
=================
|
||||
*/
|
||||
float
|
||||
player::SendEntity(entity ePEnt, float fChanged)
|
||||
{
|
||||
if (health <= 0 && ePEnt != this) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (clienttype(ePEnt) != CLIENTTYPE_REAL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (ePEnt != self) {
|
||||
fChanged &= ~PLAYER_ITEMS;
|
||||
fChanged &= ~PLAYER_HEALTH;
|
||||
fChanged &= ~PLAYER_ARMOR;
|
||||
fChanged &= ~PLAYER_VIEWOFS;
|
||||
fChanged &= ~PLAYER_AMMO1;
|
||||
fChanged &= ~PLAYER_AMMO2;
|
||||
fChanged &= ~PLAYER_AMMO3;
|
||||
}
|
||||
|
||||
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]);
|
||||
if (fChanged & PLAYER_BASEFRAME)
|
||||
WriteByte(MSG_ENTITY, baseframe);
|
||||
if (fChanged & PLAYER_FRAME)
|
||||
WriteByte(MSG_ENTITY, frame);
|
||||
|
||||
if (fChanged & PLAYER_AMMO1) {
|
||||
}
|
||||
|
||||
if (fChanged & PLAYER_AMMO2) {
|
||||
}
|
||||
|
||||
if (fChanged & PLAYER_AMMO3) {
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -281,3 +281,29 @@ int Weapons_IsPresent(player pl, int w)
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
/*
|
||||
=================
|
||||
Weapons_UpdateAmmo
|
||||
|
||||
Sets .a_ammoX fields and clamps them so they can be networked as a single byte.
|
||||
=================
|
||||
*/
|
||||
void
|
||||
Weapons_UpdateAmmo(base_player pl, int a1, int a2, int a3)
|
||||
{
|
||||
/* no change */
|
||||
if (a1 == -1) {
|
||||
a1 = pl.a_ammo1;
|
||||
}
|
||||
if (a2 == -1) {
|
||||
a2 = pl.a_ammo2;
|
||||
}
|
||||
if (a3 == -1) {
|
||||
a3 = pl.a_ammo3;
|
||||
}
|
||||
|
||||
/* networked as bytes, since we don't need more. Clamp to avoid errors */
|
||||
pl.a_ammo1 = bound(0, a1, 255);
|
||||
pl.a_ammo2 = bound(0, a2, 255);
|
||||
pl.a_ammo3 = bound(0, a3, 255);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -37,13 +37,13 @@ Cstrike_DrawCrosshair(void)
|
|||
}
|
||||
|
||||
/* amount of shots that we've shot does affect our accuracy */
|
||||
if (pl.cs_shotmultiplier > pl.cs_old_shotmultiplier) {
|
||||
if (pl.cs_shotmultiplier > pl.cs_shotmultiplier_net) {
|
||||
pl.cs_crosshairdistance = min(15, pl.cs_crosshairdistance + delta);
|
||||
} else if (pl.cs_crosshairdistance > distance) {
|
||||
pl.cs_crosshairdistance -= (pl.cs_crosshairdistance * clframetime);
|
||||
}
|
||||
|
||||
pl.cs_old_shotmultiplier = pl.cs_shotmultiplier;
|
||||
pl.cs_shotmultiplier_net = pl.cs_shotmultiplier;
|
||||
|
||||
if (pl.cs_crosshairdistance < distance) {
|
||||
pl.cs_crosshairdistance = distance;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -26,8 +26,6 @@ Propagate our pmove state to whatever the current frame before its stomped on
|
|||
void
|
||||
GamePredict_PreFrame(player pl)
|
||||
{
|
||||
pl.net_cs_shotmultiplier = pl.cs_shotmultiplier;
|
||||
pl.net_cs_shottime = pl.cs_shottime;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -42,6 +40,4 @@ Rewind our pmove state back to before we started predicting.
|
|||
void
|
||||
GamePredict_PostFrame(player pl)
|
||||
{
|
||||
pl.cs_shotmultiplier = pl.net_cs_shotmultiplier;
|
||||
pl.cs_shottime = pl.net_cs_shottime;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -37,107 +37,7 @@ CSGameRules::BuyingPossible(base_player pl)
|
|||
void
|
||||
CSGameRules::PlayerPostFrame(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
|
||||
Animation_PlayerUpdate();
|
||||
|
||||
if (autocvar_sv_playerkeepalive)
|
||||
pl.SendFlags |= PLAYER_KEEPALIVE;
|
||||
|
||||
if (pl.old_modelindex != pl.modelindex)
|
||||
pl.SendFlags |= PLAYER_MODELINDEX;
|
||||
|
||||
if (pl.old_origin[0] != pl.origin[0])
|
||||
pl.SendFlags |= PLAYER_ORIGIN;
|
||||
|
||||
if (pl.old_origin[1] != pl.origin[1])
|
||||
pl.SendFlags |= PLAYER_ORIGIN;
|
||||
|
||||
if (pl.old_origin[2] != pl.origin[2])
|
||||
pl.SendFlags |= PLAYER_ORIGIN_Z;
|
||||
|
||||
if (pl.old_angles[0] != pl.v_angle[0])
|
||||
pl.SendFlags |= PLAYER_ANGLES_X;
|
||||
|
||||
if (pl.old_angles[1] != pl.angles[1])
|
||||
pl.SendFlags |= PLAYER_ANGLES_Y;
|
||||
|
||||
if (pl.old_angles[2] != pl.angles[2])
|
||||
pl.SendFlags |= PLAYER_ANGLES_Z;
|
||||
|
||||
if (pl.old_velocity[0] != pl.velocity[0])
|
||||
pl.SendFlags |= PLAYER_VELOCITY;
|
||||
|
||||
if (pl.old_velocity[1] != pl.velocity[1])
|
||||
pl.SendFlags |= PLAYER_VELOCITY;
|
||||
|
||||
if (pl.old_velocity[2] != pl.velocity[2])
|
||||
pl.SendFlags |= PLAYER_VELOCITY_Z;
|
||||
|
||||
if (pl.old_flags != pl.flags)
|
||||
pl.SendFlags |= PLAYER_FLAGS;
|
||||
|
||||
if (pl.old_gflags != pl.gflags)
|
||||
pl.SendFlags |= PLAYER_FLAGS;
|
||||
|
||||
if (pl.old_activeweapon != pl.activeweapon)
|
||||
pl.SendFlags |= PLAYER_WEAPON;
|
||||
|
||||
if (pl.old_items != pl.g_items)
|
||||
pl.SendFlags |= PLAYER_ITEMS;
|
||||
|
||||
if (pl.old_health != pl.health)
|
||||
pl.SendFlags |= PLAYER_HEALTH;
|
||||
|
||||
if (pl.old_armor != pl.armor)
|
||||
pl.SendFlags |= PLAYER_ARMOR;
|
||||
|
||||
if (pl.old_movetype != pl.movetype)
|
||||
pl.SendFlags |= PLAYER_MOVETYPE;
|
||||
|
||||
if (pl.old_viewofs != pl.view_ofs[2])
|
||||
pl.SendFlags |= PLAYER_VIEWOFS;
|
||||
|
||||
if (pl.old_baseframe != pl.baseframe)
|
||||
pl.SendFlags |= PLAYER_BASEFRAME;
|
||||
|
||||
if (pl.old_frame != pl.frame)
|
||||
pl.SendFlags |= PLAYER_FRAME;
|
||||
|
||||
if (pl.old_a_ammo1 != pl.a_ammo1)
|
||||
pl.SendFlags |= PLAYER_AMMO1;
|
||||
|
||||
if (pl.old_a_ammo2 != pl.a_ammo2)
|
||||
pl.SendFlags |= PLAYER_AMMO2;
|
||||
|
||||
if (pl.old_a_ammo3 != pl.a_ammo3)
|
||||
pl.SendFlags |= PLAYER_AMMO3;
|
||||
|
||||
pl.old_modelindex = pl.modelindex;
|
||||
pl.old_origin = pl.origin;
|
||||
pl.old_angles = pl.angles;
|
||||
pl.old_angles[0] = pl.v_angle[0];
|
||||
pl.old_velocity = pl.velocity;
|
||||
pl.old_flags = pl.flags;
|
||||
pl.old_gflags = pl.gflags;
|
||||
pl.old_activeweapon = pl.activeweapon;
|
||||
pl.old_items = pl.g_items;
|
||||
pl.old_health = pl.health;
|
||||
pl.old_armor = pl.armor;
|
||||
pl.old_movetype = pl.movetype;
|
||||
pl.old_viewofs = pl.view_ofs[2];
|
||||
pl.old_baseframe = pl.baseframe;
|
||||
pl.old_frame = pl.frame;
|
||||
pl.old_a_ammo1 = pl.a_ammo1;
|
||||
pl.old_a_ammo2 = pl.a_ammo2;
|
||||
pl.old_a_ammo3 = pl.a_ammo3;
|
||||
pl.old_cs_shotmultiplier = pl.cs_shotmultiplier;
|
||||
pl.old_cs_shottime = pl.cs_shottime;
|
||||
|
||||
if (g_cs_gamestate != GAME_FREEZE) {
|
||||
if (pl.progress <= 0.0f)
|
||||
pl.flags &= ~FL_FROZEN;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -866,7 +866,6 @@ CSMultiplayerRules::PlayerMakeSpectator(base_player pl)
|
|||
pl.takedamage = DAMAGE_NO;
|
||||
pl.solid = SOLID_NOT;
|
||||
pl.movetype = MOVETYPE_NOCLIP;
|
||||
pl.SendEntity = Player_SendEntity;
|
||||
pl.flags = FL_CLIENT;
|
||||
pl.weapon = 0;
|
||||
pl.viewzoom = 1.0f;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -50,7 +50,6 @@ CSSingleplayerRules::PlayerSpawn(base_player pl)
|
|||
pl.velocity = [0,0,0];
|
||||
pl.gravity = __NULL__;
|
||||
pl.frame = 1;
|
||||
pl.SendEntity = Player_SendEntity;
|
||||
pl.SendFlags = UPDATE_ALL;
|
||||
pl.customphysics = Empty;
|
||||
pl.iBleeds = TRUE;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -73,96 +73,6 @@ void Player_UseUp(void) {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Player_SendEntity
|
||||
=================
|
||||
*/
|
||||
float Player_SendEntity(entity ePEnt, float fChanged)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.health <= 0 && ePEnt != pl) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
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, pl.modelindex);
|
||||
}
|
||||
if (fChanged & PLAYER_ORIGIN) {
|
||||
WriteCoord(MSG_ENTITY, pl.origin[0]);
|
||||
WriteCoord(MSG_ENTITY, pl.origin[1]);
|
||||
}
|
||||
if (fChanged & PLAYER_ORIGIN_Z) {
|
||||
WriteCoord(MSG_ENTITY, pl.origin[2]);
|
||||
}
|
||||
if (fChanged & PLAYER_ANGLES_X) {
|
||||
WriteFloat(MSG_ENTITY, pl.v_angle[0]);
|
||||
}
|
||||
if (fChanged & PLAYER_ANGLES_Y) {
|
||||
WriteFloat(MSG_ENTITY, pl.angles[1]);
|
||||
}
|
||||
if (fChanged & PLAYER_ANGLES_Z) {
|
||||
WriteFloat(MSG_ENTITY, pl.angles[2]);
|
||||
}
|
||||
if (fChanged & PLAYER_VELOCITY) {
|
||||
WriteCoord(MSG_ENTITY, pl.velocity[0]);
|
||||
WriteCoord(MSG_ENTITY, pl.velocity[1]);
|
||||
}
|
||||
if (fChanged & PLAYER_VELOCITY_Z) {
|
||||
WriteCoord(MSG_ENTITY, pl.velocity[2]);
|
||||
}
|
||||
if (fChanged & PLAYER_FLAGS) {
|
||||
WriteFloat(MSG_ENTITY, pl.flags);
|
||||
WriteFloat(MSG_ENTITY, pl.gflags);
|
||||
}
|
||||
if (fChanged & PLAYER_WEAPON) {
|
||||
WriteByte(MSG_ENTITY, pl.activeweapon);
|
||||
}
|
||||
if (fChanged & PLAYER_ITEMS) {
|
||||
WriteFloat(MSG_ENTITY, (__variant)pl.g_items);
|
||||
}
|
||||
if (fChanged & PLAYER_HEALTH) {
|
||||
WriteByte(MSG_ENTITY, pl.health);
|
||||
}
|
||||
if (fChanged & PLAYER_ARMOR) {
|
||||
WriteByte(MSG_ENTITY, pl.armor);
|
||||
}
|
||||
if (fChanged & PLAYER_MOVETYPE) {
|
||||
WriteByte(MSG_ENTITY, pl.movetype);
|
||||
}
|
||||
if (fChanged & PLAYER_VIEWOFS) {
|
||||
WriteFloat(MSG_ENTITY, pl.view_ofs[2]);
|
||||
}
|
||||
if (fChanged & PLAYER_BASEFRAME) {
|
||||
WriteByte(MSG_ENTITY, pl.baseframe);
|
||||
}
|
||||
if (fChanged & PLAYER_FRAME) {
|
||||
WriteByte(MSG_ENTITY, pl.frame);
|
||||
}
|
||||
if (fChanged & PLAYER_AMMO1) {
|
||||
WriteByte(MSG_ENTITY, pl.a_ammo1);
|
||||
}
|
||||
if (fChanged & PLAYER_AMMO2) {
|
||||
WriteByte(MSG_ENTITY, pl.a_ammo2);
|
||||
}
|
||||
if (fChanged & PLAYER_AMMO3) {
|
||||
WriteByte(MSG_ENTITY, pl.a_ammo3);
|
||||
}
|
||||
if (fChanged & PLAYER_CSSHOT) {
|
||||
WriteByte(MSG_ENTITY, pl.cs_shotmultiplier);
|
||||
}
|
||||
if (fChanged & PLAYER_CSSHOTTIME) {
|
||||
WriteFloat(MSG_ENTITY, pl.cs_shottime);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void Weapons_Draw(void);
|
||||
void CSEv_PlayerSwitchWeapon_i(int w)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -14,13 +14,176 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
enumflags
|
||||
{
|
||||
PLAYER_KEEPALIVE,
|
||||
PLAYER_MODELINDEX,
|
||||
PLAYER_ORIGIN,
|
||||
PLAYER_ORIGIN_Z,
|
||||
PLAYER_ANGLES_X,
|
||||
PLAYER_ANGLES_Y,
|
||||
PLAYER_ANGLES_Z,
|
||||
PLAYER_VELOCITY,
|
||||
PLAYER_VELOCITY_Z,
|
||||
PLAYER_FLAGS,
|
||||
PLAYER_WEAPON,
|
||||
PLAYER_ITEMS,
|
||||
PLAYER_HEALTH,
|
||||
PLAYER_ARMOR,
|
||||
PLAYER_MOVETYPE,
|
||||
PLAYER_VIEWOFS,
|
||||
PLAYER_BASEFRAME,
|
||||
PLAYER_FRAME,
|
||||
PLAYER_AMMO1,
|
||||
PLAYER_AMMO2,
|
||||
PLAYER_AMMO3,
|
||||
PLAYER_CSSHOT,
|
||||
PLAYER_CSSHOTTIME
|
||||
};
|
||||
|
||||
enumflags
|
||||
{
|
||||
AMMO1_USP45,
|
||||
AMMO1_GLOCK18,
|
||||
AMMO1_DEAGLE,
|
||||
AMMO1_P228,
|
||||
AMMO1_ELITES,
|
||||
AMMO1_FIVESEVEN,
|
||||
AMMO1_M3,
|
||||
AMMO1_XM1014,
|
||||
AMMO1_MP5,
|
||||
AMMO1_P90,
|
||||
AMMO1_UMP45,
|
||||
AMMO1_MAC10,
|
||||
AMMO1_TMP,
|
||||
AMMO1_AK47,
|
||||
AMMO1_SG552,
|
||||
AMMO1_M4A1,
|
||||
AMMO1_AUG,
|
||||
AMMO1_SCOUT,
|
||||
AMMO1_AWP,
|
||||
AMMO1_G3SG1,
|
||||
AMMO1_SG550,
|
||||
AMMO1_PARA,
|
||||
};
|
||||
|
||||
enumflags
|
||||
{
|
||||
AMMO2_50AE,
|
||||
AMMO2_762MM,
|
||||
AMMO2_556MM,
|
||||
AMMO2_556MMBOX,
|
||||
AMMO2_338MAG,
|
||||
AMMO2_9MM,
|
||||
AMMO2_BUCKSHOT,
|
||||
AMMO2_45ACP,
|
||||
AMMO2_357SIG,
|
||||
AMMO2_57MM,
|
||||
AMMO2_HEGRENADE,
|
||||
AMMO2_FBGRENADE,
|
||||
AMMO2_SMOKEGRENADE,
|
||||
};
|
||||
|
||||
enumflags
|
||||
{
|
||||
AMMO3_MODE_USP45,
|
||||
AMMO3_MODE_M4A1,
|
||||
AMMO3_MODE_GLOCK18,
|
||||
};
|
||||
|
||||
noref int input_sequence;
|
||||
class player:base_player
|
||||
{
|
||||
int cs_shotmultiplier;
|
||||
float cs_shottime;
|
||||
int ingame;
|
||||
|
||||
int ammo_50ae;
|
||||
int ammo_50ae_net;
|
||||
int ammo_762mm;
|
||||
int ammo_762mm_net;
|
||||
int ammo_556mm;
|
||||
int ammo_556mm_net;
|
||||
int ammo_556mmbox;
|
||||
int ammo_556mmbox_net;
|
||||
int ammo_338mag;
|
||||
int ammo_338mag_net;
|
||||
int ammo_9mm;
|
||||
int ammo_9mm_net;
|
||||
int ammo_buckshot;
|
||||
int ammo_buckshot_net;
|
||||
int ammo_45acp;
|
||||
int ammo_45acp_net;
|
||||
int ammo_357sig;
|
||||
int ammo_357sig_net;
|
||||
int ammo_57mm;
|
||||
int ammo_57mm_net;
|
||||
int ammo_hegrenade;
|
||||
int ammo_hegrenade_net;
|
||||
int ammo_fbgrenade;
|
||||
int ammo_fbgrenade_net;
|
||||
int ammo_smokegrenade;
|
||||
int ammo_smokegrenade_net;
|
||||
|
||||
/* Weapon specific */
|
||||
int usp45_mag;
|
||||
int usp45_mag_net;
|
||||
int glock18_mag;
|
||||
int glock18_mag_net;
|
||||
int deagle_mag;
|
||||
int deagle_mag_net;
|
||||
int p228_mag;
|
||||
int p228_mag_net;
|
||||
int elites_mag;
|
||||
int elites_mag_net;
|
||||
int fiveseven_mag;
|
||||
int fiveseven_mag_net;
|
||||
int m3_mag;
|
||||
int m3_mag_net;
|
||||
int xm1014_mag;
|
||||
int xm1014_mag_net;
|
||||
int mp5_mag;
|
||||
int mp5_mag_net;
|
||||
int p90_mag;
|
||||
int p90_mag_net;
|
||||
int ump45_mag;
|
||||
int ump45_mag_net;
|
||||
int mac10_mag;
|
||||
int mac10_mag_net;
|
||||
int tmp_mag;
|
||||
int tmp_mag_net;
|
||||
int ak47_mag;
|
||||
int ak47_mag_net;
|
||||
int sg552_mag;
|
||||
int sg552_mag_net;
|
||||
int m4a1_mag;
|
||||
int m4a1_mag_net;
|
||||
int aug_mag;
|
||||
int aug_mag_net;
|
||||
int scout_mag;
|
||||
int scout_mag_net;
|
||||
int awp_mag;
|
||||
int awp_mag_net;
|
||||
int g3sg1_mag;
|
||||
int g3sg1_mag_net;
|
||||
int sg550_mag;
|
||||
int sg550_mag_net;
|
||||
int para_mag;
|
||||
int para_mag_net;
|
||||
|
||||
int mode_usp45;
|
||||
int mode_usp45_net;
|
||||
int mode_m4a1;
|
||||
int mode_m4a1_net;
|
||||
int mode_glock18;
|
||||
int mode_glock18_net;
|
||||
|
||||
int mode_temp;
|
||||
int mode_temp_net;
|
||||
|
||||
int cs_shotmultiplier;
|
||||
int cs_shotmultiplier_net;
|
||||
float cs_shottime;
|
||||
float cs_shottime_net;
|
||||
|
||||
#ifdef CLIENT
|
||||
/* External model */
|
||||
entity p_model;
|
||||
|
@ -31,64 +194,644 @@ class player:base_player
|
|||
|
||||
int cs_cross_mindist;
|
||||
int cs_cross_deltadist;
|
||||
int cs_old_shotmultiplier;
|
||||
float cs_crosshairdistance;
|
||||
|
||||
int net_cs_shotmultiplier;
|
||||
float net_cs_shottime;
|
||||
|
||||
virtual void(void) gun_offset;
|
||||
virtual void(void) draw;
|
||||
virtual float() predraw;
|
||||
virtual void(void) postdraw;
|
||||
virtual void(float) ReceiveEntity;
|
||||
virtual void(void) PredictPreFrame;
|
||||
virtual void(void) PredictPostFrame;
|
||||
#else
|
||||
virtual void(void) EvaluateEntity;
|
||||
virtual float(entity, float) SendEntity;
|
||||
|
||||
int charmodel;
|
||||
int money;
|
||||
int ammo_50ae;
|
||||
int ammo_762mm;
|
||||
int ammo_556mm;
|
||||
int ammo_556mmbox;
|
||||
int ammo_338mag;
|
||||
int ammo_9mm;
|
||||
int ammo_buckshot;
|
||||
int ammo_45acp;
|
||||
int ammo_357sig;
|
||||
int ammo_57mm;
|
||||
int ammo_hegrenade;
|
||||
int ammo_fbgrenade;
|
||||
int ammo_smokegrenade;
|
||||
|
||||
/* Weapon specific */
|
||||
int usp45_mag;
|
||||
int glock18_mag;
|
||||
int deagle_mag;
|
||||
int p228_mag;
|
||||
int elites_mag;
|
||||
int fiveseven_mag;
|
||||
int m3_mag;
|
||||
int xm1014_mag;
|
||||
int mp5_mag;
|
||||
int p90_mag;
|
||||
int ump45_mag;
|
||||
int mac10_mag;
|
||||
int tmp_mag;
|
||||
int ak47_mag;
|
||||
int sg552_mag;
|
||||
int m4a1_mag;
|
||||
int aug_mag;
|
||||
int scout_mag;
|
||||
int awp_mag;
|
||||
int g3sg1_mag;
|
||||
int sg550_mag;
|
||||
int para_mag;
|
||||
|
||||
int mode_usp45;
|
||||
int mode_m4a1;
|
||||
int mode_glock18;
|
||||
|
||||
int old_cs_shotmultiplier;
|
||||
float old_cs_shottime;
|
||||
|
||||
float progress;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#ifdef CLIENT
|
||||
void Weapons_AmmoUpdate(entity);
|
||||
/*
|
||||
=================
|
||||
player::ReceiveEntity
|
||||
=================
|
||||
*/
|
||||
void
|
||||
player::ReceiveEntity(float new)
|
||||
{
|
||||
float fl;
|
||||
if (new == FALSE) {
|
||||
/* Go through all the physics code between the last received frame
|
||||
* and the newest frame and keep the changes this time around instead
|
||||
* of rolling back, because we'll apply the new server-verified values
|
||||
* right after anyway. */
|
||||
/* FIXME: splitscreen */
|
||||
if (entnum == player_localentnum) {
|
||||
/* FIXME: splitscreen */
|
||||
pSeat = &g_seats[0];
|
||||
|
||||
for (int i = sequence+1; i <= servercommandframe; i++) {
|
||||
/* ...maybe the input state is too old? */
|
||||
if (!getinputstate(i)) {
|
||||
break;
|
||||
}
|
||||
input_sequence = i;
|
||||
PMove_Run();
|
||||
}
|
||||
|
||||
/* any differences in things that are read below are now
|
||||
* officially from prediction misses. */
|
||||
}
|
||||
}
|
||||
|
||||
/* 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();
|
||||
if (fl & PLAYER_BASEFRAME)
|
||||
baseframe = readbyte();
|
||||
if (fl & PLAYER_FRAME) {
|
||||
frame = readbyte();
|
||||
frame1time = 0.0f;
|
||||
frame2time = 0.0f;
|
||||
}
|
||||
|
||||
if (fl & PLAYER_AMMO1) {
|
||||
usp45_mag = readbyte();
|
||||
glock18_mag = readbyte();
|
||||
deagle_mag = readbyte();
|
||||
p228_mag = readbyte();
|
||||
elites_mag = readbyte();
|
||||
fiveseven_mag = readbyte();
|
||||
m3_mag = readbyte();
|
||||
xm1014_mag = readbyte();
|
||||
mp5_mag = readbyte();
|
||||
p90_mag = readbyte();
|
||||
ump45_mag = readbyte();
|
||||
mac10_mag = readbyte();
|
||||
tmp_mag = readbyte();
|
||||
ak47_mag = readbyte();
|
||||
sg552_mag = readbyte();
|
||||
m4a1_mag = readbyte();
|
||||
aug_mag = readbyte();
|
||||
scout_mag = readbyte();
|
||||
awp_mag = readbyte();
|
||||
g3sg1_mag = readbyte();
|
||||
sg550_mag = readbyte();
|
||||
para_mag = readbyte();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_AMMO2) {
|
||||
ammo_50ae = readbyte();
|
||||
ammo_762mm = readbyte();
|
||||
ammo_556mm = readbyte();
|
||||
ammo_556mmbox = readbyte();
|
||||
ammo_338mag = readbyte();
|
||||
ammo_9mm = readbyte();
|
||||
ammo_buckshot = readbyte();
|
||||
ammo_45acp = readbyte();
|
||||
ammo_357sig = readbyte();
|
||||
ammo_57mm = readbyte();
|
||||
ammo_hegrenade = readbyte();
|
||||
ammo_fbgrenade = readbyte();
|
||||
ammo_smokegrenade = readbyte();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_AMMO3) {
|
||||
mode_usp45 = readbyte();
|
||||
mode_m4a1 = readbyte();
|
||||
mode_glock18 = readbyte();
|
||||
mode_temp = readbyte();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_CSSHOT) {
|
||||
cs_shotmultiplier = readbyte();
|
||||
}
|
||||
if (fl & PLAYER_CSSHOTTIME) {
|
||||
cs_shottime = readfloat();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_AMMO1 || fl & PLAYER_AMMO2 || fl & PLAYER_AMMO3)
|
||||
Weapons_AmmoUpdate(this);
|
||||
|
||||
setorigin(this, origin);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
player::PredictPostFrame
|
||||
|
||||
Save the last valid server values away in the _net variants of each field
|
||||
so we can roll them back later.
|
||||
=================
|
||||
*/
|
||||
void
|
||||
player::PredictPreFrame(void)
|
||||
{
|
||||
usp45_mag_net = usp45_mag;
|
||||
glock18_mag_net = glock18_mag;
|
||||
deagle_mag_net = deagle_mag;
|
||||
p228_mag_net = p228_mag;
|
||||
elites_mag_net = elites_mag;
|
||||
fiveseven_mag_net = fiveseven_mag;
|
||||
m3_mag_net = m3_mag;
|
||||
xm1014_mag_net = xm1014_mag;
|
||||
mp5_mag_net = mp5_mag;
|
||||
p90_mag_net = p90_mag;
|
||||
ump45_mag_net = ump45_mag;
|
||||
mac10_mag_net = mac10_mag;
|
||||
tmp_mag_net = tmp_mag;
|
||||
ak47_mag_net = ak47_mag;
|
||||
sg552_mag_net = sg552_mag;
|
||||
m4a1_mag_net = m4a1_mag;
|
||||
aug_mag_net = aug_mag;
|
||||
scout_mag_net = scout_mag;
|
||||
awp_mag_net = awp_mag;
|
||||
g3sg1_mag_net = g3sg1_mag;
|
||||
sg550_mag_net = sg550_mag;
|
||||
para_mag_net = para_mag;
|
||||
|
||||
ammo_50ae_net = ammo_50ae;
|
||||
ammo_762mm_net = ammo_762mm;
|
||||
ammo_556mm_net = ammo_556mm;
|
||||
ammo_556mmbox_net = ammo_556mmbox;
|
||||
ammo_338mag_net = ammo_338mag;
|
||||
ammo_9mm_net = ammo_9mm;
|
||||
ammo_buckshot_net = ammo_buckshot;
|
||||
ammo_45acp_net = ammo_45acp;
|
||||
ammo_357sig_net = ammo_357sig;
|
||||
ammo_57mm_net = ammo_57mm;
|
||||
ammo_hegrenade_net = ammo_hegrenade;
|
||||
ammo_fbgrenade_net = ammo_fbgrenade;
|
||||
ammo_smokegrenade_net = ammo_smokegrenade;
|
||||
|
||||
mode_usp45_net = mode_usp45;
|
||||
mode_m4a1_net = mode_m4a1;
|
||||
mode_glock18_net = mode_glock18;
|
||||
mode_temp_net = mode_temp;
|
||||
|
||||
cs_shotmultiplier_net = cs_shotmultiplier;
|
||||
cs_shottime_net = cs_shottime;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
player::PredictPostFrame
|
||||
|
||||
Where we roll back our values to the ones last sent/verified by the server.
|
||||
=================
|
||||
*/
|
||||
void
|
||||
player::PredictPostFrame(void)
|
||||
{
|
||||
usp45_mag = usp45_mag_net;
|
||||
glock18_mag = glock18_mag_net;
|
||||
deagle_mag = deagle_mag_net;
|
||||
p228_mag = p228_mag_net;
|
||||
elites_mag = elites_mag_net;
|
||||
fiveseven_mag = fiveseven_mag_net;
|
||||
m3_mag = m3_mag_net;
|
||||
xm1014_mag = xm1014_mag_net;
|
||||
mp5_mag = mp5_mag_net;
|
||||
p90_mag = p90_mag_net;
|
||||
ump45_mag = ump45_mag_net;
|
||||
mac10_mag = mac10_mag_net;
|
||||
tmp_mag = tmp_mag_net;
|
||||
ak47_mag = ak47_mag_net;
|
||||
sg552_mag = sg552_mag_net;
|
||||
m4a1_mag = m4a1_mag_net;
|
||||
aug_mag = aug_mag_net;
|
||||
scout_mag = scout_mag_net;
|
||||
awp_mag = awp_mag_net;
|
||||
g3sg1_mag = g3sg1_mag_net;
|
||||
sg550_mag = sg550_mag_net;
|
||||
para_mag = para_mag_net;
|
||||
|
||||
ammo_50ae = ammo_50ae_net;
|
||||
ammo_762mm = ammo_762mm_net;
|
||||
ammo_556mm = ammo_556mm_net;
|
||||
ammo_556mmbox = ammo_556mmbox_net;
|
||||
ammo_338mag = ammo_338mag_net;
|
||||
ammo_9mm = ammo_9mm_net;
|
||||
ammo_buckshot = ammo_buckshot_net;
|
||||
ammo_45acp = ammo_45acp_net;
|
||||
ammo_357sig = ammo_357sig_net;
|
||||
ammo_57mm = ammo_57mm_net;
|
||||
ammo_hegrenade = ammo_hegrenade_net;
|
||||
ammo_fbgrenade = ammo_fbgrenade_net;
|
||||
ammo_smokegrenade = ammo_smokegrenade_net;
|
||||
|
||||
mode_usp45 = mode_usp45_net;
|
||||
mode_m4a1 = mode_m4a1_net;
|
||||
mode_glock18 = mode_glock18_net;
|
||||
mode_temp = mode_temp_net;
|
||||
|
||||
cs_shotmultiplier = cs_shotmultiplier_net;
|
||||
cs_shottime = cs_shottime_net;
|
||||
}
|
||||
|
||||
#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;
|
||||
|
||||
if (old_baseframe != baseframe)
|
||||
SendFlags |= PLAYER_BASEFRAME;
|
||||
|
||||
if (old_frame != frame)
|
||||
SendFlags |= PLAYER_FRAME;
|
||||
|
||||
/* ammo 1 type updates */
|
||||
if (glock18_mag_net != glock18_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (usp45_mag_net != usp45_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (glock18_mag_net != glock18_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (deagle_mag_net != deagle_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (p228_mag_net != p228_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (elites_mag_net != elites_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (fiveseven_mag_net != fiveseven_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (m3_mag_net != m3_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (xm1014_mag_net != xm1014_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (mp5_mag_net != mp5_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (p90_mag_net != p90_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (ump45_mag_net != ump45_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (mac10_mag_net != mac10_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (tmp_mag_net != tmp_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (ak47_mag_net != ak47_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (sg552_mag_net != sg552_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (m4a1_mag_net != m4a1_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (aug_mag_net != aug_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (scout_mag_net != scout_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (awp_mag_net != awp_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (g3sg1_mag_net != g3sg1_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (sg550_mag_net != sg550_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (para_mag_net != para_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
|
||||
if (ammo_50ae_net != ammo_50ae)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
if (ammo_762mm_net != ammo_762mm)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
if (ammo_556mm_net != ammo_556mm)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
if (ammo_556mmbox_net != ammo_556mmbox)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
if (ammo_338mag_net != ammo_338mag)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
if (ammo_9mm_net != ammo_9mm)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
if (ammo_buckshot_net != ammo_buckshot)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
if (ammo_45acp_net != ammo_45acp)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
if (ammo_357sig_net != ammo_357sig)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
if (ammo_57mm_net != ammo_57mm)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
if (ammo_hegrenade_net != ammo_hegrenade)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
if (ammo_fbgrenade_net != ammo_fbgrenade)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
if (ammo_smokegrenade_net != ammo_smokegrenade)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
|
||||
if (mode_usp45_net != mode_usp45)
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
if (mode_m4a1_net != mode_m4a1)
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
if (mode_glock18_net != mode_glock18)
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
if (mode_temp_net != mode_temp)
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
if (cs_shotmultiplier != cs_shotmultiplier_net)
|
||||
SendFlags |= PLAYER_CSSHOT;
|
||||
if (cs_shottime != cs_shottime_net)
|
||||
SendFlags |= PLAYER_CSSHOTTIME;
|
||||
|
||||
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;
|
||||
|
||||
glock18_mag_net = glock18_mag;
|
||||
usp45_mag_net = usp45_mag;
|
||||
glock18_mag_net = glock18_mag;
|
||||
deagle_mag_net = deagle_mag;
|
||||
p228_mag_net = p228_mag;
|
||||
elites_mag_net = elites_mag;
|
||||
fiveseven_mag_net = fiveseven_mag;
|
||||
m3_mag_net = m3_mag;
|
||||
xm1014_mag_net = xm1014_mag;
|
||||
mp5_mag_net = mp5_mag;
|
||||
p90_mag_net = p90_mag;
|
||||
ump45_mag_net = ump45_mag;
|
||||
mac10_mag_net = mac10_mag;
|
||||
tmp_mag_net = tmp_mag;
|
||||
ak47_mag_net = ak47_mag;
|
||||
sg552_mag_net = sg552_mag;
|
||||
m4a1_mag_net = m4a1_mag;
|
||||
aug_mag_net = aug_mag;
|
||||
scout_mag_net = scout_mag;
|
||||
awp_mag_net = awp_mag;
|
||||
g3sg1_mag_net = g3sg1_mag;
|
||||
sg550_mag_net = sg550_mag;
|
||||
para_mag_net = para_mag;
|
||||
|
||||
ammo_50ae_net = ammo_50ae;
|
||||
ammo_762mm_net = ammo_762mm;
|
||||
ammo_556mm_net = ammo_556mm;
|
||||
ammo_556mmbox_net = ammo_556mmbox;
|
||||
ammo_338mag_net = ammo_338mag;
|
||||
ammo_9mm_net = ammo_9mm;
|
||||
ammo_buckshot_net = ammo_buckshot;
|
||||
ammo_45acp_net = ammo_45acp;
|
||||
ammo_357sig_net = ammo_357sig;
|
||||
ammo_57mm_net = ammo_57mm;
|
||||
ammo_hegrenade_net = ammo_hegrenade;
|
||||
ammo_fbgrenade_net = ammo_fbgrenade;
|
||||
ammo_smokegrenade_net = ammo_smokegrenade;
|
||||
|
||||
mode_usp45_net = mode_usp45;
|
||||
mode_m4a1_net = mode_m4a1;
|
||||
mode_glock18_net = mode_glock18;
|
||||
mode_temp_net = mode_temp;
|
||||
|
||||
cs_shotmultiplier_net = cs_shotmultiplier;
|
||||
cs_shottime_net = cs_shottime;
|
||||
|
||||
if (g_cs_gamestate != GAME_FREEZE) {
|
||||
if (progress <= 0.0f) {
|
||||
flags &= ~FL_FROZEN;
|
||||
SendFlags |= PLAYER_FLAGS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
player::SendEntity
|
||||
=================
|
||||
*/
|
||||
float
|
||||
player::SendEntity(entity ePEnt, float fChanged)
|
||||
{
|
||||
if (health <= 0 && ePEnt != this) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (clienttype(ePEnt) != CLIENTTYPE_REAL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (ePEnt != self) {
|
||||
fChanged &= ~PLAYER_ITEMS;
|
||||
fChanged &= ~PLAYER_HEALTH;
|
||||
fChanged &= ~PLAYER_ARMOR;
|
||||
fChanged &= ~PLAYER_VIEWOFS;
|
||||
fChanged &= ~PLAYER_AMMO1;
|
||||
fChanged &= ~PLAYER_AMMO2;
|
||||
fChanged &= ~PLAYER_AMMO3;
|
||||
}
|
||||
|
||||
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]);
|
||||
if (fChanged & PLAYER_BASEFRAME)
|
||||
WriteByte(MSG_ENTITY, baseframe);
|
||||
if (fChanged & PLAYER_FRAME)
|
||||
WriteByte(MSG_ENTITY, frame);
|
||||
|
||||
if (fChanged & PLAYER_AMMO1) {
|
||||
WriteByte(MSG_ENTITY, usp45_mag);
|
||||
WriteByte(MSG_ENTITY, glock18_mag);
|
||||
WriteByte(MSG_ENTITY, deagle_mag);
|
||||
WriteByte(MSG_ENTITY, p228_mag);
|
||||
WriteByte(MSG_ENTITY, elites_mag);
|
||||
WriteByte(MSG_ENTITY, fiveseven_mag);
|
||||
WriteByte(MSG_ENTITY, m3_mag);
|
||||
WriteByte(MSG_ENTITY, xm1014_mag);
|
||||
WriteByte(MSG_ENTITY, mp5_mag);
|
||||
WriteByte(MSG_ENTITY, p90_mag);
|
||||
WriteByte(MSG_ENTITY, ump45_mag);
|
||||
WriteByte(MSG_ENTITY, mac10_mag);
|
||||
WriteByte(MSG_ENTITY, tmp_mag);
|
||||
WriteByte(MSG_ENTITY, ak47_mag);
|
||||
WriteByte(MSG_ENTITY, sg552_mag);
|
||||
WriteByte(MSG_ENTITY, m4a1_mag);
|
||||
WriteByte(MSG_ENTITY, aug_mag);
|
||||
WriteByte(MSG_ENTITY, scout_mag);
|
||||
WriteByte(MSG_ENTITY, awp_mag);
|
||||
WriteByte(MSG_ENTITY, g3sg1_mag);
|
||||
WriteByte(MSG_ENTITY, sg550_mag);
|
||||
WriteByte(MSG_ENTITY, para_mag);
|
||||
}
|
||||
|
||||
if (fChanged & PLAYER_AMMO2) {
|
||||
WriteByte(MSG_ENTITY, ammo_50ae);
|
||||
WriteByte(MSG_ENTITY, ammo_762mm);
|
||||
WriteByte(MSG_ENTITY, ammo_556mm);
|
||||
WriteByte(MSG_ENTITY, ammo_556mmbox);
|
||||
WriteByte(MSG_ENTITY, ammo_338mag);
|
||||
WriteByte(MSG_ENTITY, ammo_9mm);
|
||||
WriteByte(MSG_ENTITY, ammo_buckshot);
|
||||
WriteByte(MSG_ENTITY, ammo_45acp);
|
||||
WriteByte(MSG_ENTITY, ammo_357sig);
|
||||
WriteByte(MSG_ENTITY, ammo_57mm);
|
||||
WriteByte(MSG_ENTITY, ammo_hegrenade);
|
||||
WriteByte(MSG_ENTITY, ammo_fbgrenade);
|
||||
WriteByte(MSG_ENTITY, ammo_smokegrenade);
|
||||
}
|
||||
|
||||
if (fChanged & PLAYER_AMMO3) {
|
||||
WriteByte(MSG_ENTITY, mode_usp45);
|
||||
WriteByte(MSG_ENTITY, mode_m4a1);
|
||||
WriteByte(MSG_ENTITY, mode_glock18);
|
||||
WriteByte(MSG_ENTITY, mode_temp);
|
||||
}
|
||||
|
||||
if (fChanged & PLAYER_CSSHOT) {
|
||||
WriteByte(MSG_ENTITY, cs_shotmultiplier);
|
||||
}
|
||||
if (fChanged & PLAYER_CSSHOTTIME) {
|
||||
WriteFloat(MSG_ENTITY, cs_shottime);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -52,9 +52,7 @@ w_ak47_precache(void)
|
|||
void
|
||||
w_ak47_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.ak47_mag, pl.ammo_762mm, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -118,35 +116,16 @@ w_ak47_primary(void)
|
|||
if (pl.w_attack_next > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!pl.ak47_mag) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1);
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 36, [accuracy,accuracy], WEAPON_AK47);
|
||||
pl.ak47_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_AK47, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_AK47, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_ak47.fire");
|
||||
#endif
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
|
||||
int r = (float)input_sequence % 3;
|
||||
switch (r) {
|
||||
|
@ -160,6 +139,17 @@ w_ak47_primary(void)
|
|||
Weapons_ViewAnimation(AK47_SHOOT3);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 36, [accuracy,accuracy], WEAPON_AK47);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_AK47, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_AK47, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_ak47.fire");
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 0.0955f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
@ -173,15 +163,6 @@ w_ak47_reload(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 30) {
|
||||
return;
|
||||
}
|
||||
if (!pl.a_ammo2) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.ak47_mag >= 30) {
|
||||
return;
|
||||
}
|
||||
|
@ -189,10 +170,11 @@ w_ak47_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
Weapons_ReloadWeapon(pl, player::ak47_mag, player::ammo_762mm, 30);
|
||||
Weapons_UpdateAmmo(pl, pl.ak47_mag, pl.ammo_762mm, -1);
|
||||
#endif
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(AK47_RELOAD);
|
||||
#else
|
||||
Weapons_ReloadWeapon(pl, player::ak47_mag, player::ammo_762mm, 30);
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 2.4f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
@ -249,7 +231,7 @@ w_ak47_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_ak47 =
|
||||
{
|
||||
.name = "ak47",
|
||||
.id = ITEM_AK47,
|
||||
.id = ITEM_AK47,
|
||||
.slot = 0,
|
||||
.slot_pos = 7,
|
||||
.allow_drop = TRUE,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -52,9 +52,7 @@ w_aug_precache(void)
|
|||
void
|
||||
w_aug_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.aug_mag, pl.ammo_762mm, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -118,35 +116,16 @@ w_aug_primary(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!pl.aug_mag) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1);
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 215);
|
||||
pl.aug_mag--;
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
#else
|
||||
pl.aug_mag--;
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 32, [accuracy,accuracy], WEAPON_AUG);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_aug.fire");
|
||||
#endif
|
||||
|
||||
int r = (float)input_sequence % 3;
|
||||
switch (r) {
|
||||
|
@ -160,6 +139,17 @@ w_aug_primary(void)
|
|||
Weapons_ViewAnimation(AUG_SHOOT3);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 32, [accuracy,accuracy], WEAPON_AUG);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_aug.fire");
|
||||
#endif
|
||||
|
||||
if (pl.viewzoom == 1.0f) {
|
||||
pl.w_attack_next = 0.0825f;
|
||||
|
@ -193,15 +183,6 @@ w_aug_reload(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 30) {
|
||||
return;
|
||||
}
|
||||
if (!pl.a_ammo2) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.aug_mag >= 30) {
|
||||
return;
|
||||
}
|
||||
|
@ -209,10 +190,11 @@ w_aug_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
Weapons_ReloadWeapon(pl, player::aug_mag, player::ammo_762mm, 30);
|
||||
Weapons_UpdateAmmo(pl, pl.aug_mag, pl.ammo_762mm, -1);
|
||||
#endif
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(AUG_RELOAD);
|
||||
#else
|
||||
Weapons_ReloadWeapon(pl, player::aug_mag, player::ammo_762mm, 30);
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 3.3f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
@ -274,7 +256,7 @@ w_aug_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_aug =
|
||||
{
|
||||
.name = "aug",
|
||||
.id = ITEM_AUG,
|
||||
.id = ITEM_AUG,
|
||||
.slot = 0,
|
||||
.slot_pos = 10,
|
||||
.allow_drop = TRUE,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -52,9 +52,7 @@ w_awp_precache(void)
|
|||
void
|
||||
w_awp_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.awp_mag, pl.ammo_338mag, pl.a_ammo3);
|
||||
#endif
|
||||
Weapons_UpdateAmmo(pl, pl.awp_mag, pl.ammo_338mag, pl.mode_temp);
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -103,6 +101,7 @@ w_awp_draw(void)
|
|||
player pl = (player)self;
|
||||
Weapons_SetModel("models/v_awp.mdl");
|
||||
Weapons_ViewAnimation(AWP_DRAW);
|
||||
pl.mode_temp = 0;
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 8;
|
||||
|
@ -122,9 +121,9 @@ w_awp_release(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo3 == 1) {
|
||||
if (pl.mode_temp == 1) {
|
||||
pl.viewzoom = 0.45f;
|
||||
} else if (pl.a_ammo3 == 2) {
|
||||
} else if (pl.mode_temp == 2) {
|
||||
pl.viewzoom = 0.1f;
|
||||
} else {
|
||||
pl.viewzoom = 1.0f;
|
||||
|
@ -144,12 +143,12 @@ w_awp_secondary(void)
|
|||
#endif
|
||||
|
||||
/* Simple toggle of fovs */
|
||||
if (pl.a_ammo3 == 1) {
|
||||
pl.a_ammo3 = 2;
|
||||
} else if (pl.a_ammo3 == 2) {
|
||||
pl.a_ammo3 = 0;
|
||||
if (pl.mode_temp == 1) {
|
||||
pl.mode_temp = 2;
|
||||
} else if (pl.mode_temp == 2) {
|
||||
pl.mode_temp = 0;
|
||||
} else {
|
||||
pl.a_ammo3 = 1;
|
||||
pl.mode_temp = 1;
|
||||
}
|
||||
|
||||
pl.w_attack_next = 0.3f;
|
||||
|
@ -166,35 +165,16 @@ w_awp_primary(void)
|
|||
w_awp_release();
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!pl.awp_mag) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1);
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, -1);
|
||||
pl.awp_mag--;
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
#else
|
||||
pl.awp_mag--;
|
||||
TraceAttack_SetPenetrationPower(2);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 115, [accuracy,accuracy], WEAPON_AWP);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_awp.fire");
|
||||
#endif
|
||||
|
||||
int r = (float)input_sequence % 3;
|
||||
switch (r) {
|
||||
|
@ -208,6 +188,17 @@ w_awp_primary(void)
|
|||
Weapons_ViewAnimation(AWP_SHOOT3);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(2);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 115, [accuracy,accuracy], WEAPON_AWP);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_awp.fire");
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 1.2f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
@ -221,15 +212,6 @@ w_awp_reload(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 10) {
|
||||
return;
|
||||
}
|
||||
if (!pl.a_ammo2) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.awp_mag >= 10) {
|
||||
return;
|
||||
}
|
||||
|
@ -237,10 +219,11 @@ w_awp_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
Weapons_ReloadWeapon(pl, player::awp_mag, player::ammo_338mag, 10);
|
||||
Weapons_UpdateAmmo(pl, pl.awp_mag, pl.ammo_338mag, -1);
|
||||
#endif
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(AWP_RELOAD);
|
||||
#else
|
||||
Weapons_ReloadWeapon(pl, player::awp_mag, player::ammo_338mag, 10);
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 2.9f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
@ -300,7 +283,7 @@ w_awp_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_awp =
|
||||
{
|
||||
.name = "awp",
|
||||
.id = ITEM_AWP,
|
||||
.id = ITEM_AWP,
|
||||
.slot = 0,
|
||||
.slot_pos = 12,
|
||||
.allow_drop = TRUE,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -73,9 +73,7 @@ w_c4bomb_precache(void)
|
|||
void
|
||||
w_c4bomb_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.a_ammo1, 1, pl.a_ammo3);
|
||||
#endif
|
||||
Weapons_UpdateAmmo(pl, -1, 1, -1);
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -99,8 +97,10 @@ w_c4bomb_deathmsg(void)
|
|||
void
|
||||
w_c4bomb_draw(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
Weapons_SetModel("models/v_c4.mdl");
|
||||
Weapons_ViewAnimation(C4_DRAW);
|
||||
pl.mode_temp = 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -108,9 +108,9 @@ w_c4bomb_release(void)
|
|||
{
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.a_ammo1 == C4S_DROPPING) {
|
||||
if (pl.mode_temp == C4S_DROPPING) {
|
||||
if (pl.w_idle_next <= 0.0f) {
|
||||
pl.a_ammo1 = C4S_DONE;
|
||||
pl.mode_temp = C4S_DONE;
|
||||
#ifdef SERVER
|
||||
C4Bomb_Plant(pl);
|
||||
Weapons_RemoveItem(pl, WEAPON_C4BOMB);
|
||||
|
@ -120,10 +120,10 @@ w_c4bomb_release(void)
|
|||
}
|
||||
|
||||
/* reset animation */
|
||||
if (pl.a_ammo1 != C4S_NONE) {
|
||||
if (pl.mode_temp != C4S_NONE) {
|
||||
Weapons_ViewAnimation(C4_IDLE);
|
||||
}
|
||||
pl.a_ammo1 = C4S_NONE;
|
||||
pl.mode_temp = C4S_NONE;
|
||||
pl.w_idle_next = 0.0f;
|
||||
}
|
||||
|
||||
|
@ -138,15 +138,15 @@ w_c4bomb_primary(void)
|
|||
|
||||
pl.flags |= FL_FROZEN;
|
||||
|
||||
switch (pl.a_ammo1) {
|
||||
switch (pl.mode_temp) {
|
||||
case C4S_NONE:
|
||||
pl.a_ammo1 = C4S_ENTERINGCODE;
|
||||
pl.mode_temp = C4S_ENTERINGCODE;
|
||||
Weapons_ViewAnimation(C4_ENTERCODE);
|
||||
pl.w_idle_next = 3.0f;
|
||||
break;
|
||||
case C4S_ENTERINGCODE:
|
||||
if (pl.w_idle_next <= 0.0f) {
|
||||
pl.a_ammo1 = C4S_DROPPING;
|
||||
pl.mode_temp = C4S_DROPPING;
|
||||
Weapons_ViewAnimation(C4_DROP);
|
||||
pl.w_idle_next = 1.0f;
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ w_c4bomb_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_c4bomb =
|
||||
{
|
||||
.name = "c4",
|
||||
.id = ITEM_C4BOMB,
|
||||
.id = ITEM_C4BOMB,
|
||||
.slot = 4,
|
||||
.slot_pos = 0,
|
||||
.allow_drop = TRUE,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -51,9 +51,7 @@ w_deagle_precache(void)
|
|||
void
|
||||
w_deagle_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.deagle_mag, pl.ammo_50ae, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -121,37 +119,18 @@ w_deagle_primary(void)
|
|||
if (pl.gflags & GF_SEMI_TOGGLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!pl.deagle_mag) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1);
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
|
||||
pl.deagle_mag--;
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
#else
|
||||
pl.deagle_mag--;
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 54, [accuracy,accuracy], WEAPON_DEAGLE);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_ONEHAND, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_ONEHAND, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_deagle.fire");
|
||||
#endif
|
||||
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
if (pl.deagle_mag <= 0) {
|
||||
Weapons_ViewAnimation(DEAGLE_SHOOT_EMPTY);
|
||||
} else {
|
||||
int r = (float)input_sequence % 2;
|
||||
|
@ -164,6 +143,17 @@ w_deagle_primary(void)
|
|||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 54, [accuracy,accuracy], WEAPON_DEAGLE);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_ONEHAND, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_ONEHAND, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_deagle.fire");
|
||||
#endif
|
||||
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
pl.w_attack_next = 0.15f;
|
||||
|
@ -178,15 +168,6 @@ w_deagle_reload(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 7) {
|
||||
return;
|
||||
}
|
||||
if (!pl.a_ammo2) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.deagle_mag >= 7) {
|
||||
return;
|
||||
}
|
||||
|
@ -194,11 +175,12 @@ w_deagle_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(DEAGLE_RELOAD);
|
||||
#else
|
||||
Weapons_ReloadWeapon(pl, player::deagle_mag, player::ammo_50ae, 7);
|
||||
Weapons_UpdateAmmo(pl, pl.deagle_mag, pl.ammo_50ae, -1);
|
||||
#endif
|
||||
|
||||
Weapons_ViewAnimation(DEAGLE_RELOAD);
|
||||
pl.w_attack_next = 2.1f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
@ -254,7 +236,7 @@ w_deagle_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_deagle =
|
||||
{
|
||||
.name = "deagle",
|
||||
.id = ITEM_DEAGLE,
|
||||
.id = ITEM_DEAGLE,
|
||||
.slot = 1,
|
||||
.slot_pos = 2,
|
||||
.allow_drop = TRUE,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -45,6 +45,7 @@ enum
|
|||
ELITES_RELOAD,
|
||||
ELITES_DRAW
|
||||
};
|
||||
|
||||
void
|
||||
w_elites_precache(void)
|
||||
{
|
||||
|
@ -60,9 +61,7 @@ w_elites_precache(void)
|
|||
void
|
||||
w_elites_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.elites_mag, pl.ammo_9mm, pl.a_ammo3);
|
||||
#endif
|
||||
Weapons_UpdateAmmo(pl, pl.elites_mag, pl.ammo_9mm, -1);
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -111,6 +110,7 @@ w_elites_draw(void)
|
|||
player pl = (player)self;
|
||||
Weapons_SetModel("models/v_elite.mdl");
|
||||
Weapons_ViewAnimation(ELITES_DRAW);
|
||||
pl.mode_temp = 0;
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 4;
|
||||
|
@ -126,52 +126,25 @@ w_elites_primary(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.gflags & GF_SEMI_TOGGLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!pl.elites_mag) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
pl.a_ammo3 = 1 - pl.a_ammo3;
|
||||
pl.mode_temp = 1 - pl.mode_temp;
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1);
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(0);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 45, [accuracy,accuracy], WEAPON_ELITES);
|
||||
pl.elites_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING) {
|
||||
if (pl.a_ammo3)
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT2_DUALPISTOLS, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_DUALPISTOLS, 0.45f);
|
||||
} else {
|
||||
if (pl.a_ammo3)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT2_DUALPISTOLS, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_DUALPISTOLS, 0.45f);
|
||||
}
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_elites.fire");
|
||||
#endif
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
|
||||
int r = (float)input_sequence % 5;
|
||||
if (pl.a_ammo3) {
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
if (pl.mode_temp) {
|
||||
if (pl.elites_mag <= 0) {
|
||||
Weapons_ViewAnimation(ELITES_SHOOT_LEFTLAST);
|
||||
} else {
|
||||
switch (r) {
|
||||
|
@ -193,7 +166,7 @@ w_elites_primary(void)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
if (pl.elites_mag <= 0) {
|
||||
Weapons_ViewAnimation(ELITES_SHOOT_RIGHTLAST);
|
||||
} else {
|
||||
switch (r) {
|
||||
|
@ -215,6 +188,24 @@ w_elites_primary(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(0);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 45, [accuracy,accuracy], WEAPON_ELITES);
|
||||
|
||||
if (self.flags & FL_CROUCHING) {
|
||||
if (pl.mode_temp)
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT2_DUALPISTOLS, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_DUALPISTOLS, 0.45f);
|
||||
} else {
|
||||
if (pl.mode_temp)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT2_DUALPISTOLS, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_DUALPISTOLS, 0.45f);
|
||||
}
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_elites.fire");
|
||||
#endif
|
||||
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
pl.w_attack_next = 0.15f;
|
||||
|
@ -229,15 +220,6 @@ w_elites_reload(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 30) {
|
||||
return;
|
||||
}
|
||||
if (!pl.a_ammo2) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.elites_mag >= 30) {
|
||||
return;
|
||||
}
|
||||
|
@ -245,11 +227,12 @@ w_elites_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(ELITES_RELOAD);
|
||||
#else
|
||||
Weapons_ReloadWeapon(pl, player::elites_mag, player::ammo_9mm, 30);
|
||||
Weapons_UpdateAmmo(pl, pl.elites_mag, pl.ammo_9mm, -1);
|
||||
#endif
|
||||
|
||||
Weapons_ViewAnimation(ELITES_RELOAD);
|
||||
pl.w_attack_next = 4.6f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
@ -305,7 +288,7 @@ w_elites_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_elites =
|
||||
{
|
||||
.name = "elites",
|
||||
.id = ITEM_ELITES,
|
||||
.id = ITEM_ELITES,
|
||||
.slot = 1,
|
||||
.slot_pos = 4,
|
||||
.allow_drop = TRUE,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -51,9 +51,7 @@ w_fiveseven_precache(void)
|
|||
void
|
||||
w_fiveseven_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.fiveseven_mag, pl.ammo_57mm, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -121,37 +119,18 @@ w_fiveseven_primary(void)
|
|||
if (pl.gflags & GF_SEMI_TOGGLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!pl.fiveseven_mag) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1);
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(0);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 25, [accuracy,accuracy], WEAPON_FIVESEVEN);
|
||||
pl.fiveseven_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_ONEHAND, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_ONEHAND, 0.45f);
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_fiveseven.fire");
|
||||
#endif
|
||||
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
if (pl.fiveseven_mag <= 0) {
|
||||
Weapons_ViewAnimation(FIVESEVEN_SHOOT_EMPTY);
|
||||
} else {
|
||||
int r = (float)input_sequence % 2;
|
||||
|
@ -164,6 +143,17 @@ w_fiveseven_primary(void)
|
|||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(0);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 25, [accuracy,accuracy], WEAPON_FIVESEVEN);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_ONEHAND, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_ONEHAND, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_fiveseven.fire");
|
||||
#endif
|
||||
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
pl.w_attack_next = 0.15f;
|
||||
|
@ -178,15 +168,6 @@ w_fiveseven_reload(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 20) {
|
||||
return;
|
||||
}
|
||||
if (!pl.a_ammo2) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.fiveseven_mag >= 20) {
|
||||
return;
|
||||
}
|
||||
|
@ -194,11 +175,12 @@ w_fiveseven_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(FIVESEVEN_RELOAD);
|
||||
#else
|
||||
Weapons_ReloadWeapon(pl, player::fiveseven_mag, player::ammo_57mm, 20);
|
||||
Weapons_UpdateAmmo(pl, pl.fiveseven_mag, pl.ammo_57mm, -1);
|
||||
#endif
|
||||
|
||||
Weapons_ViewAnimation(FIVESEVEN_RELOAD);
|
||||
pl.w_attack_next = 3.1f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
@ -254,7 +236,7 @@ w_fiveseven_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_fiveseven =
|
||||
{
|
||||
.name = "fiveseven",
|
||||
.id = ITEM_FIVESEVEN,
|
||||
.id = ITEM_FIVESEVEN,
|
||||
.slot = 1,
|
||||
.slot_pos = 5,
|
||||
.allow_drop = TRUE,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -52,9 +52,7 @@ w_flashbang_precache(void)
|
|||
void
|
||||
w_flashbang_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_fbgrenade, pl.a_ammo3);
|
||||
#endif
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_fbgrenade, pl.mode_temp);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -93,8 +91,10 @@ w_flashbang_deathmsg(void)
|
|||
void
|
||||
w_flashbang_draw(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
Weapons_SetModel("models/v_flashbang.mdl");
|
||||
Weapons_ViewAnimation(FLASHBANG_DRAW);
|
||||
pl.mode_temp = 0;
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
|
@ -159,24 +159,18 @@ w_flashbang_primary(void)
|
|||
}
|
||||
|
||||
/* We're abusing this network variable for the holding check */
|
||||
if (pl.a_ammo3 > 0) {
|
||||
if (pl.mode_temp > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.ammo_fbgrenade <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Weapons_ViewAnimation(FLASHBANG_PULLPIN);
|
||||
|
||||
pl.a_ammo3 = 1;
|
||||
pl.mode_temp = 1;
|
||||
pl.w_attack_next = 0.975f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
@ -190,18 +184,17 @@ w_flashbang_release(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo3 == 1) {
|
||||
if (pl.mode_temp == 1) {
|
||||
pl.ammo_fbgrenade--;
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo2--;
|
||||
Weapons_ViewAnimation(FLASHBANG_THROW);
|
||||
#else
|
||||
pl.ammo_fbgrenade--;
|
||||
w_flashbang_throw();
|
||||
#endif
|
||||
pl.a_ammo3 = 2;
|
||||
pl.mode_temp = 2;
|
||||
pl.w_attack_next = 1.0f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
} else if (pl.a_ammo3 == 2) {
|
||||
} else if (pl.mode_temp == 2) {
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(FLASHBANG_DRAW);
|
||||
#else
|
||||
|
@ -211,7 +204,7 @@ w_flashbang_release(void)
|
|||
#endif
|
||||
pl.w_attack_next = 0.5f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
pl.a_ammo3 = 0;
|
||||
pl.mode_temp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -265,7 +258,7 @@ w_flashbang_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_flashbang =
|
||||
{
|
||||
.name = "flashbang",
|
||||
.id = ITEM_FLASHBANG,
|
||||
.id = ITEM_FLASHBANG,
|
||||
.slot = 3,
|
||||
.slot_pos = 1,
|
||||
.allow_drop = FALSE,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -50,9 +50,7 @@ w_g3sg1_precache(void)
|
|||
void
|
||||
w_g3sg1_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.g3sg1_mag, pl.ammo_762mm, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -116,35 +114,16 @@ w_g3sg1_primary(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!pl.g3sg1_mag) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1);
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(2);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 80, [accuracy,accuracy], WEAPON_G3SG1);
|
||||
pl.g3sg1_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_g3sg1.fire");
|
||||
#endif
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
|
||||
int r = (float)input_sequence % 2;
|
||||
switch (r) {
|
||||
|
@ -155,6 +134,17 @@ w_g3sg1_primary(void)
|
|||
Weapons_ViewAnimation(SCOUT_SHOOT2);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(2);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 80, [accuracy,accuracy], WEAPON_G3SG1);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_g3sg1.fire");
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 0.25f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
@ -186,15 +176,6 @@ w_g3sg1_reload(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 20) {
|
||||
return;
|
||||
}
|
||||
if (!pl.a_ammo2) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.g3sg1_mag >= 20) {
|
||||
return;
|
||||
}
|
||||
|
@ -202,11 +183,13 @@ w_g3sg1_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(G3SG1_RELOAD);
|
||||
#else
|
||||
Weapons_ReloadWeapon(pl, player::g3sg1_mag, player::ammo_762mm, 20);
|
||||
Weapons_UpdateAmmo(pl, pl.g3sg1_mag, pl.ammo_762mm, -1);
|
||||
#endif
|
||||
|
||||
Weapons_ViewAnimation(G3SG1_RELOAD);
|
||||
pl.w_attack_next = 4.6f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
@ -265,7 +248,7 @@ w_g3sg1_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_g3sg1 =
|
||||
{
|
||||
.name = "g3sg1",
|
||||
.id = ITEM_G3SG1,
|
||||
.id = ITEM_G3SG1,
|
||||
.slot = 0,
|
||||
.slot_pos = 13,
|
||||
.allow_drop = TRUE,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -61,9 +61,7 @@ w_glock18_precache(void)
|
|||
void
|
||||
w_glock18_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.glock18_mag, pl.ammo_9mm, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -139,41 +137,33 @@ w_glock18_primary(void)
|
|||
if (pl.gflags & GF_SEMI_TOGGLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!pl.glock18_mag) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1);
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
|
||||
pl.glock18_mag--;
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(0);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 25, [accuracy,accuracy], WEAPON_GLOCK18);
|
||||
pl.glock18_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_ONEHAND, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_ONEHAND, 0.45f);
|
||||
|
||||
if (pl.a_ammo3) {
|
||||
if (pl.mode_glock18) {
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_glock18.burstfire");
|
||||
} else {
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_glock18.fire");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pl.a_ammo3) {
|
||||
if (pl.mode_glock18) {
|
||||
int r = (float)input_sequence % 2;
|
||||
switch (r) {
|
||||
case 0:
|
||||
|
@ -185,7 +175,7 @@ w_glock18_primary(void)
|
|||
}
|
||||
pl.w_attack_next = 0.5f;
|
||||
} else {
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
if (pl.glock18_mag <= 0) {
|
||||
Weapons_ViewAnimation(GLOCK_SHOOT_EMPTY);
|
||||
} else {
|
||||
Weapons_ViewAnimation(GLOCK_SHOOT);
|
||||
|
@ -206,10 +196,10 @@ w_glock18_secondary(void)
|
|||
}
|
||||
|
||||
/* toggle burst-fire */
|
||||
pl.a_ammo3 = 1 - pl.a_ammo3;
|
||||
pl.mode_glock18 = 1 - pl.mode_glock18;
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo3) {
|
||||
if (pl.mode_glock18) {
|
||||
CSQC_Parse_CenterPrint("Switched to Burst-Fire mode");
|
||||
} else {
|
||||
CSQC_Parse_CenterPrint("Switched to Semi-Automatic mode");
|
||||
|
@ -228,15 +218,6 @@ w_glock18_reload(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 20) {
|
||||
return;
|
||||
}
|
||||
if (!pl.a_ammo2) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.glock18_mag >= 20) {
|
||||
return;
|
||||
}
|
||||
|
@ -244,10 +225,7 @@ w_glock18_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
Weapons_ReloadWeapon(pl, player::glock18_mag, player::ammo_9mm, 20);
|
||||
Weapons_UpdateAmmo(pl, pl.glock18_mag, pl.ammo_9mm, -1);
|
||||
#endif
|
||||
|
||||
#ifdef CLIENT
|
||||
int r = (float)input_sequence % 2;
|
||||
switch (r) {
|
||||
case 0:
|
||||
|
@ -257,6 +235,11 @@ w_glock18_reload(void)
|
|||
Weapons_ViewAnimation(GLOCK_RELOAD2);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
|
||||
Weapons_ReloadWeapon(pl, player::glock18_mag, player::ammo_9mm, 20);
|
||||
Weapons_UpdateAmmo(pl, pl.glock18_mag, pl.ammo_9mm, -1);
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 2.1f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
@ -284,6 +267,14 @@ void
|
|||
w_glock18_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.glock18_mag == 0 && pl.ammo_9mm == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -307,6 +298,14 @@ w_glock18_hudpic(int selected, vector pos, float a)
|
|||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
|
||||
if (pl.ammo_9mm <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_9mm / AMMO_MAX_9MM;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -52,9 +52,7 @@ w_hegrenade_precache(void)
|
|||
void
|
||||
w_hegrenade_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_hegrenade, pl.a_ammo3);
|
||||
#endif
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_hegrenade, pl.mode_temp);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -95,6 +93,8 @@ w_hegrenade_draw(void)
|
|||
{
|
||||
Weapons_SetModel("models/v_hegrenade.mdl");
|
||||
Weapons_ViewAnimation(HEGRENADE_DRAW);
|
||||
player pl = (player)self;
|
||||
pl.mode_temp = 0;
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
|
@ -161,13 +161,13 @@ w_hegrenade_primary(void)
|
|||
}
|
||||
|
||||
/* We're abusing this network variable for the holding check */
|
||||
if (pl.a_ammo3 > 0) {
|
||||
if (pl.mode_temp > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
if (pl.ammo_hegrenade <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
@ -178,7 +178,7 @@ w_hegrenade_primary(void)
|
|||
|
||||
Weapons_ViewAnimation(HEGRENADE_PULLPIN);
|
||||
|
||||
pl.a_ammo3 = 1;
|
||||
pl.mode_temp = 1;
|
||||
pl.w_attack_next = 0.975f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
@ -192,18 +192,18 @@ w_hegrenade_release(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo3 == 1) {
|
||||
if (pl.mode_temp == 1) {
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo2--;
|
||||
pl.ammo_hegrenade--;
|
||||
Weapons_ViewAnimation(HEGRENADE_THROW);
|
||||
#else
|
||||
pl.ammo_hegrenade--;
|
||||
w_hegrenade_throw();
|
||||
#endif
|
||||
pl.a_ammo3 = 2;
|
||||
pl.mode_temp = 2;
|
||||
pl.w_attack_next = 1.0f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
} else if (pl.a_ammo3 == 2) {
|
||||
} else if (pl.mode_temp == 2) {
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(HEGRENADE_DRAW);
|
||||
#else
|
||||
|
@ -213,7 +213,7 @@ w_hegrenade_release(void)
|
|||
#endif
|
||||
pl.w_attack_next = 0.5f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
pl.a_ammo3 = 0;
|
||||
pl.mode_temp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ w_hegrenade_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_hegrenade =
|
||||
{
|
||||
.name = "hegrenade",
|
||||
.id = ITEM_HEGRENADE,
|
||||
.id = ITEM_HEGRENADE,
|
||||
.slot = 3,
|
||||
.slot_pos = 0,
|
||||
.allow_drop = FALSE,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -55,9 +55,7 @@ w_knife_precache(void)
|
|||
void
|
||||
w_knife_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, -1, -1, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -95,7 +93,9 @@ w_knife_primary(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
pl.w_attack_next = 0.7f;
|
||||
|
||||
#ifdef CLIENT
|
||||
int r = (float)input_sequence % 2;
|
||||
switch (r) {
|
||||
case 0:
|
||||
|
@ -105,9 +105,7 @@ w_knife_primary(void)
|
|||
Weapons_ViewAnimation(KNIFE_SLASH2);
|
||||
break;
|
||||
}
|
||||
pl.w_attack_next = 0.7f;
|
||||
|
||||
#ifdef SERVER
|
||||
#else
|
||||
vector src;
|
||||
Weapons_MakeVectors();
|
||||
src = pl.origin + pl.view_ofs;
|
||||
|
@ -145,11 +143,12 @@ w_knife_secondary(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_ViewAnimation(KNIFE_STAB);
|
||||
pl.w_attack_next = 1.2f;
|
||||
|
||||
#ifdef SERVER
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(KNIFE_STAB);
|
||||
#else
|
||||
|
||||
vector src;
|
||||
Weapons_MakeVectors();
|
||||
src = pl.origin + pl.view_ofs;
|
||||
|
@ -214,7 +213,7 @@ w_knife_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_knife =
|
||||
{
|
||||
.name = "knife",
|
||||
.id = ITEM_KNIFE,
|
||||
.id = ITEM_KNIFE,
|
||||
.slot = 2,
|
||||
.slot_pos = 0,
|
||||
.allow_drop = FALSE,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -60,9 +60,7 @@ w_m3_precache(void)
|
|||
void
|
||||
w_m3_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.m3_mag, pl.ammo_buckshot, pl.a_ammo3);
|
||||
#endif
|
||||
Weapons_UpdateAmmo(pl, pl.m3_mag, pl.ammo_buckshot, -1);
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -111,6 +109,7 @@ w_m3_draw(void)
|
|||
player pl = (player)self;
|
||||
Weapons_SetModel("models/v_m3.mdl");
|
||||
Weapons_ViewAnimation(M3_DRAW);
|
||||
pl.mode_temp = 0;
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 8;
|
||||
|
@ -128,7 +127,7 @@ w_m3_primary(void)
|
|||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
if (!pl.m3_mag) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
@ -141,7 +140,7 @@ w_m3_primary(void)
|
|||
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
pl.m3_mag--;
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(0);
|
||||
|
@ -175,10 +174,10 @@ w_m3_reload(void)
|
|||
{
|
||||
player pl = (player)self;
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 8) {
|
||||
if (pl.m3_mag >= 8) {
|
||||
return;
|
||||
}
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
if (pl.ammo_buckshot <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
@ -190,10 +189,10 @@ w_m3_reload(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (pl.a_ammo3 > M3S_IDLE) {
|
||||
if (pl.mode_temp > M3S_IDLE) {
|
||||
return;
|
||||
}
|
||||
pl.a_ammo3 = M3S_RELOAD_START;
|
||||
pl.mode_temp = M3S_RELOAD_START;
|
||||
pl.w_idle_next = 0.0f;
|
||||
}
|
||||
|
||||
|
@ -208,31 +207,31 @@ w_m3_release(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo3 == M3S_RELOAD_START) {
|
||||
if (pl.mode_temp == M3S_RELOAD_START) {
|
||||
Weapons_ViewAnimation(M3_RELOAD_START);
|
||||
pl.a_ammo3 = M3S_RELOAD;
|
||||
pl.mode_temp = M3S_RELOAD;
|
||||
pl.w_idle_next = 0.65f;
|
||||
} else if (pl.a_ammo3 == M3S_RELOAD) {
|
||||
} else if (pl.mode_temp == M3S_RELOAD) {
|
||||
Weapons_ViewAnimation(M3_INSERT);
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1++;
|
||||
pl.a_ammo2--;
|
||||
pl.m3_mag++;
|
||||
pl.ammo_buckshot--;
|
||||
|
||||
if (pl.a_ammo2 <= 0 || pl.a_ammo1 >= 8) {
|
||||
pl.a_ammo3 = M3S_RELOAD_END;
|
||||
if (pl.ammo_buckshot <= 0 || pl.m3_mag >= 8) {
|
||||
pl.mode_temp = M3S_RELOAD_END;
|
||||
}
|
||||
#else
|
||||
pl.m3_mag++;
|
||||
pl.ammo_buckshot--;
|
||||
w_m3_updateammo(pl);
|
||||
if (pl.ammo_buckshot <= 0 || pl.m3_mag >= 8) {
|
||||
pl.a_ammo3 = M3S_RELOAD_END;
|
||||
pl.mode_temp = M3S_RELOAD_END;
|
||||
}
|
||||
#endif
|
||||
pl.w_idle_next = 0.5f;
|
||||
} else if (pl.a_ammo3 == M3S_RELOAD_END) {
|
||||
} else if (pl.mode_temp == M3S_RELOAD_END) {
|
||||
Weapons_ViewAnimation(M3_RELOAD_END);
|
||||
pl.a_ammo3 = M3S_IDLE;
|
||||
pl.mode_temp = M3S_IDLE;
|
||||
pl.w_idle_next = 10.0f;
|
||||
pl.w_attack_next = 0.5f;
|
||||
}
|
||||
|
@ -289,7 +288,7 @@ w_m3_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_m3 =
|
||||
{
|
||||
.name = "m3",
|
||||
.id = ITEM_M3,
|
||||
.id = ITEM_M3,
|
||||
.slot = 0,
|
||||
.slot_pos = 0,
|
||||
.allow_drop = TRUE,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -61,9 +61,7 @@ w_m4a1_precache(void)
|
|||
void
|
||||
w_m4a1_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.m4a1_mag, pl.ammo_556mm, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -113,7 +111,7 @@ w_m4a1_draw(void)
|
|||
|
||||
Weapons_SetModel("models/v_m4a1.mdl");
|
||||
|
||||
if (pl.a_ammo3 == 1) {
|
||||
if (pl.mode_m4a1 == 1) {
|
||||
Weapons_ViewAnimation(M4A1_DRAW);
|
||||
} else {
|
||||
Weapons_ViewAnimation(M4A1_DRAWUNSIL);
|
||||
|
@ -133,53 +131,25 @@ w_m4a1_primary(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* ammo check */
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!pl.m4a1_mag) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1);
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 220);
|
||||
pl.m4a1_mag--;
|
||||
|
||||
/* actual firing */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo3 == 1) {
|
||||
if (pl.mode_m4a1 == 1) {
|
||||
View_SetMuzzleflash(0);
|
||||
} else {
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
}
|
||||
|
||||
pl.a_ammo1--;
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
#else
|
||||
pl.m4a1_mag--;
|
||||
|
||||
/* Different sounds without silencer */
|
||||
if (pl.a_ammo3 == 1) {
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_m4a1.silenced");
|
||||
} else {
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_m4a1.fire");
|
||||
}
|
||||
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 33, [accuracy,accuracy], WEAPON_M4A1);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
#endif
|
||||
|
||||
/* this stuff is predicted */
|
||||
int r = (float)input_sequence % 3;
|
||||
if (pl.a_ammo3 == 1) {
|
||||
if (pl.mode_m4a1 == 1) {
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(M4A1_SHOOT1);
|
||||
|
@ -204,6 +174,22 @@ w_m4a1_primary(void)
|
|||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* Different sounds without silencer */
|
||||
if (pl.mode_m4a1 == 1) {
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_m4a1.silenced");
|
||||
} else {
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_m4a1.fire");
|
||||
}
|
||||
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 33, [accuracy,accuracy], WEAPON_M4A1);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 0.0875f;
|
||||
pl.w_idle_next = 2.0f;
|
||||
|
@ -219,10 +205,10 @@ w_m4a1_secondary(void)
|
|||
}
|
||||
|
||||
/* toggle silencer */
|
||||
pl.a_ammo3 = 1 - pl.a_ammo3;
|
||||
pl.mode_m4a1 = 1 - pl.mode_m4a1;
|
||||
|
||||
/* play the animation */
|
||||
if (pl.a_ammo3) {
|
||||
if (pl.mode_m4a1) {
|
||||
Weapons_ViewAnimation(M4A1_ADDSIL);
|
||||
} else {
|
||||
Weapons_ViewAnimation(M4A1_DETACHSIL);
|
||||
|
@ -240,15 +226,6 @@ w_m4a1_reload(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 30) {
|
||||
return;
|
||||
}
|
||||
if (!pl.a_ammo2) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.m4a1_mag >= 30) {
|
||||
return;
|
||||
}
|
||||
|
@ -256,14 +233,15 @@ w_m4a1_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
Weapons_ReloadWeapon(pl, player::m4a1_mag, player::ammo_556mm, 30);
|
||||
#endif
|
||||
|
||||
if (pl.a_ammo3 == 1) {
|
||||
#ifdef CLIENT
|
||||
if (pl.mode_m4a1 == 1) {
|
||||
Weapons_ViewAnimation(M4A1_RELOAD);
|
||||
} else {
|
||||
Weapons_ViewAnimation(M4A1_RELOADUNSIL);
|
||||
}
|
||||
#else
|
||||
Weapons_ReloadWeapon(pl, player::m4a1_mag, player::ammo_556mm, 30);
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 3.1f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
@ -298,7 +276,7 @@ w_m4a1_release(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo3) {
|
||||
if (pl.mode_m4a1) {
|
||||
Weapons_ViewAnimation(M4A1_IDLE);
|
||||
} else {
|
||||
Weapons_ViewAnimation(M4A1_IDLEUNSIL);
|
||||
|
@ -310,6 +288,14 @@ void
|
|||
w_m4a1_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.m4a1_mag == 0 && pl.ammo_556mm == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -317,7 +303,7 @@ w_m4a1_hudpic(int selected, vector pos, float a)
|
|||
g_hud5_spr,
|
||||
[0,45/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -328,21 +314,29 @@ w_m4a1_hudpic(int selected, vector pos, float a)
|
|||
g_hud2_spr,
|
||||
[0,45/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
|
||||
if (pl.ammo_556mm <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_556mm / AMMO_MAX_556MM;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_m4a1 =
|
||||
{
|
||||
.name = "m4a1",
|
||||
.id = ITEM_M4A1,
|
||||
.id = ITEM_M4A1,
|
||||
.slot = 0,
|
||||
.slot_pos = 9,
|
||||
.allow_drop = TRUE,
|
||||
.allow_drop = TRUE,
|
||||
.draw = w_m4a1_draw,
|
||||
.holster = __NULL__,
|
||||
.primary = w_m4a1_primary,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -51,9 +51,7 @@ w_mac10_precache(void)
|
|||
void
|
||||
w_mac10_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.mac10_mag, pl.ammo_45acp, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -117,35 +115,16 @@ w_mac10_primary(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!pl.mac10_mag) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1);
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(0);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 29, [accuracy,accuracy], WEAPON_MAC10);
|
||||
pl.mac10_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_MP5, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_MP5, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_mac10.fire");
|
||||
#endif
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
|
||||
int r = (float)input_sequence % 3;
|
||||
switch (r) {
|
||||
|
@ -159,6 +138,17 @@ w_mac10_primary(void)
|
|||
Weapons_ViewAnimation(MAC10_SHOOT3);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(0);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 29, [accuracy,accuracy], WEAPON_MAC10);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_MP5, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_MP5, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_mac10.fire");
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 0.07f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
@ -172,15 +162,6 @@ w_mac10_reload(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 30) {
|
||||
return;
|
||||
}
|
||||
if (!pl.a_ammo2) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.mac10_mag >= 30) {
|
||||
return;
|
||||
}
|
||||
|
@ -188,11 +169,13 @@ w_mac10_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(MAC10_RELOAD);
|
||||
#else
|
||||
Weapons_ReloadWeapon(pl, player::mac10_mag, player::ammo_45acp, 30);
|
||||
Weapons_UpdateAmmo(pl, pl.mac10_mag, pl.ammo_45acp, -1);
|
||||
#endif
|
||||
|
||||
Weapons_ViewAnimation(MAC10_RELOAD);
|
||||
pl.w_attack_next = 3.2f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
@ -248,7 +231,7 @@ w_mac10_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_mac10 =
|
||||
{
|
||||
.name = "mac10",
|
||||
.id = ITEM_MAC10,
|
||||
.id = ITEM_MAC10,
|
||||
.slot = 0,
|
||||
.slot_pos = 5,
|
||||
.allow_drop = TRUE,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -51,9 +51,7 @@ w_mp5_precache(void)
|
|||
void
|
||||
w_mp5_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.mp5_mag, pl.ammo_9mm, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -117,40 +115,16 @@ w_mp5_primary(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!pl.mp5_mag) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1);
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 220);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
#else
|
||||
if (!pl.mp5_mag) {
|
||||
return;
|
||||
}
|
||||
|
||||
TraceAttack_SetPenetrationPower(0);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 26, [accuracy,accuracy], WEAPON_MP5);
|
||||
|
||||
pl.mp5_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_MP5, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_MP5, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_mp5.fire");
|
||||
#endif
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
|
||||
int r = (float)input_sequence % 3;
|
||||
switch (r) {
|
||||
|
@ -164,6 +138,17 @@ w_mp5_primary(void)
|
|||
Weapons_ViewAnimation(MP5_SHOOT3);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(0);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 26, [accuracy,accuracy], WEAPON_MP5);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_MP5, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_MP5, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_mp5.fire");
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 0.08f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
@ -177,15 +162,6 @@ w_mp5_reload(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 30) {
|
||||
return;
|
||||
}
|
||||
if (!pl.a_ammo2) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.mp5_mag >= 30) {
|
||||
return;
|
||||
}
|
||||
|
@ -193,11 +169,13 @@ w_mp5_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(MP5_RELOAD);
|
||||
#else
|
||||
Weapons_ReloadWeapon(pl, player::mp5_mag, player::ammo_9mm, 30);
|
||||
Weapons_UpdateAmmo(pl, pl.mp5_mag, pl.ammo_9mm, -1);
|
||||
#endif
|
||||
|
||||
Weapons_ViewAnimation(MP5_RELOAD);
|
||||
pl.w_attack_next = 2.6f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
@ -253,7 +231,7 @@ w_mp5_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_mp5 =
|
||||
{
|
||||
.name = "mp5navy",
|
||||
.id = ITEM_MP5,
|
||||
.id = ITEM_MP5,
|
||||
.slot = 0,
|
||||
.slot_pos = 2,
|
||||
.allow_drop = TRUE,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -52,9 +52,7 @@ w_p228_precache(void)
|
|||
void
|
||||
w_p228_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.p228_mag, pl.ammo_357sig, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -118,42 +116,21 @@ w_p228_primary(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.gflags & GF_SEMI_TOGGLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* ammo check */
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!pl.p228_mag) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1);
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(0);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 40, [accuracy,accuracy], WEAPON_P228);
|
||||
pl.p228_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_ONEHAND, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_ONEHAND, 0.45f);
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_p228.fire");
|
||||
#endif
|
||||
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
if (pl.p228_mag <= 0) {
|
||||
Weapons_ViewAnimation(P228_SHOOT_EMPTY);
|
||||
} else {
|
||||
int r = (float)input_sequence % 3;
|
||||
|
@ -169,6 +146,17 @@ w_p228_primary(void)
|
|||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(0);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 40, [accuracy,accuracy], WEAPON_P228);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_ONEHAND, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_ONEHAND, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_p228.fire");
|
||||
#endif
|
||||
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
pl.w_attack_next = 0.15f;
|
||||
|
@ -183,15 +171,6 @@ w_p228_reload(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 30) {
|
||||
return;
|
||||
}
|
||||
if (!pl.a_ammo2) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.p228_mag >= 30) {
|
||||
return;
|
||||
}
|
||||
|
@ -199,11 +178,13 @@ w_p228_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(P228_RELOAD);
|
||||
#else
|
||||
Weapons_ReloadWeapon(pl, player::p228_mag, player::ammo_357sig, 13);
|
||||
Weapons_UpdateAmmo(pl, pl.p228_mag, pl.ammo_357sig, -1);
|
||||
#endif
|
||||
|
||||
Weapons_ViewAnimation(P228_RELOAD);
|
||||
pl.w_attack_next = 2.7f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
@ -259,7 +240,7 @@ w_p228_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_p228 =
|
||||
{
|
||||
.name = "p228",
|
||||
.id = ITEM_P228,
|
||||
.id = ITEM_P228,
|
||||
.slot = 1,
|
||||
.slot_pos = 3,
|
||||
.allow_drop = TRUE,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -51,9 +51,7 @@ w_p90_precache(void)
|
|||
void
|
||||
w_p90_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.p90_mag, pl.ammo_57mm, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -117,36 +115,16 @@ w_p90_primary(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* ammo check */
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!pl.p90_mag) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1);
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 175);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(0);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 26, [accuracy,accuracy], WEAPON_P90);
|
||||
pl.p90_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_MP5, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_MP5, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_p90.fire");
|
||||
#endif
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
|
||||
int r = (float)input_sequence % 3;
|
||||
switch (r) {
|
||||
|
@ -160,6 +138,17 @@ w_p90_primary(void)
|
|||
Weapons_ViewAnimation(P90_SHOOT3);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(0);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 26, [accuracy,accuracy], WEAPON_P90);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_MP5, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_MP5, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_p90.fire");
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 0.07f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
@ -173,15 +162,6 @@ w_p90_reload(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 50) {
|
||||
return;
|
||||
}
|
||||
if (!pl.a_ammo2) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.p90_mag >= 50) {
|
||||
return;
|
||||
}
|
||||
|
@ -189,11 +169,13 @@ w_p90_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(P90_RELOAD);
|
||||
#else
|
||||
Weapons_ReloadWeapon(pl, player::p90_mag, player::ammo_57mm, 50);
|
||||
Weapons_UpdateAmmo(pl, pl.p90_mag, pl.ammo_57mm, -1);
|
||||
#endif
|
||||
|
||||
Weapons_ViewAnimation(P90_RELOAD);
|
||||
pl.w_attack_next = 3.3f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
@ -249,7 +231,7 @@ w_p90_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_p90 =
|
||||
{
|
||||
.name = "p90",
|
||||
.id = ITEM_P90,
|
||||
.id = ITEM_P90,
|
||||
.slot = 0,
|
||||
.slot_pos = 3,
|
||||
.allow_drop = TRUE,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -50,9 +50,7 @@ w_para_precache(void)
|
|||
void
|
||||
w_para_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.para_mag, pl.ammo_556mmbox, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -116,36 +114,16 @@ w_para_primary(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* ammo check */
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!pl.para_mag) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1);
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 175);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 35, [accuracy,accuracy], WEAPON_PARA);
|
||||
pl.para_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_PARA, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_PARA, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_para.fire");
|
||||
#endif
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
|
||||
int r = (float)input_sequence % 2;
|
||||
switch (r) {
|
||||
|
@ -156,6 +134,17 @@ w_para_primary(void)
|
|||
Weapons_ViewAnimation(SCOUT_SHOOT2);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 35, [accuracy,accuracy], WEAPON_PARA);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_PARA, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_PARA, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_para.fire");
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 0.1f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
@ -169,15 +158,6 @@ w_para_reload(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 100) {
|
||||
return;
|
||||
}
|
||||
if (!pl.a_ammo2) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.para_mag >= 100) {
|
||||
return;
|
||||
}
|
||||
|
@ -185,11 +165,13 @@ w_para_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(PARA_RELOAD);
|
||||
#else
|
||||
Weapons_ReloadWeapon(pl, player::para_mag, player::ammo_556mmbox, 100);
|
||||
Weapons_UpdateAmmo(pl, pl.para_mag, pl.ammo_556mmbox, -1);
|
||||
#endif
|
||||
|
||||
Weapons_ViewAnimation(PARA_RELOAD);
|
||||
pl.w_attack_next = 3.0f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
@ -245,7 +227,7 @@ w_para_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_para =
|
||||
{
|
||||
.name = "m249",
|
||||
.id = ITEM_PARA,
|
||||
.id = ITEM_PARA,
|
||||
.slot = 0,
|
||||
.slot_pos = 15,
|
||||
.allow_drop = TRUE,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -50,9 +50,7 @@ w_scout_precache(void)
|
|||
void
|
||||
w_scout_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.scout_mag, pl.ammo_762mm, pl.a_ammo3);
|
||||
#endif
|
||||
Weapons_UpdateAmmo(pl, pl.scout_mag, pl.ammo_762mm, -1);
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -101,6 +99,7 @@ w_scout_draw(void)
|
|||
player pl = (player)self;
|
||||
Weapons_SetModel("models/v_scout.mdl");
|
||||
Weapons_ViewAnimation(SCOUT_DRAW);
|
||||
pl.mode_temp = 0;
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 5;
|
||||
|
@ -121,9 +120,9 @@ w_scout_release(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo3 == 1) {
|
||||
if (pl.mode_temp == 1) {
|
||||
pl.viewzoom = 0.45f;
|
||||
} else if (pl.a_ammo3 == 2) {
|
||||
} else if (pl.mode_temp == 2) {
|
||||
pl.viewzoom = 0.1f;
|
||||
} else {
|
||||
pl.viewzoom = 1.0f;
|
||||
|
@ -143,12 +142,12 @@ w_scout_secondary(void)
|
|||
#endif
|
||||
|
||||
/* Simple toggle of fovs */
|
||||
if (pl.a_ammo3 == 1) {
|
||||
pl.a_ammo3 = 2;
|
||||
} else if (pl.a_ammo3 == 2) {
|
||||
pl.a_ammo3 = 0;
|
||||
if (pl.mode_temp == 1) {
|
||||
pl.mode_temp = 2;
|
||||
} else if (pl.mode_temp == 2) {
|
||||
pl.mode_temp = 0;
|
||||
} else {
|
||||
pl.a_ammo3 = 1;
|
||||
pl.mode_temp = 1;
|
||||
}
|
||||
|
||||
pl.w_attack_next = 0.3f;
|
||||
|
@ -165,36 +164,16 @@ w_scout_primary(void)
|
|||
w_scout_release();
|
||||
return;
|
||||
}
|
||||
|
||||
/* ammo check */
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!pl.scout_mag) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1);
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(2);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 75, [accuracy,accuracy], WEAPON_SCOUT);
|
||||
pl.scout_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_scout.fire");
|
||||
#endif
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
|
||||
int r = (float)input_sequence % 2;
|
||||
switch (r) {
|
||||
|
@ -205,6 +184,17 @@ w_scout_primary(void)
|
|||
Weapons_ViewAnimation(SCOUT_SHOOT2);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(2);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 75, [accuracy,accuracy], WEAPON_SCOUT);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_scout.fire");
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 1.25f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
@ -218,15 +208,6 @@ w_scout_reload(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 10) {
|
||||
return;
|
||||
}
|
||||
if (!pl.a_ammo2) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.scout_mag >= 10) {
|
||||
return;
|
||||
}
|
||||
|
@ -234,11 +215,13 @@ w_scout_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(SCOUT_RELOAD);
|
||||
#else
|
||||
Weapons_ReloadWeapon(pl, player::scout_mag, player::ammo_762mm, 10);
|
||||
Weapons_UpdateAmmo(pl, pl.scout_mag, pl.ammo_762mm, -1);
|
||||
#endif
|
||||
|
||||
Weapons_ViewAnimation(SCOUT_RELOAD);
|
||||
pl.w_attack_next = 2.0f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
@ -297,7 +280,7 @@ w_scout_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_scout =
|
||||
{
|
||||
.name = "scout",
|
||||
.id = ITEM_SCOUT,
|
||||
.id = ITEM_SCOUT,
|
||||
.slot = 0,
|
||||
.slot_pos = 11,
|
||||
.allow_drop = TRUE,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -50,9 +50,7 @@ w_sg550_precache(void)
|
|||
void
|
||||
w_sg550_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.sg550_mag, pl.ammo_556mm, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -116,36 +114,16 @@ w_sg550_primary(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* ammo check */
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!pl.sg550_mag) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1);
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 70, [accuracy,accuracy], WEAPON_SG550);
|
||||
pl.sg550_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_sg550.fire");
|
||||
#endif
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
|
||||
int r = (float)input_sequence % 2;
|
||||
switch (r) {
|
||||
|
@ -156,6 +134,17 @@ w_sg550_primary(void)
|
|||
Weapons_ViewAnimation(SCOUT_SHOOT2);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 70, [accuracy,accuracy], WEAPON_SG550);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_sg550.fire");
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 0.25f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
@ -187,15 +176,6 @@ w_sg550_reload(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 30) {
|
||||
return;
|
||||
}
|
||||
if (!pl.a_ammo2) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.sg550_mag >= 30) {
|
||||
return;
|
||||
}
|
||||
|
@ -203,11 +183,13 @@ w_sg550_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(SG550_RELOAD);
|
||||
#else
|
||||
Weapons_ReloadWeapon(pl, player::sg550_mag, player::ammo_556mm, 30);
|
||||
Weapons_UpdateAmmo(pl, pl.sg550_mag, pl.ammo_556mm, -1);
|
||||
#endif
|
||||
|
||||
Weapons_ViewAnimation(SG550_RELOAD);
|
||||
pl.w_attack_next = 3.8f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
@ -266,7 +248,7 @@ w_sg550_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_sg550 =
|
||||
{
|
||||
.name = "sg550",
|
||||
.id = ITEM_SG550,
|
||||
.id = ITEM_SG550,
|
||||
.slot = 0,
|
||||
.slot_pos = 14,
|
||||
.allow_drop = TRUE,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -51,9 +51,7 @@ w_sg552_precache(void)
|
|||
void
|
||||
w_sg552_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.sg552_mag, pl.ammo_556mm, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -117,36 +115,16 @@ w_sg552_primary(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* ammo check */
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!pl.sg552_mag) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1);
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 220);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 33, [accuracy,accuracy], WEAPON_SG552);
|
||||
pl.sg552_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_sg552.fire");
|
||||
#endif
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
|
||||
int r = (float)input_sequence % 3;
|
||||
switch (r) {
|
||||
|
@ -160,6 +138,17 @@ w_sg552_primary(void)
|
|||
Weapons_ViewAnimation(SG552_SHOOT3);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(1);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 33, [accuracy,accuracy], WEAPON_SG552);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_RIFLE, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_RIFLE, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_sg552.fire");
|
||||
#endif
|
||||
|
||||
if (pl.viewzoom == 1.0f) {
|
||||
pl.w_attack_next = 0.0825f;
|
||||
|
@ -193,15 +182,6 @@ w_sg552_reload(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 30) {
|
||||
return;
|
||||
}
|
||||
if (!pl.a_ammo2) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.sg552_mag >= 30) {
|
||||
return;
|
||||
}
|
||||
|
@ -209,11 +189,13 @@ w_sg552_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(SG552_RELOAD);
|
||||
#else
|
||||
Weapons_ReloadWeapon(pl, player::sg552_mag, player::ammo_556mm, 30);
|
||||
Weapons_UpdateAmmo(pl, pl.sg552_mag, pl.ammo_556mm, -1);
|
||||
#endif
|
||||
|
||||
Weapons_ViewAnimation(SG552_RELOAD);
|
||||
pl.w_attack_next = 3.2f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
@ -274,7 +256,7 @@ w_sg552_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_sg552 =
|
||||
{
|
||||
.name = "sg552",
|
||||
.id = ITEM_SG552,
|
||||
.id = ITEM_SG552,
|
||||
.slot = 0,
|
||||
.slot_pos = 8,
|
||||
.allow_drop = TRUE,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -52,9 +52,7 @@ w_smokegrenade_precache(void)
|
|||
void
|
||||
w_smokegrenade_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_smokegrenade, pl.a_ammo3);
|
||||
#endif
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_smokegrenade, pl.mode_temp);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -95,6 +93,8 @@ w_smokegrenade_draw(void)
|
|||
{
|
||||
Weapons_SetModel("models/v_smokegrenade.mdl");
|
||||
Weapons_ViewAnimation(SMOKEGRENADE_DRAW);
|
||||
player pl = (player)self;
|
||||
pl.mode_temp = 0;
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
|
@ -159,13 +159,13 @@ w_smokegrenade_primary(void)
|
|||
}
|
||||
|
||||
/* We're abusing this network variable for the holding check */
|
||||
if (pl.a_ammo3 > 0) {
|
||||
if (pl.mode_temp > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
if (pl.ammo_smokegrenade <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
@ -175,7 +175,7 @@ w_smokegrenade_primary(void)
|
|||
#endif
|
||||
|
||||
Weapons_ViewAnimation(SMOKEGRENADE_PULLPIN);
|
||||
pl.a_ammo3 = 1;
|
||||
pl.mode_temp = 1;
|
||||
pl.w_attack_next = 0.975f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
@ -189,18 +189,18 @@ w_smokegrenade_release(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo3 == 1) {
|
||||
if (pl.mode_temp == 1) {
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo2--;
|
||||
pl.ammo_smokegrenade--;
|
||||
Weapons_ViewAnimation(SMOKEGRENADE_THROW);
|
||||
#else
|
||||
pl.ammo_smokegrenade--;
|
||||
w_smokegrenade_throw();
|
||||
#endif
|
||||
pl.a_ammo3 = 2;
|
||||
pl.mode_temp = 2;
|
||||
pl.w_attack_next = 1.0f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
} else if (pl.a_ammo3 == 2) {
|
||||
} else if (pl.mode_temp == 2) {
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(SMOKEGRENADE_DRAW);
|
||||
#else
|
||||
|
@ -210,7 +210,7 @@ w_smokegrenade_release(void)
|
|||
#endif
|
||||
pl.w_attack_next = 0.5f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
pl.a_ammo3 = 0;
|
||||
pl.mode_temp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -51,9 +51,7 @@ w_tmp_precache(void)
|
|||
void
|
||||
w_tmp_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.tmp_mag, pl.ammo_9mm, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -119,34 +117,16 @@ w_tmp_primary(void)
|
|||
}
|
||||
|
||||
/* ammo check */
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!pl.tmp_mag) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1);
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(0);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 26, [accuracy,accuracy], WEAPON_TMP);
|
||||
pl.tmp_mag--;
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_MP5, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_MP5, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_tmp.fire");
|
||||
#endif
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
|
||||
int r = (float)input_sequence % 3;
|
||||
switch (r) {
|
||||
|
@ -160,6 +140,17 @@ w_tmp_primary(void)
|
|||
Weapons_ViewAnimation(TMP_SHOOT3);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(0);
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 26, [accuracy,accuracy], WEAPON_TMP);
|
||||
|
||||
if (self.flags & FL_CROUCHING)
|
||||
Animation_PlayerTopTemp(ANIM_SHOOT_MP5, 0.45f);
|
||||
else
|
||||
Animation_PlayerTopTemp(ANIM_CROUCH_SHOOT_MP5, 0.45f);
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_tmp.fire");
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 0.07f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
|
@ -173,15 +164,6 @@ w_tmp_reload(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 30) {
|
||||
return;
|
||||
}
|
||||
if (!pl.a_ammo2) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.tmp_mag >= 30) {
|
||||
return;
|
||||
}
|
||||
|
@ -189,11 +171,13 @@ w_tmp_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(TMP_RELOAD);
|
||||
#else
|
||||
Weapons_ReloadWeapon(pl, player::tmp_mag, player::ammo_9mm, 30);
|
||||
Weapons_UpdateAmmo(pl, pl.tmp_mag, pl.ammo_9mm, -1);
|
||||
#endif
|
||||
|
||||
Weapons_ViewAnimation(TMP_RELOAD);
|
||||
pl.w_attack_next = 2.1f;
|
||||
pl.w_idle_next = pl.w_attack_next;
|
||||
}
|
||||
|
@ -249,7 +233,7 @@ w_tmp_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_tmp =
|
||||
{
|
||||
.name = "tmp",
|
||||
.id = ITEM_TMP,
|
||||
.id = ITEM_TMP,
|
||||
.slot = 0,
|
||||
.slot_pos = 6,
|
||||
.allow_drop = TRUE,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -51,9 +51,7 @@ w_ump45_precache(void)
|
|||
void
|
||||
w_ump45_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.ump45_mag, pl.ammo_45acp, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -120,7 +118,7 @@ w_ump45_primary(void)
|
|||
|
||||
/* ammo check */
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
if (!pl.ump45_mag) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
@ -133,7 +131,7 @@ w_ump45_primary(void)
|
|||
float accuracy = Cstrike_CalculateAccuracy(pl, 210);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
pl.ump45_mag--;
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(0);
|
||||
|
@ -175,10 +173,10 @@ w_ump45_reload(void)
|
|||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 25) {
|
||||
if (pl.ump45_mag >= 25) {
|
||||
return;
|
||||
}
|
||||
if (!pl.a_ammo2) {
|
||||
if (!pl.ammo_45acp) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -64,9 +64,7 @@ w_usp45_precache(void)
|
|||
void
|
||||
w_usp45_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.usp45_mag, pl.ammo_45acp, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -115,7 +113,7 @@ w_usp45_draw(void)
|
|||
player pl = (player)self;
|
||||
|
||||
Weapons_SetModel("models/v_usp.mdl");
|
||||
if (pl.a_ammo3 == 1) {
|
||||
if (pl.mode_usp45 == 1) {
|
||||
Weapons_ViewAnimation(USP45_DRAW);
|
||||
} else {
|
||||
Weapons_ViewAnimation(USP45_DRAWUNSIL);
|
||||
|
@ -141,33 +139,24 @@ w_usp45_primary(void)
|
|||
}
|
||||
|
||||
/* ammo check */
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!pl.usp45_mag) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Cstrike_ShotMultiplierAdd(pl, 1);
|
||||
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
|
||||
pl.usp45_mag--;
|
||||
|
||||
/* actual firing */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo3 == 1) {
|
||||
if (pl.mode_usp45 == 1) {
|
||||
View_SetMuzzleflash(0);
|
||||
} else {
|
||||
View_SetMuzzleflash(MUZZLE_SMALL);
|
||||
}
|
||||
|
||||
pl.a_ammo1--;
|
||||
#else
|
||||
pl.usp45_mag--;
|
||||
|
||||
/* Different sounds without silencer */
|
||||
if (pl.a_ammo3 == 1) {
|
||||
if (pl.mode_usp45 == 1) {
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_usp45.silenced");
|
||||
} else {
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_usp45.fire");
|
||||
|
@ -184,8 +173,8 @@ w_usp45_primary(void)
|
|||
|
||||
/* this stuff is predicted */
|
||||
int r = (float)input_sequence % 3;
|
||||
if (pl.a_ammo3 == 1) {
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
if (pl.mode_usp45 == 1) {
|
||||
if (pl.usp45_mag <= 0) {
|
||||
Weapons_ViewAnimation(USP45_SHOOTLAST);
|
||||
} else {
|
||||
switch (r) {
|
||||
|
@ -201,7 +190,7 @@ w_usp45_primary(void)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
if (pl.usp45_mag <= 0) {
|
||||
Weapons_ViewAnimation(USP45_SHOOTLASTUNSIL);
|
||||
} else {
|
||||
switch (r) {
|
||||
|
@ -233,10 +222,10 @@ w_usp45_secondary(void)
|
|||
}
|
||||
|
||||
/* toggle silencer */
|
||||
pl.a_ammo3 = 1 - pl.a_ammo3;
|
||||
pl.mode_usp45 = 1 - pl.mode_usp45;
|
||||
|
||||
/* play the animation */
|
||||
if (pl.a_ammo3) {
|
||||
if (pl.mode_usp45) {
|
||||
Weapons_ViewAnimation(USP45_ADDSIL);
|
||||
} else {
|
||||
Weapons_ViewAnimation(USP45_DETACHSIL);
|
||||
|
@ -254,15 +243,6 @@ w_usp45_reload(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 12) {
|
||||
return;
|
||||
}
|
||||
if (!pl.a_ammo2) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.usp45_mag >= 12) {
|
||||
return;
|
||||
}
|
||||
|
@ -270,15 +250,15 @@ w_usp45_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
Weapons_ReloadWeapon(pl, player::usp45_mag, player::ammo_45acp, 12);
|
||||
Weapons_UpdateAmmo(pl, pl.usp45_mag, pl.ammo_45acp, -1);
|
||||
#endif
|
||||
|
||||
if (pl.a_ammo3 == 1) {
|
||||
#ifdef CLIENT
|
||||
if (pl.mode_usp45 == 1) {
|
||||
Weapons_ViewAnimation(USP45_RELOAD);
|
||||
} else {
|
||||
Weapons_ViewAnimation(USP45_RELOADUNSIL);
|
||||
}
|
||||
#else
|
||||
Weapons_ReloadWeapon(pl, player::usp45_mag, player::ammo_45acp, 12);
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 2.5f;
|
||||
}
|
||||
|
@ -305,6 +285,14 @@ void
|
|||
w_usp45_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.usp45_mag == 0 && pl.ammo_45acp == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -312,7 +300,7 @@ w_usp45_hudpic(int selected, vector pos, float a)
|
|||
g_hud4_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -323,18 +311,26 @@ w_usp45_hudpic(int selected, vector pos, float a)
|
|||
g_hud1_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
1.0f,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
|
||||
if (pl.ammo_45acp <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_45acp / AMMO_MAX_45ACP;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_usp45 =
|
||||
{
|
||||
.name = "usp",
|
||||
.id = ITEM_USP45,
|
||||
.id = ITEM_USP45,
|
||||
.slot = 1,
|
||||
.slot_pos = 0,
|
||||
.allow_drop = TRUE,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -61,9 +61,7 @@ w_xm1014_precache(void)
|
|||
void
|
||||
w_xm1014_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.xm1014_mag, pl.ammo_buckshot, pl.a_ammo3);
|
||||
#endif
|
||||
Weapons_UpdateAmmo(pl, pl.xm1014_mag, pl.ammo_buckshot, -1);
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -112,6 +110,7 @@ w_xm1014_draw(void)
|
|||
player pl = (player)self;
|
||||
Weapons_SetModel("models/v_xm1014.mdl");
|
||||
Weapons_ViewAnimation(XM1014_DRAW);
|
||||
pl.mode_temp = 0;
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.cs_cross_mindist = 9;
|
||||
|
@ -130,7 +129,7 @@ w_xm1014_primary(void)
|
|||
|
||||
/* ammo check */
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
if (!pl.xm1014_mag) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
@ -143,7 +142,7 @@ w_xm1014_primary(void)
|
|||
float accuracy = Cstrike_CalculateAccuracy(pl, 200);
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
pl.xm1014_mag--;
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
#else
|
||||
TraceAttack_SetPenetrationPower(0);
|
||||
|
@ -177,10 +176,10 @@ w_xm1014_reload(void)
|
|||
{
|
||||
player pl = (player)self;
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 7) {
|
||||
if (pl.xm1014_mag >= 7) {
|
||||
return;
|
||||
}
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
if (pl.ammo_buckshot <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
@ -192,10 +191,10 @@ w_xm1014_reload(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (pl.a_ammo3 > XM1014S_IDLE) {
|
||||
if (pl.mode_temp > XM1014S_IDLE) {
|
||||
return;
|
||||
}
|
||||
pl.a_ammo3 = XM1014S_RELOAD_START;
|
||||
pl.mode_temp = XM1014S_RELOAD_START;
|
||||
pl.w_idle_next = 0.0f;
|
||||
}
|
||||
|
||||
|
@ -210,18 +209,18 @@ w_xm1014_release(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo3 == XM1014S_RELOAD_START) {
|
||||
if (pl.mode_temp == XM1014S_RELOAD_START) {
|
||||
Weapons_ViewAnimation(XM1014_RELOAD_START);
|
||||
pl.a_ammo3 = XM1014S_RELOAD;
|
||||
pl.mode_temp = XM1014S_RELOAD;
|
||||
pl.w_idle_next = 0.65f;
|
||||
} else if (pl.a_ammo3 == XM1014S_RELOAD) {
|
||||
} else if (pl.mode_temp == XM1014S_RELOAD) {
|
||||
Weapons_ViewAnimation(XM1014_INSERT);
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1++;
|
||||
pl.a_ammo2--;
|
||||
pl.xm1014_mag++;
|
||||
pl.ammo_buckshot--;
|
||||
|
||||
if (pl.a_ammo2 <= 0 || pl.a_ammo1 >= 7) {
|
||||
pl.a_ammo3 = XM1014S_RELOAD_END;
|
||||
if (pl.ammo_buckshot <= 0 || pl.xm1014_mag >= 7) {
|
||||
pl.mode_temp = XM1014S_RELOAD_END;
|
||||
}
|
||||
#else
|
||||
pl.xm1014_mag++;
|
||||
|
@ -229,13 +228,13 @@ w_xm1014_release(void)
|
|||
w_xm1014_updateammo(pl);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_xm1014.insertshell");
|
||||
if (pl.ammo_buckshot <= 0 || pl.xm1014_mag >= 7) {
|
||||
pl.a_ammo3 = XM1014S_RELOAD_END;
|
||||
pl.mode_temp = XM1014S_RELOAD_END;
|
||||
}
|
||||
#endif
|
||||
pl.w_idle_next = 0.5f;
|
||||
} else if (pl.a_ammo3 == XM1014S_RELOAD_END) {
|
||||
} else if (pl.mode_temp == XM1014S_RELOAD_END) {
|
||||
Weapons_ViewAnimation(XM1014_RELOAD_END);
|
||||
pl.a_ammo3 = XM1014S_IDLE;
|
||||
pl.mode_temp = XM1014S_IDLE;
|
||||
pl.w_idle_next = 10.0f;
|
||||
pl.w_attack_next = 0.5f;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,12 @@ BASEGAME gearbox
|
|||
-set gameinfo_cldll 1
|
||||
-set gameinfo_hlversion "1110"
|
||||
-set gameinfo_svonly "0"
|
||||
-set gameinfo_pkgname "cg_gearbox"
|
||||
-set gameinfo_pkgname "valve_uplink valve_realmedia valve_patch1110 valve_opfordemo valve_hlds logos_realmedia valve_dayone addon_furtherdata addon_holidaymodels"
|
||||
-set gameinfo_pkgfile "halflife.wad"
|
||||
-set gameinfo_introvideo ""
|
||||
|
||||
DOWNLOADSURL http://www.frag-net.com/dl/valve_packages
|
||||
UPDATEURL http://www.frag-net.com/mods/gearbox.fmf
|
||||
|
||||
// you don't really want to change these
|
||||
RTCBROKER master.frag-net.com:27950
|
||||
|
|
|
@ -21,99 +21,7 @@ var int autocvar_sv_playerkeepalive = TRUE;
|
|||
void
|
||||
HLGameRules::PlayerPostFrame(base_player pp)
|
||||
{
|
||||
player pl = (player)pp;
|
||||
Animation_PlayerUpdate();
|
||||
|
||||
if (autocvar_sv_playerkeepalive)
|
||||
pl.SendFlags |= PLAYER_KEEPALIVE;
|
||||
|
||||
if (pl.old_modelindex != pl.modelindex)
|
||||
pl.SendFlags |= PLAYER_MODELINDEX;
|
||||
|
||||
if (pl.old_origin[0] != pl.origin[0])
|
||||
pl.SendFlags |= PLAYER_ORIGIN;
|
||||
|
||||
if (pl.old_origin[1] != pl.origin[1])
|
||||
pl.SendFlags |= PLAYER_ORIGIN;
|
||||
|
||||
if (pl.old_origin[2] != pl.origin[2])
|
||||
pl.SendFlags |= PLAYER_ORIGIN_Z;
|
||||
|
||||
if (pl.old_angles[0] != pl.v_angle[0])
|
||||
pl.SendFlags |= PLAYER_ANGLES_X;
|
||||
|
||||
if (pl.old_angles[1] != pl.angles[1])
|
||||
pl.SendFlags |= PLAYER_ANGLES_Y;
|
||||
|
||||
if (pl.old_angles[2] != pl.angles[2])
|
||||
pl.SendFlags |= PLAYER_ANGLES_Z;
|
||||
|
||||
if (pl.old_velocity[0] != pl.velocity[0])
|
||||
pl.SendFlags |= PLAYER_VELOCITY;
|
||||
|
||||
if (pl.old_velocity[1] != pl.velocity[1])
|
||||
pl.SendFlags |= PLAYER_VELOCITY;
|
||||
|
||||
if (pl.old_velocity[2] != pl.velocity[2])
|
||||
pl.SendFlags |= PLAYER_VELOCITY_Z;
|
||||
|
||||
if (pl.old_flags != pl.flags)
|
||||
pl.SendFlags |= PLAYER_FLAGS;
|
||||
|
||||
if (pl.old_gflags != pl.gflags)
|
||||
pl.SendFlags |= PLAYER_FLAGS;
|
||||
|
||||
if (pl.old_activeweapon != pl.activeweapon)
|
||||
pl.SendFlags |= PLAYER_WEAPON;
|
||||
|
||||
if (pl.old_items != pl.g_items)
|
||||
pl.SendFlags |= PLAYER_ITEMS;
|
||||
|
||||
if (pl.old_health != pl.health)
|
||||
pl.SendFlags |= PLAYER_HEALTH;
|
||||
|
||||
if (pl.old_armor != pl.armor)
|
||||
pl.SendFlags |= PLAYER_ARMOR;
|
||||
|
||||
if (pl.old_movetype != pl.movetype)
|
||||
pl.SendFlags |= PLAYER_MOVETYPE;
|
||||
|
||||
if (pl.old_viewofs != pl.view_ofs[2])
|
||||
pl.SendFlags |= PLAYER_VIEWOFS;
|
||||
|
||||
if (pl.old_baseframe != pl.baseframe)
|
||||
pl.SendFlags |= PLAYER_BASEFRAME;
|
||||
|
||||
if (pl.old_frame != pl.frame)
|
||||
pl.SendFlags |= PLAYER_FRAME;
|
||||
|
||||
if (pl.old_a_ammo1 != pl.a_ammo1)
|
||||
pl.SendFlags |= PLAYER_AMMO1;
|
||||
|
||||
if (pl.old_a_ammo2 != pl.a_ammo2)
|
||||
pl.SendFlags |= PLAYER_AMMO2;
|
||||
|
||||
if (pl.old_a_ammo3 != pl.a_ammo3)
|
||||
pl.SendFlags |= PLAYER_AMMO3;
|
||||
|
||||
pl.old_modelindex = pl.modelindex;
|
||||
pl.old_origin = pl.origin;
|
||||
pl.old_angles = pl.angles;
|
||||
pl.old_angles[0] = pl.v_angle[0];
|
||||
pl.old_velocity = pl.velocity;
|
||||
pl.old_flags = pl.flags;
|
||||
pl.old_gflags = pl.gflags;
|
||||
pl.old_activeweapon = pl.activeweapon;
|
||||
pl.old_items = pl.g_items;
|
||||
pl.old_health = pl.health;
|
||||
pl.old_armor = pl.armor;
|
||||
pl.old_movetype = pl.movetype;
|
||||
pl.old_viewofs = pl.view_ofs[2];
|
||||
pl.old_baseframe = pl.baseframe;
|
||||
pl.old_frame = pl.frame;
|
||||
pl.old_a_ammo1 = pl.a_ammo1;
|
||||
pl.old_a_ammo2 = pl.a_ammo2;
|
||||
pl.old_a_ammo3 = pl.a_ammo3;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -123,7 +123,6 @@ OP4CTFRules::PlayerSpawn(base_player pp)
|
|||
pl.velocity = [0,0,0];
|
||||
pl.gravity = __NULL__;
|
||||
pl.frame = 1;
|
||||
pl.SendEntity = Player_SendEntity;
|
||||
pl.SendFlags = UPDATE_ALL;
|
||||
pl.customphysics = Empty;
|
||||
pl.iBleeds = TRUE;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -14,10 +14,146 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
int input_sequence;
|
||||
/* all potential SendFlags bits we can possibly send */
|
||||
enumflags
|
||||
{
|
||||
PLAYER_KEEPALIVE,
|
||||
PLAYER_MODELINDEX,
|
||||
PLAYER_ORIGIN,
|
||||
PLAYER_ORIGIN_Z,
|
||||
PLAYER_ANGLES_X,
|
||||
PLAYER_ANGLES_Y,
|
||||
PLAYER_ANGLES_Z,
|
||||
PLAYER_VELOCITY,
|
||||
PLAYER_VELOCITY_Z,
|
||||
PLAYER_FLAGS,
|
||||
PLAYER_WEAPON,
|
||||
PLAYER_ITEMS,
|
||||
PLAYER_HEALTH,
|
||||
PLAYER_ARMOR,
|
||||
PLAYER_MOVETYPE,
|
||||
PLAYER_VIEWOFS,
|
||||
PLAYER_BASEFRAME,
|
||||
PLAYER_FRAME,
|
||||
PLAYER_AMMO1,
|
||||
PLAYER_AMMO2,
|
||||
PLAYER_AMMO3,
|
||||
PLAYER_UNUSED1,
|
||||
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
|
||||
{
|
||||
/* 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;
|
||||
|
||||
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;
|
||||
|
||||
int ammo_m203_grenade;
|
||||
int ammo_m203_grenade_net;
|
||||
int ammo_shotgun_state;
|
||||
int ammo_shotgun_state_net;
|
||||
int ammo_gauss_state;
|
||||
int ammo_gauss_state_net;
|
||||
int ammo_gauss_volume;
|
||||
int ammo_gauss_volume_net;
|
||||
int ammo_egon_state;
|
||||
int ammo_egon_state_net;
|
||||
int ammo_rpg_state;
|
||||
int ammo_rpg_state_net;
|
||||
int ammo_handgrenade_state;
|
||||
int ammo_handgrenade_state_net;
|
||||
|
||||
/* gearbox */
|
||||
int eagle_mag; int eagle_mag_net;
|
||||
int sniper_mag; int sniper_mag_net;
|
||||
int m249_mag; int m249_mag_net;
|
||||
int sporelauncher_mag; int sporelauncher_mag_net;
|
||||
int ammo_556; int ammo_556_net;
|
||||
int ammo_762; int ammo_762_net;
|
||||
int ammo_spore; int ammo_spore_net;
|
||||
int ammo_shock; int ammo_shock_net;
|
||||
int ammo_penguin; int ammo_penguin_net;
|
||||
int mode_displacer; int mode_displacer_net;
|
||||
int mode_eagle; int mode_eagle_net;
|
||||
int mode_wrench; int mode_wrench_net;
|
||||
int mode_sporelauncher; int mode_sporelauncher_net;
|
||||
int mode_m249; int mode_m249_net;
|
||||
|
||||
#ifdef CLIENT
|
||||
/* External model */
|
||||
entity p_model;
|
||||
|
@ -29,37 +165,642 @@ class player:base_player
|
|||
virtual void(void) draw;
|
||||
virtual float() predraw;
|
||||
virtual void(void) postdraw;
|
||||
virtual void(float) ReceiveEntity;
|
||||
virtual void(void) PredictPreFrame;
|
||||
virtual void(void) PredictPostFrame;
|
||||
#else
|
||||
/* valve specific */
|
||||
int glock_mag;
|
||||
int mp5_mag;
|
||||
int python_mag;
|
||||
int shotgun_mag;
|
||||
int crossbow_mag;
|
||||
int rpg_mag;
|
||||
int satchel_chg;
|
||||
int ammo_9mm;
|
||||
int ammo_357;
|
||||
int ammo_buckshot;
|
||||
int ammo_m203_grenade;
|
||||
int ammo_bolt;
|
||||
int ammo_rocket;
|
||||
int ammo_uranium;
|
||||
int ammo_handgrenade;
|
||||
int ammo_satchel;
|
||||
int ammo_tripmine;
|
||||
int ammo_snark;
|
||||
int ammo_hornet;
|
||||
|
||||
/* gearbox */
|
||||
int eagle_mag;
|
||||
int sniper_mag;
|
||||
int m249_mag;
|
||||
int sporelauncher_mag;
|
||||
int ammo_556;
|
||||
int ammo_762;
|
||||
int ammo_spore;
|
||||
int ammo_shock;
|
||||
int ammo_penguin;
|
||||
virtual void(void) EvaluateEntity;
|
||||
virtual float(entity, float) SendEntity;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef CLIENT
|
||||
void Weapons_AmmoUpdate(entity);
|
||||
/*
|
||||
=================
|
||||
player::ReceiveEntity
|
||||
=================
|
||||
*/
|
||||
void
|
||||
player::ReceiveEntity(float new)
|
||||
{
|
||||
float fl;
|
||||
if (new == FALSE) {
|
||||
/* Go through all the physics code between the last received frame
|
||||
* and the newest frame and keep the changes this time around instead
|
||||
* of rolling back, because we'll apply the new server-verified values
|
||||
* right after anyway. */
|
||||
/* FIXME: splitscreen */
|
||||
if (entnum == player_localentnum) {
|
||||
/* FIXME: splitscreen */
|
||||
pSeat = &g_seats[0];
|
||||
|
||||
for (int i = sequence+1; i <= servercommandframe; i++) {
|
||||
/* ...maybe the input state is too old? */
|
||||
if (!getinputstate(i)) {
|
||||
break;
|
||||
}
|
||||
input_sequence = i;
|
||||
PMove_Run();
|
||||
}
|
||||
|
||||
/* any differences in things that are read below are now
|
||||
* officially from prediction misses. */
|
||||
}
|
||||
}
|
||||
|
||||
/* 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();
|
||||
if (fl & PLAYER_BASEFRAME)
|
||||
baseframe = readbyte();
|
||||
if (fl & PLAYER_FRAME) {
|
||||
frame = readbyte();
|
||||
frame1time = 0.0f;
|
||||
frame2time = 0.0f;
|
||||
}
|
||||
|
||||
if (fl & PLAYER_AMMO1) {
|
||||
glock_mag = readbyte();
|
||||
mp5_mag = readbyte();
|
||||
python_mag = readbyte();
|
||||
shotgun_mag = readbyte();
|
||||
crossbow_mag = readbyte();
|
||||
rpg_mag = readbyte();
|
||||
satchel_chg = readbyte();
|
||||
|
||||
/* gearbox */
|
||||
eagle_mag = readbyte();
|
||||
sniper_mag = readbyte();
|
||||
m249_mag = readbyte();
|
||||
sporelauncher_mag = readbyte();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_AMMO2) {
|
||||
ammo_9mm = readbyte();
|
||||
ammo_357 = readbyte();
|
||||
ammo_buckshot = readbyte();
|
||||
ammo_bolt = readbyte();
|
||||
ammo_rocket = readbyte();
|
||||
ammo_uranium = readbyte();
|
||||
ammo_handgrenade = readbyte();
|
||||
ammo_satchel = readbyte();
|
||||
ammo_tripmine = readbyte();
|
||||
ammo_snark = readbyte();
|
||||
ammo_hornet = readbyte();
|
||||
|
||||
/* gearbox */
|
||||
ammo_556 = readbyte();
|
||||
ammo_762 = readbyte();
|
||||
ammo_spore = readbyte();
|
||||
ammo_shock = readbyte();
|
||||
ammo_penguin = readbyte();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_AMMO3) {
|
||||
ammo_m203_grenade = readbyte();
|
||||
ammo_shotgun_state = readbyte();
|
||||
ammo_gauss_state = readbyte();
|
||||
ammo_gauss_volume = readbyte();
|
||||
ammo_egon_state = readbyte();
|
||||
ammo_rpg_state = readbyte();
|
||||
ammo_handgrenade_state = readbyte();
|
||||
|
||||
/* gearbox */
|
||||
mode_displacer = readbyte();
|
||||
mode_eagle = readbyte();
|
||||
mode_wrench = readbyte();
|
||||
mode_sporelauncher = readbyte();
|
||||
mode_m249 = readbyte();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_AMMO1 || fl & PLAYER_AMMO2 || fl & PLAYER_AMMO3)
|
||||
Weapons_AmmoUpdate(this);
|
||||
|
||||
setorigin(this, origin);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
player::PredictPostFrame
|
||||
|
||||
Save the last valid server values away in the _net variants of each field
|
||||
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;
|
||||
|
||||
ammo_m203_grenade_net = ammo_m203_grenade;
|
||||
ammo_shotgun_state_net = ammo_shotgun_state;
|
||||
ammo_gauss_state_net = ammo_gauss_state;
|
||||
ammo_gauss_volume_net = ammo_gauss_volume;
|
||||
ammo_egon_state_net = ammo_egon_state;
|
||||
ammo_rpg_state_net = ammo_rpg_state;
|
||||
ammo_handgrenade_state_net = ammo_handgrenade_state;
|
||||
|
||||
/* gearbox */
|
||||
eagle_mag_net = eagle_mag;
|
||||
sniper_mag_net = sniper_mag;
|
||||
m249_mag_net = m249_mag;
|
||||
sporelauncher_mag_net = sporelauncher_mag;
|
||||
ammo_556_net = ammo_556;
|
||||
ammo_762_net = ammo_762;
|
||||
ammo_spore_net = ammo_spore;
|
||||
ammo_shock_net = ammo_shock;
|
||||
ammo_penguin_net = ammo_penguin;
|
||||
mode_displacer_net = mode_displacer;
|
||||
mode_eagle_net = mode_eagle;
|
||||
mode_wrench_net = mode_wrench;
|
||||
mode_sporelauncher_net = mode_sporelauncher;
|
||||
mode_m249_net = mode_m249;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
player::PredictPostFrame
|
||||
|
||||
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;
|
||||
|
||||
ammo_m203_grenade = ammo_m203_grenade_net;
|
||||
ammo_shotgun_state = ammo_shotgun_state_net;
|
||||
ammo_gauss_state = ammo_gauss_state_net;
|
||||
ammo_gauss_volume = ammo_gauss_volume_net;
|
||||
ammo_egon_state = ammo_egon_state_net;
|
||||
ammo_rpg_state = ammo_rpg_state_net;
|
||||
ammo_handgrenade_state = ammo_handgrenade_state_net;
|
||||
|
||||
/* gearbox */
|
||||
eagle_mag = eagle_mag_net;
|
||||
sniper_mag = sniper_mag_net;
|
||||
m249_mag = m249_mag_net;
|
||||
sporelauncher_mag = sporelauncher_mag_net;
|
||||
ammo_556 = ammo_556_net;
|
||||
ammo_762 = ammo_762_net;
|
||||
ammo_spore = ammo_spore_net;
|
||||
ammo_shock = ammo_shock_net;
|
||||
ammo_penguin = ammo_penguin_net;
|
||||
mode_displacer = mode_displacer_net;
|
||||
mode_eagle = mode_eagle_net;
|
||||
mode_wrench = mode_wrench_net;
|
||||
mode_sporelauncher = mode_sporelauncher_net;
|
||||
mode_m249 = mode_m249_net;
|
||||
}
|
||||
|
||||
#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;
|
||||
|
||||
if (old_baseframe != baseframe)
|
||||
SendFlags |= PLAYER_BASEFRAME;
|
||||
|
||||
if (old_frame != frame)
|
||||
SendFlags |= PLAYER_FRAME;
|
||||
|
||||
/* ammo 1 type updates */
|
||||
if (glock_mag != glock_mag_net) {
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (mp5_mag != mp5_mag_net) {
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (python_mag != python_mag_net) {
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (shotgun_mag != shotgun_mag_net) {
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (crossbow_mag != crossbow_mag_net) {
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (rpg_mag != rpg_mag_net) {
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (satchel_chg != satchel_chg_net) {
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
|
||||
/* ammo 2 type updates */
|
||||
if (ammo_9mm != ammo_9mm_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_357 != ammo_357_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_buckshot != ammo_buckshot_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_bolt != ammo_bolt_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_rocket != ammo_rocket_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_uranium != ammo_uranium_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_handgrenade != ammo_handgrenade_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_satchel != ammo_satchel_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_tripmine != ammo_tripmine_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_snark != ammo_snark_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_hornet != ammo_hornet_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
|
||||
if (ammo_m203_grenade != ammo_m203_grenade_net) {
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_shotgun_state != ammo_shotgun_state_net) {
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_gauss_state != ammo_gauss_state_net) {
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_gauss_volume != ammo_gauss_volume_net) {
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_egon_state != ammo_egon_state_net) {
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_rpg_state != ammo_rpg_state_net) {
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_handgrenade_state != ammo_handgrenade_state_net) {
|
||||
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;
|
||||
|
||||
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_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_shotgun_state_net = ammo_shotgun_state;
|
||||
ammo_gauss_state_net = ammo_gauss_state;
|
||||
ammo_gauss_volume_net = ammo_gauss_volume;
|
||||
ammo_egon_state_net = ammo_egon_state;
|
||||
ammo_rpg_state_net = ammo_rpg_state;
|
||||
ammo_handgrenade_state_net = ammo_handgrenade_state;
|
||||
|
||||
/* gearbox */
|
||||
if (eagle_mag_net != eagle_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (sniper_mag_net != sniper_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (m249_mag_net != m249_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
if (sporelauncher_mag_net != sporelauncher_mag)
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
|
||||
if (ammo_556_net != ammo_556)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
if (ammo_762_net != ammo_762)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
if (ammo_spore_net != ammo_spore)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
if (ammo_shock_net != ammo_shock)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
if (ammo_penguin_net != ammo_penguin)
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
|
||||
if (mode_displacer_net != mode_displacer)
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
if (mode_eagle_net != mode_eagle)
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
if (mode_wrench_net != mode_wrench)
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
if (mode_sporelauncher_net != mode_sporelauncher)
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
|
||||
eagle_mag_net = eagle_mag;
|
||||
sniper_mag_net = sniper_mag;
|
||||
m249_mag_net = m249_mag;
|
||||
sporelauncher_mag_net = sporelauncher_mag;
|
||||
ammo_556_net = ammo_556;
|
||||
ammo_762_net = ammo_762;
|
||||
ammo_spore_net = ammo_spore;
|
||||
ammo_shock_net = ammo_shock;
|
||||
ammo_penguin_net = ammo_penguin;
|
||||
mode_displacer_net = mode_displacer;
|
||||
mode_eagle_net = mode_eagle;
|
||||
mode_wrench_net = mode_wrench;
|
||||
mode_sporelauncher_net = mode_sporelauncher;
|
||||
mode_m249_net = mode_m249;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
player::SendEntity
|
||||
=================
|
||||
*/
|
||||
float
|
||||
player::SendEntity(entity ePEnt, float fChanged)
|
||||
{
|
||||
if (health <= 0 && ePEnt != this) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (clienttype(ePEnt) != CLIENTTYPE_REAL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (ePEnt != self) {
|
||||
fChanged &= ~PLAYER_ITEMS;
|
||||
fChanged &= ~PLAYER_HEALTH;
|
||||
fChanged &= ~PLAYER_ARMOR;
|
||||
fChanged &= ~PLAYER_VIEWOFS;
|
||||
fChanged &= ~PLAYER_AMMO1;
|
||||
fChanged &= ~PLAYER_AMMO2;
|
||||
fChanged &= ~PLAYER_AMMO3;
|
||||
}
|
||||
|
||||
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]);
|
||||
if (fChanged & PLAYER_BASEFRAME)
|
||||
WriteByte(MSG_ENTITY, baseframe);
|
||||
if (fChanged & PLAYER_FRAME)
|
||||
WriteByte(MSG_ENTITY, frame);
|
||||
|
||||
if (fChanged & PLAYER_AMMO1) {
|
||||
WriteByte(MSG_ENTITY, glock_mag);
|
||||
WriteByte(MSG_ENTITY, mp5_mag);
|
||||
WriteByte(MSG_ENTITY, python_mag);
|
||||
WriteByte(MSG_ENTITY, shotgun_mag);
|
||||
WriteByte(MSG_ENTITY, crossbow_mag);
|
||||
WriteByte(MSG_ENTITY, rpg_mag);
|
||||
WriteByte(MSG_ENTITY, satchel_chg);
|
||||
|
||||
/* gearbox */
|
||||
WriteByte(MSG_ENTITY, eagle_mag);
|
||||
WriteByte(MSG_ENTITY, sniper_mag);
|
||||
WriteByte(MSG_ENTITY, m249_mag);
|
||||
WriteByte(MSG_ENTITY, sporelauncher_mag);
|
||||
}
|
||||
|
||||
if (fChanged & PLAYER_AMMO2) {
|
||||
WriteByte(MSG_ENTITY, ammo_9mm);
|
||||
WriteByte(MSG_ENTITY, ammo_357);
|
||||
WriteByte(MSG_ENTITY, ammo_buckshot);
|
||||
WriteByte(MSG_ENTITY, ammo_bolt);
|
||||
WriteByte(MSG_ENTITY, ammo_rocket);
|
||||
WriteByte(MSG_ENTITY, ammo_uranium);
|
||||
WriteByte(MSG_ENTITY, ammo_handgrenade);
|
||||
WriteByte(MSG_ENTITY, ammo_satchel);
|
||||
WriteByte(MSG_ENTITY, ammo_tripmine);
|
||||
WriteByte(MSG_ENTITY, ammo_snark);
|
||||
WriteByte(MSG_ENTITY, ammo_hornet);
|
||||
|
||||
/* gearbox */
|
||||
WriteByte(MSG_ENTITY, ammo_556);
|
||||
WriteByte(MSG_ENTITY, ammo_762);
|
||||
WriteByte(MSG_ENTITY, ammo_spore);
|
||||
WriteByte(MSG_ENTITY, ammo_shock);
|
||||
WriteByte(MSG_ENTITY, ammo_penguin);
|
||||
}
|
||||
|
||||
if (fChanged & PLAYER_AMMO3) {
|
||||
WriteByte(MSG_ENTITY, ammo_m203_grenade);
|
||||
WriteByte(MSG_ENTITY, ammo_shotgun_state);
|
||||
WriteByte(MSG_ENTITY, ammo_gauss_state);
|
||||
WriteByte(MSG_ENTITY, ammo_gauss_volume);
|
||||
WriteByte(MSG_ENTITY, ammo_egon_state);
|
||||
WriteByte(MSG_ENTITY, ammo_rpg_state);
|
||||
WriteByte(MSG_ENTITY, ammo_handgrenade_state);
|
||||
|
||||
/* gearbox */
|
||||
WriteByte(MSG_ENTITY, mode_displacer);
|
||||
WriteByte(MSG_ENTITY, mode_eagle);
|
||||
WriteByte(MSG_ENTITY, mode_wrench);
|
||||
WriteByte(MSG_ENTITY, mode_sporelauncher);
|
||||
WriteByte(MSG_ENTITY, mode_m249);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -61,9 +61,7 @@ w_displacer_precache(void)
|
|||
void
|
||||
w_displacer_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_uranium, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -189,16 +187,16 @@ w_displacer_release(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo3 == 1) {
|
||||
if (pl.mode_displacer == 1) {
|
||||
Weapons_ViewAnimation(DISP_FIRE);
|
||||
w_displacer_fireball();
|
||||
pl.a_ammo3 = 0;
|
||||
pl.mode_displacer = 0;
|
||||
pl.w_idle_next = pl.w_attack_next = 1.0f;
|
||||
return;
|
||||
} else if (pl.a_ammo3 == 2) {
|
||||
} else if (pl.mode_displacer == 2) {
|
||||
Weapons_ViewAnimation(DISP_FIRE);
|
||||
w_displacer_teleport(pl);
|
||||
pl.a_ammo3 = 0;
|
||||
pl.mode_displacer = 0;
|
||||
pl.w_idle_next = pl.w_attack_next = 1.0f;
|
||||
return;
|
||||
}
|
||||
|
@ -224,7 +222,7 @@ w_displacer_primary(void)
|
|||
|
||||
/* ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo2 < 20) {
|
||||
if (pl.ammo_uranium < 20) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
@ -234,12 +232,12 @@ w_displacer_primary(void)
|
|||
#endif
|
||||
|
||||
/* we're already in spinning mode */
|
||||
if (pl.a_ammo3 > 0) {
|
||||
if (pl.mode_displacer > 0) {
|
||||
w_displacer_release();
|
||||
return;
|
||||
}
|
||||
|
||||
pl.a_ammo3 = 1;
|
||||
pl.mode_displacer = 1;
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(DISP_SPINUP);
|
||||
|
@ -260,7 +258,7 @@ w_displacer_secondary(void)
|
|||
|
||||
/* ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo2 < 60) {
|
||||
if (pl.ammo_uranium < 60) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
@ -270,12 +268,12 @@ w_displacer_secondary(void)
|
|||
#endif
|
||||
|
||||
/* we're already in spinning mode */
|
||||
if (pl.a_ammo3 > 0) {
|
||||
if (pl.mode_displacer > 0) {
|
||||
w_displacer_release();
|
||||
return;
|
||||
}
|
||||
|
||||
pl.a_ammo3 = 2;
|
||||
pl.mode_displacer = 2;
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(DISP_SPINUP);
|
||||
|
|
|
@ -74,9 +74,7 @@ w_eagle_pickup(int new, int startammo)
|
|||
void
|
||||
w_eagle_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.eagle_mag, pl.ammo_357, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -120,7 +118,7 @@ w_eagle_release(void)
|
|||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.a_ammo1 == 0 && pl.a_ammo2 > 0) {
|
||||
if (pl.eagle_mag == 0 && pl.ammo_357 > 0) {
|
||||
Weapons_Reload();
|
||||
return;
|
||||
}
|
||||
|
@ -131,7 +129,7 @@ w_eagle_release(void)
|
|||
|
||||
/* these idles don't support the 'empty' animation style */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
if (pl.eagle_mag <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
@ -170,7 +168,7 @@ w_eagle_primary(void)
|
|||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
if (pl.eagle_mag <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
@ -180,7 +178,7 @@ w_eagle_primary(void)
|
|||
#endif
|
||||
|
||||
/* Actual firing */
|
||||
if (pl.a_ammo3 == 1) {
|
||||
if (pl.mode_eagle == 1) {
|
||||
#ifdef SERVER
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 34, [0, 0], WEAPON_EAGLE);
|
||||
#endif
|
||||
|
@ -197,11 +195,11 @@ w_eagle_primary(void)
|
|||
pl.eagle_mag--;
|
||||
Weapons_UpdateAmmo(pl, pl.eagle_mag, pl.ammo_357, -1);
|
||||
#else
|
||||
pl.a_ammo1--;
|
||||
pl.eagle_mag--;
|
||||
View_SetMuzzleflash(MUZZLE_SMALL);
|
||||
Weapons_ViewPunchAngle([-10,0,0]);
|
||||
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
if (pl.eagle_mag <= 0) {
|
||||
Weapons_ViewAnimation(EAGLE_SHOOT_EMPTY);
|
||||
} else {
|
||||
Weapons_ViewAnimation(EAGLE_SHOOT);
|
||||
|
@ -219,10 +217,10 @@ w_eagle_secondary(void)
|
|||
}
|
||||
|
||||
/* toggle laser */
|
||||
pl.a_ammo3 = 1 - pl.a_ammo3;
|
||||
pl.mode_eagle = 1 - pl.mode_eagle;
|
||||
|
||||
#ifdef SERVER
|
||||
if (pl.a_ammo3) {
|
||||
if (pl.mode_eagle) {
|
||||
sound(pl, 8, "weapons/desert_eagle_sight.wav", 1, ATTN_NORM);
|
||||
} else {
|
||||
sound(pl, 8, "weapons/desert_eagle_sight2.wav", 1, ATTN_NORM);
|
||||
|
@ -243,10 +241,10 @@ w_eagle_reload(void)
|
|||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 7) {
|
||||
if (pl.eagle_mag >= 7) {
|
||||
return;
|
||||
}
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
if (pl.ammo_357 <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
@ -260,7 +258,7 @@ w_eagle_reload(void)
|
|||
|
||||
/* Audio-Visual bit */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
if (pl.eagle_mag <= 0) {
|
||||
Weapons_ViewAnimation(EAGLE_RELOAD);
|
||||
} else {
|
||||
Weapons_ViewAnimation(EAGLE_RELOAD_NOSHOT);
|
||||
|
@ -283,7 +281,7 @@ w_eagle_crosshair(void)
|
|||
vector aicon_pos;
|
||||
|
||||
/* crosshair/laser */
|
||||
if (pl.a_ammo3 == 1) {
|
||||
if (pl.mode_eagle == 1) {
|
||||
float lerp;
|
||||
vector jitter;
|
||||
Weapons_MakeVectors();
|
||||
|
|
|
@ -66,9 +66,7 @@ w_grapple_precache(void)
|
|||
void
|
||||
w_grapple_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, -1, -1, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -286,7 +284,7 @@ w_grapple_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_grapple =
|
||||
{
|
||||
.name = "grapple",
|
||||
.id = ITEM_GRAPPLE,
|
||||
.id = ITEM_GRAPPLE,
|
||||
.slot = 0,
|
||||
.slot_pos = 3,
|
||||
.draw = w_grapple_draw,
|
||||
|
|
|
@ -59,9 +59,7 @@ w_knife_precache(void)
|
|||
void
|
||||
w_knife_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, -1, -1, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
|
|
@ -73,9 +73,7 @@ w_m249_pickup(int new, int startammo)
|
|||
void
|
||||
w_m249_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.m249_mag, pl.ammo_556, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -118,7 +116,7 @@ w_m249_release(void)
|
|||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.a_ammo1 == 0 && pl.a_ammo2 > 0) {
|
||||
if (pl.m249_mag == 0 && pl.ammo_556 > 0) {
|
||||
Weapons_Reload();
|
||||
return;
|
||||
}
|
||||
|
@ -127,9 +125,9 @@ w_m249_release(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo3 == 1) {
|
||||
if (pl.mode_m249 == 1) {
|
||||
Weapons_ViewAnimation(M249_RELOAD2);
|
||||
pl.a_ammo3 = 0;
|
||||
pl.mode_m249 = 0;
|
||||
pl.w_attack_next = 2.45f;
|
||||
pl.w_idle_next = 15.0f;
|
||||
return;
|
||||
|
@ -150,7 +148,7 @@ w_m249_primary(void)
|
|||
player pl = (player)self;
|
||||
vector push;
|
||||
|
||||
if (pl.a_ammo3 == 1) {
|
||||
if (pl.mode_m249 == 1) {
|
||||
w_m249_release();
|
||||
return;
|
||||
}
|
||||
|
@ -161,7 +159,7 @@ w_m249_primary(void)
|
|||
|
||||
/* ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
if (pl.m249_mag <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
@ -178,7 +176,7 @@ w_m249_primary(void)
|
|||
|
||||
/* actual firing */
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
pl.m249_mag--;
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
Weapons_ViewPunchAngle([-5,0,0]);
|
||||
#else
|
||||
|
@ -214,10 +212,10 @@ w_m249_reload(void)
|
|||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 50) {
|
||||
if (pl.m249_mag >= 50) {
|
||||
return;
|
||||
}
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
if (pl.ammo_556 <= 0) {
|
||||
return;
|
||||
}
|
||||
Weapons_ViewAnimation(M249_RELOAD1);
|
||||
|
@ -232,7 +230,7 @@ w_m249_reload(void)
|
|||
Weapons_UpdateAmmo(pl, pl.m249_mag, pl.ammo_556, __NULL__);
|
||||
#endif
|
||||
|
||||
pl.a_ammo3 = 1;
|
||||
pl.mode_m249 = 1;
|
||||
pl.w_attack_next = pl.w_idle_next = 1.5f;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,10 +53,6 @@ w_penguin_draw(void)
|
|||
{
|
||||
Weapons_SetModel("models/v_penguin.mdl");
|
||||
Weapons_ViewAnimation(PENGUIN_DRAW);
|
||||
#ifdef SERVER
|
||||
player pl = (player)self;
|
||||
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_penguin, __NULL__);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -196,7 +192,7 @@ w_penguin_primary(void)
|
|||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
if (pl.ammo_penguin <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
@ -209,13 +205,13 @@ w_penguin_primary(void)
|
|||
|
||||
/* Audio-Visual Bit */
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo2--;
|
||||
pl.ammo_penguin--;
|
||||
#else
|
||||
w_penguin_deploy();
|
||||
pl.ammo_penguin--;
|
||||
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_penguin, __NULL__);
|
||||
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
if (pl.ammo_penguin <= 0) {
|
||||
Weapons_RemoveItem(pl, WEAPON_SNARK);
|
||||
}
|
||||
#endif
|
||||
|
@ -283,9 +279,7 @@ w_penguin_precache(void)
|
|||
void
|
||||
w_penguin_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_penguin, __NULL__);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
|
|
@ -68,9 +68,7 @@ w_pipewrench_precache(void)
|
|||
void
|
||||
w_pipewrench_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, -1, -1, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -190,9 +188,9 @@ w_pipewrench_secondary(void)
|
|||
|
||||
if (!pl.w_attack_next) {
|
||||
/* Hack */
|
||||
if (pl.a_ammo1 != 1) {
|
||||
if (pl.mode_wrench != 1) {
|
||||
Weapons_ViewAnimation(PIPE_ATTACKBIGWIND);
|
||||
pl.a_ammo1 = 1;
|
||||
pl.mode_wrench = 1;
|
||||
pl.w_attack_next = 0.75f;
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +207,7 @@ w_pipewrench_release(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo1 == 1) {
|
||||
if (pl.mode_wrench == 1) {
|
||||
#ifdef SERVER
|
||||
int hitsound = 0;
|
||||
string snd;
|
||||
|
@ -258,7 +256,7 @@ w_pipewrench_release(void)
|
|||
#endif
|
||||
pl.w_attack_next = 1.0f;
|
||||
pl.w_idle_next = 10.0f;
|
||||
pl.a_ammo1 = 0;
|
||||
pl.mode_wrench = 0;
|
||||
}
|
||||
|
||||
/* Pure cosmetics start here */
|
||||
|
@ -322,7 +320,7 @@ w_pipewrench_hudpic(int selected, vector pos, float a)
|
|||
weapon_t w_pipewrench =
|
||||
{
|
||||
.name = "pipewrench",
|
||||
.id = ITEM_PIPEWRENCH,
|
||||
.id = ITEM_PIPEWRENCH,
|
||||
.slot = 0,
|
||||
.slot_pos = 1,
|
||||
.draw = w_pipewrench_draw,
|
||||
|
|
|
@ -71,9 +71,7 @@ w_shockrifle_pickup(int new, int startammo)
|
|||
void
|
||||
w_shockrifle_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_shock, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -153,8 +151,8 @@ w_shockrifle_release(void)
|
|||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo2 < 10) {
|
||||
pl.a_ammo2 = bound(0, pl.a_ammo2 + 1, 10);
|
||||
if (pl.ammo_shock < 10) {
|
||||
pl.ammo_shock = bound(0, pl.ammo_shock + 1, 10);
|
||||
pl.w_idle_next = 0.35f;
|
||||
}
|
||||
#else
|
||||
|
@ -188,7 +186,7 @@ w_shockrifle_primary(void)
|
|||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
if (pl.ammo_shock <= 0) {
|
||||
w_shockrifle_release();
|
||||
return;
|
||||
}
|
||||
|
@ -210,7 +208,7 @@ w_shockrifle_primary(void)
|
|||
Weapons_MakeVectors();
|
||||
vector src = Weapons_GetCameraPos() + (v_forward * 16) + (v_up * -8);
|
||||
pointparticles(PART_SHOCKPIECE, src, v_forward * 1000, 1);
|
||||
pl.a_ammo2--;
|
||||
pl.ammo_shock--;
|
||||
#endif
|
||||
|
||||
Weapons_ViewAnimation(SHOCKRIFLE_SHOOT);
|
||||
|
|
|
@ -71,9 +71,7 @@ w_sniperrifle_pickup(int new, int startammo)
|
|||
void
|
||||
w_sniperrifle_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.sniper_mag, pl.ammo_762, __NULL__);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -121,7 +119,7 @@ w_sniperrifle_primary(void)
|
|||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
if (pl.sniper_mag <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
@ -138,11 +136,11 @@ w_sniperrifle_primary(void)
|
|||
pl.sniper_mag--;
|
||||
Weapons_UpdateAmmo(pl, pl.sniper_mag, pl.ammo_762, __NULL__);
|
||||
#else
|
||||
pl.a_ammo1--;
|
||||
pl.sniper_mag--;
|
||||
View_SetMuzzleflash(MUZZLE_SMALL);
|
||||
Weapons_ViewPunchAngle([-10,0,0]);
|
||||
|
||||
if (pl.a_ammo1) {
|
||||
if (pl.sniper_mag) {
|
||||
Weapons_ViewAnimation(SNIPER_FIRE1);
|
||||
} else {
|
||||
Weapons_ViewAnimation(SNIPER_FIRE2);
|
||||
|
@ -179,10 +177,10 @@ w_sniperrifle_reload(void)
|
|||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 5) {
|
||||
if (pl.sniper_mag >= 5) {
|
||||
return;
|
||||
}
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
if (pl.ammo_762 <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
@ -211,7 +209,7 @@ w_sniperrifle_release(void)
|
|||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.a_ammo1 == 0 && pl.a_ammo2 > 0) {
|
||||
if (pl.sniper_mag == 0 && pl.ammo_762 > 0) {
|
||||
Weapons_Reload();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -161,9 +161,7 @@ w_sporelauncher_precache(void)
|
|||
void
|
||||
w_sporelauncher_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.sporelauncher_mag, pl.ammo_spore, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -240,7 +238,7 @@ w_sporelauncher_primary(void)
|
|||
pl.sporelauncher_mag--;
|
||||
Weapons_UpdateAmmo(pl, pl.sporelauncher_mag, pl.ammo_spore, -1);
|
||||
#else
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
if (pl.sporelauncher_mag <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -272,7 +270,7 @@ w_sporelauncher_secondary(void)
|
|||
pl.sporelauncher_mag--;
|
||||
Weapons_UpdateAmmo(pl, pl.sporelauncher_mag, pl.ammo_spore, -1);
|
||||
#else
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
if (pl.sporelauncher_mag <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -290,7 +288,7 @@ void w_sporelauncher_release(void)
|
|||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.a_ammo3 == SLSTATE_IDLE && pl.a_ammo1 == 0 && pl.a_ammo2 > 0) {
|
||||
if (pl.mode_sporelauncher == SLSTATE_IDLE && pl.sporelauncher_mag == 0 && pl.ammo_spore > 0) {
|
||||
Weapons_Reload();
|
||||
return;
|
||||
}
|
||||
|
@ -299,7 +297,7 @@ void w_sporelauncher_release(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo3 == SLSTATE_IDLE) {
|
||||
if (pl.mode_sporelauncher == SLSTATE_IDLE) {
|
||||
int r = (float)input_sequence % 3;
|
||||
switch (r) {
|
||||
case 0:
|
||||
|
@ -315,32 +313,32 @@ void w_sporelauncher_release(void)
|
|||
pl.w_idle_next = 4.0f;
|
||||
break;
|
||||
}
|
||||
} else if (pl.a_ammo3 == SLSTATE_RELOAD_START) {
|
||||
} else if (pl.mode_sporelauncher == SLSTATE_RELOAD_START) {
|
||||
Weapons_ViewAnimation(SPORE_RELOAD1);
|
||||
pl.a_ammo3 = SLSTATE_RELOAD;
|
||||
pl.mode_sporelauncher = SLSTATE_RELOAD;
|
||||
pl.w_idle_next = 0.65f;
|
||||
} else if (pl.a_ammo3 == SLSTATE_RELOAD) {
|
||||
} else if (pl.mode_sporelauncher == SLSTATE_RELOAD) {
|
||||
Weapons_ViewAnimation(SPORE_RELOAD2);
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1++;
|
||||
pl.a_ammo2--;
|
||||
pl.sporelauncher_mag++;
|
||||
pl.ammo_spore--;
|
||||
|
||||
if (pl.a_ammo2 <= 0 || pl.a_ammo1 >= 5) {
|
||||
pl.a_ammo3 = SLSTATE_RELOAD_END;
|
||||
if (pl.ammo_spore <= 0 || pl.sporelauncher_mag >= 5) {
|
||||
pl.mode_sporelauncher = SLSTATE_RELOAD_END;
|
||||
}
|
||||
#else
|
||||
pl.sporelauncher_mag++;
|
||||
pl.ammo_spore--;
|
||||
|
||||
if (pl.ammo_spore <= 0 || pl.sporelauncher_mag >= 5) {
|
||||
pl.a_ammo3 = SLSTATE_RELOAD_END;
|
||||
pl.mode_sporelauncher = SLSTATE_RELOAD_END;
|
||||
}
|
||||
#endif
|
||||
pl.w_idle_next = 1.0f;
|
||||
} else if (pl.a_ammo3 == SLSTATE_RELOAD_END) {
|
||||
} else if (pl.mode_sporelauncher == SLSTATE_RELOAD_END) {
|
||||
Weapons_ViewAnimation(SPORE_RELOAD3);
|
||||
|
||||
pl.a_ammo3 = SLSTATE_IDLE;
|
||||
pl.mode_sporelauncher = SLSTATE_IDLE;
|
||||
pl.w_idle_next = 10.0f;
|
||||
pl.w_attack_next = 0.5f;
|
||||
}
|
||||
|
@ -352,10 +350,10 @@ w_sporelauncher_reload(void)
|
|||
player pl = (player)self;
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 5) {
|
||||
if (pl.sporelauncher_mag >= 5) {
|
||||
return;
|
||||
}
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
if (pl.ammo_spore <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
@ -367,11 +365,11 @@ w_sporelauncher_reload(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (pl.a_ammo3 > SLSTATE_IDLE) {
|
||||
if (pl.mode_sporelauncher > SLSTATE_IDLE) {
|
||||
return;
|
||||
}
|
||||
|
||||
pl.a_ammo3 = SLSTATE_RELOAD_START;
|
||||
pl.mode_sporelauncher = SLSTATE_RELOAD_START;
|
||||
pl.w_idle_next = 0.0f;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,6 @@ SHMultiplayerRules::PlayerSpawn(base_player pp)
|
|||
pl.velocity = [0,0,0];
|
||||
pl.gravity = __NULL__;
|
||||
pl.frame = 1;
|
||||
pl.SendEntity = Player_SendEntity;
|
||||
pl.SendFlags = UPDATE_ALL;
|
||||
pl.customphysics = Empty;
|
||||
pl.iBleeds = TRUE;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -14,49 +14,697 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
int input_sequence;
|
||||
/* all potential SendFlags bits we can possibly send */
|
||||
enumflags
|
||||
{
|
||||
PLAYER_KEEPALIVE,
|
||||
PLAYER_MODELINDEX,
|
||||
PLAYER_ORIGIN,
|
||||
PLAYER_ORIGIN_Z,
|
||||
PLAYER_ANGLES_X,
|
||||
PLAYER_ANGLES_Y,
|
||||
PLAYER_ANGLES_Z,
|
||||
PLAYER_VELOCITY,
|
||||
PLAYER_VELOCITY_Z,
|
||||
PLAYER_FLAGS,
|
||||
PLAYER_WEAPON,
|
||||
PLAYER_ITEMS,
|
||||
PLAYER_HEALTH,
|
||||
PLAYER_ARMOR,
|
||||
PLAYER_MOVETYPE,
|
||||
PLAYER_VIEWOFS,
|
||||
PLAYER_BASEFRAME,
|
||||
PLAYER_FRAME,
|
||||
PLAYER_AMMO1,
|
||||
PLAYER_AMMO2,
|
||||
PLAYER_AMMO3,
|
||||
PLAYER_UNUSED1,
|
||||
PLAYER_UNUSED2
|
||||
};
|
||||
|
||||
/* ammo 1 type updates */
|
||||
enumflags
|
||||
{
|
||||
AMMO1_GLOCK,
|
||||
AMMO1_MP5,
|
||||
AMMO1_PYTHON,
|
||||
AMMO1_SHOTGUN,
|
||||
AMMO1_CROSSBOW,
|
||||
AMMO1_RPG,
|
||||
AMMO1_SATCHEL,
|
||||
AMMO1_CANNON
|
||||
};
|
||||
|
||||
/* 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,
|
||||
AMMO3_CHAINSAW_STATE,
|
||||
AMMO3_HAMMER_STATE
|
||||
};
|
||||
|
||||
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;
|
||||
int cannon_mag;
|
||||
int cannon_mag_net;
|
||||
|
||||
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;
|
||||
|
||||
int ammo_m203_grenade;
|
||||
int ammo_m203_grenade_net;
|
||||
int ammo_shotgun_state;
|
||||
int ammo_shotgun_state_net;
|
||||
int ammo_gauss_state;
|
||||
int ammo_gauss_state_net;
|
||||
int ammo_gauss_volume;
|
||||
int ammo_gauss_volume_net;
|
||||
int ammo_egon_state;
|
||||
int ammo_egon_state_net;
|
||||
int ammo_rpg_state;
|
||||
int ammo_rpg_state_net;
|
||||
int ammo_handgrenade_state;
|
||||
int ammo_handgrenade_state_net;
|
||||
int ammo_chainsaw_state;
|
||||
int ammo_chainsaw_state_net;
|
||||
int ammo_hammer_state;
|
||||
int ammo_hammer_state_net;
|
||||
|
||||
#ifdef CLIENT
|
||||
/* External model */
|
||||
entity p_model;
|
||||
int playertype;
|
||||
int p_hand_bone;
|
||||
int p_model_bone;
|
||||
float lastweapon;
|
||||
|
||||
|
||||
virtual void(void) gun_offset;
|
||||
virtual void(void) draw;
|
||||
virtual float() predraw;
|
||||
virtual void(void) postdraw;
|
||||
virtual void(float) ReceiveEntity;
|
||||
virtual void(void) PredictPreFrame;
|
||||
virtual void(void) PredictPostFrame;
|
||||
#else
|
||||
|
||||
/* Weapon specific */
|
||||
int glock_mag;
|
||||
int mp5_mag;
|
||||
int python_mag;
|
||||
int shotgun_mag;
|
||||
int crossbow_mag;
|
||||
int rpg_mag;
|
||||
int satchel_chg;
|
||||
int cannon_mag;
|
||||
|
||||
int ammo_9mm;
|
||||
int ammo_357;
|
||||
int ammo_buckshot;
|
||||
int ammo_m203_grenade;
|
||||
int ammo_bolt;
|
||||
int ammo_rocket;
|
||||
int ammo_uranium;
|
||||
int ammo_handgrenade;
|
||||
int ammo_satchel;
|
||||
int ammo_tripmine;
|
||||
int ammo_snark;
|
||||
int ammo_hornet;
|
||||
virtual void(void) EvaluateEntity;
|
||||
virtual float(entity, float) SendEntity;
|
||||
|
||||
int sh_insanecount;
|
||||
float sh_insanetime;
|
||||
float sh_insaneactive;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef CLIENT
|
||||
void Weapons_AmmoUpdate(entity);
|
||||
/*
|
||||
=================
|
||||
player::ReceiveEntity
|
||||
=================
|
||||
*/
|
||||
void
|
||||
player::ReceiveEntity(float new)
|
||||
{
|
||||
float fl;
|
||||
if (new == FALSE) {
|
||||
/* Go through all the physics code between the last received frame
|
||||
* and the newest frame and keep the changes this time around instead
|
||||
* of rolling back, because we'll apply the new server-verified values
|
||||
* right after anyway. */
|
||||
/* FIXME: splitscreen */
|
||||
if (entnum == player_localentnum) {
|
||||
/* FIXME: splitscreen */
|
||||
pSeat = &g_seats[0];
|
||||
|
||||
for (int i = sequence+1; i <= servercommandframe; i++) {
|
||||
/* ...maybe the input state is too old? */
|
||||
if (!getinputstate(i)) {
|
||||
break;
|
||||
}
|
||||
input_sequence = i;
|
||||
PMove_Run();
|
||||
}
|
||||
|
||||
/* any differences in things that are read below are now
|
||||
* officially from prediction misses. */
|
||||
}
|
||||
}
|
||||
|
||||
/* 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();
|
||||
if (fl & PLAYER_BASEFRAME)
|
||||
baseframe = readbyte();
|
||||
if (fl & PLAYER_FRAME) {
|
||||
frame = readbyte();
|
||||
frame1time = 0.0f;
|
||||
frame2time = 0.0f;
|
||||
}
|
||||
|
||||
if (fl & PLAYER_AMMO1) {
|
||||
glock_mag = readbyte();
|
||||
mp5_mag = readbyte();
|
||||
python_mag = readbyte();
|
||||
shotgun_mag = readbyte();
|
||||
crossbow_mag = readbyte();
|
||||
rpg_mag = readbyte();
|
||||
satchel_chg = readbyte();
|
||||
cannon_mag = readbyte();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_AMMO2) {
|
||||
ammo_9mm = readbyte();
|
||||
ammo_357 = readbyte();
|
||||
ammo_buckshot = readbyte();
|
||||
ammo_bolt = readbyte();
|
||||
ammo_rocket = readbyte();
|
||||
ammo_uranium = readbyte();
|
||||
ammo_handgrenade = readbyte();
|
||||
ammo_satchel = readbyte();
|
||||
ammo_tripmine = readbyte();
|
||||
ammo_snark = readbyte();
|
||||
ammo_hornet = readbyte();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_AMMO3) {
|
||||
ammo_m203_grenade = readbyte();
|
||||
ammo_shotgun_state = readbyte();
|
||||
ammo_gauss_state = readbyte();
|
||||
ammo_gauss_volume = readbyte();
|
||||
ammo_egon_state = readbyte();
|
||||
ammo_rpg_state = readbyte();
|
||||
ammo_handgrenade_state = readbyte();
|
||||
ammo_chainsaw_state = readbyte();
|
||||
ammo_hammer_state = readbyte();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_AMMO1 || fl & PLAYER_AMMO2 || fl & PLAYER_AMMO3)
|
||||
Weapons_AmmoUpdate(this);
|
||||
|
||||
setorigin(this, origin);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
player::PredictPostFrame
|
||||
|
||||
Save the last valid server values away in the _net variants of each field
|
||||
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;
|
||||
cannon_mag_net = cannon_mag;
|
||||
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;
|
||||
|
||||
ammo_m203_grenade_net = ammo_m203_grenade;
|
||||
ammo_shotgun_state_net = ammo_shotgun_state;
|
||||
ammo_gauss_state_net = ammo_gauss_state;
|
||||
ammo_gauss_volume_net = ammo_gauss_volume;
|
||||
ammo_egon_state_net = ammo_egon_state;
|
||||
ammo_rpg_state_net = ammo_rpg_state;
|
||||
ammo_handgrenade_state_net = ammo_handgrenade_state;
|
||||
ammo_chainsaw_state_net = ammo_chainsaw_state;
|
||||
ammo_hammer_state_net = ammo_hammer_state;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
player::PredictPostFrame
|
||||
|
||||
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;
|
||||
cannon_mag = cannon_mag_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;
|
||||
|
||||
ammo_m203_grenade = ammo_m203_grenade_net;
|
||||
ammo_shotgun_state = ammo_shotgun_state_net;
|
||||
ammo_gauss_state = ammo_gauss_state_net;
|
||||
ammo_gauss_volume = ammo_gauss_volume_net;
|
||||
ammo_egon_state = ammo_egon_state_net;
|
||||
ammo_rpg_state = ammo_rpg_state_net;
|
||||
ammo_handgrenade_state = ammo_handgrenade_state_net;
|
||||
ammo_chainsaw_state = ammo_chainsaw_state_net;
|
||||
ammo_hammer_state = ammo_hammer_state_net;
|
||||
}
|
||||
|
||||
#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;
|
||||
|
||||
if (old_baseframe != baseframe)
|
||||
SendFlags |= PLAYER_BASEFRAME;
|
||||
|
||||
if (old_frame != frame)
|
||||
SendFlags |= PLAYER_FRAME;
|
||||
|
||||
/* ammo 1 type updates */
|
||||
if (glock_mag != glock_mag_net) {
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (mp5_mag != mp5_mag_net) {
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (python_mag != python_mag_net) {
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (shotgun_mag != shotgun_mag_net) {
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (crossbow_mag != crossbow_mag_net) {
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (rpg_mag != rpg_mag_net) {
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (satchel_chg != satchel_chg_net) {
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (cannon_mag != cannon_mag_net) {
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
|
||||
/* ammo 2 type updates */
|
||||
if (ammo_9mm != ammo_9mm_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_357 != ammo_357_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_buckshot != ammo_buckshot_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_bolt != ammo_bolt_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_rocket != ammo_rocket_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_uranium != ammo_uranium_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_handgrenade != ammo_handgrenade_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_satchel != ammo_satchel_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_tripmine != ammo_tripmine_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_snark != ammo_snark_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_hornet != ammo_hornet_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
|
||||
if (ammo_m203_grenade != ammo_m203_grenade_net) {
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_shotgun_state != ammo_shotgun_state_net) {
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_gauss_state != ammo_gauss_state_net) {
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_gauss_volume != ammo_gauss_volume_net) {
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_egon_state != ammo_egon_state_net) {
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_rpg_state != ammo_rpg_state_net) {
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_handgrenade_state != ammo_handgrenade_state_net) {
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_chainsaw_state != ammo_chainsaw_state_net) {
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_hammer_state != ammo_hammer_state_net) {
|
||||
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;
|
||||
|
||||
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;
|
||||
cannon_mag_net = cannon_mag;
|
||||
|
||||
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_shotgun_state_net = ammo_shotgun_state;
|
||||
ammo_gauss_state_net = ammo_gauss_state;
|
||||
ammo_gauss_volume_net = ammo_gauss_volume;
|
||||
ammo_egon_state_net = ammo_egon_state;
|
||||
ammo_rpg_state_net = ammo_rpg_state;
|
||||
ammo_handgrenade_state_net = ammo_handgrenade_state;
|
||||
ammo_chainsaw_state_net = ammo_chainsaw_state;
|
||||
ammo_hammer_state_net = ammo_hammer_state;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
player::SendEntity
|
||||
=================
|
||||
*/
|
||||
float
|
||||
player::SendEntity(entity ePEnt, float fChanged)
|
||||
{
|
||||
if (health <= 0 && ePEnt != this) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (clienttype(ePEnt) != CLIENTTYPE_REAL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (ePEnt != self) {
|
||||
fChanged &= ~PLAYER_ITEMS;
|
||||
fChanged &= ~PLAYER_HEALTH;
|
||||
fChanged &= ~PLAYER_ARMOR;
|
||||
fChanged &= ~PLAYER_VIEWOFS;
|
||||
fChanged &= ~PLAYER_AMMO1;
|
||||
fChanged &= ~PLAYER_AMMO2;
|
||||
fChanged &= ~PLAYER_AMMO3;
|
||||
}
|
||||
|
||||
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]);
|
||||
if (fChanged & PLAYER_BASEFRAME)
|
||||
WriteByte(MSG_ENTITY, baseframe);
|
||||
if (fChanged & PLAYER_FRAME)
|
||||
WriteByte(MSG_ENTITY, frame);
|
||||
|
||||
if (fChanged & PLAYER_AMMO1) {
|
||||
WriteByte(MSG_ENTITY, glock_mag);
|
||||
WriteByte(MSG_ENTITY, mp5_mag);
|
||||
WriteByte(MSG_ENTITY, python_mag);
|
||||
WriteByte(MSG_ENTITY, shotgun_mag);
|
||||
WriteByte(MSG_ENTITY, crossbow_mag);
|
||||
WriteByte(MSG_ENTITY, rpg_mag);
|
||||
WriteByte(MSG_ENTITY, satchel_chg);
|
||||
WriteByte(MSG_ENTITY, cannon_mag);
|
||||
}
|
||||
|
||||
if (fChanged & PLAYER_AMMO2) {
|
||||
WriteByte(MSG_ENTITY, ammo_9mm);
|
||||
WriteByte(MSG_ENTITY, ammo_357);
|
||||
WriteByte(MSG_ENTITY, ammo_buckshot);
|
||||
WriteByte(MSG_ENTITY, ammo_bolt);
|
||||
WriteByte(MSG_ENTITY, ammo_rocket);
|
||||
WriteByte(MSG_ENTITY, ammo_uranium);
|
||||
WriteByte(MSG_ENTITY, ammo_handgrenade);
|
||||
WriteByte(MSG_ENTITY, ammo_satchel);
|
||||
WriteByte(MSG_ENTITY, ammo_tripmine);
|
||||
WriteByte(MSG_ENTITY, ammo_snark);
|
||||
WriteByte(MSG_ENTITY, ammo_hornet);
|
||||
}
|
||||
|
||||
if (fChanged & PLAYER_AMMO3) {
|
||||
WriteByte(MSG_ENTITY, ammo_m203_grenade);
|
||||
WriteByte(MSG_ENTITY, ammo_shotgun_state);
|
||||
WriteByte(MSG_ENTITY, ammo_gauss_state);
|
||||
WriteByte(MSG_ENTITY, ammo_gauss_volume);
|
||||
WriteByte(MSG_ENTITY, ammo_egon_state);
|
||||
WriteByte(MSG_ENTITY, ammo_rpg_state);
|
||||
WriteByte(MSG_ENTITY, ammo_handgrenade_state);
|
||||
WriteByte(MSG_ENTITY, ammo_chainsaw_state);
|
||||
WriteByte(MSG_ENTITY, ammo_hammer_state);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -49,9 +49,7 @@ w_cannon_precache(void)
|
|||
void
|
||||
w_cannon_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.cannon_mag, pl.ammo_buckshot, __NULL__);
|
||||
#endif
|
||||
Weapons_UpdateAmmo(pl, pl.cannon_mag, pl.ammo_buckshot, -1);
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -73,14 +71,6 @@ w_cannon_reload(void)
|
|||
if (pl.w_attack_next > 0) {
|
||||
return;
|
||||
}
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 2) {
|
||||
return;
|
||||
}
|
||||
if (!pl.a_ammo2) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.cannon_mag >= 2) {
|
||||
return;
|
||||
}
|
||||
|
@ -88,10 +78,11 @@ w_cannon_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
Weapons_ReloadWeapon(pl, player::cannon_mag, player::ammo_buckshot, 2);
|
||||
Weapons_UpdateAmmo(pl, pl.cannon_mag, pl.ammo_buckshot, __NULL__);
|
||||
#endif
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(CANNON_RELOAD);
|
||||
#else
|
||||
Weapons_ReloadWeapon(pl, player::cannon_mag, player::ammo_buckshot, 2);
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 3.0f;
|
||||
pl.w_idle_next = 3.0f;
|
||||
|
@ -121,10 +112,6 @@ w_cannon_draw(void)
|
|||
{
|
||||
Weapons_SetModel("models/v_cannon.mdl");
|
||||
Weapons_ViewAnimation(CANNON_DEPLOY);
|
||||
#ifdef SERVER
|
||||
player pl = (player)self;
|
||||
Weapons_UpdateAmmo(pl, pl.cannon_mag, pl.ammo_buckshot, __NULL__);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -142,21 +129,15 @@ w_cannon_primary(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 != 2) {
|
||||
w_cannon_reload();
|
||||
return;
|
||||
}
|
||||
|
||||
View_SetMuzzleflash(MUZZLE_SMALL);
|
||||
#else
|
||||
int dmg;
|
||||
|
||||
if (pl.cannon_mag != 2) {
|
||||
w_cannon_reload();
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_SMALL);
|
||||
#else
|
||||
int dmg;
|
||||
dmg = Skill_GetValue("plr_cannon", 5);
|
||||
TraceAttack_FireBullets(20, pl.origin + pl.view_ofs, dmg, [0.08716,0.04362], WEAPON_CANNON);
|
||||
pl.cannon_mag -= 2;
|
||||
|
@ -178,32 +159,26 @@ w_cannon_secondary(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
w_cannon_reload();
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_ViewPunchAngle([-5,0,0]);
|
||||
#else
|
||||
int dmg;
|
||||
if (!pl.cannon_mag) {
|
||||
w_cannon_reload();
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewPunchAngle([-5,0,0]);
|
||||
#else
|
||||
int dmg;
|
||||
dmg = Skill_GetValue("plr_cannon", 5);
|
||||
TraceAttack_FireBullets(10, pl.origin + pl.view_ofs, dmg, [0.08716,0.04362], WEAPON_CANNON);
|
||||
pl.cannon_mag--;
|
||||
Weapons_PlaySound(pl, CHAN_WEAPON, "cannon/fire.wav", 1, ATTN_NORM);
|
||||
Weapons_UpdateAmmo(pl, pl.cannon_mag, pl.ammo_buckshot, __NULL__);
|
||||
#endif
|
||||
|
||||
if (pl.a_ammo1 == 2) {
|
||||
Weapons_ViewAnimation(CANNON_FIRELEFT);
|
||||
} else {
|
||||
Weapons_ViewAnimation(CANNON_FIRERIGHT);
|
||||
}
|
||||
if (pl.cannon_mag == 2) {
|
||||
Weapons_ViewAnimation(CANNON_FIRELEFT);
|
||||
} else {
|
||||
Weapons_ViewAnimation(CANNON_FIRERIGHT);
|
||||
}
|
||||
|
||||
pl.w_attack_next = 1.5f;
|
||||
pl.w_idle_next = 2.5f;
|
||||
|
@ -215,7 +190,7 @@ w_cannon_release(void)
|
|||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.a_ammo1 == 0 && pl.a_ammo2 > 0) {
|
||||
if (pl.cannon_mag == 0 && pl.ammo_buckshot > 0) {
|
||||
Weapons_Reload();
|
||||
return;
|
||||
}
|
||||
|
@ -261,11 +236,27 @@ void
|
|||
w_cannon_hudpic(int s, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.cannon_mag == 0 && pl.ammo_buckshot == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
if (s) {
|
||||
drawsubpic(pos, [170,45], g_cannon_spr, [0,48/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], g_cannon_spr, [0,0], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
if (pl.ammo_buckshot <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_buckshot / MAX_A_BUCKSHOT;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -47,9 +47,7 @@ void w_chainsaw_precache(void)
|
|||
|
||||
void w_chainsaw_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, __NULL__, __NULL__, __NULL__);
|
||||
#endif
|
||||
Weapons_UpdateAmmo(pl, -1, -1, -1);
|
||||
}
|
||||
string w_chainsaw_pmodel(void)
|
||||
{
|
||||
|
@ -64,10 +62,6 @@ void w_chainsaw_draw(void)
|
|||
{
|
||||
Weapons_SetModel("models/v_chainsaw.mdl");
|
||||
Weapons_ViewAnimation(CHAINSAW_DEPLOY);
|
||||
#ifdef SERVER
|
||||
player pl = (player)self;
|
||||
Weapons_UpdateAmmo(pl, __NULL__, __NULL__, __NULL__);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_chainsaw_holster(void)
|
||||
|
@ -82,7 +76,7 @@ void w_chainsaw_primary(void)
|
|||
return;
|
||||
}
|
||||
|
||||
pl.a_ammo3 = 1;
|
||||
pl.ammo_chainsaw_state = 1;
|
||||
Weapons_ViewAnimation(CHAINSAW_CONTINUEFIRE);
|
||||
|
||||
#ifdef SERVER
|
||||
|
@ -124,8 +118,8 @@ void w_chainsaw_release(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo3 == 1) {
|
||||
pl.a_ammo3 = 0;
|
||||
if (pl.ammo_chainsaw_state == 1) {
|
||||
pl.ammo_chainsaw_state = 0;
|
||||
pl.w_idle_next = 1.0f;
|
||||
Weapons_ViewAnimation(CHAINSAW_STOPFIRE);
|
||||
return;
|
||||
|
@ -163,7 +157,7 @@ void w_chainsaw_hudpic(int s, vector pos, float a)
|
|||
weapon_t w_chainsaw =
|
||||
{
|
||||
.name = "chainsaw",
|
||||
.id = ITEM_CHAINSAW,
|
||||
.id = ITEM_CHAINSAW,
|
||||
.slot = 0,
|
||||
.slot_pos = 2,
|
||||
.draw = w_chainsaw_draw,
|
||||
|
|
|
@ -48,9 +48,7 @@ void w_hammer_precache(void)
|
|||
|
||||
void w_hammer_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, -1, -1, -1);
|
||||
#endif
|
||||
}
|
||||
string w_hammer_pmodel(void)
|
||||
{
|
||||
|
@ -65,10 +63,6 @@ void w_hammer_draw(void)
|
|||
{
|
||||
Weapons_SetModel("models/v_hammer.mdl");
|
||||
Weapons_ViewAnimation(HAMMER_DRAW);
|
||||
#ifdef SERVER
|
||||
player pl = (player)self;
|
||||
Weapons_UpdateAmmo(pl, -1, -1, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_hammer_holster(void)
|
||||
|
@ -81,9 +75,9 @@ void w_hammer_primary(void)
|
|||
|
||||
if (!pl.w_attack_next) {
|
||||
/* Hack */
|
||||
if (pl.a_ammo1 != 1) {
|
||||
if (pl.ammo_hammer_state != 1) {
|
||||
Weapons_ViewAnimation(HAMMER_HOLSTER2);
|
||||
pl.a_ammo1 = 1;
|
||||
pl.ammo_hammer_state = 1;
|
||||
pl.w_attack_next = 0.5f;
|
||||
}
|
||||
}
|
||||
|
@ -95,9 +89,9 @@ void w_hammer_secondary(void)
|
|||
|
||||
if (!pl.w_attack_next) {
|
||||
/* Hack */
|
||||
if (pl.a_ammo1 != 2) {
|
||||
if (pl.ammo_hammer_state != 2) {
|
||||
Weapons_ViewAnimation(HAMMER_HOLSTER3);
|
||||
pl.a_ammo1 = 2;
|
||||
pl.ammo_hammer_state = 2;
|
||||
pl.w_attack_next = 0.5f;
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +117,7 @@ void w_hammer_release(void)
|
|||
traceline(src, src + v_forward * 64, FALSE, self);
|
||||
#endif
|
||||
|
||||
if (pl.a_ammo1 == 1) {
|
||||
if (pl.ammo_hammer_state == 1) {
|
||||
#ifdef SERVER
|
||||
if (trace_ent.takedamage) {
|
||||
hitsound = floor(random(1, 4));
|
||||
|
@ -150,7 +144,7 @@ void w_hammer_release(void)
|
|||
#endif
|
||||
Weapons_ViewAnimation(HAMMER_ATTACK1);
|
||||
pl.w_attack_next = 1.0f;
|
||||
} else if (pl.a_ammo1 == 2) {
|
||||
} else if (pl.ammo_hammer_state == 2) {
|
||||
#ifdef SERVER
|
||||
if (trace_ent.takedamage) {
|
||||
hitsound = floor(random(1, 4));
|
||||
|
@ -167,7 +161,7 @@ void w_hammer_release(void)
|
|||
}
|
||||
|
||||
#ifdef SERVER
|
||||
if (pl.a_ammo1 > 0) {
|
||||
if (pl.ammo_hammer_state > 0) {
|
||||
string snd = "sh/ham_swing.wav";
|
||||
switch (hitsound) {
|
||||
case 1:
|
||||
|
@ -188,7 +182,7 @@ void w_hammer_release(void)
|
|||
#endif
|
||||
|
||||
/* Reset the hack */
|
||||
pl.a_ammo1 = 0;
|
||||
pl.ammo_hammer_state = 0;
|
||||
|
||||
/* Pure cosmetics start here */
|
||||
if (pl.w_idle_next) {
|
||||
|
@ -229,7 +223,7 @@ void w_hammer_hudpic(int s, vector pos, float a)
|
|||
weapon_t w_hammer =
|
||||
{
|
||||
.name = "hammer",
|
||||
.id = ITEM_HAMMER,
|
||||
.id = ITEM_HAMMER,
|
||||
.slot = 0,
|
||||
.slot_pos = 1,
|
||||
.draw = w_hammer_draw,
|
||||
|
|
|
@ -834,7 +834,16 @@ CSQC_Ent_Update(float new)
|
|||
me.ReceiveEntity(readfloat());
|
||||
break;
|
||||
case ENT_PLAYER:
|
||||
Player_ReceiveEntity(new);
|
||||
player pl = (player)self;
|
||||
if (new) {
|
||||
spawnfunc_player();
|
||||
pl.classname = "player";
|
||||
pl.solid = SOLID_SLIDEBOX;
|
||||
pl.drawmask = MASK_ENGINE;
|
||||
pl.customphysics = Empty;
|
||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
}
|
||||
pl.ReceiveEntity(new);
|
||||
break;
|
||||
case ENT_SPRITE:
|
||||
env_sprite spr = (env_sprite)self;
|
||||
|
@ -896,7 +905,7 @@ CSQC_Ent_Update(float new)
|
|||
break;
|
||||
default:
|
||||
if (ClientGame_EntityUpdate(t, new) == FALSE) {
|
||||
error("Unknown entity type update received.\n");
|
||||
//error(sprintf("Unknown entity type update received. (%d)\n", t));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,14 +37,11 @@ Predict_PreFrame(player pl)
|
|||
pl.net_punchangle = pl.punchangle;
|
||||
pl.net_w_attack_next = pl.w_attack_next;
|
||||
pl.net_w_idle_next = pl.w_idle_next;
|
||||
pl.net_ammo1 = pl.a_ammo1;
|
||||
pl.net_ammo2 = pl.a_ammo2;
|
||||
pl.net_ammo3 = pl.a_ammo3;
|
||||
pl.net_weapontime = pl.weapontime;
|
||||
|
||||
/* this is where a game/mod would decide to add more prediction rollback
|
||||
* information. */
|
||||
GamePredict_PreFrame(pl);
|
||||
pl.PredictPreFrame();
|
||||
|
||||
/* run physics code for all the input frames which we've not heard back
|
||||
* from yet. This continues on in Player_ReceiveEntity! */
|
||||
|
@ -94,13 +91,10 @@ Predict_PostFrame(player pl)
|
|||
pl.punchangle = pl.net_punchangle;
|
||||
pl.w_attack_next = pl.net_w_attack_next;
|
||||
pl.w_idle_next = pl.net_w_idle_next;
|
||||
pl.a_ammo1 = pl.net_ammo1;
|
||||
pl.a_ammo2 = pl.net_ammo2;
|
||||
pl.a_ammo3 = pl.net_ammo3;
|
||||
pl.weapontime = pl.net_weapontime;
|
||||
|
||||
/* give the game/mod a chance to roll back its values too */
|
||||
GamePredict_PostFrame(pl);
|
||||
pl.PredictPostFrame();
|
||||
|
||||
/* update bounds */
|
||||
setorigin(pl, pl.origin);
|
||||
|
|
|
@ -19,6 +19,13 @@ var int autocvar_sp_decals = 128;
|
|||
var int autocvar_mp_decals = 128;
|
||||
var int autocvar_cl_decals = 128;
|
||||
|
||||
enumflags
|
||||
{
|
||||
DECALFL_ORIGIN,
|
||||
DECALFL_ANGLE,
|
||||
DECALFL_MATERIAL
|
||||
};
|
||||
|
||||
#ifdef CLIENT
|
||||
const string g_decal_shader = \
|
||||
"{\n" \
|
||||
|
@ -42,29 +49,46 @@ decal::SendEntity(entity ePEnt, float changedflags)
|
|||
return FALSE;
|
||||
|
||||
WriteByte(MSG_ENTITY, ENT_DECAL);
|
||||
WriteCoord(MSG_ENTITY, origin[0]);
|
||||
WriteCoord(MSG_ENTITY, origin[1]);
|
||||
WriteCoord(MSG_ENTITY, origin[2]);
|
||||
WriteCoord(MSG_ENTITY, angles[0]);
|
||||
WriteCoord(MSG_ENTITY, angles[1]);
|
||||
WriteCoord(MSG_ENTITY, angles[2]);
|
||||
WriteString(MSG_ENTITY, m_strTexture);
|
||||
WriteByte(MSG_ENTITY, changedflags);
|
||||
|
||||
if (changedflags & DECALFL_ORIGIN) {
|
||||
WriteCoord(MSG_ENTITY, origin[0]);
|
||||
WriteCoord(MSG_ENTITY, origin[1]);
|
||||
WriteCoord(MSG_ENTITY, origin[2]);
|
||||
}
|
||||
|
||||
if (changedflags & DECALFL_ANGLE) {
|
||||
WriteCoord(MSG_ENTITY, angles[0]);
|
||||
WriteCoord(MSG_ENTITY, angles[1]);
|
||||
WriteCoord(MSG_ENTITY, angles[2]);
|
||||
}
|
||||
|
||||
if (changedflags & DECALFL_MATERIAL)
|
||||
WriteString(MSG_ENTITY, m_strTexture);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#else
|
||||
void
|
||||
decal::ReceiveEntity(void)
|
||||
{
|
||||
origin[0] = readcoord();
|
||||
origin[1] = readcoord();
|
||||
origin[2] = readcoord();
|
||||
float changedflags = readbyte();
|
||||
|
||||
angles[0] = readcoord();
|
||||
angles[1] = readcoord();
|
||||
angles[2] = readcoord();
|
||||
setorigin(this, origin);
|
||||
if (changedflags & DECALFL_ORIGIN) {
|
||||
origin[0] = readcoord();
|
||||
origin[1] = readcoord();
|
||||
origin[2] = readcoord();
|
||||
setorigin(this, origin);
|
||||
}
|
||||
|
||||
m_strTexture = readstring();
|
||||
if (changedflags & DECALFL_ANGLE) {
|
||||
angles[0] = readcoord();
|
||||
angles[1] = readcoord();
|
||||
angles[2] = readcoord();
|
||||
}
|
||||
|
||||
if (changedflags & DECALFL_MATERIAL)
|
||||
m_strTexture = readstring();
|
||||
|
||||
size = drawgetimagesize(m_strTexture);
|
||||
|
||||
|
|
|
@ -230,8 +230,11 @@ PlayerPostThink(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (g_ents_initialized)
|
||||
if (g_ents_initialized) {
|
||||
player pl = (player)self;
|
||||
g_grMode.PlayerPostFrame((base_player)self);
|
||||
pl.EvaluateEntity();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -76,6 +76,7 @@ Footsteps_HLBSP(base_player target)
|
|||
string mat_name = "";
|
||||
string tex_name = "";
|
||||
|
||||
//tracebox(target.origin, VEC_HULL_MIN, VEC_HULL_MAX, target.origin + [0,0,-48], MOVE_NORMAL, target);
|
||||
traceline(target.origin + target.view_ofs, target.origin + [0,0,-48], FALSE, target);
|
||||
tex_name = getsurfacetexture(trace_ent, getsurfacenearpoint(trace_ent, trace_endpos));
|
||||
|
||||
|
|
|
@ -212,33 +212,6 @@ Weapons_InitItem(int w)
|
|||
it.SetItem(w);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Weapons_UpdateAmmo
|
||||
|
||||
Sets .a_ammoX fields and clamps them so they can be networked as a single byte.
|
||||
=================
|
||||
*/
|
||||
void
|
||||
Weapons_UpdateAmmo(base_player pl, int a1, int a2, int a3)
|
||||
{
|
||||
/* no change */
|
||||
if (a1 == -1) {
|
||||
a1 = pl.a_ammo1;
|
||||
}
|
||||
if (a2 == -1) {
|
||||
a2 = pl.a_ammo2;
|
||||
}
|
||||
if (a3 == -1) {
|
||||
a3 = pl.a_ammo3;
|
||||
}
|
||||
|
||||
/* networked as bytes, since we don't need more. Clamp to avoid errors */
|
||||
pl.a_ammo1 = bound(0, a1, 255);
|
||||
pl.a_ammo2 = bound(0, a2, 255);
|
||||
pl.a_ammo3 = bound(0, a3, 255);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Weapons_ReloadWeapon
|
||||
|
|
|
@ -50,30 +50,3 @@ enumflags
|
|||
NPC_SKIN,
|
||||
NPC_BODY
|
||||
};
|
||||
|
||||
enumflags
|
||||
{
|
||||
PLAYER_KEEPALIVE,
|
||||
PLAYER_MODELINDEX,
|
||||
PLAYER_ORIGIN,
|
||||
PLAYER_ORIGIN_Z,
|
||||
PLAYER_ANGLES_X,
|
||||
PLAYER_ANGLES_Y,
|
||||
PLAYER_ANGLES_Z,
|
||||
PLAYER_VELOCITY,
|
||||
PLAYER_VELOCITY_Z,
|
||||
PLAYER_FLAGS,
|
||||
PLAYER_WEAPON,
|
||||
PLAYER_ITEMS,
|
||||
PLAYER_HEALTH,
|
||||
PLAYER_ARMOR,
|
||||
PLAYER_MOVETYPE,
|
||||
PLAYER_VIEWOFS,
|
||||
PLAYER_BASEFRAME,
|
||||
PLAYER_FRAME,
|
||||
PLAYER_AMMO1,
|
||||
PLAYER_AMMO2,
|
||||
PLAYER_AMMO3,
|
||||
PLAYER_CSSHOT,
|
||||
PLAYER_CSSHOTTIME
|
||||
};
|
||||
|
|
|
@ -42,108 +42,3 @@ Player_PreDraw(base_player pl, int thirdperson)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Player_ReceiveEntity(float new)
|
||||
{
|
||||
float fl;
|
||||
player pl = (player)self;
|
||||
|
||||
if (new == TRUE || pl.classname != "player") {
|
||||
spawnfunc_player();
|
||||
pl.classname = "player";
|
||||
pl.solid = SOLID_SLIDEBOX;
|
||||
pl.drawmask = MASK_ENGINE;
|
||||
pl.customphysics = Empty;
|
||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
} else {
|
||||
/* Go through all the physics code between the last received frame
|
||||
* and the newest frame and keep the changes this time around instead
|
||||
* of rolling back, because we'll apply the new server-verified values
|
||||
* right after anyway. */
|
||||
/* FIXME: splitscreen */
|
||||
if (pl.entnum == player_localentnum) {
|
||||
/* FIXME: splitscreen */
|
||||
pSeat = &g_seats[0];
|
||||
|
||||
for (int i = pl.sequence+1; i <= servercommandframe; i++) {
|
||||
/* ...maybe the input state is too old? */
|
||||
if (!getinputstate(i)) {
|
||||
break;
|
||||
}
|
||||
input_sequence = i;
|
||||
PMove_Run();
|
||||
}
|
||||
|
||||
/* any differences in things that are read below are now
|
||||
* officially from prediction misses. */
|
||||
}
|
||||
}
|
||||
|
||||
/* seed for our prediction table */
|
||||
pl.sequence = servercommandframe;
|
||||
|
||||
fl = readfloat();
|
||||
|
||||
/* HACK: we need to make this more reliable */
|
||||
if (fl == UPDATE_ALL) {
|
||||
/* we respawned */
|
||||
pl.gravity = __NULL__;
|
||||
}
|
||||
|
||||
if (fl & PLAYER_MODELINDEX)
|
||||
pl.modelindex = readshort();
|
||||
|
||||
if (fl & PLAYER_ORIGIN) {
|
||||
pl.origin[0] = readcoord();
|
||||
pl.origin[1] = readcoord();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_ORIGIN_Z)
|
||||
pl.origin[2] = readcoord();
|
||||
if (fl & PLAYER_ANGLES_X)
|
||||
pl.pitch = readfloat();
|
||||
if (fl & PLAYER_ANGLES_Y)
|
||||
pl.angles[1] = readfloat();
|
||||
if (fl & PLAYER_ANGLES_Z)
|
||||
pl.angles[2] = readfloat();
|
||||
|
||||
if (fl & PLAYER_VELOCITY) {
|
||||
pl.velocity[0] = readcoord();
|
||||
pl.velocity[1] = readcoord();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_VELOCITY_Z)
|
||||
pl.velocity[2] = readcoord();
|
||||
if (fl & PLAYER_FLAGS) {
|
||||
pl.flags = readfloat();
|
||||
pl.gflags = readfloat();
|
||||
}
|
||||
if (fl & PLAYER_WEAPON)
|
||||
pl.activeweapon = readbyte();
|
||||
if (fl & PLAYER_ITEMS)
|
||||
pl.g_items = (__variant)readfloat();
|
||||
if (fl & PLAYER_HEALTH)
|
||||
pl.health = readbyte();
|
||||
if (fl & PLAYER_ARMOR)
|
||||
pl.armor = readbyte();
|
||||
if (fl & PLAYER_MOVETYPE)
|
||||
pl.movetype = readbyte();
|
||||
if (fl & PLAYER_VIEWOFS)
|
||||
pl.view_ofs[2] = readfloat();
|
||||
if (fl & PLAYER_BASEFRAME)
|
||||
pl.baseframe = readbyte();
|
||||
if (fl & PLAYER_FRAME) {
|
||||
pl.frame = readbyte();
|
||||
pl.frame1time = 0.0f;
|
||||
pl.frame2time = 0.0f;
|
||||
}
|
||||
if (fl & PLAYER_AMMO1)
|
||||
pl.a_ammo1 = readbyte();
|
||||
if (fl & PLAYER_AMMO2)
|
||||
pl.a_ammo2 = readbyte();
|
||||
if (fl & PLAYER_AMMO3)
|
||||
pl.a_ammo3 = readbyte();
|
||||
|
||||
setorigin(pl, pl.origin);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ SV_SendChat(entity sender, string msg, entity eEnt, float fType)
|
|||
WriteByte(MSG_MULTICAST, num_for_edict(sender) - 1);
|
||||
WriteByte(MSG_MULTICAST, sender.team);
|
||||
WriteString(MSG_MULTICAST, msg);
|
||||
|
||||
if (eEnt) {
|
||||
msg_entity = eEnt;
|
||||
multicast([0,0,0], MULTICAST_ONE);
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
var int autocvar_sv_playerkeepalive = TRUE;
|
||||
|
||||
void
|
||||
HLGameRules::LevelDecodeParms(base_player pp)
|
||||
{
|
||||
|
@ -114,96 +112,6 @@ HLGameRules::LevelNewParms(void)
|
|||
void
|
||||
HLGameRules::PlayerPostFrame(base_player pl)
|
||||
{
|
||||
if (autocvar_sv_playerkeepalive)
|
||||
pl.SendFlags |= PLAYER_KEEPALIVE;
|
||||
|
||||
if (pl.old_modelindex != pl.modelindex)
|
||||
pl.SendFlags |= PLAYER_MODELINDEX;
|
||||
|
||||
if (pl.old_origin[0] != pl.origin[0])
|
||||
pl.SendFlags |= PLAYER_ORIGIN;
|
||||
|
||||
if (pl.old_origin[1] != pl.origin[1])
|
||||
pl.SendFlags |= PLAYER_ORIGIN;
|
||||
|
||||
if (pl.old_origin[2] != pl.origin[2])
|
||||
pl.SendFlags |= PLAYER_ORIGIN_Z;
|
||||
|
||||
if (pl.old_angles[0] != pl.v_angle[0])
|
||||
pl.SendFlags |= PLAYER_ANGLES_X;
|
||||
|
||||
if (pl.old_angles[1] != pl.angles[1])
|
||||
pl.SendFlags |= PLAYER_ANGLES_Y;
|
||||
|
||||
if (pl.old_angles[2] != pl.angles[2])
|
||||
pl.SendFlags |= PLAYER_ANGLES_Z;
|
||||
|
||||
if (pl.old_velocity[0] != pl.velocity[0])
|
||||
pl.SendFlags |= PLAYER_VELOCITY;
|
||||
|
||||
if (pl.old_velocity[1] != pl.velocity[1])
|
||||
pl.SendFlags |= PLAYER_VELOCITY;
|
||||
|
||||
if (pl.old_velocity[2] != pl.velocity[2])
|
||||
pl.SendFlags |= PLAYER_VELOCITY_Z;
|
||||
|
||||
if (pl.old_flags != pl.flags)
|
||||
pl.SendFlags |= PLAYER_FLAGS;
|
||||
|
||||
if (pl.old_gflags != pl.gflags)
|
||||
pl.SendFlags |= PLAYER_FLAGS;
|
||||
|
||||
if (pl.old_activeweapon != pl.activeweapon)
|
||||
pl.SendFlags |= PLAYER_WEAPON;
|
||||
|
||||
if (pl.old_items != pl.g_items)
|
||||
pl.SendFlags |= PLAYER_ITEMS;
|
||||
|
||||
if (pl.old_health != pl.health)
|
||||
pl.SendFlags |= PLAYER_HEALTH;
|
||||
|
||||
if (pl.old_armor != pl.armor)
|
||||
pl.SendFlags |= PLAYER_ARMOR;
|
||||
|
||||
if (pl.old_movetype != pl.movetype)
|
||||
pl.SendFlags |= PLAYER_MOVETYPE;
|
||||
|
||||
if (pl.old_viewofs != pl.view_ofs[2])
|
||||
pl.SendFlags |= PLAYER_VIEWOFS;
|
||||
|
||||
if (pl.old_baseframe != pl.baseframe)
|
||||
pl.SendFlags |= PLAYER_BASEFRAME;
|
||||
|
||||
if (pl.old_frame != pl.frame)
|
||||
pl.SendFlags |= PLAYER_FRAME;
|
||||
|
||||
if (pl.old_a_ammo1 != pl.a_ammo1)
|
||||
pl.SendFlags |= PLAYER_AMMO1;
|
||||
|
||||
if (pl.old_a_ammo2 != pl.a_ammo2)
|
||||
pl.SendFlags |= PLAYER_AMMO2;
|
||||
|
||||
if (pl.old_a_ammo3 != pl.a_ammo3)
|
||||
pl.SendFlags |= PLAYER_AMMO3;
|
||||
|
||||
pl.old_modelindex = pl.modelindex;
|
||||
pl.old_origin = pl.origin;
|
||||
pl.old_angles = pl.angles;
|
||||
pl.old_angles[0] = pl.v_angle[0];
|
||||
pl.old_velocity = pl.velocity;
|
||||
pl.old_flags = pl.flags;
|
||||
pl.old_gflags = pl.gflags;
|
||||
pl.old_activeweapon = pl.activeweapon;
|
||||
pl.old_items = pl.g_items;
|
||||
pl.old_health = pl.health;
|
||||
pl.old_armor = pl.armor;
|
||||
pl.old_movetype = pl.movetype;
|
||||
pl.old_viewofs = pl.view_ofs[2];
|
||||
pl.old_baseframe = pl.baseframe;
|
||||
pl.old_frame = pl.frame;
|
||||
pl.old_a_ammo1 = pl.a_ammo1;
|
||||
pl.old_a_ammo2 = pl.a_ammo2;
|
||||
pl.old_a_ammo3 = pl.a_ammo3;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -127,7 +127,7 @@ HLMultiplayerRules::PlayerSpawn(base_player pp)
|
|||
pl.velocity = [0,0,0];
|
||||
pl.gravity = __NULL__;
|
||||
pl.frame = 1;
|
||||
pl.SendEntity = Player_SendEntity;
|
||||
//pl.SendEntity = Player_SendEntity;
|
||||
pl.SendFlags = UPDATE_ALL;
|
||||
pl.customphysics = Empty;
|
||||
pl.iBleeds = TRUE;
|
||||
|
|
|
@ -77,7 +77,7 @@ HLSingleplayerRules::PlayerSpawn(base_player pl)
|
|||
pl.velocity = [0,0,0];
|
||||
pl.gravity = __NULL__;
|
||||
pl.frame = 1;
|
||||
pl.SendEntity = Player_SendEntity;
|
||||
//pl.SendEntity = Player_SendEntity;
|
||||
pl.SendFlags = UPDATE_ALL;
|
||||
pl.customphysics = Empty;
|
||||
pl.iBleeds = TRUE;
|
||||
|
|
|
@ -70,6 +70,18 @@ void Game_Input(void)
|
|||
Weapons_AddItem(pl, WEAPON_SATCHEL, -1);
|
||||
Weapons_AddItem(pl, WEAPON_TRIPMINE, -1);
|
||||
Weapons_AddItem(pl, WEAPON_SNARK, -1);
|
||||
#ifdef GEARBOX
|
||||
Weapons_AddItem(pl, WEAPON_PIPEWRENCH, -1);
|
||||
Weapons_AddItem(pl, WEAPON_KNIFE, -1);
|
||||
Weapons_AddItem(pl, WEAPON_GRAPPLE, -1);
|
||||
Weapons_AddItem(pl, WEAPON_EAGLE, -1);
|
||||
Weapons_AddItem(pl, WEAPON_PENGUIN, -1);
|
||||
Weapons_AddItem(pl, WEAPON_M249, -1);
|
||||
Weapons_AddItem(pl, WEAPON_DISPLACER, -1);
|
||||
Weapons_AddItem(pl, WEAPON_SNIPERRIFLE, -1);
|
||||
Weapons_AddItem(pl, WEAPON_SPORELAUNCHER, -1);
|
||||
Weapons_AddItem(pl, WEAPON_SHOCKRIFLE, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (self.impulse == 102) {
|
||||
|
|
|
@ -76,94 +76,6 @@ void Player_UseUp(void) {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Player_SendEntity
|
||||
=================
|
||||
*/
|
||||
float Player_SendEntity(entity ePEnt, float fChanged)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.health <= 0 && ePEnt != pl) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (clienttype(ePEnt) != CLIENTTYPE_REAL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
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, pl.modelindex);
|
||||
}
|
||||
if (fChanged & PLAYER_ORIGIN) {
|
||||
WriteCoord(MSG_ENTITY, pl.origin[0]);
|
||||
WriteCoord(MSG_ENTITY, pl.origin[1]);
|
||||
}
|
||||
if (fChanged & PLAYER_ORIGIN_Z) {
|
||||
WriteCoord(MSG_ENTITY, pl.origin[2]);
|
||||
}
|
||||
if (fChanged & PLAYER_ANGLES_X) {
|
||||
WriteFloat(MSG_ENTITY, pl.v_angle[0]);
|
||||
}
|
||||
if (fChanged & PLAYER_ANGLES_Y) {
|
||||
WriteFloat(MSG_ENTITY, pl.angles[1]);
|
||||
}
|
||||
if (fChanged & PLAYER_ANGLES_Z) {
|
||||
WriteFloat(MSG_ENTITY, pl.angles[2]);
|
||||
}
|
||||
if (fChanged & PLAYER_VELOCITY) {
|
||||
WriteCoord(MSG_ENTITY, pl.velocity[0]);
|
||||
WriteCoord(MSG_ENTITY, pl.velocity[1]);
|
||||
}
|
||||
if (fChanged & PLAYER_VELOCITY_Z) {
|
||||
WriteCoord(MSG_ENTITY, pl.velocity[2]);
|
||||
}
|
||||
if (fChanged & PLAYER_FLAGS) {
|
||||
WriteFloat(MSG_ENTITY, pl.flags);
|
||||
WriteFloat(MSG_ENTITY, pl.gflags);
|
||||
}
|
||||
if (fChanged & PLAYER_WEAPON) {
|
||||
WriteByte(MSG_ENTITY, pl.activeweapon);
|
||||
}
|
||||
if (fChanged & PLAYER_ITEMS) {
|
||||
WriteFloat(MSG_ENTITY, (__variant)pl.g_items);
|
||||
}
|
||||
if (fChanged & PLAYER_HEALTH) {
|
||||
WriteByte(MSG_ENTITY, bound(0, pl.health, 255));
|
||||
}
|
||||
if (fChanged & PLAYER_ARMOR) {
|
||||
WriteByte(MSG_ENTITY, pl.armor);
|
||||
}
|
||||
if (fChanged & PLAYER_MOVETYPE) {
|
||||
WriteByte(MSG_ENTITY, pl.movetype);
|
||||
}
|
||||
if (fChanged & PLAYER_VIEWOFS) {
|
||||
WriteFloat(MSG_ENTITY, pl.view_ofs[2]);
|
||||
}
|
||||
if (fChanged & PLAYER_BASEFRAME) {
|
||||
WriteByte(MSG_ENTITY, pl.baseframe);
|
||||
}
|
||||
if (fChanged & PLAYER_FRAME) {
|
||||
WriteByte(MSG_ENTITY, pl.frame);
|
||||
}
|
||||
if (fChanged & PLAYER_AMMO1) {
|
||||
WriteByte(MSG_ENTITY, pl.a_ammo1);
|
||||
}
|
||||
if (fChanged & PLAYER_AMMO2) {
|
||||
WriteByte(MSG_ENTITY, pl.a_ammo2);
|
||||
}
|
||||
if (fChanged & PLAYER_AMMO3) {
|
||||
WriteByte(MSG_ENTITY, pl.a_ammo3);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void Weapons_Draw(void);
|
||||
void CSEv_PlayerSwitchWeapon_i(int w)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -14,9 +14,130 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* all potential SendFlags bits we can possibly send */
|
||||
enumflags
|
||||
{
|
||||
PLAYER_KEEPALIVE,
|
||||
PLAYER_MODELINDEX,
|
||||
PLAYER_ORIGIN,
|
||||
PLAYER_ORIGIN_Z,
|
||||
PLAYER_ANGLES_X,
|
||||
PLAYER_ANGLES_Y,
|
||||
PLAYER_ANGLES_Z,
|
||||
PLAYER_VELOCITY,
|
||||
PLAYER_VELOCITY_Z,
|
||||
PLAYER_FLAGS,
|
||||
PLAYER_WEAPON,
|
||||
PLAYER_ITEMS,
|
||||
PLAYER_HEALTH,
|
||||
PLAYER_ARMOR,
|
||||
PLAYER_MOVETYPE,
|
||||
PLAYER_VIEWOFS,
|
||||
PLAYER_BASEFRAME,
|
||||
PLAYER_FRAME,
|
||||
PLAYER_AMMO1,
|
||||
PLAYER_AMMO2,
|
||||
PLAYER_AMMO3,
|
||||
PLAYER_UNUSED1,
|
||||
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
|
||||
{
|
||||
/* 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;
|
||||
|
||||
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;
|
||||
|
||||
int ammo_m203_grenade;
|
||||
int ammo_m203_grenade_net;
|
||||
int ammo_shotgun_state;
|
||||
int ammo_shotgun_state_net;
|
||||
int ammo_gauss_state;
|
||||
int ammo_gauss_state_net;
|
||||
int ammo_gauss_volume;
|
||||
int ammo_gauss_volume_net;
|
||||
int ammo_egon_state;
|
||||
int ammo_egon_state_net;
|
||||
int ammo_rpg_state;
|
||||
int ammo_rpg_state_net;
|
||||
int ammo_handgrenade_state;
|
||||
int ammo_handgrenade_state_net;
|
||||
|
||||
#ifdef CLIENT
|
||||
/* External model */
|
||||
entity p_model;
|
||||
|
@ -28,28 +149,524 @@ class player:base_player
|
|||
virtual void(void) draw;
|
||||
virtual float() predraw;
|
||||
virtual void(void) postdraw;
|
||||
virtual void(float) ReceiveEntity;
|
||||
virtual void(void) PredictPreFrame;
|
||||
virtual void(void) PredictPostFrame;
|
||||
#else
|
||||
/* Weapon specific */
|
||||
int glock_mag;
|
||||
int mp5_mag;
|
||||
int python_mag;
|
||||
int shotgun_mag;
|
||||
int crossbow_mag;
|
||||
int rpg_mag;
|
||||
int satchel_chg;
|
||||
|
||||
int ammo_9mm;
|
||||
int ammo_357;
|
||||
int ammo_buckshot;
|
||||
int ammo_m203_grenade;
|
||||
int ammo_bolt;
|
||||
int ammo_rocket;
|
||||
int ammo_uranium;
|
||||
int ammo_handgrenade;
|
||||
int ammo_satchel;
|
||||
int ammo_tripmine;
|
||||
int ammo_snark;
|
||||
int ammo_hornet;
|
||||
virtual void(void) EvaluateEntity;
|
||||
virtual float(entity, float) SendEntity;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef CLIENT
|
||||
void Weapons_AmmoUpdate(entity);
|
||||
/*
|
||||
=================
|
||||
player::ReceiveEntity
|
||||
=================
|
||||
*/
|
||||
void
|
||||
player::ReceiveEntity(float new)
|
||||
{
|
||||
float fl;
|
||||
if (new == FALSE) {
|
||||
/* Go through all the physics code between the last received frame
|
||||
* and the newest frame and keep the changes this time around instead
|
||||
* of rolling back, because we'll apply the new server-verified values
|
||||
* right after anyway. */
|
||||
/* FIXME: splitscreen */
|
||||
if (entnum == player_localentnum) {
|
||||
/* FIXME: splitscreen */
|
||||
pSeat = &g_seats[0];
|
||||
|
||||
for (int i = sequence+1; i <= servercommandframe; i++) {
|
||||
/* ...maybe the input state is too old? */
|
||||
if (!getinputstate(i)) {
|
||||
break;
|
||||
}
|
||||
input_sequence = i;
|
||||
PMove_Run();
|
||||
}
|
||||
|
||||
/* any differences in things that are read below are now
|
||||
* officially from prediction misses. */
|
||||
}
|
||||
}
|
||||
|
||||
/* 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();
|
||||
if (fl & PLAYER_BASEFRAME)
|
||||
baseframe = readbyte();
|
||||
if (fl & PLAYER_FRAME) {
|
||||
frame = readbyte();
|
||||
frame1time = 0.0f;
|
||||
frame2time = 0.0f;
|
||||
}
|
||||
|
||||
if (fl & PLAYER_AMMO1) {
|
||||
glock_mag = readbyte();
|
||||
mp5_mag = readbyte();
|
||||
python_mag = readbyte();
|
||||
shotgun_mag = readbyte();
|
||||
crossbow_mag = readbyte();
|
||||
rpg_mag = readbyte();
|
||||
satchel_chg = readbyte();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_AMMO2) {
|
||||
ammo_9mm = readbyte();
|
||||
ammo_357 = readbyte();
|
||||
ammo_buckshot = readbyte();
|
||||
ammo_bolt = readbyte();
|
||||
ammo_rocket = readbyte();
|
||||
ammo_uranium = readbyte();
|
||||
ammo_handgrenade = readbyte();
|
||||
ammo_satchel = readbyte();
|
||||
ammo_tripmine = readbyte();
|
||||
ammo_snark = readbyte();
|
||||
ammo_hornet = readbyte();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_AMMO3) {
|
||||
ammo_m203_grenade = readbyte();
|
||||
ammo_shotgun_state = readbyte();
|
||||
ammo_gauss_state = readbyte();
|
||||
ammo_gauss_volume = readbyte();
|
||||
ammo_egon_state = readbyte();
|
||||
ammo_rpg_state = readbyte();
|
||||
ammo_handgrenade_state = readbyte();
|
||||
}
|
||||
|
||||
if (fl & PLAYER_AMMO1 || fl & PLAYER_AMMO2 || fl & PLAYER_AMMO3)
|
||||
Weapons_AmmoUpdate(this);
|
||||
|
||||
setorigin(this, origin);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
player::PredictPostFrame
|
||||
|
||||
Save the last valid server values away in the _net variants of each field
|
||||
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;
|
||||
|
||||
ammo_m203_grenade_net = ammo_m203_grenade;
|
||||
ammo_shotgun_state_net = ammo_shotgun_state;
|
||||
ammo_gauss_state_net = ammo_gauss_state;
|
||||
ammo_gauss_volume_net = ammo_gauss_volume;
|
||||
ammo_egon_state_net = ammo_egon_state;
|
||||
ammo_rpg_state_net = ammo_rpg_state;
|
||||
ammo_handgrenade_state_net = ammo_handgrenade_state;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
player::PredictPostFrame
|
||||
|
||||
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;
|
||||
|
||||
ammo_m203_grenade = ammo_m203_grenade_net;
|
||||
ammo_shotgun_state = ammo_shotgun_state_net;
|
||||
ammo_gauss_state = ammo_gauss_state_net;
|
||||
ammo_gauss_volume = ammo_gauss_volume_net;
|
||||
ammo_egon_state = ammo_egon_state_net;
|
||||
ammo_rpg_state = ammo_rpg_state_net;
|
||||
ammo_handgrenade_state = ammo_handgrenade_state_net;
|
||||
}
|
||||
|
||||
#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;
|
||||
|
||||
if (old_baseframe != baseframe)
|
||||
SendFlags |= PLAYER_BASEFRAME;
|
||||
|
||||
if (old_frame != frame)
|
||||
SendFlags |= PLAYER_FRAME;
|
||||
|
||||
/* ammo 1 type updates */
|
||||
if (glock_mag != glock_mag_net) {
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (mp5_mag != mp5_mag_net) {
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (python_mag != python_mag_net) {
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (shotgun_mag != shotgun_mag_net) {
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (crossbow_mag != crossbow_mag_net) {
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (rpg_mag != rpg_mag_net) {
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
if (satchel_chg != satchel_chg_net) {
|
||||
SendFlags |= PLAYER_AMMO1;
|
||||
}
|
||||
|
||||
/* ammo 2 type updates */
|
||||
if (ammo_9mm != ammo_9mm_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_357 != ammo_357_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_buckshot != ammo_buckshot_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_bolt != ammo_bolt_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_rocket != ammo_rocket_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_uranium != ammo_uranium_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_handgrenade != ammo_handgrenade_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_satchel != ammo_satchel_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_tripmine != ammo_tripmine_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_snark != ammo_snark_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
if (ammo_hornet != ammo_hornet_net) {
|
||||
SendFlags |= PLAYER_AMMO2;
|
||||
}
|
||||
|
||||
if (ammo_m203_grenade != ammo_m203_grenade_net) {
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_shotgun_state != ammo_shotgun_state_net) {
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_gauss_state != ammo_gauss_state_net) {
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_gauss_volume != ammo_gauss_volume_net) {
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_egon_state != ammo_egon_state_net) {
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_rpg_state != ammo_rpg_state_net) {
|
||||
SendFlags |= PLAYER_AMMO3;
|
||||
}
|
||||
if (ammo_handgrenade_state != ammo_handgrenade_state_net) {
|
||||
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;
|
||||
|
||||
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_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_shotgun_state_net = ammo_shotgun_state;
|
||||
ammo_gauss_state_net = ammo_gauss_state;
|
||||
ammo_gauss_volume_net = ammo_gauss_volume;
|
||||
ammo_egon_state_net = ammo_egon_state;
|
||||
ammo_rpg_state_net = ammo_rpg_state;
|
||||
ammo_handgrenade_state_net = ammo_handgrenade_state;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
player::SendEntity
|
||||
=================
|
||||
*/
|
||||
float
|
||||
player::SendEntity(entity ePEnt, float fChanged)
|
||||
{
|
||||
if (health <= 0 && ePEnt != this) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (clienttype(ePEnt) != CLIENTTYPE_REAL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (ePEnt != self) {
|
||||
fChanged &= ~PLAYER_ITEMS;
|
||||
fChanged &= ~PLAYER_HEALTH;
|
||||
fChanged &= ~PLAYER_ARMOR;
|
||||
fChanged &= ~PLAYER_VIEWOFS;
|
||||
fChanged &= ~PLAYER_AMMO1;
|
||||
fChanged &= ~PLAYER_AMMO2;
|
||||
fChanged &= ~PLAYER_AMMO3;
|
||||
}
|
||||
|
||||
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]);
|
||||
if (fChanged & PLAYER_BASEFRAME)
|
||||
WriteByte(MSG_ENTITY, baseframe);
|
||||
if (fChanged & PLAYER_FRAME)
|
||||
WriteByte(MSG_ENTITY, frame);
|
||||
|
||||
if (fChanged & PLAYER_AMMO1) {
|
||||
WriteByte(MSG_ENTITY, glock_mag);
|
||||
WriteByte(MSG_ENTITY, mp5_mag);
|
||||
WriteByte(MSG_ENTITY, python_mag);
|
||||
WriteByte(MSG_ENTITY, shotgun_mag);
|
||||
WriteByte(MSG_ENTITY, crossbow_mag);
|
||||
WriteByte(MSG_ENTITY, rpg_mag);
|
||||
WriteByte(MSG_ENTITY, satchel_chg);
|
||||
}
|
||||
|
||||
if (fChanged & PLAYER_AMMO2) {
|
||||
WriteByte(MSG_ENTITY, ammo_9mm);
|
||||
WriteByte(MSG_ENTITY, ammo_357);
|
||||
WriteByte(MSG_ENTITY, ammo_buckshot);
|
||||
WriteByte(MSG_ENTITY, ammo_bolt);
|
||||
WriteByte(MSG_ENTITY, ammo_rocket);
|
||||
WriteByte(MSG_ENTITY, ammo_uranium);
|
||||
WriteByte(MSG_ENTITY, ammo_handgrenade);
|
||||
WriteByte(MSG_ENTITY, ammo_satchel);
|
||||
WriteByte(MSG_ENTITY, ammo_tripmine);
|
||||
WriteByte(MSG_ENTITY, ammo_snark);
|
||||
WriteByte(MSG_ENTITY, ammo_hornet);
|
||||
}
|
||||
|
||||
if (fChanged & PLAYER_AMMO3) {
|
||||
WriteByte(MSG_ENTITY, ammo_m203_grenade);
|
||||
WriteByte(MSG_ENTITY, ammo_shotgun_state);
|
||||
WriteByte(MSG_ENTITY, ammo_gauss_state);
|
||||
WriteByte(MSG_ENTITY, ammo_gauss_volume);
|
||||
WriteByte(MSG_ENTITY, ammo_egon_state);
|
||||
WriteByte(MSG_ENTITY, ammo_rpg_state);
|
||||
WriteByte(MSG_ENTITY, ammo_handgrenade_state);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
*/
|
||||
|
||||
#define PHY_JUMP_CHAINWINDOW 0.5
|
||||
#define PHY_JUMP_CHAIN 100
|
||||
#define PHY_JUMP_CHAINDECAY 50
|
||||
#define PHY_JUMP_CHAIN 100
|
||||
#define PHY_JUMP_CHAINDECAY 50
|
||||
|
||||
.float waterlevel;
|
||||
.float watertype;
|
||||
|
@ -58,12 +58,10 @@ void GamePMove_Jump(player target)
|
|||
}
|
||||
} else {
|
||||
/* Half-Life: Longjump module */
|
||||
#ifdef VALVE
|
||||
if (target.flags & FL_CROUCHING && target.g_items & 0x00008000i) {
|
||||
target.velocity = v_forward * 512;
|
||||
target.velocity[2] += 100;
|
||||
}
|
||||
#endif
|
||||
target.velocity[2] += 240;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,9 +58,7 @@ w_crossbow_precache(void)
|
|||
void
|
||||
w_crossbow_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.crossbow_mag, pl.ammo_bolt, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -103,8 +101,13 @@ w_crossbow_pickup(int new, int startammo)
|
|||
void
|
||||
w_crossbow_draw(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
Weapons_SetModel("models/v_crossbow.mdl");
|
||||
Weapons_ViewAnimation(CROSSBOW_DRAW1);
|
||||
|
||||
if (pl.crossbow_mag <= 0)
|
||||
Weapons_ViewAnimation(CROSSBOW_DRAW2);
|
||||
else
|
||||
Weapons_ViewAnimation(CROSSBOW_DRAW1);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -160,19 +163,13 @@ w_crossbow_primary(void)
|
|||
}
|
||||
|
||||
/* ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.crossbow_mag <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
#else
|
||||
pl.crossbow_mag--;
|
||||
|
||||
#ifndef CLIENT
|
||||
Weapons_MakeVectors();
|
||||
entity bolt = spawn();
|
||||
setmodel(bolt, "models/crossbow_bolt.mdl");
|
||||
|
@ -189,17 +186,14 @@ w_crossbow_primary(void)
|
|||
bolt.weapon = pl.viewzoom == 1.0 ? 1 : 0;
|
||||
setsize(bolt, [0,0,0], [0,0,0]);
|
||||
|
||||
pl.crossbow_mag--;
|
||||
|
||||
if (pl.crossbow_mag > 0) {
|
||||
Sound_Play(pl, 8, "weapon_crossbow.hitbody");
|
||||
}
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_crossbow.fire");
|
||||
Weapons_UpdateAmmo(pl, pl.crossbow_mag, pl.ammo_bolt, -1);
|
||||
#endif
|
||||
|
||||
if (pl.a_ammo1) {
|
||||
if (pl.crossbow_mag) {
|
||||
Weapons_ViewAnimation(CROSSBOW_FIRE1);
|
||||
} else {
|
||||
Weapons_ViewAnimation(CROSSBOW_FIRE3);
|
||||
|
@ -236,21 +230,12 @@ w_crossbow_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
if (pl.ammo_bolt <= 0) {
|
||||
return;
|
||||
}
|
||||
if (pl.crossbow_mag >= 5) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.a_ammo1 >= 5) {
|
||||
return;
|
||||
}
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SERVER
|
||||
Weapons_ReloadWeapon(pl, player::crossbow_mag, player::ammo_bolt, 5);
|
||||
|
@ -270,7 +255,7 @@ w_crossbow_release(void)
|
|||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.a_ammo1 == 0 && pl.a_ammo2 > 0) {
|
||||
if (pl.crossbow_mag == 0 && pl.ammo_bolt > 0) {
|
||||
Weapons_Reload();
|
||||
return;
|
||||
}
|
||||
|
@ -281,13 +266,13 @@ w_crossbow_release(void)
|
|||
|
||||
int r = (float)input_sequence % 2;
|
||||
if (r == 1) {
|
||||
if (pl.a_ammo1) {
|
||||
if (pl.ammo_bolt) {
|
||||
Weapons_ViewAnimation(CROSSBOW_IDLE1);
|
||||
} else {
|
||||
Weapons_ViewAnimation(CROSSBOW_IDLE2);
|
||||
}
|
||||
} else {
|
||||
if (pl.a_ammo1) {
|
||||
if (pl.ammo_bolt) {
|
||||
Weapons_ViewAnimation(CROSSBOW_FIDGET1);
|
||||
} else {
|
||||
Weapons_ViewAnimation(CROSSBOW_FIDGET2);
|
||||
|
@ -343,6 +328,14 @@ void
|
|||
w_crossbow_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.crossbow_mag == 0 && pl.ammo_bolt == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -350,7 +343,7 @@ w_crossbow_hudpic(int selected, vector pos, float a)
|
|||
g_hud5_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -361,18 +354,26 @@ w_crossbow_hudpic(int selected, vector pos, float a)
|
|||
g_hud2_spr,
|
||||
[0,0],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
|
||||
if (pl.ammo_bolt <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_bolt / MAX_A_BOLT;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_crossbow =
|
||||
{
|
||||
.name = "crossbow",
|
||||
.id = ITEM_CROSSBOW,
|
||||
.id = ITEM_CROSSBOW,
|
||||
.slot = 2,
|
||||
.slot_pos = 2,
|
||||
.draw = w_crossbow_draw,
|
||||
|
@ -399,4 +400,3 @@ weapon_crossbow(void)
|
|||
Weapons_InitItem(WEAPON_CROSSBOW);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -53,9 +53,7 @@ w_crowbar_precache(void)
|
|||
void
|
||||
w_crowbar_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, -1, -1, -1);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
string
|
||||
|
|
|
@ -70,13 +70,6 @@ FXEgon::Draw(void)
|
|||
trailparticles(TRAIL_EGONBEAM, pl, gunpos, trace_endpos);
|
||||
setorigin(this, trace_endpos + v_forward * -16);
|
||||
|
||||
/*
|
||||
R_BeginPolygon(SPRITE_EGONIMPACT, 1, 0);
|
||||
R_PolygonVertex(trace_endpos + v_right * 24 - v_up * 24 + v_forward * -16, [1,1], [1,1,1], 1.0f);
|
||||
R_PolygonVertex(trace_endpos - v_right * 24 - v_up * 24 + v_forward * -16, [0,1], [1,1,1], 1.0f);
|
||||
R_PolygonVertex(trace_endpos - v_right * 24 + v_up * 24 + v_forward * -16, [0,0], [1,1,1], 1.0f);
|
||||
R_PolygonVertex(trace_endpos + v_right * 24 + v_up * 24 + v_forward * -16, [1,0], [1,1,1], 1.0f);
|
||||
R_EndPolygon();*/
|
||||
setmodel(this, "sprites/xspark1.spr");
|
||||
effects = EF_ADDITIVE;
|
||||
}
|
||||
|
@ -121,9 +114,7 @@ void w_egon_precache(void)
|
|||
}
|
||||
void w_egon_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_uranium, -1);
|
||||
#endif
|
||||
}
|
||||
string w_egon_wmodel(void)
|
||||
{
|
||||
|
@ -182,25 +173,16 @@ void w_egon_primary(void)
|
|||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
w_egon_release();
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.ammo_uranium <= 0) {
|
||||
w_egon_release();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CLIENT
|
||||
if (Weapons_GetAnimation() == EGON_IDLE1)
|
||||
Weapons_ViewAnimation(EGON_ALTFIREON);
|
||||
else if (Weapons_GetAnimation() == EGON_ALTFIREON)
|
||||
Weapons_ViewAnimation(EGON_ALTFIRECYCLE);
|
||||
|
||||
pl.a_ammo2--;
|
||||
|
||||
FXEgon p = (FXEgon)pSeat->m_pWeaponFX;
|
||||
p.m_vecAngle = input_angles;
|
||||
|
@ -212,23 +194,24 @@ void w_egon_primary(void)
|
|||
vector endpos = src + v_forward * 1024;
|
||||
traceline(src, endpos, FALSE, pl);
|
||||
Damage_Radius(trace_endpos, pl, 14, 64, TRUE, DMG_ELECTRO);
|
||||
pl.ammo_uranium--;
|
||||
#endif
|
||||
|
||||
if (pl.a_ammo1 == 0) {
|
||||
pl.ammo_uranium--;
|
||||
|
||||
if (pl.ammo_egon_state == 0) {
|
||||
#ifdef SERVER
|
||||
sound(pl, CHAN_WEAPON, "weapons/egon_windup2.wav", 1, ATTN_NORM, 100, 0);
|
||||
#endif
|
||||
pl.a_ammo1 = 1;
|
||||
pl.ammo_egon_state = 1;
|
||||
Weapons_ViewPunchAngle([-5,0,0]);
|
||||
pl.w_idle_next = 3.0f;
|
||||
} else if not (pl.w_idle_next > 0.0f) {
|
||||
/* wait 3 seconds (idle next) */
|
||||
if (pl.a_ammo1 == 1) {
|
||||
if (pl.ammo_egon_state == 1) {
|
||||
#ifdef SERVER
|
||||
sound(pl, CHAN_WEAPON, "weapons/egon_run3.wav", 1, ATTN_NORM, 100);
|
||||
#endif
|
||||
pl.a_ammo1 = 2;
|
||||
pl.ammo_egon_state = 2;
|
||||
}
|
||||
pl.w_idle_next = 3.0f;
|
||||
}
|
||||
|
@ -240,6 +223,7 @@ void w_egon_reload(void)
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
void w_egon_release(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
@ -251,11 +235,11 @@ void w_egon_release(void)
|
|||
p.alpha = 0.0f;
|
||||
#endif
|
||||
|
||||
if (pl.a_ammo1 != 0) {
|
||||
if (pl.ammo_egon_state != 0) {
|
||||
#ifdef SERVER
|
||||
sound(pl, CHAN_WEAPON, "weapons/egon_off1.wav", 1, ATTN_NORM, 100, 0);
|
||||
#endif
|
||||
pl.a_ammo1 = 0;
|
||||
pl.ammo_egon_state = 0;
|
||||
Weapons_ViewPunchAngle([-2,0,0]);
|
||||
}
|
||||
|
||||
|
@ -298,11 +282,27 @@ float w_egon_aimanim(void)
|
|||
void w_egon_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.ammo_uranium == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(pos, [170,45], g_hud5_spr, [0,135/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
drawsubpic(pos, [170,45], g_hud5_spr, [0,135/256], [170/256,45/256], hud_col, a, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], g_hud2_spr, [0,135/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
drawsubpic(pos, [170,45], g_hud2_spr, [0,135/256], [170/256,45/256], hud_col, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
if (pl.ammo_uranium <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_uranium / MAX_A_URANIUM;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ FXGauss::Draw(void)
|
|||
}
|
||||
|
||||
src = m_vecStart;
|
||||
makevectors(m_vecAngle);
|
||||
makevectors(input_angles);
|
||||
endpos = src + v_forward * 1024;
|
||||
traceline(src, endpos, FALSE, pl);
|
||||
|
||||
|
@ -140,9 +140,7 @@ void w_gauss_precache(void)
|
|||
}
|
||||
void w_gauss_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_uranium, -1);
|
||||
#endif
|
||||
}
|
||||
string w_gauss_wmodel(void)
|
||||
{
|
||||
|
@ -289,8 +287,8 @@ void w_gauss_secondary(void)
|
|||
player pl = (player)self;
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo3)
|
||||
soundupdate(pl, CHAN_WEAPON, "", 2, ATTN_NORM, 100 + (200 * (pl.a_ammo1/255)), 0, 0);
|
||||
if (pl.ammo_gauss_state)
|
||||
soundupdate(pl, CHAN_WEAPON, "", 2, ATTN_NORM, 100 + (200 * (pl.ammo_gauss_volume/255)), 0, 0);
|
||||
#endif
|
||||
|
||||
if (pl.w_attack_next) {
|
||||
|
@ -301,14 +299,14 @@ void w_gauss_secondary(void)
|
|||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
if (pl.a_ammo3 > 0) {
|
||||
if (pl.ammo_gauss_state > 0) {
|
||||
w_gauss_release();
|
||||
}
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.ammo_uranium <= 0) {
|
||||
if (pl.a_ammo3 > 0) {
|
||||
if (pl.ammo_gauss_state > 0) {
|
||||
w_gauss_release();
|
||||
}
|
||||
return;
|
||||
|
@ -316,29 +314,29 @@ void w_gauss_secondary(void)
|
|||
#endif
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 < 255)
|
||||
if (pl.ammo_gauss_volume < 255)
|
||||
pl.a_ammo2--;
|
||||
#else
|
||||
if (pl.a_ammo1 < 255)
|
||||
if (pl.ammo_gauss_volume < 255)
|
||||
pl.ammo_uranium--;
|
||||
#endif
|
||||
|
||||
/* Set pitch sound shift */
|
||||
pl.a_ammo1 += 16;
|
||||
if (pl.a_ammo1 > 255) {
|
||||
pl.a_ammo1 = 255;
|
||||
pl.ammo_gauss_volume += 16;
|
||||
if (pl.ammo_gauss_volume > 255) {
|
||||
pl.ammo_gauss_volume = 255;
|
||||
}
|
||||
|
||||
if (pl.a_ammo3 == 1) {
|
||||
if (pl.ammo_gauss_state == 1) {
|
||||
Weapons_ViewAnimation(GAUSS_SPIN);
|
||||
pl.a_ammo3 = 2;
|
||||
pl.ammo_gauss_state = 2;
|
||||
pl.w_idle_next = 0.0f;
|
||||
} else if (!pl.a_ammo3) {
|
||||
} else if (!pl.ammo_gauss_state) {
|
||||
Weapons_ViewAnimation(GAUSS_SPINUP);
|
||||
#ifdef CLIENT
|
||||
sound(pl, CHAN_WEAPON, "ambience/pulsemachine.wav", 2, ATTN_NORM);
|
||||
#endif
|
||||
pl.a_ammo3 = 1;
|
||||
pl.ammo_gauss_state = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -350,15 +348,15 @@ void w_gauss_release(void)
|
|||
}
|
||||
|
||||
/* Reset the pitch sound shift */
|
||||
pl.a_ammo1 = 0;
|
||||
pl.ammo_gauss_volume = 0;
|
||||
|
||||
if (pl.a_ammo3 == 1) {
|
||||
if (pl.ammo_gauss_state == 1) {
|
||||
pl.w_attack_next = 0.0f;
|
||||
pl.w_idle_next = 4.0f;
|
||||
w_gauss_primary();
|
||||
pl.a_ammo3 = 0;
|
||||
pl.ammo_gauss_state = 0;
|
||||
return;
|
||||
} else if (pl.a_ammo3 == 2) {
|
||||
} else if (pl.ammo_gauss_state == 2) {
|
||||
Weapons_ViewAnimation(GAUSS_FIRE1);
|
||||
#ifdef CLIENT
|
||||
FXGauss p = (FXGauss)pSeat->m_pWeaponFX;
|
||||
|
@ -373,7 +371,7 @@ void w_gauss_release(void)
|
|||
#endif
|
||||
pl.w_attack_next = 1.5f;
|
||||
pl.w_idle_next = 4.0f;
|
||||
pl.a_ammo3 = 0;
|
||||
pl.ammo_gauss_state = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -439,6 +437,14 @@ float w_gauss_aimanim(void)
|
|||
void w_gauss_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.ammo_uranium == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -446,7 +452,7 @@ void w_gauss_hudpic(int selected, vector pos, float a)
|
|||
g_hud5_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -457,11 +463,19 @@ void w_gauss_hudpic(int selected, vector pos, float a)
|
|||
g_hud2_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
|
||||
if (pl.ammo_uranium <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_uranium / MAX_A_URANIUM;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -62,9 +62,7 @@ w_glock_precache(void)
|
|||
void
|
||||
w_glock_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.glock_mag, pl.ammo_9mm, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -131,29 +129,23 @@ w_glock_primary(void)
|
|||
}
|
||||
|
||||
/* ammo check */
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!pl.glock_mag) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* actual firing */
|
||||
pl.glock_mag--;
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
View_SetMuzzleflash(MUZZLE_SMALL);
|
||||
Weapons_ViewPunchAngle([-2,0,0]);
|
||||
|
||||
if (pl.a_ammo1) {
|
||||
if (pl.glock_mag) {
|
||||
Weapons_ViewAnimation(GLOCK_SHOOT);
|
||||
} else {
|
||||
Weapons_ViewAnimation(GLOCK_SHOOT_EMPTY);
|
||||
}
|
||||
#else
|
||||
pl.glock_mag--;
|
||||
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");
|
||||
|
||||
|
@ -177,28 +169,22 @@ w_glock_secondary(void)
|
|||
}
|
||||
|
||||
/* ammo check */
|
||||
#ifdef CLIENT
|
||||
if (!pl.a_ammo1) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!pl.glock_mag) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
pl.glock_mag--;
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
View_SetMuzzleflash(MUZZLE_SMALL);
|
||||
Weapons_ViewPunchAngle([-2,0,0]);
|
||||
|
||||
if (pl.a_ammo1) {
|
||||
if (pl.glock_mag) {
|
||||
Weapons_ViewAnimation(GLOCK_SHOOT);
|
||||
} else {
|
||||
Weapons_ViewAnimation(GLOCK_SHOOT_EMPTY);
|
||||
}
|
||||
#else
|
||||
pl.glock_mag--;
|
||||
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");
|
||||
|
||||
|
@ -221,20 +207,6 @@ w_glock_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 18) {
|
||||
return;
|
||||
}
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo1) {
|
||||
Weapons_ViewAnimation(GLOCK_RELOAD);
|
||||
} else {
|
||||
Weapons_ViewAnimation(GLOCK_RELOAD_EMPTY);
|
||||
}
|
||||
#else
|
||||
if (pl.glock_mag >= 18) {
|
||||
return;
|
||||
}
|
||||
|
@ -242,6 +214,13 @@ w_glock_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.glock_mag) {
|
||||
Weapons_ViewAnimation(GLOCK_RELOAD);
|
||||
} else {
|
||||
Weapons_ViewAnimation(GLOCK_RELOAD_EMPTY);
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
Weapons_ReloadWeapon(pl, player::glock_mag, player::ammo_9mm, 18);
|
||||
#endif
|
||||
|
||||
|
@ -257,7 +236,7 @@ w_glock_release(void)
|
|||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.a_ammo1 == 0 && pl.a_ammo2 > 0) {
|
||||
if (pl.glock_mag == 0 && pl.ammo_9mm > 0) {
|
||||
Weapons_Reload();
|
||||
return;
|
||||
}
|
||||
|
@ -330,6 +309,14 @@ void
|
|||
w_glock_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.glock_mag == 0 && pl.ammo_9mm == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -337,7 +324,7 @@ w_glock_hudpic(int selected, vector pos, float a)
|
|||
g_hud4_spr,
|
||||
[0,45/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -348,18 +335,26 @@ w_glock_hudpic(int selected, vector pos, float a)
|
|||
g_hud1_spr,
|
||||
[0,45/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
|
||||
if (pl.ammo_9mm <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_9mm / MAX_A_9MM;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_glock =
|
||||
{
|
||||
.name = "9mmhandgun",
|
||||
.id = ITEM_GLOCK,
|
||||
.id = ITEM_GLOCK,
|
||||
.slot = 1,
|
||||
.slot_pos = 0,
|
||||
.draw = w_glock_draw,
|
||||
|
|
|
@ -47,9 +47,7 @@ void w_handgrenade_precache(void)
|
|||
}
|
||||
void w_handgrenade_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_handgrenade, -1);
|
||||
#endif
|
||||
}
|
||||
string w_handgrenade_wmodel(void)
|
||||
{
|
||||
|
@ -153,26 +151,20 @@ void w_handgrenade_primary(void)
|
|||
}
|
||||
|
||||
/* We're abusing this network variable for the holding check */
|
||||
if (pl.a_ammo3 > 0) {
|
||||
if (pl.ammo_handgrenade_state > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.ammo_handgrenade <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(HANDGRENADE_PULLPIN);
|
||||
#endif
|
||||
|
||||
pl.a_ammo3 = 1;
|
||||
pl.ammo_handgrenade_state = 1;
|
||||
pl.w_attack_next = 0.5f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
}
|
||||
|
@ -194,18 +186,17 @@ void w_handgrenade_release(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo3 == 1) {
|
||||
if (pl.ammo_handgrenade_state == 1) {
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo2--;
|
||||
Weapons_ViewAnimation(HANDGRENADE_THROW1);
|
||||
#else
|
||||
pl.ammo_handgrenade--;
|
||||
w_handgrenade_throw();
|
||||
#endif
|
||||
pl.a_ammo3 = 2;
|
||||
pl.ammo_handgrenade--;
|
||||
pl.ammo_handgrenade_state = 2;
|
||||
pl.w_attack_next = 1.0f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
} else if (pl.a_ammo3 == 2) {
|
||||
} else if (pl.ammo_handgrenade_state == 2) {
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(HANDGRENADE_DRAW);
|
||||
#else
|
||||
|
@ -215,7 +206,7 @@ void w_handgrenade_release(void)
|
|||
#endif
|
||||
pl.w_attack_next = 0.5f;
|
||||
pl.w_idle_next = 0.5f;
|
||||
pl.a_ammo3 = 0;
|
||||
pl.ammo_handgrenade_state = 0;
|
||||
} else {
|
||||
int r = (float)input_sequence % 8;
|
||||
if (r == 1) {
|
||||
|
@ -238,18 +229,28 @@ void
|
|||
w_handgrenade_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(pos, [170,45], g_hud6_spr, [0,0], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], g_hud3_spr, [0,0], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
if (pl.ammo_handgrenade <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_handgrenade / MAX_A_HANDGRENADE;
|
||||
drawfill(pos + [10,0], [20,4], g_hud_color, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_handgrenade =
|
||||
{
|
||||
.name = "grenade",
|
||||
.id = ITEM_HANDGRENADE,
|
||||
.id = ITEM_HANDGRENADE,
|
||||
.slot = 4,
|
||||
.slot_pos = 0,
|
||||
.draw = w_handgrenade_draw,
|
||||
|
|
|
@ -66,9 +66,7 @@ w_hornetgun_pickup(int new, int startammo)
|
|||
void
|
||||
w_hornetgun_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_hornet, -1);
|
||||
#endif
|
||||
}
|
||||
string w_hornetgun_wmodel(void)
|
||||
{
|
||||
|
@ -88,10 +86,6 @@ w_hornetgun_draw(void)
|
|||
{
|
||||
Weapons_SetModel("models/v_hgun.mdl");
|
||||
Weapons_ViewAnimation(HORNETGUN_DRAW);
|
||||
#ifdef SERVER
|
||||
player pl = (player)self;
|
||||
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_hornet, __NULL__);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -140,19 +134,13 @@ w_hornetgun_release(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo2 < MAX_A_HORNET) {
|
||||
pl.a_ammo2 = bound(0, pl.a_ammo2 + 1, MAX_A_HORNET);
|
||||
pl.w_idle_next = 0.35f;
|
||||
}
|
||||
#else
|
||||
/* slow regeneration of ammunition */
|
||||
if (pl.ammo_hornet < MAX_A_HORNET) {
|
||||
pl.ammo_hornet = bound(0, pl.ammo_hornet + 1, MAX_A_HORNET);
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_hornet, -1);
|
||||
pl.w_idle_next = 0.35f;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pl.w_idle_next > 0.0) {
|
||||
return;
|
||||
|
@ -184,29 +172,17 @@ w_hornetgun_primary(void)
|
|||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
w_hornetgun_release();
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.ammo_hornet <= 0) {
|
||||
w_hornetgun_release();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef SERVER
|
||||
w_hornetgun_shoothornet();
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_hornetgun.fire");
|
||||
|
||||
pl.ammo_hornet--;
|
||||
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_hornet, __NULL__);
|
||||
#else
|
||||
pl.a_ammo2--;
|
||||
#endif
|
||||
|
||||
pl.ammo_hornet--;
|
||||
Weapons_ViewAnimation(HORNETGUN_SHOOT);
|
||||
|
||||
pl.w_attack_next = 0.25;
|
||||
|
@ -222,27 +198,17 @@ w_hornetgun_secondary(void)
|
|||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
w_hornetgun_release();
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.ammo_hornet <= 0) {
|
||||
w_hornetgun_release();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SERVER
|
||||
pl.ammo_hornet--;
|
||||
w_hornetgun_shoothornet();
|
||||
Weapons_PlaySound(pl, CHAN_WEAPON, sprintf("agrunt/ag_fire%d.wav", floor(random(1,4))), 1, ATTN_NORM);
|
||||
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_hornet, __NULL__);
|
||||
#else
|
||||
pl.a_ammo2--;
|
||||
#endif
|
||||
|
||||
pl.ammo_hornet--;
|
||||
Weapons_ViewAnimation(HORNETGUN_SHOOT);
|
||||
|
||||
pl.w_attack_next = 0.1;
|
||||
|
@ -295,6 +261,8 @@ void
|
|||
w_hornetgun_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -318,6 +286,14 @@ w_hornetgun_hudpic(int selected, vector pos, float a)
|
|||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
|
||||
if (pl.ammo_hornet <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_hornet / MAX_A_HORNET;
|
||||
drawfill(pos + [10,0], [20,4], g_hud_color, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -86,9 +86,7 @@ w_mp5_pickup(int new, int startammo)
|
|||
void
|
||||
w_mp5_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.mp5_mag, pl.ammo_9mm, pl.ammo_m203_grenade);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -134,19 +132,12 @@ w_mp5_primary(void)
|
|||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.mp5_mag <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CLIENT
|
||||
View_SetMuzzleflash(MUZZLE_RIFLE);
|
||||
pl.a_ammo1--;
|
||||
#else
|
||||
/* singleplayer is more accurate */
|
||||
if (cvar("sv_playerslots") == 1) {
|
||||
|
@ -156,9 +147,9 @@ w_mp5_primary(void)
|
|||
}
|
||||
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_mp5.shoot");
|
||||
#endif
|
||||
|
||||
pl.mp5_mag--;
|
||||
#endif
|
||||
|
||||
/* Actual firing */
|
||||
int r = (float)input_sequence % 2;
|
||||
|
@ -183,12 +174,14 @@ w_mp5_secondary(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo3 <= 0) {
|
||||
|
||||
if (pl.ammo_m203_grenade <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
pl.a_ammo3--;
|
||||
|
||||
pl.ammo_m203_grenade--;
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewPunchAngle([-10,0,0]);
|
||||
Weapons_ViewAnimation(MP5_GRENADE);
|
||||
#else
|
||||
|
@ -205,10 +198,6 @@ w_mp5_secondary(void)
|
|||
remove(self);
|
||||
}
|
||||
|
||||
if (pl.ammo_m203_grenade <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_MakeVectors();
|
||||
entity gren = spawn();
|
||||
setmodel(gren, "models/grenade.mdl");
|
||||
|
@ -224,7 +213,6 @@ w_mp5_secondary(void)
|
|||
setsize(gren, [0,0,0], [0,0,0]);
|
||||
gren.touch = Grenade_ExplodeTouch;
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_mp5.gl");
|
||||
pl.ammo_m203_grenade--;
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 1.0f;
|
||||
|
@ -240,21 +228,12 @@ w_mp5_reload(void)
|
|||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 50) {
|
||||
return;
|
||||
}
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.mp5_mag >= 50) {
|
||||
return;
|
||||
}
|
||||
if (pl.ammo_9mm <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CLIENT
|
||||
Weapons_ViewAnimation(MP5_RELOAD);
|
||||
|
@ -273,7 +252,7 @@ w_mp5_release(void)
|
|||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.a_ammo1 == 0 && pl.a_ammo2 > 0) {
|
||||
if (pl.mp5_mag == 0 && pl.ammo_9mm > 0) {
|
||||
Weapons_Reload();
|
||||
return;
|
||||
}
|
||||
|
@ -351,6 +330,14 @@ void
|
|||
w_mp5_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.mp5_mag == 0 && pl.ammo_9mm == 0 && pl.ammo_m203_grenade == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -358,7 +345,7 @@ w_mp5_hudpic(int selected, vector pos, float a)
|
|||
g_hud4_spr,
|
||||
[0,135/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -369,18 +356,32 @@ w_mp5_hudpic(int selected, vector pos, float a)
|
|||
g_hud1_spr,
|
||||
[0,135/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
|
||||
float perc;
|
||||
|
||||
if (pl.ammo_9mm > 0) {
|
||||
perc = pl.ammo_9mm / MAX_A_9MM;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
}
|
||||
|
||||
if (pl.ammo_m203_grenade > 0) {
|
||||
perc = pl.ammo_m203_grenade / MAX_A_M203_GRENADE;
|
||||
drawfill(pos + [35,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [35,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_mp5 =
|
||||
{
|
||||
.name = "9mmAR",
|
||||
.id = ITEM_MP5,
|
||||
.id = ITEM_MP5,
|
||||
.slot = 2,
|
||||
.slot_pos = 0,
|
||||
.draw = w_mp5_draw,
|
||||
|
|
|
@ -81,9 +81,7 @@ w_python_pickup(int new, int startammo)
|
|||
void
|
||||
w_python_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.python_mag, pl.ammo_357, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -138,24 +136,18 @@ w_python_primary(void)
|
|||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.python_mag <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
pl.python_mag--;
|
||||
|
||||
/* Actual firing */
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
View_SetMuzzleflash(MUZZLE_SMALL);
|
||||
Weapons_ViewPunchAngle([-10,0,0]);
|
||||
Weapons_ViewAnimation(PYTHON_FIRE1);
|
||||
#else
|
||||
pl.python_mag--;
|
||||
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
|
||||
|
@ -185,7 +177,7 @@ w_python_secondary(void)
|
|||
pl.viewzoom = 1.0f;
|
||||
}
|
||||
|
||||
pl.w_attack_next = 0.5f;
|
||||
pl.w_attack_next = 0.25f;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -198,21 +190,12 @@ w_python_reload(void)
|
|||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 6) {
|
||||
return;
|
||||
}
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.python_mag >= 6) {
|
||||
return;
|
||||
}
|
||||
if (pl.ammo_357 <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Audio-Visual bit */
|
||||
#ifdef CLIENT
|
||||
|
@ -233,7 +216,7 @@ w_python_release(void)
|
|||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.a_ammo1 == 0 && pl.a_ammo2 > 0) {
|
||||
if (pl.python_mag == 0 && pl.ammo_357 > 0) {
|
||||
Weapons_Reload();
|
||||
return;
|
||||
}
|
||||
|
@ -310,6 +293,14 @@ void
|
|||
w_python_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.python_mag == 0 && pl.ammo_357 == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(
|
||||
pos,
|
||||
|
@ -317,7 +308,7 @@ w_python_hudpic(int selected, vector pos, float a)
|
|||
g_hud4_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
|
@ -328,18 +319,26 @@ w_python_hudpic(int selected, vector pos, float a)
|
|||
g_hud1_spr,
|
||||
[0,90/256],
|
||||
[170/256,45/256],
|
||||
g_hud_color,
|
||||
hud_col,
|
||||
a,
|
||||
DRAWFLAG_ADDITIVE
|
||||
);
|
||||
}
|
||||
|
||||
if (pl.ammo_357 <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_357 / MAX_A_357;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_python =
|
||||
{
|
||||
.name = "357",
|
||||
.id = ITEM_PYTHON,
|
||||
.id = ITEM_PYTHON,
|
||||
.slot = 1,
|
||||
.slot_pos = 1,
|
||||
.draw = w_python_draw,
|
||||
|
|
|
@ -52,9 +52,7 @@ void w_rpg_precache(void)
|
|||
|
||||
void w_rpg_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.rpg_mag, pl.ammo_rocket, -1);
|
||||
#endif
|
||||
}
|
||||
string w_rpg_wmodel(void)
|
||||
{
|
||||
|
@ -108,20 +106,14 @@ void w_rpg_primary(void)
|
|||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.rpg_mag <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Weapons_ViewAnimation(RPG_FIRE2);
|
||||
pl.rpg_mag--;
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1--;
|
||||
Weapons_ViewAnimation(RPG_FIRE2);
|
||||
Weapons_ViewPunchAngle([-10,0,0]);
|
||||
#else
|
||||
static void Rocket_Touch(void) {
|
||||
|
@ -162,13 +154,12 @@ void w_rpg_primary(void)
|
|||
rocket.nextthink = time + 0.15f;
|
||||
rocket.traileffectnum = particleeffectnum("weapon_rpg.trail");
|
||||
|
||||
if (pl.a_ammo3 > 0) {
|
||||
if (pl.ammo_rpg_state > 0) {
|
||||
rocket.weapon = 1;
|
||||
}
|
||||
|
||||
setsize(rocket, [0,0,0], [0,0,0]);
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_rpg.shoot");
|
||||
pl.rpg_mag--;
|
||||
#endif
|
||||
|
||||
pl.w_attack_next =
|
||||
|
@ -178,28 +169,18 @@ void w_rpg_primary(void)
|
|||
void w_rpg_reload(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
||||
|
||||
if (pl.w_attack_next > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 1) {
|
||||
return;
|
||||
}
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.rpg_mag >= 1) {
|
||||
return;
|
||||
}
|
||||
if (pl.ammo_rocket <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Audio-Visual Bit */
|
||||
#ifdef CLIENT
|
||||
|
@ -218,7 +199,7 @@ void w_rpg_release(void)
|
|||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.a_ammo1 == 0 && pl.a_ammo2 > 0) {
|
||||
if (pl.rpg_mag == 0 && pl.ammo_rocket > 0) {
|
||||
Weapons_Reload();
|
||||
return;
|
||||
}
|
||||
|
@ -255,9 +236,9 @@ void w_rpg_secondary(void)
|
|||
}
|
||||
|
||||
/* toggle laser */
|
||||
pl.a_ammo3 = 1 - pl.a_ammo3;
|
||||
pl.ammo_rpg_state = 1 - pl.ammo_rpg_state;
|
||||
|
||||
pl.w_attack_next = 1.0f;
|
||||
pl.w_attack_next = 0.25f;
|
||||
w_rpg_release();
|
||||
}
|
||||
|
||||
|
@ -269,11 +250,27 @@ float w_rpg_aimanim(void)
|
|||
void w_rpg_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.rpg_mag == 0 && pl.ammo_rocket == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(pos, [170,45], g_hud5_spr, [0,45/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
drawsubpic(pos, [170,45], g_hud5_spr, [0,45/256], [170/256,45/256], hud_col, a, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], g_hud2_spr, [0,45/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
drawsubpic(pos, [170,45], g_hud2_spr, [0,45/256], [170/256,45/256], hud_col, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
if (pl.ammo_rocket <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_rocket / MAX_A_ROCKET;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -285,7 +282,7 @@ void w_rpg_hud(void)
|
|||
vector aicon_pos;
|
||||
|
||||
/* crosshair/laser */
|
||||
if (pl.a_ammo3 == 1) {
|
||||
if (pl.ammo_rpg_state == 1) {
|
||||
float lerp;
|
||||
vector jitter;
|
||||
Weapons_MakeVectors();
|
||||
|
@ -366,4 +363,3 @@ void weapon_rpg(void) {
|
|||
Weapons_InitItem(WEAPON_RPG);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -48,8 +48,10 @@ s_satchel_drop(entity master, vector src, vector vel)
|
|||
{
|
||||
static void s_satchel_touch(void)
|
||||
{
|
||||
if (other == world)
|
||||
Sound_Play(self, CHAN_BODY, "weapon_satchel.bounce");
|
||||
if (other != world)
|
||||
return;
|
||||
|
||||
Sound_Play(self, CHAN_BODY, "weapon_satchel.bounce");
|
||||
}
|
||||
entity satch;
|
||||
satch = spawn();
|
||||
|
@ -72,13 +74,14 @@ void
|
|||
s_satchel_detonate(entity master)
|
||||
{
|
||||
for (entity b = world; (b = find(b, ::classname, "satchel"));) {
|
||||
if (b.owner == master) {
|
||||
float dmg = Skill_GetValue("plr_satchel", 150);
|
||||
FX_Explosion(b.origin);
|
||||
Damage_Radius(b.origin, master, dmg, dmg * 2.5f, TRUE, WEAPON_SATCHEL);
|
||||
sound(b, CHAN_WEAPON, sprintf("weapons/explode%d.wav", floor(random() * 2) + 3), 1, ATTN_NORM);
|
||||
remove(b);
|
||||
}
|
||||
if (b.owner != master)
|
||||
continue;
|
||||
|
||||
float dmg = Skill_GetValue("plr_satchel", 150);
|
||||
FX_Explosion(b.origin);
|
||||
Damage_Radius(b.origin, master, dmg, dmg * 2.5f, TRUE, WEAPON_SATCHEL);
|
||||
sound(b, CHAN_WEAPON, sprintf("weapons/explode%d.wav", floor(random() * 2) + 3), 1, ATTN_NORM);
|
||||
remove(b);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -86,9 +89,7 @@ s_satchel_detonate(entity master)
|
|||
void
|
||||
w_satchel_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.satchel_chg, pl.ammo_satchel, __NULL__);
|
||||
#endif
|
||||
Weapons_UpdateAmmo(pl, pl.satchel_chg, pl.ammo_satchel, -1);
|
||||
}
|
||||
|
||||
string
|
||||
|
@ -141,8 +142,15 @@ void
|
|||
w_satchel_draw(void)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
Weapons_SetModel("models/v_satchel.mdl");
|
||||
Weapons_ViewAnimation(SATCHEL_DRAW);
|
||||
player pl = (player)self;
|
||||
if (pl.satchel_chg > 0) {
|
||||
Weapons_SetModel("models/v_satchel_radio.mdl");
|
||||
Weapons_ViewAnimation(RADIO_DRAW);
|
||||
|
||||
} else {
|
||||
Weapons_SetModel("models/v_satchel.mdl");
|
||||
Weapons_ViewAnimation(SATCHEL_DRAW);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -162,21 +170,15 @@ w_satchel_primary(void)
|
|||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 <= 0 && pl.a_ammo2 <= 0) {
|
||||
if (pl.satchel_chg <= 0 && pl.ammo_satchel <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.satchel_chg <= 0 && pl.ammo_satchel <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
Weapons_ViewAnimation(RADIO_DRAW);
|
||||
} else {
|
||||
Weapons_ViewAnimation(RADIO_USE);
|
||||
}
|
||||
if (pl.satchel_chg <= 0) {
|
||||
Weapons_ViewAnimation(RADIO_DRAW);
|
||||
} else {
|
||||
Weapons_ViewAnimation(RADIO_USE);
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
/* if we don't have any satchels placed yet, place one */
|
||||
|
@ -202,11 +204,11 @@ w_satchel_primary(void)
|
|||
Weapons_SetModel("models/v_satchel_radio.mdl");
|
||||
|
||||
/* same thing as the SERVER ifdef above... */
|
||||
if (!pl.a_ammo1) {
|
||||
pl.a_ammo1++;
|
||||
pl.a_ammo2--;
|
||||
if (!pl.satchel_chg) {
|
||||
pl.satchel_chg++;
|
||||
pl.ammo_satchel--;
|
||||
} else {
|
||||
pl.a_ammo1 = 0;
|
||||
pl.satchel_chg = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -223,31 +225,24 @@ w_satchel_secondary(void)
|
|||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
/* Ammo check */
|
||||
if (pl.ammo_satchel <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SERVER
|
||||
vector throw;
|
||||
Weapons_MakeVectors();
|
||||
throw = pl.velocity + (v_forward * 274);
|
||||
s_satchel_drop(self, pl.origin, throw);
|
||||
pl.satchel_chg++;
|
||||
pl.ammo_satchel--;
|
||||
#else
|
||||
pl.a_ammo1++;
|
||||
pl.a_ammo2--;
|
||||
Weapons_SetModel("models/v_satchel_radio.mdl");
|
||||
Weapons_ViewAnimation(RADIO_DRAW);
|
||||
#endif
|
||||
|
||||
pl.satchel_chg++;
|
||||
pl.ammo_satchel--;
|
||||
|
||||
pl.w_attack_next = 1.0f;
|
||||
pl.w_idle_next = 2.5f;
|
||||
}
|
||||
|
@ -267,7 +262,7 @@ w_satchel_release(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
if (pl.satchel_chg <= 0) {
|
||||
Weapons_ViewAnimation(SATCHEL_FIDGET);
|
||||
} else {
|
||||
Weapons_ViewAnimation(RADIO_FIDGET);
|
||||
|
@ -295,18 +290,28 @@ void
|
|||
w_satchel_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(pos, [170,45], g_hud6_spr, [0,45/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], g_hud3_spr, [0,45/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
if (pl.ammo_satchel <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_satchel / MAX_A_SATCHEL;
|
||||
drawfill(pos + [10,0], [20,4], g_hud_color, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_satchel =
|
||||
{
|
||||
.name = "satchel",
|
||||
.id = ITEM_SATCHEL,
|
||||
.id = ITEM_SATCHEL,
|
||||
.slot = 4,
|
||||
.slot_pos = 1,
|
||||
.draw = w_satchel_draw,
|
||||
|
|
|
@ -60,9 +60,7 @@ void w_shotgun_precache(void)
|
|||
}
|
||||
void w_shotgun_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, pl.shotgun_mag, pl.ammo_buckshot, -1);
|
||||
#endif
|
||||
}
|
||||
string w_shotgun_wmodel(void)
|
||||
{
|
||||
|
@ -112,20 +110,14 @@ void w_shotgun_primary(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo3 > SHOTTY_IDLE) {
|
||||
if (pl.ammo_shotgun_state > SHOTTY_IDLE) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef SERVER
|
||||
if (pl.shotgun_mag <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SERVER
|
||||
/* Singleplayer is more accurate */
|
||||
|
@ -135,13 +127,13 @@ void w_shotgun_primary(void)
|
|||
TraceAttack_FireBullets(4, pl.origin + pl.view_ofs, Skill_GetValue("plr_buckshot", 5), [0.08716,0.04362], WEAPON_SHOTGUN);
|
||||
}
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_shotgun.single");
|
||||
pl.shotgun_mag--;
|
||||
#else
|
||||
View_SetMuzzleflash(MUZZLE_WEIRD);
|
||||
Weapons_ViewPunchAngle([-5,0,0]);
|
||||
pl.a_ammo1--;
|
||||
#endif
|
||||
Weapons_ViewAnimation(SHOTGUN_FIRE1);
|
||||
Weapons_ViewPunchAngle([-5,0,0]);
|
||||
#endif
|
||||
|
||||
pl.shotgun_mag--;
|
||||
|
||||
pl.w_attack_next = 0.75;
|
||||
pl.w_idle_next = 2.5f;
|
||||
|
@ -153,20 +145,14 @@ void w_shotgun_secondary(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo3 > SHOTTY_IDLE) {
|
||||
if (pl.ammo_shotgun_state > SHOTTY_IDLE) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 <= 1) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.shotgun_mag <= 1) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SERVER
|
||||
/* Singleplayer is more accurate */
|
||||
|
@ -176,13 +162,13 @@ void w_shotgun_secondary(void)
|
|||
TraceAttack_FireBullets(8, pl.origin + pl.view_ofs, 5, [0.17365,0.04362], WEAPON_SHOTGUN);
|
||||
}
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_shotgun.double");
|
||||
pl.shotgun_mag -= 2;
|
||||
Weapons_UpdateAmmo(pl, pl.shotgun_mag, pl.ammo_buckshot, __NULL__);
|
||||
#else
|
||||
Weapons_ViewPunchAngle([-10,0,0]);
|
||||
pl.a_ammo1 -= 2;
|
||||
#endif
|
||||
Weapons_ViewAnimation(SHOTGUN_FIRE2);
|
||||
Weapons_ViewPunchAngle([-10,0,0]);
|
||||
#endif
|
||||
|
||||
pl.shotgun_mag -= 2;
|
||||
pl.w_attack_next = 1.5f;
|
||||
pl.w_idle_next = 2.5f;
|
||||
}
|
||||
|
@ -190,26 +176,18 @@ void w_shotgun_secondary(void)
|
|||
void w_shotgun_reload(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo1 >= 8) {
|
||||
return;
|
||||
}
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
||||
if (pl.shotgun_mag >= 8) {
|
||||
return;
|
||||
}
|
||||
if (pl.ammo_buckshot <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pl.a_ammo3 > SHOTTY_IDLE) {
|
||||
|
||||
if (pl.ammo_shotgun_state > SHOTTY_IDLE) {
|
||||
return;
|
||||
}
|
||||
pl.a_ammo3 = SHOTTY_RELOAD_START;
|
||||
pl.ammo_shotgun_state = SHOTTY_RELOAD_START;
|
||||
pl.w_idle_next = 0.0f;
|
||||
}
|
||||
|
||||
|
@ -219,7 +197,7 @@ void w_shotgun_release(void)
|
|||
|
||||
/* auto-reload if need be */
|
||||
if (pl.w_attack_next <= 0.0)
|
||||
if (pl.a_ammo3 == SHOTTY_IDLE && pl.a_ammo1 == 0 && pl.a_ammo2 > 0) {
|
||||
if (pl.ammo_shotgun_state == SHOTTY_IDLE && pl.shotgun_mag == 0 && pl.ammo_buckshot > 0) {
|
||||
Weapons_Reload();
|
||||
return;
|
||||
}
|
||||
|
@ -228,7 +206,7 @@ void w_shotgun_release(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pl.a_ammo3 == SHOTTY_IDLE) {
|
||||
if (pl.ammo_shotgun_state == SHOTTY_IDLE) {
|
||||
int r = (float)input_sequence % 3;
|
||||
switch (r) {
|
||||
case 1:
|
||||
|
@ -244,35 +222,28 @@ void w_shotgun_release(void)
|
|||
pl.w_idle_next = 2.222222f;
|
||||
break;
|
||||
}
|
||||
} else if (pl.a_ammo3 == SHOTTY_RELOAD_START) {
|
||||
} else if (pl.ammo_shotgun_state == SHOTTY_RELOAD_START) {
|
||||
Weapons_ViewAnimation(SHOTGUN_START_RELOAD);
|
||||
pl.a_ammo3 = SHOTTY_RELOAD;
|
||||
pl.ammo_shotgun_state = SHOTTY_RELOAD;
|
||||
pl.w_idle_next = 0.65f;
|
||||
} else if (pl.a_ammo3 == SHOTTY_RELOAD) {
|
||||
} else if (pl.ammo_shotgun_state == SHOTTY_RELOAD) {
|
||||
Weapons_ViewAnimation(SHOTGUN_RELOAD);
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo1++;
|
||||
pl.a_ammo2--;
|
||||
|
||||
if (pl.a_ammo2 <= 0 || pl.a_ammo1 >= 8) {
|
||||
pl.a_ammo3 = SHOTTY_RELOAD_END;
|
||||
}
|
||||
#else
|
||||
pl.shotgun_mag++;
|
||||
pl.ammo_buckshot--;
|
||||
Weapons_UpdateAmmo(pl, pl.shotgun_mag, pl.ammo_buckshot, pl.a_ammo3);
|
||||
#ifdef SERVER
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_shotgun.reload");
|
||||
if (pl.ammo_buckshot <= 0 || pl.shotgun_mag >= 8) {
|
||||
pl.a_ammo3 = SHOTTY_RELOAD_END;
|
||||
}
|
||||
#endif
|
||||
if (pl.ammo_buckshot <= 0 || pl.shotgun_mag >= 8) {
|
||||
pl.ammo_shotgun_state = SHOTTY_RELOAD_END;
|
||||
}
|
||||
Weapons_UpdateAmmo(pl, pl.shotgun_mag, pl.ammo_buckshot, pl.ammo_shotgun_state);
|
||||
pl.w_idle_next = 0.5f;
|
||||
} else if (pl.a_ammo3 == SHOTTY_RELOAD_END) {
|
||||
} else if (pl.ammo_shotgun_state == SHOTTY_RELOAD_END) {
|
||||
Weapons_ViewAnimation(SHOTGUN_PUMP);
|
||||
#ifdef SERVER
|
||||
Sound_Play(pl, CHAN_WEAPON, "weapon_shotgun.cock");
|
||||
#endif
|
||||
pl.a_ammo3 = SHOTTY_IDLE;
|
||||
pl.ammo_shotgun_state = SHOTTY_IDLE;
|
||||
pl.w_idle_next = 10.0f;
|
||||
pl.w_attack_next = 0.5f;
|
||||
}
|
||||
|
@ -298,11 +269,27 @@ float w_shotgun_aimanim(void)
|
|||
void w_shotgun_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
vector hud_col;
|
||||
|
||||
if (pl.shotgun_mag == 0 && pl.ammo_buckshot == 0)
|
||||
hud_col = [1,0,0];
|
||||
else
|
||||
hud_col = g_hud_color;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(pos, [170,45], g_hud4_spr, [0,180/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
drawsubpic(pos, [170,45], g_hud4_spr, [0,180/256], [170/256,45/256], hud_col, a, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], g_hud1_spr, [0,180/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
drawsubpic(pos, [170,45], g_hud1_spr, [0,180/256], [170/256,45/256], hud_col, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
if (pl.ammo_buckshot <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_buckshot / MAX_A_BUCKSHOT;
|
||||
drawfill(pos + [10,0], [20,4], hud_col, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -176,24 +176,17 @@ void w_snark_primary(void)
|
|||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.ammo_snark <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Weapons_ViewAnimation(SNARK_THROW);
|
||||
pl.ammo_snark--;
|
||||
|
||||
/* Audio-Visual Bit */
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo2--;
|
||||
Weapons_ViewAnimation(SNARK_THROW);
|
||||
#else
|
||||
w_snark_deploy();
|
||||
pl.ammo_snark--;
|
||||
|
||||
if (pl.ammo_snark <= 0) {
|
||||
Weapons_RemoveItem(pl, WEAPON_SNARK);
|
||||
|
@ -252,9 +245,7 @@ void w_snark_precache(void)
|
|||
}
|
||||
void w_snark_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_snark, __NULL__);
|
||||
#endif
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_snark, -1);
|
||||
}
|
||||
string w_snark_wmodel(void)
|
||||
{
|
||||
|
@ -287,6 +278,8 @@ void w_snark_hud(void)
|
|||
void w_snark_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(pos, [170,45], g_hud6_spr,
|
||||
[0,135/256], [170/256,45/256],
|
||||
|
@ -296,13 +289,21 @@ void w_snark_hudpic(int selected, vector pos, float a)
|
|||
[0,135/256], [170/256,45/256],
|
||||
g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
if (pl.ammo_snark <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_snark / MAX_A_SNARK;
|
||||
drawfill(pos + [10,0], [20,4], g_hud_color, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_snark =
|
||||
{
|
||||
.name = "snark",
|
||||
.id = ITEM_SNARK,
|
||||
.id = ITEM_SNARK,
|
||||
.slot = 4,
|
||||
.slot_pos = 3,
|
||||
.draw = w_snark_draw,
|
||||
|
|
|
@ -213,9 +213,7 @@ void w_tripmine_precache(void)
|
|||
|
||||
void w_tripmine_updateammo(player pl)
|
||||
{
|
||||
#ifdef SERVER
|
||||
Weapons_UpdateAmmo(pl, -1, pl.ammo_tripmine, -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
string w_tripmine_wmodel(void)
|
||||
|
@ -270,15 +268,9 @@ w_tripmine_primary(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CLIENT
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.ammo_tripmine <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
src = Weapons_GetCameraPos();
|
||||
Weapons_MakeVectors();
|
||||
|
@ -288,11 +280,11 @@ w_tripmine_primary(void)
|
|||
return;
|
||||
}
|
||||
|
||||
pl.ammo_tripmine--;
|
||||
|
||||
#ifdef CLIENT
|
||||
pl.a_ammo2--;
|
||||
Weapons_ViewAnimation(TRIPMINE_FIRE2);
|
||||
#else
|
||||
pl.ammo_tripmine--;
|
||||
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));
|
||||
|
@ -365,18 +357,28 @@ void
|
|||
w_tripmine_hudpic(int selected, vector pos, float a)
|
||||
{
|
||||
#ifdef CLIENT
|
||||
player pl = (player)self;
|
||||
|
||||
if (selected) {
|
||||
drawsubpic(pos, [170,45], g_hud6_spr, [0,90/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
} else {
|
||||
drawsubpic(pos, [170,45], g_hud3_spr, [0,90/256], [170/256,45/256], g_hud_color, a, DRAWFLAG_ADDITIVE);
|
||||
}
|
||||
|
||||
if (pl.ammo_tripmine <= 0)
|
||||
return;
|
||||
|
||||
float perc;
|
||||
perc = pl.ammo_tripmine / MAX_A_TRIPMINE;
|
||||
drawfill(pos + [10,0], [20,4], g_hud_color, a, DRAWFLAG_NORMAL);
|
||||
drawfill(pos + [10,0], [20 * perc,4], [0,1,0], a, DRAWFLAG_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
weapon_t w_tripmine =
|
||||
{
|
||||
.name = "tripmine",
|
||||
.id = ITEM_TRIPMINE,
|
||||
.id = ITEM_TRIPMINE,
|
||||
.slot = 4,
|
||||
.slot_pos = 2,
|
||||
.draw = w_tripmine_draw,
|
||||
|
|
|
@ -51,6 +51,7 @@ void Weapons_PlaySound(entity, float, string, float, float);
|
|||
int Weapons_IsPresent(player, int);
|
||||
void Weapons_SetModel(string);
|
||||
void Weapons_SetGeomset(string);
|
||||
void Weapons_UpdateAmmo(base_player, int, int, int);
|
||||
|
||||
#ifdef CLIENT
|
||||
string Weapons_GetPlayermodel(int);
|
||||
|
|
|
@ -89,11 +89,11 @@ void Weapons_Draw(void)
|
|||
if (g_weapons[i].draw != __NULL__) {
|
||||
g_weapons[i].draw();
|
||||
}
|
||||
#ifdef SERVER
|
||||
|
||||
if (g_weapons[i].updateammo != __NULL__) {
|
||||
g_weapons[i].updateammo(pl);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void Weapons_Holster(void)
|
||||
|
@ -117,11 +117,19 @@ void Weapons_Primary(void)
|
|||
g_weapons[i].primary();
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
if (g_weapons[i].updateammo != __NULL__) {
|
||||
g_weapons[i].updateammo(pl);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Weapons_AmmoUpdate(entity target)
|
||||
{
|
||||
player pl = (player)target;
|
||||
int i = pl.activeweapon;
|
||||
|
||||
if (g_weapons[i].updateammo != __NULL__) {
|
||||
g_weapons[i].updateammo(pl);
|
||||
}
|
||||
}
|
||||
|
||||
void Weapons_Secondary(void)
|
||||
|
@ -135,11 +143,11 @@ void Weapons_Secondary(void)
|
|||
if (g_weapons[i].secondary != __NULL__) {
|
||||
g_weapons[i].secondary();
|
||||
}
|
||||
#ifdef SERVER
|
||||
|
||||
if (g_weapons[i].updateammo != __NULL__) {
|
||||
g_weapons[i].updateammo(pl);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void Weapons_Reload(void)
|
||||
|
@ -153,11 +161,10 @@ void Weapons_Reload(void)
|
|||
if (g_weapons[i].reload != __NULL__) {
|
||||
g_weapons[i].reload();
|
||||
}
|
||||
#ifdef SERVER
|
||||
|
||||
if (g_weapons[i].updateammo != __NULL__) {
|
||||
g_weapons[i].updateammo(pl);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Weapons_Release(void)
|
||||
|
@ -286,3 +293,29 @@ int Weapons_IsPresent(player pl, int w)
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
/*
|
||||
=================
|
||||
Weapons_UpdateAmmo
|
||||
|
||||
Sets .a_ammoX fields and clamps them so they can be networked as a single byte.
|
||||
=================
|
||||
*/
|
||||
void
|
||||
Weapons_UpdateAmmo(base_player pl, int a1, int a2, int a3)
|
||||
{
|
||||
/* no change */
|
||||
if (a1 == -1) {
|
||||
a1 = pl.a_ammo1;
|
||||
}
|
||||
if (a2 == -1) {
|
||||
a2 = pl.a_ammo2;
|
||||
}
|
||||
if (a3 == -1) {
|
||||
a3 = pl.a_ammo3;
|
||||
}
|
||||
|
||||
/* networked as bytes, since we don't need more. Clamp to avoid errors */
|
||||
pl.a_ammo1 = bound(0, a1, 255);
|
||||
pl.a_ammo2 = bound(0, a2, 255);
|
||||
pl.a_ammo3 = bound(0, a3, 255);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue