From 8e4def18ba251148686ab566522f1b3718ea4484 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 13 Feb 2011 21:48:22 +0000 Subject: [PATCH] use sprite's cstat bit 2048 for approximately the same effect as spritenoshade; some side-view and other editor tweaks git-svn-id: https://svn.eduke32.com/eduke32@1793 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/build.h | 4 +- polymer/eduke32/build/src/build.c | 54 ++++++++++++--------- polymer/eduke32/source/astub.c | 70 +++++++++++++++++---------- polymer/eduke32/source/premap.c | 3 ++ 4 files changed, 82 insertions(+), 49 deletions(-) diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 68053f942..ee25c3ac6 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -137,7 +137,9 @@ typedef struct // bit 7: 1 = Real centered centering, 0 = foot center "C" // bit 8: 1 = Blocking sprite (use with hitscan / cliptype 1) "H" // bit 9: 1 = Transluscence reversing, 0 = normal "T" -// bits 10-12: reserved +// bit 10: reserved (in use by a renderer hack) +// bit 11: 1 = determine shade based only on its own shade member (see CON's spritenoshade command) +// bit 12: reserved // bit 13: 1 = does not cast shadow // bit 14: 1 = invisible but casts shadow // bit 15: 1 = Invisible sprite, 0 = not invisible diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 4a1a03bac..036d30dd5 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -2731,7 +2731,8 @@ void overheadeditor(void) } else { - int32_t didmakered = (highlightsectorcnt<0); + int32_t didmakered = (highlightsectorcnt<0), hadouterpoint=0; + int16_t tmprefsect; for (i=0; i= 0) checksectorpointer(wall[j].nextwall,wall[j].nextsector); didmakered |= !!checksectorpointer((int16_t)j,highlightsector[i]); + + if (!didmakered) + { + updatesectorexclude(wall[j].x, wall[j].y, &tmprefsect, hlsectorbitmap); + if (tmprefsect<0) + hadouterpoint = 1; + } } } - if (!didmakered && newnumwalls<0) + if (!didmakered && !hadouterpoint && newnumwalls<0) { char blackcol=editorcolors[0], greycol=whitecol-25, *cp; @@ -2762,7 +2770,8 @@ void overheadeditor(void) clearkeys(); } - while (!didmakered && newnumwalls<0) // if + + while (!didmakered && !hadouterpoint && newnumwalls<0) // if { int32_t tmpnumwalls=0, refwall; uint8_t *visitedwall = Bcalloc((numwalls+7)>>3,1); @@ -3308,8 +3317,8 @@ SKIP: drawlinepat = 0x11111111; if (y1 != INT_MAX) drawline16base(halfxdim16,midydim16, 0,0, 0,y1, editorcolors[14]); - else - drawline16base(halfxdim16,midydim16, 0,0, 0,getscreenvdisp(-pos.z, zoom), editorcolors[14]); +// else +// drawline16base(halfxdim16,midydim16, 0,0, 0,getscreenvdisp(-pos.z, zoom), editorcolors[14]); drawlinepat = opat; } @@ -3320,7 +3329,7 @@ SKIP: else if ((oldmousebstatus&6) > 0) updatesectorz(pos.x,pos.y,pos.z,&cursectnum); - if (circlewall != -1 && (keystatus[0x4a] || ((bstatus&32) && !eitherCTRL))) // - + if (circlewall != -1 && (keystatus[0x4a] || ((bstatus&32) && !eitherCTRL))) // -, mousewheel down { if (circlepoints > 1) circlepoints--; @@ -3328,7 +3337,7 @@ SKIP: mouseb &= ~32; bstatus &= ~32; } - if (circlewall != -1 && (keystatus[0x4e] || ((bstatus&16) && !eitherCTRL))) // + + if (circlewall != -1 && (keystatus[0x4e] || ((bstatus&16) && !eitherCTRL))) // +, mousewheel up { if (circlepoints < 63) circlepoints++; @@ -3376,18 +3385,18 @@ SKIP: _printmessage16("Sideview angle: %d", (int32_t)m32_sideang); } - if (m32_sideview && keystatus[0x2a]) // LShift + if (m32_sideview && (keystatus[0x2a] || (bstatus&(16|32)))) // LShift { - if (DOWN_BK(MOVEUP) && m32_sideelev < 512) + if ((DOWN_BK(MOVEUP) || (bstatus&16)) && m32_sideelev < 512) { - m32_sideelev += synctics<<1; + m32_sideelev += synctics<<(1+!!(bstatus&16)); if (m32_sideelev > 512) m32_sideelev = 512; _printmessage16("Sideview elevation: %d", m32_sideelev); } - if (DOWN_BK(MOVEDOWN) && m32_sideelev > 0) + if ((DOWN_BK(MOVEDOWN) || (bstatus&32)) && m32_sideelev > 0) { - m32_sideelev -= synctics<<1; + m32_sideelev -= synctics<<(1+!!(bstatus&32)); if (m32_sideelev < 0) m32_sideelev = 0; _printmessage16("Sideview elevation: %d", m32_sideelev); @@ -3395,31 +3404,30 @@ SKIP: } else { + int32_t didzoom=0; + if ((DOWN_BK(MOVEUP) || (bstatus&16)) && zoom < 65536) { zoom += synctics*(zoom>>4); if (zoom < 24) zoom += 2; - if ((bstatus&16) && eitherALT) - { - searchx = halfxdim16; - searchy = midydim16; - pos.x = mousxplc; - pos.y = mousyplc; - } - if (zoom > 65536) zoom = 65536; - _printmessage16("Zoom: %d",zoom); + didzoom = 1; } if ((DOWN_BK(MOVEDOWN) || (bstatus&32)) && zoom > 8) { zoom -= synctics*(zoom>>4); - if ((bstatus&32) && eitherALT) + didzoom = 1; + } + + if (didzoom) + { + if (eitherALT) { searchx = halfxdim16; searchy = midydim16; pos.x = mousxplc; pos.y = mousyplc; } - if (zoom < 8) zoom = 8; + zoom = clamp(zoom, 8, 65536); _printmessage16("Zoom: %d",zoom); } } diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 498e06b40..50e4c4dc7 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -5754,6 +5754,16 @@ static void Keys3d(void) } } + // N (set "spritenoshade" bit) + if (PRESSED_KEYSC(N) && !eitherCTRL && !keystatus[KEYSC_QUOTE]) + { + if (AIMING_AT_SPRITE) + { + sprite[searchwall].cstat ^= 2048; + message("Sprite %d spritenoshade bit: %s", searchwall, ONOFF(sprite[searchwall].cstat&2048)); + } + } + if (PRESSED_KEYSC(T)) // T (transluscence for sprites/masked walls) { if (AIMING_AT_CEILING_OR_FLOOR) //Set masked/transluscent ceilings/floors @@ -9280,16 +9290,23 @@ void ExtPreCheckKeys(void) // just before drawrooms if (shadepreview) { int32_t i = 0; - for (i=numsprites-1; i>=0; i--) + for (i=0; i=0; i=nextspritesect[i]) - if (sprite[i].picnum == MUSICANDSFX /*&& zoom >= 256*/ ) - { - if (showambiencesounds==1 && sprite[i].sectnum!=cursectnum) - continue; + { + if (sprite[i].picnum != MUSICANDSFX /*|| zoom < 256*/ ) + continue; - screencoords(&xp1,&yp1, sprite[i].x-pos.x,sprite[i].y-pos.y, zoom); - if (m32_sideview) - yp1 += getscreenvdisp(sprite[i].z-pos.z, zoom); + if (showambiencesounds==1 && sprite[i].sectnum!=cursectnum) + continue; - radius = mulscale14(sprite[i].hitag,zoom); - col = 6; - if (i+16384 == pointhighlight) - if (totalclock & 32) col += (2<<2); - drawlinepat = 0xf0f0f0f0; - drawcircle16(halfxdim16+xp1, midydim16+yp1, radius, scalescreeny(16384), editorcolors[(int32_t)col]); - drawlinepat = 0xffffffff; - // radius = mulscale15(sprite[i].hitag,zoom); - // drawcircle16(halfxdim16+xp1, midydim16+yp1, radius, col); - } + screencoords(&xp1,&yp1, sprite[i].x-pos.x,sprite[i].y-pos.y, zoom); + if (m32_sideview) + yp1 += getscreenvdisp(sprite[i].z-pos.z, zoom); + + radius = mulscale14(sprite[i].hitag,zoom); + col = 6; + if (i+16384 == pointhighlight) + if (totalclock & 32) col += (2<<2); + drawlinepat = 0xf0f0f0f0; + drawcircle16(halfxdim16+xp1, midydim16+yp1, radius, scalescreeny(16384), editorcolors[(int32_t)col]); + drawlinepat = 0xffffffff; + // radius = mulscale15(sprite[i].hitag,zoom); + // drawcircle16(halfxdim16+xp1, midydim16+yp1, radius, col); + } } enddrawing(); //}}} @@ -9676,11 +9695,12 @@ void ExtAnalyzeSprites(void) if (sector[tspr->sectnum].floorpal != 0 && sector[tspr->sectnum].floorpal < num_tables) tspr->pal=sector[tspr->sectnum].floorpal; } - if (l < -127) l = -127; - if (l > 126) l = 127; - - tspr->shade = l; + if ((tspr->owner>=0 && (sprite[tspr->owner].cstat&2048)==0)) + { + l = clamp(l, -127, 127); +// tspr->shade = l; + } } switch (tspr->picnum) diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index 551a1b0a6..fd52df11b 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -1085,6 +1085,9 @@ static inline void prelevel(char g) { if (PN == SECTOREFFECTOR && SLT == 14) A_Spawn(-1,i); + + if (sprite[i].cstat&2048) + actor[i].flags |= SPRITE_NOSHADE; } lotaglist = 0;