Reform the dialog special node types.

- Any picture type is now possible; the nodes split by picture type alone were merged
- Town portal now honours your chosen picture. Town stairway also allows you to choose.
- The two one-shot dialogs now use msg3 where they previously used msg2; this is to make way for later expansion
This commit is contained in:
2014-12-26 23:04:09 -05:00
parent 131093f1bc
commit 57a0e728bb
6 changed files with 85 additions and 88 deletions

View File

@@ -2399,37 +2399,28 @@ void oneshot_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
check_mess = false;
break;
case eSpecType::ONCE_DIALOG:
case eSpecType::ONCE_DIALOG_TERRAIN:
case eSpecType::ONCE_DIALOG_MONSTER:
check_mess = false;
if(spec.m1 < 0)
break;
for(i = 0; i < 3; i++)
get_strs(strs[i * 2],strs[i * 2 + 1],cur_spec_type, spec.m1 + i * 2,spec.m1 + i * 2 + 1);
if(spec.m2 > 0) {
if(spec.m3 > 0) {
buttons[0] = 1;
buttons[1] = spec.ex1a;
buttons[2] = spec.ex2a;
if((spec.ex1a >= 0) || (spec.ex2a >= 0))
buttons[0] = 20;
}
if(spec.m2 <= 0) {buttons[0] = spec.ex1a;buttons[1] = spec.ex2a;}
if(spec.m3 <= 0) {
buttons[0] = spec.ex1a;
buttons[1] = spec.ex2a;
}
if((buttons[0] < 0) && (buttons[1] < 0)) {
giveError("Dialog box ended up with no buttons.");
break;
}
switch(cur_node.type) {
case eSpecType::ONCE_DIALOG:
if(spec.pic >= 1000) i = custom_choice_dialog(strs,spec.pic % 1000, PIC_CUSTOM_DLOG,buttons) ;
else i = custom_choice_dialog(strs,spec.pic, PIC_DLOG,buttons) ; break;
case eSpecType::ONCE_DIALOG_TERRAIN:
if(spec.pic >= 1000) i = custom_choice_dialog(strs,spec.pic % 1000, PIC_CUSTOM_TER,buttons) ;
else i = custom_choice_dialog(strs,spec.pic,PIC_TER,buttons) ; break;
case eSpecType::ONCE_DIALOG_MONSTER:
if(spec.pic >= 1000) i = custom_choice_dialog(strs,spec.pic % 1000, PIC_CUSTOM_MONST,buttons) ;
else i = custom_choice_dialog(strs,spec.pic, get_monst_pictype(spec.pic),buttons) ; break;
}
if(spec.m2 > 0) {
i = custom_choice_dialog(strs, spec.pic, ePicType(spec.pictype), buttons);
if(spec.m3 > 0) {
if(i == 1) {
if((spec.ex1a >= 0) || (spec.ex2a >= 0)) {
set_sd = false;
@@ -2444,26 +2435,13 @@ void oneshot_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
}
break;
case eSpecType::ONCE_GIVE_ITEM_DIALOG:
case eSpecType::ONCE_GIVE_ITEM_TERRAIN:
case eSpecType::ONCE_GIVE_ITEM_MONSTER:
check_mess = false;
if(spec.m1 < 0)
break;
for(i = 0; i < 3; i++)
get_strs(strs[i * 2],strs[i * 2 + 1],cur_spec_type, spec.m1 + i * 2,spec.m1 + i * 2 + 1);
buttons[0] = 20; buttons[1] = 19;
//i = custom_choice_dialog(strs,spec.pic,buttons) ;
switch(cur_node.type) {
case eSpecType::ONCE_GIVE_ITEM_DIALOG:
if(spec.pic >= 1000) i = custom_choice_dialog(strs,spec.pic % 1000,PIC_CUSTOM_DLOG,buttons) ;
else i = custom_choice_dialog(strs,spec.pic,PIC_DLOG,buttons) ; break;
case eSpecType::ONCE_GIVE_ITEM_TERRAIN:
if(spec.pic >= 1000) i = custom_choice_dialog(strs,spec.pic % 1000,PIC_CUSTOM_TER,buttons) ;
else i = custom_choice_dialog(strs,spec.pic,PIC_TER,buttons) ; break;
case eSpecType::ONCE_GIVE_ITEM_MONSTER:
if(spec.pic >= 1000) i = custom_choice_dialog(strs,spec.pic % 1000,PIC_CUSTOM_MONST,buttons) ;
else i = custom_choice_dialog(strs,spec.pic,get_monst_pictype(spec.pic),buttons) ; break;
}
i = custom_choice_dialog(strs, spec.pic, ePicType(spec.pictype), buttons);
if(i == 1) {set_sd = false; *next_spec = -1;}
else {
store_i = get_stored_item(spec.ex1a);
@@ -2473,10 +2451,10 @@ void oneshot_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
else {
give_gold(spec.ex1b,true);
give_food(spec.ex2a,true);
if((spec.m2 >= 0) && (spec.m2 < 50)) {
if(univ.party.spec_items[spec.m2] == 0)
if((spec.m3 >= 0) && (spec.m3 < 50)) {
if(univ.party.spec_items[spec.m3] == 0)
ASB("You get a special item.");
univ.party.spec_items[spec.m2] = 1;
univ.party.spec_items[spec.m3] = 1;
*redraw = true;
if(stat_window == 6)
set_stat_window(6);
@@ -3600,8 +3578,7 @@ void townmode_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
for(i = 0; i < 3; i++)
get_strs(strs[i * 2],strs[i * 2 + 1],cur_spec_type, spec.m1 + i * 2 ,spec.m1 + i * 2 + 1);
buttons[0] = 9; buttons[1] = 35;
// TODO: Handle custom pictures?
i = custom_choice_dialog(strs,spec.pic,PIC_TER,buttons);
i = custom_choice_dialog(strs, spec.pic, ePicType(spec.pictype), buttons);
if(i == 1) {*next_spec = -1;}
else {
ter = coord_to_ter(store_special_loc.x,store_special_loc.y);
@@ -3632,8 +3609,7 @@ void townmode_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
for(i = 0; i < 3; i++)
get_strs(strs[i * 2],strs[i * 2 + 1], cur_spec_type,spec.m1 + i * 2, spec.m1 + i * 2 + 1);
buttons[0] = 9; buttons[1] = 8;
// TODO: Wait, wait, aren't you supposed to be able to pick which picture to show?
i = custom_choice_dialog(strs,22,PIC_DLOG,buttons);
i = custom_choice_dialog(strs, spec.pic, ePicType(spec.pictype), buttons);
if(i == 1) {
*next_spec = -1;
if(which_mode == eSpecCtx::OUT_MOVE || which_mode == eSpecCtx::TOWN_MOVE || which_mode == eSpecCtx::COMBAT_MOVE)
@@ -3673,8 +3649,7 @@ void townmode_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
}
if(spec.ex2b == 1)
i = 2;
// TODO: Wait, wait, don't you get to choose the picture to show?
else i = custom_choice_dialog(strs,19,PIC_DLOG,buttons) ;
else i = custom_choice_dialog(strs, spec.pic, ePicType(spec.pictype), buttons);
*a = 1;
if(i == 1) {
*next_spec = -1;

View File

@@ -609,11 +609,11 @@ enum class eSpecType {
ONCE_SET_SDF = 53,
ONCE_DISPLAY_MSG = 54,
ONCE_DIALOG = 55,
ONCE_DIALOG_TERRAIN = 56,
ONCE_DIALOG_MONSTER = 57,
UNUSED13 = 56,
UNUSED14 = 57,
ONCE_GIVE_ITEM_DIALOG = 58,
ONCE_GIVE_ITEM_TERRAIN = 59,
ONCE_GIVE_ITEM_MONSTER = 60,
UNUSED15 = 59,
UNUSED16 = 60,
ONCE_OUT_ENCOUNTER = 61,
ONCE_TOWN_ENCOUNTER = 62,
ONCE_TRAP = 63,

View File

@@ -48,9 +48,30 @@ void cSpecial::append(legacy::special_node_type& old){
switch(old.type) {
case 55: case 58: case 189: // Large dialogs with 36x36 dialog graphics
pic -= 700;
pictype = PIC_DLOG;
m3 = m2;
m2 = -1;
break;
case 57: case 60: // Large dialogs with monster graphics
pic -= 400;
pictype = PIC_MONST;
m3 = m2;
m2 = -1;
if(old.type == 57) type = eSpecType::ONCE_DIALOG;
else if(old.type == 60) type = eSpecType::ONCE_GIVE_ITEM_DIALOG;
break;
case 56: case 59: case 188: // Large dialogs with terrain graphics
pictype = PIC_TER;
m3 = m2;
m2 = -1;
if(old.type == 56) type = eSpecType::ONCE_DIALOG;
else if(old.type == 59) type = eSpecType::ONCE_GIVE_ITEM_DIALOG;
break;
case 190: // Large stairway dialog
pic = 19;
pictype = PIC_DLOG;
m3 = m2;
m2 = -1;
break;
// TODO: Originally the block nodes supported messages; the new version doesn't.
// (Will probably need to make special nodes a dynamic vector before fixing this.)
@@ -193,7 +214,7 @@ std::istream& operator >> (std::istream& in, eSpecType& e) {
// m - Create/Edit button to edit message pair (covers msg1 and msg2 together)
// M - Create/Edit button to edit single message
// $ - As above, but always a scenario message
// d - Create/Edit button to edit dialog message sequence
// d - Create/Edit button to edit dialog message sequence (covers msg1 and msg2 together)
// b - Choose button to select a button label
// p - Choose button to select a picture (uses pictype for type)
// ? - Choose button to select a picture type
@@ -242,10 +263,10 @@ static const char*const button_dict[7][11] = {
" ", // ex2c
}, { // one-shot nodes
"mm mddddddmmm", // msg1
" III ", // msg2
" ", // msg3
" ", // msg2
" III ", // msg3
" pppppp ", // pic
" ", // pictype
" ?????? ", // pictype
"iI bbbiii X", // ex1a
" sss ", // ex1b
" ", // ex1c
@@ -280,8 +301,8 @@ static const char*const button_dict[7][11] = {
"mmmmmmmmmmmmmmm dddmmmmmmm", // msg1
" ", // msg2
" ", // msg3
" pp ", // pic
" ", // pictype
" ppp ", // pic
" ??? ", // pictype
" c L ", // ex1a
" s s s s @", // ex1b
" ", // ex1c

View File

@@ -599,7 +599,7 @@ static bool edit_spec_enc_value(cDialog& me, std::string item_hit, node_stack_t&
else if(field == "msg2") btn = (*type).m2_btn;
else if(field == "msg3") btn = (*type).m3_btn;
else if(field == "pict") btn = (*type).p_btn;
else if(field == "picttype") btn = (*type).pt_btn;
else if(field == "pictype") btn = (*type).pt_btn;
else if(field == "x1a") btn = (*type).x1a_btn;
else if(field == "x1b") btn = (*type).x1b_btn;
else if(field == "x1c") btn = (*type).x1c_btn;
@@ -669,6 +669,7 @@ static bool edit_spec_enc_value(cDialog& me, std::string item_hit, node_stack_t&
choose_string = false;
if(pictype < 0) me["pictype"].setTextToNum(PIC_DLOG);
store = choose_graphic(val, pictype < 0 ? PIC_DLOG : ePicType(pictype), &me);
if(store < 0) store = val;
break;
case 'f': case 'F': choose_string = false; store = choose_field_type(val, &me, btn == 'F'); break;
case 'D': choose_string = false; store = choose_damage_type(val, &me); break;
@@ -685,7 +686,7 @@ static bool edit_spec_enc_value(cDialog& me, std::string item_hit, node_stack_t&
case 'Q': strt = STRT_RACE; title = "Which species?"; break;
case 'T': strt = STRT_TOWN; title = "Which town?"; break;
case 'b': strt = STRT_BUTTON; title = "Which button?"; break;
case '?': strt = STRT_PICT; title = "Which picture type?"; break;
case '?': strt = STRT_PICT; title = "Which picture type?"; str_adj = -1; break;
case 'x': strt = STRT_SND; title = "Which sound?"; break;
case 'X': strt = STRT_TRAP; title = "What trap type?"; break;
case '=': strt = STRT_CMP; title = "What comparison method?"; str_adj = 2; break;
@@ -709,7 +710,7 @@ static bool edit_spec_enc_value(cDialog& me, std::string item_hit, node_stack_t&
break;
}
if(choose_string)
store = choose_text(strt, val, &me, title) - str_adj;
store = choose_text(strt, val + str_adj, &me, title) - str_adj;
me[field].setTextToNum(store);
return true;
}