pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src action_button.cxx,1.18,1.19 display_g


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src action_button.cxx,1.18,1.19 display_graphic_context.cxx,1.7,1.8 pingus_counter.cxx,1.10,1.11 smallmap.cxx,1.25,1.26 spot_map.cxx,1.20,1.21
Date: 17 Oct 2002 00:10:49 -0000

Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv10954

Modified Files:
        action_button.cxx display_graphic_context.cxx 
        pingus_counter.cxx smallmap.cxx spot_map.cxx 
Log Message:
- fixed fast mode a bit
- added GraphicContext::get_clip_rect()

Index: action_button.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/action_button.cxx,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- action_button.cxx   14 Oct 2002 11:15:15 -0000      1.18
+++ action_button.cxx   17 Oct 2002 00:10:46 -0000      1.19
@@ -198,7 +198,8 @@
     } 
   else 
     {
-      background.put_screen (x_pos, y_pos);
+      if (!fast_mode)
+        background.put_screen (x_pos, y_pos);
       surface.put_screen(x_pos, y_pos, 7);
     }
     
@@ -271,7 +272,8 @@
     }
   else
     {
-      background.put_screen (x_pos, y_pos);
+      if (!fast_mode)
+        background.put_screen (x_pos, y_pos);
     }
 
   surface.put_screen(x_pos, y_pos);
@@ -315,7 +317,10 @@
   if (server->get_pause()) 
     backgroundhl.put_screen (x_pos, y_pos);
   else
-    background.put_screen (x_pos, y_pos);
+    {
+    if (!fast_mode)
+      background.put_screen (x_pos, y_pos);
+    }
   
   surface.put_screen(x_pos, y_pos);
   UNUSED_ARG(gc);

Index: display_graphic_context.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/display_graphic_context.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- display_graphic_context.cxx 12 Oct 2002 00:49:09 -0000      1.7
+++ display_graphic_context.cxx 17 Oct 2002 00:10:46 -0000      1.8
@@ -49,8 +49,11 @@
 CL_Rect
 DisplayGraphicContext::get_clip_rect()
 {
-  assert (!"DisplayGraphicContext::get_clip_rect(): unimplemented");
-  return CL_Rect ();
+  // FIXME: Zooming isn't handled
+  // FIXME: This might be of-by-one
+  Vector pos = -offset - center;
+  return CL_Rect (int(pos.x), int(pos.y),
+                  int(pos.x + get_width () + 1), int(pos.y + get_height () + 
1));
 }
 
 Vector

Index: pingus_counter.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingus_counter.cxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- pingus_counter.cxx  4 Oct 2002 16:54:04 -0000       1.10
+++ pingus_counter.cxx  17 Oct 2002 00:10:46 -0000      1.11
@@ -27,6 +27,7 @@
 #include "pingu_holder.hxx"
 #include "server.hxx"
 #include "plf.hxx"
+#include "globals.hxx"
 
 PingusCounter::PingusCounter(Server* s)
   : server(s),
@@ -40,7 +41,8 @@
 {
   char str[128];
 
-  background.put_screen (CL_Display::get_width ()/2 - 
background.get_width()/2, 0);
+  if (!fast_mode)
+    background.put_screen (CL_Display::get_width ()/2 - 
background.get_width()/2, 0);
   
   World* world = server->get_world();
   

Index: smallmap.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/smallmap.cxx,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- smallmap.cxx        16 Oct 2002 09:14:45 -0000      1.25
+++ smallmap.cxx        17 Oct 2002 00:10:46 -0000      1.26
@@ -30,6 +30,7 @@
 #include "pingu.hxx"
 #include "timer.hxx"
 #include "math.hxx"
+#include "globals.hxx"
 
 using namespace std;
 
@@ -96,6 +97,12 @@
   
   cbuffer = static_cast<unsigned char*>(canvas->get_data());
 
+  int alpha;
+  if (fast_mode)
+    alpha = 255;
+  else
+    alpha = 150;
+
   int cmap_width  = colmap->get_width();
   int cmap_height = colmap->get_height();
 
@@ -114,7 +121,7 @@
          switch (current_pixel)
             {
             case Groundtype::GP_NOTHING:
-             cbuffer[i + 0] = 150;
+             cbuffer[i + 0] = alpha;
               cbuffer[i + 1] = 0;
              cbuffer[i + 2] = 0;
              cbuffer[i + 3] = 0;

Index: spot_map.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/spot_map.cxx,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- spot_map.cxx        7 Oct 2002 23:53:41 -0000       1.20
+++ spot_map.cxx        17 Oct 2002 00:10:46 -0000      1.21
@@ -148,9 +148,6 @@
 void
 PingusSpotMap::draw(GraphicContext& gc)
 {
-  //std::cout << "Draw: " << " x_pos: " << x_pos << " y_pos: " 
-  //<< " w: " << w << " h: " << h << " s: " << s << std::endl;
-  
 #if 0
   { // calculate number of used/empty tiles
     int tiles_total = 0;
@@ -171,13 +168,9 @@
     std::cout << "   " << float(tiles_used)/float(tiles_total) * 100.0f << "% 
of the map are used" << std::endl;
   }
 #endif
+  const CL_Rect& display = gc.get_clip_rect();
 
   // FIXME: delete the next four lines and replace them with gc.get_clip_rect()
-  int w = CL_Display::get_width ();
-  int h = CL_Display::get_height ();
-  int of_x = static_cast<int>(gc.get_x_offset () + (gc.get_width  ()/2));
-  int of_y = static_cast<int>(gc.get_y_offset () + (gc.get_height ()/2));
-
   if (draw_collision_map)
     {
       draw_colmap(gc);
@@ -185,19 +178,11 @@
   else
     {
       // Trying to calc which parts of the tilemap needs to be drawn
-      int start_x = -of_x/tile_size;
-      int start_y = -of_y/tile_size;
-      unsigned int tilemap_width = w / tile_size;
-      unsigned int tilemap_height = h / tile_size + 1;
-
-      //         std::cout  << " th: " << tilemap_height << " tw: " << 
tilemap_width << std::endl;
-
-      if (start_x < 0)
-       start_x = 0;
-      if (start_y < 0)
-       start_y = 0;
+      int start_x = Math::max(0, display.x1/tile_size);
+      int start_y = Math::max(0, display.y1/tile_size);
+      unsigned int tilemap_width  = display.get_width()  / tile_size + 1;
+      unsigned int tilemap_height = display.get_height() / tile_size + 1;
 
-      //unsigned int time = CL_System::get_time (); 
       // drawing the stuff
       for (TileIter x = start_x; 
           x <= (start_x + tilemap_width) && x < tile.size();
@@ -210,8 +195,13 @@
              if (!tile[x][y].is_empty()) 
                {
                  gc.draw(tile[x][y].surface,
-                         x * tile_size, 
+                         x * tile_size,
                          y * tile_size);
+#ifdef PINGUS_EARTHQUAKE
+                 gc.draw(tile[x][y].surface,
+                         x * tile_size + rand ()%20-10, 
+                         y * tile_size + rand ()%20-10);
+#endif
                }
              else
                {
@@ -222,7 +212,6 @@
                }
            }
        }
-      //std::cout << "> time: " << CL_System::get_time() - time << std::endl;
     }
 }
 





reply via email to

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