Mapster32: honor "blocking color" declared with DEF 'spritecol' et al.

Meaning tilegroup's 'colors' directive.

Also, to the packaged tiles.cfg, add a description of how to emulate the
earlier Mapster32 sprite coloring for one tile group.

git-svn-id: https://svn.eduke32.com/eduke32@5429 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2015-11-14 23:40:59 +00:00
parent ff87574df2
commit f8076f9207
5 changed files with 30 additions and 18 deletions

View file

@ -461,6 +461,8 @@ FORCE_INLINE void inpclamp(int32_t *x, int32_t mi, int32_t ma)
#define drawtranspixel(p, col) drawpixel(p, blendtable[0][(readpixel(p) * 256) + col]) #define drawtranspixel(p, col) drawpixel(p, blendtable[0][(readpixel(p) * 256) + col])
// Timed offset for Mapster32 color index cycling.
// Range: 0 .. 16
#define M32_THROB klabs(sintable[((totalclock << 4) & 2047)] >> 10) #define M32_THROB klabs(sintable[((totalclock << 4) & 2047)] >> 10)
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -3291,8 +3291,11 @@ static void drawspritelabel(int i)
// int const blocking = (sprite[i].cstat & 1); // int const blocking = (sprite[i].cstat & 1);
// KEEPINSYNC drawscreen_drawsprite()
uint8_t const spritecol = spritecol2d[sprite[i].picnum][0]; uint8_t const spritecol = spritecol2d[sprite[i].picnum][0];
int col = spritecol ? editorcolors[spritecol] : getspritecol(i); uint8_t const blockingSpriteCol = spritecol2d[sprite[i].picnum][1];
int col = spritecol ? editorcolors[(sprite[i].cstat&1) ? blockingSpriteCol : spritecol] :
getspritecol(i);
if (show2dsprite[i>>3]&pow2char[i&7]) if (show2dsprite[i>>3]&pow2char[i&7])
col = editorcolors[14] - (M32_THROB>>1); col = editorcolors[14] - (M32_THROB>>1);
@ -3759,7 +3762,7 @@ void overheadeditor(void)
} }
drawlinebetween(&v1, &v2, !hlp ? 8 : drawlinebetween(&v1, &v2, !hlp ? 8 :
editorcolors[wal->nextwall >= 0 ? 33 : 7], editorcolors[wal->nextwall >= 0 ? 12 : 7],
0x11111111); 0x11111111);
} }
} }

View file

@ -17320,11 +17320,12 @@ static void drawscreen_drawsprite(int32_t j, int32_t posxe, int32_t posye, int32
int col; int col;
const spritetype *const spr = &sprite[j]; const spritetype *const spr = &sprite[j];
int16_t const hitblocking = (spr->cstat&256); int16_t const blocking = (spr->cstat&1), hitblocking = (spr->cstat&256);
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;
// KEEPINSYNC build.c: drawspritelabel()
if (spr->sectnum<0) if (spr->sectnum<0)
col = editorcolors[4]; // red col = editorcolors[4]; // red
else else
@ -17332,16 +17333,9 @@ static void drawscreen_drawsprite(int32_t j, int32_t posxe, int32_t posye, int32
uint8_t const spritecol = spritecol2d[spr->picnum][0]; uint8_t const spritecol = spritecol2d[spr->picnum][0];
if (spritecol) if (spritecol)
col = spritecol; // XXX: should be editorcolors[spritecol] col = editorcolors[blocking ? spritecol2d[spr->picnum][1] : spritecol];
else else
col = getspritecol(j); col = getspritecol(j);
#if 0
else if (spr->cstat&1)
{
uint8_t const blockingSpriteCol = spritecol2d[spr->picnum][1];
col = blockingSpriteCol ? blockingSpriteCol : 5;
}
#endif
} }
if (editstatus == 1) if (editstatus == 1)
@ -17356,12 +17350,7 @@ static void drawscreen_drawsprite(int32_t j, int32_t posxe, int32_t posye, int32
else // if (highlightcnt > 0) else // if (highlightcnt > 0)
{ {
if (show2dsprite[j>>3]&pow2char[j&7]) if (show2dsprite[j>>3]&pow2char[j&7])
{ col = editorcolors[14] - (M32_THROB>>1);
col = editorcolors[14];
// if ((totalclock & 16) == 0)
col -= (M32_THROB>>1);
}
} }
} }

View file

@ -7,7 +7,22 @@ tilegroup "Actors"
{ {
hotkey "A" hotkey "A"
colors 31 31 // NOTE: colors specified here (as well as in the first argument to the DEF
// commands '2dcol' and '2dcolidxrange') refer to Mapster32's editorcolor[]
// index. They can be viewed with "set showpal 1" assuming that a.m32 has
// been loaded.
//
// The actual color indices will be offset in the range [0 .. 4] when the
// mouse hovers near them.
//
// For example, under the Duke3D palette, one can create a color scheme
// similar to earlier Mapster32 builds (non-blocking sprites have an orange
// tint, blocking ones are purple) by declaring in a loaded DEF file
// 2dcolidxrange 33 33 255
// which maps editorcolor[] indices 33 through 255 to the same actual color
// indices, and then setting here:
// colors 139 231
colors 31 31
tiles tiles
{ {

View file

@ -7847,6 +7847,7 @@ static void InitCustomColors(void)
vgapal16[31*4+1] = 180; // green vgapal16[31*4+1] = 180; // green
vgapal16[31*4+2] = 240; // red vgapal16[31*4+2] = 240; // red
// UNUSED?
vgapal16[39*4+0] = 144; vgapal16[39*4+0] = 144;
vgapal16[39*4+1] = 212; vgapal16[39*4+1] = 212;
vgapal16[39*4+2] = 252; vgapal16[39*4+2] = 252;
@ -7880,10 +7881,12 @@ static void InitCustomColors(void)
vgapal16[26*4+1] = 96; vgapal16[26*4+1] = 96;
vgapal16[26*4+2] = 96; vgapal16[26*4+2] = 96;
// UNUSED?
vgapal16[33*4+0] = 0; //60; // blue vgapal16[33*4+0] = 0; //60; // blue
vgapal16[33*4+1] = 0; //120; // green vgapal16[33*4+1] = 0; //120; // green
vgapal16[33*4+2] = 192; //180; // red vgapal16[33*4+2] = 192; //180; // red
// UNUSED?
vgapal16[41*4+0] = 0; //96; vgapal16[41*4+0] = 0; //96;
vgapal16[41*4+1] = 0; //160; vgapal16[41*4+1] = 0; //160;
vgapal16[41*4+2] = 252; //192; vgapal16[41*4+2] = 252; //192;