#pragma once #include #include #include #include #include #include "KingSystem/Utils/Types.h" #include "KingSystem/World/worldJob.h" namespace ksys::world { enum class Climate; // TODO class EnvMgr : public Job { SEAD_RTTI_OVERRIDE(EnvMgr, Job) public: struct EnvPaletteStatic { EnvPaletteStatic(); agl::utl::Parameter rayleigh_baseHeigh; agl::utl::Parameter mie_baseHeight; agl::utl::Parameter mie_scatteringCoeff; agl::utl::Parameter mie_symmetricalPropert; agl::utl::Parameter YFogEnd; agl::utl::Parameter SfParam_far; agl::utl::Parameter SfParam_density; agl::utl::Parameter BloomComposeColorNoUse_8_8; agl::utl::Parameter BloomLayerColorNoUse_16_16; agl::utl::Parameter BloomLayerColorNoUse_32_32; agl::utl::Parameter BloomLayerColorNoUse_64_64; agl::utl::Parameter BloomLayerColor_8_8{{}}; agl::utl::Parameter BloomLayerColor_16_16{{}}; agl::utl::Parameter BloomLayerColor_32_32{{}}; agl::utl::Parameter BloomLayerColor_64_64{{}}; agl::utl::Parameter _200; agl::utl::Parameter BloomComposeColor{{}}; agl::utl::ParameterObj obj; }; struct EnvPalette { struct Cloud { agl::utl::Parameter Cloud0_ColorBase{{}}; agl::utl::Parameter Cloud0_IntencityBase; agl::utl::Parameter Cloud0_ColorHilight{{}}; agl::utl::Parameter Cloud0_IntencityHilight; agl::utl::Parameter Cloud0_ColorShadow{{}}; agl::utl::Parameter Cloud0_IntencityShadow; agl::utl::Parameter Cloud0_ColorBackLight{{}}; agl::utl::Parameter Cloud1_ColorBase{{}}; agl::utl::Parameter Cloud1_IntencityBase; agl::utl::Parameter Cloud1_ColorHilight{{}}; agl::utl::Parameter Cloud1_IntencityHilight; agl::utl::Parameter Cloud1_ColorShadow{{}}; agl::utl::Parameter Cloud1_IntencityShadow; agl::utl::Parameter Cloud1_ColorBackLight{{}}; agl::utl::Parameter Cloud2_ColorBase{{}}; agl::utl::Parameter Cloud2_IntencityBase; agl::utl::Parameter Cloud2_ColorHilight{{}}; agl::utl::Parameter Cloud2_IntencityHilight; agl::utl::Parameter Cloud2_ColorShadow{{}}; agl::utl::Parameter Cloud2_IntencityShadow; agl::utl::Parameter Cloud2_ColorBackLight{{}}; }; agl::utl::Parameter BgDifColor; agl::utl::Parameter BgDifIntencity; agl::utl::Parameter FogColor; agl::utl::Parameter FogStart; agl::utl::Parameter FogEnd; agl::utl::Parameter YFogColor; agl::utl::Parameter YFogStart; agl::utl::Parameter SkySunColorNoUse; agl::utl::Parameter SkySunColor; agl::utl::Parameter SkyIsotropicfade; agl::utl::Parameter SfParam_near; agl::utl::Parameter SfParam_attenuation; agl::utl::Parameter SfParam_horizontal; agl::utl::Parameter afParam_attenuationForGrd; agl::utl::Parameter afParam_attenuationForSky; agl::utl::Parameter SkyRParam_rayleigh_amplifier; agl::utl::Parameter SkyRParam_mie_symmetricalProperty; agl::utl::Parameter SkyRParam_mie_amplifier; agl::utl::Parameter AmplifierForEnvMap; Cloud cloud; agl::utl::Parameter Cloud2NoUse; agl::utl::Parameter CloudShadowOnOff; agl::utl::Parameter BloomOffsetStart; agl::utl::Parameter BloomOffsetEnd; agl::utl::Parameter BloomOffset; agl::utl::Parameter BloomClampedLuminance; agl::utl::Parameter BloomThreshhold; agl::utl::Parameter BloomIntencity; agl::utl::Parameter VolumeMaskColorNoUse; agl::utl::Parameter VolumeMaskColor; agl::utl::Parameter VolumeMaskIntencity; agl::utl::Parameter AmbientIntencity; agl::utl::Parameter Exposure; agl::utl::Parameter Cloud0_BacklightPower; agl::utl::Parameter Cloud1_BacklightPower; agl::utl::Parameter Cloud2_BacklightPower; agl::utl::ParameterObj obj; }; KSYS_CHECK_SIZE_NX150(EnvPalette, 0x7b8); struct CdanAddFog { agl::utl::Parameter DungeonFogFogEnd; agl::utl::Parameter DungeonFogVolA; agl::utl::ParameterObj obj; }; KSYS_CHECK_SIZE_NX150(CdanAddFog, 0x70); struct EnvAttribute { agl::utl::Parameter DifUse; agl::utl::Parameter DifXang; agl::utl::Parameter DifYang; agl::utl::Parameter PaletteSel00; agl::utl::Parameter PaletteSel01; agl::utl::Parameter PaletteSel02; agl::utl::Parameter PaletteSel03; agl::utl::Parameter PaletteSel04; agl::utl::Parameter PaletteSel05; agl::utl::Parameter PaletteSel06; agl::utl::Parameter PaletteSel07; agl::utl::ParameterObj obj; }; KSYS_CHECK_SIZE_NX150(EnvAttribute, 0x190); struct WeatherInfluence { agl::utl::Parameter FeatureColor; agl::utl::Parameter FeatureFogColor; agl::utl::Parameter CalcRayleigh; agl::utl::Parameter CalcMieSymmetrical; agl::utl::Parameter CalcMie; agl::utl::Parameter CalcVolumeMaskIntencity; agl::utl::Parameter BloomThreshhold; agl::utl::Parameter BloomIntencity; agl::utl::Parameter AddMoisture; agl::utl::ParameterObj obj; }; KSYS_CHECK_SIZE_NX150(WeatherInfluence, 0x160); struct Remains { agl::utl::Parameter FeatureColor; agl::utl::Parameter FeatureFogColor; agl::utl::Parameter AddFog_near; agl::utl::Parameter AddFog_far; agl::utl::Parameter AddFog_ratio; agl::utl::Parameter SfParam_near; agl::utl::Parameter SfParam_attenuation; agl::utl::Parameter CalcRayleigh; agl::utl::Parameter CalcMieSymmetrical; agl::utl::Parameter CalcMie; agl::utl::Parameter BloomThreshhold; agl::utl::Parameter BloomIntencity; agl::utl::Parameter CalcVolumeMaskIntencity; agl::utl::ParameterObj obj; }; KSYS_CHECK_SIZE_NX150(Remains, 0x1e0); struct IndoorPalette { agl::utl::Parameter FeatureColor; agl::utl::Parameter CalcVolumeMaskIntencity; agl::utl::Parameter BloomClampedLuminance; agl::utl::Parameter BloomThreshhold; agl::utl::Parameter BloomIntencity; agl::utl::Parameter IndoorFogRatio; agl::utl::Parameter IndoorFogStart; agl::utl::Parameter IndoorFogEnd; agl::utl::Parameter attenuationForGrd; agl::utl::ParameterObj obj; }; EnvMgr(); ~EnvMgr() override; JobType getType() const override { return JobType::Env; } void reset(); void resetForStageUnload(); bool isBloodMoonNight() const; bool isInBloodMoonTimeRange() const; float getConcentrationBM() const; void activateForcedBloodMoon(); void setBloodMoonProhibition(bool prohibited); bool isLoadingScreenOpened() const; bool returnFalse() const; bool isInSandstorm() const; bool isInYigaClanHideoutArea() const; float getConcentrationDarkness() const; bool isPaletteSetTransitionDone() const; void worldMgrCalc2(); int getPaletteSet() const; bool isWaterRelicRainOn(Climate climate) const; void setPaletteSelSpeed(int speed); void setPaletteSet(int palette); void setCharAmbientScale(sead::Color4f color); void setCharMainLightScale(sead::Color4f color); void setWarpMistIntensity(float intensity); void setFogDirect(bool fog_near_use, bool fog_instant_sw, bool fog_far_use, float fog_ratio, float fog_near, float fog_far); float getBloodMoonProgress() const; void allowPaletteOverride(); float getWarpMistIntensity() const { return mWarpMistIntensity; } protected: void init_(sead::Heap* heap) override; void calc_() override; private: friend class Manager; static constexpr int NumEnvPalettes = 207; static constexpr int NumCdanAddFog = 4; static constexpr int NumEnvAttributes = 59; static constexpr int NumWeatherInfluences = 4; static constexpr int NumRemains = 7; void initEnvAttribute(int idx); void initEnvPalette(int idx); void initWeatherInfluence(int idx); void initRemains(int idx); void initIndoorPalette(); void initEnvPaletteStatic(); void initDungeonFog(); void updateTimeDivision(); void updateBloodMoon(); void updateBloodMoonFlags(); void updateForcedBloodMoon(); EnvPaletteStatic mEnvPaletteStatic; u32 mPrevSkyEnvTimeDivision = 0; u32 mSkyEnvTimeDivision = 0; float mEnvTimeTransition = 0.0; u32 mBloodMoonEndState = 0; u32 mBloodMoonStartState = 0; float mBloodMoonProgress = 0.0; int mPreviousPaletteSet = 0; int mActivePaletteSet = 0; float mPaletteSetTransition = 0.0; sead::SafeArray mEnvPalettes; sead::SafeArray mCdanAddFog; EnvPaletteStatic mEnvPaletteStaticUnused; sead::SafeArray mEnvAttributes; sead::SafeArray mWeatherInfluences; sead::SafeArray mRemains; IndoorPalette mIndoorPalette; sead::Color4f _6b4e8; sead::Color4f _6b4f8; sead::Color4f _6b508; sead::Color4f _6b518; sead::Color4f mCharAmbientScale; sead::Color4f mCharMainLightScale; float _6b548; float _6b54c; float _6b550; float mEventYfogRatio; float _6b558; float mEventDiffuseAttenuateDiameter; float _6b560; float _6b564; float _6b568; float _6b56c; float _6b570; float _6b574; float _6b578; float _6b57c; float mWarpMistIntensity; float mExposure; float mForcedBloodMoonTimer; float _6b58c; float _6b590; float _6b594; float _6b598; float mConcentrationBM; float mBloodMoonTimeRangeProgress; float mFogRatio; float mFogNear; float mFogFar; float _6b5b0; float _6b5b4; int mPaletteSetOverride; int mPaletteSetOverrideTimer; int mPaletteSetForClimate; int mPaletteSetForClimateTimer; u32 _6b5c8; u32 _6b5cc; u32 _6b5d0; u32 _6b5d4; int mWarpMistTimer; u32 _6b5dc; u32 _6b5e0; u32 _6b5e4; u32 _6b5e8; int mPaletteSelSpeed; int mPaletteSelSpeedTimer; int mForcedBloodMoonStatus; int mCharAmbientScaleTimer; int mCharMainLightScaleTimer; int mFogSetDirectTimer; u8 mDungeonSizeType; bool mForcedBloodMoonRequested; bool mForcedBloodMoonReady; bool mFogInstantSW; bool mFogNearUse; bool mFogFagUse; bool _6b60a; bool _6b60b; bool mBloodMoonProhibited; bool mDeactivateForcedBloodMoon; bool _6b60e; bool _6b60f; bool _6b610; bool mBlockPaletteSetOverride; u32 _6b614; }; KSYS_CHECK_SIZE_NX150(EnvMgr, 0x6b618); } // namespace ksys::world