diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-05-08 21:09:36 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-05-09 17:59:13 -0400 |
commit | 5c82f052c26303318e81ddd76475c1d188cc74f4 (patch) | |
tree | 3204ef94f2861224a380aa566728c02b4acd1fd9 /src/systems/pondering.h | |
parent | 96e6f3231aed9919d660a06944f1d96dc8241f8e (diff) | |
download | therapy-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/pondering.h')
-rw-r--r-- | src/systems/pondering.h | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/src/systems/pondering.h b/src/systems/pondering.h index abc6db2..273db67 100644 --- a/src/systems/pondering.h +++ b/src/systems/pondering.h | |||
@@ -4,19 +4,7 @@ | |||
4 | #include "system.h" | 4 | #include "system.h" |
5 | #include "components/ponderable.h" | 5 | #include "components/ponderable.h" |
6 | #include "direction.h" | 6 | #include "direction.h" |
7 | 7 | #include "vector.h" | |
8 | struct CollisionResult | ||
9 | { | ||
10 | double newX; | ||
11 | double newY; | ||
12 | bool stopProcessing = false; | ||
13 | bool touchedWall = false; | ||
14 | bool adjacentlyWarping = false; | ||
15 | Direction adjWarpDir; | ||
16 | size_t adjWarpMapId; | ||
17 | bool grounded = false; | ||
18 | EntityManager::id_type groundEntity; | ||
19 | }; | ||
20 | 8 | ||
21 | class PonderingSystem : public System { | 9 | class PonderingSystem : public System { |
22 | public: | 10 | public: |
@@ -47,7 +35,19 @@ public: | |||
47 | 35 | ||
48 | private: | 36 | private: |
49 | 37 | ||
50 | 38 | struct CollisionResult | |
39 | { | ||
40 | vec2d pos; | ||
41 | bool stopProcessing = false; | ||
42 | bool touchedWall = false; | ||
43 | bool blockedHoriz = false; | ||
44 | bool blockedVert = false; | ||
45 | bool adjacentlyWarping = false; | ||
46 | Direction adjWarpDir; | ||
47 | size_t adjWarpMapId; | ||
48 | bool grounded = false; | ||
49 | id_type groundEntity; | ||
50 | }; | ||
51 | 51 | ||
52 | void tickBody( | 52 | void tickBody( |
53 | id_type entity, | 53 | id_type entity, |
@@ -56,13 +56,11 @@ private: | |||
56 | 56 | ||
57 | CollisionResult moveBody( | 57 | CollisionResult moveBody( |
58 | id_type entity, | 58 | id_type entity, |
59 | double x, | 59 | vec2d newPos); |
60 | double y); | ||
61 | 60 | ||
62 | CollisionResult detectCollisions( | 61 | CollisionResult detectCollisions( |
63 | id_type entity, | 62 | id_type entity, |
64 | double x, | 63 | vec2d newPos); |
65 | double y); | ||
66 | 64 | ||
67 | template <typename Param> | 65 | template <typename Param> |
68 | void detectCollisionsInDirection( | 66 | void detectCollisionsInDirection( |