mirror of
https://github.com/zeldaret/botw
synced 2026-08-04 01:03:07 -04:00
Add initial PlacementMap functions
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <prim/seadTypedBitFlag.h>
|
||||
#include <prim/seadTypedLongBitFlag.h>
|
||||
#include <thread/seadAtomic.h>
|
||||
#include <thread/seadReadWriteLock.h>
|
||||
#include "KingSystem/Utils/Types.h"
|
||||
|
||||
namespace ksys::map {
|
||||
@@ -110,11 +111,13 @@ public:
|
||||
class PlacementActors {
|
||||
public:
|
||||
u32 getNumStaticObjs() const;
|
||||
map::Object* getStaticObj_2(s32 idx) const;
|
||||
Object* getStaticObj_2(s32 idx) const;
|
||||
bool sub_7100D524B4() const;
|
||||
void x_9();
|
||||
Object* resetGroup(int groupIdx);
|
||||
|
||||
u8 _0[0xe0 - 0x0];
|
||||
u8 _0[0x28 - 0x0];
|
||||
sead::ReadWriteLock mLock;
|
||||
PlacementStruct1* mStruct1;
|
||||
u8 _e8[0x538 - 0xe8];
|
||||
sead::SafeArray<ActorData, 6000> mActorData;
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
|
||||
#include "KingSystem/Map/mapPlacementMap.h"
|
||||
#include <prim/seadScopedLock.h>
|
||||
#include <thread/seadReadWriteLock.h>
|
||||
|
||||
namespace ksys::map {
|
||||
|
||||
PlacementMap::PlacementMap() {
|
||||
mInitStatus = InitStatus::None;
|
||||
mParsedNumStaticObjs = 0xFFFFFFFF;
|
||||
mStaticMapLoaded = StaticMap::None;
|
||||
mStaticMapLoaded = false;
|
||||
mStaticMapParsed = false;
|
||||
mNumStaticObjs = 0xFFFFFFFF;
|
||||
mMat = sead::Matrix34f::ident;
|
||||
mDistanceToCurrentMapUnit = 0;
|
||||
_0 = 0;
|
||||
mSkipLoadStaticMap = 0;
|
||||
_38c = 0xFFFFFFFF;
|
||||
mIdx = 0;
|
||||
@@ -33,4 +38,45 @@ PlacementMap::~PlacementMap() {
|
||||
}
|
||||
}
|
||||
|
||||
void PlacementMap::unload() {
|
||||
sead::ReadWriteLock* lock = &mPa->mLock;
|
||||
lock->writeLock();
|
||||
mPa->resetGroup(mDynamicGroupIdx);
|
||||
mDynamicGroupIdx = 0xFFFFFFFF;
|
||||
lock->writeUnlock();
|
||||
|
||||
mCs.lock();
|
||||
mDynamicMubinRes.requestUnload();
|
||||
mCs.unlock();
|
||||
}
|
||||
|
||||
phys::BodyGroup* PlacementMap::getFieldBodyGroup(int field_group_idx) {
|
||||
const auto lock = sead::makeScopedLock(mCs);
|
||||
|
||||
auto* r = mRes[0].mRes.getResource();
|
||||
if (auto* sc = sead::DynamicCast<phys::StaticCompound>(r)) {
|
||||
if (field_group_idx < sc->getNumFieldBodyGroups()) {
|
||||
return sc->getFieldBodyGroup(field_group_idx);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void PlacementMap::x_7(int idx, int unknown, s8 column, s8 row, const sead::SafeString& mubin_path,
|
||||
const sead::SafeString& folder_and_file, int map_id_maybe,
|
||||
bool skip_load_static_map) {
|
||||
_388 = unknown;
|
||||
mIdx = idx;
|
||||
mCol = column;
|
||||
mRow = row;
|
||||
mMubinPath.copy(mubin_path);
|
||||
mFolderAndFile.copy(folder_and_file);
|
||||
_38c = map_id_maybe; // Index in open world map
|
||||
mSkipLoadStaticMap = skip_load_static_map;
|
||||
}
|
||||
|
||||
void PlacementMap::unloadHksc(int hksc_idx) {
|
||||
mRes[hksc_idx].mRes.requestUnload();
|
||||
}
|
||||
|
||||
} // namespace ksys::map
|
||||
|
||||
@@ -46,7 +46,6 @@ class PlacementMap {
|
||||
};
|
||||
KSYS_CHECK_SIZE_NX150(HkscRes, 0x58);
|
||||
|
||||
enum class StaticMap : u16 { None = 0, Loaded = 1 << 0, Parsed = 1 << 8 };
|
||||
enum class InitStatus : int {
|
||||
None = 0,
|
||||
StaticLoaded = 1,
|
||||
@@ -79,12 +78,12 @@ private:
|
||||
void x_5();
|
||||
int traverseStuff(sead::Vector3f* vec, PlacementActors* pa, int id);
|
||||
|
||||
phys::BodyGroup* getFieldBodyGroup(u32 field_body_group_index);
|
||||
phys::BodyGroup* getFieldBodyGroup(int field_body_group_index);
|
||||
void cleanupPhysics();
|
||||
bool loadStaticCompound(int index, bool is_auto_gen_mu, bool load_maybe);
|
||||
int x_2(int id);
|
||||
void x(int id, Object* obj);
|
||||
void unloadHksc(int id);
|
||||
void unloadHksc(int hksc_idx);
|
||||
int x_4(int id);
|
||||
int x_1(int id);
|
||||
bool staticCompoundStuff(int sc_id, bool cleanup);
|
||||
@@ -93,11 +92,13 @@ private:
|
||||
void doDisableObjStaticCompound(Object* obj, bool disable);
|
||||
void x_9();
|
||||
|
||||
void x_7(int idx, int unknown, char column, char row, const sead::SafeString& mubinPath,
|
||||
const sead::SafeString& folderAndFile, int map_id_maybe, bool skip_load_static_map);
|
||||
void x_7(int idx, int unknown, s8 column, s8 row, const sead::SafeString& mubin_path,
|
||||
const sead::SafeString& folder_and_file, int map_id_maybe, bool skip_load_static_map);
|
||||
|
||||
u16 mSkipLoadStaticMap;
|
||||
StaticMap mStaticMapLoaded;
|
||||
u8 _0;
|
||||
u8 mSkipLoadStaticMap;
|
||||
bool mStaticMapLoaded;
|
||||
bool mStaticMapParsed;
|
||||
u16 _04;
|
||||
s16 _06;
|
||||
sead::FixedSafeString<128> mMubinPath;
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
|
||||
void cleanUp();
|
||||
bool calledFromMapDtor();
|
||||
int getNumFieldBodyGroups() const { return mFieldBodyGroups.size(); }
|
||||
|
||||
private:
|
||||
enum class Flag {
|
||||
|
||||
Reference in New Issue
Block a user