From cf3fc6cbcb9ad00f4b99502344431bef469cec8d Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sun, 18 Feb 2024 09:38:08 -0500 Subject: Make win condition checkable --- src/global.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/global.cpp') diff --git a/src/global.cpp b/src/global.cpp index 3ee4f58..bd0dcaa 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -6,6 +6,9 @@ #include #include +#include "ap_state.h" +#include "game_data.h" + const std::filesystem::path& GetExecutableDirectory() { static const std::filesystem::path* executable_directory = []() { int length = wai_getExecutablePath(NULL, 0, NULL); @@ -22,3 +25,16 @@ const std::filesystem::path& GetExecutableDirectory() { std::string GetAbsolutePath(std::string_view path) { return (GetExecutableDirectory() / path).string(); } + +bool IsLocationWinCondition(const Location& location) { + switch (AP_GetVictoryCondition()) { + case kTHE_END: + return location.ap_location_name == + "Orange Tower Seventh Floor - THE END"; + case kTHE_MASTER: + return location.ap_location_name == + "Orange Tower Seventh Floor - THE MASTER"; + case kLEVEL_2: + return location.ap_location_name == "Second Room - LEVEL 2"; + } +} -- cgit 1.4.1