[Super-tux-commit] supertux/src gameloop.cpp,1.124,1.124.2.1 gameloop.h,1.48,1.48.2.1 leveleditor.cp
Brought to you by:
wkendrick
From: Ryan F. <sik...@us...> - 2004-05-15 22:23:06
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26560/src Modified Files: Tag: supertux_0_1_1_branch gameloop.cpp gameloop.h leveleditor.cpp leveleditor.h worldmap.cpp worldmap.h Log Message: - Created supertux_0_1_1_branch branch (bugfix branch) - Fixed level editor not scrolling all the way to end of level - Fixed problems with enums Index: worldmap.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.h,v retrieving revision 1.28 retrieving revision 1.28.2.1 diff -u -d -r1.28 -r1.28.2.1 --- worldmap.h 27 Apr 2004 18:44:19 -0000 1.28 +++ worldmap.h 15 May 2004 22:22:54 -0000 1.28.2.1 @@ -81,7 +81,7 @@ Tile* get(int i); }; -enum Direction { NONE, WEST, EAST, NORTH, SOUTH }; +enum Direction { D_NONE, D_WEST, D_EAST, D_NORTH, D_SOUTH }; std::string direction_to_string(Direction d); Direction string_to_direction(const std::string& d); Index: leveleditor.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.cpp,v retrieving revision 1.109 retrieving revision 1.109.2.1 diff -u -d -r1.109 -r1.109.2.1 --- leveleditor.cpp 10 May 2004 21:59:25 -0000 1.109 +++ leveleditor.cpp 15 May 2004 22:22:54 -0000 1.109.2.1 @@ -212,8 +212,8 @@ /* making events results to be in order */ if(pos_x < 0) pos_x = 0; - if(pos_x > (le_world->get_level()->width * 32) - screen->w) - pos_x = (le_world->get_level()->width * 32) - screen->w; + if(pos_x > (le_world->get_level()->width * 32 + 2*32) - screen->w) + pos_x = (le_world->get_level()->width * 32 +2*32) - screen->w; /* draw the level */ le_drawlevel(); @@ -809,12 +809,12 @@ if(show_selections && MouseCursor::current() != mouse_select_object) { - if(le_selection_mode == CURSOR) + if(le_selection_mode == SM_CURSOR) { if(le_current.IsTile()) le_selection->draw( cursor_x - pos_x, cursor_y); } - else if(le_selection_mode == SQUARE) + else if(le_selection_mode == SM_SQUARE) { int w, h; le_highlight_selection(); @@ -860,9 +860,9 @@ le_next_level_bt->draw(); le_previous_level_bt->draw(); le_rubber_bt->draw(); - if(le_selection_mode == SQUARE) + if(le_selection_mode == SM_SQUARE) le_select_mode_one_bt->draw(); - else if(le_selection_mode == CURSOR) + else if(le_selection_mode == SM_CURSOR) le_select_mode_two_bt->draw(); le_settings_bt->draw(); le_move_right_bt->draw(); @@ -1305,17 +1305,17 @@ } - if(le_selection_mode == SQUARE) + if(le_selection_mode == SM_SQUARE) { le_select_mode_one_bt->event(event); if(le_select_mode_one_bt->get_state() == BUTTON_CLICKED) - le_selection_mode = CURSOR; + le_selection_mode = SM_CURSOR; } else { le_select_mode_two_bt->event(event); if(le_select_mode_two_bt->get_state() == BUTTON_CLICKED) - le_selection_mode = SQUARE; + le_selection_mode = SM_SQUARE; } ButtonPanelMap::iterator it; le_tilegroup_bt->event(event); @@ -1623,7 +1623,7 @@ switch(le_selection_mode) { - case CURSOR: + case SM_CURSOR: le_world->get_level()->change(x,y,tm,c); base_type cursor_base; @@ -1643,7 +1643,7 @@ } break; - case SQUARE: + case SM_SQUARE: if(selection.x1 < selection.x2) { x1 = selection.x1; @@ -1724,7 +1724,7 @@ { bool tmp_show_grid = le_show_grid; int temp_le_selection_mode = le_selection_mode; - le_selection_mode = NONE; + le_selection_mode = SM_NONE; show_selections = true; le_show_grid = false; le_help_shown = true; Index: gameloop.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.h,v retrieving revision 1.48 retrieving revision 1.48.2.1 diff -u -d -r1.48 -r1.48.2.1 --- gameloop.h 29 Apr 2004 00:15:10 -0000 1.48 +++ gameloop.h 15 May 2004 22:22:54 -0000 1.48.2.1 @@ -73,7 +73,7 @@ std::string subset; public: - enum ExitStatus { NONE, LEVEL_FINISHED, GAME_OVER, LEVEL_ABORT }; + enum ExitStatus { ES_NONE, ES_LEVEL_FINISHED, ES_GAME_OVER, ES_LEVEL_ABORT }; private: ExitStatus exit_status; public: Index: worldmap.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/worldmap.cpp,v retrieving revision 1.68 retrieving revision 1.68.2.1 diff -u -d -r1.68 -r1.68.2.1 --- worldmap.cpp 8 May 2004 10:45:52 -0000 1.68 +++ worldmap.cpp 15 May 2004 22:22:54 -0000 1.68.2.1 @@ -36,18 +36,18 @@ { switch(direction) { - case WEST: - return EAST; - case EAST: - return WEST; - case NORTH: - return SOUTH; - case SOUTH: - return NORTH; - case NONE: - return NONE; + case D_WEST: + return D_EAST; + case D_EAST: + return D_WEST; + case D_NORTH: + return D_SOUTH; + case D_SOUTH: + return D_NORTH; + case D_NONE: + return D_NONE; } - return NONE; + return D_NONE; } std::string @@ -55,13 +55,13 @@ { switch(direction) { - case WEST: + case D_WEST: return "west"; - case EAST: + case D_EAST: return "east"; - case NORTH: + case D_NORTH: return "north"; - case SOUTH: + case D_SOUTH: return "south"; default: return "none"; @@ -72,15 +72,15 @@ string_to_direction(const std::string& directory) { if (directory == "west") - return WEST; + return D_WEST; else if (directory == "east") - return EAST; + return D_EAST; else if (directory == "north") - return NORTH; + return D_NORTH; else if (directory == "south") - return SOUTH; + return D_SOUTH; else - return NONE; + return D_NONE; } TileManager::TileManager() @@ -173,8 +173,8 @@ moving = false; tile_pos.x = 4; tile_pos.y = 5; - direction = NONE; - input_direction = NONE; + direction = D_NONE; + input_direction = D_NONE; } Tux::~Tux() @@ -214,19 +214,19 @@ switch(direction) { - case WEST: + case D_WEST: x -= offset - 32; break; - case EAST: + case D_EAST: x += offset - 32; break; - case NORTH: + case D_NORTH: y -= offset - 32; break; - case SOUTH: + case D_SOUTH: y += offset - 32; break; - case NONE: + case D_NONE: break; } @@ -237,7 +237,7 @@ Tux::stop() { offset = 0; - direction = NONE; + direction = D_NONE; moving = false; } @@ -246,7 +246,7 @@ { if (!moving) { - if (input_direction != NONE) + if (input_direction != D_NONE) { WorldMap::Level* level = worldmap->at_level(); @@ -288,18 +288,18 @@ if (worldmap->at(tile_pos)->auto_walk) { // Turn to a new direction Tile* tile = worldmap->at(tile_pos); - Direction dir = NONE; + Direction dir = D_NONE; - if (tile->north && back_direction != NORTH) - dir = NORTH; - else if (tile->south && back_direction != SOUTH) - dir = SOUTH; - else if (tile->east && back_direction != EAST) - dir = EAST; - else if (tile->west && back_direction != WEST) - dir = WEST; + if (tile->north && back_direction != D_NORTH) + dir = D_NORTH; + else if (tile->south && back_direction != D_SOUTH) + dir = D_SOUTH; + else if (tile->east && back_direction != D_EAST) + dir = D_EAST; + else if (tile->west && back_direction != D_WEST) + dir = D_WEST; - if (dir != NONE) + if (dir != D_NONE) { direction = dir; back_direction = reverse_dir(direction); @@ -352,7 +352,7 @@ leveldot_green = new Surface(datadir + "/images/worldmap/leveldot_green.png", USE_ALPHA); leveldot_red = new Surface(datadir + "/images/worldmap/leveldot_red.png", USE_ALPHA); - input_direction = NONE; + input_direction = D_NONE; enter_level = false; name = "<no file>"; @@ -493,7 +493,7 @@ WorldMap::get_input() { enter_level = false; - input_direction = NONE; + input_direction = D_NONE; SDL_Event event; while (SDL_PollEvent(&event)) @@ -529,16 +529,16 @@ if (event.jaxis.axis == joystick_keymap.x_axis) { if (event.jaxis.value < -joystick_keymap.dead_zone) - input_direction = WEST; + input_direction = D_WEST; else if (event.jaxis.value > joystick_keymap.dead_zone) - input_direction = EAST; + input_direction = D_EAST; } else if (event.jaxis.axis == joystick_keymap.y_axis) { if (event.jaxis.value > joystick_keymap.dead_zone) - input_direction = SOUTH; + input_direction = D_SOUTH; else if (event.jaxis.value < -joystick_keymap.dead_zone) - input_direction = NORTH; + input_direction = D_NORTH; } break; @@ -560,13 +560,13 @@ Uint8 *keystate = SDL_GetKeyState(NULL); if (keystate[SDLK_LEFT]) - input_direction = WEST; + input_direction = D_WEST; else if (keystate[SDLK_RIGHT]) - input_direction = EAST; + input_direction = D_EAST; else if (keystate[SDLK_UP]) - input_direction = NORTH; + input_direction = D_NORTH; else if (keystate[SDLK_DOWN]) - input_direction = SOUTH; + input_direction = D_SOUTH; } } @@ -575,19 +575,19 @@ { switch(direction) { - case WEST: + case D_WEST: pos.x -= 1; break; - case EAST: + case D_EAST: pos.x += 1; break; - case NORTH: + case D_NORTH: pos.y -= 1; break; - case SOUTH: + case D_SOUTH: pos.y += 1; break; - case NONE: + case D_NONE: break; } return pos; @@ -607,19 +607,19 @@ { // Check if we the tile allows us to go to new_pos switch(direction) { - case WEST: + case D_WEST: return (at(old_pos)->west && at(*new_pos)->east); - case EAST: + case D_EAST: return (at(old_pos)->east && at(*new_pos)->west); - case NORTH: + case D_NORTH: return (at(old_pos)->north && at(*new_pos)->south); - case SOUTH: + case D_SOUTH: return (at(old_pos)->south && at(*new_pos)->north); - case NONE: + case D_NONE: assert(!"path_ok() can't work if direction is NONE"); } return false; @@ -643,7 +643,7 @@ switch (session.run()) { - case GameSession::LEVEL_FINISHED: + case GameSession::ES_LEVEL_FINISHED: { bool old_level_state = level->solved; level->solved = true; @@ -658,20 +658,20 @@ if (old_level_state != level->solved) { // Try to detect the next direction to which we should walk // FIXME: Mostly a hack - Direction dir = NONE; + Direction dir = D_NONE; Tile* tile = at(tux->get_tile_pos()); - if (tile->north && tux->back_direction != NORTH) - dir = NORTH; - else if (tile->south && tux->back_direction != SOUTH) - dir = SOUTH; - else if (tile->east && tux->back_direction != EAST) - dir = EAST; - else if (tile->west && tux->back_direction != WEST) - dir = WEST; + if (tile->north && tux->back_direction != D_NORTH) + dir = D_NORTH; + else if (tile->south && tux->back_direction != D_SOUTH) + dir = D_SOUTH; + else if (tile->east && tux->back_direction != D_EAST) + dir = D_EAST; + else if (tile->west && tux->back_direction != D_WEST) + dir = D_WEST; - if (dir != NONE) + if (dir != D_NONE) { tux->set_direction(dir); //tux->update(delta); @@ -695,7 +695,7 @@ } break; - case GameSession::LEVEL_ABORT: + case GameSession::ES_LEVEL_ABORT: // Reseting the player_status might be a worthy // consideration, but I don't think we need it // 'cause only the bad players will use it to @@ -704,11 +704,11 @@ // then stop playing the game all together since it // is to hard) break; - case GameSession::GAME_OVER: + case GameSession::ES_GAME_OVER: quit = true; player_status.reset(); break; - case GameSession::NONE: + case GameSession::ES_NONE: // Should never be reached break; } Index: gameloop.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameloop.cpp,v retrieving revision 1.124 retrieving revision 1.124.2.1 diff -u -d -r1.124 -r1.124.2.1 --- gameloop.cpp 10 May 2004 21:54:22 -0000 1.124 +++ gameloop.cpp 15 May 2004 22:22:54 -0000 1.124.2.1 @@ -76,7 +76,7 @@ GameSession::restart_level() { game_pause = false; - exit_status = NONE; + exit_status = ES_NONE; end_sequence = NO_ENDSEQUENCE; fps_timer.init(true); @@ -183,7 +183,7 @@ if(st_gl_mode == ST_GL_TEST) { - exit_status = LEVEL_ABORT; + exit_status = ES_LEVEL_ABORT; } else if (!Menu::current()) { @@ -441,7 +441,7 @@ } else if(end_sequence && !endsequence_timer.check()) { - exit_status = LEVEL_FINISHED; + exit_status = ES_LEVEL_FINISHED; return; } else if(end_sequence == ENDSEQUENCE_RUNNING && endtile && endtile->data >= 1) @@ -465,7 +465,7 @@ if(st_gl_mode != ST_GL_TEST) drawendscreen(); - exit_status = GAME_OVER; + exit_status = ES_GAME_OVER; } else { // Still has lives, so reset Tux to the levelstart @@ -479,7 +479,7 @@ void GameSession::action(double frame_ratio) { - if (exit_status == NONE) + if (exit_status == ES_NONE) { // Update Tux and the World world->action(frame_ratio); @@ -529,7 +529,7 @@ break; case MNID_ABORTLEVEL: st_pause_ticks_stop(); - exit_status = LEVEL_ABORT; + exit_status = ES_LEVEL_ABORT; break; } } @@ -560,7 +560,7 @@ draw(); - while (exit_status == NONE) + while (exit_status == ES_NONE) { /* Calculate the movement-factor */ double frame_ratio = ((double)(update_time-last_update_time))/((double)FRAME_RATE); Index: leveleditor.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/leveleditor.h,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -u -d -r1.9 -r1.9.2.1 --- leveleditor.h 9 May 2004 13:55:54 -0000 1.9 +++ leveleditor.h 15 May 2004 22:22:54 -0000 1.9.2.1 @@ -30,9 +30,9 @@ /* selection modes */ enum { - CURSOR, - SQUARE, - NONE + SM_CURSOR, + SM_SQUARE, + SM_NONE }; int leveleditor(char* filename = NULL); |