Kaninchen aus mock übernommen
authorWintermute <wintermute@hannover.ccc.de>
Sun, 13 Oct 2013 17:57:49 +0000 (19:57 +0200)
committerWintermute <wintermute@hannover.ccc.de>
Sun, 13 Oct 2013 17:57:49 +0000 (19:57 +0200)
Makefile
badge/init.c
badge/jumpnrun/enemies.c
badge/jumpnrun/enemies.h
badge/jumpnrun/level_load.c
badge/main.c

index 58aaa5b..0abe529 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -24,7 +24,7 @@ DEBUGBUILD = FALSE
 # IDE Flags (Keeps various IDEs happy)\r
 ##########################################################################\r
 \r
-OPTDEFINES = -D __NEWLIB__ -DHOB_REV2\r
+OPTDEFINES = -D __NEWLIB__ -DR0KET\r
 \r
 ##########################################################################\r
 # Project-specific files \r
index bb49df1..cc4d044 100644 (file)
@@ -13,7 +13,7 @@ static void badge_init_backlight(void) {
   SCB_CLKOUTCLKSEL = SCB_MAINCLKSEL_SOURCE_WDTOSC;
   SCB_CLKOUTCLKUEN = SCB_CLKOUTCLKUEN_DISABLE;
   SCB_CLKOUTCLKUEN = SCB_CLKOUTCLKUEN_UPDATE;
-  SCB_CLKOUTCLKDIV = 30;
+  SCB_CLKOUTCLKDIV = 75;
 }
 
 void badge_init(void) {
index ac5dd98..70461b6 100644 (file)
@@ -20,6 +20,14 @@ static badge_sprite const anim_mushroom[] = {
   { 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,
@@ -134,5 +142,11 @@ jumpnrun_enemy_type const jumpnrun_enemy_type_data[JUMPNRUN_ENEMY_TYPE_COUNT] =
     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
   }
 };
index 8277e69..cb88647 100644 (file)
@@ -56,6 +56,7 @@ enum {
 enum {
   JUMPNRUN_ENEMY_TYPE_CAT,
   JUMPNRUN_ENEMY_TYPE_MUSHROOM,
+  JUMPNRUN_ENEMY_TYPE_KANINCHEN,
 
   JUMPNRUN_ENEMY_TYPE_COUNT
 };
index c2f9dfe..180b33d 100644 (file)
@@ -3,7 +3,9 @@
 #include "items.h"
 #include "enemies.h"
 
+#ifndef __linux__
 #include <drivers/fatfs/ff.h>
+#endif
 
 #include <stdio.h>
 
@@ -47,11 +49,19 @@ static void jumpnrun_level_make_enemy(jumpnrun_enemy *dest, level_thing thing) {
   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;
   }
 
@@ -62,13 +72,21 @@ int jumpnrun_load_level_header_from_file(jumpnrun_level *dest, FIL *fd) {
   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);
@@ -76,7 +94,11 @@ int jumpnrun_load_level_from_file(jumpnrun_level *dest, FIL *fd) {
   }
 
   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;
     }
 
@@ -89,7 +111,11 @@ int jumpnrun_load_level_from_file(jumpnrun_level *dest, FIL *fd) {
   }
 
   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;
     }
 
@@ -102,7 +128,11 @@ int jumpnrun_load_level_from_file(jumpnrun_level *dest, FIL *fd) {
   }
 
   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;
     }
 
index 5f7fde3..93a243c 100644 (file)
@@ -203,6 +203,7 @@ int main(void)
   badge_init();
 #endif
 
+  /*
   for(uint8_t i = 1; ; ++i) {
     badge_framebuffer fb = { { { 0 } } };
 
@@ -216,7 +217,7 @@ int main(void)
     badge_framebuffer_flush(&fb);
     systickDelay(200);
   }
-
+  */
   {
     //    f_mkfs(0, 1, 0);
     badge_framebuffer fb;
This page took 0.032058 seconds and 4 git commands to generate.