38 lines
1.1 KiB
Lua
38 lines
1.1 KiB
Lua
to_write = ""
|
|
|
|
current = 0
|
|
for i = 0, 9999, 1 do
|
|
file = io.open("../up-editor/screens/"..i..".scr")
|
|
if file then
|
|
file_content = file:read()
|
|
formated_file = ""
|
|
for j = 1, #file_content, 1 do
|
|
if j == 1 then
|
|
formated_file = formated_file.."-----------------------------"
|
|
end
|
|
formated_file = formated_file..file_content:sub(j, j)
|
|
if j % 26 == 0 then formated_file = formated_file.."--" end
|
|
if j == 390 then
|
|
formated_file = formated_file.."---------------------------"
|
|
end
|
|
end
|
|
file:close()
|
|
to_write = to_write.." case "..i..":\n memcpy(level, \""..
|
|
formated_file.."\", "..#formated_file..");\n"
|
|
if string.find(file_content, 'c') then
|
|
to_write = to_write.." *coin_id = "..current..";\n"
|
|
end
|
|
to_write = to_write.." break;\n"
|
|
current = current + 1
|
|
end
|
|
end
|
|
|
|
--finish and write
|
|
to_write = [[#include "levels.h"
|
|
#include <gint/std/string.h>
|
|
void set_level(int level_id, char level[], unsigned int *coin_id) {
|
|
switch (level_id)
|
|
{
|
|
]]..to_write.." }\n}\n"
|
|
io.write(to_write)
|