diff --git a/src/SB/Core/x/xBehaviour.h b/src/SB/Core/x/xBehaviour.h index b878f6517..0db2b7249 100644 --- a/src/SB/Core/x/xBehaviour.h +++ b/src/SB/Core/x/xBehaviour.h @@ -215,7 +215,7 @@ struct xGoal : xListItem, xFactoryInst virtual S32 Process(en_trantype* trantype, float dt, void* ctxt, xScene* scene); virtual S32 SysEvent(xBase* from, xBase* to, U32 toEvent, const F32* toParam, - xBase* toParamWidget, S32* handled) + xBase* toParamWidget, S32* handled) { return 1; } diff --git a/src/SB/Core/x/xEnt.h b/src/SB/Core/x/xEnt.h index b52eefc52..602b38524 100644 --- a/src/SB/Core/x/xEnt.h +++ b/src/SB/Core/x/xEnt.h @@ -41,7 +41,7 @@ struct xEntAsset : xBaseAsset F32 greenMult; F32 blueMult; F32 seeThru; - + // Offset: 0x48 F32 seeThruSpeed; U32 modelInfoID; @@ -87,7 +87,7 @@ struct xEntCollis U8 pen; U8 env_sidx; U8 env_eidx; - + U8 npc_sidx; U8 npc_eidx; U8 dyn_sidx; @@ -96,7 +96,7 @@ struct xEntCollis U8 stat_sidx; U8 stat_eidx; U8 idx; - + xCollis colls[18]; void (*post)(xEnt*, xScene*, F32, xEntCollis*); U32 (*depenq)(xEnt*, xEnt*, xScene*, F32, xCollis*); @@ -137,7 +137,7 @@ struct xEnt : xBase // Offset: 0x1B U8 pflags; // p -> physics flags - U8 moreFlags; + U8 moreFlags; //0x1c U8 isCulled; U8 driving_count; U8 num_ffx; @@ -163,7 +163,7 @@ struct xEnt : xBase // Offset: 0x44 xEntRenderCallback render; xEntFrame* frame; - xEntCollis* collis; + xEntCollis* collis; //0x4c // Offset: 0x50 xGridBound gridb; @@ -172,8 +172,8 @@ struct xEnt : xBase xBound bound; // Offset: 0xB0 - xEntTranslateCallback transl; - xFFX* ffx; + xEntTranslateCallback transl; //0xb0 + xFFX* ffx; //0xb4 xEnt* driver; S32 driveMode; diff --git a/src/SB/Game/zNPCSndTable.h b/src/SB/Game/zNPCSndTable.h index ed89a46c3..717d41611 100644 --- a/src/SB/Game/zNPCSndTable.h +++ b/src/SB/Game/zNPCSndTable.h @@ -43,13 +43,13 @@ struct NPCSndTrax U32 aid_sound; }; -struct NPCSndQueue +struct NPCSndQueue //0x14 { - U32 sndDirect; - en_NPC_SOUND sndtype; - S32 flg_snd; - F32 tmr_delay; - F32 radius; + U32 sndDirect; //0x0 + en_NPC_SOUND sndtype; //0x4 + S32 flg_snd; //0x8 + F32 tmr_delay; //0xC + F32 radius; //0x10 }; void NPCS_Startup(); diff --git a/src/SB/Game/zNPCTypeCommon.h b/src/SB/Game/zNPCTypeCommon.h index 1cb628024..3e7a5d806 100644 --- a/src/SB/Game/zNPCTypeCommon.h +++ b/src/SB/Game/zNPCTypeCommon.h @@ -363,7 +363,7 @@ struct zNPCLassoInfo xModelInstance* grabGuideModel; }; -struct zNPCCommon : xNPCBasic +struct zNPCCommon : xNPCBasic //Size of zNPCCommon: 0x2A0 { xEntAsset* entass; // 0x1BC xEntNPCAsset* npcass; // 0x1C0 @@ -388,11 +388,11 @@ struct zNPCCommon : xNPCBasic S32 flg_xtrarend; F32 tmr_fidget; F32 tmr_invuln; // 0x23C - zShrapnelAsset* explosion; - xModelAssetParam* parmdata; - U32 pdatsize; - zNPCLassoInfo* lassdata; - NPCSndQueue snd_queue[4]; + zShrapnelAsset* explosion; // 0x240 + xModelAssetParam* parmdata; // 0x244 + U32 pdatsize; //0x248 + zNPCLassoInfo* lassdata; //0x24C + NPCSndQueue snd_queue[4]; //0x250 zNPCCommon(S32 myType); @@ -436,8 +436,7 @@ struct zNPCCommon : xNPCBasic S32 LassoUseGuides(S32 idx_grabmdl, S32 idx_holdmdl); S32 GetVertPos(en_mdlvert vid, xVec3* pos); void Vibrate(en_npcvibe vibe, F32 duration); - void AddScripting(xPsyche* psy, - S32 (*eval_script)(xGoal*, void*, en_trantype*, F32, void*), + void AddScripting(xPsyche* psy, S32 (*eval_script)(xGoal*, void*, en_trantype*, F32, void*), S32 (*eval_playanim)(xGoal*, void*, en_trantype*, F32, void*), S32 (*eval_attack)(xGoal*, void*, en_trantype*, F32, void*), S32 (*eval_move)(xGoal*, void*, en_trantype*, F32, void*), @@ -488,7 +487,7 @@ struct zNPCCommon : xNPCBasic virtual void NewTime(xScene* xscn, F32 dt); virtual void Move(xScene* xscn, F32 dt, xEntFrame*); virtual S32 SysEvent(xBase* from, xBase* to, U32 toEvent, const F32* toParam, - xBase* toParamWidget, S32* handled); + xBase* toParamWidget, S32* handled); virtual void CollideReview(); virtual void Destroy(); @@ -642,8 +641,8 @@ void ZNPC_Common_Shutdown(); void NPCC_BuildStandardAnimTran(xAnimTable* table, char** namelist, S32* ourAnims, S32 idx_dflt, F32 blend); -xAnimTable * ZNPC_AnimTable_Common(); -xAnimTable * ZNPC_AnimTable_LassoGuide(); +xAnimTable* ZNPC_AnimTable_Common(); +xAnimTable* ZNPC_AnimTable_LassoGuide(); S32 NPCC_NPCIsConversing(); void zNPCCommon_EjectPhlemOnPawz(); U32 xSndIsPlaying(U32 assetID, U32 parid); diff --git a/src/SB/Game/zNPCTypeDutchman.cpp b/src/SB/Game/zNPCTypeDutchman.cpp index db6a368f0..fb441e0a1 100644 --- a/src/SB/Game/zNPCTypeDutchman.cpp +++ b/src/SB/Game/zNPCTypeDutchman.cpp @@ -35,6 +35,19 @@ void zNPCDutchman::Render() zNPCDutchman::render_debug(); } +void zNPCDutchman::Damage(en_NPC_DAMAGE_TYPE, xBase*, const xVec3*) +{ + xPsyche* psy = this->psy_instinct; + psy->GIDOfActive(); +} + +// double zNPCDutchman::goal_delay() +// { +// move_info* tempR4; +// tempR4 = &this->move; +// move = *tempR4; +// } + void zNPCDutchman::render_debug() { } @@ -43,10 +56,18 @@ void zNPCDutchman::update_animation(float) { } +void zNPCDutchman::stop_hand_trail() +{ +} + void zNPCDutchman::add_splash(const xVec3&, float) { } +void zNPCDutchman::stop_flames() +{ +} + void zNPCDutchman::vanish() { } @@ -87,6 +108,23 @@ S32 zNPCGoalDutchmanBeam::Exit(F32 dt, void* updCtxt) return xGoal::Exit(dt, updCtxt); } +S32 zNPCGoalDutchmanFlame::Exit(F32 dt, void* updCtxt) +{ + S32 tempR0; + tempR0 = this->owner.flg_vuln; + tempR0 = tempR0 &= 0xFEFFFFFF; + this->owner.flg_vuln = tempR0; + + owner.stop_flames(); + owner.stop_hand_trail(); + return xGoal::Exit(dt, updCtxt); +} + +S32 zNPCGoalDutchmanCaught::Exit(float dt, void* updCtxt) +{ + return xGoal::Exit(dt, updCtxt); +} + U8 zNPCDutchman::PhysicsFlags() const { return 3; diff --git a/src/SB/Game/zNPCTypeDutchman.h b/src/SB/Game/zNPCTypeDutchman.h index c4cdc06ea..c8459a764 100644 --- a/src/SB/Game/zNPCTypeDutchman.h +++ b/src/SB/Game/zNPCTypeDutchman.h @@ -4,6 +4,8 @@ #include "zNPCTypeSubBoss.h" #include "zNPCGoalCommon.h" #include "containers.h" +#include "xBehaviour.h" +#include "zNPCTypeCommon.h" struct zNPCDutchman : zNPCSubBoss { @@ -80,11 +82,11 @@ struct zNPCDutchman : zNPCSubBoss move_enum move; fade_enum fade; } flag; - S32 life; - S32 round; - S32 stage; - F32 delay; - F32 alpha; + S32 life; //0x2B4 + S32 round; //0x2B8 + S32 stage; //0x2BC + F32 delay; //0x2C0 + F32 alpha; //0x2C4 struct { xVec2 dir; @@ -92,7 +94,7 @@ struct zNPCDutchman : zNPCSubBoss F32 accel; F32 max_vel; } turn; - move_info move; + move_info move; //0x2C8 struct { U8 moreFlags; @@ -144,7 +146,10 @@ struct zNPCDutchman : zNPCSubBoss void update_animation(float); void add_splash(const xVec3&, float); void vanish(); + void stop_flames(); + void stop_hand_trail(); void reset_speed(); + void Damage(en_NPC_DAMAGE_TYPE, xBase*, const xVec3*); U8 PhysicsFlags() const; U8 ColPenByFlags() const; U8 ColChkByFlags() const; @@ -244,6 +249,7 @@ struct zNPCGoalDutchmanFlame : zNPCGoalCommon xVec2 move_dir; U8 stopped; zNPCDutchman& owner; + S32 Exit(float, void*); static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); }; @@ -259,6 +265,7 @@ struct zNPCGoalDutchmanCaught : zNPCGoalCommon { U8 grabbed; zNPCDutchman& owner; + S32 Exit(float, void*); static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); }; @@ -271,6 +278,12 @@ struct zNPCGoalDutchmanDamage : zNPCGoalCommon static xFactoryInst* create(S32 who, RyzMemGrow* grow, void* info); }; +struct delay_goal +{ + U32 goal; + F32 delay; +}; + struct zNPCGoalDutchmanDeath : zNPCGoalCommon { enum substate_enum diff --git a/src/SB/Game/zNPCTypeKingJelly.cpp b/src/SB/Game/zNPCTypeKingJelly.cpp index 20258e311..6b95c0b11 100644 --- a/src/SB/Game/zNPCTypeKingJelly.cpp +++ b/src/SB/Game/zNPCTypeKingJelly.cpp @@ -2,6 +2,93 @@ #include +namespace +{ + void tweak() + { + } +} // namespace + +void lightning_ring::create() +{ +} + +xVec3* zNPCKingJelly::get_bottom() +{ + return (xVec3*)&this->model->Mat->pos; +} + +void zNPCKingJelly::Setup() +{ + this->children_size = 0; //Called for address 0x88C, Started plugging things in till it matched. + load_model(); + load_curtain_model(); + zNPCSubBoss::Setup(); +} + +void zNPCKingJelly::Destroy() +{ + decompose(); + post_decompose(); + zNPCCommon::Destroy(); +} + +void zNPCKingJelly::BUpdate(xVec3* pos) +{ + // Original stack variables: + //xVec3& subloc; + //xVec3 loc; + + // Something like this... + // Some vec is being added to another on the stack (probably) + // (xVec3&)this->model->Mat->pos = (xVec3&)this->model->Mat->pos + *pos; + + zNPCCommon::BUpdate(pos); +} + +// probably how many times the jellyfish can hit the player for that round +// whatever round it is, add one. +// Round = 0, max strikes = 1 +// Round = 1, max strikes = 2 +// Round = 2, max strikes = 3 +S32 zNPCKingJelly::max_strikes() +{ + return round + 1; +} + +//void zNPCKingJelly::update_round() +//{ +// if (life == 0) +// { +// store zero in something?? +// 0x2bc +// round = 0; +// return; +// } + +//round = life-- * 3; + +// updating 0x2bc +// round = + +/* + // Done + if (*(int *)(param_1 + 0x2c4) == 0) { + *(undefined4 *)(param_1 + 700) = 0; + return; + } + // 0x2BC + + ???? + *(int *)(param_1 + 700) = 2 - ((*(int *)(param_1 + 0x2c4) + -1) * 3) / DAT_80328544; + round = 2 - ((life) + -1) * 3) / DAT_80328544; + */ +// life--; +// tweak(); +// tweak(); +//tweak(); +//} + void zNPCKingJelly::on_change_ambient_ring(const tweak_info&) { } @@ -14,6 +101,69 @@ void zNPCKingJelly::render_debug() { } +void zNPCKingJelly::decompose() +{ +} + +void zNPCKingJelly::post_decompose() +{ +} + +void zNPCKingJelly::vanish() +{ + old.moreFlags = moreFlags; + pflags = 0; + moreFlags = 0; + flags2.flg_colCheck = 0; + flags2.flg_penCheck = 0; + chkby = 0; + penby = 0; + xEntHide(this); +} + +void zNPCKingJelly::reappear() +{ + moreFlags = old.moreFlags; + this->RestoreColFlags(); + xEntShow(this); +} + void zNPCKingJelly::create_tentacle_lightning() { } + +void zNPCKingJelly::generate_spawn_particles() +{ +} + +void zNPCKingJelly::load_model() +{ +} + +void zNPCKingJelly::load_curtain_model() +{ +} + +S32 zNPCGoalKJDamage::Process(en_trantype* trantype, F32 dt, void* updCtxt, xScene* xscn) +{ + // TODO + return 0; +} + +S32 zNPCGoalKJDamage::Enter(F32 dt, void* updCtxt) +{ + // TODO + return 0; +} + +S32 zNPCGoalKJDamage::Exit(F32 dt, void* updCtxt) +{ + // Needs to be a reference, casting as a pointer doesn't work. + // Would never have gotten this if not for DWARF data. + zNPCKingJelly& kj = *(zNPCKingJelly*)this->psyche->clt_owner; + + kj.update_round(); + kj.disable_tentacle_damage = false; + + return xGoal::Exit(dt, updCtxt); +} diff --git a/src/SB/Game/zNPCTypeKingJelly.h b/src/SB/Game/zNPCTypeKingJelly.h index 336be168c..70ba294ad 100644 --- a/src/SB/Game/zNPCTypeKingJelly.h +++ b/src/SB/Game/zNPCTypeKingJelly.h @@ -3,6 +3,7 @@ #include "zNPCTypeSubBoss.h" #include "zNPCGoalCommon.h" +#include "xEnt.h" struct lightning_ring { @@ -36,6 +37,8 @@ struct lightning_ring zLightning* arcs[8]; U32 arcs_size; void (*update_callback)(lightning_ring&, F32); + + void create(); }; struct zNPCKingJelly : zNPCSubBoss @@ -79,7 +82,7 @@ struct zNPCKingJelly : zNPCSubBoss struct { - U8 moreFlags; + U8 moreFlags; //0x2B4 } old; struct { @@ -89,19 +92,19 @@ struct zNPCKingJelly : zNPCSubBoss bool stop_moving; bool updated; } flag; - S32 round; - S32 attack; - S32 life; - U32 player_life; - S32 show_vertex; - U8 enabled; - shockstate_enum shockstate; - F32 spawn_particle_vel; + S32 round; //0x2BC + S32 attack; //0x2C0 + S32 life; // 0x2C4 + U32 player_life; // + S32 show_vertex; // + U8 enabled; // + shockstate_enum shockstate; // + F32 spawn_particle_vel; //0x2D8 xModelInstance* submodel[4]; struct { - U8 active; - S32 count; + U8 active; //0x2EC + S32 count; //0x2f0 F32 intensity; F32 delay; } blink; @@ -111,24 +114,37 @@ struct zNPCKingJelly : zNPCSubBoss xVec3 last_target; } camera; child_data children[32]; - U32 children_size; + U32 children_size; //0x88C F32 last_tentacle_shock; zLightning* tentacle_lightning[7]; xVec3 tentacle_points[13][7]; lightning_ring ambient_rings[3]; lightning_ring wave_rings[4]; - U8 disable_tentacle_damage; + U8 disable_tentacle_damage; // 0x1090 F32 next_pulse; F32 last_pulse; zEnt* curtain_ent; xModelInstance* curtain_model[5]; - U8 first_update; + U8 first_update; //0x10B4 zNPCKingJelly(S32 myType); + void Setup(); + void Destroy(); + void BUpdate(xVec3*); + S32 max_strikes(); + void load_model(); + void load_curtain_model(); + void decompose(); + void post_decompose(); + void vanish(); + void reappear(); + xVec3* get_bottom(); void on_change_ambient_ring(const tweak_info&); void on_change_fade_obstructions(const tweak_info&); void render_debug(); void create_tentacle_lightning(); + void generate_spawn_particles(); + void update_round(); }; struct zNPCGoalKJIdle : zNPCGoalCommon @@ -183,6 +199,10 @@ struct zNPCGoalKJDamage : zNPCGoalCommon zNPCGoalKJDamage(S32 goalID) : zNPCGoalCommon(goalID) { } + + S32 Process(en_trantype* trantype, F32 dt, void* updCtxt, xScene* xscn); + S32 Exit(F32 dt, void* updCtxt); + S32 Enter(F32 dt, void* updCtxt); }; struct zNPCGoalKJDeath : zNPCGoalCommon diff --git a/src/SB/Game/zNPCTypeSubBoss.h b/src/SB/Game/zNPCTypeSubBoss.h index b46649270..a597c5375 100644 --- a/src/SB/Game/zNPCTypeSubBoss.h +++ b/src/SB/Game/zNPCTypeSubBoss.h @@ -4,9 +4,9 @@ #include "zNPCTypeCommon.h" #include "zNPCSupport.h" -struct zNPCSubBoss : zNPCCommon +struct zNPCSubBoss : zNPCCommon //Size of zNPCSubBoss: 0x2B4 { - NPCTarget tgt_cur; + NPCTarget tgt_cur; //0x2A0 zNPCSubBoss(S32 myType);