summary refs log tree commit diff stats
path: root/src/systems/pondering.h
blob: aa430db55150806dc0d4a70fd1255395bd969b13 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef PONDERING_H_F2530E0E
#define PONDERING_H_F2530E0E

#include "system.h"
#include "components/ponderable.h"
#include "direction.h"

class PonderingSystem : public System {
public:

  PonderingSystem(Game& game) : System(game)
  {
  }

  void tick(double dt);

  void initializeBody(id_type entity, PonderableComponent::Type type);

  void initPrototype(id_type prototype);

private:

  struct CollisionResult
  {
    double newX;
    double newY;
    bool stopProcessing = false;
    bool touchedWall = false;
    bool adjacentlyWarping = false;
    Direction adjWarpDir;
    size_t adjWarpMapId;
  };

  void processCollision(
    id_type entity,
    id_type collider,
    Direction dir,
    PonderableComponent::Collision type,
    double axis,
    double lower,
    double upper,
    CollisionResult& result);

};

#endif /* end of include guard: PONDERING_H_F2530E0E */