engine: add yax_getflorzofslope() and yax_getceilzofslope()

This commit is contained in:
Richard C. Gobeille 2020-05-13 16:55:58 -07:00 committed by Christoph Oelckers
parent 5e677d6089
commit e2d79b4682
3 changed files with 31 additions and 23 deletions

View file

@ -963,6 +963,9 @@ void getzsofslopeptr(usectorptr_t sec, int32_t dax, int32_t day,
int32_t *ceilz, int32_t *florz) ATTRIBUTE((nonnull(1,4,5))); 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); void yax_getzsofslope(int sectNum, int playerX, int playerY, int32_t* pCeilZ, int32_t* pFloorZ);
int32_t yax_getceilzofslope(int const sectnum, vec2_t const vect);
int32_t yax_getflorzofslope(int const sectnum, vec2_t const vect);
static FORCE_INLINE int32_t getceilzofslope(int16_t sectnum, int32_t dax, int32_t day) static FORCE_INLINE int32_t getceilzofslope(int16_t sectnum, int32_t dax, int32_t day)
{ {
return getceilzofslopeptr((usectorptr_t)&sector[sectnum], dax, day); return getceilzofslopeptr((usectorptr_t)&sector[sectnum], dax, day);

View file

@ -5298,6 +5298,30 @@ floor:
else if (!didFloor) else if (!didFloor)
goto floor; goto floor;
} }
int32_t yax_getceilzofslope(int const sectnum, vec2_t const vect)
{
if ((sector[sectnum].ceilingstat&512)==0)
{
int const nsect = yax_getneighborsect(vect.x, vect.y, sectnum, YAX_CEILING);
if (nsect >= 0)
return getcorrectceilzofslope(nsect, vect.x, vect.y);
}
return getcorrectceilzofslope(sectnum, vect.x, vect.y);
}
int32_t yax_getflorzofslope(int const sectnum, vec2_t const vect)
{
if ((sector[sectnum].floorstat&512)==0)
{
int const nsect = yax_getneighborsect(vect.x, vect.y, sectnum, YAX_FLOOR);
if (nsect >= 0)
return getcorrectflorzofslope(nsect, vect.x, vect.y);
}
return getcorrectflorzofslope(sectnum, vect.x, vect.y);
}
#endif #endif
// //

View file

@ -627,23 +627,13 @@ static inline void VM_FacePlayer(int const shift)
: getangle(vm.pPlayer->pos.x - vm.pSprite->x, vm.pPlayer->pos.y - vm.pSprite->y)); : getangle(vm.pPlayer->pos.x - vm.pSprite->x, vm.pPlayer->pos.y - vm.pSprite->y));
} }
////////// TROR get*zofslope //////////
// These rather belong into the engine.
static int32_t VM_GetCeilZOfSlope(void) static int32_t VM_GetCeilZOfSlope(void)
{ {
vec2_t const vect = vm.pSprite->pos.vec2; vec2_t const vect = vm.pSprite->pos.vec2;
int const sectnum = vm.pSprite->sectnum; int const sectnum = vm.pSprite->sectnum;
#ifdef YAX_ENABLE return yax_getceilzofslope(sectnum, vect);
if ((sector[sectnum].ceilingstat&512)==0)
{
int const nsect = yax_getneighborsect(vect.x, vect.y, sectnum, YAX_CEILING);
if (nsect >= 0)
return getceilzofslope(nsect, vect.x, vect.y);
}
#endif
return getceilzofslope(sectnum, vect.x, vect.y);
} }
#ifndef EDUKE32_STANDALONE #ifndef EDUKE32_STANDALONE
@ -652,19 +642,10 @@ static int32_t VM_GetFlorZOfSlope(void)
vec2_t const vect = vm.pSprite->pos.vec2; vec2_t const vect = vm.pSprite->pos.vec2;
int const sectnum = vm.pSprite->sectnum; int const sectnum = vm.pSprite->sectnum;
#ifdef YAX_ENABLE return yax_getflorzofslope(sectnum, vect);
if ((sector[sectnum].floorstat&512)==0)
{
int const nsect = yax_getneighborsect(vect.x, vect.y, sectnum, YAX_FLOOR);
if (nsect >= 0)
return getflorzofslope(nsect, vect.x, vect.y);
}
#endif
return getflorzofslope(sectnum, vect.x, vect.y);
}
#endif
//////////////////// }
#endif
static int32_t A_GetWaterZOffset(int spritenum); static int32_t A_GetWaterZOffset(int spritenum);