Formatting changes

This commit is contained in:
sago007
2016-11-27 11:46:04 +01:00
parent f5c2b2d71b
commit 8a0c6dd04b

View File

@@ -285,8 +285,7 @@ static void InitOpenGL( void )
// - r_gamma
//
if ( glConfig.vidWidth == 0 )
{
if ( glConfig.vidWidth == 0 ) {
GLint temp;
GLimp_Init();
@@ -300,8 +299,7 @@ static void InitOpenGL( void )
glConfig.maxTextureSize = temp;
// stubbed or broken drivers may have reported 0...
if ( glConfig.maxTextureSize <= 0 )
{
if ( glConfig.maxTextureSize <= 0 ) {
glConfig.maxTextureSize = 0;
}
}
@@ -315,7 +313,8 @@ static void InitOpenGL( void )
GL_CheckErrors
==================
*/
void GL_CheckErrors( void ) {
void GL_CheckErrors( void )
{
int err;
char s[64];
@@ -357,15 +356,13 @@ void GL_CheckErrors( void ) {
/*
** R_GetModeInfo
*/
typedef struct vidmode_s
{
typedef struct vidmode_s {
const char *description;
int width, height;
float pixelAspect; // pixel width / height
} vidmode_t;
vidmode_t r_vidModes[] =
{
vidmode_t r_vidModes[] = {
{ "Mode 0: 320x240", 320, 240, 1 },
{ "Mode 1: 400x300", 400, 300, 1 },
{ "Mode 2: 512x384", 512, 384, 1 },
@@ -397,7 +394,8 @@ vidmode_t r_vidModes[] =
};
static int s_numVidModes = ARRAY_LEN( r_vidModes );
qboolean R_GetModeInfo( int *width, int *height, float *windowAspect, int mode ) {
qboolean R_GetModeInfo( int *width, int *height, float *windowAspect, int mode )
{
vidmode_t *vm;
float pixelAspect;
@@ -412,7 +410,8 @@ qboolean R_GetModeInfo( int *width, int *height, float *windowAspect, int mode )
*width = r_customwidth->integer;
*height = r_customheight->integer;
pixelAspect = r_customPixelAspect->value;
} else {
}
else {
vm = &r_vidModes[mode];
*width = vm->width;
@@ -433,8 +432,7 @@ static void R_ModeList_f( void )
int i;
ri.Printf( PRINT_ALL, "\n" );
for ( i = 0; i < s_numVidModes; i++ )
{
for ( i = 0; i < s_numVidModes; i++ ) {
ri.Printf( PRINT_ALL, "%s\n", r_vidModes[i].description );
}
ri.Printf( PRINT_ALL, "\n" );
@@ -532,12 +530,10 @@ void RB_TakeScreenshot(int x, int y, int width, int height, char *fileName)
srcptr = destptr = allbuf + offset;
endmem = srcptr + (linelen + padlen) * height;
while(srcptr < endmem)
{
while(srcptr < endmem) {
endline = srcptr + linelen;
while(srcptr < endline)
{
while(srcptr < endline) {
temp = srcptr[0];
*destptr++ = srcptr[2];
*destptr++ = srcptr[1];
@@ -594,13 +590,14 @@ RB_TakeScreenshotCmd
extern int tvWidth;
extern int tvHeight;
const void *RB_TakeScreenshotCmd( const void *data ) {
const void *RB_TakeScreenshotCmd( const void *data )
{
const screenshotCommand_t *cmd;
cmd = (const screenshotCommand_t *)data;
// leilei - hack for tvmode
if (r_tvMode->integer > -1){
if (r_tvMode->integer > -1) {
if (cmd->jpeg)
RB_TakeScreenshotJPEG( cmd->x, cmd->y, tvWidth, tvHeight, cmd->fileName);
@@ -621,7 +618,8 @@ const void *RB_TakeScreenshotCmd( const void *data ) {
R_TakeScreenshot
==================
*/
void R_TakeScreenshot( int x, int y, int width, int height, char *name, qboolean jpeg ) {
void R_TakeScreenshot( int x, int y, int width, int height, char *name, qboolean jpeg )
{
static char fileName[MAX_OSPATH]; // bad things if two screenshots per frame?
screenshotCommand_t *cmd;
@@ -645,7 +643,8 @@ void R_TakeScreenshot( int x, int y, int width, int height, char *name, qboolean
R_ScreenshotFilename
==================
*/
void R_ScreenshotFilename( int lastNumber, char *fileName ) {
void R_ScreenshotFilename( int lastNumber, char *fileName )
{
int a,b,c,d;
if ( lastNumber < 0 || lastNumber > 9999 ) {
@@ -670,7 +669,8 @@ void R_ScreenshotFilename( int lastNumber, char *fileName ) {
R_ScreenshotFilename
==================
*/
void R_ScreenshotFilenameJPEG( int lastNumber, char *fileName ) {
void R_ScreenshotFilenameJPEG( int lastNumber, char *fileName )
{
int a,b,c,d;
if ( lastNumber < 0 || lastNumber > 9999 ) {
@@ -698,7 +698,8 @@ levelshots are specialized 128*128 thumbnails for
the menu system, sampled down from full screen distorted images
====================
*/
void R_LevelShot( void ) {
void R_LevelShot( void )
{
char checkname[MAX_OSPATH];
byte *buffer;
byte *source, *allsource;
@@ -769,7 +770,8 @@ screenshot [filename]
Doesn't print the pacifier message if there is a second arg
==================
*/
void R_ScreenShot_f (void) {
void R_ScreenShot_f (void)
{
char checkname[MAX_OSPATH];
static int lastNumber = -1;
qboolean silent;
@@ -781,14 +783,16 @@ void R_ScreenShot_f (void) {
if ( !strcmp( ri.Cmd_Argv(1), "silent" ) ) {
silent = qtrue;
} else {
}
else {
silent = qfalse;
}
if ( ri.Cmd_Argc() == 2 && !silent ) {
// explicit filename
Com_sprintf( checkname, MAX_OSPATH, "screenshots/%s.tga", ri.Cmd_Argv( 1 ) );
} else {
}
else {
// scan for a free filename
// if we have saved a previous screenshot, don't scan
@@ -801,8 +805,7 @@ void R_ScreenShot_f (void) {
for ( ; lastNumber <= 9999 ; lastNumber++ ) {
R_ScreenshotFilename( lastNumber, checkname );
if (!ri.FS_FileExists( checkname ))
{
if (!ri.FS_FileExists( checkname )) {
break; // file doesn't exist
}
}
@@ -822,7 +825,8 @@ void R_ScreenShot_f (void) {
}
}
void R_ScreenShotJPEG_f (void) {
void R_ScreenShotJPEG_f (void)
{
char checkname[MAX_OSPATH];
static int lastNumber = -1;
qboolean silent;
@@ -834,14 +838,16 @@ void R_ScreenShotJPEG_f (void) {
if ( !strcmp( ri.Cmd_Argv(1), "silent" ) ) {
silent = qtrue;
} else {
}
else {
silent = qfalse;
}
if ( ri.Cmd_Argc() == 2 && !silent ) {
// explicit filename
Com_sprintf( checkname, MAX_OSPATH, "screenshots/%s.jpg", ri.Cmd_Argv( 1 ) );
} else {
}
else {
// scan for a free filename
// if we have saved a previous screenshot, don't scan
@@ -854,8 +860,7 @@ void R_ScreenShotJPEG_f (void) {
for ( ; lastNumber <= 9999 ; lastNumber++ ) {
R_ScreenshotFilenameJPEG( lastNumber, checkname );
if (!ri.FS_FileExists( checkname ))
{
if (!ri.FS_FileExists( checkname )) {
break; // file doesn't exist
}
}
@@ -914,15 +919,13 @@ const void *RB_TakeVideoFrameCmd( const void *data )
if(glConfig.deviceSupportsGamma)
R_GammaCorrect(cBuf, memcount);
if(cmd->motionJpeg)
{
if(cmd->motionJpeg) {
memcount = RE_SaveJPGToBuffer(cmd->encodeBuffer, linelen * cmd->height,
r_aviMotionJpegQuality->integer,
cmd->width, cmd->height, cBuf, padlen);
ri.CL_WriteAVIVideoFrame(cmd->encodeBuffer, memcount);
}
else
{
else {
byte *lineend, *memend;
byte *srcptr, *destptr;
@@ -931,11 +934,9 @@ const void *RB_TakeVideoFrameCmd( const void *data )
memend = srcptr + memcount;
// swap R and B and remove line paddings
while(srcptr < memend)
{
while(srcptr < memend) {
lineend = srcptr + linelen;
while(srcptr < lineend)
{
while(srcptr < lineend) {
*destptr++ = srcptr[2];
*destptr++ = srcptr[1];
*destptr++ = srcptr[0];
@@ -1008,14 +1009,14 @@ R_PrintLongString
Workaround for ri.Printf's 1024 characters buffer limit.
================
*/
void R_PrintLongString(const char *string) {
void R_PrintLongString(const char *string)
{
char buffer[1024];
const char *p;
int size = strlen(string);
p = string;
while(size > 0)
{
while(size > 0) {
Q_strncpyz(buffer, p, sizeof (buffer) );
ri.Printf( PRINT_ALL, "%s", buffer );
p += 1023;
@@ -1030,13 +1031,11 @@ GfxInfo_f
*/
void GfxInfo_f( void )
{
const char *enablestrings[] =
{
const char *enablestrings[] = {
"disabled",
"enabled"
};
const char *fsstrings[] =
{
const char *fsstrings[] = {
"windowed",
"fullscreen"
};
@@ -1051,20 +1050,16 @@ void GfxInfo_f( void )
ri.Printf( PRINT_ALL, "GL_MAX_TEXTURE_UNITS_ARB: %d\n", glConfig.numTextureUnits );
ri.Printf( PRINT_ALL, "\nPIXELFORMAT: color(%d-bits) Z(%d-bit) stencil(%d-bits)\n", glConfig.colorBits, glConfig.depthBits, glConfig.stencilBits );
ri.Printf( PRINT_ALL, "MODE: %d, %d x %d %s hz:", r_mode->integer, glConfig.vidWidth, glConfig.vidHeight, fsstrings[r_fullscreen->integer == 1] );
if ( glConfig.displayFrequency )
{
if ( glConfig.displayFrequency ) {
ri.Printf( PRINT_ALL, "%d\n", glConfig.displayFrequency );
}
else
{
else {
ri.Printf( PRINT_ALL, "N/A\n" );
}
if ( glConfig.deviceSupportsGamma )
{
if ( glConfig.deviceSupportsGamma ) {
ri.Printf( PRINT_ALL, "GAMMA: hardware w/ %d overbright bits\n", tr.overbrightBits );
}
else
{
else {
ri.Printf( PRINT_ALL, "GAMMA: software w/ %d overbright bits\n", tr.overbrightBits );
}
@@ -1078,17 +1073,21 @@ void GfxInfo_f( void )
if ( primitives == 0 ) {
if ( qglLockArraysEXT ) {
primitives = 2;
} else {
}
else {
primitives = 1;
}
}
if ( primitives == -1 ) {
ri.Printf( PRINT_ALL, "none\n" );
} else if ( primitives == 2 ) {
}
else if ( primitives == 2 ) {
ri.Printf( PRINT_ALL, "single glDrawElements\n" );
} else if ( primitives == 1 ) {
}
else if ( primitives == 1 ) {
ri.Printf( PRINT_ALL, "multiple glArrayElement\n" );
} else if ( primitives == 3 ) {
}
else if ( primitives == 3 ) {
ri.Printf( PRINT_ALL, "multiple glColor4ubv + glTexCoord2fv + glVertex3fv\n" );
}
}
@@ -1101,22 +1100,19 @@ void GfxInfo_f( void )
ri.Printf( PRINT_ALL, "texenv add: %s\n", enablestrings[glConfig.textureEnvAddAvailable != 0] );
ri.Printf( PRINT_ALL, "compressed textures: %s\n", enablestrings[glConfig.textureCompression!=TC_NONE] );
ri.Printf( PRINT_ALL, "glsl programs: %s\n", enablestrings[vertexShaders] );
if ( r_vertexLight->integer || glConfig.hardwareType == GLHW_PERMEDIA2 )
{
if ( r_vertexLight->integer || glConfig.hardwareType == GLHW_PERMEDIA2 ) {
ri.Printf( PRINT_ALL, "HACK: using vertex lightmap approximation\n" );
}
if ( glConfig.hardwareType == GLHW_RAGEPRO )
{
if ( glConfig.hardwareType == GLHW_RAGEPRO ) {
ri.Printf( PRINT_ALL, "HACK: ragePro approximations\n" );
}
if ( glConfig.hardwareType == GLHW_RIVA128 )
{
if ( glConfig.hardwareType == GLHW_RIVA128 ) {
ri.Printf( PRINT_ALL, "HACK: riva128 approximations\n" );
}
if ( r_finish->integer ) {
ri.Printf( PRINT_ALL, "Forcing glFinish\n" );
}
if (voodootype){
if (voodootype) {
if (voodootype == 1)
ri.Printf( PRINT_ALL, "3Dfx Voodoo Graphics assumed\n" );
@@ -1140,9 +1136,9 @@ R_Register
*/
void R_Register( void )
{
#ifdef USE_RENDERER_DLOPEN
#ifdef USE_RENDERER_DLOPEN
com_altivec = ri.Cvar_Get("com_altivec", "1", CVAR_ARCHIVE);
#endif
#endif
#if defined( _WIN32 )
// leilei - Get some version info first, code torn from quake
@@ -1385,7 +1381,8 @@ void R_Register( void )
* R_GLSL_AllocProgram
* Reserve memory for program
*/
static glslProgram_t *R_GLSL_AllocProgram(void) {
static glslProgram_t *R_GLSL_AllocProgram(void)
{
glslProgram_t *program;
if (tr.numPrograms == MAX_PROGRAMS)
@@ -1446,7 +1443,8 @@ static glslProgram_t *R_GLSL_AllocProgram(void) {
* Load all default GLSL programs which are not loaded via the q3 shader system
*/
void R_GLSL_Init(void) {
void R_GLSL_Init(void)
{
#ifdef GLSL_BACKEND
glslProgram_t *program;
char programVertexObjects[MAX_PROGRAM_OBJECTS][MAX_QPATH];
@@ -1549,8 +1547,7 @@ void R_GLSL_Init(void) {
Q_strncpyz(programFragmentObjects[0], "glsl/ntsc_bleed_fp.glsl", sizeof(programFragmentObjects[0]));
tr.NTSCBleedProgram = RE_GLSL_RegisterProgram("ntsc_bleed", (const char *)programVertexObjects, 1, (const char *)programFragmentObjects, 1);
if (strcmp( (const char *)r_postprocess->string, "none" ))
{
if (strcmp( (const char *)r_postprocess->string, "none" )) {
sprintf(p,"glsl/%s_vp.glsl",r_postprocess->string);
Q_strncpyz(programVertexObjects[0], (const char *)&p, sizeof(programVertexObjects[0]));
sprintf(p,"glsl/%s_fp.glsl",r_postprocess->string);
@@ -1570,7 +1567,8 @@ extern qboolean initparticles;
R_Init
===============
*/
void R_Init( void ) {
void R_Init( void )
{
int err;
int i;
byte *ptr;
@@ -1595,26 +1593,21 @@ void R_Init( void ) {
//
// init function tables
//
for ( i = 0; i < FUNCTABLE_SIZE; i++ )
{
for ( i = 0; i < FUNCTABLE_SIZE; i++ ) {
tr.sinTable[i] = sin( DEG2RAD( i * 360.0f / ( ( float ) ( FUNCTABLE_SIZE - 1 ) ) ) );
tr.squareTable[i] = ( i < FUNCTABLE_SIZE/2 ) ? 1.0f : -1.0f;
tr.sawToothTable[i] = (float)i / FUNCTABLE_SIZE;
tr.inverseSawToothTable[i] = 1.0f - tr.sawToothTable[i];
if ( i < FUNCTABLE_SIZE / 2 )
{
if ( i < FUNCTABLE_SIZE / 4 )
{
if ( i < FUNCTABLE_SIZE / 2 ) {
if ( i < FUNCTABLE_SIZE / 4 ) {
tr.triangleTable[i] = ( float ) i / ( FUNCTABLE_SIZE / 4 );
}
else
{
else {
tr.triangleTable[i] = 1.0f - tr.triangleTable[i-FUNCTABLE_SIZE / 4];
}
}
else
{
else {
tr.triangleTable[i] = -tr.triangleTable[i-FUNCTABLE_SIZE/2];
}
}
@@ -1672,7 +1665,8 @@ void R_Init( void ) {
RE_Shutdown
===============
*/
void RE_Shutdown( qboolean destroyWindow ) {
void RE_Shutdown( qboolean destroyWindow )
{
ri.Printf( PRINT_ALL, "RE_Shutdown( %i )\n", destroyWindow );
@@ -1715,7 +1709,8 @@ RE_EndRegistration
Touch all images to make sure they are resident
=============
*/
void RE_EndRegistration( void ) {
void RE_EndRegistration( void )
{
R_IssuePendingRenderCommands();
if (!ri.Sys_LowPhysicalMemory()) {
RB_ShowImages();
@@ -1730,9 +1725,11 @@ GetRefAPI
@@@@@@@@@@@@@@@@@@@@@
*/
#ifdef USE_RENDERER_DLOPEN
Q_EXPORT refexport_t* QDECL GetRefAPI ( int apiVersion, refimport_t *rimp ) {
Q_EXPORT refexport_t* QDECL GetRefAPI ( int apiVersion, refimport_t *rimp )
{
#else
refexport_t *GetRefAPI ( int apiVersion, refimport_t *rimp ) {
refexport_t *GetRefAPI ( int apiVersion, refimport_t *rimp )
{
#endif
static refexport_t re;