From ceaa66130417c117185d10f73526b7c1b47bd3e8 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 17 Aug 2014 19:42:01 +0000 Subject: [PATCH] Properly consider sprites with a clipshape as bridge (p->spritebridge). git-svn-id: https://svn.eduke32.com/eduke32@4574 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/build.h | 2 ++ polymer/eduke32/build/src/engine.c | 50 +++++++++++++-------------- polymer/eduke32/source/player.c | 3 +- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 7d4888886..37bd9bc6a 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -1231,6 +1231,8 @@ static inline int32_t E_SpriteIsValid(const int32_t i) return ((unsigned)i < MAXSPRITES && sprite[i].statnum != MAXSTATUS); } +int32_t clipshape_idx_for_sprite(spritetype *curspr, int32_t curidx); + void alignceilslope(int16_t dasect, int32_t x, int32_t y, int32_t z); void alignflorslope(int16_t dasect, int32_t x, int32_t y, int32_t z); int32_t sectorofwall(int16_t theline); diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 958a1267b..714c25471 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -1802,7 +1802,28 @@ int32_t clipmapinfo_load(void) return 0; } -#endif + + +int32_t clipshape_idx_for_sprite(spritetype *curspr, int32_t curidx) +{ + if (curidx < 0) // per-sprite init + curidx = pictoidx[curspr->picnum]; + else + curidx = clipinfo[curidx].next; + + while (curidx>=0 && (curspr->cstat&32) != (sector[sectq[clipinfo[curidx].qbeg]].CM_CSTAT&32)) + curidx = clipinfo[curidx].next; + + return curidx; +} +#else +int32_t clipshape_idx_for_sprite(spritetype *curspr, int32_t curidx) +{ + UNREFERENCED_PARAMETER(curspr); + UNREFERENCED_PARAMETER(curidx); + return -1; +} +#endif // HAVE_CLIPSHAPE_FEATURE ////// ////// #define WALLS_ARE_CONSISTENT(k) ((wall[k].x == x2 && wall[k].y == y2) \ @@ -12552,14 +12573,7 @@ restart_grand: mapinfo_set(&origmapinfo, &clipmapinfo); // replace sector and wall with clip map curspr = &sprite[clipspritelist[clipspritecnt]]; - - if (curidx < 0) // per-sprite init - curidx = pictoidx[curspr->picnum]; - else - curidx = clipinfo[curidx].next; - - while (curidx>=0 && (curspr->cstat&32) != (sector[sectq[clipinfo[curidx].qbeg]].CM_CSTAT&32)) - curidx = clipinfo[curidx].next; + curidx = clipshape_idx_for_sprite(curspr, curidx); if (curidx < 0) { @@ -13372,14 +13386,7 @@ int32_t clipmove(vec3_t *pos, int16_t *sectnum, } curspr = &sprite[clipspritelist[clipspritecnt]]; - - if (curidx < 0) // per-sprite init - curidx = pictoidx[curspr->picnum]; - else - curidx = clipinfo[curidx].next; - - while (curidx>=0 && (curspr->cstat&32) != (sector[sectq[clipinfo[curidx].qbeg]].CM_CSTAT&32)) - curidx = clipinfo[curidx].next; + curidx = clipshape_idx_for_sprite(curspr, curidx); if (curidx < 0) { @@ -14265,14 +14272,7 @@ restart_grand: // one set of clip-sprite sectors completed, prepare the next curspr = &sprite[clipspritelist[clipspritecnt]]; - - if (curidx < 0) // per-sprite init - curidx = pictoidx[curspr->picnum]; - else - curidx = clipinfo[curidx].next; - - while (curidx>=0 && (curspr->cstat&32) != (sector[sectq[clipinfo[curidx].qbeg]].CM_CSTAT&32)) - curidx = clipinfo[curidx].next; + curidx = clipshape_idx_for_sprite(curspr, curidx); if (curidx < 0) { diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index e30106add..10e1de540 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -4328,7 +4328,8 @@ void P_ProcessInput(int32_t snum) { j = lz&(MAXSPRITES-1); - if ((sprite[j].cstat&33) == 33 || (sprite[j].cstat&17) == 17) + if ((sprite[j].cstat&33) == 33 || (sprite[j].cstat&17) == 17 || + clipshape_idx_for_sprite(&sprite[j], -1) >= 0) { if ((sprite[j].xvel&1) == 0) // EDuke32 extension {