Fix Mapster32 sprite selection colors when using a tiles.cfg that defines tile groups using colors from the bright half of the original 16-color palette.

In layman's terms, this fixes the effect sprites flashing black in 2d mode.

git-svn-id: https://svn.eduke32.com/eduke32@5669 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2016-03-14 00:08:02 +00:00
parent 76d318ab1b
commit 99cb974d0c
2 changed files with 23 additions and 20 deletions

View file

@ -3293,23 +3293,30 @@ static void drawspritelabel(int i)
return; return;
// KEEPINSYNC drawscreen_drawsprite() // KEEPINSYNC drawscreen_drawsprite()
uint8_t const spritecol = spritecol2d[sprite[i].picnum][0]; uint8_t const spritecol = spritecol2d[sprite[i].picnum][(sprite[i].cstat&1)];
uint8_t const blockingSpriteCol = spritecol2d[sprite[i].picnum][1]; int col = spritecol ? editorcolors[spritecol] : getspritecol(i);
int col = spritecol ? editorcolors[(sprite[i].cstat&1) ? blockingSpriteCol : spritecol] : int bordercol = col;
getspritecol(i);
int bgcol = col;
// group selection
if (show2dsprite[i>>3]&pow2char[i&7]) if (show2dsprite[i>>3]&pow2char[i&7])
{ {
bgcol = editorcolors[14]; bordercol = editorcolors[14];
col = bgcol - (M32_THROB>>1); col = bordercol - (M32_THROB>>1);
} }
else if (i == pointhighlight - 16384) else if (i == pointhighlight - 16384)
col += M32_THROB>>2; {
else if (sprite[i].sectnum < 0) if (spritecol >= 8 && spritecol <= 15)
col = bgcol = editorcolors[4]; // red col -= M32_THROB>>1;
else col += M32_THROB>>2;
drawsmallabel(dabuffer, editorcolors[0], col, bgcol, sprite[i].x, sprite[i].y, sprite[i].z); if (bordercol > col)
bordercol = col;
}
else if (sprite[i].sectnum < 0)
col = bordercol = editorcolors[4]; // red
drawsmallabel(dabuffer, editorcolors[0], col, bordercol, sprite[i].x, sprite[i].y, sprite[i].z);
} }
#define EDITING_MAP_P() (newnumwalls>=0 || joinsector[0]>=0 || circlewall>=0 || (bstatus&1) || isc.active) #define EDITING_MAP_P() (newnumwalls>=0 || joinsector[0]>=0 || circlewall>=0 || (bstatus&1) || isc.active)

View file

@ -17314,19 +17314,13 @@ static void drawscreen_drawsprite(int32_t j, int32_t posxe, int32_t posye, int32
int16_t const flooraligned = (spr->cstat&32), wallaligned = (spr->cstat&16); int16_t const flooraligned = (spr->cstat&32), wallaligned = (spr->cstat&16);
int16_t const angofs = m32_sideview ? m32_sideang : 0; int16_t const angofs = m32_sideview ? m32_sideang : 0;
uint8_t const spritecol = spritecol2d[spr->picnum][blocking];
// KEEPINSYNC build.c: drawspritelabel() // KEEPINSYNC build.c: drawspritelabel()
if (spr->sectnum<0) if (spr->sectnum<0)
col = editorcolors[4]; // red col = editorcolors[4]; // red
else else
{ col = spritecol ? editorcolors[spritecol] : getspritecol(j);
uint8_t const spritecol = spritecol2d[spr->picnum][0];
if (spritecol)
col = editorcolors[blocking ? spritecol2d[spr->picnum][1] : spritecol];
else
col = getspritecol(j);
}
if (editstatus == 1) if (editstatus == 1)
{ {
@ -17335,7 +17329,9 @@ static void drawscreen_drawsprite(int32_t j, int32_t posxe, int32_t posye, int32
(!m32_sideview && (spr->x == sprite[pointhighlight-16384].x && (!m32_sideview && (spr->x == sprite[pointhighlight-16384].x &&
spr->y == sprite[pointhighlight-16384].y)))) spr->y == sprite[pointhighlight-16384].y))))
{ {
col += M32_THROB>>2; if (spritecol >= 8 && spritecol <= 15)
col -= M32_THROB>>1;
else col += M32_THROB>>2;
} }
else // if (highlightcnt > 0) else // if (highlightcnt > 0)
{ {