- converted most of the remaining CreateActor calls.

This commit is contained in:
Christoph Oelckers 2022-09-14 20:53:34 +02:00
parent 30a3bba644
commit cd6c524b90
6 changed files with 51 additions and 25 deletions

View file

@ -66,8 +66,12 @@ void RANDOMSCRAP(DDukeActor* origin)
offset.Z = krandf(16) - 8;
int v = isRR() ? 16 : 48;
CreateActor(origin->sector(), origin->spr.pos + offset,
TILE_SCRAP6 + (r4 & 15), -8, v, v, r3 & 2047, (r2 & 63) + 64, -512 - (r1 & 2047), origin, 5);
auto a = randomAngle();
auto vel = krandf(4) + 4;
auto zvel = -krandf(8) - 2;
CreateActor(origin->sector(), origin->spr.pos + offset, TILE_SCRAP6 + (r4 & 15), -8, v, v, a, vel, zvel, origin, 5);
}
//---------------------------------------------------------------------------
@ -263,9 +267,9 @@ void lotsofstuff(DDukeActor* actor, int n, int spawntype)
{
for (int i = n; i > 0; i--)
{
int r1 = krand(); // using the RANDCORRECT version from RR.
DAngle r1 = randomAngle();
double r2 = zrand(47);
auto j = CreateActor(actor->sector(), actor->spr.pos.plusZ(-r2), spawntype, -32, 8, 8, r1 & 2047, 0, 0, actor, 5);
auto j = CreateActor(actor->sector(), actor->spr.pos.plusZ(-r2), spawntype, -32, 8, 8, r1, 0., 0., actor, 5);
if (j) j->spr.cstat = randomFlip();
}
}
@ -1318,7 +1322,7 @@ void movetongue(DDukeActor *actor, int tongue, int jaw)
auto pos = actor->spr.pos + actor->spr.angle.ToVector() * 2 * k;
pos.Z += k * Sgn(actor->vel.Z) * abs(actor->vel.Z / 12);
auto q = CreateActor(actor->sector(), pos, tongue, -40 + (k << 1), 8, 8, 0, 0, 0, actor, 5);
auto q = CreateActor(actor->sector(), pos, tongue, -40 + (k << 1), 8, 8, nullAngle, 0., 0., actor, 5);
if (q)
{
q->spr.cstat = CSTAT_SPRITE_YCENTER;
@ -1328,7 +1332,7 @@ void movetongue(DDukeActor *actor, int tongue, int jaw)
int k = actor->temp_data[0]; // do not depend on the above loop counter.
auto pos = actor->spr.pos + actor->spr.angle.ToVector() * 2 * k;
pos.Z += k * Sgn(actor->vel.Z) * abs(actor->vel.Z / 12);
auto spawned = CreateActor(actor->sector(), pos, jaw, -40, 32, 32, 0, 0, 0, actor, 5);
auto spawned = CreateActor(actor->sector(), pos, jaw, -40, 32, 32, nullAngle, 0., 0., actor, 5);
if (spawned)
{
spawned->spr.cstat = CSTAT_SPRITE_YCENTER;
@ -2531,11 +2535,12 @@ void gutsdir(DDukeActor* actor, int gtype, int n, int p)
for (int j = 0; j < n; j++)
{
int a = krand() & 2047;
int r1 = krand();
int r2 = krand();
auto a = randomAngle();
auto vel = krandf(8) + 16;
auto zvel = -krandf(8) - 2;
// TRANSITIONAL: owned by a player???
CreateActor(actor->sector(), DVector3(actor->spr.pos.XY(), gutz), gtype, -32, sx, sy, a, 256 + (r2 & 127), -512 - (r1 & 2047), ps[p].GetActor(), 5);
CreateActor(actor->sector(), DVector3(actor->spr.pos.XY(), gutz), gtype, -32, sx, sy, a, vel, zvel, ps[p].GetActor(), 5);
}
}

View file

@ -2166,9 +2166,13 @@ int ParseState::parse(void)
offs.Y = krandf(16) - 8;
offs.Z = -krandf(16) - 8;
auto a = randomAngle();
auto vel = krandf(8) + 2;
auto zvel = -krandf(8);
auto spawned = CreateActor(g_ac->sector(), g_ac->spr.pos + offs,
dnum + s, g_ac->spr.shade, 32 + (krand() & 15), 32 + (krand() & 15),
krand() & 2047, (krand() & 127) + 32, -(krand() & 2047), g_ac, 5);
a, vel, zvel, g_ac, 5);
if (spawned)
{
if (weap)

View file

@ -284,7 +284,7 @@ void hud_input(int plnum)
p->inven_icon = 3;
auto pactor =
CreateActor(p->cursector, p->pos.plusZ(30), TILE_APLAYER, -64, 0, 0, p->angle.ang.Buildang(), 0, 0, nullptr, 10);
CreateActor(p->cursector, p->pos.plusZ(30), TILE_APLAYER, -64, 0, 0, p->angle.ang, 0., 0., nullptr, 10);
pactor->temp_data[3] = pactor->temp_data[4] = 0;
p->holoduke_on = pactor;
pactor->spr.yint = plnum;

View file

@ -146,9 +146,9 @@ void tracers(const DVector3& start, const DVector3& dest, int n)
if (sect)
{
if (sect->lotag == 2)
CreateActor(sect, pos, TILE_WATERBUBBLE, -32, 4 + (krand() & 3), 4 + (krand() & 3), krand() & 2047, 0, 0, ps[0].GetActor(), 5);
CreateActor(sect, pos, TILE_WATERBUBBLE, -32, 4 + (krand() & 3), 4 + (krand() & 3), randomAngle(), 0., 0., ps[0].GetActor(), 5);
else
CreateActor(sect, pos, TILE_SMALLSMOKE, -32, 14, 14, 0, 0, 0, ps[0].GetActor(), 5);
CreateActor(sect, pos, TILE_SMALLSMOKE, -32, 14, 14, nullAngle, 0., 0., ps[0].GetActor(), 5);
}
}
}

View file

@ -540,7 +540,7 @@ void resetpspritevars(int g)
STATUSBARTYPE tsbar[MAXPLAYERS];
CreateActor(ps[0].cursector, ps[0].pos,
TILE_APLAYER, 0, 0, 0, ps[0].angle.ang.Buildang(), 0, 0, nullptr, 10);
TILE_APLAYER, 0, 0, 0, ps[0].angle.ang, 0., 0., nullptr, 10);
if (ud.recstat != 2) for (i = 0; i < MAXPLAYERS; i++)
{

View file

@ -219,7 +219,7 @@ DDukeActor* spawn(DDukeActor* actj, int pn)
{
if (actj)
{
auto spawned = CreateActor(actj->sector(), actj->spr.pos, pn, 0, 0, 0, 0, 0, 0, actj, 0);
auto spawned = CreateActor(actj->sector(), actj->spr.pos, pn, 0, 0, 0, nullAngle, 0., 0., actj, 0);
if (spawned)
{
spawned->attackertype = actj->spr.picnum;
@ -1037,15 +1037,18 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
void lotsofglass(DDukeActor *actor, walltype* wal, int n)
{
int j, z, a;
int j, z;
sectortype* sect = nullptr;
if (wal == nullptr)
{
for (j = n - 1; j >= 0; j--)
{
a = actor->int_ang() - 256 + (krand() & 511) + 1024;
CreateActor(actor->sector(), actor->spr.pos, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, 32 + (krand() & 63), 1024 - (krand() & 1023), actor, 5);
auto a = actor->spr.angle - DAngle45 + DAngle180 + randomAngle(90);
auto vel = krandf(4) + 2;
auto zvel = 4 - krandf(4);
CreateActor(actor->sector(), actor->spr.pos, TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, vel, zvel, actor, 5);
}
return;
}
@ -1069,7 +1072,10 @@ void lotsofglass(DDukeActor *actor, walltype* wal, int n)
if (fabs(z) > 32)
z = actor->spr.pos.Z - 32 + krandf(64);
DAngle angl = actor->spr.angle - DAngle180;
CreateActor(actor->sector(), DVector3(pos, z), TILE_GLASSPIECES + (j % 3), -32, 36, 36, angl.Buildang(), 32 + (krand() & 63), -(krand() & 1023), actor, 5);
auto vel = krandf(4) + 2;
auto zvel = 4 - krandf(4);
CreateActor(actor->sector(), DVector3(pos, z), TILE_GLASSPIECES + (j % 3), -32, 36, 36, angl, vel, zvel, actor, 5);
}
}
}
@ -1084,8 +1090,11 @@ void spriteglass(DDukeActor* actor, int n)
{
for (int j = n; j > 0; j--)
{
int a = krand() & 2047;
auto k = CreateActor(actor->sector(), actor->spr.pos.plusZ(-(krand() & 16)), TILE_GLASSPIECES + (j % 3), krand() & 15, 36, 36, a, 32 + (krand() & 63), -512 - (krand() & 2047), actor, 5);
auto a = randomAngle();
auto vel = krandf(4) + 2;
auto zvel = -2 - krandf(8);
auto k = CreateActor(actor->sector(), actor->spr.pos.plusZ(-(krand() & 16)), TILE_GLASSPIECES + (j % 3), krand() & 15, 36, 36, a, vel, zvel, actor, 5);
if (k) k->spr.pal = actor->spr.pal;
}
}
@ -1107,8 +1116,10 @@ void ceilingglass(DDukeActor* actor, sectortype* sectp, int n)
{
pos += delta;
DAngle a = randomAngle();
auto vel = krandf(2);
double z = sectp->ceilingz + krandf(16);
CreateActor(sectp, DVector3(pos, z), TILE_GLASSPIECES + (j % 3), -32, 36, 36, a.Buildang(), (krand() & 31), 0, actor, 5);
CreateActor(sectp, DVector3(pos, z), TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, vel, 0, actor, 5);
}
}
}
@ -1129,7 +1140,10 @@ void lotsofcolourglass(DDukeActor* actor, walltype* wal, int n)
for (j = n - 1; j >= 0; j--)
{
DAngle a = randomAngle();
auto k = CreateActor(actor->sector(), actor->spr.pos.plusZ(-(krand() & 63)), TILE_GLASSPIECES + (j % 3), -32, 36, 36, a.Buildang(), 32 + (krand() & 63), 1024 - (krand() & 2047), actor, 5);
auto vel = krandf(4) + 2;
auto zvel = 4 - krandf(4);
auto k = CreateActor(actor->sector(), actor->spr.pos.plusZ(-(krand() & 63)), TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, vel, zvel, actor, 5);
if (k) k->spr.pal = krand() & 15;
}
return;
@ -1150,7 +1164,10 @@ void lotsofcolourglass(DDukeActor* actor, walltype* wal, int n)
z = actor->spr.pos.Z - 32 + krandf(64);
DAngle a = actor->spr.angle - DAngle180;
auto k = CreateActor(actor->sector(), DVector3(pos, z), TILE_GLASSPIECES + (j % 3), -32, 36, 36, a.Buildang(), 32 + (krand() & 63), -(krand() & 2047), actor, 5);
auto vel = krandf(4) + 2;
auto zvel = - krandf(8);
auto k = CreateActor(actor->sector(), DVector3(pos, z), TILE_GLASSPIECES + (j % 3), -32, 36, 36, a, vel, zvel, actor, 5);
if (k) k->spr.pal = krand() & 7;
}
}