diff --git a/source/core/namedef_custom.h b/source/core/namedef_custom.h index 966b967a3..6f96046e5 100644 --- a/source/core/namedef_custom.h +++ b/source/core/namedef_custom.h @@ -25,6 +25,7 @@ xx(DukeGlassPieces1) xx(DukeGlassPieces2) xx(DukeNaturalLightning) xx(RedneckBowlingPin) +xx(DukeReactor) xx(spawnstate) xx(brokenstate) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 21033ed98..32a5fa1a0 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -1841,7 +1841,7 @@ void handle_se15(DDukeActor* actor) // //--------------------------------------------------------------------------- -void handle_se16(DDukeActor* actor, int REACTOR, int REACTOR2) +void handle_se16(DDukeActor* actor) { auto sc = actor->sector(); @@ -1860,7 +1860,7 @@ void handle_se16(DDukeActor* actor, int REACTOR, int REACTOR2) DDukeActor* a2; while ((a2 = it.Next())) { - if (a2->spr.picnum == REACTOR || a2->spr.picnum == REACTOR2) + if (a2->IsKindOf(NAME_DukeReactor) && a2->spritesetindex == 0) return; } if (a2 == nullptr) diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 7d1c93eae..3d1194493 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -1540,7 +1540,7 @@ void moveeffectors_d(void) //STATNUM 3 break; case SE_16_REACTOR: - handle_se16(act, REACTOR, REACTOR2); + handle_se16(act); break; case SE_17_WARP_ELEVATOR: diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 8afa7af7d..8f15df38a 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -1460,7 +1460,7 @@ void moveeffectors_r(void) //STATNUM 3 break; case SE_16_REACTOR: - handle_se16(act, REACTOR, REACTOR2); + handle_se16(act); break; case SE_17_WARP_ELEVATOR: diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index 9c6bb85c2..7822fe6da 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -127,6 +127,7 @@ bool CallAnimate(DDukeActor* actor, tspritetype* hitter); bool CallShootThis(DDukeActor* clsdef, DDukeActor* actor, int pn, const DVector3& spos, DAngle sang); void CallStaticSetup(DDukeActor* actor); void CallPlayFTASound(DDukeActor* actor); +void CallStandingOn(DDukeActor* actor, player_struct* p); END_DUKE_NS diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index 2e55abf2e..dd2c37ef9 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -59,7 +59,7 @@ void handle_se11(DDukeActor* i); void handle_se12(DDukeActor* i, int planeonly = 0); void handle_se13(DDukeActor* i); void handle_se15(DDukeActor* i); -void handle_se16(DDukeActor* i, int REACTOR, int REACTOR2); +void handle_se16(DDukeActor* i); void handle_se17(DDukeActor* i); void handle_se18(DDukeActor* i, bool morecheck); void handle_se19(DDukeActor* i, int BIGFORCE); diff --git a/source/games/duke/src/game.cpp b/source/games/duke/src/game.cpp index 6b16cb1f5..4a0297968 100644 --- a/source/games/duke/src/game.cpp +++ b/source/games/duke/src/game.cpp @@ -528,5 +528,14 @@ void CallPlayFTASound(DDukeActor* actor) } } +void CallStandingOn(DDukeActor* actor, player_struct* p) +{ + IFVIRTUALPTR(actor, DDukeActor, StandingOn) + { + VMValue val[] = { actor, p }; + VMCall(func, val, 2, nullptr, 0); + } +} + END_DUKE_NS diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 28088c778..1ed4c6d70 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -2759,6 +2759,7 @@ void processinput_d(int snum) auto ang = (clz.actor()->spr.pos.XY() - p->GetActor()->spr.pos.XY()).Angle(); p->vel.XY() -= ang.ToVector(); } + CallStandingOn(clz.actor(), p); } diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 87b96cd41..2cf7fb400 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -684,13 +684,13 @@ static void shootwhip(DDukeActor* actor, int p, DVector3 pos, DAngle ang, int at if (actor->spr.extra >= 0) actor->spr.shade = -96; scount = 1; - if (atwith == 3471) + if (atwith == OWHIP) { vel = 300/16.; pos.Z -= 15; scount = 1; } - else if (atwith == 3475) + else if (atwith == UWHIP) { vel = 300/16; pos.Z += 4; @@ -3361,12 +3361,13 @@ void processinput_r(int snum) { if ((actions & SB_CROUCH) && !p->OnMotorcycle) //if (Sound[436].num == 0) - { - S_PlayActorSound(436, pact); - p->last_pissed_time = 4000; - p->eat = 0; - } + { + S_PlayActorSound(436, pact); + p->last_pissed_time = 4000; + p->eat = 0; + } } + else CallStandingOn(clz.actor(), p); } diff --git a/wadsrc/static/zscript/games/duke/dukeactor.zs b/wadsrc/static/zscript/games/duke/dukeactor.zs index 65779870b..f8257708f 100644 --- a/wadsrc/static/zscript/games/duke/dukeactor.zs +++ b/wadsrc/static/zscript/games/duke/dukeactor.zs @@ -196,6 +196,7 @@ class DukeActor : CoreActor native virtual bool animate(tspritetype tspr) { return false; } virtual void RunState() {} // this is the CON function. virtual void PlayFTASound() {} + virtual void StandingOn(DukePlayer p) {} virtual bool shootthis(DukeActor actor, DukePlayer p, Vector3 pos, double ang) const // this gets called on the defaults. { return false;