diff --git a/src/SB/Core/x/containers.h b/src/SB/Core/x/containers.h index eabeb8b45..0c9438076 100644 --- a/src/SB/Core/x/containers.h +++ b/src/SB/Core/x/containers.h @@ -51,9 +51,12 @@ template struct fixed_queue T _buffer[N + 1]; void reset(); + void front(); + void pop_front(); void push_front(const T& element); void push_back(); bool full() const; + void back(); void pop_back(); bool empty() const; }; diff --git a/src/SB/Core/x/xFX.cpp b/src/SB/Core/x/xFX.cpp index c35df84ab..7b4d12e56 100644 --- a/src/SB/Core/x/xFX.cpp +++ b/src/SB/Core/x/xFX.cpp @@ -264,16 +264,14 @@ void xFX_SceneEnter(RpWorld* world) if (ent->model) { - // non-matching: strings are getting cached for some reason - - U32 bubble; - - bubble = (ent->id == xStrHash(_stringBase0_7)); - bubble |= (ent->id == xStrHash(_stringBase0_7 + 13)); - bubble |= (ent->id == xStrHash(_stringBase0_7 + 28)); - bubble |= (ent->id == xStrHash(_stringBase0_7 + 42)); - bubble |= (ent->id == xStrHash(_stringBase0_7 + 62)); - bubble |= (ent->id == xStrHash(_stringBase0_7 + 75)); + U32 bubble = 0; + + bubble |= (ent->id == xStrHash("bubble buddy")); + bubble |= (ent->id == xStrHash("bubble missile")); + bubble |= (ent->id == xStrHash("bubble helmet")); + bubble |= (ent->id == xStrHash("bubble bowling ball")); + bubble |= (ent->id == xStrHash("bubble shoeL")); + bubble |= (ent->id == xStrHash("bubble shoeR")); if (bubble) { diff --git a/src/SB/Game/zNPCTypeCommon.h b/src/SB/Game/zNPCTypeCommon.h index b2ed0f2b3..4b3b5b714 100644 --- a/src/SB/Game/zNPCTypeCommon.h +++ b/src/SB/Game/zNPCTypeCommon.h @@ -10,6 +10,8 @@ #include "xSFX.h" #include "xstransvc.h" #include "xDraw.h" +#include "xstransvc.h" +#include "xDraw.h" #include "zNPCSndTable.h" #include "zMovePoint.h" diff --git a/src/SB/Game/zNPCTypeDutchman.cpp b/src/SB/Game/zNPCTypeDutchman.cpp index 0dd9152cd..2824615d1 100644 --- a/src/SB/Game/zNPCTypeDutchman.cpp +++ b/src/SB/Game/zNPCTypeDutchman.cpp @@ -159,6 +159,7 @@ namespace tweak_callback cb_sound; void register_tweaks(bool init, xModelAssetParam* ap, U32 apsize, const char*); + void load(xModelAssetParam*, U32); }; struct sound_data_type @@ -1275,6 +1276,16 @@ void zNPCDutchman::RenderExtra() RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)&oldcmp); } +void zNPCDutchman::ParseINI() +{ + zNPCCommon::ParseINI(); + cfg_npc->snd_traxShare = g_sndTrax_Dutchman; + NPCS_SndTablePrepare(g_sndTrax_Dutchman); + cfg_npc->snd_trax = g_sndTrax_Dutchman; + NPCS_SndTablePrepare(g_sndTrax_Dutchman); + tweak.load(parmdata, pdatsize); +} + void zNPCDutchman::SelfSetup() { xBehaveMgr* bmgr = xBehaveMgr_GetSelf(); @@ -1414,6 +1425,15 @@ void zNPCDutchman::update_animation(float) { } +void zNPCDutchman::update_camera(F32 dt) +{ + zCameraDisableTracking(CO_BOSS); + if ((zCameraIsTrackingDisabled() & -9) == 0) + { + boss_cam.update(dt); + } +} + void zNPCDutchman::kill_wave(zNPCDutchman::wave_data& wave) { kill_sound(1, wave.sound_handle); @@ -1483,15 +1503,140 @@ void zNPCDutchman::dissolve(F32 delay) } } +void zNPCDutchman::coalesce(F32 delay) +{ + reappear(); + if (delay <= 0.0f) + { + flag.fade = FADE_NONE; + disable_emitter(*fadein_emitter); + disable_emitter(*dissolve_emitter); + set_alpha(1.0f); + stop_eye_glow(); + stop_hand_trail(); + if (fade.sound_handle != 0) + { + kill_sound(2, fade.sound_handle); + fade.sound_handle = 0; + } + } + else + { + flag.fade = FADE_COALESCE; + fade.time = 0.0f; + fade.duration = delay; + fade.iduration = 1.0f / fade.duration; + enable_emitter(*fadein_emitter); + enable_emitter(*dissolve_emitter); + set_alpha(0.0f); + start_eye_glow(); + start_hand_trail(); + if (fade.sound_handle != 0) + { + set_volume(2, fade.sound_handle, 1.0f); + } + } +} + +void zNPCDutchman::reset_blob_mat() +{ + // Decomp.me says 90% + F32 temp; + F32 temp2; + + temp = isin(tweak.flame.blob_pitch); + temp2 = icos(tweak.flame.blob_pitch); + flames.blob_mat.right.assign(1.0f, 0.0f, 0.0f); + flames.blob_mat.up.assign(0.0f, temp2, temp); + flames.blob_mat.at.assign(0.0f, -temp, temp2); +} + void zNPCDutchman::reset_lasso_anim() { xAnimPlaySetState(0, lassdata->holdGuideAnim, 0); } +void zNPCDutchman::update_fade(F32 delay) +{ + F32 frac; + if (flag.fade != FADE_TELEPORT) + { + if (flag.fade < 1) + { + if (flag.fade < 4) + { + fade.time = fade.time + delay; + if (fade.time >= fade.duration) + { + flag.fade = FADE_TELEPORT; + disable_emitter(*fadeout_emitter); + set_alpha(0.0f); + vanish(); + set_volume(2, fade.sound_handle, 1.0f); + } + else + { + frac = fade.time * fade.iduration; + set_alpha(1.0f - frac); + set_volume(2, fade.sound_handle, frac); + } + } + } + else if (flag.fade < 4) + { + fade.time = fade.time + delay; + if (fade.time >= fade.duration) + { + flag.fade = FADE_NONE; + disable_emitter(*fadein_emitter); + disable_emitter(*dissolve_emitter); + set_alpha(1.0f); + stop_eye_glow(); + stop_hand_trail(); + reappear(); + kill_sound(2, fade.sound_handle); + fade.sound_handle = 0; + } + else + { + frac = fade.time * fade.iduration; + set_alpha(frac); + set_volume(2, fade.sound_handle, 1.0f - frac); + } + } + } +} + void zNPCDutchman::add_splash(const xVec3&, float) { } +void zNPCDutchman::start_fight() +{ + if (flag.fighting == 0 && life <= 0) + { + flag.fighting = 1; + psy_instinct->GoalSet(0, 0); + zCameraDisableTracking(CO_BOSS); + boss_cam.start(globals.camera); + boss_cam.set_targets((xVec3&)globals.player.ent.model->Mat->pos, (xVec3&)model->Mat->pos, + 2.0f); + } +} + +void zNPCDutchman::set_life(S32 lf) +{ + life = range_limit(life, 0, 3); + if (life < lf) + { + flag.hurting = 1; + for (S32 i = life; i < life; i++) + { + zEntEvent((xBase*)lf, (xBase*)lf, 0x1d7); // Haven't found 0x1d7. only 0x1d8 and 0x1d4 + } + } +} + void zNPCDutchman::start_beam() { if ((flag.beaming) != 0) diff --git a/src/SB/Game/zNPCTypeDutchman.h b/src/SB/Game/zNPCTypeDutchman.h index a2de6e5ae..995b47487 100644 --- a/src/SB/Game/zNPCTypeDutchman.h +++ b/src/SB/Game/zNPCTypeDutchman.h @@ -181,6 +181,7 @@ struct zNPCDutchman : zNPCSubBoss S32* handled); void Render(); void RenderExtra(); + void ParseINI(); void SelfSetup(); void render_debug(); void update_turn(F32); @@ -208,6 +209,7 @@ struct zNPCDutchman : zNPCSubBoss void refresh_reticle(); void update_hand_trail(F32); void dissolve(F32); + void coalesce(F32); void reset_lasso_anim(); void update_fade(F32); void update_slime(F32); diff --git a/src/SB/Game/zNPCTypeKingJelly.cpp b/src/SB/Game/zNPCTypeKingJelly.cpp index be33f2c00..b0ac1775f 100644 --- a/src/SB/Game/zNPCTypeKingJelly.cpp +++ b/src/SB/Game/zNPCTypeKingJelly.cpp @@ -1583,7 +1583,7 @@ S32 zNPCGoalKJTaunt::Exit(float dt, void* updCtxt) S32 zNPCGoalKJDamage::Process(en_trantype* trantype, F32 dt, void* updCtxt, xScene* xscn) { - // TODO + zNPCKingJelly& kj = *(zNPCKingJelly*)this->psyche->clt_owner; return 0; } diff --git a/src/SB/Game/zNPCTypePrawn.cpp b/src/SB/Game/zNPCTypePrawn.cpp index a5ceaf4e7..f0035e4ad 100644 --- a/src/SB/Game/zNPCTypePrawn.cpp +++ b/src/SB/Game/zNPCTypePrawn.cpp @@ -11,7 +11,7 @@ #define ANIM_Unknown 0 // 0x0 #define ANIM_Idle01 1 // 0x04 -#define ANIM_Idle02 2 // 0x08 +#define ANIM_Idle02 2 // 0x08 #define ANIM_Idle03 3 // 0xC #define ANIM_Fidget01 4 // #define ANIM_Fidget02 5 @@ -78,6 +78,10 @@ namespace void register_tweaks(bool init, xModelAssetParam* ap, U32 apsize); }; // namespace tweak_group + + void kill_sound(S32, U32) + { + } } // namespace /* @@ -259,10 +263,33 @@ void aqua_beam::stop() firing = 0; } +void aqua_beam::update(F32 dt) +{ + time += dt; + if ((cfg.duration >= 0.0f) && (time >= cfg.duration)) + { + firing = 0; + } + update_rings(dt); +} + void aqua_beam::render() { } +void aqua_beam::kill_ring() +{ + // TODO: found this in an old ss i had + // just putting it back + ring.queue.back(); + xModelInstanceFree((xModelInstance*)this); + if (this != 0) + { + kill_sound(3, (U32)this); + } + ring.queue.pop_back(); +} + xAnimTable* ZNPC_AnimTable_Prawn() { // clang-format off @@ -355,26 +382,33 @@ void zNPCPrawn::Render() // { // } /* zNPCPrawn::update_round (void) */ -void zNPCPrawn::update_round() { +void zNPCPrawn::update_round() +{ S32 var_r4; S32 temp_r3; S32 var_r30; - zNPCPrawn *var_r31; - zNPCSpawner **temp_r3_2; + zNPCPrawn* var_r31; + zNPCSpawner** temp_r3_2; temp_r3 = this->life; - if (temp_r3 == 0) { + if (temp_r3 == 0) + { this->round = 3; - } else { - this->round = 2 - ((S32) ((temp_r3 - 1) * 3) / (s32) this->cfg_npc->useBoxBound); + } + else + { + this->round = 2 - ((S32)((temp_r3 - 1) * 3) / (s32)this->cfg_npc->useBoxBound); } var_r30 = 0; var_r31 = this; - do { + do + { temp_r3_2 = var_r31->spawner; - if (temp_r3_2 != NULL) { + if (temp_r3_2 != NULL) + { var_r4 = 4; - if (var_r30 > (s32) this->round) { + if (var_r30 > (s32)this->round) + { var_r4 = 3; } //Notify__11zNPCSpawnerF13en_SM_NOTICESPv(temp_r3_2, (en_SM_NOTICES) var_r4, NULL); @@ -388,21 +422,25 @@ void zNPCPrawn::update_round() { // { // } /* zNPCPrawn::decompose (void) */ -void zNPCPrawn::decompose() { +void zNPCPrawn::decompose() +{ S32 i; - zNPCPrawn *var_r31; - zNPCSpawner **temp_r3; + zNPCPrawn* var_r31; + zNPCSpawner** temp_r3; var_r31 = this; vanish(); - if ((U8) var_r31->fighting != 0) { + if ((U8)var_r31->fighting != 0) + { var_r31->fighting = 0; //set_floor_state(var_r31, (zNPCPrawn::floor_state_enum) 0, 1, 1); //hide_model(var_r31); i = 0; - do { + do + { temp_r3 = var_r31->spawner; - if (temp_r3 != NULL) { + if (temp_r3 != NULL) + { //Notify__11zNPCSpawnerF13en_SM_NOTICESPv(temp_r3, (en_SM_NOTICES) 6, NULL); //Notify__11zNPCSpawnerF13en_SM_NOTICESPv(var_r31->unk2D0, (en_SM_NOTICES) 7, NULL); 0; //pass @@ -431,24 +469,31 @@ void zNPCPrawn::apply_pending() // { // } /* zNPCPrawn::set_floor_state (zNPCPrawn::floor_state_enum, bool, bool) */ -void zNPCPrawn::set_floor_state(zNPCPrawn::floor_state_enum arg0, bool arg1, bool arg2) { +void zNPCPrawn::set_floor_state(zNPCPrawn::floor_state_enum arg0, bool arg1, bool arg2) +{ U32 offset; U32 temp_r0; U32 temp_r3; - z_disco_floor *temp_r4; + z_disco_floor* temp_r4; - if (((S32) arg0 != (S32) this->floor_state) || (arg2 != 0)) { - this->floor_state = (floor_state_enum) arg0; + if (((S32)arg0 != (S32)this->floor_state) || (arg2 != 0)) + { + this->floor_state = (floor_state_enum)arg0; //get_floor_info(this, arg0, (zNPCPrawn::range_type *) &this->unk304, &this->unk30C, &this->unk310); - if (arg1 != 0) { + if (arg1 != 0) + { apply_pending(); return; } temp_r4 = this->disco; temp_r3 = temp_r4->state; - if ((temp_r3 < (U32) temp_r4->min_state || (temp_r0 = temp_r4->max_state, ((temp_r3 > temp_r0) != 0)))) { + if ((temp_r3 < (U32)temp_r4->min_state || + (temp_r0 = temp_r4->max_state, ((temp_r3 > temp_r0) != 0)))) + { offset = 1; - } else { + } + else + { offset = (temp_r0 - temp_r3) + 1; } this->pending.counter = temp_r4->state_counter + offset; @@ -471,8 +516,9 @@ void zNPCPrawn::set_floor_state(zNPCPrawn::floor_state_enum arg0, bool arg1, boo // { // } /* zNPCPrawn::reappear (void) */ -void zNPCPrawn::reappear() { - xModelInstance *temp_r6; +void zNPCPrawn::reappear() +{ + xModelInstance* temp_r6; temp_r6 = this->model; temp_r6->Flags |= 3; @@ -566,7 +612,8 @@ void xDebugAddTweak(const char*, xVec3*, const tweak_callback*, void*, U32) // { // } /* zNPCPrawn::turning (void) const */ -void zNPCPrawn::turning() const { +void zNPCPrawn::turning() const +{ F32 spC; F32 sp8; F32 temp_f2; @@ -574,7 +621,7 @@ void zNPCPrawn::turning() const { F32 temp_f2_3; F32 temp_f3; S8 var_r0; - RwMatrix *temp_r6; + RwMatrix* temp_r6; var_r0 = 0; temp_r6 = this->model->Mat; diff --git a/src/SB/Game/zNPCTypePrawn.h b/src/SB/Game/zNPCTypePrawn.h index e15e8cb61..3e9bb2b93 100644 --- a/src/SB/Game/zNPCTypePrawn.h +++ b/src/SB/Game/zNPCTypePrawn.h @@ -180,7 +180,9 @@ struct aqua_beam void reset(); void start(); void stop(); - bool kill_ring(); + void update(F32); + void update_rings(F32); + void kill_ring(); void render(); }; diff --git a/src/SB/Game/zTalkBox.cpp b/src/SB/Game/zTalkBox.cpp index 06f57b979..71b5637c5 100644 --- a/src/SB/Game/zTalkBox.cpp +++ b/src/SB/Game/zTalkBox.cpp @@ -31,14 +31,24 @@ namespace if (shared.delay_events == 0) { - zEntEvent(shared.active, shared.active, event); + shared.triggered.push_back(); + shared.triggered.back(); + shared.active->id = 0; } else { - shared.triggered.push_back(); + zEntEvent(shared.active, shared.active, event); } } + static void flush_triggered() + { + } + + static void reset_auto_wait() + { + } + void trigger_pads(U32 pressed) { if ((pressed & 0x10) != 0) @@ -227,7 +237,7 @@ namespace // HACK return (char*)(asset) + 4; } - + } // namespace void ztalkbox::load(const asset_type& tasset)