150 lines
3.8 KiB
Lua
150 lines
3.8 KiB
Lua
-- . air
|
|
-- 0 solid
|
|
-- - placeholder tile
|
|
-- v spike
|
|
-- ^ elevator
|
|
-- ~ ice
|
|
-- # glue
|
|
-- j jump upgrade
|
|
--
|
|
-- level id format : YYXX with YY and XX being the Y and X position on the map
|
|
|
|
levels = {[5050] = [[
|
|
----------------------------
|
|
-0000000....000000000000000-
|
|
-0000000....000000000000000-
|
|
-00000000....00000.........-
|
|
-00000000..................-
|
|
-00000000...........0000000-
|
|
-0000000000.....00000000000-
|
|
-0000000000.....00000000000-
|
|
-00000000...........0000000-
|
|
-00000..............0000000-
|
|
-.............0000000000000-
|
|
-..........0000000000000000-
|
|
-00000000000000000000000000-
|
|
-00000000000000000000000000-
|
|
-00000000000000000000000000-
|
|
-00000000000000000000000000-
|
|
----------------------------
|
|
]],
|
|
[5049] = [[
|
|
----------------------------
|
|
-00000000000000000000000000-
|
|
-00000000000000000000000000-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00......................00-
|
|
-........................00-
|
|
-........................00-
|
|
-00........................-
|
|
-000.......................-
|
|
-000.0000000000000000000000-
|
|
-..........0000000000000000-
|
|
-00000000..0000000000000000-
|
|
-00000000..0000000000000000-
|
|
----------------------------
|
|
]],
|
|
[5048] = [[
|
|
----------------------------
|
|
-00000000000000000000000000-
|
|
-00000000000000000000000000-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00........................-
|
|
-00........................-
|
|
-00.................0000000-
|
|
-00.................0000000-
|
|
-00.................0000000-
|
|
-00.................00..c..-
|
|
-000000000000000000000.0000-
|
|
-000000000000000000000.0000-
|
|
----------------------------
|
|
]],
|
|
[5148] = [[
|
|
----------------------------
|
|
-000000000000000000000.0000-
|
|
-000000000000000000000.....-
|
|
-00..................000000-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00000000000000000000000000-
|
|
-00000000000000000000000000-
|
|
----------------------------
|
|
]],
|
|
[5149] = [[
|
|
----------------------------
|
|
-00000000..0000000000000000-
|
|
-...00000..0000000000000000-
|
|
-00......................00-
|
|
-00......................00-
|
|
-0000000000000000..vv000000-
|
|
-0000000000000000...0000000-
|
|
-00000......0000.......0000-
|
|
-000.........00....00...000-
|
|
-00^.........00.........000-
|
|
-00^.j................00000-
|
|
-00^....................000-
|
|
-00^.........0^.........000-
|
|
-0000^.......0^.......00000-
|
|
-00000000000000000000000000-
|
|
-00000000000000000000000000-
|
|
----------------------------
|
|
]],
|
|
[0] = [[
|
|
----------------------------
|
|
-00000000000000000000000000-
|
|
-00000000000000000000000000-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00......................00-
|
|
-00000000000000000000000000-
|
|
-00000000000000000000000000-
|
|
----------------------------
|
|
]],
|
|
}
|
|
|
|
to_write = ""
|
|
|
|
--remove all "\n" from level strings
|
|
current = 0
|
|
for i, v in pairs(levels) do
|
|
v = string.gsub(v, "\n", "")
|
|
to_write = to_write.." case "..i..":\n memcpy(level, \""..v.."\", "..#v..");\n"
|
|
if string.find(v, 'c') then
|
|
to_write = to_write.." *coin_id = "..current..";\n"
|
|
end
|
|
to_write = to_write.." break;\n"
|
|
current = current + 1
|
|
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)
|