From 4780e94d19354eba04356043eddb600ad062a59c Mon Sep 17 00:00:00 2001 From: Wolfgang Becker Date: Sun, 21 Jan 2007 19:04:09 +0000 Subject: [PATCH] Klaus Denker's widescreen_fixes.patch: It fixes some small bugs and graphic-failures appearing at widescreen-resolutions. (or rotated widescreen resolutions) SVN-Revision: 4629 --- data/levels/misc/menu.stl | 4 +-- data/levels/misc/messages.pot | 2 +- data/locale/messages.pot | 78 +++++++++++++++++++++---------------------- src/object/camera.cpp | 4 +++ src/sector.cpp | 3 +- src/statistics.cpp | 14 +++++--- src/title.cpp | 2 +- src/video/glutil.hpp | 2 ++ src/worldmap/worldmap.cpp | 17 +++++++--- 9 files changed, 73 insertions(+), 53 deletions(-) diff --git a/data/levels/misc/menu.stl b/data/levels/misc/menu.stl index eae8353fb..1b744ac02 100644 --- a/data/levels/misc/menu.stl +++ b/data/levels/misc/menu.stl @@ -7,8 +7,8 @@ (music "music/theme.ogg") (init-script " logo <- FloatingImage(\"images/objects/logo/logo.sprite\"); -logo.set_anchor_point(ANCHOR_TOP); -logo.set_pos(0, 30); +logo.set_anchor_point(ANCHOR_MIDDLE); +logo.set_pos(0, -171); logo.set_visible(true); // Suspend (this is needed so that logo doesn't get deleted) suspend(); diff --git a/data/levels/misc/messages.pot b/data/levels/misc/messages.pot index e94a5ba51..80033fd13 100644 --- a/data/levels/misc/messages.pot +++ b/data/levels/misc/messages.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-01-15 21:44+0100\n" +"POT-Creation-Date: 2007-01-21 19:57+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/data/locale/messages.pot b/data/locale/messages.pot index 32cd532b0..f2fb07966 100644 --- a/data/locale/messages.pot +++ b/data/locale/messages.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-01-21 15:32+0100\n" +"POT-Creation-Date: 2007-01-21 19:57+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -55,34 +55,6 @@ msgstr "" msgid "Back" msgstr "" -#: src/main.cpp:210 -#, c-format -msgid "" -"Usage: %s [OPTIONS] [LEVELFILE]\n" -"\n" -msgstr "" - -#: src/main.cpp:212 -#, c-format -msgid "" -"Options:\n" -" -f, --fullscreen Run in fullscreen mode\n" -" -w, --window Run in window mode\n" -" -g, --geometry WIDTHxHEIGHT Run SuperTux in given resolution\n" -" -a, --aspect WIDTH:HEIGHT Run SuperTux with given aspect ratio\n" -" --disable-sfx Disable sound effects\n" -" --disable-music Disable music\n" -" --help Show this help message\n" -" --version Display SuperTux version and quit\n" -" --console Enable ingame scripting console\n" -" --noconsole Disable ingame scripting console\n" -" --show-fps Display framerate in levels\n" -" --no-show-fps Do not display framerate in levels\n" -" --record-demo FILE LEVEL Record a demo to FILE\n" -" --play-demo FILE LEVEL Play a recorded demo\n" -"\n" -msgstr "" - #: src/game_session.cpp:101 src/worldmap/worldmap.cpp:149 msgid "Pause" msgstr "" @@ -95,7 +67,7 @@ msgstr "" msgid "Abort Level" msgstr "" -#: src/game_session.cpp:254 src/statistics.cpp:232 +#: src/game_session.cpp:254 src/statistics.cpp:236 msgid "Coins" msgstr "" @@ -103,46 +75,74 @@ msgstr "" msgid "contributed by " msgstr "" -#: src/game_session.cpp:264 src/statistics.cpp:93 +#: src/game_session.cpp:264 src/statistics.cpp:97 msgid "Best Level Statistics" msgstr "" -#: src/statistics.cpp:111 src/statistics.cpp:168 +#: src/statistics.cpp:115 src/statistics.cpp:172 #, c-format msgid "Max coins collected:" msgstr "" -#: src/statistics.cpp:115 src/statistics.cpp:173 +#: src/statistics.cpp:119 src/statistics.cpp:177 #, c-format msgid "Max fragging:" msgstr "" -#: src/statistics.cpp:119 src/statistics.cpp:181 +#: src/statistics.cpp:123 src/statistics.cpp:185 #, c-format msgid "Min time needed:" msgstr "" -#: src/statistics.cpp:128 src/statistics.cpp:186 +#: src/statistics.cpp:132 src/statistics.cpp:190 #, c-format msgid "Max secrets found:" msgstr "" -#: src/statistics.cpp:229 +#: src/statistics.cpp:233 msgid "You" msgstr "" -#: src/statistics.cpp:230 +#: src/statistics.cpp:234 msgid "Best" msgstr "" -#: src/statistics.cpp:240 +#: src/statistics.cpp:244 msgid "Secrets" msgstr "" -#: src/statistics.cpp:248 +#: src/statistics.cpp:252 msgid "Time" msgstr "" +#: src/main.cpp:210 +#, c-format +msgid "" +"Usage: %s [OPTIONS] [LEVELFILE]\n" +"\n" +msgstr "" + +#: src/main.cpp:212 +#, c-format +msgid "" +"Options:\n" +" -f, --fullscreen Run in fullscreen mode\n" +" -w, --window Run in window mode\n" +" -g, --geometry WIDTHxHEIGHT Run SuperTux in given resolution\n" +" -a, --aspect WIDTH:HEIGHT Run SuperTux with given aspect ratio\n" +" --disable-sfx Disable sound effects\n" +" --disable-music Disable music\n" +" --help Show this help message\n" +" --version Display SuperTux version and quit\n" +" --console Enable ingame scripting console\n" +" --noconsole Disable ingame scripting console\n" +" --show-fps Display framerate in levels\n" +" --no-show-fps Do not display framerate in levels\n" +" --record-demo FILE LEVEL Record a demo to FILE\n" +" --play-demo FILE LEVEL Play a recorded demo\n" +"\n" +msgstr "" + #: src/title.cpp:82 src/title.cpp:274 msgid "Start Game" msgstr "" diff --git a/src/object/camera.cpp b/src/object/camera.cpp index c3023dfcb..62bfbc833 100644 --- a/src/object/camera.cpp +++ b/src/object/camera.cpp @@ -204,10 +204,14 @@ Camera::keep_in_bounds(Vector& translation) translation.y = height - SCREEN_HEIGHT; if(translation.y < 0) translation.y = 0; + if (height < SCREEN_HEIGHT) + translation.y = height/2.0 - SCREEN_HEIGHT/2.0; if(translation.x > width - SCREEN_WIDTH) translation.x = width - SCREEN_WIDTH; if(translation.x < 0) translation.x = 0; + if (width < SCREEN_WIDTH) + translation.x = width/2.0 - SCREEN_WIDTH/2.0; } void diff --git a/src/sector.cpp b/src/sector.cpp index a8f501833..c70d6068d 100644 --- a/src/sector.cpp +++ b/src/sector.cpp @@ -67,6 +67,7 @@ #include "scripting/squirrel_util.hpp" #include "script_interface.hpp" #include "log.hpp" +#include "main.hpp" Sector* Sector::_current = 0; @@ -630,7 +631,7 @@ Sector::get_active_region() { return Rect( camera->get_translation() - Vector(1600, 1200), - camera->get_translation() + Vector(1600, 1200)); + camera->get_translation() + Vector(1600, 1200) + Vector(SCREEN_WIDTH,SCREEN_HEIGHT)); } void diff --git a/src/statistics.cpp b/src/statistics.cpp index 56555875a..a5a8990d6 100644 --- a/src/statistics.cpp +++ b/src/statistics.cpp @@ -38,8 +38,17 @@ namespace { const int nv_secrets = std::numeric_limits::min(); } +float WMAP_INFO_LEFT_X; +float WMAP_INFO_RIGHT_X; +float WMAP_INFO_TOP_Y1; +float WMAP_INFO_TOP_Y2; + Statistics::Statistics() : coins(nv_coins), total_coins(nv_coins), badguys(nv_badguys), total_badguys(nv_badguys), time(nv_time), secrets(nv_secrets), total_secrets(nv_secrets), valid(true), display_stat(0) { + WMAP_INFO_LEFT_X = (SCREEN_WIDTH/2 + 80) + 32; + WMAP_INFO_RIGHT_X = SCREEN_WIDTH/2 + 368; + WMAP_INFO_TOP_Y1 = SCREEN_HEIGHT/2 + 172 - 16; + WMAP_INFO_TOP_Y2 = SCREEN_HEIGHT/2 + 172; } Statistics::~Statistics() @@ -76,11 +85,6 @@ Statistics::write(lisp::Writer& writer) #define TOTAL_DISPLAY_TIME 5 #define FADING_TIME 1 -const float WMAP_INFO_LEFT_X = (800 - 320) + 32; -const float WMAP_INFO_RIGHT_X = 800 - 32; -const float WMAP_INFO_TOP_Y1 = 600 - 128 - 16; -const float WMAP_INFO_TOP_Y2 = 600 - 128; - void Statistics::draw_worldmap_info(DrawingContext& context) { diff --git a/src/title.cpp b/src/title.cpp index c82b485ed..3877c007d 100644 --- a/src/title.cpp +++ b/src/title.cpp @@ -270,7 +270,7 @@ TitleScreen::TitleScreen() player->set_speedlimit(230); //MAX_WALK_XM main_menu.reset(new Menu()); - main_menu->set_pos(SCREEN_WIDTH/2, 335); + main_menu->set_pos(SCREEN_WIDTH/2, SCREEN_HEIGHT/2 + 35); main_menu->add_entry(MNID_STARTGAME, _("Start Game")); main_menu->add_entry(MNID_LEVELS_CONTRIB, _("Contrib Levels")); main_menu->add_submenu(_("Options"), get_options_menu()); diff --git a/src/video/glutil.hpp b/src/video/glutil.hpp index 6c2122fe0..90dd5255d 100644 --- a/src/video/glutil.hpp +++ b/src/video/glutil.hpp @@ -63,6 +63,8 @@ static inline void check_gl_error(const char* message) throw std::runtime_error(msg.str()); } +#else + (void) message; #endif } diff --git a/src/worldmap/worldmap.cpp b/src/worldmap/worldmap.cpp index 0ee8774ba..da6927550 100644 --- a/src/worldmap/worldmap.cpp +++ b/src/worldmap/worldmap.cpp @@ -528,10 +528,15 @@ WorldMap::update(float delta) if (camera_offset.y < 0) camera_offset.y = 0; - if (camera_offset.x > solids->get_width()*32 - SCREEN_WIDTH) - camera_offset.x = solids->get_width()*32 - SCREEN_WIDTH; - if (camera_offset.y > solids->get_height()*32 - SCREEN_HEIGHT) - camera_offset.y = solids->get_height()*32 - SCREEN_HEIGHT; + if (camera_offset.x > (int)solids->get_width()*32 - SCREEN_WIDTH) + camera_offset.x = (int)solids->get_width()*32 - SCREEN_WIDTH; + if (camera_offset.y > (int)solids->get_height()*32 - SCREEN_HEIGHT) + camera_offset.y = (int)solids->get_height()*32 - SCREEN_HEIGHT; + + if (int(solids->get_width()*32) < SCREEN_WIDTH) + camera_offset.x = solids->get_width()*16.0 - SCREEN_WIDTH/2.0; + if (int(solids->get_height()*32) < SCREEN_HEIGHT) + camera_offset.y = solids->get_height()*16.0 - SCREEN_HEIGHT/2.0; // handle input bool enter_level = false; @@ -663,6 +668,10 @@ WorldMap::at_teleporter(const Vector& pos) void WorldMap::draw(DrawingContext& context) { + if (int(solids->get_width()*32) < SCREEN_WIDTH || int(solids->get_height()*32) < SCREEN_HEIGHT) + context.draw_filled_rect(Vector(0, 0), Vector(SCREEN_WIDTH, SCREEN_HEIGHT), + Color(0.0f, 0.0f, 0.0f, 1.0f), LAYER_BACKGROUND0); + context.set_ambient_color( ambient_light ); context.push_transform(); context.set_translation(camera_offset); -- 2.11.0