Compare Revisions
Swap
Showing 22 commits
Merge Ancestor: c62400235fb9
22 silverwing b86ed9567583
6 days ago
21 silverwing 5985b0a31815
6 days ago
20 silverwing fe8693a3e7d5
6 days ago
19 silverwing 93cfddc9484c
6 days ago
18 silverwing 1332d630308f
6 days ago
17 silverwing f2f018459fb7
7 days ago
16 silverwing 0c055c1e38c1
7 days ago
15 silverwing a3357855c7d3
7 days ago
14 silverwing 9cf402fecdaf
9 days ago
13 silverwing 79074f9e816e
9 days ago
12 silverwing b1f91fd22b0b
9 days ago
11 silverwing 7da04978fd8a
2 months ago
10 silverwing f64fd360962a
2 months ago
9 silverwing 6e2e4d683a57
2 months ago
8 silverwing 3c6baa05ef09
3 months ago
7 silverwing 0ac34928cadb
3 months ago
6 silverwing e0ab59b58fc1
3 months ago
5 silverwing b16a671170b8
3 months ago
4 silverwing 6318c07fd328
3 months ago
3 silverwing 009ae74f1983
3 months ago
2 silverwing c2e2cb3a6e5d
3 months ago
1 silverwing 3dcee4fa8059
4 months ago
13 files changed:
computer_parts.lua
Show inline comments
 
function motherboard(cpu, ram, slots, status, src)
 
	local name = cpu .. '-' .. ram .. '-I' .. tostring(slots) .. 'SB';
 
	
 
	return obj {
 
		nam = name:lower();
 
		status = status;
 
		name = name;
 
		cpu = cpu;
 
		ram = ram;
 
		slots = slots;
 
		ptype = 'motherboard';
 
		part = true;
 
		disp = translate("parts_locale", 'motherboard_title', {model=name});
 
		dsc = function(s)
 
  local name = cpu .. '-' .. ram .. '-I' .. tostring(slots) .. 'SB';
 
  
 
  return obj {
 
    nam = name:lower();
 
    status = status;
 
    name = name;
 
    cpu = cpu;
 
    ram = ram;
 
    slots = slots;
 
    ptype = 'motherboard';
 
    part = true;
 
    disp = translate("parts_locale", 'motherboard_title', {model=name});
 
    dsc = function(s)
 
      return '{' .. translate_now("parts_locale", 'motherboard_title', {model=name}) .. '}^'
 
    end;
 
		inv = translate("parts_locale", 'motherboard_inv_from_' .. src, {model=name});
 
		tak = translate("parts_locale", 'motherboard_tak', {model=name});
 
	};
 
    inv = translate("parts_locale", 'motherboard_inv_from_' .. src, {model=name});
 
    tak = translate("parts_locale", 'motherboard_tak', {model=name});
 
  };
 
end;
 

	
 
function cpu(slot, speed, status, src, name_postfix)
 
	local name;
 
	if slot == 'CAX' then
 
		name = 'CPU' .. tostring(speed * 10) .. '-CAX-' .. tostring(speed) .. 'MHz';
 
	elseif slot == 'CVX' then
 
		name = 'MCPU' .. tostring(speed * 10) .. '-CVX-' .. tostring(speed) .. 'MHz';
 
	elseif slot == 'CRX' then
 
		name = 'RCPU' .. tostring(speed * 10) .. '-CRX-' .. tostring(speed) .. 'MHz';
 
	elseif slot == 'CXX' then
 
		name = 'XCPU' .. tostring(speed) .. '-CXX-' .. tostring(speed) .. 'MHz';
 
	end;
 
	
 
	if not name_postfix then
 
		name_postfix = '';
 
	end;
 
	
 
	return obj {
 
		nam = name:lower() .. name_postfix;
 
		status = status;
 
		name = name;
 
		slot = slot;
 
		disp = translate("parts_locale", 'cpu_title', {model=name});
 
		speed = speed;
 
		status = status;
 
		ptype = 'cpu';
 
		part = true;
 
		dsc = function(s)
 
  local name;
 
  if slot == 'CAX' then
 
    name = 'CPU' .. tostring(speed * 10) .. '-CAX-' .. tostring(speed) .. 'MHz';
 
  elseif slot == 'CVX' then
 
    name = 'MCPU' .. tostring(speed * 10) .. '-CVX-' .. tostring(speed) .. 'MHz';
 
  elseif slot == 'CRX' then
 
    name = 'RCPU' .. tostring(speed * 10) .. '-CRX-' .. tostring(speed) .. 'MHz';
 
  elseif slot == 'CXX' then
 
    name = 'XCPU' .. tostring(speed) .. '-CXX-' .. tostring(speed) .. 'MHz';
 
  end;
 
  
 
  if not name_postfix then
 
    name_postfix = '';
 
  end;
 
  
 
  return obj {
 
    nam = name:lower() .. name_postfix;
 
    status = status;
 
    name = name;
 
    slot = slot;
 
    disp = translate("parts_locale", 'cpu_title', {model=name});
 
    speed = speed;
 
    status = status;
 
    ptype = 'cpu';
 
    part = true;
 
    dsc = function(s)
 
      return '{' .. translate_now("parts_locale", 'cpu_title', {model=name}) .. '}^'
 
    end;
 
		inv = translate("parts_locale", 'cpu_inv_from_' .. src, {model=name});
 
		tak = translate("parts_locale", 'cpu_tak', {model=name});
 
	};
 
    inv = translate("parts_locale", 'cpu_inv_from_' .. src, {model=name});
 
    tak = translate("parts_locale", 'cpu_tak', {model=name});
 
  };
 
end;
 

	
 
function ram(slot, size, status, dsc, name_postfix)
 
	local name;
 
	if slot == 'RKT' then
 
		name = 'RKT-M' .. tostring(size * 10) .. '-' ..tostring(size) .. 'MB';
 
	else
 
		name = slot .. '-M' .. tostring(size) .. '-' ..tostring(size) .. 'MB';
 
	end;
 
	
 
	if not name_postfix then
 
		name_postfix = '';
 
	end;
 
	
 
	return obj {
 
		nam = name:lower() .. name_postfix;
 
		status = status;
 
		name = name;
 
		slot = slot;
 
		ptype = 'ram';
 
		disp = translate("parts_locale", 'ram_title', {model=name});
 
		status = status;
 
		size = size;
 
		part = true;
 
		dsc = function(s)
 
  local name;
 
  if slot == 'RKT' then
 
    name = 'RKT-M' .. tostring(size * 10) .. '-' ..tostring(size) .. 'MB';
 
  else
 
    name = slot .. '-M' .. tostring(size) .. '-' ..tostring(size) .. 'MB';
 
  end;
 
  
 
  if not name_postfix then
 
    name_postfix = '';
 
  end;
 
  
 
  return obj {
 
    nam = name:lower() .. name_postfix;
 
    status = status;
 
    name = name;
 
    slot = slot;
 
    ptype = 'ram';
 
    disp = translate("parts_locale", 'ram_title', {model=name});
 
    status = status;
 
    size = size;
 
    part = true;
 
    dsc = function(s)
 
      return '{' .. translate_now("parts_locale", 'ram_title', {model=name}) .. '}^'
 
    end;
 
		inv = translate("parts_locale", 'ram_inv_from_' .. dsc, {model=name});
 
		tak = translate("parts_locale", 'ram_tak', {model=name});
 
	};
 
    inv = translate("parts_locale", 'ram_inv_from_' .. dsc, {model=name});
 
    tak = translate("parts_locale", 'ram_tak', {model=name});
 
  };
 
end;
 

	
 
motherboard('CVX', 'RST', 3, true, 'computer');
 

	
 
motherboard('CAX', 'RKT', 2, false, 'box');
 
motherboard('CAX', 'RKT', 3, true, 'box');
 
motherboard('CAX', 'RST', 2, false, 'box');
 
motherboard('CAX', 'RST', 3, true, 'box');
 
motherboard('CVX', 'RST', 2, true, 'box');
 
motherboard('CVX', 'RST', 4, false, 'box');
 
motherboard('CVX', 'RDT', 2, true, 'box');
 
motherboard('CRX', 'RST', 3, true, 'box');
 
motherboard('CRX', 'RDT', 2, true, 'box');
 
motherboard('CRX', 'RDT', 3, true, 'box');
 

	
 
cpu('CVX', 7, true, 'computer')
 

	
 
cpu('CAX', 2, false, 'box');
 
cpu('CAX', 4, true, 'box');
 
cpu('CVX', 5, true, 'box');
 
cpu('CVX', 7, false, 'box', '_2');
 
cpu('CRX', 10, false, 'box');
 
cpu('CRX', 20, true, 'box');
 
cpu('CXX', 100, true, 'box');
 

	
 
ram('RST', 16, true, 'computer')
 

	
 
ram('RKT', 2, false, 'box'); -- type 1
 
ram('RKT', 4, true, 'box'); -- type 2
 
ram('RST', 8, false, 'box'); -- type 2
 
ram('RST', 16, false, 'box', '_2'); -- type 3
 
ram('RDT', 32, true, 'box'); -- type 3
 
ram('RDT', 64, false, 'box'); -- type 4
 

	
 
obj {
 
	nam = 'tva-rx1';
 
	status = true;
 
	name = 'TVA-RX1';
 
	ptype = 'video';
 
	slot = 'ISB';
 
	part = true;
 
  nam = 'tva-rx1';
 
  status = true;
 
  name = 'TVA-RX1';
 
  ptype = 'video';
 
  slot = 'ISB';
 
  part = true;
 
  visual = 1;
 
	disp = translate("parts_locale", 'videocard_title', {model='TVA-RX1'});
 
  disp = translate("parts_locale", 'videocard_title', {model='TVA-RX1'});
 
  dsc = function(s)
 
    return '{' .. translate_now("parts_locale", 'videocard_title', {model='TVA-RX1'}) .. '}^';
 
  end;
 
	inv = translate("parts_locale", 'videocard_inv_from_computer', {model='TVA-RX1'});
 
  inv = translate("parts_locale", 'videocard_inv_from_computer', {model='TVA-RX1'});
 
  tak = translate("parts_locale", 'videocard_tak', {model='TVA-RX1'});
 
}
 

	
 
obj {
 
	nam = 'tva-rx2';
 
	status = true;
 
	ptype = 'video';
 
	name = 'TVA-RX2';
 
	slot = 'ISB';
 
	part = true;
 
  nam = 'tva-rx2';
 
  status = true;
 
  ptype = 'video';
 
  name = 'TVA-RX2';
 
  slot = 'ISB';
 
  part = true;
 
  visual = 1;
 
	disp = translate("parts_locale", 'videocard_title', {model='TVA-RX2'});
 
	dsc = function(s)
 
  disp = translate("parts_locale", 'videocard_title', {model='TVA-RX2'});
 
  dsc = function(s)
 
    return '{' .. translate_now("parts_locale", 'videocard_title', {model='TVA-RX2'}) .. '}^';
 
  end;
 
	inv = translate("parts_locale", 'videocard_inv_from_box', {model='TVA-RX2'});
 
	tak = translate("parts_locale", 'videocard_tak', {model='TVA-RX2'});
 
  inv = translate("parts_locale", 'videocard_inv_from_box', {model='TVA-RX2'});
 
  tak = translate("parts_locale", 'videocard_tak', {model='TVA-RX2'});
 
}
 

	
 
obj {
 
	nam = 'gva-rx2';
 
	status = false;
 
	ptype = 'video';
 
	name = 'GVA-RX2';
 
	slot = 'ISB';
 
	part = true;
 
  nam = 'gva-rx2';
 
  status = false;
 
  ptype = 'video';
 
  name = 'GVA-RX2';
 
  slot = 'ISB';
 
  part = true;
 
  visual = 2;
 
	disp = translate("parts_locale", 'videocard_title', {model='GVA-RX2'});
 
	dsc = function(s)
 
  disp = translate("parts_locale", 'videocard_title', {model='GVA-RX2'});
 
  dsc = function(s)
 
    return '{' .. translate_now("parts_locale", 'videocard_title', {model='GVA-RX2'}) .. '}^';
 
  end;
 
	inv = translate("parts_locale", 'videocard_inv_from_box', {model='GVA-RX2'});
 
	tak = translate("parts_locale", 'videocard_tak', {model='GVA-RX2'});
 
  inv = translate("parts_locale", 'videocard_inv_from_box', {model='GVA-RX2'});
 
  tak = translate("parts_locale", 'videocard_tak', {model='GVA-RX2'});
 
}
 

	
 
obj {
 
	nam = 'gva-rx4';
 
	status = true;
 
	name = 'GVA-RX4';
 
	ptype = 'video';
 
	slot = 'ISB';
 
	part = true;
 
  nam = 'gva-rx4';
 
  status = true;
 
  name = 'GVA-RX4';
 
  ptype = 'video';
 
  slot = 'ISB';
 
  part = true;
 
  visual = 2;
 
	disp = translate("parts_locale", 'videocard_title', {model='GVA-RX4'});
 
	dsc = function(s)
 
  disp = translate("parts_locale", 'videocard_title', {model='GVA-RX4'});
 
  dsc = function(s)
 
    return '{' .. translate_now("parts_locale", 'videocard_title', {model='GVA-RX4'}) .. '}^';
 
  end;
 
	inv = translate("parts_locale", 'videocard_inv_from_box', {model='GVA-RX4'});
 
	tak = translate("parts_locale", 'videocard_tak', {model='GVA-RX4'});
 
  inv = translate("parts_locale", 'videocard_inv_from_box', {model='GVA-RX4'});
 
  tak = translate("parts_locale", 'videocard_tak', {model='GVA-RX4'});
 
}
 

	
 
obj {
 
	nam = 'fna-100-10mbs_1';
 
	status = true;
 
	name = 'FNA-100-10Mb/s';
 
	ptype = 'network';
 
	slot = 'ISB';
 
	part = true;
 
  nam = 'fna-100-10mbs_1';
 
  status = true;
 
  name = 'FNA-100-10Mb/s';
 
  ptype = 'network';
 
  slot = 'ISB';
 
  part = true;
 
  visual = 3;
 
	disp = translate("parts_locale", 'network_adapter_title', {model='FNA-100-10Mb/s'});
 
	dsc = function(s)
 
  disp = translate("parts_locale", 'network_adapter_title', {model='FNA-100-10Mb/s'});
 
  dsc = function(s)
 
    return '{' .. translate_now("parts_locale", 'network_adapter_title', {model='FNA-100-10Mb/s'}) .. '}^';
 
  end;
 
	inv = translate("parts_locale", 'network_adapter_inv_from_computer', {model='FNA-100-10Mb/s'});
 
  inv = translate("parts_locale", 'network_adapter_inv_from_computer', {model='FNA-100-10Mb/s'});
 
  tak = translate("parts_locale", 'network_adapter_tak', {model='FNA-100-10Mb/s'});
 
}
 

	
 
obj {
 
	nam = 'fna-200-20mbs';
 
	status = false;
 
	name = 'FNA-200-20Mb/s';
 
	ptype = 'network';
 
	slot = 'ISB';
 
	part = true;
 
  nam = 'fna-200-20mbs';
 
  status = false;
 
  name = 'FNA-200-20Mb/s';
 
  ptype = 'network';
 
  slot = 'ISB';
 
  part = true;
 
  visual = 3;
 
	disp = translate("parts_locale", 'network_adapter_title', {model='FNA-200-20Mb/s'});
 
	dsc = function(s)
 
  disp = translate("parts_locale", 'network_adapter_title', {model='FNA-200-20Mb/s'});
 
  dsc = function(s)
 
    return '{' .. translate_now("parts_locale", 'network_adapter_title', {model='FNA-200-20Mb/s'}) .. '}^';
 
  end;
 
	inv = translate("parts_locale", 'network_adapter_inv_from_box', {model='FNA-200-20Mb/s'});
 
  inv = translate("parts_locale", 'network_adapter_inv_from_box', {model='FNA-200-20Mb/s'});
 
  tak = translate("parts_locale", 'network_adapter_tak', {model='FNA-200-20Mb/s'});
 
}
 

	
 
obj {
 
	nam = 'fna-100-10mbs_2';
 
	status = true;
 
	name = 'FNA-100-10Mb/s';
 
	ptype = 'network';
 
	slot = 'ISB';
 
	part = true;
 
  nam = 'fna-100-10mbs_2';
 
  status = true;
 
  name = 'FNA-100-10Mb/s';
 
  ptype = 'network';
 
  slot = 'ISB';
 
  part = true;
 
  visual = 3;
 
	disp = translate("parts_locale", 'network_adapter_title', {model='FNA-100-10Mb/s'});
 
	dsc = function(s)
 
  disp = translate("parts_locale", 'network_adapter_title', {model='FNA-100-10Mb/s'});
 
  dsc = function(s)
 
    return '{' .. translate_now("parts_locale", 'network_adapter_title', {model='FNA-100-10Mb/s'}) .. '}^';
 
  end;
 
	inv = translate("parts_locale", 'network_adapter_inv_from_box', {model='FNA-100-10Mb/s'});
 
  inv = translate("parts_locale", 'network_adapter_inv_from_box', {model='FNA-100-10Mb/s'});
 
  tak = translate("parts_locale", 'network_adapter_tak', {model='FNA-100-10Mb/s'});
 
}
 

	
 
obj {
 
	nam = 'fna-50-5mbs';
 
	status = true;
 
	name = 'FNA-50-5Mb/s';
 
	ptype = 'network';
 
	slot = 'ISB';
 
	part = true;
 
  nam = 'fna-50-5mbs';
 
  status = true;
 
  name = 'FNA-50-5Mb/s';
 
  ptype = 'network';
 
  slot = 'ISB';
 
  part = true;
 
  visual = 3;
 
	disp = translate("parts_locale", 'network_adapter_title', {model='FNA-50-5Mb/s'});
 
	dsc = function(s)
 
  disp = translate("parts_locale", 'network_adapter_title', {model='FNA-50-5Mb/s'});
 
  dsc = function(s)
 
    return '{' .. translate_now("parts_locale", 'network_adapter_title', {model='FNA-50-5Mb/s'}) .. '}^';
 
  end;
 
	inv = translate("parts_locale", 'network_adapter_inv_from_box', {model='FNA-50-5Mb/s'});
 
  inv = translate("parts_locale", 'network_adapter_inv_from_box', {model='FNA-50-5Mb/s'});
 
  tak = translate("parts_locale", 'network_adapter_tak', {model='FNA-50-5Mb/s'});
 
}
 

	
 
obj {
 
	nam = 'kbc-s';
 
	status = true;
 
	name = 'KBC-S';
 
	ptype = 'keyboard';
 
	slot = 'ISB';
 
	part = true;
 
  nam = 'kbc-s';
 
  status = true;
 
  name = 'KBC-S';
 
  ptype = 'keyboard';
 
  slot = 'ISB';
 
  part = true;
 
  visual = 4;
 
  disp = translate("parts_locale", 'keyboard_controller_title', {model='KBC-S'});
 
  dsc = function(s)
 
    return '{' .. translate_now("parts_locale", 'keyboard_controller_title', {model='KBC-S'}) .. '}^';
 
  end;
 
	inv = translate("parts_locale", 'keyboard_controller_inv_from_computer', {model='KBC-S'});
 
  inv = translate("parts_locale", 'keyboard_controller_inv_from_computer', {model='KBC-S'});
 
  tak = translate("parts_locale", 'keyboard_controller_tak', {model='KBC-S'});
 
}
 

	
 
obj {
 
	nam = 'kbc-s_2';
 
	status = false;
 
	name = 'KBC-S';
 
	ptype = 'keyboard';
 
	slot = 'ISB';
 
	part = true;
 
  nam = 'kbc-s_2';
 
  status = false;
 
  name = 'KBC-S';
 
  ptype = 'keyboard';
 
  slot = 'ISB';
 
  part = true;
 
  visual = 4;
 
  disp = translate("parts_locale", 'keyboard_controller_title', {model='KBC-S'});
 
	dsc = function(s)
 
  dsc = function(s)
 
    return '{' .. translate_now("parts_locale", 'keyboard_controller_title', {model='KBC-S'}) .. '}^';
 
  end;
 
	inv = translate("parts_locale", 'keyboard_controller_inv_from_box', {model='KBC-S'});
 
  inv = translate("parts_locale", 'keyboard_controller_inv_from_box', {model='KBC-S'});
 
  tak = translate("parts_locale", 'keyboard_controller_tak', {model='KBC-S'});
 
}
 

	
 
obj {
 
	nam = 'kbc-r';
 
	status = false;
 
	name = 'KBC-R';
 
	ptype = 'keyboard';
 
	slot = 'ISB';
 
	part = true;
 
  nam = 'kbc-r';
 
  status = false;
 
  name = 'KBC-R';
 
  ptype = 'keyboard';
 
  slot = 'ISB';
 
  part = true;
 
  visual = 4;
 
  disp = translate("parts_locale", 'keyboard_controller_title', {model='KBC-R'});
 
	dsc = function(s)
 
  dsc = function(s)
 
    return '{' .. translate_now("parts_locale", 'keyboard_controller_title', {model='KBC-R'}) .. '}^';
 
  end;
 
	inv = translate("parts_locale", 'keyboard_controller_inv_from_box', {model='KBC-R'});
 
  inv = translate("parts_locale", 'keyboard_controller_inv_from_box', {model='KBC-R'});
 
  tak = translate("parts_locale", 'keyboard_controller_tak', {model='KBC-R'});
 
}
 

	
 
obj {
 
	nam = 'kbc-p';
 
	status = true;
 
	name = 'KBC-P';
 
	ptype = 'keyboard';
 
	slot = 'ISB';
 
	part = true;
 
  nam = 'kbc-p';
 
  status = true;
 
  name = 'KBC-P';
 
  ptype = 'keyboard';
 
  slot = 'ISB';
 
  part = true;
 
  visual = 4;
 
  disp = translate("parts_locale", 'keyboard_controller_title', {model='KBC-P'});
 
	dsc = function(s)
 
  dsc = function(s)
 
    return '{' .. translate_now("parts_locale", 'keyboard_controller_title', {model='KBC-P'}) .. '}^';
 
  end;
 
	inv = translate("parts_locale", 'keyboard_controller_inv_from_box', {model='KBC-P'});
 
  inv = translate("parts_locale", 'keyboard_controller_inv_from_box', {model='KBC-P'});
 
  tak = translate("parts_locale", 'keyboard_controller_tak', {model='KBC-P'});
 
}
ending.lua
Show inline comments
 
global {
 
	solarscale_stays = false
 
  solarscale_stays = false
 
}
 

	
 
function make_tbg_slice(scale, theme)
 
	local src = pixels.new('images/' .. theme .. '_theme/text_bg.png'):scale(scale);
 
	local tbg, tbg_slice
 
	local frw, frh, fdx, fdy
 
	if theme == 'main' or theme == 'bwm' then
 
		tbg, tbg_slice = dire_slice_9(src, {
 
			x = 9 * scale,
 
			y = 6 * scale,
 
			w = 96 * scale,
 
			h = 96 * scale
 
		});
 
	else
 
		tbg, tbg_slice = dire_slice_9(src, {
 
			x = 6 * scale,
 
			y = 6 * scale,
 
			w = 128 * scale,
 
			h = 128 * scale
 
		});
 
	end;
 
	
 
	return tbg, tbg_slice;
 
  local src = pixels.new('images/' .. theme .. '_theme/text_bg.png'):scale(scale);
 
  local tbg, tbg_slice
 
  local frw, frh, fdx, fdy
 
  if theme == 'main' or theme == 'bwm' then
 
    tbg, tbg_slice = dire_slice_9(src, {
 
      x = 9 * scale,
 
      y = 6 * scale,
 
      w = 96 * scale,
 
      h = 96 * scale
 
    });
 
  else
 
    tbg, tbg_slice = dire_slice_9(src, {
 
      x = 6 * scale,
 
      y = 6 * scale,
 
      w = 128 * scale,
 
      h = 128 * scale
 
    });
 
  end;
 
  
 
  return tbg, tbg_slice;
 
end;
 

	
 
function make_ending_frame(scale, theme, tbg, tbg_slice)
 
	local fdx, fdy, frw, frh;
 
	
 
	if theme == 'main' or theme == 'bwm'  then
 
		frw = 978 * scale;
 
		frh = 612 * scale;
 
		fdx = 9 * scale;
 
		fdy = 6 * scale;
 
	else
 
		frw = 970 * scale;
 
		frh = 610 * scale;
 
		fdx = 5 * scale;
 
		fdy = 5 * scale;
 
	end;
 
	
 
	local bgframe = pixels.new(frw, frh);
 
	dire_draw_9(tbg, bgframe, {x = 0; y = 0; w = frw; h = frh}, {parts=tbg_slice});
 
	return bgframe, fdx, fdy, frw, frh;
 
  local fdx, fdy, frw, frh;
 
  
 
  if theme == 'main' or theme == 'bwm'  then
 
    frw = 978 * scale;
 
    frh = 612 * scale;
 
    fdx = 9 * scale;
 
    fdy = 6 * scale;
 
  else
 
    frw = 970 * scale;
 
    frh = 610 * scale;
 
    fdx = 5 * scale;
 
    fdy = 5 * scale;
 
  end;
 
  
 
  local bgframe = pixels.new(frw, frh);
 
  dire_draw_9(tbg, bgframe, {x = 0; y = 0; w = frw; h = frh}, {parts=tbg_slice});
 
  return bgframe, fdx, fdy, frw, frh;
 
end;
 

	
 
function show_ending(theme, image, position, hide_textbg)
 
  --[[
 
    position: nil or 0 -- center, 1 -- bottom-left
 
  ]]
 
  --frames, process, delay, frame_nr
 
  if instead.tiny then
 
    return
 
  end;
 
  
 
	local scale = diretheme.get_scale();
 
	
 
  local scale = diretheme.get_scale();
 
  
 
  local unscaled_sw, unscaled_sh = diretheme.get_scaled_screen();
 
  
 
  local unscaled_w = 960;
 
  local unscaled_h = 600;
 
  
 
	local ox = math.floor((unscaled_sw - unscaled_w) / 2);
 
  local ox = math.floor((unscaled_sw - unscaled_w) / 2);
 
  local oy = math.floor((unscaled_sh - unscaled_h) / 2);
 

	
 
  if position == 1 then
 
    if ox < 0 then
 
      ox = 0;
 
    end;
 
    if oy < 0 then
 
      oy = unscaled_sh - unscaled_h;
 
    end;
 
  end;
 
  
 
  if hide_textbg then
 
    D {'textbg'};
 
  else
 
  elseif unscaled_sw ~= 640 or unscaled_sh ~= 480 then
 
    local sw, sh = diretheme.get_screen();
 
    local tx = 24 * scale;
 
    local tw = sw - tx - 24 * scale;
 
    if tw > 600 * scale then
 
      tw = 600 * scale;
 
      tx = (sw - tw) / 2;
 
    end;
 
    local th = 160 * scale;
 
    local ty = sh - th - 24 * scale;
 
    
 
    local textbg = pixels.new(tw, th);
 
    local tbg, tbg_slice = make_tbg_slice(scale, theme);
 
    dire_draw_9(tbg, textbg, {x = 0; y = 0; w = tw; h = th}, {parts=tbg_slice});
 
    D {'textbg', 'img', textbg:sprite(), x=tx, y=ty, w=tw, h=th, z=0, background=true};
 
  end;
 
  
 
  local themebg = pixels.new(unscaled_sw, unscaled_sh);
 
  local bgtile = pixels.new('images/' .. theme .. '_theme/background.png');
 
  dire_draw_tile(bgtile, themebg, {x=0, y=0, w=unscaled_sw, h=unscaled_sh}, {xoffset=-1, yoffset=-1});
 
  
 
  if (ox > 0) or (oy > 0) then
 
    --Don't bother painting border if it's not visible (Effective screen < 960x600)
 
    local tbg, tbg_slice = make_tbg_slice(1, theme);
 
    local bgframe, fdx, fdy, frw, frh = make_ending_frame(1, theme, tbg, tbg_slice);
 
    dire_draw_center(bgframe, themebg, {x = ox - fdx, y = oy - fdy, w = frw, h = frh});
 
  end;
 
  
 
  dire_draw_center(pixels.new(image), themebg, {x = ox, y = oy, w = 960, h = 600});
 
  
 
  local bgcolor = '#89C6AE';
 
  if theme == 'bwm' then
 
    bgcolor = '#B2B2B2';
 
  elseif theme == 'bwt' then
 
    bgcolor = '#1F1F1F';
 
  elseif theme == 'tower' then
 
    bgcolor = '#181E37';
 
  end;
 
  
 
  diretheme.set_background(bgcolor, 255, themebg, {mode=1, scale = true});
 
end;
 

	
 
function ending_room(s)
 
  s.nofollow = true;
 
  s.noinv = true;
 
  s.nosave = true;
 
  s.noautosave = true;
 
  s.notitle = true;
 
  if not s.disp then
 
    s.disp = translate("ending_locale", 'game_end');
 
  end;
 
  
 
  return room(s);
 
end;
 

	
 
--[[
 
1. Leaving the tower
 
]]
 
room {
 
  {
 
    state = 0;
 
  };
 
	nam = 'ending_left';
 
	nofollow = true;
 
	theme = 'ending_outside';
 
	disp = translate("ending_locale", 'game_end');
 
	noinv = true;
 
	notitle = true;
 
  nam = 'ending_left';
 
  nofollow = true;
 
  theme = 'ending_outside';
 
  disp = translate("ending_locale", 'game_end');
 
  noinv = true;
 
  notitle = true;
 
  nosave = true;
 
  noautosave = true;
 
	themeInit = function(s)
 
  themeInit = function(s)
 
    local scale = diretheme.get_scale();
 
    local width, height = diretheme.get_scaled_screen();
 
    local dx = math.floor((width - 960) / 2);
 
    local dy = math.floor((height - 600) / 2);
 
    
 
		show_ending('main', 'images/endings/tower_left_bg.png');
 
		timer:set(25);
 
    show_ending('main', 'images/endings/tower_left_bg.png');
 
    timer:set(25);
 
    
 
    local animheight = 600 * scale;
 
    if width == 640 and height == 480 then
 
      animheight=360 * scale;
 
    end;
 
    
 
    animation_set({
 
      {type="delay", delay=2000};
 
      {
 
          type="image", 
 
          image=get_sprite('images/endings/tower_left_bg.png'),
 
          x = dx * scale,
 
          y = dy * scale,
 
          w = 960 * scale,
 
          h = 600 * scale,
 
          background = true
 
        };
 
      {
 
          type="anim",
 
          image=get_sprite('images/endings/tower_left_frames.png'),
 
          x = dx * scale,
 
          y = dy * scale,
 
          w = 960 * scale, 
 
          h = 600 * scale, 
 
          h = animheight, 
 
          frames=6,
 
          delay=500,
 
          frame_data = {
 
            {};
 
            {x=0, y=318, w=51, h=16,  dx=444, dy=246};
 
            {x=0, y=276, w=51, h=42,  dx=444, dy=246};
 
            {x=0, y=202, w=51, h=74,  dx=444, dy=246};
 
            {x=0, y=108, w=51, h=94,  dx=444, dy=246};
 
            {x=0, y=0,   w=51, h=108, dx=444, dy=246};
 
          };
 
        };
 
    }, true);
 
	end;
 
	onenter = function(s)
 
		s.state = s.state + 1;
 
		if s.state == 1 then
 
			p(translate_now("ending_locale", 'left_state_1'));
 
			return false;
 
		elseif s.state == 2 then
 
			p(translate_now("ending_locale", 'left_state_2'));
 
			return false;
 
		elseif s.state == 3 then
 
			p(translate_now("ending_locale", 'left_state_3'));
 
			return false;
 
		end;
 
  end;
 
  onenter = function(s)
 
    s.state = s.state + 1;
 
    if s.state == 1 then
 
      p(translate_now("ending_locale", 'left_state_1'));
 
      return false;
 
    elseif s.state == 2 then
 
      p(translate_now("ending_locale", 'left_state_2'));
 
      return false;
 
    elseif s.state == 3 then
 
      p(translate_now("ending_locale", 'left_state_3'));
 
      return false;
 
    end;
 
    
 
    if irradiated then
 
      snd.music('sound/bgm_ending_forest_irradiated.ogg');
 
    else
 
      snd.music('sound/bgm_ending_forest.ogg');
 
    end;
 
    
 
    enableSmoke('images/endings/tower_left_bg.png');
 
	end;
 
  end;
 
  onexit = function(s)
 
    fading.enabled = false;
 
  end;
 
	dsc = function(s)
 
		p(translate_now("ending_locale", 'left_part_1'));
 
		if solarscale_with_me then
 
			p(translate_now("ending_locale", 'left_part_1_solarscale'));
 
		end;
 
	end;
 
  dsc = function(s)
 
    p(translate_now("ending_locale", 'left_part_1'));
 
    if solarscale_with_me then
 
      p(translate_now("ending_locale", 'left_part_1_solarscale'));
 
    end;
 
  end;
 
  way = {
 
		path {translate("common_locale", 'continue'), 'ending_left_2'};
 
	};
 
    path {translate("common_locale", 'continue'), 'ending_left_2'};
 
  };
 
}
 

	
 
room {
 
  nam = 'ending_left_2';
 
  nofollow = true;
 
  nosave = true;
 
  noautosave = true;
 
  theme = function(s)
 
    if irradiated then
 
      return 'ending_outside_bw';
 
    else
 
      return 'ending_outside';
 
    end;
 
  end;
 
	disp = translate("ending_locale", 'game_end');
 
	noinv = true;
 
	notitle = true;
 
  disp = translate("ending_locale", 'game_end');
 
  noinv = true;
 
  notitle = true;
 
  themeInit = function(s)
 
    if irradiated then
 
      show_ending('bwm', 'images/endings/tower_left_closed_bw.png');
 
    else
 
      show_ending('main', 'images/endings/tower_left_closed.png');
 
    end;
 
    
 
    animation_set(false);
 
	end;
 
	dsc = function(s)
 
		pn(translate_now("ending_locale", 'left_part_2'));
 
		if solarscale_with_me then
 
			pn(translate_now("ending_locale", 'solarscale_lost'));
 
		end;
 
  end;
 
  dsc = function(s)
 
    pn(translate_now("ending_locale", 'left_part_2'));
 
    if solarscale_with_me then
 
      pn(translate_now("ending_locale", 'solarscale_lost'));
 
    end;
 
    if irradiated then
 
      p(translate_now("ending_locale", 'irradiated'));
 
    end;
 
	end;
 
  end;
 
  way = {
 
    path {translate("common_locale", 'continue'), function(s)
 
        if irradiated then
 
          _'ending_credits'.etype = 'leftbw';
 
        else
 
          _'ending_credits'.etype = 'left';
 
        end;
 
        return 'ending_credits';
 
    end};
 
  };
 
}
 

	
 
--[[
 
2. Destroying the tower
 
]]
 

	
 
room {
 
	nam = 'ending_formatted';
 
	disp = translate("ending_locale", 'game_end');
 
	theme = 'ending_outside';
 
	nofollow = true;
 
	noinv = true;
 
	notitle = true;
 
	theme = 'ending_outside';
 
  nam = 'ending_formatted';
 
  disp = translate("ending_locale", 'game_end');
 
  theme = 'ending_outside';
 
  nofollow = true;
 
  noinv = true;
 
  notitle = true;
 
  theme = 'ending_outside';
 
  nosave = true;
 
  noautosave = true;
 
	themeInit = function(s)
 
		show_ending('main', 'images/endings/tower_ruin.png');
 
  themeInit = function(s)
 
    show_ending('main', 'images/endings/tower_ruin.png');
 
    timer:set(25);
 
	end;
 
  end;
 
  onenter = function(s)
 
    if irradiated then
 
      snd.music('sound/bgm_ending_forest_irradiated.ogg');
 
    else
 
      snd.music('sound/bgm_ending_forest.ogg');
 
    end;
 
  end;
 
  onexit = function(s)
 
    fading.enabled = false;
 
  end;
 
	dsc = function(s)
 
		if solarscale_with_me then
 
			p(translate_now("ending_locale", 'formatted_solarscale'));
 
		else
 
			p(translate_now("ending_locale", 'formatted_alone'));
 
		end;
 
	end;
 
  dsc = function(s)
 
    if solarscale_with_me then
 
      p(translate_now("ending_locale", 'formatted_solarscale'));
 
    else
 
      p(translate_now("ending_locale", 'formatted_alone'));
 
    end;
 
  end;
 
  way = {
 
		path {translate("common_locale", 'continue'), 'ending_formatted_2'};
 
	};
 
    path {translate("common_locale", 'continue'), 'ending_formatted_2'};
 
  };
 
}
 

	
 
room {
 
  nam = 'ending_formatted_2';
 
  nofollow = true;
 
  theme = function(s)
 
    if irradiated then
 
      return 'ending_outside_bw';
 
    else
 
      return 'ending_outside';
 
    end;
 
  end;
 
  nosave = true;
 
  noautosave = true;
 
	disp = translate("ending_locale", 'game_end');
 
	noinv = true;
 
	notitle = true;
 
  disp = translate("ending_locale", 'game_end');
 
  noinv = true;
 
  notitle = true;
 
  themeInit = function(s)
 
    if irradiated then
 
      return show_ending('bwm', 'images/endings/tower_ruin_bw.png');
 
    else
 
      return show_ending('main', 'images/endings/tower_ruin.png');
 
    end;
 
	end;
 
	dsc = function(s)
 
		pn(translate_now("ending_locale", 'formatted_2'));
 
		if solarscale_with_me then
 
			pn(translate_now("ending_locale", 'solarscale_lost'));
 
		end;
 
  end;
 
  dsc = function(s)
 
    pn(translate_now("ending_locale", 'formatted_2'));
 
    if solarscale_with_me then
 
      pn(translate_now("ending_locale", 'solarscale_lost'));
 
    end;
 
    if irradiated then
 
      p(translate_now("ending_locale", 'irradiated'));
 
    end;
 
	end;
 
  end;
 
  way = {
 
    path {translate("common_locale", 'continue'), function(s)
 
        if irradiated then
 
          _'ending_credits'.etype = 'formatbw';
 
        else
 
          _'ending_credits'.etype = 'format';
 
        end;
 
        return 'ending_credits';
 
    end};
 
  };
 
}
 

	
 
--[[
 
3. True ending stage 1
 
]]
 

	
 
-- 3a. With solarscale
 

	
 
ending_room {
 
  nam = 'ending_dissolving_tower_solarscale';
 
  theme = 'ending_outside';
 
  dsc = translate("ending_locale", 'ending_dissolving_tower_solarscale');
 
  onenter = function(s)
 
    enableSmoke('images/endings/crater_edge/tower_solarscale.png', 1);
 
  end;
 
  themeInit = function(s)
 
    local scale = diretheme.get_scale();
 
    local width, height = diretheme.get_scaled_screen();
 
    local dx = math.floor((width - 960) / 2);
 
    local dy = math.floor((height - 600) / 2);
 
    
 
    if dx < 0 then
 
      dx = 0;
 
    end;
 
    
 
    if dy < 0 then
 
      dy = height - 600;
 
    end;
 
    
 
		show_ending('main', 'images/endings/crater_edge/tower_solarscale.png', 1);
 
    show_ending('main', 'images/endings/crater_edge/tower_solarscale.png', 1);
 
    animation_set({
 
        {type="delay", delay=2000};
 
        {
 
          type="anim", 
 
          image=get_sprite('images/endings/crater_edge/tower_animation.png'),
 
          x = (dx + 445) * scale,
 
          y = (dy + 311) * scale,
 
          w = 40 * scale,
 
          h = 94 * scale,
 
          frames = 14,
 
          delay = 150,
 
        };
 
    }, true);
 
    timer:set(25);
 
	end;
 
  end;
 
  onexit = function(s)
 
    fading.enabled = false;
 
  end;
 
  way = {
 
		path {translate("common_locale", 'continue'), 'ending_solarscale_flies_away'};
 
	};
 
    path {translate("common_locale", 'continue'), 'ending_solarscale_flies_away'};
 
  };
 
}
 

	
 
room {
 
	nam = 'ending_solarscale_pre';
 
	theme = 'tower';
 
	disp = translate("tower_locale", 'tower_level_4_room_2_disp');
 
  nam = 'ending_solarscale_pre';
 
  theme = 'tower';
 
  disp = translate("tower_locale", 'tower_level_4_room_2_disp');
 
  nofollow = true;
 
	noinv = true;
 
  noinv = true;
 
  nosave = true;
 
  noautosave = true;
 
  pic = 'images/tower_level_4_room_2_light.png';
 
  dsc = translate("ending_locale", 'ending_solarscale_pre');
 
	way = {
 
		path {translate("common_locale", 'continue'), 'ending_solarscale_dlg'};
 
	};
 
  way = {
 
    path {translate("common_locale", 'continue'), 'ending_solarscale_dlg'};
 
  };
 
}
 

	
 
local solarscale_convince = function(s)
 
  _'ending_solarscale_dlg'.weight = _'ending_solarscale_dlg'.weight + 1;
 
  if _'ending_solarscale_dlg'.weight >= 5 then
 
    walk('ending_solarscale_stays');
 
  elseif _'ending_solarscale_dlg'.weight >= 3 then
 
    return translate_now("ending_locale", "true_solarscale_convince_level_3");
 
  elseif _'ending_solarscale_dlg'.weight >= 2 then
 
    return translate_now("ending_locale", "true_solarscale_convince_level_2");
 
  elseif _'ending_solarscale_dlg'.weight == 1 then
 
    return translate_now("ending_locale", "true_solarscale_convince_level_1");
 
  end;
 
end;
 

	
 
dlg {
 
  weight = 0;
 
	nam = 'ending_solarscale_dlg';
 
	nofollow = true;
 
	theme = 'tower';
 
	noinv = true;
 
	disp = translate("solarscale_locale", 'disp');
 
  nam = 'ending_solarscale_dlg';
 
  nofollow = true;
 
  theme = 'tower';
 
  noinv = true;
 
  disp = translate("solarscale_locale", 'disp');
 
  nosave = true;
 
  noautosave = true;
 
  pic = 'images/tower_level_4_room_2_light.png;images/characters/solarscale_tower_dusk.png';
 
	enter = translate("ending_locale", 'true_solarscale_dlg_enter');
 
	phr = {
 
		{translate("ending_locale", "true_solarscale_dlg_1"), function(s)
 
			walk('ending_solarscale_leaving_hold');
 
		end};
 
		{translate("ending_locale", "true_solarscale_dlg_2"), translate("ending_locale", "true_solarscale_dlg_2_response"), next='#convince'};
 
		{translate("ending_locale", "true_solarscale_dlg_end"), function(s)
 
			walk('ending_solarscale_leaving_farewell');
 
		end};
 
  enter = translate("ending_locale", 'true_solarscale_dlg_enter');
 
  phr = {
 
    {translate("ending_locale", "true_solarscale_dlg_1"), function(s)
 
      walk('ending_solarscale_leaving_hold');
 
    end};
 
    {translate("ending_locale", "true_solarscale_dlg_2"), translate("ending_locale", "true_solarscale_dlg_2_response"), next='#convince'};
 
    {translate("ending_locale", "true_solarscale_dlg_end"), function(s)
 
      walk('ending_solarscale_leaving_farewell');
 
    end};
 
    {false, '#convince', 
 
      {translate("ending_locale", "true_solarscale_dlg_1"), function(s)
 
        walk('ending_solarscale_leaving_hold');
 
      end};
 
      {cond=function(s) return _'ending_solarscale_dlg'.weight > 0 end; translate("ending_locale", "true_solarscale_dlg_end"), function(s)
 
        walk('ending_solarscale_leaving_farewell')
 
      end};
 
      {translate("ending_locale", "true_solarscale_dlg_3"), solarscale_convince},
 
      {cond=function(s) return _'solarscale_ally'.after_discussed end; translate("ending_locale", "true_solarscale_dlg_4"), solarscale_convince},
 
      {cond=function(s) return had_tea and tea_answer_1 == 1 and tea_answer_2 == 1 and tea_answer_3 == 1 end; translate("ending_locale", "true_solarscale_dlg_5"), solarscale_convince},
 
      {cond=function(s) return solarscale_tower end; translate("ending_locale", "true_solarscale_dlg_6"), solarscale_convince},
 
      {cond=function(s) return solarscale_helps < 2 end; translate("ending_locale", "true_solarscale_dlg_7"), solarscale_convince};
 
      {cond=function(s) return solarscale_glade_visited end; translate("ending_locale", "true_solarscale_dlg_8"), solarscale_convince};
 
    };
 
	};
 
  };
 
}
 

	
 
room {
 
  nam = 'ending_solarscale_stays';
 
  nofollow = true;
 
	theme = 'tower';
 
  theme = 'tower';
 
  nosave = true;
 
  noautosave = true;
 
  noinv = true;
 
  disp = translate("solarscale_locale", 'disp');
 
  pic = 'images/tower_level_4_room_2_light.png;images/characters/solarscale_tower_dusk.png';
 
  decor = translate("ending_locale", "true_solarscale_convince_level_4");
 
  way = {
 
		path {translate("common_locale", 'continue'), 'ending_solarscale_stays_part_2'};
 
	};
 
    path {translate("common_locale", 'continue'), 'ending_solarscale_stays_part_2'};
 
  };
 
};
 

	
 
room {
 
	nam = 'ending_solarscale_stays_part_2';
 
	notitle = true;
 
	nofollow = true;
 
	theme = 'ending_outside';
 
	noinv = true;
 
	disp = translate("ending_locale", 'game_end');
 
  nam = 'ending_solarscale_stays_part_2';
 
  notitle = true;
 
  nofollow = true;
 
  theme = 'ending_outside';
 
  noinv = true;
 
  disp = translate("ending_locale", 'game_end');
 
  nosave = true;
 
  noautosave = true;
 
	dsc = translate("ending_locale", 'true_solarscale_stays');
 
  dsc = translate("ending_locale", 'true_solarscale_stays');
 
  onenter = function(s)
 
    solarscale_stays = true;
 
    enableSmoke('images/endings/crater_edge/crater_edge.png', 1);
 
  end;
 
  themeInit = function(s)
 
    local scale = diretheme.get_scale();
 
    local width, height = diretheme.get_scaled_screen();
 
    local dx = math.floor((width - 960) / 2);
 
    local dy = math.floor((height - 600) / 2);
 
    
 
    if dx < 0 then
 
      dx = 0;
 
    end;
 
    
 
    if dy < 0 then
 
      dy = height - 600;
 
    end;
 
    
 
		show_ending('main', 'images/endings/crater_edge/crater_edge.png', 1);
 
    show_ending('main', 'images/endings/crater_edge/crater_edge.png', 1);
 
    animation_set({
 
        {type="delay", delay=2000};
 
        {
 
          type="anim", 
 
          image=get_sprite('images/endings/crater_edge/tower_animation.png'),
 
          x = (dx + 445) * scale,
 
          y = (dy + 311) * scale,
 
          w = 40 * scale,
 
          h = 94 * scale,
 
          frames = 14,
 
          delay = 150,
 
        };
 
    }, true);
 
  
 
    timer:set(25);
 
	end;
 
  end;
 
  onexit = function(s)
 
    fading.enabled = false;
 
  end;
 
	way = {
 
		path {translate("common_locale", 'continue'), 'ending_welcome'};
 
	};
 
  way = {
 
    path {translate("common_locale", 'continue'), 'ending_welcome'};
 
  };
 
};
 

	
 
room {
 
  nam = 'ending_solarscale_leaving_farewell';
 
  nofollow = true;
 
	theme = 'tower';
 
  theme = 'tower';
 
  nosave = true;
 
  noautosave = true;
 
  noinv = true;
 
  disp = translate("tower_locale", 'tower_level_4_room_2_disp');
 
  pic = 'images/tower_level_4_room_2_light.png';
 
  decor =  translate("ending_locale", "true_solarscale_dlg_end_response");
 
  decor = translate("ending_locale", "true_solarscale_dlg_end_response");
 
  way = {
 
		path {translate("common_locale", 'continue'), 'ending_solarscale_leaving_part_2'};
 
	};
 
    path {translate("common_locale", 'continue'), 'ending_solarscale_leaving_part_2'};
 
  };
 
};
 

	
 
room {
 
  nam = 'ending_solarscale_leaving_hold';
 
  nofollow = true;
 
	theme = 'tower';
 
  theme = 'tower';
 
  nosave = true;
 
  noautosave = true;
 
  noinv = true;
 
  pic = 'images/tower_level_4_room_2_light.png';
 
  disp = translate("tower_locale", 'tower_level_4_room_2_disp');
 
  decor =  translate("ending_locale", "true_solarscale_dlg_1_response");
 
  way = {
 
		path {translate("common_locale", 'continue'), 'ending_solarscale_leaving_part_2'};
 
	};
 
    path {translate("common_locale", 'continue'), 'ending_solarscale_leaving_part_2'};
 
  };
 
};
 

	
 
room {
 
	nam = 'ending_solarscale_leaving_part_2';
 
	notitle = true;
 
	nofollow = true;
 
	noinv = true;
 
	disp = translate("ending_locale", 'game_end');
 
  nam = 'ending_solarscale_leaving_part_2';
 
  notitle = true;
 
  nofollow = true;
 
  noinv = true;
 
  disp = translate("ending_locale", 'game_end');
 
  theme = 'ending_outside';
 
  nosave = true;
 
  noautosave = true;
 
  onenter = function(s)
 
    enableSmoke('images/endings/tower_left_bg.png');
 
  end;
 
  themeInit = function(s)
 
    local scale = diretheme.get_scale();
 
    local width, height = diretheme.get_scaled_screen();
 
    local dx = math.floor((width - 960) / 2);
 
    local dy = math.floor((height - 600) / 2);
 
    
 
		show_ending('main', 'images/endings/tower_left_bg.png');
 
    local animheight = 600 * scale;
 
    if width == 640 and height == 480 then
 
      animheight=360 * scale;
 
    end;
 
    
 
    show_ending('main', 'images/endings/tower_left_bg.png');
 
    animation_set({
 
        {type="delay", delay=2000};
 
        {
 
          type="image", 
 
          image=get_sprite('images/endings/tower_left_bg.png'),
 
          x = dx * scale,
 
          y = dy * scale,
 
          w = 960 * scale,
 
          h = 600 * scale,
 
          h = animheight,
 
          background = true
 
        };
 
        {
 
          type="anim",
 
          image=get_sprite('images/endings/solarscale_left_frames.png'),
 
          x = dx * scale,
 
          y = dy * scale,
 
          w = 960 * scale,
 
          h = 600 * scale,
 
          h = animheight,
 
          frames = 15,
 
          delay = 100,
 
          background = true,
 
          frame_data = {
 
            {},
 
            {x=214, y=326, w=8,   h=8,   dx=467, dy=294},
 
            {x=214, y=309, w=28,  h=17,  dx=458, dy=288},
 
            {x=49,  y=518, w=44,  h=18,  dx=449, dy=295},
 
            {x=0,   y=518, w=49,  h=24,  dx=445, dy=293},
 
            {x=214, y=272, w=43,  h=37,  dx=447, dy=293},
 
            {x=153, y=505, w=73,  h=47,  dx=431, dy=296},
 
            {x=0,   y=342, w=153, h=59,  dx=388, dy=288},
 
            {x=0,   y=272, w=214, h=70,  dx=364, dy=272},
 
            {x=0,   y=401, w=142, h=117, dx=396, dy=229},
 
            {x=153, y=342, w=102, h=163, dx=422, dy=144},
 
            {x=0,   y=0,   w=257, h=163, dx=347, dy=50},
 
            {x=0,   y=163, w=257, h=109, dx=347, dy=0},
 
            {x=93,  y=518, w=22,  h=31,  dx=462, dy=0},
 
            {}
 
          };
 
        };
 
        {
 
          type="anim",
 
          image=get_sprite('images/endings/tower_left_frames.png'),
 
          x = dx * scale,
 
          y = dy * scale,
 
          w = 960 * scale, 
 
          h = 600 * scale, 
 
          h = animheight,
 
          frames=6,
 
          delay=500,
 
          background = true,
 
          frame_data = {
 
            {};
 
            {x=0, y=318, w=51, h=16,  dx=444, dy=246};
 
            {x=0, y=276, w=51, h=42,  dx=444, dy=246};
 
            {x=0, y=202, w=51, h=74,  dx=444, dy=246};
 
            {x=0, y=108, w=51, h=94,  dx=444, dy=246};
 
            {x=0, y=0,   w=51, h=108, dx=444, dy=246};
 
          };
 
        };
 
    }, true);
 
  
 
    timer:set(25);
 
  end;
 
  onexit = function(s)
 
    fading.enabled = false;
 
  end;
 
  pic = 'images/tower_level_4_room_2_light.png';
 
  decor = translate("ending_locale", 'true_solarscale_leaving');
 
	way = {
 
		path {translate("common_locale", 'continue'), 'ending_dissolving_tower_solarscale_alt'};
 
	};
 
  way = {
 
    path {translate("common_locale", 'continue'), 'ending_dissolving_tower_solarscale_alt'};
 
  };
 
}
 

	
 
room {
 
  nam = 'ending_dissolving_tower_solarscale_alt';
 
  notitle = true;
 
	nofollow = true;
 
	theme = 'ending_outside';
 
  nofollow = true;
 
  theme = 'ending_outside';
 
  noinv = true;
 
  notitle = true;
 
  nosave = true;
 
  noautosave = true;
 
  disp = translate("ending_locale", 'game_end');
 
  themeInit = function(s)
 
    local scale = diretheme.get_scale();
 
    local width, height = diretheme.get_scaled_screen();
 
    local dx = math.floor((width - 960) / 2);
 
    local dy = math.floor((height - 600) / 2);
 
    
 
    if dx < 0 then
 
      dx = 0;
 
    end;
 
    
 
    if dy < 0 then
 
      dy = height - 600;
 
    end;
 
    
 
		show_ending('main', 'images/endings/crater_edge/tower_solarscale.png', 1);
 
    show_ending('main', 'images/endings/crater_edge/tower_solarscale.png', 1);
 
    animation_set({
 
        {type="delay", delay=2000};
 
        {
 
          type="anim", 
 
          image=get_sprite('images/endings/crater_edge/tower_animation.png'),
 
          x = (dx + 445) * scale,
 
          y = (dy + 311) * scale,
 
          w = 40 * scale,
 
          h = 94 * scale,
 
          frames = 14,
 
          delay = 150,
 
        };
 
    }, true);
 
    timer:set(25);
 
	end;
 
  end;
 
  dsc = translate("ending_locale", 'ending_dissolving_tower_solarscale_alt');
 
  way = {
 
		path {translate("common_locale", 'continue'), 'ending_solarscale_flies_away'};
 
	};
 
    path {translate("common_locale", 'continue'), 'ending_solarscale_flies_away'};
 
  };
 
};
 

	
 
room {
 
  nam = 'ending_solarscale_flies_away';
 
  notitle = true;
 
	nofollow = true;
 
	theme = 'ending_outside';
 
  nofollow = true;
 
  theme = 'ending_outside';
 
  noinv = true;
 
  notitle = true;
 
  nosave = true;
 
  noautosave = true;
 
  disp = translate("ending_locale", 'game_end');
 
  themeInit = function(s)
 
    local scale = diretheme.get_scale();
 
    local width, height = diretheme.get_scaled_screen();
 
    local dx = math.floor((width - 960) / 2);
 
    local dy = math.floor((height - 600) / 2);
 
    
 
    if dx < 0 then
 
      dx = 0;
 
    end;
 
    
 
    if dy < 0 then
 
      dy = height - 600;
 
    end;
 
    
 
		show_ending('main', 'images/endings/crater_edge/solarscale.png', 1);
 
    local animheight = 600;
 
    if width == 640 and height == 480 then
 
      animheight = 420;
 
    end;
 
    
 
    show_ending('main', 'images/endings/crater_edge/solarscale.png', 1);
 
    animation_set({
 
        {type="delay", delay=2000};
 
        {
 
          type="image", 
 
          image=get_sprite('images/endings/crater_edge/crater_edge_no_tower.png'),
 
          x = dx * scale,
 
          y = dy * scale,
 
          w = 960 * scale,
 
          h = 600 * scale,
 
          h = animheight * scale,
 
          background = true
 
        };
 
        {
 
          type="anim",
 
          image=get_sprite("images/endings/crater_edge/solarscale_frames.png");
 
          x = dx * scale,
 
          y = dy * scale,
 
          w = 960 * scale,
 
          h = 600 * scale,
 
          h = animheight * scale,
 
          frames = 28,
 
          delay = 125,
 
          background = true,
 
          frame_data = {
 
            --fx, fy, w, h, dx, dy
 
            {x=653, y=0,    w=154, h=384, dx=0,   dy=216};
 
            {x=494, y=658,  w=226, h=400, dx=0,   dy=200};
 
            {x=0,   y=658,  w=494, h=406, dx=0,   dy=194};
 
            {x=0,   y=0,    w=653, h=280, dx=0,   dy=290};
 
            {x=0,   y=280,  w=647, h=378, dx=0,   dy=222};
 
            {x=0,   y=1064, w=481, h=280, dx=89,  dy=320};
 
            {x=481, y=1064, w=299, h=239, dx=226, dy=361};
 
            {x=365, y=1344, w=326, h=214, dx=241, dy=386};
 
            {x=0,   y=1344, w=365, h=228, dx=270, dy=372};
 
            {x=365, y=1558, w=209, h=119, dx=354, dy=397};
 
            {x=0,   y=1572, w=155, h=103, dx=407, dy=395};
 
            {x=653, y=472,  w=119, h=54,  dx=427, dy=389};
 
            {x=653, y=384,  w=136, h=88,  dx=457, dy=339};
 
            {x=653, y=526,  w=71,  h=41,  dx=520, dy=253};
 
            {x=789, y=397,  w=15,  h=27,  dx=583, dy=210};
 
            {x=724, y=526,  w=25,  h=18,  dx=609, dy=168};
 
            {x=789, y=424,  w=12,  h=7,   dx=627, dy=133};
 
            {x=647, y=280,  w=5,   h=2,   dx=664, dy=81};
 
            {x=772, y=472,  w=32,  h=35,  dx=666, dy=47};
 
            {x=647, y=282,  w=3,   h=3,   dx=665, dy=80};
 
            {x=690, y=567,  w=20,  h=37,  dx=659, dy=73};
 
            {x=653, y=567,  w=37,  h=27,  dx=650, dy=68};
 
            {x=653, y=594,  w=27,  h=25,  dx=654, dy=69};
 
            {x=789, y=384,  w=17,  h=13,  dx=658, dy=75};
 
            {x=789, y=431,  w=11,  h=11,  dx=661, dy=76};
 
            {x=800, y=431,  w=7,   h=7,   dx=663, dy=78};
 
            {x=650, y=282,  w=1,   h=1,   dx=666, dy=81};
 
            {};
 
          };
 
        };
 
    }, true);
 
	end;
 
  end;
 
  dsc = translate("ending_locale", 'true_solarscale_outside_part_2');
 
  way = {
 
		path {translate("common_locale", 'continue'), 'ending_welcome'};
 
	};
 
    path {translate("common_locale", 'continue'), 'ending_welcome'};
 
  };
 
}
 

	
 
local function bayer(size)
 
  if size == 1 then
 
    return {
 
      {0}
 
    };
 
  end;
 
  
 
  local u = bayer(size / 2);
 
  local v = 4;
 
  local h = size / 2;
 
  local m = {};
 
  
 
  for j = 1, h do
 
    m[j] = {};
 
    for i = 1, h do
 
      m[j][i] = u[j][i] * v;
 
    end;
 
  end;
 
  
 
  for j = h + 1, size do
 
    m[j] = {};
 
    for i = 1, h do
 
      m[j][i] = u[j - h][i] * v + 3;
 
    end;
 
  end;
 
  
 
  for j = 1, h do
 
    for i = h + 1, size  do
 
      m[j][i] = u[j][i - h] * v + 2;
 
    end;
 
  end;
 
  
 
  for j = h + 1, size do
 
    for i = h + 1, size do
 
      m[j][i] = u[j - h][i - h] * v + 1;
 
    end;
 
  end;
 
  
 
  return m;
 
end;
 

	
 
ending_room {
 
  nam = 'ending_welcome';
 
  theme = 'ending_inside';
 
  themeInit = function(s)
 
    if instead.tiny then
 
      return;
 
    end;
 
    local scale = diretheme.get_scale();
 
    local uwidth, uheight = diretheme.get_screen();
 
    local width, height = diretheme.get_scaled_screen();
 
    local pic_dx = math.floor((width - 960) / 2);
 
    local pic_dy = math.floor((height - 600) / 2);
 
    local dx = 0;
 
    local dy = 0;
 
    if width > 960 then
 
      dx = math.floor((width - 960) / 2);
 
      width = 960;
 
      pic_dx = 0;
 
    end;
 
    if height > 600 then
 
      dy = math.floor((height - 600) / 2);
 
      height = 600;
 
      pic_dy = 0;
 
    end;
 
    
 
    local src, dst, newsrc;
 
    if solarscale_stays then
 
      src = sprite.new('images/endings/pre_space_1_solarscale.png');
 
      dst = sprite.new('images/endings/pre_space_2_solarscale.png');
 
    else
 
      src = sprite.new('images/endings/pre_space_1.png');
 
      dst = sprite.new('images/endings/pre_space_2.png');
 
    end;
 
    
 
    if width == 640 and height == 480 then
 
      height = 300;
 
    end;
 
    
 
    if pic_dx < 0 or pic_dy < 0 then
 
      local src2 = sprite.new(width, height);
 
      src:copy(-pic_dx, -pic_dy, width, height, src2, 0, 0);
 
      src = src2;
 
    end;
 
    
 
    newsrc = sprite.new(width, height);
 
    src:copy(-pic_dx, -pic_dy, width, height, newsrc, 0, 0);
 
    
 
    -- A tiny performance test: painting 1 - 512 lines, doubling every time. If any of the operations takes more than 10ms -- switch to lo-perf mode
 
    local passed = true;
 
    local test = 1;
 
    while passed and test <= 512 do
 
      local t = instead.ticks();
 
      local tdst = sprite.new(width, test);
 
      tdst:draw(-pic_dx, 0, width, test, newsrc, 0, 0, 1);
 
      if instead.ticks() - t > 10 then
 
        passed = false;
 
      end;
 
      test = test * 2;
 
    end;
 
    
 
    src:copy(0, 0, width, height, newsrc, 0, 0);
 
    
 
    local alpha = 1;
 
    local part = 0;
 
    local partcount = 10;
 
    local partheight = math.floor(600 / partcount);
 
    local partheight;
 
    local parts = {};
 
    local dalpha = 1;
 
    local alternative = false;
 
    local delta = 25;
 
    
 
    -- Now calculate animation speed
 
    -- Expected duration is 125 ms before shifting alpha by 1
 
    if passed then
 
      -- Test passed, can paint the whole sprite in one part
 
      partcount = 1;
 
      partheight = height;
 
    else
 
      -- test failed; Calculate, how fast painting can be done
 
      test = math.max(test / 4, 1); -- Rows in one frame
 
      partcount = math.ceil(height / test);
 
      dalpha = math.floor(partcount / 5);
 
      alpha = dalpha;
 
      partheight = math.floor(height / partcount);
 
    end;  
 
    
 
    for i = 1, partcount do
 
      parts[i] = sprite.new(width, partheight);
 
      dst:copy(-pic_dx, (i - 1) * partheight, width, partheight, parts[i], 0, 0);
 
    end;    
 
    
 
    local process = function(s)
 
      src:copy(-pic_dx, part * partheight, width, partheight, newsrc, 0, pic_dy + part * partheight);
 
    if partcount > 25 then
 
      -- test completely failed; Use alternative animation
 
      alternative = true;
 
      alpha = 1;
 
      delta = 125;
 
    else
 
      for i = 1, partcount do
 
        parts[i] = sprite.new(width, partheight);
 
        dst:copy(-pic_dx, (i - 1) * partheight - pic_dy, width, partheight, parts[i], 0, 0);
 
      end;
 
      dst = nil;
 
    end;
 
        
 
    local process;
 
    if alternative then
 
      local map = {};
 
      local m = bayer(16);
 
      for j = 1, 16 do
 
        for i = 1, 16 do
 
          map[i + j * 16 - 16] = m[j][i];
 
        end;
 
      end;      
 
      
 
      if alpha < 255 then
 
        dst:draw(-pic_dx, part * partheight, width, partheight, newsrc, 0, pic_dy + part * partheight, alpha);
 
      else
 
        dst:copy(-pic_dx, part * partheight, width, partheight, newsrc, 0, pic_dy + part * partheight);
 
      end;
 
      dst = dst:scale(scale, scale, false);
 
      
 
      part = part + 1
 
      if part >= partcount then
 
        part = 0
 
        alpha = alpha + 2
 
        if alpha > 255 then
 
          s.process = nil
 
          -- TODO End
 
      process = function(s)
 
        local i = map[alpha];
 
        while i < height do
 
          if scale == 1 then
 
            dst:copy(-pic_dx, i - pic_dy, width, 1, s.sprite, 0, i);
 
          else
 
            dst:copy(-pic_dy, i * scale - pic_dy, width * scale, scale, s.sprite, 0, i * scale);
 
          end;
 
          i = i + 256;
 
        end;
 
        
 
        if scale ~= 1 then
 
          s.sprite = newsrc:scale(scale, scale, false);
 
        alpha = alpha + 1;
 
        if alpha == 257 then
 
          s.process = nil
 
        end;
 
      end;
 
    else
 
      process = function(s)
 
        src:copy(0, part * partheight, width, partheight, newsrc, 0, part * partheight);
 
        
 
        if alpha < 255 then
 
          parts[part + 1]:draw(newsrc, 0, part * partheight, alpha);
 
        else
 
          newsrc:copy(s.sprite, 0, 0);
 
          parts[part + 1]:copy(newsrc, 0, part * partheight);
 
        end;
 
        
 
        return false;
 
        part = part + 1
 
        if part >= partcount then
 
          if alpha > 255 then
 
            s.process = nil
 
            -- TODO End
 
          end;
 
          
 
          part = 0
 
          alpha = alpha + dalpha;
 
          
 
          if scale ~= 1 then
 
            s.sprite = newsrc:scale(scale, scale, false);
 
          elseif partcount > 1 then
 
            newsrc:copy(s.sprite, 0, 0);
 
          end;
 
          
 
          return false;
 
        end;
 
        
 
        return true;
 
      end;
 
      
 
      return true;
 
    end;
 

	
 
    if solarscale_stays then
 
      show_ending('tower', 'images/endings/pre_space_1_solarscale.png');
 
    else
 
      show_ending('tower', 'images/endings/pre_space_1.png');
 
    end;
 
    local spr
 
    if scale ~= 1 then
 
      spr = newsrc:scale(scale, scale, false);
 
    elseif partcount == 1 then
 
      spr = newsrc;
 
    else
 
      spr = newsrc:dup();
 
    end;
 
      
 
    animation_set({
 
      {type="image", image=spr, x=dx * scale, y=dy * scale, w=width * scale, h=height * scale, process=process, delay=25, background=true};
 
      {type="image", image=spr, x=dx * scale, y=dy * scale, w=width * scale, h=height * scale, process=process, delay=125, background=true};
 
    });
 
    spr = nil;  -- remove reference
 
    timer:set(25);
 
	end;
 
  end;
 
  dsc = translate("ending_locale", 'ending_welcome');
 
  way = {
 
		path {translate("common_locale", 'continue'), function(s)
 
    path {translate("common_locale", 'continue'), function(s)
 
        if solarscale_stays then
 
          return 'ending_solarscale_flight';
 
        else
 
          return 'ending_space_1';
 
        end;
 
    end};
 
	};
 
  };
 
};
 

	
 
ending_room {
 
  nam = 'ending_solarscale_flight';
 
  theme = 'ending_inside';
 
  themeInit = function(s)
 
    if instead.tiny then
 
      return;
 
    end;
 
    local scale = diretheme.get_scale();
 
    local width, height = diretheme.get_scaled_screen();
 
    local dx = math.floor((width - 960) / 2);
 
    local dy = math.floor((height - 600) / 2);
 
    
 
    local animheight = 600 * scale;
 
    if width == 640 and height == 480 then
 
      animheight=360 * scale;
 
    end;
 
    
 
    show_ending('tower', 'images/endings/solarscale/solarscale_first.png');
 
    animation_set({
 
        {type="delay", delay=2000};
 
        {
 
          type="image",
 
          image="images/endings/solarscale/solarscale_bg.png",
 
          x = dx * scale,
 
          y = dy * scale,
 
          w = 960 * scale,
 
          h = 600 * scale,
 
          h = animheight,
 
          background = true
 
        },
 
        {
 
          type="anim", 
 
          image=get_sprite("images/endings/solarscale/solarscale_frames.png"),
 
          x = dx * scale,
 
          y = dy * scale,
 
          w = 960 * scale,
 
          h = 600 * scale,
 
          h = animheight,
 
          frames = 70,
 
          delay={
 
            150, 150, 150, 150, 150,
 
            150, 150, 150, 150, 150,
 
            150, 150, 150, 150, 150,
 
            150, 150, 150, 150, 150,
 
            150, 150, 150, 150, 150, 
 
            150, 150, 150, 200, 100, 
 
            100, 200, 200, 250, 250, 
 
            150, 150, 150, 200, 150,
 
            150, 200, 200, 200, 200, 
 
            200, 200, 150, 150, 100, 
 
            100, 100, 100, 100, 100, 
 
            100, 100, 100, 100, 100, 
 
            100, 100, 100, 100, 100, 
 
            150, 150, 150, 150, 150,
 
          },
 
          frame_data = {
 
            {x=1106, y=1385, w=592, h=454, dx=368, dy=146},
 
            {x=0   , y=2294, w=592, h=453, dx=368, dy=147},
 
            {x=3037, y=924 , w=558, h=459, dx=402, dy=141},
 
            {x=592 , y=1840, w=479, h=449, dx=481, dy=151},
 
            {x=4181, y=0   , w=485, h=459, dx=475, dy=141},
 
            {x=4107, y=3124, w=571, h=342, dx=373, dy=258},
 
            {x=0   , y=3199, w=840, h=311, dx=120, dy=289},
 
            {x=2226, y=3194, w=667, h=329, dx=253, dy=271},
 
            {x=2795, y=2747, w=588, h=408, dx=372, dy=192},
 
            {x=3383, y=3124, w=724, h=348, dx=192, dy=243},
 
            {x=840 , y=3199, w=606, h=288, dx=215, dy=287},
 
            {x=548 , y=719 , w=186, h=188, dx=439, dy=88},
 
            {x=1692, y=3335, w=220, h=81 , dx=573, dy=34},
 
            {x=355 , y=1656, w=104, h=161, dx=788, dy=121},
 
            {x=355 , y=1424, w=152, h=232, dx=616, dy=199},
 
            {x=1446, y=3335, w=246, h=134, dx=349, dy=330},
 
            {x=548 , y=504 , w=296, h=215, dx=43 , dy=248},
 
            {x=1500, y=2881, w=183, h=94 , dx=122, dy=68},
 
            {x=1500, y=2747, w=164, h=134, dx=343, dy=69},
 
            {x=1446, y=3199, w=259, h=136, dx=392, dy=178},
 
            {x=0   , y=1424, w=355, h=338, dx=366, dy=53},
 
            {x=0   , y=0   , w=845, h=504, dx=115, dy=96},
 
            {x=3383, y=2747, w=615, h=377, dx=345, dy=223},
 
            {x=3998, y=2747, w=599, h=375, dx=361, dy=225},
 
            {x=2226, y=2747, w=569, h=447, dx=391, dy=153},
 
            {x=519 , y=1385, w=587, h=455, dx=373, dy=145},
 
            {x=1698, y=1385, w=592, h=454, dx=368, dy=146},
 
            {x=1106, y=1839, w=592, h=454, dx=368, dy=146},
 
            {x=1698, y=1839, w=592, h=454, dx=368, dy=146},
 
            {x=2630, y=1383, w=467, h=457, dx=414, dy=143},
 
            {x=0   , y=2747, w=469, h=452, dx=433, dy=148},
 
            {x=548 , y=926 , w=521, h=459, dx=355, dy=141},
 
            {x=4156, y=1839, w=521, h=453, dx=355, dy=147},
 
            {x=3313, y=2294, w=533, h=453, dx=367, dy=147},
 
            {x=3846, y=2294, w=533, h=453, dx=367, dy=147},
 
            {x=4138, y=1383, w=531, h=453, dx=370, dy=147},
 
            {x=2779, y=2294, w=534, h=453, dx=370, dy=147},
 
            {x=1705, y=2293, w=537, h=453, dx=370, dy=147},
 
            {x=2242, y=2294, w=537, h=453, dx=370, dy=147},
 
            {x=1705, y=2746, w=521, h=453, dx=355, dy=147},
 
            {x=2111, y=926 , w=519, h=459, dx=357, dy=141},
 
            {x=0   , y=965 , w=519, h=459, dx=357, dy=141},
 
            {x=4150, y=924 , w=516, h=459, dx=360, dy=141},
 
            {x=1184, y=2293, w=521, h=454, dx=354, dy=146},
 
            {x=4133, y=463 , w=519, h=459, dx=357, dy=141},
 
            {x=1069, y=926 , w=521, h=459, dx=356, dy=141},
 
            {x=1590, y=926 , w=521, h=459, dx=356, dy=141},
 
            {x=469 , y=2747, w=469, h=452, dx=433, dy=148},
 
            {x=3097, y=1383, w=467, h=457, dx=414, dy=143},
 
            {x=845 , y=0   , w=560, h=463, dx=352, dy=137},
 
            {x=1405, y=0   , w=560, h=463, dx=352, dy=137},
 
            {x=1965, y=0   , w=560, h=463, dx=352, dy=137},
 
            {x=2525, y=0   , w=560, h=463, dx=352, dy=137},
 
            {x=3085, y=0   , w=548, h=463, dx=366, dy=137},
 
            {x=3633, y=0   , w=548, h=463, dx=366, dy=137},
 
            {x=845 , y=463 , w=548, h=463, dx=366, dy=137},
 
            {x=1393, y=463 , w=548, h=463, dx=366, dy=137},
 
            {x=3037, y=463 , w=548, h=461, dx=366, dy=139},
 
            {x=3585, y=463 , w=548, h=461, dx=366, dy=139},
 
            {x=0   , y=504 , w=548, h=461, dx=366, dy=139},
 
            {x=1941, y=463 , w=548, h=463, dx=366, dy=137},
 
            {x=2489, y=463 , w=548, h=463, dx=366, dy=137},
 
            {x=3595, y=924 , w=555, h=459, dx=370, dy=141},
 
            {x=3564, y=1383, w=574, h=456, dx=365, dy=144},
 
            {x=938 , y=2747, w=562, h=451, dx=377, dy=149},
 
            {x=3564, y=1839, w=592, h=454, dx=368, dy=146},
 
            {x=2290, y=1840, w=592, h=454, dx=368, dy=146},
 
            {x=2882, y=1840, w=592, h=454, dx=368, dy=146},
 
            {x=0   , y=1840, w=592, h=454, dx=368, dy=146},
 
            {x=592 , y=2293, w=592, h=454, dx=368, dy=146}
 
          }
 
        };
 
    });
 
    timer:set(25);
 
  end;
 
  dsc = translate("ending_locale", 'ending_solarscale_flight');
 
  way = {
 
		path {translate("common_locale", 'continue'), 'ending_space_1'};
 
	};
 
    path {translate("common_locale", 'continue'), 'ending_space_1'};
 
  };
 
}
 

	
 
ending_room {
 
  nam = 'ending_space_1';
 
  theme = 'ending_inside';
 
  themeInit = function(s)
 
    if instead.tiny then
 
      return;
 
    end;
 
    if solarscale_stays then
 
      show_ending('tower', 'images/endings/solarscale/solarscale_first.png');
 
    else
 
      show_ending('tower', 'images/endings/space.png');
 
    end;
 
    animation_set(false);
 
	end;
 
  end;
 
  dsc = function(s)
 
		if solarscale_stays then
 
			pr(translate_now("ending_locale", 'true_step_1_solarscale'));
 
    if solarscale_stays then
 
      pr(translate_now("ending_locale", 'true_step_1_solarscale'));
 
    else
 
      pr(translate_now("ending_locale", 'true_step_1_alone'));
 
		end;
 
    end;
 
    pn();
 
    pr(translate_now("ending_locale", 'true_step_1'));
 
	end;
 
  end;
 
  way = {
 
		path {translate("common_locale", 'continue'), function(s)
 
    path {translate("common_locale", 'continue'), function(s)
 
      if irradiated then
 
        return 'ending_space_2_irradiated';
 
      else
 
        return 'ending_space_2';
 
      end;
 
    end};
 
  }
 
};
 

	
 
room {
 
	nam = 'ending_space_2';
 
	disp = translate("ending_locale", 'game_end');
 
	noinv = true;
 
	notitle = true;
 
	nofollow = true;
 
  nam = 'ending_space_2';
 
  disp = translate("ending_locale", 'game_end');
 
  noinv = true;
 
  notitle = true;
 
  nofollow = true;
 
  nosave = true;
 
  noautosave = true;
 
	theme = 'ending_inside';
 
  theme = 'ending_inside';
 
  themeInit = function(s)
 
		if solarscale_stays then
 
    if instead.tiny then
 
      return;
 
    end;
 
    if solarscale_stays then
 
      show_ending('tower', 'images/endings/solarscale/solarscale_first.png');
 
    else
 
      show_ending('tower', 'images/endings/space.png');
 
    end;
 
    timer:set(25);
 
	end;
 
	dsc = function(s)
 
  end;
 
  dsc = function(s)
 
    if solarscale_stays then
 
      return translate_now("ending_locale", 'true_step_2_solarscale');
 
    else
 
      return translate_now("ending_locale", 'true_step_2_alone');
 
    end;
 
  end;
 
  way = {
 
    path {translate("common_locale", 'continue'), function(s)
 
        if solarscale_stays then
 
          _'ending_credits'.etype = 'main_solarscale';
 
        else
 
          _'ending_credits'.etype = 'main';
 
        end;
 
        return 'ending_credits';
 
    end};
 
  };
 
};
 

	
 
room {
 
	nam = 'ending_space_2_irradiated';
 
	disp = translate("ending_locale", 'game_end');
 
	noinv = true;
 
	notitle = true;
 
	nofollow = true;
 
  nam = 'ending_space_2_irradiated';
 
  disp = translate("ending_locale", 'game_end');
 
  noinv = true;
 
  notitle = true;
 
  nofollow = true;
 
  nosave = true;
 
  noautosave = true;
 
	theme = 'ending_inside_bw';
 
  theme = 'ending_inside_bw';
 
  themeInit = function(s)
 
		show_ending('bwt', 'images/endings/space_bw.png');
 
	end;
 
	dsc = translate("ending_locale", 'true_step_2_irradiated');
 
    show_ending('bwt', 'images/endings/space_bw.png');
 
  end;
 
  dsc = translate("ending_locale", 'true_step_2_irradiated');
 
  way = {
 
    path {translate("common_locale", 'continue'), function(s)
 
        _'ending_credits'.etype = 'bwm';
 
        return 'ending_credits';
 
    end};
 
  };
 
};
 

	
 
function credits_text(centered) 
 
  local closed_beta_participants = 'arbtttrn6, De@th K!d, Fehatt, Lesha Pak, Łukasz Sawicki, Niko Flang, Oleg Bosh, Terracon, Андрей Лобанов';
 
  local tab = '<tab>';
 
  if centered then
 
    tab = '';
 
  end;
 
  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_translation") .. ':^' ..
 
      tab .. 'Esperanto: arbtttrn6' .. '^^' ..
 
      translate_now("menu_locale", 'credits_thanks');
 
end;
 

	
 
room {
 
	nam = 'ending_credits';
 
	disp = translate("ending_locale", 'thank_you_for_playing');
 
	noinv = true;
 
	nofollow = true;
 
  nam = 'ending_credits';
 
  disp = translate("ending_locale", 'thank_you_for_playing');
 
  noinv = true;
 
  nofollow = true;
 
  nosave = true;
 
  noautosave = true;
 
  etype = false; -- main, mbw, left, leftbw, format, formatbw
 
	theme = function(s)
 
  theme = function(s)
 
    if s.etype == 'main' or s.etype == 'main_solarscale' then
 
      return 'credits_inside';
 
    elseif s.etype == 'bwm' then
 
      return 'credits_inside_bw';
 
    elseif s.etype == 'left' or s.etype == 'format' then
 
      return 'credits_outside';
 
    elseif s.etype == 'leftbw' or s.etype == 'formatbw' then
 
      return 'credits_outside_bw';  
 
    else
 
      error('Unexpected ending');
 
    end;
 
  end;
 
  themeInit = function(s)
 
    if s.etype == 'main' then
 
      show_ending('tower', 'images/endings/space_credits.png', 0, true);
 
    elseif s.etype == 'main_solarscale' then
 
      show_ending('bwt', 'images/endings/solarscale_credits.png', 0, true);
 
    elseif s.etype == 'bwm' then
 
      show_ending('bwt', 'images/endings/space_bw.png', 0, true);
 
    elseif s.etype == 'left' then
 
      show_ending('main', 'images/endings/tower_left_credits.png', 0, true);
 
    elseif s.etype == 'format' then
 
      show_ending('main', 'images/endings/tower_ruin_credits.png', 0, true);
 
    elseif s.etype == 'leftbw' then
 
      show_ending('bwm', 'images/endings/tower_left_bw_credits.png', 0, true);
 
    elseif s.etype == 'formatbw' then
 
      show_ending('bwm', 'images/endings/tower_ruin_bw_credits.png', 0, true);
 
    else
 
      error('Unexpected ending');
 
    end;
 
		timer:set(25);
 
    timer:set(25);
 
    
 
    if s.etype == 'main' and not irradiated then
 
      prefs.completed = true;
 
    end;
 
    fmt.para = false;
 
	end;  
 
  end;  
 
  themeDispose = function(s)
 
    fmt.para = true;
 
  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;
 
  decor = function(s)
 
    return credits_text(true);
 
  end;
 
  way = {
 
    path {translate("ending_locale", 'show_menu'), 'reset'};
 
  };
 
}
 

	
 
room {
 
  nam = 'reset';
 
  onenter = function(s)
 
    std.gamefile('main3.lua', true);
 
    return false;
 
  end;
 
};
 
\ No newline at end of file
forest.lua
Show inline comments
 
global {
 
	raspberry_pie_status = 0;
 
	seen_ring_librarian = false;
 
	seen_ring_box = false;
 
	power_on = false;
 
	irradiated = false;
 
	rods_raised = false;
 
	rods_enriched = false;
 
	candles_solved = false;
 
	solarscale_with_me = false;
 
  raspberry_pie_status = 0;
 
  seen_ring_librarian = false;
 
  seen_ring_box = false;
 
  power_on = false;
 
  irradiated = false;
 
  rods_raised = false;
 
  rods_enriched = false;
 
  candles_solved = false;
 
  solarscale_with_me = false;
 

	
 
	solarscale_helps = 2;
 
	solarscale_glade_visited = false;
 
	pc_status = false;
 
	village_visited = false;
 
	candle_taken = false;
 
  solarscale_helps = 2;
 
  solarscale_glade_visited = false;
 
  pc_status = false;
 
  village_visited = false;
 
  candle_taken = false;
 
  tower_seen = false;
 
  tower_accept_level = 0; --0 -- no contanct, 1 -- level 3 reached, 2 -- level 4 completed, 3 -- complete acceptance
 
  tea_answer_1 = 0; --0 -- not spoken or not correct, 1 -- correct, 2 -- don't know
 
  tea_answer_2 = 0; --0 -- not spoken or not correct, 1 -- correct, 2 -- don't know
 
  tea_answer_3 = 0; --0 -- not spoken or not correct, 1 -- correct, 2 -- don't know
 
  solarscale_tower = false;
 
  had_tea = false;
 
  
 
  library_word = '';
 
  library_book_map = {};
 
  
 
  password1 = '';
 
  password2 = '';
 
  
 
  level_1_target = '434';
 
  
 
  opening_catalyst = 'green_catalyst';
 
  light_catalyst = 'blue_catalyst';
 
  enrichment_catalyst = 'red_catalyst';
 
}
 

	
 
obj {
 
	nam = 'raspberry_pie';
 
	disp = translate("forest_locale", 'raspberry_pie');
 
	inv = translate("forest_locale", 'raspberry_pie_inv');
 
  nam = 'raspberry_pie';
 
  disp = translate("forest_locale", 'raspberry_pie');
 
  inv = translate("forest_locale", 'raspberry_pie_inv');
 
}
 

	
 
obj {
 
	nam = 'flower';
 
	disp =translate("forest_locale", 'flower');
 
	inv = translate("forest_locale", 'flower_inv');
 
  nam = 'flower';
 
  disp =translate("forest_locale", 'flower');
 
  inv = translate("forest_locale", 'flower_inv');
 
}
 

	
 
obj {
 
	nam = 'lock';
 
	disp = translate("forest_locale", 'lock');
 
	disp2 = translate("forest_locale", 'lock_disp2');
 
	disp3 = translate("forest_locale", 'lock_disp3');
 
	inv = translate("forest_locale", 'lock_inv');
 
  nam = 'lock';
 
  disp = translate("forest_locale", 'lock');
 
  disp2 = translate("forest_locale", 'lock_disp2');
 
  disp3 = translate("forest_locale", 'lock_disp3');
 
  inv = translate("forest_locale", 'lock_inv');
 
}
 

	
 
obj {
 
  nam = 'old_map';
 
  disp = translate("forest_locale", 'old_map_disp');
 
  disp2 = translate("forest_locale", 'old_map_disp2');
 
  disp3 = translate("forest_locale", 'old_map_disp3');
 
  inv = function(s)
 
    p(translate_now("forest_locale", 'old_map_inv'));
 
    if village_visited then
 
      p(translate_now("forest_locale", 'old_map_inv_visited'));
 
      if _('fly_west_from_village'):disabled() then
 
        p(translate_now("forest_locale", 'old_map_inv_visited_village'));
 
      end;
 
    else
 
      p(translate_now("forest_locale", 'old_map_inv_not_visited'));
 
    end;
 
  end;
 
}
 

	
 
room {
 
	nam = 'above_forest';
 
	pic = 'images/above_forest.png';
 
	disp = translate("forest_locale", 'above_forest');
 
	theme = 'main';
 
	decor = function(s)
 
		p(translate_now("forest_locale", 'above_forest_decor'));
 
		if not village_visited then
 
			p(translate_now("forest_locale", 'above_forest_decor_village'));
 
		end;
 
	end;
 
	enter = function(s)
 
  nam = 'above_forest';
 
  pic = 'images/above_forest.png';
 
  disp = translate("forest_locale", 'above_forest');
 
  theme = 'main';
 
  decor = function(s)
 
    p(translate_now("forest_locale", 'above_forest_decor'));
 
    if not village_visited then
 
      p(translate_now("forest_locale", 'above_forest_decor_village'));
 
    end;
 
  end;
 
  enter = function(s)
 
    if not have('old_map') then
 
      take('old_map');
 
    end;
 
		if here():from()^'intro_start' or here():from()^'intro_settings' or here():from()^'intro_info' then
 
			stop_menu();
 
		end;
 
		if here():from()^'forest_glade' then
 
			pr(translate_now("forest_locale", 'above_forest_enter'));
 
		end;
 
		snd.music('sound/bgm_forest.ogg');
 
	end;
 
	way = {
 
		 path {"#down", translate("forest_locale", 'transition_land'), 'forest_glade'}:disable();
 
		 path {"#north", translate("forest_locale", 'transition_north_along_road'), 'above_near_village'};
 
	}
 
    if here():from()^'intro_start' or here():from()^'intro_settings' or here():from()^'intro_info' then
 
      stop_menu();
 
    end;
 
    if here():from()^'forest_glade' then
 
      pr(translate_now("forest_locale", 'above_forest_enter'));
 
    end;
 
    snd.music('sound/bgm_forest.ogg');
 
  end;
 
  way = {
 
     path {"#down", translate("forest_locale", 'transition_land'), 'forest_glade'}:disable();
 
     path {"#north", translate("forest_locale", 'transition_north_along_road'), 'above_near_village'};
 
  }
 
}:with {
 
	obj {
 
		nam = '#thicket';
 
		act = translate("forest_locale", 'above_forest_thicket_act');
 
	};
 
	obj {
 
		nam = '#road';
 
		act = function(s)
 
			p(translate_now("forest_locale", 'above_forest_road_act'));
 
  obj {
 
    nam = '#thicket';
 
    act = translate("forest_locale", 'above_forest_thicket_act');
 
  };
 
  obj {
 
    nam = '#road';
 
    act = function(s)
 
      p(translate_now("forest_locale", 'above_forest_road_act'));
 

	
 
			if not village_visited then
 
				p(translate_now("forest_locale", 'above_forest_road_act_village'));
 
			end;
 
		end;
 
	};
 
	obj {
 
		nam = '#powerlines';
 
		act = translate("forest_locale", 'above_forest_powerlines_act');
 
	};
 
	obj {
 
		nam = '#glade';
 
		act = function(s)
 
			p(translate_now("forest_locale", 'above_forest_glade_act'));
 
			if _'#down':disabled() then
 
				_'#down':enable();
 
				p(translate_now("forest_locale", 'above_forest_glade_act_first'));
 
			end;
 
		end;
 
	};
 
	'mountains';
 
	'wind';
 
	'sun';
 
	'clouds';
 
      if not village_visited then
 
        p(translate_now("forest_locale", 'above_forest_road_act_village'));
 
      end;
 
    end;
 
  };
 
  obj {
 
    nam = '#powerlines';
 
    act = translate("forest_locale", 'above_forest_powerlines_act');
 
  };
 
  obj {
 
    nam = '#glade';
 
    act = function(s)
 
      p(translate_now("forest_locale", 'above_forest_glade_act'));
 
      if _'#down':disabled() then
 
        _'#down':enable();
 
        p(translate_now("forest_locale", 'above_forest_glade_act_first'));
 
      end;
 
    end;
 
  };
 
  'mountains';
 
  'wind';
 
  'sun';
 
  'clouds';
 
}
 

	
 
room {
 
	nam = 'forest_glade';
 
	pic = function(s)
 
		if lookup('#flowers', 'forest_glade').state == 1 then
 
			return 'images/forest_glade.png';
 
		else
 
			return 'images/forest_glade.png;images/forest_glade_flower.png@269,201';
 
		end;
 
	end;
 
	disp = translate("forest_locale", 'forest_glade');
 
	theme = 'main';
 
	onenter = translate("forest_locale", 'forest_glade_enter');
 
	decor = translate("forest_locale", 'forest_glade_decor');
 
	way = {
 
		path {'#up', translate("forest_locale", 'transition_fly'), 'above_forest'};
 
	}
 
  nam = 'forest_glade';
 
  pic = function(s)
 
    if lookup('#flowers', 'forest_glade').state == 1 then
 
      return 'images/forest_glade.png';
 
    else
 
      return 'images/forest_glade.png;images/forest_glade_flower.png@269,201';
 
    end;
 
  end;
 
  disp = translate("forest_locale", 'forest_glade');
 
  theme = 'main';
 
  onenter = translate("forest_locale", 'forest_glade_enter');
 
  decor = translate("forest_locale", 'forest_glade_decor');
 
  way = {
 
    path {'#up', translate("forest_locale", 'transition_fly'), 'above_forest'};
 
  }
 
}: with {
 
	obj {
 
		nam = '#thicket';
 
		act = translate("forest_locale", 'forest_glade_thicket');
 
	};
 
	obj {
 
		nam = '#birds';
 
		act = translate("forest_locale", 'forest_glade_birds');
 
	};
 
	obj {
 
		nam = '#grass';
 
		act = function(s)
 
			_'#flowers':enable();
 
			return translate_now("forest_locale", 'forest_glade_grass');
 
		end;
 
	};
 
	obj {
 
		state = 0;
 
		nam = '#flowers';
 
		act = function(s)
 
			if s.state == 0 then
 
				take('flower');
 
				s.state = 1;
 
				return translate_now("forest_locale", 'forest_glade_flowers_first');
 
			else
 
				return translate_now("forest_locale", 'forest_glade_flowers');
 
			end;
 
		end;
 
	}:disable();
 
  obj {
 
    nam = '#thicket';
 
    act = translate("forest_locale", 'forest_glade_thicket');
 
  };
 
  obj {
 
    nam = '#birds';
 
    act = translate("forest_locale", 'forest_glade_birds');
 
  };
 
  obj {
 
    nam = '#grass';
 
    act = function(s)
 
      _'#flowers':enable();
 
      return translate_now("forest_locale", 'forest_glade_grass');
 
    end;
 
  };
 
  obj {
 
    state = 0;
 
    nam = '#flowers';
 
    act = function(s)
 
      if s.state == 0 then
 
        take('flower');
 
        s.state = 1;
 
        return translate_now("forest_locale", 'forest_glade_flowers_first');
 
      else
 
        return translate_now("forest_locale", 'forest_glade_flowers');
 
      end;
 
    end;
 
  }:disable();
 
}
 

	
 
room {
 
	nam = 'above_near_village';
 
	disp = translate("forest_locale", 'near_village');
 
	pic = 'images/above_near_village.png';
 
	theme = 'main';
 
	onenter = function(s)
 
		if here()^'near_village' then
 
			return translate_now("forest_locale", 'above_near_village_enter');
 
		end;
 
	end;
 
	decor = translate("forest_locale", 'above_near_village_decor');
 
	way = {
 
		path {"#south", translate("forest_locale", 'transition_south_along_road'), 'above_forest'};
 
		path {"#down", translate("forest_locale", 'transition_land'), 'near_village'};
 
		path {"#north", translate("forest_locale", 'transition_north_to_the_village'), 'above_village'};
 
	}
 
  nam = 'above_near_village';
 
  disp = translate("forest_locale", 'near_village');
 
  pic = 'images/above_near_village.png';
 
  theme = 'main';
 
  onenter = function(s)
 
    if here()^'near_village' then
 
      return translate_now("forest_locale", 'above_near_village_enter');
 
    end;
 
  end;
 
  decor = translate("forest_locale", 'above_near_village_decor');
 
  way = {
 
    path {"#south", translate("forest_locale", 'transition_south_along_road'), 'above_forest'};
 
    path {"#down", translate("forest_locale", 'transition_land'), 'near_village'};
 
    path {"#north", translate("forest_locale", 'transition_north_to_the_village'), 'above_village'};
 
  }
 
}: with {
 
	obj {
 
		nam = '#road';
 
		act = translate("forest_locale", 'above_near_village_road');
 
	};
 
	obj {
 
		nam = '#thicket';
 
		act = translate("forest_locale", 'above_near_village_thicket');
 
	};
 
	obj {
 
		nam = '#village';
 
		act = function(s)
 
			p(translate_now("forest_locale", 'above_near_village_village'));
 
			if not village_visited then
 
				village_visited = true;
 
				p(translate_now("forest_locale", 'village_unvisited'));
 
			end;
 
		end;
 
	};
 
	'mountains';
 
	'wind';
 
	'sun';
 
	'clouds';
 
  obj {
 
    nam = '#road';
 
    act = translate("forest_locale", 'above_near_village_road');
 
  };
 
  obj {
 
    nam = '#thicket';
 
    act = translate("forest_locale", 'above_near_village_thicket');
 
  };
 
  obj {
 
    nam = '#village';
 
    act = function(s)
 
      p(translate_now("forest_locale", 'above_near_village_village'));
 
      if not village_visited then
 
        village_visited = true;
 
        p(translate_now("forest_locale", 'village_unvisited'));
 
      end;
 
    end;
 
  };
 
  'mountains';
 
  'wind';
 
  'sun';
 
  'clouds';
 
};
 

	
 
room {
 
	nam = 'above_village';
 
	pic = 'images/above_village.png';
 
	disp = translate("forest_locale", 'above_village');
 
	theme = 'main';
 
	decor = translate("forest_locale", 'above_village_decor');
 
	way = {
 
		path {"#south", translate("forest_locale", 'transition_south_along_road'), 'above_near_village'};
 
		path {"#down", translate("forest_locale", 'transition_land'), 'village_no_way'};
 
		path {"fly_west_from_village", translate("forest_locale", 'transition_west'), 'above_west'}:disable();
 
	}
 
  nam = 'above_village';
 
  pic = 'images/above_village.png';
 
  disp = translate("forest_locale", 'above_village');
 
  theme = 'main';
 
  decor = translate("forest_locale", 'above_village_decor');
 
  way = {
 
    path {"#south", translate("forest_locale", 'transition_south_along_road'), 'above_near_village'};
 
    path {"#down", translate("forest_locale", 'transition_land'), 'village_no_way'};
 
    path {"fly_west_from_village", translate("forest_locale", 'transition_west'), 'above_west'}:disable();
 
  }
 
}: with {
 
	obj {
 
		nam = '#thicket';
 
		act = translate("forest_locale", 'above_village_thicket');
 
	};
 
	obj {
 
		nam = '#road';
 
		act = translate("forest_locale", 'above_village_road');
 
	};
 
	obj {
 
		nam = '#village';
 
		act = function(s)
 
			p(translate_now("forest_locale", 'above_village_village'));
 
			if not village_visited then
 
				village_visited = true;
 
				p(translate_now("forest_locale", 'village_unvisited'));
 
			end;
 
		end;
 
	};
 
	'mountains';
 
	'wind';
 
	'sun';
 
	'clouds';
 
  obj {
 
    nam = '#thicket';
 
    act = translate("forest_locale", 'above_village_thicket');
 
  };
 
  obj {
 
    nam = '#road';
 
    act = translate("forest_locale", 'above_village_road');
 
  };
 
  obj {
 
    nam = '#village';
 
    act = function(s)
 
      p(translate_now("forest_locale", 'above_village_village'));
 
      if not village_visited then
 
        village_visited = true;
 
        p(translate_now("forest_locale", 'village_unvisited'));
 
      end;
 
    end;
 
  };
 
  'mountains';
 
  'wind';
 
  'sun';
 
  'clouds';
 
};
 

	
 
obj {
 
	nam = 'sun';
 
	act = translate("forest_locale", 'sun');
 
  nam = 'sun';
 
  act = translate("forest_locale", 'sun');
 
};
 

	
 
obj {
 
	nam = 'sun_transformed';
 
	act = translate("forest_locale", 'sun_transformed');
 
  nam = 'sun_transformed';
 
  act = translate("forest_locale", 'sun_transformed');
 
};
 

	
 
obj {
 
	nam = 'clouds';
 
	act = translate("forest_locale", 'clouds');
 
  nam = 'clouds';
 
  act = translate("forest_locale", 'clouds');
 
};
 

	
 
obj {
 
	nam = 'wind';
 
	act = translate("forest_locale", 'wind');
 
  nam = 'wind';
 
  act = translate("forest_locale", 'wind');
 
};
 

	
 
obj {
 
	nam = 'mountains';
 
	act = translate("forest_locale", 'mountains');
 
  nam = 'mountains';
 
  act = translate("forest_locale", 'mountains');
 
};
 

	
 
room {
 
	nam = 'above_west';
 
	disp = translate("forest_locale", 'above_west');
 
	pic = 'images/above_west.png';
 
	theme = 'main';
 
	decor = translate("forest_locale", 'above_west_decor');
 
	way = {
 
		path {"#east", translate("forest_locale", 'transition_east_to_the_village'), 'above_village'};
 
		path {"#west", translate("forest_locale", 'transition_west_to_the_crater'), 'above_crater'}:disable();
 
	}
 
  nam = 'above_west';
 
  disp = translate("forest_locale", 'above_west');
 
  pic = 'images/above_west.png';
 
  theme = 'main';
 
  decor = translate("forest_locale", 'above_west_decor');
 
  way = {
 
    path {"#east", translate("forest_locale", 'transition_east_to_the_village'), 'above_village'};
 
    path {"#west", translate("forest_locale", 'transition_west_to_the_crater'), 'above_crater'}:disable();
 
  }
 
}: with {
 
	obj {
 
		nam = '#village';
 
		act = translate("forest_locale", 'above_west_village');
 
	};
 
	obj {
 
		nam = '#mountains';
 
		act = translate("forest_locale", 'above_west_mountains');
 
	};
 
	obj {
 
		nam = '#mountaintops';
 
		act = translate("forest_locale", 'above_west_mountaintops');
 
	};
 
	obj {
 
		nam = '#mountainslopes';
 
		act = translate("forest_locale", 'above_west_mountainslopes');
 
	};
 
	obj {
 
		nam = '#crater';
 
		act = function(s)
 
			_'#west':enable();
 
			return translate_now("forest_locale", 'above_west_crater');
 
		end;
 
	};
 
	'clouds';
 
	'sun';
 
  obj {
 
    nam = '#village';
 
    act = translate("forest_locale", 'above_west_village');
 
  };
 
  obj {
 
    nam = '#mountains';
 
    act = translate("forest_locale", 'above_west_mountains');
 
  };
 
  obj {
 
    nam = '#mountaintops';
 
    act = translate("forest_locale", 'above_west_mountaintops');
 
  };
 
  obj {
 
    nam = '#mountainslopes';
 
    act = translate("forest_locale", 'above_west_mountainslopes');
 
  };
 
  obj {
 
    nam = '#crater';
 
    act = function(s)
 
      _'#west':enable();
 
      return translate_now("forest_locale", 'above_west_crater');
 
    end;
 
  };
 
  'clouds';
 
  'sun';
 
}
 

	
 
room {
 
	nam = 'above_crater';
 
	pic = 'images/above_crater.png';
 
	theme = 'main';
 
	onenter = function(s)
 
		if here()^'inside_crater_glade' then
 
			p(translate_now("forest_locale", 'above_crater_enter'));
 
		end;
 
	end;
 
	disp = translate("forest_locale", 'above_crater');
 
	decor = translate("forest_locale", 'above_crater_decor');
 
	way = {
 
		path {"#east", translate("forest_locale", 'transition_east'), 'above_west'};
 
		path {"#down", translate("forest_locale", 'transition_land'), 'inside_crater_glade'}:disable();
 
	}
 
  nam = 'above_crater';
 
  pic = 'images/above_crater.png';
 
  theme = 'main';
 
  onenter = function(s)
 
    if here()^'inside_crater_glade' then
 
      p(translate_now("forest_locale", 'above_crater_enter'));
 
    end;
 
  end;
 
  disp = translate("forest_locale", 'above_crater');
 
  decor = translate("forest_locale", 'above_crater_decor');
 
  way = {
 
    path {"#east", translate("forest_locale", 'transition_east'), 'above_west'};
 
    path {"#down", translate("forest_locale", 'transition_land'), 'inside_crater_glade'}:disable();
 
  }
 
}: with {
 
	obj {
 
		nam = '#crater';
 
		act = translate("forest_locale", 'above_crater_crater');
 
	};
 
	obj {
 
		nam = '#tower';
 
		act = translate("forest_locale", 'above_crater_tower');
 
	};
 
	obj {
 
		nam = '#trees';
 
		act = translate("forest_locale", 'above_crater_trees');
 
	};
 
	obj {
 
		nam = '#glade';
 
		act = function(s)
 
			_'#down':enable();
 
			return translate_now("forest_locale", 'above_crater_glade');
 
		end;
 
	};
 
	'wind';
 
	'sun';
 
	'clouds';
 
  obj {
 
    nam = '#crater';
 
    act = translate("forest_locale", 'above_crater_crater');
 
  };
 
  obj {
 
    nam = '#tower';
 
    act = translate("forest_locale", 'above_crater_tower');
 
  };
 
  obj {
 
    nam = '#trees';
 
    act = translate("forest_locale", 'above_crater_trees');
 
  };
 
  obj {
 
    nam = '#glade';
 
    act = function(s)
 
      _'#down':enable();
 
      return translate_now("forest_locale", 'above_crater_glade');
 
    end;
 
  };
 
  'wind';
 
  'sun';
 
  'clouds';
 
}
 

	
 
room {
 
	nam = 'village_no_way';
 
	onenter = function(s)
 
		if solarscale_with_me then
 
			p(translate_now("forest_locale", 'village_no_way_solarscale'));
 
		else
 
			p(translate_now("forest_locale", 'village_no_way_alone'));
 
		end;
 
		return false;
 
	end;
 
  nam = 'village_no_way';
 
  onenter = function(s)
 
    if solarscale_with_me then
 
      p(translate_now("forest_locale", 'village_no_way_solarscale'));
 
    else
 
      p(translate_now("forest_locale", 'village_no_way_alone'));
 
    end;
 
    return false;
 
  end;
 
}
 

	
 
room {
 
	nam = 'near_village';
 
	disp = translate("forest_locale", 'near_village');
 
	pic = 'images/near_village.png';
 
	theme = 'main';
 
	onenter = function(s)
 
		if here()^'above_near_village' then
 
			p(translate_now("forest_locale", 'near_village_enter'));
 
		end;
 
	end;
 
	decor = translate("forest_locale", 'near_village_decor');
 
	way = {
 
		path {"#up", translate("forest_locale", 'transition_fly'), 'above_near_village'};
 
		path {"#north", translate("forest_locale", 'transition_north_to_the_village'), 'village_south'};
 
	}
 
  nam = 'near_village';
 
  disp = translate("forest_locale", 'near_village');
 
  pic = 'images/near_village.png';
 
  theme = 'main';
 
  onenter = function(s)
 
    if here()^'above_near_village' then
 
      p(translate_now("forest_locale", 'near_village_enter'));
 
    end;
 
  end;
 
  decor = translate("forest_locale", 'near_village_decor');
 
  way = {
 
    path {"#up", translate("forest_locale", 'transition_fly'), 'above_near_village'};
 
    path {"#north", translate("forest_locale", 'transition_north_to_the_village'), 'village_south'};
 
  }
 
}: with {
 
	obj {
 
		nam = '#road';
 
		act = translate("forest_locale", 'near_village_road');
 
	};
 
	obj {
 
		nam = '#forest';
 
		act = translate("forest_locale", 'near_village_forest');
 
	};
 
	obj {
 
		nam = '#village';
 
		act = function(s)
 
			p(translate_now("forest_locale", 'near_village_village'));
 
			if not village_visited then
 
				village_visited = true;
 
				p(translate_now("forest_locale", 'village_unvisited'));
 
			end;
 
		end;
 
	};
 
	'sun_transformed';
 
	'clouds';
 
  obj {
 
    nam = '#road';
 
    act = translate("forest_locale", 'near_village_road');
 
  };
 
  obj {
 
    nam = '#forest';
 
    act = translate("forest_locale", 'near_village_forest');
 
  };
 
  obj {
 
    nam = '#village';
 
    act = function(s)
 
      p(translate_now("forest_locale", 'near_village_village'));
 
      if not village_visited then
 
        village_visited = true;
 
        p(translate_now("forest_locale", 'village_unvisited'));
 
      end;
 
    end;
 
  };
 
  'sun_transformed';
 
  'clouds';
 
}
 

	
 
room {
 
	nam = 'village_south';
 
	disp = translate("forest_locale", 'village_south');
 
	pic='images/village_south.png';
 
	theme = 'main';
 
	enter = function(s)
 
		if not village_visited then
 
			village_visited = true;
 
			p(translate_now("forest_locale", 'village_unvisited'));
 
		end;
 
	end;
 
	nofollow = function(s)
 
		if here():from()^'near_village' then
 
			return translate_now("solarscale_locale", 'follow_refuse') .. ' ' ..translate_now("solarscale_locale", 'follow_refuse_village');
 
		else
 
			return true;
 
		end;
 
	end;
 
	decor = translate("forest_locale", 'village_south_decor');
 
	way = {
 
		path {'#south', translate("forest_locale", 'transition_south_to_the_forest'), 'near_village'};
 
		path {'#in', translate("forest_locale", 'transition_inside_hut'), 'foresters_hut'};
 
		path {'#north', translate("forest_locale", 'transition_north_to_the_townhall'), 'village_center'};
 
	};
 
  nam = 'village_south';
 
  disp = translate("forest_locale", 'village_south');
 
  pic='images/village_south.png';
 
  theme = 'main';
 
  enter = function(s)
 
    if not village_visited then
 
      village_visited = true;
 
      p(translate_now("forest_locale", 'village_unvisited'));
 
    end;
 
  end;
 
  nofollow = function(s)
 
    if here():from()^'near_village' then
 
      return translate_now("solarscale_locale", 'follow_refuse') .. ' ' ..translate_now("solarscale_locale", 'follow_refuse_village');
 
    else
 
      return true;
 
    end;
 
  end;
 
  decor = translate("forest_locale", 'village_south_decor');
 
  way = {
 
    path {'#south', translate("forest_locale", 'transition_south_to_the_forest'), 'near_village'};
 
    path {'#in', translate("forest_locale", 'transition_inside_hut'), 'foresters_hut'};
 
    path {'#north', translate("forest_locale", 'transition_north_to_the_townhall'), 'village_center'};
 
  };
 
}:with {
 
	obj {
 
		nam = '#road';
 
		act = translate("forest_locale", 'village_south_road');
 
	};
 
	obj {
 
		nam = '#village';
 
		act = translate("forest_locale", 'village_south_village');
 
	};
 
	obj {
 
		nam = '#foresters_car';
 
		act = translate("forest_locale", 'village_south_car');
 
	};
 
	obj {
 
		nam = '#foresters_hut_out';
 
		act = translate("forest_locale", 'village_south_hut');
 
	};
 
	'sun_transformed';
 
	'clouds';
 
  obj {
 
    nam = '#road';
 
    act = translate("forest_locale", 'village_south_road');
 
  };
 
  obj {
 
    nam = '#village';
 
    act = translate("forest_locale", 'village_south_village');
 
  };
 
  obj {
 
    nam = '#foresters_car';
 
    act = translate("forest_locale", 'village_south_car');
 
  };
 
  obj {
 
    nam = '#foresters_hut_out';
 
    act = translate("forest_locale", 'village_south_hut');
 
  };
 
  'sun_transformed';
 
  'clouds';
 
}
 

	
 
room {
 
	state = 0;
 
	nam = 'foresters_hut';
 
	pic = function(s)
 
		if _'rope':where() == here() then
 
			return 'images/foresters_hut.png;images/foresters_hut_rope.png@8,160';
 
		else
 
			return 'images/foresters_hut.png';
 
		end;
 
	end;
 
	theme = 'main';
 
	nofollow = true;
 
	disp = translate("forest_locale", 'foresters_hut');
 
	enter = function(s)
 
		if s.state == 0 then
 
			s.state = 1;
 
			return translate_now("forest_locale", 'foresters_hut_enter');
 
		end;
 
	end;
 
	decor = translate("forest_locale", 'foresters_hut_decor');
 
	way = {
 
		path {'#out', translate("forest_locale", 'transition_out'), 'village_south'};
 
	}
 
  state = 0;
 
  nam = 'foresters_hut';
 
  pic = function(s)
 
    if _'rope':where() == here() then
 
      return 'images/foresters_hut.png;images/foresters_hut_rope.png@8,160';
 
    else
 
      return 'images/foresters_hut.png';
 
    end;
 
  end;
 
  theme = 'main';
 
  nofollow = true;
 
  disp = translate("forest_locale", 'foresters_hut');
 
  enter = function(s)
 
    if s.state == 0 then
 
      s.state = 1;
 
      return translate_now("forest_locale", 'foresters_hut_enter');
 
    end;
 
  end;
 
  decor = translate("forest_locale", 'foresters_hut_decor');
 
  way = {
 
    path {'#out', translate("forest_locale", 'transition_out'), 'village_south'};
 
  }
 
}:with {
 
	obj {
 
		nam = '#sofa';
 
		act = translate("forest_locale", 'foresters_hut_sofa');
 
	};
 
	obj {
 
		nam = '#cupboard';
 
		act = translate("forest_locale", 'foresters_hut_cupboard');
 
	};
 
	obj {
 
		nam = '#table';
 
		act = translate("forest_locale", 'foresters_hut_table');
 
	};
 
	obj {
 
		nam = '#chairs';
 
		act = translate("forest_locale", 'foresters_hut_chairs');
 
	};
 
	obj {
 
		nam = '#radio';
 
		act = translate("forest_locale", 'foresters_hut_radio');
 
	};
 
	obj {
 
		bought = false;
 
		nam = 'forester';
 
		dsc = translate("forest_locale", 'foresters_hut_forester');
 
		act = function(s)
 
			walkin('forester_dlg');
 
		end;
 
		used = function(s, o)
 
			if o^'raspberry_pie' then
 
				return translate_now("forest_locale", 'foresters_hut_forester_pie');
 
			else
 
				return translate_now("forest_locale", 'foresters_hut_not_interested');
 
			end;
 
		end;
 
	};
 
	obj {
 
		nam = 'rope';
 
		disp = translate("forest_locale", 'foresters_hut_rope_disp');
 
		dsc = translate("forest_locale", 'foresters_hut_rope');
 
		act = function(s)
 
			if _('forester').bought then
 
				p(translate_now("forest_locale", 'foresters_hut_rope_taken'));
 
				take('rope')
 
			else
 
				p(translate_now("forest_locale", 'foresters_hut_rope_not_taken'));
 
			end;
 
		end;
 
		inv = translate("forest_locale", 'foresters_hut_rope_inv');
 
	};
 
  obj {
 
    nam = '#sofa';
 
    act = translate("forest_locale", 'foresters_hut_sofa');
 
  };
 
  obj {
 
    nam = '#cupboard';
 
    act = translate("forest_locale", 'foresters_hut_cupboard');
 
  };
 
  obj {
 
    nam = '#table';
 
    act = translate("forest_locale", 'foresters_hut_table');
 
  };
 
  obj {
 
    nam = '#chairs';
 
    act = translate("forest_locale", 'foresters_hut_chairs');
 
  };
 
  obj {
 
    nam = '#radio';
 
    act = translate("forest_locale", 'foresters_hut_radio');
 
  };
 
  obj {
 
    bought = false;
 
    nam = 'forester';
 
    dsc = translate("forest_locale", 'foresters_hut_forester');
 
    act = function(s)
 
      walkin('forester_dlg');
 
    end;
 
    used = function(s, o)
 
      if o^'raspberry_pie' then
 
        return translate_now("forest_locale", 'foresters_hut_forester_pie');
 
      else
 
        return translate_now("forest_locale", 'foresters_hut_not_interested');
 
      end;
 
    end;
 
  };
 
  obj {
 
    nam = 'rope';
 
    disp = translate("forest_locale", 'foresters_hut_rope_disp');
 
    dsc = translate("forest_locale", 'foresters_hut_rope');
 
    act = function(s)
 
      if _('forester').bought then
 
        p(translate_now("forest_locale", 'foresters_hut_rope_taken'));
 
        take('rope')
 
      else
 
        p(translate_now("forest_locale", 'foresters_hut_rope_not_taken'));
 
      end;
 
    end;
 
    inv = translate("forest_locale", 'foresters_hut_rope_inv');
 
  };
 
}
 

	
 
dlg {
 
	nam = 'forester_dlg';
 
	disp = translate("forest_locale", 'forester_dlg_disp');
 
	theme = 'main';
 
	pic = 'images/characters/forester.png';
 
	enter = translate("forest_locale", 'forester_dlg_enter');
 
	phr = {
 
		{translate("forest_locale", 'common_dlg_greet'), translate("forest_locale", 'forester_dlg_greet_response'),
 
			{translate("forest_locale", 'common_dlg_places'), translate("forest_locale", 'forester_dlg_places_response')};
 
		},
 
		{cond=function(s) return where('rope') and where('rope')^'foresters_hut' and not _('forester').bought end, translate("forest_locale", 'forester_dlg_rope'), function(s)
 
			p(translate_now("forest_locale", 'forester_dlg_rope_response'));
 
			raspberry_pie_status = 1;
 
		end},
 
		{cond=function(s) return have 'raspberry_pie' end, translate("forest_locale", 'forester_dlg_pie'), function(s)
 
			remove('raspberry_pie', pl);
 
			p(translate_now("forest_locale", 'forester_dlg_pie_response'));
 
			raspberry_pie_status = 2;
 
			_('forester').bought = 1;
 
		end},
 
		{true, translate("forest_locale", 'common_dlg_bye'), function(s)
 
			p(translate_now("forest_locale", 'forester_dlg_farewell_response'));
 
			walkout();
 
		end}
 
	}
 
  nam = 'forester_dlg';
 
  disp = translate("forest_locale", 'forester_dlg_disp');
 
  theme = 'main';
 
  pic = 'images/characters/forester.png';
 
  enter = translate("forest_locale", 'forester_dlg_enter');
 
  phr = {
 
    {translate("forest_locale", 'common_dlg_greet'), translate("forest_locale", 'forester_dlg_greet_response'),
 
      {translate("forest_locale", 'common_dlg_places'), translate("forest_locale", 'forester_dlg_places_response')};
 
    },
 
    {cond=function(s) return where('rope') and where('rope')^'foresters_hut' and not _('forester').bought end, translate("forest_locale", 'forester_dlg_rope'), function(s)
 
      p(translate_now("forest_locale", 'forester_dlg_rope_response'));
 
      raspberry_pie_status = 1;
 
    end},
 
    {cond=function(s) return have 'raspberry_pie' end, translate("forest_locale", 'forester_dlg_pie'), function(s)
 
      remove('raspberry_pie', pl);
 
      p(translate_now("forest_locale", 'forester_dlg_pie_response'));
 
      raspberry_pie_status = 2;
 
      _('forester').bought = 1;
 
    end},
 
    {true, translate("forest_locale", 'common_dlg_bye'), function(s)
 
      p(translate_now("forest_locale", 'forester_dlg_farewell_response'));
 
      walkout();
 
    end}
 
  }
 
}
 

	
 
room {
 
	nam = 'village_center';
 
	nofollow = true;
 
	pic = 'images/village_center.png';
 
	theme = 'main';
 
	disp = translate("forest_locale", 'village_center');
 
	decor = function(s)
 
  nam = 'village_center';
 
  nofollow = true;
 
  pic = 'images/village_center.png';
 
  theme = 'main';
 
  disp = translate("forest_locale", 'village_center');
 
  decor = function(s)
 
    p(translate_now("forest_locale", 'village_center_decor'));
 
    p(translate_now("forest_locale", 'village_all_decor'));
 
  end;
 
	way = {
 
		 path {translate("forest_locale", 'transition_south_to_hut'), 'village_south'};
 
		 path {'#down', translate("forest_locale", 'transition_inside_well'), 'inside_well'}:disable();
 
		 path {translate("forest_locale", 'transition_inside_town_hall'), 'townhall'};
 
		 path {translate("forest_locale", 'transition_inside_tavern'), 'tavern'};
 
		 path {translate("forest_locale", 'transition_north_to_library'), 'village_north'};
 
	};
 
  way = {
 
     path {translate("forest_locale", 'transition_south_to_hut'), 'village_south'};
 
     path {'#down', translate("forest_locale", 'transition_inside_well'), 'inside_well'}:disable();
 
     path {translate("forest_locale", 'transition_inside_town_hall'), 'townhall'};
 
     path {translate("forest_locale", 'transition_inside_tavern'), 'tavern'};
 
     path {translate("forest_locale", 'transition_north_to_library'), 'village_north'};
 
  };
 
}: with {
 
	obj {
 
		nam = '#townhall';
 
		act = translate("forest_locale", 'village_center_townhall');
 
	};
 
	obj {
 
		nam = '#music';
 
		act = translate("forest_locale", 'village_center_music');
 
	};
 
	obj {
 
		nam = '#tavern';
 
		act = translate("forest_locale", 'village_center_tavern');
 
	};
 
	obj {
 
		nam = '#library';
 
		act = translate("forest_locale", 'village_center_library');
 
  obj {
 
    nam = '#townhall';
 
    act = translate("forest_locale", 'village_center_townhall');
 
  };
 
  obj {
 
    nam = '#music';
 
    act = translate("forest_locale", 'village_center_music');
 
  };
 
  obj {
 
    nam = '#tavern';
 
    act = translate("forest_locale", 'village_center_tavern');
 
  };
 
  obj {
 
    nam = '#library';
 
    act = translate("forest_locale", 'village_center_library');
 

	
 
	};
 
	obj {
 
		known = false;
 
		nam = 'village_well';
 
		dsc = function(s)
 
  };
 
  obj {
 
    known = false;
 
    nam = 'village_well';
 
    dsc = function(s)
 
      p(translate_now("forest_locale", 'village_well_dsc'));
 
			if _('inside_well').state then
 
				p(translate_now("forest_locale", 'village_well_dsc_rope'));
 
			end;
 
		end;
 
		act = function(s)
 
			if s.known then
 
				_'#down':enable();
 
				p(translate_now("forest_locale", 'village_well_act_key'));
 
			else
 
				p(translate_now("forest_locale", 'village_well_act'));
 
			end;
 
		end;
 
		used = function(s, o)
 
			if o^'rope' then
 
      if _('inside_well').state then
 
        p(translate_now("forest_locale", 'village_well_dsc_rope'));
 
      end;
 
    end;
 
    act = function(s)
 
      if s.known then
 
        _'#down':enable();
 
        p(translate_now("forest_locale", 'village_well_act_key'));
 
      else
 
        p(translate_now("forest_locale", 'village_well_act'));
 
      end;
 
    end;
 
    used = function(s, o)
 
      if o^'rope' then
 
        _'#down':enable();
 
				_('inside_well').state = true;
 
				remove('rope', pl);
 
				p(translate_now("forest_locale", 'village_well_used'));
 
			else
 
				return false;
 
			end;
 
		end;
 
	};
 
	obj {
 
		nam = 'maid';
 
		dsc = function(s)
 
        _('inside_well').state = true;
 
        remove('rope', pl);
 
        p(translate_now("forest_locale", 'village_well_used'));
 
      else
 
        return false;
 
      end;
 
    end;
 
  };
 
  obj {
 
    nam = 'maid';
 
    dsc = function(s)
 
      p(translate_now("forest_locale", 'village_maid_dsc'));
 
			if _('maid_dlg').flower then
 
				p(translate_now("forest_locale", 'village_maid_flower'));
 
			end;
 
		end;
 
		act = function(s)
 
			if _('maid_dlg').flower and (raspberry_pie_status == 0 or raspberry_pie_status == 2) then
 
				return translate_now("forest_locale", 'maid_dlg_enter') .. ' ' .. translate_now("forest_locale", 'village_maid_act_no_dlg');
 
			else
 
				walkin('maid_dlg');
 
			end;
 
		end;
 
		used = function(s, o)
 
			if o^'flower' then
 
				return translate_now("forest_locale", 'village_maid_used_flower');
 
			else
 
				return translate_now("forest_locale", 'village_maid_used_other');
 
			end;
 
		end;
 
	};
 
	'sun_transformed';
 
	'clouds';
 
      if _('maid_dlg').flower then
 
        p(translate_now("forest_locale", 'village_maid_flower'));
 
      end;
 
    end;
 
    act = function(s)
 
      if _('maid_dlg').flower and (raspberry_pie_status == 0 or raspberry_pie_status == 2) then
 
        return translate_now("forest_locale", 'maid_dlg_enter') .. ' ' .. translate_now("forest_locale", 'village_maid_act_no_dlg');
 
      else
 
        walkin('maid_dlg');
 
      end;
 
    end;
 
    used = function(s, o)
 
      if o^'flower' then
 
        return translate_now("forest_locale", 'village_maid_used_flower');
 
      else
 
        return translate_now("forest_locale", 'village_maid_used_other');
 
      end;
 
    end;
 
  };
 
  'sun_transformed';
 
  'clouds';
 
}
 

	
 
dlg {
 
	nam = 'maid_dlg';
 
	disp = translate("forest_locale", 'maid_dlg');
 
	theme = 'main';
 
	pic = function(s)
 
		if s.flower then
 
			return 'images/characters/maid_glad.png';
 
		else
 
			return 'images/characters/maid_sad.png';
 
		end;
 
	end;
 
	flower = false;
 
	pie = false;
 
	work_asked = false;
 
	pie_asked = false;
 
	enter = function(s)
 
  nam = 'maid_dlg';
 
  disp = translate("forest_locale", 'maid_dlg');
 
  theme = 'main';
 
  pic = function(s)
 
    if s.flower then
 
      return 'images/characters/maid_glad.png';
 
    else
 
      return 'images/characters/maid_sad.png';
 
    end;
 
  end;
 
  flower = false;
 
  pie = false;
 
  work_asked = false;
 
  pie_asked = false;
 
  enter = function(s)
 
    p(translate_now("forest_locale", 'maid_dlg_enter'));
 
		if _('maid_dlg').flower then
 
			p(translate_now("forest_locale", 'maid_dlg_enter_with_flower'));
 
    if _('maid_dlg').flower then
 
      p(translate_now("forest_locale", 'maid_dlg_enter_with_flower'));
 
      p(translate_now("forest_locale", 'village_maid_flower'));
 
		else
 
			p(translate_now("forest_locale", 'maid_dlg_enter_no_flower'));
 
		end;
 
	end;
 
	phr = {
 
		{cond=function(s) return not _('maid_dlg').flower end, translate("forest_locale", 'common_dlg_greet'), translate("forest_locale", 'maid_dlg_greet_response'),
 
			{translate("forest_locale", 'common_dlg_places'), translate("forest_locale", 'maid_dlg_places_response'),
 
				{translate("forest_locale", 'maid_dlg_places_like'), translate("forest_locale", 'maid_dlg_places_like_response'), only=true,
 
					{
 
						cond=function(s) return have 'flower' end,
 
						translate("forest_locale", 'maid_dlg_flower'),
 
						function(s)
 
							_('maid_dlg').flower = 1;
 
							remove('flower', pl);
 
							p(translate_now("forest_locale", 'maid_dlg_flower_response'));
 
						end
 
					};
 
					{
 
						translate("common_locale", 'dlg_keep_silent'),
 
						translate("forest_locale", 'maid_dlg_silent_response')
 
					}
 
				};
 
			};
 
		};
 
		{cond=function(s) return not _('maid_dlg').work_asked end, translate("forest_locale", 'maid_dlg_tavern'), function(s)
 
			_('maid_dlg').work_asked = true;
 
			return translate_now("forest_locale", 'maid_dlg_tavern_response');
 
		end};
 
		{
 
			cond=function(s) return _('maid_dlg').pie_asked and have 'flower' end,
 
			translate("forest_locale", 'maid_dlg_flower'),
 
			function(s)
 
				_('maid_dlg').flower = 1;
 
				remove('flower', pl);
 
				raspberry_pie_status = 2;
 
				take 'raspberry_pie'
 
				p(translate_now("forest_locale", 'maid_dlg_pie_response'));
 
			end
 
		};
 
		{
 
			cond=function(s) return _('maid_dlg').work_asked and not _('maid_dlg').pie_asked and _('maid_dlg').flower and raspberry_pie_status == 1; end;
 
			translate("forest_locale", 'maid_dlg_pie'),
 
			function(s)
 
				raspberry_pie_status = 2;
 
				take 'raspberry_pie'
 
				p(translate_now("forest_locale", 'maid_dlg_pie_response'));
 
			end;
 
		};
 
		{
 
			cond=function(s) return _('maid_dlg').work_asked and not _('maid_dlg').pie_asked and not _('maid_dlg').flower and raspberry_pie_status == 1; end;
 
			translate("forest_locale", 'maid_dlg_pie'),
 
			translate("forest_locale", 'maid_dlg_pie_fail_response'), only=true,
 
			{
 
				translate("forest_locale", 'maid_dlg_no_money'), function(s)
 
					_('maid_dlg').pie_asked = 1;
 
					p(translate_now("forest_locale", 'maid_dlg_no_money_response'));
 
				end, only=true,
 
				{
 
					cond=function(s) return have 'flower' end,
 
					translate("forest_locale", 'maid_dlg_flower'),
 
					function(s)
 
						_('maid_dlg').flower = 1;
 
						remove('flower', pl);
 
						raspberry_pie_status = 2;
 
						take('raspberry_pie');
 
						p(translate_now("forest_locale", 'maid_dlg_pie_response'));
 
					end
 
				};
 
    else
 
      p(translate_now("forest_locale", 'maid_dlg_enter_no_flower'));
 
    end;
 
  end;
 
  phr = {
 
    {cond=function(s) return not _('maid_dlg').flower end, translate("forest_locale", 'common_dlg_greet'), translate("forest_locale", 'maid_dlg_greet_response'),
 
      {translate("forest_locale", 'common_dlg_places'), translate("forest_locale", 'maid_dlg_places_response'),
 
        {translate("forest_locale", 'maid_dlg_places_like'), translate("forest_locale", 'maid_dlg_places_like_response'), only=true,
 
          {
 
            cond=function(s) return have 'flower' end,
 
            translate("forest_locale", 'maid_dlg_flower'),
 
            function(s)
 
              _('maid_dlg').flower = 1;
 
              remove('flower', pl);
 
              p(translate_now("forest_locale", 'maid_dlg_flower_response'));
 
            end
 
          };
 
          {
 
            translate("common_locale", 'dlg_keep_silent'),
 
            translate("forest_locale", 'maid_dlg_silent_response')
 
          }
 
        };
 
      };
 
    };
 
    {cond=function(s) return not _('maid_dlg').work_asked end, translate("forest_locale", 'maid_dlg_tavern'), function(s)
 
      _('maid_dlg').work_asked = true;
 
      return translate_now("forest_locale", 'maid_dlg_tavern_response');
 
    end};
 
    {
 
      cond=function(s) return _('maid_dlg').pie_asked and have 'flower' end,
 
      translate("forest_locale", 'maid_dlg_flower'),
 
      function(s)
 
        _('maid_dlg').flower = 1;
 
        remove('flower', pl);
 
        raspberry_pie_status = 2;
 
        take 'raspberry_pie'
 
        p(translate_now("forest_locale", 'maid_dlg_pie_response'));
 
      end
 
    };
 
    {
 
      cond=function(s) return _('maid_dlg').work_asked and not _('maid_dlg').pie_asked and _('maid_dlg').flower and raspberry_pie_status == 1; end;
 
      translate("forest_locale", 'maid_dlg_pie'),
 
      function(s)
 
        raspberry_pie_status = 2;
 
        take 'raspberry_pie'
 
        p(translate_now("forest_locale", 'maid_dlg_pie_response'));
 
      end;
 
    };
 
    {
 
      cond=function(s) return _('maid_dlg').work_asked and not _('maid_dlg').pie_asked and not _('maid_dlg').flower and raspberry_pie_status == 1; end;
 
      translate("forest_locale", 'maid_dlg_pie'),
 
      translate("forest_locale", 'maid_dlg_pie_fail_response'), only=true,
 
      {
 
        translate("forest_locale", 'maid_dlg_no_money'), function(s)
 
          _('maid_dlg').pie_asked = 1;
 
          p(translate_now("forest_locale", 'maid_dlg_no_money_response'));
 
        end, only=true,
 
        {
 
          cond=function(s) return have 'flower' end,
 
          translate("forest_locale", 'maid_dlg_flower'),
 
          function(s)
 
            _('maid_dlg').flower = 1;
 
            remove('flower', pl);
 
            raspberry_pie_status = 2;
 
            take('raspberry_pie');
 
            p(translate_now("forest_locale", 'maid_dlg_pie_response'));
 
          end
 
        };
 
        {translate("forest_locale", 'maid_dlg_flower_agree'), translate("forest_locale", 'maid_dlg_flower_agree_response')};
 
				{translate("forest_locale", 'maid_dlg_flower_think'), translate("forest_locale", 'maid_dlg_flower_think_response')};
 
			},
 
			{
 
				translate("forest_locale", 'maid_dlg_pie_ask'), translate("forest_locale", 'maid_dlg_pie_ask_response')
 
			}
 
		};
 
		{
 
			translate("forest_locale", 'maid_dlg_bye'), function(s)
 
			p(translate_now("forest_locale", 'maid_dlg_bye_response'));
 
			walkout();
 
		end
 
		}
 
	}
 
        {translate("forest_locale", 'maid_dlg_flower_think'), translate("forest_locale", 'maid_dlg_flower_think_response')};
 
      },
 
      {
 
        translate("forest_locale", 'maid_dlg_pie_ask'), translate("forest_locale", 'maid_dlg_pie_ask_response')
 
      }
 
    };
 
    {
 
      translate("forest_locale", 'maid_dlg_bye'), function(s)
 
      p(translate_now("forest_locale", 'maid_dlg_bye_response'));
 
      walkout();
 
    end
 
    }
 
  }
 
}
 

	
 
room {
 
	nam = 'tavern';
 
	pic = function(s)
 
		if raspberry_pie_status == 2 then
 
			return 'images/tavern.png';
 
		else
 
			return 'images/tavern.png;images/tavern_pie.png@181,124';
 
		end;
 
	end;
 
	disp = translate("forest_locale", 'tavern');
 
	theme = 'main';
 
	nofollow = true;
 
	decor = translate("forest_locale", 'tavern_decor');
 
	way = {
 
		path {'#outside', translate("forest_locale", 'transition_out'), 'village_center'};
 
	};
 
  nam = 'tavern';
 
  pic = function(s)
 
    if raspberry_pie_status == 2 then
 
      return 'images/tavern.png';
 
    else
 
      return 'images/tavern.png;images/tavern_pie.png@181,124';
 
    end;
 
  end;
 
  disp = translate("forest_locale", 'tavern');
 
  theme = 'main';
 
  nofollow = true;
 
  decor = translate("forest_locale", 'tavern_decor');
 
  way = {
 
    path {'#outside', translate("forest_locale", 'transition_out'), 'village_center'};
 
  };
 
}: with {
 
	obj {
 
		nam = '#windows';
 
		act = translate("forest_locale", 'tavern_windows');
 
	};
 
	obj {
 
		nam = '#tables';
 
		act = translate("forest_locale", 'tavern_tables');
 
	};
 
	obj {
 
		nam = '#walls';
 
		act = translate("forest_locale", 'tavern_walls');
 
	};
 
	obj {
 
		nam = '#lights';
 
		act = translate("forest_locale", 'tavern_lights');
 
	};
 
	obj {
 
		nam = '#fireplace';
 
		act = translate("forest_locale", 'tavern_fireplace');
 
	};
 
	obj {
 
		nam = '#cauldron';
 
		act = translate("forest_locale", 'tavern_cauldron');
 
	};
 
	obj {
 
		nam = 'tavernkeeper';
 
		dsc = translate("forest_locale", 'tavern_keeper');
 
		act = function(s)
 
			walkin 'tavernkeeper_dlg'
 
		end;
 
	}
 
  obj {
 
    nam = '#windows';
 
    act = translate("forest_locale", 'tavern_windows');
 
  };
 
  obj {
 
    nam = '#tables';
 
    act = translate("forest_locale", 'tavern_tables');
 
  };
 
  obj {
 
    nam = '#walls';
 
    act = translate("forest_locale", 'tavern_walls');
 
  };
 
  obj {
 
    nam = '#lights';
 
    act = translate("forest_locale", 'tavern_lights');
 
  };
 
  obj {
 
    nam = '#fireplace';
 
    act = translate("forest_locale", 'tavern_fireplace');
 
  };
 
  obj {
 
    nam = '#cauldron';
 
    act = translate("forest_locale", 'tavern_cauldron');
 
  };
 
  obj {
 
    nam = 'tavernkeeper';
 
    dsc = translate("forest_locale", 'tavern_keeper');
 
    act = function(s)
 
      walkin 'tavernkeeper_dlg'
 
    end;
 
  }
 
}
 

	
 
dlg {
 
	nam = 'tavernkeeper_dlg';
 
	noinv = true;
 
	title = translate("forest_locale", 'tavernkeeper_dlg');
 
	pic = 'images/characters/tavernkeeper.png';
 
	theme = 'main';
 
	enter = translate("forest_locale", 'tavernkeeper_dlg_enter');
 
	phr = {
 
		{translate("forest_locale", 'common_dlg_greet'), translate("forest_locale", 'tavernkeeper_dlg_greet_response'),
 
			{translate("forest_locale", 'tavernkeeper_dlg_money'), translate("forest_locale", 'tavernkeeper_dlg_money_response')};
 
			{translate("forest_locale", 'common_dlg_places'), translate("forest_locale", 'tavernkeeper_dlg_places_response')};
 
		};
 
		{cond=function(s) return raspberry_pie_status == 1; end, translate("forest_locale", 'tavernkeeper_dlg_pie'), translate("forest_locale", 'tavernkeeper_dlg_pie_response'),
 
			{translate("forest_locale", 'tavernkeeper_dlg_pie_2'), translate("forest_locale", 'tavernkeeper_dlg_pie_response_2')}
 
		};
 
		{true, translate("forest_locale", 'common_dlg_bye'), function(s)
 
			p(translate_now("forest_locale", 'tavernkeeper_dlg_bye_response'));
 
			walkout();
 
		end};
 
	};
 
  nam = 'tavernkeeper_dlg';
 
  noinv = true;
 
  title = translate("forest_locale", 'tavernkeeper_dlg');
 
  pic = 'images/characters/tavernkeeper.png';
 
  theme = 'main';
 
  enter = translate("forest_locale", 'tavernkeeper_dlg_enter');
 
  phr = {
 
    {translate("forest_locale", 'common_dlg_greet'), translate("forest_locale", 'tavernkeeper_dlg_greet_response'),
 
      {translate("forest_locale", 'tavernkeeper_dlg_money'), translate("forest_locale", 'tavernkeeper_dlg_money_response')};
 
      {translate("forest_locale", 'common_dlg_places'), translate("forest_locale", 'tavernkeeper_dlg_places_response')};
 
    };
 
    {cond=function(s) return raspberry_pie_status == 1; end, translate("forest_locale", 'tavernkeeper_dlg_pie'), translate("forest_locale", 'tavernkeeper_dlg_pie_response'),
 
      {translate("forest_locale", 'tavernkeeper_dlg_pie_2'), translate("forest_locale", 'tavernkeeper_dlg_pie_response_2')}
 
    };
 
    {true, translate("forest_locale", 'common_dlg_bye'), function(s)
 
      p(translate_now("forest_locale", 'tavernkeeper_dlg_bye_response'));
 
      walkout();
 
    end};
 
  };
 
}
 

	
 
room {
 
	nam = 'townhall';
 
	pic='images/townhall.png';
 
	theme = 'main';
 
	title = translate("forest_locale", 'townhall');
 
	nofollow = true;
 
	decor = translate("forest_locale", 'townhall_decor');
 
	onexit = function(s)
 
		if have 'oil' then
 
			p(translate_now("forest_locale", 'townhall_onexit'));
 
			return false;
 
		end;
 
	end;
 
	way = {
 
		path {'#out', translate("forest_locale", 'transition_out'), 'village_center'};
 
	};
 
  nam = 'townhall';
 
  pic='images/townhall.png';
 
  theme = 'main';
 
  title = translate("forest_locale", 'townhall');
 
  nofollow = true;
 
  decor = translate("forest_locale", 'townhall_decor');
 
  onexit = function(s)
 
    if have 'oil' then
 
      p(translate_now("forest_locale", 'townhall_onexit'));
 
      return false;
 
    end;
 
  end;
 
  way = {
 
    path {'#out', translate("forest_locale", 'transition_out'), 'village_center'};
 
  };
 
}: with {
 
	obj {
 
		nam = '#ceiling';
 
		act = translate("forest_locale", 'townhall_ceiling');
 
	};
 
	obj {
 
		nam = '#chandelier';
 
		act = translate("forest_locale", 'townhall_chandelier');
 
	};
 
	obj {
 
		nam = '#curtains';
 
		act = translate("forest_locale", 'townhall_curtains');
 
	};
 
	obj {
 
		nam = '#table';
 
		act = translate("forest_locale", 'townhall_table');
 
	};
 
	obj {
 
		nam = '#chairs';
 
		act = translate("forest_locale", 'townhall_chairs');
 
	};
 
	obj {
 
		nam = '#head';
 
		act = translate("forest_locale", 'townhall_head');
 
	};
 
	obj {
 
		flask = true;
 
		nam = 'cabinet';
 
		dsc = translate("forest_locale", 'townhall_cabinet');
 
		act = function(s)
 
			if s.flask then
 
				return translate_now("forest_locale", 'townhall_cabinet_act_oil');
 
			else
 
				return translate_now("forest_locale", 'townhall_cabinet_act');
 
			end;
 
		end;
 
		used = function(s, o)
 
			if o == _('oil') then
 
				s.flask = true;
 
				remove(o, pl);
 
				put(o, 'townhall');
 
				return translate_now("forest_locale", 'townhall_cabinet_used_oil');
 
			end;
 
		end;
 
	}:with {
 
		obj {
 
			nam = 'records';
 
			act = translate("forest_locale", 'townhall_cabinet_records');
 
		};
 
		obj {
 
			nam = 'parts';
 
			act = translate("forest_locale", 'townhall_cabinet_parts');
 
		};
 
		obj {
 
			nam = 'oil';
 
			disp = translate("forest_locale", 'townhall_cabinet_oil');
 
			tak = function(s)
 
				_('cabinet').flask = false;
 
				return translate_now("forest_locale", 'townhall_cabinet_oil_tak');
 
			end;
 
			inv = translate("forest_locale", 'townhall_cabinet_oil_inv');
 
		};
 
		obj {
 
			nam = 'record_player';
 
			act = translate("forest_locale", 'townhall_cabinet_record_player');
 
		};
 
	};
 
  obj {
 
    nam = '#ceiling';
 
    act = translate("forest_locale", 'townhall_ceiling');
 
  };
 
  obj {
 
    nam = '#chandelier';
 
    act = translate("forest_locale", 'townhall_chandelier');
 
  };
 
  obj {
 
    nam = '#curtains';
 
    act = translate("forest_locale", 'townhall_curtains');
 
  };
 
  obj {
 
    nam = '#table';
 
    act = translate("forest_locale", 'townhall_table');
 
  };
 
  obj {
 
    nam = '#chairs';
 
    act = translate("forest_locale", 'townhall_chairs');
 
  };
 
  obj {
 
    nam = '#head';
 
    act = translate("forest_locale", 'townhall_head');
 
  };
 
  obj {
 
    flask = true;
 
    nam = 'cabinet';
 
    dsc = translate("forest_locale", 'townhall_cabinet');
 
    act = function(s)
 
      if s.flask then
 
        return translate_now("forest_locale", 'townhall_cabinet_act_oil');
 
      else
 
        return translate_now("forest_locale", 'townhall_cabinet_act');
 
      end;
 
    end;
 
    used = function(s, o)
 
      if o == _('oil') then
 
        s.flask = true;
 
        remove(o, pl);
 
        put(o, 'townhall');
 
        return translate_now("forest_locale", 'townhall_cabinet_used_oil');
 
      end;
 
    end;
 
  }:with {
 
    obj {
 
      nam = 'records';
 
      act = translate("forest_locale", 'townhall_cabinet_records');
 
    };
 
    obj {
 
      nam = 'parts';
 
      act = translate("forest_locale", 'townhall_cabinet_parts');
 
    };
 
    obj {
 
      nam = 'oil';
 
      disp = translate("forest_locale", 'townhall_cabinet_oil');
 
      tak = function(s)
 
        _('cabinet').flask = false;
 
        return translate_now("forest_locale", 'townhall_cabinet_oil_tak');
 
      end;
 
      inv = translate("forest_locale", 'townhall_cabinet_oil_inv');
 
    };
 
    obj {
 
      nam = 'record_player';
 
      act = translate("forest_locale", 'townhall_cabinet_record_player');
 
    };
 
  };
 
}
 

	
 
room {
 
	state = false;
 
	nofollow = true;
 
	nam = 'inside_well';
 
	theme = 'tower';
 
	pic = 'images/oldwell.png';
 
	disp = translate("forest_locale", 'inside_well');
 
	onenter = function(s)
 
		if not s.state then
 
			p(translate_now("forest_locale", 'inside_well_enter'));
 
			return false;
 
		end;
 
	end;
 
	decor = translate("forest_locale", 'inside_well_decor');
 
	way = {
 
		path {translate("forest_locale", 'transition_up'), 'village_center'};
 
	}
 
  state = false;
 
  nofollow = true;
 
  nam = 'inside_well';
 
  theme = 'tower';
 
  pic = 'images/oldwell.png';
 
  disp = translate("forest_locale", 'inside_well');
 
  onenter = function(s)
 
    if not s.state then
 
      p(translate_now("forest_locale", 'inside_well_enter'));
 
      return false;
 
    end;
 
  end;
 
  decor = translate("forest_locale", 'inside_well_decor');
 
  way = {
 
    path {translate("forest_locale", 'transition_up'), 'village_center'};
 
  }
 
}:with {
 
	obj {
 
		nam = 'loose_rock';
 
		dsc = translate("forest_locale", 'inside_well_loose_rock');
 
		act = function(s)
 
			p(translate_now("forest_locale", 'inside_well_loose_rock_act'));
 
			take('hidden_key');
 
			s:disable();
 
		end;
 
	}
 
  obj {
 
    nam = 'loose_rock';
 
    dsc = translate("forest_locale", 'inside_well_loose_rock');
 
    act = function(s)
 
      p(translate_now("forest_locale", 'inside_well_loose_rock_act'));
 
      take('hidden_key');
 
      s:disable();
 
    end;
 
  }
 
}
 

	
 
obj {
 
	nam = 'hidden_key';
 
	disp = translate("forest_locale", 'hidden_key_disp');
 
	disp2 = translate("forest_locale", 'hidden_key_disp2');
 
	disp3 = translate("forest_locale", 'hidden_key_disp3');
 
	inv = translate("forest_locale", 'hidden_key_inv');
 
  nam = 'hidden_key';
 
  disp = translate("forest_locale", 'hidden_key_disp');
 
  disp2 = translate("forest_locale", 'hidden_key_disp2');
 
  disp3 = translate("forest_locale", 'hidden_key_disp3');
 
  inv = translate("forest_locale", 'hidden_key_inv');
 
}
 

	
 
room {
 
	nam = 'village_north';
 
	pic = 'images/village_north.png';
 
	disp = translate("forest_locale", 'village_north');
 
	theme = 'main';
 
	nofollow = true;
 
	decor = function(s)
 
  nam = 'village_north';
 
  pic = 'images/village_north.png';
 
  disp = translate("forest_locale", 'village_north');
 
  theme = 'main';
 
  nofollow = true;
 
  decor = function(s)
 
      p(translate_now("forest_locale", 'village_north_decor'));
 
      p(translate_now("forest_locale", 'village_all_decor'));
 
  end;
 
	way = {
 
		path {'#south', translate("forest_locale", 'transition_south_to_town_hall'), 'village_center'};
 
		path {'#in', translate("forest_locale", 'transition_inside_library'), 'library'};
 
	};
 
  way = {
 
    path {'#south', translate("forest_locale", 'transition_south_to_town_hall'), 'village_center'};
 
    path {'#in', translate("forest_locale", 'transition_inside_library'), 'library'};
 
  };
 
}: with {
 
	obj {
 
		nam = '#village';
 
		act = translate("forest_locale", 'village_north_village');
 
	};
 
	obj {
 
		nam = '#road';
 
		act = translate("forest_locale", 'village_north_road');
 
	};
 
	obj {
 
		nam = '#forest';
 
		act = translate("forest_locale", 'village_north_forest');
 
	};
 
	obj {
 
		nam = '#library';
 
		act = translate("forest_locale", 'village_north_library');
 
	};
 
	obj {
 
		nam = '#mountains';
 
		act = translate("forest_locale", 'village_north_mountains');
 
	};
 
	'sun_transformed';
 
	'clouds';
 
  obj {
 
    nam = '#village';
 
    act = translate("forest_locale", 'village_north_village');
 
  };
 
  obj {
 
    nam = '#road';
 
    act = translate("forest_locale", 'village_north_road');
 
  };
 
  obj {
 
    nam = '#forest';
 
    act = translate("forest_locale", 'village_north_forest');
 
  };
 
  obj {
 
    nam = '#library';
 
    act = translate("forest_locale", 'village_north_library');
 
  };
 
  obj {
 
    nam = '#mountains';
 
    act = translate("forest_locale", 'village_north_mountains');
 
  };
 
  'sun_transformed';
 
  'clouds';
 
}
 

	
 
room {
 
	nam = 'library';
 
	pic = 'images/library.png';
 
	disp = translate("forest_locale", 'library');
 
	theme = 'main';
 
	nofollow = true;
 
	decor = translate("forest_locale", 'library_decor');
 
	way = {
 
		path {'#out', translate("forest_locale", 'transition_out'), 'village_north'};
 
		path {'library_hidden_path', translate("forest_locale", 'transition_to_hidden_room'), 'library_hidden_room'}:disable();
 
	};
 
  nam = 'library';
 
  pic = 'images/library.png';
 
  disp = translate("forest_locale", 'library');
 
  theme = 'main';
 
  nofollow = true;
 
  decor = translate("forest_locale", 'library_decor');
 
  way = {
 
    path {'#out', translate("forest_locale", 'transition_out'), 'village_north'};
 
    path {'library_hidden_path', translate("forest_locale", 'transition_to_hidden_room'), 'library_hidden_room'}:disable();
 
  };
 
}:with {
 
	obj {
 
		nam = 'librarian';
 
		dsc = translate("forest_locale", 'library_librarian');
 
		act = function(s)
 
			walkin 'librarian_dlg'
 
		end;
 
		used = function(s, o)
 
			if o^'box' then
 
				return translate_now("forest_locale", 'library_librarian_used_box');
 
			else
 
				return translate_now("forest_locale", 'library_librarian_used_other');
 
			end;
 
		end;
 
	};
 
	obj {
 
		nam = '#tables';
 
		act = translate("forest_locale", 'library_tables');
 
	};
 
	obj {
 
		nam = '#chairs';
 
		act = translate("forest_locale", 'library_chairs');
 
	};
 
	obj {
 
		nam = '#lamps';
 
		act = translate("forest_locale", 'library_lamps');
 
	};
 
	obj {
 
		nam = '#windows';
 
		act = translate("forest_locale", 'library_windows');
 
	};
 
	obj {
 
		state = 0;
 
		nam = 'library_shelves';
 
		act = function(s)
 
			if s.state == 0 then
 
				p(translate_now("forest_locale", 'library_shelves_act_first'));
 
			else
 
				p(translate_now("forest_locale", 'library_shelves_act'));
 
			end;
 
		end;
 
	},
 
	obj {
 
		nam = 'library_the_shelf';
 
		act = function(s)
 
			if	_'library_shelves'.state == 0 then
 
				p(translate_now("forest_locale", 'library_the_shelf_act', {word=library_word}));
 
			end;
 
			_'library_shelves'.state = 1;
 
			walkin('library_shelf_puzzle');
 
		end;
 
	};
 
	obj {
 
		nam = '#library_notice';
 
		act = function(s)
 
			walkin('library_notice_inside')
 
		end;
 
	}
 
  obj {
 
    nam = 'librarian';
 
    dsc = translate("forest_locale", 'library_librarian');
 
    act = function(s)
 
      walkin 'librarian_dlg'
 
    end;
 
    used = function(s, o)
 
      if o^'box' then
 
        return translate_now("forest_locale", 'library_librarian_used_box');
 
      else
 
        return translate_now("forest_locale", 'library_librarian_used_other');
 
      end;
 
    end;
 
  };
 
  obj {
 
    nam = '#tables';
 
    act = translate("forest_locale", 'library_tables');
 
  };
 
  obj {
 
    nam = '#chairs';
 
    act = translate("forest_locale", 'library_chairs');
 
  };
 
  obj {
 
    nam = '#lamps';
 
    act = translate("forest_locale", 'library_lamps');
 
  };
 
  obj {
 
    nam = '#windows';
 
    act = translate("forest_locale", 'library_windows');
 
  };
 
  obj {
 
    state = 0;
 
    nam = 'library_shelves';
 
    act = function(s)
 
      if s.state == 0 then
 
        p(translate_now("forest_locale", 'library_shelves_act_first'));
 
      else
 
        p(translate_now("forest_locale", 'library_shelves_act'));
 
      end;
 
    end;
 
  },
 
  obj {
 
    nam = 'library_the_shelf';
 
    act = function(s)
 
      if  _'library_shelves'.state == 0 then
 
        p(translate_now("forest_locale", 'library_the_shelf_act', {word=library_word}));
 
      end;
 
      _'library_shelves'.state = 1;
 
      walkin('library_shelf_puzzle');
 
    end;
 
  };
 
  obj {
 
    nam = '#library_notice';
 
    act = function(s)
 
      walkin('library_notice_inside')
 
    end;
 
  }
 
}
 

	
 
room {
 
	nam = 'library_notice_inside';
 
	pic = 'images/library.png';
 
	disp = translate("forest_locale", 'library');
 
	theme = 'main';
 
  nam = 'library_notice_inside';
 
  pic = 'images/library.png';
 
  disp = translate("forest_locale", 'library');
 
  theme = 'main';
 
  nofollow = true;
 
	decor = translate("forest_locale", 'library_notice_inside_decor');
 
	way = {
 
		path {translate("common_locale", 'back'), 'library'};
 
	};
 
  decor = translate("forest_locale", 'library_notice_inside_decor');
 
  way = {
 
    path {translate("common_locale", 'back'), 'library'};
 
  };
 
}
 

	
 
dlg {
 
	ring = 0;
 
	nam = 'librarian_dlg';
 
	pic = 'images/characters/librarian.png';
 
	theme = 'main';
 
	noinv = true;
 
	title = translate("forest_locale", 'librarian_dlg');
 
	enter = function(s)
 
		seen_ring_librarian = true;
 
		return translate_now("forest_locale", 'librarian_dlg_enter');
 
	end;
 
	phr = {
 
		{translate("forest_locale", 'common_dlg_greet'), translate("forest_locale", 'librarian_dlg_greet_response'),
 
			{translate("forest_locale", 'common_dlg_places'), translate("forest_locale", 'librarian_dlg_places_response'),
 
				{translate("forest_locale", 'librarian_dlg_library'), translate("forest_locale", 'librarian_dlg_library_response')};
 
  ring = 0;
 
  nam = 'librarian_dlg';
 
  pic = 'images/characters/librarian.png';
 
  theme = 'main';
 
  noinv = true;
 
  title = translate("forest_locale", 'librarian_dlg');
 
  enter = function(s)
 
    seen_ring_librarian = true;
 
    return translate_now("forest_locale", 'librarian_dlg_enter');
 
  end;
 
  phr = {
 
    {translate("forest_locale", 'common_dlg_greet'), translate("forest_locale", 'librarian_dlg_greet_response'),
 
      {translate("forest_locale", 'common_dlg_places'), translate("forest_locale", 'librarian_dlg_places_response'),
 
        {translate("forest_locale", 'librarian_dlg_library'), translate("forest_locale", 'librarian_dlg_library_response')};
 
        {translate("forest_locale", 'librarian_dlg_library_old'), translate("forest_locale", 'librarian_dlg_library_old_response')};
 
			},
 
			{translate("forest_locale", 'librarian_dlg_ring'), translate("forest_locale", 'librarian_dlg_ring_response')}
 
		},
 
		{cond=function(s) return seen_ring_box; end, translate("forest_locale", 'librarian_dlg_ring_look'), function(s)
 
			_('village_well').known = 1;
 
			return translate_now("forest_locale", 'librarian_dlg_ring_look_response');
 
		end};
 
		{true, translate("forest_locale", 'common_dlg_bye'), function(s)
 
			p(translate_now("forest_locale", 'librarian_dlg_bye_response'));
 
			walkout();
 
		end}
 
	}
 
      },
 
      {translate("forest_locale", 'librarian_dlg_ring'), translate("forest_locale", 'librarian_dlg_ring_response')}
 
    },
 
    {cond=function(s) return seen_ring_box; end, translate("forest_locale", 'librarian_dlg_ring_look'), function(s)
 
      _('village_well').known = 1;
 
      return translate_now("forest_locale", 'librarian_dlg_ring_look_response');
 
    end};
 
    {true, translate("forest_locale", 'common_dlg_bye'), function(s)
 
      p(translate_now("forest_locale", 'librarian_dlg_bye_response'));
 
      walkout();
 
    end}
 
  }
 
}
 

	
 
function book(number) 
 
  return obj {
 
    book = number;
 
    nam = 'book_' .. tostring(number);
 
    disp = translate("forest_locale", 'library_shelf_book_disp', {number=number});
 
    dsc = function(s)
 
      return '{"' .. translate_now("forest_locale", 'library_shelf_book_disp', {number=number}) .. '"}';
 
    end;
 
    tak = translate("forest_locale", 'library_shelf_book_tak');
 
    inv = translate("forest_locale", 'library_shelf_book_inv');
 
    used = function(s, o)
 
      if o.book and where(s)^'shelf' then     
 
        local t = _'shelf'.obj;
 
        local idx = 9;
 
        for i = 1, #t do
 
          if t[i] == s then
 
            idx = i;
 
            break;
 
          end;
 
        end;
 
        
 
        remove(o, pl);
 
        _'shelf'.obj:add(o, idx);
 
        p(translate_now("forest_locale", 'library_shelf_puzzle_used_book'));
 
        if #t == 9 then
 
					for i = 1, 9 do
 
						if library_book_map[t[i].book] ~= i then
 
							return;
 
						end;
 
					end;
 
					p(translate_now("forest_locale", 'library_shelf_puzzle_used_book_success'));
 
					disable 'library_shelves'
 
					enable 'library_hidden_path'
 
					walkout()
 
				end;
 
          for i = 1, 9 do
 
            if library_book_map[t[i].book] ~= i then
 
              return;
 
            end;
 
          end;
 
          p(translate_now("forest_locale", 'library_shelf_puzzle_used_book_success'));
 
          disable 'library_shelves'
 
          enable 'library_hidden_path'
 
          walkout()
 
        end;
 
      else
 
        return false;
 
      end;
 
    end;
 
  };
 
end;
 

	
 
room {
 
	nam = 'library_shelf_puzzle';
 
	nofollow = true;
 
	disp = translate("forest_locale", 'library');
 
	theme = 'main';
 
  nam = 'library_shelf_puzzle';
 
  nofollow = true;
 
  disp = translate("forest_locale", 'library');
 
  theme = 'main';
 
  onexit = function(s)
 
    if have('book_1') or have('book_2') or have('book_3') or have('book_4') or have('book_5') or have('book_6') or have('book_7') or have('book_8')or have('book_9') then
 
      p(translate_now("forest_locale", 'leave_books_message'));
 
      return false;
 
    end;
 
  end;
 
	pic = function(s)
 
		local pic = 'images/library/library_bg_' .. library_word.. '.png';
 
		for index, book in ipairs(_'shelf'.obj) do
 
			pic = pic .. ';images/library/library_book' .. tostring(book.book) .. '.png@' .. tostring(35 * index - 33) .. ',63';
 
		end;
 
		return pic;
 
	end;
 
	way = {
 
		path {'#back', translate("forest_locale", 'transition_away_from_bookstand'), 'library'};
 
	};
 
  pic = function(s)
 
    local pic = 'images/library/library_bg_' .. library_word.. '.png';
 
    for index, book in ipairs(_'shelf'.obj) do
 
      pic = pic .. ';images/library/library_book' .. tostring(book.book) .. '.png@' .. tostring(35 * index - 33) .. ',63';
 
    end;
 
    return pic;
 
  end;
 
  way = {
 
    path {'#back', translate("forest_locale", 'transition_away_from_bookstand'), 'library'};
 
  };
 
}:with {
 
	obj {
 
		nam = 'shelf';
 
		dsc = function(s)
 
			local count = #s.obj;
 
			if count > 1 then
 
				p(translate_now("forest_locale", 'library_shelf_puzzle_shelf_multiple'));
 
			elseif count == 1 then
 
				p(translate_now("forest_locale", 'library_shelf_puzzle_shelf_single'));
 
			else
 
				p(translate_now("forest_locale", 'library_shelf_puzzle_shelf_none'));
 
			end;
 
		end;
 
		act = function(s)
 
  obj {
 
    nam = 'shelf';
 
    dsc = function(s)
 
      local count = #s.obj;
 
      if count > 1 then
 
        p(translate_now("forest_locale", 'library_shelf_puzzle_shelf_multiple'));
 
      elseif count == 1 then
 
        p(translate_now("forest_locale", 'library_shelf_puzzle_shelf_single'));
 
      else
 
        p(translate_now("forest_locale", 'library_shelf_puzzle_shelf_none'));
 
      end;
 
    end;
 
    act = function(s)
 
      return translate_now("forest_locale", 'library_shelf_puzzle_shelf_act', {word=library_word});
 
    end;
 
		used = function(s, o)		
 
			if o.book then
 
				remove(o, pl);
 
				_'shelf'.obj:add(o);
 
				p(translate_now("forest_locale", 'library_shelf_puzzle_used_book'));
 
    used = function(s, o)    
 
      if o.book then
 
        remove(o, pl);
 
        _'shelf'.obj:add(o);
 
        p(translate_now("forest_locale", 'library_shelf_puzzle_used_book'));
 

	
 
				if #s.obj == 9 then
 
					for i = 1, 9 do
 
						if library_book_map[s.obj[i].book] ~= i then
 
							return;
 
						end;
 
					end;
 
					p(translate_now("forest_locale", 'library_shelf_puzzle_used_book_success'));
 
					disable 'library_shelves'
 
					enable 'library_hidden_path'
 
					walkout()
 
				end;
 
			else
 
				return false;
 
			end;
 
		end;
 
	}:with {
 
		book(1),
 
		book(2),
 
		book(3),
 
		book(4),
 
		book(5),
 
		book(6),
 
		book(7),
 
		book(8),
 
		book(9),
 
	}
 
        if #s.obj == 9 then
 
          for i = 1, 9 do
 
            if library_book_map[s.obj[i].book] ~= i then
 
              return;
 
            end;
 
          end;
 
          p(translate_now("forest_locale", 'library_shelf_puzzle_used_book_success'));
 
          disable 'library_shelves'
 
          enable 'library_hidden_path'
 
          walkout()
 
        end;
 
      else
 
        return false;
 
      end;
 
    end;
 
  }:with {
 
    book(1),
 
    book(2),
 
    book(3),
 
    book(4),
 
    book(5),
 
    book(6),
 
    book(7),
 
    book(8),
 
    book(9),
 
  }
 
}
 

	
 
room {
 
	nam = 'library_hidden_room';
 
	pic = function(s)
 
  nam = 'library_hidden_room';
 
  pic = function(s)
 
    if where('box')^here() then
 
      return 'images/library_hidden_room_box.png';
 
    else
 
      return 'images/library_hidden_room.png';
 
    end;
 
  end;
 
	disp = translate("forest_locale", 'library_hidden_room');
 
	theme = 'main';
 
	nofollow = true;
 
	decor = translate("forest_locale", 'library_hidden_room_decor');
 
	way = {
 
		path {translate("forest_locale", 'transition_to_main_hall'), 'library'};
 
	};
 
  disp = translate("forest_locale", 'library_hidden_room');
 
  theme = 'main';
 
  nofollow = true;
 
  decor = translate("forest_locale", 'library_hidden_room_decor');
 
  way = {
 
    path {translate("forest_locale", 'transition_to_main_hall'), 'library'};
 
  };
 
}:with {
 
	obj {
 
		nam = '#table';
 
		act = translate("forest_locale", 'library_hidden_room_table');
 
	};
 
	obj {
 
		oiled = false;
 
		opened = false;
 
		lock_taken = false;
 
		nam = 'box';
 
		disp = translate("forest_locale", 'box_disp');
 
		disp2 = translate("forest_locale", 'box_disp2');
 
		disp3 = translate("forest_locale", 'box_disp3');
 
		dsc = translate("forest_locale", 'box_dsc');
 
		tak = translate("forest_locale", 'box_tak');
 
		inv = function(s)
 
			seen_ring_box = true;
 
			if s.lock_taken then
 
				p(translate_now("forest_locale", 'box_inv_without_lock'));
 
			elseif s.opened then
 
				s.lock_taken = true;
 
				p(translate_now("forest_locale", 'box_inv_take_lock'));
 
				take('lock');
 
				remove('box', pl);
 
			else
 
  obj {
 
    nam = '#table';
 
    act = translate("forest_locale", 'library_hidden_room_table');
 
  };
 
  obj {
 
    oiled = false;
 
    opened = false;
 
    lock_taken = false;
 
    nam = 'box';
 
    disp = translate("forest_locale", 'box_disp');
 
    disp2 = translate("forest_locale", 'box_disp2');
 
    disp3 = translate("forest_locale", 'box_disp3');
 
    dsc = translate("forest_locale", 'box_dsc');
 
    tak = translate("forest_locale", 'box_tak');
 
    inv = function(s)
 
      seen_ring_box = true;
 
      if s.lock_taken then
 
        p(translate_now("forest_locale", 'box_inv_without_lock'));
 
      elseif s.opened then
 
        s.lock_taken = true;
 
        p(translate_now("forest_locale", 'box_inv_take_lock'));
 
        take('lock');
 
        remove('box', pl);
 
      else
 
        p(translate_now("forest_locale", 'box_inv'));
 
        if seen_ring_librarian then
 
          p(translate_now("forest_locale", 'box_inv_known'));
 
        end;
 
			end;
 
		end;
 
		used = function(s, o)
 
			if o^'hidden_key' then
 
				if s.oiled then
 
					s.opened = true;
 
					take('map');
 
					p(translate_now("forest_locale", 'box_used_key_success'));
 
				else
 
					p(translate_now("forest_locale", 'box_used_key_failed'));
 
				end;
 
			elseif o^'oil' then
 
				if not s.oiled then
 
					s.oiled = true;
 
					p(translate_now("forest_locale", 'box_used_key_oil'));
 
				else
 
					p(translate_now("forest_locale", 'box_used_key_oil2'));
 
				end;
 
			end;
 
		end;
 
	}
 
      end;
 
    end;
 
    used = function(s, o)
 
      if o^'hidden_key' then
 
        if s.oiled then
 
          s.opened = true;
 
          take('map');
 
          p(translate_now("forest_locale", 'box_used_key_success'));
 
        else
 
          p(translate_now("forest_locale", 'box_used_key_failed'));
 
        end;
 
      elseif o^'oil' then
 
        if not s.oiled then
 
          s.oiled = true;
 
          p(translate_now("forest_locale", 'box_used_key_oil'));
 
        else
 
          p(translate_now("forest_locale", 'box_used_key_oil2'));
 
        end;
 
      end;
 
    end;
 
  }
 
}
 

	
 
obj {
 
	nam = 'map';
 
	disp = translate("forest_locale", 'map_disp');
 
	disp2 = translate("forest_locale", 'map_disp2');
 
	disp3 = translate("forest_locale", 'map_disp3');
 
	inv = function(s)
 
		p(translate_now("forest_locale", 'map_inv'));
 
		_('fly_west_from_village'):enable();
 
	end;
 
  nam = 'map';
 
  disp = translate("forest_locale", 'map_disp');
 
  disp2 = translate("forest_locale", 'map_disp2');
 
  disp3 = translate("forest_locale", 'map_disp3');
 
  inv = function(s)
 
    p(translate_now("forest_locale", 'map_inv'));
 
    _('fly_west_from_village'):enable();
 
  end;
 
}
 

	
 
room {
 
	nam = 'inside_crater_glade';
 
	pic = 'images/inside_crater_glade.png';
 
	disp = translate("forest_locale", 'inside_crater_glade');
 
	theme = 'main';
 
	onenter = function(s)
 
		if here()^'above_crater' then
 
			p(translate_now("forest_locale", 'inside_crater_glade_on_enter'));
 
		end;
 
	end;
 
	decor = translate("forest_locale", 'inside_crater_glade_decor');
 
	way = {
 
		path {translate("forest_locale", 'transition_fly'), "above_crater"};
 
		path {translate("forest_locale", 'transition_along_the_path'), "inside_crater_path"};
 
	}
 
  nam = 'inside_crater_glade';
 
  pic = 'images/inside_crater_glade.png';
 
  disp = translate("forest_locale", 'inside_crater_glade');
 
  theme = 'main';
 
  onenter = function(s)
 
    if here()^'above_crater' then
 
      p(translate_now("forest_locale", 'inside_crater_glade_on_enter'));
 
    end;
 
  end;
 
  decor = translate("forest_locale", 'inside_crater_glade_decor');
 
  way = {
 
    path {translate("forest_locale", 'transition_fly'), "above_crater"};
 
    path {translate("forest_locale", 'transition_along_the_path'), "inside_crater_path"};
 
  }
 
}: with {
 
	obj {
 
		nam = '#forest';
 
		act = translate("forest_locale", 'inside_crater_glade_forest');
 
	};
 
	obj {
 
		nam = '#oak';
 
		act = translate("forest_locale", 'inside_crater_glade_oak');
 
	};
 
	obj {
 
		nam = '#grass';
 
		act = translate("forest_locale", 'inside_crater_glade_grass');
 
	};
 
	obj {
 
		nam = '#path';
 
		act = translate("forest_locale", 'inside_crater_glade_path');
 
	};
 
	obj {
 
		nam = '#tower';
 
		act = translate("forest_locale", 'inside_crater_glade_tower');
 
	};
 
	obj {
 
		nam = '#crater';
 
		act = translate("forest_locale", 'inside_crater_glade_crater');
 
	};
 
  obj {
 
    nam = '#forest';
 
    act = translate("forest_locale", 'inside_crater_glade_forest');
 
  };
 
  obj {
 
    nam = '#oak';
 
    act = translate("forest_locale", 'inside_crater_glade_oak');
 
  };
 
  obj {
 
    nam = '#grass';
 
    act = translate("forest_locale", 'inside_crater_glade_grass');
 
  };
 
  obj {
 
    nam = '#path';
 
    act = translate("forest_locale", 'inside_crater_glade_path');
 
  };
 
  obj {
 
    nam = '#tower';
 
    act = translate("forest_locale", 'inside_crater_glade_tower');
 
  };
 
  obj {
 
    nam = '#crater';
 
    act = translate("forest_locale", 'inside_crater_glade_crater');
 
  };
 
}
 

	
 
room {
 
	nam = 'inside_crater_path';
 
	pic = function(s)
 
		local p = 'images/inside_crater_path.png';
 
		if here()^where('solarscale') then
 
			p = p .. ';images/characters/solarscale_on_rock.png';
 
		end;
 
		return p;
 
	end;
 
	disp = translate("forest_locale", 'inside_crater_path');
 
	theme = 'main';
 
	decor = translate("forest_locale", 'inside_crater_path_decor');
 
	exit = function(s, t)
 
		if t^'crater_near_tower' and seen('solarscale', s) then
 
			remove('solarscale', where('solarscale'));
 
			p(translate_now("forest_locale", 'inside_crater_path_exit'));
 
		end;
 
	end;
 
	way = {
 
		path {translate("forest_locale", 'transition_to_glade'), "inside_crater_glade"};
 
		path {translate("forest_locale", 'transition_to_tower'), "crater_near_tower"};
 
	};
 
  nam = 'inside_crater_path';
 
  pic = function(s)
 
    local p = 'images/inside_crater_path.png';
 
    if here()^where('solarscale') then
 
      p = p .. ';images/characters/solarscale_on_rock.png';
 
    end;
 
    return p;
 
  end;
 
  disp = translate("forest_locale", 'inside_crater_path');
 
  theme = 'main';
 
  decor = translate("forest_locale", 'inside_crater_path_decor');
 
  exit = function(s, t)
 
    if t^'crater_near_tower' and seen('solarscale', s) then
 
      remove('solarscale', where('solarscale'));
 
      p(translate_now("forest_locale", 'inside_crater_path_exit'));
 
    end;
 
  end;
 
  way = {
 
    path {translate("forest_locale", 'transition_to_glade'), "inside_crater_glade"};
 
    path {translate("forest_locale", 'transition_to_tower'), "crater_near_tower"};
 
  };
 
}: with {
 
	obj {
 
		nam = '#grass';
 
		act = translate("forest_locale", 'inside_crater_path_grass');
 
	};
 
	obj {
 
		nam = '#crater';
 
		act = translate("forest_locale", 'inside_crater_path_crater')
 
	};
 
	obj {
 
		nam = '#trees';
 
		act = translate("forest_locale", 'inside_crater_path_trees')
 
	};
 
	obj {
 
		nam = '#tower';
 
		act = translate("forest_locale", 'inside_crater_path_tower')
 
	};
 
	obj {
 
		nam = '#stump';
 
		dsc = function(s)
 
			if seen('solarscale', here()) then
 
				p(translate_now("forest_locale", 'inside_crater_path_stump_with_solarscale'));
 
			else
 
				p(translate_now("forest_locale", 'inside_crater_path_stump'));
 
			end;
 
		end;
 
		act = translate("forest_locale", 'inside_crater_path_stump_act');
 
	};
 
	obj {
 
		nam = 'solarscale';
 
		act = function(s)
 
			walkin('solarscale_dlg');
 
		end;
 
	}
 
  obj {
 
    nam = '#grass';
 
    act = translate("forest_locale", 'inside_crater_path_grass');
 
  };
 
  obj {
 
    nam = '#crater';
 
    act = translate("forest_locale", 'inside_crater_path_crater')
 
  };
 
  obj {
 
    nam = '#trees';
 
    act = translate("forest_locale", 'inside_crater_path_trees')
 
  };
 
  obj {
 
    nam = '#tower';
 
    act = translate("forest_locale", 'inside_crater_path_tower')
 
  };
 
  obj {
 
    nam = '#stump';
 
    dsc = function(s)
 
      if seen('solarscale', here()) then
 
        p(translate_now("forest_locale", 'inside_crater_path_stump_with_solarscale'));
 
      else
 
        p(translate_now("forest_locale", 'inside_crater_path_stump'));
 
      end;
 
    end;
 
    act = translate("forest_locale", 'inside_crater_path_stump_act');
 
  };
 
  obj {
 
    nam = 'solarscale';
 
    act = function(s)
 
      walkin('solarscale_dlg');
 
    end;
 
  }
 
}
 

	
 
dlg {
 
	nam = 'solarscale_dlg';
 
	disp = translate("solarscale_locale", 'disp');
 
	theme = 'main';
 
	pic = 'images/inside_crater_path.png;images/characters/solarscale.png';
 
	enter = translate("solarscale_locale", 'first_dlg_enter');
 
  nam = 'solarscale_dlg';
 
  disp = translate("solarscale_locale", 'disp');
 
  theme = 'main';
 
  pic = 'images/inside_crater_path.png;images/characters/solarscale.png';
 
  enter = translate("solarscale_locale", 'first_dlg_enter');
 
  convince = 0;
 
  open_q45 = false;
 
	phr = {
 
  phr = {
 
    {only=true, '#q1', translate("solarscale_locale", 'first_dlg_dragon'), translate("solarscale_locale", 'first_dlg_dragon_response'),
 
      {translate("solarscale_locale", 'first_dlg_dragon_admit'), function(s) 
 
        _('solarscale_dlg').convince = _('solarscale_dlg').convince + 1;
 
        return translate_now("solarscale_locale", 'first_dlg_dragon_admit_response');
 
      end};
 
      {translate("solarscale_locale", 'first_dlg_dragon_question'), translate("solarscale_locale", 'first_dlg_dragon_question_response')};
 
      {translate("solarscale_locale", 'first_dlg_dragon_decline'), function(s) 
 
        _('solarscale_dlg').convince = _('solarscale_dlg').convince - 1;
 
        return translate_now("solarscale_locale", 'first_dlg_dragon_decline_response');
 
      end};
 
    };
 
    {only=true, '#q2', translate("solarscale_locale", 'first_dlg_about_map'), function(s)
 
        _('solarscale_dlg').convince = _('solarscale_dlg').convince + 1;
 
        _('solarscale_ally').tower_know_discussed = true;
 
        return translate_now("solarscale_locale", 'first_dlg_about_map_response');
 
    end, 
 
      {translate("solarscale_locale", 'first_dlg_about_map_1'), translate("solarscale_locale", 'first_dlg_about_map_1_response')};
 
      {translate("solarscale_locale", 'first_dlg_about_map_2'), translate("solarscale_locale", 'first_dlg_about_map_1_response')};
 
      {translate("solarscale_locale", 'first_dlg_about_map_3'), function(s)
 
          disable('#q3');
 
          _('solarscale_dlg').open_q45 = true;
 
          return translate_now("solarscale_locale", 'first_dlg_about_map_3_response');
 
      end};
 
    };
 
    {'#q3', translate("solarscale_locale", 'first_dlg_unusual'), function(s)
 
        _('solarscale_dlg').open_q45 = true;
 
        return translate_now("solarscale_locale", 'first_dlg_unusual_response');
 
    end};
 
    {cond=function(s) return _('solarscale_dlg').open_q45 end, '#q4', translate("solarscale_locale", 'first_dlg_tower'), translate("solarscale_locale", 'first_dlg_tower_response')};
 
    {cond=function(s) return _('solarscale_dlg').open_q45 end, '#q5', translate("solarscale_locale", 'first_dlg_tower_join'), function(s)
 
      if _('solarscale_dlg').convince >= 3 then
 
        walkout();
 
        solarscale_with_me = true;
 
        remove('solarscale', where('solarscale'));
 
        put('solarscale_ally', here());
 
        lifeon(_'solarscale_ally');
 
        return translate_now("solarscale_locale", 'first_dlg_tower_join_response_success_1');
 
      else
 
        return translate_now("solarscale_locale", 'first_dlg_tower_join_response_fail');
 
      end;
 
    end;
 
      {translate("solarscale_locale", 'first_dlg_tower_join_1'), function(s)
 
        _('solarscale_dlg').convince = _('solarscale_dlg').convince + 1;
 
        if _('solarscale_dlg').convince >= 3 then
 
          walkout();
 
          solarscale_with_me = true;
 
          remove('solarscale', where('solarscale'));
 
          put('solarscale_ally', here());
 
          lifeon(_'solarscale_ally');
 
          return translate_now("solarscale_locale", 'first_dlg_tower_join_response_success_1');
 
        else
 
          return translate_now("solarscale_locale", 'first_dlg_tower_join_response_fail_1');
 
        end;
 
      end;};
 
      {translate("solarscale_locale", 'first_dlg_tower_join_2'), translate("solarscale_locale", 'first_dlg_tower_join_response_2')};
 
      {translate("solarscale_locale", 'first_dlg_tower_join_3'), function(s)
 
        _('solarscale_dlg').convince = _('solarscale_dlg').convince + 1;
 
        if _('solarscale_dlg').convince >= 3 then
 
          walkout();
 
          solarscale_with_me = true;
 
          remove('solarscale', where('solarscale'));
 
          put('solarscale_ally', here());
 
          lifeon(_'solarscale_ally');
 
          return translate_now("solarscale_locale", 'first_dlg_tower_join_response_success_3');
 
        else
 
          return translate_now("solarscale_locale", 'first_dlg_tower_join_response_fail_3');
 
        end;
 
      end;};
 
      {translate("solarscale_locale", 'first_dlg_tower_bye_thanks'), function(s)
 
        walkout();
 
        remove('solarscale', where('solarscale'));
 
        return translate_now("solarscale_locale", 'first_dlg_tower_bye_response');
 
      end};
 
    };
 
    {'#q6', function(s)
 
        if not closed('#q3') then
 
          return translate_now("solarscale_locale", 'first_dlg_tower_bye_no_time');
 
        else 
 
          return translate_now("solarscale_locale", 'first_dlg_tower_bye_thanks');
 
        end;
 
    end, function(s)
 
			walkout();
 
			remove('solarscale', where('solarscale'));
 
			return translate_now("solarscale_locale", 'first_dlg_tower_bye_response');
 
		end};
 
      walkout();
 
      remove('solarscale', where('solarscale'));
 
      return translate_now("solarscale_locale", 'first_dlg_tower_bye_response');
 
    end};
 
  }
 
}
 

	
 
room {
 
	nam = 'crater_near_tower';
 
	pic = 'images/crater_near_tower.png';
 
	disp = translate("forest_locale", 'crater_near_tower');
 
	theme = 'main';
 
	decor = translate("forest_locale", 'crater_near_tower_decor');
 
  nam = 'crater_near_tower';
 
  pic = 'images/crater_near_tower.png';
 
  disp = translate("forest_locale", 'crater_near_tower');
 
  theme = 'main';
 
  decor = translate("forest_locale", 'crater_near_tower_decor');
 
  enter = function(s)
 
    tower_seen = true;
 
  end;
 
	way = {
 
		path {translate("forest_locale", 'transition_along_the_path'), "inside_crater_path"};
 
		path {translate("forest_locale", 'transition_inside_tower'), "tower_level_1"};
 
	};
 
  way = {
 
    path {translate("forest_locale", 'transition_along_the_path'), "inside_crater_path"};
 
    path {translate("forest_locale", 'transition_inside_tower'), "tower_level_1"};
 
  };
 
}:with {
 
	obj {
 
		nam = '#tower';
 
		act = translate("forest_locale", 'crater_near_tower_tower');
 
	};
 
	obj {
 
		nam = '#grass';
 
		act = translate("forest_locale", 'crater_near_tower_grass');
 
	};
 
	obj {
 
		nam = '#trees';
 
		act = translate("forest_locale", 'crater_near_tower_trees');
 
	};
 
	obj {
 
		nam = '#sun';
 
		act = translate("forest_locale", 'crater_near_tower_sun');
 
	};
 
  obj {
 
    nam = '#tower';
 
    act = translate("forest_locale", 'crater_near_tower_tower');
 
  };
 
  obj {
 
    nam = '#grass';
 
    act = translate("forest_locale", 'crater_near_tower_grass');
 
  };
 
  obj {
 
    nam = '#trees';
 
    act = translate("forest_locale", 'crater_near_tower_trees');
 
  };
 
  obj {
 
    nam = '#sun';
 
    act = translate("forest_locale", 'crater_near_tower_sun');
 
  };
 
}
game_theme.lua
Show inline comments
 
new file 100644
 
if instead.tiny then
 
  -- Stub the theme if instead.tiny is present
 
  function set_theme(t) end;
 
  return;
 
end;
 

	
 
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});
 
    
 
    if scaled_width == 640 and scaled_height == 480 then
 
      text_area.rect = {
 
        lx = 0,
 
        rx = 0,
 
        wmax = 640,
 
        hmax = 180,
 
        by = 0,
 
        ay = 1
 
      };
 
    else
 
      text_area.rect = {
 
        lx = 24,
 
        rx = 24,
 
        wmax = 600,
 
        hmax = 160,
 
        by = 24,
 
        ay = 1
 
      };
 
    end;
 
    
 
    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});
 
    
 
     if scaled_width == 640 and scaled_height == 480 then
 
      text_area.rect = {
 
        lx = 0,
 
        rx = 0,
 
        wmax = 640,
 
        hmax = 180,
 
        by = 0,
 
        ay = 1
 
      };
 
    else
 
      text_area.rect = {
 
        lx = 24,
 
        rx = 24,
 
        wmax = 600,
 
        hmax = 160,
 
        by = 24,
 
        ay = 1
 
      };
 
    end;
 
    
 
    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;
 
\ No newline at end of file
images/terminal/keyboard_shift.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/title/about.eo.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/title/back.eo.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/title/load.eo.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/title/quit.eo.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/title/save.eo.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/title/settings.eo.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/title/start.eo.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
images/title/tutorial.eo.png
Show inline comments
 
new file 100644
 
binary diff not shown
Show images

Changeset was too big and was cut off... Show full diff