PA_BgTiles.h File Reference

Everything concerning the Bg Tile modes. More...

Go to the source code of this file.

Data Structures

struct  scrollpositions

Defines

#define CharBaseBlock(screen, n)   (((n)*0x4000) + 0x6000000 + (0x200000 * screen))
#define ScreenBaseBlock(screen, n)   (((n)*0x800) + 0x6000000 + (0x200000 * screen))
#define BG_COLOR16   0x00
#define BG_COLOR256   0x80
#define CHAR_SHIFT   2
#define SCREEN_SHIFT   8
#define WRAPAROUND   0x1
#define SCREEN_TILES   24576
#define REG_BGSCREEN0   0x04000000
#define REG_BGSCREEN1   0x04001000
#define REG_BGSCREEN(screen)   (0x04000000 + (screen * 0x1000))
#define REG_BGCNT(screen, bg_number)   (0x4000008 + (screen * 0x1000) + (bg_number << 1))
#define REG_BGSCROLLX   0x4000010
#define REG_BGSCROLLY   0x4000012
#define BG_256X256   0
#define BG_512X256   1
#define BG_256X512   2
#define BG_512X512   3
#define TILE_N   1023
#define TILE_PAL   61440
#define TILE_HFLIP   1024
#define TILE_VFLIP   2048
#define PA_HideBg(screen, bg_select)   _REG16(REG_BGSCREEN(screen)) &= ~(0x100 << (bg_select))
 Hide a screen's background.
#define PA_ShowBg(screen, bg_select)   _REG16(REG_BGSCREEN(screen)) |= (0x100 << (bg_select))
 Show a hidden background.
#define PA_ResetBg(screen)   _REG16(REG_BGSCREEN(screen)) &= ~(0xF00)
 Reinitialize de Bg system of a screen. It only hides all the backgrounds in reality...
#define PA_LoadBgTiles(screen, bg_select, bg_tiles)   PA_LoadBgTilesEx(screen, bg_select, (void*)bg_tiles, SIZEOF_16BIT(bg_tiles))
 Load a tileset into memory
#define PA_LoadTiledBg(screen, bg_number, bg_name)
 This will never get easier... Loads a background TiledBg converted with PAGfx, with it's tiles, map, and palette. Only 256 color mode available.
#define PA_LoadSimpleBg(screen, bg_select, bg_tiles, bg_map, bg_size, wraparound, color_mode)
 Simple way to load a Background. Combines PA_InitBg, PA_LoadBgTiles, and PA_LoadBgMap
#define PA_LoadBg(screen, bg_select, bg_tiles, tile_size, bg_map, bg_size, wraparound, color_mode)
 Simplest way to load a Background. Combines PA_InitBg, PA_LoadBgTiles, and PA_LoadBgMap
#define PA_BGScrollX(screen, bg_number, x)   _REG16(REG_BGSCROLLX + ((screen) * 0x1000) + ((bg_number) << 2)) = (x)&1023
 Scroll horizontaly any background
#define PA_BGScrollY(screen, bg_number, y)   _REG16(REG_BGSCROLLY + ((screen) * 0x1000) + ((bg_number) << 2)) = (y)&1023
 Scroll vertically any background
#define PA_BGScrollXY(screen, bg_number, x, y)   {PA_BGScrollX(screen, bg_number, x); PA_BGScrollY(screen, bg_number, y);}
 Scroll horizontaly and vertically any background
#define PA_SetMapTileAll(screen, bg_select, x, y, tile_info)   *(u16*)(PA_bgmap[screen][bg_select] + ((x) << 1) + ((y) << 6)) = (tile_info)
 Change the tile info used by a given tile in the map
#define PA_SetMapTileHflip(screen, bg_select, x, y, hflip)   {*(u16*)(PA_bgmap[screen][bg_select] + ((x) << 1) + ((y) << 6)) &= ALL_BUT(TILE_HFLIP); *(u16*)(PA_bgmap[screen][bg_select] + ((x) << 1) + ((y) << 6)) |= ((hflip) << 10);}
 Flip a given tile horizontaly
#define PA_SetMapTileVflip(screen, bg_select, x, y, vflip)   {*(u16*)(PA_bgmap[screen][bg_select] + ((x) << 1) + ((y) << 6)) &= ALL_BUT(TILE_VFLIP); *(u16*)(PA_bgmap[screen][bg_select] + ((x) << 1) + ((y) << 6)) |= ((vflip) << 11);}
 Flip a given tile verticaly
#define PA_SetMapTilePal(screen, bg_select, x, y, palette_number)   {*(u16*)(PA_bgmap[screen][bg_select] + ((x) << 1) + ((y) << 6)) &= ALL_BUT(TILE_PAL); *(u16*)(PA_bgmap[screen][bg_select] + ((x) << 1) + ((y) << 6)) |= ((palette_number) << 12);}
 Change the 16 color palette used by a tile. Works only if the Bg is in 16 colors...

Functions

u8 PA_GetPAGfxBgSize (u16 width, u16 height)
u8 PA_GetPAGfxRotBgSize (u16 width)
void PA_ResetBgSys (void)
 Reset the background system
void PA_InitBg (u8 screen, u8 bg_select, u8 bg_size, u8 wraparound, u8 color_mode)
 Initialise a given background. Do this only after having loaded a tileset and a map.
void PA_LoadBgTilesEx (u8 screen, u8 bg_select, void *bg_tiles, u16 size)
 Load a tileset into memory with a given size
void PA_ReLoadBgTiles (u8 screen, u8 bg_select, void *bg_tiles)
 ReLoad a tileset into memory
void PA_DeleteTiles (u8 screen, u8 bg_select)
 Delete a tilest in memory. Note that loading a tileset automatically deletes the preceding one, so you won't need to use this function often
void PA_DeleteMap (u8 screen, u8 bg_select)
 Delete a map in memory. Note that loading a map automatically deletes the preceding one, so you won't need to use this function often
void PA_DeleteBg (u8 screen, u8 bg_select)
 Delete a complete background (tiles + map + hide it...)
void PA_LoadBgMap (u8 screen, u8 bg_select, void *bg_map, u8 bg_size)
 Load a background's map info
void PA_SetMapTile (u8 screen, u8 bg_select, s16 x, s16 y, s16 tile_number)
 Change the tile gfx used by a given tile in the map
void PA_SetLargeMapTile (u8 screen, u8 bg_select, s32 x, s32 y, u32 tile_info)
 Change the tile info used by a given tile in the map, only for big background (512 large or wide)
void PA_SetMapTileEx (u8 screen, u8 bg_select, s16 x, s16 y, u16 tile_number, u8 hflip, u8 vflip, u8 palette_number)
void PA_SetBgPrio (u8 screen, u8 bg, u8 prio)
 Change a backgrounds priority
void PA_CreateBgFromTiles (u8 screen, u8 bg_select, u8 bg_tiles, void *bg_map, u8 bg_size)
void PA_ClearBg (u8 screen, u8 bg_select)
 Erase a given background (just the tilemap)

Variables

u32 PA_bgmap [2][4]
u8 tilesetchar [2][4]
u16 bg_sizes [4]
u8 bg_place [4]
u16 * PA_DrawBg [2]
u8 charblocks [2][70]
u16 tilesetsize [2][4]
u16 mapsize [2][4]
u8 mapchar [2][4]
u8 charsetstart [2]
s32 PA_parallaxX [2][4]
s32 PA_parallaxY [2][4]
scrollpositions scrollpos [2][4]


Detailed Description

Everything concerning the Bg Tile modes.

This file contains all the macros and variables regarding Tile modes, loading tiles and Bg, etc...


Generated on Wed Aug 30 21:02:12 2006 for PAlib by  doxygen 1.3.9.1