mirror of https://github.com/zeldaret/botw.git
ksys/res: Add GParamListObjectTraveler
Also adds source files for the resource class, though they're just stubs at the moment.
This commit is contained in:
parent
50027520f7
commit
a59add899e
|
|
@ -62,6 +62,10 @@ add_executable(uking
|
|||
|
||||
src/KingSystem/MessageSystem/mesTransceiver.h
|
||||
|
||||
src/KingSystem/Resource/GeneralParamList/resGParamListObject.cpp
|
||||
src/KingSystem/Resource/GeneralParamList/resGParamListObject.h
|
||||
src/KingSystem/Resource/GeneralParamList/resGParamListObjectTraveler.cpp
|
||||
src/KingSystem/Resource/GeneralParamList/resGParamListObjectTraveler.h
|
||||
src/KingSystem/Resource/resCurrentResNameMgr.cpp
|
||||
src/KingSystem/Resource/resCurrentResNameMgr.h
|
||||
src/KingSystem/Resource/resEntryFactory.cpp
|
||||
|
|
@ -78,6 +82,8 @@ add_executable(uking
|
|||
src/KingSystem/Resource/resResourceDemo.h
|
||||
src/KingSystem/Resource/resResourceDrop.cpp
|
||||
src/KingSystem/Resource/resResourceDrop.h
|
||||
src/KingSystem/Resource/resResourceGParamList.cpp
|
||||
src/KingSystem/Resource/resResourceGParamList.h
|
||||
src/KingSystem/Resource/resResourceLod.cpp
|
||||
src/KingSystem/Resource/resResourceLod.h
|
||||
src/KingSystem/Resource/resResourceRecipe.cpp
|
||||
|
|
|
|||
|
|
@ -89095,7 +89095,7 @@
|
|||
0x0000007101197528,BgparamlistObjectNpc::ctor,1232,
|
||||
0x00000071011979f8,BgparamlistObjectNpcEquipment::ctor,1960,
|
||||
0x00000071011981a0,BgparamlistObjectZora::ctor,508,
|
||||
0x000000710119839c,BgparamlistObjectTraveler::ctor,29996,
|
||||
0x000000710119839c,BgparamlistObjectTraveler::ctor,29996,_ZN4ksys3res24GParamListObjectTravelerC1Ev
|
||||
0x000000710119f8c8,BgparamlistObjectPrey::ctor,508,
|
||||
0x000000710119fac4,BgparamlistObjectEatTarget::ctor,684,
|
||||
0x000000710119fd70,BgparamlistObjectAnimalUnit::ctor,1380,
|
||||
|
|
|
|||
|
Can't render this file because it is too large.
|
|
|
@ -0,0 +1 @@
|
|||
#include "KingSystem/Resource/GeneralParamList/resGParamListObject.h"
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#pragma once
|
||||
|
||||
#include <agl/Utils/aglParameterObj.h>
|
||||
#include <hostio/seadHostIONode.h>
|
||||
#include "KingSystem/Utils/Types.h"
|
||||
|
||||
namespace ksys::res {
|
||||
|
||||
/// Base class for GeneralParamList parameter objects.
|
||||
/// @bug This should have a virtual destructor...
|
||||
class GParamListObject : public sead::hostio::Node {
|
||||
public:
|
||||
virtual const char* getName() const = 0;
|
||||
|
||||
protected:
|
||||
agl::utl::ParameterObj mObj;
|
||||
};
|
||||
KSYS_CHECK_SIZE_NX150(GParamListObject, 0x38);
|
||||
|
||||
} // namespace ksys::res
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
#include "KingSystem/Resource/GeneralParamList/resGParamListObjectTraveler.h"
|
||||
#include "KingSystem/Utils/FixedString.h"
|
||||
|
||||
namespace ksys::res {
|
||||
|
||||
template <std::size_t N, std::size_t I = 0>
|
||||
KSYS_ALWAYS_INLINE static void
|
||||
initGParamListTravelerRoutePoints(GParamListObjectTraveler::RoutePoint* point,
|
||||
agl::utl::ParameterObj* obj) {
|
||||
if constexpr (I < N) {
|
||||
point->initParameters_<I>(obj);
|
||||
initGParamListTravelerRoutePoints<N, I + 1>(point + 1, obj);
|
||||
}
|
||||
}
|
||||
|
||||
GParamListObjectTraveler::GParamListObjectTraveler() {
|
||||
auto* const obj = &mObj;
|
||||
|
||||
mAppearGameDataName.init("", "AppearGameDataName", "", obj);
|
||||
mDeleteGameDataName.init("", "DeleteGameDataName", "", obj);
|
||||
mRouteType.init("", "RouteType", "", obj);
|
||||
mRideHorseName.init("", "RideHorseName", "", obj);
|
||||
mIsLeadHorse.init(false, "IsLeadHorse", "", obj);
|
||||
mHorseGearLevel.init(-1, "HorseGearLevel", "", obj);
|
||||
|
||||
initGParamListTravelerRoutePoints<NumRoutePoints>(mRoutePoints.data(), obj);
|
||||
mRoutePoint29Name.init("", "RoutePoint29Name", "", obj);
|
||||
}
|
||||
|
||||
KSYS_ALWAYS_INLINE GParamListObjectTraveler::RoutePoints::RoutePoints() {
|
||||
// Nintendo seems to have duplicated the definitions for each of the 29 route points,
|
||||
// which is utterly disgusting and error prone. Manually writing out the loop and using
|
||||
// placement-new is necessary to prevent Clang from emitting a loop.
|
||||
#pragma clang loop unroll(full)
|
||||
for (auto& storage : mStorage)
|
||||
new (&storage) RoutePoint;
|
||||
}
|
||||
|
||||
KSYS_ALWAYS_INLINE GParamListObjectTraveler::RoutePoint::RoutePoint() = default;
|
||||
|
||||
template <s32 I>
|
||||
KSYS_ALWAYS_INLINE void
|
||||
GParamListObjectTraveler::RoutePoint::initParameters_(agl::utl::ParameterObj* obj) {
|
||||
mName.init("", KSYS_STR(Str("RoutePoint") + Str<I>() + Str("Name")), "", obj);
|
||||
mForward.initParameters_<I, I + 1>(obj);
|
||||
mBackward.initParameters_<I + 1, I>(obj);
|
||||
}
|
||||
|
||||
template <s32 From, s32 To>
|
||||
KSYS_ALWAYS_INLINE void
|
||||
GParamListObjectTraveler::RoutePoint::DirectionInfo::initParameters_(agl::utl::ParameterObj* obj) {
|
||||
static constexpr auto prefix = [] {
|
||||
using ksys::util::Str;
|
||||
return Str("RoutePoint") + Str<From>() + Str("to") + Str<To>();
|
||||
}();
|
||||
|
||||
mEntryPoint.init("", KSYS_STR(prefix + Str("EntryPoint")), "", obj);
|
||||
mWaitFrame.init(0.0, KSYS_STR(prefix + Str("WaitFrame")), "", obj);
|
||||
mSchedule.init("", KSYS_STR(prefix + Str("Schedule")), "", obj);
|
||||
mMoveAS.init("", KSYS_STR(prefix + Str("MoveAS")), "", obj);
|
||||
mWaitAS.init("", KSYS_STR(prefix + Str("WaitAS")), "", obj);
|
||||
}
|
||||
|
||||
} // namespace ksys::res
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
#pragma once
|
||||
|
||||
#include <agl/Utils/aglParameter.h>
|
||||
#include "KingSystem/Resource/GeneralParamList/resGParamListObject.h"
|
||||
#include "KingSystem/Utils/Types.h"
|
||||
|
||||
namespace ksys::res {
|
||||
|
||||
class GParamListObjectTraveler : public GParamListObject {
|
||||
public:
|
||||
struct RoutePoint {
|
||||
RoutePoint();
|
||||
|
||||
template <s32 I>
|
||||
KSYS_VISIBILITY_HIDDEN void initParameters_(agl::utl::ParameterObj* obj);
|
||||
|
||||
struct DirectionInfo {
|
||||
template <s32 From, s32 To>
|
||||
KSYS_VISIBILITY_HIDDEN void initParameters_(agl::utl::ParameterObj* obj);
|
||||
|
||||
agl::utl::Parameter<sead::SafeString> mEntryPoint;
|
||||
agl::utl::Parameter<f32> mWaitFrame;
|
||||
agl::utl::Parameter<sead::SafeString> mSchedule;
|
||||
agl::utl::Parameter<sead::SafeString> mMoveAS;
|
||||
agl::utl::Parameter<sead::SafeString> mWaitAS;
|
||||
};
|
||||
|
||||
agl::utl::Parameter<sead::SafeString> mName;
|
||||
// i to i+1
|
||||
DirectionInfo mForward;
|
||||
// i+1 to i
|
||||
DirectionInfo mBackward;
|
||||
};
|
||||
static constexpr size_t NumRoutePoints = 29;
|
||||
|
||||
GParamListObjectTraveler();
|
||||
const char* getName() const override { return "Traveler"; }
|
||||
|
||||
agl::utl::Parameter<sead::SafeString> mAppearGameDataName;
|
||||
agl::utl::Parameter<sead::SafeString> mDeleteGameDataName;
|
||||
agl::utl::Parameter<sead::SafeString> mRouteType;
|
||||
agl::utl::Parameter<sead::SafeString> mRideHorseName;
|
||||
agl::utl::Parameter<bool> mIsLeadHorse;
|
||||
agl::utl::Parameter<s32> mHorseGearLevel;
|
||||
|
||||
struct RoutePoints {
|
||||
RoutePoints();
|
||||
auto& operator[](s32 i) { return reinterpret_cast<RoutePoint&>(mStorage[i]); }
|
||||
auto& operator[](s32 i) const { return reinterpret_cast<const RoutePoint&>(mStorage[i]); }
|
||||
auto data() { return reinterpret_cast<RoutePoint*>(&mStorage[0]); }
|
||||
|
||||
private:
|
||||
std::aligned_storage_t<sizeof(RoutePoint), alignof(RoutePoint)> mStorage[NumRoutePoints];
|
||||
};
|
||||
RoutePoints mRoutePoints;
|
||||
agl::utl::Parameter<sead::SafeString> mRoutePoint29Name;
|
||||
};
|
||||
KSYS_CHECK_SIZE_NX150(GParamListObjectTraveler, 0x3148);
|
||||
|
||||
} // namespace ksys::res
|
||||
|
|
@ -0,0 +1 @@
|
|||
#include "KingSystem/Resource/resResourceGParamList.h"
|
||||
|
|
@ -0,0 +1 @@
|
|||
#pragma once
|
||||
Loading…
Reference in New Issue