Set the fields for the allocation of force powers (Used by Force Power Allocation screen)
| 4537 | |
| 4538 | // Set the fields for the allocation of force powers (Used by Force Power Allocation screen) |
| 4539 | static void UI_InitAllocForcePowers ( const char *forceName ) |
| 4540 | { |
| 4541 | menuDef_t *menu; |
| 4542 | itemDef_t *item; |
| 4543 | short forcePowerI=0; |
| 4544 | int forcelevel; |
| 4545 | |
| 4546 | menu = Menu_GetFocused(); // Get current menu |
| 4547 | |
| 4548 | if (!menu) |
| 4549 | { |
| 4550 | return; |
| 4551 | } |
| 4552 | |
| 4553 | if (!UI_GetForcePowerIndex ( forceName, &forcePowerI )) |
| 4554 | { |
| 4555 | return; |
| 4556 | } |
| 4557 | |
| 4558 | client_t* cl = &svs.clients[0]; // 0 because only ever us as a player |
| 4559 | |
| 4560 | // NOTE: this UIScript can be called outside the running game now, so handle that case |
| 4561 | // by getting info frim UIInfo instead of PlayerState |
| 4562 | if( cl ) |
| 4563 | { |
| 4564 | playerState_t* pState = cl->gentity->client; |
| 4565 | forcelevel = pState->forcePowerLevel[powerEnums[forcePowerI].powerEnum]; |
| 4566 | } |
| 4567 | else |
| 4568 | { |
| 4569 | forcelevel = uiInfo.forcePowerLevel[powerEnums[forcePowerI].powerEnum]; |
| 4570 | } |
| 4571 | |
| 4572 | char itemName[128]; |
| 4573 | Com_sprintf (itemName, sizeof(itemName), "%s_hexpic", powerEnums[forcePowerI].title); |
| 4574 | item = (itemDef_s *) Menu_FindItemByName(menu, itemName); |
| 4575 | |
| 4576 | if (item) |
| 4577 | { |
| 4578 | char itemGraphic[128]; |
| 4579 | Com_sprintf (itemGraphic, sizeof(itemGraphic), "gfx/menus/hex_pattern_%d",forcelevel >= 4 ? 3 : forcelevel); |
| 4580 | item->window.background = ui.R_RegisterShaderNoMip(itemGraphic); |
| 4581 | |
| 4582 | // If maxed out on power - don't allow update |
| 4583 | if (forcelevel>=3) |
| 4584 | { |
| 4585 | Com_sprintf (itemName, sizeof(itemName), "%s_fbutton", powerEnums[forcePowerI].title); |
| 4586 | item = (itemDef_s *) Menu_FindItemByName(menu, itemName); |
| 4587 | if (item) |
| 4588 | { |
| 4589 | item->action = 0; //you are bad, no action for you! |
| 4590 | item->descText = 0; //no desc either! |
| 4591 | } |
| 4592 | } |
| 4593 | } |
| 4594 | |
| 4595 | // Set weapons button to inactive |
| 4596 | UI_ForcePowerWeaponsButton(qfalse); |
no test coverage detected