- put EDuke frontend source into a namespace.

This commit does not work yet!
This commit is contained in:
Christoph Oelckers 2019-09-21 22:53:00 +02:00
parent 30c47a8511
commit 55a879fcc0
95 changed files with 429 additions and 294 deletions

View file

@ -257,7 +257,6 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\source\duke3d\src\startwin.game.cpp" />
<ClCompile Include="..\..\source\duke3d\src\winbits.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="audiolib.vcxproj">

View file

@ -215,9 +215,6 @@
<ClCompile Include="..\..\source\duke3d\src\startwin.game.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\source\duke3d\src\winbits.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\source\duke3d\src\network.cpp">
<Filter>Source Files</Filter>
</ClCompile>

View file

@ -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
};

View file

@ -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)
{

View file

@ -690,3 +690,5 @@ public:
}
};
void G_AddGroup(const char* buffer);
void G_AddPath(const char* buffer);

View file

@ -801,7 +801,6 @@ void CONFIG_WriteSettings(void) // save binds and aliases to <cfgname>_settings.
if (fp)
{
Bfprintf(fp,"// this file is automatically generated by %s\n", AppProperName);
Bfprintf(fp,"unbindall\n");
for (int i=0; i<MAXBOUNDKEYS+MAXMOUSEBUTTONS; i++)

View file

@ -1371,7 +1371,6 @@ int dbSaveMap(const char *pPath, int nX, int nY, int nZ, short nAngle, short nSe
IOBuffer1.Write(&mapheader, sizeof(MAPHEADER));
if (byte_1A76C8)
{
Bstrcpy(byte_19AE44.at0, AppProperName);
byte_19AE44.at48 = nXSectorSize;
byte_19AE44.at44 = nXWallSize;
byte_19AE44.at40 = nXSpriteSize;

View file

@ -11,9 +11,6 @@
#include "osd.h"
#include "timer.h"
extern int app_main(int argc, char const * const * argv);
extern const char* AppProperName;
extern const char* AppTechnicalName;
#ifdef DEBUGGINGAIDS
# define DEBUG_MASK_DRAWING
@ -29,16 +26,6 @@ extern int32_t swapcomplete;
extern int32_t r_borderless;
extern int32_t r_displayindex;
extern void app_crashhandler(void);
// NOTE: these are implemented in game-land so they may be overridden in game specific ways
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);
// video
extern int32_t r_usenewaspect, newaspect_enable;
extern int32_t r_fpgrouscan;
@ -276,5 +263,23 @@ void maybe_redirect_outputs(void);
#include "print.h"
struct GameInterface
{
void (*faketimerhandler)();
int (*app_main)(int, char const* const*);
// These will later be removed.
void (*app_crashhandler)();
int32_t(*startwin_open)();
int32_t(*startwin_close)();
int32_t(*startwin_puts)(const char*);
int32_t(*startwin_settitle)(const char*);
int32_t (*startwin_idle)(void*);
int32_t (*startwin_run)(void);
const char* (*DefaultDefFile)();
const char* (*DefFile)();
};
extern GameInterface* gi;
#endif // baselayer_h_

View file

@ -1409,8 +1409,6 @@ int32_t md_loadmodel(const char *fn);
int32_t md_setmisc(int32_t modelid, float scale, int32_t shadeoff, float zadd, float yoffset, int32_t flags);
// int32_t md_tilehasmodel(int32_t tilenume, int32_t pal);
extern const char *G_DefaultDefFile(void);
extern const char *G_DefFile(void);
extern char *g_defNamePtr;
extern GrowArray<char *> g_defModules;

View file

@ -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<ti; ii++) fprintf(stderr,"%d ", t[ii]-t[ii-1]); fprintf(stderr,"\n"); } while (0)
void Duke_CommonCleanup(void);
#endif

View file

@ -16,7 +16,6 @@ extern char silentvideomodeswitch;
extern BOOL CheckWinVersion(void);
extern void win_allowtaskswitching(int32_t onf);
extern int32_t win_checkinstance(void);
#if defined(RENDERTYPEWIN) || SDL_MAJOR_VERSION==1
extern int32_t win_inittimer(void);

View file

@ -10,6 +10,8 @@
#include "vfs.h"
GrowArray<char*> g_defModules;
void PrintBuildInfo(void)
{
buildprint(
@ -70,8 +72,6 @@ void clearDefNamePtr(void)
// g_defNamePtr assumed to be assigned to right after
}
GrowArray<char *> g_defModules;
#ifdef HAVE_CLIPSHAPE_FEATURE
GrowArray<char *> g_clipMapFiles;
#endif

View file

@ -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:

View file

@ -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);

View file

@ -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);

View file

@ -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]);

View file

@ -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);
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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__

View file

@ -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<char *> g_scriptModules;
@ -1170,3 +1173,5 @@ void Duke_CommonCleanup(void)
}
#endif
END_DUKE_NS

View file

@ -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

View file

@ -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 <cfgname>_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<MAXBOUNDKEYS+MAXMOUSEBUTTONS; i++)
@ -1223,3 +1224,4 @@ int CONFIG_SetMapBestTime(uint8_t const * const mapmd4, int32_t tm)
return 0;
}
END_DUKE_NS

View file

@ -25,6 +25,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "function.h"
BEGIN_DUKE_NS
int CONFIG_ReadSetup(void);
void CONFIG_WriteSetup(uint32_t flags);
void CONFIG_SetDefaults(void);
@ -48,4 +51,5 @@ void CONFIG_MapKey(int which, kb_scancode key1, kb_scancode oldkey1, kb_scancode
const char * CONFIG_GetGameFuncOnKeyboard(int gameFunc);
const char * CONFIG_GetGameFuncOnJoystick(int gameFunc);
END_DUKE_NS
#endif

View file

@ -31,6 +31,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "vfs.h"
BEGIN_DUKE_NS
char g_firstDemoFile[BMAX_PATH];
buildvfs_FILE g_demo_filePtr{}; // write
@ -1003,3 +1006,5 @@ nextdemo_nomenu:
// return so that e.g. the title can be shown
return 1;
}
END_DUKE_NS

View file

@ -27,6 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "vfs.h"
#include "cache1d.h"
BEGIN_DUKE_NS
#define DEMOFN_FMT "edemo%03d.edm"
#define MAXDEMOS 1000
@ -65,4 +67,6 @@ int32_t krd_print(const char *filename);
void krd_enable(int32_t which);
#endif
END_DUKE_NS
#endif

View file

@ -150,6 +150,8 @@ EDUKE32_STATIC_ASSERT(7 <= MAXTILES-MAXUSERTILES);
#include "sounds.h"
#include "soundsdyn.h"
BEGIN_DUKE_NS
static inline int32_t G_HaveActor(int spriteNum)
{
return g_tile[spriteNum].execPtr!=NULL;
@ -160,4 +162,6 @@ static inline int32_t G_DefaultActorHealth(int spriteNum)
return G_HaveActor(spriteNum) ? g_tile[spriteNum].execPtr[0] : 0;
}
END_DUKE_NS
#endif

View file

@ -2,6 +2,8 @@
#ifndef EDUKE32_EVENTS_DEFS_H_
#define EDUKE32_EVENTS_DEFS_H_
BEGIN_DUKE_NS
// the order of these can't be changed or else compatibility with EDuke 2.0 mods will break
// KEEPINSYNC with EventNames[] and lunatic/con_lang.lua
enum GameEvent_t {
@ -168,4 +170,6 @@ enum GameEvent_t {
MAXEVENTS
};
END_DUKE_NS
#endif

View file

@ -31,6 +31,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef function_public_h_
#define function_public_h_
BEGIN_DUKE_NS
#define NUMGAMEFUNCTIONS 63
#define MAXGAMEFUNCLEN 32
@ -104,4 +106,7 @@ enum GameFunction_t
gamefunc_Third_Person_View,
gamefunc_Toggle_Crouch,
};
END_DUKE_NS
#endif

View file

@ -67,8 +67,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# endif
#endif /* _WIN32 */
const char* AppProperName = APPNAME;
const char* AppTechnicalName = APPBASENAME;
BEGIN_DUKE_NS
void Duke_CommonCleanup(void);
extern const char* G_DefaultDefFile(void);
extern const char* G_DefFile(void);
int32_t g_quitDeadline = 0;
@ -6365,18 +6369,6 @@ int app_main(int argc, char const * const * argv)
#endif
#ifdef _WIN32
#ifndef DEBUGGINGAIDS
if (!G_CheckCmdSwitch(argc, argv, "-noinstancechecking") && win_checkinstance())
{
#ifdef EDUKE32_STANDALONE
if (!wm_ynbox(APPNAME, "It looks like " APPNAME " is already running.\n\n"
#else
if (!wm_ynbox(APPNAME, "It looks like the game is already running.\n\n"
#endif
"Are you sure you want to start another copy?"))
return 3;
}
#endif
backgroundidle = 0;
@ -6459,49 +6451,6 @@ int app_main(int argc, char const * const * argv)
#endif
CONFIG_ReadSetup();
#if defined(_WIN32) && !defined (EDUKE32_STANDALONE)
// initprintf("build %d\n",(uint8_t)Batoi(BUILDDATE));
if (ud.config.CheckForUpdates == 1)
{
if (time(NULL) - ud.config.LastUpdateCheck > 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

View file

@ -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

View file

@ -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

View file

@ -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_

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -4,6 +4,9 @@
#include "mdump.h"
#include <tchar.h>
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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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__

View file

@ -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

View file

@ -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_

View file

@ -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

View file

@ -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_

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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__

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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)
{

View file

@ -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<char *> g_scriptModules;

View file

@ -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

View file

@ -753,7 +753,6 @@ void CONFIG_WriteSettings(void) // save binds and aliases to <cfgname>_settings.
if (fp)
{
Bfprintf(fp,"// this file is automatically generated by %s\n", AppProperName);
Bfprintf(fp,"unbindall\n");
for (i=0; i<MAXBOUNDKEYS+MAXMOUSEBUTTONS; i++)

View file

@ -65,8 +65,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# endif
#endif /* _WIN32 */
const char* AppProperName = APPNAME;
const char* AppTechnicalName = APPBASENAME;
void Duke_CommonCleanup(void);
extern const char* G_DefaultDefFile(void);
extern const char* G_DefFile(void);
int32_t g_quitDeadline = 0;
@ -7773,12 +7775,6 @@ int app_main(int argc, char const * const * argv)
#endif
#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;
@ -7922,7 +7918,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);
@ -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
};

View file

@ -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;