mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Make get{zs,ceilz,florz}ofslope (now ...ptr) accept sectortype pointer.
And rewrite the original functions as wrappers around these. git-svn-id: https://svn.eduke32.com/eduke32@3323 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
4f2639f4d7
commit
d7cfde9d3d
2 changed files with 32 additions and 30 deletions
|
@ -818,10 +818,27 @@ void rotatepoint(int32_t xpivot, int32_t ypivot, int32_t x, int32_t y,
|
|||
int16_t daang, int32_t *x2, int32_t *y2) ATTRIBUTE((nonnull(6,7)));
|
||||
int32_t lastwall(int16_t point);
|
||||
int32_t nextsectorneighborz(int16_t sectnum, int32_t thez, int16_t topbottom, int16_t direction);
|
||||
int32_t getceilzofslope(int16_t sectnum, int32_t dax, int32_t day);
|
||||
int32_t getflorzofslope(int16_t sectnum, int32_t dax, int32_t day);
|
||||
void getzsofslope(int16_t sectnum, int32_t dax, int32_t day,
|
||||
int32_t *ceilz, int32_t *florz) ATTRIBUTE((nonnull(4,5)));
|
||||
|
||||
int32_t getceilzofslopeptr(const sectortype *sec, int32_t dax, int32_t day) ATTRIBUTE((nonnull(1)));
|
||||
int32_t getflorzofslopeptr(const sectortype *sec, int32_t dax, int32_t day) ATTRIBUTE((nonnull(1)));
|
||||
void getzsofslopeptr(const sectortype *sec, int32_t dax, int32_t day,
|
||||
int32_t *ceilz, int32_t *florz) ATTRIBUTE((nonnull(1,4,5)));
|
||||
|
||||
static inline int32_t getceilzofslope(int16_t sectnum, int32_t dax, int32_t day)
|
||||
{
|
||||
return getceilzofslopeptr(§or[sectnum], dax, day);
|
||||
}
|
||||
|
||||
static inline int32_t getflorzofslope(int16_t sectnum, int32_t dax, int32_t day)
|
||||
{
|
||||
return getflorzofslopeptr(§or[sectnum], dax, day);
|
||||
}
|
||||
|
||||
static inline void getzsofslope(int16_t sectnum, int32_t dax, int32_t day, int32_t *ceilz, int32_t *florz)
|
||||
{
|
||||
getzsofslopeptr(§or[sectnum], dax, day, ceilz, florz);
|
||||
}
|
||||
|
||||
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);
|
||||
|
|
|
@ -14297,57 +14297,42 @@ int32_t sectorofwall_noquick(int16_t theline)
|
|||
}
|
||||
|
||||
|
||||
//
|
||||
// getceilzofslope
|
||||
//
|
||||
int32_t getceilzofslope(int16_t sectnum, int32_t dax, int32_t day)
|
||||
int32_t getceilzofslopeptr(const sectortype *sec, int32_t dax, int32_t day)
|
||||
{
|
||||
if (!(sector[sectnum].ceilingstat&2)) return(sector[sectnum].ceilingz);
|
||||
if (!(sec->ceilingstat&2)) return(sec->ceilingz);
|
||||
|
||||
{
|
||||
int32_t dx, dy, i, j;
|
||||
walltype *wal;
|
||||
const walltype *wal = &wall[sec->wallptr];
|
||||
|
||||
wal = &wall[sector[sectnum].wallptr];
|
||||
// floor(sqrt(2**31-1)) == 46340
|
||||
dx = wall[wal->point2].x-wal->x; dy = wall[wal->point2].y-wal->y;
|
||||
i = (nsqrtasm(uhypsq(dx,dy))<<5); if (i == 0) return(sector[sectnum].ceilingz);
|
||||
i = (nsqrtasm(uhypsq(dx,dy))<<5); if (i == 0) return(sec->ceilingz);
|
||||
j = dmulscale3(dx,day-wal->y,-dy,dax-wal->x);
|
||||
return(sector[sectnum].ceilingz+(scale(sector[sectnum].ceilingheinum,j>>1,i)<<1));
|
||||
return(sec->ceilingz+(scale(sec->ceilingheinum,j>>1,i)<<1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// getflorzofslope
|
||||
//
|
||||
int32_t getflorzofslope(int16_t sectnum, int32_t dax, int32_t day)
|
||||
int32_t getflorzofslopeptr(const sectortype *sec, int32_t dax, int32_t day)
|
||||
{
|
||||
if (!(sector[sectnum].floorstat&2)) return(sector[sectnum].floorz);
|
||||
if (!(sec->floorstat&2)) return(sec->floorz);
|
||||
|
||||
{
|
||||
int32_t dx, dy, i, j;
|
||||
walltype *wal;
|
||||
const walltype *wal = &wall[sec->wallptr];
|
||||
|
||||
wal = &wall[sector[sectnum].wallptr];
|
||||
dx = wall[wal->point2].x-wal->x; dy = wall[wal->point2].y-wal->y;
|
||||
i = (nsqrtasm(uhypsq(dx,dy))<<5); if (i == 0) return(sector[sectnum].floorz);
|
||||
i = (nsqrtasm(uhypsq(dx,dy))<<5); if (i == 0) return(sec->floorz);
|
||||
j = dmulscale3(dx,day-wal->y,-dy,dax-wal->x);
|
||||
return(sector[sectnum].floorz+(scale(sector[sectnum].floorheinum,j>>1,i)<<1));
|
||||
return(sec->floorz+(scale(sec->floorheinum,j>>1,i)<<1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// getzsofslope
|
||||
//
|
||||
void getzsofslope(int16_t sectnum, int32_t dax, int32_t day, int32_t *ceilz, int32_t *florz)
|
||||
void getzsofslopeptr(const sectortype *sec, int32_t dax, int32_t day, int32_t *ceilz, int32_t *florz)
|
||||
{
|
||||
int32_t dx, dy, i, j;
|
||||
walltype *wal, *wal2;
|
||||
sectortype *sec;
|
||||
|
||||
sec = §or[sectnum];
|
||||
*ceilz = sec->ceilingz; *florz = sec->floorz;
|
||||
if ((sec->ceilingstat|sec->floorstat)&2)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue