Skip to content

Commit

Permalink
Start decompiling zNPCGoalStd (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgsm authored Jul 23, 2024
1 parent aafa494 commit 607f4b6
Show file tree
Hide file tree
Showing 10 changed files with 618 additions and 52 deletions.
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ def Rel(lib_name: str, objects: List[Object]) -> Dict[str, Any]:
Object(NonMatching, "SB/Core/gc/ngcrad3d.c"),
Object(Matching, "SB/Game/zNPCGoals.cpp"),
Object(NonMatching, "SB/Game/zNPCGoalCommon.cpp"), # wrong function order
Object(NonMatching, "SB/Game/zNPCGoalStd.cpp"),
Object(NonMatching, "SB/Game/zNPCGoalStd.cpp", extra_cflags=["-sym on"]),
Object(NonMatching, "SB/Game/zNPCGoalRobo.cpp"),
Object(Matching, "SB/Game/zNPCGoalTiki.cpp", extra_cflags=["-sym on"]),
Object(NonMatching, "SB/Game/zNPCMessenger.cpp"),
Expand Down
3 changes: 2 additions & 1 deletion src/SB/Core/x/xBehaviour.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ struct xPsyche : RyzMemData
void ImmTranOff();
S32 ImmTranIsOn();
S32 HasGoal(S32 goal);
S32 GIDOfPending() const;
xGoal* GetCurGoal() const;
S32 GIDOfActive() const;
S32 GIDOfPending() const;
S32 Timestep(F32 dt, void* updCtxt);
xGoal* FindGoal(S32 gid);
S32 GoalSet(S32 gid, S32 r5);
Expand Down
12 changes: 10 additions & 2 deletions src/SB/Core/x/xFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,16 @@ struct xFactoryInst : RyzMemData
xFactoryInst* nextprod;
xFactoryInst* prevprod;

xFactoryInst();
~xFactoryInst();
xFactoryInst()
{
itemType = 0;
prevprod = NULL;
nextprod = NULL;
}

~xFactoryInst()
{
}
};

typedef xFactoryInst* (*XGOFTypeInfoCreator)(S32, RyzMemGrow*, void*);
Expand Down
6 changes: 6 additions & 0 deletions src/SB/Core/x/xListItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ template <class T> struct xListItem
T* next;
T* prev;

xListItem() {
flg_travFilter = 0;
prev = NULL;
next = NULL;
}

T* Next();
void Insert(T* list);
T* RemHead(T** listhead);
Expand Down
42 changes: 35 additions & 7 deletions src/SB/Core/x/xNPCBasic.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ enum en_npcdcat
eNPCDCAT_Zero,
eNPCDCAT_Seven = 7,
eNPCDCAT_Eight = 8,
eNPCDCAT_Eleven = 11,
};

struct xNPCBasic : xEnt, xFactoryInst
Expand Down Expand Up @@ -61,7 +62,15 @@ struct xNPCBasic : xEnt, xFactoryInst
xNPCBasic(S32);

S32 SelfType() const;
void RestoreColFlags();
void RestoreColFlags()
{
flags2.flg_colCheck = ColChkFlags();
flags2.flg_penCheck = ColPenFlags();
chkby = ColChkByFlags();
penby = ColPenByFlags();
pflags = PhysicsFlags();
colFreq = -1;
}

void DBG_PStatClear();
void DBG_PStatCont(en_npcperf stat);
Expand All @@ -81,19 +90,38 @@ struct xNPCBasic : xEnt, xFactoryInst
virtual void NewTime(xScene* xscn, F32 dt);
virtual void Move(xScene* xscn, F32 dt, xEntFrame* frm);
virtual S32 SysEvent(xBase* from, xBase* to, U32 toEvent, const F32* toParam,
xBase* toParamWidget, S32* handled);
xBase* toParamWidget, S32* handled);
virtual void Render();
virtual void Save(xSerial*) const;
virtual void Load(xSerial*);
virtual void CollideReview();

/* These most likely return a combination of XENT_COLLTYPE_* values */
virtual U8 ColChkFlags() const;
virtual U8 ColPenFlags() const;
virtual U8 ColChkByFlags() const;
virtual U8 ColPenByFlags() const;
virtual U8 ColChkFlags() const
{
return 0;
}

virtual U8 ColPenFlags() const
{
return 0;
}

virtual U8 ColChkByFlags() const
{
return 0;
}

virtual U8 ColPenByFlags() const
{
return 0;
}

virtual U8 PhysicsFlags() const
{
return 0;
}

virtual U8 PhysicsFlags() const;
virtual void Destroy();
};

Expand Down
2 changes: 2 additions & 0 deletions src/SB/Game/zMovePoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

struct zMovePoint : xMovePoint
{
F32 RadiusZone();
F32 Delay();
U32 NumNodes();
U8 IsOn();
};
Expand Down
5 changes: 4 additions & 1 deletion src/SB/Game/zNPCGoalCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ struct zNPCGoalCommon : xGoal
S32 flg_info : 16; // 0x48
S32 flg_user : 16; // 0x4a

zNPCGoalCommon(S32 goalID);
zNPCGoalCommon(S32 goalID) : xGoal(goalID)
{
flg_npcgauto |= ~(1 << 3);
}

U32 DoAutoAnim(en_NPC_GOAL_SPOT gspot, S32 forceRestart);
U32 DoExplicitAnim(U32 anid, S32 forceRestart);
Expand Down
Loading

0 comments on commit 607f4b6

Please sign in to comment.