Author: shadowmaster
Date: Tue Mar 31 01:06:12 2009
New Revision: 34311
URL: http://svn.gna.org/viewcvs/wesnoth?rev=34311&view=rev
Log:
Began refactoring of story screens, which will also change their WML
structures in the future.
For now there is only a minimal set of stubs in the new code, which is
also disabled for normal builds unless -DSHADOWM_STORYSCREEN is used.
If you find "bugs" in the new code in storyscreen.?pp, talk with me first,
I may be aware of them already...
Added:
trunk/src/storyscreen.cpp
trunk/src/storyscreen.hpp
- copied, changed from r34310, trunk/src/intro.hpp
Modified:
trunk/src/CMakeLists.txt
trunk/src/Makefile.am
trunk/src/SConscript
trunk/src/intro.cpp
trunk/src/intro.hpp
Modified: trunk/src/CMakeLists.txt
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/CMakeLists.txt?rev=34311&r1=34310&r2=34311&view=diff
==============================================================================
--- trunk/src/CMakeLists.txt (original)
+++ trunk/src/CMakeLists.txt Tue Mar 31 01:06:12 2009
@@ -306,6 +306,7 @@
settings.cpp
statistics.cpp
statistics_dialog.cpp
+ storyscreen.cpp
team.cpp
terrain_filter.cpp
time_of_day.cpp
Modified: trunk/src/Makefile.am
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/Makefile.am?rev=34311&r1=34310&r2=34311&view=diff
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Tue Mar 31 01:06:12 2009
@@ -143,6 +143,7 @@
settings.cpp \
statistics.cpp \
statistics_dialog.cpp \
+ storyscreen.cpp \
team.cpp \
terrain_filter.cpp \
text.cpp \
Modified: trunk/src/SConscript
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/SConscript?rev=34311&r1=34310&r2=34311&view=diff
==============================================================================
--- trunk/src/SConscript (original)
+++ trunk/src/SConscript Tue Mar 31 01:06:12 2009
@@ -198,6 +198,7 @@
settings.cpp
statistics.cpp
statistics_dialog.cpp
+ storyscreen.cpp
team.cpp
terrain_filter.cpp
time_of_day.cpp
Modified: trunk/src/intro.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/intro.cpp?rev=34311&r1=34310&r2=34311&view=diff
==============================================================================
--- trunk/src/intro.cpp (original)
+++ trunk/src/intro.cpp Tue Mar 31 01:06:12 2009
@@ -17,6 +17,9 @@
* Introduction sequence at start of a scenario, End-screen after end of
* campaign.
*/
+
+// Do not remove the #ifndef below. See storyscreen.hpp.
+#ifndef SHADOWM_STORYSCREEN
#include "global.hpp"
#include "foreach.hpp"
@@ -507,3 +510,5 @@
--count;
}
}
+
+#endif /* ! SHADOWM_STORYSCREEN */
Modified: trunk/src/intro.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/intro.hpp?rev=34311&r1=34310&r2=34311&view=diff
==============================================================================
--- trunk/src/intro.hpp (original)
+++ trunk/src/intro.hpp Tue Mar 31 01:06:12 2009
@@ -52,4 +52,4 @@
*/
void the_end(display &disp, std::string text, unsigned int duration);
-#endif
+#endif /* ! INTRO_HPP_INCLUDED */
Added: trunk/src/storyscreen.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/storyscreen.cpp?rev=34311&view=auto
==============================================================================
--- trunk/src/storyscreen.cpp (added)
+++ trunk/src/storyscreen.cpp Tue Mar 31 01:06:12 2009
@@ -1,0 +1,96 @@
+/* $Id$ */
+/*
+ Copyright (C) 2003 - 2009 by David White <[email protected]>
+ Copyright (C) 2009 by Ignacio R. Morelle <[email protected]>
+ Part of the Battle for Wesnoth Project http://www.wesnoth.org/
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2
+ or at your option any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY.
+
+ See the COPYING file for more details.
+*/
+
+// This code is work in progress, and shouldn't be enabled for production
+// builds. It is supposed to completely replace the old story screens code
+// at intro.cpp, introducing new WML conventions while at it.
+//
+// Do not remove the #ifdef below.
+#ifdef SHADOWM_STORYSCREEN
+
+#include "global.hpp"
+#include "foreach.hpp"
+#include "variable.hpp"
+
+#include "display.hpp"
+#include "game_events.hpp"
+#include "gamestatus.hpp"
+#include "gettext.hpp"
+#include "intro.hpp"
+#include "language.hpp"
+#include "log.hpp"
+#include "sound.hpp"
+#include "text.hpp"
+
+#define ERR_NG LOG_STREAM(err , engine)
+#define LOG_NG LOG_STREAM(info, engine)
+#define ERR_DI LOG_STREAM(err , display)
+
+// TODO: remove when completed
+#include "boost/current_function.hpp"
+#define STUB() \
+ std::cerr << "OUCH: entered stub " << BOOST_CURRENT_FUNCTION << " [at "
<< __FILE__ << ":" << __LINE__ << "]\n"
+
+class storyscreen
+{
+public:
+ storyscreen(display& disp, const vconfig& data, const config&
scenario_cfg);
+
+private:
+ display& disp_;
+ vconfig data_;
+ config scenario_;
+};
+
+namespace {
+ void write_generic_endscreen_config(config& append_to_cfg)
+ {
+ config& partcfg =
append_to_cfg.add_child("story").add_child("page");
+ partcfg["text_align"] = "centered";
+ }
+} // end anonymous namespace
+
+void show_storyscreen(display& disp, const vconfig& data, const config&
scenario_cfg)
+{
+ STUB();
+ LOG_NG << "entering storyscreen procedure...\n";
+
+ // FIXME: stub!
+
+ LOG_NG << "leaving storyscreen procedure...\n";
+}
+
+void show_endscreen(display& disp, const t_string& text, unsigned int duration)
+{
+ STUB();
+ LOG_NG << "show_endscreen() invoked...\n";
+
+ // FIXME: stub!
+
+ LOG_NG << "show_endscreen() completed...\n";
+}
+
+// Trivial drop-in compatibility with intro.cpp
+void show_intro(display &disp, const vconfig& data, const config& level)
+{
+ show_storyscreen(disp,data,level);
+}
+
+void the_end(display &disp, std::string text, unsigned int duration)
+{
+ show_endscreen(disp, t_string(text) /* dumb! */, duration);
+}
+
+#endif /* SHADOWM_STORYSCREEN */
Copied: trunk/src/storyscreen.hpp (from r34310, trunk/src/intro.hpp)
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/storyscreen.hpp?p2=trunk/src/storyscreen.hpp&p1=trunk/src/intro.hpp&r1=34310&r2=34311&rev=34311&view=diff
==============================================================================
--- trunk/src/intro.hpp (original)
+++ trunk/src/storyscreen.hpp Tue Mar 31 01:06:12 2009
@@ -1,6 +1,7 @@
/* $Id$ */
/*
Copyright (C) 2003 - 2009 by David White <[email protected]>
+ Copyright (C) 2009 by Ignacio R. Morelle <[email protected]>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify
@@ -12,14 +13,23 @@
See the COPYING file for more details.
*/
-/** @file intro.hpp */
+/** @file storyscreen.hpp */
+// FIXME: textscreen.[ch]pp ??
-#ifndef INTRO_HPP_INCLUDED
-#define INTRO_HPP_INCLUDED
+// This code is work in progress, and shouldn't be enabled for production
+// builds. It is supposed to completely replace the old story screens code
+// at intro.cpp, introducing new WML conventions while at it.
+//
+// Do not remove the #ifdef below.
+#ifdef SHADOWM_STORYSCREEN
+
+#ifndef STORYSCREEN_HPP_INCLUDED
+#define STORYSCREEN_HPP_INCLUDED
class config;
class vconfig;
class display;
+class t_string;
#include "SDL.h"
#include <string>
@@ -39,7 +49,7 @@
* be displayed in turn, with the user able to go to the next part, or skip
* it entirely.
*/
-void show_intro(display &disp, const vconfig& data, const config& level);
+void show_storyscreen(display& disp, const vconfig& data, const config&
scenario_cfg);
/**
* Displays a simple fading screen with any user-provided text.
@@ -50,6 +60,8 @@
* @param duration In milliseconds, for how much time the text will
* be displayed on screen.
*/
-void the_end(display &disp, std::string text, unsigned int duration);
+void show_endscreen(display& disp, const t_string& text, unsigned int
duration);
-#endif
+#endif /* ! STORYSCREEN_HPP_INCLUDED */
+
+#endif /* SHADOWM_STORYSCREEN */
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits