mirror of
https://github.com/zeldaret/ss
synced 2026-06-23 00:49:51 -04:00
Expand dAcBase work
This commit is contained in:
@@ -211,7 +211,7 @@ inline void strnsth(char *dest, const char *src, size_t max_len) {
|
||||
/* 8000BA70 */ void FileManager::setBeaconPos(u32 beaconArea, u32 beaconNum, mVec3_c *pos) {}
|
||||
/* 8000BB80 */ mVec3_c *FileManager::getBeaconPos(u32 beaconArea, u32 beaconNum) {}
|
||||
/* 8000BC70 */ void FileManager::setEnemyKillCount(u32 enemy, u16 killCount) {}
|
||||
/* 8000BCE0 */ u16 FileManager::getEnemyKillCount(u32 enemy) {}
|
||||
/* 8000BCE0 */ s16 FileManager::getEnemyKillCount(u32 enemy) {}
|
||||
/* 8000BD60 */ void FileManager::setHitCountFromEnemy(u32 enemy, u16 hitCount) {}
|
||||
/* 8000BDD0 */ u16 FileManager::getHitCountFromEnemy(u32 enemy) {}
|
||||
|
||||
|
||||
@@ -1,26 +1,10 @@
|
||||
#include <common.h>
|
||||
#include <libc.h>
|
||||
#include <toBeSorted/misc_flag_managers.h>
|
||||
#include <toBeSorted/bitwise_flag_helper.h>
|
||||
#include <toBeSorted/file_manager.h>
|
||||
#include <toBeSorted/flag_space.h>
|
||||
|
||||
class CommittableFlagManager {
|
||||
public:
|
||||
bool mNeedsCommit;
|
||||
|
||||
virtual void doCommit() = 0;
|
||||
bool commitIfNecessary();
|
||||
void setNeedsCommit(bool commit) {
|
||||
mNeedsCommit = commit;
|
||||
}
|
||||
CommittableFlagManager() {
|
||||
mNeedsCommit = false;
|
||||
}
|
||||
CommittableFlagManager(bool commit) {
|
||||
mNeedsCommit = commit;
|
||||
}
|
||||
};
|
||||
|
||||
/* 0x800BE7B0 */
|
||||
bool CommittableFlagManager::commitIfNecessary() {
|
||||
if (mNeedsCommit) {
|
||||
@@ -32,31 +16,6 @@ bool CommittableFlagManager::commitIfNecessary() {
|
||||
}
|
||||
}
|
||||
|
||||
class TBoxFlagManager : public CommittableFlagManager {
|
||||
public:
|
||||
FlagSpace mFlagSpace;
|
||||
u16 mSceneIndex;
|
||||
BitwiseFlagHelper mFlagHelper;
|
||||
|
||||
static u16 sTBoxFlags[2];
|
||||
|
||||
static TBoxFlagManager *sInstance;
|
||||
|
||||
virtual void doCommit() override;
|
||||
bool checkUncommittedFlag(u16 flag);
|
||||
TBoxFlagManager();
|
||||
virtual ~TBoxFlagManager() {}
|
||||
void init();
|
||||
void copyFromSave(s16 sceneIndex);
|
||||
bool checkFlag(u16 sceneIndex, u16 flag);
|
||||
virtual u16 getFlagCount() const;
|
||||
void setFlag(u16 flag);
|
||||
bool checkUncommittedFlag(u16 sceneIndex, u16 flag);
|
||||
u16 checkUncommittedFlag2(u16 flag) {
|
||||
return checkUncommittedFlag(flag);
|
||||
}
|
||||
};
|
||||
|
||||
TBoxFlagManager *TBoxFlagManager::sInstance = nullptr;
|
||||
u16 TBoxFlagManager::sTBoxFlags[2] = {};
|
||||
|
||||
@@ -108,35 +67,6 @@ void TBoxFlagManager::setFlag(u16 flag) {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: Not actually Enemy Defeat.
|
||||
// This is a little more than that, it keeps track of live objects based on their id as a whole
|
||||
class EnemyDefeatManager : public CommittableFlagManager {
|
||||
public:
|
||||
FlagSpace mFlagSpace;
|
||||
BitwiseFlagHelper mFlagHelper;
|
||||
u16 mSceneIndex;
|
||||
|
||||
static u16 sEnemyDefeatFlags[4096];
|
||||
|
||||
static EnemyDefeatManager *sInstance;
|
||||
|
||||
void clearSavedFlags();
|
||||
bool checkUncommittedFlag(u16 flag);
|
||||
u16 checkUncommittedFlag2(u16 flag) {
|
||||
return checkUncommittedFlag(flag);
|
||||
}
|
||||
EnemyDefeatManager();
|
||||
void init();
|
||||
void copyFromSave(u16 sceneIndex);
|
||||
void updateFlagIndex(u16 sceneIndex);
|
||||
void clearAll();
|
||||
bool checkIsValidFlag(u16 flag);
|
||||
bool checkFlag(u16 flag);
|
||||
virtual ~EnemyDefeatManager() {}
|
||||
virtual u16 getFlagCount() const;
|
||||
void setFlag(u16 flag);
|
||||
};
|
||||
|
||||
EnemyDefeatManager *EnemyDefeatManager::sInstance = nullptr;
|
||||
u16 EnemyDefeatManager::sEnemyDefeatFlags[4096] = {};
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
#include "toBeSorted/scgame.h"
|
||||
|
||||
SpawnInfo ScGame::currentSpawnInfo = {};
|
||||
SpawnInfo ScGame::nextSpawnInfo = {};
|
||||
ScGame* ScGame::sInstance = nullptr;
|
||||
@@ -0,0 +1,114 @@
|
||||
#include "m/m_vec.h"
|
||||
#include "m/m_Angle.h"
|
||||
#include "d/d_player.h"
|
||||
#include "toBeSorted/special_item_drop_mgr.h"
|
||||
|
||||
SpecialItemDropMgr* SpecialItemDropMgr::sInstance = nullptr;
|
||||
|
||||
extern "C" short targetAngleY(mVec3_c *, mVec3_c *);
|
||||
extern "C" int rndInt(int);
|
||||
extern "C" void spawnItem1(s16 itemid, u32 roomid, mVec3_c *pos, mAng3_c *rot, u32 param2, u32 unk);
|
||||
extern "C" void spawnItem2(s16 itemid, u32 roomid, mVec3_c *pos, mAng3_c *rot, u32 param2, u32 unk);
|
||||
extern "C" void spawnItem3(s16 itemid, u32 roomid, mVec3_c *pos, mAng3_c *rot, u32 param2, u32 unk);
|
||||
extern "C" void spawnItem4(s16 itemid, u32 roomid, mVec3_c *pos, mAng3_c *rot, u32 param2, u32 unk);
|
||||
extern "C" void spawnItem5(s16 itemid, u32 roomid, mVec3_c *pos, mAng3_c *rot, u32 param2, u32 unk);
|
||||
extern "C" void spawnItem6(s16 itemid, u32 roomid, mVec3_c *pos, mAng3_c *rot, u32 param2, u32 unk);
|
||||
extern "C" void spawnItem7(s16 itemid, u32 roomid, mVec3_c *pos, mAng3_c *rot, u32 param2, u32 unk);
|
||||
extern "C" void spawnItem8(s16 itemid, u32 roomid, mVec3_c *pos, mAng3_c *rot, u32 param2, u32 unk);
|
||||
extern "C" void spawnItem9(s16 itemid, u32 roomid, mVec3_c *pos, mAng3_c *rot, u32 param2, u32 unk);
|
||||
|
||||
// 800c7b80
|
||||
SpecialItemDropMgr::SpecialItemDropMgr() {
|
||||
SpecialItemDropMgr::sInstance = this;
|
||||
}
|
||||
|
||||
// TODO: Convert to enum once work on items has started
|
||||
int SPECIAL_ITEM_ARRAY[28] = {0, 6, 6, 2, 3, 4, 0x2b, 0x28, 0x29, 7, 8, 0x39, 0, 0, 0x1c, 0xa5, 58, 59, 183, 184, 185, 72, 72, 1, 34, 0, 0, 0};
|
||||
int RAND_RUPEE_ARRAY[4] = {2, 3, 4, 0};
|
||||
|
||||
// 800c7bb0
|
||||
int fn_800C7BB0(SpecialItemDropMgr *mgr, int specialItemId) {}
|
||||
|
||||
// 800c7d00
|
||||
short fn_800C7D00(SpecialItemDropMgr *mgr, int specialItemId) {}
|
||||
|
||||
// 800c7d20
|
||||
short fn_800C7D20(SpecialItemDropMgr *mgr, int specialItemId) {}
|
||||
|
||||
// 800c7d40
|
||||
int giveSpecialDropItem(SpecialItemDropMgr *mgr, int specialItemId, int roomid, mVec3_c *pos, int subtype, s16 *rot, s32 unused) {}
|
||||
|
||||
// 800c7ef0
|
||||
// Very unmatching. Just here as a starting point
|
||||
bool spawnSpecialDropItem(SpecialItemDropMgr *mgr, int specialItemId, int roomid, mVec3_c *pos, int subtype, s16 *rot) {
|
||||
u32 unk = fn_800C7BB0(mgr, specialItemId);
|
||||
if (unk == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
s8 itemCount = 1;
|
||||
if (unk == 2) {
|
||||
itemCount = 3;
|
||||
} else if (unk == 12) {
|
||||
itemCount = 10;
|
||||
} else if (unk == 13) {
|
||||
itemCount = 5;
|
||||
} else if (unk == 22) {
|
||||
itemCount = 2;
|
||||
}
|
||||
|
||||
s16 currentRot;
|
||||
s16 tempOther;
|
||||
u16 itemid = SPECIAL_ITEM_ARRAY[unk];
|
||||
mAng3_c itemRot = {0, 0, 0};
|
||||
|
||||
if (subtype == 2 || subtype == 6) {
|
||||
currentRot = *rot;
|
||||
tempOther = -0xe39;
|
||||
} else {
|
||||
currentRot = targetAngleY(&(dPlayer::LINK->position), pos);
|
||||
tempOther = -0x8000;
|
||||
currentRot += 0x4000;
|
||||
}
|
||||
s16 angleDecrement = tempOther / itemCount;
|
||||
tempOther = angleDecrement / 2;
|
||||
currentRot += tempOther;
|
||||
tempOther /= 2;
|
||||
|
||||
for (s8 currentItemIndex = 0; currentItemIndex < itemCount; currentItemIndex++) {
|
||||
s16 out;
|
||||
SpecialItemDropMgr::fn_800C81D0(out, tempOther, -tempOther);
|
||||
|
||||
itemRot.y = currentRot + out;
|
||||
if (unk < 15) {
|
||||
itemid = RAND_RUPEE_ARRAY[rndInt(3)];
|
||||
spawnItem1(itemid, roomid, pos, &itemRot, 0xFFFFFFFF, 0);
|
||||
} else if (subtype == 2) {
|
||||
spawnItem2(itemid, roomid, pos, &itemRot, 0xFFFFFFFF, 0);
|
||||
} else {
|
||||
if (subtype == 1) {
|
||||
spawnItem3(itemid, roomid, pos, &itemRot, 0xFFFFFFFF, 0);
|
||||
} else if (subtype == 4) {
|
||||
spawnItem4(itemid, roomid, pos, &itemRot, 0xFFFFFFFF, 0);
|
||||
} else if (subtype == 3) {
|
||||
spawnItem5(itemid, roomid, pos, &itemRot, 0xFFFFFFFF, 0);
|
||||
} else if (subtype == 5) {
|
||||
spawnItem6(itemid, roomid, pos, &itemRot, 0xFFFFFFFF, 0);
|
||||
} else if (subtype == 6) {
|
||||
spawnItem7(itemid, roomid, pos, &itemRot, 0xFFFFFFFF, 0);
|
||||
} else if (subtype == 7) {
|
||||
spawnItem8(itemid, roomid, pos, &itemRot, 0xFFFFFFFF, 0);
|
||||
} else {
|
||||
spawnItem9(itemid, roomid, pos, &itemRot, 0xFFFFFFFF, 0);
|
||||
}
|
||||
}
|
||||
currentRot -= angleDecrement;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// 800c81d0
|
||||
void fn_800C81D0(s16, s16, s16) {};
|
||||
|
||||
// 800c8270
|
||||
SpecialItemDropMgr::~SpecialItemDropMgr() {}
|
||||
Reference in New Issue
Block a user