From 1a0c56f0f1a816d0695a24d530abb9730f8aea02 Mon Sep 17 00:00:00 2001 From: terminx Date: Thu, 1 Aug 2019 06:50:56 +0000 Subject: [PATCH] This adds back in the engine's old automapping feature This was removed a long time ago because Duke3D and Shadow Warrior don't use it. git-svn-id: https://svn.eduke32.com/eduke32@7873 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/build/src/polymer.cpp # source/build/src/polymost.cpp --- source/build/include/build.h | 1 + source/build/src/engine.cpp | 13 ++++++++++--- source/build/src/polymost.cpp | 11 ++++++++--- source/duke3d/src/gamevars.cpp | 1 + 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/source/build/include/build.h b/source/build/include/build.h index 7e5971f96..618977e8c 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -869,6 +869,7 @@ EXTERN int32_t windowpos, windowx, windowy; // spritenum = 54; // show2dsprite[spritenum>>3] &= ~(1<<(spritenum&7)); +EXTERN int automapping; EXTERN char show2dsector[(MAXSECTORS+7)>>3]; EXTERN char show2dwall[(MAXWALLS+7)>>3]; EXTERN char show2dsprite[(MAXSPRITES+7)>>3]; diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index b45bd926a..37f273b14 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -1674,10 +1674,8 @@ static void classicScanSector(int16_t startsectnum) return; } - if (automapping) - { + if (automapping) show2dsector[startsectnum>>3] |= pow2char[startsectnum&7]; - } sectorborder[0] = startsectnum; int32_t sectorbordercnt = 1; @@ -6222,6 +6220,9 @@ draw_as_face_sprite: classicDrawVoxel(tspr->x,tspr->y,tspr->z,i,daxrepeat,(int32_t)tspr->yrepeat,vtilenum, tspr->shade,tspr->pal,lwall,swall,tspr->cstat,(tspr->cstat&48)!=48,floorz,ceilingz); } + + if (automapping == 1 && (unsigned)spritenum < MAXSPRITES) + show2dsprite[spritenum>>3] |= pow2char[spritenum&7]; } static void renderDrawSprite(int32_t snum) @@ -8643,6 +8644,12 @@ int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz, classicDrawBunches(closest); + if (automapping) + { + for (int z=bunchfirst[closest]; z>=0; z=bunchp2[z]) + show2dwall[thewall[z]>>3] |= pow2char[thewall[z]&7]; + } + numbunches--; bunchfirst[closest] = bunchfirst[numbunches]; bunchlast[closest] = bunchlast[numbunches]; diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 882cf3a45..e85027706 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -4974,7 +4974,8 @@ void polymost_scansector(int32_t sectnum) { if (sectnum < 0) return; - if (automapping) show2dsector[sectnum>>3] |= pow2char[sectnum&7]; + if (automapping) + show2dsector[sectnum>>3] |= pow2char[sectnum&7]; sectorborder[0] = sectnum; int sectorbordercnt = 1; @@ -5453,8 +5454,8 @@ void polymost_drawrooms() if (automapping) { - for (int z = bunchfirst[closest]; z >= 0; z = bunchp2[z]) - show2dwall[thewall[z] >> 3] |= pow2char[thewall[z] & 7]; + for (int z=bunchfirst[closest]; z>=0; z=bunchp2[z]) + show2dwall[thewall[z]>>3] |= pow2char[thewall[z]&7]; } numbunches--; @@ -6457,6 +6458,10 @@ void polymost_drawsprite(int32_t snum) case 3: // Voxel sprite break; } + + if (automapping == 1 && (unsigned)spritenum < MAXSPRITES) + show2dsprite[spritenum>>3] |= pow2char[spritenum&7]; + _drawsprite_return: polymost_identityrotmat(); tilesiz[globalpicnum] = oldsiz; diff --git a/source/duke3d/src/gamevars.cpp b/source/duke3d/src/gamevars.cpp index 57f143205..539475809 100644 --- a/source/duke3d/src/gamevars.cpp +++ b/source/duke3d/src/gamevars.cpp @@ -1261,6 +1261,7 @@ static void Gv_AddSystemVars(void) Gv_NewVar("WORKSLIKE", 0, GAMEVAR_SYSTEM | GAMEVAR_PERPLAYER | GAMEVAR_READONLY); Gv_NewVar("ZRANGE", 4, GAMEVAR_SYSTEM | GAMEVAR_PERPLAYER); + Gv_NewVar("automapping", (intptr_t)&automapping, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR); Gv_NewVar("cameraang", (intptr_t)&ud.cameraq16ang, GAMEVAR_SYSTEM | GAMEVAR_Q16PTR); Gv_NewVar("cameraclock", (intptr_t)&g_cameraClock, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR); Gv_NewVar("cameradist", (intptr_t)&g_cameraDistance, GAMEVAR_SYSTEM | GAMEVAR_INT32PTR);