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
# You can set ZLIB_ROOT to specify a certain directory to look in first.
# Once done this will define
# ZLIB_FOUND - System has zlib
# ZLIB_INCLUDE_DIRS - The zlib include directories
# ZLIB_LIBRARIES - The libraries needed to use zlib
# It also adds an imported target named `3ds::zlib`, Linking against it is
# equivalent to:
# target_link_libraries(mytarget ${ZLIB_LIBRARY})
# target_include_directories(mytarget PRIVATE ${ZLIB_INCLUDE_DIRS})
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.")
endif()
if(ZLIB_INCLUDE_DIR)
# Already in cache, be silent
set(ZLIB_FIND_QUIETLY TRUE)
endif(ZLIB_INCLUDE_DIR)
include(LibFindMacros)
include(try_add_imported_target)
set(_ZLIB_SEARCHES)
# Search ZLIB_ROOT first if it is set.
if(ZLIB_ROOT)
set(_ZLIB_SEARCH_ROOT
PATHS ${ZLIB_ROOT}
NO_DEFAULT_PATH
NO_CMAKE_FIND_ROOT_PATH)
list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_ROOT)
endif()
# Search below ${DEVKITPRO}, ${DEVKITARM}, portlibs (if enabled) etc.
set(_ZLIB_SEARCH_NORMAL
PATHS /
NO_DEFAULT_PATH
ONLY_CMAKE_FIND_ROOT_PATH)
list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_NORMAL)
foreach(search ${_ZLIB_SEARCHES})
find_path(ZLIB_INCLUDE_DIR NAMES zlib.h
${${search}}
PATH_SUFFIXES include)
find_library(ZLIB_LIBRARY NAMES z libz.a
${${search}}
PATH_SUFFIXES lib)
endforeach()
set(ZLIB_PROCESS_INCLUDES ZLIB_INCLUDE_DIR)
set(ZLIB_PROCESS_LIBS ZLIB_LIBRARY)
libfind_process(ZLIB)
try_add_imported_target(ZLIB)
# - Try to find zlib
# You can set ZLIB_ROOT to specify a certain directory to look in first.
# Once done this will define
# ZLIB_FOUND - System has zlib
# ZLIB_INCLUDE_DIRS - The zlib include directories
# ZLIB_LIBRARIES - The libraries needed to use zlib
# It also adds an imported target named `3ds::zlib`, Linking against it is
# equivalent to:
# target_link_libraries(mytarget ${ZLIB_LIBRARY})
# target_include_directories(mytarget PRIVATE ${ZLIB_INCLUDE_DIRS})
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.")
endif()
if(ZLIB_INCLUDE_DIR)
# Already in cache, be silent
set(ZLIB_FIND_QUIETLY TRUE)
endif(ZLIB_INCLUDE_DIR)
include(LibFindMacros)
include(try_add_imported_target)
set(_ZLIB_SEARCHES)
# Search ZLIB_ROOT first if it is set.
if(ZLIB_ROOT)
set(_ZLIB_SEARCH_ROOT
PATHS ${ZLIB_ROOT}
NO_DEFAULT_PATH
NO_CMAKE_FIND_ROOT_PATH)
list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_ROOT)
endif()
# Search below ${DEVKITPRO}, ${DEVKITARM}, portlibs (if enabled) etc.
set(_ZLIB_SEARCH_NORMAL
PATHS /
NO_DEFAULT_PATH
ONLY_CMAKE_FIND_ROOT_PATH)
list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_NORMAL)
foreach(search ${_ZLIB_SEARCHES})
find_path(ZLIB_INCLUDE_DIR NAMES zlib.h
${${search}}
PATH_SUFFIXES include)
find_library(ZLIB_LIBRARY NAMES z libz.a
${${search}}
PATH_SUFFIXES lib)
endforeach()
set(ZLIB_PROCESS_INCLUDES ZLIB_INCLUDE_DIR)
set(ZLIB_PROCESS_LIBS ZLIB_LIBRARY)
libfind_process(ZLIB)
try_add_imported_target(ZLIB)

132
Source/DiabloUI/extrasmenu.cpp

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

18
Source/DiabloUI/extrasmenu.h

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

Loading…
Cancel
Save