codemp/ui/ui_shared.c File Reference

#include "ui_local.h"
#include "ui_shared.h"
#include "../game/bg_public.h"
#include "../game/anims.h"
#include "../ghoul2/G2.h"
#include "../namespace_begin.h"
#include "../namespace_end.h"

Go to the source code of this file.

Data Structures

struct  bind_t
struct  configcvar_t
struct  itemFlagsDef_s
struct  keywordHash_s
struct  scrollInfo_s
struct  stringDef_s
struct  uiG2PtrTracker_s

Defines

#define SCROLL_TIME_START   500
#define SCROLL_TIME_ADJUST   150
#define SCROLL_TIME_ADJUSTOFFSET   40
#define SCROLL_TIME_FLOOR   20
#define DOUBLE_CLICK_DELAY   300
#define MEM_POOL_SIZE   2048 * 1024
#define UI_ALLOCATION_TAG   TAG_UI_ALLOC
#define HASH_TABLE_SIZE   2048
#define _TRANS3
#define MAX_DEFERRED_SCRIPT   2048
#define COLOR_MAX   255.0f
#define KEYWORDHASH_SIZE   512

Typedefs

typedef scrollInfo_s scrollInfo_t
typedef itemFlagsDef_s itemFlagsDef_t
typedef stringDef_s stringDef_t
typedef keywordHash_s keywordHash_t
typedef uiG2PtrTracker_s uiG2PtrTracker_t

Functions

void UI_UpdateCharacterSkin (void)
void UI_SaberDrawBlades (itemDef_t *item, vec3_t origin, vec3_t angles)
void UI_SaberLoadParms (void)
void UI_CacheSaberGlowGraphics (void)
qboolean Item_SetFocus (itemDef_t *item, float x, float y)
void Item_RunScript (itemDef_t *item, const char *s)
void Item_SetupKeywordHash (void)
void Menu_SetupKeywordHash (void)
int BindingIDFromName (const char *name)
qboolean Item_Bind_HandleKey (itemDef_t *item, int key, qboolean down)
itemDef_tMenu_SetPrevCursorItem (menuDef_t *menu)
itemDef_tMenu_SetNextCursorItem (menuDef_t *menu)
void Menu_SetItemText (const menuDef_t *menu, const char *itemName, const char *text)
qboolean ItemParse_asset_model_go (itemDef_t *item, const char *name, int *runTimeLength)
qboolean ItemParse_model_g2anim_go (itemDef_t *item, const char *animName)
int MenuFontToHandle (int iMenuFont)
void * UI_Alloc (int size)
void UI_InitMemory (void)
qboolean UI_OutOfMemory ()
const char * String_Alloc (const char *p)
void String_Report ()
void String_Init ()
void PC_SourceWarning (int handle, char *format,...)
void PC_SourceError (int handle, char *format,...)
void LerpColor (vec4_t a, vec4_t b, vec4_t c, float t)
qboolean Float_Parse (char **p, float *f)
qboolean PC_Float_Parse (int handle, float *f)
qboolean Color_Parse (char **p, vec4_t *c)
qboolean PC_Color_Parse (int handle, vec4_t *c)
qboolean Int_Parse (char **p, int *i)
qboolean PC_Int_Parse (int handle, int *i)
qboolean Rect_Parse (char **p, rectDef_t *r)
qboolean PC_Rect_Parse (int handle, rectDef_t *r)
qboolean String_Parse (char **p, const char **out)
qboolean PC_String_Parse (int handle, const char **out)
qboolean PC_Script_Parse (int handle, const char **out)
void Init_Display (displayContextDef_t *dc)
void GradientBar_Paint (rectDef_t *rect, vec4_t color)
void Window_Init (Window *w)
void Fade (int *flags, float *f, float clamp, int *nextTime, int offsetTime, qboolean bFlags, float fadeAmount)
void Window_Paint (Window *w, float fadeAmount, float fadeClamp, float fadeCycle)
void Item_SetScreenCoords (itemDef_t *item, float x, float y)
void Item_UpdatePosition (itemDef_t *item)
void Menu_UpdatePosition (menuDef_t *menu)
void Menu_PostParse (menuDef_t *menu)
itemDef_tMenu_ClearFocus (menuDef_t *menu)
qboolean IsVisible (int flags)
qboolean Rect_ContainsPoint (rectDef_t *rect, float x, float y)
int Menu_ItemsMatchingGroup (menuDef_t *menu, const char *name)
itemDef_tMenu_GetMatchingItemByNumber (menuDef_t *menu, int index, const char *name)
qboolean Script_SetColor (itemDef_t *item, char **args)
qboolean Script_SetAsset (itemDef_t *item, char **args)
qboolean Script_SetBackground (itemDef_t *item, char **args)
qboolean Script_SetItemRectCvar (itemDef_t *item, char **args)
qboolean Script_SetItemBackground (itemDef_t *item, char **args)
qboolean Script_SetItemText (itemDef_t *item, char **args)
itemDef_tMenu_FindItemByName (menuDef_t *menu, const char *p)
qboolean Script_SetTeamColor (itemDef_t *item, char **args)
qboolean Script_SetItemColor (itemDef_t *item, char **args)
qboolean Script_SetItemColorCvar (itemDef_t *item, char **args)
qboolean Script_SetItemRect (itemDef_t *item, char **args)
void Menu_ShowGroup (menuDef_t *menu, char *groupName, qboolean showFlag)
void Menu_ShowItemByName (menuDef_t *menu, const char *p, qboolean bShow)
void Menu_FadeItemByName (menuDef_t *menu, const char *p, qboolean fadeOut)
menuDef_tMenus_FindByName (const char *p)
void Menus_ShowByName (const char *p)
void Menus_OpenByName (const char *p)
void Menus_CloseByName (const char *p)
void Menus_CloseAll ()
qboolean Script_Show (itemDef_t *item, char **args)
qboolean Script_Hide (itemDef_t *item, char **args)
qboolean Script_FadeIn (itemDef_t *item, char **args)
qboolean Script_FadeOut (itemDef_t *item, char **args)
qboolean Script_Open (itemDef_t *item, char **args)
qboolean Script_Close (itemDef_t *item, char **args)
void Menu_TransitionItemByName (menuDef_t *menu, const char *p, const rectDef_t *rectFrom, const rectDef_t *rectTo, int time, float amt)
void Menu_Transition3ItemByName (menuDef_t *menu, const char *p, const float minx, const float miny, const float minz, const float maxx, const float maxy, const float maxz, const float fovtx, const float fovty, const int time, const float amt)
qboolean Script_Defer (itemDef_t *item, char **args)
qboolean Script_RunDeferred (itemDef_t *item, char **args)
qboolean Script_Transition (itemDef_t *item, char **args)
void Menu_OrbitItemByName (menuDef_t *menu, const char *p, float x, float y, float cx, float cy, int time)
void Menu_ItemDisable (menuDef_t *menu, char *name, int disableFlag)
qboolean Script_Disable (itemDef_t *item, char **args)
qboolean Script_Scale (itemDef_t *item, char **args)
qboolean Script_Orbit (itemDef_t *item, char **args)
qboolean Script_SetFocus (itemDef_t *item, char **args)
qboolean Script_SetPlayerModel (itemDef_t *item, char **args)
qboolean ParseRect (const char **p, rectDef_t *r)
qboolean Script_Transition2 (itemDef_t *item, char **args)
qboolean Script_Transition3 (itemDef_t *item, char **args)
qboolean Script_SetCvar (itemDef_t *item, char **args)
qboolean Script_SetCvarToCvar (itemDef_t *item, char **args)
qboolean Script_Exec (itemDef_t *item, char **args)
qboolean Script_Play (itemDef_t *item, char **args)
qboolean Script_playLooped (itemDef_t *item, char **args)
void Menu_SetItemBackground (const menuDef_t *menu, const char *itemName, const char *background)
qboolean Item_EnableShowViaCvar (itemDef_t *item, int flag)
int Item_TextScroll_MaxScroll (itemDef_t *item)
int Item_TextScroll_ThumbPosition (itemDef_t *item)
int Item_TextScroll_ThumbDrawPosition (itemDef_t *item)
int Item_TextScroll_OverLB (itemDef_t *item, float x, float y)
void Item_TextScroll_MouseEnter (itemDef_t *item, float x, float y)
qboolean Item_TextScroll_HandleKey (itemDef_t *item, int key, qboolean down, qboolean force)
int Item_ListBox_MaxScroll (itemDef_t *item)
int Item_ListBox_ThumbPosition (itemDef_t *item)
int Item_ListBox_ThumbDrawPosition (itemDef_t *item)
float Item_Slider_ThumbPosition (itemDef_t *item)
int Item_Slider_OverSlider (itemDef_t *item, float x, float y)
int Item_ListBox_OverLB (itemDef_t *item, float x, float y)
void Item_ListBox_MouseEnter (itemDef_t *item, float x, float y)
void Item_MouseEnter (itemDef_t *item, float x, float y)
void Item_MouseLeave (itemDef_t *item)
itemDef_tMenu_HitTest (menuDef_t *menu, float x, float y)
void Item_SetMouseOver (itemDef_t *item, qboolean focus)
qboolean Item_OwnerDraw_HandleKey (itemDef_t *item, int key)
qboolean Item_ListBox_HandleKey (itemDef_t *item, int key, qboolean down, qboolean force)
qboolean Item_YesNo_HandleKey (itemDef_t *item, int key)
int Item_Multi_CountSettings (itemDef_t *item)
int Item_Multi_FindCvarByValue (itemDef_t *item)
const char * Item_Multi_Setting (itemDef_t *item)
qboolean Item_Multi_HandleKey (itemDef_t *item, int key)
void Leaving_EditField (itemDef_t *item)
qboolean Item_TextField_HandleKey (itemDef_t *item, int key)
void Item_StartCapture (itemDef_t *item, int key)
void Item_StopCapture (itemDef_t *item)
qboolean Item_Slider_HandleKey (itemDef_t *item, int key, qboolean down)
qboolean Item_HandleKey (itemDef_t *item, int key, qboolean down)
qboolean Item_HandleAccept (itemDef_t *item)
void Item_Action (itemDef_t *item)
void Menus_Activate (menuDef_t *menu)
int Display_VisibleMenuCount ()
void Menus_HandleOOBClick (menuDef_t *menu, int key, qboolean down)
void Menu_HandleKey (menuDef_t *menu, int key, qboolean down)
void ToWindowCoords (float *x, float *y, windowDef_t *window)
void Rect_ToWindowCoords (rectDef_t *rect, windowDef_t *window)
void Item_SetTextExtents (itemDef_t *item, int *width, int *height, const char *text)
void Item_TextColor (itemDef_t *item, vec4_t *newColor)
void Item_Text_AutoWrapped_Paint (itemDef_t *item)
void Item_Text_Wrapped_Paint (itemDef_t *item)
void Item_Text_Paint (itemDef_t *item)
void Item_TextField_Paint (itemDef_t *item)
void Item_YesNo_Paint (itemDef_t *item)
void Item_Multi_Paint (itemDef_t *item)
void Controls_GetConfig (void)
void Controls_SetConfig (qboolean restart)
void BindingFromName (const char *cvar)
void Item_Slider_Paint (itemDef_t *item)
void Item_Bind_Paint (itemDef_t *item)
qboolean Display_KeyBindPending ()
void UI_ScaleModelAxis (refEntity_t *ent)
void UI_SaberAttachToChar (itemDef_t *item)
void Item_Model_Paint (itemDef_t *item)
void Item_Image_Paint (itemDef_t *item)
void Item_TextScroll_Paint (itemDef_t *item)
void Item_ListBox_Paint (itemDef_t *item)
void Item_OwnerDraw_Paint (itemDef_t *item)
void Item_Paint (itemDef_t *item)
void Menu_Init (menuDef_t *menu)
itemDef_tMenu_GetFocusedItem (menuDef_t *menu)
menuDef_tMenu_GetFocused ()
void Menu_ScrollFeeder (menuDef_t *menu, int feeder, qboolean down)
void Menu_SetFeederSelection (menuDef_t *menu, int feeder, int index, const char *name)
qboolean Menus_AnyFullScreenVisible ()
menuDef_tMenus_ActivateByName (const char *p)
void Item_Init (itemDef_t *item)
void Menu_HandleMouseMove (menuDef_t *menu, float x, float y)
void Menu_Paint (menuDef_t *menu, qboolean forcePaint)
void Item_ValidateTypeData (itemDef_t *item)
int KeywordHash_Key (char *keyword)
void KeywordHash_Add (keywordHash_t *table[], keywordHash_t *key)
keywordHash_tKeywordHash_Find (keywordHash_t *table[], char *keyword)
qboolean ItemParse_name (itemDef_t *item, int handle)
qboolean ItemParse_focusSound (itemDef_t *item, int handle)
qboolean ItemParse_text (itemDef_t *item, int handle)
qboolean ItemParse_descText (itemDef_t *item, int handle)
qboolean ItemParse_text2 (itemDef_t *item, int handle)
qboolean ItemParse_text2alignx (itemDef_t *item, int handle)
qboolean ItemParse_text2aligny (itemDef_t *item, int handle)
qboolean ItemParse_group (itemDef_t *item, int handle)
void UI_InsertG2Pointer (void *ghoul2)
void UI_ClearG2Pointer (void *ghoul2)
void UI_CleanupGhoul2 (void)
int UI_ParseAnimationFile (const char *filename, animation_t *animset, qboolean isHumanoid)
qboolean ItemParse_asset_model (itemDef_t *item, int handle)
qboolean ItemParse_asset_shader (itemDef_t *item, int handle)
qboolean ItemParse_model_origin (itemDef_t *item, int handle)
qboolean ItemParse_model_fovx (itemDef_t *item, int handle)
qboolean ItemParse_model_fovy (itemDef_t *item, int handle)
qboolean ItemParse_model_rotation (itemDef_t *item, int handle)
qboolean ItemParse_model_angle (itemDef_t *item, int handle)
qboolean ItemParse_model_g2mins (itemDef_t *item, int handle)
qboolean ItemParse_model_g2maxs (itemDef_t *item, int handle)
qboolean ItemParse_model_g2scale (itemDef_t *item, int handle)
qhandle_t trap_R_RegisterSkin (const char *name)
qboolean ItemParse_model_g2skin (itemDef_t *item, int handle)
qboolean ItemParse_model_g2anim (itemDef_t *item, int handle)
qboolean ItemParse_model_g2skin_go (itemDef_t *item, const char *skinName)
qboolean ItemParse_rectcvar (itemDef_t *item, int handle)
qboolean ItemParse_rect (itemDef_t *item, int handle)
qboolean ItemParse_flag (itemDef_t *item, int handle)
qboolean ItemParse_style (itemDef_t *item, int handle)
qboolean ItemParse_decoration (itemDef_t *item, int handle)
qboolean ItemParse_notselectable (itemDef_t *item, int handle)
qboolean ItemParse_scrollhidden (itemDef_t *item, int handle)
qboolean ItemParse_wrapped (itemDef_t *item, int handle)
qboolean ItemParse_autowrapped (itemDef_t *item, int handle)
qboolean ItemParse_horizontalscroll (itemDef_t *item, int handle)
qboolean ItemParse_type (itemDef_t *item, int handle)
qboolean ItemParse_elementwidth (itemDef_t *item, int handle)
qboolean ItemParse_elementheight (itemDef_t *item, int handle)
qboolean ItemParse_feeder (itemDef_t *item, int handle)
qboolean ItemParse_elementtype (itemDef_t *item, int handle)
qboolean ItemParse_columns (itemDef_t *item, int handle)
qboolean ItemParse_border (itemDef_t *item, int handle)
qboolean ItemParse_bordersize (itemDef_t *item, int handle)
qboolean ItemParse_visible (itemDef_t *item, int handle)
qboolean ItemParse_ownerdraw (itemDef_t *item, int handle)
qboolean ItemParse_align (itemDef_t *item, int handle)
qboolean ItemParse_isCharacter (itemDef_t *item, int handle)
qboolean ItemParse_textalign (itemDef_t *item, int handle)
qboolean ItemParse_textalignx (itemDef_t *item, int handle)
qboolean ItemParse_textaligny (itemDef_t *item, int handle)
qboolean ItemParse_textscale (itemDef_t *item, int handle)
qboolean ItemParse_textstyle (itemDef_t *item, int handle)
qboolean ItemParse_invertyesno (itemDef_t *item, int handle)
qboolean ItemParse_xoffset (itemDef_t *item, int handle)
qboolean ItemParse_backcolor (itemDef_t *item, int handle)
qboolean ItemParse_forecolor (itemDef_t *item, int handle)
qboolean ItemParse_bordercolor (itemDef_t *item, int handle)
qboolean ItemParse_outlinecolor (itemDef_t *item, int handle)
qboolean ItemParse_background (itemDef_t *item, int handle)
qboolean ItemParse_cinematic (itemDef_t *item, int handle)
qboolean ItemParse_doubleClick (itemDef_t *item, int handle)
qboolean ItemParse_onFocus (itemDef_t *item, int handle)
qboolean ItemParse_leaveFocus (itemDef_t *item, int handle)
qboolean ItemParse_mouseEnter (itemDef_t *item, int handle)
qboolean ItemParse_mouseExit (itemDef_t *item, int handle)
qboolean ItemParse_mouseEnterText (itemDef_t *item, int handle)
qboolean ItemParse_mouseExitText (itemDef_t *item, int handle)
qboolean ItemParse_action (itemDef_t *item, int handle)
qboolean ItemParse_special (itemDef_t *item, int handle)
qboolean ItemParse_cvarTest (itemDef_t *item, int handle)
qboolean ItemParse_cvar (itemDef_t *item, int handle)
qboolean ItemParse_font (itemDef_t *item, int handle)
qboolean ItemParse_maxChars (itemDef_t *item, int handle)
qboolean ItemParse_maxPaintChars (itemDef_t *item, int handle)
qboolean ItemParse_maxLineChars (itemDef_t *item, int handle)
qboolean ItemParse_lineHeight (itemDef_t *item, int handle)
qboolean ItemParse_cvarFloat (itemDef_t *item, int handle)
qboolean ItemParse_cvarStrList (itemDef_t *item, int handle)
qboolean ItemParse_cvarFloatList (itemDef_t *item, int handle)
qboolean ItemParse_addColorRange (itemDef_t *item, int handle)
qboolean ItemParse_ownerdrawFlag (itemDef_t *item, int handle)
qboolean ItemParse_enableCvar (itemDef_t *item, int handle)
qboolean ItemParse_disableCvar (itemDef_t *item, int handle)
qboolean ItemParse_showCvar (itemDef_t *item, int handle)
qboolean ItemParse_hideCvar (itemDef_t *item, int handle)
qboolean ItemParse_Appearance_slot (itemDef_t *item, int handle)
qboolean ItemParse_isSaber (itemDef_t *item, int handle)
qboolean ItemParse_isSaber2 (itemDef_t *item, int handle)
qboolean Item_Parse (int handle, itemDef_t *item)
void Item_InitControls (itemDef_t *item)
qboolean MenuParse_font (itemDef_t *item, int handle)
qboolean MenuParse_name (itemDef_t *item, int handle)
qboolean MenuParse_fullscreen (itemDef_t *item, int handle)
qboolean MenuParse_rect (itemDef_t *item, int handle)
qboolean MenuParse_style (itemDef_t *item, int handle)
qboolean MenuParse_visible (itemDef_t *item, int handle)
qboolean MenuParse_onOpen (itemDef_t *item, int handle)
qboolean MenuParse_onClose (itemDef_t *item, int handle)
qboolean MenuParse_onAccept (itemDef_t *item, int handle)
qboolean MenuParse_onESC (itemDef_t *item, int handle)
qboolean MenuParse_border (itemDef_t *item, int handle)
qboolean MenuParse_borderSize (itemDef_t *item, int handle)
qboolean MenuParse_backcolor (itemDef_t *item, int handle)
qboolean MenuParse_descAlignment (itemDef_t *item, int handle)
qboolean MenuParse_descX (itemDef_t *item, int handle)
qboolean MenuParse_descY (itemDef_t *item, int handle)
qboolean MenuParse_descScale (itemDef_t *item, int handle)
qboolean MenuParse_descColor (itemDef_t *item, int handle)
qboolean MenuParse_forecolor (itemDef_t *item, int handle)
qboolean MenuParse_bordercolor (itemDef_t *item, int handle)
qboolean MenuParse_focuscolor (itemDef_t *item, int handle)
qboolean MenuParse_disablecolor (itemDef_t *item, int handle)
qboolean MenuParse_outlinecolor (itemDef_t *item, int handle)
qboolean MenuParse_background (itemDef_t *item, int handle)
qboolean MenuParse_cinematic (itemDef_t *item, int handle)
qboolean MenuParse_ownerdrawFlag (itemDef_t *item, int handle)
qboolean MenuParse_ownerdraw (itemDef_t *item, int handle)
qboolean MenuParse_popup (itemDef_t *item, int handle)
qboolean MenuParse_outOfBounds (itemDef_t *item, int handle)
qboolean MenuParse_soundLoop (itemDef_t *item, int handle)
qboolean MenuParse_fadeClamp (itemDef_t *item, int handle)
qboolean MenuParse_fadeAmount (itemDef_t *item, int handle)
qboolean MenuParse_fadeCycle (itemDef_t *item, int handle)
qboolean MenuParse_itemDef (itemDef_t *item, int handle)
qboolean MenuParse_appearanceIncrement (itemDef_t *item, int handle)
qboolean Menu_Parse (int handle, menuDef_t *menu)
void Menu_New (int handle)
int Menu_Count ()
void Menu_PaintAll ()
void Menu_Reset ()
displayContextDef_tDisplay_GetContext ()
void * Display_CaptureItem (int x, int y)
qboolean Display_MouseMove (void *p, int x, int y)
int Display_CursorType (int x, int y)
void Display_HandleKey (int key, qboolean down, int x, int y)
void Display_CacheAll ()

Variables

stringID_table_t animTable [MAX_ANIMATIONS+1]
vmCvar_t ui_char_color_red
vmCvar_t ui_char_color_green
vmCvar_t ui_char_color_blue
vmCvar_t se_language
qboolean ui_saber_parms_parsed
displayContextDef_tDC = NULL
menuDef_t Menus [MAX_MENUS]
int menuCount = 0
menuDef_tmenuStack [MAX_OPEN_MENUS]
int openMenuCount = 0
itemFlagsDef_t itemFlags []
char * styles []
char * alignment []
char * types []
int FPMessageTime = 0
char ui_deferredScript [MAX_DEFERRED_SCRIPT]
itemDef_tui_deferredScriptItem = NULL
commandDef_t commandList []
int scriptCommandCount = sizeof(commandList) / sizeof(commandDef_t)
char g_nameBind1 [32]
char g_nameBind2 [32]
uiG2PtrTracker_tui_G2PtrTracker = NULL
char currLanguage [32][128]
keywordHash_t itemParseKeywords []
keywordHash_titemParseKeywordHash [KEYWORDHASH_SIZE]
keywordHash_t menuParseKeywords []
keywordHash_tmenuParseKeywordHash [KEYWORDHASH_SIZE]


Define Documentation

#define _TRANS3
 

Definition at line 1694 of file ui_shared.c.

#define COLOR_MAX   255.0f
 

Definition at line 5976 of file ui_shared.c.

Referenced by Item_ListBox_Paint().

#define DOUBLE_CLICK_DELAY   300
 

Definition at line 119 of file ui_shared.c.

Referenced by Item_ListBox_HandleKey().

#define HASH_TABLE_SIZE   2048
 

Definition at line 257 of file ui_shared.c.

Referenced by String_Init().

#define KEYWORDHASH_SIZE   512
 

Definition at line 7324 of file ui_shared.c.

Referenced by KeywordHash_Key().

#define MAX_DEFERRED_SCRIPT   2048
 

Definition at line 1754 of file ui_shared.c.

Referenced by Script_Defer().

#define MEM_POOL_SIZE   2048 * 1024
 

Definition at line 141 of file ui_shared.c.

Referenced by String_Report(), and UI_Alloc().

#define SCROLL_TIME_ADJUST   150
 

Definition at line 20 of file ui_shared.c.

Referenced by Item_StartCapture().

#define SCROLL_TIME_ADJUSTOFFSET   40
 

Definition at line 21 of file ui_shared.c.

#define SCROLL_TIME_FLOOR   20
 

Definition at line 22 of file ui_shared.c.

#define SCROLL_TIME_START   500
 

Definition at line 19 of file ui_shared.c.

Referenced by Item_StartCapture().

#define UI_ALLOCATION_TAG   TAG_UI_ALLOC
 

Definition at line 142 of file ui_shared.c.

Referenced by UI_Alloc(), and UI_InitMemory().


Typedef Documentation

typedef struct itemFlagsDef_s itemFlagsDef_t
 

typedef struct keywordHash_s keywordHash_t
 

Referenced by Item_Parse(), KeywordHash_Add(), KeywordHash_Find(), and Menu_Parse().

typedef struct scrollInfo_s scrollInfo_t
 

typedef struct stringDef_s stringDef_t
 

Referenced by String_Alloc().

typedef struct uiG2PtrTracker_s uiG2PtrTracker_t
 

Definition at line 7479 of file ui_shared.c.

Referenced by UI_CleanupGhoul2(), UI_ClearG2Pointer(), and UI_InsertG2Pointer().


Function Documentation

void BindingFromName const char *  cvar  ) 
 

Definition at line 5410 of file ui_shared.c.

References bind_t::bind1, bind_t::bind2, DC, g_nameBind1, g_nameBind2, displayContextDef_t::keynumToStringBuf, Q_stricmp(), strcat(), strcpy(), trap_SP_GetStringTextString(), and va().

Referenced by Item_Bind_Paint().

05410                                        {
05411         int             i, b1, b2;
05412         char    sOR[32];
05413 
05414 
05415         // iterate each command, set its default binding
05416         for (i=0; i < g_bindCount; i++)
05417         {
05418                 if (Q_stricmp(cvar, g_bindings[i].command) == 0) {
05419                         b1 = g_bindings[i].bind1;
05420                         if (b1 == -1) {
05421                                 break;
05422                         }
05423                                 DC->keynumToStringBuf( b1, g_nameBind1, 32 );
05424 // do NOT do this or it corrupts asian text!!!                                  Q_strupr(g_nameBind1);
05425 
05426                                 b2 = g_bindings[i].bind2;
05427                                 if (b2 != -1)
05428                                 {
05429                                         DC->keynumToStringBuf( b2, g_nameBind2, 32 );
05430 // do NOT do this or it corrupts asian text!!!                                  Q_strupr(g_nameBind2);
05431 
05432                                         trap_SP_GetStringTextString("MENUS_KEYBIND_OR",sOR, sizeof(sOR));
05433 
05434                                         strcat( g_nameBind1, va(" %s ",sOR));
05435                                         strcat( g_nameBind1, g_nameBind2 );
05436                                 }
05437                         return;
05438                 }
05439         }
05440         strcpy(g_nameBind1, "???");
05441 }

int BindingIDFromName const char *  name  ) 
 

Definition at line 5396 of file ui_shared.c.

References name, and Q_stricmp().

Referenced by Item_Bind_HandleKey().

05396                                         {
05397         int i;
05398   for (i=0; i < g_bindCount; i++)
05399         {
05400                 if (Q_stricmp(name, g_bindings[i].command) == 0) {
05401                         return i;
05402                 }
05403         }
05404         return -1;
05405 }

qboolean Color_Parse char **  p,
vec4_t c
 

Definition at line 492 of file ui_shared.c.

References Float_Parse(), qboolean, qfalse, qtrue, and vec4_t.

Referenced by Script_SetItemColor().

00492                                           {
00493         int i;
00494         float f;
00495 
00496         for (i = 0; i < 4; i++) {
00497                 if (!Float_Parse(p, &f)) {
00498                         return qfalse;
00499                 }
00500                 (*c)[i] = f;
00501         }
00502         return qtrue;
00503 }

void Controls_GetConfig void   ) 
 

Definition at line 5332 of file ui_shared.c.

References bind_t::bind1, and bind_t::bind2.

Referenced by String_Init().

05333 {
05334         int             i;
05335         int             twokeys[2];
05336 
05337         // iterate each command, get its numeric binding
05338         for (i=0; i < g_bindCount; i++)
05339         {
05340 
05341                 Controls_GetKeyAssignment(g_bindings[i].command, twokeys);
05342 
05343                 g_bindings[i].bind1 = twokeys[0];
05344                 g_bindings[i].bind2 = twokeys[1];
05345         }
05346 
05347         //s_controls.invertmouse.curvalue  = DC->getCVarValue( "m_pitch" ) < 0;
05348         //s_controls.smoothmouse.curvalue  = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "m_filter" ) );
05349         //s_controls.alwaysrun.curvalue    = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "cl_run" ) );
05350         //s_controls.autoswitch.curvalue   = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "cg_autoswitch" ) );
05351         //s_controls.sensitivity.curvalue  = UI_ClampCvar( 2, 30, Controls_GetCvarValue( "sensitivity" ) );
05352         //s_controls.joyenable.curvalue    = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "in_joystick" ) );
05353         //s_controls.joythreshold.curvalue = UI_ClampCvar( 0.05, 0.75, Controls_GetCvarValue( "joy_threshold" ) );
05354         //s_controls.freelook.curvalue     = UI_ClampCvar( 0, 1, Controls_GetCvarValue( "cl_freelook" ) );
05355 }

void Controls_SetConfig qboolean  restart  ) 
 

Definition at line 5362 of file ui_shared.c.

References bind_t::bind1, bind_t::bind2, DC, and displayContextDef_t::setBinding.

Referenced by Item_Bind_HandleKey().

05363 {
05364         int             i;
05365 
05366         // iterate each command, get its numeric binding
05367         for (i=0; i < g_bindCount; i++)
05368         {
05369                 if (g_bindings[i].bind1 != -1)
05370                 {       
05371                         DC->setBinding( g_bindings[i].bind1, g_bindings[i].command );
05372 
05373                         if (g_bindings[i].bind2 != -1)
05374                                 DC->setBinding( g_bindings[i].bind2, g_bindings[i].command );
05375                 }
05376         }
05377 
05378         //if ( s_controls.invertmouse.curvalue )
05379         //      DC->setCVar("m_pitch", va("%f),-fabs( DC->getCVarValue( "m_pitch" ) ) );
05380         //else
05381         //      trap_Cvar_SetValue( "m_pitch", fabs( trap_Cvar_VariableValue( "m_pitch" ) ) );
05382 
05383         //trap_Cvar_SetValue( "m_filter", s_controls.smoothmouse.curvalue );
05384         //trap_Cvar_SetValue( "cl_run", s_controls.alwaysrun.curvalue );
05385         //trap_Cvar_SetValue( "cg_autoswitch", s_controls.autoswitch.curvalue );
05386         //trap_Cvar_SetValue( "sensitivity", s_controls.sensitivity.curvalue );
05387         //trap_Cvar_SetValue( "in_joystick", s_controls.joyenable.curvalue );
05388         //trap_Cvar_SetValue( "joy_threshold", s_controls.joythreshold.curvalue );
05389         //trap_Cvar_SetValue( "cl_freelook", s_controls.freelook.curvalue );
05390 //
05391 //      DC->executeText(EXEC_APPEND, "in_restart\n");
05392 // ^--this is bad, it shows the cursor during map load, if you need to, add it as an exec cmd to use_joy or something.
05393 }

void Display_CacheAll  ) 
 

Definition at line 9960 of file ui_shared.c.

References menuCount, and Menus.

09960                         {
09961         int i;
09962         for (i = 0; i < menuCount; i++) {
09963                 Menu_CacheContents(&Menus[i]);
09964         }
09965 }

void* Display_CaptureItem int  x,
int  y
 

Definition at line 9858 of file ui_shared.c.

References menuCount, Menus, NULL, and Rect_ContainsPoint().

Referenced by CG_KeyEvent(), and Display_HandleKey().

09858                                         {
09859         int i;
09860 
09861         for (i = 0; i < menuCount; i++) {
09862                 // turn off focus each item
09863                 // menu->items[i].window.flags &= ~WINDOW_HASFOCUS;
09864                 if (Rect_ContainsPoint(&Menus[i].window.rect, x, y)) {
09865                         return &Menus[i];
09866                 }
09867         }
09868         return NULL;
09869 }

int Display_CursorType int  x,
int  y
 

Definition at line 9903 of file ui_shared.c.

References CURSOR_ARROW, CURSOR_SIZER, rectDef_t::h, menuCount, Menus, windowDef_t::rect, Rect_ContainsPoint(), rectDef_t::w, menuDef_t::window, rectDef_t::x, and rectDef_t::y.

Referenced by CG_MouseEvent().

09903                                      {
09904         int i;
09905         for (i = 0; i < menuCount; i++) {
09906                 rectDef_t r2;
09907                 r2.x = Menus[i].window.rect.x - 3;
09908                 r2.y = Menus[i].window.rect.y - 3;
09909                 r2.w = r2.h = 7;
09910                 if (Rect_ContainsPoint(&r2, x, y)) {
09911                         return CURSOR_SIZER;
09912                 }
09913         }
09914         return CURSOR_ARROW;
09915 }

displayContextDef_t* Display_GetContext  ) 
 

Definition at line 9854 of file ui_shared.c.

References DC.

09854                                           {
09855         return DC;
09856 }

void Display_HandleKey int  key,
qboolean  down,
int  x,
int  y
 

Definition at line 9918 of file ui_shared.c.

References Display_CaptureItem(), Menu_GetFocused(), Menu_HandleKey(), and NULL.

Referenced by CG_KeyEvent().

09918                                                              {
09919         menuDef_t *menu = (menuDef_t *) Display_CaptureItem(x, y);
09920         if (menu == NULL) {  
09921                 menu = Menu_GetFocused();
09922         }
09923         if (menu) {
09924                 Menu_HandleKey(menu, key, down );
09925         }
09926 }

qboolean Display_KeyBindPending  ) 
 

Definition at line 5548 of file ui_shared.c.

References qboolean.

Referenced by Item_Paint().

05548                                   {
05549         return g_waitingForKey;
05550 }

qboolean Display_MouseMove void *  p,
int  x,
int  y
 

Definition at line 9873 of file ui_shared.c.

References windowDef_t::flags, Menu_GetFocused(), Menu_HandleMouseMove(), Menu_UpdatePosition(), menuCount, Menus, NULL, qboolean, qtrue, windowDef_t::rect, menuDef_t::window, WINDOW_POPUP, rectDef_t::x, and rectDef_t::y.

Referenced by _UI_MouseEvent(), CG_MouseEvent(), and Menu_HandleKey().

09873                                                   {
09874 
09875 //JLFMOUSE  AGAIN I THINK THIS SHOULD BE MOOT
09876 #ifdef _XBOX
09877         return qtrue;
09878 #endif
09879         //END JLF
09880         int i;
09881         menuDef_t *menu = (menuDef_t *) p;
09882 
09883         if (menu == NULL) {
09884     menu = Menu_GetFocused();
09885                 if (menu) {
09886                         if (menu->window.flags & WINDOW_POPUP) {
09887                                 Menu_HandleMouseMove(menu, x, y);
09888                                 return qtrue;
09889                         }
09890                 }
09891                 for (i = 0; i < menuCount; i++) {
09892                         Menu_HandleMouseMove(&Menus[i], x, y);
09893                 }
09894         } else {
09895                 menu->window.rect.x += x;
09896                 menu->window.rect.y += y;
09897                 Menu_UpdatePosition(menu);
09898         }
09899         return qtrue;
09900 
09901 }

int Display_VisibleMenuCount  ) 
 

Definition at line 4442 of file ui_shared.c.

References windowDef_t::flags, menuCount, Menus, menuDef_t::window, WINDOW_FORCED, and WINDOW_VISIBLE.

Referenced by Menus_HandleOOBClick().

04442                                {
04443         int i, count;
04444         count = 0;
04445         for (i = 0; i < menuCount; i++) {
04446                 if (Menus[i].window.flags & (WINDOW_FORCED | WINDOW_VISIBLE)) {
04447                         count++;
04448                 }
04449         }
04450         return count;
04451 }

void Fade int *  flags,
float *  f,
float  clamp,
int *  nextTime,
int  offsetTime,
qboolean  bFlags,
float  fadeAmount
 

Definition at line 724 of file ui_shared.c.

References DC, displayContextDef_t::realTime, WINDOW_FADINGIN, WINDOW_FADINGOUT, and WINDOW_VISIBLE.

Referenced by Item_OwnerDraw_Paint(), Item_TextColor(), and Window_Paint().

00724                                                                                                                {
00725   if (*flags & (WINDOW_FADINGOUT | WINDOW_FADINGIN)) {
00726     if (DC->realTime > *nextTime) {
00727       *nextTime = DC->realTime + offsetTime;
00728       if (*flags & WINDOW_FADINGOUT) {
00729         *f -= fadeAmount;
00730         if (bFlags && *f <= 0.0) {
00731           *flags &= ~(WINDOW_FADINGOUT | WINDOW_VISIBLE);
00732         }
00733       } else {
00734         *f += fadeAmount;
00735         if (*f >= clamp) {
00736           *f = clamp;
00737           if (bFlags) {
00738             *flags &= ~WINDOW_FADINGIN;
00739           }
00740         }
00741       }
00742     }
00743   }
00744 }

qboolean Float_Parse char **  p,
float *  f
 

Definition at line 449 of file ui_shared.c.

References atof(), COM_ParseExt(), qboolean, qfalse, and qtrue.

Referenced by Color_Parse(), Rect_Parse(), Script_Orbit(), Script_Scale(), Script_SetColor(), and Script_Transition().

00449                                          {
00450         char    *token;
00451         token = COM_ParseExt((const char **)p, qfalse);
00452         if (token && token[0] != 0) {
00453                 *f = atof(token);
00454                 return qtrue;
00455         } else {
00456                 return qfalse;
00457         }
00458 }

void GradientBar_Paint rectDef_t rect,
vec4_t  color
 

Definition at line 701 of file ui_shared.c.

References displayContextDef_t::Assets, DC, displayContextDef_t::drawHandlePic, cachedAssets_t::gradientBar, rectDef_t::h, NULL, displayContextDef_t::setColor, vec4_t, rectDef_t::w, rectDef_t::x, and rectDef_t::y.

Referenced by Window_Paint().

00701                                                       {
00702         // gradient bar takes two paints
00703         DC->setColor( color );
00704         DC->drawHandlePic(rect->x, rect->y, rect->w, rect->h, DC->Assets.gradientBar);
00705         DC->setColor( NULL );
00706 }

void Init_Display displayContextDef_t dc  ) 
 

Definition at line 693 of file ui_shared.c.

References DC.

Referenced by _UI_Init(), and CG_LoadHudMenu().

00693                                            {
00694         DC = dc;
00695 }

qboolean Int_Parse char **  p,
int *  i
 

Definition at line 528 of file ui_shared.c.

References atoi(), COM_ParseExt(), qboolean, qfalse, and qtrue.

Referenced by Script_Disable(), Script_Orbit(), Script_Transition(), and Script_Transition2().

00528                                      {
00529         char    *token;
00530         token = COM_ParseExt((const char **)p, qfalse);
00531 
00532         if (token && token[0] != 0) {
00533                 *i = atoi(token);
00534                 return qtrue;
00535         } else {
00536                 return qfalse;
00537         }
00538 }

qboolean IsVisible int  flags  ) 
 

Definition at line 1013 of file ui_shared.c.

References qboolean, WINDOW_FADINGOUT, and WINDOW_VISIBLE.

Referenced by Menu_HandleMouseMove().

01013                               {
01014   return (flags & WINDOW_VISIBLE && !(flags & WINDOW_FADINGOUT));
01015 }

void Item_Action itemDef_t item  ) 
 

Definition at line 4321 of file ui_shared.c.

References itemDef_s::action, Item_RunScript(), and itemDef_t.

Referenced by Menu_HandleKey().

04321                                   {
04322   if (item) {
04323     Item_RunScript(item, item->action);
04324   }
04325 }

qboolean Item_Bind_HandleKey itemDef_t item,
int  key,
qboolean  down
 

Definition at line 5552 of file ui_shared.c.

References A_BACKSPACE, A_ENTER, A_ESCAPE, A_MOUSE1, bind_t::bind1, bind_t::bind2, BindingIDFromName(), Controls_SetConfig(), displayContextDef_t::cursorx, displayContextDef_t::cursory, itemDef_s::cvar, DC, itemDef_t, K_CHAR_FLAG, NULL, qboolean, qfalse, qtrue, windowDef_t::rect, Rect_ContainsPoint(), displayContextDef_t::setBinding, and itemDef_s::window.

Referenced by Item_HandleKey(), and Menu_HandleKey().

05552                                                                       {
05553         int                     id;
05554         int                     i;
05555 
05556         if (key == A_MOUSE1 && Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory) && !g_waitingForKey)
05557         {
05558                 if (down) {
05559                         g_waitingForKey = qtrue;
05560                         g_bindItem = item;
05561                 }
05562                 return qtrue;
05563         }
05564         else if (key == A_ENTER && !g_waitingForKey)
05565         {
05566                 if (down) 
05567                 {
05568                         g_waitingForKey = qtrue;
05569                         g_bindItem = item;
05570                 }
05571                 return qtrue;
05572         }
05573         else
05574         {
05575                 if (!g_waitingForKey || g_bindItem == NULL) {
05576                         return qfalse;
05577                 }
05578 
05579                 if (key & K_CHAR_FLAG) {
05580                         return qtrue;
05581                 }
05582 
05583                 switch (key)
05584                 {
05585                         case A_ESCAPE:
05586                                 g_waitingForKey = qfalse;
05587                                 return qtrue;
05588         
05589                         case A_BACKSPACE:
05590                                 id = BindingIDFromName(item->cvar);
05591                                 if (id != -1) 
05592                                 {
05593                                         if ( g_bindings[id].bind1 != -1 )
05594                                         {
05595                                                 DC->setBinding ( g_bindings[id].bind1, "" );
05596                                         }
05597                                         
05598                                         if ( g_bindings[id].bind2 != -1 )
05599                                         {
05600                                                 DC->setBinding ( g_bindings[id].bind2, "" );
05601                                         }
05602                                                                 
05603                                         g_bindings[id].bind1 = -1;
05604                                         g_bindings[id].bind2 = -1;
05605                                 }
05606                                 Controls_SetConfig(qtrue);
05607                                 g_waitingForKey = qfalse;
05608                                 g_bindItem = NULL;
05609                                 return qtrue;
05610 
05611                         case '`':
05612                                 return qtrue;
05613                 }
05614         }
05615 
05616         if (key != -1)
05617         {
05618 
05619                 for (i=0; i < g_bindCount; i++)
05620                 {
05621 
05622                         if (g_bindings[i].bind2 == key) {
05623                                 g_bindings[i].bind2 = -1;
05624                         }
05625 
05626                         if (g_bindings[i].bind1 == key)
05627                         {
05628                                 g_bindings[i].bind1 = g_bindings[i].bind2;
05629                                 g_bindings[i].bind2 = -1;
05630                         }
05631                 }
05632         }
05633 
05634 
05635         id = BindingIDFromName(item->cvar);
05636 
05637         if (id != -1) {
05638                 if (key == -1) {
05639                         if( g_bindings[id].bind1 != -1 ) {
05640                                 DC->setBinding( g_bindings[id].bind1, "" );
05641                                 g_bindings[id].bind1 = -1;
05642                         }
05643                         if( g_bindings[id].bind2 != -1 ) {
05644                                 DC->setBinding( g_bindings[id].bind2, "" );
05645                                 g_bindings[id].bind2 = -1;
05646                         }
05647                 }
05648                 else if (g_bindings[id].bind1 == -1) {
05649                         g_bindings[id].bind1 = key;
05650                 }
05651                 else if (g_bindings[id].bind1 != key && g_bindings[id].bind2 == -1) {
05652                         g_bindings[id].bind2 = key;
05653                 }
05654                 else {
05655                         DC->setBinding( g_bindings[id].bind1, "" );
05656                         DC->setBinding( g_bindings[id].bind2, "" );
05657                         g_bindings[id].bind1 = key;
05658                         g_bindings[id].bind2 = -1;
05659                 }                                               
05660         }
05661 
05662         Controls_SetConfig(qtrue);      
05663         g_waitingForKey = qfalse;
05664 
05665         return qtrue;
05666 }

void Item_Bind_Paint itemDef_t item  ) 
 

Definition at line 5475 of file ui_shared.c.

References BindingFromName(), itemDef_s::cvar, DC, displayContextDef_t::drawText, editFieldDef_t, windowDef_t::flags, menuDef_t::focusColor, windowDef_t::foreColor, g_nameBind1, displayContextDef_t::getCVarValue, itemDef_s::iMenuFont, Item_Text_Paint(), itemDef_t, LerpColor(), editFieldDef_s::maxPaintChars, memcpy(), itemDef_s::parent, PULSE_DIVISOR, displayContextDef_t::realTime, SCREEN_WIDTH, sin(), itemDef_s::text, displayContextDef_t::textHeight, itemDef_s::textRect, itemDef_s::textscale, itemDef_s::textStyle, displayContextDef_t::textWidth, itemDef_s::typeData, vec4_t, rectDef_t::w, itemDef_s::window, WINDOW_HASFOCUS, rectDef_t::x, and rectDef_t::y.

Referenced by Item_Paint().

05476 {
05477         vec4_t newColor, lowLight;
05478         float value;
05479         int maxChars = 0;
05480         float   textScale,textWidth;
05481         int             textHeight,yAdj,startingXPos;
05482 
05483 
05484         menuDef_t *parent = (menuDef_t*)item->parent;
05485         editFieldDef_t *editPtr = (editFieldDef_t*)item->typeData;
05486         if (editPtr) 
05487         {
05488                 maxChars = editPtr->maxPaintChars;
05489         }
05490 
05491         value = (item->cvar) ? DC->getCVarValue(item->cvar) : 0;
05492 
05493         if (item->window.flags & WINDOW_HASFOCUS) 
05494         {
05495                 if (g_bindItem == item) 
05496                 {
05497                         lowLight[0] = 0.8f * 1.0f;
05498                         lowLight[1] = 0.8f * 0.0f;
05499                         lowLight[2] = 0.8f * 0.0f;
05500                         lowLight[3] = 0.8f * 1.0f;
05501                 } 
05502                 else 
05503                 {
05504                         lowLight[0] = 0.8f * parent->focusColor[0]; 
05505                         lowLight[1] = 0.8f * parent->focusColor[1]; 
05506                         lowLight[2] = 0.8f * parent->focusColor[2]; 
05507                         lowLight[3] = 0.8f * parent->focusColor[3]; 
05508                 }
05509                 LerpColor(parent->focusColor,lowLight,newColor,0.5+0.5*sin((float)(DC->realTime / PULSE_DIVISOR)));
05510         } 
05511         else 
05512         {
05513                 memcpy(&newColor, &item->window.foreColor, sizeof(vec4_t));
05514         }
05515 
05516         if (item->text) 
05517         {
05518                 Item_Text_Paint(item);
05519                 BindingFromName(item->cvar);
05520 
05521                 // If the text runs past the limit bring the scale down until it fits.
05522                 textScale = item->textscale;
05523                 textWidth = DC->textWidth(g_nameBind1,(float) textScale, item->iMenuFont);
05524                 startingXPos = (item->textRect.x + item->textRect.w + 8);
05525 
05526                 while ((startingXPos + textWidth) >= SCREEN_WIDTH)
05527                 {
05528                         textScale -= .05f;
05529                         textWidth = DC->textWidth(g_nameBind1,(float) textScale, item->iMenuFont);
05530                 }
05531 
05532                 // Try to adjust it's y placement if the scale has changed.
05533                 yAdj = 0;
05534                 if (textScale != item->textscale)
05535                 {
05536                         textHeight = DC->textHeight(g_nameBind1, item->textscale, item->iMenuFont);
05537                         yAdj = textHeight - DC->textHeight(g_nameBind1, textScale, item->iMenuFont);
05538                 }
05539 
05540                 DC->drawText(startingXPos, item->textRect.y + yAdj, textScale, newColor, g_nameBind1, 0, maxChars, item->textStyle,item->iMenuFont);
05541         } 
05542         else 
05543         {
05544                 DC->drawText(item->textRect.x, item->textRect.y, item->textscale, newColor, (value != 0) ? "FIXME" : "FIXME", 0, maxChars, item->textStyle,item->iMenuFont);
05545         }
05546 }

qboolean Item_EnableShowViaCvar itemDef_t item,
int  flag
 

Definition at line 2360 of file ui_shared.c.

References itemDef_s::cvarFlags, itemDef_s::cvarTest, DC, itemDef_s::enableCvar, displayContextDef_t::getCVarString, itemDef_t, Q_stricmp(), Q_strncpyz(), qboolean, qfalse, qtrue, and String_Parse().

Referenced by Item_MouseEnter(), Item_OwnerDraw_Paint(), Item_Paint(), Item_SetFocus(), Item_TextColor(), and Menu_HandleMouseMove().

02360                                                            {
02361   char script[2048], *p;
02362   if (item && item->enableCvar && *item->enableCvar && item->cvarTest && *item->cvarTest) {
02363                 char buff[2048];
02364           DC->getCVarString(item->cvarTest, buff, sizeof(buff));
02365 
02366     Q_strncpyz(script, item->enableCvar, 2048);
02367     p = script;
02368     while (1) {
02369       const char *val;
02370       // expect value then ; or NULL, NULL ends list
02371       if (!String_Parse(&p, &val)) {
02372                                 return (item->cvarFlags & flag) ? qfalse : qtrue;
02373       }
02374 
02375       if (val[0] == ';' && val[1] == '\0') {
02376         continue;
02377       }
02378 
02379                         // enable it if any of the values are true
02380                         if (item->cvarFlags & flag) {
02381         if (Q_stricmp(buff, val) == 0) {
02382                                         return qtrue;
02383                                 }
02384                         } else {
02385                                 // disable it if any of the values are true
02386         if (Q_stricmp(buff, val) == 0) {
02387                                         return qfalse;
02388                                 }
02389                         }
02390 
02391     }
02392                 return (item->cvarFlags & flag) ? qfalse : qtrue;
02393   }
02394         return qtrue;
02395 }

qboolean Item_HandleAccept itemDef_t item  ) 
 

Definition at line 4271 of file ui_shared.c.

References itemDef_s::accept, Item_RunScript(), itemDef_t, qboolean, qfalse, and qtrue.

Referenced by Menu_HandleKey().

04272 {
04273         if (item->accept)
04274         {
04275                 Item_RunScript(item, item->accept);
04276                 return qtrue;
04277         }
04278         return qfalse;
04279 }

qboolean Item_HandleKey itemDef_t item,
int  key,
qboolean  down
 

Definition at line 4176 of file ui_shared.c.

References A_ENTER, A_MOUSE1, A_MOUSE2, A_MOUSE3, itemDef_s::cvar, editFieldDef_t, Item_Bind_HandleKey(), Item_ListBox_HandleKey(), Item_Multi_HandleKey(), Item_OwnerDraw_HandleKey(), Item_Slider_HandleKey(), Item_StartCapture(), Item_StopCapture(), Item_TextScroll_HandleKey(), ITEM_TYPE_BIND, ITEM_TYPE_BUTTON, ITEM_TYPE_CHECKBOX, ITEM_TYPE_COMBO, ITEM_TYPE_EDITFIELD, ITEM_TYPE_LISTBOX, ITEM_TYPE_MULTI, ITEM_TYPE_NUMERICFIELD, ITEM_TYPE_OWNERDRAW, ITEM_TYPE_RADIOBUTTON, ITEM_TYPE_SLIDER, ITEM_TYPE_TEXT, ITEM_TYPE_TEXTSCROLL, ITEM_TYPE_YESNO, Item_YesNo_HandleKey(), itemDef_t, NULL, editFieldDef_s::paintOffset, qboolean, qfalse, itemDef_s::type, and itemDef_s::typeData.

Referenced by Menu_HandleKey().

04176                                                                  {
04177 
04178         if (itemCapture) {
04179                 Item_StopCapture(itemCapture);
04180                 itemCapture = NULL;
04181                 captureFunc = 0;
04182                 captureData = NULL;
04183         } else {
04184           // bk001206 - parentheses
04185                 if ( down && ( key == A_MOUSE1 || key == A_MOUSE2 || key == A_MOUSE3 ) ) {
04186                         Item_StartCapture(item, key);
04187                 }
04188         }
04189 
04190         if (!down) {
04191                 return qfalse;
04192         }
04193 
04194   switch (item->type) {
04195     case ITEM_TYPE_BUTTON:
04196 #ifdef _XBOX
04197                         return Item_Button_HandleKey(item, key);
04198 #else
04199                         return qfalse;
04200 #endif
04201       break;
04202     case ITEM_TYPE_RADIOBUTTON:
04203       return qfalse;
04204       break;
04205     case ITEM_TYPE_CHECKBOX:
04206       return qfalse;
04207       break;
04208     case ITEM_TYPE_EDITFIELD:
04209     case ITEM_TYPE_NUMERICFIELD:
04210                 if (key == A_MOUSE1 || key == A_MOUSE2 || key == A_ENTER)
04211                 {
04212                         editFieldDef_t *editPtr = (editFieldDef_t*)item->typeData;
04213 
04214                         if (item->cvar && editPtr)
04215                         {
04216                                 editPtr->paintOffset = 0;
04217                         }
04218 
04219       //return Item_TextField_HandleKey(item, key);
04220                 }
04221       return qfalse;
04222       break;
04223     case ITEM_TYPE_COMBO:
04224       return qfalse;
04225       break;
04226     case ITEM_TYPE_LISTBOX:
04227       return Item_ListBox_HandleKey(item, key, down, qfalse);
04228       break;
04229         case ITEM_TYPE_TEXTSCROLL:
04230       return Item_TextScroll_HandleKey(item, key, down, qfalse);
04231       break;
04232     case ITEM_TYPE_YESNO:
04233       return Item_YesNo_HandleKey(item, key);
04234       break;
04235     case ITEM_TYPE_MULTI:
04236       return Item_Multi_HandleKey(item, key);
04237       break;
04238     case ITEM_TYPE_OWNERDRAW:
04239       return Item_OwnerDraw_HandleKey(item, key);
04240       break;
04241     case ITEM_TYPE_BIND:
04242                         return Item_Bind_HandleKey(item, key, down);
04243       break;
04244     case ITEM_TYPE_SLIDER:
04245       return Item_Slider_HandleKey(item, key, down);
04246       break;
04247 #ifdef _XBOX
04248         case ITEM_TYPE_TEXT:
04249           return Item_Text_HandleKey(item, key);
04250           break;
04251 #endif
04252     //case ITEM_TYPE_IMAGE:
04253     //  Item_Image_Paint(item);
04254     //  break;
04255     default:
04256       return qfalse;
04257       break;
04258   }
04259 
04260   //return qfalse;
04261 }

void Item_Image_Paint itemDef_t item  ) 
 

Definition at line 5903 of file ui_shared.c.

References itemDef_s::asset, DC, displayContextDef_t::drawHandlePic, rectDef_t::h, itemDef_t, NULL, windowDef_t::rect, rectDef_t::w, itemDef_s::window, rectDef_t::x, and rectDef_t::y.

05903                                        {
05904         if (item == NULL) {
05905                 return;
05906         }
05907         DC->drawHandlePic(item->window.rect.x+1, item->window.rect.y+1, item->window.rect.w-2, item->window.rect.h-2, item->asset);
05908 }

void Item_Init itemDef_t item  ) 
 

Definition at line 7120 of file ui_shared.c.

References itemDef_t, memset(), itemDef_s::textscale, itemDef_s::window, and Window_Init().

Referenced by MenuParse_itemDef().

07120                                 {
07121         memset(item, 0, sizeof(itemDef_t));
07122         item->textscale = 0.55f;
07123         Window_Init(&item->window);
07124 }

void Item_InitControls itemDef_t item  ) 
 

Definition at line 9259 of file ui_shared.c.

References listBoxDef_s::cursorPos, itemDef_s::cursorPos, listBoxDef_s::endPos, ITEM_TYPE_LISTBOX, itemDef_t, listBoxDef_t, NULL, listBoxDef_s::startPos, itemDef_s::type, and itemDef_s::typeData.

Referenced by MenuParse_itemDef().

09260 {
09261         if (item == NULL) 
09262         {
09263                 return;
09264         }
09265 
09266         switch ( item->type )
09267         {
09268                 case ITEM_TYPE_LISTBOX:
09269                 {
09270                         listBoxDef_t *listPtr = (listBoxDef_t*)item->typeData;
09271                         item->cursorPos = 0;
09272                         if (listPtr) 
09273                         {
09274                                 listPtr->cursorPos = 0;
09275                                 listPtr->startPos = 0;
09276                                 listPtr->endPos = 0;
09277                                 listPtr->cursorPos = 0;
09278                         }
09279 
09280                         break;
09281                 }
09282         }
09283 }

qboolean Item_ListBox_HandleKey itemDef_t item,
int  key,
qboolean  down,
qboolean  force
 

Definition at line 3220 of file ui_shared.c.

References A_CURSOR_DOWN, A_CURSOR_LEFT, A_CURSOR_RIGHT, A_CURSOR_UP, A_END, A_HOME, A_KP_1, A_KP_2, A_KP_3, A_KP_4, A_KP_6, A_KP_7, A_KP_8, A_KP_9, A_MOUSE1, A_MOUSE2, A_PAGE_DOWN, A_PAGE_UP, itemDef_s::cursorPos, listBoxDef_s::cursorPos, displayContextDef_t::cursorx, displayContextDef_t::cursory, DC, DOUBLE_CLICK_DELAY, listBoxDef_s::doubleClick, listBoxDef_s::elementHeight, listBoxDef_s::elementStyle, listBoxDef_s::elementWidth, displayContextDef_t::feederCount, displayContextDef_t::feederSelection, windowDef_t::flags, rectDef_t::h, Item_ListBox_MaxScroll(), Item_RunScript(), itemDef_t, LISTBOX_IMAGE, listBoxDef_t, listBoxDef_s::notselectable, NULL, qboolean, qfalse, qtrue, displayContextDef_t::realTime, windowDef_t::rect, Rect_ContainsPoint(), itemDef_s::special, listBoxDef_s::startPos, itemDef_s::typeData, rectDef_t::w, itemDef_s::window, WINDOW_HASFOCUS, WINDOW_HORIZONTAL, WINDOW_LB_LEFTARROW, WINDOW_LB_PGDN, WINDOW_LB_PGUP, WINDOW_LB_RIGHTARROW, and WINDOW_LB_THUMB.

Referenced by Item_HandleKey(), and Menu_ScrollFeeder().

03220                                                                                          {
03221         listBoxDef_t *listPtr = (listBoxDef_t*)item->typeData;
03222         int count = DC->feederCount(item->special);
03223         int max, viewmax;
03224 //JLFMOUSE
03225 #ifndef _XBOX
03226         if (force || (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory) && item->window.flags & WINDOW_HASFOCUS))
03227 #else
03228         if (force || item->window.flags & WINDOW_HASFOCUS)
03229 #endif
03230         {
03231                 max = Item_ListBox_MaxScroll(item);
03232                 if (item->window.flags & WINDOW_HORIZONTAL) {
03233                         viewmax = (item->window.rect.w / listPtr->elementWidth);
03234                         if ( key == A_CURSOR_LEFT || key == A_KP_4 ) 
03235                         {
03236                                 if (!listPtr->notselectable) {
03237                                         listPtr->cursorPos--;
03238 #ifdef _XBOX
03239                                         listPtr->startPos--;
03240 #endif
03241                                         if (listPtr->cursorPos < 0) {
03242                                                 listPtr->cursorPos = 0;
03243                                                 return qfalse;
03244                                         }
03245                                         if (listPtr->cursorPos < listPtr->startPos) {
03246                                                 listPtr->startPos = listPtr->cursorPos;
03247 //JLF
03248 #ifndef _XBOX
03249                                                 return qfalse;
03250 #endif
03251                                         }
03252                                         if (listPtr->cursorPos >= listPtr->startPos + viewmax) {
03253                                                 listPtr->startPos = listPtr->cursorPos - viewmax + 1;
03254                                         }
03255                                         item->cursorPos = listPtr->cursorPos;
03256                                         DC->feederSelection(item->special, item->cursorPos, NULL);
03257                                 }
03258                                 else {
03259                                         listPtr->startPos--;
03260                                         if (listPtr->startPos < 0)
03261                                                 listPtr->startPos = 0;
03262                                 }
03263                                 return qtrue;
03264                         }
03265                         if ( key == A_CURSOR_RIGHT || key == A_KP_6 ) 
03266                         {
03267                                 if (!listPtr->notselectable) {
03268                                         listPtr->cursorPos++;
03269                                         if (listPtr->cursorPos < listPtr->startPos) {
03270                                                 listPtr->startPos = listPtr->cursorPos;
03271 //JLF
03272 #ifndef _XBOX
03273                                                 return qfalse;
03274 #endif
03275                                         }
03276                                         if (listPtr->cursorPos >= count) {
03277                                                 listPtr->cursorPos = count-1;
03278                                                 return qfalse;
03279                                         }
03280                                         if (listPtr->cursorPos >= listPtr->startPos + viewmax) {
03281                                                 listPtr->startPos = listPtr->cursorPos - viewmax + 1;
03282                                         }
03283                                         item->cursorPos = listPtr->cursorPos;
03284                                         DC->feederSelection(item->special, item->cursorPos, NULL);
03285                                 }
03286                                 else {
03287                                         listPtr->startPos++;
03288                                         if (listPtr->startPos >= count)
03289                                                 listPtr->startPos = count-1;
03290                                 }
03291                                 return qtrue;
03292                         }
03293                 }
03294                 // Vertical scroll
03295                 else {
03296 
03297                         // Multiple rows and columns (since it's more than twice as wide as an element)
03298                         if (( item->window.rect.w > (listPtr->elementWidth*2)) &&  (listPtr->elementStyle == LISTBOX_IMAGE))
03299                         {
03300                                 viewmax = (item->window.rect.w / listPtr->elementWidth);
03301                         }
03302                         else 
03303                         {
03304                                 viewmax = (item->window.rect.h / listPtr->elementHeight);
03305                         }
03306 
03307                         if ( key == A_CURSOR_UP || key == A_KP_8 ) 
03308                         {
03309                                 if (!listPtr->notselectable) {
03310                                         listPtr->cursorPos--;
03311                                         if (listPtr->cursorPos < 0) {
03312                                                 listPtr->cursorPos = 0;
03313                                                 return qfalse;
03314                                         }
03315                                         if (listPtr->cursorPos < listPtr->startPos) {
03316                                                 listPtr->startPos = listPtr->cursorPos;
03317 //JLF
03318 #ifndef _XBOX
03319                                                 return qfalse;
03320 #endif
03321                                         }
03322                                         if (listPtr->cursorPos >= listPtr->startPos + viewmax) {
03323                                                 listPtr->startPos = listPtr->cursorPos - viewmax + 1;
03324                                         }
03325                                         item->cursorPos = listPtr->cursorPos;
03326                                         DC->feederSelection(item->special, item->cursorPos, NULL);
03327                                 }
03328                                 else {
03329                                         listPtr->startPos--;
03330                                         if (listPtr->startPos < 0)
03331                                                 listPtr->startPos = 0;
03332                                 }
03333                                 return qtrue;
03334                         }
03335                         if ( key == A_CURSOR_DOWN || key == A_KP_2 ) 
03336                         {
03337                                 if (!listPtr->notselectable) {
03338                                         listPtr->cursorPos++;
03339                                         if (listPtr->cursorPos < listPtr->startPos) {
03340                                                 listPtr->startPos = listPtr->cursorPos;
03341 //JLF
03342 #ifndef _XBOX
03343                                                 return qfalse;
03344 #endif
03345                                         }
03346                                         if (listPtr->cursorPos >= count) {
03347                                                 listPtr->cursorPos = count-1;
03348                                                 return qfalse;
03349                                         }
03350                                         if (listPtr->cursorPos >= listPtr->startPos + viewmax) {
03351                                                 listPtr->startPos = listPtr->cursorPos - viewmax + 1;
03352                                         }
03353                                         item->cursorPos = listPtr->cursorPos;
03354                                         DC->feederSelection(item->special, item->cursorPos, NULL);
03355                                 }
03356                                 else {
03357                                         listPtr->startPos++;
03358                                         if (listPtr->startPos > max)
03359                                                 listPtr->startPos = max;
03360                                 }
03361                                 return qtrue;
03362                         }
03363                 }
03364                 // mouse hit
03365                 if (key == A_MOUSE1 || key == A_MOUSE2) {
03366                         if (item->window.flags & WINDOW_LB_LEFTARROW) {
03367                                 listPtr->startPos--;
03368                                 if (listPtr->startPos < 0) {
03369                                         listPtr->startPos = 0;
03370                                 }
03371                         } else if (item->window.flags & WINDOW_LB_RIGHTARROW) {
03372                                 // one down
03373                                 listPtr->startPos++;
03374                                 if (listPtr->startPos > max) {
03375                                         listPtr->startPos = max;
03376                                 }
03377                         } else if (item->window.flags & WINDOW_LB_PGUP) {
03378                                 // page up
03379                                 listPtr->startPos -= viewmax;
03380                                 if (listPtr->startPos < 0) {
03381                                         listPtr->startPos = 0;
03382                                 }
03383                         } else if (item->window.flags & WINDOW_LB_PGDN) {
03384                                 // page down
03385                                 listPtr->startPos += viewmax;
03386                                 if (listPtr->startPos > (max)) {
03387                                         listPtr->startPos = (max);
03388                                 }
03389                         } else if (item->window.flags & WINDOW_LB_THUMB) {
03390                                 // Display_SetCaptureItem(item);
03391                         } else {
03392                                 // select an item
03393 #ifdef _XBOX
03394                                 if (listPtr->doubleClick) {
03395 #else
03396                                 if (DC->realTime < lastListBoxClickTime && listPtr->doubleClick) {
03397 #endif
03398                                         Item_RunScript(item, listPtr->doubleClick);
03399                                 }
03400                                 lastListBoxClickTime = DC->realTime + DOUBLE_CLICK_DELAY;
03401 //                              if (item->cursorPos != listPtr->cursorPos) 
03402                                 {
03403                                         int prePos = item->cursorPos;
03404                                         
03405                                         item->cursorPos = listPtr->cursorPos;
03406 
03407                                         if (!DC->feederSelection(item->special, item->cursorPos, item))
03408                                         {
03409                                                 item->cursorPos = listPtr->cursorPos = prePos;
03410                                         }
03411                                 }
03412                         }
03413                         return qtrue;
03414                 }
03415                 if ( key == A_HOME || key == A_KP_7) {
03416                         // home
03417                         listPtr->startPos = 0;
03418                         return qtrue;
03419                 }
03420                 if ( key == A_END || key == A_KP_1) {
03421                         // end
03422                         listPtr->startPos = max;
03423                         return qtrue;
03424                 }
03425                 if (key == A_PAGE_UP || key == A_KP_9 ) {
03426                         // page up
03427                         if (!listPtr->notselectable) {
03428                                 listPtr->cursorPos -= viewmax;
03429                                 if (listPtr->cursorPos < 0) {
03430                                         listPtr->cursorPos = 0;
03431                                 }
03432                                 if (listPtr->cursorPos < listPtr->startPos) {
03433                                         listPtr->startPos = listPtr->cursorPos;
03434                                 }
03435                                 if (listPtr->cursorPos >= listPtr->startPos + viewmax) {
03436                                         listPtr->startPos = listPtr->cursorPos - viewmax + 1;
03437                                 }
03438                                 item->cursorPos = listPtr->cursorPos;
03439                                 DC->feederSelection(item->special, item->cursorPos, NULL);
03440                         }
03441                         else {
03442                                 listPtr->startPos -= viewmax;
03443                                 if (listPtr->startPos < 0) {
03444                                         listPtr->startPos = 0;
03445                                 }
03446                         }
03447                         return qtrue;
03448                 }
03449                 if ( key == A_PAGE_DOWN || key == A_KP_3 ) {
03450                         // page down
03451                         if (!listPtr->notselectable) {
03452                                 listPtr->cursorPos += viewmax;
03453                                 if (listPtr->cursorPos < listPtr->startPos) {
03454                                         listPtr->startPos = listPtr->cursorPos;
03455                                 }
03456                                 if (listPtr->cursorPos >= count) {
03457                                         listPtr->cursorPos = count-1;
03458                                 }
03459                                 if (listPtr->cursorPos >= listPtr->startPos + viewmax) {
03460                                         listPtr->startPos = listPtr->cursorPos - viewmax + 1;
03461                                 }
03462                                 item->cursorPos = listPtr->cursorPos;
03463                                 DC->feederSelection(item->special, item->cursorPos, NULL);
03464                         }
03465                         else {
03466                                 listPtr->startPos += viewmax;
03467                                 if (listPtr->startPos > max) {
03468                                         listPtr->startPos = max;
03469                                 }
03470                         }
03471                         return qtrue;
03472                 }
03473         }
03474         return qfalse;
03475 }

int Item_ListBox_MaxScroll itemDef_t item  ) 
 

Definition at line 2707 of file ui_shared.c.

References DC, listBoxDef_s::elementHeight, listBoxDef_s::elementWidth, displayContextDef_t::feederCount, windowDef_t::flags, rectDef_t::h, itemDef_t, listBoxDef_t, windowDef_t::rect, itemDef_s::special, itemDef_s::typeData, rectDef_t::w, itemDef_s::window, and WINDOW_HORIZONTAL.

Referenced by Item_ListBox_HandleKey(), Item_ListBox_Paint(), and Item_ListBox_ThumbPosition().

02707                                             {
02708         listBoxDef_t *listPtr = (listBoxDef_t*)item->typeData;
02709         int count = DC->feederCount(item->special);
02710         int max;
02711 
02712         if (item->window.flags & WINDOW_HORIZONTAL) {
02713                 max = count - (item->window.rect.w / listPtr->elementWidth) + 1;
02714         }
02715         else {
02716                 max = count - (item->window.rect.h / listPtr->elementHeight) + 1;
02717         }
02718         if (max < 0) {
02719                 return 0;
02720         }
02721         return max;
02722 }

void Item_ListBox_MouseEnter itemDef_t item,
float  x,
float  y
 

Definition at line 2956 of file ui_shared.c.

References listBoxDef_s::cursorPos, listBoxDef_s::drawPadding, listBoxDef_s::elementHeight, listBoxDef_s::elementStyle, listBoxDef_s::elementWidth, listBoxDef_s::endPos, windowDef_t::flags, rectDef_t::h, Item_ListBox_OverLB(), itemDef_t, LISTBOX_IMAGE, listBoxDef_t, windowDef_t::rect, Rect_ContainsPoint(), SCROLLBAR_SIZE, listBoxDef_s::startPos, itemDef_s::typeData, rectDef_t::w, itemDef_s::window, WINDOW_HORIZONTAL, WINDOW_LB_LEFTARROW, WINDOW_LB_PGDN, WINDOW_LB_PGUP, WINDOW_LB_RIGHTARROW, WINDOW_LB_THUMB, rectDef_t::x, and rectDef_t::y.

Referenced by Item_MouseEnter().

02957 {
02958         rectDef_t r;
02959         listBoxDef_t *listPtr = (listBoxDef_t*)item->typeData;
02960         
02961         item->window.flags &= ~(WINDOW_LB_LEFTARROW | WINDOW_LB_RIGHTARROW | WINDOW_LB_THUMB | WINDOW_LB_PGUP | WINDOW_LB_PGDN);
02962         item->window.flags |= Item_ListBox_OverLB(item, x, y);
02963 
02964         if (item->window.flags & WINDOW_HORIZONTAL) 
02965         {
02966                 if (!(item->window.flags & (WINDOW_LB_LEFTARROW | WINDOW_LB_RIGHTARROW | WINDOW_LB_THUMB | WINDOW_LB_PGUP | WINDOW_LB_PGDN))) 
02967                 {
02968                         // check for selection hit as we have exausted buttons and thumb
02969                         if (listPtr->elementStyle == LISTBOX_IMAGE) 
02970                         {
02971                                 r.x = item->window.rect.x;
02972                                 r.y = item->window.rect.y;
02973                                 r.h = item->window.rect.h - SCROLLBAR_SIZE;
02974                                 r.w = item->window.rect.w - listPtr->drawPadding;
02975                                 if (Rect_ContainsPoint(&r, x, y)) 
02976                                 {
02977                                         listPtr->cursorPos =  (int)((x - r.x) / listPtr->elementWidth)  + listPtr->startPos;
02978                                         if (listPtr->cursorPos >= listPtr->endPos) 
02979                                         {
02980                                                 listPtr->cursorPos = listPtr->endPos;
02981                                         }
02982                                 }
02983                         } 
02984                         else 
02985                         {
02986                                 // text hit.. 
02987                         }
02988                 }
02989         } 
02990         // Window Vertical Scroll
02991         else if (!(item->window.flags & (WINDOW_LB_LEFTARROW | WINDOW_LB_RIGHTARROW | WINDOW_LB_THUMB | WINDOW_LB_PGUP | WINDOW_LB_PGDN))) 
02992         {
02993                 // Calc which element the mouse is over
02994                 r.x = item->window.rect.x;
02995                 r.y = item->window.rect.y;
02996                 r.w = item->window.rect.w - SCROLLBAR_SIZE;
02997                 r.h = item->window.rect.h - listPtr->drawPadding;
02998                 if (Rect_ContainsPoint(&r, x, y)) 
02999                 {
03000                         // Multiple rows and columns (since it's more than twice as wide as an element)
03001                         if (( item->window.rect.w > (listPtr->elementWidth*2)) &&  (listPtr->elementStyle == LISTBOX_IMAGE))
03002                         {
03003                                 int row,column,rowLength;
03004 
03005                                 row = (int)((y - 2 - r.y) / listPtr->elementHeight);
03006                                 rowLength = (int) r.w / listPtr->elementWidth;
03007                                 column = (int)((x - r.x) / listPtr->elementWidth);
03008 
03009                                 listPtr->cursorPos = (row * rowLength)+column  + listPtr->startPos;
03010                                 if (listPtr->cursorPos >= listPtr->endPos) 
03011                                 {
03012                                         listPtr->cursorPos = listPtr->endPos;
03013                                 }
03014                         }
03015                         // single column
03016                         else
03017                         {
03018                                 listPtr->cursorPos =  (int)((y - 2 - r.y) / listPtr->elementHeight)  + listPtr->startPos;
03019                                 if (listPtr->cursorPos > listPtr->endPos) 
03020                                 {
03021                     listPtr->cursorPos = listPtr->endPos;
03022                                 }
03023                         }
03024                 }
03025         }
03026 }

int Item_ListBox_OverLB itemDef_t item,
float  x,
float  y
 

Definition at line 2837 of file ui_shared.c.

References DC, listBoxDef_s::elementStyle, listBoxDef_s::elementWidth, displayContextDef_t::feederCount, windowDef_t::flags, rectDef_t::h, Item_ListBox_ThumbPosition(), itemDef_t, LISTBOX_IMAGE, listBoxDef_t, windowDef_t::rect, Rect_ContainsPoint(), SCROLLBAR_SIZE, itemDef_s::special, itemDef_s::typeData, rectDef_t::w, itemDef_s::window, WINDOW_HORIZONTAL, WINDOW_LB_LEFTARROW, WINDOW_LB_PGDN, WINDOW_LB_PGUP, WINDOW_LB_RIGHTARROW, WINDOW_LB_THUMB, rectDef_t::x, and rectDef_t::y.

Referenced by Item_ListBox_MouseEnter(), and Item_StartCapture().

02838 {
02839         rectDef_t r;
02840         listBoxDef_t *listPtr;
02841         int thumbstart;
02842         int count;
02843 
02844         count = DC->feederCount(item->special);
02845         listPtr = (listBoxDef_t*)item->typeData;
02846         if (item->window.flags & WINDOW_HORIZONTAL) 
02847         {
02848                 // check if on left arrow
02849                 r.x = item->window.rect.x;
02850                 r.y = item->window.rect.y + item->window.rect.h - SCROLLBAR_SIZE;
02851                 r.h = r.w = SCROLLBAR_SIZE;
02852                 if (Rect_ContainsPoint(&r, x, y)) 
02853                 {
02854                         return WINDOW_LB_LEFTARROW;
02855                 }
02856 
02857                 // check if on right arrow
02858                 r.x = item->window.rect.x + item->window.rect.w - SCROLLBAR_SIZE;
02859                 if (Rect_ContainsPoint(&r, x, y)) 
02860                 {
02861                         return WINDOW_LB_RIGHTARROW;
02862                 }
02863 
02864                 // check if on thumb
02865                 thumbstart = Item_ListBox_ThumbPosition(item);
02866                 r.x = thumbstart;
02867                 if (Rect_ContainsPoint(&r, x, y)) 
02868                 {
02869                         return WINDOW_LB_THUMB;
02870                 }
02871 
02872                 r.x = item->window.rect.x + SCROLLBAR_SIZE;
02873                 r.w = thumbstart - r.x;
02874                 if (Rect_ContainsPoint(&r, x, y)) 
02875                 {
02876                         return WINDOW_LB_PGUP;
02877                 }
02878 
02879                 r.x = thumbstart + SCROLLBAR_SIZE;
02880                 r.w = item->window.rect.x + item->window.rect.w - SCROLLBAR_SIZE;
02881                 if (Rect_ContainsPoint(&r, x, y)) 
02882                 {
02883                         return WINDOW_LB_PGDN;
02884                 }
02885         }
02886         // Vertical Scroll
02887         else 
02888         {
02889                 // Multiple rows and columns (since it's more than twice as wide as an element)
02890                 if (( item->window.rect.w > (listPtr->elementWidth*2)) &&  (listPtr->elementStyle == LISTBOX_IMAGE))
02891                 {
02892                         r.x = item->window.rect.x + item->window.rect.w - SCROLLBAR_SIZE;
02893                         r.y = item->window.rect.y;
02894                         r.h = r.w = SCROLLBAR_SIZE;
02895                         if (Rect_ContainsPoint(&r, x, y)) 
02896                         {
02897                                 return WINDOW_LB_PGUP;
02898                         }
02899 
02900                         r.y = item->window.rect.y + item->window.rect.h - SCROLLBAR_SIZE;
02901                         if (Rect_ContainsPoint(&r, x, y)) 
02902                         {
02903                                 return WINDOW_LB_PGDN;
02904                         }
02905 
02906                         thumbstart = Item_ListBox_ThumbPosition(item);
02907                         r.y = thumbstart;
02908                         if (Rect_ContainsPoint(&r, x, y)) 
02909                         {
02910                                 return WINDOW_LB_THUMB;
02911                         }
02912 
02913                 }
02914                 else
02915                 {
02916                         r.x = item->window.rect.x + item->window.rect.w - SCROLLBAR_SIZE;
02917                         r.y = item->window.rect.y;
02918                         r.h = r.w = SCROLLBAR_SIZE;
02919                         if (Rect_ContainsPoint(&r, x, y)) 
02920                         {
02921                                 return WINDOW_LB_LEFTARROW;
02922                         }
02923 
02924                         r.y = item->window.rect.y + item->window.rect.h - SCROLLBAR_SIZE;
02925                         if (Rect_ContainsPoint(&r, x, y)) 
02926                         {
02927                                 return WINDOW_LB_RIGHTARROW;
02928                         }
02929 
02930                         thumbstart = Item_ListBox_ThumbPosition(item);
02931                         r.y = thumbstart;
02932                         if (Rect_ContainsPoint(&r, x, y)) 
02933                         {
02934                                 return WINDOW_LB_THUMB;
02935                         }
02936 
02937                         r.y = item->window.rect.y + SCROLLBAR_SIZE;
02938                         r.h = thumbstart - r.y;
02939                         if (Rect_ContainsPoint(&r, x, y)) 
02940                         {
02941                                 return WINDOW_LB_PGUP;
02942                         }
02943 
02944                         r.y = thumbstart + SCROLLBAR_SIZE;
02945                         r.h = item->window.rect.y + item->window.rect.h - SCROLLBAR_SIZE;
02946                         if (Rect_ContainsPoint(&r, x, y)) 
02947                         {
02948                                 return WINDOW_LB_PGDN;
02949                         }
02950                 }
02951         }
02952         return 0;
02953 }

void Item_ListBox_Paint itemDef_t item  ) 
 

Definition at line 5979 of file ui_shared.c.

References displayContextDef_t::Assets, windowDef_t::borderColor, windowDef_t::borderSize, COLOR_MAX, listBoxDef_s::columnInfo, itemDef_s::cursorPos, listBoxDef_s::cursorPos, DC, displayContextDef_t::drawHandlePic, listBoxDef_s::drawPadding, displayContextDef_t::drawRect, displayContextDef_t::drawText, listBoxDef_s::elementHeight, listBoxDef_s::elementStyle, listBoxDef_s::elementWidth, listBoxDef_s::endPos, displayContextDef_t::feederCount, displayContextDef_t::feederItemImage, displayContextDef_t::feederItemText, displayContextDef_t::feederSelection, displayContextDef_t::fillRect, windowDef_t::flags, windowDef_t::foreColor, rectDef_t::h, itemDef_s::iMenuFont, vmCvar_t::integer, Item_ListBox_MaxScroll(), Item_ListBox_ThumbDrawPosition(), itemDef_t, LISTBOX_IMAGE, listBoxDef_t, MAX_STRING_CHARS, columnInfo_s::maxChars, NULL, listBoxDef_s::numColumns, windowDef_t::outlineColor, columnInfo_s::pos, qhandle_t, windowDef_t::rect, cachedAssets_t::scrollBar, SCROLLBAR_SIZE, cachedAssets_t::scrollBarArrowDown, cachedAssets_t::scrollBarArrowLeft, cachedAssets_t::scrollBarArrowRight, cachedAssets_t::scrollBarArrowUp, cachedAssets_t::scrollBarThumb, listBoxDef_s::scrollhidden, displayContextDef_t::setColor, itemDef_s::special, listBoxDef_s::startPos, itemDef_s::textaligny, displayContextDef_t::textHeight, itemDef_s::textscale, itemDef_s::textStyle, trap_SP_GetStringTextString(), itemDef_s::typeData, ui_char_color_blue, ui_char_color_green, ui_char_color_red, vec4_t, rectDef_t::w, itemDef_s::window, WINDOW_HORIZONTAL, WINDOW_PLAYERCOLOR, rectDef_t::x, and rectDef_t::y.

Referenced by Item_Paint().

05979                                          {
05980         float x, y, sizeWidth, count, i, i2,sizeHeight, thumb;
05981         int startPos;
05982         qhandle_t image;
05983         qhandle_t optionalImage1, optionalImage2, optionalImage3;
05984         listBoxDef_t *listPtr = (listBoxDef_t*)item->typeData;
05985 //JLF MPMOVED
05986         int numlines;
05987 
05988 
05989         // the listbox is horizontal or vertical and has a fixed size scroll bar going either direction
05990         // elements are enumerated from the DC and either text or image handles are acquired from the DC as well
05991         // textscale is used to size the text, textalignx and textaligny are used to size image elements
05992         // there is no clipping available so only the last completely visible item is painted
05993         count = DC->feederCount(item->special);
05994 
05995 //JLFLISTBOX  MPMOVED
05996 #ifdef _XBOX
05997         listPtr->startPos = listPtr->cursorPos;
05998         //item->cursorPos = listPtr->startPos;
05999 #endif
06000 //JLFLISTBOX MPMOVED
06001         if (listPtr->startPos > (count?count-1:count))
06002         {//probably changed feeders, so reset
06003                 listPtr->startPos = 0;
06004         }
06005 //JLF END
06006         if (item->cursorPos > (count?count-1:count))
06007         {//probably changed feeders, so reset
06008                 item->cursorPos = (count?count-1:count);
06009                 // NOTE : might consider moving this to any spot in here we change the cursor position
06010                 DC->feederSelection( item->special, item->cursorPos, NULL );
06011         }
06012 
06013         
06014 
06015         // default is vertical if horizontal flag is not here
06016         if (item->window.flags & WINDOW_HORIZONTAL) 
06017         {
06018 #ifdef  _DEBUG
06019                 const char *text;
06020 #endif
06021 
06022 //JLF new variable (code just indented) MPMOVED
06023                 if (!listPtr->scrollhidden)
06024                 {
06025                 // draw scrollbar in bottom of the window
06026                 // bar
06027                         if (Item_ListBox_MaxScroll(item) > 0) 
06028                         {
06029                                 x = item->window.rect.x + 1;
06030                                 y = item->window.rect.y + item->window.rect.h - SCROLLBAR_SIZE - 1;
06031                                 DC->drawHandlePic(x, y, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarArrowLeft);
06032                                 x += SCROLLBAR_SIZE - 1;
06033                                 sizeWidth = item->window.rect.w - (SCROLLBAR_SIZE * 2);
06034                                 DC->drawHandlePic(x, y, sizeWidth+1, SCROLLBAR_SIZE, DC->Assets.scrollBar);
06035                                 x += sizeWidth - 1;
06036                                 DC->drawHandlePic(x, y, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarArrowRight);
06037                                 // thumb
06038                                 thumb = Item_ListBox_ThumbDrawPosition(item);//Item_ListBox_ThumbPosition(item);
06039                                 if (thumb > x - SCROLLBAR_SIZE - 1) {
06040                                         thumb = x - SCROLLBAR_SIZE - 1;
06041                                 }
06042                                 DC->drawHandlePic(thumb, y, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarThumb);
06043                         }
06044                         else if (listPtr->startPos > 0)
06045                         {
06046                                 listPtr->startPos = 0;
06047                         }
06048                 }
06049 //JLF end
06050                 //
06051                 listPtr->endPos = listPtr->startPos;
06052                 sizeWidth = item->window.rect.w - 2;
06053                 // items
06054                 // size contains max available space
06055                 if (listPtr->elementStyle == LISTBOX_IMAGE) 
06056                 {
06057                         // fit = 0;
06058                         x = item->window.rect.x + 1;
06059                         y = item->window.rect.y + 1;
06060                         for (i = listPtr->startPos; i < count; i++) 
06061                         {
06062                                 // always draw at least one
06063                                 // which may overdraw the box if it is too small for the element
06064                                 image = DC->feederItemImage(item->special, i);
06065                                 if (image) 
06066                                 {
06067 #ifndef CGAME
06068                                         if (item->window.flags & WINDOW_PLAYERCOLOR) 
06069                                         {
06070                                                 vec4_t  color;
06071 
06072                                                 color[0] = ui_char_color_red.integer/COLOR_MAX;
06073                                                 color[1] = ui_char_color_green.integer/COLOR_MAX;
06074                                                 color[2] = ui_char_color_blue.integer/COLOR_MAX;
06075                                                 color[3] = 1.0f;
06076                                                 DC->setColor(color);
06077                                         }
06078 #endif
06079                                         DC->drawHandlePic(x+1, y+1, listPtr->elementWidth - 2, listPtr->elementHeight - 2, image);
06080                                 }
06081 
06082                                 if (i == item->cursorPos) 
06083                                 {
06084                                         DC->drawRect(x, y, listPtr->elementWidth-1, listPtr->elementHeight-1, item->window.borderSize, item->window.borderColor);
06085                                 }
06086 
06087                                 sizeWidth -= listPtr->elementWidth;
06088                                 if (sizeWidth < listPtr->elementWidth) 
06089                                 {
06090                                         listPtr->drawPadding = sizeWidth; //listPtr->elementWidth - size;
06091                                         break;
06092                                 }
06093                                 x += listPtr->elementWidth;
06094                                 listPtr->endPos++;
06095                                 // fit++;
06096                         }
06097                 } 
06098                 else 
06099                 {
06100                         //
06101                 }
06102 
06103 #ifdef  _DEBUG
06104                 // Show pic name
06105                 text = DC->feederItemText(item->special, item->cursorPos, 0, &optionalImage1, &optionalImage2, &optionalImage3);
06106                 if (text) 
06107                 {
06108                         DC->drawText(item->window.rect.x, item->window.rect.y+item->window.rect.h, item->textscale, item->window.foreColor, text, 0, 0, item->textStyle, item->iMenuFont);
06109                 }
06110 #endif
06111 
06112         } 
06113         // A vertical list box
06114         else 
06115         {
06116 //JLF MPMOVED
06117                 numlines = item->window.rect.h / listPtr->elementHeight;
06118 //JLFEND
06119                 //JLF new variable (code idented with if)
06120                 if (!listPtr->scrollhidden)
06121                 {
06122 
06123                         // draw scrollbar to right side of the window
06124                         x = item->window.rect.x + item->window.rect.w - SCROLLBAR_SIZE - 1;
06125                         y = item->window.rect.y + 1;
06126                         DC->drawHandlePic(x, y, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarArrowUp);
06127                         y += SCROLLBAR_SIZE - 1;
06128 
06129                         listPtr->endPos = listPtr->startPos;
06130                         sizeHeight = item->window.rect.h - (SCROLLBAR_SIZE * 2);
06131                         DC->drawHandlePic(x, y, SCROLLBAR_SIZE, sizeHeight+1, DC->Assets.scrollBar);
06132                         y += sizeHeight - 1;
06133                         DC->drawHandlePic(x, y, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarArrowDown);
06134                         // thumb
06135                         thumb = Item_ListBox_ThumbDrawPosition(item);//Item_ListBox_ThumbPosition(item);
06136                         if (thumb > y - SCROLLBAR_SIZE - 1) {
06137                                 thumb = y - SCROLLBAR_SIZE - 1;
06138                         }
06139                         DC->drawHandlePic(x, thumb, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarThumb);
06140                 }
06141 //JLF end
06142 
06143                 // adjust size for item painting
06144                 sizeWidth = item->window.rect.w - 2;
06145                 sizeHeight = item->window.rect.h - 2;
06146 
06147                 if (listPtr->elementStyle == LISTBOX_IMAGE) 
06148                 {
06149                         // Multiple rows and columns (since it's more than twice as wide as an element)
06150                         if ( item->window.rect.w > (listPtr->elementWidth*2) )
06151                         {
06152                                 startPos = listPtr->startPos;
06153                                 x = item->window.rect.x + 1;
06154                                 y = item->window.rect.y + 1;
06155                                 // Next row
06156                                 for (i2 = startPos; i2 < count; i2++) 
06157                                 {
06158                                         x = item->window.rect.x + 1;
06159                                         sizeWidth = item->window.rect.w - 2;
06160                                         // print a row
06161                                         for (i = startPos; i < count; i++) 
06162                                         {
06163                                                 // always draw at least one
06164                                                 // which may overdraw the box if it is too small for the element
06165                                                 image = DC->feederItemImage(item->special, i);
06166                                                 if (image) 
06167                                                 {
06168                 #ifndef CGAME
06169                                                         if (item->window.flags & WINDOW_PLAYERCOLOR) 
06170                                                         {
06171                                                                 vec4_t  color;
06172 
06173                                                                 color[0] = ui_char_color_red.integer/COLOR_MAX;
06174                                                                 color[1] = ui_char_color_green.integer/COLOR_MAX;
06175                                                                 color[2] = ui_char_color_blue.integer/COLOR_MAX;
06176                                                                 color[3] = 1.0f;
06177                                                                 DC->setColor(color);
06178                                                         }
06179                 #endif
06180                                                         DC->drawHandlePic(x+1, y+1, listPtr->elementWidth - 2, listPtr->elementHeight - 2, image);
06181                                                 }
06182 
06183                                                 if (i == item->cursorPos) 
06184                                                 {
06185                                                         DC->drawRect(x, y, listPtr->elementWidth-1, listPtr->elementHeight-1, item->window.borderSize, item->window.borderColor);
06186                                                 }
06187 
06188                                                 sizeWidth -= listPtr->elementWidth;
06189                                                 if (sizeWidth < listPtr->elementWidth) 
06190                                                 {
06191                                                         listPtr->drawPadding = sizeWidth; //listPtr->elementWidth - size;
06192                                                         break;
06193                                                 }
06194                                                 x += listPtr->elementWidth;
06195                                                 listPtr->endPos++;
06196                                         }
06197 
06198                                         sizeHeight -= listPtr->elementHeight;
06199                                         if (sizeHeight < listPtr->elementHeight) 
06200                                         {
06201                                                 listPtr->drawPadding = sizeHeight; //listPtr->elementWidth - size;
06202                                                 break;
06203                                         }
06204                                         // NOTE : Is endPos supposed to be valid or not? It was being used as a valid entry but I changed those
06205                                         // few spots that were causing bugs
06206                                         listPtr->endPos++;
06207                                         startPos = listPtr->endPos;
06208                                         y += listPtr->elementHeight;
06209 
06210                                 }
06211                         }
06212                         // single column
06213                         else
06214                         {
06215                                 x = item->window.rect.x + 1;
06216                                 y = item->window.rect.y + 1;
06217                                 for (i = listPtr->startPos; i < count; i++) 
06218                                 {
06219                                         // always draw at least one
06220                                         // which may overdraw the box if it is too small for the element
06221                                         image = DC->feederItemImage(item->special, i);
06222                                         if (image) 
06223                                         {
06224                                                 DC->drawHandlePic(x+1, y+1, listPtr->elementWidth - 2, listPtr->elementHeight - 2, image);
06225                                         }
06226 
06227                                         if (i == item->cursorPos) 
06228                                         {
06229                                                 DC->drawRect(x, y, listPtr->elementWidth - 1, listPtr->elementHeight - 1, item->window.borderSize, item->window.borderColor);
06230                                         }
06231 
06232                                         listPtr->endPos++;
06233                                         sizeHeight -= listPtr->elementHeight;
06234                                         if (sizeHeight < listPtr->elementHeight) 
06235                                         {
06236                                                 listPtr->drawPadding = listPtr->elementHeight - sizeHeight;
06237                                                 break;
06238                                         }
06239                                         y += listPtr->elementHeight;
06240                                         // fit++;
06241                                 }
06242                         }
06243                 } 
06244                 else 
06245                 {
06246                         x = item->window.rect.x + 1;
06247                         y = item->window.rect.y + 1;
06248 //JLF MPMOVED
06249                         y = item->window.rect.y + 1 - listPtr->elementHeight;
06250 #ifdef _XBOX
06251                         i = listPtr->startPos - (numlines/2);
06252 #else
06253                         i = listPtr->startPos;
06254 #endif
06255 
06256                         for (; i < count; i++) 
06257 //JLF END
06258                         {
06259                                 const char *text;
06260                                 // always draw at least one
06261                                 // which may overdraw the box if it is too small for the element
06262                                 if (listPtr->numColumns > 0) {
06263                                         int j;//, subX = listPtr->elementHeight;
06264 
06265                                         for (j = 0; j < listPtr->numColumns; j++) 
06266                                         {
06267                                                 char    temp[MAX_STRING_CHARS];
06268                                                 int imageStartX = listPtr->columnInfo[j].pos;
06269                                                 text = DC->feederItemText(item->special, i, j, &optionalImage1, &optionalImage2, &optionalImage3);
06270 
06271                                                 if( !text )
06272                                                 {
06273                                                         continue;
06274                                                 }
06275 
06276                                                 if (text[0]=='@')
06277                                                 {
06278                                                         trap_SP_GetStringTextString( &text[1]  , temp, sizeof(temp));
06279                                                         text = temp;
06280                                                 }
06281 
06282                                                 /*
06283                                                 if (optionalImage >= 0) {
06284                                                         DC->drawHandlePic(x + 4 + listPtr->columnInfo[j].pos, y - 1 + listPtr->elementHeight / 2, listPtr->columnInfo[j].width, listPtr->columnInfo[j].width, optionalImage);
06285                                                 } 
06286                                                 else 
06287                                                 */
06288                                                 if ( text )
06289                                                 {
06290 //JLF MPMOVED
06291 #ifdef _XBOX
06292                                                         float fScaleA = item->textscale;
06293 #endif
06294                                                         int textyOffset;
06295 #ifdef _XBOX
06296                                                         textyOffset = DC->textHeight (text, fScaleA, item->iMenuFont);
06297                                                         textyOffset *= -1;
06298                                                         textyOffset /=2;
06299                                                         textyOffset += listPtr->elementHeight/2;
06300 #else
06301                                                         textyOffset = 0;
06302 #endif
06303 //                                                      DC->drawText(x + 4 + listPtr->columnInfo[j].pos, y + listPtr->elementHeight, item->textscale, item->window.foreColor, text, 0, listPtr->columnInfo[j].maxChars, item->textStyle);
06304         //WAS LAST                                              DC->drawText(x + 4 + listPtr->columnInfo[j].pos, y, item->textscale, item->window.foreColor, text, 0, listPtr->columnInfo[j].maxChars, item->textStyle, item->iMenuFont);
06305                                                         DC->drawText(x + 4 + listPtr->columnInfo[j].pos, y + listPtr->elementHeight+ textyOffset + item->textaligny, item->textscale, item->window.foreColor, text, 0,listPtr->columnInfo[j].maxChars, item->textStyle, item->iMenuFont);
06306 
06307 
06308 //JLF END
06309                                                 }
06310                                                 if ( j < listPtr->numColumns - 1 )
06311                                                 {
06312                                                         imageStartX = listPtr->columnInfo[j+1].pos;
06313                                                 }
06314                                                 DC->setColor( NULL );
06315                                                 if (optionalImage3 >= 0) 
06316                                                 {
06317                                                         DC->drawHandlePic(imageStartX - listPtr->elementHeight*3, y+listPtr->elementHeight+2, listPtr->elementHeight, listPtr->elementHeight, optionalImage3);
06318                                                 } 
06319                                                 if (optionalImage2 >= 0) 
06320                                                 {
06321                                                         DC->drawHandlePic(imageStartX - listPtr->elementHeight*2, y+listPtr->elementHeight+2, listPtr->elementHeight, listPtr->elementHeight, optionalImage2);
06322                                                 } 
06323                                                 if (optionalImage1 >= 0) 
06324                                                 {
06325                                                         DC->drawHandlePic(imageStartX - listPtr->elementHeight, y+listPtr->elementHeight+2, listPtr->elementHeight, listPtr->elementHeight, optionalImage1);
06326                                                 } 
06327                                         }
06328                                 } 
06329                                 else 
06330                                 {
06331 #ifdef _XBOX
06332                                         if (i >= 0)
06333                                         {
06334 #endif
06335                                         text = DC->feederItemText(item->special, i, 0, &optionalImage1, &optionalImage2, &optionalImage3 );
06336                                         if ( optionalImage1 >= 0 || optionalImage2 >= 0 || optionalImage3 >= 0) 
06337                                         {
06338                                                 //DC->drawHandlePic(x + 4 + listPtr->elementHeight, y, listPtr->columnInfo[j].width, listPtr->columnInfo[j].width, optionalImage);
06339                                         } 
06340                                         else if (text) 
06341                                         {
06342 //                                              DC->drawText(x + 4, y + listPtr->elementHeight, item->textscale, item->window.foreColor, text, 0, 0, item->textStyle);
06343                                                 DC->drawText(x + 4, y + item->textaligny, item->textscale, item->window.foreColor, text, 0, 0, item->textStyle, item->iMenuFont);
06344                                         }
06345 #ifdef _XBOX
06346                                         }
06347 #endif
06348                                 }
06349 
06350                                 if (i == item->cursorPos) 
06351                                 {
06352                                         DC->fillRect(x + 2, y + listPtr->elementHeight + 2, item->window.rect.w - SCROLLBAR_SIZE - 4, listPtr->elementHeight, item->window.outlineColor);
06353                                 }
06354 
06355                                 sizeHeight -= listPtr->elementHeight;
06356                                 if (sizeHeight < listPtr->elementHeight) 
06357                                 {
06358                                         listPtr->drawPadding = listPtr->elementHeight - sizeHeight;
06359                                         break;
06360                                 }
06361                                 listPtr->endPos++;
06362                                 y += listPtr->elementHeight;
06363                                 // fit++;
06364                         }
06365                 }
06366         }
06367 }

int Item_ListBox_ThumbDrawPosition itemDef_t item  ) 
 

Definition at line 2751 of file ui_shared.c.

References displayContextDef_t::cursorx, displayContextDef_t::cursory, DC, windowDef_t::flags, rectDef_t::h, Item_ListBox_ThumbPosition(), itemDef_t, min, windowDef_t::rect, SCROLLBAR_SIZE, rectDef_t::w, itemDef_s::window, WINDOW_HORIZONTAL, rectDef_t::x, and rectDef_t::y.

Referenced by Item_ListBox_Paint().

02752 {
02753         int min, max;
02754 
02755         if (itemCapture == item) 
02756         {
02757                 if (item->window.flags & WINDOW_HORIZONTAL) 
02758                 {
02759                         min = item->window.rect.x + SCROLLBAR_SIZE + 1;
02760                         max = item->window.rect.x + item->window.rect.w - 2*SCROLLBAR_SIZE - 1;
02761                         if (DC->cursorx >= min + SCROLLBAR_SIZE/2 && DC->cursorx <= max + SCROLLBAR_SIZE/2) 
02762                         {
02763                                 return DC->cursorx - SCROLLBAR_SIZE/2;
02764                         }
02765                         else 
02766                         {
02767                                 return Item_ListBox_ThumbPosition(item);
02768                         }
02769                 }
02770                 else 
02771                 {
02772                         min = item->window.rect.y + SCROLLBAR_SIZE + 1;
02773                         max = item->window.rect.y + item->window.rect.h - 2*SCROLLBAR_SIZE - 1;
02774                         if (DC->cursory >= min + SCROLLBAR_SIZE/2 && DC->cursory <= max + SCROLLBAR_SIZE/2) 
02775                         {
02776                                 return DC->cursory - SCROLLBAR_SIZE/2;
02777                         }
02778                         else 
02779                         {
02780                                 return Item_ListBox_ThumbPosition(item);
02781                         }
02782                 }
02783         }
02784         else 
02785         {
02786                 return Item_ListBox_ThumbPosition(item);
02787         }
02788 }

int Item_ListBox_ThumbPosition itemDef_t item  ) 
 

Definition at line 2724 of file ui_shared.c.

References windowDef_t::flags, rectDef_t::h, Item_ListBox_MaxScroll(), itemDef_t, listBoxDef_t, windowDef_t::rect, SCROLLBAR_SIZE, listBoxDef_s::startPos, itemDef_s::typeData, rectDef_t::w, itemDef_s::window, WINDOW_HORIZONTAL, rectDef_t::x, and rectDef_t::y.

Referenced by Item_ListBox_OverLB(), and Item_ListBox_ThumbDrawPosition().

02724                                                 {
02725         float max, pos, size;
02726         listBoxDef_t *listPtr = (listBoxDef_t*)item->typeData;
02727 
02728         max = Item_ListBox_MaxScroll(item);
02729         if (item->window.flags & WINDOW_HORIZONTAL) {
02730                 size = item->window.rect.w - (SCROLLBAR_SIZE * 2) - 2;
02731                 if (max > 0) {
02732                         pos = (size-SCROLLBAR_SIZE) / (float) max;
02733                 } else {
02734                         pos = 0;
02735                 }
02736                 pos *= listPtr->startPos;
02737                 return item->window.rect.x + 1 + SCROLLBAR_SIZE + pos;
02738         }
02739         else {
02740                 size = item->window.rect.h - (SCROLLBAR_SIZE * 2) - 2;
02741                 if (max > 0) {
02742                         pos = (size-SCROLLBAR_SIZE) / (float) max;
02743                 } else {
02744                         pos = 0;
02745                 }
02746                 pos *= listPtr->startPos;
02747                 return item->window.rect.y + 1 + SCROLLBAR_SIZE + pos;
02748         }
02749 }

void Item_Model_Paint itemDef_t item  ) 
 

Definition at line 5694 of file ui_shared.c.

References displayContextDef_t::addRefEntityToScene, modelDef_s::angle, AnglesToAxis(), animTable, itemDef_s::asset, displayContextDef_t::Assets, atan2(), refEntity_t::axis, AxisClear(), BOTH_FORCE_GETUP_F1, BOTH_FORCEINAIR1, BOTH_FORCEJUMP1, BOTH_FORCELAND1, BOTH_FORCELONGLEAP_LAND, BOTH_FORCELONGLEAP_START, BOTH_FORCEWALLREBOUND_FORWARD, BOTH_FORCEWALLRUNFLIP_END, BOTH_FORCEWALLRUNFLIP_START, BOTH_GETUP_BROLL_F, BOTH_GETUP_BROLL_R, BOTH_KNOCKDOWN1, BOTH_KNOCKDOWN2, BOTH_KNOCKDOWN3, CHAN_LOCAL, displayContextDef_t::clearScene, Com_sprintf(), refEntity_t::customSkin, DC, itemDef_s::flags, modelDef_s::fov_x, refdef_t::fov_x, modelDef_s::fov_y, refdef_t::fov_y, modelDef_s::g2anim, modelDef_s::g2maxs, modelDef_s::g2mins, modelDef_s::g2scale, modelDef_s::g2skin, refEntity_t::ghoul2, itemDef_s::ghoul2, rectDef_t::h, refdef_t::height, refEntity_t::hModel, vmCvar_t::integer, itemDef_t, ItemParse_asset_model_go(), ItemParse_model_g2anim_go(), ITF_ISANYSABER, ITF_ISCHARACTER, refEntity_t::lightingOrigin, M_PI, MAX_QPATH, memset(), displayContextDef_t::modelBounds, modelDef_t, refEntity_t::modelScale, uiInfo_t::moveAnimTime, cachedAssets_t::moveJumpSound, cachedAssets_t::moveRollSound, uiInfo_t::movesBaseAnim, name, NULL, refEntity_t::oldorigin, refEntity_t::origin, qtrue, refEntity_t::radius, RDF_NOWORLDMODEL, refdef_t::rdflags, displayContextDef_t::realTime, windowDef_t::rect, refEntity_t::renderfx, displayContextDef_t::renderScene, RF_LIGHTING_ORIGIN, RF_NOSHADOW, modelDef_s::rotationSpeed, refEntity_t::shaderRGBA, tan(), itemDef_s::textscale, refdef_t::time, trap_S_StartLocalSound(), itemDef_s::typeData, ui_char_color_blue, ui_char_color_green, ui_char_color_red, UI_Cvar_VariableString(), UI_SaberAttachToChar(), UI_SaberDrawBlades(), UI_ScaleModelAxis(), UI_UpdateCharacterSkin(), uiInfo_t::uiDC, uiInfo, vec3_t, VectorCopy, VectorSet, refdef_t::viewaxis, rectDef_t::w, refdef_t::width, itemDef_s::window, refdef_t::x, rectDef_t::x, displayContextDef_t::xscale, refdef_t::y, rectDef_t::y, and displayContextDef_t::yscale.

Referenced by Item_Paint().

05695 {
05696         float x, y, w, h;
05697         refdef_t refdef;
05698         refEntity_t             ent;
05699         vec3_t                  mins, maxs, origin;
05700         vec3_t                  angles;
05701         modelDef_t *modelPtr = (modelDef_t*)item->typeData;
05702 
05703         if (modelPtr == NULL) 
05704         {
05705                 return;
05706         }
05707 
05708         // a moves datapad anim is playing
05709 #ifndef CGAME
05710         if (uiInfo.moveAnimTime && (uiInfo.moveAnimTime < uiInfo.uiDC.realTime))
05711         {
05712                 modelDef_t *modelPtr;
05713                 modelPtr = (modelDef_t*)item->typeData;
05714                 if (modelPtr)
05715                 {
05716                         char modelPath[MAX_QPATH];
05717 
05718                         Com_sprintf( modelPath, sizeof( modelPath ), "models/players/%s/model.glm", UI_Cvar_VariableString ( "ui_char_model" ) );
05719                         //HACKHACKHACK: check for any multi-part anim sequences, and play the next anim, if needbe
05720                         switch( modelPtr->g2anim )
05721                         {
05722                         case BOTH_FORCEWALLREBOUND_FORWARD:
05723                         case BOTH_FORCEJUMP1: 
05724                                 ItemParse_model_g2anim_go( item, animTable[BOTH_FORCEINAIR1].name );
05725                                 ItemParse_asset_model_go( item, modelPath, &uiInfo.moveAnimTime );
05726                                 if ( !uiInfo.moveAnimTime )
05727                                 {
05728                                         uiInfo.moveAnimTime = 500;
05729                                 }
05730                                 uiInfo.moveAnimTime += uiInfo.uiDC.realTime;
05731                                 break;
05732                         case BOTH_FORCEINAIR1:
05733                                 ItemParse_model_g2anim_go( item, animTable[BOTH_FORCELAND1].name );
05734                                 ItemParse_asset_model_go( item, modelPath, &uiInfo.moveAnimTime );
05735                                 uiInfo.moveAnimTime += uiInfo.uiDC.realTime;
05736                                 break;
05737                         case BOTH_FORCEWALLRUNFLIP_START:
05738                                 ItemParse_model_g2anim_go( item, animTable[BOTH_FORCEWALLRUNFLIP_END].name );
05739                                 ItemParse_asset_model_go( item, modelPath, &uiInfo.moveAnimTime );
05740                                 uiInfo.moveAnimTime += uiInfo.uiDC.realTime;
05741                                 break;
05742                         case BOTH_FORCELONGLEAP_START:
05743                                 ItemParse_model_g2anim_go( item, animTable[BOTH_FORCELONGLEAP_LAND].name );
05744                                 ItemParse_asset_model_go( item, modelPath, &uiInfo.moveAnimTime );
05745                                 uiInfo.moveAnimTime += uiInfo.uiDC.realTime;
05746                                 break;
05747                         case BOTH_KNOCKDOWN3://on front - into force getup
05748                                 trap_S_StartLocalSound( uiInfo.uiDC.Assets.moveJumpSound, CHAN_LOCAL );
05749                                 ItemParse_model_g2anim_go( item, animTable[BOTH_FORCE_GETUP_F1].name );
05750                                 ItemParse_asset_model_go( item, modelPath, &uiInfo.moveAnimTime );
05751                                 uiInfo.moveAnimTime += uiInfo.uiDC.realTime;
05752                                 break;
05753                         case BOTH_KNOCKDOWN2://on back - kick forward getup
05754                                 trap_S_StartLocalSound( uiInfo.uiDC.Assets.moveJumpSound, CHAN_LOCAL );
05755                                 ItemParse_model_g2anim_go( item, animTable[BOTH_GETUP_BROLL_F].name );
05756                                 ItemParse_asset_model_go( item, modelPath, &uiInfo.moveAnimTime );
05757                                 uiInfo.moveAnimTime += uiInfo.uiDC.realTime;
05758                                 break;
05759                         case BOTH_KNOCKDOWN1://on back - roll-away
05760                                 trap_S_StartLocalSound( uiInfo.uiDC.Assets.moveRollSound, CHAN_LOCAL );
05761                                 ItemParse_model_g2anim_go( item, animTable[BOTH_GETUP_BROLL_R].name );
05762                                 ItemParse_asset_model_go( item, modelPath, &uiInfo.moveAnimTime );
05763                                 uiInfo.moveAnimTime += uiInfo.uiDC.realTime;
05764                                 break;
05765                         default:
05766                                 ItemParse_model_g2anim_go( item,  uiInfo.movesBaseAnim );
05767                                 ItemParse_asset_model_go( item, modelPath, &uiInfo.moveAnimTime );
05768                                 uiInfo.moveAnimTime = 0;
05769                                 break;
05770                         }
05771 
05772                         UI_UpdateCharacterSkin();
05773 
05774                         //update saber models
05775                         UI_SaberAttachToChar( item );
05776                 }
05777         }
05778 #endif
05779 
05780         // setup the refdef
05781         memset( &refdef, 0, sizeof( refdef ) );
05782 
05783         refdef.rdflags = RDF_NOWORLDMODEL;
05784         AxisClear( refdef.viewaxis );
05785         x = item->window.rect.x+1;
05786         y = item->window.rect.y+1;
05787         w = item->window.rect.w-2;
05788         h = item->window.rect.h-2;
05789 
05790         refdef.x = x * DC->xscale;
05791         refdef.y = y * DC->yscale;
05792         refdef.width = w * DC->xscale;
05793         refdef.height = h * DC->yscale;
05794 
05795         if (item->ghoul2)
05796         { //ghoul2 models don't have bounds, so we have to parse them.
05797                 VectorCopy(modelPtr->g2mins, mins);
05798                 VectorCopy(modelPtr->g2maxs, maxs);
05799 
05800                 if (!mins[0] && !mins[1] && !mins[2] &&
05801                         !maxs[0] && !maxs[1] && !maxs[2])
05802                 { //we'll use defaults then I suppose.
05803                         VectorSet(mins, -16, -16, -24);
05804                         VectorSet(maxs, 16, 16, 32);
05805                 }
05806         }
05807         else
05808         {
05809                 DC->modelBounds( item->asset, mins, maxs );
05810         }
05811 
05812         origin[2] = -0.5 * ( mins[2] + maxs[2] );
05813         origin[1] = 0.5 * ( mins[1] + maxs[1] );
05814 
05815         // calculate distance so the model nearly fills the box
05816         if (qtrue) 
05817         {
05818                 float len = 0.5 * ( maxs[2] - mins[2] );                
05819                 origin[0] = len / 0.268;        // len / tan( fov/2 )
05820                 //origin[0] = len / tan(w/2);
05821         } 
05822         else 
05823         {
05824                 origin[0] = item->textscale;
05825         }
05826         refdef.fov_x = (modelPtr->fov_x) ? modelPtr->fov_x : (int)((float)refdef.width / 640.0f * 90.0f);
05827         refdef.fov_y = (modelPtr->fov_y) ? modelPtr->fov_y : atan2( refdef.height, refdef.width / tan( refdef.fov_x / 360 * M_PI ) ) * ( 360 / M_PI );
05828         
05829         //refdef.fov_x = (int)((float)refdef.width / 640.0f * 90.0f);
05830         //refdef.fov_y = atan2( refdef.height, refdef.width / tan( refdef.fov_x / 360 * M_PI ) ) * ( 360 / M_PI );
05831 
05832         DC->clearScene();
05833 
05834         refdef.time = DC->realTime;
05835 
05836         // add the model
05837 
05838         memset( &ent, 0, sizeof(ent) );
05839 
05840         // use item storage to track
05841         if ( (item->flags&ITF_ISANYSABER) && !(item->flags&ITF_ISCHARACTER) )
05842         {//hack to put saber on it's side
05843                 if (modelPtr->rotationSpeed) 
05844                 {
05845                         VectorSet( angles, modelPtr->angle+(float)refdef.time/modelPtr->rotationSpeed, 0, 90 );
05846                 }
05847                 else
05848                 {
05849                         VectorSet( angles, modelPtr->angle, 0, 90 );
05850                 }
05851         }
05852         else if (modelPtr->rotationSpeed) 
05853         {
05854                 VectorSet( angles, 0, modelPtr->angle + (float)refdef.time/modelPtr->rotationSpeed, 0 );
05855         }
05856         else 
05857         {
05858                 VectorSet( angles, 0, modelPtr->angle, 0 );
05859         }
05860 
05861         AnglesToAxis( angles, ent.axis );
05862 
05863         if (item->ghoul2)
05864         {
05865                 ent.ghoul2 = item->ghoul2;
05866                 ent.radius = 1000;
05867                 ent.customSkin = modelPtr->g2skin;
05868 
05869                 VectorCopy(modelPtr->g2scale, ent.modelScale);
05870                 UI_ScaleModelAxis(&ent);
05871 #ifndef CGAME
05872                 if ( (item->flags&ITF_ISCHARACTER) )
05873                 {
05874                         ent.shaderRGBA[0] = ui_char_color_red.integer;
05875                         ent.shaderRGBA[1] = ui_char_color_green.integer;
05876                         ent.shaderRGBA[2] = ui_char_color_blue.integer;
05877                         ent.shaderRGBA[3] = 255;
05878 //                      UI_TalkingHead(item);
05879                 }
05880                 if ( item->flags&ITF_ISANYSABER )
05881                 {//UGH, draw the saber blade!
05882                         UI_SaberDrawBlades( item, origin, angles );
05883                 }
05884 #endif
05885         }
05886         else
05887         {
05888                 ent.hModel = item->asset;
05889         }
05890         VectorCopy( origin, ent.origin );
05891         VectorCopy( ent.origin, ent.oldorigin );
05892 
05893         // Set up lighting
05894         VectorCopy( origin, ent.lightingOrigin );
05895         ent.renderfx = RF_LIGHTING_ORIGIN | RF_NOSHADOW;
05896 
05897         DC->addRefEntityToScene( &ent );
05898         DC->renderScene( &refdef );
05899 
05900 }

void Item_MouseEnter itemDef_t item,
float  x,
float  y
 

Definition at line 3028 of file ui_shared.c.

References CVAR_DISABLE, CVAR_ENABLE, CVAR_HIDE, CVAR_SHOW, itemDef_s::cvarFlags, itemDef_s::disabled, windowDef_t::flags, itemDef_s::flags, rectDef_t::h, Item_EnableShowViaCvar(), Item_ListBox_MouseEnter(), Item_RunScript(), Item_TextScroll_MouseEnter(), ITEM_TYPE_LISTBOX, ITEM_TYPE_TEXTSCROLL, itemDef_t, itemDef_s::mouseEnter, itemDef_s::mouseEnterText, itemDef_s::mouseExitText, Rect_ContainsPoint(), itemDef_s::textRect, itemDef_s::type, itemDef_s::window, WINDOW_HASFOCUS, WINDOW_MOUSEOVER, WINDOW_MOUSEOVERTEXT, and rectDef_t::y.

Referenced by Menu_HandleMouseMove().

03028                                                         {
03029 
03030         rectDef_t r;
03031         if (item) {
03032                 r = item->textRect;
03033                 r.y -= r.h;
03034                 // in the text rect?
03035 
03036                 // items can be enabled and disabled 
03037                 if (item->disabled) 
03038                 {
03039                         return;
03040                 }
03041 
03042                 // items can be enabled and disabled based on cvars
03043                 if (item->cvarFlags & (CVAR_ENABLE | CVAR_DISABLE) && !Item_EnableShowViaCvar(item, CVAR_ENABLE)) {
03044                         return;
03045                 }
03046 
03047                 if (item->cvarFlags & (CVAR_SHOW | CVAR_HIDE) && !Item_EnableShowViaCvar(item, CVAR_SHOW)) {
03048                         return;
03049                 }
03050 
03051 //JLFMOUSE 
03052 #ifndef _XBOX
03053                 if (Rect_ContainsPoint(&r, x, y)) 
03054 #else
03055                 if (item->flags & WINDOW_HASFOCUS)
03056 #endif
03057                 {
03058                         if (!(item->window.flags & WINDOW_MOUSEOVERTEXT)) {
03059                                 Item_RunScript(item, item->mouseEnterText);
03060                                 item->window.flags |= WINDOW_MOUSEOVERTEXT;
03061                         }
03062                         if (!(item->window.flags & WINDOW_MOUSEOVER)) {
03063                                 Item_RunScript(item, item->mouseEnter);
03064                                 item->window.flags |= WINDOW_MOUSEOVER;
03065                         }
03066 
03067                 } else {
03068                         // not in the text rect
03069                         if (item->window.flags & WINDOW_MOUSEOVERTEXT) {
03070                                 // if we were
03071                                 Item_RunScript(item, item->mouseExitText);
03072                                 item->window.flags &= ~WINDOW_MOUSEOVERTEXT;
03073                         }
03074                         if (!(item->window.flags & WINDOW_MOUSEOVER)) {
03075                                 Item_RunScript(item, item->mouseEnter);
03076                                 item->window.flags |= WINDOW_MOUSEOVER;
03077                         }
03078 
03079                         if (item->type == ITEM_TYPE_LISTBOX) {
03080                                 Item_ListBox_MouseEnter(item, x, y);
03081                         }
03082                         else if ( item->type == ITEM_TYPE_TEXTSCROLL )
03083                         {
03084                                 Item_TextScroll_MouseEnter ( item, x, y );
03085                         }
03086                 }
03087         }
03088 }

void Item_MouseLeave itemDef_t item  ) 
 

Definition at line 3090 of file ui_shared.c.

References windowDef_t::flags, Item_RunScript(), itemDef_t, itemDef_s::mouseExit, itemDef_s::mouseExitText, itemDef_s::window, WINDOW_LB_LEFTARROW, WINDOW_LB_RIGHTARROW, and WINDOW_MOUSEOVERTEXT.

Referenced by Menu_HandleMouseMove().

03090                                       {
03091   if (item) {
03092     if (item->window.flags & WINDOW_MOUSEOVERTEXT) {
03093       Item_RunScript(item, item->mouseExitText);
03094       item->window.flags &= ~WINDOW_MOUSEOVERTEXT;
03095     }
03096     Item_RunScript(item, item->mouseExit);
03097     item->window.flags &= ~(WINDOW_LB_RIGHTARROW | WINDOW_LB_LEFTARROW);
03098   }
03099 }

int Item_Multi_CountSettings itemDef_t item  ) 
 

Definition at line 3504 of file ui_shared.c.

References multiDef_s::count, itemDef_t, multiDef_t, NULL, and itemDef_s::typeData.

Referenced by Item_Multi_HandleKey().

03504                                               {
03505         multiDef_t *multiPtr = (multiDef_t*)item->typeData;
03506         if (multiPtr == NULL) {
03507                 return 0;
03508         }
03509         return multiPtr->count;
03510 }

int Item_Multi_FindCvarByValue itemDef_t item  ) 
 

Definition at line 3512 of file ui_shared.c.

References multiDef_s::count, itemDef_s::cvar, multiDef_s::cvarStr, multiDef_s::cvarValue, DC, displayContextDef_t::getCVarString, displayContextDef_t::getCVarValue, itemDef_t, multiDef_t, Q_stricmp(), multiDef_s::strDef, and itemDef_s::typeData.

Referenced by Item_Multi_HandleKey().

03512                                                 {
03513         char buff[2048];
03514         float value = 0;
03515         int i;
03516         multiDef_t *multiPtr = (multiDef_t*)item->typeData;
03517         if (multiPtr) {
03518                 if (multiPtr->strDef) {
03519             DC->getCVarString(item->cvar, buff, sizeof(buff));
03520                 } else {
03521                         value = DC->getCVarValue(item->cvar);
03522                 }
03523                 for (i = 0; i < multiPtr->count; i++) {
03524                         if (multiPtr->strDef) {
03525                                 if (Q_stricmp(buff, multiPtr->cvarStr[i]) == 0) {
03526                                         return i;
03527                                 }
03528                         } else {
03529                                 if (multiPtr->cvarValue[i] == value) {
03530                                         return i;
03531                                 }
03532                         }
03533                 }
03534         }
03535         return 0;
03536 }

qboolean Item_Multi_HandleKey itemDef_t item,
int  key
 

Definition at line 3581 of file ui_shared.c.

References A_CURSOR_LEFT, A_CURSOR_RIGHT, A_ENTER, A_MOUSE1, A_MOUSE2, A_MOUSE3, displayContextDef_t::cursorx, displayContextDef_t::cursory, itemDef_s::cvar, multiDef_s::cvarStr, multiDef_s::cvarValue, DC, displayContextDef_t::feederSelection, windowDef_t::flags, Item_Multi_CountSettings(), Item_Multi_FindCvarByValue(), itemDef_t, multiDef_t, qboolean, qfalse, qtrue, windowDef_t::rect, Rect_ContainsPoint(), displayContextDef_t::setCVar, itemDef_s::special, multiDef_s::strDef, itemDef_s::typeData, va(), itemDef_s::window, and WINDOW_HASFOCUS.

Referenced by Item_HandleKey().

03582 {
03583         multiDef_t *multiPtr = (multiDef_t*)item->typeData;
03584         if (multiPtr) 
03585         {
03586 //JLF MPMOVED
03587 #ifndef _XBOX
03588                 if (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory) && item->window.flags & WINDOW_HASFOCUS) 
03589 #else
03590                 if (item->window.flags & WINDOW_HASFOCUS)// JLF* && item->cvar)
03591 #endif
03592                 {
03593 #ifndef _XBOX
03594                                         
03595                         if (key == A_MOUSE1 || key == A_ENTER || key == A_MOUSE2 || key == A_MOUSE3) 
03596 #else
03597 //JLFDPAD MPMOVED
03598                         if ( key == A_CURSOR_RIGHT || key == A_CURSOR_LEFT)
03599 //end JLFDPAD
03600 #endif
03601                         {
03602                                 int current = Item_Multi_FindCvarByValue(item);
03603                                 int max = Item_Multi_CountSettings(item);
03604 
03605                                 if (key == A_MOUSE2 || key == A_CURSOR_LEFT)    // Xbox uses CURSOR_LEFT
03606                                 {
03607                                         current--;
03608                                         if ( current < 0 ) 
03609                                         {
03610                                                 current = max-1;
03611                                         }
03612                                 }
03613                                 else
03614                                 {
03615                                         current++;
03616                                         if ( current >= max ) 
03617                                         {
03618                                                 current = 0;
03619                                         }
03620                                 }
03621 
03622                                 if (multiPtr->strDef) 
03623                                 {
03624                                         DC->setCVar(item->cvar, multiPtr->cvarStr[current]);
03625                                 } 
03626                                 else 
03627                                 {
03628                                         float value = multiPtr->cvarValue[current];
03629                                         if (((float)((int) value)) == value) 
03630                                         {
03631                                                 DC->setCVar(item->cvar, va("%i", (int) value ));
03632                                         }
03633                                         else 
03634                                         {
03635                                                 DC->setCVar(item->cvar, va("%f", value ));
03636                                         }
03637                                 }
03638                                 if (item->special)
03639                                 {//its a feeder?
03640                                         DC->feederSelection(item->special, current, item);
03641                                 }
03642 
03643                                 return qtrue;
03644                         }
03645                 }
03646         }
03647   return qfalse;
03648 }

void Item_Multi_Paint itemDef_t item  ) 
 

Definition at line 5128 of file ui_shared.c.

References DC, displayContextDef_t::drawText, windowDef_t::flags, menuDef_t::focusColor, windowDef_t::foreColor, displayContextDef_t::getCVarString, itemDef_s::iMenuFont, Item_Multi_Setting(), Item_Text_Paint(), itemDef_t, LerpColor(), MAX_STRING_CHARS, memcpy(), itemDef_s::parent, PULSE_DIVISOR, displayContextDef_t::realTime, sin(), itemDef_s::text, itemDef_s::textRect, itemDef_s::textscale, itemDef_s::textStyle, trap_SP_GetStringTextString(), vec4_t, rectDef_t::w, itemDef_s::window, WINDOW_HASFOCUS, rectDef_t::x, itemDef_s::xoffset, and rectDef_t::y.

Referenced by Item_Paint().

05128                                        {
05129         vec4_t newColor, lowLight;
05130         const char *text = "";
05131         menuDef_t *parent = (menuDef_t*)item->parent;
05132         char    temp[MAX_STRING_CHARS];
05133 
05134         if (item->window.flags & WINDOW_HASFOCUS) {
05135                 lowLight[0] = 0.8 * parent->focusColor[0]; 
05136                 lowLight[1] = 0.8 * parent->focusColor[1]; 
05137                 lowLight[2] = 0.8 * parent->focusColor[2]; 
05138                 lowLight[3] = 0.8 * parent->focusColor[3]; 
05139                 LerpColor(parent->focusColor,lowLight,newColor,0.5+0.5*sin((float)(DC->realTime / PULSE_DIVISOR)));
05140         } else {
05141                 memcpy(&newColor, &item->window.foreColor, sizeof(vec4_t));
05142         }
05143 
05144         text = Item_Multi_Setting(item);
05145         if (*text == '@')       // string reference
05146         {
05147                 trap_SP_GetStringTextString( &text[1]  , temp, sizeof(temp));
05148                 text = temp;
05149         }
05150         // Is is specifying a cvar to get the item name from?
05151         else if (*text == '*')
05152         {
05153                 DC->getCVarString(&text[1], temp, sizeof(temp));
05154                 text = temp;
05155         }
05156 
05157         if (item->text) {
05158                 Item_Text_Paint(item);
05159 //JLF  MPMOVED
05160 #ifdef _XBOX
05161                 if ( item->xoffset)
05162                         DC->drawText(item->textRect.x + item->textRect.w + item->xoffset, item->textRect.y, item->textscale, newColor, text, 0,0, item->textStyle, item->iMenuFont);
05163                 else
05164 #endif
05165                         DC->drawText(item->textRect.x + item->textRect.w + 8, item->textRect.y, item->textscale, newColor, text, 0, 0, item->textStyle,item->iMenuFont);
05166         } else {
05167                 //JLF added xoffset
05168                 DC->drawText(item->textRect.x+item->xoffset, item->textRect.y, item->textscale, newColor, text, 0, 0, item->textStyle,item->iMenuFont);
05169         }
05170 }

const char* Item_Multi_Setting itemDef_t item  ) 
 

Definition at line 3538 of file ui_shared.c.

References multiDef_s::count, itemDef_s::cvar, multiDef_s::cvarList, multiDef_s::cvarStr, multiDef_s::cvarValue, DC, displayContextDef_t::getCVarString, displayContextDef_t::getCVarValue, itemDef_t, multiDef_t, Q_stricmp(), multiDef_s::strDef, and itemDef_s::typeData.

Referenced by Item_Multi_Paint().

03538                                                 {
03539         char buff[2048];
03540         float value = 0;
03541         int i;
03542         multiDef_t *multiPtr = (multiDef_t*)item->typeData;
03543         if (multiPtr) 
03544         {
03545                 if (multiPtr->strDef) 
03546                 {
03547                         if (item->cvar)
03548                         {
03549                             DC->getCVarString(item->cvar, buff, sizeof(buff));
03550                         }
03551                 } 
03552                 else 
03553                 {
03554                         if (item->cvar) // Was a cvar given?
03555                         {
03556                                 value = DC->getCVarValue(item->cvar);
03557                         }
03558                 }
03559 
03560                 for (i = 0; i < multiPtr->count; i++) 
03561                 {
03562                         if (multiPtr->strDef) 
03563                         {
03564                                 if (Q_stricmp(buff, multiPtr->cvarStr[i]) == 0) 
03565                                 {
03566                                         return multiPtr->cvarList[i];
03567                                 }
03568                         } 
03569                         else 
03570                         {
03571                                 if (multiPtr->cvarValue[i] == value) 
03572                                 {
03573                                         return multiPtr->cvarList[i];
03574                                 }
03575                         }
03576                 }
03577         }
03578         return "";
03579 }

qboolean Item_OwnerDraw_HandleKey itemDef_t item,
int  key
 

Definition at line 3122 of file ui_shared.c.

References A_MOUSE1, A_MOUSE2, displayContextDef_t::cursorx, displayContextDef_t::cursory, DC, itemDef_t, windowDef_t::ownerDraw, windowDef_t::ownerDrawFlags, displayContextDef_t::ownerDrawHandleKey, qboolean, qfalse, windowDef_t::rect, Rect_ContainsPoint(), itemDef_s::special, UI_FORCE_RANK_ABSORB, UI_FORCE_RANK_DRAIN, UI_FORCE_RANK_GRIP, UI_FORCE_RANK_HEAL, UI_FORCE_RANK_LEVITATION, UI_FORCE_RANK_LIGHTNING, UI_FORCE_RANK_PROTECT, UI_FORCE_RANK_PULL, UI_FORCE_RANK_PUSH, UI_FORCE_RANK_RAGE, UI_FORCE_RANK_SABERATTACK, UI_FORCE_RANK_SABERDEFEND, UI_FORCE_RANK_SABERTHROW, UI_FORCE_RANK_SEE, UI_FORCE_RANK_SPEED, UI_FORCE_RANK_TEAM_FORCE, UI_FORCE_RANK_TEAM_HEAL, UI_FORCE_RANK_TELEPATHY, UI_FORCE_SIDE, and itemDef_s::window.

Referenced by Item_HandleKey().

03122                                                             {
03123   if (item && DC->ownerDrawHandleKey)
03124   {
03125         
03126           // yep this is an ugly hack
03127           if( key == A_MOUSE1 || key == A_MOUSE2 )
03128           {
03129                 switch( item->window.ownerDraw )
03130                 {
03131                         case UI_FORCE_SIDE:
03132                         case UI_FORCE_RANK_HEAL:
03133                         case UI_FORCE_RANK_LEVITATION:
03134                         case UI_FORCE_RANK_SPEED:
03135                         case UI_FORCE_RANK_PUSH:
03136                         case UI_FORCE_RANK_PULL:
03137                         case UI_FORCE_RANK_TELEPATHY:
03138                         case UI_FORCE_RANK_GRIP:
03139                         case UI_FORCE_RANK_LIGHTNING:
03140                         case UI_FORCE_RANK_RAGE:
03141                         case UI_FORCE_RANK_PROTECT:
03142                         case UI_FORCE_RANK_ABSORB:
03143                         case UI_FORCE_RANK_TEAM_HEAL:
03144                         case UI_FORCE_RANK_TEAM_FORCE:
03145                         case UI_FORCE_RANK_DRAIN:
03146                         case UI_FORCE_RANK_SEE:
03147                         case UI_FORCE_RANK_SABERATTACK:
03148                         case UI_FORCE_RANK_SABERDEFEND:
03149                         case UI_FORCE_RANK_SABERTHROW:
03150                                 if(!Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory) )
03151                                 {
03152                                         return qfalse;
03153                                 }
03154                                 break;
03155                 }
03156           }
03157           
03158 
03159     return DC->ownerDrawHandleKey(item->window.ownerDraw, item->window.ownerDrawFlags, &item->special, key);
03160   }
03161   return qfalse;
03162 }

void Item_OwnerDraw_Paint itemDef_t item  ) 
 

Definition at line 6370 of file ui_shared.c.

References itemDef_s::alignment, windowDef_t::background, BLINK_DIVISOR, colorRangeDef_t::color, itemDef_s::colorRanges, CVAR_DISABLE, CVAR_ENABLE, itemDef_s::cvarFlags, DC, menuDef_t::disableColor, itemDef_s::disabled, Fade(), menuDef_t::fadeAmount, menuDef_t::fadeClamp, menuDef_t::fadeCycle, windowDef_t::flags, menuDef_t::focusColor, windowDef_t::foreColor, displayContextDef_t::getValue, rectDef_t::h, colorRangeDef_t::high, itemDef_s::iMenuFont, Item_EnableShowViaCvar(), Item_Text_Paint(), ITEM_TEXTSTYLE_BLINK, itemDef_t, LerpColor(), colorRangeDef_t::low, memcpy(), windowDef_t::nextTime, NULL, itemDef_s::numColors, windowDef_t::ownerDraw, windowDef_t::ownerDrawFlags, displayContextDef_t::ownerDrawItem, itemDef_s::parent, PULSE_DIVISOR, qtrue, displayContextDef_t::realTime, windowDef_t::rect, sin(), itemDef_s::special, itemDef_s::text, itemDef_s::textalignx, itemDef_s::textaligny, itemDef_s::textRect, itemDef_s::textscale, itemDef_s::textStyle, vec4_t, rectDef_t::w, itemDef_s::window, WINDOW_HASFOCUS, rectDef_t::x, and rectDef_t::y.

Referenced by Item_Paint().

06370                                            {
06371   menuDef_t *parent;
06372 
06373         if (item == NULL) {
06374                 return;
06375         }
06376   parent = (menuDef_t*)item->parent;
06377 
06378         if (DC->ownerDrawItem) {
06379                 vec4_t color, lowLight;
06380                 menuDef_t *parent = (menuDef_t*)item->parent;
06381                 Fade(&item->window.flags, &item->window.foreColor[3], parent->fadeClamp, &item->window.nextTime, parent->fadeCycle, qtrue, parent->fadeAmount);
06382                 memcpy(&color, &item->window.foreColor, sizeof(color));
06383                 if (item->numColors > 0 && DC->getValue) {
06384                         // if the value is within one of the ranges then set color to that, otherwise leave at default
06385                         int i;
06386                         float f = DC->getValue(item->window.ownerDraw);
06387                         for (i = 0; i < item->numColors; i++) {
06388                                 if (f >= item->colorRanges[i].low && f <= item->colorRanges[i].high) {
06389                                         memcpy(&color, &item->colorRanges[i].color, sizeof(color));
06390                                         break;
06391                                 }
06392                         }
06393                 }
06394 
06395                 if (item->window.flags & WINDOW_HASFOCUS) {
06396                         lowLight[0] = 0.8 * parent->focusColor[0]; 
06397                         lowLight[1] = 0.8 * parent->focusColor[1]; 
06398                         lowLight[2] = 0.8 * parent->focusColor[2]; 
06399                         lowLight[3] = 0.8 * parent->focusColor[3]; 
06400                         LerpColor(parent->focusColor,lowLight,color,0.5+0.5*sin((float)(DC->realTime / PULSE_DIVISOR)));
06401                 } else if (item->textStyle == ITEM_TEXTSTYLE_BLINK && !((DC->realTime/BLINK_DIVISOR) & 1)) {
06402                         lowLight[0] = 0.8 * item->window.foreColor[0]; 
06403                         lowLight[1] = 0.8 * item->window.foreColor[1]; 
06404                         lowLight[2] = 0.8 * item->window.foreColor[2]; 
06405                         lowLight[3] = 0.8 * item->window.foreColor[3]; 
06406                         LerpColor(item->window.foreColor,lowLight,color,0.5+0.5*sin((float)(DC->realTime / PULSE_DIVISOR)));
06407                 }
06408 
06409                 if (item->disabled) 
06410                 {
06411                         memcpy(color, parent->disableColor, sizeof(vec4_t)); // bk001207 - FIXME: Com_Memcpy
06412                 }
06413 
06414                 if (item->cvarFlags & (CVAR_ENABLE | CVAR_DISABLE) && !Item_EnableShowViaCvar(item, CVAR_ENABLE)) {
06415                   memcpy(color, parent->disableColor, sizeof(vec4_t)); // bk001207 - FIXME: Com_Memcpy
06416                 }
06417         
06418                 if (item->text) {
06419                         Item_Text_Paint(item);
06420                                 if (item->text[0]) {
06421                                         // +8 is an offset kludge to properly align owner draw items that have text combined with them
06422                                         DC->ownerDrawItem(item->textRect.x + item->textRect.w + 8, item->window.rect.y, item->window.rect.w, item->window.rect.h, 0, item->textaligny, item->window.ownerDraw, item->window.ownerDrawFlags, item->alignment, item->special, item->textscale, color, item->window.background, item->textStyle,item->iMenuFont);
06423                                 } else {
06424                                         DC->ownerDrawItem(item->textRect.x + item->textRect.w, item->window.rect.y, item->window.rect.w, item->window.rect.h, 0, item->textaligny, item->window.ownerDraw, item->window.ownerDrawFlags, item->alignment, item->special, item->textscale, color, item->window.background, item->textStyle,item->iMenuFont);
06425                                 }
06426                         } else {
06427                         DC->ownerDrawItem(item->window.rect.x, item->window.rect.y, item->window.rect.w, item->window.rect.h, item->textalignx, item->textaligny, item->window.ownerDraw, item->window.ownerDrawFlags, item->alignment, item->special, item->textscale, color, item->window.background, item->textStyle,item->iMenuFont);
06428                 }
06429         }
06430 }

void Item_Paint itemDef_t item  ) 
 

Definition at line 6433 of file ui_shared.c.

References cos(), CVAR_HIDE, CVAR_SHOW, itemDef_s::cvarFlags, DC, menuDef_t::descAlignment, menuDef_t::descColor, menuDef_t::descScale, itemDef_s::descText, menuDef_t::descX, menuDef_t::descY, Display_KeyBindPending(), displayContextDef_t::drawRect, displayContextDef_t::drawText, menuDef_t::fadeAmount, menuDef_t::fadeClamp, menuDef_t::fadeCycle, windowDef_t::flags, FONT_MEDIUM, FONT_SMALL2, modelDef_s::fov_Effectx, modelDef_s::fov_Effecty, modelDef_s::fov_x, modelDef_s::fov_x2, modelDef_s::fov_y, modelDef_s::fov_y2, modelDef_s::g2maxs, modelDef_s::g2maxs2, modelDef_s::g2maxsEffect, modelDef_s::g2mins, modelDef_s::g2mins2, modelDef_s::g2minsEffect, rectDef_t::h, ITEM_ALIGN_CENTER, ITEM_ALIGN_RIGHT, Item_Bind_Paint(), Item_EnableShowViaCvar(), Item_ListBox_Paint(), Item_Model_Paint(), Item_Multi_Paint(), Item_OwnerDraw_Paint(), Item_Slider_Paint(), Item_Text_Paint(), Item_TextColor(), Item_TextField_Paint(), Item_TextScroll_Paint(), ITEM_TYPE_BIND, ITEM_TYPE_BUTTON, ITEM_TYPE_CHECKBOX, ITEM_TYPE_COMBO, ITEM_TYPE_EDITFIELD, ITEM_TYPE_LISTBOX, ITEM_TYPE_MODEL, ITEM_TYPE_MULTI, ITEM_TYPE_NUMERICFIELD, ITEM_TYPE_OWNERDRAW, ITEM_TYPE_RADIOBUTTON, ITEM_TYPE_SLIDER, ITEM_TYPE_TEXT, ITEM_TYPE_TEXTSCROLL, ITEM_TYPE_YESNO, Item_UpdatePosition(), Item_YesNo_Paint(), itemDef_t, M_PI, MAX_STRING_CHARS, modelDef_t, windowDef_t::nextTime, NULL, windowDef_t::offsetTime, windowDef_t::ownerDrawFlags, displayContextDef_t::ownerDrawVisible, itemDef_s::parent, displayContextDef_t::realTime, windowDef_t::rect, windowDef_t::rectClient, windowDef_t::rectEffects, windowDef_t::rectEffects2, SCREEN_WIDTH, sin(), displayContextDef_t::textHeight, itemDef_s::textStyle, displayContextDef_t::textWidth, trap_SP_GetStringTextString(), itemDef_s::type, itemDef_s::typeData, vec4_t, rectDef_t::w, itemDef_s::window, WINDOW_HASFOCUS, WINDOW_INTRANSITION, WINDOW_INTRANSITIONMODEL, WINDOW_MOUSEOVER, WINDOW_ORBITING, Window_Paint(), WINDOW_TIMEDVISIBLE, WINDOW_VISIBLE, rectDef_t::x, and rectDef_t::y.

Referenced by Menu_Paint().

06434 {
06435         vec4_t          red;
06436         menuDef_t *parent = (menuDef_t*)item->parent;
06437         int                     xPos,textWidth;
06438         vec4_t          color = {1, 1, 1, 1};
06439 
06440         red[0] = red[3] = 1;
06441         red[1] = red[2] = 0;
06442 
06443         if (item == NULL) 
06444         {
06445                 return;
06446         }
06447 
06448         if (item->window.flags & WINDOW_ORBITING) 
06449         {
06450                 if (DC->realTime > item->window.nextTime) 
06451                 {
06452                         float rx, ry, a, c, s, w, h;
06453       
06454                         item->window.nextTime = DC->realTime + item->window.offsetTime;
06455                         // translate
06456                         w = item->window.rectClient.w / 2;
06457                         h = item->window.rectClient.h / 2;
06458                         rx = item->window.rectClient.x + w - item->window.rectEffects.x;
06459                         ry = item->window.rectClient.y + h - item->window.rectEffects.y;
06460                         a = 3 * M_PI / 180;
06461                         c = cos(a);
06462                         s = sin(a);
06463                         item->window.rectClient.x = (rx * c - ry * s) + item->window.rectEffects.x - w;
06464                         item->window.rectClient.y = (rx * s + ry * c) + item->window.rectEffects.y - h;
06465                         Item_UpdatePosition(item);
06466                 }
06467         }
06468 
06469 
06470         if (item->window.flags & WINDOW_INTRANSITION) 
06471         {
06472                 if (DC->realTime > item->window.nextTime) 
06473                 {
06474                         int done = 0;
06475                         item->window.nextTime = DC->realTime + item->window.offsetTime;
06476 
06477                         // transition the x,y
06478                         if (item->window.rectClient.x == item->window.rectEffects.x) 
06479                         {
06480                                 done++;
06481                         } 
06482                         else 
06483                         {
06484                                 if (item->window.rectClient.x < item->window.rectEffects.x) 
06485                                 {
06486                                         item->window.rectClient.x += item->window.rectEffects2.x;
06487                                         if (item->window.rectClient.x > item->window.rectEffects.x) 
06488                                         {
06489                                                 item->window.rectClient.x = item->window.rectEffects.x;
06490                                                 done++;
06491                                         }
06492                                 } 
06493                                 else 
06494                                 {
06495                                         item->window.rectClient.x -= item->window.rectEffects2.x;
06496                                         if (item->window.rectClient.x < item->window.rectEffects.x) 
06497                                         {
06498                                                 item->window.rectClient.x = item->window.rectEffects.x;
06499                                                 done++;
06500                                         }
06501                                 }
06502                         }
06503 
06504                         if (item->window.rectClient.y == item->window.rectEffects.y) 
06505                         {
06506                                 done++;
06507                         } 
06508                         else 
06509                         {
06510                                 if (item->window.rectClient.y < item->window.rectEffects.y) 
06511                                 {
06512                                         item->window.rectClient.y += item->window.rectEffects2.y;
06513                                         if (item->window.rectClient.y > item->window.rectEffects.y) 
06514                                         {
06515                                                 item->window.rectClient.y = item->window.rectEffects.y;
06516                                                 done++;
06517                                         }
06518                                 } 
06519                                 else 
06520                                 {
06521                                         item->window.rectClient.y -= item->window.rectEffects2.y;
06522                                         if (item->window.rectClient.y < item->window.rectEffects.y) 
06523                                         {
06524                                                 item->window.rectClient.y = item->window.rectEffects.y;
06525                                                 done++;
06526                                         }
06527                                 }
06528                         }
06529 
06530                         if (item->window.rectClient.w == item->window.rectEffects.w) 
06531                         {
06532                                 done++;
06533                         } 
06534                         else 
06535                         {
06536                                 if (item->window.rectClient.w < item->window.rectEffects.w) 
06537                                 {
06538                                         item->window.rectClient.w += item->window.rectEffects2.w;
06539                                         if (item->window.rectClient.w > item->window.rectEffects.w) 
06540                                         {
06541                                                 item->window.rectClient.w = item->window.rectEffects.w;
06542                                                 done++;
06543                                         }
06544                                 } 
06545                                 else 
06546                                 {
06547                                         item->window.rectClient.w -= item->window.rectEffects2.w;
06548                                         if (item->window.rectClient.w < item->window.rectEffects.w) 
06549                                         {
06550                                                 item->window.rectClient.w = item->window.rectEffects.w;
06551                                                 done++;
06552                                         }
06553                                 }
06554                         }
06555 
06556                         if (item->window.rectClient.h == item->window.rectEffects.h) 
06557                         {
06558                                 done++;
06559                         } 
06560                         else 
06561                         {
06562                                 if (item->window.rectClient.h < item->window.rectEffects.h) 
06563                                 {
06564                                         item->window.rectClient.h += item->window.rectEffects2.h;
06565                                         if (item->window.rectClient.h > item->window.rectEffects.h) 
06566                                         {
06567                                                 item->window.rectClient.h = item->window.rectEffects.h;
06568                                                 done++;
06569                                         }
06570                                 } 
06571                                 else 
06572                                 {
06573                                         item->window.rectClient.h -= item->window.rectEffects2.h;
06574                                         if (item->window.rectClient.h < item->window.rectEffects.h) 
06575                                         {
06576                                                 item->window.rectClient.h = item->window.rectEffects.h;
06577                                                 done++;
06578                                         }
06579                                 }
06580                         }
06581 
06582                         Item_UpdatePosition(item);
06583 
06584                         if (done == 4) 
06585                         {
06586                                 item->window.flags &= ~WINDOW_INTRANSITION;
06587                         }
06588 
06589                 }
06590         }
06591 
06592 #ifdef _TRANS3
06593         
06594 //JLF begin model transition stuff
06595         if (item->window.flags & WINDOW_INTRANSITIONMODEL) 
06596         {
06597                 if ( item->type == ITEM_TYPE_MODEL)
06598                 {
06599 //fields ing modelptr
06600 //                              vec3_t g2mins2, g2maxs2, g2minsEffect, g2maxsEffect;
06601 //      float fov_x2, fov_y2, fov_Effectx, fov_Effecty;
06602 
06603                         modelDef_t  * modelptr = (modelDef_t *)item->typeData;
06604 
06605                         if (DC->realTime > item->window.nextTime) 
06606                         {
06607                                 int done = 0;
06608                                 item->window.nextTime = DC->realTime + item->window.offsetTime;
06609 
06610 
06611 // transition the x,y,z max
06612                                 if (modelptr->g2maxs[0] == modelptr->g2maxs2[0]) 
06613                                 {
06614                                         done++;
06615                                 } 
06616                                 else 
06617                                 {
06618                                         if (modelptr->g2maxs[0] < modelptr->g2maxs2[0]) 
06619                                         {
06620                                                 modelptr->g2maxs[0] += modelptr->g2maxsEffect[0];
06621                                                 if (modelptr->g2maxs[0] > modelptr->g2maxs2[0]) 
06622                                                 {
06623                                                         modelptr->g2maxs[0] = modelptr->g2maxs2[0];
06624                                                         done++;
06625                                                 }
06626                                         } 
06627                                         else 
06628                                         {
06629                                                 modelptr->g2maxs[0] -= modelptr->g2maxsEffect[0];
06630                                                 if (modelptr->g2maxs[0] < modelptr->g2maxs2[0]) 
06631                                                 {
06632                                                         modelptr->g2maxs[0] = modelptr->g2maxs2[0];
06633                                                         done++;
06634                                                 }
06635                                         }
06636                                 }
06637 //y
06638                                 if (modelptr->g2maxs[1] == modelptr->g2maxs2[1]) 
06639                                 {
06640                                         done++;
06641                                 } 
06642                                 else 
06643                                 {
06644                                         if (modelptr->g2maxs[1] < modelptr->g2maxs2[1]) 
06645                                         {
06646                                                 modelptr->g2maxs[1] += modelptr->g2maxsEffect[1];
06647                                                 if (modelptr->g2maxs[1] > modelptr->g2maxs2[1]) 
06648                                                 {
06649                                                         modelptr->g2maxs[1] = modelptr->g2maxs2[1];
06650                                                         done++;
06651                                                 }
06652                                         } 
06653                                         else 
06654                                         {
06655                                                 modelptr->g2maxs[1] -= modelptr->g2maxsEffect[1];
06656                                                 if (modelptr->g2maxs[1] < modelptr->g2maxs2[1]) 
06657                                                 {
06658                                                         modelptr->g2maxs[1] = modelptr->g2maxs2[1];
06659                                                         done++;
06660                                                 }
06661                                         }
06662                                 }
06663 
06664 
06665 //z
06666 
06667                                 if (modelptr->g2maxs[2] == modelptr->g2maxs2[2]) 
06668                                 {
06669                                         done++;
06670                                 } 
06671                                 else 
06672                                 {
06673                                         if (modelptr->g2maxs[2] < modelptr->g2maxs2[2]) 
06674                                         {
06675                                                 modelptr->g2maxs[2] += modelptr->g2maxsEffect[2];
06676                                                 if (modelptr->g2maxs[2] > modelptr->g2maxs2[2]) 
06677                                                 {
06678                                                         modelptr->g2maxs[2] = modelptr->g2maxs2[2];
06679                                                         done++;
06680                                                 }
06681                                         } 
06682                                         else 
06683                                         {
06684                                                 modelptr->g2maxs[2] -= modelptr->g2maxsEffect[2];
06685                                                 if (modelptr->g2maxs[2] < modelptr->g2maxs2[2]) 
06686                                                 {
06687                                                         modelptr->g2maxs[2] = modelptr->g2maxs2[2];
06688                                                         done++;
06689                                                 }
06690                                         }
06691                                 }
06692 
06693 // transition the x,y,z min
06694                                 if (modelptr->g2mins[0] == modelptr->g2mins2[0]) 
06695                                 {
06696                                         done++;
06697                                 } 
06698                                 else 
06699                                 {
06700                                         if (modelptr->g2mins[0] < modelptr->g2mins2[0]) 
06701                                         {
06702                                                 modelptr->g2mins[0] += modelptr->g2minsEffect[0];
06703                                                 if (modelptr->g2mins[0] > modelptr->g2mins2[0]) 
06704                                                 {
06705                                                         modelptr->g2mins[0] = modelptr->g2mins2[0];
06706                                                         done++;
06707                                                 }
06708                                         } 
06709                                         else 
06710                                         {
06711                                                 modelptr->g2mins[0] -= modelptr->g2minsEffect[0];
06712                                                 if (modelptr->g2mins[0] < modelptr->g2mins2[0]) 
06713                                                 {
06714                                                         modelptr->g2mins[0] = modelptr->g2mins2[0];
06715                                                         done++;
06716                                                 }
06717                                         }
06718                                 }
06719 //y
06720                                 if (modelptr->g2mins[1] == modelptr->g2mins2[1]) 
06721                                 {
06722                                         done++;
06723                                 } 
06724                                 else 
06725                                 {
06726                                         if (modelptr->g2mins[1] < modelptr->g2mins2[1]) 
06727                                         {
06728                                                 modelptr->g2mins[1] += modelptr->g2minsEffect[1];
06729                                                 if (modelptr->g2mins[1] > modelptr->g2mins2[1]) 
06730                                                 {
06731                                                         modelptr->g2mins[1] = modelptr->g2mins2[1];
06732                                                         done++;
06733                                                 }
06734                                         } 
06735                                         else 
06736                                         {
06737                                                 modelptr->g2mins[1] -= modelptr->g2minsEffect[1];
06738                                                 if (modelptr->g2mins[1] < modelptr->g2mins2[1]) 
06739                                                 {
06740                                                         modelptr->g2mins[1] = modelptr->g2mins2[1];
06741                                                         done++;
06742                                                 }
06743                                         }
06744                                 }
06745 
06746 
06747 //z
06748 
06749                                 if (modelptr->g2mins[2] == modelptr->g2mins2[2]) 
06750                                 {
06751                                         done++;
06752                                 } 
06753                                 else 
06754                                 {
06755                                         if (modelptr->g2mins[2] < modelptr->g2mins2[2]) 
06756                                         {
06757                                                 modelptr->g2mins[2] += modelptr->g2minsEffect[2];
06758                                                 if (modelptr->g2mins[2] > modelptr->g2mins2[2]) 
06759                                                 {
06760                                                         modelptr->g2mins[2] = modelptr->g2mins2[2];
06761                                                         done++;
06762                                                 }
06763                                         } 
06764                                         else 
06765                                         {
06766                                                 modelptr->g2mins[2] -= modelptr->g2minsEffect[2];
06767                                                 if (modelptr->g2mins[2] < modelptr->g2mins2[2]) 
06768                                                 {
06769                                                         modelptr->g2mins[2] = modelptr->g2mins2[2];
06770                                                         done++;
06771                                                 }
06772                                         }
06773                                 }
06774 
06775 
06776 
06777 //fovx
06778                                 if (modelptr->fov_x == modelptr->fov_x2) 
06779                                 {
06780                                         done++;
06781                                 } 
06782                                 else 
06783                                 {
06784                                         if (modelptr->fov_x < modelptr->fov_x2) 
06785                                         {
06786                                                 modelptr->fov_x += modelptr->fov_Effectx;
06787                                                 if (modelptr->fov_x > modelptr->fov_x2) 
06788                                                 {
06789                                                         modelptr->fov_x = modelptr->fov_x2;
06790                                                         done++;
06791                                                 }
06792                                         } 
06793                                         else 
06794                                         {
06795                                                 modelptr->fov_x -= modelptr->fov_Effectx;
06796                                                 if (modelptr->fov_x < modelptr->fov_x2) 
06797                                                 {
06798                                                         modelptr->fov_x = modelptr->fov_x2;
06799                                                         done++;
06800                                                 }
06801                                         }
06802                                 }
06803 
06804 //fovy
06805                                 if (modelptr->fov_y == modelptr->fov_y2) 
06806                                 {
06807                                         done++;
06808                                 } 
06809                                 else 
06810                                 {
06811                                         if (modelptr->fov_y < modelptr->fov_y2) 
06812                                         {
06813                                                 modelptr->fov_y += modelptr->fov_Effecty;
06814                                                 if (modelptr->fov_y > modelptr->fov_y2) 
06815                                                 {
06816                                                         modelptr->fov_y = modelptr->fov_y2;
06817                                                         done++;
06818                                                 }
06819                                         } 
06820                                         else 
06821                                         {
06822                                                 modelptr->fov_y -= modelptr->fov_Effecty;
06823                                                 if (modelptr->fov_y < modelptr->fov_y2) 
06824                                                 {
06825                                                         modelptr->fov_y = modelptr->fov_y2;
06826                                                         done++;
06827                                                 }
06828                                         }
06829                                 }
06830 
06831                                 if (done == 5) 
06832                                 {
06833                                         item->window.flags &= ~WINDOW_INTRANSITIONMODEL;
06834                                 }
06835 
06836                         }
06837                 }
06838         }
06839 #endif
06840 //JLF end transition stuff for models
06841 
06842 
06843 
06844         if (item->window.ownerDrawFlags && DC->ownerDrawVisible) {
06845                 if (!DC->ownerDrawVisible(item->window.ownerDrawFlags)) {
06846                         item->window.flags &= ~WINDOW_VISIBLE;
06847                 } else {
06848                         item->window.flags |= WINDOW_VISIBLE;
06849                 }
06850         }
06851 
06852         if (item->cvarFlags & (CVAR_SHOW | CVAR_HIDE)) {
06853                 if (!Item_EnableShowViaCvar(item, CVAR_SHOW)) {
06854                         return;
06855                 }
06856         }
06857 
06858   if (item->window.flags & WINDOW_TIMEDVISIBLE) {
06859 
06860         }
06861 
06862         if (!(item->window.flags & WINDOW_VISIBLE)) 
06863         {
06864                 return;
06865         }
06866 
06867 
06868 //JLFMOUSE
06869 #ifndef _XBOX
06870         if (item->window.flags & WINDOW_MOUSEOVER)
06871 #else
06872         if (item->window.flags & WINDOW_HASFOCUS)
06873 #endif
06874         {
06875                 if (item->descText && !Display_KeyBindPending())
06876                 {
06877                         // Make DOUBLY sure that this item should have desctext.
06878 #ifndef _XBOX
06879                         // NOTE : we can't just check the mouse position on this, what if we TABBED
06880                         // to the current menu item -- in that case our mouse isn't over the item.
06881                         // Removing the WINDOW_MOUSEOVER flag just prevents the item's OnExit script from running
06882         //          if (!Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory)) 
06883         //              {       // It isn't something that should, because it isn't live anymore.
06884         //                      item->window.flags &= ~WINDOW_MOUSEOVER;
06885         //              }
06886         //              else
06887 #endif
06888         //END JLFMOUSE
06889                         {       // Draw the desctext
06890                                 const char *textPtr = item->descText;
06891                                 if (*textPtr == '@')    // string reference
06892                                 {
06893                                         char    temp[MAX_STRING_CHARS];
06894                                         trap_SP_GetStringTextString( &textPtr[1]  , temp, sizeof(temp));
06895                                         textPtr = temp;
06896                                 }
06897 
06898                                 Item_TextColor(item, &color);
06899 
06900                                 {// stupid C language
06901                                         float fDescScale = parent->descScale ? parent->descScale : 1;
06902                                         float fDescScaleCopy = fDescScale;
06903                                         int iYadj = 0;
06904                                         while (1)
06905                                         {
06906                                                 textWidth = DC->textWidth(textPtr,fDescScale, FONT_SMALL2);
06907 
06908                                                 if (parent->descAlignment == ITEM_ALIGN_RIGHT)
06909                                                 {
06910                                                         xPos = parent->descX - textWidth;       // Right justify
06911                                                 }
06912                                                 else if (parent->descAlignment == ITEM_ALIGN_CENTER)
06913                                                 {
06914                                                         xPos = parent->descX - (textWidth/2);   // Center justify
06915                                                 }
06916                                                 else                                                                            // Left justify 
06917                                                 {
06918                                                         xPos = parent->descX;
06919                                                 }
06920 
06921                                                 if (parent->descAlignment == ITEM_ALIGN_CENTER)
06922                                                 {
06923                                                         // only this one will auto-shrink the scale until we eventually fit...
06924                                                         //
06925                                                         if (xPos + textWidth > (SCREEN_WIDTH-4)) {
06926                                                                 fDescScale -= 0.001f;
06927                                                                 continue;
06928                                                         }
06929                                                 }
06930 
06931                                                 // Try to adjust it's y placement if the scale has changed...
06932                                                 //
06933                                                 if (fDescScale != fDescScaleCopy)
06934                                                 {
06935                                                         int iOriginalTextHeight = DC->textHeight(textPtr, fDescScaleCopy, FONT_MEDIUM);
06936                                                         iYadj = iOriginalTextHeight - DC->textHeight(textPtr, fDescScale, FONT_MEDIUM);
06937                                                 }
06938 
06939                                                 DC->drawText(xPos, parent->descY + iYadj, fDescScale, parent->descColor, textPtr, 0, 0, item->textStyle, FONT_SMALL2);
06940                                                 break;
06941                                         }
06942                                 }
06943                         }
06944                 }
06945         }
06946 
06947   // paint the rect first.. 
06948   Window_Paint(&item->window, parent->fadeAmount , parent->fadeClamp, parent->fadeCycle);
06949 
06950   // Draw box to show rectangle extents, in debug mode
06951   if (debugMode) 
06952   {
06953         vec4_t color;
06954     color[1] = color[3] = 1;
06955     color[0] = color[2] = 0;
06956         DC->drawRect(
06957                 item->window.rect.x, 
06958                 item->window.rect.y, 
06959                 item->window.rect.w, 
06960                 item->window.rect.h, 
06961                 1, 
06962                 color);
06963   }
06964 
06965   //DC->drawRect(item->window.rect.x, item->window.rect.y, item->window.rect.w, item->window.rect.h, 1, red);
06966 
06967   switch (item->type) {
06968     case ITEM_TYPE_OWNERDRAW:
06969       Item_OwnerDraw_Paint(item);
06970       break;
06971     case ITEM_TYPE_TEXT:
06972     case ITEM_TYPE_BUTTON:
06973       Item_Text_Paint(item);
06974       break;
06975     case ITEM_TYPE_RADIOBUTTON:
06976       break;
06977     case ITEM_TYPE_CHECKBOX:
06978       break;
06979     case ITEM_TYPE_EDITFIELD:
06980     case ITEM_TYPE_NUMERICFIELD:
06981       Item_TextField_Paint(item);
06982       break;
06983     case ITEM_TYPE_COMBO:
06984       break;
06985     case ITEM_TYPE_LISTBOX:
06986       Item_ListBox_Paint(item);
06987       break;
06988         case ITEM_TYPE_TEXTSCROLL:
06989           Item_TextScroll_Paint ( item );
06990           break;
06991     //case ITEM_TYPE_IMAGE:
06992     //  Item_Image_Paint(item);
06993     //  break;
06994     case ITEM_TYPE_MODEL:
06995       Item_Model_Paint(item);
06996       break;
06997     case ITEM_TYPE_YESNO:
06998       Item_YesNo_Paint(item);
06999       break;
07000     case ITEM_TYPE_MULTI:
07001       Item_Multi_Paint(item);
07002       break;
07003     case ITEM_TYPE_BIND:
07004       Item_Bind_Paint(item);
07005       break;
07006     case ITEM_TYPE_SLIDER:
07007       Item_Slider_Paint(item);
07008       break;
07009     default:
07010       break;
07011   }
07012 
07013 }

qboolean Item_Parse int  handle,
itemDef_t item
 

Definition at line 9009 of file ui_shared.c.

References keywordHash_s::func, itemDef_t, itemParseKeywordHash, KeywordHash_Find(), keywordHash_t, PC_SourceError(), pc_token_t, qboolean, qfalse, qtrue, pc_token_s::string, and trap_PC_ReadToken().

Referenced by MenuParse_itemDef().

09009                                                  {
09010         pc_token_t token;
09011         keywordHash_t *key;
09012 
09013 
09014         if (!trap_PC_ReadToken(handle, &token))
09015                 return qfalse;
09016         if (*token.string != '{') {
09017                 return qfalse;
09018         }
09019         while ( 1 ) {
09020                 if (!trap_PC_ReadToken(handle, &token)) {
09021                         PC_SourceError(handle, "end of file inside menu item\n");
09022                         return qfalse;
09023                 }
09024 
09025                 if (*token.string == '}') {
09026                         return qtrue;
09027                 }
09028 
09029                 key = KeywordHash_Find(itemParseKeywordHash, token.string);
09030                 if (!key) {
09031                         PC_SourceError(handle, "unknown menu item keyword %s", token.string);
09032                         continue;
09033                 }
09034                 if ( !key->func(item, handle) ) {
09035                         PC_SourceError(handle, "couldn't parse menu item keyword %s", token.string);
09036                         return qfalse;
09037                 }
09038         }
09039         return qfalse;  // bk001205 - LCC missing return value
09040 }

void Item_RunScript itemDef_t item,
const char *  s
 

Referenced by Item_Action(), Item_HandleAccept(), Item_ListBox_HandleKey(), Item_MouseEnter(), Item_MouseLeave(), Item_SetFocus(), Menu_ClearFocus(), Menu_HandleKey(), Menus_Activate(), Script_RunDeferred(), Script_SetFocus(), UI_FeederSelection(), and UI_FindCurrentSiegeTeamClass().

qboolean Item_SetFocus itemDef_t item,
float  x,
float  y
 

Definition at line 2399 of file ui_shared.c.

References displayContextDef_t::Assets, CHAN_LOCAL_SOUND, menuDef_t::cursorItem, CVAR_DISABLE, CVAR_ENABLE, CVAR_HIDE, CVAR_SHOW, itemDef_s::cvarFlags, DC, itemDef_s::disabled, windowDef_t::flags, itemDef_s::focusSound, rectDef_t::h, Item_EnableShowViaCvar(), Item_RunScript(), ITEM_TYPE_TEXT, menuDef_t::itemCount, itemDef_t, cachedAssets_t::itemFocusSound, menuDef_t::items, Menu_ClearFocus(), NULL, itemDef_s::onFocus, itemDef_s::parent, qboolean, qfalse, qtrue, Rect_ContainsPoint(), sfxHandle_t, displayContextDef_t::startLocalSound, itemDef_s::textRect, itemDef_s::type, itemDef_s::window, WINDOW_DECORATION, WINDOW_HASFOCUS, WINDOW_VISIBLE, and rectDef_t::y.

Referenced by Menu_HandleMouseMove(), Menu_SetNextCursorItem(), Menu_SetPrevCursorItem(), and Script_SetFocus().

02399                                                           {
02400         int i;
02401         itemDef_t *oldFocus;
02402         sfxHandle_t *sfx = &DC->Assets.itemFocusSound;
02403         qboolean playSound = qfalse;
02404         menuDef_t *parent; // bk001206: = (menuDef_t*)item->parent;
02405         // sanity check, non-null, not a decoration and does not already have the focus
02406         if (item == NULL || item->window.flags & WINDOW_DECORATION || item->window.flags & WINDOW_HASFOCUS || !(item->window.flags & WINDOW_VISIBLE)) {
02407                 return qfalse;
02408         }
02409 
02410         // bk001206 - this can be NULL.
02411         parent = (menuDef_t*)item->parent; 
02412 
02413         // items can be enabled and disabled 
02414         if (item->disabled) 
02415         {
02416                 return qfalse;
02417         }
02418       
02419         // items can be enabled and disabled based on cvars
02420         if (item->cvarFlags & (CVAR_ENABLE | CVAR_DISABLE) && !Item_EnableShowViaCvar(item, CVAR_ENABLE)) {
02421                 return qfalse;
02422         }
02423 
02424         if (item->cvarFlags & (CVAR_SHOW | CVAR_HIDE) && !Item_EnableShowViaCvar(item, CVAR_SHOW)) {
02425                 return qfalse;
02426         }
02427 
02428         oldFocus = Menu_ClearFocus((menuDef_t *) item->parent);
02429 
02430         if (item->type == ITEM_TYPE_TEXT) {
02431                 rectDef_t r;
02432                 r = item->textRect;
02433                 r.y -= r.h;
02434 
02435 //JLFMOUSE
02436 #ifndef _XBOX
02437                 if (Rect_ContainsPoint(&r, x, y)) 
02438 #endif
02439                 {
02440                         item->window.flags |= WINDOW_HASFOCUS;
02441                         if (item->focusSound) {
02442                                 sfx = &item->focusSound;
02443                         }
02444                         playSound = qtrue;
02445                 }
02446 #ifndef _XBOX
02447                 else 
02448 #endif
02449                 {
02450                         if (oldFocus) {
02451                                 oldFocus->window.flags |= WINDOW_HASFOCUS;
02452                                 if (oldFocus->onFocus) {
02453                                         Item_RunScript(oldFocus, oldFocus->onFocus);
02454                                 }
02455                         }
02456                 }
02457         } else {
02458             item->window.flags |= WINDOW_HASFOCUS;
02459                 if (item->onFocus) {
02460                         Item_RunScript(item, item->onFocus);
02461                 }
02462                 if (item->focusSound) {
02463                         sfx = &item->focusSound;
02464                 }
02465                 playSound = qtrue;
02466         }
02467 
02468         if (playSound && sfx) {
02469                 DC->startLocalSound( *sfx, CHAN_LOCAL_SOUND );
02470         }
02471 
02472         for (i = 0; i < parent->itemCount; i++) {
02473                 if (parent->items[i] == item) {
02474                         parent->cursorItem = i;
02475                         break;
02476                 }
02477         }
02478 
02479         return qtrue;
02480 }

void Item_SetMouseOver itemDef_t item,
qboolean  focus
 

Definition at line 3111 of file ui_shared.c.

References windowDef_t::flags, itemDef_t, itemDef_s::window, and WINDOW_MOUSEOVER.

Referenced by Menu_HandleMouseMove().

03111                                                         {
03112   if (item) {
03113     if (focus) {
03114       item->window.flags |= WINDOW_MOUSEOVER;
03115     } else {
03116       item->window.flags &= ~WINDOW_MOUSEOVER;
03117     }
03118   }
03119 }

void Item_SetScreenCoords itemDef_t item,
float  x,
float  y
 

Definition at line 891 of file ui_shared.c.

References windowDef_t::border, windowDef_t::borderSize, textScrollDef_s::endPos, rectDef_t::h, ITEM_TYPE_TEXTSCROLL, itemDef_t, NULL, windowDef_t::rect, windowDef_t::rectClient, textScrollDef_s::startPos, itemDef_s::textRect, textScrollDef_t, itemDef_s::type, itemDef_s::typeData, rectDef_t::w, itemDef_s::window, rectDef_t::x, and rectDef_t::y.

Referenced by Item_UpdatePosition(), and Menu_UpdatePosition().

00892 { 
00893 
00894         if (item == NULL) 
00895         {
00896                 return;
00897         }
00898 
00899         if (item->window.border != 0) 
00900         {
00901                 x += item->window.borderSize;
00902                 y += item->window.borderSize;
00903         }
00904 
00905         item->window.rect.x = x + item->window.rectClient.x;
00906         item->window.rect.y = y + item->window.rectClient.y;
00907         item->window.rect.w = item->window.rectClient.w;
00908         item->window.rect.h = item->window.rectClient.h;
00909 
00910         // force the text rects to recompute
00911         item->textRect.w = 0;
00912         item->textRect.h = 0;
00913 
00914         switch ( item->type)
00915         {
00916                 case ITEM_TYPE_TEXTSCROLL:
00917                 {
00918                         textScrollDef_t *scrollPtr = (textScrollDef_t*)item->typeData;
00919                         if ( scrollPtr )
00920                         {
00921                                 scrollPtr->startPos = 0;
00922                                 scrollPtr->endPos = 0;
00923                         }
00924 
00925                         Item_TextScroll_BuildLines ( item );
00926 
00927                         break;
00928                 }
00929         }
00930 }

void Item_SetTextExtents itemDef_t item,
int *  width,
int *  height,
const char *  text
 

Definition at line 4740 of file ui_shared.c.

References itemDef_s::asset, itemDef_s::cvar, DC, displayContextDef_t::getCVarString, rectDef_t::h, itemDef_s::iMenuFont, ITEM_ALIGN_CENTER, ITEM_ALIGN_RIGHT, ITEM_TYPE_EDITFIELD, ITEM_TYPE_OWNERDRAW, itemDef_t, vmCvar_t::modificationCount, NULL, windowDef_t::ownerDraw, displayContextDef_t::ownerDrawWidth, se_language, itemDef_s::text, itemDef_s::textalignment, itemDef_s::textalignx, itemDef_s::textaligny, displayContextDef_t::textHeight, itemDef_s::textRect, itemDef_s::textscale, displayContextDef_t::textWidth, ToWindowCoords(), itemDef_s::type, rectDef_t::w, itemDef_s::window, rectDef_t::x, and rectDef_t::y.

Referenced by Item_Text_Paint(), and Item_Text_Wrapped_Paint().

04740                                                                                      {
04741         const char *textPtr = (text) ? text : item->text;
04742 
04743         if (textPtr == NULL ) {
04744                 return;
04745         }
04746 
04747         *width = item->textRect.w;
04748         *height = item->textRect.h;
04749 
04750         // keeps us from computing the widths and heights more than once
04751         if (*width == 0 || (item->type == ITEM_TYPE_OWNERDRAW && item->textalignment == ITEM_ALIGN_CENTER)
04752 #ifndef CGAME
04753                 || (item->text && item->text[0]=='@' && item->asset != se_language.modificationCount )  //string package language changed
04754 #endif
04755                 )
04756         {
04757                 int originalWidth = DC->textWidth(textPtr, item->textscale, item->iMenuFont);
04758 
04759                 if (item->type == ITEM_TYPE_OWNERDRAW && (item->textalignment == ITEM_ALIGN_CENTER || item->textalignment == ITEM_ALIGN_RIGHT)) 
04760                 {
04761                         originalWidth += DC->ownerDrawWidth(item->window.ownerDraw, item->textscale);
04762                 } 
04763                 else if (item->type == ITEM_TYPE_EDITFIELD && item->textalignment == ITEM_ALIGN_CENTER && item->cvar) 
04764                 {
04765                         char buff[256];
04766                         DC->getCVarString(item->cvar, buff, 256);
04767                         originalWidth += DC->textWidth(buff, item->textscale, item->iMenuFont);
04768                 }
04769 
04770                 *width = DC->textWidth(textPtr, item->textscale, item->iMenuFont);
04771                 *height = DC->textHeight(textPtr, item->textscale, item->iMenuFont);
04772                 
04773                 item->textRect.w = *width;
04774                 item->textRect.h = *height;
04775                 item->textRect.x = item->textalignx;
04776                 item->textRect.y = item->textaligny;
04777                 if (item->textalignment == ITEM_ALIGN_RIGHT) {
04778                         item->textRect.x = item->textalignx - originalWidth;
04779                 } else if (item->textalignment == ITEM_ALIGN_CENTER) {
04780                         item->textRect.x = item->textalignx - originalWidth / 2;
04781                 }
04782 
04783                 ToWindowCoords(&item->textRect.x, &item->textRect.y, &item->window);
04784 #ifndef CGAME
04785                 if (item->text && item->text[0]=='@' )//string package
04786                 {//mark language
04787                         item->asset = se_language.modificationCount;
04788                 }
04789 #endif
04790         }
04791 }

void Item_SetupKeywordHash void   ) 
 

Definition at line 8995 of file ui_shared.c.

References itemParseKeywordHash, itemParseKeywords, keywordHash_s::keyword, KeywordHash_Add(), and memset().

Referenced by String_Init().

08995                                  {
08996         int i;
08997 
08998         memset(itemParseKeywordHash, 0, sizeof(itemParseKeywordHash));
08999         for (i = 0; itemParseKeywords[i].keyword; i++) {
09000                 KeywordHash_Add(itemParseKeywordHash, &itemParseKeywords[i]);
09001         }
09002 }

qboolean Item_Slider_HandleKey itemDef_t item,
int  key,
qboolean  down
 

Definition at line 4101 of file ui_shared.c.

References A_CURSOR_LEFT, A_CURSOR_RIGHT, A_ENTER, A_MOUSE1, A_MOUSE2, A_MOUSE3, displayContextDef_t::cursorx, displayContextDef_t::cursory, itemDef_s::cvar, DC, editFieldDef_t, windowDef_t::flags, displayContextDef_t::getCVarValue, itemDef_t, editFieldDef_s::maxVal, editFieldDef_s::minVal, displayContextDef_t::Print, qboolean, qfalse, qtrue, windowDef_t::rect, Rect_ContainsPoint(), displayContextDef_t::setCVar, SLIDER_THUMB_WIDTH, SLIDER_WIDTH, itemDef_s::text, itemDef_s::textRect, itemDef_s::typeData, va(), rectDef_t::w, itemDef_s::window, WINDOW_HASFOCUS, and rectDef_t::x.

Referenced by Item_HandleKey().

04101                                                                         {
04102         float x, value, width, work;
04103 
04104         //DC->Print("slider handle key\n");
04105 //JLF MPMOVED
04106 #ifndef _XBOX
04107         if (item->window.flags & WINDOW_HASFOCUS && item->cvar && Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory)) {
04108                 if (key == A_MOUSE1 || key == A_ENTER || key == A_MOUSE2 || key == A_MOUSE3) {
04109                         editFieldDef_t *editDef = (editFieldDef_t *) item->typeData;
04110                         if (editDef) {
04111                                 rectDef_t testRect;
04112                                 width = SLIDER_WIDTH;
04113                                 if (item->text) {
04114                                         x = item->textRect.x + item->textRect.w + 8;
04115                                 } else {
04116                                         x = item->window.rect.x;
04117                                 }
04118 
04119                                 testRect = item->window.rect;
04120                                 testRect.x = x;
04121                                 value = (float)SLIDER_THUMB_WIDTH / 2;
04122                                 testRect.x -= value;
04123                                 //DC->Print("slider x: %f\n", testRect.x);
04124                                 testRect.w = (SLIDER_WIDTH + (float)SLIDER_THUMB_WIDTH / 2);
04125                                 //DC->Print("slider w: %f\n", testRect.w);
04126                                 if (Rect_ContainsPoint(&testRect, DC->cursorx, DC->cursory)) {
04127                                         work = DC->cursorx - x;
04128                                         value = work / width;
04129                                         value *= (editDef->maxVal - editDef->minVal);
04130                                         // vm fuckage
04131                                         // value = (((float)(DC->cursorx - x)/ SLIDER_WIDTH) * (editDef->maxVal - editDef->minVal));
04132                                         value += editDef->minVal;
04133                                         DC->setCVar(item->cvar, va("%f", value));
04134                                         return qtrue;
04135                                 }
04136                         }
04137                 }
04138         }
04139 #else  //def _XBOX
04140 //JLF
04141         if (item->window.flags & WINDOW_HASFOCUS && item->cvar)
04142         {
04143                 if (key == A_CURSOR_LEFT)
04144                 {
04145                         editFieldDef_t *editDef = (editFieldDef_s *) item->typeData;
04146                         if (editDef) 
04147                         {
04148                                 value = DC->getCVarValue(item->cvar);
04149                                 value -= (editDef->maxVal-editDef->minVal)/TICK_COUNT;
04150                                 if ( value < editDef->minVal)
04151                                         value = editDef->minVal;
04152                                 DC->setCVar(item->cvar, va("%f", value));
04153                                 return qtrue;
04154                         }
04155                 }
04156                 if (key == A_CURSOR_RIGHT)
04157                 {
04158                         editFieldDef_t *editDef = (editFieldDef_s *) item->typeData;
04159                         if (editDef) 
04160                         {
04161                                 value = DC->getCVarValue(item->cvar);
04162                                 value += (editDef->maxVal-editDef->minVal)/TICK_COUNT;
04163                                 if ( value > editDef->maxVal)
04164                                         value = editDef->maxVal;
04165                                 DC->setCVar(item->cvar, va("%f", value));
04166                                 return qtrue;
04167                         }
04168                 }
04169         }
04170 #endif
04171         DC->Print("slider handle key exit\n");
04172         return qfalse;
04173 }

int Item_Slider_OverSlider itemDef_t item,
float  x,
float  y
 

Definition at line 2823 of file ui_shared.c.

References rectDef_t::h, Item_Slider_ThumbPosition(), itemDef_t, windowDef_t::rect, Rect_ContainsPoint(), SLIDER_THUMB_HEIGHT, SLIDER_THUMB_WIDTH, rectDef_t::w, itemDef_s::window, WINDOW_LB_THUMB, rectDef_t::x, and rectDef_t::y.

Referenced by Item_StartCapture().

02823                                                               {
02824         rectDef_t r;
02825 
02826         r.x = Item_Slider_ThumbPosition(item) - (SLIDER_THUMB_WIDTH / 2);
02827         r.y = item->window.rect.y - 2;
02828         r.w = SLIDER_THUMB_WIDTH;
02829         r.h = SLIDER_THUMB_HEIGHT;
02830 
02831         if (Rect_ContainsPoint(&r, x, y)) {
02832                 return WINDOW_LB_THUMB;
02833         }
02834         return 0;
02835 }

void Item_Slider_Paint itemDef_t item  ) 
 

Definition at line 5443 of file ui_shared.c.

References displayContextDef_t::Assets, itemDef_s::cvar, DC, displayContextDef_t::drawHandlePic, windowDef_t::flags, menuDef_t::focusColor, windowDef_t::foreColor, displayContextDef_t::getCVarValue, Item_Slider_ThumbPosition(), Item_Text_Paint(), itemDef_t, LerpColor(), memcpy(), itemDef_s::parent, PULSE_DIVISOR, displayContextDef_t::realTime, windowDef_t::rect, displayContextDef_t::setColor, sin(), SLIDER_HEIGHT, SLIDER_THUMB_HEIGHT, SLIDER_THUMB_WIDTH, SLIDER_WIDTH, cachedAssets_t::sliderBar, cachedAssets_t::sliderThumb, itemDef_s::text, itemDef_s::textRect, vec4_t, rectDef_t::w, itemDef_s::window, WINDOW_HASFOCUS, rectDef_t::x, and rectDef_t::y.

Referenced by Item_Paint().

05443                                         {
05444         vec4_t newColor, lowLight;
05445         float x, y, value;
05446         menuDef_t *parent = (menuDef_t*)item->parent;
05447 
05448         value = (item->cvar) ? DC->getCVarValue(item->cvar) : 0;
05449 
05450         if (item->window.flags & WINDOW_HASFOCUS) {
05451                 lowLight[0] = 0.8 * parent->focusColor[0]; 
05452                 lowLight[1] = 0.8 * parent->focusColor[1]; 
05453                 lowLight[2] = 0.8 * parent->focusColor[2]; 
05454                 lowLight[3] = 0.8 * parent->focusColor[3]; 
05455                 LerpColor(parent->focusColor,lowLight,newColor,0.5+0.5*sin((float)(DC->realTime / PULSE_DIVISOR)));
05456         } else {
05457                 memcpy(&newColor, &item->window.foreColor, sizeof(vec4_t));
05458         }
05459 
05460         y = item->window.rect.y;
05461         if (item->text) {
05462                 Item_Text_Paint(item);
05463                 x = item->textRect.x + item->textRect.w + 8;
05464         } else {
05465                 x = item->window.rect.x;
05466         }
05467         DC->setColor(newColor);
05468         DC->drawHandlePic( x, y, SLIDER_WIDTH, SLIDER_HEIGHT, DC->Assets.sliderBar );
05469 
05470         x = Item_Slider_ThumbPosition(item);
05471         DC->drawHandlePic( x - (SLIDER_THUMB_WIDTH / 2), y - 2, SLIDER_THUMB_WIDTH, SLIDER_THUMB_HEIGHT, DC->Assets.sliderThumb );
05472 
05473 }

float Item_Slider_ThumbPosition itemDef_t item  ) 
 

Definition at line 2790 of file ui_shared.c.

References itemDef_s::cvar, DC, editFieldDef_t, displayContextDef_t::getCVarValue, itemDef_t, editFieldDef_s::maxVal, editFieldDef_s::minVal, NULL, windowDef_t::rect, SLIDER_WIDTH, itemDef_s::text, itemDef_s::textRect, itemDef_s::typeData, rectDef_t::w, itemDef_s::window, and rectDef_t::x.

Referenced by Item_Slider_OverSlider(), and Item_Slider_Paint().

02790                                                  {
02791         float value, range, x;
02792         editFieldDef_t *editDef = (editFieldDef_t *) item->typeData;
02793 
02794         if (item->text) {
02795                 x = item->textRect.x + item->textRect.w + 8;
02796         } else {
02797                 x = item->window.rect.x;
02798         }
02799 
02800         if (editDef == NULL && item->cvar) {
02801                 return x;
02802         }
02803 
02804         value = DC->getCVarValue(item->cvar);
02805 
02806         if (value < editDef->minVal) {
02807                 value = editDef->minVal;
02808         } else if (value > editDef->maxVal) {
02809                 value = editDef->maxVal;
02810         }
02811 
02812         range = editDef->maxVal - editDef->minVal;
02813         value -= editDef->minVal;
02814         value /= range;
02815         //value /= (editDef->maxVal - editDef->minVal);
02816         value *= SLIDER_WIDTH;
02817         x += value;
02818         // vm fuckage
02819         //x = x + (((float)value / editDef->maxVal) * SLIDER_WIDTH);
02820         return x;
02821 }

void Item_StartCapture itemDef_t item,
int  key
 

Definition at line 4022 of file ui_shared.c.

References scrollInfo_s::adjustValue, displayContextDef_t::cursorx, displayContextDef_t::cursory, DC, scrollInfo_s::item, Item_ListBox_OverLB(), Item_Slider_OverSlider(), Item_TextScroll_OverLB(), ITEM_TYPE_EDITFIELD, ITEM_TYPE_LISTBOX, ITEM_TYPE_NUMERICFIELD, ITEM_TYPE_SLIDER, ITEM_TYPE_TEXTSCROLL, itemDef_t, scrollInfo_s::nextAdjustTime, scrollInfo_s::nextScrollTime, qfalse, qtrue, displayContextDef_t::realTime, SCROLL_TIME_ADJUST, SCROLL_TIME_START, scrollInfo_s::scrollDir, scrollInfo_s::scrollKey, itemDef_s::type, WINDOW_LB_LEFTARROW, WINDOW_LB_RIGHTARROW, WINDOW_LB_THUMB, scrollInfo_s::xStart, and scrollInfo_s::yStart.

Referenced by Item_HandleKey().

04023 {
04024         int flags;
04025         switch (item->type) 
04026         {
04027             case ITEM_TYPE_EDITFIELD:
04028                 case ITEM_TYPE_NUMERICFIELD:
04029                 case ITEM_TYPE_LISTBOX:
04030                 {
04031                         flags = Item_ListBox_OverLB(item, DC->cursorx, DC->cursory);
04032                         if (flags & (WINDOW_LB_LEFTARROW | WINDOW_LB_RIGHTARROW)) {
04033                                 scrollInfo.nextScrollTime = DC->realTime + SCROLL_TIME_START;
04034                                 scrollInfo.nextAdjustTime = DC->realTime + SCROLL_TIME_ADJUST;
04035                                 scrollInfo.adjustValue = SCROLL_TIME_START;
04036                                 scrollInfo.scrollKey = key;
04037                                 scrollInfo.scrollDir = (flags & WINDOW_LB_LEFTARROW) ? qtrue : qfalse;
04038                                 scrollInfo.item = item;
04039                                 captureData = &scrollInfo;
04040                                 captureFunc = &Scroll_ListBox_AutoFunc;
04041                                 itemCapture = item;
04042                         } else if (flags & WINDOW_LB_THUMB) {
04043                                 scrollInfo.scrollKey = key;
04044                                 scrollInfo.item = item;
04045                                 scrollInfo.xStart = DC->cursorx;
04046                                 scrollInfo.yStart = DC->cursory;
04047                                 captureData = &scrollInfo;
04048                                 captureFunc = &Scroll_ListBox_ThumbFunc;
04049                                 itemCapture = item;
04050                         }
04051                         break;
04052                 }
04053 
04054                 case ITEM_TYPE_TEXTSCROLL:
04055                         flags = Item_TextScroll_OverLB (item, DC->cursorx, DC->cursory);
04056                         if (flags & (WINDOW_LB_LEFTARROW | WINDOW_LB_RIGHTARROW)) 
04057                         {
04058                                 scrollInfo.nextScrollTime = DC->realTime + SCROLL_TIME_START;
04059                                 scrollInfo.nextAdjustTime = DC->realTime + SCROLL_TIME_ADJUST;
04060                                 scrollInfo.adjustValue = SCROLL_TIME_START;
04061                                 scrollInfo.scrollKey = key;
04062                                 scrollInfo.scrollDir = (flags & WINDOW_LB_LEFTARROW) ? qtrue : qfalse;
04063                                 scrollInfo.item = item;
04064                                 captureData = &scrollInfo;
04065                                 captureFunc = &Scroll_TextScroll_AutoFunc;
04066                                 itemCapture = item;
04067                         } 
04068                         else if (flags & WINDOW_LB_THUMB) 
04069                         {
04070                                 scrollInfo.scrollKey = key;
04071                                 scrollInfo.item = item;
04072                                 scrollInfo.xStart = DC->cursorx;
04073                                 scrollInfo.yStart = DC->cursory;
04074                                 captureData = &scrollInfo;
04075                                 captureFunc = &Scroll_TextScroll_ThumbFunc;
04076                                 itemCapture = item;
04077                         }
04078                         break;
04079 
04080                 case ITEM_TYPE_SLIDER:
04081                 {
04082                         flags = Item_Slider_OverSlider(item, DC->cursorx, DC->cursory);
04083                         if (flags & WINDOW_LB_THUMB) {
04084                                 scrollInfo.scrollKey = key;
04085                                 scrollInfo.item = item;
04086                                 scrollInfo.xStart = DC->cursorx;
04087                                 scrollInfo.yStart = DC->cursory;
04088                                 captureData = &scrollInfo;
04089                                 captureFunc = &Scroll_Slider_ThumbFunc;
04090                                 itemCapture = item;
04091                         }
04092                         break;
04093                 }
04094         }
04095 }

void Item_StopCapture itemDef_t item  ) 
 

Definition at line 4097 of file ui_shared.c.

References itemDef_t.

Referenced by Item_HandleKey().

04097                                        {
04098 
04099 }

void Item_Text_AutoWrapped_Paint itemDef_t item  ) 
 

Definition at line 4828 of file ui_shared.c.

References itemDef_s::cvar, DC, displayContextDef_t::drawText, displayContextDef_t::getCVarString, itemDef_s::iMenuFont, ITEM_ALIGN_CENTER, ITEM_ALIGN_LEFT, ITEM_ALIGN_RIGHT, Item_TextColor(), itemDef_t, NULL, windowDef_t::rect, itemDef_s::text, itemDef_s::textalignment, itemDef_s::textalignx, itemDef_s::textaligny, displayContextDef_t::textHeight, itemDef_s::textRect, itemDef_s::textscale, itemDef_s::textStyle, displayContextDef_t::textWidth, ToWindowCoords(), trap_SP_GetStringTextString(), vec4_t, rectDef_t::w, itemDef_s::window, rectDef_t::x, and rectDef_t::y.

Referenced by Item_Text_Paint().

04828                                                   {
04829         char text[2048];
04830         const char *p, *textPtr, *newLinePtr;
04831         char buff[2048];
04832         int height, len, textWidth, newLine, newLineWidth;      //int width;
04833         float y;
04834         vec4_t color;
04835 
04836         textWidth = 0;
04837         newLinePtr = NULL;
04838 
04839         if (item->text == NULL) {
04840                 if (item->cvar == NULL) {
04841                         return;
04842                 }
04843                 else {
04844                         DC->getCVarString(item->cvar, text, sizeof(text));
04845                         textPtr = text;
04846                 }
04847         }
04848         else {
04849                 textPtr = item->text;
04850         }
04851         if (*textPtr == '@')    // string reference
04852         {
04853                 trap_SP_GetStringTextString( &textPtr[1], text, sizeof(text));
04854                 textPtr = text;
04855         }
04856         if (*textPtr == '\0') {
04857                 return;
04858         }
04859         Item_TextColor(item, &color);
04860         //Item_SetTextExtents(item, &width, &height, textPtr);
04861         //if (item->value == 0)
04862         //{
04863         //      item->value = (int)(0.5 + (float)DC->textWidth(textPtr, item->textscale, item->font) / item->window.rect.w);
04864         //}
04865         height = DC->textHeight(textPtr, item->textscale, item->iMenuFont);
04866 
04867         y = item->textaligny;
04868         len = 0;
04869         buff[0] = '\0';
04870         newLine = 0;
04871         newLineWidth = 0;
04872         p = textPtr;
04873         while (p) {     //findmeste (this will break widechar languages)!
04874                 if (*p == ' ' || *p == '\t' || *p == '\n' || *p == '\0') {
04875                         newLine = len;
04876                         newLinePtr = p+1;
04877                         newLineWidth = textWidth;
04878                 }
04879                 textWidth = DC->textWidth(buff, item->textscale, 0);
04880                 if ( (newLine && textWidth > item->window.rect.w) || *p == '\n' || *p == '\0') {
04881                         if (len) {
04882                                 if (item->textalignment == ITEM_ALIGN_LEFT) {
04883                                         item->textRect.x = item->textalignx;
04884                                 } else if (item->textalignment == ITEM_ALIGN_RIGHT) {
04885                                         item->textRect.x = item->textalignx - newLineWidth;
04886                                 } else if (item->textalignment == ITEM_ALIGN_CENTER) {
04887                                         item->textRect.x = item->textalignx - newLineWidth / 2;
04888                                 }
04889                                 item->textRect.y = y;
04890                                 ToWindowCoords(&item->textRect.x, &item->textRect.y, &item->window);
04891                                 //
04892                                 buff[newLine] = '\0';
04893                                 DC->drawText(item->textRect.x, item->textRect.y, item->textscale, color, buff, 0, 0, item->textStyle, item->iMenuFont);
04894                         }
04895                         if (*p == '\0') {
04896                                 break;
04897                         }
04898                         //
04899                         y += height + 5;
04900                         p = newLinePtr;
04901                         len = 0;
04902                         newLine = 0;
04903                         newLineWidth = 0;
04904                         continue;
04905                 }
04906                 buff[len++] = *p++;
04907                 buff[len] = '\0';
04908         }
04909 }

void Item_Text_Paint itemDef_t item  ) 
 

Definition at line 4961 of file ui_shared.c.

References itemDef_s::cvar, DC, displayContextDef_t::drawText, windowDef_t::flags, displayContextDef_t::getCVarString, itemDef_s::iMenuFont, Item_SetTextExtents(), Item_Text_AutoWrapped_Paint(), Item_Text_Wrapped_Paint(), Item_TextColor(), itemDef_t, NULL, itemDef_s::text, itemDef_s::text2, itemDef_s::text2alignx, itemDef_s::text2aligny, itemDef_s::textRect, itemDef_s::textscale, itemDef_s::textStyle, trap_SP_GetStringTextString(), vec4_t, itemDef_s::window, WINDOW_AUTOWRAPPED, WINDOW_WRAPPED, rectDef_t::x, and rectDef_t::y.

Referenced by Item_Bind_Paint(), Item_Multi_Paint(), Item_OwnerDraw_Paint(), Item_Paint(), Item_Slider_Paint(), Item_TextField_Paint(), and Item_YesNo_Paint().

04961                                       {
04962         char text[1024];
04963         const char *textPtr;
04964         int height, width;
04965         vec4_t color;
04966 
04967         if (item->window.flags & WINDOW_WRAPPED) {
04968                 Item_Text_Wrapped_Paint(item);
04969                 return;
04970         }
04971         if (item->window.flags & WINDOW_AUTOWRAPPED) {
04972                 Item_Text_AutoWrapped_Paint(item);
04973                 return;
04974         }
04975 
04976         if (item->text == NULL) {
04977                 if (item->cvar == NULL) {
04978                         return;
04979                 }
04980                 else {
04981                         DC->getCVarString(item->cvar, text, sizeof(text));
04982                         textPtr = text;
04983                 }
04984         }
04985         else {
04986                 textPtr = item->text;
04987         }
04988         if (*textPtr == '@')    // string reference
04989         {
04990                 trap_SP_GetStringTextString( &textPtr[1], text, sizeof(text));
04991                 textPtr = text;
04992         }
04993 
04994         // this needs to go here as it sets extents for cvar types as well
04995         Item_SetTextExtents(item, &width, &height, textPtr);
04996 
04997         if (*textPtr == '\0') {
04998                 return;
04999         }
05000 
05001 
05002         Item_TextColor(item, &color);
05003 
05004         DC->drawText(item->textRect.x, item->textRect.y, item->textscale, color, textPtr, 0, 0, item->textStyle, item->iMenuFont);
05005 
05006         if (item->text2)        // Is there a second line of text?
05007         {
05008                 textPtr = item->text2;
05009                 if (*textPtr == '@')    // string reference
05010                 {
05011                         trap_SP_GetStringTextString( &textPtr[1], text, sizeof(text));
05012                         textPtr = text;
05013                 }
05014                 Item_TextColor(item, &color);
05015                 DC->drawText(item->textRect.x + item->text2alignx, item->textRect.y + item->text2aligny, item->textscale, color, textPtr, 0, 0, item->textStyle,item->iMenuFont);
05016         }
05017 }

void Item_Text_Wrapped_Paint itemDef_t item  ) 
 

Definition at line 4911 of file ui_shared.c.

References itemDef_s::cvar, DC, displayContextDef_t::drawText, displayContextDef_t::getCVarString, itemDef_s::iMenuFont, Item_SetTextExtents(), Item_TextColor(), itemDef_t, NULL, strchr(), strncpy(), itemDef_s::text, itemDef_s::textRect, itemDef_s::textscale, itemDef_s::textStyle, trap_SP_GetStringTextString(), vec4_t, rectDef_t::x, and rectDef_t::y.

Referenced by Item_Text_Paint().

04911                                               {
04912         char text[1024];
04913         const char *p, *start, *textPtr;
04914         char buff[1024];
04915         int width, height;
04916         float x, y;
04917         vec4_t color;
04918 
04919         // now paint the text and/or any optional images
04920         // default to left
04921 
04922         if (item->text == NULL) {
04923                 if (item->cvar == NULL) {
04924                         return;
04925                 }
04926                 else {
04927                         DC->getCVarString(item->cvar, text, sizeof(text));
04928                         textPtr = text;
04929                 }
04930         }
04931         else {
04932                 textPtr = item->text;
04933         }
04934         if (*textPtr == '@')    // string reference
04935         {
04936                 trap_SP_GetStringTextString( &textPtr[1], text, sizeof(text));
04937                 textPtr = text;
04938         }
04939         if (*textPtr == '\0') {
04940                 return;
04941         }
04942 
04943         Item_TextColor(item, &color);
04944         Item_SetTextExtents(item, &width, &height, textPtr);
04945 
04946         x = item->textRect.x;
04947         y = item->textRect.y;
04948         start = textPtr;
04949         p = strchr(textPtr, '\r');
04950         while (p && *p) {
04951                 strncpy(buff, start, p-start+1);
04952                 buff[p-start] = '\0';
04953                 DC->drawText(x, y, item->textscale, color, buff, 0, 0, item->textStyle, item->iMenuFont);
04954                 y += height + 2;
04955                 start += p - start + 1;
04956                 p = strchr(p+1, '\r');
04957         }
04958         DC->drawText(x, y, item->textscale, color, start, 0, 0, item->textStyle, item->iMenuFont);
04959 }

void Item_TextColor itemDef_t item,
vec4_t newColor
 

Definition at line 4793 of file ui_shared.c.

References BLINK_DIVISOR, CVAR_DISABLE, CVAR_ENABLE, itemDef_s::cvarFlags, itemDef_s::cvarTest, DC, menuDef_t::disableColor, itemDef_s::disabled, itemDef_s::enableCvar, Fade(), menuDef_t::fadeAmount, menuDef_t::fadeClamp, menuDef_t::fadeCycle, windowDef_t::flags, menuDef_t::focusColor, windowDef_t::foreColor, Item_EnableShowViaCvar(), ITEM_TEXTSTYLE_BLINK, itemDef_t, LerpColor(), memcpy(), windowDef_t::nextTime, itemDef_s::parent, PULSE_DIVISOR, qtrue, displayContextDef_t::realTime, sin(), itemDef_s::textStyle, vec4_t, itemDef_s::window, and WINDOW_HASFOCUS.

Referenced by Item_Paint(), Item_Text_AutoWrapped_Paint(), Item_Text_Paint(), and Item_Text_Wrapped_Paint().

04793                                                        {
04794         vec4_t lowLight;
04795         menuDef_t *parent = (menuDef_t*)item->parent;
04796 
04797         Fade(&item->window.flags, &item->window.foreColor[3], parent->fadeClamp, &item->window.nextTime, parent->fadeCycle, qtrue, parent->fadeAmount);
04798 
04799         if (item->window.flags & WINDOW_HASFOCUS) {
04800                 lowLight[0] = 0.8 * parent->focusColor[0]; 
04801                 lowLight[1] = 0.8 * parent->focusColor[1]; 
04802                 lowLight[2] = 0.8 * parent->focusColor[2]; 
04803                 lowLight[3] = 0.8 * parent->focusColor[3]; 
04804                 LerpColor(parent->focusColor,lowLight,*newColor,0.5+0.5*sin((float)(DC->realTime / PULSE_DIVISOR)));
04805         } else if (item->textStyle == ITEM_TEXTSTYLE_BLINK && !((DC->realTime/BLINK_DIVISOR) & 1)) {
04806                 lowLight[0] = 0.8 * item->window.foreColor[0]; 
04807                 lowLight[1] = 0.8 * item->window.foreColor[1]; 
04808                 lowLight[2] = 0.8 * item->window.foreColor[2]; 
04809                 lowLight[3] = 0.8 * item->window.foreColor[3]; 
04810                 LerpColor(item->window.foreColor,lowLight,*newColor,0.5+0.5*sin((float)(DC->realTime / PULSE_DIVISOR)));
04811         } else {
04812                 memcpy(newColor, &item->window.foreColor, sizeof(vec4_t));
04813                 // items can be enabled and disabled based on cvars
04814         }
04815 
04816         if (item->disabled) 
04817         {
04818                 memcpy(newColor, &parent->disableColor, sizeof(vec4_t));
04819         }
04820 
04821         if (item->enableCvar && *item->enableCvar && item->cvarTest && *item->cvarTest) {
04822                 if (item->cvarFlags & (CVAR_ENABLE | CVAR_DISABLE) && !Item_EnableShowViaCvar(item, CVAR_ENABLE)) {
04823                         memcpy(newColor, &parent->disableColor, sizeof(vec4_t));
04824                 }
04825         }
04826 }

qboolean Item_TextField_HandleKey itemDef_t item,
int  key
 

Definition at line 3664 of file ui_shared.c.

References A_CURSOR_DOWN, A_CURSOR_LEFT, A_CURSOR_RIGHT, A_CURSOR_UP, A_DELETE, A_END, A_ENTER, A_ESCAPE, A_HOME, A_INSERT, A_KP_0, A_KP_1, A_KP_2, A_KP_4, A_KP_6, A_KP_7, A_KP_8, A_KP_ENTER, A_KP_PERIOD, A_TAB, itemDef_s::cursorPos, itemDef_s::cvar, DC, editFieldDef_t, displayContextDef_t::getCVarString, displayContextDef_t::getOverstrikeMode, ITEM_TYPE_EDITFIELD, ITEM_TYPE_NUMERICFIELD, itemDef_t, K_CHAR_FLAG, Leaving_EditField(), MAX_EDITFIELD, editFieldDef_s::maxChars, editFieldDef_s::maxPaintChars, memmove(), Menu_SetNextCursorItem(), Menu_SetPrevCursorItem(), NULL, editFieldDef_s::paintOffset, itemDef_s::parent, qboolean, qfalse, qtrue, displayContextDef_t::setCVar, displayContextDef_t::setOverstrikeMode, strlen(), itemDef_s::type, and itemDef_s::typeData.

Referenced by Menu_HandleKey().

03664                                                             {
03665         char buff[2048];
03666         int len;
03667         itemDef_t *newItem = NULL;
03668         editFieldDef_t *editPtr = (editFieldDef_t*)item->typeData;
03669 
03670         if (item->cvar) {
03671 
03672                 buff[0] = 0;
03673                 DC->getCVarString(item->cvar, buff, sizeof(buff));
03674                 len = strlen(buff);
03675                 if (editPtr->maxChars && len > editPtr->maxChars) {
03676                         len = editPtr->maxChars;
03677                 }
03678                 if ( key & K_CHAR_FLAG ) {
03679                         key &= ~K_CHAR_FLAG;
03680 
03681 
03682                         if (key == 'h' - 'a' + 1 )      {       // ctrl-h is backspace
03683                                 if ( item->cursorPos > 0 ) {
03684                                         memmove( &buff[item->cursorPos - 1], &buff[item->cursorPos], len + 1 - item->cursorPos);
03685                                         item->cursorPos--;
03686                                         if (item->cursorPos < editPtr->paintOffset) {
03687                                                 editPtr->paintOffset--;
03688                                         }
03689                                 }
03690                                 DC->setCVar(item->cvar, buff);
03691                         return qtrue;
03692                         }
03693 
03694 
03695                         //
03696                         // ignore any non printable chars
03697                         //
03698                         if ( key < 32 || !item->cvar) {
03699                             return qtrue;
03700                     }
03701 
03702                         if (item->type == ITEM_TYPE_NUMERICFIELD) {
03703                                 if (key < '0' || key > '9') {
03704                                         return qfalse;
03705                                 }
03706                         }
03707 
03708                         if (!DC->getOverstrikeMode()) {
03709                                 if (( len == MAX_EDITFIELD - 1 ) || (editPtr->maxChars && len >= editPtr->maxChars)) {
03710                                         return qtrue;
03711                                 }
03712                                 memmove( &buff[item->cursorPos + 1], &buff[item->cursorPos], len + 1 - item->cursorPos );
03713                         } else {
03714                                 if (editPtr->maxChars && item->cursorPos >= editPtr->maxChars) {
03715                                         return qtrue;
03716                                 }
03717                         }
03718 
03719                         buff[item->cursorPos] = key;
03720 
03721                         //rww - nul-terminate!
03722                         if (item->cursorPos+1 < 2048)
03723                         {
03724                                 buff[item->cursorPos+1] = 0;
03725                         }
03726                         else
03727                         {
03728                                 buff[item->cursorPos] = 0;
03729                         }
03730 
03731                         DC->setCVar(item->cvar, buff);
03732 
03733                         if (item->cursorPos < len + 1) {
03734                                 item->cursorPos++;
03735                                 if (editPtr->maxPaintChars && item->cursorPos > editPtr->maxPaintChars) {
03736                                         editPtr->paintOffset++;
03737                                 }
03738                         }
03739 
03740                 } else {
03741 
03742                         if ( key == A_DELETE || key == A_KP_PERIOD ) {
03743                                 if ( item->cursorPos < len ) {
03744                                         memmove( buff + item->cursorPos, buff + item->cursorPos + 1, len - item->cursorPos);
03745                                         DC->setCVar(item->cvar, buff);
03746                                 }
03747                                 return qtrue;
03748                         }
03749 
03750                         if ( key == A_CURSOR_RIGHT || key == A_KP_6 ) 
03751                         {
03752                                 if (editPtr->maxPaintChars && item->cursorPos >= editPtr->maxPaintChars && item->cursorPos < len) {
03753                                         item->cursorPos++;
03754                                         editPtr->paintOffset++;
03755                                         return qtrue;
03756                                 }
03757                                 if (item->cursorPos < len) {
03758                                         item->cursorPos++;
03759                                 } 
03760                                 return qtrue;
03761                         }
03762 
03763                         if ( key == A_CURSOR_LEFT || key == A_KP_4 ) 
03764                         {
03765                                 if ( item->cursorPos > 0 ) {
03766                                         item->cursorPos--;
03767                                 }
03768                                 if (item->cursorPos < editPtr->paintOffset) {
03769                                         editPtr->paintOffset--;
03770                                 }
03771                                 return qtrue;
03772                         }
03773 
03774                         if ( key == A_HOME || key == A_KP_7) {// || ( tolower(key) == 'a' && trap_Key_IsDown( K_CTRL ) ) ) {
03775                                 item->cursorPos = 0;
03776                                 editPtr->paintOffset = 0;
03777                                 return qtrue;
03778                         }
03779 
03780                         if ( key == A_END || key == A_KP_1)  {// ( tolower(key) == 'e' && trap_Key_IsDown( K_CTRL ) ) ) {
03781                                 item->cursorPos = len;
03782                                 if(item->cursorPos > editPtr->maxPaintChars) {
03783                                         editPtr->paintOffset = len - editPtr->maxPaintChars;
03784                                 }
03785                                 return qtrue;
03786                         }
03787 
03788                         if ( key == A_INSERT || key == A_KP_0 ) {
03789                                 DC->setOverstrikeMode(!DC->getOverstrikeMode());
03790                                 return qtrue;
03791                         }
03792                 }
03793 
03794                 if (key == A_TAB || key == A_CURSOR_DOWN || key == A_KP_2)
03795                 {
03796                         // switching fields so reset printed text of edit field
03797                         Leaving_EditField(item);
03798                         g_editingField = qfalse;
03799                         newItem = Menu_SetNextCursorItem((menuDef_t *) item->parent);
03800                         if (newItem && (newItem->type == ITEM_TYPE_EDITFIELD || newItem->type == ITEM_TYPE_NUMERICFIELD))
03801                         {
03802                                 g_editItem = newItem;
03803                                 g_editingField = qtrue;
03804                         }
03805                 }
03806 
03807                 if (key == A_CURSOR_UP || key == A_KP_8)
03808                 {
03809                         // switching fields so reset printed text of edit field
03810                         Leaving_EditField(item);
03811 
03812                         g_editingField = qfalse;
03813                         newItem = Menu_SetPrevCursorItem((menuDef_t *) item->parent);
03814                         if (newItem && (newItem->type == ITEM_TYPE_EDITFIELD || newItem->type == ITEM_TYPE_NUMERICFIELD))
03815                         {
03816                                 g_editItem = newItem;
03817                                 g_editingField = qtrue;
03818                         }
03819                 }
03820 
03821                 if ( key == A_ENTER || key == A_KP_ENTER || key == A_ESCAPE)  {
03822                         return qfalse;
03823                 }
03824 
03825                 return qtrue;
03826         }
03827         return qfalse;
03828 
03829 }

void Item_TextField_Paint itemDef_t item  ) 
 

Definition at line 5024 of file ui_shared.c.

References itemDef_s::cursorPos, itemDef_s::cvar, DC, displayContextDef_t::drawText, displayContextDef_t::drawTextWithCursor, editFieldDef_t, windowDef_t::flags, menuDef_t::focusColor, windowDef_t::foreColor, displayContextDef_t::getCVarString, displayContextDef_t::getOverstrikeMode, itemDef_s::iMenuFont, Item_Text_Paint(), itemDef_t, LerpColor(), memcpy(), editFieldDef_s::paintOffset, itemDef_s::parent, PULSE_DIVISOR, displayContextDef_t::realTime, windowDef_t::rect, sin(), itemDef_s::text, itemDef_s::textRect, itemDef_s::textscale, itemDef_s::textStyle, trap_SP_GetStringTextString(), itemDef_s::typeData, vec4_t, rectDef_t::w, itemDef_s::window, WINDOW_HASFOCUS, rectDef_t::x, and rectDef_t::y.

Referenced by Item_Paint().

05024                                            {
05025         char buff[1024];
05026         vec4_t newColor, lowLight;
05027         int offset;
05028         menuDef_t *parent = (menuDef_t*)item->parent;
05029         editFieldDef_t *editPtr = (editFieldDef_t*)item->typeData;
05030 
05031         Item_Text_Paint(item);
05032 
05033         buff[0] = '\0';
05034 
05035         if (item->cvar) {
05036                 DC->getCVarString(item->cvar, buff, sizeof(buff));
05037                 if (buff[0] == '@')     // string reference
05038                 {
05039                         trap_SP_GetStringTextString( &buff[1], buff, sizeof(buff));
05040                 }
05041         } 
05042 
05043         parent = (menuDef_t*)item->parent;
05044 
05045         if (item->window.flags & WINDOW_HASFOCUS) {
05046                 lowLight[0] = 0.8 * parent->focusColor[0]; 
05047                 lowLight[1] = 0.8 * parent->focusColor[1]; 
05048                 lowLight[2] = 0.8 * parent->focusColor[2]; 
05049                 lowLight[3] = 0.8 * parent->focusColor[3]; 
05050                 LerpColor(parent->focusColor,lowLight,newColor,0.5+0.5*sin((float)(DC->realTime / PULSE_DIVISOR)));
05051         } else {
05052                 memcpy(&newColor, &item->window.foreColor, sizeof(vec4_t));
05053         }
05054 
05055         offset = (item->text && *item->text) ? 8 : 0;
05056         if (item->window.flags & WINDOW_HASFOCUS && g_editingField) {
05057                 char cursor = DC->getOverstrikeMode() ? '_' : '|';
05058                 DC->drawTextWithCursor(item->textRect.x + item->textRect.w + offset, item->textRect.y, item->textscale, newColor, buff + editPtr->paintOffset, item->cursorPos - editPtr->paintOffset , cursor, item->window.rect.w, item->textStyle, item->iMenuFont);
05059         } else {
05060                 DC->drawText(item->textRect.x + item->textRect.w + offset, item->textRect.y, item->textscale, newColor, buff + editPtr->paintOffset, 0, item->window.rect.w, item->textStyle,item->iMenuFont);
05061         }
05062 }

qboolean Item_TextScroll_HandleKey itemDef_t item,
int  key,
qboolean  down,
qboolean  force
 

Definition at line 2593 of file ui_shared.c.

References A_CURSOR_DOWN, A_CURSOR_UP, A_END, A_HOME, A_KP_1, A_KP_2, A_KP_3, A_KP_7, A_KP_8, A_KP_9, A_MOUSE1, A_MOUSE2, A_PAGE_DOWN, A_PAGE_UP, displayContextDef_t::cursorx, displayContextDef_t::cursory, DC, windowDef_t::flags, rectDef_t::h, Item_TextScroll_MaxScroll(), itemDef_t, textScrollDef_s::lineHeight, qboolean, qfalse, qtrue, windowDef_t::rect, Rect_ContainsPoint(), textScrollDef_s::startPos, textScrollDef_t, itemDef_s::typeData, itemDef_s::window, WINDOW_HASFOCUS, WINDOW_LB_LEFTARROW, WINDOW_LB_PGDN, WINDOW_LB_PGUP, WINDOW_LB_RIGHTARROW, and WINDOW_LB_THUMB.

Referenced by Item_HandleKey().

02594 {
02595         textScrollDef_t *scrollPtr = (textScrollDef_t*)item->typeData;
02596         int                             max;
02597         int                             viewmax;
02598 
02599         if (force || (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory) && item->window.flags & WINDOW_HASFOCUS)) 
02600         {
02601                 max = Item_TextScroll_MaxScroll(item);
02602 
02603                 viewmax = (item->window.rect.h / scrollPtr->lineHeight);
02604                 if ( key == A_CURSOR_UP || key == A_KP_8 ) 
02605                 {
02606                         scrollPtr->startPos--;
02607                         if (scrollPtr->startPos < 0)
02608                         {
02609                                 scrollPtr->startPos = 0;
02610                         }
02611                         return qtrue;
02612                 }
02613 
02614                 if ( key == A_CURSOR_DOWN || key == A_KP_2 ) 
02615                 {
02616                         scrollPtr->startPos++;
02617                         if (scrollPtr->startPos > max)
02618                         {
02619                                 scrollPtr->startPos = max;
02620                         }
02621 
02622                         return qtrue;
02623                 }
02624 
02625                 // mouse hit
02626                 if (key == A_MOUSE1 || key == A_MOUSE2) 
02627                 {
02628                         if (item->window.flags & WINDOW_LB_LEFTARROW) 
02629                         {
02630                                 scrollPtr->startPos--;
02631                                 if (scrollPtr->startPos < 0) 
02632                                 {
02633                                         scrollPtr->startPos = 0;
02634                                 }
02635                         } 
02636                         else if (item->window.flags & WINDOW_LB_RIGHTARROW) 
02637                         {
02638                                 // one down
02639                                 scrollPtr->startPos++;
02640                                 if (scrollPtr->startPos > max) 
02641                                 {
02642                                         scrollPtr->startPos = max;
02643                                 }
02644                         } 
02645                         else if (item->window.flags & WINDOW_LB_PGUP) 
02646                         {
02647                                 // page up
02648                                 scrollPtr->startPos -= viewmax;
02649                                 if (scrollPtr->startPos < 0) 
02650                                 {
02651                                         scrollPtr->startPos = 0;
02652                                 }
02653                         } 
02654                         else if (item->window.flags & WINDOW_LB_PGDN) 
02655                         {
02656                                 // page down
02657                                 scrollPtr->startPos += viewmax;
02658                                 if (scrollPtr->startPos > max) 
02659                                 {
02660                                         scrollPtr->startPos = max;
02661                                 }
02662                         } 
02663                         else if (item->window.flags & WINDOW_LB_THUMB) 
02664                         {
02665                                 // Display_SetCaptureItem(item);
02666                         } 
02667 
02668                         return qtrue;
02669                 }
02670 
02671                 if ( key == A_HOME || key == A_KP_7) 
02672                 {
02673                         // home
02674                         scrollPtr->startPos = 0;
02675                         return qtrue;
02676                 }
02677                 if ( key == A_END || key == A_KP_1) 
02678                 {
02679                         // end
02680                         scrollPtr->startPos = max;
02681                         return qtrue;
02682                 }
02683                 if (key == A_PAGE_UP || key == A_KP_9 ) 
02684                 {
02685                         scrollPtr->startPos -= viewmax;
02686                         if (scrollPtr->startPos < 0) 
02687                         {
02688                                         scrollPtr->startPos = 0;
02689                         }
02690 
02691                         return qtrue;
02692                 }
02693                 if ( key == A_PAGE_DOWN || key == A_KP_3 ) 
02694                 {
02695                         scrollPtr->startPos += viewmax;
02696                         if (scrollPtr->startPos > max) 
02697                         {
02698                                 scrollPtr->startPos = max;
02699                         }
02700                         return qtrue;
02701                 }
02702         }
02703 
02704         return qfalse;
02705 }

int Item_TextScroll_MaxScroll itemDef_t item  ) 
 

Definition at line 2482 of file ui_shared.c.

References rectDef_t::h, textScrollDef_s::iLineCount, itemDef_t, textScrollDef_s::lineHeight, windowDef_t::rect, textScrollDef_t, itemDef_s::typeData, and itemDef_s::window.

Referenced by Item_TextScroll_HandleKey(), and Item_TextScroll_ThumbPosition().

02483 {
02484         textScrollDef_t *scrollPtr = (textScrollDef_t*)item->typeData;
02485         
02486         int count = scrollPtr->iLineCount;
02487         int max   = count - (int)(item->window.rect.h / scrollPtr->lineHeight) + 1;
02488 
02489         if (max < 0) 
02490         {
02491                 return 0;
02492         }
02493 
02494         return max;
02495 }

void Item_TextScroll_MouseEnter itemDef_t item,
float  x,
float  y
 

Definition at line 2587 of file ui_shared.c.

References windowDef_t::flags, Item_TextScroll_OverLB(), itemDef_t, itemDef_s::window, WINDOW_LB_LEFTARROW, WINDOW_LB_PGDN, WINDOW_LB_PGUP, WINDOW_LB_RIGHTARROW, and WINDOW_LB_THUMB.

Referenced by Item_MouseEnter().

int Item_TextScroll_OverLB itemDef_t item,
float  x,
float  y
 

Definition at line 2539 of file ui_shared.c.

References rectDef_t::h, textScrollDef_s::iLineCount, Item_TextScroll_ThumbPosition(), itemDef_t, windowDef_t::rect, Rect_ContainsPoint(), SCROLLBAR_SIZE, textScrollDef_t, itemDef_s::typeData, rectDef_t::w, itemDef_s::window, WINDOW_LB_LEFTARROW, WINDOW_LB_PGDN, WINDOW_LB_PGUP, WINDOW_LB_RIGHTARROW, WINDOW_LB_THUMB, rectDef_t::x, and rectDef_t::y.

Referenced by Item_StartCapture(), and Item_TextScroll_MouseEnter().

02540 {
02541         rectDef_t               r;
02542         textScrollDef_t *scrollPtr;
02543         int                             thumbstart;
02544         int                             count;
02545 
02546         scrollPtr = (textScrollDef_t*)item->typeData;
02547         count     = scrollPtr->iLineCount;
02548 
02549         r.x = item->window.rect.x + item->window.rect.w - SCROLLBAR_SIZE;
02550         r.y = item->window.rect.y;
02551         r.h = r.w = SCROLLBAR_SIZE;
02552         if (Rect_ContainsPoint(&r, x, y)) 
02553         {
02554                 return WINDOW_LB_LEFTARROW;
02555         }
02556 
02557         r.y = item->window.rect.y + item->window.rect.h - SCROLLBAR_SIZE;
02558         if (Rect_ContainsPoint(&r, x, y)) 
02559         {
02560                 return WINDOW_LB_RIGHTARROW;
02561         }
02562 
02563         thumbstart = Item_TextScroll_ThumbPosition(item);
02564         r.y = thumbstart;
02565         if (Rect_ContainsPoint(&r, x, y)) 
02566         {
02567                 return WINDOW_LB_THUMB;
02568         }
02569 
02570         r.y = item->window.rect.y + SCROLLBAR_SIZE;
02571         r.h = thumbstart - r.y;
02572         if (Rect_ContainsPoint(&r, x, y)) 
02573         {
02574                 return WINDOW_LB_PGUP;
02575         }
02576 
02577         r.y = thumbstart + SCROLLBAR_SIZE;
02578         r.h = item->window.rect.y + item->window.rect.h - SCROLLBAR_SIZE;
02579         if (Rect_ContainsPoint(&r, x, y)) 
02580         {
02581                 return WINDOW_LB_PGDN;
02582         }
02583 
02584         return 0;
02585 }

void Item_TextScroll_Paint itemDef_t item  ) 
 

Definition at line 5911 of file ui_shared.c.

References displayContextDef_t::Assets, itemDef_s::cvar, DC, displayContextDef_t::drawHandlePic, textScrollDef_s::drawPadding, displayContextDef_t::drawText, textScrollDef_s::endPos, windowDef_t::foreColor, displayContextDef_t::getCVarString, rectDef_t::h, textScrollDef_s::iLineCount, itemDef_s::iMenuFont, Item_TextScroll_ThumbDrawPosition(), itemDef_t, textScrollDef_s::lineHeight, textScrollDef_s::pLines, windowDef_t::rect, cachedAssets_t::scrollBar, SCROLLBAR_SIZE, cachedAssets_t::scrollBarArrowDown, cachedAssets_t::scrollBarArrowUp, cachedAssets_t::scrollBarThumb, textScrollDef_s::startPos, itemDef_s::text, itemDef_s::textalignx, itemDef_s::textaligny, itemDef_s::textscale, textScrollDef_t, itemDef_s::textStyle, itemDef_s::typeData, rectDef_t::w, itemDef_s::window, rectDef_t::x, and rectDef_t::y.

Referenced by Item_Paint().

05912 {
05913         char cvartext[1024];
05914         float x, y, size, count, thumb;
05915         int       i;
05916         textScrollDef_t *scrollPtr = (textScrollDef_t*)item->typeData;
05917 
05918         count = scrollPtr->iLineCount;
05919 
05920         // draw scrollbar to right side of the window
05921         x = item->window.rect.x + item->window.rect.w - SCROLLBAR_SIZE - 1;
05922         y = item->window.rect.y + 1;
05923         DC->drawHandlePic(x, y, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarArrowUp);
05924         y += SCROLLBAR_SIZE - 1;
05925 
05926         scrollPtr->endPos = scrollPtr->startPos;
05927         size = item->window.rect.h - (SCROLLBAR_SIZE * 2);
05928         DC->drawHandlePic(x, y, SCROLLBAR_SIZE, size+1, DC->Assets.scrollBar);
05929         y += size - 1;
05930         DC->drawHandlePic(x, y, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarArrowDown);
05931         
05932         // thumb
05933         thumb = Item_TextScroll_ThumbDrawPosition(item);
05934         if (thumb > y - SCROLLBAR_SIZE - 1) 
05935         {
05936                 thumb = y - SCROLLBAR_SIZE - 1;
05937         }
05938         DC->drawHandlePic(x, thumb, SCROLLBAR_SIZE, SCROLLBAR_SIZE, DC->Assets.scrollBarThumb);
05939 
05940         if (item->cvar) 
05941         {
05942                 DC->getCVarString(item->cvar, cvartext, sizeof(cvartext));
05943                 item->text = cvartext;
05944                 Item_TextScroll_BuildLines ( item );
05945         }
05946 
05947         // adjust size for item painting
05948         size = item->window.rect.h - 2;
05949         x        = item->window.rect.x + item->textalignx + 1;
05950         y        = item->window.rect.y + item->textaligny + 1;
05951 
05952         for (i = scrollPtr->startPos; i < count; i++) 
05953         {
05954                 const char *text;
05955 
05956                 text = scrollPtr->pLines[i];
05957                 if (!text) 
05958                 {
05959                         continue;
05960                 }
05961 
05962                 DC->drawText(x + 4, y, item->textscale, item->window.foreColor, text, 0, 0, item->textStyle, item->iMenuFont);
05963 
05964                 size -= scrollPtr->lineHeight;
05965                 if (size < scrollPtr->lineHeight) 
05966                 {
05967                         scrollPtr->drawPadding = scrollPtr->lineHeight - size;
05968                         break;
05969                 }
05970 
05971                 scrollPtr->endPos++;
05972                 y += scrollPtr->lineHeight;
05973         }
05974 }

int Item_TextScroll_ThumbDrawPosition itemDef_t item  ) 
 

Definition at line 2519 of file ui_shared.c.

References displayContextDef_t::cursory, DC, rectDef_t::h, Item_TextScroll_ThumbPosition(), itemDef_t, min, windowDef_t::rect, SCROLLBAR_SIZE, itemDef_s::window, and rectDef_t::y.

Referenced by Item_TextScroll_Paint().

02520 {
02521         int min, max;
02522 
02523         if (itemCapture == item) 
02524         {
02525                 min = item->window.rect.y + SCROLLBAR_SIZE + 1;
02526                 max = item->window.rect.y + item->window.rect.h - 2*SCROLLBAR_SIZE - 1;
02527 
02528                 if (DC->cursory >= min + SCROLLBAR_SIZE/2 && DC->cursory <= max + SCROLLBAR_SIZE/2) 
02529                 {
02530                         return DC->cursory - SCROLLBAR_SIZE/2;
02531                 }
02532 
02533                 return Item_TextScroll_ThumbPosition(item);
02534         }
02535 
02536         return Item_TextScroll_ThumbPosition(item);
02537 }

int Item_TextScroll_ThumbPosition itemDef_t item  ) 
 

Definition at line 2497 of file ui_shared.c.

References rectDef_t::h, Item_TextScroll_MaxScroll(), itemDef_t, windowDef_t::rect, SCROLLBAR_SIZE, textScrollDef_s::startPos, textScrollDef_t, itemDef_s::typeData, itemDef_s::window, and rectDef_t::y.

Referenced by Item_TextScroll_OverLB(), and Item_TextScroll_ThumbDrawPosition().

02498 {
02499         float max, pos, size;
02500         textScrollDef_t *scrollPtr = (textScrollDef_t*)item->typeData;
02501 
02502         max  = Item_TextScroll_MaxScroll ( item );
02503         size = item->window.rect.h - (SCROLLBAR_SIZE * 2) - 2;
02504 
02505         if (max > 0) 
02506         {
02507                 pos = (size-SCROLLBAR_SIZE) / (float) max;
02508         } 
02509         else 
02510         {
02511                 pos = 0;
02512         }
02513         
02514         pos *= scrollPtr->startPos;
02515         
02516         return item->window.rect.y + 1 + SCROLLBAR_SIZE + pos;
02517 }

void Item_UpdatePosition itemDef_t item  ) 
 

Definition at line 933 of file ui_shared.c.

References windowDef_t::border, windowDef_t::borderSize, Item_SetScreenCoords(), itemDef_t, NULL, itemDef_s::parent, windowDef_t::rect, menuDef_t::window, rectDef_t::x, and rectDef_t::y.

Referenced by Item_Paint(), Menu_OrbitItemByName(), and Menu_TransitionItemByName().

00934 {
00935         float x, y;
00936         menuDef_t *menu;
00937   
00938         if (item == NULL || item->parent == NULL) 
00939         {
00940                 return;
00941         }
00942 
00943         menu = (menuDef_t *) item->parent;
00944 
00945         x = menu->window.rect.x;
00946         y = menu->window.rect.y;
00947   
00948         if (menu->window.border != 0) 
00949         {
00950                 x += menu->window.borderSize;
00951                 y += menu->window.borderSize;
00952         }
00953 
00954         Item_SetScreenCoords(item, x, y);
00955 
00956 }

void Item_ValidateTypeData itemDef_t item  ) 
 

Definition at line 7279 of file ui_shared.c.

References editFieldDef_t, ITEM_TYPE_BIND, ITEM_TYPE_EDITFIELD, ITEM_TYPE_LISTBOX, ITEM_TYPE_MODEL, ITEM_TYPE_MULTI, ITEM_TYPE_NUMERICFIELD, ITEM_TYPE_SLIDER, ITEM_TYPE_TEXT, ITEM_TYPE_TEXTSCROLL, ITEM_TYPE_YESNO, itemDef_t, listBoxDef_t, MAX_EDITFIELD, memset(), modelDef_t, multiDef_t, textScrollDef_t, itemDef_s::type, itemDef_s::typeData, and UI_Alloc().

Referenced by ItemParse_asset_model(), ItemParse_asset_model_go(), ItemParse_columns(), ItemParse_cvar(), ItemParse_cvarFloat(), ItemParse_cvarFloatList(), ItemParse_cvarStrList(), ItemParse_doubleClick(), ItemParse_elementheight(), ItemParse_elementtype(), ItemParse_elementwidth(), ItemParse_font(), ItemParse_lineHeight(), ItemParse_maxChars(), ItemParse_maxLineChars(), ItemParse_maxPaintChars(), ItemParse_model_angle(), ItemParse_model_fovx(), ItemParse_model_fovy(), ItemParse_model_g2anim(), ItemParse_model_g2anim_go(), ItemParse_model_g2maxs(), ItemParse_model_g2mins(), ItemParse_model_g2scale(), ItemParse_model_g2skin(), ItemParse_model_g2skin_go(), ItemParse_model_origin(), ItemParse_model_rotation(), ItemParse_notselectable(), ItemParse_scrollhidden(), and ItemParse_type().

07280 {
07281         if (item->typeData) 
07282         {
07283                 return;
07284         }
07285 
07286         if (item->type == ITEM_TYPE_LISTBOX) 
07287         {
07288                 item->typeData = UI_Alloc(sizeof(listBoxDef_t));
07289                 memset(item->typeData, 0, sizeof(listBoxDef_t));
07290         }
07291         else if (item->type == ITEM_TYPE_EDITFIELD || item->type == ITEM_TYPE_NUMERICFIELD || item->type == ITEM_TYPE_YESNO || item->type == ITEM_TYPE_BIND || item->type == ITEM_TYPE_SLIDER || item->type == ITEM_TYPE_TEXT) 
07292         {
07293                 item->typeData = UI_Alloc(sizeof(editFieldDef_t));
07294                 memset(item->typeData, 0, sizeof(editFieldDef_t));
07295                 if (item->type == ITEM_TYPE_EDITFIELD) 
07296                 {
07297                         if (!((editFieldDef_t *) item->typeData)->maxPaintChars) 
07298                         {
07299                                 ((editFieldDef_t *) item->typeData)->maxPaintChars = MAX_EDITFIELD;
07300                         }
07301                 }
07302         } 
07303         else if (item->type == ITEM_TYPE_MULTI) 
07304         {
07305                 item->typeData = UI_Alloc(sizeof(multiDef_t));
07306         } 
07307         else if (item->type == ITEM_TYPE_MODEL) 
07308         {
07309                 item->typeData = UI_Alloc(sizeof(modelDef_t));
07310                 memset(item->typeData, 0, sizeof(modelDef_t));
07311         }
07312         else if (item->type == ITEM_TYPE_TEXTSCROLL )
07313         {
07314                 item->typeData = UI_Alloc(sizeof(textScrollDef_t));
07315         }
07316 }

qboolean Item_YesNo_HandleKey itemDef_t item,
int  key
 

Definition at line 3477 of file ui_shared.c.

References A_CURSOR_LEFT, A_CURSOR_RIGHT, A_ENTER, A_MOUSE1, A_MOUSE2, A_MOUSE3, displayContextDef_t::cursorx, displayContextDef_t::cursory, itemDef_s::cvar, DC, windowDef_t::flags, displayContextDef_t::getCVarValue, itemDef_t, qboolean, qfalse, qtrue, windowDef_t::rect, Rect_ContainsPoint(), displayContextDef_t::setCVar, va(), itemDef_s::window, and WINDOW_HASFOCUS.

Referenced by Item_HandleKey().

03477                                                         {
03478 //JLFMOUSE MPMOVED
03479 #ifndef _XBOX
03480   if (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory) && item->window.flags & WINDOW_HASFOCUS && item->cvar) 
03481 #else
03482         if (item->window.flags & WINDOW_HASFOCUS && item->cvar) 
03483 #endif
03484         {
03485 
03486 //JLFDPAD MPMOVED
03487 #ifndef _XBOX
03488                 if (key == A_MOUSE1 || key == A_ENTER || key == A_MOUSE2 || key == A_MOUSE3) 
03489 #else
03490                 if ( key == A_CURSOR_RIGHT || key == A_CURSOR_LEFT)
03491 #endif
03492 //end JLFDPAD
03493 
03494                 {
03495             DC->setCVar(item->cvar, va("%i", !DC->getCVarValue(item->cvar)));
03496                   return qtrue;
03497                 }
03498   }
03499 
03500   return qfalse;
03501 
03502 }

void Item_YesNo_Paint itemDef_t item  ) 
 

Definition at line 5064 of file ui_shared.c.

References itemDef_s::cvar, DC, displayContextDef_t::drawText, windowDef_t::flags, menuDef_t::focusColor, windowDef_t::foreColor, displayContextDef_t::getCVarValue, itemDef_s::iMenuFont, itemDef_s::invertYesNo, Item_Text_Paint(), itemDef_t, LerpColor(), memcpy(), itemDef_s::parent, PULSE_DIVISOR, displayContextDef_t::realTime, sin(), itemDef_s::text, itemDef_s::textRect, itemDef_s::textscale, itemDef_s::textStyle, trap_SP_GetStringTextString(), vec4_t, rectDef_t::w, itemDef_s::window, WINDOW_HASFOCUS, rectDef_t::x, itemDef_s::xoffset, and rectDef_t::y.

Referenced by Item_Paint().

05064                                        {
05065         char    sYES[20];
05066         char    sNO[20];
05067         vec4_t newColor, lowLight;
05068         float value;
05069         menuDef_t *parent = (menuDef_t*)item->parent;
05070         const char *yesnovalue;
05071         
05072         value = (item->cvar) ? DC->getCVarValue(item->cvar) : 0;
05073 
05074         if (item->window.flags & WINDOW_HASFOCUS) {
05075                 lowLight[0] = 0.8 * parent->focusColor[0]; 
05076                 lowLight[1] = 0.8 * parent->focusColor[1]; 
05077                 lowLight[2] = 0.8 * parent->focusColor[2]; 
05078                 lowLight[3] = 0.8 * parent->focusColor[3]; 
05079                 LerpColor(parent->focusColor,lowLight,newColor,0.5+0.5*sin((float)(DC->realTime / PULSE_DIVISOR)));
05080         } else {
05081                 memcpy(&newColor, &item->window.foreColor, sizeof(vec4_t));
05082         }
05083 
05084 
05085         trap_SP_GetStringTextString("MENUS_YES",sYES, sizeof(sYES));
05086         trap_SP_GetStringTextString("MENUS_NO", sNO,  sizeof(sNO));
05087 
05088 //JLFYESNO MPMOVED
05089         if (item->invertYesNo)
05090                 yesnovalue = (value == 0) ? sYES : sNO;
05091         else
05092                 yesnovalue = (value != 0) ? sYES : sNO;
05093         
05094         if (item->text) 
05095         {
05096                 Item_Text_Paint(item);
05097 //JLF MPMOVED
05098 #ifdef _XBOX
05099                 if (item->xoffset == 0)
05100                         DC->drawText(item->textRect.x + item->textRect.w + item->xoffset + 8, item->textRect.y, item->textscale, newColor, yesnovalue, 0, 0,item->textStyle, item->iMenuFont);
05101                 else
05102 #endif
05103                         DC->drawText(item->textRect.x + item->textRect.w + 8, item->textRect.y, item->textscale, newColor, yesnovalue, 0, 0, item->textStyle, item->iMenuFont);
05104 
05105         } 
05106         else 
05107         {
05108 //JLF MPMOVED
05109 #ifdef _XBOX
05110                 DC->drawText(item->textRect.x + item->xoffset, item->textRect.y, item->textscale, newColor, yesnovalue , 0, 0, item->textStyle, item->iMenuFont);
05111 #else
05112                 DC->drawText(item->textRect.x, item->textRect.y, item->textscale, newColor, yesnovalue , 0, 0, item->textStyle, item->iMenuFont);
05113 #endif
05114         }               
05115 
05116 /* JLF ORIGINAL CODE
05117         if (item->text) {
05118                 Item_Text_Paint(item);
05119 //              DC->drawText(item->textRect.x + item->textRect.w + 8, item->textRect.y, item->textscale, newColor, (value != 0) ? sYES : sNO, 0, 0, item->textStyle);
05120                 DC->drawText(item->textRect.x + item->textRect.w + 8, item->textRect.y, item->textscale, newColor, (value != 0) ? sYES : sNO, 0, 0, item->textStyle,item->iMenuFont);
05121         } else {
05122 //              DC->drawText(item->textRect.x, item->textRect.y, item->textscale, newColor, (value != 0) ? sYES : sNO, 0, 0, item->textStyle);
05123                 DC->drawText(item->textRect.x, item->textRect.y, item->textscale, newColor, (value != 0) ? sYES : sNO, 0, 0, item->textStyle,item->iMenuFont);
05124         }
05125 */
05126 }

qboolean ItemParse_action itemDef_t item,
int  handle
 

Definition at line 8451 of file ui_shared.c.

References itemDef_s::action, itemDef_t, PC_Script_Parse(), qboolean, qfalse, and qtrue.

08451                                                          {
08452         if (!PC_Script_Parse(handle, &item->action)) {
08453                 return qfalse;
08454         }
08455         return qtrue;
08456 }

qboolean ItemParse_addColorRange itemDef_t item,
int  handle
 

Definition at line 8763 of file ui_shared.c.

References colorRangeDef_t::color, itemDef_s::colorRanges, colorRangeDef_t::high, itemDef_t, colorRangeDef_t::low, MAX_COLOR_RANGES, memcpy(), itemDef_s::numColors, PC_Color_Parse(), PC_Float_Parse(), qboolean, qfalse, and qtrue.

08763                                                                 {
08764         colorRangeDef_t color;
08765 
08766         if (PC_Float_Parse(handle, &color.low) &&
08767                 PC_Float_Parse(handle, &color.high) &&
08768                 PC_Color_Parse(handle, &color.color) ) {
08769                 if (item->numColors < MAX_COLOR_RANGES) {
08770                         memcpy(&item->colorRanges[item->numColors], &color, sizeof(color));
08771                         item->numColors++;
08772                 }
08773                 return qtrue;
08774         }
08775         return qfalse;
08776 }

qboolean ItemParse_align itemDef_t item,
int  handle
 

Definition at line 8213 of file ui_shared.c.

References itemDef_s::alignment, itemDef_t, PC_Int_Parse(), qboolean, qfalse, and qtrue.

08213                                                         {
08214         if (!PC_Int_Parse(handle, &item->alignment)) {
08215                 return qfalse;
08216         }
08217         return qtrue;
08218 }

qboolean ItemParse_Appearance_slot itemDef_t item,
int  handle
 

Definition at line 8824 of file ui_shared.c.

References itemDef_s::appearanceSlot, itemDef_t, PC_Int_Parse(), qboolean, qfalse, and qtrue.

08825 {
08826         if (!PC_Int_Parse(handle, &item->appearanceSlot))
08827         {
08828                 return qfalse;
08829         }
08830         return qtrue;
08831 }

qboolean ItemParse_asset_model itemDef_t item,
int  handle
 

Definition at line 7659 of file ui_shared.c.

References Com_sprintf(), Item_ValidateTypeData(), itemDef_t, ItemParse_asset_model_go(), MAX_QPATH, modelDef_t, pc_token_t, qboolean, qfalse, pc_token_s::string, trap_Cvar_VariableStringBuffer(), trap_PC_ReadToken(), itemDef_s::typeData, and ui_char_model.

07659                                                               {
07660         const char *temp;
07661         modelDef_t *modelPtr;
07662         int animRunLength;
07663         pc_token_t token;
07664 
07665         Item_ValidateTypeData(item);
07666         modelPtr = (modelDef_t*)item->typeData;
07667 
07668         if (!trap_PC_ReadToken(handle, &token)) {
07669                 return qfalse;
07670         }
07671         temp = token.string;
07672 
07673 #ifndef CGAME
07674         if (!stricmp(token.string,"ui_char_model") )
07675         {
07676                 char modelPath[MAX_QPATH];
07677                 char ui_char_model[MAX_QPATH];
07678                 trap_Cvar_VariableStringBuffer("ui_char_model", ui_char_model, sizeof(ui_char_model) );
07679                 Com_sprintf( modelPath, sizeof( modelPath ), "models/players/%s/model.glm", ui_char_model );
07680                 temp = modelPath;
07681         }
07682 #endif
07683         return (ItemParse_asset_model_go( item, temp, &animRunLength ));
07684 }

qboolean ItemParse_asset_model_go itemDef_t item,
const char *  name,
int *  runTimeLength
 

Referenced by Item_Model_Paint(), ItemParse_asset_model(), and UI_FeederSelection().

qboolean ItemParse_asset_shader itemDef_t item,
int  handle
 

Definition at line 7687 of file ui_shared.c.

References itemDef_s::asset, DC, itemDef_t, pc_token_t, qboolean, qfalse, qtrue, displayContextDef_t::registerShaderNoMip, pc_token_s::string, and trap_PC_ReadToken().

07687                                                                {
07688         pc_token_t token;
07689         if (!trap_PC_ReadToken(handle, &token)) {
07690                 return qfalse;
07691         }
07692         item->asset = DC->registerShaderNoMip(token.string);
07693         return qtrue;
07694 }

qboolean ItemParse_autowrapped itemDef_t item,
int  handle
 

Definition at line 8069 of file ui_shared.c.

References windowDef_t::flags, itemDef_t, qboolean, qtrue, itemDef_s::window, and WINDOW_AUTOWRAPPED.

08069                                                               {
08070         item->window.flags |= WINDOW_AUTOWRAPPED;
08071         return qtrue;
08072 }

qboolean ItemParse_backcolor itemDef_t item,
int  handle
 

Definition at line 8322 of file ui_shared.c.

References windowDef_t::backColor, itemDef_t, PC_Float_Parse(), qboolean, qfalse, qtrue, and itemDef_s::window.

08322                                                             {
08323         int i;
08324         float f;
08325 
08326         for (i = 0; i < 4; i++) {
08327                 if (!PC_Float_Parse(handle, &f)) {
08328                         return qfalse;
08329                 }
08330                 item->window.backColor[i]  = f;
08331         }
08332         return qtrue;
08333 }

qboolean ItemParse_background itemDef_t item,
int  handle
 

Definition at line 8376 of file ui_shared.c.

References windowDef_t::background, DC, itemDef_t, pc_token_t, qboolean, qfalse, qtrue, displayContextDef_t::registerShaderNoMip, pc_token_s::string, trap_PC_ReadToken(), and itemDef_s::window.

08376                                                              {
08377         pc_token_t token;
08378 
08379         if (!trap_PC_ReadToken(handle, &token)) {
08380                 return qfalse;
08381         }
08382         item->window.background = DC->registerShaderNoMip(token.string);
08383         return qtrue;
08384 }

qboolean ItemParse_border itemDef_t item,
int  handle
 

Definition at line 8179 of file ui_shared.c.

References windowDef_t::border, itemDef_t, PC_Int_Parse(), qboolean, qfalse, qtrue, and itemDef_s::window.

08179                                                          {
08180         if (!PC_Int_Parse(handle, &item->window.border)) {
08181                 return qfalse;
08182         }
08183         return qtrue;
08184 }

qboolean ItemParse_bordercolor itemDef_t item,
int  handle
 

Definition at line 8356 of file ui_shared.c.

References windowDef_t::borderColor, itemDef_t, PC_Float_Parse(), qboolean, qfalse, qtrue, and itemDef_s::window.

08356                                                               {
08357         int i;
08358         float f;
08359 
08360         for (i = 0; i < 4; i++) {
08361                 if (!PC_Float_Parse(handle, &f)) {
08362                         return qfalse;
08363                 }
08364                 item->window.borderColor[i]  = f;
08365         }
08366         return qtrue;
08367 }

qboolean ItemParse_bordersize itemDef_t item,
int  handle
 

Definition at line 8186 of file ui_shared.c.

References windowDef_t::borderSize, itemDef_t, PC_Float_Parse(), qboolean, qfalse, qtrue, and itemDef_s::window.

08186                                                              {
08187         if (!PC_Float_Parse(handle, &item->window.borderSize)) {
08188                 return qfalse;
08189         }
08190         return qtrue;
08191 }

qboolean ItemParse_cinematic itemDef_t item,
int  handle
 

Definition at line 8386 of file ui_shared.c.

References windowDef_t::cinematicName, itemDef_t, PC_String_Parse(), qboolean, qfalse, qtrue, and itemDef_s::window.

08386                                                             {
08387         if (!PC_String_Parse(handle, &item->window.cinematicName)) {
08388                 return qfalse;
08389         }
08390         return qtrue;
08391 }

qboolean ItemParse_columns itemDef_t item,
int  handle
 

Definition at line 8149 of file ui_shared.c.

References listBoxDef_s::columnInfo, Item_ValidateTypeData(), itemDef_t, listBoxDef_t, MAX_LB_COLUMNS, columnInfo_s::maxChars, listBoxDef_s::numColumns, PC_Int_Parse(), columnInfo_s::pos, qboolean, qfalse, qtrue, itemDef_s::typeData, and columnInfo_s::width.

08149                                                           {
08150         int num, i;
08151         listBoxDef_t *listPtr;
08152 
08153         Item_ValidateTypeData(item);
08154         if (!item->typeData)
08155                 return qfalse;
08156         listPtr = (listBoxDef_t*)item->typeData;
08157         if (PC_Int_Parse(handle, &num)) {
08158                 if (num > MAX_LB_COLUMNS) {
08159                         num = MAX_LB_COLUMNS;
08160                 }
08161                 listPtr->numColumns = num;
08162                 for (i = 0; i < num; i++) {
08163                         int pos, width, maxChars;
08164 
08165                         if (PC_Int_Parse(handle, &pos) && PC_Int_Parse(handle, &width) && PC_Int_Parse(handle, &maxChars)) {
08166                                 listPtr->columnInfo[i].pos = pos;
08167                                 listPtr->columnInfo[i].width = width;
08168                                 listPtr->columnInfo[i].maxChars = maxChars;
08169                         } else {
08170                                 return qfalse;
08171                         }
08172                 }
08173         } else {
08174                 return qfalse;
08175         }
08176         return qtrue;
08177 }

qboolean ItemParse_cvar itemDef_t item,
int  handle
 

Definition at line 8472 of file ui_shared.c.

References itemDef_s::cvar, editFieldDef_s::defVal, editFieldDef_t, ITEM_TYPE_BIND, ITEM_TYPE_EDITFIELD, ITEM_TYPE_NUMERICFIELD, ITEM_TYPE_SLIDER, ITEM_TYPE_TEXT, ITEM_TYPE_YESNO, Item_ValidateTypeData(), itemDef_t, editFieldDef_s::maxVal, editFieldDef_s::minVal, PC_String_Parse(), qboolean, qfalse, qtrue, itemDef_s::type, and itemDef_s::typeData.

08473 {
08474         Item_ValidateTypeData(item);
08475         if (!PC_String_Parse(handle, &item->cvar)) 
08476         {
08477                 return qfalse;
08478         }
08479 
08480         if ( item->typeData)
08481         {
08482                 editFieldDef_t *editPtr;
08483 
08484                 switch ( item->type )
08485                 {
08486                         case ITEM_TYPE_EDITFIELD:
08487                         case ITEM_TYPE_NUMERICFIELD:
08488                         case ITEM_TYPE_YESNO:
08489                         case ITEM_TYPE_BIND:
08490                         case ITEM_TYPE_SLIDER:
08491                         case ITEM_TYPE_TEXT:
08492                                 editPtr = (editFieldDef_t*)item->typeData;
08493                                 editPtr->minVal = -1;
08494                                 editPtr->maxVal = -1;
08495                                 editPtr->defVal = -1;
08496                                 break;
08497                 }
08498         }
08499         return qtrue;
08500 }

qboolean ItemParse_cvarFloat itemDef_t item,
int  handle
 

Definition at line 8585 of file ui_shared.c.

References itemDef_s::cvar, editFieldDef_s::defVal, editFieldDef_t, Item_ValidateTypeData(), itemDef_t, editFieldDef_s::maxVal, editFieldDef_s::minVal, PC_Float_Parse(), PC_String_Parse(), qboolean, qfalse, qtrue, and itemDef_s::typeData.

08585                                                             {
08586         editFieldDef_t *editPtr;
08587 
08588         Item_ValidateTypeData(item);
08589         if (!item->typeData)
08590                 return qfalse;
08591         editPtr = (editFieldDef_t*)item->typeData;
08592         if (PC_String_Parse(handle, &item->cvar) &&
08593                 PC_Float_Parse(handle, &editPtr->defVal) &&
08594                 PC_Float_Parse(handle, &editPtr->minVal) &&
08595                 PC_Float_Parse(handle, &editPtr->maxVal)) {
08596                 return qtrue;
08597         }
08598         return qfalse;
08599 }

qboolean ItemParse_cvarFloatList itemDef_t item,
int  handle
 

Definition at line 8696 of file ui_shared.c.

References multiDef_s::count, multiDef_s::cvarList, multiDef_s::cvarValue, Item_ValidateTypeData(), itemDef_t, MAX_MULTI_CVARS, multiDef_t, PC_Float_Parse(), PC_SourceError(), PC_String_Parse(), pc_token_t, qboolean, qfalse, qtrue, multiDef_s::strDef, pc_token_s::string, trap_PC_ReadToken(), and itemDef_s::typeData.

08697 {
08698         pc_token_t token;
08699         multiDef_t *multiPtr;
08700         
08701         Item_ValidateTypeData(item);
08702         if (!item->typeData)
08703         {
08704                 return qfalse;
08705         }
08706         
08707         multiPtr = (multiDef_t*)item->typeData;
08708         multiPtr->count = 0;
08709         multiPtr->strDef = qfalse;
08710 
08711         if (!trap_PC_ReadToken(handle, &token))
08712         {
08713                 return qfalse;
08714         }
08715         
08716         if (*token.string != '{') 
08717         {
08718                 return qfalse;
08719         }
08720 
08721         while ( 1 ) 
08722         {
08723                 char* string;
08724 
08725                 if ( !PC_String_Parse ( handle, (const char **)&string ) )
08726                 {
08727                         PC_SourceError(handle, "end of file inside menu item\n");
08728                         return qfalse;
08729                 }
08730                         
08731                 //a normal StringAlloc ptr
08732                 if ((int)string > 0)    
08733                 {
08734                         if (*string == '}') 
08735                         {
08736                                 return qtrue;
08737                         }
08738 
08739                         if (*string == ',' || *string == ';') 
08740                         {
08741                                 continue;
08742                         }
08743                 }
08744 
08745                 multiPtr->cvarList[multiPtr->count] = string;
08746                 if (!PC_Float_Parse(handle, &multiPtr->cvarValue[multiPtr->count])) 
08747                 {
08748                         return qfalse;
08749                 }
08750 
08751                 multiPtr->count++;
08752                 if (multiPtr->count >= MAX_MULTI_CVARS) 
08753                 {
08754                         return qfalse;
08755                 }
08756 
08757         }
08758         return qfalse;  // bk001205 - LCC missing return value
08759 }

qboolean ItemParse_cvarStrList itemDef_t item,
int  handle
 

Definition at line 8604 of file ui_shared.c.

References multiDef_s::count, currLanguage, multiDef_s::cvarList, multiDef_s::cvarStr, FEEDER_LANGUAGES, FEEDER_PLAYER_SPECIES, Item_ValidateTypeData(), itemDef_t, uiInfo_t::languageCount, MAX_MULTI_CVARS, multiDef_t, PC_SourceError(), PC_String_Parse(), pc_token_t, uiInfo_t::playerSpecies, uiInfo_t::playerSpeciesCount, Q_stricmp(), qboolean, qfalse, qtrue, itemDef_s::special, multiDef_s::strDef, pc_token_s::string, String_Alloc(), trap_GetLanguageName(), trap_PC_ReadToken(), itemDef_s::typeData, uiInfo, and va().

08604                                                               {
08605         pc_token_t token;
08606         multiDef_t *multiPtr;
08607         int pass;
08608         
08609         Item_ValidateTypeData(item);
08610         if (!item->typeData)
08611                 return qfalse;
08612         multiPtr = (multiDef_t*)item->typeData;
08613         multiPtr->count = 0;
08614         multiPtr->strDef = qtrue;
08615 
08616         if (!trap_PC_ReadToken(handle, &token))
08617         {
08618                 return qfalse;
08619         }
08620 
08621         if (!Q_stricmp(token.string,"feeder") && item->special == FEEDER_PLAYER_SPECIES) 
08622         {
08623 #ifndef CGAME
08624                 for (; multiPtr->count < uiInfo.playerSpeciesCount; multiPtr->count++)
08625                 {
08626                         multiPtr->cvarList[multiPtr->count] = String_Alloc(strupr(va("@MENUS_%s",uiInfo.playerSpecies[multiPtr->count].Name )));        //look up translation
08627                         multiPtr->cvarStr[multiPtr->count] = uiInfo.playerSpecies[multiPtr->count].Name;        //value
08628                 }
08629 #endif
08630                 return qtrue;
08631         }
08632         // languages
08633         if (!Q_stricmp(token.string,"feeder") && item->special == FEEDER_LANGUAGES) 
08634         {
08635 #ifndef CGAME
08636                 for (; multiPtr->count < uiInfo.languageCount; multiPtr->count++)
08637                 {
08638                         // The displayed text
08639                         trap_GetLanguageName( (const int) multiPtr->count,(char *) currLanguage[multiPtr->count]  );    // eg "English"
08640                         multiPtr->cvarList[multiPtr->count] = languageString;
08641                         // The cvar value that goes into se_language
08642                         trap_GetLanguageName( (const int) multiPtr->count,(char *) currLanguage[multiPtr->count] );
08643                         multiPtr->cvarStr[multiPtr->count] = currLanguage[multiPtr->count];
08644                 }
08645 #endif
08646                 return qtrue;
08647         }
08648 
08649         if (*token.string != '{') {
08650                 return qfalse;
08651         }
08652 
08653         pass = 0;
08654         while ( 1 ) {
08655                 char* psString;
08656 
08657 //              if (!trap_PC_ReadToken(handle, &token)) {
08658 //                      PC_SourceError(handle, "end of file inside menu item\n");
08659 //                      return qfalse;
08660 //              }                  
08661 
08662                 if (!PC_String_Parse(handle, (const char **)&psString)) 
08663                 {
08664                         PC_SourceError(handle, "end of file inside menu item\n");
08665                         return qfalse;
08666                 }
08667 
08668                 //a normal StringAlloc ptr
08669                 if ((int)psString > 0)  
08670                 {
08671                         if (*psString == '}') {
08672                                 return qtrue;
08673                         }
08674 
08675                         if (*psString == ',' || *psString == ';') {
08676                                 continue;
08677                         }
08678                 }
08679 
08680                 if (pass == 0) {
08681                         multiPtr->cvarList[multiPtr->count] = psString;
08682                         pass = 1;
08683                 } else {
08684                         multiPtr->cvarStr[multiPtr->count] = psString;
08685                         pass = 0;
08686                         multiPtr->count++;
08687                         if (multiPtr->count >= MAX_MULTI_CVARS) {
08688                                 return qfalse;
08689                         }
08690                 }
08691 
08692         }
08693         return qfalse;  // bk001205 - LCC missing return value
08694 }

qboolean ItemParse_cvarTest itemDef_t item,
int  handle
 

Definition at line 8465 of file ui_shared.c.

References itemDef_s::cvarTest, itemDef_t, PC_String_Parse(), qboolean, qfalse, and qtrue.

08465                                                            {
08466         if (!PC_String_Parse(handle, &item->cvarTest)) {
08467                 return qfalse;
08468         }
08469         return qtrue;
08470 }

qboolean ItemParse_decoration itemDef_t item,
int  handle
 

Definition at line 8023 of file ui_shared.c.

References windowDef_t::flags, itemDef_t, qboolean, qtrue, itemDef_s::window, and WINDOW_DECORATION.

08023                                                              {
08024         item->window.flags |= WINDOW_DECORATION;
08025         return qtrue;
08026 }

qboolean ItemParse_descText itemDef_t item,
int  handle
 

Definition at line 7412 of file ui_shared.c.

References itemDef_s::descText, itemDef_t, PC_String_Parse(), qboolean, qfalse, and qtrue.

07413 {
07414 
07415         if (!PC_String_Parse(handle, &item->descText))
07416         {
07417                 return qfalse;
07418         }
07419 
07420         return qtrue;
07421 
07422 }

qboolean ItemParse_disableCvar itemDef_t item,
int  handle
 

Definition at line 8795 of file ui_shared.c.

References CVAR_DISABLE, itemDef_s::cvarFlags, itemDef_s::enableCvar, itemDef_t, PC_Script_Parse(), qboolean, qfalse, and qtrue.

08795                                                               {
08796         if (PC_Script_Parse(handle, &item->enableCvar)) {
08797                 item->cvarFlags = CVAR_DISABLE;
08798                 return qtrue;
08799         }
08800         return qfalse;
08801 }

qboolean ItemParse_doubleClick itemDef_t item,
int  handle
 

Definition at line 8393 of file ui_shared.c.

References listBoxDef_s::doubleClick, Item_ValidateTypeData(), itemDef_t, listBoxDef_t, PC_Script_Parse(), qboolean, qfalse, qtrue, and itemDef_s::typeData.

08393                                                               {
08394         listBoxDef_t *listPtr;
08395 
08396         Item_ValidateTypeData(item);
08397         if (!item->typeData) {
08398                 return qfalse;
08399         }
08400 
08401         listPtr = (listBoxDef_t*)item->typeData;
08402 
08403         if (!PC_Script_Parse(handle, &listPtr->doubleClick)) {
08404                 return qfalse;
08405         }
08406         return qtrue;
08407 }

qboolean ItemParse_elementheight itemDef_t item,
int  handle
 

Definition at line 8114 of file ui_shared.c.

References listBoxDef_s::elementHeight, Item_ValidateTypeData(), itemDef_t, listBoxDef_t, PC_Float_Parse(), qboolean, qfalse, qtrue, and itemDef_s::typeData.

08114                                                                 {
08115         listBoxDef_t *listPtr;
08116 
08117         Item_ValidateTypeData(item);
08118         listPtr = (listBoxDef_t*)item->typeData;
08119         if (!PC_Float_Parse(handle, &listPtr->elementHeight)) {
08120                 return qfalse;
08121         }
08122         return qtrue;
08123 }

qboolean ItemParse_elementtype itemDef_t item,
int  handle
 

Definition at line 8135 of file ui_shared.c.

References listBoxDef_s::elementStyle, Item_ValidateTypeData(), itemDef_t, listBoxDef_t, PC_Int_Parse(), qboolean, qfalse, qtrue, and itemDef_s::typeData.

08135                                                               {
08136         listBoxDef_t *listPtr;
08137 
08138         Item_ValidateTypeData(item);
08139         if (!item->typeData)
08140                 return qfalse;
08141         listPtr = (listBoxDef_t*)item->typeData;
08142         if (!PC_Int_Parse(handle, &listPtr->elementStyle)) {
08143                 return qfalse;
08144         }
08145         return qtrue;
08146 }

qboolean ItemParse_elementwidth itemDef_t item,
int  handle
 

Definition at line 8101 of file ui_shared.c.

References listBoxDef_s::elementWidth, Item_ValidateTypeData(), itemDef_t, listBoxDef_t, PC_Float_Parse(), qboolean, qfalse, qtrue, and itemDef_s::typeData.

08101                                                                {
08102         listBoxDef_t *listPtr;
08103 
08104         Item_ValidateTypeData(item);
08105         listPtr = (listBoxDef_t*)item->typeData;
08106         if (!PC_Float_Parse(handle, &listPtr->elementWidth)) {
08107                 return qfalse;
08108         }
08109         return qtrue;
08110 }

qboolean ItemParse_enableCvar itemDef_t item,
int  handle
 

Definition at line 8787 of file ui_shared.c.

References CVAR_ENABLE, itemDef_s::cvarFlags, itemDef_s::enableCvar, itemDef_t, PC_Script_Parse(), qboolean, qfalse, and qtrue.

08787                                                              {
08788         if (PC_Script_Parse(handle, &item->enableCvar)) {
08789                 item->cvarFlags = CVAR_ENABLE;
08790                 return qtrue;
08791         }
08792         return qfalse;
08793 }

qboolean ItemParse_feeder itemDef_t item,
int  handle
 

Definition at line 8126 of file ui_shared.c.

References itemDef_t, PC_Float_Parse(), qboolean, qfalse, qtrue, and itemDef_s::special.

08126                                                          {
08127         if (!PC_Float_Parse(handle, &item->special)) {
08128                 return qfalse;
08129         }
08130         return qtrue;
08131 }

qboolean ItemParse_flag itemDef_t item,
int  handle
 

Definition at line 7975 of file ui_shared.c.

References Com_Printf(), windowDef_t::flags, itemDef_t, itemFlags, NULL, pc_token_t, Q_stricmp(), qboolean, qfalse, qtrue, S_COLOR_YELLOW, itemFlagsDef_s::string, pc_token_s::string, styles, trap_PC_ReadToken(), va(), itemFlagsDef_s::value, and itemDef_s::window.

07976 {
07977         int             i;
07978         pc_token_t token;
07979 
07980         if (!trap_PC_ReadToken(handle, &token))
07981         {
07982                 return qfalse;
07983         }
07984 
07985         i=0;
07986         while (styles[i])
07987         {
07988                 if (Q_stricmp(token.string,itemFlags[i].string)==0)
07989                 {
07990                         item->window.flags |= itemFlags[i].value;
07991                         break;
07992                 }
07993                 i++;
07994         }
07995 
07996         if (itemFlags[i].string == NULL)
07997         {
07998                 Com_Printf(va( S_COLOR_YELLOW "Unknown item style value '%s'",token.string));
07999         }
08000 
08001         return qtrue;
08002 }

qboolean ItemParse_focusSound itemDef_t item,
int  handle
 

Definition at line 7388 of file ui_shared.c.

References DC, itemDef_s::focusSound, itemDef_t, pc_token_t, qboolean, qfalse, qtrue, displayContextDef_t::registerSound, pc_token_s::string, and trap_PC_ReadToken().

07388                                                              {
07389         pc_token_t token;
07390         if (!trap_PC_ReadToken(handle, &token)) {
07391                 return qfalse;
07392         }
07393         item->focusSound = DC->registerSound(token.string);
07394         return qtrue;
07395 }

qboolean ItemParse_font itemDef_t item,
int  handle
 

Definition at line 8502 of file ui_shared.c.

References itemDef_s::iMenuFont, Item_ValidateTypeData(), itemDef_t, PC_Int_Parse(), qboolean, qfalse, and qtrue.

08503 {
08504         Item_ValidateTypeData(item);
08505         if (!PC_Int_Parse(handle, &item->iMenuFont)) 
08506         {
08507                 return qfalse;
08508         }
08509         return qtrue;
08510 }

qboolean ItemParse_forecolor itemDef_t item,
int  handle
 

Definition at line 8335 of file ui_shared.c.

References windowDef_t::flags, windowDef_t::foreColor, itemDef_t, PC_Float_Parse(), qboolean, qfalse, qtrue, itemDef_s::window, WINDOW_FORECOLORSET, and WINDOW_PLAYERCOLOR.

08335                                                             {
08336         int i;
08337         float f;
08338 
08339         for (i = 0; i < 4; i++) {
08340                 if (!PC_Float_Parse(handle, &f)) {
08341                         return qfalse;
08342                 }
08343 
08344                 if (f < 0)
08345                 {       //special case for player color
08346                         item->window.flags |= WINDOW_PLAYERCOLOR;
08347                         return qtrue;
08348                 }
08349 
08350                 item->window.foreColor[i]  = f;
08351                 item->window.flags |= WINDOW_FORECOLORSET;
08352         }
08353         return qtrue;
08354 }

qboolean ItemParse_group itemDef_t item,
int  handle
 

Definition at line 7472 of file ui_shared.c.

References windowDef_t::group, itemDef_t, PC_String_Parse(), qboolean, qfalse, qtrue, and itemDef_s::window.

07472                                                         {
07473         if (!PC_String_Parse(handle, &item->window.group)) {
07474                 return qfalse;
07475         }
07476         return qtrue;
07477 }

qboolean ItemParse_hideCvar itemDef_t item,
int  handle
 

Definition at line 8811 of file ui_shared.c.

References CVAR_HIDE, itemDef_s::cvarFlags, itemDef_s::enableCvar, itemDef_t, PC_Script_Parse(), qboolean, qfalse, and qtrue.

08811                                                            {
08812         if (PC_Script_Parse(handle, &item->enableCvar)) {
08813                 item->cvarFlags = CVAR_HIDE;
08814                 return qtrue;
08815         }
08816         return qfalse;
08817 }

qboolean ItemParse_horizontalscroll itemDef_t item,
int  handle
 

Definition at line 8076 of file ui_shared.c.

References windowDef_t::flags, itemDef_t, qboolean, qtrue, itemDef_s::window, and WINDOW_HORIZONTAL.

08076                                                                    {
08077         item->window.flags |= WINDOW_HORIZONTAL;
08078         return qtrue;
08079 }

qboolean ItemParse_invertyesno itemDef_t item,
int  handle
 

Definition at line 8298 of file ui_shared.c.

References itemDef_s::invertYesNo, itemDef_t, PC_Int_Parse(), qboolean, qfalse, and qtrue.

08299 {
08300         if (!PC_Int_Parse(handle, &item->invertYesNo)) 
08301         {
08302                 return qfalse;
08303         }
08304         return qtrue;
08305 }

qboolean ItemParse_isCharacter itemDef_t item,
int  handle
 

Definition at line 8227 of file ui_shared.c.

References itemDef_s::flags, itemDef_t, ITF_ISCHARACTER, PC_Int_Parse(), qboolean, qfalse, and qtrue.

08228 {
08229         int flag;
08230 
08231         if (PC_Int_Parse(handle, &flag)) 
08232         {
08233                 if ( flag )
08234                 {
08235                         item->flags |= ITF_ISCHARACTER;
08236                 }
08237                 else
08238                 {
08239                         item->flags &= ~ITF_ISCHARACTER;
08240                 }
08241                 return qtrue;
08242         }
08243         return qfalse;
08244 }

qboolean ItemParse_isSaber itemDef_t item,
int  handle
 

Definition at line 8833 of file ui_shared.c.

References itemDef_s::flags, itemDef_t, ITF_ISSABER, PC_Int_Parse(), qboolean, qfalse, qtrue, UI_CacheSaberGlowGraphics(), ui_saber_parms_parsed, and UI_SaberLoadParms().

08834 {
08835 #ifndef CGAME
08836 
08837         int     i;
08838 
08839         if (PC_Int_Parse(handle, &i)) 
08840         {
08841                 if ( i )
08842                 {
08843                         item->flags |= ITF_ISSABER;
08844                         UI_CacheSaberGlowGraphics();
08845                         if ( !ui_saber_parms_parsed )
08846                         {
08847                                 UI_SaberLoadParms();
08848                         }
08849                 }
08850                 else
08851                 {
08852                         item->flags &= ~ITF_ISSABER;
08853                 }
08854         
08855                 return qtrue;
08856         }
08857 #endif
08858         return qfalse;
08859 }

qboolean ItemParse_isSaber2 itemDef_t item,
int  handle
 

Definition at line 8865 of file ui_shared.c.

References itemDef_s::flags, itemDef_t, ITF_ISSABER2, PC_Int_Parse(), qboolean, qfalse, qtrue, UI_CacheSaberGlowGraphics(), ui_saber_parms_parsed, and UI_SaberLoadParms().

08866 {
08867 #ifndef CGAME
08868         int     i;
08869         if (PC_Int_Parse(handle, &i)) 
08870         {
08871                 if ( i )
08872                 {
08873                         item->flags |= ITF_ISSABER2;
08874                         UI_CacheSaberGlowGraphics();
08875                         if ( !ui_saber_parms_parsed )
08876                         {
08877                                 UI_SaberLoadParms();
08878                         }
08879                 }
08880                 else
08881                 {
08882                         item->flags &= ~ITF_ISSABER2;
08883                 }
08884 
08885                 return qtrue;
08886         }
08887 #endif
08888         
08889         return qfalse;
08890 }

qboolean ItemParse_leaveFocus itemDef_t item,
int  handle
 

Definition at line 8416 of file ui_shared.c.

References itemDef_t, itemDef_s::leaveFocus, PC_Script_Parse(), qboolean, qfalse, and qtrue.

08416                                                              {
08417         if (!PC_Script_Parse(handle, &item->leaveFocus)) {
08418                 return qfalse;
08419         }
08420         return qtrue;
08421 }

qboolean ItemParse_lineHeight itemDef_t item,
int  handle
 

Definition at line 8565 of file ui_shared.c.

References Item_ValidateTypeData(), itemDef_t, textScrollDef_s::lineHeight, PC_Int_Parse(), qboolean, qfalse, qtrue, textScrollDef_t, and itemDef_s::typeData.

08566 {
08567         textScrollDef_t *scrollPtr;
08568         int                             height;
08569 
08570         Item_ValidateTypeData(item);
08571         if (!item->typeData)
08572                 return qfalse;
08573 
08574         if (!PC_Int_Parse(handle, &height)) 
08575         {
08576                 return qfalse;
08577         }
08578 
08579         scrollPtr = (textScrollDef_t*)item->typeData;
08580         scrollPtr->lineHeight = height;
08581 
08582         return qtrue;
08583 }

qboolean ItemParse_maxChars itemDef_t item,
int  handle
 

Definition at line 8513 of file ui_shared.c.

References editFieldDef_t, Item_ValidateTypeData(), itemDef_t, editFieldDef_s::maxChars, PC_Int_Parse(), qboolean, qfalse, qtrue, and itemDef_s::typeData.

08513                                                            {
08514         editFieldDef_t *editPtr;
08515         int maxChars;
08516 
08517         Item_ValidateTypeData(item);
08518         if (!item->typeData)
08519                 return qfalse;
08520 
08521         if (!PC_Int_Parse(handle, &maxChars)) {
08522                 return qfalse;
08523         }
08524         editPtr = (editFieldDef_t*)item->typeData;
08525         editPtr->maxChars = maxChars;
08526         return qtrue;
08527 }

qboolean ItemParse_maxLineChars itemDef_t item,
int  handle
 

Definition at line 8545 of file ui_shared.c.

References Item_ValidateTypeData(), itemDef_t, textScrollDef_s::maxLineChars, PC_Int_Parse(), qboolean, qfalse, qtrue, textScrollDef_t, and itemDef_s::typeData.

08546 {
08547         textScrollDef_t *scrollPtr;
08548         int                             maxChars;
08549 
08550         Item_ValidateTypeData(item);
08551         if (!item->typeData)
08552                 return qfalse;
08553 
08554         if (!PC_Int_Parse(handle, &maxChars)) 
08555         {
08556                 return qfalse;
08557         }
08558 
08559         scrollPtr = (textScrollDef_t*)item->typeData;
08560         scrollPtr->maxLineChars = maxChars;
08561 
08562         return qtrue;
08563 }

qboolean ItemParse_maxPaintChars itemDef_t item,
int  handle
 

Definition at line 8529 of file ui_shared.c.

References editFieldDef_t, Item_ValidateTypeData(), itemDef_t, editFieldDef_s::maxPaintChars, PC_Int_Parse(), qboolean, qfalse, qtrue, and itemDef_s::typeData.

08529                                                                 {
08530         editFieldDef_t *editPtr;
08531         int maxChars;
08532 
08533         Item_ValidateTypeData(item);
08534         if (!item->typeData)
08535                 return qfalse;
08536 
08537         if (!PC_Int_Parse(handle, &maxChars)) {
08538                 return qfalse;
08539         }
08540         editPtr = (editFieldDef_t*)item->typeData;
08541         editPtr->maxPaintChars = maxChars;
08542         return qtrue;
08543 }

qboolean ItemParse_model_angle itemDef_t item,
int  handle
 

Definition at line 7749 of file ui_shared.c.

References modelDef_s::angle, Item_ValidateTypeData(), itemDef_t, modelDef_t, PC_Int_Parse(), qboolean, qfalse, qtrue, and itemDef_s::typeData.

07749                                                               {
07750         modelDef_t *modelPtr;
07751         Item_ValidateTypeData(item);
07752         modelPtr = (modelDef_t*)item->typeData;
07753 
07754         if (!PC_Int_Parse(handle, &modelPtr->angle)) {
07755                 return qfalse;
07756         }
07757         return qtrue;
07758 }

qboolean ItemParse_model_fovx itemDef_t item,
int  handle
 

Definition at line 7713 of file ui_shared.c.

References modelDef_s::fov_x, Item_ValidateTypeData(), itemDef_t, modelDef_t, PC_Float_Parse(), qboolean, qfalse, qtrue, and itemDef_s::typeData.

07713                                                              {
07714         modelDef_t *modelPtr;
07715         Item_ValidateTypeData(item);
07716         modelPtr = (modelDef_t*)item->typeData;
07717 
07718         if (!PC_Float_Parse(handle, &modelPtr->fov_x)) {
07719                 return qfalse;
07720         }
07721         return qtrue;
07722 }

qboolean ItemParse_model_fovy itemDef_t item,
int  handle
 

Definition at line 7725 of file ui_shared.c.

References modelDef_s::fov_y, Item_ValidateTypeData(), itemDef_t, modelDef_t, PC_Float_Parse(), qboolean, qfalse, qtrue, and itemDef_s::typeData.

07725                                                              {
07726         modelDef_t *modelPtr;
07727         Item_ValidateTypeData(item);
07728         modelPtr = (modelDef_t*)item->typeData;
07729 
07730         if (!PC_Float_Parse(handle, &modelPtr->fov_y)) {
07731                 return qfalse;
07732         }
07733         return qtrue;
07734 }

qboolean ItemParse_model_g2anim itemDef_t item,
int  handle
 

Definition at line 7833 of file ui_shared.c.

References animTable, Com_Printf(), modelDef_s::g2anim, Item_ValidateTypeData(), itemDef_t, MAX_ANIMATIONS, modelDef_t, stringID_table_s::name, pc_token_t, Q_stricmp(), qboolean, qfalse, qtrue, pc_token_s::string, trap_PC_ReadToken(), and itemDef_s::typeData.

07833                                                                {
07834         modelDef_t *modelPtr;
07835         pc_token_t token;
07836         int i = 0;
07837 
07838         Item_ValidateTypeData(item);
07839         modelPtr = (modelDef_t*)item->typeData;
07840 
07841         if (!trap_PC_ReadToken(handle, &token)) {
07842                 return qfalse;
07843         }
07844 
07845         if ( !token.string[0])
07846         { //it was parsed correctly so still return true.
07847                 return qtrue;
07848         }
07849 
07850         while (i < MAX_ANIMATIONS)
07851         {
07852                 if (!Q_stricmp(token.string, animTable[i].name))
07853                 { //found it
07854                         modelPtr->g2anim = i;
07855                         return qtrue;
07856                 }
07857                 i++;
07858         }
07859 
07860         Com_Printf("Could not find '%s' in the anim table\n", token.string);
07861         return qtrue;
07862 }

qboolean ItemParse_model_g2anim_go itemDef_t item,
const char *  animName
 

Referenced by Item_Model_Paint(), and UI_FeederSelection().

qboolean ItemParse_model_g2maxs itemDef_t item,
int  handle
 

Definition at line 7777 of file ui_shared.c.

References modelDef_s::g2maxs, Item_ValidateTypeData(), itemDef_t, modelDef_t, PC_Float_Parse(), qboolean, qfalse, qtrue, and itemDef_s::typeData.

07777                                                                {
07778         modelDef_t *modelPtr;
07779         Item_ValidateTypeData(item);
07780         modelPtr = (modelDef_t*)item->typeData;
07781 
07782         if (PC_Float_Parse(handle, &modelPtr->g2maxs[0])) {
07783                 if (PC_Float_Parse(handle, &modelPtr->g2maxs[1])) {
07784                         if (PC_Float_Parse(handle, &modelPtr->g2maxs[2])) {
07785                                 return qtrue;
07786                         }
07787                 }
07788         }
07789         return qfalse;
07790 }

qboolean ItemParse_model_g2mins itemDef_t item,
int  handle
 

Definition at line 7761 of file ui_shared.c.

References modelDef_s::g2mins, Item_ValidateTypeData(), itemDef_t, modelDef_t, PC_Float_Parse(), qboolean, qfalse, qtrue, and itemDef_s::typeData.

07761                                                                {
07762         modelDef_t *modelPtr;
07763         Item_ValidateTypeData(item);
07764         modelPtr = (modelDef_t*)item->typeData;
07765 
07766         if (PC_Float_Parse(handle, &modelPtr->g2mins[0])) {
07767                 if (PC_Float_Parse(handle, &modelPtr->g2mins[1])) {
07768                         if (PC_Float_Parse(handle, &modelPtr->g2mins[2])) {
07769                                 return qtrue;
07770                         }
07771                 }
07772         }
07773         return qfalse;
07774 }

qboolean ItemParse_model_g2scale itemDef_t item,
int  handle
 

Definition at line 7793 of file ui_shared.c.

References modelDef_s::g2scale, Item_ValidateTypeData(), itemDef_t, modelDef_t, PC_Float_Parse(), qboolean, qfalse, qtrue, and itemDef_s::typeData.

07793                                                                 {
07794         modelDef_t *modelPtr;
07795         Item_ValidateTypeData(item);
07796         modelPtr = (modelDef_t*)item->typeData;
07797 
07798         if (PC_Float_Parse(handle, &modelPtr->g2scale[0])) {
07799                 if (PC_Float_Parse(handle, &modelPtr->g2scale[1])) {
07800                         if (PC_Float_Parse(handle, &modelPtr->g2scale[2])) {
07801                                 return qtrue;
07802                         }
07803                 }
07804         }
07805         return qfalse;
07806 }

qboolean ItemParse_model_g2skin itemDef_t item,
int  handle
 

Definition at line 7811 of file ui_shared.c.

References modelDef_s::g2skin, Item_ValidateTypeData(), itemDef_t, modelDef_t, pc_token_t, qboolean, qfalse, qtrue, pc_token_s::string, trap_PC_ReadToken(), trap_R_RegisterSkin(), and itemDef_s::typeData.

07811                                                                {
07812         modelDef_t *modelPtr;
07813         pc_token_t token;
07814 
07815         Item_ValidateTypeData(item);
07816         modelPtr = (modelDef_t*)item->typeData;
07817 
07818         if (!trap_PC_ReadToken(handle, &token)) {
07819                 return qfalse;
07820         }
07821 
07822         if (!token.string[0])
07823         { //it was parsed correctly so still return true.
07824                 return qtrue;
07825         }
07826 
07827         modelPtr->g2skin = trap_R_RegisterSkin(token.string);
07828 
07829         return qtrue;
07830 }

qboolean ItemParse_model_g2skin_go itemDef_t item,
const char *  skinName
 

Definition at line 7865 of file ui_shared.c.

References modelDef_s::g2skin, itemDef_s::ghoul2, Item_ValidateTypeData(), itemDef_t, modelDef_t, qboolean, qtrue, trap_G2API_SetSkin(), trap_R_RegisterSkin(), and itemDef_s::typeData.

Referenced by UI_UpdateCharacterSkin().

07866 {
07867 
07868         modelDef_t *modelPtr;
07869         int defSkin;
07870 
07871 
07872         Item_ValidateTypeData(item);
07873         modelPtr = (modelDef_t*)item->typeData;
07874 
07875         if (!skinName || !skinName[0])
07876         { //it was parsed correctly so still return true.
07877                 modelPtr->g2skin = 0;
07878                 trap_G2API_SetSkin(item->ghoul2, 0, 0, 0);
07879 
07880                 return qtrue;
07881         }
07882 
07883         // set skin
07884         if ( item->ghoul2 )
07885         {
07886                 defSkin = trap_R_RegisterSkin(skinName);
07887                 trap_G2API_SetSkin(item->ghoul2, 0, defSkin, defSkin);
07888         }
07889 
07890         return qtrue;
07891 }

qboolean ItemParse_model_origin itemDef_t item,
int  handle
 

Definition at line 7697 of file ui_shared.c.

References Item_ValidateTypeData(), itemDef_t, modelDef_t, modelDef_s::origin, PC_Float_Parse(), qboolean, qfalse, qtrue, and itemDef_s::typeData.

07697                                                                {
07698         modelDef_t *modelPtr;
07699         Item_ValidateTypeData(item);
07700         modelPtr = (modelDef_t*)item->typeData;
07701 
07702         if (PC_Float_Parse(handle, &modelPtr->origin[0])) {
07703                 if (PC_Float_Parse(handle, &modelPtr->origin[1])) {
07704                         if (PC_Float_Parse(handle, &modelPtr->origin[2])) {
07705                                 return qtrue;
07706                         }
07707                 }
07708         }
07709         return qfalse;
07710 }

qboolean ItemParse_model_rotation itemDef_t item,
int  handle
 

Definition at line 7737 of file ui_shared.c.

References Item_ValidateTypeData(), itemDef_t, modelDef_t, PC_Int_Parse(), qboolean, qfalse, qtrue, modelDef_s::rotationSpeed, and itemDef_s::typeData.

07737                                                                  {
07738         modelDef_t *modelPtr;
07739         Item_ValidateTypeData(item);
07740         modelPtr = (modelDef_t*)item->typeData;
07741 
07742         if (!PC_Int_Parse(handle, &modelPtr->rotationSpeed)) {
07743                 return qfalse;
07744         }
07745         return qtrue;
07746 }

qboolean ItemParse_mouseEnter itemDef_t item,
int  handle
 

Definition at line 8423 of file ui_shared.c.

References itemDef_t, itemDef_s::mouseEnter, PC_Script_Parse(), qboolean, qfalse, and qtrue.

08423                                                              {
08424         if (!PC_Script_Parse(handle, &item->mouseEnter)) {
08425                 return qfalse;
08426         }
08427         return qtrue;
08428 }

qboolean ItemParse_mouseEnterText itemDef_t item,
int  handle
 

Definition at line 8437 of file ui_shared.c.

References itemDef_t, itemDef_s::mouseEnterText, PC_Script_Parse(), qboolean, qfalse, and qtrue.

08437                                                                  {
08438         if (!PC_Script_Parse(handle, &item->mouseEnterText)) {
08439                 return qfalse;
08440         }
08441         return qtrue;
08442 }

qboolean ItemParse_mouseExit itemDef_t item,
int  handle
 

Definition at line 8430 of file ui_shared.c.

References itemDef_t, itemDef_s::mouseExit, PC_Script_Parse(), qboolean, qfalse, and qtrue.

08430                                                             {
08431         if (!PC_Script_Parse(handle, &item->mouseExit)) {
08432                 return qfalse;
08433         }
08434         return qtrue;
08435 }

qboolean ItemParse_mouseExitText itemDef_t item,
int  handle
 

Definition at line 8444 of file ui_shared.c.

References itemDef_t, itemDef_s::mouseExitText, PC_Script_Parse(), qboolean, qfalse, and qtrue.

08444                                                                 {
08445         if (!PC_Script_Parse(handle, &item->mouseExitText)) {
08446                 return qfalse;
08447         }
08448         return qtrue;
08449 }

qboolean ItemParse_name itemDef_t item,
int  handle
 

Definition at line 7380 of file ui_shared.c.

References itemDef_t, windowDef_t::name, PC_String_Parse(), qboolean, qfalse, qtrue, and itemDef_s::window.

07380                                                        {
07381         if (!PC_String_Parse(handle, &item->window.name)) {
07382                 return qfalse;
07383         }
07384         return qtrue;
07385 }

qboolean ItemParse_notselectable itemDef_t item,
int  handle
 

Definition at line 8029 of file ui_shared.c.

References ITEM_TYPE_LISTBOX, Item_ValidateTypeData(), itemDef_t, listBoxDef_t, listBoxDef_s::notselectable, qboolean, qtrue, itemDef_s::type, and itemDef_s::typeData.

08029                                                                 {
08030         listBoxDef_t *listPtr;
08031         Item_ValidateTypeData(item);
08032         listPtr = (listBoxDef_t*)item->typeData;
08033         if (item->type == ITEM_TYPE_LISTBOX && listPtr) {
08034                 listPtr->notselectable = qtrue;
08035         }
08036         return qtrue;
08037 }

qboolean ItemParse_onFocus itemDef_t item,
int  handle
 

Definition at line 8409 of file ui_shared.c.

References itemDef_t, itemDef_s::onFocus, PC_Script_Parse(), qboolean, qfalse, and qtrue.

08409                                                           {
08410         if (!PC_Script_Parse(handle, &item->onFocus)) {
08411                 return qfalse;
08412         }
08413         return qtrue;
08414 }

qboolean ItemParse_outlinecolor itemDef_t item,
int  handle
 

Definition at line 8369 of file ui_shared.c.

References itemDef_t, windowDef_t::outlineColor, PC_Color_Parse(), qboolean, qfalse, qtrue, and itemDef_s::window.

08369                                                                {
08370         if (!PC_Color_Parse(handle, &item->window.outlineColor)){
08371                 return qfalse;
08372         }
08373         return qtrue;
08374 }

qboolean ItemParse_ownerdraw itemDef_t item,
int  handle
 

Definition at line 8205 of file ui_shared.c.

References ITEM_TYPE_OWNERDRAW, itemDef_t, windowDef_t::ownerDraw, PC_Int_Parse(), qboolean, qfalse, qtrue, itemDef_s::type, and itemDef_s::window.

08205                                                             {
08206         if (!PC_Int_Parse(handle, &item->window.ownerDraw)) {
08207                 return qfalse;
08208         }
08209         item->type = ITEM_TYPE_OWNERDRAW;
08210         return qtrue;
08211 }

qboolean ItemParse_ownerdrawFlag itemDef_t item,
int  handle
 

Definition at line 8778 of file ui_shared.c.

References itemDef_t, windowDef_t::ownerDrawFlags, PC_Int_Parse(), qboolean, qfalse, qtrue, and itemDef_s::window.

08778                                                                 {
08779         int i;
08780         if (!PC_Int_Parse(handle, &i)) {
08781                 return qfalse;
08782         }
08783         item->window.ownerDrawFlags |= i;
08784         return qtrue;
08785 }

qboolean ItemParse_rect itemDef_t item,
int  handle
 

Definition at line 7962 of file ui_shared.c.

References itemDef_t, PC_Rect_Parse(), qboolean, qfalse, qtrue, windowDef_t::rectClient, and itemDef_s::window.

07962                                                        {
07963         if (!PC_Rect_Parse(handle, &item->window.rectClient)) {
07964                 return qfalse;
07965         }
07966         return qtrue;
07967 }

qboolean ItemParse_rectcvar itemDef_t item,
int  handle
 

Definition at line 7922 of file ui_shared.c.

References atof(), DC, displayContextDef_t::getCVarString, rectDef_t::h, itemDef_t, pc_token_t, qboolean, qfalse, qtrue, windowDef_t::rectClient, pc_token_s::string, String_Parse(), trap_PC_ReadToken(), rectDef_t::w, itemDef_s::window, rectDef_t::x, and rectDef_t::y.

07923 {
07924         char    cvarBuf[1024];
07925         const char      *holdVal;
07926         char    *holdBuf;
07927 
07928         // get Cvar name
07929         pc_token_t token;
07930         if (!trap_PC_ReadToken(handle, &token))
07931         {
07932                 return qfalse;
07933         }
07934 
07935         // get cvar data
07936         DC->getCVarString(token.string, cvarBuf, sizeof(cvarBuf));
07937         
07938         holdBuf = cvarBuf;
07939         if (String_Parse(&holdBuf,&holdVal))
07940         {
07941                 item->window.rectClient.x = atof(holdVal);
07942                 if (String_Parse(&holdBuf,&holdVal))
07943                 {
07944                         item->window.rectClient.y = atof(holdVal);
07945                         if (String_Parse(&holdBuf,&holdVal))
07946                         {
07947                                 item->window.rectClient.w = atof(holdVal);
07948                                 if (String_Parse(&holdBuf,&holdVal))
07949                                 {
07950                                         item->window.rectClient.h = atof(holdVal);
07951                                         return qtrue;
07952                                 }
07953                         }
07954                 }
07955         }
07956 
07957         // There may be no cvar built for this, and that's okay. . . I guess.
07958         return qtrue;
07959 }

qboolean ItemParse_scrollhidden itemDef_t item,
int  handle
 

Definition at line 8045 of file ui_shared.c.

References ITEM_TYPE_LISTBOX, Item_ValidateTypeData(), itemDef_t, listBoxDef_t, qboolean, qtrue, listBoxDef_s::scrollhidden, itemDef_s::type, and itemDef_s::typeData.

08046 {
08047         listBoxDef_t *listPtr;
08048         Item_ValidateTypeData(item);
08049         listPtr = (listBoxDef_t*)item->typeData;
08050 
08051         if (item->type == ITEM_TYPE_LISTBOX && listPtr) 
08052         {
08053                 listPtr->scrollhidden = qtrue;
08054         }
08055         return qtrue;
08056 }

qboolean ItemParse_showCvar itemDef_t item,
int  handle
 

Definition at line 8803 of file ui_shared.c.

References CVAR_SHOW, itemDef_s::cvarFlags, itemDef_s::enableCvar, itemDef_t, PC_Script_Parse(), qboolean, qfalse, and qtrue.

08803                                                            {
08804         if (PC_Script_Parse(handle, &item->enableCvar)) {
08805                 item->cvarFlags = CVAR_SHOW;
08806                 return qtrue;
08807         }
08808         return qfalse;
08809 }

qboolean ItemParse_special itemDef_t item,
int  handle
 

Definition at line 8458 of file ui_shared.c.

References itemDef_t, PC_Float_Parse(), qboolean, qfalse, qtrue, and itemDef_s::special.

08458                                                           {
08459         if (!PC_Float_Parse(handle, &item->special)) {
08460                 return qfalse;
08461         }
08462         return qtrue;
08463 }

qboolean ItemParse_style itemDef_t item,
int  handle
 

Definition at line 8010 of file ui_shared.c.

References Com_Printf(), itemDef_t, PC_Int_Parse(), qboolean, qfalse, qtrue, S_COLOR_YELLOW, windowDef_t::style, and itemDef_s::window.

08011 {
08012         if (!PC_Int_Parse(handle, &item->window.style))
08013         {
08014                 Com_Printf(S_COLOR_YELLOW "Unknown item style value");
08015                 return qfalse;
08016         }
08017 
08018         return qtrue;
08019 }

qboolean ItemParse_text itemDef_t item,
int  handle
 

Definition at line 7399 of file ui_shared.c.

References itemDef_t, PC_String_Parse(), qboolean, qfalse, qtrue, and itemDef_s::text.

07399                                                        {
07400         if (!PC_String_Parse(handle, &item->text)) {
07401                 return qfalse;
07402         }
07403         return qtrue;
07404 }

qboolean ItemParse_text2 itemDef_t item,
int  handle
 

Definition at line 7431 of file ui_shared.c.

References itemDef_t, PC_String_Parse(), qboolean, qfalse, qtrue, and itemDef_s::text2.

07432 {
07433 
07434         if (!PC_String_Parse(handle, &item->text2))
07435         {
07436                 return qfalse;
07437         }
07438 
07439         return qtrue;
07440 
07441 }

qboolean ItemParse_text2alignx itemDef_t item,
int  handle
 

Definition at line 7448 of file ui_shared.c.

References itemDef_t, PC_Float_Parse(), qboolean, qfalse, qtrue, and itemDef_s::text2alignx.

07449 {
07450         if (!PC_Float_Parse(handle, &item->text2alignx)) 
07451         {
07452                 return qfalse;
07453         }
07454         return qtrue;
07455 }

qboolean ItemParse_text2aligny itemDef_t item,
int  handle
 

Definition at line 7462 of file ui_shared.c.

References itemDef_t, PC_Float_Parse(), qboolean, qfalse, qtrue, and itemDef_s::text2aligny.

07463 {
07464         if (!PC_Float_Parse(handle, &item->text2aligny)) 
07465         {
07466                 return qfalse;
07467         }
07468         return qtrue;
07469 }

qboolean ItemParse_textalign itemDef_t item,
int  handle
 

Definition at line 8252 of file ui_shared.c.

References Com_Printf(), itemDef_t, PC_Int_Parse(), qboolean, qfalse, qtrue, S_COLOR_YELLOW, and itemDef_s::textalignment.

08253 {
08254         if (!PC_Int_Parse(handle, &item->textalignment)) 
08255         {
08256                 Com_Printf(S_COLOR_YELLOW "Unknown text alignment value");
08257         
08258                 return qfalse;
08259         }
08260 
08261         return qtrue;
08262 }

qboolean ItemParse_textalignx itemDef_t item,
int  handle
 

Definition at line 8264 of file ui_shared.c.

References itemDef_t, PC_Float_Parse(), qboolean, qfalse, qtrue, and itemDef_s::textalignx.

08264                                                              {
08265         if (!PC_Float_Parse(handle, &item->textalignx)) {
08266                 return qfalse;
08267         }
08268         return qtrue;
08269 }

qboolean ItemParse_textaligny itemDef_t item,
int  handle
 

Definition at line 8271 of file ui_shared.c.

References itemDef_t, PC_Float_Parse(), qboolean, qfalse, qtrue, and itemDef_s::textaligny.

08271                                                              {
08272         if (!PC_Float_Parse(handle, &item->textaligny)) {
08273                 return qfalse;
08274         }
08275         return qtrue;
08276 }

qboolean ItemParse_textscale itemDef_t item,
int  handle
 

Definition at line 8278 of file ui_shared.c.

References itemDef_t, PC_Float_Parse(), qboolean, qfalse, qtrue, and itemDef_s::textscale.

08278                                                             {
08279         if (!PC_Float_Parse(handle, &item->textscale)) {
08280                 return qfalse;
08281         }
08282         return qtrue;
08283 }

qboolean ItemParse_textstyle itemDef_t item,
int  handle
 

Definition at line 8285 of file ui_shared.c.

References itemDef_t, PC_Int_Parse(), qboolean, qfalse, qtrue, and itemDef_s::textStyle.

08285                                                             {
08286         if (!PC_Int_Parse(handle, &item->textStyle)) {
08287                 return qfalse;
08288         }
08289         return qtrue;
08290 }

qboolean ItemParse_type itemDef_t item,
int  handle
 

Definition at line 8087 of file ui_shared.c.

References Item_ValidateTypeData(), itemDef_t, PC_Int_Parse(), qboolean, qfalse, qtrue, and itemDef_s::type.

08088 {
08089 //      int             i,holdInt;
08090 
08091         if (!PC_Int_Parse(handle, &item->type)) 
08092         {
08093                 return qfalse;
08094         }
08095         Item_ValidateTypeData(item);
08096         return qtrue;
08097 }

qboolean ItemParse_visible itemDef_t item,
int  handle
 

Definition at line 8193 of file ui_shared.c.

References windowDef_t::flags, itemDef_t, PC_Int_Parse(), qboolean, qfalse, qtrue, itemDef_s::window, and WINDOW_VISIBLE.

08193                                                           {
08194         int i;
08195 
08196         if (!PC_Int_Parse(handle, &i)) {
08197                 return qfalse;
08198         }
08199         if (i) {
08200                 item->window.flags |= WINDOW_VISIBLE;
08201         }
08202         return qtrue;
08203 }

qboolean ItemParse_wrapped itemDef_t item,
int  handle
 

Definition at line 8063 of file ui_shared.c.

References windowDef_t::flags, itemDef_t, qboolean, qtrue, itemDef_s::window, and