diff --git a/game/modules/tome/data/gfx/particles/weather_storm.lua b/game/modules/tome/data/gfx/particles/weather_storm.lua new file mode 100644 index 0000000000000000000000000000000000000000..9473c71765f0ae35be982172f2ce1a9317f766db --- /dev/null +++ b/game/modules/tome/data/gfx/particles/weather_storm.lua @@ -0,0 +1,59 @@ +-- ToME - Tales of Maj'Eyal +-- 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) +h_per_tick = math.sin(dir) + +local first = true + +return { generator = function() + local size = rng.float(300, 800) + local x = rng.range(size, width + size) + local y = -size + if first then y = rng.range(size, height - size) end + local vel = rng.float(speed[1], speed[2]) + + return { + life = (height + size*2) / h_per_tick, + size = rng.float(300, 800), 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 = 1, rv = 0, ra = 0, + g = 1, gv = 0, ga = 0, + b = 1, bv = 0, ba = 0, + a = rng.float(alpha[1], alpha[2]), av = 0, aa = 0, + } +end, }, +function(self) + if first then + self.ps:emit(rng.range(0, max_nb or 1)) + first = false + return + end + + if rng.chance(chance or 100) then + self.ps:emit(1) + end +end, +max_nb or 1, +particle_name, true diff --git a/game/modules/tome/data/gfx/weather/grey_cloud_01.png b/game/modules/tome/data/gfx/weather/grey_cloud_01.png new file mode 100644 index 0000000000000000000000000000000000000000..c70c14a2c07ccdd8894fe0cc146246334fd13a2e Binary files /dev/null and b/game/modules/tome/data/gfx/weather/grey_cloud_01.png differ diff --git a/game/modules/tome/data/gfx/weather/grey_cloud_02.png b/game/modules/tome/data/gfx/weather/grey_cloud_02.png new file mode 100644 index 0000000000000000000000000000000000000000..84e0758d2ba1ed00d7a01c520c9cd96d59b0401f Binary files /dev/null and b/game/modules/tome/data/gfx/weather/grey_cloud_02.png differ diff --git a/game/modules/tome/data/gfx/weather/grey_cloud_03.png b/game/modules/tome/data/gfx/weather/grey_cloud_03.png new file mode 100644 index 0000000000000000000000000000000000000000..0d27e018bd4a3e61a5a51a5388009833acd66dbd Binary files /dev/null and b/game/modules/tome/data/gfx/weather/grey_cloud_03.png differ diff --git a/game/modules/tome/data/gfx/weather/grey_cloud_04.png b/game/modules/tome/data/gfx/weather/grey_cloud_04.png new file mode 100644 index 0000000000000000000000000000000000000000..375f14b7ed1de305daa3b621c052ea7bf8054df6 Binary files /dev/null and b/game/modules/tome/data/gfx/weather/grey_cloud_04.png differ diff --git a/game/modules/tome/data/gfx/weather/grey_cloud_05.png b/game/modules/tome/data/gfx/weather/grey_cloud_05.png new file mode 100644 index 0000000000000000000000000000000000000000..df0a50dfd6026aa6799ec066db6af11ddecb9d97 Binary files /dev/null and b/game/modules/tome/data/gfx/weather/grey_cloud_05.png differ diff --git a/game/modules/tome/data/gfx/weather/grey_cloud_06.png b/game/modules/tome/data/gfx/weather/grey_cloud_06.png new file mode 100644 index 0000000000000000000000000000000000000000..ac6e850639d83ca7d16928a3ca5e08431ebc90d8 Binary files /dev/null and b/game/modules/tome/data/gfx/weather/grey_cloud_06.png differ diff --git a/game/modules/tome/data/gfx/weather/grey_cloud_07.png b/game/modules/tome/data/gfx/weather/grey_cloud_07.png new file mode 100644 index 0000000000000000000000000000000000000000..763ae6a81e171e4f8dfb89e4953a963c0bb19157 Binary files /dev/null and b/game/modules/tome/data/gfx/weather/grey_cloud_07.png differ diff --git a/game/modules/tome/data/gfx/weather/sand_light_01.png b/game/modules/tome/data/gfx/weather/sand_light_01.png new file mode 100644 index 0000000000000000000000000000000000000000..b01ce94cbdadfe973a374dbe8f561951bd6595ed Binary files /dev/null and b/game/modules/tome/data/gfx/weather/sand_light_01.png differ diff --git a/game/modules/tome/data/gfx/weather/sand_light_02.png b/game/modules/tome/data/gfx/weather/sand_light_02.png new file mode 100644 index 0000000000000000000000000000000000000000..d4a4538440f028abe197337a4aebc7e8586c739d Binary files /dev/null and b/game/modules/tome/data/gfx/weather/sand_light_02.png differ diff --git a/game/modules/tome/data/gfx/weather/sand_light_03.png b/game/modules/tome/data/gfx/weather/sand_light_03.png new file mode 100644 index 0000000000000000000000000000000000000000..310e37ce215231e66d9ad52978405f78ddaecafa Binary files /dev/null and b/game/modules/tome/data/gfx/weather/sand_light_03.png differ diff --git a/game/modules/tome/data/gfx/weather/sand_light_04.png b/game/modules/tome/data/gfx/weather/sand_light_04.png new file mode 100644 index 0000000000000000000000000000000000000000..35c9cc48ff537aa90c601c2feec543ac23d5a6ac Binary files /dev/null and b/game/modules/tome/data/gfx/weather/sand_light_04.png differ diff --git a/game/modules/tome/data/gfx/weather/sand_light_05.png b/game/modules/tome/data/gfx/weather/sand_light_05.png new file mode 100644 index 0000000000000000000000000000000000000000..5ebbecaafdef150820a829112934200cfeff609f Binary files /dev/null and b/game/modules/tome/data/gfx/weather/sand_light_05.png differ diff --git a/game/modules/tome/data/gfx/weather/sand_light_06.png b/game/modules/tome/data/gfx/weather/sand_light_06.png new file mode 100644 index 0000000000000000000000000000000000000000..902ff8ae4c7e3dd9931433f79ebfcee499273dba Binary files /dev/null and b/game/modules/tome/data/gfx/weather/sand_light_06.png differ diff --git a/game/modules/tome/data/gfx/weather/sand_light_07.png b/game/modules/tome/data/gfx/weather/sand_light_07.png new file mode 100644 index 0000000000000000000000000000000000000000..d7db66fc52317e49ace3da508a88790cbe5b63b7 Binary files /dev/null and b/game/modules/tome/data/gfx/weather/sand_light_07.png differ diff --git a/game/modules/tome/data/zones/arena/zone.lua b/game/modules/tome/data/zones/arena/zone.lua index 1c781e9e445c4e86b38ed046eeb101449e30c7ee..7b1a9b31e5fcaf3e1c15cb9872dbdafcaafee4db 100644 --- a/game/modules/tome/data/zones/arena/zone.lua +++ b/game/modules/tome/data/zones/arena/zone.lua @@ -297,7 +297,7 @@ return { local newRank = math.floor(game.level.arena.rank) if currentRank < newRank then --Player's rank increases! local x, y = game.level.map:getTileToScreen(game.player.x, game.player.y) - if newRank == 9 then world:gainAchievement("XXX_THE_DESTROYER", game.player) + if newRank == 10 then world:gainAchievement("XXX_THE_DESTROYER", game.player) elseif newRank == 21 then world:gainAchievement("GRAND_MASTER", game.player) end game.flyers:add(x, y, 90, 0, -0.5, "RANK UP!!", { 2, 57, 185 }, true) diff --git a/game/modules/tome/data/zones/eruan/zone.lua b/game/modules/tome/data/zones/eruan/zone.lua index 5958a55daac968a6119b1175007b61360f8805bd..0066eff6b2b345f07b61b0636a7f7d89f7b94cea 100644 --- a/game/modules/tome/data/zones/eruan/zone.lua +++ b/game/modules/tome/data/zones/eruan/zone.lua @@ -78,4 +78,31 @@ return { }, }, }, }, + + post_process = function(level) + local Map = require "engine.Map" + local Particles = require("engine.Particles") + local ps = {} + ps[#ps+1] = Particles.new("weather_storm", 1, {width=Map.viewport.width, height=Map.viewport.height, speed={10, 40}, alpha={0.3, 0.6}, particle_name="weather/sand_light_01"}) + ps[#ps+1] = Particles.new("weather_storm", 1, {width=Map.viewport.width, height=Map.viewport.height, speed={10, 40}, alpha={0.3, 0.6}, particle_name="weather/sand_light_02"}) + ps[#ps+1] = Particles.new("weather_storm", 1, {width=Map.viewport.width, height=Map.viewport.height, speed={10, 40}, alpha={0.3, 0.6}, particle_name="weather/sand_light_03"}) + ps[#ps+1] = Particles.new("weather_storm", 1, {width=Map.viewport.width, height=Map.viewport.height, speed={10, 40}, alpha={0.3, 0.6}, particle_name="weather/sand_light_04"}) + ps[#ps+1] = Particles.new("weather_storm", 1, {width=Map.viewport.width, height=Map.viewport.height, speed={10, 40}, alpha={0.3, 0.6}, particle_name="weather/sand_light_05"}) + ps[#ps+1] = Particles.new("weather_storm", 1, {width=Map.viewport.width, height=Map.viewport.height, speed={10, 40}, alpha={0.3, 0.6}, particle_name="weather/sand_light_06"}) + ps[#ps+1] = Particles.new("weather_storm", 1, {width=Map.viewport.width, height=Map.viewport.height, speed={10, 40}, alpha={0.3, 0.6}, particle_name="weather/sand_light_07"}) + level.foreground_particle = ps + end, + + foreground = function(level, x, y, nb_keyframes) + local Map = require "engine.Map" + + local ps = level.foreground_particle + for j = 1, #ps do + for i = 1, nb_keyframes do + ps[j]:update() + ps[j].ps:update() + end + ps[j].ps:toScreen(x, y, true, 1) + end + end, } diff --git a/game/modules/tome/data/zones/old-forest/zone.lua b/game/modules/tome/data/zones/old-forest/zone.lua index 632bed63b8677b069e102728763169e4c1474747..ed286bb551d17090ee7c3892002319140c0dc023 100644 --- a/game/modules/tome/data/zones/old-forest/zone.lua +++ b/game/modules/tome/data/zones/old-forest/zone.lua @@ -90,8 +90,8 @@ return { for i = 1, nb_keyframes do level.foreground_particle:update() - if i == 1 then level.foreground_particle.ps:toScreen(x, y, true, 1) end level.foreground_particle.ps:update() end + level.foreground_particle.ps:toScreen(x, y, true, 1) end, } diff --git a/game/modules/tome/data/zones/temporal-rift/zone.lua b/game/modules/tome/data/zones/temporal-rift/zone.lua index d18842d47c19a57d523a44057647f90d9a6b39e2..d61c4d0f5883715e36c9e3ec21fff3eef524401f 100644 --- a/game/modules/tome/data/zones/temporal-rift/zone.lua +++ b/game/modules/tome/data/zones/temporal-rift/zone.lua @@ -61,8 +61,8 @@ return { for i = 1, nb_keyframes do level.background_particle:update() - if i == 1 then level.background_particle.ps:toScreen(x, y, true, 1) end level.background_particle.ps:update() end + level.background_particle.ps:toScreen(x, y, true, 1) end, } diff --git a/game/modules/tome/data/zones/trollmire/zone.lua b/game/modules/tome/data/zones/trollmire/zone.lua index 4acd0e631acf638938f5025faa9456ba086264d4..8ee4a9c4da0658e155d6b863bf2663c6dda46de6 100644 --- a/game/modules/tome/data/zones/trollmire/zone.lua +++ b/game/modules/tome/data/zones/trollmire/zone.lua @@ -66,10 +66,6 @@ return { nb_trap = {6, 9}, }, }, - post_process = function(level) - -- Place a lore note on each level - game:placeRandomLoreObject("NOTE"..level.level) - end, levels = { [1] = { @@ -78,4 +74,35 @@ return { }, }, }, }, + + post_process = function(level) + -- Place a lore note on each level + game:placeRandomLoreObject("NOTE"..level.level) + + local Map = require "engine.Map" + local Particles = require("engine.Particles") + local ps = {} + ps[#ps+1] = Particles.new("weather_storm", 1, {max_nb=5, width=level.map.w*level.map.tile_w, height=level.map.h*level.map.tile_h, speed={0.5, 1.6}, alpha={0.23, 0.35}, particle_name="weather/grey_cloud_01"}) + ps[#ps+1] = Particles.new("weather_storm", 1, {max_nb=5, width=level.map.w*level.map.tile_w, height=level.map.h*level.map.tile_h, speed={0.5, 1.6}, alpha={0.23, 0.35}, particle_name="weather/grey_cloud_02"}) + ps[#ps+1] = Particles.new("weather_storm", 1, {max_nb=5, width=level.map.w*level.map.tile_w, height=level.map.h*level.map.tile_h, speed={0.5, 1.6}, alpha={0.23, 0.35}, particle_name="weather/grey_cloud_03"}) + ps[#ps+1] = Particles.new("weather_storm", 1, {max_nb=5, width=level.map.w*level.map.tile_w, height=level.map.h*level.map.tile_h, speed={0.5, 1.6}, alpha={0.23, 0.35}, particle_name="weather/grey_cloud_04"}) + ps[#ps+1] = Particles.new("weather_storm", 1, {max_nb=5, width=level.map.w*level.map.tile_w, height=level.map.h*level.map.tile_h, speed={0.5, 1.6}, alpha={0.23, 0.35}, particle_name="weather/grey_cloud_05"}) + ps[#ps+1] = Particles.new("weather_storm", 1, {max_nb=5, width=level.map.w*level.map.tile_w, height=level.map.h*level.map.tile_h, speed={0.5, 1.6}, alpha={0.23, 0.35}, particle_name="weather/grey_cloud_06"}) + ps[#ps+1] = Particles.new("weather_storm", 1, {max_nb=5, width=level.map.w*level.map.tile_w, height=level.map.h*level.map.tile_h, speed={0.5, 1.6}, alpha={0.23, 0.35}, particle_name="weather/grey_cloud_07"}) + level.foreground_particle = ps + end, + + foreground = function(level, x, y, nb_keyframes) + local Map = require "engine.Map" + + local ps = level.foreground_particle + local dx, dy = level.map:getTileToScreen(0, 0) -- Display at map border, always, so it scrolls with the map + for j = 1, #ps do + for i = 1, nb_keyframes do + ps[j]:update() + ps[j].ps:update() + end + ps[j].ps:toScreen(dx, dy, true, 1) + end + end, } diff --git a/src/particles.c b/src/particles.c index efd56eed6b026c2837e87fa69b849a4922ad445c..a4963865e17f325ddc4ee2c0e91295c156f371e6 100644 --- a/src/particles.c +++ b/src/particles.c @@ -164,6 +164,7 @@ static int particles_emit(lua_State *L) { particles_type *ps = (particles_type*)auxiliar_checkclass(L, "core{particles}", 1); int nb = luaL_checknumber(L, 2); + if (!nb) return 0; nb = (nb * ps->density) / 100; if (!nb) nb = 1;