From: Wolfgang Becker Date: Fri, 11 Apr 2008 18:12:27 +0000 (+0000) Subject: * Peek in X and Y direction at the same time. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=60301a8f1268695058e2241473e1aaa7c28cd9d9;p=supertux.git * Peek in X and Y direction at the same time. * Print used renderer information. (GL or SDL) * Spikes on tiles 2120 and 2178 do hurt. SVN-Revision: 5386 --- diff --git a/data/images/tiles.strf b/data/images/tiles.strf index 2ec961ea3..84e84d592 100644 --- a/data/images/tiles.strf +++ b/data/images/tiles.strf @@ -6855,7 +6855,7 @@ 1 1 1 0 0 1 1 1 0 0 1 1 1 0 0 - 1 1 1 0 0 + 1 1 1 0 1024 ) (image "tiles/snowcastle/foreground.png") ) @@ -6996,6 +6996,7 @@ (tile (id 2178) + (hurts #t) (images "tiles/snow/spike.png")) diff --git a/src/object/camera.cpp b/src/object/camera.cpp index 9c26e863c..d8402415d 100644 --- a/src/object/camera.cpp +++ b/src/object/camera.cpp @@ -404,9 +404,9 @@ Camera::update_scroll_normal(float elapsed_time) float peek_to = 0; float translation_compensation = player_pos.y - translation.y; - if(player->peeking_direction() == ::UP) { + if(player->peeking_direction_y() == ::UP) { peek_to = bottom_edge - translation_compensation; - } else if(player->peeking_direction() == ::DOWN) { + } else if(player->peeking_direction_y() == ::DOWN) { peek_to = top_edge - translation_compensation; } @@ -571,9 +571,9 @@ Camera::update_scroll_normal(float elapsed_time) float peek_to = 0; float translation_compensation = player_pos.x - translation.x; - if(player->peeking_direction() == ::LEFT) { + if(player->peeking_direction_x() == ::LEFT) { peek_to = right_edge - translation_compensation; - } else if(player->peeking_direction() == ::RIGHT) { + } else if(player->peeking_direction_x() == ::RIGHT) { peek_to = left_edge - translation_compensation; } diff --git a/src/object/player.cpp b/src/object/player.cpp index 7abd84662..abacfa4d2 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -139,7 +139,8 @@ Player::init() dead = false; dying = false; - peeking = AUTO; + peekingX = AUTO; + peekingY = AUTO; last_ground_y = 0; fall_mode = ON_GROUND; jumping = false; @@ -651,28 +652,28 @@ Player::handle_input() /* Peeking */ if( controller->released( Controller::PEEK_LEFT ) ) { - peeking = AUTO; + peekingX = AUTO; } if( controller->released( Controller::PEEK_RIGHT ) ) { - peeking = AUTO; + peekingX = AUTO; } if( controller->released( Controller::PEEK_UP ) ) { - peeking = AUTO; + peekingY = AUTO; } if( controller->released( Controller::PEEK_DOWN ) ) { - peeking = AUTO; + peekingY = AUTO; } if( controller->pressed( Controller::PEEK_LEFT ) ) { - peeking = LEFT; + peekingX = LEFT; } if( controller->pressed( Controller::PEEK_RIGHT ) ) { - peeking = RIGHT; + peekingX = RIGHT; } if(!backflipping && !jumping && on_ground()) { if( controller->pressed( Controller::PEEK_UP ) ) { - peeking = UP; + peekingY = UP; } else if( controller->pressed( Controller::PEEK_DOWN ) ) { - peeking = DOWN; + peekingY = DOWN; } } diff --git a/src/object/player.hpp b/src/object/player.hpp index be124ac05..afe93e48a 100644 --- a/src/object/player.hpp +++ b/src/object/player.hpp @@ -70,7 +70,7 @@ private: bool dying; bool backflipping; int backflip_direction; - Direction peeking; + Direction peekingX, peekingY; bool swimming; float speedlimit; Controller* scripting_controller_old; /**< Saves the old controller while the scripting_controller is used */ @@ -130,9 +130,14 @@ public: { return dying; } - Direction peeking_direction() const + Direction peeking_direction_x() const { - return peeking; + return peekingX; + } + + Direction peeking_direction_y() const + { + return peekingY; } void kill(bool completely); diff --git a/src/video/video_systems.cpp b/src/video/video_systems.cpp index 1fd3627c2..261285729 100644 --- a/src/video/video_systems.cpp +++ b/src/video/video_systems.cpp @@ -38,21 +38,27 @@ Renderer *new_renderer() { case AUTO_VIDEO: #ifdef HAVE_OPENGL + log_info << "new GL renderer\n"; return new GL::Renderer(); #else + log_warning << "new SDL renderer\n"; return new SDL::Renderer(); #endif #ifdef HAVE_OPENGL case OPENGL: + log_info << "new GL renderer\n"; return new GL::Renderer(); #endif case PURE_SDL: + log_warning << "new SDL renderer\n"; return new SDL::Renderer(); default: assert(0 && "invalid video system in config"); #ifdef HAVE_OPENGL + log_info << "new GL renderer\n"; return new GL::Renderer(); #else + log_warning << "new SDL renderer\n"; return new SDL::Renderer(); #endif }