From f8076f92073474debac484897b2942191d2fd757 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sat, 14 Nov 2015 23:40:59 +0000 Subject: [PATCH] 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 --- polymer/eduke32/build/include/editor.h | 2 ++ polymer/eduke32/build/src/build.c | 7 +++++-- polymer/eduke32/build/src/engine.c | 19 ++++--------------- polymer/eduke32/package/sdk/tiles.cfg | 17 ++++++++++++++++- polymer/eduke32/source/astub.c | 3 +++ 5 files changed, 30 insertions(+), 18 deletions(-) diff --git a/polymer/eduke32/build/include/editor.h b/polymer/eduke32/build/include/editor.h index 7582dfcb2..bd8a9e0af 100644 --- a/polymer/eduke32/build/include/editor.h +++ b/polymer/eduke32/build/include/editor.h @@ -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]) +// Timed offset for Mapster32 color index cycling. +// Range: 0 .. 16 #define M32_THROB klabs(sintable[((totalclock << 4) & 2047)] >> 10) #ifdef __cplusplus diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index c4eee496c..6aaf32cbf 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -3291,8 +3291,11 @@ static void drawspritelabel(int i) // int const blocking = (sprite[i].cstat & 1); + // KEEPINSYNC drawscreen_drawsprite() 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]) col = editorcolors[14] - (M32_THROB>>1); @@ -3759,7 +3762,7 @@ void overheadeditor(void) } drawlinebetween(&v1, &v2, !hlp ? 8 : - editorcolors[wal->nextwall >= 0 ? 33 : 7], + editorcolors[wal->nextwall >= 0 ? 12 : 7], 0x11111111); } } diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 34e9897eb..c5b65c546 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -17320,11 +17320,12 @@ static void drawscreen_drawsprite(int32_t j, int32_t posxe, int32_t posye, int32 int col; 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 angofs = m32_sideview ? m32_sideang : 0; + // KEEPINSYNC build.c: drawspritelabel() if (spr->sectnum<0) col = editorcolors[4]; // red 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]; if (spritecol) - col = spritecol; // XXX: should be editorcolors[spritecol] + col = editorcolors[blocking ? spritecol2d[spr->picnum][1] : spritecol]; else 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) @@ -17356,12 +17350,7 @@ static void drawscreen_drawsprite(int32_t j, int32_t posxe, int32_t posye, int32 else // if (highlightcnt > 0) { if (show2dsprite[j>>3]&pow2char[j&7]) - { - col = editorcolors[14]; - -// if ((totalclock & 16) == 0) - col -= (M32_THROB>>1); - } + col = editorcolors[14] - (M32_THROB>>1); } } diff --git a/polymer/eduke32/package/sdk/tiles.cfg b/polymer/eduke32/package/sdk/tiles.cfg index eb5aa4f58..00dfc6323 100644 --- a/polymer/eduke32/package/sdk/tiles.cfg +++ b/polymer/eduke32/package/sdk/tiles.cfg @@ -7,7 +7,22 @@ tilegroup "Actors" { 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 { diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 16fa6cc64..c0d5eb8ba 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -7847,6 +7847,7 @@ static void InitCustomColors(void) vgapal16[31*4+1] = 180; // green vgapal16[31*4+2] = 240; // red + // UNUSED? vgapal16[39*4+0] = 144; vgapal16[39*4+1] = 212; vgapal16[39*4+2] = 252; @@ -7880,10 +7881,12 @@ static void InitCustomColors(void) vgapal16[26*4+1] = 96; vgapal16[26*4+2] = 96; + // UNUSED? vgapal16[33*4+0] = 0; //60; // blue vgapal16[33*4+1] = 0; //120; // green vgapal16[33*4+2] = 192; //180; // red + // UNUSED? vgapal16[41*4+0] = 0; //96; vgapal16[41*4+1] = 0; //160; vgapal16[41*4+2] = 252; //192;