From 470b1d43fb6f8e17624ee90f87270de5bd6ff77e Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 13 Feb 2021 20:50:21 -0500 Subject: Added lightning sprite to mailbox event Sprites can be destroyed now, which really just means that their index is removed from the list of active sprites. The actual memory is not freed until all sprites are deleted on map change. Sprite layers are introduced. All sprites by default are on layer 0 (Normal) which renders them in between the lower and upper map layers. There is also a layer 1 (Above) that renders above the upper map layer, and the sprite for the lightning strike uses this layer in order to not be hidden by the trees. Fixed a bug where waiting for the end of a non-looping animation would trip the flag immediately upon the final frame activating, instead of waiting the length of the last frame. --- src/game.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/game.h') diff --git a/src/game.h b/src/game.h index 84114ca..c7926bf 100644 --- a/src/game.h +++ b/src/game.h @@ -6,6 +6,7 @@ #include #include #include +#include #include "sprite.h" #include "map.h" #include "consts.h" @@ -45,6 +46,8 @@ public: int emplaceSprite(std::string alias); + void destroySprite(int id); + const Sprite& getSprite(int id) const { return sprites_.at(id); } @@ -53,7 +56,7 @@ public: return sprites_.at(id); } - const std::vector& getSprites() { + const std::set& getSprites() { return spriteIds_; } @@ -93,7 +96,7 @@ private: std::list> systems_; std::map systemByKey_; - std::vector spriteIds_; + std::set spriteIds_; std::vector sprites_; std::map spritesByAlias_; std::unique_ptr map_; -- cgit 1.4.1