From 30f728f7d1410ca0b0933ccac682399bf0ff28bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali.rohar@gmail.com> Date: Fri, 5 Nov 2010 20:00:03 +0100 Subject: [PATCH] Added tag Editor to TitleScreen. If will be set to 0 (default) this title screen will not be show when starting Editor from command line (stratagus -e) --- doc/scripts/config.html | 3 +++ src/include/title.h | 3 ++- src/stratagus/title.cpp | 5 +++++ src/ui/script_ui.cpp | 2 ++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/scripts/config.html b/doc/scripts/config.html index 0d8ec8181..2a3dffdf5 100644 --- a/doc/scripts/config.html +++ b/doc/scripts/config.html @@ -1102,6 +1102,9 @@ previously playing music. </dd> <dt>Timeout = number</dt> <dd>The number of seconds we should show this title-screen.(20 by default)</dd> + <dt>Editor = number</dt> + <dd>0 - display this title screen in normal startup (default)</dd> + <dd>1 - display this title screen only when starting Editor from command line</dd> <dt>Label = { {Text = "text", Pos = {x, y}, Font = "font-name"}, ... }</dt> <dd>Optional text to be displayed. It's a list of elements with three tags: <dl> diff --git a/src/include/title.h b/src/include/title.h index a59daeb5a..d6c5bb062 100644 --- a/src/include/title.h +++ b/src/include/title.h @@ -53,7 +53,7 @@ public: class TitleScreen { public: - TitleScreen() : StretchImage(true), Timeout(0), Iterations(0), Labels(NULL) {} + TitleScreen() : StretchImage(true), Timeout(0), Iterations(0), Editor(0), Labels(NULL) {} ~TitleScreen() { if (this->Labels) { for (int i = 0; this->Labels[i]; ++i) { @@ -68,6 +68,7 @@ public: bool StretchImage; int Timeout; int Iterations; + int Editor; TitleScreenLabel **Labels; }; diff --git a/src/stratagus/title.cpp b/src/stratagus/title.cpp index 77ec6675a..0bc2d291e 100644 --- a/src/stratagus/title.cpp +++ b/src/stratagus/title.cpp @@ -34,6 +34,7 @@ #include "movie.h" #include "font.h" #include "sound_server.h" +#include "editor.h" TitleScreen **TitleScreens; /// Title screens to show at startup @@ -172,6 +173,10 @@ void ShowTitleScreens() SetVideoSync(); for (int i = 0; TitleScreens[i]; ++i) { + if ((Editor.Running && !TitleScreens[i]->Editor) || (!Editor.Running && TitleScreens[i]->Editor)) { + continue; + } + if (!TitleScreens[i]->Music.empty()) { if (TitleScreens[i]->Music == "none" || PlayMusic(TitleScreens[i]->Music) == -1) { diff --git a/src/ui/script_ui.cpp b/src/ui/script_ui.cpp index 780b5c025..46b7b9f1d 100644 --- a/src/ui/script_ui.cpp +++ b/src/ui/script_ui.cpp @@ -269,6 +269,8 @@ static int CclSetTitleScreens(lua_State *l) TitleScreens[j]->Timeout = LuaToNumber(l, -1); } else if (!strcmp(value, "Iterations")) { TitleScreens[j]->Iterations = LuaToNumber(l, -1); + } else if (!strcmp(value, "Editor")) { + TitleScreens[j]->Editor = LuaToNumber(l, -1); } else if (!strcmp(value, "Labels")) { if (!lua_istable(l, -1)) { LuaError(l, "incorrect argument");