mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-03-03 07:51:36 +00:00
Merge pull request #574 from 0lvin/for_review
fix tearing with fix palette change(explosion near without move)
This commit is contained in:
commit
3c681210ba
1 changed files with 33 additions and 17 deletions
|
@ -47,6 +47,7 @@ static int vid_zminu, vid_zminv, vid_zmaxu, vid_zmaxv;
|
||||||
static vec3_t lastvieworg;
|
static vec3_t lastvieworg;
|
||||||
static vec3_t lastviewangles;
|
static vec3_t lastviewangles;
|
||||||
qboolean fastmoving;
|
qboolean fastmoving;
|
||||||
|
static qboolean palette_changed;
|
||||||
|
|
||||||
refimport_t ri;
|
refimport_t ri;
|
||||||
|
|
||||||
|
@ -1424,6 +1425,9 @@ static rserr_t SWimp_SetMode(int *pwidth, int *pheight, int mode, int fullscreen
|
||||||
static void
|
static void
|
||||||
RE_BeginFrame( float camera_separation )
|
RE_BeginFrame( float camera_separation )
|
||||||
{
|
{
|
||||||
|
// pallete without changes
|
||||||
|
palette_changed = false;
|
||||||
|
|
||||||
while (r_mode->modified || vid_fullscreen->modified || r_vsync->modified)
|
while (r_mode->modified || vid_fullscreen->modified || r_vsync->modified)
|
||||||
{
|
{
|
||||||
RE_SetMode();
|
RE_SetMode();
|
||||||
|
@ -1533,12 +1537,20 @@ R_GammaCorrectAndSetPalette( const unsigned char *palette )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
// Replace palette
|
||||||
for ( i = 0; i < 256; i++ )
|
for ( i = 0; i < 256; i++ )
|
||||||
|
{
|
||||||
|
if (sw_state.currentpalette[i*4+0] != sw_state.gammatable[palette[i*4+2]] ||
|
||||||
|
sw_state.currentpalette[i*4+1] != sw_state.gammatable[palette[i*4+1]] ||
|
||||||
|
sw_state.currentpalette[i*4+2] != sw_state.gammatable[palette[i*4+0]])
|
||||||
{
|
{
|
||||||
sw_state.currentpalette[i*4+0] = sw_state.gammatable[palette[i*4+2]]; // blue
|
sw_state.currentpalette[i*4+0] = sw_state.gammatable[palette[i*4+2]]; // blue
|
||||||
sw_state.currentpalette[i*4+1] = sw_state.gammatable[palette[i*4+1]]; // green
|
sw_state.currentpalette[i*4+1] = sw_state.gammatable[palette[i*4+1]]; // green
|
||||||
sw_state.currentpalette[i*4+2] = sw_state.gammatable[palette[i*4+0]]; // red
|
sw_state.currentpalette[i*4+2] = sw_state.gammatable[palette[i*4+0]]; // red
|
||||||
|
|
||||||
sw_state.currentpalette[i*4+3] = 0xFF; // alpha
|
sw_state.currentpalette[i*4+3] = 0xFF; // alpha
|
||||||
|
palette_changed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2184,6 +2196,9 @@ RE_EndFrame (void)
|
||||||
vmax = vid.height * vid.width;
|
vmax = vid.height * vid.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if palette changed need to flush whole buffer
|
||||||
|
if (!palette_changed)
|
||||||
|
{
|
||||||
// search real begin/end of difference
|
// search real begin/end of difference
|
||||||
vmin = RE_BufferDifferenceStart(vmin, vmax);
|
vmin = RE_BufferDifferenceStart(vmin, vmax);
|
||||||
|
|
||||||
|
@ -2199,6 +2214,7 @@ RE_EndFrame (void)
|
||||||
{
|
{
|
||||||
vmax = vid.height * vid.width;
|
vmax = vid.height * vid.width;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RE_FlushFrame(vmin, vmax);
|
RE_FlushFrame(vmin, vmax);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue