From 3539ef5204ff530534c51a15df2a52df3dd2f1e6 Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Sun, 24 Oct 2010 22:48:26 +0000 Subject: [PATCH] Added rain to the old forest git-svn-id: http://svn.net-core.org/repos/t-engine4@1619 51575b47-30f0-44d4-a5cc-537603b46e54 --- game/modules/tome/class/Game.lua | 11 ++-- game/modules/tome/data/gfx/particle_drop.png | Bin 0 -> 324 bytes .../tome/data/gfx/particles/raindrops.lua | 50 ++++++++++++++++++ .../tome/data/zones/old-forest/zone.lua | 13 +++++ game/modules/tome/data/zones/test/zone.lua | 4 +- 5 files changed, 71 insertions(+), 7 deletions(-) create mode 100644 game/modules/tome/data/gfx/particle_drop.png create mode 100644 game/modules/tome/data/gfx/particles/raindrops.lua diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua index f3ca821080..c70882c682 100644 --- a/game/modules/tome/class/Game.lua +++ b/game/modules/tome/class/Game.lua @@ -490,16 +490,15 @@ function _M:display() self.player:playerFOV() end - -- Level background - if self.level.data.background then - self.level.data.background(self.level) - end - -- Display using Framebuffer, sotaht we can use shaders and all if self.fbo then self.fbo:use(true) + + if self.level.data.background then self.level.data.background(self.level, 0, 0) end self.level.map:display(0, 0) self.target:display(0, 0) + if self.level.data.foreground then self.level.data.foreground(self.level, 0, 0) end + self.fbo:use(false) _2DNoise:bind(1, false) self.fbo:toScreen( @@ -510,8 +509,10 @@ function _M:display() -- Basic display else + if self.level.data.background then self.level.data.background(self.level, self.level.map.display_x, self.level.map.display_y) end self.level.map:display() self.target:display() + if self.level.data.foreground then self.level.data.foreground(self.level, self.level.map.display_x, self.level.map.display_y) end end if not self.zone_name_s then diff --git a/game/modules/tome/data/gfx/particle_drop.png b/game/modules/tome/data/gfx/particle_drop.png new file mode 100644 index 0000000000000000000000000000000000000000..3ce09d09d8deeb86c3409b19e4cf8f8d9652be3a GIT binary patch literal 324 zcmeAS@N?(olHy`uVBq!ia0vp^93afW1|*O0@9PFqjKx9jP7LeL$-D$|*pj^6U4S$Y z{B+)352QE?JR*x37`TN&n2}-D90{Nxdx@v7EBh@j2{B0tgVi!yfI_mFArU3c`MJ5N zc_lzD1A}u>YGO%hib8p2Nrr;Er*A-tUMf3Ke72{HV~E6M-?N5Z&VdXr7eB}C<7{#i z3|``)x+qmE+wo3gb%A(h?weTmO`Hc)T`op-MAX<%ekQu}tjP3-V(coGN163D9LdjJ zq&D-hjB(6Esmbf+>VItVzmw3IyvNJP>(iVk_9y)(#ZFqUvRdVGSM(i4iH97b`8Pss zwz~AMd)u&Y$|OGNJCFH=*BBlX^O|IA^JsDEy~3vVL8msb-*vHDH96&i1IYcJu6{1- HoD!M<jumZq literal 0 HcmV?d00001 diff --git a/game/modules/tome/data/gfx/particles/raindrops.lua b/game/modules/tome/data/gfx/particles/raindrops.lua new file mode 100644 index 0000000000..8c148d3022 --- /dev/null +++ b/game/modules/tome/data/gfx/particles/raindrops.lua @@ -0,0 +1,50 @@ +-- ToME - Tales of Middle-Earth +-- Copyright (C) 2009, 2010 Nicolas Casalini +-- +-- 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 3 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, see <http://www.gnu.org/licenses/>. +-- +-- Nicolas Casalini "DarkGod" +-- darkgod@te4.org + +dir = math.rad(110) + +return { generator = function() + local x, y = rng.range(-width/2, width), rng.range(-height/2, height) + local vel = rng.float(32, 48) + + return { + life = 30, + size = rng.float(3, 6), sizev = 0, sizea = 0, + + x = x, xv = 0, xa = 0, + y = y, yv = 0, ya = 0, + dir = dir, dirv = blur, dira = 0, + vel = vel, velv = 0, vela = 0, + + r = 0.6, rv = 0, ra = 0, + g = 0.7, gv = 0, ga = 0, + b = 0.7, bv = 0, ba = 0, + a = rng.float(0.6, 0.9), av = 0, aa = 0, + } +end, }, +function(self) + if first then + self.ps:emit(700) + else + self.ps:emit(1) + end + first = false +end, +1000, +"particle_drop" diff --git a/game/modules/tome/data/zones/old-forest/zone.lua b/game/modules/tome/data/zones/old-forest/zone.lua index 2140dff1b3..51eb05e570 100644 --- a/game/modules/tome/data/zones/old-forest/zone.lua +++ b/game/modules/tome/data/zones/old-forest/zone.lua @@ -28,6 +28,8 @@ return { -- all_remembered = true, all_lited = true, persistant = "zone", + color_shown = {0.6, 0.6, 0.6, 1}, + color_obscure = {0.6*0.6, 0.6*0.6, 0.6*0.6, 1}, ambiant_music = "Woods of Eremae.ogg", generator = { map = { @@ -67,4 +69,15 @@ return { }, }, }, }, + + post_process = function(level) + local Map = require "engine.Map" + level.foreground_particle = require("engine.Particles").new("raindrops", 1, {width=Map.viewport.width, height=Map.viewport.height}) + end, + + foreground = function(level, x, y) + local Map = require "engine.Map" + level.foreground_particle:update() + level.foreground_particle.ps:toScreen(x, y, true, 1) + end, } diff --git a/game/modules/tome/data/zones/test/zone.lua b/game/modules/tome/data/zones/test/zone.lua index 610a87c2ad..acd7000b92 100644 --- a/game/modules/tome/data/zones/test/zone.lua +++ b/game/modules/tome/data/zones/test/zone.lua @@ -65,9 +65,9 @@ return { level.background_particle = require("engine.Particles").new("starfield", 1, {width=Map.viewport.width, height=Map.viewport.height}) end, - background = function(level) + background = function(level, x, y) local Map = require "engine.Map" level.background_particle:update() - level.background_particle.ps:toScreen(Map.display_x, Map.display_y, true, 1) + level.background_particle.ps:toScreen(x, y, true, 1) end, } -- GitLab