Counter-Strike: Handle level-transitions for weapon information, purge
said information when dying in MP games as well.
This commit is contained in:
parent
da7f06b835
commit
46f720d562
3 changed files with 141 additions and 8 deletions
|
@ -146,6 +146,42 @@ CSGameRules::LevelDecodeParms(player pl)
|
|||
pl.activeweapon = parm11;
|
||||
pl.flags = parm64;
|
||||
|
||||
pl.ammo_50ae = parm12;
|
||||
pl.ammo_762mm = parm13;
|
||||
pl.ammo_556mm = parm14;
|
||||
pl.ammo_556mmbox = parm15;
|
||||
pl.ammo_338mag = parm16;
|
||||
pl.ammo_9mm = parm17;
|
||||
pl.ammo_buckshot = parm18;
|
||||
pl.ammo_45acp = parm19;
|
||||
pl.ammo_357sig = parm20;
|
||||
pl.ammo_57mm = parm21;
|
||||
pl.ammo_hegrenade = parm22;
|
||||
pl.ammo_fbgrenade = parm23;
|
||||
pl.ammo_smokegrenade = parm24;
|
||||
pl.usp45_mag = parm25;
|
||||
pl.glock18_mag = parm26;
|
||||
pl.deagle_mag = parm27;
|
||||
pl.p228_mag = parm28;
|
||||
pl.elites_mag = parm29;
|
||||
pl.fiveseven_mag = parm30;
|
||||
pl.m3_mag = parm31;
|
||||
pl.xm1014_mag = parm32;
|
||||
pl.mp5_mag = parm33;
|
||||
pl.p90_mag = parm34;
|
||||
pl.ump45_mag = parm35;
|
||||
pl.mac10_mag = parm36;
|
||||
pl.tmp_mag = parm37;
|
||||
pl.ak47_mag = parm38;
|
||||
pl.sg552_mag = parm39;
|
||||
pl.m4a1_mag = parm40;
|
||||
pl.aug_mag = parm41;
|
||||
pl.scout_mag = parm42;
|
||||
pl.awp_mag = parm43;
|
||||
pl.g3sg1_mag = parm44;
|
||||
pl.sg550_mag = parm45;
|
||||
pl.para_mag = parm46;
|
||||
|
||||
if (pl.flags & FL_CROUCHING) {
|
||||
setsize(pl, VEC_CHULL_MIN, VEC_CHULL_MAX);
|
||||
} else {
|
||||
|
@ -168,6 +204,42 @@ CSGameRules::LevelChangeParms(player pl)
|
|||
parm64 = pl.flags;
|
||||
parm10 = pl.g_items;
|
||||
parm11 = pl.activeweapon;
|
||||
|
||||
parm12 = pl.ammo_50ae;
|
||||
parm13 = pl.ammo_762mm;
|
||||
parm14 = pl.ammo_556mm;
|
||||
parm15 = pl.ammo_556mmbox;
|
||||
parm16 = pl.ammo_338mag;
|
||||
parm17 = pl.ammo_9mm;
|
||||
parm18 = pl.ammo_buckshot;
|
||||
parm19 = pl.ammo_45acp;
|
||||
parm20 = pl.ammo_357sig;
|
||||
parm21 = pl.ammo_57mm;
|
||||
parm22 = pl.ammo_hegrenade;
|
||||
parm23 = pl.ammo_fbgrenade;
|
||||
parm24 = pl.ammo_smokegrenade;
|
||||
parm25 = pl.usp45_mag;
|
||||
parm26 = pl.glock18_mag;
|
||||
parm27 = pl.deagle_mag;
|
||||
parm28 = pl.p228_mag;
|
||||
parm29 = pl.elites_mag;
|
||||
parm30 = pl.fiveseven_mag;
|
||||
parm31 = pl.m3_mag;
|
||||
parm32 = pl.xm1014_mag;
|
||||
parm33 = pl.mp5_mag;
|
||||
parm34 = pl.p90_mag;
|
||||
parm35 = pl.ump45_mag;
|
||||
parm36 = pl.mac10_mag;
|
||||
parm37 = pl.tmp_mag;
|
||||
parm38 = pl.ak47_mag;
|
||||
parm39 = pl.sg552_mag;
|
||||
parm40 = pl.m4a1_mag;
|
||||
parm41 = pl.aug_mag;
|
||||
parm42 = pl.scout_mag;
|
||||
parm43 = pl.awp_mag;
|
||||
parm44 = pl.g3sg1_mag;
|
||||
parm45 = pl.sg550_mag;
|
||||
parm46 = pl.para_mag;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -177,7 +249,9 @@ CSGameRules::LevelNewParms(void)
|
|||
parm8 = parm9 = parm10 = parm11 = parm12 = parm13 = parm14 =
|
||||
parm15 = parm16 = parm17 = parm18 = parm19 = parm20 = parm21 =
|
||||
parm22 = parm23 = parm24 = parm25 = parm26 = parm27 = parm28 =
|
||||
parm29 = parm30 = 0;
|
||||
parm29 = parm30 = parm31 = parm32 = parm33 = parm34 = parm35 =
|
||||
parm36 = parm37 = parm38 = parm39 = parm40 = parm41 = parm42 =
|
||||
parm43 = parm44 = parm45 = parm46 = 0;
|
||||
parm64 = FL_CLIENT;
|
||||
}
|
||||
|
||||
|
@ -192,7 +266,7 @@ CSGameRules::PlayerConnect(entity pl)
|
|||
playercount++;
|
||||
}
|
||||
|
||||
/* we're the first. respawn all entities? */
|
||||
/* we're the first. respawn all entities? */
|
||||
if (playercount == 0) {
|
||||
for (a = world; (a = findfloat(a, ::gflags, GF_CANRESPAWN));) {
|
||||
CBaseEntity caw = (CBaseEntity)a;
|
||||
|
|
|
@ -71,6 +71,7 @@ class CSMultiplayerRules:CSGameRules
|
|||
virtual void(void) SwitchTeams;
|
||||
virtual void(void) TimeOut;
|
||||
|
||||
virtual void(player) PlayerClearWeaponry;
|
||||
virtual void(player, int) PlayerMakePlayable;
|
||||
virtual void(player) PlayerMakeSpectator;
|
||||
virtual void(player, int) PlayerRespawn;
|
||||
|
|
|
@ -27,11 +27,14 @@ CSMultiplayerRules::MaxItemPerSlot(int slot)
|
|||
void
|
||||
CSMultiplayerRules::PlayerDeath(player pl)
|
||||
{
|
||||
/* clear all ammo and inventory... */
|
||||
PlayerClearWeaponry(pl);
|
||||
|
||||
pl.movetype = MOVETYPE_NONE;
|
||||
pl.solid = SOLID_NOT;
|
||||
pl.takedamage = DAMAGE_NO;
|
||||
pl.flags &= ~FL_FLASHLIGHT;
|
||||
pl.armor = pl.activeweapon = pl.g_items = 0;
|
||||
pl.armor = 0;
|
||||
pl.health = 0;
|
||||
|
||||
entity corpse = spawn();
|
||||
|
@ -49,7 +52,6 @@ CSMultiplayerRules::PlayerDeath(player pl)
|
|||
/* gamerule stuff */
|
||||
PlayerMakeSpectator(pl);
|
||||
pl.classname = "player";
|
||||
pl.health = 0;
|
||||
forceinfokey(pl, "*dead", "1");
|
||||
forceinfokey(pl, "*team", ftos(pl.team));
|
||||
CountPlayers();
|
||||
|
@ -620,17 +622,30 @@ Recursive function that gets the next spawnpoint
|
|||
entity
|
||||
CSMultiplayerRules::PlayerFindSpawn(float t)
|
||||
{
|
||||
entity point;
|
||||
if (t == TEAM_T) {
|
||||
m_eLastTSpawn = find(m_eLastTSpawn, ::classname, "info_player_deathmatch");
|
||||
return m_eLastTSpawn;
|
||||
|
||||
if (m_eLastTSpawn == world) {
|
||||
m_eLastTSpawn = find(m_eLastTSpawn, ::classname, "info_player_deathmatch");
|
||||
}
|
||||
point = m_eLastTSpawn;
|
||||
} else if (t == TEAM_CT) {
|
||||
m_eLastCTSpawn = find(m_eLastCTSpawn, ::classname, "info_player_start");
|
||||
return m_eLastCTSpawn;
|
||||
|
||||
if (m_eLastCTSpawn == world) {
|
||||
m_eLastCTSpawn = find(m_eLastCTSpawn, ::classname, "info_player_start");
|
||||
}
|
||||
point = m_eLastCTSpawn;
|
||||
} else if (t == TEAM_VIP) {
|
||||
return find(world, ::classname, "info_vip_start");
|
||||
point = find(world, ::classname, "info_vip_start");
|
||||
}
|
||||
|
||||
return world;
|
||||
if (point == world) {
|
||||
error("Error: No valid spawnpoints available.");
|
||||
}
|
||||
|
||||
return point;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -702,6 +717,49 @@ CSMultiplayerRules::PlayerRespawn(player pl, int fTeam)
|
|||
Ammo_AutoFill(pl.fSlotSecondary);*/
|
||||
}
|
||||
|
||||
void
|
||||
CSMultiplayerRules::PlayerClearWeaponry(player pl)
|
||||
{
|
||||
pl.g_items = 0x0;
|
||||
pl.activeweapon = 0;
|
||||
pl.ammo_50ae = 0;
|
||||
pl.ammo_762mm = 0;
|
||||
pl.ammo_556mm = 0;
|
||||
pl.ammo_556mmbox = 0;
|
||||
pl.ammo_338mag = 0;
|
||||
pl.ammo_9mm = 0;
|
||||
pl.ammo_buckshot = 0;
|
||||
pl.ammo_45acp = 0;
|
||||
pl.ammo_357sig = 0;
|
||||
pl.ammo_57mm = 0;
|
||||
pl.ammo_hegrenade = 0;
|
||||
pl.ammo_fbgrenade = 0;
|
||||
pl.ammo_smokegrenade = 0;
|
||||
pl.usp45_mag = 0;
|
||||
pl.glock18_mag = 0;
|
||||
pl.deagle_mag = 0;
|
||||
pl.p228_mag = 0;
|
||||
pl.elites_mag = 0;
|
||||
pl.fiveseven_mag = 0;
|
||||
pl.m3_mag = 0;
|
||||
pl.xm1014_mag = 0;
|
||||
pl.mp5_mag = 0;
|
||||
pl.p90_mag = 0;
|
||||
pl.ump45_mag = 0;
|
||||
pl.mac10_mag = 0;
|
||||
pl.tmp_mag = 0;
|
||||
pl.ak47_mag = 0;
|
||||
pl.sg552_mag = 0;
|
||||
pl.m4a1_mag = 0;
|
||||
pl.aug_mag = 0;
|
||||
pl.scout_mag = 0;
|
||||
pl.awp_mag = 0;
|
||||
pl.g3sg1_mag = 0;
|
||||
pl.sg550_mag = 0;
|
||||
pl.para_mag = 0;
|
||||
pl.viewzoom = 1.0f;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
PlayerMakePlayable
|
||||
|
|
Loading…
Reference in a new issue