mirror of https://github.com/zeldaret/botw.git
ksys/gdt: Add some special flag utils
This commit is contained in:
parent
f7901ae193
commit
404597421d
|
|
@ -54121,33 +54121,33 @@
|
|||
0x00000071008fd16c,sub_71008FD16C,680,
|
||||
0x00000071008fd414,sub_71008FD414,544,
|
||||
0x00000071008fd634,sub_71008FD634,1044,
|
||||
0x00000071008fda48,getFlag_SaveProhibition,244,
|
||||
0x00000071008fdb3c,isWarpProhibited,340,
|
||||
0x00000071008fdc90,isKillTimeProhibited,340,
|
||||
0x00000071008fdde4,sub_71008FDDE4,904,
|
||||
0x00000071008fe16c,gdm::getIntByKey,100,
|
||||
0x00000071008fe1d0,sub_71008FE1D0,636,
|
||||
0x00000071008fe44c,sub_71008FE44C,884,
|
||||
0x00000071008fe7c0,gdm::setIntByKey,272,
|
||||
0x00000071008fe8d0,gdm::setBoolByKey,264,
|
||||
0x00000071008fe9d8,gdm::getFlagByKey,100,
|
||||
0x00000071008fea3c,gdm::getDungeonClearFlag,560,
|
||||
0x00000071008fec6c,gdm::setDungeonClearFlag,516,
|
||||
0x00000071008fee70,gdm::getEnterDungeonFlag,560,
|
||||
0x00000071008ff0a0,gdm::setEnterDungeonFlag,516,
|
||||
0x00000071008fda48,getFlag_SaveProhibition,244,_ZN4ksys3gdt16isSaveProhibitedEv
|
||||
0x00000071008fdb3c,isWarpProhibited,340,_ZN4ksys3gdt16isWarpProhibitedEv
|
||||
0x00000071008fdc90,isKillTimeProhibited,340,_ZN4ksys3gdt20isKillTimeProhibitedEv
|
||||
0x00000071008fdde4,sub_71008FDDE4,904,_ZN4ksys3gdt14getSmallKeyNumERKN4sead14SafeStringBaseIcEEb
|
||||
0x00000071008fe16c,gdm::getIntByKey,100,_ZN4ksys3gdt11getS32ByKeyERKN4sead14SafeStringBaseIcEEb
|
||||
0x00000071008fe1d0,sub_71008FE1D0,636,_ZN4ksys3gdt13getDungeonNumERKN4sead14SafeStringBaseIcEE
|
||||
0x00000071008fe44c,sub_71008FE44C,884,_ZN4ksys3gdt20incrementSmallKeyNumERKN4sead14SafeStringBaseIcEEib
|
||||
0x00000071008fe7c0,gdm::setIntByKey,272,_ZN4ksys3gdt11setS32ByKeyEiRKN4sead14SafeStringBaseIcEEb
|
||||
0x00000071008fe8d0,gdm::setBoolByKey,264,_ZN4ksys3gdt12setBoolByKeyEbRKN4sead14SafeStringBaseIcEEb
|
||||
0x00000071008fe9d8,gdm::getFlagByKey,100,_ZN4ksys3gdt12getBoolByKeyERKN4sead14SafeStringBaseIcEEb
|
||||
0x00000071008fea3c,gdm::getDungeonClearFlag,560,_ZN4ksys3gdt16isDungeonClearedERKN4sead14SafeStringBaseIcEEb
|
||||
0x00000071008fec6c,gdm::setDungeonClearFlag,516,_ZN4ksys3gdt17setDungeonClearedERKN4sead14SafeStringBaseIcEEbb
|
||||
0x00000071008fee70,gdm::getEnterDungeonFlag,560,_ZN4ksys3gdt16isDungeonEnteredERKN4sead14SafeStringBaseIcEEb
|
||||
0x00000071008ff0a0,gdm::setEnterDungeonFlag,516,_ZN4ksys3gdt17setDungeonEnteredERKN4sead14SafeStringBaseIcEEbb
|
||||
0x00000071008ff2a4,sub_71008FF2A4,8,
|
||||
0x00000071008ff2ac,setIsGetFlag,12,
|
||||
0x00000071008ff2b8,sub_71008FF2B8,8,
|
||||
0x00000071008ff2c0,sub_71008FF2C0,8,
|
||||
0x00000071008ff2c8,setIsGetFlag_0,12,
|
||||
0x00000071008ff2d4,gdm::getFloatFromParamOrB,100,
|
||||
0x00000071008ff338,gdm::getShopStringFromParamOrB,76,
|
||||
0x00000071008ff384,sub_71008FF384,76,
|
||||
0x00000071008ff3d0,sub_71008FF3D0,108,
|
||||
0x00000071008ff43c,sub_71008FF43C,108,
|
||||
0x00000071008ff4a8,sub_71008FF4A8,84,
|
||||
0x00000071008ff4fc,sub_71008FF4FC,272,
|
||||
0x00000071008ff60c,sub_71008FF60C,308,
|
||||
0x00000071008ff2d4,gdm::getFloatFromParamOrB,100,_ZN4ksys3gdt11getF32ByKeyERKN4sead14SafeStringBaseIcEEb
|
||||
0x00000071008ff338,gdm::getShopStringFromParamOrB,76,_ZN4ksys3gdt13getStr64ByKeyEPPKcRKN4sead14SafeStringBaseIcEEb
|
||||
0x00000071008ff384,sub_71008FF384,76,_ZN4ksys3gdt13getVec3fByKeyEPN4sead7Vector3IfEERKNS1_14SafeStringBaseIcEEb
|
||||
0x00000071008ff3d0,sub_71008FF3D0,108,_ZN4ksys3gdt11getS32ByKeyERKN4sead14SafeStringBaseIcEEib
|
||||
0x00000071008ff43c,sub_71008FF43C,108,_ZN4ksys3gdt11getF32ByKeyERKN4sead14SafeStringBaseIcEEib
|
||||
0x00000071008ff4a8,sub_71008FF4A8,84,_ZN4ksys3gdt13getStr64ByKeyEPPKcRKN4sead14SafeStringBaseIcEEib
|
||||
0x00000071008ff4fc,sub_71008FF4FC,272,_ZN4ksys3gdt11setF32ByKeyEfRKN4sead14SafeStringBaseIcEEb
|
||||
0x00000071008ff60c,sub_71008FF60C,308,_ZN4ksys3gdt13setStr64ByKeyERKN4sead14SafeStringBaseIcEES5_b
|
||||
0x00000071008ff740,GameDataMgr::setBoolByIdx,236,_ZN4ksys3gdt7Manager19setBoolNoCheckForceEbNS0_10FlagHandleE
|
||||
0x00000071008ff82c,GameDataMgr::setS32ByIdxForce,236,_ZN4ksys3gdt7Manager18setS32NoCheckForceEiNS0_10FlagHandleE
|
||||
0x00000071008ff918,GameDataMgr::setFloatByIdx,236,_ZN4ksys3gdt7Manager18setF32NoCheckForceEfNS0_10FlagHandleE
|
||||
|
|
|
|||
|
Can't render this file because it is too large.
|
|
|
@ -11,6 +11,8 @@ target_sources(uking PRIVATE
|
|||
gdtManager.h
|
||||
gdtSaveMgr.cpp
|
||||
gdtSaveMgr.h
|
||||
gdtSpecialFlags.cpp
|
||||
gdtSpecialFlags.h
|
||||
gdtTriggerParam.cpp
|
||||
gdtTriggerParam.h
|
||||
)
|
||||
|
|
|
|||
|
|
@ -378,6 +378,15 @@ public:
|
|||
return NAME##NoCheckForce(TRAITS::convertValue(value), name); \
|
||||
} \
|
||||
return NAME(TRAITS::convertValue(value), name); \
|
||||
} \
|
||||
inline bool NAME##Special(TRAITS::WrapperArgType value, const sead::SafeString& name, \
|
||||
bool debug, bool force = false) { \
|
||||
if (debug) { \
|
||||
onChangedByDebug(); \
|
||||
auto& ref = debug ? getParamBypassPerm() : getParam(); \
|
||||
return ref.get().NAME(TRAITS::convertValue(value), name, force); \
|
||||
} \
|
||||
return NAME(TRAITS::convertValue(value), name); \
|
||||
} \
|
||||
\
|
||||
bool NAME(TRAITS::WrapperArgType value, FlagHandle handle, bool debug, s32 sub_idx) { \
|
||||
|
|
|
|||
|
|
@ -0,0 +1,242 @@
|
|||
#include "KingSystem/GameData/gdtSpecialFlags.h"
|
||||
#include <prim/seadStringUtil.h>
|
||||
#include "KingSystem/GameData/gdtCommonFlagsUtils.h"
|
||||
#include "KingSystem/GameData/gdtFlagUtils.h"
|
||||
|
||||
namespace ksys::gdt {
|
||||
|
||||
const char* str_Dungeon = "Dungeon";
|
||||
const char* str_Remains = "Remains";
|
||||
const char* sSmallKeyNumFlagSuffix = "_SmallKeyNum";
|
||||
const char* sDungeonClearFlagPrefix = "Clear_";
|
||||
const char* sDungeonEnterFlagPrefix = "Enter_";
|
||||
|
||||
#define GDT_DEFINE_BOOL_GETTER(FLAG) \
|
||||
bool getBool_##FLAG(bool debug = false) { return getBool(flag_##FLAG(), debug); }
|
||||
|
||||
GDT_DEFINE_BOOL_GETTER(SaveProhibition)
|
||||
GDT_DEFINE_BOOL_GETTER(SaveProhibitionArea)
|
||||
GDT_DEFINE_BOOL_GETTER(WarpProhibition)
|
||||
GDT_DEFINE_BOOL_GETTER(WarpProhibitionArea)
|
||||
GDT_DEFINE_BOOL_GETTER(WarpProhibitionArea_Fire_Relic)
|
||||
GDT_DEFINE_BOOL_GETTER(KillTimeProhibition)
|
||||
GDT_DEFINE_BOOL_GETTER(KillTimeProhibitionArea)
|
||||
GDT_DEFINE_BOOL_GETTER(KillTimeProhibitionArea_Fire_Relic)
|
||||
|
||||
#undef GDT_DEFINE_BOOL_GETTER
|
||||
|
||||
s32 getSmallKeyFlag(s32 idx, bool debug = false) {
|
||||
return getS32(flag_SmallKey(), idx, debug);
|
||||
}
|
||||
|
||||
bool isSaveProhibited() {
|
||||
if (getBool_SaveProhibition())
|
||||
return true;
|
||||
if (getBool_SaveProhibitionArea())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isWarpProhibited() {
|
||||
if (getBool_WarpProhibition())
|
||||
return true;
|
||||
if (getBool_WarpProhibitionArea())
|
||||
return true;
|
||||
if (getBool_WarpProhibitionArea_Fire_Relic())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isKillTimeProhibited() {
|
||||
if (getBool_KillTimeProhibition())
|
||||
return true;
|
||||
if (getBool_KillTimeProhibitionArea())
|
||||
return true;
|
||||
if (getBool_KillTimeProhibitionArea_Fire_Relic())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 getSmallKeyNum(const sead::SafeString& map, bool debug) {
|
||||
if (map.startsWith(str_Remains)) {
|
||||
sead::FixedSafeString<32> flag{map};
|
||||
flag.append(sSmallKeyNumFlagSuffix);
|
||||
return getS32ByKey(flag, debug);
|
||||
}
|
||||
|
||||
const s32 dungeon_num = getDungeonNum(map);
|
||||
if (dungeon_num == -1)
|
||||
return 0;
|
||||
|
||||
return getSmallKeyFlag(dungeon_num, debug);
|
||||
}
|
||||
|
||||
s32 getS32ByKey(const sead::SafeString& flag, bool debug) {
|
||||
s32 value{};
|
||||
|
||||
auto* mgr = Manager::instance();
|
||||
if (mgr) {
|
||||
if (debug)
|
||||
mgr->getParamBypassPerm().get().getS32(&value, flag);
|
||||
else
|
||||
mgr->getParam().get().getS32(&value, flag);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
s32 getDungeonNum(const sead::SafeString& map) {
|
||||
if (map.startsWith(str_Dungeon)) {
|
||||
const sead::FixedSafeString<32> buffer{str_Dungeon};
|
||||
s32 ret = -1;
|
||||
|
||||
const auto part = map.getPart(buffer.calcLength());
|
||||
if (sead::StringUtil::tryParseS32(&ret, part, sead::StringUtil::CardinalNumber::Base10))
|
||||
return ret;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void incrementSmallKeyNum(const sead::SafeString& map, s32 value, bool debug) {
|
||||
if (map.startsWith(str_Remains)) {
|
||||
sead::FixedSafeString<32> flag{map};
|
||||
flag.append(sSmallKeyNumFlagSuffix);
|
||||
increaseS32CommonFlag(value, flag, -1, debug);
|
||||
} else {
|
||||
const s32 dungeon_number = getDungeonNum(map);
|
||||
if (dungeon_number != -1)
|
||||
increaseS32CommonFlag(value, "SmallKey", dungeon_number, debug);
|
||||
}
|
||||
}
|
||||
|
||||
bool setS32ByKey(s32 value, const sead::SafeString& flag, bool debug) {
|
||||
auto* mgr = Manager::instance();
|
||||
return mgr && mgr->setS32Special(value, flag, debug, true);
|
||||
}
|
||||
|
||||
bool setBoolByKey(bool value, const sead::SafeString& flag, bool debug) {
|
||||
auto* mgr = Manager::instance();
|
||||
return mgr && mgr->setBoolSpecial(value, flag, debug, true);
|
||||
}
|
||||
|
||||
bool getBoolByKey(const sead::SafeString& flag, bool debug) {
|
||||
bool value{};
|
||||
|
||||
auto* mgr = Manager::instance();
|
||||
if (mgr) {
|
||||
if (debug)
|
||||
mgr->getParamBypassPerm().get().getBool(&value, flag);
|
||||
else
|
||||
mgr->getParam().get().getBool(&value, flag);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
bool isDungeonCleared(const sead::SafeString& map, bool debug) {
|
||||
sead::FixedSafeString<32> flag{sDungeonClearFlagPrefix};
|
||||
flag.append(map, 32 - sizeof("Clear_"));
|
||||
return getBoolByKey(flag, debug);
|
||||
}
|
||||
|
||||
void setDungeonCleared(const sead::SafeString& map, bool cleared, bool debug) {
|
||||
sead::FixedSafeString<32> flag{sDungeonClearFlagPrefix};
|
||||
flag.append(map, 32 - sizeof("Clear_"));
|
||||
setBoolByKey(cleared, flag, debug);
|
||||
}
|
||||
|
||||
bool isDungeonEntered(const sead::SafeString& map, bool debug) {
|
||||
sead::FixedSafeString<32> flag{sDungeonEnterFlagPrefix};
|
||||
flag.append(map, 32 - sizeof("Enter_"));
|
||||
return getBoolByKey(flag, debug);
|
||||
}
|
||||
|
||||
void setDungeonEntered(const sead::SafeString& map, bool cleared, bool debug) {
|
||||
sead::FixedSafeString<32> flag{sDungeonEnterFlagPrefix};
|
||||
flag.append(map, 32 - sizeof("Enter_"));
|
||||
setBoolByKey(cleared, flag, debug);
|
||||
}
|
||||
|
||||
f32 getF32ByKey(const sead::SafeString& flag, bool debug) {
|
||||
f32 value{};
|
||||
|
||||
auto* mgr = Manager::instance();
|
||||
if (mgr) {
|
||||
if (debug)
|
||||
mgr->getParamBypassPerm().get().getF32(&value, flag);
|
||||
else
|
||||
mgr->getParam().get().getF32(&value, flag);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
void getStr64ByKey(const char** value, const sead::SafeString& flag, bool debug) {
|
||||
auto* mgr = Manager::instance();
|
||||
if (mgr) {
|
||||
if (debug)
|
||||
mgr->getParamBypassPerm().get().getStr64(value, flag);
|
||||
else
|
||||
mgr->getParam().get().getStr64(value, flag);
|
||||
}
|
||||
}
|
||||
|
||||
void getVec3fByKey(sead::Vector3f* value, const sead::SafeString& flag, bool debug) {
|
||||
auto* mgr = Manager::instance();
|
||||
if (mgr) {
|
||||
if (debug)
|
||||
mgr->getParamBypassPerm().get().getVec3f(value, flag);
|
||||
else
|
||||
mgr->getParam().get().getVec3f(value, flag);
|
||||
}
|
||||
}
|
||||
|
||||
s32 getS32ByKey(const sead::SafeString& flag, s32 sub_idx, bool debug) {
|
||||
s32 value{};
|
||||
|
||||
auto* mgr = Manager::instance();
|
||||
if (mgr) {
|
||||
if (debug)
|
||||
mgr->getParamBypassPerm().get().getS32(&value, flag, sub_idx);
|
||||
else
|
||||
mgr->getParam().get().getS32(&value, flag, sub_idx);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
f32 getF32ByKey(const sead::SafeString& flag, s32 sub_idx, bool debug) {
|
||||
f32 value{};
|
||||
|
||||
auto* mgr = Manager::instance();
|
||||
if (mgr) {
|
||||
if (debug)
|
||||
mgr->getParamBypassPerm().get().getF32(&value, flag, sub_idx);
|
||||
else
|
||||
mgr->getParam().get().getF32(&value, flag, sub_idx);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
void getStr64ByKey(const char** value, const sead::SafeString& flag, s32 sub_idx, bool debug) {
|
||||
auto* mgr = Manager::instance();
|
||||
if (mgr) {
|
||||
if (debug)
|
||||
mgr->getParamBypassPerm().get().getStr64(value, flag, sub_idx);
|
||||
else
|
||||
mgr->getParam().get().getStr64(value, flag, sub_idx);
|
||||
}
|
||||
}
|
||||
|
||||
bool setF32ByKey(f32 value, const sead::SafeString& flag, bool debug) {
|
||||
auto* mgr = Manager::instance();
|
||||
return mgr && mgr->setF32Special(value, flag, debug, true);
|
||||
}
|
||||
|
||||
bool setStr64ByKey(const sead::SafeString& value, const sead::SafeString& flag, bool debug) {
|
||||
auto* mgr = Manager::instance();
|
||||
return mgr && mgr->setStr64Special(value, flag, debug, true);
|
||||
}
|
||||
|
||||
} // namespace ksys::gdt
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
#pragma once
|
||||
|
||||
#include <math/seadVector.h>
|
||||
#include <prim/seadSafeString.h>
|
||||
|
||||
namespace ksys::act {
|
||||
class Actor;
|
||||
}
|
||||
|
||||
namespace ksys::gdt {
|
||||
|
||||
bool isSaveProhibited();
|
||||
bool isWarpProhibited();
|
||||
bool isKillTimeProhibited();
|
||||
|
||||
s32 getSmallKeyNum(const sead::SafeString& map, bool debug = false);
|
||||
s32 getDungeonNum(const sead::SafeString& map);
|
||||
void incrementSmallKeyNum(const sead::SafeString& map, s32 value, bool debug = false);
|
||||
|
||||
s32 getS32ByKey(const sead::SafeString& flag, bool debug = false);
|
||||
bool setS32ByKey(s32 value, const sead::SafeString& flag, bool debug = false);
|
||||
|
||||
bool setBoolByKey(bool value, const sead::SafeString& flag, bool debug = false);
|
||||
bool getBoolByKey(const sead::SafeString& flag, bool debug = false);
|
||||
|
||||
bool isDungeonCleared(const sead::SafeString& map, bool debug = false);
|
||||
void setDungeonCleared(const sead::SafeString& map, bool cleared, bool debug = false);
|
||||
|
||||
bool isDungeonEntered(const sead::SafeString& map, bool debug = false);
|
||||
void setDungeonEntered(const sead::SafeString& map, bool entered, bool debug = false);
|
||||
|
||||
bool isGetItem(const sead::SafeString& actor, bool debug = false);
|
||||
bool isGetItem(act::Actor* actor, bool debug = false);
|
||||
void setIsGetItem(const sead::SafeString& actor, bool value, bool debug = false);
|
||||
// XXX: Same as isGetItem -- why does this exist?
|
||||
bool isGetItem2(const sead::SafeString& actor, bool debug = false);
|
||||
void setIsGetItem2(const sead::SafeString& actor, bool value, bool debug = false);
|
||||
|
||||
f32 getF32ByKey(const sead::SafeString& flag, bool debug = false);
|
||||
void getStr64ByKey(const char** value, const sead::SafeString& flag, bool debug = false);
|
||||
void getVec3fByKey(sead::Vector3f* value, const sead::SafeString& flag, bool debug = false);
|
||||
s32 getS32ByKey(const sead::SafeString& flag, s32 sub_idx, bool debug = false);
|
||||
f32 getF32ByKey(const sead::SafeString& flag, s32 sub_idx, bool debug = false);
|
||||
void getStr64ByKey(const char** value, const sead::SafeString& flag, s32 sub_idx,
|
||||
bool debug = false);
|
||||
bool setF32ByKey(f32 value, const sead::SafeString& flag, bool debug = false);
|
||||
bool setStr64ByKey(const sead::SafeString& value, const sead::SafeString& flag, bool debug = false);
|
||||
|
||||
} // namespace ksys::gdt
|
||||
Loading…
Reference in New Issue