diff options
| author | robojumper <robojumper@gmail.com> | 2024-11-06 22:43:27 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-06 16:43:27 -0500 |
| commit | aaf88fa648557435a2af5c4bc1436507c2b0042c (patch) | |
| tree | 1a512fa1a34da7c02c446f9e58f6cb9fcd0938fb /include | |
| parent | 9334796eef3caa2c9ff0bc9c6cfca0677a269a04 (diff) | |
Clean up special item drop mgr (#87)
* Clean up special item drop mgr
* Progress
* Mostly matching
* Docs
Diffstat (limited to 'include')
| -rw-r--r-- | include/c/c_math.h | 9 | ||||
| -rw-r--r-- | include/d/a/d_a_player.h | 2 | ||||
| -rw-r--r-- | include/d/a/obj/d_a_obj_item.h | 2 | ||||
| -rw-r--r-- | include/toBeSorted/special_item_drop_mgr.h | 20 |
4 files changed, 21 insertions, 12 deletions
diff --git a/include/c/c_math.h b/include/c/c_math.h index 8b95bf71..ee21fe0d 100644 --- a/include/c/c_math.h +++ b/include/c/c_math.h @@ -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)); } diff --git a/include/d/a/d_a_player.h b/include/d/a/d_a_player.h index 57471a06..666a5365 100644 --- a/include/d/a/d_a_player.h +++ b/include/d/a/d_a_player.h @@ -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(); diff --git a/include/d/a/obj/d_a_obj_item.h b/include/d/a/obj/d_a_obj_item.h index 4a2cf494..fc0cb063 100644 --- a/include/d/a/obj/d_a_obj_item.h +++ b/include/d/a/obj/d_a_obj_item.h @@ -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 diff --git a/include/toBeSorted/special_item_drop_mgr.h b/include/toBeSorted/special_item_drop_mgr.h index 492f0725..8132cff0 100644 --- a/include/toBeSorted/special_item_drop_mgr.h +++ b/include/toBeSorted/special_item_drop_mgr.h @@ -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 |
