mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- checkhitswitch_r
This commit is contained in:
parent
6d4365f3a2
commit
8c4cb75d8c
1 changed files with 24 additions and 24 deletions
|
@ -347,8 +347,9 @@ void operateforcefields_r(DDukeActor* act, int low)
|
||||||
bool checkhitswitch_r(int snum, int ww, DDukeActor* act)
|
bool checkhitswitch_r(int snum, int ww, DDukeActor* act)
|
||||||
{
|
{
|
||||||
uint8_t switchpal;
|
uint8_t switchpal;
|
||||||
int i, x, lotag, hitag, picnum, correctdips, numdips;
|
int lotag, hitag, picnum, correctdips, numdips;
|
||||||
int sx, sy;
|
int sx, sy;
|
||||||
|
walltype* wwal = nullptr;
|
||||||
|
|
||||||
if (ww < 0 && act == nullptr) return 0;
|
if (ww < 0 && act == nullptr) return 0;
|
||||||
correctdips = 1;
|
correctdips = 1;
|
||||||
|
@ -366,14 +367,14 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto wal = &wall[ww];
|
wwal = &wall[ww];
|
||||||
lotag = wal->lotag;
|
lotag = wwal->lotag;
|
||||||
if (lotag == 0) return 0;
|
if (lotag == 0) return 0;
|
||||||
hitag = wal->hitag;
|
hitag = wwal->hitag;
|
||||||
sx = wal->x;
|
sx = wwal->x;
|
||||||
sy = wal->y;
|
sy = wwal->y;
|
||||||
picnum = wal->picnum;
|
picnum = wwal->picnum;
|
||||||
switchpal = wal->pal;
|
switchpal = wwal->pal;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (picnum)
|
switch (picnum)
|
||||||
|
@ -602,42 +603,41 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < numwalls; i++)
|
for (auto& wal : walls())
|
||||||
{
|
{
|
||||||
x = i;
|
if (lotag == wal.lotag)
|
||||||
if (lotag == wall[x].lotag)
|
switch (wal.picnum)
|
||||||
switch (wall[x].picnum)
|
|
||||||
{
|
{
|
||||||
case DIPSWITCH:
|
case DIPSWITCH:
|
||||||
case TECHSWITCH:
|
case TECHSWITCH:
|
||||||
case ALIENSWITCH:
|
case ALIENSWITCH:
|
||||||
if (!act && i == ww) wall[x].picnum++;
|
if (!act && &wal == wwal) wal.picnum++;
|
||||||
else if (wall[x].hitag == 0) correctdips++;
|
else if (wal.hitag == 0) correctdips++;
|
||||||
numdips++;
|
numdips++;
|
||||||
break;
|
break;
|
||||||
case DIPSWITCH + 1:
|
case DIPSWITCH + 1:
|
||||||
case TECHSWITCH + 1:
|
case TECHSWITCH + 1:
|
||||||
case ALIENSWITCH + 1:
|
case ALIENSWITCH + 1:
|
||||||
if (!act && i == ww) wall[x].picnum--;
|
if (!act && &wal == wwal) wal.picnum--;
|
||||||
else if (wall[x].hitag == 1) correctdips++;
|
else if (wal.hitag == 1) correctdips++;
|
||||||
numdips++;
|
numdips++;
|
||||||
break;
|
break;
|
||||||
case MULTISWITCH:
|
case MULTISWITCH:
|
||||||
case MULTISWITCH + 1:
|
case MULTISWITCH + 1:
|
||||||
case MULTISWITCH + 2:
|
case MULTISWITCH + 2:
|
||||||
case MULTISWITCH + 3:
|
case MULTISWITCH + 3:
|
||||||
wall[x].picnum++;
|
wal.picnum++;
|
||||||
if (wall[x].picnum > (MULTISWITCH + 3))
|
if (wal.picnum > (MULTISWITCH + 3))
|
||||||
wall[x].picnum = MULTISWITCH;
|
wal.picnum = MULTISWITCH;
|
||||||
break;
|
break;
|
||||||
case MULTISWITCH2:
|
case MULTISWITCH2:
|
||||||
case MULTISWITCH2 + 1:
|
case MULTISWITCH2 + 1:
|
||||||
case MULTISWITCH2 + 2:
|
case MULTISWITCH2 + 2:
|
||||||
case MULTISWITCH2 + 3:
|
case MULTISWITCH2 + 3:
|
||||||
if (!isRRRA()) break;
|
if (!isRRRA()) break;
|
||||||
wall[x].picnum++;
|
wal.picnum++;
|
||||||
if (wall[x].picnum > (MULTISWITCH2 + 3))
|
if (wal.picnum > (MULTISWITCH2 + 3))
|
||||||
wall[x].picnum = MULTISWITCH2;
|
wal.picnum = MULTISWITCH2;
|
||||||
break;
|
break;
|
||||||
case RRTILE8660:
|
case RRTILE8660:
|
||||||
if (!isRRRA()) break;
|
if (!isRRRA()) break;
|
||||||
|
@ -658,7 +658,7 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act)
|
||||||
case DIPSWITCH3:
|
case DIPSWITCH3:
|
||||||
case RRTILE2697:
|
case RRTILE2697:
|
||||||
case RRTILE2707:
|
case RRTILE2707:
|
||||||
wall[x].picnum++;
|
wal.picnum++;
|
||||||
break;
|
break;
|
||||||
case HANDSWITCH + 1:
|
case HANDSWITCH + 1:
|
||||||
case PULLSWITCH + 1:
|
case PULLSWITCH + 1:
|
||||||
|
@ -674,7 +674,7 @@ bool checkhitswitch_r(int snum, int ww, DDukeActor* act)
|
||||||
case DIPSWITCH3 + 1:
|
case DIPSWITCH3 + 1:
|
||||||
case RRTILE2697 + 1:
|
case RRTILE2697 + 1:
|
||||||
case RRTILE2707 + 1:
|
case RRTILE2707 + 1:
|
||||||
wall[x].picnum--;
|
wal.picnum--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue