Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 94 additions & 1 deletion src/SB/Game/zNPCHazard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include "zGlobals.h"
#include "zNPCTypeCommon.h"
#include "zNPCTypes.h"
#include "zNPCSupplement.h"
#include "xMath.h"

extern U32 g_hash_hazanim[3];
extern char* g_strz_hazanim[3];
Expand Down Expand Up @@ -177,6 +179,56 @@ void NPCHazard::Reconfigure(en_npchaz haztype)
}
}

void NPCHazard::FreeModel()
{
if (mdl_hazard != NULL)
{
xModelInstanceFree(mdl_hazard);
}
mdl_hazard = NULL;
}

void NPCHazard::Discard()
{
if ((flg_hazard & 1) != 0)
{
if (cb_notify != NULL)
{
cb_notify->Notify((en_haznote)0, this);
}

Cleanup();

g_cnt_activehaz &= ~((g_cnt_activehaz-1) >> 31);
}
}

void NPCHazard::Kill()
{
if ((flg_hazard & 1) != 0)
{
if (cb_notify != NULL)
{
cb_notify->Notify(HAZ_NOTE_ABORT, this);
}
Discard();
}
}

void NPCHazard::Start(const xVec3* pos, F32 tym)
{
if (tym > 0.0f)
{
tmr_remain = tym;
}
tym_lifespan = tmr_remain;
if (pos != NULL)
{
PosSet(pos);
}
flg_hazard |= 0x1a;
}

void NPCHazard::PosSet(const xVec3* pos)
{
if (pos != NULL)
Expand Down Expand Up @@ -259,6 +311,45 @@ void NPCHazard::Upd_Patriot(F32)
{
}

S32 NPCHazard::KickSteamyStinky()
{
S32 ok;
NPCHazard* haz = (NPCHazard *)HAZ_Acquire();

F32 tym_lifeOfChild = 0.25f;

if (haz == NULL)
{
ok = 0;
}
else
{
if (haz->ConfigHelper(NPC_HAZ_TARTARSTINK) == 0)
{
haz->Discard();
ok = 1;
}
else
{
haz->Start(&pos_hazard, tmr_remain - tym_lifeOfChild);
ok = 2;
}
}
return ok;
}

void NPCHazard::TarTarGunkTrail()
{
xVec3 pos = pos_hazard;
NPAR_EmitTarTarTrail(&pos, &g_Y3);
}

void NPCHazard::ReconArfBone()
{
Reconfigure(NPC_HAZ_ARFBONEBLAST);
Start(NULL, -1.0f);
}

void UVAModelInfo::Hemorrage()
{
model = 0;
Expand All @@ -280,8 +371,10 @@ S32 UVAModelInfo::GetUV(RwTexCoords*& coords, S32& numVertices, RpAtomic* model)
{
return 0;
}

coords = geom->texCoords[0];
return (-(S32)coords->u | (U32)coords->u) >> 0x1f;

return coords != NULL;
}

RwV3d* NPCHazard::At() const
Expand Down
4 changes: 4 additions & 0 deletions src/SB/Game/zNPCHazard.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ struct NPCHazard
NPCHazard(en_npchaz haztype);
S32 ConfigHelper(en_npchaz haztype);
void Reconfigure(en_npchaz haztype);
void FreeModel();
void SetNPCOwner(zNPCCommon* owner);
void Start(const xVec3* pos, F32 tym);
void MarkForRecycle();
Expand All @@ -224,6 +225,9 @@ struct NPCHazard
S32 ColTestCyl(const xBound* bnd_tgt, F32 rad, F32 hyt);
S32 ColPlyrSphere(F32 rad);
S32 ColPlyrCyl(F32 rad, F32 hyt);
void TarTarGunkTrail();
S32 KickSteamyStinky();
void ReconArfBone();
void HurtThePlayer();
void TypData_RotMatSet(xMat3x3* mat);
void TypData_RotMatApply(xMat3x3* mat);
Expand Down
1 change: 1 addition & 0 deletions src/SB/Game/zNPCSupplement.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ void NPCSupplement_ScenePostInit();
void NPCSupplement_Timestep(F32 dt);
void NPAR_ScenePrepare();
void NPAR_SceneFinish();
void NPAR_EmitTarTarTrail(const xVec3*, const xVec3*);
NPARMgmt* NPAR_PartySetup(en_nparptyp parType, void** userData, NPARXtraData* xtraData);
void NPAR_SceneReset();
void NPCC_ShadowCacheReset();
Expand Down