Skip to content

Commit

Permalink
Merge remote-tracking branch 'ioquake/master' into flexible_hud
Browse files Browse the repository at this point in the history
  • Loading branch information
zturtleman committed Oct 7, 2019
2 parents d0205ce + 4d82b8b commit 35242be
Show file tree
Hide file tree
Showing 23 changed files with 1,032 additions and 205 deletions.
14 changes: 14 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# These are supported funding model platforms

patreon: timedoctor
open_collective: # Replace with a single Open Collective username
ko_fi: jackslater
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ['https://www.patreon.com/icculus', 'https://www.patreon.com/SmileTheory', 'https://ko-fi.com/zturtleman']


#please add your links to this if you've been a long-time contributor!
4 changes: 3 additions & 1 deletion code/client/cl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3088,8 +3088,10 @@ static __attribute__ ((format (printf, 2, 3))) void QDECL CL_RefPrintf( int prin
Com_Printf ("%s", msg);
} else if ( print_level == PRINT_WARNING ) {
Com_Printf (S_COLOR_YELLOW "%s", msg); // yellow
} else if ( print_level == PRINT_ERROR ) {
Com_Printf (S_COLOR_RED "%s", msg); // red
} else if ( print_level == PRINT_DEVELOPER ) {
Com_DPrintf (S_COLOR_RED "%s", msg); // red
Com_DPrintf (S_COLOR_RED "%s", msg); // red - developer only
}
}

Expand Down
24 changes: 20 additions & 4 deletions code/q3_ui/ui_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ static int resToRatio[ MAX_RESOLUTIONS ];

static char resbuf[ MAX_STRING_CHARS ];
static const char* detectedResolutions[ MAX_RESOLUTIONS ];
static char currentResolution[ 20 ];

static const char** resolutions = builtinResolutions;
static qboolean resolutionsDetected = qfalse;
Expand Down Expand Up @@ -487,7 +488,7 @@ GraphicsOptions_GetResolutions
*/
static void GraphicsOptions_GetResolutions( void )
{
Q_strncpyz(resbuf, UI_Cvar_VariableString("r_availableModes"), sizeof(resbuf));
trap_Cvar_VariableStringBuffer("r_availableModes", resbuf, sizeof(resbuf));
if(*resbuf)
{
char* s = resbuf;
Expand All @@ -501,11 +502,26 @@ static void GraphicsOptions_GetResolutions( void )
}
detectedResolutions[ i ] = NULL;

if( i > 0 )
// add custom resolution if not in mode list
if ( i < ARRAY_LEN(detectedResolutions)-1 )
{
resolutions = detectedResolutions;
resolutionsDetected = qtrue;
Com_sprintf( currentResolution, sizeof ( currentResolution ), "%dx%d", uis.glconfig.vidWidth, uis.glconfig.vidHeight );

for( i = 0; detectedResolutions[ i ]; i++ )
{
if ( strcmp( detectedResolutions[ i ], currentResolution ) == 0 )
break;
}

if ( detectedResolutions[ i ] == NULL )
{
detectedResolutions[ i++ ] = currentResolution;
detectedResolutions[ i ] = NULL;
}
}

resolutions = detectedResolutions;
resolutionsDetected = qtrue;
}
}

Expand Down
22 changes: 22 additions & 0 deletions code/qcommon/q_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,28 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// q_shared.c -- stateless support routines that are included in each code dll
#include "q_shared.h"

// ^[0-9a-zA-Z]
qboolean Q_IsColorString(const char *p) {
if (!p)
return qfalse;

if (p[0] != Q_COLOR_ESCAPE)
return qfalse;

if (p[1] == 0)
return qfalse;

// isalnum expects a signed integer in the range -1 (EOF) to 255, or it might assert on undefined behaviour
// a dereferenced char pointer has the range -128 to 127, so we just need to rangecheck the negative part
if (p[1] < 0)
return qfalse;

if (isalnum(p[1]) == 0)
return qfalse;

return qtrue;
}

float Com_Clamp( float min, float max, float value ) {
if ( value < min ) {
return min;
Expand Down
6 changes: 5 additions & 1 deletion code/qcommon/q_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ typedef vec_t vec3_t[3];
typedef vec_t vec4_t[4];
typedef vec_t vec5_t[5];

typedef vec_t quat_t[4];

typedef int fixed4_t;
typedef int fixed8_t;
typedef int fixed16_t;
Expand Down Expand Up @@ -409,7 +411,7 @@ extern vec4_t colorMdGrey;
extern vec4_t colorDkGrey;

#define Q_COLOR_ESCAPE '^'
#define Q_IsColorString(p) ((p) && *(p) == Q_COLOR_ESCAPE && *((p)+1) && isalnum(*((p)+1))) // ^[0-9a-zA-Z]
qboolean Q_IsColorString(const char *p); // ^[0-9a-zA-Z]

#define COLOR_BLACK '0'
#define COLOR_RED '1'
Expand Down Expand Up @@ -578,6 +580,8 @@ typedef struct {

#define Byte4Copy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])

#define QuatCopy(a,b) ((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2],(b)[3]=(a)[3])

#define SnapVector(v) {v[0]=((int)(v[0]));v[1]=((int)(v[1]));v[2]=((int)(v[2]));}
// just in case you don't want to use the macros
vec_t _DotProduct( const vec3_t v1, const vec3_t v2 );
Expand Down
1 change: 1 addition & 0 deletions code/renderercommon/tr_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ extern glconfig_t glConfig; // outside of TR since it shouldn't be cleared duri
extern qboolean textureFilterAnisotropic;
extern int maxAnisotropy;
extern float displayAspect;
extern qboolean haveClampToEdge;

//
// cvars
Expand Down
4 changes: 2 additions & 2 deletions code/renderergl1/tr_backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -794,8 +794,8 @@ void RE_UploadCinematic (int w, int h, int cols, int rows, const byte *data, int
qglTexImage2D( GL_TEXTURE_2D, 0, GL_RGB8, cols, rows, 0, GL_RGBA, GL_UNSIGNED_BYTE, data );
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, haveClampToEdge ? GL_CLAMP_TO_EDGE : GL_CLAMP );
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, haveClampToEdge ? GL_CLAMP_TO_EDGE : GL_CLAMP );
} else {
if (dirty) {
// otherwise, just subimage upload it so that drivers can tell we are going to be changing
Expand Down
2 changes: 1 addition & 1 deletion code/renderergl1/tr_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ image_t *R_CreateImage( const char *name, byte *pic, int width, int height,
image->width = width;
image->height = height;
if (flags & IMGFLAG_CLAMPTOEDGE)
glWrapClampMode = GL_CLAMP_TO_EDGE;
glWrapClampMode = haveClampToEdge ? GL_CLAMP_TO_EDGE : GL_CLAMP;
else
glWrapClampMode = GL_REPEAT;

Expand Down
2 changes: 2 additions & 0 deletions code/renderergl1/tr_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ glconfig_t glConfig;
qboolean textureFilterAnisotropic = qfalse;
int maxAnisotropy = 0;
float displayAspect = 0.0f;
qboolean haveClampToEdge = qfalse;

glstate_t glState;

Expand Down Expand Up @@ -1294,6 +1295,7 @@ void RE_Shutdown( qboolean destroyWindow ) {
textureFilterAnisotropic = qfalse;
maxAnisotropy = 0;
displayAspect = 0.0f;
haveClampToEdge = qfalse;

Com_Memset( &glState, 0, sizeof( glState ) );
}
Expand Down
11 changes: 9 additions & 2 deletions code/renderergl1/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,12 @@ typedef struct {
drawVert_t *verts;
} srfTriangles_t;

typedef struct {
vec3_t translate;
quat_t rotate;
vec3_t scale;
} iqmTransform_t;

// inter-quake-model
typedef struct {
int num_vertexes;
Expand Down Expand Up @@ -623,8 +629,9 @@ typedef struct {

char *jointNames;
int *jointParents;
float *jointMats;
float *poseMats;
float *bindJoints; // [num_joints * 12]
float *invBindJoints; // [num_joints * 12]
iqmTransform_t *poses; // [num_frames * num_poses]
float *bounds;
} iqmData_t;

Expand Down
Loading

0 comments on commit 35242be

Please sign in to comment.