MCPcopy Create free account
hub / github.com/JACoders/OpenJK / UI_ForcePowerWeaponsButton

Function UI_ForcePowerWeaponsButton

code/ui/ui_main.cpp:4675–4708  ·  view source on GitHub ↗

. Find weapons button and make active/inactive (Used by Force Power Allocation screen)

Source from the content-addressed store, hash-verified

4673
4674//. Find weapons button and make active/inactive (Used by Force Power Allocation screen)
4675static void UI_ForcePowerWeaponsButton(qboolean activeFlag)
4676{
4677 menuDef_t *menu;
4678 menu = Menu_GetFocused(); // Get current menu
4679
4680 if (!menu)
4681 {
4682 return;
4683 }
4684
4685#ifndef JK2_MODE
4686 if (!activeFlag) {
4687 // total light and dark powers are at maximum level 3 ( 3 levels * ( 4ls + 4ds ) = 24 )
4688 if ( UI_CountForcePowers() >= 24 )
4689 activeFlag = qtrue;
4690 }
4691#endif
4692
4693 // Find weaponsbutton
4694 itemDef_t *item;
4695 item = (itemDef_s *) Menu_FindItemByName(menu, "weaponbutton");
4696 if (item)
4697 {
4698 // Make it active
4699 if (activeFlag)
4700 {
4701 item->window.flags &= ~WINDOW_INACTIVE;
4702 }
4703 else
4704 {
4705 item->window.flags |= WINDOW_INACTIVE;
4706 }
4707 }
4708}
4709
4710void UI_SetItemColor(itemDef_t *item,const char *itemname,const char *name,vec4_t color);
4711

Callers 4

UI_InitAllocForcePowersFunction · 0.85
UI_AffectForcePowerLevelFunction · 0.85
UI_ResetForceLevelsFunction · 0.85

Calls 3

UI_CountForcePowersFunction · 0.85
Menu_GetFocusedFunction · 0.70
Menu_FindItemByNameFunction · 0.70

Tested by

no test coverage detected