Split "if looking", "if in boat", "if on horse" into separate special node types rather than filing them under "if context"

This commit is contained in:
2015-01-26 22:50:16 -05:00
parent 672b416644
commit 12d1760fd3
8 changed files with 103 additions and 149 deletions

View File

@@ -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
Being attacked at range

View File

@@ -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

View File

@@ -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
--------------------

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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
}
};