49 |
class ActorInfo { |
class ActorInfo { |
50 |
public: |
public: |
51 |
ActorInfo(V2 p, V2 v) |
ActorInfo(V2 p, V2 v) |
52 |
: pos(p), oldpos(p), vel(v), oldvel(v), |
: pos(p), vel(v), forceacc(), |
53 |
forceacc(), |
charge(0), mass(1), radius(1), |
54 |
charge(0), mass(1), radius(1), |
grabbed(false), |
55 |
grabbed(false) |
last_pos(), oldpos(), oldvel(v), force() |
56 |
{} |
{} |
57 |
|
|
58 |
V2 pos, oldpos; // Absolute position |
// |
59 |
V2 vel, oldvel; // Velocity |
// Public variables |
60 |
|
// |
61 |
|
V2 pos; // Absolute position |
62 |
|
V2 vel; // Velocity |
63 |
V2 forceacc; // Force accumulator |
V2 forceacc; // Force accumulator |
|
V2 forceacc2; |
|
64 |
double charge; // Electric charge |
double charge; // Electric charge |
65 |
double mass; // Mass |
double mass; // Mass |
66 |
double radius; // Radius of the sphere |
double radius; // Radius of the sphere |
67 |
bool grabbed; // Actor not controlled by the physics engine |
bool grabbed; // Actor not controlled by the physics engine |
68 |
|
|
69 |
|
// |
70 |
|
// Variables used internally by the physics engine |
71 |
|
// |
72 |
|
V2 last_pos; // Position befure current tick |
73 |
|
V2 oldpos; // Backup position for adaptive stepsize control |
74 |
|
V2 oldvel; // Backup velocity (see oldpos) |
75 |
|
V2 force; // Force used during tick |
76 |
}; |
}; |
77 |
|
|
78 |
/* |
/* |
114 |
GridPos stonepos; |
GridPos stonepos; |
115 |
StoneResponse response; |
StoneResponse response; |
116 |
|
|
117 |
V2 contact_point; // where do the shapes meet? (world coords) |
V2 contact_point; // Where do the shapes meet? (world coords) |
118 |
V2 normal; // the surface normal at the contact point |
V2 normal; // The surface normal at the contact point |
119 |
bool is_collision; // actor moves towards the stone, not away |
bool is_collision; // Actor moves towards the stone, not away |
120 |
bool fake_collision; |
bool fake_collision; |
121 |
bool is_contact; |
bool new_collision; // True if actor did not touch the stone before |
122 |
|
bool is_contact; // if false, contact_point is actually closest feature |
123 |
std::string sound; |
std::string sound; |
124 |
}; |
}; |
125 |
|
|
267 |
void SwapStones (GridPos p, GridPos newp); |
void SwapStones (GridPos p, GridPos newp); |
268 |
void MoveStone(GridPos oldPos, GridPos newPos); |
void MoveStone(GridPos oldPos, GridPos newPos); |
269 |
|
|
270 |
// puzzle stone scrambling |
// Puzzle stone scrambling |
271 |
|
|
272 |
void SetScrambleIntensity(int intensity); |
void SetScrambleIntensity(int intensity); |
273 |
void AddScramble(GridPos p, Direction d); |
void AddScramble(GridPos p, Direction d); |