Browse Source

Fix SpriteTexture

pull/2/head
mittorn 6 years ago
parent
commit
0a22040c6e
  1. 22
      engine/client/cl_game.c
  2. 2
      engine/client/ref_common.c
  3. 2
      engine/ref_api.h
  4. 2
      ref_gl/gl_context.c
  5. 2
      ref_gl/gl_triapi.c

22
engine/client/cl_game.c

@ -519,7 +519,7 @@ static void SPR_DrawGeneric( int frame, float x, float y, float width, float hei @@ -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 ) @@ -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

2
engine/client/ref_common.c

@ -420,7 +420,7 @@ static void CL_FillTriAPIFromRef( triangleapi_t *dst, const ref_interface_t *src @@ -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;

2
engine/ref_api.h

@ -507,6 +507,7 @@ typedef struct ref_interface_s @@ -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 @@ -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 );

2
ref_gl/gl_context.c

@ -446,6 +446,7 @@ ref_interface_t gReffuncs = @@ -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 = @@ -511,7 +512,6 @@ ref_interface_t gReffuncs =
TriTexCoord2f,
TriVertex3fv,
TriVertex3f,
TriSpriteTexture,
TriWorldToScreen,
TriFog,
R_ScreenToWorld,

2
ref_gl/gl_triapi.c

@ -237,7 +237,7 @@ int TriSpriteTexture( model_t *pSpriteModel, int frame ) @@ -237,7 +237,7 @@ int TriSpriteTexture( model_t *pSpriteModel, int frame )
GL_Bind( XASH_TEXTURE0, gl_texturenum );
return gl_texturenum;
return 1;
}
/*

Loading…
Cancel
Save