Skip to content

Commit

Permalink
Merge from 3.3.0
Browse files Browse the repository at this point in the history
(plus various changes to get things to work again)
  • Loading branch information
sirjuddington committed Mar 30, 2024
2 parents eae40d8 + f4bdecf commit 559ab1f
Show file tree
Hide file tree
Showing 585 changed files with 17,867 additions and 15,889 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ jobs:
name: "macOS",
os: macos-12,
extra_options: "-DBUILD_PK3=ON",
deps_cmdline: "brew install fluidsynth freeimage ftgl lua mpg123 sfml wxwidgets"
deps_cmdline: "brew install fluidsynth freeimage ftgl glm lua mpg123 sfml wxwidgets"
}
- {
name: "Linux GCC",
os: ubuntu-20.04,
deps_cmdline: "sudo apt-key adv --fetch-keys https://repos.codelite.org/CodeLite.asc && \
sudo apt-add-repository 'deb https://repos.codelite.org/wx3.2.0/ubuntu/ focal universe' && \
sudo apt update && sudo apt install \
libfluidsynth-dev libfreeimage-dev libftgl-dev libgtk-3-dev \
libfluidsynth-dev libfreeimage-dev libftgl-dev libglm-dev libgtk-3-dev \
liblua5.3-dev libmpg123-dev libsfml-dev libwxgtk3.2unofficial-dev"
}
- {
Expand All @@ -32,7 +32,7 @@ jobs:
deps_cmdline: "sudo apt-key adv --fetch-keys https://repos.codelite.org/CodeLite.asc && \
sudo apt-add-repository 'deb https://repos.codelite.org/wx3.2.0/ubuntu/ focal universe' && \
sudo apt update && sudo apt install \
libfluidsynth-dev libfreeimage-dev libftgl-dev libgtk-3-dev \
libfluidsynth-dev libfreeimage-dev libftgl-dev libglm-dev libgtk-3-dev \
liblua5.3-dev libmpg123-dev libsfml-dev libwxgtk3.2unofficial-dev"
}

Expand Down
4 changes: 3 additions & 1 deletion cmake/unix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ if (NOT NO_LUA)
find_package(Lua REQUIRED)
endif()
find_package(MPG123 REQUIRED)
find_package(glm REQUIRED)
include_directories(
${FREEIMAGE_INCLUDE_DIR}
${SFML_INCLUDE_DIR}
Expand Down Expand Up @@ -178,6 +179,7 @@ target_link_libraries(slade
${OPENGL_LIBRARIES}
${LUA_LIBRARIES}
${MPG123_LIBRARIES}
glm::glm
)

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION LESS 9)
Expand Down Expand Up @@ -243,7 +245,7 @@ endif()

if (NOT NO_COTIRE)
set_target_properties(slade PROPERTIES
COTIRE_CXX_PREFIX_HEADER_INIT "common.h"
COTIRE_CXX_PREFIX_HEADER_INIT "Application/Main.h"
# Enable multithreaded unity builds by default
# because otherwise probably no one would realize how
COTIRE_UNITY_SOURCE_MAXIMUM_NUMBER_OF_INCLUDES -j
Expand Down
4 changes: 3 additions & 1 deletion cmake/win_msvc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ find_package(freeimage CONFIG REQUIRED)
find_package(MPG123 CONFIG REQUIRED)
find_package(OpenGL REQUIRED)
find_package(SFML COMPONENTS system audio window network CONFIG REQUIRED)
find_package(glm REQUIRED)


# Include Search Paths ---------------------------------------------------------
Expand Down Expand Up @@ -78,7 +79,7 @@ set_target_properties(slade
)

# Precompiled Header
target_precompile_headers(slade PRIVATE "common.h")
target_precompile_headers(slade PRIVATE "Application/Main.h")

# Link
target_link_libraries(slade
Expand All @@ -95,6 +96,7 @@ target_link_libraries(slade
sfml-main
sfml-network
sfml-window
glm::glm
)

if (NOT NO_LUA)
Expand Down
6 changes: 6 additions & 0 deletions src/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,9 @@ TabWidth: 4
UseTab: ForContinuationAndIndentation
PenaltyReturnTypeOnItsOwnLine: 1000
PenaltyBreakAssignment: 1000

AlignConsecutiveShortCaseStatements:
Enabled: true
AcrossEmptyLines: true
AcrossComments: true
AlignCaseColons: false
23 changes: 16 additions & 7 deletions src/Application/App.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

// -----------------------------------------------------------------------------
// SLADE - It's a Doom Editor
// Copyright(C) 2008 - 2022 Simon Judd
// Copyright(C) 2008 - 2024 Simon Judd
//
// Email: sirjuddington@gmail.com
// Web: http://slade.mancubus.net
Expand Down Expand Up @@ -32,8 +32,12 @@
// -----------------------------------------------------------------------------
#include "Main.h"
#include "App.h"
#include "Archive/Archive.h"
#include "Archive/ArchiveManager.h"
#include "Game/Configuration.h"
#include "Archive/EntryType/EntryDataFormat.h"
#include "Archive/EntryType/EntryType.h"
#include "Game/Game.h"
#include "Game/SpecialPreset.h"
#include "General/Clipboard.h"
#include "General/ColourConfiguration.h"
#include "General/Console.h"
Expand All @@ -59,12 +63,17 @@
#include "UI/WxUtils.h"
#include "Utility/StringUtils.h"
#include "Utility/Tokenizer.h"
#include <FreeImage.h>
#include <dumb.h>
#include <filesystem>
#ifdef __WXOSX__
#include <ApplicationServices/ApplicationServices.h>
#endif

#ifndef _WIN32
#undef _WINDOWS_ // Undefine _WINDOWS_ that has been defined by FreeImage
#endif

using namespace slade;


Expand Down Expand Up @@ -743,12 +752,12 @@ string app::path(string_view filename, Dir dir)
{
switch (dir)
{
case Dir::User: return fmt::format("{}{}{}", dir_user, dir_separator, filename);
case Dir::Data: return fmt::format("{}{}{}", dir_data, dir_separator, filename);
case Dir::User: return fmt::format("{}{}{}", dir_user, dir_separator, filename);
case Dir::Data: return fmt::format("{}{}{}", dir_data, dir_separator, filename);
case Dir::Executable: return fmt::format("{}{}{}", dir_app, dir_separator, filename);
case Dir::Resources: return fmt::format("{}{}{}", dir_res, dir_separator, filename);
case Dir::Temp: return fmt::format("{}{}{}", dir_temp, dir_separator, filename);
default: return string{ filename };
case Dir::Resources: return fmt::format("{}{}{}", dir_res, dir_separator, filename);
case Dir::Temp: return fmt::format("{}{}{}", dir_temp, dir_separator, filename);
default: return string{ filename };
}
}

Expand Down
41 changes: 13 additions & 28 deletions src/common.h → src/Application/Common.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#ifndef COMMON_H
#define COMMON_H

#ifndef __COMMON_H__
#define __COMMON_H__

// wxWidgets -------------------------------------------------------------------

Expand Down Expand Up @@ -29,11 +30,8 @@
#include <wx/dcmemory.h>
#include <wx/dialog.h>
#include <wx/dir.h>
#include <wx/dirdlg.h>
#include <wx/display.h>
#include <wx/dnd.h>
#include <wx/event.h>
#include <wx/ffile.h>
#include <wx/file.h>
#include <wx/filedlg.h>
#include <wx/filefn.h>
Expand All @@ -44,11 +42,9 @@
#include <wx/generic/textdlgg.h>
#include <wx/graphics.h>
#include <wx/grid.h>
#include <wx/hashmap.h>
#include <wx/image.h>
#include <wx/imaglist.h>
#include <wx/ipc.h>
#include <wx/listbox.h>
#include <wx/listctrl.h>
#include <wx/log.h>
#include <wx/menu.h>
Expand All @@ -62,7 +58,6 @@
#include <wx/propgrid/property.h>
#include <wx/propgrid/propgrid.h>
#include <wx/protocol/http.h>
#include <wx/ptr_scpd.h>
#include <wx/radiobut.h>
#include <wx/regex.h>
#include <wx/renderer.h>
Expand All @@ -72,7 +67,6 @@
#include <wx/slider.h>
#include <wx/snglinst.h>
#include <wx/spinctrl.h>
#include <wx/sstream.h>
#include <wx/stackwalk.h>
#include <wx/statbox.h>
#include <wx/statline.h>
Expand All @@ -92,7 +86,6 @@
#include <wx/valnum.h>
#include <wx/wfstream.h>
#include <wx/wrapsizer.h>
#include <wx/xrc/xmlres.h>
#include <wx/zipstrm.h>

#ifdef __WXMSW__
Expand All @@ -102,41 +95,33 @@

// Other Libraries -------------------------------------------------------------

// Fluidsynth
#ifndef NO_FLUIDSYNTH
#include <fluidsynth.h>
#endif

// SFML
#include <SFML/System.hpp>

// Freeimage
#define FREEIMAGE_LIB
#include <FreeImage.h>
#ifndef _WIN32
#undef _WINDOWS_ // Undefine _WINDOWS_ that has been defined by FreeImage
#endif

// fmt
#include <fmt/core.h>

// Sigslot
#include "thirdparty/sigslot/signal.hpp"

// glm
#include <glm/glm.hpp>
// GLM
#define GLM_FORCE_CTOR_INIT
#define GLM_FORCE_SWIZZLE
#include <glm/geometric.hpp>
#include <glm/mat4x4.hpp>
#include <glm/vec2.hpp>
#include <glm/vec3.hpp>


// C++ -------------------------------------------------------------------------

#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <map>
#include <memory>
#include <optional>
#include <set>
#include <unordered_map>
#include <variant>
#include <vector>

#endif // COMMON_H
#endif // __COMMON_H__
27 changes: 27 additions & 0 deletions src/Application/CommonFwd.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#pragma once

// Forward declarations for commonly used classes/structs/etc.

namespace slade
{
// Archive
class Archive;
class ArchiveDir;
class ArchiveEntry;

// Graphics
class Palette;

// SLADEMap
class MapLine;
class MapObject;
class MapSector;
class MapSide;
class MapThing;
class MapVertex;
class SLADEMap;

// Utility
class ParseTreeNode;
struct ColRGBA;
} // namespace slade
9 changes: 5 additions & 4 deletions src/Application/Main.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#ifndef __MAIN_H__
#define __MAIN_H__

#include "common.h"
#include "common2.h"
#include "Common.h"
#include "CommonFwd.h"

#if defined _MSC_VER && _MSC_VER < 1900
#define _CRT_SECURE_NO_WARNINGS 1
Expand Down Expand Up @@ -63,7 +63,7 @@ namespace slade
using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using y16 = uint16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
Expand All @@ -73,9 +73,10 @@ using u64 = uint64_t;
// Global internal includes
// clang-format off
#include "General/CVar.h"
#include "Utility/Structs.h"
#include "Geometry/Vectors.h"
#include "General/Log.h"
#include "Utility/MemChunk.h"
#include "OpenGL/GLHeaders.h"
// clang-format on

#endif // __MAIN_H__
19 changes: 11 additions & 8 deletions src/Application/SLADEWxApp.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

// -----------------------------------------------------------------------------
// SLADE - It's a Doom Editor
// Copyright(C) 2008 - 2022 Simon Judd
// Copyright(C) 2008 - 2024 Simon Judd
//
// Email: sirjuddington@gmail.com
// Web: http://slade.mancubus.net
Expand Down Expand Up @@ -32,8 +32,11 @@
#include "Main.h"
#include "SLADEWxApp.h"
#include "App.h"
#include "Archive/Archive.h"
#include "Archive/ArchiveEntry.h"
#include "Archive/ArchiveManager.h"
#include "General/Console.h"
#include "General/SAction.h"
#include "General/Web.h"
#include "MainEditor/MainEditor.h"
#include "MainEditor/UI/ArchiveManagerPanel.h"
Expand Down Expand Up @@ -71,7 +74,7 @@ string sc_rev;
#ifdef DEBUG
bool debug = true;
#else
bool debug = false;
bool debug = false;
#endif

int win_version_major = 0;
Expand Down Expand Up @@ -442,7 +445,7 @@ bool SLADEWxApp::OnInit()
#ifdef __WINDOWS__
wxApp::SetAppName("SLADE3");
#else
wxApp::SetAppName("slade3");
wxApp::SetAppName("slade3");
#endif

// Handle exceptions using wxDebug stuff, but only in release mode
Expand All @@ -457,11 +460,11 @@ bool SLADEWxApp::OnInit()
// Should be constant, wxWidgets Cocoa backend scales everything under the hood
const double ui_scale = 1.0;
#else // !__APPLE__
// Calculate scaling factor (from system ppi)
wxMemoryDC dc;
double ui_scale = static_cast<double>(dc.GetPPI().x) / 96.0;
if (ui_scale < 1.)
ui_scale = 1.;
// Calculate scaling factor (from system ppi)
wxMemoryDC dc;
double ui_scale = static_cast<double>(dc.GetPPI().x) / 96.0;
if (ui_scale < 1.)
ui_scale = 1.;
#endif // __APPLE__

// Get Windows version
Expand Down
Loading

0 comments on commit 559ab1f

Please sign in to comment.