[Super-tux-commit] supertux/src gameloop.cpp,1.28,1.29 level.cpp,1.17,1.18
Brought to you by:
wkendrick
From: Ingo R. <gr...@us...> - 2004-03-25 12:26:34
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17841 Modified Files: gameloop.cpp level.cpp Log Message: - cleaned up the way badguys are handled Index: level.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/level.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- level.cpp 25 Mar 2004 12:02:46 -0000 1.17 +++ level.cpp 25 Mar 2004 12:15:47 -0000 1.18 @@ -322,9 +322,6 @@ { std::map<char, int> transtable; transtable['.'] = 0; - transtable['0'] = 1000; - transtable['1'] = 1001; - transtable['2'] = 1002; transtable['x'] = 104; transtable['X'] = 77; transtable['y'] = 78; @@ -363,13 +360,29 @@ transtable['\\'] = 81; transtable['&'] = 75; + int x = 0; + int y = 0; for(std::vector<int>::iterator i = ia_tm.begin(); i != ia_tm.end(); ++i) { - std::map<char, int>::iterator j = transtable.find(*i); - if (j != transtable.end()) - *i = j->second; + if (*i == '0' || *i == '1' || *i == '2') + { + plevel->badguy_data.push_back(BadGuyData(static_cast<BadGuyKind>(*i-'0'), + x*32, y*32)); + *i = 0; + } else - printf("Error: conversion will fail, unsupported char: '%c' (%d)\n", *i, *i); + { + std::map<char, int>::iterator j = transtable.find(*i); + if (j != transtable.end()) + *i = j->second; + else + printf("Error: conversion will fail, unsupported char: '%c' (%d)\n", *i, *i); + } + ++x; + if (x >= plevel->width) { + x = 0; + ++y; + } } } } Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- gameloop.cpp 25 Mar 2004 11:36:05 -0000 1.28 +++ gameloop.cpp 25 Mar 2004 12:15:47 -0000 1.29 @@ -100,28 +100,12 @@ void activate_bad_guys(void) { - // Activate badguys the new style for (std::vector<BadGuyData>::iterator i = current_level.badguy_data.begin(); i != current_level.badguy_data.end(); ++i) { add_bad_guy(i->x, i->y, i->kind); } - - // FIXME: should be removed; - // Activate bad guys the old style - for (int y = 0; y < 15; y++) - { - for (int x = 0; x < current_level.width; x++) - { - if (current_level.ia_tiles[y][x] >= 1000 && current_level.ia_tiles[y][x] <= 1010) - { - add_bad_guy(x * 32, y * 32, - static_cast<BadGuyKind>(current_level.ia_tiles[y][x] - 1000)); - current_level.ia_tiles[y][x] = 0; - } - } - } } void activate_particle_systems(void) |