mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2025-02-16 09:02:11 +00:00
Update to ioquake3 2018-12-21 part 3 (UI code)
This commit is contained in:
parent
dfb9bed2b8
commit
a4be4e4a37
16 changed files with 560 additions and 281 deletions
|
@ -512,6 +512,10 @@ void UI_DrawProportionalString( int x, int y, const char* str, int style, vec4_t
|
|||
int width;
|
||||
float sizeScale;
|
||||
|
||||
if( !str ) {
|
||||
return;
|
||||
}
|
||||
|
||||
sizeScale = UI_ProportionalSizeScale( style );
|
||||
|
||||
switch( style & UI_FORMATMASK ) {
|
||||
|
@ -803,7 +807,7 @@ static void NeedCDKeyAction( qboolean result ) {
|
|||
|
||||
void UI_SetActiveMenu( uiMenuCommand_t menu ) {
|
||||
// this should be the ONLY way the menu system is brought up
|
||||
// enusure minumum menu data is cached
|
||||
// ensure minimum menu data is cached
|
||||
Menu_Cache();
|
||||
|
||||
switch ( menu ) {
|
||||
|
@ -872,17 +876,21 @@ UI_MouseEvent
|
|||
void UI_MouseEvent( int dx, int dy )
|
||||
{
|
||||
int i;
|
||||
int bias;
|
||||
menucommon_s* m;
|
||||
|
||||
if (!uis.activemenu)
|
||||
return;
|
||||
|
||||
// convert X bias to 640 coords
|
||||
bias = uis.bias / uis.xscale;
|
||||
|
||||
// update mouse screen position
|
||||
uis.cursorx += dx;
|
||||
if (uis.cursorx < -uis.bias)
|
||||
uis.cursorx = -uis.bias;
|
||||
else if (uis.cursorx > SCREEN_WIDTH+uis.bias)
|
||||
uis.cursorx = SCREEN_WIDTH+uis.bias;
|
||||
if (uis.cursorx < -bias)
|
||||
uis.cursorx = -bias;
|
||||
else if (uis.cursorx > SCREEN_WIDTH+bias)
|
||||
uis.cursorx = SCREEN_WIDTH+bias;
|
||||
|
||||
uis.cursory += dy;
|
||||
if (uis.cursory < 0)
|
||||
|
|
|
@ -169,7 +169,7 @@ static void UI_LoadArenas( void ) {
|
|||
int numdirs;
|
||||
vmCvar_t arenasFile;
|
||||
char filename[128];
|
||||
char dirlist[2048];
|
||||
char dirlist[4096];
|
||||
char* dirptr;
|
||||
int i, n;
|
||||
int dirlen;
|
||||
|
@ -188,7 +188,7 @@ static void UI_LoadArenas( void ) {
|
|||
}
|
||||
|
||||
// get all arenas from .arena files
|
||||
numdirs = trap_FS_GetFileList("scripts", ".arena", dirlist, 2048 );
|
||||
numdirs = trap_FS_GetFileList("scripts", ".arena", dirlist, 4096 );
|
||||
dirptr = dirlist;
|
||||
for (i = 0; i < numdirs; i++, dirptr += dirlen+1) {
|
||||
dirlen = strlen(dirptr);
|
||||
|
@ -796,7 +796,7 @@ void UI_SPUnlockMedals_f( void ) {
|
|||
|
||||
trap_Cvar_Set( "g_spAwards", awardData );
|
||||
|
||||
trap_Print( "All levels unlocked at 100\n" );
|
||||
trap_Print( "All awards unlocked at 100\n" );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@ typedef struct
|
|||
int width;
|
||||
int height;
|
||||
int columns;
|
||||
int seperation;
|
||||
int separation;
|
||||
} menulist_s;
|
||||
|
||||
typedef struct
|
||||
|
@ -486,6 +486,9 @@ typedef struct {
|
|||
|
||||
animation_t animations[MAX_ANIMATIONS];
|
||||
|
||||
qboolean fixedlegs; // true if legs yaw is always the same as torso yaw
|
||||
qboolean fixedtorso; // true if torso never changes yaw
|
||||
|
||||
qhandle_t weaponModel;
|
||||
qhandle_t barrelModel;
|
||||
qhandle_t flashModel;
|
||||
|
|
|
@ -185,7 +185,7 @@ static cvarTable_t cvarTable[] = {
|
|||
|
||||
{ &ui_spSelection, "ui_spSelection", "", CVAR_ROM },
|
||||
|
||||
{ &ui_browserMaster, "ui_browserMaster", "0", CVAR_ARCHIVE },
|
||||
{ &ui_browserMaster, "ui_browserMaster", "1", CVAR_ARCHIVE },
|
||||
{ &ui_browserGameType, "ui_browserGameType", "0", CVAR_ARCHIVE },
|
||||
{ &ui_browserSortKey, "ui_browserSortKey", "4", CVAR_ARCHIVE },
|
||||
{ &ui_browserShowFull, "ui_browserShowFull", "1", CVAR_ARCHIVE },
|
||||
|
@ -214,7 +214,8 @@ static cvarTable_t cvarTable[] = {
|
|||
{ &ui_server16, "server16", "", CVAR_ARCHIVE },
|
||||
|
||||
{ &ui_cdkeychecked, "ui_cdkeychecked", "0", CVAR_ROM },
|
||||
{ &ui_ioq3, "ui_ioq3", "1", CVAR_ROM }
|
||||
{ &ui_ioq3, "ui_ioq3", "1", CVAR_ROM },
|
||||
{ NULL, "g_localTeamPref", "", 0 }
|
||||
};
|
||||
|
||||
static int cvarTableSize = ARRAY_LEN( cvarTable );
|
||||
|
@ -244,6 +245,10 @@ void UI_UpdateCvars( void ) {
|
|||
cvarTable_t *cv;
|
||||
|
||||
for ( i = 0, cv = cvarTable ; i < cvarTableSize ; i++, cv++ ) {
|
||||
if ( !cv->vmCvar ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
trap_Cvar_Update( cv->vmCvar );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -339,14 +339,14 @@ static void PlayerModel_PicEvent( void* ptr, int event )
|
|||
Q_strncpyz(s_playermodel.modelskin,buffptr,pdest-buffptr+1);
|
||||
strcat(s_playermodel.modelskin,pdest + 5);
|
||||
|
||||
// seperate the model name
|
||||
// separate the model name
|
||||
maxlen = pdest-buffptr;
|
||||
if (maxlen > 16)
|
||||
maxlen = 16;
|
||||
Q_strncpyz( s_playermodel.modelname.string, buffptr, maxlen );
|
||||
Q_strupr( s_playermodel.modelname.string );
|
||||
|
||||
// seperate the skin name
|
||||
// separate the skin name
|
||||
maxlen = strlen(pdest+5)+1;
|
||||
if (maxlen > 16)
|
||||
maxlen = 16;
|
||||
|
@ -494,14 +494,14 @@ static void PlayerModel_SetMenuItems( void )
|
|||
s_playermodel.selectedmodel = i;
|
||||
s_playermodel.modelpage = i/MAX_MODELSPERPAGE;
|
||||
|
||||
// seperate the model name
|
||||
// separate the model name
|
||||
maxlen = pdest-buffptr;
|
||||
if (maxlen > 16)
|
||||
maxlen = 16;
|
||||
Q_strncpyz( s_playermodel.modelname.string, buffptr, maxlen );
|
||||
Q_strupr( s_playermodel.modelname.string );
|
||||
|
||||
// seperate the skin name
|
||||
// separate the skin name
|
||||
maxlen = strlen(pdest+5)+1;
|
||||
if (maxlen > 16)
|
||||
maxlen = 16;
|
||||
|
|
|
@ -363,7 +363,7 @@ UI_RunLerpFrame
|
|||
===============
|
||||
*/
|
||||
static void UI_RunLerpFrame( playerInfo_t *ci, lerpFrame_t *lf, int newAnimation ) {
|
||||
int f;
|
||||
int f, numFrames;
|
||||
animation_t *anim;
|
||||
|
||||
// see if the animation sequence is switching
|
||||
|
@ -379,25 +379,41 @@ static void UI_RunLerpFrame( playerInfo_t *ci, lerpFrame_t *lf, int newAnimation
|
|||
|
||||
// get the next frame based on the animation
|
||||
anim = lf->animation;
|
||||
if ( !anim->frameLerp ) {
|
||||
return; // shouldn't happen
|
||||
}
|
||||
if ( dp_realtime < lf->animationTime ) {
|
||||
lf->frameTime = lf->animationTime; // initial lerp
|
||||
} else {
|
||||
lf->frameTime = lf->oldFrameTime + anim->frameLerp;
|
||||
}
|
||||
f = ( lf->frameTime - lf->animationTime ) / anim->frameLerp;
|
||||
if ( f >= anim->numFrames ) {
|
||||
f -= anim->numFrames;
|
||||
|
||||
numFrames = anim->numFrames;
|
||||
if (anim->flipflop) {
|
||||
numFrames *= 2;
|
||||
}
|
||||
if ( f >= numFrames ) {
|
||||
f -= numFrames;
|
||||
if ( anim->loopFrames ) {
|
||||
f %= anim->loopFrames;
|
||||
f += anim->numFrames - anim->loopFrames;
|
||||
} else {
|
||||
f = anim->numFrames - 1;
|
||||
f = numFrames - 1;
|
||||
// the animation is stuck at the end, so it
|
||||
// can immediately transition to another sequence
|
||||
lf->frameTime = dp_realtime;
|
||||
}
|
||||
}
|
||||
lf->frame = anim->firstFrame + f;
|
||||
if ( anim->reversed ) {
|
||||
lf->frame = anim->firstFrame + anim->numFrames - 1 - f;
|
||||
}
|
||||
else if (anim->flipflop && f>=anim->numFrames) {
|
||||
lf->frame = anim->firstFrame + anim->numFrames - 1 - (f%anim->numFrames);
|
||||
}
|
||||
else {
|
||||
lf->frame = anim->firstFrame + f;
|
||||
}
|
||||
if ( dp_realtime > lf->frameTime ) {
|
||||
lf->frameTime = dp_realtime;
|
||||
}
|
||||
|
@ -615,6 +631,16 @@ static void UI_PlayerAngles( playerInfo_t *pi, vec3_t legs[3], vec3_t torso[3],
|
|||
UI_SwingAngles( dest, 15, 30, 0.1f, &pi->torso.pitchAngle, &pi->torso.pitching );
|
||||
torsoAngles[PITCH] = pi->torso.pitchAngle;
|
||||
|
||||
if ( pi->fixedtorso ) {
|
||||
torsoAngles[PITCH] = 0.0f;
|
||||
}
|
||||
|
||||
if ( pi->fixedlegs ) {
|
||||
legsAngles[YAW] = torsoAngles[YAW];
|
||||
legsAngles[PITCH] = 0.0f;
|
||||
legsAngles[ROLL] = 0.0f;
|
||||
}
|
||||
|
||||
// pull the angles back out of the hierarchial chain
|
||||
AnglesSubtract( headAngles, torsoAngles, headAngles );
|
||||
AnglesSubtract( torsoAngles, legsAngles, torsoAngles );
|
||||
|
@ -930,7 +956,7 @@ static qboolean UI_RegisterClientSkin( playerInfo_t *pi, const char *modelName,
|
|||
UI_ParseAnimationFile
|
||||
======================
|
||||
*/
|
||||
static qboolean UI_ParseAnimationFile( const char *filename, animation_t *animations ) {
|
||||
static qboolean UI_ParseAnimationFile( const char *filename, playerInfo_t *pi ) {
|
||||
char *text_p, *prev;
|
||||
int len;
|
||||
int i;
|
||||
|
@ -939,9 +965,15 @@ static qboolean UI_ParseAnimationFile( const char *filename, animation_t *animat
|
|||
int skip;
|
||||
char text[20000];
|
||||
fileHandle_t f;
|
||||
animation_t *animations;
|
||||
|
||||
animations = pi->animations;
|
||||
|
||||
memset( animations, 0, sizeof( animation_t ) * MAX_ANIMATIONS );
|
||||
|
||||
pi->fixedlegs = qfalse;
|
||||
pi->fixedtorso = qfalse;
|
||||
|
||||
// load the file
|
||||
len = trap_FS_FOpenFile( filename, &f, FS_READ );
|
||||
if ( len <= 0 ) {
|
||||
|
@ -964,29 +996,35 @@ static qboolean UI_ParseAnimationFile( const char *filename, animation_t *animat
|
|||
while ( 1 ) {
|
||||
prev = text_p; // so we can unget
|
||||
token = COM_Parse( &text_p );
|
||||
if ( !token ) {
|
||||
if ( !token[0] ) {
|
||||
break;
|
||||
}
|
||||
if ( !Q_stricmp( token, "footsteps" ) ) {
|
||||
token = COM_Parse( &text_p );
|
||||
if ( !token ) {
|
||||
if ( !token[0] ) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
} else if ( !Q_stricmp( token, "headoffset" ) ) {
|
||||
for ( i = 0 ; i < 3 ; i++ ) {
|
||||
token = COM_Parse( &text_p );
|
||||
if ( !token ) {
|
||||
if ( !token[0] ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
} else if ( !Q_stricmp( token, "sex" ) ) {
|
||||
token = COM_Parse( &text_p );
|
||||
if ( !token ) {
|
||||
if ( !token[0] ) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
} else if ( !Q_stricmp( token, "fixedlegs" ) ) {
|
||||
pi->fixedlegs = qtrue;
|
||||
continue;
|
||||
} else if ( !Q_stricmp( token, "fixedtorso" ) ) {
|
||||
pi->fixedtorso = qtrue;
|
||||
continue;
|
||||
}
|
||||
|
||||
// if it is a number, start parsing animations
|
||||
|
@ -1002,7 +1040,17 @@ static qboolean UI_ParseAnimationFile( const char *filename, animation_t *animat
|
|||
for ( i = 0 ; i < MAX_ANIMATIONS ; i++ ) {
|
||||
|
||||
token = COM_Parse( &text_p );
|
||||
if ( !token ) {
|
||||
if ( !token[0] ) {
|
||||
if( i >= TORSO_GETFLAG && i <= TORSO_NEGATIVE ) {
|
||||
animations[i].firstFrame = animations[TORSO_GESTURE].firstFrame;
|
||||
animations[i].frameLerp = animations[TORSO_GESTURE].frameLerp;
|
||||
animations[i].initialLerp = animations[TORSO_GESTURE].initialLerp;
|
||||
animations[i].loopFrames = animations[TORSO_GESTURE].loopFrames;
|
||||
animations[i].numFrames = animations[TORSO_GESTURE].numFrames;
|
||||
animations[i].reversed = qfalse;
|
||||
animations[i].flipflop = qfalse;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
animations[i].firstFrame = atoi( token );
|
||||
|
@ -1010,24 +1058,32 @@ static qboolean UI_ParseAnimationFile( const char *filename, animation_t *animat
|
|||
if ( i == LEGS_WALKCR ) {
|
||||
skip = animations[LEGS_WALKCR].firstFrame - animations[TORSO_GESTURE].firstFrame;
|
||||
}
|
||||
if ( i >= LEGS_WALKCR ) {
|
||||
if ( i >= LEGS_WALKCR && i<TORSO_GETFLAG) {
|
||||
animations[i].firstFrame -= skip;
|
||||
}
|
||||
|
||||
token = COM_Parse( &text_p );
|
||||
if ( !token ) {
|
||||
if ( !token[0] ) {
|
||||
break;
|
||||
}
|
||||
animations[i].numFrames = atoi( token );
|
||||
|
||||
animations[i].reversed = qfalse;
|
||||
animations[i].flipflop = qfalse;
|
||||
// if numFrames is negative the animation is reversed
|
||||
if (animations[i].numFrames < 0) {
|
||||
animations[i].numFrames = -animations[i].numFrames;
|
||||
animations[i].reversed = qtrue;
|
||||
}
|
||||
|
||||
token = COM_Parse( &text_p );
|
||||
if ( !token ) {
|
||||
if ( !token[0] ) {
|
||||
break;
|
||||
}
|
||||
animations[i].loopFrames = atoi( token );
|
||||
|
||||
token = COM_Parse( &text_p );
|
||||
if ( !token ) {
|
||||
if ( !token[0] ) {
|
||||
break;
|
||||
}
|
||||
fps = atof( token );
|
||||
|
@ -1110,7 +1166,7 @@ qboolean UI_RegisterClientModelname( playerInfo_t *pi, const char *modelSkinName
|
|||
|
||||
// load the animations
|
||||
Com_sprintf( filename, sizeof( filename ), "models/players/%s/animation.cfg", modelName );
|
||||
if ( !UI_ParseAnimationFile( filename, pi->animations ) ) {
|
||||
if ( !UI_ParseAnimationFile( filename, pi ) ) {
|
||||
Com_Printf( "Failed to load animation file %s\n", filename );
|
||||
return qfalse;
|
||||
}
|
||||
|
|
|
@ -881,13 +881,13 @@ static void ScrollList_Init( menulist_s *l )
|
|||
|
||||
if( !l->columns ) {
|
||||
l->columns = 1;
|
||||
l->seperation = 0;
|
||||
l->separation = 0;
|
||||
}
|
||||
else if( !l->seperation ) {
|
||||
l->seperation = 3;
|
||||
else if( !l->separation ) {
|
||||
l->separation = 3;
|
||||
}
|
||||
|
||||
w = ( (l->width + l->seperation) * l->columns - l->seperation) * SMALLCHAR_WIDTH;
|
||||
w = ( (l->width + l->separation) * l->columns - l->separation) * SMALLCHAR_WIDTH;
|
||||
|
||||
l->generic.left = l->generic.x;
|
||||
l->generic.top = l->generic.y;
|
||||
|
@ -926,14 +926,14 @@ sfxHandle_t ScrollList_Key( menulist_s *l, int key )
|
|||
// check scroll region
|
||||
x = l->generic.x;
|
||||
y = l->generic.y;
|
||||
w = ( (l->width + l->seperation) * l->columns - l->seperation) * SMALLCHAR_WIDTH;
|
||||
w = ( (l->width + l->separation) * l->columns - l->separation) * SMALLCHAR_WIDTH;
|
||||
if( l->generic.flags & QMF_CENTER_JUSTIFY ) {
|
||||
x -= w / 2;
|
||||
}
|
||||
if (UI_CursorInRect( x, y, w, l->height*SMALLCHAR_HEIGHT ))
|
||||
{
|
||||
cursorx = (uis.cursorx - x)/SMALLCHAR_WIDTH;
|
||||
column = cursorx / (l->width + l->seperation);
|
||||
column = cursorx / (l->width + l->separation);
|
||||
cursory = (uis.cursory - y)/SMALLCHAR_HEIGHT;
|
||||
index = column * l->height + cursory;
|
||||
if (l->top + index < l->numitems)
|
||||
|
@ -1034,6 +1034,50 @@ sfxHandle_t ScrollList_Key( menulist_s *l, int key )
|
|||
}
|
||||
return (menu_buzz_sound);
|
||||
|
||||
case K_MWHEELUP:
|
||||
if( l->columns > 1 ) {
|
||||
return menu_null_sound;
|
||||
}
|
||||
|
||||
if (l->top > 0)
|
||||
{
|
||||
// if scrolling 3 lines would replace over half of the
|
||||
// displayed items, only scroll 1 item at a time.
|
||||
int scroll = l->height < 6 ? 1 : 3;
|
||||
l->top -= scroll;
|
||||
if (l->top < 0)
|
||||
l->top = 0;
|
||||
|
||||
if (l->generic.callback)
|
||||
l->generic.callback( l, QM_GOTFOCUS );
|
||||
|
||||
// make scrolling silent
|
||||
return (menu_null_sound);
|
||||
}
|
||||
return (menu_buzz_sound);
|
||||
|
||||
case K_MWHEELDOWN:
|
||||
if( l->columns > 1 ) {
|
||||
return menu_null_sound;
|
||||
}
|
||||
|
||||
if (l->top < l->numitems-l->height)
|
||||
{
|
||||
// if scrolling 3 items would replace over half of the
|
||||
// displayed items, only scroll 1 item at a time.
|
||||
int scroll = l->height < 6 ? 1 : 3;
|
||||
l->top += scroll;
|
||||
if (l->top > l->numitems-l->height)
|
||||
l->top = l->numitems-l->height;
|
||||
|
||||
if (l->generic.callback)
|
||||
l->generic.callback( l, QM_GOTFOCUS );
|
||||
|
||||
// make scrolling silent
|
||||
return (menu_null_sound);
|
||||
}
|
||||
return (menu_buzz_sound);
|
||||
|
||||
case K_KP_UPARROW:
|
||||
case K_UPARROW:
|
||||
if( l->curvalue == 0 ) {
|
||||
|
@ -1241,7 +1285,7 @@ void ScrollList_Draw( menulist_s *l )
|
|||
|
||||
y += SMALLCHAR_HEIGHT;
|
||||
}
|
||||
x += (l->width + l->seperation) * SMALLCHAR_WIDTH;
|
||||
x += (l->width + l->separation) * SMALLCHAR_WIDTH;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,34 +81,39 @@ MULTIPLAYER MENU (SERVER BROWSER)
|
|||
#define GR_LETTERS 31
|
||||
|
||||
#define UIAS_LOCAL 0
|
||||
#define UIAS_GLOBAL1 1
|
||||
#define UIAS_GLOBAL2 2
|
||||
#define UIAS_GLOBAL3 3
|
||||
#define UIAS_GLOBAL4 4
|
||||
#define UIAS_GLOBAL5 5
|
||||
#define UIAS_FAVORITES 6
|
||||
#define UIAS_GLOBAL0 1
|
||||
#define UIAS_GLOBAL1 2
|
||||
#define UIAS_GLOBAL2 3
|
||||
#define UIAS_GLOBAL3 4
|
||||
#define UIAS_GLOBAL4 5
|
||||
#define UIAS_GLOBAL5 6
|
||||
#define UIAS_FAVORITES 7
|
||||
#define UIAS_NUM_SOURCES 8
|
||||
|
||||
#define UI_MAX_MASTER_SERVERS 5
|
||||
#define UI_MAX_MASTER_SERVERS 6
|
||||
|
||||
#define SORT_HOST 0
|
||||
#define SORT_MAP 1
|
||||
#define SORT_CLIENTS 2
|
||||
#define SORT_GAME 3
|
||||
#define SORT_PING 4
|
||||
#define SORT_NUM_SORTS 5
|
||||
|
||||
#define GAMES_ALL 0
|
||||
#define GAMES_FFA 1
|
||||
#define GAMES_TEAMPLAY 2
|
||||
#define GAMES_TOURNEY 3
|
||||
#define GAMES_CTF 4
|
||||
#define GAMES_NUM_GAMES 5
|
||||
|
||||
static const char *master_items[] = {
|
||||
"Local",
|
||||
"Internet1",
|
||||
"Internet2",
|
||||
"Internet3",
|
||||
"Internet4",
|
||||
"Internet5",
|
||||
"Internet",
|
||||
"Master1",
|
||||
"Master2",
|
||||
"Master3",
|
||||
"Master4",
|
||||
"Master5",
|
||||
"Favorites",
|
||||
NULL
|
||||
};
|
||||
|
@ -335,6 +340,29 @@ static int QDECL ArenaServers_Compare( const void *arg1, const void *arg2 ) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
ArenaServers_SourceForLAN
|
||||
|
||||
Convert ui's g_servertype to AS_* used by trap calls.
|
||||
=================
|
||||
*/
|
||||
int ArenaServers_SourceForLAN(void) {
|
||||
switch( g_servertype ) {
|
||||
default:
|
||||
case UIAS_LOCAL:
|
||||
return AS_LOCAL;
|
||||
case UIAS_GLOBAL0:
|
||||
case UIAS_GLOBAL1:
|
||||
case UIAS_GLOBAL2:
|
||||
case UIAS_GLOBAL3:
|
||||
case UIAS_GLOBAL4:
|
||||
case UIAS_GLOBAL5:
|
||||
return AS_GLOBAL;
|
||||
case UIAS_FAVORITES:
|
||||
return AS_FAVORITES;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
|
@ -399,7 +427,6 @@ static void ArenaServers_UpdateMenu( void ) {
|
|||
}
|
||||
else {
|
||||
// all servers pinged - enable controls
|
||||
g_arenaservers.master.generic.flags &= ~QMF_GRAYED;
|
||||
g_arenaservers.gametype.generic.flags &= ~QMF_GRAYED;
|
||||
g_arenaservers.sortkey.generic.flags &= ~QMF_GRAYED;
|
||||
g_arenaservers.showempty.generic.flags &= ~QMF_GRAYED;
|
||||
|
@ -410,7 +437,7 @@ static void ArenaServers_UpdateMenu( void ) {
|
|||
g_arenaservers.punkbuster.generic.flags &= ~QMF_GRAYED;
|
||||
|
||||
// update status bar
|
||||
if( g_servertype >= UIAS_GLOBAL1 && g_servertype <= UIAS_GLOBAL5 ) {
|
||||
if( g_servertype >= UIAS_GLOBAL0 && g_servertype <= UIAS_GLOBAL5 ) {
|
||||
g_arenaservers.statusbar.string = quake3worldMessage;
|
||||
}
|
||||
else {
|
||||
|
@ -426,7 +453,6 @@ static void ArenaServers_UpdateMenu( void ) {
|
|||
g_arenaservers.statusbar.string = "Press SPACE to stop";
|
||||
|
||||
// disable controls during refresh
|
||||
g_arenaservers.master.generic.flags |= QMF_GRAYED;
|
||||
g_arenaservers.gametype.generic.flags |= QMF_GRAYED;
|
||||
g_arenaservers.sortkey.generic.flags |= QMF_GRAYED;
|
||||
g_arenaservers.showempty.generic.flags |= QMF_GRAYED;
|
||||
|
@ -445,7 +471,7 @@ static void ArenaServers_UpdateMenu( void ) {
|
|||
}
|
||||
|
||||
// update status bar
|
||||
if( g_servertype >= UIAS_GLOBAL1 && g_servertype <= UIAS_GLOBAL5 ) {
|
||||
if( g_servertype >= UIAS_GLOBAL0 && g_servertype <= UIAS_GLOBAL5 ) {
|
||||
g_arenaservers.statusbar.string = quake3worldMessage;
|
||||
}
|
||||
else {
|
||||
|
@ -697,38 +723,6 @@ static void ArenaServers_Insert( char* adrstr, char* info, int pingtime )
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
ArenaServers_InsertFavorites
|
||||
|
||||
Insert nonresponsive address book entries into display lists.
|
||||
=================
|
||||
*/
|
||||
void ArenaServers_InsertFavorites( void )
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
char info[MAX_INFO_STRING];
|
||||
|
||||
// resync existing results with new or deleted cvars
|
||||
info[0] = '\0';
|
||||
Info_SetValueForKey( info, "hostname", "No Response" );
|
||||
for (i=0; i<g_arenaservers.numfavoriteaddresses; i++)
|
||||
{
|
||||
// find favorite address in refresh list
|
||||
for (j=0; j<g_numfavoriteservers; j++)
|
||||
if (!Q_stricmp(g_arenaservers.favoriteaddresses[i],g_favoriteserverlist[j].adrstr))
|
||||
break;
|
||||
|
||||
if ( j >= g_numfavoriteservers)
|
||||
{
|
||||
// not in list, add it
|
||||
ArenaServers_Insert( g_arenaservers.favoriteaddresses[i], info, ArenaServers_MaxPing() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
ArenaServers_LoadFavorites
|
||||
|
@ -812,12 +806,6 @@ static void ArenaServers_StopRefresh( void )
|
|||
|
||||
g_arenaservers.refreshservers = qfalse;
|
||||
|
||||
if (g_servertype == UIAS_FAVORITES)
|
||||
{
|
||||
// nonresponsive favorites must be shown
|
||||
ArenaServers_InsertFavorites();
|
||||
}
|
||||
|
||||
// final tally
|
||||
if (g_arenaservers.numqueriedservers >= 0)
|
||||
{
|
||||
|
@ -850,15 +838,22 @@ static void ArenaServers_DoRefresh( void )
|
|||
{
|
||||
if (g_servertype != UIAS_FAVORITES) {
|
||||
if (g_servertype == UIAS_LOCAL) {
|
||||
if (!trap_LAN_GetServerCount(g_servertype)) {
|
||||
if (!trap_LAN_GetServerCount(AS_LOCAL)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (trap_LAN_GetServerCount(g_servertype) < 0) {
|
||||
if (trap_LAN_GetServerCount(ArenaServers_SourceForLAN()) < 0) {
|
||||
// still waiting for response
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (g_servertype == UIAS_LOCAL) {
|
||||
if (!trap_LAN_GetServerCount(AS_LOCAL)) {
|
||||
// no local servers found, check again
|
||||
trap_Cmd_ExecuteText( EXEC_APPEND, "localservers\n" );
|
||||
g_arenaservers.refreshtime = uis.realtime + 5000;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (uis.realtime < g_arenaservers.nextpingtime)
|
||||
|
@ -904,6 +899,12 @@ static void ArenaServers_DoRefresh( void )
|
|||
// stale it out
|
||||
info[0] = '\0';
|
||||
time = maxPing;
|
||||
|
||||
// set hostname for nonresponsive favorite server
|
||||
if (g_servertype == UIAS_FAVORITES) {
|
||||
Info_SetValueForKey( info, "hostname", adrstr );
|
||||
Info_SetValueForKey( info, "game", "???" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -926,7 +927,7 @@ static void ArenaServers_DoRefresh( void )
|
|||
if (g_servertype == UIAS_FAVORITES) {
|
||||
g_arenaservers.numqueriedservers = g_arenaservers.numfavoriteaddresses;
|
||||
} else {
|
||||
g_arenaservers.numqueriedservers = trap_LAN_GetServerCount(g_servertype);
|
||||
g_arenaservers.numqueriedservers = trap_LAN_GetServerCount(ArenaServers_SourceForLAN());
|
||||
}
|
||||
|
||||
// if (g_arenaservers.numqueriedservers > g_arenaservers.maxservers)
|
||||
|
@ -956,7 +957,7 @@ static void ArenaServers_DoRefresh( void )
|
|||
if (g_servertype == UIAS_FAVORITES) {
|
||||
strcpy( adrstr, g_arenaservers.favoriteaddresses[g_arenaservers.currentping] );
|
||||
} else {
|
||||
trap_LAN_GetServerAddressString(g_servertype, g_arenaservers.currentping, adrstr, MAX_ADDRESSLENGTH );
|
||||
trap_LAN_GetServerAddressString(ArenaServers_SourceForLAN(), g_arenaservers.currentping, adrstr, MAX_ADDRESSLENGTH );
|
||||
}
|
||||
|
||||
strcpy( g_arenaservers.pinglist[j].adrstr, adrstr );
|
||||
|
@ -1015,7 +1016,7 @@ static void ArenaServers_StartRefresh( void )
|
|||
return;
|
||||
}
|
||||
|
||||
if( g_servertype >= UIAS_GLOBAL1 && g_servertype <= UIAS_GLOBAL5 ) {
|
||||
if( g_servertype >= UIAS_GLOBAL0 && g_servertype <= UIAS_GLOBAL5 ) {
|
||||
switch( g_arenaservers.gametype.curvalue ) {
|
||||
default:
|
||||
case GAMES_ALL:
|
||||
|
@ -1051,10 +1052,10 @@ static void ArenaServers_StartRefresh( void )
|
|||
protocol[0] = '\0';
|
||||
trap_Cvar_VariableStringBuffer( "debug_protocol", protocol, sizeof(protocol) );
|
||||
if (strlen(protocol)) {
|
||||
trap_Cmd_ExecuteText( EXEC_APPEND, va( "globalservers %d %s%s\n", g_servertype - 1, protocol, myargs ));
|
||||
trap_Cmd_ExecuteText( EXEC_APPEND, va( "globalservers %d %s%s\n", g_servertype - UIAS_GLOBAL0, protocol, myargs ));
|
||||
}
|
||||
else {
|
||||
trap_Cmd_ExecuteText( EXEC_APPEND, va( "globalservers %d %d%s\n", g_servertype - 1, (int)trap_Cvar_VariableValue( "protocol" ), myargs ) );
|
||||
trap_Cmd_ExecuteText( EXEC_APPEND, va( "globalservers %d %d%s\n", g_servertype - UIAS_GLOBAL0, (int)trap_Cvar_VariableValue( "protocol" ), myargs ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1099,18 +1100,27 @@ ArenaServers_SetType
|
|||
*/
|
||||
int ArenaServers_SetType( int type )
|
||||
{
|
||||
ArenaServers_StopRefresh();
|
||||
|
||||
if(type >= UIAS_GLOBAL1 && type <= UIAS_GLOBAL5)
|
||||
{
|
||||
char masterstr[2], cvarname[sizeof("sv_master1")];
|
||||
int direction;
|
||||
|
||||
while(type <= UIAS_GLOBAL5)
|
||||
if (type == g_servertype || type == ((g_servertype+1) % UIAS_NUM_SOURCES)) {
|
||||
direction = 1;
|
||||
} else {
|
||||
direction = -1;
|
||||
}
|
||||
|
||||
while(type >= UIAS_GLOBAL1 && type <= UIAS_GLOBAL5)
|
||||
{
|
||||
Com_sprintf(cvarname, sizeof(cvarname), "sv_master%d", type);
|
||||
Com_sprintf(cvarname, sizeof(cvarname), "sv_master%d", type - UIAS_GLOBAL0);
|
||||
trap_Cvar_VariableStringBuffer(cvarname, masterstr, sizeof(masterstr));
|
||||
if(*masterstr)
|
||||
break;
|
||||
|
||||
type++;
|
||||
type += direction;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1125,14 +1135,15 @@ int ArenaServers_SetType( int type )
|
|||
g_arenaservers.maxservers = MAX_LOCALSERVERS;
|
||||
break;
|
||||
|
||||
case UIAS_GLOBAL0:
|
||||
case UIAS_GLOBAL1:
|
||||
case UIAS_GLOBAL2:
|
||||
case UIAS_GLOBAL3:
|
||||
case UIAS_GLOBAL4:
|
||||
case UIAS_GLOBAL5:
|
||||
g_arenaservers.remove.generic.flags |= (QMF_INACTIVE|QMF_HIDDEN);
|
||||
g_arenaservers.serverlist = g_globalserverlist[type-UIAS_GLOBAL1];
|
||||
g_arenaservers.numservers = &g_numglobalservers[type-UIAS_GLOBAL1];
|
||||
g_arenaservers.serverlist = g_globalserverlist[type-UIAS_GLOBAL0];
|
||||
g_arenaservers.numservers = &g_numglobalservers[type-UIAS_GLOBAL0];
|
||||
g_arenaservers.maxservers = MAX_GLOBALSERVERS;
|
||||
break;
|
||||
|
||||
|
@ -1330,7 +1341,6 @@ ArenaServers_MenuInit
|
|||
static void ArenaServers_MenuInit( void ) {
|
||||
int i;
|
||||
int y;
|
||||
int value;
|
||||
static char statusbuffer[MAX_STATUSLENGTH];
|
||||
|
||||
// zero set all our globals
|
||||
|
@ -1578,17 +1588,12 @@ static void ArenaServers_MenuInit( void ) {
|
|||
|
||||
ArenaServers_LoadFavorites();
|
||||
|
||||
g_servertype = Com_Clamp( 0, 3, ui_browserMaster.integer );
|
||||
// hack to get rid of MPlayer stuff
|
||||
value = g_servertype;
|
||||
if (value >= 1)
|
||||
value--;
|
||||
g_arenaservers.master.curvalue = value;
|
||||
g_arenaservers.master.curvalue = g_servertype = Com_Clamp( 0, UIAS_NUM_SOURCES-1, ui_browserMaster.integer );
|
||||
|
||||
g_gametype = Com_Clamp( 0, 4, ui_browserGameType.integer );
|
||||
g_gametype = Com_Clamp( 0, GAMES_NUM_GAMES-1, ui_browserGameType.integer );
|
||||
g_arenaservers.gametype.curvalue = g_gametype;
|
||||
|
||||
g_sortkey = Com_Clamp( 0, 4, ui_browserSortKey.integer );
|
||||
g_sortkey = Com_Clamp( 0, SORT_NUM_SORTS-1, ui_browserSortKey.integer );
|
||||
g_arenaservers.sortkey.curvalue = g_sortkey;
|
||||
|
||||
g_fullservers = Com_Clamp( 0, 1, ui_browserShowFull.integer );
|
||||
|
|
|
@ -119,7 +119,7 @@ static int GametypeBits( char *string ) {
|
|||
p = string;
|
||||
while( 1 ) {
|
||||
token = COM_ParseExt( &p, qfalse );
|
||||
if( token[0] == 0 ) {
|
||||
if ( !token[0] ) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -331,6 +331,7 @@ static void StartServer_LevelshotDraw( void *self ) {
|
|||
int h;
|
||||
int n;
|
||||
const char *info;
|
||||
char mapname[ MAX_NAMELENGTH ];
|
||||
|
||||
b = (menubitmap_s *)self;
|
||||
|
||||
|
@ -366,7 +367,9 @@ static void StartServer_LevelshotDraw( void *self ) {
|
|||
n = s_startserver.page * MAX_MAPSPERPAGE + b->generic.id - ID_PICTURES;
|
||||
|
||||
info = UI_GetArenaInfoByNumber( s_startserver.maplist[ n ]);
|
||||
UI_DrawString( x, y, Info_ValueForKey( info, "map" ), UI_CENTER|UI_SMALLFONT, color_orange );
|
||||
Q_strncpyz( mapname, Info_ValueForKey( info, "map"), MAX_NAMELENGTH );
|
||||
Q_strupr( mapname );
|
||||
UI_DrawString( x, y, mapname, UI_CENTER|UI_SMALLFONT, color_orange );
|
||||
|
||||
x = b->generic.x;
|
||||
y = b->generic.y;
|
||||
|
@ -815,7 +818,11 @@ static void ServerOptions_Start( void ) {
|
|||
|
||||
// set player's team
|
||||
if( dedicated == 0 && s_serveroptions.gametype >= GT_TEAM ) {
|
||||
// send team command for vanilla q3 game qvm
|
||||
trap_Cmd_ExecuteText( EXEC_APPEND, va( "wait 5; team %s\n", playerTeam_list[s_serveroptions.playerTeam[0].curvalue] ) );
|
||||
|
||||
// set g_localTeamPref for ioq3 game qvm
|
||||
trap_Cvar_Set( "g_localTeamPref", playerTeam_list[s_serveroptions.playerTeam[0].curvalue] );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -679,11 +679,24 @@ static void GraphicsOptions_ApplyChanges( void *unused, int notification )
|
|||
trap_Cvar_SetValue( "r_mode", s_graphicsoptions.mode.curvalue );
|
||||
|
||||
trap_Cvar_SetValue( "r_fullscreen", s_graphicsoptions.fs.curvalue );
|
||||
|
||||
trap_Cvar_Reset("r_colorbits");
|
||||
trap_Cvar_Reset("r_depthbits");
|
||||
trap_Cvar_Reset("r_stencilbits");
|
||||
|
||||
switch ( s_graphicsoptions.colordepth.curvalue )
|
||||
{
|
||||
case 0:
|
||||
trap_Cvar_SetValue( "r_colorbits", 0 );
|
||||
trap_Cvar_SetValue( "r_depthbits", 0 );
|
||||
trap_Cvar_Reset( "r_stencilbits" );
|
||||
break;
|
||||
case 1:
|
||||
trap_Cvar_SetValue( "r_colorbits", 16 );
|
||||
trap_Cvar_SetValue( "r_depthbits", 16 );
|
||||
trap_Cvar_SetValue( "r_stencilbits", 0 );
|
||||
break;
|
||||
case 2:
|
||||
trap_Cvar_SetValue( "r_colorbits", 32 );
|
||||
trap_Cvar_SetValue( "r_depthbits", 24 );
|
||||
trap_Cvar_SetValue( "r_stencilbits", 8 );
|
||||
break;
|
||||
}
|
||||
trap_Cvar_SetValue( "r_vertexLight", s_graphicsoptions.lighting.curvalue );
|
||||
|
||||
if ( s_graphicsoptions.geometry.curvalue == 2 )
|
||||
|
|
|
@ -629,18 +629,10 @@ Makro - converted to macro, see ui_local.h
|
|||
void _UI_AdjustFrom640(float *x, float *y, float *w, float *h)
|
||||
{
|
||||
// expect valid pointers
|
||||
#if 0
|
||||
*x = *x * uiInfo.uiDC.scale + uiInfo.uiDC.bias;
|
||||
*y *= uiInfo.uiDC.scale;
|
||||
*w *= uiInfo.uiDC.scale;
|
||||
*h *= uiInfo.uiDC.scale;
|
||||
#endif
|
||||
|
||||
*x *= uiInfo.uiDC.xscale;
|
||||
*x = *x * uiInfo.uiDC.xscale + uiInfo.uiDC.bias;
|
||||
*y *= uiInfo.uiDC.yscale;
|
||||
*w *= uiInfo.uiDC.xscale;
|
||||
*h *= uiInfo.uiDC.yscale;
|
||||
|
||||
}
|
||||
|
||||
void UI_DrawNamedPic(float x, float y, float width, float height, const char *picname)
|
||||
|
|
|
@ -189,12 +189,10 @@ void UI_LoadArenas(void)
|
|||
char filename[128];
|
||||
char dirlist[1024];
|
||||
char *dirptr;
|
||||
int i, n;
|
||||
int i;
|
||||
int dirlen;
|
||||
char *type;
|
||||
|
||||
ui_numArenas = 0;
|
||||
uiInfo.mapCount = 0;
|
||||
|
||||
trap_Cvar_Register(&arenasFile, "g_arenasFile", "", CVAR_INIT | CVAR_ROM);
|
||||
if (*arenasFile.string) {
|
||||
|
@ -216,6 +214,19 @@ void UI_LoadArenas(void)
|
|||
if (UI_OutOfMemory()) {
|
||||
trap_Print(S_COLOR_YELLOW "WARNING: not anough memory in pool to load all arenas\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
UI_LoadArenasIntoMapList
|
||||
===============
|
||||
*/
|
||||
void UI_LoadArenasIntoMapList(void)
|
||||
{
|
||||
int i, n;
|
||||
char *type;
|
||||
|
||||
uiInfo.mapCount = 0;
|
||||
|
||||
for (n = 0; n < ui_numArenas; n++) {
|
||||
// determine type
|
||||
|
@ -302,7 +313,7 @@ static void UI_LoadBotsFromFile(char *filename)
|
|||
return;
|
||||
}
|
||||
if (len >= MAX_BOTS_TEXT) {
|
||||
trap_Print(va(S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, MAX_BOTS_TEXT));
|
||||
trap_Print(va(S_COLOR_RED "file too large: %s is %i, max allowed is %i\n", filename, len, MAX_BOTS_TEXT));
|
||||
trap_FS_FCloseFile(f);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -410,7 +410,7 @@ typedef struct {
|
|||
int width;
|
||||
int height;
|
||||
int columns;
|
||||
int seperation;
|
||||
int separation;
|
||||
} menulist_s;
|
||||
|
||||
typedef struct {
|
||||
|
@ -508,6 +508,7 @@ int UI_AdjustTimeByGame(int time);
|
|||
void UI_ShowPostGame(qboolean newHigh);
|
||||
void UI_ClearScores( void );
|
||||
void UI_LoadArenas(void);
|
||||
void UI_LoadArenasIntoMapList(void);
|
||||
//Makro - added
|
||||
void UI_BuildIngameServerInfoList( void );
|
||||
|
||||
|
@ -685,6 +686,9 @@ typedef struct {
|
|||
|
||||
animation_t animations[MAX_TOTALANIMATIONS];
|
||||
|
||||
qboolean fixedlegs; // true if legs yaw is always the same as torso yaw
|
||||
qboolean fixedtorso; // true if torso never changes yaw
|
||||
|
||||
qhandle_t weaponModel;
|
||||
qhandle_t barrelModel;
|
||||
qhandle_t flashModel;
|
||||
|
|
|
@ -437,8 +437,7 @@ static const int numRadioPresets = sizeof(radioPresets) / sizeof(radioPreset_t);
|
|||
static char *netnames[] = {
|
||||
"???",
|
||||
"UDP",
|
||||
"IPX",
|
||||
NULL
|
||||
"UDP6"
|
||||
};
|
||||
|
||||
//Makro - not used anywhere
|
||||
|
@ -449,7 +448,7 @@ static char *netnames[] = {
|
|||
static int gamecodetoui[] = { 4, 2, 3, 0, 5, 1, 6 };
|
||||
static int uitogamecode[] = { 4, 6, 2, 3, 1, 5, 7 };
|
||||
|
||||
static void UI_StartServerRefresh(qboolean full);
|
||||
static void UI_StartServerRefresh(qboolean full, qboolean force);
|
||||
static void UI_StopServerRefresh(void);
|
||||
static void UI_DoServerRefresh(void);
|
||||
static void UI_FeederSelection(float feederID, int index);
|
||||
|
@ -467,6 +466,7 @@ static const char *UI_SelectedHead(int index, int *actual);
|
|||
static int UI_MapCountVote(void);
|
||||
|
||||
static int UI_GetIndexFromSelection(int actual);
|
||||
static void UI_DrawCinematic(int handle, float x, float y, float w, float h);
|
||||
|
||||
int ProcessNewUI(int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6);
|
||||
|
||||
|
@ -2187,8 +2187,7 @@ static void UI_DrawClanCinematic(rectDef_t * rect, float scale, vec4_t color)
|
|||
}
|
||||
if (uiInfo.teamList[i].cinematic >= 0) {
|
||||
trap_CIN_RunCinematic(uiInfo.teamList[i].cinematic);
|
||||
trap_CIN_SetExtents(uiInfo.teamList[i].cinematic, rect->x, rect->y, rect->w, rect->h);
|
||||
trap_CIN_DrawCinematic(uiInfo.teamList[i].cinematic);
|
||||
UI_DrawCinematic(uiInfo.teamList[i].cinematic, rect->x, rect->y, rect->w, rect->h);
|
||||
} else {
|
||||
trap_R_SetColor(color);
|
||||
UI_DrawHandlePic(rect->x, rect->y, rect->w, rect->h, uiInfo.teamList[i].teamIcon_Metal);
|
||||
|
@ -2212,8 +2211,7 @@ static void UI_DrawPreviewCinematic(rectDef_t * rect, float scale, vec4_t color)
|
|||
(CIN_loop | CIN_silent));
|
||||
if (uiInfo.previewMovie >= 0) {
|
||||
trap_CIN_RunCinematic(uiInfo.previewMovie);
|
||||
trap_CIN_SetExtents(uiInfo.previewMovie, rect->x, rect->y, rect->w, rect->h);
|
||||
trap_CIN_DrawCinematic(uiInfo.previewMovie);
|
||||
UI_DrawCinematic(uiInfo.previewMovie, rect->x, rect->y, rect->w, rect->h);
|
||||
} else {
|
||||
uiInfo.previewMovie = -2;
|
||||
}
|
||||
|
@ -2399,8 +2397,7 @@ static void UI_DrawMapCinematic(rectDef_t * rect, float scale, vec4_t color, qbo
|
|||
}
|
||||
if (uiInfo.mapList[map].cinematic >= 0) {
|
||||
trap_CIN_RunCinematic(uiInfo.mapList[map].cinematic);
|
||||
trap_CIN_SetExtents(uiInfo.mapList[map].cinematic, rect->x, rect->y, rect->w, rect->h);
|
||||
trap_CIN_DrawCinematic(uiInfo.mapList[map].cinematic);
|
||||
UI_DrawCinematic(uiInfo.mapList[map].cinematic, rect->x, rect->y, rect->w, rect->h);
|
||||
} else {
|
||||
uiInfo.mapList[map].cinematic = -2;
|
||||
}
|
||||
|
@ -2595,8 +2592,7 @@ static void UI_DrawNetMapCinematic(rectDef_t * rect, float scale, vec4_t color)
|
|||
|
||||
if (uiInfo.serverStatus.currentServerCinematic >= 0) {
|
||||
trap_CIN_RunCinematic(uiInfo.serverStatus.currentServerCinematic);
|
||||
trap_CIN_SetExtents(uiInfo.serverStatus.currentServerCinematic, rect->x, rect->y, rect->w, rect->h);
|
||||
trap_CIN_DrawCinematic(uiInfo.serverStatus.currentServerCinematic);
|
||||
UI_DrawCinematic(uiInfo.serverStatus.currentServerCinematic, rect->x, rect->y, rect->w, rect->h);
|
||||
} else {
|
||||
UI_DrawNetMapPreview(rect, scale, color);
|
||||
}
|
||||
|
@ -3113,20 +3109,14 @@ static void UI_DrawBotName(rectDef_t * rect, float scale, vec4_t color, int text
|
|||
int value = uiInfo.botIndex;
|
||||
|
||||
//int game = trap_Cvar_VariableValue("g_gametype");
|
||||
const char *text = "";
|
||||
const char *text;
|
||||
|
||||
//Makro - using bot list instead of character list
|
||||
/*
|
||||
if (game >= GT_TEAM) {
|
||||
if (value >= uiInfo.characterCount) {
|
||||
value = 0;
|
||||
}
|
||||
text = uiInfo.characterList[value].name;
|
||||
} else {
|
||||
*/
|
||||
if (value >= UI_GetNumBots()) {
|
||||
value = 0;
|
||||
}
|
||||
text = UI_GetBotNameByNumber(value);
|
||||
// }
|
||||
if (rect->hasVectors)
|
||||
|
@ -3159,6 +3149,10 @@ static void UI_DrawCrosshair(rectDef_t * rect, float scale)
|
|||
vec4_t color;
|
||||
float size;
|
||||
|
||||
if (!uiInfo.currentCrosshair) {
|
||||
return;
|
||||
}
|
||||
|
||||
color[0] = trap_Cvar_VariableValue("cg_RQ3_crosshairColorR");
|
||||
color[1] = trap_Cvar_VariableValue("cg_RQ3_crosshairColorG");
|
||||
color[2] = trap_Cvar_VariableValue("cg_RQ3_crosshairColorB");
|
||||
|
@ -3168,32 +3162,25 @@ static void UI_DrawCrosshair(rectDef_t * rect, float scale)
|
|||
|
||||
trap_R_SetColor(color);
|
||||
|
||||
if (uiInfo.currentCrosshair < 0 || uiInfo.currentCrosshair >= NUM_CROSSHAIRS) {
|
||||
uiInfo.currentCrosshair = 0;
|
||||
}
|
||||
//Makro - fixing bug that draws a crosshair even if cg_drawcrosshair is 0
|
||||
if (uiInfo.currentCrosshair != 0)
|
||||
if (rect->hasVectors)
|
||||
{
|
||||
if (rect->hasVectors)
|
||||
{
|
||||
float pt[2];
|
||||
float mx, my;
|
||||
float pt[2];
|
||||
float mx, my;
|
||||
|
||||
pt[0] = rect->x;
|
||||
pt[1] = rect->y;
|
||||
pt[0] = rect->x;
|
||||
pt[1] = rect->y;
|
||||
|
||||
mx = (rect->w - size) * 0.5f;
|
||||
my = (rect->h - size) * 0.5f;
|
||||
mx = (rect->w - size) * 0.5f;
|
||||
my = (rect->h - size) * 0.5f;
|
||||
|
||||
Vector2MA(pt, mx, rect->u, pt);
|
||||
Vector2MA(pt, my, rect->v, pt);
|
||||
Vector2MA(pt, mx, rect->u, pt);
|
||||
Vector2MA(pt, my, rect->v, pt);
|
||||
|
||||
UI_DrawAngledPic(pt[0], pt[1], size, size, rect->u, rect->v, color,
|
||||
0.f, 0.f, 1.f, 1.f, uiInfo.uiDC.Assets.crosshairShader[uiInfo.currentCrosshair]);
|
||||
}
|
||||
else
|
||||
UI_DrawHandlePic(rect->x + (rect->w - size) * 0.5f, rect->y + (rect->h - size) * 0.5f, size, size,
|
||||
uiInfo.uiDC.Assets.crosshairShader[uiInfo.currentCrosshair]);
|
||||
UI_DrawAngledPic(pt[0], pt[1], size, size, rect->u, rect->v, color,
|
||||
0.f, 0.f, 1.f, 1.f, uiInfo.uiDC.Assets.crosshairShader[uiInfo.currentCrosshair]);
|
||||
} else {
|
||||
UI_DrawHandlePic(rect->x + (rect->w - size) * 0.5f, rect->y + (rect->h - size) * 0.5f, size, size,
|
||||
uiInfo.uiDC.Assets.crosshairShader[uiInfo.currentCrosshair]);
|
||||
}
|
||||
trap_R_SetColor(NULL);
|
||||
}
|
||||
|
@ -4474,10 +4461,10 @@ static qboolean UI_Handicap_HandleKey(int flags, float *special, int key)
|
|||
}
|
||||
if (h > 100) {
|
||||
h = 5;
|
||||
} else if (h < 0) {
|
||||
} else if (h < 5) {
|
||||
h = 100;
|
||||
}
|
||||
trap_Cvar_Set("handicap", va("%i", h));
|
||||
trap_Cvar_SetValue("handicap", h);
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
|
@ -4562,18 +4549,18 @@ static qboolean UI_GameType_HandleKey(int flags, float *special, int key, qboole
|
|||
}
|
||||
}
|
||||
|
||||
if (uiInfo.gameTypes[ui_gameType.integer].gtEnum == GT_TOURNAMENT) {
|
||||
trap_Cvar_Set("ui_Q3Model", "1");
|
||||
if (uiInfo.gameTypes[ui_gameType.integer].gtEnum < GT_TEAM) {
|
||||
trap_Cvar_SetValue("ui_Q3Model", 1);
|
||||
} else {
|
||||
trap_Cvar_Set("ui_Q3Model", "0");
|
||||
trap_Cvar_SetValue("ui_Q3Model", 0);
|
||||
}
|
||||
|
||||
trap_Cvar_Set("ui_gameType", va("%d", ui_gameType.integer));
|
||||
trap_Cvar_SetValue("ui_gameType", ui_gameType.integer);
|
||||
UI_SetCapFragLimits(qtrue);
|
||||
UI_LoadBestScores(uiInfo.mapList[ui_currentMap.integer].mapLoadName,
|
||||
uiInfo.gameTypes[ui_gameType.integer].gtEnum);
|
||||
if (resetMap && oldCount != UI_MapCountByGameType(qtrue)) {
|
||||
trap_Cvar_Set("ui_currentMap", "0");
|
||||
trap_Cvar_SetValue("ui_currentMap", 0);
|
||||
Menu_SetFeederSelection(NULL, FEEDER_MAPS, 0, NULL);
|
||||
}
|
||||
return qtrue;
|
||||
|
@ -4599,9 +4586,9 @@ static qboolean UI_NetGameType_HandleKey(int flags, float *special, int key)
|
|||
ui_netGameType.integer = 0;
|
||||
}
|
||||
|
||||
trap_Cvar_Set("ui_netGameType", va("%d", ui_netGameType.integer));
|
||||
trap_Cvar_Set("ui_actualnetGameType", va("%d", uiInfo.gameTypes[ui_netGameType.integer].gtEnum));
|
||||
trap_Cvar_Set("ui_currentNetMap", "0");
|
||||
trap_Cvar_SetValue("ui_netGameType", ui_netGameType.integer);
|
||||
trap_Cvar_SetValue("ui_actualnetGameType", uiInfo.gameTypes[ui_netGameType.integer].gtEnum);
|
||||
trap_Cvar_SetValue("ui_currentNetMap", 0);
|
||||
|
||||
UI_MapCountByGameType(qfalse);
|
||||
Menu_SetFeederSelection(NULL, FEEDER_ALLMAPS, 0, NULL);
|
||||
|
@ -4628,7 +4615,7 @@ static qboolean UI_JoinGameType_HandleKey(int flags, float *special, int key)
|
|||
ui_joinGameType.integer = 0;
|
||||
}
|
||||
|
||||
trap_Cvar_Set("ui_joinGameType", va("%d", ui_joinGameType.integer));
|
||||
trap_Cvar_SetValue("ui_joinGameType", ui_joinGameType.integer);
|
||||
UI_BuildServerDisplayList(qtrue);
|
||||
return qtrue;
|
||||
}
|
||||
|
@ -4664,7 +4651,7 @@ static qboolean UI_Skill_HandleKey(int flags, float *special, int key)
|
|||
i = 1;
|
||||
}
|
||||
|
||||
trap_Cvar_Set("g_spSkill", va("%i", i));
|
||||
trap_Cvar_SetValue("g_spSkill", i);
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
|
@ -4744,7 +4731,7 @@ static qboolean UI_TeamMember_HandleKey(int flags, float *special, int key, qboo
|
|||
}
|
||||
// }
|
||||
|
||||
trap_Cvar_Set(cvar, va("%i", value));
|
||||
trap_Cvar_SetValue(cvar, value);
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
|
@ -4773,10 +4760,8 @@ static qboolean UI_NetSource_HandleKey(int flags, float *special, int key)
|
|||
}
|
||||
|
||||
UI_BuildServerDisplayList(qtrue);
|
||||
if (ui_netSource.integer != AS_GLOBAL) {
|
||||
UI_StartServerRefresh(qtrue);
|
||||
}
|
||||
trap_Cvar_Set("ui_netSource", va("%d", ui_netSource.integer));
|
||||
UI_StartServerRefresh(qtrue, qfalse);
|
||||
trap_Cvar_SetValue("ui_netSource", ui_netSource.integer);
|
||||
return qtrue;
|
||||
}
|
||||
return qfalse;
|
||||
|
@ -4918,7 +4903,7 @@ static qboolean UI_Crosshair_HandleKey(int flags, float *special, int key)
|
|||
uiInfo.currentCrosshair = NUM_CROSSHAIRS - 1;
|
||||
}
|
||||
|
||||
trap_Cvar_Set("cg_drawCrosshair", va("%d", uiInfo.currentCrosshair));
|
||||
trap_Cvar_SetValue("cg_drawCrosshair", uiInfo.currentCrosshair);
|
||||
|
||||
return qtrue;
|
||||
}
|
||||
|
@ -4943,7 +4928,7 @@ static qboolean UI_SSG_Crosshair_HandleKey(int flags, float *special, int key)
|
|||
else if (current >= NUM_SSGCROSSHAIRS)
|
||||
current = 0;
|
||||
|
||||
trap_Cvar_SetValue("cg_RQ3_ssgCrosshair", (float) current);
|
||||
trap_Cvar_SetValue("cg_RQ3_ssgCrosshair", current);
|
||||
|
||||
uiInfo.uiDC.Assets.SSGcrosshairShader = trap_R_RegisterShaderNoMip(va("gfx/rq3_hud/ssg2x-%i", current));
|
||||
|
||||
|
@ -4982,7 +4967,7 @@ static qboolean UI_SelectedPlayer_HandleKey(int flags, float *special, int key)
|
|||
} else {
|
||||
trap_Cvar_Set("cg_selectedPlayerName", uiInfo.teamNames[selected]);
|
||||
}
|
||||
trap_Cvar_Set("cg_selectedPlayer", va("%d", selected));
|
||||
trap_Cvar_SetValue( "cg_selectedPlayer", selected);
|
||||
}
|
||||
return qfalse;
|
||||
}
|
||||
|
@ -5257,6 +5242,9 @@ void UI_ServersSort(int column, qboolean force)
|
|||
uiInfo.serverStatus.sortKey = column;
|
||||
qsort(&uiInfo.serverStatus.displayServers[0], uiInfo.serverStatus.numDisplayServers, sizeof(int),
|
||||
UI_ServersQsortCompare);
|
||||
|
||||
// update displayed levelshot
|
||||
UI_FeederSelection(FEEDER_SERVERS, uiInfo.serverStatus.currentServer);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -5606,7 +5594,11 @@ static void UI_StartSkirmish(qboolean next)
|
|||
}
|
||||
}
|
||||
if (g >= GT_TEAM) {
|
||||
// send team command for vanilla q3 game qvm
|
||||
trap_Cmd_ExecuteText(EXEC_APPEND, "wait 5; team Red\n");
|
||||
|
||||
// set g_localTeamPref for ioq3 game qvm
|
||||
trap_Cvar_Set("g_localTeamPref", "Red");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5635,14 +5627,14 @@ static void UI_Update(const char *name)
|
|||
switch (val) {
|
||||
case 0:
|
||||
trap_Cvar_SetValue("r_depthbits", 0);
|
||||
trap_Cvar_SetValue("r_stencilbits", 8);
|
||||
trap_Cvar_Reset("r_stencilbits");
|
||||
break;
|
||||
case 16:
|
||||
trap_Cvar_SetValue("r_depthbits", 0);
|
||||
trap_Cvar_SetValue("r_depthbits", 16);
|
||||
trap_Cvar_SetValue("r_stencilbits", 0);
|
||||
break;
|
||||
case 32:
|
||||
trap_Cvar_SetValue("r_depthbits", 0);
|
||||
trap_Cvar_SetValue("r_depthbits", 24);
|
||||
trap_Cvar_SetValue("r_stencilbits", 8);
|
||||
break;
|
||||
}
|
||||
|
@ -6195,7 +6187,9 @@ static void UI_RunMenuScript(char **args)
|
|||
trap_Cmd_ExecuteText(EXEC_APPEND, "cvar_restart\n");
|
||||
trap_Cmd_ExecuteText(EXEC_APPEND, "exec default.cfg\n");
|
||||
//Controls_SetDefaults();
|
||||
#ifdef CINEMATICS_INTRO
|
||||
trap_Cvar_Set("com_introPlayed", "1");
|
||||
#endif
|
||||
trap_Cmd_ExecuteText(EXEC_APPEND, "vid_restart\n");
|
||||
} else if (Q_stricmp(name, "getCDKey") == 0) {
|
||||
char out[17];
|
||||
|
@ -6338,13 +6332,13 @@ static void UI_RunMenuScript(char **args)
|
|||
trap_Cvar_Set("ui_actualnetGameType",
|
||||
va("%d", uiInfo.gameTypes[ui_netGameType.integer].gtEnum));
|
||||
trap_Cvar_Set("ui_currentNetMap", "0");
|
||||
UI_LoadArenas();
|
||||
UI_LoadArenasIntoMapList();
|
||||
UI_MapCountByGameType(qfalse);
|
||||
Menu_SetFeederSelection(NULL, FEEDER_ALLMAPS, 0, "createserver");
|
||||
//Makro - new UI script that doesn't check the gametype
|
||||
} else if (Q_stricmp(name, "loadVoteArenas") == 0) {
|
||||
trap_Cvar_Set("ui_currentNetMap", "0");
|
||||
UI_LoadArenas();
|
||||
UI_LoadArenasIntoMapList();
|
||||
UI_MapCountVote();
|
||||
Menu_SetFeederSelection(NULL, FEEDER_ALLMAPS, 0, "ingame_callvote");
|
||||
//Makro - get the team names
|
||||
|
@ -6382,10 +6376,10 @@ static void UI_RunMenuScript(char **args)
|
|||
} else if (Q_stricmp(name, "resetScores") == 0) {
|
||||
UI_ClearScores();
|
||||
} else if (Q_stricmp(name, "RefreshServers") == 0) {
|
||||
UI_StartServerRefresh(qtrue);
|
||||
UI_StartServerRefresh(qtrue, qtrue);
|
||||
UI_BuildServerDisplayList(qtrue);
|
||||
} else if (Q_stricmp(name, "RefreshFilter") == 0) {
|
||||
UI_StartServerRefresh(qfalse);
|
||||
UI_StartServerRefresh(qfalse, qtrue);
|
||||
UI_BuildServerDisplayList(qtrue);
|
||||
} else if (Q_stricmp(name, "RunSPDemo") == 0) {
|
||||
if (uiInfo.demoAvailable) {
|
||||
|
@ -6453,9 +6447,8 @@ static void UI_RunMenuScript(char **args)
|
|||
uiInfo.nextServerStatusRefresh = 0;
|
||||
uiInfo.nextFindPlayerRefresh = 0;
|
||||
} else if (Q_stricmp(name, "UpdateFilter") == 0) {
|
||||
if (ui_netSource.integer == AS_LOCAL) {
|
||||
UI_StartServerRefresh(qtrue);
|
||||
}
|
||||
// UpdateFilter is called when server broser menu is opened and when a favorite server is deleted.
|
||||
UI_StartServerRefresh(qtrue, qfalse);
|
||||
UI_BuildServerDisplayList(qtrue);
|
||||
UI_FeederSelection(FEEDER_SERVERS, 0);
|
||||
} else if (Q_stricmp(name, "ServerStatus") == 0) {
|
||||
|
@ -6616,7 +6609,7 @@ static void UI_RunMenuScript(char **args)
|
|||
} else if (Q_stricmp(name, "addFavorite") == 0) {
|
||||
if (ui_netSource.integer != AS_FAVORITES) {
|
||||
char name[MAX_NAME_LENGTH];
|
||||
char addr[MAX_NAME_LENGTH];
|
||||
char addr[MAX_ADDRESSLENGTH];
|
||||
int res;
|
||||
|
||||
trap_LAN_GetServerInfo(ui_netSource.integer,
|
||||
|
@ -6624,8 +6617,8 @@ static void UI_RunMenuScript(char **args)
|
|||
currentServer], buff,
|
||||
MAX_STRING_CHARS);
|
||||
name[0] = addr[0] = '\0';
|
||||
Q_strncpyz(name, Info_ValueForKey(buff, "hostname"), MAX_NAME_LENGTH);
|
||||
Q_strncpyz(addr, Info_ValueForKey(buff, "addr"), MAX_NAME_LENGTH);
|
||||
Q_strncpyz(name, Info_ValueForKey(buff, "hostname"), sizeof(name));
|
||||
Q_strncpyz(addr, Info_ValueForKey(buff, "addr"), sizeof(addr));
|
||||
if (strlen(name) > 0 && strlen(addr) > 0) {
|
||||
res = trap_LAN_AddServer(AS_FAVORITES, name, addr);
|
||||
if (res == 0) {
|
||||
|
@ -6642,39 +6635,37 @@ static void UI_RunMenuScript(char **args)
|
|||
}
|
||||
} else if (Q_stricmp(name, "deleteFavorite") == 0) {
|
||||
if (ui_netSource.integer == AS_FAVORITES) {
|
||||
char addr[MAX_NAME_LENGTH];
|
||||
char addr[MAX_ADDRESSLENGTH];
|
||||
|
||||
trap_LAN_GetServerInfo(ui_netSource.integer,
|
||||
uiInfo.serverStatus.displayServers[uiInfo.serverStatus.
|
||||
currentServer], buff,
|
||||
MAX_STRING_CHARS);
|
||||
addr[0] = '\0';
|
||||
Q_strncpyz(addr, Info_ValueForKey(buff, "addr"), MAX_NAME_LENGTH);
|
||||
Q_strncpyz(addr, Info_ValueForKey(buff, "addr"), sizeof(addr));
|
||||
if (strlen(addr) > 0) {
|
||||
trap_LAN_RemoveServer(AS_FAVORITES, addr);
|
||||
}
|
||||
}
|
||||
} else if (Q_stricmp(name, "createFavorite") == 0) {
|
||||
if (ui_netSource.integer == AS_FAVORITES) {
|
||||
char name[MAX_NAME_LENGTH];
|
||||
char addr[MAX_NAME_LENGTH];
|
||||
int res;
|
||||
char name[MAX_NAME_LENGTH];
|
||||
char addr[MAX_ADDRESSLENGTH];
|
||||
int res;
|
||||
|
||||
name[0] = addr[0] = '\0';
|
||||
Q_strncpyz(name, UI_Cvar_VariableString("ui_favoriteName"), MAX_NAME_LENGTH);
|
||||
Q_strncpyz(addr, UI_Cvar_VariableString("ui_favoriteAddress"), MAX_NAME_LENGTH);
|
||||
if (strlen(name) > 0 && strlen(addr) > 0) {
|
||||
res = trap_LAN_AddServer(AS_FAVORITES, name, addr);
|
||||
if (res == 0) {
|
||||
// server already in the list
|
||||
Com_Printf("Favorite already in list\n");
|
||||
} else if (res == -1) {
|
||||
// list full
|
||||
Com_Printf("Favorite list full\n");
|
||||
} else {
|
||||
// successfully added
|
||||
Com_Printf("Added favorite server %s\n", addr);
|
||||
}
|
||||
name[0] = addr[0] = '\0';
|
||||
Q_strncpyz(name, UI_Cvar_VariableString("ui_favoriteName"), sizeof(name));
|
||||
Q_strncpyz(addr, UI_Cvar_VariableString("ui_favoriteAddress"), sizeof(addr));
|
||||
if (strlen(name) > 0 && strlen(addr) > 0) {
|
||||
res = trap_LAN_AddServer(AS_FAVORITES, name, addr);
|
||||
if (res == 0) {
|
||||
// server already in the list
|
||||
Com_Printf("Favorite already in list\n");
|
||||
} else if (res == -1) {
|
||||
// list full
|
||||
Com_Printf("Favorite list full\n");
|
||||
} else {
|
||||
// successfully added
|
||||
Com_Printf("Added favorite server %s\n", addr);
|
||||
}
|
||||
}
|
||||
} else if (Q_stricmp(name, "orders") == 0) {
|
||||
|
@ -6966,6 +6957,11 @@ static void UI_InsertServerIntoDisplayList(int num, int position)
|
|||
uiInfo.serverStatus.displayServers[i] = uiInfo.serverStatus.displayServers[i - 1];
|
||||
}
|
||||
uiInfo.serverStatus.displayServers[position] = num;
|
||||
|
||||
// update displayed levelshot
|
||||
if ( position == uiInfo.serverStatus.currentServer ) {
|
||||
UI_FeederSelection( FEEDER_SERVERS, uiInfo.serverStatus.currentServer );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -7093,15 +7089,22 @@ static void UI_BuildServerDisplayList(qboolean force)
|
|||
// get the ping for this server
|
||||
ping = trap_LAN_GetServerPing(ui_netSource.integer, i);
|
||||
if (ping > 0 || ui_netSource.integer == AS_FAVORITES) {
|
||||
// Remove favorite servers so they do not appear multiple times
|
||||
// or appear when the cached server info was not filtered out
|
||||
// but the new server info is filtered out.
|
||||
if (ui_netSource.integer == AS_FAVORITES) {
|
||||
UI_RemoveServerFromDisplayList(i);
|
||||
}
|
||||
|
||||
trap_LAN_GetServerInfo(ui_netSource.integer, i, info, MAX_STRING_CHARS);
|
||||
|
||||
clients = atoi(Info_ValueForKey(info, "clients"));
|
||||
uiInfo.serverStatus.numPlayersOnServers += clients;
|
||||
|
||||
if (ui_browserShowEmpty.integer == 0) {
|
||||
if (clients == 0) {
|
||||
trap_LAN_MarkServerVisible(ui_netSource.integer, i, qfalse);
|
||||
if (ping > 0) {
|
||||
trap_LAN_MarkServerVisible(ui_netSource.integer, i, qfalse);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -7109,7 +7112,9 @@ static void UI_BuildServerDisplayList(qboolean force)
|
|||
if (ui_browserShowFull.integer == 0) {
|
||||
maxClients = atoi(Info_ValueForKey(info, "sv_maxclients"));
|
||||
if (clients == maxClients) {
|
||||
trap_LAN_MarkServerVisible(ui_netSource.integer, i, qfalse);
|
||||
if (ping > 0) {
|
||||
trap_LAN_MarkServerVisible(ui_netSource.integer, i, qfalse);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -7119,7 +7124,9 @@ static void UI_BuildServerDisplayList(qboolean force)
|
|||
if (uiInfo.joinGameTypes[ui_joinGameType.integer].gtEnum != -1) {
|
||||
game = atoi(Info_ValueForKey(info, "gametype"));
|
||||
if (game != uiInfo.joinGameTypes[ui_joinGameType.integer].gtEnum) {
|
||||
trap_LAN_MarkServerVisible(ui_netSource.integer, i, qfalse);
|
||||
if (ping > 0) {
|
||||
trap_LAN_MarkServerVisible(ui_netSource.integer, i, qfalse);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -7135,15 +7142,12 @@ static void UI_BuildServerDisplayList(qboolean force)
|
|||
continue;
|
||||
}
|
||||
} */
|
||||
// make sure we never add a favorite server twice
|
||||
if (ui_netSource.integer == AS_FAVORITES) {
|
||||
UI_RemoveServerFromDisplayList(i);
|
||||
}
|
||||
// insert the server into the list
|
||||
UI_BinaryServerInsertion(i);
|
||||
// done with this server
|
||||
if (ping > 0) {
|
||||
trap_LAN_MarkServerVisible(ui_netSource.integer, i, qfalse);
|
||||
uiInfo.serverStatus.numPlayersOnServers += clients;
|
||||
numinvisible++;
|
||||
}
|
||||
}
|
||||
|
@ -7222,11 +7226,21 @@ static int UI_GetServerStatusInfo(const char *serverAddress, serverStatusInfo_t
|
|||
char *p, *score, *ping, *name;
|
||||
int i, len;
|
||||
|
||||
if (info) {
|
||||
memset(info, 0, sizeof(*info));
|
||||
}
|
||||
|
||||
// ignore initial unset addresses
|
||||
if (serverAddress && *serverAddress == '\0') {
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
// reset server status request for this address
|
||||
if (!info) {
|
||||
trap_LAN_ServerStatus(serverAddress, NULL, 0);
|
||||
return qfalse;
|
||||
}
|
||||
memset(info, 0, sizeof(*info));
|
||||
|
||||
if (trap_LAN_ServerStatus(serverAddress, info->text, sizeof(info->text))) {
|
||||
Q_strncpyz(info->address, serverAddress, sizeof(info->address));
|
||||
p = info->text;
|
||||
|
@ -7469,11 +7483,11 @@ static void UI_BuildFindPlayerList(qboolean force)
|
|||
} else {
|
||||
// add a line that shows the number of servers found
|
||||
if (!uiInfo.numFoundPlayerServers) {
|
||||
Com_sprintf(uiInfo.foundPlayerServerNames[uiInfo.numFoundPlayerServers - 1],
|
||||
sizeof(uiInfo.foundPlayerServerAddresses[0]), "no servers found");
|
||||
Com_sprintf(uiInfo.foundPlayerServerNames[0],
|
||||
sizeof(uiInfo.foundPlayerServerNames[0]), "no servers found");
|
||||
} else {
|
||||
Com_sprintf(uiInfo.foundPlayerServerNames[uiInfo.numFoundPlayerServers - 1],
|
||||
sizeof(uiInfo.foundPlayerServerAddresses[0]), "%d server%s found with player %s",
|
||||
sizeof(uiInfo.foundPlayerServerNames[0]), "%d server%s found with player %s",
|
||||
uiInfo.numFoundPlayerServers - 1, uiInfo.numFoundPlayerServers == 2 ? "" : "s",
|
||||
uiInfo.findPlayerName);
|
||||
}
|
||||
|
@ -7693,9 +7707,15 @@ static const char *UI_FeederItemText(float feederID, int index, int column, qhan
|
|||
return Info_ValueForKey(info, "addr");
|
||||
} else {
|
||||
if (ui_netSource.integer == AS_LOCAL) {
|
||||
int nettype = atoi(Info_ValueForKey(info, "nettype"));
|
||||
|
||||
if (nettype < 0 || nettype >= ARRAY_LEN(netnames)) {
|
||||
nettype = 0;
|
||||
}
|
||||
|
||||
Com_sprintf(hostname, sizeof(hostname), "%s [%s]",
|
||||
Info_ValueForKey(info, "hostname"),
|
||||
netnames[atoi(Info_ValueForKey(info, "nettype"))]);
|
||||
netnames[nettype]);
|
||||
return hostname;
|
||||
} else {
|
||||
Com_sprintf(hostname, sizeof(hostname), "%s",
|
||||
|
@ -7963,7 +7983,7 @@ static qboolean Team_Parse(char **p)
|
|||
return qtrue;
|
||||
}
|
||||
|
||||
if (!token || token[0] == 0) {
|
||||
if (!token[0]) {
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
|
@ -8028,7 +8048,7 @@ static qboolean Character_Parse(char **p)
|
|||
return qtrue;
|
||||
}
|
||||
|
||||
if (!token || token[0] == 0) {
|
||||
if (!token[0]) {
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
|
@ -8090,7 +8110,7 @@ static qboolean Alias_Parse(char **p)
|
|||
return qtrue;
|
||||
}
|
||||
|
||||
if (!token || token[0] == 0) {
|
||||
if (!token[0]) {
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
|
@ -8143,7 +8163,7 @@ static void UI_ParseTeamInfo(const char *teamFile)
|
|||
|
||||
INFINITE_LOOP {
|
||||
token = COM_ParseExt(&p, qtrue);
|
||||
if (!token || token[0] == 0 || token[0] == '}') {
|
||||
if (!token[0] || token[0] == '}') {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -8204,7 +8224,7 @@ joingametypes {
|
|||
return qtrue;
|
||||
}
|
||||
|
||||
if (!token || token[0] == 0) {
|
||||
if (!token[0]) {
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
|
@ -8268,7 +8288,7 @@ static qboolean MapList_Parse(char **p)
|
|||
return qtrue;
|
||||
}
|
||||
|
||||
if (!token || token[0] == 0) {
|
||||
if (!token[0]) {
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
|
@ -8336,7 +8356,7 @@ static void UI_ParseGameInfo(const char *teamFile)
|
|||
|
||||
INFINITE_LOOP {
|
||||
token = COM_ParseExt(&p, qtrue);
|
||||
if (!token || token[0] == 0 || token[0] == '}') {
|
||||
if (!token[0] || token[0] == '}') {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -8430,6 +8450,15 @@ static void UI_StopCinematic(int handle)
|
|||
|
||||
static void UI_DrawCinematic(int handle, float x, float y, float w, float h)
|
||||
{
|
||||
// adjust coords to get correct placement in wide screen
|
||||
UI_AdjustFrom640( &x, &y, &w, &h );
|
||||
|
||||
// CIN_SetExtents takes stretched 640x480 virtualized coords
|
||||
x *= SCREEN_WIDTH / (float)uiInfo.uiDC.glconfig.vidWidth;
|
||||
w *= SCREEN_WIDTH / (float)uiInfo.uiDC.glconfig.vidWidth;
|
||||
y *= SCREEN_HEIGHT / (float)uiInfo.uiDC.glconfig.vidHeight;
|
||||
h *= SCREEN_HEIGHT / (float)uiInfo.uiDC.glconfig.vidHeight;
|
||||
|
||||
trap_CIN_SetExtents(handle, x, y, w, h);
|
||||
trap_CIN_DrawCinematic(handle);
|
||||
}
|
||||
|
@ -8799,6 +8828,7 @@ void _UI_Init(qboolean inGameLoad)
|
|||
UI_ParseTeamInfo("teaminfo.txt");
|
||||
UI_LoadTeams();
|
||||
UI_ParseGameInfo("gameinfo.txt");
|
||||
UI_LoadArenas();
|
||||
#endif
|
||||
|
||||
menuSet = UI_Cvar_VariableString("ui_menuFiles");
|
||||
|
@ -8826,8 +8856,10 @@ void _UI_Init(qboolean inGameLoad)
|
|||
|
||||
// sets defaults for ui temp cvars
|
||||
uiInfo.effectsColor = gamecodetoui[(int) trap_Cvar_VariableValue("color1") - 1];
|
||||
uiInfo.currentCrosshair = (int) trap_Cvar_VariableValue("cg_drawCrosshair");
|
||||
|
||||
uiInfo.currentCrosshair = (int)trap_Cvar_VariableValue("cg_drawCrosshair") % NUM_CROSSHAIRS;
|
||||
if (uiInfo.currentCrosshair < 0) {
|
||||
uiInfo.currentCrosshair = 0;
|
||||
}
|
||||
trap_Cvar_Set("ui_mousePitch", (trap_Cvar_VariableValue("m_pitch") >= 0) ? "0" : "1");
|
||||
|
||||
//Makro - save the music volume
|
||||
|
@ -8968,7 +9000,7 @@ void _UI_SetActiveMenu(uiMenuCommand_t menu)
|
|||
char buf[256];
|
||||
|
||||
// this should be the ONLY way the menu system is brought up
|
||||
// enusure minumum menu data is cached
|
||||
// ensure minimum menu data is cached
|
||||
if (Menu_Count() > 0) {
|
||||
vec3_t v;
|
||||
|
||||
|
@ -9696,6 +9728,9 @@ static cvarTable_t cvarTable[] = {
|
|||
{&ui_realWarmUp, "g_warmup", "20", CVAR_ARCHIVE},
|
||||
{&ui_realCaptureLimit, "capturelimit", "8", CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_NORESTART},
|
||||
{&ui_serverStatusTimeOut, "ui_serverStatusTimeOut", "7000", CVAR_ARCHIVE},
|
||||
|
||||
{ NULL, "g_localTeamPref", "", 0 },
|
||||
|
||||
//Makro - tablet support in the UI
|
||||
{&ui_RQ3_tabletMode, "ui_RQ3_tabletMode", "0", CVAR_ARCHIVE},
|
||||
//Makro - cvar for player model display
|
||||
|
@ -9804,6 +9839,10 @@ void UI_UpdateCvars(void)
|
|||
cvarTable_t *cv;
|
||||
|
||||
for (i = 0, cv = cvarTable; i < cvarTableSize; i++, cv++) {
|
||||
if (!cv->vmCvar) {
|
||||
continue;
|
||||
}
|
||||
|
||||
trap_Cvar_Update(cv->vmCvar);
|
||||
}
|
||||
}
|
||||
|
@ -9890,6 +9929,10 @@ static void UI_DoServerRefresh(void)
|
|||
UI_BuildServerDisplayList(2);
|
||||
// stop the refresh
|
||||
UI_StopServerRefresh();
|
||||
} else if ( ui_netSource.integer == AS_LOCAL ) {
|
||||
// no local servers found, check again
|
||||
trap_Cmd_ExecuteText( EXEC_NOW, "localservers\n" );
|
||||
uiInfo.serverStatus.refreshtime = uiInfo.uiDC.realTime + 5000;
|
||||
}
|
||||
//
|
||||
UI_BuildServerDisplayList(qfalse);
|
||||
|
@ -9900,13 +9943,22 @@ static void UI_DoServerRefresh(void)
|
|||
UI_StartServerRefresh
|
||||
=================
|
||||
*/
|
||||
static void UI_StartServerRefresh(qboolean full)
|
||||
static void UI_StartServerRefresh(qboolean full, qboolean force)
|
||||
{
|
||||
int i;
|
||||
char *ptr;
|
||||
|
||||
qtime_t q;
|
||||
|
||||
// This function is called with force=qfalse when server browser menu opens or net source changes.
|
||||
// Automatically update local and favorite servers.
|
||||
// Only auto update master server list if there is no server info cache.
|
||||
if ( !force && ui_netSource.integer == AS_GLOBAL ) {
|
||||
if ( trap_LAN_GetServerCount( AS_GLOBAL ) > 0 ) {
|
||||
return; // have cached list
|
||||
}
|
||||
}
|
||||
|
||||
trap_RealTime(&q);
|
||||
//Makro - added leading zero's
|
||||
//trap_Cvar_Set( va("ui_lastServerRefresh_%i", ui_netSource.integer), va("%s-%i, %i at %i:%i", MonthAbbrev[q.tm_mon],q.tm_mday, 1900+q.tm_year,q.tm_hour,q.tm_min));
|
||||
|
@ -9931,7 +9983,7 @@ static void UI_StartServerRefresh(qboolean full)
|
|||
//
|
||||
if (ui_netSource.integer == AS_LOCAL) {
|
||||
trap_Cmd_ExecuteText(EXEC_NOW, "localservers\n");
|
||||
uiInfo.serverStatus.refreshtime = uiInfo.uiDC.realTime + 1000;
|
||||
uiInfo.serverStatus.refreshtime = uiInfo.uiDC.realTime + 5000;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -380,7 +380,7 @@ UI_RunLerpFrame
|
|||
*/
|
||||
static void UI_RunLerpFrame(playerInfo_t * ci, lerpFrame_t * lf, int newAnimation)
|
||||
{
|
||||
int f;
|
||||
int f, numFrames;
|
||||
animation_t *anim;
|
||||
|
||||
// see if the animation sequence is switching
|
||||
|
@ -395,25 +395,40 @@ static void UI_RunLerpFrame(playerInfo_t * ci, lerpFrame_t * lf, int newAnimatio
|
|||
|
||||
// get the next frame based on the animation
|
||||
anim = lf->animation;
|
||||
if (!anim->frameLerp) {
|
||||
return; // shouldn't happen
|
||||
}
|
||||
if (dp_realtime < lf->animationTime) {
|
||||
lf->frameTime = lf->animationTime; // initial lerp
|
||||
} else {
|
||||
lf->frameTime = lf->oldFrameTime + anim->frameLerp;
|
||||
}
|
||||
f = (lf->frameTime - lf->animationTime) / anim->frameLerp;
|
||||
if (f >= anim->numFrames) {
|
||||
f -= anim->numFrames;
|
||||
|
||||
numFrames = anim->numFrames;
|
||||
if (anim->flipflop) {
|
||||
numFrames *= 2;
|
||||
}
|
||||
|
||||
if (f >= numFrames) {
|
||||
f -= numFrames;
|
||||
if (anim->loopFrames) {
|
||||
f %= anim->loopFrames;
|
||||
f += anim->numFrames - anim->loopFrames;
|
||||
} else {
|
||||
f = anim->numFrames - 1;
|
||||
f = numFrames - 1;
|
||||
// the animation is stuck at the end, so it
|
||||
// can immediately transition to another sequence
|
||||
lf->frameTime = dp_realtime;
|
||||
}
|
||||
}
|
||||
lf->frame = anim->firstFrame + f;
|
||||
if (anim->reversed) {
|
||||
lf->frame = anim->firstFrame + anim->numFrames - 1 - f;
|
||||
} else if (anim->flipflop && f >= anim->numFrames) {
|
||||
lf->frame = anim->firstFrame + anim->numFrames - 1 - (f % anim->numFrames);
|
||||
} else {
|
||||
lf->frame = anim->firstFrame + f;
|
||||
}
|
||||
if (dp_realtime > lf->frameTime) {
|
||||
lf->frameTime = dp_realtime;
|
||||
}
|
||||
|
@ -626,6 +641,16 @@ static void UI_PlayerAngles(playerInfo_t * pi, vec3_t legs[3], vec3_t torso[3],
|
|||
UI_SwingAngles(dest, 15, 30, 0.1f, &pi->torso.pitchAngle, &pi->torso.pitching);
|
||||
torsoAngles[PITCH] = pi->torso.pitchAngle;
|
||||
|
||||
if ( pi->fixedtorso ) {
|
||||
torsoAngles[PITCH] = 0.0f;
|
||||
}
|
||||
|
||||
if ( pi->fixedlegs ) {
|
||||
legsAngles[YAW] = torsoAngles[YAW];
|
||||
legsAngles[PITCH] = 0.0f;
|
||||
legsAngles[ROLL] = 0.0f;
|
||||
}
|
||||
|
||||
// pull the angles back out of the hierarchial chain
|
||||
AnglesSubtract(headAngles, torsoAngles, headAngles);
|
||||
AnglesSubtract(torsoAngles, legsAngles, torsoAngles);
|
||||
|
@ -1040,7 +1065,7 @@ static qboolean UI_RegisterClientSkin(playerInfo_t * pi, const char *modelName,
|
|||
UI_ParseAnimationFile
|
||||
======================
|
||||
*/
|
||||
static qboolean UI_ParseAnimationFile(const char *filename, animation_t * animations)
|
||||
static qboolean UI_ParseAnimationFile(const char *filename, playerInfo_t *pi)
|
||||
{
|
||||
char *text_p, *prev;
|
||||
int len;
|
||||
|
@ -1050,9 +1075,15 @@ static qboolean UI_ParseAnimationFile(const char *filename, animation_t * animat
|
|||
int skip;
|
||||
char text[20000];
|
||||
fileHandle_t f;
|
||||
animation_t *animations;
|
||||
|
||||
animations = pi->animations;
|
||||
|
||||
memset(animations, 0, sizeof(animation_t) * MAX_ANIMATIONS);
|
||||
|
||||
pi->fixedlegs = qfalse;
|
||||
pi->fixedtorso = qfalse;
|
||||
|
||||
// load the file
|
||||
len = trap_FS_FOpenFile(filename, &f, FS_READ);
|
||||
if (len <= 0) {
|
||||
|
@ -1060,6 +1091,7 @@ static qboolean UI_ParseAnimationFile(const char *filename, animation_t * animat
|
|||
}
|
||||
if (len >= (sizeof(text) - 1)) {
|
||||
Com_Printf("File %s too long\n", filename);
|
||||
trap_FS_FCloseFile(f);
|
||||
return qfalse;
|
||||
}
|
||||
trap_FS_Read(text, len, f);
|
||||
|
@ -1076,30 +1108,37 @@ static qboolean UI_ParseAnimationFile(const char *filename, animation_t * animat
|
|||
while (1) {
|
||||
prev = text_p; // so we can unget
|
||||
token = COM_Parse(&text_p);
|
||||
if (!token) {
|
||||
if (!token[0]) {
|
||||
break;
|
||||
}
|
||||
if (!Q_stricmp(token, "footsteps")) {
|
||||
token = COM_Parse(&text_p);
|
||||
if (!token) {
|
||||
if (!token[0]) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
} else if (!Q_stricmp(token, "headoffset")) {
|
||||
for (i = 0; i < 3; i++) {
|
||||
token = COM_Parse(&text_p);
|
||||
if (!token) {
|
||||
if (!token[0]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
} else if (!Q_stricmp(token, "sex")) {
|
||||
token = COM_Parse(&text_p);
|
||||
if (!token) {
|
||||
if (!token[0]) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
} else if (!Q_stricmp(token, "fixedlegs")) {
|
||||
pi->fixedlegs = qtrue;
|
||||
continue;
|
||||
} else if (!Q_stricmp(token, "fixedtorso")) {
|
||||
pi->fixedtorso = qtrue;
|
||||
continue;
|
||||
}
|
||||
|
||||
// if it is a number, start parsing animations
|
||||
if (token[0] >= '0' && token[0] <= '9') {
|
||||
text_p = prev; // unget the token
|
||||
|
@ -1113,7 +1152,17 @@ static qboolean UI_ParseAnimationFile(const char *filename, animation_t * animat
|
|||
for (i = 0; i < MAX_ANIMATIONS; i++) {
|
||||
|
||||
token = COM_Parse(&text_p);
|
||||
if (!token) {
|
||||
if (!token[0]) {
|
||||
if (i >= TORSO_GETFLAG && i <= TORSO_NEGATIVE) {
|
||||
animations[i].firstFrame = animations[TORSO_GESTURE].firstFrame;
|
||||
animations[i].frameLerp = animations[TORSO_GESTURE].frameLerp;
|
||||
animations[i].initialLerp = animations[TORSO_GESTURE].initialLerp;
|
||||
animations[i].loopFrames = animations[TORSO_GESTURE].loopFrames;
|
||||
animations[i].numFrames = animations[TORSO_GESTURE].numFrames;
|
||||
animations[i].reversed = qfalse;
|
||||
animations[i].flipflop = qfalse;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
animations[i].firstFrame = atoi(token);
|
||||
|
@ -1121,24 +1170,32 @@ static qboolean UI_ParseAnimationFile(const char *filename, animation_t * animat
|
|||
if (i == LEGS_WALKCR) {
|
||||
skip = animations[LEGS_WALKCR].firstFrame - animations[TORSO_GESTURE].firstFrame;
|
||||
}
|
||||
if (i >= LEGS_WALKCR) {
|
||||
if (i >= LEGS_WALKCR && i<TORSO_GETFLAG) {
|
||||
animations[i].firstFrame -= skip;
|
||||
}
|
||||
|
||||
token = COM_Parse(&text_p);
|
||||
if (!token) {
|
||||
if (!token[0]) {
|
||||
break;
|
||||
}
|
||||
animations[i].numFrames = atoi(token);
|
||||
|
||||
animations[i].reversed = qfalse;
|
||||
animations[i].flipflop = qfalse;
|
||||
// if numFrames is negative the animation is reversed
|
||||
if (animations[i].numFrames < 0) {
|
||||
animations[i].numFrames = -animations[i].numFrames;
|
||||
animations[i].reversed = qtrue;
|
||||
}
|
||||
|
||||
token = COM_Parse(&text_p);
|
||||
if (!token) {
|
||||
if (!token[0]) {
|
||||
break;
|
||||
}
|
||||
animations[i].loopFrames = atoi(token);
|
||||
|
||||
token = COM_Parse(&text_p);
|
||||
if (!token) {
|
||||
if (!token[0]) {
|
||||
break;
|
||||
}
|
||||
fps = atof(token);
|
||||
|
@ -1150,7 +1207,7 @@ static qboolean UI_ParseAnimationFile(const char *filename, animation_t * animat
|
|||
}
|
||||
|
||||
if (i != MAX_ANIMATIONS) {
|
||||
Com_Printf("Error parsing animation file: %s", filename);
|
||||
Com_Printf("Error parsing animation file: %s\n", filename);
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
|
@ -1260,11 +1317,11 @@ qboolean UI_RegisterClientModelname(playerInfo_t * pi, const char *modelSkinName
|
|||
}
|
||||
// load the animations
|
||||
Com_sprintf(filename, sizeof(filename), "models/players/%s/animation.cfg", modelName);
|
||||
if (!UI_ParseAnimationFile(filename, pi->animations)) {
|
||||
if (!UI_ParseAnimationFile(filename, pi)) {
|
||||
Com_sprintf(filename, sizeof(filename), "models/players/characters/%s/animation.cfg", modelName);
|
||||
if (!UI_ParseAnimationFile(filename, pi->animations)) {
|
||||
if (!UI_ParseAnimationFile(filename, pi)) {
|
||||
Com_sprintf(filename, sizeof(filename), "models/players/reactionmale/animation.cfg");
|
||||
if (!UI_ParseAnimationFile(filename, pi->animations)) {
|
||||
if (!UI_ParseAnimationFile(filename, pi)) {
|
||||
Com_Printf("Failed to load animation file %s\n", filename);
|
||||
return qfalse;
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// string allocation/managment
|
||||
// string allocation/management
|
||||
|
||||
#include "ui_shared.h"
|
||||
#include "../game/bg_public.h"
|
||||
|
@ -360,6 +360,9 @@ const char *String_Alloc(const char *p)
|
|||
}
|
||||
|
||||
str = UI_Alloc(sizeof(stringDef_t));
|
||||
if (!str) {
|
||||
return NULL;
|
||||
}
|
||||
str->next = NULL;
|
||||
str->str = &strPool[ph];
|
||||
if (last) {
|
||||
|
@ -1914,10 +1917,10 @@ void Menu_TransitionItemByName(menuDef_t * menu, const char *p, rectDef_t rectFr
|
|||
//
|
||||
memcpy(&item->window.rectClient, &rectFrom, sizeof(rectDef_t));
|
||||
memcpy(&item->window.rectEffects, &rectTo, sizeof(rectDef_t));
|
||||
item->window.rectEffects2.x = abs(rectTo.x - rectFrom.x) / amt;
|
||||
item->window.rectEffects2.y = abs(rectTo.y - rectFrom.y) / amt;
|
||||
item->window.rectEffects2.w = abs(rectTo.w - rectFrom.w) / amt;
|
||||
item->window.rectEffects2.h = abs(rectTo.h - rectFrom.h) / amt;
|
||||
item->window.rectEffects2.x = fabs(rectTo.x - rectFrom.x) / amt;
|
||||
item->window.rectEffects2.y = fabs(rectTo.y - rectFrom.y) / amt;
|
||||
item->window.rectEffects2.w = fabs(rectTo.w - rectFrom.w) / amt;
|
||||
item->window.rectEffects2.h = fabs(rectTo.h - rectFrom.h) / amt;
|
||||
|
||||
Item_UpdatePosition(item);
|
||||
}
|
||||
|
@ -2952,6 +2955,27 @@ qboolean Item_ListBox_HandleKey(itemDef_t * item, int key, qboolean down, qboole
|
|||
return qtrue;
|
||||
}
|
||||
}
|
||||
|
||||
// Use mouse wheel in vertical and horizontal menus.
|
||||
// If scrolling 3 items would replace over half of the
|
||||
// displayed items, only scroll 1 item at a time.
|
||||
if (key == K_MWHEELUP) {
|
||||
int scroll = viewmax < 6 ? 1 : 3;
|
||||
listPtr->startPos -= scroll;
|
||||
if (listPtr->startPos < 0) {
|
||||
listPtr->startPos = 0;
|
||||
}
|
||||
return qtrue;
|
||||
}
|
||||
if (key == K_MWHEELDOWN) {
|
||||
int scroll = viewmax < 6 ? 1 : 3;
|
||||
listPtr->startPos += scroll;
|
||||
if (listPtr->startPos > max) {
|
||||
listPtr->startPos = max;
|
||||
}
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
// mouse hit
|
||||
if (key == K_MOUSE1 || key == K_MOUSE2) {
|
||||
if (item->window.flags & WINDOW_LB_LEFTARROW) {
|
||||
|
@ -3007,8 +3031,7 @@ qboolean Item_ListBox_HandleKey(itemDef_t * item, int key, qboolean down, qboole
|
|||
listPtr->startPos = max;
|
||||
return qtrue;
|
||||
}
|
||||
//Makro - support for mouse wheel
|
||||
if (key == K_PGUP || key == K_KP_PGUP || key == K_MWHEELUP) {
|
||||
if (key == K_PGUP || key == K_KP_PGUP) {
|
||||
// page up
|
||||
if (!listPtr->notselectable) {
|
||||
listPtr->cursorPos -= viewmax;
|
||||
|
@ -3031,8 +3054,7 @@ qboolean Item_ListBox_HandleKey(itemDef_t * item, int key, qboolean down, qboole
|
|||
}
|
||||
return qtrue;
|
||||
}
|
||||
//Makro - support for mouse wheel
|
||||
if (key == K_PGDN || key == K_KP_PGDN || key == K_MWHEELDOWN) {
|
||||
if (key == K_PGDN || key == K_KP_PGDN) {
|
||||
// page down
|
||||
if (!listPtr->notselectable) {
|
||||
listPtr->cursorPos += viewmax;
|
||||
|
@ -6836,7 +6858,7 @@ typedef struct keywordHash_s {
|
|||
|
||||
int KeywordHash_Key(const char *keyword)
|
||||
{
|
||||
int register hash, i;
|
||||
int hash, i;
|
||||
|
||||
hash = 0;
|
||||
for (i = 0; keyword[i] != '\0'; i++) {
|
||||
|
|
Loading…
Reference in a new issue