mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-23 20:42:45 +00:00
- scriptified the native part of FireflyFlyingEffect.
This commit is contained in:
parent
9783b8c402
commit
9f01c87ccb
5 changed files with 50 additions and 69 deletions
|
@ -991,69 +991,6 @@ void movetransports_d(void)
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
static void fireflyflyingeffect(DDukeActor *actor)
|
|
||||||
{
|
|
||||||
double xx;
|
|
||||||
int p = findplayer(actor, &xx);
|
|
||||||
execute(actor, p, xx);
|
|
||||||
if (actor->ObjectFlags & OF_EuthanizeMe) return; // killed by script.
|
|
||||||
|
|
||||||
auto Owner = actor->GetOwner();
|
|
||||||
if (!Owner || Owner->spr.picnum != DTILE_FIREFLY)
|
|
||||||
{
|
|
||||||
actor->Destroy();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Owner->spr.scale.X >= 0.375 || Owner->spr.pal == 1)
|
|
||||||
actor->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
|
|
||||||
else
|
|
||||||
actor->spr.cstat &= ~CSTAT_SPRITE_INVISIBLE;
|
|
||||||
|
|
||||||
auto dvec = Owner->spr.pos.XY() - ps[p].GetActor()->spr.pos.XY();
|
|
||||||
double dist = dvec.Length();
|
|
||||||
|
|
||||||
if (dist != 0.0) dvec /= dist;
|
|
||||||
actor->spr.pos = Owner->spr.pos + DVector3(dvec.X * -0.625, dvec.Y * -0.625, 8);
|
|
||||||
|
|
||||||
if (Owner->spr.extra <= 0)
|
|
||||||
{
|
|
||||||
actor->Destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void moveexplosions_d(void) // STATNUM 5
|
|
||||||
{
|
|
||||||
DukeStatIterator it(STAT_MISC);
|
|
||||||
while (auto act = it.Next())
|
|
||||||
{
|
|
||||||
if (act->spr.scale.X == 0 || act->spr.sectp == nullptr || actorflag(act, SFLAG2_DIENOW))
|
|
||||||
{
|
|
||||||
act->Destroy();
|
|
||||||
}
|
|
||||||
else if (isWorldTour() && act->spr.picnum == DTILE_FIREFLYFLYINGEFFECT)
|
|
||||||
{
|
|
||||||
fireflyflyingeffect(act);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CallTick(act);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void handle_se06_d(DDukeActor* actor)
|
void handle_se06_d(DDukeActor* actor)
|
||||||
{
|
{
|
||||||
auto sc = actor->sector();
|
auto sc = actor->sector();
|
||||||
|
@ -1609,7 +1546,7 @@ void think_d(void)
|
||||||
tickstat(STAT_PROJECTILE); //ST 4
|
tickstat(STAT_PROJECTILE); //ST 4
|
||||||
moveplayers(); //ST 10
|
moveplayers(); //ST 10
|
||||||
movefallers_d(); //ST 12
|
movefallers_d(); //ST 12
|
||||||
moveexplosions_d(); //ST 5
|
tickstat(STAT_MISC, true); //ST 5
|
||||||
|
|
||||||
actortime.Reset();
|
actortime.Reset();
|
||||||
actortime.Clock();
|
actortime.Clock();
|
||||||
|
|
|
@ -123,11 +123,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
|
||||||
ChangeActorStat(act, STAT_ZOMBIEACTOR);
|
ChangeActorStat(act, STAT_ZOMBIEACTOR);
|
||||||
}
|
}
|
||||||
return act;
|
return act;
|
||||||
case DTILE_FIREFLYFLYINGEFFECT:
|
|
||||||
act->SetOwner(actj);
|
|
||||||
ChangeActorStat(act, STAT_MISC);
|
|
||||||
act->spr.scale = DVector2(0.25, 0.25);
|
|
||||||
return act;
|
|
||||||
case DTILE_LAVAPOOLBUBBLE:
|
case DTILE_LAVAPOOLBUBBLE:
|
||||||
if (actj->spr.scale.X < 0.46875)
|
if (actj->spr.scale.X < 0.46875)
|
||||||
return act;
|
return act;
|
||||||
|
|
|
@ -6,4 +6,5 @@ spawnclasses
|
||||||
5737 = DukeGenericDestructible, "WTGLASS2", "", "GLASS_BREAKING", spawnglass
|
5737 = DukeGenericDestructible, "WTGLASS2", "", "GLASS_BREAKING", spawnglass
|
||||||
5294 = DeveloperCommentary
|
5294 = DeveloperCommentary
|
||||||
1891 = DukeFlamethrowerFlame
|
1891 = DukeFlamethrowerFlame
|
||||||
|
5296 = DukeFireflyFlyingEffect
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,6 +103,7 @@ version "4.10"
|
||||||
#include "zscript/games/duke/actors/toilet.zs"
|
#include "zscript/games/duke/actors/toilet.zs"
|
||||||
|
|
||||||
#include "zscript/games/duke/actors/flamethrowerflame.zs"
|
#include "zscript/games/duke/actors/flamethrowerflame.zs"
|
||||||
|
#include "zscript/games/duke/actors/firefly.zs"
|
||||||
|
|
||||||
#include "zscript/games/duke/actors/redneckmisc.zs"
|
#include "zscript/games/duke/actors/redneckmisc.zs"
|
||||||
#include "zscript/games/duke/actors/emptybike.zs"
|
#include "zscript/games/duke/actors/emptybike.zs"
|
||||||
|
|
47
wadsrc/static/zscript/games/duke/actors/firefly.zs
Normal file
47
wadsrc/static/zscript/games/duke/actors/firefly.zs
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
|
||||||
|
// for now only the effect is scriptified.
|
||||||
|
|
||||||
|
class DukeFireflyFlyingEffect : DukeActor
|
||||||
|
{
|
||||||
|
default
|
||||||
|
{
|
||||||
|
pic "FIREFLYFLYINGEFFECT";
|
||||||
|
}
|
||||||
|
|
||||||
|
override void Initialize()
|
||||||
|
{
|
||||||
|
self.scale = (0.25, 0.25);
|
||||||
|
self.ChangeStat(STAT_MISC);
|
||||||
|
}
|
||||||
|
|
||||||
|
override void Tick()
|
||||||
|
{
|
||||||
|
Super.Tick();
|
||||||
|
if (bDestroyed) return; // killed by script.
|
||||||
|
|
||||||
|
|
||||||
|
let Owner = self.ownerActor;
|
||||||
|
if (!Owner || !Owner.checkType("FIREFLY"))
|
||||||
|
{
|
||||||
|
self.Destroy();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Owner.scale.X >= 0.375 || Owner.pal == 1)
|
||||||
|
self.cstat |= CSTAT_SPRITE_INVISIBLE;
|
||||||
|
else
|
||||||
|
self.cstat &= ~CSTAT_SPRITE_INVISIBLE;
|
||||||
|
|
||||||
|
let p = self.findplayer();
|
||||||
|
let dvec = Owner.pos.XY - p.actor.pos.XY;
|
||||||
|
double dist = dvec.Length();
|
||||||
|
|
||||||
|
if (dist != 0.0) dvec /= dist;
|
||||||
|
self.pos = Owner.pos + (dvec.X * -0.625, dvec.Y * -0.625, 8);
|
||||||
|
|
||||||
|
if (Owner.extra <= 0)
|
||||||
|
{
|
||||||
|
self.Destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue