Skip to content

Commit 95c7c2b

Browse files
authored
Merge pull request #1322 from FortressOne/staging
Staging
2 parents 6d5c820 + f565a79 commit 95c7c2b

File tree

11 files changed

+203
-63
lines changed

11 files changed

+203
-63
lines changed

csqc/main.qc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ void Slot_Keyup(float slot) {
252252
localcmd("-attack\n");
253253
}
254254

255-
void W_ChangeToSlotAlternate(string opt1, string opt2);
255+
void W_ChangeToSlotAlternate(string opt1, string opt2, string opt3, string opt4);
256256

257257
noref float(string cmd) CSQC_ConsoleCommand = {
258258
tokenize_console(cmd);
@@ -452,7 +452,7 @@ noref float(string cmd) CSQC_ConsoleCommand = {
452452
RemoveVoteMap(argv(1), TRUE);
453453
break;
454454
case "slot_a": // Alternate between passed options
455-
W_ChangeToSlotAlternate(argv(1), argv(2));
455+
W_ChangeToSlotAlternate(argv(1), argv(2), argv(3), argv(4));
456456
break;
457457
}
458458

csqc/weapon_predict.qc

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -712,19 +712,25 @@ void WP_ChangeWeapon(Slot slot) {
712712

713713
// Alternate between opt1/opt2, activating opt1 if neither is active.
714714
// Useful for demoman to have red/yellows bound to 1 key.
715-
void W_ChangeToSlotAlternate(string opt1, string opt2) {
716-
float v1 = strlen(opt1) > 0 ? stof(opt1) : 0;
717-
float v2 = strlen(opt2) > 0 ? stof(opt2) : v1;
715+
void W_ChangeToSlotAlternate(string opt1, string opt2, string opt3, string opt4) {
716+
float v[4], nv = 0, idx = -1;
717+
string s[4] = {opt1, opt2, opt3, opt4};
718718

719-
if ((v1 < 1 || v1 > TF_NUM_SLOTS) || (v2 < 1 || v2 > TF_NUM_SLOTS))
720-
return;
719+
for (int i = 0; i < s.length; i++) {
720+
if (strlen(s[i]) == 0)
721+
break;
722+
723+
float t = stof(s[i]);
724+
if (t < 1 || t > TF_NUM_SLOTS)
725+
return;
726+
727+
if (SlotIndex(pstate_pred.current_slot) + 1 == t)
728+
idx = nv;
729+
v[nv++] = t;
730+
}
721731

722-
// The OWI/slot mess rears its head again here. We convert to a slot for
723-
// comparison but use the naked input value which will then be converted per
724-
// OWI if active.
725-
Slot slot = FO_SlotByInput(pstate_pred.playerclass, v1);
726-
float imp = IsSameSlot(pstate_pred.current_slot, slot) ? v2 : v1;
727-
localcmd(sprintf("impulse %d\n", imp));
732+
idx = (idx + 1) % nv;
733+
localcmd(sprintf("impulse %d\n", TF_SLOT1 + v[idx] - 1));
728734
}
729735

730736
Slot WP_BestWeaponSlot() {

ssqc/client.qc

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ static float NB_UseMinPing() {
241241
return TRUE;
242242
}
243243

244-
void ActivateNewBalance() {
244+
void ActivateOrgGame() {
245245
disable_resup_gren = 2; // No gren2 pickups
246246

247247
drop_gren1 = 0; // No grenades in backpacks
@@ -250,17 +250,17 @@ void ActivateNewBalance() {
250250
for (i = 1; i <= 9; i++) // 3 gren spawn
251251
SetAllRoles(i, 1, 3);
252252

253-
SetAllRoles(4, 2, 1); // 1 mirv for demoman
254-
SetAllRoles(6, 2, 1); // 1 mirv for hwguy
255-
SetAllRoles(9, 2, 1); // 1 emp for engineer
256-
SetAllRoles(9, 1, 4); // 4 gren1 for engineer
257-
SetAllRoles(3, 1, 4); // 4 gren1 for soldier
253+
SetAllRoles(4, 2, CF_GetSetting("mg2_4", "max_gren2_demoman", ftos(1))); // 1 mirv for demoman
254+
SetAllRoles(6, 2, CF_GetSetting("mg2_6", "max_gren2_hwguy", ftos(1))); // 1 mirv for hwguy
255+
SetAllRoles(9, 2, CF_GetSetting("mg2_9", "max_gren2_engineer", ftos(1))); // 1 emp for engineer
256+
SetAllRoles(9, 1, CF_GetSetting("mg1_9", "max_gren1_engineer", ftos(4))); // 4 gren1 for engineer
257+
SetAllRoles(3, 1, CF_GetSetting("mg1_3", "max_gren1_soldier", ftos(4))); // 4 gren1 for soldier
258258

259259
PC_PYRO_AIRBLAST_COOLDOWN = 10;
260260
PC_ENGINEER_GRENADE_TYPE_2_RANGE = 200;
261261

262-
float use_new_cap = CF_GetSetting("nbcc", "new_balance_conc_cap", "4");
263-
if (use_new_cap == 4 && ServerRegion() == kRegionOCE)
262+
float use_new_cap = CF_GetSetting("nbcc", "new_balance_conc_cap", "0");
263+
if (use_new_cap == 4)
264264
use_new_cap = 1;
265265
else
266266
use_new_cap = 0;
@@ -383,6 +383,7 @@ void () DecodeLevelParms = {
383383
duelmode = CF_GetSetting("duelmode", "duelmode", "off");
384384

385385
disable_voting = clanbattle || quadmode;
386+
org_game = clanbattle || quadmode;
386387

387388
rounds = CF_GetSetting("rounds","rounds","on");
388389
if (!rounds)
@@ -711,14 +712,14 @@ void () DecodeLevelParms = {
711712
*/
712713
Role_None.gren1_limits[0] = 0;
713714
Role_None.gren1_limits[1] = CF_GetSetting("mg1_1", "max_gren1_scout", ftos(PC_SCOUT_GRENADE_MAX_1));
714-
Role_None.gren1_limits[2] = CF_GetSetting("mg1_2", "max_gren1_sniper", ftos(PC_SNIPER_GRENADE_MAX_1));
715-
Role_None.gren1_limits[3] = CF_GetSetting("mg1_3", "max_gren1_soldier", ftos(PC_SOLDIER_GRENADE_MAX_1));
716-
Role_None.gren1_limits[4] = CF_GetSetting("mg1_4", "max_gren1_demoman", ftos(PC_DEMOMAN_GRENADE_MAX_1));
717-
Role_None.gren1_limits[5] = CF_GetSetting("mg1_5", "max_gren1_medic", ftos(PC_MEDIC_GRENADE_MAX_1));
718-
Role_None.gren1_limits[6] = CF_GetSetting("mg1_6", "max_gren1_hwguy", ftos(PC_HVYWEAP_GRENADE_MAX_1));
719-
Role_None.gren1_limits[7] = CF_GetSetting("mg1_7", "max_gren1_pyro", ftos(PC_PYRO_GRENADE_MAX_1));
720-
Role_None.gren1_limits[8] = CF_GetSetting("mg1_8", "max_gren1_spy", ftos(PC_SPY_GRENADE_MAX_1));
721-
Role_None.gren1_limits[9] = CF_GetSetting("mg2_9", "max_gren1_engineer", ftos(PC_ENGINEER_GRENADE_MAX_1));
715+
Role_None.gren1_limits[2] = CF_GetSetting("mg1_2", "max_gren1_sniper", ftos(PC_SNIPER_GRENADE_MAX_1));
716+
Role_None.gren1_limits[3] = CF_GetSetting("mg1_3", "max_gren1_soldier", ftos(PC_SOLDIER_GRENADE_MAX_1));
717+
Role_None.gren1_limits[4] = CF_GetSetting("mg1_4", "max_gren1_demoman", ftos(PC_DEMOMAN_GRENADE_MAX_1));
718+
Role_None.gren1_limits[5] = CF_GetSetting("mg1_5", "max_gren1_medic", ftos(PC_MEDIC_GRENADE_MAX_1));
719+
Role_None.gren1_limits[6] = CF_GetSetting("mg1_6", "max_gren1_hwguy", ftos(PC_HVYWEAP_GRENADE_MAX_1));
720+
Role_None.gren1_limits[7] = CF_GetSetting("mg1_7", "max_gren1_pyro", ftos(PC_PYRO_GRENADE_MAX_1));
721+
Role_None.gren1_limits[8] = CF_GetSetting("mg1_8", "max_gren1_spy", ftos(PC_SPY_GRENADE_MAX_1));
722+
Role_None.gren1_limits[9] = CF_GetSetting("mg1_9", "max_gren1_engineer", ftos(PC_ENGINEER_GRENADE_MAX_1));
722723

723724
// Maximum number of secondary grenades per class
724725
Role_None.gren2_limits[1] = CF_GetSetting("mg2_1", "max_gren2_scout", ftos(PC_SCOUT_GRENADE_MAX_2));
@@ -1096,11 +1097,12 @@ void () DecodeLevelParms = {
10961097

10971098
// Overrides other settings.
10981099
new_balance = CF_GetSetting("new_balance", "new_balance", "1");
1099-
11001100
// mirror current state into desired state bit
11011101
new_balance |= (new_balance << 1);
1102-
if (NewBalanceActive())
1103-
ActivateNewBalance();
1102+
1103+
if (org_game) // This used to depend on new balance
1104+
ActivateOrgGame();
1105+
11041106
};
11051107

11061108
entity() FindIntermission =

ssqc/commands.qc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,10 @@ float (string arg1, string arg2, string arg3) ParseCmds = {
846846
break;
847847
case "break":
848848
processedCmd = TRUE;
849-
if(self.vote_map) {
849+
850+
if (disable_voting) {
851+
// Do nothing
852+
} else if (self.vote_map) {
850853
UnvoteForMap(self);
851854
} else {
852855
if(votemode) {

ssqc/engineer.qc

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,6 +1577,33 @@ void () CheckDistance = {
15771577
self.nextthink = time + 0.3;
15781578
};
15791579

1580+
float IsEngEnt(entity ent) {
1581+
return ent.classname == "building_dispenser" ||
1582+
ent.classname == "building_sentrygun";
1583+
1584+
}
1585+
1586+
void RemoveEngEnt(entity bld, float explode) {
1587+
entity owner = bld.real_owner;
1588+
if (owner.building == bld) {
1589+
Menu_Close(owner);
1590+
owner.building = world;
1591+
}
1592+
1593+
if (explode) {
1594+
TF_T_Damage(bld, world, world, 500, 0, 0);
1595+
} else {
1596+
if(bld.classname == "building_dispenser")
1597+
owner.has_dispenser = 0;
1598+
if(bld.classname == "building_sentrygun") {
1599+
owner.has_sentry = 0;
1600+
if (bld.trigger_field != world)
1601+
dremove (bld.trigger_field);
1602+
}
1603+
dremove (bld);
1604+
}
1605+
}
1606+
15801607
void (entity eng, string bld, float explode) DestroyBuildingWithOptions = {
15811608
local entity te;
15821609
local entity oldself;
@@ -1593,23 +1620,10 @@ void (entity eng, string bld, float explode) DestroyBuildingWithOptions = {
15931620
bound_other_ammo(self);
15941621
self = oldself;
15951622
}
1596-
if (te.real_owner.building == te) {
1597-
Menu_Close(te.real_owner);
1598-
te.real_owner.building = world;
1599-
}
1600-
if(explode) {
1601-
TF_T_Damage(te, world, world, 500, 0, 0);
1602-
} else {
1603-
if(bld == "building_dispenser")
1604-
te.real_owner.has_dispenser = 0;
1605-
if(bld == "building_sentrygun") {
1606-
te.real_owner.has_sentry = 0;
1607-
if (te.trigger_field != world)
1608-
dremove (te.trigger_field);
1609-
}
1610-
spawn_tfog(te.origin);
1611-
dremove (te);
1612-
}
1623+
1624+
spawn_tfog(te.origin);
1625+
RemoveEngEnt(te, explode);
1626+
16131627
}
16141628
te = find(te, classname, bld);
16151629
}

ssqc/progs.src

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ events.qc
2929
roles.qc
3030
q3defs.qc
3131
status.qc
32+
teamplay.qc
3233
functions.qc
3334
menu.qc
3435
csmenu.qc

ssqc/qw.qc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ float clanbattle;
452452
float clan_scores_dumped;
453453
float cb_prematch;
454454
float disable_voting;
455+
float org_game;
455456
float v_break;
456457
float v_ready;
457458
.float allowvote;

ssqc/scout.qc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -830,8 +830,8 @@ void (entity inflictor, entity attacker, float bounce,
830830
local entity te;
831831
local vector org;
832832

833-
if (NewBalanceActive() && inflictor.owner.playerclass == PC_MEDIC)
834-
actual_cuss_time = 2;
833+
//if (NewBalanceActive() && inflictor.owner.playerclass == PC_MEDIC)
834+
// actual_cuss_time = 2;
835835

836836
head = findradius(inflictor.origin, bounce + 40);
837837
while (head) {

ssqc/teamplay.qc

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
static void Apply(entity* targets, int tcount, int(entity) filter_fn,
2+
void(entity) apply_fn) {
3+
for (int i = 0; i < tcount; i++)
4+
if (filter_fn(targets[i]))
5+
apply_fn(targets[i]);
6+
}
7+
8+
static entity EntityOwner(entity e) {
9+
if (e.real_owner != world)
10+
return e.real_owner;
11+
else
12+
return e.owner;
13+
}
14+
15+
static void ApplyList(entity* targets, int count,
16+
int(entity) player_filter_fn, void(entity) player_apply_fn,
17+
int(entity) other_filter_fn, void(entity) other_apply_fn) {
18+
for (int i = 0; i < count; i++) {
19+
entity e = targets[i];
20+
21+
if (e.classname == "player") {
22+
if (player_filter_fn(e))
23+
player_apply_fn(e);
24+
} else if (EntityOwner(e).classname == "player") {
25+
if (other_filter_fn(e))
26+
other_apply_fn(e);
27+
}
28+
}
29+
}
30+
31+
static void ApplyRadius(vector org, float rad,
32+
int(entity) player_filter_fn, void(entity) player_apply_fn,
33+
int(entity) other_filter_fn, void(entity) other_apply_fn) {
34+
int count;
35+
entity* ents = findradius_list(org, rad, count);
36+
ApplyList(ents, count,
37+
player_filter_fn, player_apply_fn, other_filter_fn, other_apply_fn);
38+
}
39+
40+
void RemovePrimedGrenades(entity player);
41+
42+
/* Disabled new-balance remove chaser ammo mechanic
43+
static void EffStrip(entity player) {
44+
player.ammo_cells = 0;
45+
player.ammo_rockets = 0;
46+
player.ammo_shells = 0;
47+
player.ammo_nails = 0;
48+
49+
player.no_grenades_1 = player.no_grenades_2 = 0;
50+
player.current_slot = player.queue_slot = MakeSlot(4);
51+
52+
RemovePrimedGrenades(player);
53+
54+
string msg = "The enemy captured! You are afflicted by the Curse of Isma!";
55+
stuffcmd(player, "bf\n");
56+
sprint(player, PRINT_HIGH, msg, "\n");
57+
centerprint(player, msg);
58+
}*/
59+
60+
float IsEngEnt(entity ent);
61+
void RemoveEngEnt(entity bld, float explode);
62+
63+
static void EffRemove(entity non_player) {
64+
if (non_player.classname == "player") {
65+
printf("ERROR! Tried to remove player [%s]\n", non_player.netname);
66+
return;
67+
}
68+
69+
pointparticles(particleeffectnum("fo_airblast"), non_player.origin);
70+
if (IsEngEnt(non_player))
71+
RemoveEngEnt(non_player, FALSE);
72+
else
73+
dremove(non_player);
74+
}
75+
76+
static int(entity p) FilTeamEQ[] = {
77+
{ return p.team_no == 1; },
78+
{ return p.team_no == 2; },
79+
{ return p.team_no == 3; },
80+
{ return p.team_no == 4; },
81+
};
82+
83+
static int(entity p) FilTeamNEQ[] = {
84+
{ return p.team_no != 1; },
85+
{ return p.team_no != 2; },
86+
{ return p.team_no != 3; },
87+
{ return p.team_no != 4; },
88+
};
89+
90+
static int(entity p) FilOwnerTeamNEQ[] = {
91+
{ return EntityOwner(p).team_no != 1; },
92+
{ return EntityOwner(p).team_no != 2; },
93+
{ return EntityOwner(p).team_no != 3; },
94+
{ return EntityOwner(p).team_no != 4; },
95+
};
96+
97+
void TeamPlay_Cap(vector origin, entity player) {
98+
if (!org_game || !new_balance)
99+
return;
100+
101+
//ApplyRadius(origin, 1500,
102+
// FilTeamNEQ[player.team_no - 1], EffStrip,
103+
// FilOwnerTeamNEQ[player.team_no - 1], EffRemove);
104+
}

ssqc/tfort.qc

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,21 @@ void () RemoveAutoIdTimer = {
133133
}
134134
};
135135

136+
void RemovePrimedGrenades(entity player) {
137+
entity* ents;
138+
int count;
139+
140+
ents = find_list(classname, "primetimer", EV_STRING, count);
141+
for (int i = 0; i < count; i++)
142+
if (ents[i].owner == player)
143+
dremove(ents[i]);
144+
145+
player.tfstate &= ~(TFSTATE_GREN1_PRIMED | TFSTATE_GREN2_PRIMED);
146+
}
147+
136148
void () RemovePrimeTimers = {
137-
if (!drop_grenades) {
138-
local entity te = find(world, classname, "primetimer");
139-
while (te != world) {
140-
if (te.owner == self)
141-
dremove(te);
142-
te = find(te, classname, "primetimer");
143-
}
144-
}
149+
if (!drop_grenades)
150+
RemovePrimedGrenades(self);
145151
};
146152

147153
void () RemoveGasTimers = {
@@ -2045,11 +2051,12 @@ void (float Suicided) TeamFortress_SetupRespawn = {
20452051
if (Suicided) {
20462052
if (self.lives > 0)
20472053
self.lives = self.lives - 1;
2048-
2049-
if(!allowpracspawns)
2050-
restime = restime + 7;
2054+
2055+
if (!allowpracspawns)
2056+
restime = restime + (new_balance ? 5 : 7);
20512057
}
20522058
}
2059+
20532060
if (cb_prematch) {
20542061
if (self.lives > 0)
20552062
self.lives = self.lives - 1;

0 commit comments

Comments
 (0)