diff --git a/source/core/gamestruct.h b/source/core/gamestruct.h index 3ce0d945a..cfc6eabf6 100644 --- a/source/core/gamestruct.h +++ b/source/core/gamestruct.h @@ -102,7 +102,7 @@ struct GameInterface virtual const char *CheckCheatMode() { return nullptr; } virtual const char* GenericCheat(int player, int cheat) = 0; virtual void NextLevel(MapRecord* map, int skill) {} - virtual void NewGame(MapRecord* map, int skill) {} + virtual void NewGame(MapRecord* map, int skill, bool special = false) {} virtual void LevelCompleted(MapRecord* map, int skill) {} virtual bool DrawAutomapPlayer(int x, int y, int z, int a, double const smoothratio) { return false; } virtual void SetTileProps(int tile, int surf, int vox, int shade) {} diff --git a/source/core/mainloop.cpp b/source/core/mainloop.cpp index 1ffdc6293..8a7ed3e12 100644 --- a/source/core/mainloop.cpp +++ b/source/core/mainloop.cpp @@ -197,7 +197,7 @@ static void GameTicker() C_FlushDisplay(); gameaction = ga_level; BackupSaveGame = ""; - gi->NewGame(g_nextmap, g_nextskill); + gi->NewGame(g_nextmap, g_nextskill, ga == ga_newgamenostopsound); break; case ga_startup: diff --git a/source/games/blood/src/blood.cpp b/source/games/blood/src/blood.cpp index f9ac09273..a97d7bb86 100644 --- a/source/games/blood/src/blood.cpp +++ b/source/games/blood/src/blood.cpp @@ -248,7 +248,7 @@ void NewLevel(MapRecord *sng, int skill) } -void GameInterface::NewGame(MapRecord *sng, int skill) +void GameInterface::NewGame(MapRecord *sng, int skill, bool) { gGameOptions.uGameFlags = 0; cheatReset(); diff --git a/source/games/blood/src/blood.h b/source/games/blood/src/blood.h index 7ae8c809c..317252463 100644 --- a/source/games/blood/src/blood.h +++ b/source/games/blood/src/blood.h @@ -132,7 +132,7 @@ struct GameInterface : ::GameInterface void Startup() override; void Render() override; const char* GenericCheat(int player, int cheat) override; - void NewGame(MapRecord *sng, int skill) override; + void NewGame(MapRecord *sng, int skill, bool) override; void NextLevel(MapRecord* map, int skill) override; void LevelCompleted(MapRecord* map, int skill) override; bool DrawAutomapPlayer(int x, int y, int z, int a, double const smoothratio) override; diff --git a/source/games/duke/src/_polymost.cpp b/source/games/duke/src/_polymost.cpp index 108b4892f..bb3d544ad 100644 --- a/source/games/duke/src/_polymost.cpp +++ b/source/games/duke/src/_polymost.cpp @@ -30,7 +30,7 @@ void SE40_Draw(int tag, spritetype *spr, int x, int y, int z, binangle a, fixedh DukeStatIterator it(STAT_RAROR); while (auto act = it.Next()) { - auto spr = &act->s; + auto spr = act->s; if ( spr->picnum == SECTOREFFECTOR && spr->lotag == fofmode && @@ -50,7 +50,7 @@ void SE40_Draw(int tag, spritetype *spr, int x, int y, int z, binangle a, fixedh it.Reset(STAT_RAROR); while (auto act = it.Next()) { - auto spr = &act->s; + auto spr = act->s; if ( spr->picnum == SECTOREFFECTOR && spr->lotag == k && @@ -68,7 +68,7 @@ void SE40_Draw(int tag, spritetype *spr, int x, int y, int z, binangle a, fixedh it.Reset(STAT_RAROR); while (auto act = it.Next()) { - auto spr = &act->s; + auto spr = act->s; if (spr->picnum == SECTOREFFECTOR && spr->lotag == k + 2 && spr->hitag == floor1->hitag @@ -101,7 +101,7 @@ void SE40_Draw(int tag, spritetype *spr, int x, int y, int z, binangle a, fixedh it.Reset(STAT_RAROR); while (auto act = it.Next()) { - auto spr = &act->s; + auto spr = act->s; if (spr->picnum == 1 && spr->lotag == k + 2 && spr->hitag == floor1->hitag @@ -139,7 +139,7 @@ void se40code(int x, int y, int z, binangle a, fixedhoriz h, int smoothratio) DukeStatIterator it(STAT_RAROR); while (auto act = it.Next()) { - switch (act->s.lotag - tag + 40) + switch (act->s->lotag - tag + 40) { // case 40: // case 41: @@ -149,8 +149,8 @@ void se40code(int x, int y, int z, binangle a, fixedhoriz h, int smoothratio) case 43: case 44: case 45: - if (ps[screenpeek].cursectnum == act->s.sectnum) - SE40_Draw(tag, &act->s, x, y, z, a, h, smoothratio); + if (ps[screenpeek].cursectnum == act->s->sectnum) + SE40_Draw(tag, act->s, x, y, z, a, h, smoothratio); break; } } @@ -218,7 +218,7 @@ static void geometryEffect(int cposx, int cposy, int cposz, binangle cang, fixed while (auto act = it.Next()) { changespritesect(act, geosectorwarp[gs]); - setsprite(act, act->s.x -= geox[gs], act->s.y -= geoy[gs], act->s.z); + setsprite(act, act->s->x -= geox[gs], act->s->y -= geoy[gs], act->s->z); } if (geosector[gs] == sect) { @@ -238,7 +238,7 @@ static void geometryEffect(int cposx, int cposy, int cposz, binangle cang, fixed while (auto act = it.Next()) { changespritesect(act, geosector[gs]); - setsprite(act, act->s.x += geox[gs], act->s.y += geoy[gs], act->s.z); + setsprite(act, act->s->x += geox[gs], act->s->y += geoy[gs], act->s->z); } } fi.animatesprites(pm_tsprite, pm_spritesortcnt, cposx, cposy, cang.asbuild(), smoothratio); @@ -250,7 +250,7 @@ static void geometryEffect(int cposx, int cposy, int cposz, binangle cang, fixed while (auto act = it.Next()) { changespritesect(act, geosectorwarp2[gs]); - setsprite(act, act->s.x -= geox2[gs], act->s.y -= geoy2[gs], act->s.z); + setsprite(act, act->s->x -= geox2[gs], act->s->y -= geoy2[gs], act->s->z); } if (geosector[gs] == sect) { @@ -270,7 +270,7 @@ static void geometryEffect(int cposx, int cposy, int cposz, binangle cang, fixed while (auto act = it.Next()) { changespritesect(act, geosector[gs]); - setsprite(act, act->s.x += geox2[gs], act->s.y += geoy2[gs], act->s.z); + setsprite(act, act->s->x += geox2[gs], act->s->y += geoy2[gs], act->s->z); } } fi.animatesprites(pm_tsprite, pm_spritesortcnt, cposx, cposy, cang.asbuild(), smoothratio); diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 39f746b42..05e2dc458 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -61,8 +61,8 @@ void RANDOMSCRAP(DDukeActor* origin) { int r1 = krand(), r2 = krand(), r3 = krand(), r4 = krand(), r5 = krand(), r6 = krand(), r7 = krand(); int v = isRR() ? 16 : 48; - EGS(origin->s.sectnum, - origin->s.x + (r7 & 255) - 128, origin->s.y + (r6 & 255) - 128, origin->s.z - (8 << 8) - (r5 & 8191), + EGS(origin->s->sectnum, + origin->s->x + (r7 & 255) - 128, origin->s->y + (r6 & 255) - 128, origin->s->z - (8 << 8) - (r5 & 8191), TILE_SCRAP6 + (r4 & 15), -8, v, v, r3 & 2047, (r2 & 63) + 64, -512 - (r1 & 2047), origin, 5); } @@ -74,8 +74,8 @@ void RANDOMSCRAP(DDukeActor* origin) void deletesprite(DDukeActor *const actor) { - if (actor->s.picnum == MUSICANDSFX && actor->temp_data[0] == 1) - S_StopSound(actor->s.lotag, actor); + if (actor->s->picnum == MUSICANDSFX && actor->temp_data[0] == 1) + S_StopSound(actor->s->lotag, actor); else S_RelinkActorSound(actor, nullptr); ::deletesprite(actor->GetIndex()); @@ -212,8 +212,8 @@ void clearcamera(player_struct* ps) DukeStatIterator it(STAT_ACTOR); while (auto k = it.Next()) { - if (k->s.picnum == TILE_CAMERA1) - k->s.yvel = 0; + if (k->s->picnum == TILE_CAMERA1) + k->s->yvel = 0; } } @@ -228,8 +228,8 @@ int ssp(DDukeActor* const actor, unsigned int cliptype) //The set sprite functio Collision c; return movesprite_ex(actor, - MulScale(actor->s.xvel, bcos(actor->s.ang), 14), - MulScale(actor->s.xvel, bsin(actor->s.ang), 14), actor->s.zvel, + MulScale(actor->s->xvel, bcos(actor->s->ang), 14), + MulScale(actor->s->xvel, bsin(actor->s->ang), 14), actor->s->zvel, cliptype, c) == kHitNone; } @@ -247,13 +247,13 @@ void insertspriteq(DDukeActor* const actor) { // Why is this not deleted here? // Also todo: Make list size a CVAR. - spriteq[spriteqloc]->s.xrepeat = 0; + spriteq[spriteqloc]->s->xrepeat = 0; // deletesprite(spriteq[spriteqloc]); } spriteq[spriteqloc] = actor; spriteqloc = (spriteqloc + 1) % spriteqamount; } - else actor->s.xrepeat = actor->s.yrepeat = 0; + else actor->s->xrepeat = actor->s->yrepeat = 0; } //--------------------------------------------------------------------------- @@ -264,12 +264,12 @@ void insertspriteq(DDukeActor* const actor) void lotsofstuff(DDukeActor* actor, int n, int spawntype) { - auto s = &actor->s; + auto s = actor->s; for (int i = n; i > 0; i--) { int r1 = krand(), r2 = krand(); // using the RANDCORRECT version from RR. auto j = EGS(s->sectnum, s->x, s->y, s->z - (r2 % (47 << 8)), spawntype, -32, 8, 8, r1 & 2047, 0, 0, actor, 5); - j->s.cstat = krand() & 12; + j->s->cstat = krand() & 12; } } @@ -285,7 +285,7 @@ void ms(DDukeActor* const actor) short startwall, endwall, x; int tx, ty; - auto s = &actor->s; + auto s = actor->s; s->x += MulScale(s->xvel, bcos(s->ang), 14); s->y += MulScale(s->xvel, bsin(s->ang), 14); @@ -366,9 +366,9 @@ void movedummyplayers(void) { if (!act->GetOwner()) continue; p = act->GetOwner()->PlayerIndex(); - auto spri = &act->s; + auto spri = act->s; - if ((!isRR() && ps[p].on_crane != nullptr) || sector[ps[p].cursectnum].lotag != 1 || ps->GetActor()->s.extra <= 0) + if ((!isRR() && ps[p].on_crane != nullptr) || sector[ps[p].cursectnum].lotag != 1 || ps->GetActor()->s->extra <= 0) { ps[p].dummyplayersprite = nullptr; deletesprite(act); @@ -413,7 +413,7 @@ void moveplayers(void) { int pn = act->PlayerIndex(); auto p = &ps[pn]; - auto spri = &act->s; + auto spri = act->s; if (act->GetOwner()) { @@ -441,9 +441,9 @@ void moveplayers(void) if (ud.multimode > 1) { auto psp = ps[otherp].GetActor(); - if (psp->s.extra > 0) + if (psp->s->extra > 0) { - if (spri->yrepeat > 32 && psp->s.yrepeat < 32) + if (spri->yrepeat > 32 && psp->s->yrepeat < 32) { if (otherx < 1400 && p->knee_incs == 0) { @@ -464,7 +464,7 @@ void moveplayers(void) if (p->actorsqu != nullptr) { - p->angle.addadjustment(getincanglebam(p->angle.ang, bvectangbam(p->actorsqu->s.x - p->posx, p->actorsqu->s.y - p->posy)).signedbuild() >> 2); + p->angle.addadjustment(getincanglebam(p->angle.ang, bvectangbam(p->actorsqu->s->x - p->posx, p->actorsqu->s->y - p->posy)).signedbuild() >> 2); } if (spri->extra > 0) @@ -485,9 +485,9 @@ void moveplayers(void) p->newOwner = nullptr; - if (p->wackedbyactor != nullptr && p->wackedbyactor->s.statnum < MAXSTATUS) + if (p->wackedbyactor != nullptr && p->wackedbyactor->s->statnum < MAXSTATUS) { - p->angle.addadjustment(getincanglebam(p->angle.ang, bvectangbam(p->wackedbyactor->s.x - p->posx, p->wackedbyactor->s.y - p->posy)).signedbuild() >> 1); + p->angle.addadjustment(getincanglebam(p->angle.ang, bvectangbam(p->wackedbyactor->s->x - p->posx, p->wackedbyactor->s->y - p->posy)).signedbuild() >> 1); } } spri->ang = p->angle.ang.asbuild(); @@ -555,7 +555,7 @@ void movefx(void) DukeStatIterator iti(STAT_FX); while (auto act = iti.Next()) { - auto spri = &act->s; + auto spri = act->s; switch (spri->picnum) { case RESPAWN: @@ -645,7 +645,7 @@ void movefx(void) void movecrane(DDukeActor *actor, int crane) { int* t = &actor->temp_data[0]; - auto spri = &actor->s; + auto spri = actor->s; int sect = spri->sectnum; int x; @@ -659,14 +659,14 @@ void movecrane(DDukeActor *actor, int crane) DukeSectIterator it(t[1]); while (auto a2 = it.Next()) { - switch (a2->s.statnum) + switch (a2->s->statnum) { case STAT_ACTOR: case STAT_ZOMBIEACTOR: case STAT_STANDABLE: case STAT_PLAYER: spri->ang = getangle(msx[t[4] + 1] - spri->x, msy[t[4] + 1] - spri->y); - setsprite(a2, msx[t[4] + 1], msy[t[4] + 1], a2->s.z); + setsprite(a2, msx[t[4] + 1], msy[t[4] + 1], a2->s->z); t[0]++; return; } @@ -735,7 +735,7 @@ void movecrane(DDukeActor *actor, int crane) DukeSectIterator it(t[1]); while (auto a2 = it.Next()) { - switch (a2->s.statnum) + switch (a2->s->statnum) { case 1: case 6: @@ -805,7 +805,7 @@ void movecrane(DDukeActor *actor, int crane) { setsprite(Owner, spri->pos); - Owner->s.opos = spri->pos; + Owner->s->opos = spri->pos; spri->zvel = 0; } @@ -819,7 +819,7 @@ void movecrane(DDukeActor *actor, int crane) ps[p].posy = spri->y - bsin(ang, -6); ps[p].posz = spri->z + (2 << 8); setsprite(ps[p].GetActor(), ps[p].posx, ps[p].posy, ps[p].posz); - ps[p].cursectnum = ps[p].GetActor()->s.sectnum; + ps[p].cursectnum = ps[p].GetActor()->s->sectnum; } } } @@ -840,10 +840,10 @@ void movefountain(DDukeActor *actor, int fountain) { t[0]++; - actor->s.picnum++; + actor->s->picnum++; - if (actor->s.picnum == fountain + 3) - actor->s.picnum = fountain + 1; + if (actor->s->picnum == fountain + 3) + actor->s->picnum = fountain + 1; } else { @@ -852,7 +852,7 @@ void movefountain(DDukeActor *actor, int fountain) if (x > 512) { t[0] = 0; - actor->s.picnum = fountain; + actor->s->picnum = fountain; } else t[0] = 1; } @@ -866,7 +866,7 @@ void movefountain(DDukeActor *actor, int fountain) void moveflammable(DDukeActor* actor, int tire, int box, int pool) { - auto spri = &actor->s; + auto spri = actor->s; int j; if (actor->temp_data[0] == 1) { @@ -877,7 +877,7 @@ void moveflammable(DDukeActor* actor, int tire, int box, int pool) { spri->cstat = 0; auto spawned = spawn(actor, pool); - spawned->s.shade = 127; + spawned->s->shade = 127; } else { @@ -922,15 +922,15 @@ void moveflammable(DDukeActor* actor, int tire, int box, int pool) void detonate(DDukeActor *actor, int explosion) { - auto spri = &actor->s; + auto spri = actor->s; int* t = &actor->temp_data[0]; earthquaketime = 16; DukeStatIterator itj(STAT_EFFECTOR); while (auto effector = itj.Next()) { - auto sj = &effector->s; - if (actor->s.hitag == sj->hitag) + auto sj = effector->s; + if (actor->s->hitag == sj->hitag) { if (sj->lotag == SE_13_EXPLOSIVE) { @@ -974,7 +974,7 @@ void detonate(DDukeActor *actor, int explosion) void movemasterswitch(DDukeActor *actor, int spectype1, int spectype2) { - auto spri = &actor->s; + auto spri = actor->s; if (spri->yvel == 1) { spri->hitag--; @@ -985,7 +985,7 @@ void movemasterswitch(DDukeActor *actor, int spectype1, int spectype2) DukeSectIterator it(spri->sectnum); while (auto effector = it.Next()) { - auto sj = &effector->s; + auto sj = effector->s; if (sj->statnum == STAT_EFFECTOR) { switch (sj->lotag) @@ -1028,7 +1028,7 @@ void movemasterswitch(DDukeActor *actor, int spectype1, int spectype2) void movetrash(DDukeActor *actor) { - auto s = &actor->s; + auto s = actor->s; if (s->xvel == 0) s->xvel = 1; if (ssp(actor, CLIPMASK0)) { @@ -1048,7 +1048,7 @@ void movetrash(DDukeActor *actor) void movewaterdrip(DDukeActor *actor, int drip) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; int sect = s->sectnum; @@ -1072,7 +1072,7 @@ void movewaterdrip(DDukeActor *actor, int drip) S_PlayActorSound(SOMETHING_DRIPPING, actor); auto Owner = actor->GetOwner(); - if (!Owner || Owner->s.picnum != drip) + if (!Owner || Owner->s->picnum != drip) { deletesprite(actor); } @@ -1094,7 +1094,7 @@ void movewaterdrip(DDukeActor *actor, int drip) void movedoorshock(DDukeActor* actor) { - auto s = &actor->s; + auto s = actor->s; int sect = s->sectnum; int j = abs(sector[sect].ceilingz - sector[sect].floorz) >> 9; s->yrepeat = j + 4; @@ -1110,7 +1110,7 @@ void movedoorshock(DDukeActor* actor) void movetouchplate(DDukeActor* actor, int plate) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; int sect = s->sectnum; int x; @@ -1178,7 +1178,7 @@ void movetouchplate(DDukeActor* actor, int plate) DukeStatIterator it(STAT_STANDABLE); while (auto act2 = it.Next()) { - if (act2 != actor && act2->s.picnum == plate && act2->s.lotag == s->lotag) + if (act2 != actor && act2->s->picnum == plate && act2->s->lotag == s->lotag) { act2->temp_data[1] = 1; act2->temp_data[3] = t[3]; @@ -1195,7 +1195,7 @@ void movetouchplate(DDukeActor* actor, int plate) void moveooz(DDukeActor* actor, int seenine, int seeninedead, int ooz, int explosion) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; int j; if (s->shade != -32 && s->shade != -33) @@ -1214,7 +1214,7 @@ void moveooz(DDukeActor* actor, int seenine, int seeninedead, int ooz, int explo DukeStatIterator it(STAT_STANDABLE); while (auto act2 = it.Next()) { - auto ss = &act2->s; + auto ss = act2->s; if (s->hitag == ss->hitag && (ss->picnum == seenine || ss->picnum == ooz)) ss->shade = -32; } @@ -1283,7 +1283,7 @@ void movecanwithsomething(DDukeActor* actor) for (j = 0; j < 10; j++) RANDOMSCRAP(actor); - if (actor->s.lotag) spawn(actor, actor->s.lotag); + if (actor->s->lotag) spawn(actor, actor->s->lotag); deletesprite(actor); } } @@ -1296,7 +1296,7 @@ void movecanwithsomething(DDukeActor* actor) void bounce(DDukeActor* actor) { - auto s = &actor->s; + auto s = actor->s; int xvect = MulScale(s->xvel, bcos(s->ang), 10); int yvect = MulScale(s->xvel, bsin(s->ang), 10); int zvect = s->zvel; @@ -1339,7 +1339,7 @@ void bounce(DDukeActor* actor) void movetongue(DDukeActor *actor, int tongue, int jaw) { - auto s = &actor->s; + auto s = actor->s; actor->temp_data[0] = bsin(actor->temp_data[1], -9); actor->temp_data[1] += 32; if (actor->temp_data[1] > 2047) @@ -1351,18 +1351,18 @@ void movetongue(DDukeActor *actor, int tongue, int jaw) auto Owner = actor->GetOwner(); if (!Owner) return; - if (Owner->s.statnum == MAXSTATUS) + if (Owner->s->statnum == MAXSTATUS) if (badguy(Owner) == 0) { deletesprite(actor); return; } - s->ang = Owner->s.ang; - s->x = Owner->s.x; - s->y = Owner->s.y; - if (Owner->s.picnum == TILE_APLAYER) - s->z = Owner->s.z - (34 << 8); + s->ang = Owner->s->ang; + s->x = Owner->s->x; + s->y = Owner->s->y; + if (Owner->s->picnum == TILE_APLAYER) + s->z = Owner->s->z - (34 << 8); for (int k = 0; k < actor->temp_data[0]; k++) { auto q = EGS(s->sectnum, @@ -1372,8 +1372,8 @@ void movetongue(DDukeActor *actor, int tongue, int jaw) 8, 8, 0, 0, 0, actor, 5); if (q) { - q->s.cstat = 128; - q->s.pal = 8; + q->s->cstat = 128; + q->s->pal = 8; } } int k = actor->temp_data[0]; // do not depend on the above loop counter. @@ -1384,9 +1384,9 @@ void movetongue(DDukeActor *actor, int tongue, int jaw) 32, 32, 0, 0, 0, actor, 5); if (spawned) { - spawned->s.cstat = 128; + spawned->s->cstat = 128; if (actor->temp_data[1] > 512 && actor->temp_data[1] < (1024)) - spawned->s.picnum = jaw + 1; + spawned->s->picnum = jaw + 1; } } @@ -1398,14 +1398,14 @@ void movetongue(DDukeActor *actor, int tongue, int jaw) void rpgexplode(DDukeActor *actor, int hit, const vec3_t &pos, int EXPLOSION2, int EXPLOSION2BOT, int newextra, int playsound) { - auto s = &actor->s; + auto s = actor->s; auto explosion = spawn(actor, EXPLOSION2); - explosion->s.pos = pos; + explosion->s->pos = pos; if (s->xrepeat < 10) { - explosion->s.xrepeat = 6; - explosion->s.yrepeat = 6; + explosion->s->xrepeat = 6; + explosion->s->yrepeat = 6; } else if (hit == kHitSector) { @@ -1413,8 +1413,8 @@ void rpgexplode(DDukeActor *actor, int hit, const vec3_t &pos, int EXPLOSION2, i spawn(actor, EXPLOSION2BOT); else { - explosion->s.cstat |= 8; - explosion->s.z += (48 << 8); + explosion->s->cstat |= 8; + explosion->s->z += (48 << 8); } } if (newextra > 0) s->extra = newextra; @@ -1447,9 +1447,9 @@ bool respawnmarker(DDukeActor *actor, int yellow, int green) return false; } if (actor->temp_data[0] >= (gs.respawnitemtime >> 1) && actor->temp_data[0] < ((gs.respawnitemtime >> 1) + (gs.respawnitemtime >> 2))) - actor->s.picnum = yellow; + actor->s->picnum = yellow; else if (actor->temp_data[0] > ((gs.respawnitemtime >> 1) + (gs.respawnitemtime >> 2))) - actor->s.picnum = green; + actor->s->picnum = green; makeitfall(actor); return true; } @@ -1462,7 +1462,7 @@ bool respawnmarker(DDukeActor *actor, int yellow, int green) bool rat(DDukeActor* actor, bool makesound) { - auto s = &actor->s; + auto s = actor->s; makeitfall(actor); if (ssp(actor, CLIPMASK0)) { @@ -1493,13 +1493,13 @@ bool rat(DDukeActor* actor, bool makesound) bool queball(DDukeActor *actor, int pocket, int queball, int stripeball) { - auto s = &actor->s; + auto s = actor->s; if (s->xvel) { DukeStatIterator it(STAT_DEFAULT); while (auto aa = it.Next()) { - if (aa->s.picnum == pocket && ldist(aa, actor) < 52) + if (aa->s->picnum == pocket && ldist(aa, actor) < 52) { deletesprite(actor); return false; @@ -1551,7 +1551,7 @@ bool queball(DDukeActor *actor, int pocket, int queball, int stripeball) DDukeActor *act2; while ((act2 = it.Next())) { - auto sa = &act2->s; + auto sa = act2->s; if (sa->picnum == queball || sa->picnum == stripeball) { j = getincangle(ps[p].angle.ang.asbuild(), getangle(sa->x - ps[p].posx, sa->y - ps[p].posy)); @@ -1591,7 +1591,7 @@ bool queball(DDukeActor *actor, int pocket, int queball, int stripeball) void forcesphere(DDukeActor* actor, int forcesphere) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; int sect = s->sectnum; if (s->yvel == 0) @@ -1602,11 +1602,11 @@ void forcesphere(DDukeActor* actor, int forcesphere) for (int j = 0; j < 2048; j += 128) { auto k = spawn(actor, forcesphere); - k->s.cstat = 257 + 128; - k->s.clipdist = 64; - k->s.ang = j; - k->s.zvel = bsin(l, -5); - k->s.xvel = bcos(l, -9); + k->s->cstat = 257 + 128; + k->s->clipdist = 64; + k->s->ang = j; + k->s->zvel = bsin(l, -5); + k->s->xvel = bcos(l, -9); k->SetOwner(actor); } } @@ -1629,7 +1629,7 @@ void forcesphere(DDukeActor* actor, int forcesphere) DukeStatIterator it(STAT_MISC); while (auto aa = it.Next()) { - if (aa->GetOwner() == actor && aa->s.picnum == forcesphere) + if (aa->GetOwner() == actor && aa->s->picnum == forcesphere) aa->temp_data[1] = 1 + (krand() & 63); } t[3] = 64; @@ -1645,7 +1645,7 @@ void forcesphere(DDukeActor* actor, int forcesphere) void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int painsnd, int roamsnd, int shift, int (*getspawn)(DDukeActor* i)) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; int sect = s->sectnum; int a; @@ -1768,7 +1768,7 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p a = s->ang; s->xvel >>= 1; } - else a = getangle(Owner->s.x - s->x, Owner->s.y - s->y); + else a = getangle(Owner->s->x - s->x, Owner->s->y - s->y); if (t[0] == 1 || t[0] == 4) // Found a locator and going with it { @@ -1819,7 +1819,7 @@ void recon(DDukeActor *actor, int explosion, int firelaser, int attacksnd, int p t[3] = getincangle(s->ang, a); s->ang += t[3] >> 3; - if (s->z < Owner->s.z) + if (s->z < Owner->s->z) s->z += 1024; else s->z -= 1024; } @@ -1847,9 +1847,9 @@ void ooz(DDukeActor *actor) if (x < 8) x = 8; else if (x > 48) x = 48; - actor->s.yrepeat = j; - actor->s.xrepeat = x; - actor->s.z = actor->floorz; + actor->s->yrepeat = j; + actor->s->xrepeat = x; + actor->s->z = actor->floorz; } //--------------------------------------------------------------------------- @@ -1860,16 +1860,16 @@ void ooz(DDukeActor *actor) void reactor(DDukeActor* actor, int REACTOR, int REACTOR2, int REACTORBURNT, int REACTOR2BURNT, int REACTORSPARK, int REACTOR2SPARK) { - spritetype* s = &actor->s; + spritetype* s = actor->s; int* t = &actor->temp_data[0]; - int sect = actor->s.sectnum; + int sect = actor->s->sectnum; if (t[4] == 1) { DukeSectIterator it(sect); while (auto act2 = it.Next()) { - auto sprj = &act2->s; + auto sprj = act2->s; if (sprj->picnum == SECTOREFFECTOR) { if (sprj->lotag == 1) @@ -1915,7 +1915,7 @@ void reactor(DDukeActor* actor, int REACTOR, int REACTOR2, int REACTORBURNT, int S_PlayActorSound(SHORT_CIRCUIT, actor); - ps[p].GetActor()->s.extra--; + ps[p].GetActor()->s->extra--; SetPlayerPal(&ps[p], PalEntry(32, 32, 0, 0)); } t[0] += 128; @@ -1944,7 +1944,7 @@ void reactor(DDukeActor* actor, int REACTOR, int REACTOR2, int REACTORBURNT, int DukeStatIterator it(STAT_STANDABLE); while (auto act2 = it.Next()) { - auto sj = &act2->s; + auto sj = act2->s; if (sj->picnum == MASTERSWITCH) if (sj->hitag == s->hitag) if (sj->yvel == 0) @@ -1997,7 +1997,7 @@ void reactor(DDukeActor* actor, int REACTOR, int REACTOR2, int REACTORBURNT, int void camera(DDukeActor *actor) { - spritetype* s = &actor->s; + spritetype* s = actor->s; int* t = &actor->temp_data[0]; if (t[0] == 0) { @@ -2062,7 +2062,7 @@ void camera(DDukeActor *actor) void forcesphereexplode(DDukeActor *actor) { int* t = &actor->temp_data[0]; - int l = actor->s.xrepeat; + int l = actor->s->xrepeat; if (t[1] > 0) { t[1]--; @@ -2089,17 +2089,17 @@ void forcesphereexplode(DDukeActor *actor) l -= 3; } - actor->s.x = Owner->s.x; - actor->s.y = Owner->s.y; - actor->s.z = Owner->s.z; - actor->s.ang += Owner->temp_data[0]; + actor->s->x = Owner->s->x; + actor->s->y = Owner->s->y; + actor->s->z = Owner->s->z; + actor->s->ang += Owner->temp_data[0]; if (l > 64) l = 64; else if (l < 1) l = 1; - actor->s.xrepeat = l; - actor->s.yrepeat = l; - actor->s.shade = (l >> 1) - 48; + actor->s->xrepeat = l; + actor->s->yrepeat = l; + actor->s->shade = (l >> 1) - 48; for (int j = t[0]; j > 0; j--) ssp(actor, CLIPMASK0); @@ -2113,7 +2113,7 @@ void forcesphereexplode(DDukeActor *actor) void watersplash2(DDukeActor* actor) { - int sect = actor->s.sectnum; + int sect = actor->s->sectnum; int* t = &actor->temp_data[0]; t[0]++; if (t[0] == 1) @@ -2154,10 +2154,10 @@ void frameeffect1(DDukeActor *actor) deletesprite(actor); return; } - else if (t[0] > 4) actor->s.cstat |= 512 + 2; - else if (t[0] > 2) actor->s.cstat |= 2; - actor->s.xoffset = Owner->s.xoffset; - actor->s.yoffset = Owner->s.yoffset; + else if (t[0] > 4) actor->s->cstat |= 512 + 2; + else if (t[0] > 2) actor->s->cstat |= 2; + actor->s->xoffset = Owner->s->xoffset; + actor->s->yoffset = Owner->s->yoffset; } } @@ -2169,7 +2169,7 @@ void frameeffect1(DDukeActor *actor) bool money(DDukeActor* actor, int BLOODPOOL) { - auto s = &actor->s; + auto s = actor->s; int sect = s->sectnum; int* t = &actor->temp_data[0]; @@ -2209,7 +2209,7 @@ bool money(DDukeActor* actor, int BLOODPOOL) DukeStatIterator it(STAT_MISC); while (auto aa = it.Next()) { - if (aa->s.picnum == BLOODPOOL) + if (aa->s->picnum == BLOODPOOL) if (ldist(actor, aa) < 348) { s->pal = 2; @@ -2228,7 +2228,7 @@ bool money(DDukeActor* actor, int BLOODPOOL) bool jibs(DDukeActor *actor, int JIBS6, bool timeout, bool callsetsprite, bool floorcheck, bool zcheck1, bool zcheck2) { - spritetype* s = &actor->s; + spritetype* s = actor->s; int sect = s->sectnum; int* t = &actor->temp_data[0]; @@ -2352,7 +2352,7 @@ bool jibs(DDukeActor *actor, int JIBS6, bool timeout, bool callsetsprite, bool f bool bloodpool(DDukeActor* actor, bool puke, int TIRE) { - spritetype* s = &actor->s; + spritetype* s = actor->s; int sect = s->sectnum; int* t = &actor->temp_data[0]; @@ -2405,7 +2405,7 @@ bool bloodpool(DDukeActor* actor, bool puke, int TIRE) { if (!S_CheckSoundPlaying(DUKE_LONGTERM_PAIN)) S_PlayActorSound(DUKE_LONGTERM_PAIN, ps[p].GetActor()); - ps[p].GetActor()->s.extra--; + ps[p].GetActor()->s->extra--; SetPlayerPal(&ps[p], PalEntry(32, 16, 0, 0)); } } @@ -2438,7 +2438,7 @@ bool bloodpool(DDukeActor* actor, bool puke, int TIRE) void shell(DDukeActor* actor, bool morecheck) { - spritetype* s = &actor->s; + spritetype* s = actor->s; int sect = s->sectnum; int* t = &actor->temp_data[0]; @@ -2492,7 +2492,7 @@ void shell(DDukeActor* actor, bool morecheck) void glasspieces(DDukeActor* actor) { - spritetype* s = &actor->s; + spritetype* s = actor->s; int sect = s->sectnum; int* t = &actor->temp_data[0]; @@ -2540,7 +2540,7 @@ void glasspieces(DDukeActor* actor) void scrap(DDukeActor* actor, int SCRAP1, int SCRAP6) { - spritetype* s = &actor->s; + spritetype* s = actor->s; int sect = s->sectnum; int* t = &actor->temp_data[0]; @@ -2586,7 +2586,7 @@ void scrap(DDukeActor* actor, int SCRAP1, int SCRAP6) auto spawned = spawn(actor, s->yvel); setsprite(spawned, s->pos); getglobalz(spawned); - spawned->s.hitag = spawned->s.lotag = 0; + spawned->s->hitag = spawned->s->lotag = 0; } deletesprite(actor); } @@ -2602,17 +2602,17 @@ void gutsdir(DDukeActor* actor, short gtype, short n, short p) { int sx, sy; - if (badguy(actor) && actor->s.xrepeat < 16) + if (badguy(actor) && actor->s->xrepeat < 16) sx = sy = 8; else sx = sy = 32; - int gutz = actor->s.z - (8 << 8); - int floorz = getflorzofslope(actor->s.sectnum, actor->s.x, actor->s.y); + int gutz = actor->s->z - (8 << 8); + int floorz = getflorzofslope(actor->s->sectnum, actor->s->x, actor->s->y); if (gutz > (floorz - (8 << 8))) gutz = floorz - (8 << 8); - gutz += gs.actorinfo[actor->s.picnum].gutsoffset; + gutz += gs.actorinfo[actor->s->picnum].gutsoffset; for (int j = 0; j < n; j++) { @@ -2620,7 +2620,7 @@ void gutsdir(DDukeActor* actor, short gtype, short n, short p) int r1 = krand(); int r2 = krand(); // TRANSITIONAL: owned by a player??? - EGS(actor->s.sectnum, actor->s.x, actor->s.y, gutz, gtype, -32, sx, sy, a, 256 + (r2 & 127), -512 - (r1 & 2047), ps[p].GetActor(), 5); + EGS(actor->s->sectnum, actor->s->x, actor->s->y, gutz, gtype, -32, sx, sy, a, 256 + (r2 & 127), -512 - (r1 & 2047), ps[p].GetActor(), 5); } } @@ -2632,7 +2632,7 @@ void gutsdir(DDukeActor* actor, short gtype, short n, short p) void handle_se00(DDukeActor* actor, int LASERLINE) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; sectortype *sect = §or[s->sectnum]; int st = s->lotag; @@ -2642,7 +2642,7 @@ void handle_se00(DDukeActor* actor, int LASERLINE) auto Owner = actor->GetOwner(); - if (!Owner || Owner->s.lotag == (short)65535) + if (!Owner || Owner->s->lotag == (short)65535) { deletesprite(actor); return; @@ -2724,14 +2724,14 @@ void handle_se00(DDukeActor* actor, int LASERLINE) return; } - if (Owner->s.ang > 1024) + if (Owner->s->ang > 1024) l = -1; else l = 1; if (t[3] == 0) t[3] = ldist(actor, Owner); s->xvel = t[3]; - s->x = Owner->s.x; - s->y = Owner->s.y; + s->x = Owner->s->x; + s->y = Owner->s->y; s->ang += (l * q); t[2] += (l * q); } @@ -2748,7 +2748,7 @@ void handle_se00(DDukeActor* actor, int LASERLINE) ps[p].posz += zchange; int m, x; - rotatepoint(Owner->s.x, Owner->s.y, ps[p].posx, ps[p].posy, (q * l), &m, &x); + rotatepoint(Owner->s->x, Owner->s->y, ps[p].posx, ps[p].posy, (q * l), &m, &x); ps[p].bobposx += m - ps[p].posx; ps[p].bobposy += x - ps[p].posy; @@ -2757,17 +2757,17 @@ void handle_se00(DDukeActor* actor, int LASERLINE) ps[p].posy = x; auto psp = ps[p].GetActor(); - if (psp->s.extra <= 0) + if (psp->s->extra <= 0) { - psp->s.x = m; - psp->s.y = x; + psp->s->x = m; + psp->s->y = x; } } } DukeSectIterator itp(s->sectnum); while (auto ap = itp.Next()) { - auto sprp = &ap->s; + auto sprp = ap->s; if (sprp->statnum != 3 && sprp->statnum != 4) if (LASERLINE < 0 || sprp->picnum != LASERLINE) { @@ -2780,7 +2780,7 @@ void handle_se00(DDukeActor* actor, int LASERLINE) sprp->ang &= 2047; sprp->z += zchange; - rotatepoint(Owner->s.x, Owner->s.y, ap->s.x, ap->s.y, (q* l), &ap->s.x, &ap->s.y); + rotatepoint(Owner->s->x, Owner->s->y, ap->s->x, ap->s->y, (q* l), &ap->s->x, &ap->s->y); } } @@ -2797,7 +2797,7 @@ void handle_se00(DDukeActor* actor, int LASERLINE) void handle_se01(DDukeActor *actor) { int* t = &actor->temp_data[0]; - int sh = actor->s.hitag; + int sh = actor->s->hitag; if (actor->GetOwner() == nullptr) //Init { actor->SetOwner(actor); @@ -2805,7 +2805,7 @@ void handle_se01(DDukeActor *actor) DukeStatIterator it(STAT_EFFECTOR); while (auto ac = it.Next()) { - if (ac->s.lotag == 19 && ac->s.hitag == sh) + if (ac->s->lotag == 19 && ac->s->hitag == sh) { t[0] = 0; break; @@ -2822,7 +2822,7 @@ void handle_se01(DDukeActor *actor) void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; auto sc = §or[s->sectnum]; int st = s->lotag; @@ -2845,7 +2845,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6) if (j < 1024) { if (st == 6) - if (Owner->s.hitag & 1) + if (Owner->s->hitag & 1) t[4] = sc->extra; //Slow it down t[3]++; auto NewOwner = LocateTheLocator(t[3], t[0]); @@ -2860,7 +2860,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6) Owner = actor->GetOwner(); if (s->xvel) { - int x = getangle(Owner->s.x - s->x, Owner->s.y - s->y); + int x = getangle(Owner->s->x - s->x, Owner->s->y - s->y); int q = getincangle(s->ang, x) >> 3; t[2] += q; @@ -2896,7 +2896,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6) for (int p = connecthead; p >= 0; p = connectpoint2[p]) { auto psp = ps[p].GetActor(); - if (psp->s.extra > 0) + if (psp->s->extra > 0) { short k = ps[p].cursectnum; updatesector(ps[p].posx, ps[p].posy, &k); @@ -2927,7 +2927,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6) po[p].oy += x; } - if (s->sectnum == psp->s.sectnum) + if (s->sectnum == psp->s->sectnum) { rotatepoint(s->x, s->y, ps[p].posx, ps[p].posy, q, &ps[p].posx, &ps[p].posy); @@ -2944,10 +2944,10 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6) ps[p].oposx = ps[p].posx; ps[p].oposy = ps[p].posy; } - if (psp->s.extra <= 0) + if (psp->s->extra <= 0) { - psp->s.x = ps[p].posx; - psp->s.y = ps[p].posy; + psp->s->x = ps[p].posx; + psp->s->y = ps[p].posy; } } } @@ -2955,7 +2955,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6) DukeSectIterator it(s->sectnum); while (auto a2 = it.Next()) { - auto sj = &a2->s; + auto sj = a2->s; if (sj->statnum != 10 && sector[sj->sectnum].lotag != 2 && sj->picnum != SECTOREFFECTOR && sj->picnum != LOCATORS) { rotatepoint(s->x, s->y, sj->x, sj->y, q, &sj->x, &sj->y); @@ -2980,7 +2980,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6) if (ud.clipping == 0 && s->xvel >= 192) for (int p = connecthead; p >= 0; p = connectpoint2[p]) { - if (ps[p].GetActor()->s.extra > 0) + if (ps[p].GetActor()->s->extra > 0) { short k = ps[p].cursectnum; updatesector(ps[p].posx, ps[p].posy, &k); @@ -2999,14 +2999,14 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6) auto Owner = actor->GetOwner(); if (Owner) { - DukeSectIterator itr(Owner->s.sectnum); + DukeSectIterator itr(Owner->s->sectnum); while (auto a2 = itr.Next()) { - if (a2->s.statnum == 1 && badguy(a2) && a2->s.picnum != SECTOREFFECTOR && a2->s.picnum != LOCATORS) + if (a2->s->statnum == 1 && badguy(a2) && a2->s->picnum != SECTOREFFECTOR && a2->s->picnum != LOCATORS) { - short k = a2->s.sectnum; - updatesector(a2->s.x, a2->s.y, &k); - if (a2->s.extra >= 0 && k == s->sectnum) + short k = a2->s->sectnum; + updatesector(a2->s->x, a2->s->y, &k); + if (a2->s->extra >= 0 && k == s->sectnum) { gutsdir(a2, JIBS6, 72, myconnectindex); S_PlayActorSound(SQUISHED, actor); @@ -3027,7 +3027,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6) void handle_se30(DDukeActor *actor, int JIBS6) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; auto sc = §or[s->sectnum]; int st = s->lotag; @@ -3056,7 +3056,7 @@ void handle_se30(DDukeActor *actor, int JIBS6) } if (t[4] == 2) { - int l = FindDistance2D(Owner->s.x - s->x, Owner->s.y - s->y); + int l = FindDistance2D(Owner->s->x - s->x, Owner->s->y - s->y); if (l <= 128) s->xvel = 0; @@ -3085,7 +3085,7 @@ void handle_se30(DDukeActor *actor, int JIBS6) for (int p = connecthead; p >= 0; p = connectpoint2[p]) { auto psp = ps[p].GetActor(); - if (psp->s.extra > 0) + if (psp->s->extra > 0) { short k = ps[p].cursectnum; updatesector(ps[p].posx, ps[p].posy, &k); @@ -3103,7 +3103,7 @@ void handle_se30(DDukeActor *actor, int JIBS6) for (int p = connecthead; p >= 0; p = connectpoint2[p]) { auto psp = ps[p].GetActor(); - if (psp->s.sectnum == s->sectnum) + if (psp->s->sectnum == s->sectnum) { ps[p].posx += l; ps[p].posy += x; @@ -3128,7 +3128,7 @@ void handle_se30(DDukeActor *actor, int JIBS6) DukeSectIterator its(s->sectnum); while (auto a2 = its.Next()) { - auto spa2 = &a2->s; + auto spa2 = a2->s; if (spa2->picnum != SECTOREFFECTOR && spa2->picnum != LOCATORS) { spa2->x += l; @@ -3148,7 +3148,7 @@ void handle_se30(DDukeActor *actor, int JIBS6) { if (ud.clipping == 0) for (int p = connecthead; p >= 0; p = connectpoint2[p]) - if (ps[p].GetActor()->s.extra > 0) + if (ps[p].GetActor()->s->extra > 0) { short k = ps[p].cursectnum; updatesector(ps[p].posx, ps[p].posy, &k); @@ -3169,16 +3169,16 @@ void handle_se30(DDukeActor *actor, int JIBS6) if (Owner) { - DukeSectIterator it(Owner->s.sectnum); + DukeSectIterator it(Owner->s->sectnum); while (auto a2 = it.Next()) { - if (a2->s.statnum == 1 && badguy(a2) && a2->s.picnum != SECTOREFFECTOR && a2->s.picnum != LOCATORS) + if (a2->s->statnum == 1 && badguy(a2) && a2->s->picnum != SECTOREFFECTOR && a2->s->picnum != LOCATORS) { // if(a2->s.sectnum != s->sectnum) { - short k = a2->s.sectnum; - updatesector(a2->s.x, a2->s.y, &k); - if (a2->s.extra >= 0 && k == s->sectnum) + short k = a2->s->sectnum; + updatesector(a2->s->x, a2->s->y, &k); + if (a2->s->extra >= 0 && k == s->sectnum) { gutsdir(a2, JIBS6, 24, myconnectindex); S_PlayActorSound(SQUISHED, a2); @@ -3200,7 +3200,7 @@ void handle_se30(DDukeActor *actor, int JIBS6) void handle_se02(DDukeActor *actor) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; auto sc = §or[s->sectnum]; int st = s->lotag; @@ -3256,7 +3256,7 @@ void handle_se02(DDukeActor *actor) DukeSectIterator it(s->sectnum); while (auto a2 = it.Next()) { - auto sj = &a2->s; + auto sj = a2->s; if (sj->picnum != SECTOREFFECTOR) { sj->x += m; @@ -3277,7 +3277,7 @@ void handle_se02(DDukeActor *actor) void handle_se03(DDukeActor *actor) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; auto sc = §or[s->sectnum]; int st = s->lotag; @@ -3331,7 +3331,7 @@ void handle_se03(DDukeActor *actor) void handle_se04(DDukeActor *actor) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; auto sc = §or[s->sectnum]; int st = s->lotag; @@ -3380,7 +3380,7 @@ void handle_se04(DDukeActor *actor) DukeSectIterator it(s->sectnum); while (auto a2 = it.Next()) { - auto sj = &a2->s; + auto sj = a2->s; if (sj->cstat & 16) { if (sc->ceilingstat & 1) @@ -3402,7 +3402,7 @@ void handle_se04(DDukeActor *actor) void handle_se05(DDukeActor* actor, int FIRELASER) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; auto sc = §or[s->sectnum]; int st = s->lotag; @@ -3441,7 +3441,7 @@ void handle_se05(DDukeActor* actor, int FIRELASER) actor->SetOwner(Owner); if (!Owner) return; // Undefined case - was not checked. - s->zvel = Sgn(Owner->s.z - s->z) << 4; + s->zvel = Sgn(Owner->s->z - s->z) << 4; } if (ldist(Owner, actor) < 1024) @@ -3456,7 +3456,7 @@ void handle_se05(DDukeActor* actor, int FIRELASER) } else s->xvel = 256; - x = getangle(Owner->s.x - s->x, Owner->s.y - s->y); + x = getangle(Owner->s->x - s->x, Owner->s->y - s->y); int q = getincangle(s->ang, x) >> 3; s->ang += q; @@ -3498,7 +3498,7 @@ void handle_se05(DDukeActor* actor, int FIRELASER) void handle_se08(DDukeActor *actor, bool checkhitag1) { // work only if its moving - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; auto sc = §or[s->sectnum]; int st = s->lotag; @@ -3532,11 +3532,11 @@ void handle_se08(DDukeActor *actor, bool checkhitag1) DukeStatIterator it(STAT_EFFECTOR); while (auto ac = it.Next()) { - if (((ac->s.lotag) == st) && (ac->s.hitag) == sh) + if (((ac->s->lotag) == st) && (ac->s->hitag) == sh) { - sn = ac->s.sectnum; + sn = ac->s->sectnum; auto sect = §or[sn]; - int m = ac->s.shade; + int m = ac->s->shade; auto wal = &wall[sect->wallptr]; @@ -3586,7 +3586,7 @@ void handle_se08(DDukeActor *actor, bool checkhitag1) void handle_se10(DDukeActor* actor, const int* specialtags) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; auto sc = §or[s->sectnum]; int st = s->lotag; @@ -3599,7 +3599,7 @@ void handle_se10(DDukeActor* actor, const int* specialtags) if ((sc->lotag & 0xff) != 27) for (int p = connecthead; p >= 0; p = connectpoint2[p]) if (sc->lotag != 30 && sc->lotag != 31 && sc->lotag != 0) - if (s->sectnum == ps[p].GetActor()->s.sectnum) + if (s->sectnum == ps[p].GetActor()->s->sectnum) j = 0; if (j == 1) @@ -3630,7 +3630,7 @@ void handle_se10(DDukeActor* actor, const int* specialtags) void handle_se11(DDukeActor *actor) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; auto sc = §or[s->sectnum]; int st = s->lotag; @@ -3654,7 +3654,7 @@ void handle_se11(DDukeActor *actor) { while (auto ac = it.Next()) { - auto sk = &ac->s; + auto sk = ac->s; if (sk->extra > 0 && badguy(ac) && clipinsidebox(sk->x, sk->y, j, 256L) == 1) return; } @@ -3671,7 +3671,7 @@ void handle_se11(DDukeActor *actor) it.Reset(STAT_PLAYER); while (auto ac = it.Next()) { - auto sk = &ac->s; + auto sk = ac->s; if (ac->GetOwner() && clipinsidebox(sk->x, sk->y, j, 144L) == 1) { t[5] = 8; // Delay @@ -3702,7 +3702,7 @@ void handle_se11(DDukeActor *actor) void handle_se12(DDukeActor *actor, int planeonly) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; auto sc = §or[s->sectnum]; int st = s->lotag; @@ -3727,11 +3727,11 @@ void handle_se12(DDukeActor *actor, int planeonly) DukeSectIterator it(s->sectnum); while (auto a2 = it.Next()) { - if (a2->s.cstat & 16) + if (a2->s->cstat & 16) { if (sc->ceilingstat & 1) - a2->s.shade = sc->ceilingshade; - else a2->s.shade = sc->floorshade; + a2->s->shade = sc->ceilingshade; + else a2->s->shade = sc->floorshade; } } @@ -3766,11 +3766,11 @@ void handle_se12(DDukeActor *actor, int planeonly) DukeSectIterator it(s->sectnum); while (auto a2 = it.Next()) { - if (a2->s.cstat & 16) + if (a2->s->cstat & 16) { if (sc->ceilingstat & 1) - a2->s.shade = sc->ceilingshade; - else a2->s.shade = sc->floorshade; + a2->s->shade = sc->ceilingshade; + else a2->s->shade = sc->floorshade; } } } @@ -3784,7 +3784,7 @@ void handle_se12(DDukeActor *actor, int planeonly) void handle_se13(DDukeActor* actor) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; auto sc = §or[s->sectnum]; int st = s->lotag; @@ -3861,7 +3861,7 @@ void handle_se13(DDukeActor* actor) void handle_se15(DDukeActor* actor) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; if (t[4]) { @@ -3901,7 +3901,7 @@ void handle_se15(DDukeActor* actor) void handle_se16(DDukeActor* actor, int REACTOR, int REACTOR2) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; auto sc = §or[s->sectnum]; @@ -3920,7 +3920,7 @@ void handle_se16(DDukeActor* actor, int REACTOR, int REACTOR2) DDukeActor* a2; while ((a2 = it.Next())) { - if (a2->s.picnum == REACTOR || a2->s.picnum == REACTOR2) + if (a2->s->picnum == REACTOR || a2->s->picnum == REACTOR2) return; } if (a2 == nullptr) @@ -3946,7 +3946,7 @@ void handle_se16(DDukeActor* actor, int REACTOR, int REACTOR2) void handle_se17(DDukeActor* actor) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; auto sc = §or[s->sectnum]; int st = s->lotag; @@ -3960,19 +3960,19 @@ void handle_se17(DDukeActor* actor) DukeSectIterator it(s->sectnum); while (auto act1 = it.Next()) { - if (act1->s.statnum == STAT_PLAYER && act1->GetOwner()) + if (act1->s->statnum == STAT_PLAYER && act1->GetOwner()) { - int p = act1->s.yvel; + int p = act1->s->yvel; if (numplayers < 2) ps[p].oposz = ps[p].posz; ps[p].posz += q; ps[p].truefz += q; ps[p].truecz += q; if (numplayers > 1) ps[p].oposz = ps[p].posz; } - if (act1->s.statnum != STAT_EFFECTOR) + if (act1->s->statnum != STAT_EFFECTOR) { - act1->s.backupz(); - act1->s.z += q; + act1->s->backupz(); + act1->s->z += q; } act1->floorz = sc->floorz; @@ -4001,18 +4001,18 @@ void handle_se17(DDukeActor* actor) DukeStatIterator it(STAT_EFFECTOR); while ((act2 = it.Next())) { - if (actor != act2 && (act2->s.lotag) == 17) - if ((sc->hitag - t[0]) == (sector[act2->s.sectnum].hitag) && sh == (act2->s.hitag)) + if (actor != act2 && (act2->s->lotag) == 17) + if ((sc->hitag - t[0]) == (sector[act2->s->sectnum].hitag) && sh == (act2->s->hitag)) break; } if (act2 == nullptr) return; - auto spr2 = &act2->s; + auto spr2 = act2->s; DukeSectIterator its(s->sectnum); while (auto act3 = its.Next()) { - auto spr3 = &act3->s; + auto spr3 = act3->s; if (spr3->statnum == STAT_PLAYER && act3->GetOwner()) { int p = spr3->yvel; @@ -4063,15 +4063,15 @@ void handle_se17(DDukeActor* actor) void handle_se18(DDukeActor *actor, bool morecheck) { int* t = &actor->temp_data[0]; - auto sc = §or[actor->s.sectnum]; - int st = actor->s.lotag; - int sh = actor->s.hitag; + auto sc = §or[actor->s->sectnum]; + int st = actor->s->lotag; + int sh = actor->s->hitag; if (t[0]) { - if (actor->s.pal) + if (actor->s->pal) { - if (actor->s.ang == 512) + if (actor->s->ang == 512) { sc->ceilingz -= sc->extra; if (sc->ceilingz <= t[1]) @@ -4086,14 +4086,14 @@ void handle_se18(DDukeActor *actor, bool morecheck) sc->floorz += sc->extra; if (morecheck) { - DukeSectIterator it(actor->s.sectnum); + DukeSectIterator it(actor->s->sectnum); while (auto a2 = it.Next()) { - if (a2->s.picnum == TILE_APLAYER && a2->GetOwner()) + if (a2->s->picnum == TILE_APLAYER && a2->GetOwner()) if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].posz += sc->extra; - if (a2->s.zvel == 0 && a2->s.statnum != STAT_EFFECTOR && a2->s.statnum != STAT_PROJECTILE) + if (a2->s->zvel == 0 && a2->s->statnum != STAT_EFFECTOR && a2->s->statnum != STAT_PROJECTILE) { - a2->s.z += sc->extra; + a2->s->z += sc->extra; a2->floorz = sc->floorz; } } @@ -4108,12 +4108,12 @@ void handle_se18(DDukeActor *actor, bool morecheck) } else { - if (actor->s.ang == 512) + if (actor->s->ang == 512) { sc->ceilingz += sc->extra; - if (sc->ceilingz >= actor->s.z) + if (sc->ceilingz >= actor->s->z) { - sc->ceilingz = actor->s.z; + sc->ceilingz = actor->s->z; deletesprite(actor); return; } @@ -4123,21 +4123,21 @@ void handle_se18(DDukeActor *actor, bool morecheck) sc->floorz -= sc->extra; if (morecheck) { - DukeSectIterator it(actor->s.sectnum); + DukeSectIterator it(actor->s->sectnum); while (auto a2 = it.Next()) { - if (a2->s.picnum == TILE_APLAYER && a2->GetOwner()) + if (a2->s->picnum == TILE_APLAYER && a2->GetOwner()) if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].posz -= sc->extra; - if (a2->s.zvel == 0 && a2->s.statnum != STAT_EFFECTOR && a2->s.statnum != STAT_PROJECTILE) + if (a2->s->zvel == 0 && a2->s->statnum != STAT_EFFECTOR && a2->s->statnum != STAT_PROJECTILE) { - a2->s.z -= sc->extra; + a2->s->z -= sc->extra; a2->floorz = sc->floorz; } } } - if (sc->floorz <= actor->s.z) + if (sc->floorz <= actor->s->z) { - sc->floorz = actor->s.z; + sc->floorz = actor->s->z; deletesprite(actor); return; } @@ -4145,7 +4145,7 @@ void handle_se18(DDukeActor *actor, bool morecheck) } t[2]++; - if (t[2] >= actor->s.hitag) + if (t[2] >= actor->s->hitag) { t[2] = 0; t[0] = 0; @@ -4162,9 +4162,9 @@ void handle_se18(DDukeActor *actor, bool morecheck) void handle_se19(DDukeActor *actor, int BIGFORCE) { int* t = &actor->temp_data[0]; - auto sc = §or[actor->s.sectnum]; - int st = actor->s.lotag; - int sh = actor->s.hitag; + auto sc = §or[actor->s->sectnum]; + int st = actor->s->lotag; + int sh = actor->s->hitag; int j, x, q; if (t[0]) @@ -4188,7 +4188,7 @@ void handle_se19(DDukeActor *actor, int BIGFORCE) } if (sc->ceilingz < sc->floorz) - sc->ceilingz += actor->s.yvel; + sc->ceilingz += actor->s->yvel; else { sc->ceilingz = sc->floorz; @@ -4197,11 +4197,11 @@ void handle_se19(DDukeActor *actor, int BIGFORCE) while (auto a2 = it.Next()) { auto a2Owner = a2->GetOwner(); - if (a2->s.lotag == 0 && a2->s.hitag == sh && a2Owner) + if (a2->s->lotag == 0 && a2->s->hitag == sh && a2Owner) { - q = a2Owner->s.sectnum; - sector[a2->s.sectnum].floorpal = sector[a2->s.sectnum].ceilingpal = sector[q].floorpal; - sector[a2->s.sectnum].floorshade = sector[a2->s.sectnum].ceilingshade = sector[q].floorshade; + q = a2Owner->s->sectnum; + sector[a2->s->sectnum].floorpal = sector[a2->s->sectnum].ceilingpal = sector[q].floorpal; + sector[a2->s->sectnum].floorshade = sector[a2->s->sectnum].ceilingshade = sector[q].floorshade; a2Owner->temp_data[0] = 2; } } @@ -4211,7 +4211,7 @@ void handle_se19(DDukeActor *actor, int BIGFORCE) } else //Not hit yet { - auto hitter = fi.ifhitsectors(actor->s.sectnum); + auto hitter = fi.ifhitsectors(actor->s->sectnum); if (hitter) { FTA(8, &ps[myconnectindex]); @@ -4219,15 +4219,15 @@ void handle_se19(DDukeActor *actor, int BIGFORCE) DukeStatIterator it(STAT_EFFECTOR); while (auto ac = it.Next()) { - x = ac->s.lotag & 0x7fff; + x = ac->s->lotag & 0x7fff; switch (x) { case 0: - if (ac->s.hitag == sh && ac->GetOwner()) + if (ac->s->hitag == sh && ac->GetOwner()) { - q = ac->s.sectnum; - sector[q].floorshade = sector[q].ceilingshade = ac->GetOwner()->s.shade; - sector[q].floorpal = sector[q].ceilingpal = ac->GetOwner()->s.pal; + q = ac->s->sectnum; + sector[q].floorshade = sector[q].ceilingshade = ac->GetOwner()->s->shade; + sector[q].floorpal = sector[q].ceilingpal = ac->GetOwner()->s->pal; } break; @@ -4236,7 +4236,7 @@ void handle_se19(DDukeActor *actor, int BIGFORCE) //case 18: case 19: - if (sh == ac->s.hitag) + if (sh == ac->s->hitag) if (ac->temp_data[0] == 0) { ac->temp_data[0] = 1; //Shut them all on @@ -4258,7 +4258,7 @@ void handle_se19(DDukeActor *actor, int BIGFORCE) void handle_se20(DDukeActor* actor) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; auto sc = §or[s->sectnum]; int st = s->lotag; @@ -4290,13 +4290,13 @@ void handle_se20(DDukeActor* actor) DukeSectIterator it(s->sectnum); while (auto a2 = it.Next()) { - if (a2->s.statnum != 3 && a2->s.zvel == 0) + if (a2->s->statnum != 3 && a2->s->zvel == 0) { - a2->s.x += x; - a2->s.y += l; - setsprite(a2, a2->s.pos); - if (sector[a2->s.sectnum].floorstat & 2) - if (a2->s.statnum == 2) + a2->s->x += x; + a2->s->y += l; + setsprite(a2, a2->s->pos); + if (sector[a2->s->sectnum].floorstat & 2) + if (a2->s->statnum == 2) makeitfall(a2); } } @@ -4332,7 +4332,7 @@ void handle_se20(DDukeActor* actor) void handle_se21(DDukeActor* actor) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; auto sc = §or[s->sectnum]; int st = s->lotag; @@ -4374,7 +4374,7 @@ void handle_se21(DDukeActor* actor) void handle_se22(DDukeActor* actor) { int* t = &actor->temp_data[0]; - auto sc = §or[actor->s.sectnum]; + auto sc = §or[actor->s->sectnum]; if (t[1]) { if (getanimationgoal(anim_ceilingz, t[0]) >= 0) @@ -4391,7 +4391,7 @@ void handle_se22(DDukeActor* actor) void handle_se26(DDukeActor* actor) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; auto sc = §or[s->sectnum]; int x, l; @@ -4414,17 +4414,17 @@ void handle_se26(DDukeActor* actor) DukeSectIterator it(s->sectnum); while (auto a2 = it.Next()) { - if (a2->s.statnum != 3 && a2->s.statnum != 10) + if (a2->s->statnum != 3 && a2->s->statnum != 10) { - a2->s.x += l; - a2->s.y += x; - a2->s.z += s->zvel; - setsprite(a2, a2->s.pos); + a2->s->x += l; + a2->s->y += x; + a2->s->z += s->zvel; + setsprite(a2, a2->s->pos); } } for (int p = connecthead; p >= 0; p = connectpoint2[p]) - if (ps[p].GetActor()->s.sectnum == s->sectnum && ps[p].on_ground) + if (ps[p].GetActor()->s->sectnum == s->sectnum && ps[p].on_ground) { ps[p].fric.x += l << 5; ps[p].fric.y += x << 5; @@ -4443,7 +4443,7 @@ void handle_se26(DDukeActor* actor) void handle_se27(DDukeActor* actor) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; auto sc = §or[s->sectnum]; int st = s->lotag; @@ -4455,7 +4455,7 @@ void handle_se27(DDukeActor* actor) actor->tempang = s->ang; p = findplayer(actor, &x); - if (ps[p].GetActor()->s.extra > 0 && myconnectindex == screenpeek) + if (ps[p].GetActor()->s->extra > 0 && myconnectindex == screenpeek) { if (t[0] < 0) { @@ -4513,13 +4513,13 @@ void handle_se24(DDukeActor *actor, int16_t *list1, int16_t *list2, bool scroll, if (t[4]) return; - int x = MulScale(actor->s.yvel, bcos(actor->s.ang), 18); - int l = MulScale(actor->s.yvel, bsin(actor->s.ang), 18); + int x = MulScale(actor->s->yvel, bcos(actor->s->ang), 18); + int l = MulScale(actor->s->yvel, bsin(actor->s->ang), 18); - DukeSectIterator it(actor->s.sectnum); + DukeSectIterator it(actor->s->sectnum); while (auto a2 = it.Next()) { - auto s2 = &a2->s; + auto s2 = a2->s; if (s2->zvel >= 0) { switch (s2->statnum) @@ -4566,7 +4566,7 @@ void handle_se24(DDukeActor *actor, int16_t *list1, int16_t *list2, bool scroll, for (auto p = connecthead; p >= 0; p = connectpoint2[p]) { - if (ps[p].cursectnum == actor->s.sectnum && ps[p].on_ground) + if (ps[p].cursectnum == actor->s->sectnum && ps[p].on_ground) { if (abs(ps[p].pos.z - ps[p].truefz) < gs.playerheight + (9 << 8)) { @@ -4575,7 +4575,7 @@ void handle_se24(DDukeActor *actor, int16_t *list1, int16_t *list2, bool scroll, } } } - if (scroll) sector[actor->s.sectnum].addfloorxpan(actor->s.yvel / 128.f); + if (scroll) sector[actor->s->sectnum].addfloorxpan(actor->s->yvel / 128.f); } //--------------------------------------------------------------------------- @@ -4587,16 +4587,16 @@ void handle_se24(DDukeActor *actor, int16_t *list1, int16_t *list2, bool scroll, void handle_se25(DDukeActor* actor, int t_index, int snd1, int snd2) { int* t = &actor->temp_data[0]; - auto sec = §or[actor->s.sectnum]; + auto sec = §or[actor->s->sectnum]; if (sec->floorz <= sec->ceilingz) - actor->s.shade = 0; + actor->s->shade = 0; else if (sec->ceilingz <= t[t_index]) - actor->s.shade = 1; + actor->s->shade = 1; - if (actor->s.shade) + if (actor->s->shade) { - sec->ceilingz += actor->s.yvel << 4; + sec->ceilingz += actor->s->yvel << 4; if (sec->ceilingz > sec->floorz) { sec->ceilingz = sec->floorz; @@ -4606,7 +4606,7 @@ void handle_se25(DDukeActor* actor, int t_index, int snd1, int snd2) } else { - sec->ceilingz -= actor->s.yvel << 4; + sec->ceilingz -= actor->s->yvel << 4; if (sec->ceilingz < t[t_index]) { sec->ceilingz = t[t_index]; @@ -4624,7 +4624,7 @@ void handle_se25(DDukeActor* actor, int t_index, int snd1, int snd2) void handle_se32(DDukeActor *actor) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; auto sc = §or[s->sectnum]; @@ -4692,7 +4692,7 @@ void handle_se32(DDukeActor *actor) void handle_se35(DDukeActor *actor, int SMALLSMOKE, int EXPLOSION2) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; auto sc = §or[s->sectnum]; @@ -4701,9 +4701,9 @@ void handle_se35(DDukeActor *actor, int SMALLSMOKE, int EXPLOSION2) { s->ang += krand() & 511; auto spawned = spawn(actor, SMALLSMOKE); - spawned->s.xvel = 96 + (krand() & 127); + spawned->s->xvel = 96 + (krand() & 127); ssp(spawned, CLIPMASK0); - setsprite(spawned, spawned->s.pos); + setsprite(spawned, spawned->s->pos); if (rnd(16)) spawn(actor, EXPLOSION2); } @@ -4737,7 +4737,7 @@ void handle_se35(DDukeActor *actor, int SMALLSMOKE, int EXPLOSION2) void handle_se128(DDukeActor *actor) { int* t = &actor->temp_data[0]; - auto sc = §or[actor->s.sectnum]; + auto sc = §or[actor->s->sectnum]; auto wal = &wall[t[2]]; @@ -4776,7 +4776,7 @@ void handle_se128(DDukeActor *actor) void handle_se130(DDukeActor *actor, int countmax, int EXPLOSION2) { int* t = &actor->temp_data[0]; - auto sc = §or[actor->s.sectnum]; + auto sc = §or[actor->s->sectnum]; if (t[0] > countmax) { @@ -4790,10 +4790,10 @@ void handle_se130(DDukeActor *actor, int countmax, int EXPLOSION2) if (rnd(64)) { auto k = spawn(actor, EXPLOSION2); - k->s.xrepeat = k->s.yrepeat = 2 + (krand() & 7); - k->s.z = sc->floorz - (krand() % x); - k->s.ang += 256 - (krand() % 511); - k->s.xvel = krand() & 127; + k->s->xrepeat = k->s->yrepeat = 2 + (krand() & 7); + k->s->z = sc->floorz - (krand() % x); + k->s->ang += 256 - (krand() % 511); + k->s->xvel = krand() & 127; ssp(k, CLIPMASK0); } } @@ -4806,7 +4806,7 @@ void handle_se130(DDukeActor *actor, int countmax, int EXPLOSION2) void handle_se31(DDukeActor* actor, bool choosedir) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; auto sec = §or[s->sectnum]; @@ -4840,12 +4840,12 @@ void handle_se31(DDukeActor* actor, bool choosedir) DukeSectIterator it(s->sectnum); while (auto a2 = it.Next()) { - if (a2->s.picnum == TILE_APLAYER && a2->GetOwner()) + if (a2->s->picnum == TILE_APLAYER && a2->GetOwner()) if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].posz += l; - if (a2->s.zvel == 0 && a2->s.statnum != STAT_EFFECTOR && (!choosedir || a2->s.statnum != STAT_PROJECTILE)) + if (a2->s->zvel == 0 && a2->s->statnum != STAT_EFFECTOR && (!choosedir || a2->s->statnum != STAT_PROJECTILE)) { - a2->s.z += l; + a2->s->z += l; a2->floorz = sec->floorz; } } @@ -4869,12 +4869,12 @@ void handle_se31(DDukeActor* actor, bool choosedir) DukeSectIterator it(s->sectnum); while (auto a2 = it.Next()) { - if (a2->s.picnum == TILE_APLAYER && a2->GetOwner()) + if (a2->s->picnum == TILE_APLAYER && a2->GetOwner()) if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].posz += l; - if (a2->s.zvel == 0 && a2->s.statnum != STAT_EFFECTOR && (!choosedir || a2->s.statnum != STAT_PROJECTILE)) + if (a2->s->zvel == 0 && a2->s->statnum != STAT_EFFECTOR && (!choosedir || a2->s->statnum != STAT_PROJECTILE)) { - a2->s.z += l; + a2->s->z += l; a2->floorz = sec->floorz; } } @@ -4900,12 +4900,12 @@ void handle_se31(DDukeActor* actor, bool choosedir) DukeSectIterator it(s->sectnum); while (auto a2 = it.Next()) { - if (a2->s.picnum == TILE_APLAYER && a2->GetOwner()) + if (a2->s->picnum == TILE_APLAYER && a2->GetOwner()) if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].posz += l; - if (a2->s.zvel == 0 && a2->s.statnum != STAT_EFFECTOR && (!choosedir || a2->s.statnum != STAT_PROJECTILE)) + if (a2->s->zvel == 0 && a2->s->statnum != STAT_EFFECTOR && (!choosedir || a2->s->statnum != STAT_PROJECTILE)) { - a2->s.z += l; + a2->s->z += l; a2->floorz = sec->floorz; } } @@ -4928,12 +4928,12 @@ void handle_se31(DDukeActor* actor, bool choosedir) DukeSectIterator it(s->sectnum); while (auto a2 = it.Next()) { - if (a2->s.picnum ==TILE_APLAYER && a2->GetOwner()) + if (a2->s->picnum ==TILE_APLAYER && a2->GetOwner()) if (ps[a2->PlayerIndex()].on_ground == 1) ps[a2->PlayerIndex()].posz -= l; - if (a2->s.zvel == 0 && a2->s.statnum != STAT_EFFECTOR && (!choosedir || a2->s.statnum != STAT_PROJECTILE)) + if (a2->s->zvel == 0 && a2->s->statnum != STAT_EFFECTOR && (!choosedir || a2->s->statnum != STAT_PROJECTILE)) { - a2->s.z -= l; + a2->s->z -= l; a2->floorz = sec->floorz; } } @@ -4950,7 +4950,7 @@ void handle_se31(DDukeActor* actor, bool choosedir) void getglobalz(DDukeActor* actor) { - auto s = &actor->s; + auto s = actor->s; int zr; Collision hz, lz; @@ -4962,9 +4962,9 @@ void getglobalz(DDukeActor* actor) getzrange_ex(s->x, s->y, s->z - (FOURSLEIGHT), s->sectnum, &actor->ceilingz, hz, &actor->floorz, lz, zr, CLIPMASK0); - if( lz.type == kHitSprite && (lz.actor->s.cstat&48) == 0 ) + if( lz.type == kHitSprite && (lz.actor->s->cstat&48) == 0 ) { - if( badguy(lz.actor) && lz.actor->s.pal != 1) + if( badguy(lz.actor) && lz.actor->s->pal != 1) { if( s->statnum != STAT_PROJECTILE) { @@ -4974,14 +4974,14 @@ void getglobalz(DDukeActor* actor) ssp(actor, CLIPMASK0); } } - else if(lz.actor->s.picnum == TILE_APLAYER && badguy(actor) ) + else if(lz.actor->s->picnum == TILE_APLAYER && badguy(actor) ) { actor->aflags |= SFLAG_NOFLOORSHADOW; //actor->dispicnum = -4; // No shadows on actors s->xvel = -256; ssp(actor, CLIPMASK0); } - else if(s->statnum == STAT_PROJECTILE && lz.actor->s.picnum == TILE_APLAYER && actor->GetOwner() == actor) + else if(s->statnum == STAT_PROJECTILE && lz.actor->s->picnum == TILE_APLAYER && actor->GetOwner() == actor) { actor->ceilingz = sector[s->sectnum].ceilingz; actor->floorz = sector[s->sectnum].floorz; @@ -5003,7 +5003,7 @@ void getglobalz(DDukeActor* actor) void makeitfall(DDukeActor* actor) { - auto s = &actor->s; + auto s = actor->s; int c; if( fi.floorspace(s->sectnum) ) @@ -5055,7 +5055,7 @@ void makeitfall(DDukeActor* actor) int dodge(DDukeActor* actor) { - auto s = &actor->s; + auto s = actor->s; int bx, by, mx, my, bxvect, byvect, d; mx = s->x; @@ -5064,7 +5064,7 @@ int dodge(DDukeActor* actor) DukeStatIterator it(STAT_PROJECTILE); while (auto ac = it.Next()) { - auto si = &ac->s; + auto si = ac->s; if (ac->GetOwner() == ac || si->sectnum != s->sectnum) continue; @@ -5095,7 +5095,7 @@ int dodge(DDukeActor* actor) int furthestangle(DDukeActor *actor, int angs) { - auto s = &actor->s; + auto s = actor->s; short j, hitsect, hitwall, furthest_angle, angincs; int hx, hy, hz, d, greatestd; DDukeActor* dd; @@ -5129,7 +5129,7 @@ int furthestangle(DDukeActor *actor, int angs) int furthestcanseepoint(DDukeActor *actor, DDukeActor* tosee, int* dax, int* day) { - auto s = &actor->s; + auto s = actor->s; short j, hitsect, hitwall, angincs; int hx, hy, hz, d, da;//, d, cd, ca,tempx,tempy,cx,cy; DDukeActor* dd; @@ -5140,7 +5140,7 @@ int furthestcanseepoint(DDukeActor *actor, DDukeActor* tosee, int* dax, int* day angincs = 2048 / 2; else angincs = 2048 / (1 + (krand() & 1)); - auto ts = &tosee->s; + auto ts = tosee->s; for (j = ts->ang; j < (2048 + ts->ang); j += (angincs - (krand() & 511))) { hitscan(ts->x, ts->y, ts->z - (16 << 8), ts->sectnum, bcos(j), bsin(j), 16384 - (krand() & 32767), @@ -5168,7 +5168,7 @@ int furthestcanseepoint(DDukeActor *actor, DDukeActor* tosee, int* dax, int* day void alterang(int ang, DDukeActor* actor, int playernum) { - auto s = &actor->s; + auto s = actor->s; short aang, angdif, goalang, j; int ticselapsed; int* t = actor->temp_data; @@ -5190,15 +5190,15 @@ void alterang(int ang, DDukeActor* actor, int playernum) // NOTE: looks like 'Owner' is set to target sprite ID... - if (holoduke && cansee(holoduke->s.x, holoduke->s.y, holoduke->s.z, holoduke->s.sectnum, s->x, s->y, s->z, s->sectnum)) + if (holoduke && cansee(holoduke->s->x, holoduke->s->y, holoduke->s->z, holoduke->s->sectnum, s->x, s->y, s->z, s->sectnum)) actor->SetOwner(holoduke); else actor->SetOwner(ps[playernum].GetActor()); auto Owner = actor->GetOwner(); - if (Owner->s.picnum == TILE_APLAYER) + if (Owner->s->picnum == TILE_APLAYER) goalang = getangle(actor->lastvx - s->x, actor->lastvy - s->y); else - goalang = getangle(Owner->s.x - s->x, Owner->s.y - s->y); + goalang = getangle(Owner->s->x - s->x, Owner->s->y - s->y); if (s->xvel && s->picnum != TILE_DRONE) { @@ -5249,7 +5249,7 @@ void alterang(int ang, DDukeActor* actor, int playernum) void fall_common(DDukeActor *actor, int playernum, int JIBS6, int DRONE, int BLOODPOOL, int SHOTSPARK1, int squished, int thud, int(*fallspecial)(DDukeActor*, int)) { - auto s = &actor->s; + auto s = actor->s; s->xoffset = 0; s->yoffset = 0; // if(!gotz) @@ -5343,7 +5343,7 @@ DDukeActor *LocateTheLocator(int n, int sectnum) DukeStatIterator it(STAT_LOCATOR); while (auto ac = it.Next()) { - if ((sectnum == -1 || sectnum == ac->s.sectnum) && n == ac->s.lotag) + if ((sectnum == -1 || sectnum == ac->s->sectnum) && n == ac->s->lotag) return ac; } return nullptr; @@ -5362,7 +5362,7 @@ void recordoldspritepos() DukeStatIterator it(statNum); while (auto ac = it.Next()) { - ac->s.backuploc(); + ac->s->backuploc(); } } } diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 308866bd8..10ad5dee0 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -146,7 +146,7 @@ bool floorspace_d(int sectnum) void check_fta_sounds_d(DDukeActor* actor) { - if (actor->s.extra > 0) switch (actor->s.picnum) + if (actor->s->extra > 0) switch (actor->s->picnum) { case LIZTROOPONTOILET: case LIZTROOPJUSTSIT: @@ -188,18 +188,18 @@ void check_fta_sounds_d(DDukeActor* actor) S_PlaySound(BOS1_RECOG); break; case BOSS2: - if (actor->s.pal == 1) + if (actor->s->pal == 1) S_PlaySound(BOS2_RECOG); else S_PlaySound(WHIPYOURASS); break; case BOSS3: - if (actor->s.pal == 1) + if (actor->s->pal == 1) S_PlaySound(BOS3_RECOG); else S_PlaySound(RIPHEADNECK); break; case BOSS4: case BOSS4STAYPUT: - if (actor->s.pal == 1) + if (actor->s->pal == 1) S_PlaySound(BOS4_RECOG); S_PlaySound(BOSS4_FIRSTSEE); break; @@ -295,7 +295,7 @@ bool ifsquished(DDukeActor* actor, int p) { if (isRR()) return false; // this function is a no-op in RR's source. - auto spri = &actor->s; + auto spri = actor->s; bool squishme = false; if (spri->picnum == APLAYER && ud.clipping) return false; @@ -345,7 +345,7 @@ void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h 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. - auto spri = &actor->s; + auto spri = actor->s; if(spri->picnum == RPG && spri->xrepeat < 11) goto SKIPWALLCHECK; @@ -403,15 +403,15 @@ SKIPWALLCHECK: DukeStatIterator itj(statlist[x]); while (auto act2 = itj.Next()) { - auto spri2 = &act2->s; + auto spri2 = act2->s; if (isWorldTour() && Owner) { - if (Owner->s.picnum == APLAYER && spri2->picnum == APLAYER && ud.coop != 0 && ud.ffire == 0 && Owner != act2) + if (Owner->s->picnum == APLAYER && spri2->picnum == APLAYER && ud.coop != 0 && ud.ffire == 0 && Owner != act2) { continue; } - if (spri->picnum == FLAMETHROWERFLAME && ((Owner->s.picnum == FIREFLY && spri2->picnum == FIREFLY) || (Owner->s.picnum == BOSS5 && spri2->picnum == BOSS5))) + if (spri->picnum == FLAMETHROWERFLAME && ((Owner->s->picnum == FIREFLY && spri2->picnum == FIREFLY) || (Owner->s->picnum == BOSS5 && spri2->picnum == BOSS5))) { continue; } @@ -458,7 +458,7 @@ SKIPWALLCHECK: { if (spri->picnum == SHRINKSPARK || spri->picnum == FLAMETHROWERFLAME) act2->picnum = spri->picnum; - else if (spri->picnum != FIREBALL || !Owner || Owner->s.picnum != APLAYER) + else if (spri->picnum != FIREBALL || !Owner || Owner->s->picnum != APLAYER) { if (spri->picnum == LAVAPOOL) act2->picnum = FLAMETHROWERFLAME; @@ -504,13 +504,13 @@ SKIPWALLCHECK: } else if (spri->extra == 0) act2->extra = 0; - if (spri2->picnum != RADIUSEXPLOSION && Owner && Owner->s.statnum < MAXSTATUS) + if (spri2->picnum != RADIUSEXPLOSION && Owner && Owner->s->statnum < MAXSTATUS) { if (spri2->picnum == APLAYER) { p = spri2->yvel; - if (isWorldTour() && act2->picnum == FLAMETHROWERFLAME && Owner->s.picnum == APLAYER) + if (isWorldTour() && act2->picnum == FLAMETHROWERFLAME && Owner->s->picnum == APLAYER) { ps[p].numloogs = -1 - spri->yvel; } @@ -540,7 +540,7 @@ int movesprite_ex_d(DDukeActor* actor, int xchange, int ychange, int zchange, un int daz, h, oldx, oldy; short retval, dasectnum, cd; - auto spri = &actor->s; + auto spri = actor->s; int bg = badguy(actor); if (spri->statnum == 5 || (bg && spri->xrepeat < 4)) @@ -649,7 +649,7 @@ void lotsofpaper_d(DDukeActor *actor, short n) void guts_d(DDukeActor* actor, short gtype, short n, short p) { - auto s = &actor->s; + auto s = actor->s; int gutz, floorz; int i=0, j; int sx, sy; @@ -685,13 +685,13 @@ void guts_d(DDukeActor* actor, short gtype, short n, short p) int r5 = krand(); // TRANSITIONAL: owned by a player??? auto spawned = EGS(s->sectnum, s->x + (r5 & 255) - 128, s->y + (r4 & 255) - 128, gutz - (r3 & 8191), gtype, -32, sx, sy, a, 48 + (r2 & 31), -512 - (r1 & 2047), ps[p].GetActor(), 5); - if (spawned->s.picnum == JIBS2) + if (spawned->s->picnum == JIBS2) { - spawned->s.xrepeat >>= 2; - spawned->s.yrepeat >>= 2; + spawned->s->xrepeat >>= 2; + spawned->s->yrepeat >>= 2; } if (pal != 0) - spawned->s.pal = pal; + spawned->s->pal = pal; } } @@ -711,13 +711,13 @@ void movefta_d(void) while (auto act = iti.Next()) { - auto s = &act->s; + auto s = act->s; p = findplayer(act, &x); ssect = psect = s->sectnum; auto pa = ps[p].GetActor(); - if (pa->s.extra > 0) + if (pa->s->extra > 0) { if (x < 30000) { @@ -807,7 +807,7 @@ DDukeActor* ifhitsectors_d(int sectnum) DukeStatIterator it(STAT_MISC); while (auto a1 = it.Next()) { - if (a1->s.picnum == EXPLOSION2 && sectnum == a1->s.sectnum) + if (a1->s->picnum == EXPLOSION2 && sectnum == a1->s->sectnum) return a1; } return nullptr; @@ -822,7 +822,7 @@ DDukeActor* ifhitsectors_d(int sectnum) int ifhitbyweapon_d(DDukeActor *actor) { short p; - auto spri = &actor->s; + auto spri = actor->s; auto hitowner = actor->GetHitOwner(); if (actor->extra >= 0) @@ -836,7 +836,7 @@ int ifhitbyweapon_d(DDukeActor *actor) p = spri->yvel; if (hitowner && - hitowner->s.picnum == APLAYER && + hitowner->s->picnum == APLAYER && ud.coop == 1 && ud.ffire == 0) return -1; @@ -851,7 +851,7 @@ int ifhitbyweapon_d(DDukeActor *actor) ps[p].wackedbyactor = hitowner; - if (hitowner->s.picnum == APLAYER && p != hitowner->PlayerIndex()) + if (hitowner->s->picnum == APLAYER && p != hitowner->PlayerIndex()) { ps[p].frag_ps = hitowner->PlayerIndex(); } @@ -891,7 +891,7 @@ int ifhitbyweapon_d(DDukeActor *actor) spri->extra -= actor->extra; auto Owner = actor->GetOwner(); - if (spri->picnum != RECON && Owner && Owner->s.statnum < MAXSTATUS) + if (spri->picnum != RECON && Owner && Owner->s->statnum < MAXSTATUS) actor->SetOwner(hitowner); } @@ -918,7 +918,7 @@ int ifhitbyweapon_d(DDukeActor *actor) spri->extra = 0; ps[p].wackedbyactor = hitowner; - if (hitowner->s.picnum == APLAYER && hitowner != ps[p].GetActor()) + if (hitowner->s->picnum == APLAYER && hitowner != ps[p].GetActor()) ps[p].frag_ps = hitowner->PlayerIndex(); // set the proper player index here - this previously set the sprite index... actor->SetHitOwner(ps[p].GetActor()); @@ -943,7 +943,7 @@ void movefallers_d(void) DukeStatIterator iti(STAT_FALLER); while (auto act = iti.Next()) { - auto s = &act->s; + auto s = act->s; sect = s->sectnum; if (act->temp_data[0] == 0) @@ -962,12 +962,12 @@ void movefallers_d(void) DukeStatIterator itj(STAT_FALLER); while (auto a2 = itj.Next()) { - if (a2->s.hitag == s->hitag) + if (a2->s->hitag == s->hitag) { a2->temp_data[0] = 1; - a2->s.cstat &= (65535 - 64); - if (a2->s.picnum == CEILINGSTEAM || a2->s.picnum == STEAM) - a2->s.cstat |= 32768; + a2->s->cstat &= (65535 - 64); + if (a2->s->picnum == CEILINGSTEAM || a2->s->picnum == STEAM) + a2->s->cstat |= 32768; } } } @@ -1042,7 +1042,7 @@ void movefallers_d(void) static void movetripbomb(DDukeActor *actor) { - auto s = &actor->s; + auto s = actor->s; int j, x; int lTripBombControl = GetGameVar("TRIPBOMB_CONTROL", TRIPBOMB_TRIPWIRE, nullptr, -1); if (lTripBombControl & TRIPBOMB_TIMER) @@ -1069,15 +1069,15 @@ static void movetripbomb(DDukeActor *actor) fi.hitradius(actor, gs.tripbombblastradius, x >> 2, x >> 1, x - (x >> 2), x); auto spawned = spawn(actor, EXPLOSION2); - spawned->s.ang = s->ang; - spawned->s.xvel = 348; + spawned->s->ang = s->ang; + spawned->s->xvel = 348; ssp(spawned, CLIPMASK0); DukeStatIterator it(STAT_MISC); while (auto a1 = it.Next()) { - if (a1->s.picnum == LASERLINE && s->hitag == a1->s.hitag) - a1->s.xrepeat = a1->s.yrepeat = 0; + if (a1->s->picnum == LASERLINE && s->hitag == a1->s->hitag) + a1->s->xrepeat = a1->s->yrepeat = 0; } deletesprite(actor); } @@ -1135,13 +1135,13 @@ static void movetripbomb(DDukeActor *actor) while (x > 0) { auto spawned = spawn(actor, LASERLINE); - setsprite(spawned, spawned->s.pos); - spawned->s.hitag = s->hitag; - spawned->temp_data[1] = spawned->s.z; + setsprite(spawned, spawned->s->pos); + spawned->s->hitag = s->hitag; + spawned->temp_data[1] = spawned->s->z; if (x < 1024) { - spawned->s.xrepeat = x >> 5; + spawned->s->xrepeat = x >> 5; break; } x -= 1024; @@ -1206,7 +1206,7 @@ static void movetripbomb(DDukeActor *actor) static void movecrack(DDukeActor* actor) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; if (s->hitag > 0) { @@ -1218,9 +1218,9 @@ static void movecrack(DDukeActor* actor) DukeStatIterator it(STAT_STANDABLE); while (auto a1 = it.Next()) { - if (s->hitag == a1->s.hitag && (a1->s.picnum == OOZFILTER || a1->s.picnum == SEENINE)) - if (a1->s.shade != -32) - a1->s.shade = -32; + if (s->hitag == a1->s->hitag && (a1->s->picnum == OOZFILTER || a1->s->picnum == SEENINE)) + if (a1->s->shade != -32) + a1->s->shade = -32; } detonate(actor, EXPLOSION2); } @@ -1248,25 +1248,25 @@ static void movefireext(DDukeActor* actor) for (int k = 0; k < 16; k++) { - auto spawned = EGS(actor->s.sectnum, actor->s.x, actor->s.y, actor->s.z - (krand() % (48 << 8)), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (actor->s.zvel >> 2), actor, 5); - spawned->s.pal = 2; + auto spawned = EGS(actor->s->sectnum, actor->s->x, actor->s->y, actor->s->z - (krand() % (48 << 8)), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (actor->s->zvel >> 2), actor, 5); + spawned->s->pal = 2; } spawn(actor, EXPLOSION2); S_PlayActorSound(PIPEBOMB_EXPLODE, actor); S_PlayActorSound(GLASS_HEAVYBREAK, actor); - if (actor->s.hitag > 0) + if (actor->s->hitag > 0) { DukeStatIterator it(STAT_STANDABLE); while (auto a1 = it.Next()) { - if (actor->s.hitag == a1->s.hitag && (a1->s.picnum == OOZFILTER || a1->s.picnum == SEENINE)) - if (a1->s.shade != -32) - a1->s.shade = -32; + if (actor->s->hitag == a1->s->hitag && (a1->s->picnum == OOZFILTER || a1->s->picnum == SEENINE)) + if (a1->s->shade != -32) + a1->s->shade = -32; } - int x = actor->s.extra; + int x = actor->s->extra; spawn(actor, EXPLOSION2); fi.hitradius(actor, gs.pipebombblastradius, x >> 2, x - (x >> 1), x - (x >> 2), x); S_PlayActorSound(PIPEBOMB_EXPLODE, actor); @@ -1288,7 +1288,7 @@ static void movefireext(DDukeActor* actor) static void moveviewscreen(DDukeActor* actor) { const int VIEWSCR_DIST = 8192; // was originally 2048, was increased to this by EDuke32 and RedNukem. - if (actor->s.xrepeat == 0) deletesprite(actor); + if (actor->s->xrepeat == 0) deletesprite(actor); else { int x; @@ -1298,7 +1298,7 @@ static void moveviewscreen(DDukeActor* actor) if (x >= VIEWSCR_DIST && camsprite == actor) { camsprite = nullptr; - actor->s.yvel = 0; + actor->s->yvel = 0; actor->temp_data[0] = 0; } } @@ -1312,7 +1312,7 @@ static void moveviewscreen(DDukeActor* actor) static void movesidebolt(DDukeActor* actor) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; int x; int sect = s->sectnum; @@ -1355,7 +1355,7 @@ CLEAR_THE_BOLT2: static void movebolt(DDukeActor *actor) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; int x; int sect = s->sectnum; @@ -1422,9 +1422,9 @@ void movestandables_d(void) DukeStatIterator it(STAT_STANDABLE); while (auto act = it.Next()) { - int picnum = act->s.picnum; + int picnum = act->s->picnum; - if (act->s.sectnum < 0) + if (act->s->sectnum < 0) { deletesprite(act); continue; @@ -1542,7 +1542,7 @@ void movestandables_d(void) static bool movefireball(DDukeActor* actor) { - auto s = &actor->s; + auto s = actor->s; auto Owner = actor->GetOwner(); if (sector[s->sectnum].lotag == 2) @@ -1551,7 +1551,7 @@ static bool movefireball(DDukeActor* actor) return true; } - if (!Owner || Owner->s.picnum != FIREBALL) + if (!Owner || Owner->s->picnum != FIREBALL) { if (actor->temp_data[0] >= 1 && actor->temp_data[0] < 6) { @@ -1559,7 +1559,7 @@ static bool movefireball(DDukeActor* actor) // This still needs work- it stores an actor reference in a general purpose integer field. int trail = actor->temp_data[1]; auto ball = spawn(actor, FIREBALL); - auto spr = &ball->s; + auto spr = ball->s; actor->temp_data[1] = ball->GetIndex(); spr->xvel = s->xvel; @@ -1602,14 +1602,14 @@ static bool movefireball(DDukeActor* actor) static bool weaponhitsprite(DDukeActor* proj, DDukeActor *targ, bool fireball) { - auto s = &proj->s; - if (s->picnum == FREEZEBLAST && targ->s.pal == 1) - if (badguy(targ) || targ->s.picnum == APLAYER) + auto s = proj->s; + if (s->picnum == FREEZEBLAST && targ->s->pal == 1) + if (badguy(targ) || targ->s->picnum == APLAYER) { auto spawned = spawn(targ, TRANSPORTERSTAR); - spawned->s.pal = 1; - spawned->s.xrepeat = 32; - spawned->s.yrepeat = 32; + spawned->s->pal = 1; + spawned->s->xrepeat = 32; + spawned->s->yrepeat = 32; deletesprite(proj); return true; @@ -1618,12 +1618,12 @@ static bool weaponhitsprite(DDukeActor* proj, DDukeActor *targ, bool fireball) if (!isWorldTour() || s->picnum != FIREBALL || fireball) fi.checkhitsprite(targ, proj); - if (targ->s.picnum == APLAYER) + if (targ->s->picnum == APLAYER) { - int p = targ->s.yvel; + int p = targ->s->yvel; auto Owner = proj->GetOwner(); - if (ud.multimode >= 2 && fireball && Owner && Owner->s.picnum == APLAYER) + if (ud.multimode >= 2 && fireball && Owner && Owner->s->picnum == APLAYER) { ps[p].numloogs = -1 - s->yvel; } @@ -1662,7 +1662,7 @@ static bool weaponhitsprite(DDukeActor* proj, DDukeActor *targ, bool fireball) static bool weaponhitwall(DDukeActor *proj, int j, const vec3_t &oldpos) { - auto s = &proj->s; + auto s = proj->s; if (s->picnum != RPG && s->picnum != FREEZEBLAST && s->picnum != SPIT && (!isWorldTour() || s->picnum != FIREBALL) && (wall[j].overpicnum == MIRROR || wall[j].picnum == MIRROR)) @@ -1706,7 +1706,7 @@ static bool weaponhitwall(DDukeActor *proj, int j, const vec3_t &oldpos) static bool weaponhitsector(DDukeActor* proj, const vec3_t& oldpos, bool fireball) { - auto s = &proj->s; + auto s = proj->s; setsprite(proj, oldpos); if (s->zvel < 0) @@ -1725,7 +1725,7 @@ static bool weaponhitsector(DDukeActor* proj, const vec3_t& oldpos, bool firebal auto spawned = spawn(proj, LAVAPOOL); spawned->SetOwner(proj); spawned->SetHitOwner(proj); - spawned->s.yvel = s->yvel; + spawned->s->yvel = s->yvel; deletesprite(proj); return true; } @@ -1753,7 +1753,7 @@ static bool weaponhitsector(DDukeActor* proj, const vec3_t& oldpos, bool firebal static void weaponcommon_d(DDukeActor* proj) { - auto s = &proj->s; + auto s = proj->s; if (s->picnum == COOLEXPLOSION1) if (!S_CheckActorSoundPlaying(proj, WIERDSHOT_FLY)) S_PlayActorSound(WIERDSHOT_FLY, proj); @@ -1781,7 +1781,7 @@ static void weaponcommon_d(DDukeActor* proj) if (proj->picnum != BOSS2 && s->xrepeat >= 10 && sector[s->sectnum].lotag != 2) { auto spawned = spawn(proj, SMALLSMOKE); - spawned->s.z += (1 << 8); + spawned->s->z += (1 << 8); } break; @@ -1796,7 +1796,7 @@ static void weaponcommon_d(DDukeActor* proj) MulScale(k, bsin(s->ang), 14), ll, CLIPMASK1, coll); if (s->picnum == RPG && proj->temp_actor != nullptr) - if (FindDistance2D(s->x - proj->temp_actor->s.x, s->y - proj->temp_actor->s.y) < 256) + if (FindDistance2D(s->x - proj->temp_actor->s->x, s->y - proj->temp_actor->s->y) < 256) coll.setSprite(proj->temp_actor); if (s->sectnum < 0) @@ -1832,8 +1832,8 @@ static void weaponcommon_d(DDukeActor* proj) s->z + ((k * Sgn(s->zvel)) * abs(s->zvel / 24)), FIRELASER, -40 + (k << 2), s->xrepeat, s->yrepeat, 0, 0, 0, proj->GetOwner(), 5); - spawned->s.cstat = 128; - spawned->s.pal = s->pal; + spawned->s->cstat = 128; + spawned->s->pal = s->pal; } } else if (s->picnum == SPIT) if (s->zvel < 6144) @@ -1843,7 +1843,7 @@ static void weaponcommon_d(DDukeActor* proj) { if (s->picnum == COOLEXPLOSION1) { - if (coll.type == kHitSprite && coll.actor->s.picnum != APLAYER) + if (coll.type == kHitSprite && coll.actor->s->picnum != APLAYER) { return; } @@ -1851,7 +1851,7 @@ static void weaponcommon_d(DDukeActor* proj) s->zvel = 0; } - bool fireball = (isWorldTour() && s->picnum == FIREBALL && (!proj->GetOwner() || proj->GetOwner()->s.picnum != FIREBALL)); + bool fireball = (isWorldTour() && s->picnum == FIREBALL && (!proj->GetOwner() || proj->GetOwner()->s->picnum != FIREBALL)); if (coll.type == kHitSprite) { @@ -1882,19 +1882,19 @@ static void weaponcommon_d(DDukeActor* proj) else if (s->picnum != COOLEXPLOSION1 && s->picnum != FREEZEBLAST && s->picnum != FIRELASER && (!isWorldTour() || s->picnum != FIREBALL)) { auto k = spawn(proj, EXPLOSION2); - k->s.xrepeat = k->s.yrepeat = s->xrepeat >> 1; + k->s->xrepeat = k->s->yrepeat = s->xrepeat >> 1; if (coll.type == kHitSector) { if (s->zvel < 0) { - k->s.cstat |= 8; k->s.z += (72 << 8); + k->s->cstat |= 8; k->s->z += (72 << 8); } } } if (fireball) { auto spawned = spawn(proj, EXPLOSION2); - spawned->s.xrepeat = spawned->s.yrepeat = (short)(s->xrepeat >> 1); + spawned->s->xrepeat = spawned->s->yrepeat = (short)(s->xrepeat >> 1); } } if (s->picnum != COOLEXPLOSION1) @@ -1927,14 +1927,14 @@ void moveweapons_d(void) DukeStatIterator it(STAT_PROJECTILE); while (auto act = it.Next()) { - if (act->s.sectnum < 0) + if (act->s->sectnum < 0) { deletesprite(act); continue; } - switch(act->s.picnum) + switch(act->s->picnum) { case RADIUSEXPLOSION: case KNEE: @@ -1945,18 +1945,18 @@ void moveweapons_d(void) continue; case FREEZEBLAST: - if (act->s.yvel < 1 || act->s.extra < 2 || (act->s.xvel|act->s.zvel) == 0) + if (act->s->yvel < 1 || act->s->extra < 2 || (act->s->xvel|act->s->zvel) == 0) { auto spawned = spawn(act,TRANSPORTERSTAR); - spawned->s.pal = 1; - spawned->s.xrepeat = 32; - spawned->s.yrepeat = 32; + spawned->s->pal = 1; + spawned->s->xrepeat = 32; + spawned->s->yrepeat = 32; deletesprite(act); continue; } case FIREBALL: // Twentieth Anniversary World Tour - if (act->s.picnum == FIREBALL && !isWorldTour()) break; + if (act->s->picnum == FIREBALL && !isWorldTour()) break; case SHRINKSPARK: case RPG: case FIRELASER: @@ -1990,7 +1990,7 @@ void movetransports_d(void) DukeStatIterator iti(STAT_TRANSPORT); while (auto act = iti.Next()) { - auto spr = &act->s; + auto spr = act->s; auto Owner = act->GetOwner(); if (Owner == act) @@ -2007,7 +2007,7 @@ void movetransports_d(void) DukeSectIterator itj(sect); while (auto act2 = itj.Next()) { - auto spr2 = &act2->s; + auto spr2 = act2->s; switch (spr2->statnum) { case STAT_PLAYER: // Player @@ -2029,13 +2029,13 @@ void movetransports_d(void) } for (int k = connecthead; k >= 0; k = connectpoint2[k]) - if (ps[k].cursectnum == Owner->s.sectnum) + if (ps[k].cursectnum == Owner->s->sectnum) { ps[k].frag_ps = p; - ps[k].GetActor()->s.extra = 0; + ps[k].GetActor()->s->extra = 0; } - ps[p].angle.ang = buildang(Owner->s.ang); + ps[p].angle.ang = buildang(Owner->s->ang); if (Owner->GetOwner() != Owner) { @@ -2044,11 +2044,11 @@ void movetransports_d(void) ps[p].transporter_hold = 13; } - ps[p].bobposx = ps[p].oposx = ps[p].posx = Owner->s.x; - ps[p].bobposy = ps[p].oposy = ps[p].posy = Owner->s.y; - ps[p].oposz = ps[p].posz = Owner->s.z - gs.playerheight; + ps[p].bobposx = ps[p].oposx = ps[p].posx = Owner->s->x; + ps[p].bobposy = ps[p].oposy = ps[p].posy = Owner->s->y; + ps[p].oposz = ps[p].posz = Owner->s->z - gs.playerheight; - changespritesect(act2, Owner->s.sectnum); + changespritesect(act2, Owner->s->sectnum); ps[p].cursectnum = spr2->sectnum; if (spr->pal == 0) @@ -2066,19 +2066,19 @@ void movetransports_d(void) if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP))) || (ps[p].jetpack_on && PlayerInput(p, SB_CROUCH))) { - ps[p].oposx = ps[p].posx += Owner->s.x - spr->x; - ps[p].oposy = ps[p].posy += Owner->s.y - spr->y; + ps[p].oposx = ps[p].posx += Owner->s->x - spr->x; + ps[p].oposy = ps[p].posy += Owner->s->y - spr->y; if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11)) - ps[p].posz = Owner->s.z - 6144; - else ps[p].posz = Owner->s.z + 6144; + ps[p].posz = Owner->s->z - 6144; + else ps[p].posz = Owner->s->z + 6144; ps[p].oposz = ps[p].posz; auto pa = ps[p].GetActor(); - pa->s.opos = ps[p].pos; + pa->s->opos = ps[p].pos; - changespritesect(act2, Owner->s.sectnum); - ps[p].cursectnum = Owner->s.sectnum; + changespritesect(act2, Owner->s->sectnum); + ps[p].cursectnum = Owner->s->sectnum; break; } @@ -2093,10 +2093,10 @@ void movetransports_d(void) { FX_StopAllSounds(); } - if (ps[p].GetActor()->s.extra > 0) + if (ps[p].GetActor()->s->extra > 0) S_PlayActorSound(DUKE_UNDERWATER, act2); ps[p].oposz = ps[p].posz = - sector[Owner->s.sectnum].ceilingz + (7 << 8); + sector[Owner->s->sectnum].ceilingz + (7 << 8); ps[p].posxv = 4096 - (krand() & 8192); ps[p].posyv = 4096 - (krand() & 8192); @@ -2114,7 +2114,7 @@ void movetransports_d(void) S_PlayActorSound(DUKE_GASP, act2); ps[p].oposz = ps[p].posz = - sector[Owner->s.sectnum].floorz - (7 << 8); + sector[Owner->s->sectnum].floorz - (7 << 8); ps[p].jumping_toggle = 1; ps[p].jumping_counter = 0; @@ -2122,14 +2122,14 @@ void movetransports_d(void) if (k == 1) { - ps[p].oposx = ps[p].posx += Owner->s.x - spr->x; - ps[p].oposy = ps[p].posy += Owner->s.y - spr->y; + ps[p].oposx = ps[p].posx += Owner->s->x - spr->x; + ps[p].oposy = ps[p].posy += Owner->s->y - spr->y; if (!Owner || Owner->GetOwner() != Owner) ps[p].transporter_hold = -2; - ps[p].cursectnum = Owner->s.sectnum; + ps[p].cursectnum = Owner->s->sectnum; - changespritesect(act2, Owner->s.sectnum); + changespritesect(act2, Owner->s->sectnum); setsprite(ps[p].GetActor(), ps[p].posx, ps[p].posy, ps[p].posz + gs.playerheight); if ((krand() & 255) < 32) @@ -2139,7 +2139,7 @@ void movetransports_d(void) for (int l = 0; l < 9; l++) { auto q = spawn(ps[p].GetActor(), WATERBUBBLE); - q->s.z += krand() & 16383; + q->s->z += krand() & 16383; } } } @@ -2220,8 +2220,8 @@ void movetransports_d(void) auto k = spawn(act2, WATERSPLASH2); if (sectlotag == 1 && spr2->statnum == 4) { - k->s.xvel = spr2->xvel >> 1; - k->s.ang = spr2->ang; + k->s->xvel = spr2->xvel >> 1; + k->s->ang = spr2->ang; ssp(k, CLIPMASK0); } } @@ -2231,12 +2231,12 @@ void movetransports_d(void) case 0: if (onfloorz) { - if (spr2->statnum == STAT_PROJECTILE || (checkcursectnums(sect) == -1 && checkcursectnums(Owner->s.sectnum) == -1)) + if (spr2->statnum == STAT_PROJECTILE || (checkcursectnums(sect) == -1 && checkcursectnums(Owner->s->sectnum) == -1)) { - spr2->x += (Owner->s.x - spr->x); - spr2->y += (Owner->s.y - spr->y); - spr2->z -= spr->z - sector[Owner->s.sectnum].floorz; - spr2->ang = Owner->s.ang; + spr2->x += (Owner->s->x - spr->x); + spr2->y += (Owner->s->y - spr->y); + spr2->z -= spr->z - sector[Owner->s->sectnum].floorz; + spr2->ang = Owner->s->ang; spr2->backupang(); @@ -2255,38 +2255,38 @@ void movetransports_d(void) Owner->temp_data[0] = 13; } - changespritesect(act2, Owner->s.sectnum); + changespritesect(act2, Owner->s->sectnum); } } else { - spr2->x += (Owner->s.x - spr->x); - spr2->y += (Owner->s.y - spr->y); - spr2->z = Owner->s.z + 4096; + spr2->x += (Owner->s->x - spr->x); + spr2->y += (Owner->s->y - spr->y); + spr2->z = Owner->s->z + 4096; spr2->backupz(); - changespritesect(act2, Owner->s.sectnum); + changespritesect(act2, Owner->s->sectnum); } break; case 1: - spr2->x += (Owner->s.x - spr->x); - spr2->y += (Owner->s.y - spr->y); - spr2->z = sector[Owner->s.sectnum].ceilingz + ll; + spr2->x += (Owner->s->x - spr->x); + spr2->y += (Owner->s->y - spr->y); + spr2->z = sector[Owner->s->sectnum].ceilingz + ll; spr2->backupz(); - changespritesect(act2, Owner->s.sectnum); + changespritesect(act2, Owner->s->sectnum); break; case 2: - spr2->x += (Owner->s.x - spr->x); - spr2->y += (Owner->s.y - spr->y); - spr2->z = sector[Owner->s.sectnum].floorz - ll; + spr2->x += (Owner->s->x - spr->x); + spr2->y += (Owner->s->y - spr->y); + spr2->z = sector[Owner->s->sectnum].floorz - ll; spr2->backupz(); - changespritesect(act2, Owner->s.sectnum); + changespritesect(act2, Owner->s->sectnum); break; } @@ -2310,7 +2310,7 @@ void movetransports_d(void) static void greenslime(DDukeActor *actor) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; int sect = s->sectnum; int j; @@ -2371,7 +2371,7 @@ static void greenslime(DDukeActor *actor) for (j = 16; j >= 0; j--) { auto k = EGS(s->sectnum, s->x, s->y, s->z, GLASSPIECES + (j % 3), -32, 36, 36, krand() & 2047, 32 + (krand() & 63), 1024 - (krand() & 1023), actor, 5); - k->s.pal = 1; + k->s->pal = 1; } ps[p].actors_killed++; S_PlayActorSound(GLASS_BREAKING, actor); @@ -2393,7 +2393,7 @@ static void greenslime(DDukeActor *actor) if (t[0] == -4) //On the player { - if (ps[p].GetActor()->s.extra < 1) + if (ps[p].GetActor()->s->extra < 1) { t[0] = 0; return; @@ -2403,13 +2403,13 @@ static void greenslime(DDukeActor *actor) s->ang = ps[p].angle.ang.asbuild(); - if ((PlayerInput(p, SB_FIRE) || (ps[p].quick_kick > 0)) && ps[p].GetActor()->s.extra > 0) + if ((PlayerInput(p, SB_FIRE) || (ps[p].quick_kick > 0)) && ps[p].GetActor()->s->extra > 0) if (ps[p].quick_kick > 0 || (ps[p].curr_weapon != HANDREMOTE_WEAPON && ps[p].curr_weapon != HANDBOMB_WEAPON && ps[p].curr_weapon != TRIPBOMB_WEAPON && ps[p].ammo_amount[ps[p].curr_weapon] >= 0)) { for (x = 0; x < 8; x++) { auto j = EGS(sect, s->x, s->y, s->z - (8 << 8), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (s->zvel >> 2), actor, 5); - j->s.pal = 6; + j->s->pal = 6; } S_PlayActorSound(SLIM_DYING, actor); @@ -2417,7 +2417,7 @@ static void greenslime(DDukeActor *actor) if ((krand() & 255) < 32) { auto j = spawn(actor, BLOODPOOL); - j->s.pal = 0; + j->s->pal = 0; } ps[p].actors_killed++; t[0] = -3; @@ -2450,7 +2450,7 @@ static void greenslime(DDukeActor *actor) DukeStatIterator it(STAT_ACTOR); while (auto ac = it.Next()) { - if (ac->s.picnum == CAMERA1) ac->s.yvel = 0; + if (ac->s->picnum == CAMERA1) ac->s->yvel = 0; } } @@ -2463,7 +2463,7 @@ static void greenslime(DDukeActor *actor) if (t[3] == 5) { auto psp = ps[p].GetActor(); - psp->s.extra += -(5 + (krand() & 3)); + psp->s->extra += -(5 + (krand() & 3)); S_PlayActorSound(SLIM_ATTACK, actor); } @@ -2518,13 +2518,13 @@ static void greenslime(DDukeActor *actor) if ((krand() & 255) < 32) { auto j = spawn(actor, BLOODPOOL); - j->s.pal = 0; + j->s->pal = 0; } for (x = 0; x < 8; x++) { auto j = EGS(sect, s->x, s->y, s->z - (8 << 8), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (s->zvel >> 2), actor, 5); - j->s.pal = 6; + j->s->pal = 6; } t[0] = -3; deletesprite(actor); @@ -2558,13 +2558,13 @@ static void greenslime(DDukeActor *actor) makeitfall(actor); if (s5) { - s5->s.xvel = 0; + s5->s->xvel = 0; - int l = s5->s.ang; + int l = s5->s->ang; - s->z = s5->s.z; - s->x = s5->s.x + bcos(l, -11); - s->y = s5->s.y + bsin(l, -11); + s->z = s5->s->z; + s->x = s5->s->x + bcos(l, -11); + s->y = s5->s->y + bsin(l, -11); s->picnum = GREENSLIME + 2 + (global_random & 1); @@ -2577,7 +2577,7 @@ static void greenslime(DDukeActor *actor) t[0] = -1; x = ldist(actor, s5); if (x < 768) { - s5->s.xrepeat = 0; + s5->s->xrepeat = 0; } } } @@ -2591,9 +2591,9 @@ static void greenslime(DDukeActor *actor) DukeSectIterator it(sect); while (auto a2 = it.Next()) { - if (gs.actorinfo[a2->s.picnum].flags & SFLAG_GREENSLIMEFOOD) + if (gs.actorinfo[a2->s->picnum].flags & SFLAG_GREENSLIMEFOOD) { - if (ldist(actor, a2) < 768 && (abs(s->z - a2->s.z) < 8192)) //Gulp them + if (ldist(actor, a2) < 768 && (abs(s->z - a2->s->z) < 8192)) //Gulp them { actor->temp_actor = a2; t[0] = -2; @@ -2711,7 +2711,7 @@ static void greenslime(DDukeActor *actor) static void flamethrowerflame(DDukeActor *actor) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; int sect = s->sectnum; int x; @@ -2720,7 +2720,7 @@ static void flamethrowerflame(DDukeActor *actor) t[0]++; if (sector[sect].lotag == 2) { - spawn(actor, EXPLOSION2)->s.shade = 127; + spawn(actor, EXPLOSION2)->s->shade = 127; deletesprite(actor); return; } @@ -2741,7 +2741,7 @@ static void flamethrowerflame(DDukeActor *actor) t[3] = krand() % 10; if (t[0] > 30) { - spawn(actor, EXPLOSION2)->s.shade = 127; + spawn(actor, EXPLOSION2)->s->shade = 127; deletesprite(actor); return; } @@ -2777,7 +2777,7 @@ static void flamethrowerflame(DDukeActor *actor) if (coll.type == kHitSprite) { fi.checkhitsprite(coll.actor, actor); - if (coll.actor->s.picnum == APLAYER) + if (coll.actor->s->picnum == APLAYER) S_PlayActorSound(PISTOL_BODYHIT, coll.actor); } else if (coll.type == kHitWall) @@ -2813,7 +2813,7 @@ static void flamethrowerflame(DDukeActor *actor) static void heavyhbomb(DDukeActor *actor) { - auto s = &actor->s; + auto s = actor->s; auto t = &actor->temp_data[0]; auto Owner = actor->GetOwner(); int sect = s->sectnum; @@ -2895,7 +2895,7 @@ static void heavyhbomb(DDukeActor *actor) goto DETONATEB; } - if ( Owner && Owner->s.picnum == APLAYER) + if ( Owner && Owner->s->picnum == APLAYER) l = Owner->PlayerIndex(); else l = -1; @@ -3000,7 +3000,7 @@ DETONATEB: if (ps[p].gotweapon[HANDBOMB_WEAPON] == 0 || Owner == ps[p].GetActor()) fi.addweapon(&ps[p], HANDBOMB_WEAPON); - if (!Owner || Owner->s.picnum != APLAYER) + if (!Owner || Owner->s->picnum != APLAYER) { SetPlayerPal(&ps[p], PalEntry(32, 0, 32, 0)); } @@ -3039,7 +3039,7 @@ void moveactors_d(void) DukeStatIterator it(STAT_ACTOR); while (auto act = it.Next()) { - auto s = &act->s; + auto s = act->s; sect = s->sectnum; if (s->xrepeat == 0 || sect < 0 || sect >= MAXSECTORS) @@ -3080,11 +3080,11 @@ void moveactors_d(void) DukeStatIterator it(STAT_ACTOR); while (auto act2 = it.Next()) { - if (act2->s.lotag == s->lotag && - act2->s.picnum == s->picnum) + if (act2->s->lotag == s->lotag && + act2->s->picnum == s->picnum) { - if ((act2->s.hitag && !(act2->s.cstat & 32)) || - (!act2->s.hitag && (act2->s.cstat & 32)) + if ((act2->s->hitag && !(act2->s->cstat & 32)) || + (!act2->s->hitag && (act2->s->cstat & 32)) ) { k = 0; @@ -3216,19 +3216,19 @@ static void fireflyflyingeffect(DDukeActor *actor) execute(actor, p, x); auto Owner = actor->GetOwner(); - if (!Owner || Owner->s.picnum != FIREFLY) + if (!Owner || Owner->s->picnum != FIREFLY) { deletesprite(actor); return; } - if (Owner->s.xrepeat >= 24 || Owner->s.pal == 1) - actor->s.cstat |= 0x8000; + if (Owner->s->xrepeat >= 24 || Owner->s->pal == 1) + actor->s->cstat |= 0x8000; else - actor->s.cstat &= ~0x8000; + actor->s->cstat &= ~0x8000; - double dx = Owner->s.x - ps[p].GetActor()->s.x; - double dy = Owner->s.y - ps[p].GetActor()->s.y; + double dx = Owner->s->x - ps[p].GetActor()->s->x; + double dy = Owner->s->y - ps[p].GetActor()->s->y; double dist = sqrt(dx * dx + dy * dy); if (dist != 0.0) { @@ -3236,11 +3236,11 @@ static void fireflyflyingeffect(DDukeActor *actor) dy /= dist; } - actor->s.x = (int) (Owner->s.x - (dx * -10.0)); - actor->s.y = (int) (Owner->s.y - (dy * -10.0)); - actor->s.z = Owner->s.z + 2048; + actor->s->x = (int) (Owner->s->x - (dx * -10.0)); + actor->s->y = (int) (Owner->s->y - (dy * -10.0)); + actor->s->z = Owner->s->z + 2048; - if (Owner->s.extra <= 0) + if (Owner->s->extra <= 0) { deletesprite(actor); } @@ -3260,7 +3260,7 @@ void moveexplosions_d(void) // STATNUM 5 DukeStatIterator it(STAT_MISC); while (auto act = it.Next()) { - auto s = &act->s; + auto s = act->s; int* t = &act->temp_data[0]; sect = s->sectnum; @@ -3336,7 +3336,7 @@ void moveexplosions_d(void) // STATNUM 5 if (x < 512) { SetPlayerPal(&ps[p], PalEntry(32, 32, 0, 0)); - ps[p].GetActor()->s.extra -= 4; + ps[p].GetActor()->s->extra -= 4; } case FIRELASER: @@ -3439,7 +3439,7 @@ void moveexplosions_d(void) // STATNUM 5 void handle_se06_d(DDukeActor* actor) { - auto s = &actor->s; + auto s = actor->s; auto t = &actor->temp_data[0]; auto sc = §or[s->sectnum]; @@ -3468,15 +3468,15 @@ 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])) { - act2->s.xvel = s->xvel; + act2->s->xvel = s->xvel; //if( t[4] == 1 ) { if (act2->temp_data[5] == 0) act2->temp_data[5] = dist(act2, actor); int x = Sgn(dist(act2, actor) - act2->temp_data[5]); - if (act2->s.extra) + if (act2->s->extra) x = -x; s->xvel += x; } @@ -3495,7 +3495,7 @@ void handle_se06_d(DDukeActor* actor) static void handle_se28(DDukeActor* actor) { - auto s = &actor->s; + auto s = actor->s; auto sc = §or[s->sectnum]; int st = s->lotag; int sh = s->hitag; @@ -3535,8 +3535,8 @@ static void handle_se28(DDukeActor* actor) DukeStatIterator it(STAT_DEFAULT); while (auto act2 = it.Next()) { - if (act2->s.picnum == NATURALLIGHTNING && act2->s.hitag == s->hitag) - act2->s.cstat |= 32768; + if (act2->s->picnum == NATURALLIGHTNING && act2->s->hitag == s->hitag) + act2->s->cstat |= 32768; } } else if (t[2] > (t[1] >> 3) && t[2] < (t[1] >> 2)) @@ -3552,11 +3552,11 @@ static void handle_se28(DDukeActor* actor) DukeStatIterator it(STAT_DEFAULT); while (auto act2 = it.Next()) { - if (act2->s.picnum == NATURALLIGHTNING && act2->s.hitag == s->hitag) + if (act2->s->picnum == NATURALLIGHTNING && act2->s->hitag == s->hitag) { if (rnd(32) && (t[2] & 1)) { - act2->s.cstat &= 32767; + act2->s->cstat &= 32767; spawn(act2, SMALLSMOKE); int x; @@ -3568,12 +3568,12 @@ static void handle_se28(DDukeActor* actor) if (S_CheckActorSoundPlaying(psa, DUKE_LONGTERM_PAIN) < 1) S_PlayActorSound(DUKE_LONGTERM_PAIN, psa); S_PlayActorSound(SHORT_CIRCUIT, psa); - psa->s.extra -= 8 + (krand() & 7); + psa->s->extra -= 8 + (krand() & 7); SetPlayerPal(&ps[p], PalEntry(32, 16, 0, 0)); } return; } - else act2->s.cstat |= 32768; + else act2->s->cstat |= 32768; } } } @@ -3595,8 +3595,8 @@ void moveeffectors_d(void) //STATNUM 3 DukeStatIterator it(STAT_EFFECTOR); while (auto act = it.Next()) { - auto sc = §or[act->s.sectnum]; - switch (act->s.lotag) + auto sc = §or[act->s->sectnum]; + switch (act->s->lotag) { case SE_0_ROTATING_SECTOR: handle_se00(act, LASERLINE); @@ -3721,9 +3721,9 @@ void moveeffectors_d(void) //STATNUM 3 break; case SE_29_WAVES: - act->s.hitag += 64; - l = MulScale(act->s.yvel, bsin(act->s.hitag), 12); - sc->floorz = act->s.z + l; + act->s->hitag += 64; + l = MulScale(act->s->yvel, bsin(act->s->hitag), 12); + sc->floorz = act->s->z + l; break; case SE_31_FLOOR_RISE_FALL: // True Drop Floor handle_se31(act, true); @@ -3766,11 +3766,11 @@ void moveeffectors_d(void) //STATNUM 3 it.Reset(STAT_EFFECTOR); while (auto act = it.Next()) { - if (act->s.lotag != SE_29_WAVES) continue; - auto sc = §or[act->s.sectnum]; + if (act->s->lotag != SE_29_WAVES) continue; + auto sc = §or[act->s->sectnum]; if (sc->wallnum != 4) continue; auto wal = &wall[sc->wallptr + 2]; - alignflorslope(act->s.sectnum, wal->x, wal->y, sector[wal->nextsector].floorz); + alignflorslope(act->s->sectnum, wal->x, wal->y, sector[wal->nextsector].floorz); } } @@ -3782,7 +3782,7 @@ void moveeffectors_d(void) //STATNUM 3 void move_d(DDukeActor *actor, int playernum, int xvel) { - auto spr = &actor->s; + auto spr = actor->s; auto t = actor->temp_data; int l; short goalang, angdif; @@ -3998,7 +3998,7 @@ bool spawnweapondebris_d(int picnum, int dnum) void respawnhitag_d(DDukeActor* actor) { - switch (actor->s.picnum) + switch (actor->s->picnum) { case FEM1: case FEM2: @@ -4013,19 +4013,19 @@ void respawnhitag_d(DDukeActor* actor) case PODFEM1: case NAKED1: case STATUE: - if (actor->s.yvel) fi.operaterespawns(actor->s.yvel); + if (actor->s->yvel) fi.operaterespawns(actor->s->yvel); break; default: - if (actor->s.hitag >= 0) fi.operaterespawns(actor->s.hitag); + if (actor->s->hitag >= 0) fi.operaterespawns(actor->s->hitag); break; } } void checktimetosleep_d(DDukeActor *actor) { - if (actor->s.statnum == STAT_STANDABLE) + if (actor->s->statnum == STAT_STANDABLE) { - switch (actor->s.picnum) + switch (actor->s->picnum) { case RUBBERCAN: case EXPLODINGBARREL: diff --git a/source/games/duke/src/actors_lava.cpp b/source/games/duke/src/actors_lava.cpp index dc228c485..ddebf025e 100644 --- a/source/games/duke/src/actors_lava.cpp +++ b/source/games/duke/src/actors_lava.cpp @@ -521,7 +521,7 @@ void moveminecart(void) DukeSectIterator it(csect); while (auto a2 = it.Next()) { - auto sj = &a2->s; + auto sj = a2->s; if (badguy(sj)) setsprite(a2, cx, cy, sj->z); } diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index f4988af0d..8403bb23c 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -94,7 +94,7 @@ bool floorspace_r(int sectnum) void check_fta_sounds_r(DDukeActor* actor) { - if (actor->s.extra > 0) switch (actor->s.picnum) + if (actor->s->extra > 0) switch (actor->s->picnum) { case COOT: // LIZTROOP if (!isRRRA() && (krand() & 3) == 2) @@ -223,7 +223,7 @@ void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int h 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. - auto spri = &actor->s; + auto spri = actor->s; if (spri->xrepeat < 11) { @@ -281,7 +281,7 @@ SKIPWALLCHECK: DukeStatIterator it1(statlist[x]); while (auto act2 = it1.Next()) { - auto spri2 = &act2->s; + auto spri2 = act2->s; if (x == 0 || x >= 5 || AFLAMABLE(spri2->picnum)) { if (spri2->cstat & 257) @@ -355,7 +355,7 @@ SKIPWALLCHECK: fi.checkhitsprite(act2, actor); if (spri2->picnum != RADIUSEXPLOSION && - Owner && Owner->s.statnum < MAXSTATUS) + Owner && Owner->s->statnum < MAXSTATUS) { if (spri2->picnum == APLAYER) { @@ -383,7 +383,7 @@ int movesprite_ex_r(DDukeActor* actor, int xchange, int ychange, int zchange, un { int daz, h, oldx, oldy; short retval, dasectnum, cd; - auto spri = &actor->s; + auto spri = actor->s; int bg = badguy(actor); if (spri->statnum == 5 || (bg && spri->xrepeat < 4)) @@ -471,7 +471,7 @@ void lotsoffeathers_r(DDukeActor *actor, short n) void guts_r(DDukeActor* actor, short gtype, short n, short p) { - auto s = &actor->s; + auto s = actor->s; int gutz, floorz; int i=0, j; int sx, sy; @@ -512,7 +512,7 @@ void guts_r(DDukeActor* actor, short gtype, short n, short p) // TRANSITIONAL: owned by a player??? auto spawned = EGS(s->sectnum, s->x + (r5 & 255) - 128, s->y + (r4 & 255) - 128, gutz - (r3 & 8191), gtype, -32, sx >> 1, sy >> 1, a, 48 + (r2 & 31), -512 - (r1 & 2047), ps[p].GetActor(), 5); if (pal != 0) - spawned->s.pal = pal; + spawned->s->pal = pal; } } @@ -531,13 +531,13 @@ void movefta_r(void) DukeStatIterator it(STAT_ZOMBIEACTOR); while(auto act = it.Next()) { - auto s = &act->s; + auto s = act->s; p = findplayer(act, &x); j = 0; ssect = psect = s->sectnum; - if (ps[p].GetActor()->s.extra > 0) + if (ps[p].GetActor()->s->extra > 0) { if (x < 30000) { @@ -643,7 +643,7 @@ DDukeActor* ifhitsectors_r(int sectnum) DukeStatIterator it(STAT_MISC); while (auto a1 = it.Next()) { - if (a1->s.picnum == EXPLOSION2 || (a1->s.picnum == EXPLOSION3 && sectnum == a1->s.sectnum)) + if (a1->s->picnum == EXPLOSION2 || (a1->s->picnum == EXPLOSION3 && sectnum == a1->s->sectnum)) return a1; } return nullptr; @@ -659,7 +659,7 @@ int ifhitbyweapon_r(DDukeActor *actor) { int p; auto hitowner = actor->GetHitOwner(); - auto spri = &actor->s; + auto spri = actor->s; if (actor->extra >= 0) { @@ -672,7 +672,7 @@ int ifhitbyweapon_r(DDukeActor *actor) p = actor->PlayerIndex(); if (hitowner && - hitowner->s.picnum == APLAYER && + hitowner->s->picnum == APLAYER && ud.coop == 1 && ud.ffire == 0) return -1; @@ -687,7 +687,7 @@ int ifhitbyweapon_r(DDukeActor *actor) ps[p].wackedbyactor = hitowner; - if (hitowner->s.picnum == APLAYER && p != hitowner->PlayerIndex()) + if (hitowner->s->picnum == APLAYER && p != hitowner->PlayerIndex()) { ps[p].frag_ps = hitowner->PlayerIndex(); } @@ -724,7 +724,7 @@ int ifhitbyweapon_r(DDukeActor *actor) return -1; spri->extra -= actor->extra; - if (spri->picnum != RECON && actor->GetOwner() && actor->GetOwner()->s.statnum < MAXSTATUS) + if (spri->picnum != RECON && actor->GetOwner() && actor->GetOwner()->s->statnum < MAXSTATUS) actor->SetOwner(hitowner); } @@ -745,8 +745,8 @@ int ifhitbyweapon_r(DDukeActor *actor) void respawn_rrra(DDukeActor* oldact, DDukeActor* newact) { - auto newspr = &newact->s; - newspr->pal = oldact->s.pal; + auto newspr = newact->s; + newspr->pal = oldact->s->pal; if (newspr->picnum == MAMA) { if (newspr->pal == 30) @@ -785,7 +785,7 @@ void respawn_rrra(DDukeActor* oldact, DDukeActor* newact) deletesprite(oldact); return; } - oldact->s.extra = (66 - 13); + oldact->s->extra = (66 - 13); newspr->pal = 0; } @@ -800,7 +800,7 @@ void movefallers_r(void) DukeStatIterator it(STAT_FALLER); while (auto act = it.Next()) { - auto s = &act->s; + auto s = act->s; int sect = s->sectnum; if (act->temp_data[0] == 0) @@ -819,12 +819,12 @@ void movefallers_r(void) DukeStatIterator it(STAT_FALLER); while (auto ac2 = it.Next()) { - if (ac2->s.hitag == s->hitag) + if (ac2->s->hitag == s->hitag) { ac2->temp_data[0] = 1; - ac2->s.cstat &= (65535 - 64); - if (ac2->s.picnum == CEILINGSTEAM || ac2->s.picnum == STEAM) - ac2->s.cstat |= 32768; + ac2->s->cstat &= (65535 - 64); + if (ac2->s->picnum == CEILINGSTEAM || ac2->s->picnum == STEAM) + ac2->s->cstat |= 32768; } } } @@ -896,7 +896,7 @@ void movefallers_r(void) static void movecrack(DDukeActor* actor) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; if (s->hitag > 0) { @@ -908,9 +908,9 @@ static void movecrack(DDukeActor* actor) DukeStatIterator it(STAT_STANDABLE); while (auto a1 = it.Next()) { - if (s->hitag == a1->s.hitag && (a1->s.picnum == OOZFILTER || a1->s.picnum == SEENINE)) - if (a1->s.shade != -32) - a1->s.shade = -32; + if (s->hitag == a1->s->hitag && (a1->s->picnum == OOZFILTER || a1->s->picnum == SEENINE)) + if (a1->s->shade != -32) + a1->s->shade = -32; } detonate(actor, EXPLOSION2); } @@ -931,7 +931,7 @@ static void movecrack(DDukeActor* actor) static void movebolt(DDukeActor* actor) { - auto s = &actor->s; + auto s = actor->s; int* t = &actor->temp_data[0]; int x; int sect = s->sectnum; @@ -998,9 +998,9 @@ void movestandables_r(void) DukeStatIterator it(STAT_STANDABLE); while (auto act = it.Next()) { - int picnum = act->s.picnum; + int picnum = act->s->picnum; - if (act->s.sectnum < 0) + if (act->s->sectnum < 0) { deletesprite(act); continue; @@ -1096,12 +1096,12 @@ void movestandables_r(void) static void chickenarrow(DDukeActor* actor) { - auto s = &actor->s; + auto s = actor->s; s->hitag++; if (actor->picnum != BOSS2 && s->xrepeat >= 10 && sector[s->sectnum].lotag != 2) { auto spawned = spawn(actor, SMALLSMOKE); - spawned->s.z += (1 << 8); + spawned->s->z += (1 << 8); if ((krand() & 15) == 2) { spawn(actor, MONEY); @@ -1110,12 +1110,12 @@ static void chickenarrow(DDukeActor* actor) auto ts = actor->seek_actor; if (!ts) return; - if (ts->s.extra <= 0) + if (ts->s->extra <= 0) actor->seek_actor = nullptr; if (actor->seek_actor && s->hitag > 5) { int ang, ang2, ang3; - ang = getangle(ts->s.x - s->x, ts->s.y - s->y); + ang = getangle(ts->s->x - s->x, ts->s->y - s->y); ang2 = ang - s->ang; ang3 = abs(ang2); if (ang2 < 100) @@ -1149,25 +1149,25 @@ static void chickenarrow(DDukeActor* actor) static bool weaponhitsprite(DDukeActor *proj, DDukeActor *targ, const vec3_t &oldpos) { - auto s = &proj->s; + auto s = proj->s; if (isRRRA()) { - if (targ->s.picnum == MINION + if (targ->s->picnum == MINION && (s->picnum == RPG || s->picnum == RPG2) - && targ->s.pal == 19) + && targ->s->pal == 19) { S_PlayActorSound(RPG_EXPLODE, proj); - spawn(proj, EXPLOSION2)->s.pos = oldpos; + spawn(proj, EXPLOSION2)->s->pos = oldpos; return true; } } - else if (s->picnum == FREEZEBLAST && targ->s.pal == 1) - if (badguy(targ) || targ->s.picnum == APLAYER) + else if (s->picnum == FREEZEBLAST && targ->s->pal == 1) + if (badguy(targ) || targ->s->picnum == APLAYER) { auto star = spawn(proj, TRANSPORTERSTAR); - star->s.pal = 1; - star->s.xrepeat = 32; - star->s.yrepeat = 32; + star->s->pal = 1; + star->s->xrepeat = 32; + star->s->yrepeat = 32; deletesprite(proj); return true; @@ -1175,14 +1175,14 @@ static bool weaponhitsprite(DDukeActor *proj, DDukeActor *targ, const vec3_t &ol fi.checkhitsprite(targ, proj); - if (targ->s.picnum == APLAYER) + if (targ->s->picnum == APLAYER) { - int p = targ->s.yvel; + int p = targ->s->yvel; S_PlayActorSound(PISTOL_BODYHIT, targ); if (s->picnum == SPIT) { - if (isRRRA() && proj->GetOwner() && proj->GetOwner()->s.picnum == MAMA) + if (isRRRA() && proj->GetOwner() && proj->GetOwner()->s->picnum == MAMA) { guts_r(proj, RABBITJIBA, 2, myconnectindex); guts_r(proj, RABBITJIBB, 2, myconnectindex); @@ -1219,8 +1219,8 @@ static bool weaponhitsprite(DDukeActor *proj, DDukeActor *targ, const vec3_t &ol static bool weaponhitwall(DDukeActor *proj, int wal, const vec3_t& oldpos) { - auto s = &proj->s; - if (isRRRA() && proj->GetOwner() && proj->GetOwner()->s.picnum == MAMA) + auto s = proj->s; + if (isRRRA() && proj->GetOwner() && proj->GetOwner()->s->picnum == MAMA) { guts_r(proj, RABBITJIBA, 2, myconnectindex); guts_r(proj, RABBITJIBB, 2, myconnectindex); @@ -1271,14 +1271,14 @@ static bool weaponhitwall(DDukeActor *proj, int wal, const vec3_t& oldpos) s->x += bcos(s->ang, -7); s->y += bsin(s->ang, -7); auto Owner = proj->GetOwner(); - if (!isRRRA() || !Owner || (Owner->s.picnum != CHEER && Owner->s.picnum != CHEERSTAYPUT)) + if (!isRRRA() || !Owner || (Owner->s->picnum != CHEER && Owner->s->picnum != CHEERSTAYPUT)) { auto j = spawn(proj, CIRCLESTUCK); - j->s.xrepeat = 8; - j->s.yrepeat = 8; - j->s.cstat = 16; - j->s.ang = (j->s.ang + 512) & 2047; - j->s.clipdist = MulScale(s->xrepeat, tileWidth(s->picnum), 7); + j->s->xrepeat = 8; + j->s->yrepeat = 8; + j->s->cstat = 16; + j->s->ang = (j->s->ang + 512) & 2047; + j->s->clipdist = MulScale(s->xrepeat, tileWidth(s->picnum), 7); } deletesprite(proj); return true; @@ -1308,10 +1308,10 @@ static bool weaponhitwall(DDukeActor *proj, int wal, const vec3_t& oldpos) bool weaponhitsector(DDukeActor *proj, const vec3_t& oldpos) { - auto s = &proj->s; + auto s = proj->s; setsprite(proj, oldpos); - if (isRRRA() && proj->GetOwner() && proj->GetOwner()->s.picnum == MAMA) + if (isRRRA() && proj->GetOwner() && proj->GetOwner()->s->picnum == MAMA) { guts_r(proj, RABBITJIBA, 2, myconnectindex); guts_r(proj, RABBITJIBB, 2, myconnectindex); @@ -1353,7 +1353,7 @@ bool weaponhitsector(DDukeActor *proj, const vec3_t& oldpos) static void weaponcommon_r(DDukeActor *proj) { - auto s = &proj->s; + auto s = proj->s; int k, p; int ll; @@ -1384,7 +1384,7 @@ static void weaponcommon_r(DDukeActor *proj) case RPG: if (proj->picnum != BOSS2 && s->xrepeat >= 10 && sector[s->sectnum].lotag != 2) { - spawn(proj, SMALLSMOKE)->s.z += (1 << 8); + spawn(proj, SMALLSMOKE)->s->z += (1 << 8); } break; case RPG2: @@ -1403,7 +1403,7 @@ static void weaponcommon_r(DDukeActor *proj) makeitfall(proj); if (s->xrepeat >= 10 && sector[s->sectnum].lotag != 2) { - spawn(proj, SMALLSMOKE)->s.z += (1 << 8); + spawn(proj, SMALLSMOKE)->s->z += (1 << 8); } break; } @@ -1414,7 +1414,7 @@ static void weaponcommon_r(DDukeActor *proj) MulScale(k, bsin(s->ang), 14), ll, CLIPMASK1, coll); if ((s->picnum == RPG || (isRRRA() && isIn(s->picnum, RPG2, RRTILE1790))) && proj->temp_actor != nullptr) - if (FindDistance2D(s->x - proj->temp_actor->s.x, s->y - proj->temp_actor->s.y) < 256) + if (FindDistance2D(s->x - proj->temp_actor->s->x, s->y - proj->temp_actor->s->y) < 256) coll.setSprite(proj->temp_actor); if (s->sectnum < 0) // || (isRR() && sector[s->sectnum].filler == 800)) @@ -1449,8 +1449,8 @@ static void weaponcommon_r(DDukeActor *proj) s->z + ((k * Sgn(s->zvel)) * abs(s->zvel / 24)), FIRELASER, -40 + (k << 2), s->xrepeat, s->yrepeat, 0, 0, 0, proj->GetOwner(), 5); - x->s.cstat = 128; - x->s.pal = s->pal; + x->s->cstat = 128; + x->s->pal = s->pal; } } else if (s->picnum == SPIT) if (s->zvel < 6144) @@ -1479,13 +1479,13 @@ static void weaponcommon_r(DDukeActor *proj) else if (s->picnum != FREEZEBLAST && s->picnum != FIRELASER && s->picnum != SHRINKSPARK) { auto k = spawn(proj, 1441); - k->s.xrepeat = k->s.yrepeat = s->xrepeat >> 1; + k->s->xrepeat = k->s->yrepeat = s->xrepeat >> 1; if (coll.type == kHitSector) { if (s->zvel < 0) { - k->s.cstat |= 8; - k->s.z += (72 << 8); + k->s->cstat |= 8; + k->s->z += (72 << 8); } } } @@ -1509,13 +1509,13 @@ void moveweapons_r(void) DukeStatIterator it(STAT_PROJECTILE); while (auto proj = it.Next()) { - if (proj->s.sectnum < 0) + if (proj->s->sectnum < 0) { deletesprite(proj); continue; } - switch (proj->s.picnum) + switch (proj->s->picnum) { case RADIUSEXPLOSION: deletesprite(proj); @@ -1525,12 +1525,12 @@ void moveweapons_r(void) continue; case FREEZEBLAST: - if (proj->s.yvel < 1 || proj->s.extra < 2 || (proj->s.xvel | proj->s.zvel) == 0) + if (proj->s->yvel < 1 || proj->s->extra < 2 || (proj->s->xvel | proj->s->zvel) == 0) { auto star = spawn(proj, TRANSPORTERSTAR); - star->s.pal = 1; - star->s.xrepeat = 32; - star->s.yrepeat = 32; + star->s->pal = 1; + star->s->xrepeat = 32; + star->s->yrepeat = 32; deletesprite(proj); continue; } @@ -1577,7 +1577,7 @@ void movetransports_r(void) DukeStatIterator iti(STAT_TRANSPORT); while (auto act = iti.Next()) { - auto spr = &act->s; + auto spr = act->s; sect = spr->sectnum; sectlotag = sector[sect].lotag; @@ -1594,7 +1594,7 @@ void movetransports_r(void) DukeSectIterator itj(sect); while (auto act2 = itj.Next()) { - auto spr2 = &act2->s; + auto spr2 = act2->s; switch (spr2->statnum) { case STAT_PLAYER: // Player @@ -1613,13 +1613,13 @@ void movetransports_r(void) S_PlayActorSound(TELEPORTER, act); for (k = connecthead; k >= 0; k = connectpoint2[k]) - if (ps[k].cursectnum == Owner->s.sectnum) + if (ps[k].cursectnum == Owner->s->sectnum) { ps[k].frag_ps = p; - ps[k].GetActor()->s.extra = 0; + ps[k].GetActor()->s->extra = 0; } - ps[p].angle.ang = buildang(Owner->s.ang); + ps[p].angle.ang = buildang(Owner->s->ang); if (Owner->GetOwner() != Owner) { @@ -1628,11 +1628,11 @@ void movetransports_r(void) ps[p].transporter_hold = 13; } - ps[p].bobposx = ps[p].oposx = ps[p].posx = Owner->s.x; - ps[p].bobposy = ps[p].oposy = ps[p].posy = Owner->s.y; - ps[p].oposz = ps[p].posz = Owner->s.z - (gs.playerheight - (4 << 8)); + ps[p].bobposx = ps[p].oposx = ps[p].posx = Owner->s->x; + ps[p].bobposy = ps[p].oposy = ps[p].posy = Owner->s->y; + ps[p].oposz = ps[p].posz = Owner->s->z - (gs.playerheight - (4 << 8)); - changespritesect(act2, Owner->s.sectnum); + changespritesect(act2, Owner->s->sectnum); ps[p].cursectnum = spr2->sectnum; auto beam = spawn(Owner, TRANSPORTERBEAM); @@ -1647,16 +1647,16 @@ void movetransports_r(void) if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && PlayerInput(p, SB_JUMP)) || (ps[p].jetpack_on && PlayerInput(p, SB_CROUCH))) { - ps[p].oposx = ps[p].posx += Owner->s.x - spr->x; - ps[p].oposy = ps[p].posy += Owner->s.y - spr->y; + ps[p].oposx = ps[p].posx += Owner->s->x - spr->x; + ps[p].oposy = ps[p].posy += Owner->s->y - spr->y; if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11)) - ps[p].posz = Owner->s.z - 6144; - else ps[p].posz = Owner->s.z + 6144; + ps[p].posz = Owner->s->z - 6144; + else ps[p].posz = Owner->s->z + 6144; ps[p].oposz = ps[p].posz; - changespritesect(act2, Owner->s.sectnum); - ps[p].cursectnum = Owner->s.sectnum; + changespritesect(act2, Owner->s->sectnum); + ps[p].cursectnum = Owner->s->sectnum; break; } @@ -1669,15 +1669,15 @@ void movetransports_r(void) { k = 2; ps[p].oposz = ps[p].posz = - sector[Owner->s.sectnum].ceilingz + (7 << 8); + sector[Owner->s->sectnum].ceilingz + (7 << 8); } if (onfloorz && sectlotag == 161 && ps[p].posz < (sector[sect].ceilingz + (6 << 8))) { k = 2; - if (ps[p].GetActor()->s.extra <= 0) break; + if (ps[p].GetActor()->s->extra <= 0) break; ps[p].oposz = ps[p].posz = - sector[Owner->s.sectnum].floorz - (49 << 8); + sector[Owner->s->sectnum].floorz - (49 << 8); } } @@ -1692,7 +1692,7 @@ void movetransports_r(void) } S_PlayActorSound(DUKE_UNDERWATER, ps[p].GetActor()); ps[p].oposz = ps[p].posz = - sector[Owner->s.sectnum].ceilingz + (7 << 8); + sector[Owner->s->sectnum].ceilingz + (7 << 8); if (ps[p].OnMotorcycle) ps[p].moto_underwater = 1; } @@ -1700,7 +1700,7 @@ void movetransports_r(void) if (onfloorz && sectlotag == ST_2_UNDERWATER && ps[p].posz < (sector[sect].ceilingz + (6 << 8))) { k = 1; - if (ps[p].GetActor()->s.extra <= 0) break; + if (ps[p].GetActor()->s->extra <= 0) break; if (screenpeek == p) { FX_StopAllSounds(); @@ -1708,33 +1708,33 @@ void movetransports_r(void) S_PlayActorSound(DUKE_GASP, ps[p].GetActor()); ps[p].oposz = ps[p].posz = - sector[Owner->s.sectnum].floorz - (7 << 8); + sector[Owner->s->sectnum].floorz - (7 << 8); } if (k == 1) { - ps[p].oposx = ps[p].posx += Owner->s.x - spr->x; - ps[p].oposy = ps[p].posy += Owner->s.y - spr->y; + ps[p].oposx = ps[p].posx += Owner->s->x - spr->x; + ps[p].oposy = ps[p].posy += Owner->s->y - spr->y; if (Owner->GetOwner() != Owner) ps[p].transporter_hold = -2; - ps[p].cursectnum = Owner->s.sectnum; + ps[p].cursectnum = Owner->s->sectnum; - changespritesect(act2, Owner->s.sectnum); + changespritesect(act2, Owner->s->sectnum); if ((krand() & 255) < 32) spawn(ps[p].GetActor(), WATERSPLASH2); } else if (isRRRA() && k == 2) { - ps[p].oposx = ps[p].posx += Owner->s.x - spr->x; - ps[p].oposy = ps[p].posy += Owner->s.y - spr->y; + ps[p].oposx = ps[p].posx += Owner->s->x - spr->x; + ps[p].oposy = ps[p].posy += Owner->s->y - spr->y; if (Owner->GetOwner() != Owner) ps[p].transporter_hold = -2; - ps[p].cursectnum = Owner->s.sectnum; + ps[p].cursectnum = Owner->s->sectnum; - changespritesect(act2, Owner->s.sectnum); + changespritesect(act2, Owner->s->sectnum); } } break; @@ -1828,8 +1828,8 @@ void movetransports_r(void) auto k = spawn(act2, WATERSPLASH2); if (sectlotag == 1 && spr2->statnum == 4) { - k->s.xvel = spr2->xvel >> 1; - k->s.ang = spr2->ang; + k->s->xvel = spr2->xvel >> 1; + k->s->ang = spr2->ang; ssp(k, CLIPMASK0); } } @@ -1839,12 +1839,12 @@ void movetransports_r(void) case ST_0_NO_EFFECT: if (onfloorz) { - if (checkcursectnums(sect) == -1 && checkcursectnums(Owner->s.sectnum) == -1) + if (checkcursectnums(sect) == -1 && checkcursectnums(Owner->s->sectnum) == -1) { - spr2->x += (Owner->s.x - spr->x); - spr2->y += (Owner->s.y - spr->y); - spr2->z -= spr->z - sector[Owner->s.sectnum].floorz; - spr2->ang = Owner->s.ang; + spr2->x += (Owner->s->x - spr->x); + spr2->y += (Owner->s->y - spr->y); + spr2->z -= spr->z - sector[Owner->s->sectnum].floorz; + spr2->ang = Owner->s->ang; spr2->backupang(); @@ -1860,50 +1860,50 @@ void movetransports_r(void) Owner->temp_data[0] = 13; } - changespritesect(act2, Owner->s.sectnum); + changespritesect(act2, Owner->s->sectnum); } } else { - spr2->x += (Owner->s.x - spr->x); - spr2->y += (Owner->s.y - spr->y); - spr2->z = Owner->s.z + 4096; + spr2->x += (Owner->s->x - spr->x); + spr2->y += (Owner->s->y - spr->y); + spr2->z = Owner->s->z + 4096; spr2->backupz(); - changespritesect(act2, Owner->s.sectnum); + changespritesect(act2, Owner->s->sectnum); } break; case ST_1_ABOVE_WATER: - spr2->x += (Owner->s.x - spr->x); - spr2->y += (Owner->s.y - spr->y); - spr2->z = sector[Owner->s.sectnum].ceilingz + ll; + spr2->x += (Owner->s->x - spr->x); + spr2->y += (Owner->s->y - spr->y); + spr2->z = sector[Owner->s->sectnum].ceilingz + ll; spr2->backupz(); - changespritesect(act2, Owner->s.sectnum); + changespritesect(act2, Owner->s->sectnum); break; case ST_2_UNDERWATER: - spr2->x += (Owner->s.x - spr->x); - spr2->y += (Owner->s.y - spr->y); - spr2->z = sector[Owner->s.sectnum].floorz - ll; + spr2->x += (Owner->s->x - spr->x); + spr2->y += (Owner->s->y - spr->y); + spr2->z = sector[Owner->s->sectnum].floorz - ll; spr2->backupz(); - changespritesect(act2, Owner->s.sectnum); + changespritesect(act2, Owner->s->sectnum); break; case 160: if (!isRRRA()) break; - spr2->x += (Owner->s.x - spr->x); - spr2->y += (Owner->s.y - spr->y); - spr2->z = sector[Owner->s.sectnum].ceilingz + ll2; + spr2->x += (Owner->s->x - spr->x); + spr2->y += (Owner->s->y - spr->y); + spr2->z = sector[Owner->s->sectnum].ceilingz + ll2; spr2->backupz(); - changespritesect(act2, Owner->s.sectnum); + changespritesect(act2, Owner->s->sectnum); movesprite_ex(act2, MulScale(spr2->xvel, bcos(spr2->ang), 14), MulScale(spr2->xvel, bsin(spr2->ang), 14), 0, CLIPMASK1, coll); @@ -1911,13 +1911,13 @@ void movetransports_r(void) break; case 161: if (!isRRRA()) break; - spr2->x += (Owner->s.x - spr->x); - spr2->y += (Owner->s.y - spr->y); - spr2->z = sector[Owner->s.sectnum].floorz - ll2; + spr2->x += (Owner->s->x - spr->x); + spr2->y += (Owner->s->y - spr->y); + spr2->z = sector[Owner->s->sectnum].floorz - ll2; spr2->backupz(); - changespritesect(act2, Owner->s.sectnum); + changespritesect(act2, Owner->s->sectnum); movesprite_ex(act2, MulScale(spr2->xvel, bcos(spr2->ang), 14), MulScale(spr2->xvel, bsin(spr2->ang), 14), 0, CLIPMASK1, coll); @@ -1947,7 +1947,7 @@ static void rrra_specialstats() DukeStatIterator it(117); while (auto act = it.Next()) { - auto s = &act->s; + auto s = act->s; if (s->hitag > 2) s->hitag = 0; if ((s->picnum == RRTILE8488 || s->picnum == RRTILE8490) && s->hitag != 2) @@ -1982,7 +1982,7 @@ static void rrra_specialstats() it.Reset(118); while (auto act = it.Next()) { - auto s = &act->s; + auto s = act->s; if (s->hitag > 1) s->hitag = 0; if (s->hitag == 0) @@ -2014,7 +2014,7 @@ static void rrra_specialstats() DukeSpriteIterator it; while (auto act = it.Next()) { - auto s = &act->s; + auto s = act->s; switch (s->picnum) { //case 4049: @@ -2077,7 +2077,7 @@ static void rrra_specialstats() it.Reset(121); while (auto act = it.Next()) { - auto s = &act->s; + auto s = act->s; s->extra++; if (s->extra < 100) { @@ -2107,7 +2107,7 @@ static void rrra_specialstats() it.Reset(119); while (auto act = it.Next()) { - auto s = &act->s; + auto s = act->s; if (s->hitag > 0) { if (s->extra == 0) @@ -2123,7 +2123,7 @@ static void rrra_specialstats() it.Reset(116); while (auto act = it.Next()) { - auto s = &act->s; + auto s = act->s; if (s->extra) { if (s->extra == s->lotag) @@ -2151,7 +2151,7 @@ static void rrra_specialstats() it.Reset(115); while (auto act = it.Next()) { - auto s = &act->s; + auto s = act->s; if (s->extra) { if (s->picnum != RRTILE8162) @@ -2228,7 +2228,7 @@ static void rrra_specialstats() it.Reset(122); while (auto act = it.Next()) { - auto s = &act->s; + auto s = act->s; if (s->extra) { if (s->picnum != RRTILE8589) @@ -2305,7 +2305,7 @@ static void rrra_specialstats() it.Reset(123); while (auto act = it.Next()) { - if (act->s.lotag == 5) + if (act->s->lotag == 5) if (!S_CheckSoundPlaying(330)) S_PlayActorSound(330, act); } @@ -2322,7 +2322,7 @@ void rr_specialstats() DukeStatIterator it(107); while (auto act = it.Next()) { - auto s = &act->s; + auto s = act->s; if (s->hitag == 100) { s->z += (4 << 8); @@ -2342,9 +2342,9 @@ void rr_specialstats() DukeStatIterator it2(STAT_DEFAULT); while (auto act2 = it2.Next()) { - if (act2->s.picnum == 128) - if (act2->s.hitag == 999) - act2->s.picnum = 127; + if (act2->s->picnum == 128) + if (act2->s->hitag == 999) + act2->s->picnum = 127; } } } @@ -2355,14 +2355,14 @@ void rr_specialstats() it.Reset(106); while (auto act = it.Next()) { - auto s = &act->s; + auto s = act->s; switch (s->picnum) { case RRTILE285: s->lotag--; if (s->lotag < 0) { - spawn(act, RRTILE3190)->s.ang = s->ang; + spawn(act, RRTILE3190)->s->ang = s->ang; s->lotag = 128; } break; @@ -2370,7 +2370,7 @@ void rr_specialstats() s->lotag--; if (s->lotag < 0) { - spawn(act, RRTILE3192)->s.ang = s->ang; + spawn(act, RRTILE3192)->s->ang = s->ang; s->lotag = 256; } break; @@ -2395,7 +2395,7 @@ void rr_specialstats() s->lotag--; if (s->lotag < 0) { - spawn(act, RRTILE3120)->s.ang = s->ang; + spawn(act, RRTILE3120)->s->ang = s->ang; s->lotag = 448; } break; @@ -2403,7 +2403,7 @@ void rr_specialstats() s->lotag--; if (s->lotag < 0) { - spawn(act, RRTILE3122)->s.ang = s->ang; + spawn(act, RRTILE3122)->s->ang = s->ang; s->lotag = 64; } break; @@ -2411,7 +2411,7 @@ void rr_specialstats() s->lotag--; if (s->lotag < 0) { - spawn(act, RRTILE3123)->s.ang = s->ang; + spawn(act, RRTILE3123)->s->ang = s->ang; s->lotag = 512; } break; @@ -2419,7 +2419,7 @@ void rr_specialstats() s->lotag--; if (s->lotag < 0) { - spawn(act, RRTILE3124)->s.ang = s->ang; + spawn(act, RRTILE3124)->s->ang = s->ang; s->lotag = 224; } break; @@ -2441,7 +2441,7 @@ void rr_specialstats() it.Reset(STAT_BOWLING); while (auto act = it.Next()) { - auto s = &act->s; + auto s = act->s; if (s->picnum == RRTILE280) if (s->lotag == 100) { @@ -2469,7 +2469,7 @@ void rr_specialstats() it.Reset(108); while (auto act = it.Next()) { - auto s = &act->s; + auto s = act->s; if (s->picnum == RRTILE296) { int x; @@ -2479,15 +2479,15 @@ void rr_specialstats() DukeStatIterator it2(108); while (auto act2 = it2.Next()) { - if (act2->s.picnum == RRTILE297) + if (act2->s->picnum == RRTILE297) { - ps[p].angle.ang = buildang(act2->s.ang); - ps[p].bobposx = ps[p].oposx = ps[p].posx = act2->s.x; - ps[p].bobposy = ps[p].oposy = ps[p].posy = act2->s.y; - ps[p].oposz = ps[p].posz = act2->s.z - (36 << 8); + ps[p].angle.ang = buildang(act2->s->ang); + ps[p].bobposx = ps[p].oposx = ps[p].posx = act2->s->x; + ps[p].bobposy = ps[p].oposy = ps[p].posy = act2->s->y; + ps[p].oposz = ps[p].posz = act2->s->z - (36 << 8); auto pact = ps[p].GetActor(); - changespritesect(pact, act2->s.sectnum); - ps[p].cursectnum = pact->s.sectnum; + changespritesect(pact, act2->s->sectnum); + ps[p].cursectnum = pact->s->sectnum; S_PlayActorSound(70, act2); deletesprite(act2); } @@ -2505,7 +2505,7 @@ void rr_specialstats() static void heavyhbomb(DDukeActor *actor) { - auto s = &actor->s; + auto s = actor->s; auto t = &actor->temp_data[0]; int sect = s->sectnum; int x, l; @@ -2605,7 +2605,7 @@ static void heavyhbomb(DDukeActor *actor) goto DETONATEB; } - if (Owner && Owner->s.picnum == APLAYER) + if (Owner && Owner->s->picnum == APLAYER) l = Owner->PlayerIndex(); else l = -1; @@ -2712,14 +2712,14 @@ DETONATEB: if (ps[p].gotweapon[DYNAMITE_WEAPON] == 0 || Owner == ps[p].GetActor()) fi.addweapon(&ps[p], DYNAMITE_WEAPON); - if (!Owner || Owner->s.picnum != APLAYER) + if (!Owner || Owner->s->picnum != APLAYER) { SetPlayerPal(&ps[p], PalEntry(32, 0, 32, 0)); } - if (Owner && (Owner->picnum != HEAVYHBOMB || ud.respawn_items == 0 || Owner->s.picnum == APLAYER)) + if (Owner && (Owner->picnum != HEAVYHBOMB || ud.respawn_items == 0 || Owner->s->picnum == APLAYER)) { - if (s->picnum == HEAVYHBOMB && Owner->s.picnum != APLAYER && ud.coop) + if (s->picnum == HEAVYHBOMB && Owner->s->picnum != APLAYER && ud.coop) return; deletesprite(actor); return; @@ -2743,7 +2743,7 @@ DETONATEB: static int henstand(DDukeActor *actor) { - auto s = &actor->s; + auto s = actor->s; auto t = &actor->temp_data[0]; int sect = s->sectnum; @@ -2781,13 +2781,13 @@ static int henstand(DDukeActor *actor) { auto hitact = coll.actor; fi.checkhitsprite(actor, hitact); - if (hitact->s.picnum == HEN) + if (hitact->s->picnum == HEN) { auto ns = spawn(hitact, HENSTAND); deletesprite(hitact); - ns->s.xvel = 32; - ns->s.lotag = 40; - ns->s.ang = s->ang; + ns->s->xvel = 32; + ns->s->lotag = 40; + ns->s->ang = s->ang; } } } @@ -2849,7 +2849,7 @@ void moveactors_r(void) DukeStatIterator it(STAT_ACTOR); while (auto act = it.Next()) { - auto s = &act->s; + auto s = act->s; bool deleteafterexecute = false; // taking a cue here from RedNukem to not run scripts on deleted sprites. auto sect = s->sectnum; @@ -2962,7 +2962,7 @@ void moveactors_r(void) if (sector[sect].lotag == 1) { auto j = spawn(act, WATERSPLASH2); - j->s.z = sector[j->s.sectnum].floorz; + j->s->z = sector[j->s->sectnum].floorz; } deletesprite(act); continue; @@ -3011,7 +3011,7 @@ void moveactors_r(void) case UFO5: recon(act, EXPLOSION2, FIRELASER, -1, -1, 457, 8, [](DDukeActor* act) ->int { - auto s = &act->s; + auto s = act->s; if (isRRRA() && ufospawnsminion) return MINION; else if (s->picnum == UFO1_RR) @@ -3117,7 +3117,7 @@ void moveexplosions_r(void) // STATNUM 5 DukeStatIterator it(STAT_MISC); while (auto act = it.Next()) { - auto s = &act->s; + auto s = act->s; t = &act->temp_data[0]; sect = s->sectnum; @@ -3200,7 +3200,7 @@ void moveexplosions_r(void) // STATNUM 5 if (x < 512) { SetPlayerPal(&ps[p], PalEntry(32, 32, 0, 0)); - ps[p].GetActor()->s.extra -= 4; + ps[p].GetActor()->s->extra -= 4; } case COOLEXPLOSION1: @@ -3343,7 +3343,7 @@ void moveexplosions_r(void) // STATNUM 5 void handle_se06_r(DDukeActor *actor) { - auto s = &actor->s; + auto s = actor->s; auto t = &actor->temp_data[0]; auto sc = §or[s->sectnum]; @@ -3369,19 +3369,19 @@ void handle_se06_r(DDukeActor *actor) { hulkspawn--; auto ns = spawn(actor, HULK); - ns->s.z = sector[ns->s.sectnum].ceilingz; - ns->s.pal = 33; + ns->s->z = sector[ns->s->sectnum].ceilingz; + ns->s->pal = 33; if (!hulkspawn) { ns = EGS(s->sectnum, s->x, s->y, sector[s->sectnum].ceilingz + 119428, 3677, -8, 16, 16, 0, 0, 0, actor, 5); - ns->s.cstat = 514; - ns->s.pal = 7; - ns->s.xrepeat = 80; - ns->s.yrepeat = 255; + ns->s->cstat = 514; + ns->s->pal = 7; + ns->s->xrepeat = 80; + ns->s->yrepeat = 255; ns = spawn(actor, 296); - ns->s.cstat = 0; - ns->s.cstat |= 32768; - ns->s.z = sector[s->sectnum].floorz - 6144; + ns->s->cstat = 0; + ns->s->cstat |= 32768; + ns->s->z = sector[s->sectnum].floorz - 6144; deletesprite(actor); return; } @@ -3394,7 +3394,7 @@ void handle_se06_r(DDukeActor *actor) DukeSectIterator it(s->sectnum); while (auto a2 = it.Next()) { - if (a2->s.picnum == UFOBEAM && ufospawn && ++ufocnt == 64) + if (a2->s->picnum == UFOBEAM && ufospawn && ++ufocnt == 64) { int pn; ufocnt = 0; @@ -3420,7 +3420,7 @@ void handle_se06_r(DDukeActor *actor) } else pn = UFO1_RRRA; auto ns = spawn(actor, pn); - ns->s.z = sector[ns->s.sectnum].ceilingz; + ns->s->z = sector[ns->s->sectnum].ceilingz; } } } @@ -3428,15 +3428,15 @@ 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])) { - act2->s.xvel = s->xvel; + act2->s->xvel = s->xvel; // if( t[4] == 1 ) { if (act2->temp_data[5] == 0) act2->temp_data[5] = dist(act2, actor); int x = Sgn(dist(act2, actor) - act2->temp_data[5]); - if (act2->s.extra) x = -x; + if (act2->s->extra) x = -x; s->xvel += x; } act2->temp_data[4] = t[4]; @@ -3460,9 +3460,9 @@ void moveeffectors_r(void) //STATNUM 3 DukeStatIterator it(STAT_EFFECTOR); while (auto act = it.Next()) { - auto sc = §or[act->s.sectnum]; - int st = act->s.lotag; - int sh = act->s.hitag; + auto sc = §or[act->s->sectnum]; + int st = act->s->lotag; + int sh = act->s->hitag; auto t = &act->temp_data[0]; @@ -3598,9 +3598,9 @@ void moveeffectors_r(void) //STATNUM 3 break; case SE_29_WAVES: - act->s.hitag += 64; - l = MulScale(act->s.yvel, bsin(act->s.hitag), 12); - sc->floorz = act->s.z + l; + act->s->hitag += 64; + l = MulScale(act->s->yvel, bsin(act->s->hitag), 12); + sc->floorz = act->s->z + l; break; case SE_31_FLOOR_RISE_FALL: // True Drop Floor @@ -3644,12 +3644,12 @@ void moveeffectors_r(void) //STATNUM 3 it.Reset(STAT_EFFECTOR); while (auto act = it.Next()) { - auto s = &act->s; - if (act->s.lotag != SE_29_WAVES) continue; - auto sc = §or[act->s.sectnum]; + auto s = act->s; + if (act->s->lotag != SE_29_WAVES) continue; + auto sc = §or[act->s->sectnum]; if (sc->wallnum != 4) continue; auto wal = &wall[sc->wallptr + 2]; - alignflorslope(act->s.sectnum, wal->x, wal->y, sector[wal->nextsector].floorz); + alignflorslope(act->s->sectnum, wal->x, wal->y, sector[wal->nextsector].floorz); } } @@ -3662,9 +3662,9 @@ void moveeffectors_r(void) //STATNUM 3 int adjustfall(DDukeActor *actor, int c) { - if ((actor->s.picnum == BIKERB || actor->s.picnum == CHEERB) && c == gs.gravity) + if ((actor->s->picnum == BIKERB || actor->s->picnum == CHEERB) && c == gs.gravity) c = gs.gravity>>2; - else if (actor->s.picnum == BIKERBV2 && c == gs.gravity) + else if (actor->s->picnum == BIKERBV2 && c == gs.gravity) c = gs.gravity>>3; return c; } @@ -3677,7 +3677,7 @@ int adjustfall(DDukeActor *actor, int c) void move_r(DDukeActor *actor, int pnum, int xvel) { - auto spr = &actor->s; + auto spr = actor->s; auto t = actor->temp_data; int l; short goalang, angdif; @@ -4006,7 +4006,7 @@ void fakebubbaspawn(DDukeActor *actor, int g_p) static int fallspecial(DDukeActor *actor, int playernum) { - auto s = &actor->s; + auto s = actor->s; int sphit = 0; if (isRRRA()) { @@ -4102,37 +4102,37 @@ void destroyit(DDukeActor *actor) int wallstart, wallend; hitag = 0; - DukeSectIterator it1(actor->s.sectnum); + DukeSectIterator it1(actor->s->sectnum); while (auto a2 = it1.Next()) { - if (a2->s.picnum == RRTILE63) + if (a2->s->picnum == RRTILE63) { - lotag = a2->s.lotag; + lotag = a2->s->lotag; spr = a2; - if (a2->s.hitag) - hitag = a2->s.hitag; + if (a2->s->hitag) + hitag = a2->s->hitag; } } DukeStatIterator it(STAT_DESTRUCT); while (auto a2 = it.Next()) { - int it_sect = a2->s.sectnum; - if (hitag && hitag == a2->s.hitag) + int it_sect = a2->s->sectnum; + if (hitag && hitag == a2->s->hitag) { DukeSectIterator its(it_sect); while (auto a3 = its.Next()) { - if (a3->s.picnum == DESTRUCTO) + if (a3->s->picnum == DESTRUCTO) { a3->picnum = SHOTSPARK1; a3->extra = 1; } } } - if (spr->s.sectnum != it_sect) - if (lotag == a2->s.lotag) + if (spr->s->sectnum != it_sect) + if (lotag == a2->s->lotag) { - sectnum = spr->s.sectnum; + sectnum = spr->s->sectnum; wallstart = sector[sectnum].wallptr; wallend = wallstart + sector[sectnum].wallnum; wallstart2 = sector[it_sect].wallptr; @@ -4175,10 +4175,10 @@ void destroyit(DDukeActor *actor) sector[sectnum].extra = sector[it_sect].extra; } } - it1.Reset(actor->s.sectnum); + it1.Reset(actor->s->sectnum); while (auto a2 = it1.Next()) { - switch (a2->s.picnum) + switch (a2->s->picnum) { case DESTRUCTO: case RRTILE63: @@ -4215,24 +4215,24 @@ bool spawnweapondebris_r(int picnum, int dnum) void respawnhitag_r(DDukeActor *actor) { - switch (actor->s.picnum) + switch (actor->s->picnum) { case FEM10: case NAKED1: case STATUE: - if (actor->s.yvel) fi.operaterespawns(actor->s.yvel); + if (actor->s->yvel) fi.operaterespawns(actor->s->yvel); break; default: - if (actor->s.hitag >= 0) fi.operaterespawns(actor->s.hitag); + if (actor->s->hitag >= 0) fi.operaterespawns(actor->s->hitag); break; } } void checktimetosleep_r(DDukeActor *actor) { - if (actor->s.statnum == STAT_STANDABLE) + if (actor->s->statnum == STAT_STANDABLE) { - switch (actor->s.picnum) + switch (actor->s->picnum) { case RUBBERCAN: case EXPLODINGBARREL: diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index 02436d078..29523455d 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -57,7 +57,7 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int t = &tsprite[j]; i = t->owner; h = &hittype[i]; - s = &h->s; + s = h->s; switch (t->picnum) { @@ -149,9 +149,9 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int t = &tsprite[j]; i = t->owner; h = &hittype[i]; - s = &h->s; + s = h->s; auto OwnerAc = h->GetOwner(); - auto Owner = OwnerAc ? &OwnerAc->s : nullptr; + auto Owner = OwnerAc ? OwnerAc->s : nullptr; switch (s->picnum) { @@ -227,7 +227,7 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int Owner->y - t->y); if (abs(getincangle(sqa, sqb)) > 512) - if (ldist(Owner, t) < ldist(&ps[screenpeek].GetActor()->s, Owner)) + if (ldist(Owner, t) < ldist(ps[screenpeek].GetActor()->s, Owner)) t->xrepeat = t->yrepeat = 0; } continue; @@ -336,7 +336,7 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int } } - if ((display_mirror == 1 || screenpeek != p || !h->GetOwner()) && ud.multimode > 1 && cl_showweapon && ps[p].GetActor()->s.extra > 0 && ps[p].curr_weapon > 0) + if ((display_mirror == 1 || screenpeek != p || !h->GetOwner()) && ud.multimode > 1 && cl_showweapon && ps[p].GetActor()->s->extra > 0 && ps[p].curr_weapon > 0) { auto newtspr = &tsprite[spritesortcnt]; memcpy(newtspr, t, sizeof(spritetype)); diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index 37f903ccf..4bf44f22c 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -52,7 +52,7 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int t = &tsprite[j]; i = t->owner; h = &hittype[i]; - s = &h->s; + s = h->s; switch (t->picnum) { @@ -139,9 +139,9 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int t = &tsprite[j]; i = t->owner; h = &hittype[i]; - s = &h->s; + s = h->s; auto OwnerAc = h->GetOwner(); - auto Owner = OwnerAc ? &OwnerAc->s : nullptr; + auto Owner = OwnerAc ? OwnerAc->s : nullptr; switch (s->picnum) { @@ -226,7 +226,7 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int Owner->y - t->y); if (abs(getincangle(sqa, sqb)) > 512) - if (ldist(Owner, t) < ldist(&ps[screenpeek].GetActor()->s, Owner)) + if (ldist(Owner, t) < ldist(ps[screenpeek].GetActor()->s, Owner)) t->xrepeat = t->yrepeat = 0; } continue; @@ -382,7 +382,7 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int } } - if ((display_mirror == 1 || screenpeek != p || !h->GetOwner()) && ud.multimode > 1 && cl_showweapon && ps[p].GetActor()->s.extra > 0 && ps[p].curr_weapon > 0) + if ((display_mirror == 1 || screenpeek != p || !h->GetOwner()) && ud.multimode > 1 && cl_showweapon && ps[p].GetActor()->s->extra > 0 && ps[p].curr_weapon > 0) { auto newtspr = &tsprite[spritesortcnt]; memcpy(newtspr, t, sizeof(spritetype)); diff --git a/source/games/duke/src/bowling.cpp b/source/games/duke/src/bowling.cpp index 876e95f85..817526a93 100644 --- a/source/games/duke/src/bowling.cpp +++ b/source/games/duke/src/bowling.cpp @@ -38,17 +38,17 @@ void ballreturn(DDukeActor *ball) DukeStatIterator it(STAT_BOWLING); while (auto act = it.Next()) { - if (act->s.picnum == RRTILE281 && ball->s.sectnum == act->s.sectnum) + if (act->s->picnum == RRTILE281 && ball->s->sectnum == act->s->sectnum) { DukeStatIterator it2(STAT_BOWLING); while (auto act2 = it2.Next()) { - if (act2->s.picnum == RRTILE282 && act->s.hitag == act2->s.hitag) + if (act2->s->picnum == RRTILE282 && act->s->hitag == act2->s->hitag) spawn(act2, BOWLINGBALLSPRITE); - if (act2->s.picnum == RRTILE280 && act->s.hitag == act2->s.hitag && act2->s.lotag == 0) + if (act2->s->picnum == RRTILE280 && act->s->hitag == act2->s->hitag && act2->s->lotag == 0) { - act2->s.lotag = 100; - act2->s.extra++; + act2->s->lotag = 100; + act2->s->extra++; } } } @@ -94,14 +94,14 @@ short checkpins(short sect) DukeSectIterator it(sect); while (auto a2 = it.Next()) { - if (a2->s.picnum == RRTILE3440) + if (a2->s->picnum == RRTILE3440) { pin++; - pins[a2->s.lotag] = 1; + pins[a2->s->lotag] = 1; } - if (a2->s.picnum == RRTILE280) + if (a2->s->picnum == RRTILE280) { - tag = a2->s.hitag; + tag = a2->s->hitag; } } @@ -171,28 +171,28 @@ void resetpins(short sect) DukeSectIterator it(sect); while (auto a2 = it.Next()) { - if (a2->s.picnum == RRTILE3440) + if (a2->s->picnum == RRTILE3440) deletesprite(a2); } it.Reset(sect); while (auto a2 = it.Next()) { - if (a2->s.picnum == 283) + if (a2->s->picnum == 283) { auto spawned = spawn(a2, RRTILE3440); - spawned->s.lotag = a2->s.lotag; - if (spawned->s.lotag == 3 || spawned->s.lotag == 5) + spawned->s->lotag = a2->s->lotag; + if (spawned->s->lotag == 3 || spawned->s->lotag == 5) { - spawned->s.clipdist = (1 + (krand() % 1)) * 16 + 32; + spawned->s->clipdist = (1 + (krand() % 1)) * 16 + 32; } else { - spawned->s.clipdist = (1 + (krand() % 1)) * 16 + 32; + spawned->s->clipdist = (1 + (krand() % 1)) * 16 + 32; } - spawned->s.ang -= ((krand() & 32) - (krand() & 64)) & 2047; + spawned->s->ang -= ((krand() & 32) - (krand() & 64)) & 2047; } - if (a2->s.picnum == 280) - tag = a2->s.hitag; + if (a2->s->picnum == 280) + tag = a2->s->hitag; } if (tag) { diff --git a/source/games/duke/src/ccmds.cpp b/source/games/duke/src/ccmds.cpp index 09bac2261..a2b5c339b 100644 --- a/source/games/duke/src/ccmds.cpp +++ b/source/games/duke/src/ccmds.cpp @@ -90,9 +90,9 @@ static int ccmd_spawn(CCmdFuncPtr parm) } auto spawned = spawn(ps[myconnectindex].GetActor(), picnum); - if (set & 1) spawned->s.pal = (char)pal; - if (set & 2) spawned->s.cstat = (short)cstat; - if (set & 4) spawned->s.ang = ang; + if (set & 1) spawned->s->pal = (char)pal; + if (set & 2) spawned->s->cstat = (short)cstat; + if (set & 4) spawned->s->ang = ang; if (set & 8) { if (setsprite(spawned, x, y, z) < 0) { diff --git a/source/games/duke/src/cheats.cpp b/source/games/duke/src/cheats.cpp index 62ef14f90..6c7f67bc3 100644 --- a/source/games/duke/src/cheats.cpp +++ b/source/games/duke/src/cheats.cpp @@ -67,12 +67,12 @@ static const char *cheatGod(int myconnectindex, int state) auto act = p->GetActor(); p->resurrected = true; - act->s.extra = gs.max_player_health; + act->s->extra = gs.max_player_health; act->extra = 0; if (ud.god) { if (isRRRA()) S_PlaySound(218, CHAN_AUTO, CHANF_UI); - act->s.cstat = 257; + act->s->cstat = 257; act->temp_data[0] = 0; act->temp_data[1] = 0; @@ -81,9 +81,9 @@ static const char *cheatGod(int myconnectindex, int state) act->temp_data[4] = 0; act->temp_data[5] = 0; - act->s.hitag = 0; - act->s.lotag = 0; - act->s.pal = + act->s->hitag = 0; + act->s->lotag = 0; + act->s->pal = ps[myconnectindex].palookup; return quoteMgr.GetQuote(QUOTE_CHEAT_GODMODE_ON); @@ -91,7 +91,7 @@ static const char *cheatGod(int myconnectindex, int state) else { ud.god = 0; - act->s.extra = gs.max_player_health; + act->s->extra = gs.max_player_health; act->extra = -1; ps[myconnectindex].last_extra = gs.max_player_health; return quoteMgr.GetQuote(QUOTE_CHEAT_GODMODE_OFF); @@ -121,9 +121,9 @@ static const char *cheatKfc(int player) for (int i = 0; i < 7; i++) { auto spr = spawn(ps[player].GetActor(), TILE_HEN); - spr->s.pal = 1; - spr->s.xrepeat = spr->s.xrepeat << 2; - spr->s.yrepeat = spr->s.yrepeat << 2; + spr->s->pal = 1; + spr->s->xrepeat = spr->s->xrepeat << 2; + spr->s->yrepeat = spr->s->yrepeat << 2; } return quoteMgr.GetQuote(QUOTE_CHEAT_KFC); } @@ -197,7 +197,7 @@ const char* GameInterface::GenericCheat(int player, int cheat) ps[player].gotweapon.Zero(); ps[player].curr_weapon = KNEE_WEAPON; ps[player].nocheat = 1; - ps[player].GetActor()->s.extra = 1; + ps[player].GetActor()->s->extra = 1; return quoteMgr.GetQuote(QUOTE_YERFUCKED); case CHT_AARON: @@ -473,7 +473,7 @@ static void cmd_Give(int player, uint8_t** stream, bool skip) int type = ReadByte(stream); if (skip) return; - if (numplayers != 1 || gamestate != GS_LEVEL || ps[player].GetActor()->s.extra <= 0) + if (numplayers != 1 || gamestate != GS_LEVEL || ps[player].GetActor()->s->extra <= 0) { Printf("give: Cannot give while dead or not in a single-player game.\n"); return; @@ -487,7 +487,7 @@ static void cmd_Give(int player, uint8_t** stream, bool skip) break; case GIVE_HEALTH: - ps[player].GetActor()->s.extra = gs.max_player_health << 1; + ps[player].GetActor()->s->extra = gs.max_player_health << 1; break; case GIVE_WEAPONS: diff --git a/source/games/duke/src/d_menu.cpp b/source/games/duke/src/d_menu.cpp index 6af3e4349..879597e58 100644 --- a/source/games/duke/src/d_menu.cpp +++ b/source/games/duke/src/d_menu.cpp @@ -92,7 +92,7 @@ bool GameInterface::CanSave() { if (ud.recstat == 2 || gamestate != GS_LEVEL) return false; auto &myplayer = ps[myconnectindex]; - return (myplayer.GetActor()->s.extra > 0); + return (myplayer.GetActor()->s->extra > 0); } bool GameInterface::StartGame(FNewGameStartup& gs) diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index e853601ec..8bf76282a 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -54,7 +54,7 @@ struct GameInterface : public ::GameInterface const char* GenericCheat(int player, int cheat) override; const char* CheckCheatMode() override; void NextLevel(MapRecord* map, int skill) override; - void NewGame(MapRecord* map, int skill) override; + void NewGame(MapRecord* map, int skill, bool) override; void LevelCompleted(MapRecord* map, int skill) override; bool DrawAutomapPlayer(int x, int y, int z, int a, double const smoothratio) override; int playerKeyMove() override { return 40; } diff --git a/source/games/duke/src/dukeactor.h b/source/games/duke/src/dukeactor.h index 611269542..f4a6e4828 100644 --- a/source/games/duke/src/dukeactor.h +++ b/source/games/duke/src/dukeactor.h @@ -78,7 +78,7 @@ public: while (index < MAXSPRITES) { auto p = &hittype[index++]; - if (p->s.statnum != MAXSTATUS) return p; + if (p->s->statnum != MAXSTATUS) return p; } return nullptr; } @@ -91,7 +91,7 @@ inline DDukeActor* player_struct::GetActor() inline int player_struct::GetPlayerNum() { - return GetActor()->s.yvel; + return GetActor()->s->yvel; } // Refactoring helpers/intermediates @@ -141,7 +141,7 @@ inline int ActorToScriptIndex(DDukeActor* a) inline DDukeActor* ScriptIndexToActor(int index) { // only allow valid actors to get through here. Everything else gets null'ed. - if (index < 0 || index >= MAXSPRITES || hittype[index].s.statnum == MAXSTATUS) return nullptr; + if (index < 0 || index >= MAXSPRITES || hittype[index].s->statnum == MAXSTATUS) return nullptr; return &hittype[index]; } @@ -156,22 +156,22 @@ inline DDukeActor* spawn(DDukeActor* spawner, int type) inline int ldist(DDukeActor* s1, DDukeActor* s2) { - return ldist(&s1->s, &s2->s); + return ldist(s1->s, s2->s); } inline int dist(DDukeActor* s1, DDukeActor* s2) { - return dist(&s1->s, &s2->s); + return dist(s1->s, s2->s); } inline int badguy(DDukeActor* pSprite) { - return badguypic(pSprite->s.picnum); + return badguypic(pSprite->s->picnum); } inline int bossguy(DDukeActor* pSprite) { - return bossguypic(pSprite->s.picnum); + return bossguypic(pSprite->s->picnum); } // old interface versions of already changed functions diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index 8bdc840bb..53acadb3f 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -251,7 +251,7 @@ void drawoverlays(double smoothratio) { fi.displayweapon(screenpeek, smoothratio); if (pp->over_shoulder_on == 0) - fi.displaymasks(screenpeek, pp->GetActor()->s.pal == 1 ? 1 : sector[pp->cursectnum].floorpal, smoothratio); + fi.displaymasks(screenpeek, pp->GetActor()->s->pal == 1 ? 1 : sector[pp->cursectnum].floorpal, smoothratio); } if (!isRR()) moveclouds(smoothratio); @@ -414,7 +414,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang, DukeSectIterator it(i); while (auto act = it.Next()) { - spr = &act->s; + spr = act->s; if (act == pactor || (spr->cstat & 0x8000) || spr->cstat == 257 || spr->xrepeat == 0) continue; @@ -555,7 +555,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang, for (p = connecthead; p >= 0; p = connectpoint2[p]) { auto act = ps[p].GetActor(); - auto pspr = &act->s; + auto pspr = act->s; auto spos = pspr->interpolatedvec2(smoothratio); daang = ((!SyncInput() ? pspr->ang : pspr->interpolatedang(smoothratio)) - cang) & 2047; diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index b058a1f9b..73edeb5fa 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -1033,7 +1033,7 @@ void DoSector(char bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, if (lVar1 == g_iThisActorID) { // if they've asked for 'this', then use 'this'... - iSector = sActor->s.sectnum; + iSector = sActor->s->sectnum; } else { @@ -1161,7 +1161,7 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, iActor = GetGameVarID(lVar1, sActor, sPlayer); act = ScriptIndexToActor(iActor); } - auto spr = &act->s; + auto spr = act->s; if (iActor < 0 || iActor >= MAXSPRITES || spr->statnum == MAXSTATUS) { @@ -1404,7 +1404,7 @@ static int ifcanshoottarget(DDukeActor *actor, int g_p, int g_x) { short sclip, angdif; - if (badguy(actor) && actor->s.xrepeat > 56) + if (badguy(actor) && actor->s->xrepeat > 56) { sclip = 3084; angdif = 48; @@ -1423,21 +1423,21 @@ static int ifcanshoottarget(DDukeActor *actor, int g_p, int g_x) } if (j > sclip) { - if (hit != nullptr && hit->s.picnum == actor->s.picnum) + if (hit != nullptr && hit->s->picnum == actor->s->picnum) j = 0; else { - actor->s.ang += angdif; j = hitasprite(actor, &hit); actor->s.ang -= angdif; + actor->s->ang += angdif; j = hitasprite(actor, &hit); actor->s->ang -= angdif; if (j > sclip) { - if (hit != nullptr && hit->s.picnum == actor->s.picnum) + if (hit != nullptr && hit->s->picnum == actor->s->picnum) j = 0; else { - actor->s.ang -= angdif; j = hitasprite(actor, &hit); actor->s.ang += angdif; + actor->s->ang -= angdif; j = hitasprite(actor, &hit); actor->s->ang += angdif; if (j > 768) { - if (hit != nullptr && hit->s.picnum == actor->s.picnum) + if (hit != nullptr && hit->s->picnum == actor->s->picnum) j = 0; else j = 1; } @@ -1463,7 +1463,7 @@ static bool ifcansee(DDukeActor* actor, int pnum) { int j; DDukeActor* tosee; - auto spr = &actor->s; + auto spr = actor->s; // select sprite for monster to target // if holoduke is on, let them target holoduke first. @@ -1471,7 +1471,7 @@ static bool ifcansee(DDukeActor* actor, int pnum) if (ps[pnum].holoduke_on != nullptr && !isRR()) { tosee = ps[pnum].holoduke_on; - j = cansee(spr->x, spr->y, spr->z - (krand() & ((32 << 8) - 1)), spr->sectnum, tosee->s.x, tosee->s.y, tosee->s.z, tosee->s.sectnum); + j = cansee(spr->x, spr->y, spr->z - (krand() & ((32 << 8) - 1)), spr->sectnum, tosee->s->x, tosee->s->y, tosee->s->z, tosee->s->sectnum); if (j == 0) { @@ -1483,7 +1483,7 @@ static bool ifcansee(DDukeActor* actor, int pnum) else tosee = ps[pnum].GetActor(); // holoduke not on. look for player // can they see player, (or player's holoduke) - j = cansee(spr->x, spr->y, spr->z - (krand() & ((47 << 8))), spr->sectnum, tosee->s.x, tosee->s.y, tosee->s.z - ((isRR()? 28 : 24) << 8), tosee->s.sectnum); + j = cansee(spr->x, spr->y, spr->z - (krand() & ((47 << 8))), spr->sectnum, tosee->s->x, tosee->s->y, tosee->s->z - ((isRR()? 28 : 24) << 8), tosee->s->sectnum); if (j == 0) { @@ -1495,8 +1495,8 @@ static bool ifcansee(DDukeActor* actor, int pnum) { // else, they did see it. // save where we were looking.. - actor->lastvx = tosee->s.x; - actor->lastvy = tosee->s.y; + actor->lastvx = tosee->s->x; + actor->lastvy = tosee->s->y; } if (j == 1 && (spr->statnum == STAT_ACTOR || spr->statnum == STAT_STANDABLE)) @@ -1511,7 +1511,7 @@ static bool ifcansee(DDukeActor* actor, int pnum) int ParseState::parse(void) { int j, l, s; - auto g_sp = g_ac? &g_ac->s : nullptr; + auto g_sp = g_ac? g_ac->s : nullptr; if(killit_flag) return 1; @@ -1535,12 +1535,12 @@ int ParseState::parse(void) parseifelse(ifcanshoottarget(g_ac, g_p, g_x)); break; case concmd_ifcanseetarget: - j = cansee(g_sp->x, g_sp->y, g_sp->z - ((krand() & 41) << 8), g_sp->sectnum, ps[g_p].posx, ps[g_p].posy, ps[g_p].posz/*-((krand()&41)<<8)*/, ps[g_p].GetActor()->s.sectnum); + j = cansee(g_sp->x, g_sp->y, g_sp->z - ((krand() & 41) << 8), g_sp->sectnum, ps[g_p].posx, ps[g_p].posy, ps[g_p].posz/*-((krand()&41)<<8)*/, ps[g_p].GetActor()->s->sectnum); parseifelse(j); if (j) g_ac->timetosleep = SLEEPTIME; break; case concmd_ifnocover: - j = cansee(g_sp->x, g_sp->y, g_sp->z, g_sp->sectnum, ps[g_p].posx, ps[g_p].posy, ps[g_p].posz, ps[g_p].GetActor()->s.sectnum); + j = cansee(g_sp->x, g_sp->y, g_sp->z, g_sp->sectnum, ps[g_p].posx, ps[g_p].posy, ps[g_p].posz, ps[g_p].GetActor()->s->sectnum); parseifelse(j); if (j) g_ac->timetosleep = SLEEPTIME; break; @@ -1953,7 +1953,7 @@ int ParseState::parse(void) case concmd_isdrunk: // todo: move out to player_r. insptr++; ps[g_p].drink_amt += *insptr; - j = ps[g_p].GetActor()->s.extra; + j = ps[g_p].GetActor()->s->extra; if (j > 0) j += *insptr; if (j > gs.max_player_health * 2) @@ -1972,14 +1972,14 @@ int ParseState::parse(void) ps[g_p].last_extra = j; } - ps[g_p].GetActor()->s.extra = j; + ps[g_p].GetActor()->s->extra = j; } if (ps[g_p].drink_amt > 100) ps[g_p].drink_amt = 100; - if (ps[g_p].GetActor()->s.extra >= gs.max_player_health) + if (ps[g_p].GetActor()->s->extra >= gs.max_player_health) { - ps[g_p].GetActor()->s.extra = gs.max_player_health; + ps[g_p].GetActor()->s->extra = gs.max_player_health; ps[g_p].last_extra = gs.max_player_health; } insptr++; @@ -1994,8 +1994,8 @@ int ParseState::parse(void) break; case concmd_larrybird: insptr++; - ps[g_p].posz = sector[ps[g_p].GetActor()->s.sectnum].ceilingz; - ps[g_p].GetActor()->s.z = ps[g_p].posz; + ps[g_p].posz = sector[ps[g_p].GetActor()->s->sectnum].ceilingz; + ps[g_p].GetActor()->s->z = ps[g_p].posz; break; case concmd_destroyit: insptr++; @@ -2011,7 +2011,7 @@ int ParseState::parse(void) ps[g_p].drink_amt -= *insptr; if (ps[g_p].drink_amt < 0) ps[g_p].drink_amt = 0; - j = ps[g_p].GetActor()->s.extra; + j = ps[g_p].GetActor()->s->extra; if (g_sp->picnum != TILE_ATOMICHEALTH) { if (j > gs.max_player_health && *insptr > 0) @@ -2048,7 +2048,7 @@ int ParseState::parse(void) ps[g_p].last_extra = j; } - ps[g_p].GetActor()->s.extra = j; + ps[g_p].GetActor()->s->extra = j; } insptr++; @@ -2069,12 +2069,12 @@ int ParseState::parse(void) DukeStatIterator it(STAT_ACTOR); while (auto j = it.Next()) { - if (j->s.picnum == TILE_CAMERA1) - j->s.yvel = 0; + if (j->s->picnum == TILE_CAMERA1) + j->s->yvel = 0; } } - j = ps[g_p].GetActor()->s.extra; + j = ps[g_p].GetActor()->s->extra; if(g_sp->picnum != TILE_ATOMICHEALTH) { @@ -2112,7 +2112,7 @@ int ParseState::parse(void) ps[g_p].last_extra = j; } - ps[g_p].GetActor()->s.extra = j; + ps[g_p].GetActor()->s->extra = j; } insptr++; @@ -2188,9 +2188,9 @@ int ParseState::parse(void) dnum + s, g_sp->shade, 32 + (krand() & 15), 32 + (krand() & 15), krand() & 2047, (krand() & 127) + 32, -(krand() & 2047), g_ac, 5); if(weap) - l->s.yvel = gs.weaponsandammosprites[j%14]; - else l->s.yvel = -1; - l->s.pal = g_sp->pal; + l->s->yvel = gs.weaponsandammosprites[j%14]; + else l->s->yvel = -1; + l->s->pal = g_sp->pal; } insptr++; } @@ -2423,7 +2423,7 @@ int ParseState::parse(void) j = 1; else if( (l& pkicking) && ( ps[g_p].quick_kick > 0 || ( ps[g_p].curr_weapon == KNEE_WEAPON && ps[g_p].kickback_pic > 0 ) ) ) j = 1; - else if( (l& pshrunk) && ps[g_p].GetActor()->s.xrepeat < (isRR() ? 8 : 32)) + else if( (l& pshrunk) && ps[g_p].GetActor()->s->xrepeat < (isRR() ? 8 : 32)) j = 1; else if( (l& pjetpack) && ps[g_p].jetpack_on ) j = 1; @@ -2431,9 +2431,9 @@ int ParseState::parse(void) j = 1; else if( (l& ponground) && ps[g_p].on_ground) j = 1; - else if( (l& palive) && ps[g_p].GetActor()->s.xrepeat > (isRR() ? 8 : 32) && ps[g_p].GetActor()->s.extra > 0 && ps[g_p].timebeforeexit == 0 ) + else if( (l& palive) && ps[g_p].GetActor()->s->xrepeat > (isRR() ? 8 : 32) && ps[g_p].GetActor()->s->extra > 0 && ps[g_p].timebeforeexit == 0 ) j = 1; - else if( (l& pdead) && ps[g_p].GetActor()->s.extra <= 0) + else if( (l& pdead) && ps[g_p].GetActor()->s->extra <= 0) j = 1; else if( (l& pfacing) ) { @@ -2509,7 +2509,7 @@ int ParseState::parse(void) DDukeActor* a2; while ((a2 = it.Next())) { - auto sj = &a2->s; + auto sj = a2->s; if (sj->picnum == ACTIVATOR) break; } @@ -2542,7 +2542,7 @@ int ParseState::parse(void) case concmd_ifrespawn: if( badguy(g_ac) ) parseifelse( ud.respawn_monsters ); - else if( inventory(&g_ac->s) ) + else if( inventory(g_ac->s) ) parseifelse( ud.respawn_inventory ); else parseifelse( ud.respawn_items ); @@ -2726,7 +2726,7 @@ int ParseState::parse(void) } case concmd_ifphealthl: insptr++; - parseifelse( ps[g_p].GetActor()->s.extra < *insptr); + parseifelse( ps[g_p].GetActor()->s->extra < *insptr); break; case concmd_ifpinventory: @@ -2777,8 +2777,8 @@ int ParseState::parse(void) } case concmd_pstomp: insptr++; - if( ps[g_p].knee_incs == 0 && ps[g_p].GetActor()->s.xrepeat >= (isRR()? 9: 40) ) - if( cansee(g_sp->x,g_sp->y,g_sp->z-(4<<8),g_sp->sectnum,ps[g_p].posx,ps[g_p].posy,ps[g_p].posz+(16<<8),ps[g_p].GetActor()->s.sectnum) ) + if( ps[g_p].knee_incs == 0 && ps[g_p].GetActor()->s->xrepeat >= (isRR()? 9: 40) ) + if( cansee(g_sp->x,g_sp->y,g_sp->z-(4<<8),g_sp->sectnum,ps[g_p].posx,ps[g_p].posy,ps[g_p].posz+(16<<8),ps[g_p].GetActor()->s->sectnum) ) { ps[g_p].knee_incs = 1; if(ps[g_p].weapon_pos == 0) @@ -2929,7 +2929,7 @@ int ParseState::parse(void) DukeStatIterator it(STAT_ACTOR); while (auto j = it.Next()) { - if (j->s.picnum == lType) + if (j->s->picnum == lType) { lTemp = ldist(g_ac, j); if (lTemp < lMaxDist) @@ -2972,7 +2972,7 @@ int ParseState::parse(void) DukeStatIterator it(STAT_ACTOR); while (auto j = it.Next()) { - if (j->s.picnum == lType) + if (j->s->picnum == lType) { lTemp = ldist(g_ac, j); if (lTemp < lMaxDist) @@ -3660,14 +3660,14 @@ void LoadActor(DDukeActor *actor, int p, int x) s.g_ac = actor; s.g_t = &s.g_ac->temp_data[0]; // Sprite's 'extra' data - auto addr = gs.tileinfo[actor->s.picnum].loadeventscriptptr; + auto addr = gs.tileinfo[actor->s->picnum].loadeventscriptptr; if (addr == 0) return; int *insptr = &ScriptCode[addr + 1]; s.killit_flag = 0; - if (actor->s.sectnum < 0 || actor->s.sectnum >= MAXSECTORS) + if (actor->s->sectnum < 0 || actor->s->sectnum >= MAXSECTORS) { deletesprite(actor); return; @@ -3690,14 +3690,14 @@ void LoadActor(DDukeActor *actor, int p, int x) { fi.move(actor, p, x); - if (actor->s.statnum == STAT_ACTOR) + if (actor->s->statnum == STAT_ACTOR) { if (badguy(actor)) { - if (actor->s.xrepeat > 60) return; - if (ud.respawn_monsters == 1 && actor->s.extra <= 0) return; + if (actor->s->xrepeat > 60) return; + if (ud.respawn_monsters == 1 && actor->s->extra <= 0) return; } - else if (ud.respawn_items == 1 && (actor->s.cstat & 32768)) return; + else if (ud.respawn_items == 1 && (actor->s->cstat & 32768)) return; if (actor->timetosleep > 1) actor->timetosleep--; @@ -3705,7 +3705,7 @@ void LoadActor(DDukeActor *actor, int p, int x) changespritestat(actor, STAT_ZOMBIEACTOR); } - else if (actor->s.statnum == 6) + else if (actor->s->statnum == 6) { #if 0 switch (actor->s.picnum) @@ -3741,7 +3741,7 @@ void LoadActor(DDukeActor *actor, int p, int x) void execute(DDukeActor *actor,int p,int x) { - if (gs.actorinfo[actor->s.picnum].scriptaddress == 0) return; + if (gs.actorinfo[actor->s->picnum].scriptaddress == 0) return; int done; @@ -3751,12 +3751,12 @@ void execute(DDukeActor *actor,int p,int x) s.g_ac = actor; s.g_t = &actor->temp_data[0]; // Sprite's 'extra' data - if (gs.actorinfo[actor->s.picnum].scriptaddress == 0) return; - s.insptr = &ScriptCode[4 + (gs.actorinfo[actor->s.picnum].scriptaddress)]; + if (gs.actorinfo[actor->s->picnum].scriptaddress == 0) return; + s.insptr = &ScriptCode[4 + (gs.actorinfo[actor->s->picnum].scriptaddress)]; s.killit_flag = 0; - if(actor->s.sectnum < 0 || actor->s.sectnum >= MAXSECTORS) + if(actor->s->sectnum < 0 || actor->s->sectnum >= MAXSECTORS) { if(badguy(actor)) ps[p].actors_killed++; @@ -3772,11 +3772,11 @@ void execute(DDukeActor *actor,int p,int x) int increment = ptr[3]; int delay = ptr[4]; - actor->s.lotag += TICSPERFRAME; - if (actor->s.lotag > delay) + actor->s->lotag += TICSPERFRAME; + if (actor->s->lotag > delay) { s.g_t[2]++; - actor->s.lotag = 0; + actor->s->lotag = 0; s.g_t[3] += increment; } if (abs(s.g_t[3]) >= abs(numframes * increment)) @@ -3798,14 +3798,14 @@ void execute(DDukeActor *actor,int p,int x) { fi.move(actor, p, x); - if (actor->s.statnum == STAT_ACTOR) + if (actor->s->statnum == STAT_ACTOR) { if (badguy(actor)) { - if (actor->s.xrepeat > 60) goto quit; - if (ud.respawn_monsters == 1 && actor->s.extra <= 0) goto quit; + if (actor->s->xrepeat > 60) goto quit; + if (ud.respawn_monsters == 1 && actor->s->extra <= 0) goto quit; } - else if (ud.respawn_items == 1 && (actor->s.cstat & 32768)) goto quit; + else if (ud.respawn_items == 1 && (actor->s->cstat & 32768)) goto quit; if (actor->timetosleep > 1) actor->timetosleep--; @@ -3813,7 +3813,7 @@ void execute(DDukeActor *actor,int p,int x) changespritestat(actor, STAT_ZOMBIEACTOR); } - else if (actor->s.statnum == STAT_STANDABLE) + else if (actor->s->statnum == STAT_STANDABLE) fi.checktimetosleep(actor); } quit: diff --git a/source/games/duke/src/gameloop.cpp b/source/games/duke/src/gameloop.cpp index 917bdf3f7..3b5791477 100644 --- a/source/games/duke/src/gameloop.cpp +++ b/source/games/duke/src/gameloop.cpp @@ -183,7 +183,7 @@ void GameInterface::NextLevel(MapRecord* map, int skill) // //--------------------------------------------------------------------------- -void GameInterface::NewGame(MapRecord* map, int skill) +void GameInterface::NewGame(MapRecord* map, int skill, bool) { // Hmm... What about the other players? ps[0].last_extra = gs.max_player_health; diff --git a/source/games/duke/src/hudweapon_d.cpp b/source/games/duke/src/hudweapon_d.cpp index bc28679fc..9a805b229 100644 --- a/source/games/duke/src/hudweapon_d.cpp +++ b/source/games/duke/src/hudweapon_d.cpp @@ -120,7 +120,7 @@ int animatefist(int gs, player_struct* p, double look_anghalf, double looking_ar int animateknee(int gs, player_struct* p, double look_anghalf, double looking_arc, double horiz16th, double plravel, int pal) { - if (p->knee_incs > 11 || p->knee_incs == 0 || p->GetActor()->s.extra <= 0) return 0; + if (p->knee_incs > 11 || p->knee_incs == 0 || p->GetActor()->s->extra <= 0) return 0; static const short knee_y[] = { 0,-8,-16,-32,-64,-84,-108,-108,-108,-72,-32,-8 }; @@ -139,7 +139,7 @@ int animateknee(int gs, player_struct* p, double look_anghalf, double looking_ar int animateknuckles(int gs, player_struct* p, double look_anghalf, double looking_arc, double horiz16th, double plravel, int pal) { - if (isWW2GI() || p->over_shoulder_on != 0 || p->knuckle_incs == 0 || p->GetActor()->s.extra <= 0) return 0; + if (isWW2GI() || p->over_shoulder_on != 0 || p->knuckle_incs == 0 || p->GetActor()->s->extra <= 0) return 0; static const short knuckle_frames[] = { 0,1,2,2,3,3,3,2,2,1,0 }; @@ -191,7 +191,7 @@ static int animatetip(int gs, player_struct* p, double look_anghalf, double look int animateaccess(int gs, player_struct* p, double look_anghalf, double looking_arc, double horiz16th, double plravel, int pal) { - if(p->access_incs == 0 || p->GetActor()->s.extra <= 0) return 0; + if(p->access_incs == 0 || p->GetActor()->s->extra <= 0) return 0; static const short access_y[] = {0,-8,-16,-32,-64,-84,-108,-108,-108,-108,-108,-108,-108,-108,-108,-108,-96,-72,-64,-32,-16}; @@ -249,22 +249,22 @@ void displayweapon_d(int snum, double smoothratio) looking_arc = p->angle.looking_arc(cl_hudinterpolation, smoothratio); hard_landing *= 8.; - gun_pos -= fabs(p->GetActor()->s.xrepeat < 32 ? bsinf(weapon_sway * 4., -9) : bsinf(weapon_sway * 0.5, -10)); + gun_pos -= fabs(p->GetActor()->s->xrepeat < 32 ? bsinf(weapon_sway * 4., -9) : bsinf(weapon_sway * 0.5, -10)); gun_pos -= hard_landing; weapon_xoffset = (160)-90; weapon_xoffset -= bcosf(weapon_sway * 0.5) * (1. / 1536.); weapon_xoffset -= 58 + p->weapon_ang; - shade = p->GetActor()->s.shade; + shade = p->GetActor()->s->shade; if(shade > 24) shade = 24; - pal = p->GetActor()->s.pal == 1 ? 1 : sector[p->cursectnum].floorpal; + pal = p->GetActor()->s->pal == 1 ? 1 : sector[p->cursectnum].floorpal; if (pal == 0) pal = p->palookup; auto adjusted_arc = looking_arc - hard_landing; - bool playerVars = p->newOwner != nullptr || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->s.pal != 1 && p->GetActor()->s.extra <= 0); + bool playerVars = p->newOwner != nullptr || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->s->pal != 1 && p->GetActor()->s->extra <= 0); bool playerAnims = animatefist(shade, p, look_anghalf, looking_arc, plravel, pal) || animateknuckles(shade, p, look_anghalf, adjusted_arc, horiz16th, plravel, pal) || animatetip(shade, p, look_anghalf, adjusted_arc, horiz16th, plravel, pal) || animateaccess(shade, p, look_anghalf, adjusted_arc, horiz16th, plravel, pal); @@ -308,13 +308,13 @@ void displayweapon_d(int snum, double smoothratio) } } - if (p->GetActor()->s.xrepeat < 40) + if (p->GetActor()->s->xrepeat < 40) { static int fistsign; //shrunken.. if (p->jetpack_on == 0) { - i = p->GetActor()->s.xvel; + i = p->GetActor()->s->xvel; looking_arc += 32 - (i >> 1); fistsign += i >> 1; } @@ -440,7 +440,7 @@ void displayweapon_d(int snum, double smoothratio) gun_pos -= bsinf(kickback_pic * 128., -12); } - if (*kb > 0 && p->GetActor()->s.pal != 1) + if (*kb > 0 && p->GetActor()->s->pal != 1) { weapon_xoffset += 1 - (rand() & 3); } @@ -560,7 +560,7 @@ void displayweapon_d(int snum, double smoothratio) if (*kb > 0) gun_pos -= bsinf(kickback_pic * 128., -12); - if (*kb > 0 && p->GetActor()->s.pal != 1) weapon_xoffset += 1 - (rand() & 3); + if (*kb > 0 && p->GetActor()->s->pal != 1) weapon_xoffset += 1 - (rand() & 3); if (*kb == 0) { @@ -661,7 +661,7 @@ void displayweapon_d(int snum, double smoothratio) if (*kb > 0) gun_pos -= bsinf(kickback_pic * 128., -12); - if (*kb > 0 && p->GetActor()->s.pal != 1) weapon_xoffset += 1 - (rand() & 3); + if (*kb > 0 && p->GetActor()->s->pal != 1) weapon_xoffset += 1 - (rand() & 3); hud_drawpal(weapon_xoffset + 168 - look_anghalf, looking_arc + 260 - gun_pos, CHAINGUN, shade, o, pal); switch(*kb) @@ -673,9 +673,9 @@ void displayweapon_d(int snum, double smoothratio) if (*kb > 4 && *kb < 12) { i = 0; - if (p->GetActor()->s.pal != 1) i = rand() & 7; + if (p->GetActor()->s->pal != 1) i = rand() & 7; hud_drawpal(i + weapon_xoffset - 4 + 140 - look_anghalf,i + looking_arc - (kickback_pic / 2.) + 208 - gun_pos, CHAINGUN + 5 + ((*kb - 4) / 5),shade,o,pal); - if (p->GetActor()->s.pal != 1) i = rand() & 7; + if (p->GetActor()->s->pal != 1) i = rand() & 7; hud_drawpal(i + weapon_xoffset - 4 + 184 - look_anghalf,i + looking_arc - (kickback_pic / 2.) + 208 - gun_pos, CHAINGUN + 5 + ((*kb - 4) / 5),shade,o,pal); } if (*kb < 8) @@ -922,7 +922,7 @@ void displayweapon_d(int snum, double smoothratio) { char cat_frames[] = { 0,0,1,1,2,2 }; - if (p->GetActor()->s.pal != 1) + if (p->GetActor()->s->pal != 1) { weapon_xoffset += rand() & 3; looking_arc += rand() & 3; @@ -972,7 +972,7 @@ void displayweapon_d(int snum, double smoothratio) else { // the 'active' display. - if (p->GetActor()->s.pal != 1) + if (p->GetActor()->s->pal != 1) { weapon_xoffset += rand() & 3; gun_pos += (rand() & 3); @@ -1044,7 +1044,7 @@ void displayweapon_d(int snum, double smoothratio) } else { - if (p->GetActor()->s.pal != 1) + if (p->GetActor()->s->pal != 1) { weapon_xoffset += rand() & 3; gun_pos += (rand() & 3); @@ -1133,7 +1133,7 @@ void displayweapon_d(int snum, double smoothratio) } else { - if (p->GetActor()->s.pal != 1) + if (p->GetActor()->s->pal != 1) { weapon_xoffset += rand() & 3; gun_pos += (rand() & 3); @@ -1177,7 +1177,7 @@ void displayweapon_d(int snum, double smoothratio) else { static const uint8_t cat_frames[] = { 0, 0, 1, 1, 2, 2 }; - if (p->GetActor()->s.pal != 1) + if (p->GetActor()->s->pal != 1) { weapon_xoffset += krand() & 1; looking_arc += krand() & 1; diff --git a/source/games/duke/src/hudweapon_r.cpp b/source/games/duke/src/hudweapon_r.cpp index bc0ccc761..d592460db 100644 --- a/source/games/duke/src/hudweapon_r.cpp +++ b/source/games/duke/src/hudweapon_r.cpp @@ -137,7 +137,7 @@ void displayweapon_r(int snum, double smoothratio) looking_arc = p->angle.looking_arc(cl_hudinterpolation, smoothratio); hard_landing *= 8.; - gun_pos -= fabs(p->GetActor()->s.xrepeat < 8 ? bsinf(weapon_sway * 4., -9) : bsinf(weapon_sway * 0.5, -10)); + gun_pos -= fabs(p->GetActor()->s->xrepeat < 8 ? bsinf(weapon_sway * 4., -9) : bsinf(weapon_sway * 0.5, -10)); gun_pos -= hard_landing; weapon_xoffset = (160)-90; @@ -147,12 +147,12 @@ void displayweapon_r(int snum, double smoothratio) if (shadedsector[p->cursectnum] == 1) shade = 16; else - shade = p->GetActor()->s.shade; + shade = p->GetActor()->s->shade; if(shade > 24) shade = 24; - pal = p->GetActor()->s.pal == 1 ? 1 : pal = sector[p->cursectnum].floorpal; + pal = p->GetActor()->s->pal == 1 ? 1 : pal = sector[p->cursectnum].floorpal; - if(p->newOwner != nullptr || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->s.pal != 1 && p->GetActor()->s.extra <= 0)) + if(p->newOwner != nullptr || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->s->pal != 1 && p->GetActor()->s->extra <= 0)) return; if(p->last_weapon >= 0) @@ -162,7 +162,7 @@ void displayweapon_r(int snum, double smoothratio) j = 14-p->quick_kick; if(j != 14) { - if(p->GetActor()->s.pal == 1) + if(p->GetActor()->s->pal == 1) pal = 1; else pal = p->palookup; @@ -289,12 +289,12 @@ void displayweapon_r(int snum, double smoothratio) return; } - if (p->GetActor()->s.xrepeat < 8) + if (p->GetActor()->s->xrepeat < 8) { static int fistsign; if (p->jetpack_on == 0) { - i = p->GetActor()->s.xvel; + i = p->GetActor()->s->xvel; looking_arc += 32 - (i >> 1); fistsign += i >> 1; } @@ -599,7 +599,7 @@ void displayweapon_r(int snum, double smoothratio) if (*kb > 0) gun_pos -= bsinf((*kb) << 7, -12); - if (*kb > 0 && p->GetActor()->s.pal != 1) weapon_xoffset += 1 - (rand() & 3); + if (*kb > 0 && p->GetActor()->s->pal != 1) weapon_xoffset += 1 - (rand() & 3); switch (*kb) { @@ -812,7 +812,7 @@ void displayweapon_r(int snum, double smoothratio) } else { - if (p->GetActor()->s.pal != 1) + if (p->GetActor()->s->pal != 1) { weapon_xoffset += rand() & 3; gun_pos += (rand() & 3); diff --git a/source/games/duke/src/inlines.h b/source/games/duke/src/inlines.h index 10a8bb6af..90286e98b 100644 --- a/source/games/duke/src/inlines.h +++ b/source/games/duke/src/inlines.h @@ -39,7 +39,7 @@ inline int bossguy(spritetype const* const pSprite) inline int actorflag(DDukeActor * actor, int mask) { - return (((gs.actorinfo[actor->s.picnum].flags) & mask) != 0); + return (((gs.actorinfo[actor->s->picnum].flags) & mask) != 0); } inline int actorfella(DDukeActor* actor) @@ -70,14 +70,14 @@ inline void settileflag(int flag, const std::initializer_list& types) inline bool wallswitchcheck(DDukeActor* s) { - return !!(gs.tileinfo[s->s.picnum].flags & TFLAG_WALLSWITCH); + return !!(gs.tileinfo[s->s->picnum].flags & TFLAG_WALLSWITCH); } inline int checkcursectnums(int se) { int i; for(i=connecthead;i>=0;i=connectpoint2[i]) - if(ps[i].GetActor() && ps[i].GetActor()->s.sectnum == se ) return i; + if(ps[i].GetActor() && ps[i].GetActor()->s->sectnum == se ) return i; return -1; } diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index 85f0d9f8a..a36acd2cb 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -76,18 +76,18 @@ void hud_input(int plnum) { if (PlayerInput(plnum, SB_QUICK_KICK) && p->last_pissed_time == 0) { - if (!isRRRA() || p->GetActor()->s.extra > 0) + if (!isRRRA() || p->GetActor()->s->extra > 0) { p->last_pissed_time = 4000; S_PlayActorSound(437, pact); - if (p->GetActor()->s.extra <= gs.max_player_health - gs.max_player_health / 10) + if (p->GetActor()->s->extra <= gs.max_player_health - gs.max_player_health / 10) { - p->GetActor()->s.extra += 2; - p->last_extra = p->GetActor()->s.extra; + p->GetActor()->s->extra += 2; + p->last_extra = p->GetActor()->s->extra; p->resurrected = true; } - else if (p->GetActor()->s.extra < gs.max_player_health) - p->GetActor()->s.extra = gs.max_player_health; + else if (p->GetActor()->s->extra < gs.max_player_health) + p->GetActor()->s->extra = gs.max_player_health; } } } @@ -115,7 +115,7 @@ void hud_input(int plnum) // Don't go on if paused or dead. if (paused) return; - if (p->GetActor()->s.extra <= 0) return; + if (p->GetActor()->s->extra <= 0) return; // Activate an inventory item. This just forwards to the other inventory bits. If the inventory selector was taken out of the playsim this could be removed. if (PlayerInput(plnum, SB_INVUSE) && p->newOwner == nullptr) @@ -289,8 +289,8 @@ void hud_input(int plnum) p->posz + (30 << 8), TILE_APLAYER, -64, 0, 0, p->angle.ang.asbuild(), 0, 0, nullptr, 10); pactor->temp_data[3] = pactor->temp_data[4] = 0; p->holoduke_on = pactor; - pactor->s.yvel = plnum; - pactor->s.extra = 0; + pactor->s->yvel = plnum; + pactor->s->extra = 0; FTA(QUOTE_HOLODUKE_ON, p); S_PlayActorSound(TELEPORTER, p->holoduke_on); } @@ -306,12 +306,12 @@ void hud_input(int plnum) } else // In RR this means drinking whiskey. { - if (p->holoduke_amount > 0 && p->GetActor()->s.extra < gs.max_player_health) + if (p->holoduke_amount > 0 && p->GetActor()->s->extra < gs.max_player_health) { p->holoduke_amount -= 400; - p->GetActor()->s.extra += 5; - if (p->GetActor()->s.extra > gs.max_player_health) - p->GetActor()->s.extra = gs.max_player_health; + p->GetActor()->s->extra += 5; + if (p->GetActor()->s->extra > gs.max_player_health) + p->GetActor()->s->extra = gs.max_player_health; p->drink_amt += 5; p->inven_icon = 3; @@ -339,18 +339,18 @@ void hud_input(int plnum) madenoise(plnum); if (sector[p->cursectnum].lotag == 857) { - if (p->GetActor()->s.extra <= gs.max_player_health) + if (p->GetActor()->s->extra <= gs.max_player_health) { - p->GetActor()->s.extra += 10; - if (p->GetActor()->s.extra >= gs.max_player_health) - p->GetActor()->s.extra = gs.max_player_health; + p->GetActor()->s->extra += 10; + if (p->GetActor()->s->extra >= gs.max_player_health) + p->GetActor()->s->extra = gs.max_player_health; } } else { - if (p->GetActor()->s.extra + 1 <= gs.max_player_health) + if (p->GetActor()->s->extra + 1 <= gs.max_player_health) { - p->GetActor()->s.extra++; + p->GetActor()->s->extra++; } } } @@ -363,21 +363,21 @@ void hud_input(int plnum) OnEvent(EVENT_USEMEDKIT, plnum, nullptr, -1); if (GetGameVarID(g_iReturnVarID, nullptr, plnum) == 0) { - if (p->firstaid_amount > 0 && p->GetActor()->s.extra < gs.max_player_health) + if (p->firstaid_amount > 0 && p->GetActor()->s->extra < gs.max_player_health) { if (!isRR()) { - int j = gs.max_player_health - p->GetActor()->s.extra; + int j = gs.max_player_health - p->GetActor()->s->extra; if ((unsigned int)p->firstaid_amount > j) { p->firstaid_amount -= j; - p->GetActor()->s.extra = gs.max_player_health; + p->GetActor()->s->extra = gs.max_player_health; p->inven_icon = 1; } else { - p->GetActor()->s.extra += p->firstaid_amount; + p->GetActor()->s->extra += p->firstaid_amount; p->firstaid_amount = 0; checkavailinven(p); } @@ -389,19 +389,19 @@ void hud_input(int plnum) if (p->firstaid_amount > j) { p->firstaid_amount -= j; - p->GetActor()->s.extra += j; - if (p->GetActor()->s.extra > gs.max_player_health) - p->GetActor()->s.extra = gs.max_player_health; + p->GetActor()->s->extra += j; + if (p->GetActor()->s->extra > gs.max_player_health) + p->GetActor()->s->extra = gs.max_player_health; p->inven_icon = 1; } else { - p->GetActor()->s.extra += p->firstaid_amount; + p->GetActor()->s->extra += p->firstaid_amount; p->firstaid_amount = 0; checkavailinven(p); } - if (p->GetActor()->s.extra > gs.max_player_health) - p->GetActor()->s.extra = gs.max_player_health; + if (p->GetActor()->s->extra > gs.max_player_health) + p->GetActor()->s->extra = gs.max_player_health; p->drink_amt += 10; if (p->drink_amt <= 100 && !S_CheckActorSoundPlaying(pact, DUKE_USEMEDKIT)) S_PlayActorSound(DUKE_USEMEDKIT, pact); @@ -444,7 +444,7 @@ void hud_input(int plnum) else { // eat cow pie - if (p->jetpack_amount > 0 && p->GetActor()->s.extra < gs.max_player_health) + if (p->jetpack_amount > 0 && p->GetActor()->s->extra < gs.max_player_health) { if (!S_CheckActorSoundPlaying(pact, 429)) S_PlayActorSound(429, pact); @@ -464,12 +464,12 @@ void hud_input(int plnum) p->eat = 100; } - p->GetActor()->s.extra += 5; + p->GetActor()->s->extra += 5; p->inven_icon = 4; - if (p->GetActor()->s.extra > gs.max_player_health) - p->GetActor()->s.extra = gs.max_player_health; + if (p->GetActor()->s->extra > gs.max_player_health) + p->GetActor()->s->extra = gs.max_player_health; if (p->jetpack_amount <= 0) checkavailinven(p); @@ -755,7 +755,7 @@ static void processVehicleInput(player_struct *p, ControlInfo* const hidInput, I input.avel = boatApplyTurn(p, hidInput, kbdLeft, kbdRight, scaleAdjust); } - input.fvel = xs_CRoundToInt(p->MotoSpeed); + input.fvel = clamp(xs_CRoundToInt(p->MotoSpeed), -(MAXVELMOTO >> 3), MAXVELMOTO); input.avel *= BAngToDegree; loc.avel += input.avel; } @@ -766,9 +766,9 @@ static void processVehicleInput(player_struct *p, ControlInfo* const hidInput, I // //--------------------------------------------------------------------------- -static void FinalizeInput(player_struct *p, InputPacket& input, bool vehicle) +static void FinalizeInput(player_struct *p, InputPacket& input) { - if (movementBlocked(p) || p->GetActor()->s.extra <= 0 || (p->dead_flag && !ud.god && !p->resurrected)) + if (movementBlocked(p) || p->GetActor()->s->extra <= 0 || (p->dead_flag && !ud.god && !p->resurrected)) { // neutralize all movement when blocked or in automap follow mode loc.fvel = loc.svel = 0; @@ -777,14 +777,7 @@ static void FinalizeInput(player_struct *p, InputPacket& input, bool vehicle) } else { - if (p->on_crane == nullptr) - { - if (vehicle) - { - loc.fvel = clamp(input.fvel, -(MAXVELMOTO >> 3), MAXVELMOTO); - } - } - else + if (p->on_crane != nullptr) { loc.fvel = input.fvel = 0; loc.svel = input.svel = 0; @@ -833,11 +826,11 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput) processMovement(&input, &loc, hidInput, scaleAdjust, p->drink_amt); } - FinalizeInput(p, input, rrraVehicle); + FinalizeInput(p, input); if (!SyncInput()) { - if (p->GetActor()->s.extra > 0) + if (p->GetActor()->s->extra > 0) { // Do these in the same order as the old code. doslopetilting(p, scaleAdjust); @@ -848,7 +841,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput) p->angle.processhelpers(scaleAdjust); p->horizon.processhelpers(scaleAdjust); - p->GetActor()->s.ang = p->angle.ang.asbuild(); + p->GetActor()->s->ang = p->angle.ang.asbuild(); } if (packet) diff --git a/source/games/duke/src/noise.cpp b/source/games/duke/src/noise.cpp index 8f3bf8487..15baa7c49 100644 --- a/source/games/duke/src/noise.cpp +++ b/source/games/duke/src/noise.cpp @@ -45,7 +45,7 @@ int wakeup(DDukeActor* ac, int snum) player_struct *p; int radius; p = &ps[snum]; - auto spr = &ac->s; + auto spr = ac->s; if (!p->donoise) return 0; if (spr->pal == 30 || spr->pal == 32 || spr->pal == 33 || (isRRRA() && spr->pal == 8)) diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 9f642ed95..fbe1c245e 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -67,8 +67,8 @@ void PlayerColorChanged(void) { pp.palookup = ud.user_pals[myconnectindex] = playercolor2lookup(playercolor); } - if (pp.GetActor()->s.picnum == TILE_APLAYER && pp.GetActor()->s.pal != 1) - pp.GetActor()->s.pal = ud.user_pals[myconnectindex]; + if (pp.GetActor()->s->picnum == TILE_APLAYER && pp.GetActor()->s->pal != 1) + pp.GetActor()->s->pal = ud.user_pals[myconnectindex]; } //--------------------------------------------------------------------------- @@ -100,8 +100,8 @@ void quickkill(struct player_struct* p) SetPlayerPal(p, PalEntry(48, 48, 48, 48)); auto pa = p->GetActor(); - pa->s.extra = 0; - pa->s.cstat |= 32768; + pa->s->extra = 0; + pa->s->cstat |= 32768; if (ud.god == 0) fi.guts(pa, TILE_JIBS6, 8, myconnectindex); return; } @@ -167,7 +167,7 @@ void tracers(int x1, int y1, int z1, int x2, int y2, int z2, int n) int hits(DDukeActor* actor) { - auto sp = &actor->s; + auto sp = actor->s; int sx, sy, sz; short sect; short hw; @@ -190,7 +190,7 @@ int hits(DDukeActor* actor) int hitasprite(DDukeActor* actor, DDukeActor** hitsp) { - auto sp = &actor->s; + auto sp = actor->s; int sx, sy, sz, zoff; short sect, hw; @@ -240,7 +240,7 @@ DDukeActor* aim(DDukeActor* actor, int aang) int aimstats[] = { STAT_PLAYER, STAT_DUMMYPLAYER, STAT_ACTOR, STAT_ZOMBIEACTOR }; int dx1, dy1, dx2, dy2, dx3, dy3, smax, sdist; int xv, yv; - auto s = &actor->s; + auto s = actor->s; a = s->ang; @@ -309,7 +309,7 @@ DDukeActor* aim(DDukeActor* actor, int aang) DukeStatIterator it(aimstats[k]); while (auto act = it.Next()) { - auto sp = &act->s; + auto sp = act->s; if (sp->xrepeat > 0 && sp->extra >= 0 && (sp->cstat & (257 + 32768)) == 257) if (badguy(sp) || k < 2) { @@ -381,18 +381,18 @@ void dokneeattack(int snum, const std::initializer_list & respawnlist) fi.guts(p->actorsqu, TILE_JIBS6, 7, myconnectindex); spawn(p->actorsqu, TILE_BLOODPOOL); S_PlayActorSound(SQUISHED, p->actorsqu); - if (isIn(p->actorsqu->s.picnum, respawnlist)) + if (isIn(p->actorsqu->s->picnum, respawnlist)) { - if (p->actorsqu->s.yvel) - fi.operaterespawns(p->actorsqu->s.yvel); + if (p->actorsqu->s->yvel) + fi.operaterespawns(p->actorsqu->s->yvel); } - if (p->actorsqu->s.picnum == TILE_APLAYER) + if (p->actorsqu->s->picnum == TILE_APLAYER) { - quickkill(&ps[p->actorsqu->s.yvel]); - ps[p->actorsqu->s.yvel].frag_ps = snum; + quickkill(&ps[p->actorsqu->s->yvel]); + ps[p->actorsqu->s->yvel].frag_ps = snum; } - else if (badguy(&p->actorsqu->s)) + else if (badguy(p->actorsqu->s)) { deletesprite(p->actorsqu); p->actors_killed++; @@ -415,7 +415,7 @@ int makepainsounds(int snum, int type) { auto p = &ps[snum]; auto actor = p->GetActor(); - auto s = &actor->s; + auto s = actor->s; int k = 0; switch (type) @@ -489,7 +489,7 @@ void footprints(int snum) { auto p = &ps[snum]; auto actor = p->GetActor(); - auto s = &actor->s; + auto s = actor->s; auto psect = s->sectnum; if (p->footprintcount > 0 && p->on_ground) @@ -499,9 +499,9 @@ void footprints(int snum) DukeSectIterator it(psect); while (auto act = it.Next()) { - if (act->s.picnum == TILE_FOOTPRINTS || act->s.picnum == TILE_FOOTPRINTS2 || act->s.picnum == TILE_FOOTPRINTS3 || act->s.picnum == TILE_FOOTPRINTS4) - if (abs(act->s.x - p->posx) < 384) - if (abs(act->s.y - p->posy) < 384) + if (act->s->picnum == TILE_FOOTPRINTS || act->s->picnum == TILE_FOOTPRINTS2 || act->s->picnum == TILE_FOOTPRINTS3 || act->s->picnum == TILE_FOOTPRINTS4) + if (abs(act->s->x - p->posx) < 384) + if (abs(act->s->y - p->posy) < 384) { j = 1; break; @@ -520,8 +520,8 @@ void footprints(int snum) case 2: fprint = spawn(actor, TILE_FOOTPRINTS3); break; default: fprint = spawn(actor, TILE_FOOTPRINTS4); break; } - fprint->s.pal = p->footprintpal; - fprint->s.shade = p->footprintshade; + fprint->s->pal = p->footprintpal; + fprint->s->shade = p->footprintshade; } } } @@ -544,7 +544,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz) { auto p = &ps[snum]; auto actor = p->GetActor(); - auto s = &actor->s; + auto s = actor->s; if (p->dead_flag == 0) { @@ -1002,7 +1002,7 @@ int haskey(int sect, int snum) void shootbloodsplat(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, int atwith, int BIGFORCE, int OOZFILTER, int NEWBEAST) { - spritetype* const s = &actor->s; + spritetype* const s = actor->s; int sect = s->sectnum; int zvel; short hitsect, hitwall; @@ -1037,7 +1037,7 @@ void shootbloodsplat(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i DukeSectIterator it(wall[hitwall].nextsector); while (auto act2 = it.Next()) { - if (act2->s.statnum == STAT_EFFECTOR && act2->s.lotag == SE_13_EXPLOSIVE) + if (act2->s->statnum == STAT_EFFECTOR && act2->s->lotag == SE_13_EXPLOSIVE) return; } } @@ -1049,16 +1049,16 @@ void shootbloodsplat(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i if (wall[hitwall].hitag == 0) { auto spawned = spawn(actor, atwith); - spawned->s.xvel = -12; - spawned->s.ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, wall[hitwall].y - wall[wall[hitwall].point2].y) + 512; - spawned->s.x = hitx; - spawned->s.y = hity; - spawned->s.z = hitz; - spawned->s.cstat |= (krand() & 4); + spawned->s->xvel = -12; + spawned->s->ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, wall[hitwall].y - wall[wall[hitwall].point2].y) + 512; + spawned->s->x = hitx; + spawned->s->y = hity; + spawned->s->z = hitz; + spawned->s->cstat |= (krand() & 4); ssp(spawned, CLIPMASK0); - setsprite(spawned, spawned->s.pos); + setsprite(spawned, spawned->s->pos); if (s->picnum == OOZFILTER || s->picnum == NEWBEAST) - spawned->s.pal = 6; + spawned->s->pal = 6; } } } diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 3d5832434..b3dac8381 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -54,9 +54,9 @@ void incur_damage_d(struct player_struct* p) { int damage = 0L, shield_damage = 0L; - p->GetActor()->s.extra -= p->extra_extra8 >> 8; + p->GetActor()->s->extra -= p->extra_extra8 >> 8; - damage = p->GetActor()->s.extra - p->last_extra; + damage = p->GetActor()->s->extra - p->last_extra; if (damage < 0) { @@ -76,7 +76,7 @@ void incur_damage_d(struct player_struct* p) } } - p->GetActor()->s.extra = p->last_extra + damage; + p->GetActor()->s->extra = p->last_extra + damage; } } @@ -89,7 +89,7 @@ void incur_damage_d(struct player_struct* p) static void shootfireball(DDukeActor *actor, int p, int sx, int sy, int sz, int sa) { - auto s = &actor->s; + auto s = actor->s; int vel, zvel; if (s->extra >= 0) @@ -127,7 +127,7 @@ static void shootfireball(DDukeActor *actor, int p, int sx, int sy, int sz, int } auto spawned = EGS(s->sectnum, sx, sy, sz, FIREBALL, -127, sizx, sizy, sa, vel, zvel, actor, (short)4); - auto spr = &spawned->s; + auto spr = spawned->s; spr->extra += (krand() & 7); if (s->picnum == BOSS5 || p >= 0) { @@ -147,7 +147,7 @@ static void shootfireball(DDukeActor *actor, int p, int sx, int sy, int sz, int static void shootflamethrowerflame(DDukeActor* actor, int p, int sx, int sy, int sz, int sa) { - auto s = &actor->s; + auto s = actor->s; int vel, zvel; if (s->extra >= 0) @@ -182,10 +182,10 @@ static void shootflamethrowerflame(DDukeActor* actor, int p, int sx, int sy, int else { zvel = -MulScale(ps[p].horizon.sum().asq16(), 81, 16); - if (ps[p].GetActor()->s.xvel != 0) + if (ps[p].GetActor()->s->xvel != 0) vel = (int)((((512 - (1024 - abs(abs(getangle(sx - ps[p].oposx, sy - ps[p].oposy) - sa) - 1024))) - * 0.001953125f) * ps[p].GetActor()->s.xvel) + 400); + * 0.001953125f) * ps[p].GetActor()->s->xvel) + 400); if (sector[s->sectnum].lotag == 2 && (krand() % 5) == 0) spawned = spawn(actor, WATERBUBBLE); } @@ -193,30 +193,30 @@ static void shootflamethrowerflame(DDukeActor* actor, int p, int sx, int sy, int if (spawned == nullptr) { spawned = spawn(actor, FLAMETHROWERFLAME); - spawned->s.xvel = (short)vel; - spawned->s.zvel = (short)zvel; + spawned->s->xvel = (short)vel; + spawned->s->zvel = (short)zvel; } - spawned->s.x = sx + bsin(sa + 630) / 448; - spawned->s.y = sy + bsin(sa + 112) / 448; - spawned->s.z = sz - 256; - spawned->s.sectnum = s->sectnum; - spawned->s.cstat = 0x80; - spawned->s.ang = sa; - spawned->s.xrepeat = 2; - spawned->s.yrepeat = 2; - spawned->s.clipdist = 40; - spawned->s.yvel = p; + spawned->s->x = sx + bsin(sa + 630) / 448; + spawned->s->y = sy + bsin(sa + 112) / 448; + spawned->s->z = sz - 256; + spawned->s->sectnum = s->sectnum; + spawned->s->cstat = 0x80; + spawned->s->ang = sa; + spawned->s->xrepeat = 2; + spawned->s->yrepeat = 2; + spawned->s->clipdist = 40; + spawned->s->yvel = p; spawned->SetOwner(actor); if (p == -1) { if (s->picnum == BOSS5) { - spawned->s.x -= bsin(sa) / 56; - spawned->s.y += bcos(sa) / 56; - spawned->s.xrepeat = 10; - spawned->s.yrepeat = 10; + spawned->s->x -= bsin(sa) / 56; + spawned->s->y += bcos(sa) / 56; + spawned->s->xrepeat = 10; + spawned->s->yrepeat = 10; } } } @@ -229,7 +229,7 @@ static void shootflamethrowerflame(DDukeActor* actor, int p, int sx, int sy, int static void shootknee(DDukeActor* actor, int p, int sx, int sy, int sz, int sa) { - auto s = &actor->s; + auto s = actor->s; int sect = s->sectnum; int zvel; short hitsect, hitwall; @@ -246,8 +246,8 @@ static void shootknee(DDukeActor* actor, int p, int sx, int sy, int sz, int sa) { int x; auto pactor = ps[findplayer(actor, &x)].GetActor(); - zvel = ((pactor->s.z - sz) << 8) / (x + 1); - sa = getangle(pactor->s.x - sx, pactor->s.y - sy); + zvel = ((pactor->s->z - sz) << 8) / (x + 1); + sa = getangle(pactor->s->x - sx, pactor->s->y - sy); } hitscan(sx, sy, sz, sect, @@ -263,18 +263,18 @@ static void shootknee(DDukeActor* actor, int p, int sx, int sy, int sz, int sa) if (hitwall >= 0 || hitsprt) { auto knee = EGS(hitsect, hitx, hity, hitz, KNEE, -15, 0, 0, sa, 32, 0, actor, 4); - knee->s.extra += (krand() & 7); + knee->s->extra += (krand() & 7); if (p >= 0) { auto k = spawn(knee, SMALLSMOKE); - k->s.z -= (8 << 8); + k->s->z -= (8 << 8); S_PlayActorSound(KICK_HIT, knee); } if (p >= 0 && ps[p].steroids_amount > 0 && ps[p].steroids_amount < 400) - knee->s.extra += (gs.max_player_health >> 2); + knee->s->extra += (gs.max_player_health >> 2); - if (hitsprt && hitsprt->s.picnum != ACCESSSWITCH && hitsprt->s.picnum != ACCESSSWITCH2) + if (hitsprt && hitsprt->s->picnum != ACCESSSWITCH && hitsprt->s->picnum != ACCESSSWITCH2) { fi.checkhitsprite(hitsprt, knee); if (p >= 0) fi.checkhitswitch(p, -1, hitsprt); @@ -297,12 +297,12 @@ static void shootknee(DDukeActor* actor, int p, int sx, int sy, int sz, int sa) else if (p >= 0 && zvel > 0 && sector[hitsect].lotag == 1) { auto splash = spawn(ps[p].GetActor(), WATERSPLASH2); - splash->s.x = hitx; - splash->s.y = hity; - splash->s.ang = ps[p].angle.ang.asbuild(); // Total tweek - splash->s.xvel = 32; + splash->s->x = hitx; + splash->s->y = hity; + splash->s->ang = ps[p].angle.ang.asbuild(); // Total tweek + splash->s->xvel = 32; ssp(actor, CLIPMASK0); - splash->s.xvel = 0; + splash->s->xvel = 0; } } @@ -316,7 +316,7 @@ static void shootknee(DDukeActor* actor, int p, int sx, int sy, int sz, int sa) static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, int atwith) { - auto s = &actor->s; + auto s = actor->s; int sect = s->sectnum; int zvel; short hitsect, hitwall; @@ -338,8 +338,8 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa if (aimed) { - int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) + (5 << 8); - switch (aimed->s.picnum) + int dal = ((aimed->s->xrepeat * tileHeight(aimed->s->picnum)) << 1) + (5 << 8); + switch (aimed->s->picnum) { case GREENSLIME: case GREENSLIME + 1: @@ -353,8 +353,8 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa dal -= (8 << 8); break; } - zvel = ((aimed->s.z - sz - dal) << 8) / ldist(ps[p].GetActor(), aimed); - sa = getangle(aimed->s.x - sx, aimed->s.y - sy); + zvel = ((aimed->s->z - sz - dal) << 8) / ldist(ps[p].GetActor(), aimed); + sa = getangle(aimed->s->x - sx, aimed->s->y - sy); } if (isWW2GI()) @@ -419,8 +419,8 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa if (p >= 0) { spark = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 10, 10, sa, 0, 0, actor, 4); - spark->s.extra = ScriptCode[gs.actorinfo[atwith].scriptaddress]; - spark->s.extra += (krand() % 6); + spark->s->extra = ScriptCode[gs.actorinfo[atwith].scriptaddress]; + spark->s->extra += (krand() % 6); if (hitwall == -1 && hitact == nullptr) { @@ -428,8 +428,8 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa { if (sector[hitsect].ceilingstat & 1) { - spark->s.xrepeat = 0; - spark->s.yrepeat = 0; + spark->s->xrepeat = 0; + spark->s->yrepeat = 0; return; } else @@ -441,26 +441,26 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa if (hitact) { fi.checkhitsprite(hitact, spark); - if (hitact->s.picnum == TILE_APLAYER && (ud.coop != 1 || ud.ffire == 1)) + if (hitact->s->picnum == TILE_APLAYER && (ud.coop != 1 || ud.ffire == 1)) { auto jib = spawn(spark, JIBS6); - spark->s.xrepeat = spark->s.yrepeat = 0; - jib->s.z += (4 << 8); - jib->s.xvel = 16; - jib->s.xrepeat = jib->s.yrepeat = 24; - jib->s.ang += 64 - (krand() & 127); + spark->s->xrepeat = spark->s->yrepeat = 0; + jib->s->z += (4 << 8); + jib->s->xvel = 16; + jib->s->xrepeat = jib->s->yrepeat = 24; + jib->s->ang += 64 - (krand() & 127); } else spawn(spark, SMALLSMOKE); if (p >= 0 && ( - hitact->s.picnum == DIPSWITCH || - hitact->s.picnum == DIPSWITCH + 1 || - hitact->s.picnum == DIPSWITCH2 || - hitact->s.picnum == DIPSWITCH2 + 1 || - hitact->s.picnum == DIPSWITCH3 || - hitact->s.picnum == DIPSWITCH3 + 1 || - hitact->s.picnum == HANDSWITCH || - hitact->s.picnum == HANDSWITCH + 1)) + hitact->s->picnum == DIPSWITCH || + hitact->s->picnum == DIPSWITCH + 1 || + hitact->s->picnum == DIPSWITCH2 || + hitact->s->picnum == DIPSWITCH2 + 1 || + hitact->s->picnum == DIPSWITCH3 || + hitact->s->picnum == DIPSWITCH3 + 1 || + hitact->s->picnum == HANDSWITCH || + hitact->s->picnum == HANDSWITCH + 1)) { fi.checkhitswitch(p, -1, hitact); return; @@ -500,7 +500,7 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa DukeSectIterator it(wall[hitwall].nextsector); while (auto l = it.Next()) { - if (l->s.statnum == 3 && l->s.lotag == 13) + if (l->s->statnum == 3 && l->s->lotag == 13) goto SKIPBULLETHOLE; } } @@ -508,13 +508,13 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa DukeStatIterator it(STAT_MISC); while (auto l = it.Next()) { - if (l->s.picnum == BULLETHOLE) + if (l->s->picnum == BULLETHOLE) if (dist(l, spark) < (12 + (krand() & 7))) goto SKIPBULLETHOLE; } auto hole = spawn(spark, BULLETHOLE); - hole->s.xvel = -1; - hole->s.ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, + hole->s->xvel = -1; + hole->s->ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, wall[hitwall].y - wall[wall[hitwall].point2].y) + 512; ssp(hole, CLIPMASK0); } @@ -532,14 +532,14 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa else { spark = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 24, 24, sa, 0, 0, actor, 4); - spark->s.extra = ScriptCode[gs.actorinfo[atwith].scriptaddress]; + spark->s->extra = ScriptCode[gs.actorinfo[atwith].scriptaddress]; if (hitact) { fi.checkhitsprite(hitact, spark); - if (hitact->s.picnum != TILE_APLAYER) + if (hitact->s->picnum != TILE_APLAYER) spawn(spark, SMALLSMOKE); - else spark->s.xrepeat = spark->s.yrepeat = 0; + else spark->s->xrepeat = spark->s->yrepeat = 0; } else if (hitwall >= 0) fi.checkhitwall(spark, hitwall, hitx, hity, hitz, SHOTSPARK1); @@ -560,7 +560,7 @@ static void shootweapon(DDukeActor *actor, int p, int sx, int sy, int sz, int sa static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, int atwith) { - spritetype* const s = &actor->s; + spritetype* const s = actor->s; int sect = s->sectnum; int vel, zvel; short l, scount; @@ -590,9 +590,9 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, if (aimed) { - int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) - (12 << 8); - zvel = ((aimed->s.z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed); - sa = getangle(aimed->s.x - sx, aimed->s.y - sy); + int dal = ((aimed->s->xrepeat * tileHeight(aimed->s->picnum)) << 1) - (12 << 8); + zvel = ((aimed->s->z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed); + sa = getangle(aimed->s->x - sx, aimed->s->y - sy); } else zvel = -MulScale(ps[p].horizon.sum().asq16(), 98, 16); @@ -638,23 +638,23 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, while (scount > 0) { auto spawned = EGS(sect, sx, sy, sz, atwith, -127, sizx, sizy, sa, vel, zvel, actor, 4); - spawned->s.extra += (krand() & 7); + spawned->s->extra += (krand() & 7); if (atwith == COOLEXPLOSION1) { - spawned->s.shade = 0; + spawned->s->shade = 0; if (s->picnum == BOSS2) { - l = spawned->s.xvel; - spawned->s.xvel = 1024; + l = spawned->s->xvel; + spawned->s->xvel = 1024; ssp(spawned, CLIPMASK0); - spawned->s.xvel = l; - spawned->s.ang += 128 - (krand() & 255); + spawned->s->xvel = l; + spawned->s->ang += 128 - (krand() & 255); } } - spawned->s.cstat = 128; - spawned->s.clipdist = 4; + spawned->s->cstat = 128; + spawned->s->clipdist = 4; sa = s->ang + 32 - (krand() & 63); zvel = oldzvel + 512 - (krand() & 1023); @@ -671,7 +671,7 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, static void shootrpg(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, int atwith) { - auto s = &actor->s; + auto s = actor->s; int sect = s->sectnum; int vel, zvel; short l, scount; @@ -688,10 +688,10 @@ static void shootrpg(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, i aimed = aim(actor, 48); if (aimed) { - int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) + (8 << 8); - zvel = ((aimed->s.z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed); - if (aimed->s.picnum != RECON) - sa = getangle(aimed->s.x - sx, aimed->s.y - sy); + int dal = ((aimed->s->xrepeat * tileHeight(aimed->s->picnum)) << 1) + (8 << 8); + zvel = ((aimed->s->z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed); + if (aimed->s->picnum != RECON) + sa = getangle(aimed->s->x - sx, aimed->s->y - sy); } else zvel = -MulScale(ps[p].horizon.sum().asq16(), 81, 16); if (atwith == RPG) @@ -707,7 +707,7 @@ static void shootrpg(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, i { int zoffs = (32 << 8); if (isWorldTour()) // Twentieth Anniversary World Tour - zoffs = (int)((actor->s.yrepeat / 80.0f) * zoffs); + zoffs = (int)((actor->s->yrepeat / 80.0f) * zoffs); sz -= zoffs; } else if (s->picnum == BOSS2) @@ -715,7 +715,7 @@ static void shootrpg(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, i vel += 128; int zoffs = 24 << 8; if (isWorldTour()) // Twentieth Anniversary World Tour - zoffs = (int)((actor->s.yrepeat / 80.0f) * zoffs); + zoffs = (int)((actor->s->yrepeat / 80.0f) * zoffs); sz += zoffs; } @@ -732,7 +732,7 @@ static void shootrpg(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, i sy + (bsin(sa + 348) / 448), sz - (1 << 8), atwith, 0, 14, 14, sa, vel, zvel, actor, 4); - auto spj = &spawned->s; + auto spj = spawned->s; spj->extra += (krand() & 7); if (atwith != FREEZEBLAST) spawned->temp_actor = aimed; @@ -761,7 +761,7 @@ static void shootrpg(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, i if (isWorldTour()) // Twentieth Anniversary World Tour { - float siz = actor->s.yrepeat / 80.0f; + float siz = actor->s->yrepeat / 80.0f; xoffs *= siz; yoffs *= siz; aoffs *= siz; @@ -781,7 +781,7 @@ static void shootrpg(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, i int aoffs = 8 + (krand() & 255) - 128; if (isWorldTour()) { // Twentieth Anniversary World Tour - int siz = actor->s.yrepeat; + int siz = actor->s->yrepeat; xoffs = Scale(xoffs, siz, 80); yoffs = Scale(yoffs, siz, 80); aoffs = Scale(aoffs, siz, 80); @@ -842,7 +842,7 @@ static void shootrpg(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, i static void shootlaser(DDukeActor* actor, int p, int sx, int sy, int sz, int sa) { - spritetype* const s = &actor->s; + spritetype* const s = actor->s; int sect = s->sectnum; int zvel; short hitsect, hitwall, j; @@ -884,7 +884,7 @@ static void shootlaser(DDukeActor* actor, int p, int sx, int sy, int sz, int sa) int lLifetime = GetGameVar("STICKYBOMB_LIFETIME", NAM_GRENADE_LIFETIME, nullptr, p); int lLifetimeVar = GetGameVar("STICKYBOMB_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, nullptr, p); // set timer. blows up when at zero.... - bomb->s.extra = lLifetime + bomb->s->extra = lLifetime + MulScale(krand(), lLifetimeVar, 14) - lLifetimeVar; } @@ -893,12 +893,12 @@ static void shootlaser(DDukeActor* actor, int p, int sx, int sy, int sz, int sa) // this originally used the sprite index as tag to link the laser segments. // This value is never used again to reference an actor by index. Decouple this for robustness. ud.bomb_tag = (ud.bomb_tag + 1) & 32767; - bomb->s.hitag = ud.bomb_tag; + bomb->s->hitag = ud.bomb_tag; S_PlayActorSound(LASERTRIP_ONWALL, bomb); - bomb->s.xvel = -20; + bomb->s->xvel = -20; ssp(bomb, CLIPMASK0); - bomb->s.cstat = 16; - bomb->temp_data[5] = bomb->s.ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, wall[hitwall].y - wall[wall[hitwall].point2].y) - 512; + bomb->s->cstat = 16; + bomb->temp_data[5] = bomb->s->ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, wall[hitwall].y - wall[wall[hitwall].point2].y) - 512; if (p >= 0) ps[p].ammo_amount[TRIPBOMB_WEAPON]--; @@ -913,7 +913,7 @@ static void shootlaser(DDukeActor* actor, int p, int sx, int sy, int sz, int sa) static void shootgrowspark(DDukeActor* actor, int p, int sx, int sy, int sz, int sa) { - auto s = &actor->s; + auto s = actor->s; int sect = s->sectnum; int zvel; short hitsect, hitwall, k; @@ -925,8 +925,8 @@ static void shootgrowspark(DDukeActor* actor, int p, int sx, int sy, int sz, int auto aimed = aim(actor, AUTO_AIM_ANGLE); if (aimed) { - int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) + (5 << 8); - switch (aimed->s.picnum) + int dal = ((aimed->s->xrepeat * tileHeight(aimed->s->picnum)) << 1) + (5 << 8); + switch (aimed->s->picnum) { case GREENSLIME: case GREENSLIME + 1: @@ -940,8 +940,8 @@ static void shootgrowspark(DDukeActor* actor, int p, int sx, int sy, int sz, int dal -= (8 << 8); break; } - zvel = ((aimed->s.z - sz - dal) << 8) / (ldist(ps[p].GetActor(), aimed)); - sa = getangle(aimed->s.x - sx, aimed->s.y - sy); + zvel = ((aimed->s->z - sz - dal) << 8) / (ldist(ps[p].GetActor(), aimed)); + sa = getangle(aimed->s->x - sx, aimed->s->y - sy); } else { @@ -974,9 +974,9 @@ static void shootgrowspark(DDukeActor* actor, int p, int sx, int sy, int sz, int auto spark = EGS(sect, hitx, hity, hitz, GROWSPARK, -16, 28, 28, sa, 0, 0, actor, 1); - spark->s.pal = 2; - spark->s.cstat |= 130; - spark->s.xrepeat = spark->s.yrepeat = 1; + spark->s->pal = 2; + spark->s->cstat |= 130; + spark->s->xrepeat = spark->s->yrepeat = 1; if (hitwall == -1 && hitsprt == nullptr && hitsect >= 0) { @@ -998,7 +998,7 @@ static void shootgrowspark(DDukeActor* actor, int p, int sx, int sy, int sz, int void shoot_d(DDukeActor* actor, int atwith) { - spritetype* const s = &actor->s; + spritetype* const s = actor->s; short sect, l, j; int sx, sy, sz, sa, p, vel, zvel, x, dal; @@ -1065,13 +1065,13 @@ void shoot_d(DDukeActor* actor, int atwith) case FIREFLY: // BOSS5 shot { auto k = spawn(actor, atwith); - k->s.sectnum = sect; - k->s.x = sx; - k->s.y = sy; - k->s.z = sz; - k->s.ang = sa; - k->s.xvel = 500; - k->s.zvel = 0; + k->s->sectnum = sect; + k->s->x = sx; + k->s->y = sy; + k->s->z = sz; + k->s->ang = sa; + k->s->xvel = 500; + k->s->zvel = 0; return; } } @@ -1145,9 +1145,9 @@ void shoot_d(DDukeActor* actor, int atwith) auto aimed = isNamWW2GI() ? nullptr : aim(actor, AUTO_AIM_ANGLE); if (aimed) { - dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1); - zvel = ((aimed->s.z - sz - dal - (4 << 8)) * 768) / (ldist(ps[p].GetActor(), aimed)); - sa = getangle(aimed->s.x - sx, aimed->s.y - sy); + dal = ((aimed->s->xrepeat * tileHeight(aimed->s->picnum)) << 1); + zvel = ((aimed->s->z - sz - dal - (4 << 8)) * 768) / (ldist(ps[p].GetActor(), aimed)); + sa = getangle(aimed->s->x - sx, aimed->s->y - sy); } else zvel = -MulScale(ps[p].horizon.sum().asq16(), 98, 16); } @@ -1164,8 +1164,8 @@ void shoot_d(DDukeActor* actor, int atwith) sy + bcos(sa, -12), sz + (2 << 8), SHRINKSPARK, -16, 28, 28, sa, 768, zvel, actor, 4); - j->s.cstat = 128; - j->s.clipdist = 32; + j->s->cstat = 128; + j->s->clipdist = 32; return; @@ -1184,7 +1184,7 @@ void selectweapon_d(int snum, int weap) // playernum, weaponnum { int i, j, k; auto p = &ps[snum]; - if (p->last_pissed_time <= (26 * 218) && p->show_empty_weapon == 0 && p->kickback_pic == 0 && p->quick_kick == 0 && p->GetActor()->s.xrepeat > 32 && p->access_incs == 0 && p->knee_incs == 0) + if (p->last_pissed_time <= (26 * 218) && p->show_empty_weapon == 0 && p->kickback_pic == 0 && p->quick_kick == 0 && p->GetActor()->s->xrepeat > 32 && p->access_incs == 0 && p->knee_incs == 0) { if ((p->weapon_pos == 0 || (p->holster_weapon && p->weapon_pos == -9))) { @@ -1313,7 +1313,7 @@ void selectweapon_d(int snum, int weap) // playernum, weaponnum DukeStatIterator it(STAT_ACTOR); while (auto act = it.Next()) { - if (act->s.picnum == HEAVYHBOMB && act->GetOwner() == p->GetActor()) + if (act->s->picnum == HEAVYHBOMB && act->GetOwner() == p->GetActor()) { p->gotweapon.Set(HANDBOMB_WEAPON); j = HANDREMOTE_WEAPON; @@ -1435,7 +1435,7 @@ int doincrements_d(struct player_struct* p) int snum; auto pact = p->GetActor(); - snum = pact->s.yvel; + snum = pact->s->yvel; p->player_par++; @@ -1517,7 +1517,7 @@ int doincrements_d(struct player_struct* p) } } - if (p->quick_kick > 0 && p->GetActor()->s.pal != 1) + if (p->quick_kick > 0 && p->GetActor()->s->pal != 1) { p->last_quick_kick = p->quick_kick + 1; p->quick_kick--; @@ -1527,17 +1527,17 @@ int doincrements_d(struct player_struct* p) else if (p->last_quick_kick > 0) p->last_quick_kick--; - if (p->access_incs && p->GetActor()->s.pal != 1) + if (p->access_incs && p->GetActor()->s->pal != 1) { p->access_incs++; - if (p->GetActor()->s.extra <= 0) + if (p->GetActor()->s->extra <= 0) p->access_incs = 12; if (p->access_incs == 12) { if (p->access_spritenum != nullptr) { fi.checkhitswitch(snum, -1, p->access_spritenum); - switch (p->access_spritenum->s.pal) + switch (p->access_spritenum->s->pal) { case 0:p->got_access &= (0xffff - 0x1); break; case 21:p->got_access &= (0xffff - 0x2); break; @@ -1634,7 +1634,7 @@ void checkweapons_d(struct player_struct* p) if (isWW2GI()) { - int snum = p->GetActor()->s.yvel; + int snum = p->GetActor()->s->yvel; cw = aplWeaponWorksLike[p->curr_weapon][snum]; } else @@ -1809,8 +1809,8 @@ static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int else if (p->falling_counter > 9) { j = p->falling_counter; - pact->s.extra -= j - (krand() & 3); - if (pact->s.extra <= 0) + pact->s->extra -= j - (krand() & 3); + if (pact->s->extra <= 0) { S_PlayActorSound(SQUISHED, pact); SetPlayerPal(p, PalEntry(63, 63, 0, 0)); @@ -1987,11 +1987,11 @@ static void underwater(int snum, ESyncBits actions, int psect, int fz, int cz) if (p->scuba_on && (krand() & 255) < 8) { auto j = spawn(pact, WATERBUBBLE); - j->s.x += bcos(p->angle.ang.asbuild() + 64 - (global_random & 128), -6); - j->s.y += bsin(p->angle.ang.asbuild() + 64 - (global_random & 128), -6); - j->s.xrepeat = 3; - j->s.yrepeat = 2; - j->s.z = p->posz + (8 << 8); + j->s->x += bcos(p->angle.ang.asbuild() + 64 - (global_random & 128), -6); + j->s->y += bsin(p->angle.ang.asbuild() + 64 - (global_random & 128), -6); + j->s->xrepeat = 3; + j->s->yrepeat = 2; + j->s->z = p->posz + (8 << 8); } } @@ -2028,7 +2028,7 @@ int operateTripbomb(int snum) DukeSectIterator it(sect); while (j = it.Next()) { - auto sj = &j->s; + auto sj = j->s; if (sj->picnum == TRIPBOMB && abs(sj->z - sz) < (12 << 8) && ((sj->x - sx) * (sj->x - sx) + (sj->y - sy) * (sj->y - sy)) < (290 * 290)) return 0; @@ -2210,21 +2210,21 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if (isNam()) { - spawned->s.extra = MulScale(krand(), NAM_GRENADE_LIFETIME_VAR, 14); + spawned->s->extra = MulScale(krand(), NAM_GRENADE_LIFETIME_VAR, 14); } if (k == 15) { - spawned->s.yvel = 3; - spawned->s.z += (8 << 8); + spawned->s->yvel = 3; + spawned->s->z += (8 << 8); } k = hits(pact); if (k < 512) { - spawned->s.ang += 1024; - spawned->s.zvel /= 3; - spawned->s.xvel /= 3; + spawned->s->ang += 1024; + spawned->s->zvel /= 3; + spawned->s->xvel /= 3; } p->hbomb_on = 1; @@ -2348,9 +2348,9 @@ static void operateweapon(int snum, ESyncBits actions, int psect) case 24: { auto j = spawn(pact, SHOTGUNSHELL); - j->s.ang += 1024; + j->s->ang += 1024; ssp(j, CLIPMASK0); - j->s.ang += 1024; + j->s->ang += 1024; p->kickback_pic++; break; } @@ -2374,10 +2374,10 @@ static void operateweapon(int snum, ESyncBits actions, int psect) { auto j = spawn(pact, SHELL); - j->s.ang += 1024; - j->s.ang &= 2047; - j->s.xvel += 32; - j->s.z += (3 << 8); + j->s->ang += 1024; + j->s->ang &= 2047; + j->s->xvel += 32; + j->s->z += (3 << 8); ssp(j, CLIPMASK0); } @@ -2527,7 +2527,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) fi.shoot(pact, FREEZEBLAST); checkavailweapon(p); } - if (pact->s.xrepeat < 32) + if (pact->s->xrepeat < 32) { p->okickback_pic = p->kickback_pic = 0; break; } @@ -2627,7 +2627,7 @@ static void processweapon(int snum, ESyncBits actions, int psect) { auto p = &ps[snum]; auto pact = p->GetActor(); - auto s = &pact->s; + auto s = pact->s; int shrunk = (s->yrepeat < 32); // Set maximum for pistol slightly higher if playing with `cl_showmagamount 1`. @@ -2736,7 +2736,7 @@ void processinput_d(int snum) p = &ps[snum]; auto pact = p->GetActor(); - s = &pact->s; + s = pact->s; p->horizon.resetadjustment(); p->angle.resetadjustment(); @@ -2784,7 +2784,7 @@ void processinput_d(int snum) if (chz.type == kHitSprite) { - if (chz.actor->s.statnum == 1 && chz.actor->s.extra >= 0) + if (chz.actor->s->statnum == 1 && chz.actor->s->extra >= 0) { chz.type = kHitNone; chz.actor = nullptr; @@ -2794,15 +2794,15 @@ void processinput_d(int snum) if (clz.type == kHitSprite) { - if ((clz.actor->s.cstat & 33) == 33) + if ((clz.actor->s->cstat & 33) == 33) { psectlotag = 0; p->footprintcount = 0; p->spritebridge = 1; } - else if (badguy(clz.actor) && clz.actor->s.xrepeat > 24 && abs(s->z - clz.actor->s.z) < (84 << 8)) + else if (badguy(clz.actor) && clz.actor->s->xrepeat > 24 && abs(s->z - clz.actor->s->z) < (84 << 8)) { - j = getangle(clz.actor->s.x - p->posx, clz.actor->s.y - p->posy); + j = getangle(clz.actor->s->x - p->posx, clz.actor->s->y - p->posy); p->posxv -= bcos(j, 4); p->posyv -= bsin(j, 4); } @@ -2869,7 +2869,7 @@ void processinput_d(int snum) p->playerweaponsway(s->xvel); s->xvel = clamp(ksqrt((p->posx - p->bobposx) * (p->posx - p->bobposx) + (p->posy - p->bobposy) * (p->posy - p->bobposy)), 0, 512); - if (p->on_ground) p->bobcounter += p->GetActor()->s.xvel >> 1; + if (p->on_ground) p->bobcounter += p->GetActor()->s->xvel >> 1; p->backuppos(ud.clipping == 0 && (sector[p->cursectnum].floorpicnum == MIRROR || p->cursectnum < 0 || p->cursectnum >= MAXSECTORS)); @@ -2963,7 +2963,7 @@ void processinput_d(int snum) case 0: if (clz.type == kHitSprite) - j = clz.actor->s.picnum; + j = clz.actor->s->picnum; else j = sector[psect].floorpicnum; @@ -3079,7 +3079,7 @@ HORIZONLY: if (ud.clipping == 0 && sector[psect].lotag == 31) { auto secact = ScriptIndexToActor(sector[psect].hitag); - if (secact && secact->s.xvel && secact->temp_data[0] == 0) + if (secact && secact->s->xvel && secact->temp_data[0] == 0) { quickkill(p); return; diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 2100376f9..f515066b8 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -46,9 +46,9 @@ void incur_damage_r(struct player_struct* p) int damage = 0, unk = 0, shield_damage = 0; short gut = 0; - p->GetActor()->s.extra -= p->extra_extra8 >> 8; + p->GetActor()->s->extra -= p->extra_extra8 >> 8; - damage = p->GetActor()->s.extra - p->last_extra; + damage = p->GetActor()->s->extra - p->last_extra; if (damage < 0) { p->extra_extra8 = 0; @@ -78,7 +78,7 @@ void incur_damage_r(struct player_struct* p) break; } - p->GetActor()->s.extra = p->last_extra + damage; + p->GetActor()->s->extra = p->last_extra + damage; } } @@ -90,7 +90,7 @@ void incur_damage_r(struct player_struct* p) static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, int atwith) { - spritetype* const s = &actor->s; + spritetype* const s = actor->s; int sect = s->sectnum; int zvel; short hitsect, hitwall; @@ -107,8 +107,8 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, { int x; auto pspr = ps[findplayer(actor, &x)].GetActor(); - zvel = ((pspr->s.z - sz) << 8) / (x + 1); - sa = getangle(pspr->s.x - sx, pspr->s.y - sy); + zvel = ((pspr->s->z - sz) << 8) / (x + 1); + sa = getangle(pspr->s->x - sx, pspr->s->y - sy); } hitscan(sx, sy, sz, sect, @@ -123,21 +123,21 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, while (auto effector = its.Next()) { // shouldn't this only check STAT_EFFECTOR? - if (effector->s.sectnum == hitsect && effector->s.picnum == SECTOREFFECTOR && effector->GetOwner() - && effector->s.lotag == 7) + if (effector->s->sectnum == hitsect && effector->s->picnum == SECTOREFFECTOR && effector->GetOwner() + && effector->s->lotag == 7) { int nx, ny, nz; - nx = hitx + (effector->GetOwner()->s.x - effector->s.x); - ny = hity + (effector->GetOwner()->s.y - effector->s.y); + nx = hitx + (effector->GetOwner()->s->x - effector->s->x); + ny = hity + (effector->GetOwner()->s->y - effector->s->y); if (sector[hitsect].lotag == 161) { - nz = sector[effector->GetOwner()->s.sectnum].floorz; + nz = sector[effector->GetOwner()->s->sectnum].floorz; } else { - nz = sector[effector->GetOwner()->s.sectnum].ceilingz; + nz = sector[effector->GetOwner()->s->sectnum].ceilingz; } - hitscan(nx, ny, nz, effector->GetOwner()->s.sectnum, bcos(sa), bsin(sa), zvel << 6, + hitscan(nx, ny, nz, effector->GetOwner()->s->sectnum, bcos(sa), bsin(sa), zvel << 6, &hitsect, &hitwall, &hitsprt, &hitx, &hity, &hitz, CLIPMASK1); break; } @@ -154,25 +154,25 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, if (isRRRA() && atwith == SLINGBLADE) { wpn = EGS(hitsect, hitx, hity, hitz, SLINGBLADE, -15, 0, 0, sa, 32, 0, actor, 4); - wpn->s.extra += 50; + wpn->s->extra += 50; } else { wpn = EGS(hitsect, hitx, hity, hitz, KNEE, -15, 0, 0, sa, 32, 0, actor, 4); - wpn->s.extra += (krand() & 7); + wpn->s->extra += (krand() & 7); } if (p >= 0) { auto k = spawn(wpn, SMALLSMOKE); - k->s.z -= (8 << 8); + k->s->z -= (8 << 8); if (atwith == KNEE) S_PlayActorSound(KICK_HIT, wpn); else if (isRRRA() && atwith == SLINGBLADE) S_PlayActorSound(260, wpn); } if (p >= 0 && ps[p].steroids_amount > 0 && ps[p].steroids_amount < 400) - wpn->s.extra += (gs.max_player_health >> 2); + wpn->s->extra += (gs.max_player_health >> 2); - if (hitsprt && hitsprt->s.picnum != ACCESSSWITCH && hitsprt->s.picnum != ACCESSSWITCH2) + if (hitsprt && hitsprt->s->picnum != ACCESSSWITCH && hitsprt->s->picnum != ACCESSSWITCH2) { fi.checkhitsprite(hitsprt, wpn); if (p >= 0) fi.checkhitswitch(p, -1, hitsprt); @@ -194,12 +194,12 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, else if (p >= 0 && zvel > 0 && sector[hitsect].lotag == 1) { auto splash = spawn(ps[p].GetActor(), WATERSPLASH2); - splash->s.x = hitx; - splash->s.y = hity; - splash->s.ang = ps[p].angle.ang.asbuild(); // Total tweek - splash->s.xvel = 32; + splash->s->x = hitx; + splash->s->y = hity; + splash->s->ang = ps[p].angle.ang.asbuild(); // Total tweek + splash->s->xvel = 32; ssp(actor, 0); - splash->s.xvel = 0; + splash->s->xvel = 0; } } } @@ -212,7 +212,7 @@ static void shootmelee(DDukeActor *actor, int p, int sx, int sy, int sz, int sa, static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, int atwith) { - auto s = &actor->s; + auto s = actor->s; int sect = s->sectnum; int zvel; short hitsect, hitwall; @@ -226,9 +226,9 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa auto aimed = aim(actor, AUTO_AIM_ANGLE); if (aimed) { - int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) + (5 << 8); - zvel = ((aimed->s.z - sz - dal) << 8) / ldist(ps[p].GetActor(), aimed); - sa = getangle(aimed->s.x - sx, aimed->s.y - sy); + int dal = ((aimed->s->xrepeat * tileHeight(aimed->s->picnum)) << 1) + (5 << 8); + zvel = ((aimed->s->z - sz - dal) << 8) / ldist(ps[p].GetActor(), aimed); + sa = getangle(aimed->s->x - sx, aimed->s->y - sy); } if (atwith == SHOTSPARK1) @@ -280,21 +280,21 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa while (auto effector = its.Next()) { // shouldn't this only check STAT_EFFECTOR? - if (effector->s.sectnum == hitsect && effector->s.picnum == SECTOREFFECTOR && effector->GetOwner() - && effector->s.lotag == 7) + if (effector->s->sectnum == hitsect && effector->s->picnum == SECTOREFFECTOR && effector->GetOwner() + && effector->s->lotag == 7) { int nx, ny, nz; - nx = hitx + (effector->GetOwner()->s.x - effector->s.x); - ny = hity + (effector->GetOwner()->s.y - effector->s.y); + nx = hitx + (effector->GetOwner()->s->x - effector->s->x); + ny = hity + (effector->GetOwner()->s->y - effector->s->y); if (sector[hitsect].lotag == 161) { - nz = sector[effector->GetOwner()->s.sectnum].floorz; + nz = sector[effector->GetOwner()->s->sectnum].floorz; } else { - nz = sector[effector->GetOwner()->s.sectnum].ceilingz; + nz = sector[effector->GetOwner()->s->sectnum].ceilingz; } - hitscan(nx, ny, nz, effector->GetOwner()->s.sectnum, bcos(sa), bsin(sa), zvel << 6, + hitscan(nx, ny, nz, effector->GetOwner()->s->sectnum, bcos(sa), bsin(sa), zvel << 6, &hitsect, &hitwall, &hitsprt, &hitx, &hity, &hitz, CLIPMASK1); break; } @@ -317,8 +317,8 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa if (p >= 0) { spark = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 10, 10, sa, 0, 0, actor, 4); - spark->s.extra = ScriptCode[gs.actorinfo[atwith].scriptaddress]; - spark->s.extra += (krand() % 6); + spark->s->extra = ScriptCode[gs.actorinfo[atwith].scriptaddress]; + spark->s->extra += (krand() % 6); if (hitwall == -1 && hitsprt == nullptr) { @@ -326,8 +326,8 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa { if (sector[hitsect].ceilingstat & 1) { - spark->s.xrepeat = 0; - spark->s.yrepeat = 0; + spark->s->xrepeat = 0; + spark->s->yrepeat = 0; return; } else @@ -339,30 +339,30 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa if (hitsprt) { - if (hitsprt->s.picnum == 1930) + if (hitsprt->s->picnum == 1930) return; fi.checkhitsprite(hitsprt, spark); - if (hitsprt->s.picnum == TILE_APLAYER && (ud.coop != 1 || ud.ffire == 1)) + if (hitsprt->s->picnum == TILE_APLAYER && (ud.coop != 1 || ud.ffire == 1)) { auto l = spawn(spark, JIBS6); - spark->s.xrepeat = spark->s.yrepeat = 0; - l->s.z += (4 << 8); - l->s.xvel = 16; - l->s.xrepeat = l->s.yrepeat = 24; - l->s.ang += 64 - (krand() & 127); + spark->s->xrepeat = spark->s->yrepeat = 0; + l->s->z += (4 << 8); + l->s->xvel = 16; + l->s->xrepeat = l->s->yrepeat = 24; + l->s->ang += 64 - (krand() & 127); } else spawn(spark, SMALLSMOKE); if (p >= 0 && ( - hitsprt->s.picnum == DIPSWITCH || - hitsprt->s.picnum == DIPSWITCH + 1 || - hitsprt->s.picnum == DIPSWITCH2 || - hitsprt->s.picnum == DIPSWITCH2 + 1 || - hitsprt->s.picnum == DIPSWITCH3 || - hitsprt->s.picnum == DIPSWITCH3 + 1 || - (isRRRA() && hitsprt->s.picnum == RRTILE8660) || - hitsprt->s.picnum == HANDSWITCH || - hitsprt->s.picnum == HANDSWITCH + 1)) + hitsprt->s->picnum == DIPSWITCH || + hitsprt->s->picnum == DIPSWITCH + 1 || + hitsprt->s->picnum == DIPSWITCH2 || + hitsprt->s->picnum == DIPSWITCH2 + 1 || + hitsprt->s->picnum == DIPSWITCH3 || + hitsprt->s->picnum == DIPSWITCH3 + 1 || + (isRRRA() && hitsprt->s->picnum == RRTILE8660) || + hitsprt->s->picnum == HANDSWITCH || + hitsprt->s->picnum == HANDSWITCH + 1)) { fi.checkhitswitch(p, -1, hitsprt); return; @@ -405,7 +405,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa DukeSectIterator it(wall[hitwall].nextsector); while (auto l = it.Next()) { - if (l->s.statnum == 3 && l->s.lotag == 13) + if (l->s->statnum == 3 && l->s->lotag == 13) goto SKIPBULLETHOLE; } } @@ -413,13 +413,13 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa DukeStatIterator it(STAT_MISC); while (auto l = it.Next()) { - if (l->s.picnum == BULLETHOLE) + if (l->s->picnum == BULLETHOLE) if (dist(l, spark) < (12 + (krand() & 7))) goto SKIPBULLETHOLE; } auto l = spawn(spark, BULLETHOLE); - l->s.xvel = -1; - l->s.ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, + l->s->xvel = -1; + l->s->ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x, wall[hitwall].y - wall[wall[hitwall].point2].y) + 512; ssp(l, CLIPMASK0); } @@ -437,14 +437,14 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa else { spark = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 24, 24, sa, 0, 0, actor, 4); - spark->s.extra = ScriptCode[gs.actorinfo[atwith].scriptaddress]; + spark->s->extra = ScriptCode[gs.actorinfo[atwith].scriptaddress]; if (hitsprt) { fi.checkhitsprite(hitsprt, spark); - if (hitsprt->s.picnum != TILE_APLAYER) + if (hitsprt->s->picnum != TILE_APLAYER) spawn(spark, SMALLSMOKE); - else spark->s.xrepeat = spark->s.yrepeat = 0; + else spark->s->xrepeat = spark->s->yrepeat = 0; } else if (hitwall >= 0) fi.checkhitwall(spark, hitwall, hitx, hity, hitz, SHOTSPARK1); @@ -465,7 +465,7 @@ static void shootweapon(DDukeActor* actor, int p, int sx, int sy, int sz, int sa static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, int atwith) { - auto s = &actor->s; + auto s = actor->s; int sect = s->sectnum; int vel, zvel; short scount; @@ -515,9 +515,9 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, if (aimed) { - int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) - (12 << 8); - zvel = ((aimed->s.z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed); - sa = getangle(aimed->s.x - sx, aimed->s.y - sy); + int dal = ((aimed->s->xrepeat * tileHeight(aimed->s->picnum)) << 1) - (12 << 8); + zvel = ((aimed->s->z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed); + sa = getangle(aimed->s->x - sx, aimed->s->y - sy); } else { @@ -580,17 +580,17 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, while (scount > 0) { auto j = EGS(sect, sx, sy, sz, atwith, -127, sizx, sizy, sa, vel, zvel, actor, 4); - j->s.extra += (krand() & 7); - j->s.cstat = 128; - j->s.clipdist = 4; + j->s->extra += (krand() & 7); + j->s->cstat = 128; + j->s->clipdist = 4; sa = s->ang + 32 - (krand() & 63); zvel = oldzvel + 512 - (krand() & 1023); if (atwith == FIRELASER) { - j->s.xrepeat = 8; - j->s.yrepeat = 8; + j->s->xrepeat = 8; + j->s->yrepeat = 8; } scount--; @@ -605,7 +605,7 @@ static void shootstuff(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, static void shootrpg(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, int atwith) { - auto s = &actor->s; + auto s = actor->s; int sect = s->sectnum; int vel, zvel; short l, scount; @@ -625,15 +625,15 @@ static void shootrpg(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i { if (isRRRA() && atwith == RPG2) { - if (aimed->s.picnum == HEN || aimed->s.picnum == HENSTAYPUT) + if (aimed->s->picnum == HEN || aimed->s->picnum == HENSTAYPUT) act90 = ps[screenpeek].GetActor(); else act90 = aimed; } - int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) + (8 << 8); - zvel = ((aimed->s.z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed); - if (aimed->s.picnum != RECON) - sa = getangle(aimed->s.x - sx, aimed->s.y - sy); + int dal = ((aimed->s->xrepeat * tileHeight(aimed->s->picnum)) << 1) + (8 << 8); + zvel = ((aimed->s->z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed); + if (aimed->s->picnum != RECON) + sa = getangle(aimed->s->x - sx, aimed->s->y - sy); } else zvel = -MulScale(ps[p].horizon.sum().asq16(), 81, 16); if (atwith == RPG) @@ -684,67 +684,67 @@ static void shootrpg(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i { if (atwith == RRTILE1790) { - spawned->s.extra = 10; - spawned->s.zvel = -(10 << 8); + spawned->s->extra = 10; + spawned->s->zvel = -(10 << 8); } else if (atwith == RPG2) { spawned->seek_actor = act90; - spawned->s.hitag = 0; + spawned->s->hitag = 0; fi.lotsofmoney(spawned, (krand() & 3) + 1); } } - spawned->s.extra += (krand() & 7); + spawned->s->extra += (krand() & 7); if (atwith != FREEZEBLAST) spawned->temp_actor = aimed; else { - spawned->s.yvel = gs.numfreezebounces; - spawned->s.xrepeat >>= 1; - spawned->s.yrepeat >>= 1; - spawned->s.zvel -= (2 << 4); + spawned->s->yvel = gs.numfreezebounces; + spawned->s->xrepeat >>= 1; + spawned->s->yrepeat >>= 1; + spawned->s->zvel -= (2 << 4); } if (p == -1) { if (s->picnum == HULK) { - spawned->s.xrepeat = 8; - spawned->s.yrepeat = 8; + spawned->s->xrepeat = 8; + spawned->s->yrepeat = 8; } else if (atwith != FREEZEBLAST) { - spawned->s.xrepeat = 30; - spawned->s.yrepeat = 30; - spawned->s.extra >>= 2; + spawned->s->xrepeat = 30; + spawned->s->yrepeat = 30; + spawned->s->extra >>= 2; } } else if (ps[p].curr_weapon == TIT_WEAPON) { - spawned->s.extra >>= 2; - spawned->s.ang += 16 - (krand() & 31); - spawned->s.zvel += 256 - (krand() & 511); + spawned->s->extra >>= 2; + spawned->s->ang += 16 - (krand() & 31); + spawned->s->zvel += 256 - (krand() & 511); if (ps[p].hbomb_hold_delay) { - spawned->s.x -= bsin(sa) / 644; - spawned->s.y += bcos(sa) / 644; + spawned->s->x -= bsin(sa) / 644; + spawned->s->y += bcos(sa) / 644; } else { - spawned->s.x += bsin(sa, -8); - spawned->s.y -= bcos(sa, -8); + spawned->s->x += bsin(sa, -8); + spawned->s->y -= bcos(sa, -8); } - spawned->s.xrepeat >>= 1; - spawned->s.yrepeat >>= 1; + spawned->s->xrepeat >>= 1; + spawned->s->yrepeat >>= 1; } - spawned->s.cstat = 128; + spawned->s->cstat = 128; if (atwith == RPG || (atwith == RPG2 && isRRRA())) - spawned->s.clipdist = 4; + spawned->s->clipdist = 4; else - spawned->s.clipdist = 40; + spawned->s->clipdist = 40; } @@ -757,7 +757,7 @@ static void shootrpg(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, i static void shootwhip(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, int atwith) { - auto s = &actor->s; + auto s = actor->s; int sect = s->sectnum; int vel, zvel; short scount; @@ -784,9 +784,9 @@ static void shootwhip(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, if (aimed) { - int dal = ((aimed->s.xrepeat * tileHeight(aimed->s.picnum)) << 1) - (12 << 8); - zvel = ((aimed->s.z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed); - sa = getangle(aimed->s.x - sx, aimed->s.y - sy); + int dal = ((aimed->s->xrepeat * tileHeight(aimed->s->picnum)) << 1) - (12 << 8); + zvel = ((aimed->s->z - sz - dal) * vel) / ldist(ps[p].GetActor(), aimed); + sa = getangle(aimed->s->x - sx, aimed->s->y - sy); } else zvel = -MulScale(ps[p].horizon.sum().asq16(), 98, 16); @@ -813,9 +813,9 @@ static void shootwhip(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, while (scount > 0) { auto j = EGS(sect, sx, sy, sz, atwith, -127, sizx, sizy, sa, vel, zvel, actor, 4); - j->s.extra += (krand() & 7); - j->s.cstat = 128; - j->s.clipdist = 4; + j->s->extra += (krand() & 7); + j->s->cstat = 128; + j->s->clipdist = 4; sa = s->ang + 32 - (krand() & 63); zvel = oldzvel + 512 - (krand() & 1023); @@ -832,7 +832,7 @@ static void shootwhip(DDukeActor* actor, int p, int sx, int sy, int sz, int sa, void shoot_r(DDukeActor* actor, int atwith) { - spritetype* const s = &actor->s; + spritetype* const s = actor->s; short sect, sa, p; int sx, sy, sz, vel, zvel, x; @@ -900,17 +900,17 @@ void shoot_r(DDukeActor* actor, int atwith) case TRIPBOMBSPRITE: { auto j = spawn(actor, atwith); - j->s.xvel = 32; - j->s.ang = s->ang; - j->s.z -= (5 << 8); + j->s->xvel = 32; + j->s->ang = s->ang; + j->s->z -= (5 << 8); break; } case BOWLINGBALL: { auto j = spawn(actor, atwith); - j->s.xvel = 250; - j->s.ang = s->ang; - j->s.z -= (15 << 8); + j->s->xvel = 250; + j->s->ang = s->ang; + j->s->z -= (15 << 8); break; } case OWHIP: @@ -978,7 +978,7 @@ void selectweapon_r(int snum, int weap) { int i, j, k; auto p = &ps[snum]; - if (p->last_pissed_time <= (26 * 218) && p->show_empty_weapon == 0 && p->kickback_pic == 0 && p->quick_kick == 0 && p->GetActor()->s.xrepeat > 8 && p->access_incs == 0 && p->knee_incs == 0) + if (p->last_pissed_time <= (26 * 218) && p->show_empty_weapon == 0 && p->kickback_pic == 0 && p->quick_kick == 0 && p->GetActor()->s->xrepeat > 8 && p->access_incs == 0 && p->knee_incs == 0) { if ((p->weapon_pos == 0 || (p->holster_weapon && p->weapon_pos == -9))) { @@ -1085,7 +1085,7 @@ void selectweapon_r(int snum, int weap) DukeStatIterator it(STAT_ACTOR); while (auto act = it.Next()) { - if (act->s.picnum == HEAVYHBOMB && act->GetOwner() == p->GetActor()) + if (act->s->picnum == HEAVYHBOMB && act->GetOwner() == p->GetActor()) { p->gotweapon.Set(DYNAMITE_WEAPON); j = THROWINGDYNAMITE_WEAPON; @@ -1250,7 +1250,7 @@ int doincrements_r(struct player_struct* p) { BellTime--; if (BellTime == 0 && BellSprite) - BellSprite->s.picnum++; + BellSprite->s->picnum++; } if (chickenphase > 0) chickenphase--; @@ -1262,7 +1262,7 @@ int doincrements_r(struct player_struct* p) } } - snum = p->GetActor()->s.yvel; + snum = p->GetActor()->s->yvel; p->player_par++; if (p->yehaa_timer) @@ -1389,17 +1389,17 @@ int doincrements_r(struct player_struct* p) S_PlayActorSound(DUKE_TAKEPILLS, pact); } - if (p->access_incs && p->GetActor()->s.pal != 1) + if (p->access_incs && p->GetActor()->s->pal != 1) { p->access_incs++; - if (p->GetActor()->s.extra <= 0) + if (p->GetActor()->s->extra <= 0) p->access_incs = 12; if (p->access_incs == 12) { if (p->access_spritenum != nullptr) { fi.checkhitswitch(snum, -1, p->access_spritenum); - switch (p->access_spritenum->s.pal) + switch (p->access_spritenum->s->pal) { case 0:p->keys[1] = 1; break; case 21:p->keys[2] = 1; break; @@ -1519,7 +1519,7 @@ void checkweapons_r(struct player_struct* p) if (p->OnMotorcycle && numplayers > 1) { auto j = spawn(p->GetActor(), 7220); - j->s.ang = p->angle.ang.asbuild(); + j->s->ang = p->angle.ang.asbuild(); j->saved_ammo = p->ammo_amount[MOTORCYCLE_WEAPON]; p->OnMotorcycle = 0; p->gotweapon.Clear(MOTORCYCLE_WEAPON); @@ -1535,7 +1535,7 @@ void checkweapons_r(struct player_struct* p) else if (p->OnBoat && numplayers > 1) { auto j = spawn(p->GetActor(), 7233); - j->s.ang = p->angle.ang.asbuild(); + j->s->ang = p->angle.ang.asbuild(); j->saved_ammo = p->ammo_amount[BOAT_WEAPON]; p->OnBoat = 0; p->gotweapon.Clear(BOAT_WEAPON); @@ -1573,16 +1573,16 @@ void checkweapons_r(struct player_struct* p) switch (i) { case 1: - j->s.lotag = 100; + j->s->lotag = 100; break; case 2: - j->s.lotag = 101; + j->s->lotag = 101; break; case 3: - j->s.lotag = 102; + j->s->lotag = 102; break; case 4: - j->s.lotag = 103; + j->s->lotag = 103; break; } } @@ -2073,7 +2073,7 @@ static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int { auto p = &ps[snum]; auto pact = p->GetActor(); - auto s = &pact->s; + auto s = pact->s; if (p->airleft != 15 * 26) p->airleft = 15 * 26; //Aprox twenty seconds. @@ -2358,12 +2358,12 @@ static void underwater(int snum, ESyncBits actions, int psect, int fz, int cz) if (p->scuba_on && (krand() & 255) < 8) { auto j = spawn(pact, WATERBUBBLE); - j->s.x += bcos(p->angle.ang.asbuild() + 64 - (global_random & 128) + 128, -6); - j->s.y += bsin(p->angle.ang.asbuild() + 64 - (global_random & 128) + 128, -6); - j->s.xrepeat = 3; - j->s.yrepeat = 2; - j->s.z = p->posz + (8 << 8); - j->s.cstat = 514; + j->s->x += bcos(p->angle.ang.asbuild() + 64 - (global_random & 128) + 128, -6); + j->s->y += bsin(p->angle.ang.asbuild() + 64 - (global_random & 128) + 128, -6); + j->s->xrepeat = 3; + j->s->yrepeat = 2; + j->s->z = p->posz + (8 << 8); + j->s->cstat = 514; } } @@ -2377,7 +2377,7 @@ void onMotorcycleMove(int snum, int psect, int j) { auto p = &ps[snum]; auto pact = p->GetActor(); - auto s = &pact->s; + auto s = pact->s; int psectlotag = sector[psect].lotag; short angleDelta = abs(p->angle.ang.asbuild() - getangle(wall[wall[j].point2].x - wall[j].x, wall[wall[j].point2].y - wall[j].y)); short damageAmount; @@ -2474,7 +2474,7 @@ void onBoatMove(int snum, int psect, int j) void onMotorcycleHit(int snum, DDukeActor* victim) { auto p = &ps[snum]; - auto s = &victim->s; + auto s = victim->s; if (badguy(s) || s->picnum == APLAYER) { if (s->picnum != APLAYER) @@ -2504,7 +2504,7 @@ void onMotorcycleHit(int snum, DDukeActor* victim) DukeSpriteIterator it; while (auto act2 = it.Next()) { - auto sprj = &act2->s; + auto sprj = act2->s; if ((sprj->picnum == RRTILE2431 || sprj->picnum == RRTILE2451) && sprj->pal == 4) { if (s->lotag == sprj->lotag) @@ -2535,7 +2535,7 @@ void onMotorcycleHit(int snum, DDukeActor* victim) void onBoatHit(int snum, DDukeActor* victim) { auto p = &ps[snum]; - auto s = &victim->s; + auto s = victim->s; if (badguy(s) || s->picnum == APLAYER) { @@ -2765,16 +2765,16 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if (k == 15) { - spawned->s.yvel = 3; - spawned->s.z += (8 << 8); + spawned->s->yvel = 3; + spawned->s->z += (8 << 8); } k = hits(p->GetActor()); if (k < 512) { - spawned->s.ang += 1024; - spawned->s.zvel /= 3; - spawned->s.xvel /= 3; + spawned->s->ang += 1024; + spawned->s->zvel /= 3; + spawned->s->xvel /= 3; } p->hbomb_on = 1; @@ -2985,10 +2985,10 @@ static void operateweapon(int snum, ESyncBits actions, int psect) { auto j = spawn(pact, SHELL); - j->s.ang += 1024; - j->s.ang &= 2047; - j->s.xvel += 32; - j->s.z += (3 << 8); + j->s->ang += 1024; + j->s->ang &= 2047; + j->s->xvel += 32; + j->s->z += (3 << 8); ssp(j, CLIPMASK0); } @@ -3291,7 +3291,7 @@ static void processweapon(int snum, ESyncBits actions, int psect) { auto p = &ps[snum]; auto pact = p->GetActor(); - auto s = &pact->s; + auto s = pact->s; int shrunk = (s->yrepeat < 8); if (actions & SB_FIRE) @@ -3358,7 +3358,7 @@ void processinput_r(int snum) auto p = &ps[snum]; auto pact = p->GetActor(); - auto s = &pact->s; + auto s = pact->s; p->horizon.resetadjustment(); p->angle.resetadjustment(); @@ -3395,8 +3395,8 @@ void processinput_r(int snum) DukeSectIterator it(psect); while (auto act2 = it.Next()) { - if (act2->s.picnum == RRTILE380) - if (act2->s.z - (8 << 8) < p->posz) + if (act2->s->picnum == RRTILE380) + if (act2->s->z - (8 << 8) < p->posz) psectlotag = 2; } } @@ -3445,13 +3445,13 @@ void processinput_r(int snum) if (chz.type == kHitSprite) { - if (chz.actor->s.statnum == 1 && chz.actor->s.extra >= 0) + if (chz.actor->s->statnum == 1 && chz.actor->s->extra >= 0) { chz.type = kHitNone; chz.actor = nullptr; cz = p->truecz; } - else if (chz.actor->s.picnum == RRTILE3587) + else if (chz.actor->s->picnum == RRTILE3587) { if (!p->stairs) { @@ -3470,7 +3470,7 @@ void processinput_r(int snum) if (clz.type == kHitSprite) { - if ((clz.actor->s.cstat & 33) == 33) + if ((clz.actor->s->cstat & 33) == 33) { psectlotag = 0; p->footprintcount = 0; @@ -3492,29 +3492,29 @@ void processinput_r(int snum) p->MotoSpeed -= p->MotoSpeed / 16.; } } - else if (badguy(clz.actor) && clz.actor->s.xrepeat > 24 && abs(s->z - clz.actor->s.z) < (84 << 8)) + else if (badguy(clz.actor) && clz.actor->s->xrepeat > 24 && abs(s->z - clz.actor->s->z) < (84 << 8)) { - int j = getangle(clz.actor->s.x - p->posx, clz.actor->s.y - p->posy); + int j = getangle(clz.actor->s->x - p->posx, clz.actor->s->y - p->posy); p->posxv -= bcos(j, 4); p->posyv -= bsin(j, 4); } - if (clz.actor->s.picnum == RRTILE3587) + if (clz.actor->s->picnum == RRTILE3587) { if (!p->stairs) { p->stairs = 10; if ((actions & SB_CROUCH) && !p->OnMotorcycle) { - cz = clz.actor->s.z; + cz = clz.actor->s->z; chz.type = kHitNone; chz.actor = nullptr; - fz = clz.actor->s.z + (4 << 8); + fz = clz.actor->s->z + (4 << 8); } } else p->stairs--; } - else if (clz.actor->s.picnum == TOILET || clz.actor->s.picnum == RRTILE2121) + else if (clz.actor->s->picnum == TOILET || clz.actor->s->picnum == RRTILE2121) { if ((actions & SB_CROUCH) && !p->OnMotorcycle) //if (Sound[436].num == 0) @@ -3586,7 +3586,7 @@ void processinput_r(int snum) p->playerweaponsway(s->xvel); s->xvel = clamp(ksqrt((p->posx - p->bobposx) * (p->posx - p->bobposx) + (p->posy - p->bobposy) * (p->posy - p->bobposy)), 0, 512); - if (p->on_ground) p->bobcounter += p->GetActor()->s.xvel >> 1; + if (p->on_ground) p->bobcounter += p->GetActor()->s->xvel >> 1; p->backuppos(ud.clipping == 0 && (sector[p->cursectnum].floorpicnum == MIRROR || p->cursectnum < 0 || p->cursectnum >= MAXSECTORS)); @@ -3694,7 +3694,7 @@ void processinput_r(int snum) case 0: if (clz.type == kHitSprite) - j = clz.actor->s.picnum; + j = clz.actor->s->picnum; else j = sector[psect].floorpicnum; break; case 1: @@ -3858,33 +3858,33 @@ HORIZONLY: } else if (badguy(clip.actor)) { - if (clip.actor->s.statnum != 1) + if (clip.actor->s->statnum != 1) { clip.actor->timetosleep = 0; - if (clip.actor->s.picnum == BILLYRAY) + if (clip.actor->s->picnum == BILLYRAY) S_PlayActorSound(404, clip.actor); else check_fta_sounds_r(clip.actor); changespritestat(clip.actor, 1); } } - else if (!isRRRA() && clip.actor->s.picnum == RRTILE3410) + else if (!isRRRA() && clip.actor->s->picnum == RRTILE3410) { quickkill(p); S_PlayActorSound(446, pact); } if (isRRRA()) { - if (clip.actor->s.picnum == RRTILE3410) + if (clip.actor->s->picnum == RRTILE3410) { quickkill(p); S_PlayActorSound(446, pact); } - else if (clip.actor->s.picnum == RRTILE2443 && clip.actor->s.pal == 19) + else if (clip.actor->s->picnum == RRTILE2443 && clip.actor->s->pal == 19) { - clip.actor->s.pal = 0; + clip.actor->s->pal = 0; p->DrugMode = 5; - ps[snum].GetActor()->s.extra = gs.max_player_health; + ps[snum].GetActor()->s->extra = gs.max_player_health; } } } @@ -3921,7 +3921,7 @@ HORIZONLY: if (ud.clipping == 0 && sector[psect].lotag == ST_31_TWO_WAY_TRAIN) { auto act = ScriptIndexToActor(sector[psect].hitag); - if (act && act->s.xvel && act->temp_data[0] == 0) + if (act && act->s->xvel && act->temp_data[0] == 0) { quickkill(p); return; @@ -4072,9 +4072,9 @@ void OnMotorcycle(struct player_struct *p, DDukeActor* motosprite) { if (motosprite) { - p->posx = motosprite->s.x; - p->posy = motosprite->s.y; - p->angle.ang = buildang(motosprite->s.ang); + p->posx = motosprite->s->x; + p->posy = motosprite->s->y; + p->angle.ang = buildang(motosprite->s->ang); p->ammo_amount[MOTORCYCLE_WEAPON] = motosprite->saved_ammo; deletesprite(motosprite); } @@ -4130,9 +4130,9 @@ void OffMotorcycle(struct player_struct *p) p->posyv -= p->angle.ang.bsin(7); p->moto_underwater = 0; auto spawned = spawn(p->GetActor(), EMPTYBIKE); - spawned->s.ang = p->angle.ang.asbuild(); - spawned->s.xvel += p->angle.ang.bcos(7); - spawned->s.yvel += p->angle.ang.bsin(7); + spawned->s->ang = p->angle.ang.asbuild(); + spawned->s->xvel += p->angle.ang.bcos(7); + spawned->s->yvel += p->angle.ang.bsin(7); spawned->saved_ammo = p->ammo_amount[MOTORCYCLE_WEAPON]; } } @@ -4149,9 +4149,9 @@ void OnBoat(struct player_struct *p, DDukeActor* boat) { if (boat) { - p->posx = boat->s.x; - p->posy = boat->s.y; - p->angle.ang = buildang(boat->s.ang); + p->posx = boat->s->x; + p->posy = boat->s->y; + p->angle.ang = buildang(boat->s->ang); p->ammo_amount[BOAT_WEAPON] = boat->saved_ammo; deletesprite(boat); } @@ -4194,9 +4194,9 @@ void OffBoat(struct player_struct *p) p->posyv -= p->angle.ang.bsin(7); p->moto_underwater = 0; auto spawned = spawn(p->GetActor(), EMPTYBOAT); - spawned->s.ang = p->angle.ang.asbuild(); - spawned->s.xvel += p->angle.ang.bcos(7); - spawned->s.yvel += p->angle.ang.bsin(7); + spawned->s->ang = p->angle.ang.asbuild(); + spawned->s->xvel += p->angle.ang.bcos(7); + spawned->s->yvel += p->angle.ang.bsin(7); spawned->saved_ammo = p->ammo_amount[BOAT_WEAPON]; } } diff --git a/source/games/duke/src/player_w.cpp b/source/games/duke/src/player_w.cpp index 98706c196..f34758efa 100644 --- a/source/games/duke/src/player_w.cpp +++ b/source/games/duke/src/player_w.cpp @@ -116,18 +116,18 @@ void DoSpawn(struct player_struct *p, short snum) if((aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_SPAWNTYPE2 ) ) { // like shotgun shells - j->s.ang += 1024; + j->s->ang += 1024; ssp(j,CLIPMASK0); - j->s.ang += 1024; + j->s->ang += 1024; // p->kickback_pic++; } else if((aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_SPAWNTYPE3 ) ) { // like chaingun shells - j->s.ang += 1024; - j->s.ang &= 2047; - j->s.xvel += 32; - j->s.z += (3<<8); + j->s->ang += 1024; + j->s->ang &= 2047; + j->s->xvel += 32; + j->s->z += (3<<8); ssp(j,CLIPMASK0); } @@ -351,23 +351,23 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect) int lGrenadeLifetime = GetGameVar("GRENADE_LIFETIME", NAM_GRENADE_LIFETIME, nullptr, snum); int lGrenadeLifetimeVar = GetGameVar("GRENADE_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, nullptr, snum); // set timer. blows up when at zero.... - j->s.extra = lGrenadeLifetime + j->s->extra = lGrenadeLifetime + MulScale(krand(), lGrenadeLifetimeVar, 14) - lGrenadeLifetimeVar; } if (k == 15) { - j->s.yvel = 3; - j->s.z += (8 << 8); + j->s->yvel = 3; + j->s->z += (8 << 8); } k = hits(p->GetActor()); if (k < 512) { - j->s.ang += 1024; - j->s.zvel /= 3; - j->s.xvel /= 3; + j->s->ang += 1024; + j->s->zvel /= 3; + j->s->xvel /= 3; } p->hbomb_on = 1; diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 4d72dd6a4..77571074b 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -571,7 +571,7 @@ void resetpspritevars(int g) DukeStatIterator it(STAT_PLAYER); while (auto act = it.Next()) { - s = &act->s; + s = act->s; if (numplayersprites == MAXPLAYERS) I_Error("Too many player sprites (max 16.)"); @@ -865,7 +865,7 @@ static void SpawnPortals() DukeStatIterator it(STAT_RAROR); while (auto act = it.Next()) { - auto spr = &act->s; + auto spr = act->s; if (spr->picnum == SECTOREFFECTOR && spr->lotag == tag) { if (processedTags.Find(spr->hitag) == processedTags.Size()) @@ -873,7 +873,7 @@ static void SpawnPortals() DukeStatIterator it2(STAT_RAROR); while (auto act2 = it2.Next()) { - auto spr2 = &act2->s; + auto spr2 = act2->s; if (spr2->picnum == SECTOREFFECTOR && spr2->lotag == tag + 1 && spr2->hitag == spr->hitag) { if (processedTags.Find(spr->hitag) == processedTags.Size()) @@ -1068,7 +1068,7 @@ void enterlevel(MapRecord *mi, int gamemode) for (int i = connecthead; i >= 0; i = connectpoint2[i]) { - int pn = sector[ps[i].GetActor()->s.sectnum].floorpicnum; + int pn = sector[ps[i].GetActor()->s->sectnum].floorpicnum; if (pn == TILE_HURTRAIL || pn == TILE_FLOORSLIME || pn == TILE_FLOORPLASMA) { resetweapons(i); diff --git a/source/games/duke/src/premap_d.cpp b/source/games/duke/src/premap_d.cpp index a3a67e6ea..c484017cd 100644 --- a/source/games/duke/src/premap_d.cpp +++ b/source/games/duke/src/premap_d.cpp @@ -256,8 +256,8 @@ void cacheit_d(void) DukeSectIterator it(i); while (auto j = it.Next()) { - if (j->s.xrepeat != 0 && j->s.yrepeat != 0 && (j->s.cstat & 32768) == 0) - cachespritenum(&j->s); + if (j->s->xrepeat != 0 && j->s->yrepeat != 0 && (j->s->cstat & 32768) == 0) + cachespritenum(j->s); } } @@ -280,7 +280,7 @@ void prelevel_d(int g) DukeStatIterator it(STAT_DEFAULT); while (auto ac = it.Next()) { - auto si = &ac->s; + auto si = ac->s; LoadActor(ac, -1, -1); if (si->lotag == -1 && (si->cstat & 16)) @@ -366,7 +366,7 @@ void prelevel_d(int g) DukeStatIterator it1(STAT_EFFECTOR); while (auto ac = it1.Next()) { - if (ac->s.lotag == 12 && ac->s.hitag == spr->lotag) + if (ac->s->lotag == 12 && ac->s->hitag == spr->lotag) ac->temp_data[0] = 1; } } diff --git a/source/games/duke/src/premap_r.cpp b/source/games/duke/src/premap_r.cpp index 5ff71c275..a7aa8d365 100644 --- a/source/games/duke/src/premap_r.cpp +++ b/source/games/duke/src/premap_r.cpp @@ -431,8 +431,8 @@ void cacheit_r(void) DukeSectIterator it(i); while (auto j = it.Next()) { - if(j->s.xrepeat != 0 && j->s.yrepeat != 0 && (j->s.cstat&32768) == 0) - cachespritenum(&j->s); + if(j->s->xrepeat != 0 && j->s->yrepeat != 0 && (j->s->cstat&32768) == 0) + cachespritenum(j->s); } } precacheMarkedTiles(); @@ -499,7 +499,7 @@ void prelevel_r(int g) DukeSectIterator it(i); while (auto act = it.Next()) { - auto spr = &act->s; + auto spr = act->s; if (spr->picnum == RRTILE11) { dist = spr->lotag << 4; @@ -530,7 +530,7 @@ void prelevel_r(int g) DukeSectIterator it(i); while (auto act = it.Next()) { - auto sj = &act->s; + auto sj = act->s; if (sj->picnum == RRTILE64) { dist = sj->lotag << 4; @@ -562,7 +562,7 @@ void prelevel_r(int g) DukeStatIterator it(STAT_DEFAULT); while (auto ac = it.Next()) { - auto si = &ac->s; + auto si = ac->s; LoadActor(ac, -1, -1); if (si->lotag == -1 && (si->cstat & 16)) @@ -698,7 +698,7 @@ void prelevel_r(int g) it.Reset(STAT_DEFAULT); while (auto ac = it.Next()) { - auto spr = &ac->s; + auto spr = ac->s; switch (spr->picnum) { case RRTILE8464 + 1: @@ -733,7 +733,7 @@ void prelevel_r(int g) DukeStatIterator it1(STAT_EFFECTOR); while (auto j = it1.Next()) { - if (j->s.lotag == 12 && j->s.hitag == spr->lotag) + if (j->s->lotag == 12 && j->s->hitag == spr->lotag) j->temp_data[0] = 1; } } diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index c3e11f45b..0f6a62c3e 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -101,7 +101,7 @@ void GameInterface::UpdateCameras(double smoothratio) return; auto p = &ps[screenpeek]; - auto sp = &camsprite->s; + auto sp = camsprite->s; if (p->newOwner != nullptr) camsprite->SetOwner(p->newOwner); @@ -115,7 +115,7 @@ void GameInterface::UpdateCameras(double smoothratio) screen->RenderTextureView(canvas, [=](IntRect& rect) { - auto camera = &camsprite->GetOwner()->s; + auto camera = camsprite->GetOwner()->s; auto ang = buildang(camera->interpolatedang(smoothratio)); display_mirror = 1; // should really be 'display external view'. if (!testnewrenderer) @@ -291,9 +291,7 @@ void displayrooms(int snum, double smoothratio) if (ud.cameraactor) { - spritetype* s; - - s = &ud.cameraactor->s; + spritetype* s = ud.cameraactor->s; if (s->yvel < 0) s->yvel = -100; else if (s->yvel > 199) s->yvel = 300; @@ -306,7 +304,7 @@ void displayrooms(int snum, double smoothratio) else { // Fixme: This should get the aspect ratio from the backend, not the current viewport size. - int i = DivScale(1, isRR() ? 64 : p->GetActor()->s.yrepeat + 28, 22); + int i = DivScale(1, isRR() ? 64 : p->GetActor()->s->yrepeat + 28, 22); int viewingaspect = !isRRRA() || !p->DrugMode ? xs_CRoundToInt(double(i) * tan(r_fov * (pi::pi() / 360.))) : getdrugmode(p, i); renderSetAspect(MulScale(viewingaspect, viewingrange, 16), yxaspect); @@ -356,7 +354,7 @@ void displayrooms(int snum, double smoothratio) spritetype* viewer; if (p->newOwner != nullptr) { - auto spr = &p->newOwner->s; + auto spr = p->newOwner->s; cang = buildang(spr->interpolatedang(smoothratio)); choriz = buildhoriz(spr->shade); cposx = spr->pos.x; @@ -370,18 +368,18 @@ void displayrooms(int snum, double smoothratio) else if (p->over_shoulder_on == 0) { if (cl_viewbob) cposz += interpolatedvalue(p->opyoff, p->pyoff, smoothratio); - viewer = &p->GetActor()->s; + viewer = p->GetActor()->s; } else { cposz -= isRR() ? 3840 : 3072; - if (!calcChaseCamPos(&cposx, &cposy, &cposz, &p->GetActor()->s, §, cang, choriz, smoothratio)) + if (!calcChaseCamPos(&cposx, &cposy, &cposz, p->GetActor()->s, §, cang, choriz, smoothratio)) { cposz += isRR() ? 3840 : 3072; - calcChaseCamPos(&cposx, &cposy, &cposz, &p->GetActor()->s, §, cang, choriz, smoothratio); + calcChaseCamPos(&cposx, &cposy, &cposz, p->GetActor()->s, §, cang, choriz, smoothratio); } - viewer = &p->GetActor()->s; + viewer = p->GetActor()->s; } cz = p->GetActor()->ceilingz; @@ -393,7 +391,7 @@ void displayrooms(int snum, double smoothratio) cang += buildang((2 - ((earthquaketime) & 2)) << 2); } - if (p->GetActor()->s.pal == 1) cposz -= (18 << 8); + if (p->GetActor()->s->pal == 1) cposz -= (18 << 8); else if (p->spritebridge == 0 && p->newOwner == nullptr) { diff --git a/source/games/duke/src/sbar_d.cpp b/source/games/duke/src/sbar_d.cpp index ac7088136..ff1d620a7 100644 --- a/source/games/duke/src/sbar_d.cpp +++ b/source/games/duke/src/sbar_d.cpp @@ -158,7 +158,7 @@ public: imgScale = baseScale / img->GetDisplayHeight(); DrawGraphic(img, 2, -1.5, DI_ITEM_LEFT_BOTTOM, 1., -1, -1, imgScale, imgScale); - if (!althud_flashing || p->last_extra > (gs.max_player_health >> 2) || (PlayClock & 32) || (p->GetActor()->s.pal == 1 && p->last_extra < 2)) + if (!althud_flashing || p->last_extra > (gs.max_player_health >> 2) || (PlayClock & 32) || (p->GetActor()->s->pal == 1 && p->last_extra < 2)) { int s = -8; if (althud_flashing && p->last_extra > gs.max_player_health) @@ -261,7 +261,7 @@ public: // health // DrawGraphic(tileGetTexture(HEALTHBOX), 5, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); - int health = (p->GetActor()->s.pal == 1 && p->last_extra < 2) ? 1 : p->last_extra; + int health = (p->GetActor()->s->pal == 1 && p->last_extra < 2) ? 1 : p->last_extra; FStringf format("%d", health); SBar_DrawString(this, digiFont, format, 20, -digiFont->mFont->GetHeight() * scale - 3, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); @@ -437,7 +437,7 @@ public: } DrawWeaponAmounts(p, 96, top + 15.5); - int num = (p->GetActor()->s.pal == 1 && p->last_extra < 2) ? 1 : p->last_extra; + int num = (p->GetActor()->s->pal == 1 && p->last_extra < 2) ? 1 : p->last_extra; format.Format("%d", num); SBar_DrawString(this, digiFont, format, 31, top + 17, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, 1, 1); format.Format("%d", GetMoraleOrShield(p, snum)); diff --git a/source/games/duke/src/sbar_r.cpp b/source/games/duke/src/sbar_r.cpp index c6035b13a..f2d8374b0 100644 --- a/source/games/duke/src/sbar_r.cpp +++ b/source/games/duke/src/sbar_r.cpp @@ -110,7 +110,7 @@ public: imgScale = baseScale / img->GetDisplayHeight(); DrawGraphic(img, 2, -2, DI_ITEM_LEFT_BOTTOM, 1, 0, 0, imgScale, imgScale); - if (!althud_flashing || p->last_extra > (gs.max_player_health >> 2) || (PlayClock & 32) || (p->GetActor()->s.pal == 1 && p->last_extra < 2)) + if (!althud_flashing || p->last_extra > (gs.max_player_health >> 2) || (PlayClock & 32) || (p->GetActor()->s->pal == 1 && p->last_extra < 2)) { int s = -8; if (althud_flashing && p->last_extra > gs.max_player_health) @@ -230,7 +230,7 @@ public: // health // DrawGraphic(tileGetTexture(HEALTHBOX), 2, -2, DI_ITEM_LEFT_BOTTOM, 1, -1, -1, scale, scale); - int health = (p->GetActor()->s.pal == 1 && p->last_extra < 2) ? 1 : p->last_extra; + int health = (p->GetActor()->s->pal == 1 && p->last_extra < 2) ? 1 : p->last_extra; FStringf format("%d", health); SBar_DrawString(this, digiFont, format, 21.5, -digiFont->mFont->GetHeight() * scale - 5.5, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); @@ -379,7 +379,7 @@ public: if (p->keys[1]) DrawGraphic(key, 145, top + 21, DI_ITEM_OFFSETS, 1, -1, -1, scale, scale, 0xffffffff, TRANSLATION(Translation_Remap, 0)); } - int num = (p->GetActor()->s.pal == 1 && p->last_extra < 2) ? 1 : p->last_extra; + int num = (p->GetActor()->s->pal == 1 && p->last_extra < 2) ? 1 : p->last_extra; format.Format("%d", num); SBar_DrawString(this, digiFont, format, 66.5, top + 16, DI_TEXT_ALIGN_CENTER, CR_UNTRANSLATED, 1, 0, 0, scale, scale); diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index f8fd8d00e..8cc7d4919 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -64,7 +64,7 @@ int callsound(int sn, DDukeActor* whatsprite) DukeSectIterator it(sn); while (auto act = it.Next()) { - auto si = &act->s; + auto si = act->s; if (si->picnum == MUSICANDSFX && si->lotag < 1000) { if (whatsprite == nullptr) whatsprite = act; @@ -122,17 +122,17 @@ int check_activator_motion(int lotag) DukeStatIterator it(STAT_ACTIVATOR); while (auto act = it.Next()) { - if (act->s.lotag == lotag) + if (act->s->lotag == lotag) { for (int j = animatecnt - 1; j >= 0; j--) - if (act->s.sectnum == animatesect[j]) + if (act->s->sectnum == animatesect[j]) return(1); DukeStatIterator it1(STAT_EFFECTOR); while (auto act2 = it1.Next()) { - if (act->s.sectnum == act2->s.sectnum) - switch (act2->s.lotag) + if (act->s->sectnum == act2->s->sectnum) + switch (act2->s->lotag) { case SE_11_SWINGING_DOOR: case SE_30_TWO_WAY_TRAIN: @@ -218,7 +218,7 @@ int findplayer(const DDukeActor* actor, int* d) { short j, closest_player; int x, closest; - auto s = &actor->s.pos; + auto s = &actor->s->pos; if (ud.multimode < 2) { @@ -232,7 +232,7 @@ int findplayer(const DDukeActor* actor, int* d) for (j = connecthead; j >= 0; j = connectpoint2[j]) { x = abs(ps[j].oposx - s->x) + abs(ps[j].oposy - s->y) + ((abs(ps[j].oposz - s->z + (28 << 8))) >> 4); - if (x < closest && ps[j].GetActor()->s.extra > 0) + if (x < closest && ps[j].GetActor()->s->extra > 0) { closest_player = j; closest = x; @@ -258,7 +258,7 @@ int findotherplayer(int p, int* d) closest_player = p; for (j = connecthead; j >= 0; j = connectpoint2[j]) - if (p != j && ps[j].GetActor()->s.extra > 0) + if (p != j && ps[j].GetActor()->s->extra > 0) { x = abs(ps[j].oposx - ps[p].posx) + abs(ps[j].oposy - ps[p].posy) + (abs(ps[j].oposz - ps[p].posz) >> 4); @@ -356,10 +356,10 @@ void doanimations(void) DukeSectIterator it(dasect); while (auto act = it.Next()) { - if (act->s.statnum != STAT_EFFECTOR) + if (act->s->statnum != STAT_EFFECTOR) { - act->s.backupz(); - act->s.z += v; + act->s->backupz(); + act->s->z += v; act->floorz = sector[dasect].floorz + v; } } @@ -435,7 +435,7 @@ int setanimation(short animsect, int animtype, int animtarget, int thegoal, int bool activatewarpelevators(DDukeActor* actor, int d) //Parm = sectoreffectornum { - int sn = actor->s.sectnum; + int sn = actor->s->sectnum; // See if the sector exists @@ -443,10 +443,10 @@ bool activatewarpelevators(DDukeActor* actor, int d) //Parm = sectoreffectornum DDukeActor *act2; while ((act2 = it.Next())) { - if (act2->s.lotag == SE_17_WARP_ELEVATOR || (isRRRA() && act2->s.lotag == SE_18_INCREMENTAL_SECTOR_RISE_FALL)) - if (act2->s.hitag == actor->s.hitag) - if ((abs(sector[sn].floorz - actor->temp_data[2]) > act2->s.yvel) || - (sector[act2->s.sectnum].hitag == (sector[sn].hitag - d))) + if (act2->s->lotag == SE_17_WARP_ELEVATOR || (isRRRA() && act2->s->lotag == SE_18_INCREMENTAL_SECTOR_RISE_FALL)) + if (act2->s->hitag == actor->s->hitag) + if ((abs(sector[sn].floorz - actor->temp_data[2]) > act2->s->yvel) || + (sector[act2->s->sectnum].hitag == (sector[sn].hitag - d))) break; } @@ -466,8 +466,8 @@ bool activatewarpelevators(DDukeActor* actor, int d) //Parm = sectoreffectornum it.Reset(STAT_EFFECTOR); while ((act2 = it.Next())) { - if (act2->s.lotag == SE_17_WARP_ELEVATOR || (isRRRA() && act2->s.lotag == SE_18_INCREMENTAL_SECTOR_RISE_FALL)) - if (act2->s.hitag == actor->s.hitag) + if (act2->s->lotag == SE_17_WARP_ELEVATOR || (isRRRA() && act2->s->lotag == SE_18_INCREMENTAL_SECTOR_RISE_FALL)) + if (act2->s->hitag == actor->s->hitag) { act2->temp_data[0] = d; act2->temp_data[1] = d; //Make all check warp @@ -575,18 +575,18 @@ static void handle_st09(int sn, DDukeActor* actor) static void handle_st15(int sn, DDukeActor* actor) { - if (actor->s.picnum != TILE_APLAYER) return; + if (actor->s->picnum != TILE_APLAYER) return; sectortype* sptr = §or[sn]; DukeSectIterator it(sn); DDukeActor* a2; while ((a2 = it.Next())) { - if (a2->s.picnum == SECTOREFFECTOR && a2->s.lotag == ST_17_PLATFORM_UP) break; + if (a2->s->picnum == SECTOREFFECTOR && a2->s->lotag == ST_17_PLATFORM_UP) break; } if (!a2) return; - if (actor->s.sectnum == sn) + if (actor->s->sectnum == sn) { if (activatewarpelevators(a2, -1)) activatewarpelevators(a2, 1); @@ -596,7 +596,7 @@ static void handle_st15(int sn, DDukeActor* actor) } else { - if (sptr->floorz > a2->s.z) + if (sptr->floorz > a2->s->z) activatewarpelevators(a2, -1); else activatewarpelevators(a2, 1); @@ -678,10 +678,10 @@ static void handle_st29(int sn, DDukeActor* actor) DukeStatIterator it(STAT_EFFECTOR); while (auto act2 = it.Next()) { - if ((act2->s.lotag == 22) && - (act2->s.hitag == sptr->hitag)) + if ((act2->s->lotag == 22) && + (act2->s->hitag == sptr->hitag)) { - sector[act2->s.sectnum].extra = -sector[act2->s.sectnum].extra; + sector[act2->s->sectnum].extra = -sector[act2->s->sectnum].extra; act2->temp_data[0] = sn; act2->temp_data[1] = 1; @@ -713,9 +713,9 @@ REDODOOR: DukeSectIterator it(sn); while ((a2 = it.Next())) { - if (a2->s.statnum == 3 && a2->s.lotag == 9) + if (a2->s->statnum == 3 && a2->s->lotag == 9) { - j = a2->s.z; + j = a2->s->z; break; } } @@ -815,14 +815,14 @@ static void handle_st23(int sn, DDukeActor* actor) DDukeActor* act2; while ((act2 = it.Next())) { - if (act2->s.lotag == SE_11_SWINGING_DOOR && act2->s.sectnum == sn && !act2->temp_data[4]) + if (act2->s->lotag == SE_11_SWINGING_DOOR && act2->s->sectnum == sn && !act2->temp_data[4]) { break; } } if (!act2) return; - int l = sector[act2->s.sectnum].lotag & 0x8000; + int l = sector[act2->s->sectnum].lotag & 0x8000; if (act2) { @@ -830,7 +830,7 @@ static void handle_st23(int sn, DDukeActor* actor) while (auto act3 = it.Next()) { - if (l == (sector[act3->s.sectnum].lotag & 0x8000) && act3->s.lotag == SE_11_SWINGING_DOOR && act2->s.hitag == act3->s.hitag && act3->temp_data[4]) + if (l == (sector[act3->s->sectnum].lotag & 0x8000) && act3->s->lotag == SE_11_SWINGING_DOOR && act2->s->hitag == act3->s->hitag && act3->temp_data[4]) { return; } @@ -839,10 +839,10 @@ static void handle_st23(int sn, DDukeActor* actor) it.Reset(STAT_EFFECTOR); while (auto act3 = it.Next()) { - if (l == (sector[act3->s.sectnum].lotag & 0x8000) && act3->s.lotag == SE_11_SWINGING_DOOR && act2->s.hitag == act3->s.hitag) + if (l == (sector[act3->s->sectnum].lotag & 0x8000) && act3->s->lotag == SE_11_SWINGING_DOOR && act2->s->hitag == act3->s->hitag) { - if (sector[act3->s.sectnum].lotag & 0x8000) sector[act3->s.sectnum].lotag &= 0x7fff; - else sector[act3->s.sectnum].lotag |= 0x8000; + if (sector[act3->s->sectnum].lotag & 0x8000) sector[act3->s->sectnum].lotag &= 0x7fff; + else sector[act3->s->sectnum].lotag |= 0x8000; act3->temp_data[4] = 1; act3->temp_data[3] = -act3->temp_data[3]; if (q == 0) @@ -867,7 +867,7 @@ static void handle_st25(int sn, DDukeActor* actor) DDukeActor* act2; while ((act2 = it.Next())) { - if (act2->s.lotag == 15 && act2->s.sectnum == sn) + if (act2->s->lotag == 15 && act2->s->sectnum == sn) { break; } @@ -879,15 +879,15 @@ static void handle_st25(int sn, DDukeActor* actor) it.Reset(STAT_EFFECTOR); while (auto act3 = it.Next()) { - if (act3->s.hitag == act2->s.hitag) + if (act3->s->hitag == act2->s->hitag) { - if (act3->s.lotag == 15) + if (act3->s->lotag == 15) { - sector[act3->s.sectnum].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 (sector[act3->s.sectnum].lotag & 0x8000) act3->temp_data[4] = 1; + sector[act3->s->sectnum].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 (sector[act3->s->sectnum].lotag & 0x8000) act3->temp_data[4] = 1; else act3->temp_data[4] = 2; } } @@ -905,7 +905,7 @@ static void handle_st27(int sn, DDukeActor* actor) DukeStatIterator it(STAT_EFFECTOR); while (auto act2 = it.Next()) { - if ((act2->s.lotag & 0xff) == 20 && act2->s.sectnum == sn) //Bridge + if ((act2->s->lotag & 0xff) == 20 && act2->s->sectnum == sn) //Bridge { sector[sn].lotag ^= 0x8000; @@ -931,9 +931,9 @@ static void handle_st28(int sn, DDukeActor* actor) DukeSectIterator it(sn); while (auto a2 = it.Next()) { - if (a2->s.statnum == 3 && (a2->s.lotag & 0xff) == 21) + if (a2->s->statnum == 3 && (a2->s->lotag & 0xff) == 21) { - j = a2->s.hitag; + j = a2->s->hitag; break; //Found it } } @@ -942,8 +942,8 @@ static void handle_st28(int sn, DDukeActor* actor) DukeStatIterator it1(STAT_EFFECTOR); while (auto act3 = it.Next()) { - if ((act3->s.lotag & 0xff) == 21 && !act3->temp_data[0] && - (act3->s.hitag) == j) + if ((act3->s->lotag & 0xff) == 21 && !act3->temp_data[0] && + (act3->s->hitag) == j) act3->temp_data[0] = 1; } callsound(sn, actor); @@ -986,8 +986,8 @@ void operatesectors(int sn, DDukeActor *actor) auto act = ScriptIndexToActor(sector[sn].hitag); if (!act) break; if (act->tempang == 0 || act->tempang == 256) callsound(sn, actor); - if (act->s.extra == 1) act->s.extra = 3; - else act->s.extra = 1; + if (act->s->extra == 1) act->s->extra = 3; + else act->s->extra = 1; break; } @@ -1101,45 +1101,45 @@ void operateactivators(int low, int plnum) DukeStatIterator it(STAT_ACTIVATOR); while (auto act = it.Next()) { - if (act->s.lotag == low) + if (act->s->lotag == low) { - if (act->s.picnum == ACTIVATORLOCKED) + if (act->s->picnum == ACTIVATORLOCKED) { - sector[act->s.sectnum].lotag ^= 16384; + sector[act->s->sectnum].lotag ^= 16384; if (plnum >= 0) { - if (sector[act->s.sectnum].lotag & 16384) + if (sector[act->s->sectnum].lotag & 16384) FTA(4, &ps[plnum]); else FTA(8, &ps[plnum]); } } else { - switch (act->s.hitag) + switch (act->s->hitag) { case 0: break; case 1: - if (sector[act->s.sectnum].floorz != sector[act->s.sectnum].ceilingz) + if (sector[act->s->sectnum].floorz != sector[act->s->sectnum].ceilingz) { continue; } break; case 2: - if (sector[act->s.sectnum].floorz == sector[act->s.sectnum].ceilingz) + if (sector[act->s->sectnum].floorz == sector[act->s->sectnum].ceilingz) { continue; } break; } - if (sector[act->s.sectnum].lotag < 3) + if (sector[act->s->sectnum].lotag < 3) { - DukeSectIterator it(act->s.sectnum); + DukeSectIterator it(act->s->sectnum); while (auto a2 = it.Next()) { - if (a2->s.statnum == 3) switch (a2->s.lotag) + if (a2->s->statnum == 3) switch (a2->s->lotag) { case SE_18_INCREMENTAL_SECTOR_RISE_FALL: if (isRRRA()) break; @@ -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->s->sectnum, a2); break; } } } - if (k == -1 && (sector[act->s.sectnum].lotag & 0xff) == 22) - k = callsound(act->s.sectnum, act); + if (k == -1 && (sector[act->s->sectnum].lotag & 0xff) == 22) + k = callsound(act->s->sectnum, act); - operatesectors(act->s.sectnum, act); + operatesectors(act->s->sectnum, act); } } } @@ -1175,8 +1175,8 @@ void operatemasterswitches(int low) DukeStatIterator it(STAT_STANDABLE); while (auto act2 = it.Next()) { - if (act2->s.picnum == MASTERSWITCH && act2->s.lotag == low && act2->s.yvel == 0) - act2->s.yvel = 1; + if (act2->s->picnum == MASTERSWITCH && act2->s->lotag == low && act2->s->yvel == 0) + act2->s->yvel = 1; } } @@ -1203,7 +1203,7 @@ void operateforcefields_common(DDukeActor *effector, int low, const std::initial { wall[i].cstat = 0; - if (effector && effector->s.picnum == SECTOREFFECTOR && effector->s.lotag == 30) + if (effector && effector->s->picnum == SECTOREFFECTOR && effector->s->lotag == 30) wall[i].lotag = 0; } else @@ -1237,15 +1237,15 @@ void allignwarpelevators(void) DukeStatIterator it(STAT_EFFECTOR); while (auto act = it.Next()) { - if (act->s.lotag == SE_17_WARP_ELEVATOR && act->s.shade > 16) + if (act->s->lotag == SE_17_WARP_ELEVATOR && act->s->shade > 16) { DukeStatIterator it1(STAT_EFFECTOR); while (auto act2 = it1.Next()) { - if ((act2->s.lotag) == SE_17_WARP_ELEVATOR && act != act2 && act->s.hitag == act2->s.hitag) + if ((act2->s->lotag) == SE_17_WARP_ELEVATOR && act != act2 && act->s->hitag == act2->s->hitag) { - sector[act2->s.sectnum].floorz = sector[act->s.sectnum].floorz; - sector[act2->s.sectnum].ceilingz = sector[act->s.sectnum].ceilingz; + sector[act2->s->sectnum].floorz = sector[act->s->sectnum].floorz; + sector[act2->s->sectnum].ceilingz = sector[act->s->sectnum].ceilingz; } } } diff --git a/source/games/duke/src/sectors_d.cpp b/source/games/duke/src/sectors_d.cpp index 8693df3bb..5b4948123 100644 --- a/source/games/duke/src/sectors_d.cpp +++ b/source/games/duke/src/sectors_d.cpp @@ -191,15 +191,15 @@ void operaterespawns_d(int low) DukeStatIterator it(STAT_FX); while (auto act = it.Next()) { - if (act->s.lotag == low) switch (act->s.picnum) + if (act->s->lotag == low) switch (act->s->picnum) { case RESPAWN: - if (badguypic(act->s.hitag) && ud.monsters_off) break; + if (badguypic(act->s->hitag) && ud.monsters_off) break; auto star = spawn(act, TRANSPORTERSTAR); - star->s.z -= (32 << 8); + star->s->z -= (32 << 8); - act->s.extra = 66 - 12; // Just a way to killit + act->s->extra = 66 - 12; // Just a way to killit break; } } @@ -234,13 +234,13 @@ bool checkhitswitch_d(int snum, int ww, DDukeActor *act) if (act) { - lotag = act->s.lotag; + lotag = act->s->lotag; if (lotag == 0) return 0; - hitag = act->s.hitag; - sx = act->s.x; - sy = act->s.y; - picnum = act->s.picnum; - switchpal = act->s.pal; + hitag = act->s->hitag; + sx = act->s->x; + sy = act->s->y; + picnum = act->s->picnum; + switchpal = act->s->pal; } else { @@ -267,7 +267,7 @@ bool checkhitswitch_d(int snum, int ww, DDukeActor *act) if (act) { StopCommentary(); - act->s.picnum = DEVELOPERCOMMENTARY; + act->s->picnum = DEVELOPERCOMMENTARY; return true; } return false; @@ -275,7 +275,7 @@ bool checkhitswitch_d(int snum, int ww, DDukeActor *act) if (act) { if (StartCommentary(lotag, act)) - act->s.picnum = DEVELOPERCOMMENTARY+1; + act->s->picnum = DEVELOPERCOMMENTARY+1; return true; } return false; @@ -354,7 +354,7 @@ bool checkhitswitch_d(int snum, int ww, DDukeActor *act) DukeStatIterator it(STAT_DEFAULT); while (auto other = it.Next()) { - auto si = &other->s; + auto si = other->s; if (lotag == si->lotag) switch (si->picnum) { case DIPSWITCH: @@ -551,12 +551,12 @@ bool checkhitswitch_d(int snum, int ww, DDukeActor *act) DukeStatIterator it(STAT_EFFECTOR); while (auto other = it.Next()) { - if (other->s.hitag == lotag) + if (other->s->hitag == lotag) { - switch (other->s.lotag) + switch (other->s->lotag) { case SE_12_LIGHT_SWITCH: - sector[other->s.sectnum].floorpal = 0; + sector[other->s->sectnum].floorpal = 0; other->temp_data[0]++; if (other->temp_data[0] == 2) other->temp_data[0]++; @@ -621,9 +621,9 @@ void activatebysector_d(int sect, DDukeActor* activator) DukeSectIterator it(sect); while (auto act = it.Next()) { - if (act->s.picnum == ACTIVATOR) + if (act->s->picnum == ACTIVATOR) { - operateactivators(act->s.lotag, -1); + operateactivators(act->s->lotag, -1); didit = 1; // return; } @@ -685,12 +685,12 @@ void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw else { if (atwith == CHAINGUN) - spawned = EGS(sn, x, y, z, FORCERIPPLE, -127, 16 + spr->s.xrepeat, 16 + spr->s.yrepeat, 0, 0, 0, spr, 5); + spawned = EGS(sn, x, y, z, FORCERIPPLE, -127, 16 + spr->s->xrepeat, 16 + spr->s->yrepeat, 0, 0, 0, spr, 5); else spawned = EGS(sn, x, y, z, FORCERIPPLE, -127, 32, 32, 0, 0, 0, spr, 5); } - spawned->s.cstat |= 18 + 128; - spawned->s.ang = getangle(wal->x - wall[wal->point2].x, wal->y - wall[wal->point2].y) - 512; + spawned->s->cstat |= 18 + 128; + spawned->s->ang = getangle(wal->x - wall[wal->point2].x, wal->y - wall[wal->point2].y) - 512; S_PlayActorSound(SOMETHINGHITFORCE, spawned); @@ -719,7 +719,7 @@ void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw wall[wal->nextwall].cstat = 0; auto spawned = EGS(sn, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.asbuild(), 0, 0, spr, 3); - spawned->s.lotag = 128; + spawned->s->lotag = 128; spawned->temp_data[1] = 5; spawned->temp_data[2] = dawallnum; S_PlayActorSound(GLASS_BREAKING, spawned); @@ -870,7 +870,7 @@ void checkhitwall_d(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw DukeStatIterator it(STAT_EFFECTOR); while (auto effector = it.Next()) { - if (effector->s.hitag == wall[dawallnum].lotag && effector->s.lotag == 3) + if (effector->s->hitag == wall[dawallnum].lotag && effector->s->lotag == 3) { effector->temp_data[2] = j; effector->temp_data[3] = darkestwall; @@ -891,12 +891,12 @@ void checkplayerhurt_d(struct player_struct* p, const Collision& coll) { if (coll.type == kHitSprite) { - switch (coll.actor->s.picnum) + switch (coll.actor->s->picnum) { case CACTUS: if (p->hurt_delay < 8) { - p->GetActor()->s.extra -= 5; + p->GetActor()->s->extra -= 5; p->hurt_delay = 16; SetPlayerPal(p, PalEntry(32, 32, 0, 0)); S_PlayActorSound(DUKE_LONGTERM_PAIN, p->GetActor()); @@ -915,7 +915,7 @@ void checkplayerhurt_d(struct player_struct* p, const Collision& coll) case W_FORCEFIELD: case W_FORCEFIELD + 1: case W_FORCEFIELD + 2: - p->GetActor()->s.extra -= 5; + p->GetActor()->s->extra -= 5; p->hurt_delay = 16; SetPlayerPal(p, PalEntry(32, 32, 0, 0)); @@ -988,12 +988,12 @@ bool checkhitceiling_d(int sn) DukeSectIterator it(sn); while (auto act = it.Next()) { - if (act->s.picnum == SECTOREFFECTOR && act->s.lotag == 12) + if (act->s->picnum == SECTOREFFECTOR && act->s->lotag == 12) { DukeStatIterator it1(STAT_EFFECTOR); while (auto act2 = it1.Next()) { - if (act2->s.hitag == act->s.hitag) + if (act2->s->hitag == act->s->hitag) act2->temp_data[3] = 1; } break; @@ -1005,7 +1005,7 @@ bool checkhitceiling_d(int sn) DukeStatIterator it(STAT_EFFECTOR); while (auto act = it.Next()) { - if (act->s.hitag == (sector[sn].hitag) && act->s.lotag == 3) + if (act->s->hitag == (sector[sn].hitag) && act->s->lotag == 3) { act->temp_data[2] = j; act->temp_data[4] = 1; @@ -1027,8 +1027,8 @@ bool checkhitceiling_d(int sn) void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) { int j, k, p; - spritetype* s = &targ->s; - auto pspr = &proj->s; + spritetype* s = targ->s; + auto pspr = proj->s; switch (s->picnum) { @@ -1106,7 +1106,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) for (k = 0; k < 64; k++) { auto j = EGS(s->sectnum, s->x, s->y, s->z - (krand() % (48 << 8)), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (s->zvel >> 2), targ, 5); - j->s.pal = 8; + j->s->pal = 8; } if (s->picnum == CACTUS) @@ -1305,7 +1305,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) } { auto j = spawn(targ, STEAM); - j->s.z = sector[s->sectnum].floorz - (32 << 8); + j->s->z = sector[s->sectnum].floorz - (32 << 8); } break; @@ -1367,7 +1367,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) case PLAYERONWATER: targ = targ->GetOwner(); if (!targ) break; - s = &targ->s; + s = targ->s; default: if ((s->cstat & 16) && s->hitag == 0 && s->lotag == 0 && s->statnum == 0) break; @@ -1387,16 +1387,16 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) { auto spawned = spawn(proj, JIBS6); if (pspr->pal == 6) - spawned->s.pal = 6; - spawned->s.z += (4 << 8); - spawned->s.xvel = 16; - spawned->s.xrepeat = spawned->s.yrepeat = 24; - spawned->s.ang += 32 - (krand() & 63); + spawned->s->pal = 6; + spawned->s->z += (4 << 8); + spawned->s->xvel = 16; + spawned->s->xrepeat = spawned->s->yrepeat = 24; + spawned->s->ang += 32 - (krand() & 63); } auto Owner = proj->GetOwner(); - if (Owner && Owner->s.picnum == APLAYER && s->picnum != ROTATEGUN && s->picnum != DRONE) + if (Owner && Owner->s->picnum == APLAYER && s->picnum != ROTATEGUN && s->picnum != DRONE) if (ps[Owner->PlayerIndex()].curr_weapon == SHOTGUN_WEAPON) { fi.shoot(targ, BLOODSPLAT3); @@ -1432,13 +1432,13 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) int hitpic = pspr->picnum; auto Owner = proj->GetOwner(); - if (Owner && Owner->s.picnum == APLAYER) + if (Owner && Owner->s->picnum == APLAYER) { if (s->picnum == APLAYER && ud.coop != 0 && ud.ffire == 0) return; auto tOwner = targ->GetOwner(); - if (isWorldTour() && hitpic == FIREBALL && tOwner && tOwner->s.picnum != FIREBALL) + if (isWorldTour() && hitpic == FIREBALL && tOwner && tOwner->s->picnum != FIREBALL) hitpic = FLAMETHROWERFLAME; } @@ -1464,7 +1464,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) DukeStatIterator it(STAT_ACTOR); while (auto j = it.Next()) { - if (j->s.picnum == CAMERA1) j->s.yvel = 0; + if (j->s->picnum == CAMERA1) j->s->yvel = 0; } } @@ -1472,7 +1472,7 @@ void checkhitsprite_d(DDukeActor* targ, DDukeActor* proj) return; auto hitowner = targ->GetHitOwner(); - if (!hitowner || hitowner->s.picnum != APLAYER) + if (!hitowner || hitowner->s->picnum != APLAYER) if (ud.player_skill >= 3) pspr->extra += (pspr->extra >> 1); } @@ -1531,7 +1531,7 @@ void checksectors_d(int snum) //After this point the the player effects the map with space - if (chatmodeon || p->GetActor()->s.extra <= 0) return; + if (chatmodeon || p->GetActor()->s->extra <= 0) return; if (ud.cashman && PlayerInput(snum, SB_OPEN)) fi.lotsofmoney(p->GetActor(), 2); @@ -1579,20 +1579,20 @@ void checksectors_d(int snum) return; if (p->newOwner != nullptr) - neartag(p->oposx, p->oposy, p->oposz, p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); + neartag(p->oposx, p->oposy, p->oposz, p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); else { - neartag(p->posx, p->posy, p->posz, p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); + neartag(p->posx, p->posy, p->posz, p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); if (neartagsprite == nullptr && neartagwall == -1 && neartagsector == -1) - neartag(p->posx, p->posy, p->posz + (8 << 8), p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); + neartag(p->posx, p->posy, p->posz + (8 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); if (neartagsprite == nullptr && neartagwall == -1 && neartagsector == -1) - neartag(p->posx, p->posy, p->posz + (16 << 8), p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); + neartag(p->posx, p->posy, p->posz + (16 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); if (neartagsprite == nullptr && neartagwall == -1 && neartagsector == -1) { - neartag(p->posx, p->posy, p->posz + (16 << 8), p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3); + neartag(p->posx, p->posy, p->posz + (16 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3); if (neartagsprite != nullptr) { - switch (neartagsprite->s.picnum) + switch (neartagsprite->s->picnum) { case FEM1: case FEM2: @@ -1619,8 +1619,8 @@ void checksectors_d(int snum) } if (p->newOwner == nullptr && neartagsprite == nullptr && neartagsector == -1 && neartagwall == -1) - if (isanunderoperator(sector[p->GetActor()->s.sectnum].lotag)) - neartagsector = p->GetActor()->s.sectnum; + if (isanunderoperator(sector[p->GetActor()->s->sectnum].lotag)) + neartagsector = p->GetActor()->s->sectnum; if (neartagsector >= 0 && (sector[neartagsector].lotag & 16384)) return; @@ -1639,7 +1639,7 @@ void checksectors_d(int snum) { if (fi.checkhitswitch(snum, -1, neartagsprite)) return; - switch (neartagsprite->s.picnum) + switch (neartagsprite->s->picnum) { case TOILET: case STALL: @@ -1654,13 +1654,13 @@ void checksectors_d(int snum) p->holster_weapon = 1; p->weapon_pos = -1; } - if (p->GetActor()->s.extra <= (gs.max_player_health - (gs.max_player_health / 10))) + if (p->GetActor()->s->extra <= (gs.max_player_health - (gs.max_player_health / 10))) { - p->GetActor()->s.extra += gs.max_player_health / 10; - p->last_extra = p->GetActor()->s.extra; + p->GetActor()->s->extra += gs.max_player_health / 10; + p->last_extra = p->GetActor()->s->extra; } - else if (p->GetActor()->s.extra < gs.max_player_health) - p->GetActor()->s.extra = gs.max_player_health; + else if (p->GetActor()->s->extra < gs.max_player_health) + p->GetActor()->s->extra = gs.max_player_health; } else if (S_CheckActorSoundPlaying(neartagsprite, FLUSH_TOILET) == 0) S_PlayActorSound(FLUSH_TOILET, neartagsprite); @@ -1674,9 +1674,9 @@ void checksectors_d(int snum) { neartagsprite->temp_data[0] = 1; neartagsprite->SetOwner(p->GetActor()); - p->buttonpalette = neartagsprite->s.pal; + p->buttonpalette = neartagsprite->s->pal; if (p->buttonpalette) - ud.secretlevel = neartagsprite->s.lotag; + ud.secretlevel = neartagsprite->s->lotag; else ud.secretlevel = 0; } return; @@ -1686,16 +1686,16 @@ void checksectors_d(int snum) neartagsprite->temp_data[0] = 1; neartagsprite->SetOwner(p->GetActor()); - if (p->GetActor()->s.extra < gs.max_player_health) + if (p->GetActor()->s->extra < gs.max_player_health) { - p->GetActor()->s.extra++; + p->GetActor()->s->extra++; S_PlayActorSound(DUKE_DRINKING, p->GetActor()); } } return; case PLUG: S_PlayActorSound(SHORT_CIRCUIT, pact); - p->GetActor()->s.extra -= 2 + (krand() & 3); + p->GetActor()->s->extra -= 2 + (krand() & 3); SetPlayerPal(p, PalEntry(32, 48, 48, 64)); break; case VIEWSCREEN: @@ -1704,14 +1704,14 @@ void checksectors_d(int snum) DukeStatIterator it(STAT_ACTOR); while (auto acti = it.Next()) { - auto spr = &acti->s; - if (spr->picnum == CAMERA1 && spr->yvel == 0 && neartagsprite->s.hitag == spr->lotag) + auto spr = acti->s; + if (spr->picnum == CAMERA1 && spr->yvel == 0 && neartagsprite->s->hitag == spr->lotag) { spr->yvel = 1; //Using this camera if (snum == screenpeek) S_PlaySound(MONITOR_ACTIVE); neartagsprite->SetOwner(acti); - neartagsprite->s.yvel = 1; + neartagsprite->s->yvel = 1; camsprite = neartagsprite; @@ -1741,7 +1741,7 @@ void checksectors_d(int snum) DukeStatIterator it(STAT_ACTOR); while (auto act = it.Next()) { - if (act->s.picnum == CAMERA1) act->s.yvel = 0; + if (act->s->picnum == CAMERA1) act->s->yvel = 0; } } else if (p->newOwner != nullptr) @@ -1783,21 +1783,21 @@ void checksectors_d(int snum) DukeSectIterator it(neartagsector); while (auto act = it.Next()) { - if (act->s.picnum == ACTIVATOR || act->s.picnum == MASTERSWITCH) + if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH) return; } operatesectors(neartagsector, p->GetActor()); } - else if ((sector[p->GetActor()->s.sectnum].lotag & 16384) == 0) + else if ((sector[p->GetActor()->s->sectnum].lotag & 16384) == 0) { - if (isanunderoperator(sector[p->GetActor()->s.sectnum].lotag)) + if (isanunderoperator(sector[p->GetActor()->s->sectnum].lotag)) { - DukeSectIterator it(p->GetActor()->s.sectnum); + DukeSectIterator it(p->GetActor()->s->sectnum); while (auto act = it.Next()) { - if (act->s.picnum == ACTIVATOR || act->s.picnum == MASTERSWITCH) return; + if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH) return; } - operatesectors(p->GetActor()->s.sectnum, p->GetActor()); + operatesectors(p->GetActor()->s->sectnum, p->GetActor()); } else fi.checkhitswitch(snum, neartagwall, nullptr); } diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 3c1681540..4b89feab1 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -306,16 +306,16 @@ void operaterespawns_r(int low) DukeStatIterator it(STAT_FX); while (auto act = it.Next()) { - if (act->s.lotag == low) switch (act->s.picnum) + if (act->s->lotag == low) switch (act->s->picnum) { case RESPAWN: { - if (badguypic(act->s.hitag) && ud.monsters_off) break; + if (badguypic(act->s->hitag) && ud.monsters_off) break; auto star = spawn(act, TRANSPORTERSTAR); - star->s.z -= (32 << 8); + star->s->z -= (32 << 8); - act->s.extra = 66 - 12; // Just a way to killit + act->s->extra = 66 - 12; // Just a way to killit break; } case RRTILE7424: @@ -356,13 +356,13 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act) if (act) { - lotag = act->s.lotag; + lotag = act->s->lotag; if (lotag == 0) return 0; - hitag = act->s.hitag; - sx = act->s.x; - sy = act->s.y; - picnum = act->s.picnum; - switchpal = act->s.pal; + hitag = act->s->hitag; + sx = act->s->x; + sy = act->s->y; + picnum = act->s->picnum; + switchpal = act->s->pal; } else { @@ -489,7 +489,7 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act) DukeStatIterator it(STAT_DEFAULT); while (auto other = it.Next()) { - auto si = &other->s; + auto si = other->s; if (lotag == si->lotag) switch (si->picnum) { case DIPSWITCH: @@ -554,14 +554,14 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act) DukeStatIterator it1(107); while (auto other2 = it1.Next()) { - if (other2->s.picnum == RRTILE3410) + if (other2->s->picnum == RRTILE3410) { - other2->s.picnum++; - other2->s.hitag = 100; - other2->s.extra = 0; + other2->s->picnum++; + other2->s->hitag = 100; + other2->s->extra = 0; S_PlayActorSound(474, other2); } - else if (other2->s.picnum == RRTILE295) + else if (other2->s->picnum == RRTILE295) deletesprite(other2); } si->picnum++; @@ -762,11 +762,11 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act) { BellTime = 132; BellSprite = act; - act->s.picnum++; + act->s->picnum++; } else if (picnum == RRTILE8464) { - act->s.picnum = act->s.picnum + 1; + act->s->picnum = act->s->picnum + 1; if (hitag == 10001) { if (ps[snum].SeaSick == 0) @@ -790,8 +790,8 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act) DukeLinearSpriteIterator it; while (auto actt = it.Next()) { - int jpn = actt->s.picnum; - int jht = actt->s.hitag; + int jpn = actt->s->picnum; + int jht = actt->s->hitag; if ((jpn == MULTISWITCH || jpn == MULTISWITCH2) && jht == 10000) { if (switchcount < 3) @@ -806,11 +806,11 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act) S_PlaySound3D(78, act, &v); for (j = 0; j < switchcount; j++) { - switches[j]->s.hitag = 0; + switches[j]->s->hitag = 0; if (picnum >= MULTISWITCH2) - switches[j]->s.picnum = MULTISWITCH2 + 3; + switches[j]->s->picnum = MULTISWITCH2 + 3; else - switches[j]->s.picnum = MULTISWITCH + 3; + switches[j]->s->picnum = MULTISWITCH + 3; checkhitswitch_r(snum, -1, switches[j]); } } @@ -831,16 +831,16 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act) DukeStatIterator it(STAT_EFFECTOR); while (auto other = it.Next()) { - if (other->s.hitag == lotag) + if (other->s->hitag == lotag) { - switch (other->s.lotag) + switch (other->s->lotag) { case 46: case SE_47_LIGHT_SWITCH: case SE_48_LIGHT_SWITCH: if (!isRRRA()) break; case SE_12_LIGHT_SWITCH: - sector[other->s.sectnum].floorpal = 0; + sector[other->s->sectnum].floorpal = 0; other->temp_data[0]++; if (other->temp_data[0] == 2) other->temp_data[0]++; @@ -901,9 +901,9 @@ void activatebysector_r(int sect, DDukeActor* activator) DukeSectIterator it(sect); while (auto act = it.Next()) { - if (act->s.picnum == ACTIVATOR) + if (act->s->picnum == ACTIVATOR) { - operateactivators(act->s.lotag, -1); + operateactivators(act->s->lotag, -1); // return; } } @@ -925,7 +925,7 @@ static void lotsofpopcorn(DDukeActor *actor, short wallnum, short n) short sect, a; sect = -1; - auto sp = &actor->s; + auto sp = actor->s; if (wallnum < 0) { @@ -1032,7 +1032,7 @@ void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw wall[wal->nextwall].cstat = 0; auto spawned = EGS(sn, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.asbuild(), 0, 0, spr, 3); - spawned->s.lotag = 128; + spawned->s->lotag = 128; spawned->temp_data[1] = 2; spawned->temp_data[2] = dawallnum; S_PlayActorSound(GLASS_BREAKING, spawned); @@ -1049,7 +1049,7 @@ void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw wall[wal->nextwall].cstat = 0; auto spawned = EGS(sn, x, y, z, SECTOREFFECTOR, 0, 0, 0, ps[0].angle.ang.asbuild(), 0, 0, spr, 3); - spawned->s.lotag = 128; + spawned->s->lotag = 128; spawned->temp_data[1] = 2; spawned->temp_data[2] = dawallnum; S_PlayActorSound(GLASS_BREAKING, spawned); @@ -1083,7 +1083,7 @@ void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw DukeSectIterator it(sect); while (auto act = it.Next()) { - s = &act->s; + s = act->s; if (s->lotag == 6) { //for (j = 0; j < 16; j++) RANDOMSCRAP(s, -1); This never spawned anything due to the -1. @@ -1095,7 +1095,7 @@ void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw for (i = startwall; i < endwall; i++) sector[wall[i].nextsector].lotag = 0; sector[s->sectnum].lotag = 0; - S_StopSound(act->s.lotag); + S_StopSound(act->s->lotag); S_PlayActorSound(400, act); deletesprite(act); } @@ -1356,7 +1356,7 @@ void checkhitwall_r(DDukeActor* spr, int dawallnum, int x, int y, int z, int atw DukeStatIterator it(STAT_EFFECTOR); while (auto act = it.Next()) { - if (act->s.hitag == wall[dawallnum].lotag && act->s.lotag == 3) + if (act->s->hitag == wall[dawallnum].lotag && act->s->lotag == 3) { act->temp_data[2] = j; act->temp_data[3] = darkestwall; @@ -1377,7 +1377,7 @@ void checkplayerhurt_r(struct player_struct* p, const Collision &coll) { if (coll.type == kHitSprite) { - switch (coll.actor->s.picnum) + switch (coll.actor->s->picnum) { case RRTILE2430: case RRTILE2431: @@ -1388,7 +1388,7 @@ void checkplayerhurt_r(struct player_struct* p, const Collision &coll) case RRTILE2455: if (isRRRA() && p->hurt_delay2 < 8) { - p->GetActor()->s.extra -= 2; + p->GetActor()->s->extra -= 2; p->hurt_delay2 = 16; SetPlayerPal(p, PalEntry(32, 32, 0, 0)); S_PlayActorSound(DUKE_LONGTERM_PAIN, p->GetActor()); @@ -1397,7 +1397,7 @@ void checkplayerhurt_r(struct player_struct* p, const Collision &coll) case CACTUS: if (!isRRRA() && p->hurt_delay < 8) { - p->GetActor()->s.extra -= 5; + p->GetActor()->s->extra -= 5; p->hurt_delay = 16; SetPlayerPal(p, PalEntry(32, 32, 0, 0)); S_PlayActorSound(DUKE_LONGTERM_PAIN, p->GetActor()); @@ -1495,13 +1495,13 @@ bool checkhitceiling_r(int sn) DukeSectIterator it(sn); while (auto act1 = it.Next()) { - auto spr1 = &act1->s; + auto spr1 = act1->s; if (spr1->picnum == SECTOREFFECTOR && (spr1->lotag == 12 || (isRRRA() && (spr1->lotag == 47 || spr1->lotag == 48)))) { DukeStatIterator it(STAT_EFFECTOR); while (auto act2 = it.Next()) { - if (act2->s.hitag == spr1->hitag) + if (act2->s->hitag == spr1->hitag) act2->temp_data[3] = 1; } break; @@ -1513,7 +1513,7 @@ bool checkhitceiling_r(int sn) DukeStatIterator it(STAT_EFFECTOR); while (auto act1 = it.Next()) { - auto spr1 = &act1->s; + auto spr1 = act1->s; if (spr1->hitag == (sector[sn].hitag) && spr1->lotag == 3) { act1->temp_data[2] = j; @@ -1536,8 +1536,8 @@ bool checkhitceiling_r(int sn) void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) { int j, k, p; - spritetype* s = &targ->s; - auto pspr = &proj->s; + spritetype* s = targ->s; + auto pspr = proj->s; if (isRRRA()) switch (s->picnum) { @@ -1919,10 +1919,10 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) DukeSpriteIterator it; while (auto act = it.Next()) { - if (act->s.picnum == RRTILE8679 && act->s.pal == 4) + if (act->s->picnum == RRTILE8679 && act->s->pal == 4) { - if (act->s.lotag == s->lotag) - act->s.picnum = RRTILE8680; + if (act->s->lotag == s->lotag) + act->s->picnum = RRTILE8680; } } } @@ -1945,8 +1945,8 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) DukeSpriteIterator it; while (auto act = it.Next()) { - if (act->s.picnum == RRTILE8094) - act->s.picnum = RRTILE5088; + if (act->s->picnum == RRTILE8094) + act->s->picnum = RRTILE5088; } } break; @@ -1959,10 +1959,10 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) DukeSpriteIterator it; while (auto act = it.Next()) { - if (act->s.picnum == RRTILE2431 && act->s.pal == 4) + if (act->s->picnum == RRTILE2431 && act->s->pal == 4) { - if (s->lotag == act->s.lotag) - act->s.picnum = RRTILE2451; + if (s->lotag == act->s->lotag) + act->s->picnum = RRTILE2451; } } } @@ -1986,14 +1986,14 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) DukeSpriteIterator it; while (auto act = it.Next()) { - if (act->s.picnum == RRTILE2451 && act->s.pal == 4) + if (act->s->picnum == RRTILE2451 && act->s->pal == 4) { - if (s->lotag == act->s.lotag) + if (s->lotag == act->s->lotag) { fi.guts(targ, RRTILE2460, 12, myconnectindex); fi.guts(targ, RRTILE2465, 3, myconnectindex); - act->s.xrepeat = 0; - act->s.yrepeat = 0; + act->s->xrepeat = 0; + act->s->yrepeat = 0; s->xrepeat = 0; s->yrepeat = 0; } @@ -2161,7 +2161,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) for (k = 0; k < 64; k++) { auto j = EGS(s->sectnum, s->x, s->y, s->z - (krand() % (48 << 8)), SCRAP6 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (s->zvel >> 2), targ, 5); - j->s.pal = 8; + j->s->pal = 8; } if (s->picnum == CACTUS) @@ -2317,7 +2317,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) } { auto j = spawn(targ, STEAM); - j->s.z = sector[s->sectnum].floorz - (32 << 8); + j->s->z = sector[s->sectnum].floorz - (32 << 8); } break; @@ -2342,7 +2342,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) case PLAYERONWATER: targ = targ->GetOwner(); if (!targ) break; - s = &targ->s; + s = targ->s; default: if ((s->cstat & 16) && s->hitag == 0 && s->lotag == 0 && s->statnum == 0) break; @@ -2360,16 +2360,16 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) { auto spawned = spawn(proj, JIBS6); if (pspr->pal == 6) - spawned->s.pal = 6; - spawned->s.z += (4 << 8); - spawned->s.xvel = 16; - spawned->s.xrepeat = spawned->s.yrepeat = 24; - spawned->s.ang += 32 - (krand() & 63); + spawned->s->pal = 6; + spawned->s->z += (4 << 8); + spawned->s->xvel = 16; + spawned->s->xrepeat = spawned->s->yrepeat = 24; + spawned->s->ang += 32 - (krand() & 63); } auto Owner = proj->GetOwner(); - if (Owner && Owner->s.picnum == APLAYER && s->picnum != DRONE) + if (Owner && Owner->s->picnum == APLAYER && s->picnum != DRONE) if (ps[Owner->PlayerIndex()].curr_weapon == SHOTGUN_WEAPON) { fi.shoot(targ, BLOODSPLAT3); @@ -2412,11 +2412,11 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) DukeStatIterator it(STAT_EFFECTOR); while (auto act = it.Next()) { - if (act->s.picnum == CAMERA1) act->s.yvel = 0; + if (act->s->picnum == CAMERA1) act->s->yvel = 0; } } auto Owner = targ->GetHitOwner(); - if (!Owner || Owner->s.picnum != APLAYER) + if (!Owner || Owner->s->picnum != APLAYER) if (ud.player_skill >= 3) pspr->extra += (pspr->extra >> 1); } @@ -2479,7 +2479,7 @@ void checksectors_r(int snum) //After this point the the player effects the map with space - if (chatmodeon || p->GetActor()->s.extra <= 0) return; + if (chatmodeon || p->GetActor()->s->extra <= 0) return; if (ud.cashman && PlayerInput(snum, SB_OPEN)) fi.lotsofmoney(p->GetActor(), 2); @@ -2553,24 +2553,24 @@ void checksectors_r(int snum) } return; } - neartag(p->posx, p->posy, p->posz, p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3); + neartag(p->posx, p->posy, p->posz, p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3); } if (p->newOwner != nullptr) - neartag(p->oposx, p->oposy, p->oposz, p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); + neartag(p->oposx, p->oposy, p->oposz, p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); else { - neartag(p->posx, p->posy, p->posz, p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); + neartag(p->posx, p->posy, p->posz, p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); if (neartagsprite == nullptr && neartagwall == -1 && neartagsector == -1) - neartag(p->posx, p->posy, p->posz + (8 << 8), p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); + neartag(p->posx, p->posy, p->posz + (8 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); if (neartagsprite == nullptr && neartagwall == -1 && neartagsector == -1) - neartag(p->posx, p->posy, p->posz + (16 << 8), p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); + neartag(p->posx, p->posy, p->posz + (16 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 1); if (neartagsprite == nullptr && neartagwall == -1 && neartagsector == -1) { - neartag(p->posx, p->posy, p->posz + (16 << 8), p->GetActor()->s.sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3); + neartag(p->posx, p->posy, p->posz + (16 << 8), p->GetActor()->s->sectnum, p->angle.oang.asbuild(), &neartagsector, &neartagwall, &neartagsprite, &neartaghitdist, 1280L, 3); if (neartagsprite != nullptr) { - switch (neartagsprite->s.picnum) + switch (neartagsprite->s->picnum) { case FEM10: case NAKED1: @@ -2590,8 +2590,8 @@ void checksectors_r(int snum) } if (p->newOwner == nullptr && neartagsprite == nullptr && neartagsector == -1 && neartagwall == -1) - if (isanunderoperator(sector[p->GetActor()->s.sectnum].lotag)) - neartagsector = p->GetActor()->s.sectnum; + if (isanunderoperator(sector[p->GetActor()->s->sectnum].lotag)) + neartagsector = p->GetActor()->s->sectnum; if (neartagsector >= 0 && (sector[neartagsector].lotag & 16384)) return; @@ -2609,7 +2609,7 @@ void checksectors_r(int snum) { if (fi.checkhitswitch(snum, -1,neartagsprite)) return; - switch (neartagsprite->s.picnum) + switch (neartagsprite->s->picnum) { case RRTILE8448: if (!isRRRA()) return; @@ -2658,7 +2658,7 @@ void checksectors_r(int snum) case RRTILE8594: case RRTILE8595: if (!isRRRA()) return; - neartagsprite->s.extra = 60; + neartagsprite->s->extra = 60; S_PlayActorSound(235, neartagsprite); return; @@ -2677,13 +2677,13 @@ void checksectors_r(int snum) p->holster_weapon = 1; p->weapon_pos = -1; } - if (p->GetActor()->s.extra <= (gs.max_player_health - (gs.max_player_health / 10))) + if (p->GetActor()->s->extra <= (gs.max_player_health - (gs.max_player_health / 10))) { - p->GetActor()->s.extra += gs.max_player_health / 10; - p->last_extra = p->GetActor()->s.extra; + p->GetActor()->s->extra += gs.max_player_health / 10; + p->last_extra = p->GetActor()->s->extra; } - else if (p->GetActor()->s.extra < gs.max_player_health) - p->GetActor()->s.extra = gs.max_player_health; + else if (p->GetActor()->s->extra < gs.max_player_health) + p->GetActor()->s->extra = gs.max_player_health; } else if (S_CheckActorSoundPlaying(pact, DUKE_GRUNT) == 0) S_PlayActorSound(DUKE_GRUNT, pact); @@ -2694,16 +2694,16 @@ void checksectors_r(int snum) neartagsprite->temp_data[0] = 1; neartagsprite->SetOwner(p->GetActor()); - if (p->GetActor()->s.extra < gs.max_player_health) + if (p->GetActor()->s->extra < gs.max_player_health) { - p->GetActor()->s.extra++; + p->GetActor()->s->extra++; S_PlayActorSound(DUKE_DRINKING, pact); } } return; case PLUG: S_PlayActorSound(SHORT_CIRCUIT, pact); - p->GetActor()->s.extra -= 2 + (krand() & 3); + p->GetActor()->s->extra -= 2 + (krand() & 3); SetPlayerPal(p, PalEntry(32, 48, 48, 64)); break; } @@ -2736,7 +2736,7 @@ void checksectors_r(int snum) DukeSectIterator it(neartagsector); while (auto act = it.Next()) { - if (act->s.picnum == ACTIVATOR || act->s.picnum == MASTERSWITCH) + if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH) return; } if (haskey(neartagsector, snum)) @@ -2750,18 +2750,18 @@ void checksectors_r(int snum) FTA(41, p); } } - else if ((sector[p->GetActor()->s.sectnum].lotag & 16384) == 0) + else if ((sector[p->GetActor()->s->sectnum].lotag & 16384) == 0) { - if (isanunderoperator(sector[p->GetActor()->s.sectnum].lotag)) + if (isanunderoperator(sector[p->GetActor()->s->sectnum].lotag)) { - DukeSectIterator it(p->GetActor()->s.sectnum); + DukeSectIterator it(p->GetActor()->s->sectnum); while (auto act = it.Next()) { - if (act->s.picnum == ACTIVATOR || act->s.picnum == MASTERSWITCH) + if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH) return; } if (haskey(neartagsector, snum)) - operatesectors(p->GetActor()->s.sectnum, p->GetActor()); + operatesectors(p->GetActor()->s->sectnum, p->GetActor()); else { if (neartagsprite && neartagsprite->spriteextra > 3) @@ -2905,7 +2905,7 @@ void tearitup(int sect) DukeSectIterator it(sect); while (auto act = it.Next()) { - if (act->s.picnum == DESTRUCTO) + if (act->s->picnum == DESTRUCTO) { act->picnum = SHOTSPARK1; act->extra = 1; diff --git a/source/games/duke/src/sounds.cpp b/source/games/duke/src/sounds.cpp index aefc53400..c9214b65b 100644 --- a/source/games/duke/src/sounds.cpp +++ b/source/games/duke/src/sounds.cpp @@ -56,7 +56,7 @@ BEGIN_DUKE_NS // These are needed until real objects can be used for actors. inline void* sndActor(DDukeActor* actor) { - return actor ? &actor->s : nullptr; + return actor ? actor->s : nullptr; } inline DDukeActor* getSndActor(const void* source) @@ -124,7 +124,7 @@ public: { UnloadSound(schan->SoundID); currentCommentarySound = 0; - currentCommentarySprite->s.picnum = DEVELOPERCOMMENTARY; + currentCommentarySprite->s->picnum = DEVELOPERCOMMENTARY; I_SetRelativeVolume(1.0f); UnmuteSounds(); } @@ -257,7 +257,7 @@ int S_DefineSound(unsigned index, const char *filename, int minpitch, int maxpit inline bool S_IsAmbientSFX(DDukeActor* actor) { - return (actor->s.picnum == MUSICANDSFX && actor->s.lotag < 999); + return (actor->s->picnum == MUSICANDSFX && actor->s->lotag < 999); } //========================================================================== @@ -272,7 +272,7 @@ static int GetPositionInfo(DDukeActor* actor, int soundNum, int sectNum, // There's a lot of hackery going on here that could be mapped to rolloff and attenuation parameters. // However, ultimately rolloff would also just reposition the sound source so this can remain as it is. - auto sp = &actor->s; + auto sp = actor->s; int orgsndist = 0, sndang = 0, sndist = 0, explosion = 0; auto const* snd = soundEngine->GetUserData(soundNum + 1); int userflags = snd ? snd[kFlags] : 0; @@ -337,9 +337,9 @@ void S_GetCamera(vec3_t** c, int32_t* ca, int32_t* cs) } else { - if (c) *c = &ud.cameraactor->s.pos; - if (cs) *cs = ud.cameraactor->s.sectnum; - if (ca) *ca = ud.cameraactor->s.ang; + if (c) *c = &ud.cameraactor->s->pos; + if (cs) *cs = ud.cameraactor->s->sectnum; + if (ca) *ca = ud.cameraactor->s->ang; } } @@ -370,11 +370,11 @@ void DukeSoundEngine::CalcPosVel(int type, const void* source, const float pt[3] else if (type == SOURCE_Actor) { auto aactor = getSndActor(source); - auto actor = aactor ? &aactor->s : nullptr; - assert(actor != nullptr); - if (actor != nullptr) + auto aspr = aactor ? aactor->s : nullptr; + assert(aspr != nullptr); + if (aspr != nullptr) { - GetPositionInfo(aactor, chanSound - 1, camsect, campos, &actor->pos, nullptr, pos); + GetPositionInfo(aactor, chanSound - 1, camsect, campos, &aspr->pos, nullptr, pos); /* if (vel) // DN3D does not properly maintain this. { @@ -431,7 +431,7 @@ void GameInterface::UpdateSounds(void) listener.Environment = nullptr; listener.valid = false; } - listener.ListenerObject = ud.cameraactor == nullptr ? nullptr : &ud.cameraactor->s; + listener.ListenerObject = ud.cameraactor == nullptr ? nullptr : ud.cameraactor->s; soundEngine->SetListener(listener); } @@ -459,7 +459,7 @@ int S_PlaySound3D(int sndnum, DDukeActor* actor, const vec3_t* pos, int channel, if (userflags & SF_TALK) { - if (snd_speech == 0 || (ud.multimode > 1 && actor->s.picnum == TILE_APLAYER && actor->s.yvel != screenpeek && ud.coop != 1)) return -1; + if (snd_speech == 0 || (ud.multimode > 1 && actor->s->picnum == TILE_APLAYER && actor->s->yvel != screenpeek && ud.coop != 1)) return -1; bool foundone = soundEngine->EnumerateChannels([&](FSoundChan* chan) { auto sid = chan->OrgID; @@ -497,7 +497,7 @@ int S_PlaySound3D(int sndnum, DDukeActor* actor, const vec3_t* pos, int channel, } else { - if (sndist > 32767 && actor->s.picnum != MUSICANDSFX && (userflags & (SF_LOOP | SF_MSFX)) == 0) + if (sndist > 32767 && actor->s->picnum != MUSICANDSFX && (userflags & (SF_LOOP | SF_MSFX)) == 0) return -1; if (underwater && (userflags & SF_TALK) == 0) @@ -505,7 +505,7 @@ int S_PlaySound3D(int sndnum, DDukeActor* actor, const vec3_t* pos, int channel, } bool is_playing = soundEngine->GetSoundPlayingInfo(SOURCE_Any, nullptr, sndnum+1); - if (is_playing && actor->s.picnum != MUSICANDSFX) + if (is_playing && actor->s->picnum != MUSICANDSFX) S_StopSound(sndnum, actor); int const repeatp = (userflags & SF_LOOP); @@ -564,12 +564,12 @@ int S_PlaySound(int sndnum, int channel, EChanFlags flags, float vol) int S_PlayActorSound(int soundNum, DDukeActor* actor, int channel, EChanFlags flags) { return (actor == nullptr ? S_PlaySound(soundNum, channel, flags) : - S_PlaySound3D(soundNum, actor, &actor->s.pos, channel, flags)); + S_PlaySound3D(soundNum, actor, &actor->s->pos, channel, flags)); } void S_RelinkActorSound(DDukeActor* from, DDukeActor* to) { - FVector3 pos = GetSoundPos(&from->s.pos); + FVector3 pos = GetSoundPos(&from->s->pos); soundEngine->RelinkSound(SOURCE_Actor, sndActor(from), sndActor(to), &pos); } @@ -584,7 +584,7 @@ void S_StopSound(int sndNum, DDukeActor* actor, int channel) else soundEngine->StopSound(SOURCE_Actor, actor, channel, -1); // StopSound kills the actor reference so this cannot be delayed until ChannelEnded gets called. At that point the actor may also not be valid anymore. - if (S_IsAmbientSFX(actor) && sector[actor->s.sectnum].lotag < 3) // ST_2_UNDERWATER + if (S_IsAmbientSFX(actor) && sector[actor->s->sectnum].lotag < 3) // ST_2_UNDERWATER actor->temp_data[0] = 0; } } diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index 7cf3f57ae..b087cba1b 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -57,7 +57,7 @@ DDukeActor* EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed ch I_Error(" Too many sprites spawned."); auto act = &hittype[i]; - auto s = &act->s; + auto s = act->s; s->x = s_x; s->y = s_y; @@ -95,7 +95,7 @@ DDukeActor* EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed ch if (s_ow) { - act->picnum = s_ow->s.picnum; + act->picnum = s_ow->s->picnum; act->floorz = s_ow->floorz; act->ceilingz = s_ow->ceilingz; } @@ -143,9 +143,9 @@ int initspriteforspawn(DDukeActor* actj, int pn, const std::initializer_lists.sectnum, actj->s.x, actj->s.y, actj->s.z, pn, 0, 0, 0, 0, 0, 0, actj, 0); - spawned->picnum = actj->s.picnum; - sp = &spawned->s; + auto spawned = EGS(actj->s->sectnum, actj->s->x, actj->s->y, actj->s->z, pn, 0, 0, 0, 0, 0, 0, actj, 0); + spawned->picnum = actj->s->picnum; + sp = spawned->s; t = spawned->temp_data; i = spawned->GetIndex(); } @@ -153,7 +153,7 @@ int initspriteforspawn(DDukeActor* actj, int pn, const std::initializer_lists; + sp = act->s; t = act->temp_data; act->picnum = sp->picnum; @@ -234,7 +234,7 @@ int initspriteforspawn(DDukeActor* actj, int pn, const std::initializer_lists; + auto sp = act->s; auto sect = sp->sectnum; if (gs.actorinfo[sp->picnum].scriptaddress) @@ -271,8 +271,8 @@ void spawninitdefault(DDukeActor* actj, DDukeActor *act) sp->clipdist = 80; if (actj) { - if (actj->s.picnum == RESPAWN) - act->tempang = sp->pal = actj->s.pal; + if (actj->s->picnum == RESPAWN) + act->tempang = sp->pal = actj->s->pal; changespritestat(act, STAT_ACTOR); } else changespritestat(act, STAT_ZOMBIEACTOR); @@ -287,7 +287,7 @@ void spawninitdefault(DDukeActor* actj, DDukeActor *act) act->timetosleep = 0; if (actj) - sp->ang = actj->s.ang; + sp->ang = actj->s->ang; } } @@ -300,8 +300,8 @@ void spawninitdefault(DDukeActor* actj, DDukeActor *act) void spawntransporter(DDukeActor *actj, DDukeActor* acti, bool beam) { if (actj == nullptr) return; - auto sp = &acti->s; - auto spj = &actj->s; + auto sp = acti->s; + auto spj = actj->s; if (beam) { sp->xrepeat = 31; @@ -342,7 +342,7 @@ void spawntransporter(DDukeActor *actj, DDukeActor* acti, bool beam) int spawnbloodpoolpart1(DDukeActor *actj, DDukeActor* acti) { - auto sp = &acti->s; + auto sp = acti->s; short s1 = sp->sectnum; updatesector(sp->x + 108, sp->y + 108, &s1); @@ -382,7 +382,7 @@ int spawnbloodpoolpart1(DDukeActor *actj, DDukeActor* acti) void initfootprint(DDukeActor* actj, DDukeActor* acti) { - auto sp = &acti->s; + auto sp = acti->s; int sect = sp->sectnum; if (actj) { @@ -410,8 +410,8 @@ void initfootprint(DDukeActor* actj, DDukeActor* acti) } else { sp->xrepeat = sp->yrepeat = 0; return; } - sp->cstat = 32 + ((ps[actj->s.yvel].footprintcount & 1) << 2); - sp->ang = actj->s.ang; + sp->cstat = 32 + ((ps[actj->s->yvel].footprintcount & 1) << 2); + sp->ang = actj->s->ang; } sp->z = sector[sect].floorz; @@ -430,12 +430,12 @@ void initfootprint(DDukeActor* actj, DDukeActor* acti) void initshell(DDukeActor* actj, DDukeActor* acti, bool isshell) { - auto sp = &acti->s; + auto sp = acti->s; int sect = sp->sectnum; auto t = acti->temp_data; if (actj) { - auto spj = &actj->s; + auto spj = actj->s; short snum, a; if (spj->picnum == TILE_APLAYER) @@ -484,7 +484,7 @@ void initshell(DDukeActor* actj, DDukeActor* acti, bool isshell) void initcrane(DDukeActor* actj, DDukeActor* acti, int CRANEPOLE) { - auto sp = &acti->s; + auto sp = acti->s; int sect = sp->sectnum; auto t = acti->temp_data; sp->cstat |= 64 | 257; @@ -500,7 +500,7 @@ void initcrane(DDukeActor* actj, DDukeActor* acti, int CRANEPOLE) DukeStatIterator it(STAT_DEFAULT); while (auto act = it.Next()) { - auto ss = &act->s; + auto ss = act->s; if (ss->picnum == CRANEPOLE && sp->hitag == (ss->hitag)) { msy[tempwallptr + 2] = ActorToScriptIndex(act); @@ -537,13 +537,13 @@ void initcrane(DDukeActor* actj, DDukeActor* acti, int CRANEPOLE) void initwaterdrip(DDukeActor* actj, DDukeActor* actor) { - auto sp = &actor->s; + auto sp = actor->s; int sect = sp->sectnum; auto t = actor->temp_data; - if (actj && (actj->s.statnum == 10 || actj->s.statnum == 1)) + if (actj && (actj->s->statnum == 10 || actj->s->statnum == 1)) { sp->shade = 32; - if (actj->s.pal != 1) + if (actj->s->pal != 1) { sp->pal = 2; sp->z -= (18 << 8); @@ -573,7 +573,7 @@ void initwaterdrip(DDukeActor* actj, DDukeActor* actor) int initreactor(DDukeActor* actj, DDukeActor* actor, bool isrecon) { - auto sp = &actor->s; + auto sp = actor->s; int sect = sp->sectnum; auto t = actor->temp_data; if (isrecon) @@ -621,7 +621,7 @@ int initreactor(DDukeActor* actj, DDukeActor* actor, bool isrecon) void spawneffector(DDukeActor* actor) { - auto sp = &actor->s; + auto sp = actor->s; int sect = sp->sectnum; auto t = actor->temp_data; int startwall, endwall, x, y, d, s, clostest; @@ -642,8 +642,8 @@ void spawneffector(DDukeActor* actor) DukeLinearSpriteIterator it; while (auto act2 = it.Next()) { - if (act2->s.statnum < MAXSTATUS && act2->s.picnum == SECTOREFFECTOR && (act2->s.lotag == SE_7_TELEPORT || act2->s.lotag == SE_23_ONE_WAY_TELEPORT) && - actor != act2 && act2->s.hitag == sp->hitag) + if (act2->s->statnum < MAXSTATUS && act2->s->picnum == SECTOREFFECTOR && (act2->s->lotag == SE_7_TELEPORT || act2->s->lotag == SE_23_ONE_WAY_TELEPORT) && + actor != act2 && act2->s->hitag == sp->hitag) { actor->SetOwner(act2); break; @@ -976,7 +976,7 @@ void spawneffector(DDukeActor* actor) bool found = false; while (auto act2 = it.Next()) { - auto spr = &act2->s; + auto spr = act2->s; if (spr->statnum < MAXSTATUS) if (spr->picnum == SECTOREFFECTOR && spr->lotag == SE_1_PIVOT && @@ -1094,17 +1094,17 @@ void spawneffector(DDukeActor* actor) case SE_15_SLIDING_DOOR: case SE_16_REACTOR: case SE_26: - setsectinterpolate(actor->s.sectnum); + setsectinterpolate(actor->s->sectnum); break; case SE_29_WAVES: - StartInterpolation(actor->s.sectnum, Interp_Sect_Floorheinum); - StartInterpolation(actor->s.sectnum, Interp_Sect_Floorz); + StartInterpolation(actor->s->sectnum, Interp_Sect_Floorheinum); + StartInterpolation(actor->s->sectnum, Interp_Sect_Floorz); break; } - if ((!isRR() && actor->s.lotag >= 40 && actor->s.lotag <= 45) || - (isRRRA() && actor->s.lotag >= 150 && actor->s.lotag <= 155)) + if ((!isRR() && actor->s->lotag >= 40 && actor->s->lotag <= 45) || + (isRRRA() && actor->s->lotag >= 150 && actor->s->lotag <= 155)) changespritestat(actor, STAT_RAROR); else changespritestat(actor, STAT_EFFECTOR); @@ -1121,7 +1121,7 @@ void lotsofglass(DDukeActor *actor, int wallnum, int n) { int j, xv, yv, z, x1, y1, a; short sect; - auto sp = &actor->s; + auto sp = actor->s; sect = -1; @@ -1174,14 +1174,14 @@ void lotsofglass(DDukeActor *actor, int wallnum, int n) void spriteglass(DDukeActor* actor, int n) { - auto sp = &actor->s; + auto sp = actor->s; for (int j = n; j > 0; j--) { int a = krand() & 2047; int z = sp->z - ((krand() & 16) << 8); auto k = EGS(sp->sectnum, sp->x, sp->y, z, TILE_GLASSPIECES + (j % 3), krand() & 15, 36, 36, a, 32 + (krand() & 63), -512 - (krand() & 2047), actor, 5); - k->s.pal = sp->pal; + k->s->pal = sp->pal; } } @@ -1195,7 +1195,7 @@ void ceilingglass(DDukeActor* actor, int sectnum, int n) { int j, xv, yv, z, x1, y1; int a, s, startwall, endwall; - auto sp = &actor->s; + auto sp = actor->s; startwall = sector[sectnum].wallptr; endwall = startwall + sector[sectnum].wallnum; @@ -1230,7 +1230,7 @@ void lotsofcolourglass(DDukeActor* actor, int wallnum, int n) int j, xv, yv, z, x1, y1; short sect = -1; int a;; - auto sp = &actor->s; + auto sp = actor->s; if (wallnum < 0) { @@ -1238,7 +1238,7 @@ void lotsofcolourglass(DDukeActor* actor, int wallnum, int n) { a = krand() & 2047; auto k = EGS(sp->sectnum, sp->x, sp->y, sp->z - (krand() & (63 << 8)), TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), 1024 - (krand() & 2047), actor, 5); - k->s.pal = krand() & 15; + k->s->pal = krand() & 15; } return; } @@ -1261,7 +1261,7 @@ void lotsofcolourglass(DDukeActor* actor, int wallnum, int n) z = sp->z - (32 << 8) + (krand() & ((64 << 8) - 1)); a = sp->ang - 1024; auto k = EGS(sp->sectnum, x1, y1, z, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), -(krand() & 2047), actor, 5); - k->s.pal = krand() & 7; + k->s->pal = krand() & 7; } } diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp index bc861e7f1..7b06e1ab0 100644 --- a/source/games/duke/src/spawn_d.cpp +++ b/source/games/duke/src/spawn_d.cpp @@ -50,8 +50,8 @@ int spawn_d(int j, int pn) if (!(i & 0x1000000)) return i; i &= 0xffffff; auto act = &hittype[i]; - auto sp = &act->s; - auto spj = j < 0 ? nullptr : &actj->s; + auto sp = act->s; + auto spj = j < 0 ? nullptr : actj->s; auto t = act->temp_data; int sect = sp->sectnum; diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index 4b8f2c4cc..d63d6cfc0 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -45,8 +45,8 @@ int spawn_r(int j, int pn) if (!(i & 0x1000000)) return i; i &= 0xffffff; auto act = &hittype[i]; - auto sp = &act->s; - auto spj = j < 0? nullptr : &actj->s; + auto sp = act->s; + auto spj = j < 0? nullptr : actj->s; auto t = act->temp_data; int sect = sp->sectnum; diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index 681604cbd..33d948929 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -36,11 +36,11 @@ struct weaponhit }; int temp_data[6]; weaponhit* temp_actor, *seek_actor; - spritetype& s; // direct reference to the corresponding sprite. + spritetype* s; // direct reference to the corresponding sprite. static weaponhit* array(); // this is necessary to allow define inline functions referencing the global array inside the definition itself. - weaponhit() : s(sprite_s[this - array()]) {} // little trick to initialize the reference automatically. ;) + weaponhit() : s(&sprite_s[this - array()]) {} // little trick to initialize the reference automatically. ;) weaponhit(const weaponhit& other) = delete; // we also do not want to allow copies. weaponhit& operator=(const weaponhit& other) = delete; void clear() @@ -55,12 +55,12 @@ struct weaponhit // Wrapper around some ugliness. The 'owner' field gets abused by some actors, so better wrap its real use in access functions to keep things in order. inline weaponhit* GetOwner() { - return s.owner < 0 ? nullptr : &array()[s.owner]; + return s->owner < 0 ? nullptr : &array()[s->owner]; } inline void SetOwner(weaponhit* a) { - s.owner = a? a->GetIndex() : -1; + s->owner = a? a->GetIndex() : -1; } // same for the 'hittype' owner - which is normally the shooter in an attack. @@ -77,18 +77,18 @@ struct weaponhit // This used the Owner field - better move this to something more safe. inline bool IsActiveCrane() { - return s.owner == -2; + return s->owner == -2; } inline void SetActiveCrane(bool yes) { - s.owner = yes ? -2 : -1; + s->owner = yes ? -2 : -1; } int PlayerIndex() const { // only valid for real players - just here to abstract yvel. - return s.yvel; + return s->yvel; } diff --git a/source/games/exhumed/src/exhumed.h b/source/games/exhumed/src/exhumed.h index 8ea32fea1..fb8f6075f 100644 --- a/source/games/exhumed/src/exhumed.h +++ b/source/games/exhumed/src/exhumed.h @@ -243,7 +243,7 @@ struct GameInterface : ::GameInterface void GetInput(InputPacket* packet, ControlInfo* const hidInput) override; void Startup() override; const char* GenericCheat(int player, int cheat) override; - void NewGame(MapRecord *map, int skill) override; + void NewGame(MapRecord *map, int skill, bool) override; void LevelCompleted(MapRecord *map, int skill) override; void NextLevel(MapRecord *map, int skill) override; bool DrawAutomapPlayer(int x, int y, int z, int a, double const smoothratio) override; diff --git a/source/games/exhumed/src/gameloop.cpp b/source/games/exhumed/src/gameloop.cpp index 2392a9760..82172390d 100644 --- a/source/games/exhumed/src/gameloop.cpp +++ b/source/games/exhumed/src/gameloop.cpp @@ -212,12 +212,13 @@ void GameInterface::NextLevel(MapRecord *map, int skill) } -void GameInterface::NewGame(MapRecord *map, int skill) +void GameInterface::NewGame(MapRecord *map, int skill, bool frommenu) { // start a new game on the given level InitNewGame(); if (map->levelNumber == 1) STAT_StartNewGame("Exhumed", 1); - Intermission(nullptr, map); + if (frommenu) Intermission(nullptr, map); + else NextLevel(map, skill); } void GameInterface::LevelCompleted(MapRecord *map, int skill) diff --git a/source/games/sw/src/game.cpp b/source/games/sw/src/game.cpp index 716a03184..a7ca1a910 100644 --- a/source/games/sw/src/game.cpp +++ b/source/games/sw/src/game.cpp @@ -610,7 +610,7 @@ void GameInterface::NextLevel(MapRecord *map, int skill) // //--------------------------------------------------------------------------- -void GameInterface::NewGame(MapRecord *map, int skill) +void GameInterface::NewGame(MapRecord *map, int skill, bool) { if (skill != -1) Skill = skill; ShadowWarrior::NewGame = true; diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 33c3a95db..d9784cf61 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -2233,7 +2233,7 @@ struct GameInterface : ::GameInterface const char* GenericCheat(int player, int cheat) override; void LevelCompleted(MapRecord *map, int skill) override; void NextLevel(MapRecord *map, int skill) override; - void NewGame(MapRecord *map, int skill) override; + void NewGame(MapRecord *map, int skill, bool) override; bool DrawAutomapPlayer(int x, int y, int z, int a, double const smoothratio) override; int playerKeyMove() override { return 35; } void WarpToCoords(int x, int y, int z, int a, int h) override;