From 6748a39c8fbb8f19785d868595dd1230b2850efd Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 26 Nov 2021 20:41:03 +0100 Subject: [PATCH] - deprecate the sector index variant of pushmove --- source/build/include/clip.h | 2 +- source/build/src/clip.cpp | 2 +- source/core/coreactor.h | 17 +++++++++++++++++ source/core/gamefuncs.h | 9 --------- source/games/blood/src/prediction.cpp | 2 ++ source/games/duke/src/actors.cpp | 8 ++++---- source/games/exhumed/src/set.cpp | 7 +++---- 7 files changed, 28 insertions(+), 19 deletions(-) diff --git a/source/build/include/clip.h b/source/build/include/clip.h index 49ef5e2bb..88dd03cfe 100644 --- a/source/build/include/clip.h +++ b/source/build/include/clip.h @@ -33,7 +33,7 @@ int clipinsideboxline(int x, int y, int x1, int y1, int x2, int y2, int walldist int32_t clipmove_(vec3_t *const pos, int *const sectnum, int32_t xvect, int32_t yvect, int32_t const walldist, int32_t const ceildist, int32_t const flordist, uint32_t const cliptype, int clipmoveboxtracenum = 3) ATTRIBUTE((nonnull(1, 2))); -int pushmove(vec3_t *const vect, int *const sectnum, int32_t const walldist, int32_t const ceildist, int32_t const flordist, +int pushmove_(vec3_t *const vect, int *const sectnum, int32_t const walldist, int32_t const ceildist, int32_t const flordist, uint32_t const cliptype, bool clear = true) ATTRIBUTE((nonnull(1, 2))); #endif diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index 1c2edc3e3..41d623940 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -825,7 +825,7 @@ int32_t clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect, int32_ // // pushmove // -int pushmove(vec3_t *const vect, int *const sectnum, +int pushmove_(vec3_t *const vect, int *const sectnum, int32_t const walldist, int32_t const ceildist, int32_t const flordist, uint32_t const cliptype, bool clear /*= true*/) { int bad; diff --git a/source/core/coreactor.h b/source/core/coreactor.h index 64b4783ad..a57096f7c 100644 --- a/source/core/coreactor.h +++ b/source/core/coreactor.h @@ -358,6 +358,14 @@ inline void getzrange(int x, int y, int z, int16_t sectnum, int32_t* ceilz, int3 getzrange_(&v, sectnum, ceilz, ceilhit, florz, florhit, walldist, cliptype); } +[[deprecated]] +inline int pushmove(vec3_t* const vect, int* const sectnum, int32_t const walldist, int32_t const ceildist, int32_t const flordist, + uint32_t const cliptype, bool clear = true) +{ + return pushmove_(vect, sectnum, walldist, ceildist, flordist, cliptype, clear); +} + + inline int hitscan(const vec3_t& start, const sectortype* startsect, const vec3_t& direction, HitInfoBase& hitinfo, unsigned cliptype) @@ -400,3 +408,12 @@ inline void getzrange(const vec3_t& pos, sectortype* sect, int32_t* ceilz, Colli ceilhit.setFromEngine(ch); florhit.setFromEngine(fh); } + +inline int pushmove(vec3_t* const vect, sectortype** const sect, int32_t const walldist, int32_t const ceildist, int32_t const flordist, + uint32_t const cliptype, bool clear = true) +{ + int sectno = *sect ? sector.IndexOf(*sect) : -1; + int res = pushmove_(vect, §no, walldist, ceildist, flordist, cliptype, clear); + *sect = sectno == -1 ? nullptr : §or[sectno]; + return res; +} diff --git a/source/core/gamefuncs.h b/source/core/gamefuncs.h index 9b8001e02..98f509e48 100644 --- a/source/core/gamefuncs.h +++ b/source/core/gamefuncs.h @@ -323,15 +323,6 @@ inline void dragpoint(walltype* pointhighlight, int32_t dax, int32_t day) dragpoint(wallnum(pointhighlight), dax, day); } -inline int pushmove(vec3_t *const vect, sectortype**const sect, int32_t const walldist, int32_t const ceildist, int32_t const flordist, - uint32_t const cliptype, bool clear = true) -{ - int sectno = *sect? sector.IndexOf(*sect) : -1; - int res = pushmove(vect, §no, walldist, ceildist, flordist, cliptype, clear); - *sect = sectno == -1? nullptr : §or[sectno]; - return res; -} - inline void alignceilslope(sectortype* dasect, int32_t x, int32_t y, int32_t z) { alignceilslope(sector.IndexOf(dasect), x, y, z); diff --git a/source/games/blood/src/prediction.cpp b/source/games/blood/src/prediction.cpp index 9ef102771..a4f7db813 100644 --- a/source/games/blood/src/prediction.cpp +++ b/source/games/blood/src/prediction.cpp @@ -262,6 +262,7 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput) void fakePlayerProcess(PLAYER *pPlayer, InputPacket *pInput) { +#if 0 spritetype *pSprite = pPlayer->pSprite; XSPRITE *pXSprite = pPlayer->pXSprite; POSTURE* pPosture = &pPlayer->pPosture[pPlayer->lifeMode][predict.at48]; @@ -353,6 +354,7 @@ void fakePlayerProcess(PLAYER *pPlayer, InputPacket *pInput) predict.at72 = 0; } } +#endif } static void fakeMoveDude(spritetype *pSprite) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 994addc3f..6cba92973 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -5291,10 +5291,10 @@ void fall_common(DDukeActor *actor, int playernum, int JIBS6, int DRONE, int BLO else if (s->zvel > 2048 && s->sector()->lotag != 1) { - auto j = s->sector(); - pushmove(&s->pos, &j, 128, (4 << 8), (4 << 8), CLIPMASK0); - if (j != s->sector() && j != nullptr) - changeactorsect(actor, j); + auto sect = s->sector(); + pushmove(&s->pos, §, 128, (4 << 8), (4 << 8), CLIPMASK0); + if (sect != s->sector() && sect != nullptr) + changeactorsect(actor, sect); S_PlayActorSound(thud, actor); } diff --git a/source/games/exhumed/src/set.cpp b/source/games/exhumed/src/set.cpp index 6ae6e3226..ed9c9582f 100644 --- a/source/games/exhumed/src/set.cpp +++ b/source/games/exhumed/src/set.cpp @@ -282,10 +282,9 @@ void AISet::Tick(RunListEvent* ev) auto nMov = MoveCreature(pActor); - static_assert(sizeof(pSprite->sectnum) != 4); - int sectnum = pSprite->sectnum; - pushmove(&pSprite->pos, §num, pSprite->clipdist << 2, 5120, -5120, CLIPMASK0); - pSprite->sectnum = sectnum; + auto sect = pSprite->sector(); + pushmove(&pSprite->pos, §, pSprite->clipdist << 2, 5120, -5120, CLIPMASK0); + pSprite->setsector(sect); if (pSprite->zvel > 4000) {