diff --git a/source/games/duke/src/actors_lava.cpp b/source/games/duke/src/actors_lava.cpp index b8a67c009..dc228c485 100644 --- a/source/games/duke/src/actors_lava.cpp +++ b/source/games/duke/src/actors_lava.cpp @@ -539,14 +539,14 @@ void operatejaildoors(int hitag) jaildooropen[i] = 1; jaildoordrag[i] = jaildoordist[i]; if (!isRRRA() || jaildoorsound[i] != 0) - S_PlayActorSound(jaildoorsound[i], ps[screenpeek].i); + S_PlayActorSound(jaildoorsound[i], ps[screenpeek].GetActor()); } if (jaildooropen[i] == 2) { jaildooropen[i] = 3; jaildoordrag[i] = jaildoordist[i]; if (!isRRRA() || jaildoorsound[i] != 0) - S_PlayActorSound(jaildoorsound[i], ps[screenpeek].i); + S_PlayActorSound(jaildoorsound[i], ps[screenpeek].GetActor()); } } } diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 6ce4b69b6..a405afe74 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -197,13 +197,13 @@ void addweapon_r(struct player_struct* p, int weapon) case THROWINGDYNAMITE_WEAPON: break; case SHOTGUN_WEAPON: - S_PlayActorSound(SHOTGUN_COCK, p->i); + S_PlayActorSound(SHOTGUN_COCK, p->GetActor()); break; case PISTOL_WEAPON: - S_PlayActorSound(INSERT_CLIP, p->i); + S_PlayActorSound(INSERT_CLIP, p->GetActor()); break; default: - S_PlayActorSound(EJECT_CLIP, p->i); + S_PlayActorSound(EJECT_CLIP, p->GetActor()); break; } } diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 387930690..b9c833fa5 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -1956,7 +1956,7 @@ int ParseState::parse(void) { if ((j - *insptr) < (max_player_health >> 2) && j >= (max_player_health >> 2)) - S_PlayActorSound(DUKE_GOTHEALTHATLOW, ps[g_p].i); + S_PlayActorSound(DUKE_GOTHEALTHATLOW, ps[g_p].GetActor()); ps[g_p].last_extra = j; } @@ -2032,7 +2032,7 @@ int ParseState::parse(void) { if ((j - *insptr) < (max_player_health >> 2) && j >= (max_player_health >> 2)) - S_PlayActorSound(229, ps[g_p].i); + S_PlayActorSound(229, ps[g_p].GetActor()); ps[g_p].last_extra = j; } @@ -2097,7 +2097,7 @@ int ParseState::parse(void) { if( ( j - *insptr ) < (max_player_health>>2) && j >= (max_player_health>>2) ) - S_PlayActorSound(isRR()? 229 : DUKE_GOTHEALTHATLOW,ps[g_p].i); + S_PlayActorSound(isRR()? 229 : DUKE_GOTHEALTHATLOW,ps[g_p].GetActor()); ps[g_p].last_extra = j; } @@ -2230,7 +2230,7 @@ int ParseState::parse(void) g_sp->y = g_ac->bposy = ps[g_p].bobposy = ps[g_p].oposy = ps[g_p].posy; g_sp->z = g_ac->bposy = ps[g_p].oposz = ps[g_p].posz; updatesector(ps[g_p].posx, ps[g_p].posy, &ps[g_p].cursectnum); - setsprite(ps[g_p].i, ps[g_p].posx, ps[g_p].posy, ps[g_p].posz + PHEIGHT); + setsprite(ps[g_p].GetActor(), ps[g_p].posx, ps[g_p].posy, ps[g_p].posz + PHEIGHT); g_sp->cstat = 257; g_sp->shade = -12; diff --git a/source/games/duke/src/inlines.h b/source/games/duke/src/inlines.h index 13a387349..961866535 100644 --- a/source/games/duke/src/inlines.h +++ b/source/games/duke/src/inlines.h @@ -77,7 +77,7 @@ inline int checkcursectnums(int se) { int i; for(i=connecthead;i>=0;i=connectpoint2[i]) - if((unsigned)ps[i].i < MAXSPRITES && 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/premap.cpp b/source/games/duke/src/premap.cpp index 3d376e94c..4ffb76284 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -950,7 +950,7 @@ void enterlevel(MapRecord *mi, int gamemode) for (int i = connecthead; i >= 0; i = connectpoint2[i]) { - int pn = sector[sprite[ps[i].i].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/render.cpp b/source/games/duke/src/render.cpp index a3e2c8fe4..8e76837b8 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -279,11 +279,12 @@ void animatecamsprite(double smoothratio) int spriteNum = camsprite; auto p = &ps[screenpeek]; - auto sp = &sprite[spriteNum]; + auto act = &hittype[spriteNum]; + auto sp = &act->s; if (p->newowner >= 0) sp->owner = p->newowner; - if (sp->owner >= 0 && dist(&sprite[p->i], sp) < VIEWSCREEN_ACTIVE_DISTANCE) + if (sp->owner >= 0 && dist(p->GetActor(), act) < VIEWSCREEN_ACTIVE_DISTANCE) { auto tex = tileGetTexture(sp->picnum); TileFiles.MakeCanvas(TILE_VIEWSCR, tex->GetDisplayWidth(), tex->GetDisplayHeight()); @@ -621,8 +622,8 @@ void displayrooms(int snum, double smoothratio) // do screen rotation. renderSetRollAngle(rotscrnang.asbam() / (double)(BAMUNIT)); - cz = hittype[p->i].ceilingz; - fz = hittype[p->i].floorz; + cz = p->GetActor()->ceilingz; + fz = p->GetActor()->floorz; if (earthquaketime > 0 && p->on_ground == 1) { diff --git a/source/games/duke/src/sounds.cpp b/source/games/duke/src/sounds.cpp index 5e86fbc25..4dfc9e278 100644 --- a/source/games/duke/src/sounds.cpp +++ b/source/games/duke/src/sounds.cpp @@ -444,7 +444,6 @@ int S_PlaySound3D(int sndnum, int spriteNum, const vec3_t* pos, int channel, ECh if (ud.multimode == 1) { spriteNum = pl->i; - auto sp = &sprite[spriteNum]; } }