diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index fe35feb24..2aba4bd3a 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -570,7 +570,7 @@ int movesprite_ex_d(DDukeActor* actor, int xchange, int ychange, int zchange, un { if (spri->picnum == LIZMAN) cd = 292; - else if (actorflag(actor->GetIndex(), SFLAG_BADGUY)) + else if (actorflag(actor, SFLAG_BADGUY)) cd = spri->clipdist << 2; else cd = 192; diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index eabbfd6b8..5bb41cf8c 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -602,7 +602,7 @@ void movefta_r(void) default: #if 0 // TRANSITIONAL: RedNukem has this here. Needed? - if (actorflag(spriteNum, SFLAG_USEACTIVATOR) && sector[s prite[spriteNum].sectnum].lotag & 16384) break; + if (actorflag(act, SFLAG_USEACTIVATOR) && sector[act->s.lotag & 16384) break; #endif act->timetosleep = 0; check_fta_sounds_r(act); diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index ab9eae4f8..1cec095cb 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -417,6 +417,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang) yvect2 = mulscale16(yvect, yxaspect); //Draw sprites + auto pactor = ps[screenpeek].GetActor(); for (i = 0; i < numsectors; i++) { if (!gFullMap || !show2dsector[i]) continue; @@ -425,7 +426,7 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang) { spr = &act->s; - if (act == ps[screenpeek].GetActor() || (spr->cstat & 0x8000) || spr->cstat == 257 || spr->xrepeat == 0) continue; + if (act == pactor || (spr->cstat & 0x8000) || spr->cstat == 257 || spr->xrepeat == 0) continue; col = PalEntry(0, 170, 170); if (spr->cstat & 1) col = PalEntry(170, 0, 170); diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 76e6b7fbd..a02babdb3 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -1900,7 +1900,7 @@ int ParseState::parse(void) { if (g_ac->spriteextra < 1 || g_ac->spriteextra == 128) { - if (actorfella(g_ac->GetIndex())) + if (actorfella(g_ac)) ps[g_p].actors_killed += *insptr; } } diff --git a/source/games/duke/src/inlines.h b/source/games/duke/src/inlines.h index cbc53b7dc..698c87ff9 100644 --- a/source/games/duke/src/inlines.h +++ b/source/games/duke/src/inlines.h @@ -37,14 +37,14 @@ inline int bossguy(spritetype const* const pSprite) return bossguypic(pSprite->picnum); } -inline int actorflag(int spritenum, int mask) +inline int actorflag(DDukeActor * actor, int mask) { - return (((actorinfo[sprite[spritenum].picnum].flags/* ^ hittype[spritenum].flags*/) & mask) != 0); + return (((actorinfo[actor->s.picnum].flags/* ^ hittype[spritenum].flags*/) & mask) != 0); } -inline int actorfella(int spnum) +inline int actorfella(DDukeActor* actor) { - return actorflag(spnum, SFLAG_KILLCOUNT); + return actorflag(actor, SFLAG_KILLCOUNT); } inline void setflag(int flag, const std::initializer_list& types) diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index c81c1f7a8..499d8a06c 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -283,15 +283,15 @@ void hud_input(int plnum) { p->inven_icon = 3; - i = + auto pactor = EGS(p->cursectnum, p->posx, p->posy, - p->posz + (30 << 8), TILE_APLAYER, -64, 0, 0, p->angle.ang.asbuild(), 0, 0, -1, 10); - hittype[i].temp_data[3] = hittype[i].temp_data[4] = 0; - p->holoduke_on = &hittype[i]; - sprite[i].yvel = plnum; - sprite[i].extra = 0; + 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; FTA(QUOTE_HOLODUKE_ON, p); S_PlayActorSound(TELEPORTER, p->holoduke_on); } @@ -918,7 +918,7 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput) if (!cl_syncinput) { - if (sprite[p->i].extra > 0) + if (p->GetActor()->s.extra > 0) { // Do these in the same order as the old code. calcviewpitch(p, scaleAdjust); diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index f4acaa142..0f0a54cd3 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -248,7 +248,7 @@ void spawninitdefault(int j, int i) if (sp->xrepeat == 0 || sp->yrepeat == 0) sp->xrepeat = sp->yrepeat = 1; - if (actorflag(i, SFLAG_BADGUY)) + if (actorflag(act, SFLAG_BADGUY)) { if (ud.monsters_off == 1) { @@ -259,10 +259,10 @@ void spawninitdefault(int j, int i) makeitfall(i); - if (actorflag(i, SFLAG_BADGUYSTAYPUT)) + if (actorflag(act, SFLAG_BADGUYSTAYPUT)) act->actorstayput = sp->sectnum; - if (!isRR() || actorflag(i, SFLAG_KILLCOUNT)) // Duke is just like Doom - Bad guys always count as kill. + if (!isRR() || actorflag(act, SFLAG_KILLCOUNT)) // Duke is just like Doom - Bad guys always count as kill. ps[myconnectindex].max_actors_killed++; sp->clipdist = 80; @@ -568,26 +568,27 @@ void initwaterdrip(int j, int i) // //--------------------------------------------------------------------------- -int initreactor(int j, int i, bool isrecon) +int initreactor(int j, int i_, bool isrecon) { - auto sp = &sprite[i]; + auto actor = &hittype[i_]; + auto sp = &actor->s; int sect = sp->sectnum; - auto t = hittype[i].temp_data; + auto t = actor->temp_data; if (isrecon) { if (sp->lotag > ud.player_skill) { sp->xrepeat = sp->yrepeat = 0; - changespritestat(i, STAT_MISC); + changespritestat(actor, STAT_MISC); return true; } - if (!isRR() || actorflag(i, SFLAG_KILLCOUNT)) // Duke is just like Doom - Bad guys always count as kill. + if (!isRR() || actorflag(actor, SFLAG_KILLCOUNT)) // Duke is just like Doom - Bad guys always count as kill. ps[myconnectindex].max_actors_killed++; - hittype[i].temp_data[5] = 0; + actor->temp_data[5] = 0; if (ud.monsters_off == 1) { sp->xrepeat = sp->yrepeat = 0; - changespritestat(i, STAT_MISC); + changespritestat(actor, STAT_MISC); return false; } sp->extra = 130; @@ -600,13 +601,13 @@ int initreactor(int j, int i, bool isrecon) if (ud.multimode < 2 && sp->pal != 0) { sp->xrepeat = sp->yrepeat = 0; - changespritestat(i, STAT_MISC); + changespritestat(actor, STAT_MISC); return false; } sp->pal = 0; sp->shade = -17; - changespritestat(i, 2); + changespritestat(actor, 2); return false; } diff --git a/source/games/duke/src/spawn_r.cpp b/source/games/duke/src/spawn_r.cpp index b3d250bb9..8de57064c 100644 --- a/source/games/duke/src/spawn_r.cpp +++ b/source/games/duke/src/spawn_r.cpp @@ -1042,7 +1042,7 @@ int spawn_r(int j, int pn) sp->cstat |= 257; if(sp->picnum != 5501) - if (actorfella(i)) + if (actorfella(&hittype[i])) ps[myconnectindex].max_actors_killed++; }