diff --git a/src/SB/Game/zNPCFXCinematic.cpp b/src/SB/Game/zNPCFXCinematic.cpp index 47d64ad7e..1cd92f044 100644 --- a/src/SB/Game/zNPCFXCinematic.cpp +++ b/src/SB/Game/zNPCFXCinematic.cpp @@ -1,10 +1,10 @@ #include "xVec3.h" #include "xMath3.h" +#include "xParEmitter.h" #include "zNPCFXCinematic.h" #include -#include "xCutscene.h" static S32 init = 0; @@ -20,6 +20,544 @@ void zNPCFXCinematic_Init() } } +void NCIN_Par_BPLANK_JET_1_Upd(const zCutsceneMgr*, NCINEntry* fxrec, S32 param) +{ + if (param != 0) + { + fxrec->flg_stat |= 4; + return; + } + + if (fxrec->flg_stat & 2) + { + fxrec->fxdata.pardata.emitter = zParEmitterFind("PAREMIT_BPLANK_JET_1"); + + if (fxrec->fxdata.pardata.emitter->tasset) + { + if (fxrec->fxdata.pardata.emitter->tasset->emit_type != 15) + { + fxrec->fxdata.pardata.emitter = NULL; + } + } + } + + if (fxrec->fxdata.pardata.emitter == NULL) + { + fxrec->flg_stat |= 4; + return; + } + + F32& float_accum = fxrec->pos_A[1].y; + + if (float_accum < 0.0f) + { + U8 val = fxrec->fxdata.pardata.emitter->emit_pad[0]; + float_accum = 20.0f + val; + } + + fxrec->pos_B[0] = 5.0f; +} + +void NCIN_Par_BPLANK_JET_2_Upd(const zCutsceneMgr*, NCINEntry* fxrec, S32 param) +{ + if (param != 0) + { + fxrec->flg_stat |= 4; + return; + } + + if (fxrec->flg_stat & 2) + { + fxrec->fxdata.pardata.emitter = zParEmitterFind("PAREMIT_BPLANK_JET_2"); + + if (fxrec->fxdata.pardata.emitter->tasset) + { + if (fxrec->fxdata.pardata.emitter->tasset->emit_type != 15) + { + fxrec->fxdata.pardata.emitter = NULL; + } + } + } + + if (fxrec->fxdata.pardata.emitter == NULL) + { + fxrec->flg_stat |= 4; + return; + } + + F32& float_accum = fxrec->pos_A[1].y; + + if (float_accum < 0.0f) + { + U8 val = fxrec->fxdata.pardata.emitter->emit_pad[0]; + float_accum = 20.0f + val; + } + + fxrec->pos_B[0] = 5.0f; +} + +void NCIN_Par_BPLANK_SBB_FLAMES_1_Upd(const zCutsceneMgr*, NCINEntry* fxrec, S32 param) +{ + if (param != 0) + { + fxrec->flg_stat |= 4; + return; + } + + if (fxrec->flg_stat & 2) + { + fxrec->fxdata.pardata.emitter = zParEmitterFind("PAREMIT_SBB_FLAMES_1"); + + if (fxrec->fxdata.pardata.emitter->tasset) + { + if (fxrec->fxdata.pardata.emitter->tasset->emit_type != 15) + { + fxrec->fxdata.pardata.emitter = NULL; + } + } + } + + if (fxrec->fxdata.pardata.emitter == NULL) + { + fxrec->flg_stat |= 4; + return; + } + + F32& float_accum = fxrec->pos_A[1].y; + + if (float_accum < 0.0f) + { + U8 val = fxrec->fxdata.pardata.emitter->emit_pad[0]; + float_accum = 20.0f + val; + } + + fxrec->pos_B[0] = 5.0f; +} + +void NCIN_Par_BPLANK_SBB_FLAMES_2_Upd(const zCutsceneMgr*, NCINEntry* fxrec, S32 param) +{ + if (param != 0) + { + fxrec->flg_stat |= 4; + return; + } + + if (fxrec->flg_stat & 2) + { + fxrec->fxdata.pardata.emitter = zParEmitterFind("PAREMIT_SBB_FLAMES_2"); + + if (fxrec->fxdata.pardata.emitter->tasset) + { + if (fxrec->fxdata.pardata.emitter->tasset->emit_type != 15) + { + fxrec->fxdata.pardata.emitter = NULL; + } + } + } + + if (fxrec->fxdata.pardata.emitter == NULL) + { + fxrec->flg_stat |= 4; + return; + } + + F32& float_accum = fxrec->pos_A[1].y; + + if (float_accum < 0.0f) + { + U8 val = fxrec->fxdata.pardata.emitter->emit_pad[0]; + float_accum = 20.0f + val; + } + + fxrec->pos_B[0] = 5.0f; +} + +void NCIN_Par_BPLANK_SBB_JET_1_Upd(const zCutsceneMgr*, NCINEntry* fxrec, S32 param) +{ + if (param != 0) + { + fxrec->flg_stat |= 4; + return; + } + + if (fxrec->flg_stat & 2) + { + fxrec->fxdata.pardata.emitter = zParEmitterFind("PAREMIT_SBB_JET_1"); + + if (fxrec->fxdata.pardata.emitter->tasset) + { + if (fxrec->fxdata.pardata.emitter->tasset->emit_type != 15) + { + fxrec->fxdata.pardata.emitter = NULL; + } + } + } + + if (fxrec->fxdata.pardata.emitter == NULL) + { + fxrec->flg_stat |= 4; + return; + } + + F32& float_accum = fxrec->pos_A[1].y; + + if (float_accum < 0.0f) + { + U8 val = fxrec->fxdata.pardata.emitter->emit_pad[0]; + float_accum = 20.0f + val; + } + + fxrec->pos_B[0] = 5.0f; +} + +void NCIN_Par_BPLANK_SBB_JET_2_Upd(const zCutsceneMgr*, NCINEntry* fxrec, S32 param) +{ + if (param != 0) + { + fxrec->flg_stat |= 4; + return; + } + + if (fxrec->flg_stat & 2) + { + fxrec->fxdata.pardata.emitter = zParEmitterFind("PAREMIT_SBB_JET_2"); + + if (fxrec->fxdata.pardata.emitter->tasset) + { + if (fxrec->fxdata.pardata.emitter->tasset->emit_type != 15) + { + fxrec->fxdata.pardata.emitter = NULL; + } + } + } + + if (fxrec->fxdata.pardata.emitter == NULL) + { + fxrec->flg_stat |= 4; + return; + } + + F32& float_accum = fxrec->pos_A[1].y; + + if (float_accum < 0.0f) + { + U8 val = fxrec->fxdata.pardata.emitter->emit_pad[0]; + float_accum = 20.0f + val; + } + + fxrec->pos_B[0] = 5.0f; +} + +void NCIN_Par_BPLANK_SBB_SMOKE_1_Upd(const zCutsceneMgr*, NCINEntry* fxrec, S32 param) +{ + if (param != 0) + { + fxrec->flg_stat |= 4; + return; + } + + if (fxrec->flg_stat & 2) + { + fxrec->fxdata.pardata.emitter = zParEmitterFind("PAREMIT_SBB_SMOKE_1"); + + if (fxrec->fxdata.pardata.emitter->tasset) + { + if (fxrec->fxdata.pardata.emitter->tasset->emit_type != 15) + { + fxrec->fxdata.pardata.emitter = NULL; + } + } + } + + if (fxrec->fxdata.pardata.emitter == NULL) + { + fxrec->flg_stat |= 4; + return; + } + + F32& float_accum = fxrec->pos_A[1].y; + + if (float_accum < 0.0f) + { + U8 val = fxrec->fxdata.pardata.emitter->emit_pad[0]; + float_accum = 20.0f + val; + } + + fxrec->pos_B[0] = 5.0f; +} + +void NCIN_Par_BPLANK_SBB_SMOKE_2_Upd(const zCutsceneMgr*, NCINEntry* fxrec, S32 param) +{ + if (param != 0) + { + fxrec->flg_stat |= 4; + return; + } + + if (fxrec->flg_stat & 2) + { + fxrec->fxdata.pardata.emitter = zParEmitterFind("PAREMIT_SBB_SMOKE_2"); + + if (fxrec->fxdata.pardata.emitter->tasset) + { + if (fxrec->fxdata.pardata.emitter->tasset->emit_type != 15) + { + fxrec->fxdata.pardata.emitter = NULL; + } + } + } + + if (fxrec->fxdata.pardata.emitter == NULL) + { + fxrec->flg_stat |= 4; + return; + } + + F32& float_accum = fxrec->pos_A[1].y; + + if (float_accum < 0.0f) + { + U8 val = fxrec->fxdata.pardata.emitter->emit_pad[0]; + float_accum = 20.0f + val; + } + + fxrec->pos_B[0] = 5.0f; +} + +void NCIN_Par_CIN_BIGDUP_SMOKE_Upd(const zCutsceneMgr*, NCINEntry* fxrec, S32 param) +{ + if (param != 0) + { + fxrec->flg_stat |= 4; + return; + } + + if (fxrec->flg_stat & 2) + { + fxrec->fxdata.pardata.emitter = zParEmitterFind("PAREMIT_CIN_BIGUP_SMOKE"); + + if (fxrec->fxdata.pardata.emitter->tasset) + { + if (fxrec->fxdata.pardata.emitter->tasset->emit_type != 15) + { + fxrec->fxdata.pardata.emitter = NULL; + } + } + } + + if (fxrec->fxdata.pardata.emitter == NULL) + { + fxrec->flg_stat |= 4; + return; + } + + F32& float_accum = fxrec->pos_A[1].y; + + if (float_accum < 0.0f) + { + U8 val = fxrec->fxdata.pardata.emitter->emit_pad[0]; + float_accum = 20.0f + val; + } + + fxrec->pos_B[0] = 5.0f; +} + +void NCIN_Par_CIN_BIGDUP_SPAWN_Upd(const zCutsceneMgr*, NCINEntry* fxrec, S32 param) +{ + if (param != 0) + { + fxrec->flg_stat |= 4; + return; + } + + if (fxrec->flg_stat & 2) + { + fxrec->fxdata.pardata.emitter = zParEmitterFind("PAREMIT_CIN_BIGUP_SPAWN"); + + if (fxrec->fxdata.pardata.emitter->tasset) + { + if (fxrec->fxdata.pardata.emitter->tasset->emit_type != 15) + { + fxrec->fxdata.pardata.emitter = NULL; + } + } + } + + if (fxrec->fxdata.pardata.emitter == NULL) + { + fxrec->flg_stat |= 4; + return; + } + + F32& float_accum = fxrec->pos_A[1].y; + + if (float_accum < 0.0f) + { + U8 val = fxrec->fxdata.pardata.emitter->emit_pad[0]; + float_accum = 20.0f + val; + } + + fxrec->pos_B[0] = 5.0f; +} + +void NCIN_Par_CIN_PLATFORM_JETS_Upd(const zCutsceneMgr*, NCINEntry* fxrec, S32 param) +{ + if (param != 0) + { + fxrec->flg_stat |= 4; + return; + } + + if (fxrec->flg_stat & 2) + { + fxrec->fxdata.pardata.emitter = zParEmitterFind("PAREMIT_CIN_PLATFORM_JETS"); + + if (fxrec->fxdata.pardata.emitter->tasset) + { + if (fxrec->fxdata.pardata.emitter->tasset->emit_type != 15) + { + fxrec->fxdata.pardata.emitter = NULL; + } + } + } + + if (fxrec->fxdata.pardata.emitter == NULL) + { + fxrec->flg_stat |= 4; + return; + } + + F32& float_accum = fxrec->pos_A[1].y; + + if (float_accum < 0.0f) + { + U8 val = fxrec->fxdata.pardata.emitter->emit_pad[0]; + float_accum = 20.0f + val; + } + + fxrec->pos_B[0] = 5.0f; +} + +void NCIN_Generic_Upd(const zCutsceneMgr*, NCINEntry* fxrec, S32 param) +{ + if (param != 0) + { + fxrec->flg_stat |= 4; + return; + } +} + +void NCIN_BubSlam(const zCutsceneMgr*, NCINEntry* fxrec, S32 param) +{ + if (param != 0) + { + fxrec->flg_stat |= 4; + return; + } + + if (!(fxrec->flg_stat & 2)) + { + return; + } + + switch (fxrec->typ_ncinfx) + { + case 3: + zFX_SpawnBubbleSlam(&fxrec->pos_A[0], 64, fxrec->tym_beg, fxrec->tym_end, fxrec->tym_end); + break; + case 2: + zFX_SpawnBubbleSlam(&fxrec->pos_A[0], 128, fxrec->tym_beg, fxrec->tym_end, fxrec->tym_end); + break; + default: + break; + } +} + +void NCIN_BubTrailBone_AR(const zCutsceneMgr*, NCINEntry* fxrec, RpAtomic*, RwMatrixTag*, U32 num_1, U32 num_2) +{ + S32 ifx = fxrec->pos_A[1].x; + S32 ify = fxrec->pos_A[1].y; + + if (num_1 != ifx) + { + return; + } + + xVec3 pos = fxrec->pos_A[2]; + + if (ify > 0) + { + xVec3& offset = fxrec->pos_B[ify]; + pos += offset; + } + + zFX_SpawnBubbleTrail(&pos, 1); +} + +void NCIN_BubHit(const zCutsceneMgr*, NCINEntry* fxrec, S32 param) +{ + if (param != 0) + { + fxrec->flg_stat |= 4; + return; + } + + else + { + if (fxrec->flg_stat & 2) + { + zFX_SpawnBubbleHit(&fxrec->pos_A[0], 16); + } + + zFX_SpawnBubbleHit(&fxrec->pos_A[0], 3); + } +} + +void NCIN_Zapper(const zCutsceneMgr*, NCINEntry* fxrec, S32 param) +{ + if (param != 0) + { + fxrec->flg_stat |= 4; + + if (fxrec->idx_anim == 29 || fxrec->idx_anim == 8) + { + if (fxrec->fxdata.lytdata.lyt_zap != NULL) + { + zLightningKill(fxrec->fxdata.lytdata.lyt_zap); + } + + fxrec->fxdata.lytdata.lyt_zap = NULL; + } + return; + } + + if (fxrec->flg_stat & 2) + { + memset(&fxrec->fxdata.arcdata.lightning, 0, sizeof(fxrec->fxdata.arcdata.lightning)); + } + + if (fxrec->fxdata.lytdata.lyt_zap == NULL) + { + fxrec->flg_stat |= 4; + } +} + +void NCIN_HammerShock(const zCutsceneMgr*, NCINEntry* fxrec, S32 param) +{ + if (param != 0) + { + fxrec->flg_stat |= 4; + return; + } + + if (fxrec->flg_stat & 2) + { + zFXHammer(&fxrec->pos_A[0]); + fxrec->flg_stat |= 4; + } +} + + void clamp_bone_index(NCINEntry*, RpAtomic*) { } diff --git a/src/SB/Game/zNPCFXCinematic.h b/src/SB/Game/zNPCFXCinematic.h index 8cc5e0b09..bca187829 100644 --- a/src/SB/Game/zNPCFXCinematic.h +++ b/src/SB/Game/zNPCFXCinematic.h @@ -53,7 +53,6 @@ struct NPARData struct NPARXtraData { - }; struct NPARMgmt diff --git a/src/SB/Game/zTalkBox.cpp b/src/SB/Game/zTalkBox.cpp index f39f00241..dc984e90e 100644 --- a/src/SB/Game/zTalkBox.cpp +++ b/src/SB/Game/zTalkBox.cpp @@ -1,3 +1,19 @@ #include "zTalkBox.h" #include + +namespace +{ + struct SharedTalkboxState + { + void* padding[2]; // FIXME: variables not verified + ztalkbox* active; + }; + + SharedTalkboxState ztalkbox_shared; +} + +ztalkbox* ztalkbox::get_active() +{ + return ztalkbox_shared.active; +} diff --git a/src/SB/Game/zTalkBox.h b/src/SB/Game/zTalkBox.h index 776ecb790..7772d2aed 100644 --- a/src/SB/Game/zTalkBox.h +++ b/src/SB/Game/zTalkBox.h @@ -86,6 +86,8 @@ struct ztalkbox : xBase static void reset_all(); static void permit(U32 add_flags, U32 remove_flags); + + static ztalkbox* get_active(); void start_talk(U32 textID, callback*, zNPCCommon*); // FIXME: params not verified void stop_talk();