Clean up special item drop mgr (#87)

* Clean up special item drop mgr

* Progress

* Mostly matching

* Docs
This commit is contained in:
robojumper
2024-11-06 22:43:27 +01:00
committed by GitHub
parent 9334796eef
commit aaf88fa648
11 changed files with 548 additions and 87 deletions
+8 -1
View File
@@ -11,7 +11,14 @@ int rndInt(int max);
f32 rndF(f32 max);
f32 rndFX(f32 amp);
template <typename T>
template <typename T>
T rndRange(T min, T max) {
f32 r = cM::rndF(max - min);
f32 m = min;
m += r;
return m;
}
inline T minMaxLimit(T val, T min, T max) {
return (T)((T)val < (T)min ? (T)min : ((T)val > (T)max ? (T)max : (T)val));
}
+1 -1
View File
@@ -99,7 +99,7 @@ public:
/* vt 0x144 */ virtual void setActorLinkToSomething();
/* vt 0x148 */ virtual void applyDamageWithIFrames();
/* vt 0x14C */ virtual void vt_0x14C();
/* vt 0x150 */ virtual void hasLessThanQuarterHealth();
/* vt 0x150 */ virtual bool hasLessThanQuarterHealth(bool);
/* vt 0x154 */ virtual void vt_0x154();
/* vt 0x158 */ virtual void vt_0x158();
/* vt 0x15C */ virtual void vt_0x15C();
+2
View File
@@ -12,6 +12,8 @@ public:
static void spawnItem(u16 item, u32 room, const mVec3_c &pos, const mAng3_c &rot, u32 params, u32 arg);
static void spawnDrop(u16 item, u32 room, const mVec3_c &pos, const mAng3_c &rot);
static u32 checkFlag(u32 flag);
};
#endif
+10 -10
View File
@@ -2,6 +2,7 @@
#define SPECIAL_ITEM_DROP_MGR_H
#include "common.h"
#include "m/m_angle.h"
#include "m/m_vec.h"
class SpecialItemDropMgr {
@@ -9,16 +10,15 @@ public:
static SpecialItemDropMgr *sInstance;
SpecialItemDropMgr();
static int fn_800C7BB0(SpecialItemDropMgr *mgr, int specialItemId);
static short fn_800C7D00(SpecialItemDropMgr *mgr, int specialItemId);
static short fn_800C7D20(SpecialItemDropMgr *mgr, int specialItemId);
static int giveSpecialDropItem(
SpecialItemDropMgr *mgr, int specialItemId, int roomid, mVec3_c *pos, int subtype, s16 *rot, s32 unused
);
static bool
spawnSpecialDropItem(SpecialItemDropMgr *mgr, int specialItemId, int roomid, mVec3_c *pos, int subtype, s16 *rot);
static void fn_800C81D0(s16, s16, s16);
~SpecialItemDropMgr();
virtual ~SpecialItemDropMgr() {}
static SpecialItemDropMgr *create();
int fn_800C7BB0(int specialItemId);
bool shouldTryExtraHearts(int specialItemId);
bool shouldTryExtraRupees(int specialItemId);
int giveSpecialDropItem(int specialItemId, int roomid, mVec3_c *pos, int subtype, mAng rot, s32 unused);
bool spawnSpecialDropItem(int specialItemId, int roomid, mVec3_c *pos, int subtype, mAng rot);
};
#endif