Klaus Denker's widescreen_fixes.patch:
authorWolfgang Becker <uafr@gmx.de>
Sun, 21 Jan 2007 19:04:09 +0000 (19:04 +0000)
committerWolfgang Becker <uafr@gmx.de>
Sun, 21 Jan 2007 19:04:09 +0000 (19:04 +0000)
It fixes some small bugs and graphic-failures appearing at
widescreen-resolutions. (or rotated widescreen resolutions)

SVN-Revision: 4629

data/levels/misc/menu.stl
data/levels/misc/messages.pot
data/locale/messages.pot
src/object/camera.cpp
src/sector.cpp
src/statistics.cpp
src/title.cpp
src/video/glutil.hpp
src/worldmap/worldmap.cpp

index eae8353..1b744ac 100644 (file)
@@ -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();
index e94a5ba..80033fd 100644 (file)
@@ -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 <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
index 32cd532..f2fb079 100644 (file)
@@ -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 <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\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 ""
index c3023df..62bfbc8 100644 (file)
@@ -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
index a8f5018..c70d606 100644 (file)
@@ -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
index 5655587..a5a8990 100644 (file)
@@ -38,8 +38,17 @@ namespace {
   const int nv_secrets = std::numeric_limits<int>::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)
 {
index c82b485..3877c00 100644 (file)
@@ -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());
index 6c2122f..90dd525 100644 (file)
@@ -63,6 +63,8 @@ static inline void check_gl_error(const char* message)
 
     throw std::runtime_error(msg.str());
   }
+#else
+  (void) message;
 #endif
 }
 
index 0ee8774..da69275 100644 (file)
@@ -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);