Skip to content

Commit

Permalink
zNPCTypeRobot things (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
escape209 authored Oct 1, 2024
1 parent 2f6b926 commit 1228f98
Show file tree
Hide file tree
Showing 7 changed files with 356 additions and 15 deletions.
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

0 comments on commit 1228f98

Please sign in to comment.