diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 5a6e0a263..1879e195e 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -2669,7 +2669,7 @@ void handle_se00(DDukeActor* actor, int LASERLINE) { actor->tempang += 4; if (actor->tempang >= 256) - callsound(s->sectnum, actor); + callsound(s->sector(), actor); if (s->clipdist) l = 1; else l = -1; } @@ -2697,7 +2697,7 @@ void handle_se00(DDukeActor* actor, int LASERLINE) { actor->tempang -= 4; if (actor->tempang <= 0) - callsound(s->sectnum, actor); + callsound(s->sector(), actor); if (s->clipdist) l = -1; else l = 1; } @@ -3854,7 +3854,7 @@ void handle_se15(DDukeActor* actor) if (t[3] >= (s->yvel >> 3)) { t[4] = 0; //Turn off the sliders - callsound(s->sectnum, actor); + callsound(s->sector(), actor); return; } t[3]++; @@ -3864,7 +3864,7 @@ void handle_se15(DDukeActor* actor) if (t[3] < 1) { t[4] = 0; - callsound(s->sectnum, actor); + callsound(s->sector(), actor); return; } t[3]--; @@ -4259,7 +4259,7 @@ void handle_se20(DDukeActor* actor) s->x -= x; s->y -= l; t[0] = 0; - callsound(s->sectnum, actor); + callsound(s->sector(), actor); return; } @@ -4612,7 +4612,7 @@ void handle_se32(DDukeActor *actor) if (abs(sc->ceilingz - s->z) < (s->yvel << 1)) { sc->ceilingz = s->z; - callsound(s->sectnum, actor); + callsound(s->sector(), actor); t[2] = 0; t[0] = 0; } @@ -4623,7 +4623,7 @@ void handle_se32(DDukeActor *actor) if (abs(sc->ceilingz - t[1]) < (s->yvel << 1)) { sc->ceilingz = t[1]; - callsound(s->sectnum, actor); + callsound(s->sector(), actor); t[2] = 0; t[0] = 0; } @@ -4638,7 +4638,7 @@ void handle_se32(DDukeActor *actor) { t[0] = 0; t[2] = !t[2]; - callsound(s->sectnum, actor); + callsound(s->sector(), actor); sc->ceilingz = s->z; } else sc->ceilingz += Sgn(s->z - sc->ceilingz) * s->yvel; @@ -4649,7 +4649,7 @@ void handle_se32(DDukeActor *actor) { t[0] = 0; t[2] = !t[2]; - callsound(s->sectnum, actor); + callsound(s->sector(), actor); } else sc->ceilingz -= Sgn(s->z - t[1]) * s->yvel; } @@ -4810,7 +4810,7 @@ void handle_se31(DDukeActor* actor, bool choosedir) t[2] = 0; t[0] = 0; if (choosedir) t[3] = s->hitag; - callsound(s->sectnum, actor); + callsound(s->sector(), actor); } else { @@ -4836,7 +4836,7 @@ void handle_se31(DDukeActor* actor, bool choosedir) if (abs(sec->floorz - t[1]) < s->yvel) { sec->floorz = t[1]; - callsound(s->sectnum, actor); + callsound(s->sector(), actor); t[2] = 0; t[0] = 0; if (choosedir) t[3] = s->hitag; @@ -4867,7 +4867,7 @@ void handle_se31(DDukeActor* actor, bool choosedir) { if (abs(s->z - sec->floorz) < s->yvel) { - callsound(s->sectnum, actor); + callsound(s->sector(), actor); t[0] = 0; t[2] = 1; if (choosedir) t[3] = s->hitag; @@ -4896,7 +4896,7 @@ void handle_se31(DDukeActor* actor, bool choosedir) if (abs(sec->floorz - t[1]) < s->yvel) { t[0] = 0; - callsound(s->sectnum, actor); + callsound(s->sector(), actor); t[2] = 1; t[3] = s->hitag; } diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 6071d1653..e41d4cc27 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -3475,7 +3475,7 @@ void handle_se06_d(DDukeActor* actor) DukeStatIterator it(STAT_EFFECTOR); while (auto act2 = it.Next()) { - if ((act2->s->lotag == 14) && (sh == act2->s->hitag) && (act2->temp_data[0] == t[0])) + if ((act2->s->lotag == 14) && (sh == act2->s->hitag) && (act2->temp_data[0] == t[0])) // sectnum() { act2->s->xvel = s->xvel; //if( t[4] == 1 ) diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 88a98c075..a4d0148e9 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -3441,7 +3441,7 @@ void handle_se06_r(DDukeActor *actor) DukeStatIterator it(STAT_EFFECTOR); while (auto act2 = it.Next()) { - if ((act2->s->lotag == 14) && (sh == act2->s->hitag) && (act2->temp_data[0] == t[0])) + if ((act2->s->lotag == 14) && (sh == act2->s->hitag) && (act2->temp_data[0] == t[0])) // sectnum() { act2->s->xvel = s->xvel; // if( t[4] == 1 ) diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index 6075134a8..ac5ec425a 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -137,7 +137,7 @@ 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); -int callsound(int sectnum,DDukeActor* snum); +int callsound(sectortype* sectnum,DDukeActor* snum); int hitasprite(DDukeActor* snum,DDukeActor **hitSprite); int findplayer(const DDukeActor* s, int* dist); void operatejaildoors(int hitag); diff --git a/source/games/duke/src/inlines.h b/source/games/duke/src/inlines.h index 93ee4f71e..bb1836504 100644 --- a/source/games/duke/src/inlines.h +++ b/source/games/duke/src/inlines.h @@ -193,11 +193,6 @@ inline void doslopetilting(player_struct* p, double const scaleAdjust = 1) p->horizon.calcviewpitch(p->pos.vec2, p->angle.ang, p->aim_mode == 0, canslopetilt, p->cursectnum, scaleAdjust); } -inline int callsound(sectortype* sect, DDukeActor* snum) -{ - return callsound(sectnum(sect), snum); -} - //--------------------------------------------------------------------------- // // diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index f52a3042b..cdd122bb3 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -51,7 +51,7 @@ static int interptype[] = { Interp_Sect_Floorz, Interp_Sect_Ceilingz, Interp_Wal //--------------------------------------------------------------------------- static bool haltsoundhack; -int callsound(int sn, DDukeActor* whatsprite) +int callsound(sectortype* sn, DDukeActor* whatsprite) { if (!isRRRA() && haltsoundhack) { @@ -887,8 +887,8 @@ static void handle_st25(sectortype* sptr, DDukeActor* actor) { act3->getSector()->lotag ^= 0x8000; // Toggle the open or close act3->s->ang += 1024; - if (act3->temp_data[4]) callsound(act3->s->sectnum, act3); - callsound(act3->s->sectnum, act3); + if (act3->temp_data[4]) callsound(act3->getSector(), act3); + callsound(act3->getSector(), act3); if (act3->getSector()->lotag & 0x8000) act3->temp_data[4] = 1; else act3->temp_data[4] = 2; } @@ -1147,16 +1147,16 @@ void operateactivators(int low, int plnum) case SE_31_FLOOR_RISE_FALL: case SE_32_CEILING_RISE_FALL: a2->temp_data[0] = 1 - a2->temp_data[0]; - callsound(act->s->sectnum, a2); + callsound(act->getSector(), a2); break; } } } if (k == -1 && (act->getSector()->lotag & 0xff) == 22) - k = callsound(act->s->sectnum, act); + k = callsound(act->getSector(), act); - operatesectors(act->s->sector(), act); + operatesectors(act->getSector(), act); } } } diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index 4a481e5a3..a16d0cb5f 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -623,7 +623,6 @@ void spawneffector(DDukeActor* actor) { auto sp = actor->s; auto sectp = sp->sector(); - int sect = sp->sectnum; auto t = actor->temp_data; int d, clostest = 0; @@ -769,8 +768,8 @@ void spawneffector(DDukeActor* actor) case SE_17_WARP_ELEVATOR: { t[2] = sectp->floorz; //Stopping loc - t[3] = nextsectorneighborzptr(sect, sectp->floorz, -1, -1)->ceilingz; - t[4] = nextsectorneighborzptr(sect, sectp->ceilingz, 1, 1)->floorz; + t[3] = nextsectorneighborzptr(sectp, sectp->floorz, -1, -1)->ceilingz; + t[4] = nextsectorneighborzptr(sectp, sectp->ceilingz, 1, 1)->floorz; if (numplayers < 2) { @@ -1045,7 +1044,7 @@ void spawneffector(DDukeActor* actor) case SE_6_SUBWAY: case SE_14_SUBWAY_CAR: { - int j = callsound(sect, actor); + int j = callsound(sectp, actor); if (j == -1) { if (!isRR()) j = SUBWAY; // Duke