<commit_before>require "sprites"
require "theme"
require "timer"
local w, h

local font
local font_height

local text = {
	{ "ПРОВОДНИК", style = 1},
	{ },
	{ "Сюжет и код игры:", style = 2},
	{ "<NAME>" },
	{ },
	{ "Иллюстрации:", style = 2 },
	{ "<NAME>" },
	{ },
	{ "Музыка:", style = 2 },
	{ "<NAME>" },
	{ },
	{ "Тестирование:", style = 2 },
	{ "kerber" },
	{ "<NAME>" },
	{ },
	{ "Игра написана в ферале 2017" },
	{ "Для тестирования движка STEAD3"},
	{ },
	{ "Спасибо Вам за прохождение!" },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ "КОНЕЦ", style = 1 },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },

}

local offset = 0
local pos = 1
local line
local ww, hh

function game:timer()
	local scr = sprite.scr()
	-- scroll
	scr:copy(0, 1, w, h - 1, scr, 0, 0)

	if offset >= font_height then
		pos = pos + 1
		offset = 0
	end

	if offset == 0 then
		if pos <= #text then
			line = text[pos]
			line = font:text(line[1] or ' ', line.color or 'white', line.style or 0)
			ww, hh = line:size()
		else
			line = false
		end
	end
	if line then
		offset = offset + 1
		scr:fill(0, h - offset, w, offset, 'black')
		line:draw(scr, math.floor((w - ww) / 2), h - offset)
	end
end
room {
	nam = 'legacy_titles',
	title = false,
	decor = function(s)
		for k, v in ipairs(text) do
			if v.style == 1 then
				pn(txt:center(txt:bold(v[1] or '')))
			elseif v.style == 2 then
				pn(txt:center(txt:em(v[1] or '')))
			else
				pn(txt:center(v[1] or ''))
			end
		end
	end;
}

global 'ontitles' (false)
local activated
room {
	title = false;
	nam = 'black';
	onenter = function()
		theme.set('scr.gfx.bg', '')
		theme.set('scr.col.bg', 'black')
		theme.set('menu.button.x', w)
		timer:set(1000)
	end;
	timer = function(s)
		if activated then
			return false
		end
		activated = true
		timer:set(30)
		sprite.direct(true)
		sprite.scr():fill 'black'
		return false
	end;
}

function end_titles()
	offset = 0
	ontitles = true
	if true or not sprite.direct(true) then
		timer:stop()
		instead.fading = 32
		walk ('legacy_titles', false)
		return
	end
	sprite.direct(false)
	instead.fading = 32<commit_msg>titles fix2<commit_after>require "sprites"
require "theme"
require "timer"
local w, h

local font
local font_height

local text = {
	{ "ПРОВОДНИК", style = 1},
	{ },
	{ "Сюжет и код игры:", style = 2},
	{ "<NAME>" },
	{ },
	{ "Иллюстрации:", style = 2 },
	{ "<NAME>" },
	{ },
	{ "Музыка:", style = 2 },
	{ "<NAME>" },
	{ },
	{ "Тестирование:", style = 2 },
	{ "kerber" },
	{ "<NAME>" },
	{ },
	{ "Игра написана в ферале 2017" },
	{ "Для тестирования движка STEAD3"},
	{ },
	{ "Спасибо Вам за прохождение!" },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ "КОНЕЦ", style = 1 },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },
	{ },

}

local offset = 0
local pos = 1
local line
local ww, hh

function game:timer()
	local scr = sprite.scr()
	-- scroll
	scr:copy(0, 1, w, h - 1, scr, 0, 0)

	if offset >= font_height then
		pos = pos + 1
		offset = 0
	end

	if offset == 0 then
		if pos <= #text then
			line = text[pos]
			line = font:text(line[1] or ' ', line.color or 'white', line.style or 0)
			ww, hh = line:size()
		else
			line = false
		end
	end
	if line then
		offset = offset + 1
		scr:fill(0, h - offset, w, offset, 'black')
		line:draw(scr, math.floor((w - ww) / 2), h - offset)
	end
end
room {
	nam = 'legacy_titles',
	title = false,
	decor = function(s)
		for k, v in ipairs(text) do
			if v.style == 1 then
				pn(txt:center(txt:bold(v[1] or '')))
			elseif v.style == 2 then
				pn(txt:center(txt:em(v[1] or '')))
			else
				pn(txt:center(v[1] or ''))
			end
		end
	end;
}

global 'ontitles' (false)
local activated
room {
	title = false;
	nam = 'black';
	onenter = function()
		theme.set('scr.gfx.bg', '')
		theme.set('scr.col.bg', 'black')
		theme.set('menu.button.x', w)
		timer:set(1000)
	end;
	timer = function(s)
		if activated then
			return false
		end
		activated = true
		timer:set(30)
		sprite.direct(true)
		sprite.scr():fill 'black'
		return false
	end;
}

function end_titles()
	offset = 0
	ontitles = true
	if not sprite.direct(true) then
		timer:stop()
		instead.fading = 32
		walk ('legacy_titles', false)
		return
	end
	sprite.direct(false)
	instead.fading = 32
{'fraction_non_alphanumeric': 0.20227272727272727, 'fraction_numerical': 0.019318181818181818, 'mean_word_length': 2.7551194539249146, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5365759', 'n_tokens_mistral': 2116, 'n_tokens_neox': 1959, 'n_words': 450}