diff --git a/gba/cartest/data/chaser.bin b/gba/cartest/data/chaser.bin new file mode 100644 index 0000000..23e7f1b Binary files /dev/null and b/gba/cartest/data/chaser.bin differ diff --git a/gba/cartest/src/cartest.c b/gba/cartest/src/cartest.c index 6784c4a..b672ac1 100644 --- a/gba/cartest/src/cartest.c +++ b/gba/cartest/src/cartest.c @@ -18,14 +18,17 @@ //--------------------------------------------------------------------------------- #include "car_pal_bin.h" #include "car_bin.h" +#include "chaser_bin.h" //--------------------------------------------------------------------------------- // storage space for palette data //--------------------------------------------------------------------------------- u16 PaletteBuffer[256]; +#define NUMCHASERS 10 + // 4 sprites and one -OBJATTR oe_buffer[4]; +OBJATTR oe_buffer[1+NUMCHASERS]; OBJAFFINE *const oa_buffer = (OBJAFFINE*)oe_buffer; unsigned int frame; @@ -46,6 +49,8 @@ int main(void) { OBJATTR*car = &oe_buffer[0]; OBJAFFINE*car_aff = &oa_buffer[0]; + // We'll make a few chasers + OBJATTR*chasers = &oe_buffer[1]; // Set up the interrupt handlers InitInterrupt(); @@ -64,8 +69,12 @@ int main(void) u32 white = 0x10101010; CpuFastSet(&white, (void*)VRAM, FILL | 240*160/4); FadeToPalette((void*)car_pal_bin, 1); - - CpuFastSet(car_bin, BITMAP_OBJ_BASE_ADR, COPY32 | car_bin_size/4); + + void* free_space = BITMAP_OBJ_BASE_ADR; + CpuFastSet(car_bin, free_space, COPY32 | car_bin_size/4); + free_space += car_bin_size; + CpuFastSet(chaser_bin, free_space, COPY32 | chaser_bin_size/4); + free_space += chaser_bin_size; CpuFastSet(car_pal_bin, OBJ_COLORS, COPY32 | car_pal_bin_size/4); car->attr2 = OBJ_CHAR(512); @@ -78,13 +87,15 @@ int main(void) car_aff->pc = 0;; car_aff->pd = 1 << 8; + u8 i; + for (i=0; iattr1 = OBJ_SIZE(1) | OBJ_X(x+xadjust); - car->attr0 = OBJ_256_COLOR | OBJ_DOUBLE | OBJ_ROT_SCALE_ON | OBJ_Y(y+yadjust); + car->attr1 = OBJ_SIZE(1) | OBJ_X(x); + car->attr0 = OBJ_256_COLOR | OBJ_DOUBLE | OBJ_ROT_SCALE_ON | OBJ_Y(y); + + for (i=0; i