X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmutators%2Fmutator%2Fgamemode_ca.qc;h=209c8b85673b09a587379821121c72fe69daf7ca;hb=a28262196252bb70222525b589104054806b2c0a;hp=2a8da29c275210b8646a31ba08bae7a0a6bc3d1f;hpb=fc15d72b041c9a748b605ba28735380fbe5b5b01;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/mutators/mutator/gamemode_ca.qc b/qcsrc/server/mutators/mutator/gamemode_ca.qc index 2a8da29c2..209c8b856 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ca.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ca.qc @@ -36,7 +36,15 @@ REGISTER_MUTATOR(ca, false) if (ca_teams < 2) ca_teams = autocvar_g_ca_teams; ca_teams = bound(2, ca_teams, 4); - ScoreRules_basics(ca_teams, SFL_SORT_PRIO_PRIMARY, 0, true); + int teams = 0; + if(ca_teams >= 1) teams |= BIT(0); + if(ca_teams >= 2) teams |= BIT(1); + if(ca_teams >= 3) teams |= BIT(2); + if(ca_teams >= 4) teams |= BIT(3); + + ca_teams = teams; // now set it? + + ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, true); ScoreInfo_SetLabel_TeamScore(ST_CA_ROUNDS, "rounds", SFL_SORT_PRIO_PRIMARY); ScoreRules_basics_end(); @@ -117,7 +125,7 @@ float CA_GetWinnerTeam() void nades_Clear(entity player); #define CA_ALIVE_TEAMS() ((redalive > 0) + (bluealive > 0) + (yellowalive > 0) + (pinkalive > 0)) -#define CA_ALIVE_TEAMS_OK() (CA_ALIVE_TEAMS() == ca_teams) +#define CA_ALIVE_TEAMS_OK() (CA_ALIVE_TEAMS() == NumTeams(ca_teams)) float CA_CheckWinner() { if(round_handler_GetEndTime() > 0 && round_handler_GetEndTime() - time <= 0) @@ -179,9 +187,15 @@ bool CA_CheckTeams() prev_missing_teams_mask = -1; return false; } - int missing_teams_mask = (!redalive) + (!bluealive) * 2; - if(ca_teams >= 3) missing_teams_mask += (!yellowalive) * 4; - if(ca_teams >= 4) missing_teams_mask += (!pinkalive) * 8; + int missing_teams_mask = 0; + if(ca_teams & BIT(0)) + missing_teams_mask += (!redalive) * 1; + if(ca_teams & BIT(1)) + missing_teams_mask += (!bluealive) * 2; + if(ca_teams & BIT(2)) + missing_teams_mask += (!yellowalive) * 4; + if(ca_teams & BIT(3)) + missing_teams_mask += (!pinkalive) * 8; if(prev_missing_teams_mask != missing_teams_mask) { Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_MISSING_TEAMS, missing_teams_mask); @@ -307,7 +321,7 @@ void ca_LastPlayerForTeam_Notify(entity this) MUTATOR_HOOKFUNCTION(ca, PlayerDies) { entity frag_target = M_ARGV(2, entity); - + ca_LastPlayerForTeam_Notify(frag_target); if (!allowed_to_spawn) frag_target.respawn_flags = RESPAWN_SILENT; @@ -340,6 +354,8 @@ MUTATOR_HOOKFUNCTION(ca, MakePlayerObserver) player.caplayer = 0; if (player.caplayer) player.frags = FRAGS_LMS_LOSER; + else + player.frags = FRAGS_SPECTATOR; if (!warmup_stage) eliminatedPlayers.SendFlags |= 1; return true; // prevent team reset @@ -439,11 +455,11 @@ MUTATOR_HOOKFUNCTION(ca, SpectateSet) MUTATOR_HOOKFUNCTION(ca, SpectateNext) { entity client = M_ARGV(0, entity); - entity targ = M_ARGV(1, entity); if (!autocvar_g_ca_spectate_enemies && client.caplayer) { - targ = CA_SpectateNext(client, targ); + entity targ = M_ARGV(1, entity); + M_ARGV(1, entity) = CA_SpectateNext(client, targ); return true; } } @@ -468,6 +484,8 @@ MUTATOR_HOOKFUNCTION(ca, SpectatePrev) } } + M_ARGV(1, entity) = targ; + return MUT_SPECPREV_FOUND; }