diff --git a/SConstruct b/SConstruct index 56075eea6..b1c940a03 100644 --- a/SConstruct +++ b/SConstruct @@ -762,7 +762,7 @@ class DXXProgram(DXXCommon): 'main/effects.cpp', 'main/fvi.cpp', 'main/game.cpp', -'main/gamecntl.c', +'main/gamecntl.cpp', 'main/gamefont.c', 'main/gamerend.c', 'main/gamesave.c', diff --git a/common/main/aistruct.h b/common/main/aistruct.h index 9e866722f..5ca376837 100644 --- a/common/main/aistruct.h +++ b/common/main/aistruct.h @@ -26,6 +26,10 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "inferno.h" #include "polyobj.h" +#ifdef __cplusplus +extern "C" { +#endif + #define GREEN_GUY 1 #define MAX_SEGMENTS_PER_PATH 20 @@ -311,4 +315,8 @@ typedef struct { extern void ai_do_cloak_stuff(void); +#ifdef __cplusplus +} +#endif + #endif /* _AISTRUCT_H */ diff --git a/common/main/escort.h b/common/main/escort.h index 3cdcc48b3..3f3540617 100644 --- a/common/main/escort.h +++ b/common/main/escort.h @@ -6,6 +6,11 @@ #ifndef _ESCORT_H #define _ESCORT_H + +#ifdef __cplusplus +extern "C" { +#endif + #if defined(DXX_BUILD_DESCENT_I) static inline void invalidate_escort_goal(void) { @@ -27,4 +32,9 @@ void invalidate_escort_goal(void); void drop_stolen_items (struct object *); extern fix64 Buddy_sorry_time; #endif + +#ifdef __cplusplus +} +#endif + #endif // _ESCORT_H diff --git a/common/main/lighting.h b/common/main/lighting.h index 83d19329e..ab0879d47 100644 --- a/common/main/lighting.h +++ b/common/main/lighting.h @@ -21,6 +21,10 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #ifndef _LIGHTING_H #define _LIGHTING_H +#ifdef __cplusplus +extern "C" { +#endif + #define MAX_LIGHT 0x10000 // max value #define MIN_LIGHT_DIST (F1_0*4) @@ -50,4 +54,8 @@ g3s_lrgb compute_object_light(object *obj,vms_vector *rotated_pnt); void toggle_headlight_active(void); void start_lighting_frame(struct object *viewer); +#ifdef __cplusplus +} +#endif + #endif /* _LIGHTING_H */ diff --git a/common/main/playsave.h b/common/main/playsave.h index 968c148cd..770b47997 100644 --- a/common/main/playsave.h +++ b/common/main/playsave.h @@ -31,6 +31,10 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "escort.h" #endif +#ifdef __cplusplus +extern "C" { +#endif + #define N_SAVE_SLOTS 10 #define GAME_NAME_LEN 25 // +1 for terminating zero = 26 @@ -136,4 +140,8 @@ struct netgame_info; void read_netgame_profile(struct netgame_info *ng); void write_netgame_profile(struct netgame_info *ng); +#ifdef __cplusplus +} +#endif + #endif /* _PLAYSAVE_H */ diff --git a/common/main/powerup.h b/common/main/powerup.h index ee3fd0872..43ec768cf 100644 --- a/common/main/powerup.h +++ b/common/main/powerup.h @@ -24,6 +24,10 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "dxxsconf.h" #include "vclip.h" +#ifdef __cplusplus +extern "C" { +#endif + enum powerup_type_t { POW_EXTRA_LIFE = 0, @@ -141,4 +145,8 @@ extern void powerup_basic(int redadd, int greenadd, int blueadd, int score, cons */ extern int powerup_type_info_read_n(powerup_type_info *pti, int n, PHYSFS_file *fp); +#ifdef __cplusplus +} +#endif + #endif /* _POWERUP_H */ diff --git a/common/main/slew.h b/common/main/slew.h index 2e2004617..a7d69b1ad 100644 --- a/common/main/slew.h +++ b/common/main/slew.h @@ -23,6 +23,10 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "object.h" +#ifdef __cplusplus +extern "C" { +#endif + //from slew.c #if 1 //ndef RELEASE //kill error on RELEASE build @@ -41,4 +45,8 @@ int slew_frame(int dont_check_keys); // Does slew frame #endif +#ifdef __cplusplus +} +#endif + #endif /* _SLEW_H */ diff --git a/common/main/state.h b/common/main/state.h index 7c3524c96..40209ea6e 100644 --- a/common/main/state.h +++ b/common/main/state.h @@ -32,6 +32,10 @@ extern int state_save_old_game(int slotnum, const char * sg_name, player_rw * sg #define SECRETC_FILENAME GameArg.SysUsePlayersDir? "Players/secret.sgc" : "secret.sgc" #endif +#ifdef __cplusplus +extern "C" { +#endif + int state_save_all(int secret_save, const char *filename_override, int blind_save); int state_restore_all(int in_game, int secret_restore, const char *filename_override); @@ -52,4 +56,8 @@ static inline void set_pos_from_return_segment(void) void set_pos_from_return_segment(void); #endif +#ifdef __cplusplus +} +#endif + #endif /* _STATE_H */ diff --git a/common/main/titles.h b/common/main/titles.h index 625a62d14..a2e4ddbc8 100644 --- a/common/main/titles.h +++ b/common/main/titles.h @@ -20,6 +20,10 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #ifndef _TITLES_H #define _TITLES_H +#ifdef __cplusplus +extern "C" { +#endif + extern void show_titles(void); extern void do_briefing_screens(const char *filename, int level_num); extern void do_end_briefing_screens(const char *filename); @@ -31,4 +35,8 @@ extern int intro_played; #endif extern void show_order_form(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/d2x-rebirth/main/movie.h b/d2x-rebirth/main/movie.h index becff3bac..880a0acb7 100644 --- a/d2x-rebirth/main/movie.h +++ b/d2x-rebirth/main/movie.h @@ -20,6 +20,10 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #ifndef _MOVIE_H #define _MOVIE_H +#ifdef __cplusplus +extern "C" { +#endif + #define MOVIE_ABORT_ON 1 #define MOVIE_ABORT_OFF 0 @@ -50,4 +54,8 @@ void init_extra_robot_movie(char *filename); extern int MovieHires; // specifies whether movies use low or high res +#ifdef __cplusplus +} +#endif + #endif /* _MOVIE_H */ diff --git a/similar/main/gamecntl.c b/similar/main/gamecntl.cpp similarity index 99% rename from similar/main/gamecntl.c rename to similar/main/gamecntl.cpp index d3bbeee3b..37adceb4e 100644 --- a/similar/main/gamecntl.c +++ b/similar/main/gamecntl.cpp @@ -19,6 +19,9 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. //#define DOOR_DEBUGGING +#define __STDC_FORMAT_MACROS // For PRIi64 + +#include #include #include #include @@ -100,6 +103,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include +using std::min; + // Global Variables ----------------------------------------------------------- int Debug_spew;