pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] r2815 - in branches/pingus_sdl: . src src/components


From: jsalmon3
Subject: [Pingus-CVS] r2815 - in branches/pingus_sdl: . src src/components
Date: Sun, 5 Aug 2007 21:18:53 +0200

Author: jsalmon3
Date: 2007-08-05 21:18:47 +0200 (Sun, 05 Aug 2007)
New Revision: 2815

Modified:
   branches/pingus_sdl/TODO
   branches/pingus_sdl/src/components/smallmap.cpp
   branches/pingus_sdl/src/graphic_context_state.cpp
Log:
Fixed bug scrolling and drawing the smallmap rectangle when the map size is 
smaller than the screen

Modified: branches/pingus_sdl/TODO
===================================================================
--- branches/pingus_sdl/TODO    2007-08-05 18:20:06 UTC (rev 2814)
+++ branches/pingus_sdl/TODO    2007-08-05 19:18:47 UTC (rev 2815)
@@ -32,8 +32,6 @@
 
 - completly broken: data/levels/playable/bombing.scm (z ordering?)
 
-- small levels make scrolling go crazy: data/levels/playable/blue3-marcotte.scm
-
 - hotspot offset gets ignored/mishandled
 
 - colorkey is used even in surfaces that don't have transparency

Modified: branches/pingus_sdl/src/components/smallmap.cpp
===================================================================
--- branches/pingus_sdl/src/components/smallmap.cpp     2007-08-05 18:20:06 UTC 
(rev 2814)
+++ branches/pingus_sdl/src/components/smallmap.cpp     2007-08-05 19:18:47 UTC 
(rev 2815)
@@ -89,10 +89,12 @@
   gc.draw(image->get_surface(), Vector3f((float)x_pos, (float)y_pos));
   
   Vector2i of = playfield->get_pos();
-    
-  of.x = x_pos + of.x * width  / 
client->get_server()->get_world()->get_colmap()->get_width();
-  of.y = y_pos + of.y * height / 
client->get_server()->get_world()->get_colmap()->get_height();
 
+  int cwidth = client->get_server()->get_world()->get_colmap()->get_width();
+  int cheight = client->get_server()->get_world()->get_colmap()->get_height();
+  of.x = x_pos + of.x * width  / Math::max(cwidth, int(gc.get_width()));
+  of.y = y_pos + of.y * height / Math::max(cheight, int(gc.get_height()));
+
   int w = Math::min(rwidth,  int(width  - 1));
   int h = Math::min(rheight, int(height - 1));
 

Modified: branches/pingus_sdl/src/graphic_context_state.cpp
===================================================================
--- branches/pingus_sdl/src/graphic_context_state.cpp   2007-08-05 18:20:06 UTC 
(rev 2814)
+++ branches/pingus_sdl/src/graphic_context_state.cpp   2007-08-05 19:18:47 UTC 
(rev 2815)
@@ -165,7 +165,10 @@
         }
       else if (-impl->offset.x + get_width() > impl->limit.right)
         {
-          impl->offset.x = (float)-(impl->limit.right - get_width());
+          if (impl->limit.right - impl->limit.left > get_width())
+            impl->offset.x = (float)-(impl->limit.right - get_width());
+          else
+            impl->offset.x = (float)-(impl->limit.left);
         }
 
       if (-impl->offset.y < impl->limit.top)
@@ -174,7 +177,10 @@
         }
       else if (-impl->offset.y + get_height() > impl->limit.bottom)
         {
-          impl->offset.y = (float)-(impl->limit.bottom - get_height());
+          if (impl->limit.bottom - impl->limit.top > get_height())
+            impl->offset.y = (float)-(impl->limit.bottom - get_height());
+          else
+            impl->offset.y = (float)-(impl->limit.top);
         }
     }
 }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]