From 0e4c71bfd8d0230552fa431af768af6bb74bf28e Mon Sep 17 00:00:00 2001 From: MonsterDruide1 <5958456@gmail.com> Date: Sun, 20 Jun 2021 23:11:18 +0200 Subject: Decompiled aoc3/ChampionBalladManager Change getBlightRematchCount to s8 Fixing review messages Decompiled aoc3/ChampionBalladManager --- src/Game/DLC/CMakeLists.txt | 2 ++ src/Game/DLC/aocChampionBalladManager.cpp | 32 +++++++++++++++++++++++++++++++ src/Game/DLC/aocChampionBalladManager.h | 26 +++++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 src/Game/DLC/aocChampionBalladManager.cpp create mode 100644 src/Game/DLC/aocChampionBalladManager.h (limited to 'src/Game/DLC') diff --git a/src/Game/DLC/CMakeLists.txt b/src/Game/DLC/CMakeLists.txt index aec47721..0b0579b0 100644 --- a/src/Game/DLC/CMakeLists.txt +++ b/src/Game/DLC/CMakeLists.txt @@ -1,4 +1,6 @@ target_sources(uking PRIVATE + aocChampionBalladManager.cpp + aocChampionBalladManager.h aocHardModeManager.cpp aocHardModeManager.h aocManager.cpp diff --git a/src/Game/DLC/aocChampionBalladManager.cpp b/src/Game/DLC/aocChampionBalladManager.cpp new file mode 100644 index 00000000..0a0833a0 --- /dev/null +++ b/src/Game/DLC/aocChampionBalladManager.cpp @@ -0,0 +1,32 @@ +#include "Game/DLC/aocChampionBalladManager.h" + +namespace uking { + +SEAD_SINGLETON_DISPOSER_IMPL(ChampionBalladManager) + +void ChampionBalladManager::init() { + mBlightCounts = {}; +} + +void ChampionBalladManager::setBlightRematchCount(s8 count, BlightType blight_type) { + if (count >= 0 && blight_type <= BlightType::Water) { + if (count >= 30) { + count = 30; + } + mBlightCounts[u32(blight_type)] = count; + } +} + +void ChampionBalladManager::incrementBlightRematchCount(BlightType blight_type) { + if (blight_type <= BlightType::Water) { + s8 count = mBlightCounts[u32(blight_type)] + 1; + setBlightRematchCount(count, blight_type); + } +} + +s8 ChampionBalladManager::getBlightRematchCount(BlightType blight_type) const { + if (blight_type <= BlightType::Water) + return mBlightCounts[u32(blight_type)]; + return 0; +} +} // namespace uking diff --git a/src/Game/DLC/aocChampionBalladManager.h b/src/Game/DLC/aocChampionBalladManager.h new file mode 100644 index 00000000..22c07b60 --- /dev/null +++ b/src/Game/DLC/aocChampionBalladManager.h @@ -0,0 +1,26 @@ +#pragma once + +#include +#include +#include + +namespace uking { + +enum class BlightType : u32 { Wind, Electric, Fire, Water }; + +class ChampionBalladManager { + SEAD_SINGLETON_DISPOSER(ChampionBalladManager) + ChampionBalladManager() = default; + virtual ~ChampionBalladManager() = default; + +public: + void init(); + void setBlightRematchCount(s8 count, BlightType blight_type); + void incrementBlightRematchCount(BlightType blight_type); + s8 getBlightRematchCount(BlightType blight_type) const; + +private: + sead::SafeArray mBlightCounts; +}; + +} // namespace uking -- cgit v1.2.3