2020-02-13 09:12:34 +01:00
|
|
|
-- . air
|
|
|
|
-- 0 solid
|
|
|
|
-- - placeholder tile
|
|
|
|
-- v spike
|
2020-02-13 10:12:04 +01:00
|
|
|
-- ^ elevator
|
2020-02-17 15:47:02 +01:00
|
|
|
-- ~ ice
|
2020-02-17 16:10:41 +01:00
|
|
|
-- # glue
|
2020-02-14 11:10:06 +01:00
|
|
|
-- j jump upgrade
|
2020-02-21 15:27:56 +01:00
|
|
|
-- c coin
|
2020-02-14 11:10:06 +01:00
|
|
|
--
|
|
|
|
-- level id format : YYXX with YY and XX being the Y and X position on the map
|
2020-02-13 09:12:34 +01:00
|
|
|
|
2020-02-20 12:22:38 +01:00
|
|
|
levels = {[5050] = [[
|
2020-02-13 09:12:34 +01:00
|
|
|
----------------------------
|
2020-02-14 14:54:00 +01:00
|
|
|
-0000000....000000000000000-
|
|
|
|
-0000000....000000000000000-
|
2020-02-20 12:22:38 +01:00
|
|
|
-00000000....00000.........-
|
2020-02-14 11:10:06 +01:00
|
|
|
-00000000..................-
|
2020-02-20 12:22:38 +01:00
|
|
|
-00000000...........0000000-
|
2020-02-18 11:48:02 +01:00
|
|
|
-0000000000.....00000000000-
|
2020-02-13 09:12:34 +01:00
|
|
|
-0000000000.....00000000000-
|
2020-02-20 12:22:38 +01:00
|
|
|
-00000000...........0000000-
|
|
|
|
-00000..............0000000-
|
2020-02-14 11:10:06 +01:00
|
|
|
-.............0000000000000-
|
2020-02-13 09:12:34 +01:00
|
|
|
-..........0000000000000000-
|
2020-02-20 12:22:38 +01:00
|
|
|
-00000000000000000000000000-
|
2020-02-18 11:48:02 +01:00
|
|
|
-00000000000000000000000000-
|
2020-02-13 09:12:34 +01:00
|
|
|
-00000000000000000000000000-
|
|
|
|
-00000000000000000000000000-
|
|
|
|
----------------------------
|
|
|
|
]],
|
2020-02-20 12:22:38 +01:00
|
|
|
[5049] = [[
|
2020-02-13 10:43:45 +01:00
|
|
|
----------------------------
|
|
|
|
-00000000000000000000000000-
|
|
|
|
-00000000000000000000000000-
|
2020-02-18 11:48:02 +01:00
|
|
|
-00......................00-
|
|
|
|
-00......................00-
|
2020-02-13 10:43:45 +01:00
|
|
|
-00......................00-
|
2020-02-20 12:22:38 +01:00
|
|
|
-00......................00-
|
|
|
|
-00......................00-
|
|
|
|
-........................00-
|
|
|
|
-........................00-
|
|
|
|
-00........................-
|
|
|
|
-000.......................-
|
|
|
|
-000.0000000000000000000000-
|
|
|
|
-..........0000000000000000-
|
|
|
|
-00000000..0000000000000000-
|
|
|
|
-00000000..0000000000000000-
|
2020-02-13 10:43:45 +01:00
|
|
|
----------------------------
|
|
|
|
]],
|
2020-02-20 12:22:38 +01:00
|
|
|
[5048] = [[
|
2020-02-14 11:10:06 +01:00
|
|
|
----------------------------
|
|
|
|
-00000000000000000000000000-
|
|
|
|
-00000000000000000000000000-
|
2020-02-20 12:22:38 +01:00
|
|
|
-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-
|
2020-02-19 13:16:20 +01:00
|
|
|
----------------------------
|
|
|
|
]],
|
2020-02-20 12:22:38 +01:00
|
|
|
[5148] = [[
|
2020-02-19 13:16:20 +01:00
|
|
|
----------------------------
|
2020-02-20 12:22:38 +01:00
|
|
|
-000000000000000000000.0000-
|
|
|
|
-000000000000000000000.....-
|
|
|
|
-00..................000000-
|
|
|
|
-00......................00-
|
|
|
|
-00......................00-
|
2020-02-14 11:10:06 +01:00
|
|
|
-00......................00-
|
|
|
|
-00......................00-
|
|
|
|
-00......................00-
|
|
|
|
-00......................00-
|
2020-02-20 12:22:38 +01: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-
|
2020-02-19 13:16:20 +01:00
|
|
|
-00000000000000000000000000-
|
|
|
|
-00000000000000000000000000-
|
2020-02-14 11:10:06 +01:00
|
|
|
----------------------------
|
|
|
|
]],
|
|
|
|
[0] = [[
|
2020-02-13 10:43:45 +01:00
|
|
|
----------------------------
|
|
|
|
-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-
|
|
|
|
----------------------------
|
|
|
|
]],
|
2020-02-11 11:44:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
to_write = ""
|
|
|
|
|
|
|
|
--remove all "\n" from level strings
|
2020-02-20 12:22:38 +01:00
|
|
|
current = 0
|
2020-02-14 11:10:06 +01:00
|
|
|
for i, v in pairs(levels) do
|
2020-02-11 11:44:37 +01:00
|
|
|
v = string.gsub(v, "\n", "")
|
2020-02-20 12:22:38 +01:00
|
|
|
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
|
2020-02-11 11:44:37 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
--finish and write
|
|
|
|
to_write = [[#include "levels.h"
|
2020-02-11 13:55:57 +01:00
|
|
|
#include <gint/std/string.h>
|
2020-02-20 12:22:38 +01:00
|
|
|
void set_level(int level_id, char level[], unsigned int *coin_id) {
|
2020-02-11 11:44:37 +01:00
|
|
|
switch (level_id)
|
|
|
|
{
|
2020-02-13 09:12:34 +01:00
|
|
|
]]..to_write.." }\n}\n"
|
2020-02-11 11:44:37 +01:00
|
|
|
io.write(to_write)
|