diff --git a/source/build/include/build.h b/source/build/include/build.h index 39b4badde98..66a6ed3744e 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -429,10 +429,6 @@ 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); void dragpoint(int pointhighlight, int32_t dax, int32_t day); -inline void dragpoint(walltype* pointhighlight, int32_t dax, int32_t day) -{ - dragpoint(int(pointhighlight - wall), dax, day); -} int32_t try_facespr_intersect(uspriteptr_t const spr, vec3_t const in, int32_t vx, int32_t vy, int32_t vz, vec3_t * const intp, int32_t strictly_smaller_than_p); @@ -452,6 +448,7 @@ void updatesectorneighbor(int32_t const x, int32_t const y, int * const sectnum, void updatesectorneighborz(int32_t const x, int32_t const y, int32_t const z, int * const sectnum, int32_t initialMaxDistance = INITIALUPDATESECTORDIST, int32_t maxDistance = MAXUPDATESECTORDIST) ATTRIBUTE((nonnull(4))); int findwallbetweensectors(int sect1, int sect2); + inline int sectoradjacent(int sect1, int sect2) { return findwallbetweensectors(sect1, sect2) != -1; } int32_t getsectordist(vec2_t const in, int const sectnum, vec2_t * const out = nullptr); extern const int16_t *chsecptr_onextwall; diff --git a/source/core/gamefuncs.h b/source/core/gamefuncs.h index e424a807dcc..5d4d7256f06 100644 --- a/source/core/gamefuncs.h +++ b/source/core/gamefuncs.h @@ -296,3 +296,17 @@ inline double SquareDistToWall(double px, double py, const walltype* wal) return SquareDist(px, py, lx1 + t * (lx2 - lx1), ly1 + t * (ly2 - ly1)); } +inline int inside(int x, int y, sectortype* sect) +{ + return inside(x, y, sectnum(sect)); +} + +inline void dragpoint(walltype* pointhighlight, int32_t dax, int32_t day) +{ + dragpoint(wallnum(pointhighlight), dax, day); +} + +inline int findwallbetweensectors(sectortype* sect1, sectortype* sect2) +{ + return findwallbetweensectors(sectnum(sect1), sectnum(sect2)); +} diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index 5b25dc00bb9..b829295cfd4 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -133,7 +133,7 @@ int findotherplayer(int p, int* d); void quickkill(struct player_struct* p); int setpal(struct player_struct* p); int madenoise(int playerNum); -int haskey(int sect, int snum); +int haskey(sectortype* sect, int snum); void shootbloodsplat(DDukeActor* i, int p, int sx, int sy, int sz, int sa, int atwith, int BIGFORCE, int OOZFILTER, int NEWBEAST); void breakwall(int newpn, DDukeActor* spr, walltype* dawallnum); diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 670b324a707..74c8b20ca19 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -960,8 +960,9 @@ bool movementBlocked(player_struct *p) // //--------------------------------------------------------------------------- -int haskey(int sect, int snum) +int haskey(sectortype* sectp, int snum) { + int sect = sectnum(sectp); auto p = &ps[snum]; if (!sectorextra[sect]) return 1; diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 8d30b38f935..5384cb02ead 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -3172,23 +3172,4 @@ void processinput_d(int snum) processweapon(snum, actions, psect); } -void processmove_d(int snum, ESyncBits actions, int psect, int fz, int cz, int shrunk, int truefdist) -{ - auto psectp = §or[psect]; - int psectlotag = psectp->lotag; - auto p = &ps[snum]; - if (psectlotag == 2) - { - underwater(snum, actions, fz, cz); - } - - else if (p->jetpack_on) - { - operateJetpack(snum, actions, psectlotag, fz, cz, shrunk); - } - else if (psectlotag != 2) - { - movement(snum, actions, psectp, fz, cz, shrunk, truefdist, psectlotag); - } -} END_DUKE_NS diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index e428a1f8100..38f0955ee0e 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -4016,26 +4016,6 @@ void processinput_r(int snum) // //--------------------------------------------------------------------------- -void processmove_r(int snum, ESyncBits actions, int psect, int fz, int cz, int shrunk, int truefdist) -{ - auto psectp = §or[psect]; - int psectlotag = psectp->lotag; - if (psectlotag == ST_2_UNDERWATER) - { - underwater(snum, actions, fz, cz); - } - else - { - movement(snum, actions, psectp, fz, cz, shrunk, truefdist, psectlotag); - } -} - -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - void OnMotorcycle(struct player_struct *p, DDukeActor* motosprite) { if (!p->OnMotorcycle && !(p->cursector()->lotag == 2)) diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index a0c097161a8..ddb2b3fa15f 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -1025,7 +1025,7 @@ void enterlevel(MapRecord *mi, int gamemode) for (int i = connecthead; i >= 0; i = connectpoint2[i]) { bool clearweapon = !!(currentLevel->flags & LEVEL_CLEARWEAPONS); - int pn = sector[ps[i].GetActor()->s->sectnum].floorpicnum; + int pn = ps[i].GetActor()->getSector()->floorpicnum; if (pn == TILE_HURTRAIL || pn == TILE_FLOORSLIME || pn == TILE_FLOORPLASMA) { resetinventory(i); diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index dba54dc629e..d414e2c8593 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -2749,7 +2749,7 @@ void checksectors_r(int snum) if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH) return; } - if (haskey(sectnum(ntsector), snum)) + if (haskey(ntsector, snum)) operatesectors(ntsector, p->GetActor()); else { @@ -2770,7 +2770,7 @@ void checksectors_r(int snum) if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH) return; } - if (haskey(sectnum(ntsector), snum)) + if (haskey(ntsector, snum)) operatesectors(p->GetActor()->s->sector(), p->GetActor()); else { @@ -2830,16 +2830,16 @@ void dofurniture(walltype* wlwal, sectortype* sectp, int snum) max_y += var_cx + 1; min_x -= var_cx + 1; min_y -= var_cx + 1; - ins = inside(max_x, max_y, sectnum(sectp)); + ins = inside(max_x, max_y, sectp); if (!ins) var_C = 0; - ins = inside(max_x, min_y, sectnum(sectp)); + ins = inside(max_x, min_y, sectp); if (!ins) var_C = 0; - ins = inside(min_x, min_y, sectnum(sectp)); + ins = inside(min_x, min_y, sectp); if (!ins) var_C = 0; - ins = inside(min_x, max_y, sectnum(sectp)); + ins = inside(min_x, max_y, sectp); if (!ins) var_C = 0; if (var_C)