use get_tile function, format maps

Signed-off-by: Xe Iaso <me@christine.website>
This commit is contained in:
Cadey Ratio 2022-07-02 09:58:27 -04:00
parent 4bc7b5b123
commit 243fbb0584
5 changed files with 228 additions and 234 deletions

View File

@ -5,14 +5,17 @@ fn mapgen(b: *std.build.Step) !void {
var alloc = std.heap.page_allocator; var alloc = std.heap.page_allocator;
const maps = [_][2][]const u8{ const maps = [_][2][]const u8{
[2][]const u8{"./maps/dungeon.json", "./src/maps/dungeon.zig"}, [2][]const u8{ "./maps/dungeon.json", "./src/maps/dungeon.zig" },
[2][]const u8{"./maps/RPGmap.json", "./src/maps/overworld.zig"}, [2][]const u8{ "./maps/RPGmap.json", "./src/maps/overworld.zig" },
}; };
for (&maps) |map| { for (&maps) |map| {
var deno = std.ChildProcess.init(&.{"deno", "run", "-A", "./src/tools/genmap.js", map[0], map[1]}, alloc); var deno = std.ChildProcess.init(&.{ "deno", "run", "-A", "./src/tools/genmap.js", map[0], map[1] }, alloc);
try deno.spawn(); try deno.spawn();
_ = try deno.wait(); _ = try deno.wait();
var zig = std.ChildProcess.init(&.{ "zig", "fmt", map[1] }, alloc);
try zig.spawn();
_ = try zig.wait();
std.log.info("generated map {s}", .{map[1]}); std.log.info("generated map {s}", .{map[1]});
} }
@ -22,7 +25,7 @@ fn release(b: *std.build.Step) !void {
_ = b; _ = b;
var alloc = std.heap.page_allocator; var alloc = std.heap.page_allocator;
var rel = std.ChildProcess.init(&.{"bash", "./release.sh"}, alloc); var rel = std.ChildProcess.init(&.{ "bash", "./release.sh" }, alloc);
try rel.spawn(); try rel.spawn();
_ = try rel.wait(); _ = try rel.wait();
@ -32,7 +35,7 @@ fn release(b: *std.build.Step) !void {
pub fn build(b: *std.build.Builder) !void { pub fn build(b: *std.build.Builder) !void {
const map_step = b.step("mapgen", "Generate maps from Tiled JSON"); const map_step = b.step("mapgen", "Generate maps from Tiled JSON");
map_step.makeFn = mapgen; map_step.makeFn = mapgen;
const release_step = b.step("release", "Generate release binaries"); const release_step = b.step("release", "Generate release binaries");
release_step.makeFn = release; release_step.makeFn = release;
release_step.dependOn(map_step); release_step.dependOn(map_step);

View File

@ -120,7 +120,7 @@ fn drawMap() !void {
while (row < endRow) { while (row < endRow) {
defer row += 1; defer row += 1;
var tile = map.data[@intCast(u32, col) * map.width + @intCast(u32, row)]; var tile = map.get_tile(@intCast(u32, col), @intCast(u32, row));
var x = (row - startCol) * tile_size - offsetX; var x = (row - startCol) * tile_size - offsetX;
var y = (col - startRow) * tile_size - offsetY; var y = (col - startRow) * tile_size - offsetY;

View File

@ -10,63 +10,61 @@ const Rect = sh0rk.Rect;
pub const width = 20; pub const width = 20;
pub const height = 20; pub const height = 20;
pub fn get_tile(x: u32, y: u32) u9 {
return data[x * height + y];
}
pub const tileset: Tileset = .Dungeon; pub const tileset: Tileset = .Dungeon;
pub const ts_width = 14; pub const ts_width = 14;
pub const ts_height = 13; pub const ts_height = 13;
pub const data = [400]u9{ pub const data = [400]u9{
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 58, 59, 71, 59, 18, 59,
43, 43, 43, 58, 59, 71, 59, 18, 59, 18, 18, 15, 16, 17, 59, 76, 43, 43, 43, 43, 43,
15, 16, 17, 59, 76, 43, 43, 43, 43, 43, 43, 43, 43, 72, 79, 32, 73, 32, 73, 32, 29,
43, 43, 43, 72, 79, 32, 73, 32, 73, 32, 30, 31, 57, 90, 43, 43, 43, 43, 43, 43, 43,
29, 30, 31, 57, 90, 43, 43, 43, 43, 43, 43, 105, 106, 105, 106, 105, 106, 105, 106, 105, 106,
43, 43, 43, 105, 106, 105, 106, 105, 106, 105, 105, 106, 43, 43, 43, 43, 43, 43, 43, 43, 117,
106, 105, 106, 105, 106, 43, 43, 43, 43, 43, 118, 117, 118, 117, 118, 117, 118, 117, 118, 117, 118,
43, 43, 43, 117, 118, 117, 118, 117, 118, 117, 43, 43, 43, 43, 43, 43, 43, 43, 131, 132, 103,
118, 117, 118, 117, 118, 43, 43, 43, 43, 43, 104, 103, 104, 103, 104, 103, 104, 103, 104, 43, 43,
43, 43, 43, 131, 132, 103, 104, 103, 104, 103, 43, 43, 43, 43, 43, 43, 145, 146, 117, 118, 117,
104, 103, 104, 103, 104, 43, 43, 43, 43, 43, 118, 117, 118, 117, 118, 117, 118, 43, 43, 43, 43,
43, 43, 43, 145, 146, 117, 118, 117, 118, 117, 43, 43, 43, 43, 105, 106, 103, 104, 103, 104, 103,
118, 117, 118, 117, 118, 43, 43, 43, 43, 43, 104, 103, 104, 103, 104, 43, 43, 43, 43, 43, 43,
43, 43, 43, 105, 106, 103, 104, 103, 104, 103, 43, 43, 117, 118, 117, 118, 117, 118, 117, 118, 117,
104, 103, 104, 103, 104, 43, 43, 43, 43, 43, 118, 137, 138, 43, 43, 43, 43, 43, 43, 43, 43,
43, 43, 43, 117, 118, 117, 118, 117, 118, 117, 103, 104, 103, 104, 103, 104, 103, 104, 103, 104, 151,
118, 117, 118, 137, 138, 43, 43, 43, 43, 43, 152, 43, 43, 43, 43, 43, 43, 43, 43, 117, 118,
43, 43, 43, 103, 104, 103, 104, 103, 104, 103, 117, 118, 117, 118, 117, 118, 117, 118, 117, 118, 43,
104, 103, 104, 151, 152, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 93, 94, 121, 94,
43, 43, 43, 117, 118, 117, 118, 117, 118, 117, 121, 94, 121, 94, 121, 94, 121, 94, 43, 43, 43,
118, 117, 118, 117, 118, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 107, 108, 108, 108, 108, 108,
43, 43, 43, 93, 94, 121, 94, 121, 94, 121, 108, 108, 108, 108, 108, 108, 43, 43, 43, 43, 43,
94, 121, 94, 121, 94, 43, 43, 43, 43, 43, 43, 43, 43, 123, 122, 123, 122, 123, 122, 123, 122,
43, 43, 43, 107, 108, 108, 108, 108, 108, 108, 123, 122, 122, 123, 43, 43, 43, 43, 43, 43, 43,
108, 108, 108, 108, 108, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
43, 43, 43, 123, 122, 123, 122, 123, 122, 123, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
122, 123, 122, 122, 123, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
43, 43, 43, 43, 43, 43, 43, 43, 43,
}; };
pub const coll = [_]Rect{ pub const coll = [_]Rect{
Rect{.base = Point{.x = 0, .y = 0}, .width = 159, .height = 54}, Rect{ .base = Point{ .x = 0, .y = 0 }, .width = 159, .height = 54 },
Rect{.base = Point{.x = 0, .y = 55}, .width = 31, .height = 104}, Rect{ .base = Point{ .x = 0, .y = 55 }, .width = 31, .height = 104 },
Rect{.base = Point{.x = 32, .y = 121}, .width = 95, .height = 39}, Rect{ .base = Point{ .x = 32, .y = 121 }, .width = 95, .height = 39 },
Rect{.base = Point{.x = 127, .y = 55}, .width = 32, .height = 105}, Rect{ .base = Point{ .x = 127, .y = 55 }, .width = 32, .height = 105 },
Rect{.base = Point{.x = 112, .y = 98}, .width = 15, .height = 14}, Rect{ .base = Point{ .x = 112, .y = 98 }, .width = 15, .height = 14 },
}; };
pub const start_point = Point{ .x = 40, .y = 73 }; pub const start_point = Point{ .x = 40, .y = 73 };
pub const triggers = [_]Trigger{ pub const triggers = [_]Trigger{};
};

View File

@ -10,197 +10,185 @@ const Rect = sh0rk.Rect;
pub const width = 40; pub const width = 40;
pub const height = 40; pub const height = 40;
pub fn get_tile(x: u32, y: u32) u9 {
return data[x * height + y];
}
pub const tileset: Tileset = .Rpg; pub const tileset: Tileset = .Rpg;
pub const ts_width = 34; pub const ts_width = 34;
pub const ts_height = 16; pub const ts_height = 16;
pub const data = [1600]u9{ pub const data = [1600]u9{
1, 2, 39, 40, 1, 2, 137, 138, 1, 2, 71, 1, 2, 39, 40, 1, 2, 137, 138, 1, 2, 71,
72, 73, 74, 75, 76, 1, 2, 137, 138, 1, 72, 73, 74, 75, 76, 1, 2, 137, 138, 1, 2,
2, 137, 138, 1, 2, 137, 138, 1, 2, 137, 137, 138, 1, 2, 137, 138, 1, 2, 137, 138, 1,
138, 1, 2, 137, 138, 1, 2, 137, 138, 35, 2, 137, 138, 1, 2, 137, 138, 35, 36, 73, 74,
36, 73, 74, 35, 36, 171, 172, 35, 36, 105, 35, 36, 171, 172, 35, 36, 105, 106, 107, 108, 109,
106, 107, 108, 109, 110, 35, 39, 40, 172, 35, 110, 35, 39, 40, 172, 35, 36, 171, 172, 35, 36,
36, 171, 172, 35, 36, 171, 172, 35, 36, 171, 171, 172, 35, 36, 171, 172, 35, 36, 171, 172, 35,
172, 35, 36, 171, 172, 35, 36, 171, 172, 69, 36, 171, 172, 69, 70, 205, 206, 69, 70, 205, 206,
70, 205, 206, 69, 70, 205, 206, 69, 70, 139, 69, 70, 139, 140, 207, 208, 143, 144, 69, 73, 74,
140, 207, 208, 143, 144, 69, 73, 74, 206, 69, 206, 69, 70, 205, 206, 69, 70, 205, 206, 69, 70,
70, 205, 206, 69, 70, 205, 206, 69, 70, 205, 205, 206, 69, 70, 205, 206, 69, 70, 205, 206, 103,
206, 69, 70, 205, 206, 69, 70, 205, 206, 103, 104, 239, 240, 103, 104, 239, 240, 103, 104, 173, 174,
104, 239, 240, 103, 104, 239, 240, 103, 104, 173, 241, 242, 177, 178, 103, 104, 239, 240, 103, 104, 239,
174, 241, 242, 177, 178, 103, 104, 239, 240, 103, 240, 103, 104, 239, 240, 103, 104, 239, 240, 103, 104,
104, 239, 240, 103, 104, 239, 240, 103, 104, 239, 239, 240, 103, 104, 239, 240, 137, 138, 137, 138, 307,
240, 103, 104, 239, 240, 103, 104, 239, 240, 137, 274, 137, 138, 341, 342, 345, 346, 411, 412, 137, 138,
138, 137, 138, 307, 274, 137, 138, 341, 342, 345, 1, 2, 33, 34, 1, 2, 137, 138, 1, 2, 137,
346, 411, 412, 137, 138, 1, 2, 33, 34, 1, 138, 1, 2, 137, 138, 1, 2, 137, 138, 1, 2,
2, 137, 138, 1, 2, 137, 138, 1, 2, 137, 137, 138, 171, 172, 171, 172, 307, 307, 171, 172, 375,
138, 1, 2, 137, 138, 1, 2, 137, 138, 171, 376, 379, 380, 445, 446, 171, 172, 35, 36, 67, 68,
172, 171, 172, 307, 307, 171, 172, 375, 376, 379, 35, 36, 171, 172, 35, 36, 171, 172, 35, 36, 171,
380, 445, 446, 171, 172, 35, 36, 67, 68, 35, 172, 35, 36, 171, 172, 35, 36, 171, 172, 205, 206,
36, 171, 172, 35, 36, 171, 172, 35, 36, 171, 205, 206, 69, 70, 205, 206, 413, 414, 39, 40, 69,
172, 35, 36, 171, 172, 35, 36, 171, 172, 205, 70, 205, 206, 69, 70, 205, 206, 69, 70, 205, 206,
206, 205, 206, 69, 70, 205, 206, 413, 414, 39, 69, 70, 205, 206, 69, 70, 205, 206, 69, 70, 205,
40, 69, 70, 205, 206, 69, 70, 205, 206, 69, 206, 69, 70, 205, 206, 239, 240, 239, 240, 103, 104,
70, 205, 206, 69, 70, 205, 206, 69, 70, 205, 39, 40, 447, 448, 73, 74, 307, 104, 239, 274, 103,
206, 69, 70, 205, 206, 69, 70, 205, 206, 239, 104, 239, 240, 103, 104, 239, 240, 103, 104, 239, 240,
240, 239, 240, 103, 104, 39, 40, 447, 448, 73, 103, 104, 239, 240, 103, 104, 239, 240, 103, 104, 239,
74, 307, 104, 239, 274, 103, 104, 239, 240, 103, 240, 1, 2, 137, 307, 1, 2, 73, 74, 413, 414,
104, 239, 240, 103, 104, 239, 240, 103, 104, 239, 137, 39, 40, 2, 137, 138, 1, 2, 137, 138, 1,
240, 103, 104, 239, 240, 103, 104, 239, 240, 1, 2, 137, 138, 1, 2, 137, 138, 1, 2, 137, 138,
2, 137, 307, 1, 2, 73, 74, 413, 414, 137, 1, 2, 137, 138, 1, 2, 137, 138, 35, 36, 171,
39, 40, 2, 137, 138, 1, 2, 137, 138, 1, 172, 35, 36, 171, 172, 447, 448, 171, 73, 74, 36,
2, 137, 138, 1, 2, 137, 138, 1, 2, 137, 171, 172, 331, 332, 171, 172, 35, 36, 171, 172, 35,
138, 1, 2, 137, 138, 1, 2, 137, 138, 35, 36, 171, 172, 35, 36, 171, 172, 35, 36, 171, 172,
36, 171, 172, 35, 36, 171, 172, 447, 448, 171, 35, 36, 171, 172, 69, 70, 205, 206, 69, 70, 274,
73, 74, 36, 171, 172, 331, 332, 171, 172, 35, 206, 413, 414, 235, 236, 233, 234, 205, 364, 365, 366,
36, 171, 172, 35, 36, 171, 172, 35, 36, 171, 367, 206, 69, 70, 205, 206, 69, 70, 205, 206, 69,
172, 35, 36, 171, 172, 35, 36, 171, 172, 69, 70, 205, 206, 69, 70, 205, 206, 69, 70, 205, 206,
70, 205, 206, 69, 70, 274, 206, 413, 414, 235, 103, 104, 239, 240, 39, 40, 239, 240, 447, 448, 269,
236, 233, 234, 205, 364, 365, 366, 367, 206, 69, 270, 267, 268, 397, 398, 399, 400, 401, 402, 103, 104,
70, 205, 206, 69, 70, 205, 206, 69, 70, 205, 239, 240, 103, 104, 239, 240, 103, 104, 239, 240, 103,
206, 69, 70, 205, 206, 69, 70, 205, 206, 103, 104, 239, 240, 103, 104, 239, 240, 1, 2, 237, 238,
104, 239, 240, 39, 40, 239, 240, 447, 448, 269, 73, 74, 137, 138, 413, 414, 233, 234, 235, 236, 431,
270, 267, 268, 397, 398, 399, 400, 401, 402, 103, 432, 433, 434, 435, 436, 1, 2, 137, 138, 1, 2,
104, 239, 240, 103, 104, 239, 240, 103, 104, 239, 137, 138, 1, 2, 137, 138, 1, 2, 137, 138, 1,
240, 103, 104, 239, 240, 103, 104, 239, 240, 1, 2, 137, 138, 35, 36, 271, 272, 35, 353, 354, 172,
2, 237, 238, 73, 74, 137, 138, 413, 414, 233, 447, 448, 267, 268, 269, 270, 465, 466, 467, 468, 469,
234, 235, 236, 431, 432, 433, 434, 435, 436, 1, 470, 35, 36, 171, 172, 35, 36, 171, 172, 35, 36,
2, 137, 138, 1, 2, 137, 138, 1, 2, 137, 171, 172, 35, 36, 171, 172, 35, 36, 171, 172, 69,
138, 1, 2, 137, 138, 1, 2, 137, 138, 35, 70, 351, 352, 69, 387, 388, 206, 347, 348, 349, 350,
36, 271, 272, 35, 353, 354, 172, 447, 448, 267, 343, 344, 499, 500, 439, 440, 503, 504, 69, 70, 205,
268, 269, 270, 465, 466, 467, 468, 469, 470, 35, 206, 69, 70, 205, 206, 69, 70, 205, 206, 69, 70,
36, 171, 172, 35, 36, 171, 172, 35, 36, 171, 205, 206, 69, 70, 205, 206, 103, 104, 385, 386, 103,
172, 35, 36, 171, 172, 35, 36, 171, 172, 69, 104, 239, 240, 381, 121, 121, 121, 121, 378, 403, 404,
70, 351, 352, 69, 387, 388, 206, 347, 348, 349, 473, 474, 405, 406, 103, 104, 239, 240, 103, 104, 239,
350, 343, 344, 499, 500, 439, 440, 503, 504, 69, 240, 103, 104, 239, 240, 103, 104, 239, 240, 103, 104,
70, 205, 206, 69, 70, 205, 206, 69, 70, 205, 239, 240, 1, 2, 409, 410, 345, 346, 345, 346, 417,
206, 69, 70, 205, 206, 69, 70, 205, 206, 103, 121, 121, 121, 121, 418, 345, 346, 417, 418, 345, 346,
104, 385, 386, 103, 104, 239, 240, 381, 121, 121, 345, 346, 345, 346, 345, 346, 345, 346, 345, 346, 345,
121, 121, 378, 403, 404, 473, 474, 405, 406, 103, 346, 345, 346, 345, 346, 345, 346, 345, 346, 35, 36,
104, 239, 240, 103, 104, 239, 240, 103, 104, 239, 443, 444, 379, 380, 379, 380, 451, 452, 451, 452, 451,
240, 103, 104, 239, 240, 103, 104, 239, 240, 1, 452, 379, 380, 451, 452, 379, 380, 379, 380, 379, 380,
2, 409, 410, 345, 346, 345, 346, 417, 121, 121, 379, 380, 379, 380, 379, 380, 379, 380, 379, 380, 379,
121, 121, 418, 345, 346, 417, 418, 345, 346, 345, 380, 379, 380, 379, 380, 69, 57, 58, 206, 69, 70,
346, 345, 346, 345, 346, 345, 346, 345, 346, 345, 205, 206, 69, 307, 205, 206, 69, 70, 205, 206, 39,
346, 345, 346, 345, 346, 345, 346, 345, 346, 35, 40, 205, 206, 69, 70, 205, 206, 69, 70, 205, 206,
36, 443, 444, 379, 380, 379, 380, 451, 452, 451, 69, 70, 205, 206, 69, 70, 205, 206, 69, 70, 205,
452, 451, 452, 379, 380, 451, 452, 379, 380, 379, 206, 90, 91, 92, 93, 57, 58, 57, 58, 103, 104,
380, 379, 380, 379, 380, 379, 380, 379, 380, 379, 239, 240, 103, 104, 239, 240, 73, 74, 239, 240, 103,
380, 379, 380, 379, 380, 379, 380, 379, 380, 69, 104, 239, 240, 103, 104, 239, 240, 103, 104, 239, 240,
57, 58, 206, 69, 70, 205, 206, 69, 307, 205, 103, 104, 239, 240, 103, 104, 239, 240, 91, 92, 91,
206, 69, 70, 205, 206, 39, 40, 205, 206, 69, 92, 91, 92, 91, 92, 93, 21, 137, 138, 1, 2,
70, 205, 206, 69, 70, 205, 206, 69, 70, 205, 137, 138, 1, 2, 137, 138, 1, 2, 137, 138, 1,
206, 69, 70, 205, 206, 69, 70, 205, 206, 90, 2, 137, 138, 1, 2, 137, 138, 1, 2, 137, 138,
91, 92, 93, 57, 58, 57, 58, 103, 104, 239, 1, 2, 137, 138, 125, 126, 125, 126, 125, 126, 125,
240, 103, 104, 239, 240, 73, 74, 239, 240, 103, 126, 127, 94, 171, 172, 35, 36, 171, 172, 35, 36,
104, 239, 240, 103, 104, 239, 240, 103, 104, 239, 171, 172, 35, 36, 171, 172, 35, 36, 171, 172, 35,
240, 103, 104, 239, 240, 103, 104, 239, 240, 91, 36, 171, 172, 35, 36, 171, 172, 35, 36, 171, 172,
92, 91, 92, 91, 92, 91, 92, 93, 21, 137, 159, 160, 159, 160, 159, 160, 159, 160, 70, 26, 205,
138, 1, 2, 137, 138, 1, 2, 137, 138, 1, 206, 69, 70, 205, 206, 69, 70, 205, 206, 69, 70,
2, 137, 138, 1, 2, 137, 138, 1, 2, 137, 205, 206, 69, 70, 205, 206, 69, 70, 205, 206, 69,
138, 1, 2, 137, 138, 1, 2, 137, 138, 125, 70, 205, 206, 69, 70, 205, 206, 103, 104, 239, 240,
126, 125, 126, 125, 126, 125, 126, 127, 94, 171, 103, 104, 239, 240, 103, 104, 239, 240, 103, 104, 239,
172, 35, 36, 171, 172, 35, 36, 171, 172, 35, 240, 103, 104, 239, 240, 103, 104, 239, 240, 103, 104,
36, 171, 172, 35, 36, 171, 172, 35, 36, 171, 239, 240, 103, 104, 239, 240, 103, 104, 239, 240, 103,
172, 35, 36, 171, 172, 35, 36, 171, 172, 159, 104, 239, 240, 1, 2, 137, 138, 1, 2, 137, 138,
160, 159, 160, 159, 160, 159, 160, 70, 26, 205, 1, 2, 137, 138, 1, 2, 137, 138, 1, 2, 137,
206, 69, 70, 205, 206, 69, 70, 205, 206, 69, 138, 1, 2, 137, 138, 1, 2, 137, 138, 1, 2,
70, 205, 206, 69, 70, 205, 206, 69, 70, 205, 137, 138, 1, 2, 137, 138, 1, 2, 137, 138, 35,
206, 69, 70, 205, 206, 69, 70, 205, 206, 103, 36, 171, 172, 35, 36, 171, 172, 35, 36, 171, 172,
104, 239, 240, 103, 104, 239, 240, 103, 104, 239, 35, 36, 171, 172, 35, 36, 171, 172, 35, 36, 171,
240, 103, 104, 239, 240, 103, 104, 239, 240, 103, 172, 35, 36, 171, 172, 35, 36, 171, 172, 35, 36,
104, 239, 240, 103, 104, 239, 240, 103, 104, 239, 171, 172, 35, 36, 171, 172, 69, 70, 205, 206, 69,
240, 103, 104, 239, 240, 103, 104, 239, 240, 1, 70, 205, 206, 69, 70, 205, 206, 69, 70, 205, 206,
2, 137, 138, 1, 2, 137, 138, 1, 2, 137, 69, 70, 205, 206, 69, 70, 205, 206, 69, 70, 205,
138, 1, 2, 137, 138, 1, 2, 137, 138, 1, 206, 69, 70, 205, 206, 69, 70, 205, 206, 69, 70,
2, 137, 138, 1, 2, 137, 138, 1, 2, 137, 205, 206, 103, 104, 239, 240, 103, 104, 239, 240, 103,
138, 1, 2, 137, 138, 1, 2, 137, 138, 35, 104, 239, 240, 103, 104, 239, 240, 103, 104, 239, 240,
36, 171, 172, 35, 36, 171, 172, 35, 36, 171, 103, 104, 239, 240, 103, 104, 239, 240, 103, 104, 239,
172, 35, 36, 171, 172, 35, 36, 171, 172, 35, 240, 103, 104, 239, 240, 103, 104, 239, 240, 1, 2,
36, 171, 172, 35, 36, 171, 172, 35, 36, 171, 137, 138, 1, 2, 137, 138, 1, 2, 137, 138, 1,
172, 35, 36, 171, 172, 35, 36, 171, 172, 69, 2, 137, 138, 1, 2, 137, 138, 1, 2, 137, 138,
70, 205, 206, 69, 70, 205, 206, 69, 70, 205, 1, 2, 137, 138, 1, 2, 137, 138, 1, 2, 137,
206, 69, 70, 205, 206, 69, 70, 205, 206, 69, 138, 1, 2, 137, 138, 35, 36, 171, 172, 35, 36,
70, 205, 206, 69, 70, 205, 206, 69, 70, 205, 171, 172, 35, 36, 171, 172, 35, 36, 171, 172, 35,
206, 69, 70, 205, 206, 69, 70, 205, 206, 103, 36, 171, 172, 35, 36, 171, 172, 35, 36, 171, 172,
104, 239, 240, 103, 104, 239, 240, 103, 104, 239, 35, 36, 171, 172, 35, 36, 171, 172, 35, 36, 171,
240, 103, 104, 239, 240, 103, 104, 239, 240, 103, 172, 69, 70, 205, 206, 69, 70, 205, 206, 69, 70,
104, 239, 240, 103, 104, 239, 240, 103, 104, 239, 205, 206, 69, 70, 205, 206, 69, 70, 205, 206, 69,
240, 103, 104, 239, 240, 103, 104, 239, 240, 1, 70, 205, 206, 69, 70, 205, 206, 69, 70, 205, 206,
2, 137, 138, 1, 2, 137, 138, 1, 2, 137, 69, 70, 205, 206, 69, 70, 205, 206, 103, 104, 239,
138, 1, 2, 137, 138, 1, 2, 137, 138, 1, 240, 103, 104, 239, 240, 103, 104, 239, 240, 103, 104,
2, 137, 138, 1, 2, 137, 138, 1, 2, 137, 239, 240, 103, 104, 239, 240, 103, 104, 239, 240, 103,
138, 1, 2, 137, 138, 1, 2, 137, 138, 35, 104, 239, 240, 103, 104, 239, 240, 103, 104, 239, 240,
36, 171, 172, 35, 36, 171, 172, 35, 36, 171, 103, 104, 239, 240, 1, 2, 137, 138, 1, 2, 137,
172, 35, 36, 171, 172, 35, 36, 171, 172, 35, 138, 1, 2, 137, 138, 1, 2, 137, 138, 1, 2,
36, 171, 172, 35, 36, 171, 172, 35, 36, 171, 137, 138, 1, 2, 137, 138, 1, 2, 137, 138, 1,
172, 35, 36, 171, 172, 35, 36, 171, 172, 69, 2, 137, 138, 1, 2, 137, 138, 1, 2, 137, 138,
70, 205, 206, 69, 70, 205, 206, 69, 70, 205, 35, 36, 171, 172, 35, 36, 171, 172, 35, 36, 171,
206, 69, 70, 205, 206, 69, 70, 205, 206, 69, 172, 35, 36, 171, 172, 35, 36, 171, 172, 35, 36,
70, 205, 206, 69, 70, 205, 206, 69, 70, 205, 171, 172, 35, 36, 171, 172, 35, 36, 171, 172, 35,
206, 69, 70, 205, 206, 69, 70, 205, 206, 103, 36, 171, 172, 35, 36, 171, 172, 69, 70, 205, 206,
104, 239, 240, 103, 104, 239, 240, 103, 104, 239, 69, 70, 205, 206, 69, 70, 205, 206, 69, 70, 205,
240, 103, 104, 239, 240, 103, 104, 239, 240, 103, 206, 69, 70, 205, 206, 69, 70, 205, 206, 69, 70,
104, 239, 240, 103, 104, 239, 240, 103, 104, 239, 205, 206, 69, 70, 205, 206, 69, 70, 205, 206, 69,
240, 103, 104, 239, 240, 103, 104, 239, 240, 1, 70, 205, 206, 103, 104, 239, 240, 103, 104, 239, 240,
2, 137, 138, 1, 2, 137, 138, 1, 2, 137, 103, 104, 239, 240, 103, 104, 239, 240, 103, 104, 239,
138, 1, 2, 137, 138, 1, 2, 137, 138, 1, 240, 103, 104, 239, 240, 103, 104, 239, 240, 103, 104,
2, 137, 138, 1, 2, 137, 138, 1, 2, 137, 239, 240, 103, 104, 239, 240, 103, 104, 239, 240, 1,
138, 1, 2, 137, 138, 1, 2, 137, 138, 35, 2, 137, 138, 1, 2, 137, 138, 1, 2, 137, 138,
36, 171, 172, 35, 36, 171, 172, 35, 36, 171, 1, 2, 137, 138, 1, 2, 137, 138, 1, 2, 137,
172, 35, 36, 171, 172, 35, 36, 171, 172, 35, 138, 1, 2, 137, 138, 1, 2, 137, 138, 1, 2,
36, 171, 172, 35, 36, 171, 172, 35, 36, 171, 137, 138, 1, 2, 137, 138, 35, 36, 171, 172, 35,
172, 35, 36, 171, 172, 35, 36, 171, 172, 69, 36, 171, 172, 35, 36, 171, 172, 35, 36, 171, 172,
70, 205, 206, 69, 70, 205, 206, 69, 70, 205, 35, 36, 171, 172, 35, 36, 171, 172, 35, 36, 171,
206, 69, 70, 205, 206, 69, 70, 205, 206, 69, 172, 35, 36, 171, 172, 35, 36, 171, 172, 35, 36,
70, 205, 206, 69, 70, 205, 206, 69, 70, 205, 171, 172, 69, 70, 205, 206, 69, 70, 205, 206, 69,
206, 69, 70, 205, 206, 69, 70, 205, 206, 103, 70, 205, 206, 69, 70, 205, 206, 69, 70, 205, 206,
104, 239, 240, 103, 104, 239, 240, 103, 104, 239, 69, 70, 205, 206, 69, 70, 205, 206, 69, 70, 205,
240, 103, 104, 239, 240, 103, 104, 239, 240, 103, 206, 69, 70, 205, 206, 69, 70, 205, 206, 103, 104,
104, 239, 240, 103, 104, 239, 240, 103, 104, 239, 239, 240, 103, 104, 239, 240, 103, 104, 239, 240, 103,
240, 103, 104, 239, 240, 103, 104, 239, 240, 1, 104, 239, 240, 103, 104, 239, 240, 103, 104, 239, 240,
2, 137, 138, 1, 2, 137, 138, 1, 2, 137, 103, 104, 239, 240, 103, 104, 239, 240, 103, 104, 239,
138, 1, 2, 137, 138, 1, 2, 137, 138, 1, 240, 103, 104, 239, 240,
2, 137, 138, 1, 2, 137, 138, 1, 2, 137,
138, 1, 2, 137, 138, 1, 2, 137, 138, 35,
36, 171, 172, 35, 36, 171, 172, 35, 36, 171,
172, 35, 36, 171, 172, 35, 36, 171, 172, 35,
36, 171, 172, 35, 36, 171, 172, 35, 36, 171,
172, 35, 36, 171, 172, 35, 36, 171, 172, 69,
70, 205, 206, 69, 70, 205, 206, 69, 70, 205,
206, 69, 70, 205, 206, 69, 70, 205, 206, 69,
70, 205, 206, 69, 70, 205, 206, 69, 70, 205,
206, 69, 70, 205, 206, 69, 70, 205, 206, 103,
104, 239, 240, 103, 104, 239, 240, 103, 104, 239,
240, 103, 104, 239, 240, 103, 104, 239, 240, 103,
104, 239, 240, 103, 104, 239, 240, 103, 104, 239,
240, 103, 104, 239, 240, 103, 104, 239, 240,
}; };
pub const coll = [_]Rect{ pub const coll = [_]Rect{
Rect{.base = Point{.x = 80, .y = 0}, .width = 47, .height = 16}, Rect{ .base = Point{ .x = 80, .y = 0 }, .width = 47, .height = 16 },
Rect{.base = Point{.x = 128, .y = 70}, .width = 16, .height = 9}, Rect{ .base = Point{ .x = 128, .y = 70 }, .width = 16, .height = 9 },
Rect{.base = Point{.x = 146, .y = 32}, .width = 11, .height = 16}, Rect{ .base = Point{ .x = 146, .y = 32 }, .width = 11, .height = 16 },
Rect{.base = Point{.x = 18, .y = 98}, .width = 12, .height = 13}, Rect{ .base = Point{ .x = 18, .y = 98 }, .width = 12, .height = 13 },
Rect{.base = Point{.x = 114, .y = 16}, .width = 12, .height = 13}, Rect{ .base = Point{ .x = 114, .y = 16 }, .width = 12, .height = 13 },
Rect{.base = Point{.x = 81, .y = 16}, .width = 13, .height = 15}, Rect{ .base = Point{ .x = 81, .y = 16 }, .width = 13, .height = 15 },
Rect{.base = Point{.x = 83, .y = 85}, .width = 26, .height = 27}, Rect{ .base = Point{ .x = 83, .y = 85 }, .width = 26, .height = 27 },
Rect{.base = Point{.x = 100, .y = 81}, .width = 8, .height = 5}, Rect{ .base = Point{ .x = 100, .y = 81 }, .width = 8, .height = 5 },
Rect{.base = Point{.x = 112, .y = 94}, .width = 48, .height = 17}, Rect{ .base = Point{ .x = 112, .y = 94 }, .width = 48, .height = 17 },
Rect{.base = Point{.x = 121, .y = 87}, .width = 30, .height = 7}, Rect{ .base = Point{ .x = 121, .y = 87 }, .width = 30, .height = 7 },
Rect{.base = Point{.x = 128, .y = 80}, .width = 16, .height = 7}, Rect{ .base = Point{ .x = 128, .y = 80 }, .width = 16, .height = 7 },
Rect{.base = Point{.x = 114, .y = 112}, .width = 11, .height = 13}, Rect{ .base = Point{ .x = 114, .y = 112 }, .width = 11, .height = 13 },
Rect{.base = Point{.x = 145, .y = 111}, .width = 12, .height = 13}, Rect{ .base = Point{ .x = 145, .y = 111 }, .width = 12, .height = 13 },
Rect{.base = Point{.x = 11, .y = 146}, .width = 9, .height = 7}, Rect{ .base = Point{ .x = 11, .y = 146 }, .width = 9, .height = 7 },
Rect{.base = Point{.x = 0, .y = 154}, .width = 61, .height = 27}, Rect{ .base = Point{ .x = 0, .y = 154 }, .width = 61, .height = 27 },
Rect{.base = Point{.x = 62, .y = 162}, .width = 8, .height = 11}, Rect{ .base = Point{ .x = 62, .y = 162 }, .width = 8, .height = 11 },
}; };
pub const triggers = [_]Trigger{ pub const triggers = [_]Trigger{
Trigger{.aura = Rect{.base = Point{.x = 16, .y = 96}, .width = 16, .height = 20}, .direction = Direction.Up, .dialogue = "18 chars per line\nallowed. Or else!"}, // sign Trigger{ .aura = Rect{ .base = Point{ .x = 16, .y = 96 }, .width = 16, .height = 20 }, .direction = Direction.Up, .dialogue = "18 chars per line\nallowed. Or else!" }, // sign
Trigger{.aura = Rect{.base = Point{.x = 83, .y = 103}, .width = 7, .height = 16}, .direction = Direction.Up, .dialogue = "Ded."}, // gravestone 1 Trigger{ .aura = Rect{ .base = Point{ .x = 83, .y = 103 }, .width = 7, .height = 16 }, .direction = Direction.Up, .dialogue = "Ded." }, // gravestone 1
Trigger{.aura = Rect{.base = Point{.x = 96, .y = 103}, .width = 7, .height = 16}, .direction = Direction.Up, .dialogue = "Moar ded."}, // gravestone 2 Trigger{ .aura = Rect{ .base = Point{ .x = 96, .y = 103 }, .width = 7, .height = 16 }, .direction = Direction.Up, .dialogue = "Moar ded." }, // gravestone 2
}; };
pub const start_point = Point{ .x = 32, .y = 31 }; pub const start_point = Point{ .x = 32, .y = 31 };

View File

@ -24,6 +24,11 @@ out += `const Rect = sh0rk.Rect;\n\n`;
out += `pub const width = ${map.width};\n`; out += `pub const width = ${map.width};\n`;
out += `pub const height = ${map.height};\n\n`; out += `pub const height = ${map.height};\n\n`;
out += `pub fn get_tile(x: u32, y: u32) u9 {
return data[x * height + y];
}
`;
let tiles = map.layers[0]; let tiles = map.layers[0];
let tilesheet = { let tilesheet = {