diff --git a/engine/client/cl_game.c b/engine/client/cl_game.c index cbfd3cc9..dffa9bce 100644 --- a/engine/client/cl_game.c +++ b/engine/client/cl_game.c @@ -519,7 +519,7 @@ static void SPR_DrawGeneric( int frame, float x, float y, float width, float hei // scale for screen sizes SPR_AdjustSize( &x, &y, &width, &height ); - texnum = ref.dllFuncs.SpriteTexture( clgame.ds.pSprite, frame ); + texnum = ref.dllFuncs.R_GetSpriteTexture( clgame.ds.pSprite, frame ); ref.dllFuncs.Color4ub( clgame.ds.spriteColor[0], clgame.ds.spriteColor[1], clgame.ds.spriteColor[2], clgame.ds.spriteColor[3] ); ref.dllFuncs.R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, texnum ); } @@ -3238,6 +3238,26 @@ void TriColor4fRendermode( float r, float g, float b, float a, int rendermode ) else ref.dllFuncs.Color4f( r * a, g * a, b * a, 1.0f ); } + +/* +============= +TriSpriteTexture + +bind current texture +============= +*/ +int TriSpriteTexture( model_t *pSpriteModel, int frame ) +{ + int gl_texturenum; + + if(( gl_texturenum = ref.dllFuncs.R_GetSpriteTexture( pSpriteModel, frame )) <= 0 ) + return 0; + + ref.dllFuncs.GL_Bind( XASH_TEXTURE0, gl_texturenum ); + + return 1; +} + /* ================= DemoApi implementation diff --git a/engine/client/ref_common.c b/engine/client/ref_common.c index 501fab9a..df11a105 100644 --- a/engine/client/ref_common.c +++ b/engine/client/ref_common.c @@ -420,7 +420,7 @@ static void CL_FillTriAPIFromRef( triangleapi_t *dst, const ref_interface_t *src dst->Vertex3fv = src->Vertex3fv; dst->Brightness = TriBrightness; dst->CullFace = TriCullFace; - dst->SpriteTexture = src->SpriteTexture; + dst->SpriteTexture = TriSpriteTexture; dst->WorldToScreen = TriWorldToScreen; dst->Fog = src->Fog; dst->ScreenToWorld = src->ScreenToWorld; diff --git a/engine/ref_api.h b/engine/ref_api.h index d2f978aa..08dc265b 100644 --- a/engine/ref_api.h +++ b/engine/ref_api.h @@ -507,6 +507,7 @@ typedef struct ref_interface_s // sprites void (*R_GetSpriteParms)( int *frameWidth, int *frameHeight, int *numFrames, int currentFrame, const model_t *pSprite ); + int (*R_GetSpriteTexture)( const model_t *m_pSpriteModel, int frame ); // model management // flags ignored for everything except spritemodels @@ -592,7 +593,6 @@ typedef struct ref_interface_s void (*TexCoord2f)( float u, float v ); void (*Vertex3fv)( const float *worldPnt ); void (*Vertex3f)( float x, float y, float z ); - int (*SpriteTexture)( struct model_s *pSpriteModel, int frame ); int (*WorldToScreen)( const float *world, float *screen ); // Returns 1 if it's z clipped void (*Fog)( float flFogColor[3], float flStart, float flEnd, int bOn ); //Works just like GL_FOG, flFogColor is r/g/b. void (*ScreenToWorld)( const float *screen, float *world ); diff --git a/ref_gl/gl_context.c b/ref_gl/gl_context.c index 09a168a6..71e978c8 100644 --- a/ref_gl/gl_context.c +++ b/ref_gl/gl_context.c @@ -446,6 +446,7 @@ ref_interface_t gReffuncs = CL_RunLightStyles, R_GetSpriteParms, + R_GetSpriteTexture, Mod_LoadMapSprite, Mod_ProcessRenderData, @@ -511,7 +512,6 @@ ref_interface_t gReffuncs = TriTexCoord2f, TriVertex3fv, TriVertex3f, - TriSpriteTexture, TriWorldToScreen, TriFog, R_ScreenToWorld, diff --git a/ref_gl/gl_triapi.c b/ref_gl/gl_triapi.c index 923fea18..01ca181d 100644 --- a/ref_gl/gl_triapi.c +++ b/ref_gl/gl_triapi.c @@ -237,7 +237,7 @@ int TriSpriteTexture( model_t *pSpriteModel, int frame ) GL_Bind( XASH_TEXTURE0, gl_texturenum ); - return gl_texturenum; + return 1; } /*