diff --git a/common/arch/sdl/digi_mixer_music.cpp b/common/arch/sdl/digi_mixer_music.cpp index d22fdcce6..ba640d061 100644 --- a/common/arch/sdl/digi_mixer_music.cpp +++ b/common/arch/sdl/digi_mixer_music.cpp @@ -25,6 +25,8 @@ #include "u_mem.h" #include "console.h" +inline namespace dcx { + namespace { class current_music_t @@ -184,3 +186,5 @@ void mix_pause_resume_music() else if (Mix_PlayingMusic()) Mix_PauseMusic(); } + +} diff --git a/common/arch/sdl/event.cpp b/common/arch/sdl/event.cpp index 52bda327b..941de03dd 100644 --- a/common/arch/sdl/event.cpp +++ b/common/arch/sdl/event.cpp @@ -25,6 +25,8 @@ #include "joy.h" #include "args.h" +inline namespace dcx { + void event_poll() { SDL_Event event; @@ -200,3 +202,4 @@ fix event_get_idle_seconds() return (timer_query() - last_event)/F1_0; } +} diff --git a/common/arch/sdl/joy.cpp b/common/arch/sdl/joy.cpp index 98888345b..fd68eee62 100644 --- a/common/arch/sdl/joy.cpp +++ b/common/arch/sdl/joy.cpp @@ -26,6 +26,8 @@ #include "compiler-integer_sequence.h" #include "compiler-type_traits.h" +inline namespace dcx { + namespace { int num_joysticks = 0; @@ -381,4 +383,6 @@ int event_joystick_get_button(const d_event &event) Assert(e.type == EVENT_JOYSTICK_BUTTON_DOWN || e.type == EVENT_JOYSTICK_BUTTON_UP); return e.button; } + +} #endif diff --git a/common/arch/sdl/key.cpp b/common/arch/sdl/key.cpp index 35a06e86d..8ff3f315b 100644 --- a/common/arch/sdl/key.cpp +++ b/common/arch/sdl/key.cpp @@ -28,6 +28,8 @@ #include "dxxsconf.h" #include "compiler-array.h" +inline namespace dcx { + //-------- Variable accessed by outside functions --------- static bool keyd_repeat; // 1 = use repeats, 0 no repeats pressed_keys keyd_pressed; @@ -509,3 +511,5 @@ void key_toggle_repeat(int enable) } key_flush(); } + +} diff --git a/common/arch/sdl/mouse.cpp b/common/arch/sdl/mouse.cpp index 75b6e3854..fb5e9041f 100644 --- a/common/arch/sdl/mouse.cpp +++ b/common/arch/sdl/mouse.cpp @@ -23,6 +23,8 @@ #include "args.h" #include "gr.h" +inline namespace dcx { + namespace { struct flushable_mouseinfo @@ -251,3 +253,5 @@ void mouse_cursor_autohide() } SDL_ShowCursor(result); } + +} diff --git a/common/arch/sdl/rbaudio.cpp b/common/arch/sdl/rbaudio.cpp index 2be01dc6d..908b29903 100644 --- a/common/arch/sdl/rbaudio.cpp +++ b/common/arch/sdl/rbaudio.cpp @@ -31,6 +31,8 @@ #include "partial_range.h" #include "compiler-range_for.h" +inline namespace dcx { + #define REDBOOK_VOLUME_SCALE 255 static SDL_CD *s_cd = NULL; @@ -319,3 +321,5 @@ void RBAList(void) range_for (auto &i, partial_range(s_cd->track, static_cast(s_cd->numtracks))) con_printf(CON_VERBOSE, "RBAudio: CD track %d, type %s, length %d, offset %d", i.id, (i.type == SDL_AUDIO_TRACK) ? "audio" : "data", i.length, i.offset); } + +} diff --git a/common/arch/sdl/timer.cpp b/common/arch/sdl/timer.cpp index 0dd7a4ff9..c08489c60 100644 --- a/common/arch/sdl/timer.cpp +++ b/common/arch/sdl/timer.cpp @@ -17,6 +17,8 @@ #include "config.h" #include "multi.h" +inline namespace dcx { + static fix64 F64_RunTime = 0; fix64 timer_update() @@ -71,3 +73,5 @@ void timer_delay_bound(const unsigned caller_bound) } } } + +} diff --git a/common/arch/sdl/window.cpp b/common/arch/sdl/window.cpp index ffed5e5cb..a680ad41e 100644 --- a/common/arch/sdl/window.cpp +++ b/common/arch/sdl/window.cpp @@ -20,6 +20,8 @@ #include "dxxerror.h" #include "event.h" +inline namespace dcx { + struct window { grs_canvas w_canv; // the window's canvas to draw to @@ -221,3 +223,5 @@ int window_is_modal(window &wind) { return wind.w_modal; } + +} diff --git a/common/include/digi_mixer_music.h b/common/include/digi_mixer_music.h index 7cbf9200a..acb286c8b 100644 --- a/common/include/digi_mixer_music.h +++ b/common/include/digi_mixer_music.h @@ -10,10 +10,10 @@ * -- MD2211 (2006-04-24) */ -#ifndef _SDLMIXER_MUSIC_H -#define _SDLMIXER_MUSIC_H +#pragma once #ifdef __cplusplus +inline namespace dcx { int mix_play_music(const char *, int); int mix_play_file(const char *, int, void (*)()); @@ -24,6 +24,5 @@ void mix_resume_music(); void mix_pause_resume_music(); void mix_free_music(); -#endif - +} #endif diff --git a/common/include/editor/editor.h b/common/include/editor/editor.h index 9129de9ff..cf714c147 100644 --- a/common/include/editor/editor.h +++ b/common/include/editor/editor.h @@ -30,10 +30,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "ui.h" #include "fmtcheck.h" -struct window; - #ifdef __cplusplus - +#include "fwd-window.h" #include "fwd-segment.h" #include "objnum.h" diff --git a/common/include/editor/info.h b/common/include/editor/info.h index d69c482e3..7dfba4341 100644 --- a/common/include/editor/info.h +++ b/common/include/editor/info.h @@ -23,17 +23,13 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. * */ -#ifndef _INFO_H -#define _INFO_H +#pragma once #ifdef __cplusplus - -struct window; +#include "fwd-window.h" struct window *info_window_create(void); extern int init_info; #endif - -#endif diff --git a/common/include/editor/objpage.h b/common/include/editor/objpage.h index 7f67643d9..c42ee5f56 100644 --- a/common/include/editor/objpage.h +++ b/common/include/editor/objpage.h @@ -23,14 +23,13 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. * */ -#ifndef _OBJPAGE_H -#define _OBJPAGE_H +#pragma once #include "ui.h" #ifdef __cplusplus +#include "fwd-event.h" -struct d_event; struct vms_angvec; int objpage_grab_current(int n); @@ -43,5 +42,3 @@ int objpage_do(const d_event &event); extern void draw_object_picture(int id, vms_angvec *orient_angles, int type); #endif - -#endif diff --git a/common/include/editor/texpage.h b/common/include/editor/texpage.h index a1b9b492f..f88f2aba8 100644 --- a/common/include/editor/texpage.h +++ b/common/include/editor/texpage.h @@ -29,8 +29,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "ui.h" #ifdef __cplusplus - -struct d_event; +#include "fwd-event.h" extern int TextureLights; extern int TextureEffects; diff --git a/common/include/event.h b/common/include/event.h index 75052db2a..e981b27af 100644 --- a/common/include/event.h +++ b/common/include/event.h @@ -12,6 +12,7 @@ #include "maths.h" #ifdef __cplusplus +inline namespace dcx { enum event_type : unsigned { @@ -79,4 +80,5 @@ struct d_select_event : d_event fix event_get_idle_seconds(); +} #endif diff --git a/common/include/fwd-event.h b/common/include/fwd-event.h index 6e107b3c9..57af9762a 100644 --- a/common/include/fwd-event.h +++ b/common/include/fwd-event.h @@ -7,13 +7,13 @@ #pragma once +inline namespace dcx { + struct d_event; struct d_create_event; struct d_change_event; struct d_select_event; -#ifdef __cplusplus - enum event_type : unsigned; int event_init(); @@ -44,4 +44,4 @@ static inline void event_toggle_focus(int activate_focus) // See how long we were idle for void event_reset_idle_seconds(); -#endif +} diff --git a/common/include/fwd-window.h b/common/include/fwd-window.h index 9eb0f0dad..71b30be0f 100644 --- a/common/include/fwd-window.h +++ b/common/include/fwd-window.h @@ -11,9 +11,11 @@ #include "fwd-event.h" #include "fwd-gr.h" +void arch_init(); +inline namespace dcx { + struct window; enum class window_event_result : uint8_t; -void arch_init(); template using window_subfunction = window_event_result (*)(window *menu,const d_event &event, T *userdata); @@ -45,4 +47,6 @@ int window_is_modal(window &wind); #define WINDOW_SEND_EVENT(w, e) (event.type = e, (WINDOW_SEND_EVENT)(*w, event, __FILE__, __LINE__, #e)) +} + #endif diff --git a/common/include/joy.h b/common/include/joy.h index c115d3661..81debbc4b 100644 --- a/common/include/joy.h +++ b/common/include/joy.h @@ -19,7 +19,7 @@ #include "maths.h" #include -#ifdef __cplusplus +inline namespace dcx { struct d_event; @@ -37,13 +37,16 @@ extern void joy_close(); const d_event_joystick_axis_value &event_joystick_get_axis(const d_event &event); extern void joy_flush(); extern int event_joystick_get_button(const d_event &event); -#endif + +} #else #define joy_init() #define joy_flush() #define joy_close() #endif +inline namespace dcx { + #if MAX_BUTTONS_PER_JOYSTICK extern void joy_button_handler(SDL_JoyButtonEvent *jbe); #else @@ -61,3 +64,5 @@ extern int joy_axis_handler(SDL_JoyAxisEvent *jae); #else #define joy_axis_handler(jae) (static_cast(static_cast(jae)), 1) #endif + +} diff --git a/common/include/key.h b/common/include/key.h index d27cb385a..7e56006d2 100644 --- a/common/include/key.h +++ b/common/include/key.h @@ -41,6 +41,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. struct SDL_KeyboardEvent; +inline namespace dcx { + //========================================================================== // This installs the int9 vector and initializes the keyboard in buffered // ASCII mode. key_close simply undoes that. @@ -55,7 +57,7 @@ extern array unicode_frame_buffer; extern void key_flush(); // Clears the 256 char buffer extern int event_key_get(const d_event &event); // Get the keycode from the EVENT_KEY_COMMAND event extern int event_key_get_raw(const d_event &event); // same as above but without mod states -extern unsigned char key_ascii(); +unsigned char key_ascii(); class pressed_keys { @@ -224,4 +226,6 @@ struct key_props extern const array key_properties; +} + #endif diff --git a/common/include/mouse.h b/common/include/mouse.h index 1c3e571e6..787e4cf68 100644 --- a/common/include/mouse.h +++ b/common/include/mouse.h @@ -23,6 +23,8 @@ struct SDL_MouseButtonEvent; struct SDL_MouseMotionEvent; +inline namespace dcx { + #define MOUSE_MAX_BUTTONS 16 #define Z_SENSITIVITY 100 #define MBTN_LEFT 0 @@ -87,4 +89,6 @@ static inline void event_mouse_get_delta(const d_event &event, int *dx, int *dy, *dz = e.dz; } +} + #endif diff --git a/common/include/rbaudio.h b/common/include/rbaudio.h index d574e35e6..ed8f83c29 100644 --- a/common/include/rbaudio.h +++ b/common/include/rbaudio.h @@ -17,14 +17,12 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ - - -#ifndef _RBAUDIO_H -#define _RBAUDIO_H +#pragma once #define RBA_MEDIA_CHANGED -1 #ifdef __cplusplus +inline namespace dcx { struct RBACHANNELCTL { @@ -74,6 +72,5 @@ unsigned long RBAGetDiscID(); // List the tracks on the CD void RBAList(void); -#endif - +} #endif diff --git a/common/include/timer.h b/common/include/timer.h index 440a0560a..8cf7e960e 100644 --- a/common/include/timer.h +++ b/common/include/timer.h @@ -16,6 +16,7 @@ #include "maths.h" #ifdef __cplusplus +inline namespace dcx { fix64 timer_update(); __attribute_warn_unused_result @@ -31,4 +32,5 @@ static inline void timer_delay2(int fps) timer_delay_bound(1000u / fps); } +} #endif diff --git a/common/include/window.h b/common/include/window.h index b3bcf31ca..4cc4d8382 100644 --- a/common/include/window.h +++ b/common/include/window.h @@ -21,6 +21,7 @@ #ifdef __cplusplus #include "fwd-window.h" +inline namespace dcx { enum class window_event_result : uint8_t { @@ -83,4 +84,5 @@ static inline window_event_result (WINDOW_SEND_EVENT)(window &w, const d_event & return window_send_event(w, event); } +} #endif diff --git a/common/main/kconfig.h b/common/main/kconfig.h index 8cb0a5e8b..19a308aaa 100644 --- a/common/main/kconfig.h +++ b/common/main/kconfig.h @@ -30,11 +30,10 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #ifdef __cplusplus #include +#include "fwd-event.h" #include "compiler-array.h" #include "compiler-type_traits.h" -struct d_event; - #if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II) struct control_info { template