X-Git-Url: https://git.rohieb.name/hackover2013-badge-firmware.git/blobdiff_plain/875a5450a1974299bbfad500c4b0d5eedb60fc7c..c63dbfcb347e10f9406053545eaf44dd4d9d9bdb:/mock/tools/level-converter.cc diff --git a/mock/tools/level-converter.cc b/mock/tools/level-converter.cc index d99928c..54be8f7 100644 --- a/mock/tools/level-converter.cc +++ b/mock/tools/level-converter.cc @@ -18,9 +18,11 @@ extern "C" { #include enum { - LEVEL_LINE_COUNT = 13 + LEVEL_LINE_COUNT = 14 }; +#define PATH_PREFIX "../badge/jumpnrun/" + namespace jnrcpp { struct descriptors { descriptors() { @@ -31,16 +33,32 @@ namespace jnrcpp { ("tube_right" , JUMPNRUN_TILE_TYPE_TUBE_RIGHT ) ("brick" , JUMPNRUN_TILE_TYPE_BRICK ) ("square" , JUMPNRUN_TILE_TYPE_SQUARE ) + ("spike_up" , JUMPNRUN_TILE_TYPE_SPIKE_UP ) + ("spike_right" , JUMPNRUN_TILE_TYPE_SPIKE_RIGHT ) + ("spike_down" , JUMPNRUN_TILE_TYPE_SPIKE_DOWN ) + ("spike_left" , JUMPNRUN_TILE_TYPE_SPIKE_LEFT ) ; items.add - ("doc", JUMPNRUN_ITEM_TYPE_DOCUMENT) + ("doc" , JUMPNRUN_ITEM_TYPE_DOCUMENT ) + ("checkpoint" , JUMPNRUN_ITEM_TYPE_CHECKPOINT ) + ("key" , JUMPNRUN_ITEM_TYPE_KEY ) + ("doc_encrypted", JUMPNRUN_ITEM_TYPE_ENCRYPTED_DOCUMENT) ; enemies.add - ("cat" , JUMPNRUN_ENEMY_TYPE_CAT ) - ("mushroom" , JUMPNRUN_ENEMY_TYPE_MUSHROOM ) - ("kaninchen", JUMPNRUN_ENEMY_TYPE_KANINCHEN) + ("cat" , JUMPNRUN_ENEMY_TYPE_CAT ) + ("mushroom" , JUMPNRUN_ENEMY_TYPE_MUSHROOM ) + ("bunny" , JUMPNRUN_ENEMY_TYPE_BUNNY ) + ("kaninchen" , JUMPNRUN_ENEMY_TYPE_BUNNY ) // legacy + ("snake" , JUMPNRUN_ENEMY_TYPE_SNAKE ) + ("spiral" , JUMPNRUN_ENEMY_TYPE_SPIRAL ) + ("rotor" , JUMPNRUN_ENEMY_TYPE_ROTOR ) + ("dog" , JUMPNRUN_ENEMY_TYPE_DOG ) + ("giraffe" , JUMPNRUN_ENEMY_TYPE_GIRAFFE ) + ("bird" , JUMPNRUN_ENEMY_TYPE_BIRD ) + ("bird_straight", JUMPNRUN_ENEMY_TYPE_BIRD_STRAIGHT) + ("bird_dip" , JUMPNRUN_ENEMY_TYPE_BIRD_DIP ) ; } @@ -51,10 +69,10 @@ namespace jnrcpp { struct level_name_map { level_name_map() { - std::ifstream in("jumpnrun/levels.txt"); + std::ifstream in(PATH_PREFIX "levels.txt"); if(!in) { - throw std::logic_error("jumpnrun/levels.txt konnte nicht geöffnet werden."); + throw std::logic_error(PATH_PREFIX "levels.txt konnte nicht geöffnet werden."); } std::string name; @@ -74,7 +92,7 @@ namespace jnrcpp { : name(name), level_lines(LEVEL_LINE_COUNT) { - std::ifstream in(("jumpnrun/" + name + ".lv").c_str()); + std::ifstream in((PATH_PREFIX + name + ".lv").c_str()); if(!in) { throw std::invalid_argument("Could not open file: " + name + ".lv"); @@ -238,7 +256,7 @@ namespace jnrcpp { void jumpnrun_level_dump(size_t level) { std::string name = jnrcpp::level_names.names[level]; jnrcpp::level lv(name); - std::ofstream out(("jumpnrun/" + name + ".lvl").c_str()); + std::ofstream out((PATH_PREFIX + name + ".lvl").c_str()); lv.dump(out); }