Update of /cvsroot/super-tux/supertux/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15385
Modified Files:
special.cpp special.h world.cpp
Log Message:
bump patch for upgrades from matzeb
Index: world.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/world.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- world.cpp 26 Apr 2004 12:21:23 -0000 1.42
+++ world.cpp 26 Apr 2004 21:09:31 -0000 1.43
@@ -375,7 +375,7 @@
{
// We have detected a collision and now call the collision
// functions of the collided objects.
- upgrades[i].collision(&tux, CO_PLAYER);
+ upgrades[i].collision(&tux, CO_PLAYER, COLLISION_NORMAL);
}
}
}
@@ -614,9 +614,7 @@
upgrades[i].base.x >= x - 32 && upgrades[i].base.x <= x + 32 &&
upgrades[i].base.y >= y - 16 && upgrades[i].base.y <= y + 16)
{
- upgrades[i].base.xm = -upgrades[i].base.xm;
- upgrades[i].base.ym = -8;
- play_sound(sounds[SND_BUMP_UPGRADE], SOUND_CENTER_SPEAKER);
+ upgrades[i].collision(&tux, CO_PLAYER, COLLISION_BUMP);
}
}
}
Index: special.h
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/special.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- special.h 25 Apr 2004 23:46:30 -0000 1.18
+++ special.h 26 Apr 2004 21:09:31 -0000 1.19
@@ -52,7 +52,7 @@
void init(float x, float y, Direction dir, UpgradeKind kind);
void action(double frame_ratio);
void draw();
- void collision(void* p_c_object, int c_object);
+ void collision(void* p_c_object, int c_object, CollisionType type);
private:
/** removes the Upgrade from the global upgrade list. Note that after this
@@ -60,6 +60,8 @@
* anymore then
*/
void remove_me();
+
+ void bump(Player* player);
};
class Bullet
Index: special.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/special.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- special.cpp 26 Apr 2004 12:21:22 -0000 1.31
+++ special.cpp 26 Apr 2004 21:09:31 -0000 1.32
@@ -288,10 +288,32 @@
}
void
-Upgrade::collision(void* p_c_object, int c_object)
+Upgrade::bump(Player* )
+{
+ // these can't be bumped
+ if(kind != UPGRADE_GROWUP)
+ return;
+
+ play_sound(sounds[SND_BUMP_UPGRADE], SOUND_CENTER_SPEAKER);
+
+ // do a little jump and change direction
+ physic.set_velocity(-physic.get_velocity_x(), 3);
+ dir = dir == LEFT ? RIGHT : LEFT;
+ physic.enable_gravity(true);
+}
+
+void
+Upgrade::collision(void* p_c_object, int c_object, CollisionType type)
{
Player* pplayer = NULL;
+ if(type == COLLISION_BUMP) {
+ if(c_object == CO_PLAYER)
+ pplayer = (Player*) p_c_object;
+ bump(pplayer);
+ return;
+ }
+
switch (c_object)
{
case CO_PLAYER:
|