diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-18 12:37:22 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-18 12:37:22 -0500 |
commit | 027166a0efa4b91b4c400ef253a4b51dcea8cb6c (patch) | |
tree | 6cbe92e9dc499828ef4376fe8c15fe7f21adaa68 /src | |
parent | c1a62ba1459cf849b5ee965aa461e10695bb0b01 (diff) | |
download | tanetane-027166a0efa4b91b4c400ef253a4b51dcea8cb6c.tar.gz tanetane-027166a0efa4b91b4c400ef253a4b51dcea8cb6c.tar.bz2 tanetane-027166a0efa4b91b4c400ef253a4b51dcea8cb6c.zip |
Spawnblocked map sprites with already-used names
i.e. Map prototypes and triggers will not be instantiated upon loading the map if there is a persistent sprite with the same name. This is important because the Claus that joins your party is originally a map prototype.
Diffstat (limited to 'src')
-rw-r--r-- | src/game.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/game.cpp b/src/game.cpp index ffa52cf..dbd314a 100644 --- a/src/game.cpp +++ b/src/game.cpp | |||
@@ -52,6 +52,8 @@ void Game::loadMap(std::string filename) { | |||
52 | map_ = std::make_unique<Map>(filename); | 52 | map_ = std::make_unique<Map>(filename); |
53 | 53 | ||
54 | for (const Prototype& p : map_->getPrototypes()) { | 54 | for (const Prototype& p : map_->getPrototypes()) { |
55 | if (spritesByAlias_.count(p.name)) continue; | ||
56 | |||
55 | int spriteId = emplaceSprite(p.name); | 57 | int spriteId = emplaceSprite(p.name); |
56 | getSystem<TransformSystem>().initSprite(spriteId, p.pos); | 58 | getSystem<TransformSystem>().initSprite(spriteId, p.pos); |
57 | getSystem<TransformSystem>().setUpCollision(spriteId, p.collisionOffset, p.collisionSize, true); | 59 | getSystem<TransformSystem>().setUpCollision(spriteId, p.collisionOffset, p.collisionSize, true); |
@@ -63,6 +65,8 @@ void Game::loadMap(std::string filename) { | |||
63 | } | 65 | } |
64 | 66 | ||
65 | for (const Trigger& t : map_->getTriggers()) { | 67 | for (const Trigger& t : map_->getTriggers()) { |
68 | if (spritesByAlias_.count(t.name)) continue; | ||
69 | |||
66 | int spriteId = emplaceSprite(t.name); | 70 | int spriteId = emplaceSprite(t.name); |
67 | getSystem<TransformSystem>().initSprite(spriteId, t.pos); | 71 | getSystem<TransformSystem>().initSprite(spriteId, t.pos); |
68 | getSystem<TransformSystem>().setUpCollision(spriteId, {0, 0}, t.size, false); | 72 | getSystem<TransformSystem>().setUpCollision(spriteId, {0, 0}, t.size, false); |