- exported TOILETWATER, BURNING and EXPLOSION2.

All types needed for cleaning up PicForName
This commit is contained in:
Christoph Oelckers 2022-12-12 09:25:41 +01:00
parent e0bd038391
commit ccc048136f
16 changed files with 121 additions and 64 deletions

View file

@ -607,7 +607,7 @@ void operaterespawns(int low)
//
//---------------------------------------------------------------------------
void detonate(DDukeActor *actor, int explosion)
void detonate(DDukeActor *actor, PClassActor* explosion)
{
ud.earthquaketime = 16;

View file

@ -303,18 +303,11 @@ void animatesprites_d(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
switch (h->spr.picnum)
{
case DTILE_EXPLOSION2:
case DTILE_EXPLOSION2BOT:
case DTILE_ATOMICHEALTH:
case DTILE_GROWSPARK:
case DTILE_CHAINGUN:
case DTILE_SHRINKEREXPLOSION:
case DTILE_FLOORFLAME:
if (t->picnum == DTILE_EXPLOSION2)
{
ps[screenpeek].visibility = -127;
lastvisinc = PlayClock + 32;
}
t->shade = -127;
break;
case DTILE_FIRE:

View file

@ -350,16 +350,9 @@ void animatesprites_r(tspriteArray& tsprites, const DVector2& viewVec, DAngle vi
t->shade = -127;
break;
case RTILE_EXPLOSION2:
case RTILE_ATOMICHEALTH:
case RTILE_CHAINGUN:
case RTILE_EXPLOSION3:
if (t->picnum == RTILE_EXPLOSION2)
{
ps[screenpeek].visibility = -127;
lastvisinc = PlayClock + 32;
t->pal = 0;
}
t->shade = -127;
break;
case RTILE_UFOBEAM:

View file

@ -38,7 +38,7 @@ void movefta();
void clearcameras(player_struct* p);
void RANDOMSCRAP(DDukeActor* i);
void detonate(DDukeActor* i, int explosion);
void detonate(DDukeActor* i, PClassActor* explosion);
void lotsofstuff(DDukeActor* s, int n, int spawntype);
void watersplash2(DDukeActor* i);
bool money(DDukeActor* i, int BLOODPOOL);

View file

@ -341,7 +341,7 @@ void displayrooms(int snum, double interpfrac, bool sceneonly)
//GLInterface.SetMapFog(false);
RestoreInterpolations();
if (!isRRRA() || !fogactive)
if (!fogactive)
{
if (PlayClock < lastvisinc)
{

View file

@ -227,10 +227,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
if (!isWorldTour())
break;
[[fallthrough]];
case DTILE_EXPLOSION2:
case DTILE_EXPLOSION2BOT:
case DTILE_BURNING:
case DTILE_BURNING2:
case DTILE_SMALLSMOKE:
case DTILE_SHRINKEREXPLOSION:
@ -241,12 +237,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
act->spr.cstat = CSTAT_SPRITE_YCENTER | randomXFlip();
}
if (act->spr.picnum == DTILE_EXPLOSION2 || act->spr.picnum == DTILE_EXPLOSION2BOT)
{
act->spr.scale = DVector2(0.75, 0.75);
act->spr.shade = -127;
act->spr.cstat |= CSTAT_SPRITE_YCENTER;
}
else if (act->spr.picnum == DTILE_SHRINKEREXPLOSION)
{
act->spr.scale = DVector2(0.5, 0.5);
@ -255,10 +245,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
{
act->spr.scale = DVector2(0.375, 0.375);
}
else if (act->spr.picnum == DTILE_BURNING || act->spr.picnum == DTILE_BURNING2)
{
act->spr.scale = DVector2(0.0625, 0.0625);
}
if (actj)
{
@ -586,10 +572,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
ChangeActorStat(act, STAT_ZOMBIEACTOR);
}
break;
case DTILE_TOILETWATER:
act->spr.shade = -16;
ChangeActorStat(act, STAT_STANDABLE);
break;
}
return act;
}

View file

@ -118,9 +118,7 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
ChangeActorStat(act, STAT_ACTOR);
break;
case RTILE_EXPLOSION2:
case RTILE_EXPLOSION3:
case RTILE_BURNING:
case RTILE_SMALLSMOKE:
if (actj)
{
@ -129,12 +127,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
act->spr.cstat = CSTAT_SPRITE_YCENTER | randomXFlip();
}
if (act->spr.picnum == RTILE_EXPLOSION2)
{
act->spr.scale = DVector2(0.75, 0.75);
act->spr.shade = -127;
act->spr.cstat |= CSTAT_SPRITE_YCENTER;
}
else if (act->spr.picnum == RTILE_EXPLOSION3)
{
act->spr.scale = DVector2(2, 2);
@ -145,10 +137,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
{
act->spr.scale = DVector2(0.1875, 0.1875);
}
else if (act->spr.picnum == RTILE_BURNING)
{
act->spr.scale = DVector2(0.0625, 0.0625);
}
if (actj)
{
@ -695,10 +683,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
ChangeActorStat(act, STAT_ZOMBIEACTOR);
}
break;
case RTILE_TOILETWATER:
act->spr.shade = -16;
ChangeActorStat(act, STAT_STANDABLE);
break;
case RTILE_RRTILE63:
act->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
act->spr.scale = DVector2(REPEAT_SCALE, REPEAT_SCALE);

View file

@ -14,11 +14,6 @@ int PicForName(int intname)
if (classnameToTile.CountUsed() == 0)
{
static std::pair<const char*, const char*> classes[] = {
{ "DukeToiletWater", "TOILETWATER" },
{ "DukeBurning", "BURNING"},
{"DukeExplosion2","EXPLOSION2"},
{"DukeExplosion2Bot","EXPLOSION2BOT"},
{"DukeTransporterStar", "TRANSPORTERSTAR"},
{"RedneckRabbit","RABBIT"},
{"DukeBatteryAmmo", "BATTERYAMMO"},
{"DukeSixpak", "SIXPAK"},
@ -29,9 +24,7 @@ int PicForName(int intname)
{"RedneckCircleStuck", "CIRCLESTUCK"},
{"DukePigCop", "PIGCOP"},
{"DukeSmallSmoke", "SMALLSMOKE"},
{"DukeBurning", "BURNING"},
{"RedneckBowlingBallSprite", "BOWLINGBALLSPRITE"},
{"DukeToiletWater", "TOILETWATER"},
{"DukeSteam", "STEAM"},
{"RedneckHen", "HEN"},
{"RedneckCow", "COW"},
@ -223,6 +216,18 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Duke, getPlayerIndex, getPlayerIndex)
PARAM_PROLOGUE;
PARAM_POINTER(p, player_struct);
ACTION_RETURN_INT(getPlayerIndex(p));
}
void setlastvisinc(int v)
{
lastvisinc = PlayClock + v;
}
DEFINE_ACTION_FUNCTION_NATIVE(_Duke, setlastvisinc, setlastvisinc)
{
PARAM_PROLOGUE;
PARAM_INT(v);
setlastvisinc(v);
return 0;
}
@ -576,17 +581,15 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, hitasprite, hitasprite)
return min(numret, 2);
}
void DukeActor_detonate(DDukeActor* origin, int intname)
void DukeActor_detonate(DDukeActor* origin, PClassActor* type)
{
// all callers use "EXPLOSION2", so ignore the parameter for now. This should be fixed once EXPLOSION2 gets scriptified.
int picnum = tileForName("EXPLOSION2");
detonate(origin, picnum);
detonate(origin, type);
}
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, detonate, DukeActor_detonate)
{
PARAM_SELF_PROLOGUE(DDukeActor);
PARAM_INT(type);
PARAM_POINTER(type, PClassActor);
DukeActor_detonate(self, type);
return 0;
}

View file

@ -239,5 +239,10 @@ spawnclasses
1671 = DukeForceRipple
1630 = DukeTransporterStar
1261 = DukeTransporterBeam
921 = DukeToiletWater
2270 = DukeBurning
2310 = DukeBurning2
1890 = DukeExplosion2
2219 = DukeExplosion2Bot
}

View file

@ -275,6 +275,9 @@ spawnclasses
1398 = DukeTransporterStar
1338 = DukeTransporterBeam
1196 = DukeToiletWater
1494 = DukeBurning
1441 = DukeExplosion2
}

View file

@ -103,6 +103,9 @@ version "4.10"
#include "zscript/games/duke/actors/toilet.zs"
#include "zscript/games/duke/actors/transporter.zs"
#include "zscript/games/duke/actors/toiletwater.zs"
#include "zscript/games/duke/actors/burning.zs"
#include "zscript/games/duke/actors/explosion2.zs"
#include "zscript/games/duke/actors/flamethrowerflame.zs"
#include "zscript/games/duke/actors/firefly.zs"

View file

@ -0,0 +1,28 @@
class DukeBurning : DukeActor
{
default
{
pic "BURNING";
}
override void Initialize()
{
if (!self.mapSpawned)
{
double c,f;
[c, f] = self.sector.getSlopes(self.pos.XY);
self.pos.Z = min(self.pos.Z, f - 12);
}
self.Scale = (0.0625, 0.0625);
self.ChangeStat(STAT_MISC);
}
}
class DukeBurning2 : DukeBurning
{
default
{
pic "BURNING2";
}
}

View file

@ -0,0 +1,49 @@
class DukeExplosion2 : DukeActor
{
default
{
pic "EXPLOSION2";
}
override bool animate(tspritetype t)
{
Duke.GetViewPlayer().visibility = -127;
Duke.setlastvisinc(32);
t.shade = -127;
return false;
}
override void Initialize()
{
let owner = self.ownerActor;
if (owner && owner != self)
{
self.Angle = owner.Angle;
self.cstat = randomXFlip();
double c,f;
[c, f] = self.sector.getSlopes(self.pos.XY);
self.pos.Z = min(self.pos.Z, f - 12);
}
self.cstat |= CSTAT_SPRITE_YCENTER;
self.shade = -127;
self.Scale = (0.75, 0.75);
self.ChangeStat(STAT_MISC);
}
}
class DukeExplosion2Bot : DukeExplosion2
{
default
{
pic "EXPLOSION2BOT";
}
override bool animate(tspritetype t)
{
t.shade = -127;
return false;
}
}

View file

@ -0,0 +1,13 @@
class DukeToiletWater : DukeActor
{
default
{
pic "TOILETWATER";
}
override void Initialize()
{
self.shade = -16;
self.changeStat(STAT_STANDABLE);
}
}

View file

@ -197,7 +197,7 @@ class DukeActor : CoreActor native
native void lotsofglass(int count, walltype wal = null);
native void lotsofcolourglass(int count, walltype wal = null);
native void makeitfall();
native void detonate(name type);
native void detonate(class<DukeActor> type);
native void checkhitdefault(DukeActor proj);
native void operatesectors(sectortype sec);
native int SpriteWidth();

View file

@ -171,6 +171,7 @@ struct Duke native
native static bool StartCommentary(int tag, DukeActor act);
native static void StopCommentary();
static native int getPlayerIndex(DukePlayer p);
static native void setlastvisinc(int amount);
static int rnd(int val)
{
return (random(0, 255) >= (255 - (val)));