From 364ddfb37110599b54c9f68f0fa59bfc2a931726 Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Sat, 2 Oct 2010 21:19:43 +0000 Subject: [PATCH] remove IntroDialog git-svn-id: http://svn.net-core.org/repos/t-engine4@1364 51575b47-30f0-44d4-a5cc-537603b46e54 --- .../default/engine/dialogs/ShowText.lua | 8 ++- .../default/engine/dialogs/UseTalents.lua | 2 +- game/modules/tome/class/Game.lua | 4 +- .../tome/data/texts/intro-bree-man.lua | 2 +- .../modules/tome/data/texts/intro-dunadan.lua | 2 +- game/modules/tome/data/texts/intro-dwarf.lua | 2 +- game/modules/tome/data/texts/intro-elf.lua | 2 +- game/modules/tome/data/texts/intro-ghoul.lua | 2 +- game/modules/tome/data/texts/intro-hobbit.lua | 2 +- game/modules/tome/data/texts/intro-orc.lua | 2 +- .../tome/data/texts/intro-skeleton.lua | 2 +- .../tome/data/texts/intro-tutorial.lua | 2 +- game/modules/tome/dialogs/IntroDialog.lua | 51 ------------------- 13 files changed, 18 insertions(+), 65 deletions(-) delete mode 100644 game/modules/tome/dialogs/IntroDialog.lua diff --git a/game/engines/default/engine/dialogs/ShowText.lua b/game/engines/default/engine/dialogs/ShowText.lua index b4e5056dc8..dde3e3c84b 100644 --- a/game/engines/default/engine/dialogs/ShowText.lua +++ b/game/engines/default/engine/dialogs/ShowText.lua @@ -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 diff --git a/game/engines/default/engine/dialogs/UseTalents.lua b/game/engines/default/engine/dialogs/UseTalents.lua index 6f9e0182c8..07e9772b3b 100644 --- a/game/engines/default/engine/dialogs/UseTalents.lua +++ b/game/engines/default/engine/dialogs/UseTalents.lua @@ -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 diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua index ed5ad78b9c..a3ecb3fd21 100644 --- a/game/modules/tome/class/Game.lua +++ b/game/modules/tome/class/Game.lua @@ -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() diff --git a/game/modules/tome/data/texts/intro-bree-man.lua b/game/modules/tome/data/texts/intro-bree-man.lua index ecaa6364c7..e25a51ed59 100644 --- a/game/modules/tome/data/texts/intro-bree-man.lua +++ b/game/modules/tome/data/texts/intro-bree-man.lua @@ -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. diff --git a/game/modules/tome/data/texts/intro-dunadan.lua b/game/modules/tome/data/texts/intro-dunadan.lua index 42dd5972e6..98beec1478 100644 --- a/game/modules/tome/data/texts/intro-dunadan.lua +++ b/game/modules/tome/data/texts/intro-dunadan.lua @@ -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. diff --git a/game/modules/tome/data/texts/intro-dwarf.lua b/game/modules/tome/data/texts/intro-dwarf.lua index b2d61706e6..4f50d5d824 100644 --- a/game/modules/tome/data/texts/intro-dwarf.lua +++ b/game/modules/tome/data/texts/intro-dwarf.lua @@ -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. diff --git a/game/modules/tome/data/texts/intro-elf.lua b/game/modules/tome/data/texts/intro-elf.lua index b05f0c9c83..8283802054 100644 --- a/game/modules/tome/data/texts/intro-elf.lua +++ b/game/modules/tome/data/texts/intro-elf.lua @@ -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. diff --git a/game/modules/tome/data/texts/intro-ghoul.lua b/game/modules/tome/data/texts/intro-ghoul.lua index 3f90a6047d..a27512d374 100644 --- a/game/modules/tome/data/texts/intro-ghoul.lua +++ b/game/modules/tome/data/texts/intro-ghoul.lua @@ -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. diff --git a/game/modules/tome/data/texts/intro-hobbit.lua b/game/modules/tome/data/texts/intro-hobbit.lua index 7b7869124c..d4325a8a2b 100644 --- a/game/modules/tome/data/texts/intro-hobbit.lua +++ b/game/modules/tome/data/texts/intro-hobbit.lua @@ -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. diff --git a/game/modules/tome/data/texts/intro-orc.lua b/game/modules/tome/data/texts/intro-orc.lua index 613dcc823b..cafce5bf51 100644 --- a/game/modules/tome/data/texts/intro-orc.lua +++ b/game/modules/tome/data/texts/intro-orc.lua @@ -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! diff --git a/game/modules/tome/data/texts/intro-skeleton.lua b/game/modules/tome/data/texts/intro-skeleton.lua index e3fae2bd58..9b7587b41f 100644 --- a/game/modules/tome/data/texts/intro-skeleton.lua +++ b/game/modules/tome/data/texts/intro-skeleton.lua @@ -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. diff --git a/game/modules/tome/data/texts/intro-tutorial.lua b/game/modules/tome/data/texts/intro-tutorial.lua index 292c46e92a..b1b975ef6a 100644 --- a/game/modules/tome/data/texts/intro-tutorial.lua +++ b/game/modules/tome/data/texts/intro-tutorial.lua @@ -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. diff --git a/game/modules/tome/dialogs/IntroDialog.lua b/game/modules/tome/dialogs/IntroDialog.lua deleted file mode 100644 index ea2a682c86..0000000000 --- a/game/modules/tome/dialogs/IntroDialog.lua +++ /dev/null @@ -1,51 +0,0 @@ --- 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 -- GitLab