mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-25 13:31:55 +00:00
- split RRRA's tag10000specialswitch into a subfunction.
Unfortunately I have no idea where this gets used so it's untested for now.
This commit is contained in:
parent
97a5fc2948
commit
4191a9493a
2 changed files with 45 additions and 44 deletions
|
@ -1452,5 +1452,46 @@ void resetswitch(int tag)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void tag10000specialswitch(int snum, DDukeActor* act, const DVector3& v)
|
||||
{
|
||||
DDukeActor* switches[3];
|
||||
int switchcount = 0, j;
|
||||
S_PlaySound3D(SWITCH_ON, act, v);
|
||||
DukeSpriteIterator itr;
|
||||
while (auto actt = itr.Next())
|
||||
{
|
||||
int jht = actt->spr.hitag;
|
||||
auto ext = GetExtInfo(actt->spr.spritetexture());
|
||||
if (jht == 10000 && ext.switchphase == 0 && ::switches[ext.switchindex].type == SwitchDef::Multi)
|
||||
{
|
||||
if (switchcount < 3)
|
||||
{
|
||||
switches[switchcount] = actt;
|
||||
switchcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (switchcount == 3)
|
||||
{
|
||||
// This once was a linear search over sprites[] so bring things back in order, just to be safe.
|
||||
if (switches[0]->GetIndex() > switches[1]->GetIndex()) std::swap(switches[0], switches[1]);
|
||||
if (switches[0]->GetIndex() > switches[2]->GetIndex()) std::swap(switches[0], switches[2]);
|
||||
if (switches[1]->GetIndex() > switches[2]->GetIndex()) std::swap(switches[1], switches[2]);
|
||||
|
||||
S_PlaySound3D(78, act, v);
|
||||
for (j = 0; j < switchcount; j++)
|
||||
{
|
||||
switches[j]->spr.hitag = 0;
|
||||
switches[j]->spr.setspritetexture(::switches[GetExtInfo(switches[j]->spr.spritetexture()).switchindex].states[3]);
|
||||
fi.checkhitswitch(snum, nullptr, switches[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -173,7 +173,7 @@ bool checkaccessswitch_r(int snum, int switchpal, DDukeActor* act, walltype* wwa
|
|||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void tag10000specialswitch(int snum, DDukeActor* act, const DVector3& v);
|
||||
bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
|
||||
{
|
||||
uint8_t switchpal;
|
||||
|
@ -498,50 +498,10 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
else if (hitag == 10000)
|
||||
else if (hitag == 10000 && swdef.type == SwitchDef::Multi)
|
||||
{
|
||||
if (picnum == RTILE_MULTISWITCH || picnum == (RTILE_MULTISWITCH_2) ||
|
||||
picnum == (RTILE_MULTISWITCH_3) || picnum == (RTILE_MULTISWITCH_4) ||
|
||||
picnum == RTILE_MULTISWITCH2 || picnum == (RTILE_MULTISWITCH2_2) ||
|
||||
picnum == (RTILE_MULTISWITCH2_3) || picnum == (RTILE_MULTISWITCH2_4))
|
||||
{
|
||||
DDukeActor* switches[3];
|
||||
int switchcount = 0, j;
|
||||
S_PlaySound3D(SWITCH_ON, act, v);
|
||||
DukeSpriteIterator itr;
|
||||
while (auto actt = itr.Next())
|
||||
{
|
||||
int jpn = actt->spr.picnum;
|
||||
int jht = actt->spr.hitag;
|
||||
if ((jpn == RTILE_MULTISWITCH || jpn == RTILE_MULTISWITCH2) && jht == 10000)
|
||||
{
|
||||
if (switchcount < 3)
|
||||
{
|
||||
switches[switchcount] = actt;
|
||||
switchcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (switchcount == 3)
|
||||
{
|
||||
// This once was a linear search over sprites[] so bring things back in order, just to be safe.
|
||||
if (switches[0]->GetIndex() > switches[1]->GetIndex()) std::swap(switches[0], switches[1]);
|
||||
if (switches[0]->GetIndex() > switches[2]->GetIndex()) std::swap(switches[0], switches[2]);
|
||||
if (switches[1]->GetIndex() > switches[2]->GetIndex()) std::swap(switches[1], switches[2]);
|
||||
|
||||
S_PlaySound3D(78, act, v);
|
||||
for (j = 0; j < switchcount; j++)
|
||||
{
|
||||
switches[j]->spr.hitag = 0;
|
||||
if (picnum >= RTILE_MULTISWITCH2)
|
||||
switches[j]->spr.picnum = RTILE_MULTISWITCH2_4;
|
||||
else
|
||||
switches[j]->spr.picnum = RTILE_MULTISWITCH_4;
|
||||
checkhitswitch_r(snum, nullptr, switches[j]);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
tag10000specialswitch(snum, act, v);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (picnum == RTILE_MULTISWITCH || picnum == (RTILE_MULTISWITCH_2) ||
|
||||
|
|
Loading…
Reference in a new issue