Skip to content

Commit

Permalink
Added seasons support
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinopony committed Feb 9, 2024
1 parent cdbe4a2 commit c098b90
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.21)

project(randstalker_archipelago VERSION 1.3.2 LANGUAGES CXX)
project(randstalker_archipelago VERSION 1.3.3 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![version](https://img.shields.io/badge/Version-1.3.0-blue)
![version](https://img.shields.io/badge/Version-1.3.3-blue)
<a href="https://discord.gg/XNA76xc9sU">
<img src="https://img.shields.io/badge/-Discord-lightgrey?logo=discord" alt="Join Discord">
</a>
Expand Down
Binary file modified release_package/randstalker.exe
Binary file not shown.
50 changes: 44 additions & 6 deletions src/user_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,20 @@ void UserInterface::draw_rom_generation_window()
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Swap the music before and after taking boat to Verla");

ImGui::Checkbox("Winter theme", &_winter_theme);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Covers the world with snow. Merry Christmas!");
const Season SEASONS[] = { Season::SPRING, Season::SUMMER, Season::AUTUMN, Season::WINTER };
ImGui::Text("Season");
if(ImGui::BeginCombo("##seasonCombo", get_season_pretty_name(_season)))
{
for(Season season : SEASONS)
{
bool is_selected = (_season == season);
if (ImGui::Selectable(get_season_pretty_name(season), is_selected))
_season = season;
if (is_selected)
ImGui::SetItemDefaultFocus();
}
ImGui::EndCombo();
}

ImGui::Dummy(ImVec2(0.f, 2.f));
ImGui::Separator(); // --------------------------------------------------------
Expand Down Expand Up @@ -1134,8 +1145,19 @@ void UserInterface::load_personal_settings()
_remove_music = personal_settings.at("removeMusic");
if(personal_settings.contains("swapOverworldMusic"))
_swap_overworld_music = personal_settings.at("swapOverworldMusic");
if(personal_settings.contains("winterTheme"))
_winter_theme = personal_settings.at("winterTheme");

if(personal_settings.contains("season"))
{
std::string season_str = personal_settings["season"];
if(season_str == "winter")
_season = Season::WINTER;
else if(season_str == "summer")
_season = Season::SUMMER;
else if(season_str == "autumn" || season_str == "fall")
_season = Season::AUTUMN;
}
else if(personal_settings.contains("winterTheme") && personal_settings.at("winterTheme") == true)
_season = Season::WINTER;
}

void UserInterface::load_client_settings()
Expand Down Expand Up @@ -1210,7 +1232,11 @@ void UserInterface::save_personal_settings()

personal_settings["removeMusic"] = _remove_music;
personal_settings["swapOverworldMusic"] = _swap_overworld_music;
personal_settings["winterTheme"] = _winter_theme;

if(_season == Season::SPRING) personal_settings["season"] = "winter";
else if(_season == Season::SUMMER) personal_settings["season"] = "summer";
else if(_season == Season::AUTUMN) personal_settings["season"] = "autumn";
else if(_season == Season::WINTER) personal_settings["season"] = "winter";

std::ofstream output_file("./personal_settings.json");
if(output_file.is_open())
Expand Down Expand Up @@ -1303,3 +1329,15 @@ void UserInterface::init_presets_list()
if(_presets.empty())
_offline_generation_mode = 1; // Force permalink mode if there are no presets
}

const char* UserInterface::get_season_pretty_name(Season season)
{
if(season == Season::SUMMER)
return "Summer";
if(season == Season::AUTUMN)
return "Autumn";
if(season == Season::WINTER)
return "Winter";
else // if(season == Season::SPRING)
return "Spring (Default)";
}
12 changes: 10 additions & 2 deletions src/user_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
#include "trackable_region.hpp"
#include "tracker_config.hpp"

enum class Season {
SPRING,
SUMMER,
AUTUMN,
WINTER
};

class UserInterface {
private:
char _host[512] = "archipelago.gg:12345";
Expand All @@ -22,7 +29,7 @@ class UserInterface {
float _nigel_color_dark[3] = { 0.f, 0.f, 0.f };
bool _remove_music = false;
bool _swap_overworld_music = false;
bool _winter_theme = false;
Season _season = Season::SPRING;

int _offline_generation_mode = 0; ///< 0 = preset, 1 = permalink
int _selected_preset = 0;
Expand Down Expand Up @@ -56,7 +63,6 @@ class UserInterface {

[[nodiscard]] const char* input_rom_path() const { return _input_rom_path; }
[[nodiscard]] const char* output_rom_path() const { return _output_rom_path; }
[[nodiscard]] bool use_winter_theme() const { return _winter_theme; }

[[nodiscard]] const std::vector<TrackableItem*>& trackable_items() const { return _trackable_items; }
[[nodiscard]] const std::vector<TrackableRegion*>& trackable_regions() const { return _trackable_regions; }
Expand All @@ -73,6 +79,8 @@ class UserInterface {
void init_map_tracker();
void init_presets_list();

static const char* get_season_pretty_name(Season season);

void loop(sf::RenderWindow& window);

void draw_archipelago_connection_window();
Expand Down

0 comments on commit c098b90

Please sign in to comment.