Skip to content

Commit 1101254

Browse files
committed
Update plasma gun frame ranges and reformat comments
Corrected the frame ranges for the plasma gun animation in p_weapon.cpp to match the actual model frames and updated the comment for clarity. No functional changes were made to Tournament_ReplayGame in match_state.cpp; only code formatting was adjusted.
1 parent d93f577 commit 1101254

File tree

2 files changed

+87
-85
lines changed

2 files changed

+87
-85
lines changed

src/server/match/match_state.cpp

Lines changed: 78 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -504,83 +504,6 @@ void TournamentRecordTeamWin(Team team) {
504504
game.tournament.seriesComplete = true;
505505
}
506506

507-
bool Tournament_ReplayGame(int gameNumber, std::string &message) {
508-
if (!Tournament_IsActive()) {
509-
message = "Tournament mode is not active.";
510-
return false;
511-
}
512-
513-
if (gameNumber < 1) {
514-
message = "Replay game number must be at least 1.";
515-
return false;
516-
}
517-
518-
if (game.tournament.mapOrder.empty()) {
519-
message = "Tournament map order is not locked yet.";
520-
return false;
521-
}
522-
523-
const size_t targetIndex = static_cast<size_t>(gameNumber - 1);
524-
if (targetIndex >= game.tournament.mapOrder.size()) {
525-
message =
526-
G_Fmt("Replay game must be between 1 and {}.",
527-
game.tournament.mapOrder.size())
528-
.data();
529-
return false;
530-
}
531-
532-
TournamentEnsureStateForMatch();
533-
if (!game.tournament.active) {
534-
message = "Tournament state is not active.";
535-
return false;
536-
}
537-
538-
game.tournament.seriesComplete = false;
539-
game.tournament.gamesPlayed = 0;
540-
game.tournament.teamWins.fill(0);
541-
game.tournament.playerWins.fill(0);
542-
543-
const size_t available = std::min(targetIndex, game.tournament.matchWinners.size());
544-
for (size_t i = 0; i < available; ++i) {
545-
const std::string &winner = game.tournament.matchWinners[i];
546-
if (game.tournament.teamBased) {
547-
if (winner == "red") {
548-
game.tournament.teamWins[static_cast<size_t>(Team::Red)] += 1;
549-
} else if (winner == "blue") {
550-
game.tournament.teamWins[static_cast<size_t>(Team::Blue)] += 1;
551-
}
552-
} else if (!winner.empty()) {
553-
const size_t slot = TournamentFindOrAssignPlayerSlotById(winner, {});
554-
if (slot != kTournamentInvalidSlot) {
555-
game.tournament.playerWins[slot] += 1;
556-
}
557-
}
558-
game.tournament.gamesPlayed += 1;
559-
}
560-
561-
if (game.tournament.matchWinners.size() > targetIndex)
562-
game.tournament.matchWinners.resize(targetIndex);
563-
if (game.tournament.matchIds.size() > targetIndex)
564-
game.tournament.matchIds.resize(targetIndex);
565-
if (game.tournament.matchMaps.size() > targetIndex)
566-
game.tournament.matchMaps.resize(targetIndex);
567-
568-
game.tournament.gamesPlayed = static_cast<int>(targetIndex);
569-
game.tournament.seriesComplete = false;
570-
571-
const std::string &mapName = game.tournament.mapOrder[targetIndex];
572-
if (mapName.empty()) {
573-
message = "Replay map is missing.";
574-
return false;
575-
}
576-
577-
gi.LocBroadcast_Print(PRINT_CENTER,
578-
".Tournament replay: game {} will be replayed.",
579-
gameNumber);
580-
gi.AddCommandString(G_Fmt("gamemap {}\n", mapName).data());
581-
return true;
582-
}
583-
584507
int TournamentBestOpponentWins(size_t winnerSlot) {
585508
int best = 0;
586509
for (size_t i = 0; i < game.maxClients; ++i) {
@@ -687,6 +610,84 @@ void QueueTournamentIntermission(std::string_view baseMessage,
687610

688611
} // namespace
689612

613+
bool Tournament_ReplayGame(int gameNumber, std::string &message) {
614+
if (!Tournament_IsActive()) {
615+
message = "Tournament mode is not active.";
616+
return false;
617+
}
618+
619+
if (gameNumber < 1) {
620+
message = "Replay game number must be at least 1.";
621+
return false;
622+
}
623+
624+
if (game.tournament.mapOrder.empty()) {
625+
message = "Tournament map order is not locked yet.";
626+
return false;
627+
}
628+
629+
const size_t targetIndex = static_cast<size_t>(gameNumber - 1);
630+
if (targetIndex >= game.tournament.mapOrder.size()) {
631+
message =
632+
G_Fmt("Replay game must be between 1 and {}.",
633+
game.tournament.mapOrder.size())
634+
.data();
635+
return false;
636+
}
637+
638+
TournamentEnsureStateForMatch();
639+
if (!game.tournament.active) {
640+
message = "Tournament state is not active.";
641+
return false;
642+
}
643+
644+
game.tournament.seriesComplete = false;
645+
game.tournament.gamesPlayed = 0;
646+
game.tournament.teamWins.fill(0);
647+
game.tournament.playerWins.fill(0);
648+
649+
const size_t available =
650+
std::min(targetIndex, game.tournament.matchWinners.size());
651+
for (size_t i = 0; i < available; ++i) {
652+
const std::string &winner = game.tournament.matchWinners[i];
653+
if (game.tournament.teamBased) {
654+
if (winner == "red") {
655+
game.tournament.teamWins[static_cast<size_t>(Team::Red)] += 1;
656+
} else if (winner == "blue") {
657+
game.tournament.teamWins[static_cast<size_t>(Team::Blue)] += 1;
658+
}
659+
} else if (!winner.empty()) {
660+
const size_t slot = TournamentFindOrAssignPlayerSlotById(winner, {});
661+
if (slot != kTournamentInvalidSlot) {
662+
game.tournament.playerWins[slot] += 1;
663+
}
664+
}
665+
game.tournament.gamesPlayed += 1;
666+
}
667+
668+
if (game.tournament.matchWinners.size() > targetIndex)
669+
game.tournament.matchWinners.resize(targetIndex);
670+
if (game.tournament.matchIds.size() > targetIndex)
671+
game.tournament.matchIds.resize(targetIndex);
672+
if (game.tournament.matchMaps.size() > targetIndex)
673+
game.tournament.matchMaps.resize(targetIndex);
674+
675+
game.tournament.gamesPlayed = static_cast<int>(targetIndex);
676+
game.tournament.seriesComplete = false;
677+
678+
const std::string &mapName = game.tournament.mapOrder[targetIndex];
679+
if (mapName.empty()) {
680+
message = "Replay map is missing.";
681+
return false;
682+
}
683+
684+
gi.LocBroadcast_Print(PRINT_CENTER,
685+
".Tournament replay: game {} will be replayed.",
686+
gameNumber);
687+
gi.AddCommandString(G_Fmt("gamemap {}\n", mapName).data());
688+
return true;
689+
}
690+
690691
void Marathon_RegisterClientBaseline(gclient_t *cl) {
691692
if (!cl || !game.marathon.active)
692693
return;

src/server/player/p_weapon.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3139,14 +3139,15 @@ PLASMA GUN
31393139
======================================================================
31403140
*/
31413141

3142-
// v_plasmr.md2 has 52 frames (0..51)
3143-
constexpr int PLASMAGUN_FRAME_ACTIVATE_LAST = 7;
3144-
constexpr int PLASMAGUN_FRAME_FIRE_FIRST = 8;
3145-
constexpr int PLASMAGUN_FRAME_FIRE_LAST = 19;
3146-
constexpr int PLASMAGUN_FRAME_IDLE_FIRST = 20;
3147-
constexpr int PLASMAGUN_FRAME_IDLE_LAST = 45;
3148-
constexpr int PLASMAGUN_FRAME_DEACTIVATE_FIRST = 42;
3149-
constexpr int PLASMAGUN_FRAME_DEACTIVATE_LAST = 45;
3142+
// v_plasmr.md2 has 52 frames (0..51): activate 0-8, fire 9-42, idle 43-49,
3143+
// deactivate 50-51.
3144+
constexpr int PLASMAGUN_FRAME_ACTIVATE_LAST = 8;
3145+
constexpr int PLASMAGUN_FRAME_FIRE_FIRST = 9;
3146+
constexpr int PLASMAGUN_FRAME_FIRE_LAST = 42;
3147+
constexpr int PLASMAGUN_FRAME_IDLE_FIRST = 43;
3148+
constexpr int PLASMAGUN_FRAME_IDLE_LAST = 49;
3149+
constexpr int PLASMAGUN_FRAME_DEACTIVATE_FIRST = 50;
3150+
constexpr int PLASMAGUN_FRAME_DEACTIVATE_LAST = 51;
31503151

31513152
static void Weapon_PlasmaGun_Fire(gentity_t *ent) {
31523153
if (!ent || !ent->client)

0 commit comments

Comments
 (0)