From f50bd4881a34a2ba26da0d4f05ac7e0b05fa8004 Mon Sep 17 00:00:00 2001 From: Livewire Date: Tue, 18 Mar 2025 00:06:10 -0400 Subject: [PATCH 1/7] 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 2/7] 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 3/7] 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 4/7] 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 5/7] 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 6/7] 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 7/7] 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);