Merge branch 'icyworld' new worldmap graphics for Icy Island
authorLMH <lmh.0013@gmail.com>
Wed, 20 Feb 2013 23:39:03 +0000 (13:39 -1000)
committerLMH <lmh.0013@gmail.com>
Wed, 20 Feb 2013 23:39:03 +0000 (13:39 -1000)
src/supertux/collision.cpp
src/supertux/levelintro.cpp
src/supertux/sector.cpp
src/supertux/tile.cpp
src/video/gl/gl_renderer.cpp
src/video/gl/gl_renderer.hpp

index 95fbbbb..4e1c601 100644 (file)
@@ -54,7 +54,7 @@ bool rectangle_aatriangle(Constraints* constraints, const Rectf& rect,
     return false;
 
   Vector normal;
-  float c;
+  float c = 0.0;
   Vector p1;
   Rectf area;
   switch(triangle.dir & AATriangle::DEFORM_MASK) {
index bbd3f21..98d8544 100644 (file)
@@ -116,6 +116,13 @@ LevelIntro::draw(DrawingContext& context)
     context.draw_center_text(Resources::normal_font, ss.str(), Vector(0, py), LAYER_FOREGROUND1, LevelIntro::stat_color);
     py += static_cast<int>(Resources::normal_font->get_height());
   }
+       
+  {
+    std::stringstream ss;
+    ss << _("Badguys killed") << ": " << Statistics::frags_to_string((best_level_statistics && (best_level_statistics->coins >= 0)) ? best_level_statistics->badguys : 0, stats.total_badguys);
+    context.draw_center_text(Resources::normal_font, ss.str(), Vector(0, py), LAYER_FOREGROUND1,LevelIntro::stat_color);
+    py += static_cast<int>(Resources::normal_font->get_height());
+  }
   
   {
     std::stringstream ss;
index c52a03c..91b469d 100644 (file)
@@ -594,7 +594,13 @@ Sector::activate(const Vector& player_pos)
     }
   }
 
+  //FIXME: This is a really dirty workaround for this strange camera jump
+  player->move(player->get_pos()+Vector(-32, 0));
   camera->reset(player->get_pos());
+  camera->update(1);
+  player->move(player->get_pos()+(Vector(32, 0)));
+  camera->update(1);
+  
   update_game_objects();
 
   //Run default.nut just before init script
index d29a6c5..b815953 100644 (file)
@@ -271,8 +271,8 @@ bool Tile::check_position_unisolid (const Rectf& obj_bbox,
   float gradient;
   float delta_x;
   float delta_y;
-  float obj_x;
-  float obj_y;
+  float obj_x = 0.0;
+  float obj_y = 0.0;
 
   /* If this is not a slope, this is - again - easy */
   if (!this->is_slope())
index 361f30a..2f1f505 100644 (file)
@@ -34,7 +34,8 @@
 GLRenderer::GLRenderer() :
   desktop_size(-1, -1),
   screen_size(-1, -1),
-  fullscreen_active(false)
+  fullscreen_active(false),
+  last_texture(static_cast<GLuint> (-1))
 {
   Renderer::instance_ = this;
 
@@ -116,7 +117,11 @@ GLRenderer::draw_surface(const DrawingRequest& request)
   GLTexture* gltexture = static_cast<GLTexture*>(surface->get_texture().get());
   GLSurfaceData *surface_data = static_cast<GLSurfaceData*>(surface->get_surface_data());
 
-  glBindTexture(GL_TEXTURE_2D, gltexture->get_handle());
+  GLuint th = gltexture->get_handle();
+  if (th != last_texture) {
+    last_texture = th;
+    glBindTexture(GL_TEXTURE_2D, th);
+  }
   intern_draw(request.pos.x, request.pos.y,
               request.pos.x + surface->get_width(),
               request.pos.y + surface->get_height(),
@@ -148,7 +153,11 @@ GLRenderer::draw_surface_part(const DrawingRequest& request)
   float uv_right = surface_data->get_uv_left() + (uv_width * (surfacepartrequest->source.x + surfacepartrequest->size.x)) / surface->get_width();
   float uv_bottom = surface_data->get_uv_top() + (uv_height * (surfacepartrequest->source.y + surfacepartrequest->size.y)) / surface->get_height();
 
-  glBindTexture(GL_TEXTURE_2D, gltexture->get_handle());
+  GLuint th = gltexture->get_handle();
+  if (th != last_texture) {
+    last_texture = th;
+    glBindTexture(GL_TEXTURE_2D, th);
+  }
   intern_draw(request.pos.x, request.pos.y,
               request.pos.x + surfacepartrequest->size.x,
               request.pos.y + surfacepartrequest->size.y,
index 9e20859..d5d9995 100644 (file)
@@ -109,6 +109,8 @@ private:
   Size desktop_size;
   Size screen_size;
   bool fullscreen_active;
+       
+  GLuint last_texture;
 
 public:
   GLRenderer();