Add a Swap Buffer node, giving you an infinite number of string variables

- Also fix the string buffer so that it actually works.
- Also add a node to change the text of a sign
This commit is contained in:
2015-06-23 20:17:06 -04:00
parent 8b2f2bee45
commit cb14a9c5d7
6 changed files with 65 additions and 15 deletions

View File

@@ -43,8 +43,8 @@ append-ter
pause pause
start-talk start-talk
quest quest
swap-buf
sign-buf
once-give-item once-give-item

View File

@@ -734,6 +734,38 @@ Unused
Unused Unused
Special to Jump To Special to Jump To
-------------------- --------------------
Swap String Buffer
Unused
Unused
First part of message
Second part of message
Unused
Unused
Unused
Which string buffer?
Unused
Unused
Unused
Unused
Unused
Special to Jump To
--------------------
Alter Sign Text
Unused
Unused
First part of message
Second part of message
Unused
Unused
Unused
Which sign?
Unused
Unused
Unused
Unused
Unused
Special to Jump To
--------------------
Special Name Special Name
sdf1 sdf1
sdf2 sdf2

View File

@@ -2410,6 +2410,19 @@ void general_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
case eSpecType::APPEND_TER: case eSpecType::APPEND_TER:
univ.get_buf() += univ.scenario.ter_types[spec.ex1a].name; univ.get_buf() += univ.scenario.ter_types[spec.ex1a].name;
break; break;
case eSpecType::SWAP_STR_BUF:
univ.swap_buf(spec.ex1a);
break;
case eSpecType::STR_BUF_TO_SIGN:
if(spec.ex1a < 0) break;
if(is_out()) {
if(spec.ex1a >= univ.out->sign_locs.size()) break;
std::swap(univ.out->sign_locs[spec.ex1a].text, univ.get_buf());
} else {
if(spec.ex1a >= univ.town->sign_locs.size()) break;
std::swap(univ.town->sign_locs[spec.ex1a].text, univ.get_buf());
}
break;
case eSpecType::PAUSE: case eSpecType::PAUSE:
if(spec.ex1a < 0) break; if(spec.ex1a < 0) break;
redraw_screen(REFRESH_TERRAIN | REFRESH_STATS); redraw_screen(REFRESH_TERRAIN | REFRESH_STATS);

View File

@@ -614,6 +614,8 @@ enum class eSpecType {
PAUSE = 43, PAUSE = 43,
START_TALK = 44, START_TALK = 44,
UPDATE_QUEST = 45, UPDATE_QUEST = 45,
SWAP_STR_BUF = 46,
STR_BUF_TO_SIGN = 47,
ONCE_GIVE_ITEM = 50, ONCE_GIVE_ITEM = 50,
ONCE_GIVE_SPEC_ITEM = 51, ONCE_GIVE_SPEC_ITEM = 51,
ONCE_NULL = 52, ONCE_NULL = 52,
@@ -744,7 +746,7 @@ enum class eSpecCat {
inline eSpecCat getNodeCategory(eSpecType node) { inline eSpecCat getNodeCategory(eSpecType node) {
int code = (int) node; int code = (int) node;
if(code >= 0 && code <= 45) if(code >= 0 && code <= 47)
return eSpecCat::GENERAL; return eSpecCat::GENERAL;
if(code >= 50 && code <= 63) if(code >= 50 && code <= 63)
return eSpecCat::ONCE; return eSpecCat::ONCE;

View File

@@ -387,17 +387,17 @@ void cSpecial::append(legacy::special_node_type& old){
// (terrain, monster, dialog, talk, item, pc, field, boom, missile, status) // (terrain, monster, dialog, talk, item, pc, field, boom, missile, status)
static const char*const button_dict[7][11] = { static const char*const button_dict[7][11] = {
{ // general nodes { // general nodes
" mmmMmmmmmMmmm mmmmmm Mmm $ mmmmmm m", // msg1 " mmmMmmmmmMmmm mmmmmm Mmm $ mmmmmm mmm", // msg1
" ", // msg2 " ", // msg2
" ", // msg3 " ", // msg3
" p 3 ", // pic " p 3 ", // pic
" ? ", // pictype " ? ", // pictype
" & x T i M cit j", // ex1a " & x T i M cit j ", // ex1a
" % S ss cJ", // ex1b " % S ss cJ ", // ex1b
" ", // ex1c " ", // ex1c
" tt ", // ex2a " tt ", // ex2a
" t ", // ex2b " t ", // ex2b
" ", // ex2c " ", // ex2c
}, { // one-shot nodes }, { // one-shot nodes
"mm md d mmm", // msg1 "mm md d mmm", // msg1
" ", // msg2 " ", // msg2

View File

@@ -158,6 +158,7 @@ class cUniverse{
void check_monst(cMonster& monst); void check_monst(cMonster& monst);
void check_item(cItem& item); void check_item(cItem& item);
std::string strbuf; std::string strbuf;
std::map<int,std::string> extrabufs;
public: public:
void exportSummons(); void exportSummons();
void exportGraphics(); void exportGraphics();
@@ -165,7 +166,9 @@ public:
iLiving& get_target(size_t which); iLiving& get_target(size_t which);
iLiving* target_there(location pos, eTargetType type = TARG_ANY); iLiving* target_there(location pos, eTargetType type = TARG_ANY);
size_t get_target_i(iLiving& who); size_t get_target_i(iLiving& who);
std::string get_buf() {return strbuf;}
std::string& get_buf() {return strbuf;}
void swap_buf(int newbuf) {std::swap(strbuf, extrabufs[newbuf]);}
cScenario scenario; cScenario scenario;
cParty party; cParty party;