diff --git a/src/SB/Core/x/xDecal.h b/src/SB/Core/x/xDecal.h index 958d5c34c..1d5a4120b 100644 --- a/src/SB/Core/x/xDecal.h +++ b/src/SB/Core/x/xDecal.h @@ -23,7 +23,7 @@ struct xDecalEmitter struct config { U32 flags; - F32 life_time; + F32 life_time; // 0x2ec U32 blend_src; U32 blend_dst; struct diff --git a/src/SB/Core/x/xLaserBolt.h b/src/SB/Core/x/xLaserBolt.h index c4b96f00d..4e8de6048 100644 --- a/src/SB/Core/x/xLaserBolt.h +++ b/src/SB/Core/x/xLaserBolt.h @@ -42,21 +42,6 @@ enum fx_orient_enum FORCE_INT_FX_ORIENT = 0xffffffff }; -struct bolt -{ - xVec3 origin; - xVec3 dir; - xVec3 loc; - xVec3 hit_norm; - F32 dist; - F32 hit_dist; - F32 prev_dist; - F32 prev_check_dist; - xEnt* hit_ent; - F32 emitted; - void* context; -}; - struct xLaserBoltEmitter { struct config @@ -75,6 +60,8 @@ struct xLaserBoltEmitter F32 damage; }; + struct bolt; + struct static_queue { U32 _first; @@ -104,6 +91,21 @@ struct xLaserBoltEmitter F32 irate; }; + struct bolt + { + xVec3 origin; + xVec3 dir; + xVec3 loc; + xVec3 hit_norm; + F32 dist; + F32 hit_dist; + F32 prev_dist; + F32 prev_check_dist; + xEnt* hit_ent; + F32 emitted; + void* context; + }; + config cfg; static_queue bolts; F32 ialpha; @@ -112,6 +114,7 @@ struct xLaserBoltEmitter effect_data* fx[7]; U32 fxsize[7]; + void init(U32 max_bolts, const char*); void set_texture(char* name); void set_texture(U32 aid); void set_texture(RwTexture* tex); @@ -128,6 +131,8 @@ struct xLaserBoltEmitter RxObjSpace3DVertex* get_vert_buffer(S32& dat); void applyDamage(bolt& b); void reset_fx(fx_when_enum when); + + U32 visible() const; }; #endif diff --git a/src/SB/Game/zEntPlayerOOBState.cpp b/src/SB/Game/zEntPlayerOOBState.cpp index a6510aa52..f1d664b13 100644 --- a/src/SB/Game/zEntPlayerOOBState.cpp +++ b/src/SB/Game/zEntPlayerOOBState.cpp @@ -44,6 +44,20 @@ namespace oob_state tagFixed fixed; xMat4x3 shared_target; + static void reset_camera() + { + // xMat4x3 ma, is not correct. This is a major placeholder. + // Simply have not figured out what the data/global is supposed to be + // FIXME: Correct this function + + xMat4x3* ma = xEntGetFrame(&(xEnt)globals.player.ent); + + zCameraEnableInput(); + zCameraEnableTracking(CO_OOB); + xCameraDoCollisions(1, 6); + zCameraTweakGlobal_Init(); + } + static bool assume_player_is_stupid() { shared.tutorial = (ztalkbox*)zSceneFindObject(xStrHash("OUT_OF_BOUNDS_TLKBX")); @@ -74,6 +88,21 @@ namespace oob_state { } + static void set_rect_vert(rwGameCube2DVertex&, F32, F32, F32, iColor_tag, F32) + { + } + + drop_state_type::substate_enum drop_state_type::supdate_fade_in(drop_state_type&, + xScene& scn, F32& unk0) + { + return drop_state_type::update_fade_in(); + } + + drop_state_type::substate_enum drop_state_type::update_fade_in(xScene&, float&) + { + return SS_MOVING_IN; + } + } // namespace } // namespace oob_state diff --git a/src/SB/Game/zEntPlayerOOBState.h b/src/SB/Game/zEntPlayerOOBState.h index 1bbfdaf08..0562ae88e 100644 --- a/src/SB/Game/zEntPlayerOOBState.h +++ b/src/SB/Game/zEntPlayerOOBState.h @@ -4,6 +4,8 @@ #include "xserializer.h" #include "zTalkBox.h" #include "zTaskBox.h" +#include "zCamera.h" +#include "zCameraTweak.h" extern bool oob_player_teleported; @@ -109,6 +111,36 @@ namespace oob_state void stop(); }; + struct drop_state_type : state_type + { + enum substate_enum + { + SS_MOVING_IN, + SS_STOPPING, + SS_STOPPED, + SS_STARTING, + SS_MOVING_OUT, + SS_START_FADE_IN, + SS_FADE_IN, + MAX_SS, + SS_INVALID = 0xffffffff, + }; + + substate_enum move_substate; + substate_enum fade_substate; + xVec3 player_start; + F32 stop_time; + F32 fade_start_time; + F32 fade_time; + substate_enum (*updatess)(drop_state_type&, xScene&, F32&)[7]; + + void start(); + state_enum update(xScene& s, F32& dt); + substate_enum supdate_fade_in(drop_state_type&, xScene&, F32&); + substate_enum update_fade_in(); + substate_enum update_fade_in(xScene&, F32&); + }; + struct _class_9 { int flags; diff --git a/src/SB/Game/zNPCTypeBossPlankton.cpp b/src/SB/Game/zNPCTypeBossPlankton.cpp index e9099f1ad..7b2a0e13d 100644 --- a/src/SB/Game/zNPCTypeBossPlankton.cpp +++ b/src/SB/Game/zNPCTypeBossPlankton.cpp @@ -59,54 +59,115 @@ namespace U32 flags; }; + struct bolt; + + struct effect_data + { + struct effect_callback + { + void (*fp)(bolt&, void*); + void* context; + }; + + fx_type_enum type; + fx_orient_enum orient; + F32 rate; + union + { + xParEmitter* par; + xDecalEmitter* decal; + effect_callback callback; + }; + F32 irate; + }; + + static effect_data beam_launch_effect[2]; // size: 0x30, address: 0x4E0E60 + static effect_data beam_head_effect[1]; // size: 0x18, address: 0x4E0E90 + static effect_data beam_impact_effect[3]; // size: 0x48, address: 0x4E0EB0 + static effect_data beam_death_effect[1]; // size: 0x18, address: 0x5E53F0 + static effect_data beam_kill_effect[1]; + static U32 sound_asset_ids[6][10]; static sound_data_type sound_data[6]; - static const sound_asset sound_assets[29] = - { - {0, "RSB_foot_loop", 0, 3}, - {0, "fan_loop", 0, 3}, - {0, "Rocket_burn_loop", 0, 3}, - {0, "RP_whirr_loop", 0, 3}, - {0, "RP_whirr2_loop", 0, 3}, - {0, "Glove_hover", 0, 3}, - {0, "Glove_pursuit", 0, 3}, - {1, "Prawn_FF_hit", 0, 0}, - {1, "Prawn_hit", 0, 0}, - {1, "Door_metal_shut", 0, 0}, - {1, "Ghostplat_fall", 0, 0}, - {1, "ST-death", 0, 0}, - {1, "RP_Bwrrzt", 0, 0}, - {1, "RP_chunk", 0, 0}, - {1, "b201_rp_exhale", 0, 0}, - {2, "RP_laser_alt", 0, 0}, - {3, "RP_laser_loop", 0, 1}, - {3, "ElecArc_alt_b", 0, 1}, - {3, "Laser_lrg_fire_loop", 0, 1}, - {3, "Laser_sm_fire_loop", 0, 1}, - {4, "RB_stalact_brk", 0, 0}, - {4, "Volcano_blast", 0, 0}, - {4, "RP_laser_thunk", 0, 0}, - {4, "RP_pfft", 0, 0}, - {4, "RP_thwash", 0, 0}, - {5, "RP_charge_whirr", 0, 0}, - {5, "B101_SC_jump", 0, 0}, - {5, "KJ_Charge", 0, 0}, - {5, "Laser_med_pwrup1", 0, 0} + + static const sound_asset sound_assets[29] = { + { 0, "RSB_foot_loop", 0, 3 }, { 0, "fan_loop", 0, 3 }, + { 0, "Rocket_burn_loop", 0, 3 }, { 0, "RP_whirr_loop", 0, 3 }, + { 0, "RP_whirr2_loop", 0, 3 }, { 0, "Glove_hover", 0, 3 }, + { 0, "Glove_pursuit", 0, 3 }, { 1, "Prawn_FF_hit", 0, 0 }, + { 1, "Prawn_hit", 0, 0 }, { 1, "Door_metal_shut", 0, 0 }, + { 1, "Ghostplat_fall", 0, 0 }, { 1, "ST-death", 0, 0 }, + { 1, "RP_Bwrrzt", 0, 0 }, { 1, "RP_chunk", 0, 0 }, + { 1, "b201_rp_exhale", 0, 0 }, { 2, "RP_laser_alt", 0, 0 }, + { 3, "RP_laser_loop", 0, 1 }, { 3, "ElecArc_alt_b", 0, 1 }, + { 3, "Laser_lrg_fire_loop", 0, 1 }, { 3, "Laser_sm_fire_loop", 0, 1 }, + { 4, "RB_stalact_brk", 0, 0 }, { 4, "Volcano_blast", 0, 0 }, + { 4, "RP_laser_thunk", 0, 0 }, { 4, "RP_pfft", 0, 0 }, + { 4, "RP_thwash", 0, 0 }, { 5, "RP_charge_whirr", 0, 0 }, + { 5, "B101_SC_jump", 0, 0 }, { 5, "KJ_Charge", 0, 0 }, + { 5, "Laser_med_pwrup1", 0, 0 } }; + const size_t beam_ring_curve = 2; + + xVec3* get_player_loc() + { + return (xVec3*)&globals.player.ent.model->Mat->pos; + } S32 init_sound() { return 0; } - F32 get_player_loc() + void reset_sound() + { + for (S32 i = 0; i < 6; ++i) + { + sound_data[i].handle = 0; + } + } + + void* play_sound(int, const xVec3*, float) + { + return NULL; + } + + void* kill_sound(S32, U32) + { + return 0; // to-do + } + + void* kill_sound(S32) { return 0; } - void play_sound(int, const xVec3*, float) + void play_beam_fly_sound(xLaserBoltEmitter::bolt& bolt, void* unk) + { + if (bolt.context == NULL) + { + bolt.context = play_sound(SOUND_BOLT_FLY, &bolt.loc, 1.0f); + } + } + + void kill_beam_fly_sound(xLaserBoltEmitter::bolt& bolt, void* unk) + { + if (bolt.context != NULL) + { + kill_sound(3, (U32)bolt.context); + bolt.context = NULL; + } + } + + void play_beam_fire_sound(xLaserBoltEmitter::bolt& bolt, void* unk) { + play_sound(SOUND_BOLT_FIRE, &bolt.origin, 1.0f); + } + + void play_beam_hit_sound(xLaserBoltEmitter::bolt& bolt, void* unk) + { + play_sound(SOUND_BOLT_HIT, &bolt.loc, 1.0f); } struct config @@ -233,9 +294,17 @@ namespace tweak_callback cb_sound; tweak_callback cb_sound_asset; + void load(xModelAssetParam*, U32); void register_tweaks(bool init, xModelAssetParam* ap, U32 apsize, const char*); }; + static tweak_group tweak; + + void tweak_group::load(xModelAssetParam* ap, U32 apsize) + { + register_tweaks(true, ap, apsize, NULL); + } + void tweak_group::register_tweaks(bool init, xModelAssetParam* ap, U32 apsize, const char*) { xVec3 V0; @@ -829,17 +898,20 @@ namespace if (init) { sound[SOUND_BOLT_FIRE].asset = sound_asset_ids[2][0]; - sound_data[SOUND_BOLT_FIRE].id = xStrHash(sound_assets[sound[SOUND_BOLT_FIRE].asset].name); + sound_data[SOUND_BOLT_FIRE].id = + xStrHash(sound_assets[sound[SOUND_BOLT_FIRE].asset].name); } if (init) { sound[SOUND_BOLT_FLY].asset = sound_asset_ids[3][3]; - sound_data[SOUND_BOLT_FLY].id = xStrHash(sound_assets[sound[SOUND_BOLT_FLY].asset].name); + sound_data[SOUND_BOLT_FLY].id = + xStrHash(sound_assets[sound[SOUND_BOLT_FLY].asset].name); } if (init) { sound[SOUND_BOLT_HIT].asset = sound_asset_ids[4][3]; - sound_data[SOUND_BOLT_HIT].id = xStrHash(sound_assets[sound[SOUND_BOLT_HIT].asset].name); + sound_data[SOUND_BOLT_HIT].id = + xStrHash(sound_assets[sound[SOUND_BOLT_HIT].asset].name); } if (init) { @@ -848,6 +920,18 @@ namespace } } + static void update_move_accel(xVec3& loc, zNPCBPlankton::move_info& move, F32 dt) + { + // Ghidra output, will come back to this later + + // xAccelMove((double)*(float*)(param_3 + 0x18), param_1_00, (double)*(float*)(param_3 + 0x24), + // (float*)this, (float*)(param_3 + 0xc)); + // xAccelMove((double)*(float*)(param_3 + 0x1c), param_1_00, (double)*(float*)(param_3 + 0x28), + // (float*)(this + 4), (float*)(param_3 + 0x10)); + // xAccelMove((double)*(float*)(param_3 + 0x20), param_1_00, (double)*(float*)(param_3 + 0x2c), + // (float*)(this + 8), (float*)(param_3 + 0x14)); + } + } // namespace xAnimTable* ZNPC_AnimTable_BossPlankton() @@ -988,6 +1072,33 @@ void zNPCBPlankton::Init(xEntAsset* asset) //66% zNPCBPlankton::aim_gun(play, &gun_tilt, &move.dest, 0); } +void zNPCBPlankton::Setup() +{ + U32 tmpVar; + + zNPCBoss::Setup(); + zNPCBPlankton::setup_beam(); + tmpVar = xStrHash("NPC_NEWSCASTER"); + newsfish = (zNPCNewsFish*)zSceneFindObject(tmpVar); +} + +void zNPCBPlankton::PostSetup() +{ + xUpdateCull_SetCB(xglobals->updateMgr, NULL, xUpdateCull_AlwaysTrueCB, NULL); +} + +void zNPCBPlankton::Reset() +{ + if (newsfish != 0) + { + } + + zNPCCommon::Reset(); + zNPCBPlankton::reset_beam(); + memset((void*)flag.updated, 0, 0x10); + zNPCBPlankton::face_player(); +} + void zNPCBPlankton::Destroy() { zNPCCommon::Destroy(); @@ -1050,12 +1161,37 @@ void zNPCBPlankton::Process(xScene* xscn, float dt) //Process__10zNPCCommonFP6xScenef(param_1,param_9,param_10); } +S32 zNPCBPlankton::SysEvent(xBase* from, xBase* to, U32 toEvent, const F32* toParam, + xBase* toParamWidget, S32* handled) +{ + *handled = 0; + return zNPCCommon::SysEvent(from, to, toEvent, toParam, toParamWidget, handled); + + // ((zNPCCommon*) 0x1b8??? +} + void zNPCBPlankton::Render() { xNPCBasic::Render(); zNPCBPlankton::render_debug(); } +void zNPCBPlankton::RenderExtraPostParticles() +{ + if ((beam.visible() & 0xff) != 0) + { + RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)5); + RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)2); + beam.render(); + } +} + +void zNPCBPlankton::ParseINI() +{ + zNPCCommon::ParseINI(); + tweak.load(parmdata, pdatsize); +} + void zNPCBPlankton::SelfSetup() { xBehaveMgr* bmgr = xBehaveMgr_GetSelf(); @@ -1168,15 +1304,138 @@ S32 zNPCBPlankton::next_goal() } void zNPCBPlankton::render_debug() +{ + // weak +} + +void zNPCBPlankton::reset_territories() +{ +} + +void zNPCBPlankton::update_animation(F32) { } -void zNPCBPlankton::update_animation(float) +void zNPCBPlankton::update_follow(F32 dt) { + if (flag.follow != 2) + { + update_follow_player(dt); + } + else if ((flag.follow < 2) && (1 > flag.follow)) + { + update_follow_camera(dt); + } +} + +void zNPCBPlankton::check_player_damage() +{ + // TODO +} + +void zNPCBPlankton::init_beam() +{ + beam.init((U32)&beam, "Plankton\'s Beam"); + beam.set_texture("plankton_laser_bolt"); + + beam.refresh_config(); + // + beam_ring.init(0, "Plankton\'s Beam Rings"); + beam_ring.set_curve((xDecalEmitter::curve_node*)&beam_ring.curve, beam_ring_curve); + beam_ring.set_texture("bubble"); + beam_ring.set_default_config(); + beam_ring.cfg.flags = 0; + beam_ring.cfg.life_time = 0.0f; + beam_ring.cfg.blend_src = 5; + beam_ring.cfg.blend_dst = 2; + beam_ring.refresh_config(); + + // + beam_glow.init(0, "Plankton\'s Beam Glow"); + beam_glow.set_curve((xDecalEmitter::curve_node*)&beam_glow.curve, 0); + beam_glow.set_texture("fx_firework"); + beam_glow.set_default_config(); + beam_glow.cfg.flags = 0; + beam_glow.cfg.life_time = 0.0f; + beam_glow.cfg.blend_src = 5; + beam_glow.cfg.blend_dst = 2; + beam_glow.refresh_config(); +} + +void zNPCBPlankton::setup_beam() +{ +} + +void zNPCBPlankton::reset_beam() +{ + beam.reset(); } void zNPCBPlankton::vanish() { + flags = flags & 0xfe; + flags = flags | 0x40; + pflags = 0; + moreFlags = 0; + chkby = 0; + penby = 0; + flags2.flg_colCheck = 0; + flags2.flg_penCheck = 0; + kill_sound(NULL); +} + +void zNPCBPlankton::reappear() +{ + flags = flags | 1; + flags = flags & 0xbf; + pflags = 0; + moreFlags = 16; + chkby = 16; + penby = 16; + flags2.flg_colCheck = 0; + flags2.flg_penCheck = 0; + play_sound(0, (xVec3*)&bound.pad[3], 1.0f); +} + +void zNPCBPlankton::next_territory() +{ + if ((have_cronies() & 0xff) != 0) + { + active_territory = active_territory + 1; + if (active_territory >= territory_size) + { + active_territory = territory_size + -1; + } + } +} + +S32 zNPCBPlankton::have_cronies() const +{ + // FIXME: dunno how to fix this yet + return (active_territory) & (active_territory * 0x3c + 0x4e4) >> 0x1f; +} + +void zNPCBPlankton::sickum() +{ +} + +void zNPCBPlankton::here_boy() +{ + flag.hunt = 0; +} + +void zNPCBPlankton::follow_player() +{ + flag.follow = FOLLOW_PLAYER; + follow.delay = follow.max_delay = 0.0f; + flag.move = MOVE_ORBIT; +} + +void zNPCBPlankton::follow_camera() +{ + flag.follow = FOLLOW_CAMERA; + follow.delay = follow.max_delay = 0.0f; + flag.move = MOVE_ORBIT; } S32 zNPCBPlankton::IsAlive() @@ -1204,16 +1463,64 @@ xFactoryInst* zNPCGoalBPlanktonIdle::create(S32 who, RyzMemGrow* grow, void* inf return new (who, grow) zNPCGoalBPlanktonIdle(who, (zNPCBPlankton&)*info); } +S32 zNPCGoalBPlanktonIdle::Enter(F32 dt, void* ctxt) +{ + F32 tmpFloat; + F32 local_24[3]; + + owner.reappear(); + owner.flag.attacking = false; + owner.refresh_orbit(); + owner.reset_speed(); + owner.flag.follow = owner.FOLLOW_NONE; + get_yaw(tmpFloat, dt); + apply_yaw(tmpFloat); + return zNPCGoalCommon::Enter(dt, ctxt); +} + +S32 zNPCGoalBPlanktonIdle::Exit(F32 dt, void* ctxt) +{ + owner.refresh_orbit(); + return xGoal::Exit(dt, ctxt); +} + xFactoryInst* zNPCGoalBPlanktonAttack::create(S32 who, RyzMemGrow* grow, void* info) { return new (who, grow) zNPCGoalBPlanktonAttack(who, (zNPCBPlankton&)*info); } +S32 zNPCGoalBPlanktonAttack::Enter(F32 dt, void* ctxt) +{ + owner.reappear(); + owner.flag.attacking = true; + owner.refresh_orbit(); + owner.follow_player(); + owner.delay = 0.0f; + owner.face_player(); + owner.reset_speed(); + return zNPCGoalCommon::Enter(dt, ctxt); +} + +S32 zNPCGoalBPlanktonAttack::Exit(F32 dt, void* ctxt) +{ + return xGoal::Exit(dt, ctxt); +} + xFactoryInst* zNPCGoalBPlanktonAmbush::create(S32 who, RyzMemGrow* grow, void* info) { return new (who, grow) zNPCGoalBPlanktonAmbush(who, (zNPCBPlankton&)*info); } +S32 zNPCGoalBPlanktonAmbush::Enter(F32 dt, void* ctxt) +{ + return zNPCGoalCommon::Enter(dt, ctxt); +} + +S32 zNPCGoalBPlanktonAmbush::Exit(F32 dt, void* ctxt) +{ + return xGoal::Exit(dt, ctxt); +} + xFactoryInst* zNPCGoalBPlanktonFlank::create(S32 who, RyzMemGrow* grow, void* info) { return new (who, grow) zNPCGoalBPlanktonFlank(who, (zNPCBPlankton&)*info); @@ -1229,7 +1536,7 @@ xFactoryInst* zNPCGoalBPlanktonHunt::create(S32 who, RyzMemGrow* grow, void* inf return new (who, grow) zNPCGoalBPlanktonHunt(who, (zNPCBPlankton&)*info); } -S32 zNPCGoalBPlanktonHunt::Enter(float dt, void* updCtxt) +S32 zNPCGoalBPlanktonHunt::Enter(F32 dt, void* updCtxt) { owner.reappear(); get_player_loc(); @@ -1241,7 +1548,7 @@ S32 zNPCGoalBPlanktonHunt::Enter(float dt, void* updCtxt) return zNPCGoalCommon::Enter(dt, updCtxt); } -S32 zNPCGoalBPlanktonHunt::Exit(float dt, void* updCtxt) +S32 zNPCGoalBPlanktonHunt::Exit(F32 dt, void* updCtxt) { owner.refresh_orbit(); return xGoal::Exit(dt, updCtxt); @@ -1312,24 +1619,22 @@ xFactoryInst* zNPCGoalBPlanktonBeam::create(S32 who, RyzMemGrow* grow, void* inf S32 zNPCGoalBPlanktonBeam::Enter(float dt, void* updCtxt) { - xParEmitter parE; - xParEmitter& pEmit = parE; // this is one of the codes of all time owner.reappear(); + substate = SS_WARM_UP; owner.delay = 0.0f; - emitted = 0.0f; + emitted = 0; + owner.flag.aim_gun = true; owner.flag.follow = owner.FOLLOW_NONE; - owner.enable_emitter(pEmit); - void play_sound(S32, const xVec3*, F32); // dunno how to get this to call properly + owner.enable_emitter((xParEmitter&)owner.beam_charge); + play_sound(5, (xVec3*)&owner.bound.pad[3], 1.0f); // dunno how to get this to call properly return zNPCGoalCommon::Enter(dt, updCtxt); } S32 zNPCGoalBPlanktonBeam::Exit(float dt, void* updCtxt) { - xParEmitter parE; - xParEmitter& pEmit = parE; // this is one of the codes of all time owner.flag.aim_gun = false; - owner.flag.follow = owner.FOLLOW_NONE; - owner.disable_emitter(pEmit); + owner.flag.follow = owner.FOLLOW_PLAYER; + owner.disable_emitter((xParEmitter&)owner.beam_charge); return xGoal::Exit(dt, updCtxt); } diff --git a/src/SB/Game/zNPCTypeBossPlankton.h b/src/SB/Game/zNPCTypeBossPlankton.h index 075125dad..7836d4a53 100644 --- a/src/SB/Game/zNPCTypeBossPlankton.h +++ b/src/SB/Game/zNPCTypeBossPlankton.h @@ -2,6 +2,7 @@ #define ZNPCTYPEBOSSPLANKTON_H #include "zNPCTypeBoss.h" +#include "zNPCTypeVillager.h" #include "zNPCGoalCommon.h" #include "zEntDestructObj.h" @@ -10,8 +11,7 @@ #include "xTimer.h" #include "zNPCGoals.h" #include "xParEmitter.h" - -struct zNPCNewsFish; +#include "xLaserBolt.h" namespace auto_tweak { @@ -77,8 +77,8 @@ struct zNPCBPlankton : zNPCBoss F32 delay; //0x2c8 xQuat gun_tilt; F32 ambush_delay; - F32 beam_duration; - F32 stun_duration; + F32 beam_duration; // 0x2e0 + F32 stun_duration; // 0x2e4 xDecalEmitter beam_ring; xDecalEmitter beam_glow; xLaserBoltEmitter beam; @@ -115,28 +115,43 @@ struct zNPCBPlankton : zNPCBoss zNPCBPlankton(S32 myType); void Init(xEntAsset*); + void Setup(); + void PostSetup(); + void Reset(); void Destroy(); void Process(xScene*, float); + S32 SysEvent(xBase*, xBase*, unsigned int, const float*, xBase*, int*); void Render(); + void RenderExtraPostParticles(); + void ParseINI(); void SelfSetup(); U32 AnimPick(int, en_NPC_GOAL_SPOT, xGoal*); S32 next_goal(); void render_debug(); - void update_turn(float); - void update_move(float); + void update_turn(F32); + void update_move(F32); void check_player_damage(); - void update_animation(float); - void update_follow(float); - void update_aim_gun(float); - void update_dialog(float); + void reset_territories(); + void update_animation(F32); + void update_follow(F32); + void update_follow_player(F32); + void update_follow_camera(F32); + void update_aim_gun(F32); + void update_dialog(F32); void init_beam(); + void setup_beam(); + void reset_beam(); void vanish(); void reappear(); U32 crony_attacking() const; + void next_territory(); + S32 have_cronies() const; S32 player_left_territory(); void say(int, int, bool); + void sickum(); void aim_gun(xAnimPlay*, xQuat*, xVec3*, int); void here_boy(); + void follow_player(); void follow_camera(); void reset_speed(); void refresh_orbit(); @@ -146,9 +161,10 @@ struct zNPCBPlankton : zNPCBoss U8 ColChkFlags() const; U8 ColChkByFlags() const; - // Not yet organized + // Not yet organized / WEAK void enable_emitter(xParEmitter&) const; void disable_emitter(xParEmitter&) const; + void face_player(); }; struct zNPCGoalBPlanktonIdle : zNPCGoalCommon @@ -160,6 +176,11 @@ struct zNPCGoalBPlanktonIdle : zNPCGoalCommon } static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); + S32 Enter(F32, void*); + S32 Exit(F32, void*); + + S32 get_yaw(F32&, F32&) const; + S32 apply_yaw(F32); }; struct zNPCGoalBPlanktonAttack : zNPCGoalCommon @@ -171,6 +192,8 @@ struct zNPCGoalBPlanktonAttack : zNPCGoalCommon } static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); + S32 Enter(F32, void*); + S32 Exit(F32, void*); }; struct zNPCGoalBPlanktonAmbush : zNPCGoalCommon @@ -182,6 +205,8 @@ struct zNPCGoalBPlanktonAmbush : zNPCGoalCommon } static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); + S32 Enter(F32, void*); + S32 Exit(F32, void*); }; struct zNPCGoalBPlanktonFlank : zNPCGoalCommon @@ -219,8 +244,8 @@ struct zNPCGoalBPlanktonHunt : zNPCGoalCommon static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); - S32 Enter(float, void*); - S32 Exit(float, void*); + S32 Enter(F32, void*); + S32 Exit(F32, void*); }; struct zNPCGoalBPlanktonTaunt : zNPCGoalCommon @@ -232,7 +257,7 @@ struct zNPCGoalBPlanktonTaunt : zNPCGoalCommon } static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); - S32 Process(en_trantype*, float, void*, xScene*); + S32 Process(en_trantype*, F32, void*, xScene*); }; struct zNPCGoalBPlanktonMove : zNPCGoalCommon @@ -244,7 +269,7 @@ struct zNPCGoalBPlanktonMove : zNPCGoalCommon } static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); - S32 Process(en_trantype*, float, void*, xScene*); + S32 Process(en_trantype*, F32, void*, xScene*); }; struct zNPCGoalBPlanktonStun : zNPCGoalCommon @@ -256,9 +281,9 @@ struct zNPCGoalBPlanktonStun : zNPCGoalCommon } static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); - S32 Enter(float, void*); - S32 Exit(float, void*); - S32 Process(en_trantype*, float, void*, xScene*); + S32 Enter(F32, void*); + S32 Exit(F32, void*); + S32 Process(en_trantype*, F32, void*, xScene*); }; struct zNPCGoalBPlanktonFall : zNPCGoalCommon diff --git a/src/SB/Game/zNPCTypeBossSB2.cpp b/src/SB/Game/zNPCTypeBossSB2.cpp index c8f61e473..5df7f7e10 100644 --- a/src/SB/Game/zNPCTypeBossSB2.cpp +++ b/src/SB/Game/zNPCTypeBossSB2.cpp @@ -83,20 +83,11 @@ namespace static U32 sound_asset_ids[10][4]; static sound_data_type sound_data[10]; - static const sound_asset sound_assets[12] = - { - {0, "RSB_laugh", 0, 0}, - {1, "RSB_kah", 0, 0}, - {2, "RSB_chop_windup", 0, 0}, - {3, "RSB_chop_swing", 0, 0}, - {4, "RSB_swipe", 0, 0}, - {5, "RSB_foot_loop", 0, 1}, - {6, "RSB_armhit1", 0, 0}, - {6, "RSB_armhit2", 0, 0}, - {7, "RSB_armhit1", 0, 0}, - {7, "RSB_armhit2", 0, 0}, - {8, "RSB_armsmash", 0, 0}, - {9, "RSB_foor_impact", 0, 0}, + static const sound_asset sound_assets[12] = { + { 0, "RSB_laugh", 0, 0 }, { 1, "RSB_kah", 0, 0 }, { 2, "RSB_chop_windup", 0, 0 }, + { 3, "RSB_chop_swing", 0, 0 }, { 4, "RSB_swipe", 0, 0 }, { 5, "RSB_foot_loop", 0, 1 }, + { 6, "RSB_armhit1", 0, 0 }, { 6, "RSB_armhit2", 0, 0 }, { 7, "RSB_armhit1", 0, 0 }, + { 7, "RSB_armhit2", 0, 0 }, { 8, "RSB_armsmash", 0, 0 }, { 9, "RSB_foor_impact", 0, 0 }, }; S32 set_alpha_blend(xModelInstance*) @@ -118,6 +109,14 @@ namespace return 0; // to-do } + void reset_sound() + { + for (S32 i = 0; i < 10; ++i) + { + sound_data[i].handle = 0; + } + } + S32 play_sound(int, const xVec3*, float) { return 0; // to-do @@ -223,6 +222,11 @@ namespace void register_tweaks(bool init, xModelAssetParam* ap, U32 apsize, const char*); }; + void tweak_group::load(xModelAssetParam* params, U32 size) + { + tweak_group::register_tweaks(true, params, size, NULL); + } + void tweak_group::register_tweaks(bool init, xModelAssetParam* ap, U32 apsize, const char*) { if (init) @@ -975,6 +979,10 @@ namespace } } + void response_curve::end_t() const + { + } + } // namespace xAnimTable* ZNPC_AnimTable_BossSB2() @@ -1285,7 +1293,7 @@ S32 zNPCGoalBossSB2Idle::Exit(float dt, void* updCtxt) S32 zNPCGoalBossSB2Taunt::Enter(float dt, void* updCtxt) { - ::play_sound(0, &owner.sound_loc.mouth , 1.0f); + play_sound(0, &owner.sound_loc.mouth , 1.0f); owner.flag.face_player = 1; return zNPCGoalCommon::Enter(dt, updCtxt); } diff --git a/src/SB/Game/zNPCTypeBossSB2.h b/src/SB/Game/zNPCTypeBossSB2.h index c0b80c4e4..bff1a91a2 100644 --- a/src/SB/Game/zNPCTypeBossSB2.h +++ b/src/SB/Game/zNPCTypeBossSB2.h @@ -14,6 +14,27 @@ namespace auto_tweak void load_param(T1&, T2, T2, T2, xModelAssetParam*, U32, const char*); }; +struct inode; + +struct response_curve +{ + U32 values; // offset 0x0, + inode* curve; // offset 0x4, + U32 nodes; // offset 0x8, + U32 active_node; // offset 0xC, + + void end_t() const; +}; +struct node +{ + F32 t; +}; + +struct inode : node +{ + F32 value[1]; +}; + struct zNPCB_SB2 : zNPCBoss { enum move_enum diff --git a/src/SB/Game/zNPCTypeDutchman.cpp b/src/SB/Game/zNPCTypeDutchman.cpp index 34b003386..321bb0747 100644 --- a/src/SB/Game/zNPCTypeDutchman.cpp +++ b/src/SB/Game/zNPCTypeDutchman.cpp @@ -5,7 +5,6 @@ #include - #define f1605 0.0f #define f1606 1.0f #define f1689 0.2f @@ -36,6 +35,7 @@ static U32 dutchman_count; namespace { + void kill_sound(S32 a, U32 b) { } @@ -161,10 +161,15 @@ namespace tweak_callback cb_blob_pitch; tweak_callback cb_sound; - void register_tweaks(bool init, xModelAssetParam* ap, U32 apsize, const char*); }; + static tweak_group tweak; + + static void set_volume(S32 which, U32, F32 new_vol) + { + } + void tweak_group::register_tweaks(bool init, xModelAssetParam* ap, U32 apsize, const char*) { if (init) @@ -1345,7 +1350,6 @@ xFactoryInst* zNPCGoalDutchmanPostFlame::create(S32 who, RyzMemGrow* grow, void* return new (who, grow) zNPCGoalDutchmanPostFlame(who, (zNPCDutchman&)*info); } - S32 zNPCGoalDutchmanPostFlame::Exit(F32 dt, void* updCtxt) { owner.flag.hurting = 0;