[Super-tux-commit] supertux/src badguy.cpp,1.76,1.77 collision.cpp,1.22,1.23 collision.h,1.12,1.13 g
Brought to you by:
wkendrick
From: Ryan F. <sik...@us...> - 2004-05-17 06:26:53
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1470 Modified Files: badguy.cpp collision.cpp collision.h gameobjs.cpp player.cpp tile.cpp tile.h Log Message: - added spikes Index: tile.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/tile.h,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- tile.h 8 May 2004 11:35:04 -0000 1.19 +++ tile.h 17 May 2004 06:26:41 -0000 1.20 @@ -58,12 +58,16 @@ /** water */ bool water; + /** spike - kills player on contact */ + bool spike; + /** Bonusbox, content is stored in \a data */ bool fullbox; /** Tile is a distro/coin */ bool distro; + /** the level should be finished when touching a goaltile. * if data is 0 then the endsequence should be triggered, if data is 1 * then we can finish the level instantly. Index: collision.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/collision.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- collision.h 16 May 2004 05:48:28 -0000 1.12 +++ collision.h 17 May 2004 06:26:41 -0000 1.13 @@ -54,6 +54,7 @@ bool issolid(float x, float y); bool isbrick(float x, float y); bool isice(float x, float y); +bool isspike(float x, float y); bool isfullbox(float x, float y); typedef void* (*tiletestfunction)(Tile* tile); Index: collision.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/collision.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- collision.cpp 7 May 2004 20:48:21 -0000 1.22 +++ collision.cpp 17 May 2004 06:26:41 -0000 1.23 @@ -263,6 +263,12 @@ return tile && tile->ice; } +bool isspike(float x, float y) +{ + Tile* tile = gettile(x,y); + return tile && tile->spike; +} + bool isfullbox(float x, float y) { Tile* tile = gettile(x,y); Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.76 retrieving revision 1.77 diff -u -d -r1.76 -r1.77 --- badguy.cpp 16 May 2004 18:44:54 -0000 1.76 +++ badguy.cpp 17 May 2004 06:26:41 -0000 1.77 @@ -719,6 +719,17 @@ return; } + // Kill us if we landed on spikes + if (dying == DYING_NOT + && (kind != BAD_STALACTITE && kind != BAD_FLAME && kind != BAD_BOMB) + && (isspike(base.x, base.y) || isspike(base.x + base.width, base.y) + || isspike(base.x, base.y + base.height) + || isspike(base.x + base.width, base.y + base.height))) + { + physic.set_velocity_y(3); + kill_me(0); + } + // Once it's on screen, it's activated! if (base.x <= scroll_x + screen->w + OFFSCREEN_DISTANCE) seen = true; @@ -965,6 +976,7 @@ physic.enable_gravity(true); /* Gain some points: */ + if (score != 0) World::current()->add_score(base.x, base.y, score * player_status.score_multiplier); Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.97 retrieving revision 1.98 diff -u -d -r1.97 -r1.98 --- player.cpp 17 May 2004 05:35:21 -0000 1.97 +++ player.cpp 17 May 2004 06:26:41 -0000 1.98 @@ -184,6 +184,14 @@ collision_swept_object_map(&old_base, &base); + if (!invincible_timer.started() + && (isspike(base.x, base.y) || isspike(base.x + base.width, base.y) + || isspike(base.x, base.y + base.height) + || isspike(base.x + base.width, base.y + base.height))) + { + kill(SHRINK); + } + // Don't accelerate Tux if he is running against a wall if (target.x != base.x) { Index: gameobjs.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameobjs.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- gameobjs.cpp 17 May 2004 05:24:40 -0000 1.23 +++ gameobjs.cpp 17 May 2004 06:26:41 -0000 1.24 @@ -255,6 +255,8 @@ void Trampoline::action(double frame_ratio) { + // TODO: Remove if we're too far off the screen + physic.apply(frame_ratio, base.x, base.y); // Falling Index: tile.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/tile.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- tile.cpp 14 May 2004 17:35:30 -0000 1.22 +++ tile.cpp 17 May 2004 06:26:41 -0000 1.23 @@ -91,6 +91,7 @@ tile->brick = false; tile->ice = false; tile->water = false; + tile->spike = false; tile->fullbox = false; tile->distro = false; tile->goal = false; @@ -104,6 +105,7 @@ reader.read_bool("brick", &tile->brick); reader.read_bool("ice", &tile->ice); reader.read_bool("water", &tile->water); + reader.read_bool("spike", &tile->spike); reader.read_bool("fullbox", &tile->fullbox); reader.read_bool("distro", &tile->distro); reader.read_bool("goal", &tile->goal); |