merge revgraphics

This commit is contained in:
Eduardo Bart
2012-02-03 02:21:36 -02:00
95 changed files with 2652 additions and 1259 deletions

View File

@@ -173,6 +173,11 @@ end
function Terminal.executeCommand(command)
if command == nil or #command == 0 then return end
logLocked = true
Logger.log(LogInfo, '>> ' .. command)
logLocked = false
-- detect and convert commands with simple syntax
local realCommand
if commandEnv[command] then

View File

@@ -298,3 +298,18 @@ KeyCodeDescs = {
[KeyNumpad8] = 'Numpad8',
[KeyNumpad9] = 'Numpad9'
}
SpeakSay = 1
SpeakWhisper = 2
SpeakYell = 3
SpeakBroadcast = 4
SpeakPrivate = 5
SpeakPrivateRed = 6
SpeakPrivatePlayerToNpc = 7
SpeakPrivateNpcToPlayer = 8
SpeakChannelYellow = 9
SpeakChannelWhite = 10
SpeakChannelRed = 11
SpeakChannelOrange = 12
SpeakMonsterSay = 13
SpeakMonsterYell = 14

View File

@@ -1,5 +1,13 @@
Settings = {}
Settings.exists = g_configs.exists
Settings.setNode = g_configs.setNode
Settings.addNode = g_configs.addNode
Settings.getNode = g_configs.getNode
Settings.remove = g_configs.remove
Settings.setList = g_configs.setList
Settings.getList = g_configs.getList
local function convertSettingValue(value)
if type(value) == 'table' then
if value.x and value.width then
@@ -20,21 +28,10 @@ local function convertSettingValue(value)
end
end
function Settings.exists(key)
return g_configs.exists(key)
end
function Settings.remove(key)
g_configs.remove(key)
end
function Settings.set(key, value)
g_configs.set(key, convertSettingValue(value))
end
function Settings.setList(key, list)
g_configs.setList(key, list)
end
function Settings.setDefault(key, value)
if Settings.exists(key) then return false end
@@ -49,10 +46,6 @@ function Settings.get(key, default)
return g_configs.get(key)
end
function Settings.getList(key)
return g_configs.getList(key)
end
function Settings.getString(key, default)
return Settings.get(key, default)
end

View File

@@ -13,7 +13,7 @@ local function moveToolTip(tooltip)
else
pos.x = pos.x + 10
end
tooltip:setPos(pos)
tooltip:setPosition(pos)
end
-- public functions

View File

@@ -1,6 +1,8 @@
function UIItem:onDragEnter(mousePos)
if self:isVirtual() then return false end
local item = self:getItem()
if not item then return false end
if not item then return true end
self:setBorderWidth(1)
@@ -11,28 +13,32 @@ function UIItem:onDragEnter(mousePos)
end
function UIItem:onDragLeave(widget, mousePos)
if self:isVirtual() then return false end
if not self.parsed then
self.currentDragThing = nil
end
restoreCursor()
self:setBorderWidth(0)
return true
end
function UIItem:onDrop(widget, mousePos)
if not widget or not widget.currentDragThing then return false end
if self:isVirtual() then return false end
if not widget or not widget.currentDragThing then return true end
local pos = self.position
local data = widget.currentDragThing:getData()
if widget.currentDragThing:isStackable() and data > 1 then
local count = widget.currentDragThing:getCount()
if widget.currentDragThing:isStackable() and count > 1 then
widget.parsed = true
local moveWindow = displayUI('/game/movewindow.otui')
local spinbox = moveWindow:getChildById('spinbox')
spinbox:setMaximum(data)
spinbox:setMaximum(count)
spinbox:setMinimum(1)
spinbox:setCurrentIndex(data)
spinbox:setCurrentIndex(count)
local okButton = moveWindow:getChildById('buttonOk')
okButton.onClick = function() Game.move(widget.currentDragThing, pos, spinbox:getCurrentIndex()) okButton:getParent():destroy() widget.currentDragThing = nil end
moveWindow.onEnter = okButton.onClick
@@ -45,6 +51,8 @@ function UIItem:onDrop(widget, mousePos)
end
function UIItem:onHoverChange(hovered)
if self:isVirtual() then return end
if g_ui.getDraggingWidget() and self ~= g_ui.getDraggingWidget() then
if hovered then
self:setBorderWidth(1)
@@ -55,6 +63,8 @@ function UIItem:onHoverChange(hovered)
end
function UIItem:onMouseRelease(mousePosition, mouseButton)
if self:isVirtual() then return false end
local item = self:getItem()
if not item or not self:containsPoint(mousePosition) then return false end
return Game.processMouseAction(mousePosition, mouseButton, nil, item, item, nil, item)

View File

@@ -65,7 +65,7 @@ function UIPopupMenu:onKeyPress(keyCode, keyboardModifiers, wouldFilter)
return false
end
-- close all menus when the window is resized
-- close all menus when the window is resized
local function onRootGeometryUpdate()
for i,menu in ipairs(displayedMenuList) do
menu:destroy()

View File

@@ -21,12 +21,12 @@ local function onUseWithMouseRelease(self, mousePosition, mouseButton)
if mouseButton == MouseLeftButton then
local clickedWidget = Game.gameUi:recursiveGetChildByPos(mousePosition)
if clickedWidget then
if clickedWidget.getTile then
if clickedWidget:getClassName() == 'UIMap' then
local tile = clickedWidget:getTile(mousePosition)
if tile then
Game.useWith(Game.selectedThing, tile:getTopMultiUseThing())
end
elseif clickedWidget.getItem then
elseif clickedWidget:getClassName() == 'UIItem' and not clickedWidget:isVirtual() then
Game.useWith(Game.selectedThing, clickedWidget:getItem())
end
end

View File

@@ -15,7 +15,7 @@ function UIMap:onDragLeave(widget, mousePos)
if not self.parsed then
self.currentDragThing = nil
end
restoreCursor()
return true
end
@@ -25,21 +25,21 @@ function UIMap:onDrop(widget, mousePos)
local tile = self:getTile(mousePos)
if not tile then return false end
local data = widget.currentDragThing:getData()
local count = widget.currentDragThing:getCount()
if widget.currentDragThing:isStackable() and data > 1 then
widget.parsed = true
local moveWindow = displayUI('/game/movewindow.otui')
local spinbox = moveWindow:getChildById('spinbox')
spinbox:setMaximum(data)
spinbox:setMaximum(count)
spinbox:setMinimum(1)
spinbox:setCurrentIndex(data)
spinbox:setCurrentIndex(count)
local okButton = moveWindow:getChildById('buttonOk')
okButton.onClick = function() Game.move(widget.currentDragThing, tile:getPos(), spinbox:getCurrentIndex()) okButton:getParent():destroy() widget.currentDragThing = nil end
okButton.onClick = function() Game.move(widget.currentDragThing, tile:getPosition(), spinbox:getCurrentIndex()) okButton:getParent():destroy() widget.currentDragThing = nil end
moveWindow.onEnter = okButton.onClick
else
Game.move(widget.currentDragThing, tile:getPos(), 1)
Game.move(widget.currentDragThing, tile:getPosition(), 1)
end
return true

View File

@@ -1,11 +1,11 @@
function Thing:isInsideContainer()
local pos = self:getPos()
local pos = self:getPosition()
return (pos and pos.x == 65535 and pos.y >= 64)
end
function Thing:getContainerId()
local pos = self:getPos()
local pos = self:getPosition()
if not pos then return 0 end
return pos.y - 64
end

View File

@@ -46,7 +46,7 @@ function Containers.onContainerOpen(containerId, itemId, name, capacity, hasPare
if i <= #items then
local item = items[i]
item:setPos(itemWidget.position)
item:setPosition(itemWidget.position)
itemWidget:setItem(item)
end
end
@@ -76,7 +76,7 @@ function Containers.onContainerAddItem(containerId, item)
local swapItem = itemWidget:getItem()
if swapItem then
swapItem:setPos(nextItemWidget.position)
swapItem:setPosition(nextItemWidget.position)
nextItemWidget:setItem(swapItem)
end
@@ -85,7 +85,7 @@ function Containers.onContainerAddItem(containerId, item)
local itemWidget = container:getChildByIndex(1)
if not itemWidget then return end
item:setPos(itemWidget.position)
item:setPosition(itemWidget.position)
itemWidget:setItem(item)
container.itemCount = container.itemCount + 1
@@ -98,7 +98,7 @@ function Containers.onContainerUpdateItem(containerId, slot, item)
local itemWidget = container:getChildByIndex(slot + 1)
if not itemWidget then return end
itemWidget:setItem(item)
item:setPos(itemWidget.position)
item:setPosition(itemWidget.position)
end
function Containers.onContainerRemoveItem(containerId, slot)
@@ -117,9 +117,9 @@ function Containers.onContainerRemoveItem(containerId, slot)
if not nextItemWidget then return end
local item = nextItemWidget:getItem()
local pos = item:getPos()
local pos = item:getPosition()
pos.z = pos.z - 1
item:setPos(pos)
item:setPosition(pos)
itemWidget:setItem(item)
nextItemWidget:setItem(nil)

View File

@@ -0,0 +1,10 @@
uniform float opacity; // painter opacity
uniform vec4 color; // painter color
uniform float time; // time in seconds since shader linkage
uniform sampler2D texture; // map texture
varying vec2 textureCoords; // map texture coords
void main()
{
gl_FragColor = texture2D(texture, textureCoords) * opacity;
}

View File

@@ -11,24 +11,19 @@ uniform vec4 bodyColor;
uniform vec4 legsColor;
uniform vec4 feetColor;
const vec4 yellow = vec4(1.0, 1.0, 0.0, 1.0);
const vec4 red = vec4(1.0, 0.0, 0.0, 1.0);
const vec4 green = vec4(0.0, 1.0, 0.0, 1.0);
const vec4 blue = vec4(0.0, 0.0, 1.0, 1.0);
vec4 calcOutfitPixel()
{
vec4 pixel = texture2D(texture, textureCoords);
vec4 maskColor = texture2D(maskTexture, textureCoords);
vec4 outColor = vec4(1.0, 1.0, 1.0, 1.0);
if(maskColor == yellow)
if(maskColor.r > 0.1 && maskColor.g > 0.1)
outColor = headColor;
else if(maskColor == red)
else if(maskColor.r > 0.1)
outColor = bodyColor;
else if(maskColor == green)
else if(maskColor.g > 0.1)
outColor = legsColor;
else if(maskColor == blue)
else if(maskColor.b > 0.1)
outColor = feetColor;
return pixel * outColor;