Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

ui_mods.c File Reference

#include "ui_local.h"

Include dependency graph for ui_mods.c:

Include dependency graph

Go to the source code of this file.

Data Structures

struct  mods_t

Defines

#define ART_BACK0   "menu/art/back_0"
#define ART_BACK1   "menu/art/back_1"
#define ART_FIGHT0   "menu/art/load_0"
#define ART_FIGHT1   "menu/art/load_1"
#define ART_FRAMEL   "menu/art/frame2_l"
#define ART_FRAMER   "menu/art/frame1_r"
#define GAMEBUFSIZE   ( MAX_MODS * 16 )
#define ID_BACK   10
#define ID_GO   11
#define ID_LIST   12
#define MAX_MODS   64
#define NAMEBUFSIZE   ( MAX_MODS * 48 )

Functions

void UI_Mods_LoadMods (void)
void UI_Mods_MenuEvent (void *ptr, int event)
void UI_Mods_MenuInit (void)
void UI_Mods_ParseInfos (char *modDir, char *modDesc)
void UI_ModsMenu (void)
void UI_ModsMenu_Cache (void)

Variables

mods_t s_mods


Define Documentation

#define ART_BACK0   "menu/art/back_0"
 

Definition at line 25 of file ui_mods.c.

#define ART_BACK1   "menu/art/back_1"
 

Definition at line 26 of file ui_mods.c.

#define ART_FIGHT0   "menu/art/load_0"
 

Definition at line 27 of file ui_mods.c.

#define ART_FIGHT1   "menu/art/load_1"
 

Definition at line 28 of file ui_mods.c.

#define ART_FRAMEL   "menu/art/frame2_l"
 

Definition at line 29 of file ui_mods.c.

#define ART_FRAMER   "menu/art/frame1_r"
 

Definition at line 30 of file ui_mods.c.

#define GAMEBUFSIZE   ( MAX_MODS * 16 )
 

Definition at line 34 of file ui_mods.c.

#define ID_BACK   10
 

Definition at line 36 of file ui_mods.c.

#define ID_GO   11
 

Definition at line 37 of file ui_mods.c.

#define ID_LIST   12
 

Definition at line 38 of file ui_mods.c.

#define MAX_MODS   64
 

Definition at line 32 of file ui_mods.c.

#define NAMEBUFSIZE   ( MAX_MODS * 48 )
 

Definition at line 33 of file ui_mods.c.


Function Documentation

void UI_Mods_LoadMods void   )  [static]
 

Definition at line 150 of file ui_mods.c.

References mods_t::description, mods_t::descriptionList, mods_t::descriptionPtr, mods_t::fs_game, mods_t::fs_gameList, mods_t::fs_gamePtr, i, menulist_s::itemnames, mods_t::list, menulist_s::numitems, s_mods, strlen(), trap_FS_GetFileList(), trap_Print(), UI_Mods_ParseInfos(), and va().

Referenced by UI_Mods_MenuInit().

00150                                      {
00151     int     numdirs;
00152     char    dirlist[2048];
00153     char    *dirptr;
00154   char  *descptr;
00155     int     i;
00156     int     dirlen;
00157 
00158     s_mods.list.itemnames = (const char **)s_mods.descriptionList;
00159     s_mods.descriptionPtr = s_mods.description;
00160     s_mods.fs_gamePtr = s_mods.fs_game;
00161 
00162     // always start off with baseq3
00163     s_mods.list.numitems = 1;
00164     s_mods.list.itemnames[0] = s_mods.descriptionList[0] = "Quake III Arena";
00165     s_mods.fs_gameList[0] = "";
00166 
00167     numdirs = trap_FS_GetFileList( "$modlist", "", dirlist, sizeof(dirlist) );
00168     dirptr  = dirlist;
00169     for( i = 0; i < numdirs; i++ ) {
00170         dirlen = strlen( dirptr ) + 1;
00171     descptr = dirptr + dirlen;
00172     UI_Mods_ParseInfos( dirptr, descptr);
00173     dirptr += dirlen + strlen(descptr) + 1;
00174     }
00175 
00176     trap_Print( va( "%i mods parsed\n", s_mods.list.numitems ) );
00177     if (s_mods.list.numitems > MAX_MODS) {
00178         s_mods.list.numitems = MAX_MODS;
00179     }
00180 }

Here is the call graph for this function:

void UI_Mods_MenuEvent void *  ptr,
int  event
[static]
 

Definition at line 71 of file ui_mods.c.

References menulist_s::curvalue, EXEC_APPEND, mods_t::fs_gameList, ID_BACK, ID_GO, mods_t::list, s_mods, trap_Cmd_ExecuteText(), trap_Cvar_Set(), and UI_PopMenu().

00071                                                       {
00072     if( event != QM_ACTIVATED ) {
00073         return;
00074     }
00075 
00076     switch ( ((menucommon_s*)ptr)->id ) {
00077     case ID_GO:
00078         trap_Cvar_Set( "fs_game", s_mods.fs_gameList[s_mods.list.curvalue] );
00079         trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart;" );
00080         UI_PopMenu();
00081         break;
00082 
00083     case ID_BACK:
00084         UI_PopMenu();
00085         break;
00086     }
00087 }

Here is the call graph for this function:

void UI_Mods_MenuInit void   )  [static]
 

Definition at line 188 of file ui_mods.c.

References mods_t::back, mods_t::banner, menucommon_s::callback, menutext_s::color, menucommon_s::flags, menubitmap_s::focuspic, mods_t::framel, mods_t::framer, _tag_menuframework::fullscreen, menulist_s::generic, menubitmap_s::generic, menutext_s::generic, mods_t::go, menulist_s::height, menubitmap_s::height, menucommon_s::id, mods_t::list, memset(), mods_t::menu, Menu_AddItem(), menucommon_s::name, QMF_LEFT_JUSTIFY, QMF_PULSEIFFOCUS, QMF_RIGHT_JUSTIFY, s_mods, menutext_s::string, menutext_s::style, menucommon_s::type, UI_Mods_LoadMods(), UI_ModsMenu_Cache(), menulist_s::width, menubitmap_s::width, _tag_menuframework::wrapAround, menucommon_s::x, and menucommon_s::y.

Referenced by UI_ModsMenu().

00188                                      {
00189     UI_ModsMenu_Cache();
00190 
00191     memset( &s_mods, 0 ,sizeof(mods_t) );
00192     s_mods.menu.wrapAround = qtrue;
00193     s_mods.menu.fullscreen = qtrue;
00194 
00195     s_mods.banner.generic.type      = MTYPE_BTEXT;
00196     s_mods.banner.generic.x         = 320;
00197     s_mods.banner.generic.y         = 16;
00198     s_mods.banner.string            = "MODS";
00199     s_mods.banner.color             = color_white;
00200     s_mods.banner.style             = UI_CENTER;
00201 
00202     s_mods.framel.generic.type      = MTYPE_BITMAP;
00203     s_mods.framel.generic.name      = ART_FRAMEL;
00204     s_mods.framel.generic.flags     = QMF_INACTIVE;
00205     s_mods.framel.generic.x         = 0;  
00206     s_mods.framel.generic.y         = 78;
00207     s_mods.framel.width             = 256;
00208     s_mods.framel.height            = 329;
00209 
00210     s_mods.framer.generic.type      = MTYPE_BITMAP;
00211     s_mods.framer.generic.name      = ART_FRAMER;
00212     s_mods.framer.generic.flags     = QMF_INACTIVE;
00213     s_mods.framer.generic.x         = 376;
00214     s_mods.framer.generic.y         = 76;
00215     s_mods.framer.width             = 256;
00216     s_mods.framer.height            = 334;
00217 
00218     s_mods.back.generic.type        = MTYPE_BITMAP;
00219     s_mods.back.generic.name        = ART_BACK0;
00220     s_mods.back.generic.flags       = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
00221     s_mods.back.generic.id          = ID_BACK;
00222     s_mods.back.generic.callback    = UI_Mods_MenuEvent;
00223     s_mods.back.generic.x           = 0;
00224     s_mods.back.generic.y           = 480-64;
00225     s_mods.back.width               = 128;
00226     s_mods.back.height              = 64;
00227     s_mods.back.focuspic            = ART_BACK1;
00228 
00229     s_mods.go.generic.type          = MTYPE_BITMAP;
00230     s_mods.go.generic.name          = ART_FIGHT0;
00231     s_mods.go.generic.flags         = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS;
00232     s_mods.go.generic.id            = ID_GO;
00233     s_mods.go.generic.callback      = UI_Mods_MenuEvent;
00234     s_mods.go.generic.x             = 640;
00235     s_mods.go.generic.y             = 480-64;
00236     s_mods.go.width                 = 128;
00237     s_mods.go.height                = 64;
00238     s_mods.go.focuspic              = ART_FIGHT1;
00239 
00240     // scan for mods
00241     s_mods.list.generic.type        = MTYPE_SCROLLLIST;
00242     s_mods.list.generic.flags       = QMF_PULSEIFFOCUS|QMF_CENTER_JUSTIFY;
00243     s_mods.list.generic.callback    = UI_Mods_MenuEvent;
00244     s_mods.list.generic.id          = ID_LIST;
00245     s_mods.list.generic.x           = 320;
00246     s_mods.list.generic.y           = 130;
00247     s_mods.list.width               = 48;
00248     s_mods.list.height              = 14;
00249 
00250     UI_Mods_LoadMods();
00251 
00252     Menu_AddItem( &s_mods.menu, &s_mods.banner );
00253     Menu_AddItem( &s_mods.menu, &s_mods.framel );
00254     Menu_AddItem( &s_mods.menu, &s_mods.framer );
00255     Menu_AddItem( &s_mods.menu, &s_mods.list );
00256     Menu_AddItem( &s_mods.menu, &s_mods.back );
00257     Menu_AddItem( &s_mods.menu, &s_mods.go );
00258 }

Here is the call graph for this function:

void UI_Mods_ParseInfos char *  modDir,
char *  modDesc
[static]
 

Definition at line 95 of file ui_mods.c.

References mods_t::descriptionList, mods_t::descriptionPtr, mods_t::fs_gameList, mods_t::fs_gamePtr, menulist_s::itemnames, mods_t::list, menulist_s::numitems, Q_strncpyz(), s_mods, and strlen().

Referenced by UI_Mods_LoadMods().

Here is the call graph for this function:

void UI_ModsMenu void   ) 
 

Definition at line 280 of file ui_mods.c.

References mods_t::menu, s_mods, UI_Mods_MenuInit(), and UI_PushMenu().

00280                          {
00281     UI_Mods_MenuInit();
00282     UI_PushMenu( &s_mods.menu );
00283 }

Here is the call graph for this function:

void UI_ModsMenu_Cache void   ) 
 

Definition at line 265 of file ui_mods.c.

References ART_BACK0, ART_BACK1, ART_FIGHT0, ART_FIGHT1, ART_FRAMEL, ART_FRAMER, and trap_R_RegisterShaderNoMip().

00265                                {
00266     trap_R_RegisterShaderNoMip( ART_BACK0 );
00267     trap_R_RegisterShaderNoMip( ART_BACK1 );
00268     trap_R_RegisterShaderNoMip( ART_FIGHT0 );
00269     trap_R_RegisterShaderNoMip( ART_FIGHT1 );
00270     trap_R_RegisterShaderNoMip( ART_FRAMEL );
00271     trap_R_RegisterShaderNoMip( ART_FRAMER );
00272 }

Here is the call graph for this function:


Variable Documentation

mods_t s_mods [static]
 

Definition at line 63 of file ui_mods.c.

Referenced by UI_Mods_LoadMods(), UI_Mods_MenuEvent(), UI_Mods_MenuInit(), UI_Mods_ParseInfos(), and UI_ModsMenu().


Generated on Thu Aug 25 14:33:01 2005 for Quake III Arena by  doxygen 1.3.9.1