From 76a7799d7c5a5ed9c1b3482dd75213ab020f4a75 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sat, 9 Apr 2011 13:27:08 +0000 Subject: [PATCH] Revise shade preview; fix PGUP/PGDN with selected sectors; allow INS/DEL in 2D side-view mode; 64-bit printf cleanup git-svn-id: https://svn.eduke32.com/eduke32@1860 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/build.h | 1 + polymer/eduke32/build/src/build.c | 5 +- polymer/eduke32/build/src/engine.c | 10 ++-- polymer/eduke32/source/astub.c | 75 ++++++++++++++++++--------- polymer/eduke32/source/gamevars.c | 2 +- 5 files changed, 63 insertions(+), 30 deletions(-) diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 871162377..ca0c64684 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -600,6 +600,7 @@ static inline int32_t deletesprite(int16_t spritenum) int32_t changespritesect(int16_t spritenum, int16_t newsectnum); int32_t changespritestat(int16_t spritenum, int16_t newstatnum); int32_t setsprite(int16_t spritenum, const vec3_t *new) ATTRIBUTE((nonnull(2))); +int32_t setspritez(int16_t spritenum, const vec3_t *new) ATTRIBUTE((nonnull(2))); void spriteheightofs(int16_t i, int32_t *height, int32_t *zofs); diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 268dd8b2c..2d101620e 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -1745,7 +1745,7 @@ static void sideview_filter_keys(void) { switch (i) { - case 0xd2: case 0xd3: // ins, del +// case 0xd2: case 0xd3: // ins, del case 0x2e: case 0x39: // c, space // case 0xb8: // ralt keystatus[i] = 0; @@ -2950,6 +2950,7 @@ void overheadeditor(void) update_highlightsector(); message("Extended %ss of highlighted sectors, creating bunch %d", cfs[cf], k); + asksave = 1; end_yax: ; } #endif @@ -5540,7 +5541,7 @@ int32_t LoadBoard(const char *filename, uint32_t flags) startang = ang; startsectnum = cursectnum; #ifdef YAX_ENABLE - yax_resetbunchnums(); +// yax_resetbunchnums(); #endif return 0; diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 3ad7c556e..9361272a7 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -7455,7 +7455,9 @@ int32_t loadboard(char *filename, char flags, int32_t *daposx, int32_t *daposy, sprite[i].picnum = 0; } } - +#ifdef YAX_ENABLE + yax_update(0); +#endif for (i=0; i=0 && mcf==0 && *ceilhit==sectnum+16384) { for (i=0; i=0 && mcf==1 && *florhit==sectnum+16384) { // (almost) same as above, but with floors... diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index aa4fecd89..29a7dc2bc 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -587,7 +587,9 @@ int32_t map_undoredo(int32_t dir) if (qsetmode == 200 && rendmode == 4) polymer_loadboard(); #endif - +#ifdef YAX_ENABLE + yax_update(0); +#endif CheckMapCorruption(4, 0); return 0; @@ -3835,10 +3837,6 @@ restart: tilescreen_drawrest(iSelected, showmsg); - enddrawing(); - showframe(1); - begindrawing(); - k = (mousex || mousey || mouseb); if (!k) for (i=0; i<(signed)(sizeof(keystatus)/sizeof(keystatus[0])); i++) @@ -3853,6 +3851,10 @@ restart: showframe(1); return 1; } + + enddrawing(); + showframe(1); + begindrawing(); } } } @@ -5392,7 +5394,7 @@ static void Keys3d(void) k = 0; if (highlightsectorcnt > 0 && searchsector>=0 && searchsector>3]&(1<<(searchsector&7))) + if (hlsectorbitmap[searchsector>>3]&(1<<(searchsector&7))) k = highlightsectorcnt; } @@ -9873,7 +9875,7 @@ void ExtAnalyzeSprites(void) { int32_t i, k; spritetype *tspr; - int32_t frames=0, l; + int32_t frames=0, sh; for (i=0,tspr=&tsprite[0]; icstat |= 2+512; } - if (shadepreview && !(tspr->cstat & 16)) + /* Shade preview rules (thanks to Gambini) + * + * 1st rule: Any pal value not equal to 0 in the floor of a sector will + * turn all the sprites within this sector to that pal value. + * + * 2nd rule: The shade of a sprite will be taken from the floor unless the + * ceiling is parallaxed, in which case will be taken from the + * ceiling. But not the pal which always follow the 1st rule. + * + * 3rd rule: relative to wall sprites will keep their own shade unless + * they're actors, but they will still retain the floor pal. + */ + if (shadepreview) { + int32_t wallaligned = (tspr->cstat & 16); + if (tspr->sectnum<0) continue; - if (sector[tspr->sectnum].ceilingstat&1) - { - l = sector[tspr->sectnum].ceilingshade; - if (sector[tspr->sectnum].ceilingpal != 0 && sector[tspr->sectnum].ceilingpal < num_tables) - tspr->pal=sector[tspr->sectnum].ceilingpal; - } - else - { - l = sector[tspr->sectnum].floorshade; - if (sector[tspr->sectnum].floorpal != 0 && sector[tspr->sectnum].floorpal < num_tables) - tspr->pal=sector[tspr->sectnum].floorpal; - } + // 1st rule + if (sector[tspr->sectnum].floorpal > 0 && sector[tspr->sectnum].floorpal < num_tables) + tspr->pal = sector[tspr->sectnum].floorpal; - if ((tspr->owner>=0 && (sprite[tspr->owner].cstat&2048)==0)) + // 2nd and 3rd rule minus "actor condition" + if (!wallaligned && (tspr->cstat&2048)==0) { - inpclamp(&l, -127, 127); -// tspr->shade = l; + if (sector[tspr->sectnum].ceilingstat&1) + sh = sector[tspr->sectnum].ceilingshade; + else + sh = sector[tspr->sectnum].floorshade; + + inpclamp(&sh, -127, 127); + tspr->shade = sh; } } @@ -10747,7 +10760,7 @@ static void EditSectorData(int16_t sectnum) #ifdef YAX_ENABLE if (med_editval) { - if ((row==0 || row==1 || row==3 || row==5) && yax_getbunch(sectnum, (col==2)) >= 0) + if ((row==1 || row==3 || row==5) && yax_getbunch(sectnum, (col==2)) >= 0) med_editval = 0; } #endif @@ -10757,8 +10770,15 @@ static void EditSectorData(int16_t sectnum) switch (row) { case 0: +#ifdef YAX_ENABLE + i = sector[sectnum].ceilingstat&YAX_BIT; +#endif handlemed(1, "Flags (hex)", "Ceiling Flags", §or[sectnum].ceilingstat, sizeof(sector[sectnum].ceilingstat), 65535, 0); +#ifdef YAX_ENABLE + sector[sectnum].ceilingstat &= ~YAX_BIT; + sector[sectnum].ceilingstat |= i; +#endif break; case 1: for (i=Bsprintf(med_disptext,"(X,Y)pan: %d, %d",sector[sectnum].ceilingxpanning,sector[sectnum].ceilingypanning); i < med_dispwidth; i++) med_disptext[i] = ' '; @@ -10798,8 +10818,15 @@ static void EditSectorData(int16_t sectnum) switch (row) { case 0: +#ifdef YAX_ENABLE + i = sector[sectnum].ceilingstat&YAX_BIT; +#endif handlemed(1, "Flags (hex)", "Floor Flags", §or[sectnum].floorstat, sizeof(sector[sectnum].floorstat), 65535, 0); +#ifdef YAX_ENABLE + sector[sectnum].ceilingstat &= ~YAX_BIT; + sector[sectnum].ceilingstat |= i; +#endif break; case 1: diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index cb45e831c..c3344ff95 100644 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -798,7 +798,7 @@ int32_t __fastcall Gv_GetVarX(register int32_t id) } badindex: - OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index (%s[%d])\n",g_errorLineNum,keyw[g_tw],aGameArrays[id].szLabel,negateResult); + OSD_Printf(CON_ERROR "Gv_GetVar(): invalid array index (%s[%d])\n",g_errorLineNum,keyw[g_tw],aGameArrays[id].szLabel,(int32_t)negateResult); return -1; badvarid: