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

Function UI_SetHexPicLevel

code/ui/ui_main.cpp:4712–4752  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4710void UI_SetItemColor(itemDef_t *item,const char *itemname,const char *name,vec4_t color);
4711
4712static void UI_SetHexPicLevel( const menuDef_t *menu,const int forcePowerI,const int powerLevel, const qboolean goldFlag )
4713{
4714 char itemName[128];
4715 itemDef_t *item;
4716
4717 // Find proper hex picture on menu
4718 Com_sprintf (itemName, sizeof(itemName), "%s_hexpic", powerEnums[forcePowerI].title);
4719 item = (itemDef_s *) Menu_FindItemByName((menuDef_t *) menu, itemName);
4720
4721 // Now give it the proper hex graphic
4722 if (item)
4723 {
4724 char itemGraphic[128];
4725 if (goldFlag)
4726 {
4727 Com_sprintf (itemGraphic, sizeof(itemGraphic), "gfx/menus/hex_pattern_%d_gold",powerLevel >= 4 ? 3 : powerLevel);
4728 }
4729 else
4730 {
4731 Com_sprintf (itemGraphic, sizeof(itemGraphic), "gfx/menus/hex_pattern_%d",powerLevel >= 4 ? 3 : powerLevel);
4732 }
4733
4734 item->window.background = ui.R_RegisterShaderNoMip(itemGraphic);
4735
4736 Com_sprintf (itemName, sizeof(itemName), "%s_fbutton", powerEnums[forcePowerI].title);
4737 item = (itemDef_s *) Menu_FindItemByName((menuDef_t *)menu, itemName);
4738 if (item)
4739 {
4740 if (goldFlag)
4741 {
4742 // Change description text to tell player they can decrement the force point
4743 item->descText = "@MENUS_REMOVEFP";
4744 }
4745 else
4746 {
4747 // Change description text to tell player they can increment the force point
4748 item->descText = "@MENUS_ADDFP";
4749 }
4750 }
4751 }
4752}
4753
4754void UI_SetItemVisible(menuDef_t *menu,const char *itemname,qboolean visible);
4755

Callers 2

UI_AffectForcePowerLevelFunction · 0.85

Calls 2

Menu_FindItemByNameFunction · 0.70
Com_sprintfFunction · 0.50

Tested by

no test coverage detected