Browse Source

Fix line endings in a few files

pull/3379/head
Gleb Mazovetskiy 4 years ago committed by Anders Jenbo
parent
commit
4e8c2e3644
  1. 112
      CMake/ctr/modules/FindZLIB.cmake
  2. 132
      Source/DiabloUI/extrasmenu.cpp
  3. 18
      Source/DiabloUI/extrasmenu.h

112
CMake/ctr/modules/FindZLIB.cmake

@ -1,56 +1,56 @@
# - Try to find zlib # - Try to find zlib
# You can set ZLIB_ROOT to specify a certain directory to look in first. # You can set ZLIB_ROOT to specify a certain directory to look in first.
# Once done this will define # Once done this will define
# ZLIB_FOUND - System has zlib # ZLIB_FOUND - System has zlib
# ZLIB_INCLUDE_DIRS - The zlib include directories # ZLIB_INCLUDE_DIRS - The zlib include directories
# ZLIB_LIBRARIES - The libraries needed to use zlib # ZLIB_LIBRARIES - The libraries needed to use zlib
# It also adds an imported target named `3ds::zlib`, Linking against it is # It also adds an imported target named `3ds::zlib`, Linking against it is
# equivalent to: # equivalent to:
# target_link_libraries(mytarget ${ZLIB_LIBRARY}) # target_link_libraries(mytarget ${ZLIB_LIBRARY})
# target_include_directories(mytarget PRIVATE ${ZLIB_INCLUDE_DIRS}) # target_include_directories(mytarget PRIVATE ${ZLIB_INCLUDE_DIRS})
if(NOT NINTENDO_3DS) if(NOT NINTENDO_3DS)
message(FATAL_ERROR "This module can only be used if you are using the 3DS toolchain file. Please erase this build directory or create another one, and then use -DCMAKE_TOOLCHAIN_FILE=DevkitArm3DS.cmake when calling cmake for the 1st time. For more information, see the Readme.md for more information.") message(FATAL_ERROR "This module can only be used if you are using the 3DS toolchain file. Please erase this build directory or create another one, and then use -DCMAKE_TOOLCHAIN_FILE=DevkitArm3DS.cmake when calling cmake for the 1st time. For more information, see the Readme.md for more information.")
endif() endif()
if(ZLIB_INCLUDE_DIR) if(ZLIB_INCLUDE_DIR)
# Already in cache, be silent # Already in cache, be silent
set(ZLIB_FIND_QUIETLY TRUE) set(ZLIB_FIND_QUIETLY TRUE)
endif(ZLIB_INCLUDE_DIR) endif(ZLIB_INCLUDE_DIR)
include(LibFindMacros) include(LibFindMacros)
include(try_add_imported_target) include(try_add_imported_target)
set(_ZLIB_SEARCHES) set(_ZLIB_SEARCHES)
# Search ZLIB_ROOT first if it is set. # Search ZLIB_ROOT first if it is set.
if(ZLIB_ROOT) if(ZLIB_ROOT)
set(_ZLIB_SEARCH_ROOT set(_ZLIB_SEARCH_ROOT
PATHS ${ZLIB_ROOT} PATHS ${ZLIB_ROOT}
NO_DEFAULT_PATH NO_DEFAULT_PATH
NO_CMAKE_FIND_ROOT_PATH) NO_CMAKE_FIND_ROOT_PATH)
list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_ROOT) list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_ROOT)
endif() endif()
# Search below ${DEVKITPRO}, ${DEVKITARM}, portlibs (if enabled) etc. # Search below ${DEVKITPRO}, ${DEVKITARM}, portlibs (if enabled) etc.
set(_ZLIB_SEARCH_NORMAL set(_ZLIB_SEARCH_NORMAL
PATHS / PATHS /
NO_DEFAULT_PATH NO_DEFAULT_PATH
ONLY_CMAKE_FIND_ROOT_PATH) ONLY_CMAKE_FIND_ROOT_PATH)
list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_NORMAL) list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_NORMAL)
foreach(search ${_ZLIB_SEARCHES}) foreach(search ${_ZLIB_SEARCHES})
find_path(ZLIB_INCLUDE_DIR NAMES zlib.h find_path(ZLIB_INCLUDE_DIR NAMES zlib.h
${${search}} ${${search}}
PATH_SUFFIXES include) PATH_SUFFIXES include)
find_library(ZLIB_LIBRARY NAMES z libz.a find_library(ZLIB_LIBRARY NAMES z libz.a
${${search}} ${${search}}
PATH_SUFFIXES lib) PATH_SUFFIXES lib)
endforeach() endforeach()
set(ZLIB_PROCESS_INCLUDES ZLIB_INCLUDE_DIR) set(ZLIB_PROCESS_INCLUDES ZLIB_INCLUDE_DIR)
set(ZLIB_PROCESS_LIBS ZLIB_LIBRARY) set(ZLIB_PROCESS_LIBS ZLIB_LIBRARY)
libfind_process(ZLIB) libfind_process(ZLIB)
try_add_imported_target(ZLIB) try_add_imported_target(ZLIB)

132
Source/DiabloUI/extrasmenu.cpp

@ -1,66 +1,66 @@
#include "selstart.h" #include "selstart.h"
#include "control.h" #include "control.h"
#include "DiabloUI/diabloui.h" #include "DiabloUI/diabloui.h"
#include "options.h" #include "options.h"
#include "utils/language.h" #include "utils/language.h"
namespace devilution { namespace devilution {
namespace { namespace {
bool endMenu; bool endMenu;
std::vector<std::unique_ptr<UiListItem>> vecDialogItems; std::vector<std::unique_ptr<UiListItem>> vecDialogItems;
std::vector<std::unique_ptr<UiItemBase>> vecDialog; std::vector<std::unique_ptr<UiItemBase>> vecDialog;
Art artLogo; Art artLogo;
_mainmenu_selections selectionExtrasMenu; _mainmenu_selections selectionExtrasMenu;
void ItemSelected(int value) void ItemSelected(int value)
{ {
selectionExtrasMenu = static_cast<_mainmenu_selections>(vecDialogItems[value]->m_value); selectionExtrasMenu = static_cast<_mainmenu_selections>(vecDialogItems[value]->m_value);
endMenu = true; endMenu = true;
} }
void EscPressed() void EscPressed()
{ {
selectionExtrasMenu = MAINMENU_NONE; selectionExtrasMenu = MAINMENU_NONE;
endMenu = true; endMenu = true;
} }
} // namespace } // namespace
_mainmenu_selections UiExtrasMenu() _mainmenu_selections UiExtrasMenu()
{ {
LoadBackgroundArt("ui_art\\black.pcx"); LoadBackgroundArt("ui_art\\black.pcx");
UiAddBackground(&vecDialog); UiAddBackground(&vecDialog);
UiAddLogo(&vecDialog); UiAddLogo(&vecDialog);
if (diabdat_mpq != nullptr && hellfire_mpq != nullptr) if (diabdat_mpq != nullptr && hellfire_mpq != nullptr)
vecDialogItems.push_back(std::make_unique<UiListItem>(gbIsHellfire ? _("Switch to Diablo") : _("Switch to Hellfire"), MAINMENU_SWITCHGAME)); vecDialogItems.push_back(std::make_unique<UiListItem>(gbIsHellfire ? _("Switch to Diablo") : _("Switch to Hellfire"), MAINMENU_SWITCHGAME));
if (diabdat_mpq != nullptr) if (diabdat_mpq != nullptr)
vecDialogItems.push_back(std::make_unique<UiListItem>(gbIsSpawn ? _("Switch to Fullgame") : _("Switch to Shareware"), MAINMENU_TOGGLESPAWN)); vecDialogItems.push_back(std::make_unique<UiListItem>(gbIsSpawn ? _("Switch to Fullgame") : _("Switch to Shareware"), MAINMENU_TOGGLESPAWN));
vecDialogItems.push_back(std::make_unique<UiListItem>(_("Replay Intro"), MAINMENU_REPLAY_INTRO)); vecDialogItems.push_back(std::make_unique<UiListItem>(_("Replay Intro"), MAINMENU_REPLAY_INTRO));
vecDialogItems.push_back(std::make_unique<UiListItem>(_("Support"), MAINMENU_SHOW_SUPPORT)); vecDialogItems.push_back(std::make_unique<UiListItem>(_("Support"), MAINMENU_SHOW_SUPPORT));
vecDialogItems.push_back(std::make_unique<UiListItem>(_("Previous Menu"), MAINMENU_NONE)); vecDialogItems.push_back(std::make_unique<UiListItem>(_("Previous Menu"), MAINMENU_NONE));
vecDialog.push_back(std::make_unique<UiList>(vecDialogItems, PANEL_LEFT + 34, (UI_OFFSET_Y + 240), 570, 43, UiFlags::AlignCenter | UiFlags::FontSize42 | UiFlags::ColorUiGold, 5)); vecDialog.push_back(std::make_unique<UiList>(vecDialogItems, PANEL_LEFT + 34, (UI_OFFSET_Y + 240), 570, 43, UiFlags::AlignCenter | UiFlags::FontSize42 | UiFlags::ColorUiGold, 5));
UiInitList(vecDialogItems.size(), nullptr, ItemSelected, EscPressed, vecDialog, true); UiInitList(vecDialogItems.size(), nullptr, ItemSelected, EscPressed, vecDialog, true);
endMenu = false; endMenu = false;
while (!endMenu) { while (!endMenu) {
UiClearScreen(); UiClearScreen();
UiRenderItems(vecDialog); UiRenderItems(vecDialog);
UiPollAndRender(); UiPollAndRender();
} }
ArtBackground.Unload(); ArtBackground.Unload();
ArtBackgroundWidescreen.Unload(); ArtBackgroundWidescreen.Unload();
vecDialogItems.clear(); vecDialogItems.clear();
vecDialog.clear(); vecDialog.clear();
return selectionExtrasMenu; return selectionExtrasMenu;
} }
} // namespace devilution } // namespace devilution

18
Source/DiabloUI/extrasmenu.h

@ -1,9 +1,9 @@
#pragma once #pragma once
#include "DiabloUI/diabloui.h" #include "DiabloUI/diabloui.h"
namespace devilution { namespace devilution {
_mainmenu_selections UiExtrasMenu(); _mainmenu_selections UiExtrasMenu();
} // namespace devilution } // namespace devilution

Loading…
Cancel
Save