diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-05-13 11:00:02 -0400 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-05-17 15:39:39 -0400 |
| commit | 046ee24a341468e9b3ea2983a731dbce18b52ac6 (patch) | |
| tree | 554a645bbc9dac63433cf06e1a5168eb2551d02a /src/systems/playing.cpp | |
| parent | 5269e7c09a0b17c8c972c8ad996b04d42dbcd9cb (diff) | |
| download | therapy-046ee24a341468e9b3ea2983a731dbce18b52ac6.tar.gz therapy-046ee24a341468e9b3ea2983a731dbce18b52ac6.tar.bz2 therapy-046ee24a341468e9b3ea2983a731dbce18b52ac6.zip | |
Integrated RealizableComponent into RealizingSystem
Diffstat (limited to 'src/systems/playing.cpp')
| -rw-r--r-- | src/systems/playing.cpp | 26 |
1 files changed, 9 insertions, 17 deletions
| diff --git a/src/systems/playing.cpp b/src/systems/playing.cpp index dabc9a5..6652099 100644 --- a/src/systems/playing.cpp +++ b/src/systems/playing.cpp | |||
| @@ -5,7 +5,6 @@ | |||
| 5 | #include "components/playable.h" | 5 | #include "components/playable.h" |
| 6 | #include "components/controllable.h" | 6 | #include "components/controllable.h" |
| 7 | #include "components/orientable.h" | 7 | #include "components/orientable.h" |
| 8 | #include "components/realizable.h" | ||
| 9 | #include "systems/mapping.h" | 8 | #include "systems/mapping.h" |
| 10 | #include "systems/pondering.h" | 9 | #include "systems/pondering.h" |
| 11 | #include "systems/orienting.h" | 10 | #include "systems/orienting.h" |
| @@ -36,13 +35,10 @@ void PlayingSystem::initPlayer() | |||
| 36 | 35 | ||
| 37 | auto& realizing = game_.getSystemManager().getSystem<RealizingSystem>(); | 36 | auto& realizing = game_.getSystemManager().getSystem<RealizingSystem>(); |
| 38 | 37 | ||
| 39 | auto& realizable = game_.getEntityManager(). | ||
| 40 | getComponent<RealizableComponent>(realizing.getSingleton()); | ||
| 41 | |||
| 42 | auto& transformable = game_.getEntityManager(). | 38 | auto& transformable = game_.getEntityManager(). |
| 43 | emplaceComponent<TransformableComponent>(player); | 39 | emplaceComponent<TransformableComponent>(player); |
| 44 | 40 | ||
| 45 | transformable.pos = realizable.startingPos; | 41 | transformable.pos = realizing.getStartingPos(); |
| 46 | transformable.size.w() = 10; | 42 | transformable.size.w() = 10; |
| 47 | transformable.size.h() = 12; | 43 | transformable.size.h() = 12; |
| 48 | 44 | ||
| @@ -56,13 +52,13 @@ void PlayingSystem::initPlayer() | |||
| 56 | auto& playable = game_.getEntityManager(). | 52 | auto& playable = game_.getEntityManager(). |
| 57 | emplaceComponent<PlayableComponent>(player); | 53 | emplaceComponent<PlayableComponent>(player); |
| 58 | 54 | ||
| 59 | playable.mapId = realizable.activeMap; | 55 | playable.mapId = realizing.getActiveMap(); |
| 60 | playable.checkpointMapId = realizable.startingMapId; | 56 | playable.checkpointMapId = realizing.getStartingMapId(); |
| 61 | playable.checkpointPos = realizable.startingPos; | 57 | playable.checkpointPos = realizing.getStartingPos(); |
| 62 | 58 | ||
| 63 | realizing.enterActiveMap(player); | 59 | realizing.enterActiveMap(player); |
| 64 | 60 | ||
| 65 | realizable.activePlayer = player; | 61 | realizing.setActivePlayer(player); |
| 66 | } | 62 | } |
| 67 | 63 | ||
| 68 | void PlayingSystem::changeMap( | 64 | void PlayingSystem::changeMap( |
| @@ -77,20 +73,16 @@ void PlayingSystem::changeMap( | |||
| 77 | getComponent<TransformableComponent>(player); | 73 | getComponent<TransformableComponent>(player); |
| 78 | 74 | ||
| 79 | auto& pondering = game_.getSystemManager().getSystem<PonderingSystem>(); | 75 | auto& pondering = game_.getSystemManager().getSystem<PonderingSystem>(); |
| 80 | |||
| 81 | auto& realizing = game_.getSystemManager().getSystem<RealizingSystem>(); | 76 | auto& realizing = game_.getSystemManager().getSystem<RealizingSystem>(); |
| 82 | 77 | ||
| 83 | auto& realizable = game_.getEntityManager(). | 78 | id_type newMapEntity = realizing.getEntityByMapId(mapId); |
| 84 | getComponent<RealizableComponent>(realizing.getSingleton()); | ||
| 85 | |||
| 86 | id_type newMapEntity = realizable.entityByMapId[mapId]; | ||
| 87 | 79 | ||
| 88 | if (playable.mapId != newMapEntity) | 80 | if (playable.mapId != newMapEntity) |
| 89 | { | 81 | { |
| 90 | if (playable.mapId == realizable.activeMap) | 82 | if (playable.mapId == realizing.getActiveMap()) |
| 91 | { | 83 | { |
| 92 | realizing.leaveActiveMap(player); | 84 | realizing.leaveActiveMap(player); |
| 93 | } else if (newMapEntity == realizable.activeMap) | 85 | } else if (newMapEntity == realizing.getActiveMap()) |
| 94 | { | 86 | { |
| 95 | realizing.enterActiveMap(player); | 87 | realizing.enterActiveMap(player); |
| 96 | } | 88 | } |
| @@ -102,7 +94,7 @@ void PlayingSystem::changeMap( | |||
| 102 | 94 | ||
| 103 | transformable.pos = warpPos; | 95 | transformable.pos = warpPos; |
| 104 | 96 | ||
| 105 | if (realizable.activePlayer == player) | 97 | if (realizing.getActivePlayer() == player) |
| 106 | { | 98 | { |
| 107 | realizing.loadMap(newMapEntity); | 99 | realizing.loadMap(newMapEntity); |
| 108 | } | 100 | } |
