mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-19 07:01:09 +00:00
- first round of CreateActor calls.
This commit is contained in:
parent
666f768413
commit
5ccefcb77b
5 changed files with 45 additions and 31 deletions
|
@ -537,7 +537,6 @@ void lotsofpaper_d(DDukeActor *actor, int n)
|
|||
|
||||
void guts_d(DDukeActor* actor, int gtype, int n, int p)
|
||||
{
|
||||
int j;
|
||||
int sx, sy;
|
||||
uint8_t pal;
|
||||
|
||||
|
@ -560,18 +559,18 @@ void guts_d(DDukeActor* actor, int gtype, int n, int p)
|
|||
else
|
||||
pal = actor->spr.pal;
|
||||
|
||||
for (j = 0; j < n; j++)
|
||||
for (int j = 0; j < n; j++)
|
||||
{
|
||||
// RANDCORRECT version from RR.
|
||||
int a = krand() & 2047;
|
||||
int r1 = krand();
|
||||
int r2 = krand();
|
||||
DAngle a = randomAngle();
|
||||
double zvel = -2 -krandf(8);
|
||||
double vel = 3 + krandf(2);
|
||||
DVector3 offs;
|
||||
offs.Z = gutz - krandf(16);
|
||||
offs.Y = krandf(16) - 8;
|
||||
offs.X = krandf(16) - 8;
|
||||
// TRANSITIONAL: owned by a player???
|
||||
auto spawned = CreateActor(actor->sector(), offs + actor->spr.pos.XY(), gtype, -32, sx, sy, a, 48 + (r2 & 31), -512 - (r1 & 2047), ps[p].GetActor(), 5);
|
||||
auto spawned = CreateActor(actor->sector(), offs + actor->spr.pos.XY(), gtype, -32, sx, sy, a, vel, zvel, ps[p].GetActor(), 5);
|
||||
if (spawned)
|
||||
{
|
||||
if (spawned->spr.picnum == JIBS2)
|
||||
|
@ -1004,7 +1003,10 @@ static void movefireext(DDukeActor* actor)
|
|||
|
||||
for (int k = 0; k < 16; k++)
|
||||
{
|
||||
auto spawned = CreateActor(actor->sector(), actor->spr.pos.plusZ(krandf(-48)), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (actor->int_zvel() >> 2), actor, 5);
|
||||
auto a = randomAngle();
|
||||
auto vel = krandf(4) + 4;
|
||||
auto zvel = -krandf(16) - actor->vel.Z * 0.25;
|
||||
auto spawned = CreateActor(actor->sector(), actor->spr.pos.plusZ(krandf(-48)), SCRAP3 + (krand() & 3), -8, 48, 48, a, vel, zvel, actor, 5);
|
||||
if(spawned) spawned->spr.pal = 2;
|
||||
}
|
||||
|
||||
|
@ -1569,7 +1571,7 @@ static void weaponcommon_d(DDukeActor* proj)
|
|||
double zAdd = k * proj->vel.Z / 24;
|
||||
auto spawned = CreateActor(proj->sector(), proj->spr.pos.plusZ(zAdd) + proj->spr.angle.ToVector() * k * 2.,
|
||||
FIRELASER, -40 + (k << 2),
|
||||
proj->spr.xrepeat, proj->spr.yrepeat, 0, 0, 0, proj->GetOwner(), 5);
|
||||
proj->spr.xrepeat, proj->spr.yrepeat, nullAngle, 0., 0., proj->GetOwner(), 5);
|
||||
|
||||
if (spawned)
|
||||
{
|
||||
|
@ -2103,7 +2105,11 @@ static void greenslime(DDukeActor *actor)
|
|||
return;
|
||||
for (j = 16; j >= 0; j--)
|
||||
{
|
||||
auto k = CreateActor(actor->sector(), actor->spr.pos, GLASSPIECES + (j % 3), -32, 36, 36, krand() & 2047, 32 + (krand() & 63), 1024 - (krand() & 1023), actor, 5);
|
||||
auto a = randomAngle();
|
||||
auto vel = krandf(2) + 2;
|
||||
auto zvel = 4 - krandf(4);
|
||||
|
||||
auto k = CreateActor(actor->sector(), actor->spr.pos, GLASSPIECES + (j % 3), -32, 36, 36, a, vel, zvel, actor, 5);
|
||||
k->spr.pal = 1;
|
||||
}
|
||||
ps[p].actors_killed++;
|
||||
|
@ -2134,14 +2140,18 @@ static void greenslime(DDukeActor *actor)
|
|||
|
||||
SetActor(actor, actor->spr.pos);
|
||||
|
||||
actor->set_int_ang(ps[p].angle.ang.Buildang());
|
||||
actor->spr.angle = ps[p].angle.ang;
|
||||
|
||||
if ((PlayerInput(p, SB_FIRE) || (ps[p].quick_kick > 0)) && ps[p].GetActor()->spr.extra > 0)
|
||||
if (ps[p].quick_kick > 0 || (ps[p].curr_weapon != HANDREMOTE_WEAPON && ps[p].curr_weapon != HANDBOMB_WEAPON && ps[p].curr_weapon != TRIPBOMB_WEAPON && ps[p].ammo_amount[ps[p].curr_weapon] >= 0))
|
||||
{
|
||||
for (x = 0; x < 8; x++)
|
||||
{
|
||||
auto spawned = CreateActor(actor->sector(), actor->spr.pos.plusZ(-8), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (actor->int_zvel() >> 2), actor, 5);
|
||||
auto a = randomAngle();
|
||||
auto vel = krandf(4) + 4;
|
||||
auto zvel = -krandf(16) - actor->vel.Z * 0.25;
|
||||
|
||||
auto spawned = CreateActor(actor->sector(), actor->spr.pos.plusZ(-8), SCRAP3 + (krand() & 3), -8, 48, 48, a, vel, zvel, actor, 5);
|
||||
spawned->spr.pal = 6;
|
||||
}
|
||||
|
||||
|
@ -2249,7 +2259,11 @@ static void greenslime(DDukeActor *actor)
|
|||
|
||||
for (x = 0; x < 8; x++)
|
||||
{
|
||||
auto spawned = CreateActor(actor->sector(), actor->spr.pos.plusZ(-8), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (actor->int_zvel() >> 2), actor, 5);
|
||||
auto a = randomAngle();
|
||||
auto vel = krandf(4) + 4;
|
||||
auto zvel = -krandf(16) - actor->vel.Z * 0.25;
|
||||
|
||||
auto spawned = CreateActor(actor->sector(), actor->spr.pos.plusZ(-8), SCRAP3 + (krand() & 3), -8, 48, 48, a, vel, zvel, actor, 5);
|
||||
if (spawned) spawned->spr.pal = 6;
|
||||
}
|
||||
actor->temp_data[0] = -3;
|
||||
|
|
|
@ -179,11 +179,11 @@ DAngle furthestangle(DDukeActor* snum, int angDiv);
|
|||
void getglobalz(DDukeActor* s);
|
||||
void OnEvent(int id, int pnum = -1, DDukeActor* snum = nullptr, int dist = -1);
|
||||
|
||||
DDukeActor* CreateActor(sectortype* whatsect, const DVector3& pos, int s_pn, int8_t s_s, int8_t s_xr, int8_t s_yr, int s_a, int s_ve, int s_zv, DDukeActor* s_ow, int8_t s_ss);
|
||||
|
||||
inline DDukeActor* EGS(sectortype* whatsectp, int s_x, int s_y, int s_z, int s_pn, int8_t s_s, int8_t s_xr, int8_t s_yr, int s_a, int s_ve, int s_zv, DDukeActor* s_ow, int8_t s_ss)
|
||||
DDukeActor* CreateActor(sectortype* whatsectp, const DVector3& pos, int s_pn, int8_t s_shd, int8_t s_xr, int8_t s_yr, DAngle s_ang, double s_vel, double s_zvel, DDukeActor* s_ow, int8_t s_stat);
|
||||
[[deprecated]]
|
||||
inline DDukeActor* CreateActor(sectortype* whatsectp, const DVector3& pos, int s_pn, int8_t s_shd, int8_t s_xr, int8_t s_yr, int s_ang, int s_vel, int s_zvel, DDukeActor* s_ow, int8_t s_stat)
|
||||
{
|
||||
return CreateActor(whatsectp, { s_x * inttoworld, s_y * inttoworld, s_z * zinttoworld }, s_pn, s_s, s_xr, s_yr, s_a, s_ve, s_zv, s_ow, s_ss);
|
||||
return CreateActor(whatsectp, pos, s_pn, s_shd, s_xr, s_yr, DAngle::fromBuild(s_ang), s_vel * inttoworld, s_zvel * zinttoworld, s_ow, s_stat);
|
||||
}
|
||||
|
||||
void ceilingglass(DDukeActor* snum, sectortype* sectnum, int cnt);
|
||||
|
|
|
@ -126,7 +126,7 @@ static void shootfireball(DDukeActor *actor, int p, DVector3 pos, DAngle ang)
|
|||
sizy = 7;
|
||||
}
|
||||
|
||||
auto spawned = CreateActor(actor->sector(), pos, FIREBALL, -127, sizx, sizy, ang.Buildang(), vel * worldtoint, zvel * zworldtoint, actor, (short)4);
|
||||
auto spawned = CreateActor(actor->sector(), pos, FIREBALL, -127, sizx, sizy, ang.Buildang(), int(vel * worldtoint), int(zvel * zworldtoint), actor, (short)4);
|
||||
if (spawned)
|
||||
{
|
||||
spawned->spr.extra += (krand() & 7);
|
||||
|
@ -659,7 +659,7 @@ static void shootstuff(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int a
|
|||
|
||||
while (scount > 0)
|
||||
{
|
||||
auto spawned = CreateActor(sect, pos, atwith, -127, sizx, sizy, ang.Buildang(), vel * worldtoint, zvel * zworldtoint, actor, 4);
|
||||
auto spawned = CreateActor(sect, pos, atwith, -127, sizx, sizy, ang.Buildang(), int(vel * worldtoint), int(zvel * zworldtoint), actor, 4);
|
||||
if (!spawned) return;
|
||||
spawned->spr.extra += (krand() & 7);
|
||||
|
||||
|
@ -754,7 +754,7 @@ static void shootrpg(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int atw
|
|||
if (p < 0) aimed = nullptr;
|
||||
|
||||
auto offset = (ang + DAngle1 * 61).ToVector() * (1024 / 448);
|
||||
auto spawned = CreateActor(sect, pos.plusZ(-1) + offset, atwith, 0, 14, 14, ang.Buildang(), vel * worldtoint, zvel * zworldtoint, actor, 4);
|
||||
auto spawned = CreateActor(sect, pos.plusZ(-1) + offset, atwith, 0, 14, 14, ang.Buildang(), int(vel * worldtoint), int(zvel * zworldtoint), actor, 4);
|
||||
|
||||
if (!spawned) return;
|
||||
|
||||
|
@ -1027,7 +1027,7 @@ static void shootmortar(DDukeActor* actor, int p, const DVector3& pos, DAngle an
|
|||
zvel = -4;
|
||||
double vel = x / 16.;
|
||||
|
||||
CreateActor(sect, pos.plusZ(-6) + ang.ToVector() * 4, atwith, -64, 32, 32, ang.Buildang(), vel * worldtoint, zvel * zworldtoint, actor, 1);
|
||||
CreateActor(sect, pos.plusZ(-6) + ang.ToVector() * 4, atwith, -64, 32, 32, ang.Buildang(), int(vel * worldtoint), int(zvel * zworldtoint), actor, 1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -1063,7 +1063,7 @@ static void shootshrinker(DDukeActor* actor, int p, const DVector3& pos, DAngle
|
|||
else zvel = 0;
|
||||
|
||||
auto spawned = CreateActor(actor->sector(),
|
||||
pos.plusZ(2) + ang.ToVector() * 0.25, SHRINKSPARK, -16, 28, 28, ang.Buildang(), 768, zvel * zworldtoint, actor, 4);
|
||||
pos.plusZ(2) + ang.ToVector() * 0.25, SHRINKSPARK, -16, 28, 28, ang.Buildang(), 768, int(zvel * zworldtoint), actor, 4);
|
||||
|
||||
if (spawned)
|
||||
{
|
||||
|
|
|
@ -571,7 +571,7 @@ static void shootstuff(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int a
|
|||
|
||||
while (scount > 0)
|
||||
{
|
||||
auto spawned = CreateActor(sect, pos, atwith, -127, sizx, sizy, ang.Buildang(), vel * worldtoint, zvel * zworldtoint, actor, 4);
|
||||
auto spawned = CreateActor(sect, pos, atwith, -127, sizx, sizy, ang.Buildang(), int(vel * worldtoint), int(zvel * zworldtoint), actor, 4);
|
||||
if (!spawned) return;
|
||||
spawned->spr.extra += (krand() & 7);
|
||||
spawned->spr.cstat = CSTAT_SPRITE_YCENTER;
|
||||
|
@ -671,7 +671,7 @@ static void shootrpg(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int atw
|
|||
}
|
||||
|
||||
auto offset = (ang + DAngle1 * 61).ToVector() * (1024 / 448.);
|
||||
auto spawned = CreateActor(sect, pos.plusZ(-1) + offset, atwith, 0, 14, 14, ang.Buildang(), vel * worldtoint, zvel * zworldtoint, actor, 4);
|
||||
auto spawned = CreateActor(sect, pos.plusZ(-1) + offset, atwith, 0, 14, 14, ang.Buildang(), int(vel * worldtoint), int(zvel * zworldtoint), actor, 4);
|
||||
|
||||
if (!spawned) return;
|
||||
if (isRRRA())
|
||||
|
@ -807,7 +807,7 @@ static void shootwhip(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int at
|
|||
|
||||
while (scount > 0)
|
||||
{
|
||||
auto spawned = CreateActor(sect, pos, atwith, -127, sizx, sizy, ang.Buildang(), vel, zvel, actor, 4);
|
||||
auto spawned = CreateActor(sect, pos, atwith, -127, sizx, sizy, ang, vel, zvel, actor, 4);
|
||||
if (!spawned) return;
|
||||
spawned->spr.extra += (krand() & 7);
|
||||
spawned->spr.cstat = CSTAT_SPRITE_YCENTER;
|
||||
|
@ -845,7 +845,7 @@ static void shootmortar(DDukeActor* actor, int p, const DVector3& pos, DAngle an
|
|||
|
||||
int size = atwith == CHEERBOMB ? 16 : 32;
|
||||
|
||||
CreateActor(sect, pos.plusZ(-6) + ang.ToVector() * 4, atwith, -64, size, size, ang.Buildang(), vel * worldtoint, zvel * zworldtoint, actor, 1);
|
||||
CreateActor(sect, pos.plusZ(-6) + ang.ToVector() * 4, atwith, -64, size, size, ang, vel, zvel, actor, 1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -50,13 +50,13 @@ BEGIN_DUKE_NS
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
DDukeActor* CreateActor(sectortype* whatsectp, const DVector3& pos, int s_pn, int8_t s_s, int8_t s_xr, int8_t s_yr, int s_a, int s_ve, int s_zv, DDukeActor* s_ow, int8_t s_ss)
|
||||
DDukeActor* CreateActor(sectortype* whatsectp, const DVector3& pos, int s_pn, int8_t s_shd, int8_t s_xr, int8_t s_yr, DAngle s_ang, double s_vel, double s_zvel, DDukeActor* s_ow, int8_t s_stat)
|
||||
{
|
||||
// sector pointer must be strictly validated here or the engine will crash.
|
||||
if (whatsectp == nullptr || !validSectorIndex(sectnum(whatsectp))) return nullptr;
|
||||
// spawning out of range sprites will also crash.
|
||||
if (s_pn < 0 || s_pn >= MAXTILES) return nullptr;
|
||||
auto act = static_cast<DDukeActor*>(::InsertActor(RUNTIME_CLASS(DDukeActor), whatsectp, s_ss));
|
||||
auto act = static_cast<DDukeActor*>(::InsertActor(RUNTIME_CLASS(DDukeActor), whatsectp, s_stat));
|
||||
|
||||
if (act == nullptr) return nullptr;
|
||||
SetupGameVarsForActor(act);
|
||||
|
@ -65,14 +65,14 @@ DDukeActor* CreateActor(sectortype* whatsectp, const DVector3& pos, int s_pn, in
|
|||
act->spr.pos = pos;
|
||||
act->spr.cstat = 0;
|
||||
act->spr.picnum = s_pn;
|
||||
act->spr.shade = s_s;
|
||||
act->spr.shade = s_shd;
|
||||
act->spr.xrepeat = s_xr;
|
||||
act->spr.yrepeat = s_yr;
|
||||
act->spr.pal = 0;
|
||||
|
||||
act->set_int_ang(s_a);
|
||||
act->vel.X = (s_ve) * inttoworld;
|
||||
act->vel.Z = (s_zv) * zinttoworld;
|
||||
act->spr.angle = s_ang;
|
||||
act->vel.X = s_vel;
|
||||
act->vel.Z = s_zvel;
|
||||
act->spr.xoffset = 0;
|
||||
act->spr.yoffset = 0;
|
||||
act->spr.yint = 0;
|
||||
|
|
Loading…
Reference in a new issue