Loading...
Searching...
No Matches
map.h
Go to the documentation of this file.
1
44
#ifndef OPENSNES_MAP_H
45
#define OPENSNES_MAP_H
46
47
#include <
snes/types.h
>
48
49
/*============================================================================
50
* Tile Property Constants
51
*============================================================================*/
52
54
#define T_EMPTY 0x0000
55
57
#define T_SOLID 0xFF00
58
60
#define T_LADDER 0x0001
61
63
#define T_FIRES 0x0002
64
66
#define T_SPIKE 0x0004
67
69
#define T_PLATE 0x0008
70
72
#define T_SLOPEU1 0x0020
73
75
#define T_SLOPED1 0x0021
76
78
#define T_SLOPELU2 0x0022
79
81
#define T_SLOPELD2 0x0023
82
84
#define T_SLOPEUU2 0x0024
85
87
#define T_SLOPEUD2 0x0025
88
89
/*============================================================================
90
* Action Constants (used by both map and object engines)
91
*============================================================================*/
92
93
#define ACT_STAND 0x0000
94
#define ACT_WALK 0x0001
95
#define ACT_JUMP 0x0002
96
#define ACT_FALL 0x0004
97
#define ACT_CLIMB 0x2000
98
#define ACT_DIE 0x4000
99
#define ACT_BURN 0x8000
101
/*============================================================================
102
* Map Options
103
*============================================================================*/
104
106
#define MAP_OPT_1WAY 0x01
107
109
#define MAP_OPT_BG2 0x02
110
111
/*============================================================================
112
* Exported Variables
113
*============================================================================*/
114
115
/* --- Bank $00 SLOT 1 (C-accessible, < $2000) --- */
116
118
extern
u16
x_pos
;
119
121
extern
u16
y_pos
;
122
123
/* --- Bank $7E SLOT 2 (NOT C-accessible, ASM-only) --- */
124
/* The map engine's bulk data lives in Bank $7E:
125
* metatiles[4096] — metatile definitions (4 tile entries per metatile)
126
* metatilesprop[2048] — tile collision properties
127
* bg_L1[2048] — BG1 tilemap buffer
128
* mapadrrowlut[1024] — row address lookup table
129
* These are managed internally by mapLoad/mapUpdate/mapVblank.
130
* C code accesses map data through mapGetMetaTile/mapGetMetaTilesProp.
131
*/
132
133
/*============================================================================
134
* Functions
135
*============================================================================*/
136
152
void
mapLoad
(
u8
*layer1map,
u8
*layertiles,
u8
*tilesprop);
153
160
void
mapUpdate
(
void
);
161
170
void
mapVblank
(
void
);
171
181
void
mapUpdateCamera
(
u16
xpos
,
u16
ypos);
182
190
u16
mapGetMetaTile
(
u16
xpos
,
u16
ypos);
191
199
u16
mapGetMetaTilesProp
(
u16
xpos
,
u16
ypos);
200
206
void
mapSetMapOptions
(
u8
optmap);
207
208
#endif
/* OPENSNES_MAP_H */
xpos
static const s16 xpos[4]
X positions for the four sprites displayed in a horizontal row.
Definition
main.c:54
u16
unsigned short u16
16-bit unsigned integer (0 to 65535)
Definition
types.h:52
u8
unsigned char u8
8-bit unsigned integer (0 to 255)
Definition
types.h:46
mapUpdateCamera
void mapUpdateCamera(u16 xpos, u16 ypos)
Update camera position to follow an object.
mapGetMetaTilesProp
u16 mapGetMetaTilesProp(u16 xpos, u16 ypos)
Get tile collision property at map coordinates.
x_pos
u16 x_pos
Current camera X position in pixels.
mapSetMapOptions
void mapSetMapOptions(u8 optmap)
Set map engine options.
y_pos
u16 y_pos
Current camera Y position in pixels.
mapVblank
void mapVblank(void)
Transfer map updates to VRAM.
mapUpdate
void mapUpdate(void)
Update map scroll buffers based on camera position.
mapLoad
void mapLoad(u8 *layer1map, u8 *layertiles, u8 *tilesprop)
Load map data into the engine and flush to VRAM.
mapGetMetaTile
u16 mapGetMetaTile(u16 xpos, u16 ypos)
Get metatile index at map coordinates.
types.h
OpenSNES Standard Types.
lib
include
snes
map.h
Generated by
1.9.8