mirror of
https://github.com/zeldaret/botw
synced 2026-08-16 20:57:31 -04:00
ksys/evt: Add DemoInfo
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
target_sources(uking PRIVATE
|
||||
evtDemoInfo.cpp
|
||||
evtDemoInfo.h
|
||||
evtEvent.cpp
|
||||
evtEvent.h
|
||||
evtInfoData.cpp
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
#include "KingSystem/Event/evtDemoInfo.h"
|
||||
#include "KingSystem/Resource/Event/resResourceDemo.h"
|
||||
|
||||
namespace ksys::evt {
|
||||
|
||||
DemoInfo::DemoInfo() {
|
||||
init(nullptr);
|
||||
}
|
||||
|
||||
bool DemoInfo::init(const res::Demo* resource) {
|
||||
mRes = resource;
|
||||
|
||||
if (mRes) {
|
||||
mNoEntryActors.set(mRes->mNoEntryActors.ref());
|
||||
mProductFormat.set(mRes->mProductFormat.ref());
|
||||
mProgress.set(mRes->mProgress.ref());
|
||||
mSaveType.set(mRes->mSaveType.ref());
|
||||
mStartType.set(mRes->mStartType.ref());
|
||||
mExtension.set(mRes->mExtension.ref());
|
||||
mEventMode.set(mRes->mEventMode.ref());
|
||||
mStartLocationType.set(mRes->mStartLocationType.ref());
|
||||
mTraverseType.set(mRes->mTraverseType.ref());
|
||||
} else {
|
||||
mNoEntryActors.value = NoEntryActors::kDefault;
|
||||
mProductFormat.value = ProductFormat::kOther;
|
||||
mProgress.value = Progress::kOther;
|
||||
mSaveType.value = SaveType::kNoAutoSave;
|
||||
mStartType.value = StartType::kOther;
|
||||
mExtension.value = Extension::kOther;
|
||||
mEventMode.value = EventMode::kOther;
|
||||
mStartLocationType.value = StartLocationType::kOther;
|
||||
mTraverseType.value = TraverseType::kOther;
|
||||
}
|
||||
|
||||
return mRes != nullptr;
|
||||
}
|
||||
|
||||
const sead::Vector3f& DemoInfo::getLocation() const {
|
||||
return isValid() ? mRes->mLocation.ref() : sead::Vector3f::zero;
|
||||
}
|
||||
|
||||
const sead::SafeString& DemoInfo::getMapProjectName() const {
|
||||
return isValid() ? mRes->mMapProjectName.ref() : sead::SafeString::cEmptyString;
|
||||
}
|
||||
|
||||
float DemoInfo::getTime() const {
|
||||
return isValid() ? mRes->mTime.ref() : -1.0;
|
||||
}
|
||||
|
||||
const sead::SafeString& DemoInfo::getWeather() const {
|
||||
return isValid() ? mRes->mWeather.ref() : sead::SafeString::cEmptyString;
|
||||
}
|
||||
|
||||
bool DemoInfo::isStopChemical() const {
|
||||
return !mRes || mRes->mIsStopChemical.ref();
|
||||
}
|
||||
|
||||
bool DemoInfo::isWithTransAnimation() const {
|
||||
return mRes && mRes->mWithTransAnimation.ref();
|
||||
}
|
||||
|
||||
float DemoInfo::getStartLocationRotY() const {
|
||||
return isValid() ? mRes->mStartLocationRotY.ref() : 0.0;
|
||||
}
|
||||
|
||||
const sead::SafeString& DemoInfo::getStartPosName() const {
|
||||
return isValid() ? mRes->mStartPosName.ref() : sead::SafeString::cEmptyString;
|
||||
}
|
||||
|
||||
bool DemoInfo::isForbidSkip() const {
|
||||
return mRes && mRes->mSkipPolicy.ref() == "Forbid";
|
||||
}
|
||||
|
||||
bool DemoInfo::isSkipPolicyMoveLastFrame() const {
|
||||
if (isValid()) {
|
||||
if (mRes->mSkipPolicy->include("MoveLastFrame"))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const sead::SafeString& DemoInfo::getDispName() const {
|
||||
return isValid() ? mRes->mDispName.ref() : sead::SafeString::cEmptyString;
|
||||
}
|
||||
|
||||
bool DemoInfo::isForceEnableIK() const {
|
||||
return mRes && mRes->mForceEnableIK.ref();
|
||||
}
|
||||
|
||||
bool DemoInfo::isUseNakedSound() const {
|
||||
return mRes && mRes->mIsUseNakedSound.ref();
|
||||
}
|
||||
|
||||
const sead::SafeString& DemoInfo::getWorldMuteType() const {
|
||||
return isValid() ? mRes->mWorldMuteType.ref() : sead::SafeString::cEmptyString;
|
||||
}
|
||||
|
||||
const sead::Vector3f& DemoInfo::getTraversePos() const {
|
||||
return isValid() ? mRes->mTraversePos.ref() : sead::Vector3f::zero;
|
||||
}
|
||||
|
||||
const sead::SafeString& DemoInfo::getWaitLoadActorNames() const {
|
||||
return isValid() ? mRes->mWaitLoadActorNames.ref() : sead::SafeString::cEmptyString;
|
||||
}
|
||||
|
||||
float DemoInfo::getTraverseLimit() const {
|
||||
return isValid() ? mRes->mTraverseLimit.ref() : 0.0;
|
||||
}
|
||||
|
||||
void DemoInfo::NoEntryActors::set(const sead::SafeString& val) {
|
||||
if (val == "AllPause")
|
||||
value = kAllPause;
|
||||
else
|
||||
value = kDefault;
|
||||
}
|
||||
|
||||
void DemoInfo::ProductFormat::set(const sead::SafeString& val) {
|
||||
if (val == "RealTime")
|
||||
value = kRealTime;
|
||||
else if (val.startsWith("MovieFile"))
|
||||
value = kMovieFile;
|
||||
else
|
||||
value = kOther;
|
||||
}
|
||||
|
||||
void DemoInfo::Progress::set(const sead::SafeString& val) {
|
||||
if (val == "Initialize")
|
||||
value = kInitialize;
|
||||
else if (val == "Temp")
|
||||
value = kTemp;
|
||||
else if (val == "Conte")
|
||||
value = kConte;
|
||||
else if (val == "Animatics")
|
||||
value = kAnimatics;
|
||||
else if (val == "Product")
|
||||
value = kProduct;
|
||||
else
|
||||
value = kOther;
|
||||
}
|
||||
|
||||
void DemoInfo::SaveType::set(const sead::SafeString& val) {
|
||||
if (val == "AutoSave")
|
||||
value = kAutoSave;
|
||||
else
|
||||
value = kNoAutoSave;
|
||||
}
|
||||
|
||||
void DemoInfo::StartType::set(const sead::SafeString& val) {
|
||||
if (val == "Seamless")
|
||||
value = kSeamless;
|
||||
else if (val == "Load")
|
||||
value = kLoad;
|
||||
else if (val == "Load(NotWaitPlacement)")
|
||||
value = kLoadNotWaitPlacement;
|
||||
else
|
||||
value = kOther;
|
||||
}
|
||||
|
||||
void DemoInfo::Extension::set(const sead::SafeString& val) {
|
||||
if (val == "evfl")
|
||||
value = kEvfl;
|
||||
else if (val == "evtm")
|
||||
value = kEvtm;
|
||||
else
|
||||
value = kOther;
|
||||
}
|
||||
|
||||
void DemoInfo::EventMode::set(const sead::SafeString& val) {
|
||||
if (val == "Seamless")
|
||||
value = kSeamless;
|
||||
else if (val == "Load")
|
||||
value = kLoad;
|
||||
else if (val == "FullPackage")
|
||||
value = kFullPackage;
|
||||
else if (val == "Continue")
|
||||
value = kContinue;
|
||||
else
|
||||
value = kOther;
|
||||
}
|
||||
|
||||
void DemoInfo::StartLocationType::set(const sead::SafeString& val) {
|
||||
if (val == "Starter")
|
||||
value = kStarter;
|
||||
else if (val == "StarterPositionOnly")
|
||||
value = kStarterPositionOnly;
|
||||
else if (val == "Player")
|
||||
value = kPlayer;
|
||||
else if (val == "SetWorldPos")
|
||||
value = kSetWorldPos;
|
||||
else if (val == "SearchSafetyPos")
|
||||
value = kSearchSafetyPos;
|
||||
else if (val == "MapUnitStartPos")
|
||||
value = kMapUnitStartPos;
|
||||
else
|
||||
value = kOther;
|
||||
}
|
||||
|
||||
void DemoInfo::TraverseType::set(const sead::SafeString& val) {
|
||||
if (val == "SetPos")
|
||||
value = kSetPos;
|
||||
else
|
||||
value = kDefault;
|
||||
}
|
||||
|
||||
} // namespace ksys::evt
|
||||
@@ -0,0 +1,160 @@
|
||||
#pragma once
|
||||
|
||||
#include <basis/seadTypes.h>
|
||||
#include <math/seadVector.h>
|
||||
#include <prim/seadSafeString.h>
|
||||
|
||||
namespace ksys::res {
|
||||
class Demo;
|
||||
}
|
||||
|
||||
namespace ksys::evt {
|
||||
|
||||
class DemoInfo {
|
||||
public:
|
||||
struct NoEntryActors {
|
||||
enum Value : u8 {
|
||||
kDefault = 0,
|
||||
kAllPause = 1,
|
||||
};
|
||||
virtual ~NoEntryActors() = default;
|
||||
void set(const sead::SafeString& val);
|
||||
Value value = kDefault;
|
||||
};
|
||||
|
||||
struct ProductFormat {
|
||||
enum Value {
|
||||
kRealTime = 0,
|
||||
kMovieFile = 1,
|
||||
kOther = 2,
|
||||
};
|
||||
virtual ~ProductFormat() = default;
|
||||
void set(const sead::SafeString& val);
|
||||
Value value = kOther;
|
||||
};
|
||||
|
||||
struct Progress {
|
||||
enum Value {
|
||||
kInitialize = 0,
|
||||
kTemp = 1,
|
||||
kConte = 2,
|
||||
kAnimatics = 3,
|
||||
kProduct = 4,
|
||||
kOther = 5,
|
||||
};
|
||||
virtual ~Progress() = default;
|
||||
void set(const sead::SafeString& val);
|
||||
Value value = kOther;
|
||||
};
|
||||
|
||||
struct SaveType {
|
||||
enum Value : u8 {
|
||||
kNoAutoSave = 0,
|
||||
kAutoSave = 1,
|
||||
};
|
||||
virtual ~SaveType() = default;
|
||||
void set(const sead::SafeString& val);
|
||||
Value value = kNoAutoSave;
|
||||
};
|
||||
|
||||
struct StartType {
|
||||
enum Value {
|
||||
kSeamless = 0,
|
||||
kLoad = 1,
|
||||
kLoadNotWaitPlacement = 2,
|
||||
kOther = 3,
|
||||
};
|
||||
virtual ~StartType() = default;
|
||||
void set(const sead::SafeString& val);
|
||||
Value value = kOther;
|
||||
};
|
||||
|
||||
struct Extension {
|
||||
enum Value {
|
||||
kEvfl = 0,
|
||||
kEvtm = 1,
|
||||
kOther = 2,
|
||||
};
|
||||
virtual ~Extension() = default;
|
||||
void set(const sead::SafeString& val);
|
||||
Value value = kOther;
|
||||
};
|
||||
|
||||
struct EventMode {
|
||||
enum Value {
|
||||
kSeamless = 0,
|
||||
kLoad = 1,
|
||||
kFullPackage = 2,
|
||||
kContinue = 3,
|
||||
kOther = 4,
|
||||
};
|
||||
virtual ~EventMode() = default;
|
||||
void set(const sead::SafeString& val);
|
||||
Value value = kOther;
|
||||
};
|
||||
|
||||
struct StartLocationType {
|
||||
enum Value {
|
||||
kStarter = 0,
|
||||
kStarterPositionOnly = 1,
|
||||
kPlayer = 2,
|
||||
kSetWorldPos = 3,
|
||||
kMapUnitStartPos = 4,
|
||||
kSearchSafetyPos = 5,
|
||||
kOther = 6,
|
||||
};
|
||||
virtual ~StartLocationType() = default;
|
||||
void set(const sead::SafeString& val);
|
||||
Value value = kOther;
|
||||
};
|
||||
|
||||
struct TraverseType {
|
||||
enum Value {
|
||||
kDefault = 0,
|
||||
kSetPos = 1,
|
||||
kOther = 2,
|
||||
};
|
||||
virtual ~TraverseType() = default;
|
||||
void set(const sead::SafeString& val);
|
||||
Value value = kOther;
|
||||
};
|
||||
|
||||
DemoInfo();
|
||||
virtual ~DemoInfo() = default;
|
||||
|
||||
bool init(const res::Demo* resource);
|
||||
|
||||
bool isValid() const { return mRes != nullptr; }
|
||||
|
||||
const sead::Vector3f& getLocation() const;
|
||||
const sead::SafeString& getMapProjectName() const;
|
||||
float getTime() const;
|
||||
const sead::SafeString& getWeather() const;
|
||||
bool isStopChemical() const;
|
||||
bool isWithTransAnimation() const;
|
||||
float getStartLocationRotY() const;
|
||||
const sead::SafeString& getStartPosName() const;
|
||||
bool isForbidSkip() const;
|
||||
bool isSkipPolicyMoveLastFrame() const;
|
||||
const sead::SafeString& getDispName() const;
|
||||
bool isForceEnableIK() const;
|
||||
bool isUseNakedSound() const;
|
||||
const sead::SafeString& getWorldMuteType() const;
|
||||
const sead::Vector3f& getTraversePos() const;
|
||||
const sead::SafeString& getWaitLoadActorNames() const;
|
||||
float getTraverseLimit() const;
|
||||
|
||||
private:
|
||||
const res::Demo* mRes = nullptr;
|
||||
NoEntryActors mNoEntryActors;
|
||||
ProductFormat mProductFormat;
|
||||
Progress mProgress;
|
||||
SaveType mSaveType;
|
||||
StartType mStartType;
|
||||
Extension mExtension;
|
||||
EventMode mEventMode;
|
||||
StartLocationType mStartLocationType;
|
||||
TraverseType mTraverseType;
|
||||
};
|
||||
|
||||
} // namespace ksys::evt
|
||||
Reference in New Issue
Block a user