From 1620763703a3dd48fbb20f6d84bd302834608761 Mon Sep 17 00:00:00 2001 From: Matt P Date: Fri, 28 Mar 2025 21:45:50 -0500 Subject: [PATCH 1/6] ship it, YOLO --- .github/workflows/build.yml | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5382a09f5..979d82796 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -141,7 +141,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: write - needs: + needs: - build - build-previous if: github.ref == 'refs/heads/main' @@ -197,3 +197,28 @@ jobs: github_token: ${{ secrets.WEBSITE_TOKEN }} repository: bfbbdecomp/website branch: ${{ github.ref }} + pr-comment: + runs-on: ubuntu-latest + needs: + - build + - build-previous + if: github.event_name == 'pull_request' + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Run OK command + id: ok-command + run: | + OK --previous build/${{ matrix.version }}/previous.json --current build/${{ matrix.version }}/progress.json pr > result.txt + cat result.txt + + - name: Post comment to PR + run: | + PR_NUMBER=$(jq --raw-output .pull_request.number $GITHUB_EVENT_PATH) + COMMENT_BODY=$(cat result.txt) + curl -X POST \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "Content-Type: application/json" \ + --data "{\"body\":\"$COMMENT_BODY\"}" \ + "https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/comments" From 869d1310db272fb9ecba9f2f1dac87787bb234ca Mon Sep 17 00:00:00 2001 From: Livewire Date: Fri, 28 Mar 2025 23:22:26 -0400 Subject: [PATCH 2/6] test --- .github/workflows/build.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ea8f0e7c6..2db014404 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -197,3 +197,38 @@ jobs: github_token: ${{ secrets.WEBSITE_TOKEN }} repository: bfbbdecomp/website branch: ${{ github.ref }} + pr-comment: + runs-on: ubuntu-latest + needs: + - build + - build-previous + if: github.event_name == 'pull_request' + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Download Progress Artifacts + uses: actions/download-artifact@v4 + with: + path: ./artifacts + + - name: Download OK bot + id: download-ok + run: | + python ./tools/download_tool.py ok . --tag v0.1.1 + + - name: Run OK command + id: ok-command + run: | + ./ok --previous artifacts/previous.json --current artifacts/progress.json pr > pr.txt + cat pr.txt + + - name: Post comment to PR + run: | + PR_NUMBER=$(jq --raw-output .pull_request.number $GITHUB_EVENT_PATH) + COMMENT_BODY=$(cat pr.txt) + curl -X POST \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "Content-Type: application/json" \ + --data "{\"body\":\"$COMMENT_BODY\"}" \ + "https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/comments" From 371797fb395dd6ce812c4ff8430d50495f6a1b1e Mon Sep 17 00:00:00 2001 From: Livewire Date: Tue, 1 Apr 2025 20:04:56 -0400 Subject: [PATCH 3/6] BossSB2 functions and mem offsets --- src/SB/Game/zNPCTypeBossPlankton.h | 3 +- src/SB/Game/zNPCTypeBossSB2.cpp | 266 ++++++++++++++++++++++++++++- src/SB/Game/zNPCTypeBossSB2.h | 71 +++++--- src/SB/Game/zNPCTypeCommon.h | 4 +- 4 files changed, 321 insertions(+), 23 deletions(-) diff --git a/src/SB/Game/zNPCTypeBossPlankton.h b/src/SB/Game/zNPCTypeBossPlankton.h index b0930a8f4..23eac1218 100644 --- a/src/SB/Game/zNPCTypeBossPlankton.h +++ b/src/SB/Game/zNPCTypeBossPlankton.h @@ -108,6 +108,7 @@ struct zNPCBPlankton : zNPCBoss zNPCBPlankton(S32 myType); void render_debug(); void update_animation(float); + void here_boy(); S32 IsAlive(); U8 ColPenFlags() const; U8 ColChkFlags() const; @@ -237,6 +238,6 @@ struct zNPCGoalBPlanktonBomb : zNPCGoalCommon S32 Process(en_trantype*, float, void*, xScene*); }; -xAnimTable * ZNPC_AnimTable_BossPlankton(); +xAnimTable* ZNPC_AnimTable_BossPlankton(); #endif diff --git a/src/SB/Game/zNPCTypeBossSB2.cpp b/src/SB/Game/zNPCTypeBossSB2.cpp index d631307f1..7abccae4c 100644 --- a/src/SB/Game/zNPCTypeBossSB2.cpp +++ b/src/SB/Game/zNPCTypeBossSB2.cpp @@ -1,5 +1,6 @@ #include "zNPCTypeBossSB2.h" +#include "zNPCGoalCommon.h" #include #include "string.h" #include "iModel.h" @@ -17,7 +18,6 @@ #include "zGrid.h" #include "zNPCTypeBossPatrick.h" #include "zRenderState.h" -#include "zNPCGoals.h" #include "zLightning.h" #include "zNPCTypeRobot.h" #include @@ -50,6 +50,34 @@ #define ANIM_KarateLoop 64 #define ANIM_KarateEnd 65 +namespace +{ + S32 set_alpha_blend(xModelInstance*) + { + return 0; // to-do + } + + F32 max(float maxFloat1, float maxFloat2) //Temp names till file is further + { + if (maxFloat1 > maxFloat2) + { + return maxFloat1; + } + return maxFloat2; + } + + S32 tweak() + { + return 0; // to-do + } + + S32 play_sound(int, const xVec3*, float) + { + return 0; // to-do + } + +} // namespace + xAnimTable* ZNPC_AnimTable_BossSB2() { // clang-format off @@ -197,6 +225,28 @@ xAnimTable* ZNPC_AnimTable_BossSB2() return table; } +void zNPCB_SB2::SelfSetup() +{ + xBehaveMgr* bmgr = xBehaveMgr_GetSelf(); + xPsyche* psy = 0; + this->psy_instinct = bmgr->Subscribe(this, NULL); + this->psy_instinct->BrainBegin(); + for (S32 i = NPC_GOAL_BOSSSB2INTRO; i <= NPC_GOAL_BOSSSB2DEATH; i++) + { + psy_instinct->AddGoal(i, this); + } + psy_instinct->AddGoal(NPC_GOAL_LIMBO, this); + psy_instinct->BrainEnd(); + psy_instinct->SetSafety(NPC_GOAL_BOSSSB2IDLE); +} + +void zNPCB_SB2::Destroy() +{ + zNPCB_SB2::destroy_glow_light(); + zNPCCommon::Destroy(); +} + + void zNPCB_SB2::render_debug() { } @@ -205,10 +255,224 @@ void zNPCB_SB2::decompose() { } +void zNPCB_SB2::Render() +{ + xNPCBasic::Render(); + zNPCB_SB2::render_debug(); +} + +F32 zNPCB_SB2::AttackTimeLeft() +{ + if (flag.dizzy != false) + { + return 0.0f; + } + return 1e38f; +} + void zNPCB_SB2::HoldUpDude() { } +void zNPCB_SB2::ThanksImDone() +{ + flag.dizzy = false; +} + +void zNPCB_SB2::reset_speed() //tweak in .bss +{ + turn.accel = 0; + turn.max_vel = 0; +} + +S32 zNPCB_SB2::player_platform() +{ + return 0; // to-do +} + +void zNPCB_SB2::activate_hand(zNPCB_SB2::hand_enum, bool) +{ + hands[0].hurt_player = 1; + hands[0].hit_platforms = 0x10; + penby = 0x10; +} + +void zNPCB_SB2::deactivate_hand(zNPCB_SB2::hand_enum) +{ + hands[0].hit_platforms = 0; + hands[0].hurt_player = 0x10; + penby = 0x10; +} + +S32 zNPCB_SB2::player_on_ground() const +{ + return 0; + // to-do +} + +void zNPCB_SB2::abandon_slugs() +{ + +} + +void zNPCB_SB2::reset_stage() +{ + stage = -1; + stage_delay = 0; +} + +S32 zNPCGoalBossSB2Intro::Enter(float dt, void* updCtxt) +{ + if (owner.said_intro == 0) + { + owner.say(0); + owner.said_intro = 1; + } + owner.delay = 0.0f; + zEntPlayerControlOff(CONTROL_OWNER_BOSS); + return zNPCGoalCommon::Enter(dt, updCtxt); + +} + +S32 zNPCGoalBossSB2Intro::Exit(float dt, void* updCtxt) +{ + zEntPlayerControlOn(CONTROL_OWNER_BOSS); + return xGoal::Exit(dt, updCtxt); +} + +S32 zNPCGoalBossSB2Idle::Enter(float dt, void* updCtxt) +{ + transitioning = 1; + return zNPCGoalCommon::Enter(dt, updCtxt); +} + +S32 zNPCGoalBossSB2Idle::Exit(float dt, void* updCtxt) +{ + return xGoal::Exit(dt, updCtxt); +} + +S32 zNPCGoalBossSB2Taunt::Enter(float dt, void* updCtxt) +{ + ::play_sound(0, &owner.sound_loc.mouth , 1.0f); + owner.flag.face_player = 1; + return zNPCGoalCommon::Enter(dt, updCtxt); +} + +S32 zNPCGoalBossSB2Taunt::Exit(float dt, void* updCtxt) +{ + return xGoal::Exit(dt, updCtxt); +} + +S32 zNPCGoalBossSB2Dizzy::Enter(float dt, void* updCtxt) +{ + sicked = 0; + owner.flag.face_player = 0; + owner.delay = 0; + owner.set_vulnerable(false); + return zNPCGoalCommon::Enter(dt, updCtxt); +} + +S32 zNPCGoalBossSB2Dizzy::Exit(float dt, void* updCtxt) +{ + S32 tempDizzy; + owner.set_vulnerable(true); + if (sicked != false && owner.player_on_ground() == 0) //Not compared correctly + { + owner.plankton->here_boy(); + } + if (owner.life == 1) + { + owner.say(6); + } + else if (owner.flag.dizzy == false) + { + owner.say(0xb); + } + return xGoal::Exit(dt, updCtxt); +} + +S32 zNPCGoalBossSB2Hit::Enter(float dt, void* updCtxt) +{ + // Function needs set up differently + // im just dumb + + S32 tempHitVar; + + owner.flag.face_player = 1; + owner.set_vulnerable(false); + + if (owner.flag.dizzy == false) { + if (owner.life < 4){ + if (owner.life < 2){ + if (owner.life > 0){ + owner.say(9); + } + } + else { + owner.say(2); + } + } + else { + owner.say(3); + } + } + else { + owner.say(4); + } + +return zNPCGoalCommon::Enter(dt, updCtxt); +} + +S32 zNPCGoalBossSB2Hit::Exit(float dt, void* updCtxt) +{ + owner.set_vulnerable(true); + return xGoal::Exit(dt, updCtxt); +} + +S32 zNPCGoalBossSB2Swipe::Exit(float dt, void* updCtxt) +{ + owner.flag.face_player = true; + owner.deactivate_hand(owner.active_hand); + return xGoal::Exit(dt, updCtxt); +} + +S32 zNPCGoalBossSB2Swipe::can_start() const +{ + S32 tempStart; + tempStart = owner.player_platform(); + return tempStart != 0; +} + +S32 zNPCGoalBossSB2Chop::Exit(float dt, void* updCtxt) +{ + owner.deactivate_hand(owner.active_hand); + return xGoal::Exit(dt, updCtxt); +} + +S32 zNPCGoalBossSB2Karate::Exit(float dt, void* updCtxt) +{ + owner.abandon_slugs(); + return xGoal::Exit(dt, updCtxt); +} + +S32 zNPCGoalBossSB2Karate::can_start() const +{ + S32 tempStart; + tempStart = owner.player_platform(); + return tempStart != 0; +} + +S32 zNPCGoalBossSB2Death::Enter(float dt, void* updCtxt) +{ + owner.decompose(); + return zNPCGoalCommon::Enter(dt, updCtxt); +} + +S32 zNPCGoalBossSB2Death::Exit(float dt, void* updCtxt) +{ + return xGoal::Exit(dt, updCtxt); +} + S32 zNPCGoalBossSB2Death::Process(en_trantype*, F32, void*, xScene*) { return 0; diff --git a/src/SB/Game/zNPCTypeBossSB2.h b/src/SB/Game/zNPCTypeBossSB2.h index d584223a8..3804ae10f 100644 --- a/src/SB/Game/zNPCTypeBossSB2.h +++ b/src/SB/Game/zNPCTypeBossSB2.h @@ -4,6 +4,7 @@ #include "zNPCTypeBoss.h" #include "zNPCTypeBossPlankton.h" #include "zNPCGoalCommon.h" +#include "zNPCGoals.h" struct zNPCNewsFish; @@ -46,8 +47,8 @@ struct zNPCB_SB2 : zNPCBoss struct hand_data { - U8 hurt_player; - U8 hit_platforms; + U8 hurt_player; //0x714 if [0] + U8 hit_platforms; //0x715 if [0] xModelTag head_tag[4]; xModelTag tail_tag[4]; xEnt* ent; @@ -80,7 +81,7 @@ struct zNPCB_SB2 : zNPCBoss enum slug_stage { - SLUG_INACTIVE, + SLUG_INACTIVE, //0x152c if is used slugs[0].stage SLUG_AIM, SLUG_DELAY, SLUG_DYING, @@ -91,7 +92,7 @@ struct zNPCB_SB2 : zNPCBoss { slug_stage stage; U8 spun; - U8 abandoned; + U8 abandoned; //0x1531 if [0] F32 time; F32 stage_delay; xEnt* ent; @@ -122,7 +123,7 @@ struct zNPCB_SB2 : zNPCBoss { xVec2 dest; xVec2 dir; - F32 vel; + F32 vel; //0x17b8?? F32 yaw; F32 yaw_vel; }; @@ -131,20 +132,20 @@ struct zNPCB_SB2 : zNPCBoss { bool face_player; bool face_follow; - bool dizzy; + bool dizzy; //0x2b6 move_enum move; bool vulnerable; - bool cruise_exploding; + bool cruise_exploding; //0x2bd bool cruise_hit_body; - bool cruise_hit_target; + bool cruise_hit_target; //0x2bf bool nodes_taken; - bool updated; + bool updated; //0x2c1 } flag; S32 life; - S32 round; - S32 stage; - F32 delay; - F32 stage_delay; + S32 round; //0x2c8 + S32 stage; //0x2cc + F32 delay; //0x2d0 + F32 stage_delay; //0x2d4 F32 player_damage_timer; U32 old_player_health; hand_enum active_hand; @@ -161,24 +162,24 @@ struct zNPCB_SB2 : zNPCBoss { xVec2 dir; F32 vel; - F32 accel; - F32 max_vel; + F32 accel; //0x1790 + F32 max_vel; //0x1794 } turn; move_data move; struct { - F32 begin; + F32 begin; //0x17c4 F32 end; F32 time; - F32 end_time; + F32 end_time; //0x17d0 } ymove; struct { xVec3 body; - xVec3 mouth; + xVec3 mouth; //0x17e0 xVec3 hand[2]; } sound_loc; - F32 node_pulse; + F32 node_pulse; //0x1804 struct { xLightKit kit; @@ -186,9 +187,24 @@ struct zNPCB_SB2 : zNPCBoss } glow_light; zNPCB_SB2(S32 myType); + void SelfSetup(); + void Destroy(); void render_debug(); void decompose(); + void destroy_glow_light(); + void Render(); + F32 AttackTimeLeft(); void HoldUpDude(); + void ThanksImDone(); + void reset_speed(); + S32 player_platform(); + void activate_hand(zNPCB_SB2::hand_enum, bool); + void deactivate_hand(zNPCB_SB2::hand_enum); + S32 player_on_ground() const; + void reset_stage(); + void abandon_slugs(); + void set_vulnerable(bool); + void say(int); }; struct zNPCGoalBossSB2Intro : zNPCGoalCommon @@ -196,6 +212,8 @@ struct zNPCGoalBossSB2Intro : zNPCGoalCommon zNPCB_SB2& owner; static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); + S32 Enter(float, void*); + S32 Exit(float, void*); }; struct zNPCGoalBossSB2Idle : zNPCGoalCommon @@ -204,6 +222,8 @@ struct zNPCGoalBossSB2Idle : zNPCGoalCommon zNPCB_SB2& owner; static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); + S32 Enter(float, void*); + S32 Exit(float, void*); }; struct zNPCGoalBossSB2Taunt : zNPCGoalCommon @@ -211,6 +231,8 @@ struct zNPCGoalBossSB2Taunt : zNPCGoalCommon zNPCB_SB2& owner; static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); + S32 Enter(float, void*); + S32 Exit(float, void*); }; struct zNPCGoalBossSB2Dizzy : zNPCGoalCommon @@ -219,6 +241,8 @@ struct zNPCGoalBossSB2Dizzy : zNPCGoalCommon zNPCB_SB2& owner; static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); + S32 Enter(float, void*); + S32 Exit(float, void*); }; struct zNPCGoalBossSB2Hit : zNPCGoalCommon @@ -226,6 +250,8 @@ struct zNPCGoalBossSB2Hit : zNPCGoalCommon zNPCB_SB2& owner; static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); + S32 Enter(float, void*); + S32 Exit(float, void*); }; struct zNPCGoalBossSB2Hunt : zNPCGoalCommon @@ -247,6 +273,8 @@ struct zNPCGoalBossSB2Swipe : zNPCGoalCommon zNPCB_SB2& owner; static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); + S32 Exit(float, void*); + S32 can_start() const; }; struct zNPCGoalBossSB2Chop : zNPCGoalCommon @@ -259,6 +287,7 @@ struct zNPCGoalBossSB2Chop : zNPCGoalCommon zNPCB_SB2& owner; static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); + S32 Exit(float, void*); }; struct zNPCGoalBossSB2Karate : zNPCGoalCommon @@ -268,6 +297,8 @@ struct zNPCGoalBossSB2Karate : zNPCGoalCommon zNPCB_SB2& owner; static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); + S32 Exit(float, void*); + S32 can_start() const; }; struct zNPCGoalBossSB2Death : zNPCGoalCommon @@ -276,6 +307,8 @@ struct zNPCGoalBossSB2Death : zNPCGoalCommon static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); S32 Process(en_trantype*, F32, void*, xScene*); + S32 Enter(float, void*); + S32 Exit(float, void*); }; xAnimTable* ZNPC_AnimTable_BossSB2(); diff --git a/src/SB/Game/zNPCTypeCommon.h b/src/SB/Game/zNPCTypeCommon.h index c58f1d8c0..773b5f3fa 100644 --- a/src/SB/Game/zNPCTypeCommon.h +++ b/src/SB/Game/zNPCTypeCommon.h @@ -384,9 +384,9 @@ struct zNPCCommon : xNPCBasic //Size of zNPCCommon: 0x2A0 xEntDrive* drv_data; xPsyche* psy_instinct; // 0x228 zNPCCommon* npc_duplodude; - F32 spd_throttle; + F32 spd_throttle; //0x230 S32 flg_xtrarend; - F32 tmr_fidget; + F32 tmr_fidget; //0x238 F32 tmr_invuln; // 0x23C zShrapnelAsset* explosion; // 0x240 xModelAssetParam* parmdata; // 0x244 From a96d1e8d869d52416f69264ce8b238888353f5c8 Mon Sep 17 00:00:00 2001 From: Livewire Date: Wed, 2 Apr 2025 21:16:11 -0400 Subject: [PATCH 4/6] wip push --- src/SB/Game/zNPCTypeBossPlankton.cpp | 112 +++++++++++++++++++++++++++ src/SB/Game/zNPCTypeBossPlankton.h | 35 ++++++--- src/SB/Game/zNPCTypeBossSB2.cpp | 43 ++++++++++ src/SB/Game/zNPCTypeBossSB2.h | 6 ++ 4 files changed, 187 insertions(+), 9 deletions(-) diff --git a/src/SB/Game/zNPCTypeBossPlankton.cpp b/src/SB/Game/zNPCTypeBossPlankton.cpp index 78cf10362..19ba20a1f 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,109 @@ 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*) +{ +} + 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 From 132618724bdd81d332abdf20b765f23a48f0b086 Mon Sep 17 00:00:00 2001 From: Livewire Date: Wed, 2 Apr 2025 21:20:47 -0400 Subject: [PATCH 5/6] push fix --- src/SB/Game/zNPCTypeBossPlankton.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SB/Game/zNPCTypeBossPlankton.cpp b/src/SB/Game/zNPCTypeBossPlankton.cpp index 19ba20a1f..9a061f72f 100644 --- a/src/SB/Game/zNPCTypeBossPlankton.cpp +++ b/src/SB/Game/zNPCTypeBossPlankton.cpp @@ -240,6 +240,7 @@ void zNPCBPlankton::SelfSetup() U32 zNPCBPlankton::AnimPick(int, en_NPC_GOAL_SPOT, xGoal*) { + return 0; } void zNPCBPlankton::render_debug() From 165d8b9ee4eeb3edceadaf40a2533f31c8696ae9 Mon Sep 17 00:00:00 2001 From: Livewire Date: Thu, 3 Apr 2025 23:18:32 -0400 Subject: [PATCH 6/6] couple of bossplankton functions. --- src/SB/Game/zNPCTypeBossPlankton.cpp | 100 ++++++++++++++++++++++++++- src/SB/Game/zNPCTypeBossPlankton.h | 3 + 2 files changed, 101 insertions(+), 2 deletions(-) diff --git a/src/SB/Game/zNPCTypeBossPlankton.cpp b/src/SB/Game/zNPCTypeBossPlankton.cpp index 9a061f72f..ba6885a84 100644 --- a/src/SB/Game/zNPCTypeBossPlankton.cpp +++ b/src/SB/Game/zNPCTypeBossPlankton.cpp @@ -238,9 +238,101 @@ void zNPCBPlankton::SelfSetup() psy->SetSafety(NPC_GOAL_BPLANKTONIDLE); } -U32 zNPCBPlankton::AnimPick(int, en_NPC_GOAL_SPOT, xGoal*) +U32 zNPCBPlankton::AnimPick(S32 rawgoal, en_NPC_GOAL_SPOT gspot, xGoal* goal) { - return 0; + U32 animId = 0; + S32 index = 1; + + switch (rawgoal) + { + case NPC_GOAL_BPLANKTONIDLE: + case NPC_GOAL_BPLANKTONATTACK: + case NPC_GOAL_BPLANKTONAMBUSH: + case NPC_GOAL_BPLANKTONFLANK: + case NPC_GOAL_BPLANKTONEVADE: + case NPC_GOAL_BPLANKTONHUNT: + { + index = 1; + break; + } + case NPC_GOAL_BPLANKTONTAUNT: + { + index = 3; + break; + } + case NPC_GOAL_BPLANKTONMOVE: + { + index = 0x42; + break; + } + case NPC_GOAL_BPLANKTONSTUN: + case NPC_GOAL_BPLANKTONFALL: + case NPC_GOAL_BPLANKTONDIZZY: + { + index = 0x43; + break; + } + case NPC_GOAL_BPLANKTONBEAM: + { + index = 0x46; + break; + } + case NPC_GOAL_BPLANKTONWALL: + { + index = 0x49; + break; + } + case NPC_GOAL_BPLANKTONMISSLE: + { + index = 0x4c; + break; + } + case NPC_GOAL_BPLANKTONBOMB: + { + index = 0x4d; + break; + } + + default: + index = 1; + break; + } + + if (index > -1) + { + return animId = g_hash_bossanim[index]; + } + + return animId; +} + +S32 zNPCBPlankton::next_goal() +{ + // Not in the correct order? + S32 tempR; + U32 cronyAttack; + + if (mode == 0) + { + if (flag.hunt == false) + { + cronyAttack = crony_attacking(); + tempR = + ((0 - (cronyAttack & 0xff) | cronyAttack & 0xff) >> 0x1f) + NPC_GOAL_BPLANKTONHUNT; + //NPC_GOAL_BPLANKTONATTACK + } + else + { + tempR = NPC_GOAL_BPLANKTONATTACK; + //NPC_GOAL_BPLANKTONHUNT + } + } + else + { + tempR = NPC_GOAL_BPLANKTONEVADE; + //NPC_GOAL_BPLANKTONHUNT + } + return tempR; } void zNPCBPlankton::render_debug() @@ -251,6 +343,10 @@ void zNPCBPlankton::update_animation(float) { } +void zNPCBPlankton::vanish() +{ +} + S32 zNPCBPlankton::IsAlive() { return 1; diff --git a/src/SB/Game/zNPCTypeBossPlankton.h b/src/SB/Game/zNPCTypeBossPlankton.h index f2a7d97af..1d4c62553 100644 --- a/src/SB/Game/zNPCTypeBossPlankton.h +++ b/src/SB/Game/zNPCTypeBossPlankton.h @@ -113,6 +113,7 @@ struct zNPCBPlankton : zNPCBoss void Render(); void SelfSetup(); U32 AnimPick(int, en_NPC_GOAL_SPOT, xGoal*); + S32 next_goal(); void render_debug(); void update_turn(float); void update_move(float); @@ -122,6 +123,8 @@ struct zNPCBPlankton : zNPCBoss void update_aim_gun(float); void update_dialog(float); void init_beam(); + void vanish(); + U32 crony_attacking() const; S32 player_left_territory(); void say(int, int, bool); void aim_gun(xAnimPlay*, xQuat*, xVec3*, int);