|
@@ -13,9 +13,7 @@ float scale = 3.0;
|
|
int frameskip = 10;
|
|
int frameskip = 10;
|
|
|
|
|
|
|
|
|
|
-void log(char* msg){
|
|
|
|
- dbg_sprintf(dbgout, "[TBP] %s\n", msg);
|
|
|
|
-}
|
|
|
|
|
|
+#define log(msg) dbg_sprintf(dbgout, "[TBP] %s\n", msg)
|
|
|
|
|
|
int main(void){
|
|
int main(void){
|
|
kb_key_t arrows;
|
|
kb_key_t arrows;
|
|
@@ -27,28 +25,35 @@ int main(void){
|
|
Object* player = new_Object(0, 0);
|
|
Object* player = new_Object(0, 0);
|
|
Vector* objects = new_Vector(1, sizeof(Object), &free_Object);
|
|
Vector* objects = new_Vector(1, sizeof(Object), &free_Object);
|
|
Vector* sprites = new_Vector(22, sizeof(Sprite), &free_Sprite);
|
|
Vector* sprites = new_Vector(22, sizeof(Sprite), &free_Sprite);
|
|
- sprites->consume(sprites, new_Sprite(bm1_width, bm1_height, bm1_compressed));
|
|
|
|
- sprites->consume(sprites, new_Sprite(bm2_width, bm2_height, bm2_compressed));
|
|
|
|
- sprites->consume(sprites, new_Sprite(bm3_width, bm3_height, bm3_compressed));
|
|
|
|
- sprites->consume(sprites, new_Sprite(bm4_width, bm4_height, bm4_compressed));
|
|
|
|
- sprites->consume(sprites, new_Sprite(bm5_width, bm5_height, bm5_compressed));
|
|
|
|
- sprites->consume(sprites, new_Sprite(bm6_width, bm6_height, bm6_compressed));
|
|
|
|
- sprites->consume(sprites, new_Sprite(bm7_width, bm7_height, bm7_compressed));
|
|
|
|
- sprites->consume(sprites, new_Sprite(bm8_width, bm8_height, bm8_compressed));
|
|
|
|
- sprites->consume(sprites, new_Sprite(bm9_width, bm9_height, bm9_compressed));
|
|
|
|
- sprites->consume(sprites, new_Sprite(bm10_width, bm10_height, bm10_compressed));
|
|
|
|
- sprites->consume(sprites, new_Sprite(bm11_width, bm11_height, bm11_compressed));
|
|
|
|
- sprites->consume(sprites, new_Sprite(bm12_width, bm12_height, bm12_compressed));
|
|
|
|
- sprites->consume(sprites, new_Sprite(bm13_width, bm13_height, bm13_compressed));
|
|
|
|
- sprites->consume(sprites, new_Sprite(bm14_width, bm14_height, bm14_compressed));
|
|
|
|
- sprites->consume(sprites, new_Sprite(bm15_width, bm15_height, bm15_compressed));
|
|
|
|
- sprites->consume(sprites, new_Sprite(bm16_width, bm16_height, bm16_compressed));
|
|
|
|
- sprites->consume(sprites, new_Sprite(bm17_width, bm17_height, bm17_compressed));
|
|
|
|
- sprites->consume(sprites, new_Sprite(bm18_width, bm18_height, bm18_compressed));
|
|
|
|
- sprites->consume(sprites, new_Sprite(bm19_width, bm19_height, bm19_compressed));
|
|
|
|
- sprites->consume(sprites, new_Sprite(bm20_width, bm20_height, bm20_compressed));
|
|
|
|
- sprites->consume(sprites, new_Sprite(bm21_width, bm21_height, bm21_compressed));
|
|
|
|
- sprites->consume(sprites, new_Sprite(bm22_width, bm22_height, bm22_compressed));
|
|
|
|
|
|
+ if(!sprites->consume(sprites, new_Sprite(bm1_width, bm1_height, bm1_compressed)) ||
|
|
|
|
+ !sprites->consume(sprites, new_Sprite(bm2_width, bm2_height, bm2_compressed)) ||
|
|
|
|
+ !sprites->consume(sprites, new_Sprite(bm3_width, bm3_height, bm3_compressed)) ||
|
|
|
|
+ !sprites->consume(sprites, new_Sprite(bm4_width, bm4_height, bm4_compressed)) ||
|
|
|
|
+ !sprites->consume(sprites, new_Sprite(bm5_width, bm5_height, bm5_compressed)) ||
|
|
|
|
+ !sprites->consume(sprites, new_Sprite(bm6_width, bm6_height, bm6_compressed)) ||
|
|
|
|
+ !sprites->consume(sprites, new_Sprite(bm7_width, bm7_height, bm7_compressed)) ||
|
|
|
|
+ !sprites->consume(sprites, new_Sprite(bm8_width, bm8_height, bm8_compressed)) ||
|
|
|
|
+ !sprites->consume(sprites, new_Sprite(bm9_width, bm9_height, bm9_compressed)) ||
|
|
|
|
+ !sprites->consume(sprites, new_Sprite(bm10_width, bm10_height, bm10_compressed)) ||
|
|
|
|
+ !sprites->consume(sprites, new_Sprite(bm11_width, bm11_height, bm11_compressed)) ||
|
|
|
|
+ !sprites->consume(sprites, new_Sprite(bm12_width, bm12_height, bm12_compressed)) ||
|
|
|
|
+ !sprites->consume(sprites, new_Sprite(bm13_width, bm13_height, bm13_compressed)) ||
|
|
|
|
+ !sprites->consume(sprites, new_Sprite(bm14_width, bm14_height, bm14_compressed)) ||
|
|
|
|
+ !sprites->consume(sprites, new_Sprite(bm15_width, bm15_height, bm15_compressed)) ||
|
|
|
|
+ !sprites->consume(sprites, new_Sprite(bm16_width, bm16_height, bm16_compressed)) ||
|
|
|
|
+ !sprites->consume(sprites, new_Sprite(bm17_width, bm17_height, bm17_compressed)) ||
|
|
|
|
+ !sprites->consume(sprites, new_Sprite(bm18_width, bm18_height, bm18_compressed)) ||
|
|
|
|
+ !sprites->consume(sprites, new_Sprite(bm19_width, bm19_height, bm19_compressed)) ||
|
|
|
|
+ !sprites->consume(sprites, new_Sprite(bm20_width, bm20_height, bm20_compressed)) ||
|
|
|
|
+ !sprites->consume(sprites, new_Sprite(bm21_width, bm21_height, bm21_compressed)) ||
|
|
|
|
+ !sprites->consume(sprites, new_Sprite(bm22_width, bm22_height, bm22_compressed))
|
|
|
|
+ ){
|
|
|
|
+ log("Failed to load sprites");
|
|
|
|
+ free_Object(player);
|
|
|
|
+ free_Vector(objects);
|
|
|
|
+ free_Vector(sprites);
|
|
|
|
+ return 1;
|
|
|
|
+ }
|
|
|
|
|
|
if(!objects->push(objects, player)){
|
|
if(!objects->push(objects, player)){
|
|
log("Unable to add player to stack");
|
|
log("Unable to add player to stack");
|