From d20aa47adfb8dde0b6966172f66fb9857e05e2d1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 6 Nov 2021 19:27:51 +0100 Subject: [PATCH] - made sector parameter of updatesectorz an int and deprecated the short version. --- source/build/include/build.h | 10 +++++++++- source/build/src/engine.cpp | 4 ++-- source/core/gamefuncs.cpp | 2 +- source/core/gamefuncs.h | 3 ++- source/games/blood/src/view.cpp | 2 +- source/games/duke/src/render.cpp | 2 +- source/games/exhumed/src/view.cpp | 2 +- source/games/sw/src/draw.cpp | 10 +++++----- source/games/sw/src/player.cpp | 12 ++++++------ source/games/sw/src/rooms.cpp | 10 +++++----- source/games/sw/src/weapon.cpp | 2 +- 11 files changed, 34 insertions(+), 25 deletions(-) diff --git a/source/build/include/build.h b/source/build/include/build.h index aded26a33..2c2989e3c 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -411,7 +411,15 @@ inline void updatesector(int32_t const x, int32_t const y, int16_t * const sectn updatesector(x, y, &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 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))); diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index a78c28a2c..7bcdbc64c 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -895,7 +895,7 @@ int32_t setsprite(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]) 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 // (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) { diff --git a/source/core/gamefuncs.cpp b/source/core/gamefuncs.cpp index c8cd23b40..09fab5765 100644 --- a/source/core/gamefuncs.cpp +++ b/source/core/gamefuncs.cpp @@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 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; binangle daang; diff --git a/source/core/gamefuncs.h b/source/core/gamefuncs.h index 00df8a3af..1494b31d8 100644 --- a/source/core/gamefuncs.h +++ b/source/core/gamefuncs.h @@ -8,7 +8,8 @@ extern int cameradist, cameraclock; 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); inline void PlanesAtPoint(const sectortype* sec, float dax, float day, float* ceilz, float* florz) // this is just for warning evasion. { diff --git a/source/games/blood/src/view.cpp b/source/games/blood/src/view.cpp index 1b4c263b2..5847af9f8 100644 --- a/source/games/blood/src/view.cpp +++ b/source/games/blood/src/view.cpp @@ -474,7 +474,7 @@ void SetupView(int &cX, int& cY, int& cZ, binangle& cA, fixedhoriz& cH, int& nSe } 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); } diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index e75de10fd..98db70155 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -256,7 +256,7 @@ static int getdrugmode(player_struct *p, int oyrepeat) void displayrooms(int snum, double smoothratio) { int cposx, cposy, cposz, fz, cz; - short sect; + int sect; binangle cang, rotscrnang; fixedhoriz choriz; struct player_struct* p; diff --git a/source/games/exhumed/src/view.cpp b/source/games/exhumed/src/view.cpp index bd4358944..73c63cc83 100644 --- a/source/games/exhumed/src/view.cpp +++ b/source/games/exhumed/src/view.cpp @@ -203,7 +203,7 @@ void DrawView(double smoothRatio, bool sceneonly) int playerX; int playerY; int playerZ; - short nSector; + int nSector; binangle nAngle, rotscrnang; fixedhoriz pan; diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index bca04680d..1d7479ba9 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -914,7 +914,7 @@ post_analyzesprites(spritetype* tsprite, int& spritesortcnt) #endif 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 }; 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; binangle ang; @@ -1268,7 +1268,7 @@ int CopySprite(spritetype const * tsp, short newsector) int ConnectCopySprite(spritetype const * tsp) { - short newsector; + int newsector; int testz; if (FAF_ConnectCeiling(tsp->sectnum)) @@ -1460,7 +1460,7 @@ drawscreen(PLAYERp pp, double smoothratio) int tx, ty, tz; binangle tang, trotscrnang; fixedhoriz thoriz; - short tsectnum; + int tsectnum; short i,j; int bob_amt = 0; int quake_z, quake_x, quake_y; @@ -1515,7 +1515,7 @@ drawscreen(PLAYERp pp, double smoothratio) } tsectnum = camerapp->cursectnum; - COVERupdatesector(tx, ty, &tsectnum); + updatesector(tx, ty, &tsectnum); if (tsectnum >= 0) { diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 32efb8132..fb1cb1484 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -2263,7 +2263,7 @@ DoPlayerMove(PLAYERp pp) void DoPlayerSectorUpdatePreMove(PLAYERp pp) { - short sectnum = pp->cursectnum; + int sectnum = pp->cursectnum; if (sectnum < 0) return; @@ -2274,7 +2274,7 @@ DoPlayerSectorUpdatePreMove(PLAYERp pp) if (sectnum < 0) { sectnum = pp->cursectnum; - COVERupdatesector(pp->posx, pp->posy, §num); + updatesector(pp->posx, pp->posy, §num); } ASSERT(sectnum >= 0); } @@ -2284,7 +2284,7 @@ DoPlayerSectorUpdatePreMove(PLAYERp pp) if (sectnum < 0) { sectnum = pp->cursectnum; - COVERupdatesector(pp->posx, pp->posy, §num); + updatesector(pp->posx, pp->posy, §num); } ASSERT(sectnum >= 0); } @@ -3189,7 +3189,7 @@ void StackedWaterSplash(PLAYERp pp) { if (FAF_ConnectArea(pp->cursectnum)) { - short sectnum = pp->cursectnum; + int sectnum = pp->cursectnum; updatesectorz(pp->posx, pp->posy, SPRITEp_BOS(pp->SpriteP), §num); @@ -4097,7 +4097,7 @@ PlayerCanDiveNoWarp(PLAYERp pp) { if (FAF_ConnectArea(pp->cursectnum)) { - short sectnum = pp->cursectnum; + int sectnum = pp->cursectnum; updatesectorz(pp->posx, pp->posy, SPRITEp_BOS(pp->SpriteP), §num); @@ -4730,7 +4730,7 @@ DoPlayerDive(PLAYERp pp) { 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 updatesectorz(pp->posx, pp->posy, sector[pp->cursectnum].ceilingz - Z(8), §num); diff --git a/source/games/sw/src/rooms.cpp b/source/games/sw/src/rooms.cpp index b195793b3..035fa8da7 100644 --- a/source/games/sw/src/rooms.cpp +++ b/source/games/sw/src/rooms.cpp @@ -154,7 +154,7 @@ FAFhitscan(int32_t x, int32_t y, int32_t z, int16_t sectnum, { vec3_t firstpos = { x, y, z }; int loz, hiz; - short newsectnum = sectnum; + int newsectnum = sectnum; int startclipmask = 0; bool plax_found = false; @@ -532,7 +532,7 @@ void FAFgetzrange(vec3_t pos, int16_t sectnum, if (FAF_ConnectCeiling(sectnum)) { - short uppersect = sectnum; + int uppersect = sectnum; int newz = *hiz - Z(2); 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)) //if (FAF_ConnectFloor(sectnum)) { - short lowersect = sectnum; + int lowersect = sectnum; int newz = *loz + Z(2); 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)) { - short uppersect = sectnum; + int uppersect = sectnum; int newz = *hiz - Z(2); 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)) //if (FAF_ConnectFloor(sectnum)) { - short lowersect = sectnum; + int lowersect = sectnum; int newz = *loz + Z(2); switch (TEST(*florhit, HIT_MASK)) { diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 7c5d8a39b..12ce20ff2 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -12210,7 +12210,7 @@ DoBloodWorm(DSWActor* actor) int xvect,yvect; int bx,by; int amt; - short sectnum; + int sectnum; u = User[Weapon].Data();