Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zNPCTypeRobot things #380

Merged
merged 1 commit into from
Oct 1, 2024
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
15 changes: 13 additions & 2 deletions src/SB/Core/x/xBehaviour.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,15 @@ struct xPsyche : RyzMemData
void SetOwner(xBase*, void*);
void KillBrain(xFactory*);
void Lobotomy(xFactory*);
void SetSafety(S32);
void SetSafety(S32 goalID)
{
gid_safegoal = goalID;
}
void Amnesia(S32);
void SetNotify(xPSYNote* notice)
{
cb_notice = notice;
}

xBase* GetClient()
{
Expand Down Expand Up @@ -169,7 +176,11 @@ struct xGoal : xListItem<xGoal>, xFactoryInst
xPsyche* GetPsyche() const;
void SetCallbacks(xGoalProcessCallback process, xGoalChkRuleCallback chkRule,
xGoalPreCalcCallback precalc, void* cbdata);
S32 GetFlags() const;
S32 GetFlags() const
{
return flg_able;
}

void SetPsyche(xPsyche* psyche);
const char* Name();
void SetState(en_GOALSTATE state);
Expand Down
1 change: 1 addition & 0 deletions src/SB/Game/zNPCHazard.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ struct UVAModelInfo
void UVVelSet(float, float);
S32 GetUV(RwTexCoords*& coords, S32& numVertices, RpAtomic* model);
void SetColor(iColor_tag);
void Update(F32, xVec2*);
};

struct NPCHazard;
Expand Down
22 changes: 22 additions & 0 deletions src/SB/Game/zNPCSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include "zNPCGlyph.h"
#include "zNPCSupplement.h"

#include "xMathInlines.h"

void NPCSupport_Shutdown()
{
zNPCHazard_Shutdown();
Expand All @@ -21,3 +23,23 @@ void NPCWidget_Shutdown()
void NPCWidget_ScenePrepare()
{
}

F32 NPCC_TmrCycle(float* tmr, float dt, float interval)
{
F32 parameterized;

if (*tmr < 0.0f)
{
*tmr = 0.0f;
}

parameterized = (*tmr / interval);
*tmr += dt;

if (*tmr > interval)
{
*tmr = xfmod(*tmr,interval);
}

return parameterized;
}
4 changes: 4 additions & 0 deletions src/SB/Game/zNPCSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ struct NPCBlinker
{
F32 tmr_uvcell;
S32 idx_uvcell;

void Reset();
};

void NPCWidget_Shutdown();
Expand All @@ -53,12 +55,14 @@ void NPCSupport_SceneReset();
void NPCSupport_Shutdown();
void NPCSupport_ScenePostInit();
S32 NPCC_LampStatus();
F32 NPCC_TmrCycle(float* tmr, float dt, float interval);
xVec3* NPCC_rightDir(xEnt* ent);
xVec3* NPCC_faceDir(xEnt* ent);
void NPCC_ang_toXZDir(F32 angle, xVec3* dir);
F32 NPCC_aimVary(xVec3* dir_aim, xVec3* pos_src, xVec3* pos_tgt, F32 dst_vary, S32 flg_vary, xVec3* pos_aimPoint);
F32 NPCC_ds2_toCam(const xVec3* pos_from, xVec3* delta);
void zNPC_SNDStop(_tageNPCSnd snd);
void zNPC_SNDPlay3D(_tageNPCSnd snd, xEnt*);
RwRaster* NPCC_FindRWRaster(char*);

#endif
4 changes: 3 additions & 1 deletion src/SB/Game/zNPCTypeCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ struct zNPCSettings : xDynAsset
S8 allowDetect;
U8 allowPatrol;
U8 allowWander;
S8 reduceCollide;
U8 reduceCollide;
S8 useNavSplines;
S8 pad[3];
S8 allowChase;
Expand Down Expand Up @@ -407,7 +407,9 @@ struct zNPCCommon : xNPCBasic
void ModelScaleSet(F32 x, F32 y, F32 z);
void ModelScaleSet(F32 unk);
void ModelScaleSet(const xVec3* vec);
xModelInstance* ModelAtomicFind(int index, int idx_prev, xModelInstance* mdl_prev);
xModelInstance* ModelAtomicHide(int index, xModelInstance* mdl);
xModelInstance* ModelAtomicShow(int index, xModelInstance* mdl);
S32 AnimStart(U32 animID, S32 forceRestart);
xAnimState* AnimFindState(U32 animID);
xAnimState* AnimCurState();
Expand Down
Loading