summaryrefslogtreecommitdiff
path: root/source/gl_main.c
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2008-04-05 20:44:47 +0000
committerAndrey Nazarov <skuller@skuller.net>2008-04-05 20:44:47 +0000
commita18e27d9df3934b82ab2ddec1dbf951c24fe4cb2 (patch)
tree7334d8d8fe9633cb1503d118fc3921ba033bf585 /source/gl_main.c
parent22fd6efeeb7ee918e0d1ffb75f6292077ce27816 (diff)
Added `scr_showstats' variable.
Fixed drawing of transparent sprites.
Diffstat (limited to 'source/gl_main.c')
-rw-r--r--source/gl_main.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/source/gl_main.c b/source/gl_main.c
index 76e78fd..02b9b74 100644
--- a/source/gl_main.c
+++ b/source/gl_main.c
@@ -274,22 +274,25 @@ static void GL_DrawSpriteModel( model_t *model ) {
entity_t *e = glr.ent;
spriteFrame_t *frame;
image_t *image;
- int idx, bits;
+ int bits;
float alpha;
- idx = e->frame % model->numFrames;
- frame = &model->sframes[idx];
+ frame = &model->sframes[e->frame % model->numFrames];
image = frame->image;
GL_TexEnv( GL_MODULATE );
- alpha = 1;
- bits = GLS_DEFAULT;
- if( e->flags & RF_TRANSLUCENT ) {
- alpha = e->alpha;
- bits = GLS_BLEND_BLEND;
- }
+ alpha = ( e->flags & RF_TRANSLUCENT ) ? e->alpha : 1.0f;
+ if( alpha == 1.0f ) {
+ if( image->flags & if_transparent ) {
+ bits = GLS_ALPHATEST_ENABLE;
+ } else {
+ bits = GLS_DEFAULT;
+ }
+ } else {
+ bits = GLS_BLEND_BLEND;
+ }
GL_Bits( bits );
qglColor4f( 1, 1, 1, alpha );