diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 4d82c1de9..e87dae5e8 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -5340,5 +5340,4 @@ void movefta(void) } - END_DUKE_NS diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 1237cf1bf..7ec004dc1 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -3768,32 +3768,6 @@ void respawnhitag_d(DDukeActor* actor) } } -void checktimetosleep_d(DDukeActor *actor) -{ - if (actor->spr.statnum == STAT_STANDABLE) - { - switch (actor->spr.picnum) - { - case RUBBERCAN: - case EXPLODINGBARREL: - case WOODENHORSE: - case HORSEONSIDE: - case CANWITHSOMETHING: - case FIREBARREL: - case NUKEBARREL: - case NUKEBARRELDENTED: - case NUKEBARRELLEAKED: - case TRIPBOMB: - case EGG: - if (actor->timetosleep > 1) - actor->timetosleep--; - else if (actor->timetosleep == 1) - ChangeActorStat(actor, STAT_ZOMBIEACTOR); - break; - } - } -} - //--------------------------------------------------------------------------- // // diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 975899497..5c8b6d092 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -4046,32 +4046,6 @@ void respawnhitag_r(DDukeActor *actor) } } -void checktimetosleep_r(DDukeActor *actor) -{ - if (actor->spr.statnum == STAT_STANDABLE) - { - switch (actor->spr.picnum) - { - case RUBBERCAN: - case EXPLODINGBARREL: - case WOODENHORSE: - case HORSEONSIDE: - case CANWITHSOMETHING: - case FIREBARREL: - case NUKEBARREL: - case NUKEBARRELDENTED: - case NUKEBARRELLEAKED: - case TRIPBOMB: - case EGG: - if (actor->timetosleep > 1) - actor->timetosleep--; - else if (actor->timetosleep == 1) - ChangeActorStat(actor, STAT_ZOMBIEACTOR); - break; - } - } -} - //--------------------------------------------------------------------------- // // diff --git a/source/games/duke/src/constants.h b/source/games/duke/src/constants.h index acb54a9d9..81ef79406 100644 --- a/source/games/duke/src/constants.h +++ b/source/games/duke/src/constants.h @@ -321,6 +321,7 @@ enum sflags_t SFLAG_NOFLOORFIRE = 0x01000000, SFLAG_HITRADIUS_FLAG1 = 0x02000000, SFLAG_HITRADIUS_FLAG2 = 0x04000000, + SFLAG_CHECKSLEEP = 0x08000000, }; diff --git a/source/games/duke/src/dispatch.cpp b/source/games/duke/src/dispatch.cpp index 1b1e884df..34a9892fc 100644 --- a/source/games/duke/src/dispatch.cpp +++ b/source/games/duke/src/dispatch.cpp @@ -78,8 +78,6 @@ bool spawnweapondebris_d(int picnum, int dnum); bool spawnweapondebris_r(int picnum, int dnum); void respawnhitag_d(DDukeActor* g_sp); void respawnhitag_r(DDukeActor* g_sp); -void checktimetosleep_d(DDukeActor* actor); -void checktimetosleep_r(DDukeActor* actor); void move_d(DDukeActor* i, int g_p, int g_x); void move_r(DDukeActor* i, int g_p, int g_x); void incur_damage_d(struct player_struct* p); @@ -136,7 +134,6 @@ void SetDispatcher() fall_d, spawnweapondebris_d, respawnhitag_d, - checktimetosleep_d, move_d, incur_damage_d, @@ -179,7 +176,6 @@ void SetDispatcher() fall_r, spawnweapondebris_r, respawnhitag_r, - checktimetosleep_r, move_r, incur_damage_r, diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index 58cfa3588..5e25d586b 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -99,7 +99,6 @@ struct Dispatcher void (*fall)(DDukeActor* actor, int g_p); bool (*spawnweapondebris)(int picnum, int dnum); void (*respawnhitag)(DDukeActor* g_sp); - void (*checktimetosleep)(DDukeActor* actor); void (*move)(DDukeActor* i, int g_p, int g_x); // player diff --git a/source/games/duke/src/flags_d.cpp b/source/games/duke/src/flags_d.cpp index 636f1e3d9..8663db49e 100644 --- a/source/games/duke/src/flags_d.cpp +++ b/source/games/duke/src/flags_d.cpp @@ -206,6 +206,7 @@ void initactorflags_d() setflag(SFLAG_NOFLOORFIRE, { TREE1, TREE2 }); setflag(SFLAG_HITRADIUS_FLAG1, { BOX, TREE1, TREE2, TIRE, CONE }); setflag(SFLAG_HITRADIUS_FLAG2, { TRIPBOMB, QUEBALL, STRIPEBALL, DUKELYINGDEAD }); + setflag(SFLAG_CHECKSLEEP, { RUBBERCAN, EXPLODINGBARREL, WOODENHORSE, HORSEONSIDE, CANWITHSOMETHING, FIREBARREL, NUKEBARREL, NUKEBARRELDENTED, NUKEBARRELLEAKED, TRIPBOMB }); if (isWorldTour()) { diff --git a/source/games/duke/src/flags_r.cpp b/source/games/duke/src/flags_r.cpp index 11026d394..095125d7f 100644 --- a/source/games/duke/src/flags_r.cpp +++ b/source/games/duke/src/flags_r.cpp @@ -236,6 +236,7 @@ void initactorflags_r() setflag(SFLAG_NOFLOORFIRE, { TREE1, TREE2 }); setflag(SFLAG_HITRADIUS_FLAG1, { BOX, TREE1, TREE2, TIRE }); setflag(SFLAG_HITRADIUS_FLAG2, { QUEBALL, STRIPEBALL, BOWLINGPIN, DUKELYINGDEAD }); + setflag(SFLAG_CHECKSLEEP, { RUBBERCAN, EXPLODINGBARREL, WOODENHORSE, HORSEONSIDE, CANWITHSOMETHING, FIREBARREL, NUKEBARREL, NUKEBARRELDENTED, NUKEBARRELLEAKED, TRIPBOMB, EGG }); // 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) diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index ea8fff5de..3a891a7c4 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -3835,15 +3835,15 @@ void execute(DDukeActor *actor,int p,int x) if (ud.respawn_monsters == 1 && actor->spr.extra <= 0) goto quit; } else if (ud.respawn_items == 1 && (actor->spr.cstat & CSTAT_SPRITE_INVISIBLE)) goto quit; + } + if (actor->spr.statnum == STAT_ACTOR || (actor->spr.statnum == STAT_STANDABLE && actorflag(actor, SFLAG_CHECKSLEEP))) + { if (actor->timetosleep > 1) actor->timetosleep--; else if (actor->timetosleep == 1) ChangeActorStat(actor, STAT_ZOMBIEACTOR); } - - else if (actor->spr.statnum == STAT_STANDABLE) - fi.checktimetosleep(actor); } quit: if (killthesprite) deletesprite(actor);