diff --git a/platform/Windows/eduke32.vcxproj b/platform/Windows/eduke32.vcxproj index 00203ecd2..0a5596093 100644 --- a/platform/Windows/eduke32.vcxproj +++ b/platform/Windows/eduke32.vcxproj @@ -257,7 +257,6 @@ true - diff --git a/platform/Windows/eduke32.vcxproj.filters b/platform/Windows/eduke32.vcxproj.filters index 3fa224fe2..07c0a4962 100644 --- a/platform/Windows/eduke32.vcxproj.filters +++ b/platform/Windows/eduke32.vcxproj.filters @@ -215,9 +215,6 @@ Source Files - - Source Files - Source Files diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index a33b4f849..c31e40af1 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -79,8 +79,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # endif #endif /* _WIN32 */ -const char* AppProperName = APPNAME; -const char* AppTechnicalName = APPBASENAME; +extern const char* G_DefaultDefFile(void); +extern const char* G_DefFile(void); char SetupFilename[BMAX_PATH] = SETUPFILENAME; int32_t gNoSetup = 0, gCommandSetup = 0; @@ -1408,12 +1408,6 @@ int app_main(int argc, char const * const * argv) margc = argc; margv = argv; #ifdef _WIN32 - if (!G_CheckCmdSwitch(argc, argv, "-noinstancechecking") && win_checkinstance()) - { - if (!wm_ynbox(APPNAME, "Another Build game is currently running. " - "Do you wish to continue starting this copy?")) - return 3; - } backgroundidle = 0; @@ -1484,7 +1478,7 @@ int app_main(int argc, char const * const * argv) #ifdef STARTUP_SETUP_WINDOW if (readSetup < 0 || (!gNoSetup && (configversion != BYTEVERSION || gSetup.forcesetup)) || gCommandSetup) { - if (quitevent || !startwin_run()) + if (quitevent || !gi->startwin_run()) { engineUnInit(); Bexit(0); @@ -2537,3 +2531,27 @@ void sndPlaySpecialMusicOrNothing(int nMusic) strncpy(gGameOptions.zLevelSong, gEpisodeInfo[nEpisode].at28[nLevel].atd0, BMAX_PATH); } } + +extern void faketimerhandler(); +extern int app_main(int argc, char const* const* argv); +extern void app_crashhandler(void); +extern int32_t startwin_open(void); +extern int32_t startwin_close(void); +extern int32_t startwin_puts(const char*); +extern int32_t startwin_settitle(const char*); +extern int32_t startwin_idle(void*); +extern int32_t startwin_run(void); + +GameInterface Interface = { + faketimerhandler, + app_main, + app_crashhandler, + startwin_open, + startwin_close, + startwin_puts, + startwin_settitle, + startwin_idle, + startwin_run, + G_DefaultDefFile, + G_DefFile +}; diff --git a/source/blood/src/common.cpp b/source/blood/src/common.cpp index ec8d170ce..c6a737ec9 100644 --- a/source/blood/src/common.cpp +++ b/source/blood/src/common.cpp @@ -101,6 +101,7 @@ static char g_rootDir[BMAX_PATH]; int g_useCwd; int32_t g_groupFileHandle; +struct strllist* CommandPaths, * CommandGrps; void G_ExtPreInit(int32_t argc,char const * const * argv) { @@ -596,7 +597,6 @@ void G_CleanupSearchPaths(void) ////////// -struct strllist *CommandPaths, *CommandGrps; void G_AddGroup(const char *buffer) { diff --git a/source/blood/src/common_game.h b/source/blood/src/common_game.h index dc1ff31c7..a9f21731a 100644 --- a/source/blood/src/common_game.h +++ b/source/blood/src/common_game.h @@ -690,3 +690,5 @@ public: } }; +void G_AddGroup(const char* buffer); +void G_AddPath(const char* buffer); diff --git a/source/blood/src/config.cpp b/source/blood/src/config.cpp index f38a1194f..9529ba598 100644 --- a/source/blood/src/config.cpp +++ b/source/blood/src/config.cpp @@ -801,7 +801,6 @@ void CONFIG_WriteSettings(void) // save binds and aliases to _settings. if (fp) { - Bfprintf(fp,"// this file is automatically generated by %s\n", AppProperName); Bfprintf(fp,"unbindall\n"); for (int i=0; i g_defModules; diff --git a/source/build/include/common.h b/source/build/include/common.h index 014a325fc..a23712ed2 100644 --- a/source/build/include/common.h +++ b/source/build/include/common.h @@ -56,8 +56,6 @@ extern void PrintBuildInfo(void); extern void clearDefNamePtr(void); -void G_AddGroup(const char *buffer); -void G_AddPath(const char *buffer); void G_AddDef(const char *buffer); void G_AddDefModule(const char *buffer); #ifdef HAVE_CLIPSHAPE_FEATURE @@ -142,6 +140,4 @@ void COMMON_clearbackground(int32_t numcols, int32_t numrows); #define EDUKE32_TMRTIC t[ti++]=timerGetTicks() #define EDUKE32_TMRPRN do { int ii=0; fprintf(stderr,"%s: ",tmrstr); for (ii=1; ii g_defModules; + void PrintBuildInfo(void) { buildprint( @@ -70,8 +72,6 @@ void clearDefNamePtr(void) // g_defNamePtr assumed to be assigned to right after } -GrowArray g_defModules; - #ifdef HAVE_CLIPSHAPE_FEATURE GrowArray g_clipMapFiles; #endif diff --git a/source/build/src/defs.cpp b/source/build/src/defs.cpp index 9ebc7bdcb..648db8da8 100644 --- a/source/build/src/defs.cpp +++ b/source/build/src/defs.cpp @@ -443,7 +443,7 @@ static int32_t defsparser(scriptfile *script) } case T_INCLUDEDEFAULT: { - defsparser_include(G_DefaultDefFile(), script, cmdtokptr); + defsparser_include(gi->DefaultDefFile(), script, cmdtokptr); break; } case T_DEFINE: diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index fa2afd31a..db9f1d67b 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -245,6 +245,10 @@ double u64tickspersec; int32_t engine_screenshot = 0; #endif +void faketimerhandler() +{ +} + int32_t get_alwaysshowgray(void) { return showinnergray || !(editorzrange[0]==INT32_MIN && editorzrange[1]==INT32_MAX); diff --git a/source/build/src/osd.cpp b/source/build/src/osd.cpp index 1b7c41ad6..232291301 100644 --- a/source/build/src/osd.cpp +++ b/source/build/src/osd.cpp @@ -1875,8 +1875,6 @@ void OSD_Dispatch(const char *cmd) if ((strlen_gamefunc_ >= strlen_token || Bstrncmp(token, s_gamefunc_, strlen_gamefunc_)) && !m32_osd_tryscript) OSD_Printf("%s\"%s\" is not a valid command or cvar\n", osd->draw.highlight, token); - else if (m32_osd_tryscript) - M32RunScript(cmd); Xfree(workbuf); return; @@ -2159,7 +2157,7 @@ int osdcmd_cvar_set(osdcmdptr_t parm) switch (pData.flags & (CVAR_RESTARTVID|CVAR_INVALIDATEALL|CVAR_INVALIDATEART)) { case CVAR_RESTARTVID: - osdcmd_restartvid(NULL); + //osdcmd_restartvid(NULL); break; case CVAR_INVALIDATEALL: gltexinvalidatetype(INVALIDATE_ALL); diff --git a/source/build/src/sdlayer.cpp b/source/build/src/sdlayer.cpp index d2ec2120f..93aff6dc4 100644 --- a/source/build/src/sdlayer.cpp +++ b/source/build/src/sdlayer.cpp @@ -39,6 +39,8 @@ static SDL_version linked; #endif +GameInterface* gi; + #if !defined STARTUP_SETUP_WINDOW int32_t startwin_open(void) { return 0; } int32_t startwin_close(void) { return 0; } @@ -46,6 +48,13 @@ int32_t startwin_puts(const char *s) { UNREFERENCED_PARAMETER(s); return 0; } int32_t startwin_idle(void *s) { UNREFERENCED_PARAMETER(s); return 0; } int32_t startwin_settitle(const char *s) { UNREFERENCED_PARAMETER(s); return 0; } int32_t startwin_run(void) { return 0; } +#else +int32_t startwin_open(void) { return gi->startwin_open(); } +int32_t startwin_close(void) { return gi->startwin_close(); } +int32_t startwin_puts(const char* s) { return gi->startwin_puts(s); } +int32_t startwin_idle(void* s) { return gi->startwin_idle(s); } +int32_t startwin_settitle(const char* s) { return gi->startwin_settitle(s); } +int32_t startwin_run(void) { return gi->startwin_run(); } #endif /// These can be useful for debugging sometimes... @@ -323,7 +332,7 @@ static void sighandler(int signum) // usleep(15000000); #endif attach_debugger_here(); - app_crashhandler(); + gi->app_crashhandler(); uninitsystem(); Bexit(8); } @@ -411,7 +420,7 @@ int main(int argc, char *argv[]) PHYSFS_init(buildargv[0]); PHYSFS_setWriteDir(PHYSFS_getBaseDir()); #endif - r = app_main(buildargc, (const char **)buildargv); + r = gi->app_main(buildargc, (const char **)buildargv); #else #ifdef USE_PHYSFS int pfsi = PHYSFS_init(argv[0]); diff --git a/source/build/src/winbits.cpp b/source/build/src/winbits.cpp index 284abafcf..a8fb87ef9 100644 --- a/source/build/src/winbits.cpp +++ b/source/build/src/winbits.cpp @@ -136,16 +136,6 @@ void win_allowtaskswitching(int32_t onf) } -// -// win_checkinstance() -- looks for another instance of a Build app -// -int32_t win_checkinstance(void) -{ - if (!instanceflag) return 0; - return (WaitForSingleObject(instanceflag,0) == WAIT_TIMEOUT); -} - - static void ToggleDesktopComposition(BOOL compEnable) { static HMODULE hDWMApiDLL = NULL; @@ -169,21 +159,6 @@ typedef void (*dllSetString)(const char*); // void win_open(void) { -#ifdef DEBUGGINGAIDS - HMODULE ebacktrace = LoadLibraryA(EBACKTRACEDLL); - if (ebacktrace) - { - dllSetString SetTechnicalName = (dllSetString) (void (*)(void))GetProcAddress(ebacktrace, "SetTechnicalName"); - dllSetString SetProperName = (dllSetString) (void (*)(void))GetProcAddress(ebacktrace, "SetProperName"); - - if (SetTechnicalName) - SetTechnicalName(AppTechnicalName); - - if (SetProperName) - SetProperName(AppProperName); - } -#endif - instanceflag = CreateSemaphore(NULL, 1,1, WindowClass); } diff --git a/source/duke3d/src/_functio.h b/source/duke3d/src/_functio.h index 0d51bb5bc..33fce5ab2 100644 --- a/source/duke3d/src/_functio.h +++ b/source/duke3d/src/_functio.h @@ -30,6 +30,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "_control.h" #include "control.h" +BEGIN_DUKE_NS + #ifndef function_private_h_ #define function_private_h_ @@ -280,6 +282,7 @@ static const char * mousedigitaldefaults[MAXMOUSEDIGITAL] = { }; +END_DUKE_NS #endif #endif diff --git a/source/duke3d/src/_rts.h b/source/duke3d/src/_rts.h index 21269c7ed..9c67343e8 100644 --- a/source/duke3d/src/_rts.h +++ b/source/duke3d/src/_rts.h @@ -26,6 +26,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "cache1d.h" #include "vfs.h" +BEGIN_DUKE_NS + //=============== // TYPES //=============== @@ -51,4 +53,6 @@ typedef struct char name[8]; } filelump_t; +END_DUKE_NS + #endif diff --git a/source/duke3d/src/actors.cpp b/source/duke3d/src/actors.cpp index 7244a01e3..6ec1fc257 100644 --- a/source/duke3d/src/actors.cpp +++ b/source/duke3d/src/actors.cpp @@ -26,6 +26,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "duke3d.h" +BEGIN_DUKE_NS + + #if KRANDDEBUG # define ACTOR_STATIC #else @@ -8575,3 +8578,5 @@ void G_MoveWorld(void) g_moveWorldTime = (1-0.033)*g_moveWorldTime + 0.033*(timerGetHiTicks()-worldTime); } + +END_DUKE_NS diff --git a/source/duke3d/src/actors.h b/source/duke3d/src/actors.h index 379cf72de..94a2340bc 100644 --- a/source/duke3d/src/actors.h +++ b/source/duke3d/src/actors.h @@ -24,6 +24,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define actors_h_ #include "player.h" +# include "namesdyn.h" + +BEGIN_DUKE_NS #define MAXSLEEPDIST 16384 #define SLEEPTIME 1536 @@ -514,8 +517,6 @@ ACTOR_INLINE int32_t A_MoveSprite(int const spriteNum, vec3_t const * const chan # endif -# include "namesdyn.h" - EXTERN_INLINE int G_CheckForSpaceCeiling(int const sectnum) { return ((sector[sectnum].ceilingstat&1) && sector[sectnum].ceilingpal == 0 && @@ -533,6 +534,8 @@ EXTERN_INLINE int A_CheckEnemySprite(void const * const pSprite) return A_CheckEnemyTile(((uspriteptr_t) pSprite)->picnum); } +END_DUKE_NS + #endif #endif diff --git a/source/duke3d/src/anim.cpp b/source/duke3d/src/anim.cpp index 465583904..2caa7c9b6 100644 --- a/source/duke3d/src/anim.cpp +++ b/source/duke3d/src/anim.cpp @@ -38,6 +38,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "vfs.h" +BEGIN_DUKE_NS + + // animsound_t.sound EDUKE32_STATIC_ASSERT(INT16_MAX >= MAXSOUNDS); @@ -582,3 +585,5 @@ end_anim: return !running; } + +END_DUKE_NS diff --git a/source/duke3d/src/anim.h b/source/duke3d/src/anim.h index 420ccc589..7b897ea57 100644 --- a/source/duke3d/src/anim.h +++ b/source/duke3d/src/anim.h @@ -26,6 +26,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "compat.h" #include "hash.h" +BEGIN_DUKE_NS + typedef struct { uint16_t frame; int16_t sound; @@ -49,4 +51,6 @@ extern dukeanim_t * Anim_Create(const char *fn); int32_t Anim_Play(const char *fn); void Anim_Init(void); +END_DUKE_NS + #endif diff --git a/source/duke3d/src/cheats.cpp b/source/duke3d/src/cheats.cpp index a7cc47563..48b28922a 100644 --- a/source/duke3d/src/cheats.cpp +++ b/source/duke3d/src/cheats.cpp @@ -26,6 +26,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "osdcmds.h" #include "cheats.h" +BEGIN_DUKE_NS + char CheatStrings [NUMCHEATS][MAXCHEATLEN] = { #ifndef EDUKE32_STANDALONE @@ -754,3 +756,5 @@ void G_DoCheats(void) } } } + +END_DUKE_NS diff --git a/source/duke3d/src/cheats.h b/source/duke3d/src/cheats.h index 563f9c4b3..385aa1c51 100644 --- a/source/duke3d/src/cheats.h +++ b/source/duke3d/src/cheats.h @@ -22,6 +22,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #pragma once +BEGIN_DUKE_NS + #define MAXCHEATLEN 20 #define MAXCHEATDESC 64 #define NUMCHEATCODES (int32_t) ARRAY_SIZE(CheatStrings) @@ -91,3 +93,5 @@ enum CheatCodeFunctions CHEATFUNC_DEBUG, NUMCHEATFUNCS, }; + +END_DUKE_NS diff --git a/source/duke3d/src/cmdline.cpp b/source/duke3d/src/cmdline.cpp index d0eb264bd..5084fc070 100644 --- a/source/duke3d/src/cmdline.cpp +++ b/source/duke3d/src/cmdline.cpp @@ -28,10 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "renderlayer.h" #include "cmdline.h" -#ifdef LUNATIC -char const * const * g_argv; -const char **g_elModules; -#endif +BEGIN_DUKE_NS int32_t g_commandSetup = 0; int32_t g_noSetup = 0; @@ -849,3 +846,5 @@ void G_CheckCommandLine(int32_t argc, char const * const * argv) } while (i < argc); } } + +END_DUKE_NS diff --git a/source/duke3d/src/cmdline.h b/source/duke3d/src/cmdline.h index cd3b18bcd..f273cd956 100644 --- a/source/duke3d/src/cmdline.h +++ b/source/duke3d/src/cmdline.h @@ -25,6 +25,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "compat.h" +BEGIN_DUKE_NS + + extern void G_CheckCommandLine(int32_t argc, char const * const * argv); extern void G_ShowParameterHelp(void); extern void G_ShowDebugHelp(void); @@ -38,4 +41,7 @@ extern const char *CommandMap; extern const char *CommandName; extern int32_t g_forceWeaponChoice; extern int32_t g_fakeMultiMode; + +END_DUKE_NS + #endif // cmdline_h__ diff --git a/source/duke3d/src/common.cpp b/source/duke3d/src/common.cpp index 54f587473..e084227ff 100644 --- a/source/duke3d/src/common.cpp +++ b/source/duke3d/src/common.cpp @@ -30,6 +30,9 @@ #include "common.h" #include "common_game.h" +BEGIN_DUKE_NS + + struct grpfile_t const *g_selectedGrp; int32_t g_gameType = GAMEFLAG_DUKE; @@ -247,6 +250,7 @@ static char g_rootDir[BMAX_PATH]; int g_useCwd; static void G_LoadAddon(void); int32_t g_groupFileHandle; +struct strllist* CommandPaths, * CommandGrps; void G_ExtPreInit(int32_t argc,char const * const * argv) { @@ -926,7 +930,6 @@ void G_CleanupSearchPaths(void) ////////// -struct strllist *CommandPaths, *CommandGrps; GrowArray g_scriptModules; @@ -1170,3 +1173,5 @@ void Duke_CommonCleanup(void) } #endif + +END_DUKE_NS diff --git a/source/duke3d/src/common_game.h b/source/duke3d/src/common_game.h index 3be771a64..7a25a161a 100644 --- a/source/duke3d/src/common_game.h +++ b/source/duke3d/src/common_game.h @@ -12,6 +12,9 @@ #include "vfs.h" +BEGIN_DUKE_NS + + extern int g_useCwd; #ifndef APPNAME @@ -123,8 +126,6 @@ extern void G_SetupGlobalPsky(void); ////////// -extern char g_modDir[BMAX_PATH]; -extern buildvfs_kfd kopen4loadfrommod(const char *filename, char searchfirst); extern void G_AddSearchPaths(void); extern void G_CleanupSearchPaths(void); @@ -153,4 +154,8 @@ extern buildvfs_kfd S_OpenAudio(const char *fn, char searchfirst, uint8_t ismusi # define S_OpenAudio(fn, searchfirst, ismusic) kopen4loadfrommod(fn, searchfirst) #endif +void G_AddGroup(const char* buffer); +void G_AddPath(const char* buffer); + +END_DUKE_NS #endif diff --git a/source/duke3d/src/config.cpp b/source/duke3d/src/config.cpp index 77b76b257..33ba88eb3 100644 --- a/source/duke3d/src/config.cpp +++ b/source/duke3d/src/config.cpp @@ -40,6 +40,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define __SETUP__ // JBF 20031211 #include "_functio.h" +BEGIN_DUKE_NS + + hashtable_t h_gamefuncs = { NUMGAMEFUNCTIONS<<1, NULL }; int32_t CONFIG_FunctionNameToNum(const char *func) @@ -906,8 +909,6 @@ void CONFIG_WriteSettings(void) // save binds and aliases to _settings. if (fp) { - buildvfs_fputstr(fp, "// this file is automatically generated by "); - buildvfs_fputstrptr(fp, AppProperName); buildvfs_fputstr(fp,"\nunbindall\n"); for (int i=0; i UPDATEINTERVAL) - { - initprintf("Checking for updates...\n"); - - ud.config.LastUpdateCheck = time(NULL); - - if (G_GetVersionFromWebsite(tempbuf)) - { - initprintf("Current version is %d",Batoi(tempbuf)); - - if (Batoi(tempbuf) > atoi(s_buildDate)) - { - if (wm_ynbox("EDuke32","A new version of EDuke32 is available. " - "Browse to http://www.eduke32.com now?")) - { - SHELLEXECUTEINFOA sinfo; - char const *p = "http://www.eduke32.com"; - - Bmemset(&sinfo, 0, sizeof(sinfo)); - sinfo.cbSize = sizeof(sinfo); - sinfo.fMask = SEE_MASK_CLASSNAME; - sinfo.lpVerb = "open"; - sinfo.lpFile = p; - sinfo.nShow = SW_SHOWNORMAL; - sinfo.lpClass = "http"; - - if (!ShellExecuteExA(&sinfo)) - initprintf("update: error launching browser!\n"); - } - } - else initprintf("... no updates available\n"); - } - else initprintf("update: failed to check for updates\n"); - } - } -#endif - if (enginePreInit()) { wm_msgbox("Build Engine Initialization Error", @@ -6518,7 +6467,7 @@ int app_main(int argc, char const * const * argv) #ifdef STARTUP_SETUP_WINDOW if (readSetup < 0 || (!g_noSetup && (ud.configversion != BYTEVERSION_EDUKE32 || ud.setup.forcesetup)) || g_commandSetup) { - if (quitevent || !startwin_run()) + if (quitevent || !gi->startwin_run()) { engineUnInit(); Bexit(0); @@ -7398,3 +7347,27 @@ static void G_SetupGameButtons(void) CONTROL_DefineFlag(gamefunc_Third_Person_View, FALSE); CONTROL_DefineFlag(gamefunc_Toggle_Crouch, FALSE); } + +extern void faketimerhandler(); +extern int app_main(int argc, char const* const* argv); +extern void app_crashhandler(void); +extern int32_t startwin_open(void); +extern int32_t startwin_close(void); +extern int32_t startwin_puts(const char*); +extern int32_t startwin_settitle(const char*); +extern int32_t startwin_idle(void*); +extern int32_t startwin_run(void); + +GameInterface Interface = { + faketimerhandler, + app_main, + app_crashhandler, + startwin_open, + startwin_close, + startwin_puts, + startwin_settitle, + startwin_idle, + startwin_run +}; + +END_DUKE_NS diff --git a/source/duke3d/src/game.h b/source/duke3d/src/game.h index 820958edc..62f90867d 100644 --- a/source/duke3d/src/game.h +++ b/source/duke3d/src/game.h @@ -35,6 +35,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "mmulti.h" #include "network.h" +BEGIN_DUKE_NS #ifndef ONLY_USERDEFS @@ -636,4 +637,6 @@ EXTERN_INLINE void SetIfGreater(int32_t *variable, int32_t potentialValue) #endif +END_DUKE_NS + #endif diff --git a/source/duke3d/src/gamedef.cpp b/source/duke3d/src/gamedef.cpp index 7d813f916..729323643 100644 --- a/source/duke3d/src/gamedef.cpp +++ b/source/duke3d/src/gamedef.cpp @@ -37,6 +37,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "vfs.h" +BEGIN_DUKE_NS + #define LINE_NUMBER (g_lineNumber << 12) int32_t g_scriptVersion = 13; // 13 = 1.3D-style CON files, 14 = 1.4/1.5 style CON files @@ -6480,3 +6482,5 @@ void C_ReportError(int error) } } #endif + +END_DUKE_NS diff --git a/source/duke3d/src/gamedef.h b/source/duke3d/src/gamedef.h index 04f163d70..3d36f8107 100644 --- a/source/duke3d/src/gamedef.h +++ b/source/duke3d/src/gamedef.h @@ -30,6 +30,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "cheats.h" #include "common.h" // tokenlist #include "player.h" // projectile_t +#include "events_defs.h" + + +BEGIN_DUKE_NS enum { @@ -81,7 +85,6 @@ void VM_ScriptInfo(intptr_t const * const ptr, int const range); extern hashtable_t h_gamefuncs; -#if !defined LUNATIC extern hashtable_t h_gamevars; extern hashtable_t h_arrays; extern hashtable_t h_labels; @@ -121,9 +124,7 @@ enum QuickStructureAccess_t extern int32_t g_structVarIDs; -#include "events_defs.h" extern intptr_t apScriptEvents[MAXEVENTS]; -#endif extern char g_scriptFileName[BMAX_PATH]; @@ -1400,4 +1401,6 @@ enum ScriptKeywords_t #endif +END_DUKE_NS + #endif // gamedef_h_ diff --git a/source/duke3d/src/gamedefs.h b/source/duke3d/src/gamedefs.h index 2d105bf63..0865022ca 100644 --- a/source/duke3d/src/gamedefs.h +++ b/source/duke3d/src/gamedefs.h @@ -51,15 +51,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // default joystick settings -#if defined(GEKKO) -#define DEFAULTJOYSTICKANALOGUESCALE 16384 -#define DEFAULTJOYSTICKANALOGUEDEAD 1000 -#define DEFAULTJOYSTICKANALOGUESATURATE 9500 -#else #define DEFAULTJOYSTICKANALOGUESCALE 65536 #define DEFAULTJOYSTICKANALOGUEDEAD 2000 #define DEFAULTJOYSTICKANALOGUESATURATE 9500 -#endif #endif diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index d53a566f4..8742efefa 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -36,6 +36,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "vfs.h" +BEGIN_DUKE_NS + #if KRANDDEBUG # define GAMEEXEC_INLINE # define GAMEEXEC_STATIC @@ -6869,3 +6871,5 @@ void VM_DrawTileSmall(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int3 } #endif + +END_DUKE_NS diff --git a/source/duke3d/src/gameexec.h b/source/duke3d/src/gameexec.h index 72926cb42..c57c40a9b 100644 --- a/source/duke3d/src/gameexec.h +++ b/source/duke3d/src/gameexec.h @@ -28,6 +28,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "gamedef.h" // vmstate_t #include "sector.h" // mapstate_t +BEGIN_DUKE_NS + int32_t VM_ExecuteEvent(int const nEventID, int const spriteNum, int const playerNum, int const nDist, int32_t const nReturn); int32_t VM_ExecuteEvent(int const nEventID, int const spriteNum, int const playerNum, int const nDist); int32_t VM_ExecuteEvent(int const nEventID, int const spriteNum, int const playerNum); @@ -119,4 +121,6 @@ int G_StartTrack(int levelNum); void VM_UpdateAnim(int const spriteNum, int32_t * const pData); void VM_GetZRange(int const spriteNum, int32_t * const ceilhit, int32_t * const florhit, int const wallDist); +END_DUKE_NS + #endif diff --git a/source/duke3d/src/gamevars.cpp b/source/duke3d/src/gamevars.cpp index 4172bead6..ca2657916 100644 --- a/source/duke3d/src/gamevars.cpp +++ b/source/duke3d/src/gamevars.cpp @@ -28,6 +28,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "vfs.h" +BEGIN_DUKE_NS + #define gamevars_c_ #ifdef LUNATIC @@ -1473,3 +1475,5 @@ void Gv_RefreshPointers(void) aGameArrays[Gv_GetArrayIndex("tilesizy")].pValues = (intptr_t *)&tilesiz[0].y; } #endif + +END_DUKE_NS diff --git a/source/duke3d/src/gamevars.h b/source/duke3d/src/gamevars.h index fa384da44..8deb7adce 100644 --- a/source/duke3d/src/gamevars.h +++ b/source/duke3d/src/gamevars.h @@ -28,6 +28,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "vfs.h" +BEGIN_DUKE_NS + + #define MAXGAMEVARS 2048 // must be a power of two #define MAXVARLABEL 26 @@ -297,4 +300,6 @@ VM_GAMEVAR_OPERATOR(Gv_ShiftVarR, >>=) #endif +END_DUKE_NS + #endif diff --git a/source/duke3d/src/global.cpp b/source/duke3d/src/global.cpp index 8c059db4a..ec8041631 100644 --- a/source/duke3d/src/global.cpp +++ b/source/duke3d/src/global.cpp @@ -26,6 +26,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "global.h" #include "duke3d.h" +BEGIN_DUKE_NS + + user_defs ud; const char *s_buildDate = "20120522"; @@ -133,3 +136,5 @@ char CheatKeys[2] = { sc_D, sc_N }; char g_setupFileName[BMAX_PATH] = SETUPFILENAME; + +END_DUKE_NS diff --git a/source/duke3d/src/global.h b/source/duke3d/src/global.h index d3bc6cbd5..979b01e69 100644 --- a/source/duke3d/src/global.h +++ b/source/duke3d/src/global.h @@ -31,6 +31,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "sector.h" #include "sounds.h" +BEGIN_DUKE_NS + #ifdef global_c_ #define G_EXTERN #else @@ -221,4 +223,7 @@ EXTERN_INLINE void G_RestoreInterpolations(void) //Stick at end of drawscreen #endif +END_DUKE_NS + + #endif diff --git a/source/duke3d/src/grpscan.cpp b/source/duke3d/src/grpscan.cpp index c9a9ca876..5f465eddf 100644 --- a/source/duke3d/src/grpscan.cpp +++ b/source/duke3d/src/grpscan.cpp @@ -33,6 +33,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "vfs.h" +BEGIN_DUKE_NS + #ifndef EDUKE32_STANDALONE static void process_vaca13(int32_t crcval); static void process_vacapp15(int32_t crcval); @@ -683,3 +685,5 @@ static void process_vacapp15(int32_t crcval) initgroupfile("VACATION.PRG"); } #endif + +END_DUKE_NS diff --git a/source/duke3d/src/grpscan.h b/source/duke3d/src/grpscan.h index d3761e274..c5d453f75 100644 --- a/source/duke3d/src/grpscan.h +++ b/source/duke3d/src/grpscan.h @@ -23,6 +23,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #ifndef grpscan_h_ #define grpscan_h_ +BEGIN_DUKE_NS + #define MAXLISTNAMELEN 32 // List of internally-known GRP files @@ -97,4 +99,6 @@ extern grpfile_t * FindGroup(int32_t crcval); int32_t ScanGroups(void); void FreeGroups(void); +END_DUKE_NS + #endif diff --git a/source/duke3d/src/input.cpp b/source/duke3d/src/input.cpp index 50cb303e6..1958f2846 100644 --- a/source/duke3d/src/input.cpp +++ b/source/duke3d/src/input.cpp @@ -32,6 +32,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "input.h" #include "menus.h" +BEGIN_DUKE_NS + + int32_t I_CheckAllInput(void) { return @@ -403,3 +406,5 @@ int32_t I_EnterText(char *t, int32_t maxlength, int32_t flags) return 0; } + +END_DUKE_NS diff --git a/source/duke3d/src/input.h b/source/duke3d/src/input.h index aff5fff67..fe9bab2cd 100644 --- a/source/duke3d/src/input.h +++ b/source/duke3d/src/input.h @@ -23,6 +23,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #ifndef input_h_ #define input_h_ +BEGIN_DUKE_NS + + extern int32_t I_CheckAllInput(void); extern void I_ClearAllInput(void); @@ -66,4 +69,6 @@ enum EnterTextFlags_t { extern int32_t I_EnterText(char *t, int32_t maxlength, int32_t flags); +END_DUKE_NS + #endif diff --git a/source/duke3d/src/inv.h b/source/duke3d/src/inv.h index 0a9e563b5..e85b9f1d0 100644 --- a/source/duke3d/src/inv.h +++ b/source/duke3d/src/inv.h @@ -22,6 +22,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #pragma once +BEGIN_DUKE_NS + enum dukeinv_t { GET_STEROIDS, // 0 @@ -72,3 +74,5 @@ enum dukeweapon_t GROW_WEAPON, MAX_WEAPONS }; + +END_DUKE_NS diff --git a/source/duke3d/src/keys.h b/source/duke3d/src/keys.h index 78074008b..90fede7cd 100644 --- a/source/duke3d/src/keys.h +++ b/source/duke3d/src/keys.h @@ -24,6 +24,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define KEYS_H +BEGIN_DUKE_NS + #define NUM_CODES 128 #define ESC 0x1B @@ -145,4 +147,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define asc_Enter 13 #define asc_Space 32 +END_DUKE_NS + #endif diff --git a/source/duke3d/src/macros.h b/source/duke3d/src/macros.h index a0cfb8977..cd38645b2 100644 --- a/source/duke3d/src/macros.h +++ b/source/duke3d/src/macros.h @@ -25,6 +25,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "mmulti.h" +BEGIN_DUKE_NS + + // Macros, some from SW source #define BGSTRETCH (ud.bgstretch ? 1024 : 0) @@ -193,4 +196,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define T5(i) actor[i].t_data[4] #define T6(i) actor[i].t_data[5] +END_DUKE_NS + #endif diff --git a/source/duke3d/src/mdump.cpp b/source/duke3d/src/mdump.cpp index 8c03c014e..a4aec60c2 100644 --- a/source/duke3d/src/mdump.cpp +++ b/source/duke3d/src/mdump.cpp @@ -4,6 +4,9 @@ #include "mdump.h" #include + +BEGIN_DUKE_NS + LPCSTR MiniDumper::m_szAppName; MiniDumper g_dumper("eduke32"); @@ -96,3 +99,5 @@ LONG MiniDumper::TopLevelFilter(struct _EXCEPTION_POINTERS *pExceptionInfo) return retval; } + +END_DUKE_NS diff --git a/source/duke3d/src/mdump.h b/source/duke3d/src/mdump.h index c76db7c8e..be6463b55 100644 --- a/source/duke3d/src/mdump.h +++ b/source/duke3d/src/mdump.h @@ -3,6 +3,8 @@ #define NEED_MMSYSTEM_H #include "windows_inc.h" +BEGIN_DUKE_NS + // based on dbghelp.h typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType, CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, @@ -20,3 +22,5 @@ private: public: MiniDumper( LPCSTR szAppName ); }; + +END_DUKE_NS diff --git a/source/duke3d/src/menus.cpp b/source/duke3d/src/menus.cpp index 40ed33a12..8e14f9b9e 100644 --- a/source/duke3d/src/menus.cpp +++ b/source/duke3d/src/menus.cpp @@ -32,6 +32,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "savegame.h" #include "xxhash.h" +BEGIN_DUKE_NS + + // common positions #define MENU_MARGIN_REGULAR 40 #define MENU_MARGIN_WIDE 32 @@ -7236,3 +7239,4 @@ void M_DisplayMenus(void) CAMERADIST = 65536; } } +END_DUKE_NS diff --git a/source/duke3d/src/menus.h b/source/duke3d/src/menus.h index df807f8a8..62af1301c 100644 --- a/source/duke3d/src/menus.h +++ b/source/duke3d/src/menus.h @@ -25,6 +25,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "compat.h" +BEGIN_DUKE_NS + enum MenuIndex_t { MENU_NULL = INT32_MIN, // sentinel for "do nothing" MENU_CLOSE = -2, // sentinel for "close the menu"/"no menu" @@ -516,4 +518,6 @@ extern MenuGameplayStemEntry g_MenuGameplayEntries[MAXMENUGAMEPLAYENTRIES]; extern MenuEntry_t ME_NEWGAMECUSTOMENTRIES[MAXMENUGAMEPLAYENTRIES]; extern MenuEntry_t ME_NEWGAMECUSTOMSUBENTRIES[MAXMENUGAMEPLAYENTRIES][MAXMENUGAMEPLAYENTRIES]; +END_DUKE_NS + #endif diff --git a/source/duke3d/src/namesdyn.cpp b/source/duke3d/src/namesdyn.cpp index 0f6675692..ac381ca07 100644 --- a/source/duke3d/src/namesdyn.cpp +++ b/source/duke3d/src/namesdyn.cpp @@ -28,6 +28,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "namesdyn.h" #include "global.h" +BEGIN_DUKE_NS + #ifdef DYNTILEREMAP_ENABLE # define DVPTR(x) &x #else @@ -1318,3 +1320,4 @@ void G_InitDynamicTiles(void) MENUSCREEN = LOADSCREEN = BETASCREEN; #endif } +END_DUKE_NS diff --git a/source/duke3d/src/namesdyn.h b/source/duke3d/src/namesdyn.h index 0a1b5a88b..c87b2e06a 100644 --- a/source/duke3d/src/namesdyn.h +++ b/source/duke3d/src/namesdyn.h @@ -23,6 +23,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #ifndef namesdyn_h__ #define namesdyn_h__ +BEGIN_DUKE_NS + #define DYNTILEREMAP_ENABLE @@ -1245,4 +1247,7 @@ extern int32_t XXXSTACY; #define DYNAMICTILEMAP(Tilenum) (Tilenum) #endif + +END_DUKE_NS + #endif // namesdyn_h__ diff --git a/source/duke3d/src/network.cpp b/source/duke3d/src/network.cpp index e2749698b..b2a85c084 100644 --- a/source/duke3d/src/network.cpp +++ b/source/duke3d/src/network.cpp @@ -43,6 +43,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "vfs.h" +BEGIN_DUKE_NS + // Data needed even if netcode is disabled ENetHost *g_netServer = NULL; ENetHost *g_netClient = NULL; @@ -5251,3 +5253,4 @@ void Net_NotifyNewGame() #endif //------------------------------------------------------------------------------------------------- +END_DUKE_NS diff --git a/source/duke3d/src/network.h b/source/duke3d/src/network.h index 79c33214a..a6f7169db 100644 --- a/source/duke3d/src/network.h +++ b/source/duke3d/src/network.h @@ -33,6 +33,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "enet/enet.h" +BEGIN_DUKE_NS + // net packet specification/compatibility version #define NETVERSION 1 @@ -348,4 +350,6 @@ void Net_WaitForInitialSnapshot(); #endif +END_DUKE_NS + #endif // netplay_h_ diff --git a/source/duke3d/src/osdcmds.cpp b/source/duke3d/src/osdcmds.cpp index f474ec03a..c6260882c 100644 --- a/source/duke3d/src/osdcmds.cpp +++ b/source/duke3d/src/osdcmds.cpp @@ -34,6 +34,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "vfs.h" +BEGIN_DUKE_NS + + struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat; float r_ambientlight = 1.0, r_ambientlightrecip = 1.0; @@ -1814,3 +1817,4 @@ int32_t registerosdcommands(void) return 0; } +END_DUKE_NS diff --git a/source/duke3d/src/osdcmds.h b/source/duke3d/src/osdcmds.h index ea91ed91b..feb89f495 100644 --- a/source/duke3d/src/osdcmds.h +++ b/source/duke3d/src/osdcmds.h @@ -23,6 +23,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #ifndef osdcmds_h_ #define osdcmds_h_ +BEGIN_DUKE_NS + struct osdcmd_cheatsinfo { int32_t cheatnum; // -1 = none, else = see DoCheats() int32_t volume,level; @@ -39,5 +41,7 @@ extern const char *const ConsoleButtons[]; extern uint32_t cl_cheatmask; +END_DUKE_NS + #endif // osdcmds_h_ diff --git a/source/duke3d/src/osdfuncs.cpp b/source/duke3d/src/osdfuncs.cpp index 171c3d133..293c147d4 100644 --- a/source/duke3d/src/osdfuncs.cpp +++ b/source/duke3d/src/osdfuncs.cpp @@ -30,6 +30,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "osdfuncs.h" #include "premap.h" +BEGIN_DUKE_NS + int osdhightile = 1; int osdshown = 0; @@ -172,3 +174,5 @@ void GAME_clearbackground(int numcols, int numrows) } #undef OSD_SCALE + +END_DUKE_NS diff --git a/source/duke3d/src/osdfuncs.h b/source/duke3d/src/osdfuncs.h index 4450970e4..e225fb424 100644 --- a/source/duke3d/src/osdfuncs.h +++ b/source/duke3d/src/osdfuncs.h @@ -20,6 +20,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ //------------------------------------------------------------------------- +BEGIN_DUKE_NS + void GAME_drawosdchar(int32_t x, int32_t y, char ch, int32_t shade, int32_t pal); void GAME_drawosdstr(int32_t x, int32_t y, const char *ch, int32_t len, int32_t shade, int32_t pal); void GAME_drawosdcursor(int32_t x, int32_t y, int32_t type, int32_t lastkeypress); @@ -31,3 +33,5 @@ void GAME_clearbackground(int32_t numcols, int32_t numrows); extern int osdhightile; extern int osdshown; extern float osdscale, osdrscale; + +END_DUKE_NS diff --git a/source/duke3d/src/player.cpp b/source/duke3d/src/player.cpp index e77253d96..2d4f2aeb1 100644 --- a/source/duke3d/src/player.cpp +++ b/source/duke3d/src/player.cpp @@ -25,6 +25,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "duke3d.h" #include "demo.h" #include "enet/enet.h" +#include "sjson.h" + +BEGIN_DUKE_NS + int32_t lastvisinc; hudweapon_t hudweap; @@ -5620,7 +5624,6 @@ RECHECK: } -#include "sjson.h" int portableBackupSave(const char * path, const char * name, int volume, int level) { @@ -5740,3 +5743,4 @@ int portableBackupSave(const char * path, const char * name, int volume, int lev return 0; } +END_DUKE_NS diff --git a/source/duke3d/src/player.h b/source/duke3d/src/player.h index 05b64e450..0997ca683 100644 --- a/source/duke3d/src/player.h +++ b/source/duke3d/src/player.h @@ -26,6 +26,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "build.h" #include "inv.h" +BEGIN_DUKE_NS + + extern int32_t g_mostConcurrentPlayers; #define MOVEFIFOSIZ 2 @@ -409,4 +412,6 @@ static inline int P_Get(int32_t spriteNum) { return P_GetP((uspriteptr_t)&sprite extern int portableBackupSave(const char *, const char *, int, int); +END_DUKE_NS + #endif diff --git a/source/duke3d/src/premap.cpp b/source/duke3d/src/premap.cpp index c35cd9993..dda4a093f 100644 --- a/source/duke3d/src/premap.cpp +++ b/source/duke3d/src/premap.cpp @@ -31,6 +31,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "vfs.h" +BEGIN_DUKE_NS + static uint8_t precachehightile[2][(MAXTILES+7)>>3]; static int32_t g_precacheCount; @@ -2105,3 +2107,4 @@ void G_FreeMapState(int levelNum) ALIGNED_FREE_AND_NULL(board.savedstate); } +END_DUKE_NS diff --git a/source/duke3d/src/premap.h b/source/duke3d/src/premap.h index 73bb59f8d..b7f2c1dc6 100644 --- a/source/duke3d/src/premap.h +++ b/source/duke3d/src/premap.h @@ -23,6 +23,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #ifndef premap_h_ #define premap_h_ +BEGIN_DUKE_NS + extern int32_t g_levelTextTime; extern int32_t voting,vote_map,vote_episode; extern palette_t CrosshairColors; @@ -45,4 +47,6 @@ void G_ClearFIFO(void); void G_ResetInterpolations(void); int fragbarheight(void); +END_DUKE_NS + #endif diff --git a/source/duke3d/src/rts.cpp b/source/duke3d/src/rts.cpp index 25202c428..e0eab531d 100644 --- a/source/duke3d/src/rts.cpp +++ b/source/duke3d/src/rts.cpp @@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "vfs.h" +BEGIN_DUKE_NS static int32_t rts_numlumps; static void **rts_lumpcache; @@ -172,3 +173,5 @@ void *RTS_GetSound(int32_t lump) return rts_lumpcache[lump]; } + +END_DUKE_NS diff --git a/source/duke3d/src/rts.h b/source/duke3d/src/rts.h index d4e8c193b..5d9444cd6 100644 --- a/source/duke3d/src/rts.h +++ b/source/duke3d/src/rts.h @@ -29,6 +29,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #ifndef rts_public_ #define rts_public_ +BEGIN_DUKE_NS + + extern char rts_lumplockbyte[11]; /* Files with a .rts extension are idlink files with multiple lumps */ @@ -41,4 +44,6 @@ int32_t RTS_SoundLength(int32_t lump); void *RTS_GetSound(int32_t lump); +END_DUKE_NS + #endif diff --git a/source/duke3d/src/savegame.cpp b/source/duke3d/src/savegame.cpp index 7f82b0caf..3c14294bf 100644 --- a/source/duke3d/src/savegame.cpp +++ b/source/duke3d/src/savegame.cpp @@ -26,9 +26,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "premap.h" #include "prlights.h" #include "savegame.h" +#include "sjson.h" #include "vfs.h" +BEGIN_DUKE_NS + + static OutputFileCounter savecounter; // For storing pointers in files. @@ -354,7 +358,6 @@ static void sv_postudload(); // hack static int different_user_map; -#include "sjson.h" // XXX: keyboard input 'blocked' after load fail? (at least ESC?) int32_t G_LoadPlayer(savebrief_t & sv) @@ -2580,3 +2583,4 @@ static void postloadplayer(int32_t savegamep) } ////////// END GENERIC SAVING/LOADING SYSTEM ////////// +END_DUKE_NS diff --git a/source/duke3d/src/savegame.h b/source/duke3d/src/savegame.h index eb7d29054..d5cd12ab5 100644 --- a/source/duke3d/src/savegame.h +++ b/source/duke3d/src/savegame.h @@ -27,6 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "vfs.h" +BEGIN_DUKE_NS + #ifdef LUNATIC # define SV_MAJOR_VER 2 @@ -152,4 +154,6 @@ enum void G_Util_PtrToIdx(void *ptr, int32_t count, const void *base, int32_t mode); void G_Util_PtrToIdx2(void *ptr, int32_t count, size_t stride, const void *base, int32_t mode); +END_DUKE_NS + #endif diff --git a/source/duke3d/src/sbar.cpp b/source/duke3d/src/sbar.cpp index 9300d5a51..963119f68 100644 --- a/source/duke3d/src/sbar.cpp +++ b/source/duke3d/src/sbar.cpp @@ -26,6 +26,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "compat.h" #include "sbar.h" +BEGIN_DUKE_NS + + int32_t althud_flashing = 1; int32_t althud_numbertile = 2930; int32_t althud_numberpal = 0; @@ -1144,3 +1147,4 @@ void G_DrawBackground(void) pus = pub = NUMPAGES; } +END_DUKE_NS diff --git a/source/duke3d/src/sbar.h b/source/duke3d/src/sbar.h index aef64b6aa..0651d488d 100644 --- a/source/duke3d/src/sbar.h +++ b/source/duke3d/src/sbar.h @@ -22,6 +22,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #pragma once +BEGIN_DUKE_NS + extern int32_t althud_flashing; extern int32_t althud_numberpal; extern int32_t althud_numbertile; @@ -36,3 +38,5 @@ int32_t sbarx16(int32_t x); int32_t sbary16(int32_t y); void G_DrawInventory(const DukePlayer_t *p); void G_DrawStatusBar(int32_t snum); + +END_DUKE_NS diff --git a/source/duke3d/src/screens.cpp b/source/duke3d/src/screens.cpp index e1b883edf..25f76c9b6 100644 --- a/source/duke3d/src/screens.cpp +++ b/source/duke3d/src/screens.cpp @@ -32,6 +32,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "sbar.h" #include "screens.h" +BEGIN_DUKE_NS + #define COLOR_RED redcol #define COLOR_WHITE whitecol @@ -712,6 +714,7 @@ static void G_ShowCacheLocks(void) int k = 0; +/* #if !defined DEBUG_ALLOCACHE_AS_MALLOC for (int i=cacnum-1; i>=0; i--) { @@ -726,6 +729,7 @@ static void G_ShowCacheLocks(void) } } #endif +*/ if (k < ydim-12) k += 6; @@ -2588,3 +2592,4 @@ void G_BonusScreen(int32_t bonusonly) } while (1); } +END_DUKE_NS diff --git a/source/duke3d/src/screens.h b/source/duke3d/src/screens.h index 7dff4ba83..beea34478 100644 --- a/source/duke3d/src/screens.h +++ b/source/duke3d/src/screens.h @@ -20,6 +20,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ //------------------------------------------------------------------------- +BEGIN_DUKE_NS + extern void G_DisplayExtraScreens(void); extern void G_DisplayLogo(void); extern void G_DoOrderScreen(void); @@ -44,3 +46,5 @@ extern int32_t dr_yxaspect, dr_viewingrange; extern int32_t g_noLogoAnim, g_noLogo; extern void G_FadePalette(int32_t r, int32_t g, int32_t b, int32_t e); + +END_DUKE_NS diff --git a/source/duke3d/src/screentext.cpp b/source/duke3d/src/screentext.cpp index 16b89be25..47be7e7fe 100644 --- a/source/duke3d/src/screentext.cpp +++ b/source/duke3d/src/screentext.cpp @@ -27,6 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "sbar.h" #include "menus.h" +BEGIN_DUKE_NS + // get the string length until the next '\n' int32_t G_GetStringLineLength(const char *text, const char *end, const int32_t iter) { @@ -1163,3 +1165,4 @@ void P_DoQuote(int32_t q, DukePlayer_t *p) pub = NUMPAGES; pus = NUMPAGES; } +END_DUKE_NS diff --git a/source/duke3d/src/screentext.h b/source/duke3d/src/screentext.h index b18bfc15f..951796631 100644 --- a/source/duke3d/src/screentext.h +++ b/source/duke3d/src/screentext.h @@ -24,6 +24,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "menus.h" +BEGIN_DUKE_NS + + #define MAXUSERQUOTES 6 extern int32_t user_quote_time[MAXUSERQUOTES]; @@ -93,3 +96,4 @@ extern void G_AddCoordsFromRotation(vec2_t *coords, const vec2_t *unitDirection, extern vec2_t G_ScreenText(int32_t font, int32_t x, int32_t y, int32_t z, int32_t blockangle, int32_t charangle, const char *str, int32_t shade, int32_t pal, int32_t o, int32_t alpha, int32_t xspace, int32_t yline, int32_t xbetween, int32_t ybetween, int32_t f, int32_t x1, int32_t y1, int32_t x2, int32_t y2); extern vec2_t G_ScreenTextShadow(int32_t sx, int32_t sy, int32_t font, int32_t x, int32_t y, int32_t z, int32_t blockangle, int32_t charangle, const char *str, int32_t shade, int32_t pal, int32_t o, int32_t alpha, int32_t xspace, int32_t yline, int32_t xbetween, int32_t ybetween, int32_t f, int32_t x1, int32_t y1, int32_t x2, int32_t y2); +END_DUKE_NS diff --git a/source/duke3d/src/sector.cpp b/source/duke3d/src/sector.cpp index aebae6462..c1dc1b8d4 100644 --- a/source/duke3d/src/sector.cpp +++ b/source/duke3d/src/sector.cpp @@ -27,6 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "duke3d.h" #include "input.h" +BEGIN_DUKE_NS + // PRIMITIVE static int g_haltSoundHack = 0; @@ -3446,3 +3448,4 @@ void P_CheckSectors(int playerNum) } } +END_DUKE_NS diff --git a/source/duke3d/src/sector.h b/source/duke3d/src/sector.h index 85c0ae998..031ac2a4a 100644 --- a/source/duke3d/src/sector.h +++ b/source/duke3d/src/sector.h @@ -29,6 +29,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "namesdyn.h" // for G_GetForcefieldPicnum() #include "player.h" // playerspawn_t +BEGIN_DUKE_NS + #define MAXCYCLERS 1024 #define MAXANIMATES 1024 #define MAXANIMWALLS 512 @@ -180,4 +182,6 @@ EXTERN_INLINE int32_t G_CheckPlayerInSector(int32_t const sect) #endif +END_DUKE_NS + #endif diff --git a/source/duke3d/src/sounds.cpp b/source/duke3d/src/sounds.cpp index 3e390495b..54d0dd375 100644 --- a/source/duke3d/src/sounds.cpp +++ b/source/duke3d/src/sounds.cpp @@ -30,6 +30,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "vfs.h" +BEGIN_DUKE_NS + + #define DQSIZE 256 int32_t g_numEnvSoundsPlaying, g_highestSoundIdx; @@ -1036,3 +1039,4 @@ int S_CheckSoundPlaying(int soundNum) if (EDUKE32_PREDICT_FALSE((unsigned)soundNum > (unsigned)g_highestSoundIdx)) return false; return (g_sounds[soundNum].num != 0); } +END_DUKE_NS diff --git a/source/duke3d/src/sounds.h b/source/duke3d/src/sounds.h index 1eae0d1fe..f8f9565db 100644 --- a/source/duke3d/src/sounds.h +++ b/source/duke3d/src/sounds.h @@ -31,6 +31,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "sounds_common.h" +BEGIN_DUKE_NS + // KEEPINSYNC lunatic/con_lang.lua #define MAXSOUNDS 4096 #define MAXSOUNDINSTANCES 8 @@ -97,4 +99,6 @@ static inline bool S_IsAmbientSFX(int spriteNum) return (sprite[spriteNum].picnum == MUSICANDSFX && sprite[spriteNum].lotag < 999); } +END_DUKE_NS + #endif diff --git a/source/duke3d/src/soundsdyn.cpp b/source/duke3d/src/soundsdyn.cpp index db2c9fdef..1d1218360 100644 --- a/source/duke3d/src/soundsdyn.cpp +++ b/source/duke3d/src/soundsdyn.cpp @@ -30,6 +30,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "soundsdyn.h" #include "global.h" +BEGIN_DUKE_NS + #ifdef DYNSOUNDREMAP_ENABLE # define DVPTR(x) &x #else @@ -378,3 +380,4 @@ void G_InitDynamicSounds(void) #endif } +END_DUKE_NS diff --git a/source/duke3d/src/soundsdyn.h b/source/duke3d/src/soundsdyn.h index 9058d8d8d..72e65da91 100644 --- a/source/duke3d/src/soundsdyn.h +++ b/source/duke3d/src/soundsdyn.h @@ -22,6 +22,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #ifndef soundsdyn_h__ #define soundsdyn_h__ +BEGIN_DUKE_NS + #define DYNSOUNDREMAP_ENABLE @@ -330,4 +332,7 @@ extern int32_t WIND_REPEAT; #define DYNAMICSOUNDMAP(Soundnum) (Soundnum) #endif + +END_DUKE_NS + #endif // soundsdyn_h__ diff --git a/source/duke3d/src/startgtk.game.cpp b/source/duke3d/src/startgtk.game.cpp index 4cdb7cf3e..f21b92a4f 100644 --- a/source/duke3d/src/startgtk.game.cpp +++ b/source/duke3d/src/startgtk.game.cpp @@ -33,6 +33,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "grpscan.h" #include "gtkpixdata.h" +BEGIN_DUKE_NS + enum { NONE, @@ -884,3 +886,4 @@ int32_t startwin_run(void) return retval; } +END_DUKE_NS diff --git a/source/duke3d/src/startwin.game.cpp b/source/duke3d/src/startwin.game.cpp index bff547289..534d539fe 100644 --- a/source/duke3d/src/startwin.game.cpp +++ b/source/duke3d/src/startwin.game.cpp @@ -49,6 +49,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "startwin.game.h" #include "windows_inc.h" +BEGIN_DUKE_NS + + #define TAB_CONFIG 0 #define TAB_MESSAGES 1 @@ -714,4 +717,8 @@ int32_t startwin_run(void) return done; } +END_DUKE_NS + #endif // STARTUP_SETUP_WINDOW + + diff --git a/source/duke3d/src/winbits.cpp b/source/duke3d/src/winbits.cpp deleted file mode 100644 index 851ffa093..000000000 --- a/source/duke3d/src/winbits.cpp +++ /dev/null @@ -1,133 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ -//------------------------------------------------------------------------- - -#include "ns.h" // Must come before everything else! - -#ifdef _WIN32 - -#include "compat.h" - -#define NEED_SHELLAPI_H -#define NEED_WINSOCK2_H -#define NEED_WS2TCPIP_H -#include "windows_inc.h" - -#include "renderlayer.h" - -int32_t G_GetVersionFromWebsite(char *buffer) -{ - static int32_t wsainitialized = 0; - int32_t i=0, j=0, r=0; - struct sockaddr_in dest_addr; - struct hostent *h; - char const *host = "www.eduke32.com"; - char const *req = "GET http://www.eduke32.com/VERSION HTTP/1.0\r\n\r\n\r\n"; - char *tok; - char tempbuf[2048],otherbuf[16],ver[16]; - SOCKET mysock; - WSADATA ws; - -#ifdef _WIN32 - if (wsainitialized == 0) - { - if (WSAStartup(0x101, &ws) == SOCKET_ERROR) - return 0; - - wsainitialized = 1; - } -#endif - - if ((h = gethostbyname(host)) == NULL) - { - initprintf("Couldn't resolve %s!\n", host); - return 0; - } - - dest_addr.sin_addr.s_addr = ((struct in_addr *)(h->h_addr))->s_addr; - dest_addr.sin_family = AF_INET; - dest_addr.sin_port = htons(80); - - memset(&(dest_addr.sin_zero), '\0', 8); - - mysock = socket(PF_INET, SOCK_STREAM, 0); - - if (mysock == INVALID_SOCKET) - { - WSACleanup(); - return 0; - } - - initprintf("Connecting to http://%s\n",host); - - if (connect(mysock, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr)) == SOCKET_ERROR) - goto done; - - i = send(mysock, req, strlen(req), 0); - - if (i == SOCKET_ERROR) - goto done; - - i = recv(mysock, (char *)&tempbuf, sizeof(tempbuf), 0); - - if (i < 0) - goto done; - - Bmemcpy(&otherbuf, &tempbuf, sizeof(otherbuf)); - - strtok(otherbuf, " "); - - if ((tok = strtok(NULL, " ")) == NULL) - goto done; - - if (Batol(tok) == 200) - { - for (i = 0; (unsigned)i < strlen(tempbuf); i++) // HACK: all of this needs to die a fiery death; we just skip to the content - { - // instead of actually parsing any of the http headers - if (i > 4) - if (tempbuf[i-1] == '\n' && tempbuf[i-2] == '\r' && tempbuf[i-3] == '\n' && tempbuf[i-4] == '\r') - { - while (j < 9) - { - ver[j] = tempbuf[i]; - i++, j++; - } - ver[j] = '\0'; - break; - } - } - - if (j) - { - strcpy(buffer, ver); - r = 1; - goto done; - } - } - -done: - closesocket(mysock); - WSACleanup(); - - return r; -} -#endif diff --git a/source/rr/src/actors.h b/source/rr/src/actors.h index 4bc0be60e..7128d8d47 100644 --- a/source/rr/src/actors.h +++ b/source/rr/src/actors.h @@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define actors_h_ #include "player.h" +# include "namesdyn.h" #define MAXSLEEPDIST 16384 #define SLEEPTIME 1536 @@ -316,7 +317,6 @@ ACTOR_INLINE int A_SetSprite(int const spriteNum, uint32_t cliptype) # endif -# include "namesdyn.h" EXTERN_INLINE int G_CheckForSpaceCeiling(int const sectnum) { diff --git a/source/rr/src/common.cpp b/source/rr/src/common.cpp index 0b9365a6e..289fcfbea 100644 --- a/source/rr/src/common.cpp +++ b/source/rr/src/common.cpp @@ -213,6 +213,7 @@ static char g_rootDir[BMAX_PATH]; int g_useCwd; static void G_LoadAddon(void); int32_t g_groupFileHandle; +struct strllist* CommandPaths, * CommandGrps; void G_ExtPreInit(int32_t argc,char const * const * argv) { @@ -898,7 +899,6 @@ void G_CleanupSearchPaths(void) ////////// -struct strllist *CommandPaths, *CommandGrps; GrowArray g_scriptModules; diff --git a/source/rr/src/common_game.h b/source/rr/src/common_game.h index 37d166f10..0df1cb566 100644 --- a/source/rr/src/common_game.h +++ b/source/rr/src/common_game.h @@ -159,4 +159,7 @@ extern int32_t S_OpenAudio(const char *fn, char searchfirst, uint8_t ismusic); # define S_OpenAudio(fn, searchfirst, ismusic) kopen4loadfrommod(fn, searchfirst) #endif +void G_AddGroup(const char* buffer); +void G_AddPath(const char* buffer); + #endif diff --git a/source/rr/src/config.cpp b/source/rr/src/config.cpp index b1bf4ec00..e24857d19 100644 --- a/source/rr/src/config.cpp +++ b/source/rr/src/config.cpp @@ -753,7 +753,6 @@ void CONFIG_WriteSettings(void) // save binds and aliases to _settings. if (fp) { - Bfprintf(fp,"// this file is automatically generated by %s\n", AppProperName); Bfprintf(fp,"unbindall\n"); for (i=0; istartwin_run()) { engineUnInit(); Bexit(0); @@ -8876,3 +8872,26 @@ static void G_SetupGameButtons(void) CONTROL_DefineFlag(gamefunc_Third_Person_View, FALSE); CONTROL_DefineFlag(gamefunc_Toggle_Crouch, FALSE); } + + +extern void faketimerhandler(); +extern int app_main(int argc, char const* const* argv); +extern void app_crashhandler(void); +extern int32_t startwin_open(void); +extern int32_t startwin_close(void); +extern int32_t startwin_puts(const char*); +extern int32_t startwin_settitle(const char*); +extern int32_t startwin_idle(void*); +extern int32_t startwin_run(void); + +GameInterface Interface = { + faketimerhandler, + app_main, + app_crashhandler, + startwin_open, + startwin_close, + startwin_puts, + startwin_settitle, + startwin_idle, + startwin_run +}; diff --git a/source/rr/src/screens.cpp b/source/rr/src/screens.cpp index 08262dd94..43beb27a5 100644 --- a/source/rr/src/screens.cpp +++ b/source/rr/src/screens.cpp @@ -709,6 +709,7 @@ static void G_ShowCacheLocks(void) return; k = 0; +/* #if !defined DEBUG_ALLOCACHE_AS_MALLOC for (i=cacnum-1; i>=0; i--) if ((*cac[i].lock) >= 200) @@ -721,6 +722,7 @@ static void G_ShowCacheLocks(void) k += 6; } #endif +*/ if (k < ydim-12) k += 6;