Break out screen drawing stuff from game.c into screens.c and command line processing stuff into cmdline.c

git-svn-id: https://svn.eduke32.com/eduke32@5618 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2016-02-13 21:05:57 +00:00
parent 7b47a21cf2
commit dbbc7b1e13
15 changed files with 3437 additions and 3297 deletions

View file

@ -230,7 +230,7 @@ MAPSTER32_TARGET:=$(MAPSTER32)$(EXESUFFIX)
COMMON_OBJS=rev
COMMON_EDITOR_OBJS=m32common m32def m32exec m32vars rev
DUKE3D_OBJS=game global actors gamedef gameexec gamevars player premap sector anim animsounds common config demo input menus namesdyn net savegame rts osdfuncs osdcmds grpscan sounds soundsdyn cheats sbar screentext
DUKE3D_OBJS=game global actors gamedef gameexec gamevars player premap sector anim animsounds common config demo input menus namesdyn net savegame rts osdfuncs osdcmds grpscan sounds soundsdyn cheats sbar screentext screens cmdline
DUKE3D_EDITOR_OBJS=astub common grpscan sounds_mapster32
ifneq ($(USE_LIBVPX),0)

View file

@ -40,7 +40,8 @@ $(DUKE3D_OBJ)/game.$o: $(DUKE3D_SRC)/game.c $(game_defs_dep) $(MACT_ROOT)/scripl
$(DUKE3D_OBJ)/actors.$o: $(DUKE3D_SRC)/actors.c $(duke3d_h)
$(DUKE3D_OBJ)/anim.$o: $(DUKE3D_SRC)/anim.c $(duke3d_h) $(DUKE3D_SRC)/input.h $(MACT_ROOT)/animlib.h $(DUKE3D_SRC)/animvpx.h $(DUKE3D_SRC)/animsounds.h
$(DUKE3D_OBJ)/animsounds.$o: $(DUKE3D_SRC)/animsounds.c $(DUKE3D_SRC)/animsounds.h
$(DUKE3D_OBJ)/cheats.$o: $(DUKE3D_SRC)/cheats.c
$(DUKE3D_OBJ)/cheats.$o: $(DUKE3D_SRC)/cheats.c $(DUKE3D_SRC)/cheats.h
$(DUKE3D_OBJ)/cmdline.$o: $(DUKE3D_SRC)/cmdline.c $(DUKE3D_SRC)/cmdline.h
$(DUKE3D_OBJ)/demo.$o: $(DUKE3D_SRC)/demo.c $(duke3d_h) $(DUKE3D_SRC)/input.h
$(DUKE3D_OBJ)/gamedef.$o: $(DUKE3D_SRC)/gamedef.c $(duke3d_h) $(gamedef_h) $(DUKE3D_SRC)/savegame.h
$(DUKE3D_OBJ)/gameexec.$o: $(DUKE3D_SRC)/gameexec.c $(DUKE3D_SRC)/gamestructures.c $(duke3d_h) $(gamedef_h)
@ -56,6 +57,7 @@ $(DUKE3D_OBJ)/player.$o: $(DUKE3D_SRC)/player.c $(duke3d_h)
$(DUKE3D_OBJ)/premap.$o: $(DUKE3D_SRC)/premap.c $(duke3d_h) $(ENGINE_INC)/osd.h
$(DUKE3D_OBJ)/savegame.$o: $(DUKE3D_SRC)/savegame.c $(duke3d_h) $(DUKE3D_SRC)/savegame.h
$(DUKE3D_OBJ)/sbar.$o: $(DUKE3D_SRC)/sbar.c $(DUKE3D_SRC)/sbar.h
$(DUKE3D_OBJ)/screens.$o: $(DUKE3D_SRC)/screens.c $(DUKE3D_SRC)/screens.h
$(DUKE3D_OBJ)/screentext.$o: $(DUKE3D_SRC)/screentext.c $(DUKE3D_SRC)/screentext.h
$(DUKE3D_OBJ)/sector.$o: $(DUKE3D_SRC)/sector.c $(duke3d_h) $(DUKE3D_SRC)/input.h
$(DUKE3D_OBJ)/sounds.$o: $(DUKE3D_SRC)/sounds.c $(duke3d_h)

View file

@ -198,6 +198,8 @@ DUKE3D_OBJS=$(DUKE3D_OBJ)\game.$o \
$(DUKE3D_OBJ)\cheats.$o \
$(DUKE3D_OBJ)\sbar.$o \
$(DUKE3D_OBJ)\screentext.$o \
$(DUKE3D_OBJ)\screens.$o \
$(DUKE3D_OBJ)\cmdline.$o \
$(DUKE3D_OBJ)\common.$o \
$(DUKE3D_OBJ)\demo.$o \
$(DUKE3D_OBJ)\gamedef.$o \

View file

@ -174,6 +174,7 @@
<ClInclude Include="source\animsounds.h" />
<ClInclude Include="source\animvpx.h" />
<ClInclude Include="source\cheats.h" />
<ClInclude Include="source\cmdline.h" />
<ClInclude Include="source\common_game.h" />
<ClInclude Include="source\demo.h" />
<ClInclude Include="source\events_defs.h" />
@ -194,6 +195,7 @@
<ClInclude Include="source\quotes.h" />
<ClInclude Include="source\savegame.h" />
<ClInclude Include="source\sbar.h" />
<ClInclude Include="source\screens.h" />
<ClInclude Include="source\screentext.h" />
<ClInclude Include="source\sector.h" />
<ClInclude Include="source\_functio.h" />
@ -308,6 +310,7 @@
<ClCompile Include="source\animvpx.c" />
<ClCompile Include="source\astub.c" />
<ClCompile Include="source\cheats.c" />
<ClCompile Include="source\cmdline.c" />
<ClCompile Include="source\config.c" />
<ClCompile Include="source\common.c" />
<ClCompile Include="source\demo.c" />
@ -344,6 +347,7 @@
<ClCompile Include="source\rts.c" />
<ClCompile Include="source\savegame.c" />
<ClCompile Include="source\sbar.c" />
<ClCompile Include="source\screens.c" />
<ClCompile Include="source\screentext.c" />
<ClCompile Include="source\sdlmusic.c" />
<ClCompile Include="source\sector.c" />

View file

@ -519,6 +519,12 @@
<ClInclude Include="source\screentext.h">
<Filter>eduke32\headers</Filter>
</ClInclude>
<ClInclude Include="source\screens.h">
<Filter>eduke32\headers</Filter>
</ClInclude>
<ClInclude Include="source\cmdline.h">
<Filter>eduke32\headers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="build\src\a-c.c">
@ -911,6 +917,12 @@
<ClCompile Include="source\screentext.c">
<Filter>eduke32\source</Filter>
</ClCompile>
<ClCompile Include="source\screens.c">
<Filter>eduke32\source</Filter>
</ClCompile>
<ClCompile Include="source\cmdline.c">
<Filter>eduke32\source</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="Makefile.msvc">

View file

@ -0,0 +1,840 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 2016 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 "duke3d.h"
#include "demo.h"
#include "screens.h"
#ifdef LUNATIC
char const * const * g_argv;
const char **g_elModules;
#endif
int32_t g_commandSetup = 0;
int32_t g_noSetup = 0;
int32_t g_noAutoLoad = 0;
int32_t g_noSound = 0;
int32_t g_noMusic = 0;
const char *CommandMap = NULL;
const char *CommandName = NULL;
int32_t g_forceWeaponChoice = 0;
int32_t g_fakeMultiMode = 0;
void G_ShowParameterHelp(void)
{
const char *s = "Usage: eduke32 [files] [options]\n"
"Example: eduke32 -q4 -a -m -tx -map nukeland.map\n\n"
"Files can be *.grp/zip/con/def/rts\n"
"\n"
"-cfg [file.cfg]\tUse an alternate configuration file\n"
#ifdef HAVE_CLIPSHAPE_FEATURE
"-clipmap [file.map]\tLoad an additional clipping map for use with clipshape\n"
#endif
"-connect [host]\tConnect to a multiplayer game\n"
"-c#\t\tUse MP mode #, 1 = Dukematch, 2 = Coop, 3 = Dukematch(no spawn)\n"
"-d [file.edm or demonum]\tPlay a demo\n"
"-g [file.grp]\tLoad additional game data\n"
"-h [file.def]\tLoad an alternate definitions file\n"
"-j [dir]\t\tAdds a directory to EDuke32's search list\n"
"-l#\t\tWarp to level #, see -v\n"
"-map [file.map]\tLoads a map\n"
"-mh [file.def]\tInclude an additional definitions module\n"
"-mx [file.con]\tInclude an additional CON script module\n"
"-m\t\tDisable monsters\n"
"-nam\t\tRun in NAM compatibility mode\n"
"-napalm\t\tRun in NAPALM compatibility mode\n"
"-rts [file.rts]\tLoad a custom Remote Ridicule sound bank\n"
"-r\t\tRecord demo\n"
"-s#\t\tSet skill level (1-4)\n"
"-server\t\tStart a multiplayer game for other players to join\n"
#ifdef STARTUP_SETUP_WINDOW
"-setup/nosetup\tEnables/disables startup window\n"
#endif
"-t#\t\tSet respawn mode: 1 = Monsters, 2 = Items, 3 = Inventory, x = All\n"
"-usecwd\t\tRead game data and configuration file from working directory\n"
"-u#########\tUser's favorite weapon order (default: 3425689071)\n"
"-v#\t\tWarp to volume #, see -l\n"
"-ww2gi\t\tRun in WWII GI compatibility mode\n"
"-x [game.con]\tLoad custom CON script\n"
"-#\t\tLoad and run a game from slot # (0-9)\n"
// "\n-?/--help\tDisplay this help message and exit\n"
"\nSee eduke32 -debughelp for debug parameters"
;
#ifdef WM_MSGBOX_WINDOW
Bsnprintf(tempbuf, sizeof(tempbuf), HEAD2 " %s", s_buildRev);
wm_msgbox(tempbuf, "%s", s);
#else
initprintf("%s\n", s);
#endif
}
void G_ShowDebugHelp(void)
{
const char *s = "Usage: eduke32 [files] [options]\n"
"\n"
"-a\t\tUse fake player AI (fake multiplayer only)\n"
"-cachesize #\tSets cache size, in Kb\n"
"-game_dir [dir]\tDuke3d_w32 compatibility option, see -j\n"
"-gamegrp \tSelects which file to use as main grp\n"
"-name [name]\tPlayer name in multiplay\n"
"-noautoload\tDisable loading content from autoload dir\n"
#ifdef _WIN32
"-nodinput\t\tDisable DirectInput (joystick) support\n"
#endif
"-nologo\t\tSkip the logo anim\n"
"-ns/-nm\t\tDisable sound or music\n"
"-rotatesprite-no-widescreen\tpass bit 1024 to all CON rotatesprite calls\n"
"-q#\t\tFake multiplayer with # (2-8) players\n"
"-z#/-condebug\tEnable line-by-line CON compile debugging at level #\n"
"-conversion YYYYMMDD\tSelects CON script version for compatibility with older mods\n"
#ifdef LUNATIC
"-Lopts=<opt1>,<opt2>,...\n"
" Pass options to Lunatic, valid ones are:\n"
" diag, nojit, traces, dump, strict\n"
#endif
;
#ifdef WM_MSGBOX_WINDOW
Bsnprintf(tempbuf, sizeof(tempbuf), HEAD2 " %s", s_buildRev);
wm_msgbox(tempbuf, "%s", s);
#else
initprintf("%s\n", s);
#endif
}
static void G_AddDemo(const char* param)
{
Bstrncpy(tempbuf, param, sizeof(tempbuf));
char * colon = (char *) Bstrchr(tempbuf, ':');
int32_t framespertic=-1, numrepeats=1;
if (colon && colon != tempbuf)
{
// -d<filename>:<num>[,<num>]
// profiling options
*(colon++) = 0;
Bsscanf(colon, "%u,%u", &framespertic, &numrepeats);
}
Demo_SetFirst(tempbuf);
if (framespertic < 0)
{
initprintf("Play demo %s.\n", g_firstDemoFile);
}
else
{
framespertic = clamp(framespertic, 0, 8)+1;
// TODO: repeat count and gathering statistics.
initprintf("Profile demo %s, %d frames/gametic, repeated 1x.\n", g_firstDemoFile,
framespertic-1);
Demo_PlayFirst(framespertic, 1);
g_noLogo = 1;
}
}
void G_CheckCommandLine(int32_t argc, char const * const * argv)
{
int16_t i = 1, j;
const char *c, *k;
#ifdef LUNATIC
g_argv = argv;
g_elModules = (const char **) Xcalloc(argc+1, sizeof(char *));
#endif
ud.fta_on = 1;
ud.god = 0;
ud.m_respawn_items = 0;
ud.m_respawn_monsters = 0;
ud.m_respawn_inventory = 0;
ud.warp_on = 0;
ud.cashman = 0;
ud.m_player_skill = ud.player_skill = 2;
g_player[0].wchoice[0] = 3;
g_player[0].wchoice[1] = 4;
g_player[0].wchoice[2] = 5;
g_player[0].wchoice[3] = 7;
g_player[0].wchoice[4] = 8;
g_player[0].wchoice[5] = 6;
g_player[0].wchoice[6] = 0;
g_player[0].wchoice[7] = 2;
g_player[0].wchoice[8] = 9;
g_player[0].wchoice[9] = 1;
Bsprintf(ud.wchoice, "3457860291");
#ifdef HAVE_CLIPSHAPE_FEATURE
// pre-form the default 10 clipmaps
for (j = '0'; j<='9'; ++j)
{
char clipshape[16] = "_clipshape0.map";
clipshape[10] = j;
g_clipMapFiles = (char **) Xrealloc(g_clipMapFiles, (g_clipMapFilesNum+1) * sizeof(char *));
g_clipMapFiles[g_clipMapFilesNum] = Xstrdup(clipshape);
++g_clipMapFilesNum;
}
#endif
if (argc > 1)
{
#ifdef LUNATIC
int32_t numlmods = 0;
#endif
initprintf("Application parameters: ");
while (i < argc)
initprintf("%s ", argv[i++]);
initprintf("\n");
i = 1;
do
{
const char *const oc = argv[i];
int32_t shortopt = 0, ignored_short_opt = 0;
c = oc;
if ((*c == '-')
#ifdef _WIN32
|| (*c == '/')
#endif
)
{
shortopt = 0;
if (!Bstrcasecmp(c+1, "?") || !Bstrcasecmp(c+1, "help") || !Bstrcasecmp(c+1, "-help"))
{
G_ShowParameterHelp();
Bexit(0);
}
if (!Bstrcasecmp(c+1, "addon"))
{
if (argc > i+1)
{
g_usingAddon = Batoi(argv[i+1]);
if (g_usingAddon > ADDON_NONE && g_usingAddon < NUMADDONS)
g_noSetup = 1;
else g_usingAddon = ADDON_NONE;
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1, "debughelp") || !Bstrcasecmp(c+1, "-debughelp"))
{
G_ShowDebugHelp();
Bexit(0);
}
if (!Bstrcasecmp(c+1, "grp") || !Bstrcasecmp(c+1, "g"))
{
if (argc > i+1)
{
G_AddGroup(argv[i+1]);
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1, "game_dir"))
{
if (argc > i+1)
{
Bstrncpyz(g_modDir, argv[i+1], sizeof(g_modDir));
G_AddPath(argv[i+1]);
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1, "cfg"))
{
if (argc > i+1)
{
Bstrcpy(setupfilename, argv[i+1]);
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1, "gamegrp"))
{
if (argc > i+1)
{
clearGrpNamePtr();
g_grpNamePtr = dup_filename(argv[i+1]);
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1, "nam"))
{
g_gameType = GAMEFLAG_NAM;
i++;
continue;
}
if (!Bstrcasecmp(c+1, "napalm"))
{
g_gameType = GAMEFLAG_NAM|GAMEFLAG_NAPALM;
i++;
continue;
}
if (!Bstrcasecmp(c+1, "ww2gi"))
{
g_gameType = GAMEFLAG_WW2GI;
i++;
continue;
}
if (!Bstrcasecmp(c+1, "setup"))
{
g_commandSetup = TRUE;
i++;
continue;
}
if (!Bstrcasecmp(c+1, "nosetup"))
{
g_noSetup = 1;
g_commandSetup = 0;
i++;
continue;
}
#if defined RENDERTYPEWIN
if (!Bstrcasecmp(c+1, "nodinput"))
{
initprintf("DirectInput (joystick) support disabled\n");
di_disabled = 1;
i++;
continue;
}
#endif
if (!Bstrcasecmp(c+1, "noautoload"))
{
initprintf("Autoload disabled\n");
g_noAutoLoad = 1;
i++;
continue;
}
if (!Bstrcasecmp(c+1, "net"))
{
G_GameExit("EDuke32 no longer supports legacy networking.\n\n"
"If using YANG or other launchers that only support legacy netplay, download an older build of EDuke32. "
"Otherwise, run the following:\n\n"
"eduke32 -server\n\n"
"Other clients can then connect by typing \"connect [host]\" in the console.\n\n"
"EDuke32 will now close.");
}
if (!Bstrcasecmp(c+1, "port"))
{
if (argc > i+1)
{
g_netPort = Batoi(argv[i+1]);
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1, "server"))
{
g_networkMode = NET_SERVER;
g_noSetup = g_noLogo = TRUE;
i++;
continue;
}
if (!Bstrcasecmp(c+1, "dedicated"))
{
g_networkMode = NET_DEDICATED_SERVER;
g_noSetup = g_noLogo = TRUE;
i++;
continue;
}
if (!Bstrcasecmp(c+1, "connect"))
{
if (argc > i+1)
{
Net_Connect(argv[i+1]);
g_noSetup = g_noLogo = TRUE;
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1, "password"))
{
if (argc > i+1)
{
Bstrncpyz(g_netPassword, argv[i+1], sizeof(g_netPassword));
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1, "name"))
{
if (argc > i+1)
{
CommandName = argv[i+1];
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1, "map"))
{
if (argc > i+1)
{
CommandMap = argv[i+1];
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1, "rts"))
{
if (argc > i+1)
{
g_rtsNamePtr = argv[i+1];
Bstrncpyz(ud.rtsname, g_rtsNamePtr, sizeof(ud.rtsname));
initprintf("Using RTS file \"%s\".\n", ud.rtsname);
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1, "x"))
{
if (argc > i+1)
{
G_AddCon(argv[i+1]);
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1, "mx"))
{
if (argc > i+1)
{
G_AddConModule(argv[i+1]);
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1, "h"))
{
if (argc > i+1)
{
G_AddDef(argv[i+1]);
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1, "mh"))
{
if (argc > i+1)
{
G_AddDefModule(argv[i+1]);
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1, "j"))
{
if (argc > i+1)
{
G_AddPath(argv[i+1]);
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1, "d"))
{
if (argc > i+1)
{
G_AddDemo(argv[i+1]);
i++;
}
i++;
continue;
}
#ifdef HAVE_CLIPSHAPE_FEATURE
if (!Bstrcasecmp(c+1, "clipmap"))
{
if (argc > i+1)
{
G_AddClipMap(argv[i+1]);
i++;
}
i++;
continue;
}
#endif
if (!Bstrcasecmp(c+1, "condebug"))
{
g_scriptDebug = 1;
i++;
continue;
}
if (!Bstrcasecmp(c+1, "nologo"))
{
g_noLogo = 1;
i++;
continue;
}
if (!Bstrcasecmp(c+1, "rotatesprite-no-widescreen"))
{
g_rotatespriteNoWidescreen = 1;
i++;
continue;
}
if (!Bstrcasecmp(c+1, "usecwd"))
{
usecwd = 1;
i++;
continue;
}
if (!Bstrcasecmp(c+1, "cachesize"))
{
if (argc > i+1)
{
uint32_t j = Batol(argv[i+1]);
MAXCACHE1DSIZE = j<<10;
initprintf("Cache size: %dkB\n", j);
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1, "noinstancechecking"))
{
i++;
continue;
}
#if defined(RENDERTYPEWIN) && defined(USE_OPENGL)
if (!Bstrcasecmp(c+1, "forcegl"))
{
forcegl = 1;
i++;
continue;
}
#endif
// the following two dummy entries allow us to serve as a drop-in replacement for NAM on Steam
if (!Bstrcasecmp(c+1, "noconsole"))
{
i++;
continue;
}
if (!Bstrcasecmp(c+1, "conf"))
{
if (argc > i+1)
i++;
i++;
continue;
}
}
if ((*c == '-')
#ifdef _WIN32
|| (*c == '/')
#endif
)
{
shortopt = 1;
c++;
switch (Btolower(*c))
{
case 'a':
ud.playerai = 1;
initprintf("Other player AI.\n");
break;
case 'c':
c++;
ud.m_coop = 0;
while ((*c >= '0')&&(*c <= '9'))
{
ud.m_coop *= 10;
ud.m_coop += *c - '0';
c++;
}
ud.m_coop--;
break;
case 'd':
{
c++;
if (*c)
G_AddDemo(c);
break;
}
#ifdef LUNATIC
case 'f':
break;
#endif
case 'g':
c++;
if (*c)
G_AddGroup(c);
break;
case 'h':
c++;
if (*c)
G_AddDef(c);
break;
case 'j':
c++;
if (*c)
G_AddPath(c);
break;
case 'l':
// NOTE: Overlaid with -Lopts=... options for Lunatic, hence the check.
if (Bisdigit(c[1]))
{
ud.warp_on = 1;
c++;
ud.m_level_number = ud.level_number = ((unsigned) (Batoi(c)-1))%MAXLEVELS;
}
break;
case 'm':
if (*(c+1) != 'a' && *(c+1) != 'A')
{
ud.m_monsters_off = 1;
ud.m_player_skill = ud.player_skill = 0;
initprintf("Monsters off.\n");
}
break;
case 'n':
c++;
if (*c == 's' || *c == 'S')
{
g_noSound = 2;
initprintf("Sound off.\n");
}
else if (*c == 'm' || *c == 'M')
{
g_noMusic = 1;
initprintf("Music off.\n");
}
else
{
G_ShowParameterHelp();
exit(-1);
}
break;
case 'q':
if (*(++c) == 0)
{
ud.multimode = 1;
initprintf("Fake multiplayer mode: expected number after -q, falling back to 1 player.\n");
}
else
{
int32_t numpl = Batoi(c);
if (numpl < 2 || numpl > MAXPLAYERS)
{
initprintf("Fake multiplayer mode: expected 2-%d players, falling back to 1.\n",
MAXPLAYERS);
}
else
{
ud.multimode = numpl;
initprintf("Fake multiplayer mode: %d players.\n", ud.multimode);
g_fakeMultiMode = numpl;
}
}
ud.m_coop = ud.coop = 0;
ud.m_marker = ud.marker = 1;
ud.m_respawn_monsters = ud.respawn_monsters = 1;
ud.m_respawn_items = ud.respawn_items = 1;
ud.m_respawn_inventory = ud.respawn_inventory = 1;
break;
case 'r':
ud.m_recstat = 1;
initprintf("Demo record mode on.\n");
break;
case 's':
c++;
ud.m_player_skill = ud.player_skill = (Batoi(c)%5);
if (ud.m_player_skill == 4)
ud.m_respawn_monsters = ud.respawn_monsters = 1;
break;
case 't':
c++;
if (*c == '1') ud.m_respawn_monsters = 1;
else if (*c == '2') ud.m_respawn_items = 1;
else if (*c == '3') ud.m_respawn_inventory = 1;
else
{
ud.m_respawn_monsters = 1;
ud.m_respawn_items = 1;
ud.m_respawn_inventory = 1;
}
initprintf("Respawn on.\n");
break;
case 'u':
g_forceWeaponChoice = 1;
c++;
j = 0;
if (*c)
{
initprintf("Using favorite weapon order(s).\n");
while (*c)
{
g_player[0].wchoice[j] = *c-'0';
ud.wchoice[j] = *c;
c++;
j++;
}
while (j < 10)
{
if (j == 9)
{
g_player[0].wchoice[9] = 1;
ud.wchoice[9] = '1';
}
else
{
g_player[0].wchoice[j] = 2;
ud.wchoice[j] = '2';
}
j++;
}
}
else
{
initprintf("Using default weapon orders.\n");
g_player[0].wchoice[0] = 3;
g_player[0].wchoice[1] = 4;
g_player[0].wchoice[2] = 5;
g_player[0].wchoice[3] = 7;
g_player[0].wchoice[4] = 8;
g_player[0].wchoice[5] = 6;
g_player[0].wchoice[6] = 0;
g_player[0].wchoice[7] = 2;
g_player[0].wchoice[8] = 9;
g_player[0].wchoice[9] = 1;
Bsprintf(ud.wchoice, "3457860291");
}
break;
case 'v':
c++;
ud.warp_on = 1;
ud.m_volume_number = ud.volume_number = ((unsigned) (Batoi(c)-1))%MAXVOLUMES;
break;
case 'w':
ud.coords = 1;
break;
#ifdef LUNATIC
case 'W':
break;
#endif
case 'x':
c++;
if (*c)
G_AddCon(c);
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
ud.warp_on = 2 + (*c) - '0';
break;
case 'z':
c++;
g_scriptDebug = Batoi(c);
if (!g_scriptDebug)
g_scriptDebug = 1;
break;
default:
ignored_short_opt = 1;
break;
}
}
else
{
shortopt = 0;
k = Bstrrchr(c, '.');
if (k)
{
if (!Bstrcasecmp(k, ".map"))
{
CommandMap = argv[i++];
continue;
}
if (!Bstrcasecmp(k, ".grp") || !Bstrcasecmp(k, ".zip") || !Bstrcasecmp(k, ".pk3") || !Bstrcasecmp(k, ".pk4"))
{
G_AddGroup(argv[i++]);
continue;
}
if (!Bstrcasecmp(k, ".con"))
{
clearScriptNamePtr();
g_scriptNamePtr = dup_filename(argv[i++]);
initprintf("Using CON file \"%s\".\n", g_scriptNamePtr);
continue;
}
if (!Bstrcasecmp(k, ".def"))
{
clearDefNamePtr();
g_defNamePtr = dup_filename(argv[i++]);
initprintf("Using DEF file \"%s\".\n", g_defNamePtr);
continue;
}
if (!Bstrcasecmp(k, ".rts"))
{
g_rtsNamePtr = argv[i++];
Bstrncpyz(ud.rtsname, g_rtsNamePtr, sizeof(ud.rtsname));
initprintf("Using RTS file \"%s\".\n", ud.rtsname);
continue;
}
#ifdef LUNATIC
if (!Bstrcmp(k, ".lua")) // NOTE: case sensitive!
{
g_elModules[numlmods++] = argv[i++];
continue;
}
#endif
}
}
if (!shortopt || ignored_short_opt)
initprintf("Warning: ignored application parameter \"%s\".\n", oc);
i++;
} while (i < argc);
}
}

View file

@ -0,0 +1,35 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 2016 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.
*/
//-------------------------------------------------------------------------
extern void G_CheckCommandLine(int32_t argc, char const * const * argv);
extern void G_ShowParameterHelp(void);
extern void G_ShowDebugHelp(void);
extern int32_t g_commandSetup;
extern int32_t g_noSetup;
extern int32_t g_noAutoLoad;
extern int32_t g_noSound;
extern int32_t g_noMusic;
extern const char *CommandMap;
extern const char *CommandName;
extern int32_t g_forceWeaponChoice;
extern int32_t g_fakeMultiMode;

File diff suppressed because it is too large Load diff

View file

@ -276,6 +276,7 @@ extern int32_t ticrandomseed;
extern int32_t vote_map;
extern int32_t voting;
extern int32_t MAXCACHE1DSIZE;
//extern int8_t cheatbuf[MAXCHEATLEN],cheatbuflen;
#define CROSSHAIR_PAL (MAXPALOOKUPS-RESERVEDPALS-1)
@ -326,12 +327,6 @@ void G_DrawFrags(void);
void G_HandleMirror(int32_t x, int32_t y, int32_t z, int32_t a, int32_t horiz, int32_t smoothratio);
void G_DrawRooms(int32_t snum,int32_t smoothratio);
void G_DrawTXDigiNumZ(int32_t starttile,int32_t x,int32_t y,int32_t n,int32_t s,int32_t pal,int32_t cs,int32_t x1,int32_t y1,int32_t x2,int32_t y2,int32_t z);
#if !defined LUNATIC
void G_DrawTile(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation);
void G_DrawTilePal(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation,int32_t p);
void G_DrawTilePalSmall(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation,int32_t p);
void G_DrawTileSmall(int32_t x,int32_t y,int32_t tilenum,int32_t shade,int32_t orientation);
#endif
void G_FadePalette(int32_t r,int32_t g,int32_t b,int32_t e);
void G_GameExit(const char *t) ATTRIBUTE((noreturn));
void G_GameQuit(void);
@ -519,8 +514,6 @@ extern void G_StartMusic(void);
#ifdef LUNATIC
void El_SetCON(const char *conluacode);
void G_DrawTileGeneric(int32_t x, int32_t y, int32_t zoom, int32_t tilenum,
int32_t shade, int32_t orientation, int32_t p);
#endif
EXTERN_INLINE_HEADER void G_SetStatusBarScale(int32_t sc);

View file

@ -2385,16 +2385,16 @@ nullquote:
switch (tw)
{
case CON_MYOS:
G_DrawTile(pos.x, pos.y, tilenum, shade, orientation);
VM_DrawTile(pos.x, pos.y, tilenum, shade, orientation);
break;
case CON_MYOSPAL:
G_DrawTilePal(pos.x, pos.y, tilenum, shade, orientation, Gv_GetVarX(*insptr++));
VM_DrawTilePal(pos.x, pos.y, tilenum, shade, orientation, Gv_GetVarX(*insptr++));
break;
case CON_MYOSX:
G_DrawTileSmall(pos.x, pos.y, tilenum, shade, orientation);
VM_DrawTileSmall(pos.x, pos.y, tilenum, shade, orientation);
break;
case CON_MYOSPALX:
G_DrawTilePalSmall(pos.x, pos.y, tilenum, shade, orientation, Gv_GetVarX(*insptr++));
VM_DrawTilePalSmall(pos.x, pos.y, tilenum, shade, orientation, Gv_GetVarX(*insptr++));
break;
}
continue;
@ -6136,3 +6136,51 @@ int32_t VM_CheckSquished2(int32_t i, int32_t snum)
return VM_CheckSquished();
}
#endif
// MYOS* CON commands.
LUNATIC_EXTERN void VM_DrawTileGeneric(int32_t x, int32_t y, int32_t zoom, int32_t tilenum,
int32_t shade, int32_t orientation, int32_t p)
{
int32_t a = 0;
orientation &= (ROTATESPRITE_MAX-1);
if (orientation&4)
a = 1024;
if (!(orientation&ROTATESPRITE_FULL16))
{
x<<=16;
y<<=16;
}
rotatesprite_win(x, y, zoom, a, tilenum, shade, p, 2|orientation);
}
#if !defined LUNATIC
void VM_DrawTile(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation)
{
DukePlayer_t *ps = g_player[screenpeek].ps;
int32_t p = ps->cursectnum >= 0 ? sector[ps->cursectnum].floorpal : 0;
VM_DrawTileGeneric(x, y, 65536, tilenum, shade, orientation, p);
}
void VM_DrawTilePal(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p)
{
VM_DrawTileGeneric(x, y, 65536, tilenum, shade, orientation, p);
}
void VM_DrawTileSmall(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation)
{
DukePlayer_t *ps = g_player[screenpeek].ps;
int32_t p = ps->cursectnum >= 0 ? sector[ps->cursectnum].floorpal : 0;
VM_DrawTileGeneric(x, y, 32768, tilenum, shade, orientation, p);
}
void VM_DrawTilePalSmall(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p)
{
VM_DrawTileGeneric(x, y, 32768, tilenum, shade, orientation, p);
}
#endif

View file

@ -56,6 +56,16 @@ int32_t G_GetAngleDelta(int32_t a,int32_t na);
void G_RestoreMapState();
void G_SaveMapState();
#if !defined LUNATIC
void VM_DrawTile(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation);
void VM_DrawTilePal(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p);
void VM_DrawTilePalSmall(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation, int32_t p);
void VM_DrawTileSmall(int32_t x, int32_t y, int32_t tilenum, int32_t shade, int32_t orientation);
#else
void VM_DrawTileGeneric(int32_t x, int32_t y, int32_t zoom, int32_t tilenum,
int32_t shade, int32_t orientation, int32_t p);
#endif
int32_t VM_OnEventWithBoth_(int32_t iEventID, int32_t iActor, int32_t iPlayer, int32_t lDist, int32_t iReturn);
int32_t VM_OnEventWithReturn_(int32_t iEventID, int32_t iActor, int32_t iPlayer, int32_t iReturn);
int32_t VM_OnEventWithDist_(int32_t iEventID, int32_t iActor, int32_t iPlayer, int32_t lDist);

View file

@ -65,14 +65,14 @@ enum GamearrayFlags_t {
GAMEARRAY_OFCHAR = 0x00000001,
GAMEARRAY_OFSHORT = 0x00000002,
GAMEARRAY_OFINT = 0x00000004,
GAMEARRAY_RESET = 0x00000008,
GAMEARRAY_TYPE_MASK = GAMEARRAY_OFCHAR|GAMEARRAY_OFSHORT|GAMEARRAY_OFINT,
GAMEARRAY_RESTORE = 0x00000010,
GAMEARRAY_VARSIZE = 0x00000020,
GAMEARRAY_STRIDE2 = 0x00000100,
GAMEARRAY_RESET = 0x00000008,
/// GAMEARRAY_NORESET = 0x00000001,
};
#pragma pack(push,1)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,44 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 2016 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.
*/
//-------------------------------------------------------------------------
extern void G_DisplayExtraScreens(void);
extern void G_DisplayLogo(void);
extern void G_DoOrderScreen(void);
static inline int G_LastMapInfoIndex(void)
{
Bassert(ud.last_level >= 1); // NOTE: last_level is 1-based
return ud.volume_number*MAXLEVELS + ud.last_level-1;
}
#ifdef DEBUGGINGAIDS
typedef struct {
uint32_t lastgtic;
uint32_t lastnumins, numins;
int32_t numonscreen;
} sprstat_t;
sprstat_t g_spriteStat;
#endif
extern int32_t dr_yxaspect, dr_viewingrange;
extern int32_t g_noLogoAnim, g_noLogo;

View file

@ -86,6 +86,7 @@ typedef struct {
twalltype wall[MAXWALLS];
#if !defined LUNATIC
intptr_t *vars[MAXGAMEVARS];
intptr_t *arrays[MAXGAMEARRAYS];
#else
char *savecode;
#endif