From: Ingo Ruhnke Date: Thu, 25 Mar 2004 12:15:47 +0000 (+0000) Subject: - cleaned up the way badguys are handled X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=ac2b263bb256df9d50212819a94de2a63f161272;p=supertux.git - cleaned up the way badguys are handled SVN-Revision: 360 --- diff --git a/src/gameloop.cpp b/src/gameloop.cpp index 099643af9..bb8d76b0d 100644 --- a/src/gameloop.cpp +++ b/src/gameloop.cpp @@ -100,28 +100,12 @@ void start_timers(void) void activate_bad_guys(void) { - // Activate badguys the new style for (std::vector::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(current_level.ia_tiles[y][x] - 1000)); - current_level.ia_tiles[y][x] = 0; - } - } - } } void activate_particle_systems(void) diff --git a/src/level.cpp b/src/level.cpp index bc515dbab..9fb802c45 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -322,9 +322,6 @@ int level_load(st_level* plevel, const char* filename) { std::map 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 @@ int level_load(st_level* plevel, const char* filename) transtable['\\'] = 81; transtable['&'] = 75; + int x = 0; + int y = 0; for(std::vector::iterator i = ia_tm.begin(); i != ia_tm.end(); ++i) { - std::map::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(*i-'0'), + x*32, y*32)); + *i = 0; + } else - printf("Error: conversion will fail, unsupported char: '%c' (%d)\n", *i, *i); + { + std::map::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; + } } } }