- converted all remaining classes used by PicForName.

This means all functions using this can now pass class pointers directly to the native code.
This commit is contained in:
Christoph Oelckers 2022-12-12 19:39:17 +01:00
parent c9888ae6cb
commit 7f240a0a7a
23 changed files with 135 additions and 161 deletions

View file

@ -38,6 +38,13 @@ xx(DukeSectorEffector)
xx(RedneckGoogooCluster)
xx(DukeAtomicHealth)
xx(RedneckHen)
xx(DukeSmallSmoke)
xx(DukeExplosion2)
xx(DukeWaterBubble)
xx(DukeMoney)
xx(DukeMail)
xx(DukePaper)
xx(RedneckFeather)
xx(spawnstate)
xx(brokenstate)

View file

@ -301,7 +301,7 @@ void insertspriteq(DDukeActor* const actor)
//
//---------------------------------------------------------------------------
void lotsofstuff(DDukeActor* actor, int n, int spawntype)
void lotsofstuff(DDukeActor* actor, int n, PClassActor* spawntype)
{
for (int i = n; i > 0; i--)
{
@ -2633,7 +2633,7 @@ void handle_se32(DDukeActor *actor)
//
//---------------------------------------------------------------------------
void handle_se35(DDukeActor *actor, int SMALLSMOKE, int EXPLOSION2)
void handle_se35(DDukeActor *actor)
{
auto sc = actor->sector();
@ -2641,14 +2641,14 @@ void handle_se35(DDukeActor *actor, int SMALLSMOKE, int EXPLOSION2)
for (int j = 0; j < 8; j++)
{
actor->spr.Angles.Yaw = randomAngle(90);
auto spawned = spawn(actor, SMALLSMOKE);
auto spawned = spawn(actor, PClass::FindActor(NAME_DukeSmallSmoke));
if (spawned)
{
spawned->vel.X = 6 + krandf(8);
ssp(spawned, CLIPMASK0);
SetActor(spawned, spawned->spr.pos);
if (rnd(16))
spawn(actor, EXPLOSION2);
spawn(actor, PClass::FindActor(NAME_DukeExplosion2));
}
}
@ -2720,7 +2720,7 @@ void handle_se128(DDukeActor *actor)
//
//---------------------------------------------------------------------------
void handle_se130(DDukeActor *actor, int countmax, int EXPLOSION2)
void handle_se130(DDukeActor *actor, int countmax)
{
auto sc = actor->sector();
@ -2735,7 +2735,7 @@ void handle_se130(DDukeActor *actor, int countmax, int EXPLOSION2)
if (rnd(64))
{
auto k = spawn(actor, EXPLOSION2);
auto k = spawn(actor, PClass::FindActor(NAME_DukeExplosion2));
if (k)
{
double s = 0.03125 + (krand() & 7) * REPEAT_SCALE;

View file

@ -471,17 +471,17 @@ int movesprite_ex_d(DDukeActor* actor, const DVector3& change, unsigned int clip
void lotsofmoney_d(DDukeActor *actor, int n)
{
lotsofstuff(actor, n, DTILE_MONEY);
lotsofstuff(actor, n, PClass::FindActor(NAME_DukeMoney));
}
void lotsofmail_d(DDukeActor *actor, int n)
{
lotsofstuff(actor, n, DTILE_MAIL);
lotsofstuff(actor, n, PClass::FindActor(NAME_DukeMail));
}
void lotsofpaper_d(DDukeActor *actor, int n)
{
lotsofstuff(actor, n, DTILE_PAPER);
lotsofstuff(actor, n, PClass::FindActor(NAME_DukePaper));
}
//---------------------------------------------------------------------------
@ -1095,7 +1095,7 @@ static void handle_se28(DDukeActor* actor)
if (rnd(32) && (actor->temp_data[2] & 1))
{
act2->spr.cstat &= ~CSTAT_SPRITE_INVISIBLE;
spawn(act2, DTILE_SMALLSMOKE);
spawn(act2, PClass::FindActor(NAME_DukeSmallSmoke));
double x;
int p = findplayer(actor, &x);
@ -1235,7 +1235,7 @@ void moveeffectors_d(void) //STATNUM 3
break;
}
case SE_35:
handle_se35(act, DTILE_SMALLSMOKE, DTILE_EXPLOSION2);
handle_se35(act);
break;
case SE_25_PISTON: //PISTONS
@ -1287,10 +1287,10 @@ void moveeffectors_d(void) //STATNUM 3
break;
case 130:
handle_se130(act, 80, DTILE_EXPLOSION2);
handle_se130(act, 80);
break;
case 131:
handle_se130(act, 40, DTILE_EXPLOSION2);
handle_se130(act, 40);
break;
}
}

View file

@ -357,7 +357,7 @@ int movesprite_ex_r(DDukeActor* actor, const DVector3& change, unsigned int clip
void lotsoffeathers_r(DDukeActor *actor, int n)
{
lotsofstuff(actor, n, RTILE_FEATHER);
lotsofstuff(actor, n, PClass::FindActor(NAME_RedneckFeather));
}
@ -1215,7 +1215,7 @@ void moveeffectors_r(void) //STATNUM 3
}
case SE_35:
handle_se35(act, RTILE_SMALLSMOKE, RTILE_EXPLOSION2);
handle_se35(act);
break;
case SE_25_PISTON: //PISTONS
@ -1264,10 +1264,10 @@ void moveeffectors_r(void) //STATNUM 3
break;
case SE_130:
handle_se130(act, 80, RTILE_EXPLOSION2);
handle_se130(act, 80);
break;
case SE_131:
handle_se130(act, 40, RTILE_EXPLOSION2);
handle_se130(act, 40);
break;
}
}

View file

@ -173,7 +173,6 @@ int TILE_THREEDEE;
int TILE_INGAMEDUKETHREEDEE;
int TILE_FIRE;
int TILE_WATERBUBBLE;
int TILE_SMALLSMOKE;
int TILE_BLOODPOOL;
int TILE_CLOUDYSKIES;
int TILE_MIRRORBROKE;

View file

@ -289,7 +289,6 @@ void initactorflags_d()
TILE_BOTTOMSTATUSBAR = isWorldTour()? DTILE_WIDESCREENSTATUSBAR : DTILE_BOTTOMSTATUSBAR;
TILE_FIRE = DTILE_FIRE;
TILE_WATERBUBBLE = DTILE_WATERBUBBLE;
TILE_SMALLSMOKE = DTILE_SMALLSMOKE;
TILE_BLOODPOOL = DTILE_BLOODPOOL;
TILE_CLOUDYSKIES = DTILE_CLOUDYSKIES;
TILE_MIRRORBROKE = DTILE_MIRRORBROKE;

View file

@ -284,7 +284,6 @@ void initactorflags_r()
TILE_BOTTOMSTATUSBAR = RTILE_BOTTOMSTATUSBAR;
TILE_FIRE = RTILE_FIRE;
TILE_WATERBUBBLE = RTILE_WATERBUBBLE;
TILE_SMALLSMOKE = RTILE_SMALLSMOKE;
TILE_BLOODPOOL = RTILE_BLOODPOOL;
TILE_CLOUDYSKIES = RTILE_CLOUDYSKIES;
TILE_MIRRORBROKE = RTILE_MIRRORBROKE;

View file

@ -39,7 +39,7 @@ void movefta();
void clearcameras(player_struct* p);
void RANDOMSCRAP(DDukeActor* i);
void detonate(DDukeActor* i, PClassActor* explosion);
void lotsofstuff(DDukeActor* s, int n, int spawntype);
void lotsofstuff(DDukeActor* s, int n, PClassActor* spawntype);
void watersplash2(DDukeActor* i);
bool money(DDukeActor* i, int BLOODPOOL);
bool bloodpool(DDukeActor* i, bool puke);
@ -75,9 +75,9 @@ void handle_se27(DDukeActor* i);
void handle_se29(DDukeActor* actor);
void handle_se31(DDukeActor* a, bool choosedir);
void handle_se32(DDukeActor* i);
void handle_se35(DDukeActor* i, int SMALLSMOKE, int EXPLOSION2);
void handle_se35(DDukeActor* i);
void handle_se128(DDukeActor* i);
void handle_se130(DDukeActor* i, int countmax, int EXPLOSION2);
void handle_se130(DDukeActor* i, int countmax);
void check_fta_sounds_d(DDukeActor* i);

View file

@ -14,7 +14,6 @@ extern int TILE_STATIC;
extern int TILE_BOTTOMSTATUSBAR;
extern int TILE_FIRE;
extern int TILE_WATERBUBBLE;
extern int TILE_SMALLSMOKE;
extern int TILE_BLOODPOOL;
extern int TILE_CLOUDYSKIES;
extern int TILE_MIRRORBROKE;

View file

@ -150,10 +150,10 @@ void tracers(const DVector3& start, const DVector3& dest, int n)
if (sect->lotag == 2)
{
DVector2 scale(0.0625 + (krand() & 3) * REPEAT_SCALE, 0.0625 + (krand() & 3) * REPEAT_SCALE);
CreateActor(sect, pos, TILE_WATERBUBBLE, -32, scale, randomAngle(), 0., 0., ps[0].GetActor(), 5);
CreateActor(sect, pos, PClass::FindActor(NAME_DukeWaterBubble), -32, scale, randomAngle(), 0., 0., ps[0].GetActor(), 5);
}
else
CreateActor(sect, pos, TILE_SMALLSMOKE, -32, DVector2(0.21875, 0.21875), nullAngle, 0., 0., ps[0].GetActor(), 5);
CreateActor(sect, pos, PClass::FindActor(NAME_DukeSmallSmoke), -32, DVector2(0.21875, 0.21875), nullAngle, 0., 0., ps[0].GetActor(), 5);
}
}
}

View file

@ -175,7 +175,7 @@ static void shootknee(DDukeActor* actor, int p, DVector3 pos, DAngle ang)
knee->spr.extra += (krand() & 7);
if (p >= 0)
{
auto k = spawn(knee, DTILE_SMALLSMOKE);
auto k = spawn(knee, PClass::FindActor(NAME_DukeSmallSmoke));
if (k) k->spr.pos.Z -= 8;
S_PlayActorSound(KICK_HIT, knee);
}
@ -336,7 +336,7 @@ static void shootweapon(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int
else
checkhitceiling(hit.hitSector);
}
spawn(spark, DTILE_SMALLSMOKE);
spawn(spark, PClass::FindActor(NAME_DukeSmallSmoke));
}
if (hit.actor())
@ -354,7 +354,7 @@ static void shootweapon(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int
jib->spr.Angles.Yaw += DAngle22_5 / 2 - randomAngle(22.5);
}
}
else spawn(spark, DTILE_SMALLSMOKE);
else spawn(spark, PClass::FindActor(NAME_DukeSmallSmoke));
if (p >= 0 && isshootableswitch(hit.actor()->spr.spritetexture()))
{
@ -364,7 +364,7 @@ static void shootweapon(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int
}
else if (hit.hitWall)
{
spawn(spark, DTILE_SMALLSMOKE);
spawn(spark, PClass::FindActor(NAME_DukeSmallSmoke));
if (isadoorwall(hit.hitWall->walltexture) == 1)
goto SKIPBULLETHOLE;
@ -433,7 +433,7 @@ static void shootweapon(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int
{
fi.checkhitsprite(hit.actor(), spark);
if (!hit.actor()->isPlayer())
spawn(spark, DTILE_SMALLSMOKE);
spawn(spark, PClass::FindActor(NAME_DukeSmallSmoke));
else spark->spr.scale = DVector2(0, 0);
}
else if (hit.hitWall)
@ -1534,7 +1534,7 @@ void checkweapons_d(player_struct* p)
{
case RPG_WEAPON:
case HANDBOMB_WEAPON:
spawn(p->GetActor(), DTILE_EXPLOSION2);
spawn(p->GetActor(), PClass::FindActor(NAME_DukeExplosion2));
break;
}
}

View file

@ -151,7 +151,7 @@ static void shootmelee(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int a
}
if (p >= 0)
{
auto k = spawn(wpn, RTILE_SMALLSMOKE);
auto k = spawn(wpn, PClass::FindActor(NAME_DukeSmallSmoke));
if (k) k->spr.pos.Z -= 8;
if (atwith == RTILE_KNEE) S_PlayActorSound(KICK_HIT, wpn);
else if (isRRRA() && atwith == RTILE_SLINGBLADE) S_PlayActorSound(260, wpn);
@ -312,7 +312,7 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int
checkhitceiling(hit.hitSector);
}
if (hit.hitSector->lotag != 1)
spawn(spark, RTILE_SMALLSMOKE);
spawn(spark, PClass::FindActor(NAME_DukeSmallSmoke));
}
if (hit.actor())
@ -332,7 +332,7 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int
jib->spr.Angles.Yaw += DAngle22_5 / 2 - randomAngle(22.5);
}
}
else spawn(spark, RTILE_SMALLSMOKE);
else spawn(spark, PClass::FindActor(NAME_DukeSmallSmoke));
if (p >= 0 && isshootableswitch(hit.actor()->spr.spritetexture()))
{
@ -342,7 +342,7 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int
}
else if (hit.hitWall != nullptr)
{
spawn(spark, RTILE_SMALLSMOKE);
spawn(spark, PClass::FindActor(NAME_DukeSmallSmoke));
if (isadoorwall(hit.hitWall->walltexture) == 1)
goto SKIPBULLETHOLE;
@ -410,7 +410,7 @@ static void shootweapon(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int
{
fi.checkhitsprite(hit.actor(), spark);
if (!hit.actor()->isPlayer())
spawn(spark, RTILE_SMALLSMOKE);
spawn(spark, PClass::FindActor(NAME_DukeSmallSmoke));
else spark->spr.scale = DVector2(0, 0);
}
else if (hit.hitWall != nullptr)
@ -1427,7 +1427,7 @@ void checkweapons_r(player_struct* p)
[[fallthrough]];
case DYNAMITE_WEAPON:
case CROSSBOW_WEAPON:
spawn(p->GetActor(), RTILE_EXPLOSION2);
spawn(p->GetActor(), PClass::FindActor(NAME_DukeExplosion2));
break;
}
}

View file

@ -207,8 +207,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
// Twentieth Anniversary World Tour
if (!isWorldTour())
break;
[[fallthrough]];
case DTILE_SMALLSMOKE:
if (actj)
{
@ -225,16 +223,12 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
act->spr.pos.Z = x - 12;
}
if (act->spr.picnum == DTILE_ONFIRE)
{
act->spr.pos.X += krandf(32) - 16;
act->spr.pos.Y += krandf(32) - 16;
act->spr.pos.Z -= krandf(40);
act->spr.cstat |= CSTAT_SPRITE_YCENTER;
}
act->spr.pos.X += krandf(32) - 16;
act->spr.pos.Y += krandf(32) - 16;
act->spr.pos.Z -= krandf(40);
act->spr.cstat |= CSTAT_SPRITE_YCENTER;
ChangeActorStat(act, STAT_MISC);
break;
case DTILE_PLAYERONWATER:
@ -470,16 +464,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
ChangeActorStat(act, STAT_STANDABLE);
break;
case DTILE_STEAM:
if (actj)
{
act->spr.Angles.Yaw = actj->spr.Angles.Yaw;
act->spr.cstat = CSTAT_SPRITE_ALIGNMENT_WALL | CSTAT_SPRITE_YCENTER | CSTAT_SPRITE_TRANSLUCENT;
act->spr.scale = DVector2(REPEAT_SCALE, REPEAT_SCALE);
act->vel.X = -0.5;
ssp(act, CLIPMASK0);
}
[[fallthrough]];
case DTILE_CEILINGSTEAM:
ChangeActorStat(act, STAT_STANDABLE);
break;

View file

@ -119,7 +119,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
break;
case RTILE_EXPLOSION3:
case RTILE_SMALLSMOKE:
if (actj)
{
act->spr.Angles.Yaw = actj->spr.Angles.Yaw;
@ -133,10 +132,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
act->spr.shade = -127;
act->spr.cstat |= CSTAT_SPRITE_YCENTER;
}
else if (act->spr.picnum == RTILE_SMALLSMOKE)
{
act->spr.scale = DVector2(0.1875, 0.1875);
}
if (actj)
{
@ -422,19 +417,11 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
case RTILE_FIRSTAID:
case RTILE_SAWAMMO:
case RTILE_BOWLINGBALLSPRITE:
if (actj)
{
act->spr.lotag = 0;
if (act->spr.picnum != RTILE_BOWLINGBALLSPRITE)
{
act->spr.pos.Z -= 32;
act->vel.Z = -4;
}
else
{
act->vel.Z = 0;
}
act->spr.pos.Z -= 32;
act->vel.Z = -4;
ssp(act, CLIPMASK0);
act->spr.cstat = randomXFlip();
}
@ -518,14 +505,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
case RTILE_AIRTANK:
act->spr.scale = DVector2(0.296875, 0.25);
break;
case RTILE_BOWLINGBALLSPRITE:
act->spr.scale = DVector2(0.171875, 0.171875);
break;
case RTILE_POWDERKEG:
act->spr.scale = DVector2(0.171875, 0.171875);
act->spr.yint = 4;
act->vel.X = 2;
break;
case RTILE_CROSSBOWSPRITE:
act->spr.scale = DVector2(0.25, 0.21875);
break;
@ -557,16 +536,6 @@ DDukeActor* spawninit_r(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
}
act->spr.shade = act->sector()->floorshade;
break;
case RTILE_STEAM:
if (actj)
{
act->spr.Angles.Yaw = actj->spr.Angles.Yaw;
act->spr.cstat = CSTAT_SPRITE_ALIGNMENT_WALL | CSTAT_SPRITE_YCENTER | CSTAT_SPRITE_TRANSLUCENT;
act->spr.scale = DVector2(REPEAT_SCALE, REPEAT_SCALE);
act->vel.X = -0.5;
ssp(act, CLIPMASK0);
}
[[fallthrough]];
case RTILE_CEILINGSTEAM:
ChangeActorStat(act, STAT_STANDABLE);
break;

View file

@ -7,34 +7,6 @@ BEGIN_DUKE_NS
void resetswitch(int tag);
static TMap<FName, int> classnameToTile;
// Workaround so that the script code can be written in its final form. This must go away later.
int PicForName(int intname)
{
if (classnameToTile.CountUsed() == 0)
{
static std::pair<const char*, const char*> classes[] = {
{"DukeSmallSmoke", "SMALLSMOKE"},
{"RedneckBowlingBallSprite", "BOWLINGBALLSPRITE"},
{"DukeSteam", "STEAM"},
{"RedneckHen", "HEN"},
{"RedneckCow", "COW"},
{"RedneckPig", "PIG"},
{"RedneckBillyRay", "BILLYRAY"},
{"RedneckMinion", "MINION"},
};
for (auto& p : classes)
{
classnameToTile.Insert(FName(p.first), tileForName(p.second));
}
}
auto p = classnameToTile.CheckKey(FName(ENamedName(intname)));
if (p) return *p;
return -1;
}
//---------------------------------------------------------------------------
//
// global exports
@ -391,42 +363,29 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, StopSound, DukeActor_StopSound)
return 0;
}
DDukeActor* DukeActor_Spawn(DDukeActor* origin, int intname)
DDukeActor* DukeActor_Spawn(DDukeActor* origin, PClassActor* cls)
{
int picnum = PicForName(intname);
if (picnum == -1)
{
auto cls = PClass::FindActor(FName(ENamedName(intname)));
if (cls) return spawn(origin, cls);
}
else
{
return spawn(origin, picnum);
}
return nullptr;
return spawn(origin, cls);
}
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, spawn, DukeActor_Spawn)
{
PARAM_SELF_PROLOGUE(DDukeActor);
PARAM_INT(type);
PARAM_POINTER(type, PClassActor);
ACTION_RETURN_POINTER(DukeActor_Spawn(self, type));
}
void DukeActor_Lotsofstuff(DDukeActor* actor, int count, int intname)
void DukeActor_Lotsofstuff(DDukeActor* actor, PClassActor* intname, int count)
{
int picnum = PicForName(intname);
// Todo: make this class aware.
lotsofstuff(actor, count, picnum);
lotsofstuff(actor, count, intname);
}
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, lotsofstuff, DukeActor_Lotsofstuff)
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, lotsofstuff, lotsofstuff)
{
PARAM_SELF_PROLOGUE(DDukeActor);
PARAM_INT(type);
PARAM_POINTER(type, PClassActor);
PARAM_INT(count);
DukeActor_Lotsofstuff(self, count, type);
lotsofstuff(self, count, type);
return 0;
}
@ -664,27 +623,15 @@ DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, spritewidth, duke_spw)
ACTION_RETURN_INT(duke_spw(self));
}
void DukeActor_shoot(DDukeActor* act, int intname)
void DukeActor_shoot(DDukeActor* act, PClassActor* intname)
{
int picnum = PicForName(intname);
if (picnum == -1)
{
auto n = FName(ENamedName(intname));
auto cls = PClass::FindActor(n);
assert(cls);
fi.shoot(act, -1, cls);
}
else
{
fi.shoot(act, picnum, nullptr);
}
fi.shoot(act, -1, intname);
}
DEFINE_ACTION_FUNCTION_NATIVE(DDukeActor, shoot, DukeActor_shoot)
{
PARAM_SELF_PROLOGUE(DDukeActor);
PARAM_INT(type);
PARAM_POINTER(type, PClassActor);
DukeActor_shoot(self, type);
return 0;
}

View file

@ -249,6 +249,8 @@ spawnclasses
100 = DukeAtomicHealth
1656 = DukeShrinkerExplosion
661 = DukeWaterBubble
2329 = DukeSmallSmoke
1250 = DukeSteam
2000 = DukePigCop
2001 = DukePigCopStayPut

View file

@ -283,6 +283,9 @@ spawnclasses
5595 = RedneckGoogooCluster
240 = DukeWaterBubble
3388 = RedneckCircleStuck
1554 = DukeSmallSmoke
1327 = DukeSteam
3437 = RedneckBowlingBallSprite
4861 = RedneckHen
4862 = RedneckHenStayput

View file

@ -107,6 +107,8 @@ version "4.10"
#include "zscript/games/duke/actors/burning.zs"
#include "zscript/games/duke/actors/explosion2.zs"
#include "zscript/games/duke/actors/waterbubble.zs"
#include "zscript/games/duke/actors/smallsmoke.zs"
#include "zscript/games/duke/actors/steam.zs"
#include "zscript/games/duke/actors/batteryammo.zs"
#include "zscript/games/duke/actors/sixpak.zs"

View file

@ -346,3 +346,15 @@ class RedneckBowlingBallSpot : RedneckBowlingController
class RedneckBowlingPinSpot : RedneckBowlingController
{ }
class RedneckBowlingBallsprite : DukeActor
{
default
{
pic "BOWLINGBALLSPRITE";
}
override void Initialize()
{
commonItemSetup((0.171875, 0.171875), -1, true);
}
}

View file

@ -9,7 +9,7 @@ class DukeRecon : DukeActor
Sound PainSnd;
Sound RoamSnd;
int shift;
String spawntype; // should be 'class<DukeActor>' but the spawned types have not all been converted yet.
class<DukeActor> spawntype; // should be 'class<DukeActor>' but the spawned types have not all been converted yet.
override void initialize()
{

View file

@ -0,0 +1,25 @@
class DukeSmallSmoke : DukeActor
{
default
{
pic "SMALLSMOKE";
}
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.scale = (0.375, 0.375);
self.ChangeStat(STAT_MISC);
}
}

View file

@ -0,0 +1,22 @@
class DukeSteam : DukeActor
{
default
{
pic "STEAM";
}
override void Initialize()
{
let owner = self.ownerActor;
if (owner && owner != self)
{
self.Angle = owner.Angle;
self.cstat = CSTAT_SPRITE_ALIGNMENT_WALL | CSTAT_SPRITE_YCENTER | CSTAT_SPRITE_TRANSLUCENT;
self.vel.X = -0.5;
self.doMove(CLIPMASK0);
}
self.scale = (REPEAT_SCALE, REPEAT_SCALE);
self.ChangeStat(STAT_STANDABLE);
}
}

View file

@ -191,7 +191,7 @@ class DukeActor : CoreActor native
native int PlayActorSound(Sound snd, int chan = CHAN_AUTO, int flags = 0);
native int CheckSoundPlaying(Sound snd, int chan = CHAN_AUTO);
native void StopSound(Sound snd, int flags = 0);
native DukeActor spawn(Name type);
native DukeActor spawn(class<DukeActor> type);
native DukeActor spawnsprite(int type); // for cases where the map has a picnum stored. Avoid when possible.
native DukeActor spawnweaponorammo(int type);
native void lotsofglass(int count, walltype wal = null);
@ -235,7 +235,7 @@ class DukeActor : CoreActor native
native double gutsoffset();
native int movesprite(Vector3 move, int clipmask);
native int movesprite_ex(Vector3 move, int clipmask, CollisionData coll);
native void shoot(Name spawnclass);
native void shoot(class<DukeActor> spawnclass);
native void setClipDistFromTile();
native void insertspriteq();
native void operateforcefields(int tag);
@ -274,14 +274,19 @@ class DukeActor : CoreActor native
}
void commonItemSetup(Vector2 scale = (0.5, 0.5), int usefloorshade = -1)
void commonItemSetup(Vector2 scale = (0.5, 0.5), int usefloorshade = -1, bool noinitialmove = false)
{
let owner = self.ownerActor;
if (owner != self)
{
self.lotag = 0;
self.pos.Z -= 32;
self.vel.Z = -4;
if (!noinitialmove)
{
self.pos.Z -= 32;
self.vel.Z = -4;
}
else
self.vel.Z = 0;
self.DoMove(CLIPMASK0);
self.cstat |= randomxflip();
}