Lunatic translator embedded: handle command line arguments.

Also, fix an error() call in control.lua:gamearray_file_common().

git-svn-id: https://svn.eduke32.com/eduke32@3572 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-03-17 18:11:58 +00:00
parent d909173065
commit 38ee330c93
6 changed files with 26 additions and 1 deletions

View file

@ -8686,12 +8686,20 @@ static int32_t loaddefinitions_game(const char *fn, int32_t preload)
return 0;
}
#ifdef LUNATIC
// TODO: In Windows, argv[argc] isn't NULL as demanded by C99. (See winlayer.c:
// "carve up...").
const char **g_argv;
#endif
static void G_CheckCommandLine(int32_t argc, const char **argv)
{
int16_t i = 1, j;
const char *c, *k;
#ifdef LUNATIC
g_argv = argv;
#endif
ud.fta_on = 1;
ud.god = 0;
ud.m_respawn_items = 0;
@ -9107,6 +9115,10 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
}
break;
}
#ifdef LUNATIC
case 'f':
break;
#endif
case 'g':
c++;
if (*c)
@ -9256,6 +9268,10 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
case 'w':
ud.coords = 1;
break;
#ifdef LUNATIC
case 'W':
break;
#endif
case 'x':
c++;
if (*c)

View file

@ -1656,7 +1656,7 @@ local function gamearray_file_common(qnum, writep)
local f, errmsg = io.open(fn);
if (f == nil) then
if (not writep) then
error([[failed opening "%s" for reading: %s]], fn, errmsg, 3)
error(format([[failed opening "%s" for reading: %s]], fn, errmsg), 3)
else
return nil, nil, true, fn
end

View file

@ -524,6 +524,7 @@ const char *g_sizes_of_what[];
int32_t g_sizes_of[];
int32_t g_elCallDepth;
int32_t g_elEventRETURN;
const char **g_argv;
char g_modDir[];
actor_t actor[MAXSPRITES];
camera_t g_camera;

View file

@ -498,6 +498,7 @@ local spritetype_mt = {
end,
_set_owner = function(s, owner)
-- XXX: AMC TC sets owner to -1 in the cutscene.
check_sprite_idx(owner)
ffi.cast(spritetype_ptr_ct, s).owner = owner
end,

View file

@ -74,6 +74,7 @@ g_sizes_of_what;
g_sizes_of;
g_elCallDepth;
g_elEventRETURN;
g_argv;
g_modDir;
kopen4loadfrommod;

View file

@ -3278,6 +3278,12 @@ if (string.dump) then
end
end
else
local i=0
while (ffiC.g_argv[i] ~= nil) do
handle_cmdline_arg(ffi.string(ffiC.g_argv[i]))
i = i+1
end
-- running from EDuke32
function compile(filenames)
-- TODO: pathsearchmode=1 set in G_CompileScripts