mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-22 11:41:08 +00:00
- skip switch animation checks for custom switch actors.
This commit is contained in:
parent
95a2b85fae
commit
b980789ddf
4 changed files with 61 additions and 54 deletions
|
@ -125,7 +125,7 @@ void CallStaticSetup(DDukeActor* actor);
|
||||||
void CallPlayFTASound(DDukeActor* actor);
|
void CallPlayFTASound(DDukeActor* actor);
|
||||||
void CallStandingOn(DDukeActor* actor, player_struct* p);
|
void CallStandingOn(DDukeActor* actor, player_struct* p);
|
||||||
void CallRunState(DDukeActor* actor);
|
void CallRunState(DDukeActor* actor);
|
||||||
bool CallTriggerSwitch(DDukeActor* actor, player_struct* p);
|
int CallTriggerSwitch(DDukeActor* actor, player_struct* p);
|
||||||
|
|
||||||
extern FTextureID mirrortex, foftex;
|
extern FTextureID mirrortex, foftex;
|
||||||
|
|
||||||
|
|
|
@ -560,7 +560,7 @@ void CallStandingOn(DDukeActor* actor, player_struct* p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CallTriggerSwitch(DDukeActor* actor, player_struct* p)
|
int CallTriggerSwitch(DDukeActor* actor, player_struct* p)
|
||||||
{
|
{
|
||||||
int nval = false;
|
int nval = false;
|
||||||
IFVIRTUALPTR(actor, DDukeActor, TriggerSwitch)
|
IFVIRTUALPTR(actor, DDukeActor, TriggerSwitch)
|
||||||
|
|
|
@ -1610,6 +1610,7 @@ bool checkhitswitch(int snum, walltype* wwal, DDukeActor* act)
|
||||||
int lotag, hitag, correctdips, numdips;
|
int lotag, hitag, correctdips, numdips;
|
||||||
DVector2 spos;
|
DVector2 spos;
|
||||||
FTextureID texid;
|
FTextureID texid;
|
||||||
|
int swresult = 0;
|
||||||
|
|
||||||
if (wwal == nullptr && act == nullptr) return 0;
|
if (wwal == nullptr && act == nullptr) return 0;
|
||||||
correctdips = 1;
|
correctdips = 1;
|
||||||
|
@ -1625,7 +1626,8 @@ bool checkhitswitch(int snum, walltype* wwal, DDukeActor* act)
|
||||||
switchpal = act->spr.pal;
|
switchpal = act->spr.pal;
|
||||||
|
|
||||||
// custom switches that maintain themselves can immediately abort.
|
// custom switches that maintain themselves can immediately abort.
|
||||||
if (CallTriggerSwitch(act, &ps[snum])) return true;
|
swresult = CallTriggerSwitch(act, &ps[snum]);
|
||||||
|
if (swresult == 1) return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1639,6 +1641,8 @@ bool checkhitswitch(int snum, walltype* wwal, DDukeActor* act)
|
||||||
auto& ext = GetExtInfo(texid);
|
auto& ext = GetExtInfo(texid);
|
||||||
auto& swdef = switches[ext.switchindex];
|
auto& swdef = switches[ext.switchindex];
|
||||||
|
|
||||||
|
if (swresult == 0)
|
||||||
|
{
|
||||||
// check if the switch may be activated.
|
// check if the switch may be activated.
|
||||||
switch (swdef.type)
|
switch (swdef.type)
|
||||||
{
|
{
|
||||||
|
@ -1669,8 +1673,6 @@ bool checkhitswitch(int snum, walltype* wwal, DDukeActor* act)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DVector3 v(spos, ps[snum].GetActor()->getOffsetZ());
|
|
||||||
|
|
||||||
// Yet another crude RRRA hack that cannot be fully generalized.
|
// Yet another crude RRRA hack that cannot be fully generalized.
|
||||||
if (hitag == 10001 && swdef.flags & SwitchDef::oneway && isRRRA())
|
if (hitag == 10001 && swdef.flags & SwitchDef::oneway && isRRRA())
|
||||||
{
|
{
|
||||||
|
@ -1682,8 +1684,12 @@ bool checkhitswitch(int snum, walltype* wwal, DDukeActor* act)
|
||||||
S_PlayActorSound(328, ps[snum].GetActor());
|
S_PlayActorSound(328, ps[snum].GetActor());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
DVector3 v(spos, ps[snum].GetActor()->getOffsetZ());
|
||||||
|
|
||||||
if (swdef.type != SwitchDef::None || isadoorwall(texid))
|
if (swdef.type != SwitchDef::None || isadoorwall(texid))
|
||||||
|
{
|
||||||
|
if (swresult == 0)
|
||||||
{
|
{
|
||||||
if (swdef.type == SwitchDef::Combo)
|
if (swdef.type == SwitchDef::Combo)
|
||||||
{
|
{
|
||||||
|
@ -1702,6 +1708,7 @@ bool checkhitswitch(int snum, walltype* wwal, DDukeActor* act)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DukeStatIterator itr(STAT_EFFECTOR);
|
DukeStatIterator itr(STAT_EFFECTOR);
|
||||||
while (auto other = itr.Next())
|
while (auto other = itr.Next())
|
||||||
|
|
|
@ -86,7 +86,7 @@ class RedneckBellSwitch : DukeActor
|
||||||
self.detail = 132;
|
self.detail = 132;
|
||||||
self.setSpriteSetImage(1);
|
self.setSpriteSetImage(1);
|
||||||
self.changeStat(STAT_MISC); // needs to be made to call Tick
|
self.changeStat(STAT_MISC); // needs to be made to call Tick
|
||||||
return false; // still needs to act as a switch.
|
return 2; // 2 lets the switch code perform the trigger action without messing around with this actor.
|
||||||
}
|
}
|
||||||
|
|
||||||
override void Tick()
|
override void Tick()
|
||||||
|
|
Loading…
Reference in a new issue