From 609235b4f1548a91cbf417465a6ef05ccb07b735 Mon Sep 17 00:00:00 2001 From: mittorn Date: Thu, 31 Oct 2019 01:52:38 +0700 Subject: [PATCH] ref_soft: fix texcoords on image blitting --- r_draw.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/r_draw.c b/r_draw.c index 3525e6b2..6515169d 100644 --- a/r_draw.c +++ b/r_draw.c @@ -63,7 +63,7 @@ int GAME_EXPORT R_GetSpriteTexture( const model_t *m_pSpriteModel, int frame ) Draw_StretchPicImplementation ============= */ -void R_DrawStretchPicImplementation (int x, int y, int w, int h, int s1, int t1, int s2, int t2, image_t *pic) +void R_DrawStretchPicImplementation( int x, int y, int w, int h, int s1, int t1, int s2, int t2, image_t *pic ) { pixel_t *source, *dest; unsigned int v, u, sv; @@ -127,9 +127,8 @@ void R_DrawStretchPicImplementation (int x, int y, int w, int h, int s1, int t1, { f = 0; - fstep = s2*0x10000/w; - if( w == s2 - s1 ) - fstep = 0x10000; + fstep = ((s2-s1) << 16)/w; + #if 0 for (u=0 ; uwidth, height = pic->height; // GL_Bind( XASH_TEXTURE0, texnum ); - if( s2 > 1 || t2 > 2 ) + if( s2 > 1.0f || t2 > 1.0f ) return; - if( w <= 0 || h <= 0 ) + if( s1 < 0.0f || t1 < 0.0f ) return; - R_DrawStretchPicImplementation(x,y,w,h, pic->width * s1, pic->height * t1, pic->width * s2, pic->height * t2, pic); + if( w < 1.0f || h < 1.0f ) + return; + R_DrawStretchPicImplementation(x,y,w,h, width * s1, height * t1, width * s2, height * t2, pic); } void Draw_Fill (int x, int y, int w, int h)