fix growup, lightmap experiments with willowisp
authorMatthias Braun <matze@braunis.de>
Fri, 31 Mar 2006 11:42:28 +0000 (11:42 +0000)
committerMatthias Braun <matze@braunis.de>
Fri, 31 Mar 2006 11:42:28 +0000 (11:42 +0000)
SVN-Revision: 3145

src/badguy/badguy.cpp
src/badguy/willowisp.cpp
src/badguy/willowisp.hpp
src/object/player.cpp
src/video/drawing_context.cpp

index 6ffe20c..9be4b01 100644 (file)
@@ -172,7 +172,8 @@ BadGuy::collision_player(Player& player, const CollisionHit& hit)
     return ABORT_MOVE;
   }
 
-  printf("PlayerHit: PM: %3.1f %3.1f BM: %3.1f %3.1f Hit: %3.1f %3.1f\n",
+  printf("PlayerHit: GT %3.1f PM: %3.1f %3.1f BM: %3.1f %3.1f Hit: %3.1f %3.1f\n",
+          game_time,
           player.get_movement().x, player.get_movement().y,
           get_movement().x, get_movement().y,
           hit.normal.x, hit.normal.y);
index 00f0c74..412ea74 100644 (file)
@@ -59,6 +59,19 @@ WillOWisp::write(lisp::Writer& writer)
 }
 
 void
+WillOWisp::draw(DrawingContext& context)
+{
+  sprite->draw(context, get_pos(), LAYER_OBJECTS);
+  
+  context.push_target();
+  context.set_target(DrawingContext::LIGHTMAP);
+
+  sprite->draw(context, get_pos(), LAYER_OBJECTS);
+  
+  context.pop_target();
+}
+
+void
 WillOWisp::active_update(float elapsed_time)
 {
   Player* player = get_nearest_player();
index fe15b32..e634528 100644 (file)
@@ -36,6 +36,8 @@ public:
   void active_update(float elapsed_time);
   void kill_fall();
 
+  virtual void draw(DrawingContext& context);
+
 protected:
   HitResponse collision_player(Player& player, const CollisionHit& hit);
 
index a279739..b462a64 100644 (file)
@@ -660,28 +660,12 @@ Player::draw(DrawingContext& context)
   if(dying) {
     smalltux_gameover->draw(context, get_pos(), layer);
   } else if(growing_timer.get_timeleft() > 0) {
-    if(!is_big())
-      {
-      if (dir == RIGHT)
-        context.draw_surface(growingtux_right[GROWING_FRAMES-1 - 
-                 int((growing_timer.get_timegone() *
-                 GROWING_FRAMES) / GROWING_TIME)], get_pos(), layer);
-      else
-        context.draw_surface(growingtux_left[GROWING_FRAMES-1 - 
-                int((growing_timer.get_timegone() *
-                GROWING_FRAMES) / GROWING_TIME)], get_pos(), layer);
-      }
-    else
-      {
-      if (dir == RIGHT)
-        context.draw_surface(growingtux_right[
-            int((growing_timer.get_timegone() *
-                GROWING_FRAMES) / GROWING_TIME)], get_pos(), layer);
-      else
-        context.draw_surface(growingtux_left[
-            int((growing_timer.get_timegone() *
-                             GROWING_FRAMES) / GROWING_TIME)],
-            get_pos(), layer);
+      if (dir == RIGHT) {
+        context.draw_surface(growingtux_right[int((growing_timer.get_timegone() *
+                 GROWING_FRAMES) / GROWING_TIME)], get_pos() - Vector(0, 32), layer);
+      } else {
+        context.draw_surface(growingtux_left[int((growing_timer.get_timegone() *
+                GROWING_FRAMES) / GROWING_TIME)], get_pos() - Vector(0, 32), layer);
       }
     }
   else if (safe_timer.started() && size_t(game_time*40)%2)
index c231e4b..807c92a 100644 (file)
@@ -296,7 +296,8 @@ DrawingContext::do_drawing()
     glMatrixMode(GL_MODELVIEW);
     glLoadIdentity();
 
-    glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
+    //glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
+    glClearColor(0, 0, 0, 1);
     glClear(GL_COLOR_BUFFER_BIT);
     handle_drawing_requests(lightmap_requests);
     lightmap_requests.clear();
@@ -319,7 +320,7 @@ DrawingContext::do_drawing()
   drawing_requests.clear();
 
   if(use_lightmap) {
-    glBlendFunc(GL_DST_COLOR, GL_ZERO);
+    glBlendFunc(GL_SRC_ALPHA, GL_ONE);
 
     glBindTexture(GL_TEXTURE_2D, lightmap->get_handle());
     glBegin(GL_QUADS);