X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fgameloop.cpp;h=d05379f9dd3d760b87592cf88059d714dbe46798;hb=546364c9567ef212ea9276201facf73f5ada696a;hp=63f7791f7e99efa4ae8a634ffd908b2e4c111fd8;hpb=1dd7efd08b81efc1066381c5a1723592bb653d7d;p=supertux.git diff --git a/src/gameloop.cpp b/src/gameloop.cpp index 63f7791f7..d05379f9d 100644 --- a/src/gameloop.cpp +++ b/src/gameloop.cpp @@ -191,8 +191,10 @@ GameSession::levelintro(void) DrawingContext context; currentsector->background->draw(context); - context.draw_text(gold_text, level->get_name(), Vector(screen->w/2, 160), - CENTER_ALLIGN, LAYER_FOREGROUND1); +// context.draw_text(gold_text, level->get_name(), Vector(screen->w/2, 160), +// CENTER_ALLIGN, LAYER_FOREGROUND1); + context.draw_center_text(gold_text, level->get_name(), Vector(0, 160), + LAYER_FOREGROUND1); sprintf(str, "TUX x %d", player_status.lives); context.draw_text(white_text, str, Vector(screen->w/2, 210), @@ -246,11 +248,12 @@ GameSession::on_escape_press() it could have nasty bugs, like going allways to the right or whatever that key does */ Player& tux = *(currentsector->player); - tux.key_event((SDLKey)keymap.jump, UP); - tux.key_event((SDLKey)keymap.duck, UP); + tux.key_event((SDLKey)keymap.up, UP); + tux.key_event((SDLKey)keymap.down, UP); tux.key_event((SDLKey)keymap.left, UP); tux.key_event((SDLKey)keymap.right, UP); - tux.key_event((SDLKey)keymap.fire, UP); + tux.key_event((SDLKey)keymap.jump, UP); + tux.key_event((SDLKey)keymap.power, UP); Menu::set_current(game_menu); Ticks::pause_start(); @@ -441,6 +444,11 @@ GameSession::process_events() player_status.lives--; last_keys.clear(); } + if(compare_last(last_keys, "grease")) + { + tux.physic.set_velocity_x(tux.physic.get_velocity_x()*3); + last_keys.clear(); + } if(compare_last(last_keys, "invincible")) { // be invincle for the rest of the level tux.invincible_timer.start(time_left.get_left()); @@ -469,6 +477,22 @@ GameSession::process_events() currentsector->camera->reset(Vector(tux.base.x, tux.base.y)); last_keys.clear(); } + // temporary to help player's choosing a flapping + if(compare_last(last_keys, "marek")) + { + tux.flapping_mode = Player::MAREK_FLAP; + last_keys.clear(); + } + if(compare_last(last_keys, "ricardo")) + { + tux.flapping_mode = Player::RICARDO_FLAP; + last_keys.clear(); + } + if(compare_last(last_keys, "ryan")) + { + tux.flapping_mode = Player::RYAN_FLAP; + last_keys.clear(); + } break; case SDL_JOYAXISMOTION: @@ -493,11 +517,20 @@ GameSession::process_events() else if (event.jaxis.axis == joystick_keymap.y_axis) { if (event.jaxis.value > joystick_keymap.dead_zone) - tux.input.down = DOWN; - else if (event.jaxis.value < -joystick_keymap.dead_zone) + { + tux.input.up = DOWN; tux.input.down = UP; + } + else if (event.jaxis.value < -joystick_keymap.dead_zone) + { + tux.input.up = UP; + tux.input.down = DOWN; + } else - tux.input.down = UP; + { + tux.input.up = DOWN; + tux.input.down = DOWN; + } } break; @@ -524,7 +557,7 @@ GameSession::process_events() case SDL_JOYBUTTONDOWN: if (event.jbutton.button == joystick_keymap.a_button) - tux.input.up = DOWN; + tux.input.jump = DOWN; else if (event.jbutton.button == joystick_keymap.b_button) tux.input.fire = DOWN; else if (event.jbutton.button == joystick_keymap.start_button) @@ -532,7 +565,7 @@ GameSession::process_events() break; case SDL_JOYBUTTONUP: if (event.jbutton.button == joystick_keymap.a_button) - tux.input.up = UP; + tux.input.jump = UP; else if (event.jbutton.button == joystick_keymap.b_button) tux.input.fire = UP; break; @@ -621,8 +654,9 @@ GameSession::action(double frame_ratio) int red = rand() % 255; // calculate firework color int green = rand() % red; - currentsector->add_particles(epicenter, Vector(1.4,1.4), Vector(0,0), - 45, Color(red,green,0), 3, 1300); + currentsector->add_particles(epicenter, 0, 360, Vector(1.4,1.4), + Vector(0,0), 45, Color(red,green,0), 3, 1300, + LAYER_FOREGROUND1+1); SoundManager::get()->play_sound(IDToSound(SND_FIREWORKS)); random_timer.start(rand() % 400 + 600); // next firework @@ -953,12 +987,11 @@ bool process_load_game_menu() if (access(slotfile.c_str(), F_OK) != 0) { + shrink_fade(Vector(screen->w/2,screen->h/2), 600); draw_intro(); } - // shrink_fade(Point((screen->w/2),(screen->h/2)), 1000); fadeout(256); - DrawingContext context; context.draw_text(white_text, "Loading...", Vector(screen->w/2, screen->h/2), CENTER_ALLIGN, LAYER_FOREGROUND1); @@ -966,6 +999,7 @@ bool process_load_game_menu() WorldMapNS::WorldMap worldmap; + worldmap.set_map_filename("icyisland.stwm"); // Load the game or at least set the savegame_file variable worldmap.loadgame(slotfile);