Skip to content
Snippets Groups Projects
Commit 1ec1e2af authored by dg's avatar dg
Browse files

New command: Show map, default binding to "tab"

Toggle creatures list default binding set to "ctrl+tab"


git-svn-id: http://svn.net-core.org/repos/t-engine4@4776 51575b47-30f0-44d4-a5cc-537603b46e54
parent cc1fbcc8
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@
-- darkgod@te4.org
defineAction{
default = { "sym:_TAB:false:false:false:false" },
default = { "sym:_TAB:true:false:false:false" },
type = "TOGGLE_NPC_LIST",
group = "actions",
name = "Toggle list of seen creatures",
......@@ -37,3 +37,10 @@ defineAction{
group = "actions",
name = "Take a screenshot",
}
defineAction{
default = { "sym:_TAB:false:false:false:false" },
type = "SHOW_MAP",
group = "actions",
name = "Show map",
}
-- TE4 - T-Engine 4
-- Copyright (C) 2009, 2010, 2011 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
require "engine.class"
local Base = require "engine.ui.Base"
local Focusable = require "engine.ui.Focusable"
--- An empty space
module(..., package.seeall, class.inherit(Base, Focusable))
function _M:init(t)
self.w = assert(t.width, "no empty zone width")
self.h = assert(t.height, "no empty zone height")
Base.init(self, t)
end
function _M:generate()
end
function _M:display(x, y)
end
......@@ -1390,6 +1390,10 @@ function _M:setupCommands()
if not ok and err then print(debug.traceback(co)) error(err) end
end,
SHOW_MAP = function()
game:registerDialog(require("mod.dialogs.ShowMap").new())
end,
USERCHAT_SHOW_TALK = function()
self.show_userchat = not self.show_userchat
end,
......
......@@ -1071,6 +1071,8 @@ function _M:displayPlayer(scale, bx, by)
end
function _M:displayMinimap(scale, bx, by)
if self.no_minimap then return end
local map = game.level.map
mm_shadow[1]:toScreenFull(0, 2, mm_shadow[6], mm_shadow[7], mm_shadow[2], mm_shadow[3])
......@@ -1107,6 +1109,8 @@ function _M:displayMinimap(scale, bx, by)
elseif button == "right" then
local tmx, tmy = math.floor((bx-50) / 3), math.floor((by-30) / 3)
game.level.map:moveViewSurround(tmx + game.minimap_scroll_x, tmy + game.minimap_scroll_y, 1000, 1000)
elseif event == "button" and button == "middle" then
game.key:triggerVirtual("SHOW_MAP")
end
end
end
......@@ -1159,14 +1163,14 @@ function _M:display(nb_keyframes)
profile.chat:toScreen()
self.logdisplay:toScreen()
if self.show_npc_list then
if game.show_npc_list then
self.npcs_display:toScreen()
else
self.hotkeys_display:toScreen()
end
sep[1]:toScreenFull(0, self.map_h_stop, game.w, sep[7], sep[2], sep[3])
sep_vines[1]:toScreenFull(0, self.map_h_stop, game.w, sep_vines[7], sep_vines[2], sep_vines[3])
sep_vines[1]:toScreenFull(0, self.map_h_stop - 3, game.w, sep_vines[7], sep_vines[2], sep_vines[3])
end
function _M:setupMouse(mouse)
......
......@@ -67,6 +67,7 @@ newEntity{
block_sight = true,
nice_tiler = { method="replace", base={"FOREST", 100, 1, 30}},
nice_editer = grass_editer,
special_minimap = colors.GREEN,
}
for i = 1, 30 do newEntity{ base="FOREST", define_as = "FOREST"..i, image = "terrain/grass.png", add_displays = class:makeTrees("terrain/tree_alpha", 13, 9)} end
......@@ -82,6 +83,7 @@ newEntity{
block_sight = true,
nice_tiler = { method="replace", base={"OLD_FOREST", 100, 1, 30}},
nice_editer = grass_editer,
special_minimap = colors.GREEN,
}
for i = 1, 30 do newEntity{ base="OLD_FOREST", define_as = "OLD_FOREST"..i, image = "terrain/grass.png", add_displays = class:makeTrees("terrain/tree_alpha", 13, 9, colors.GREY)} end
......@@ -112,6 +114,7 @@ newEntity{
block_sight = true,
nice_tiler = { method="replace", base={"BURNT_FOREST", 100, 1, 20}},
nice_editer = lava_editer,
special_minimap = colors.GREY,
}
for i = 1, 20 do newEntity{ base="BURNT_FOREST", define_as = "BURNT_FOREST"..i, name = "burnt tree", image = "terrain/lava_floor.png", add_displays = class:makeTrees("terrain/burnttree_alpha", 8, 0)} end
......@@ -135,6 +138,7 @@ newEntity{
can_encounter=true, equilibrium_level=-10,
nice_editer = ice_editer,
nice_tiler = { method="replace", base={"FROZEN_SEA", 100, 1, 4}},
special_minimap = colors.BLUE,
}
for i = 1, 4 do newEntity{ base="FROZEN_SEA", define_as = "FROZEN_SEA"..i, add_mos = {{image = "terrain/ice/frozen_ground_5_0"..i..".png"}}} end
......@@ -169,6 +173,7 @@ newEntity{
display = '~', color=colors.AQUAMARINE, back_color=colors.DARK_BLUE,
always_remember = true,
can_encounter="water", equilibrium_level=-10,
special_minimap = colors.BLUE,
}
newEntity{ base = "WATER_BASE", define_as = "WATER_BASE_DEEP", can_pass = {pass_water=1}, does_block_move = true }
......@@ -260,6 +265,7 @@ newEntity{
block_sight = true,
nice_tiler = { method="replace", base={"JUNGLE_FOREST", 100, 1, 30}},
nice_editer = jungle_grass_editer,
special_minimap = colors.GREEN,
}
for i = 1, 30 do
newEntity{ base="JUNGLE_FOREST", define_as = "JUNGLE_FOREST"..i, image = "terrain/jungle/jungle_grass_floor_01.png", add_displays = class:makeTrees("terrain/jungle/jungle_tree_", 17, 7)}
......
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009, 2010, 2011 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
require "engine.class"
local Dialog = require "engine.ui.Dialog"
local GenericContainer = require "engine.ui.GenericContainer"
module(..., package.seeall, class.inherit(Dialog))
function _M:init()
self.title_shadow = false
self.color = {r=0x3a, g=0x35, b=0x33}
self.ui = "parchment"
self.bsize = 12
local map = game.level.map
local mw, mh = map.w * self.bsize, map.h * self.bsize
local Mw, Mh = math.floor(game.w * 0.9), math.floor(game.h * 0.9)
while mw > Mw or mh > Mh do
if self.bsize <= 3 then break end
self.bsize = self.bsize - 1
mw, mh = map.w * self.bsize, map.h * self.bsize
end
mw = math.min(mw, Mw)
mh = math.min(mh, Mh)
local t_per_w, t_per_h = math.floor(mw / self.bsize), math.floor(mh / self.bsize)
Dialog.init(self, "Map: #0080FF#"..game.old_zone_name, 1, 1)
local mc = GenericContainer.new{width=mw, height=mh}
local uis = { {left=0, top=0, ui=mc} }
mc.mouse:registerZone(0, 0, mc.w, mc.h, function(button, mx, my, xrel, yrel, bx, by, event)
if event == "out" then game.tooltip_x, game.tooltip_y = 1, 1 return end
game.tooltip_x, game.tooltip_y = 1, 1
local basex, basey = math.floor(bx / self.bsize), math.floor(by / self.bsize)
local dx, dy = game.minimap_scroll_x + basex, game.minimap_scroll_y + basey
local ts = game.tooltip:getTooltipAtMap(dx, dy, dx, dy)
if ts then game.tooltip:set(ts) game.tooltip:display() else game.tooltip:erase() end
if event == "button" and button == "left" then
game.minimap_scroll_x = dx - math.floor(t_per_w / 2)
game.minimap_scroll_y = dy - math.floor(t_per_h / 2)
game.minimap_scroll_x = util.bound(game.minimap_scroll_x, 0, math.max(0, map.w - t_per_w))
game.minimap_scroll_y = util.bound(game.minimap_scroll_y, 0, math.max(0, map.h - t_per_h))
end
end, nil, nil, true)
self:loadUI(uis)
self.key:addBind("EXIT", function() game:unregisterDialog(self) end)
self.key:addBind("ACCEPT", function() game:unregisterDialog(self) end)
self.key:addBind("SHOW_MAP", function() game:unregisterDialog(self) end)
self:setupUI(true, true)
self:setFocus(1)
game:playSound("actions/read")
game.uiset.no_minimap = true
game.level.map._map:setupMiniMapGridSize(self.bsize)
end
function _M:unload()
game.uiset.no_minimap = nil
game.uiset:setupMinimap(game.level)
end
function _M:innerDisplay(x, y, nb_keyframes)
local map = game.level.map
local w = math.floor(self.iw / self.bsize)
local h = math.floor(self.ih / self.bsize)
map:minimapDisplay(x + self.ix, y + self.iy, game.minimap_scroll_x, game.minimap_scroll_y, w, h, 0.85)
end
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