Skip to content

Commit

Permalink
Debracketing
Browse files Browse the repository at this point in the history
  • Loading branch information
davemoore22 committed Mar 25, 2024
1 parent ed533c2 commit 57e84fa
Show file tree
Hide file tree
Showing 29 changed files with 210 additions and 225 deletions.
80 changes: 40 additions & 40 deletions sorcery.layout
Original file line number Diff line number Diff line change
Expand Up @@ -2,114 +2,114 @@
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Debug" />
<File name="src/types/monstertype.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/resources/itemstore.cpp" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2904" topLine="91" />
<Cursor1 position="11232" topLine="319" />
</Cursor>
</File>
<File name="src/types/monster.cpp" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="dat/layout.json" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2882" topLine="117" />
<Cursor1 position="252118" topLine="13634" />
</Cursor>
</File>
<File name="src/types/character.cpp" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/gui/partypanel.cpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="77269" topLine="2428" />
<Cursor1 position="2991" topLine="51" />
</Cursor>
</File>
<File name="src/gui/characterdisplay.cpp" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/modules/castle.cpp" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="9629" topLine="286" />
<Cursor1 position="2024" topLine="32" />
</Cursor>
</File>
<File name="dat/layout.json" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="dat/explain.json" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="252118" topLine="13634" />
<Cursor1 position="4629" topLine="18" />
</Cursor>
</File>
<File name="src/core/application.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4115" topLine="79" />
</Cursor>
</File>
<File name="src/modules/inn.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/resources/monsterstore.cpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="7144" topLine="148" />
<Cursor1 position="5109" topLine="130" />
</Cursor>
</File>
<File name="src/core/display.cpp" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2097" topLine="38" />
</Cursor>
</File>
<File name="dat/strings.json" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/gui/menu.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="477" topLine="0" />
<Cursor1 position="2259" topLine="50" />
</Cursor>
</File>
<File name="dat/explain.json" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/gui/monsterdisplay.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="4629" topLine="18" />
<Cursor1 position="3629" topLine="53" />
</Cursor>
</File>
<File name="src/engine/engine.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="cfg/config.ini" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="51251" topLine="1437" />
<Cursor1 position="136" topLine="0" />
</Cursor>
</File>
<File name="src/resources/itemstore.cpp" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/types/dice.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="11232" topLine="319" />
<Cursor1 position="2533" topLine="83" />
</Cursor>
</File>
<File name="cfg/config.ini" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="doc/COMPILE" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="136" topLine="0" />
<Cursor1 position="342" topLine="0" />
</Cursor>
</File>
<File name="src/gui/partypanel.cpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/types/monstertype.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2991" topLine="51" />
<Cursor1 position="2904" topLine="91" />
</Cursor>
</File>
<File name="src/modules/castle.cpp" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/engine/engine.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2024" topLine="32" />
<Cursor1 position="51251" topLine="1437" />
</Cursor>
</File>
<File name="src/engine/inspect.cpp" open="1" top="1" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/types/monster.cpp" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="18433" topLine="458" />
<Cursor1 position="2882" topLine="117" />
</Cursor>
</File>
<File name="src/resources/monsterstore.cpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/types/character.cpp" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5109" topLine="130" />
<Cursor1 position="77269" topLine="2428" />
</Cursor>
</File>
<File name="inc/types/monster.hpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/engine/inspect.cpp" open="1" top="1" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1351" topLine="19" />
<Cursor1 position="18433" topLine="458" />
</Cursor>
</File>
<File name="src/gui/menu.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/gui/characterdisplay.cpp" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2259" topLine="50" />
<Cursor1 position="9629" topLine="286" />
</Cursor>
</File>
<File name="doc/COMPILE" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="dat/strings.json" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="342" topLine="0" />
<Cursor1 position="477" topLine="0" />
</Cursor>
</File>
<File name="src/gui/monsterdisplay.cpp" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/modules/inn.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3629" topLine="53" />
<Cursor1 position="7144" topLine="148" />
</Cursor>
</File>
<File name="src/types/dice.cpp" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="inc/types/monster.hpp" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2533" topLine="83" />
<Cursor1 position="1351" topLine="19" />
</Cursor>
</File>
</CodeBlocks_layout_file>
8 changes: 4 additions & 4 deletions src/core/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,13 @@ auto Sorcery::Application::start() -> int {
auto do_restart{false};
auto do_maze{false};
auto destination{Destination::DEFAULT};
if ((_check_param(CONTINUE_GAME)) && (_game->valid))
if (_check_param(CONTINUE_GAME) && _game->valid)
destination = Destination::CONTINUE;
else if (_check_param(NEW_GAME))
destination = Destination::NEW;
else if ((_check_param(RESTART_EXPEDITION)) && (_game->valid))
else if (_check_param(RESTART_EXPEDITION) && _game->valid)
do_restart = true;
else if ((_check_param(START_EXPEDITION)) && (_game->valid)) {
else if (_check_param(START_EXPEDITION) && _game->valid) {
if (_game->state->party_has_members())
do_maze = true;
} else if (_check_param(QUICKSTART))
Expand Down Expand Up @@ -385,7 +385,7 @@ auto Sorcery::Application::_restart_expedition(const unsigned int character_chos
_game->state->clear_party();
for (auto &[character_id, character] : _game->characters) {
if (character.get_location() == CharacterLocation::MAZE) {
if ((character.depth.value() == to_depth) && (character.coordinate.value() == to_loc)) {
if (character.depth.value() == to_depth && character.coordinate.value() == to_loc) {
character.set_location(CharacterLocation::PARTY);
_game->state->add_character_by_id(character_id);
}
Expand Down
22 changes: 11 additions & 11 deletions src/core/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,15 @@ auto Sorcery::Display::generate(std::string_view screen, std::map<std::string, s
image.setTexture(_system->resources->textures[component.texture]);

// Scale to less than the window size if needed
if ((component.unique_key.ends_with("banner:banner_image")) ||
(component.unique_key.ends_with("splash:splash_image")) ||
(component.unique_key.ends_with("main_menu_attract:logo_image"))) {
if (component.unique_key.ends_with("banner:banner_image") ||
component.unique_key.ends_with("splash:splash_image") ||
component.unique_key.ends_with("main_menu_attract:logo_image")) {
const ImageSize size{static_cast<unsigned int>(image.getLocalBounds().width),
static_cast<unsigned int>(image.getLocalBounds().height)};
const ImageSize window_size{
window->get_window()->getSize().x, window->get_window()->getSize().y};
auto scale_ratio_needed{1.0f};
if ((size.w > window_size.w) || (size.h > window_size.h)) {
if (size.w > window_size.w || size.h > window_size.h) {
auto shrink_width_needed{static_cast<float>(window_size.w) / static_cast<float>(size.w)};
auto shrink_height_needed{static_cast<float>(window_size.h) / static_cast<float>(size.h)};
scale_ratio_needed = std::min(shrink_width_needed, shrink_height_needed);
Expand Down Expand Up @@ -332,7 +332,7 @@ auto Sorcery::Display::display(std::string_view screen, std::map<std::string, sf
if (const CharacterStage character_stage{std::any_cast<CharacterStage>(parameter.value())};
character_stage == CharacterStage::CHOOSE_METHOD ||
character_stage == CharacterStage::REVIEW_AND_CONFIRM) {
if ((unique_key.ends_with("_frame_progress")) || (unique_key.ends_with("_summary_progres")))
if (unique_key.ends_with("_frame_progress") || unique_key.ends_with("_summary_progres"))
continue;
}
}
Expand All @@ -343,7 +343,7 @@ auto Sorcery::Display::display(std::string_view screen, std::map<std::string, sf

// Display all other sprites, but not the background wallpaper
for (auto &[unique_key, sprite] : sprites) {
if ((unique_key.ends_with("banner:banner_image")) || (unique_key.ends_with("splash:splash_image"))) {
if (unique_key.ends_with("banner:banner_image") || unique_key.ends_with("splash:splash_image")) {
if (parameter) {
sprite.setColor(sf::Color(255, 255, 255, std::any_cast<unsigned int>(parameter.value())));
}
Expand All @@ -363,10 +363,10 @@ auto Sorcery::Display::display(std::string_view screen, std::map<std::string, sf
if (parameter) {
if (const MainMenuType menu_stage{std::any_cast<MainMenuType>(parameter.value())};
menu_stage == MainMenuType::ATTRACT_MENU) {
if ((unique_key.ends_with("main_menu_attract:press_any_key")) ||
(unique_key.ends_with("main_menu_attract:subtitle_1")) ||
(unique_key.ends_with("main_menu_attract:subtitle_2")) ||
(unique_key.ends_with("main_menu_attract:copyright")))
if (unique_key.ends_with("main_menu_attract:press_any_key") ||
unique_key.ends_with("main_menu_attract:subtitle_1") ||
unique_key.ends_with("main_menu_attract:subtitle_2") ||
unique_key.ends_with("main_menu_attract:copyright"))
continue;
}
}
Expand All @@ -375,7 +375,7 @@ auto Sorcery::Display::display(std::string_view screen, std::map<std::string, sf
if (const CharacterStage character_stage{std::any_cast<CharacterStage>(parameter.value())};
character_stage == CharacterStage::CHOOSE_METHOD ||
character_stage == CharacterStage::REVIEW_AND_CONFIRM) {
if ((unique_key.ends_with("_frame_progress")) || (unique_key.ends_with("_summary_progress")))
if (unique_key.ends_with("_frame_progress") || unique_key.ends_with("_summary_progress"))
continue;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ auto Sorcery::State::clear_log_messages() -> void {
auto Sorcery::State::add_log_dice_roll(
const std::string &message, const int dice, const int roll, const int needed) -> void {

if ((dice != -1) || (roll != -1) || (needed != -1)) {
if (dice != -1 || roll != -1 || needed != -1) {
const auto success{roll < needed ? "SUCCESS" : "FAILURE"};
const auto string{fmt::format("{} ({})", message, success)};
add_log_message(_system->dice_roll_to_str(string, dice, roll, needed), MessageType::ROLL);
Expand Down
2 changes: 1 addition & 1 deletion src/engine/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ auto Sorcery::Event::start() -> std::optional<MenuItem> {

// Generate the display
std::string screen_key{};
if ((_type == TREBOR_VOICE) || (_type == WERDNA_BOAST)) {
if (_type == TREBOR_VOICE || _type == WERDNA_BOAST) {
screen_key = std::invoke([&] {
if (_stage == 1)
return _dungeon_event.component_key + "_1";
Expand Down
24 changes: 12 additions & 12 deletions src/engine/inspect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ auto Sorcery::Inspect::start(std::optional<unsigned int> character_id) -> std::o
// We have selected something from the menu
if (selected) {
const MenuItem option_chosen{(*selected.value()).item};
if ((option_chosen == MenuItem::ET_TRAIN) || (option_chosen == MenuItem::CA_TAVERN) ||
(option_chosen == MenuItem::CA_TEMPLE) || (option_chosen == MenuItem::CA_INN) ||
(option_chosen == MenuItem::ITEM_CAMP) || (option_chosen == MenuItem::CA_SHOP)) {
if (option_chosen == MenuItem::ET_TRAIN || option_chosen == MenuItem::CA_TAVERN ||
option_chosen == MenuItem::CA_TEMPLE || option_chosen == MenuItem::CA_INN ||
option_chosen == MenuItem::ITEM_CAMP || option_chosen == MenuItem::CA_SHOP) {
_display->set_input_mode(WindowInputMode::NAVIGATE_MENU);
_cur_char = std::nullopt;
return std::nullopt;
Expand All @@ -222,12 +222,12 @@ auto Sorcery::Inspect::start(std::optional<unsigned int> character_id) -> std::o

// Display Character Panel
if (selected) {
if (((*selected.value()).item != MenuItem::ET_TRAIN) &&
((*selected.value()).item != MenuItem::CA_TAVERN) &&
((*selected.value()).item != MenuItem::CA_SHOP) &&
((*selected.value()).item != MenuItem::CA_TEMPLE) &&
((*selected.value()).item != MenuItem::CA_INN) &&
((*selected.value()).item != MenuItem::ITEM_CAMP)) {
if ((*selected.value()).item != MenuItem::ET_TRAIN &&
(*selected.value()).item != MenuItem::CA_TAVERN &&
(*selected.value()).item != MenuItem::CA_SHOP &&
(*selected.value()).item != MenuItem::CA_TEMPLE &&
(*selected.value()).item != MenuItem::CA_INN &&
(*selected.value()).item != MenuItem::ITEM_CAMP) {
const auto character_chosen{static_cast<int>((*selected.value()).index)};
if (character_chosen != _cur_char_id) {
auto character{&_game->characters[character_chosen]};
Expand Down Expand Up @@ -306,8 +306,8 @@ auto Sorcery::Inspect::_handle_in_character(unsigned int character_id) -> std::o

if (event.type == sf::Event::Closed)
return MenuItem::ITEM_ABORT;
else if ((_system->input->check(WindowInput::CANCEL, event)) ||
(_system->input->check(WindowInput::BACK, event))) {
else if (_system->input->check(WindowInput::CANCEL, event) ||
_system->input->check(WindowInput::BACK, event)) {
_display->set_input_mode(WindowInputMode::NAVIGATE_MENU);
_cur_char = std::nullopt;
_in_character = false;
Expand Down Expand Up @@ -432,7 +432,7 @@ auto Sorcery::Inspect::_handle_in_character(unsigned int character_id) -> std::o
if (slot_item.has_value()) {
auto &item{slot_item.value()};

if ((item->get_equipped()) && (item->get_usable()))
if (item->get_equipped() && item->get_usable() && !item->get_cursed())
item->set_equipped(false);

// TODO: handle curses
Expand Down
Loading

0 comments on commit 57e84fa

Please sign in to comment.