From f50bd4881a34a2ba26da0d4f05ac7e0b05fa8004 Mon Sep 17 00:00:00 2001 From: Livewire Date: Tue, 18 Mar 2025 00:06:10 -0400 Subject: [PATCH 01/11] 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) { } From 935bf498a44a0770ec91414b4055d0d1aa33f712 Mon Sep 17 00:00:00 2001 From: Livewire Date: Tue, 18 Mar 2025 23:46:55 -0400 Subject: [PATCH 02/11] zNPC_AnimTable_KingJelly --- src/SB/Game/zNPCTypeKingJelly.cpp | 132 ++++++++++++++++++++++++++++++ src/SB/Game/zNPCTypeKingJelly.h | 4 + src/SB/Game/zNPCTypeSubBoss.cpp | 6 +- src/SB/Game/zNPCTypeSubBoss.h | 4 + 4 files changed, 145 insertions(+), 1 deletion(-) diff --git a/src/SB/Game/zNPCTypeKingJelly.cpp b/src/SB/Game/zNPCTypeKingJelly.cpp index 79eddbd40..6b945fa95 100644 --- a/src/SB/Game/zNPCTypeKingJelly.cpp +++ b/src/SB/Game/zNPCTypeKingJelly.cpp @@ -1,6 +1,45 @@ #include "zNPCTypeKingJelly.h" #include +#include "string.h" + +#define f1868 1.0f +#define f1869 0.0f +#define f2105 0.2f +#define f2106 0.1f + +#define ANIM_Unknown 0 // 0x0 +#define ANIM_Idle01 1 // 0x04 +#define ANIM_Idle02 2 // 0x08 animetable new state +#define ANIM_Idle03 3 // 0xC +#define ANIM_Fidget01 4 // +#define ANIM_Fidget02 5 +#define ANIM_Fidget03 6 +#define ANIM_Taunt01 7 // 0x1c +#define ANIM_Attack01 8 //0x20 DEPRACATED +#define ANIM_Damage01 9 //0x24 +#define ANIM_Damage02 10 //0x28 +#define ANIM_Death01 11 //0x2c +#define ANIM_AttackWindup01 12 //0x30 +#define ANIM_AttackLoop01 13 //0x34 +#define ANIM_AttackEnd01 14 //0x38 +#define ANIM_SpawnKids01 15 //0x3C +#define ANIM_Attack02Windup01 16 +#define ANIM_Attack02Loop01 17 +#define ANIM_Attack02End01 18 +#define ANIM_LassoGrab01 19 + +// #define ANIM_Idle01 1 +// #define ANIM_Idle02 2 +// #define ANIM_Idle03 3 +// #define ANIM_Taunt01 7 +// #define ANIM_Attack01 8 +// #define ANIM_AttackWindup01 12 +// #define ANIM_AttackLoop01 13 +// #define ANIM_AttackEnd01 14 +// #define ANIM_Damage01 9 +// #define ANIM_SpawnKids01 15 +// #define ANIM_Unknown 0 namespace { @@ -18,6 +57,99 @@ void lightning_ring::create() //store 0 into 0x7c } +void foo() +{ + xAnimTable* foo = xAnimTableNew("FOO", 0, 0); +} + +xAnimTable* ZNPC_AnimTable_KingJelly() +{ + // clang-format off + S32 ourAnims[11] = { + ANIM_Idle01, + ANIM_Idle02, + ANIM_Idle03, + ANIM_Taunt01, + ANIM_Attack01, + ANIM_AttackWindup01, // replace with king jelly anims + ANIM_AttackLoop01, + ANIM_AttackEnd01, + ANIM_Damage01, + ANIM_SpawnKids01, + ANIM_Unknown, + + }; + // clang-format on + + xAnimTable* table = xAnimTableNew("zNPCKingJelly", NULL, 0); + + xAnimTableNewState(table, g_strz_subbanim[ANIM_Idle01], 0x10, 0, f1868, NULL, NULL, f1869, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_Idle02], 0x20, 0, f1868, NULL, NULL, f1869, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_Idle03], 0x20, 0, f1868, NULL, NULL, f1869, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_Taunt01], 0x20, 0, f1868, NULL, NULL, f1869, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_Attack01], 0x10, 0, f1868, NULL, NULL, f1869, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_AttackWindup01], 0x20, 0, f1868, NULL, NULL, + f1869, NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_AttackLoop01], 0x10, 0, f1868, NULL, NULL, f1869, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_AttackEnd01], 0x20, 0, f1868, NULL, NULL, f1869, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_Damage01], 0x20, 0, f1868, NULL, NULL, f1869, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_SpawnKids01], 0x10, 0, f1868, NULL, NULL, f1869, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + + NPCC_BuildStandardAnimTran(table, g_strz_subbanim, ourAnims, 1, f2105); + + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_AttackWindup01], + g_strz_subbanim[ANIM_Attack01], 0, 0, 0x10, 0, 0, 0, 0, 0, f2106, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_AttackLoop01], + g_strz_subbanim[ANIM_Attack01], 0, 0, 0, 0, 0, 0, 0, 0, f2106, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_Attack01], + g_strz_subbanim[ANIM_AttackLoop01], 0, 0, 0, 0, 0, 0, 0, 0, f2106, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_AttackLoop01], + g_strz_subbanim[ANIM_AttackEnd01], 0, 0, 0, 0, 0, 0, 0, 0, f2106, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_Idle02], g_strz_subbanim[ANIM_Damage01], 0, + 0, 0, 0, 0, 0, 0, 0, f2106, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_Idle03], g_strz_subbanim[ANIM_Damage01], 0, + 0, 0, 0, 0, 0, 0, 0, f2106, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_Taunt01], g_strz_subbanim[ANIM_Damage01], 0, + 0, 0, 0, 0, 0, 0, 0, f2106, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_AttackWindup01], + g_strz_subbanim[ANIM_Damage01], 0, 0, 0, 0, 0, 0, 0, 0, f2106, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_AttackLoop01], + g_strz_subbanim[ANIM_Damage01], 0, 0, 0, 0, 0, 0, 0, 0, f2106, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_Attack01], g_strz_subbanim[ANIM_Damage01], + 0, 0, 0, 0, 0, 0, 0, 0, f2106, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_AttackEnd01], + g_strz_subbanim[ANIM_Damage01], 0, 0, 0, 0, 0, 0, 0, 0, f2106, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_SpawnKids01], + g_strz_subbanim[ANIM_Damage01], 0, 0, 0, 0, 0, 0, 0, 0, f2106, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_Idle02], g_strz_subbanim[ANIM_Taunt01], 0, + 0, 0, 0, 0, 0, 0, 0, f2106, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_Idle03], g_strz_subbanim[ANIM_Taunt01], 0, + 0, 0, 0, 0, 0, 0, 0, f2106, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_AttackWindup01], + g_strz_subbanim[ANIM_Taunt01], 0, 0, 0, 0, 0, 0, 0, 0, f2106, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_AttackLoop01], + g_strz_subbanim[ANIM_Taunt01], 0, 0, 0, 0, 0, 0, 0, 0, f2106, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_Attack01], g_strz_subbanim[ANIM_Taunt01], 0, + 0, 0, 0, 0, 0, 0, 0, f2106, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_AttackEnd01], g_strz_subbanim[ANIM_Taunt01], + 0, 0, 0, 0, 0, 0, 0, 0, f2106, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_SpawnKids01], g_strz_subbanim[ANIM_Taunt01], + 0, 0, 0, 0, 0, 0, 0, 0, f2106, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_Damage01], + g_strz_subbanim[ANIM_SpawnKids01], 0, 0, 0, 0, 0, 0, 0, 0, f2106, 0); + + return table; +} + xVec3* zNPCKingJelly::get_bottom() { return (xVec3*)&this->model->Mat->pos; diff --git a/src/SB/Game/zNPCTypeKingJelly.h b/src/SB/Game/zNPCTypeKingJelly.h index 341078dce..3a78a22a2 100644 --- a/src/SB/Game/zNPCTypeKingJelly.h +++ b/src/SB/Game/zNPCTypeKingJelly.h @@ -130,10 +130,14 @@ struct zNPCKingJelly : zNPCSubBoss zEnt* curtain_ent; xModelInstance* curtain_model[5]; U8 first_update; //0x10B4 + xAnimState* animState; // offset 0x157C, size 0x4 //copied from patrick comment not true + xAnimTransitionList* + animTranList; // offset 0x1580, size 0x4 //copied from patrick comment not true zNPCKingJelly(S32 myType); void Setup(); void Destroy(); + U32 AnimPick(S32 rawgoal, en_NPC_GOAL_SPOT gspot, xGoal* goal); void BUpdate(xVec3*); void SelfSetup(); void init_child(zNPCKingJelly::child_data&, zNPCCommon&, int); diff --git a/src/SB/Game/zNPCTypeSubBoss.cpp b/src/SB/Game/zNPCTypeSubBoss.cpp index 658504dbc..436d136f9 100644 --- a/src/SB/Game/zNPCTypeSubBoss.cpp +++ b/src/SB/Game/zNPCTypeSubBoss.cpp @@ -9,8 +9,12 @@ U32 g_hash_subbanim[ANIM_COUNT] = {}; +void foo(zNPCKingJelly* jelly) +{ +} + // clang-format off -const char* g_strz_subbanim[ANIM_COUNT] = +char* g_strz_subbanim[ANIM_COUNT] = { "Unknown", "Idle01", diff --git a/src/SB/Game/zNPCTypeSubBoss.h b/src/SB/Game/zNPCTypeSubBoss.h index a597c5375..9a1508521 100644 --- a/src/SB/Game/zNPCTypeSubBoss.h +++ b/src/SB/Game/zNPCTypeSubBoss.h @@ -26,4 +26,8 @@ void zNPCSubBoss_SceneFinish(); xFactoryInst* ZNPC_Create_SubBoss(S32 who, RyzMemGrow* grow, void*); void ZNPC_Destroy_SubBoss(xFactoryInst* inst); +#define ANIM_COUNT 78 +extern U32 g_hash_subbanim[ANIM_COUNT]; +extern char* g_strz_subbanim[ANIM_COUNT]; + #endif From ed0e484420f83fc25c72e360116ae310fb3322aa Mon Sep 17 00:00:00 2001 From: Livewire Date: Tue, 18 Mar 2025 23:52:28 -0400 Subject: [PATCH 03/11] fix --- src/SB/Game/zNPCTypeKingJelly.cpp | 1 - src/SB/Game/zNPCTypeSubBoss.cpp | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/SB/Game/zNPCTypeKingJelly.cpp b/src/SB/Game/zNPCTypeKingJelly.cpp index 6b945fa95..767abae7d 100644 --- a/src/SB/Game/zNPCTypeKingJelly.cpp +++ b/src/SB/Game/zNPCTypeKingJelly.cpp @@ -80,7 +80,6 @@ xAnimTable* ZNPC_AnimTable_KingJelly() }; // clang-format on - xAnimTable* table = xAnimTableNew("zNPCKingJelly", NULL, 0); xAnimTableNewState(table, g_strz_subbanim[ANIM_Idle01], 0x10, 0, f1868, NULL, NULL, f1869, NULL, diff --git a/src/SB/Game/zNPCTypeSubBoss.cpp b/src/SB/Game/zNPCTypeSubBoss.cpp index 436d136f9..0f31b506a 100644 --- a/src/SB/Game/zNPCTypeSubBoss.cpp +++ b/src/SB/Game/zNPCTypeSubBoss.cpp @@ -5,8 +5,6 @@ #include "zNPCTypeDutchman.h" #include "zNPCTypePrawn.h" -#define ANIM_COUNT 23 - U32 g_hash_subbanim[ANIM_COUNT] = {}; void foo(zNPCKingJelly* jelly) From 7c8371849fe4e3c6b8d4cf6844e04667c0164c76 Mon Sep 17 00:00:00 2001 From: Livewire Date: Wed, 19 Mar 2025 00:00:01 -0400 Subject: [PATCH 04/11] removed leftover junk from intially starting the function --- src/SB/Game/zNPCTypeKingJelly.cpp | 5 ----- src/SB/Game/zNPCTypeKingJelly.h | 3 --- src/SB/Game/zNPCTypeSubBoss.cpp | 4 ---- 3 files changed, 12 deletions(-) diff --git a/src/SB/Game/zNPCTypeKingJelly.cpp b/src/SB/Game/zNPCTypeKingJelly.cpp index 767abae7d..682e81d19 100644 --- a/src/SB/Game/zNPCTypeKingJelly.cpp +++ b/src/SB/Game/zNPCTypeKingJelly.cpp @@ -57,11 +57,6 @@ void lightning_ring::create() //store 0 into 0x7c } -void foo() -{ - xAnimTable* foo = xAnimTableNew("FOO", 0, 0); -} - xAnimTable* ZNPC_AnimTable_KingJelly() { // clang-format off diff --git a/src/SB/Game/zNPCTypeKingJelly.h b/src/SB/Game/zNPCTypeKingJelly.h index 3a78a22a2..880593dbd 100644 --- a/src/SB/Game/zNPCTypeKingJelly.h +++ b/src/SB/Game/zNPCTypeKingJelly.h @@ -130,9 +130,6 @@ struct zNPCKingJelly : zNPCSubBoss zEnt* curtain_ent; xModelInstance* curtain_model[5]; U8 first_update; //0x10B4 - xAnimState* animState; // offset 0x157C, size 0x4 //copied from patrick comment not true - xAnimTransitionList* - animTranList; // offset 0x1580, size 0x4 //copied from patrick comment not true zNPCKingJelly(S32 myType); void Setup(); diff --git a/src/SB/Game/zNPCTypeSubBoss.cpp b/src/SB/Game/zNPCTypeSubBoss.cpp index 0f31b506a..a74dd0d7e 100644 --- a/src/SB/Game/zNPCTypeSubBoss.cpp +++ b/src/SB/Game/zNPCTypeSubBoss.cpp @@ -7,10 +7,6 @@ U32 g_hash_subbanim[ANIM_COUNT] = {}; -void foo(zNPCKingJelly* jelly) -{ -} - // clang-format off char* g_strz_subbanim[ANIM_COUNT] = { From 8ef31113988c8692fad815b06f7f0444156b8a93 Mon Sep 17 00:00:00 2001 From: Livewire Date: Wed, 19 Mar 2025 21:18:51 -0400 Subject: [PATCH 05/11] ZNPC_AnimTable_BossSB2 - 73% code match --- src/SB/Game/zNPCTypeBossSB2.cpp | 198 +++++++++++++++++++++++++++++++- 1 file changed, 195 insertions(+), 3 deletions(-) diff --git a/src/SB/Game/zNPCTypeBossSB2.cpp b/src/SB/Game/zNPCTypeBossSB2.cpp index aa2293038..b8e74e975 100644 --- a/src/SB/Game/zNPCTypeBossSB2.cpp +++ b/src/SB/Game/zNPCTypeBossSB2.cpp @@ -1,9 +1,201 @@ -#include "xVec3.h" -#include "xMath3.h" #include "zNPCTypeBossSB2.h" - #include +#include "string.h" +#include "iModel.h" +#include "xCollide.h" +#include "xMath.h" +#include "xMath3.h" +#include "xstransvc.h" +#include "xSnd.h" +#include "xVec3.h" + +#include "zCamera.h" +#include "zEntSimpleObj.h" +#include "zEntDestructObj.h" +#include "zGlobals.h" +#include "zGrid.h" +#include "zNPCTypeBossPatrick.h" +#include "zRenderState.h" +#include "zNPCGoals.h" +#include "zLightning.h" +#include "zNPCTypeRobot.h" +#include + +#define ANIM_Unknown 0 //0x0 +#define ANIM_Idle01 1 // 0x4 +#define ANIM_Idle02 2 // 0x8 +#define ANIM_Taunt01 3 // 0xC +#define ANIM_Hit01 7 //0x1c +#define ANIM_Hit02 8 //0x20 +#define ANIM_Dizzy01 10 //0x28 +#define ANIM_SmashHitLeft 46 +#define ANIM_SmashHitRight 47 +#define ANIM_SmackLeft01 48 +#define ANIM_SmackRight01 49 +#define ANIM_ChopLeftBegin 50 +#define ANIM_ChopLeftLoop 51 +#define ANIM_ChopLeftEnd 52 +#define ANIM_ChopRightBegin 53 +#define ANIM_ChopRightLoop 54 +#define ANIM_ChopRightEnd 55 +#define ANIM_SwipeLeftBegin 56 +#define ANIM_SwipeLeftLoop 57 +#define ANIM_SwipeLeftEnd 58 +#define ANIM_SwipeRightBegin 59 +#define ANIM_SwipeRightLoop 60 +#define ANIM_SwipeRightEnd 61 +#define ANIM_ReturnIdle01 62 +#define ANIM_KarateStart 63 +#define ANIM_KarateLoop 64 +#define ANIM_KarateEnd 65 + +xAnimTable* ZNPC_AnimTable_BossSB2() +{ + // clang-format off + // S32 anim_list[27] = { + + // ANIM_Idle01, + // ANIM_Idle02, + // ANIM_Taunt01, + // ANIM_Hit01, + // ANIM_Hit02, + // ANIM_SmashHitLeft, + // ANIM_SmashHitRight, + // ANIM_SmackLeft01, + // ANIM_SmackRight01, + // ANIM_ChopLeftBegin, + // ANIM_ChopLeftLoop, + // ANIM_ChopLeftEnd, + // ANIM_ChopRightBegin, No longer needed? + // ANIM_ChopRightLoop, Was used instead of "ANIM_xxxxx;" right about new state + // ANIM_ChopRightEnd, + // ANIM_SwipeLeftBegin, + // ANIM_SwipeLeftLoop, + // ANIM_SwipeLeftEnd, + // ANIM_SwipeRightBegin, + // ANIM_SwipeRightLoop, + // ANIM_SwipeRightEnd, + // ANIM_ReturnIdle01, + // ANIM_KarateStart, + // ANIM_KarateLoop, + // ANIM_KarateEnd, + // ANIM_Dizzy01, + // }; + + + xAnimTable* table = xAnimTableNew("zNPCB_SB2_Karate", NULL, 0); + //24 new state + //15 new transition + ANIM_Idle01; + xAnimTableNewState(table, g_strz_bossanim[ANIM_Idle01], 0x10, 0, 1, NULL, NULL, 0, NULL, NULL, + xAnimDefaultBeforeEnter, NULL, NULL); + ANIM_Idle02; + xAnimTableNewState(table, g_strz_bossanim[ANIM_Idle02], 0, 0, 1, NULL, NULL, 0, NULL, NULL, + xAnimDefaultBeforeEnter, NULL, NULL); + ANIM_Taunt01; + xAnimTableNewState(table, g_strz_bossanim[ANIM_Taunt01], 0, 0, 1, NULL, NULL, 0, NULL, NULL, + xAnimDefaultBeforeEnter, NULL, NULL); + ANIM_SmackLeft01; + xAnimTableNewState(table, g_strz_bossanim[ANIM_SmackLeft01], 0x20, 0, 1, NULL, NULL, 0, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + ANIM_SmackRight01; + xAnimTableNewState(table, g_strz_bossanim[ANIM_SmackRight01], 0x20, 0, 1, NULL, NULL, 0, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + ANIM_ChopLeftBegin; + xAnimTableNewState(table, g_strz_bossanim[ANIM_ChopLeftBegin], 0x20, 0, 1, NULL, NULL, 0, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + ANIM_ChopLeftLoop; + xAnimTableNewState(table, g_strz_bossanim[ANIM_ChopLeftLoop], 0, 0, 1, NULL, NULL, 0, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + ANIM_ChopLeftEnd; + xAnimTableNewState(table, g_strz_bossanim[ANIM_ChopLeftEnd], 0x20, 0, 1, NULL, NULL, 0, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + ANIM_ChopRightBegin; + xAnimTableNewState(table, g_strz_bossanim[ANIM_ChopRightBegin], 0x20, 0, 1, NULL, NULL, 0, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + ANIM_ChopRightLoop; + xAnimTableNewState(table, g_strz_bossanim[ANIM_ChopRightLoop], 0, 0, 1, NULL, NULL, 0, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + ANIM_ChopRightEnd; + xAnimTableNewState(table, g_strz_bossanim[ANIM_ChopRightEnd], 0x20, 0, 1, NULL, NULL, 0, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + ANIM_SwipeLeftBegin; + xAnimTableNewState(table, g_strz_bossanim[ANIM_SwipeLeftBegin], 0x20, 0, 1, NULL, NULL, 0, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + ANIM_SwipeLeftLoop; + xAnimTableNewState(table, g_strz_bossanim[ANIM_SwipeLeftLoop], 0x10, 0, 1, NULL, NULL, 0, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + ANIM_SwipeLeftEnd; + xAnimTableNewState(table, g_strz_bossanim[ANIM_SwipeLeftEnd], 0x20, 0, 1, NULL, NULL, 0, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + ANIM_SwipeRightBegin; + xAnimTableNewState(table, g_strz_bossanim[ANIM_SwipeRightBegin], 0x20, 0, 1, NULL, NULL, 0, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + ANIM_SwipeRightLoop; + xAnimTableNewState(table, g_strz_bossanim[ANIM_SwipeRightLoop], 0x10, 0, 1, NULL, NULL, 0, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + ANIM_SwipeRightEnd; + xAnimTableNewState(table, g_strz_bossanim[ANIM_SwipeRightEnd], 0x20, 0, 1, NULL, NULL, 0, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + ANIM_Dizzy01; + xAnimTableNewState(table, g_strz_bossanim[ANIM_Dizzy01], 0x10, 0, 1, NULL, NULL, 0, NULL, NULL, + xAnimDefaultBeforeEnter, NULL, NULL); + ANIM_Hit01; + xAnimTableNewState(table, g_strz_bossanim[ANIM_Hit01], 0, 0, 1, NULL, NULL, 0, NULL, NULL, + xAnimDefaultBeforeEnter, NULL, NULL); + ANIM_Hit02; + xAnimTableNewState(table, g_strz_bossanim[ANIM_Hit02], 0, 0, 1, NULL, NULL, 0, NULL, NULL, + xAnimDefaultBeforeEnter, NULL, NULL); + ANIM_ReturnIdle01; + xAnimTableNewState(table, g_strz_bossanim[ANIM_ReturnIdle01], 0x20, 0, 1, NULL, NULL, 0, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + ANIM_KarateStart; + xAnimTableNewState(table, g_strz_bossanim[ANIM_KarateStart], 0x20, 0, 1, NULL, NULL, 0, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + ANIM_KarateLoop; + xAnimTableNewState(table, g_strz_bossanim[ANIM_KarateLoop], 0x10, 0, 1, NULL, NULL, 0, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + ANIM_KarateEnd; + xAnimTableNewState(table, g_strz_bossanim[ANIM_KarateEnd], 0x20, 0, 1, NULL, NULL, 0, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + + NPCC_BuildStandardAnimTran(table, g_strz_bossanim, 0, 1, 0.2); + + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_SmackLeft01], g_strz_bossanim[ANIM_Dizzy01], + 0, 0, 0x10, 0, 0, 0, 0, 0, 0.1, 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_SmackRight01], + g_strz_bossanim[ANIM_Dizzy01], 0, 0, 0x10, 0, 0, 0, 0, 0, 0.1, 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_ReturnIdle01], g_strz_bossanim[ANIM_Idle01], + 0, 0, 0x10, 0, 0, 0, 0, 0, 0.1, 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_KarateStart], + g_strz_bossanim[ANIM_KarateLoop], 0, 0, 0x10, 0, 0, 0, 0, 0, 0.1, 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_KarateEnd], g_strz_bossanim[ANIM_Idle01], 0, + 0, 0x10, 0, 0, 0, 0, 0, 0.1, 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_ChopLeftBegin], + g_strz_bossanim[ANIM_ChopLeftLoop], 0, 0, 0x10, 0, 0, 0, 0, 0, 0.1, 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_ChopLeftLoop], + g_strz_bossanim[ANIM_ChopLeftEnd], 0, 0, 0, 0, 0, 0, 0, 0, 0.1, 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_ChopRightBegin], + g_strz_bossanim[ANIM_ChopRightLoop], 0, 0, 0x10, 0, 0, 0, 0, 0, 0.1, 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_ChopRightLoop], + g_strz_bossanim[ANIM_ChopRightEnd], 0, 0, 0, 0, 0, 0, 0, 0, 0.1, 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_SwipeLeftBegin], + g_strz_bossanim[ANIM_SwipeLeftLoop], 0, 0, 0x10, 0, 0, 0, 0, 0, 0.1, 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_SwipeLeftLoop], + g_strz_bossanim[ANIM_SwipeLeftEnd], 0, 0, 0, 0, 0, 0, 0, 0, 0.1, 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_SwipeRightBegin], + g_strz_bossanim[ANIM_SwipeRightLoop], 0, 0, 0x10, 0, 0, 0, 0, 0, 0.1, + 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_SwipeRightLoop], + g_strz_bossanim[ANIM_SwipeRightEnd], 0, 0, 0, 0, 0, 0, 0, 0, 0.1, 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_Hit01], g_strz_bossanim[ANIM_Idle01], 0, 0, + 0x10, 0, 0, 0, 0, 0, 0.1, 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_Hit02], g_strz_bossanim[ANIM_Dizzy01], 0, 0, + 0x10, 0, 0, 0, 0, 0, 0.1, 0); + + return table; +} void xMat3x3RMulVec(xVec3* o, const xMat3x3* m, const xVec3* v) { From 58b715b7795427094f503623af16aa37f4b5cfc1 Mon Sep 17 00:00:00 2001 From: Livewire Date: Wed, 19 Mar 2025 22:50:36 -0400 Subject: [PATCH 06/11] Dutchman anim table should be complete, removed some junk from zNPCTypeKingJelly --- src/SB/Game/zNPCTypeDutchman.cpp | 97 ++++++++++++++++++++++++++++++- src/SB/Game/zNPCTypeKingJelly.cpp | 16 +---- 2 files changed, 97 insertions(+), 16 deletions(-) diff --git a/src/SB/Game/zNPCTypeDutchman.cpp b/src/SB/Game/zNPCTypeDutchman.cpp index 22f18c4fc..76fdb0e17 100644 --- a/src/SB/Game/zNPCTypeDutchman.cpp +++ b/src/SB/Game/zNPCTypeDutchman.cpp @@ -10,7 +10,101 @@ namespace { } } // namespace -//dummy text for pushing + +#define f1605 0.0f +#define f1606 1.0f +#define f1689 0.2f +#define f1690 0.1f + +#define ANIM_Idle01 1 +#define ANIM_Fidget01 4 //0x10 +#define ANIM_Fidget02 5 //0x14 +#define ANIM_Fidget03 6 //0x18 +#define ANIM_Taunt01 7 // 0x1c +#define ANIM_Death01 11 //0x2c +#define ANIM_AttackWindup01 12 //0x30 +#define ANIM_AttackLoop01 13 //0x34 +#define ANIM_AttackEnd01 14 //0x38 +#define ANIM_Attack02Windup01 16 //0x40 +#define ANIM_Attack02Loop01 17 //0x44 +#define ANIM_Attack02End01 18 //0x48 +#define ANIM_LassoGrab01 19 //0x4c + +//13 new states +//8 new transitions +xAnimTable* ZNPC_AnimTable_Dutchman() +{ + // clang-format off + S32 ourAnims[13] = { + ANIM_Idle01, + ANIM_Fidget01, + ANIM_Fidget02, + ANIM_Fidget03, + ANIM_Taunt01, + ANIM_Death01, + ANIM_AttackWindup01, + ANIM_AttackLoop01, + ANIM_AttackEnd01, + ANIM_Attack02Windup01, + ANIM_Attack02Loop01, + ANIM_Attack02End01, + ANIM_LassoGrab01, + + }; + // clang-format on + xAnimTable* table = xAnimTableNew("zNPCDutchman", NULL, 0); + + xAnimTableNewState(table, g_strz_subbanim[ANIM_Idle01], 0x10, 0, f1606, NULL, NULL, f1605, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_Death01], 0, 0, f1606, NULL, NULL, f1605, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_Fidget01], 0x20, 0, f1606, NULL, NULL, f1605, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_Fidget02], 0x20, 0, f1606, NULL, NULL, f1605, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_Fidget03], 0x20, 0, f1606, NULL, NULL, f1605, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_Taunt01], 0x20, 0, f1606, NULL, NULL, f1605, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_AttackWindup01], 0x20, 0, f1606, NULL, NULL, + f1605, NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_AttackLoop01], 0x10, 0, f1606, NULL, NULL, f1605, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_AttackEnd01], 0x20, 0, f1606, NULL, NULL, f1605, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_Attack02Windup01], 0x20, 0, f1606, NULL, NULL, + f1605, NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_Attack02Loop01], 0x10, 0, f1606, NULL, NULL, + f1605, NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_Attack02End01], 0x20, 0, f1606, NULL, NULL, + f1605, NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_LassoGrab01], 0x20, 0x2000000, f1606, NULL, NULL, + f1605, NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + + NPCC_BuildStandardAnimTran(table, g_strz_subbanim, ourAnims, 1, f1689); + + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_AttackWindup01], + g_strz_subbanim[ANIM_AttackLoop01], 0, 0, 0x10, 0, 0, 0, 0, 0, f1690, + 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_AttackLoop01], + g_strz_subbanim[ANIM_AttackEnd01], 0, 0, 0, 0, 0, 0, 0, 0, f1690, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_Attack02Windup01], + g_strz_subbanim[ANIM_Attack02Loop01], 0, 0, 0x10, 0, 0, 0, 0, 0, f1690, + 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_Attack02Loop01], + g_strz_subbanim[ANIM_Attack02End01], 0, 0, 0, 0, 0, 0, 0, 0, f1690, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_Fidget02], g_strz_subbanim[ANIM_Idle01], 0, + 0, 0x10, 0, 0, 0, 0, 0, f1690, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_Fidget02], + g_strz_subbanim[ANIM_AttackWindup01], 0, 0, 0, 0, 0, 0, 0, 0, f1690, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_Fidget02], g_strz_subbanim[ANIM_Fidget01], + 0, 0, 0, 0, 0, 0, 0, 0, f1690, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_LassoGrab01], g_strz_subbanim[ANIM_Death01], + 0, 0, 0, 0, 0, 0, 0, 0, f1690, 0); + + return table; +} + void xMat3x3RMulVec(xVec3* o, const xMat3x3* m, const xVec3* v) { F32 x = m->right.x * v->x + m->up.x * v->y + m->at.x * v->z; @@ -216,7 +310,6 @@ S32 zNPCGoalDutchmanDeath::Enter(F32 dt, void* updCtxt) { owner.delay = 0.0f; return zNPCGoalCommon::Enter(dt, updCtxt); - } U8 zNPCDutchman::PhysicsFlags() const diff --git a/src/SB/Game/zNPCTypeKingJelly.cpp b/src/SB/Game/zNPCTypeKingJelly.cpp index 682e81d19..695619064 100644 --- a/src/SB/Game/zNPCTypeKingJelly.cpp +++ b/src/SB/Game/zNPCTypeKingJelly.cpp @@ -16,7 +16,7 @@ #define ANIM_Fidget02 5 #define ANIM_Fidget03 6 #define ANIM_Taunt01 7 // 0x1c -#define ANIM_Attack01 8 //0x20 DEPRACATED +#define ANIM_Attack01 8 //0x20 #define ANIM_Damage01 9 //0x24 #define ANIM_Damage02 10 //0x28 #define ANIM_Death01 11 //0x2c @@ -29,18 +29,6 @@ #define ANIM_Attack02End01 18 #define ANIM_LassoGrab01 19 -// #define ANIM_Idle01 1 -// #define ANIM_Idle02 2 -// #define ANIM_Idle03 3 -// #define ANIM_Taunt01 7 -// #define ANIM_Attack01 8 -// #define ANIM_AttackWindup01 12 -// #define ANIM_AttackLoop01 13 -// #define ANIM_AttackEnd01 14 -// #define ANIM_Damage01 9 -// #define ANIM_SpawnKids01 15 -// #define ANIM_Unknown 0 - namespace { void tweak() @@ -66,7 +54,7 @@ xAnimTable* ZNPC_AnimTable_KingJelly() ANIM_Idle03, ANIM_Taunt01, ANIM_Attack01, - ANIM_AttackWindup01, // replace with king jelly anims + ANIM_AttackWindup01, ANIM_AttackLoop01, ANIM_AttackEnd01, ANIM_Damage01, From a48a40f1f5308ae4f5c069cc97d58d544b31d72e Mon Sep 17 00:00:00 2001 From: Livewire Date: Sun, 23 Mar 2025 19:12:57 -0400 Subject: [PATCH 07/11] Anim Tables --- src/SB/Game/zNPCTypeBossPlankton.cpp | 128 +++++++++++++++++++++++++++ src/SB/Game/zNPCTypeBossSB2.cpp | 2 +- src/SB/Game/zNPCTypePrawn.cpp | 77 ++++++++++++++++ 3 files changed, 206 insertions(+), 1 deletion(-) diff --git a/src/SB/Game/zNPCTypeBossPlankton.cpp b/src/SB/Game/zNPCTypeBossPlankton.cpp index 1f67bbe92..78cf10362 100644 --- a/src/SB/Game/zNPCTypeBossPlankton.cpp +++ b/src/SB/Game/zNPCTypeBossPlankton.cpp @@ -2,6 +2,134 @@ #include +#define f1585 1.0f +#define f1586 0.0f +#define f1657 0.2f +#define f1658 0.1f + +#define ANIM_Unknown 0 +#define ANIM_Idle01 1 // 0x4 +#define ANIM_Taunt01 3 // 0xC +#define ANIM_move 66 // 0x42 +#define ANIM_stun_begin 67 //0x43 +#define ANIM_stun_loop 68 //0x44 +#define ANIM_stun_end 69 //0x45 +#define ANIM_attack_beam_begin 70 //0x46 +#define ANIM_attack_beam_loop 71 //0x47 +#define ANIM_attack_beam_end 72 //0x48 +#define ANIM_attack_wall_begin 73 //0x49 +#define ANIM_attack_wall_loop 74 //0x4a +#define ANIM_attack_wall_end 75 //0x4b +#define ANIM_attack_missle 76 //0x4c +#define ANIM_attack_bomb 77 //0x4d + +xAnimTable* ZNPC_AnimTable_BossPlankton() +{ + // clang-format off + S32 ourAnims[32] = { //dwarf says it should be 32, matches less with 15 + ANIM_Idle01, + ANIM_Taunt01, + ANIM_move, + ANIM_stun_begin, + ANIM_stun_loop, + ANIM_stun_end, + ANIM_attack_beam_begin, + ANIM_attack_beam_loop, + ANIM_attack_beam_end, + ANIM_attack_wall_begin, + ANIM_attack_wall_loop, + ANIM_attack_wall_end, + ANIM_attack_missle, + ANIM_attack_bomb, + ANIM_Unknown, + }; + // clang-format on + + xAnimTable* table = xAnimTableNew("zNPCBPlankton", NULL, 0); + + xAnimTableNewState(table, g_strz_bossanim[ANIM_Idle01], 0x10, 0, 1.0f, NULL, NULL, 0.0f, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[ANIM_Taunt01], 0x20, 0, 1.0f, NULL, NULL, 0.0f, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[ANIM_move], 0x10, 0, f1585, NULL, NULL, f1586, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[ANIM_stun_begin], 0x20, 0, f1585, NULL, NULL, f1586, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[ANIM_stun_loop], 0x10, 0, f1585, NULL, NULL, f1586, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[ANIM_stun_end], 0x20, 0, f1585, NULL, NULL, f1586, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[ANIM_attack_beam_begin], 0x20, 0, f1585, NULL, NULL, + f1586, NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[ANIM_attack_beam_loop], 0x10, 0, f1585, NULL, NULL, + f1586, NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[ANIM_attack_beam_end], 0x20, 0, f1585, NULL, NULL, + f1586, NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[ANIM_attack_wall_begin], 0x20, 0, f1585, NULL, NULL, + f1586, NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[ANIM_attack_wall_loop], 0x10, 0, f1585, NULL, NULL, + f1586, NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[ANIM_attack_wall_end], 0x20, 0, f1585, NULL, NULL, + f1586, NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[ANIM_attack_missle], 0x20, 0, f1585, NULL, NULL, + f1586, NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[ANIM_attack_bomb], 0x20, 0, f1585, NULL, NULL, f1586, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + + NPCC_BuildStandardAnimTran(table, g_strz_bossanim, ourAnims, 1, f1657); + + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_stun_begin], + g_strz_bossanim[ANIM_stun_loop], 0, 0, 0x10, 0, f1586, f1586, 0, 0, + f1658, 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_stun_loop], g_strz_bossanim[ANIM_stun_end], + 0, 0, 0, 0, f1586, f1586, 0, 0, f1658, 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_attack_beam_begin], + g_strz_bossanim[ANIM_attack_beam_loop], 0, 0, 0x10, 0, f1586, f1586, 0, + 0, f1658, 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_attack_beam_begin], + g_strz_bossanim[ANIM_attack_beam_end], 0, 0, 0, 0, f1586, f1586, 0, 0, + f1658, 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_attack_beam_loop], + g_strz_bossanim[ANIM_attack_beam_end], 0, 0, 0, 0, f1586, f1586, 0, 0, + f1658, 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_attack_wall_begin], + g_strz_bossanim[ANIM_attack_wall_loop], 0, 0, 0x10, 0, f1586, f1586, 0, + 0, f1658, 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_attack_wall_loop], + g_strz_bossanim[ANIM_attack_wall_end], 0, 0, 0, 0, f1586, f1586, 0, 0, + f1658, 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_Taunt01], g_strz_bossanim[ANIM_stun_begin], + 0, 0, 0, 0, f1586, f1586, 0, 0, f1658, 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_move], g_strz_bossanim[ANIM_stun_begin], 0, + 0, 0, 0, f1586, f1586, 0, 0, f1658, 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_attack_beam_begin], + g_strz_bossanim[ANIM_stun_begin], 0, 0, 0, 0, f1586, f1586, 0, 0, f1658, + 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_attack_beam_loop], + g_strz_bossanim[ANIM_stun_begin], 0, 0, 0, 0, f1586, f1586, 0, 0, f1658, + 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_attack_beam_end], + g_strz_bossanim[ANIM_stun_begin], 0, 0, 0, 0, f1586, f1586, 0, 0, f1658, + 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_attack_wall_begin], + g_strz_bossanim[ANIM_stun_begin], 0, 0, 0, 0, f1586, f1586, 0, 0, f1658, + 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_attack_wall_loop], + g_strz_bossanim[ANIM_stun_begin], 0, 0, 0, 0, f1586, f1586, 0, 0, f1658, + 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_attack_wall_end], + g_strz_bossanim[ANIM_stun_begin], 0, 0, 0, 0, f1586, f1586, 0, 0, f1658, + 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_attack_missle], + g_strz_bossanim[ANIM_stun_begin], 0, 0, 0, 0, f1586, f1586, 0, 0, f1658, + 0); + xAnimTableNewTransition(table, g_strz_bossanim[ANIM_attack_bomb], + g_strz_bossanim[ANIM_stun_begin], 0, 0, 0, 0, f1586, f1586, 0, 0, f1658, + 0); + + return table; +} + void zNPCBPlankton::render_debug() { } diff --git a/src/SB/Game/zNPCTypeBossSB2.cpp b/src/SB/Game/zNPCTypeBossSB2.cpp index b8e74e975..4999aafe6 100644 --- a/src/SB/Game/zNPCTypeBossSB2.cpp +++ b/src/SB/Game/zNPCTypeBossSB2.cpp @@ -68,7 +68,7 @@ xAnimTable* ZNPC_AnimTable_BossSB2() // ANIM_ChopLeftLoop, // ANIM_ChopLeftEnd, // ANIM_ChopRightBegin, No longer needed? - // ANIM_ChopRightLoop, Was used instead of "ANIM_xxxxx;" right about new state + // ANIM_ChopRightLoop, Was used instead of "ANIM_xxxxx;" right before new state // ANIM_ChopRightEnd, // ANIM_SwipeLeftBegin, // ANIM_SwipeLeftLoop, diff --git a/src/SB/Game/zNPCTypePrawn.cpp b/src/SB/Game/zNPCTypePrawn.cpp index 7c38bf85e..80c053efa 100644 --- a/src/SB/Game/zNPCTypePrawn.cpp +++ b/src/SB/Game/zNPCTypePrawn.cpp @@ -2,6 +2,32 @@ #include +#define f1052 1.0f +#define f1053 0.0f +#define f1454 0.2f +#define f1455 0.1f + +#define ANIM_Unknown 0 // 0x0 +#define ANIM_Idle01 1 // 0x04 +#define ANIM_Idle02 2 // 0x08 animtable new state +#define ANIM_Idle03 3 // 0xC +#define ANIM_Fidget01 4 // +#define ANIM_Fidget02 5 +#define ANIM_Fidget03 6 +#define ANIM_Taunt01 7 // 0x1c +#define ANIM_Attack01 8 //0x20 +#define ANIM_Damage01 9 //0x24 +#define ANIM_Damage02 10 //0x28 +#define ANIM_Death01 11 //0x2c +#define ANIM_AttackWindup01 12 //0x30 +#define ANIM_AttackLoop01 13 //0x34 +#define ANIM_AttackEnd01 14 //0x38 +#define ANIM_SpawnKids01 15 //0x3C +#define ANIM_Attack02Windup01 16 +#define ANIM_Attack02Loop01 17 +#define ANIM_Attack02End01 18 +#define ANIM_LassoGrab01 19 + namespace { sound_data_type sound_data[4]; @@ -246,6 +272,57 @@ void aqua_beam::render() { } +xAnimTable* ZNPC_AnimTable_Prawn() +{ + // clang-format off + S32 ourAnims[10] = { + ANIM_Idle01, + ANIM_Fidget01, + ANIM_Fidget02, + ANIM_Taunt01, + ANIM_AttackWindup01, + ANIM_AttackLoop01, + ANIM_AttackLoop01, + ANIM_AttackEnd01, + ANIM_Damage01, + ANIM_Damage02, + + }; + // clang-format on + xAnimTable* table = xAnimTableNew("zNPCPrawn", NULL, 0); + + xAnimTableNewState(table, g_strz_subbanim[ANIM_Idle01], 0x10, 0, f1052, NULL, NULL, f1053, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_Fidget01], 0x20, 0, f1052, NULL, NULL, f1053, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_Fidget02], 0x20, 0, f1052, NULL, NULL, f1053, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_Taunt01], 0x20, 0, f1052, NULL, NULL, f1053, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_AttackWindup01], 0x20, 0, f1052, NULL, NULL, + f1053, NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_AttackLoop01], 0x10, 0, f1052, NULL, NULL, f1053, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_AttackEnd01], 0x20, 0, f1052, NULL, NULL, f1053, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_Damage01], 0x20, 0, f1052, NULL, NULL, f1053, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_subbanim[ANIM_Damage02], 0x20, 0, f1052, NULL, NULL, f1053, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + + NPCC_BuildStandardAnimTran(table, g_strz_subbanim, ourAnims, 1, f1454); + + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_AttackWindup01], + g_strz_subbanim[ANIM_AttackLoop01], 0, 0, 0x10, 0, 0, 0, 0, 0, f1455, + 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_AttackLoop01], + g_strz_subbanim[ANIM_AttackEnd01], 0, 0, 0, 0, 0, 0, 0, 0, f1455, 0); + xAnimTableNewTransition(table, g_strz_subbanim[ANIM_AttackEnd01], g_strz_subbanim[ANIM_Idle01], + 0, 0, 0x10, 0, 0, 0, 0, 0, f1455, 0); + + return table; +} + void zNPCPrawn::NewTime(xScene* xscn, float dt) { zNPCCommon::NewTime(xscn, dt); From 41af8673835980902f928a2067e8dcb8b74012aa Mon Sep 17 00:00:00 2001 From: Livewire Date: Mon, 24 Mar 2025 00:15:34 -0400 Subject: [PATCH 08/11] worst push ever --- src/SB/Game/zNPCTypeDuplotron.cpp | 45 +++++++++++++++++++++++++++++++ src/SB/Game/zNPCTypeDuplotron.h | 6 ++++- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/src/SB/Game/zNPCTypeDuplotron.cpp b/src/SB/Game/zNPCTypeDuplotron.cpp index d1d1cbea8..ef6745dfb 100644 --- a/src/SB/Game/zNPCTypeDuplotron.cpp +++ b/src/SB/Game/zNPCTypeDuplotron.cpp @@ -1,9 +1,16 @@ #include "zNPCTypeDuplotron.h" +#include "zNPCTypeCommon.h" #include "zNPCTypes.h" #include "xMath3.h" #include "xstransvc.h" +#define ANIM_Unk1 1 +#define ANIM_Unk2 2 +#define ANIM_Unk3 3 // TEMP NAMES +#define ANIM_Unk4 4 +#define ANIM_UNKNOWN 5 + extern U32 g_hash_dupoanim[5]; extern char* g_strz_dupoanim[5]; @@ -72,6 +79,38 @@ void ZNPC_Destroy_Duplotron(xFactoryInst* inst) delete inst; } +xAnimTable* ZNPC_AnimTable_Duplotron() +{ + S32 ourAnims[5] = { //Literally no clue what the names should be. + ANIM_Unk1, ANIM_Unk2, ANIM_Unk3, ANIM_Unk4, ANIM_UNKNOWN + }; + + xAnimTable* table = xAnimTableNew("zNPCDupltron", NULL, 0); + + xAnimTableNewState(table, g_strz_dupoanim[ANIM_Unk1], 0x10, 0, 1, NULL, NULL, 0, NULL, NULL, + xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_dupoanim[ANIM_Unk2], 0x20, 0, 1, NULL, NULL, 0, NULL, + NULL, //Needs a bit of attention + xAnimDefaultBeforeEnter, NULL, + NULL); //Only pushing cus im done with it for now + xAnimTableNewState(table, g_strz_dupoanim[ANIM_Unk3], 0x10, 0, 1, NULL, NULL, 0, NULL, NULL, + xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_dupoanim[ANIM_Unk4], 0, 0, 1, NULL, NULL, 0, NULL, NULL, + xAnimDefaultBeforeEnter, NULL, NULL); + + NPCC_BuildStandardAnimTran(table, g_strz_dupoanim, ourAnims, 1, 0.2); +} + +void zNPCDuplotron::ParseINI() +{ + zNPCCommon::ParseINI(); +} + +void zNPCDuplotron::BUpdate(xVec3* pos) +{ + zNPCCommon::BUpdate(pos); +} + // 100% match that needs the full vtable to be filled out // because it induces vtable generation void zNPCDuplotron::SelfSetup() @@ -86,6 +125,12 @@ void zNPCDuplotron::SelfSetup() psy->SetSafety(0x4E474430); } +S32 zNPCDuplotron::IsAlive() +{ + xPsyche* psy = this->psy_instinct; + psy->GIDOfActive(); +} + // non-matching: scheduling? void DUPO_InitEffects() { diff --git a/src/SB/Game/zNPCTypeDuplotron.h b/src/SB/Game/zNPCTypeDuplotron.h index 8d5624ba6..7c9e85f09 100644 --- a/src/SB/Game/zNPCTypeDuplotron.h +++ b/src/SB/Game/zNPCTypeDuplotron.h @@ -13,10 +13,14 @@ struct zNPCDuplotron : zNPCCommon zNPCDuplotron(S32 myType); void SelfSetup(); - + S32 IsAlive(); void VFXSmokeStack(F32 dt); void VFXOverheat(F32 dt, F32); void VFXCycleLights(F32 dt, S32 fastpace); + void ParseINI(); + void Reset(); + void BUpdate(xVec3*); + void Process(xScene*, float); // zNPCTypeCommon overrides void Move(xScene*, F32 dt, xEntFrame*); From 44288bc2d846bc615b9b0f588ca08398e6016f2d Mon Sep 17 00:00:00 2001 From: Livewire Date: Mon, 24 Mar 2025 01:02:05 -0400 Subject: [PATCH 09/11] BossSandy Animtable --- src/SB/Game/zNPCTypeBossSandy.cpp | 119 ++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) diff --git a/src/SB/Game/zNPCTypeBossSandy.cpp b/src/SB/Game/zNPCTypeBossSandy.cpp index bea758ddb..6fef07ea9 100644 --- a/src/SB/Game/zNPCTypeBossSandy.cpp +++ b/src/SB/Game/zNPCTypeBossSandy.cpp @@ -14,6 +14,35 @@ extern const char bossSandyStrings[]; +#define Unknown 1 +#define Idle01 2 +#define Idle02 3 +#define Taunt01 4 +#define Run01 5 +#define Walk01 6 +#define Melee01 7 +#define Hit01 8 +#define Hit02 9 +#define GetUp01 10 +#define Dizzy01 11 +#define ElbowDrop01 12 +#define Leap01 13 +#define Leap02 14 +#define Leap03 15 +#define Leap04 16 +#define Sit01 17 +#define SitShock01 18 +#define CLBegin01 19 +#define CLLoop01 20 +#define CLEnd01 21 +#define NoHeadIdle01 22 +#define NoHeadWaving01 23 +#define NoHeadGetUp01 24 +#define NoHeadShotUp01 25 +#define NoHeadShock01 26 +#define NoHeadReplace01 27 +#define NoHeadHit01 28 + extern F32 __830; // 0.0 0 extern F32 __831; // 1.0 3f800000 extern F32 __842; // 0.20000000298023224 3e4ccccd @@ -129,6 +158,96 @@ void on_change_shockwave(const tweak_info& tweak) sSandyPtr->shockRadius = __831; } +xAnimTable* ZNPC_AnimTable_BossSandy() +{ + // clang-format off + S32 ourAnims[28] = { + Unknown, + Idle01, + Idle02, + Taunt01, + Run01, + Walk01, + Melee01, + Hit01, + Hit02, + GetUp01, + Dizzy01, + ElbowDrop01, + Leap01, + Leap02, + Leap03 , + Leap04, + Sit01, + SitShock01, + CLBegin01, + CLLoop01, + CLEnd01, + NoHeadIdle01, + NoHeadWaving01, + NoHeadGetUp01, + NoHeadShotUp01, + NoHeadShock01, + NoHeadReplace01, + NoHeadHit01, + }; + // clang-format on + + //Missing like 2 logic lines or something, too tired to figure it out + xAnimTable* table = xAnimTableNew("zNPCBSandy", NULL, 0); + + xAnimTableNewState(table, g_strz_bossanim[Unknown], 0x10, 0x40, __831, NULL, NULL, __830, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[Idle02], 0x10, 0x40, __831, NULL, NULL, __830, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[Taunt01], 0x10, 0, __831, NULL, NULL, __830, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[Run01], 0x10, 0, __831, NULL, NULL, __830, NULL, NULL, + xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[Walk01], 0x10, 0, __831, NULL, NULL, __830, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[Dizzy01], 0x10, 0, __831, NULL, NULL, __830, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[ElbowDrop01], 0x10, 0, __831, NULL, NULL, __830, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[Leap01], 0x10, 0, __831, NULL, NULL, __830, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[Leap02], 0x10, 0, __831, NULL, NULL, __830, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[Leap03], 0x10, 0, __831, NULL, NULL, __830, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[Leap04], 0x10, 0, __831, NULL, NULL, __830, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[Sit01], 0x10, 0, __831, NULL, NULL, __830, NULL, NULL, + xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[Hit02], 0x10, 0, __831, NULL, NULL, __830, NULL, NULL, + xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[SitShock01], 0x10, 0, __831, NULL, NULL, __830, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[CLBegin01], 0x10, 0, __831, NULL, NULL, __830, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[CLLoop01], 0x10, 0, __831, NULL, NULL, __830, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[CLEnd01], 0x10, 0, __831, NULL, NULL, __830, NULL, + NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[NoHeadIdle01], 0x10, 0, __831, NULL, NULL, __830, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[NoHeadWaving01], 0x10, 0, __831, NULL, NULL, __830, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[NoHeadGetUp01], 0x10, 0, __831, NULL, NULL, __830, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[NoHeadShotUp01], 0x10, 0, __831, NULL, NULL, __830, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[NoHeadShock01], 0x10, 0, __831, NULL, NULL, __830, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + xAnimTableNewState(table, g_strz_bossanim[NoHeadReplace01], 0x10, 0, __831, NULL, NULL, __830, + NULL, NULL, xAnimDefaultBeforeEnter, NULL, NULL); + + NPCC_BuildStandardAnimTran(table, g_strz_bossanim, ourAnims, 1, __842); + + return table; +} + U32 HeadIsCarried(xAnimTransition*, xAnimSingle*, void*) { return globals.player.carry.grabbed == sSandyPtr->headBoulder; From be630cec361c4fa761e520c25d08d51603e5b0a5 Mon Sep 17 00:00:00 2001 From: Livewire Date: Mon, 24 Mar 2025 23:54:08 -0400 Subject: [PATCH 10/11] ZNPCTypeVillager --- src/SB/Game/zNPCTypeDuplotron.cpp | 4 +- src/SB/Game/zNPCTypeVillager.cpp | 135 ++++++++++++++++++++++++++++++ src/SB/Game/zNPCTypeVillager.h | 29 ++++++- 3 files changed, 166 insertions(+), 2 deletions(-) diff --git a/src/SB/Game/zNPCTypeDuplotron.cpp b/src/SB/Game/zNPCTypeDuplotron.cpp index ef6745dfb..8f5cdbd27 100644 --- a/src/SB/Game/zNPCTypeDuplotron.cpp +++ b/src/SB/Game/zNPCTypeDuplotron.cpp @@ -99,6 +99,7 @@ xAnimTable* ZNPC_AnimTable_Duplotron() xAnimDefaultBeforeEnter, NULL, NULL); NPCC_BuildStandardAnimTran(table, g_strz_dupoanim, ourAnims, 1, 0.2); + return table; } void zNPCDuplotron::ParseINI() @@ -128,7 +129,8 @@ void zNPCDuplotron::SelfSetup() S32 zNPCDuplotron::IsAlive() { xPsyche* psy = this->psy_instinct; - psy->GIDOfActive(); + //psy->GIDOfActive(); + return psy->GIDOfActive(); } // non-matching: scheduling? diff --git a/src/SB/Game/zNPCTypeVillager.cpp b/src/SB/Game/zNPCTypeVillager.cpp index 4891b1403..e83131fdc 100644 --- a/src/SB/Game/zNPCTypeVillager.cpp +++ b/src/SB/Game/zNPCTypeVillager.cpp @@ -1,6 +1,19 @@ #include "zNPCTypeVillager.h" #include "zNPCTypes.h" +#include "zNPCGoals.h" + +#define ANIM_Idle01 1 +#define ANIM_Move01 2 +#define ANIM_Hurt01 3 +#define ANIM_Yawn01 4 +#define ANIM_Talk01 5 +#define ANIM_Flee01 6 +#define ANIM_Fear01 7 +#define ANIM_Pray01 8 +#define ANIM_Clap01 9 +#define ANIM_Special01 10 +#define ANIM_Unknown 0 extern char* g_strz_folkanim[26]; extern U32 g_hash_folkanim[26]; @@ -268,6 +281,120 @@ xAnimTable* ZNPC_AnimTable_SuperFriend() return ZNPC_AnimTable_SuperFriend(NULL); } +U8 zNPCVillager::PhysicsFlags() const +{ + S32 flags = 0; + S32 pflags = 0; + if (flg_move & 0x6) + { + flags |= 3; + } + pflags = flags * -5; + if (flg_move & 0x2) + { + pflags = flags |= 4; + } + + return pflags; +} + +void zNPCVillager::Init(xEntAsset* asset) +{ + zNPCCommon::Init(asset); + zNPCCommon::flg_move = 10; + zNPCCommon::flg_vuln = 0; +} + +// void zNPCVillager::Reset() //Not sure what the correct values are for the IFs +// { +// NPCConfig* cfg; +// this->zNPCCommon::Reset(); + +// if (psy_instinct != 0) +// { +// this->psy_instinct->GoalSet(NPC_GOAL_IDLE, 1); +// } +// } + +void zNPCVillager::ParseINI() +{ + zNPCCommon::ParseINI(); + cfg_npc->snd_traxShare = &g_sndTrax_Villager; + NPCS_SndTablePrepare((NPCSndTrax*)&g_sndTrax_Villager); + zNPCVillager::ParseNonRandTalk(); +} + +void zNPCVillager::ParseNonRandTalk() +{ + // NPCConfig* cfg; //0x1d8 + // F32 non_choices[4]; + // S32 found; + // S32 i; + // U8 skip; + // S32 j; + + // cfg = cfg_npc; + // cfg = 0; + // non_choices[0] = 0.0; + // non_choices[1] = 0.0; + // non_choices[2] = 0.0; + // non_choices[3] = 0.0; + + // +} + +void zNPCVillager::Process(xScene* xscn, float dt) +{ + zNPCVillager::ChkCheatSize(); + if (psy_instinct != 0) + { + this->psy_instinct->Timestep(dt, NULL); + } + zNPCCommon::Process(xscn, dt); +} + +void zNPCVillager::SpeakBegin() +{ + psy_instinct->GoalSet(NPC_GOAL_SPEAK, 1); +} + +void zNPCVillager::SpeakEnd() //80% +{ + xPsyche* psy = psy_instinct; + psy->GIDInStack(NPC_GOAL_LIMBO); + + if ((psy == 0) && (psy->GIDOfSafety() != 0)) + { + psy->GoalSet(NPC_GOAL_LIMBO, 1); + } +} + +void zNPCVillager::TossMyConverse() +{ + converse = 0; +} + +void zNPCFish::ParseINI() +{ + zNPCVillager::ParseINI(); + zNPCFish::FishSoundTables(); +} + +// void zNPCFish::FishSoundTables() +// { +// S32 tempR; +// tempR = xNPCBasic::SelfType(); +// switch (tempR) +// { +// case 'NTF0': +// { +// } +// case 'NPC_TYPE_FISH_MALE': +// { +// } +// } +// } + /* void FOLK_InitEffects() { @@ -301,6 +428,14 @@ void zNPCFish::CheckDoChat() { } +void zNPCMerManChair::Init(xEntAsset*) //Seems to load an extra value? +{ + zNPCVillager::Init(asset); + flg_move = 1; + flg_vuln = -1; + flg_vuln = flg_vuln & 0x9effffff; +} + void ztaskbox::callback::on_talk_start() { } diff --git a/src/SB/Game/zNPCTypeVillager.h b/src/SB/Game/zNPCTypeVillager.h index 11f03a669..6549982c8 100644 --- a/src/SB/Game/zNPCTypeVillager.h +++ b/src/SB/Game/zNPCTypeVillager.h @@ -18,7 +18,7 @@ struct HiThere : ztaskbox::callback struct zNPCVillager : zNPCCommon { HiThere hithere; - ztaskbox* converse; + ztaskbox* converse; //0x2a8 S32 current_talk_anim; zNPCVillager(S32 myType); @@ -26,6 +26,18 @@ struct zNPCVillager : zNPCCommon void FindMyConverse(); U8 ColPenByFlags() const; U8 ColChkByFlags() const; + U8 ColPenFlags() const; + U8 PhysicsFlags() const; + void Init(xEntAsset*); + void Reset(); + void ParseINI(); + void ParseNonRandTalk(); + void Process(xScene* xscn, float dt); + void SelfSetup(); + void SpeakBegin(); + void SpeakEnd(); + void TossMyConverse(); + void ChkCheatSize(); F32 GenShadCacheRad(); }; @@ -37,6 +49,8 @@ struct zNPCFish : zNPCVillager xEntDrive raw_drvdata; zNPCFish(S32 myType); + void ParseINI(); + void FishSoundTables(); void CheckDoChat(); }; @@ -77,6 +91,7 @@ struct zNPCMerManChair : zNPCVillager S32 flg_mermanchair; zNPCMerManChair(S32 myType); + void Init(xEntAsset*); U8 PhysicsFlags() const; U8 ColPenFlags() const; U8 ColChkFlags() const; @@ -192,5 +207,17 @@ void ZNPC_Villager_Startup(); void ZNPC_Villager_Shutdown(); xFactoryInst* ZNPC_Create_Villager(S32 who, RyzMemGrow* growCtxt, void*); void ZNPC_Destroy_Villager(xFactoryInst* inst); +NPCSndTrax g_sndTrax_Villager; +S32 zParamGetFloatList(xModelAssetParam* parmdata, U32 pdatsize, const char* str32, S32 found, + F32* non_choices, F32 len_mvptspline); + +extern NPCSndTrax g_sndTrax_VillagerMale; +extern NPCSndTrax g_sndTrax_VillagerFemale; +extern NPCSndTrax g_sndTrax_VillagerElder; +extern NPCSndTrax g_sndTrax_VillagerEldess; +extern NPCSndTrax g_sndTrax_VillagerBoy; +extern NPCSndTrax g_sndTrax_VillagerGirl; +extern NPCSndTrax g_sndTrax_VillagerCoStar; +extern NPCSndTrax g_sndTrax_Squidward; #endif From 4c7e35aedc7c3c63d00b754796dda085648a6108 Mon Sep 17 00:00:00 2001 From: Livewire Date: Wed, 26 Mar 2025 00:41:22 -0400 Subject: [PATCH 11/11] ZNPCTypeVillager functions --- src/SB/Game/zNPCGoals.cpp | 4 +- src/SB/Game/zNPCTypeVillager.cpp | 105 +++++++++++++++++++++++++++++++ src/SB/Game/zNPCTypeVillager.h | 27 ++++++-- 3 files changed, 128 insertions(+), 8 deletions(-) diff --git a/src/SB/Game/zNPCGoals.cpp b/src/SB/Game/zNPCGoals.cpp index 3920d92eb..5c19fb03b 100644 --- a/src/SB/Game/zNPCGoals.cpp +++ b/src/SB/Game/zNPCGoals.cpp @@ -43,7 +43,7 @@ void zNPCGoals_RegisterTypes(xFactory* fac) NPC_GOAL_TALK, GOALCreate_Villager, GOALDestroy_Goal, NPC_GOAL_CHATTER, GOALCreate_Villager, GOALDestroy_Goal, NPC_GOAL_SPEAK, GOALCreate_Villager, GOALDestroy_Goal, - NPC_GOAL_BALLOON, GOALCreate_Villager, GOALDestroy_Goal, + NPC_GOAL_BALLOON, GOALCreate_Villager, GOALDestroy_Goal, //0x533e NPC_GOAL_BOYRIDE, GOALCreate_Villager, GOALDestroy_Goal, NPC_GOAL_BOYFALL, GOALCreate_Villager, GOALDestroy_Goal, NPC_GOAL_BOYWEEP, GOALCreate_Villager, GOALDestroy_Goal, @@ -201,4 +201,4 @@ void zNPCGoals_RegisterTypes(xFactory* fac) // clang-format on fac->RegItemType(typelist); -} \ No newline at end of file +} diff --git a/src/SB/Game/zNPCTypeVillager.cpp b/src/SB/Game/zNPCTypeVillager.cpp index e83131fdc..6d6506c70 100644 --- a/src/SB/Game/zNPCTypeVillager.cpp +++ b/src/SB/Game/zNPCTypeVillager.cpp @@ -315,6 +315,9 @@ void zNPCVillager::Init(xEntAsset* asset) // this->psy_instinct->GoalSet(NPC_GOAL_IDLE, 1); // } // } +void zNPCVillager::Reset() +{ +} void zNPCVillager::ParseINI() { @@ -374,6 +377,10 @@ void zNPCVillager::TossMyConverse() converse = 0; } +void zNPCFish::Reset() +{ +} + void zNPCFish::ParseINI() { zNPCVillager::ParseINI(); @@ -436,6 +443,104 @@ void zNPCMerManChair::Init(xEntAsset*) //Seems to load an extra value? flg_vuln = flg_vuln & 0x9effffff; } +void zNPCNewsFish::SpeakStop() +{ + S32 tempvar = zNPCNewsFish::IsTalking(); + if (tempvar != 0) + { + xSndStop(soundHandle); + } + currSoundID = 0; + nextSoundID = 0; + soundHandle = 0; + jawData = 0; +} + +S32 zNPCNewsFish::IsTalking() +{ + return (soundHandle) ? xSndIsPlayingByHandle(soundHandle) : false; +} + +void zNPCNewsFish::TalkOnScreen(S32 talkOnScreen) +{ + if (talkOnScreen != 0) + { + newsfishFlags = newsfishFlags | 1; + return; + } + newsfishFlags = newsfishFlags & 0xfffffffe; + return; +} + +void zNPCNewsFish::reset_said() +{ + // +} + +void zNPCSandyBikini::Reset() //100% code match +{ + zNPCVillager::Reset(); + tmr_leakCycle = 0.0; +} + +void zNPCSandyBikini::Process(xScene* xscn, float dt) //100% code match +{ + zNPCVillager::Process(xscn, dt); + zNPCSandyBikini::VFXLeakyFaucet(dt); +} + +void zNPCBalloonBoy::Init(xEntAsset* asset) //68% +{ + zNPCFish::Init(asset); + rast_shadBalloon = 0; + bound.type = 0; + + //cg_npc 0x1d8 + //bound.type 0x84 +} + +void zNPCBalloonBoy::SelfSetup() //100% code match +{ + xPsyche* psy; + zNPCFish::SelfSetup(); + psy = psy_instinct; + psy->BrainExtend(); + zNPCBalloonBoy::AddBallooning(psy); + psy->BrainEnd(); +} + +void zNPCBalloonBoy::Render() +{ + xNPCBasic::Render(); + zNPCBalloonBoy::PlatShadRend(); +} + +void zNPCBalloonBoy::AddBallooning(xPsyche* psy) +{ + psy->AddGoal(NPC_GOAL_BALLOON, NULL); + psy->AddGoal(NPC_GOAL_BOYRIDE, NULL); + psy->AddGoal(NPC_GOAL_BOYFALL, NULL); + psy->AddGoal(NPC_GOAL_BOYWEEP, NULL); + psy->AddGoal(NPC_GOAL_BOYSWIM, NULL); +} + +void zNPCBalloonBoy::PlatAnimSet(en_BBOY_PLATANIM platanim) +{ + F32 fvals[4]; +} + +void zNPCBalloonBoy::PlatAnimSync() +{ + zNPCCommon::AnimCurState(); +} + +void zNPCBubbleBuddy::Reset() // possible scheduling meme? +{ + zNPCFish::Reset(); + // flags = flags | 0x40; + flags |= 0x40; +} + void ztaskbox::callback::on_talk_start() { } diff --git a/src/SB/Game/zNPCTypeVillager.h b/src/SB/Game/zNPCTypeVillager.h index 6549982c8..89ad80795 100644 --- a/src/SB/Game/zNPCTypeVillager.h +++ b/src/SB/Game/zNPCTypeVillager.h @@ -52,11 +52,15 @@ struct zNPCFish : zNPCVillager void ParseINI(); void FishSoundTables(); void CheckDoChat(); + void Reset(); + void SelfSetup(); }; struct zNPCBubbleBuddy : zNPCFish { zNPCBubbleBuddy(S32 myType); + + void Reset(); }; enum en_BBOY_PLATANIM @@ -72,18 +76,27 @@ struct zNPCBalloonBoy : zNPCFish S32 specialBalloon; zPlatform* plat_balloons; xShadowCache* shadCache; + RwRaster* rast_shadBalloon; zNPCBalloonBoy(S32 myType); + void Init(xEntAsset* asset); + void SelfSetup(); + void Render(); + void PlatShadRend(); + void AddBallooning(xPsyche* psy); void PlatAnimSet(en_BBOY_PLATANIM anim); void PlatAnimSync(); }; struct zNPCSandyBikini : zNPCVillager { - F32 tmr_leakCycle; + F32 tmr_leakCycle; //0xac zNPCSandyBikini(S32 myType); + void Reset(); + void Process(xScene* xscn, float dt); + void VFXLeakyFaucet(float dt); }; struct zNPCMerManChair : zNPCVillager @@ -107,12 +120,12 @@ struct zNPCNewsFish : zNPCVillager say_data said[71]; U8 was_reset; - U32 soundHandle; - U32 currSoundID; - U32 nextSoundID; - F32 jawTime; + U32 soundHandle; //0x4ec + U32 currSoundID; //0x4f0 + U32 nextSoundID; //0x4f4 + F32 jawTime; //0x4f8 void* jawData; - U32 newsfishFlags; + U32 newsfishFlags; //0x500 xVec2 onScreenCoords; xVec2 offScreenCoords; xVec2 screenCoords; @@ -121,6 +134,8 @@ struct zNPCNewsFish : zNPCVillager F32 appearSpeed; F32 disappearSpeed; F32 screenLerp; + S32 IsTalking(); + void reset_said(); zNPCNewsFish(S32 myType);