Skip to content

Commit

Permalink
Make wall splats follow moving sectors.
Browse files Browse the repository at this point in the history
  • Loading branch information
JRHard771 committed Oct 24, 2018
1 parent 8a1928b commit 0a7c355
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ZScript/droplets/Droplets.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class BloodDroplet : Droplets
splat.angle = VectorAngle(
linedat.HitLine.v2.p.x - linedat.HitLine.v1.p.x,
linedat.HitLine.v2.p.y - linedat.HitLine.v1.p.y)
+ 90.0;
- 90.0;
return resolveState("Death");
}
return resolveState(null);
Expand Down
38 changes: 38 additions & 0 deletions ZScript/droplets/Wall.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
class WallBloodSpot : Droplets
{
Vector2 sector_pos;
double[2] last_z; //(floor, ceiling)
double user_scale;
bool is_upper, is_lower;

override void PostBeginPlay()
{
Super.PostBeginPlay();
sector_pos = (pos.xy - AngleToVector(angle,4.0));
[last_z[0], last_z[1]] = GetSectorZ();
}

override void Tick()
{
double new_z[2];
Super.Tick();
[new_z[0], new_z[1]] = GetSectorZ();
if (pos.z < last_z[0] && last_z[0] != new_z[0])
SetOrigin((pos.xy, pos.z + (new_z[0] - last_z[0])), true);
else if (pos.z > last_z[1] && last_z[1] != new_z[1])
SetOrigin((pos.xy, pos.z + (new_z[1] - last_z[1])), true);
last_z[0] = new_z[0];
last_z[1] = new_z[1];
}

double, double GetSectorZ()
{
return GetZAt(sector_pos.x, sector_pos.y, flags: GZF_ABSOLUTEPOS),
GetZAt(sector_pos.x, sector_pos.y, flags: GZF_CEILING | GZF_ABSOLUTEPOS);
}

default
{
Expand All @@ -17,6 +46,7 @@ class WallBloodSpot : Droplets
{
A_QueueCorpse();
let run = RunnySpot(Actor.Spawn('RunnySpot',pos));
run.wbs = self;
run.user_scale = user_scale;
run.translation = translation;
run.angle = angle;
Expand All @@ -33,7 +63,15 @@ class WallBloodSpot : Droplets

class RunnySpot : Droplets
{
WallBloodSpot wbs;
double user_scale;
bool is_upper, is_lower;

override void Tick()
{
Super.Tick();
SetOrigin(wbs.pos,true);
}

default
{
Expand Down

0 comments on commit 0a7c355

Please sign in to comment.