187 |
|
|
188 |
|
|
189 |
// Floor interface |
// Floor interface |
190 |
virtual px::V3 get_force(Actor *a) |
virtual px::V2 get_force(Actor *a) |
191 |
{ return px::V3(); } |
{ return px::V2(); } |
192 |
|
|
193 |
virtual void on_drop(Item* it) {} |
virtual void on_drop(Item* it) {} |
194 |
virtual void on_pickup(Item* it) {} |
virtual void on_pickup(Item* it) {} |
231 |
// Item interface |
// Item interface |
232 |
// |
// |
233 |
|
|
234 |
virtual px::V3 get_force(Actor *a); |
virtual px::V2 get_force(Actor *a); |
235 |
|
|
236 |
virtual void on_drop(Actor *a); |
virtual void on_drop(Actor *a); |
237 |
virtual void on_pickup(Actor *a); |
virtual void on_pickup(Actor *a); |
269 |
|
|
270 |
// Stone interface |
// Stone interface |
271 |
virtual StoneResponse collision_response(const StoneContact &sc); |
virtual StoneResponse collision_response(const StoneContact &sc); |
272 |
virtual px::V3 actor_impulse (const StoneContact &sc); |
virtual px::V2 actor_impulse (const StoneContact &sc); |
273 |
virtual void actor_hit (const StoneContact &sc); |
virtual void actor_hit (const StoneContact &sc); |
274 |
virtual void actor_inside (Actor *a) {} |
virtual void actor_inside (Actor *a) {} |
275 |
virtual void actor_contact (Actor *a) {} |
virtual void actor_contact (Actor *a) {} |
288 |
public: |
public: |
289 |
// Actor interface. |
// Actor interface. |
290 |
virtual void on_hit(Actor* a) {} |
virtual void on_hit(Actor* a) {} |
291 |
virtual void on_creation(const px::V3 &pos); |
virtual void on_creation(const px::V2 &pos); |
292 |
virtual void on_respawn (const px::V3 &pos); |
virtual void on_respawn (const px::V2 &pos); |
293 |
|
|
294 |
virtual bool is_dead() = 0; |
virtual bool is_dead() = 0; |
295 |
virtual bool is_flying() { return false; } |
virtual bool is_flying() { return false; } |
302 |
|
|
303 |
// Accessors. |
// Accessors. |
304 |
world::ActorInfo *get_actorinfo() { return &actorinfo; } |
world::ActorInfo *get_actorinfo() { return &actorinfo; } |
305 |
const px::V3 &get_pos() const { return actorinfo.pos; } |
const px::V2 &get_pos() const { return actorinfo.pos; } |
306 |
const px::V3 &get_vel() const { return actorinfo.vel; } |
const px::V2 &get_vel() const { return actorinfo.vel; } |
307 |
double get_radius() const { return actorinfo.radius; } |
double get_radius() const { return actorinfo.radius; } |
308 |
double get_mass() const { return actorinfo.mass; } |
double get_mass() const { return actorinfo.mass; } |
309 |
|
|
310 |
void move(); |
void move(); |
311 |
void warp(const px::V3 &newpos); |
void warp(const px::V2 &newpos); |
312 |
|
|
313 |
void respawn(); |
void respawn(); |
314 |
void add_force (const px::V3 &f); |
void add_force (const px::V2 &f); |
315 |
|
|
316 |
display::SpriteId get_spriteid() const { return sprite_id; } |
const display::SpriteHandle &get_sprite() const { return m_sprite; } |
317 |
|
|
318 |
protected: |
protected: |
319 |
Actor(const char *name, const px::V3 &pos); |
Actor(const char *name, const px::V2 &pos); |
320 |
|
|
321 |
void set_model(const string &mname, const px::V3 &pos); |
void set_model(const string &mname, const px::V2 &pos); |
322 |
void set_model(const string &mname); |
void set_model(const string &mname); |
323 |
void set_attrib(const string &key, const Value &val); |
void set_attrib(const string &key, const Value &val); |
324 |
|
|
325 |
private: |
private: |
326 |
virtual void on_motion(px::V3 newpos) {} |
|
327 |
|
virtual void on_motion(px::V2 newpos) {} |
328 |
world::ActorInfo actorinfo; |
world::ActorInfo actorinfo; |
329 |
display::SpriteId sprite_id; |
display::SpriteHandle m_sprite; |
330 |
V3 startingpos; |
V2 startingpos; |
331 |
V3 respawnpos; |
V2 respawnpos; |
332 |
bool use_respawnpos; |
bool use_respawnpos; |
333 |
}; |
}; |
334 |
} |
} |