From f819bc891853ce06265d896058fca4805e29e91a Mon Sep 17 00:00:00 2001 From: Petr Bartos Date: Tue, 31 Oct 2023 17:55:10 +0100 Subject: [PATCH] Fix level progress in case all force powers are maxed --- .../Android/jni/OpenJK/code/ui/ui_main.cpp | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Projects/Android/jni/OpenJK/code/ui/ui_main.cpp b/Projects/Android/jni/OpenJK/code/ui/ui_main.cpp index 3edfcfc..b0f5d6d 100644 --- a/Projects/Android/jni/OpenJK/code/ui/ui_main.cpp +++ b/Projects/Android/jni/OpenJK/code/ui/ui_main.cpp @@ -4770,6 +4770,27 @@ static void UI_ForcePowerWeaponsButton(qboolean activeFlag) if(trap_Cvar_VariableValue("helpUsObi") != 0) 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 itemDef_t *item; item = (itemDef_s *) Menu_FindItemByName(menu, "weaponbutton");