mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-29 07:22:33 +00:00
- same procedure for wall switches
This commit is contained in:
parent
d9122a0482
commit
0c0199fbdc
3 changed files with 51 additions and 138 deletions
|
@ -1517,13 +1517,13 @@ void togglespriteswitches(DDukeActor* act, const TexExtInfo& ext, int lotag, int
|
|||
case SwitchDef::Combo:
|
||||
if (other_ext.switchphase == 0)
|
||||
{
|
||||
if (act && act == other) other->spr.setspritetexture(other_swdef.states[1]);
|
||||
if (act == other) other->spr.setspritetexture(other_swdef.states[1]);
|
||||
else if (other->spr.hitag == 0) correctdips++;
|
||||
numdips++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (act && act == other) other->spr.setspritetexture(other_swdef.states[0]);
|
||||
if (act == other) other->spr.setspritetexture(other_swdef.states[0]);
|
||||
else if (other->spr.hitag == 1) correctdips++;
|
||||
numdips++;
|
||||
}
|
||||
|
@ -1553,4 +1553,48 @@ void togglespriteswitches(DDukeActor* act, const TexExtInfo& ext, int lotag, int
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void togglewallswitches(walltype* wwal, const TexExtInfo& ext, int lotag, int& correctdips, int& numdips)
|
||||
{
|
||||
for (auto& wal : wall)
|
||||
{
|
||||
if (lotag != wal.lotag) continue;
|
||||
|
||||
auto& other_ext = GetExtInfo(wal.walltexture());
|
||||
auto& other_swdef = switches[other_ext.switchindex];
|
||||
|
||||
switch (other_swdef.type)
|
||||
{
|
||||
case SwitchDef::Combo:
|
||||
if (other_ext.switchphase == 0)
|
||||
{
|
||||
if (&wal == wwal) wal.setwalltexture(other_swdef.states[1]);
|
||||
else if (wal.hitag == 0) correctdips++;
|
||||
numdips++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (&wal == wwal) wal.setwalltexture(other_swdef.states[0]);
|
||||
else if (wal.hitag == 1) correctdips++;
|
||||
numdips++;
|
||||
}
|
||||
break;
|
||||
|
||||
case SwitchDef::Multi:
|
||||
wal.setwalltexture(other_swdef.states[(other_ext.switchphase + 1) & 3]);
|
||||
break;
|
||||
|
||||
case SwitchDef::Access:
|
||||
case SwitchDef::Regular:
|
||||
wal.setwalltexture(other_swdef.states[1 - other_ext.switchphase]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -204,6 +204,7 @@ bool checkaccessswitch_d(int snum, int switchpal, DDukeActor* act, walltype* wwa
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
void togglespriteswitches(DDukeActor* act, const TexExtInfo& ext, int lotag, int& correctdips, int& numdips);
|
||||
void togglewallswitches(walltype* wwal, const TexExtInfo& ext, int lotag, int& correctdips, int& numdips);
|
||||
|
||||
bool checkhitswitch_d(int snum, walltype* wwal, DDukeActor *act)
|
||||
{
|
||||
|
@ -262,66 +263,7 @@ bool checkhitswitch_d(int snum, walltype* wwal, DDukeActor *act)
|
|||
}
|
||||
|
||||
togglespriteswitches(act, ext, lotag, correctdips, numdips);
|
||||
|
||||
for (auto& wal : wall)
|
||||
{
|
||||
if (lotag == wal.lotag)
|
||||
switch (wal.wallpicnum)
|
||||
{
|
||||
case DTILE_DIPSWITCH:
|
||||
case DTILE_TECHSWITCH:
|
||||
case DTILE_ALIENSWITCH:
|
||||
if (!act && &wal == wwal) wal.wallpicnum++;
|
||||
else if (wal.hitag == 0) correctdips++;
|
||||
numdips++;
|
||||
break;
|
||||
case DTILE_DIPSWITCHON:
|
||||
case DTILE_TECHSWITCHON:
|
||||
case DTILE_ALIENSWITCHON:
|
||||
if (!act && &wal == wwal) wal.wallpicnum--;
|
||||
else if (wal.hitag == 1) correctdips++;
|
||||
numdips++;
|
||||
break;
|
||||
case DTILE_MULTISWITCH:
|
||||
case DTILE_MULTISWITCH_2:
|
||||
case DTILE_MULTISWITCH_3:
|
||||
case DTILE_MULTISWITCH_4:
|
||||
wal.wallpicnum++;
|
||||
if (wal.wallpicnum > (DTILE_MULTISWITCH_4))
|
||||
wal.wallpicnum = DTILE_MULTISWITCH;
|
||||
break;
|
||||
case DTILE_ACCESSSWITCH:
|
||||
case DTILE_ACCESSSWITCH2:
|
||||
case DTILE_SLOTDOOR:
|
||||
case DTILE_LIGHTSWITCH:
|
||||
case DTILE_SPACELIGHTSWITCH:
|
||||
case DTILE_SPACEDOORSWITCH:
|
||||
case DTILE_LIGHTSWITCH2:
|
||||
case DTILE_POWERSWITCH1:
|
||||
case DTILE_LOCKSWITCH1:
|
||||
case DTILE_POWERSWITCH2:
|
||||
case DTILE_PULLSWITCH:
|
||||
case DTILE_HANDSWITCH:
|
||||
case DTILE_DIPSWITCH2:
|
||||
case DTILE_DIPSWITCH3:
|
||||
wal.wallpicnum++;
|
||||
break;
|
||||
case DTILE_HANDSWITCHON:
|
||||
case DTILE_PULLSWITCHON:
|
||||
case DTILE_LIGHTSWITCH2ON:
|
||||
case DTILE_POWERSWITCH1ON:
|
||||
case DTILE_LOCKSWITCH1ON:
|
||||
case DTILE_POWERSWITCH2ON:
|
||||
case DTILE_SLOTDOORON:
|
||||
case DTILE_LIGHTSWITCHON:
|
||||
case DTILE_SPACELIGHTSWITCHON:
|
||||
case DTILE_SPACEDOORSWITCHON:
|
||||
case DTILE_DIPSWITCH2ON:
|
||||
case DTILE_DIPSWITCH3ON:
|
||||
wal.wallpicnum--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
togglewallswitches(wwal, ext, lotag, correctdips, numdips);
|
||||
|
||||
if (lotag == -1)
|
||||
{
|
||||
|
|
|
@ -175,6 +175,7 @@ bool checkaccessswitch_r(int snum, int switchpal, DDukeActor* act, walltype* wwa
|
|||
//---------------------------------------------------------------------------
|
||||
void tag10000specialswitch(int snum, DDukeActor* act, const DVector3& v);
|
||||
void togglespriteswitches(DDukeActor* act, const TexExtInfo& ext, int lotag, int& correctdips, int& numdips);
|
||||
void togglewallswitches(walltype* wwal, const TexExtInfo& ext, int lotag, int& correctdips, int& numdips);
|
||||
|
||||
bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
|
||||
{
|
||||
|
@ -233,86 +234,12 @@ bool checkhitswitch_r(int snum, walltype* wwal, DDukeActor* act)
|
|||
}
|
||||
|
||||
togglespriteswitches(act, ext, lotag, correctdips, numdips);
|
||||
|
||||
for (auto& wal : wall)
|
||||
{
|
||||
if (lotag == wal.lotag)
|
||||
switch (wal.wallpicnum)
|
||||
{
|
||||
case RTILE_DIPSWITCH:
|
||||
case RTILE_TECHSWITCH:
|
||||
case RTILE_ALIENSWITCH:
|
||||
if (!act && &wal == wwal) wal.wallpicnum++;
|
||||
else if (wal.hitag == 0) correctdips++;
|
||||
numdips++;
|
||||
break;
|
||||
case RTILE_DIPSWITCHON:
|
||||
case RTILE_TECHSWITCHON:
|
||||
case RTILE_ALIENSWITCHON:
|
||||
if (!act && &wal == wwal) wal.wallpicnum--;
|
||||
else if (wal.hitag == 1) correctdips++;
|
||||
numdips++;
|
||||
break;
|
||||
case RTILE_MULTISWITCH:
|
||||
case RTILE_MULTISWITCH_2:
|
||||
case RTILE_MULTISWITCH_3:
|
||||
case RTILE_MULTISWITCH_4:
|
||||
wal.wallpicnum++;
|
||||
if (wal.wallpicnum > (RTILE_MULTISWITCH_4))
|
||||
wal.wallpicnum = RTILE_MULTISWITCH;
|
||||
break;
|
||||
case RTILE_MULTISWITCH2:
|
||||
case RTILE_MULTISWITCH2_2:
|
||||
case RTILE_MULTISWITCH2_3:
|
||||
case RTILE_MULTISWITCH2_4:
|
||||
if (!isRRRA()) break;
|
||||
wal.wallpicnum++;
|
||||
if (wal.wallpicnum > (RTILE_MULTISWITCH2_4))
|
||||
wal.wallpicnum = RTILE_MULTISWITCH2;
|
||||
break;
|
||||
case RTILE_BELLSWITCH:
|
||||
if (!isRRRA()) break;
|
||||
[[fallthrough]];
|
||||
case RTILE_ACCESSSWITCH:
|
||||
case RTILE_ACCESSSWITCH2:
|
||||
case RTILE_SLOTDOOR:
|
||||
case RTILE_LIGHTSWITCH:
|
||||
case RTILE_SPACELIGHTSWITCH:
|
||||
case RTILE_SPACEDOORSWITCH:
|
||||
case RTILE_LIGHTSWITCH2:
|
||||
case RTILE_POWERSWITCH1:
|
||||
case RTILE_LOCKSWITCH1:
|
||||
case RTILE_POWERSWITCH2:
|
||||
case RTILE_PULLSWITCH:
|
||||
case RTILE_HANDSWITCH:
|
||||
case RTILE_DIPSWITCH2:
|
||||
case RTILE_DIPSWITCH3:
|
||||
case RTILE_ALERTSWITCH:
|
||||
case RTILE_HANDLESWITCH:
|
||||
wal.wallpicnum++;
|
||||
break;
|
||||
case RTILE_HANDSWITCHON:
|
||||
case RTILE_PULLSWITCHON:
|
||||
case RTILE_LIGHTSWITCH2ON:
|
||||
case RTILE_POWERSWITCH1ON:
|
||||
case RTILE_LOCKSWITCH1ON:
|
||||
case RTILE_POWERSWITCH2ON:
|
||||
case RTILE_SLOTDOORON:
|
||||
case RTILE_LIGHTSWITCHON:
|
||||
case RTILE_SPACELIGHTSWITCHON:
|
||||
case RTILE_SPACEDOORSWITCHON:
|
||||
case RTILE_DIPSWITCH2ON:
|
||||
case RTILE_DIPSWITCH3ON:
|
||||
case RTILE_ALERTSWITCHON:
|
||||
case RTILE_HANDLESWITCHON:
|
||||
wal.wallpicnum--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
togglewallswitches(wwal, ext, lotag, correctdips, numdips);
|
||||
|
||||
if (lotag == -1)
|
||||
{
|
||||
setnextmap(false);
|
||||
return 1;
|
||||
}
|
||||
|
||||
DVector3 v(pos, ps[snum].GetActor()->getOffsetZ());
|
||||
|
|
Loading…
Reference in a new issue