codemp/ui/ui_shared.h

Go to the documentation of this file.
00001 #ifndef __UI_SHARED_H
00002 #define __UI_SHARED_H
00003 
00004 
00005 #include "../game/q_shared.h"
00006 #include "../cgame/tr_types.h"
00007 #include "keycodes.h"
00008 
00009 #include "../../ui/menudef.h"
00010 
00011 #define MAX_MENUNAME                            32
00012 #define MAX_ITEMTEXT                            64
00013 #define MAX_ITEMACTION                          64
00014 #define MAX_MENUDEFFILE                         4096
00015 #define MAX_MENUFILE                            32768
00016 #define MAX_MENUS                                       64
00017 #define MAX_MENUITEMS                           256
00018 #define MAX_COLOR_RANGES                        10
00019 #define MAX_OPEN_MENUS                          16
00020 #define MAX_TEXTSCROLL_LINES            256
00021 
00022 #define WINDOW_MOUSEOVER                        0x00000001      // mouse is over it, non exclusive
00023 #define WINDOW_HASFOCUS                         0x00000002      // has cursor focus, exclusive
00024 #define WINDOW_VISIBLE                          0x00000004      // is visible
00025 #define WINDOW_INACTIVE                         0x00000008      // is visible but grey ( non-active )
00026 #define WINDOW_DECORATION                       0x00000010      // for decoration only, no mouse, keyboard, etc.. 
00027 #define WINDOW_FADINGOUT                        0x00000020      // fading out, non-active
00028 #define WINDOW_FADINGIN                         0x00000040      // fading in
00029 #define WINDOW_MOUSEOVERTEXT            0x00000080      // mouse is over it, non exclusive
00030 #define WINDOW_INTRANSITION                     0x00000100      // window is in transition
00031 #define WINDOW_FORECOLORSET                     0x00000200      // forecolor was explicitly set ( used to color alpha images or not )
00032 #define WINDOW_HORIZONTAL                       0x00000400      // for list boxes and sliders, vertical is default this is set of horizontal
00033 #define WINDOW_LB_LEFTARROW                     0x00000800      // mouse is over left/up arrow
00034 #define WINDOW_LB_RIGHTARROW            0x00001000      // mouse is over right/down arrow
00035 #define WINDOW_LB_THUMB                         0x00002000      // mouse is over thumb
00036 #define WINDOW_LB_PGUP                          0x00004000      // mouse is over page up
00037 #define WINDOW_LB_PGDN                          0x00008000      // mouse is over page down
00038 #define WINDOW_ORBITING                         0x00010000      // item is in orbit
00039 #define WINDOW_OOB_CLICK                        0x00020000      // close on out of bounds click
00040 #define WINDOW_WRAPPED                          0x00040000      // manually wrap text
00041 #define WINDOW_AUTOWRAPPED                      0x00080000      // auto wrap text
00042 #define WINDOW_FORCED                           0x00100000      // forced open
00043 #define WINDOW_POPUP                            0x00200000      // popup
00044 #define WINDOW_BACKCOLORSET                     0x00400000      // backcolor was explicitly set 
00045 #define WINDOW_TIMEDVISIBLE                     0x00800000      // visibility timing ( NOT implemented )
00046 #define WINDOW_PLAYERCOLOR                      0x01000000      // hack the forecolor to match ui_char_color_*
00047 
00048 //JLF
00049 #define WINDOW_INTRANSITIONMODEL        0x04000000      // delayed script waiting to run
00050 
00051 
00052 // CGAME cursor type bits
00053 #define CURSOR_NONE                                     0x00000001
00054 #define CURSOR_ARROW                            0x00000002
00055 #define CURSOR_SIZER                            0x00000004
00056 
00057 #ifdef _XBOX
00058 
00059 #ifdef CGAME
00060 #define STRING_POOL_SIZE 32*1024
00061 #else
00062 #define STRING_POOL_SIZE 128*1024
00063 #endif
00064 
00065 #else
00066 
00067 #ifdef CGAME
00068 #define STRING_POOL_SIZE 128*1024
00069 #else
00070 #define STRING_POOL_SIZE 384*1024
00071 #endif
00072 
00073 #endif
00074 
00075 #define MAX_STRING_HANDLES 4096
00076 #define MAX_SCRIPT_ARGS 12
00077 #define MAX_EDITFIELD 256
00078 
00079 #define ART_FX_BASE                     "menu/art/fx_base"
00080 #define ART_FX_BLUE                     "menu/art/fx_blue"
00081 #define ART_FX_CYAN                     "menu/art/fx_cyan"
00082 #define ART_FX_GREEN            "menu/art/fx_grn"
00083 #define ART_FX_RED                      "menu/art/fx_red"
00084 #define ART_FX_TEAL                     "menu/art/fx_teal"
00085 #define ART_FX_WHITE            "menu/art/fx_white"
00086 #define ART_FX_YELLOW           "menu/art/fx_yel"
00087 #define ART_FX_ORANGE           "menu/art/fx_orange"
00088 #define ART_FX_PURPLE           "menu/art/fx_purple"
00089 
00090 #define ASSET_GRADIENTBAR                       "ui/assets/gradientbar2.tga"
00091 #define ASSET_SCROLLBAR             "gfx/menus/scrollbar.tga"
00092 #define ASSET_SCROLLBAR_ARROWDOWN   "gfx/menus/scrollbar_arrow_dwn_a.tga"
00093 #define ASSET_SCROLLBAR_ARROWUP     "gfx/menus/scrollbar_arrow_up_a.tga"
00094 #define ASSET_SCROLLBAR_ARROWLEFT   "gfx/menus/scrollbar_arrow_left.tga"
00095 #define ASSET_SCROLLBAR_ARROWRIGHT  "gfx/menus/scrollbar_arrow_right.tga"
00096 #define ASSET_SCROLL_THUMB          "gfx/menus/scrollbar_thumb.tga"
00097 #define ASSET_SLIDER_BAR                        "menu/new/slider"
00098 #define ASSET_SLIDER_THUMB                      "menu/new/sliderthumb"
00099 #define SCROLLBAR_SIZE 16.0
00100 #define SLIDER_WIDTH 96.0
00101 #define SLIDER_HEIGHT 16.0
00102 #define SLIDER_THUMB_WIDTH 12.0
00103 #define SLIDER_THUMB_HEIGHT 20.0
00104 #define NUM_CROSSHAIRS                  9
00105 
00106 typedef struct {
00107   const char *command;
00108   const char *args[MAX_SCRIPT_ARGS];
00109 } scriptDef_t;
00110 
00111 
00112 typedef struct {
00113   float x;    // horiz position
00114   float y;    // vert position
00115   float w;    // width
00116   float h;    // height;
00117 } rectDef_t;
00118 
00119 typedef rectDef_t Rectangle;
00120 
00121 // FIXME: do something to separate text vs window stuff
00122 typedef struct {
00123   Rectangle rect;                 // client coord rectangle
00124   Rectangle rectClient;           // screen coord rectangle
00125   const char *name;               //
00126   const char *group;              // if it belongs to a group
00127   const char *cinematicName;              // cinematic name
00128   int cinematic;                                                                  // cinematic handle
00129   int style;                      //
00130   int border;                     //
00131   int ownerDraw;                                                                        // ownerDraw style
00132         int ownerDrawFlags;                                                     // show flags for ownerdraw items
00133   float borderSize;               // 
00134   int flags;                      // visible, focus, mouseover, cursor
00135   Rectangle rectEffects;          // for various effects
00136   Rectangle rectEffects2;         // for various effects
00137   int offsetTime;                 // time based value for various effects
00138   int nextTime;                   // time next effect should cycle
00139   vec4_t foreColor;               // text color
00140   vec4_t backColor;               // border color
00141   vec4_t borderColor;             // border color
00142   vec4_t outlineColor;            // border color
00143   qhandle_t background;           // background asset  
00144 } windowDef_t;
00145 
00146 typedef windowDef_t Window;
00147 
00148 typedef struct {
00149         vec4_t  color;
00150         float           low;
00151         float           high;
00152 } colorRangeDef_t;
00153 
00154 // FIXME: combine flags into bitfields to save space
00155 // FIXME: consolidate all of the common stuff in one structure for menus and items
00156 // THINKABOUTME: is there any compelling reason not to have items contain items
00157 // and do away with a menu per say.. major issue is not being able to dynamically allocate 
00158 // and destroy stuff.. Another point to consider is adding an alloc free call for vm's and have 
00159 // the engine just allocate the pool for it based on a cvar
00160 // many of the vars are re-used for different item types, as such they are not always named appropriately
00161 // the benefits of c++ in DOOM will greatly help crap like this
00162 // FIXME: need to put a type ptr that points to specific type info per type
00163 // 
00164 #define MAX_LB_COLUMNS 16
00165 
00166 typedef struct columnInfo_s {
00167         int pos;
00168         int width;
00169         int maxChars;
00170 } columnInfo_t;
00171 
00172 typedef struct listBoxDef_s {
00173         int startPos;
00174         int endPos;
00175         int drawPadding;
00176         int cursorPos;
00177         float elementWidth;
00178         float elementHeight;
00179         int elementStyle;
00180         int numColumns;
00181         columnInfo_t columnInfo[MAX_LB_COLUMNS];
00182         const char *doubleClick;
00183         qboolean notselectable;
00184         //JLF MPMOVED
00185         qboolean        scrollhidden;
00186 } listBoxDef_t;
00187 
00188 typedef struct editFieldDef_s {
00189   float minVal;                  //     edit field limits
00190   float maxVal;                  //
00191   float defVal;                  //
00192         float range;                                                                     // 
00193   int maxChars;                  // for edit fields
00194   int maxPaintChars;             // for edit fields
00195         int paintOffset;                                                         // 
00196 } editFieldDef_t;
00197 
00198 #define MAX_MULTI_CVARS 32
00199 
00200 typedef struct multiDef_s {
00201         const char *cvarList[MAX_MULTI_CVARS];
00202         const char *cvarStr[MAX_MULTI_CVARS];
00203         float cvarValue[MAX_MULTI_CVARS];
00204         int count;
00205         qboolean strDef;
00206 } multiDef_t;
00207 
00208 typedef struct modelDef_s {
00209         int angle;
00210         vec3_t origin;
00211         float fov_x;
00212         float fov_y;
00213         int rotationSpeed;
00214 
00215         vec3_t g2mins; //required
00216         vec3_t g2maxs; //required
00217         vec3_t g2scale; //optional
00218         int g2skin; //optional
00219         int g2anim; //optional
00220         //JLF
00221 //Transition extras
00222         vec3_t g2mins2, g2maxs2, g2minsEffect, g2maxsEffect;
00223         float fov_x2, fov_y2, fov_Effectx, fov_Effecty;
00224 } modelDef_t;
00225 
00226 typedef struct textScrollDef_s 
00227 {
00228         int                             startPos;
00229         int                             endPos;
00230 
00231         float                   lineHeight;
00232         int                             maxLineChars;
00233         int                             drawPadding;
00234 
00235         // changed spelling to make them fall out during compile while I made them asian-aware  -Ste
00236         //
00237         int                             iLineCount;
00238         const char*             pLines[MAX_TEXTSCROLL_LINES];   // can contain NULL ptrs that you should skip over during paint.
00239 
00240 } textScrollDef_t;
00241 
00242 #define ITEM_ALIGN_LEFT         0               // left alignment
00243 #define ITEM_ALIGN_CENTER       1               // center alignment
00244 #define ITEM_ALIGN_RIGHT        2               // right alignment
00245 
00246 #define CVAR_ENABLE                     0x00000001
00247 #define CVAR_DISABLE            0x00000002
00248 #define CVAR_SHOW                       0x00000004
00249 #define CVAR_HIDE                       0x00000008
00250 
00251 #define ITF_G2VALID                     0x0001                                  // indicates whether or not g2 instance is valid.
00252 #define ITF_ISCHARACTER         0x0002                                  // a character item, uses customRGBA
00253 #define ITF_ISSABER                     0x0004                                  // first saber item, draws blade
00254 #define ITF_ISSABER2            0x0008                                  // second saber item, draws blade
00255 
00256 #define ITF_ISANYSABER          (ITF_ISSABER|ITF_ISSABER2)      //either saber
00257 
00258 typedef struct itemDef_s {
00259         Window          window;                                         // common positional, border, style, layout info
00260         Rectangle       textRect;                                       // rectangle the text ( if any ) consumes     
00261         int                     type;                                           // text, button, radiobutton, checkbox, textfield, listbox, combo
00262         int                     alignment;                                      // left center right
00263         int                     textalignment;                          // ( optional ) alignment for text within rect based on text width
00264         float           textalignx;                                     // ( optional ) text alignment x coord
00265         float           textaligny;                                     // ( optional ) text alignment x coord
00266         float           textscale;                                      // scale percentage from 72pts
00267         int                     textStyle;                                      // ( optional ) style, normal and shadowed are it for now
00268         const char      *text;                                          // display text
00269         const char      *text2;                                         // display text, 2nd line
00270         float           text2alignx;                            // ( optional ) text2 alignment x coord
00271         float           text2aligny;                            // ( optional ) text2 alignment y coord
00272         void            *parent;                                        // menu owner
00273         qhandle_t       asset;                                          // handle to asset
00274         void            *ghoul2;                                        // ghoul2 instance if available instead of a model.
00275         int                     flags;                                          // flags like g2valid, character, saber, saber2, etc.
00276         const char      *mouseEnterText;                        // mouse enter script
00277         const char      *mouseExitText;                         // mouse exit script
00278         const char      *mouseEnter;                            // mouse enter script
00279         const char      *mouseExit;                                     // mouse exit script 
00280         const char      *action;                                        // select script
00281 //JLFACCEPT MPMOVED
00282         const char  *accept;
00283 //JLFDPADSCRIPT
00284         const char * selectionNext;
00285         const char * selectionPrev;
00286 
00287         const char      *onFocus;                                       // select script
00288         const char      *leaveFocus;                            // select script
00289         const char      *cvar;                                          // associated cvar 
00290         const char      *cvarTest;                                      // associated cvar for enable actions
00291         const char      *enableCvar;                            // enable, disable, show, or hide based on value, this can contain a list
00292         int                     cvarFlags;                                      //      what type of action to take on cvarenables
00293         sfxHandle_t focusSound;
00294         int                     numColors;                                      // number of color ranges
00295         colorRangeDef_t colorRanges[MAX_COLOR_RANGES];
00296         float           special;                                        // used for feeder id's etc.. diff per type
00297         int                     cursorPos;                                      // cursor position in characters
00298         void            *typeData;                                      // type specific data ptr's     
00299         const char      *descText;                                      //      Description text
00300         int                     appearanceSlot;                         // order of appearance
00301         int                     iMenuFont;                                      // FONT_SMALL,FONT_MEDIUM,FONT_LARGE    // changed from 'font' so I could see what didn't compile, and differentiate between font handles returned from RegisterFont -ste
00302         qboolean        disabled;                                       // Does this item ignore mouse and keyboard focus
00303         int                     invertYesNo;
00304         int                     xoffset;
00305 } itemDef_t;
00306 
00307 typedef struct {
00308         Window window;
00309         const char  *font;                                              // font
00310         qboolean fullScreen;                                    // covers entire screen 
00311         int itemCount;                                                  // number of items;
00312         int fontIndex;                                                  // 
00313         int cursorItem;                                                 // which item as the cursor
00314         int fadeCycle;                                                  //
00315         float fadeClamp;                                                //
00316         float fadeAmount;                                               //
00317         const char *onOpen;                                             // run when the menu is first opened
00318         const char *onClose;                                    // run when the menu is closed
00319 //JLFACCEPT
00320         const char  *onAccept;                                  // run when menu is closed with acceptance
00321 
00322         const char *onESC;                                              // run when the menu is closed
00323         const char *soundName;                                  // background loop sound for menu
00324 
00325         vec4_t focusColor;                                              // focus color for items
00326         vec4_t disableColor;                                    // focus color for items
00327         itemDef_t *items[MAX_MENUITEMS];                // items this menu contains   
00328         int                     descX;                                          // X position of description
00329         int                     descY;                                          // X position of description
00330         vec4_t          descColor;                                      // description text color for items
00331         int                     descAlignment;                          // Description of alignment
00332         float           descScale;                                      // Description scale
00333         float           appearanceTime;                         //      when next item should appear
00334         int                     appearanceCnt;                          //      current item displayed
00335         float           appearanceIncrement;            //
00336 } menuDef_t;
00337 
00338 typedef struct {
00339   const char *fontStr;
00340   const char *cursorStr;
00341   const char *gradientStr;
00342   qhandle_t     qhSmallFont;
00343   qhandle_t     qhSmall2Font;
00344   qhandle_t     qhMediumFont;
00345   qhandle_t     qhBigFont;
00346   qhandle_t cursor;
00347   qhandle_t gradientBar;
00348   qhandle_t scrollBarArrowUp;
00349   qhandle_t scrollBarArrowDown;
00350   qhandle_t scrollBarArrowLeft;
00351   qhandle_t scrollBarArrowRight;
00352   qhandle_t scrollBar;
00353   qhandle_t scrollBarThumb;
00354   qhandle_t buttonMiddle;
00355   qhandle_t buttonInside;
00356   qhandle_t solidBox;
00357   qhandle_t sliderBar;
00358   qhandle_t sliderThumb;
00359   sfxHandle_t menuEnterSound;
00360   sfxHandle_t menuExitSound;
00361   sfxHandle_t menuBuzzSound;
00362   sfxHandle_t itemFocusSound;
00363   float fadeClamp;
00364   int fadeCycle;
00365   float fadeAmount;
00366   float shadowX;
00367   float shadowY;
00368   vec4_t shadowColor;
00369   float shadowFadeClamp;
00370   qboolean fontRegistered;
00371 
00372     qhandle_t needPass;
00373     qhandle_t noForce;
00374     qhandle_t forceRestrict;
00375     qhandle_t saberOnly;
00376     qhandle_t trueJedi;
00377 
00378         sfxHandle_t moveRollSound;
00379         sfxHandle_t moveJumpSound;
00380         sfxHandle_t datapadmoveSaberSound1;
00381         sfxHandle_t datapadmoveSaberSound2;
00382         sfxHandle_t datapadmoveSaberSound3;
00383         sfxHandle_t datapadmoveSaberSound4;
00384         sfxHandle_t datapadmoveSaberSound5;
00385         sfxHandle_t datapadmoveSaberSound6;
00386 
00387   // player settings
00388         qhandle_t fxBasePic;
00389   qhandle_t fxPic[7];
00390         qhandle_t       crosshairShader[NUM_CROSSHAIRS];
00391 
00392 } cachedAssets_t;
00393 
00394 typedef struct 
00395 {
00396         const char *name;
00397         qboolean (*handler) (itemDef_t *item, char** args);
00398 } commandDef_t;
00399 
00400 typedef struct {
00401   qhandle_t (*registerShaderNoMip) (const char *p);
00402   void (*setColor) (const vec4_t v);
00403   void (*drawHandlePic) (float x, float y, float w, float h, qhandle_t asset);
00404   void (*drawStretchPic) (float x, float y, float w, float h, float s1, float t1, float s2, float t2, qhandle_t hShader );
00405   void (*drawText) (float x, float y, float scale, vec4_t color, const char *text, float adjust, int limit, int style, int iMenuFont);  
00406   int (*textWidth) (const char *text, float scale, int iMenuFont);  
00407   int (*textHeight) (const char *text, float scale, int iMenuFont);
00408   qhandle_t (*registerModel) (const char *p);
00409   void (*modelBounds) (qhandle_t model, vec3_t min, vec3_t max);
00410   void (*fillRect) ( float x, float y, float w, float h, const vec4_t color);
00411   void (*drawRect) ( float x, float y, float w, float h, float size, const vec4_t color);
00412   void (*drawSides) (float x, float y, float w, float h, float size);
00413   void (*drawTopBottom) (float x, float y, float w, float h, float size);
00414   void (*clearScene) ();
00415   void (*addRefEntityToScene) (const refEntity_t *re );
00416   void (*renderScene) ( const refdef_t *fd );
00417 
00418         qhandle_t (*RegisterFont)( const char *fontName );
00419         int             (*Font_StrLenPixels) (const char *text, const int iFontIndex, const float scale);
00420         int             (*Font_StrLenChars) (const char *text);
00421         int             (*Font_HeightPixels)(const int iFontIndex, const float scale);
00422         void    (*Font_DrawString)(int ox, int oy, const char *text, const float *rgba, const int setIndex, int iCharLimit, const float scale);
00423         qboolean (*Language_IsAsian)(void);
00424         qboolean (*Language_UsesSpaces)(void);
00425         unsigned int (*AnyLanguage_ReadCharFromString)( const char *psText, int *piAdvanceCount, qboolean *pbIsTrailingPunctuation/* = NULL*/ );
00426   void (*ownerDrawItem) (float x, float y, float w, float h, float text_x, float text_y, int ownerDraw, int ownerDrawFlags, int align, float special, float scale, vec4_t color, qhandle_t shader, int textStyle,int iMenuFont);
00427         float (*getValue) (int ownerDraw);
00428         qboolean (*ownerDrawVisible) (int flags);
00429   void (*runScript)(char **p);
00430   qboolean (*deferScript)(char **p);
00431   void (*getTeamColor)(vec4_t *color);
00432   void (*getCVarString)(const char *cvar, char *buffer, int bufsize);
00433   float (*getCVarValue)(const char *cvar);
00434   void (*setCVar)(const char *cvar, const char *value);
00435   void (*drawTextWithCursor)(float x, float y, float scale, vec4_t color, const char *text, int cursorPos, char cursor, int limit, int style, int iFontIndex);
00436   void (*setOverstrikeMode)(qboolean b);
00437   qboolean (*getOverstrikeMode)();
00438   void (*startLocalSound)( sfxHandle_t sfx, int channelNum );
00439   qboolean (*ownerDrawHandleKey)(int ownerDraw, int flags, float *special, int key);
00440   int (*feederCount)(float feederID);
00441   const char *(*feederItemText)(float feederID, int index, int column, qhandle_t *handle1, qhandle_t *handle2, qhandle_t *handle3);
00442   qhandle_t (*feederItemImage)(float feederID, int index);
00443   qboolean (*feederSelection)(float feederID, int index, itemDef_t *item);
00444         void (*keynumToStringBuf)( int keynum, char *buf, int buflen );
00445         void (*getBindingBuf)( int keynum, char *buf, int buflen );
00446         void (*setBinding)( int keynum, const char *binding );
00447         void (*executeText)(int exec_when, const char *text );  
00448         void (*Error)(int level, const char *error, ...);
00449         void (*Print)(const char *msg, ...);
00450         void (*Pause)(qboolean b);
00451         int (*ownerDrawWidth)(int ownerDraw, float scale);
00452         sfxHandle_t (*registerSound)(const char *name);
00453         void (*startBackgroundTrack)( const char *intro, const char *loop, qboolean bReturnWithoutStarting);
00454         void (*stopBackgroundTrack)();
00455         int (*playCinematic)(const char *name, float x, float y, float w, float h);
00456         void (*stopCinematic)(int handle);
00457         void (*drawCinematic)(int handle, float x, float y, float w, float h);
00458         void (*runCinematicFrame)(int handle);
00459 
00460   float                 yscale;
00461   float                 xscale;
00462   float                 bias;
00463   int                           realTime;
00464   int                           frameTime;
00465         int                             cursorx;
00466         int                             cursory;
00467         qboolean        debug;
00468 
00469   cachedAssets_t Assets;
00470 
00471         glconfig_t glconfig;
00472         qhandle_t       whiteShader;
00473   qhandle_t gradientImage;
00474   qhandle_t cursor;
00475         float FPS;
00476 
00477 } displayContextDef_t;
00478 
00479 #include "../namespace_begin.h"
00480 
00481 const char *String_Alloc(const char *p);
00482 void String_Init();
00483 void String_Report();
00484 void Init_Display(displayContextDef_t *dc);
00485 void Display_ExpandMacros(char * buff);
00486 void Menu_Init(menuDef_t *menu);
00487 void Item_Init(itemDef_t *item);
00488 void Menu_PostParse(menuDef_t *menu);
00489 menuDef_t *Menu_GetFocused();
00490 void Menu_HandleKey(menuDef_t *menu, int key, qboolean down);
00491 void Menu_HandleMouseMove(menuDef_t *menu, float x, float y);
00492 void Menu_ScrollFeeder(menuDef_t *menu, int feeder, qboolean down);
00493 qboolean Float_Parse(char **p, float *f);
00494 qboolean Color_Parse(char **p, vec4_t *c);
00495 qboolean Int_Parse(char **p, int *i);
00496 qboolean Rect_Parse(char **p, rectDef_t *r);
00497 qboolean String_Parse(char **p, const char **out);
00498 qboolean Script_Parse(char **p, const char **out);
00499 qboolean PC_Float_Parse(int handle, float *f);
00500 qboolean PC_Color_Parse(int handle, vec4_t *c);
00501 qboolean PC_Int_Parse(int handle, int *i);
00502 qboolean PC_Rect_Parse(int handle, rectDef_t *r);
00503 qboolean PC_String_Parse(int handle, const char **out);
00504 qboolean PC_Script_Parse(int handle, const char **out);
00505 int Menu_Count();
00506 void Menu_New(int handle);
00507 void Menu_PaintAll();
00508 menuDef_t *Menus_ActivateByName(const char *p);
00509 void Menu_Reset();
00510 qboolean Menus_AnyFullScreenVisible();
00511 void  Menus_Activate(menuDef_t *menu);
00512 itemDef_t *Menu_FindItemByName(menuDef_t *menu, const char *p);
00513 
00514 displayContextDef_t *Display_GetContext();
00515 void *Display_CaptureItem(int x, int y);
00516 qboolean Display_MouseMove(void *p, int x, int y);
00517 int Display_CursorType(int x, int y);
00518 qboolean Display_KeyBindPending();
00519 void Menus_OpenByName(const char *p);
00520 menuDef_t *Menus_FindByName(const char *p);
00521 void Menus_ShowByName(const char *p);
00522 void Menus_CloseByName(const char *p);
00523 void Display_HandleKey(int key, qboolean down, int x, int y);
00524 void LerpColor(vec4_t a, vec4_t b, vec4_t c, float t);
00525 void Menus_CloseAll();
00526 void Menu_Paint(menuDef_t *menu, qboolean forcePaint);
00527 void Menu_SetFeederSelection(menuDef_t *menu, int feeder, int index, const char *name);
00528 void Display_CacheAll();
00529 void Menu_SetItemBackground(const menuDef_t *menu,const char *itemName, const char *background);
00530 
00531 void *UI_Alloc( int size );
00532 void UI_InitMemory( void );
00533 qboolean UI_OutOfMemory();
00534 
00535 void Controls_GetConfig( void );
00536 void Controls_SetConfig(qboolean restart);
00537 
00538 
00539 int                     trap_PC_AddGlobalDefine                 ( char *define );
00540 int                     trap_PC_LoadSource                              ( const char *filename );
00541 int                     trap_PC_FreeSource                              ( int handle );
00542 int                     trap_PC_ReadToken                               ( int handle, pc_token_t *pc_token );
00543 int                     trap_PC_SourceFileAndLine               ( int handle, char *filename, int *line );
00544 int                     trap_PC_LoadGlobalDefines               ( const char* filename );
00545 void            trap_PC_RemoveAllGlobalDefines  ( void );
00546 
00547 int                     trap_R_Font_StrLenPixels(const char *text, const int iFontIndex, const float scale);
00548 int                     trap_R_Font_StrLenChars(const char *text);
00549 int                     trap_R_Font_HeightPixels(const int iFontIndex, const float scale);
00550 void            trap_R_Font_DrawString(int ox, int oy, const char *text, const float *rgba, const int setIndex, int iCharLimit, const float scale);
00551 qboolean        trap_Language_IsAsian(void);
00552 qboolean        trap_Language_UsesSpaces(void);
00553 unsigned int trap_AnyLanguage_ReadCharFromString( const char *psText, int *piAdvanceCount, qboolean *pbIsTrailingPunctuation );
00554 
00555 int trap_SP_GetStringTextString(const char *text, char *buffer, int bufferLength);
00556 int trap_SP_GetNumLanguages( void );
00557 void trap_GetLanguageName( const int languageIndex, char *buffer );
00558 
00559 //these traps must exist both on the cgame and ui
00560 /*
00561 Ghoul2 Insert Start
00562 */
00563 // UI specific API access
00564 void            trap_G2API_CollisionDetect              ( CollisionRecord_t *collRecMap, void* ghoul2, const vec3_t angles, const vec3_t position,int frameNumber, int entNum, const vec3_t rayStart, const vec3_t rayEnd, const vec3_t scale, int traceFlags, int useLod, float fRadius );
00565 void            trap_G2API_CollisionDetectCache         ( CollisionRecord_t *collRecMap, void* ghoul2, const vec3_t angles, const vec3_t position,int frameNumber, int entNum, const vec3_t rayStart, const vec3_t rayEnd, const vec3_t scale, int traceFlags, int useLod, float fRadius );
00566 
00567 
00568 void            trap_G2_ListModelSurfaces(void *ghlInfo);
00569 void            trap_G2_ListModelBones(void *ghlInfo, int frame);
00570 void            trap_G2_SetGhoul2ModelIndexes(void *ghoul2, qhandle_t *modelList, qhandle_t *skinList);
00571 qboolean        trap_G2_HaveWeGhoul2Models(void *ghoul2);
00572 qboolean        trap_G2API_GetBoltMatrix(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
00573                                                                 const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale);
00574 qboolean        trap_G2API_GetBoltMatrix_NoReconstruct(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
00575                                                                 const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale);
00576 qboolean        trap_G2API_GetBoltMatrix_NoRecNoRot(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
00577                                                                 const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale);
00578 int                     trap_G2API_InitGhoul2Model(void **ghoul2Ptr, const char *fileName, int modelIndex, qhandle_t customSkin,
00579                                                   qhandle_t customShader, int modelFlags, int lodBias);
00580 qboolean        trap_G2API_SetSkin(void *ghoul2, int modelIndex, qhandle_t customSkin, qhandle_t renderSkin);
00581 qboolean        trap_G2API_AttachG2Model(void *ghoul2From, int modelIndexFrom, void *ghoul2To, int toBoltIndex, int toModel);
00582 
00583 
00584 int                     trap_G2API_CopyGhoul2Instance(void *g2From, void *g2To, int modelIndex);
00585 void            trap_G2API_CopySpecificGhoul2Model(void *g2From, int modelFrom, void *g2To, int modelTo);
00586 void            trap_G2API_DuplicateGhoul2Instance(void *g2From, void **g2To);
00587 qboolean        trap_G2API_HasGhoul2ModelOnIndex(void *ghlInfo, int modelIndex);
00588 qboolean        trap_G2API_RemoveGhoul2Model(void *ghlInfo, int modelIndex);
00589 
00590 int                     trap_G2API_AddBolt(void *ghoul2, int modelIndex, const char *boneName);
00591 //qboolean      trap_G2API_RemoveBolt(void *ghoul2, int index);
00592 void            trap_G2API_SetBoltInfo(void *ghoul2, int modelIndex, int boltInfo);
00593 void            trap_G2API_CleanGhoul2Models(void **ghoul2Ptr);
00594 qboolean        trap_G2API_SetBoneAngles(void *ghoul2, int modelIndex, const char *boneName, const vec3_t angles, const int flags,
00595                                                                 const int up, const int right, const int forward, qhandle_t *modelList,
00596                                                                 int blendTime , int currentTime );
00597 void            trap_G2API_GetGLAName(void *ghoul2, int modelIndex, char *fillBuf);
00598 qboolean        trap_G2API_SetBoneAnim(void *ghoul2, const int modelIndex, const char *boneName, const int startFrame, const int endFrame,
00599                                                           const int flags, const float animSpeed, const int currentTime, const float setFrame , const int blendTime );
00600 qboolean        trap_G2API_GetBoneAnim(void *ghoul2, const char *boneName, const int currentTime, float *currentFrame, int *startFrame,
00601                                                                 int *endFrame, int *flags, float *animSpeed, int *modelList, const int modelIndex);
00602 qboolean        trap_G2API_GetBoneFrame(void *ghoul2, const char *boneName, const int currentTime, float *currentFrame, int *modelList, const int modelIndex);
00603 
00604 qboolean        trap_G2API_SetRootSurface(void *ghoul2, const int modelIndex, const char *surfaceName);
00605 qboolean        trap_G2API_SetSurfaceOnOff(void *ghoul2, const char *surfaceName, const int flags);
00606 qboolean        trap_G2API_SetNewOrigin(void *ghoul2, const int boltIndex);
00607 
00608 int                     trap_G2API_GetTime(void);
00609 void            trap_G2API_SetTime(int time, int clock);
00610 
00611 void            trap_G2API_SetRagDoll(void *ghoul2, sharedRagDollParams_t *params);
00612 void            trap_G2API_AnimateG2Models(void *ghoul2, int time, sharedRagDollUpdateParams_t *params);
00613 
00614 qboolean        trap_G2API_SetBoneIKState(void *ghoul2, int time, const char *boneName, int ikState, sharedSetBoneIKStateParams_t *params);
00615 qboolean        trap_G2API_IKMove(void *ghoul2, int time, sharedIKMoveParams_t *params);
00616 
00617 void            trap_G2API_GetSurfaceName(void *ghoul2, int surfNumber, int modelIndex, char *fillBuf);
00618 
00619 #include "../namespace_end.h"
00620 
00621 /*
00622 Ghoul2 Insert End
00623 */
00624 #endif