[Super-tux-commit] supertux/src player.cpp,1.116,1.117 player.h,1.58,1.59 world.cpp,1.108,1.109 worl
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-05-22 15:27:54
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10618/src Modified Files: player.cpp player.h world.cpp world.h Log Message: Tux shows arm when firing. Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.116 retrieving revision 1.117 diff -u -d -r1.116 -r1.117 --- player.cpp 21 May 2004 00:43:30 -0000 1.116 +++ player.cpp 22 May 2004 15:27:40 -0000 1.117 @@ -30,6 +30,8 @@ #include "screen.h" #define AUTOSCROLL_DEAD_INTERVAL 300 +// animation times (in ms): +#define SHOOTING_TIME 320 Surface* tux_life; @@ -110,6 +112,7 @@ safe_timer.init(true); frame_timer.init(true); kick_timer.init(true); + shooting_timer.init(true); physic.reset(); } @@ -474,8 +477,9 @@ /* Shoot! */ if (input.fire == DOWN && input.old_fire == UP && got_power != NONE_POWER) { - World::current()->add_bullet(Vector(base.x, base.y + (base.height/2)), - physic.get_velocity_x(), dir); + if(World::current()->add_bullet(Vector(base.x, base.y + (base.height/2)), + physic.get_velocity_x(), dir)) + shooting_timer.start(SHOOTING_TIME); input.old_fire = DOWN; } @@ -590,7 +594,7 @@ if(layer == LAYER_OBJECTS + 1) { // Draw arm overlay graphics when Tux is holding something - if (holding_something && physic.get_velocity_y() == 0) + if ((holding_something && physic.get_velocity_y() == 0) || shooting_timer.check()) { if (dir == RIGHT) sprite->grab_right->draw(pos); Index: world.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/world.h,v retrieving revision 1.46 retrieving revision 1.47 diff -u -d -r1.46 -r1.47 --- world.h 21 May 2004 00:22:57 -0000 1.46 +++ world.h 22 May 2004 15:27:45 -0000 1.47 @@ -106,7 +106,7 @@ BadGuy* add_bad_guy(float x, float y, BadGuyKind kind); void add_upgrade(const Vector& pos, Direction dir, UpgradeKind kind); - void add_bullet(const Vector& pos, float xm, Direction dir); + bool add_bullet(const Vector& pos, float xm, Direction dir); /** Try to grab the coin at the given coordinates */ void trygrabdistro(float x, float y, int bounciness); Index: world.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/world.cpp,v retrieving revision 1.108 retrieving revision 1.109 diff -u -d -r1.108 -r1.109 --- world.cpp 21 May 2004 00:22:57 -0000 1.108 +++ world.cpp 22 May 2004 15:27:45 -0000 1.109 @@ -538,18 +538,18 @@ add_object(new Upgrade(displaymanager, pos, dir, kind)); } -void +bool World::add_bullet(const Vector& pos, float xm, Direction dir) { if(tux->got_power == Player::FIRE_POWER) { if(bullets.size() > MAX_FIRE_BULLETS-1) - return; + return false; } else if(tux->got_power == Player::ICE_POWER) { if(bullets.size() > MAX_ICE_BULLETS-1) - return; + return false; } Bullet* new_bullet = 0; @@ -562,6 +562,8 @@ add_object(new_bullet); play_sound(sounds[SND_SHOOT], SOUND_CENTER_SPEAKER); + + return true; } void Index: player.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.h,v retrieving revision 1.58 retrieving revision 1.59 diff -u -d -r1.58 -r1.59 --- player.h 21 May 2004 00:22:57 -0000 1.58 +++ player.h 22 May 2004 15:27:45 -0000 1.59 @@ -135,6 +135,7 @@ Timer safe_timer; Timer frame_timer; Timer kick_timer; + Timer shooting_timer; // used to show the arm when Tux is shooting Physic physic; public: |