From 3d7fcbd60ef210421669fe01a784799113ac04dc Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Sat, 17 Jan 2015 02:59:34 -0500 Subject: [PATCH] New special node to initiate conversation (should even work outdoors) --- rsrc/strings/specials-opcodes.txt | 2 +- rsrc/strings/specials-text-general.txt | 18 +++++++++++++++++- src/boe.dlgutil.cpp | 22 ++++++++++++---------- src/boe.specials.cpp | 9 +++++++-- src/classes/monster.cpp | 15 ++------------- src/classes/monster.h | 1 - src/classes/simpletypes.h | 3 ++- src/classes/special.cpp | 22 +++++++++++----------- src/scenedit/scen.actions.cpp | 2 -- 9 files changed, 52 insertions(+), 42 deletions(-) diff --git a/rsrc/strings/specials-opcodes.txt b/rsrc/strings/specials-opcodes.txt index c7b0e0e8..fcb4d87f 100644 --- a/rsrc/strings/specials-opcodes.txt +++ b/rsrc/strings/specials-opcodes.txt @@ -41,7 +41,7 @@ append-monst append-item append-ter pause - +start-talk diff --git a/rsrc/strings/specials-text-general.txt b/rsrc/strings/specials-text-general.txt index 1c93ce72..5aa5d63d 100644 --- a/rsrc/strings/specials-text-general.txt +++ b/rsrc/strings/specials-text-general.txt @@ -76,7 +76,7 @@ Unused Number of items in store (1 .. 40) Cost adjust (0 .. 6, lower = cheaper) Unused -Special to Jump To +Unused -------------------- Display Small Message Unused @@ -702,6 +702,22 @@ Unused Unused Special to Jump To -------------------- +Start Conversation +Unused +Unused +Unused +Unused +Unused +Facial Picture +Unused +Personality +Unused +Unused +Unused +Unused +Unused +Unused +-------------------- Special Name sdf1 sdf2 diff --git a/src/boe.dlgutil.cpp b/src/boe.dlgutil.cpp index eab2e403..0904de54 100644 --- a/src/boe.dlgutil.cpp +++ b/src/boe.dlgutil.cpp @@ -677,9 +677,7 @@ void handle_talk_event(location p) { strnum1 = -1; return; case eTalkNode::BUY_HEALING: - // TODO: extra1 and extra2 are actually never used! So remove them. - start_shop_mode(eShopType::HEALING,univ.town.monst[store_m_num].extra1, - univ.town.monst[store_m_num].extra2,a,save_talk_str1.c_str()); + start_shop_mode(eShopType::HEALING,0,0,a,save_talk_str1.c_str()); strnum1 = -1; return; break; @@ -834,8 +832,10 @@ void handle_talk_event(location p) { talk_end_forced = true; break; case eTalkNode::END_FIGHT: - univ.town.monst[store_m_num].attitude = 1; - univ.town.monst[store_m_num].mobility = 1; + if(store_m_num >= 0 && store_m_num <= univ.town->max_monst()) { + univ.town.monst[store_m_num].attitude = 1; + univ.town.monst[store_m_num].mobility = 1; + } talk_end_forced = true; break; case eTalkNode::END_ALARM: @@ -843,11 +843,13 @@ void handle_talk_event(location p) { talk_end_forced = true; break; case eTalkNode::END_DIE: - // TODO: Any reason not to call something like kill_monst? - univ.town.monst[store_m_num].active = 0; - // Special killing effects - if(sd_legit(univ.town.monst[store_m_num].spec1,univ.town.monst[store_m_num].spec2)) - PSD[univ.town.monst[store_m_num].spec1][univ.town.monst[store_m_num].spec2] = 1; + if(store_m_num >= 0 && store_m_num <= univ.town->max_monst()) { + // TODO: Any reason not to call something like kill_monst? + univ.town.monst[store_m_num].active = 0; + // Special killing effects + if(sd_legit(univ.town.monst[store_m_num].spec1,univ.town.monst[store_m_num].spec2)) + PSD[univ.town.monst[store_m_num].spec1][univ.town.monst[store_m_num].spec2] = 1; + } talk_end_forced = true; break; // TODO: Strings resulting from this don't seem to be recordable; whyever not? diff --git a/src/boe.specials.cpp b/src/boe.specials.cpp index 2dc15cf1..f6eaa4eb 100644 --- a/src/boe.specials.cpp +++ b/src/boe.specials.cpp @@ -1538,8 +1538,6 @@ bool damage_monst(short which_m, short who_hit, short how_much, short how_much_s univ.town.monst[which_spot].start_loc = victim->start_loc; univ.town.monst[which_spot].mobility = victim->mobility; univ.town.monst[which_spot].time_flag = victim->time_flag; - univ.town.monst[which_spot].extra1 = victim->extra1; - univ.town.monst[which_spot].extra2 = victim->extra2; univ.town.monst[which_spot].spec1 = victim->spec1; univ.town.monst[which_spot].spec2 = victim->spec2; univ.town.monst[which_spot].spec_enc_code = victim->spec_enc_code; @@ -2406,6 +2404,13 @@ void general_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, redraw_screen(REFRESH_TERRAIN | REFRESH_STATS); sf::sleep(sf::milliseconds(spec.ex1a)); break; + case eSpecType::START_TALK: + i = current_pc_picked_in_spec_enc; + if(i >= 100) i -= 100; + else i = -1; + start_talk_mode(i, spec.ex1a, spec.ex1b, spec.pic); + *next_spec = -1; + break; } if(check_mess) { handle_message(which_mode,cur_spec_type,cur_node.m1,cur_node.m2,a,b); diff --git a/src/classes/monster.cpp b/src/classes/monster.cpp index 7c87f619..cb98f311 100644 --- a/src/classes/monster.cpp +++ b/src/classes/monster.cpp @@ -375,7 +375,7 @@ cCreature::cCreature(){ id = number = active = attitude = start_attitude = 0; start_loc.x = start_loc.y = cur_loc.x = cur_loc.y = targ_loc.x = targ_loc.y = 80; mobility = 1; - time_flag = summoned = extra1 = extra2 = 0; + time_flag = summoned = 0; spec1 = spec2 = spec_enc_code = time_code = monster_time = 0; personality = special_on_kill = facial_pic = -1; target = 6; @@ -392,8 +392,6 @@ void cCreature::append(legacy::creature_start_type old){ start_loc.y = old.start_loc.y; mobility = old.mobile; time_flag = old.time_flag; - extra1 = old.extra1; - extra2 = old.extra2; spec1 = old.spec1; spec2 = old.spec2; spec_enc_code = old.spec_enc_code; @@ -419,8 +417,6 @@ void cCreature::append(legacy::creature_data_type old){ start_loc.y = old.monst_start.start_loc.y; mobility = old.monst_start.mobile; time_flag = old.monst_start.time_flag; - extra1 = old.monst_start.extra1; - extra2 = old.monst_start.extra2; spec1 = old.monst_start.spec1; spec2 = old.monst_start.spec2; spec_enc_code = old.monst_start.spec_enc_code; @@ -931,8 +927,6 @@ void cCreature::writeTo(std::ostream& file) const { file << "MOBILITY " << unsigned(mobility) << '\n'; file << "TIMEFLAG " << unsigned(time_flag) << '\n'; file << "SUMMONED " << summoned << '\n'; - // TODO: Don't remember what these do - file << "EXTRA " << unsigned(extra1) << ' ' << unsigned(extra2) << '\n'; file << "SPEC " << spec1 << ' ' << spec2 << '\n'; file << "SPECCODE " << int(spec_enc_code) << '\n'; file << "TIMECODE " << int(time_code) << '\n'; @@ -981,12 +975,7 @@ void cCreature::readFrom(std::istream& file) { time_flag = i; } else if(cur == "SUMMONED") line >> summoned; - else if(cur == "EXTRA") { - unsigned int i,j; - line >> i >> j; - extra1 = i; - extra2 = j; - } else if(cur == "SPEC") + else if(cur == "SPEC") line >> spec1 >> spec2; else if(cur == "SPECCODE") { int i; diff --git a/src/classes/monster.h b/src/classes/monster.h index 5f41cea8..d00f0734 100644 --- a/src/classes/monster.h +++ b/src/classes/monster.h @@ -164,7 +164,6 @@ public: unsigned short mobility; unsigned char time_flag; short summoned; - unsigned char extra1, extra2; short spec1, spec2; char spec_enc_code, time_code; short monster_time, personality; diff --git a/src/classes/simpletypes.h b/src/classes/simpletypes.h index f33520e4..0016b9fb 100644 --- a/src/classes/simpletypes.h +++ b/src/classes/simpletypes.h @@ -545,6 +545,7 @@ enum class eSpecType { APPEND_ITEM = 41, APPEND_TER = 42, PAUSE = 43, + START_TALK = 44, ONCE_GIVE_ITEM = 50, ONCE_GIVE_SPEC_ITEM = 51, ONCE_NULL = 52, @@ -668,7 +669,7 @@ enum class eSpecCat { inline eSpecCat getNodeCategory(eSpecType node) { int code = (int) node; - if(code >= 0 && code <= 43) + if(code >= 0 && code <= 44) return eSpecCat::GENERAL; if(code >= 50 && code <= 63) return eSpecCat::ONCE; diff --git a/src/classes/special.cpp b/src/classes/special.cpp index 87fb13e0..e2fb7fed 100644 --- a/src/classes/special.cpp +++ b/src/classes/special.cpp @@ -379,17 +379,17 @@ std::istream& operator >> (std::istream& in, eSpecType& e) { // (terrain, monster, dialog, talk, item, pc, field, boom, missile, status) static const char*const button_dict[7][11] = { { // general nodes - " mmmMMmmmm mmm mmmmmm Mmm $ mmmmmm ", // msg1 - " ", // msg2 - " ", // msg3 - " ", // pic - " ", // pictype - " # x T i M cit ", // ex1a - " & S ss ", // ex1b - " ", // ex1c - " tt ", // ex2a - " % t ", // ex2b - " ", // ex2c + " mmmMMmmmm mmm mmmmmm Mmm $ mmmmmm ", // msg1 + " ", // msg2 + " ", // msg3 + " 3", // pic + " ", // pictype + " # x T i M cit ", // ex1a + " & S ss c", // ex1b + " ", // ex1c + " tt ", // ex2a + " % t ", // ex2b + " ", // ex2c }, { // one-shot nodes "mm mddddddmmm", // msg1 " ", // msg2 diff --git a/src/scenedit/scen.actions.cpp b/src/scenedit/scen.actions.cpp index 3e259ef6..91312cd9 100644 --- a/src/scenedit/scen.actions.cpp +++ b/src/scenedit/scen.actions.cpp @@ -607,8 +607,6 @@ bool handle_action(location the_point,sf::Event /*event*/) { scenario.scen_monsters[mode_count].default_attitude; town->creatures(i).mobility = 1; town->creatures(i).time_flag = 0; - town->creatures(i).extra1 = 0; - town->creatures(i).extra2 = 0; town->creatures(i).spec1 = -1; town->creatures(i).spec2 = -1; town->creatures(i).spec_enc_code = 0;