Browse Source

ref: add new special rendermode that specifically used for modulate mode in engine's ScreenFade

pull/2/head
Alibek Omarov 2 years ago
parent
commit
4bbd0cc404
  1. 4
      engine/ref_api.h
  2. 4
      ref/gl/gl_backend.c
  3. 8
      ref/soft/r_draw.c

4
engine/ref_api.h

@ -67,6 +67,10 @@ GNU General Public License for more details.
#define FWORLD_WATERALPHA BIT( 2 ) #define FWORLD_WATERALPHA BIT( 2 )
#define FWORLD_HAS_DELUXEMAP BIT( 3 ) #define FWORLD_HAS_DELUXEMAP BIT( 3 )
// special rendermode for screenfade modulate
// (probably will be expanded at some point)
#define kRenderScreenFadeModulate 0x1000
typedef enum typedef enum
{ {
DEMO_INACTIVE = 0, DEMO_INACTIVE = 0,

4
ref/gl/gl_backend.c

@ -417,6 +417,10 @@ void GL_SetRenderMode( int mode )
pglDisable( GL_ALPHA_TEST ); pglDisable( GL_ALPHA_TEST );
pglBlendFunc( GL_SRC_ALPHA, GL_ONE ); pglBlendFunc( GL_SRC_ALPHA, GL_ONE );
break; break;
case kRenderScreenFadeModulate:
pglEnable( GL_BLEND );
pglDisable( GL_ALPHA_TEST );
pglBlendFunc( GL_ZERO, GL_SRC_COLOR );
} }
} }

8
ref/soft/r_draw.c

@ -165,11 +165,15 @@ void R_DrawStretchPicImplementation( int x, int y, int w, int h, int s1, int t1,
pixel_t screen = dest[u]; pixel_t screen = dest[u];
dest[u] = vid.addmap[(src & 0xff00)|(screen>>8)] << 8 | (screen & 0xff) | ((src & 0xff) >> 0); dest[u] = vid.addmap[(src & 0xff00)|(screen>>8)] << 8 | (screen & 0xff) | ((src & 0xff) >> 0);
} }
else if( vid.rendermode == kRenderScreenFadeModulate )
{
pixel_t screen = dest[u];
dest[u] = BLEND_COLOR( screen, vid.color );
}
else if( alpha < 7) // && (vid.rendermode == kRenderTransAlpha || vid.rendermode == kRenderTransTexture ) ) else if( alpha < 7) // && (vid.rendermode == kRenderTransAlpha || vid.rendermode == kRenderTransTexture ) )
{ {
pixel_t screen = dest[u]; // | 0xff & screen & src ; pixel_t screen = dest[u]; // | 0xff & screen & src ;
dest[u] = BLEND_ALPHA( alpha, src, screen);//vid.alphamap[( alpha << 16)|(src & 0xff00)|(screen>>8)] << 8 | (screen & 0xff) >> 3 | ((src & 0xff) >> 3); dest[u] = BLEND_ALPHA( alpha, src, screen );//vid.alphamap[( alpha << 16)|(src & 0xff00)|(screen>>8)] << 8 | (screen & 0xff) >> 3 | ((src & 0xff) >> 3);
} }
else else
dest[u] = src; dest[u] = src;

Loading…
Cancel
Save