Applied changes that where in 1.29h -> 1.32b gamecode.

This commit is contained in:
Richard Allen 2003-04-19 17:41:26 +00:00
parent c23d31995b
commit 3862a82179
21 changed files with 293 additions and 59 deletions

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.146 2003/04/19 17:41:26 jbravo
// Applied changes that where in 1.29h -> 1.32b gamecode.
//
// Revision 1.145 2003/04/19 15:27:30 jbravo
// Backing out of most of unlagged. Only optimized prediction and smooth clients
// remains.
@ -2279,6 +2282,7 @@ int trap_FS_FOpenFile(const char *qpath, fileHandle_t * f, fsMode_t mode);
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,
@ -2326,7 +2330,7 @@ void trap_S_AddLoopingSound(int entityNum, const vec3_t origin, const vec3_t vel
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

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.135 2003/04/19 17:41:26 jbravo
// Applied changes that where in 1.29h -> 1.32b gamecode.
//
// Revision 1.134 2003/04/19 15:27:30 jbravo
// Backing out of most of unlagged. Only optimized prediction and smooth clients
// remains.
@ -708,7 +711,7 @@ static cvarTable_t cvarTable[] = { // bk001129
{&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},

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.7 2003/04/19 17:41:26 jbravo
// Applied changes that where in 1.29h -> 1.32b gamecode.
//
// Revision 1.6 2002/06/16 20:06:13 jbravo
// Reindented all the source files with "indent -kr -ut -i8 -l120 -lc120 -sob -bad -bap"
//
@ -157,6 +160,8 @@ typedef enum {
CG_GET_ENTITY_TOKEN,
CG_R_ADDPOLYSTOSCENE,
CG_R_INPVS,
// 1.32
CG_FS_SEEK,
/*
CG_LOADCAMERA,

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.72 2003/04/19 17:41:26 jbravo
// Applied changes that where in 1.29h -> 1.32b gamecode.
//
// Revision 1.71 2003/03/09 21:30:38 jbravo
// Adding unlagged. Still needs work.
//
@ -742,6 +745,7 @@ int CG_ParseVoiceChats(const char *filename, voiceChatList_t * voiceChatList, in
char *token;
voiceChat_t *voiceChats;
qboolean compress;
sfxHandle_t sound;
compress = qtrue;
if (cg_buildScript.integer) {
@ -809,9 +813,9 @@ int CG_ParseVoiceChats(const char *filename, voiceChatList_t * voiceChatList, in
}
if (!Q_stricmp(token, "}"))
break;
sound = trap_S_RegisterSound(token, compress);
voiceChats[voiceChatList->numVoiceChats].sounds[voiceChats[voiceChatList->numVoiceChats].
numSounds] =
trap_S_RegisterSound(token, compress);
numSounds] = sound;
token = COM_ParseExt(p, qtrue);
if (!token || token[0] == 0) {
return qtrue;
@ -819,7 +823,8 @@ int CG_ParseVoiceChats(const char *filename, voiceChatList_t * voiceChatList, in
Com_sprintf(voiceChats[voiceChatList->numVoiceChats].
chats[voiceChats[voiceChatList->numVoiceChats].numSounds], MAX_CHATSIZE, "%s",
token);
voiceChats[voiceChatList->numVoiceChats].numSounds++;
if (sound)
voiceChats[voiceChatList->numVoiceChats].numSounds++;
if (voiceChats[voiceChatList->numVoiceChats].numSounds >= MAX_VOICESOUNDS)
break;
}

View file

@ -89,6 +89,7 @@ equ trap_R_AddAdditiveLightToScene -86
equ trap_GetEntityToken -87
equ trap_R_AddPolysToScene -88
equ trap_R_inPVS -89
equ trap_FS_Seek -90
equ memset -101

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.9 2003/04/19 17:41:26 jbravo
// Applied changes that where in 1.29h -> 1.32b gamecode.
//
// Revision 1.8 2002/06/16 20:06:13 jbravo
// Reindented all the source files with "indent -kr -ut -i8 -l120 -lc120 -sob -bad -bap"
//
@ -23,6 +26,10 @@
//
// cg_syscalls.c -- this file is only included when building a dll
// cg_syscalls.asm is included instead when building a qvm
#ifdef Q3_VM
#error "Do not use in VM build"
#endif
#include "cg_local.h"
static int (QDECL * syscall) (int arg, ...) = (int (QDECL *) (int, ...)) -1;
@ -110,6 +117,11 @@ void trap_FS_FCloseFile(fileHandle_t f)
syscall(CG_FS_FCLOSEFILE, f);
}
int trap_FS_Seek(fileHandle_t f, long offset, int origin)
{
return syscall(CG_FS_SEEK, f, offset, origin);
}
void trap_SendConsoleCommand(const char *text)
{
syscall(CG_SENDCONSOLECOMMAND, text);

View file

@ -25,4 +25,4 @@ bg_misc
q_math
q_shared
ui_shared
cg_newDraw
cg_newdraw

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.6 2003/04/19 17:41:26 jbravo
// Applied changes that where in 1.29h -> 1.32b gamecode.
//
// Revision 1.5 2002/06/16 20:06:13 jbravo
// Reindented all the source files with "indent -kr -ut -i8 -l120 -lc120 -sob -bad -bap"
//
@ -196,16 +199,27 @@ typedef struct {
qboolean smpActive; // dual processor
} glconfig_t;
#if !defined _WIN32
// FIXME: VM should be OS agnostic .. in theory
#define _3DFX_DRIVER_NAME "libMesaVoodooGL.so"
#define OPENGL_DRIVER_NAME "libGL.so"
/*
#ifdef Q3_VM
#else
#define _3DFX_DRIVER_NAME "Voodoo"
#define OPENGL_DRIVER_NAME "Default"
#elif defined(_WIN32)
*/
#if defined(Q3_VM) || defined(_WIN32)
#define _3DFX_DRIVER_NAME "3dfxvgl"
#define OPENGL_DRIVER_NAME "opengl32"
#endif // !defined _WIN32
#else
#define _3DFX_DRIVER_NAME "libMesaVoodooGL.so"
// https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=524
#define OPENGL_DRIVER_NAME "libGL.so.1"
#endif // !defined _WIN32
#endif // __TR_TYPES_H

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.132 2003/04/19 17:41:26 jbravo
// Applied changes that where in 1.29h -> 1.32b gamecode.
//
// Revision 1.131 2003/04/19 15:27:30 jbravo
// Backing out of most of unlagged. Only optimized prediction and smooth clients
// remains.
@ -1217,7 +1220,8 @@ void ClientUserinfoChanged(int clientNum)
trap_SetConfigstring(CS_PLAYERS + clientNum, s);
// JBravo: ugly in the logs. Enable to debug if necessary
// this is not the userinfo, more like the configstring actually
// JBravo: ugly in the logs. Enable to debug if necessary
// G_LogPrintf( "ClientUserinfoChanged: %i %s\n", clientNum, s );
}
@ -1322,14 +1326,20 @@ char *ClientConnect(int clientNum, qboolean firstTime, qboolean isBot)
ent = &g_entities[clientNum];
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
ip = Info_ValueForKey(userinfo, "ip");
strcpy(ipaddr, ip);
if (G_FilterPacket(ip)) {
return "Banned.";
return "You are banned from this server..";
}
if (!(ent->r.svFlags & SVF_BOT)) {
// we don't check password for bots and local client
// NOTE: local client <-> "ip" "localhost"
// this means this client is not running in our current process
if (!(ent->r.svFlags & SVF_BOT) && (strcmp(value, "localhost") != 0)) {
// check for a password
value = Info_ValueForKey(userinfo, "password");
if (g_password.string[0] && Q_stricmp(g_password.string, "none") &&

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.140 2003/04/19 17:41:26 jbravo
// Applied changes that where in 1.29h -> 1.32b gamecode.
//
// Revision 1.139 2003/04/19 15:27:31 jbravo
// Backing out of most of unlagged. Only optimized prediction and smooth clients
// remains.
@ -1484,6 +1487,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);

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.9 2003/04/19 17:41:26 jbravo
// Applied changes that where in 1.29h -> 1.32b gamecode.
//
// Revision 1.8 2002/06/16 20:06:14 jbravo
// Reindented all the source files with "indent -kr -ut -i8 -l120 -lc120 -sob -bad -bap"
//
@ -34,6 +37,9 @@
// 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 // set if the entity is a bot
#define SVF_BROADCAST 0x00000020 // send to all connected clients
#define SVF_PORTAL 0x00000040 // merge a second pvs at origin2 into snapshots
@ -57,7 +63,9 @@ typedef struct {
int linkcount;
int svFlags; // SVF_NOCLIENT, SVF_BROADCAST, etc
int singleClient; // only send to this client when SVF_SINGLECLIENT is set
// only send to this client when SVF_SINGLECLIENT is set
// if SVF_CLIENTMASK is set, use bitmask for clients to send to (maxclients must be <= 32, up to the mod to enforce this)
int singleClient;
qboolean bmodel; // if false, assume an explicit mins / maxs bounding box
// only set by trap_SetBrushModel
@ -215,6 +223,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,

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.15 2003/04/19 17:41:26 jbravo
// Applied changes that where in 1.29h -> 1.32b gamecode.
//
// Revision 1.14 2002/08/02 22:44:37 slicer
// Added resetMatch command for MM
//
@ -58,7 +61,7 @@ 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.
@ -71,12 +74,14 @@ 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
==============================================================================
*/
// extern vmCvar_t g_banIPs;
// extern vmCvar_t g_filterBan;
typedef struct ipFilter_s {
unsigned mask;
unsigned compare;
@ -106,6 +111,14 @@ static qboolean StringToFilter(char *s, ipFilter_t * f)
for (i = 0; i < 4; i++) {
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;
}
@ -116,9 +129,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;
s++;
@ -137,21 +148,35 @@ UpdateIPBans
*/
static void UpdateIPBans(void)
{
byte b[4];
int i;
char iplist[MAX_INFO_STRING];
byte b[4], 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]);
*(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);
trap_Cvar_Set("g_banIPs", iplist_final);
}
/*
@ -222,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));

View file

@ -45,6 +45,7 @@ equ trap_RealTime -42
equ trap_SnapVector -43
equ trap_TraceCapsule -44
equ trap_EntityContactCapsule -45
equ trap_FS_Seek -46
equ memset -101
equ memcpy -102

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.7 2003/04/19 17:41:26 jbravo
// Applied changes that where in 1.29h -> 1.32b gamecode.
//
// Revision 1.6 2002/06/16 20:06:14 jbravo
// Reindented all the source files with "indent -kr -ut -i8 -l120 -lc120 -sob -bad -bap"
//
@ -22,6 +25,9 @@
// this file is only included when building a dll
// g_syscalls.asm is included instead when building a qvm
#ifdef Q3_VM
#error "Do not use in VM build"
#endif
static int (QDECL * syscall) (int arg, ...) = (int (QDECL *) (int, ...)) -1;
@ -87,6 +93,11 @@ int trap_FS_GetFileList(const char *path, const char *extension, char *listbuf,
return syscall(G_FS_GETFILELIST, path, extension, listbuf, bufsize);
}
int trap_FS_Seek(fileHandle_t f, long offset, int origin)
{
return syscall(G_FS_SEEK, f, offset, origin);
}
void trap_SendConsoleCommand(int exec_when, const char *text)
{
syscall(G_SEND_CONSOLE_COMMAND, exec_when, text);

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.13 2003/04/19 17:41:26 jbravo
// Applied changes that where in 1.29h -> 1.32b gamecode.
//
// Revision 1.12 2003/03/09 21:30:39 jbravo
// Adding unlagged. Still needs work.
//
@ -36,7 +39,8 @@
// 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.32b"
// 1.32 released 7-10-2002
#define MAX_LATENT_CMDS 64
#define MAX_TEAMNAME 32
@ -510,6 +514,14 @@ void *Hunk_AllocDebug(int size, ha_pref preference, char *label, char *file, int
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);
@ -686,7 +698,7 @@ typedef struct {
float v[3];
} vec3struct_t;
#define VectorCopy(a,b) *(vec3struct_t *)b=*(vec3struct_t *)a;
#define VectorCopy(a,b) (*(vec3struct_t *)b=*(vec3struct_t *)a)
// JBravo: ID_INLINE get defined again. Error....
#undef ID_INLINE
#define ID_INLINE static
@ -1154,7 +1166,7 @@ typedef enum {
#define MAX_GENTITIES (1<<GENTITYNUM_BITS)
// entitynums are communicated with GENTITY_BITS, so any reserved
// values thatare going to be communcated over the net need to
// values that are going to be communcated over the net need to
// also be in this range
#define ENTITYNUM_NONE (MAX_GENTITIES-1)
#define ENTITYNUM_WORLD (MAX_GENTITIES-2)
@ -1440,6 +1452,7 @@ typedef struct qtime_s {
} qtime_t;
// server browser sources
// TTimo: AS_MPLAYER is no longer used
#define AS_LOCAL 0
#define AS_MPLAYER 1
#define AS_GLOBAL 2
@ -1464,9 +1477,9 @@ typedef enum _flag_status {
FLAG_DROPPED
} flagStatus_t;
#define MAX_GLOBAL_SERVERS 2048
#define MAX_OTHER_SERVERS 128
#define MAX_PINGREQUESTS 32
#define MAX_GLOBAL_SERVERS 4096
#define MAX_OTHER_SERVERS 128
#define MAX_PINGREQUESTS 32
#define MAX_SERVERSTATUSREQUESTS 16
#define SAY_ALL 0

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.25 2003/04/19 17:41:26 jbravo
// Applied changes that where in 1.29h -> 1.32b gamecode.
//
// Revision 1.24 2003/03/31 00:23:18 makro
// Replacements and stuff
//
@ -1094,6 +1097,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);
@ -1157,6 +1161,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
//

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.74 2003/04/19 17:41:26 jbravo
// Applied changes that where in 1.29h -> 1.32b gamecode.
//
// Revision 1.73 2003/04/13 16:56:22 makro
// In-game browser was showing "reaction" servers instead of "rq3" ones
//
@ -607,9 +610,6 @@ int Text_Width(const char *text, float scale, int limit)
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;
@ -631,7 +631,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++;
@ -647,9 +647,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;
@ -1869,7 +1866,7 @@ static void UI_DrawPlayerModel(rectDef_t * rect)
static void UI_DrawNetSource(rectDef_t * rect, float scale, vec4_t color, int textStyle)
{
if (ui_netSource.integer < 0 || ui_netSource.integer > uiInfo.numGameTypes) {
if (ui_netSource.integer < 0 || ui_netSource.integer > numNetSources) {
ui_netSource.integer = 0;
}
Text_Paint(rect->x, rect->y, scale, color, va("Source: %s", netSources[ui_netSource.integer]), 0, 0, textStyle);
@ -2916,7 +2913,7 @@ static void UI_DrawKeyBindStatus(rectDef_t * rect, float scale, vec4_t color, in
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;
@ -2931,7 +2928,7 @@ static void UI_DrawGLInfo(rectDef_t * rect, float scale, vec4_t color, int textS
uiInfo.uiDC.glconfig.depthBits, uiInfo.uiDC.glconfig.stencilBits), 0, 48, textStyle);
// build null terminated extension strings
Q_strncpyz(buff, uiInfo.uiDC.glconfig.extensions_string, 4096);
Q_strncpyz(buff, uiInfo.uiDC.glconfig.extensions_string, 1024);
eptr = buff;
y = rect->y + 45;
numLines = 0;
@ -3846,8 +3843,12 @@ static qboolean UI_NetSource_HandleKey(int flags, float *special, int key)
if (key == K_MOUSE2 || key == K_LEFTARROW) {
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++;
}
if (ui_netSource.integer >= numNetSources) {
@ -5446,9 +5447,14 @@ static void UI_RunMenuScript(char **args)
} else if (Q_stricmp(name, "update") == 0) {
if (String_Parse(args, &name2)) {
UI_Update(name2);
} else {
Com_Printf("unknown UI script %s\n", name);
}
} 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);
}
}
}
@ -6316,7 +6322,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],
@ -6340,13 +6346,8 @@ static const char *UI_FeederItemText(float feederID, int index, int column, qhan
netnames[atoi(Info_ValueForKey(info, "nettype"))]);
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;
}
}
@ -6369,6 +6370,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) {
@ -7551,6 +7559,59 @@ 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:";
@ -7675,13 +7736,13 @@ 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(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) {

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.8 2003/04/19 17:41:26 jbravo
// Applied changes that where in 1.29h -> 1.32b gamecode.
//
// Revision 1.7 2002/08/26 00:41:52 makro
// Presets menu + editor
//
@ -125,6 +128,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,
@ -160,6 +166,7 @@ typedef enum {
#define SORT_CLIENTS 2
#define SORT_GAME 3
#define SORT_PING 4
#define SORT_PUNKBUSTER 5
typedef enum {
UI_GETAPIVERSION = 0, // system reserved

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.30 2003/04/19 17:41:26 jbravo
// Applied changes that where in 1.29h -> 1.32b gamecode.
//
// Revision 1.29 2003/04/06 18:31:21 makro
// SSG crosshairs
//
@ -1463,6 +1466,23 @@ 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;
@ -1686,6 +1706,8 @@ commandDef_t commandList[] = {
, // works on this
{"open", &Script_Open}
, // nenu
{"conditionalopen", &Script_ConditionalOpen}
, // menu
{"close", &Script_Close}
, // menu
{"setasset", &Script_SetAsset}

View file

@ -87,6 +87,9 @@ 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

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.6 2003/04/19 17:41:26 jbravo
// Applied changes that where in 1.29h -> 1.32b gamecode.
//
// Revision 1.5 2002/06/16 20:06:15 jbravo
// Reindented all the source files with "indent -kr -ut -i8 -l120 -lc120 -sob -bad -bap"
//
@ -22,6 +25,9 @@
// this file is only included when building a dll
// syscalls.asm is included instead when building a qvm
#ifdef Q3_VM
#error "Do not use in VM build"
#endif
static int (QDECL * syscall) (int arg, ...) = (int (QDECL *) (int, ...)) -1;
@ -141,6 +147,11 @@ 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);
@ -474,3 +485,8 @@ 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);
}