diff --git a/gba/cartest/data/smoke.bin b/gba/cartest/data/smoke.bin new file mode 100644 index 0000000..1b325c1 Binary files /dev/null and b/gba/cartest/data/smoke.bin differ diff --git a/gba/cartest/data/smoke.xcf b/gba/cartest/data/smoke.xcf new file mode 100644 index 0000000..583f045 Binary files /dev/null and b/gba/cartest/data/smoke.xcf differ diff --git a/gba/cartest/src/cartest.c b/gba/cartest/src/cartest.c index a5a4b27..f345176 100644 --- a/gba/cartest/src/cartest.c +++ b/gba/cartest/src/cartest.c @@ -14,8 +14,7 @@ // headers for binary data generated by bin2o macro in makefile #include "car_pal_bin.h" #include "car_bin.h" -#include "chaser_bin.h" - +#include "smoke_bin.h" #include "sinlut.h" @@ -30,11 +29,12 @@ typedef s32 FIXED; // 32bit FIXED in 24.8 format #define lut_cos(x) _sinLUT[(x + (SIN_SIZE>>2)) & SIN_MASK] -#define NUMCHASERS 10 +#define NUMSMOKES 20 u16 PaletteBuffer[256]; -OBJATTR oe_buffer[1+NUMCHASERS]; +OBJATTR oe_buffer[1+NUMSMOKES]; OBJAFFINE *const oa_buffer = (OBJAFFINE*)oe_buffer; +s8 smoke_frame[NUMSMOKES]; unsigned int frame; @@ -48,8 +48,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]; + // We'll make a few smoke clouds + OBJATTR*smokes = &oe_buffer[1]; // Set up the interrupt handlers InitInterrupt(); @@ -72,20 +72,23 @@ int main(void) 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); + // load smoke + CpuFastSet(smoke_bin, free_space, COPY32 | smoke_bin_size/4); + free_space += smoke_bin_size; + car->attr2 = OBJ_CHAR(512); - s32 base = (s32)(0.707106781 * 256); - s32 one = 1 << 8; + u8 next_smoke = 0; u8 i; - for (i=0; iattr1 = OBJ_SIZE(1) | OBJ_X(FIX2INT(x)); car->attr0 = OBJ_256_COLOR | OBJ_DOUBLE | OBJ_ROT_SCALE_ON | OBJ_Y(FIX2INT(y)); + // Update smoke cloud frames + if ((frame & 3) == 3) { + for (i=0; i=NUMSMOKES) { + next_smoke = 1; + } + + for (i=0; i