Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into package
Browse files Browse the repository at this point in the history
  • Loading branch information
maggu2810 committed Jan 1, 2024
2 parents d3b23c9 + 4efe4c9 commit 6cd0f17
Show file tree
Hide file tree
Showing 57 changed files with 420 additions and 498 deletions.
28 changes: 14 additions & 14 deletions INSTALL.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ The DXX-Rebirth maintainers have no control over the sites linked below. The ma
### Prerequisites

* [Python 3.x](https://www.python.org/) to run [scons](https://www.scons.org/), the processor for SConstruct scripts.
[Python 3.9](https://www.python.org/downloads/release/python-3912/) is recommended.
[Python 3.11](https://www.python.org/downloads/release/python-3117/) is recommended.
* C++ compiler with support for selected C++20 features. One of:
* [gcc](https://gcc.gnu.org/) 10.3
* [clang](https://clang.llvm.org/) 14.0 or later
* [gcc](https://gcc.gnu.org/) 12 or 13
* [clang](https://clang.llvm.org/) 15.0 or later
* Microsoft Visual Studio is **not** supported at this time.
Visual Studio 2022 release notes indicate it has sufficient C++ support
that it should be able to compile Rebirth. However, due to limitations
Expand All @@ -28,7 +28,7 @@ Optional, but recommended:
* [SDL\_mixer 1.2](https://www.libsdl.org/projects/SDL_mixer/).
* [libpng](http://www.libpng.org/).

Unless otherwise noted, using the newest release available is recommended. For example, prefer gcc-11.3 to gcc-10.4, even though both should work.
Unless otherwise noted, using the newest release available is recommended. For example, prefer gcc-13 to gcc-12, even though both should work.

DXX-Rebirth can be built on one system to run on a different system, such as using Linux to build for Windows (a "cross-compiled build"). The sections below specify where to get prerequisites for a build meant to run on the system where it is built (a "native build").

Expand All @@ -51,8 +51,8 @@ Where possible, Windows users should try to obtain a compiled package, rather th

If you are not sure whether your system is Windows x86 or Windows x64, use the packages for Windows x86. Systems running Windows x64 support running Windows x86 programs, but Windows x86 systems do not run Windows x64 programs.

* [Python x86 installer](https://www.python.org/ftp/python/3.9.12/python-3.9.12.exe) |
[Python x64 installer](https://www.python.org/ftp/python/3.9.12/python-3.9.12-amd64.exe)
* [Python x86 installer](https://www.python.org/ftp/python/3.11.7/python-3.11.7.exe) |
[Python x64 installer](https://www.python.org/ftp/python/3.11.7/python-3.11.7-amd64.exe)
* [SCons](http://prdownloads.sourceforge.net/scons/scons-4.2.0.zip)
* C++ compiler
* mingw-gcc: [Getting Started](http://www.mingw.org/wiki/Getting_Started) |
Expand Down Expand Up @@ -159,28 +159,28 @@ Packaging scripts should use **builddir** with manually chosen directories.

The build system supports building multiple targets in parallel. This is primarily useful for developers, but can also be used by packagers to create secondary builds with different features enabled. To use it, run **scons** *game*=*profile[,profile...]*. **SConstruct** will search each profile for the known options. The first match wins. For example:

scons dxx=gcc10,e, d2x=gcc11,sdl2, \
gcc10_CXX=/path/to/gcc-10 \
gcc11_CXX=/path/to/gcc-11 \
scons dxx=gcc13,e, d2x=gcc12,sdl2, \
gcc13_CXX=/path/to/gcc-13 \
gcc12_CXX=/path/to/gcc-12 \
e_editor=1 sdl2_sdl2=1

This tells **SConstruct** to build both games (**dxx**) with the profiles **gcc10**, **e**, *empty* and also to build D2X-Rebirth (**d2x**) with the profiles **gcc11**, **sdl2**, *empty*. Profiles **gcc10** and **gcc11** define private values for **CXX**, so the default value of **CXX** is ignored. Profile **e** enables the **editor** option, which builds features used by players who want to create their own levels. Profile **sdl2** sets the **sdl2** option to true, which produces a build that uses libSDL2 instead of libSDL. Profile *empty* is the default namespace, so CPPFLAGS, CXXFLAGS, etc. are found when it is searched. Since these values were not assigned, they are drawn from the corresponding environment variables.
This tells **SConstruct** to build both games (**dxx**) with the profiles **gcc13**, **e**, *empty* and also to build D2X-Rebirth (**d2x**) with the profiles **gcc12**, **sdl2**, *empty*. Profiles **gcc13** and **gcc12** define private values for **CXX**, so the default value of **CXX** is ignored. Profile **e** enables the **editor** option, which builds features used by players who want to create their own levels. Profile **sdl2** sets the **sdl2** option to true, which produces a build that uses libSDL2 instead of libSDL. Profile *empty* is the default namespace, so CPPFLAGS, CXXFLAGS, etc. are found when it is searched. Since these values were not assigned, they are drawn from the corresponding environment variables.

The build system supports specifying a group of closely related targets. This is mostly redundant on shells with brace expansion support, but can be easier to type. For example:

scons builddir_prefix=build/ \
dxx=gcc10+gcc11,prof1,prof2,prof3,
dxx=gcc12+gcc13,prof1,prof2,prof3,

This is equivalent to the shell brace expansion:

scons builddir_prefix=build/ \
dxx={gcc10,gcc11},prof1,prof2,prof3,
dxx={gcc12,gcc13},prof1,prof2,prof3,

or

scons builddir_prefix=build/ \
dxx=gcc10,prof1,prof2,prof3, \
dxx=gcc11,prof1,prof2,prof3,
dxx=gcc12,prof1,prof2,prof3, \
dxx=gcc13,prof1,prof2,prof3,

Profile addition can be stacked: **scons dxx=a+b,c+d,e+f** is equivalent to **scons dxx=a,c,e dxx=a,d,e dxx=b,c,e dxx=b,d,e dxx=a,c,f dxx=a,d,f dxx=b,c,f dxx=b,d,f**.

Expand Down
2 changes: 1 addition & 1 deletion common/2d/bitblt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ class bm_rle_window : bm_rle_src_stride
{
public:
bm_rle_window(const grs_bitmap &src) :
bm_rle_src_stride(src, src.get_flag_mask(BM_FLAG_RLE_BIG))
bm_rle_src_stride{src, src.get_flag_mask(BM_FLAG_RLE_BIG)}
{
}
void skip_upper_rows(uint_fast32_t);
Expand Down
3 changes: 1 addition & 2 deletions common/3d/clipper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
namespace dcx {

#if !DXX_USE_OGL
temporary_points_t::temporary_points_t() :
free_point_num(0)
temporary_points_t::temporary_points_t()
{
auto p = &temp_points.front();
range_for (auto &f, free_points)
Expand Down
2 changes: 1 addition & 1 deletion common/3d/clipper.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace dcx {
struct polygon_clip_points : std::array<g3s_point *, MAX_POINTS_IN_POLY> {};
struct temporary_points_t
{
uint_fast32_t free_point_num;
uint_fast32_t free_point_num{};
std::array<g3s_point, MAX_POINTS_IN_POLY> temp_points;
std::array<g3s_point *, MAX_POINTS_IN_POLY> free_points;
temporary_points_t();
Expand Down
4 changes: 2 additions & 2 deletions common/3d/draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const std::array<GLfloat, 8> build_color_array_from_color_palette_index(const co
}

g3_draw_line_colors::g3_draw_line_colors(const color_palette_index color) :
color_array(build_color_array_from_color_palette_index(color))
color_array{build_color_array_from_color_palette_index(color)}
{
}
#endif
Expand Down Expand Up @@ -116,7 +116,7 @@ bool do_facing_check(const std::array<cg3s_point *, 3> &vertlist)
{
//normal not specified, so must compute
//get three points (rotated) and compute normal
const auto tempv = vm_vec_perp(vertlist[0]->p3_vec,vertlist[1]->p3_vec,vertlist[2]->p3_vec);
const auto tempv{vm_vec_perp(vertlist[0]->p3_vec, vertlist[1]->p3_vec, vertlist[2]->p3_vec)};
return (vm_vec_dot(tempv,vertlist[1]->p3_vec) < 0);
}

Expand Down
2 changes: 1 addition & 1 deletion common/3d/rod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static clipping_code calc_rod_corners(rod_4point &rod_point_group, const g3s_poi

const auto top = vm_vec_normalized(top_point.p3_vec);

auto rod_norm = vm_vec_cross(delta_vec,top);
auto rod_norm{vm_vec_cross(delta_vec, top)};

vm_vec_normalize(rod_norm);

Expand Down
2 changes: 1 addition & 1 deletion common/arch/sdl/joy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct d_event_joystickbutton : d_event
{
const unsigned button;
constexpr d_event_joystickbutton(const event_type t, const unsigned b) :
d_event(t), button(b)
d_event{t}, button{b}
{
}
};
Expand Down
2 changes: 1 addition & 1 deletion common/arch/sdl/key.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ struct d_event_keycommand : d_event
{
const unsigned keycode;
constexpr d_event_keycommand(const event_type t, const unsigned k) :
d_event(t), keycode(k)
d_event{t}, keycode{k}
{
}
};
Expand Down
2 changes: 1 addition & 1 deletion common/arch/sdl/mouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static mouseinfo Mouse;
}

d_event_mousebutton::d_event_mousebutton(const event_type etype, const mbtn b) :
d_event{etype}, button(b)
d_event{etype}, button{b}
{
}

Expand Down
2 changes: 1 addition & 1 deletion common/arch/sdl/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static window *FirstWindow = nullptr;

window::window(grs_canvas &src, const uint16_t x, const uint16_t y, const uint16_t w, const uint16_t h) :
// Default to visible and modal
prev(FrontWindow)
prev{FrontWindow}
{
gr_init_sub_canvas(w_canv, src, {x}, {y}, {w}, {h});

Expand Down
4 changes: 2 additions & 2 deletions common/arch/win32/except.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class RAII_Windows_FILE_HANDLE
const HANDLE m_h;
public:
RAII_Windows_FILE_HANDLE(HANDLE &&h) :
m_h(h)
m_h{h}
{
}
~RAII_Windows_FILE_HANDLE()
Expand All @@ -43,7 +43,7 @@ class RAII_Windows_DynamicSharedObject
{
HMODULE m_h;
RAII_Windows_DynamicSharedObject(HMODULE &&h) :
m_h(h)
m_h{h}
{
}
static RAII_Windows_DynamicSharedObject LoadInternal(std::array<wchar_t, MAX_PATH> &pathbuf, const unsigned lws, const wchar_t *const filename)
Expand Down
4 changes: 2 additions & 2 deletions common/include/3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,9 @@ class g3_draw_line_context
const color_palette_index color;
g3_draw_line_context(grs_canvas &canvas, color_palette_index color) :
#if DXX_USE_OGL
g3_draw_line_colors(color),
g3_draw_line_colors{color},
#endif
canvas(canvas), color(color)
canvas{canvas}, color{color}
{
}
g3_draw_line_context(const g3_draw_line_context &) = delete;
Expand Down
6 changes: 3 additions & 3 deletions common/include/cpp-valptridx.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@ class untyped_utilities
>::type
>::type;

class allow_end_construction;
class allow_none_construction;
class assume_nothrow_index;
class allow_end_construction {};
class allow_none_construction {};
class assume_nothrow_index {};
class rebind_policy;
};

Expand Down
3 changes: 2 additions & 1 deletion common/include/editor/editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,8 @@ struct editor_dialog final : UI_DIALOG

extern editor_dialog *EditorWindow;

void med_point_2_vec(grs_canvas *canv,vms_vector &v,short sx,short sy);
[[nodiscard]]
vms_vector med_point_2_vec(grs_canvas *canv, short sx, short sy);

//shutdown ui on the editor screen
void close_editor_screen(void);
Expand Down
2 changes: 1 addition & 1 deletion common/include/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct d_event
{
const event_type type;
constexpr d_event(const event_type t) :
type(t)
type{t}
{
}
};
Expand Down
17 changes: 6 additions & 11 deletions common/include/fwd-vecmat.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ vms_vector &vm_vec_add (vms_vector &dest, const vms_vector &src0, const vms_vect
vms_vector &_vm_vec_sub(vms_vector &dest, const vms_vector &src0, const vms_vector &src1);
void vm_vec_add2 (vms_vector &dest, const vms_vector &src);
void vm_vec_sub2 (vms_vector &dest, const vms_vector &src);
void vm_vec_avg (vms_vector &dest, const vms_vector &src0, const vms_vector &src1);
vms_vector &vm_vec_scale (vms_vector &dest, fix s);
void vm_vec_divide(vms_vector &dest, const vms_vector &src, fix d);

#define vm_vec_copy_scale(A,B,...) vm_vec_copy_scale(A, ## __VA_ARGS__, B)
vms_vector &vm_vec_copy_scale (vms_vector &dest, const vms_vector &src, fix s);
Expand Down Expand Up @@ -76,12 +74,6 @@ vm_magnitude vm_vec_normalized_dir_quick (vms_vector &dest, const vms_vector &en
[[nodiscard]]
fix vm_vec_dot (const vms_vector &v0, const vms_vector &v1);

void vm_vec_cross (vms_vector &dest, const vms_vector &src0, const vms_vector &src1);

void vm_vec_normal (vms_vector &dest, const vms_vector &p0, const vms_vector &p1, const vms_vector &p2);

void vm_vec_perp (vms_vector &dest, const vms_vector &p0, const vms_vector &p1, const vms_vector &p2);

[[nodiscard]]
fixang vm_vec_delta_ang (const vms_vector &v0, const vms_vector &v1, const vms_vector &fvec);

Expand All @@ -97,13 +89,16 @@ void vm_vec_ang_2_matrix (vms_matrix &m, const vms_vector &v, fixang a);
void vm_vector_2_matrix (vms_matrix &m, const vms_vector &fvec, const vms_vector *uvec, const vms_vector *rvec);
void vm_vec_rotate (vms_vector &dest, const vms_vector &src, const vms_matrix &m);
void _vm_matrix_x_matrix (vms_matrix &dest, const vms_matrix &src0, const vms_matrix &src1);
void vm_extract_angles_matrix (vms_angvec &a, const vms_matrix &m);
void vm_extract_angles_vector (vms_angvec &a, const vms_vector &v);
[[nodiscard]]
vms_angvec vm_extract_angles_matrix(const vms_matrix &m);
[[nodiscard]]
vms_angvec vm_extract_angles_vector(const vms_vector &v);

[[nodiscard]]
fix vm_dist_to_plane (const vms_vector &checkp, const vms_vector &norm, const vms_vector &planep);

void vms_quaternion_from_matrix(vms_quaternion &q, const vms_matrix &m);
[[nodiscard]]
vms_quaternion vms_quaternion_from_matrix(const vms_matrix &m);
void vms_matrix_from_quaternion(vms_matrix &m, const vms_quaternion &q);

}
22 changes: 6 additions & 16 deletions common/include/gr.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class grs_main_bitmap : public grs_bitmap
grs_main_bitmap(const grs_main_bitmap &) = delete;
grs_main_bitmap &operator=(const grs_main_bitmap &) = delete;
grs_main_bitmap(grs_main_bitmap &&r) :
grs_bitmap(std::move(static_cast<grs_bitmap &>(r)))
grs_bitmap{std::move(static_cast<grs_bitmap &>(r))}
{
r.bm_data = nullptr;
#if DXX_USE_OGL
Expand Down Expand Up @@ -205,13 +205,13 @@ union screen_mode
struct {
uint16_t width, height;
};
bool operator==(const screen_mode &rhs) const
constexpr bool operator==(const screen_mode &rhs) const
{
return wh == rhs.wh;
}
screen_mode() = default;
constexpr screen_mode(uint16_t &&w, uint16_t &&h) :
width(w), height(h)
width{w}, height{h}
{
}
};
Expand Down Expand Up @@ -260,7 +260,7 @@ struct RAII_SDL_Surface
RAII_SDL_Surface(RAII_SDL_Surface &&) = default;
RAII_SDL_Surface &operator=(RAII_SDL_Surface &&) = default;
explicit RAII_SDL_Surface(SDL_Surface *const s) :
surface(s)
surface{s}
{
}
};
Expand Down Expand Up @@ -350,24 +350,14 @@ static inline void gr_set_transparent(grs_bitmap &bm, bool bTransparent)

namespace dcx {

static inline void gr_set_font_fg_color(grs_canvas &canvas, int fg_color)
{
canvas.cv_font_fg_color = fg_color;
}

static inline void gr_set_font_fg_color(grs_canvas &canvas, color_palette_index fg_color)
{
canvas.cv_font_fg_color = static_cast<int>(fg_color);
}

static inline void gr_set_font_bg_color(grs_canvas &canvas, int bg_color)
{
canvas.cv_font_bg_color = bg_color;
canvas.cv_font_fg_color = fg_color;
}

static inline void gr_set_font_bg_color(grs_canvas &canvas, color_palette_index bg_color)
{
canvas.cv_font_bg_color = static_cast<int>(bg_color);
canvas.cv_font_bg_color = bg_color;
}

#define gr_set_fontcolor(C,F,B) \
Expand Down
2 changes: 1 addition & 1 deletion common/include/mouse.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class d_event_mouse_moved : public d_event
const SDL_MOUSE_MOVE_INT_TYPE dx, dy;
const int16_t dz;
constexpr d_event_mouse_moved(const event_type t, const SDL_MOUSE_MOVE_INT_TYPE x, const SDL_MOUSE_MOVE_INT_TYPE y, const int16_t z) :
d_event(t), dx(x), dy(y), dz(z)
d_event{t}, dx{x}, dy{y}, dz{z}
{
}
#undef SDL_MOUSE_MOVE_INT_TYPE
Expand Down
2 changes: 1 addition & 1 deletion common/include/physfsx.h
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ class PHYSFS_computed_path_mount_deleter : PHYSFS_unowned_storage_mount_deleter,
PHYSFS_computed_path_mount_deleter(const PHYSFS_computed_path_mount_deleter &) = default;
PHYSFS_computed_path_mount_deleter(PHYSFS_computed_path_mount_deleter &&) = default;
PHYSFS_computed_path_mount_deleter(std::default_delete<element_type> &&d) :
std::default_delete<element_type>(std::move(d))
std::default_delete<element_type>{std::move(d)}
{
}
PHYSFS_computed_path_mount_deleter &operator=(PHYSFS_computed_path_mount_deleter &&) = default;
Expand Down
14 changes: 7 additions & 7 deletions common/include/rle.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ class bm_rle_src_stride
public:
bm_rle_src_stride(const grs_bitmap &src, const unsigned rle_big) :
/* Jump threading should collapse the separate ?: uses */
src_bit_stride_size(rle_big ? sizeof(uint16_t) : sizeof(uint8_t)),
src_bit_load_mask(rle_big ? 0xffff : 0xff),
ptr_src_bit_lengths(&src.bm_data[4]),
src_bits(&ptr_src_bit_lengths[rle_big ? src.bm_h * 2 : src.bm_h])
src_bit_stride_size{rle_big ? unsigned{sizeof(uint16_t)} : unsigned{sizeof(uint8_t)}},
src_bit_load_mask{rle_big ? 0xffffu : 0xffu},
ptr_src_bit_lengths{&src.bm_data[4]},
src_bits{&ptr_src_bit_lengths[rle_big ? src.bm_h * 2 : src.bm_h]}
{
}
void advance_src_bits();
Expand Down Expand Up @@ -184,9 +184,9 @@ class bm_rle_expand : bm_rle_src_stride
dst_exhausted,
};
bm_rle_expand(const grs_bitmap &src) :
bm_rle_src_stride(src, src.get_flag_mask(BM_FLAG_RLE_BIG)),
end_src_bit_lengths(src_bits),
end_src_bm(end(src))
bm_rle_src_stride{src, src.get_flag_mask(BM_FLAG_RLE_BIG)},
end_src_bit_lengths{src_bits},
end_src_bm{end(src)}
{
}
/* Decode one row of the bitmap, then return control to the
Expand Down
2 changes: 1 addition & 1 deletion common/include/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ class message
tuple_type t;
public:
message(Args &&... args) :
t(detail::capture_value<Args>(std::forward<Args>(args))...)
t{detail::capture_value<Args>(std::forward<Args>(args))...}
{
(check_type<Args>(), ...);
}
Expand Down
Loading

0 comments on commit 6cd0f17

Please sign in to comment.