Add a lot of stuff scraped from *i's version of the code, plus a couple of additional bits.

Adapted from *i:
- Show a confirm dialog when interrupting a special node sequence
- New monster special ability: call global special node (as an action, not on death)
- New item special ability: call global special node
- Check there's a monster death special before calling it (wasn't necessary before, might be now with the special queue changes)
- Queue specials that are triggered while another special is in progress, instead of ignoring them; they will be run after the current special in progress finishes.
- *i's version of petrification touch is currently active only for monster-on-monster combat; need to merge with my version for monster-on-pc combat.
- Pass party location to special in use special item context
- Fix set town visibility node (was checking wrong field and thus could not hide towns)
Special nodes:
- Town Hostile: change to Set Town Attitude
- Select PC node: option to select random PC
- Affect special nodes can now affect monsters
- Fix affect death node reviving non-existent PCs
- Affect Spells: Can remove spells, and can affect level 1-3 spells
- If Objects: Merged from If Barrels and If Crates
- If Species: Replaces If Cave Lore
- If Trait: Replaces If Woodsman
- If Statistic: Replaces If Enough Mage Lore
- Change Lighting: Can affect town's global lighting setting, player's light level, or both at once.
- Pointers! Actually, I'd already implemented the callbacks for setting and getting them, but they're now actually used, and the implementation has been tweaked a little.
- Campaign flags! Again, I'd already implemented them sorta, but I tweaked things and they ended up sort of halfway between the two implementations. Plus there's now a special node to set them.

Additional bits:
- Special queue now uses an std::queue instead of a basic array.
- Enum for town lighting levels
- Disease touch ability is now honoured for monster-on-monster combat
- See monster special context now passes the monster's location as the trigger location; also, removed the double-trigger from one circumstance.
- Along with the set town attitude change, there's now the possibility for making the town hostile to trigger a special node, which can cause the party to be slain.
- Select PC special node: option to select specific PC
- Spell IDs for use in shops and Affect Spell nodes have changed so that 0 is now the first level 1 spell, and so forth.
- add_string_to_buf can now auto-split the string over multiple lines, and the special node that uses it takes advantage of this
- Special node parser warns if a node type is missing a corresponding opcode
- Reserved "pointers" to access the special node's trigger location (this was *i's idea, but he never implemented it)
This commit is contained in:
2014-12-08 00:58:39 -05:00
parent 0d7ad2c718
commit 5249c6eef7
29 changed files with 796 additions and 193 deletions

View File

@@ -30,6 +30,10 @@ namespace legacy {
struct setup_save_type;
};
struct campaign_flag_type{
unsigned char idx[25][25];
};
class cParty {
public:
class cConvers { // conversation; formerly talk_save_type
@@ -68,6 +72,7 @@ public:
short light_level;
location outdoor_corner;
location i_w_c;
// TODO: Does this duplicate cCurTown::p_loc? If not, why not?
location p_loc;
location loc_in_sec;
cVehicle boats[30];
@@ -106,12 +111,17 @@ public:
std::vector<cMonster> summons; // an array of monsters which can be summoned by the party's items yet don't originate from this scenario
bool graphicUsed[250]; // whether each custom graphics slot on the party's sheet is actually used; needed to place new custom graphics on the sheet.
unsigned short scen_won, scen_played; // numbers of scenarios won and played respectively by this party
std::map<std::string,std::vector<signed short> > campaign_flags;
std::map<short,std::pair<unsigned short,unsigned char> > pointers;
private:
std::map<std::string,campaign_flag_type> campaign_flags;
std::map<unsigned short,std::pair<unsigned short,unsigned char>> pointers;
public:
void set_ptr(short p, unsigned short sdfx, unsigned short sdfy);
void force_ptr(short p, unsigned short sdfx, unsigned short sdfy);
unsigned char get_ptr(short p);
void set_ptr(unsigned short p, unsigned short sdfx, unsigned short sdfy);
void force_ptr(unsigned short p, unsigned short sdfx, unsigned short sdfy);
void clear_ptr(unsigned short p);
unsigned char get_ptr(unsigned short p);
unsigned char& cpn_flag(unsigned int x, unsigned int y, std::string id = "");
cParty& operator = (legacy::party_record_type& old);
void append(legacy::big_tr_type& old);
@@ -142,8 +152,8 @@ public:
typedef std::vector<cJournal>::iterator journalIter;
typedef std::vector<cConvers>::iterator talkIter;
typedef std::vector<cTimer>::iterator timerIter;
typedef std::map<std::string,std::vector<signed short> >::iterator campIter;
typedef std::map<short,std::pair<unsigned short,unsigned char> >::iterator ptrIter;
// TODO: Remove this in favour of cParty constructor
friend void init_party(short);
};
bool operator==(const cParty::cConvers& one, const cParty::cConvers& two);