[Super-tux-commit] supertux/src badguy.cpp,1.7,1.8 badguy.h,1.11,1.12 gameloop.cpp,1.16,1.17 leveled
Brought to you by:
wkendrick
From: Ingo R. <gr...@us...> - 2004-03-24 15:34:47
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18987 Modified Files: badguy.cpp badguy.h gameloop.cpp leveleditor.cpp scene.cpp scene.h Log Message: - created a named enum for badguys Index: scene.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/scene.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- scene.cpp 22 Mar 2004 15:47:31 -0000 1.3 +++ scene.cpp 24 Mar 2004 15:24:07 -0000 1.4 @@ -131,7 +131,7 @@ /* Add a bad guy: */ -void add_bad_guy(float x, float y, int kind) +void add_bad_guy(float x, float y, BadGuyKind kind) { bad_guy_type new_bad_guy; badguy_init(&new_bad_guy,x,y,kind); Index: leveleditor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- leveleditor.cpp 24 Mar 2004 13:52:34 -0000 1.13 +++ leveleditor.cpp 24 Mar 2004 15:24:05 -0000 1.14 @@ -130,7 +130,7 @@ for (y = 0; y < 15; ++y) for (x = 0; x < le_current_level->width; ++x) if (le_current_level->tiles[y][x] >= '0' && le_current_level->tiles[y][x] <= '9') - add_bad_guy(x * 32, y * 32, le_current_level->tiles[y][x] - '0'); + add_bad_guy(x * 32, y * 32, static_cast<BadGuyKind>(le_current_level->tiles[y][x] - '0')); } void le_set_defaults() Index: badguy.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- badguy.h 24 Mar 2004 15:12:16 -0000 1.11 +++ badguy.h 24 Mar 2004 15:24:05 -0000 1.12 @@ -22,19 +22,24 @@ #include "collision.h" /* Enemy modes: */ - #define NORMAL 0 #define FLAT 1 #define KICK 2 #define HELD 3 -/* Badguy type: */ +/* Bad guy kinds: */ +enum BadGuyKind { + BAD_BSOD, + BAD_LAPTOP, + BAD_MONEY +}; +/* Badguy type: */ struct bad_guy_type { int mode; DyingType dying; - int kind; + BadGuyKind kind; bool seen; int dir; int frame; @@ -44,14 +49,6 @@ physic_type physic; }; -/* Bad guy kinds: */ - -enum { - BAD_BSOD, - BAD_LAPTOP, - BAD_MONEY -}; - extern texture_type img_bsod_squished_left; extern texture_type img_bsod_squished_right; extern texture_type img_bsod_falling_left; @@ -71,7 +68,7 @@ void badguy_create_bitmasks(); -void badguy_init(bad_guy_type* pbad, float x, float y, int kind); +void badguy_init(bad_guy_type* pbad, float x, float y, BadGuyKind kind); void badguy_action(bad_guy_type* pbad); void badguy_draw(bad_guy_type* pbad); Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- badguy.cpp 24 Mar 2004 15:12:16 -0000 1.7 +++ badguy.cpp 24 Mar 2004 15:24:04 -0000 1.8 @@ -38,20 +38,20 @@ /*bm_bsod = img_bsod_left[0];*/ } -void badguy_init(bad_guy_type* pbad, float x, float y, int kind) +void badguy_init(bad_guy_type* pbad, float x, float y, BadGuyKind kind) { - pbad->base.width = 32; + pbad->base.width = 32; pbad->base.height = 32; - pbad->mode = NORMAL; - pbad->dying = DYING_NOT; - pbad->kind = kind; - pbad->base.x = x; - pbad->base.y = y; - pbad->base.xm = 1.3; - pbad->base.ym = 4.8; + pbad->mode = NORMAL; + pbad->dying = DYING_NOT; + pbad->kind = kind; + pbad->base.x = x; + pbad->base.y = y; + pbad->base.xm = 1.3; + pbad->base.ym = 4.8; pbad->old_base = pbad->base; - pbad->dir = LEFT; - pbad->seen = false; + pbad->dir = LEFT; + pbad->seen = false; timer_init(&pbad->timer, true); physic_init(&pbad->physic); } Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- gameloop.cpp 24 Mar 2004 13:52:34 -0000 1.16 +++ gameloop.cpp 24 Mar 2004 15:24:05 -0000 1.17 @@ -108,7 +108,7 @@ { if (current_level.tiles[y][x] >= '0' && current_level.tiles[y][x] <= '9') { - add_bad_guy(x * 32, y * 32, current_level.tiles[y][x] - '0'); + add_bad_guy(x * 32, y * 32, static_cast<BadGuyKind>(current_level.tiles[y][x] - '0')); current_level.tiles[y][x] = '.'; } } Index: scene.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/scene.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- scene.h 22 Mar 2004 15:47:31 -0000 1.9 +++ scene.h 24 Mar 2004 15:24:07 -0000 1.10 @@ -57,7 +57,7 @@ void add_broken_brick(float x, float y); void add_broken_brick_piece(float x, float y, float xm, float ym); void add_bouncy_brick(float x, float y); -void add_bad_guy(float x, float y, int kind); +void add_bad_guy(float x, float y, BadGuyKind kind); void add_upgrade(float x, float y, int dir, int kind); void add_bullet(float x, float y, float xm, int dir); |