- exported ceilingsteam and consolidated movefallers functions.

This commit is contained in:
Christoph Oelckers 2022-12-14 17:12:36 +01:00
parent 82d04756be
commit ef6a8c010a
8 changed files with 117 additions and 195 deletions

View file

@ -45,6 +45,7 @@ xx(DukeMoney)
xx(DukeMail)
xx(DukePaper)
xx(RedneckFeather)
xx(DukeSteamBase)
xx(spawnstate)
xx(brokenstate)

View file

@ -569,6 +569,101 @@ void moveplayers(void)
//
//---------------------------------------------------------------------------
void movefallers(void)
{
DukeStatIterator iti(STAT_FALLER);
while (auto act = iti.Next())
{
auto sectp = act->sector();
if (act->temp_data[0] == 0)
{
act->spr.pos.Z -= 16;
DAngle saved_angle = act->spr.Angles.Yaw;
int x = act->spr.extra;
int j = fi.ifhitbyweapon(act);
if (j >= 0)
{
if (gs.actorinfo[j].flags2 & SFLAG2_EXPLOSIVE)
{
if (act->spr.extra <= 0)
{
act->temp_data[0] = 1;
DukeStatIterator itj(STAT_FALLER);
while (auto a2 = itj.Next())
{
if (a2->spr.hitag == act->spr.hitag)
{
a2->temp_data[0] = 1;
a2->spr.cstat &= ~CSTAT_SPRITE_ONE_SIDE;
if (a2->IsKindOf(NAME_DukeSteamBase))
a2->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
}
}
}
}
else
{
act->hitextra = 0;
act->spr.extra = x;
}
}
act->spr.Angles.Yaw = saved_angle;
act->spr.pos.Z += 16;
}
else if (act->temp_data[0] == 1)
{
if (act->spr.lotag > 0)
{
act->spr.lotag -= 3;
if (act->spr.lotag <= 0 || isRR())
{
act->vel.X = 2 + krandf(4);
act->vel.Z = -4 + krandf(4);
}
}
else
{
if (act->vel.X > 0)
{
act->vel.X -= 0.5;
ssp(act, CLIPMASK0);
}
double grav;
if (floorspace(act->sector())) grav = 0;
else
{
if (ceilingspace(act->sector()))
grav = gs.gravity / 6;
else
grav = gs.gravity;
}
if (act->spr.pos.Z < sectp->floorz - 1)
{
act->vel.Z += grav;
if (act->vel.Z > 24)
act->vel.Z = 24;
act->spr.pos.Z += act->vel.Z;
}
if ((sectp->floorz - act->spr.pos.Z) < 16)
{
int j = 1 + (krand() & 7);
for (int x = 0; x < j; x++) RANDOMSCRAP(act);
act->Destroy();
}
}
}
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void tickstat(int stat, bool deleteinvalid)
{
DukeStatIterator iti(stat);

View file

@ -526,103 +526,6 @@ int ifhitbyweapon_d(DDukeActor *actor)
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void movefallers_d(void)
{
int j;
DukeStatIterator iti(STAT_FALLER);
while (auto act = iti.Next())
{
auto sectp = act->sector();
if (act->temp_data[0] == 0)
{
act->spr.pos.Z -= 16;
DAngle saved_angle = act->spr.Angles.Yaw;
int x = act->spr.extra;
j = fi.ifhitbyweapon(act);
if (j >= 0)
{
if (gs.actorinfo[j].flags2 & SFLAG2_EXPLOSIVE)
{
if (act->spr.extra <= 0)
{
act->temp_data[0] = 1;
DukeStatIterator itj(STAT_FALLER);
while (auto a2 = itj.Next())
{
if (a2->spr.hitag == act->spr.hitag)
{
a2->temp_data[0] = 1;
a2->spr.cstat &= ~CSTAT_SPRITE_ONE_SIDE;
if (a2->spr.picnum == DTILE_CEILINGSTEAM || a2->spr.picnum == DTILE_STEAM)
a2->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
}
}
}
}
else
{
act->hitextra = 0;
act->spr.extra = x;
}
}
act->spr.Angles.Yaw = saved_angle;
act->spr.pos.Z += 16;
}
else if (act->temp_data[0] == 1)
{
if (act->spr.lotag > 0)
{
act->spr.lotag-=3;
if (act->spr.lotag <= 0)
{
act->vel.X = 2 + krandf(4);
act->vel.Z = -4 + krandf(4);
}
}
else
{
if (act->vel.X > 0)
{
act->vel.X -= 0.5;
ssp(act, CLIPMASK0);
}
double grav;
if (floorspace(act->sector())) grav = 0;
else
{
if (ceilingspace(act->sector()))
grav = gs.gravity / 6;
else
grav = gs.gravity;
}
if (act->spr.pos.Z < sectp->floorz - 1)
{
act->vel.Z += grav;
if (act->vel.Z > 24)
act->vel.Z = 24;
act->spr.pos.Z += act->vel.Z;
}
if ((sectp->floorz - act->spr.pos.Z) < 16)
{
j = 1 + (krand() & 7);
for (int x = 0; x < j; x++) RANDOMSCRAP(act);
act->Destroy();
}
}
}
}
}
//---------------------------------------------------------------------------
//
@ -1470,7 +1373,7 @@ void think_d(void)
movefta(); //ST 2
tickstat(STAT_PROJECTILE); //ST 4
moveplayers(); //ST 10
movefallers_d(); //ST 12
movefallers(); //ST 12
tickstat(STAT_MISC, true); //ST 5
actortime.Reset();

View file

@ -442,98 +442,6 @@ int ifhitbyweapon_r(DDukeActor *actor)
//
//---------------------------------------------------------------------------
void movefallers_r(void)
{
DukeStatIterator it(STAT_FALLER);
while (auto act = it.Next())
{
auto sectp = act->sector();
if (act->temp_data[0] == 0)
{
act->spr.pos.Z -= 16;
DAngle saved_angle = act->spr.Angles.Yaw;
int x = act->spr.extra;
int j = fi.ifhitbyweapon(act);
if (j >= 0)
{
if (gs.actorinfo[j].flags2 & SFLAG2_EXPLOSIVE)
{
if (act->spr.extra <= 0)
{
act->temp_data[0] = 1;
DukeStatIterator itr(STAT_FALLER);
while (auto ac2 = itr.Next())
{
if (ac2->spr.hitag == act->spr.hitag)
{
ac2->temp_data[0] = 1;
ac2->spr.cstat &= ~CSTAT_SPRITE_ONE_SIDE;
if (ac2->spr.picnum == RTILE_CEILINGSTEAM || ac2->spr.picnum == RTILE_STEAM)
ac2->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
}
}
}
}
else
{
act->hitextra = 0;
act->spr.extra = x;
}
}
act->spr.Angles.Yaw = saved_angle;
act->spr.pos.Z += 16;
}
else if (act->temp_data[0] == 1)
{
if (act->spr.lotag > 0)
{
act->spr.lotag -= 3;
act->vel.X = 4 + krandf(8);
act->vel.Z = -4 + krandf(4);
}
else
{
if (act->vel.X > 0)
{
act->vel.X -= 1/8.;
ssp(act, CLIPMASK0);
}
double grav;
if (floorspace(act->sector())) grav = 0;
else
{
if (ceilingspace(act->sector()))
grav = gs.gravity / 6;
else
grav = gs.gravity;
}
if (act->spr.pos.Z < sectp->floorz - 1)
{
act->vel.Z += grav;
if (act->vel.Z > 24)
act->vel.Z = 24;
act->spr.pos.Z += act->vel.Z;
}
if ((sectp->floorz - act->spr.pos.Z) < 16)
{
int j = 1 + (krand() & 7);
for (int x = 0; x < j; x++) RANDOMSCRAP(act);
act->Destroy();
}
}
}
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void movetransports_r(void)
{
uint8_t warpdir = 0, warpspriteto;
@ -1829,7 +1737,7 @@ void think_r(void)
movefta(); //ST 2
tickstat(STAT_PROJECTILE);
moveplayers(); //ST 10
movefallers_r(); //ST 12
movefallers(); //ST 12
tickstat(STAT_MISC, true);
actortime.Reset();

View file

@ -30,6 +30,7 @@ void movecyclers(void);
void movedummyplayers(void);
void resetlanepics(void);
void moveplayers();
void movefallers();
void doanimations();
void tickstat(int stat, bool deleteinvalid = false);
void operaterespawns(int low);

View file

@ -193,10 +193,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray<DDukeActor*>*
act->spr.shade = -127;
ChangeActorStat(act, STAT_STANDABLE);
break;
case DTILE_CEILINGSTEAM:
ChangeActorStat(act, STAT_STANDABLE);
break;
}
return act;
}

View file

@ -282,6 +282,7 @@ spawnclasses
661 = DukeWaterBubble
2329 = DukeSmallSmoke
1250 = DukeSteam
1255 = DukeCeilingSteam
1312 = DukeFemale1
1317 = DukeFemale2
1321 = DukeFemale3

View file

@ -1,3 +1,20 @@
class DukeSteamBase : DukeActor // we need this for in-game checking and the shared CON code.
{
default
{
statnum STAT_STANDABLE;
}
}
class DukeCeilingSteam : DukeSteamBase
{
default
{
pic "CEILINGSTEAM";
}
}
class DukeSteam : DukeActor
{
default