Shared: Inherit weapon_common from Nuclide's base game.
This commit is contained in:
parent
73b91819ce
commit
747fdd838d
15 changed files with 110 additions and 181 deletions
|
@ -2,7 +2,7 @@
|
||||||
../../../valve/src/shared/entities.h
|
../../../valve/src/shared/entities.h
|
||||||
../../../valve/src/shared/flags.h
|
../../../valve/src/shared/flags.h
|
||||||
player.qc
|
player.qc
|
||||||
../../../valve/src/shared/weapon_common.h
|
../../../base/src/shared/weapon_common.h
|
||||||
../../../valve/src/shared/animations.h
|
../../../valve/src/shared/animations.h
|
||||||
../../../valve/src/shared/animations.qc
|
../../../valve/src/shared/animations.qc
|
||||||
../../../valve/src/shared/pmove.qc
|
../../../valve/src/shared/pmove.qc
|
||||||
|
@ -42,6 +42,6 @@ w_spanner.qc
|
||||||
w_taurus.qc
|
w_taurus.qc
|
||||||
w_tnt.qc
|
w_tnt.qc
|
||||||
weapons.qc
|
weapons.qc
|
||||||
../../../valve/src/shared/weapon_common.qc
|
../../../base/src/shared/weapon_common.qc
|
||||||
input.qc
|
input.qc
|
||||||
#endlist
|
#endlist
|
||||||
|
|
|
@ -14,26 +14,24 @@
|
||||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
=================
|
|
||||||
Input_Handle
|
|
||||||
|
|
||||||
Handles impulse and whatnot
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
void
|
void
|
||||||
Game_Input(void)
|
Game_Input(void)
|
||||||
{
|
{
|
||||||
#ifdef SERVER
|
#ifdef SERVER
|
||||||
if (input_buttons & INPUT_BUTTON5) {
|
CGameRules rules = (CGameRules)g_grMode;
|
||||||
Player_UseDown();
|
|
||||||
} else {
|
if (rules.m_iIntermission) {
|
||||||
Player_UseUp();
|
rules.IntermissionEnd();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.impulse == 100) {
|
if (input_buttons & INPUT_BUTTON5)
|
||||||
|
Player_UseDown();
|
||||||
|
else
|
||||||
|
Player_UseUp();
|
||||||
|
|
||||||
|
if (self.impulse == 100)
|
||||||
Flashlight_Toggle();
|
Flashlight_Toggle();
|
||||||
}
|
|
||||||
|
|
||||||
if (cvar("sv_cheats") == 1) {
|
if (cvar("sv_cheats") == 1) {
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
|
@ -63,27 +61,17 @@ Game_Input(void)
|
||||||
Weapons_AddItem(pl, WEAPON_SNARK, -1);
|
Weapons_AddItem(pl, WEAPON_SNARK, -1);
|
||||||
Weapons_AddItem(pl, WEAPON_MEDKIT, -1);
|
Weapons_AddItem(pl, WEAPON_MEDKIT, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.impulse == 102) {
|
|
||||||
// Respawn all the entities
|
|
||||||
for (entity a = world; (a = findfloat(a, ::identity, 1));) {
|
|
||||||
CBaseEntity caw = (CBaseEntity)a;
|
|
||||||
caw.Respawn();
|
|
||||||
}
|
|
||||||
bprint(PRINT_HIGH, "Respawning all map entities...\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self.impulse = 0;
|
self.impulse = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (input_buttons & INPUT_BUTTON0) {
|
if (input_buttons & INPUT_BUTTON0)
|
||||||
Weapons_Primary();
|
Weapons_Primary();
|
||||||
} else if (input_buttons & INPUT_BUTTON4) {
|
else if (input_buttons & INPUT_BUTTON4)
|
||||||
Weapons_Reload();
|
Weapons_Reload();
|
||||||
} else if (input_buttons & INPUT_BUTTON3) {
|
else if (input_buttons & INPUT_BUTTON3)
|
||||||
Weapons_Secondary();
|
Weapons_Secondary();
|
||||||
} else {
|
else
|
||||||
Weapons_Release();
|
Weapons_Release();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -437,11 +437,11 @@ float
|
||||||
player::SendEntity(entity ePEnt, float fChanged)
|
player::SendEntity(entity ePEnt, float fChanged)
|
||||||
{
|
{
|
||||||
if (health <= 0 && ePEnt != this) {
|
if (health <= 0 && ePEnt != this) {
|
||||||
return FALSE;
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clienttype(ePEnt) != CLIENTTYPE_REAL) {
|
if (clienttype(ePEnt) != CLIENTTYPE_REAL) {
|
||||||
return FALSE;
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ePEnt != self) {
|
if (ePEnt != self) {
|
||||||
|
@ -514,6 +514,6 @@ player::SendEntity(entity ePEnt, float fChanged)
|
||||||
WriteByte(MSG_ENTITY, mode_silencer);
|
WriteByte(MSG_ENTITY, mode_silencer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return (1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,13 +30,12 @@ w_ap9_precache(void)
|
||||||
{
|
{
|
||||||
#ifdef SERVER
|
#ifdef SERVER
|
||||||
Sound_Precache("weapon_ap9.fire");
|
Sound_Precache("weapon_ap9.fire");
|
||||||
#endif
|
|
||||||
precache_model("models/v_ap9.mdl");
|
|
||||||
precache_model("models/w_ap9.mdl");
|
precache_model("models/w_ap9.mdl");
|
||||||
|
#else
|
||||||
|
precache_model("models/v_ap9.mdl");
|
||||||
precache_model("models/p_ap9.mdl");
|
precache_model("models/p_ap9.mdl");
|
||||||
precache_sound("weapons/ap9_bolt.wav");
|
|
||||||
precache_sound("weapons/ap9_clipin.wav");
|
#endif
|
||||||
precache_sound("weapons/ap9_clipout.wav");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -75,11 +74,11 @@ w_ap9_pickup(int new, int startammo)
|
||||||
if (pl.ammo_ap9 < MAX_A_AP9) {
|
if (pl.ammo_ap9 < MAX_A_AP9) {
|
||||||
pl.ammo_ap9 = bound(0, pl.ammo_ap9 + 40, MAX_A_AP9);
|
pl.ammo_ap9 = bound(0, pl.ammo_ap9 + 40, MAX_A_AP9);
|
||||||
} else {
|
} else {
|
||||||
return FALSE;
|
return (0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return TRUE;
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -100,14 +99,10 @@ w_ap9_primary(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
|
|
||||||
if (pl.w_attack_next > 0.0) {
|
if (pl.w_attack_next > 0.0)
|
||||||
return;
|
return;
|
||||||
}
|
if (!pl.ap9_mag)
|
||||||
|
|
||||||
/* ammo check */
|
|
||||||
if (!pl.ap9_mag) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
pl.ap9_mag--;
|
pl.ap9_mag--;
|
||||||
Weapons_ViewPunchAngle([-2,0,0]);
|
Weapons_ViewPunchAngle([-2,0,0]);
|
||||||
|
@ -146,14 +141,11 @@ w_ap9_secondary(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
|
|
||||||
if (pl.w_attack_next > 0) {
|
if (pl.w_attack_next > 0)
|
||||||
|
return;
|
||||||
|
if ((pl.ap9_mag - 3) < 0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* ammo check */
|
|
||||||
if ((pl.ap9_mag - 3) < 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
pl.ap9_mag -= 3;
|
pl.ap9_mag -= 3;
|
||||||
|
|
||||||
Weapons_ViewPunchAngle([-2,0,0]);
|
Weapons_ViewPunchAngle([-2,0,0]);
|
||||||
|
@ -192,15 +184,12 @@ w_ap9_reload(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
|
|
||||||
if (pl.w_attack_next > 0.0) {
|
if (pl.w_attack_next > 0.0)
|
||||||
return;
|
return;
|
||||||
}
|
if (pl.ap9_mag >= 40)
|
||||||
if (pl.ap9_mag >= 40) {
|
|
||||||
return;
|
return;
|
||||||
}
|
if (pl.a_ammo2 <= 0)
|
||||||
if (pl.a_ammo2 <= 0) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CLIENT
|
#ifdef CLIENT
|
||||||
Weapons_ViewAnimation(AP9_RELOAD);
|
Weapons_ViewAnimation(AP9_RELOAD);
|
||||||
|
@ -224,9 +213,8 @@ w_ap9_release(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pl.w_idle_next > 0.0) {
|
if (pl.w_idle_next > 0.0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
Weapons_ViewAnimation(AP9_IDLE);
|
Weapons_ViewAnimation(AP9_IDLE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,11 +53,11 @@ w_chaingun_pickup(int new, int startammo)
|
||||||
if (pl.ammo_9mm < MAX_A_9MM) {
|
if (pl.ammo_9mm < MAX_A_9MM) {
|
||||||
pl.ammo_9mm = bound(0, pl.ammo_9mm + 100, MAX_A_9MM);
|
pl.ammo_9mm = bound(0, pl.ammo_9mm + 100, MAX_A_9MM);
|
||||||
} else {
|
} else {
|
||||||
return FALSE;
|
return (0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return TRUE;
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -111,9 +111,8 @@ w_chaingun_release(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pl.w_idle_next > 0.0) {
|
if (pl.w_idle_next > 0.0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* end firing */
|
/* end firing */
|
||||||
if (pl.mode_tempstate == 1) {
|
if (pl.mode_tempstate == 1) {
|
||||||
|
@ -157,14 +156,12 @@ w_chaingun_primary(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pl.w_attack_next > 0.0) {
|
if (pl.w_attack_next > 0.0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* ammo check */
|
/* ammo check */
|
||||||
if (pl.chaingun_mag <= 0) {
|
if (pl.chaingun_mag <= 0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* spin up first */
|
/* spin up first */
|
||||||
if (pl.mode_tempstate == 0) {
|
if (pl.mode_tempstate == 0) {
|
||||||
|
@ -203,12 +200,10 @@ w_chaingun_reload(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ammo check */
|
/* ammo check */
|
||||||
if (pl.chaingun_mag >= 100) {
|
if (pl.chaingun_mag >= 100)
|
||||||
return;
|
return;
|
||||||
}
|
if (pl.ammo_9mm <= 0)
|
||||||
if (pl.ammo_9mm <= 0) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
Weapons_ViewAnimation(CHAINGUN_HOLSTER);
|
Weapons_ViewAnimation(CHAINGUN_HOLSTER);
|
||||||
|
|
||||||
|
|
|
@ -74,10 +74,10 @@ w_flame_pickup(int new, int startammo)
|
||||||
if (pl.ammo_gas < MAX_A_GAS) {
|
if (pl.ammo_gas < MAX_A_GAS) {
|
||||||
pl.ammo_gas = bound(0, pl.ammo_gas + 20, MAX_A_GAS);
|
pl.ammo_gas = bound(0, pl.ammo_gas + 20, MAX_A_GAS);
|
||||||
} else {
|
} else {
|
||||||
return FALSE;
|
return (0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return TRUE;
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -113,14 +113,12 @@ void
|
||||||
w_flame_primary(void)
|
w_flame_primary(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
if (pl.w_attack_next > 0.0) {
|
if (pl.w_attack_next > 0.0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* Ammo check */
|
/* Ammo check */
|
||||||
if (pl.ammo_gas <= 0) {
|
if (pl.ammo_gas <= 0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
pl.ammo_gas--;
|
pl.ammo_gas--;
|
||||||
|
|
||||||
|
|
|
@ -76,11 +76,11 @@ w_medkit_pickup(int new, int startammo)
|
||||||
if (pl.ammo_medkit < MAX_A_MEDKIT) {
|
if (pl.ammo_medkit < MAX_A_MEDKIT) {
|
||||||
pl.ammo_medkit = bound(0, pl.ammo_medkit + 8, MAX_A_MEDKIT);
|
pl.ammo_medkit = bound(0, pl.ammo_medkit + 8, MAX_A_MEDKIT);
|
||||||
} else {
|
} else {
|
||||||
return FALSE;
|
return (0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return TRUE;
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,19 +96,16 @@ w_medkit_primary(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
|
|
||||||
if (pl.w_attack_next > 0.0) {
|
if (pl.w_attack_next > 0.0)
|
||||||
return;
|
return;
|
||||||
}
|
if (!pl.ammo_medkit)
|
||||||
if (!pl.ammo_medkit) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* Don't give the player more than 100 health */
|
/* Don't give the player more than 100 health */
|
||||||
if (pl.health >= 100) {
|
if (pl.health >= 100)
|
||||||
return;
|
return;
|
||||||
} else {
|
else
|
||||||
Weapons_ViewAnimation(MEDKIT_USE);
|
Weapons_ViewAnimation(MEDKIT_USE);
|
||||||
}
|
|
||||||
|
|
||||||
pl.ammo_medkit--;
|
pl.ammo_medkit--;
|
||||||
|
|
||||||
|
@ -132,9 +129,8 @@ w_medkit_release(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
|
|
||||||
if (pl.w_idle_next > 0.0) {
|
if (pl.w_idle_next > 0.0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
int r = (float)input_sequence % 2;
|
int r = (float)input_sequence % 2;
|
||||||
switch (r) {
|
switch (r) {
|
||||||
|
|
|
@ -87,11 +87,11 @@ w_rpg_pickup(int new, int startammo)
|
||||||
if (pl.ammo_rocket < MAX_A_ROCKET) {
|
if (pl.ammo_rocket < MAX_A_ROCKET) {
|
||||||
pl.ammo_rocket = bound(0, pl.ammo_rocket + 1, MAX_A_ROCKET);
|
pl.ammo_rocket = bound(0, pl.ammo_rocket + 1, MAX_A_ROCKET);
|
||||||
} else {
|
} else {
|
||||||
return FALSE;
|
return (0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return TRUE;
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -111,14 +111,12 @@ void
|
||||||
w_rpg_primary(void)
|
w_rpg_primary(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
if (pl.w_attack_next > 0.0) {
|
if (pl.w_attack_next > 0.0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* Ammo check */
|
/* Ammo check */
|
||||||
if (pl.rpg_mag <= 0) {
|
if (pl.rpg_mag <= 0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
pl.rpg_mag--;
|
pl.rpg_mag--;
|
||||||
|
|
||||||
|
@ -181,17 +179,14 @@ w_rpg_reload(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
|
|
||||||
if (pl.w_attack_next > 0) {
|
if (pl.w_attack_next > 0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* Ammo check */
|
/* Ammo check */
|
||||||
if (pl.rpg_mag >= 1) {
|
if (pl.rpg_mag >= 1)
|
||||||
return;
|
return;
|
||||||
}
|
if (pl.ammo_rocket <= 0)
|
||||||
if (pl.ammo_rocket <= 0) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
Weapons_ViewAnimation(RPG_RELOAD);
|
Weapons_ViewAnimation(RPG_RELOAD);
|
||||||
|
|
||||||
|
@ -215,9 +210,8 @@ w_rpg_release(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pl.w_idle_next > 0.0) {
|
if (pl.w_idle_next > 0.0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
int r = (float)input_sequence % 3;
|
int r = (float)input_sequence % 3;
|
||||||
|
|
||||||
|
|
|
@ -84,9 +84,8 @@ w_shovel_primary(void)
|
||||||
vector src;
|
vector src;
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
|
|
||||||
if (pl.w_attack_next) {
|
if (pl.w_attack_next)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
Weapons_MakeVectors();
|
Weapons_MakeVectors();
|
||||||
src = pl.origin + pl.view_ofs;
|
src = pl.origin + pl.view_ofs;
|
||||||
|
@ -138,9 +137,8 @@ w_shovel_primary(void)
|
||||||
#ifdef SERVER
|
#ifdef SERVER
|
||||||
Sound_Play(self, CHAN_WEAPON, "weapon_crowbar.miss");
|
Sound_Play(self, CHAN_WEAPON, "weapon_crowbar.miss");
|
||||||
|
|
||||||
if (trace_fraction >= 1.0) {
|
if (trace_fraction >= 1.0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* don't bother with decals, we got squibs */
|
/* don't bother with decals, we got squibs */
|
||||||
if (trace_ent.iBleeds) {
|
if (trace_ent.iBleeds) {
|
||||||
|
@ -209,7 +207,7 @@ w_shovel_hudpic(int selected, vector pos, float a)
|
||||||
weapon_t w_shovel =
|
weapon_t w_shovel =
|
||||||
{
|
{
|
||||||
.name = "shovel",
|
.name = "shovel",
|
||||||
.id = ITEM_SHOVEL,
|
.id = ITEM_SHOVEL,
|
||||||
.slot = 0,
|
.slot = 0,
|
||||||
.slot_pos = 1,
|
.slot_pos = 1,
|
||||||
.draw = w_shovel_draw,
|
.draw = w_shovel_draw,
|
||||||
|
|
|
@ -97,14 +97,12 @@ w_silencer_primary(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
|
|
||||||
if (pl.w_attack_next > 0.0) {
|
if (pl.w_attack_next > 0.0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* ammo check */
|
/* ammo check */
|
||||||
if (!pl.glock_mag) {
|
if (!pl.glock_mag)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
pl.glock_mag--;
|
pl.glock_mag--;
|
||||||
|
|
||||||
|
@ -155,9 +153,8 @@ w_silencer_secondary(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
|
|
||||||
if (pl.w_attack_next > 0) {
|
if (pl.w_attack_next > 0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* toggle silencer */
|
/* toggle silencer */
|
||||||
pl.mode_silencer = 1 - pl.mode_silencer;
|
pl.mode_silencer = 1 - pl.mode_silencer;
|
||||||
|
|
|
@ -49,11 +49,11 @@ w_sniper_pickup(int new, int startammo)
|
||||||
if (pl.ammo_sniper < MAX_A_SNIPER) {
|
if (pl.ammo_sniper < MAX_A_SNIPER) {
|
||||||
pl.ammo_sniper = bound(0, pl.ammo_sniper + 5, MAX_A_SNIPER);
|
pl.ammo_sniper = bound(0, pl.ammo_sniper + 5, MAX_A_SNIPER);
|
||||||
} else {
|
} else {
|
||||||
return FALSE;
|
return (0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return TRUE;
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -108,9 +108,8 @@ w_sniper_release(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pl.w_idle_next > 0.0) {
|
if (pl.w_idle_next > 0.0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (pl.mode_tempstate == 1) {
|
if (pl.mode_tempstate == 1) {
|
||||||
Weapons_ViewAnimation(SNIPER_DRAW);
|
Weapons_ViewAnimation(SNIPER_DRAW);
|
||||||
|
@ -140,14 +139,12 @@ w_sniper_primary(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
|
|
||||||
if (pl.w_attack_next > 0.0) {
|
if (pl.w_attack_next > 0.0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* Ammo check */
|
/* Ammo check */
|
||||||
if (pl.sniper_mag <= 0) {
|
if (pl.sniper_mag <= 0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
pl.sniper_mag--;
|
pl.sniper_mag--;
|
||||||
|
|
||||||
|
@ -176,9 +173,8 @@ w_sniper_secondary(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
|
|
||||||
if (pl.w_attack_next > 0.0) {
|
if (pl.w_attack_next > 0.0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* Simple toggle of fovs */
|
/* Simple toggle of fovs */
|
||||||
if (pl.viewzoom == 1.0f) {
|
if (pl.viewzoom == 1.0f) {
|
||||||
|
@ -198,12 +194,10 @@ w_sniper_reload(void)
|
||||||
w_sniper_release();
|
w_sniper_release();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (pl.sniper_mag >= 5) {
|
if (pl.sniper_mag >= 5)
|
||||||
return;
|
return;
|
||||||
}
|
if (pl.ammo_sniper <= 0)
|
||||||
if (pl.ammo_sniper <= 0) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
Weapons_ViewAnimation(SNIPER_HOLSTER);
|
Weapons_ViewAnimation(SNIPER_HOLSTER);
|
||||||
|
|
||||||
|
|
|
@ -46,11 +46,11 @@ w_sniper2_pickup(int new, int startammo)
|
||||||
if (pl.ammo_sniper < MAX_A_SNIPER) {
|
if (pl.ammo_sniper < MAX_A_SNIPER) {
|
||||||
pl.ammo_sniper = bound(0, pl.ammo_sniper + 5, MAX_A_SNIPER);
|
pl.ammo_sniper = bound(0, pl.ammo_sniper + 5, MAX_A_SNIPER);
|
||||||
} else {
|
} else {
|
||||||
return FALSE;
|
return (0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return TRUE;
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -101,9 +101,8 @@ w_sniper2_release(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pl.w_idle_next > 0.0) {
|
if (pl.w_idle_next > 0.0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
int r = floor(random(0,2));
|
int r = floor(random(0,2));
|
||||||
switch (r) {
|
switch (r) {
|
||||||
|
@ -125,14 +124,12 @@ w_sniper2_primary(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
|
|
||||||
if (pl.w_attack_next > 0.0) {
|
if (pl.w_attack_next > 0.0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* Ammo check */
|
/* Ammo check */
|
||||||
if (pl.sniper_mag <= 0) {
|
if (pl.sniper_mag <= 0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
pl.sniper_mag--;
|
pl.sniper_mag--;
|
||||||
|
|
||||||
|
@ -167,15 +164,12 @@ w_sniper2_reload(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
|
|
||||||
if (pl.w_attack_next > 0.0) {
|
if (pl.w_attack_next > 0.0)
|
||||||
return;
|
return;
|
||||||
}
|
if (pl.sniper_mag >= 5)
|
||||||
if (pl.sniper_mag >= 5) {
|
|
||||||
return;
|
return;
|
||||||
}
|
if (pl.ammo_sniper <= 0)
|
||||||
if (pl.ammo_sniper <= 0) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
Weapons_ViewAnimation(SNIPER_RELOAD);
|
Weapons_ViewAnimation(SNIPER_RELOAD);
|
||||||
|
|
||||||
|
|
|
@ -81,9 +81,8 @@ w_spanner_primary(void)
|
||||||
vector src;
|
vector src;
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
|
|
||||||
if (pl.w_attack_next) {
|
if (pl.w_attack_next)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
Weapons_MakeVectors();
|
Weapons_MakeVectors();
|
||||||
src = pl.origin + pl.view_ofs;
|
src = pl.origin + pl.view_ofs;
|
||||||
|
@ -111,9 +110,8 @@ w_spanner_primary(void)
|
||||||
#ifdef SERVER
|
#ifdef SERVER
|
||||||
Sound_Play(self, CHAN_WEAPON, "weapon_crowbar.miss");
|
Sound_Play(self, CHAN_WEAPON, "weapon_crowbar.miss");
|
||||||
|
|
||||||
if (trace_fraction >= 1.0) {
|
if (trace_fraction >= 1.0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* don't bother with decals, we got squibs */
|
/* don't bother with decals, we got squibs */
|
||||||
if (trace_ent.iBleeds) {
|
if (trace_ent.iBleeds) {
|
||||||
|
@ -181,7 +179,7 @@ w_spanner_hudpic(int selected, vector pos, float a)
|
||||||
weapon_t w_spanner =
|
weapon_t w_spanner =
|
||||||
{
|
{
|
||||||
.name = "spanner",
|
.name = "spanner",
|
||||||
.id = ITEM_SPANNER,
|
.id = ITEM_SPANNER,
|
||||||
.slot = 0,
|
.slot = 0,
|
||||||
.slot_pos = 2,
|
.slot_pos = 2,
|
||||||
.draw = w_spanner_draw,
|
.draw = w_spanner_draw,
|
||||||
|
|
|
@ -77,11 +77,11 @@ w_taurus_pickup(int new, int startammo)
|
||||||
if (pl.ammo_taurus < MAX_A_TAURUS) {
|
if (pl.ammo_taurus < MAX_A_TAURUS) {
|
||||||
pl.ammo_taurus = bound(0, pl.ammo_taurus + 10, MAX_A_TAURUS);
|
pl.ammo_taurus = bound(0, pl.ammo_taurus + 10, MAX_A_TAURUS);
|
||||||
} else {
|
} else {
|
||||||
return FALSE;
|
return (0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return TRUE;
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -102,14 +102,12 @@ w_taurus_primary(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
|
|
||||||
if (pl.w_attack_next > 0.0) {
|
if (pl.w_attack_next > 0.0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* ammo check */
|
/* ammo check */
|
||||||
if (!pl.taurus_mag) {
|
if (!pl.taurus_mag)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
pl.taurus_mag--;
|
pl.taurus_mag--;
|
||||||
|
|
||||||
|
@ -149,15 +147,12 @@ w_taurus_reload(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
|
|
||||||
if (pl.w_attack_next > 0.0) {
|
if (pl.w_attack_next > 0.0)
|
||||||
return;
|
return;
|
||||||
}
|
if (pl.taurus_mag >= 10)
|
||||||
if (pl.taurus_mag >= 10) {
|
|
||||||
return;
|
return;
|
||||||
}
|
if (pl.ammo_taurus <= 0)
|
||||||
if (pl.ammo_taurus <= 0) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (pl.taurus_mag) {
|
if (pl.taurus_mag) {
|
||||||
Weapons_ViewAnimation(TAURUS_RELOAD);
|
Weapons_ViewAnimation(TAURUS_RELOAD);
|
||||||
|
@ -186,9 +181,8 @@ w_taurus_release(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pl.w_idle_next > 0.0) {
|
if (pl.w_idle_next > 0.0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
r = floor(random(0,3));
|
r = floor(random(0,3));
|
||||||
switch (r) {
|
switch (r) {
|
||||||
|
@ -228,7 +222,7 @@ w_taurus_hudpic(int selected, vector pos, float a)
|
||||||
weapon_t w_taurus =
|
weapon_t w_taurus =
|
||||||
{
|
{
|
||||||
.name = "taurus",
|
.name = "taurus",
|
||||||
.id = ITEM_TAURUS,
|
.id = ITEM_TAURUS,
|
||||||
.slot = 1,
|
.slot = 1,
|
||||||
.slot_pos = 3,
|
.slot_pos = 3,
|
||||||
.draw = w_taurus_draw,
|
.draw = w_taurus_draw,
|
||||||
|
|
|
@ -72,8 +72,7 @@ w_tnt_pickup(int new, int startammo)
|
||||||
void
|
void
|
||||||
w_tnt_throw(void)
|
w_tnt_throw(void)
|
||||||
{
|
{
|
||||||
static void WeaponFrag_Throw_Explode(void)
|
static void WeaponFrag_Throw_Explode(void) {
|
||||||
{
|
|
||||||
float dmg = Skill_GetValue("plr_hand_grenade", 100);
|
float dmg = Skill_GetValue("plr_hand_grenade", 100);
|
||||||
FX_Explosion(self.origin);
|
FX_Explosion(self.origin);
|
||||||
Damage_Radius(self.origin, self.owner, dmg, dmg * 2.5f, TRUE, WEAPON_HANDGRENADE);
|
Damage_Radius(self.origin, self.owner, dmg, dmg * 2.5f, TRUE, WEAPON_HANDGRENADE);
|
||||||
|
@ -81,28 +80,26 @@ w_tnt_throw(void)
|
||||||
remove(self);
|
remove(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WeaponFrag_Throw_Touch(void)
|
static void WeaponFrag_Throw_Touch(void) {
|
||||||
{
|
if (other.takedamage == DAMAGE_YES)
|
||||||
if (other.takedamage == DAMAGE_YES) {
|
|
||||||
Damage_Apply(other, self.owner, 15, WEAPON_HANDGRENADE, DMG_BLUNT);
|
Damage_Apply(other, self.owner, 15, WEAPON_HANDGRENADE, DMG_BLUNT);
|
||||||
} else {
|
else
|
||||||
Sound_Play(self, CHAN_BODY, "weapon_handgrenade.bounce");
|
Sound_Play(self, CHAN_BODY, "weapon_handgrenade.bounce");
|
||||||
}
|
|
||||||
self.frame = 0;
|
self.frame = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
vector vPLAngle = pl.v_angle;
|
vector vPLAngle = pl.v_angle;
|
||||||
if (vPLAngle[0] < 0) {
|
|
||||||
|
if (vPLAngle[0] < 0)
|
||||||
vPLAngle[0] = -10 + vPLAngle[0] * ((90 - 10) / 90.0);
|
vPLAngle[0] = -10 + vPLAngle[0] * ((90 - 10) / 90.0);
|
||||||
} else {
|
else
|
||||||
vPLAngle[0] = -10 + vPLAngle[0] * ((90 + 10) / 90.0);
|
vPLAngle[0] = -10 + vPLAngle[0] * ((90 + 10) / 90.0);
|
||||||
}
|
|
||||||
|
|
||||||
float flVel = (90 - vPLAngle[0]) * 5;
|
float flVel = (90 - vPLAngle[0]) * 5;
|
||||||
if (flVel > 1000) {
|
if (flVel > 1000)
|
||||||
flVel = 1000;
|
flVel = 1000;
|
||||||
}
|
|
||||||
|
|
||||||
makevectors(vPLAngle);
|
makevectors(vPLAngle);
|
||||||
vector vecSrc = pl.origin + pl.view_ofs + v_forward * 16;
|
vector vecSrc = pl.origin + pl.view_ofs + v_forward * 16;
|
||||||
|
@ -161,26 +158,24 @@ w_tnt_release(void)
|
||||||
{
|
{
|
||||||
player pl = (player)self;
|
player pl = (player)self;
|
||||||
|
|
||||||
if (pl.w_idle_next > 0.0) {
|
if (pl.w_idle_next > 0.0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (pl.mode_tempstate == 1) {
|
if (pl.mode_tempstate == 1) {
|
||||||
pl.ammo_handgrenade--;
|
|
||||||
Weapons_ViewAnimation(HANDGRENADE_THROW1);
|
|
||||||
#ifdef SERVER
|
#ifdef SERVER
|
||||||
w_tnt_throw();
|
w_tnt_throw();
|
||||||
#endif
|
#endif
|
||||||
|
Weapons_ViewAnimation(HANDGRENADE_THROW1);
|
||||||
|
pl.ammo_handgrenade--;
|
||||||
pl.mode_tempstate = 2;
|
pl.mode_tempstate = 2;
|
||||||
pl.w_attack_next = 1.0f;
|
pl.w_attack_next = 1.0f;
|
||||||
pl.w_idle_next = 0.5f;
|
pl.w_idle_next = 0.5f;
|
||||||
} else if (pl.mode_tempstate == 2) {
|
} else if (pl.mode_tempstate == 2) {
|
||||||
Weapons_ViewAnimation(HANDGRENADE_DRAW);
|
|
||||||
#ifdef SERVER
|
#ifdef SERVER
|
||||||
if (!pl.ammo_handgrenade) {
|
if (!pl.ammo_handgrenade)
|
||||||
Weapons_RemoveItem(pl, WEAPON_HANDGRENADE);
|
Weapons_RemoveItem(pl, WEAPON_HANDGRENADE);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
Weapons_ViewAnimation(HANDGRENADE_DRAW);
|
||||||
pl.w_attack_next = 0.5f;
|
pl.w_attack_next = 0.5f;
|
||||||
pl.w_idle_next = 0.5f;
|
pl.w_idle_next = 0.5f;
|
||||||
pl.mode_tempstate = 0;
|
pl.mode_tempstate = 0;
|
||||||
|
|
Loading…
Reference in a new issue