|
@@ -3,23 +3,28 @@
|
|
|
-- $Author: Khaelenmore Thaal & Sabra Naikomy$
|
|
|
-- $Info: A tiny illustrated text adventure$
|
|
|
|
|
|
if instead.tiny then
|
|
|
require "lib/tiny/stubs"
|
|
|
end;
|
|
|
require "lib/link"
|
|
|
require "noinv"
|
|
|
require 'snd'
|
|
|
require 'keys'
|
|
|
require "timer"
|
|
|
require "theme"
|
|
|
if not instead.tiny then
|
|
|
require "lib/decor"
|
|
|
end;
|
|
|
require "prefs"
|
|
|
if not instead.tiny then
|
|
|
require "lib/dire/theme"
|
|
|
end;
|
|
|
require 'lib/utils'
|
|
|
require "lib/dire/theme"
|
|
|
require "lib/locale"
|
|
|
if not instead.tiny then
|
|
|
require "lib/fading"
|
|
|
require "lib/smoke"
|
|
|
|
|
|
declare({
|
|
|
closed_beta_participants = 'arbtttrn6, De@th K!d, Fehatt, Lesha Pak, Łukasz Sawicki, Niko Flang, Oleg Bosh, Terracon, Андрей Лобанов';
|
|
|
})
|
|
|
end
|
|
|
|
|
|
fmt.quotes = false;
|
|
|
fmt.filter = function(r)
|
|
@@ -29,6 +34,8 @@ fmt.filter = function(r)
|
|
|
r = r:gsub('"([^"]*)"', translate_now("common_locale", 'quotes'));
|
|
|
end;
|
|
|
|
|
|
r = r:gsub('<tab>', fmt.nb(' '));
|
|
|
|
|
|
return r;
|
|
|
end;
|
|
|
|
|
@@ -119,31 +126,32 @@ std.phrase_show = false;
|
|
|
|
|
|
declare {
|
|
|
current_theme = false,
|
|
|
sounds = {
|
|
|
['bubble'] = snd.new('sound/bubble.ogg');
|
|
|
['potion'] = snd.new('sound/potion.ogg');
|
|
|
['error_beep'] = snd.new('sound/error_beep.ogg');
|
|
|
['long_beep'] = snd.new('sound/long_beep.ogg');
|
|
|
['short_beep'] = snd.new('sound/short_beep.ogg');
|
|
|
['note_c'] = snd.new('sound/c.ogg');
|
|
|
['note_d'] = snd.new('sound/d.ogg');
|
|
|
['note_e'] = snd.new('sound/e.ogg');
|
|
|
['note_f'] = snd.new('sound/f.ogg');
|
|
|
['note_g'] = snd.new('sound/g.ogg');
|
|
|
['note_a'] = snd.new('sound/a.ogg');
|
|
|
['note_b'] = snd.new('sound/b.ogg');
|
|
|
['wind_gust_1'] = snd.new('sound/wind_blow_1.ogg');
|
|
|
['wind_gust_2'] = snd.new('sound/wind_blow_2.ogg');
|
|
|
['wind_gust_3'] = snd.new('sound/wind_blow_3.ogg');
|
|
|
['open_door'] = snd.new('sound/open_door.ogg');
|
|
|
['pc_startup'] = snd.new('sound/pc_startup.ogg');
|
|
|
['keyboard1'] = snd.new('sound/keyboard1.ogg');
|
|
|
['keyboard2'] = snd.new('sound/keyboard2.ogg');
|
|
|
['keyboard3'] = snd.new('sound/keyboard3.ogg');
|
|
|
['keyboard4'] = snd.new('sound/keyboard4.ogg');
|
|
|
['keyboard5'] = snd.new('sound/keyboard5.ogg');
|
|
|
['irradiated'] = snd.new('sound/irradiated.ogg');
|
|
|
},
|
|
|
sound_names = {
|
|
|
['bubble'] = 'sound/bubble.ogg';
|
|
|
['potion'] = 'sound/potion.ogg';
|
|
|
['error_beep'] = 'sound/error_beep.ogg';
|
|
|
['long_beep'] = 'sound/long_beep.ogg';
|
|
|
['short_beep'] = 'sound/short_beep.ogg';
|
|
|
['note_c'] = 'sound/c.ogg';
|
|
|
['note_d'] = 'sound/d.ogg';
|
|
|
['note_e'] = 'sound/e.ogg';
|
|
|
['note_f'] = 'sound/f.ogg';
|
|
|
['note_g'] = 'sound/g.ogg';
|
|
|
['note_a'] = 'sound/a.ogg';
|
|
|
['note_b'] = 'sound/b.ogg';
|
|
|
['wind_gust_1'] = 'sound/wind_blow_1.ogg';
|
|
|
['wind_gust_2'] = 'sound/wind_blow_2.ogg';
|
|
|
['wind_gust_3'] = 'sound/wind_blow_3.ogg';
|
|
|
['open_door'] = 'sound/open_door.ogg';
|
|
|
['pc_startup'] = 'sound/pc_startup.ogg';
|
|
|
['keyboard1'] = 'sound/keyboard1.ogg';
|
|
|
['keyboard2'] = 'sound/keyboard2.ogg';
|
|
|
['keyboard3'] = 'sound/keyboard3.ogg';
|
|
|
['keyboard4'] = 'sound/keyboard4.ogg';
|
|
|
['keyboard5'] = 'sound/keyboard5.ogg';
|
|
|
['irradiated'] = 'sound/irradiated.ogg';
|
|
|
};
|
|
|
sounds = {},
|
|
|
gusts = {
|
|
|
'wind_gust_1';
|
|
|
'wind_gust_2';
|
|
@@ -158,6 +166,42 @@ global {
|
|
|
in_game = false,
|
|
|
}
|
|
|
|
|
|
function load_sounds(...)
|
|
|
for i = 1, #arg do
|
|
|
local s = arg[i];
|
|
|
if not sounds[s] then
|
|
|
sounds[s] = snd.new(sound_names[s]);
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if instead.tiny then
|
|
|
function DSA () end;
|
|
|
function DS () end;
|
|
|
else
|
|
|
function DSA (data)
|
|
|
local scale = diretheme.get_scale();
|
|
|
data[3] = get_sprite(data[3]);
|
|
|
data['x'] = data['x'] * scale;
|
|
|
data['y'] = data['y'] * scale;
|
|
|
data['w'] = data['w'] * scale;
|
|
|
data['h'] = data['h'] * scale;
|
|
|
D(data);
|
|
|
end;
|
|
|
|
|
|
function DS (data)
|
|
|
local scale = diretheme.get_scale();
|
|
|
data[3] = get_sprite(data[3], 'fuchsia');
|
|
|
data['background'] = true;
|
|
|
data['x'] = data['x'] * scale;
|
|
|
data['y'] = data['y'] * scale;
|
|
|
data['w'] = data['w'] * scale;
|
|
|
data['h'] = data['h'] * scale;
|
|
|
D(data);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
include "game_theme"
|
|
|
include "tutorial"
|
|
|
include "computer_parts"
|
|
|
include "solarscale"
|
|
@@ -165,51 +209,12 @@ include "tower"
|
|
|
include "forest"
|
|
|
include "ending"
|
|
|
|
|
|
function get_sprite(path, transparent)
|
|
|
local s = diretheme.get_scale();
|
|
|
|
|
|
if not menu_sprites[path] then
|
|
|
if s ~= 1 then
|
|
|
menu_sprites[path] = pixels.new(path):scale(s, s):sprite();
|
|
|
if instead.tiny then
|
|
|
include "tiny_menu"
|
|
|
else
|
|
|
menu_sprites[path] = sprite.new(path);
|
|
|
end;
|
|
|
if transparent then
|
|
|
menu_sprites[path]:colorkey(transparent);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
return menu_sprites[path];
|
|
|
end;
|
|
|
|
|
|
function get_button(button_name)
|
|
|
local path = 'images/title/' .. button_name .. '.' .. get_language() .. '.png';
|
|
|
if menu_sprites[path] then
|
|
|
return menu_sprites[path];
|
|
|
include "menu"
|
|
|
end;
|
|
|
|
|
|
local sprite = nil;
|
|
|
|
|
|
--Check if file exists(only used here, so not moved to function)
|
|
|
local f = io.open(path, 'r');
|
|
|
if f then
|
|
|
f:close();
|
|
|
sprite = get_sprite(path, 'fuchsia')
|
|
|
end;
|
|
|
|
|
|
if not sprite then
|
|
|
local path = 'images/title/' .. button_name .. '.' .. get_default_language() .. '.png';
|
|
|
sprite = get_sprite(path, 'fuchsia');
|
|
|
end;
|
|
|
return sprite
|
|
|
end;
|
|
|
|
|
|
function stop_menu()
|
|
|
D {'bgframe'};
|
|
|
D {'background'};
|
|
|
D {'bganim'};
|
|
|
D {'title'};
|
|
|
end;
|
|
|
|
|
|
game.ondecor = function(s, name, press, x, y, btn)
|
|
|
if press then
|
|
@@ -249,909 +254,6 @@ game.afterwalk = function()
|
|
|
last_location = here().nam;
|
|
|
end;
|
|
|
|
|
|
function cat_list(list, sep)
|
|
|
local rval;
|
|
|
|
|
|
if sep == nil then
|
|
|
sep = '';
|
|
|
end;
|
|
|
|
|
|
for i, v in ipairs(list) do
|
|
|
if rval then
|
|
|
rval = rval .. sep .. v;
|
|
|
else
|
|
|
rval = v;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
return rval;
|
|
|
end;
|
|
|
|
|
|
function init_menu(with_text, buttons)
|
|
|
local scale = diretheme.get_scale();
|
|
|
|
|
|
local w = 960 * scale;
|
|
|
local h = 600 * scale;
|
|
|
local sw, sh = diretheme.get_screen();
|
|
|
local ox = math.floor((sw - w) / 2);
|
|
|
local oy = math.floor((sh - h) / 2)
|
|
|
|
|
|
local button_dy = 0;
|
|
|
local button_dx = 0;
|
|
|
if sh < 520 * scale then
|
|
|
button_dy = -50;
|
|
|
button_dx = 20;
|
|
|
end;
|
|
|
|
|
|
local btop = 515;
|
|
|
|
|
|
if #buttons == 5 then
|
|
|
btop = 435;
|
|
|
end;
|
|
|
|
|
|
if sh <= 560 * scale then
|
|
|
btop = btop - 20;
|
|
|
end;
|
|
|
|
|
|
if #buttons == 1 then
|
|
|
D {
|
|
|
buttons[1],
|
|
|
'img',
|
|
|
get_button(buttons[1]),
|
|
|
x=ox + 398 * scale,
|
|
|
y=oy + (btop + button_dy) * scale,
|
|
|
click=true,
|
|
|
background=true,
|
|
|
z=3
|
|
|
};
|
|
|
else
|
|
|
D {
|
|
|
buttons[1],
|
|
|
'img',
|
|
|
get_button(buttons[1]),
|
|
|
x=ox + (157 + button_dx) * scale,
|
|
|
y=oy + (btop + button_dy) * scale,
|
|
|
click=true,
|
|
|
background=true,
|
|
|
z=3
|
|
|
};
|
|
|
D {
|
|
|
buttons[2],
|
|
|
'img',
|
|
|
get_button(buttons[2]),
|
|
|
x=ox + 398 * scale,
|
|
|
y=oy + (btop + button_dy) * scale,
|
|
|
click=true,
|
|
|
background=true,
|
|
|
z=3
|
|
|
};
|
|
|
D {
|
|
|
buttons[3],
|
|
|
'img',
|
|
|
get_button(buttons[3]),
|
|
|
x=ox + (639 - button_dx) * scale,
|
|
|
y=oy + (btop + button_dy) * scale,
|
|
|
click=true,
|
|
|
background=true,
|
|
|
z=3
|
|
|
};
|
|
|
end;
|
|
|
|
|
|
if #buttons == 5 then
|
|
|
btop = btop + 80
|
|
|
D {
|
|
|
buttons[4],
|
|
|
'img',
|
|
|
get_button(buttons[4]),
|
|
|
x=ox + (278 + button_dx / 2) * scale,
|
|
|
y=oy + (btop + button_dy) * scale,
|
|
|
click=true,
|
|
|
background=true,
|
|
|
z=3
|
|
|
};
|
|
|
|
|
|
D {
|
|
|
buttons[5],
|
|
|
'img',
|
|
|
get_button(buttons[5]),
|
|
|
x=ox + (519 - button_dx / 2) * scale,
|
|
|
y=oy + (btop + button_dy) * scale,
|
|
|
click=true,
|
|
|
background=true,
|
|
|
z=3
|
|
|
};
|
|
|
end;
|
|
|
|
|
|
if sw > w or sh > h then
|
|
|
local bgframe_pixels = pixels.new('images/main_theme/text_bg.png');
|
|
|
local tbg, tbg_slice;
|
|
|
tbg, tbg_slice = dire_slice_9(bgframe_pixels, {
|
|
|
x = 9,
|
|
|
y = 6,
|
|
|
w = 96,
|
|
|
h = 96
|
|
|
});
|
|
|
|
|
|
local bgframe = pixels.new(978, 612);
|
|
|
dire_draw_9(tbg, bgframe, {x = 0; y = 0; w = 978; h = 612}, {parts=tbg_slice});
|
|
|
D {'bgframe', 'img', bgframe:scale(scale, scale):sprite(), x=ox - 9 * scale, y=oy - 6 * scale, w=w + 18 * scale, h=h + 12 * scale, background=true, z=5};
|
|
|
end;
|
|
|
|
|
|
if not D('background') then
|
|
|
D {'background', 'img', get_sprite('images/title/bg.png'), x=ox, y=oy, z=4, background=true};
|
|
|
end;
|
|
|
|
|
|
if not D('bganim') then
|
|
|
D {'bganim', 'img', get_sprite('images/title/bg_frames.png'), x=ox, y=oy, w=w, h=h, frames=16, z=3, delay=200, animated=true, background=true, frame_data=scale_frame_data({
|
|
|
{},
|
|
|
{x=0, y=0, w=960, h=302, dx=0, dy=0},
|
|
|
{x=960, y=0, w=960, h=302, dx=0, dy=0},
|
|
|
{x=1920, y=0, w=960, h=302, dx=0, dy=0},
|
|
|
{x=2880, y=0, w=960, h=302, dx=0, dy=0},
|
|
|
{x=0, y=302, w=960, h=302, dx=0, dy=0},
|
|
|
{x=960, y=302, w=960, h=302, dx=0, dy=0},
|
|
|
{x=1920, y=302, w=960, h=302, dx=0, dy=0},
|
|
|
{x=2880, y=302, w=960, h=302, dx=0, dy=0},
|
|
|
{x=0, y=604, w=960, h=302, dx=0, dy=0},
|
|
|
{x=960, y=604, w=960, h=302, dx=0, dy=0},
|
|
|
{x=1920, y=604, w=960, h=302, dx=0, dy=0},
|
|
|
{x=2880, y=604, w=960, h=302, dx=0, dy=0},
|
|
|
{x=0, y=906, w=960, h=302, dx=0, dy=0},
|
|
|
{x=960, y=906, w=960, h=302, dx=0, dy=0},
|
|
|
{x=1920, y=906, w=960, h=302, dx=0, dy=0}
|
|
|
})};
|
|
|
end;
|
|
|
if not D('title') then
|
|
|
D {'title', 'img', get_sprite('images/title/title.png', 'fuchsia'), x=ox + 230 * scale, y=oy + 88 * scale, z=2, background=true};
|
|
|
end;
|
|
|
|
|
|
if with_text then
|
|
|
D {'textbg', 'img', get_sprite('images/title/text_background.png', 'fuchsia'), x=ox + 180 * scale, z=1, y=oy + (126 + button_dy) * scale, background=true};
|
|
|
if sh < 520 * scale then
|
|
|
D {'title'}
|
|
|
else
|
|
|
D('title').y = oy + 40 * scale;
|
|
|
end;
|
|
|
else
|
|
|
D('title').y = oy + 88 * scale;
|
|
|
end;
|
|
|
|
|
|
timer:set(25);
|
|
|
end;
|
|
|
|
|
|
room {
|
|
|
nam = 'main';
|
|
|
notitle = true;
|
|
|
nosave = true;
|
|
|
noautosave = true;
|
|
|
noinv = true;
|
|
|
nofading = true;
|
|
|
disp = '';
|
|
|
theme = 'menu';
|
|
|
onenter = function(s)
|
|
|
in_game = false;
|
|
|
end;
|
|
|
themeInit = function(s)
|
|
|
init_menu(false, {'start', 'load', 'about', 'settings', 'quit'});
|
|
|
end;
|
|
|
themeDispose = function(s)
|
|
|
D {'start'};
|
|
|
D {'load'};
|
|
|
D {'about'};
|
|
|
D {'settings'};
|
|
|
D {'quit'};
|
|
|
timer:stop();
|
|
|
end;
|
|
|
ondecor = function(s, name, press, x, y, btn)
|
|
|
if press then
|
|
|
if name == 'start' then
|
|
|
walk('intro_start');
|
|
|
return true;
|
|
|
elseif name == 'load' then
|
|
|
instead.menu('load');
|
|
|
return true;
|
|
|
elseif name == 'about' then
|
|
|
walk('intro_info');
|
|
|
return true;
|
|
|
elseif name == 'settings' then
|
|
|
walk('intro_settings');
|
|
|
return true;
|
|
|
elseif name == 'quit' then
|
|
|
instead.menu('exit');
|
|
|
return true;
|
|
|
end;
|
|
|
end;
|
|
|
return false;
|
|
|
end;
|
|
|
enter = function(s)
|
|
|
if prefs.completed then
|
|
|
snd.music('sound/bgm_credits.ogg');
|
|
|
else
|
|
|
snd.music('sound/bgm_intro.ogg');
|
|
|
end;
|
|
|
end;
|
|
|
}
|
|
|
|
|
|
room {
|
|
|
nam = 'intro_start';
|
|
|
notitle = true;
|
|
|
nosave = true;
|
|
|
noautosave = true;
|
|
|
noinv = true;
|
|
|
nofading = true;
|
|
|
disp = '';
|
|
|
theme = 'menu';
|
|
|
themeInit = function(s)
|
|
|
init_menu(true, {'back', 'tutorial', 'start'});
|
|
|
end;
|
|
|
themeDispose = function(s)
|
|
|
D {'back'};
|
|
|
D {'tutorial'};
|
|
|
D {'start'};
|
|
|
D {'textbg'};
|
|
|
timer:stop();
|
|
|
end;
|
|
|
ondecor = function(s, name, press, x, y, btn)
|
|
|
if press then
|
|
|
if name == 'start' then
|
|
|
walk('above_forest');
|
|
|
in_game = true;
|
|
|
return true;
|
|
|
elseif name == 'tutorial' then
|
|
|
walk('tutorial_start');
|
|
|
in_game = true;
|
|
|
return true;
|
|
|
elseif name == 'back' then
|
|
|
walk('main');
|
|
|
return true;
|
|
|
end;
|
|
|
end;
|
|
|
return false;
|
|
|
end;
|
|
|
decor = translate("menu_locale", 'intro');
|
|
|
}
|
|
|
|
|
|
room {
|
|
|
nam = 'intro_info';
|
|
|
notitle = true;
|
|
|
nosave = true;
|
|
|
noautosave = true;
|
|
|
noinv = true;
|
|
|
nofading = true;
|
|
|
disp = '';
|
|
|
theme = 'menu';
|
|
|
themeInit = function(s)
|
|
|
init_menu(true, {'back'});
|
|
|
end;
|
|
|
themeDispose = function(s)
|
|
|
D {'start'};
|
|
|
D {'back'};
|
|
|
D {'settings'};
|
|
|
D {'textbg'};
|
|
|
timer:stop();
|
|
|
end;
|
|
|
ondecor = function(s, name, press, x, y, btn)
|
|
|
if press then
|
|
|
if name == 'back' then
|
|
|
if in_game then
|
|
|
walk('menu');
|
|
|
else
|
|
|
walk('main');
|
|
|
end;
|
|
|
return true;
|
|
|
end;
|
|
|
end;
|
|
|
return false;
|
|
|
end;
|
|
|
decor = function(s)
|
|
|
return translate_now("menu_locale", 'credits_author') .. ': Khaelenmore Thaal^' ..
|
|
|
translate_now("menu_locale", 'credits_art') .. ': Sabra Naikomy^' ..
|
|
|
translate_now("menu_locale", 'credits_music') .. ': Khaelenmore Thaal^' ..
|
|
|
translate_now("menu_locale", 'credits_engine') .. ': INSTEAD ' .. translate_now("menu_locale", 'credits_engine_author') .. ' {$link https://github.com/instead-hub/instead/}^' ..
|
|
|
translate_now("menu_locale", 'credits_sounds') .. ': {$link https://freesound.org/} CC-0^' ..
|
|
|
translate_now("menu_locale", 'credits_fonts') .. ': VileR {$link https://int10h.org/oldschool-pc-fonts/} CC-BY-SA 4.0^^' ..
|
|
|
translate_now("menu_locale", 'credits_closed_beta') .. ': ' .. closed_beta_participants .. '^^'..
|
|
|
translate_now("menu_locale", 'credits_thanks');
|
|
|
end;
|
|
|
}
|
|
|
|
|
|
obj {
|
|
|
nam = 'empty';
|
|
|
dsc = '^';
|
|
|
}
|
|
|
|
|
|
room {
|
|
|
nam = 'intro_settings';
|
|
|
nofollow = true;
|
|
|
notitle = true;
|
|
|
nosave = true;
|
|
|
noautosave = true;
|
|
|
noinv = true;
|
|
|
nofading = true;
|
|
|
disp = '';
|
|
|
theme = 'menu';
|
|
|
themeInit = function(s)
|
|
|
init_menu(true, {'back'});
|
|
|
end;
|
|
|
themeDispose = function(s)
|
|
|
D {'start'};
|
|
|
D {'about'};
|
|
|
D {'back'};
|
|
|
D {'textbg'};
|
|
|
timer:stop();
|
|
|
end;
|
|
|
ondecor = function(s, name, press, x, y, btn)
|
|
|
if press then
|
|
|
if name == 'back' then
|
|
|
if in_game then
|
|
|
stop_menu();
|
|
|
walkback();
|
|
|
else
|
|
|
walk('main');
|
|
|
end;
|
|
|
return true;
|
|
|
end;
|
|
|
end;
|
|
|
return false;
|
|
|
end;
|
|
|
}:with {
|
|
|
obj {
|
|
|
nam = '#system_settings';
|
|
|
dsc = function(s)
|
|
|
return fmt.c(fmt.b('{[' .. translate_now("menu_locale", 'system_settings') .. ']}^^'));
|
|
|
end;
|
|
|
act = function(s)
|
|
|
instead.menu('settings');
|
|
|
end;
|
|
|
};
|
|
|
obj {
|
|
|
nam = '#language';
|
|
|
dsc = function(s)
|
|
|
local l = translate_now("menu_locale", 'auto_option');
|
|
|
|
|
|
|
|
|
pn(fmt.c(fmt.b(translate_now("menu_locale", 'language'))));
|
|
|
|
|
|
local t;
|
|
|
if get_language_saved() == '' then
|
|
|
t = l;
|
|
|
else
|
|
|
t = '{#l_auto|'.. l .. '}';
|
|
|
end;
|
|
|
|
|
|
for i, language in ipairs(get_language_list()) do
|
|
|
if get_language_saved() == language[1] then
|
|
|
t = t .. ' | ' .. language[2];
|
|
|
else
|
|
|
t = t .. ' | ' .. '{@set_language ' .. language[1] .. '|' .. language[2] .. '}';
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
pn(fmt.c(t) .. '^')
|
|
|
end;
|
|
|
}: with {
|
|
|
obj {
|
|
|
nam = '#l_auto';
|
|
|
act = function(s)
|
|
|
set_language('');
|
|
|
walk(here());
|
|
|
end;
|
|
|
};
|
|
|
};
|
|
|
obj {
|
|
|
nam = '#graphics_scale';
|
|
|
dsc = function(s)
|
|
|
local graphic_scale = get_graphic_scale();
|
|
|
|
|
|
pn(fmt.c(fmt.b(translate_now("menu_locale", 'graphic_scale')) .. ' {[' .. translate_now("menu_locale", 'auto_option') .. ']}'))
|
|
|
|
|
|
local t = '';
|
|
|
|
|
|
if graphic_scale > 1 then
|
|
|
t = t .. '{#g_less|<<} ';
|
|
|
else
|
|
|
t = t .. '<< ';
|
|
|
end;
|
|
|
|
|
|
local l = translate_now("menu_locale", 'auto_option') .. ' (' .. tostring(graphic_scale * 100) .. '%)';
|
|
|
|
|
|
|
|
|
if prefs.graphic_scale then
|
|
|
l = tostring(graphic_scale * 100) .. '%';
|
|
|
end;
|
|
|
|
|
|
t = t .. l;
|
|
|
|
|
|
local w, h = diretheme.get_screen();
|
|
|
|
|
|
local wsmax = math.floor(w / 640);
|
|
|
local smax = math.floor(h / 480);
|
|
|
if wsmax < smax then
|
|
|
smax = wsmax;
|
|
|
end;
|
|
|
|
|
|
if smax < 1 then
|
|
|
smax = 1;
|
|
|
end;
|
|
|
|
|
|
if graphic_scale < smax then
|
|
|
t = t .. ' {#g_more|>>}';
|
|
|
else
|
|
|
t = t .. ' >>';
|
|
|
end;
|
|
|
|
|
|
pn(fmt.c(t) .. '^');
|
|
|
end;
|
|
|
act = function(s)
|
|
|
prefs.graphic_scale = false;
|
|
|
prefs:store();
|
|
|
|
|
|
set_theme(std.call(here(), 'theme'));
|
|
|
menu_sprites = {};
|
|
|
here():themeDispose();
|
|
|
stop_menu();
|
|
|
here():themeInit();
|
|
|
walk(here());
|
|
|
end;
|
|
|
}: with {
|
|
|
obj {
|
|
|
nam = '#g_less';
|
|
|
act = function(s)
|
|
|
prefs.graphic_scale = get_graphic_scale() - 1;
|
|
|
|
|
|
prefs:store();
|
|
|
|
|
|
set_theme(std.call(here(), 'theme'));
|
|
|
menu_sprites = {};
|
|
|
here():themeDispose();
|
|
|
stop_menu();
|
|
|
here():themeInit();
|
|
|
walk(here());
|
|
|
end;
|
|
|
};
|
|
|
obj {
|
|
|
nam = '#g_more';
|
|
|
act = function(s)
|
|
|
prefs.graphic_scale = get_graphic_scale() + 1;
|
|
|
|
|
|
prefs:store();
|
|
|
|
|
|
set_theme(std.call(here(), 'theme'));
|
|
|
menu_sprites = {};
|
|
|
here():themeDispose();
|
|
|
stop_menu();
|
|
|
here():themeInit();
|
|
|
walk(here());
|
|
|
end;
|
|
|
};
|
|
|
};
|
|
|
obj {
|
|
|
nam = '#cursor_scale';
|
|
|
dsc = function(s)
|
|
|
local cursor_scale = get_cursor_scale();
|
|
|
|
|
|
pn(fmt.c(fmt.b(translate_now("menu_locale", 'cursor_scale')) .. ' {[' .. translate_now("menu_locale", 'auto_option') .. ']}'))
|
|
|
|
|
|
local t = '';
|
|
|
|
|
|
if cursor_scale > 1 then
|
|
|
t = t .. '{#cursor_less|<<} ';
|
|
|
else
|
|
|
t = t .. '<< ';
|
|
|
end;
|
|
|
|
|
|
local l = translate_now("menu_locale", 'auto_option') .. ' (' .. tostring(cursor_scale * 100) .. '%)';
|
|
|
|
|
|
if prefs.cursor_scale then
|
|
|
l = tostring(cursor_scale * 100) .. '%';
|
|
|
end;
|
|
|
|
|
|
t = t .. l;
|
|
|
|
|
|
local w, h = diretheme.get_screen();
|
|
|
|
|
|
local wsmax = math.floor(w / 640);
|
|
|
local smax = math.floor(h / 480);
|
|
|
if wsmax < smax then
|
|
|
smax = wsmax;
|
|
|
end;
|
|
|
|
|
|
if smax < 1 then
|
|
|
smax = 1;
|
|
|
end;
|
|
|
|
|
|
if cursor_scale < smax then
|
|
|
t = t .. ' {#cursor_more|>>}';
|
|
|
else
|
|
|
t = t .. ' >>';
|
|
|
end;
|
|
|
|
|
|
pn(fmt.c(t) .. '^');
|
|
|
end;
|
|
|
act = function(s)
|
|
|
prefs.cursor_scale = false;
|
|
|
prefs:store();
|
|
|
|
|
|
set_theme(std.call(here(), 'theme'));
|
|
|
menu_sprites = {};
|
|
|
here():themeDispose();
|
|
|
stop_menu();
|
|
|
here():themeInit();
|
|
|
walk(here());
|
|
|
end;
|
|
|
}: with {
|
|
|
obj {
|
|
|
nam = '#cursor_less';
|
|
|
act = function(s)
|
|
|
prefs.cursor_scale = get_cursor_scale() - 1;
|
|
|
|
|
|
prefs:store();
|
|
|
|
|
|
set_theme(std.call(here(), 'theme'));
|
|
|
menu_sprites = {};
|
|
|
here():themeDispose();
|
|
|
stop_menu();
|
|
|
here():themeInit();
|
|
|
walk(here());
|
|
|
end;
|
|
|
};
|
|
|
obj {
|
|
|
nam = '#cursor_more';
|
|
|
act = function(s)
|
|
|
prefs.cursor_scale = get_cursor_scale() + 1;
|
|
|
|
|
|
prefs:store();
|
|
|
|
|
|
set_theme(std.call(here(), 'theme'));
|
|
|
menu_sprites = {};
|
|
|
here():themeDispose();
|
|
|
stop_menu();
|
|
|
here():themeInit();
|
|
|
walk(here());
|
|
|
end;
|
|
|
};
|
|
|
};
|
|
|
obj {
|
|
|
nam = '#font_scale';
|
|
|
dsc = function(s)
|
|
|
local graphic_scale = get_graphic_scale();
|
|
|
local font_scale = get_font_scale();
|
|
|
|
|
|
pn(fmt.c(fmt.b(translate_now("menu_locale", 'font_scale')) .. ' {[' .. translate_now("menu_locale", 'auto_option') .. ']}'));
|
|
|
|
|
|
local t = '';
|
|
|
|
|
|
if font_scale > 50 then
|
|
|
t = t .. '{#f_less|<<} ';
|
|
|
else
|
|
|
t = t .. '<< ';
|
|
|
end;
|
|
|
|
|
|
if prefs.font_scale then
|
|
|
t = t .. tostring(font_scale) .. '%';
|
|
|
else
|
|
|
t = t .. translate_now("menu_locale", 'auto_option') .. ' (' .. tostring(font_scale) .. '%)';
|
|
|
end;
|
|
|
|
|
|
|
|
|
if font_scale < graphic_scale * 200 then
|
|
|
t = t .. ' {#f_more|>>}';
|
|
|
else
|
|
|
t = t .. ' >>';
|
|
|
end;
|
|
|
|
|
|
pn(fmt.c(t) .. '^');
|
|
|
end;
|
|
|
act = function(s)
|
|
|
prefs.font_scale = false;
|
|
|
|
|
|
prefs:store();
|
|
|
set_theme(std.call(here(), 'theme'));
|
|
|
walk(here());
|
|
|
end;
|
|
|
}: with {
|
|
|
obj {
|
|
|
nam = '#f_less';
|
|
|
act = function(s)
|
|
|
prefs.font_scale = get_font_scale() - 10;
|
|
|
|
|
|
prefs:store();
|
|
|
set_theme(std.call(here(), 'theme'));
|
|
|
walk(here());
|
|
|
end;
|
|
|
};
|
|
|
obj {
|
|
|
nam = '#f_more';
|
|
|
act = function(s)
|
|
|
prefs.font_scale = get_font_scale() + 10;
|
|
|
|
|
|
prefs:store();
|
|
|
set_theme(std.call(here(), 'theme'));
|
|
|
walk(here());
|
|
|
end;
|
|
|
};
|
|
|
};
|
|
|
obj {
|
|
|
nam = '#inv_font_scale';
|
|
|
dsc = function(s)
|
|
|
local graphic_scale = get_graphic_scale();
|
|
|
local font_scale = get_inventory_font_scale();
|
|
|
|
|
|
pn(fmt.c(fmt.b(translate_now("menu_locale", 'inventory_scale')) .. ' {[' .. translate_now("menu_locale", 'auto_option') .. ']}'));
|
|
|
|
|
|
local t = '';
|
|
|
|
|
|
if font_scale > 50 then
|
|
|
t = t .. '{#if_less|<<} ';
|
|
|
else
|
|
|
t = t .. '<< ';
|
|
|
end;
|
|
|
|
|
|
if prefs.inventory_scale then
|
|
|
t = t .. tostring(font_scale) .. '%';
|
|
|
else
|
|
|
t = t .. translate_now("menu_locale", 'auto_option') .. ' (' .. tostring(font_scale) .. '%)';
|
|
|
end;
|
|
|
|
|
|
|
|
|
if font_scale < graphic_scale * 200 then
|
|
|
t = t .. ' {#if_more|>>}';
|
|
|
else
|
|
|
t = t .. ' >>';
|
|
|
end;
|
|
|
|
|
|
pn(fmt.c(t) .. '^');
|
|
|
end;
|
|
|
act = function(s)
|
|
|
prefs.inventory_scale = false;
|
|
|
|
|
|
prefs:store();
|
|
|
set_theme(std.call(here(), 'theme'));
|
|
|
walk(here());
|
|
|
end;
|
|
|
}: with {
|
|
|
obj {
|
|
|
nam = '#if_less';
|
|
|
act = function(s)
|
|
|
prefs.inventory_scale = get_inventory_font_scale() - 10;
|
|
|
|
|
|
prefs:store();
|
|
|
set_theme(std.call(here(), 'theme'));
|
|
|
walk(here());
|
|
|
end;
|
|
|
};
|
|
|
obj {
|
|
|
nam = '#if_more';
|
|
|
act = function(s)
|
|
|
prefs.inventory_scale = get_inventory_font_scale() + 10;
|
|
|
|
|
|
prefs:store();
|
|
|
set_theme(std.call(here(), 'theme'));
|
|
|
walk(here());
|
|
|
end;
|
|
|
};
|
|
|
};
|
|
|
obj {
|
|
|
nam = '#text_width';
|
|
|
dsc = function(s)
|
|
|
pn(fmt.c(fmt.b(translate_now("menu_locale", 'text_width'))));
|
|
|
local t = '';
|
|
|
if prefs.text_width > 40 then
|
|
|
t = t .. '{#fw_less|<<} ';
|
|
|
else
|
|
|
t = t .. '<< ';
|
|
|
end;
|
|
|
|
|
|
t = t .. tostring(prefs.text_width) .. '%';
|
|
|
|
|
|
if prefs.text_width < 100 then
|
|
|
t = t .. ' {#fw_more|>>}';
|
|
|
else
|
|
|
t = t .. ' >>';
|
|
|
end;
|
|
|
|
|
|
pn(fmt.c(t) .. '^');
|
|
|
end;
|
|
|
act = function(s)
|
|
|
if not prefs.text_width then
|
|
|
prefs.text_width = 100;
|
|
|
end;
|
|
|
|
|
|
prefs.text_width = prefs.text_width + 20;
|
|
|
|
|
|
if prefs.text_width > 100 then
|
|
|
prefs.text_width = 40;
|
|
|
end;
|
|
|
|
|
|
prefs:store();
|
|
|
|
|
|
walk(here());
|
|
|
end;
|
|
|
}: with {
|
|
|
obj {
|
|
|
nam = '#fw_less';
|
|
|
act = function(s)
|
|
|
prefs.text_width = prefs.text_width - 10;
|
|
|
|
|
|
prefs:store();
|
|
|
set_theme(std.call(here(), 'theme'));
|
|
|
walk(here());
|
|
|
end;
|
|
|
};
|
|
|
obj {
|
|
|
nam = '#fw_more';
|
|
|
act = function(s)
|
|
|
prefs.text_width = prefs.text_width + 10;
|
|
|
|
|
|
prefs:store();
|
|
|
set_theme(std.call(here(), 'theme'));
|
|
|
walk(here());
|
|
|
end;
|
|
|
};
|
|
|
};
|
|
|
obj {
|
|
|
nam = '#text_alignment';
|
|
|
dsc = function(s)
|
|
|
pn(fmt.c(fmt.b(translate_now("menu_locale", 'text_alignment'))));
|
|
|
|
|
|
local t = '';
|
|
|
|
|
|
if prefs.text_alignment == 1 then
|
|
|
t = t .. translate_now("menu_locale", 'text_alignment_justify') .. ' | ';
|
|
|
else
|
|
|
t = t .. '{#align_just|' .. translate_now("menu_locale", 'text_alignment_justify') .. '} | ';
|
|
|
end;
|
|
|
|
|
|
|
|
|
if prefs.text_alignment == 2 then
|
|
|
t = t .. translate_now("menu_locale", 'text_alignment_left');
|
|
|
else
|
|
|
t = t .. '{#align_left|' .. translate_now("menu_locale", 'text_alignment_left') .. '}';
|
|
|
end;
|
|
|
pn(fmt.c(t) .. '^');
|
|
|
end;
|
|
|
}: with {
|
|
|
obj {
|
|
|
nam = '#align_just';
|
|
|
act = function(s)
|
|
|
prefs.text_alignment = 1;
|
|
|
|
|
|
prefs:store();
|
|
|
set_theme(std.call(here(), 'theme'));
|
|
|
walk(here());
|
|
|
end;
|
|
|
};
|
|
|
obj {
|
|
|
nam = '#align_left';
|
|
|
act = function(s)
|
|
|
prefs.text_alignment = 2;
|
|
|
|
|
|
prefs:store();
|
|
|
set_theme(std.call(here(), 'theme'));
|
|
|
walk(here());
|
|
|
end;
|
|
|
};
|
|
|
};
|
|
|
obj {
|
|
|
nam = '#padding';
|
|
|
dsc = function(s)
|
|
|
pn(fmt.c(fmt.b(translate_now("menu_locale", 'padding'))));
|
|
|
|
|
|
local t = '';
|
|
|
|
|
|
if prefs.text_padding == 1 then
|
|
|
t = t .. translate_now("menu_locale", 'normal') .. ' | ';
|
|
|
else
|
|
|
t = t .. '{#pad_norm|' .. translate_now("menu_locale", 'normal') .. '} | ';
|
|
|
end;
|
|
|
|
|
|
|
|
|
if prefs.text_padding == 2 then
|
|
|
t = t .. translate_now("menu_locale", 'extended');
|
|
|
else
|
|
|
t = t .. '{#pad_large|' .. translate_now("menu_locale", 'extended') .. '}';
|
|
|
end;
|
|
|
pn(fmt.c(t) .. '^');
|
|
|
end;
|
|
|
}: with {
|
|
|
obj {
|
|
|
nam = '#pad_norm';
|
|
|
act = function(s)
|
|
|
prefs.text_padding = 1;
|
|
|
|
|
|
prefs:store();
|
|
|
set_theme(std.call(here(), 'theme'));
|
|
|
walk(here());
|
|
|
end;
|
|
|
};
|
|
|
obj {
|
|
|
nam = '#pad_large';
|
|
|
act = function(s)
|
|
|
prefs.text_padding = 2;
|
|
|
|
|
|
prefs:store();
|
|
|
set_theme(std.call(here(), 'theme'));
|
|
|
walk(here());
|
|
|
end;
|
|
|
};
|
|
|
};
|
|
|
obj {
|
|
|
nam = '#interval';
|
|
|
dsc = function(s)
|
|
|
pn(fmt.c(fmt.b(translate_now("menu_locale", 'interval'))));
|
|
|
|
|
|
local t = '';
|
|
|
|
|
|
if prefs.text_interval == 1 then
|
|
|
t = t .. translate_now("menu_locale", 'normal') .. ' | ';
|
|
|
else
|
|
|
t = t .. '{#int_norm|' .. translate_now("menu_locale", 'normal') .. '} | ';
|
|
|
end;
|
|
|
|
|
|
|
|
|
if prefs.text_interval == 2 then
|
|
|
t = t .. translate_now("menu_locale", 'extended');
|
|
|
else
|
|
|
t = t .. '{#int_large|' .. translate_now("menu_locale", 'extended') .. '}';
|
|
|
end;
|
|
|
pn(fmt.c(t) .. '^');
|
|
|
end;
|
|
|
}: with {
|
|
|
obj {
|
|
|
nam = '#int_norm';
|
|
|
act = function(s)
|
|
|
prefs.text_interval = 1;
|
|
|
|
|
|
prefs:store();
|
|
|
set_theme(std.call(here(), 'theme'));
|
|
|
walk(here());
|
|
|
end;
|
|
|
};
|
|
|
obj {
|
|
|
nam = '#int_large';
|
|
|
act = function(s)
|
|
|
prefs.text_interval = 2;
|
|
|
|
|
|
prefs:store();
|
|
|
set_theme(std.call(here(), 'theme'));
|
|
|
walk(here());
|
|
|
end;
|
|
|
};
|
|
|
};
|
|
|
obj {
|
|
|
nam = '#textinput';
|
|
|
dsc = function(s)
|
|
|
pn(fmt.c(fmt.b(translate_now("menu_locale", 'use_text_input'))));
|
|
|
|
|
|
local t = '';
|
|
|
if prefs.text_input then
|
|
|
t = '{#ti_disable|' .. translate_now("menu_locale", 'disable') .. '} | ' .. translate_now("menu_locale", 'enable');
|
|
|
else
|
|
|
t = translate_now("menu_locale", 'disable') .. ' | {#ti_enable|' .. translate_now("menu_locale", 'enable') .. '}';
|
|
|
end;
|
|
|
|
|
|
pn(fmt.c(t) .. '^');
|
|
|
end;
|
|
|
}: with {
|
|
|
obj {
|
|
|
nam = '#ti_disable';
|
|
|
act = function(s)
|
|
|
prefs.text_input = false;
|
|
|
prefs:store();
|
|
|
walk(here());
|
|
|
end;
|
|
|
};
|
|
|
obj {
|
|
|
nam = '#ti_enable';
|
|
|
act = function(s)
|
|
|
prefs.text_input = true;
|
|
|
prefs:store();
|
|
|
walk(here());
|
|
|
end;
|
|
|
};
|
|
|
};
|
|
|
}
|
|
|
|
|
|
room {
|
|
|
nosave = true;
|
|
|
noautosave = true;
|
|
@@ -1192,633 +294,16 @@ room {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function set_theme(t)
|
|
|
-- resetting defaults
|
|
|
fmt.para = true;
|
|
|
std.scene_delim = '^^';
|
|
|
theme.set('snd.click', 'sound/click.wav');
|
|
|
|
|
|
D {'settings_open'};
|
|
|
|
|
|
local tname, tcolor_text, tcolor_link, tcolor_alink;
|
|
|
|
|
|
local width, height = diretheme.get_screen();
|
|
|
|
|
|
-- 640x480 is the base size
|
|
|
local scale = get_graphic_scale();
|
|
|
local max_scale_x = math.floor(width / 640);
|
|
|
local max_scale_y = math.floor(height / 480);
|
|
|
-- Fail-safe for too small screen
|
|
|
if max_scale_x < 1 then max_scale_x = 1; end;
|
|
|
if max_scale_y < 1 then max_scale_y = 1; end;
|
|
|
|
|
|
local max_scale = math.min(max_scale_x, max_scale_y);
|
|
|
|
|
|
if scale > max_scale then
|
|
|
scale = max_scale;
|
|
|
prefs.graphic_scale = false;
|
|
|
end;
|
|
|
|
|
|
local cursor_scale = get_cursor_scale();
|
|
|
if cursor_scale > 2 * max_scale then
|
|
|
cursor_scale = 2 * max_scale;
|
|
|
end;
|
|
|
|
|
|
local font_scale = get_font_scale() / 100;
|
|
|
if font_scale > 2 * scale then
|
|
|
font_scale = scale;
|
|
|
prefs.font_scale = font_scale * 100
|
|
|
end;
|
|
|
|
|
|
local inv_scale = get_inventory_font_scale() / 100;
|
|
|
|
|
|
local text_align = 'justify';
|
|
|
if prefs.text_alignment == 2 then
|
|
|
text_align = 'left';
|
|
|
end;
|
|
|
|
|
|
local hpadding, vpadding = 0, 0;
|
|
|
if prefs.text_padding == 2 then
|
|
|
hpadding, vpadding = 24, 12;
|
|
|
end;
|
|
|
|
|
|
local interval = '1.0';
|
|
|
if prefs.text_interval == 2 then
|
|
|
interval = '1.5';
|
|
|
end;
|
|
|
|
|
|
local canvas = diretheme.set_canvas({rmax = 2, rmin = 1});
|
|
|
diretheme.set_scale(scale);
|
|
|
|
|
|
local scaled_width, scaled_height = diretheme.get_scaled_screen();
|
|
|
|
|
|
current_theme = t;
|
|
|
local tvariant = 0;
|
|
|
if t:match("_bw$") then
|
|
|
t = t:gsub("_bw$", "");
|
|
|
tvariant = 1;
|
|
|
end;
|
|
|
|
|
|
-- Most text area settings are per-theme
|
|
|
local text_area = {};
|
|
|
|
|
|
-- Hide inventory by default
|
|
|
local inventory = {
|
|
|
rect = {
|
|
|
lx = width + 1,
|
|
|
y = 0,
|
|
|
wmax = 1,
|
|
|
wmin = 1,
|
|
|
ty = 2,
|
|
|
by = 2,
|
|
|
ax = 1
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-- And image
|
|
|
local image_area = {
|
|
|
rect = {
|
|
|
lx = width + 1,
|
|
|
ax = 1,
|
|
|
wmax = 584,
|
|
|
hmax = 258,
|
|
|
wmin = 584,
|
|
|
hmin = 258
|
|
|
};
|
|
|
bg = {};
|
|
|
mode = 'float';
|
|
|
};
|
|
|
|
|
|
-- Preset colors
|
|
|
local theme_directory = nil;
|
|
|
local text_color, link_color, alink_color;
|
|
|
local inv_color, inv_link, inv_alink;
|
|
|
if t == 'terminal' or t == 'black' then
|
|
|
diretheme.set_canvas({
|
|
|
lx = 0, ty = 0, rx = 0, by = 0
|
|
|
});
|
|
|
text_color = '#D0FFFF';
|
|
|
link_color = '#ABDECE';
|
|
|
alink_color = '#9BCEBE';
|
|
|
theme_directory = 'images/tower_theme';
|
|
|
|
|
|
text_area.text = {
|
|
|
font = 'fonts/vga.ttf',
|
|
|
color = text_color,
|
|
|
link = link_color,
|
|
|
alink = alink_color,
|
|
|
size = 16
|
|
|
};
|
|
|
else
|
|
|
canvas = diretheme.set_canvas({
|
|
|
lx = 0, ty = 0, rx = 0, by = 0, rmin = 1.2, rmax = 1.8
|
|
|
});
|
|
|
|
|
|
if t == 'menu' or t == 'main' or t == 'ending_outside' or t == 'credits_outside' then
|
|
|
inv_color = '#403426';
|
|
|
inv_link = '#403426';
|
|
|
inv_alink = '#61503A';
|
|
|
|
|
|
if tvariant == 0 then
|
|
|
text_color = '#000504';
|
|
|
link_color = '#80382A';
|
|
|
alink_color = '#80605D';
|
|
|
theme_directory = 'images/main_theme';
|
|
|
else
|
|
|
text_color = '#040404';
|
|
|
link_color = '#434343';
|
|
|
alink_color = '#585858';
|
|
|
theme_directory = 'images/bwm_theme';
|
|
|
end;
|
|
|
|
|
|
text_area.uppos = {ax=1, x = 12, y = 0, ay=-1};
|
|
|
text_area.downpos = {ax=1, x = 12, y = 0, ay=1};
|
|
|
text_area.bg = {
|
|
|
image = theme_directory .. '/text_bg.png',
|
|
|
options = {
|
|
|
mode = 6,
|
|
|
drawmethod = 2,
|
|
|
slice = {
|
|
|
x = 9,
|
|
|
y = 6,
|
|
|
w = 96,
|
|
|
h = 96
|
|
|
},
|
|
|
scale = true
|
|
|
}
|
|
|
};
|
|
|
elseif t == 'tower' or t == 'ending_inside' or t == 'credits_inside' then
|
|
|
inv_color = '#6b9e8e';
|
|
|
inv_link = '#9bcebe';
|
|
|
inv_alink = '#Bbeede';
|
|
|
|
|
|
if tvariant == 0 then
|
|
|
text_color = '#93DDCD';
|
|
|
link_color = '#E0F0EA';
|
|
|
alink_color = '#FFFFFF';
|
|
|
theme_directory = 'images/tower_theme';
|
|
|
else
|
|
|
text_color = '#ADADAD';
|
|
|
link_color = '#CDCDCD';
|
|
|
alink_color = '#BDBDBD';
|
|
|
theme_directory = 'images/bwt_theme';
|
|
|
end;
|
|
|
|
|
|
text_area.uppos = {ax=1, x = 16, y = 0, ay=-1};
|
|
|
text_area.downpos = {ax=1, x = 16, y = 0, ay=1};
|
|
|
text_area.bg = {
|
|
|
image = theme_directory .. '/text_bg.png',
|
|
|
options = {
|
|
|
mode = 6,
|
|
|
drawmethod = 2,
|
|
|
slice = {
|
|
|
x = 6,
|
|
|
y = 6,
|
|
|
w = 128,
|
|
|
h = 128
|
|
|
},
|
|
|
scale = true
|
|
|
}
|
|
|
};
|
|
|
end;
|
|
|
|
|
|
if t == 'ending_inside' or t == 'ending_outside' then
|
|
|
canvas = diretheme.set_canvas({
|
|
|
lx = 0, ty = 0, rx = 0, by = 0
|
|
|
});
|
|
|
end;
|
|
|
|
|
|
text_area.align = text_align;
|
|
|
text_area.height = interval;
|
|
|
text_area.scaleui = true;
|
|
|
text_area.up = theme_directory .. '/arrow_up.png';
|
|
|
text_area.down = theme_directory .. '/arrow_down.png';
|
|
|
text_area.text = {
|
|
|
font = 'fonts/{sans,sans-b,sans-i,sans-bi}.ttf',
|
|
|
color = text_color,
|
|
|
link = link_color,
|
|
|
alink = alink_color,
|
|
|
size = math.floor(16 * font_scale),
|
|
|
noscale = true
|
|
|
};
|
|
|
|
|
|
inventory.up = theme_directory .. '/arrow_up.png';
|
|
|
inventory.down = theme_directory .. '/arrow_down.png';
|
|
|
inventory.uppos = {ax=1, x = 8, y = 0, ay=-1};
|
|
|
inventory.downpos = {ax=1, x = 8, y = 0, ay=1};
|
|
|
inventory.text = {
|
|
|
color = inv_color,
|
|
|
link = inv_link,
|
|
|
alink = inv_alink,
|
|
|
size = math.floor(16 * inv_scale),
|
|
|
noscale = true
|
|
|
};
|
|
|
inventory.height = interval;
|
|
|
end;
|
|
|
|
|
|
if t == 'main' or t == 'tower' then
|
|
|
std.scene_delim = '^' .. fmt.c(fmt.img(theme_directory .. '/line_separator.png')) .. '^'
|
|
|
end;
|
|
|
|
|
|
-- And menu, but need theme_directory to have proper button image
|
|
|
local menu = {
|
|
|
button = {
|
|
|
image = theme_directory ..'/menu.png';
|
|
|
options = {
|
|
|
mode = 1,
|
|
|
scale = true
|
|
|
}
|
|
|
};
|
|
|
buttonrect = {
|
|
|
x = width + 1,
|
|
|
y = 0,
|
|
|
w = 50,
|
|
|
h = 16
|
|
|
};
|
|
|
text = {
|
|
|
size = math.floor(15 * font_scale),
|
|
|
noscale = true
|
|
|
},
|
|
|
height = interval,
|
|
|
scaleui = true;
|
|
|
};
|
|
|
|
|
|
local cursor, active_cursor = 'images/cursor.png', 'images/cursor_active.png';
|
|
|
if tvariant == 1 then
|
|
|
cursor, active_cursor = 'images/cursor_bw.png', 'images/cursor_active_bw.png'
|
|
|
end;
|
|
|
|
|
|
diretheme.set_cursor({
|
|
|
x = 2,
|
|
|
y = 2,
|
|
|
normal = cursor,
|
|
|
active = active_cursor,
|
|
|
scale = true;
|
|
|
scalefactor = cursor_scale;
|
|
|
});
|
|
|
|
|
|
if t == 'menu' then
|
|
|
diretheme.set_background('#89C6AE', 255, 'images/main_theme/background.png', {mode=2, scale=true});
|
|
|
local padding_delta = -10;
|
|
|
if height < 520 * scale then
|
|
|
padding_delta = -95;
|
|
|
end;
|
|
|
|
|
|
text_area.rect = {
|
|
|
ty = padding_delta + vpadding,
|
|
|
wmax = 538 - hpadding * 2,
|
|
|
hmax = 322 - vpadding * 2,
|
|
|
ay = 0
|
|
|
};
|
|
|
text_area.text = text_area.text;
|
|
|
text_area.uppos = {ax=1, x = 15, y = 65, ay=-1};
|
|
|
text_area.downpos = {ax=1, x = 15, y = -20, ay=1};
|
|
|
text_area.contentrect = {wf=prefs.text_width / 100};
|
|
|
text_area.bg = '';
|
|
|
elseif t == 'main' then
|
|
|
diretheme.set_background('#89C6AE', 255, 'images/main_theme/background.png', {mode=2, scale = true});
|
|
|
|
|
|
local image_bg = 'images/main_theme/picture_bg.png';
|
|
|
if canvas.w < 800 * scale then
|
|
|
image_bg = 'images/main_theme/picture_bg_small.png';
|
|
|
end;
|
|
|
|
|
|
image_area.leftof = 'inv';
|
|
|
image_area.topof = 'text';
|
|
|
image_area.rect = {
|
|
|
ax = 0,
|
|
|
wmax = 584,
|
|
|
hmax = 265,
|
|
|
wmin = 584,
|
|
|
hmin = 265
|
|
|
};
|
|
|
image_area.contentrect = {
|
|
|
ax = 0,
|
|
|
ay = -1,
|
|
|
ty = 11,
|
|
|
wmin = 320,
|
|
|
hmin = 240,
|
|
|
wmax = 320,
|
|
|
hmax = 240
|
|
|
};
|
|
|
image_area.bg = {
|
|
|
image = image_bg,
|
|
|
options = {
|
|
|
mode = 1,
|
|
|
scale = true
|
|
|
}
|
|
|
};
|
|
|
|
|
|
text_area.leftof = 'inv';
|
|
|
text_area.rect = {
|
|
|
lx = 7,
|
|
|
ty = 266,
|
|
|
rx = 8,
|
|
|
by = 2,
|
|
|
ax = 1,
|
|
|
ay = 1
|
|
|
};
|
|
|
text_area.contentrect = {
|
|
|
lx = 21 + hpadding,
|
|
|
rx = 21 + hpadding,
|
|
|
ty = 14 + vpadding,
|
|
|
by = 14 + vpadding,
|
|
|
wf=prefs.text_width / 100
|
|
|
};
|
|
|
|
|
|
inventory.rect = {
|
|
|
rx = 2,
|
|
|
y = 2,
|
|
|
wmax = 208,
|
|
|
wmin = 208,
|
|
|
ty = 2,
|
|
|
by = 2,
|
|
|
ax = 1
|
|
|
};
|
|
|
inventory.contentrect = {
|
|
|
lx = 25,
|
|
|
rx = 25,
|
|
|
ty = 40,
|
|
|
by = 40
|
|
|
};
|
|
|
inventory.bg = {
|
|
|
image = function(tpx, rect)
|
|
|
local top = pixels.new('images/main_theme/inv_top.png'):scale(scale, scale, false);
|
|
|
local mid = pixels.new('images/main_theme/inv_mid.png'):scale(scale, scale, false);
|
|
|
local bottom = pixels.new('images/main_theme/inv_bottom.png'):scale(scale, scale, false);
|
|
|
|
|
|
dire_draw_tile(mid, tpx, { x=rect.x + 11 * scale, y=rect.y + 10 * scale, w=rect.w - 22 * scale, h = rect.h - 20 * scale}, {});
|
|
|
dire_draw_center(top, tpx, {x=rect.x, y=rect.y, w=208 * scale, h=60 * scale});
|
|
|
dire_draw_center(bottom, tpx, {x=rect.x, y=rect.y + rect.h - 60 * scale, w=208 * scale, h=60 * scale});
|
|
|
end,
|
|
|
options = {scale = true}
|
|
|
};
|
|
|
|
|
|
menu.buttonrect = {
|
|
|
wmin = 50,
|
|
|
wmax = 50,
|
|
|
hmin = 16,
|
|
|
hmax = 16,
|
|
|
by = 12,
|
|
|
ay = 1,
|
|
|
rx = 81,
|
|
|
ax = 1
|
|
|
};
|
|
|
|
|
|
D {
|
|
|
'settings_open',
|
|
|
'raw',
|
|
|
x=canvas.x + canvas.w - 33 * scale,
|
|
|
y=canvas.y + canvas.h - 30 * scale,
|
|
|
xc=0,
|
|
|
yc=0,
|
|
|
w=24 * scale,
|
|
|
h=22 * scale,
|
|
|
click=true
|
|
|
};
|
|
|
elseif t == 'tower' then
|
|
|
diretheme.set_background('#181E37', 255, 'images/tower_theme/background.png', {mode=2, scale=true});
|
|
|
|
|
|
local image_bg = 'images/tower_theme/picture_bg.png';
|
|
|
if canvas.w < 800 * scale then
|
|
|
image_bg = 'images/tower_theme/picture_bg_small.png';
|
|
|
end;
|
|
|
|
|
|
image_area.leftof='inv';
|
|
|
image_area.topof='text';
|
|
|
image_area.rect = {
|
|
|
ax = 0,
|
|
|
maxw = 584,
|
|
|
maxh = 258,
|
|
|
minw = 584,
|
|
|
minh = 258
|
|
|
};
|
|
|
image_area.contentrect = {
|
|
|
ax = 0,
|
|
|
ay = -1,
|
|
|
ty = 12,
|
|
|
wmin = 320,
|
|
|
hmin = 240,
|
|
|
wmax = 320,
|
|
|
hmax = 240
|
|
|
};
|
|
|
image_area.bg = {
|
|
|
image = image_bg,
|
|
|
options = {
|
|
|
mode = 1,
|
|
|
scale = true
|
|
|
}
|
|
|
};
|
|
|
|
|
|
text_area.leftof = 'inv';
|
|
|
text_area.rect = {
|
|
|
lx = 7,
|
|
|
ty = 266,
|
|
|
rx = 8,
|
|
|
by = 2,
|
|
|
ax = 1,
|
|
|
ay = 1
|
|
|
};
|
|
|
text_area.contentrect = {
|
|
|
lx = 21 + hpadding,
|
|
|
rx = 21 + hpadding,
|
|
|
ty = 14 + vpadding,
|
|
|
by = 14 + vpadding,
|
|
|
wf = prefs.text_width / 100
|
|
|
};
|
|
|
|
|
|
inventory.rect = {
|
|
|
rx = 2,
|
|
|
y = 2,
|
|
|
wmax = 208,
|
|
|
wmin = 208,
|
|
|
ty = 2,
|
|
|
by = 2,
|
|
|
ax = 1
|
|
|
};
|
|
|
inventory.contentrect = {
|
|
|
lx = 12,
|
|
|
rx = 16,
|
|
|
ty = 10,
|
|
|
by = 40
|
|
|
};
|
|
|
inventory.bg = {
|
|
|
image = function(tpx, rect)
|
|
|
local bg = pixels.new('images/tower_theme/inv_bg.png'):scale(scale, scale, false);
|
|
|
local icon = pixels.new('images/tower_theme/settings.png'):scale(scale, scale, false);
|
|
|
|
|
|
local tbg, tbg_slice = dire_slice_9(bg, {
|
|
|
x = 7 * scale,
|
|
|
y = 11 * scale,
|
|
|
w = 194 * scale,
|
|
|
h = 38 * scale
|
|
|
})
|
|
|
|
|
|
dire_draw_9(tbg, tpx, rect, {parts=tbg_slice});
|
|
|
|
|
|
dire_draw_center(icon, tpx, {x = rect.x + rect.w - 33 * scale, y = rect.y + rect.h - 35 * scale, w = 24 * scale, h = 22 * scale});
|
|
|
end
|
|
|
};
|
|
|
|
|
|
menu.buttonrect = {
|
|
|
wmin = 50,
|
|
|
wmax = 50,
|
|
|
hmin = 16,
|
|
|
hmax = 16,
|
|
|
by = 20,
|
|
|
ay = 1,
|
|
|
rx = 81,
|
|
|
ax = 1
|
|
|
};
|
|
|
|
|
|
D {
|
|
|
'settings_open',
|
|
|
'raw',
|
|
|
x=canvas.x + canvas.w - 35 * scale,
|
|
|
y=canvas.y + canvas.h - 37 * scale,
|
|
|
xc=0,
|
|
|
yc=0,
|
|
|
w=24 * scale,
|
|
|
h=22 * scale,
|
|
|
click=true
|
|
|
};
|
|
|
elseif t == 'terminal' then
|
|
|
theme.set('snd.click', '');
|
|
|
|
|
|
local upshift = 0;
|
|
|
if height / scale < 540 then
|
|
|
upshift = 19;
|
|
|
end;
|
|
|
|
|
|
local px = pixels.new(scaled_width, scaled_height);
|
|
|
local tiles_src = pixels.new('images/terminal/table_tiles.png');
|
|
|
local backdrop_src = pixels.new('images/terminal/backdrop.png');
|
|
|
|
|
|
local tabletop = scaled_height - 422 - upshift
|
|
|
if tabletop < 335 - upshift then
|
|
|
tabletop = 335 - upshift;
|
|
|
end;
|
|
|
|
|
|
dire_draw_tile(tiles_src, px, {
|
|
|
w = scaled_width,
|
|
|
h = 422,
|
|
|
x = 0,
|
|
|
y = tabletop
|
|
|
}, {xoffset = -1, yoffxet = -1});
|
|
|
|
|
|
dire_draw_tile(backdrop_src, px, {
|
|
|
w = scaled_width,
|
|
|
h = tabletop,
|
|
|
x = 0,
|
|
|
y = 0
|
|
|
}, {xoffset = -1, yoffset = -2});
|
|
|
|
|
|
diretheme.set_background('#181E37', 255, px, {mode=5});
|
|
|
|
|
|
local ty
|
|
|
if here().ticks ~= nil and here().ticks < 128 and here().graphical then
|
|
|
ty = 72
|
|
|
else
|
|
|
ty = 2
|
|
|
end;
|
|
|
|
|
|
text_area.rect = {
|
|
|
ty = 0 - upshift,
|
|
|
by = 189,
|
|
|
wmin = 808,
|
|
|
hmin = 568,
|
|
|
wmax = 808,
|
|
|
hmax = 568,
|
|
|
ax = 0,
|
|
|
ay = 1
|
|
|
};
|
|
|
text_area.contentrect = {
|
|
|
wmax = 569,
|
|
|
hmax = 390,
|
|
|
ty = ty,
|
|
|
ax = 0,
|
|
|
ay = -2,
|
|
|
dx = -16
|
|
|
};
|
|
|
text_area.bg = {
|
|
|
image = 'images/terminal/bg_text.png',
|
|
|
options = {
|
|
|
mode = 1,
|
|
|
scale = true
|
|
|
}
|
|
|
};
|
|
|
elseif t == 'ending_outside' then
|
|
|
diretheme.set_background('#89C6AE', 255, theme_directory .. '/background.png', {mode=2, scale=true});
|
|
|
|
|
|
text_area.rect = {
|
|
|
lx = 24,
|
|
|
rx = 24,
|
|
|
wmax = 600,
|
|
|
hmax = 160,
|
|
|
by = 24,
|
|
|
ay = 1
|
|
|
};
|
|
|
text_area.contentrect = {
|
|
|
lx = 18 + hpadding,
|
|
|
rx = 18 + hpadding,
|
|
|
ty = 14 + vpadding,
|
|
|
by = 14 + vpadding,
|
|
|
wf = prefs.text_width / 100
|
|
|
};
|
|
|
elseif t == 'ending_inside' then
|
|
|
diretheme.set_background('#181E37', 255, theme_directory .. '/background.png', {mode=2});
|
|
|
|
|
|
text_area.rect = {
|
|
|
lx = 24,
|
|
|
rx = 24,
|
|
|
wmax = 600,
|
|
|
hmax = 160,
|
|
|
by = 24,
|
|
|
ay = 1
|
|
|
};
|
|
|
text_area.contentrect = {
|
|
|
lx = 18 + hpadding,
|
|
|
rx = 18 + hpadding,
|
|
|
ty = 14 + vpadding,
|
|
|
by = 14 + vpadding,
|
|
|
wf = prefs.text_width / 100
|
|
|
};
|
|
|
elseif t == 'credits_outside' or t == 'credits_inside' then
|
|
|
-- text scaled on top of picture
|
|
|
text_area.rect = {
|
|
|
wmax = 960,
|
|
|
hmax = 600
|
|
|
};
|
|
|
text_area.bg = {};
|
|
|
text_area.align = 'center';
|
|
|
text_area.content_rect = {
|
|
|
wf = prefs.text_width / 100
|
|
|
};
|
|
|
elseif t == 'black' then
|
|
|
fmt.para = false;
|
|
|
diretheme.set_background('#000000', 255);
|
|
|
|
|
|
text_area.rect = {
|
|
|
wmax = 600,
|
|
|
hmax = 400,
|
|
|
ax = 0,
|
|
|
ay = 0
|
|
|
};
|
|
|
text_area.align = 'center';
|
|
|
end;
|
|
|
|
|
|
diretheme.set_image_area(image_area, true);
|
|
|
diretheme.set_text_area(text_area, true);
|
|
|
diretheme.set_inventory_area(inventory, true);
|
|
|
|
|
|
diretheme.set_menu(menu, true);
|
|
|
end;
|
|
|
|
|
|
function start(load)
|
|
|
dprint('start', load);
|
|
|
last_location = here().nam;
|
|
|
local w, h = diretheme.get_screen();
|
|
|
local name = theme.name();
|
|
|
if instead.tiny then
|
|
|
if not load then
|
|
|
take('tiny_ingame_settings');
|
|
|
end;
|
|
|
else
|
|
|
if here() ~= _'theme_warning' and here() ~= _'resolution_warning' then
|
|
|
if name ~= '.' then
|
|
|
walkin('theme_warning');
|
|
@@ -1836,6 +321,7 @@ function start(load)
|
|
|
game:lastdisp(r);
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
set_theme(std.call(here(), 'theme'));
|
|
|
|
|
@@ -1991,4 +477,15 @@ function init()
|
|
|
if not prefs.text_width then
|
|
|
prefs.text_width = 100;
|
|
|
end;
|
|
|
|
|
|
if not instead.tiny and prefs.simplified_animation == nil then
|
|
|
-- Tiny performance test
|
|
|
local a = sprite.new(640, 480);
|
|
|
local b = sprite.new(640, 480);
|
|
|
local t = instead.ticks();
|
|
|
b:copy(a, 0, 0);
|
|
|
t = instead.ticks() - t;
|
|
|
dprint(t);
|
|
|
prefs.simplified_animation = t > 10;
|
|
|
end;
|
|
|
end;
|