Shared: Inherit weapon_common from Nuclide's base game.

This commit is contained in:
Marco Cawthorne 2021-05-10 08:18:36 +02:00
parent 35de6c1ea5
commit 3d12f067b8
11 changed files with 22 additions and 98 deletions

View file

@ -119,11 +119,11 @@ HUD_InSlotPos(int slot, int pos)
if (pl.g_items & g_weapons[i].id) {
return i;
} else {
return -1;
return (-1);
}
}
}
return -1;
return (-1);
}
void

View file

@ -2,7 +2,7 @@
../../../valve/src/shared/entities.h
../../../valve/src/shared/flags.h
player.qc
../../../valve/src/shared/weapon_common.h
../../../base/src/shared/weapon_common.h
../../../valve/src/shared/animations.h
../../../valve/src/shared/animations.qc
../../../valve/src/shared/pmove.qc
@ -42,6 +42,6 @@ w_sporelauncher.qc
w_penguin.qc
w_shockrifle.qc
weapons.qc
../../../valve/src/shared/weapon_common.qc
input.qc
../../../base/src/shared/weapon_common.qc
../../../valve/src/shared/input.qc
#endlist

View file

@ -1,76 +0,0 @@
/*
* Copyright (c) 2016-2020 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
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
void
Game_Input(void)
{
#ifdef SERVER
if (input_buttons & INPUT_BUTTON5) {
Player_UseDown();
} else {
Player_UseUp();
}
if (self.impulse == 100) {
Flashlight_Toggle();
}
if (cvar("sv_cheats") == 1) {
player pl = (player)self;
if (self.impulse == 101) {
pl.health = 100;
pl.armor = 100;
pl.g_items |= ITEM_SUIT;
Weapons_AddItem(pl, WEAPON_CROWBAR, -1);
Weapons_AddItem(pl, WEAPON_GLOCK, -1);
Weapons_AddItem(pl, WEAPON_PYTHON, -1);
Weapons_AddItem(pl, WEAPON_MP5, -1);
Weapons_AddItem(pl, WEAPON_SHOTGUN, -1);
Weapons_AddItem(pl, WEAPON_CROSSBOW, -1);
Weapons_AddItem(pl, WEAPON_RPG, -1);
Weapons_AddItem(pl, WEAPON_GAUSS, -1);
Weapons_AddItem(pl, WEAPON_EGON, -1);
Weapons_AddItem(pl, WEAPON_HORNETGUN, -1);
Weapons_AddItem(pl, WEAPON_HANDGRENADE, -1);
Weapons_AddItem(pl, WEAPON_SATCHEL, -1);
Weapons_AddItem(pl, WEAPON_TRIPMINE, -1);
Weapons_AddItem(pl, WEAPON_SNARK, -1);
Weapons_AddItem(pl, WEAPON_PENGUIN, -1);
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_M249, -1);
Weapons_AddItem(pl, WEAPON_SHOCKRIFLE, -1);
Weapons_AddItem(pl, WEAPON_SPORELAUNCHER, -1);
Weapons_AddItem(pl, WEAPON_SNIPERRIFLE, -1);
Weapons_AddItem(pl, WEAPON_DISPLACER, -1);
}
}
self.impulse = 0;
#endif
if (input_buttons & INPUT_BUTTON0) {
Weapons_Primary();
} else if (input_buttons & INPUT_BUTTON4) {
Weapons_Reload();
} else if (input_buttons & INPUT_BUTTON3) {
Weapons_Secondary();
} else {
Weapons_Release();
}
}

View file

@ -463,11 +463,11 @@ float
player::SendEntity(entity ePEnt, float fChanged)
{
if (health <= 0 && ePEnt != this) {
return FALSE;
return (0);
}
if (clienttype(ePEnt) != CLIENTTYPE_REAL) {
return FALSE;
return (0);
}
if (ePEnt != self) {
@ -546,7 +546,7 @@ player::SendEntity(entity ePEnt, float fChanged)
WriteByte(MSG_ENTITY, mode_m249);
}
return TRUE;
return (1);
}
#endif

View file

@ -91,10 +91,10 @@ w_displacer_pickup(int new, int startammo)
if (pl.ammo_uranium < MAX_A_URANIUM) {
pl.ammo_uranium = bound(0, pl.ammo_uranium + 40, MAX_A_URANIUM);
} else {
return FALSE;
return (0);
}
#endif
return TRUE;
return (1);
}
void

View file

@ -64,11 +64,11 @@ w_eagle_pickup(int new, int startammo)
if (pl.ammo_357 < MAX_A_357) {
pl.ammo_357 = bound(0, pl.ammo_357 + 7, MAX_A_357);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -63,11 +63,11 @@ w_m249_pickup(int new, int startammo)
if (pl.ammo_556 < MAX_A_556) {
pl.ammo_556 = bound(0, pl.ammo_556 + 50, MAX_A_556);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -42,10 +42,10 @@ w_penguin_pickup(int new, int startammo)
if (pl.ammo_penguin < MAX_A_PENGUIN) {
pl.ammo_penguin = bound(0, pl.ammo_penguin + 3, MAX_A_PENGUIN);
} else {
return FALSE;
return (0);
}
#endif
return TRUE;
return (1);
}
void

View file

@ -62,10 +62,10 @@ w_shockrifle_pickup(int new, int startammo)
/* only pick it up once */
if (new) {
pl.ammo_shock = MAX_A_SHOCK;
return TRUE;
return (1);
}
#endif
return FALSE;
return (0);
}
void

View file

@ -61,11 +61,11 @@ w_sniperrifle_pickup(int new, int startammo)
if (pl.ammo_762 < MAX_A_762) {
pl.ammo_762 = bound(0, pl.ammo_762 + 5, MAX_A_762);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -197,11 +197,11 @@ w_sporelauncher_pickup(int new, int startammo)
if (pl.ammo_spore < MAX_A_SPORE) {
pl.ammo_spore = bound(0, pl.ammo_spore + 5, MAX_A_SPORE);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void