diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 5edb5b758..fd50d692e 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -211,7 +211,7 @@ void clearcamera(player_struct* ps) DukeStatIterator it(STAT_ACTOR); while (auto k = it.Next()) { - if (k->spr.picnum == TILE_CAMERA1) + if (actorflag(k, SFLAG2_CAMERA)) k->spr.yvel = 0; } } diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index a6327538f..2f0f28a62 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -2203,7 +2203,7 @@ static void greenslime(DDukeActor *actor) DukeStatIterator it(STAT_ACTOR); while (auto ac = it.Next()) { - if (ac->spr.picnum == CAMERA1) ac->spr.yvel = 0; + if (actorflag(ac, SFLAG2_CAMERA)) ac->spr.yvel = 0; } } diff --git a/source/games/duke/src/constants.h b/source/games/duke/src/constants.h index be1b2d1e6..5f5148130 100644 --- a/source/games/duke/src/constants.h +++ b/source/games/duke/src/constants.h @@ -341,6 +341,7 @@ enum sflags2_t SFLAG2_BRIGHTEXPLODE = 0x00000020, SFLAG2_DOUBLEDMGTHRUST = 0x00000040, SFLAG2_BREAKMIRRORS = 0x00000080, + SFLAG2_CAMERA = 0x00000100, }; using EDukeFlags2 = TFlags; diff --git a/source/games/duke/src/dispatch.cpp b/source/games/duke/src/dispatch.cpp index 73018cc61..e6e563a6a 100644 --- a/source/games/duke/src/dispatch.cpp +++ b/source/games/duke/src/dispatch.cpp @@ -198,7 +198,6 @@ int TILE_TREE2; int TILE_TIRE; int TILE_CONE; int TILE_W_FORCEFIELD; -int TILE_CAMERA1; int TILE_SCRAP6; int TILE_APLAYER; int TILE_DRONE; diff --git a/source/games/duke/src/flags_d.cpp b/source/games/duke/src/flags_d.cpp index b388949b6..769041f6e 100644 --- a/source/games/duke/src/flags_d.cpp +++ b/source/games/duke/src/flags_d.cpp @@ -218,6 +218,7 @@ void initactorflags_d() setflag(SFLAG2_BRIGHTEXPLODE, { SEENINE, OOZFILTER }); setflag(SFLAG2_DOUBLEDMGTHRUST, { RADIUSEXPLOSION, RPG, HYDRENT, HEAVYHBOMB, SEENINE, OOZFILTER, EXPLODINGBARREL }); setflag(SFLAG2_BREAKMIRRORS, { RADIUSEXPLOSION, RPG, HYDRENT, HEAVYHBOMB, SEENINE, OOZFILTER, EXPLODINGBARREL }); + setflag(SFLAG2_CAMERA, { CAMERA1 }); if (isWorldTour()) { @@ -311,7 +312,6 @@ void initactorflags_d() TILE_TIRE = TIRE; TILE_CONE = CONE; TILE_W_FORCEFIELD = W_FORCEFIELD; - TILE_CAMERA1 = CAMERA1; TILE_SCRAP6 = SCRAP6; TILE_APLAYER = APLAYER; TILE_DRONE = DRONE; diff --git a/source/games/duke/src/flags_r.cpp b/source/games/duke/src/flags_r.cpp index 51efc94bc..4c1157dad 100644 --- a/source/games/duke/src/flags_r.cpp +++ b/source/games/duke/src/flags_r.cpp @@ -247,6 +247,7 @@ void initactorflags_r() if (isRRRA()) setflag(SFLAG2_DOUBLEDMGTHRUST, { RPG2 }); setflag(SFLAG2_BREAKMIRRORS, { RADIUSEXPLOSION, RPG, HYDRENT, HEAVYHBOMB, SEENINE, OOZFILTER, EXPLODINGBARREL, POWDERKEG }); if (isRRRA()) setflag(SFLAG2_BREAKMIRRORS, { RPG2 }); + setflag(SFLAG2_CAMERA, { CAMERA1 }); // Animals were not supposed to have this, but due to a coding bug the logic was unconditional for everything in the game. for (auto& ainf : gs.actorinfo) @@ -283,7 +284,6 @@ void initactorflags_r() TILE_TIRE = TIRE; TILE_CONE = CONE; TILE_W_FORCEFIELD = W_FORCEFIELD; - TILE_CAMERA1 = CAMERA1; TILE_SCRAP6 = SCRAP6; TILE_APLAYER = APLAYER; TILE_DRONE = DRONE; diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index db8740c10..2e78aff81 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -29,6 +29,7 @@ void movefx(); void moveclouds(double smoothratio); void movefta(); +void clearcameras(int i, player_struct* p); void RANDOMSCRAP(DDukeActor* i); void ms(DDukeActor* i); void movecrane(DDukeActor* i, int crane); diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index f8cd3374b..65d3e2b08 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -2075,7 +2075,7 @@ int ParseState::parse(void) DukeStatIterator it(STAT_ACTOR); while (auto actj = it.Next()) { - if (actj->spr.picnum == TILE_CAMERA1) + if (actorflag(actj, SFLAG2_CAMERA)) actj->spr.yvel = 0; } } diff --git a/source/games/duke/src/names.h b/source/games/duke/src/names.h index 0db7227e4..3832f3408 100644 --- a/source/games/duke/src/names.h +++ b/source/games/duke/src/names.h @@ -9,7 +9,6 @@ extern int TILE_TREE2; extern int TILE_TIRE; extern int TILE_CONE; extern int TILE_W_FORCEFIELD; -extern int TILE_CAMERA1; extern int TILE_SCRAP6; extern int TILE_APLAYER; extern int TILE_DRONE; diff --git a/source/games/duke/src/premap_d.cpp b/source/games/duke/src/premap_d.cpp index 17eed9601..981e01bc4 100644 --- a/source/games/duke/src/premap_d.cpp +++ b/source/games/duke/src/premap_d.cpp @@ -187,8 +187,6 @@ static void cachegoodsprites(void) tloadtile(i); } - tloadtile(VIEWSCREEN); - for(i=FOOTPRINTS;ispr.picnum == CAMERA1) itActor->spr.yvel = 0; + if (actorflag(itActor, SFLAG2_CAMERA)) itActor->spr.yvel = 0; } } @@ -1489,7 +1489,7 @@ void clearcameras(int i, player_struct* p) DukeStatIterator it(STAT_ACTOR); while (auto act = it.Next()) { - if (act->spr.picnum == CAMERA1) act->spr.yvel = 0; + if (actorflag(act, SFLAG2_CAMERA)) act->spr.yvel = 0; } } else if (p->newOwner != nullptr) @@ -1719,7 +1719,7 @@ void checksectors_d(int snum) DukeStatIterator it(STAT_ACTOR); while (auto acti = it.Next()) { - if (acti->spr.picnum == CAMERA1 && acti->spr.yvel == 0 && neartagsprite->spr.hitag == acti->spr.lotag) + if (actorflag(acti, SFLAG2_CAMERA) && acti->spr.yvel == 0 && neartagsprite->spr.hitag == acti->spr.lotag) { acti->spr.yvel = 1; //Using this camera if (snum == screenpeek) S_PlaySound(MONITOR_ACTIVE); diff --git a/source/games/duke/src/sectors_r.cpp b/source/games/duke/src/sectors_r.cpp index 66de03619..f194ddd0a 100644 --- a/source/games/duke/src/sectors_r.cpp +++ b/source/games/duke/src/sectors_r.cpp @@ -2382,7 +2382,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj) DukeStatIterator it(STAT_EFFECTOR); while (auto act = it.Next()) { - if (act->spr.picnum == CAMERA1) act->spr.yvel = 0; + if (actorflag(act, SFLAG2_CAMERA)) act->spr.yvel = 0; } } auto Owner = targ->GetHitOwner();