Skip to content

Commit

Permalink
Disable groups UI for tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Aug 29, 2023
1 parent d8737c5 commit 3a8eaca
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/configuration.cpp
Expand Up @@ -390,7 +390,8 @@ bool loadConfig()
war_SetCameraSpeed((v % CAMERASPEED_STEP != 0) ? CAMERASPEED_DEFAULT : v);
}
setShakeStatus(iniGetBool("shake", false).value());
setGroupButtonEnabled(iniGetBool("groupmenu", true).value());
war_setGroupsMenuEnabled(iniGetBool("groupmenu", true).value());
setGroupButtonEnabled(war_getGroupsMenuEnabled());
setCameraAccel(iniGetBool("cameraAccel", true).value());
setDrawShadows(iniGetBool("shadows", true).value());
war_setSoundEnabled(iniGetBool("sound", true).value());
Expand Down Expand Up @@ -691,7 +692,7 @@ bool saveConfig()
iniSetInteger("lodDistanceBias", war_getLODDistanceBiasPercentage());
iniSetBool("cameraAccel", getCameraAccel()); // camera acceleration
iniSetInteger("shake", (int)getShakeStatus()); // screenshake
iniSetInteger("groupmenu", (int)getGroupButtonEnabled()); // screenshake
iniSetInteger("groupmenu", (int)war_getGroupsMenuEnabled()); // groups menu
iniSetInteger("mouseflip", (int)(getInvertMouseStatus())); // flipmouse
iniSetInteger("nomousewarp", (int)getMouseWarp()); // mouse warp
iniSetInteger("coloredCursor", (int)war_GetColouredCursor());
Expand Down Expand Up @@ -931,5 +932,8 @@ bool reloadMPConfig()
game.gameTimeLimitMinutes = war_getMPGameTimeLimitMinutes();
game.playerLeaveMode = war_getMPPlayerLeaveMode();

// restore group menus enabled setting (as tutorial may override it)
setGroupButtonEnabled(war_getGroupsMenuEnabled());

return true;
}
2 changes: 2 additions & 0 deletions src/frontend.cpp
Expand Up @@ -331,6 +331,7 @@ bool runTutorialMenu()
case FRONTEND_TUTORIAL:
SPinit(LEVEL_TYPE::CAMPAIGN);
sstrcpy(aLevelName, TUTORIAL_LEVEL);
setGroupButtonEnabled(false); // hack to disable the groups UI for the tutorial
changeTitleMode(STARTGAME);
break;

Expand Down Expand Up @@ -1263,6 +1264,7 @@ bool runGraphicsOptionsMenu()
case FRONTEND_GROUPS:
case FRONTEND_GROUPS_R:
setGroupButtonEnabled(!getGroupButtonEnabled());
war_setGroupsMenuEnabled(getGroupButtonEnabled()); // persist
widgSetString(psWScreen, FRONTEND_GROUPS_R, graphicsOptionsGroupsMenuEnabled());
break;

Expand Down
1 change: 1 addition & 0 deletions src/ingameop.cpp
Expand Up @@ -711,6 +711,7 @@ static bool runIGGraphicsOptionsMenu(UDWORD id)
case INTINGAMEOP_GROUPS:
case INTINGAMEOP_GROUPS_R:
setGroupButtonEnabled(!getGroupButtonEnabled());
war_setGroupsMenuEnabled(getGroupButtonEnabled()); // persist
widgSetString(psWScreen, INTINGAMEOP_GROUPS_R, graphicsOptionsGroupsMenuEnabled());
break;

Expand Down
11 changes: 11 additions & 0 deletions src/warzoneconfig.cpp
Expand Up @@ -89,6 +89,8 @@ struct WARZONE_GLOBALS
uint32_t shadowFilteringMode = 1;
uint32_t shadowFilterSize = 5;
uint32_t shadowMapResolution = 0; // this defaults to 0, which causes the gfx backend to figure out a recommended default based on the system properties
// groups UI
bool groupsMenuEnabled = true;
};

static WARZONE_GLOBALS warGlobs;
Expand Down Expand Up @@ -645,3 +647,12 @@ void war_setShadowMapResolution(uint32_t resolution)
warGlobs.shadowMapResolution = resolution;
}

bool war_getGroupsMenuEnabled()
{
return warGlobs.groupsMenuEnabled;
}

void war_setGroupsMenuEnabled(bool enabled)
{
warGlobs.groupsMenuEnabled = enabled;
}
3 changes: 3 additions & 0 deletions src/warzoneconfig.h
Expand Up @@ -162,6 +162,9 @@ void war_setShadowFilterSize(uint32_t filterSize);
uint32_t war_getShadowMapResolution();
void war_setShadowMapResolution(uint32_t resolution);

bool war_getGroupsMenuEnabled();
void war_setGroupsMenuEnabled(bool enabled);

/**
* Enable or disable sound initialization
*
Expand Down

0 comments on commit 3a8eaca

Please sign in to comment.