- replaced checktimetosleep with a flag.

This commit is contained in:
Christoph Oelckers 2022-01-18 23:26:06 +01:00
parent 72510a47fa
commit fc94fb9651
9 changed files with 6 additions and 61 deletions

View file

@ -5340,5 +5340,4 @@ void movefta(void)
}
END_DUKE_NS

View file

@ -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;
}
}
}
//---------------------------------------------------------------------------
//
//

View file

@ -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;
}
}
}
//---------------------------------------------------------------------------
//
//

View file

@ -321,6 +321,7 @@ enum sflags_t
SFLAG_NOFLOORFIRE = 0x01000000,
SFLAG_HITRADIUS_FLAG1 = 0x02000000,
SFLAG_HITRADIUS_FLAG2 = 0x04000000,
SFLAG_CHECKSLEEP = 0x08000000,
};

View file

@ -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,

View file

@ -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

View file

@ -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())
{

View file

@ -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)

View file

@ -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);