From f50bd4881a34a2ba26da0d4f05ac7e0b05fa8004 Mon Sep 17 00:00:00 2001 From: Livewire Date: Tue, 18 Mar 2025 00:06:10 -0400 Subject: [PATCH] self setup and others --- src/SB/Game/zNPCTypeKingJelly.cpp | 88 +++++++++++++++++++++++++++++++ src/SB/Game/zNPCTypeKingJelly.h | 26 ++++++--- 2 files changed, 108 insertions(+), 6 deletions(-) diff --git a/src/SB/Game/zNPCTypeKingJelly.cpp b/src/SB/Game/zNPCTypeKingJelly.cpp index 6b95c0b11..79eddbd40 100644 --- a/src/SB/Game/zNPCTypeKingJelly.cpp +++ b/src/SB/Game/zNPCTypeKingJelly.cpp @@ -11,6 +11,11 @@ namespace void lightning_ring::create() { + // store 1 into 0x0 + active = 1; + arcs_size = 0; + + //store 0 into 0x7c } xVec3* zNPCKingJelly::get_bottom() @@ -46,6 +51,57 @@ void zNPCKingJelly::BUpdate(xVec3* pos) zNPCCommon::BUpdate(pos); } +void zNPCKingJelly::SelfSetup() +{ + xBehaveMgr* bmgr; + xPsyche* psy; + + bmgr = xBehaveMgr_GetSelf(); + psy_instinct = bmgr->Subscribe(this, 0); + psy = psy_instinct; + psy->BrainBegin(); + psy->AddGoal(NPC_GOAL_KJIDLE, NULL); + psy->AddGoal(NPC_GOAL_KJBORED, NULL); + psy->AddGoal(NPC_GOAL_KJSPAWNKIDS, NULL); + psy->AddGoal(NPC_GOAL_KJTAUNT, NULL); + psy->AddGoal(NPC_GOAL_KJSHOCKGROUND, NULL); + psy->AddGoal(NPC_GOAL_KJDAMAGE, NULL); + psy->AddGoal(NPC_GOAL_KJDEATH, NULL); + psy->AddGoal(NPC_GOAL_LIMBO, NULL); + psy->BrainEnd(); + psy->SetSafety(NPC_GOAL_KJIDLE); +} + +void zNPCKingJelly::init_child(zNPCKingJelly::child_data& child, zNPCCommon& npc, int wave) +{ + child.npc = &npc; + child.wave = wave; + child.active = 1; + child.callback.eventFunc = npc.eventFunc; + child.callback.update = npc.update; + child.callback.bupdate = npc.bupdate; + child.callback.move = npc.move; + child.callback.render = npc.render; + child.callback.transl = npc.transl; +} + +void zNPCKingJelly::disable_child(zNPCKingJelly::child_data& child) +{ + if (child.active) + { + ((zNPCJelly*)child.npc)->JellyKill(); + child.active = false; + } +} + +void zNPCKingJelly::enable_child(zNPCKingJelly::child_data& child) +{ + if (child.active == false) + { + child.active = true; + } +} + // probably how many times the jellyfish can hit the player for that round // whatever round it is, add one. // Round = 0, max strikes = 1 @@ -144,6 +200,16 @@ void zNPCKingJelly::load_curtain_model() { } +// void zNPCKingJelly::reset_curtain() +// { +// // f0 = data shit +// // r4 = 0x10b0 +// // 0x24 = f0 +// // r3 = 0x10a8 +// // 0x24 = f0 // 0x24 model??? + +// } + S32 zNPCGoalKJDamage::Process(en_trantype* trantype, F32 dt, void* updCtxt, xScene* xscn) { // TODO @@ -167,3 +233,25 @@ S32 zNPCGoalKJDamage::Exit(F32 dt, void* updCtxt) return xGoal::Exit(dt, updCtxt); } + +void zNPCKingJelly::update_round() +{ +} + +S32 zNPCGoalKJDeath::Enter(float dt, void* updCtxt) +{ + zNPCKingJelly& kj = *(zNPCKingJelly*)this->psyche->clt_owner; + kj.decompose(); + kj.post_decompose(); + zNPCGoalCommon::Enter(dt, updCtxt); +} + +S32 zNPCGoalKJDeath::Exit(float dt, void* updCtxt) +{ + xGoal::Exit(dt, updCtxt); +} + +S32 zNPCGoalKJDeath::Process(en_trantype* trantype, float dt, void* updCtxt, xScene* xscn) +{ + xGoal::Process(trantype, dt, updCtxt, xscn); +} diff --git a/src/SB/Game/zNPCTypeKingJelly.h b/src/SB/Game/zNPCTypeKingJelly.h index 70ba294ad..341078dce 100644 --- a/src/SB/Game/zNPCTypeKingJelly.h +++ b/src/SB/Game/zNPCTypeKingJelly.h @@ -3,7 +3,11 @@ #include "zNPCTypeSubBoss.h" #include "zNPCGoalCommon.h" +#include "zNPCGoals.h" #include "xEnt.h" +#include "containers.h" +#include "xBehaviour.h" +#include "zNPCTypeAmbient.h" struct lightning_ring { @@ -13,7 +17,7 @@ struct lightning_ring F32 min_height; F32 max_height; F32 min_radius; - F32 max_radius; + F32 max_radius; //0x20? F32 delay; F32 accel; F32 max_vel; @@ -24,7 +28,7 @@ struct lightning_ring F32 radius; F32 vel; F32 accel; - F32 time; + F32 time; //0x44?? } current; struct { @@ -32,10 +36,10 @@ struct lightning_ring F32 thickness; iColor_tag color; F32 rot_radius; - F32 degrees; + F32 degrees; //0x58? } property; zLightning* arcs[8]; - U32 arcs_size; + U32 arcs_size; //0x7c void (*update_callback)(lightning_ring&, F32); void create(); @@ -56,11 +60,11 @@ struct zNPCKingJelly : zNPCSubBoss struct child_data { zNPCCommon* npc; - U8 wave; + U8 wave; //0x5 U8 active; struct { - S32 (*eventFunc)(xBase*, xBase*, U32, F32*, xBase*); + xBaseEventCB eventFunc; void (*update)(xEnt*, xScene*, F32); void (*bupdate)(xEnt*, xVec3*); void (*move)(xEnt*, xScene*, F32, xEntFrame*); @@ -131,9 +135,14 @@ struct zNPCKingJelly : zNPCSubBoss void Setup(); void Destroy(); void BUpdate(xVec3*); + void SelfSetup(); + void init_child(zNPCKingJelly::child_data&, zNPCCommon&, int); + void disable_child(zNPCKingJelly::child_data&); + void enable_child(zNPCKingJelly::child_data& child); S32 max_strikes(); void load_model(); void load_curtain_model(); + void reset_curtain(); void decompose(); void post_decompose(); void vanish(); @@ -143,6 +152,8 @@ struct zNPCKingJelly : zNPCSubBoss void on_change_fade_obstructions(const tweak_info&); void render_debug(); void create_tentacle_lightning(); + void refresh_tentacle_points(); + void refresh_tentacle_points(S32); void generate_spawn_particles(); void update_round(); }; @@ -207,6 +218,9 @@ struct zNPCGoalKJDamage : zNPCGoalCommon struct zNPCGoalKJDeath : zNPCGoalCommon { + S32 Enter(float dt, void* updCtxt); + S32 Exit(float dt, void* updCtxt); + S32 Process(en_trantype* trantype, float dt, void* updCtxt, xScene* xscn); zNPCGoalKJDeath(S32 goalID) : zNPCGoalCommon(goalID) { }