head 1.1; branch 1.1.1; access ; symbols start:1.1.1.1 PAlibDoc:1.1.1; locks ; strict; comment @# @; 1.1 date 2005.11.02.08.30.23; author jandujar; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2005.11.02.08.30.23; author jandujar; state Exp; branches ; next ; desc @@ 1.1 log @Initial revision @ text @
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 | BG_ROT_128X128 0 |
#define | BG_ROT_256X256 1 |
#define | BG_ROT_512X512 2 |
#define | BG_ROT_1024X1024 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_LoadSimpleBg(screen, bg_select, bg_tiles, bg_map, bg_size, wraparound, color_mode) |
Simplest way to load a Background. Combines PA_InitBg, PA_LoadBgTiles, and PA_LoadBgMap | |
#define | PA_LoadRotBg(screen, bg_select, bg_tiles, bg_map, bg_size, wraparound) |
Load a background fit for rotating/scaling ! Warning, you must use PA_SetVideoMode to 1 if you want 1 rotating background (Bg3 only !), or 2 for 2 rotating backgrounds (Bg2 and 3). The background MUST be in 256 colors | |
#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_GetBGScrollX(screen, bg_number) ((_REG16(REG_BGSCROLLX + ((screen) * 0x1000) + ((bg_number) << 2))) &1023) |
Get the current horizontal scroll of 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_GetBGScrollY(screen, bg_number) ((_REG16(REG_BGSCROLLY + ((screen) * 0x1000) + ((bg_number) << 2))) &1023) |
Get the current vertical scroll of 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_SetMapTile(screen, bg_select, x, y, tile_number) {*(u16*)(PA_bgmap[screen][bg_select] + ((x) << 1) + ((y) << 6)) &= ALL_BUT(TILE_N); *(u16*)(PA_bgmap[screen][bg_select] + ((x) << 1) + ((y) << 6)) |= ((tile_number)&TILE_N);} |
Change the tile gfx used by a given tile in the map | |
#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... | |
#define | PA_SetMapTileEx(screen, bg_select, x, y, tile_number, hflip, vflip, palette_number) *(u16*)(PA_bgmap[screen][bg_select] + ((x) << 1) + ((y) << 6)) = (tile_number) + ((hflip) << 10) + ((vflip) << 11) + ((palette_number) << 12) |
Change every aspect of a given map tile | |
#define | PA_LoadTiledBitmap(screen, tiled_bitmap) PA_LoadBg(screen, 0, tiled_bitmap, SCREEN_TILES, bitmap, BG_256X256, 1, 1) |
Load a bitmap converted using gfx2gba, converted like a tileset but without any optimisations. No use to include the map. Carefull, takes the whole tile memory... | |
#define | PA_LoadLargeBg(screen, bg_select, bg_tiles, bg_map, color_mode, lx, ly) |
Completely load and initialise a background with infinite scrolling (usefull if larger or wider than 512 pixels) | |
#define | PA_LoadLargeBgEx(screen, bg_select, bg_tiles, tile_size, bg_map, color_mode, lx, ly) |
Completely load and initialise a background with infinite scrolling (usefull if larger or wider than 512 pixels), but here you can put yourself the tile size... | |
Functions | |
void | PA_LoadRotBgMap (bool screen, u8 bg_select, void *bg_map, u8 bg_size) |
void | PA_ResetBgSys (void) |
Reset the background system | |
void | PA_InitBg (bool screen, u8 bg_select, u8 bg_size, bool wraparound, bool color_mode) |
Initialise a given background. Do this only after having loaded a tileset and a map. | |
void | PA_LoadBgTilesEx (bool screen, u8 bg_select, void *bg_tiles, u16 size) |
Load a tileset into memory with a given size | |
void | PA_DeleteTiles (bool 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 (bool 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 (bool screen, u8 bg_select) |
Delete a complete background (tiles + map + hide it...) | |
void | PA_LoadBgMap (bool screen, u8 bg_select, void *bg_map, u8 bg_size) |
Load a background's map info | |
void | PA_SetBgRot (bool screen, u8 bg_select, s32 x_scroll, s32 y_scroll, s32 x_rotcentre, s32 y_rotcentre, s16 bg_angle, s32 bg_zoom) |
void | PA_SetLargeMapTile (bool 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_InfLargeScrollX (bool screen, u8 bg_select, s32 x) |
Scroll a large infinite scrolling background horizontaly. It must have been initialised with PA_LoadLargeBg. | |
void | PA_InfLargeScrollY (bool screen, u8 bg_select, s32 y) |
Scroll a large infinite scrolling background vertically. It must have been initialised with PA_LoadLargeBg. | |
void | PA_InfLargeScrollXY (bool screen, u8 bg_select, s32 x, s32 y) |
Scroll a large infinite scrolling background horizontaly and vertically. It must have been initialised with PA_LoadLargeBg. | |
void | PA_LargeScrollX (bool screen, u8 bg_select, s32 x) |
Scroll a large background horizontaly. It must have been initialised with PA_LoadLargeBg. This function does not wrap around, but is faster than the InfLargeScroll... | |
void | PA_LargeScrollY (bool screen, u8 bg_select, s32 y) |
Scroll a large background vertically. It must have been initialised with PA_LoadLargeBg. This function does not wrap around, but is faster than the InfLargeScroll... | |
void | PA_LargeScrollXY (bool screen, u8 bg_select, s32 x, s32 y) |
Scroll a large background horizontaly and vertically. It must have been initialised with PA_LoadLargeBg. This function does not wrap around, but is faster than the InfLargeScroll... | |
void | PA_InitParallaxX (bool screen, s32 bg0, s32 bg1, s32 bg2, s32 bg3) |
Initialise Parallax Scrolling for multiple backgrounds, horizontaly. Chose the speed at which each background will scroll compared to the others. Then use PA_ParallaxScrollX to scroll... | |
void | PA_InitParallaxY (bool screen, s32 bg0, s32 bg1, s32 bg2, s32 bg3) |
Initialise Parallax Scrolling for multiple backgrounds, horizontaly. Chose the speed at which each background will scroll compared to the others. Then use PA_ParallaxScrollX to scroll... | |
void | PA_ParallaxScrollX (bool screen, s32 x) |
Scroll the backgrounds | |
void | PA_ParallaxScrollY (bool screen, s32 y) |
Scroll the backgrounds | |
void | PA_ParallaxScrollXY (bool screen, s32 x, s32 y) |
Scroll the backgrounds | |
void | PA_SetBgPrio (bool screen, u8 bg, u8 prio) |
Change a backgrounds priority | |
void | PA_InitLargeBg (bool screen, u8 bg_select, s32 lx, s32 ly, void *bg_map) |
Variables | |
u32 | PA_bgmap [2][4] |
u8 | tilesetchar [2][4] |
u16 | bg_sizes [4] |
u8 | bg_place [4] |
u16 * | PA_DrawBg [2] |
bool | 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] |
This file contains all the macros and variables regarding Tile modes (0-2), loading tiles and Bg, etc...