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)
132 lines
3.2 KiB
C++
132 lines
3.2 KiB
C++
/*
|
|
* town.h
|
|
* BoE
|
|
*
|
|
* Created by Celtic Minsrel on 22/04/09.
|
|
*
|
|
*/
|
|
|
|
#ifndef BOE_DATA_TOWN_H
|
|
#define BOE_DATA_TOWN_H
|
|
|
|
#include <vector>
|
|
#include <iosfwd>
|
|
#include "simpletypes.h"
|
|
#include "location.h"
|
|
#include "special.h"
|
|
#include "monster.h"
|
|
#include "talking.h"
|
|
|
|
namespace legacy {
|
|
struct town_record_type;
|
|
struct big_tr_type;
|
|
struct ave_tr_type;
|
|
struct tiny_tr_type;
|
|
struct creature_start_type;
|
|
struct wandering_type;
|
|
struct preset_item_type;
|
|
struct preset_field_type;
|
|
};
|
|
|
|
enum eLighting {
|
|
LIGHT_NORMAL = 0,
|
|
LIGHT_DARK = 1,
|
|
LIGHT_DRAINS = 2,
|
|
LIGHT_NONE = 3,
|
|
};
|
|
|
|
class cTown { // formerly town_record_type
|
|
public:
|
|
// class cCreature { // formerly creature_start_type
|
|
// public:
|
|
// unsigned short number;
|
|
// unsigned char start_attitude;
|
|
// location start_loc;
|
|
// unsigned char mobile;
|
|
// unsigned char time_flag;
|
|
// unsigned char extra1,extra2;
|
|
// short spec1, spec2;
|
|
// char spec_enc_code,time_code;
|
|
// short monster_time,personality;
|
|
// short special_on_kill,facial_pic;
|
|
//
|
|
// cCreature& operator = (legacy::creature_start_type old);
|
|
// };
|
|
class cWandering { // formerly wandering_type
|
|
public:
|
|
m_num_t monst[4];
|
|
|
|
bool isNull();
|
|
cWandering& operator = (legacy::wandering_type old);
|
|
};
|
|
class cItem { // formerly preset_item_type
|
|
public:
|
|
location loc;
|
|
short code,ability;
|
|
unsigned char charges,always_there,property,contained;
|
|
|
|
cItem& operator = (legacy::preset_item_type old);
|
|
};
|
|
class cField { // formerly preset_field_type
|
|
public:
|
|
location loc;
|
|
short type;
|
|
|
|
cField& operator = (legacy::preset_field_type old);
|
|
};
|
|
short town_chop_time,town_chop_key;
|
|
cWandering wandering[4];
|
|
location wandering_locs[4];
|
|
location special_locs[50];
|
|
unsigned short spec_id[50];
|
|
location sign_locs[15];
|
|
eLighting lighting_type;
|
|
location start_locs[4];
|
|
location exit_locs[4];
|
|
short exit_specs[4];
|
|
rectangle in_town_rect;
|
|
cItem preset_items[64];
|
|
short max_num_monst;
|
|
std::vector<cField> preset_fields;
|
|
short spec_on_entry,spec_on_entry_if_dead;
|
|
short spec_on_hostile;
|
|
short timer_spec_times[8];
|
|
short timer_specs[8];
|
|
unsigned char strlens[180];
|
|
cSpecial specials[100];
|
|
//unsigned char specials1,specials2,res1,res2;
|
|
bool strong_barriers : 1;
|
|
bool defy_mapping : 1;
|
|
bool defy_scrying : 1;
|
|
char reserved_bits : 5;
|
|
short hostile_fry_party; // number of a special to be called when the town goes hostile TODO: Not sure about this yet though
|
|
short difficulty;
|
|
//char town_strs[180][256];
|
|
char town_name[256];
|
|
char rect_names[16][256];
|
|
char comment[3][256];
|
|
char spec_strs[100][256];
|
|
char sign_strs[20][256];
|
|
__declspec(deprecated) char(& town_strs(short i))[256];
|
|
cSpeech talking;
|
|
|
|
virtual ~cTown(){}
|
|
virtual void append(legacy::big_tr_type& old);
|
|
virtual void append(legacy::ave_tr_type& old);
|
|
virtual void append(legacy::tiny_tr_type& old);
|
|
virtual ter_num_t& terrain(size_t x, size_t y) = 0;
|
|
virtual rectangle& room_rect(size_t i) = 0;
|
|
virtual cCreature& creatures(size_t i) = 0;
|
|
virtual unsigned char& lighting(size_t i, size_t r) = 0;
|
|
virtual short max_dim() = 0;
|
|
virtual short max_monst() = 0;
|
|
virtual short max_items() = 0;
|
|
|
|
cTown();
|
|
cTown(short size);
|
|
cTown& operator = (legacy::town_record_type& old);
|
|
virtual void writeTerrainTo(std::ostream& file) = 0;
|
|
virtual void readTerrainFrom(std::istream& file) = 0;
|
|
};
|
|
|
|
#endif |