mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-20 08:00:56 +00:00
- simplified several switch check blocks using the data from the definition files.
This commit is contained in:
parent
2386ea9930
commit
808fb3c433
5 changed files with 13 additions and 78 deletions
|
@ -50,7 +50,6 @@ struct DukeGameInfo
|
|||
extern DukeGameInfo gs;
|
||||
|
||||
inline TObjPtr<DDukeActor*> camsprite;
|
||||
inline TObjPtr<DDukeActor*> BellSprite;
|
||||
inline TObjPtr<DDukeActor*> spriteq[1024];
|
||||
inline TObjPtr<DDukeActor*> currentCommentarySprite;
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ static void shootknee(DDukeActor* actor, int p, DVector3 pos, DAngle ang)
|
|||
if (p >= 0 && ps[p].steroids_amount > 0 && ps[p].steroids_amount < 400)
|
||||
knee->spr.extra += (gs.max_player_health >> 2);
|
||||
}
|
||||
if (hit.actor() && hit.actor()->spr.picnum != DTILE_ACCESSSWITCH && hit.actor()->spr.picnum != DTILE_ACCESSSWITCH2)
|
||||
if (hit.actor() && ! isaccessswitch(hit.actor()->spr.spritetexture()))
|
||||
{
|
||||
fi.checkhitsprite(hit.actor(), knee);
|
||||
if (p >= 0) fi.checkhitswitch(p, nullptr, hit.actor());
|
||||
|
@ -281,7 +281,7 @@ static void shootknee(DDukeActor* actor, int p, DVector3 pos, DAngle ang)
|
|||
if (hit.hitpos.Z >= hit.hitWall->nextSector()->floorz)
|
||||
hit.hitWall =hit.hitWall->nextWall();
|
||||
|
||||
if (hit.hitWall->wallpicnum != DTILE_ACCESSSWITCH && hit.hitWall->wallpicnum != DTILE_ACCESSSWITCH2)
|
||||
if (!isaccessswitch(hit.hitWall->walltexture()))
|
||||
{
|
||||
checkhitwall(knee, hit.hitWall, hit.hitpos);
|
||||
if (p >= 0) fi.checkhitswitch(p, hit.hitWall, nullptr);
|
||||
|
@ -441,15 +441,7 @@ static void shootweapon(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int
|
|||
}
|
||||
else spawn(spark, DTILE_SMALLSMOKE);
|
||||
|
||||
if (p >= 0 && (
|
||||
hit.actor()->spr.picnum == DTILE_DIPSWITCH ||
|
||||
hit.actor()->spr.picnum == DTILE_DIPSWITCHON ||
|
||||
hit.actor()->spr.picnum == DTILE_DIPSWITCH2 ||
|
||||
hit.actor()->spr.picnum == DTILE_DIPSWITCH2ON ||
|
||||
hit.actor()->spr.picnum == DTILE_DIPSWITCH3 ||
|
||||
hit.actor()->spr.picnum == DTILE_DIPSWITCH3ON ||
|
||||
hit.actor()->spr.picnum == DTILE_HANDSWITCH ||
|
||||
hit.actor()->spr.picnum == DTILE_HANDSWITCHON))
|
||||
if (p >= 0 && isshootableswitch(hit.actor()->spr.spritetexture()))
|
||||
{
|
||||
fi.checkhitswitch(p, nullptr, hit.actor());
|
||||
return;
|
||||
|
@ -463,15 +455,7 @@ static void shootweapon(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int
|
|||
goto SKIPBULLETHOLE;
|
||||
if (isablockdoor(hit.hitWall->walltexture()) == 1)
|
||||
goto SKIPBULLETHOLE;
|
||||
if (p >= 0 && (
|
||||
hit.hitWall->wallpicnum == DTILE_DIPSWITCH ||
|
||||
hit.hitWall->wallpicnum == DTILE_DIPSWITCHON ||
|
||||
hit.hitWall->wallpicnum == DTILE_DIPSWITCH2 ||
|
||||
hit.hitWall->wallpicnum == DTILE_DIPSWITCH2ON ||
|
||||
hit.hitWall->wallpicnum == DTILE_DIPSWITCH3 ||
|
||||
hit.hitWall->wallpicnum == DTILE_DIPSWITCH3ON ||
|
||||
hit.hitWall->wallpicnum == DTILE_HANDSWITCH ||
|
||||
hit.hitWall->wallpicnum == DTILE_HANDSWITCHON))
|
||||
if (p >= 0 && isshootableswitch(hit.hitWall->walltexture()))
|
||||
{
|
||||
fi.checkhitswitch(p, hit.hitWall, nullptr);
|
||||
return;
|
||||
|
@ -956,7 +940,7 @@ static void shootgrowspark(DDukeActor* actor, int p, DVector3 pos, DAngle ang)
|
|||
else if (hit.actor() != nullptr) fi.checkhitsprite(hit.actor(), spark);
|
||||
else if (hit.hitWall != nullptr)
|
||||
{
|
||||
if (hit.hitWall->wallpicnum != DTILE_ACCESSSWITCH && hit.hitWall->wallpicnum != DTILE_ACCESSSWITCH2)
|
||||
if (!isaccessswitch(hit.hitWall->walltexture()))
|
||||
{
|
||||
checkhitwall(spark, hit.hitWall, hit.hitpos);
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ static void shootmelee(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int a
|
|||
if (p >= 0 && ps[p].steroids_amount > 0 && ps[p].steroids_amount < 400)
|
||||
wpn->spr.extra += (gs.max_player_health >> 2);
|
||||
|
||||
if (hit.actor() && hit.actor()->spr.picnum != RTILE_ACCESSSWITCH && hit.actor()->spr.picnum != RTILE_ACCESSSWITCH2)
|
||||
if (hit.actor() && !isaccessswitch(hit.actor()->spr.spritetexture()))
|
||||
{
|
||||
fi.checkhitsprite(hit.actor(), wpn);
|
||||
if (p >= 0) fi.checkhitswitch(p, nullptr, hit.actor());
|
||||
|
@ -172,7 +172,7 @@ static void shootmelee(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int a
|
|||
if (hit.hitpos.Z >= hit.hitWall->nextSector()->floorz)
|
||||
hit.hitWall = hit.hitWall->nextWall();
|
||||
|
||||
if (hit.hitWall->wallpicnum != RTILE_ACCESSSWITCH && hit.hitWall->wallpicnum != RTILE_ACCESSSWITCH2)
|
||||
if (!isaccessswitch(hit.hitWall->walltexture()))
|
||||
{
|
||||
checkhitwall(wpn, hit.hitWall, hit.hitpos);
|
||||
if (p >= 0) fi.checkhitswitch(p, hit.hitWall, nullptr);
|
||||
|
@ -334,16 +334,7 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int
|
|||
}
|
||||
else spawn(spark, RTILE_SMALLSMOKE);
|
||||
|
||||
if (p >= 0 && (
|
||||
hit.actor()->spr.picnum == RTILE_DIPSWITCH ||
|
||||
hit.actor()->spr.picnum == RTILE_DIPSWITCHON ||
|
||||
hit.actor()->spr.picnum == RTILE_DIPSWITCH2 ||
|
||||
hit.actor()->spr.picnum == RTILE_DIPSWITCH2ON ||
|
||||
hit.actor()->spr.picnum == RTILE_DIPSWITCH3 ||
|
||||
hit.actor()->spr.picnum == RTILE_DIPSWITCH3ON ||
|
||||
(isRRRA() && hit.actor()->spr.picnum == RTILE_BELLSWITCH) ||
|
||||
hit.actor()->spr.picnum == RTILE_HANDSWITCH ||
|
||||
hit.actor()->spr.picnum == RTILE_HANDSWITCHON))
|
||||
if (p >= 0 && isshootableswitch(hit.actor()->spr.spritetexture()))
|
||||
{
|
||||
fi.checkhitswitch(p, nullptr, hit.actor());
|
||||
return;
|
||||
|
@ -357,16 +348,7 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int
|
|||
goto SKIPBULLETHOLE;
|
||||
if (isablockdoor(hit.hitWall->walltexture()) == 1)
|
||||
goto SKIPBULLETHOLE;
|
||||
if (p >= 0 && (
|
||||
hit.hitWall->wallpicnum == RTILE_DIPSWITCH ||
|
||||
hit.hitWall->wallpicnum == RTILE_DIPSWITCHON ||
|
||||
hit.hitWall->wallpicnum == RTILE_DIPSWITCH2 ||
|
||||
hit.hitWall->wallpicnum == RTILE_DIPSWITCH2ON ||
|
||||
hit.hitWall->wallpicnum == RTILE_DIPSWITCH3 ||
|
||||
hit.hitWall->wallpicnum == RTILE_DIPSWITCH3ON ||
|
||||
(isRRRA() && hit.hitWall->wallpicnum == RTILE_BELLSWITCH) ||
|
||||
hit.hitWall->wallpicnum == RTILE_HANDSWITCH ||
|
||||
hit.hitWall->wallpicnum == RTILE_HANDSWITCHON))
|
||||
if (p >= 0 && isshootableswitch(hit.hitWall->walltexture()))
|
||||
{
|
||||
fi.checkhitswitch(p, hit.hitWall, nullptr);
|
||||
return;
|
||||
|
|
|
@ -291,21 +291,9 @@ void prelevel_d(int g, TArray<DDukeActor*>& actors)
|
|||
it.Reset(STAT_DEFAULT);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
switch (actor->spr.picnum)
|
||||
auto ext = GetExtInfo(actor->spr.spritetexture());
|
||||
if (ext.switchphase == 1 && switches[ext.switchindex].type == SwitchDef::Regular)
|
||||
{
|
||||
case DTILE_DIPSWITCHON:
|
||||
case DTILE_DIPSWITCH2ON:
|
||||
case DTILE_PULLSWITCHON:
|
||||
case DTILE_HANDSWITCHON:
|
||||
case DTILE_SLOTDOORON:
|
||||
case DTILE_LIGHTSWITCHON:
|
||||
case DTILE_SPACELIGHTSWITCHON:
|
||||
case DTILE_SPACEDOORSWITCHON:
|
||||
case DTILE_FRANKENSTINESWITCHON:
|
||||
case DTILE_LIGHTSWITCH2ON:
|
||||
case DTILE_POWERSWITCH1ON:
|
||||
case DTILE_LOCKSWITCH1ON:
|
||||
case DTILE_POWERSWITCH2ON:
|
||||
j = lotags.Find(actor->spr.lotag);
|
||||
if (j == lotags.Size())
|
||||
{
|
||||
|
@ -317,7 +305,6 @@ void prelevel_d(int g, TArray<DDukeActor*>& actors)
|
|||
ac->temp_data[0] = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -590,25 +590,9 @@ void prelevel_r(int g, TArray<DDukeActor*>& actors)
|
|||
it.Reset(STAT_DEFAULT);
|
||||
while (auto ac = it.Next())
|
||||
{
|
||||
switch (ac->spr.picnum)
|
||||
auto ext = GetExtInfo(ac->spr.spritetexture());
|
||||
if (ext.switchphase == 1 && switches[ext.switchindex].type == SwitchDef::Regular)
|
||||
{
|
||||
case RTILE_IRONWHEELSWITCHON:
|
||||
if (!isRRRA()) break;
|
||||
[[fallthrough]];
|
||||
case RTILE_DIPSWITCHON:
|
||||
case RTILE_DIPSWITCH2ON:
|
||||
case RTILE_PULLSWITCHON:
|
||||
case RTILE_HANDSWITCHON:
|
||||
case RTILE_SLOTDOORON:
|
||||
case RTILE_LIGHTSWITCHON:
|
||||
case RTILE_SPACELIGHTSWITCHON:
|
||||
case RTILE_SPACEDOORSWITCHON:
|
||||
case RTILE_FRANKENSTINESWITCHON:
|
||||
case RTILE_LIGHTSWITCH2ON:
|
||||
case RTILE_POWERSWITCH1ON:
|
||||
case RTILE_LOCKSWITCH1ON:
|
||||
case RTILE_POWERSWITCH2ON:
|
||||
|
||||
j = lotags.Find(ac->spr.lotag);
|
||||
if (j == lotags.Size())
|
||||
{
|
||||
|
@ -620,7 +604,6 @@ void prelevel_r(int g, TArray<DDukeActor*>& actors)
|
|||
actj->temp_data[0] = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue