From 91e2391911e06f6b5ca8f8f6dbbffcaeac1b2e4e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 26 Nov 2021 18:59:28 +0100 Subject: [PATCH] - adapted neartag in Duke. --- source/build/include/build.h | 5 +- source/build/src/engine.cpp | 9 ++-- source/core/coreactor.h | 19 ++++++++ source/games/duke/src/dukeactor.h | 24 ---------- source/games/duke/src/gameexec.cpp | 8 ++-- source/games/duke/src/sectors_d.cpp | 62 ++++++++++++------------- source/games/duke/src/sectors_r.cpp | 71 ++++++++++++++--------------- source/games/exhumed/src/player.cpp | 2 +- source/games/sw/src/ai.cpp | 2 +- source/games/sw/src/player.cpp | 6 +-- source/games/sw/src/sector.cpp | 4 +- source/games/sw/src/sprite.cpp | 4 +- source/games/sw/src/track.cpp | 4 +- 13 files changed, 101 insertions(+), 119 deletions(-) diff --git a/source/build/include/build.h b/source/build/include/build.h index 62f6b6ae3..286b77621 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -387,10 +387,9 @@ extern vec2_t hitscangoal; int32_t hitscan_(const vec3_t* sv, int16_t sectnum, int32_t vx, int32_t vy, int32_t vz, hitdata_t* hitinfo, uint32_t cliptype) ATTRIBUTE((nonnull(1, 6))); -void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, +void neartag_(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, int16_t *neartagsector, int16_t *neartagwall, int16_t *neartagsprite, - int32_t *neartaghitdist, int32_t neartagrange, uint8_t tagsearch, - int32_t (*blacklist_sprite_func)(int32_t) = nullptr) ATTRIBUTE((nonnull(6,7,8))); + int32_t *neartaghitdist, int32_t neartagrange, uint8_t tagsearch); 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); int32_t inside(int32_t x, int32_t y, int sectnum); diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 1d0a0a446..e5a1944b4 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -911,10 +911,9 @@ int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, int32_t x2, in // // neartag // -void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, +void neartag_(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, int16_t *neartagsector, int16_t *neartagwall, int16_t *neartagsprite, int32_t *neartaghitdist, /* out */ - int32_t neartagrange, uint8_t tagsearch, - int32_t (*blacklist_sprite_func)(int32_t)) + int32_t neartagrange, uint8_t tagsearch) { int16_t tempshortcnt, tempshortnum; @@ -926,7 +925,7 @@ void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, *neartagsector = -1; *neartagwall = -1; *neartagsprite = -1; *neartaghitdist = 0; - if (sectnum < 0 || (tagsearch & 3) == 0) + if (!validSectorIndex(sectnum) || (tagsearch & 3) == 0) return; clipsectorlist[0] = sectnum; @@ -993,8 +992,6 @@ void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, if (spr->cstat2 & CSTAT2_SPRITE_NOFIND) continue; - if (blacklist_sprite_func && blacklist_sprite_func(z)) - continue; if (((tagsearch&1) && spr->lotag) || ((tagsearch&2) && spr->hitag)) { diff --git a/source/core/coreactor.h b/source/core/coreactor.h index 37e8d7c51..52162cf8f 100644 --- a/source/core/coreactor.h +++ b/source/core/coreactor.h @@ -328,6 +328,14 @@ inline int32_t clipmove(vec3_t* const pos, sectortype** const sect, int32_t xvec return res; } +[[deprecated]] +inline void neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, + int16_t* neartagsector, int16_t* neartagwall, int16_t* neartagsprite, + int32_t* neartaghitdist, int32_t neartagrange, uint8_t tagsearch) +{ + neartag_(xs, ys, zs, sectnum, ange, neartagsector, neartagwall, neartagsprite, neartaghitdist, neartagrange, tagsearch); +} + inline int hitscan(const vec3_t& start, const sectortype* startsect, const vec3_t& direction, HitInfoBase& hitinfo, unsigned cliptype) @@ -350,3 +358,14 @@ inline int clipmove(vec3_t& pos, sectortype** const sect, int xvect, int yvect, *sect = sectno == -1 ? nullptr : §or[sectno]; return result.setFromEngine(res); } + +inline void neartag(const vec3_t& pos, sectortype* sect, int angle, HitInfoBase& result, int neartagrange, int tagsearch) +{ + short ntsect, ntwal, ntsprt; + int ntdist; + neartag_(pos.x, pos.y, pos.z, sect == nullptr ? -1 : sector.IndexOf(sect), angle, &ntsect, &ntwal, &ntsprt, &ntdist, neartagrange, tagsearch); + result.hitpos.x = ntdist; + result.hitSector = ntsect == -1 ? nullptr : §or[ntsect]; + result.hitWall = ntwal == -1 ? nullptr : &wall[ntwal]; + result.hitActor = ntsprt == -1 ? nullptr : actorArray[ntsprt]; +} diff --git a/source/games/duke/src/dukeactor.h b/source/games/duke/src/dukeactor.h index 7c5d8355a..392a27c8c 100644 --- a/source/games/duke/src/dukeactor.h +++ b/source/games/duke/src/dukeactor.h @@ -197,30 +197,6 @@ inline void getzrange_ex(int x, int y, int z, sectortype* sect, int32_t* ceilz, florhit.setFromEngine(fh); } -inline void neartag(int32_t xs, int32_t ys, int32_t zs, int sectnum, int ange, - sectortype** neartagsector, walltype** neartagwall, DDukeActor** neartagsprite, - int32_t* neartaghitdist, int32_t neartagrange, uint8_t tagsearch) -{ - int16_t nts; - int16_t ntsec, ntwal; - ::neartag(xs, ys, zs, sectnum, ange, &ntsec, &ntwal, &nts, neartaghitdist, neartagrange, tagsearch); - *neartagsprite = nts == -1 ? nullptr : &hittype[nts]; - *neartagsector = ntsec == -1? nullptr : §or[ntsec]; - *neartagwall = ntwal == -1? nullptr : &wall[ntwal]; -} - -inline void neartag(int32_t xs, int32_t ys, int32_t zs, sectortype* sect, int ange, - sectortype** neartagsector, walltype** neartagwall, DDukeActor** neartagsprite, - int32_t* neartaghitdist, int32_t neartagrange, uint8_t tagsearch) -{ - int16_t nts; - int16_t ntsec, ntwal; - ::neartag(xs, ys, zs, sectnum(sect), ange, &ntsec, &ntwal, &nts, neartaghitdist, neartagrange, tagsearch); - *neartagsprite = nts == -1 ? nullptr : &hittype[nts]; - *neartagsector = ntsec == -1 ? nullptr : §or[ntsec]; - *neartagwall = ntwal == -1 ? nullptr : &wall[ntwal]; -} - END_DUKE_NS diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index ca5b08920..d3d27eeac 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -2465,11 +2465,9 @@ int ParseState::parse(void) insptr++; if( g_sp->sector()->lotag == 0 ) { - sectortype* sectp; - walltype* neartagwall; - DDukeActor* neartagsprite; - int32_t neartaghitdist; - neartag(g_sp->x, g_sp->y, g_sp->z - (32 << 8), g_sp->sector(), g_sp->ang, §p, &neartagwall, &neartagsprite, &neartaghitdist, 768L, 1); + HitInfo hit; + neartag({ g_sp->x, g_sp->y, g_sp->z - (32 << 8) }, g_sp->sector(), g_sp->ang, hit, 768, 1); + auto sectp = hit.hitSector; if (sectp) { if (isanearoperator(sectp->lotag)) diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 93ac58454..508d698c5 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -1534,10 +1534,7 @@ void checksectors_d(int snum) int i = -1, oldz; struct player_struct* p; walltype* hitscanwall; - sectortype* ntsector = nullptr; - walltype* ntwall = nullptr; - DDukeActor* neartagsprite = nullptr; - int neartaghitdist = 0; + HitInfo near; p = &ps[snum]; auto pact = p->GetActor(); @@ -1604,7 +1601,7 @@ void checksectors_d(int snum) return; } - neartagsprite = nullptr; + near.hitActor = nullptr; p->toggle_key_flag = 1; hitscanwall = nullptr; @@ -1623,20 +1620,20 @@ void checksectors_d(int snum) return; } if (p->newOwner != nullptr) - neartag(p->oposx, p->oposy, p->oposz, p->GetActor()->sector(), p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 1); + neartag({ p->oposx, p->oposy, p->oposz }, p->GetActor()->sector(), p->angle.oang.asbuild(), near, 1280L, 1); else { - neartag(p->pos.x, p->pos.y, p->pos.z, p->GetActor()->sector(), p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 1); - if (neartagsprite == nullptr && ntwall == nullptr && ntsector == nullptr) - neartag(p->pos.x, p->pos.y, p->pos.z + (8 << 8), p->GetActor()->sector(), p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 1); - if (neartagsprite == nullptr && ntwall == nullptr && ntsector == nullptr) - neartag(p->pos.x, p->pos.y, p->pos.z + (16 << 8), p->GetActor()->sector(), p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 1); - if (neartagsprite == nullptr && ntwall == nullptr && ntsector == nullptr) + neartag(p->pos, p->GetActor()->sector(), p->angle.oang.asbuild(), near, 1280, 1); + if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr) + neartag({ p->pos.x, p->pos.y, p->pos.z + (8 << 8) }, p->GetActor()->sector(), p->angle.oang.asbuild(), near, 1280, 1); + if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr) + neartag({ p->pos.x, p->pos.y, p->pos.z + (16 << 8) }, p->GetActor()->sector(), p->angle.oang.asbuild(), near, 1280, 1); + if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr) { - neartag(p->pos.x, p->pos.y, p->pos.z + (16 << 8), p->GetActor()->sector(), p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 3); - if (neartagsprite != nullptr) + neartag({ p->pos.x, p->pos.y, p->pos.z + (16 << 8) }, p->GetActor()->sector(), p->angle.oang.asbuild(), near, 1280, 3); + if (near.actor() != nullptr) { - switch (neartagsprite->s->picnum) + switch (near.actor()->s->picnum) { case FEM1: case FEM2: @@ -1656,29 +1653,28 @@ void checksectors_d(int snum) } } - neartagsprite = nullptr; - ntwall = nullptr; - ntsector = nullptr; + near.clearObj(); } } - if (p->newOwner == nullptr && neartagsprite == nullptr && ntsector == nullptr && ntwall == nullptr) + if (p->newOwner == nullptr && near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr) if (isanunderoperator(p->GetActor()->sector()->lotag)) - ntsector = p->GetActor()->s->sector(); + near.hitSector = p->GetActor()->s->sector(); - if (ntsector && (ntsector->lotag & 16384)) + if (near.hitSector && (near.hitSector->lotag & 16384)) return; - if (neartagsprite == nullptr && ntwall == nullptr) + if (near.actor() == nullptr && near.hitWall == nullptr) if (p->cursector->lotag == 2) { DDukeActor* hit; oldz = hitasprite(p->GetActor(), &hit); - if (hit) neartagsprite = hit; - if (oldz > 1280) neartagsprite = nullptr; + if (hit) near.hitActor = hit; + if (oldz > 1280) near.hitActor = nullptr; } + auto const neartagsprite = near.actor(); if (neartagsprite != nullptr) { if (fi.checkhitswitch(snum, nullptr, neartagsprite)) return; @@ -1780,7 +1776,7 @@ void checksectors_d(int snum) return; } - if (ntwall == nullptr && ntsector == nullptr && neartagsprite == nullptr) + if (near.hitWall == nullptr && near.hitSector == nullptr && near.actor() == nullptr) if (abs(hits(p->GetActor())) < 512) { if ((krand() & 255) < 16) @@ -1789,12 +1785,12 @@ void checksectors_d(int snum) return; } - if (ntwall) + if (near.hitWall) { - if (ntwall->lotag > 0 && fi.isadoorwall(ntwall->picnum)) + if (near.hitWall->lotag > 0 && fi.isadoorwall(near.hitWall->picnum)) { - if (hitscanwall == ntwall || hitscanwall == nullptr) - fi.checkhitswitch(snum, ntwall, nullptr); + if (hitscanwall == near.hitWall || hitscanwall == nullptr) + fi.checkhitswitch(snum, near.hitWall, nullptr); return; } else if (p->newOwner != nullptr) @@ -1804,15 +1800,15 @@ void checksectors_d(int snum) } } - if (ntsector && (ntsector->lotag & 16384) == 0 && isanearoperator(ntsector->lotag)) + if (near.hitSector && (near.hitSector->lotag & 16384) == 0 && isanearoperator(near.hitSector->lotag)) { - DukeSectIterator it(ntsector); + DukeSectIterator it(near.hitSector); while (auto act = it.Next()) { if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH) return; } - operatesectors(ntsector, p->GetActor()); + operatesectors(near.hitSector, p->GetActor()); } else if ((p->GetActor()->sector()->lotag & 16384) == 0) { @@ -1825,7 +1821,7 @@ void checksectors_d(int snum) } operatesectors(p->GetActor()->sector(), p->GetActor()); } - else fi.checkhitswitch(snum, ntwall, nullptr); + else fi.checkhitswitch(snum, near.hitWall, nullptr); } } } diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 4520330fa..6a469501c 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -2450,10 +2450,7 @@ void checksectors_r(int snum) int oldz; struct player_struct* p; walltype* hitscanwall; - sectortype* ntsector = nullptr; - walltype* ntwall = nullptr; - DDukeActor* neartagsprite = nullptr; - int neartaghitdist = 0; + HitInfo near; p = &ps[snum]; auto pact = p->GetActor(); @@ -2506,7 +2503,7 @@ void checksectors_r(int snum) else if (!p->toggle_key_flag) { - neartagsprite = nullptr; + near.hitActor = nullptr; p->toggle_key_flag = 1; hitscanwall = nullptr; @@ -2572,24 +2569,24 @@ void checksectors_r(int snum) } return; } - neartag(p->pos.x, p->pos.y, p->pos.z, p->GetActor()->sector(), p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 3); + neartag(p->pos, p->GetActor()->sector(), p->angle.oang.asbuild(), near , 1280, 3); } if (p->newOwner != nullptr) - neartag(p->oposx, p->oposy, p->oposz, p->GetActor()->sector(), p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 1); + neartag({ p->oposx, p->oposy, p->oposz }, p->GetActor()->sector(), p->angle.oang.asbuild(), near, 1280L, 1); else { - neartag(p->pos.x, p->pos.y, p->pos.z, p->GetActor()->sector(), p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 1); - if (neartagsprite == nullptr && ntwall == nullptr && ntsector == nullptr) - neartag(p->pos.x, p->pos.y, p->pos.z + (8 << 8), p->GetActor()->sector(), p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 1); - if (neartagsprite == nullptr && ntwall == nullptr && ntsector == nullptr) - neartag(p->pos.x, p->pos.y, p->pos.z + (16 << 8), p->GetActor()->sector(), p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 1); - if (neartagsprite == nullptr && ntwall == nullptr && ntsector == nullptr) + neartag(p->pos, p->GetActor()->sector(), p->angle.oang.asbuild(), near, 1280, 1); + if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr) + neartag({ p->pos.x, p->pos.y, p->pos.z + (8 << 8) }, p->GetActor()->sector(), p->angle.oang.asbuild(), near, 1280, 1); + if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr) + neartag({ p->pos.x, p->pos.y, p->pos.z + (16 << 8) }, p->GetActor()->sector(), p->angle.oang.asbuild(), near, 1280, 1); + if (near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr) { - neartag(p->pos.x, p->pos.y, p->pos.z + (16 << 8), p->GetActor()->sector(), p->angle.oang.asbuild(), &ntsector, &ntwall, &neartagsprite, &neartaghitdist, 1280L, 3); - if (neartagsprite != nullptr) + neartag({ p->pos.x, p->pos.y, p->pos.z + (16 << 8) }, p->GetActor()->sector(), p->angle.oang.asbuild(), near, 1280, 3); + if (near.actor() != nullptr) { - switch (neartagsprite->s->picnum) + switch (near.actor()->s->picnum) { case FEM10: case NAKED1: @@ -2597,33 +2594,33 @@ void checksectors_r(int snum) case TOUGHGAL: return; case COW: - neartagsprite->spriteextra = 1; + near.actor()->spriteextra = 1; return; } } - neartagsprite = nullptr; - ntwall = nullptr; - ntsector = nullptr; + near.clearObj(); } } - if (p->newOwner == nullptr && neartagsprite == nullptr && ntsector == nullptr && ntwall == nullptr) + if (p->newOwner == nullptr && near.actor() == nullptr && near.hitWall == nullptr && near.hitSector == nullptr) if (isanunderoperator(p->GetActor()->sector()->lotag)) - ntsector = p->GetActor()->s->sector(); + near.hitSector = p->GetActor()->s->sector(); - if (ntsector && (ntsector->lotag & 16384)) + if (near.hitSector && (near.hitSector->lotag & 16384)) return; - if (neartagsprite == nullptr && ntwall == nullptr) + if (near.actor() == nullptr && near.hitWall == nullptr) if (p->cursector->lotag == 2) { DDukeActor* hit; oldz = hitasprite(p->GetActor(), &hit); - if (hit) neartagsprite = hit; - if (oldz > 1280) neartagsprite = nullptr; + if (hit) near.hitActor = hit; + if (oldz > 1280) near.hitActor = nullptr; + } + auto const neartagsprite = near.actor(); if (neartagsprite != nullptr) { if (fi.checkhitswitch(snum, nullptr, neartagsprite)) return; @@ -2730,7 +2727,7 @@ void checksectors_r(int snum) if (!PlayerInput(snum, SB_OPEN)) return; - if (ntwall == nullptr && ntsector == nullptr && neartagsprite == nullptr) + if (near.hitWall == nullptr && near.hitSector == nullptr && near.actor() == nullptr) if (abs(hits(p->GetActor())) < 512) { if ((krand() & 255) < 16) @@ -2739,26 +2736,26 @@ void checksectors_r(int snum) return; } - if (ntwall != nullptr) + if (near.hitWall) { - if (ntwall->lotag > 0 && fi.isadoorwall(ntwall->picnum)) + if (near.hitWall->lotag > 0 && fi.isadoorwall(near.hitWall->picnum)) { - if (hitscanwall == ntwall || hitscanwall == nullptr) - fi.checkhitswitch(snum, ntwall, nullptr); + if (hitscanwall == near.hitWall || hitscanwall == nullptr) + fi.checkhitswitch(snum, near.hitWall, nullptr); return; } } - if (ntsector && (ntsector->lotag & 16384) == 0 && isanearoperator(ntsector->lotag)) + if (near.hitSector && (near.hitSector->lotag & 16384) == 0 && isanearoperator(near.hitSector->lotag)) { - DukeSectIterator it(ntsector); + DukeSectIterator it(near.hitSector); while (auto act = it.Next()) { if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH) return; } - if (haskey(ntsector, snum)) - operatesectors(ntsector, p->GetActor()); + if (haskey(near.hitSector, snum)) + operatesectors(near.hitSector, p->GetActor()); else { if (neartagsprite && neartagsprite->spriteextra > 3) @@ -2778,7 +2775,7 @@ void checksectors_r(int snum) if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH) return; } - if (haskey(ntsector, snum)) + if (haskey(near.hitSector, snum)) operatesectors(p->GetActor()->s->sector(), p->GetActor()); else { @@ -2789,7 +2786,7 @@ void checksectors_r(int snum) FTA(41, p); } } - else fi.checkhitswitch(snum, ntwall, nullptr); + else fi.checkhitswitch(snum, near.hitWall, nullptr); } } } diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index ea895d0fa..52e34651a 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -1308,7 +1308,7 @@ sectdone: // neartag finds the nearest sector, wall, and sprite which has its hitag and/or lotag set to a value. neartag(pPlayerSprite->x, pPlayerSprite->y, pPlayerSprite->z, pPlayerSprite->sectnum, pPlayerSprite->ang, - &nearTagSector, &nearTagWall, &nearTagSprite, (int32_t*)&nearHitDist, 1024, 2, nullptr); + &nearTagSector, &nearTagWall, &nearTagSprite, (int32_t*)&nearHitDist, 1024, 2); DExhumedActor* pActorB; feebtag(pPlayerSprite->x, pPlayerSprite->y, pPlayerSprite->z, pPlayerSprite->sector(), &pActorB, var_30, 768); diff --git a/source/games/sw/src/ai.cpp b/source/games/sw/src/ai.cpp index 01a2493a6..fd7a49eb3 100644 --- a/source/games/sw/src/ai.cpp +++ b/source/games/sw/src/ai.cpp @@ -472,7 +472,7 @@ int DoActorOperate(DSWActor* actor) { neartag(sp->x, sp->y, z[i], sp->sectnum, sp->ang, &nearsector, &nearwall, &nearsprite, - &nearhitdist, 1024L, NTAG_SEARCH_LO_HI, nullptr); + &nearhitdist, 1024L, NTAG_SEARCH_LO_HI); } diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index de7e9fade..ff786211c 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -3394,7 +3394,7 @@ void DoPlayerClimb(PLAYERp pp) neartag(pp->posx, pp->posy, pp->posz, sectnum(pp->cursector), pp->angle.ang.asbuild(), &sec, &wal, &spr, - &dist, 800L, NTAG_SEARCH_LO_HI, nullptr); + &dist, 800L, NTAG_SEARCH_LO_HI); if (wal >= 0) { @@ -3745,7 +3745,7 @@ bool PlayerOnLadder(PLAYERp pp) neartag(pp->posx, pp->posy, pp->posz, sectnum(pp->cursector), pp->angle.ang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, - &neartaghitdist, 1024L+768L, NTAG_SEARCH_LO_HI, nullptr); + &neartaghitdist, 1024L+768L, NTAG_SEARCH_LO_HI); dir = DOT_PRODUCT_2D(pp->xvect, pp->yvect, pp->angle.ang.bcos(), pp->angle.ang.bsin()); @@ -3759,7 +3759,7 @@ bool PlayerOnLadder(PLAYERp pp) { neartag(pp->posx, pp->posy, pp->posz, sectnum(pp->cursector), NORM_ANGLE(pp->angle.ang.asbuild() + angles[i]), &sec, &wal, &spr, - &dist, 600L, NTAG_SEARCH_LO_HI, nullptr); + &dist, 600L, NTAG_SEARCH_LO_HI); if (wal < 0 || dist < 100 || wall[wal].lotag != TAG_WALL_CLIMB) return false; diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index 88312b202..1af433b25 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -2026,7 +2026,7 @@ bool NearThings(PLAYERp pp) neartag(pp->posx, pp->posy, pp->posz, sectnum(pp->cursector), pp->angle.ang.asbuild(), &neartagsect, &neartagwall, &neartagsprite, - &neartaghitdist, 1024L, NTAG_SEARCH_LO_HI, nullptr); + &neartaghitdist, 1024L, NTAG_SEARCH_LO_HI); // hit a sprite? Check to see if it has sound info in it! @@ -2114,7 +2114,7 @@ void NearTagList(NEAR_TAG_INFOp ntip, PLAYERp pp, int z, int dist, int type, int neartag(pp->posx, pp->posy, z, sectnum(pp->cursector), pp->angle.ang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, - &neartaghitdist, dist, type, nullptr); + &neartaghitdist, dist, type); if (neartagsector >= 0) { diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index c04e1a86d..2d14243ef 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -4812,7 +4812,7 @@ int move_actor(DSWActor* actor, int xchange, int ychange, int zchange) u->lo_sectp = lo_sectp; u->hi_sectp = hi_sectp; u->coll.invalidate(); - ChangeActorSect(actor, sectnum); + ChangeActorSect(actor, sect); return false; } @@ -4830,7 +4830,7 @@ int move_actor(DSWActor* actor, int xchange, int ychange, int zchange) u->lo_sectp = lo_sectp; u->hi_sectp = hi_sectp; u->coll.invalidate(); - ChangeActorSect(actor, sectnum); + ChangeActorSect(actor, sect); return false; } } diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index bf5d932df..67dd78136 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -3227,7 +3227,7 @@ bool ActorTrackDecide(TRACK_POINTp tpoint, DSWActor* actor) { neartag(sp->x, sp->y, z[i], sp->sectnum, sp->ang, &nearsector, &nearwall, &nearsprite, - &nearhitdist, 1024, NTAG_SEARCH_LO_HI, nullptr); + &nearhitdist, 1024, NTAG_SEARCH_LO_HI); if (nearsprite >= 0 && nearhitdist < 1024) { @@ -3450,7 +3450,7 @@ bool ActorTrackDecide(TRACK_POINTp tpoint, DSWActor* actor) neartag(sp->x, sp->y, SPRITEp_TOS(sp) - DIV2(SPRITEp_SIZE_Z(sp)), sp->sectnum, sp->ang, &hit_sect, &hit_wall, &hit_sprite, - &dist, 600L, NTAG_SEARCH_LO_HI, nullptr); + &dist, 600L, NTAG_SEARCH_LO_HI); if (hit_wall < 0) {