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

Function UI_ShowForceLevelDesc

code/ui/ui_main.cpp:5240–5284  ·  view source on GitHub ↗

Show force level description that matches current player level (Used by Force Power Allocation screen)

Source from the content-addressed store, hash-verified

5238
5239// Show force level description that matches current player level (Used by Force Power Allocation screen)
5240static void UI_ShowForceLevelDesc ( const char *forceName )
5241{
5242 short forcePowerI=0;
5243 menuDef_t *menu;
5244 itemDef_t *item;
5245 menu = Menu_GetFocused(); // Get current menu
5246
5247 if (!menu)
5248 {
5249 return;
5250 }
5251
5252
5253 if (!UI_GetForcePowerIndex ( forceName, &forcePowerI ))
5254 {
5255 return;
5256 }
5257
5258 // Get player state
5259 client_t* cl = &svs.clients[0]; // 0 because only ever us as a player
5260
5261 if (!cl) // No client, get out
5262 {
5263 return;
5264 }
5265 playerState_t* pState = cl->gentity->client;
5266
5267 char itemName[128];
5268
5269 // Update level description
5270 Com_sprintf (
5271 itemName,
5272 sizeof(itemName),
5273 "%s_level%ddesc",
5274 powerEnums[forcePowerI].title,
5275 pState->forcePowerLevel[powerEnums[forcePowerI].powerEnum]
5276 );
5277
5278 item = (itemDef_s *) Menu_FindItemByName(menu, itemName);
5279 if (item)
5280 {
5281 item->window.flags |= WINDOW_VISIBLE;
5282 }
5283
5284}
5285
5286// Reset force level powers screen to what it was before player upgraded them (Used by Force Power Allocation screen)
5287static void UI_ResetForceLevels ( void )

Callers 3

UI_RunMenuScriptFunction · 0.85
UI_AffectForcePowerLevelFunction · 0.85

Calls 4

UI_GetForcePowerIndexFunction · 0.85
Menu_GetFocusedFunction · 0.70
Menu_FindItemByNameFunction · 0.70
Com_sprintfFunction · 0.50

Tested by

no test coverage detected