Shared: Inherit weapon_common and input from Nuclide's base game

This commit is contained in:
Marco Cawthorne 2021-05-10 08:16:51 +02:00
parent 133bf4fec2
commit a2f65f73d7
35 changed files with 77 additions and 172 deletions

View file

@ -198,7 +198,7 @@ ClientGame_ConsoleCommand(void)
sendevent("Radio", "f", RADIO_ENEMYDOWN);
break;
default:
return FALSE;
return (0);
}
return TRUE;
return (1);
}

View file

@ -22,10 +22,10 @@ ClientGame_EntityUpdate(float id, float new)
w_c4bomb_parse();
break;
default:
return FALSE;
return (0);
}
return TRUE;
return (1);
}
void

View file

@ -113,11 +113,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

@ -29,7 +29,7 @@ CSGameRules::PlayerPain(base_player pl)
int
CSGameRules::BuyingPossible(base_player pl)
{
return FALSE;
return (0);
}
/* we check what fields have changed over the course of the frame and network

View file

@ -21,7 +21,7 @@ CSMultiplayerRules::MaxItemPerSlot(int slot)
if (slot == 3) {
return 3;
}
return 1;
return (1);
}
void
@ -355,42 +355,42 @@ int
CSMultiplayerRules::BuyingPossible(base_player pl)
{
if (pl.health <= 0) {
return FALSE;
return (0);
}
if (g_cs_gamestate == GAME_ACTIVE) {
if (((autocvar_mp_roundtime * 60) - g_cs_gametime) > autocvar_mp_buytime) {
centerprint(pl, sprintf("%d seconds have passed...\nYou can't buy anything now!", autocvar_mp_buytime));
return FALSE;
return (0);
}
}
if (pl.team == TEAM_VIP) {
centerprint(pl, "You are the VIP...\nYou can't buy anything!\n");
return FALSE;
return (0);
}
if (g_cstrike_buying == BUY_NEITHER) {
centerprint(pl, "Sorry, you aren't meant\nto be buying anything.\n");
return FALSE;
return (0);
}
if (g_cstrike_buying != BUY_BOTH) {
if (g_cstrike_buying == BUY_CT && pl.team == TEAM_T) {
centerprint(pl, "Terrorists aren't allowed to\nbuy anything on this map!\n");
return FALSE;
return (0);
} else if (g_cstrike_buying == BUY_T && pl.team == TEAM_CT) {
centerprint(pl, "CTs aren't allowed to buy\nanything on this map!\n");
return FALSE;
return (0);
}
}
if (!(pl.gflags & GF_BUYZONE)) {
centerprint(pl, "Sorry, you aren't in a buyzone.\n");
return FALSE;
return (0);
}
return TRUE;
return (1);
}
void
@ -913,10 +913,10 @@ CSMultiplayerRules::ConsoleCommand(base_player pp, string cmd)
}
break;
default:
return FALSE;
return (0);
}
return TRUE;
return (1);
}
void

View file

@ -1,7 +1,7 @@
#includelist
flags.h
player.h
../../../valve/src/shared/weapon_common.h
../../../base/src/shared/weapon_common.h
animations.h
animations.qc
@ -45,8 +45,8 @@ w_flashbang.qc
w_hegrenade.qc
w_smokegrenade.qc
weapons.qc
../../../valve/src/shared/weapon_common.qc
input.qc
../../../base/src/shared/weapon_common.qc
../../../base/src/shared/input.qc
pmove.qc
../../../valve/src/shared/pmove_water.qc
item_c4bomb.qc

View file

@ -1,95 +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
CGameRules rules = (CGameRules)g_grMode;
if (rules.m_iIntermission) {
rules.IntermissionEnd();
return;
}
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;
Weapons_AddItem(pl, WEAPON_M3, -1);
Weapons_AddItem(pl, WEAPON_XM1014, -1);
Weapons_AddItem(pl, WEAPON_MP5, -1);
Weapons_AddItem(pl, WEAPON_P90, -1);
Weapons_AddItem(pl, WEAPON_UMP45, -1);
Weapons_AddItem(pl, WEAPON_MAC10, -1);
Weapons_AddItem(pl, WEAPON_TMP, -1);
Weapons_AddItem(pl, WEAPON_AK47, -1);
Weapons_AddItem(pl, WEAPON_SG552, -1);
Weapons_AddItem(pl, WEAPON_M4A1, -1);
Weapons_AddItem(pl, WEAPON_AUG, -1);
Weapons_AddItem(pl, WEAPON_SCOUT, -1);
Weapons_AddItem(pl, WEAPON_AWP, -1);
Weapons_AddItem(pl, WEAPON_G3SG1, -1);
Weapons_AddItem(pl, WEAPON_SG550, -1);
Weapons_AddItem(pl, WEAPON_PARA, -1);
Weapons_AddItem(pl, WEAPON_C4BOMB, -1);
Weapons_AddItem(pl, WEAPON_FLASHBANG, -1);
Weapons_AddItem(pl, WEAPON_HEGRENADE, -1);
Weapons_AddItem(pl, WEAPON_SMOKEGRENADE, -1);
Weapons_AddItem(pl, WEAPON_USP45, -1);
Weapons_AddItem(pl, WEAPON_GLOCK18, -1);
Weapons_AddItem(pl, WEAPON_DEAGLE, -1);
Weapons_AddItem(pl, WEAPON_P228, -1);
Weapons_AddItem(pl, WEAPON_ELITES, -1);
Weapons_AddItem(pl, WEAPON_FIVESEVEN, -1);
Weapons_AddItem(pl, WEAPON_KNIFE, -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;
#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

@ -54,7 +54,7 @@ item_c4::SendEntity(entity pvsent, float flags)
WriteCoord(MSG_ENTITY, angles[1]);
WriteCoord(MSG_ENTITY, angles[2]);
WriteShort(MSG_ENTITY, modelindex);
return TRUE;
return (1);
}
void

View file

@ -508,11 +508,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) {
@ -595,6 +595,6 @@ player::SendEntity(entity ePEnt, float fChanged)
WriteFloat(MSG_ENTITY, cs_shottime);
}
return TRUE;
return (1);
}
#endif

View file

@ -122,11 +122,11 @@ w_ak47_pickup(int new, int startammo)
if (pl.ammo_762mm < AMMO_MAX_762MM) {
pl.ammo_762mm = bound(0, pl.ammo_762mm + 30, AMMO_MAX_762MM);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -88,11 +88,11 @@ w_aug_pickup(int new, int startammo)
if (pl.ammo_762mm < AMMO_MAX_762MM) {
pl.ammo_762mm = bound(0, pl.ammo_762mm + 30, AMMO_MAX_762MM);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -121,11 +121,11 @@ w_awp_pickup(int new, int startammo)
if (pl.ammo_338mag < 20) {
pl.ammo_338mag = bound(0, pl.ammo_338mag + 10, 20);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -187,9 +187,9 @@ w_c4bomb_pickup(int new, int startammo)
player pl = (player)self;
if (pl.team != TEAM_T)
return FALSE;
return (0);
#endif
return TRUE;
return (1);
}
void

View file

@ -120,11 +120,11 @@ w_deagle_pickup(int new, int startammo)
if (pl.ammo_50ae < AMMO_MAX_50AE) {
pl.ammo_50ae = bound(0, pl.ammo_50ae + 7, AMMO_MAX_50AE);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -142,11 +142,11 @@ w_elites_pickup(int new, int startammo)
if (pl.ammo_9mm < AMMO_MAX_9MM) {
pl.ammo_9mm = bound(0, pl.ammo_9mm + 30, AMMO_MAX_9MM);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -87,11 +87,11 @@ w_fiveseven_pickup(int new, int startammo)
if (pl.ammo_57mm < AMMO_MAX_57MM) {
pl.ammo_57mm = bound(0, pl.ammo_57mm + 20, AMMO_MAX_57MM);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -64,10 +64,10 @@ w_flashbang_pickup(int new, int startammo)
if (pl.ammo_fbgrenade < AMMO_MAX_FLASHBANG) {
pl.ammo_fbgrenade = bound(0, pl.ammo_fbgrenade + 1, AMMO_MAX_FLASHBANG);
} else {
return FALSE;
return (0);
}
#endif
return TRUE;
return (1);
}
string

View file

@ -86,11 +86,11 @@ w_g3sg1_pickup(int new, int startammo)
if (pl.ammo_762mm < AMMO_MAX_762MM) {
pl.ammo_762mm = bound(0, pl.ammo_762mm + 20, AMMO_MAX_762MM);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -97,11 +97,11 @@ w_glock18_pickup(int new, int startammo)
if (pl.ammo_9mm < AMMO_MAX_9MM) {
pl.ammo_9mm = bound(0, pl.ammo_9mm + 20, AMMO_MAX_9MM);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -64,10 +64,10 @@ w_hegrenade_pickup(int new, int startammo)
if (pl.ammo_hegrenade < AMMO_MAX_HENADE) {
pl.ammo_hegrenade = bound(0, pl.ammo_hegrenade + 1, AMMO_MAX_HENADE);
} else {
return FALSE;
return (0);
}
#endif
return TRUE;
return (1);
}
string

View file

@ -131,11 +131,11 @@ w_m3_pickup(int new, int startammo)
if (pl.ammo_buckshot < AMMO_MAX_BUCKSHOT) {
pl.ammo_buckshot = bound(0, pl.ammo_buckshot + 8, AMMO_MAX_BUCKSHOT);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -97,11 +97,11 @@ w_m4a1_pickup(int new, int startammo)
if (pl.ammo_556mm < AMMO_MAX_556MM) {
pl.ammo_556mm = bound(0, pl.ammo_556mm + 30, AMMO_MAX_556MM);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -87,11 +87,11 @@ w_mac10_pickup(int new, int startammo)
if (pl.ammo_45acp < AMMO_MAX_45ACP) {
pl.ammo_45acp = bound(0, pl.ammo_45acp + 30, AMMO_MAX_45ACP);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -87,11 +87,11 @@ w_mp5_pickup(int new, int startammo)
if (pl.ammo_9mm < AMMO_MAX_9MM) {
pl.ammo_9mm = bound(0, pl.ammo_9mm + 30, AMMO_MAX_9MM);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -88,11 +88,11 @@ w_p228_pickup(int new, int startammo)
if (pl.ammo_357sig < AMMO_MAX_357SIG) {
pl.ammo_357sig = bound(0, pl.ammo_357sig + 13, AMMO_MAX_357SIG);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -87,11 +87,11 @@ w_p90_pickup(int new, int startammo)
if (pl.ammo_57mm < AMMO_MAX_57MM) {
pl.ammo_57mm = bound(0, pl.ammo_57mm + 50, AMMO_MAX_57MM);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -86,11 +86,11 @@ w_para_pickup(int new, int startammo)
if (pl.ammo_556mmbox < AMMO_MAX_556MMBOX) {
pl.ammo_556mmbox = bound(0, pl.ammo_556mmbox + 100, AMMO_MAX_556MMBOX);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -86,11 +86,11 @@ w_scout_pickup(int new, int startammo)
if (pl.ammo_762mm < AMMO_MAX_762MM) {
pl.ammo_762mm = bound(0, pl.ammo_762mm + 10, AMMO_MAX_762MM);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -86,11 +86,11 @@ w_sg550_pickup(int new, int startammo)
if (pl.ammo_556mm < AMMO_MAX_556MM) {
pl.ammo_556mm = bound(0, pl.ammo_556mm + 30, AMMO_MAX_556MM);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -87,11 +87,11 @@ w_sg552_pickup(int new, int startammo)
if (pl.ammo_556mm < AMMO_MAX_556MM) {
pl.ammo_556mm = bound(0, pl.ammo_556mm + 30, AMMO_MAX_556MM);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -64,10 +64,10 @@ w_smokegrenade_pickup(int new, int startammo)
if (pl.ammo_smokegrenade < AMMO_MAX_SMOKE) {
pl.ammo_smokegrenade = bound(0, pl.ammo_smokegrenade + 1, AMMO_MAX_SMOKE);
} else {
return FALSE;
return (0);
}
#endif
return TRUE;
return (1);
}
string

View file

@ -87,11 +87,11 @@ w_tmp_pickup(int new, int startammo)
if (pl.ammo_9mm < AMMO_MAX_9MM) {
pl.ammo_9mm = bound(0, pl.ammo_9mm + 30, AMMO_MAX_9MM);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -87,11 +87,11 @@ w_ump45_pickup(int new, int startammo)
if (pl.ammo_45acp < AMMO_MAX_45ACP) {
pl.ammo_45acp = bound(0, pl.ammo_45acp + 25, AMMO_MAX_45ACP);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -100,11 +100,11 @@ w_usp45_pickup(int new, int startammo)
if (pl.ammo_45acp < AMMO_MAX_45ACP) {
pl.ammo_45acp = bound(0, pl.ammo_45acp + 12, AMMO_MAX_45ACP);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void

View file

@ -130,11 +130,11 @@ w_xm1014_pickup(int new, int startammo)
if (pl.ammo_buckshot < AMMO_MAX_BUCKSHOT) {
pl.ammo_buckshot = bound(0, pl.ammo_buckshot + 7, AMMO_MAX_BUCKSHOT);
} else {
return FALSE;
return (0);
}
}
#endif
return TRUE;
return (1);
}
void