summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cgame/cg_local.h3
-rw-r--r--src/cgame/cg_main.c2
-rw-r--r--src/cgame/tr_types.h3
-rw-r--r--src/game/g_client.c5
-rw-r--r--src/game/g_local.h1
-rw-r--r--src/game/g_public.h8
-rw-r--r--src/game/g_svcmds.c73
-rw-r--r--src/game/q_shared.h17
-rw-r--r--src/ui/ui_local.h3
-rw-r--r--src/ui/ui_main.c118
-rw-r--r--src/ui/ui_public.h12
-rw-r--r--src/ui/ui_shared.c19
-rw-r--r--src/ui/ui_syscalls.asm194
-rw-r--r--src/ui/ui_syscalls.c8
14 files changed, 303 insertions, 163 deletions
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 3f52acf1..70e7b567 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -1470,6 +1470,7 @@ int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mo
void trap_FS_Read( void *buffer, int len, fileHandle_t f );
void trap_FS_Write( const void *buffer, int len, fileHandle_t f );
void trap_FS_FCloseFile( fileHandle_t f );
+int trap_FS_Seek( fileHandle_t f, long offset, int origin ); // fsOrigin_t
// add commands to the local console as if they were typed in
// for map changing, etc. The command is not executed immediately,
@@ -1520,7 +1521,7 @@ void trap_S_AddLoopingSound( int entityNum, const vec3_t origin, const
void trap_S_AddRealLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx );
void trap_S_UpdateEntityPosition( int entityNum, const vec3_t origin );
-// repatialize recalculates the volumes of sound as they should be heard by the
+// respatialize recalculates the volumes of sound as they should be heard by the
// given entityNum and position
void trap_S_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[3], int inwater );
sfxHandle_t trap_S_RegisterSound( const char *sample, qboolean compressed ); // returns buzz if not found
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index 551a5baf..a20d193a 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -250,7 +250,7 @@ static cvarTable_t cvarTable[ ] =
{ &cg_centertime, "cg_centertime", "3", CVAR_CHEAT },
{ &cg_runpitch, "cg_runpitch", "0.002", CVAR_ARCHIVE},
{ &cg_runroll, "cg_runroll", "0.005", CVAR_ARCHIVE },
- { &cg_bobup , "cg_bobup", "0.005", CVAR_ARCHIVE },
+ { &cg_bobup , "cg_bobup", "0.005", CVAR_CHEAT },
{ &cg_bobpitch, "cg_bobpitch", "0.002", CVAR_ARCHIVE },
{ &cg_bobroll, "cg_bobroll", "0.002", CVAR_ARCHIVE },
{ &cg_swingSpeed, "cg_swingSpeed", "0.3", CVAR_CHEAT },
diff --git a/src/cgame/tr_types.h b/src/cgame/tr_types.h
index e424cacc..6bff73ba 100644
--- a/src/cgame/tr_types.h
+++ b/src/cgame/tr_types.h
@@ -211,7 +211,8 @@ typedef struct
#if !defined _WIN32
#define _3DFX_DRIVER_NAME "libMesaVoodooGL.so"
-#define OPENGL_DRIVER_NAME "libGL.so"
+// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=524
+#define OPENGL_DRIVER_NAME "libGL.so.1"
#else
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 7bb6dd73..af242be3 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -1103,10 +1103,13 @@ char *ClientConnect( int clientNum, qboolean firstTime, qboolean isBot )
trap_GetUserinfo( clientNum, userinfo, sizeof( userinfo ) );
+ // IP filtering
+ // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=500
+ // recommanding PB based IP / GUID banning, the builtin system is pretty limited
// check to see if they are on the banned IP list
value = Info_ValueForKey( userinfo, "ip" );
if( G_FilterPacket( value ) )
- return "Banned.";
+ return "You are banned from this server.";
// check for a password
value = Info_ValueForKey( userinfo, "password" );
diff --git a/src/game/g_local.h b/src/game/g_local.h
index d614fb28..ed67b3ee 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -806,6 +806,7 @@ void trap_FS_Read( void *buffer, int len, fileHandle_t f );
void trap_FS_Write( const void *buffer, int len, fileHandle_t f );
void trap_FS_FCloseFile( fileHandle_t f );
int trap_FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize );
+int trap_FS_Seek( fileHandle_t f, long offset, int origin ); // fsOrigin_t
void trap_SendConsoleCommand( int exec_when, const char *text );
void trap_Cvar_Register( vmCvar_t *cvar, const char *var_name, const char *value, int flags );
void trap_Cvar_Update( vmCvar_t *cvar );
diff --git a/src/game/g_public.h b/src/game/g_public.h
index eb6440ed..2d639cad 100644
--- a/src/game/g_public.h
+++ b/src/game/g_public.h
@@ -23,6 +23,11 @@
// in entityStates (level eType), so the game must explicitly flag
// special server behaviors
#define SVF_NOCLIENT 0x00000001 // don't send entity to clients, even if it has effects
+
+// TTimo
+// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=551
+#define SVF_CLIENTMASK 0x00000002
+
#define SVF_BOT 0x00000008
#define SVF_BROADCAST 0x00000020 // send to all connected clients
#define SVF_PORTAL 0x00000040 // merge a second pvs at origin2 into snapshots
@@ -209,6 +214,9 @@ typedef enum {
G_TRACECAPSULE, // ( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask );
G_ENTITY_CONTACTCAPSULE, // ( const vec3_t mins, const vec3_t maxs, const gentity_t *ent );
+ // 1.32
+ G_FS_SEEK,
+
BOTLIB_SETUP = 200, // ( void );
BOTLIB_SHUTDOWN, // ( void );
BOTLIB_LIBVAR_SET,
diff --git a/src/game/g_svcmds.c b/src/game/g_svcmds.c
index 7386d90b..c14eddef 100644
--- a/src/game/g_svcmds.c
+++ b/src/game/g_svcmds.c
@@ -30,7 +30,8 @@ You can add or remove addresses from the filter list with:
addip <ip>
removeip <ip>
-The ip address is specified in dot format, and any unspecified digits will match any value, so you can specify an entire class C network with "addip 192.246.40".
+The ip address is specified in dot format, and you can use '*' to match any value
+so you can specify an entire class C network with "addip 192.246.40.*"
Removeip will only remove an address specified exactly the same way. You cannot addip a subnet, then removeip a single host.
@@ -43,6 +44,10 @@ If 1 (the default), then ip addresses matching the current list will be prohibit
If 0, then only addresses matching the list will be allowed. This lets you easily set up a private game, or a game that only allows players from your local network.
+TTimo NOTE: for persistence, bans are stored in g_banIPs cvar MAX_CVAR_VALUE_STRING
+The size of the cvar string buffer is limiting the banning to around 20 masks
+this could be improved by putting some g_banIPs2 g_banIps3 etc. maybe
+still, you should rely on PB for banning instead
==============================================================================
*/
@@ -84,6 +89,17 @@ static qboolean StringToFilter( char *s, ipFilter_t *f )
{
if( *s < '0' || *s > '9' )
{
+ if( *s == '*' ) // 'match any'
+ {
+ //b[ i ] and m[ i ] to 0
+ s++;
+ if ( !*s )
+ break;
+
+ s++;
+ continue;
+ }
+
G_Printf( "Bad filter address: %s\n", s );
return qfalse;
}
@@ -95,8 +111,7 @@ static qboolean StringToFilter( char *s, ipFilter_t *f )
num[ j ] = 0;
b[ i ] = atoi( num );
- if( b[ i ] != 0 )
- m[ i ] = 255;
+ m[ i ] = 255;
if( !*s )
break;
@@ -117,23 +132,43 @@ UpdateIPBans
*/
static void UpdateIPBans( void )
{
- byte b[ 4 ];
- int i;
- char iplist[ MAX_INFO_STRING ];
+ byte b[ 4 ];
+ byte m[ 4 ];
+ int i, j;
+ char iplist_final[ MAX_CVAR_VALUE_STRING ];
+ char ip[ 64 ];
- *iplist = 0;
+ *iplist_final = 0;
- for( i = 0 ; i < numIPFilters ; i++ )
- {
- if( ipFilters[ i ].compare == 0xffffffff )
- continue;
-
- *(unsigned *)b = ipFilters[ i ].compare;
- Com_sprintf( iplist + strlen( iplist ), sizeof( iplist ) - strlen( iplist ),
- "%i.%i.%i.%i ", b[ 0 ], b[ 1 ], b[ 2 ], b[ 3 ] );
- }
-
- trap_Cvar_Set( "g_banIPs", iplist );
+ for( i = 0 ; i < numIPFilters ; i++ )
+ {
+ if( ipFilters[ i ].compare == 0xffffffff )
+ continue;
+
+ *(unsigned *)b = ipFilters[ i ].compare;
+ *(unsigned *)m = ipFilters[ i ].mask;
+ *ip = 0;
+
+ for( j = 0 ; j < 4 ; j++ )
+ {
+ if( m[ j ] != 255 )
+ Q_strcat( ip, sizeof( ip ), "*" );
+ else
+ Q_strcat( ip, sizeof( ip ), va( "%i", b[ j ] ) );
+
+ Q_strcat( ip, sizeof( ip ), ( j < 3 ) ? "." : " " );
+ }
+
+ if( strlen( iplist_final ) + strlen( ip ) < MAX_CVAR_VALUE_STRING )
+ Q_strcat( iplist_final, sizeof( iplist_final ), ip );
+ else
+ {
+ Com_Printf( "g_banIPs overflowed at MAX_CVAR_VALUE_STRING\n" );
+ break;
+ }
+ }
+
+ trap_Cvar_Set( "g_banIPs", iplist_final );
}
/*
@@ -212,7 +247,7 @@ G_ProcessIPBans
void G_ProcessIPBans( void )
{
char *s, *t;
- char str[ MAX_TOKEN_CHARS ];
+ char str[ MAX_CVAR_VALUE_STRING ];
Q_strncpyz( str, g_banIPs.string, sizeof( str ) );
diff --git a/src/game/q_shared.h b/src/game/q_shared.h
index 4ff5fa52..fefeed3b 100644
--- a/src/game/q_shared.h
+++ b/src/game/q_shared.h
@@ -20,7 +20,7 @@
// q_shared.h -- included first by ALL program modules.
// A user mod should never modify this file
-#define Q3_VERSION "Q3 1.29h"
+#define Q3_VERSION "Q3 1.32"
#define MAX_TEAMNAME 32
@@ -68,10 +68,6 @@
#ifdef Q3_VM
-//#ifdef __linux__
-//#undef __linux__
-//#endif
-
#include "bg_lib.h"
#else
@@ -444,6 +440,14 @@ void *Hunk_AllocDebug( int size, ha_pref preference, char *label, char *file, in
void *Hunk_Alloc( int size, ha_pref preference );
#endif
+#ifdef __linux__
+// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=371
+// custom Snd_Memset implementation for glibc memset bug workaround
+void Snd_Memset (void* dest, const int val, const size_t count);
+#else
+#define Snd_Memset Com_Memset
+#endif
+
#if !( defined __VECTORC )
void Com_Memset (void* dest, const int val, const size_t count);
void Com_Memcpy (void* dest, const void* src, const size_t count);
@@ -1378,6 +1382,7 @@ typedef struct qtime_s {
// server browser sources
+// TTimo: AS_MPLAYER is no longer used
#define AS_LOCAL 0
#define AS_MPLAYER 1
#define AS_GLOBAL 2
@@ -1405,7 +1410,7 @@ typedef enum _flag_status {
-#define MAX_GLOBAL_SERVERS 2048
+#define MAX_GLOBAL_SERVERS 4096
#define MAX_OTHER_SERVERS 128
#define MAX_PINGREQUESTS 32
#define MAX_SERVERSTATUSREQUESTS 16
diff --git a/src/ui/ui_local.h b/src/ui/ui_local.h
index 3b690e06..4531790e 100644
--- a/src/ui/ui_local.h
+++ b/src/ui/ui_local.h
@@ -1008,6 +1008,7 @@ void trap_FS_Read( void *buffer, int len, fileHandle_t f );
void trap_FS_Write( const void *buffer, int len, fileHandle_t f );
void trap_FS_FCloseFile( fileHandle_t f );
int trap_FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize );
+int trap_FS_Seek( fileHandle_t f, long offset, int origin ); // fsOrigin_t
qhandle_t trap_R_RegisterModel( const char *name );
qhandle_t trap_R_RegisterSkin( const char *name );
qhandle_t trap_R_RegisterShaderNoMip( const char *name );
@@ -1069,6 +1070,8 @@ int trap_RealTime(qtime_t *qtime);
void trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset );
qboolean trap_VerifyCDKey( const char *key, const char *chksum);
+void trap_SetPbClStatus( int status );
+
//
// ui_addbots.c
//
diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c
index a96d9a71..c23867d1 100644
--- a/src/ui/ui_main.c
+++ b/src/ui/ui_main.c
@@ -275,9 +275,6 @@ int Text_Width(const char *text, float scale, int limit) {
float out;
glyphInfo_t *glyph;
float useScale;
-// TTimo: FIXME: use const unsigned char to avoid getting a warning in linux debug (.so) when using glyph = &font->glyphs[*s];
-// but use const char to build with lcc..
-// const unsigned char *s = text; // bk001206 - unsigned
const char *s = text;
fontInfo_t *font = &uiInfo.uiDC.Assets.textFont;
if (scale <= ui_smallFont.value) {
@@ -298,7 +295,7 @@ int Text_Width(const char *text, float scale, int limit) {
s += 2;
continue;
} else {
- glyph = &font->glyphs[(int)*s]; // TTimo: FIXME: getting nasty warnings without the cast, hopefully this doesn't break the VM build
+ glyph = &font->glyphs[(int)*s];
out += glyph->xSkip;
s++;
count++;
@@ -313,8 +310,6 @@ int Text_Height(const char *text, float scale, int limit) {
float max;
glyphInfo_t *glyph;
float useScale;
-// TTimo: FIXME
-// const unsigned char *s = text; // bk001206 - unsigned
const char *s = text; // bk001206 - unsigned
fontInfo_t *font = &uiInfo.uiDC.Assets.textFont;
if (scale <= ui_smallFont.value) {
@@ -335,7 +330,7 @@ int Text_Height(const char *text, float scale, int limit) {
s += 2;
continue;
} else {
- glyph = &font->glyphs[(int)*s]; // TTimo: FIXME: getting nasty warnings without the cast, hopefully this doesn't break the VM build
+ glyph = &font->glyphs[(int)*s];
if (max < glyph->height) {
max = glyph->height;
}
@@ -368,8 +363,6 @@ void Text_Paint(float x, float y, float scale, vec4_t color, const char *text, f
}
useScale = scale * font->glyphScale;
if (text) {
-// TTimo: FIXME
-// const unsigned char *s = text; // bk001206 - unsigned
const char *s = text; // bk001206 - unsigned
trap_R_SetColor( color );
memcpy(&newColor[0], &color[0], sizeof(vec4_t));
@@ -379,7 +372,7 @@ void Text_Paint(float x, float y, float scale, vec4_t color, const char *text, f
}
count = 0;
while (s && *s && count < len) {
- glyph = &font->glyphs[(int)*s]; // TTimo: FIXME: getting nasty warnings without the cast, hopefully this doesn't break the VM build
+ glyph = &font->glyphs[(int)*s];
//int yadj = Assets.textFont.glyphs[text[i]].bottom + Assets.textFont.glyphs[text[i]].top;
//float yadj = scale * (Assets.textFont.glyphs[text[i]].imageHeight - Assets.textFont.glyphs[text[i]].height);
if ( Q_IsColorString( s ) ) {
@@ -496,8 +489,6 @@ void Text_PaintWithCursor(float x, float y, float scale, vec4_t color, const cha
}
useScale = scale * font->glyphScale;
if (text) {
-// TTimo: FIXME
-// const unsigned char *s = text; // bk001206 - unsigned
const char *s = text; // bk001206 - unsigned
trap_R_SetColor( color );
memcpy(&newColor[0], &color[0], sizeof(vec4_t));
@@ -508,9 +499,7 @@ void Text_PaintWithCursor(float x, float y, float scale, vec4_t color, const cha
count = 0;
glyph2 = &font->glyphs[ (int) cursor]; // bk001206 - possible signed char
while (s && *s && count < len) {
- glyph = &font->glyphs[(int)*s]; // TTimo: FIXME: getting nasty warnings without the cast, hopefully this doesn't break the VM build
- //int yadj = Assets.textFont.glyphs[text[i]].bottom + Assets.textFont.glyphs[text[i]].top;
- //float yadj = scale * (Assets.textFont.glyphs[text[i]].imageHeight - Assets.textFont.glyphs[text[i]].height);
+ glyph = &font->glyphs[(int)*s];
if ( Q_IsColorString( s ) ) {
memcpy( newColor, g_color_table[ColorIndex(*(s+1))], sizeof( newColor ) );
newColor[3] = color[3];
@@ -647,8 +636,6 @@ static void Text_Paint_Limit(float *maxX, float x, float y, float scale, vec4_t
vec4_t newColor;
glyphInfo_t *glyph;
if (text) {
-// TTimo: FIXME
-// const unsigned char *s = text; // bk001206 - unsigned
const char *s = text; // bk001206 - unsigned
float max = *maxX;
float useScale;
@@ -666,7 +653,7 @@ static void Text_Paint_Limit(float *maxX, float x, float y, float scale, vec4_t
}
count = 0;
while (s && *s && count < len) {
- glyph = &font->glyphs[(int)*s]; // TTimo: FIXME: getting nasty warnings without the cast, hopefully this doesn't break the VM build
+ glyph = &font->glyphs[(int)*s];
if ( Q_IsColorString( s ) ) {
memcpy( newColor, g_color_table[ColorIndex(*(s+1))], sizeof( newColor ) );
newColor[3] = color[3];
@@ -2362,7 +2349,7 @@ static void UI_DrawKeyBindStatus(rectDef_t *rect, float scale, vec4_t color, int
static void UI_DrawGLInfo(rectDef_t *rect, float scale, vec4_t color, int textStyle) {
char * eptr;
- char buff[4096];
+ char buff[1024];
const char *lines[64];
int y, numLines, i;
@@ -2371,7 +2358,10 @@ static void UI_DrawGLInfo(rectDef_t *rect, float scale, vec4_t color, int textSt
Text_Paint(rect->x + 2, rect->y + 30, scale, color, va ("PIXELFORMAT: color(%d-bits) Z(%d-bits) stencil(%d-bits)", uiInfo.uiDC.glconfig.colorBits, uiInfo.uiDC.glconfig.depthBits, uiInfo.uiDC.glconfig.stencilBits), 0, 30, textStyle);
// build null terminated extension strings
- Q_strncpyz(buff, uiInfo.uiDC.glconfig.extensions_string, 4096);
+ // TTimo: https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=399
+ // in TA this was not directly crashing, but displaying a nasty broken shader right in the middle
+ // brought down the string size to 1024, there's not much that can be shown on the screen anyway
+ Q_strncpyz(buff, uiInfo.uiDC.glconfig.extensions_string, 1024);
eptr = buff;
y = rect->y + 45;
numLines = 0;
@@ -2923,8 +2913,12 @@ static qboolean UI_NetSource_HandleKey(int flags, float *special, int key) {
if (key == K_MOUSE2) {
ui_netSource.integer--;
+ if (ui_netSource.integer == AS_MPLAYER)
+ ui_netSource.integer--;
} else {
ui_netSource.integer++;
+ if (ui_netSource.integer == AS_MPLAYER)
+ ui_netSource.integer++;
}
Com_Printf( "pre ui_netSource: %d\n", ui_netSource.integer );
@@ -4356,12 +4350,15 @@ static void UI_RunMenuScript(char **args) {
} else if (Q_stricmp(name, "glCustom") == 0) {
trap_Cvar_Set("ui_glCustom", "4");
} else if (Q_stricmp(name, "update") == 0) {
- if (String_Parse(args, &name2)) {
+ if (String_Parse(args, &name2))
UI_Update(name2);
+ } else if (Q_stricmp(name, "setPbClStatus") == 0) {
+ int stat;
+ if ( Int_Parse( args, &stat ) )
+ trap_SetPbClStatus( stat );
}
else {
Com_Printf("unknown UI script %s\n", name);
- }
}
}
}
@@ -5140,7 +5137,7 @@ static const char *UI_FeederItemText(float feederID, int index, int column, qhan
return UI_SelectedMap(index, &actual);
} else if (feederID == FEEDER_SERVERS) {
if (index >= 0 && index < uiInfo.serverStatus.numDisplayServers) {
- int ping, game;
+ int ping, game, punkbuster;
if (lastColumn != column || lastTime > uiInfo.uiDC.realTime + 5000) {
trap_LAN_GetServerInfo(ui_netSource.integer, uiInfo.serverStatus.displayServers[index], info, MAX_STRING_CHARS);
lastColumn = column;
@@ -5164,13 +5161,8 @@ static const char *UI_FeederItemText(float feederID, int index, int column, qhan
return hostname;
}
else {
- if (atoi(Info_ValueForKey(info, "sv_allowAnonymous")) != 0) { // anonymous server
- Com_sprintf( hostname, sizeof(hostname), "(A) %s",
- Info_ValueForKey(info, "hostname"));
- } else {
- Com_sprintf( hostname, sizeof(hostname), "%s",
- Info_ValueForKey(info, "hostname"));
- }
+ Com_sprintf( hostname, sizeof(hostname), "%s", Info_ValueForKey(info, "hostname"));
+
return hostname;
}
}
@@ -5185,6 +5177,13 @@ static const char *UI_FeederItemText(float feederID, int index, int column, qhan
} else {
return Info_ValueForKey(info, "ping");
}
+ case SORT_PUNKBUSTER:
+ punkbuster = atoi(Info_ValueForKey(info, "punkbuster"));
+ if ( punkbuster ) {
+ return "Yes";
+ } else {
+ return "No";
+ }
}
}
} else if (feederID == FEEDER_SERVERSTATUS) {
@@ -6264,6 +6263,62 @@ void Text_PaintCenter(float x, float y, float scale, vec4_t color, const char *t
Text_Paint(x - len / 2, y, scale, color, text, 0, 0, ITEM_TEXTSTYLE_SHADOWEDMORE);
}
+void Text_PaintCenter_AutoWrapped(float x, float y, float xmax, float ystep, float scale, vec4_t color, const char *str, float adjust) {
+ int width;
+ char *s1,*s2,*s3;
+ char c_bcp;
+ char buf[1024];
+
+ if (!str || str[0]=='\0')
+ return;
+
+ Q_strncpyz(buf, str, sizeof(buf));
+ s1 = s2 = s3 = buf;
+
+ while (1) {
+ do {
+ s3++;
+ } while (*s3!=' ' && *s3!='\0');
+ c_bcp = *s3;
+ *s3 = '\0';
+ width = Text_Width(s1, scale, 0);
+ *s3 = c_bcp;
+ if (width > xmax) {
+ if (s1==s2)
+ {
+ // fuck, don't have a clean cut, we'll overflow
+ s2 = s3;
+ }
+ *s2 = '\0';
+ Text_PaintCenter(x, y, scale, color, s1, adjust);
+ y += ystep;
+ if (c_bcp == '\0')
+ {
+ // that was the last word
+ // we could start a new loop, but that wouldn't be much use
+ // even if the word is too long, we would overflow it (see above)
+ // so just print it now if needed
+ s2++;
+ if (*s2 != '\0') // if we are printing an overflowing line we have s2 == s3
+ Text_PaintCenter(x, y, scale, color, s2, adjust);
+ break;
+ }
+ s2++;
+ s1 = s2;
+ s3 = s2;
+ }
+ else
+ {
+ s2 = s3;
+ if (c_bcp == '\0') // we reached the end
+ {
+ Text_PaintCenter(x, y, scale, color, s1, adjust);
+ break;
+ }
+ }
+ }
+}
+
static void UI_DisplayDownloadInfo( const char *downloadName, float centerPoint, float yStart, float scale ) {
static char dlText[] = "Downloading:";
@@ -6382,13 +6437,12 @@ void UI_DrawConnectScreen( qboolean overlay ) {
Text_PaintCenter(centerPoint, yStart + 48, scale, colorWhite,text , ITEM_TEXTSTYLE_SHADOWEDMORE);
}
- //UI_DrawProportionalString( 320, 96, "Press Esc to abort", UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, menu_text_color );
// display global MOTD at bottom
Text_PaintCenter(centerPoint, 600, scale, colorWhite, Info_ValueForKey( cstate.updateInfoString, "motd" ), 0);
// print any server info (server full, bad version, etc)
if ( cstate.connState < CA_CONNECTED ) {
- Text_PaintCenter(centerPoint, yStart + 176, scale, colorWhite, cstate.messageString, 0);
+ Text_PaintCenter_AutoWrapped(centerPoint, yStart + 176, 630, 20, scale, colorWhite, cstate.messageString, 0);
}
if ( lastConnState > cstate.connState ) {
diff --git a/src/ui/ui_public.h b/src/ui/ui_public.h
index 29f795fb..6e9e261f 100644
--- a/src/ui/ui_public.h
+++ b/src/ui/ui_public.h
@@ -115,6 +115,9 @@ typedef enum {
UI_LAN_GETSERVERPING,
UI_LAN_SERVERISVISIBLE,
UI_LAN_COMPARESERVERS,
+ // 1.32
+ UI_FS_SEEK,
+ UI_SET_PBCLSTATUS,
UI_MEMSET = 100,
UI_MEMCPY,
@@ -137,10 +140,11 @@ typedef enum {
UIMENU_POSTGAME
} uiMenuCommand_t;
-#define SORT_HOST 0
-#define SORT_MAP 1
-#define SORT_CLIENTS 2
-#define SORT_PING 3
+#define SORT_HOST 0
+#define SORT_MAP 1
+#define SORT_CLIENTS 2
+#define SORT_PING 3
+#define SORT_PUNKBUSTER 4
typedef enum {
UI_GETAPIVERSION = 0, // system reserved
diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c
index e17416bb..73244fef 100644
--- a/src/ui/ui_shared.c
+++ b/src/ui/ui_shared.c
@@ -1081,6 +1081,22 @@ void Script_Open(itemDef_t *item, char **args) {
}
}
+void Script_ConditionalOpen(itemDef_t *item, char **args) {
+ const char *cvar;
+ const char *name1;
+ const char *name2;
+ float val;
+
+ if ( String_Parse(args, &cvar) && String_Parse(args, &name1) && String_Parse(args, &name2) ) {
+ val = DC->getCVarValue( cvar );
+ if ( val == 0.f ) {
+ Menus_OpenByName(name2);
+ } else {
+ Menus_OpenByName(name1);
+ }
+ }
+}
+
void Script_Close(itemDef_t *item, char **args) {
const char *name;
if (String_Parse(args, &name)) {
@@ -1227,7 +1243,8 @@ commandDef_t commandList[] =
{"show", &Script_Show}, // group/name
{"hide", &Script_Hide}, // group/name
{"setcolor", &Script_SetColor}, // works on this
- {"open", &Script_Open}, // nenu
+ {"open", &Script_Open}, // menu
+ {"conditionalopen", &Script_ConditionalOpen}, // menu
{"close", &Script_Close}, // menu
{"setasset", &Script_SetAsset}, // works on this
{"setbackground", &Script_SetBackground}, // works on this
diff --git a/src/ui/ui_syscalls.asm b/src/ui/ui_syscalls.asm
index 4b00201a..54255f29 100644
--- a/src/ui/ui_syscalls.asm
+++ b/src/ui/ui_syscalls.asm
@@ -1,101 +1,103 @@
code
-equ trap_Error -1
-equ trap_Print -2
-equ trap_Milliseconds -3
-equ trap_Cvar_Set -4
-equ trap_Cvar_VariableValue -5
-equ trap_Cvar_VariableStringBuffer -6
-equ trap_Cvar_SetValue -7
-equ trap_Cvar_Reset -8
-equ trap_Cvar_Create -9
-equ trap_Cvar_InfoStringBuffer -10
-equ trap_Argc -11
-equ trap_Argv -12
-equ trap_Cmd_ExecuteText -13
-equ trap_FS_FOpenFile -14
-equ trap_FS_Read -15
-equ trap_FS_Write -16
-equ trap_FS_FCloseFile -17
-equ trap_FS_GetFileList -18
-equ trap_R_RegisterModel -19
-equ trap_R_RegisterSkin -20
-equ trap_R_RegisterShaderNoMip -21
-equ trap_R_ClearScene -22
-equ trap_R_AddRefEntityToScene -23
-equ trap_R_AddPolyToScene -24
-equ trap_R_AddLightToScene -25
-equ trap_R_RenderScene -26
-equ trap_R_SetColor -27
-equ trap_R_DrawStretchPic -28
-equ trap_UpdateScreen -29
-equ trap_CM_LerpTag -30
-equ trap_CM_LoadModel -31
-equ trap_S_RegisterSound -32
-equ trap_S_StartLocalSound -33
-equ trap_Key_KeynumToStringBuf -34
-equ trap_Key_GetBindingBuf -35
-equ trap_Key_SetBinding -36
-equ trap_Key_IsDown -37
-equ trap_Key_GetOverstrikeMode -38
-equ trap_Key_SetOverstrikeMode -39
-equ trap_Key_ClearStates -40
-equ trap_Key_GetCatcher -41
-equ trap_Key_SetCatcher -42
-equ trap_GetClipboardData -43
-equ trap_GetGlconfig -44
-equ trap_GetClientState -45
-equ trap_GetConfigString -46
-equ trap_LAN_GetPingQueueCount -47
-equ trap_LAN_ClearPing -48
-equ trap_LAN_GetPing -49
-equ trap_LAN_GetPingInfo -50
-equ trap_Cvar_Register -51
-equ trap_Cvar_Update -52
-equ trap_MemoryRemaining -53
-equ trap_GetCDKey -54
-equ trap_SetCDKey -55
-equ trap_R_RegisterFont -56
-equ trap_R_ModelBounds -57
-equ trap_PC_AddGlobalDefine -58
-equ trap_PC_LoadSource -59
-equ trap_PC_FreeSource -60
-equ trap_PC_ReadToken -61
-equ trap_PC_SourceFileAndLine -62
-equ trap_S_StopBackgroundTrack -63
-equ trap_S_StartBackgroundTrack -64
-equ trap_RealTime -65
-equ trap_LAN_GetServerCount -66
-equ trap_LAN_GetServerAddressString -67
-equ trap_LAN_GetServerInfo -68
-equ trap_LAN_MarkServerVisible -69
-equ trap_LAN_UpdateVisiblePings -70
-equ trap_LAN_ResetPings -71
-equ trap_LAN_LoadCachedServers -72
-equ trap_LAN_SaveCachedServers -73
-equ trap_LAN_AddServer -74
-equ trap_LAN_RemoveServer -75
-equ trap_CIN_PlayCinematic -76
-equ trap_CIN_StopCinematic -77
-equ trap_CIN_RunCinematic -78
-equ trap_CIN_DrawCinematic -79
-equ trap_CIN_SetExtents -80
-equ trap_R_RemapShader -81
-equ trap_VerifyCDKey -82
-equ trap_LAN_ServerStatus -83
-equ trap_LAN_GetServerPing -84
-equ trap_LAN_ServerIsVisible -85
-equ trap_LAN_CompareServers -86
-equ trap_FS_Seek -87
+equ trap_Error -1
+equ trap_Print -2
+equ trap_Milliseconds -3
+equ trap_Cvar_Set -4
+equ trap_Cvar_VariableValue -5
+equ trap_Cvar_VariableStringBuffer -6
+equ trap_Cvar_SetValue -7
+equ trap_Cvar_Reset -8
+equ trap_Cvar_Create -9
+equ trap_Cvar_InfoStringBuffer -10
+equ trap_Argc -11
+equ trap_Argv -12
+equ trap_Cmd_ExecuteText -13
+equ trap_FS_FOpenFile -14
+equ trap_FS_Read -15
+equ trap_FS_Write -16
+equ trap_FS_FCloseFile -17
+equ trap_FS_GetFileList -18
+equ trap_R_RegisterModel -19
+equ trap_R_RegisterSkin -20
+equ trap_R_RegisterShaderNoMip -21
+equ trap_R_ClearScene -22
+equ trap_R_AddRefEntityToScene -23
+equ trap_R_AddPolyToScene -24
+equ trap_R_AddLightToScene -25
+equ trap_R_RenderScene -26
+equ trap_R_SetColor -27
+equ trap_R_DrawStretchPic -28
+equ trap_UpdateScreen -29
+equ trap_CM_LerpTag -30
+equ trap_CM_LoadModel -31
+equ trap_S_RegisterSound -32
+equ trap_S_StartLocalSound -33
+equ trap_Key_KeynumToStringBuf -34
+equ trap_Key_GetBindingBuf -35
+equ trap_Key_SetBinding -36
+equ trap_Key_IsDown -37
+equ trap_Key_GetOverstrikeMode -38
+equ trap_Key_SetOverstrikeMode -39
+equ trap_Key_ClearStates -40
+equ trap_Key_GetCatcher -41
+equ trap_Key_SetCatcher -42
+equ trap_GetClipboardData -43
+equ trap_GetGlconfig -44
+equ trap_GetClientState -45
+equ trap_GetConfigString -46
+equ trap_LAN_GetPingQueueCount -47
+equ trap_LAN_ClearPing -48
+equ trap_LAN_GetPing -49
+equ trap_LAN_GetPingInfo -50
+equ trap_Cvar_Register -51
+equ trap_Cvar_Update -52
+equ trap_MemoryRemaining -53
+equ trap_GetCDKey -54
+equ trap_SetCDKey -55
+equ trap_R_RegisterFont -56
+equ trap_R_ModelBounds -57
+equ trap_PC_AddGlobalDefine -58
+equ trap_PC_LoadSource -59
+equ trap_PC_FreeSource -60
+equ trap_PC_ReadToken -61
+equ trap_PC_SourceFileAndLine -62
+equ trap_S_StopBackgroundTrack -63
+equ trap_S_StartBackgroundTrack -64
+equ trap_RealTime -65
+equ trap_LAN_GetServerCount -66
+equ trap_LAN_GetServerAddressString -67
+equ trap_LAN_GetServerInfo -68
+equ trap_LAN_MarkServerVisible -69
+equ trap_LAN_UpdateVisiblePings -70
+equ trap_LAN_ResetPings -71
+equ trap_LAN_LoadCachedServers -72
+equ trap_LAN_SaveCachedServers -73
+equ trap_LAN_AddServer -74
+equ trap_LAN_RemoveServer -75
+equ trap_CIN_PlayCinematic -76
+equ trap_CIN_StopCinematic -77
+equ trap_CIN_RunCinematic -78
+equ trap_CIN_DrawCinematic -79
+equ trap_CIN_SetExtents -80
+equ trap_R_RemapShader -81
+equ trap_VerifyCDKey -82
+equ trap_LAN_ServerStatus -83
+equ trap_LAN_GetServerPing -84
+equ trap_LAN_ServerIsVisible -85
+equ trap_LAN_CompareServers -86
+equ trap_FS_Seek -87
+equ trap_SetPbClStatus -88
-equ memset -101
-equ memcpy -102
-equ strncpy -103
-equ sin -104
-equ cos -105
-equ atan2 -106
-equ sqrt -107
-equ floor -108
-equ ceil -109
+
+equ memset -101
+equ memcpy -102
+equ strncpy -103
+equ sin -104
+equ cos -105
+equ atan2 -106
+equ sqrt -107
+equ floor -108
+equ ceil -109
diff --git a/src/ui/ui_syscalls.c b/src/ui/ui_syscalls.c
index 2cb5edc8..294d30f0 100644
--- a/src/ui/ui_syscalls.c
+++ b/src/ui/ui_syscalls.c
@@ -113,6 +113,10 @@ int trap_FS_GetFileList( const char *path, const char *extension, char *listbuf
return syscall( UI_FS_GETFILELIST, path, extension, listbuf, bufsize );
}
+int trap_FS_Seek( fileHandle_t f, long offset, int origin ) {
+ return syscall( UI_FS_SEEK, f, offset, origin );
+}
+
qhandle_t trap_R_RegisterModel( const char *name ) {
return syscall( UI_R_REGISTERMODEL, name );
}
@@ -383,4 +387,6 @@ qboolean trap_VerifyCDKey( const char *key, const char *chksum) {
return syscall( UI_VERIFY_CDKEY, key, chksum);
}
-
+void trap_SetPbClStatus( int status ) {
+ syscall( UI_SET_PBCLSTATUS, status );
+}