Experimen must go on. + noautosave switch

This commit is contained in:
p.kosyh 2009-09-19 09:59:59 +00:00
parent 2b5c996f96
commit a9ee3a6d6f
7 changed files with 42 additions and 22 deletions

View file

@ -53,6 +53,9 @@ Runs the game in fullscreen mode.
.TP
.B -window
Runs the game in windowed mode.
.TP
.B -noautosave <path>
Disable autosave/autoload.
.PP
Configuration file name is 'insteadrc' and it's located in ~/.instead/.

View file

@ -246,7 +246,8 @@ help2 = room {
-themespath <path> - additional path to themes;^
-gamespath <path> - additional path to games;^
-window - windowed mode;^
-fullscreen - fullscreen mode.
-fullscreen - fullscreen mode;^
-noautosave - disable autosave/autoload option.
]],
obj = { vway('keys', 'See {list of keyboard shortcuts}.', 'help')},
};

View file

@ -275,7 +275,8 @@ help2 = room {
-themespath <путь> - дополнительный путь к темам;^
-gamespath <путь> - дополнительный путь к играм;^
-windows - оконный режим;^
-fullscreen - полноэкранный режим.
-fullscreen - полноэкранный режим;
-noautosave - отключить автосохранение/автозагрузку.
]],
obj = { vway('keys', 'Посмотреть {список клавиш}.', 'help')},
};

View file

@ -991,16 +991,17 @@ int game_cmd(char *cmd)
int new_pict = 0, new_place = 0;
int title_h = 0, ways_h = 0, pict_h = 0;
char buf[1024];
char *cmdstr;
char *invstr;
char *waystr;
char *title;
char *pict;
char *cmdstr = NULL;
char *invstr = NULL;
char *waystr = NULL;
char *title = NULL;
char *pict = NULL;
img_t oldscreen = NULL;
cmdstr = instead_cmd(cmd);
if (!cmdstr)
goto err;
goto inv; /* hackish? ok, yes it is... */
// goto err;
game_music_player();
// sound_player(); /* TODO */
title = instead_eval("return get_title();");
@ -1055,12 +1056,7 @@ int game_cmd(char *cmd)
el(el_spic)->p.p = NULL;
}
waystr = instead_cmd("way");
invstr = instead_cmd("inv");
if (invstr && game_theme.inv_mode == INV_MODE_HORIZ) {
invstr = horiz_inv(invstr);
}
waystr = instead_cmd("way");
if (waystr) {
waystr[strcspn(waystr,"\n")] = 0;
@ -1098,6 +1094,7 @@ int game_cmd(char *cmd)
txt_box_set(el_box(el_scene), txt_box_layout(el_box(el_scene)));
}
free(cmdstr);
el(el_ways)->y = el(el_title)->y + title_h + pict_h;
if (waystr)
free(waystr);
@ -1133,6 +1130,13 @@ int game_cmd(char *cmd)
txt_box_resize(el_box(el_scene), game_theme.win_w, game_theme.win_h - title_h - ways_h - pict_h);
el_draw(el_scene);
inv:
invstr = instead_cmd("inv");
if (invstr && game_theme.inv_mode == INV_MODE_HORIZ) {
invstr = horiz_inv(invstr);
}
do {
int off = txt_box_off(el_box(el_inv));
@ -1448,7 +1452,7 @@ int game_click(int x, int y, int action)
if (elem->id == el_inv) {
int menu_mode = 0;
if (!strncmp("use ", xref_get_text(xref), 4))
if (!strncmp("act ", xref_get_text(xref), 4))
menu_mode = 1;
if (!inv_xref && !menu_mode) {
@ -1458,7 +1462,7 @@ int game_click(int x, int y, int action)
}
if (menu_mode)
snprintf(buf,sizeof(buf), "%s", xref_get_text(xref));
snprintf(buf,sizeof(buf), "use %s", xref_get_text(xref) + 4);
else if (xref == inv_xref)
snprintf(buf,sizeof(buf), "use %s", xref_get_text(xref));
else

View file

@ -17,7 +17,7 @@ iface.xref = function(self, str, obj)\n\
return str;\n\
end\n\
if isMenu(o) then\n\
cmd = 'use ';\n\
cmd = 'act ';\n\
end\n\
return cat('<a:'..cmd..'0'..tostring(o.id)..'>',str,'</a>');\n\
end;\n\

View file

@ -5,6 +5,7 @@ extern int debug_init(void);
extern void debug_done(void);
int debug_sw = 0;
int noauto_sw = 0;
char *game_sw = NULL;
char *games_sw = NULL;
char *theme_sw = NULL;
@ -24,6 +25,8 @@ int main(int argc, char **argv)
window_sw = 1;
else if (!strcmp(argv[i], "-debug"))
debug_sw = 1;
else if (!strcmp(argv[i], "-noautosave"))
noauto_sw = 1;
else if (!strcmp(argv[i], "-game")) {
if ((i + 1) < argc)
game_sw = argv[++i];
@ -73,6 +76,8 @@ int main(int argc, char **argv)
cfg_load();
if (noauto_sw)
opt_autosave = 0;
if (window_sw)
opt_fs = 0;
if (fullscreen_sw)

View file

@ -893,11 +893,11 @@ function player_action(self, what, ...)
v, r = player_take(self, what);
if not v then
v, r = call(ref(obj), 'act', unpack(arg));
if not v then
if not v and r ~= true then
v, r = call(ref(game), 'act', obj, unpack(arg));
end
end
return v;
return v, r;
end
function player_take(self, what)
@ -922,10 +922,10 @@ function player_use(self, what, onwhat)
end
if onwhat == nil then
v, r = call(ref(obj),'inv');
if not v then
if not v and r ~= true then
v, r = call(game, 'inv', obj);
end
return cat(v, ' '), r;
return v, r;
end
obj2 = ref(self.where):srch(onwhat);
if not obj2 then
@ -941,7 +941,7 @@ function player_use(self, what, onwhat)
if not v and not vv then
v, r = call(game, 'use', obj, obj2);
end
return cat(par(' ', v, vv),' ');
return par(' ', v, vv);
end
function player_back(self)
@ -1464,6 +1464,12 @@ iface = {
r,v = me():action(strip(inp));
st = true;
end
if st and r == nil and v == true then -- we do nothing
me():tag();
return nil; --game._lastdisp;
end
-- self:text(r);
if st and v ~= false then
vv = par(" ",vv, game:step());