pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] r3000 - in branches/pingus_sdl: . src/worldobjs


From: grumbel at BerliOS
Subject: [Pingus-CVS] r3000 - in branches/pingus_sdl: . src/worldobjs
Date: Sat, 18 Aug 2007 01:11:09 +0200

Author: grumbel
Date: 2007-08-18 01:11:07 +0200 (Sat, 18 Aug 2007)
New Revision: 3000

Modified:
   branches/pingus_sdl/TODO
   branches/pingus_sdl/src/worldobjs/surface_background.cpp
Log:
- fixed paralax scrolling issue

Modified: branches/pingus_sdl/TODO
===================================================================
--- branches/pingus_sdl/TODO    2007-08-17 20:48:53 UTC (rev 2999)
+++ branches/pingus_sdl/TODO    2007-08-17 23:11:07 UTC (rev 3000)
@@ -50,9 +50,6 @@
 Important:
 ==========
 
-- paralax handling is different between 0.6 and SDL, see
-  data/levels/playable/slidenride1-grumbel.pingus
-
 - grep for all the FIXME's and '#if 0' and find those that might be
   important, add what you find to this TODO
 
@@ -92,8 +89,6 @@
 - hurry-up should be removed and replaced by something less heavy
   (isn't used in tutorial island, since those levels don't have time)
 
-- remove unneeded/outdated fonts
-
 - "core/misc/404sprite" isn't returned for missing graphics
 
 Older Stuff:

Modified: branches/pingus_sdl/src/worldobjs/surface_background.cpp
===================================================================
--- branches/pingus_sdl/src/worldobjs/surface_background.cpp    2007-08-17 
20:48:53 UTC (rev 2999)
+++ branches/pingus_sdl/src/worldobjs/surface_background.cpp    2007-08-17 
23:11:07 UTC (rev 3000)
@@ -155,21 +155,17 @@
         }
       else
         {
-          int x_of = gc.color().get_clip_rect().left;
-          int y_of = gc.color().get_clip_rect().top;
+          Vector3f offset = gc.color().world_to_screen(Vector3f(0,0));
 
-          int start_x;
-          int start_y;
+          int start_x = static_cast<int>((offset.x * para_x) + scroll_ox);
+          int start_y = static_cast<int>((offset.y * para_y) + scroll_oy);
 
-          start_x = static_cast<int>((x_of * para_x) + scroll_ox);
-          start_y = static_cast<int>((y_of * para_y) + scroll_oy);
+          if (start_x > 0)
+            start_x = (start_x % bg_surface.get_width()) - 
bg_surface.get_width();
 
-          while (start_x > 0)
-            start_x -= bg_surface.get_width();
+          if (start_y > 0)
+            start_y = (start_y % bg_surface.get_height()) - 
bg_surface.get_height();
 
-          while (start_y > 0)
-            start_y -= bg_surface.get_height();
-
           for(int y = start_y;
               y < world->get_height();
               y += bg_surface.get_height())
@@ -178,8 +174,7 @@
                   x < world->get_width();
                   x += bg_surface.get_width())
                 {
-                  gc.color().draw(bg_surface, Vector3f(static_cast<float>(x),
-                                                       static_cast<float>(y), 
pos.z));
+                  gc.color().draw(bg_surface, Vector3f(x - offset.x, y - 
offset.y, pos.z));
                 }
             }
         }





reply via email to

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