Gamemodes: Moved the level transition stuff outside of the _singleplayer
logic as lots of mods want to inherit that of HL anyway.
This commit is contained in:
parent
594ba56f02
commit
992add7dfd
18 changed files with 426 additions and 791 deletions
|
@ -16,20 +16,23 @@
|
|||
|
||||
var int autocvar_sv_playerkeepalive = TRUE;
|
||||
|
||||
class HLGameRules:CGameRules
|
||||
class CSGameRules:CGameRules
|
||||
{
|
||||
virtual void(entity) PlayerConnect;
|
||||
virtual void(entity) PlayerDisconnect;
|
||||
virtual void(player) PlayerKill;
|
||||
virtual void(player) PlayerPostFrame;
|
||||
|
||||
/* level transitions */
|
||||
virtual void(player) LevelChangeParms;
|
||||
virtual void(player) LevelDecodeParms;
|
||||
virtual void(void) LevelNewParms;
|
||||
};
|
||||
|
||||
/* we check what fields have changed over the course of the frame and network
|
||||
* only the ones that have actually changed */
|
||||
void
|
||||
HLGameRules::PlayerPostFrame(player pl)
|
||||
CSGameRules::PlayerPostFrame(player pl)
|
||||
{
|
||||
Animation_PlayerUpdate();
|
||||
|
||||
|
@ -123,8 +126,49 @@ HLGameRules::PlayerPostFrame(player pl)
|
|||
pl.old_cs_shottime = pl.cs_shottime;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
HLGameRules::LevelNewParms(void)
|
||||
CSGameRules::LevelDecodeParms(player pl)
|
||||
{
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
pl.angles[0] = parm4;
|
||||
pl.angles[1] = parm5;
|
||||
pl.angles[2] = parm6;
|
||||
pl.velocity[0] = parm7;
|
||||
pl.velocity[1] = parm8;
|
||||
pl.velocity[2] = parm9;
|
||||
pl.g_items = parm10;
|
||||
pl.activeweapon = parm11;
|
||||
pl.flags = parm64;
|
||||
|
||||
if (pl.flags & FL_CROUCHING) {
|
||||
setsize(pl, VEC_CHULL_MIN, VEC_CHULL_MAX);
|
||||
} else {
|
||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CSGameRules::LevelChangeParms(player pl)
|
||||
{
|
||||
parm1 = g_landmarkpos[0];
|
||||
parm2 = g_landmarkpos[1];
|
||||
parm3 = g_landmarkpos[2];
|
||||
parm4 = pl.angles[0];
|
||||
parm5 = pl.angles[1];
|
||||
parm6 = pl.angles[2];
|
||||
parm7 = pl.velocity[0];
|
||||
parm8 = pl.velocity[1];
|
||||
parm9 = pl.velocity[2];
|
||||
parm64 = pl.flags;
|
||||
parm10 = pl.g_items;
|
||||
parm11 = pl.activeweapon;
|
||||
}
|
||||
|
||||
void
|
||||
CSGameRules::LevelNewParms(void)
|
||||
{
|
||||
parm1 = parm2 = parm3 = parm4 = parm5 = parm6 = parm7 =
|
||||
parm8 = parm9 = parm10 = parm11 = parm12 = parm13 = parm14 =
|
||||
|
@ -135,7 +179,7 @@ HLGameRules::LevelNewParms(void)
|
|||
}
|
||||
|
||||
void
|
||||
HLGameRules::PlayerConnect(entity pl)
|
||||
CSGameRules::PlayerConnect(entity pl)
|
||||
{
|
||||
entity a;
|
||||
bprint(PRINT_HIGH, sprintf("%s connected\n", pl.netname));
|
||||
|
@ -156,7 +200,7 @@ HLGameRules::PlayerConnect(entity pl)
|
|||
}
|
||||
|
||||
void
|
||||
HLGameRules::PlayerDisconnect(entity pl)
|
||||
CSGameRules::PlayerDisconnect(entity pl)
|
||||
{
|
||||
bprint(PRINT_HIGH, sprintf("%s disconnected\n", pl.netname));
|
||||
|
||||
|
@ -170,7 +214,7 @@ HLGameRules::PlayerDisconnect(entity pl)
|
|||
}
|
||||
|
||||
void
|
||||
HLGameRules::PlayerKill(player pl)
|
||||
CSGameRules::PlayerKill(player pl)
|
||||
{
|
||||
Damage_Apply(pl, pl, pl.health, WEAPON_NONE, DMG_SKIP_ARMOR);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
class CSMultiplayerRules:HLGameRules
|
||||
class CSMultiplayerRules:CSGameRules
|
||||
{
|
||||
virtual void(void) FrameStart;
|
||||
/* client */
|
||||
|
|
|
@ -14,56 +14,12 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
class CSSingleplayerRules:HLGameRules
|
||||
class CSSingleplayerRules:CSGameRules
|
||||
{
|
||||
/* client */
|
||||
virtual void(player) PlayerSpawn;
|
||||
|
||||
/* level transitions */
|
||||
virtual void(player) LevelChangeParms;
|
||||
virtual void(player) LevelDecodeParms;
|
||||
};
|
||||
|
||||
void
|
||||
CSSingleplayerRules::LevelDecodeParms(player pl)
|
||||
{
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
pl.angles[0] = parm4;
|
||||
pl.angles[1] = parm5;
|
||||
pl.angles[2] = parm6;
|
||||
pl.velocity[0] = parm7;
|
||||
pl.velocity[1] = parm8;
|
||||
pl.velocity[2] = parm9;
|
||||
pl.g_items = parm10;
|
||||
pl.activeweapon = parm11;
|
||||
pl.flags = parm64;
|
||||
|
||||
if (pl.flags & FL_CROUCHING) {
|
||||
setsize(pl, VEC_CHULL_MIN, VEC_CHULL_MAX);
|
||||
} else {
|
||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CSSingleplayerRules::LevelChangeParms(player pl)
|
||||
{
|
||||
parm1 = g_landmarkpos[0];
|
||||
parm2 = g_landmarkpos[1];
|
||||
parm3 = g_landmarkpos[2];
|
||||
parm4 = pl.angles[0];
|
||||
parm5 = pl.angles[1];
|
||||
parm6 = pl.angles[2];
|
||||
parm7 = pl.velocity[0];
|
||||
parm8 = pl.velocity[1];
|
||||
parm9 = pl.velocity[2];
|
||||
parm64 = pl.flags;
|
||||
parm10 = pl.g_items;
|
||||
parm11 = pl.activeweapon;
|
||||
}
|
||||
|
||||
void
|
||||
CSSingleplayerRules::PlayerSpawn(player pl)
|
||||
{
|
||||
|
@ -89,7 +45,6 @@ CSSingleplayerRules::PlayerSpawn(player pl)
|
|||
forceinfokey(pl, "*spec", "0");
|
||||
forceinfokey(pl, "*deaths", ftos(pl.deaths));
|
||||
|
||||
/* this is where the mods want to deviate */
|
||||
entity spot;
|
||||
|
||||
if (startspot != "") {
|
||||
|
|
|
@ -23,6 +23,9 @@ class HLGameRules:CGameRules
|
|||
virtual void(player) PlayerKill;
|
||||
virtual void(player) PlayerPostFrame;
|
||||
|
||||
/* level transitions */
|
||||
virtual void(player) LevelChangeParms;
|
||||
virtual void(player) LevelDecodeParms;
|
||||
virtual void(void) LevelNewParms;
|
||||
};
|
||||
|
||||
|
@ -132,6 +135,108 @@ HLGameRules::LevelNewParms(void)
|
|||
parm64 = FL_CLIENT;
|
||||
}
|
||||
|
||||
void
|
||||
HLGameRules::LevelDecodeParms(player pl)
|
||||
{
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
pl.angles[0] = parm4;
|
||||
pl.angles[1] = parm5;
|
||||
pl.angles[2] = parm6;
|
||||
pl.velocity[0] = parm7;
|
||||
pl.velocity[1] = parm8;
|
||||
pl.velocity[2] = parm9;
|
||||
pl.g_items = parm10;
|
||||
pl.activeweapon = parm11;
|
||||
pl.flags = parm64;
|
||||
|
||||
pl.ammo_9mm = parm12;
|
||||
pl.ammo_357 = parm13;
|
||||
pl.ammo_buckshot = parm14;
|
||||
pl.ammo_m203_grenade = parm15;
|
||||
pl.ammo_bolt = parm16;
|
||||
pl.ammo_rocket = parm17;
|
||||
pl.ammo_uranium = parm18;
|
||||
pl.ammo_handgrenade = parm19;
|
||||
pl.ammo_satchel = parm20;
|
||||
pl.ammo_tripmine = parm21;
|
||||
pl.ammo_snark = parm22;
|
||||
pl.ammo_hornet = parm23;
|
||||
|
||||
pl.glock_mag = parm24;
|
||||
pl.mp5_mag = parm25;
|
||||
pl.python_mag = parm26;
|
||||
pl.shotgun_mag = parm27;
|
||||
pl.crossbow_mag = parm28;
|
||||
pl.rpg_mag = parm29;
|
||||
pl.satchel_chg = parm30;
|
||||
|
||||
/* near gearbox additions */
|
||||
pl.ammo_556 = parm31;
|
||||
pl.ammo_762 = parm32;
|
||||
pl.ammo_spore = parm33;
|
||||
pl.ammo_shock = parm34;
|
||||
pl.ammo_penguin = parm35;
|
||||
pl.eagle_mag = parm36;
|
||||
pl.sniper_mag = parm37;
|
||||
pl.m249_mag = parm38;
|
||||
pl.sporelauncher_mag = parm39;
|
||||
|
||||
if (pl.flags & FL_CROUCHING) {
|
||||
setsize(pl, VEC_CHULL_MIN, VEC_CHULL_MAX);
|
||||
} else {
|
||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
HLGameRules::LevelChangeParms(player pl)
|
||||
{
|
||||
parm1 = g_landmarkpos[0];
|
||||
parm2 = g_landmarkpos[1];
|
||||
parm3 = g_landmarkpos[2];
|
||||
parm4 = pl.angles[0];
|
||||
parm5 = pl.angles[1];
|
||||
parm6 = pl.angles[2];
|
||||
parm7 = pl.velocity[0];
|
||||
parm8 = pl.velocity[1];
|
||||
parm9 = pl.velocity[2];
|
||||
parm64 = pl.flags;
|
||||
parm10 = pl.g_items;
|
||||
parm11 = pl.activeweapon;
|
||||
parm12 = pl.ammo_9mm;
|
||||
parm13 = pl.ammo_357;
|
||||
parm14 = pl.ammo_buckshot;
|
||||
parm15 = pl.ammo_m203_grenade;
|
||||
parm16 = pl.ammo_bolt;
|
||||
parm17 = pl.ammo_rocket;
|
||||
parm18 = pl.ammo_uranium;
|
||||
parm19 = pl.ammo_handgrenade;
|
||||
parm20 = pl.ammo_satchel;
|
||||
parm21 = pl.ammo_tripmine;
|
||||
parm22 = pl.ammo_snark;
|
||||
parm23 = pl.ammo_hornet;
|
||||
parm24 = pl.glock_mag;
|
||||
parm25 = pl.mp5_mag;
|
||||
parm26 = pl.python_mag;
|
||||
parm27 = pl.shotgun_mag;
|
||||
parm28 = pl.crossbow_mag;
|
||||
parm29 = pl.rpg_mag;
|
||||
parm30 = pl.satchel_chg;
|
||||
|
||||
/* near gearbox additions */
|
||||
parm31 = pl.ammo_556;
|
||||
parm32 = pl.ammo_762;
|
||||
parm33 = pl.ammo_spore;
|
||||
parm34 = pl.ammo_shock;
|
||||
parm35 = pl.ammo_penguin;
|
||||
parm36 = pl.eagle_mag;
|
||||
parm37 = pl.sniper_mag;
|
||||
parm38 = pl.m249_mag;
|
||||
parm39 = pl.sporelauncher_mag;
|
||||
}
|
||||
|
||||
void
|
||||
HLGameRules::PlayerConnect(entity pl)
|
||||
{
|
||||
|
|
|
@ -1,114 +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.
|
||||
*/
|
||||
|
||||
class HLMultiplayerRules:HLGameRules
|
||||
{
|
||||
/* client */
|
||||
virtual void(player) PlayerSpawn;
|
||||
|
||||
/* level transitions */
|
||||
virtual void(player) LevelDecodeParms;
|
||||
};
|
||||
|
||||
void
|
||||
HLMultiplayerRules::LevelDecodeParms(player pl)
|
||||
{
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
pl.angles[0] = parm4;
|
||||
pl.angles[1] = parm5;
|
||||
pl.angles[2] = parm6;
|
||||
pl.velocity[0] = parm7;
|
||||
pl.velocity[1] = parm8;
|
||||
pl.velocity[2] = parm9;
|
||||
pl.g_items = ITEM_CROWBAR | ITEM_GLOCK | ITEM_SUIT;
|
||||
pl.activeweapon = WEAPON_GLOCK;
|
||||
pl.flags = parm64;
|
||||
|
||||
pl.ammo_9mm = 44;
|
||||
pl.ammo_357 = parm13;
|
||||
pl.ammo_buckshot = parm14;
|
||||
pl.ammo_m203_grenade = parm15;
|
||||
pl.ammo_bolt = parm16;
|
||||
pl.ammo_rocket = parm17;
|
||||
pl.ammo_uranium = parm18;
|
||||
pl.ammo_handgrenade = parm19;
|
||||
pl.ammo_satchel = parm20;
|
||||
pl.ammo_tripmine = parm21;
|
||||
pl.ammo_snark = parm22;
|
||||
pl.ammo_hornet = parm23;
|
||||
|
||||
pl.glock_mag = 18;
|
||||
pl.mp5_mag = parm25;
|
||||
pl.python_mag = parm26;
|
||||
pl.shotgun_mag = parm27;
|
||||
pl.crossbow_mag = parm28;
|
||||
pl.rpg_mag = parm29;
|
||||
pl.satchel_chg = parm30;
|
||||
|
||||
if (pl.flags & FL_CROUCHING) {
|
||||
setsize(pl, VEC_CHULL_MIN, VEC_CHULL_MAX);
|
||||
} else {
|
||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
HLMultiplayerRules::PlayerSpawn(player pl)
|
||||
{
|
||||
/* this is where the mods want to deviate */
|
||||
entity spot;
|
||||
|
||||
pl.classname = "player";
|
||||
pl.health = pl.max_health = 100;
|
||||
pl.takedamage = DAMAGE_YES;
|
||||
pl.solid = SOLID_SLIDEBOX;
|
||||
pl.movetype = MOVETYPE_WALK;
|
||||
pl.flags = FL_CLIENT;
|
||||
pl.viewzoom = 1.0;
|
||||
pl.model = "models/player.mdl";
|
||||
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.view_ofs = VEC_PLAYER_VIEWPOS;
|
||||
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));
|
||||
|
||||
LevelNewParms();
|
||||
LevelDecodeParms(pl);
|
||||
spot = Spawn_SelectRandom("info_player_deathmatch");
|
||||
setorigin(pl, spot.origin);
|
||||
pl.angles = spot.angles;
|
||||
Weapons_RefreshAmmo(pl);
|
||||
|
||||
Client_FixAngle(pl, pl.angles);
|
||||
}
|
|
@ -1,170 +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.
|
||||
*/
|
||||
|
||||
class HLSingleplayerRules:HLGameRules
|
||||
{
|
||||
/* client */
|
||||
virtual void(player) PlayerSpawn;
|
||||
|
||||
/* level transitions */
|
||||
virtual void(player) LevelChangeParms;
|
||||
virtual void(player) LevelDecodeParms;
|
||||
};
|
||||
|
||||
void
|
||||
HLSingleplayerRules::LevelDecodeParms(player pl)
|
||||
{
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
pl.angles[0] = parm4;
|
||||
pl.angles[1] = parm5;
|
||||
pl.angles[2] = parm6;
|
||||
pl.velocity[0] = parm7;
|
||||
pl.velocity[1] = parm8;
|
||||
pl.velocity[2] = parm9;
|
||||
pl.g_items = parm10;
|
||||
pl.activeweapon = parm11;
|
||||
pl.flags = parm64;
|
||||
|
||||
pl.ammo_9mm = parm12;
|
||||
pl.ammo_357 = parm13;
|
||||
pl.ammo_buckshot = parm14;
|
||||
pl.ammo_m203_grenade = parm15;
|
||||
pl.ammo_bolt = parm16;
|
||||
pl.ammo_rocket = parm17;
|
||||
pl.ammo_uranium = parm18;
|
||||
pl.ammo_handgrenade = parm19;
|
||||
pl.ammo_satchel = parm20;
|
||||
pl.ammo_tripmine = parm21;
|
||||
pl.ammo_snark = parm22;
|
||||
pl.ammo_hornet = parm23;
|
||||
|
||||
pl.glock_mag = parm24;
|
||||
pl.mp5_mag = parm25;
|
||||
pl.python_mag = parm26;
|
||||
pl.shotgun_mag = parm27;
|
||||
pl.crossbow_mag = parm28;
|
||||
pl.rpg_mag = parm29;
|
||||
pl.satchel_chg = parm30;
|
||||
|
||||
/* near gearbox additions */
|
||||
pl.ammo_556 = parm31;
|
||||
pl.ammo_762 = parm32;
|
||||
pl.ammo_spore = parm33;
|
||||
pl.ammo_shock = parm34;
|
||||
pl.ammo_penguin = parm35;
|
||||
pl.eagle_mag = parm36;
|
||||
pl.sniper_mag = parm37;
|
||||
pl.m249_mag = parm38;
|
||||
pl.sporelauncher_mag = parm39;
|
||||
|
||||
if (pl.flags & FL_CROUCHING) {
|
||||
setsize(pl, VEC_CHULL_MIN, VEC_CHULL_MAX);
|
||||
} else {
|
||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
HLSingleplayerRules::LevelChangeParms(player pl)
|
||||
{
|
||||
parm1 = g_landmarkpos[0];
|
||||
parm2 = g_landmarkpos[1];
|
||||
parm3 = g_landmarkpos[2];
|
||||
parm4 = pl.angles[0];
|
||||
parm5 = pl.angles[1];
|
||||
parm6 = pl.angles[2];
|
||||
parm7 = pl.velocity[0];
|
||||
parm8 = pl.velocity[1];
|
||||
parm9 = pl.velocity[2];
|
||||
parm64 = pl.flags;
|
||||
parm10 = pl.g_items;
|
||||
parm11 = pl.activeweapon;
|
||||
parm12 = pl.ammo_9mm;
|
||||
parm13 = pl.ammo_357;
|
||||
parm14 = pl.ammo_buckshot;
|
||||
parm15 = pl.ammo_m203_grenade;
|
||||
parm16 = pl.ammo_bolt;
|
||||
parm17 = pl.ammo_rocket;
|
||||
parm18 = pl.ammo_uranium;
|
||||
parm19 = pl.ammo_handgrenade;
|
||||
parm20 = pl.ammo_satchel;
|
||||
parm21 = pl.ammo_tripmine;
|
||||
parm22 = pl.ammo_snark;
|
||||
parm23 = pl.ammo_hornet;
|
||||
parm24 = pl.glock_mag;
|
||||
parm25 = pl.mp5_mag;
|
||||
parm26 = pl.python_mag;
|
||||
parm27 = pl.shotgun_mag;
|
||||
parm28 = pl.crossbow_mag;
|
||||
parm29 = pl.rpg_mag;
|
||||
parm30 = pl.satchel_chg;
|
||||
|
||||
/* near gearbox additions */
|
||||
parm31 = pl.ammo_556;
|
||||
parm32 = pl.ammo_762;
|
||||
parm33 = pl.ammo_spore;
|
||||
parm34 = pl.ammo_shock;
|
||||
parm35 = pl.ammo_penguin;
|
||||
parm36 = pl.eagle_mag;
|
||||
parm37 = pl.sniper_mag;
|
||||
parm38 = pl.m249_mag;
|
||||
parm39 = pl.sporelauncher_mag;
|
||||
}
|
||||
|
||||
void
|
||||
HLSingleplayerRules::PlayerSpawn(player pl)
|
||||
{
|
||||
pl.classname = "player";
|
||||
pl.health = pl.max_health = 100;
|
||||
pl.takedamage = DAMAGE_YES;
|
||||
pl.solid = SOLID_SLIDEBOX;
|
||||
pl.movetype = MOVETYPE_WALK;
|
||||
pl.flags = FL_CLIENT;
|
||||
pl.viewzoom = 1.0;
|
||||
pl.model = "models/player.mdl";
|
||||
setmodel(pl, pl.model);
|
||||
|
||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
pl.view_ofs = VEC_PLAYER_VIEWPOS;
|
||||
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);
|
||||
}
|
|
@ -118,8 +118,8 @@
|
|||
|
||||
../gamerules.cpp
|
||||
../gearbox/gamerules.cpp
|
||||
../gearbox/gamerules_singleplayer.cpp
|
||||
../gearbox/gamerules_multiplayer.cpp
|
||||
../valve/gamerules_singleplayer.cpp
|
||||
../valve/gamerules_multiplayer.cpp
|
||||
../valve/client.c
|
||||
../client.c
|
||||
../valve/server.c
|
||||
|
|
|
@ -23,6 +23,9 @@ class HLGameRules:CGameRules
|
|||
virtual void(player) PlayerKill;
|
||||
virtual void(player) PlayerPostFrame;
|
||||
|
||||
/* level transitions */
|
||||
virtual void(player) LevelChangeParms;
|
||||
virtual void(player) LevelDecodeParms;
|
||||
virtual void(void) LevelNewParms;
|
||||
};
|
||||
|
||||
|
@ -132,6 +135,70 @@ HLGameRules::LevelNewParms(void)
|
|||
parm64 = FL_CLIENT;
|
||||
}
|
||||
|
||||
void
|
||||
HLGameRules::LevelDecodeParms(player pl)
|
||||
{
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
pl.angles[0] = parm4;
|
||||
pl.angles[1] = parm5;
|
||||
pl.angles[2] = parm6;
|
||||
pl.velocity[0] = parm7;
|
||||
pl.velocity[1] = parm8;
|
||||
pl.velocity[2] = parm9;
|
||||
pl.g_items = parm10;
|
||||
pl.activeweapon = parm11;
|
||||
pl.flags = parm64;
|
||||
|
||||
pl.ammo_nail = parm12;
|
||||
pl.ammo_buckshot = parm13;
|
||||
pl.ammo_bolts = parm14;
|
||||
pl.ammo_xencandy = parm15;
|
||||
pl.ammo_satchel = parm16;
|
||||
|
||||
pl.bradnailer_mag = parm17;
|
||||
pl.nailgun_mag = parm18;
|
||||
pl.shotgun_mag = parm19;
|
||||
pl.cmlwbr_mag = parm20;
|
||||
pl.xs_mag = parm21;
|
||||
pl.satchel_chg = parm22;
|
||||
|
||||
if (pl.flags & FL_CROUCHING) {
|
||||
setsize(pl, VEC_CHULL_MIN, VEC_CHULL_MAX);
|
||||
} else {
|
||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
HLGameRules::LevelChangeParms(player pl)
|
||||
{
|
||||
parm1 = g_landmarkpos[0];
|
||||
parm2 = g_landmarkpos[1];
|
||||
parm3 = g_landmarkpos[2];
|
||||
parm4 = pl.angles[0];
|
||||
parm5 = pl.angles[1];
|
||||
parm6 = pl.angles[2];
|
||||
parm7 = pl.velocity[0];
|
||||
parm8 = pl.velocity[1];
|
||||
parm9 = pl.velocity[2];
|
||||
parm64 = pl.flags;
|
||||
parm10 = pl.g_items;
|
||||
parm11 = pl.activeweapon;
|
||||
parm12 = pl.ammo_nail;
|
||||
parm13 = pl.ammo_buckshot;
|
||||
parm14 = pl.ammo_bolts;
|
||||
parm15 = pl.ammo_xencandy;
|
||||
parm16 = pl.ammo_satchel;
|
||||
parm17 = pl.bradnailer_mag;
|
||||
parm18 = pl.nailgun_mag;
|
||||
parm19 = pl.shotgun_mag;
|
||||
parm20 = pl.cmlwbr_mag;
|
||||
parm21 = pl.xs_mag;
|
||||
parm22 = pl.satchel_chg;
|
||||
}
|
||||
|
||||
void
|
||||
HLGameRules::PlayerConnect(entity pl)
|
||||
{
|
||||
|
|
|
@ -1,132 +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.
|
||||
*/
|
||||
|
||||
class HLSingleplayerRules:HLGameRules
|
||||
{
|
||||
/* client */
|
||||
virtual void(player) PlayerSpawn;
|
||||
|
||||
/* level transitions */
|
||||
virtual void(player) LevelChangeParms;
|
||||
virtual void(player) LevelDecodeParms;
|
||||
};
|
||||
|
||||
void
|
||||
HLSingleplayerRules::LevelDecodeParms(player pl)
|
||||
{
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
pl.angles[0] = parm4;
|
||||
pl.angles[1] = parm5;
|
||||
pl.angles[2] = parm6;
|
||||
pl.velocity[0] = parm7;
|
||||
pl.velocity[1] = parm8;
|
||||
pl.velocity[2] = parm9;
|
||||
pl.g_items = parm10;
|
||||
pl.activeweapon = parm11;
|
||||
pl.flags = parm64;
|
||||
|
||||
pl.ammo_nail = parm12;
|
||||
pl.ammo_buckshot = parm13;
|
||||
pl.ammo_bolts = parm14;
|
||||
pl.ammo_xencandy = parm15;
|
||||
pl.ammo_satchel = parm16;
|
||||
|
||||
pl.bradnailer_mag = parm17;
|
||||
pl.nailgun_mag = parm18;
|
||||
pl.shotgun_mag = parm19;
|
||||
pl.cmlwbr_mag = parm20;
|
||||
pl.xs_mag = parm21;
|
||||
pl.satchel_chg = parm22;
|
||||
|
||||
if (pl.flags & FL_CROUCHING) {
|
||||
setsize(pl, VEC_CHULL_MIN, VEC_CHULL_MAX);
|
||||
} else {
|
||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
HLSingleplayerRules::LevelChangeParms(player pl)
|
||||
{
|
||||
parm1 = g_landmarkpos[0];
|
||||
parm2 = g_landmarkpos[1];
|
||||
parm3 = g_landmarkpos[2];
|
||||
parm4 = pl.angles[0];
|
||||
parm5 = pl.angles[1];
|
||||
parm6 = pl.angles[2];
|
||||
parm7 = pl.velocity[0];
|
||||
parm8 = pl.velocity[1];
|
||||
parm9 = pl.velocity[2];
|
||||
parm64 = pl.flags;
|
||||
parm10 = pl.g_items;
|
||||
parm11 = pl.activeweapon;
|
||||
parm12 = pl.ammo_nail;
|
||||
parm13 = pl.ammo_buckshot;
|
||||
parm14 = pl.ammo_bolts;
|
||||
parm15 = pl.ammo_xencandy;
|
||||
parm16 = pl.ammo_satchel;
|
||||
parm17 = pl.bradnailer_mag;
|
||||
parm18 = pl.nailgun_mag;
|
||||
parm19 = pl.shotgun_mag;
|
||||
parm20 = pl.cmlwbr_mag;
|
||||
parm21 = pl.xs_mag;
|
||||
parm22 = pl.satchel_chg;
|
||||
}
|
||||
|
||||
void
|
||||
HLSingleplayerRules::PlayerSpawn(player pl)
|
||||
{
|
||||
pl.classname = "player";
|
||||
pl.health = pl.max_health = 100;
|
||||
pl.takedamage = DAMAGE_YES;
|
||||
pl.solid = SOLID_SLIDEBOX;
|
||||
pl.movetype = MOVETYPE_WALK;
|
||||
pl.flags = FL_CLIENT;
|
||||
pl.viewzoom = 1.0;
|
||||
pl.model = "models/player.mdl";
|
||||
setmodel(pl, pl.model);
|
||||
|
||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
pl.view_ofs = VEC_PLAYER_VIEWPOS;
|
||||
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);
|
||||
}
|
|
@ -97,7 +97,7 @@
|
|||
|
||||
../gamerules.cpp
|
||||
../poke646/gamerules.cpp
|
||||
../poke646/gamerules_singleplayer.cpp
|
||||
../valve/gamerules_singleplayer.cpp
|
||||
../poke646/gamerules_multiplayer.cpp
|
||||
../valve/client.c
|
||||
../client.c
|
||||
|
|
|
@ -23,9 +23,102 @@ class HLGameRules:CGameRules
|
|||
virtual void(player) PlayerKill;
|
||||
virtual void(player) PlayerPostFrame;
|
||||
|
||||
virtual void(player) LevelDecodeParms;
|
||||
virtual void(player) LevelChangeParms;
|
||||
virtual void(void) LevelNewParms;
|
||||
};
|
||||
|
||||
void
|
||||
HLGameRules::LevelDecodeParms(player pl)
|
||||
{
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
pl.angles[0] = parm4;
|
||||
pl.angles[1] = parm5;
|
||||
pl.angles[2] = parm6;
|
||||
pl.velocity[0] = parm7;
|
||||
pl.velocity[1] = parm8;
|
||||
pl.velocity[2] = parm9;
|
||||
pl.g_items = parm10;
|
||||
pl.activeweapon = parm11;
|
||||
pl.flags = parm64;
|
||||
|
||||
/*pl.ammo_9mm = parm12;
|
||||
pl.ammo_357 = parm13;
|
||||
pl.ammo_buckshot = parm14;
|
||||
pl.ammo_m203_grenade = parm15;
|
||||
pl.ammo_bolt = parm16;
|
||||
pl.ammo_rocket = parm17;
|
||||
pl.ammo_uranium = parm18;
|
||||
pl.ammo_handgrenade = parm19;
|
||||
pl.ammo_satchel = parm20;
|
||||
pl.ammo_tripmine = parm21;
|
||||
pl.ammo_snark = parm22;
|
||||
pl.ammo_hornet = parm23;
|
||||
|
||||
pl.glock_mag = parm24;
|
||||
pl.mp5_mag = parm25;
|
||||
pl.python_mag = parm26;
|
||||
pl.shotgun_mag = parm27;
|
||||
pl.crossbow_mag = parm28;
|
||||
pl.rpg_mag = parm29;
|
||||
pl.satchel_chg = parm30;*/
|
||||
|
||||
if (pl.flags & FL_CROUCHING) {
|
||||
setsize(pl, VEC_CHULL_MIN, VEC_CHULL_MAX);
|
||||
} else {
|
||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
HLGameRules::LevelChangeParms(player pl)
|
||||
{
|
||||
parm1 = g_landmarkpos[0];
|
||||
parm2 = g_landmarkpos[1];
|
||||
parm3 = g_landmarkpos[2];
|
||||
parm4 = pl.angles[0];
|
||||
parm5 = pl.angles[1];
|
||||
parm6 = pl.angles[2];
|
||||
parm7 = pl.velocity[0];
|
||||
parm8 = pl.velocity[1];
|
||||
parm9 = pl.velocity[2];
|
||||
parm64 = pl.flags;
|
||||
parm10 = pl.g_items;
|
||||
parm11 = pl.activeweapon;
|
||||
/*parm12 = pl.ammo_9mm;
|
||||
parm13 = pl.ammo_357;
|
||||
parm14 = pl.ammo_buckshot;
|
||||
parm15 = pl.ammo_m203_grenade;
|
||||
parm16 = pl.ammo_bolt;
|
||||
parm17 = pl.ammo_rocket;
|
||||
parm18 = pl.ammo_uranium;
|
||||
parm19 = pl.ammo_handgrenade;
|
||||
parm20 = pl.ammo_satchel;
|
||||
parm21 = pl.ammo_tripmine;
|
||||
parm22 = pl.ammo_snark;
|
||||
parm23 = pl.ammo_hornet;
|
||||
parm24 = pl.glock_mag;
|
||||
parm25 = pl.mp5_mag;
|
||||
parm26 = pl.python_mag;
|
||||
parm27 = pl.shotgun_mag;
|
||||
parm28 = pl.crossbow_mag;
|
||||
parm29 = pl.rpg_mag;
|
||||
parm30 = pl.satchel_chg;*/
|
||||
}
|
||||
|
||||
void
|
||||
HLGameRules::LevelNewParms(void)
|
||||
{
|
||||
parm1 = parm2 = parm3 = parm4 = parm5 = parm6 = parm7 =
|
||||
parm8 = parm9 = parm10 = parm11 = parm12 = parm13 = parm14 =
|
||||
parm15 = parm16 = parm17 = parm18 = parm19 = parm20 = parm21 =
|
||||
parm22 = parm23 = parm24 = parm25 = parm26 = parm27 = parm28 =
|
||||
parm29 = parm30 = 0;
|
||||
parm64 = FL_CLIENT;
|
||||
}
|
||||
|
||||
/* we check what fields have changed over the course of the frame and network
|
||||
* only the ones that have actually changed */
|
||||
void
|
||||
|
@ -121,17 +214,6 @@ HLGameRules::PlayerPostFrame(player pl)
|
|||
pl.old_a_ammo3 = pl.a_ammo3;
|
||||
}
|
||||
|
||||
void
|
||||
HLGameRules::LevelNewParms(void)
|
||||
{
|
||||
parm1 = parm2 = parm3 = parm4 = parm5 = parm6 = parm7 =
|
||||
parm8 = parm9 = parm10 = parm11 = parm12 = parm13 = parm14 =
|
||||
parm15 = parm16 = parm17 = parm18 = parm19 = parm20 = parm21 =
|
||||
parm22 = parm23 = parm24 = parm25 = parm26 = parm27 = parm28 =
|
||||
parm29 = parm30 = 0;
|
||||
parm64 = FL_CLIENT;
|
||||
}
|
||||
|
||||
void
|
||||
HLGameRules::PlayerConnect(entity pl)
|
||||
{
|
||||
|
|
|
@ -18,17 +18,8 @@ class HLMultiplayerRules:HLGameRules
|
|||
{
|
||||
/* client */
|
||||
virtual void(player) PlayerSpawn;
|
||||
|
||||
/* level transitions */
|
||||
virtual void(player) LevelDecodeParms;
|
||||
};
|
||||
|
||||
void
|
||||
HLMultiplayerRules::LevelDecodeParms(player pl)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
HLMultiplayerRules::PlayerSpawn(player pl)
|
||||
{
|
||||
|
@ -67,6 +58,12 @@ HLMultiplayerRules::PlayerSpawn(player pl)
|
|||
|
||||
LevelNewParms();
|
||||
LevelDecodeParms(pl);
|
||||
|
||||
/*pl.g_items = ITEM_CROWBAR | ITEM_GLOCK | ITEM_SUIT;
|
||||
pl.activeweapon = WEAPON_GLOCK;
|
||||
pl.glock_mag = 18;
|
||||
pl.ammo_9mm = 44;*/
|
||||
|
||||
spot = Spawn_SelectRandom("info_player_deathmatch");
|
||||
setorigin(pl, spot.origin);
|
||||
pl.angles = spot.angles;
|
||||
|
|
|
@ -1,108 +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.
|
||||
*/
|
||||
|
||||
class HLSingleplayerRules:HLGameRules
|
||||
{
|
||||
/* client */
|
||||
virtual void(player) PlayerSpawn;
|
||||
|
||||
/* level transitions */
|
||||
virtual void(player) LevelChangeParms;
|
||||
virtual void(player) LevelDecodeParms;
|
||||
};
|
||||
|
||||
void
|
||||
HLSingleplayerRules::LevelDecodeParms(player pl)
|
||||
{
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
pl.angles[0] = parm4;
|
||||
pl.angles[1] = parm5;
|
||||
pl.angles[2] = parm6;
|
||||
pl.velocity[0] = parm7;
|
||||
pl.velocity[1] = parm8;
|
||||
pl.velocity[2] = parm9;
|
||||
pl.g_items = parm10;
|
||||
pl.activeweapon = parm11;
|
||||
pl.flags = parm64;
|
||||
|
||||
if (pl.flags & FL_CROUCHING) {
|
||||
setsize(pl, VEC_CHULL_MIN, VEC_CHULL_MAX);
|
||||
} else {
|
||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
HLSingleplayerRules::LevelChangeParms(player pl)
|
||||
{
|
||||
parm1 = g_landmarkpos[0];
|
||||
parm2 = g_landmarkpos[1];
|
||||
parm3 = g_landmarkpos[2];
|
||||
parm4 = pl.angles[0];
|
||||
parm5 = pl.angles[1];
|
||||
parm6 = pl.angles[2];
|
||||
parm7 = pl.velocity[0];
|
||||
parm8 = pl.velocity[1];
|
||||
parm9 = pl.velocity[2];
|
||||
parm64 = pl.flags;
|
||||
parm10 = pl.g_items;
|
||||
parm11 = pl.activeweapon;
|
||||
}
|
||||
|
||||
void
|
||||
HLSingleplayerRules::PlayerSpawn(player pl)
|
||||
{
|
||||
pl.classname = "player";
|
||||
pl.health = pl.max_health = 100;
|
||||
pl.takedamage = DAMAGE_YES;
|
||||
pl.solid = SOLID_SLIDEBOX;
|
||||
pl.movetype = MOVETYPE_WALK;
|
||||
pl.flags = FL_CLIENT;
|
||||
pl.viewzoom = 1.0;
|
||||
pl.model = "models/player.mdl";
|
||||
setmodel(pl, pl.model);
|
||||
|
||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
pl.view_ofs = VEC_PLAYER_VIEWPOS;
|
||||
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);
|
||||
}
|
|
@ -65,8 +65,8 @@ monster_human_unarmed.cpp
|
|||
../../shared/valve/animations.c
|
||||
|
||||
../gamerules.cpp
|
||||
../valve/gamerules.cpp
|
||||
../rewolf/gamerules_singleplayer.cpp
|
||||
../rewolf/gamerules.cpp
|
||||
../valve/gamerules_singleplayer.cpp
|
||||
../rewolf/gamerules_multiplayer.cpp
|
||||
../valve/client.c
|
||||
../client.c
|
||||
|
|
|
@ -18,55 +18,8 @@ class SHMultiplayerRules:HLGameRules
|
|||
{
|
||||
/* client */
|
||||
virtual void(player) PlayerSpawn;
|
||||
|
||||
/* level transitions */
|
||||
virtual void(player) LevelDecodeParms;
|
||||
};
|
||||
|
||||
void
|
||||
SHMultiplayerRules::LevelDecodeParms(player pl)
|
||||
{
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
pl.angles[0] = parm4;
|
||||
pl.angles[1] = parm5;
|
||||
pl.angles[2] = parm6;
|
||||
pl.velocity[0] = parm7;
|
||||
pl.velocity[1] = parm8;
|
||||
pl.velocity[2] = parm9;
|
||||
pl.g_items = ITEM_CROWBAR | ITEM_GLOCK | ITEM_SUIT;
|
||||
pl.activeweapon = WEAPON_GLOCK;
|
||||
pl.flags = parm64;
|
||||
|
||||
pl.ammo_9mm = 44;
|
||||
pl.ammo_357 = parm13;
|
||||
pl.ammo_buckshot = parm14;
|
||||
pl.ammo_m203_grenade = parm15;
|
||||
pl.ammo_bolt = parm16;
|
||||
pl.ammo_rocket = parm17;
|
||||
pl.ammo_uranium = parm18;
|
||||
pl.ammo_handgrenade = parm19;
|
||||
pl.ammo_satchel = parm20;
|
||||
pl.ammo_tripmine = parm21;
|
||||
pl.ammo_snark = parm22;
|
||||
pl.ammo_hornet = parm23;
|
||||
|
||||
pl.glock_mag = 18;
|
||||
pl.mp5_mag = parm25;
|
||||
pl.python_mag = parm26;
|
||||
pl.shotgun_mag = parm27;
|
||||
pl.crossbow_mag = parm28;
|
||||
pl.rpg_mag = parm29;
|
||||
pl.satchel_chg = parm30;
|
||||
|
||||
if (pl.flags & FL_CROUCHING) {
|
||||
setsize(pl, VEC_CHULL_MIN, VEC_CHULL_MAX);
|
||||
} else {
|
||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SHMultiplayerRules::PlayerSpawn(player pl)
|
||||
{
|
||||
|
|
|
@ -23,9 +23,102 @@ class HLGameRules:CGameRules
|
|||
virtual void(player) PlayerKill;
|
||||
virtual void(player) PlayerPostFrame;
|
||||
|
||||
virtual void(player) LevelDecodeParms;
|
||||
virtual void(player) LevelChangeParms;
|
||||
virtual void(void) LevelNewParms;
|
||||
};
|
||||
|
||||
void
|
||||
HLGameRules::LevelDecodeParms(player pl)
|
||||
{
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
pl.angles[0] = parm4;
|
||||
pl.angles[1] = parm5;
|
||||
pl.angles[2] = parm6;
|
||||
pl.velocity[0] = parm7;
|
||||
pl.velocity[1] = parm8;
|
||||
pl.velocity[2] = parm9;
|
||||
pl.g_items = parm10;
|
||||
pl.activeweapon = parm11;
|
||||
pl.flags = parm64;
|
||||
|
||||
pl.ammo_9mm = parm12;
|
||||
pl.ammo_357 = parm13;
|
||||
pl.ammo_buckshot = parm14;
|
||||
pl.ammo_m203_grenade = parm15;
|
||||
pl.ammo_bolt = parm16;
|
||||
pl.ammo_rocket = parm17;
|
||||
pl.ammo_uranium = parm18;
|
||||
pl.ammo_handgrenade = parm19;
|
||||
pl.ammo_satchel = parm20;
|
||||
pl.ammo_tripmine = parm21;
|
||||
pl.ammo_snark = parm22;
|
||||
pl.ammo_hornet = parm23;
|
||||
|
||||
pl.glock_mag = parm24;
|
||||
pl.mp5_mag = parm25;
|
||||
pl.python_mag = parm26;
|
||||
pl.shotgun_mag = parm27;
|
||||
pl.crossbow_mag = parm28;
|
||||
pl.rpg_mag = parm29;
|
||||
pl.satchel_chg = parm30;
|
||||
|
||||
if (pl.flags & FL_CROUCHING) {
|
||||
setsize(pl, VEC_CHULL_MIN, VEC_CHULL_MAX);
|
||||
} else {
|
||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
HLGameRules::LevelChangeParms(player pl)
|
||||
{
|
||||
parm1 = g_landmarkpos[0];
|
||||
parm2 = g_landmarkpos[1];
|
||||
parm3 = g_landmarkpos[2];
|
||||
parm4 = pl.angles[0];
|
||||
parm5 = pl.angles[1];
|
||||
parm6 = pl.angles[2];
|
||||
parm7 = pl.velocity[0];
|
||||
parm8 = pl.velocity[1];
|
||||
parm9 = pl.velocity[2];
|
||||
parm64 = pl.flags;
|
||||
parm10 = pl.g_items;
|
||||
parm11 = pl.activeweapon;
|
||||
parm12 = pl.ammo_9mm;
|
||||
parm13 = pl.ammo_357;
|
||||
parm14 = pl.ammo_buckshot;
|
||||
parm15 = pl.ammo_m203_grenade;
|
||||
parm16 = pl.ammo_bolt;
|
||||
parm17 = pl.ammo_rocket;
|
||||
parm18 = pl.ammo_uranium;
|
||||
parm19 = pl.ammo_handgrenade;
|
||||
parm20 = pl.ammo_satchel;
|
||||
parm21 = pl.ammo_tripmine;
|
||||
parm22 = pl.ammo_snark;
|
||||
parm23 = pl.ammo_hornet;
|
||||
parm24 = pl.glock_mag;
|
||||
parm25 = pl.mp5_mag;
|
||||
parm26 = pl.python_mag;
|
||||
parm27 = pl.shotgun_mag;
|
||||
parm28 = pl.crossbow_mag;
|
||||
parm29 = pl.rpg_mag;
|
||||
parm30 = pl.satchel_chg;
|
||||
}
|
||||
|
||||
void
|
||||
HLGameRules::LevelNewParms(void)
|
||||
{
|
||||
parm1 = parm2 = parm3 = parm4 = parm5 = parm6 = parm7 =
|
||||
parm8 = parm9 = parm10 = parm11 = parm12 = parm13 = parm14 =
|
||||
parm15 = parm16 = parm17 = parm18 = parm19 = parm20 = parm21 =
|
||||
parm22 = parm23 = parm24 = parm25 = parm26 = parm27 = parm28 =
|
||||
parm29 = parm30 = 0;
|
||||
parm64 = FL_CLIENT;
|
||||
}
|
||||
|
||||
/* we check what fields have changed over the course of the frame and network
|
||||
* only the ones that have actually changed */
|
||||
void
|
||||
|
@ -121,17 +214,6 @@ HLGameRules::PlayerPostFrame(player pl)
|
|||
pl.old_a_ammo3 = pl.a_ammo3;
|
||||
}
|
||||
|
||||
void
|
||||
HLGameRules::LevelNewParms(void)
|
||||
{
|
||||
parm1 = parm2 = parm3 = parm4 = parm5 = parm6 = parm7 =
|
||||
parm8 = parm9 = parm10 = parm11 = parm12 = parm13 = parm14 =
|
||||
parm15 = parm16 = parm17 = parm18 = parm19 = parm20 = parm21 =
|
||||
parm22 = parm23 = parm24 = parm25 = parm26 = parm27 = parm28 =
|
||||
parm29 = parm30 = 0;
|
||||
parm64 = FL_CLIENT;
|
||||
}
|
||||
|
||||
void
|
||||
HLGameRules::PlayerConnect(entity pl)
|
||||
{
|
||||
|
|
|
@ -18,55 +18,8 @@ class HLMultiplayerRules:HLGameRules
|
|||
{
|
||||
/* client */
|
||||
virtual void(player) PlayerSpawn;
|
||||
|
||||
/* level transitions */
|
||||
virtual void(player) LevelDecodeParms;
|
||||
};
|
||||
|
||||
void
|
||||
HLMultiplayerRules::LevelDecodeParms(player pl)
|
||||
{
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
pl.angles[0] = parm4;
|
||||
pl.angles[1] = parm5;
|
||||
pl.angles[2] = parm6;
|
||||
pl.velocity[0] = parm7;
|
||||
pl.velocity[1] = parm8;
|
||||
pl.velocity[2] = parm9;
|
||||
pl.g_items = ITEM_CROWBAR | ITEM_GLOCK | ITEM_SUIT;
|
||||
pl.activeweapon = WEAPON_GLOCK;
|
||||
pl.flags = parm64;
|
||||
|
||||
pl.ammo_9mm = 44;
|
||||
pl.ammo_357 = parm13;
|
||||
pl.ammo_buckshot = parm14;
|
||||
pl.ammo_m203_grenade = parm15;
|
||||
pl.ammo_bolt = parm16;
|
||||
pl.ammo_rocket = parm17;
|
||||
pl.ammo_uranium = parm18;
|
||||
pl.ammo_handgrenade = parm19;
|
||||
pl.ammo_satchel = parm20;
|
||||
pl.ammo_tripmine = parm21;
|
||||
pl.ammo_snark = parm22;
|
||||
pl.ammo_hornet = parm23;
|
||||
|
||||
pl.glock_mag = 18;
|
||||
pl.mp5_mag = parm25;
|
||||
pl.python_mag = parm26;
|
||||
pl.shotgun_mag = parm27;
|
||||
pl.crossbow_mag = parm28;
|
||||
pl.rpg_mag = parm29;
|
||||
pl.satchel_chg = parm30;
|
||||
|
||||
if (pl.flags & FL_CROUCHING) {
|
||||
setsize(pl, VEC_CHULL_MIN, VEC_CHULL_MAX);
|
||||
} else {
|
||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
HLMultiplayerRules::PlayerSpawn(player pl)
|
||||
{
|
||||
|
@ -105,6 +58,11 @@ HLMultiplayerRules::PlayerSpawn(player pl)
|
|||
|
||||
LevelNewParms();
|
||||
LevelDecodeParms(pl);
|
||||
pl.g_items = ITEM_CROWBAR | ITEM_GLOCK | ITEM_SUIT;
|
||||
pl.activeweapon = WEAPON_GLOCK;
|
||||
pl.glock_mag = 18;
|
||||
pl.ammo_9mm = 44;
|
||||
|
||||
spot = Spawn_SelectRandom("info_player_deathmatch");
|
||||
setorigin(pl, spot.origin);
|
||||
pl.angles = spot.angles;
|
||||
|
|
|
@ -18,92 +18,8 @@ class HLSingleplayerRules:HLGameRules
|
|||
{
|
||||
/* client */
|
||||
virtual void(player) PlayerSpawn;
|
||||
|
||||
/* level transitions */
|
||||
virtual void(player) LevelChangeParms;
|
||||
virtual void(player) LevelDecodeParms;
|
||||
};
|
||||
|
||||
void
|
||||
HLSingleplayerRules::LevelDecodeParms(player pl)
|
||||
{
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
pl.angles[0] = parm4;
|
||||
pl.angles[1] = parm5;
|
||||
pl.angles[2] = parm6;
|
||||
pl.velocity[0] = parm7;
|
||||
pl.velocity[1] = parm8;
|
||||
pl.velocity[2] = parm9;
|
||||
pl.g_items = parm10;
|
||||
pl.activeweapon = parm11;
|
||||
pl.flags = parm64;
|
||||
|
||||
pl.ammo_9mm = parm12;
|
||||
pl.ammo_357 = parm13;
|
||||
pl.ammo_buckshot = parm14;
|
||||
pl.ammo_m203_grenade = parm15;
|
||||
pl.ammo_bolt = parm16;
|
||||
pl.ammo_rocket = parm17;
|
||||
pl.ammo_uranium = parm18;
|
||||
pl.ammo_handgrenade = parm19;
|
||||
pl.ammo_satchel = parm20;
|
||||
pl.ammo_tripmine = parm21;
|
||||
pl.ammo_snark = parm22;
|
||||
pl.ammo_hornet = parm23;
|
||||
|
||||
pl.glock_mag = parm24;
|
||||
pl.mp5_mag = parm25;
|
||||
pl.python_mag = parm26;
|
||||
pl.shotgun_mag = parm27;
|
||||
pl.crossbow_mag = parm28;
|
||||
pl.rpg_mag = parm29;
|
||||
pl.satchel_chg = parm30;
|
||||
|
||||
if (pl.flags & FL_CROUCHING) {
|
||||
setsize(pl, VEC_CHULL_MIN, VEC_CHULL_MAX);
|
||||
} else {
|
||||
setsize(pl, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
HLSingleplayerRules::LevelChangeParms(player pl)
|
||||
{
|
||||
parm1 = g_landmarkpos[0];
|
||||
parm2 = g_landmarkpos[1];
|
||||
parm3 = g_landmarkpos[2];
|
||||
parm4 = pl.angles[0];
|
||||
parm5 = pl.angles[1];
|
||||
parm6 = pl.angles[2];
|
||||
parm7 = pl.velocity[0];
|
||||
parm8 = pl.velocity[1];
|
||||
parm9 = pl.velocity[2];
|
||||
parm64 = pl.flags;
|
||||
parm10 = pl.g_items;
|
||||
parm11 = pl.activeweapon;
|
||||
parm12 = pl.ammo_9mm;
|
||||
parm13 = pl.ammo_357;
|
||||
parm14 = pl.ammo_buckshot;
|
||||
parm15 = pl.ammo_m203_grenade;
|
||||
parm16 = pl.ammo_bolt;
|
||||
parm17 = pl.ammo_rocket;
|
||||
parm18 = pl.ammo_uranium;
|
||||
parm19 = pl.ammo_handgrenade;
|
||||
parm20 = pl.ammo_satchel;
|
||||
parm21 = pl.ammo_tripmine;
|
||||
parm22 = pl.ammo_snark;
|
||||
parm23 = pl.ammo_hornet;
|
||||
parm24 = pl.glock_mag;
|
||||
parm25 = pl.mp5_mag;
|
||||
parm26 = pl.python_mag;
|
||||
parm27 = pl.shotgun_mag;
|
||||
parm28 = pl.crossbow_mag;
|
||||
parm29 = pl.rpg_mag;
|
||||
parm30 = pl.satchel_chg;
|
||||
}
|
||||
|
||||
void
|
||||
HLSingleplayerRules::PlayerSpawn(player pl)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue