Removal of Game_Input which has been made obsolete.
This commit is contained in:
parent
22b5c6a84f
commit
70167ed233
5 changed files with 72 additions and 98 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -35,5 +35,4 @@ w_snark.qc
|
|||
w_tripmine.qc
|
||||
weapons.qc
|
||||
../../../base/src/shared/weapon_common.qc
|
||||
input.qc
|
||||
#endlist
|
||||
|
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Cawthorne <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(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);
|
||||
}
|
Loading…
Reference in a new issue