Merge the XXX_BLOCK and SANCTIFY special nodes into a single, more versatile IS_CONTEXT node

This commit is contained in:
2014-12-07 00:36:10 -05:00
parent 5ec983ef32
commit 46c3c69bd9
5 changed files with 143 additions and 43 deletions

View File

@@ -550,10 +550,10 @@ enum class eSpecType {
SECRET_PASSAGE = 4,
DISPLAY_SM_MSG = 5,
FLIP_SDF = 6,
OUT_BLOCK = 7,
TOWN_BLOCK = 8,
FIGHT_BLOCK = 9,
LOOK_BLOCK = 10,
UNUSED1 = 7, // formerly OUT_BLOCK
UNUSED2 = 8, // formerly TOWN_BLOCK
UNUSED3 = 9, // formerly FIGHT_BLOCK
UNUSED4 = 10, // formerly LOOK_BLOCK
CANT_ENTER = 11,
CHANGE_TIME = 12,
SCEN_TIMER_START = 13,
@@ -567,7 +567,7 @@ enum class eSpecType {
CALL_GLOBAL = 21,
SET_SDF_ROW = 22,
COPY_SDF = 23,
SANCTIFY = 24,
UNUSED6 = 24, // formerly SANCTIFY
REST = 25,
WANDERING_WILL_FIGHT = 26,
END_SCENARIO = 27,
@@ -638,6 +638,7 @@ enum class eSpecType {
IF_ENOUGH_MAGE_LORE = 153,
IF_TEXT_RESPONSE = 154,
IF_SDF_EQ = 155,
IF_CONTEXT = 156,
MAKE_TOWN_HOSTILE = 170,
TOWN_CHANGE_TER = 171,
TOWN_SWAP_TER = 172,
@@ -703,7 +704,7 @@ inline eSpecCat getNodeCategory(eSpecType node) {
return eSpecCat::ONCE;
if(code >= 80 && code <= 106)
return eSpecCat::AFFECT;
if(code >= 130 && code <= 155)
if(code >= 130 && code <= 156)
return eSpecCat::IF_THEN;
if(code >= 170 && code <= 195)
return eSpecCat::TOWN;

View File

@@ -34,12 +34,6 @@ cSpecial& cSpecial::operator = (legacy::special_node_type& old){
sd1 = old.sd1;
sd2 = old.sd2;
pic = old.pic;
// Large dialogs with 36x36 dialog graphics
if(old.type == 55 || old.type == 58 || old.type == 189)
pic -= 700;
// Large dialogs with monster graphics
else if(old.type == 57 || old.type == 60)
pic -= 400;
m1 = old.m1;
m2 = old.m2;
ex1a = old.ex1a;
@@ -47,6 +41,32 @@ cSpecial& cSpecial::operator = (legacy::special_node_type& old){
ex2a = old.ex2a;
ex2b = old.ex2b;
jumpto = old.jumpto;
// Now apply any needed conversions.
switch(old.type) {
case 55: case 58: case 189: // Large dialogs with 36x36 dialog graphics
pic -= 700;
break;
case 57: case 60: // Large dialogs with monster graphics
pic -= 400;
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.)
case 7: case 8: case 9: case 10: // out, town, combat, look block
type = eSpecType::IF_CONTEXT;
ex1b = ex1a;
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;
break;
case 24: // ritual of sanctification
type = eSpecType::IF_CONTEXT;
ex1c = jumpto;
jumpto = ex1b;
ex1a = (int) eSpecCtx::TARGET;
ex1b = 108; // Spell ID for ritual of sanctification, as seen in cast_town_spell()
break;
}
return *this;
}