From 3d8fe065b5c13b5ab042a12d66a95daf1f50e63c Mon Sep 17 00:00:00 2001 From: mittorn Date: Mon, 25 Mar 2019 21:18:47 +0700 Subject: [PATCH] ref_soft: Fix windows build --- r_context.c | 2 +- r_image.c | 6 ++++-- r_triapi.c | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/r_context.c b/r_context.c index 2f2a9693..75158b3c 100644 --- a/r_context.c +++ b/r_context.c @@ -708,7 +708,7 @@ ref_interface_t gReffuncs = VGUI_GenerateTexture, }; -int GAME_EXPORT GetRefAPI( int version, ref_interface_t *funcs, ref_api_t *engfuncs, ref_globals_t *globals ) +int EXPORT GAME_EXPORT GetRefAPI( int version, ref_interface_t *funcs, ref_api_t *engfuncs, ref_globals_t *globals ) { if( version != REF_API_VERSION ) return 0; diff --git a/r_image.c b/r_image.c index 200b4eb7..17a840fd 100644 --- a/r_image.c +++ b/r_image.c @@ -493,6 +493,7 @@ static qboolean GL_UploadTexture( image_t *tex, rgbdata_t *pic ) uint offset = 0; qboolean normalMap; const byte *bufend; + int mipCount; tex->fogParams[0] = pic->fogParams[0]; tex->fogParams[1] = pic->fogParams[1]; @@ -511,7 +512,7 @@ static qboolean GL_UploadTexture( image_t *tex, rgbdata_t *pic ) buf = pic->buffer; - int mipCount = 4;//GL_CalcMipmapCount( tex, ( buf != NULL )); + mipCount = 4;//GL_CalcMipmapCount( tex, ( buf != NULL )); // NOTE: only single uncompressed textures can be resamples, no mips, no layers, no sides if(( tex->depth == 1 ) && ( pic->width != tex->width ) || ( pic->height != tex->height )) @@ -524,6 +525,7 @@ static qboolean GL_UploadTexture( image_t *tex, rgbdata_t *pic ) // mips will be auto-generated if desired for( j = 0; j < mipCount; j++ ) { + int x, y; width = Q_max( 1, ( tex->width >> j )); height = Q_max( 1, ( tex->height >> j )); texsize = GL_CalcTextureSize( width, height, tex->depth ); @@ -532,7 +534,7 @@ static qboolean GL_UploadTexture( image_t *tex, rgbdata_t *pic ) tex->pixels[j] = Mem_Calloc( r_temppool, width * height * sizeof(pixel_t) + 64 ); if( j == 0 && tex->flags & TF_HAS_ALPHA ) tex->alpha_pixels = Mem_Calloc( r_temppool, width * height * sizeof(pixel_t) + 64 ); - int x, y; + for(i = 0; i < height * width; i++ ) { diff --git a/r_triapi.c b/r_triapi.c index 7f405fb0..47b81e6c 100644 --- a/r_triapi.c +++ b/r_triapi.c @@ -134,6 +134,7 @@ void _TriColor4f( float rr, float gg, float bb, float aa ) { //pglColor4f( r, g, b, a ); unsigned short r,g,b; + unsigned int major, minor; vid.alpha = aa * 7; @@ -150,10 +151,10 @@ void _TriColor4f( float rr, float gg, float bb, float aa ) r = rr * 31, g = gg * 63, b = bb * 31; - unsigned int major = (((r >> 2) & MASK(3)) << 5) |( (( (g >> 3) & MASK(3)) << 2 ) )| (((b >> 3) & MASK(2))); + major = (((r >> 2) & MASK(3)) << 5) |( (( (g >> 3) & MASK(3)) << 2 ) )| (((b >> 3) & MASK(2))); // save minor GBRGBRGB - unsigned int minor = MOVE_BIT(r,1,5) | MOVE_BIT(r,0,2) | MOVE_BIT(g,2,7) | MOVE_BIT(g,1,4) | MOVE_BIT(g,0,1) | MOVE_BIT(b,2,6)| MOVE_BIT(b,1,3)|MOVE_BIT(b,0,0); + minor = MOVE_BIT(r,1,5) | MOVE_BIT(r,0,2) | MOVE_BIT(g,2,7) | MOVE_BIT(g,1,4) | MOVE_BIT(g,0,1) | MOVE_BIT(b,2,6)| MOVE_BIT(b,1,3)|MOVE_BIT(b,0,0); vid.color = major << 8 | (minor & 0xFF); }