From 73a4e0d1fe805d1966d0b35c866882db40b6aa00 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 7 Mar 2020 10:04:29 +0100 Subject: [PATCH] - made Blood's FullMap flag global and removed the hacks to show the full automap. Also refactor show2dsector into a bit array to get rid of the bit shifting code at play here. --- source/blood/src/config.cpp | 1 - source/blood/src/config.h | 1 - source/blood/src/db.cpp | 2 +- source/blood/src/map2d.cpp | 10 +- source/build/include/build.h | 4 +- source/build/src/engine.cpp | 6 +- source/build/src/polymost.cpp | 2 +- source/common/savegamehelp.cpp | 4 +- source/common/utility/tarray.h | 5 + source/duke3d/src/cheats.cpp | 8 +- source/duke3d/src/demo.cpp | 5 +- source/duke3d/src/game.h | 2 +- source/duke3d/src/gameexec.cpp | 4 +- source/duke3d/src/gamestructures.cpp | 4 +- source/duke3d/src/gamevars.cpp | 2 +- source/duke3d/src/premap.cpp | 4 +- source/duke3d/src/savegame.cpp | 1 - source/duke3d/src/screens.cpp | 18 +-- source/duke3d/src/sector.h | 2 +- source/exhumed/src/map.cpp | 161 +----------------------- source/rr/src/cheats.cpp | 7 +- source/rr/src/demo.cpp | 6 +- source/rr/src/game.h | 2 +- source/rr/src/premap.cpp | 4 +- source/rr/src/rrdh.cpp | 5 +- source/rr/src/savegame.cpp | 1 - source/rr/src/screens.cpp | 175 +++++++-------------------- source/rr/src/sector.h | 2 +- source/sw/src/draw.cpp | 4 +- source/sw/src/game.cpp | 32 ----- source/sw/src/game.h | 1 - source/sw/src/jplayer.cpp | 2 +- 32 files changed, 101 insertions(+), 386 deletions(-) diff --git a/source/blood/src/config.cpp b/source/blood/src/config.cpp index 7fa55ac8e..e96d21448 100644 --- a/source/blood/src/config.cpp +++ b/source/blood/src/config.cpp @@ -57,7 +57,6 @@ int32_t gMessageFont = 0; int32_t gMouseSensitivity; bool gNoClip; bool gInfiniteAmmo; -bool gFullMap; int32_t gDeliriumBlur = 1; ////////// diff --git a/source/blood/src/config.h b/source/blood/src/config.h index 402997b75..8a88a1597 100644 --- a/source/blood/src/config.h +++ b/source/blood/src/config.h @@ -43,7 +43,6 @@ extern int32_t gMessageFont; extern int32_t gMouseSensitivity; extern bool gNoClip; extern bool gInfiniteAmmo; -extern bool gFullMap; extern int32_t gDeliriumBlur; /////// diff --git a/source/blood/src/db.cpp b/source/blood/src/db.cpp index 2fa95e191..3a9e77b2e 100644 --- a/source/blood/src/db.cpp +++ b/source/blood/src/db.cpp @@ -636,7 +636,7 @@ const int nXWallSize = 24; int dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, short *pSector, unsigned int *pCRC) { int16_t tpskyoff[256]; - memset(show2dsector, 0, sizeof(show2dsector)); + show2dsector.Zero(); memset(show2dwall, 0, sizeof(show2dwall)); memset(show2dsprite, 0, sizeof(show2dsprite)); #ifdef NOONE_EXTENSIONS diff --git a/source/blood/src/map2d.cpp b/source/blood/src/map2d.cpp index 50ce97e98..7f1162178 100644 --- a/source/blood/src/map2d.cpp +++ b/source/blood/src/map2d.cpp @@ -43,7 +43,7 @@ void sub_2541C(int x, int y, int z, short a) int nSin2 = mulscale16(nSin, yxaspect); for (int i = 0; i < numsectors; i++) { - if (gFullMap || (show2dsector[i>>3]&(1<<(i&7)))) + if (gFullMap || show2dsector[i]) { int nStartWall = sector[i].wallptr; int nEndWall = nStartWall+sector[i].wallnum; @@ -58,9 +58,7 @@ void sub_2541C(int x, int y, int z, short a) if (sector[pWall->nextsector].ceilingz == nZCeil && sector[pWall->nextsector].floorz == nZFloor && ((wall[nNextWall].cstat | pWall->cstat) & 0x30) == 0) continue; - if (gFullMap) - continue; - if (show2dsector[pWall->nextsector>>3]&(1<<(pWall->nextsector&7))) + if (gFullMap || show2dsector[pWall->nextsector]) continue; int wx = pWall->x-x; int wy = pWall->y-y; @@ -80,7 +78,7 @@ void sub_2541C(int x, int y, int z, short a) int nPSprite = gView->pSprite->index; for (int i = 0; i < numsectors; i++) { - if (gFullMap || (show2dsector[i>>3]&(1<<(i&7)))) + if (gFullMap || show2dsector[i]) { for (int nSprite = headspritesect[i]; nSprite >= 0; nSprite = nextspritesect[nSprite]) { @@ -94,7 +92,7 @@ void sub_2541C(int x, int y, int z, short a) } for (int i = 0; i < numsectors; i++) { - if (gFullMap || (show2dsector[i>>3]&(1<<(i&7)))) + if (gFullMap || show2dsector[i]) { int nStartWall = sector[i].wallptr; int nEndWall = nStartWall+sector[i].wallnum; diff --git a/source/build/include/build.h b/source/build/include/build.h index 8b31afc6e..ee9359481 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -643,7 +643,9 @@ static CONSTEXPR const int32_t pow2long[32] = // show2dsprite[spritenum>>3] &= ~(1<<(spritenum&7)); EXTERN int automapping; -EXTERN char show2dsector[(MAXSECTORS+7)>>3]; +EXTERN FixedBitArray show2dsector; +EXTERN bool gFullMap; + 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 6071906d4..deb58783a 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -1504,7 +1504,7 @@ static void classicScanSector(int16_t startsectnum) return; if (automapping) - show2dsector[startsectnum>>3] |= pow2char[startsectnum&7]; + show2dsector.Set(startsectnum); sectorborder[0] = startsectnum; int32_t sectorbordercnt = 1; @@ -7852,7 +7852,7 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang) usectorptr_t sec; for (s=0,sec=(usectorptr_t)§or[s]; s>3]&pow2char[s&7]) + if (gFullMap || show2dsector[s]) { #ifdef YAX_ENABLE if (yax_getbunch(s, YAX_FLOOR) >= 0 && (sector[s].floorstat&(256+128))==0) @@ -8093,7 +8093,7 @@ static void enginePrepareLoadBoard(FileReader & fr, vec3_t *dapos, int16_t *daan { initspritelists(); - Bmemset(show2dsector, 0, sizeof(show2dsector)); + show2dsector.Zero(); Bmemset(show2dsprite, 0, sizeof(show2dsprite)); Bmemset(show2dwall, 0, sizeof(show2dwall)); Bmemset(editwall, 0, sizeof(editwall)); diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index c71156e3a..02839b805 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -2912,7 +2912,7 @@ void polymost_scansector(int32_t sectnum) if (sectnum < 0) return; if (automapping) - show2dsector[sectnum>>3] |= pow2char[sectnum&7]; + show2dsector.Set(sectnum); sectorborder[0] = sectnum; int sectorbordercnt = 1; diff --git a/source/common/savegamehelp.cpp b/source/common/savegamehelp.cpp index ecff9b139..5cd9035b0 100644 --- a/source/common/savegamehelp.cpp +++ b/source/common/savegamehelp.cpp @@ -486,7 +486,7 @@ void SaveEngineState() fw->Write(show2dwall, sizeof(show2dwall)); fw->Write(show2dsprite, sizeof(show2dsprite)); - fw->Write(show2dsector, sizeof(show2dsector)); + fw->Write(&show2dsector, sizeof(show2dsector)); WriteMagic(fw); fw->Write(&numyaxbunches, sizeof(numyaxbunches)); @@ -549,7 +549,7 @@ void LoadEngineState() fr.Read(show2dwall, sizeof(show2dwall)); fr.Read(show2dsprite, sizeof(show2dsprite)); - fr.Read(show2dsector, sizeof(show2dsector)); + fr.Read(&show2dsector, sizeof(show2dsector)); CheckMagic(fr); fr.Read(&numyaxbunches, sizeof(numyaxbunches)); diff --git a/source/common/utility/tarray.h b/source/common/utility/tarray.h index 2be5f882a..0f6e081e3 100644 --- a/source/common/utility/tarray.h +++ b/source/common/utility/tarray.h @@ -1498,6 +1498,11 @@ public: { memset(&bytes[0], 0, sizeof(bytes)); } + + void SetAll(bool on) + { + memset(&bytes[0], on ? -1 : 0, sizeof(bytes)); + } }; // A wrapper to externally stored data. diff --git a/source/duke3d/src/cheats.cpp b/source/duke3d/src/cheats.cpp index 97209cd1e..d1e29cfd5 100644 --- a/source/duke3d/src/cheats.cpp +++ b/source/duke3d/src/cheats.cpp @@ -638,13 +638,9 @@ void G_DoCheats(void) return; case CHEAT_SHOWMAP: // SHOW ALL OF THE MAP TOGGLE; - ud.showallmap = !ud.showallmap; + gFullMap = !gFullMap; - for (char & i : show2dsector) - i = ud.showallmap*255; - - P_DoQuote(ud.showallmap ? QUOTE_SHOW_MAP_ON : QUOTE_SHOW_MAP_OFF, - pPlayer); + P_DoQuote(gFullMap ? QUOTE_SHOW_MAP_ON : QUOTE_SHOW_MAP_OFF, pPlayer); end_cheat(pPlayer); return; diff --git a/source/duke3d/src/demo.cpp b/source/duke3d/src/demo.cpp index 2a7175abe..dbc0ef444 100644 --- a/source/duke3d/src/demo.cpp +++ b/source/duke3d/src/demo.cpp @@ -116,7 +116,7 @@ static int32_t G_OpenDemoRead(int32_t g_whichDemo) // 0 = mine g_demo_cnt = 1; ud.reccnt = 0; - ud.god = ud.cashman = ud.eog = ud.showallmap = 0; + ud.god = ud.cashman = ud.eog = gFullMap = 0; ud.noclip = ud.scrollmode = ud.overhead_on = 0; //= ud.pause_on = 0; totalclock = ototalclock = lockclock = 0; @@ -576,9 +576,6 @@ RECHECK: g_demo_cnt = 1; ud.reccnt = 0; - // ud.god = ud.cashman = ud.eog = ud.showallmap = 0; - // ud.noclip = ud.scrollmode = ud.overhead_on = ud.pause_on = 0; - totalclock = ototalclock = lockclock = 0; } else CORRUPT(0); diff --git a/source/duke3d/src/game.h b/source/duke3d/src/game.h index 7bac2fd86..ca1c25c36 100644 --- a/source/duke3d/src/game.h +++ b/source/duke3d/src/game.h @@ -173,7 +173,7 @@ typedef struct { } config; char overhead_on,last_overhead,showweapons; - char god,warp_on,cashman,eog,showallmap; + char god,warp_on,cashman,eog; char scrollmode,noclip; char display_bonus_screen; char show_level_text; diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index b6127e610..20e614d4a 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -6535,7 +6535,7 @@ void G_SaveMapState(void) Bmemcpy(&save->g_mirrorWall[0],&g_mirrorWall[0],sizeof(g_mirrorWall)); Bmemcpy(&save->g_mirrorSector[0],&g_mirrorSector[0],sizeof(g_mirrorSector)); save->g_mirrorCount = g_mirrorCount; - Bmemcpy(&save->show2dsector[0],&show2dsector[0],sizeof(show2dsector)); + save->show2dsector = show2dsector; save->g_cloudCnt = g_cloudCnt; Bmemcpy(&save->g_cloudSect[0],&g_cloudSect[0],sizeof(g_cloudSect)); save->g_cloudX = g_cloudX; @@ -6672,7 +6672,7 @@ void G_RestoreMapState(void) Bmemcpy(&g_mirrorWall[0],&pSavedState->g_mirrorWall[0],sizeof(g_mirrorWall)); Bmemcpy(&g_mirrorSector[0],&pSavedState->g_mirrorSector[0],sizeof(g_mirrorSector)); g_mirrorCount = pSavedState->g_mirrorCount; - Bmemcpy(&show2dsector[0],&pSavedState->show2dsector[0],sizeof(show2dsector)); + show2dsector = pSavedState->show2dsector; g_cloudCnt = pSavedState->g_cloudCnt; Bmemcpy(&g_cloudSect[0],&pSavedState->g_cloudSect[0],sizeof(g_cloudSect)); g_cloudX = pSavedState->g_cloudX; diff --git a/source/duke3d/src/gamestructures.cpp b/source/duke3d/src/gamestructures.cpp index 1cfc033d2..f8150d56a 100644 --- a/source/duke3d/src/gamestructures.cpp +++ b/source/duke3d/src/gamestructures.cpp @@ -1385,7 +1385,7 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum, int const lParm2) case USERDEFS_WARP_ON: labelNum = ud.warp_on; break; case USERDEFS_CASHMAN: labelNum = ud.cashman; break; case USERDEFS_EOG: labelNum = ud.eog; break; - case USERDEFS_SHOWALLMAP: labelNum = ud.showallmap; break; + case USERDEFS_SHOWALLMAP: labelNum = gFullMap; break; case USERDEFS_SHOW_HELP: labelNum = 0; break; case USERDEFS_SCROLLMODE: labelNum = ud.scrollmode; break; case USERDEFS_CLIPPING: labelNum = ud.noclip; break; @@ -1573,7 +1573,7 @@ void __fastcall VM_SetUserdef(int const labelNum, int const lParm2, int32_t cons case USERDEFS_WARP_ON: ud.warp_on = iSet; break; case USERDEFS_CASHMAN: ud.cashman = iSet; break; case USERDEFS_EOG: ud.eog = iSet; break; - case USERDEFS_SHOWALLMAP: ud.showallmap = iSet; break; + case USERDEFS_SHOWALLMAP: gFullMap = iSet; break; case USERDEFS_SHOW_HELP: break; case USERDEFS_SCROLLMODE: ud.scrollmode = iSet; break; case USERDEFS_CLIPPING: ud.noclip = iSet; break; diff --git a/source/duke3d/src/gamevars.cpp b/source/duke3d/src/gamevars.cpp index 22a5819b9..44a1665ae 100644 --- a/source/duke3d/src/gamevars.cpp +++ b/source/duke3d/src/gamevars.cpp @@ -1339,7 +1339,7 @@ static void Gv_AddSystemVars(void) // SYSTEM_GAMEARRAY Gv_NewArray("gotpic", (void *)&gotpic[0], MAXTILES, GAMEARRAY_SYSTEM | GAMEARRAY_BITMAP); Gv_NewArray("radiusdmgstatnums", (void *)&g_radiusDmgStatnums[0], MAXSTATUS, GAMEARRAY_SYSTEM | GAMEARRAY_BITMAP); - Gv_NewArray("show2dsector", (void *)&show2dsector[0], MAXSECTORS, GAMEARRAY_SYSTEM | GAMEARRAY_BITMAP); + Gv_NewArray("show2dsector", (void *)&show2dsector, MAXSECTORS, GAMEARRAY_SYSTEM | GAMEARRAY_BITMAP); Gv_NewArray("tilesizx", (void *)tileWidth, MAXTILES, GAMEARRAY_SYSTEM | GAMEARRAY_FUNC | GAMEARRAY_READONLY); Gv_NewArray("tilesizy", (void *)tileHeight, MAXTILES, GAMEARRAY_SYSTEM | GAMEARRAY_FUNC | GAMEARRAY_READONLY); #endif diff --git a/source/duke3d/src/premap.cpp b/source/duke3d/src/premap.cpp index 8cd104293..16f9fc760 100644 --- a/source/duke3d/src/premap.cpp +++ b/source/duke3d/src/premap.cpp @@ -670,7 +670,7 @@ void P_ResetPlayer(int playerNum) { auto &p = *g_player[playerNum].ps; - ud.showallmap = 0; + gFullMap = 0; p.access_spritenum = -1; p.actorsqu = -1; @@ -1205,7 +1205,7 @@ static void G_DeleteTempEffectors() static void prelevel(int g) { - Bmemset(show2dsector, 0, sizeof(show2dsector)); + show2dsector.Zero(); #ifdef LEGACY_ROR Bmemset(ror_protectedsectors, 0, MAXSECTORS); #endif diff --git a/source/duke3d/src/savegame.cpp b/source/duke3d/src/savegame.cpp index eca765668..ba06b307b 100644 --- a/source/duke3d/src/savegame.cpp +++ b/source/duke3d/src/savegame.cpp @@ -1162,7 +1162,6 @@ static const dataspec_t svgm_anmisc[] = { 0, &g_spriteDeleteQueuePos, sizeof(g_spriteDeleteQueuePos), 1 }, { DS_NOCHK, &g_deleteQueueSize, sizeof(g_deleteQueueSize), 1 }, { DS_CNT(g_deleteQueueSize), &SpriteDeletionQueue[0], sizeof(int16_t), (intptr_t)&g_deleteQueueSize }, - { 0, &show2dsector[0], sizeof(uint8_t), (MAXSECTORS+7)>>3 }, { DS_NOCHK, &g_cloudCnt, sizeof(g_cloudCnt), 1 }, { 0, &g_cloudSect[0], sizeof(g_cloudSect), 1 }, { 0, &g_cloudX, sizeof(g_cloudX), 1 }, diff --git a/source/duke3d/src/screens.cpp b/source/duke3d/src/screens.cpp index 34d0ce50a..45f76c410 100644 --- a/source/duke3d/src/screens.cpp +++ b/source/duke3d/src/screens.cpp @@ -249,7 +249,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 //Draw red lines for (i=numsectors-1; i>=0; i--) { - if (!(show2dsector[i>>3]&pow2char[i&7])) continue; + if (!gFullMap && !show2dsector[i]) continue; startwall = sector[i].wallptr; endwall = sector[i].wallptr + sector[i].wallnum; @@ -265,7 +265,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 if (sector[wal->nextsector].ceilingz == z1 && sector[wal->nextsector].floorz == z2) if (((wal->cstat|wall[wal->nextwall].cstat)&(16+32)) == 0) continue; - if (!(show2dsector[wal->nextsector >> 3] & pow2char[wal->nextsector & 7])) + if (!gFullMap && !show2dsector[wal->nextsector]) col = PalEntry(170, 170, 170); else continue; @@ -288,7 +288,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 k = g_player[screenpeek].ps->i; if (!FURY) for (i=numsectors-1; i>=0; i--) { - if (!(show2dsector[i>>3]&pow2char[i&7])) continue; + if (!gFullMap && !show2dsector[i]) continue; for (j=headspritesect[i]; j>=0; j=nextspritesect[j]) { spr = &sprite[j]; @@ -432,7 +432,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 //Draw white lines for (i=numsectors-1; i>=0; i--) { - if (!(show2dsector[i>>3]&pow2char[i&7])) continue; + if (!gFullMap && !show2dsector[i]) continue; startwall = sector[i].wallptr; endwall = sector[i].wallptr + sector[i].wallnum; @@ -728,7 +728,7 @@ void G_DisplayRest(int32_t smoothratio) { const walltype *wal = &wall[sector[i].wallptr]; - show2dsector[i>>3] |= pow2char[i&7]; + show2dsector.Set(i); for (j=sector[i].wallnum; j>0; j--, wal++) { i = wal->nextsector; @@ -737,7 +737,7 @@ void G_DisplayRest(int32_t smoothratio) if (wall[wal->nextwall].cstat&0x0071) continue; if (sector[i].lotag == 32767) continue; if (sector[i].ceilingz >= sector[i].floorz) continue; - show2dsector[i>>3] |= pow2char[i&7]; + show2dsector.Set(i); } } @@ -901,13 +901,7 @@ void G_DisplayRest(int32_t smoothratio) if (ud.pause_on==1 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0) menutext_center(100, GStrings("Game Paused")); -#ifdef YAX_DEBUG - M32_drawdebug(); -#endif - -#ifdef USE_OPENGL mdpause = (ud.pause_on || (ud.recstat==2 && (g_demo_paused && g_demo_goalCnt==0)) || (g_player[myconnectindex].ps->gm&MODE_MENU && numplayers < 2)); -#endif // JBF 20040124: display level stats in screen corner if (ud.overhead_on != 2 && hud_stats && VM_OnEvent(EVENT_DISPLAYLEVELSTATS, g_player[screenpeek].ps->i, screenpeek) == 0) diff --git a/source/duke3d/src/sector.h b/source/duke3d/src/sector.h index 6e2ec2d8c..0ca39296a 100644 --- a/source/duke3d/src/sector.h +++ b/source/duke3d/src/sector.h @@ -74,7 +74,7 @@ typedef struct { uint16_t g_earthquakeTime; int8_t g_playerSpawnCnt; - uint8_t show2dsector[(MAXSECTORS+7)>>3]; + FixedBitArray show2dsector; actor_t actor[MAXSPRITES]; playerspawn_t g_playerSpawnPoints[MAXPLAYERS]; diff --git a/source/exhumed/src/map.cpp b/source/exhumed/src/map.cpp index 4107dde6d..7ebe07cbe 100644 --- a/source/exhumed/src/map.cpp +++ b/source/exhumed/src/map.cpp @@ -37,7 +37,7 @@ void MarkSectorSeen(short nSector); void InitMap() { - memset(show2dsector, 0, sizeof(show2dsector)); + show2dsector.Zero(); memset(show2dwall, 0, sizeof(show2dwall)); memset(show2dsprite, 0, sizeof(show2dsprite)); @@ -54,9 +54,9 @@ void GrabMap() void MarkSectorSeen(short nSector) { - if (!((1 << (nSector & 7)) & show2dsector[nSector >> 3])) + if (!show2dsector[nSector]) { - show2dsector[nSector >> 3] |= 1 << (nSector & 7); + show2dsector.Set(nSector); short startwall = sector[nSector].wallptr; short nWalls = sector[nSector].wallnum; @@ -321,7 +321,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 //Draw red lines for (i=numsectors-1; i>=0; i--) { - if (!(show2dsector[i>>3]&pow2char[i&7])) continue; + if (!gFullMap && !show2dsector[i]) continue; startwall = sector[i].wallptr; endwall = sector[i].wallptr + sector[i].wallnum; @@ -357,161 +357,10 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 } } -#if 0 - renderEnableFog(); - - //Draw sprites - k = PlayerList[nLocalPlayer].nSprite; - if (!FURY) for (i=numsectors-1; i>=0; i--) - { - if (!(show2dsector[i>>3]&pow2char[i&7])) continue; - for (j=headspritesect[i]; j>=0; j=nextspritesect[j]) - { - spr = &sprite[j]; - - if (j == k || (spr->cstat&0x8000) || spr->cstat == 257 || spr->xrepeat == 0) continue; - - col = PalEntry(0, 170, 170); - if (spr->cstat & 1) col = PalEntry(170, 0, 170); - - sprx = spr->x; - spry = spr->y; - - if ((spr->cstat&257) != 0) switch (spr->cstat&48) - { - case 0: - // break; - - ox = sprx-cposx; - oy = spry-cposy; - x1 = dmulscale16(ox, xvect, -oy, yvect); - y1 = dmulscale16(oy, xvect2, ox, yvect2); - - ox = (sintable[(spr->ang+512)&2047]>>7); - oy = (sintable[(spr->ang)&2047]>>7); - x2 = dmulscale16(ox, xvect, -oy, yvect); - y2 = dmulscale16(oy, xvect, ox, yvect); - - x3 = mulscale16(x2, yxaspect); - y3 = mulscale16(y2, yxaspect); - - renderDrawLine(x1-x2+(xdim<<11), y1-y3+(ydim<<11), - x1+x2+(xdim<<11), y1+y3+(ydim<<11), col); - renderDrawLine(x1-y2+(xdim<<11), y1+x3+(ydim<<11), - x1+x2+(xdim<<11), y1+y3+(ydim<<11), col); - renderDrawLine(x1+y2+(xdim<<11), y1-x3+(ydim<<11), - x1+x2+(xdim<<11), y1+y3+(ydim<<11), col); - break; - - case 16: - if (spr->picnum == LASERLINE) - { - x1 = sprx; - y1 = spry; - tilenum = spr->picnum; - xoff = picanm[tilenum].xofs + spr->xoffset; - if ((spr->cstat&4) > 0) xoff = -xoff; - k = spr->ang; - l = spr->xrepeat; - dax = sintable[k&2047]*l; - day = sintable[(k+1536)&2047]*l; - l = tilesiz[tilenum].x; - k = (l>>1)+xoff; - x1 -= mulscale16(dax, k); - x2 = x1+mulscale16(dax, l); - y1 -= mulscale16(day, k); - y2 = y1+mulscale16(day, l); - - ox = x1-cposx; - oy = y1-cposy; - x1 = dmulscale16(ox, xvect, -oy, yvect); - y1 = dmulscale16(oy, xvect2, ox, yvect2); - - ox = x2-cposx; - oy = y2-cposy; - x2 = dmulscale16(ox, xvect, -oy, yvect); - y2 = dmulscale16(oy, xvect2, ox, yvect2); - - renderDrawLine(x1+(xdim<<11), y1+(ydim<<11), - x2+(xdim<<11), y2+(ydim<<11), col); - } - - break; - - case 32: - tilenum = spr->picnum; - xoff = picanm[tilenum].xofs + spr->xoffset; - yoff = picanm[tilenum].yofs + spr->yoffset; - if ((spr->cstat&4) > 0) xoff = -xoff; - if ((spr->cstat&8) > 0) yoff = -yoff; - - k = spr->ang; - cosang = sintable[(k+512)&2047]; - sinang = sintable[k&2047]; - xspan = tilesiz[tilenum].x; - xrepeat = spr->xrepeat; - yspan = tilesiz[tilenum].y; - yrepeat = spr->yrepeat; - - dax = ((xspan>>1)+xoff)*xrepeat; - day = ((yspan>>1)+yoff)*yrepeat; - x1 = sprx + dmulscale16(sinang, dax, cosang, day); - y1 = spry + dmulscale16(sinang, day, -cosang, dax); - l = xspan*xrepeat; - x2 = x1 - mulscale16(sinang, l); - y2 = y1 + mulscale16(cosang, l); - l = yspan*yrepeat; - k = -mulscale16(cosang, l); - x3 = x2+k; - x4 = x1+k; - k = -mulscale16(sinang, l); - y3 = y2+k; - y4 = y1+k; - - ox = x1-cposx; - oy = y1-cposy; - x1 = dmulscale16(ox, xvect, -oy, yvect); - y1 = dmulscale16(oy, xvect2, ox, yvect2); - - ox = x2-cposx; - oy = y2-cposy; - x2 = dmulscale16(ox, xvect, -oy, yvect); - y2 = dmulscale16(oy, xvect2, ox, yvect2); - - ox = x3-cposx; - oy = y3-cposy; - x3 = dmulscale16(ox, xvect, -oy, yvect); - y3 = dmulscale16(oy, xvect2, ox, yvect2); - - ox = x4-cposx; - oy = y4-cposy; - x4 = dmulscale16(ox, xvect, -oy, yvect); - y4 = dmulscale16(oy, xvect2, ox, yvect2); - - renderDrawLine(x1+(xdim<<11), y1+(ydim<<11), - x2+(xdim<<11), y2+(ydim<<11), col); - - renderDrawLine(x2+(xdim<<11), y2+(ydim<<11), - x3+(xdim<<11), y3+(ydim<<11), col); - - renderDrawLine(x3+(xdim<<11), y3+(ydim<<11), - x4+(xdim<<11), y4+(ydim<<11), col); - - renderDrawLine(x4+(xdim<<11), y4+(ydim<<11), - x1+(xdim<<11), y1+(ydim<<11), col); - - break; - } - } - } - - renderDisableFog(); -#endif - //Draw white lines for (i=numsectors-1; i>=0; i--) { - if (!(show2dsector[i>>3]&pow2char[i&7])) continue; + if (!gFullMap && !show2dsector[i]) continue; startwall = sector[i].wallptr; endwall = sector[i].wallptr + sector[i].wallnum; diff --git a/source/rr/src/cheats.cpp b/source/rr/src/cheats.cpp index 96170b5d4..84e4e4fec 100644 --- a/source/rr/src/cheats.cpp +++ b/source/rr/src/cheats.cpp @@ -687,12 +687,9 @@ void G_DoCheats(void) return; case CHEAT_SHOWMAP: // SHOW ALL OF THE MAP TOGGLE; - ud.showallmap = !ud.showallmap; + gFullMap = !gFullMap; - for (char & i : show2dsector) - i = ud.showallmap*255; - - P_DoQuote(ud.showallmap ? QUOTE_SHOW_MAP_ON : QUOTE_SHOW_MAP_OFF, + P_DoQuote(gFullMap ? QUOTE_SHOW_MAP_ON : QUOTE_SHOW_MAP_OFF, pPlayer); end_cheat(pPlayer); diff --git a/source/rr/src/demo.cpp b/source/rr/src/demo.cpp index 1b894283d..86cfa2f4d 100644 --- a/source/rr/src/demo.cpp +++ b/source/rr/src/demo.cpp @@ -118,7 +118,8 @@ static int32_t G_OpenDemoRead(int32_t g_whichDemo) // 0 = mine g_demo_cnt = 1; ud.reccnt = 0; - ud.god = ud.cashman = ud.eog = ud.showallmap = 0; + gFullMap = false; + ud.god = ud.cashman = ud.eog = 0; ud.noclip = ud.scrollmode = ud.overhead_on = 0; //= ud.pause_on = 0; totalclock = ototalclock = lockclock = 0; @@ -578,9 +579,6 @@ RECHECK: g_demo_cnt = 1; ud.reccnt = 0; - // ud.god = ud.cashman = ud.eog = ud.showallmap = 0; - // ud.noclip = ud.scrollmode = ud.overhead_on = ud.pause_on = 0; - totalclock = ototalclock = lockclock = 0; } else CORRUPT(0); diff --git a/source/rr/src/game.h b/source/rr/src/game.h index 10ddddfe1..f784bf975 100644 --- a/source/rr/src/game.h +++ b/source/rr/src/game.h @@ -167,7 +167,7 @@ typedef struct { } config; char overhead_on,last_overhead,showweapons; - char god,warp_on,cashman,eog,showallmap; + char god,warp_on,cashman,eog; char scrollmode,noclip; char display_bonus_screen; char show_level_text; diff --git a/source/rr/src/premap.cpp b/source/rr/src/premap.cpp index 6c51408ad..a9828228e 100644 --- a/source/rr/src/premap.cpp +++ b/source/rr/src/premap.cpp @@ -844,7 +844,7 @@ void P_ResetStatus(int playerNum) { DukePlayer_t *const pPlayer = g_player[playerNum].ps; - ud.showallmap = 0; + gFullMap = 0; pPlayer->dead_flag = 0; pPlayer->wackedbyactor = -1; pPlayer->falling_counter = 0; @@ -1306,7 +1306,7 @@ static void prelevel(char g) Bmemset(g_geoSectorWarp2, -1, sizeof(g_geoSectorWarp2)); Bmemset(g_ambientHitag, -1, sizeof(g_ambientHitag)); Bmemset(g_ambientLotag, -1, sizeof(g_ambientLotag)); - Bmemset(show2dsector, 0, sizeof(show2dsector)); + show2dsector.Zero(); #ifdef LEGACY_ROR Bmemset(ror_protectedsectors, 0, MAXSECTORS); #endif diff --git a/source/rr/src/rrdh.cpp b/source/rr/src/rrdh.cpp index 25521a58d..8624a9895 100644 --- a/source/rr/src/rrdh.cpp +++ b/source/rr/src/rrdh.cpp @@ -3406,8 +3406,7 @@ int dword_AAAEC; void sub_57AC0(void) { int i; - for (i = 0; i < MAXSECTORS; i++) - show2dsector[i>>3] |= 1<<(i&7); + show2dsector.SetAll(1); for (i = 0; i < MAXWALLS; i++) show2dwall[i>>3] |= 1<<(i&7); dword_AAAEC ^= 1; @@ -3444,7 +3443,7 @@ void sub_57B38(long cposx, long cposy, long czoom, short cang) //Draw white lines for(i=0;i>3]&(1<<(i&7)))) continue; + if (!gFullMap && !show2dsector[i]) continue; startwall = sector[i].wallptr; endwall = sector[i].wallptr + sector[i].wallnum; diff --git a/source/rr/src/savegame.cpp b/source/rr/src/savegame.cpp index 996ec4b0f..5834fb344 100644 --- a/source/rr/src/savegame.cpp +++ b/source/rr/src/savegame.cpp @@ -892,7 +892,6 @@ static const dataspec_t svgm_anmisc[] = { 0, &g_spriteDeleteQueuePos, sizeof(g_spriteDeleteQueuePos), 1 }, { DS_NOCHK, &g_deleteQueueSize, sizeof(g_deleteQueueSize), 1 }, { DS_CNT(g_deleteQueueSize), &SpriteDeletionQueue[0], sizeof(int16_t), (intptr_t)&g_deleteQueueSize }, - { 0, &show2dsector[0], sizeof(uint8_t), MAXSECTORS>>3 }, { DS_NOCHK, &g_cloudCnt, sizeof(g_cloudCnt), 1 }, { 0, &g_cloudSect[0], sizeof(g_cloudSect), 1 }, { 0, &g_cloudX, sizeof(g_cloudX), 1 }, diff --git a/source/rr/src/screens.cpp b/source/rr/src/screens.cpp index 3e32d14b6..05cda2d86 100644 --- a/source/rr/src/screens.cpp +++ b/source/rr/src/screens.cpp @@ -183,6 +183,9 @@ static int32_t gtextsc(int32_t sc) static void G_DrawCameraText(int16_t i) { + //if (VM_OnEvent(EVENT_DISPLAYCAMERAOSD, i, screenpeek) != 0) + // return; + if (!T1(i)) { rotatesprite_win(24<<16, 33<<16, 65536L, 0, CAMCORNER, 0, 0, 2); @@ -245,7 +248,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 //Draw red lines for (i=numsectors-1; i>=0; i--) { - if (!(show2dsector[i>>3]&(1<<(i&7)))) continue; + if (!gFullMap && !show2dsector[i]) continue; startwall = sector[i].wallptr; endwall = sector[i].wallptr + sector[i].wallnum; @@ -258,37 +261,34 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 k = wal->nextwall; if (k < 0) continue; - if (sector[wal->nextsector].ceilingz == z1) - if (sector[wal->nextsector].floorz == z2) + if (sector[wal->nextsector].ceilingz == z1 && sector[wal->nextsector].floorz == z2) if (((wal->cstat|wall[wal->nextwall].cstat)&(16+32)) == 0) continue; - col = PalEntry(255, 0, 0); - if ((wal->cstat | wall[wal->nextwall].cstat) & 1) col = PalEntry(170, 0, 170); + if (!gFullMap && !show2dsector[wal->nextsector]) + { - if (!(show2dsector[wal->nextsector >> 3] & (1 << (wal->nextsector & 7)))) col = PalEntry(170, 170, 170); - else continue; + ox = wal->x-cposx; + oy = wal->y-cposy; + x1 = dmulscale16(ox, xvect, -oy, yvect)+(xdim<<11); + y1 = dmulscale16(oy, xvect2, ox, yvect2)+(ydim<<11); - ox = wal->x-cposx; - oy = wal->y-cposy; - x1 = dmulscale16(ox, xvect, -oy, yvect)+(xdim<<11); - y1 = dmulscale16(oy, xvect2, ox, yvect2)+(ydim<<11); + wal2 = (uwalltype *)&wall[wal->point2]; + ox = wal2->x-cposx; + oy = wal2->y-cposy; + x2 = dmulscale16(ox, xvect, -oy, yvect)+(xdim<<11); + y2 = dmulscale16(oy, xvect2, ox, yvect2)+(ydim<<11); - wal2 = (uwalltype *)&wall[wal->point2]; - ox = wal2->x-cposx; - oy = wal2->y-cposy; - x2 = dmulscale16(ox, xvect, -oy, yvect)+(xdim<<11); - y2 = dmulscale16(oy, xvect2, ox, yvect2)+(ydim<<11); - - drawlinergb(x1, y1, x2, y2, col); + drawlinergb(x1, y1, x2, y2, col); + } } } //Draw sprites k = g_player[screenpeek].ps->i; - for (i=numsectors-1; i>=0; i--) + /*if (!FURY)*/ for (i=numsectors-1; i>=0; i--) // todo - make a switchable flag. { - if (!(show2dsector[i>>3]&(1<<(i&7)))) continue; + if (!gFullMap || !show2dsector[i]) continue; for (j=headspritesect[i]; j>=0; j=nextspritesect[j]) { spr = &sprite[j]; @@ -432,7 +432,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 //Draw white lines for (i=numsectors-1; i>=0; i--) { - if (!(show2dsector[i>>3]&(1<<(i&7)))) continue; + if (!gFullMap && !show2dsector[i]) continue; startwall = sector[i].wallptr; endwall = sector[i].wallptr + sector[i].wallnum; @@ -465,7 +465,7 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 x2 = dmulscale16(ox, xvect, -oy, yvect)+(xdim<<11); y2 = dmulscale16(oy, xvect2, ox, yvect2)+(ydim<<11); - renderDrawLine(x1, y1, x2, y2, PalEntry(170, 170, 170)); + drawlinergb(x1, y1, x2, y2, PalEntry(170, 170, 170)); } } @@ -497,6 +497,8 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 else i = APLAYERTOP; + //i = VM_OnEventWithReturn(EVENT_DISPLAYOVERHEADMAPPLAYER, pPlayer->i, p, i); + if (i < 0) continue; @@ -569,17 +571,6 @@ FString GameInterface::GetCoordString() } -#define LOW_FPS 30 -#define SLOW_FRAME_TIME 33 - -#if defined GEKKO -# define FPS_YOFFSET 16 -#else -# define FPS_YOFFSET 0 -#endif - -#define FPS_COLOR(x) ((x) ? COLOR_RED : COLOR_WHITE) - FString GameInterface::statFPS() { FString output; @@ -667,12 +658,8 @@ void G_DisplayRest(int32_t smoothratio) palaccum_t tint = PALACCUM_INITIALIZER; DukePlayer_t *const pp = g_player[screenpeek].ps; -#ifdef SPLITSCREEN_MOD_HACKS - DukePlayer_t *const pp2 = g_fakeMultiMode==2 ? g_player[1].ps : NULL; -#endif int32_t cposx, cposy, cang; -#ifdef USE_OPENGL // this takes care of fullscreen tint for OpenGL if (videoGetRenderMode() >= REND_POLYMOST) { @@ -700,22 +687,12 @@ void G_DisplayRest(int32_t smoothratio) fstint.f = 0; } } -#endif // USE_OPENGL - palaccum_add(&tint, &pp->pals, pp->pals.f); -#ifdef SPLITSCREEN_MOD_HACKS - if (pp2) - palaccum_add(&tint, &pp2->pals, pp2->pals.f); -#endif if (!RR) { static const palette_t loogiepal = { 0, 63, 0, 0 }; palaccum_add(&tint, &loogiepal, pp->loogcnt>>1); -#ifdef SPLITSCREEN_MOD_HACKS - if (pp2) - palaccum_add(&tint, &loogiepal, pp2->loogcnt>>1); -#endif } if (g_restorePalette) @@ -726,21 +703,9 @@ void G_DisplayRest(int32_t smoothratio) if (g_restorePalette < 2 || omovethingscnt+1 == g_moveThingsCount) { int32_t pal = pp->palette; -#ifdef SPLITSCREEN_MOD_HACKS - const int32_t opal = pal; - - if (pp2) // splitscreen HACK: BASEPAL trumps all, then it's arbitrary. - pal = min(pal, pp2->palette); -#endif // g_restorePalette < 0: reset tinting, too (e.g. when loading new game) - P_SetGamePalette(pp, pal, (g_restorePalette>0)? Pal_DontResetFade : ESetPalFlags::FromInt(0)); - -#ifdef SPLITSCREEN_MOD_HACKS - if (pp2) // keep first player's pal as its member! - pp->palette = opal; -#endif - + P_SetGamePalette(pp, pal, (g_restorePalette > 0) ? Pal_DontResetFade : ESetPalFlags::FromInt(0)); g_restorePalette = 0; } else @@ -755,7 +720,7 @@ void G_DisplayRest(int32_t smoothratio) { const walltype *wal = &wall[sector[i].wallptr]; - show2dsector[i>>3] |= (1<<(i&7)); + show2dsector.Set(i); for (j=sector[i].wallnum; j>0; j--, wal++) { i = wal->nextsector; @@ -764,7 +729,7 @@ void G_DisplayRest(int32_t smoothratio) if (wall[wal->nextwall].cstat&0x0071) continue; if (sector[i].lotag == 32767) continue; if (sector[i].ceilingz >= sector[i].floorz) continue; - show2dsector[i>>3] |= (1<<(i&7)); + show2dsector.Set(i); } } @@ -778,27 +743,9 @@ void G_DisplayRest(int32_t smoothratio) { PspTwoDSetter set; P_DisplayWeapon(); -#ifdef SPLITSCREEN_MOD_HACKS - if (pp2) // HACK - { - const int32_t oscreenpeek = screenpeek; - screenpeek = 1; - P_DisplayWeapon(); - screenpeek = oscreenpeek; - } -#endif if (pp->over_shoulder_on == 0) P_DisplayScuba(); -#ifdef SPLITSCREEN_MOD_HACKS - if (pp2 && pp2->over_shoulder_on == 0) // HACK - { - const int32_t oscreenpeek = screenpeek; - screenpeek = 1; - P_DisplayScuba(); - screenpeek = oscreenpeek; - } -#endif } if (!RR) G_MoveClouds(); @@ -860,10 +807,12 @@ void G_DisplayRest(int32_t smoothratio) G_RestoreInterpolations(); - if (ud.overhead_on == 2) + //int32_t const textret = VM_OnEvent(EVENT_DISPLAYOVERHEADMAPTEXT, g_player[screenpeek].ps->i, screenpeek); + if (/*textret == 0 &&*/ ud.overhead_on == 2) { const int32_t a = RR ? 0 : ((ud.screen_size > 0) ? 147 : 179); - if (!G_HaveUserMap()) + + if (!G_HaveUserMap()) // && !(G_GetLogoFlags() & LOGO_HIDEEPISODE)) minitext(5, a+6, GStrings.localize(gVolumeNames[ud.volume_number]), 0, 2+8+16+256); minitext(5, a+6+6, currentLevel->DisplayName(), 0, 2+8+16+256); } @@ -872,16 +821,8 @@ void G_DisplayRest(int32_t smoothratio) if (pp->invdisptime > 0) G_DrawInventory(pp); - G_DrawStatusBar(screenpeek); - -#ifdef SPLITSCREEN_MOD_HACKS - // HACK - if (g_fakeMultiMode==2) - { - G_DrawStatusBar(1); - G_PrintGameQuotes(1); - } -#endif + //if (VM_OnEvent(EVENT_DISPLAYSBAR, g_player[screenpeek].ps->i, screenpeek) == 0) + G_DrawStatusBar(screenpeek); G_PrintGameQuotes(screenpeek); @@ -900,9 +841,13 @@ void G_DisplayRest(int32_t smoothratio) if (!DEER && g_player[myconnectindex].ps->newowner == -1 && ud.overhead_on == 0 && cl_crosshair && ud.camerasprite == -1) { int32_t a = CROSSHAIR; + //ud.returnvar[0] = (160<<16) - (g_player[myconnectindex].ps->look_ang<<15); + //ud.returnvar[1] = 100<<16; + //int32_t a = VM_OnEventWithReturn(EVENT_DISPLAYCROSSHAIR, g_player[screenpeek].ps->i, screenpeek, CROSSHAIR); if ((unsigned) a < MAXTILES) { vec2_t crosshairpos = { (160<<16) - (g_player[myconnectindex].ps->look_ang<<15), 100<<16 }; + //vec2_t crosshairpos = { ud.returnvar[0], ud.returnvar[1] }; uint32_t crosshair_o = 1|2; uint32_t crosshair_scale = divscale16(cl_crosshairscale, 100); if (RR) @@ -912,20 +857,22 @@ void G_DisplayRest(int32_t smoothratio) } } + /* + if (VM_HaveEvent(EVENT_DISPLAYREST)) + { + int32_t vr=viewingrange, asp=yxaspect; + VM_ExecuteEvent(EVENT_DISPLAYREST, g_player[screenpeek].ps->i, screenpeek); + renderSetAspect(vr, asp); + } + */ if (ud.pause_on==1 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0) menutext_center(100, GStrings("Game Paused")); -#ifdef YAX_DEBUG - M32_drawdebug(); -#endif - -#ifdef USE_OPENGL mdpause = (ud.pause_on || (ud.recstat==2 && (g_demo_paused && g_demo_goalCnt==0)) || (g_player[myconnectindex].ps->gm&MODE_MENU && numplayers < 2)); -#endif // JBF 20040124: display level stats in screen corner - if (ud.overhead_on != 2 && hud_stats) + if (ud.overhead_on != 2 && hud_stats) // && VM_OnEvent(EVENT_DISPLAYLEVELSTATS, g_player[screenpeek].ps->i, screenpeek) == 0) { DukePlayer_t const * const myps = g_player[myconnectindex].ps; int const sbarshift = RR ? 15 : 16; @@ -1085,10 +1032,6 @@ static void fadepaltile(int32_t r, int32_t g, int32_t b, int32_t start, int32_t } while (start != end+step); } -#ifdef __ANDROID__ -int inExtraScreens = 0; -#endif - void G_DisplayExtraScreens(void) { Mus_Stop(); @@ -1098,9 +1041,6 @@ void G_DisplayExtraScreens(void) if (!VOLUMEALL) { -#ifdef __ANDROID__ - inExtraScreens = 1; -#endif videoSetViewableArea(0, 0, xdim-1, ydim-1); renderFlushPerms(); //g_player[myconnectindex].ps->palette = palette; @@ -1118,16 +1058,10 @@ void G_DisplayExtraScreens(void) while (!inputState.CheckAllInput()) G_HandleAsync(); -#ifdef __ANDROID__ - inExtraScreens = 0; -#endif } if (0) { -#ifdef __ANDROID__ - inExtraScreens = 1; -#endif videoSetViewableArea(0, 0, xdim-1, ydim-1); renderFlushPerms(); //g_player[myconnectindex].ps->palette = palette; @@ -1142,9 +1076,6 @@ void G_DisplayExtraScreens(void) fadepaltile(0, 0, 0, 0, 252, 28, TENSCREEN); inputState.ClearAllInput(); -#ifdef __ANDROID__ - inExtraScreens = 0; -#endif } } @@ -1317,9 +1248,7 @@ void G_DisplayLogo(void) } if (!g_noLogo && !userConfig.nologo /* && (!g_netServer && ud.multimode < 2) */) { -#ifndef EDUKE32_TOUCH_DEVICES if (VOLUMEALL) -#endif { if (!inputState.CheckAllInput() && g_noLogoAnim == 0 && !userConfig.nologo) { @@ -1396,9 +1325,7 @@ void G_DisplayLogo(void) totalclock = 0; while ( -#ifndef EDUKE32_SIMPLE_MENU totalclock < (860+120) && -#endif !inputState.CheckAllInput()) { if (G_FPSLimit()) @@ -2358,11 +2285,6 @@ void G_BonusScreen(int32_t bonusonly) else menutext(231, yy, tempbuf); yy += yystep; -#if 0 - // Always overwritten. - if (g_player[myconnectindex].ps->secret_rooms > 0) - Bsprintf(tempbuf, "%-3d%%", (100*g_player[myconnectindex].ps->secret_rooms/g_player[myconnectindex].ps->max_secret_rooms)); -#endif Bsprintf(tempbuf, "%-3d", g_player[myconnectindex].ps->max_secret_rooms-g_player[myconnectindex].ps->secret_rooms); if (!RR) gametext_number((320>>2)+70, yy+9, tempbuf); @@ -2857,11 +2779,6 @@ void G_BonusScreenRRRA(int32_t bonusonly) Bsprintf(tempbuf, "%-3d", g_player[myconnectindex].ps->secret_rooms); menutext(231, yy, tempbuf); yy += yystep; -#if 0 - // Always overwritten. - if (g_player[myconnectindex].ps->secret_rooms > 0) - Bsprintf(tempbuf, "%-3d%%", (100*g_player[myconnectindex].ps->secret_rooms/g_player[myconnectindex].ps->max_secret_rooms)); -#endif Bsprintf(tempbuf, "%-3d", g_player[myconnectindex].ps->max_secret_rooms-g_player[myconnectindex].ps->secret_rooms); menutext(231, yy, tempbuf); yy += yystep; diff --git a/source/rr/src/sector.h b/source/rr/src/sector.h index 8aedecad6..ecd93e882 100644 --- a/source/rr/src/sector.h +++ b/source/rr/src/sector.h @@ -76,7 +76,7 @@ typedef struct { uint16_t g_earthquakeTime; int8_t g_playerSpawnCnt; - uint8_t show2dsector[(MAXSECTORS+7)>>3]; + FixedBitArray show2dsector; actor_t actor[MAXSPRITES]; playerspawn_t g_playerSpawnPoints[MAXPLAYERS]; diff --git a/source/sw/src/draw.cpp b/source/sw/src/draw.cpp index c6b1e2c36..bd58b0a2a 100644 --- a/source/sw/src/draw.cpp +++ b/source/sw/src/draw.cpp @@ -2164,7 +2164,7 @@ drawscreen(PLAYERp pp) if (i >= 0) { - show2dsector[i>>3] |= (1<<(i&7)); + show2dsector.Set(i); walltype *wal = &wall[sector[i].wallptr]; for (j=sector[i].wallnum; j>0; j--,wal++) { @@ -2175,7 +2175,7 @@ drawscreen(PLAYERp pp) if (nextwall < MAXWALLS && wall[nextwall].cstat&0x0071) continue; if (sector[i].lotag == 32767) continue; if (sector[i].ceilingz >= sector[i].floorz) continue; - show2dsector[i>>3] |= (1<<(i&7)); + show2dsector.Set(i); } } diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index dab6eb784..539435199 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -562,33 +562,6 @@ Distance(int x1, int y1, int x2, int y2) return x2 + y2 - DIV2(min); } -void -MapSetAll2D(uint8_t fill) -{ -#if 0 - int i; - - for (i = 0; i < (MAXWALLS >> 3); i++) - show2dwall[i] = fill; - for (i = 0; i < (MAXSPRITES >> 3); i++) - show2dsprite[i] = fill; - - //for (i = 0; i < (MAXSECTORS >> 3); i++) - for (i = 0; i < MAXSECTORS; i++) - { - if (sector[i].ceilingpicnum != 342 && sector[i].floorpicnum != 342) - show2dsector[i>>3] |= (1<<(i&7)); - //show2dsector[i] = fill; - } -#endif -} - -void -MapSetup(void) -{ - MapSetAll2D(0xFF); -} - void setup2dscreen(void) { @@ -969,10 +942,6 @@ void InitLevelGlobals(void) extern SWBOOL zillawasseen; extern short BossSpriteNum[3]; - // A few IMPORTANT GLOBAL RESETS - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1 - MapSetup(); - //Zombies = 0; ChopTics = 0; dimensionmode = 3; zoom = 768; @@ -1176,7 +1145,6 @@ InitLevel(void) TrackSetup(); PlayerPanelSetup(); - MapSetup(); SectorSetup(); JS_InitMirrors(); JS_InitLockouts(); // Setup the lockout linked lists diff --git a/source/sw/src/game.h b/source/sw/src/game.h index 9e78a81a7..df77e90d6 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -2337,7 +2337,6 @@ int BunnyHatch2(short Weapon); // bunny.c int DoSkullBeginDeath(int16_t SpriteNum); // skull.c void AnimateCacheCursor(void); // game.c -void MapSetAll2D(uint8_t fill); // game.c void TerminateGame(void); // game.c void TerminateLevel(void); // game.c void drawoverheadmap(int cposx,int cposy,int czoom,short cang); // game.c diff --git a/source/sw/src/jplayer.cpp b/source/sw/src/jplayer.cpp index 7abed385f..5c8ee7f8a 100644 --- a/source/sw/src/jplayer.cpp +++ b/source/sw/src/jplayer.cpp @@ -410,7 +410,7 @@ static int goalx[MAX_SW_PLAYERS_REG], goaly[MAX_SW_PLAYERS_REG], goalz[MAX_SW_PL static int goalsect[MAX_SW_PLAYERS_REG], goalwall[MAX_SW_PLAYERS_REG], goalsprite[MAX_SW_PLAYERS_REG]; static int goalplayer[MAX_SW_PLAYERS_REG], clipmovecount[MAX_SW_PLAYERS_REG]; short searchsect[MAXSECTORS], searchparent[MAXSECTORS]; -char dashow2dsector[(MAXSECTORS+7)>>3]; +uint8_t dashow2dsector[(MAXSECTORS+7)>>3]; void computergetinput(int snum, SW_PACKET *syn) {