Skip to content

Commit

Permalink
Merge pull request #1305 from newbytf/dev-cur
Browse files Browse the repository at this point in the history
Dev cur
  • Loading branch information
newbytf authored Mar 15, 2024
2 parents af69103 + 28f7d51 commit 387d1b5
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 25 deletions.
10 changes: 6 additions & 4 deletions ssqc/client.qc
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ static float NB_UseMinPing() {
return TRUE;
}

void ActivateNewBalance() {
void ActivateOrgGame() {
disable_resup_gren = 2; // No gren2 pickups

drop_gren1 = 0; // No grenades in backpacks
Expand Down Expand Up @@ -383,6 +383,7 @@ void () DecodeLevelParms = {
duelmode = CF_GetSetting("duelmode", "duelmode", "off");

disable_voting = clanbattle || quadmode;
org_game = clanbattle || quadmode;

rounds = CF_GetSetting("rounds","rounds","on");
if (!rounds)
Expand Down Expand Up @@ -1093,11 +1094,12 @@ void () DecodeLevelParms = {

// Overrides other settings.
new_balance = CF_GetSetting("new_balance", "new_balance", "1");

// mirror current state into desired state bit
new_balance |= (new_balance << 1);
if (NewBalanceActive())
ActivateNewBalance();

if (org_game) // This used to depend on new balance
ActivateOrgGame();

};

entity() FindIntermission =
Expand Down
5 changes: 4 additions & 1 deletion ssqc/commands.qc
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,10 @@ float (string arg1, string arg2, string arg3) ParseCmds = {
break;
case "break":
processedCmd = TRUE;
if(self.vote_map) {

if (disable_voting) {
// Do nothing
} else if (self.vote_map) {
UnvoteForMap(self);
} else {
if(votemode) {
Expand Down
48 changes: 31 additions & 17 deletions ssqc/engineer.qc
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,33 @@ void () CheckDistance = {
self.nextthink = time + 0.3;
};

float IsEngEnt(entity ent) {
return ent.classname == "building_dispenser" ||
ent.classname == "building_sentrygun";

}

void RemoveEngEnt(entity bld, float explode) {
entity owner = bld.real_owner;
if (owner.building == bld) {
Menu_Close(owner);
owner.building = world;
}

if (explode) {
TF_T_Damage(bld, world, world, 500, 0, 0);
} else {
if(bld.classname == "building_dispenser")
owner.has_dispenser = 0;
if(bld.classname == "building_sentrygun") {
owner.has_sentry = 0;
if (bld.trigger_field != world)
dremove (bld.trigger_field);
}
dremove (bld);
}
}

void (entity eng, string bld, float explode) DestroyBuildingWithOptions = {
local entity te;
local entity oldself;
Expand All @@ -1593,23 +1620,10 @@ void (entity eng, string bld, float explode) DestroyBuildingWithOptions = {
bound_other_ammo(self);
self = oldself;
}
if (te.real_owner.building == te) {
Menu_Close(te.real_owner);
te.real_owner.building = world;
}
if(explode) {
TF_T_Damage(te, world, world, 500, 0, 0);
} else {
if(bld == "building_dispenser")
te.real_owner.has_dispenser = 0;
if(bld == "building_sentrygun") {
te.real_owner.has_sentry = 0;
if (te.trigger_field != world)
dremove (te.trigger_field);
}
spawn_tfog(te.origin);
dremove (te);
}

spawn_tfog(te.origin);
RemoveEngEnt(te, explode);

}
te = find(te, classname, bld);
}
Expand Down
1 change: 1 addition & 0 deletions ssqc/progs.src
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ events.qc
roles.qc
q3defs.qc
status.qc
teamplay.qc
functions.qc
menu.qc
csmenu.qc
Expand Down
1 change: 1 addition & 0 deletions ssqc/qw.qc
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ float clanbattle;
float clan_scores_dumped;
float cb_prematch;
float disable_voting;
float org_game;
float v_break;
float v_ready;
.float allowvote;
Expand Down
94 changes: 94 additions & 0 deletions ssqc/teamplay.qc
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
static void Apply(entity* targets, int tcount, int(entity) filter_fn,
void(entity) apply_fn) {
for (int i = 0; i < tcount; i++)
if (filter_fn(targets[i]))
apply_fn(targets[i]);
}

static entity EntityOwner(entity e) {
if (e.real_owner != world)
return e.real_owner;
else
return e.owner;
}

static void ApplyList(entity* targets, int count,
int(entity) player_filter_fn, void(entity) player_apply_fn,
int(entity) other_filter_fn, void(entity) other_apply_fn) {
for (int i = 0; i < count; i++) {
entity e = targets[i];

if (e.classname == "player") {
if (player_filter_fn(e))
player_apply_fn(e);
} else if (EntityOwner(e).classname == "player") {
if (other_filter_fn(e))
other_apply_fn(e);
}
}
}

static void ApplyRadius(vector org, float rad,
int(entity) player_filter_fn, void(entity) player_apply_fn,
int(entity) other_filter_fn, void(entity) other_apply_fn) {
int count;
entity* ents = findradius_list(org, rad, count);
ApplyList(ents, count,
player_filter_fn, player_apply_fn, other_filter_fn, other_apply_fn);
}

static void EffStrip(entity player) {
player.ammo_cells = 0;
player.ammo_rockets = 0;
player.ammo_shells = 0;
player.ammo_nails = 0;

player.no_grenades_1 = player.no_grenades_2 = 0;
player.current_slot = player.queue_slot = MakeSlot(4);
}

float IsEngEnt(entity ent);
void RemoveEngEnt(entity bld, float explode);

static void EffRemove(entity non_player) {
if (non_player.classname == "player") {
printf("ERROR! Tried to remove player [%s]\n", non_player.netname);
return;
}

pointparticles(particleeffectnum("fo_airblast"), non_player.origin);
if (IsEngEnt(non_player))
RemoveEngEnt(non_player, FALSE);
else
dremove(non_player);
}

static int(entity p) FilTeamEQ[] = {
{ return p.team_no == 1; },
{ return p.team_no == 2; },
{ return p.team_no == 3; },
{ return p.team_no == 4; },
};

static int(entity p) FilTeamNEQ[] = {
{ return p.team_no != 1; },
{ return p.team_no != 2; },
{ return p.team_no != 3; },
{ return p.team_no != 4; },
};

static int(entity p) FilOwnerTeamNEQ[] = {
{ return EntityOwner(p).team_no != 1; },
{ return EntityOwner(p).team_no != 2; },
{ return EntityOwner(p).team_no != 3; },
{ return EntityOwner(p).team_no != 4; },
};

void TeamPlay_Cap(vector origin, entity player) {
if (!org_game || !new_balance)
return;

ApplyRadius(origin, 1500,
FilTeamNEQ[player.team_no - 1], EffStrip,
FilOwnerTeamNEQ[player.team_no - 1], EffRemove);
}
7 changes: 4 additions & 3 deletions ssqc/tfort.qc
Original file line number Diff line number Diff line change
Expand Up @@ -2045,11 +2045,12 @@ void (float Suicided) TeamFortress_SetupRespawn = {
if (Suicided) {
if (self.lives > 0)
self.lives = self.lives - 1;
if(!allowpracspawns)
restime = restime + 7;

if (!allowpracspawns)
restime = restime + (new_balance ? 4 : 7);
}
}

if (cb_prematch) {
if (self.lives > 0)
self.lives = self.lives - 1;
Expand Down
2 changes: 2 additions & 0 deletions ssqc/tfortmap.qc
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,8 @@ void (entity Goal, entity Player, entity AP, float addb) Apply_Results = {

if (stock_on_cap) {
if (Player == AP) {
TeamPlay_Cap(AP.origin, AP);

if (Player.health > 0) {
T_Heal(Player, Player.max_health, 0);
Player.armortype = Player.armor_allowed;
Expand Down

0 comments on commit 387d1b5

Please sign in to comment.