From: Ingo Ruhnke Date: Mon, 19 Apr 2004 14:06:10 +0000 (+0000) Subject: - added UpgradeKind name to nameless enum X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=46053ca6fbb70a861c529fdfe82417c4641c0214;p=supertux.git - added UpgradeKind name to nameless enum - slowed down grow-up upgrade SVN-Revision: 570 --- diff --git a/src/special.cpp b/src/special.cpp index 78ae3637c..e21f2b5ce 100644 --- a/src/special.cpp +++ b/src/special.cpp @@ -28,6 +28,8 @@ Surface* img_growup; 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 @@ Bullet::collision(int c_object) } 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 @@ Upgrade::init(float x_, float y_, int dir_, int kind_) 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 @@ Upgrade::action(double frame_ratio) 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); } diff --git a/src/special.h b/src/special.h index dfec8a472..1a3364bad 100644 --- a/src/special.h +++ b/src/special.h @@ -26,7 +26,7 @@ /* Upgrade types: */ -enum { +enum UpgradeKind { UPGRADE_GROWUP, UPGRADE_ICEFLOWER, UPGRADE_HERRING, @@ -39,13 +39,13 @@ void free_special_gfx(); 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); diff --git a/src/world.cpp b/src/world.cpp index 2617f532a..72cafc743 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -386,7 +386,7 @@ World::add_bad_guy(float x, float y, BadGuyKind kind) } 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); diff --git a/src/world.h b/src/world.h index db383e211..297acef13 100644 --- a/src/world.h +++ b/src/world.h @@ -85,7 +85,7 @@ class World 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 */