summary refs log tree commit diff stats
path: root/src/systems/playing.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-05-08 21:09:36 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-05-09 17:59:13 -0400
commit5c82f052c26303318e81ddd76475c1d188cc74f4 (patch)
tree3204ef94f2861224a380aa566728c02b4acd1fd9 /src/systems/playing.cpp
parent96e6f3231aed9919d660a06944f1d96dc8241f8e (diff)
downloadtherapy-5c82f052c26303318e81ddd76475c1d188cc74f4.tar.gz
therapy-5c82f052c26303318e81ddd76475c1d188cc74f4.tar.bz2
therapy-5c82f052c26303318e81ddd76475c1d188cc74f4.zip
Simplified positions/sizes with vectors
Positions and sizes are now stored as vectors (of doubles and ints, respectively). This allows for at least minor code simplification in many places, and cleans up the CollisionParams code in PonderingSystem quite a bit.
Diffstat (limited to 'src/systems/playing.cpp')
-rw-r--r--src/systems/playing.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/systems/playing.cpp b/src/systems/playing.cpp index acec4e7..dabc9a5 100644 --- a/src/systems/playing.cpp +++ b/src/systems/playing.cpp
@@ -42,10 +42,9 @@ void PlayingSystem::initPlayer()
42 auto& transformable = game_.getEntityManager(). 42 auto& transformable = game_.getEntityManager().
43 emplaceComponent<TransformableComponent>(player); 43 emplaceComponent<TransformableComponent>(player);
44 44
45 transformable.x = realizable.startingX; 45 transformable.pos = realizable.startingPos;
46 transformable.y = realizable.startingY; 46 transformable.size.w() = 10;
47 transformable.w = 10; 47 transformable.size.h() = 12;
48 transformable.h = 12;
49 48
50 game_.getSystemManager().getSystem<PonderingSystem>().initializeBody( 49 game_.getSystemManager().getSystem<PonderingSystem>().initializeBody(
51 player, 50 player,
@@ -59,8 +58,7 @@ void PlayingSystem::initPlayer()
59 58
60 playable.mapId = realizable.activeMap; 59 playable.mapId = realizable.activeMap;
61 playable.checkpointMapId = realizable.startingMapId; 60 playable.checkpointMapId = realizable.startingMapId;
62 playable.checkpointX = realizable.startingX; 61 playable.checkpointPos = realizable.startingPos;
63 playable.checkpointY = realizable.startingY;
64 62
65 realizing.enterActiveMap(player); 63 realizing.enterActiveMap(player);
66 64
@@ -70,8 +68,7 @@ void PlayingSystem::initPlayer()
70void PlayingSystem::changeMap( 68void PlayingSystem::changeMap(
71 id_type player, 69 id_type player,
72 size_t mapId, 70 size_t mapId,
73 double x, 71 vec2d warpPos)
74 double y)
75{ 72{
76 auto& playable = game_.getEntityManager(). 73 auto& playable = game_.getEntityManager().
77 getComponent<PlayableComponent>(player); 74 getComponent<PlayableComponent>(player);
@@ -103,8 +100,7 @@ void PlayingSystem::changeMap(
103 100
104 pondering.unferry(player); 101 pondering.unferry(player);
105 102
106 transformable.x = x; 103 transformable.pos = warpPos;
107 transformable.y = y;
108 104
109 if (realizable.activePlayer == player) 105 if (realizable.activePlayer == player)
110 { 106 {
@@ -139,8 +135,7 @@ void PlayingSystem::die(id_type player)
139 changeMap( 135 changeMap(
140 player, 136 player,
141 playable.checkpointMapId, 137 playable.checkpointMapId,
142 playable.checkpointX, 138 playable.checkpointPos);
143 playable.checkpointY);
144 139
145 animatable.frozen = false; 140 animatable.frozen = false;
146 animatable.flickering = false; 141 animatable.flickering = false;