- did a clean reimplementation of resetswitch.

This commit is contained in:
Christoph Oelckers 2022-12-11 11:52:36 +01:00
parent 9bc0a43028
commit 97a5fc2948
2 changed files with 21 additions and 18 deletions

View file

@ -1010,24 +1010,6 @@ static void rrra_specialstats()
tickstat(STAT_RABBITSPAWN);
}
//---------------------------------------------------------------------------
//
// this one's a hack. Can only be replaced with something better when
// the switch code has been redone.
//
//---------------------------------------------------------------------------
void resetswitch(int tag)
{
DukeStatIterator it2(STAT_DEFAULT);
while (auto act2 = it2.Next())
{
if (act2->spr.picnum == RTILE_DIPSWITCH3ON)
if (act2->spr.hitag == tag)
act2->spr.picnum = RTILE_DIPSWITCH3;
}
}
//---------------------------------------------------------------------------
//
//

View file

@ -1429,7 +1429,28 @@ void moveclouds(double interpfrac)
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void resetswitch(int tag)
{
DukeStatIterator it2(STAT_DEFAULT);
while (auto act2 = it2.Next())
{
auto& ext = GetExtInfo(act2->spr.spritetexture());
if (ext.switchindex > 0 && ext.switchphase == 1 && act2->spr.hitag == tag)
{
auto& swdef = switches[ext.switchindex];
if (swdef.type == SwitchDef::Regular && swdef.flags & SwitchDef::resettable)
{
act2->spr.setspritetexture(swdef.states[0]);
}
}
}
}
END_DUKE_NS