{ 7, 7, (uint8_t const *) "\x04\xc3\xe7\xf3\x31\x10" }
};
+static badge_sprite const anim_kaninchen[] = {
+ { 7, 5, (uint8_t const *) "\x60\x30\xbe\x31\x02" },
+ { 7, 5, (uint8_t const *) "\x42\x30\xbe\x31\x01" },
+ { 7, 5, (uint8_t const *) "\x42\x30\xae\x35\x01" },
+ { 7, 5, (uint8_t const *) "\x60\x30\xae\x35\x02" },
+ { 7, 5, (uint8_t const *) "\x60\x30\xbe\x31\x01" }
+};
+
void jumpnrun_process_enemy(jumpnrun_enemy *self,
badge_framebuffer *fb,
struct jumpnrun_game_state *state,
enemy_collision_tiles_bounce_horiz,
enemy_collision_player_jumpable,
enemy_tick_cat
+ }, {
+ 9, ARRAY_SIZE(anim_kaninchen), anim_kaninchen,
+ { FIXED_POINT_I(0, -80), FIXED_POINT_I(0, 0) },
+ enemy_collision_tiles_bounce_horiz,
+ enemy_collision_player_jumpable,
+ enemy_tick_cat
}
};
#include "items.h"
#include "enemies.h"
+#ifndef __linux__
#include <drivers/fatfs/ff.h>
+#endif
#include <stdio.h>
dest->current_frame = 0;
}
+#ifdef __linux__
+int jumpnrun_load_level_header_from_file(jumpnrun_level *dest, FILE *fd) {
+#else
int jumpnrun_load_level_header_from_file(jumpnrun_level *dest, FIL *fd) {
- uint16_t head[3];
UINT count;
+#endif
+ uint16_t head[3];
+#ifdef __linux__
+ if(1 != fread(&head, sizeof(head), 1, fd)) {
+#else
if(FR_OK != f_read(fd, head, sizeof(head), &count) || count != sizeof(head)) {
+#endif
return JUMPNRUN_LEVEL_LOAD_ERROR;
}
return JUMPNRUN_LEVEL_LOAD_OK;
}
+#ifdef __linux__
+int jumpnrun_load_level_from_file(jumpnrun_level *dest, FILE *fd) {
+#else
int jumpnrun_load_level_from_file(jumpnrun_level *dest, FIL *fd) {
+ UINT count;
+#endif
size_t i;
unsigned char buf[3];
uint16_t spos[2];
- UINT count;
+#ifdef __linux__
+ if(1 != fread(spos, sizeof(spos), 1, fd)) {
+#else
if(FR_OK != f_read(fd, spos, sizeof(spos), &count) || count != sizeof(spos)) {
+#endif
return JUMPNRUN_LEVEL_LOAD_ERROR;
} else {
dest->start_pos.x = FIXED_POINT(spos[0] * JUMPNRUN_TILE_PIXEL_WIDTH , 0);
}
for(i = 0; i < dest->header.tile_count; ++i) {
+#ifdef __linux__
+ if(1 != fread(buf, 3, 1, fd)) {
+#else
if(FR_OK != f_read(fd, buf, sizeof(buf), &count) || count != sizeof(buf)) {
+#endif
return JUMPNRUN_LEVEL_LOAD_ERROR;
}
}
for(i = 0; i < dest->header.item_count; ++i) {
+#ifdef __linux__
+ if(1 != fread(buf, 3, 1, fd)) {
+#else
if(FR_OK != f_read(fd, buf, sizeof(buf), &count) || count != sizeof(buf)) {
+#endif
return JUMPNRUN_LEVEL_LOAD_ERROR;
}
}
for(i = 0; i < dest->header.enemy_count; ++i) {
+#ifdef __linux__
+ if(1 != fread(buf, 3, 1, fd)) {
+#else
if(FR_OK != f_read(fd, buf, sizeof(buf), &count) || count != sizeof(buf)) {
+#endif
return JUMPNRUN_LEVEL_LOAD_ERROR;
}