From 8fd6e0e183bff6a016ebf32b43c783488f73fd57 Mon Sep 17 00:00:00 2001 From: nukeykt Date: Wed, 26 Jun 2019 23:02:01 +0900 Subject: [PATCH] TROR related tweaks # Conflicts: # source/blood/src/mirrors.cpp --- source/blood/src/actor.cpp | 3 ++- source/blood/src/db.cpp | 4 +++- source/blood/src/db.h | 16 ++++++++++++++++ source/blood/src/loadsave.cpp | 9 +++++++++ source/blood/src/mirrors.cpp | 8 ++++---- source/blood/src/triggers.cpp | 2 +- source/build/include/build.h | 2 +- 7 files changed, 36 insertions(+), 8 deletions(-) diff --git a/source/blood/src/actor.cpp b/source/blood/src/actor.cpp index 42e79d505..e9602a6e0 100644 --- a/source/blood/src/actor.cpp +++ b/source/blood/src/actor.cpp @@ -6527,7 +6527,8 @@ bool actCanSplatWall(int nWall) return 0; if (pWall->cstat & 32768) return 0; - if (pWall->lotag >= 500 && pWall->lotag < 512) + int nType = GetWallType(nWall); + if (nType >= 500 && nType < 512) return 0; if (pWall->nextsector != -1) { diff --git a/source/blood/src/db.cpp b/source/blood/src/db.cpp index f4e6cf70b..a37f4efb2 100644 --- a/source/blood/src/db.cpp +++ b/source/blood/src/db.cpp @@ -1238,5 +1238,7 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, shor } } - yax_update(1); +#ifdef YAX_ENABLE + yax_update(numyaxbunches > 0 ? 2 : 1); +#endif } diff --git a/source/blood/src/db.h b/source/blood/src/db.h index b08c51ed0..671982293 100644 --- a/source/blood/src/db.h +++ b/source/blood/src/db.h @@ -269,6 +269,22 @@ extern unsigned short nextXSprite[kMaxXSprites]; extern unsigned short nextXWall[kMaxXWalls]; extern unsigned short nextXSector[kMaxXSectors]; +#ifdef YAX_ENABLE +static inline bool yax_hasnextwall(int nWall) +{ + return yax_getnextwall(nWall, YAX_CEILING) >= 0 || yax_getnextwall(nWall, YAX_FLOOR); +} +#endif + +static inline int GetWallType(int nWall) +{ +#ifdef YAX_ENABLE + if (yax_hasnextwall(nWall)) + return 0; +#endif + return wall[nWall].lotag; +} + void InsertSpriteSect(int nSprite, int nSector); void RemoveSpriteSect(int nSprite); void InsertSpriteStat(int nSprite, int nStat); diff --git a/source/blood/src/loadsave.cpp b/source/blood/src/loadsave.cpp index ad08434b2..31fd9e0bc 100644 --- a/source/blood/src/loadsave.cpp +++ b/source/blood/src/loadsave.cpp @@ -127,6 +127,9 @@ void LoadSave::LoadGame(char *pzFile) if (!bVanilla && !gMe->packInfo[1].at0) // if diving suit is not active, turn off reverb sound effect sfxSetReverb(0); ambInit(); +#ifdef YAX_ENABLE + yax_update(numyaxbunches > 0 ? 2 : 1); +#endif memset(myMinLag, 0, sizeof(myMinLag)); otherMinLag = 0; myMaxLag = 0; @@ -303,6 +306,9 @@ void MyLoadSave::Load(void) Read(&gMapRev, sizeof(gMapRev)); Read(&gSongId, sizeof(gSkyCount)); Read(&gFogMode, sizeof(gFogMode)); +#ifdef YAX_ENABLE + Read(&numyaxbunches, sizeof(numyaxbunches)); +#endif gCheatMgr.sub_5BCF4(); } @@ -404,6 +410,9 @@ void MyLoadSave::Save(void) Write(&gMapRev, sizeof(gMapRev)); Write(&gSongId, sizeof(gSkyCount)); Write(&gFogMode, sizeof(gFogMode)); +#ifdef YAX_ENABLE + Write(&numyaxbunches, sizeof(numyaxbunches)); +#endif } void LoadSavedInfo(void) diff --git a/source/blood/src/mirrors.cpp b/source/blood/src/mirrors.cpp index 6fb302de2..9e0e141ae 100644 --- a/source/blood/src/mirrors.cpp +++ b/source/blood/src/mirrors.cpp @@ -99,7 +99,7 @@ void InitMirrors(void) int nTile = 4080+mirrorcnt; if (wall[i].overpicnum == 504) { - if (wall[i].extra > 0 && wall[i].lotag == 501) + if (wall[i].extra > 0 && GetWallType(i) == 501) { wall[i].overpicnum = nTile; mirror[mirrorcnt].at14 = i; @@ -111,7 +111,7 @@ void InitMirrors(void) { if (j == i) continue; - if (wall[j].extra > 0 && wall[j].lotag == 501) + if (wall[j].extra > 0 && GetWallType(i) == 501) { if (tmp != xwall[wall[j].extra].data) continue; @@ -374,7 +374,7 @@ void DrawMirrors(int x, int y, int z, fix16_t a, fix16_t horiz) sector[mirrorsector].floorz = sector[nSector].floorz; sector[mirrorsector].ceilingz = sector[nSector].ceilingz; int cx, cy, ca; - if (pWall->lotag == 501) + if (GetWallType(nWall) == 501) { cx = x - (wall[pWall->hitag].x-wall[pWall->point2].x); cy = y - (wall[pWall->hitag].y-wall[pWall->point2].y); @@ -387,7 +387,7 @@ void DrawMirrors(int x, int y, int z, fix16_t a, fix16_t horiz) renderDrawRoomsQ16(cx, cy, z, ca,horiz,mirrorsector|MAXSECTORS); viewProcessSprites(cx,cy,z); renderDrawMasks(); - if (pWall->lotag != 501) + if (GetWallType(nWall) != 501) renderCompleteMirror(); if (wall[nWall].pal != 0 || wall[nWall].shade != 0) TranslateMirrorColors(wall[nWall].shade, wall[nWall].pal); diff --git a/source/blood/src/triggers.cpp b/source/blood/src/triggers.cpp index d7f583a11..73433af42 100644 --- a/source/blood/src/triggers.cpp +++ b/source/blood/src/triggers.cpp @@ -1191,7 +1191,7 @@ void OperateWall(int nWall, XWALL *pXWall, EVENT a3) pXWall->locked ^= 1; return; } - if (pWall->lotag == 511) + if (GetWallType(nWall) == 511) { char bStatus; switch (a3.cmd) diff --git a/source/build/include/build.h b/source/build/include/build.h index e49462880..b98003589 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -177,7 +177,7 @@ void yax_updategrays(int32_t posze); # define YAX_NEXTWALLDEFAULT(Cf) (-1) # else // More user tag hijacking: lotag/extra. :/ -# define YAX_PTRNEXTWALL(Ptr, Wall, Cf) (*(int16_t *)(&Ptr[Wall].lotag + 2*Cf)) +# define YAX_PTRNEXTWALL(Ptr, Wall, Cf) (*(int16_t *)(&Ptr[Wall].lotag + (bloodhack ? 1 : 2)*Cf)) # define YAX_NEXTWALLDEFAULT(Cf) (((Cf)==YAX_CEILING) ? 0 : -1) extern int16_t yax_bunchnum[MAXSECTORS][2]; extern int16_t yax_nextwall[MAXWALLS][2];