From 70167ed233cdb110fd06b53e2c4b7305f44c27d0 Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Wed, 11 Jan 2023 17:44:32 -0800 Subject: [PATCH] Removal of Game_Input which has been made obsolete. --- src/server/gamerules.h | 2 + src/server/gamerules.qc | 25 +++++++- src/server/gamerules_singleplayer.qc | 46 +++++++++++++ src/shared/include.src | 1 - src/shared/input.qc | 96 ---------------------------- 5 files changed, 72 insertions(+), 98 deletions(-) delete mode 100644 src/shared/input.qc diff --git a/src/server/gamerules.h b/src/server/gamerules.h index 63c7f6e..3aab4f5 100644 --- a/src/server/gamerules.h +++ b/src/server/gamerules.h @@ -26,6 +26,7 @@ class HLGameRules:CGameRules virtual void(void) LevelNewParms; virtual bool(void) IsMultiplayer; + virtual bool ImpulseCommand(NSClient, float); }; class HLSingleplayerRules:HLGameRules @@ -34,6 +35,7 @@ class HLSingleplayerRules:HLGameRules virtual void(NSClientPlayer) PlayerSpawn; virtual void(NSClientPlayer) PlayerDeath; virtual bool(void) IsMultiplayer; + virtual bool ImpulseCommand(NSClient, float); }; class HLMultiplayerRules:HLGameRules diff --git a/src/server/gamerules.qc b/src/server/gamerules.qc index 44798bc..5343c88 100644 --- a/src/server/gamerules.qc +++ b/src/server/gamerules.qc @@ -138,4 +138,27 @@ void HLGameRules::PlayerKill(NSClientPlayer pl) { Damage_Apply(pl, pl, pl.health, WEAPON_NONE, DMG_SKIP_ARMOR); -} +} + +void +TriggerFlashlight(NSClient target) +{ + entity oldself = self; + self = target; + Flashlight_Toggle(); + self = oldself; +} + +bool +HLGameRules::ImpulseCommand(NSClient bp, float num) +{ + switch (num) { + case 100: + TriggerFlashlight(bp); + break; + default: + return super::ImpulseCommand(bp, num); + } + + return true; +} diff --git a/src/server/gamerules_singleplayer.qc b/src/server/gamerules_singleplayer.qc index 3849cd6..bc347d2 100644 --- a/src/server/gamerules_singleplayer.qc +++ b/src/server/gamerules_singleplayer.qc @@ -106,3 +106,49 @@ HLSingleplayerRules::PlayerSpawn(NSClientPlayer pl) Weapons_RefreshAmmo(pl); Client_FixAngle(pl, pl.angles); } + + + +bool +HLSingleplayerRules::ImpulseCommand(NSClient bp, float num) +{ + switch (num) { + case 101: + player pl = (player)bp; + 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); + pl.ammo_m203_grenade = 10; +#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 + break; + default: + return super::ImpulseCommand(bp, num); + } + + return true; +} diff --git a/src/shared/include.src b/src/shared/include.src index 1327be6..eeee887 100644 --- a/src/shared/include.src +++ b/src/shared/include.src @@ -35,5 +35,4 @@ w_snark.qc w_tripmine.qc weapons.qc ../../../base/src/shared/weapon_common.qc -input.qc #endlist diff --git a/src/shared/input.qc b/src/shared/input.qc deleted file mode 100644 index e59da2d..0000000 --- a/src/shared/input.qc +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2016-2020 Marco Cawthorne - * - * 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(player pl) -{ -#ifdef SERVER - CGameRules rules = (CGameRules)g_grMode; - - if (rules.m_iIntermission) { - rules.IntermissionEnd(); - return; - } else { - if (input_buttons & INPUT_BUTTON0) - if (pl.IsAlive() == false) - if (pl.TimeSinceDeath() > 0.5f) /* allow for some time to pass */ - pl.ScheduleThink(PutClientInServer, 0.0f); - } - - if (input_buttons & INPUT_BUTTON5) - pl.InputUse_Down(); - else - pl.InputUse_Up(); - - if (pl.impulse == 100) - Flashlight_Toggle(); - - if (cvar("sv_cheats") == 1) { - if (pl.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); - pl.ammo_m203_grenade = 10; -#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 - } - } - - pl.impulse = 0; -#endif - - NSVehicle veh = (NSVehicle)pl.vehicle; - bool canfire = true; - if (veh) - if (veh.PreventPlayerFire() == true) - canfire = false; - - if (canfire == false) - return; - - if (input_buttons & INPUT_BUTTON0) - Weapons_Primary(pl); - else if (input_buttons & INPUT_BUTTON4) - Weapons_Reload(pl); - else if (input_buttons & INPUT_BUTTON3) - Weapons_Secondary(pl); - else - Weapons_Release(pl); -}