diff --git a/source/core/namedef_custom.h b/source/core/namedef_custom.h index eca02e547..f63de12f8 100644 --- a/source/core/namedef_custom.h +++ b/source/core/namedef_custom.h @@ -45,6 +45,7 @@ xx(DukeMoney) xx(DukeMail) xx(DukePaper) xx(RedneckFeather) +xx(DukeSteamBase) xx(spawnstate) xx(brokenstate) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index b6e571447..64b2a58e4 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -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); diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 5d99b0d1c..6ce35f5e5 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -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(); diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 71899b5d1..62562200c 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -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(); diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index 477552251..8d01be3ff 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -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); diff --git a/source/games/duke/src/spawn_d.cpp b/source/games/duke/src/spawn_d.cpp index e1ecc0a11..3e7c371a8 100644 --- a/source/games/duke/src/spawn_d.cpp +++ b/source/games/duke/src/spawn_d.cpp @@ -193,10 +193,6 @@ DDukeActor* spawninit_d(DDukeActor* actj, DDukeActor* act, TArray* act->spr.shade = -127; ChangeActorStat(act, STAT_STANDABLE); break; - - case DTILE_CEILINGSTEAM: - ChangeActorStat(act, STAT_STANDABLE); - break; } return act; } diff --git a/wadsrc/static/filter/dukelike/rmapinfo.spawnclasses b/wadsrc/static/filter/dukelike/rmapinfo.spawnclasses index 2fa7562b9..fb0d5efa3 100644 --- a/wadsrc/static/filter/dukelike/rmapinfo.spawnclasses +++ b/wadsrc/static/filter/dukelike/rmapinfo.spawnclasses @@ -282,6 +282,7 @@ spawnclasses 661 = DukeWaterBubble 2329 = DukeSmallSmoke 1250 = DukeSteam + 1255 = DukeCeilingSteam 1312 = DukeFemale1 1317 = DukeFemale2 1321 = DukeFemale3 diff --git a/wadsrc/static/zscript/games/duke/actors/steam.zs b/wadsrc/static/zscript/games/duke/actors/steam.zs index 3ca3fa108..bd5e0dcc8 100644 --- a/wadsrc/static/zscript/games/duke/actors/steam.zs +++ b/wadsrc/static/zscript/games/duke/actors/steam.zs @@ -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