From 1a2ff6339085ca0a75c3477c81dc1076f58191ce Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Fri, 31 Mar 2006 11:42:28 +0000 Subject: [PATCH] fix growup, lightmap experiments with willowisp SVN-Revision: 3145 --- src/badguy/badguy.cpp | 3 ++- src/badguy/willowisp.cpp | 13 +++++++++++++ src/badguy/willowisp.hpp | 2 ++ src/object/player.cpp | 28 ++++++---------------------- src/video/drawing_context.cpp | 5 +++-- 5 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/badguy/badguy.cpp b/src/badguy/badguy.cpp index 6ffe20cbe..9be4b0199 100644 --- a/src/badguy/badguy.cpp +++ b/src/badguy/badguy.cpp @@ -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); diff --git a/src/badguy/willowisp.cpp b/src/badguy/willowisp.cpp index 00f0c748c..412ea7442 100644 --- a/src/badguy/willowisp.cpp +++ b/src/badguy/willowisp.cpp @@ -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(); diff --git a/src/badguy/willowisp.hpp b/src/badguy/willowisp.hpp index fe15b32ed..e6345281e 100644 --- a/src/badguy/willowisp.hpp +++ b/src/badguy/willowisp.hpp @@ -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); diff --git a/src/object/player.cpp b/src/object/player.cpp index a27973992..b462a64a9 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -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) diff --git a/src/video/drawing_context.cpp b/src/video/drawing_context.cpp index c231e4bb8..807c92aa3 100644 --- a/src/video/drawing_context.cpp +++ b/src/video/drawing_context.cpp @@ -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); -- 2.11.0