From: Matthias Braun Date: Sat, 3 Mar 2007 21:09:25 +0000 (+0000) Subject: at the left or right end, it's obvious which dir we will go next X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=64530628d03afcd5120125182295f5e0c7210294;p=supertux.git at the left or right end, it's obvious which dir we will go next SVN-Revision: 4921 --- diff --git a/src/object/camera.cpp b/src/object/camera.cpp index a0f6bc947..8ad604f32 100644 --- a/src/object/camera.cpp +++ b/src/object/camera.cpp @@ -378,14 +378,21 @@ Camera::update_scroll_normal(float elapsed_time) float LEFTEND = SCREEN_WIDTH * config.sensitive_x; float RIGHTEND = SCREEN_WIDTH * (1-config.sensitive_x); - /* if we're undecided then look if we crossed the left or right "sensitive" - * area */ if(lookahead_mode == LOOKAHEAD_NONE) { + /* if we're undecided then look if we crossed the left or right + * "sensitive" area */ if(player_pos.x < translation.x + LEFTEND) { lookahead_mode = LOOKAHEAD_LEFT; } else if(player_pos.x > translation.x + RIGHTEND) { lookahead_mode = LOOKAHEAD_RIGHT; } + /* at the ends of a level it's obvious which way we will go */ + if(player_pos.x < SCREEN_WIDTH*0.5) { + lookahead_mode = LOOKAHEAD_RIGHT; + } else if(player_pos.x >= sector->get_width() - SCREEN_WIDTH*0.5) { + lookahead_mode = LOOKAHEAD_LEFT; + } + changetime = -1; } else if(lookahead_mode != walkDirection) { /* player changed direction while camera was scrolling...