diff options
Diffstat (limited to 'src/systems/realizing.cpp')
-rw-r--r-- | src/systems/realizing.cpp | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/src/systems/realizing.cpp b/src/systems/realizing.cpp index 8e670ac..f9285ad 100644 --- a/src/systems/realizing.cpp +++ b/src/systems/realizing.cpp | |||
@@ -93,20 +93,20 @@ void parseAI( | |||
93 | 93 | ||
94 | if (direction == "left") | 94 | if (direction == "left") |
95 | { | 95 | { |
96 | action.speedX = -speed; | 96 | action.speed.x() = -speed; |
97 | action.speedY = 0; | 97 | action.speed.y() = 0; |
98 | } else if (direction == "right") | 98 | } else if (direction == "right") |
99 | { | 99 | { |
100 | action.speedX = speed; | 100 | action.speed.x() = speed; |
101 | action.speedY = 0; | 101 | action.speed.y() = 0; |
102 | } else if (direction == "up") | 102 | } else if (direction == "up") |
103 | { | 103 | { |
104 | action.speedX = 0; | 104 | action.speed.x() = 0; |
105 | action.speedY = -speed; | 105 | action.speed.y() = -speed; |
106 | } else if (direction == "down") | 106 | } else if (direction == "down") |
107 | { | 107 | { |
108 | action.speedX = 0; | 108 | action.speed.x() = 0; |
109 | action.speedY = speed; | 109 | action.speed.y() = speed; |
110 | } | 110 | } |
111 | 111 | ||
112 | action.dur = length / speed; | 112 | action.dur = length / speed; |
@@ -186,11 +186,11 @@ EntityManager::id_type RealizingSystem::initSingleton( | |||
186 | } | 186 | } |
187 | 187 | ||
188 | key = getProp(top, "startx"); | 188 | key = getProp(top, "startx"); |
189 | realizable.startingX = atoi(reinterpret_cast<char*>(key)); | 189 | realizable.startingPos.x() = atoi(reinterpret_cast<char*>(key)); |
190 | xmlFree(key); | 190 | xmlFree(key); |
191 | 191 | ||
192 | key = getProp(top, "starty"); | 192 | key = getProp(top, "starty"); |
193 | realizable.startingY = atoi(reinterpret_cast<char*>(key)); | 193 | realizable.startingPos.y() = atoi(reinterpret_cast<char*>(key)); |
194 | xmlFree(key); | 194 | xmlFree(key); |
195 | 195 | ||
196 | key = getProp(top, "startmap"); | 196 | key = getProp(top, "startmap"); |
@@ -260,11 +260,11 @@ EntityManager::id_type RealizingSystem::initSingleton( | |||
260 | emplaceComponent<TransformableComponent>(mapObject); | 260 | emplaceComponent<TransformableComponent>(mapObject); |
261 | 261 | ||
262 | key = getProp(mapNode, "x"); | 262 | key = getProp(mapNode, "x"); |
263 | transformable.origX = atoi(reinterpret_cast<char*>(key)); | 263 | transformable.origPos.x() = atoi(reinterpret_cast<char*>(key)); |
264 | xmlFree(key); | 264 | xmlFree(key); |
265 | 265 | ||
266 | key = getProp(mapNode, "y"); | 266 | key = getProp(mapNode, "y"); |
267 | transformable.origY = atoi(reinterpret_cast<char*>(key)); | 267 | transformable.origPos.y() = atoi(reinterpret_cast<char*>(key)); |
268 | xmlFree(key); | 268 | xmlFree(key); |
269 | 269 | ||
270 | // Set the sprite and size using the prototype definition. | 270 | // Set the sprite and size using the prototype definition. |
@@ -273,17 +273,17 @@ EntityManager::id_type RealizingSystem::initSingleton( | |||
273 | xmlFree(key); | 273 | xmlFree(key); |
274 | 274 | ||
275 | key = getProp(prototypeNode, "width"); | 275 | key = getProp(prototypeNode, "width"); |
276 | transformable.origW = atoi(reinterpret_cast<char*>(key)); | 276 | transformable.origSize.w() = atoi(reinterpret_cast<char*>(key)); |
277 | xmlFree(key); | 277 | xmlFree(key); |
278 | 278 | ||
279 | key = getProp(prototypeNode, "height"); | 279 | key = getProp(prototypeNode, "height"); |
280 | transformable.origH = atoi(reinterpret_cast<char*>(key)); | 280 | transformable.origSize.h() = atoi(reinterpret_cast<char*>(key)); |
281 | xmlFree(key); | 281 | xmlFree(key); |
282 | 282 | ||
283 | AnimationSet objectAnim( | 283 | AnimationSet objectAnim( |
284 | spritePath.c_str(), | 284 | spritePath.c_str(), |
285 | transformable.origW, | 285 | transformable.origSize.w(), |
286 | transformable.origH, | 286 | transformable.origSize.h(), |
287 | 1); | 287 | 1); |
288 | 288 | ||
289 | objectAnim.emplaceAnimation("static", 0, 1, 1); | 289 | objectAnim.emplaceAnimation("static", 0, 1, 1); |
@@ -503,10 +503,8 @@ void RealizingSystem::loadMap(id_type mapEntity) | |||
503 | auto& transformable = game_.getEntityManager(). | 503 | auto& transformable = game_.getEntityManager(). |
504 | getComponent<TransformableComponent>(prototype); | 504 | getComponent<TransformableComponent>(prototype); |
505 | 505 | ||
506 | transformable.x = transformable.origX; | 506 | transformable.pos = transformable.origPos; |
507 | transformable.y = transformable.origY; | 507 | transformable.size = transformable.origSize; |
508 | transformable.w = transformable.origW; | ||
509 | transformable.h = transformable.origH; | ||
510 | } | 508 | } |
511 | 509 | ||
512 | if (game_.getEntityManager().hasComponent<AnimatableComponent>(prototype)) | 510 | if (game_.getEntityManager().hasComponent<AnimatableComponent>(prototype)) |