Merge branch 'master' into sdl2

Conflicts:
	.travis.yml
This commit is contained in:
Zack Middleton 2014-06-03 00:52:49 -05:00
commit 107cae63d6
21 changed files with 162 additions and 240 deletions

View file

@ -1,8 +1,15 @@
language: c
compiler:
- gcc
- clang
- i686-w64-mingw32-gcc
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"
script: ./travis-ci-build.sh
@ -10,7 +17,7 @@ before_install:
- echo "yes" | sudo apt-add-repository ppa:zoogie/sdl2-snapshots
- sudo apt-get update -qq
- sudo apt-get remove -qq -y mingw32
- sudo apt-get install -q -y libgl1-mesa-dev libsdl2-dev libvorbis-dev libfreetype6-dev mingw-w64
- sudo apt-get install -q -y libgl1-mesa-dev libsdl2-dev libfreetype6-dev mingw-w64
notifications:
email: false

View file

@ -995,14 +995,14 @@ int PC_Directive_include(source_t *source)
script = LoadScriptFile(token.string);
if (!script)
{
strcpy(path, source->includepath);
strcat(path, token.string);
Q_strncpyz(path, source->includepath, sizeof(path));
Q_strcat(path, sizeof(path), token.string);
script = LoadScriptFile(path);
} //end if
} //end if
else if (token.type == TT_PUNCTUATION && *token.string == '<')
{
strcpy(path, source->includepath);
Q_strncpyz(path, source->includepath, sizeof(path));
while(PC_ReadSourceToken(source, &token))
{
if (token.linescrossed > 0)
@ -1011,7 +1011,7 @@ int PC_Directive_include(source_t *source)
break;
} //end if
if (token.type == TT_PUNCTUATION && *token.string == '>') break;
strncat(path, token.string, MAX_PATH - 1);
Q_strcat(path, sizeof(path), token.string);
} //end while
if (*token.string != '>')
{
@ -2831,6 +2831,7 @@ int PC_ExpectTokenType(source_t *source, int type, int subtype, token_t *token)
{
if ((token->subtype & subtype) != subtype)
{
strcpy(str, "");
if (subtype & TT_DECIMAL) strcpy(str, "decimal");
if (subtype & TT_HEX) strcpy(str, "hex");
if (subtype & TT_OCTAL) strcpy(str, "octal");
@ -2954,10 +2955,14 @@ void PC_UnreadToken(source_t *source, token_t *token)
//============================================================================
void PC_SetIncludePath(source_t *source, char *path)
{
strncpy(source->includepath, path, MAX_PATH);
size_t len;
Q_strncpyz(source->includepath, path, MAX_PATH-1);
len = strlen(source->includepath);
//add trailing path seperator
if (source->includepath[strlen(source->includepath)-1] != '\\' &&
source->includepath[strlen(source->includepath)-1] != '/')
if (len > 0 && source->includepath[len-1] != '\\' &&
source->includepath[len-1] != '/')
{
strcat(source->includepath, PATHSEPERATOR_STR);
} //end if

View file

@ -828,7 +828,7 @@ int PS_ReadPrimitive(script_t *script, token_t *token)
len = 0;
while(*script->script_p > ' ' && *script->script_p != ';')
{
if (len >= MAX_TOKEN)
if (len >= MAX_TOKEN - 1)
{
ScriptError(script, "primitive token longer than MAX_TOKEN = %d", MAX_TOKEN);
return 0;
@ -956,6 +956,7 @@ int PS_ExpectTokenType(script_t *script, int type, int subtype, token_t *token)
if (token->type != type)
{
strcpy(str, "");
if (type == TT_STRING) strcpy(str, "string");
if (type == TT_LITERAL) strcpy(str, "literal");
if (type == TT_NUMBER) strcpy(str, "number");
@ -968,6 +969,7 @@ int PS_ExpectTokenType(script_t *script, int type, int subtype, token_t *token)
{
if ((token->subtype & subtype) != subtype)
{
strcpy(str, "");
if (subtype & TT_DECIMAL) strcpy(str, "decimal");
if (subtype & TT_HEX) strcpy(str, "hex");
if (subtype & TT_OCTAL) strcpy(str, "octal");
@ -1350,7 +1352,7 @@ script_t *LoadScriptFile(const char *filename)
buffer = GetClearedMemory(sizeof(script_t) + length + 1);
script = (script_t *) buffer;
Com_Memset(script, 0, sizeof(script_t));
strcpy(script->filename, filename);
Q_strncpyz(script->filename, filename, sizeof(script->filename));
script->buffer = (char *) buffer + sizeof(script_t);
script->buffer[length] = 0;
script->length = length;
@ -1396,7 +1398,7 @@ script_t *LoadScriptMemory(char *ptr, int length, char *name)
buffer = GetClearedMemory(sizeof(script_t) + length + 1);
script = (script_t *) buffer;
Com_Memset(script, 0, sizeof(script_t));
strcpy(script->filename, name);
Q_strncpyz(script->filename, name, sizeof(script->filename));
script->buffer = (char *) buffer + sizeof(script_t);
script->buffer[length] = 0;
script->length = length;

View file

@ -1774,6 +1774,9 @@ static void CG_PlayerTokens( centity_t *cent, int renderfx ) {
refEntity_t ent;
vec3_t dir, origin;
skulltrail_t *trail;
if ( cent->currentState.number >= MAX_CLIENTS ) {
return;
}
trail = &cg.skulltrails[cent->currentState.number];
tokens = cent->currentState.generic1;
if ( !tokens ) {

View file

@ -216,7 +216,7 @@ typedef struct
vec3_t playerMoveangles;
int playerLegs;
int playerTorso;
int playerWeapon;
weapon_t playerWeapon;
qboolean playerChat;
menubitmap_s back;
@ -434,7 +434,7 @@ static void Controls_UpdateModel( int anim ) {
s_controls.playerMoveangles[YAW] = s_controls.playerViewangles[YAW];
s_controls.playerLegs = LEGS_IDLE;
s_controls.playerTorso = TORSO_STAND;
s_controls.playerWeapon = -1;
s_controls.playerWeapon = WP_NUM_WEAPONS;
s_controls.playerChat = qfalse;
switch( anim ) {

View file

@ -332,8 +332,8 @@ static void UI_PositionRotatedEntityOnTag( refEntity_t *entity, const refEntity_
}
// cast away const because of compiler problems
MatrixMultiply( entity->axis, ((refEntity_t *)parent)->axis, tempAxis );
MatrixMultiply( lerped.axis, tempAxis, entity->axis );
MatrixMultiply( entity->axis, lerped.axis, tempAxis );
MatrixMultiply( tempAxis, ((refEntity_t *)parent)->axis, entity->axis );
}
@ -845,10 +845,6 @@ void UI_DrawPlayer( float x, float y, float w, float h, playerInfo_t *pi, int ti
angles[YAW] = 0;
angles[PITCH] = 0;
angles[ROLL] = UI_MachinegunSpinAngle( pi );
if( pi->realWeapon == WP_GAUNTLET || pi->realWeapon == WP_BFG ) {
angles[PITCH] = angles[ROLL];
angles[ROLL] = 0;
}
AnglesToAxis( angles, barrel.axis );
UI_PositionRotatedEntityOnTag( &barrel, &gun, pi->weaponModel, "tag_barrel");

View file

@ -626,6 +626,9 @@ static int CM_EdgePlaneNum( cGrid_t *grid, int gridPlanes[MAX_GRID_SIZE][MAX_GRI
p1 = grid->points[i][j];
p2 = grid->points[i+1][j];
p = CM_GridPlane( gridPlanes, i, j, 0 );
if ( p == -1 ) {
return -1;
}
VectorMA( p1, 4, planes[ p ].plane, up );
return CM_FindPlane( p1, p2, up );
@ -633,6 +636,9 @@ static int CM_EdgePlaneNum( cGrid_t *grid, int gridPlanes[MAX_GRID_SIZE][MAX_GRI
p1 = grid->points[i][j+1];
p2 = grid->points[i+1][j+1];
p = CM_GridPlane( gridPlanes, i, j, 1 );
if ( p == -1 ) {
return -1;
}
VectorMA( p1, 4, planes[ p ].plane, up );
return CM_FindPlane( p2, p1, up );
@ -640,6 +646,9 @@ static int CM_EdgePlaneNum( cGrid_t *grid, int gridPlanes[MAX_GRID_SIZE][MAX_GRI
p1 = grid->points[i][j];
p2 = grid->points[i][j+1];
p = CM_GridPlane( gridPlanes, i, j, 1 );
if ( p == -1 ) {
return -1;
}
VectorMA( p1, 4, planes[ p ].plane, up );
return CM_FindPlane( p2, p1, up );
@ -647,6 +656,9 @@ static int CM_EdgePlaneNum( cGrid_t *grid, int gridPlanes[MAX_GRID_SIZE][MAX_GRI
p1 = grid->points[i+1][j];
p2 = grid->points[i+1][j+1];
p = CM_GridPlane( gridPlanes, i, j, 0 );
if ( p == -1 ) {
return -1;
}
VectorMA( p1, 4, planes[ p ].plane, up );
return CM_FindPlane( p1, p2, up );
@ -654,6 +666,9 @@ static int CM_EdgePlaneNum( cGrid_t *grid, int gridPlanes[MAX_GRID_SIZE][MAX_GRI
p1 = grid->points[i+1][j+1];
p2 = grid->points[i][j];
p = CM_GridPlane( gridPlanes, i, j, 0 );
if ( p == -1 ) {
return -1;
}
VectorMA( p1, 4, planes[ p ].plane, up );
return CM_FindPlane( p1, p2, up );
@ -661,6 +676,9 @@ static int CM_EdgePlaneNum( cGrid_t *grid, int gridPlanes[MAX_GRID_SIZE][MAX_GRI
p1 = grid->points[i][j];
p2 = grid->points[i+1][j+1];
p = CM_GridPlane( gridPlanes, i, j, 1 );
if ( p == -1 ) {
return -1;
}
VectorMA( p1, 4, planes[ p ].plane, up );
return CM_FindPlane( p1, p2, up );

View file

@ -966,7 +966,7 @@ static md3Tag_t *R_GetTag( md3Header_t *mod, int frame, const char *tagName ) {
return NULL;
}
void R_GetAnimTag( mdrHeader_t *mod, int framenum, const char *tagName, md3Tag_t * dest)
md3Tag_t *R_GetAnimTag( mdrHeader_t *mod, int framenum, const char *tagName, md3Tag_t * dest)
{
int i, j, k;
int frameSize;
@ -1001,13 +1001,11 @@ void R_GetAnimTag( mdrHeader_t *mod, int framenum, const char *tagName, md3Tag_t
dest->origin[1]=frame->bones[tag->boneIndex].matrix[1][3];
dest->origin[2]=frame->bones[tag->boneIndex].matrix[2][3];
return;
return dest;
}
}
AxisClear( dest->axis );
VectorClear( dest->origin );
strcpy(dest->name,"");
return NULL;
}
/*
@ -1028,34 +1026,29 @@ int R_LerpTag( orientation_t *tag, qhandle_t handle, int startFrame, int endFram
{
if(model->type == MOD_MDR)
{
start = &start_space;
end = &end_space;
R_GetAnimTag((mdrHeader_t *) model->modelData, startFrame, tagName, start);
R_GetAnimTag((mdrHeader_t *) model->modelData, endFrame, tagName, end);
start = R_GetAnimTag((mdrHeader_t *) model->modelData, startFrame, tagName, &start_space);
end = R_GetAnimTag((mdrHeader_t *) model->modelData, endFrame, tagName, &end_space);
}
else if( model->type == MOD_IQM ) {
return R_IQMLerpTag( tag, model->modelData,
startFrame, endFrame,
frac, tagName );
} else {
AxisClear( tag->axis );
VectorClear( tag->origin );
return qfalse;
start = end = NULL;
}
}
else
{
start = R_GetTag( model->md3[0], startFrame, tagName );
end = R_GetTag( model->md3[0], endFrame, tagName );
if ( !start || !end ) {
AxisClear( tag->axis );
VectorClear( tag->origin );
return qfalse;
}
}
if ( !start || !end ) {
AxisClear( tag->axis );
VectorClear( tag->origin );
return qfalse;
}
frontLerp = frac;
backLerp = 1.0f - frac;

View file

@ -1010,8 +1010,8 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
token = COM_ParseExt( text, qfalse );
if ( token[0] == 0 )
break;
strcat( buffer, token );
strcat( buffer, " " );
Q_strcat( buffer, sizeof (buffer), token );
Q_strcat( buffer, sizeof (buffer), " " );
}
ParseTexMod( buffer, stage );

View file

@ -145,7 +145,6 @@ cvar_t *r_baseNormalY;
cvar_t *r_baseParallax;
cvar_t *r_baseSpecular;
cvar_t *r_baseGloss;
cvar_t *r_recalcMD3Normals;
cvar_t *r_mergeLightmaps;
cvar_t *r_dlightMode;
cvar_t *r_pshadowDist;
@ -1206,7 +1205,6 @@ void R_Register( void )
r_baseGloss = ri.Cvar_Get( "r_baseGloss", "0.3", CVAR_ARCHIVE | CVAR_LATCH );
r_dlightMode = ri.Cvar_Get( "r_dlightMode", "0", CVAR_ARCHIVE | CVAR_LATCH );
r_pshadowDist = ri.Cvar_Get( "r_pshadowDist", "128", CVAR_ARCHIVE );
r_recalcMD3Normals = ri.Cvar_Get( "r_recalcMD3Normals", "0", CVAR_ARCHIVE | CVAR_LATCH );
r_mergeLightmaps = ri.Cvar_Get( "r_mergeLightmaps", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_imageUpsample = ri.Cvar_Get( "r_imageUpsample", "0", CVAR_ARCHIVE | CVAR_LATCH );
r_imageUpsampleMaxSize = ri.Cvar_Get( "r_imageUpsampleMaxSize", "1024", CVAR_ARCHIVE | CVAR_LATCH );

View file

@ -1805,7 +1805,6 @@ extern cvar_t *r_baseSpecular;
extern cvar_t *r_baseGloss;
extern cvar_t *r_dlightMode;
extern cvar_t *r_pshadowDist;
extern cvar_t *r_recalcMD3Normals;
extern cvar_t *r_mergeLightmaps;
extern cvar_t *r_imageUpsample;
extern cvar_t *r_imageUpsampleMaxSize;
@ -1866,8 +1865,9 @@ void R_DecomposeSort( unsigned sort, int *entityNum, shader_t **shader,
void R_AddDrawSurf( surfaceType_t *surface, shader_t *shader,
int fogIndex, int dlightMap, int pshadowMap, int cubemap );
void R_CalcTangentSpace(vec3_t tangent, vec3_t bitangent, vec3_t normal,
const vec3_t v0, const vec3_t v1, const vec3_t v2, const vec2_t t0, const vec2_t t1, const vec2_t t2);
void R_CalcTexDirs(vec3_t sdir, vec3_t tdir, const vec3_t v1, const vec3_t v2,
const vec3_t v3, const vec2_t w1, const vec2_t w2, const vec2_t w3);
void R_CalcTbnFromNormalAndTexDirs(vec3_t tangent, vec3_t bitangent, vec3_t normal, vec3_t sdir, vec3_t tdir);
qboolean R_CalcTangentVectors(srfVert_t * dv[3]);
#define CULL_IN 0 // completely unclipped

View file

@ -294,13 +294,11 @@ void R_CalcTangentSpaceFast(vec3_t tangent, vec3_t bitangent, vec3_t normal,
/*
http://www.terathon.com/code/tangent.html
*/
void R_CalcTBN(vec3_t tangent, vec3_t bitangent, vec3_t normal,
const vec3_t v1, const vec3_t v2, const vec3_t v3, const vec2_t w1, const vec2_t w2, const vec2_t w3)
void R_CalcTexDirs(vec3_t sdir, vec3_t tdir, const vec3_t v1, const vec3_t v2,
const vec3_t v3, const vec2_t w1, const vec2_t w2, const vec2_t w3)
{
vec3_t u, v;
float x1, x2, y1, y2, z1, z2;
float s1, s2, t1, t2;
float r, dot;
float s1, s2, t1, t2, r;
x1 = v2[0] - v1[0];
x2 = v3[0] - v1[0];
@ -316,24 +314,27 @@ void R_CalcTBN(vec3_t tangent, vec3_t bitangent, vec3_t normal,
r = 1.0f / (s1 * t2 - s2 * t1);
VectorSet(tangent, (t2 * x1 - t1 * x2) * r, (t2 * y1 - t1 * y2) * r, (t2 * z1 - t1 * z2) * r);
VectorSet(bitangent, (s1 * x2 - s2 * x1) * r, (s1 * y2 - s2 * y1) * r, (s1 * z2 - s2 * z1) * r);
VectorSet(sdir, (t2 * x1 - t1 * x2) * r, (t2 * y1 - t1 * y2) * r, (t2 * z1 - t1 * z2) * r);
VectorSet(tdir, (s1 * x2 - s2 * x1) * r, (s1 * y2 - s2 * y1) * r, (s1 * z2 - s2 * z1) * r);
}
// compute the face normal based on vertex points
VectorSubtract(v3, v1, u);
VectorSubtract(v2, v1, v);
CrossProduct(u, v, normal);
VectorNormalize(normal);
void R_CalcTbnFromNormalAndTexDirs(vec3_t tangent, vec3_t bitangent, vec3_t normal, vec3_t sdir, vec3_t tdir)
{
vec3_t n_cross_t;
vec_t n_dot_t, handedness;
// Gram-Schmidt orthogonalize
//tangent[a] = (t - n * Dot(n, t)).Normalize();
dot = DotProduct(normal, tangent);
VectorMA(tangent, -dot, normal, tangent);
n_dot_t = DotProduct(normal, sdir);
VectorMA(sdir, -n_dot_t, normal, tangent);
VectorNormalize(tangent);
// B=NxT
//CrossProduct(normal, tangent, bitangent);
// Calculate handedness
CrossProduct(normal, sdir, n_cross_t);
handedness = (DotProduct(n_cross_t, tdir) < 0.0f) ? -1.0f : 1.0f;
// Calculate bitangent
CrossProduct(normal, tangent, bitangent);
VectorScale(bitangent, handedness, bitangent);
}
void R_CalcTBN2(vec3_t tangent, vec3_t bitangent, vec3_t normal,

View file

@ -372,7 +372,7 @@ R_LoadMD3
*/
static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, int bufferSize, const char *modName)
{
int f, i, j, k;
int f, i, j;
md3Header_t *md3Model;
md3Frame_t *md3Frame;
@ -598,70 +598,54 @@ static qboolean R_LoadMD3(model_t * mod, int lod, void *buffer, int bufferSize,
#ifdef USE_VERT_TANGENT_SPACE
// calc tangent spaces
{
// Valgrind complaints: Conditional jump or move depends on uninitialised value(s)
// So lets Initialize them.
const float *v0 = NULL, *v1 = NULL, *v2 = NULL;
const float *t0 = NULL, *t1 = NULL, *t2 = NULL;
vec3_t tangent = { 0, 0, 0 };
vec3_t bitangent = { 0, 0, 0 };
vec3_t normal = { 0, 0, 0 };
for(j = 0, v = surf->verts; j < (surf->numVerts * mdvModel->numFrames); j++, v++)
{
VectorClear(v->tangent);
VectorClear(v->bitangent);
if (r_recalcMD3Normals->integer)
VectorClear(v->normal);
}
for(f = 0; f < mdvModel->numFrames; f++)
{
for(j = 0, tri = surf->indexes; j < surf->numIndexes; j += 3, tri += 3)
{
v0 = surf->verts[surf->numVerts * f + tri[0]].xyz;
v1 = surf->verts[surf->numVerts * f + tri[1]].xyz;
v2 = surf->verts[surf->numVerts * f + tri[2]].xyz;
vec3_t sdir, tdir;
const float *v0, *v1, *v2, *t0, *t1, *t2;
glIndex_t index0, index1, index2;
index0 = surf->numVerts * f + tri[0];
index1 = surf->numVerts * f + tri[1];
index2 = surf->numVerts * f + tri[2];
v0 = surf->verts[index0].xyz;
v1 = surf->verts[index1].xyz;
v2 = surf->verts[index2].xyz;
t0 = surf->st[tri[0]].st;
t1 = surf->st[tri[1]].st;
t2 = surf->st[tri[2]].st;
if (!r_recalcMD3Normals->integer)
VectorCopy(v->normal, normal);
else
VectorClear(normal);
R_CalcTexDirs(sdir, tdir, v0, v1, v2, t0, t1, t2);
#if 1
R_CalcTangentSpace(tangent, bitangent, normal, v0, v1, v2, t0, t1, t2);
#else
R_CalcNormalForTriangle(normal, v0, v1, v2);
R_CalcTangentsForTriangle(tangent, bitangent, v0, v1, v2, t0, t1, t2);
#endif
for(k = 0; k < 3; k++)
{
float *v;
v = surf->verts[surf->numVerts * f + tri[k]].tangent;
VectorAdd(v, tangent, v);
v = surf->verts[surf->numVerts * f + tri[k]].bitangent;
VectorAdd(v, bitangent, v);
if (r_recalcMD3Normals->integer)
{
v = surf->verts[surf->numVerts * f + tri[k]].normal;
VectorAdd(v, normal, v);
}
}
VectorAdd(sdir, surf->verts[index0].tangent, surf->verts[index0].tangent);
VectorAdd(sdir, surf->verts[index1].tangent, surf->verts[index1].tangent);
VectorAdd(sdir, surf->verts[index2].tangent, surf->verts[index2].tangent);
VectorAdd(tdir, surf->verts[index0].bitangent, surf->verts[index0].bitangent);
VectorAdd(tdir, surf->verts[index1].bitangent, surf->verts[index1].bitangent);
VectorAdd(tdir, surf->verts[index2].bitangent, surf->verts[index2].bitangent);
}
}
for(j = 0, v = surf->verts; j < (surf->numVerts * mdvModel->numFrames); j++, v++)
{
VectorNormalize(v->tangent);
VectorNormalize(v->bitangent);
VectorNormalize(v->normal);
vec3_t sdir, tdir;
VectorCopy(v->tangent, sdir);
VectorCopy(v->bitangent, tdir);
VectorNormalize(sdir);
VectorNormalize(tdir);
R_CalcTbnFromNormalAndTexDirs(v->tangent, v->bitangent, v->normal, sdir, tdir);
}
}
#endif
@ -1132,6 +1116,7 @@ static qboolean R_LoadMDR( model_t *mod, void *buffer, int filesize, const char
** RE_BeginRegistration
*/
void RE_BeginRegistration( glconfig_t *glconfigOut ) {
int i;
R_Init();
@ -1140,7 +1125,10 @@ void RE_BeginRegistration( glconfig_t *glconfigOut ) {
R_IssuePendingRenderCommands();
tr.visIndex = 0;
memset(tr.visClusters, -2, sizeof(tr.visClusters)); // force markleafs to regenerate
// force markleafs to regenerate
for(i = 0; i < MAX_VISCOUNTS; i++) {
tr.visClusters[i] = -2;
}
R_ClearFlares();
RE_ClearScene();
@ -1230,7 +1218,7 @@ static mdvTag_t *R_GetTag( mdvModel_t *mod, int frame, const char *_tagName ) {
return NULL;
}
void R_GetAnimTag( mdrHeader_t *mod, int framenum, const char *tagName, mdvTag_t * dest)
mdvTag_t *R_GetAnimTag( mdrHeader_t *mod, int framenum, const char *tagName, mdvTag_t * dest)
{
int i, j, k;
int frameSize;
@ -1263,12 +1251,11 @@ void R_GetAnimTag( mdrHeader_t *mod, int framenum, const char *tagName, mdvTag_t
dest->origin[1]=frame->bones[tag->boneIndex].matrix[1][3];
dest->origin[2]=frame->bones[tag->boneIndex].matrix[2][3];
return;
return dest;
}
}
AxisClear( dest->axis );
VectorClear( dest->origin );
return NULL;
}
/*
@ -1289,34 +1276,29 @@ int R_LerpTag( orientation_t *tag, qhandle_t handle, int startFrame, int endFram
{
if(model->type == MOD_MDR)
{
start = &start_space;
end = &end_space;
R_GetAnimTag((mdrHeader_t *) model->modelData, startFrame, tagName, start);
R_GetAnimTag((mdrHeader_t *) model->modelData, endFrame, tagName, end);
start = R_GetAnimTag((mdrHeader_t *) model->modelData, startFrame, tagName, &start_space);
end = R_GetAnimTag((mdrHeader_t *) model->modelData, endFrame, tagName, &end_space);
}
else if( model->type == MOD_IQM ) {
return R_IQMLerpTag( tag, model->modelData,
startFrame, endFrame,
frac, tagName );
} else {
AxisClear( tag->axis );
VectorClear( tag->origin );
return qfalse;
start = end = NULL;
}
}
else
{
start = R_GetTag( model->mdv[0], startFrame, tagName );
end = R_GetTag( model->mdv[0], endFrame, tagName );
if ( !start || !end ) {
AxisClear( tag->axis );
VectorClear( tag->origin );
return qfalse;
}
}
if ( !start || !end ) {
AxisClear( tag->axis );
VectorClear( tag->origin );
return qfalse;
}
frontLerp = frac;
backLerp = 1.0f - frac;

View file

@ -639,7 +639,7 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
else if ( !Q_stricmp( token, "$lightmap" ) )
{
stage->bundle[0].isLightmap = qtrue;
if ( shader.lightmapIndex < 0 ) {
if ( shader.lightmapIndex < 0 || !tr.lightmaps ) {
stage->bundle[0].image[0] = tr.whiteImage;
} else {
stage->bundle[0].image[0] = tr.lightmaps[shader.lightmapIndex];
@ -1265,8 +1265,8 @@ static qboolean ParseStage( shaderStage_t *stage, char **text )
token = COM_ParseExt( text, qfalse );
if ( token[0] == 0 )
break;
strcat( buffer, token );
strcat( buffer, " " );
Q_strcat( buffer, sizeof (buffer), token );
Q_strcat( buffer, sizeof (buffer), " " );
}
ParseTexMod( buffer, stage );

View file

@ -846,7 +846,7 @@ static void SV_AddBanToList(qboolean isexception)
return;
}
if(serverBansCount > ARRAY_LEN(serverBans))
if(serverBansCount >= ARRAY_LEN(serverBans))
{
Com_Printf ("Error: Maximum number of bans/exceptions exceeded.\n");
return;

View file

@ -208,7 +208,7 @@ static void CON_Show( void )
{
if( i < qconsole_linelen )
{
if( Q_IsColorString( qconsole_line + i ) )
if( i + 1 < qconsole_linelen && Q_IsColorString( qconsole_line + i ) )
attrib = CON_ColorCharToAttrib( *( qconsole_line + i + 1 ) );
line[ i ].Char.AsciiChar = qconsole_line[ i ];

View file

@ -333,8 +333,8 @@ static void UI_PositionRotatedEntityOnTag( refEntity_t *entity, const refEntity_
}
// cast away const because of compiler problems
MatrixMultiply( entity->axis, ((refEntity_t *)parent)->axis, tempAxis );
MatrixMultiply( lerped.axis, tempAxis, entity->axis );
MatrixMultiply( entity->axis, lerped.axis, tempAxis );
MatrixMultiply( tempAxis, ((refEntity_t *)parent)->axis, entity->axis );
}
@ -845,10 +845,6 @@ void UI_DrawPlayer( float x, float y, float w, float h, playerInfo_t *pi, int ti
angles[YAW] = 0;
angles[PITCH] = 0;
angles[ROLL] = UI_MachinegunSpinAngle( pi );
if( pi->realWeapon == WP_GAUNTLET || pi->realWeapon == WP_BFG ) {
angles[PITCH] = angles[ROLL];
angles[ROLL] = 0;
}
AnglesToAxis( angles, barrel.axis );
UI_PositionRotatedEntityOnTag( &barrel, &gun, pi->weaponModel, "tag_barrel");

View file

@ -1491,7 +1491,7 @@ float Item_Slider_ThumbPosition(itemDef_t *item) {
x = item->window.rect.x;
}
if (editDef == NULL && item->cvar) {
if (!editDef || !item->cvar) {
return x;
}

View file

@ -177,7 +177,7 @@
<AdditionalIncludeDirectories>..\..\code\SDL12\include;..\..\code\libcurl;..\..\code\AL;..\..\code\libspeex\include;..\..\code\zlib;..\..\code\jpeg-8c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN32;WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;BOTLIB;USE_ICON;USE_CURL;USE_CURL_DLOPEN;USE_OPENAL;USE_OPENAL_DLOPEN;USE_VOIP;USE_INTERNAL_JPEG;HAVE_CONFIG_H;MISSIONPACK;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
@ -393,7 +393,7 @@
<AdditionalIncludeDirectories>..\..\code\SDL12\include;..\..\code\libcurl;..\..\code\AL;..\..\code\libspeex\include;..\..\code\zlib;..\..\code\jpeg-8c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN32;WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;BOTLIB;USE_ICON;USE_CURL;USE_CURL_DLOPEN;USE_OPENAL;USE_OPENAL_DLOPEN;USE_VOIP;USE_INTERNAL_JPEG;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>

View file

@ -18,7 +18,6 @@ compatibility with existing Quake 3 mods.
- Texture upsampling.
- Advanced materials support.
- Advanced shading and specular methods.
- Separate material/light/framebuffer/tonemap gamma.
- LATC and BPTC texture compression support.
- Screen-space ambient occlusion.
@ -311,29 +310,6 @@ Cvars for the sunlight and cascaded shadow maps:
4096 - 4096x4096, indistinguishable from
2048.
Cvars for adjusting gamma values:
r_materialGamma - Gamma level for material textures.
(diffuse, specular)
1.0 - Quake 3, fastest. (default)
2.0 - More accurate, slower.
2.2 - Most accurate, slowest.
r_lightGamma - Gamma level for light.
(lightmap, lightgrid, vertex lights)
1.0 - Quake 3, fastest. (default)
2.0 - More accurate, slower.
2.2 - Most accurate, slowest.
r_framebufferGamma - Gamma level for framebuffers.
1.0 - Quake 3, fastest. (default)
2.0 - More accurate, slower.
2.2 - Most accurate, slowest.
r_tonemapGamma - Gamma applied after tonemapping.
1.0 - Quake 3, fastest. (default)
2.0 - More accurate, slower.
2.2 - Most accurate, slowest.
Cvars that you probably don't care about or shouldn't mess with:
r_mergeMultidraws - Optimize number of calls to
glMultiDrawElements().
@ -381,7 +357,20 @@ Cvars that you probably don't care about or shouldn't mess with:
r_shadowCascadeZBias - Z-bias for shadow cascade frustums.
-256 - Default.
r_materialGamma - Gamma level for material textures.
(diffuse, specular)
1.0 - Quake 3, fastest. (default)
r_lightGamma - Gamma level for light.
(lightmap, lightgrid, vertex lights)
1.0 - Quake 3, fastest. (default)
r_framebufferGamma - Gamma level for framebuffers.
1.0 - Quake 3, fastest. (default)
r_tonemapGamma - Gamma applied after tonemapping.
1.0 - Quake 3, fastest. (default)
Cvars that have broken bits:
r_dlightMode - Change how dynamic lights look.
0 - Quake 3 style dlights, fake
@ -615,59 +604,6 @@ Each of these settings corresponds to a matching cvar, so you can view and
adjust the effect before settling on fixed settings.
-------------------------------------------------------------------------------
MATERIAL/LIGHT/FRAMEBUFFER/TONEMAP GAMMA
-------------------------------------------------------------------------------
This adds four cvars, r_materialGamma, r_lightGamma, r_framebufferGamma, and
r_tonemapGamma. These adjust the gamma levels of their corresponding texture
or color, allowing for more realistic lighting and shading.
These settings are fastest:
r_materialGamma 1
r_lightGamma 1
r_framebufferGamma 1
r_tonemapGamma 1
This is the same as Quake 3 behaviour, where colors are not adjusted for gamma
until presentation to the screen.
These settings are more accurate:
r_materialGamma 2
r_lightGamma 2
r_framebufferGamma 2
r_tonemapGamma 2
This converts diffuse/specular from gamma 2 space to linear space
(r_materialGamma 2), converts light values similarly (r_lightGamma 2),
converts those to the gamma 2 of the framebuffer (r_framebufferGamma 2), and
converts to a monitor gamma of 2 after tonemapping (r_tonemapGamma 2).
These settings are the most accurate:
r_materialGamma 2.2
r_lightGamma 2.2
r_framebufferGamma 2.2
r_tonemapGamma 2.2
This is the same as the previous, except using a more correct gamma of 2.2,
which approximates sRGB.
The only issue with these last two examples are that dlights aren't added
linearly, since they are still performed as a straight add to a non-linear
framebuffer. To fix this, these settings are possible:
r_materialGamma 2.2
r_lightGamma 2.2
r_framebufferGamma 1.0
r_tonemapGamma 2.2
But these cause UI draws to have the wrong gamma, as these are rendered after
tonemapping. I recommend the use of the second or third set of settings.
-------------------------------------------------------------------------------
THANKS
-------------------------------------------------------------------------------

View file

@ -2,28 +2,13 @@
failed=0;
# check if testing mingw
if [ "$CC" = "i686-w64-mingw32-gcc" ]; then
export PLATFORM=mingw32
export ARCH=x86
export CC=
haveExternalLibs=0
else
haveExternalLibs=1
fi
# Default Build
(make clean release) || failed=1;
# Test additional options
if [ $haveExternalLibs -eq 1 ]; then
(make clean release USE_CODEC_VORBIS=1 USE_FREETYPE=1) || failed=1;
fi
if [ $failed -eq 1 ]; then
echo "Build failure.";
else
echo "All builds successful.";
echo "Build successful.";
fi
exit $failed;