diff options
Diffstat (limited to 'src/systems/pondering.h')
| -rw-r--r-- | src/systems/pondering.h | 40 |
1 files changed, 29 insertions, 11 deletions
| diff --git a/src/systems/pondering.h b/src/systems/pondering.h index eed0d32..abc6db2 100644 --- a/src/systems/pondering.h +++ b/src/systems/pondering.h | |||
| @@ -5,6 +5,19 @@ | |||
| 5 | #include "components/ponderable.h" | 5 | #include "components/ponderable.h" |
| 6 | #include "direction.h" | 6 | #include "direction.h" |
| 7 | 7 | ||
| 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 | class PonderingSystem : public System { | 21 | class PonderingSystem : public System { |
| 9 | public: | 22 | public: |
| 10 | 23 | ||
| @@ -34,23 +47,28 @@ public: | |||
| 34 | 47 | ||
| 35 | private: | 48 | private: |
| 36 | 49 | ||
| 37 | struct CollisionResult | 50 | |
| 38 | { | ||
| 39 | double newX; | ||
| 40 | double newY; | ||
| 41 | bool stopProcessing = false; | ||
| 42 | bool touchedWall = false; | ||
| 43 | bool adjacentlyWarping = false; | ||
| 44 | Direction adjWarpDir; | ||
| 45 | size_t adjWarpMapId; | ||
| 46 | id_type groundEntity; | ||
| 47 | }; | ||
| 48 | 51 | ||
| 49 | void tickBody( | 52 | void tickBody( |
| 50 | id_type entity, | 53 | id_type entity, |
| 51 | double dt, | 54 | double dt, |
| 52 | const std::set<id_type>& entities); | 55 | const std::set<id_type>& entities); |
| 53 | 56 | ||
| 57 | CollisionResult moveBody( | ||
| 58 | id_type entity, | ||
| 59 | double x, | ||
| 60 | double y); | ||
| 61 | |||
| 62 | CollisionResult detectCollisions( | ||
| 63 | id_type entity, | ||
| 64 | double x, | ||
| 65 | double y); | ||
| 66 | |||
| 67 | template <typename Param> | ||
| 68 | void detectCollisionsInDirection( | ||
| 69 | id_type entity, | ||
| 70 | CollisionResult& result); | ||
| 71 | |||
| 54 | void processCollision( | 72 | void processCollision( |
| 55 | id_type entity, | 73 | id_type entity, |
| 56 | id_type collider, | 74 | id_type collider, |
