PVSnesLib  4.3.0
Documentation to code in C or ASM for the Nintendo SNES
map.h File Reference

contains the functions to manage / scroll large background MAP on SNES. More...

#include <snes/snestypes.h>

Go to the source code of this file.

Macros

#define ACT_BURN   0x0020
 Action type BURN for object.
 
#define ACT_CLIMB   0x0008
 Action type CLIMB for object.
 
#define ACT_DIE   0x0010
 Action type DIE for object.
 
#define ACT_FALL   0x0004
 Action type FALL for object.
 
#define ACT_JUMP   0x0002
 Action type JUMP for object.
 
#define ACT_STAND   0x0000
 Action type STAND for object.
 
#define ACT_WALK   0x0001
 Action type WALK for object.
 
#define T_EMPTY   0x0000
 Type Empty (action will be fall) for tile

 
#define T_FIRES   0x0002
 Type Fire (action will be burn) for tile

 
#define T_LADDE   0x0001
 Type Ladder (action will be climb) for tile

 
#define T_PLATE   0x0008
 Type Ground (action will be jump through and land) for tile

 
#define T_SOLID   0xFF00
 Type Solid (action is walk only) for tile

 
#define T_SPIKE   0x0004
 Type Spike (action will be die) for tile

 

Functions

u16 mapGetMetaTile (u16 xpos, u16 ypos)
 Get metatile value from current map. More...
 
u16 mapGetMetaTilesProp (u16 xpos, u16 ypos)
 Get metatile property from current map (solid, lad, fire, etc...) More...
 
void mapLoad (u8 *layer1map, u8 *layertiles, u8 *tilesprop)
 Load map definition into memory. More...
 
void mapUpdate (void)
 Update map regarding current camera position (must be done once per frame)
 
void mapUpdateCamera (u16 xpos, u16 ypos)
 Update map camera (must be done once per frame) More...
 
void mapVblank (void)
 Display map regarding current buffer (must be done once per frame, near Vblank)
 

Variables

u16 bg_L1 [32 *32]
 The buffer to use when updating the whole display on layer 1.
 
u8 mapupdbuf
 State of buffer update (vert / horiz / all)
 
u16 y_pos
 Current value of camera in x & y coordinates.
 

Detailed Description

contains the functions to manage / scroll large background MAP on SNES.

this can only be use for mode 1

the engine scrolls layer1 in x and y coordinates

layer address is : 6800 for Layer 1

Function Documentation

◆ mapGetMetaTile()

mapGetMetaTile ( u16  xpos,
u16  ypos 
)

Get metatile value from current map.

Parameters
xposx coordinate of metatile
yposx coordinate of metatile
Returns
tile value

◆ mapGetMetaTilesProp()

mapGetMetaTilesProp ( u16  xpos,
u16  ypos 
)

Get metatile property from current map (solid, lad, fire, etc...)

Parameters
xposx coordinate of metatile
yposx coordinate of metatile
Returns
tile properties

◆ mapLoad()

mapLoad ( u8 *  layer1map,
u8 *  layertiles,
u8 *  tilesprop 
)

Load map definition into memory.

WARNING! Map engine must be used on Background #0.

Parameters
layer1mapaddress of map with tiles
layertilesaddress of tiles definition
tilespropaddress of tiles property definition (blocker, spikes, and so on)
Examples
games/likemario/LikeMario.c, maps/mapscroll/mapscroll.c, maps/tiled/tiled.c, objects/mapandobjects/mapandobjects.c, and objects/nogravityobject/nogravityobjects.c.

◆ mapUpdateCamera()

mapUpdateCamera ( u16  xpos,
u16  ypos 
)

Update map camera (must be done once per frame)

Parameters
xposx coordinate of object where we want to focus on
yposx coordinate of object where we want to focus on
Examples
games/likemario/LikeMario.c, maps/mapscroll/mapscroll.c, maps/tiled/tiled.c, and objects/nogravityobject/nogravityobjects.c.