--- /dev/null
+(supertux-sprite
+ (action
+ (name "normal")
+ (images "magicblock.png"))
+ (action
+ (name "solid")
+ (images "magicblock-solid.png"))
+)
--- /dev/null
+(supertux-level
+ (version 2)
+ (name (_ "Unnamed"))
+ (author "wolfgang")
+ (sector
+ (name "main")
+ (ambient-light 0.1451591 0.1451591 0.1451591)
+ (camera
+ (mode "normal")
+ )
+ (spawnpoint
+ (name "main")
+ (x 96)
+ (y 96)
+ )
+ (spotlight
+ (angle 90)
+ (color 1 0 1)
+ (x 256)
+ (y 160)
+ )
+ (spotlight
+ (angle 0)
+ (color 1 1 1)
+ (x 608)
+ (y 192)
+ )
+ (magicblock
+ (x 192)
+ (y 288)
+ (color 1 1 1)
+ )
+ (magicblock
+ (x 288)
+ (y 288)
+ (color 1 0 0)
+ )
+ (magicblock
+ (x 384)
+ (y 288)
+ (color 0 1 0)
+ )
+ (magicblock
+ (x 480)
+ (y 288)
+ (color 0 0 1)
+ )
+ (magicblock
+ (x 576)
+ (y 288)
+ (color 1 1 0)
+ )
+ (magicblock
+ (x 640)
+ (y 288)
+ (color 1 0 1)
+ )
+ (magicblock
+ (x 736)
+ (y 288)
+ (color 0 1 1)
+ )
+ (magicblock
+ (x 832)
+ (y 288)
+ (color 0 0 0)
+ )
+ (magicblock
+ (x 288)
+ (y 288)
+ (color 1 0 0)
+ )
+ (tilemap
+ (z-pos -100)
+ (solid #f)
+ (speed 1)
+ (width 50)
+ (height 20)
+ (tiles 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
+ )
+ (background
+ (speed 0.5)
+ (image-top "images/background/arctis_top.jpg")
+ (image "images/background/arctis.jpg")
+ (image-bottom "images/background/arctis_bottom.jpg")
+ )
+ )
+)
--- /dev/null
+// $Id:$
+//
+// SuperTux - MagicBlock
+//
+// Magic Blocks are tile-like game objects that are sensitive to
+// lighting conditions. They are rendered in a color and
+// will only be solid as long as light of the same color shines
+// on the block.
+//
+// Copyright (C) 2006 Wolfgang Becker <uafr@gmx.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#include <config.h>
+#include <vector>
+
+#include "magicblock.hpp"
+#include "object_factory.hpp"
+#include "sprite/sprite_manager.hpp"
+
+namespace {
+ const float MIN_INTENSITY = 0.8;
+ const float ALPHA_SOLID = 0.7;
+ const float ALPHA_NONSOLID = 0.3;
+}
+
+MagicBlock::MagicBlock(const lisp::Lisp& lisp)
+ : MovingSprite(lisp, "images/objects/magicblock/magicblock.sprite"),
+ is_solid(false), light(1.0f,1.0f,1.0f)
+{
+ set_group(COLGROUP_STATIC);
+ //get color from lisp
+ std::vector<float> vColor;
+ lisp.get_vector("color", vColor );
+ color = Color( vColor );
+
+ //all alpha to make the sprite still visible
+ color.alpha = ALPHA_SOLID;
+
+ //set trigger
+ trigger_red = (color.red == 1.0f ? MIN_INTENSITY : 0);
+ trigger_green = (color.green == 1.0f ? MIN_INTENSITY : 0);
+ trigger_blue = (color.blue == 1.0f ? MIN_INTENSITY : 0);
+
+ center = Vector((get_bbox().p1.x+get_bbox().p2.x)/2,
+ (get_bbox().p1.y+get_bbox().p2.y)/2);
+}
+
+void
+MagicBlock::update(float /*elapsed_time*/)
+{
+ if(light.red >= trigger_red && light.green >= trigger_green
+ && light.blue >= trigger_blue) {
+ is_solid = true;
+ } else {
+ is_solid = false;
+ }
+
+ //Update Sprite.
+ if(is_solid) {
+ color.alpha = ALPHA_SOLID;
+ sprite->set_action("solid");
+ } else {
+ color.alpha = ALPHA_NONSOLID;
+ sprite->set_action("normal");
+ }
+}
+
+void
+MagicBlock::draw(DrawingContext& context){
+ //Ask for update about lightmap at center of this block
+ context.get_light( center, &light );
+
+ //Draw the Sprite.
+ MovingSprite::draw(context);
+ //Add the color.
+ context.draw_filled_rect( get_bbox(), color, layer);
+}
+
+HitResponse
+MagicBlock::collision(GameObject& /*other*/, const CollisionHit& /*hit*/)
+{
+ if(is_solid) {
+ return SOLID;
+ } else {
+ return PASSTHROUGH;
+ }
+}
+
+IMPLEMENT_FACTORY(MagicBlock, "magicblock");
--- /dev/null
+// $Id$
+//
+// SuperTux - MagicBlock
+//
+// Magic Blocks are tile-like game objects that are sensitive to
+// lighting conditions. They are rendered in a color and
+// will only be solid as long as light of the same color shines
+// on the block.
+//
+// Copyright (C) 2006 Wolfgang Becker <uafr@gmx.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#ifndef SUPERTUX_TRAMPOLINE_H
+#define SUPERTUX_TRAMPOLINE_H
+
+#include "moving_sprite.hpp"
+#include "lisp/lisp.hpp"
+
+class MagicBlock: public MovingSprite
+{
+public:
+ MagicBlock(const lisp::Lisp& reader);
+
+ HitResponse collision(GameObject& other, const CollisionHit& hit);
+ void update(float elapsed_time);
+ void draw(DrawingContext& context);
+
+private:
+ bool is_solid;
+ float trigger_red;
+ float trigger_green;
+ float trigger_blue;
+ Color color;
+ Color light;
+ Vector center;
+};
+
+#endif
-// $Id$
+// $Id:$
//
// SuperTux - Trampoline
// Copyright (C) 2006 Wolfgang Becker <uafr@gmx.de>
}
Trampoline::Trampoline(const lisp::Lisp& lisp)
- : MovingSprite(lisp, "images/objects/trampoline/trampoline.sprite" )
+ : MovingSprite(lisp, "images/objects/trampoline/trampoline.sprite")
{
set_group(COLGROUP_MOVING_STATIC);
sound_manager->preload(TRAMPOLINE_SOUND);
}
HitResponse
-Trampoline::collision(GameObject& other, const CollisionHit& hit )
+Trampoline::collision(GameObject& other, const CollisionHit& hit)
{
//Tramponine has to be on ground to work.
if(!on_ground) {
}
void
-Trampoline::ungrab(MovingObject& , Direction ) {
+Trampoline::ungrab(MovingObject& , Direction) {
set_group(COLGROUP_MOVING_STATIC);
on_ground = false;
physic.set_velocity(0, 0);
void collision_solid(const CollisionHit& hit);
void update(float elapsed_time);
- void grab( MovingObject&, const Vector& pos, Direction );
- void ungrab(MovingObject& , Direction );
+ void grab(MovingObject&, const Vector& pos, Direction);
+ void ungrab(MovingObject&, Direction);
bool is_portable() const;
private:
#include "glutil.hpp"
#include "texture.hpp"
#include "texture_manager.hpp"
-
#define LIGHTMAP_DIV 4
static inline int next_po2(int val)
}
void
+DrawingContext::get_light(const Vector& position, Color* color)
+{
+ if( ambient_color.red == 1.0f && ambient_color.green == 1.0f
+ && ambient_color.blue == 1.0f ) {
+ *color = Color( 1.0f, 1.0f, 1.0f);
+ return;
+ }
+ DrawingRequest request;
+ request.type = GETLIGHT;
+ request.pos = transform.apply(position);
+ request.layer = LAYER_GUI; //make sure all get_light requests are handled last.
+
+ GetLightRequest* getlightrequest = new GetLightRequest;
+ getlightrequest->color_ptr = color;
+ request.request_data = getlightrequest;
+ lightmap_requests.push_back(request);
+}
+
+void
+DrawingContext::get_light(DrawingRequest& request)
+{
+ GetLightRequest* getlightrequest = (GetLightRequest*) request.request_data;
+
+ float pixels[3];
+ for( int i = 0; i<3; i++)
+ pixels[i] = 0.0f; //set to black
+
+ //TODO: not working as i thought. this only returns ambient_color. Why?
+ glReadPixels((GLint) request.pos.x, (GLint)request.pos.y, 1, 1, GL_RGB, GL_FLOAT, pixels);
+ *(getlightrequest->color_ptr) = Color( pixels[0], pixels[1], pixels[2]);
+ //printf("get_light %f/%f r%f g%f b%f\n", request.pos.x, request.pos.y, pixels[0], pixels[1], pixels[2]);
+
+ delete getlightrequest;
+}
+
+void
DrawingContext::draw_surface_part(DrawingRequest& request)
{
SurfacePartRequest* surfacepartrequest
case LIGHTMAPREQUEST:
draw_lightmap(*i);
break;
+ case GETLIGHT:
+ get_light(*i);
+ break;
}
}
}
/// return currently set alpha
float get_alpha() const;
+ /// on next update, set color to lightmap's color at position
+ void get_light(const Vector& position, Color* color );
+
enum Target {
NORMAL, LIGHTMAP
};
enum RequestType
{
- SURFACE, SURFACE_PART, TEXT, GRADIENT, FILLRECT, LIGHTMAPREQUEST
+ SURFACE, SURFACE_PART, TEXT, GRADIENT, FILLRECT, LIGHTMAPREQUEST, GETLIGHT
};
struct SurfacePartRequest
}
};
+ struct GetLightRequest
+ {
+ Color* color_ptr;
+ };
+
typedef std::vector<DrawingRequest> DrawingRequests;
void handle_drawing_requests(DrawingRequests& requests);
void draw_gradient(DrawingRequest& request);
void draw_filled_rect(DrawingRequest& request);
void draw_lightmap(DrawingRequest& request);
+ void get_light(DrawingRequest& request);
DrawingRequests drawing_requests;
DrawingRequests lightmap_requests;