[Super-tux-commit] supertux/src defines.h,1.32,1.33 world.cpp,1.69,1.70 world.h,1.37,1.38
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-05-09 21:16:08
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9709/src Modified Files: defines.h world.cpp world.h Log Message: Instead of limitating the number of bullets, according to the ones in screen, do it in a time bases. This was asked in a comment on The Linux Game Tome and I already wanted to do this, since the day I made that hack, so here it goes. You can tune that time on the defines.h file, it is the BULLETS_TIMEOUT definition (in ms). There is a fire test level. Index: world.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/world.h,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- world.h 7 May 2004 20:48:22 -0000 1.37 +++ world.h 9 May 2004 21:15:58 -0000 1.38 @@ -58,6 +58,7 @@ std::vector<FloatingScore*> floating_scores; std::vector<Upgrade> upgrades; + Timer bullets_timer; std::vector<Bullet> bullets; typedef std::vector<ParticleSystem*> ParticleSystems; ParticleSystems particle_systems; Index: defines.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/defines.h,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- defines.h 6 May 2004 21:39:47 -0000 1.32 +++ defines.h 9 May 2004 21:15:58 -0000 1.33 @@ -69,7 +69,7 @@ #define START_LIVES 4 -#define MAX_BULLETS 2 +#define BULLETS_TIMEOUT 500 #define YM_FOR_JUMP 6.0 #define WALK_ACCELERATION_X 0.03 Index: world.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/world.cpp,v retrieving revision 1.69 retrieving revision 1.70 diff -u -d -r1.69 -r1.70 --- world.cpp 8 May 2004 10:41:42 -0000 1.69 +++ world.cpp 9 May 2004 21:15:58 -0000 1.70 @@ -56,6 +56,7 @@ apply_bonuses(); scrolling_timer.init(true); + bullets_timer.init(true); } World::World(const std::string& subset, int level_nr) @@ -77,6 +78,7 @@ apply_bonuses(); scrolling_timer.init(true); + bullets_timer.init(true); } void @@ -541,9 +543,11 @@ void World::add_bullet(float x, float y, float xm, Direction dir) { - if(bullets.size() > MAX_BULLETS-1) + if(bullets_timer.check()) return; + bullets_timer.start(BULLETS_TIMEOUT); + Bullet new_bullet; new_bullet.init(x,y,xm,dir); bullets.push_back(new_bullet); |