From 1f91897f5df49f6d9bb8547d3a7a50e9a6900ab5 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 9 Jan 2016 16:38:12 +0000 Subject: [PATCH] Move some game symbols to namespaces --- common/main/game.h | 7 ++++--- common/main/newdemo.h | 4 +++- common/main/titles.h | 5 +++++ similar/main/game.cpp | 8 ++++++++ similar/main/gamecntl.cpp | 4 ++++ similar/main/newdemo.cpp | 4 ++++ similar/main/titles.cpp | 4 ++++ 7 files changed, 32 insertions(+), 4 deletions(-) diff --git a/common/main/game.h b/common/main/game.h index 7bf5051e5..50c8c8654 100644 --- a/common/main/game.h +++ b/common/main/game.h @@ -123,7 +123,6 @@ extern int Slew_on; // in slew or sim mode? // from game.c -void game(void); void close_game(void); void calc_frame_time(void); namespace dcx { @@ -144,6 +143,7 @@ extern int PaletteRedAdd, PaletteGreenAdd, PaletteBlueAdd; #if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II) namespace dsx { +void game(); void init_game(); void init_cockpit(); extern void PALETTE_FLASH_ADD(int dr, int dg, int db); @@ -345,6 +345,9 @@ struct game_cheats : prohibit_void_ptr extern game_cheats cheats; void move_player_2_segment(vsegptridx_t seg, int side); +window *game_setup(); +window_event_result game_handler(window *wind,const d_event &event, const unused_window_userdata_t *); +window_event_result ReadControls(const d_event &event); } #endif int cheats_enabled(); @@ -353,7 +356,6 @@ int allowed_to_fire_laser(void); int allowed_to_fire_flare(void); int allowed_to_fire_missile(void); void check_rear_view(void); -window *game_setup(void); int create_special_path(void); window_event_result ReadControls(const d_event &event); void toggle_cockpit(void); @@ -370,7 +372,6 @@ extern ubyte DemoDoingRight,DemoDoingLeft; extern fix64 Time_flash_last_played; } #endif -window_event_result game_handler(window *wind,const d_event &event, const unused_window_userdata_t *); #ifdef EDITOR void dump_used_textures_all(); diff --git a/common/main/newdemo.h b/common/main/newdemo.h index 181e99891..ebf49636c 100644 --- a/common/main/newdemo.h +++ b/common/main/newdemo.h @@ -78,6 +78,9 @@ void newdemo_record_render_object(vobjptridx_t obj); void newdemo_record_viewer_object(vobjptridx_t obj); cobjptridx_t newdemo_find_object(object_signature_t signature); void newdemo_record_kill_sound_linked_to_object(vcobjptridx_t); +namespace dsx { +void newdemo_start_playback(const char *filename); +} #endif extern void newdemo_record_sound_3d_once( int soundno, int angle, int volume ); extern void newdemo_record_sound_once( int soundno ); @@ -130,7 +133,6 @@ extern void newdemo_goto_end(int to_rewrite); extern void newdemo_goto_beginning(); // Interactive functions to control playback/record; -extern void newdemo_start_playback( const char * filename ); extern void newdemo_stop_playback(); extern void newdemo_start_recording(); extern void newdemo_stop_recording(); diff --git a/common/main/titles.h b/common/main/titles.h index 282242ef0..dfd4f6ab8 100644 --- a/common/main/titles.h +++ b/common/main/titles.h @@ -27,6 +27,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #ifdef __cplusplus #include +#include "dxxsconf.h" namespace dcx { @@ -35,8 +36,12 @@ struct d_fname; } extern void show_titles(void); +#if defined(DXX_BUILD_DESCENT_I) || defined(DXX_BUILD_DESCENT_II) +namespace dsx { void do_briefing_screens(const d_fname &filename, int level_num); void do_end_briefing_screens(const d_fname &filename); +} +#endif extern char * get_briefing_screen( int level_num ); #if defined(DXX_BUILD_DESCENT_II) void show_loading_screen(uint8_t *title_pal); diff --git a/similar/main/game.cpp b/similar/main/game.cpp index 2f94d2ef1..abd38f9c4 100644 --- a/similar/main/game.cpp +++ b/similar/main/game.cpp @@ -1144,6 +1144,8 @@ void game_disable_cheats() // game_setup() // ---------------------------------------------------------------------------- +namespace dsx { + window *game_setup(void) { window *game_wind; @@ -1194,8 +1196,12 @@ window *game_setup(void) return game_wind; } +} + window *Game_wind = NULL; +namespace dsx { + // Event handler for the game window_event_result game_handler(window *,const d_event &event, const unused_window_userdata_t *) { @@ -1302,6 +1308,8 @@ void game() Game_wind = game_setup(); } +} + //called at the end of the program void close_game() { diff --git a/similar/main/gamecntl.cpp b/similar/main/gamecntl.cpp index 8939e9cee..bbc536b27 100644 --- a/similar/main/gamecntl.cpp +++ b/similar/main/gamecntl.cpp @@ -1863,6 +1863,8 @@ static void play_test_sound() } #endif //ifndef NDEBUG +namespace dsx { + window_event_result ReadControls(const d_event &event) { int key; @@ -1969,3 +1971,5 @@ window_event_result ReadControls(const d_event &event) } return window_event_result::ignored; } + +} diff --git a/similar/main/newdemo.cpp b/similar/main/newdemo.cpp index 9dd1b1966..a2c629480 100644 --- a/similar/main/newdemo.cpp +++ b/similar/main/newdemo.cpp @@ -3885,6 +3885,8 @@ int newdemo_count_demos() return NumFiles; } +namespace dsx { + void newdemo_start_playback(const char * filename) { enum purpose_type rnd_demo = PURPOSE_CHOSE_PLAY; @@ -3969,6 +3971,8 @@ void newdemo_start_playback(const char * filename) Game_wind = game_setup(); // create game environment } +} + void newdemo_stop_playback() { infile.reset(); diff --git a/similar/main/titles.cpp b/similar/main/titles.cpp index afa8a99e9..e116406e8 100644 --- a/similar/main/titles.cpp +++ b/similar/main/titles.cpp @@ -1526,6 +1526,8 @@ static window_event_result briefing_handler(window *, const d_event &event, brie return window_event_result::ignored; } +namespace dsx { + void do_briefing_screens(const d_fname &filename, int level_num) { window *wind; @@ -1636,3 +1638,5 @@ void do_end_briefing_screens(const d_fname &filename) if (showorder) show_order_form(); } + +}