Merge branch 'master' into game/eliteforce

This commit is contained in:
Zack Middleton 2015-03-23 23:54:32 -05:00
commit 956bea9cda
47 changed files with 354 additions and 167 deletions

View file

@ -1,15 +1,19 @@
language: c
env:
# standard builds
- CC=gcc
- CC=clang
# extra libs
- CC=gcc USE_CODEC_VORBIS=1 USE_FREETYPE=1
- CC=clang USE_CODEC_VORBIS=1 USE_FREETYPE=1
# cross-compile using mingw
- CC= PLATFORM="mingw32" ARCH="x86"
- CC= PLATFORM="mingw32" ARCH="x86_64"
global:
# coverity token
- secure: "a2pGsG/+LS12sD/vgCF912TKBDDiT8PwRTH50eE94trQoHmD+bubIc4mXR9rSuU/NKNPdn6KZlqrVkVuoIanjYaf+rg28VavGMcBrtVO2cI1yjTUxb5Eq/cT20m3KfZCSFw3iWXfiK1CpDkm9Pdrr2Yz99EGZse3Y6jRGJ6giWM="
matrix:
# standard builds
- CC=gcc
- CC=clang
# extra libs
- CC=gcc USE_CODEC_VORBIS=1 USE_FREETYPE=1
- CC=clang USE_CODEC_VORBIS=1 USE_FREETYPE=1
# cross-compile using mingw
- CC= PLATFORM="mingw32" ARCH="x86"
- CC= PLATFORM="mingw32" ARCH="x86_64"
script: ./travis-ci-build.sh
@ -22,10 +26,6 @@ before_install:
notifications:
email: false
env:
global:
- secure: "a2pGsG/+LS12sD/vgCF912TKBDDiT8PwRTH50eE94trQoHmD+bubIc4mXR9rSuU/NKNPdn6KZlqrVkVuoIanjYaf+rg28VavGMcBrtVO2cI1yjTUxb5Eq/cT20m3KfZCSFw3iWXfiK1CpDkm9Pdrr2Yz99EGZse3Y6jRGJ6giWM="
addons:
coverity_scan:
project:

View file

@ -63,6 +63,10 @@ endif
#############################################################################
-include Makefile.local
ifeq ($(COMPILE_PLATFORM),cygwin)
PLATFORM=mingw32
endif
ifndef PLATFORM
PLATFORM=$(COMPILE_PLATFORM)
endif
@ -615,6 +619,11 @@ ifeq ($(PLATFORM),mingw32)
TOOLS_BINEXT=.exe
endif
ifeq ($(COMPILE_PLATFORM),cygwin)
TOOLS_BINEXT=.exe
TOOLS_CC=$(CC)
endif
LIBS= -lws2_32 -lwinmm -lpsapi
# clang 3.4 doesn't support this
ifneq ("$(CC)", $(findstring "$(CC)", "clang" "clang++"))

View file

@ -320,6 +320,9 @@ The defaults for these variables differ depending on the target platform.
all bots even if someone is named "allbots")
tell <client num> <msg> - send message to a single client (new to server)
cvar_modified [filter] - list modified cvars, can filter results (such as "r*"
for renderer cvars) like cvarlist which lists all cvars
```

View file

@ -21,10 +21,9 @@
; MASM ftol conversion functions using SSE or FPU
; assume __cdecl calling convention is being used for x86, __fastcall for x64
IFNDEF idx64
.686p
.xmm
IFNDEF idx64
.model flat, c
ENDIF

View file

@ -24,10 +24,9 @@
; function prototype:
; void qsnapvector(vec3_t vec)
IFNDEF idx64
.686p
.xmm
IFNDEF idx64
.model flat, c
ENDIF
@ -47,7 +46,6 @@ IFDEF idx64
; qsnapvector using SSE
qsnapvectorsse PROC
sub rsp, 8
movaps xmm1, ssemask ; initialize the mask register
movups xmm0, [rcx] ; here is stored our vector. Read 4 values in one go
movaps xmm2, xmm0 ; keep a copy of the original data

View file

@ -358,7 +358,7 @@ static void CG_TauntDeathInsult_f (void ) {
}
static void CG_TauntGauntlet_f (void ) {
trap_SendConsoleCommand("cmd vsay kill_guantlet\n");
trap_SendConsoleCommand("cmd vsay kill_gauntlet\n");
}
static void CG_TaskSuicide_f (void ) {

View file

@ -679,6 +679,11 @@ static float CG_DrawAttacker( float y ) {
return y;
}
if ( !cgs.clientinfo[clientNum].infoValid ) {
cg.attackerTime = 0;
return y;
}
t = cg.time - cg.attackerTime;
if ( t > ATTACKER_HEAD_TIME ) {
cg.attackerTime = 0;
@ -1899,6 +1904,8 @@ static void CG_DrawCrosshair(void)
trap_R_DrawStretchPic( x + cg.refdef.x + 0.5 * (cg.refdef.width - w),
y + cg.refdef.y + 0.5 * (cg.refdef.height - h),
w, h, 0, 0, 1, 1, hShader );
trap_R_SetColor( NULL );
}
/*
@ -2298,8 +2305,7 @@ static void CG_DrawProxWarning( void ) {
char s [32];
int w;
static int proxTime;
static int proxCounter;
static int proxTick;
int proxTick;
if( !(cg.snap->ps.eFlags & EF_TICKING ) ) {
proxTime = 0;
@ -2307,17 +2313,12 @@ static void CG_DrawProxWarning( void ) {
}
if (proxTime == 0) {
proxTime = cg.time + 5000;
proxCounter = 5;
proxTick = 0;
proxTime = cg.time;
}
if (cg.time > proxTime) {
proxTick = proxCounter--;
proxTime = cg.time + 1000;
}
proxTick = 10 - ((cg.time - proxTime) / 1000);
if (proxTick != 0) {
if (proxTick > 0 && proxTick <= 5) {
Com_sprintf(s, sizeof(s), "INTERNAL COMBUSTION IN: %i", proxTick);
} else {
Com_sprintf(s, sizeof(s), "YOU HAVE BEEN MINED");

View file

@ -349,9 +349,9 @@ static void CG_Item( centity_t *cent ) {
// add to refresh list
trap_R_AddRefEntityToScene(&ent);
#ifdef MISSIONPACK
if ( item->giType == IT_WEAPON && wi && wi->barrelModel ) {
refEntity_t barrel;
vec3_t angles;
memset( &barrel, 0, sizeof( barrel ) );
@ -361,14 +361,17 @@ static void CG_Item( centity_t *cent ) {
barrel.shadowPlane = ent.shadowPlane;
barrel.renderfx = ent.renderfx;
angles[YAW] = 0;
angles[PITCH] = 0;
angles[ROLL] = 0;
AnglesToAxis( angles, barrel.axis );
CG_PositionRotatedEntityOnTag( &barrel, &ent, wi->weaponModel, "tag_barrel" );
AxisCopy( ent.axis, barrel.axis );
barrel.nonNormalizedAxes = ent.nonNormalizedAxes;
trap_R_AddRefEntityToScene( &barrel );
}
#endif
// accompanying rings / spheres for powerups
if ( !cg_simpleItems.integer )

View file

@ -655,19 +655,16 @@ void CG_RegisterWeapon( int weaponNum ) {
weaponInfo->ammoModel = trap_R_RegisterModel( ammo->world_model[0] );
}
strcpy( path, item->world_model[0] );
COM_StripExtension(path, path, sizeof(path));
strcat( path, "_flash.md3" );
COM_StripExtension( item->world_model[0], path, sizeof(path) );
Q_strcat( path, sizeof(path), "_flash.md3" );
weaponInfo->flashModel = trap_R_RegisterModel( path );
strcpy( path, item->world_model[0] );
COM_StripExtension(path, path, sizeof(path));
strcat( path, "_barrel.md3" );
COM_StripExtension( item->world_model[0], path, sizeof(path) );
Q_strcat( path, sizeof(path), "_barrel.md3" );
weaponInfo->barrelModel = trap_R_RegisterModel( path );
strcpy( path, item->world_model[0] );
COM_StripExtension(path, path, sizeof(path));
strcat( path, "_hand.md3" );
COM_StripExtension( item->world_model[0], path, sizeof(path) );
Q_strcat( path, sizeof(path), "_hand.md3" );
weaponInfo->handsModel = trap_R_RegisterModel( path );
if ( !weaponInfo->handsModel ) {

View file

@ -35,7 +35,7 @@
#endif
#include <fcntl.h>
#include <inttypes.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@ -146,7 +146,7 @@ void mumble_set_identity(const char* identity)
size_t len;
if (!lm)
return;
len = MIN(sizeof(lm->identity), strlen(identity)+1);
len = MIN(sizeof(lm->identity)/sizeof(wchar_t), strlen(identity)+1);
mbstowcs(lm->identity, identity, len);
}
@ -164,7 +164,7 @@ void mumble_set_description(const char* description)
size_t len;
if (!lm)
return;
len = MIN(sizeof(lm->description), strlen(description)+1);
len = MIN(sizeof(lm->description)/sizeof(wchar_t), strlen(description)+1);
mbstowcs(lm->description, description, len);
}

View file

@ -2130,7 +2130,7 @@ void S_AL_StartBackgroundTrack( const char *intro, const char *loop )
issame = qfalse;
// Copy the loop over
strncpy( s_backgroundLoop, loop, sizeof( s_backgroundLoop ) );
Q_strncpyz( s_backgroundLoop, loop, sizeof( s_backgroundLoop ) );
if(!issame)
{

View file

@ -2876,6 +2876,7 @@ float BotEntityVisible(int viewer, vec3_t eye, vec3_t viewangles, float fov, int
BotAI_Trace(&trace, start, NULL, NULL, end, passent, contents_mask);
//if water was hit
waterfactor = 1.0;
//note: trace.contents is always 0, see BotAI_Trace
if (trace.contents & (CONTENTS_LAVA|CONTENTS_SLIME|CONTENTS_WATER)) {
//if the water surface is translucent
if (1) {

View file

@ -149,7 +149,8 @@ void BotAI_Trace(bsp_trace_t *bsptrace, vec3_t start, vec3_t mins, vec3_t maxs,
VectorCopy(trace.plane.normal, bsptrace->plane.normal);
bsptrace->plane.signbits = trace.plane.signbits;
bsptrace->plane.type = trace.plane.type;
bsptrace->surface.value = trace.surfaceFlags;
bsptrace->surface.value = 0;
bsptrace->surface.flags = trace.surfaceFlags;
bsptrace->ent = trace.entityNum;
bsptrace->exp_dist = 0;
bsptrace->sidenum = 0;

View file

@ -248,7 +248,7 @@ typedef struct bot_state_s
float leadmessage_time; //last time a messaged was sent to the team mate
float leadbackup_time; //time backing up towards team mate
//
char teamleader[32]; //netname of the team leader
char teamleader[MAX_NETNAME]; //netname of the team leader
float askteamleader_time; //time asked for team leader
float becometeamleader_time; //time the bot will become the team leader
float teamgiveorders_time; //time to give team orders

View file

@ -817,7 +817,7 @@ static void G_SpawnBots( char *botList, int baseDelay ) {
while( *p && *p == ' ' ) {
p++;
}
if( !p ) {
if( !*p ) {
break;
}

View file

@ -651,6 +651,13 @@ void StopFollowing( gentity_t *ent ) {
ent->client->ps.pm_flags &= ~PMF_FOLLOW;
ent->r.svFlags &= ~SVF_BOT;
ent->client->ps.clientNum = ent - g_entities;
SetClientViewAngle( ent, ent->client->ps.viewangles );
// don't use dead view angles
if ( ent->client->ps.stats[STAT_HEALTH] <= 0 ) {
ent->client->ps.stats[STAT_HEALTH] = 1;
}
}
/*

View file

@ -506,6 +506,7 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) {
G_RemapTeamShaders();
trap_SetConfigstring( CS_INTERMISSION, "" );
}

View file

@ -88,15 +88,13 @@ tryagain:
}
if ( weaponNum == WP_MACHINEGUN || weaponNum == WP_GAUNTLET || weaponNum == WP_BFG ) {
strcpy( path, item->world_model[0] );
COM_StripExtension( path, path, sizeof(path) );
strcat( path, "_barrel.md3" );
COM_StripExtension( item->world_model[0], path, sizeof(path) );
Q_strcat( path, sizeof(path), "_barrel.md3" );
pi->barrelModel = trap_R_RegisterModel( path );
}
strcpy( path, item->world_model[0] );
COM_StripExtension( path, path, sizeof(path) );
strcat( path, "_flash.md3" );
COM_StripExtension( item->world_model[0], path, sizeof(path) );
Q_strcat( path, sizeof(path), "_flash.md3" );
pi->flashModel = trap_R_RegisterModel( path );
switch( weaponNum ) {

View file

@ -183,7 +183,7 @@ static void UI_SPLevelMenu_SetBots( void ) {
while( *p && *p == ' ' ) {
p++;
}
if( !p ) {
if( !*p ) {
break;
}
@ -236,7 +236,7 @@ static void UI_SPLevelMenu_SetMenuArena( int n, int level, const char *arenaInfo
levelMenuInfo.levelScores[n] = 8;
}
strcpy( levelMenuInfo.levelPicNames[n], va( "levelshots/%s.tga", map ) );
Com_sprintf( levelMenuInfo.levelPicNames[n], sizeof(levelMenuInfo.levelPicNames[n]), "levelshots/%s.tga", map );
if( !trap_R_RegisterShaderNoMip( levelMenuInfo.levelPicNames[n] ) ) {
strcpy( levelMenuInfo.levelPicNames[n], ART_MAP_UNKNOWN );
}

View file

@ -1076,7 +1076,7 @@ static void ServerOptions_InitBotNames( void ) {
while( *p && *p == ' ' ) {
p++;
}
if( !p ) {
if( !*p ) {
break;
}

View file

@ -3644,7 +3644,7 @@ void Com_RandomBytes( byte *string, int len )
Com_Printf( "Com_RandomBytes: using weak randomization\n" );
for( i = 0; i < len; i++ )
string[i] = (unsigned char)( rand() % 255 );
string[i] = (unsigned char)( rand() % 256 );
}

View file

@ -1021,6 +1021,90 @@ void Cvar_List_f( void ) {
Com_Printf ("%i cvar indexes\n", cvar_numIndexes);
}
/*
============
Cvar_ListModified_f
============
*/
void Cvar_ListModified_f( void ) {
cvar_t *var;
int totalModified;
char *value;
char *match;
if ( Cmd_Argc() > 1 ) {
match = Cmd_Argv( 1 );
} else {
match = NULL;
}
totalModified = 0;
for (var = cvar_vars ; var ; var = var->next)
{
if ( !var->name || !var->modificationCount )
continue;
value = var->latchedString ? var->latchedString : var->string;
if ( !strcmp( value, var->resetString ) )
continue;
totalModified++;
if (match && !Com_Filter(match, var->name, qfalse))
continue;
if (var->flags & CVAR_SERVERINFO) {
Com_Printf("S");
} else {
Com_Printf(" ");
}
if (var->flags & CVAR_SYSTEMINFO) {
Com_Printf("s");
} else {
Com_Printf(" ");
}
if (var->flags & CVAR_USERINFO) {
Com_Printf("U");
} else {
Com_Printf(" ");
}
if (var->flags & CVAR_ROM) {
Com_Printf("R");
} else {
Com_Printf(" ");
}
if (var->flags & CVAR_INIT) {
Com_Printf("I");
} else {
Com_Printf(" ");
}
if (var->flags & CVAR_ARCHIVE) {
Com_Printf("A");
} else {
Com_Printf(" ");
}
if (var->flags & CVAR_LATCH) {
Com_Printf("L");
} else {
Com_Printf(" ");
}
if (var->flags & CVAR_CHEAT) {
Com_Printf("C");
} else {
Com_Printf(" ");
}
if (var->flags & CVAR_USER_CREATED) {
Com_Printf("?");
} else {
Com_Printf(" ");
}
Com_Printf (" %s \"%s\", default \"%s\"\n", var->name, value, var->resetString);
}
Com_Printf ("\n%i total modified cvars\n", totalModified);
}
/*
============
Cvar_Unset
@ -1343,5 +1427,6 @@ void Cvar_Init (void)
Cmd_SetCommandCompletionFunc("unset", Cvar_CompleteCvarName);
Cmd_AddCommand ("cvarlist", Cvar_List_f);
Cmd_AddCommand ("cvar_modified", Cvar_ListModified_f);
Cmd_AddCommand ("cvar_restart", Cvar_Restart_f);
}

View file

@ -412,23 +412,24 @@ static void DoSyscall(void)
if(vm_syscallNum < 0)
{
int *data;
int *data, *ret;
#if idx64
int index;
intptr_t args[MAX_VMSYSCALL_ARGS];
#endif
data = (int *) (savedVM->dataBase + vm_programStack + 4);
ret = &vm_opStackBase[vm_opStackOfs + 1];
#if idx64
args[0] = ~vm_syscallNum;
for(index = 1; index < ARRAY_LEN(args); index++)
args[index] = data[index];
vm_opStackBase[vm_opStackOfs + 1] = savedVM->systemCall(args);
*ret = savedVM->systemCall(args);
#else
data[0] = ~vm_syscallNum;
vm_opStackBase[vm_opStackOfs + 1] = savedVM->systemCall((intptr_t *) data);
*ret = savedVM->systemCall((intptr_t *) data);
#endif
}
else

View file

@ -1469,7 +1469,7 @@ static qboolean ParseShader( char **text )
else if ( token[0] == '{' )
{
if ( s >= MAX_SHADER_STAGES ) {
ri.Printf( PRINT_WARNING, "WARNING: too many stages in shader %s\n", shader.name );
ri.Printf( PRINT_WARNING, "WARNING: too many stages in shader %s (max is %i)\n", shader.name, MAX_SHADER_STAGES );
return qfalse;
}

View file

@ -127,25 +127,12 @@ void GL_Cull( int cullType ) {
}
else
{
qboolean cullFront;
qboolean cullFront = (cullType == CT_FRONT_SIDED);
if ( glState.faceCulling == CT_TWO_SIDED )
{
qglEnable( GL_CULL_FACE );
}
cullFront = (cullType == CT_FRONT_SIDED);
if ( backEnd.viewParms.isMirror )
{
cullFront = !cullFront;
}
if ( backEnd.currentEntity && backEnd.currentEntity->mirrored )
{
cullFront = !cullFront;
}
if (glState.faceCullFront != cullFront)
if ( glState.faceCullFront != cullFront )
qglCullFace( cullFront ? GL_FRONT : GL_BACK );
glState.faceCullFront = cullFront;

View file

@ -653,9 +653,6 @@ void R_FBOList_f(void)
ri.Printf(PRINT_ALL, " %i FBOs\n", tr.numFBOs);
}
// FIXME
extern void RB_SetGL2D (void);
void FBO_BlitFromTexture(struct image_s *src, ivec4_t inSrcBox, vec2_t inSrcTexScale, FBO_t *dst, ivec4_t inDstBox, struct shaderProgram_s *shaderProgram, vec4_t inColor, int blend)
{
ivec4_t dstBox, srcBox;

View file

@ -2714,7 +2714,7 @@ void R_CreateBuiltinImages( void ) {
{
for( x = 0; x < MAX_DLIGHTS; x++)
{
tr.shadowCubemaps[x] = R_CreateImage(va("*shadowcubemap%i", x), (byte *)data, DEFAULT_SIZE, DEFAULT_SIZE, IMGTYPE_COLORALPHA, IMGFLAG_CLAMPTOEDGE | IMGFLAG_CUBEMAP, 0);
tr.shadowCubemaps[x] = R_CreateImage(va("*shadowcubemap%i", x), (byte *)data, PSHADOW_MAP_SIZE, PSHADOW_MAP_SIZE, IMGTYPE_COLORALPHA, IMGFLAG_CLAMPTOEDGE | IMGFLAG_CUBEMAP, 0);
}
}

View file

@ -1539,20 +1539,28 @@ void RB_StageIteratorGeneric( void )
//
// set face culling appropriately
//
if ((backEnd.viewParms.flags & VPF_DEPTHSHADOW))
if (input->shader->cullType == CT_TWO_SIDED)
{
//GL_Cull( CT_TWO_SIDED );
if (input->shader->cullType == CT_TWO_SIDED)
GL_Cull( CT_TWO_SIDED );
else if (input->shader->cullType == CT_FRONT_SIDED)
GL_Cull( CT_BACK_SIDED );
else
GL_Cull( CT_FRONT_SIDED );
GL_Cull( CT_TWO_SIDED );
}
else
GL_Cull( input->shader->cullType );
{
qboolean cullFront = (input->shader->cullType == CT_FRONT_SIDED);
if ( backEnd.viewParms.flags & VPF_DEPTHSHADOW )
cullFront = !cullFront;
if ( backEnd.viewParms.isMirror )
cullFront = !cullFront;
if ( backEnd.currentEntity && backEnd.currentEntity->mirrored )
cullFront = !cullFront;
if (cullFront)
GL_Cull( CT_FRONT_SIDED );
else
GL_Cull( CT_BACK_SIDED );
}
// set polygon offset if necessary
if ( input->shader->polygonOffset )

View file

@ -1724,7 +1724,7 @@ static qboolean ParseShader( char **text )
else if ( token[0] == '{' )
{
if ( s >= MAX_SHADER_STAGES ) {
ri.Printf( PRINT_WARNING, "WARNING: too many stages in shader %s\n", shader.name );
ri.Printf( PRINT_WARNING, "WARNING: too many stages in shader %s (max is %i)\n", shader.name, MAX_SHADER_STAGES );
return qfalse;
}

View file

@ -776,7 +776,7 @@ static void IN_ProcessEvents( void )
else if( ( *c & 0xF8 ) == 0xF0 ) // 1111 0xxx
{
utf32 |= ( *c++ & 0x07 ) << 18;
utf32 |= ( *c++ & 0x3F ) << 6;
utf32 |= ( *c++ & 0x3F ) << 12;
utf32 |= ( *c++ & 0x3F ) << 6;
utf32 |= ( *c++ & 0x3F );
}
@ -802,7 +802,11 @@ static void IN_ProcessEvents( void )
case SDL_MOUSEMOTION:
if( mouseActive )
{
if( !e.motion.xrel && !e.motion.yrel )
break;
Com_QueueEvent( 0, SE_MOUSE, e.motion.xrel, e.motion.yrel, 0, NULL );
}
break;
case SDL_MOUSEBUTTONDOWN:
@ -845,11 +849,19 @@ static void IN_ProcessEvents( void )
{
case SDL_WINDOWEVENT_RESIZED:
{
char width[32], height[32];
Com_sprintf( width, sizeof( width ), "%d", e.window.data1 );
Com_sprintf( height, sizeof( height ), "%d", e.window.data2 );
Cvar_Set( "r_customwidth", width );
Cvar_Set( "r_customheight", height );
int width, height;
width = e.window.data1;
height = e.window.data2;
// check if size actually changed
if( cls.glconfig.vidWidth == width && cls.glconfig.vidHeight == height )
{
break;
}
Cvar_SetValue( "r_customwidth", width );
Cvar_SetValue( "r_customheight", height );
Cvar_Set( "r_mode", "-1" );
// Wait until user stops dragging for 1 second, so
@ -883,7 +895,6 @@ void IN_Frame( void )
qboolean loading;
IN_JoyMove( );
IN_ProcessEvents( );
// If not DISCONNECTED (main menu) or ACTIVE (in game), we're loading
loading = ( clc.state != CA_DISCONNECTED && clc.state != CA_ACTIVE );
@ -906,6 +917,8 @@ void IN_Frame( void )
else
IN_ActivateMouse( );
IN_ProcessEvents( );
// In case we had to delay actual restart of video system
if( ( vidRestartTime != 0 ) && ( vidRestartTime < Sys_Milliseconds( ) ) )
{

View file

@ -188,7 +188,8 @@ static void BotImport_Trace(bsp_trace_t *bsptrace, vec3_t start, vec3_t mins, ve
VectorCopy(trace.plane.normal, bsptrace->plane.normal);
bsptrace->plane.signbits = trace.plane.signbits;
bsptrace->plane.type = trace.plane.type;
bsptrace->surface.value = trace.surfaceFlags;
bsptrace->surface.value = 0;
bsptrace->surface.flags = trace.surfaceFlags;
bsptrace->ent = trace.entityNum;
bsptrace->exp_dist = 0;
bsptrace->sidenum = 0;
@ -213,7 +214,8 @@ static void BotImport_EntityTrace(bsp_trace_t *bsptrace, vec3_t start, vec3_t mi
VectorCopy(trace.plane.normal, bsptrace->plane.normal);
bsptrace->plane.signbits = trace.plane.signbits;
bsptrace->plane.type = trace.plane.type;
bsptrace->surface.value = trace.surfaceFlags;
bsptrace->surface.value = 0;
bsptrace->surface.flags = trace.surfaceFlags;
bsptrace->ent = trace.entityNum;
bsptrace->exp_dist = 0;
bsptrace->sidenum = 0;

View file

@ -496,7 +496,7 @@ qboolean SVC_RateLimit( leakyBucket_t *bucket, int burst, int period ) {
int expired = interval / period;
int expiredRemainder = interval % period;
if ( expired > bucket->burst ) {
if ( expired > bucket->burst || interval < 0 ) {
bucket->burst = 0;
bucket->lastTime = now;
} else {

View file

@ -44,6 +44,7 @@ static int qconsole_history_oldest = 0;
static char qconsole_line[ MAX_EDIT_LINE ];
static int qconsole_linelen = 0;
static qboolean qconsole_drawinput = qtrue;
static int qconsole_cursor;
static HANDLE qconsole_hout;
static HANDLE qconsole_hin;
@ -139,6 +140,7 @@ static void CON_HistPrev( void )
Q_strncpyz( qconsole_line, qconsole_history[ qconsole_history_pos ],
sizeof( qconsole_line ) );
qconsole_linelen = strlen( qconsole_line );
qconsole_cursor = qconsole_linelen;
}
/*
@ -163,6 +165,7 @@ static void CON_HistNext( void )
qconsole_history_pos = pos;
qconsole_line[ 0 ] = '\0';
qconsole_linelen = 0;
qconsole_cursor = qconsole_linelen;
return;
}
@ -170,6 +173,7 @@ static void CON_HistNext( void )
Q_strncpyz( qconsole_line, qconsole_history[ qconsole_history_pos ],
sizeof( qconsole_line ) );
qconsole_linelen = strlen( qconsole_line );
qconsole_cursor = qconsole_linelen;
}
@ -233,7 +237,11 @@ static void CON_Show( void )
// set curor position
cursorPos.Y = binfo.dwCursorPosition.Y;
cursorPos.X = qconsole_linelen > binfo.srWindow.Right ? binfo.srWindow.Right : qconsole_linelen;
cursorPos.X = qconsole_cursor < qconsole_linelen
? qconsole_cursor
: qconsole_linelen > binfo.srWindow.Right
? binfo.srWindow.Right
: qconsole_linelen;
SetConsoleCursorPosition( qconsole_hout, cursorPos );
}
@ -358,6 +366,7 @@ char *CON_Input( void )
if( key == VK_RETURN )
{
newlinepos = i;
qconsole_cursor = 0;
break;
}
else if( key == VK_UP )
@ -370,6 +379,34 @@ char *CON_Input( void )
CON_HistNext();
break;
}
else if( key == VK_LEFT )
{
qconsole_cursor--;
if ( qconsole_cursor < 0 )
{
qconsole_cursor = 0;
}
break;
}
else if( key == VK_RIGHT )
{
qconsole_cursor++;
if ( qconsole_cursor > qconsole_linelen )
{
qconsole_cursor = qconsole_linelen;
}
break;
}
else if( key == VK_HOME )
{
qconsole_cursor = 0;
break;
}
else if( key == VK_END )
{
qconsole_cursor = qconsole_linelen;
break;
}
else if( key == VK_TAB )
{
field_t f;
@ -380,6 +417,7 @@ char *CON_Input( void )
Q_strncpyz( qconsole_line, f.buffer,
sizeof( qconsole_line ) );
qconsole_linelen = strlen( qconsole_line );
qconsole_cursor = qconsole_linelen;
break;
}
@ -389,15 +427,33 @@ char *CON_Input( void )
if( key == VK_BACK )
{
int pos = ( qconsole_linelen > 0 ) ?
qconsole_linelen - 1 : 0;
if ( qconsole_cursor > 0 )
{
int newlen = ( qconsole_linelen > 0 ) ? qconsole_linelen - 1 : 0;
if ( qconsole_cursor < qconsole_linelen )
{
memmove( qconsole_line + qconsole_cursor - 1,
qconsole_line + qconsole_cursor,
qconsole_linelen - qconsole_cursor );
}
qconsole_line[ pos ] = '\0';
qconsole_linelen = pos;
qconsole_line[ newlen ] = '\0';
qconsole_linelen = newlen;
qconsole_cursor--;
}
}
else if( c )
{
qconsole_line[ qconsole_linelen++ ] = c;
if ( qconsole_linelen > qconsole_cursor )
{
memmove( qconsole_line + qconsole_cursor + 1,
qconsole_line + qconsole_cursor,
qconsole_linelen - qconsole_cursor );
}
qconsole_line[ qconsole_cursor++ ] = c;
qconsole_linelen++;
qconsole_line[ qconsole_linelen ] = '\0';
}
}

View file

@ -816,6 +816,8 @@ void Sys_PlatformInit( void )
signal( SIGIOT, Sys_SigHandler );
signal( SIGBUS, Sys_SigHandler );
Sys_SetFloatEnv();
stdinIsATTY = isatty( STDIN_FILENO ) &&
!( term && ( !strcmp( term, "raw" ) || !strcmp( term, "dumb" ) ) );
}

View file

@ -9,7 +9,7 @@ char rcsid[] = "cpp.c - faked rcsid";
#define OUTS 16384
char outbuf[OUTS];
char *outp = outbuf;
char *outbufp = outbuf;
Source *cursource;
int nerrs;
struct token nltoken = { NL, 0, 0, 0, 1, (uchar*)"\n" };
@ -51,7 +51,7 @@ process(Tokenrow *trp)
for (;;) {
if (trp->tp >= trp->lp) {
trp->tp = trp->lp = trp->bp;
outp = outbuf;
outbufp = outbuf;
anymacros |= gettokens(trp, 1);
trp->tp = trp->bp;
}

View file

@ -143,7 +143,7 @@ void setobjname(char *);
char *basepath( char *fname );
extern char *outp;
extern char *outbufp;
extern Token nltoken;
extern Source *cursource;
extern char *curtime;

View file

@ -120,7 +120,7 @@ genline(void)
static Tokenrow tr = { &ta, &ta, &ta+1, 1 };
uchar *p;
ta.t = p = (uchar*)outp;
ta.t = p = (uchar*)outbufp;
strcpy((char*)p, "#line ");
p += sizeof("#line ")-1;
p = (uchar*)outnum((char*)p, cursource->line);
@ -133,8 +133,8 @@ genline(void)
strcpy((char*)p, cursource->filename);
p += strlen((char*)p);
*p++ = '"'; *p++ = '\n';
ta.len = (char*)p-outp;
outp = (char*)p;
ta.len = (char*)p-outbufp;
outbufp = (char*)p;
tr.tp = tr.bp;
puttokens(&tr);
}

View file

@ -470,10 +470,10 @@ builtin(Tokenrow *trp, int biname)
/* most are strings */
tp->type = STRING;
if (tp->wslen) {
*outp++ = ' ';
*outbufp++ = ' ';
tp->wslen = 1;
}
op = outp;
op = outbufp;
*op++ = '"';
switch (biname) {
@ -508,7 +508,7 @@ builtin(Tokenrow *trp, int biname)
}
if (tp->type==STRING)
*op++ = '"';
tp->t = (uchar*)outp;
tp->len = op - outp;
outp = op;
tp->t = (uchar*)outbufp;
tp->len = op - outbufp;
outbufp = op;
}

View file

@ -2,6 +2,7 @@
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include "cpp.h"
extern int lcc_getopt(int, char *const *, const char *);
@ -66,7 +67,12 @@ setup(int argc, char **argv)
error(FATAL, "Can't open input file %s", fp);
}
if (optind+1<argc) {
int fdo = creat(argv[optind+1], 0666);
int fdo;
#ifdef WIN32
fdo = creat(argv[optind+1], _S_IREAD | _S_IWRITE);
#else
fdo = creat(argv[optind+1], 0666);
#endif
if (fdo<0)
error(FATAL, "Can't open output file %s", argv[optind+1]);
dup2(fdo, 1);

View file

@ -52,6 +52,10 @@ int option(char *arg) {
cpp[0] = concat(&arg[8], "/q3cpp" BINEXT);
include[0] = concat("-I", concat(&arg[8], "/include"));
com[0] = concat(&arg[8], "/q3rcc" BINEXT);
} else if (strncmp(arg, "-lcppdir=", 9) == 0) {
cpp[0] = concat(&arg[9], "/q3cpp" BINEXT);
} else if (strncmp(arg, "-lrccdir=", 9) == 0) {
com[0] = concat(&arg[9], "/q3rcc" BINEXT);
} else if (strcmp(arg, "-p") == 0 || strcmp(arg, "-pg") == 0) {
fprintf( stderr, "no profiling supported, %s ignored.\n", arg);
} else if (strcmp(arg, "-b") == 0)

View file

@ -11,7 +11,12 @@ static char rcsid[] = "Id: dummy rcsid";
#include <assert.h>
#include <ctype.h>
#include <signal.h>
#ifdef WIN32
#include <process.h> /* getpid() */
#include <io.h> /* access() */
#else
#include <unistd.h>
#endif
#ifndef TEMPDIR
#define TEMPDIR "/tmp"

View file

@ -577,6 +577,7 @@ extern Tree cnsttree(Type, ...);
extern Tree consttree(unsigned int, Type);
extern Tree eqtree(int, Tree, Tree);
extern int iscallb(Tree);
extern int isnullptr(Tree);
extern Tree shtree(int, Tree, Tree);
extern void typeerror(int, Tree, Tree);

View file

@ -5,7 +5,6 @@ static Tree addtree(int, Tree, Tree);
static Tree andtree(int, Tree, Tree);
static Tree cmptree(int, Tree, Tree);
static int compatible(Type, Type);
static int isnullptr(Tree e);
static Tree multree(int, Tree, Tree);
static Tree subtree(int, Tree, Tree);
#define isvoidptr(ty) \
@ -220,7 +219,7 @@ static int compatible(Type ty1, Type ty2) {
&& isptr(ty2) && !isfunc(ty2->type)
&& eqtype(unqual(ty1->type), unqual(ty2->type), 0);
}
static int isnullptr(Tree e) {
int isnullptr(Tree e) {
Type ty = unqual(e->type);
return generic(e->op) == CNST

View file

@ -621,7 +621,7 @@ Tree cast(Tree p, Type type) {
p = simplify(CVP, dst, p, NULL);
else {
if ((isfunc(src->type) && !isfunc(dst->type))
|| (!isfunc(src->type) && isfunc(dst->type)))
|| (!isnullptr(p) && !isfunc(src->type) && isfunc(dst->type)))
warning("conversion from `%t' to `%t' is compiler dependent\n", p->type, type);
if (src->size != dst->size)

View file

@ -971,7 +971,7 @@ void UI_Load(void) {
menuDef_t *menu = Menu_GetFocused();
char *menuSet = UI_Cvar_VariableString("ui_menuFiles");
if (menu && menu->window.name) {
strcpy(lastName, menu->window.name);
Q_strncpyz(lastName, menu->window.name, sizeof(lastName));
}
if (menuSet == NULL || menuSet[0] == '\0') {
menuSet = "ui/menus.txt";
@ -1280,8 +1280,8 @@ static void UI_DrawPlayerModel(rectDef_t *rect) {
vec3_t moveangles;
if (trap_Cvar_VariableValue("ui_Q3Model")) {
strcpy(model, UI_Cvar_VariableString("model"));
strcpy(head, UI_Cvar_VariableString("headmodel"));
Q_strncpyz(model, UI_Cvar_VariableString("model"), sizeof(model));
Q_strncpyz(head, UI_Cvar_VariableString("headmodel"), sizeof(head));
if (!q3Model) {
q3Model = qtrue;
updateModel = qtrue;
@ -1289,9 +1289,9 @@ static void UI_DrawPlayerModel(rectDef_t *rect) {
team[0] = '\0';
} else {
strcpy(team, UI_Cvar_VariableString("ui_teamName"));
strcpy(model, UI_Cvar_VariableString("team_model"));
strcpy(head, UI_Cvar_VariableString("team_headmodel"));
Q_strncpyz(team, UI_Cvar_VariableString("ui_teamName"), sizeof(team));
Q_strncpyz(model, UI_Cvar_VariableString("team_model"), sizeof(model));
Q_strncpyz(head, UI_Cvar_VariableString("team_headmodel"), sizeof(head));
if (q3Model) {
q3Model = qfalse;
updateModel = qtrue;
@ -1314,7 +1314,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 > numNetSources) {
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);
@ -1347,7 +1347,7 @@ static void UI_DrawNetMapCinematic(rectDef_t *rect, float scale, vec4_t color) {
static void UI_DrawNetFilter(rectDef_t *rect, float scale, vec4_t color, int textStyle) {
if (ui_serverFilterType.integer < 0 || ui_serverFilterType.integer > numServerFilters) {
if (ui_serverFilterType.integer < 0 || ui_serverFilterType.integer >= numServerFilters) {
ui_serverFilterType.integer = 0;
}
Text_Paint(rect->x, rect->y, scale, color, va("Filter: %s", serverFilters[ui_serverFilterType.integer].description), 0, 0, textStyle);
@ -1394,7 +1394,7 @@ static void UI_DrawTierMapName(rectDef_t *rect, float scale, vec4_t color, int t
i = 0;
}
j = trap_Cvar_VariableValue("ui_currentMap");
if (j < 0 || j > MAPS_PER_TIER) {
if (j < 0 || j >= MAPS_PER_TIER) {
j = 0;
}
@ -1408,7 +1408,7 @@ static void UI_DrawTierGameType(rectDef_t *rect, float scale, vec4_t color, int
i = 0;
}
j = trap_Cvar_VariableValue("ui_currentMap");
if (j < 0 || j > MAPS_PER_TIER) {
if (j < 0 || j >= MAPS_PER_TIER) {
j = 0;
}
@ -1490,8 +1490,8 @@ static void UI_DrawOpponent(rectDef_t *rect) {
if (updateOpponentModel) {
strcpy(model, UI_Cvar_VariableString("ui_opponentModel"));
strcpy(headmodel, UI_Cvar_VariableString("ui_opponentModel"));
Q_strncpyz(model, UI_Cvar_VariableString("ui_opponentModel"), sizeof(model));
Q_strncpyz(headmodel, UI_Cvar_VariableString("ui_opponentModel"), sizeof(headmodel));
team[0] = '\0';
memset( &info2, 0, sizeof(playerInfo_t) );
@ -1707,13 +1707,13 @@ static int UI_OwnerDrawWidth(int ownerDraw, float scale) {
s = va("%i. %s", ownerDraw-UI_REDTEAM1 + 1, text);
break;
case UI_NETSOURCE:
if (ui_netSource.integer < 0 || ui_netSource.integer > numNetSources) {
if (ui_netSource.integer < 0 || ui_netSource.integer >= numNetSources) {
ui_netSource.integer = 0;
}
s = va("Source: %s", netSources[ui_netSource.integer]);
break;
case UI_NETFILTER:
if (ui_serverFilterType.integer < 0 || ui_serverFilterType.integer > numServerFilters) {
if (ui_serverFilterType.integer < 0 || ui_serverFilterType.integer >= numServerFilters) {
ui_serverFilterType.integer = 0;
}
s = va("Filter: %s", serverFilters[ui_serverFilterType.integer].description );
@ -2795,7 +2795,7 @@ static void UI_StartSinglePlayer(void) {
i = 0;
}
j = trap_Cvar_VariableValue("ui_currentMap");
if (j < 0 || j > MAPS_PER_TIER) {
if (j < 0 || j >= MAPS_PER_TIER) {
j = 0;
}
@ -3508,17 +3508,17 @@ static void UI_RunMenuScript(char **args) {
if (String_Parse(args, &orders)) {
int selectedPlayer = trap_Cvar_VariableValue("cg_selectedPlayer");
if (selectedPlayer < uiInfo.myTeamCount) {
strcpy(buff, orders);
trap_Cmd_ExecuteText( EXEC_APPEND, va(buff, uiInfo.teamClientNums[selectedPlayer]) );
Com_sprintf( buff, sizeof( buff ), orders, uiInfo.teamClientNums[selectedPlayer] );
trap_Cmd_ExecuteText( EXEC_APPEND, buff );
trap_Cmd_ExecuteText( EXEC_APPEND, "\n" );
} else {
int i;
for (i = 0; i < uiInfo.myTeamCount; i++) {
if (Q_stricmp(UI_Cvar_VariableString("name"), uiInfo.teamNames[i]) == 0) {
if (uiInfo.playerNumber == uiInfo.teamClientNums[i]) {
continue;
}
strcpy(buff, orders);
trap_Cmd_ExecuteText( EXEC_APPEND, va(buff, uiInfo.teamNames[i]) );
Com_sprintf( buff, sizeof( buff ), orders, uiInfo.teamClientNums[i] );
trap_Cmd_ExecuteText( EXEC_APPEND, buff );
trap_Cmd_ExecuteText( EXEC_APPEND, "\n" );
}
}
@ -3545,8 +3545,8 @@ static void UI_RunMenuScript(char **args) {
if (String_Parse(args, &orders)) {
int selectedPlayer = trap_Cvar_VariableValue("cg_selectedPlayer");
if (selectedPlayer < uiInfo.myTeamCount) {
strcpy(buff, orders);
trap_Cmd_ExecuteText( EXEC_APPEND, va(buff, uiInfo.teamClientNums[selectedPlayer]) );
Com_sprintf( buff, sizeof( buff ), orders, uiInfo.teamClientNums[selectedPlayer] );
trap_Cmd_ExecuteText( EXEC_APPEND, buff );
trap_Cmd_ExecuteText( EXEC_APPEND, "\n" );
}
trap_Key_SetCatcher( trap_Key_GetCatcher() & ~KEYCATCH_UI );
@ -3996,8 +3996,6 @@ static int UI_GetServerStatusInfo( const char *serverAddress, serverStatusInfo_t
while (p && *p) {
if (*p == '\\')
*p++ = '\0';
if (!p)
break;
score = p;
p = strchr(p, ' ');
if (!p)
@ -4628,6 +4626,11 @@ static qboolean Character_Parse(char **p) {
}
if (token[0] == '{') {
if (uiInfo.characterCount == MAX_HEADS) {
uiInfo.characterCount--;
Com_Printf("Too many characters, last character replaced!\n");
}
// two tokens per line, character name and sex
if (!String_Parse(p, &uiInfo.characterList[uiInfo.characterCount].name) || !String_Parse(p, &tempStr)) {
return qfalse;
@ -4645,11 +4648,7 @@ static qboolean Character_Parse(char **p) {
}
Com_Printf("Loaded %s character %s.\n", uiInfo.characterList[uiInfo.characterCount].base, uiInfo.characterList[uiInfo.characterCount].name);
if (uiInfo.characterCount < MAX_HEADS) {
uiInfo.characterCount++;
} else {
Com_Printf("Too many characters, last character replaced!\n");
}
uiInfo.characterCount++;
token = COM_ParseExt(p, qtrue);
if (token[0] != '}') {
@ -4683,17 +4682,18 @@ static qboolean Alias_Parse(char **p) {
}
if (token[0] == '{') {
if (uiInfo.aliasCount == MAX_ALIASES) {
uiInfo.aliasCount--;
Com_Printf("Too many aliases, last alias replaced!\n");
}
// three tokens per line, character name, bot alias, and preferred action a - all purpose, d - defense, o - offense
if (!String_Parse(p, &uiInfo.aliasList[uiInfo.aliasCount].name) || !String_Parse(p, &uiInfo.aliasList[uiInfo.aliasCount].ai) || !String_Parse(p, &uiInfo.aliasList[uiInfo.aliasCount].action)) {
return qfalse;
}
Com_Printf("Loaded character alias %s using character ai %s.\n", uiInfo.aliasList[uiInfo.aliasCount].name, uiInfo.aliasList[uiInfo.aliasCount].ai);
if (uiInfo.aliasCount < MAX_ALIASES) {
uiInfo.aliasCount++;
} else {
Com_Printf("Too many aliases, last alias replaced!\n");
}
uiInfo.aliasCount++;
token = COM_ParseExt(p, qtrue);
if (token[0] != '}') {
@ -5554,7 +5554,7 @@ void UI_DrawConnectScreen( qboolean overlay ) {
if (!Q_stricmp(cstate.servername,"localhost")) {
Text_PaintCenter(centerPoint, yStart + 48, scale, colorWhite, "Starting up...", ITEM_TEXTSTYLE_SHADOWEDMORE);
} else {
strcpy(text, va("Connecting to %s", cstate.servername));
Com_sprintf(text, sizeof(text), "Connecting to %s", cstate.servername);
Text_PaintCenter(centerPoint, yStart + 48, scale, colorWhite,text , ITEM_TEXTSTYLE_SHADOWEDMORE);
}

View file

@ -89,15 +89,13 @@ tryagain:
}
if ( weaponNum == WP_MACHINEGUN || weaponNum == WP_GAUNTLET || weaponNum == WP_BFG ) {
strcpy( path, item->world_model[0] );
COM_StripExtension(path, path, sizeof(path));
strcat( path, "_barrel.md3" );
COM_StripExtension( item->world_model[0], path, sizeof(path) );
Q_strcat( path, sizeof(path), "_barrel.md3" );
pi->barrelModel = trap_R_RegisterModel( path );
}
strcpy( path, item->world_model[0] );
COM_StripExtension(path, path, sizeof(path));
strcat( path, "_flash.md3" );
COM_StripExtension( item->world_model[0], path, sizeof(path) );
Q_strcat( path, sizeof(path), "_flash.md3" );
pi->flashModel = trap_R_RegisterModel( path );
switch( weaponNum ) {

View file

@ -609,18 +609,23 @@ void Fade(int *flags, float *f, float clamp, int *nextTime, int offsetTime, qboo
void Window_Paint(Window *w, float fadeAmount, float fadeClamp, float fadeCycle) {
//float bordersize = 0;
vec4_t color = {0};
rectDef_t fillRect = w->rect;
rectDef_t fillRect;
if ( w == NULL ) {
return;
}
if (debugMode) {
color[0] = color[1] = color[2] = color[3] = 1;
DC->drawRect(w->rect.x, w->rect.y, w->rect.w, w->rect.h, 1, color);
}
if (w == NULL || (w->style == 0 && w->border == 0)) {
if (w->style == 0 && w->border == 0) {
return;
}
fillRect = w->rect;
if (w->border != 0) {
fillRect.x += w->borderSize;
fillRect.y += w->borderSize;