- made sector parameter of updatesectorz an int and deprecated the short version.

This commit is contained in:
Christoph Oelckers 2021-11-06 19:27:51 +01:00
parent 13306e900d
commit d20aa47adf
11 changed files with 34 additions and 25 deletions

View file

@ -411,7 +411,15 @@ inline void updatesector(int32_t const x, int32_t const y, int16_t * const sectn
updatesector(x, y, &snum); updatesector(x, y, &snum);
*sectnum = snum; *sectnum = snum;
} }
void updatesectorz(int32_t const x, int32_t const y, int32_t const z, int16_t * const sectnum) ATTRIBUTE((nonnull(4))); void updatesectorz(int32_t const x, int32_t const y, int32_t const z, int * const sectnum) ATTRIBUTE((nonnull(4)));
[[deprecated]]
inline void updatesectorz(int32_t const x, int32_t const y, int32_t const z, int16_t* const sectnum)
{
int snum = *sectnum;
updatesectorz(x, y, z, &snum);
*sectnum = snum;
}
void updatesectorneighbor(int32_t const x, int32_t const y, int16_t * const sectnum, int32_t initialMaxDistance = INITIALUPDATESECTORDIST, int32_t maxDistance = MAXUPDATESECTORDIST) ATTRIBUTE((nonnull(3))); void updatesectorneighbor(int32_t const x, int32_t const y, int16_t * const sectnum, int32_t initialMaxDistance = INITIALUPDATESECTORDIST, int32_t maxDistance = MAXUPDATESECTORDIST) ATTRIBUTE((nonnull(3)));
void updatesectorneighborz(int32_t const x, int32_t const y, int32_t const z, int16_t * const sectnum, int32_t initialMaxDistance = INITIALUPDATESECTORDIST, int32_t maxDistance = MAXUPDATESECTORDIST) ATTRIBUTE((nonnull(4))); void updatesectorneighborz(int32_t const x, int32_t const y, int32_t const z, int16_t * const sectnum, int32_t initialMaxDistance = INITIALUPDATESECTORDIST, int32_t maxDistance = MAXUPDATESECTORDIST) ATTRIBUTE((nonnull(4)));

View file

@ -895,7 +895,7 @@ int32_t setsprite(int16_t spritenum, const vec3_t *newpos)
int32_t setspritez(int16_t spritenum, const vec3_t *newpos) int32_t setspritez(int16_t spritenum, const vec3_t *newpos)
{ {
int16_t tempsectnum = sprite[spritenum].sectnum; int tempsectnum = sprite[spritenum].sectnum;
if ((void const *)newpos != (void *)&sprite[spritenum]) if ((void const *)newpos != (void *)&sprite[spritenum])
sprite[spritenum].pos = *newpos; sprite[spritenum].pos = *newpos;
@ -1377,7 +1377,7 @@ void updatesector(int32_t const x, int32_t const y, int * const sectnum)
// as starting sector and the 'initial' z check is skipped // as starting sector and the 'initial' z check is skipped
// (not initial anymore because it follows the sector updating due to TROR) // (not initial anymore because it follows the sector updating due to TROR)
void updatesectorz(int32_t const x, int32_t const y, int32_t const z, int16_t * const sectnum) void updatesectorz(int32_t const x, int32_t const y, int32_t const z, int* const sectnum)
{ {
if (enginecompatibility_mode != ENGINECOMPATIBILITY_NONE) if (enginecompatibility_mode != ENGINECOMPATIBILITY_NONE)
{ {

View file

@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
int cameradist, cameraclock; int cameradist, cameraclock;
bool calcChaseCamPos(int* px, int* py, int* pz, spritetype* pspr, short *psectnum, binangle ang, fixedhoriz horiz, double const smoothratio) bool calcChaseCamPos(int* px, int* py, int* pz, spritetype* pspr, int *psectnum, binangle ang, fixedhoriz horiz, double const smoothratio)
{ {
hitdata_t hitinfo; hitdata_t hitinfo;
binangle daang; binangle daang;

View file

@ -8,7 +8,8 @@ extern int cameradist, cameraclock;
void loaddefinitionsfile(const char* fn, bool cumulative = false, bool maingrp = false); void loaddefinitionsfile(const char* fn, bool cumulative = false, bool maingrp = false);
bool calcChaseCamPos(int* px, int* py, int* pz, spritetype* pspr, short *psectnum, binangle ang, fixedhoriz horiz, double const smoothratio); bool calcChaseCamPos(int* px, int* py, int* pz, spritetype* pspr, int *psectnum, binangle ang, fixedhoriz horiz, double const smoothratio);
void PlanesAtPoint(const sectortype* sec, int dax, int day, float* ceilz, float* florz); void PlanesAtPoint(const sectortype* sec, int dax, int day, float* ceilz, float* florz);
inline void PlanesAtPoint(const sectortype* sec, float dax, float day, float* ceilz, float* florz) // this is just for warning evasion. inline void PlanesAtPoint(const sectortype* sec, float dax, float day, float* ceilz, float* florz) // this is just for warning evasion.
{ {

View file

@ -474,7 +474,7 @@ void SetupView(int &cX, int& cY, int& cZ, binangle& cA, fixedhoriz& cH, int& nSe
} }
else else
{ {
calcChaseCamPos((int*)&cX, (int*)&cY, (int*)&cZ, gView->pSprite, (short*)&nSectnum, cA, cH, gInterpolate); calcChaseCamPos((int*)&cX, (int*)&cY, (int*)&cZ, gView->pSprite, &nSectnum, cA, cH, gInterpolate);
} }
CheckLink((int*)&cX, (int*)&cY, (int*)&cZ, &nSectnum); CheckLink((int*)&cX, (int*)&cY, (int*)&cZ, &nSectnum);
} }

View file

@ -256,7 +256,7 @@ static int getdrugmode(player_struct *p, int oyrepeat)
void displayrooms(int snum, double smoothratio) void displayrooms(int snum, double smoothratio)
{ {
int cposx, cposy, cposz, fz, cz; int cposx, cposy, cposz, fz, cz;
short sect; int sect;
binangle cang, rotscrnang; binangle cang, rotscrnang;
fixedhoriz choriz; fixedhoriz choriz;
struct player_struct* p; struct player_struct* p;

View file

@ -203,7 +203,7 @@ void DrawView(double smoothRatio, bool sceneonly)
int playerX; int playerX;
int playerY; int playerY;
int playerZ; int playerZ;
short nSector; int nSector;
binangle nAngle, rotscrnang; binangle nAngle, rotscrnang;
fixedhoriz pan; fixedhoriz pan;

View file

@ -914,7 +914,7 @@ post_analyzesprites(spritetype* tsprite, int& spritesortcnt)
#endif #endif
void void
CircleCamera(int *nx, int *ny, int *nz, short *vsect, binangle *nang, fixed_t q16horiz) CircleCamera(int *nx, int *ny, int *nz, int *vsect, binangle *nang, fixed_t q16horiz)
{ {
vec3_t n = { *nx, *ny, *nz }; vec3_t n = { *nx, *ny, *nz };
SPRITEp sp; SPRITEp sp;
@ -1091,7 +1091,7 @@ void DrawCrosshair(PLAYERp pp)
} }
} }
void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, short *tsectnum, binangle *tang, fixedhoriz *thoriz) void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, int *tsectnum, binangle *tang, fixedhoriz *thoriz)
{ {
int i; int i;
binangle ang; binangle ang;
@ -1268,7 +1268,7 @@ int CopySprite(spritetype const * tsp, short newsector)
int ConnectCopySprite(spritetype const * tsp) int ConnectCopySprite(spritetype const * tsp)
{ {
short newsector; int newsector;
int testz; int testz;
if (FAF_ConnectCeiling(tsp->sectnum)) if (FAF_ConnectCeiling(tsp->sectnum))
@ -1460,7 +1460,7 @@ drawscreen(PLAYERp pp, double smoothratio)
int tx, ty, tz; int tx, ty, tz;
binangle tang, trotscrnang; binangle tang, trotscrnang;
fixedhoriz thoriz; fixedhoriz thoriz;
short tsectnum; int tsectnum;
short i,j; short i,j;
int bob_amt = 0; int bob_amt = 0;
int quake_z, quake_x, quake_y; int quake_z, quake_x, quake_y;
@ -1515,7 +1515,7 @@ drawscreen(PLAYERp pp, double smoothratio)
} }
tsectnum = camerapp->cursectnum; tsectnum = camerapp->cursectnum;
COVERupdatesector(tx, ty, &tsectnum); updatesector(tx, ty, &tsectnum);
if (tsectnum >= 0) if (tsectnum >= 0)
{ {

View file

@ -2263,7 +2263,7 @@ DoPlayerMove(PLAYERp pp)
void void
DoPlayerSectorUpdatePreMove(PLAYERp pp) DoPlayerSectorUpdatePreMove(PLAYERp pp)
{ {
short sectnum = pp->cursectnum; int sectnum = pp->cursectnum;
if (sectnum < 0) if (sectnum < 0)
return; return;
@ -2274,7 +2274,7 @@ DoPlayerSectorUpdatePreMove(PLAYERp pp)
if (sectnum < 0) if (sectnum < 0)
{ {
sectnum = pp->cursectnum; sectnum = pp->cursectnum;
COVERupdatesector(pp->posx, pp->posy, &sectnum); updatesector(pp->posx, pp->posy, &sectnum);
} }
ASSERT(sectnum >= 0); ASSERT(sectnum >= 0);
} }
@ -2284,7 +2284,7 @@ DoPlayerSectorUpdatePreMove(PLAYERp pp)
if (sectnum < 0) if (sectnum < 0)
{ {
sectnum = pp->cursectnum; sectnum = pp->cursectnum;
COVERupdatesector(pp->posx, pp->posy, &sectnum); updatesector(pp->posx, pp->posy, &sectnum);
} }
ASSERT(sectnum >= 0); ASSERT(sectnum >= 0);
} }
@ -3189,7 +3189,7 @@ void StackedWaterSplash(PLAYERp pp)
{ {
if (FAF_ConnectArea(pp->cursectnum)) if (FAF_ConnectArea(pp->cursectnum))
{ {
short sectnum = pp->cursectnum; int sectnum = pp->cursectnum;
updatesectorz(pp->posx, pp->posy, SPRITEp_BOS(pp->SpriteP), &sectnum); updatesectorz(pp->posx, pp->posy, SPRITEp_BOS(pp->SpriteP), &sectnum);
@ -4097,7 +4097,7 @@ PlayerCanDiveNoWarp(PLAYERp pp)
{ {
if (FAF_ConnectArea(pp->cursectnum)) if (FAF_ConnectArea(pp->cursectnum))
{ {
short sectnum = pp->cursectnum; int sectnum = pp->cursectnum;
updatesectorz(pp->posx, pp->posy, SPRITEp_BOS(pp->SpriteP), &sectnum); updatesectorz(pp->posx, pp->posy, SPRITEp_BOS(pp->SpriteP), &sectnum);
@ -4730,7 +4730,7 @@ DoPlayerDive(PLAYERp pp)
{ {
if (pp->posz < sector[pp->cursectnum].ceilingz + Z(10)) if (pp->posz < sector[pp->cursectnum].ceilingz + Z(10))
{ {
short sectnum = pp->cursectnum; int sectnum = pp->cursectnum;
// check for sector above to see if it is an underwater sector also // check for sector above to see if it is an underwater sector also
updatesectorz(pp->posx, pp->posy, sector[pp->cursectnum].ceilingz - Z(8), &sectnum); updatesectorz(pp->posx, pp->posy, sector[pp->cursectnum].ceilingz - Z(8), &sectnum);

View file

@ -154,7 +154,7 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum,
{ {
vec3_t firstpos = { x, y, z }; vec3_t firstpos = { x, y, z };
int loz, hiz; int loz, hiz;
short newsectnum = sectnum; int newsectnum = sectnum;
int startclipmask = 0; int startclipmask = 0;
bool plax_found = false; bool plax_found = false;
@ -532,7 +532,7 @@ void FAFgetzrange(vec3_t pos, int16_t sectnum,
if (FAF_ConnectCeiling(sectnum)) if (FAF_ConnectCeiling(sectnum))
{ {
short uppersect = sectnum; int uppersect = sectnum;
int newz = *hiz - Z(2); int newz = *hiz - Z(2);
switch (TEST(*ceilhit, HIT_MASK)) switch (TEST(*ceilhit, HIT_MASK))
@ -552,7 +552,7 @@ void FAFgetzrange(vec3_t pos, int16_t sectnum,
else if (FAF_ConnectFloor(sectnum) && !TEST(sector[sectnum].floorstat, FLOOR_STAT_FAF_BLOCK_HITSCAN)) else if (FAF_ConnectFloor(sectnum) && !TEST(sector[sectnum].floorstat, FLOOR_STAT_FAF_BLOCK_HITSCAN))
//if (FAF_ConnectFloor(sectnum)) //if (FAF_ConnectFloor(sectnum))
{ {
short lowersect = sectnum; int lowersect = sectnum;
int newz = *loz + Z(2); int newz = *loz + Z(2);
switch (TEST(*florhit, HIT_MASK)) switch (TEST(*florhit, HIT_MASK))
@ -606,7 +606,7 @@ void FAFgetzrangepoint(int32_t x, int32_t y, int32_t z, int16_t sectnum,
if (FAF_ConnectCeiling(sectnum)) if (FAF_ConnectCeiling(sectnum))
{ {
short uppersect = sectnum; int uppersect = sectnum;
int newz = *hiz - Z(2); int newz = *hiz - Z(2);
switch (TEST(*ceilhit, HIT_MASK)) switch (TEST(*ceilhit, HIT_MASK))
{ {
@ -622,7 +622,7 @@ void FAFgetzrangepoint(int32_t x, int32_t y, int32_t z, int16_t sectnum,
else if (FAF_ConnectFloor(sectnum) && !TEST(sector[sectnum].floorstat, FLOOR_STAT_FAF_BLOCK_HITSCAN)) else if (FAF_ConnectFloor(sectnum) && !TEST(sector[sectnum].floorstat, FLOOR_STAT_FAF_BLOCK_HITSCAN))
//if (FAF_ConnectFloor(sectnum)) //if (FAF_ConnectFloor(sectnum))
{ {
short lowersect = sectnum; int lowersect = sectnum;
int newz = *loz + Z(2); int newz = *loz + Z(2);
switch (TEST(*florhit, HIT_MASK)) switch (TEST(*florhit, HIT_MASK))
{ {

View file

@ -12210,7 +12210,7 @@ DoBloodWorm(DSWActor* actor)
int xvect,yvect; int xvect,yvect;
int bx,by; int bx,by;
int amt; int amt;
short sectnum; int sectnum;
u = User[Weapon].Data(); u = User[Weapon].Data();