Skip to content

Commit

Permalink
Unification of score limits across all modules. (#168)
Browse files Browse the repository at this point in the history
* All score limits unified across all modules

* Update CHANGELOG.md
  • Loading branch information
NeonKnightOA authored Mar 12, 2024
1 parent c2c79e9 commit 1f66bfb
Show file tree
Hide file tree
Showing 6 changed files with 153 additions and 60 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@

**Release date:** TBA

* Unified score limits across all modules. The default limits are now as follows:
* Free For All: 20 frags, 0 minutes.
* Tournament: 0 frags, 15 minutes.
* Single-Player: 10 frags, 0 minutes.
* Team Deathmatch: 0 frags, 20 minutes.
* Capture the Flag: 8 flags, 30 minutes.
* One Flag CTF: 8 flags, 30 minutes.
* Overload: 8 obelisk destructions, 30 minutes.
* Harvester: 20 skulls, 30 minutes.
* Elimination: 8 rounds won, 20 minutes.
* CTF Elimination: 8 rounds won, 30 minutes.
* Last Man Standing: 20 rounds won, 0 minutes.
* Double Domination: 8 rounds won, 30 minutes.
* Domination: 500 points, 30 minutes.
* Possession: 120 flag-holding seconds (2 minutes), 20 minutes.
* Fix: Sound bug in cg_playerstate.c where flag taken messages played in non-flag-based gametypes. Also modified a condition in the fraglimit warnings.
* AI enhancement: Holdable item (Teleporter/Medkit/Kamikaze/Invulnerability) handling improvements.
* AI enhancement: Double Domination bot logic improved (team formations, voice orders, voice speech support)
Expand Down
29 changes: 29 additions & 0 deletions code/game/bg_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,35 @@ typedef enum {
#define GAMETYPE_IS_ROUND_BASED(gametype) (gametype == GT_ELIMINATION || gametype == GT_CTF_ELIMINATION || gametype == GT_LMS)
#define GAMETYPE_USES_OBELISKS(gametype) (gametype == GT_HARVESTER || gametype == GT_OBELISK)

#define GT_FFA_DEFAULT_SCORELIMIT "20"
#define GT_FFA_DEFAULT_TIMELIMIT "0"
#define GT_TOURNEY_DEFAULT_SCORELIMIT "0"
#define GT_TOURNEY_DEFAULT_TIMELIMIT "15"
#define GT_SINGLE_DEFAULT_SCORELIMIT "10"
#define GT_SINGLE_DEFAULT_TIMELIMIT "0"
#define GT_TEAM_DEFAULT_SCORELIMIT "0"
#define GT_TEAM_DEFAULT_TIMELIMIT "20"
#define GT_CTF_DEFAULT_SCORELIMIT "8"
#define GT_CTF_DEFAULT_TIMELIMIT "30"
#define GT_1FCTF_DEFAULT_SCORELIMIT "8"
#define GT_1FCTF_DEFAULT_TIMELIMIT "30"
#define GT_OBELISK_DEFAULT_SCORELIMIT "8"
#define GT_OBELISK_DEFAULT_TIMELIMIT "30"
#define GT_HARVESTER_DEFAULT_SCORELIMIT "20"
#define GT_HARVESTER_DEFAULT_TIMELIMIT "30"
#define GT_ELIMINATION_DEFAULT_SCORELIMIT "8"
#define GT_ELIMINATION_DEFAULT_TIMELIMIT "20"
#define GT_CTF_ELIMINATION_DEFAULT_SCORELIMIT "8"
#define GT_CTF_ELIMINATION_DEFAULT_TIMELIMIT "30"
#define GT_LMS_DEFAULT_SCORELIMIT "20"
#define GT_LMS_DEFAULT_TIMELIMIT "0"
#define GT_DOUBLE_D_DEFAULT_SCORELIMIT "8"
#define GT_DOUBLE_D_DEFAULT_TIMELIMIT "30"
#define GT_DOMINATION_DEFAULT_SCORELIMIT "500"
#define GT_DOMINATION_DEFAULT_TIMELIMIT "30"
#define GT_POSSESSION_DEFAULT_SCORELIMIT "120"
#define GT_POSSESSION_DEFAULT_TIMELIMIT "20"

typedef enum { GENDER_MALE, GENDER_FEMALE, GENDER_NEUTER } gender_t;

/*
Expand Down
4 changes: 2 additions & 2 deletions code/game/g_bot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1050,8 +1050,8 @@ void G_InitBots( qboolean restart ) {
}

if ( !fragLimit && !timeLimit ) {
trap_Cvar_Set( "fraglimit", "10" );
trap_Cvar_Set( "timelimit", "0" );
trap_Cvar_Set( "fraglimit", GT_SINGLE_DEFAULT_SCORELIMIT );
trap_Cvar_Set( "timelimit", GT_SINGLE_DEFAULT_TIMELIMIT );
}

basedelay = BOT_BEGIN_DELAY_BASE;
Expand Down
6 changes: 3 additions & 3 deletions code/game/g_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ static cvarTable_t gameCvarTable[] = {
{ &g_videoflags, "videoflags", "7", CVAR_SERVERINFO | CVAR_ARCHIVE, 0, qtrue },
{ &g_elimflags, "elimflags", "0", CVAR_SERVERINFO, 0, qfalse },
{ &g_voteflags, "voteflags", "0", CVAR_SERVERINFO, 0, qfalse },
{ &g_fraglimit, "fraglimit", "20", CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_NORESTART, 0, qtrue },
{ &g_timelimit, "timelimit", "0", CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_NORESTART, 0, qtrue },
{ &g_capturelimit, "capturelimit", "8", CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_NORESTART, 0, qtrue },
{ &g_fraglimit, "fraglimit", GT_FFA_DEFAULT_SCORELIMIT, CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_NORESTART, 0, qtrue },
{ &g_timelimit, "timelimit", GT_FFA_DEFAULT_TIMELIMIT, CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_NORESTART, 0, qtrue },
{ &g_capturelimit, "capturelimit", GT_CTF_DEFAULT_SCORELIMIT, CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_NORESTART, 0, qtrue },

{ &g_synchronousClients, "g_synchronousClients", "0", CVAR_SYSTEMINFO, 0, qfalse },

Expand Down
52 changes: 26 additions & 26 deletions code/q3_ui/ui_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,51 +178,51 @@ vmCvar_t ui_browserHidePrivate;

// bk001129 - made static to avoid aliasing.
static cvarTable_t cvarTable[] = {
{ &ui_ffa_fraglimit, "ui_ffa_fraglimit", "20", CVAR_ARCHIVE },
{ &ui_ffa_timelimit, "ui_ffa_timelimit", "0", CVAR_ARCHIVE },
{ &ui_ffa_fraglimit, "ui_ffa_fraglimit", GT_FFA_DEFAULT_SCORELIMIT, CVAR_ARCHIVE },
{ &ui_ffa_timelimit, "ui_ffa_timelimit", GT_FFA_DEFAULT_TIMELIMIT, CVAR_ARCHIVE },

{ &ui_tourney_fraglimit, "ui_tourney_fraglimit", "0", CVAR_ARCHIVE },
{ &ui_tourney_timelimit, "ui_tourney_timelimit", "15", CVAR_ARCHIVE },
{ &ui_tourney_fraglimit, "ui_tourney_fraglimit", GT_TOURNEY_DEFAULT_SCORELIMIT, CVAR_ARCHIVE },
{ &ui_tourney_timelimit, "ui_tourney_timelimit", GT_TOURNEY_DEFAULT_TIMELIMIT, CVAR_ARCHIVE },

{ &ui_team_fraglimit, "ui_team_fraglimit", "0", CVAR_ARCHIVE },
{ &ui_team_timelimit, "ui_team_timelimit", "20", CVAR_ARCHIVE },
{ &ui_team_fraglimit, "ui_team_fraglimit", GT_TEAM_DEFAULT_SCORELIMIT, CVAR_ARCHIVE },
{ &ui_team_timelimit, "ui_team_timelimit", GT_TEAM_DEFAULT_TIMELIMIT, CVAR_ARCHIVE },
{ &ui_team_friendly, "ui_team_friendly", "1", CVAR_ARCHIVE },

{ &ui_ctf_capturelimit, "ui_ctf_capturelimit", "8", CVAR_ARCHIVE },
{ &ui_ctf_timelimit, "ui_ctf_timelimit", "30", CVAR_ARCHIVE },
{ &ui_ctf_capturelimit, "ui_ctf_capturelimit", GT_CTF_DEFAULT_SCORELIMIT, CVAR_ARCHIVE },
{ &ui_ctf_timelimit, "ui_ctf_timelimit", GT_CTF_DEFAULT_TIMELIMIT, CVAR_ARCHIVE },
{ &ui_ctf_friendly, "ui_ctf_friendly", "0", CVAR_ARCHIVE },

{ &ui_1fctf_capturelimit, "ui_1fctf_capturelimit", "8", CVAR_ARCHIVE },
{ &ui_1fctf_timelimit, "ui_1fctf_timelimit", "30", CVAR_ARCHIVE },
{ &ui_1fctf_capturelimit, "ui_1fctf_capturelimit", GT_1FCTF_DEFAULT_SCORELIMIT, CVAR_ARCHIVE },
{ &ui_1fctf_timelimit, "ui_1fctf_timelimit", GT_1FCTF_DEFAULT_TIMELIMIT, CVAR_ARCHIVE },
{ &ui_1fctf_friendly, "ui_1fctf_friendly", "0", CVAR_ARCHIVE },

{ &ui_overload_capturelimit, "ui_overload_capturelimit", "8", CVAR_ARCHIVE },
{ &ui_overload_timelimit, "ui_overload_timelimit", "30", CVAR_ARCHIVE },
{ &ui_overload_capturelimit, "ui_overload_capturelimit", GT_OBELISK_DEFAULT_SCORELIMIT, CVAR_ARCHIVE },
{ &ui_overload_timelimit, "ui_overload_timelimit", GT_OBELISK_DEFAULT_TIMELIMIT, CVAR_ARCHIVE },
{ &ui_overload_friendly, "ui_overload_friendly", "0", CVAR_ARCHIVE },

{ &ui_harvester_capturelimit, "ui_harvester_capturelimit", "20", CVAR_ARCHIVE },
{ &ui_harvester_timelimit, "ui_harvester_timelimit", "30", CVAR_ARCHIVE },
{ &ui_harvester_capturelimit, "ui_harvester_capturelimit", GT_HARVESTER_DEFAULT_SCORELIMIT, CVAR_ARCHIVE },
{ &ui_harvester_timelimit, "ui_harvester_timelimit", GT_HARVESTER_DEFAULT_TIMELIMIT, CVAR_ARCHIVE },
{ &ui_harvester_friendly, "ui_harvester_friendly", "0", CVAR_ARCHIVE },

{ &ui_elimination_capturelimit, "ui_elimination_capturelimit", "8", CVAR_ARCHIVE },
{ &ui_elimination_timelimit, "ui_elimination_timelimit", "20", CVAR_ARCHIVE },
{ &ui_elimination_capturelimit, "ui_elimination_capturelimit", GT_ELIMINATION_DEFAULT_SCORELIMIT, CVAR_ARCHIVE },
{ &ui_elimination_timelimit, "ui_elimination_timelimit", GT_ELIMINATION_DEFAULT_TIMELIMIT, CVAR_ARCHIVE },

{ &ui_ctf_elimination_capturelimit, "ui_ctf_elimination_capturelimit", "8", CVAR_ARCHIVE },
{ &ui_ctf_elimination_timelimit, "ui_ctf_elimination_timelimit", "30", CVAR_ARCHIVE },
{ &ui_ctf_elimination_capturelimit, "ui_ctf_elimination_capturelimit", GT_CTF_ELIMINATION_DEFAULT_SCORELIMIT, CVAR_ARCHIVE },
{ &ui_ctf_elimination_timelimit, "ui_ctf_elimination_timelimit", GT_CTF_ELIMINATION_DEFAULT_TIMELIMIT, CVAR_ARCHIVE },

{ &ui_lms_fraglimit, "ui_lms_fraglimit", "20", CVAR_ARCHIVE },
{ &ui_lms_timelimit, "ui_lms_timelimit", "0", CVAR_ARCHIVE },
{ &ui_lms_fraglimit, "ui_lms_fraglimit", GT_LMS_DEFAULT_SCORELIMIT, CVAR_ARCHIVE },
{ &ui_lms_timelimit, "ui_lms_timelimit", GT_LMS_DEFAULT_TIMELIMIT, CVAR_ARCHIVE },

{ &ui_dd_capturelimit, "ui_dd_capturelimit", "8", CVAR_ARCHIVE },
{ &ui_dd_timelimit, "ui_dd_timelimit", "30", CVAR_ARCHIVE },
{ &ui_dd_capturelimit, "ui_dd_capturelimit", GT_DOUBLE_D_DEFAULT_SCORELIMIT, CVAR_ARCHIVE },
{ &ui_dd_timelimit, "ui_dd_timelimit", GT_DOUBLE_D_DEFAULT_TIMELIMIT, CVAR_ARCHIVE },
{ &ui_dd_friendly, "ui_dd_friendly", "0", CVAR_ARCHIVE },

{ &ui_dom_capturelimit, "ui_dom_capturelimit", "500", CVAR_ARCHIVE },
{ &ui_dom_timelimit, "ui_dom_timelimit", "30", CVAR_ARCHIVE },
{ &ui_dom_capturelimit, "ui_dom_capturelimit", GT_DOMINATION_DEFAULT_SCORELIMIT, CVAR_ARCHIVE },
{ &ui_dom_timelimit, "ui_dom_timelimit", GT_DOMINATION_DEFAULT_TIMELIMIT, CVAR_ARCHIVE },
{ &ui_dom_friendly, "ui_dom_friendly", "0", CVAR_ARCHIVE },

{ &ui_pos_scorelimit, "ui_pos_scorelimit", "120", CVAR_ARCHIVE },
{ &ui_pos_timelimit, "ui_pos_timelimit", "20", CVAR_ARCHIVE },
{ &ui_pos_scorelimit, "ui_pos_scorelimit", GT_POSSESSION_DEFAULT_SCORELIMIT, CVAR_ARCHIVE },
{ &ui_pos_timelimit, "ui_pos_timelimit", GT_POSSESSION_DEFAULT_TIMELIMIT, CVAR_ARCHIVE },

{ &ui_arenasFile, "g_arenasFile", "", CVAR_INIT|CVAR_ROM },
{ &ui_botsFile, "g_botsFile", "", CVAR_INIT|CVAR_ROM },
Expand Down
107 changes: 78 additions & 29 deletions code/ui/ui_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1422,36 +1422,85 @@ static void UI_DrawClanName(rectDef_t *rect, float scale, vec4_t color, int text

static void UI_SetCapFragLimits(qboolean uiVars)
{
int cap = 5;
int frag = 10;
if (uiVars) {
if (uiVars == qtrue) {
trap_Cvar_Set("ui_captureLimit", va("%d", cap));
trap_Cvar_Set("ui_fragLimit", va("%d", frag));
}
else if (uiVars == qfalse) {
trap_Cvar_Set("capturelimit", va("%d", cap));
trap_Cvar_Set("fraglimit", va("%d", frag));
}
char *capLimit;
char *fragLimit;
char *timeLimit;
switch (uiInfo.gameTypes[ui_gameType.integer].gtEnum) {
case GT_FFA:
fragLimit = GT_FFA_DEFAULT_SCORELIMIT;
capLimit = "0";
timeLimit = GT_FFA_DEFAULT_TIMELIMIT;
break;
case GT_TOURNAMENT:
fragLimit = GT_TOURNEY_DEFAULT_SCORELIMIT;
capLimit = "0";
timeLimit = GT_TOURNEY_DEFAULT_TIMELIMIT;
break;
case GT_TEAM:
fragLimit = GT_TEAM_DEFAULT_SCORELIMIT;
capLimit = "0";
timeLimit = GT_TEAM_DEFAULT_TIMELIMIT;
break;
case GT_CTF:
fragLimit = "0";
capLimit = GT_CTF_DEFAULT_SCORELIMIT;
timeLimit = GT_CTF_DEFAULT_TIMELIMIT;
break;
case GT_1FCTF:
fragLimit = "0";
capLimit = GT_1FCTF_DEFAULT_SCORELIMIT;
timeLimit = GT_1FCTF_DEFAULT_TIMELIMIT;
break;
case GT_OBELISK:
fragLimit = "0";
capLimit = GT_OBELISK_DEFAULT_SCORELIMIT;
timeLimit = GT_OBELISK_DEFAULT_TIMELIMIT;
break;
case GT_HARVESTER:
fragLimit = "0";
capLimit = GT_HARVESTER_DEFAULT_SCORELIMIT;
timeLimit = GT_HARVESTER_DEFAULT_TIMELIMIT;
break;
case GT_ELIMINATION:
fragLimit = "0";
capLimit = GT_ELIMINATION_DEFAULT_SCORELIMIT;
timeLimit = GT_ELIMINATION_DEFAULT_TIMELIMIT;
break;
case GT_CTF_ELIMINATION:
fragLimit = "0";
capLimit = GT_CTF_ELIMINATION_DEFAULT_SCORELIMIT;
timeLimit = GT_CTF_ELIMINATION_DEFAULT_TIMELIMIT;
break;
case GT_LMS:
fragLimit = GT_LMS_DEFAULT_SCORELIMIT;
capLimit = "0";
timeLimit = GT_LMS_DEFAULT_TIMELIMIT;
break;
case GT_DOUBLE_D:
fragLimit = "0";
capLimit = GT_DOUBLE_D_DEFAULT_SCORELIMIT;
timeLimit = GT_DOUBLE_D_DEFAULT_TIMELIMIT;
break;
case GT_DOMINATION:
fragLimit = "0";
capLimit = GT_DOMINATION_DEFAULT_SCORELIMIT;
timeLimit = GT_DOMINATION_DEFAULT_TIMELIMIT;
break;
case GT_POSSESSION:
fragLimit = GT_POSSESSION_DEFAULT_SCORELIMIT;
capLimit = "0";
timeLimit = GT_POSSESSION_DEFAULT_TIMELIMIT;
break;
}
else
{
if (uiInfo.gameTypes[ui_gameType.integer].gtEnum == GT_OBELISK) {
cap = 4;
frag = 0;
}
else if (uiInfo.gameTypes[ui_gameType.integer].gtEnum == GT_HARVESTER) {
cap = 15;
frag = 0;
}
else if (uiInfo.gameTypes[ui_gameType.integer].gtEnum == GT_DOMINATION) {
cap = 125;
frag = 0;
}
else if (uiInfo.gameTypes[ui_gameType.integer].gtEnum == GT_POSSESSION) {
frag = 125;
cap = 0;
}
if (uiVars == qtrue) {
trap_Cvar_Set("ui_captureLimit", capLimit);
trap_Cvar_Set("ui_fragLimit", fragLimit);
trap_Cvar_Set("ui_timeLimit", timeLimit);
}
else if (uiVars == qfalse) {
trap_Cvar_Set("capturelimit", capLimit);
trap_Cvar_Set("fraglimit", fragLimit);
trap_Cvar_Set("timelimit", timeLimit);
}
}
// ui_gameType assumes gametype 0 is -1 ALL and will not show
Expand Down

0 comments on commit 1f66bfb

Please sign in to comment.