(author "Marek")
(sector
(name "main")
+ (ambient-light 0.450721 0.3396048 0.3396048)
(background
- (x 0)
- (y 0)
- (image "images/background/arctis.jpg")
(speed 0.5)
+ (image "images/background/BlueRock_Forest/blue-top.jpg")
)
(tilemap
(z-pos -100)
(height 30)
(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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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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 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1910 1911 1908 1909 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1914 1915 1912 1913 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1902 1903 1900 1901 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905 1906 1907 1904 1905)
+ )
(camera
(mode "normal")
)
#include "sector.hpp"
#include "object/sprite_particle.hpp"
#include "object_factory.hpp"
+#include "random_generator.hpp"
Candle::Candle(const lisp::Lisp& lisp)
- : MovingSprite(lisp, "images/objects/candle/candle.sprite", LAYER_BACKGROUNDTILES+1, COLGROUP_DISABLED), burning(true)
+ : MovingSprite(lisp, "images/objects/candle/candle.sprite", LAYER_BACKGROUNDTILES+1, COLGROUP_DISABLED), burning(true),
+ candle_light_1("images/objects/candle/candle-light-1.png"),
+ candle_light_2("images/objects/candle/candle-light-2.png")
{
+ lisp.get("name", name);
lisp.get("burning", burning);
if (burning) {
} else {
sprite->set_action("off");
}
+
+}
+
+void
+Candle::draw(DrawingContext& context)
+{
+ // draw regular sprite
+ sprite->draw(context, get_pos(), layer);
+
+ // draw on lightmap
+ if (burning) {
+ Vector pos = get_pos() + (bbox.get_size() - candle_light_1.get_size()) / 2;
+ context.push_target();
+ context.set_target(DrawingContext::LIGHTMAP);
+ // draw approx. 1 in 10 frames darker. Makes the candle flicker
+ if (systemRandom.rand(10) != 0) {
+ context.draw_surface(&candle_light_1, pos, layer);
+ } else {
+ context.draw_surface(&candle_light_2, pos, layer);
+ }
+ context.pop_target();
+ }
}
HitResponse
#include "lisp/lisp.hpp"
#include "object/moving_sprite.hpp"
#include "script_interface.hpp"
+#include "video/surface.hpp"
/**
* A burning candle: Simple, scriptable level decoration.
public:
Candle(const lisp::Lisp& lisp);
virtual Candle* clone() const { return new Candle(*this); }
+ virtual void draw(DrawingContext& context);
HitResponse collision(GameObject& other, const CollisionHit& hit);
private:
bool burning; /**< true if candle is currently lighted */
+ Surface candle_light_1; /**< drawn to lightmap */
+ Surface candle_light_2; /**< drawn to lightmap (alternative image) */
};