ksys/res: Implement GParamList System + General

This commit is contained in:
Léo Lam
2020-09-19 21:27:12 +02:00
parent 62880a0b1d
commit 5ff20fa250
5 changed files with 75 additions and 4 deletions
@@ -0,0 +1,38 @@
#pragma once
#include <agl/Utils/aglParameter.h>
#include "KingSystem/Resource/GeneralParamList/resGParamListObject.h"
#include "KingSystem/Utils/Types.h"
namespace ksys::res {
class GParamListObjectGeneral : public GParamListObject {
public:
GParamListObjectGeneral();
const char* getName() const override { return "General"; }
agl::utl::Parameter<f32> mSpeed;
agl::utl::Parameter<s32> mLife;
agl::utl::Parameter<bool> mIsLifeInfinite;
agl::utl::Parameter<f32> mElectricalDischarge;
agl::utl::Parameter<bool> mIsBurnOutBorn;
agl::utl::Parameter<sead::SafeString> mBurnOutBornName;
agl::utl::Parameter<bool> mIsBurnOutBornIdent;
agl::utl::Parameter<sead::SafeString> mChangeDropTableName;
};
KSYS_CHECK_SIZE_NX150(GParamListObjectGeneral, 0x148);
inline GParamListObjectGeneral::GParamListObjectGeneral() {
auto* const obj = &mObj;
mSpeed.init(1.0, "Speed", "", obj);
mLife.init(100, "Life", "", obj);
mIsLifeInfinite.init(false, "IsLifeInfinite", "", obj);
mElectricalDischarge.init(1.0, "ElectricalDischarge", "", obj);
mIsBurnOutBorn.init(false, "IsBurnOutBorn", "", obj);
mBurnOutBornName.init("", "BurnOutBornName", "", obj);
mIsBurnOutBornIdent.init(false, "IsBurnOutBornIdent", "", obj);
mChangeDropTableName.init("", "ChangeDropTableName", "", obj);
}
} // namespace ksys::res
@@ -0,0 +1,26 @@
#pragma once
#include <agl/Utils/aglParameter.h>
#include "KingSystem/Resource/GeneralParamList/resGParamListObject.h"
#include "KingSystem/Utils/Types.h"
namespace ksys::res {
class GParamListObjectSystem : public GParamListObject {
public:
GParamListObjectSystem();
const char* getName() const override { return "System"; }
agl::utl::Parameter<sead::SafeString> mSameGroupActorName;
agl::utl::Parameter<bool> mIsGetItemSelf;
};
KSYS_CHECK_SIZE_NX150(GParamListObjectSystem, 0x80);
inline GParamListObjectSystem::GParamListObjectSystem() {
auto* const obj = &mObj;
mSameGroupActorName.init("", "SameGroupActorName", "", obj);
mIsGetItemSelf.init(false, "IsGetItemSelf", "", obj);
}
} // namespace ksys::res
@@ -3,6 +3,8 @@
#include <agl/Utils/aglParameter.h>
#include <prim/seadRuntimeTypeInfo.h>
#include "KingSystem/Resource/GeneralParamList/resGParamListObject.h"
#include "KingSystem/Resource/GeneralParamList/resGParamListObjectGeneral.h"
#include "KingSystem/Resource/GeneralParamList/resGParamListObjectSystem.h"
#include "KingSystem/Resource/GeneralParamList/resGParamListTraits.h"
namespace ksys::res {
@@ -37,7 +39,10 @@ bool GParamList::parse_(u8* data, size_t, sead::Heap* heap) {
const agl::utl::ResParameterArchive archive{data};
// TODO: System, etc.
add<GParamListObjType::System>(archive.getRootList(), "System", heap, dummy_list);
add<GParamListObjType::General>(archive.getRootList(), "General", heap, dummy_list);
// TODO: the rest
if (data)
applyResParameterArchive(archive);