mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 00:41:55 +00:00
- made updatesector receive a 32 bit int pointer and deprecated the 16 bit variant.
This commit is contained in:
parent
f2adeff8c1
commit
83fe41e71e
19 changed files with 49 additions and 43 deletions
|
@ -236,7 +236,7 @@ if( MSVC )
|
|||
set( DEB_C_FLAGS "/D _CRTDBG_MAP_ALLOC /MTd" )
|
||||
|
||||
# Disable warnings for unsecure CRT functions from VC8+
|
||||
set( ALL_C_FLAGS "${ALL_C_FLAGS} /wd4996 /DUNICODE /D_UNICODE /D_WIN32_WINNT=0x0600" )
|
||||
set( ALL_C_FLAGS "${ALL_C_FLAGS} /DUNICODE /D_UNICODE /D_WIN32_WINNT=0x0600 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS" )
|
||||
|
||||
# These must be silenced because the code is full of them. Expect some of undefined behavior hidden in this mess. :(
|
||||
#set( ALL_C_FLAGS "${ALL_C_FLAGS} /wd4244 /wd4018 /wd4267" )
|
||||
|
|
|
@ -403,7 +403,14 @@ int32_t try_facespr_intersect(uspriteptr_t const spr, vec3_t const in,
|
|||
|
||||
#define MAXUPDATESECTORDIST 1536
|
||||
#define INITIALUPDATESECTORDIST 256
|
||||
void updatesector(int32_t const x, int32_t const y, int16_t * const sectnum) ATTRIBUTE((nonnull(3)));
|
||||
void updatesector(int const x, int const y, int * const sectnum) ATTRIBUTE((nonnull(3)));
|
||||
[[deprecated]]
|
||||
inline void updatesector(int32_t const x, int32_t const y, int16_t * const sectnum) ATTRIBUTE((nonnull(3)))
|
||||
{
|
||||
int snum = *sectnum;
|
||||
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 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)));
|
||||
|
|
|
@ -43,7 +43,7 @@ void renderPrepareMirror(int32_t dax, int32_t day, int32_t daz, fixed_t daang,
|
|||
int32_t* tposx, int32_t* tposy, fixed_t* tang);
|
||||
void renderCompleteMirror(void);
|
||||
|
||||
int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz, fixed_t daang, fixed_t dahoriz, int16_t dacursectnum);
|
||||
int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz, fixed_t daang, fixed_t dahoriz, int dacursectnum);
|
||||
|
||||
void renderDrawMasks(void);
|
||||
|
||||
|
|
|
@ -1356,7 +1356,7 @@ int findwallbetweensectors(int sect1, int sect2)
|
|||
//
|
||||
// updatesector[z]
|
||||
//
|
||||
void updatesector(int32_t const x, int32_t const y, int16_t * const sectnum)
|
||||
void updatesector(int32_t const x, int32_t const y, int * const sectnum)
|
||||
{
|
||||
int16_t sect = *sectnum;
|
||||
updatesectorneighbor(x, y, §, INITIALUPDATESECTORDIST, MAXUPDATESECTORDIST);
|
||||
|
|
|
@ -3307,7 +3307,7 @@ void renderCompleteMirror(void)
|
|||
EXTERN_CVAR(Int, gl_fogmode)
|
||||
|
||||
int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz,
|
||||
fixed_t daang, fixed_t dahoriz, int16_t dacursectnum)
|
||||
fixed_t daang, fixed_t dahoriz, int dacursectnum)
|
||||
{
|
||||
pm_spritesortcnt = 0;
|
||||
checkRotatedWalls();
|
||||
|
|
|
@ -475,7 +475,7 @@ void PlayerHorizon::calcviewpitch(vec2_t const pos, binangle const ang, bool con
|
|||
int const shift = -(isBlood() ? BLOODSINSHIFT : DEFSINSHIFT);
|
||||
int const x = pos.x + ang.bcos(shift);
|
||||
int const y = pos.y + ang.bsin(shift);
|
||||
int16_t tempsect = cursectnum;
|
||||
int tempsect = cursectnum;
|
||||
updatesector(x, y, &tempsect);
|
||||
|
||||
if (tempsect >= 0) // If the new point is inside a valid sector...
|
||||
|
|
|
@ -314,9 +314,7 @@ void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sect
|
|||
|
||||
if (gl_fogmode == 1) gl_fogmode = 2; // still needed?
|
||||
|
||||
int16_t sect = sectnum;
|
||||
updatesector(position.x, position.y, §);
|
||||
if (sect >= 0) sectnum = sect;
|
||||
updatesector(position.x, position.y, §num);
|
||||
if (sectnum < 0) return;
|
||||
|
||||
iter_dlightf = iter_dlight = draw_dlight = draw_dlightf = 0;
|
||||
|
@ -369,9 +367,7 @@ void render_drawrooms(spritetype* playersprite, const vec3_t& position, int sect
|
|||
|
||||
void render_camtex(spritetype* playersprite, const vec3_t& position, int sectnum, binangle angle, fixedhoriz horizon, binangle rollang, FGameTexture* camtex, IntRect& rect, double smoothratio)
|
||||
{
|
||||
int16_t sect = sectnum;
|
||||
updatesector(position.x, position.y, §);
|
||||
if (sect >= 0) sectnum = sect;
|
||||
updatesector(position.x, position.y, §num);
|
||||
if (sectnum < 0) return;
|
||||
|
||||
screen->RenderState()->SetVertexBuffer(screen->mVertexData);
|
||||
|
|
|
@ -2770,7 +2770,7 @@ static void actNapalmMove(DBloodActor* actor)
|
|||
static DBloodActor* actSpawnFloor(DBloodActor* actor)
|
||||
{
|
||||
auto pSprite = &actor->s();
|
||||
short sector = pSprite->sectnum;
|
||||
int sector = pSprite->sectnum;
|
||||
int x = pSprite->x;
|
||||
int y = pSprite->y;
|
||||
updatesector(x, y, §or);
|
||||
|
@ -5392,7 +5392,7 @@ int MoveMissile(DBloodActor* actor)
|
|||
enginecompatibility_mode = bakCompat; // restore
|
||||
pSprite->cstat = bakSpriteCstat;
|
||||
clipmoveboxtracenum = 3;
|
||||
short nSector = nSector2;
|
||||
int nSector = nSector2;
|
||||
if (nSector2 < 0)
|
||||
{
|
||||
cliptype = -1;
|
||||
|
|
|
@ -196,7 +196,7 @@ void CFX::fxProcess(void)
|
|||
{
|
||||
spritetype *pSprite = &actor->s();
|
||||
viewBackupSpriteLoc(actor);
|
||||
short nSector = pSprite->sectnum;
|
||||
int nSector = pSprite->sectnum;
|
||||
assert(nSector >= 0 && nSector < kMaxSectors);
|
||||
assert(pSprite->type < kFXMax);
|
||||
FXDATA *pFXData = &gFXData[pSprite->type];
|
||||
|
|
|
@ -243,7 +243,7 @@ static void fakeProcessInput(PLAYER *pPlayer, InputPacket *pInput)
|
|||
int z1 = getflorzofslope(nSector, predict.x, predict.y);
|
||||
int x2 = predict.x+MulScale(64, Cos(predict.angle.asbuild()), 30);
|
||||
int y2 = predict.y+MulScale(64, Sin(predict.angle.asbuild()), 30);
|
||||
short nSector2 = nSector;
|
||||
int nSector2 = nSector;
|
||||
updatesector(x2, y2, &nSector2);
|
||||
if (nSector2 == nSector)
|
||||
{
|
||||
|
|
|
@ -2894,7 +2894,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
|
|||
auto psp = ps[p].GetActor();
|
||||
if (psp->s->extra > 0)
|
||||
{
|
||||
short k = ps[p].cursectnum;
|
||||
int k = ps[p].cursectnum;
|
||||
updatesector(ps[p].pos.x, ps[p].pos.y, &k);
|
||||
if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && ps[p].cursectnum != s->sectnum))
|
||||
{
|
||||
|
@ -2978,7 +2978,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
|
|||
{
|
||||
if (ps[p].GetActor()->s->extra > 0)
|
||||
{
|
||||
short k = ps[p].cursectnum;
|
||||
int k = ps[p].cursectnum;
|
||||
updatesector(ps[p].pos.x, ps[p].pos.y, &k);
|
||||
if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && ps[p].cursectnum != s->sectnum))
|
||||
{
|
||||
|
@ -3000,7 +3000,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
|
|||
{
|
||||
if (a2->s->statnum == 1 && badguy(a2) && a2->s->picnum != SECTOREFFECTOR && a2->s->picnum != LOCATORS)
|
||||
{
|
||||
short k = a2->s->sectnum;
|
||||
int k = a2->s->sectnum;
|
||||
updatesector(a2->s->x, a2->s->y, &k);
|
||||
if (a2->s->extra >= 0 && k == s->sectnum)
|
||||
{
|
||||
|
@ -3083,7 +3083,7 @@ void handle_se30(DDukeActor *actor, int JIBS6)
|
|||
auto psp = ps[p].GetActor();
|
||||
if (psp->s->extra > 0)
|
||||
{
|
||||
short k = ps[p].cursectnum;
|
||||
int k = ps[p].cursectnum;
|
||||
updatesector(ps[p].pos.x, ps[p].pos.y, &k);
|
||||
if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && ps[p].cursectnum != s->sectnum))
|
||||
{
|
||||
|
@ -3146,7 +3146,7 @@ void handle_se30(DDukeActor *actor, int JIBS6)
|
|||
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
||||
if (ps[p].GetActor()->s->extra > 0)
|
||||
{
|
||||
short k = ps[p].cursectnum;
|
||||
int k = ps[p].cursectnum;
|
||||
updatesector(ps[p].pos.x, ps[p].pos.y, &k);
|
||||
if ((k == -1 && ud.clipping == 0) || (k == s->sectnum && ps[p].cursectnum != s->sectnum))
|
||||
{
|
||||
|
@ -3172,7 +3172,7 @@ void handle_se30(DDukeActor *actor, int JIBS6)
|
|||
{
|
||||
// if(a2->s.sectnum != s->sectnum)
|
||||
{
|
||||
short k = a2->s->sectnum;
|
||||
int k = a2->s->sectnum;
|
||||
updatesector(a2->s->x, a2->s->y, &k);
|
||||
if (a2->s->extra >= 0 && k == s->sectnum)
|
||||
{
|
||||
|
|
|
@ -342,7 +342,8 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
|
|||
walltype* wal;
|
||||
int d, q, x1, y1;
|
||||
int sectcnt, sectend, dasect, startwall, endwall, nextsect;
|
||||
short p, x, sect;
|
||||
short p, x;
|
||||
int sect;
|
||||
static const uint8_t statlist[] = { STAT_DEFAULT, STAT_ACTOR, STAT_STANDABLE, STAT_PLAYER, STAT_FALLER, STAT_ZOMBIEACTOR, STAT_MISC };
|
||||
short tempshort[MAXSECTORS]; // originally hijacked a global buffer which is bad. Q: How many do we really need? RedNukem says 64.
|
||||
|
||||
|
@ -705,7 +706,8 @@ void guts_d(DDukeActor* actor, short gtype, short n, short p)
|
|||
void movefta_d(void)
|
||||
{
|
||||
int x, px, py, sx, sy;
|
||||
short p, psect, ssect;
|
||||
short p;
|
||||
int psect, ssect;
|
||||
int j;
|
||||
|
||||
DukeStatIterator iti(STAT_ZOMBIEACTOR);
|
||||
|
|
|
@ -219,7 +219,8 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h
|
|||
walltype* wal;
|
||||
int d, q, x1, y1;
|
||||
int sectcnt, sectend, dasect, startwall, endwall, nextsect;
|
||||
short p, x, sect;
|
||||
short p, x;
|
||||
int sect;
|
||||
static const uint8_t statlist[] = { STAT_DEFAULT, STAT_ACTOR, STAT_STANDABLE, STAT_PLAYER, STAT_FALLER, STAT_ZOMBIEACTOR, STAT_MISC };
|
||||
short tempshort[MAXSECTORS]; // originally hijacked a global buffer which is bad. Q: How many do we really need? RedNukem says 64.
|
||||
|
||||
|
@ -526,7 +527,8 @@ void guts_r(DDukeActor* actor, short gtype, short n, short p)
|
|||
void movefta_r(void)
|
||||
{
|
||||
int x, px, py, sx, sy;
|
||||
short j, p, psect, ssect;
|
||||
short j, p;
|
||||
int psect, ssect;
|
||||
|
||||
DukeStatIterator it(STAT_ZOMBIEACTOR);
|
||||
while(auto act = it.Next())
|
||||
|
|
|
@ -2780,7 +2780,7 @@ int ParseState::parse(void)
|
|||
break;
|
||||
case concmd_ifawayfromwall:
|
||||
{
|
||||
short s1;
|
||||
int s1;
|
||||
|
||||
s1 = g_sp->sectnum;
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ void forceplayerangle(int snum)
|
|||
void tracers(int x1, int y1, int z1, int x2, int y2, int z2, int n)
|
||||
{
|
||||
int i, xv, yv, zv;
|
||||
short sect = -1;
|
||||
int sect = -1;
|
||||
|
||||
i = n + 1;
|
||||
xv = (x2 - x1) / i;
|
||||
|
|
|
@ -641,7 +641,7 @@ void activatebysector_d(int sect, DDukeActor* activator)
|
|||
|
||||
void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atwith)
|
||||
{
|
||||
short j, sn = -1, darkestwall;
|
||||
int j, sn = -1, darkestwall;
|
||||
walltype* wal;
|
||||
|
||||
wal = &wall[dawallnum];
|
||||
|
|
|
@ -919,10 +919,10 @@ void activatebysector_r(int sect, DDukeActor* activator)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void lotsofpopcorn(DDukeActor *actor, short wallnum, short n)
|
||||
static void lotsofpopcorn(DDukeActor *actor, int wallnum, int n)
|
||||
{
|
||||
int j, xv, yv, z, x1, y1;
|
||||
short sect, a;
|
||||
int sect, a;
|
||||
|
||||
sect = -1;
|
||||
auto sp = actor->s;
|
||||
|
@ -976,7 +976,8 @@ static void lotsofpopcorn(DDukeActor *actor, short wallnum, short n)
|
|||
|
||||
void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atwith)
|
||||
{
|
||||
short j, i, sn = -1, darkestwall;
|
||||
short j, i;
|
||||
int sn = -1, darkestwall;
|
||||
walltype* wal;
|
||||
spritetype* s;
|
||||
|
||||
|
|
|
@ -343,7 +343,7 @@ void spawntransporter(DDukeActor *actj, DDukeActor* acti, bool beam)
|
|||
int spawnbloodpoolpart1(DDukeActor *actj, DDukeActor* acti)
|
||||
{
|
||||
auto sp = acti->s;
|
||||
short s1 = sp->sectnum;
|
||||
int s1 = sp->sectnum;
|
||||
|
||||
updatesector(sp->x + 108, sp->y + 108, &s1);
|
||||
if (s1 >= 0 && sector[s1].floorz == sp->sector()->floorz)
|
||||
|
@ -386,21 +386,19 @@ void initfootprint(DDukeActor* actj, DDukeActor* acti)
|
|||
int sect = sp->sectnum;
|
||||
if (actj)
|
||||
{
|
||||
short s1;
|
||||
s1 = sp->sectnum;
|
||||
auto sect1 = §or[s1];
|
||||
int s1 = sp->sectnum;
|
||||
|
||||
updatesector(sp->x + 84, sp->y + 84, &s1);
|
||||
if (s1 >= 0 && sect1->floorz == sp->sector()->floorz)
|
||||
if (s1 >= 0 && sector[s1].floorz == sp->sector()->floorz)
|
||||
{
|
||||
updatesector(sp->x - 84, sp->y - 84, &s1);
|
||||
if (s1 >= 0 && sect1->floorz == sp->sector()->floorz)
|
||||
if (s1 >= 0 && sector[s1].floorz == sp->sector()->floorz)
|
||||
{
|
||||
updatesector(sp->x + 84, sp->y - 84, &s1);
|
||||
if (s1 >= 0 && sect1->floorz == sp->sector()->floorz)
|
||||
if (s1 >= 0 && sector[s1].floorz == sp->sector()->floorz)
|
||||
{
|
||||
updatesector(sp->x - 84, sp->y + 84, &s1);
|
||||
if (s1 >= 0 && sect1->floorz != sp->sector()->floorz)
|
||||
if (s1 >= 0 && sector[s1].floorz != sp->sector()->floorz)
|
||||
{
|
||||
sp->xrepeat = sp->yrepeat = 0; changeactorstat(acti, STAT_MISC); return;
|
||||
}
|
||||
|
@ -1126,7 +1124,7 @@ void spawneffector(DDukeActor* actor)
|
|||
void lotsofglass(DDukeActor *actor, int wallnum, int n)
|
||||
{
|
||||
int j, xv, yv, z, x1, y1, a;
|
||||
short sect;
|
||||
int sect;
|
||||
auto sp = actor->s;
|
||||
|
||||
sect = -1;
|
||||
|
@ -1234,7 +1232,7 @@ void ceilingglass(DDukeActor* actor, int sectnum, int n)
|
|||
void lotsofcolourglass(DDukeActor* actor, int wallnum, int n)
|
||||
{
|
||||
int j, xv, yv, z, x1, y1;
|
||||
short sect = -1;
|
||||
int sect = -1;
|
||||
int a;;
|
||||
auto sp = actor->s;
|
||||
|
||||
|
|
|
@ -274,7 +274,7 @@ DoShadows(spritetype* tsprite, int& spritesortcnt, tspriteptr_t tsp, int viewz,
|
|||
int loz;
|
||||
short xrepeat;
|
||||
short yrepeat;
|
||||
short sectnum;
|
||||
int sectnum;
|
||||
|
||||
sectnum = tsp->sectnum;
|
||||
// make sure its the correct sector
|
||||
|
|
Loading…
Reference in a new issue