From 12d1760fd39864720cb7cb2fad50907abd00a978 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Mon, 26 Jan 2015 22:50:16 -0500 Subject: [PATCH] Split "if looking", "if in boat", "if on horse" into separate special node types rather than filing them under "if context" --- rsrc/strings/special-contexts.txt | 91 ++------------------------- rsrc/strings/specials-opcodes.txt | 6 +- rsrc/strings/specials-text-ifthen.txt | 40 ++++++++++-- src/boe.specials.cpp | 25 ++++---- src/classes/outdoors.cpp | 4 +- src/classes/regtown.cpp | 12 ++-- src/classes/simpletypes.h | 6 +- src/classes/special.cpp | 68 ++++++++++---------- 8 files changed, 103 insertions(+), 149 deletions(-) diff --git a/rsrc/strings/special-contexts.txt b/rsrc/strings/special-contexts.txt index f632f277..23ad0e72 100644 --- a/rsrc/strings/special-contexts.txt +++ b/rsrc/strings/special-contexts.txt @@ -1,8 +1,8 @@ -Outdoors -Town -Combat - - +Moving (Outdoors) +Moving (Town) +Moving (Combat) +Looking (Outdoors) +Looking (Town/Combat) Entering town Leaving town Talking @@ -21,83 +21,4 @@ Monster using special ability Attacking at melee Being attacked at melee Attacking at range -Being attacked at range - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Looking -In Boat -On Horse \ No newline at end of file +Being attacked at range \ No newline at end of file diff --git a/rsrc/strings/specials-opcodes.txt b/rsrc/strings/specials-opcodes.txt index fcb4d87f..39a5ec21 100644 --- a/rsrc/strings/specials-opcodes.txt +++ b/rsrc/strings/specials-opcodes.txt @@ -143,7 +143,7 @@ if-spell-mage if-spell-priest if-alchemy if-status - +if-look if-day if-field if-party-size @@ -155,8 +155,8 @@ if-response if-sdf-eq if-context if-num-response - - +if-boat +if-horse diff --git a/rsrc/strings/specials-text-ifthen.txt b/rsrc/strings/specials-text-ifthen.txt index dcfc198b..9a38b915 100644 --- a/rsrc/strings/specials-text-ifthen.txt +++ b/rsrc/strings/specials-text-ifthen.txt @@ -254,7 +254,7 @@ Cumulation mode (if whole party selected) Comparison mode Otherwise call this special -------------------- -Unused Node +If Looking? Unused Unused Unused @@ -264,11 +264,11 @@ Unused Unused Unused Unused +If player is looking, call this special ... Unused Unused Unused -Unused -Special to Jump To +Otherwise call this special -------------------- Day Reached? Unused @@ -422,7 +422,7 @@ Unused Unused Unused Unused -Which context (0 .. 24 or 100 .. 102) +Which context (0 .. 24) 0 - can enter, 1 - no enter If context matches, call this special ... Unused @@ -446,3 +446,35 @@ Range upper bound (or comparison method -2 .. 2) If test 2 passes but test 1 fails, call this special ... Otherwise call this special -------------------- +If In Boat? +Unused +Unused +Unused +Unused +Unused +Unused +Unused +Unused +Which boat? (-1 = any boat) +If party in boat, call this special ... +Unused +Unused +Unused +Otherwise call this special +-------------------- +If On Horse? +Unused +Unused +Unused +Unused +Unused +Unused +Unused +Unused +Which horse? (-1 = any horse) +If party on horse, call this special ... +Unused +Unused +Unused +Otherwise call this special +-------------------- \ No newline at end of file diff --git a/src/boe.specials.cpp b/src/boe.specials.cpp index 00ec7842..7da49425 100644 --- a/src/boe.specials.cpp +++ b/src/boe.specials.cpp @@ -3481,22 +3481,21 @@ void ifthen_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, if(which_mode == eSpecCtx::ATTACKED_RANGE) *next_spec = spec.ex1c; break; - // Past here are special values that don't have an equivalent in eSpecCtx. - case 100: // Look (town or out) - if(which_mode == eSpecCtx::OUT_LOOK || which_mode == eSpecCtx::TOWN_LOOK) - *next_spec = spec.ex1c; - break; - case 101: // In boat - if((spec.ex1b == -1 && univ.party.in_boat >= 0) || spec.ex1b == univ.party.in_boat) - *next_spec = spec.ex1c; - break; - case 102: // On horse - if((spec.ex1b == -1 && univ.party.in_horse >= 0) || spec.ex1b == univ.party.in_horse) - *next_spec = spec.ex1c; - break; } if(j >= 0) *a = j; break; + case eSpecType::IF_LOOKING: + if(which_mode == eSpecCtx::OUT_LOOK || which_mode == eSpecCtx::TOWN_LOOK) + *next_spec = spec.ex1c; + break; + case eSpecType::IF_IN_BOAT: + if((spec.ex1b == -1 && univ.party.in_boat >= 0) || spec.ex1b == univ.party.in_boat) + *next_spec = spec.ex1c; + break; + case eSpecType::IF_ON_HORSE: + if((spec.ex1b == -1 && univ.party.in_horse >= 0) || spec.ex1b == univ.party.in_horse) + *next_spec = spec.ex1c; + break; } if(check_mess) { handle_message(which_mode,cur_spec_type,cur_node.m1,cur_node.m2,a,b); diff --git a/src/classes/outdoors.cpp b/src/classes/outdoors.cpp index 09348c09..ac84de6c 100644 --- a/src/classes/outdoors.cpp +++ b/src/classes/outdoors.cpp @@ -80,8 +80,8 @@ void cOutdoors::append(legacy::outdoor_record_type& old){ int found_spec_id = special_id[found_spec], use_slot = unused_special_slots.back(); unused_special_slots.pop_back(); cSpecial& node = specials[use_slot]; - node.type = eSpecType::IF_CONTEXT; - node.ex1a = 101; // if in boat + node.type = eSpecType::IF_IN_BOAT; + node.ex1b = -1; // any boat; node.ex1c = -1; // do nothing node.jumpto = found_spec_id; // else jump here special_id[found_spec] = use_slot; diff --git a/src/classes/regtown.cpp b/src/classes/regtown.cpp index c190d8a1..fee6d91f 100644 --- a/src/classes/regtown.cpp +++ b/src/classes/regtown.cpp @@ -58,8 +58,8 @@ void cTinyTown::append(legacy::tiny_tr_type& old, int town_num){ int found_spec_id = spec_id[found_spec], use_slot = unused_special_slots.back(); unused_special_slots.pop_back(); cSpecial& node = specials[use_slot]; - node.type = eSpecType::IF_CONTEXT; - node.ex1a = 101; // if in boat + node.type = eSpecType::IF_IN_BOAT; + node.ex1b = -1; // any boat; node.ex1c = -1; // do nothing node.jumpto = found_spec_id; // else jump here spec_id[found_spec] = use_slot; @@ -123,8 +123,8 @@ void cMedTown::append(legacy::ave_tr_type& old, int town_num){ int found_spec_id = spec_id[found_spec], use_slot = unused_special_slots.back(); unused_special_slots.pop_back(); cSpecial& node = specials[use_slot]; - node.type = eSpecType::IF_CONTEXT; - node.ex1a = 101; // if in boat + node.type = eSpecType::IF_IN_BOAT; + node.ex1b = -1; // any boat; node.ex1c = -1; // do nothing node.jumpto = found_spec_id; // else jump here spec_id[found_spec] = use_slot; @@ -188,8 +188,8 @@ void cBigTown::append(legacy::big_tr_type& old, int town_numo){ int found_spec_id = spec_id[found_spec], use_slot = unused_special_slots.back(); unused_special_slots.pop_back(); cSpecial& node = specials[use_slot]; - node.type = eSpecType::IF_CONTEXT; - node.ex1a = 101; // if in boat + node.type = eSpecType::IF_IN_BOAT; + node.ex1b = -1; // any boat; node.ex1c = -1; // do nothing node.jumpto = found_spec_id; // else jump here spec_id[found_spec] = use_slot; diff --git a/src/classes/simpletypes.h b/src/classes/simpletypes.h index ea1a01d2..ab4a0211 100644 --- a/src/classes/simpletypes.h +++ b/src/classes/simpletypes.h @@ -622,7 +622,7 @@ enum class eSpecType { IF_PRIEST_SPELL = 143, IF_RECIPE = 144, IF_STATUS = 145, - UNUSED26 = 146, + IF_LOOKING = 146, IF_DAY_REACHED = 147, IF_FIELDS = 148, IF_PARTY_SIZE = 149, @@ -634,6 +634,8 @@ enum class eSpecType { IF_SDF_EQ = 155, IF_CONTEXT = 156, IF_NUM_RESPONSE = 157, + IF_IN_BOAT = 158, + IF_ON_HORSE = 159, MAKE_TOWN_HOSTILE = 170, TOWN_RUN_MISSILE = 171, TOWN_MONST_ATTACK = 172, @@ -695,7 +697,7 @@ inline eSpecCat getNodeCategory(eSpecType node) { return eSpecCat::ONCE; if(code >= 80 && code <= 105) return eSpecCat::AFFECT; - if(code >= 130 && code <= 157) + if(code >= 130 && code <= 159) return eSpecCat::IF_THEN; if(code >= 170 && code <= 199) return eSpecCat::TOWN; diff --git a/src/classes/special.cpp b/src/classes/special.cpp index 229d30a1..d73a3374 100644 --- a/src/classes/special.cpp +++ b/src/classes/special.cpp @@ -93,7 +93,7 @@ void cSpecial::append(legacy::special_node_type& old){ if(old.type == 7) ex1a = (int) eSpecCtx::OUT_MOVE; if(old.type == 8) ex1a = (int) eSpecCtx::TOWN_MOVE; if(old.type == 9) ex1a = (int) eSpecCtx::COMBAT_MOVE; - if(old.type == 10) ex1a = 100; + if(old.type == 10) type = eSpecType::IF_LOOKING; break; case 24: // ritual of sanctification type = eSpecType::IF_CONTEXT; @@ -428,17 +428,17 @@ static const char*const button_dict[7][11] = { " D ", // ex2b " x ", // ex2c }, { // if-then nodes - " f $ $", // msg1 - " s ", // msg2 - " ", // msg3 - " ", // pic - " ", // pictype - " T I w APae Qq $ * ", // ex1a - "ssss sss ssssss s s sssss =", // ex1b - " ss", // ex1c - " t K$ ", // ex2a - "s ss s + s==+s =", // ex2b - " = s", // ex2c + " f $ $ ", // msg1 + " s ", // msg2 + " ", // msg3 + " ", // pic + " ", // pictype + " T I w APae Qq $ * ", // ex1a + "ssss sss ssssss s s sssss = ", // ex1b + " s ssss", // ex1c + " t K$ ", // ex2a + "s ss s + s==+s = ", // ex2b + " = s ", // ex2c }, { // town nodes "mmmmmmmmmmmmmmm dddmmmmmmmmmmmm", // msg1 " ", // msg2 @@ -452,29 +452,29 @@ static const char*const button_dict[7][11] = { " DD / ", // ex2b " x x : : ", // ex2c }, { // rectangle nodes - "mm mmmmmmm", // msg1 - " ", // msg2 - " ", // msg3 - " ", // pic - " ", // pictype - " tt ", // sdf1 - " ", // unused - " ", // ex1c - "F t ", // sdf2 - " ", // unused - " ", // ex2c + "mmmmmmmmm", // msg1 + " ", // msg2 + " ", // msg3 + " ", // pic + " ", // pictype + " tt ", // sdf1 + " ", // unused + " ", // ex1c + "F t ", // sdf2 + " ", // unused + " ", // ex2c }, { // outdoors nodes - " mmM", // msg1 - " ", // msg2 - " ", // msg3 - " ", // pic - " ", // pictype - " #", // ex1a - " &", // ex1b - " ", // ex1c - " ", // ex2a - " %", // ex2b - " ", // ex2c + " mm", // msg1 + " ", // msg2 + " ", // msg3 + " ", // pic + " ", // pictype + " ", // ex1a + " ", // ex1b + " ", // ex1c + " ", // ex2a + " ", // ex2b + " ", // ex2c } };