mirror of
https://github.com/zeldaret/botw
synced 2026-07-10 22:31:54 -04:00
ksys/act: Add InfoData::InvalidLifeConditions
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include "KingSystem/Utils/Byaml/ByamlArrayIter.h"
|
||||
#include "KingSystem/Utils/Byaml/ByamlData.h"
|
||||
#include "KingSystem/Utils/Byaml/ByamlHashIter.h"
|
||||
#include "KingSystem/World/worldManager.h"
|
||||
|
||||
namespace ksys::act {
|
||||
|
||||
@@ -717,4 +718,36 @@ bool InfoData::getName(al::ByamlIter* iter, const char** name, s32 idx) const {
|
||||
return iter->tryConvertString(name, &data);
|
||||
}
|
||||
|
||||
bool InfoData::InvalidLifeConditions::containsCurrentTimeOrWeather(
|
||||
const sead::Vector3f& pos) const {
|
||||
return containsCurrentTime() || containsCurrentWeather(pos);
|
||||
}
|
||||
|
||||
bool InfoData::InvalidLifeConditions::containsCurrentTime() const {
|
||||
if (num_times < 1 || !world::Manager::instance() || world::Manager::instance()->isAocField()) {
|
||||
return false;
|
||||
}
|
||||
const char* time_type_name =
|
||||
world::TimeType::text(world::Manager::instance()->getTimeMgr()->getTimeType());
|
||||
for (int i = 0; i < num_times; i++) {
|
||||
if (times[i] == time_type_name)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool InfoData::InvalidLifeConditions::containsCurrentWeather(const sead::Vector3f& pos) const {
|
||||
if (num_weathers < 1 || !world::Manager::instance() ||
|
||||
world::Manager::instance()->isAocField()) {
|
||||
return false;
|
||||
}
|
||||
auto current_weather = world::WeatherType(world::Manager::instance()->sub_71010F337C(pos));
|
||||
const char* current_weather_name = world::Manager::getWeatherTypeString(current_weather);
|
||||
for (int i = 0; i < num_weathers; i++) {
|
||||
if (weathers[i] == current_weather_name)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ksys::act
|
||||
|
||||
@@ -74,6 +74,10 @@ public:
|
||||
sead::SafeArray<sead::SafeString, 16> times;
|
||||
s32 num_weathers;
|
||||
sead::SafeArray<sead::SafeString, 16> weathers;
|
||||
|
||||
bool containsCurrentTimeOrWeather(const sead::Vector3f& pos) const;
|
||||
bool containsCurrentTime() const;
|
||||
bool containsCurrentWeather(const sead::Vector3f& pos) const;
|
||||
};
|
||||
KSYS_CHECK_SIZE_NX150(InvalidLifeConditions, 0x210);
|
||||
|
||||
|
||||
@@ -208,6 +208,9 @@ public:
|
||||
|
||||
bool worldInfoLoaded() const { return mWorldInfoLoadStatus != WorldInfoLoadStatus::NotLoaded; }
|
||||
|
||||
u8 sub_71010F337C(const sead::Vector3f& pos); // TODO implement this : 0x71010F337C - maybe has
|
||||
// a different parameter type
|
||||
|
||||
private:
|
||||
enum class WorldInfoLoadStatus : u8 {
|
||||
NotLoaded,
|
||||
|
||||
@@ -91,6 +91,7 @@ public:
|
||||
bool isTimeFlowingNormally() const;
|
||||
|
||||
int getTimeDivision() const { return mTimeDivision; }
|
||||
int getTimeType() const { return mTimeType; }
|
||||
sead::DelegateEvent<const NewDayEvent&>& getNewDaySignal() { return mNewDaySignal; }
|
||||
float getTimeStep() const { return mTimeStep; }
|
||||
float getBloodMoonTimer() const { return mBloodMoonTimer; }
|
||||
|
||||
Reference in New Issue
Block a user