- added a new argument to GlassBreak to allow it to spawn other types of debris than GlassJunk by passing a spawn ID.

This commit is contained in:
Christoph Oelckers 2017-02-26 23:07:16 +01:00
parent 8c30ca213d
commit 0514a997db
2 changed files with 26 additions and 13 deletions

View file

@ -47,7 +47,7 @@ DEFINE_SPECIAL(Ceiling_CrushRaiseAndStay, 45, 3, 4, 4)
DEFINE_SPECIAL(Floor_CrushStop, 46, 1, 1, 1)
DEFINE_SPECIAL(Ceiling_MoveToValue, 47, 3, 5, 5)
DEFINE_SPECIAL(Sector_Attach3dMidtex, 48, -1, -1, 3)
DEFINE_SPECIAL(GlassBreak, 49, 0, 1, 1)
DEFINE_SPECIAL(GlassBreak, 49, 0, 1, 2)
DEFINE_SPECIAL(ExtraFloor_LightOnly, 50, -1, -1, 2)
DEFINE_SPECIAL(Sector_SetLink, 51, 4, 4, 4)
DEFINE_SPECIAL(Scroll_Wall, 52, 5, 5, 5)

View file

@ -3177,7 +3177,7 @@ FUNC(LS_ClearForceField)
}
FUNC(LS_GlassBreak)
// GlassBreak (bNoJunk)
// GlassBreak (bNoJunk, junkID)
{
bool switched;
bool quest1, quest2;
@ -3197,7 +3197,6 @@ FUNC(LS_GlassBreak)
{
if (!arg0)
{ // Break some glass
AActor *glass;
DVector2 linemid((ln->v1->fX() + ln->v2->fX()) / 2, (ln->v1->fY() + ln->v2->fY()) / 2);
@ -3209,13 +3208,26 @@ FUNC(LS_GlassBreak)
y += (ln->frontsector->centerspot.y - y) / 5;
*/
auto type = SpawnableThings.CheckKey(arg1);
for (int i = 0; i < 7; ++i)
{
AActor *glass = nullptr;
if (arg1 > 0)
{
if (type != nullptr)
{
glass = Spawn(*type, DVector3(linemid, ONFLOORZ), ALLOW_REPLACE);
glass->AddZ(24.);
}
}
else
{
glass = Spawn("GlassJunk", DVector3(linemid, ONFLOORZ), ALLOW_REPLACE);
glass->AddZ(24.);
glass->SetState(glass->SpawnState + (pr_glass() % glass->health));
}
if (glass != nullptr)
{
glass->Angles.Yaw = pr_glass() * (360 / 256.);
glass->VelFromAngle(pr_glass() & 3);
glass->Vel.Z = (pr_glass() & 7);
@ -3223,6 +3235,7 @@ FUNC(LS_GlassBreak)
glass->tics += pr_glass();
}
}
}
if (quest1 || quest2)
{ // Up stats and signal this mission is complete
if (it == NULL)