diff --git a/src/SB/Game/zNPCTypeBossPlankton.cpp b/src/SB/Game/zNPCTypeBossPlankton.cpp index 78cf10362..9a061f72f 100644 --- a/src/SB/Game/zNPCTypeBossPlankton.cpp +++ b/src/SB/Game/zNPCTypeBossPlankton.cpp @@ -23,6 +23,15 @@ #define ANIM_attack_missle 76 //0x4c #define ANIM_attack_bomb 77 //0x4d +namespace +{ + S32 init_sound() + { + return 0; + } + +} // namespace + xAnimTable* ZNPC_AnimTable_BossPlankton() { // clang-format off @@ -130,6 +139,110 @@ xAnimTable* ZNPC_AnimTable_BossPlankton() return table; } +void zNPCBPlankton::Init(xEntAsset* asset) //66% +{ + ::init_sound(); + zNPCCommon::Init(asset); + flg_move = 1; + flg_vuln = 1; + xNPCBasic::RestoreColFlags(); + territory_size = 0; + played_intro = 0; + zNPCBPlankton::init_beam(); + xAnimPlay* play = 0; + + // Is being called incorrectly. + // play is a temp fix to get it to build + zNPCBPlankton::aim_gun(play, &gun_tilt, &move.dest, 0); +} + +void zNPCBPlankton::Destroy() +{ + zNPCCommon::Destroy(); +} + +void zNPCBPlankton::Process(xScene* xscn, float dt) +{ + // This function needs a lot of work, writing most of these comments + // so that i can resume where i left off when i return to it + + // territory_data& t ; + //xCollis& coll; + xEnt* platform; + S32 i; + + //xVec3& player_loc; + xPsyche* psy = psy_instinct; + + if ((flag.updated == false) && (flag.updated = 1, played_intro == false)) + { + zNPCBPlankton::say(0, 0, true); + played_intro = true; + } + beam.update(dt); + delay = delay + dt; + if ((mode == 1) && (territory->fuse_detected = player_left_territory(), psy_instinct != 0)) + { + stun_duration = 0.0f; + psy_instinct->GoalSet(NPC_GOAL_BPLANKTONAMBUSH, 1); + } + // uvar1 = zNPCCommon::SomethingWonderful(); + //if ((uVar1 & 0x23) == 0) + // { + // psy_instinct->xPsyche::Timestep(dt, 0) + // } + if (flag.face_player = false) + { + // iVar4 = *(int *)(DAT_803c0c5c + 0x4c); + // pfVar2 = (float *)location__13zNPCBPlanktonCFv(param_9); + // param_3 = (double)*(float *)(iVar4 + 0x30); + // param_2 = (double)(*(float *)(iVar4 + 0x38) - pfVar2[2]); + // assign__5xVec2Fff((double)(float)(param_3 - (double)*pfVar2),param_2,(float *)(param_9 + 0x460)); + // normalize__5xVec2Fv((float *)(param_9 + 0x460)); + } + update_follow(dt); + update_turn(dt); + update_move(dt); + update_animation(dt); //uvar5 = update anim + check_player_damage(); //uvar1 = check_player_damage + if (psy_instinct != 0) //psy_instinct isnt right, needs (uvar1 & 0xff) + { + zEntPlayer_Damage(0, 1); //needs xBase* instead of 0 + } + update_aim_gun(dt); + update_dialog(dt); + //bVar3 = visible__17xLaserBoltEmitterCFv(param_9 + 0x3b8); + //if (bVar3) { + // *(uint *)(param_9 + 0x234) = *(uint *)(param_9 + 0x234) | 2; + //} + //Process__10zNPCCommonFP6xScenef(param_1,param_9,param_10); +} + +void zNPCBPlankton::Render() +{ + xNPCBasic::Render(); + zNPCBPlankton::render_debug(); +} + +void zNPCBPlankton::SelfSetup() +{ + xBehaveMgr* bmgr = xBehaveMgr_GetSelf(); + this->psy_instinct = bmgr->Subscribe(this, NULL); + xPsyche* psy = this->psy_instinct; + psy->BrainBegin(); + for (S32 i = NPC_GOAL_BPLANKTONIDLE; i <= NPC_GOAL_BPLANKTONBOMB; i++) + { + psy->AddGoal(i, this); + } + psy->BrainEnd(); + psy->SetSafety(NPC_GOAL_BPLANKTONIDLE); +} + +U32 zNPCBPlankton::AnimPick(int, en_NPC_GOAL_SPOT, xGoal*) +{ + return 0; +} + void zNPCBPlankton::render_debug() { } diff --git a/src/SB/Game/zNPCTypeBossPlankton.h b/src/SB/Game/zNPCTypeBossPlankton.h index 23eac1218..f2a7d97af 100644 --- a/src/SB/Game/zNPCTypeBossPlankton.h +++ b/src/SB/Game/zNPCTypeBossPlankton.h @@ -8,6 +8,7 @@ #include "xDecal.h" #include "xLaserBolt.h" #include "xTimer.h" +#include "zNPCGoals.h" struct zNPCNewsFish; @@ -57,16 +58,16 @@ struct zNPCBPlankton : zNPCBoss struct { - bool updated; - bool face_player; - bool attacking; - bool hunt; + bool updated; //0x2b4 + bool face_player; //0x2b5 + bool attacking; //0x2b6 + bool hunt; //0x2b7 bool aim_gun; move_enum move; follow_enum follow; } flag; mode_enum mode; - F32 delay; + F32 delay; //0x2c8 xQuat gun_tilt; F32 ambush_delay; F32 beam_duration; @@ -95,19 +96,35 @@ struct zNPCBPlankton : zNPCBoss } follow; struct { - U8 moreFlags; + U8 moreFlags; //0x4ac } old; zNPCBoss* crony; territory_data territory[8]; - S32 territory_size; + S32 territory_size; //0x694 S32 active_territory; zNPCNewsFish* newsfish; - U32 old_player_health; - U8 played_intro; + U32 old_player_health; //0x6a0 + U8 played_intro; //0x6a4 zNPCBPlankton(S32 myType); + void Init(xEntAsset*); + void Destroy(); + void Process(xScene*, float); + void Render(); + void SelfSetup(); + U32 AnimPick(int, en_NPC_GOAL_SPOT, xGoal*); void render_debug(); + void update_turn(float); + void update_move(float); + void check_player_damage(); void update_animation(float); + void update_follow(float); + void update_aim_gun(float); + void update_dialog(float); + void init_beam(); + S32 player_left_territory(); + void say(int, int, bool); + void aim_gun(xAnimPlay*, xQuat*, xVec3*, int); void here_boy(); S32 IsAlive(); U8 ColPenFlags() const; diff --git a/src/SB/Game/zNPCTypeBossSB2.cpp b/src/SB/Game/zNPCTypeBossSB2.cpp index 7abccae4c..89d99eaa0 100644 --- a/src/SB/Game/zNPCTypeBossSB2.cpp +++ b/src/SB/Game/zNPCTypeBossSB2.cpp @@ -1,5 +1,6 @@ #include "zNPCTypeBossSB2.h" +#include "xLightKit.h" #include "zNPCGoalCommon.h" #include #include "string.h" @@ -255,6 +256,34 @@ void zNPCB_SB2::decompose() { } +void zNPCB_SB2::show_nodes() +{ + // Haven't found 0x74 + S32 i; + for (i = 0; i < 9; i++) + { + if (nodes->ent != 0){ + xEntShow(nodes->ent); + } + } + +} + +void zNPCB_SB2::ouchie() +{ + xPsyche* psy = psy_instinct; + S32 tempOuch; + tempOuch = psy_instinct->GIDOfActive(); + if (tempOuch != NPC_GOAL_BOSSSB2HIT) + { + set_vulnerable(false); + psy_instinct->GoalSet(NPC_GOAL_BOSSSB2HIT, 1); + } + +} + + + void zNPCB_SB2::Render() { xNPCBasic::Render(); @@ -321,6 +350,11 @@ void zNPCB_SB2::reset_stage() stage_delay = 0; } +void zNPCB_SB2::destroy_glow_light() +{ + xLightKit_Destroy(&glow_light.kit); +} + S32 zNPCGoalBossSB2Intro::Enter(float dt, void* updCtxt) { if (owner.said_intro == 0) @@ -477,3 +511,12 @@ S32 zNPCGoalBossSB2Death::Process(en_trantype*, F32, void*, xScene*) { return 0; } + +// WEAK + +void zNPCB_SB2::choose_hand() //53% +{ + S32 rand; + rand = xrand() >> 0xd & 1; + +} diff --git a/src/SB/Game/zNPCTypeBossSB2.h b/src/SB/Game/zNPCTypeBossSB2.h index 3804ae10f..698547e3a 100644 --- a/src/SB/Game/zNPCTypeBossSB2.h +++ b/src/SB/Game/zNPCTypeBossSB2.h @@ -191,6 +191,8 @@ struct zNPCB_SB2 : zNPCBoss void Destroy(); void render_debug(); void decompose(); + void show_nodes(); + void ouchie(); void destroy_glow_light(); void Render(); F32 AttackTimeLeft(); @@ -201,10 +203,14 @@ struct zNPCB_SB2 : zNPCBoss void activate_hand(zNPCB_SB2::hand_enum, bool); void deactivate_hand(zNPCB_SB2::hand_enum); S32 player_on_ground() const; + S32 slugs_ready() const; void reset_stage(); void abandon_slugs(); void set_vulnerable(bool); void say(int); + + // WEAK + void choose_hand(); }; struct zNPCGoalBossSB2Intro : zNPCGoalCommon