Skip to content

Commit

Permalink
Post-refactor cleanup. (#180)
Browse files Browse the repository at this point in the history
* Post-refactor cleanup.

* Turns out this is the right way.

* Forgot about this one.

* And these two too.

* With this we also silence two warnings.
  • Loading branch information
NeonKnightOA authored Mar 13, 2024
1 parent 83bfc08 commit 01bf6ea
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 21 deletions.
6 changes: 3 additions & 3 deletions code/game/ai_team.c
Original file line number Diff line number Diff line change
Expand Up @@ -2137,7 +2137,7 @@ void BotDDorders_PointATaken(bot_state_t *bs) {
char name[MAX_NETNAME];
int pointADefenders=0;
int pointBTakers=0;
int roamers=0;
// int roamers=0;

if (bot_nochat.integer>2) return;

Expand Down Expand Up @@ -2176,7 +2176,7 @@ void BotDDorders_PointATaken(bot_state_t *bs) {
BotSayVoiceTeamOrder(bs, teammates[1], VOICECHAT_HOLDPOINTB);
}
case 3: {
// Two will pick a point and take it, the other will roam..
// Two will pick a point and take it, the other will roam.
ClientName(teammates[0], name, sizeof(name));
BotAI_BotInitialChat(bs, "cmd_holdpointa", name, NULL);
BotSayTeamOrder(bs, teammates[0]);
Expand Down Expand Up @@ -2296,7 +2296,7 @@ void BotDDorders_PointBTaken(bot_state_t *bs) {
char name[MAX_NETNAME];
int pointATakers=0;
int pointBDefenders=0;
int roamers=0;
// int roamers=0;

if (bot_nochat.integer>2) return;

Expand Down
18 changes: 12 additions & 6 deletions code/game/ai_vcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,18 +223,21 @@ void BotVoiceChat_Offense(bot_state_t *bs, int client, int mode) {
}
else if (gametype == GT_DOUBLE_D) {
if ((BotTeam(bs) == TEAM_RED && level.pointStatusA == TEAM_RED) ||
(BotTeam(bs) == TEAM_BLUE && level.pointStatusA == TEAM_BLUE))
(BotTeam(bs) == TEAM_BLUE && level.pointStatusA == TEAM_BLUE)) {
BotVoiceChat_HoldPointA(bs,client,mode);
}
else if ((BotTeam(bs) == TEAM_RED && level.pointStatusB == TEAM_RED) ||
(BotTeam(bs) == TEAM_BLUE && level.pointStatusB == TEAM_BLUE))
(BotTeam(bs) == TEAM_BLUE && level.pointStatusB == TEAM_BLUE)) {
BotVoiceChat_HoldPointB(bs,client,mode);
}
else if ((BotTeam(bs) == TEAM_RED && level.pointStatusA == TEAM_RED &&
level.pointStatusB == TEAM_RED) || (BotTeam(bs) == TEAM_BLUE &&
level.pointStatusA == TEAM_BLUE && level.pointStatusB == TEAM_BLUE))
level.pointStatusA == TEAM_BLUE && level.pointStatusB == TEAM_BLUE)) {
if (rand() % 10 > 5)
BotVoiceChat_HoldPointA(bs,client,mode);
else
BotVoiceChat_HoldPointB(bs,client,mode);
}
return;
}
else if (gametype == GT_DOMINATION) {
Expand Down Expand Up @@ -291,20 +294,23 @@ void BotVoiceChat_Defend(bot_state_t *bs, int client, int mode) {
else if (gametype == GT_DOUBLE_D) {
// If the point A is under control, defend it.
if ((BotTeam(bs) == TEAM_RED && level.pointStatusA == TEAM_RED) ||
(BotTeam(bs) == TEAM_BLUE && level.pointStatusA == TEAM_BLUE))
(BotTeam(bs) == TEAM_BLUE && level.pointStatusA == TEAM_BLUE)) {
BotVoiceChat_HoldPointA(bs,client,mode);
}
// If the point B is under control, defend it.
else if ((BotTeam(bs) == TEAM_RED && level.pointStatusB == TEAM_RED) ||
(BotTeam(bs) == TEAM_BLUE && level.pointStatusB == TEAM_BLUE))
(BotTeam(bs) == TEAM_BLUE && level.pointStatusB == TEAM_BLUE)) {
BotVoiceChat_HoldPointB(bs,client,mode);
}
// If both points are under control, pick one and defend it.
else if ((BotTeam(bs) == TEAM_RED && level.pointStatusA == TEAM_RED &&
level.pointStatusB == TEAM_RED) || (BotTeam(bs) == TEAM_BLUE &&
level.pointStatusA == TEAM_BLUE && level.pointStatusB == TEAM_BLUE))
level.pointStatusA == TEAM_BLUE && level.pointStatusB == TEAM_BLUE)) {
if (rand() % 10 > 5)
BotVoiceChat_HoldPointA(bs,client,mode);
else
BotVoiceChat_HoldPointB(bs,client,mode);
}
return;
}
else if (gametype == GT_DOMINATION) {
Expand Down
2 changes: 1 addition & 1 deletion code/ui/ui_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1321,6 +1321,6 @@ qboolean UI_IsATeamGametype(int check); /* Whether the gametype is team-based or
qboolean UI_UsesTeamFlags(int check); /* Whether the gametype uses the red and blue flags. */
qboolean UI_UsesTheWhiteFlag(int check); /* Whether the gametype uses the neutral flag. */
qboolean UI_IsARoundBasedGametype(int check); /* Whether the gametype uses the neutral flag. */
int UI_GetGametype(); /* Returns the current gametype */
int UI_GetGametype(void); /* Returns the current gametype */
int UI_GetTimeToBeat(int game); /* Returns the time to beat for the current game */
/* /Neon_Knight */
17 changes: 8 additions & 9 deletions code/ui/ui_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1427,18 +1427,12 @@ static void UI_DrawClanName(rectDef_t *rect, float scale, vec4_t color, int text
Text_Paint(rect->x, rect->y, scale, color, UI_Cvar_VariableString("ui_teamName"), 0, 0, textStyle);
}


static void UI_SetCapFragLimits(qboolean uiVars)
{
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";
Expand Down Expand Up @@ -1499,6 +1493,11 @@ static void UI_SetCapFragLimits(qboolean uiVars)
capLimit = "0";
timeLimit = GT_POSSESSION_DEFAULT_TIMELIMIT;
break;
default:
fragLimit = GT_FFA_DEFAULT_SCORELIMIT;
capLimit = "0";
timeLimit = GT_FFA_DEFAULT_TIMELIMIT;
break;
}
if (uiVars == qtrue) {
trap_Cvar_Set("ui_captureLimit", capLimit);
Expand Down Expand Up @@ -3254,7 +3253,7 @@ static qboolean UI_GameType_HandleKey(int flags, float *special, int key)
{
int select = UI_SelectForKey(key);
if (select != 0) {
int oldCount = UI_MapCountByGameTypeSP();
//int oldCount = UI_MapCountByGameTypeSP();

// hard coded mess here
// Changed RD
Expand Down Expand Up @@ -3992,7 +3991,7 @@ static void UI_NextMapSkirmish(char *name)
}


static void UI_StartSkirmish()
static void UI_StartSkirmish(void)
{
int i, k, g, delay, temp;
float skill;
Expand Down Expand Up @@ -7875,7 +7874,7 @@ UI_GetGametype
Returns the current gametype.
===================
*/
int UI_GetGametype() {
int UI_GetGametype(void) {
return uiInfo.gameTypes[ui_gameType.integer].gtEnum;
}
/*
Expand Down
2 changes: 1 addition & 1 deletion code/ui/ui_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -7058,7 +7058,7 @@ setMenuCount(count int)
============================
With these two functions we avoid referring to the menu count directly.
*/
int getMenuCount() {
int getMenuCount(void) {
return menuCount;
}
void setMenuCount(int count) {
Expand Down
2 changes: 1 addition & 1 deletion code/ui/ui_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ void *UI_Alloc(int size);
void UI_InitMemory(void);
qboolean UI_OutOfMemory(void);

int getMenuCount();
int getMenuCount(void);
void setMenuCount(int count);

#ifndef BASEOA
Expand Down

0 comments on commit 01bf6ea

Please sign in to comment.