Gez
Why don't I have a custom title by now?!
Posts: 7036
Registered: 07-07 |
There's no dedicated Hexen glass break effect; in the Raven game it's all handled by ACS.
The function is indeed from Strife. If there's differences with what you got from your reverse engineering, then either Randy made a mistake or thought it would be better this way.
code: FUNC(LS_GlassBreak)
// GlassBreak (bNoJunk)
{
bool switched;
bool quest1, quest2;
ln->flags &= ~(ML_BLOCKING|ML_BLOCKEVERYTHING);
switched = P_ChangeSwitchTexture (ln->sidedef[0], false, 0, &quest1);
ln->special = 0;
if (ln->sidedef[1] != NULL)
{
switched |= P_ChangeSwitchTexture (ln->sidedef[1], false, 0, &quest2);
}
else
{
quest2 = quest1;
}
if (switched)
{
if (!arg0)
{ // Break some glass
fixed_t x, y;
AActor *glass;
angle_t an;
int speed;
x = ln->v1->x + ln->dx/2;
y = ln->v1->y + ln->dy/2;
x += (ln->frontsector->soundorg[0] - x) / 5;
y += (ln->frontsector->soundorg[1] - y) / 5;
for (int i = 0; i < 7; ++i)
{
glass = Spawn("GlassJunk", x, y, ONFLOORZ, ALLOW_REPLACE);
glass->z += 24 * FRACUNIT;
glass->SetState (glass->SpawnState + (pr_glass() % glass->health));
an = pr_glass() << (32-8);
glass->angle = an;
an >>= ANGLETOFINESHIFT;
speed = pr_glass() & 3;
glass->velx = finecosine[an] * speed;
glass->vely = finesine[an] * speed;
glass->velz = (pr_glass() & 7) << FRACBITS;
// [RH] Let the shards stick around longer than they did in Strife.
glass->tics += pr_glass();
}
}
if (quest1 || quest2)
{ // Up stats and signal this mission is complete
if (it == NULL)
{
for (int i = 0; i < MAXPLAYERS; ++i)
{
if (playeringame[i])
{
it = players[i].mo;
break;
}
}
}
if (it != NULL)
{
it->GiveInventoryType (QuestItemClasses[28]);
it->GiveInventoryType (RUNTIME_CLASS(AUpgradeAccuracy));
it->GiveInventoryType (RUNTIME_CLASS(AUpgradeStamina));
}
}
}
// We already changed the switch texture, so don't make the main code switch it back.
return false;
}
|