From 2eaf76d1c9cab650fe67a3c4e439c6b6334c2d47 Mon Sep 17 00:00:00 2001 From: mathnerd314 Date: Thu, 24 Dec 2009 17:35:49 +0000 Subject: [PATCH] Change anim_fps to fps in snail (fixes sprite; frames could use some work maybe) and tileset. git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6224 837edb03-e0f3-0310-88ca-d4d4e8b29345 --- data/images/creatures/snail/snail.sprite | 3 +- data/images/tiles.strf | 112 +++++++++++++++---------------- src/supertux/tile.cpp | 8 +-- src/supertux/tile.hpp | 4 +- src/supertux/tile_set_parser.cpp | 14 ++-- 5 files changed, 71 insertions(+), 70 deletions(-) diff --git a/data/images/creatures/snail/snail.sprite b/data/images/creatures/snail/snail.sprite index e2d14359a..f9087d3ac 100644 --- a/data/images/creatures/snail/snail.sprite +++ b/data/images/creatures/snail/snail.sprite @@ -12,7 +12,7 @@ (mirror-action "left")) (action (name "flat-left") - (anim-fps 64.0) + (fps 64.0) (hitbox 2 3 31.8 31.8) (images "snowsnail_flip1.png" @@ -259,5 +259,6 @@ )) (action (name "flat-right") + (fps 64.0) (hitbox 2 3 31.8 31.8) (mirror-action "flat-left"))) diff --git a/data/images/tiles.strf b/data/images/tiles.strf index f010a74fc..78998fecf 100644 --- a/data/images/tiles.strf +++ b/data/images/tiles.strf @@ -755,7 +755,7 @@ (fullbox #t) (next-tile 84) (data 1) - (anim-fps 2) + (fps 2) ) (tiles (width 3) @@ -799,7 +799,7 @@ "objects/coin/coin-7.png" ) (coin #t) - (anim-fps 10) + (fps 10) ) (tile (id 47) @@ -971,7 +971,7 @@ "tiles/water/waves-2.png" ) (water #t) - (anim-fps 10) + (fps 10) ) (tile (id 77) @@ -1007,7 +1007,7 @@ "tiles/doodads/flag-0.png" "tiles/doodads/flag-1.png" ) - (anim-fps 10) + (fps 10) ) (tile ; dupe of tile 26, this one will be kept. @@ -1029,7 +1029,7 @@ (fullbox #t) (next-tile 84) (data 1) - (anim-fps 2) + (fps 2) ) (tile (id 84) @@ -1084,7 +1084,7 @@ (next-tile 84) (editor-images "objects/bonus_block/bonus-fire_flower.png") (data 2) - (anim-fps 2) + (fps 2) ) (tile (id 103) @@ -1106,7 +1106,7 @@ (next-tile 84) (editor-images "objects/bonus_block/bonus-herring.png") (data 3) - (anim-fps 2) + (fps 2) ) (tile (id 104) @@ -1189,7 +1189,7 @@ (next-tile 84) (editor-images "objects/bonus_block/bonus-1up.png") (data 4) - (anim-fps 2) + (fps 2) ) (tile (id 129) @@ -1207,7 +1207,7 @@ "tiles/goal/goal1-1.png" "tiles/goal/goal1-1.png" ) - (anim-fps 10) + (fps 10) ) (tile (id 130) @@ -1225,7 +1225,7 @@ "tiles/goal/goal2-1.png" "tiles/goal/goal2-1.png" ) - (anim-fps 10) + (fps 10) ) (tile (id 131) @@ -1289,7 +1289,7 @@ (next-tile 84) (editor-images "objects/bonus_block/bonus-ice_flower.png") (data 5) - (anim-fps 2) + (fps 2) ) (tiles @@ -1333,7 +1333,7 @@ (water #t) (hurts #t) (fire #t) - (anim-fps 10) + (fps 10) ) (tile (id 174) @@ -1346,7 +1346,7 @@ (water #t) (hurts #t) (fire #t) - (anim-fps 10) + (fps 10) ) (tiles (width 4) @@ -1371,7 +1371,7 @@ "tiles/waterfall/trans-3.png" "tiles/waterfall/trans-4.png" ) - (anim-fps 10) + (fps 10) ) (tile (id 195) @@ -1382,7 +1382,7 @@ "tiles/waterfall/waterfall1-0-4.png" ) (water #t) - (anim-fps 10) + (fps 10) ) (tile (id 196) @@ -1393,7 +1393,7 @@ "tiles/waterfall/waterfall1-5-4.png" ) (water #t) - (anim-fps 10) + (fps 10) ) (tile (id 197) @@ -1404,7 +1404,7 @@ "tiles/waterfall/waterfall0-0-4.png" ) (water #t) - (anim-fps 10) + (fps 10) ) (tile (id 198) @@ -1415,7 +1415,7 @@ "tiles/waterfall/waterfall0-1-4.png" ) (water #t) - (anim-fps 10) + (fps 10) ) (tile (id 199) @@ -1426,7 +1426,7 @@ "tiles/waterfall/waterfall0-2-4.png" ) (water #t) - (anim-fps 10) + (fps 10) ) (tile (id 200) @@ -1443,7 +1443,7 @@ "tiles/water/waves-trans-2.png" ) (water #t) - (anim-fps 10) + (fps 10) ) (tiles (width 1) @@ -1483,7 +1483,7 @@ "tiles/waterfall/waterfall-3.png" "tiles/waterfall/waterfall-4.png" ) - (anim-fps 10) + (fps 10) ) (tile (id 295) @@ -1557,7 +1557,7 @@ "tiles/jungle/jungle12-2.png" ) (solid #t) - (anim-fps 10) + (fps 10) ) (tiles (width 2) @@ -2010,7 +2010,7 @@ "objects/particles/rainsplash-3.png" "objects/particles/rainsplash-4.png" "tiles/auxiliary/blank.png") - (anim-fps 18) + (fps 18) ) (tile (id 1314) @@ -2020,7 +2020,7 @@ "objects/particles/rainsplash-4.png" "tiles/auxiliary/blank.png" "objects/particles/rainsplash-1.png") - (anim-fps 20) + (fps 20) ) (tile (id 1315) @@ -2030,7 +2030,7 @@ "tiles/auxiliary/blank.png" "objects/particles/rainsplash-1.png" "objects/particles/rainsplash-2.png") - (anim-fps 22) + (fps 22) ) (tile (id 1316) @@ -2040,7 +2040,7 @@ "objects/particles/rainsplash-1.png" "objects/particles/rainsplash-2.png" "objects/particles/rainsplash-3.png") - (anim-fps 24) + (fps 24) ) (tile (id 1317) @@ -2050,7 +2050,7 @@ "objects/particles/rainsplash-vertical-3.png" "objects/particles/rainsplash-vertical-4.png" "tiles/auxiliary/blank.png") - (anim-fps 21) + (fps 21) ) (tile (id 1318) @@ -2060,7 +2060,7 @@ "objects/particles/rainsplash-vertical-4.png" "tiles/auxiliary/blank.png" "objects/particles/rainsplash-vertical-1.png") - (anim-fps 19) + (fps 19) ) (tile (id 1319) @@ -2070,7 +2070,7 @@ "tiles/auxiliary/blank.png" "objects/particles/rainsplash-vertical-1.png" "objects/particles/rainsplash-vertical-2.png") - (anim-fps 17) + (fps 17) ) (tile (id 1320) @@ -2080,7 +2080,7 @@ "objects/particles/rainsplash-vertical-1.png" "objects/particles/rainsplash-vertical-2.png" "objects/particles/rainsplash-vertical-3.png") - (anim-fps 15) + (fps 15) ) (tiles (width 4) @@ -2214,7 +2214,7 @@ "tiles/water/electrified-0.png" "tiles/water/electrified-1.png" ) - (anim-fps 10) + (fps 10) (hurts #t) (water #t) ) @@ -2224,7 +2224,7 @@ "tiles/water/electrified_waves-0.png" "tiles/water/electrified_waves-1.png" ) - (anim-fps 10) + (fps 10) (hurts #t) (water #t) ) @@ -2324,7 +2324,7 @@ "tiles/castle/walltorch/flame-6.png" "tiles/castle/walltorch/flame-6.png" ) - (anim-fps 10) + (fps 10) ) (tile (id 1518) @@ -2387,7 +2387,7 @@ "tiles/forest/pogonia/pogonia-4.png") (hurts #t) (solid #f) - (anim-fps 2) + (fps 2) ) (tiles @@ -2408,7 +2408,7 @@ "tiles/forest/pogonia/pogonia-4-flip.png") (hurts #t) (solid #f) - (anim-fps 2) + (fps 2) ) (tiles (width 2) @@ -2523,7 +2523,7 @@ (hurts #t) (fire #t) (solid #f) - (anim-fps 2) + (fps 2) ) (tile (id 1701) @@ -2535,7 +2535,7 @@ (hurts #t) (fire #t) (solid #f) - (anim-fps 2) + (fps 2) ) (tile (id 1702) @@ -2551,7 +2551,7 @@ (hurts #t) (fire #t) (solid #f) - (anim-fps 2) + (fps 2) ) (tile (id 1703) @@ -2567,7 +2567,7 @@ (hurts #t) (fire #t) (solid #f) - (anim-fps 2) + (fps 2) ) (tile (id 1704) @@ -2584,7 +2584,7 @@ (hurts #t) (fire #t) (solid #f) - (anim-fps 2) + (fps 2) ) (tile (id 1705) @@ -2596,7 +2596,7 @@ (hurts #t) (fire #t) (solid #f) - (anim-fps 2) + (fps 2) ) (tile (id 1706) @@ -2608,7 +2608,7 @@ (hurts #t) (fire #t) (solid #f) - (anim-fps 2) + (fps 2) ) (tile (id 1707) @@ -2620,7 +2620,7 @@ (hurts #t) (fire #t) (solid #f) - (anim-fps 2) + (fps 2) ) (tile (id 1708) @@ -2630,7 +2630,7 @@ "tiles/lava/zone/surface-1-3.png" "tiles/lava/zone/surface-1-4.png") (solid #f) - (anim-fps 2) + (fps 2) ) (tile (id 1709) @@ -2642,7 +2642,7 @@ (hurts #t) (fire #t) (solid #f) - (anim-fps 2) + (fps 2) ) (tile (id 1710) @@ -2654,7 +2654,7 @@ (hurts #t) (fire #t) (solid #f) - (anim-fps 2) + (fps 2) ) (tile (id 1711) @@ -2666,7 +2666,7 @@ (hurts #t) (fire #t) (solid #f) - (anim-fps 2) + (fps 2) ) (tile (id 1712) @@ -2678,7 +2678,7 @@ (hurts #t) (fire #t) (solid #f) - (anim-fps 2) + (fps 2) ) (tile (id 1713) @@ -2690,7 +2690,7 @@ (hurts #t) (fire #t) (solid #f) - (anim-fps 2) + (fps 2) ) (tile (id 1714) @@ -2706,7 +2706,7 @@ (hurts #t) (fire #t) (solid #f) - (anim-fps 2) + (fps 2) ) (tile (id 1715) @@ -2722,7 +2722,7 @@ (hurts #t) (fire #t) (solid #f) - (anim-fps 2) + (fps 2) ) (tile @@ -2740,7 +2740,7 @@ (hurts #t) (fire #t) (solid #f) - (anim-fps 2) + (fps 2) ) (tiles (width 5) @@ -2810,7 +2810,7 @@ ) (hurts #f) (solid #f) - (anim-fps 2)) + (fps 2)) (tile (id 1736) (images @@ -2821,7 +2821,7 @@ ) (hurts #t) (solid #f) - (anim-fps 2)) + (fps 2)) (tiles (width 1) (height 3) @@ -3194,7 +3194,7 @@ "tiles/water/antarctic-7.png" "tiles/water/antarctic-8.png" ) - (anim-fps 16) + (fps 16) ) (tile (id 2020) @@ -3250,7 +3250,7 @@ "tiles/lava/lava-7.png" "tiles/lava/lava-8.png" ) - (anim-fps 16) + (fps 16) ) (tiles diff --git a/src/supertux/tile.cpp b/src/supertux/tile.cpp index 660dbf311..3d5ec4df7 100644 --- a/src/supertux/tile.cpp +++ b/src/supertux/tile.cpp @@ -26,18 +26,18 @@ Tile::Tile(const TileSet& new_tileset) : images(), attributes(0), data(0), - anim_fps(1) + fps(1) { } Tile::Tile(const TileSet& new_tileset, const std::vector& imagespecs_, - uint32_t attributes, uint32_t data, float animfps) : + uint32_t attributes, uint32_t data, float fps) : tileset(new_tileset), imagespecs(imagespecs_), images(), attributes(attributes), data(data), - anim_fps(animfps) + fps(fps) { correct_attributes(); } @@ -78,7 +78,7 @@ void Tile::draw(DrawingContext& context, const Vector& pos, int z_pos) const { if(images.size() > 1) { - size_t frame = size_t(game_time * anim_fps) % images.size(); + size_t frame = size_t(game_time * fps) % images.size(); context.draw_surface(images[frame], pos, z_pos); } else if (images.size() == 1) { context.draw_surface(images[0], pos, z_pos); diff --git a/src/supertux/tile.hpp b/src/supertux/tile.hpp index 7ba7167d7..b2d2ae238 100644 --- a/src/supertux/tile.hpp +++ b/src/supertux/tile.hpp @@ -102,12 +102,12 @@ private: /** General purpose data attached to a tile (content of a box, type of coin)*/ int data; - float anim_fps; + float fps; public: Tile(const TileSet& tileset); Tile(const TileSet& tileset, const std::vector& images, - uint32_t attributes, uint32_t data, float animfps); + uint32_t attributes, uint32_t data, float fps); ~Tile(); /** load Surfaces, if not already loaded */ diff --git a/src/supertux/tile_set_parser.cpp b/src/supertux/tile_set_parser.cpp index 5163901b0..484c7a275 100644 --- a/src/supertux/tile_set_parser.cpp +++ b/src/supertux/tile_set_parser.cpp @@ -82,7 +82,7 @@ TileSetParser::parse_tile(const Reader& reader) uint32_t data = 0; std::vector imagespecs; - float anim_fps = 10; + float fps = 10; bool value = false; if(reader.get("solid", value) && value) @@ -118,7 +118,7 @@ TileSetParser::parse_tile(const Reader& reader) data |= Tile::WORLDMAP_STOP; reader.get("data", data); - reader.get("anim-fps", anim_fps); + reader.get("fps", fps); if(reader.get("slope-type", data)) { @@ -139,7 +139,7 @@ TileSetParser::parse_tile(const Reader& reader) } #endif - std::auto_ptr tile(new Tile(m_tileset, imagespecs, attributes, data, anim_fps)); + std::auto_ptr tile(new Tile(m_tileset, imagespecs, attributes, data, fps)); if (id >= m_tileset.tiles.size()) m_tileset.tiles.resize(id+1, 0); @@ -230,14 +230,14 @@ TileSetParser::parse_tiles(const Reader& reader) reader.get("width", width); reader.get("height", height); - float animfps = 10; - reader.get("anim-fps", animfps); + float fps = 10; + reader.get("fps", fps); if (images.size() <= 0) { throw std::runtime_error("No images in tile."); } - else if (animfps < 0) + else if (fps < 0) { throw std::runtime_error("Negative fps."); } @@ -281,7 +281,7 @@ TileSetParser::parse_tiles(const Reader& reader) } std::auto_ptr tile(new Tile(m_tileset, imagespecs, - (has_attributes ? attributes[i] : 0), (has_datas ? datas[i] : 0), animfps)); + (has_attributes ? attributes[i] : 0), (has_datas ? datas[i] : 0), fps)); if (m_tileset.tiles[ids[i]] == 0) { m_tileset.tiles[ids[i]] = tile.release(); } else { -- 2.11.0