projects
/
supertux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
4358672
)
Merged gravity patch by T. Goya
author
Christoph Sommer
<mail@christoph-sommer.de>
Fri, 5 Jan 2007 15:43:18 +0000
(15:43 +0000)
committer
Christoph Sommer
<mail@christoph-sommer.de>
Fri, 5 Jan 2007 15:43:18 +0000
(15:43 +0000)
SVN-Revision: 4530
18 files changed:
src/badguy/badguy.hpp
patch
|
blob
|
history
src/object/bullet.hpp
patch
|
blob
|
history
src/object/falling_coin.hpp
patch
|
blob
|
history
src/object/flower.hpp
patch
|
blob
|
history
src/object/gameobjs.hpp
patch
|
blob
|
history
src/object/growup.hpp
patch
|
blob
|
history
src/object/oneup.hpp
patch
|
blob
|
history
src/object/player.hpp
patch
|
blob
|
history
src/object/powerup.hpp
patch
|
blob
|
history
src/object/rock.hpp
patch
|
blob
|
history
src/object/scripted_object.hpp
patch
|
blob
|
history
src/object/skull_tile.hpp
patch
|
blob
|
history
src/object/star.hpp
patch
|
blob
|
history
src/object/trampoline.hpp
patch
|
blob
|
history
src/object/unstable_tile.hpp
patch
|
blob
|
history
src/object/weak_block.hpp
patch
|
blob
|
history
src/physic.hpp
patch
|
blob
|
history
src/sector.cpp
patch
|
blob
|
history
diff --git
a/src/badguy/badguy.hpp
b/src/badguy/badguy.hpp
index
5824610
..
a6f0197
100644
(file)
--- a/
src/badguy/badguy.hpp
+++ b/
src/badguy/badguy.hpp
@@
-38,7
+38,7
@@
#include "audio/sound_manager.hpp"
#include "audio/sound_source.hpp"
#include "audio/sound_manager.hpp"
#include "audio/sound_source.hpp"
-class BadGuy : public MovingSprite, public Serializable
+class BadGuy : public MovingSprite, p
rotected UsesPhysic, p
ublic Serializable
{
public:
BadGuy(const Vector& pos, const std::string& sprite_name, int layer = LAYER_OBJECTS);
{
public:
BadGuy(const Vector& pos, const std::string& sprite_name, int layer = LAYER_OBJECTS);
@@
-175,8
+175,6
@@
protected:
*/
Player* get_nearest_player();
*/
Player* get_nearest_player();
- Physic physic;
-
/// is the enemy activated
bool activated;
/**
/// is the enemy activated
bool activated;
/**
diff --git
a/src/object/bullet.hpp
b/src/object/bullet.hpp
index
b18e375
..
7891447
100644
(file)
--- a/
src/object/bullet.hpp
+++ b/
src/object/bullet.hpp
@@
-25,7
+25,7
@@
#include "sprite/sprite.hpp"
#include "player_status.hpp"
#include "sprite/sprite.hpp"
#include "player_status.hpp"
-class Bullet : public MovingObject
+class Bullet : public MovingObject
, private UsesPhysic
{
public:
Bullet(const Vector& pos, float xm, int dir, BonusType type);
{
public:
Bullet(const Vector& pos, float xm, int dir, BonusType type);
@@
-50,7
+50,6
@@
public:
private:
int life_count;
private:
int life_count;
- Physic physic;
std::auto_ptr<Sprite> sprite;
BonusType type;
};
std::auto_ptr<Sprite> sprite;
BonusType type;
};
diff --git
a/src/object/falling_coin.hpp
b/src/object/falling_coin.hpp
index
04358dd
..
8eeabb3
100644
(file)
--- a/
src/object/falling_coin.hpp
+++ b/
src/object/falling_coin.hpp
@@
-26,7
+26,7
@@
#include "video/drawing_context.hpp"
#include "physic.hpp"
#include "video/drawing_context.hpp"
#include "physic.hpp"
-class FallingCoin : public GameObject
+class FallingCoin : public GameObject
, private UsesPhysic
{
public:
FallingCoin(const Vector& start_position, const int x_vel);
{
public:
FallingCoin(const Vector& start_position, const int x_vel);
@@
-37,7
+37,6
@@
public:
private:
Vector pos;
Sprite* sprite;
private:
Vector pos;
Sprite* sprite;
- Physic physic;
};
#endif
};
#endif
diff --git
a/src/object/flower.hpp
b/src/object/flower.hpp
index
46a2e6c
..
e1c06ac
100644
(file)
--- a/
src/object/flower.hpp
+++ b/
src/object/flower.hpp
@@
-22,7
+22,6
@@
#include "moving_object.hpp"
#include "sprite/sprite.hpp"
#include "moving_object.hpp"
#include "sprite/sprite.hpp"
-#include "physic.hpp"
#include "player_status.hpp"
class Flower : public MovingObject
#include "player_status.hpp"
class Flower : public MovingObject
diff --git
a/src/object/gameobjs.hpp
b/src/object/gameobjs.hpp
index
d15ed27
..
5a4063f
100644
(file)
--- a/
src/object/gameobjs.hpp
+++ b/
src/object/gameobjs.hpp
@@
-22,7
+22,6
@@
#include "video/surface.hpp"
#include "timer.hpp"
#include "video/surface.hpp"
#include "timer.hpp"
-#include "physic.hpp"
#include "game_object.hpp"
#include "moving_object.hpp"
#include "serializable.hpp"
#include "game_object.hpp"
#include "moving_object.hpp"
#include "serializable.hpp"
diff --git
a/src/object/growup.hpp
b/src/object/growup.hpp
index
315740d
..
869b3fe
100644
(file)
--- a/
src/object/growup.hpp
+++ b/
src/object/growup.hpp
@@
-24,7
+24,7
@@
#include "physic.hpp"
#include "direction.hpp"
#include "physic.hpp"
#include "direction.hpp"
-class GrowUp : public MovingSprite
+class GrowUp : public MovingSprite
, private UsesPhysic
{
public:
GrowUp(Direction direction = RIGHT);
{
public:
GrowUp(Direction direction = RIGHT);
@@
-33,9
+33,6
@@
public:
virtual void update(float elapsed_time);
virtual void collision_solid(const CollisionHit& hit);
virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
virtual void update(float elapsed_time);
virtual void collision_solid(const CollisionHit& hit);
virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
-
-private:
- Physic physic;
};
#endif
};
#endif
diff --git
a/src/object/oneup.hpp
b/src/object/oneup.hpp
index
415c61c
..
1e23841
100644
(file)
--- a/
src/object/oneup.hpp
+++ b/
src/object/oneup.hpp
@@
-24,7
+24,7
@@
#include "physic.hpp"
#include "direction.hpp"
#include "physic.hpp"
#include "direction.hpp"
-class OneUp : public MovingSprite
+class OneUp : public MovingSprite
, private UsesPhysic
{
public:
OneUp(const Vector& pos, Direction direction = RIGHT);
{
public:
OneUp(const Vector& pos, Direction direction = RIGHT);
@@
-32,9
+32,6
@@
public:
virtual void update(float elapsed_time);
virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
virtual void update(float elapsed_time);
virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
-
-private:
- Physic physic;
};
#endif
};
#endif
diff --git
a/src/object/player.hpp
b/src/object/player.hpp
index
de22949
..
73027ec
100644
(file)
--- a/
src/object/player.hpp
+++ b/
src/object/player.hpp
@@
-81,7
+81,7
@@
extern TuxBodyParts* big_tux;
extern TuxBodyParts* fire_tux;
extern TuxBodyParts* ice_tux;
extern TuxBodyParts* fire_tux;
extern TuxBodyParts* ice_tux;
-class Player : public MovingObject, public Scripting::Player, public ScriptInterface
+class Player : public MovingObject, public
UsesPhysic, public
Scripting::Player, public ScriptInterface
{
public:
enum FallMode { ON_GROUND, JUMPING, TRAMPOLINE_JUMP, FALLING };
{
public:
enum FallMode { ON_GROUND, JUMPING, TRAMPOLINE_JUMP, FALLING };
@@
-119,7
+119,6
@@
public:
Timer growing_timer;
Timer idle_timer;
Timer backflip_timer;
Timer growing_timer;
Timer idle_timer;
Timer backflip_timer;
- Physic physic;
public:
Player(PlayerStatus* player_status, const std::string& name);
public:
Player(PlayerStatus* player_status, const std::string& name);
diff --git
a/src/object/powerup.hpp
b/src/object/powerup.hpp
index
5ed2b49
..
4779db1
100644
(file)
--- a/
src/object/powerup.hpp
+++ b/
src/object/powerup.hpp
@@
-25,7
+25,7
@@
#include "collision_hit.hpp"
#include "physic.hpp"
#include "collision_hit.hpp"
#include "physic.hpp"
-class PowerUp : public MovingSprite
+class PowerUp : public MovingSprite
, private UsesPhysic
{
public:
PowerUp(const lisp::Lisp& lisp);
{
public:
PowerUp(const lisp::Lisp& lisp);
@@
-35,7
+35,6
@@
public:
virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
private:
virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
private:
- Physic physic;
std::string script;
bool no_physics;
};
std::string script;
bool no_physics;
};
diff --git
a/src/object/rock.hpp
b/src/object/rock.hpp
index
379ed07
..
099d7ca
100644
(file)
--- a/
src/object/rock.hpp
+++ b/
src/object/rock.hpp
@@
-28,7
+28,7
@@
class Sprite;
class Sprite;
-class Rock : public MovingSprite, public Portable, public Serializable
+class Rock : public MovingSprite, public Portable, p
rotected UsesPhysic, p
ublic Serializable
{
public:
Rock(const lisp::Lisp& reader);
{
public:
Rock(const lisp::Lisp& reader);
@@
-46,7
+46,6
@@
public:
protected:
bool on_ground;
bool grabbed;
protected:
bool on_ground;
bool grabbed;
- Physic physic;
Vector last_movement;
};
Vector last_movement;
};
diff --git
a/src/object/scripted_object.hpp
b/src/object/scripted_object.hpp
index
1e432a7
..
9ac72c5
100644
(file)
--- a/
src/object/scripted_object.hpp
+++ b/
src/object/scripted_object.hpp
@@
-27,8
+27,8
@@
#include "script_interface.hpp"
#include "scripting/scripted_object.hpp"
#include "script_interface.hpp"
#include "scripting/scripted_object.hpp"
-class ScriptedObject : public MovingSprite, public
Scripting::ScriptedObject,
- public ScriptInterface
+class ScriptedObject : public MovingSprite, public
UsesPhysic,
+ public Script
ing::ScriptedObject, public Script
Interface
{
public:
ScriptedObject(const lisp::Lisp& lisp);
{
public:
ScriptedObject(const lisp::Lisp& lisp);
@@
-69,7
+69,6
@@
private:
bool visible;
bool new_vel_set;
Vector new_vel;
bool visible;
bool new_vel_set;
Vector new_vel;
- Physic physic;
};
#endif
};
#endif
diff --git
a/src/object/skull_tile.hpp
b/src/object/skull_tile.hpp
index
f9a19fc
..
5a65798
100644
(file)
--- a/
src/object/skull_tile.hpp
+++ b/
src/object/skull_tile.hpp
@@
-28,7
+28,7
@@
class Player;
/** A tile that starts falling down if tux stands to long on it */
class Player;
/** A tile that starts falling down if tux stands to long on it */
-class SkullTile : public MovingSprite
+class SkullTile : public MovingSprite
, private UsesPhysic
{
public:
SkullTile(const lisp::Lisp& lisp);
{
public:
SkullTile(const lisp::Lisp& lisp);
@@
-39,7
+39,6
@@
public:
void draw(DrawingContext& context);
private:
void draw(DrawingContext& context);
private:
- Physic physic;
Timer timer;
bool hit;
bool falling;
Timer timer;
bool hit;
bool falling;
diff --git
a/src/object/star.hpp
b/src/object/star.hpp
index
68b4fc9
..
e3f4f04
100644
(file)
--- a/
src/object/star.hpp
+++ b/
src/object/star.hpp
@@
-24,7
+24,7
@@
#include "physic.hpp"
#include "direction.hpp"
#include "physic.hpp"
#include "direction.hpp"
-class Star : public MovingSprite
+class Star : public MovingSprite
, private UsesPhysic
{
public:
Star(const Vector& pos, Direction direction = RIGHT);
{
public:
Star(const Vector& pos, Direction direction = RIGHT);
@@
-33,9
+33,6
@@
public:
virtual void update(float elapsed_time);
virtual void collision_solid(const CollisionHit& hit);
virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
virtual void update(float elapsed_time);
virtual void collision_solid(const CollisionHit& hit);
virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
-
-private:
- Physic physic;
};
#endif
};
#endif
diff --git
a/src/object/trampoline.hpp
b/src/object/trampoline.hpp
index
c1eca0f
..
c7653c0
100644
(file)
--- a/
src/object/trampoline.hpp
+++ b/
src/object/trampoline.hpp
@@
-23,7
+23,6
@@
#include "moving_sprite.hpp"
#include "lisp/lisp.hpp"
#include "object/rock.hpp"
#include "moving_sprite.hpp"
#include "lisp/lisp.hpp"
#include "object/rock.hpp"
-#include "physic.hpp"
/**
* Jumping on a trampolin makes tux jump higher.
/**
* Jumping on a trampolin makes tux jump higher.
diff --git
a/src/object/unstable_tile.hpp
b/src/object/unstable_tile.hpp
index
9c6e0bd
..
a6bb71e
100644
(file)
--- a/
src/object/unstable_tile.hpp
+++ b/
src/object/unstable_tile.hpp
@@
-29,7
+29,7
@@
/**
* A block that disintegrates when stood on
*/
/**
* A block that disintegrates when stood on
*/
-class UnstableTile : public MovingSprite
+class UnstableTile : public MovingSprite
, public UsesPhysic
{
public:
UnstableTile(const lisp::Lisp& lisp);
{
public:
UnstableTile(const lisp::Lisp& lisp);
@@
-45,8
+45,6
@@
private:
STATE_DISINTEGRATING /**< disintegrating, no longer solid */
};
State state;
STATE_DISINTEGRATING /**< disintegrating, no longer solid */
};
State state;
-
- Physic physic;
};
#endif
};
#endif
diff --git
a/src/object/weak_block.hpp
b/src/object/weak_block.hpp
index
e36d1eb
..
01e2464
100644
(file)
--- a/
src/object/weak_block.hpp
+++ b/
src/object/weak_block.hpp
@@
-29,7
+29,7
@@
/**
* A block that can be destroyed by Bullet hits
*/
/**
* A block that can be destroyed by Bullet hits
*/
-class WeakBlock : public MovingSprite
+class WeakBlock : public MovingSprite
, public UsesPhysic
{
public:
WeakBlock(const lisp::Lisp& lisp);
{
public:
WeakBlock(const lisp::Lisp& lisp);
@@
-55,8
+55,6
@@
private:
STATE_DISINTEGRATING /**< crumbling to dust, no longer solid */
};
State state;
STATE_DISINTEGRATING /**< crumbling to dust, no longer solid */
};
State state;
-
- Physic physic;
};
#endif
};
#endif
diff --git
a/src/physic.hpp
b/src/physic.hpp
index
abfdba5
..
037d85e
100644
(file)
--- a/
src/physic.hpp
+++ b/
src/physic.hpp
@@
-87,4
+87,11
@@
private:
float gravity;
};
float gravity;
};
+class UsesPhysic
+{
+public:
+ Physic physic;
+ friend class Sector;
+};
+
#endif
#endif
diff --git
a/src/sector.cpp
b/src/sector.cpp
index
af81987
..
c306517
100644
(file)
--- a/
src/sector.cpp
+++ b/
src/sector.cpp
@@
-74,7
+74,7
@@
bool Sector::draw_solids_only = false;
Sector::Sector(Level* parent)
: level(parent), currentmusic(LEVEL_MUSIC),
Sector::Sector(Level* parent)
: level(parent), currentmusic(LEVEL_MUSIC),
- ambient_light( 1.0f, 1.0f, 1.0f, 1.0f ), gravity(10), player(0), camera(0)
+ ambient_light( 1.0f, 1.0f, 1.0f, 1.0f ), gravity(10
00.0
), player(0), camera(0)
{
add_object(new Player(player_status, "Tux"));
add_object(new DisplayEffect("Effect"));
{
add_object(new Player(player_status, "Tux"));
add_object(new DisplayEffect("Effect"));
@@
-708,6
+708,13
@@
Sector::before_object_add(GameObject* object)
this->player = player;
}
this->player = player;
}
+ UsesPhysic *physic_object = dynamic_cast<UsesPhysic *>(object);
+ if(physic_object)
+ {
+ physic_object->physic.set_gravity(gravity);
+ }
+
+
if(_current == this) {
try_expose(object);
}
if(_current == this) {
try_expose(object);
}