Initial work on standalone (non-Duke3D) binary support.

git-svn-id: https://svn.eduke32.com/eduke32@6009 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2017-01-18 22:21:08 +00:00
parent 00e39e3ffe
commit 0c5d9f8cbe
7 changed files with 52 additions and 10 deletions

View file

@ -171,6 +171,8 @@ APPLE_FRAMEWORKS ?=/Library/Frameworks
# LINKED_GTK - enables compile-time linkage to GTK # LINKED_GTK - enables compile-time linkage to GTK
# #
APPNAME ?= EDuke32 APPNAME ?= EDuke32
APPBASENAME ?= eduke32
STANDALONE ?= 0
POLYMER = 1 POLYMER = 1
USE_OPENGL = 1 USE_OPENGL = 1
NOASM = 0 NOASM = 0
@ -670,6 +672,9 @@ ifneq (0,$(DMALLOC))
LIBS+= -ldmalloc LIBS+= -ldmalloc
COMPILERFLAGS+= -DDMALLOC COMPILERFLAGS+= -DDMALLOC
endif endif
ifneq (0,$(STANDALONE))
COMPILERFLAGS+= -DEDUKE32_STANDALONE
endif
COMPILERFLAGS+= -DAPPNAME=\"$(APPNAME)\" COMPILERFLAGS+= -DAPPNAME=\"$(APPNAME)\"

View file

@ -25,8 +25,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "cheats.h" #include "cheats.h"
// KEEPINSYNC game.h: enum cheatindex_t // KEEPINSYNC game.h: enum cheatindex_t
char CheatStrings [][MAXCHEATLEN] = char CheatStrings [NUMCHEATS][MAXCHEATLEN] =
{ {
#ifndef EDUKE32_STANDALONE
"cornholio", // 0 "cornholio", // 0
"stuff", // 1 "stuff", // 1
"scotty###", // 2 "scotty###", // 2
@ -54,9 +55,10 @@ char CheatStrings [][MAXCHEATLEN] =
"debug", // 24 "debug", // 24
"<RESERVED>", // 25 "<RESERVED>", // 25
"cgs", // 26 "cgs", // 26
#endif
}; };
const uint32_t CheatFunctionFlags [] = const uint32_t CheatFunctionFlags [NUMCHEATS] =
{ {
1 << CHEATFUNC_GOD, 1 << CHEATFUNC_GOD,
1 << CHEATFUNC_GIVEEVERYTHING, 1 << CHEATFUNC_GIVEEVERYTHING,
@ -89,7 +91,7 @@ const uint32_t CheatFunctionFlags [] =
// KEEPINSYNC game.h: enum CheatCodeFunctions // KEEPINSYNC game.h: enum CheatCodeFunctions
// KEEPINSYNC menus.c: MenuEntry_t ME_CheatCodes[] // KEEPINSYNC menus.c: MenuEntry_t ME_CheatCodes[]
const uint8_t CheatFunctionIDs [] = const uint8_t CheatFunctionIDs[NUMCHEATS] =
{ {
CHEAT_CASHMAN, CHEAT_CASHMAN,
CHEAT_CORNHOLIO, CHEAT_CORNHOLIO,
@ -116,6 +118,7 @@ const uint8_t CheatFunctionIDs [] =
char const * const g_NAMMattCheatQuote = "Matt Saettler. matts@saettler.com"; char const * const g_NAMMattCheatQuote = "Matt Saettler. matts@saettler.com";
#ifndef EDUKE32_STANDALONE
void G_SetupCheats(void) void G_SetupCheats(void)
{ {
// KEEPINSYNC: NAM_WW2GI_CHEATS // KEEPINSYNC: NAM_WW2GI_CHEATS
@ -189,7 +192,7 @@ void G_SetupCheats(void)
Bstrcpy(g_gametypeNames[2], "GruntMatch (No Spawn)"); Bstrcpy(g_gametypeNames[2], "GruntMatch (No Spawn)");
} }
} }
#endif
static void doinvcheat(DukePlayer_t * const pPlayer, int32_t invidx, int32_t defaultnum, int32_t event) static void doinvcheat(DukePlayer_t * const pPlayer, int32_t invidx, int32_t defaultnum, int32_t event)
{ {

View file

@ -25,7 +25,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
extern void G_DoCheats(void); extern void G_DoCheats(void);
extern void G_SetupCheats(void); extern void G_SetupCheats(void);
extern char CheatStrings [][MAXCHEATLEN];
extern char const * const g_NAMMattCheatQuote; extern char const * const g_NAMMattCheatQuote;
// Cheats // Cheats
@ -62,6 +61,8 @@ enum cheatindex_t
NUMCHEATS, NUMCHEATS,
}; };
extern char CheatStrings[NUMCHEATS][MAXCHEATLEN];
// KEEPINSYNC game.c: uint8_t CheatFunctionIDs[] // KEEPINSYNC game.c: uint8_t CheatFunctionIDs[]
// KEEPINSYNC menus.c: MenuEntry_t ME_CheatCodes[] // KEEPINSYNC menus.c: MenuEntry_t ME_CheatCodes[]
enum CheatCodeFunctions enum CheatCodeFunctions

View file

@ -34,10 +34,12 @@ const char *g_gameNamePtr = NULL;
// grp/con handling // grp/con handling
static const char *defaultconfilename = "GAME.CON";
#ifndef EDUKE32_STANDALONE
static const char *defaultgamegrp[GAMECOUNT] = { "DUKE3D.GRP", "NAM.GRP", "NAPALM.GRP", "WW2GI.GRP" }; static const char *defaultgamegrp[GAMECOUNT] = { "DUKE3D.GRP", "NAM.GRP", "NAPALM.GRP", "WW2GI.GRP" };
static const char *defaultdeffilename[GAMECOUNT] = { "duke3d.def", "nam.def", "napalm.def", "ww2gi.def" }; static const char *defaultdeffilename[GAMECOUNT] = { "duke3d.def", "nam.def", "napalm.def", "ww2gi.def" };
static const char *defaultconfilename = "GAME.CON";
static const char *defaultgameconfilename[GAMECOUNT] = { "EDUKE.CON", "NAM.CON", "NAPALM.CON", "WW2GI.CON" }; static const char *defaultgameconfilename[GAMECOUNT] = { "EDUKE.CON", "NAM.CON", "NAPALM.CON", "WW2GI.CON" };
#endif
// g_grpNamePtr can ONLY point to a malloc'd block (length BMAX_PATH) // g_grpNamePtr can ONLY point to a malloc'd block (length BMAX_PATH)
char *g_grpNamePtr = NULL; char *g_grpNamePtr = NULL;
@ -58,6 +60,7 @@ void clearScriptNamePtr(void)
const char *G_DefaultGrpFile(void) const char *G_DefaultGrpFile(void)
{ {
#ifndef EDUKE32_STANDALONE
if (DUKE) if (DUKE)
return defaultgamegrp[GAME_DUKE]; return defaultgamegrp[GAME_DUKE];
else if (NAPALM) else if (NAPALM)
@ -68,9 +71,13 @@ const char *G_DefaultGrpFile(void)
return defaultgamegrp[GAME_NAM]; return defaultgamegrp[GAME_NAM];
return defaultgamegrp[0]; return defaultgamegrp[0];
#else
return "(none)";
#endif
} }
const char *G_DefaultDefFile(void) const char *G_DefaultDefFile(void)
{ {
#ifndef EDUKE32_STANDALONE
if (DUKE) if (DUKE)
return defaultdeffilename[GAME_DUKE]; return defaultdeffilename[GAME_DUKE];
else if (WW2GI) else if (WW2GI)
@ -91,9 +98,13 @@ const char *G_DefaultDefFile(void)
} }
return defaultdeffilename[0]; return defaultdeffilename[0];
#else
return "(none)";
#endif
} }
const char *G_DefaultConFile(void) const char *G_DefaultConFile(void)
{ {
#ifndef EDUKE32_STANDALONE
if (DUKE && testkopen(defaultgameconfilename[GAME_DUKE],0)) if (DUKE && testkopen(defaultgameconfilename[GAME_DUKE],0))
return defaultgameconfilename[GAME_DUKE]; return defaultgameconfilename[GAME_DUKE];
else if (WW2GI && testkopen(defaultgameconfilename[GAME_WW2GI],0)) else if (WW2GI && testkopen(defaultgameconfilename[GAME_WW2GI],0))
@ -118,7 +129,7 @@ const char *G_DefaultConFile(void)
else else
return defaultgameconfilename[GAME_NAM]; return defaultgameconfilename[GAME_NAM];
} }
#endif
return defaultconfilename; return defaultconfilename;
} }
@ -301,7 +312,7 @@ void G_ExtInit(void)
{ {
Bsnprintf(cwd,sizeof(cwd),"%s/" Bsnprintf(cwd,sizeof(cwd),"%s/"
#if defined(_WIN32) #if defined(_WIN32)
"EDuke32 Settings" APPNAME " Settings"
#elif defined(GEKKO) #elif defined(GEKKO)
"apps/eduke32" "apps/eduke32"
#else #else
@ -321,6 +332,7 @@ void G_ExtInit(void)
} }
// JBF 20031220: Because it's annoying renaming GRP files whenever I want to test different game data // JBF 20031220: Because it's annoying renaming GRP files whenever I want to test different game data
#ifndef EDUKE32_STANDALONE
if (g_grpNamePtr == NULL) if (g_grpNamePtr == NULL)
{ {
const char *cp = getenv("DUKE3DGRP"); const char *cp = getenv("DUKE3DGRP");
@ -331,6 +343,7 @@ void G_ExtInit(void)
initprintf("Using \"%s\" as main GRP file\n", g_grpNamePtr); initprintf("Using \"%s\" as main GRP file\n", g_grpNamePtr);
} }
} }
#endif
} }
void G_ScanGroups(void) void G_ScanGroups(void)
@ -447,6 +460,7 @@ void G_LoadGroups(int32_t autoload)
if (g_modDir[0] != '/') if (g_modDir[0] != '/')
G_LoadGroupsInDir(g_modDir); G_LoadGroupsInDir(g_modDir);
#ifndef EDUKE32_STANDALONE
if (g_defNamePtr == NULL) if (g_defNamePtr == NULL)
{ {
const char *tmpptr = getenv("DUKE3DDEF"); const char *tmpptr = getenv("DUKE3DDEF");
@ -457,6 +471,7 @@ void G_LoadGroups(int32_t autoload)
initprintf("Using \"%s\" as definitions file\n", g_defNamePtr); initprintf("Using \"%s\" as definitions file\n", g_defNamePtr);
} }
} }
#endif
loaddefinitions_game(G_DefFile(), TRUE); loaddefinitions_game(G_DefFile(), TRUE);
@ -508,6 +523,7 @@ static int G_ReadRegistryValue(char const * const SubKey, char const * const Val
static void G_LoadAddon(void) static void G_LoadAddon(void)
{ {
#ifndef EDUKE32_STANDALONE
int32_t crc = 0; // compiler-happy int32_t crc = 0; // compiler-happy
switch (g_addonNum) switch (g_addonNum)
@ -529,8 +545,10 @@ static void G_LoadAddon(void)
if (grp) if (grp)
g_selectedGrp = grp; g_selectedGrp = grp;
#endif
} }
#ifndef EDUKE32_STANDALONE
#ifndef EDUKE32_TOUCH_DEVICES #ifndef EDUKE32_TOUCH_DEVICES
#if defined EDUKE32_OSX || defined __linux__ || defined EDUKE32_BSD #if defined EDUKE32_OSX || defined __linux__ || defined EDUKE32_BSD
static void G_AddSteamPaths(const char *basepath) static void G_AddSteamPaths(const char *basepath)
@ -734,9 +752,11 @@ static void G_ParseSteamKeyValuesForPaths(const char *vdf)
} }
#endif #endif
#endif #endif
#endif
void G_AddSearchPaths(void) void G_AddSearchPaths(void)
{ {
#ifndef EDUKE32_STANDALONE
#ifndef EDUKE32_TOUCH_DEVICES #ifndef EDUKE32_TOUCH_DEVICES
#if defined __linux__ || defined EDUKE32_BSD #if defined __linux__ || defined EDUKE32_BSD
char buf[BMAX_PATH]; char buf[BMAX_PATH];
@ -870,6 +890,7 @@ void G_AddSearchPaths(void)
} }
#endif #endif
#endif #endif
#endif
} }
void G_CleanupSearchPaths(void) void G_CleanupSearchPaths(void)

View file

@ -6214,11 +6214,12 @@ int app_main(int argc, char const * const * argv)
G_LoadGroups(!g_noAutoLoad && !ud.config.NoAutoLoad); G_LoadGroups(!g_noAutoLoad && !ud.config.NoAutoLoad);
// flushlogwindow = 1; // flushlogwindow = 1;
G_SetupCheats();
if (!g_useCwd) if (!g_useCwd)
G_CleanupSearchPaths(); G_CleanupSearchPaths();
#ifndef EDUKE32_STANDALONE
G_SetupCheats();
if (SHAREWARE) if (SHAREWARE)
g_Shareware = 1; g_Shareware = 1;
else else
@ -6231,6 +6232,7 @@ int app_main(int argc, char const * const * argv)
kclose(kFile); kclose(kFile);
} }
} }
#endif
// gotta set the proper title after we compile the CONs if this is the full version // gotta set the proper title after we compile the CONs if this is the full version

View file

@ -31,6 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "common_game.h" #include "common_game.h"
#include "grpscan.h" #include "grpscan.h"
#ifndef EDUKE32_STANDALONE
static void process_vaca13(int32_t crcval); static void process_vaca13(int32_t crcval);
static void process_vacapp15(int32_t crcval); static void process_vacapp15(int32_t crcval);
@ -65,6 +66,7 @@ static internalgrpinfo_t const internalgrpfiles[] =
{ "NAPALM", NAPALM_CRC, 44365728, GAMEFLAG_NAM|GAMEFLAG_NAPALM, 0, NULL, NULL}, { "NAPALM", NAPALM_CRC, 44365728, GAMEFLAG_NAM|GAMEFLAG_NAPALM, 0, NULL, NULL},
{ "WWII GI", WW2GI_CRC, 77939508, GAMEFLAG_WW2GI, 0, NULL, NULL}, { "WWII GI", WW2GI_CRC, 77939508, GAMEFLAG_WW2GI, 0, NULL, NULL},
}; };
#endif
struct grpfile_t *foundgrps = NULL; struct grpfile_t *foundgrps = NULL;
struct grpinfo_t *listgrps = NULL; struct grpinfo_t *listgrps = NULL;
@ -76,6 +78,7 @@ static void LoadList(const char * filename)
if (!script) if (!script)
return; return;
#ifndef EDUKE32_STANDALONE
scriptfile_addsymbolvalue("GAMEFLAG_DUKE", GAMEFLAG_DUKE); scriptfile_addsymbolvalue("GAMEFLAG_DUKE", GAMEFLAG_DUKE);
scriptfile_addsymbolvalue("GAMEFLAG_ADDON", GAMEFLAG_DUKE|GAMEFLAG_ADDON); scriptfile_addsymbolvalue("GAMEFLAG_ADDON", GAMEFLAG_DUKE|GAMEFLAG_ADDON);
scriptfile_addsymbolvalue("GAMEFLAG_NAM", GAMEFLAG_NAM); scriptfile_addsymbolvalue("GAMEFLAG_NAM", GAMEFLAG_NAM);
@ -97,6 +100,7 @@ static void LoadList(const char * filename)
scriptfile_addsymbolvalue("NAM_CRC", NAM_CRC); scriptfile_addsymbolvalue("NAM_CRC", NAM_CRC);
scriptfile_addsymbolvalue("NAPALM_CRC", NAPALM_CRC); scriptfile_addsymbolvalue("NAPALM_CRC", NAPALM_CRC);
scriptfile_addsymbolvalue("WW2GI_CRC", WW2GI_CRC); scriptfile_addsymbolvalue("WW2GI_CRC", WW2GI_CRC);
#endif
while (!scriptfile_eof(script)) while (!scriptfile_eof(script))
{ {
@ -197,6 +201,7 @@ static void LoadList(const char * filename)
static void LoadGameList(void) static void LoadGameList(void)
{ {
#ifndef EDUKE32_STANDALONE
for (size_t i = 0; i < ARRAY_SIZE(internalgrpfiles); i++) for (size_t i = 0; i < ARRAY_SIZE(internalgrpfiles); i++)
{ {
grpinfo_t * const fg = (grpinfo_t *)Xcalloc(1, sizeof(grpinfo_t)); grpinfo_t * const fg = (grpinfo_t *)Xcalloc(1, sizeof(grpinfo_t));
@ -215,6 +220,7 @@ static void LoadGameList(void)
fg->next = listgrps; fg->next = listgrps;
listgrps = fg; listgrps = fg;
} }
#endif
CACHE1D_FIND_REC * const srch = klistpath("/", "*.grpinfo", CACHE1D_FIND_FILE); CACHE1D_FIND_REC * const srch = klistpath("/", "*.grpinfo", CACHE1D_FIND_FILE);
@ -505,6 +511,7 @@ void FreeGroups(void)
FreeGameList(); FreeGameList();
} }
#ifndef EDUKE32_STANDALONE
static void process_vaca13(int32_t crcval) static void process_vaca13(int32_t crcval)
{ {
krename(crcval, 0, "ADDREE.VOC"); krename(crcval, 0, "ADDREE.VOC");
@ -646,3 +653,4 @@ static void process_vacapp15(int32_t crcval)
initgroupfile("VACATION.PRG"); initgroupfile("VACATION.PRG");
} }
#endif

View file

@ -2196,6 +2196,7 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
case MENU_CREDITS: case MENU_CREDITS:
case MENU_CREDITS2: case MENU_CREDITS2:
case MENU_CREDITS3: case MENU_CREDITS3:
#ifndef EDUKE32_STANDALONE
if (!VOLUMEALL || !PLUTOPAK) if (!VOLUMEALL || !PLUTOPAK)
{ {
switch (cm) switch (cm)
@ -2317,6 +2318,7 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
} }
} }
break; break;
#endif
case MENU_CREDITS4: // JBF 20031220 case MENU_CREDITS4: // JBF 20031220
l = 7; l = 7;