From 3e4f2de79a554cc486cea64e39b5ebe58e2c90c6 Mon Sep 17 00:00:00 2001 From: terminx Date: Tue, 17 Sep 2019 03:20:38 +0000 Subject: [PATCH] Add yax_getzsofslope(), based on getzsofslope_player() git-svn-id: https://svn.eduke32.com/eduke32@8109 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/include/build.h | 1 + source/build/src/engine.cpp | 39 ++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/source/build/include/build.h b/source/build/include/build.h index a9c45ecb5..e49462880 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -1226,6 +1226,7 @@ int32_t getceilzofslopeptr(usectorptr_t sec, int32_t dax, int32_t day) ATTRIBU int32_t getflorzofslopeptr(usectorptr_t sec, int32_t dax, int32_t day) ATTRIBUTE((nonnull(1))); void getzsofslopeptr(usectorptr_t sec, int32_t dax, int32_t day, int32_t *ceilz, int32_t *florz) ATTRIBUTE((nonnull(1,4,5))); +void yax_getzsofslope(int sectNum, int playerX, int playerY, int32_t* pCeilZ, int32_t* pFloorZ); static FORCE_INLINE int32_t getceilzofslope(int16_t sectnum, int32_t dax, int32_t day) { diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 14db5f252..2e1b36cda 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -12300,6 +12300,45 @@ void getzsofslopeptr(usectorptr_t sec, int32_t dax, int32_t day, int32_t *ceilz, *florz += scale(sec->floorheinum,j>>1,i)<<1; } +#ifdef YAX_ENABLE +void yax_getzsofslope(int sectNum, int playerX, int playerY, int32_t *pCeilZ, int32_t *pFloorZ) +{ + int didCeiling = 0; + int didFloor = 0; + int testSector = 0; + + if ((sector[sectNum].ceilingstat & 512) == 0) + { + testSector = yax_getneighborsect(playerX, playerY, sectNum, YAX_CEILING); + + if (testSector >= 0) + { +ceiling: + *pCeilZ = getcorrectceilzofslope(testSector, playerX, playerY); + didCeiling = 1; + } + } + + if ((sector[sectNum].floorstat & 512) == 0) + { + testSector = yax_getneighborsect(playerX, playerY, sectNum, YAX_FLOOR); + + if (testSector >= 0) + { +floor: + *pFloorZ = getcorrectflorzofslope(testSector, playerX, playerY); + didFloor = 1; + } + } + + testSector = sectNum; + + if (!didCeiling) + goto ceiling; + else if (!didFloor) + goto floor; +} +#endif // // alignceilslope