- migrated all simple EGS calls to CreateActor

The remaining ones require more work on the weapon code first
This commit is contained in:
Christoph Oelckers 2022-09-13 20:35:14 +02:00
parent a48ebc51a6
commit 65b6b5ba71
5 changed files with 28 additions and 56 deletions

View file

@ -284,10 +284,7 @@ void hud_input(int plnum)
p->inven_icon = 3;
auto pactor =
EGS(p->cursector,
p->player_int_pos().X,
p->player_int_pos().Y,
p->player_int_pos().Z + (30 << 8), 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.Buildang(), 0, 0, nullptr, 10);
pactor->temp_data[3] = pactor->temp_data[4] = 0;
p->holoduke_on = pactor;
pactor->spr.yint = plnum;

View file

@ -962,7 +962,7 @@ static void shootgrowspark(DDukeActor* actor, int p, int sx, int sy, int sz, int
actor->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL;
auto spark = EGS(sect, hit.int_hitpos().X, hit.int_hitpos().Y, hit.int_hitpos().Z, GROWSPARK, -16, 28, 28, sa, 0, 0, actor, 1);
auto spark = CreateActor(sect, hit.hitpos, GROWSPARK, -16, 28, 28, sa, 0, 0, actor, 1);
if (!spark) return;
spark->spr.pal = 2;
@ -2211,10 +2211,7 @@ static void operateweapon(int snum, ESyncBits actions)
i = -512 - MulScale(p->horizon.sum().asq16(), 20, 16);
}
auto spawned = EGS(p->cursector,
p->player_int_pos().X + p->angle.ang.Cos() * (1 << 8),
p->player_int_pos().Y + p->angle.ang.Sin() * (1 << 8),
p->player_int_pos().Z, HEAVYHBOMB, -16, 9, 9,
auto spawned = CreateActor(p->cursector, p->pos + p->angle.ang.ToVector() * 16, HEAVYHBOMB, -16, 9, 9,
p->angle.ang.Buildang(), (k + (p->hbomb_hold_delay << 5)), i, pact, 1);
if (isNam())

View file

@ -854,6 +854,9 @@ void shoot_r(DDukeActor* actor, int atwith)
sy += bcos(sa, -7);
}
}
DVector3 svec(sx * inttoworld, sy * inttoworld, sz * zinttoworld);
DAngle sang = DAngle::fromBuild(sa);
SetGameVarID(g_iAtWithVarID, atwith, actor, p);
SetGameVarID(g_iReturnVarID, 0, actor, p);
@ -947,16 +950,11 @@ void shoot_r(DDukeActor* actor, int atwith)
zvel = -2048;
vel = x >> 4;
sang += DAngle90;
if (atwith == CHEERBOMB)
EGS(sect,
sx - bsin(sa + 512, -8),
sy + bcos(sa + 512, -8),
sz + (6 << 8), atwith, -64, 16, 16, sa, vel, zvel, actor, 1);
CreateActor(sect, svec + DVector3(-sang.Sin() * 4, sang.Cos() * 4, 6), atwith, -64, 16, 16, sa, vel, zvel, actor, 1);
else
EGS(sect,
sx - bsin(sa + 512, -8),
sy + bcos(sa + 512, -8),
sz + (6 << 8), atwith, -64, 32, 32, sa, vel, zvel, actor, 1);
CreateActor(sect, svec + DVector3(-sang.Sin() * 4, sang.Cos() * 4, 6), atwith, -64, 32, 32, sa, vel, zvel, actor, 1);
break;
}
}
@ -2745,10 +2743,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
i = -512 - MulScale(p->horizon.sum().asq16(), 20, 16);
}
auto spawned = EGS(p->cursector,
p->player_int_pos().X + p->angle.ang.Cos() * (1 << 8),
p->player_int_pos().Y + p->angle.ang.Sin() * (1 << 8),
p->player_int_pos().Z, HEAVYHBOMB, -16, 9, 9,
auto spawned = CreateActor(p->cursector,p->pos + p->angle.ang.ToVector() * 16, HEAVYHBOMB, -16, 9, 9,
p->angle.ang.Buildang(), (k + (p->hbomb_hold_delay << 5)) * 2, i, pact, 1);
if (spawned)
@ -3154,10 +3149,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
i = -512 - MulScale(p->horizon.sum().asq16(), 20, 16);
}
EGS(p->cursector,
p->player_int_pos().X + p->angle.ang.Cos() * (1 << 8),
p->player_int_pos().Y + p->angle.ang.Sin() * (1 << 8),
p->player_int_pos().Z, POWDERKEG, -16, 9, 9,
CreateActor(p->cursector, p->pos + p->angle.ang.ToVector() * 16, POWDERKEG, -16, 9, 9,
p->angle.ang.Buildang(), k * 2, i, pact, 1);
}
p->kickback_pic++;

View file

@ -340,10 +340,7 @@ void operateweapon_ww(int snum, ESyncBits actions)
i = -512 - MulScale(p->horizon.sum().asq16(), 20, 16);
}
auto j = EGS(p->cursector,
p->player_int_pos().X + p->angle.ang.Cos() * (1 << 8),
p->player_int_pos().Y + p->angle.ang.Sin() * (1 << 8),
p->player_int_pos().Z, HEAVYHBOMB, -16, 9, 9,
auto j = CreateActor(p->cursector, p->pos + p->angle.ang.ToVector() * 16, HEAVYHBOMB, -16, 9, 9,
p->angle.ang.Buildang(), (k + (p->hbomb_hold_delay << 5)), i, p->GetActor(), 1);
if (j)

View file

@ -927,47 +927,36 @@ void activatebysector_r(sectortype* sect, DDukeActor* activator)
static void lotsofpopcorn(DDukeActor *actor, walltype* wal, int n)
{
int j, z;
int a;
sectortype* sect = nullptr;
if (wal == nullptr)
{
for (j = n - 1; j >= 0; j--)
for (int j = n - 1; j >= 0; j--)
{
a = actor->int_ang() - 256 + (krand() & 511) + 1024;
CreateActor(actor->sector(), actor->spr.pos, POPCORN, -32, 36, 36, a, 32 + (krand() & 63), 1024 - (krand() & 1023), actor, 5);
DAngle a = actor->spr.angle - DAngle45 + DAngle180 + randomAngle(90);
CreateActor(actor->sector(), actor->spr.pos, POPCORN, -32, 36, 36, a.Buildang(), 32 + (krand() & 63), 1024 - (krand() & 1023), actor, 5);
}
return;
}
j = n + 1;
auto pos = wal->pos;
auto delta = wal->delta() / (n + 1);
int x1 = wal->wall_int_pos().X;
int y1 = wal->wall_int_pos().Y;
pos.X -= Sgn(delta.X) * maptoworld;
pos.Y += Sgn(delta.Y) * maptoworld;
auto delta = wal->int_delta();
x1 -= Sgn(delta.X);
y1 += Sgn(delta.Y);
delta.X /= j;
delta.Y /= j;
for (j = n; j > 0; j--)
for (int j = n; j > 0; j--)
{
x1 += delta.X;
y1 += delta.Y;
updatesector(x1, y1, &sect);
pos += delta;
sect = actor->sector();
updatesector(DVector3(pos, sect->floorz), &sect);
if (sect)
{
z = sect->int_floorz() - (krand() & (abs(sect->int_ceilingz() - sect->int_floorz())));
if (z < -(32 << 8) || z >(32 << 8))
z = actor->int_pos().Z - (32 << 8) + (krand() & ((64 << 8) - 1));
a = actor->int_ang() - 1024;
EGS(actor->sector(), x1, y1, z, POPCORN, -32, 36, 36, a, 32 + (krand() & 63), -(krand() & 1023), actor, 5);
double z = sect->floorz - krandf(abs(sect->ceilingz - sect->floorz));
if (abs(z) > 32)
z = actor->spr.pos.Z - 32 + krandf(64);
DAngle a = actor->spr.angle - DAngle180;
CreateActor(actor->sector(), DVector3(pos, z), POPCORN, -32, 36, 36, a.Buildang(), 32 + (krand() & 63), -(krand() & 1023), actor, 5);
}
}
}