Removal of Game_Input which has been made obsolete.
This commit is contained in:
parent
25315e3eb0
commit
9f6a4bfbfa
5 changed files with 160 additions and 66 deletions
|
@ -146,4 +146,27 @@ HLGameRules::PlayerKill(NSClientPlayer pp)
|
||||||
{
|
{
|
||||||
player pl = (player)pp;
|
player pl = (player)pp;
|
||||||
Damage_Apply(pl, pl, pl.health, WEAPON_NONE, DMG_SKIP_ARMOR);
|
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;
|
||||||
|
}
|
||||||
|
|
135
src/server/gamerules_singleplayer.qc
Normal file
135
src/server/gamerules_singleplayer.qc
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLSingleplayerRules::IsMultiplayer(void)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLSingleplayerRules::PlayerDeath(NSClientPlayer pl)
|
||||||
|
{
|
||||||
|
pl.movetype = MOVETYPE_NONE;
|
||||||
|
pl.solid = SOLID_NOT;
|
||||||
|
pl.takedamage = DAMAGE_NO;
|
||||||
|
pl.gflags &= ~GF_FLASHLIGHT;
|
||||||
|
pl.armor = pl.activeweapon = pl.g_items = pl.weapon = 0;
|
||||||
|
pl.health = 0;
|
||||||
|
Sound_Play(pl, CHAN_AUTO, "player.die");
|
||||||
|
|
||||||
|
if (cvar("coop") == 1) {
|
||||||
|
pl.think = PutClientInServer;
|
||||||
|
pl.nextthink = time + 4.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pl.health < -50) {
|
||||||
|
FX_GibHuman(pl.origin, vectoangles(pl.origin - g_dmg_eAttacker.origin), g_dmg_iDamage * 2.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Let's handle corpses on the clientside */
|
||||||
|
entity corpse = spawn();
|
||||||
|
setorigin(corpse, pl.origin + [0,0,32]);
|
||||||
|
setmodel(corpse, pl.model);
|
||||||
|
setsize(corpse, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||||
|
corpse.movetype = MOVETYPE_TOSS;
|
||||||
|
corpse.solid = SOLID_TRIGGER;
|
||||||
|
corpse.modelindex = pl.modelindex;
|
||||||
|
corpse.frame = ANIM_DIESIMPLE;
|
||||||
|
corpse.angles = pl.angles;
|
||||||
|
corpse.velocity = pl.velocity;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLSingleplayerRules::PlayerSpawn(NSClientPlayer pl)
|
||||||
|
{
|
||||||
|
pl.classname = "player";
|
||||||
|
pl.health = pl.max_health = 100;
|
||||||
|
pl.takedamage = DAMAGE_YES;
|
||||||
|
pl.SetSolid(SOLID_SLIDEBOX);
|
||||||
|
pl.SetMovetype(MOVETYPE_WALK);
|
||||||
|
pl.flags = FL_CLIENT;
|
||||||
|
pl.viewzoom = 1.0;
|
||||||
|
pl.model = "models/player.mdl";
|
||||||
|
|
||||||
|
|
||||||
|
if (cvar("coop") == 1) {
|
||||||
|
string mymodel = infokey(pl, "model");
|
||||||
|
if (mymodel) {
|
||||||
|
mymodel = sprintf("models/player/%s/%s.mdl", mymodel, mymodel);
|
||||||
|
if (whichpack(mymodel)) {
|
||||||
|
pl.model = mymodel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setmodel(pl, pl.model);
|
||||||
|
|
||||||
|
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||||
|
pl.velocity = [0,0,0];
|
||||||
|
pl.gravity = __NULL__;
|
||||||
|
pl.frame = 1;
|
||||||
|
//pl.SendEntity = Player_SendEntity;
|
||||||
|
pl.SendFlags = UPDATE_ALL;
|
||||||
|
pl.customphysics = Empty;
|
||||||
|
pl.iBleeds = TRUE;
|
||||||
|
forceinfokey(pl, "*spec", "0");
|
||||||
|
forceinfokey(pl, "*deaths", ftos(pl.deaths));
|
||||||
|
|
||||||
|
/* this is where the mods want to deviate */
|
||||||
|
entity spot;
|
||||||
|
|
||||||
|
if (startspot != "") {
|
||||||
|
dprint(sprintf("^3Gamerules_Spawn^7: Startspot is %s\n", startspot));
|
||||||
|
LevelDecodeParms(pl);
|
||||||
|
setorigin(pl, Landmark_GetSpot());
|
||||||
|
} else {
|
||||||
|
LevelNewParms();
|
||||||
|
spot = find(world, ::classname, "info_player_start");
|
||||||
|
setorigin(pl, spot.origin);
|
||||||
|
pl.angles = spot.angles;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
Weapons_AddItem(pl, WEAPON_FISTS, -1);
|
||||||
|
Weapons_AddItem(pl, WEAPON_GAUSSPISTOL, -1);
|
||||||
|
Weapons_AddItem(pl, WEAPON_BEAMGUN, -1);
|
||||||
|
Weapons_AddItem(pl, WEAPON_CHEMICALGUN, -1);
|
||||||
|
Weapons_AddItem(pl, WEAPON_DML, -1);
|
||||||
|
Weapons_AddItem(pl, WEAPON_MINIGUN, -1);
|
||||||
|
Weapons_AddItem(pl, WEAPON_AICORE, -1);
|
||||||
|
Weapons_AddItem(pl, WEAPON_SHOTGUN, -1);
|
||||||
|
Weapons_AddItem(pl, WEAPON_GRENADE, -1);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return super::ImpulseCommand(bp, num);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
|
@ -102,7 +102,7 @@ player_giveitems.qc
|
||||||
../../../src/botlib/include.src
|
../../../src/botlib/include.src
|
||||||
|
|
||||||
gamerules.qc
|
gamerules.qc
|
||||||
../../../valve/src/server/gamerules_singleplayer.qc
|
gamerules_singleplayer.qc
|
||||||
gamerules_multiplayer.qc
|
gamerules_multiplayer.qc
|
||||||
|
|
||||||
../../../valve/src/server/server.qc
|
../../../valve/src/server/server.qc
|
||||||
|
|
|
@ -29,5 +29,4 @@ w_minigun.qc
|
||||||
w_aicore.qc
|
w_aicore.qc
|
||||||
weapons.qc
|
weapons.qc
|
||||||
../../../base/src/shared/weapon_common.qc
|
../../../base/src/shared/weapon_common.qc
|
||||||
input.qc
|
|
||||||
#endlist
|
#endlist
|
||||||
|
|
|
@ -1,63 +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;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
Weapons_AddItem(pl, WEAPON_FISTS, -1);
|
|
||||||
Weapons_AddItem(pl, WEAPON_GAUSSPISTOL, -1);
|
|
||||||
Weapons_AddItem(pl, WEAPON_BEAMGUN, -1);
|
|
||||||
Weapons_AddItem(pl, WEAPON_CHEMICALGUN, -1);
|
|
||||||
Weapons_AddItem(pl, WEAPON_DML, -1);
|
|
||||||
Weapons_AddItem(pl, WEAPON_MINIGUN, -1);
|
|
||||||
Weapons_AddItem(pl, WEAPON_AICORE, -1);
|
|
||||||
Weapons_AddItem(pl, WEAPON_SHOTGUN, -1);
|
|
||||||
Weapons_AddItem(pl, WEAPON_GRENADE, -1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pl.impulse = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
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