New lightweight minimap format, finish #15

This commit is contained in:
Eduardo Bart
2013-01-27 14:06:47 -02:00
parent cf0ecf418d
commit e81dd31ae3
14 changed files with 261 additions and 124 deletions

View File

@@ -530,7 +530,10 @@ function processChannelTabMenu(tab, mousePos, mouseButton)
--menu:addOption(tr('Show Server Messages'), function() --[[TODO]] end)
menu:addSeparator()
end
menu:addOption(tr('Clear Messages'), function() clearChannel(consoleTabBar) end)
if consoleTabBar:getCurrentTab() == tab then
menu:addOption(tr('Clear Messages'), function() clearChannel(consoleTabBar) end)
end
--menu:addOption(tr('Save Messages'), function() --[[TODO]] end)
menu:display(mousePos)

View File

@@ -551,9 +551,8 @@ function processMouseAction(menuPosition, mouseButton, autoWalkPos, lookThing, u
player:stopAutoWalk()
if autoWalkPos and keyboardModifiers == KeyboardNoModifier and mouseButton == MouseLeftButton then
if not player:autoWalk(autoWalkPos) then
modules.game_textmessage.displayStatusMessage(tr('There is no way.'))
end
player.onAutoWalkFail = function() modules.game_textmessage.displayStatusMessage(tr('There is no way.')) end
player:autoWalk(autoWalkPos)
return true
end

View File

@@ -6,7 +6,7 @@ navigating = false
minimapWidget = nil
minimapButton = nil
minimapWindow = nil
otmm = false
flagsPanel = nil
flagWindow = nil
nextFlagId = 0
@@ -49,6 +49,7 @@ function init()
reset()
minimapWindow:setup()
loadMapFlags()
useOTMM()
if g_game.isOnline() then
addEvent(function() updateMapFlags() end)
@@ -263,17 +264,32 @@ end
function loadMap()
local protocolVersion = g_game.getProtocolVersion()
local minimapFile = '/minimap_' .. protocolVersion .. '.otcm'
if g_resources.fileExists(minimapFile) then
g_map.clean()
g_map.loadOtcm(minimapFile)
g_map.clean()
g_minimap.clean()
if otmm then
local minimapFile = '/minimap.otmm'
if g_resources.fileExists(minimapFile) then
g_minimap.loadOtmm(minimapFile)
end
else
local minimapFile = '/minimap_' .. protocolVersion .. '.otcm'
if g_resources.fileExists(minimapFile) then
g_map.loadOtcm(minimapFile)
end
end
end
function saveMap()
local protocolVersion = g_game.getProtocolVersion()
local minimapFile = '/minimap_' .. protocolVersion .. '.otcm'
g_map.saveOtcm(minimapFile)
if otmm then
local minimapFile = '/minimap.otmm'
g_minimap.saveOtmm(minimapFile)
else
local minimapFile = '/minimap_' .. protocolVersion .. '.otcm'
g_map.saveOtcm(minimapFile)
end
end
function toggle()
@@ -286,6 +302,10 @@ function toggle()
end
end
function useOTMM()
otmm = true
end
function isClickInRange(position, fromPosition, toPosition)
return (position.x >= fromPosition.x and position.y >= fromPosition.y and position.x <= toPosition.x and position.y <= toPosition.y)
end