Skip to content

Commit

Permalink
Merge branch 'devil'
Browse files Browse the repository at this point in the history
  • Loading branch information
zturtleman committed May 13, 2016
2 parents a3da9be + ef98e70 commit 35fe7b2
Show file tree
Hide file tree
Showing 27 changed files with 126 additions and 137 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ endif
export CROSS_COMPILING

ifndef VERSION
VERSION=0.2
VERSION=0.3
endif

ifndef CLIENTBIN
Expand Down
2 changes: 1 addition & 1 deletion code/cgame/cg_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Suite 120, Rockville, Maryland 20850 USA.
// major 0 means each minor is an API break.
// major > 0 means each major is an API break and each minor extends API.
#define CG_API_MAJOR_VERSION 0
#define CG_API_MINOR_VERSION 34
#define CG_API_MINOR_VERSION 36


#define CMD_BACKUP 64
Expand Down
6 changes: 3 additions & 3 deletions code/client/cl_cgame.c
Original file line number Diff line number Diff line change
Expand Up @@ -1421,10 +1421,10 @@ intptr_t CL_CgameSystemCalls( intptr_t *args ) {
case CG_R_LERPTAG_TORSO:
return re.LerpTag( VMA(1), args[2], args[3], args[4], args[5], args[6], VMF(7), VMA(8), VMA(9), VMA(10), args[11], args[12], args[13], args[14], VMF(15) );
case CG_R_GET_GLOBAL_FOG:
re.GetGlobalFog( VMA(1), VMA(2), VMA(3), VMA(4) );
re.GetGlobalFog( VMA(1), VMA(2), VMA(3), VMA(4), VMA(5) );
return 0;
case CG_R_GET_VIEW_FOG:
re.GetViewFog( VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6] );
re.GetViewFog( VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), VMA(6), args[7] );
return 0;
case CG_GETCLIPBOARDDATA:
CL_GetClipboardData( VMA(1), args[2] );
Expand Down Expand Up @@ -1686,7 +1686,7 @@ intptr_t CL_CgameSystemCalls( intptr_t *args ) {
return getCameraInfo(args[1], VMA(2), VMA(3));
*/
case CG_GET_ENTITY_TOKEN:
return re.GetEntityToken( VMA(1), args[2] );
return CM_GetEntityToken( VMA(1), VMA(2), args[3] );
case CG_R_INPVS:
return re.inPVS( VMA(1), VMA(2) );

Expand Down
10 changes: 5 additions & 5 deletions code/game/g_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Suite 120, Rockville, Maryland 20850 USA.
// major 0 means each minor is an API break.
// major > 0 means each major is an API break and each minor extends API.
#define GAME_API_MAJOR_VERSION 0
#define GAME_API_MINOR_VERSION 11
#define GAME_API_MINOR_VERSION 13


// entity->svFlags
Expand Down Expand Up @@ -251,13 +251,13 @@ typedef enum {

G_GET_USERCMD, // ( int playerNum, usercmd_t *cmd )

G_GET_ENTITY_TOKEN, // qboolean ( char *buffer, int bufferSize )
G_GET_ENTITY_TOKEN, // qboolean ( int *parseOffset, char *buffer, int bufferSize )
// Retrieves the next string token from the entity spawn text, returning
// false when all tokens have been parsed.
// This should only be done at GAME_INIT time.

G_DEBUG_POLYGON_CREATE,
G_DEBUG_POLYGON_DELETE,
G_DEBUG_POLYGON_CREATE, // ( int color, int numPoints, vec3_t *points );
G_DEBUG_POLYGON_SHOW, // ( int id, int color, int numPoints, vec3_t *points );
G_DEBUG_POLYGON_DELETE, // ( int id );

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 );
Expand Down
2 changes: 1 addition & 1 deletion code/qcommon/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Suite 120, Rockville, Maryland 20850 USA.
// List of demo protocols that are supported for playback.
// Also plays protocol com_protocol
int demo_protocols[] =
{ PROTOCOL_VERSION, 3, 2, 0 };
{ PROTOCOL_VERSION, 4, 3, 2, 0 };

#define MAX_NUM_ARGVS 50

Expand Down
4 changes: 2 additions & 2 deletions code/qcommon/qcommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Suite 120, Rockville, Maryland 20850 USA.

// Keep this in-sync with VERSION in Makefile.
#ifndef PRODUCT_VERSION
#define PRODUCT_VERSION "0.2"
#define PRODUCT_VERSION "0.3"
#endif

#define Q3_VERSION PRODUCT_NAME " " PRODUCT_VERSION
Expand Down Expand Up @@ -318,7 +318,7 @@ PROTOCOL
==============================================================
*/

#define PROTOCOL_VERSION 4
#define PROTOCOL_VERSION 5
#define PROTOCOL_LEGACY_VERSION 0

// maintain a list of compatible protocols for demo playing
Expand Down
4 changes: 2 additions & 2 deletions code/renderercommon/tr_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ typedef struct {

void (*TakeVideoFrame)( int h, int w, byte* captureBuffer, byte *encodeBuffer, qboolean motionJpeg );

void (*GetGlobalFog)( fogType_t *type, vec3_t color, float *depthForOpaque, float *density );
void (*GetViewFog)( const vec3_t origin, fogType_t *type, vec3_t color, float *depthForOpaque, float *density, qboolean inwater );
void (*GetGlobalFog)( fogType_t *type, vec3_t color, float *depthForOpaque, float *density, float *farClip );
void (*GetViewFog)( const vec3_t origin, fogType_t *type, vec3_t color, float *depthForOpaque, float *density, float *farClip, qboolean inwater );

void (*SetSurfaceShader)( int surfaceNum, const char *name );
qhandle_t (*GetSurfaceShader)( int surfaceNum, int lightmapIndex );
Expand Down
3 changes: 3 additions & 0 deletions code/renderercommon/tr_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ typedef struct {

// for alphaGen skyAlpha and oneMinusSkyAlpha
float skyAlpha;

// maximum distance for the far clip plane
float farClip;
} refdef_t;


Expand Down
2 changes: 1 addition & 1 deletion code/renderergl1/tr_backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ void RB_BeginDrawingView (void) {
{
clearBits |= GL_STENCIL_BUFFER_BIT;
}
if ( ( backEnd.refdef.fogType == FT_LINEAR || r_fastsky->integer )
if ( ( backEnd.refdef.maxFarClip > 1 || r_fastsky->integer )
&& !( backEnd.refdef.rdflags & (RDF_NOWORLDMODEL|RDF_NOSKY) ) ) {
clearBits |= GL_COLOR_BUFFER_BIT;

Expand Down
1 change: 1 addition & 0 deletions code/renderergl1/tr_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2165,6 +2165,7 @@ void RE_LoadWorldMap( const bspFile_t *bsp ) {
VectorCopy( shader->fogParms.color, tr.globalFogColor );
tr.globalFogDepthForOpaque = shader->fogParms.depthForOpaque;
tr.globalFogDensity = shader->fogParms.density;
tr.globalFogFarClip = shader->fogParms.farClip;
}

R_InitExternalShaders();
Expand Down
16 changes: 14 additions & 2 deletions code/renderergl1/tr_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ void RE_2DPolyies( polyVert_t* verts, int numverts, qhandle_t hShader ) {
RE_GetGlobalFog
====================
*/
void RE_GetGlobalFog( fogType_t *type, vec3_t color, float *depthForOpaque, float *density ) {
void RE_GetGlobalFog( fogType_t *type, vec3_t color, float *depthForOpaque, float *density, float *farClip ) {
if (type) {
*type = tr.globalFogType;
}
Expand All @@ -464,6 +464,10 @@ void RE_GetGlobalFog( fogType_t *type, vec3_t color, float *depthForOpaque, floa
if (density) {
*density = tr.globalFogDensity;
}

if (farClip) {
*farClip = tr.globalFogFarClip;
}
}

/*
Expand Down Expand Up @@ -498,22 +502,25 @@ qboolean R_PointInBrush( const vec3_t point, const bmodel_t *bmodel ) {
RE_GetViewFog
====================
*/
void RE_GetViewFog( const vec3_t origin, fogType_t *type, vec3_t color, float *depthForOpaque, float *density, qboolean inwater ) {
void RE_GetViewFog( const vec3_t origin, fogType_t *type, vec3_t color, float *depthForOpaque, float *density, float *farClip, qboolean inwater ) {
fogType_t fogType;
vec3_t fogColor;
float fogDepthForOpaque;
float fogDensity;
float fogFarClip;

if ( inwater ) {
fogType = tr.waterFogParms.fogType;
VectorCopy( tr.waterFogParms.color, fogColor );
fogDepthForOpaque = tr.waterFogParms.depthForOpaque;
fogDensity = tr.waterFogParms.density;
fogFarClip = tr.waterFogParms.farClip;
} else {
fogType = FT_NONE;
VectorSet( fogColor, 0, 0, 0 );
fogDepthForOpaque = 0;
fogDensity = 0;
fogFarClip = 0;
}

if ( tr.world && tr.world->numBModels > 1 ) {
Expand Down Expand Up @@ -541,6 +548,7 @@ void RE_GetViewFog( const vec3_t origin, fogType_t *type, vec3_t color, float *d
VectorCopy( surface->shader->viewFogParms.color, fogColor );
fogDepthForOpaque = surface->shader->viewFogParms.depthForOpaque;
fogDensity = surface->shader->viewFogParms.density;
fogFarClip = surface->shader->viewFogParms.farClip;
break;
}
}
Expand All @@ -566,6 +574,10 @@ void RE_GetViewFog( const vec3_t origin, fogType_t *type, vec3_t color, float *d
if (density) {
*density = fogDensity;
}

if (farClip) {
*farClip = fogFarClip;
}
}

#define MODE_RED_CYAN 1
Expand Down
9 changes: 7 additions & 2 deletions code/renderergl1/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ typedef struct {
vec3_t color;
float depthForOpaque;
float density;
float farClip;
} fogParms_t;


Expand Down Expand Up @@ -458,6 +459,9 @@ typedef struct {
float fogDensity;
float fogTcScale;

// maximum distance for the far clip plane
float maxFarClip;

int num_entities;
trRefEntity_t *entities;

Expand Down Expand Up @@ -1101,6 +1105,7 @@ typedef struct {
vec3_t globalFogColor;
float globalFogDepthForOpaque;
float globalFogDensity;
float globalFogFarClip;

// set by skyfogvars in a shader
fogType_t skyFogType;
Expand Down Expand Up @@ -1856,8 +1861,8 @@ size_t RE_SaveJPGToBuffer(byte *buffer, size_t bufSize, int quality,
void RE_SaveTGA(char * filename, int image_width, int image_height, byte *image_buffer, int padding);
void RE_TakeVideoFrame( int width, int height,
byte *captureBuffer, byte *encodeBuffer, qboolean motionJpeg );
void RE_GetGlobalFog( fogType_t *type, vec3_t color, float *depthForOpaque, float *density );
void RE_GetViewFog( const vec3_t origin, fogType_t *type, vec3_t color, float *depthForOpaque, float *density, qboolean inwater );
void RE_GetGlobalFog( fogType_t *type, vec3_t color, float *depthForOpaque, float *density, float *farClip );
void RE_GetViewFog( const vec3_t origin, fogType_t *type, vec3_t color, float *depthForOpaque, float *density, float *farClip, qboolean inwater );

//------------------------------------------------------------------------------
// Ridah, mesh compression
Expand Down
5 changes: 2 additions & 3 deletions code/renderergl1/tr_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -701,9 +701,8 @@ static void R_SetFarClip( void )
}
tr.viewParms.zFar = sqrt( farthestCornerDistance );

// global fog
if ( tr.refdef.fogType == FT_LINEAR && tr.refdef.fogDepthForOpaque > 1 && tr.refdef.fogDepthForOpaque < tr.viewParms.zFar ) {
tr.viewParms.zFar = tr.refdef.fogDepthForOpaque;
if ( tr.refdef.maxFarClip > 1 && tr.refdef.maxFarClip < tr.viewParms.zFar ) {
tr.viewParms.zFar = tr.refdef.maxFarClip;
}
}

Expand Down
2 changes: 2 additions & 0 deletions code/renderergl1/tr_scene.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,8 @@ void RE_RenderScene( const refdef_t *vmRefDef, int vmRefDefSize ) {
}
tr.refdef.fogTcScale = R_FogTcScale( tr.refdef.fogType, tr.refdef.fogDepthForOpaque, tr.refdef.fogDensity );

tr.refdef.maxFarClip = fd.farClip;

// copy the areamask data over and note if it has changed, which
// will force a reset of the visible leafs even if the view hasn't moved
tr.refdef.areamaskModified = qfalse;
Expand Down
8 changes: 8 additions & 0 deletions code/renderergl1/tr_shader.c
Original file line number Diff line number Diff line change
Expand Up @@ -2542,12 +2542,14 @@ static qboolean ParseShader( char **text )
if ( !Q_stricmp( token, "linear" ) ) {
shader.fogParms.fogType = FT_LINEAR;
shader.fogParms.density = DEFAULT_FOG_LINEAR_DENSITY;
shader.fogParms.farClip = shader.fogParms.depthForOpaque;
} else {
if ( Q_stricmp( token, "exp" ) && !Q_isanumber( token ) )
ri.Printf( PRINT_WARNING, "WARNING: unknown fog type '%s' for 'fogParms' keyword in shader '%s'\n", token, shader.name );

shader.fogParms.fogType = FT_EXP;
shader.fogParms.density = DEFAULT_FOG_EXP_DENSITY;
shader.fogParms.farClip = 0;
}

// note: skips any old gradient directions
Expand Down Expand Up @@ -2634,10 +2636,12 @@ static qboolean ParseShader( char **text )
tr.waterFogParms.fogType = FT_LINEAR;
tr.waterFogParms.depthForOpaque = fogvar;
tr.waterFogParms.density = DEFAULT_FOG_LINEAR_DENSITY;
tr.waterFogParms.farClip = fogvar;
} else {
tr.waterFogParms.fogType = FT_EXP;
tr.waterFogParms.density = fogvar;
tr.waterFogParms.depthForOpaque = DEFAULT_FOG_EXP_DEPTH_FOR_OPAQUE;
tr.waterFogParms.farClip = 0;
}

VectorCopy( waterColor, tr.waterFogParms.color );
Expand Down Expand Up @@ -2677,6 +2681,8 @@ static qboolean ParseShader( char **text )
shader.viewFogParms.depthForOpaque = DEFAULT_FOG_EXP_DEPTH_FOR_OPAQUE;
}

shader.viewFogParms.farClip = 0;

VectorCopy( viewColor, shader.viewFogParms.color );
continue;
}
Expand All @@ -2703,10 +2709,12 @@ static qboolean ParseShader( char **text )
tr.globalFogType = FT_LINEAR;
tr.globalFogDepthForOpaque = fogvar;
tr.globalFogDensity = DEFAULT_FOG_LINEAR_DENSITY;
tr.globalFogFarClip = fogvar;
} else {
tr.globalFogType = FT_EXP;
tr.globalFogDensity = fogvar;
tr.globalFogDepthForOpaque = DEFAULT_FOG_EXP_DEPTH_FOR_OPAQUE;
tr.globalFogFarClip = 0;
}

VectorCopy( fogColor, tr.globalFogColor );
Expand Down
9 changes: 3 additions & 6 deletions code/renderergl1/tr_sky.c
Original file line number Diff line number Diff line change
Expand Up @@ -778,12 +778,9 @@ void RB_StageIteratorSky( void ) {
return;
}

// RTCW doesn't draw sky if world global fog is linear.
// However, skies are drawn in sky box refdefs that use linear fog
// so cannot check if the current refdef uses linear fog.
// Water fog does not draw sky if there is linear fog.
if ( !r_globalLinearFogDrawSky->integer && ( tr.globalFogType == FT_LINEAR
|| ( ( backEnd.refdef.rdflags & RDF_UNDERWATER ) && backEnd.refdef.fogType == FT_LINEAR ) ) ) {
// RTCW doesn't draw sky if world/water global fog is linear (they use clip plane).
// Skies are drawn in sky box refdefs that use linear fog (they do not use clip plane).
if ( !r_globalLinearFogDrawSky->integer && backEnd.refdef.fogType == FT_LINEAR && backEnd.refdef.maxFarClip > 1 ) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion code/renderergl2/tr_backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ void RB_BeginDrawingView (void) {
{
clearBits |= GL_STENCIL_BUFFER_BIT;
}
if ( ( backEnd.refdef.fogType == FT_LINEAR || r_fastsky->integer )
if ( ( backEnd.refdef.maxFarClip > 1 || r_fastsky->integer )
&& !( backEnd.refdef.rdflags & (RDF_NOWORLDMODEL|RDF_NOSKY) ) ) {
clearBits |= GL_COLOR_BUFFER_BIT;

Expand Down
1 change: 1 addition & 0 deletions code/renderergl2/tr_bsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3934,6 +3934,7 @@ void RE_LoadWorldMap( const bspFile_t *bsp ) {
VectorCopy( shader->fogParms.color, tr.globalFogColor );
tr.globalFogDepthForOpaque = shader->fogParms.depthForOpaque;
tr.globalFogDensity = shader->fogParms.density;
tr.globalFogFarClip = shader->fogParms.farClip;
}

R_InitExternalShaders();
Expand Down
Loading

0 comments on commit 35fe7b2

Please sign in to comment.