Skip to content
Snippets Groups Projects
Commit 5229779d authored by dg's avatar dg
Browse files

fix

git-svn-id: http://svn.net-core.org/repos/t-engine4@4117 51575b47-30f0-44d4-a5cc-537603b46e54
parent 43cd005f
No related branches found
No related tags found
No related merge requests found
......@@ -96,19 +96,20 @@ function _M:getFileName(o)
end
function _M:saveObject(obj, zip)
local processed = 0
self.current_save_zip = zip
self.current_save_main = obj
self:addToProcess(obj)
while #self.process > 0 do
local tbl = table.remove(self.process)
self.tables[tbl] = self:getFileName(tbl)
-- zip:add(self:getFileName(tbl), tbl:save(nil, nil, self))
tbl:save()
savefile_pipe.current_nb = savefile_pipe.current_nb + 1
processed = processed + 1
if self.coroutine then coroutine.yield() end
end
return self.tables[obj]
return processed
end
--- Get a savename for a world
......@@ -133,7 +134,8 @@ function _M:saveWorld(world, no_dialog)
core.display.forceRedraw()
local zip = fs.zipOpen(self.save_dir..self:nameSaveWorld(world)..".tmp")
self:saveObject(world, zip)
local nb = self:saveObject(world, zip)
zip:add("nb", tostring(nb))
zip:close()
fs.delete(self.save_dir..self:nameSaveWorld(world))
fs.rename(self.save_dir..self:nameSaveWorld(world)..".tmp", self.save_dir..self:nameSaveWorld(world))
......@@ -215,7 +217,8 @@ function _M:saveGame(game, no_dialog)
core.display.forceRedraw()
local zip = fs.zipOpen(self.save_dir..self:nameSaveGame(game)..".tmp")
self:saveObject(game, zip)
local nb = self:saveObject(game, zip)
zip:add("nb", tostring(nb))
zip:close()
fs.delete(self.save_dir..self:nameSaveGame(game))
fs.rename(self.save_dir..self:nameSaveGame(game)..".tmp", self.save_dir..self:nameSaveGame(game))
......@@ -360,6 +363,7 @@ function _M:loadReal(load)
-- Resolve self referencing tables now
resolveSelf(o, o, true)
-- core.wait.manualTick()
self.loaded[load] = o
return o
end
......
-- 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"
--- A generic waiter bar
module(..., package.seeall, class.inherit(Base))
function _M:init(t)
self.size = assert(t.size, "no waiter size")
Base.init(self, t)
end
function _M:generate()
local left = core.display.loadImage("/data/gfx/waiter/left_basic.png")
local right = core.display.loadImage("/data/gfx/waiter/right_basic.png")
local lw, lh = left:getSize()
local rw, rh = right:getSize()
self.w, self.h = self.size + lw + lw, lh
self.dx = lw
end
function _M:display(x, y)
end
function _M:getWaitDisplay(d)
d.__showup = false
d.unload_wait = rawget(d, "unload")
d.unload = function(self) core.wait.disable() if self.unload_wait then self:unload_wait() end end
core.display.forceRedraw()
return function()
local dx, dy, dw, dh = self.dx + d.ui_by_ui[self].x + d.display_x, d.ui_by_ui[self].y + d.display_y, self.size, self.h
local i, max, dir = 0, 20, 1
local left = {core.display.loadImage("/data/gfx/waiter/left_basic.png"):glTexture()}
local right = {core.display.loadImage("/data/gfx/waiter/right_basic.png"):glTexture()}
local middle = {core.display.loadImage("/data/gfx/waiter/middle.png"):glTexture()}
local bar = {core.display.loadImage("/data/gfx/waiter/bar.png"):glTexture()}
return function()
-- Background
core.wait.drawLastFrame()
-- Progressbar
local x
i = i + dir
if dir > 0 and i >= max then dir = -1
elseif dir < 0 and i <= -max then dir = 1
end
local x = dw * (i / max)
local x2 = x + dw
x = util.bound(x, 0, dw)
x2 = util.bound(x2, 0, dw)
local w, h = x2 - x, dh
middle[1]:toScreenFull(dx, dy, dw, middle[7], middle[2], middle[3])
bar[1]:toScreenFull(dx + x, dy, w, bar[7], bar[2], bar[3])
left[1]:toScreenFull(dx - left[6] + 5, dy + (middle[7] - left[7]) / 2, left[6], left[7], left[2], left[3])
right[1]:toScreenFull(dx + dw - 5, dy + (middle[7] - right[7]) / 2, right[6], right[7], right[2], right[3])
end
end
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