mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
const correctness for parameters passed to the updatesector family of functions
git-svn-id: https://svn.eduke32.com/eduke32@7478 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
f50ad3d424
commit
631863ab67
2 changed files with 21 additions and 21 deletions
|
@ -1154,11 +1154,11 @@ void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange
|
|||
int32_t (*blacklist_sprite_func)(int32_t)) ATTRIBUTE((nonnull(6,7,8)));
|
||||
int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1,
|
||||
int32_t x2, int32_t y2, int32_t z2, int16_t sect2);
|
||||
void updatesector(int32_t x, int32_t y, int16_t *sectnum) ATTRIBUTE((nonnull(3)));
|
||||
void updatesectorbreadth(int32_t x, int32_t y, int16_t *sectnum) ATTRIBUTE((nonnull(3)));
|
||||
void updatesectorexclude(int32_t x, int32_t y, int16_t *sectnum,
|
||||
const uint8_t *excludesectbitmap) ATTRIBUTE((nonnull(3,4)));
|
||||
void updatesectorz(int32_t x, int32_t y, int32_t z, int16_t *sectnum) ATTRIBUTE((nonnull(4)));
|
||||
void updatesector(int32_t const x, int32_t const y, int16_t * const sectnum) ATTRIBUTE((nonnull(3)));
|
||||
void updatesectorbreadth(int32_t const x, int32_t const y, int16_t * const sectnum) ATTRIBUTE((nonnull(3)));
|
||||
void updatesectorexclude(int32_t const x, int32_t const y, int16_t * const sectnum,
|
||||
const uint8_t * const excludesectbitmap) ATTRIBUTE((nonnull(3,4)));
|
||||
void updatesectorz(int32_t const x, int32_t const y, int32_t const z, int16_t * const sectnum) ATTRIBUTE((nonnull(4)));
|
||||
int32_t inside(int32_t x, int32_t y, int16_t sectnum);
|
||||
void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day, uint8_t flags);
|
||||
void setfirstwall(int16_t sectnum, int16_t newfirstwall);
|
||||
|
|
|
@ -10964,35 +10964,35 @@ void bfirst_search_try(int16_t * const list, uint8_t * const bitmap, int32_t * c
|
|||
/* Different "is inside" predicates.
|
||||
* NOTE: The redundant bound checks are expected to be optimized away in the
|
||||
* inlined code. */
|
||||
static inline int32_t inside_p(int32_t x, int32_t y, int16_t sectnum)
|
||||
static inline bool inside_p(int32_t const x, int32_t const y, int const sectnum)
|
||||
{
|
||||
return (sectnum>=0 && inside(x, y, sectnum) == 1);
|
||||
}
|
||||
|
||||
static inline int32_t inside_exclude_p(int32_t x, int32_t y, int16_t i, const uint8_t *excludesectbitmap)
|
||||
static inline bool inside_exclude_p(int32_t const x, int32_t const y, int const sectnum, const uint8_t *excludesectbitmap)
|
||||
{
|
||||
return (i>=0 && !(excludesectbitmap[i>>3]&(1<<(i&7))) && inside_p(x, y, i));
|
||||
return (sectnum>=0 && !bitmap_test(excludesectbitmap, sectnum) && inside_p(x, y, sectnum));
|
||||
}
|
||||
|
||||
/* NOTE: no bound check */
|
||||
static inline int32_t inside_z_p(int32_t x, int32_t y, int32_t z, int16_t i)
|
||||
static inline bool inside_z_p(int32_t const x, int32_t const y, int32_t const z, int const sectnum)
|
||||
{
|
||||
int32_t cz, fz;
|
||||
getzsofslope(i, x, y, &cz, &fz);
|
||||
return (z >= cz && z <= fz && inside_p(x, y, i));
|
||||
getzsofslope(sectnum, x, y, &cz, &fz);
|
||||
return (z >= cz && z <= fz && inside_p(x, y, sectnum));
|
||||
}
|
||||
|
||||
#define SET_AND_RETURN(Lval, Rval) do \
|
||||
{ \
|
||||
#define SET_AND_RETURN(Lval, Rval) \
|
||||
do \
|
||||
{ \
|
||||
(Lval) = (Rval); \
|
||||
return; \
|
||||
} while (0)
|
||||
|
||||
} while (0)
|
||||
|
||||
//
|
||||
// updatesector[z]
|
||||
//
|
||||
void updatesector(int32_t x, int32_t y, int16_t *sectnum)
|
||||
void updatesector(int32_t const x, int32_t const y, int16_t * const sectnum)
|
||||
{
|
||||
if (inside_p(x,y,*sectnum))
|
||||
return;
|
||||
|
@ -11019,7 +11019,7 @@ void updatesector(int32_t x, int32_t y, int16_t *sectnum)
|
|||
*sectnum = -1;
|
||||
}
|
||||
|
||||
void updatesectorbreadth(int32_t x, int32_t y, int16_t *sectnum)
|
||||
void updatesectorbreadth(int32_t const x, int32_t const y, int16_t * const sectnum)
|
||||
{
|
||||
static int16_t sectlist[MAXSECTORS];
|
||||
static uint8_t sectbitmap[MAXSECTORS>>3];
|
||||
|
@ -11049,7 +11049,7 @@ void updatesectorbreadth(int32_t x, int32_t y, int16_t *sectnum)
|
|||
*sectnum = -1;
|
||||
}
|
||||
|
||||
void updatesectorexclude(int32_t x, int32_t y, int16_t *sectnum, const uint8_t *excludesectbitmap)
|
||||
void updatesectorexclude(int32_t const x, int32_t const y, int16_t * const sectnum, const uint8_t * const excludesectbitmap)
|
||||
{
|
||||
if (inside_exclude_p(x, y, *sectnum, excludesectbitmap))
|
||||
return;
|
||||
|
@ -11079,7 +11079,7 @@ void updatesectorexclude(int32_t x, int32_t y, int16_t *sectnum, const uint8_t *
|
|||
// new: if *sectnum >= MAXSECTORS, *sectnum-=MAXSECTORS is considered instead
|
||||
// as starting sector and the 'initial' z check is skipped
|
||||
// (not initial anymore because it follows the sector updating due to TROR)
|
||||
void updatesectorz(int32_t x, int32_t y, int32_t z, int16_t *sectnum)
|
||||
void updatesectorz(int32_t const x, int32_t const y, int32_t const z, int16_t * const sectnum)
|
||||
{
|
||||
if ((uint32_t)(*sectnum) < 2*MAXSECTORS)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue