move custom_choice_dialog into shared code
This commit is contained in:
@@ -579,27 +579,6 @@ bool show_get_items(std::string titleText, std::vector<cItem*>& itemRefs, short
|
||||
|
||||
}
|
||||
|
||||
short custom_choice_dialog(std::array<std::string, 6>& strs,short pic_num,ePicType pic_type,std::array<short, 3>& buttons,bool anim_pict,short anim_loops, int anim_fps) {
|
||||
set_cursor(sword_curs);
|
||||
|
||||
std::vector<std::string> vec(strs.begin(), strs.end());
|
||||
// Strip off trailing empty strings
|
||||
while(!vec.empty() && vec.back().empty())
|
||||
vec.pop_back();
|
||||
cThreeChoice customDialog(vec, buttons, pic_num, pic_type);
|
||||
if(anim_pict)
|
||||
setup_dialog_pict_anim(*(customDialog.operator->()), "pict", anim_loops, anim_fps);
|
||||
|
||||
std::string item_hit = customDialog.show();
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
auto& btn = basic_buttons[buttons[i]];
|
||||
if(item_hit == btn.label)
|
||||
return i + 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void custom_pic_dialog(std::string title, pic_num_t bigpic) {
|
||||
cDialog pic_dlg(*ResMgr::dialogs.get("show-map"));
|
||||
cControl& okay = pic_dlg["okay"];
|
||||
@@ -623,13 +602,6 @@ void custom_pic_dialog(std::string title, pic_num_t bigpic) {
|
||||
pic_dlg.run();
|
||||
}
|
||||
|
||||
void setup_dialog_pict_anim(cDialog& dialog, std::string pict_id, short anim_loops, short anim_fps) {
|
||||
cPict& pict = dynamic_cast<cPict&>(dialog[pict_id]);
|
||||
pict.setAnimLoops(anim_loops);
|
||||
dialog.setAnimPictFPS(anim_fps);
|
||||
dialog.setDoAnimations(true);
|
||||
}
|
||||
|
||||
void story_dialog(std::string title, str_num_t first, str_num_t last, eSpecCtxType which_str_type, pic_num_t pic, ePicType pt, short anim_loops, int anim_fps) {
|
||||
cDialog story_dlg(*ResMgr::dialogs.get("many-str"));
|
||||
dynamic_cast<cPict&>(story_dlg["pict"]).setPict(pic, pt);
|
||||
|
@@ -24,9 +24,7 @@ void make_town_hostile();
|
||||
void set_town_attitude(short lo,short hi,eAttitude att);
|
||||
bool show_get_items(std::string titleText, std::vector<cItem*>& itemRefs, short pc_getting, bool overload = false);
|
||||
bool display_item(location from_loc,short pc_num,short mode, bool check_container);
|
||||
short custom_choice_dialog(std::array<std::string, 6>& strs,short pic_num,ePicType pic_type,std::array<short, 3>& buttons, bool anim_pict = false, short anim_loops = -1, int anim_fps = -1);
|
||||
void custom_pic_dialog(std::string title, pic_num_t bigpic);
|
||||
void setup_dialog_pict_anim(cDialog& dialog, std::string pict_id, short anim_loops, short anim_fps);
|
||||
void story_dialog(std::string title, str_num_t first, str_num_t last, eSpecCtxType which_str_type, pic_num_t pic, ePicType pt, short anim_loops, int anim_fps);
|
||||
short get_num_of_items(short max_num);
|
||||
void init_mini_map();
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include "dialogxml/dialogs/strdlog.hpp"
|
||||
#include "dialogxml/dialogs/choicedlog.hpp"
|
||||
#include "dialogxml/dialogs/pictchoice.hpp"
|
||||
#include "dialogxml/dialogs/3choice.hpp"
|
||||
#include "tools/winutil.hpp"
|
||||
#include "fileio/fileio.hpp"
|
||||
#include "fileio/resmgr/res_dialog.hpp"
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include "boe.main.hpp"
|
||||
#include "dialogxml/dialogs/strdlog.hpp"
|
||||
#include "dialogxml/dialogs/choicedlog.hpp"
|
||||
#include "dialogxml/dialogs/3choice.hpp"
|
||||
#include "fileio/fileio.hpp"
|
||||
#include <array>
|
||||
#include "spell.hpp"
|
||||
|
Reference in New Issue
Block a user