Fix level progress in case all force powers are maxed

This commit is contained in:
Petr Bartos 2023-10-31 17:55:10 +01:00 committed by Simon
parent b0a45e5907
commit f819bc8918

View file

@ -4770,6 +4770,27 @@ static void UI_ForcePowerWeaponsButton(qboolean activeFlag)
if(trap_Cvar_VariableValue("helpUsObi") != 0) if(trap_Cvar_VariableValue("helpUsObi") != 0)
activeFlag = qtrue; activeFlag = qtrue;
if (!activeFlag) {
// If all force powers are maxed, let us pass
client_t* cl = &svs.clients[0];
playerState_t* pState = NULL;
int forcelevel;
qboolean allforcesmaxed = qtrue;
for (int i = 0; i < MAX_POWER_ENUMS; i++) {
if (cl) {
pState = cl->gentity->client;
forcelevel = pState->forcePowerLevel[powerEnums[i].powerEnum];
} else {
forcelevel = uiInfo.forcePowerLevel[powerEnums[i].powerEnum];
}
if (forcelevel < 3) {
allforcesmaxed = qfalse;
break;
}
}
activeFlag = allforcesmaxed;
}
// Find weaponsbutton // Find weaponsbutton
itemDef_t *item; itemDef_t *item;
item = (itemDef_s *) Menu_FindItemByName(menu, "weaponbutton"); item = (itemDef_s *) Menu_FindItemByName(menu, "weaponbutton");