mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-26 00:40:56 +00:00
player.c: factor out inline checks for shootable switch picnums.
git-svn-id: https://svn.eduke32.com/eduke32@2980 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
08a19e19f3
commit
e4bb83cd39
1 changed files with 12 additions and 36 deletions
|
@ -321,6 +321,14 @@ static void A_SetHitData(int32_t i, const hitdata_t *hit)
|
||||||
actor[i].t_data[8] = hit->sprite;
|
actor[i].t_data[8] = hit->sprite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t CheckShootSwitchTile(int32_t pn)
|
||||||
|
{
|
||||||
|
return pn == DIPSWITCH || pn == DIPSWITCH+1 ||
|
||||||
|
pn == DIPSWITCH2 || pn == DIPSWITCH2+1 ||
|
||||||
|
pn == DIPSWITCH3 || pn == DIPSWITCH3+1 ||
|
||||||
|
pn == HANDSWITCH || pn == HANDSWITCH+1;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t A_Shoot(int32_t i,int32_t atwith)
|
int32_t A_Shoot(int32_t i,int32_t atwith)
|
||||||
{
|
{
|
||||||
int16_t l, sa, j, k=-1;
|
int16_t l, sa, j, k=-1;
|
||||||
|
@ -786,15 +794,7 @@ int32_t A_Shoot(int32_t i,int32_t atwith)
|
||||||
A_SetHitData(wh, &hit);
|
A_SetHitData(wh, &hit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (p >= 0 && (
|
if (p >= 0 && CheckShootSwitchTile(sprite[hit.sprite].picnum))
|
||||||
sprite[hit.sprite].picnum == DIPSWITCH ||
|
|
||||||
sprite[hit.sprite].picnum == DIPSWITCH+1 ||
|
|
||||||
sprite[hit.sprite].picnum == DIPSWITCH2 ||
|
|
||||||
sprite[hit.sprite].picnum == DIPSWITCH2+1 ||
|
|
||||||
sprite[hit.sprite].picnum == DIPSWITCH3 ||
|
|
||||||
sprite[hit.sprite].picnum == DIPSWITCH3+1 ||
|
|
||||||
sprite[hit.sprite].picnum == HANDSWITCH ||
|
|
||||||
sprite[hit.sprite].picnum == HANDSWITCH+1))
|
|
||||||
{
|
{
|
||||||
P_ActivateSwitch(p,hit.sprite,1);
|
P_ActivateSwitch(p,hit.sprite,1);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -811,15 +811,7 @@ int32_t A_Shoot(int32_t i,int32_t atwith)
|
||||||
}
|
}
|
||||||
if (CheckDoorTile(wall[hit.wall].picnum) == 1)
|
if (CheckDoorTile(wall[hit.wall].picnum) == 1)
|
||||||
goto DOSKIPBULLETHOLE;
|
goto DOSKIPBULLETHOLE;
|
||||||
if (p >= 0 && (
|
if (p >= 0 && CheckShootSwitchTile(wall[hit.wall].picnum))
|
||||||
wall[hit.wall].picnum == DIPSWITCH ||
|
|
||||||
wall[hit.wall].picnum == DIPSWITCH+1 ||
|
|
||||||
wall[hit.wall].picnum == DIPSWITCH2 ||
|
|
||||||
wall[hit.wall].picnum == DIPSWITCH2+1 ||
|
|
||||||
wall[hit.wall].picnum == DIPSWITCH3 ||
|
|
||||||
wall[hit.wall].picnum == DIPSWITCH3+1 ||
|
|
||||||
wall[hit.wall].picnum == HANDSWITCH ||
|
|
||||||
wall[hit.wall].picnum == HANDSWITCH+1))
|
|
||||||
{
|
{
|
||||||
P_ActivateSwitch(p,hit.wall,0);
|
P_ActivateSwitch(p,hit.wall,0);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1338,15 +1330,7 @@ DOSKIPBULLETHOLE:
|
||||||
A_SetHitData(l, &hit);
|
A_SetHitData(l, &hit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p >= 0 && (
|
if (p >= 0 && CheckShootSwitchTile(sprite[hit.sprite].picnum))
|
||||||
sprite[hit.sprite].picnum == DIPSWITCH ||
|
|
||||||
sprite[hit.sprite].picnum == DIPSWITCH+1 ||
|
|
||||||
sprite[hit.sprite].picnum == DIPSWITCH2 ||
|
|
||||||
sprite[hit.sprite].picnum == DIPSWITCH2+1 ||
|
|
||||||
sprite[hit.sprite].picnum == DIPSWITCH3 ||
|
|
||||||
sprite[hit.sprite].picnum == DIPSWITCH3+1 ||
|
|
||||||
sprite[hit.sprite].picnum == HANDSWITCH ||
|
|
||||||
sprite[hit.sprite].picnum == HANDSWITCH+1))
|
|
||||||
{
|
{
|
||||||
P_ActivateSwitch(p,hit.sprite,1);
|
P_ActivateSwitch(p,hit.sprite,1);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1359,15 +1343,7 @@ DOSKIPBULLETHOLE:
|
||||||
|
|
||||||
if (CheckDoorTile(wall[hit.wall].picnum) == 1)
|
if (CheckDoorTile(wall[hit.wall].picnum) == 1)
|
||||||
goto SKIPBULLETHOLE;
|
goto SKIPBULLETHOLE;
|
||||||
if (p >= 0 && (
|
if (p >= 0 && CheckShootSwitchTile(wall[hit.wall].picnum))
|
||||||
wall[hit.wall].picnum == DIPSWITCH ||
|
|
||||||
wall[hit.wall].picnum == DIPSWITCH+1 ||
|
|
||||||
wall[hit.wall].picnum == DIPSWITCH2 ||
|
|
||||||
wall[hit.wall].picnum == DIPSWITCH2+1 ||
|
|
||||||
wall[hit.wall].picnum == DIPSWITCH3 ||
|
|
||||||
wall[hit.wall].picnum == DIPSWITCH3+1 ||
|
|
||||||
wall[hit.wall].picnum == HANDSWITCH ||
|
|
||||||
wall[hit.wall].picnum == HANDSWITCH+1))
|
|
||||||
{
|
{
|
||||||
P_ActivateSwitch(p,hit.wall,0);
|
P_ActivateSwitch(p,hit.wall,0);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in a new issue