aboutsummaryrefslogtreecommitdiff
path: root/src/maps.h
blob: 8a3dad19c3af582847988f7cf66e3b8dffb43ace (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
   Kitsune's Curse
   Copyright (C) 2020-2023 Juan J. Martinez <jjm@usebox.net>

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */
#ifndef _MAPS_H
#define _MAPS_H

#include <stdint.h>

#ifndef LOCAL
#define LOCAL extern
#endif

void init_map(uint8_t m);
void set_map(uint8_t m);
void draw_map();

uint8_t exit_map_left();
uint8_t exit_map_right();
uint8_t exit_map_up();
uint8_t exit_map_down();

void set_map_tile(uint8_t x, uint8_t y, uint8_t tile);
uint8_t is_map_blocked(uint8_t x, uint8_t y);
uint8_t is_map_deadly(uint8_t x, uint8_t y);

LOCAL uint8_t cmap, ts;
LOCAL uint8_t exit_up, offset_up, exit_down, offset_down;

LOCAL uint8_t last_deadly;

LOCAL uint8_t wmap[TMW * TMH];

// highest bit denotes deadly tile
#define DEADLY_TILE_BASE 59

#define BLOCKED_PLATFORM 128
#define BLOCKED_OPEN_DOOR 143
#define BLOCKED_OPEN_DOOR_TILE 43

#define SWITCH_DOOR_TILE 58

#define BLOCKED_UP (1<<4)
#define BLOCKED_DOWN (1<<5)
#define BLOCKED_LEFT (1<<6)
#define BLOCKED_RIGHT (1<<7)

#define LAST_TILE_TILESET 48
#define LAST_NON_SOLID 10

#undef LOCAL

#endif // _MAPS_H