PAlib: PA_BgRot.h Source File

Main Page | Modules | File List | Globals | Search for

# PA_BgRot.h

Go to the documentation of this file.

    00001 #ifndef _PA_BGROT
    00002 #define _PA_BGROT
    00003
    00004
    00005 #include "PA_BgTiles.h"
    00006
    00007
    00008
    00015 #define BG_ROT_128X128 0
    00016 #define BG_ROT_256X256 1
    00017 #define BG_ROT_512X512 2
    00018 #define BG_ROT_1024X1024 3
    00019
    00020
    00021 void PA_LoadRotBgMap(u8 screen, u8 bg_select, void* bg_map, u8 bg_size);
    00022
    00023 #define PA_BGXX(screen, bg) _REG32(0x4000008 + (0x1000 * screen) + (bg << 4))
    00024 #define PA_BGXY(screen, bg) _REG32(0x400000C + (0x1000 * screen) + (bg << 4))
    00025 #define PA_BGXPA(screen, bg) _REG16(0x4000000 + (0x1000 * screen) + (bg << 4))
    00026 #define PA_BGXPB(screen, bg) _REG16(0x4000002 + (0x1000 * screen) + (bg << 4))
    00027 #define PA_BGXPC(screen, bg) _REG16(0x4000004 + (0x1000 * screen) + (bg << 4))
    00028 #define PA_BGXPD(screen, bg) _REG16(0x4000006 + (0x1000 * screen) + (bg << 4))
    00029
    00030
    00031
    00032
    00033
    00064 #define PA_LoadRotBg(screen, bg_select, bg_tiles, bg_map, bg_size, wraparound) {\
    00065 PA_DeleteBg(screen, bg_select);\
    00066 PA_LoadBgTiles(screen, bg_select, bg_tiles); \
    00067 PA_LoadRotBgMap(screen, bg_select, (void*)bg_map, bg_size); \
    00068 PA_InitBg(screen, bg_select, bg_size, wraparound, 1);\
    00069 PA_SetBgRot(screen, bg_select, 0, 0, 0, 0, 0, 256);\
    00070 }
    00071
    00072
    00091 #define PA_LoadPAGfxRotBg(screen, bg_select, bg_name, wraparound) {\
    00092 PA_LoadNormalBgPal(screen, (void*)bg_name##_Pal);\
    00093 PA_LoadRotBg(screen, bg_select, bg_name##_Tiles, bg_name##_Map, PA_GetPAGfxRotBgSize(bg_name##_Width), wraparound);\
    00094 }
    00095
    00096
    00097
    00098
    00099
    00130 extern inline void PA_SetBgRot(u8 screen, u8 bg_select, s32 x_scroll, s32 y_scroll, s32 x_rotcentre, s32 y_rotcentre, s16 bg_angle, s32 bg_zoom){
    00131        s32 pa, pb, pc, pd;
    00132
    00133        pa = (PA_Cos(bg_angle) * (bg_zoom)) >> 8;
    00134        pb = (-PA_Sin(bg_angle) * (bg_zoom)) >> 8;
    00135        pc = (PA_Sin(bg_angle) * (bg_zoom)) >> 8;
    00136        pd = pa;
    00137
    00138        PA_BGXX(screen, bg_select) = (x_scroll << 8) - (x_rotcentre * pa + y_rotcentre * pb);
    00139        PA_BGXY(screen, bg_select) = (y_scroll << 8) - (x_rotcentre * pc + y_rotcentre * pd);
    00140
    00141        PA_BGXPA(screen, bg_select) = pa;
    00142        PA_BGXPB(screen, bg_select) = pb;
    00143        PA_BGXPC(screen, bg_select) = pc;
    00144        PA_BGXPD(screen, bg_select) = pd;
    00145 }
    00146  // end of BgRot
    00148
    00149
    00150
    00151
    00152
    00153 #endif
    00154