Accept [story] as ActionWML
This commit is contained in:
parent
a7cacfb77f
commit
efb0fe05e9
7 changed files with 33 additions and 14 deletions
|
@ -39,6 +39,7 @@ Version 1.13.7+dev:
|
||||||
comparable with == or ~=
|
comparable with == or ~=
|
||||||
* wesnoth.set_music is now deprecated, in favour of the above new API
|
* wesnoth.set_music is now deprecated, in favour of the above new API
|
||||||
* New wesnoth.sound_volume function gets/sets the current sound volume, as [volume]sound=
|
* New wesnoth.sound_volume function gets/sets the current sound volume, as [volume]sound=
|
||||||
|
* New wesnoth.show_story function launches the storyscreen viewer
|
||||||
* Multiplayer:
|
* Multiplayer:
|
||||||
* Fixed statistics being lost when reloading an MP game.
|
* Fixed statistics being lost when reloading an MP game.
|
||||||
* Performance:
|
* Performance:
|
||||||
|
@ -71,6 +72,7 @@ Version 1.13.7+dev:
|
||||||
* [kill]animate=yes now plays victory animations if applicable
|
* [kill]animate=yes now plays victory animations if applicable
|
||||||
* Fix [volume] not accepting 100% as the new volume.
|
* Fix [volume] not accepting 100% as the new volume.
|
||||||
* New concat_to_* keys in unit_type inheritance allow amending keys
|
* New concat_to_* keys in unit_type inheritance allow amending keys
|
||||||
|
* Accept [story] as ActionWML in events
|
||||||
* Miscellaneous and bug fixes:
|
* Miscellaneous and bug fixes:
|
||||||
* Fixed base animation showing on walking corpse & soulless bats (bug #25673)
|
* Fixed base animation showing on walking corpse & soulless bats (bug #25673)
|
||||||
|
|
||||||
|
|
|
@ -1523,6 +1523,10 @@ function wesnoth.wml_actions.zoom(cfg)
|
||||||
wesnoth.zoom(cfg.factor, cfg.relative)
|
wesnoth.zoom(cfg.factor, cfg.relative)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function wesnoth.wml_actions.story(cfg)
|
||||||
|
wesnoth.show_story(cfg, cfg.title)
|
||||||
|
end
|
||||||
|
|
||||||
function wesnoth.wml_conditionals.proceed_to_next_scenario(cfg)
|
function wesnoth.wml_conditionals.proceed_to_next_scenario(cfg)
|
||||||
local endlevel_data = wesnoth.get_end_level_data()
|
local endlevel_data = wesnoth.get_end_level_data()
|
||||||
if not endlevel_data then
|
if not endlevel_data then
|
||||||
|
|
|
@ -36,20 +36,9 @@ public:
|
||||||
|
|
||||||
~story_viewer();
|
~story_viewer();
|
||||||
|
|
||||||
static void display(const std::string& scenario_name, const config::const_child_itors& story, CVideo& video)
|
static void display(const std::string& scenario_name, const config& story, CVideo& video)
|
||||||
{
|
{
|
||||||
// Combine all the [story] tags into a single config. Handle this here since
|
story_viewer(scenario_name, story).show(video);
|
||||||
// storyscreen::controller doesn't have a default constructor.
|
|
||||||
config cfg;
|
|
||||||
for(const auto& iter : story) {
|
|
||||||
cfg.append_children(iter);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(cfg.empty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
story_viewer(scenario_name, cfg).show(video);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -235,7 +235,16 @@ LEVEL_RESULT playsingle_controller::play_scenario(const config& level)
|
||||||
sound::commit_music_changes();
|
sound::commit_music_changes();
|
||||||
|
|
||||||
if(!this->is_skipping_replay()) {
|
if(!this->is_skipping_replay()) {
|
||||||
gui2::dialogs::story_viewer::display(get_scenario_name(), level.child_range("story"), gui_->video());
|
// Combine all the [story] tags into a single config. Handle this here since
|
||||||
|
// storyscreen::controller doesn't have a default constructor.
|
||||||
|
config cfg;
|
||||||
|
for(const auto& iter : level.child_range("story")) {
|
||||||
|
cfg.append_children(iter);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!cfg.empty()) {
|
||||||
|
gui2::dialogs::story_viewer::display(get_scenario_name(), cfg, gui_->video());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
gui_->labels().read(level);
|
gui_->labels().read(level);
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "gui/dialogs/gamestate_inspector.hpp"
|
#include "gui/dialogs/gamestate_inspector.hpp"
|
||||||
#include "gui/dialogs/lua_interpreter.hpp"
|
#include "gui/dialogs/lua_interpreter.hpp"
|
||||||
#include "gui/dialogs/wml_message.hpp"
|
#include "gui/dialogs/wml_message.hpp"
|
||||||
|
#include "gui/dialogs/story_viewer.hpp"
|
||||||
#include "gui/dialogs/transient_message.hpp"
|
#include "gui/dialogs/transient_message.hpp"
|
||||||
#include "gui/widgets/clickable_item.hpp"
|
#include "gui/widgets/clickable_item.hpp"
|
||||||
#include "gui/widgets/styled_widget.hpp"
|
#include "gui/widgets/styled_widget.hpp"
|
||||||
|
@ -387,6 +388,18 @@ int show_popup_dialog(lua_State *L, CVideo & video) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a story screen
|
||||||
|
* - Arg 1: The story config
|
||||||
|
* - Arg 2: The default title
|
||||||
|
*/
|
||||||
|
int show_story(lua_State* L, CVideo& video) {
|
||||||
|
config story = luaW_checkconfig(L, 1);
|
||||||
|
std::string title = luaL_checkstring(L, 2);
|
||||||
|
gui2::dialogs::story_viewer::display(title, story, video);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a popup menu at the current mouse position
|
* Displays a popup menu at the current mouse position
|
||||||
* Best used from a [set_menu_item], to show a submenu
|
* Best used from a [set_menu_item], to show a submenu
|
||||||
|
|
|
@ -38,6 +38,7 @@ int show_dialog(lua_State *L, CVideo & video);
|
||||||
int show_message_dialog(lua_State *L, CVideo & video);
|
int show_message_dialog(lua_State *L, CVideo & video);
|
||||||
int show_popup_dialog(lua_State *L, CVideo & video);
|
int show_popup_dialog(lua_State *L, CVideo & video);
|
||||||
int show_menu(lua_State* L, CVideo& video);
|
int show_menu(lua_State* L, CVideo& video);
|
||||||
|
int show_story(lua_State* L, CVideo& video);
|
||||||
int show_lua_console(lua_State*L, CVideo & video, lua_kernel_base * lk);
|
int show_lua_console(lua_State*L, CVideo & video, lua_kernel_base * lk);
|
||||||
int show_gamestate_inspector(CVideo& video, const vconfig& cfg, const game_data& data, const game_state& state);
|
int show_gamestate_inspector(CVideo& video, const vconfig& cfg, const game_data& data, const game_state& state);
|
||||||
int intf_remove_dialog_item(lua_State *L);
|
int intf_remove_dialog_item(lua_State *L);
|
||||||
|
|
|
@ -367,6 +367,7 @@ lua_kernel_base::lua_kernel_base()
|
||||||
{ "show_menu", &video_dispatch<lua_gui2::show_menu> },
|
{ "show_menu", &video_dispatch<lua_gui2::show_menu> },
|
||||||
{ "show_message_dialog", &video_dispatch<lua_gui2::show_message_dialog> },
|
{ "show_message_dialog", &video_dispatch<lua_gui2::show_message_dialog> },
|
||||||
{ "show_popup_dialog", &video_dispatch<lua_gui2::show_popup_dialog> },
|
{ "show_popup_dialog", &video_dispatch<lua_gui2::show_popup_dialog> },
|
||||||
|
{ "show_story", &video_dispatch<lua_gui2::show_story> },
|
||||||
{ "show_lua_console", &dispatch<&lua_kernel_base::intf_show_lua_console> },
|
{ "show_lua_console", &dispatch<&lua_kernel_base::intf_show_lua_console> },
|
||||||
{ "compile_formula", &lua_formula_bridge::intf_compile_formula},
|
{ "compile_formula", &lua_formula_bridge::intf_compile_formula},
|
||||||
{ "eval_formula", &lua_formula_bridge::intf_eval_formula},
|
{ "eval_formula", &lua_formula_bridge::intf_eval_formula},
|
||||||
|
|
Loading…
Add table
Reference in a new issue