diff --git a/assets/animations.json b/assets/animations.json index 95f228b..27ba938 100644 --- a/assets/animations.json +++ b/assets/animations.json @@ -194,5 +194,19 @@ "stationary": true, "toggled": false, "looped": true + }, + "test_floor": { + "_type": "Animation", + "easing": 0, + "ease_rate": 0.5, + "scale_x": 1.0, + "scale_y": 1.0, + "max_scale": 0.4, + "simple": true, + "frames": 1, + "speed": 1.0, + "stationary": true, + "toggled": false, + "looped": false } } diff --git a/assets/config.json b/assets/config.json index 195ec1f..17eafe5 100644 --- a/assets/config.json +++ b/assets/config.json @@ -261,9 +261,9 @@ "frame_height": 832 }, "test_floor": - {"path": "assets/boss2/boss_fight_scene_1_floor.png", - "frame_width": 1080, - "frame_height": 720 + {"path": "assets/bossfights/test_floor.png", + "frame_width": 1920, + "frame_height": 1080 }, "test_player": {"path": "assets/bossfights/test_player.png", diff --git a/components.hpp b/components.hpp index 359ba61..d91b522 100644 --- a/components.hpp +++ b/components.hpp @@ -83,8 +83,6 @@ namespace components { struct AnimatedScene { std::string background; - std::optional floor; - std::string floor_pos; json actors; json fixtures; }; @@ -151,7 +149,7 @@ namespace components { using ComponentMap = std::unordered_map; ENROLL_COMPONENT(Tile, display, foreground, background); - ENROLL_COMPONENT(AnimatedScene, background, floor, floor_pos, actors, fixtures); + ENROLL_COMPONENT(AnimatedScene, background, actors, fixtures); ENROLL_COMPONENT(Sprite, name, scale); ENROLL_COMPONENT(Curative, hp); ENROLL_COMPONENT(LightSource, strength, radius); diff --git a/scene.cpp b/scene.cpp index 5f345b2..3313b4b 100644 --- a/scene.cpp +++ b/scene.cpp @@ -20,6 +20,7 @@ namespace scene { float x = config["x"]; float y = config["y"]; + // BUG: need to make animation optional auto anim = animation::load(sprite_name); if(and_play) anim.play(); anim.scale_x = scale_x; @@ -42,11 +43,6 @@ namespace scene { $actor_name_ids.try_emplace(element.name, $actors.size() - 1); } - // floor is std::optional - if($scene.floor) { - $floor_sprite = textures::get_sprite(*$scene.floor); - } - for(auto& fixture : $scene.fixtures) { auto element = config_scene_element(fixture, true, true); $fixtures.push_back(element); @@ -68,10 +64,6 @@ namespace scene { "[floor4|player5|player6|player7|player8|_]" ); - if($scene.floor) { - position_sprite($floor_sprite, $scene.floor_pos, 1.0f, 1.0f, false); - } - for(auto& actor : $actors) { actor.pos = position_sprite(actor.st, actor.cell, actor.scale_x, actor.scale_y, false, actor.x, actor.y); @@ -88,10 +80,6 @@ namespace scene { } void Engine::render(sf::RenderWindow& window) { - if($floor_sprite.sprite) { - window.draw(*$floor_sprite.sprite); - } - $ui.render(window); for(auto& fixture : $fixtures) { @@ -99,7 +87,7 @@ namespace scene { } for(auto& actor : $actors) { - window.draw(*actor.st.sprite); + window.draw(*actor.st.sprite); } if(DEBUG) $ui.debug_layout(window); diff --git a/scene.hpp b/scene.hpp index 929de1b..d74966e 100644 --- a/scene.hpp +++ b/scene.hpp @@ -25,7 +25,6 @@ namespace scene { struct Engine { guecs::UI $ui; - SpriteTexture $floor_sprite; components::AnimatedScene& $scene; std::unordered_map $actor_name_ids; std::vector $fixtures; diff --git a/tests/components.cpp b/tests/components.cpp index e888e4d..cfa1a06 100644 --- a/tests/components.cpp +++ b/tests/components.cpp @@ -37,8 +37,6 @@ TEST_CASE("make sure json_mods works", "[components]") { for(auto& comp_data : config["RAT_KING"]["components"]) { if(comp_data["_type"] == "AnimatedScene") { auto comp = components::convert(comp_data); - // the boss fight for the rat king doesn't have a stage so false=optional - REQUIRE(comp.floor == std::nullopt); } } @@ -49,7 +47,5 @@ TEST_CASE("make sure json_mods works", "[components]") { auto rat_king = world.entity(); components::configure_entity(world, rat_king, config["RAT_KING"]["components"]); - auto boss = world.get(rat_king); - REQUIRE(boss.floor == std::nullopt); }