Update of /cvsroot/super-tux/supertux/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18290
Modified Files:
special.cpp special.h world.cpp world.h
Log Message:
- added UpgradeKind name to nameless enum
- slowed down grow-up upgrade
Index: world.h
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/world.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- world.h 17 Apr 2004 13:56:48 -0000 1.23
+++ world.h 19 Apr 2004 14:06:10 -0000 1.24
@@ -85,7 +85,7 @@
void add_broken_brick_piece(Tile* tile, float x, float y, float xm, float ym);
void add_bouncy_brick(float x, float y);
void add_bad_guy(float x, float y, BadGuyKind kind);
- void add_upgrade(float x, float y, int dir, int kind);
+ void add_upgrade(float x, float y, int dir, UpgradeKind kind);
void add_bullet(float x, float y, float xm, int dir);
/** Try to grab the coin at the given coordinates */
Index: world.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/world.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- world.cpp 18 Apr 2004 13:42:15 -0000 1.29
+++ world.cpp 19 Apr 2004 14:06:10 -0000 1.30
@@ -386,7 +386,7 @@
}
void
-World::add_upgrade(float x, float y, int dir, int kind)
+World::add_upgrade(float x, float y, int dir, UpgradeKind kind)
{
Upgrade new_upgrade;
new_upgrade.init(x,y,dir,kind);
Index: special.h
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/special.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- special.h 12 Apr 2004 18:57:36 -0000 1.13
+++ special.h 19 Apr 2004 14:06:10 -0000 1.14
@@ -26,7 +26,7 @@
/* Upgrade types: */
-enum {
+enum UpgradeKind {
UPGRADE_GROWUP,
UPGRADE_ICEFLOWER,
UPGRADE_HERRING,
@@ -39,13 +39,13 @@
class Upgrade
{
public:
- int kind;
+ UpgradeKind kind;
int dir;
base_type base;
base_type old_base;
Physic physic;
- void init(float x, float y, int dir, int kind);
+ void init(float x, float y, int dir, UpgradeKind kind);
void action(double frame_ratio);
void draw();
void collision(void* p_c_object, int c_object);
Index: special.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/special.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- special.cpp 18 Apr 2004 13:42:15 -0000 1.19
+++ special.cpp 19 Apr 2004 14:06:10 -0000 1.20
@@ -28,6 +28,8 @@
Surface* img_iceflower;
Surface* img_1up;
+#define GROWUP_SPEED 1.0f
+
void
Bullet::init(float x, float y, float xm, int dir)
{
@@ -113,7 +115,7 @@
}
void
-Upgrade::init(float x_, float y_, int dir_, int kind_)
+Upgrade::init(float x_, float y_, int dir_, UpgradeKind kind_)
{
kind = kind_;
dir = dir_;
@@ -133,6 +135,8 @@
base.height = 32;
} else if (kind == UPGRADE_ICEFLOWER) {
// nothing
+ } else if (kind == UPGRADE_GROWUP) {
+ physic.set_velocity(dir == LEFT ? -GROWUP_SPEED : GROWUP_SPEED, 0);
} else {
physic.set_velocity(dir == LEFT ? -2 : 2, 0);
}
@@ -188,7 +192,7 @@
old_base = base;
if(kind == UPGRADE_GROWUP) {
physic.enable_gravity(false);
- physic.set_velocity(dir == LEFT ? -2 : 2, 0);
+ physic.set_velocity(dir == LEFT ? -GROWUP_SPEED : GROWUP_SPEED, 0);
} else if(kind == UPGRADE_HERRING) {
physic.set_velocity(dir == LEFT ? -2 : 2, 3);
}
|