From 3196798b3140aa5336ad7d57f26c0008f8254bcf Mon Sep 17 00:00:00 2001
From: DarkGod <darkgod@net-core.org>
Date: Mon, 22 Jul 2013 11:53:40 +0200
Subject: [PATCH] in birth too

---
 game/engines/default/engine/Entity.lua                     | 2 +-
 game/engines/default/engine/Particles.lua                  | 1 +
 game/modules/tome/data/birth/classes/corrupted.lua         | 4 +++-
 game/modules/tome/data/birth/classes/mage.lua              | 6 +++++-
 game/modules/tome/data/gfx/particles/shader_wings.lua      | 2 +-
 game/modules/tome/data/talents/corruptions/shadowflame.lua | 4 +---
 game/modules/tome/data/talents/gifts/cold-drake.lua        | 4 +---
 game/modules/tome/data/talents/gifts/fire-drake.lua        | 4 +---
 game/modules/tome/data/talents/gifts/higher-draconic.lua   | 4 +---
 game/modules/tome/data/talents/gifts/sand-drake.lua        | 4 +---
 game/modules/tome/data/talents/gifts/storm-drake.lua       | 4 +---
 game/modules/tome/data/talents/gifts/venom-drake.lua       | 4 +---
 game/modules/tome/data/talents/spells/grave.lua            | 4 +---
 game/modules/tome/data/talents/spells/wildfire.lua         | 4 +---
 game/modules/tome/dialogs/Birther.lua                      | 2 +-
 15 files changed, 21 insertions(+), 32 deletions(-)

diff --git a/game/engines/default/engine/Entity.lua b/game/engines/default/engine/Entity.lua
index f6898da2dc..f7116e0ac1 100644
--- a/game/engines/default/engine/Entity.lua
+++ b/game/engines/default/engine/Entity.lua
@@ -204,7 +204,7 @@ end
 function _M:getParticlesList(back)
 	local ps = {}
 	for e, _ in pairs(self.__particles) do
-		if (not back and not e.toback) or (back and e.toback) then
+		if (not back and not e.toback) or (back and e.toback) or (back == "all") then
 			e:checkDisplay()
 			ps[#ps+1] = e
 		end
diff --git a/game/engines/default/engine/Particles.lua b/game/engines/default/engine/Particles.lua
index a5525198a2..7b38fbef75 100644
--- a/game/engines/default/engine/Particles.lua
+++ b/game/engines/default/engine/Particles.lua
@@ -62,6 +62,7 @@ function _M:loaded()
 
 		if t.use_shader then self.shader = t.use_shader end
 		if t.alterscreen then islast = true end
+		if t.toback then self.toback = true end
 		if t.sub_particle then sub_particle = t.sub_particle end
 	else error("unsupported particle type: "..type(self.def))
 	end
diff --git a/game/modules/tome/data/birth/classes/corrupted.lua b/game/modules/tome/data/birth/classes/corrupted.lua
index 03747069c5..3d8958fab5 100644
--- a/game/modules/tome/data/birth/classes/corrupted.lua
+++ b/game/modules/tome/data/birth/classes/corrupted.lua
@@ -105,7 +105,9 @@ newBirthDescriptor{
 	power_source = {arcane=true},
 	stats = { mag=4, wil=3, con=2, },
 	birth_example_particles = {
-		function(actor)	actor:addParticles(Particles.new("shadowfire", 1)) end,
+		function(actor)	if core.shader.active(4) then actor:addParticles(Particles.new("shadowfire", 1)) end end,
+		function(actor) if core.shader.active(4) then actor:addParticles(Particles.new("shader_wings", 1, {infinite=1, img="bloodwings", flap=28, a=0.6})) end
+		end,
 	},
 	talents_types = {
 		["cunning/survival"]={false, 0},
diff --git a/game/modules/tome/data/birth/classes/mage.lua b/game/modules/tome/data/birth/classes/mage.lua
index 8aee0cccec..786ff5dc95 100644
--- a/game/modules/tome/data/birth/classes/mage.lua
+++ b/game/modules/tome/data/birth/classes/mage.lua
@@ -127,7 +127,7 @@ newBirthDescriptor{
 	stats = { mag=5, wil=3, cun=1, },
 	birth_example_particles = {
 		function(actor)
-			if core.shader.active(4) then actor:addParticles(Particles.new("shader_ring_rotating", 1, {radius=1.1}, {type="flames", hide_center=0, xy={0, 0}}))
+			if core.shader.active(4) then actor:addParticles(Particles.new("shader_wings", 1, {infinite=1}))
 			else actor:addParticles(Particles.new("wildfire", 1))
 			end
 		end,
@@ -236,6 +236,10 @@ newBirthDescriptor{
 	},
 	birth_example_particles = {
 		"necrotic-aura",
+		function(actor)
+			if core.shader.active(4) then actor:addParticles(Particles.new("shader_wings", 1, {infinite=1, img="darkwings"}))
+			end
+		end,
 		function(actor)
 			actor:addParticles(Particles.new("ultrashield", 1, {rm=0, rM=0, gm=0, gM=0, bm=10, bM=100, am=70, aM=180, radius=0.4, density=60, life=14, instop=20}))
 		end,
diff --git a/game/modules/tome/data/gfx/particles/shader_wings.lua b/game/modules/tome/data/gfx/particles/shader_wings.lua
index 70cb3b9cbc..bf804789c4 100644
--- a/game/modules/tome/data/gfx/particles/shader_wings.lua
+++ b/game/modules/tome/data/gfx/particles/shader_wings.lua
@@ -17,7 +17,7 @@
 -- Nicolas Casalini "DarkGod"
 -- darkgod@te4.org
 
-use_shader = {type="flamewings", deploy_factor=deploy_speed, flap=flap}
+use_shader = {type="flamewings", deploy_factor=deploy_speed, flap=flap} toback=true
 base_size = 32
 
 local r = 1
diff --git a/game/modules/tome/data/talents/corruptions/shadowflame.lua b/game/modules/tome/data/talents/corruptions/shadowflame.lua
index 2b3e95f6e7..8de6bea6c3 100644
--- a/game/modules/tome/data/talents/corruptions/shadowflame.lua
+++ b/game/modules/tome/data/talents/corruptions/shadowflame.lua
@@ -225,9 +225,7 @@ newTalent{
 
 		local particle
 		if core.shader.active(4) then
-			local p = Particles.new("shader_wings", 1, {infinite=1, img="bloodwings", flap=28, a=0.6})
-			p.toback = true
-			particle = self:addParticles(p)
+			particle = self:addParticles(Particles.new("shader_wings", 1, {infinite=1, img="bloodwings", flap=28, a=0.6}))
 		end
 		local ret = {
 			vim = self:addTemporaryValue("vim_regen", -5),
diff --git a/game/modules/tome/data/talents/gifts/cold-drake.lua b/game/modules/tome/data/talents/gifts/cold-drake.lua
index 63030005d2..a19682a7cb 100644
--- a/game/modules/tome/data/talents/gifts/cold-drake.lua
+++ b/game/modules/tome/data/talents/gifts/cold-drake.lua
@@ -174,9 +174,7 @@ newTalent{
 		game:playSoundNear(self, "talents/breath")
 		
 		if core.shader.active(4) then
-			local p = Particles.new("shader_wings", 1, {life=18, fade=-0.003, deploy_speed=14})
-			p.toback = true
-			self:addParticles(p)
+			self:addParticles(Particles.new("shader_wings", 1, {life=18, fade=-0.003, deploy_speed=14}))
 		end
 		return true
 	end,
diff --git a/game/modules/tome/data/talents/gifts/fire-drake.lua b/game/modules/tome/data/talents/gifts/fire-drake.lua
index f3a7a835f2..4b2a4348ec 100644
--- a/game/modules/tome/data/talents/gifts/fire-drake.lua
+++ b/game/modules/tome/data/talents/gifts/fire-drake.lua
@@ -81,9 +81,7 @@ newTalent{
 		game:playSoundNear(self, "talents/breath")
 
 		if core.shader.active(4) then
-			local p = Particles.new("shader_wings", 1, {life=18, fade=-0.003, deploy_speed=14})
-			p.toback = true
-			self:addParticles(p)
+			self:addParticles(Particles.new("shader_wings", 1, {life=18, fade=-0.003, deploy_speed=14}))
 		end
 		return true
 	end,
diff --git a/game/modules/tome/data/talents/gifts/higher-draconic.lua b/game/modules/tome/data/talents/gifts/higher-draconic.lua
index f502dfccad..87387637ea 100644
--- a/game/modules/tome/data/talents/gifts/higher-draconic.lua
+++ b/game/modules/tome/data/talents/gifts/higher-draconic.lua
@@ -123,9 +123,7 @@ newTalent{
 		game:playSoundNear(self, "talents/breath")
 		
 		if core.shader.active(4) then
-			local p = Particles.new("shader_wings", 1, {life=18, fade=-0.003, deploy_speed=14})
-			p.toback = true
-			self:addParticles(p)
+			self:addParticles(Particles.new("shader_wings", 1, {life=18, fade=-0.003, deploy_speed=14}))
 		end
 		return true
 	end,
diff --git a/game/modules/tome/data/talents/gifts/sand-drake.lua b/game/modules/tome/data/talents/gifts/sand-drake.lua
index 33e1743659..932d4309c2 100644
--- a/game/modules/tome/data/talents/gifts/sand-drake.lua
+++ b/game/modules/tome/data/talents/gifts/sand-drake.lua
@@ -159,9 +159,7 @@ newTalent{
 		game:playSoundNear(self, "talents/breath")
 		
 		if core.shader.active(4) then
-			local p = Particles.new("shader_wings", 1, {life=18, fade=-0.003, deploy_speed=14})
-			p.toback = true
-			self:addParticles(p)
+			self:addParticles(Particles.new("shader_wings", 1, {life=18, fade=-0.003, deploy_speed=14}))
 		end
 		return true
 	end,
diff --git a/game/modules/tome/data/talents/gifts/storm-drake.lua b/game/modules/tome/data/talents/gifts/storm-drake.lua
index 36a1ce269b..498d1d1aeb 100644
--- a/game/modules/tome/data/talents/gifts/storm-drake.lua
+++ b/game/modules/tome/data/talents/gifts/storm-drake.lua
@@ -212,9 +212,7 @@ newTalent{
 
 		
 		if core.shader.active(4) then
-			local p = Particles.new("shader_wings", 1, {img="lightningwings",infinite=1, life=18, fade=0*-0.003, deploy_speed=14})
-			p.toback = true
-			self:addParticles(p)
+			self:addParticles(Particles.new("shader_wings", 1, {img="lightningwings", life=18, fade=-0.003, deploy_speed=14}))
 		end
 		game:playSoundNear(self, "talents/breath")
 		return true
diff --git a/game/modules/tome/data/talents/gifts/venom-drake.lua b/game/modules/tome/data/talents/gifts/venom-drake.lua
index 64e2c9dd8e..9958a78d1e 100644
--- a/game/modules/tome/data/talents/gifts/venom-drake.lua
+++ b/game/modules/tome/data/talents/gifts/venom-drake.lua
@@ -184,9 +184,7 @@ newTalent{
 		game:playSoundNear(self, "talents/breath")
 		
 		if core.shader.active(4) then
-			local p = Particles.new("shader_wings", 1, {life=18, fade=-0.003, deploy_speed=14})
-			p.toback = true
-			self:addParticles(p)
+			self:addParticles(Particles.new("shader_wings", 1, {life=18, fade=-0.003, deploy_speed=14}))
 		end
 		return true
 	end,
diff --git a/game/modules/tome/data/talents/spells/grave.lua b/game/modules/tome/data/talents/spells/grave.lua
index 87ebb50dda..7f46a49334 100644
--- a/game/modules/tome/data/talents/spells/grave.lua
+++ b/game/modules/tome/data/talents/spells/grave.lua
@@ -331,9 +331,7 @@ newTalent{
 		game:playSoundNear(self, "talents/spell_generic2")
 		local particle
 		if core.shader.active(4) then
-			local p = Particles.new("shader_wings", 1, {infinite=1, img="darkwings"})
-			p.toback = true
-			particle = self:addParticles(p)
+			particle = self:addParticles(Particles.new("shader_wings", 1, {infinite=1, img="darkwings"}))
 		end
 		local ret = {
 			chance = self:addTemporaryValue("life_leech_chance", chance),
diff --git a/game/modules/tome/data/talents/spells/wildfire.lua b/game/modules/tome/data/talents/spells/wildfire.lua
index 7ff2a02002..a3d00bc64e 100644
--- a/game/modules/tome/data/talents/spells/wildfire.lua
+++ b/game/modules/tome/data/talents/spells/wildfire.lua
@@ -124,9 +124,7 @@ newTalent{
 
 		local particle
 		if core.shader.active(4) then
-			local p = Particles.new("shader_wings", 1, {infinite=1})
-			p.toback = true
-			particle = self:addParticles(p)
+			particle = self:addParticles(Particles.new("shader_wings", 1, {infinite=1}))
 		else
 			particle = self:addParticles(Particles.new("wildfire", 1))
 		end
diff --git a/game/modules/tome/dialogs/Birther.lua b/game/modules/tome/dialogs/Birther.lua
index 505a4eba3f..50a439022a 100644
--- a/game/modules/tome/dialogs/Birther.lua
+++ b/game/modules/tome/dialogs/Birther.lua
@@ -1066,7 +1066,7 @@ function _M:setTile(f, w, h, last)
 		self:fakeEquip(false)
 
 		-- Add an example particles if any
-		local ps = self.actor:getParticlesList()
+		local ps = self.actor:getParticlesList("all")
 		for i, p in ipairs(ps) do self.actor:removeParticles(p) end
 		if self.descriptors_by_type.subclass then
 			local d = self.birth_descriptor_def.subclass[self.descriptors_by_type.subclass]
-- 
GitLab