diff --git a/src/SB/Core/x/containers.h b/src/SB/Core/x/containers.h index f584cb2af..58773407f 100644 --- a/src/SB/Core/x/containers.h +++ b/src/SB/Core/x/containers.h @@ -38,6 +38,7 @@ template struct static_queue U32 _max_size; U32 _max_size_mask; T* _buffer; + void clear(); }; template struct fixed_queue diff --git a/src/SB/Core/x/xEnt.h b/src/SB/Core/x/xEnt.h index 602b38524..29fd66791 100644 --- a/src/SB/Core/x/xEnt.h +++ b/src/SB/Core/x/xEnt.h @@ -127,7 +127,7 @@ struct xEnt : xBase // Offset: 0x10 xEntAsset* asset; - U16 idx; + U16 idx; //0x14 U16 num_updates; // Offset: 0x18 diff --git a/src/SB/Game/zEntCruiseBubble.cpp b/src/SB/Game/zEntCruiseBubble.cpp index 6f50f0457..d4f9dfaef 100644 --- a/src/SB/Game/zEntCruiseBubble.cpp +++ b/src/SB/Game/zEntCruiseBubble.cpp @@ -1753,6 +1753,7 @@ void cruise_bubble::tweak_group::register_tweaks(bool init, xModelAssetParam* ap { if (init) { + this->aim_delay; this->aim_delay = zEntCruiseBubble_f_0_2; auto_tweak::load_param(this->aim_delay, 1.0f, zEntCruiseBubble_f_0_0, 1.0f, ap, apsize, "aim_delay"); diff --git a/src/SB/Game/zNPCTypeDutchman.cpp b/src/SB/Game/zNPCTypeDutchman.cpp index 9de1acf89..046fdf5b7 100644 --- a/src/SB/Game/zNPCTypeDutchman.cpp +++ b/src/SB/Game/zNPCTypeDutchman.cpp @@ -6,8 +6,11 @@ namespace { -} - + void kill_sound(S32 a, U32 b) + { + } +} // namespace +//dummy text for pushing 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; @@ -48,6 +51,12 @@ void zNPCDutchman::Damage(en_NPC_DAMAGE_TYPE, xBase*, const xVec3*) // move = *tempR4; // } +S32 zNPCDutchman::LassoSetup() +{ + zNPCCommon::LassoUseGuides(1, 1); + zNPCCommon::LassoSetup(); +} + void zNPCDutchman::render_debug() { } @@ -56,6 +65,11 @@ void zNPCDutchman::update_animation(float) { } +void zNPCDutchman::kill_wave(zNPCDutchman::wave_data& wave) +{ + kill_sound(1, wave.sound_handle); +} + void zNPCDutchman::start_eye_glow() //Matches but the data is fucked { flag.eye_glow = true; @@ -100,6 +114,17 @@ void zNPCDutchman::stop_beam() flag.beaming = false; } +void zNPCDutchman::start_flames() +{ + //static_queue::clear(); + flag.flaming = true; + flames.time = 0.0; + flames.emitted = 0; + flames.blob_break = 1; + flames.splash_break = 1; + slime.slices.clear(); +} + void zNPCDutchman::stop_flames() { flag.flaming = false; @@ -117,16 +142,28 @@ void zNPCDutchman::vanish() xEntHide(this); } +void zNPCDutchman::reappear() +{ + moreFlags = old.moreFlags; + xNPCBasic::RestoreColFlags(); + xEntShow(this); +} + void zNPCDutchman::reset_speed() { } //S32 zNPCGoalDutchmanInitiate::Exit(F32 dt, void* updCtxt) //{ -// owner; // return xGoal::Exit(dt, updCtxt); //} +S32 zNPCGoalDutchmanIdle::Enter(F32 dt, void* updCtxt) +{ + owner.face_player(); + return zNPCGoalCommon::Enter(dt, updCtxt); +} + S32 zNPCGoalDutchmanIdle::Exit(F32 dt, void* updCtxt) { return xGoal::Exit(dt, updCtxt); @@ -194,3 +231,8 @@ U8 zNPCDutchman::ColChkFlags() const { return 0; } + +WEAK void zNPCDutchman::face_player() +{ + flag.face_player = true; +} diff --git a/src/SB/Game/zNPCTypeDutchman.h b/src/SB/Game/zNPCTypeDutchman.h index 74e5fafad..ac3bc8e79 100644 --- a/src/SB/Game/zNPCTypeDutchman.h +++ b/src/SB/Game/zNPCTypeDutchman.h @@ -76,7 +76,7 @@ struct zNPCDutchman : zNPCSubBoss bool beaming; bool was_beaming; bool hurting; - bool flaming; + bool flaming; //0x2b9 bool eye_glow; bool hand_trail; //0x2bb move_enum move; @@ -97,7 +97,7 @@ struct zNPCDutchman : zNPCSubBoss move_info move; //0x2C8 struct { - U8 moreFlags; //0x31c?? + U8 moreFlags; //0x31c } old; beam_info beam[2]; //Needed for start_beam func static_queue waves; //Needed for start_beam func @@ -108,7 +108,7 @@ struct zNPCDutchman : zNPCSubBoss S32 emitted; //0x574 U8 splash_break; xVec3 splash_loc; - U8 blob_break; + U8 blob_break; //0x588 xVec3 blob_loc; F32 imax_dist; //0x598 xMat3x3 blob_mat; @@ -144,14 +144,20 @@ struct zNPCDutchman : zNPCSubBoss void Render(); void render_debug(); void update_animation(float); + void kill_wave(zNPCDutchman::wave_data&); void add_splash(const xVec3&, float); void vanish(); + void reappear(); + void face_player(); void start_beam(); void stop_beam(); + void start_flames(); void stop_flames(); void stop_hand_trail(); + void reset_lasso_anim(); void reset_speed(); void Damage(en_NPC_DAMAGE_TYPE, xBase*, const xVec3*); + S32 LassoSetup(); void start_eye_glow(); void stop_eye_glow(); U8 PhysicsFlags() const; @@ -177,6 +183,7 @@ struct zNPCGoalDutchmanInitiate : zNPCGoalCommon struct zNPCGoalDutchmanIdle : zNPCGoalCommon { zNPCDutchman& owner; + S32 Enter(float, void*); S32 Exit(float, void*); static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); diff --git a/src/SB/Game/zNPCTypePrawn.cpp b/src/SB/Game/zNPCTypePrawn.cpp index 44bfc85f4..52661b151 100644 --- a/src/SB/Game/zNPCTypePrawn.cpp +++ b/src/SB/Game/zNPCTypePrawn.cpp @@ -2,6 +2,208 @@ #include +namespace +{ + sound_data_type sound_data[4]; + U32 sound_asset_ids[6][4]; + + struct tweak_group + { + F32 turn_accel; + F32 spawn_delay; + F32 repel_radius; + struct + { + range_type pattern; + } safe; + struct + { + range_type pattern; + F32 state_delay; // 0x1c + F32 transition_delay; + } begin; + struct + { + F32 delay[3]; + range_type pattern; + F32 state_delay; + F32 transition_delay; + F32 exhaust_vel; + F32 knock_back; + struct + { + S32 amount[3]; + F32 arc; + F32 delay; + F32 accel; + F32 max_vel; + } sweep; + fire_type fire; + } beam; + _class_7 aim_lane; + _class_14 lane; + _class_25 danger; + sound_property sound[4]; + void* context; + tweak_callback cb_sound; + tweak_callback cb_sound_asset; + + void register_tweaks(bool init, xModelAssetParam* ap, U32 apsize); + }; // namespace tweak_group +} // namespace + +/* + +TODO: 42%, needs quite a bit of work still. +Thought this function was going to be an easy copy/paste like other register_tweak fn, +but turning out to be harder to decipher than I anticipated so leaving it like this for now. +*/ +void tweak_group::register_tweaks(bool init, xModelAssetParam* ap, U32 apsize) +{ + if (init) + { + this->sound[0].volume = 0; + auto_tweak::load_param(this->sound[0].volume, 1.0f, 0.0, 1.0f, ap, apsize, + "TODO1"); + } + + if (init) + { + this->sound[0].range_inner = 0; + auto_tweak::load_param(this->sound[0].range_inner, 1.0f, 0.0, 1.0f, ap, apsize, + "TODO2"); + } + if (init) + { + this->sound[0].range_outer = 0; + auto_tweak::load_param(this->sound[0].range_outer, 1.0f, 0.0, 1.0f, ap, apsize, + "TODO3"); + } + + if (init) + { + this->sound[0].delay = 0; + auto_tweak::load_param(this->sound[0].delay, 1.0f, 0.0, 1.0f, ap, apsize, + "TODO4"); + } + if (init) + { + this->sound[1].volume = 0; + auto_tweak::load_param(this->sound[1].volume, 1.0f, 0.0, 1.0f, ap, apsize, + "TODo5"); + } + if (init) + { + this->sound[1].range_inner = 0; + auto_tweak::load_param(this->sound[1].range_inner, 1.0f, 0.0, 1.0f, ap, apsize, + "TODo6"); + } + + if (init) + { + this->sound[1].range_outer = 0; + auto_tweak::load_param(this->sound[1].range_outer, 1.0f, 0.0, 1.0f, ap, apsize, + "todo7"); + } + if (init) + { + this->sound[1].delay = 0; + auto_tweak::load_param(this->sound[1].delay, 1.0f, 0.0, 1.0f, ap, apsize, + "todo8"); + } + if (init) + { + this->sound[2].volume = 0; + auto_tweak::load_param(this->sound[2].volume, 1.0f, 0.0, 1.0f, ap, apsize, + "todo9"); + } + if (init) + { + this->sound[2].range_inner = 0; + auto_tweak::load_param(this->sound[2].range_inner, 1.0f, 0.0, 1.0f, ap, apsize, + "todo10"); + } + + if (init) + { + this->sound[2].range_outer = 0; + auto_tweak::load_param(this->sound[2].range_outer, 1.0f, 0.0, 1.0f, ap, apsize, + "todo11"); + } + if (init) + { + this->sound[2].delay = 0; + auto_tweak::load_param(this->sound[2].delay, 1.0f, 0.0, 1.0f, ap, apsize, + "todo12"); + } + if (init) + { + this->sound[3].volume = 0; + auto_tweak::load_param(this->sound[3].volume, 1.0f, 0.0, 1.0f, ap, apsize, + "todo13"); + } + if (init) + { + this->sound[3].range_inner = 0; + auto_tweak::load_param(this->sound[3].range_inner, 1.0f, 0.0, 1.0f, ap, apsize, + "todo14"); + } + + if (init) + { + this->sound[3].range_outer = 0; + auto_tweak::load_param(this->sound[3].range_outer, 1.0f, 0.0, 1.0f, ap, apsize, + "todo15"); + } + if (init) + { + this->sound[3].delay = 0; + auto_tweak::load_param(this->sound[3].delay, 1.0f, 0.0, 1.0f, ap, apsize, + "todo16"); + } + + if (init) + { + this->sound[3].delay = 0; + auto_tweak::load_param(this->sound[3].delay, 1.0f, 0.0, 1.0f, ap, apsize, + "todo17"); + } + + if (init) + { + sound_data[0].volume = sound[0].volume; + sound_data[0].id = sound_asset_ids[0][0] = xStrHash("TES1"); + } + if (init) + { + sound_data[1].volume = sound[1].volume; + sound_data[1].id = sound_asset_ids[0][1] = xStrHash("TES2"); + } + if (init) + { + sound_data[2].volume = sound[2].volume; + sound_data[2].id = sound_asset_ids[0][2] = xStrHash("TES3"); + } + if (init) + { + sound_data[3].volume = sound[3].volume; + sound_data[3].id = sound_asset_ids[0][3] = xStrHash("TES4"); + } + + /* + *(undefined4 *)(param_1 + 0x1ac) = sound_asset_ids__27@unnamed@zNPCTypePrawn_cpp@; + sound_data__27@unnamed@zNPCTypePrawn_cpp@ = + xStrHash__FPCc((&PTR_@stringBase0_8026e83c)[*(int *)(param_1 + 0x1ac) * 4]); + *(undefined4 *)(param_1 + 0x1c4) = DAT_80329548; + DAT_803295b0 = xStrHash__FPCc((&PTR_@stringBase0_8026e83c)[*(int *)(param_1 + 0x1c4) * 4]); + *(undefined4 *)(param_1 + 0x1dc) = DAT_80329560; + DAT_803295c0 = xStrHash__FPCc((&PTR_@stringBase0_8026e83c)[*(int *)(param_1 + 0x1dc) * 4]); + *(undefined4 *)(param_1 + 500) = DAT_80329578; + DAT_803295d0 = xStrHash__FPCc((&PTR_@stringBase0_8026e83c)[*(int *)(param_1 + 500) * 4]); + } + */ +} + void zNPCPrawn::render_debug() { } diff --git a/src/SB/Game/zNPCTypePrawn.h b/src/SB/Game/zNPCTypePrawn.h index cc52d5821..5743a69a8 100644 --- a/src/SB/Game/zNPCTypePrawn.h +++ b/src/SB/Game/zNPCTypePrawn.h @@ -7,6 +7,108 @@ #include "zNPCSpawner.h" #include "containers.h" +struct sound_data_type +{ + U32 id; + U32 handle; + xVec3* loc; + F32 volume; +}; + +struct range_type +{ + S32 min; + S32 max; +}; + +struct _class_5 +{ + F32 size; + F32 alpha; + F32 vel; + F32 accel; + F32 emit_delay; + F32 grow; + F32 fade_dist; + F32 kill_dist; + F32 follow; + F32 hit_radius; + xVec3 hit_offset; +}; + +struct config_0 +{ + F32 duration; + S32 sound_interval; + _class_5 ring; +}; + +struct _class_8 +{ + S32 first; + S32 range; + S32 offset; + S32 size; +}; + +struct _class_7 +{ + F32 duration; + F32 state_delay; + F32 transition_delay; + _class_8 pattern; +}; + +struct _class_18 +{ + S32 first; + S32 range; + S32 offset; + S32 size; +}; + +struct _class_25 +{ + F32 state_delay; + F32 transition_delay; + F32 cycle_delay; // 0x100 + S32 pattern_offset; + S32 pattern_size; + range_type pattern[20]; +}; + +struct sound_property +{ + U32 asset; + F32 volume; + F32 range_inner; + F32 range_outer; + F32 delay; + F32 fade_time; +}; + +struct _class_14 +{ + F32 duration[3]; + F32 state_delay; + F32 transition_delay; + _class_18 pattern; +}; + +struct fire_type : config_0 +{ + S32 emit_bone; + xVec3 offset; + F32 yaw; + F32 pitch; +}; + +namespace auto_tweak +{ + template + void load_param(T1&, T2, T2, T2, xModelAssetParam*, U32, const char*); +}; + struct aqua_beam { struct config