Skip to content
Snippets Groups Projects
Commit 9c7b5fd5 authored by dg's avatar dg
Browse files

option for daynight cycle

fix lightning overload


git-svn-id: http://svn.net-core.org/repos/t-engine4@2851 51575b47-30f0-44d4-a5cc-537603b46e54
parent 3bad9a4a
No related branches found
No related tags found
No related merge requests found
game/engines/default/data/gfx/ui/button-left-sel.png

467 B

game/engines/default/data/gfx/ui/button-left.png

396 B

game/engines/default/data/gfx/ui/button-middle-sel.png

244 B

game/engines/default/data/gfx/ui/button-middle.png

233 B

game/engines/default/data/gfx/ui/button-right-sel.png

484 B

game/engines/default/data/gfx/ui/button-right.png

434 B

...@@ -481,6 +481,17 @@ end ...@@ -481,6 +481,17 @@ end
--- Compute a day/night cycle --- Compute a day/night cycle
-- Works by changing the tint of the map gradualy -- Works by changing the tint of the map gradualy
function _M:dayNightCycle() function _M:dayNightCycle()
local map = game.level.map
local shown = map.color_shown
local obscure = map.color_obscure
if not config.settings.tome.daynight then
-- Restore defaults
map._map:setShown(unpack(shown))
map._map:setObscure(unpack(obscure))
return
end
local hour, minute = game.calendar:getTimeOfDay(game.turn) local hour, minute = game.calendar:getTimeOfDay(game.turn)
hour = hour + (minute / 60) hour = hour + (minute / 60)
local tint = {r = 0.1, g = 0.1, b = 0.1} local tint = {r = 0.1, g = 0.1, b = 0.1}
...@@ -505,9 +516,6 @@ function _M:dayNightCycle() ...@@ -505,9 +516,6 @@ function _M:dayNightCycle()
endTint = { r = 0.1, g = 0.1, b = 0.1 } endTint = { r = 0.1, g = 0.1, b = 0.1 }
tint = doTint(startTint, endTint, (hour - 18) / 6) tint = doTint(startTint, endTint, (hour - 18) / 6)
end end
local map = game.level.map
local shown = map.color_shown
local obscure = map.color_obscure
map._map:setShown(shown[1] * (tint.r+0.4), shown[2] * (tint.g+0.4), shown[3] * (tint.b+0.4), shown[4]) map._map:setShown(shown[1] * (tint.r+0.4), shown[2] * (tint.g+0.4), shown[3] * (tint.b+0.4), shown[4])
map._map:setObscure(obscure[1] * (tint.r+0.2), obscure[2] * (tint.g+0.2), obscure[3] * (tint.b+0.2), obscure[4]) map._map:setObscure(obscure[1] * (tint.r+0.2), obscure[2] * (tint.g+0.2), obscure[3] * (tint.b+0.2), obscure[4])
end end
......
...@@ -58,11 +58,12 @@ on_grant = function(self, who) ...@@ -58,11 +58,12 @@ on_grant = function(self, who)
local m = game.zone:makeEntity(game.level, "actor", {special_rarity="derth_rarity"}, nil, true) local m = game.zone:makeEntity(game.level, "actor", {special_rarity="derth_rarity"}, nil, true)
local spot = game.level:pickSpot{type="npc", subtype="elemental"} local spot = game.level:pickSpot{type="npc", subtype="elemental"}
if m and spot then if m and spot then
local x, y = util.findFreeGrid(spot.x, spot.y, 5, true, {[engine.Map.ACTOR]=true})
m.quest = true m.quest = true
m.on_die = function(self) m.on_die = function(self)
game.player:resolveSource():hasQuest("lightning-overload"):kill_one() game.player:resolveSource():hasQuest("lightning-overload"):kill_one()
end end
game.zone:addEntity(game.level, m, "actor", spot.x, spot.y) game.zone:addEntity(game.level, m, "actor", x, y)
self.max_count = self.max_count + 1 self.max_count = self.max_count + 1
end end
end end
......
...@@ -110,6 +110,15 @@ function _M:generateList() ...@@ -110,6 +110,15 @@ function _M:generateList()
self.c_list:drawItem(item) self.c_list:drawItem(item)
end,} end,}
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Enables of disables day/night light variations effects..#WHITE#"}
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Day/night light cycle#WHITE##{normal}#", status=function(item)
return tostring(config.settings.tome.daynight and "enabled" or "disabled")
end, fct=function(item)
config.settings.tome.daynight = not config.settings.tome.daynight
game:saveSettings("tome.daynight", ("tome.daynight = %s\n"):format(tostring(config.settings.tome.daynight)))
self.c_list:drawItem(item)
end,}
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Enables smooth fog-of-war.\nDisabling it will make the fog of war look 'blocky' but might gain a slight performance increase.#WHITE#"} local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=string.toTString"Enables smooth fog-of-war.\nDisabling it will make the fog of war look 'blocky' but might gain a slight performance increase.#WHITE#"}
list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Smooth fog of war#WHITE##{normal}#", status=function(item) list[#list+1] = { zone=zone, name=string.toTString"#GOLD##{bold}#Smooth fog of war#WHITE##{normal}#", status=function(item)
return tostring(config.settings.tome.smooth_fov and "enabled" or "disabled") return tostring(config.settings.tome.smooth_fov and "enabled" or "disabled")
......
...@@ -198,6 +198,7 @@ if not config.settings.tome.smooth_move then config.settings.tome.smooth_move = ...@@ -198,6 +198,7 @@ if not config.settings.tome.smooth_move then config.settings.tome.smooth_move =
if not config.settings.tome.gfx then config.settings.tome.gfx = {size="32x32", tiles="mushroom"} end if not config.settings.tome.gfx then config.settings.tome.gfx = {size="32x32", tiles="mushroom"} end
if type(config.settings.tome.weather_effects) == "nil" then config.settings.tome.weather_effects = true end if type(config.settings.tome.weather_effects) == "nil" then config.settings.tome.weather_effects = true end
if type(config.settings.tome.smooth_fov) == "nil" then config.settings.tome.smooth_fov = true end if type(config.settings.tome.smooth_fov) == "nil" then config.settings.tome.smooth_fov = true end
if type(config.settings.tome.daynight) == "nil" then config.settings.tome.daynight = true end
Map.smooth_scroll = config.settings.tome.smooth_move Map.smooth_scroll = config.settings.tome.smooth_move
return {require "mod.class.Game", require "mod.class.World"} return {require "mod.class.Game", require "mod.class.World"}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment