From 50e79e6f9d3fe62801fc8a057c1e5fdf2344f3d3 Mon Sep 17 00:00:00 2001 From: Colin Miller Date: Fri, 9 May 2025 22:51:52 -0400 Subject: [PATCH 1/3] setup all ::create functions in zNPCTypeDutchman --- src/SB/Game/zNPCTypeDutchman.cpp | 75 +++++++++++++++++++++++++++++--- src/SB/Game/zNPCTypeDutchman.h | 49 +++++++++++++++++++++ 2 files changed, 117 insertions(+), 7 deletions(-) diff --git a/src/SB/Game/zNPCTypeDutchman.cpp b/src/SB/Game/zNPCTypeDutchman.cpp index 4aa5d3e23..b2d97100a 100644 --- a/src/SB/Game/zNPCTypeDutchman.cpp +++ b/src/SB/Game/zNPCTypeDutchman.cpp @@ -352,10 +352,20 @@ void zNPCDutchman::reset_speed() { } -//S32 zNPCGoalDutchmanInitiate::Exit(F32 dt, void* updCtxt) -//{ -// return xGoal::Exit(dt, updCtxt); -//} +xFactoryInst* zNPCGoalDutchmanInitiate::create(S32 who, RyzMemGrow* grow, void* info) +{ + return new (who, grow) zNPCGoalDutchmanInitiate(who, (zNPCDutchman&)*info); +} + +S32 zNPCGoalDutchmanInitiate::Exit(F32 dt, void* updCtxt) +{ +return xGoal::Exit(dt, updCtxt); +} + +xFactoryInst* zNPCGoalDutchmanIdle::create(S32 who, RyzMemGrow* grow, void* info) +{ + return new (who, grow) zNPCGoalDutchmanIdle(who, (zNPCDutchman&)*info); +} S32 zNPCGoalDutchmanIdle::Enter(F32 dt, void* updCtxt) { @@ -396,27 +406,52 @@ S32 zNPCGoalDutchmanDisappear::Exit(F32 dt, void* updCtxt) return xGoal::Exit(dt, updCtxt); } +xFactoryInst* zNPCGoalDutchmanDamage::create(S32 who, RyzMemGrow* grow, void* info) +{ + return new (who, grow) zNPCGoalDutchmanDamage(who, (zNPCDutchman&)*info); +} + S32 zNPCGoalDutchmanDamage::Exit(F32 dt, void* updCtxt) { return xGoal::Exit(dt, updCtxt); } +xFactoryInst* zNPCGoalDutchmanTeleport::create(S32 who, RyzMemGrow* grow, void* info) +{ + return new (who, grow) zNPCGoalDutchmanTeleport(who, (zNPCDutchman&)*info); +} + S32 zNPCGoalDutchmanTeleport::Exit(F32 dt, void* updCtxt) { return xGoal::Exit(dt, updCtxt); } +xFactoryInst* zNPCGoalDutchmanReappear::create(S32 who, RyzMemGrow* grow, void* info) +{ + return new (who, grow) zNPCGoalDutchmanReappear(who, (zNPCDutchman&)*info); +} + S32 zNPCGoalDutchmanReappear::Exit(F32 dt, void* updCtxt) { owner.reset_speed(); return xGoal::Exit(dt, updCtxt); } +xFactoryInst* zNPCGoalDutchmanBeam::create(S32 who, RyzMemGrow* grow, void* info) +{ + return new (who, grow) zNPCGoalDutchmanBeam(who, (zNPCDutchman&)*info); +} + S32 zNPCGoalDutchmanBeam::Exit(F32 dt, void* updCtxt) { return xGoal::Exit(dt, updCtxt); } +xFactoryInst* zNPCGoalDutchmanFlame::create(S32 who, RyzMemGrow* grow, void* info) +{ + return new (who, grow) zNPCGoalDutchmanFlame(who, (zNPCDutchman&)*info); +} + S32 zNPCGoalDutchmanFlame::Enter(F32 dt, void* updCtxt) { owner.reset_lasso_anim(); @@ -439,6 +474,29 @@ S32 zNPCGoalDutchmanFlame::Exit(F32 dt, void* updCtxt) return xGoal::Exit(dt, updCtxt); } +xFactoryInst* zNPCGoalDutchmanPostFlame::create(S32 who, RyzMemGrow* grow, void* info) +{ + return new (who, grow) zNPCGoalDutchmanPostFlame(who, (zNPCDutchman&)*info); +} + + +S32 zNPCGoalDutchmanPostFlame::Exit(F32 dt, void* updCtxt) +{ + owner.flag.hurting = 0; + return xGoal::Exit(dt, updCtxt); +} + +xFactoryInst* zNPCGoalDutchmanCaught::create(S32 who, RyzMemGrow* grow, void* info) +{ + return new (who, grow) zNPCGoalDutchmanCaught(who, (zNPCDutchman&)*info); +} + +S32 zNPCGoalDutchmanCaught::Enter(float dt, void* updCtxt) +{ + // To-Do + return zNPCGoalCommon::Enter(dt, updCtxt); +} + S32 zNPCGoalDutchmanCaught::Exit(F32 dt, void* updCtxt) { return xGoal::Exit(dt, updCtxt); @@ -452,12 +510,15 @@ S32 zNPCGoalDutchmanDeath::Enter(F32 dt, void* updCtxt) S32 zNPCGoalDutchmanDeath::Exit(F32 dt, void* updCtxt) { - // Not sure how this is supposed to be called? - // dwarf dats shows: xVec3& up = dt; - owner.move.dest.assign(dt, 0.0f, 1.0f); + owner.move.dest.assign(dt, 1.0f, 0.0f); return xGoal::Exit(dt, updCtxt); } +xFactoryInst* zNPCGoalDutchmanDeath::create(S32 who, RyzMemGrow* grow, void* info) +{ + return new (who, grow) zNPCGoalDutchmanDeath(who, (zNPCDutchman&)*info); +} + S32 zNPCGoalDutchmanDeath::Process(en_trantype* trantype, F32 dt, void* updCtxt, xScene* xscn) { if (owner.delay >= 2.0f) diff --git a/src/SB/Game/zNPCTypeDutchman.h b/src/SB/Game/zNPCTypeDutchman.h index 1c1f42f59..697c0d75e 100644 --- a/src/SB/Game/zNPCTypeDutchman.h +++ b/src/SB/Game/zNPCTypeDutchman.h @@ -187,6 +187,11 @@ struct zNPCGoalDutchmanNil : zNPCGoalCommon struct zNPCGoalDutchmanInitiate : zNPCGoalCommon { zNPCDutchman& owner; + + zNPCGoalDutchmanInitiate(S32 goalID, zNPCDutchman& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + S32 Exit(float, void*); static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); @@ -195,6 +200,11 @@ struct zNPCGoalDutchmanInitiate : zNPCGoalCommon struct zNPCGoalDutchmanIdle : zNPCGoalCommon { zNPCDutchman& owner; + + zNPCGoalDutchmanIdle(S32 goalID, zNPCDutchman& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + S32 Enter(float, void*); S32 Exit(float, void*); S32 Process(en_trantype*, float, void*, xScene*); @@ -217,6 +227,11 @@ struct zNPCGoalDutchmanDisappear : zNPCGoalCommon struct zNPCGoalDutchmanTeleport : zNPCGoalCommon { zNPCDutchman& owner; + + zNPCGoalDutchmanTeleport(S32 goalID, zNPCDutchman& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + S32 Exit(float, void*); static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); @@ -225,6 +240,11 @@ struct zNPCGoalDutchmanTeleport : zNPCGoalCommon struct zNPCGoalDutchmanReappear : zNPCGoalCommon { zNPCDutchman& owner; + + zNPCGoalDutchmanReappear(S32 goalID, zNPCDutchman& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + S32 Exit(float, void*); void reset_speed(); @@ -259,6 +279,11 @@ struct zNPCGoalDutchmanBeam : zNPCGoalCommon S32 shots; beam_data beam[2]; zNPCDutchman& owner; + + zNPCGoalDutchmanBeam(S32 goalID, zNPCDutchman& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + S32 Exit(float, void*); static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); }; @@ -277,6 +302,11 @@ struct zNPCGoalDutchmanFlame : zNPCGoalCommon xVec2 move_dir; U8 stopped; zNPCDutchman& owner; + + zNPCGoalDutchmanFlame(S32 goalID, zNPCDutchman& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + S32 Enter(float, void*); S32 Exit(float, void*); @@ -287,13 +317,24 @@ struct zNPCGoalDutchmanPostFlame : zNPCGoalCommon { zNPCDutchman& owner; + zNPCGoalDutchmanPostFlame(S32 goalID, zNPCDutchman& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); + S32 Exit(F32 dt, void* updCtxt); }; struct zNPCGoalDutchmanCaught : zNPCGoalCommon { U8 grabbed; zNPCDutchman& owner; + + zNPCGoalDutchmanCaught(S32 goalID, zNPCDutchman& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + + S32 Enter(float, void*); S32 Exit(float, void*); static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); @@ -304,6 +345,10 @@ struct zNPCGoalDutchmanDamage : zNPCGoalCommon U8 moving; zNPCDutchman& owner; + zNPCGoalDutchmanDamage(S32 goalID, zNPCDutchman& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); S32 Exit(F32 dt, void* updCtxt); }; @@ -324,6 +369,10 @@ struct zNPCGoalDutchmanDeath : zNPCGoalCommon SS_DONE }; + zNPCGoalDutchmanDeath(S32 goalID, zNPCDutchman& npc) : zNPCGoalCommon(goalID), owner(npc) + { + } + substate_enum substate; F32 emit_frac; F32 min_y; From 85346752964adeeb10be5044fb068497421b4f6c Mon Sep 17 00:00:00 2001 From: Colin Miller Date: Fri, 9 May 2025 23:00:06 -0400 Subject: [PATCH 2/3] formatting fix --- src/SB/Game/zNPCTypeDutchman.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SB/Game/zNPCTypeDutchman.cpp b/src/SB/Game/zNPCTypeDutchman.cpp index b2d97100a..d8ebfb0b4 100644 --- a/src/SB/Game/zNPCTypeDutchman.cpp +++ b/src/SB/Game/zNPCTypeDutchman.cpp @@ -359,7 +359,7 @@ xFactoryInst* zNPCGoalDutchmanInitiate::create(S32 who, RyzMemGrow* grow, void* S32 zNPCGoalDutchmanInitiate::Exit(F32 dt, void* updCtxt) { -return xGoal::Exit(dt, updCtxt); + return xGoal::Exit(dt, updCtxt); } xFactoryInst* zNPCGoalDutchmanIdle::create(S32 who, RyzMemGrow* grow, void* info) From d22e76cbc702123d8013c934f0fd6a6a96c5487e Mon Sep 17 00:00:00 2001 From: Colin Miller Date: Fri, 9 May 2025 23:03:18 -0400 Subject: [PATCH 3/3] todo format fix --- src/SB/Game/zNPCTypeDutchman.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SB/Game/zNPCTypeDutchman.cpp b/src/SB/Game/zNPCTypeDutchman.cpp index d8ebfb0b4..e1fedb7b9 100644 --- a/src/SB/Game/zNPCTypeDutchman.cpp +++ b/src/SB/Game/zNPCTypeDutchman.cpp @@ -493,7 +493,7 @@ xFactoryInst* zNPCGoalDutchmanCaught::create(S32 who, RyzMemGrow* grow, void* in S32 zNPCGoalDutchmanCaught::Enter(float dt, void* updCtxt) { - // To-Do + // TODO return zNPCGoalCommon::Enter(dt, updCtxt); }