Skip to content
Snippets Groups Projects
Commit 364ddfb3 authored by dg's avatar dg
Browse files

remove IntroDialog

git-svn-id: http://svn.net-core.org/repos/t-engine4@1364 51575b47-30f0-44d4-a5cc-537603b46e54
parent a1d66c49
No related branches found
No related tags found
No related merge requests found
Showing
with 18 additions and 65 deletions
......@@ -23,7 +23,7 @@ local Textzone = require "engine.ui.Textzone"
module(..., package.seeall, class.inherit(Dialog))
function _M:init(title, file, replace, w, h)
function _M:init(title, file, replace, w, h, on_exit, accept_key)
local rw, rh = w, h
w = math.floor(w or game.w * 0.6)
h = math.floor(h or game.h * 0.8)
......@@ -40,7 +40,11 @@ function _M:init(title, file, replace, w, h)
self:setupUI(not rw, not rh)
self.key:addBinds{
EXIT = function() game:unregisterDialog(self) end,
ACCEPT = accept_key and "EXIT",
EXIT = function()
game:unregisterDialog(self)
if on_exit then on_exit() end
end,
}
end
......
......@@ -157,7 +157,7 @@ function _M:generateList()
if added then
local zone = Textzone.new{width=self.c_desc.w, height=self.c_desc.h, text=tt.description}
table.insert(list, where+1, { zone=zone, char="", name=cat:capitalize().." / "..tt.name:capitalize(), type=tt.type, color={0x80, 0x80, 0x80}, status="" })
table.insert(list, where+1, { zone=zone, char="", name="#{bold}#"..cat:capitalize().." / "..tt.name:capitalize().."#{normal}#", type=tt.type, color={0x80, 0x80, 0x80}, status="" })
end
end
for i = 1, #list do list[i].id = i end
......
......@@ -149,12 +149,12 @@ function _M:newGame()
self.paused = true
print("[PLAYER BIRTH] resolved!")
local birthend = function()
self:registerDialog(require("mod.dialogs.IntroDialog").new(self.player, function()
self:registerDialog(require("engine.dialogs.ShowText").new("Welcome to ToME", "intro-"..self.player.starting_intro, {name=self.player.name}, nil, nil, function()
self.player:resetToFull()
self.player:registerCharacterPlayed()
self.player:grantQuest(self.player.starting_quest)
self.player:onBirth(birth)
end))
end, true))
end
if self.player.no_birth_levelup then birthend()
......
......@@ -17,7 +17,7 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
return [[Welcome #LIGHT_GREEN#]]..name..[[#WHITE#.
return [[Welcome #LIGHT_GREEN#@name@#WHITE#.
You are a native of the town of Bree, a multicultural town that both men and hobbits call home.
Humans are the most common race of the land, and you are one of them. In an attempt to prove your worth, you have decided to venture into the old and wild places of the world, looking for ancient treasures and glory.
......
......@@ -17,7 +17,7 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
return [[Welcome #LIGHT_GREEN#]]..name..[[#WHITE#.
return [[Welcome #LIGHT_GREEN#@name@#WHITE#.
You are a Dúnedain, one of the last descendants of the proud men of Númenor.
Hailing from a great line of greater men, you have decided to prove your worth by venturing into the old and wild places of the world, looking for ancient treasures and glory.
......
......@@ -17,7 +17,7 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
return [[Welcome #LIGHT_GREEN#]]..name..[[#WHITE#.
return [[Welcome #LIGHT_GREEN#@name@#WHITE#.
You are a member of the proud race of the Dwarves.
Hailing from the dwarven kingdom under the Lonely Mountain you have decided to take to the road and start a new life of adventuring.
......
......@@ -17,7 +17,7 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
return [[Welcome #LIGHT_GREEN#]]..name..[[#WHITE#.
return [[Welcome #LIGHT_GREEN#@name@#WHITE#.
You are an elf, one of the first born. Many of your kind, having grown weary of Middle Earth, have left for the immortal lands.
Yet some elves do not wish to leave this land they fought so hard for. In Mirkwood Forest, now called Eryn Lasgalen, the kingdom of Thranduil still thrives.
You lived a peaceful life deep in the forest for many years, but lately you have grown restless and have decided to step into the world.
......
......@@ -17,7 +17,7 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
return [[Welcome #LIGHT_GREEN#]]..name..[[#WHITE#.
return [[Welcome #LIGHT_GREEN#@name@#WHITE#.
You have died ages ago, but that did not stop you, you were raised as an undead ghoul.
After wandering aimlessly for eons you found a goal: to become a force to be reckoned with in this world.
......
......@@ -17,7 +17,7 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
return [[Welcome #LIGHT_GREEN#]]..name..[[#WHITE#.
return [[Welcome #LIGHT_GREEN#@name@#WHITE#.
You are a hobbit of the Shire. Most hobbits never leave the borders of their beloved Shire, even in this time of peace. Few know about the distant lands and fewer yet are willing to venture there.
You are one of those rare few, inspired by the stories of dragons, gold, and the treasures of Bilbo nearly two hundred years before. You have decided to venture into the old and wild places of the world, looking for ancient treasures and glory.
......
......@@ -17,7 +17,7 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
return [[Welcome #LIGHT_GREEN#]]..name..[[#WHITE#.
return [[Welcome #LIGHT_GREEN#@name@#WHITE#.
You are a member of the feared race of the Orcs.
For ages your kind has served Morgoth and his lieutenant Sauron, but they have all been vanquished by the free people.
Now as come the time for your revenge, a new power is rising in the far east of Arda, and you are one of its soldiers!
......
......@@ -17,7 +17,7 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
return [[Welcome #LIGHT_GREEN#]]..name..[[#WHITE#.
return [[Welcome #LIGHT_GREEN#@name@#WHITE#.
You have died ages ago, but that did not stop you, you were raised as an undead skeleton.
After wandering aimlessly for eons you found a goal: to become a force to be reckoned with in this world.
......
......@@ -17,7 +17,7 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
return [[Welcome #LIGHT_GREEN#]]..name..[[#WHITE#.
return [[Welcome #LIGHT_GREEN#@name@#WHITE#.
#LIGHT_GREEN#Welcome to ToME 4!#LAST#
This tutorial will present you with a short quest to familiarise yourself with the game.
......
-- ToME - Tales of Middle-Earth
-- Copyright (C) 2009, 2010 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"
require "engine.Dialog"
module(..., package.seeall, class.inherit(engine.Dialog))
function _M:init(actor, on_exit)
self.actor = actor
engine.Dialog.init(self, "Welcome to ToME", 500, 400)
self:keyCommands(nil, {
ACCEPT = "EXIT",
EXIT = function()
game:unregisterDialog(self)
on_exit()
end,
})
self:mouseZones{
{ x=0, y=0, w=game.w, h=game.h, mode={button=true}, norestrict=true, fct=function(button) if button == "left" then self.key:triggerVirtual("EXIT") end end},
}
end
function _M:drawDialog(s)
local f, err = loadfile("/data/texts/intro-"..self.actor.starting_intro..".lua")
if not f and err then error(err) end
setfenv(f, {name=self.actor.name})
local str = f()
local lines = str:splitLines(self.iw - 10, self.font)
for i = 1, #lines do
s:drawColorStringBlended(self.font, lines[i], 5, 4 + i * self.font:lineSkip())
end
self.changed = false
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