diff options
126 files changed, 3935 insertions, 3471 deletions
diff --git a/crawl-ref/source/Kills.cc b/crawl-ref/source/Kills.cc index 890d9c3deb..b4446d980a 100644 --- a/crawl-ref/source/Kills.cc +++ b/crawl-ref/source/Kills.cc @@ -12,9 +12,10 @@ #include "chardump.h" #include "describe.h" #include "mon-util.h" +#include "monstuff.h" #include "files.h" #include "itemname.h" -#include "misc.h" +#include "place.h" #include "travel.h" #include "tags.h" #include "Kills.h" @@ -38,6 +39,19 @@ const char *kill_category_names[] = "others", }; +KillMaster::KillMaster() +{ +} + +KillMaster::KillMaster(const KillMaster &other) +{ + *this = other; +} + +KillMaster::~KillMaster() +{ +} + const char *KillMaster::category_name(kill_category kc) const { if (kc >= KC_YOU && kc < KC_NCATEGORIES) diff --git a/crawl-ref/source/Kills.h b/crawl-ref/source/Kills.h index ea02322742..1c249251ab 100644 --- a/crawl-ref/source/Kills.h +++ b/crawl-ref/source/Kills.h @@ -154,6 +154,10 @@ private: class KillMaster { public: + KillMaster(); + KillMaster(const KillMaster& other); + ~KillMaster(); + void record_kill(const monsters *mon, int killer, bool ispet); bool empty() const; diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc index 550890b41d..cf3ca6eece 100644 --- a/crawl-ref/source/abl-show.cc +++ b/crawl-ref/source/abl-show.cc @@ -42,6 +42,7 @@ #include "effects.h" #include "food.h" #include "it_use2.h" +#include "itemprop.h" #include "macro.h" #include "message.h" #include "menu.h" @@ -52,6 +53,7 @@ #include "notes.h" #include "ouch.h" #include "player.h" +#include "randart.h" #include "religion.h" #include "skills.h" #include "skills2.h" @@ -71,6 +73,19 @@ #include "libunix.h" #endif +enum ability_flag_type +{ + ABFLAG_NONE = 0x00000000, + ABFLAG_BREATH = 0x00000001, // ability uses DUR_BREATH_WEAPON + ABFLAG_DELAY = 0x00000002, // ability has its own delay (ie glamour) + ABFLAG_PAIN = 0x00000004, // ability must hurt player (ie torment) + ABFLAG_EXHAUSTION = 0x00000008, // fails if you.exhausted + ABFLAG_INSTANT = 0x00000010, // doesn't take time to use + ABFLAG_PERMANENT_HP = 0x00000020, // costs permanent HPs + ABFLAG_PERMANENT_MP = 0x00000040, // costs permanent MPs + ABFLAG_CONF_OK = 0x00000080 // can use even if confused. +}; + static void lugonu_bends_space(); static int find_ability_slot( ability_type which_ability ); static bool activate_talent(const talent& tal); diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc index 5efd92fa94..3a6a951205 100644 --- a/crawl-ref/source/abyss.cc +++ b/crawl-ref/source/abyss.cc @@ -21,7 +21,7 @@ #include "cloud.h" #include "makeitem.h" #include "mapmark.h" -#include "misc.h" +#include "message.h" #include "monplace.h" #include "mtransit.h" #include "player.h" @@ -30,6 +30,8 @@ #include "lev-pand.h" #include "randart.h" #include "stuff.h" +#include "terrain.h" +#include "traps.h" #include "view.h" // public for abyss generation diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 03addb8192..1fdb6f0b92 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -126,9 +126,12 @@ #include "spl-book.h" #include "spl-cast.h" #include "spl-util.h" +#include "state.h" #include "stuff.h" #include "tags.h" +#include "terrain.h" #include "transfor.h" +#include "traps.h" #include "travel.h" #include "tutorial.h" #include "view.h" diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index ec4b944f5c..36aa6cb31b 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -42,6 +42,7 @@ #include "items.h" #include "itemname.h" #include "itemprop.h" +#include "message.h" #include "misc.h" #include "monplace.h" #include "monstuff.h" @@ -56,6 +57,8 @@ #include "spells3.h" #include "spells4.h" #include "stuff.h" +#include "terrain.h" +#include "traps.h" #include "view.h" #define BEAM_STOP 1000 // all beams stopped by subtracting this diff --git a/crawl-ref/source/beam.h b/crawl-ref/source/beam.h index e9ac9efa84..11cd0c5f6e 100644 --- a/crawl-ref/source/beam.h +++ b/crawl-ref/source/beam.h @@ -16,6 +16,169 @@ #include "externs.h" +#include "ray.h" + +enum demon_beam_type +{ + DMNBM_HELLFIRE, // 0 + DMNBM_SMITING, + DMNBM_BRAIN_FEED, + DMNBM_MUTATION +}; + +// beam[].type - note that this (and its variants) also accepts values +// from other enums - confusing {dlb} +enum zap_symbol_type +{ + SYM_SPACE = ' ', // 32 + SYM_FLASK = '!', // 33 + SYM_BOLT = '#', // 35 + SYM_CHUNK = '%', // 37 + SYM_OBJECT = '(', // 40 - actually used for books, but... {dlb} + SYM_WEAPON = ')', // 41 + SYM_ZAP = '*', // 42 + SYM_BURST = '+', // 43 + SYM_STICK = '/', // 47 + SYM_TRINKET = '=', // 61 + SYM_SCROLL = '?', // 63 + SYM_DEBUG = 'X', // 88 + SYM_ARMOUR = '[', // 91 + SYM_MISSILE = '`', // 96 + SYM_EXPLOSION = '#' +}; + +enum zap_type +{ + ZAP_FLAME, // 0 + ZAP_FROST, + ZAP_SLOWING, + ZAP_HASTING, + ZAP_MAGIC_DARTS, + ZAP_HEALING, // 5 + ZAP_PARALYSIS, + ZAP_FIRE, + ZAP_COLD, + ZAP_CONFUSION, + ZAP_INVISIBILITY, // 10 + ZAP_DIGGING, + ZAP_FIREBALL, + ZAP_TELEPORTATION, + ZAP_LIGHTNING, + ZAP_POLYMORPH_OTHER, // 15 + ZAP_VENOM_BOLT, + ZAP_NEGATIVE_ENERGY, + ZAP_CRYSTAL_SPEAR, + ZAP_BEAM_OF_ENERGY, + ZAP_MYSTIC_BLAST, // 20 + ZAP_ENSLAVEMENT, + ZAP_PAIN, + ZAP_STICKY_FLAME, + ZAP_DISPEL_UNDEAD, + ZAP_CLEANSING_FLAME, // 25 + ZAP_BONE_SHARDS, + ZAP_BANISHMENT, + ZAP_DEGENERATION, + ZAP_STING, + ZAP_HELLFIRE, // 30 + ZAP_IRON_BOLT, + ZAP_STRIKING, + ZAP_STONE_ARROW, + ZAP_ELECTRICITY, + ZAP_ORB_OF_ELECTRICITY, // 35 + ZAP_SPIT_POISON, + ZAP_DEBUGGING_RAY, + ZAP_BREATHE_FIRE, + ZAP_BREATHE_FROST, + ZAP_BREATHE_ACID, // 40 + ZAP_BREATHE_POISON, + ZAP_BREATHE_POWER, + ZAP_ENSLAVE_UNDEAD, + ZAP_AGONY, + ZAP_DISRUPTION, // 45 + ZAP_DISINTEGRATION, // 46 + // ZAP_ISKS_CROSS, // 47: Isk's Cross -- commented out, deprecated {dlb} + ZAP_BREATHE_STEAM = 48, // 48 + ZAP_CONTROL_DEMON, + ZAP_ORB_OF_FRAGMENTATION, // 50 + ZAP_ICE_BOLT, + ZAP_ICE_STORM, + ZAP_BACKLIGHT, //jmf: added next bunch 19mar2000 + ZAP_SLEEP, + ZAP_FLAME_TONGUE, + ZAP_SANDBLAST, + ZAP_SMALL_SANDBLAST, + ZAP_MAGMA, + ZAP_POISON_ARROW, + ZAP_BREATHE_STICKY_FLAME, + ZAP_BREATHE_LIGHTNING, + ZAP_PETRIFY, + ZAP_HELLFROST, + NUM_ZAPS // must remain last member {dlb} +}; + +struct dist; + +struct bolt +{ + // INPUT parameters set by caller + int range; // minimum range + int rangeMax; // maximum range + int type; // missile gfx + int colour; + int flavour; + int source_x, source_y; // beam origin + dice_def damage; + int ench_power, hit; + int target_x, target_y; // intended target + char thrower; // what kind of thing threw this? + char ex_size; // explosion radius (0==none) + int beam_source; // NON_MONSTER or monster index # + std::string name; + bool is_beam; // beams? (can hits multiple targets?) + bool is_explosion; + bool is_big_cloud; // expands into big_cloud at endpoint + bool is_enchant; // no block/dodge, but mag resist + bool is_energy; // mostly energy/non-physical attack + bool is_launched; // was fired from launcher? + bool is_thrown; // was thrown from hand? + bool target_first; // targeting by direction + bool aimed_at_spot; // aimed at (x,y), should not cross + std::string aux_source; // source of KILL_MISC beams + + // OUTPUT parameters (tracing, ID) + bool obvious_effect; // did an 'obvious' effect happen? + bool effect_known; // did we _know_ this would happen? + int fr_count, foe_count; // # of times a friend/foe is "hit" + int fr_power, foe_power; // total levels/hit dice affected + + // INTERNAL use - should not usually be set outside of beam.cc + bool is_tracer; // is this a tracer? + bool aimed_at_feet; // this was aimed at self! + bool msg_generated; // an appropriate msg was already mpr'd + bool in_explosion_phase; // explosion phase (as opposed to beam phase) + bool smart_monster; // tracer firer can guess at other mons. resists? + bool can_see_invis; // tracer firer can see invisible? + mon_attitude_type attitude; // attitude of whoever fired tracer + int foe_ratio; // 100* foe ratio (see mons_should_fire()) + bool chose_ray; // do we want a specific ray? + ray_def ray; // shoot on this specific ray + +public: + // A constructor to try and fix some of the bugs that occur because + // this struct never seems to be properly initialized. Definition + // is over in beam.cc. + bolt(); + + void set_target(const dist &); + + // Returns YOU_KILL or MON_KILL, depending on the source of the beam. + killer_type killer() const; + + coord_def target() const + { + return (coord_def(target_x, target_y)); + } +}; dice_def calc_dice( int num_dice, int max_damage ); diff --git a/crawl-ref/source/chardump.cc b/crawl-ref/source/chardump.cc index c5f3abebaf..7092a900d2 100644 --- a/crawl-ref/source/chardump.cc +++ b/crawl-ref/source/chardump.cc @@ -38,14 +38,17 @@ #include "debug.h" #include "describe.h" #include "hiscores.h" +#include "initfile.h" #include "itemprop.h" #include "items.h" +#include "Kills.h" #include "macro.h" -#include "misc.h" +#include "message.h" #include "mutation.h" #include "notes.h" #include "output.h" #include "overmap.h" +#include "place.h" #include "player.h" #include "randart.h" #include "religion.h" @@ -56,6 +59,7 @@ #include "spl-util.h" #include "stash.h" #include "stuff.h" +#include "transfor.h" #include "version.h" #include "view.h" @@ -811,7 +815,7 @@ static void sdump_spells(dump_params &par) static void sdump_kills(dump_params &par) { - par.text += you.kills.kill_info(); + par.text += you.kills->kill_info(); } static void sdump_overview(dump_params &par) diff --git a/crawl-ref/source/chardump.h b/crawl-ref/source/chardump.h index fa4b344183..b6ce4b9fd0 100644 --- a/crawl-ref/source/chardump.h +++ b/crawl-ref/source/chardump.h @@ -17,6 +17,20 @@ #include <string> +enum item_origin_dump_selector +{ + IODS_PRICE = 0, // Extra info is provided based on price + IODS_ARTEFACTS = 1, // Extra information on artefacts + IODS_EGO_ARMOUR = 2, + IODS_EGO_WEAPON = 4, + IODS_JEWELLERY = 8, + IODS_RUNES = 16, + IODS_RODS = 32, + IODS_STAVES = 64, + IODS_BOOKS = 128, + IODS_EVERYTHING = 0xFF +}; + struct scorefile_entry; bool dump_char(const std::string &fname, bool show_prices, diff --git a/crawl-ref/source/cio.cc b/crawl-ref/source/cio.cc index df1b10a4de..4296b65654 100644 --- a/crawl-ref/source/cio.cc +++ b/crawl-ref/source/cio.cc @@ -10,6 +10,7 @@ #include "cio.h" #include "externs.h" #include "macro.h" +#include "state.h" #include <queue> diff --git a/crawl-ref/source/cio.h b/crawl-ref/source/cio.h index 376d806c72..c21a54aa94 100644 --- a/crawl-ref/source/cio.h +++ b/crawl-ref/source/cio.h @@ -11,10 +11,31 @@ #include "AppHdr.h" #include "externs.h" #include "defines.h" +#include "direct.h" #include <cctype> #include <string> #include <vector> +class input_history +{ +public: + input_history(size_t size); + + void new_input(const std::string &s); + void clear(); + + const std::string *prev(); + const std::string *next(); + + void go_end(); +private: + typedef std::list<std::string> string_list; + + string_list history; + string_list::iterator pos; + size_t maxsize; +}; + void cursorxy(int x, int y); // Read one key, flag it as a mouse event if appropriate, but apply no @@ -36,7 +57,6 @@ void get_input_line( char *const buff, int len ); // In view.cc, declared here for default argument to cancelable_get_line() int get_number_of_cols(void); -class input_history; // Returns zero if user entered text and pressed Enter, otherwise returns the // key pressed that caused the exit, usually Escape. // @@ -224,4 +244,6 @@ private: int pos; }; +typedef int keycode_type; + #endif diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc index c0eacdde5a..05c5dcaa70 100644 --- a/crawl-ref/source/cloud.cc +++ b/crawl-ref/source/cloud.cc @@ -16,8 +16,8 @@ #include "externs.h" #include "cloud.h" -#include "misc.h" #include "stuff.h" +#include "terrain.h" // Returns true if this cloud spreads out as it dissipates. static bool cloud_spreads(const cloud_struct &cloud) diff --git a/crawl-ref/source/clua.cc b/crawl-ref/source/clua.cc index 95c31ed9b0..9c6cca38a5 100644 --- a/crawl-ref/source/clua.cc +++ b/crawl-ref/source/clua.cc @@ -21,6 +21,7 @@ #include "itemprop.h" #include "items.h" #include "item_use.h" +#include "it_use2.h" #include "libutil.h" #include "macro.h" #include "mapdef.h" @@ -32,7 +33,9 @@ #include "religion.h" #include "skills2.h" #include "spl-util.h" +#include "state.h" #include "stuff.h" +#include "transfor.h" #include "travel.h" #include "view.h" diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc index 7510d775a2..81ef504d05 100644 --- a/crawl-ref/source/command.cc +++ b/crawl-ref/source/command.cc @@ -33,11 +33,14 @@ #include "items.h" #include "libutil.h" #include "menu.h" +#include "message.h" #include "ouch.h" #include "player.h" #include "spl-cast.h" #include "spl-util.h" +#include "state.h" #include "stuff.h" +#include "transfor.h" #include "version.h" #include "view.h" diff --git a/crawl-ref/source/command.h b/crawl-ref/source/command.h index 338ef6489c..174acce2f7 100644 --- a/crawl-ref/source/command.h +++ b/crawl-ref/source/command.h @@ -22,7 +22,6 @@ * *********************************************************************** */ void quit_game(void); - // last updated 12may2000 {dlb} /* *********************************************************************** * called from: acr diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index 367b023fda..2dc68b3471 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -36,6 +36,7 @@ #include "externs.h" +#include "beam.h" #include "branch.h" #include "cio.h" #include "decks.h" @@ -45,6 +46,7 @@ #include "dungeon.h" #include "fight.h" #include "files.h" +#include "food.h" #include "invent.h" #include "it_use2.h" #include "itemname.h" @@ -59,6 +61,7 @@ #include "makeitem.h" #include "mapdef.h" #include "maps.h" +#include "message.h" #include "misc.h" #include "monplace.h" #include "monspeak.h" @@ -66,6 +69,7 @@ #include "mon-util.h" #include "mutation.h" #include "ouch.h" +#include "place.h" #include "player.h" #include "randart.h" #include "religion.h" @@ -74,6 +78,8 @@ #include "spl-cast.h" #include "spl-util.h" #include "stuff.h" +#include "terrain.h" +#include "traps.h" #include "travel.h" #include "version.h" #include "view.h" diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index 66602c0667..74e2a0c4ef 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -24,6 +24,7 @@ #include "item_use.h" #include "itemprop.h" #include "items.h" +#include "message.h" #include "misc.h" #include "monplace.h" #include "monstuff.h" @@ -38,7 +39,9 @@ #include "spl-cast.h" #include "spl-util.h" #include "stuff.h" +#include "terrain.h" #include "transfor.h" +#include "traps.h" #include "view.h" #define VECFROM(x) (x), (x) + ARRAYSIZE(x) @@ -1365,3 +1368,25 @@ void card_effect(card_type which_card, deck_rarity_type rarity) return; } + +bool is_deck(const item_def &item) +{ + return item.base_type == OBJ_MISCELLANY + && (item.sub_type >= MISC_DECK_OF_ESCAPE && + item.sub_type <= MISC_DECK_OF_DEFENSE); +} + +deck_rarity_type deck_rarity(const item_def &item) +{ + ASSERT( is_deck(item) ); + switch (item.colour) + { + case BLACK: case BLUE: case GREEN: case CYAN: case RED: + default: + return DECK_RARITY_COMMON; + case MAGENTA: case BROWN: + return DECK_RARITY_RARE; + case LIGHTMAGENTA: + return DECK_RARITY_LEGENDARY; + } +} diff --git a/crawl-ref/source/decks.h b/crawl-ref/source/decks.h index 1ab652904f..6ef6725928 100644 --- a/crawl-ref/source/decks.h +++ b/crawl-ref/source/decks.h @@ -17,6 +17,23 @@ #include "externs.h" +enum deck_rarity_type +{ + DECK_RARITY_COMMON, + DECK_RARITY_RARE, + DECK_RARITY_LEGENDARY +}; + +enum deck_type +{ + // pure decks + DECK_OF_ESCAPE, + DECK_OF_DESTRUCTION, + DECK_OF_DUNGEONS, + DECK_OF_SUMMONING, + DECK_OF_WONDERS +}; + const char* card_name(card_type card); void evoke_deck(item_def& deck); bool deck_triple_draw(); @@ -26,4 +43,7 @@ bool choose_deck_and_draw(); void card_effect(card_type which_card, deck_rarity_type rarity); void draw_from_deck_of_punishment(); +bool is_deck(const item_def &item); +deck_rarity_type deck_rarity(const item_def &item); + #endif diff --git a/crawl-ref/source/delay.h b/crawl-ref/source/delay.h index c45d5a0b2b..81e14807f0 100644 --- a/crawl-ref/source/delay.h +++ b/crawl-ref/source/delay.h @@ -14,6 +14,62 @@ #include "enum.h" +struct monsters; +struct ait_hp_loss; + +enum activity_interrupt_payload_type +{ + AIP_NONE, + AIP_INT, + AIP_STRING, + AIP_MONSTER, + AIP_HP_LOSS +}; + +struct activity_interrupt_data +{ + activity_interrupt_payload_type apt; + const void *data; + std::string context; + + activity_interrupt_data() + : apt(AIP_NONE), data(NULL), context() + { + } + activity_interrupt_data(const int *i) + : apt(AIP_INT), data(i), context() + { + } + activity_interrupt_data(const char *s) + : apt(AIP_STRING), data(s), context() + { + } + activity_interrupt_data(const std::string &s) + : apt(AIP_STRING), data(s.c_str()), context() + { + } + activity_interrupt_data(const monsters *m, const std::string &ctx = "") + : apt(AIP_MONSTER), data(m), context(ctx) + { + } + activity_interrupt_data(const ait_hp_loss *ahl) + : apt(AIP_HP_LOSS), data(ahl), context() + { + } + activity_interrupt_data(const activity_interrupt_data &a) + : apt(a.apt), data(a.data), context(a.context) + { + } +}; + +struct ait_hp_loss +{ + int hp; + int hurt_type; // KILLED_BY_POISON, etc. + + ait_hp_loss(int _hp, int _ht) : hp(_hp), hurt_type(_ht) { } +}; + void start_delay( delay_type type, int turns, int parm1 = 0, int parm2 = 0 ); void stop_delay( void ); bool you_are_delayed( void ); diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index 4282ee5660..7ec5fd1ea5 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -38,10 +38,13 @@ #include "debug.h" #include "decks.h" #include "fight.h" +#include "food.h" +#include "it_use2.h" #include "itemname.h" #include "itemprop.h" #include "macro.h" #include "menu.h" +#include "message.h" #include "mon-util.h" #include "player.h" #include "randart.h" diff --git a/crawl-ref/source/describe.h b/crawl-ref/source/describe.h index aaa6044e33..a5999d8488 100644 --- a/crawl-ref/source/describe.h +++ b/crawl-ref/source/describe.h @@ -19,6 +19,16 @@ #include "externs.h" #include "enum.h" +enum item_description_type +{ + IDESC_WANDS = 0, + IDESC_POTIONS, + IDESC_SCROLLS, // special field (like the others) + IDESC_RINGS, + IDESC_SCROLLS_II, + NUM_IDESC +}; + // last updated 12may2000 {dlb} /* *********************************************************************** * called from: chardump - spells4 @@ -65,4 +75,6 @@ std::string ghost_description(const monsters &mons, bool concise = false); const char *trap_name(trap_type trap); int str_to_trap(const std::string &s); +extern const char* god_gain_power_messages[MAX_NUM_GODS][MAX_GOD_ABILITIES]; + #endif diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc index 3e74133ff0..8a6074721d 100644 --- a/crawl-ref/source/direct.cc +++ b/crawl-ref/source/direct.cc @@ -39,6 +39,8 @@ #include "dungeon.h" #include "itemname.h" #include "mapmark.h" +#include "message.h" +#include "misc.h" #include "monstuff.h" #include "mon-util.h" #include "player.h" @@ -46,6 +48,8 @@ #include "stuff.h" #include "spells4.h" #include "stash.h" +#include "terrain.h" +#include "traps.h" #include "travel.h" #include "tutorial.h" #include "view.h" diff --git a/crawl-ref/source/direct.h b/crawl-ref/source/direct.h index b3d2fa3482..93ea85d89a 100644 --- a/crawl-ref/source/direct.h +++ b/crawl-ref/source/direct.h @@ -16,12 +16,80 @@ #include "externs.h" #include "enum.h" +#include "ray.h" // last updated 12may2000 {dlb} /* *********************************************************************** * called from: acr - debug - effects - it_use3 - item_use - spells1 - * spells2 - spells3 - spells4 * *********************************************************************** */ +struct crawl_view_geometry +{ +public: + coord_def termsz; // Size of the terminal. + coord_def viewp; // Left-top pos of viewport. + coord_def viewsz; // Size of the viewport (play area). + coord_def hudp; // Left-top pos of status area. + coord_def hudsz; // Size of the status area. + coord_def msgp; // Left-top pos of the message pane. + coord_def msgsz; // Size of the message pane. + + coord_def vgrdc; // What grid pos is at the centre of the view + // usually you.pos(). + + coord_def viewhalfsz; + + coord_def glos1, glos2; // LOS limit grid coords (inclusive) + coord_def vlos1, vlos2; // LOS limit viewport coords (inclusive) + + coord_def mousep; // Where the mouse is. + + static const int message_min_lines = 7; + static const int hud_min_width = 41; + static const int hud_min_gutter = 3; + static const int hud_max_gutter = 6; + +private: + coord_def last_player_pos; + +public: + crawl_view_geometry(); + void init_geometry(); + + void init_view(); + void set_player_at(const coord_def &c, bool force_centre = false); + + coord_def view_centre() const + { + return viewp + viewhalfsz; + } + + bool in_grid_los(const coord_def &c) const + { + return (c.x >= glos1.x && c.x <= glos2.x + && c.y >= glos1.y && c.y <= glos2.y); + } + + bool in_view_los(const coord_def &c) const + { + return (c.x >= vlos1.x && c.x <= vlos2.x + && c.y >= vlos1.y && c.y <= vlos2.y); + } + + bool in_view_viewport(const coord_def &c) const + { + return (c.x >= viewp.x && c.y >= viewp.y + && c.x < viewp.x + viewsz.x + && c.y < viewp.y + viewsz.y); + } + + bool in_grid_viewport(const coord_def &c) const + { + return in_view_viewport(c - vgrdc + view_centre()); + } +}; + +extern crawl_view_geometry crawl_view; // An object that modifies the behaviour of the direction prompt. class targeting_behaviour @@ -40,6 +108,30 @@ public: bool compass; }; +// output from direction() function: +struct dist +{ + bool isValid; // valid target chosen? + bool isTarget; // target (true), or direction (false)? + bool isMe; // selected self (convenience: tx == you.x_pos, + // ty == you.y_pos) + bool isEndpoint; // Does the player want the attack to stop at (tx,ty)? + bool isCancel; // user cancelled (usually <ESC> key) + bool choseRay; // user wants a specific beam + int tx,ty; // target x,y or logical extension of beam to map edge + int dx,dy; // delta x and y if direction - always -1,0,1 + ray_def ray; // ray chosen if necessary + + // internal use - ignore + int prev_target; // previous target + + // target - source (source == you.pos()) + coord_def target() const + { + return coord_def(tx, ty); + } +}; + void direction( dist &moves, targeting_type restricts = DIR_NONE, targ_mode_type mode = TARG_ANY, bool just_looking = false, bool needs_path = true, const char *prompt = NULL, @@ -110,4 +202,6 @@ inline coord_def grid2show(const coord_def &pos) return (view2show(grid2view(pos))); } +extern const struct coord_def Compass[8]; + #endif diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index d52c6cdb24..545f3bb8fd 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -40,6 +40,7 @@ #include "direct.h" #include "dungeon.h" #include "files.h" +#include "food.h" #include "itemname.h" #include "itemprop.h" #include "items.h" @@ -47,18 +48,23 @@ #include "mapdef.h" #include "mapmark.h" #include "maps.h" +#include "message.h" #include "misc.h" #include "mon-util.h" #include "mon-pick.h" #include "monplace.h" #include "monstuff.h" #include "notes.h" +#include "place.h" #include "player.h" #include "randart.h" #include "spells3.h" #include "spl-book.h" +#include "state.h" #include "stuff.h" #include "tags.h" +#include "terrain.h" +#include "traps.h" #include "travel.h" #include "view.h" diff --git a/crawl-ref/source/dungeon.h b/crawl-ref/source/dungeon.h index f99b560c01..b7fc8bca02 100644 --- a/crawl-ref/source/dungeon.h +++ b/crawl-ref/source/dungeon.h @@ -17,11 +17,32 @@ #include "FixVec.h" #include "FixAry.h" #include "externs.h" -#include "misc.h" +#include "terrain.h" #include "travel.h" #include "stuff.h" #include <vector> +enum portal_type +{ + PORTAL_NONE = 0, + PORTAL_LABYRINTH, + PORTAL_HELL, + PORTAL_ABYSS, + PORTAL_PANDEMONIUM, + NUM_PORTALS +}; + +enum special_room_type +{ + SROOM_LAIR_ORC, // 0 + SROOM_LAIR_KOBOLD, + SROOM_TREASURY, + SROOM_BEEHIVE, + SROOM_JELLY_PIT, + SROOM_MORGUE, + NUM_SPECIAL_ROOMS // 5 - must remain final member {dlb} +}; + const int MAKE_GOOD_ITEM = 351; // Should be the larger of GXM/GYM diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index 8194a74128..bf9753216a 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -21,12 +21,15 @@ #include "beam.h" #include "direct.h" +#include "food.h" #include "hiscores.h" +#include "it_use2.h" #include "item_use.h" #include "itemname.h" #include "itemprop.h" #include "items.h" #include "makeitem.h" +#include "message.h" #include "misc.h" #include "monplace.h" #include "monstuff.h" @@ -44,6 +47,7 @@ #include "spl-book.h" #include "spl-util.h" #include "stuff.h" +#include "terrain.h" #include "view.h" // torment_monsters is called with power 0 because torment is diff --git a/crawl-ref/source/effects.h b/crawl-ref/source/effects.h index f5e9dcd4ce..0ed6b8371e 100644 --- a/crawl-ref/source/effects.h +++ b/crawl-ref/source/effects.h @@ -16,7 +16,7 @@ #include "externs.h" - +struct bolt; // last updated 12may2000 {dlb} /* *********************************************************************** diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index ec3773886f..67856cc382 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -131,19 +131,6 @@ enum ability_type ABIL_RENOUNCE_RELIGION = 250 // 250 }; -enum ability_flag_type -{ - ABFLAG_NONE = 0x00000000, - ABFLAG_BREATH = 0x00000001, // ability uses DUR_BREATH_WEAPON - ABFLAG_DELAY = 0x00000002, // ability has its own delay (ie glamour) - ABFLAG_PAIN = 0x00000004, // ability must hurt player (ie torment) - ABFLAG_EXHAUSTION = 0x00000008, // fails if you.exhausted - ABFLAG_INSTANT = 0x00000010, // doesn't take time to use - ABFLAG_PERMANENT_HP = 0x00000020, // costs permanent HPs - ABFLAG_PERMANENT_MP = 0x00000040, // costs permanent MPs - ABFLAG_CONF_OK = 0x00000080 // can use even if confused. -}; - enum activity_interrupt_type { AI_FORCE_INTERRUPT = 0, // Forcibly kills any activity that can be @@ -167,83 +154,13 @@ enum activity_interrupt_type NUM_AINTERRUPTS }; -enum activity_interrupt_payload_type -{ - AIP_NONE, - AIP_INT, - AIP_STRING, - AIP_MONSTER, - AIP_HP_LOSS -}; - enum actor_type { ACT_NONE = -1, ACT_PLAYER, ACT_MONSTER }; - -// Various ways to get the acquirement effect. -enum acquirement_agent_type -{ - AQ_SCROLL = 0, - - // Empty space for the gods - - AQ_CARD_GENIE = 100, - - AQ_WIZMODE = 200 -}; - -enum armour_type -{ - ARM_ROBE, // 0 - ARM_LEATHER_ARMOUR, - ARM_RING_MAIL, - ARM_SCALE_MAIL, - ARM_CHAIN_MAIL, - ARM_SPLINT_MAIL, // 5 - ARM_BANDED_MAIL, - ARM_PLATE_MAIL, - ARM_SHIELD, - ARM_CLOAK, - ARM_HELMET, // 10 - ARM_GLOVES, - ARM_BOOTS, - ARM_BUCKLER, - ARM_LARGE_SHIELD, - ARM_DRAGON_HIDE, // 15 - ARM_TROLL_HIDE, - ARM_CRYSTAL_PLATE_MAIL, - ARM_DRAGON_ARMOUR, - ARM_TROLL_LEATHER_ARMOUR, - ARM_ICE_DRAGON_HIDE, // 20 - ARM_ICE_DRAGON_ARMOUR, - ARM_STEAM_DRAGON_HIDE, - ARM_STEAM_DRAGON_ARMOUR, - ARM_MOTTLED_DRAGON_HIDE, - ARM_MOTTLED_DRAGON_ARMOUR, // 25 - ARM_STORM_DRAGON_HIDE, - ARM_STORM_DRAGON_ARMOUR, - ARM_GOLD_DRAGON_HIDE, - ARM_GOLD_DRAGON_ARMOUR, - ARM_ANIMAL_SKIN, // 30 - ARM_SWAMP_DRAGON_HIDE, - ARM_SWAMP_DRAGON_ARMOUR, - ARM_STUDDED_LEATHER_ARMOUR, - ARM_CAP, - ARM_CENTAUR_BARDING, // 35 - ARM_NAGA_BARDING, - - NUM_ARMOURS -}; - -enum armour_property_type -{ - PARM_AC, // 0 - PARM_EVASION -}; - + enum attribute_type { ATTR_DIVINE_LIGHTNING_PROTECTION, // 0 @@ -257,56 +174,6 @@ enum attribute_type NUM_ATTRIBUTES }; -enum band_type -{ - BAND_NO_BAND = 0, - BAND_KOBOLDS = 1, - BAND_ORCS, - BAND_ORC_KNIGHT, - BAND_KILLER_BEES, - BAND_FLYING_SKULLS, // 5 - BAND_SLIME_CREATURES, - BAND_YAKS, - BAND_UGLY_THINGS, - BAND_HELL_HOUNDS, - BAND_JACKALS, // 10 - BAND_HELL_KNIGHTS, - BAND_ORC_HIGH_PRIEST, - BAND_GNOLLS, // 13 - BAND_BUMBLEBEES = 16, - BAND_CENTAURS, - BAND_YAKTAURS, - BAND_INSUBSTANTIAL_WISPS, - BAND_OGRE_MAGE, // 20 - BAND_DEATH_YAKS, - BAND_NECROMANCER, - BAND_BALRUG, - BAND_CACODEMON, - BAND_EXECUTIONER, // 25 - BAND_HELLWING, - BAND_DEEP_ELF_FIGHTER, - BAND_DEEP_ELF_KNIGHT, - BAND_DEEP_ELF_HIGH_PRIEST, - BAND_KOBOLD_DEMONOLOGIST, // 30 - BAND_NAGAS, - BAND_WAR_DOGS, - BAND_GREY_RATS, - BAND_GREEN_RATS, - BAND_ORANGE_RATS, // 35 - BAND_SHEEP, - BAND_GHOULS, - BAND_DEEP_TROLLS, - BAND_HOGS, - BAND_HELL_HOGS, // 40 - BAND_GIANT_MOSQUITOES, - BAND_BOGGARTS, - BAND_BLINK_FROGS, - BAND_SKELETAL_WARRIORS, // 44 - BAND_DRACONIAN, // 45 - BAND_PANDEMONIUM_DEMON, - NUM_BANDS // always last -}; - enum beam_type // beam[].flavour { BEAM_MISSILE, // 0 @@ -770,13 +637,6 @@ enum command_type }; -enum confirm_level_type -{ - CONFIRM_NONE_EASY, - CONFIRM_SAFE_EASY, - CONFIRM_ALL_EASY -}; - enum conduct_type { DID_NECROMANCY = 1, // vamp/drain/pain wpns, Zong/Curses @@ -814,24 +674,11 @@ enum conduct_type NUM_CONDUCTS }; -enum corpse_effect_type -{ - CE_NOCORPSE, // 0 - CE_CLEAN, // 1 - CE_CONTAMINATED, // 2 - CE_POISONOUS, // 3 - CE_HCL, // 4 - CE_MUTAGEN_RANDOM, // 5 - CE_MUTAGEN_GOOD, // 6 - may be worth implementing {dlb} - CE_MUTAGEN_BAD, // 7 - may be worth implementing {dlb} - CE_RANDOM, // 8 - not used, but may be worth implementing {dlb} - CE_ROTTEN = 50 // 50 - must remain at 50 for now {dlb} -}; - -enum corpse_type +enum confirm_level_type { - CORPSE_BODY, // 0 - CORPSE_SKELETON + CONFIRM_NONE_EASY, + CONFIRM_SAFE_EASY, + CONFIRM_ALL_EASY }; enum death_knight_type @@ -851,23 +698,6 @@ enum startup_book_type SBT_RANDOM }; -enum deck_rarity_type -{ - DECK_RARITY_COMMON, - DECK_RARITY_RARE, - DECK_RARITY_LEGENDARY -}; - -enum deck_type -{ - // pure decks - DECK_OF_ESCAPE, - DECK_OF_DESTRUCTION, - DECK_OF_DUNGEONS, - DECK_OF_SUMMONING, - DECK_OF_WONDERS -}; - // When adding new delays, update their names in delay.cc, or bad things will // happen. enum delay_type @@ -900,22 +730,6 @@ enum delay_type NUM_DELAYS }; -enum demon_beam_type -{ - DMNBM_HELLFIRE, // 0 - DMNBM_SMITING, - DMNBM_BRAIN_FEED, - DMNBM_MUTATION -}; - -enum demon_class_type -{ - DEMON_LESSER, // 0: Class V - DEMON_COMMON, // 1: Class II-IV - DEMON_GREATER, // 2: Class I - DEMON_RANDOM // any of the above -}; - enum description_level_type { DESC_CAP_THE, // 0 @@ -935,13 +749,6 @@ enum description_level_type // enchantments. }; -enum dragon_class_type -{ - DRAGON_LIZARD, - DRAGON_DRACONIAN, - DRAGON_DRAGON -}; - enum game_direction_type { GDT_NONE, @@ -988,12 +795,6 @@ enum dungeon_char_type NUM_DCHAR_TYPES }; -enum drop_mode_type -{ - DM_SINGLE, - DM_MULTI -}; - // When adding: // // * New stairs/portals: update grid_stair_direction. @@ -1226,46 +1027,6 @@ enum duration_type NUM_DURATIONS }; -// various elemental colour schemes... used for abstracting random short lists -// MUST match the order in initfile.cc or breakage results. -enum element_type -{ - EC_FIRE = 32, // fiery colours (must be first and > highest colour) - EC_ICE, // icy colours - EC_EARTH, // earthy colours - EC_ELECTRICITY, // electrical side of air - EC_AIR, // non-electric and general air magic - EC_POISON, // used only for venom mage and stalker stuff - EC_WATER, // used only for the elemental - EC_MAGIC, // general magical effect - EC_MUTAGENIC, // transmute, poly, radiation effects - EC_WARP, // teleportation and anything similar - EC_ENCHANT, // magical enhancements - EC_HEAL, // holy healing (not necromantic stuff) - EC_HOLY, // general "good" god effects - EC_DARK, // darkness - EC_DEATH, // currently only assassin (and equal to EC_NECRO) - EC_NECRO, // necromancy stuff - EC_UNHOLY, // demonology stuff - EC_VEHUMET, // vehumet's odd-ball colours - EC_BEOGH, // Beogh altar colours - EC_CRYSTAL, // colours of crystal - EC_BLOOD, // colours of blood - EC_SMOKE, // colours of smoke - EC_SLIME, // colours of slime - EC_JEWEL, // colourful - EC_ELVEN, // used for colouring elf fabric items - EC_DWARVEN, // used for colouring dwarf fabric items - EC_ORCISH, // used for colouring orc fabric items - EC_GILA, // gila monster colours - EC_FLOOR, // colour of the area's floor - EC_ROCK, // colour of the area's rock - EC_STONE, // colour of the area's stone - EC_MIST, // colour of mist - EC_SHIMMER_BLUE, // shimmering colours of blue. - EC_RANDOM // any colour (except BLACK) -}; - // This list must match the enchant_names array in mon-util.cc enum enchant_type { @@ -1342,21 +1103,6 @@ enum feature_flag_type FFT_EXAMINE_HINT = 0x2 // could get an "examine-this" hint. }; -enum fire_type -{ - FIRE_NONE = 0x0000, - FIRE_LAUNCHER = 0x0001, - FIRE_DART = 0x0002, - FIRE_STONE = 0x0004, - FIRE_DAGGER = 0x0008, - FIRE_JAVELIN = 0x0010, - FIRE_SPEAR = 0x0020, - FIRE_HAND_AXE = 0x0040, - FIRE_CLUB = 0x0080, - FIRE_ROCK = 0x0100, - FIRE_NET = 0x0200 -}; - enum flush_reason_type { FLUSH_ON_FAILURE, // spell/ability failed to cast @@ -1370,48 +1116,6 @@ enum flush_reason_type NUM_FLUSH_REASONS }; -enum food_type -{ - FOOD_MEAT_RATION, // 0 - FOOD_BREAD_RATION, - FOOD_PEAR, - FOOD_APPLE, - FOOD_CHOKO, - FOOD_HONEYCOMB, // 5 - FOOD_ROYAL_JELLY, - FOOD_SNOZZCUMBER, - FOOD_PIZZA, - FOOD_APRICOT, - FOOD_ORANGE, // 10 - FOOD_BANANA, - FOOD_STRAWBERRY, - FOOD_RAMBUTAN, - FOOD_LEMON, - FOOD_GRAPE, // 15 - FOOD_SULTANA, - FOOD_LYCHEE, - FOOD_BEEF_JERKY, - FOOD_CHEESE, - FOOD_SAUSAGE, // 20 - FOOD_CHUNK, - NUM_FOODS -}; - -enum genus_type -{ - GENPC_DRACONIAN, // 0 - GENPC_ELVEN, // 1 - GENPC_DWARVEN, // 2 - GENPC_OGRE -}; - -enum gender_type -{ - GENDER_NEUTER, - GENDER_MALE, - GENDER_FEMALE -}; - enum ghost_value_type { GVAL_MAX_HP, // 0 @@ -1468,48 +1172,6 @@ enum god_type GOD_RANDOM = 100 }; -enum hands_reqd_type -{ - HANDS_ONE, - HANDS_HALF, - HANDS_TWO, - - HANDS_DOUBLE // not a level, marks double ended weapons (== half) -}; - -enum helmet_type -{ - THELM_HELMET = 0x0000, - THELM_HELM = 0x0001, - THELM_CAP = 0x0002, - THELM_WIZARD_HAT = 0x0003, - THELM_NUM_TYPES = 4, - - THELM_SPECIAL = 0x0004, // type used only for artefacts (mask, hat) - THELM_TYPE_MASK = 0x00ff, - - THELM_DESC_PLAIN = 0x0000, - THELM_DESC_WINGED = 0x0100, - THELM_DESC_HORNED = 0x0200, - THELM_DESC_CRESTED = 0x0300, - THELM_DESC_PLUMED = 0x0400, - THELM_DESC_SPIKED = 0x0500, - THELM_DESC_VISORED = 0x0600, - THELM_DESC_JEWELLED = 0x0700, - - THELM_DESC_MASK = 0xff00 -}; - - -enum boot_type // used in pluses2 -{ - TBOOT_BOOTS = 0, - TBOOT_NAGA_BARDING, - TBOOT_CENTAUR_BARDING, - NUM_BOOT_TYPES -}; - - enum hunger_state // you.hunger_state { HS_RAVENOUS, // 0: not used within code, really @@ -1562,104 +1224,6 @@ enum item_status_flag_type // per item flags: ie. ident status, cursed status ISFLAG_NOTED_GET = 0x10000000 }; -enum item_description_type -{ - IDESC_WANDS = 0, - IDESC_POTIONS, - IDESC_SCROLLS, // special field (like the others) - IDESC_RINGS, - IDESC_SCROLLS_II, - NUM_IDESC -}; - -enum item_make_species_type -{ - MAKE_ITEM_ELVEN = 1, - MAKE_ITEM_DWARVEN = 2, - MAKE_ITEM_ORCISH = 3, - - MAKE_ITEM_NO_RACE = 100, - MAKE_ITEM_RANDOM_RACE = 250 -}; - -enum item_origin_dump_selector -{ - IODS_PRICE = 0, // Extra info is provided based on price - IODS_ARTEFACTS = 1, // Extra information on artefacts - IODS_EGO_ARMOUR = 2, - IODS_EGO_WEAPON = 4, - IODS_JEWELLERY = 8, - IODS_RUNES = 16, - IODS_RODS = 32, - IODS_STAVES = 64, - IODS_BOOKS = 128, - IODS_EVERYTHING = 0xFF -}; - -enum item_type_id_type -{ - IDTYPE_WANDS = 0, - IDTYPE_SCROLLS, - IDTYPE_JEWELLERY, - IDTYPE_POTIONS, - NUM_IDTYPE -}; - -enum item_type_id_state_type // used for values in id[4][50] -{ - ID_UNKNOWN_TYPE = 0, - ID_MON_TRIED_TYPE, - ID_TRIED_TYPE, - ID_KNOWN_TYPE -}; - -enum jewellery_type -{ - RING_FIRST_RING = 0, - - RING_REGENERATION = RING_FIRST_RING, // 0 - RING_PROTECTION, - RING_PROTECTION_FROM_FIRE, - RING_POISON_RESISTANCE, - RING_PROTECTION_FROM_COLD, - RING_STRENGTH, // 5 - RING_SLAYING, - RING_SEE_INVISIBLE, - RING_INVISIBILITY, - RING_HUNGER, - RING_TELEPORTATION, // 10 - RING_EVASION, - RING_SUSTAIN_ABILITIES, - RING_SUSTENANCE, - RING_DEXTERITY, - RING_INTELLIGENCE, // 15 - RING_WIZARDRY, - RING_MAGICAL_POWER, - RING_LEVITATION, - RING_LIFE_PROTECTION, - RING_PROTECTION_FROM_MAGIC, // 20 - RING_FIRE, - RING_ICE, - RING_TELEPORT_CONTROL, // 23 - - NUM_RINGS, // 24, keep as last ring; can overlap - // safely with first amulet. - - AMU_FIRST_AMULET = 35, - AMU_RAGE = AMU_FIRST_AMULET, // 35 - AMU_RESIST_SLOW, - AMU_CLARITY, - AMU_WARDING, - AMU_RESIST_CORROSION, - AMU_THE_GOURMAND, // 40 - AMU_CONSERVATION, - AMU_CONTROLLED_FLIGHT, - AMU_INACCURACY, - AMU_RESIST_MUTATION, - - NUM_JEWELLERY -}; - enum job_type { JOB_FIGHTER, // 0 @@ -1696,45 +1260,6 @@ enum job_type JOB_UNKNOWN = 100 }; -enum kill_method_type -{ - KILLED_BY_MONSTER, // 0 - KILLED_BY_POISON, - KILLED_BY_CLOUD, - KILLED_BY_BEAM, // 3 - KILLED_BY_DEATHS_DOOR, // should be deprecated, but you never know {dlb} - KILLED_BY_LAVA, // 5 - KILLED_BY_WATER, - KILLED_BY_STUPIDITY, - KILLED_BY_WEAKNESS, - KILLED_BY_CLUMSINESS, - KILLED_BY_TRAP, // 10 - KILLED_BY_LEAVING, - KILLED_BY_WINNING, - KILLED_BY_QUITTING, - KILLED_BY_DRAINING, - KILLED_BY_STARVATION, // 15 - KILLED_BY_FREEZING, - KILLED_BY_BURNING, - KILLED_BY_WILD_MAGIC, - KILLED_BY_XOM, - KILLED_BY_STATUE, // 20 - KILLED_BY_ROTTING, - KILLED_BY_TARGETTING, - KILLED_BY_SPORE, - KILLED_BY_TSO_SMITING, - KILLED_BY_PETRIFICATION, // 25 - KILLED_BY_SOMETHING = 27, - KILLED_BY_FALLING_DOWN_STAIRS, - KILLED_BY_ACID, - KILLED_BY_CURARE, - KILLED_BY_MELTING, - KILLED_BY_BLEEDING, - KILLED_BY_BEOGH_SMITING, - - NUM_KILLBY -}; - // This order is *critical*. Don't mess with it (see mon_enchant) enum kill_category { @@ -1757,17 +1282,6 @@ enum killer_type // monster_die(), thing_thrown KILL_DISMISSED // only on new game startup }; -#define YOU_KILL(x) ((x) == KILL_YOU || (x) == KILL_YOU_MISSILE \ - || (x) == KILL_YOU_CONF) -#define MON_KILL(x) ((x) == KILL_MON || (x) == KILL_MON_MISSILE) - -enum launch_retval -{ - LRET_FUMBLED = 0, // must be left as 0 - LRET_LAUNCHED, - LRET_THROWN -}; - enum flight_type { FL_NONE = 0, @@ -1786,13 +1300,6 @@ enum level_area_type // you.level_type NUM_LEVEL_AREA_TYPES }; -enum load_mode_type -{ - LOAD_START_GAME, - LOAD_RESTART_GAME, - LOAD_ENTER_LEVEL -}; - // Can't change this order without breaking saves. enum map_marker_type { @@ -1803,28 +1310,6 @@ enum map_marker_type MAT_ANY }; -// [dshaligram] Maps can be mirrored; for every orientation, there must be -// a suitable mirror. -enum map_section_type // see maps.cc and dungeon.cc {dlb} -{ - MAP_NONE = -1, - MAP_NORTH = 1, // 1 - MAP_SOUTH, - MAP_EAST, - MAP_WEST, - MAP_NORTHWEST, // 5 - MAP_NORTHEAST, - MAP_SOUTHWEST, - MAP_SOUTHEAST, - MAP_ENCOMPASS, - - // A "floating" vault is placed somewhat like a minivault, away from - // the edges, although in other respects it behaves like a regular vault. - MAP_FLOAT, - - MAP_NUM_SECTION_TYPES -}; - enum menu_type { MT_ANY = -1, @@ -1835,182 +1320,14 @@ enum menu_type MT_PICKUP }; -// if you mess with this list, you'll need to make changes in initfile.cc -// to message_channel_names, and probably also to message.cc to colour -// everything properly -enum msg_channel_type -{ - MSGCH_PLAIN, // regular text - MSGCH_PROMPT, // various prompts - MSGCH_GOD, // god/religion (param is god) - MSGCH_PRAY, // praying messages (param is god) - MSGCH_DURATION, // effect down/warnings - MSGCH_DANGER, // serious life threats (ie very large HP attacks) - MSGCH_WARN, // much less serious threats - MSGCH_FOOD, // hunger notices - MSGCH_RECOVERY, // recovery from disease/stat/poison condition - MSGCH_SOUND, // messages about things the player hears - MSGCH_TALK, // monster talk (param is monster type) - MSGCH_INTRINSIC_GAIN, // player level/stat/species-power gains - MSGCH_MUTATION, // player gain/lose mutations - MSGCH_MONSTER_SPELL, // monsters casting spells - MSGCH_MONSTER_ENCHANT,// monsters enchantments up and down - MSGCH_MONSTER_DAMAGE, // monster damage reports (param is level) - MSGCH_MONSTER_TARGET, // message marking the monster as a target - MSGCH_ROTTEN_MEAT, // messages about chunks/corpses becoming rotten - MSGCH_EQUIPMENT, // equipment listing messages - MSGCH_FLOOR_ITEMS, // like equipment, but lists of floor items - MSGCH_MULTITURN_ACTION, // delayed action messages - MSGCH_EXAMINE, // messages describing monsters, features, items - MSGCH_EXAMINE_FILTER, // "less important" instances of the above - MSGCH_DIAGNOSTICS, // various diagnostic messages - MSGCH_TUTORIAL, // messages for tutorial - NUM_MESSAGE_CHANNELS // always last -}; - -enum msg_colour_type -{ - MSGCOL_BLACK = 0, // the order of these colours is important - MSGCOL_BLUE, - MSGCOL_GREEN, - MSGCOL_CYAN, - MSGCOL_RED, - MSGCOL_MAGENTA, - MSGCOL_BROWN, - MSGCOL_LIGHTGRAY, - MSGCOL_DARKGRAY, - MSGCOL_LIGHTBLUE, - MSGCOL_LIGHTGREEN, - MSGCOL_LIGHTCYAN, - MSGCOL_LIGHTMAGENTA, - MSGCOL_YELLOW, - MSGCOL_WHITE, - MSGCOL_DEFAULT, // use default colour - MSGCOL_ALTERNATE, // use secondary default colour scheme - MSGCOL_MUTED, // don't print messages - MSGCOL_PLAIN // same as plain channel -}; - -enum misc_item_type -{ - MISC_BOTTLED_EFREET, // 0 - MISC_CRYSTAL_BALL_OF_SEEING, - MISC_AIR_ELEMENTAL_FAN, - MISC_LAMP_OF_FIRE, - MISC_STONE_OF_EARTH_ELEMENTALS, - MISC_LANTERN_OF_SHADOWS, - MISC_HORN_OF_GERYON, - MISC_BOX_OF_BEASTS, - MISC_CRYSTAL_BALL_OF_ENERGY, - MISC_EMPTY_EBONY_CASKET, - MISC_CRYSTAL_BALL_OF_FIXATION, - MISC_DISC_OF_STORMS, - - // pure decks - MISC_DECK_OF_ESCAPE, - MISC_DECK_OF_DESTRUCTION, - MISC_DECK_OF_DUNGEONS, - MISC_DECK_OF_SUMMONING, - MISC_DECK_OF_WONDERS, - MISC_DECK_OF_PUNISHMENT, - - // mixed decks - MISC_DECK_OF_WAR, - MISC_DECK_OF_CHANGES, - MISC_DECK_OF_DEFENSE, - - MISC_RUNE_OF_ZOT, - - NUM_MISCELLANY // mv: used for random generation -}; - -enum missile_type -{ - MI_STONE, // 0 - MI_ARROW, - MI_BOLT, - MI_DART, - MI_NEEDLE, - MI_LARGE_ROCK, - MI_SLING_BULLET, - MI_JAVELIN, - MI_THROWING_NET, - NUM_MISSILES, - MI_NONE // was MI_EGGPLANT... used for launch type detection -}; - -// properties of the monster class (other than resists/vulnerabilities) -enum mons_class_flags -{ - M_NO_FLAGS = 0, - - M_SPELLCASTER = (1<< 0), // any non-physical-attack powers, - M_ACTUAL_SPELLS = (1<< 1), // monster is a wizard, - M_PRIEST = (1<< 2), // monster is a priest - M_FIGHTER = (1<< 3), // monster is skilled fighter - - M_FLIES = (1<< 4), // will crash to ground if paralysed? - M_LEVITATE = (1<< 5), // ... but not if this is set - M_INVIS = (1<< 6), // is created invis - M_SEE_INVIS = (1<< 7), // can see invis - M_SENSE_INVIS = (1<< 8), // can sense invisible things - M_SPEAKS = (1<< 9), // uses talking code - M_CONFUSED = (1<<10), // monster is perma-confused, - M_BATTY = (1<<11), // monster is batty - M_SPLITS = (1<<12), // monster can split - M_AMPHIBIOUS = (1<<13), // monster can swim in water, - M_THICK_SKIN = (1<<14), // monster has more effective AC, - M_HUMANOID = (1<<15), // for Glamour - M_COLD_BLOOD = (1<<16), // susceptible to cold - M_WARM_BLOOD = (1<<17), // no effect currently - M_REGEN = (1<<18), // regenerates quickly - M_BURROWS = (1<<19), // monster digs through rock - M_EVIL = (1<<20), // monster vulnerable to holy spells - - M_UNIQUE = (1<<21), // monster is a unique - M_ACID_SPLASH = (1<<22), // Passive acid splash when hit. - - M_ARCHER = (1<<23), // gets various archery boosts - - M_SPECIAL_ABILITY = (1<<26), // XXX: eventually make these spells? - - M_NO_SKELETON = (1<<29), // boneless corpses - M_NO_EXP_GAIN = (1<<31) // worth 0 xp -}; - -// now saved in an unsigned long. -enum mon_resist_flags +enum mon_holy_type // matches (char) H_foo in mon-util.h, see: monster_holiness() { - MR_NO_FLAGS = 0, - - // resistances - // Notes: - // - negative energy is mostly handled via mons_has_life_force() - // - acid is handled mostly by genus (jellies) plus non-living - // - asphyx-resistance replaces hellfrost resistance. - MR_RES_ELEC = (1<< 0), - MR_RES_POISON = (1<< 1), - MR_RES_FIRE = (1<< 2), - MR_RES_HELLFIRE = (1<< 3), - MR_RES_COLD = (1<< 4), - MR_RES_ASPHYX = (1<< 5), - MR_RES_ACID = (1<< 6), - - // vulnerabilities - MR_VUL_ELEC = (1<< 7), - MR_VUL_POISON = (1<< 8), - MR_VUL_FIRE = (1<< 9), - MR_VUL_COLD = (1<<10), - - // melee armour resists/vulnerabilities - // XXX: how to do combos (bludgeon/slice, bludgeon/pierce) - MR_RES_PIERCE = (1<<11), - MR_RES_SLICE = (1<<12), - MR_RES_BLUDGEON = (1<<13), - - MR_VUL_PIERCE = (1<<14), - MR_VUL_SLICE = (1<<15), - MR_VUL_BLUDGEON = (1<<16) + MH_HOLY, // 0 - was -1 + MH_NATURAL, // 1 - was 0 + MH_UNDEAD, // 2 - was 1 + MH_DEMONIC, // 3 - was 2 + MH_NONLIVING, // golems and other constructs + MH_PLANT // plants }; enum targ_mode_type @@ -2429,51 +1746,6 @@ enum beh_type BEH_GUARD // creation only - monster is guard }; -enum mon_attack_type -{ - AT_NONE, - AT_HIT, // including weapon attacks - AT_BITE, - AT_STING, - AT_SPORE, - AT_TOUCH, - AT_ENGULF, - AT_CLAW, - AT_TAIL_SLAP, - AT_BUTT, - - AT_SHOOT // attack representing missile damage for M_ARCHER -}; - -enum mon_attack_flavour -{ - AF_PLAIN, - AF_ACID, - AF_BLINK, - AF_COLD, - AF_CONFUSE, - AF_DISEASE, - AF_DRAIN_DEX, - AF_DRAIN_STR, - AF_DRAIN_XP, - AF_ELEC, - AF_FIRE, - AF_HUNGER, - AF_MUTATE, - AF_BAD_MUTATE, - AF_PARALYSE, - AF_POISON, - AF_POISON_NASTY, - AF_POISON_MEDIUM, - AF_POISON_STRONG, - AF_POISON_STR, - AF_ROT, - AF_VAMPIRIC, - AF_KLOWN, - AF_DISTORT, - AF_RAGE -}; - enum mon_attitude_type { ATT_HOSTILE, // 0, default in most cases @@ -2481,18 +1753,6 @@ enum mon_attitude_type ATT_NEUTRAL }; -enum mon_event_type -{ - ME_EVAL, // 0, evaluate monster AI state - ME_DISTURB, // noisy - ME_ANNOY, // annoy at range - ME_ALERT, // alert to presence - ME_WHACK, // physical attack - ME_SHOT, // attack at range - ME_SCARE, // frighten monster - ME_CORNERED // cannot flee -}; - enum mon_flight_type { FLY_NOT, @@ -2523,43 +1783,6 @@ enum monster_flag_type MF_BAND_MEMBER = 0x2000 // Created as a member of a band }; -enum mon_dam_level_type -{ - MDAM_OKAY, - MDAM_LIGHTLY_DAMAGED, - MDAM_MODERATELY_DAMAGED, - MDAM_HEAVILY_DAMAGED, - MDAM_HORRIBLY_DAMAGED, - MDAM_ALMOST_DEAD, - MDAM_DEAD -}; - -enum mon_desc_type // things that cross categorical lines {dlb} -{ - MDSC_LEAVES_HIDE, // 0 - MDSC_REGENERATES, - MDSC_NOMSG_WOUNDS -}; - -enum mon_holy_type // matches (char) H_foo in mon-util.h, see: monster_holiness() -{ - MH_HOLY, // 0 - was -1 - MH_NATURAL, // 1 - was 0 - MH_UNDEAD, // 2 - was 1 - MH_DEMONIC, // 3 - was 2 - MH_NONLIVING, // golems and other constructs - MH_PLANT // plants -}; - -enum mon_intel_type // Must be in increasing intelligence order -{ - I_PLANT = 0, - I_INSECT, - I_ANIMAL, - I_NORMAL, - I_HIGH -}; - // Adding slots breaks saves. YHBW. enum mon_inv_type // (int) menv[].inv[] { @@ -2576,17 +1799,6 @@ enum mon_inv_type // (int) menv[].inv[] NUM_MONSTER_SLOTS }; -// order of these is important: -enum mon_itemuse_type -{ - MONUSE_NOTHING, - MONUSE_EATS_ITEMS, - MONUSE_OPEN_DOORS, - MONUSE_STARTING_EQUIPMENT, - MONUSE_WEAPONS_ARMOUR, - MONUSE_MAGIC_ITEMS -}; - // XXX: These still need to be applied in mon-data.h enum mon_spellbook_type { @@ -2806,14 +2018,6 @@ enum object_class_type // (unsigned char) mitm[].base_type // for blanket random sub_type .. see dungeon::items() }; -enum object_selector -{ - OSEL_ANY = -1, - OSEL_WIELD = -2, - OSEL_UNIDENT = -3, - OSEL_EQUIP = -4 -}; - enum operation_types { OPER_WIELD = 'w', @@ -2847,90 +2051,6 @@ enum player_size_type PSIZE_PROFILE // profile only (for stealth checks) }; -enum portal_type -{ - PORTAL_NONE = 0, - PORTAL_LABYRINTH, - PORTAL_HELL, - PORTAL_ABYSS, - PORTAL_PANDEMONIUM, - NUM_PORTALS -}; - -// [dshaligram] If you edit potion colours/descriptions, also update -// itemname.cc. -enum potion_description_colour_type -{ - PDC_CLEAR, - PDC_BLUE, - PDC_BLACK, - PDC_SILVERY, - PDC_CYAN, - PDC_PURPLE, - PDC_ORANGE, - PDC_INKY, - PDC_RED, - PDC_YELLOW, - PDC_GREEN, - PDC_BROWN, - PDC_PINK, - PDC_WHITE, - PDC_NCOLOURS -}; - -// [dshaligram] If you edit potion colours/descriptions, also update -// itemname.cc. -enum potion_description_qualifier_type -{ - PDQ_NONE, - PDQ_BUBBLING, - PDQ_FUMING, - PDQ_FIZZY, - PDQ_VISCOUS, - PDQ_LUMPY, - PDQ_SMOKY, - PDQ_GLOWING, - PDQ_SEDIMENTED, - PDQ_METALLIC, - PDQ_MURKY, - PDQ_GLUGGY, - PDQ_OILY, - PDQ_SLIMY, - PDQ_EMULSIFIED, - PDQ_NQUALS -}; - -enum potion_type -{ - POT_HEALING, // 0 - POT_HEAL_WOUNDS, - POT_SPEED, - POT_MIGHT, - POT_GAIN_STRENGTH, - POT_GAIN_DEXTERITY, // 5 - POT_GAIN_INTELLIGENCE, - POT_LEVITATION, - POT_POISON, - POT_SLOWING, - POT_PARALYSIS, // 10 - POT_CONFUSION, - POT_INVISIBILITY, - POT_PORRIDGE, - POT_DEGENERATION, - POT_DECAY, // 15 - POT_WATER, - POT_EXPERIENCE, - POT_MAGIC, - POT_RESTORE_ABILITIES, - POT_STRONG_POISON, // 20 - POT_BERSERK_RAGE, - POT_CURE_MUTATION, - POT_MUTATION, - POT_BLOOD, - POT_RESISTANCE, - NUM_POTIONS -}; - enum pronoun_type { PRONOUN_CAP, // 0 @@ -2940,117 +2060,6 @@ enum pronoun_type PRONOUN_REFLEXIVE // 4 (reflexive is always lowercase) }; -enum proximity_type // proximity to player to create monster -{ - PROX_ANYWHERE, - PROX_CLOSE_TO_PLAYER, - PROX_AWAY_FROM_PLAYER, - PROX_NEAR_STAIRS -}; - -enum randart_prop_type -{ - RAP_BRAND, // 0 - RAP_AC, - RAP_EVASION, - RAP_STRENGTH, - RAP_INTELLIGENCE, - RAP_DEXTERITY, // 5 - RAP_FIRE, - RAP_COLD, - RAP_ELECTRICITY, - RAP_POISON, - RAP_NEGATIVE_ENERGY, // 10 - RAP_MAGIC, - RAP_EYESIGHT, - RAP_INVISIBLE, - RAP_LEVITATE, - RAP_BLINK, // 15 - RAP_CAN_TELEPORT, - RAP_BERSERK, - RAP_MAPPING, - RAP_NOISES, - RAP_PREVENT_SPELLCASTING, // 20 - RAP_CAUSE_TELEPORTATION, - RAP_PREVENT_TELEPORTATION, - RAP_ANGRY, - RAP_METABOLISM, - RAP_MUTAGENIC, // 25 - RAP_ACCURACY, - RAP_DAMAGE, - RAP_CURSED, - RAP_STEALTH, - RAP_NUM_PROPERTIES -}; - -enum read_book_action_type -{ - RBOOK_USE_STAFF, - RBOOK_MEMORISE, - RBOOK_READ_SPELL -}; - -enum run_check_type -{ - RCHECK_LEFT, - RCHECK_FRONT, - RCHECK_RIGHT -}; - -enum run_dir_type -{ - RDIR_UP = 0, - RDIR_UP_RIGHT, - RDIR_RIGHT, - RDIR_DOWN_RIGHT, - RDIR_DOWN, - RDIR_DOWN_LEFT, - RDIR_LEFT, - RDIR_UP_LEFT, - RDIR_REST -}; - -enum run_mode_type -{ - RMODE_INTERLEVEL = -4, // Interlevel travel (Ctrl+G) - RMODE_EXPLORE_GREEDY = -3, // Explore + grab items (Tab/Ctrl+I) - RMODE_EXPLORE = -2, // Exploring (Ctrl+O) - RMODE_TRAVEL = -1, // Classic or Plain Old travel - RMODE_NOT_RUNNING = 0, // must remain equal to 0 - RMODE_CONTINUE, - RMODE_START, - RMODE_REST_DURATION = 100 -}; - -enum rune_type -{ - // Note: that runes DIS-SWAMP have the same numeric value as the branch - RUNE_DIS = BRANCH_DIS, - RUNE_GEHENNA = BRANCH_GEHENNA, - RUNE_COCYTUS = BRANCH_COCYTUS, - RUNE_TARTARUS = BRANCH_TARTARUS, - RUNE_SLIME_PITS = BRANCH_SLIME_PITS, - RUNE_VAULTS = BRANCH_VAULTS, - RUNE_SNAKE_PIT = BRANCH_SNAKE_PIT, - RUNE_ELVEN_HALLS = BRANCH_ELVEN_HALLS, // unused - RUNE_TOMB = BRANCH_TOMB, - RUNE_SWAMP = BRANCH_SWAMP, - RUNE_SHOALS = BRANCH_SHOALS, - - // Runes 50 and 51 are for Pandemonium (general demon) and the Abyss - RUNE_DEMONIC = 50, - RUNE_ABYSSAL, - - // Runes 60-63 correspond to the Pandemonium demonlords, - // and are equal to the corresponding vault. - RUNE_MNOLEG = 60, - RUNE_LOM_LOBON, - RUNE_CEREBOV, - RUNE_GLOORX_VLOQ, - NUM_RUNE_TYPES, // should always be last - RUNE_NONE -}; - enum score_format_type { SCORE_TERSE, // one line @@ -3058,34 +2067,6 @@ enum score_format_type SCORE_VERBOSE // everything (dates, times, god, etc) }; -enum scroll_type -{ - SCR_IDENTIFY, // 0 - SCR_TELEPORTATION, - SCR_FEAR, - SCR_NOISE, - SCR_REMOVE_CURSE, - SCR_DETECT_CURSE, // 5 - SCR_SUMMONING, - SCR_ENCHANT_WEAPON_I, - SCR_ENCHANT_ARMOUR, - SCR_TORMENT, - SCR_RANDOM_USELESSNESS, // 10 - SCR_CURSE_WEAPON, - SCR_CURSE_ARMOUR, - SCR_IMMOLATION, - SCR_BLINKING, - SCR_PAPER, // 15 - SCR_MAGIC_MAPPING, - SCR_FORGETFULNESS, - SCR_ACQUIREMENT, - SCR_ENCHANT_WEAPON_II, - SCR_VORPALISE_WEAPON, // 20 - SCR_RECHARGING, - SCR_ENCHANT_WEAPON_III, - NUM_SCROLLS -}; - enum shop_type // (unsigned char) env.sh_type[], item_in_shop(), in_a_shop() { SHOP_WEAPON, // 0 @@ -3105,34 +2086,6 @@ enum shop_type // (unsigned char) env.sh_type[], item_in_shop(), in_a_shop() SHOP_RANDOM = 255 // keep set at 255 for now {dlb} }; -enum shout_type -{ - S_SILENT, // silent - S_SHOUT, // shout - S_BARK, // bark - S_SHOUT2, // shout twice (e.g. two-headed ogres) - S_ROAR, // roar - S_SCREAM, // scream - S_BELLOW, // bellow (?) - S_SCREECH, // screech - S_BUZZ, // buzz - S_MOAN, // moan - S_WHINE, // irritating whine (mosquito) - S_CROAK, // frog croak - S_GROWL, // for bears - S_HISS, // for snakes and lizards - - // Loudness setting for shouts that are only defined in dat/shout.txt - S_VERY_SOFT, - S_SOFT, - S_NORMAL, - S_LOUD, - S_VERY_LOUD, - - NUM_SHOUTS, - S_RANDOM -}; - // These are often addressed relative to each other (esp. delta SIZE_MEDIUM) enum size_type { @@ -3197,61 +2150,6 @@ enum skill_type SK_NONE }; -enum special_armour_type -{ - SPARM_NORMAL, // 0 - SPARM_RUNNING, - SPARM_FIRE_RESISTANCE, - SPARM_COLD_RESISTANCE, - SPARM_POISON_RESISTANCE, - SPARM_SEE_INVISIBLE, // 5 - SPARM_DARKNESS, - SPARM_STRENGTH, - SPARM_DEXTERITY, - SPARM_INTELLIGENCE, - SPARM_PONDEROUSNESS, // 10 - SPARM_LEVITATION, - SPARM_MAGIC_RESISTANCE, - SPARM_PROTECTION, - SPARM_STEALTH, - SPARM_RESISTANCE, // 15 - SPARM_POSITIVE_ENERGY, - SPARM_ARCHMAGI, - SPARM_PRESERVATION, // 18 - SPARM_RANDART_I = 25, // must remain at 25 for now - how high do they go? {dlb} - SPARM_RANDART_II = 26, // 26 - SPARM_RANDART_III = 27, // 27 - SPARM_RANDART_IV = 28, // 28 - SPARM_RANDART_V = 29 // 29 - highest value found thus far {dlb} -}; - -enum special_missile_type // to separate from weapons in general {dlb} -{ - SPMSL_NORMAL, // 0 - SPMSL_FLAME, // 1 - SPMSL_ICE, // 2 - SPMSL_POISONED, // 3 - SPMSL_POISONED_II, // 4 - unused - SPMSL_CURARE // 5 -}; - -enum special_room_type -{ - SROOM_LAIR_ORC, // 0 - SROOM_LAIR_KOBOLD, - SROOM_TREASURY, - SROOM_BEEHIVE, - SROOM_JELLY_PIT, - SROOM_MORGUE, - NUM_SPECIAL_ROOMS // 5 - must remain final member {dlb} -}; - -enum special_ring_type // jewellery mitm[].special values -{ - SPRING_RANDART = 200, - SPRING_UNRANDART = 201 -}; - // order is important on these (see player_speed()) enum speed_type { @@ -3260,74 +2158,6 @@ enum speed_type SPEED_HASTED }; -enum brand_type // equivalent to (you.inv[].special or mitm[].special) % 30 -{ - SPWPN_NORMAL, // 0 - SPWPN_FLAMING, - SPWPN_FREEZING, - SPWPN_HOLY_WRATH, - SPWPN_ELECTROCUTION, - SPWPN_ORC_SLAYING, // 5 - SPWPN_VENOM, - SPWPN_PROTECTION, - SPWPN_DRAINING, - SPWPN_SPEED, - SPWPN_VORPAL, // 10 - SPWPN_FLAME, - SPWPN_FROST, - SPWPN_VAMPIRICISM, - SPWPN_DISRUPTION, - SPWPN_PAIN, // 15 - SPWPN_DISTORTION, - SPWPN_REACHING, // 17 - SPWPN_RETURNING, - SPWPN_CONFUSE, - SPWPN_RANDART_I = 25, // 25 - SPWPN_RANDART_II, - SPWPN_RANDART_III, - SPWPN_RANDART_IV, - SPWPN_RANDART_V, - NUM_SPECIAL_WEAPONS, - SPWPN_DUMMY_CRUSHING, // ONLY TEMPORARY USAGE -- converts to VORPAL - - // everything above this point is a special artefact wield: - SPWPN_SINGING_SWORD = 181, // 181 - SPWPN_WRATH_OF_TROG, - SPWPN_SCYTHE_OF_CURSES, - SPWPN_MACE_OF_VARIABILITY, - SPWPN_GLAIVE_OF_PRUNE, // 185 - SPWPN_SCEPTRE_OF_TORMENT, - SPWPN_SWORD_OF_ZONGULDROK, - - // these three are not generated randomly {dlb} - SPWPN_SWORD_OF_CEREBOV, - SPWPN_STAFF_OF_DISPATER, - SPWPN_SCEPTRE_OF_ASMODEUS, // 190 - - SPWPN_SWORD_OF_POWER, - SPWPN_KNIFE_OF_ACCURACY, - SPWPN_STAFF_OF_OLGREB, - SPWPN_VAMPIRES_TOOTH, - SPWPN_STAFF_OF_WUCAD_MU // 195 -}; - -enum special_wield_type // you.special_wield -{ - SPWLD_NONE, // 0 - SPWLD_SING, - SPWLD_TROG, - SPWLD_CURSE, - SPWLD_VARIABLE, // 4 - SPWLD_PRUNE, // 5 - implicit in it_use3::special_wielded() {dlb} - SPWLD_TORMENT, // 6 - SPWLD_ZONGULDROK, - SPWLD_POWER, - SPWLD_WUCAD_MU, // 9 - SPWLD_OLGREB, // 10 - SPWLD_SHADOW = 50, // 50 - SPWLD_NOISE // further differentiation useless -> removed (jpeg) -}; - enum species_type { SP_HUMAN = 1, // 1 @@ -3590,47 +2420,6 @@ enum spell_type SPELL_NO_SPELL = 250 // 255 - added 22jan2000 {dlb} }; -enum spflag_type -{ - SPFLAG_NONE = 0x0000, - SPFLAG_DIR_OR_TARGET = 0x0001, // use DIR_NONE targeting - SPFLAG_TARGET = 0x0002, // use DIR_TARGET targeting - SPFLAG_GRID = 0x0004, // use DIR_GRID targeting - SPFLAG_DIR = 0x0008, // use DIR_DIR targeting - SPFLAG_TARGETING_MASK = 0x000f, // used to test for targeting - SPFLAG_HELPFUL = 0x0010, // TARG_FRIENDS used - SPFLAG_NOT_SELF = 0x0020, // aborts on isMe - SPFLAG_UNHOLY = 0x0040 // counts at "unholy" -}; - -enum spret_type -{ - SPRET_ABORT = 0, // should be left as 0 - SPRET_FAIL, - SPRET_SUCCESS -}; - -enum spschool_flag_type -{ - SPTYP_NONE = 0, // "0" is reserved for no type at all {dlb} - SPTYP_CONJURATION = 1, // was 11, but only for old typematch routine {dlb} - SPTYP_ENCHANTMENT = 1<<1, - SPTYP_FIRE = 1<<2, - SPTYP_ICE = 1<<3, - SPTYP_TRANSMIGRATION = 1<<4, - SPTYP_NECROMANCY = 1<<5, - SPTYP_SUMMONING = 1<<6, - SPTYP_DIVINATION = 1<<7, - SPTYP_TRANSLOCATION = 1<<8, - SPTYP_POISON = 1<<9, - SPTYP_EARTH = 1<<10, - SPTYP_AIR = 1<<11, - SPTYP_HOLY = 1<<12, //jmf: moved to accomodate "random" miscast f/x - SPTYP_LAST_EXPONENT = 12, //jmf: ``NUM_SPELL_TYPES'' kinda useless - NUM_SPELL_TYPES = 14, - SPTYP_RANDOM = 1<<14 -}; - enum slot_select_mode { SS_FORWARD = 0, @@ -3647,107 +2436,6 @@ enum stat_type STAT_RANDOM = 255 // leave at 255, added for increase_stats() handling {dlb} }; -enum status_redraw_flag_type -{ - REDRAW_HUNGER = 0x00000001, - REDRAW_BURDEN = 0x00000002, - REDRAW_LINE_1_MASK = 0x00000003, - - REDRAW_PRAYER = 0x00000100, - REDRAW_REPEL_UNDEAD = 0x00000200, - REDRAW_BREATH = 0x00000400, - REDRAW_REPEL_MISSILES = 0x00000800, - REDRAW_REGENERATION = 0x00001000, - REDRAW_INSULATION = 0x00002000, - REDRAW_FLY = 0x00004000, - REDRAW_INVISIBILITY = 0x00008000, - REDRAW_LINE_2_MASK = 0x0000ff00, - - REDRAW_CONFUSION = 0x00010000, - REDRAW_POISONED = 0x00020000, - REDRAW_LIQUID_FLAMES = 0x00040000, - REDRAW_DISEASED = 0x00080000, - REDRAW_CONTAMINATED = 0x00100000, - REDRAW_SWIFTNESS = 0x00200000, - REDRAW_SPEED = 0x00400000, - REDRAW_LINE_3_MASK = 0x007f0000 -}; - -enum stave_type -{ - // staves - STAFF_WIZARDRY = 0, - STAFF_POWER, - STAFF_FIRE, - STAFF_COLD, - STAFF_POISON, - STAFF_ENERGY, - STAFF_DEATH, - STAFF_CONJURATION, - STAFF_ENCHANTMENT, - STAFF_SUMMONING, - STAFF_AIR, - STAFF_EARTH, - STAFF_CHANNELING, - // rods - STAFF_SMITING, // must be first rod! - STAFF_SPELL_SUMMONING, - STAFF_DESTRUCTION_I, - STAFF_DESTRUCTION_II, - STAFF_DESTRUCTION_III, - STAFF_DESTRUCTION_IV, - STAFF_WARDING, - STAFF_DISCOVERY, - STAFF_DEMONOLOGY, - STAFF_STRIKING, - STAFF_VENOM, - NUM_STAVES // must remain last member {dlb} -}; - -// beam[].type - note that this (and its variants) also accepts values from other enums - confusing {dlb} -enum zap_symbol_type -{ - SYM_SPACE = ' ', // 32 - SYM_FLASK = '!', // 33 - SYM_BOLT = '#', // 35 - SYM_CHUNK = '%', // 37 - SYM_OBJECT = '(', // 40 - actually used for books, but... {dlb} - SYM_WEAPON = ')', // 41 - SYM_ZAP = '*', // 42 - SYM_BURST = '+', // 43 - SYM_STICK = '/', // 47 - SYM_TRINKET = '=', // 61 - SYM_SCROLL = '?', // 63 - SYM_DEBUG = 'X', // 88 - SYM_ARMOUR = '[', // 91 - SYM_MISSILE = '`', // 96 - SYM_EXPLOSION = '#' -}; - -enum tag_type // used during save/load process to identify data blocks -{ - TAG_VERSION = 0, // should NEVER be read in! - TAG_YOU = 1, // 'you' structure - TAG_YOU_ITEMS, // your items - TAG_YOU_DUNGEON, // dungeon specs (stairs, branches, features) - TAG_LEVEL, // various grids & clouds - TAG_LEVEL_ITEMS, // items/traps - TAG_LEVEL_MONSTERS, // monsters - TAG_GHOST, // ghost - TAG_LEVEL_ATTITUDE, // monster attitudes - TAG_LOST_MONSTERS, // monsters in transit - NUM_TAGS -}; - -enum tag_file_type // file types supported by tag system -{ - TAGTYPE_PLAYER=0, // Foo.sav - TAGTYPE_LEVEL, // Foo.00a, .01a, etc. - TAGTYPE_GHOST, // bones.xxx - - TAGTYPE_PLAYER_NAME // Used only to read the player name -}; - enum targeting_type { DIR_NONE, @@ -3764,21 +2452,6 @@ enum torment_source_type TORMENT_SPELL = -5 // SPELL_SYMBOL_OF_TORMENT }; -enum transformation_type -{ - TRAN_NONE, // 0 - TRAN_SPIDER, - TRAN_BLADE_HANDS, - TRAN_STATUE, - TRAN_ICE_BEAST, - TRAN_DRAGON, // 5 - TRAN_LICH, - TRAN_SERPENT_OF_HELL, - TRAN_AIR, - TRAN_BAT, - NUM_TRANSFORMATIONS // must remain last member {dlb} -}; - enum trap_type // env.trap_type[] { TRAP_DART, // 0 @@ -3868,16 +2541,6 @@ enum tutorial_types TUT_TYPES_NUM // 3 }; -enum unarmed_attack_type -{ - UNAT_NO_ATTACK, // 0 - UNAT_KICK, - UNAT_HEADBUTT, - UNAT_TAILSLAP, - UNAT_PUNCH, - UNAT_BITE -}; - enum undead_state_type // you.is_undead { US_ALIVE = 0, @@ -3892,150 +2555,6 @@ enum unique_item_status_type UNIQ_LOST_IN_ABYSS = 2 }; -enum vorpal_damage_type -{ - // Types of damage a weapon can do... currently assuming that anything - // with BLUDGEON always does "AND" with any other specified types, - // and and sets not including BLUDGEON are "OR". - DAM_BASH = 0x0000, // non-melee weapon blugeoning - DAM_BLUDGEON = 0x0001, // crushing - DAM_SLICE = 0x0002, // slicing/chopping - DAM_PIERCE = 0x0004, // stabbing/piercing - DAM_WHIP = 0x0008, // whip slashing (no butcher) - - // These are used for vorpal weapon desc (don't set more than one) - DVORP_NONE = 0x0000, // used for non-melee weapons - DVORP_CRUSHING = 0x1000, - DVORP_SLICING = 0x2000, - DVORP_PIERCING = 0x3000, - DVORP_CHOPPING = 0x4000, // used for axes - DVORP_SLASHING = 0x5000, // used for whips - DVORP_STABBING = 0x6000, // used for knives/daggers - - DVORP_CLAWING = 0x7000, // claw damage - - // These are shortcuts to tie vorpal/damage types for easy setting... - // as above, setting more than one vorpal type is trouble. - DAMV_NON_MELEE = DVORP_NONE | DAM_BASH, // launchers - DAMV_CRUSHING = DVORP_CRUSHING | DAM_BLUDGEON, - DAMV_SLICING = DVORP_SLICING | DAM_SLICE, - DAMV_PIERCING = DVORP_PIERCING | DAM_PIERCE, - DAMV_CHOPPING = DVORP_CHOPPING | DAM_SLICE, - DAMV_SLASHING = DVORP_SLASHING | DAM_WHIP, - DAMV_STABBING = DVORP_STABBING | DAM_PIERCE, - - DAM_MASK = 0x0fff, // strips vorpal specification - DAMV_MASK = 0xf000 // strips non-vorpal specification -}; - -// NOTE: This order is very special! Its basically the same as ZAP_*, -// and there are bits of the code that still use that fact.. see zap_wand(). -enum wand_type // mitm[].subtype -{ - WAND_FLAME, // 0 - WAND_FROST, - WAND_SLOWING, - WAND_HASTING, - WAND_MAGIC_DARTS, - WAND_HEALING, // 5 - WAND_PARALYSIS, - WAND_FIRE, - WAND_COLD, - WAND_CONFUSION, - WAND_INVISIBILITY, // 10 - WAND_DIGGING, - WAND_FIREBALL, - WAND_TELEPORTATION, - WAND_LIGHTNING, - WAND_POLYMORPH_OTHER, // 15 - WAND_ENSLAVEMENT, - WAND_DRAINING, - WAND_RANDOM_EFFECTS, - WAND_DISINTEGRATION, - NUM_WANDS // must remain last member {dlb} -}; - -enum weapon_type -{ -// Base weapons - WPN_CLUB, // 0 - WPN_MACE, - WPN_FLAIL, - WPN_DAGGER, - WPN_MORNINGSTAR, - WPN_SHORT_SWORD, // 5 - WPN_LONG_SWORD, - WPN_GREAT_SWORD, - WPN_SCIMITAR, - WPN_HAND_AXE, - WPN_BATTLEAXE, // 10 - WPN_SPEAR, - WPN_HALBERD, - WPN_SLING, - WPN_BOW, - WPN_CROSSBOW, // 15 - WPN_HAND_CROSSBOW, - WPN_GLAIVE, - WPN_QUARTERSTAFF, -// these three not created ordinarily - WPN_SCYTHE, - WPN_GIANT_CLUB, // 20 - WPN_GIANT_SPIKED_CLUB, -// "rare" weapons - some have special cases and are uncommon - WPN_EVENINGSTAR, - WPN_QUICK_BLADE, - WPN_KATANA, - WPN_EXECUTIONERS_AXE, // 25 - WPN_DOUBLE_SWORD, - WPN_TRIPLE_SWORD, - WPN_HAMMER, - WPN_ANCUS, - WPN_WHIP, // 30 - WPN_SABRE, - WPN_DEMON_BLADE, - WPN_DEMON_WHIP, - WPN_DEMON_TRIDENT, - WPN_BROAD_AXE, // 35 -// base items (continued) - WPN_WAR_AXE, - WPN_TRIDENT, - WPN_SPIKED_FLAIL, - WPN_GREAT_MACE, - WPN_DIRE_FLAIL, // 40 - WPN_KNIFE, - WPN_BLOWGUN, - WPN_FALCHION, - WPN_BLESSED_BLADE, // 44 - WPN_LONGBOW, - WPN_LAJATANG, - WPN_LOCHABER_AXE, - - NUM_WEAPONS, // 48 - must be last regular member {dlb} - -// special cases - WPN_UNARMED = 500, // 500 - WPN_UNKNOWN = 1000, // 1000 - WPN_RANDOM -}; - -enum weapon_description_type -{ - DWPN_PLAIN = 0, // 0 - added to round out enum {dlb} - DWPN_RUNED = 1, // 1 - DWPN_GLOWING, - DWPN_ORCISH, - DWPN_ELVEN, - DWPN_DWARVEN // 5 -}; - -enum weapon_property_type -{ - PWPN_DAMAGE, // 0 - PWPN_HIT, - PWPN_SPEED, - PWPN_ACQ_WEIGHT -}; - #ifdef WIZARD enum wizard_option_type @@ -4047,86 +2566,4 @@ enum wizard_option_type #endif -enum zap_type -{ - ZAP_FLAME, // 0 - ZAP_FROST, - ZAP_SLOWING, - ZAP_HASTING, - ZAP_MAGIC_DARTS, - ZAP_HEALING, // 5 - ZAP_PARALYSIS, - ZAP_FIRE, - ZAP_COLD, - ZAP_CONFUSION, - ZAP_INVISIBILITY, // 10 - ZAP_DIGGING, - ZAP_FIREBALL, - ZAP_TELEPORTATION, - ZAP_LIGHTNING, - ZAP_POLYMORPH_OTHER, // 15 - ZAP_VENOM_BOLT, - ZAP_NEGATIVE_ENERGY, - ZAP_CRYSTAL_SPEAR, - ZAP_BEAM_OF_ENERGY, - ZAP_MYSTIC_BLAST, // 20 - ZAP_ENSLAVEMENT, - ZAP_PAIN, - ZAP_STICKY_FLAME, - ZAP_DISPEL_UNDEAD, - ZAP_CLEANSING_FLAME, // 25 - ZAP_BONE_SHARDS, - ZAP_BANISHMENT, - ZAP_DEGENERATION, - ZAP_STING, - ZAP_HELLFIRE, // 30 - ZAP_IRON_BOLT, - ZAP_STRIKING, - ZAP_STONE_ARROW, - ZAP_ELECTRICITY, - ZAP_ORB_OF_ELECTRICITY, // 35 - ZAP_SPIT_POISON, - ZAP_DEBUGGING_RAY, - ZAP_BREATHE_FIRE, - ZAP_BREATHE_FROST, - ZAP_BREATHE_ACID, // 40 - ZAP_BREATHE_POISON, - ZAP_BREATHE_POWER, - ZAP_ENSLAVE_UNDEAD, - ZAP_AGONY, - ZAP_DISRUPTION, // 45 - ZAP_DISINTEGRATION, // 46 - // ZAP_ISKS_CROSS, // 47: Isk's Cross -- commented out, deprecated {dlb} - ZAP_BREATHE_STEAM = 48, // 48 - ZAP_CONTROL_DEMON, - ZAP_ORB_OF_FRAGMENTATION, // 50 - ZAP_ICE_BOLT, - ZAP_ICE_STORM, - ZAP_BACKLIGHT, //jmf: added next bunch 19mar2000 - ZAP_SLEEP, - ZAP_FLAME_TONGUE, - ZAP_SANDBLAST, - ZAP_SMALL_SANDBLAST, - ZAP_MAGMA, - ZAP_POISON_ARROW, - ZAP_BREATHE_STICKY_FLAME, - ZAP_BREATHE_LIGHTNING, - ZAP_PETRIFY, - ZAP_HELLFROST, - NUM_ZAPS // must remain last member {dlb} -}; - -enum zap_count_type -{ - ZAPCOUNT_EMPTY = -1, - ZAPCOUNT_UNKNOWN = -2 -}; - -enum zombie_size_type -{ - Z_NOZOMBIE, - Z_SMALL, - Z_BIG -}; - #endif // ENUM_H diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 7e64f69916..20bad76b20 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -29,9 +29,8 @@ #include "defines.h" #include "enum.h" #include "FixAry.h" -#include "Kills.h" #include "libutil.h" -#include "message.h" +#include "mpr.h" #define INFO_SIZE 200 // size of message buffers #define ITEMNAME_SIZE 200 // size of item names/shop names/etc @@ -60,45 +59,6 @@ const int kPathLen = 256; // penalty (Xom's granted or from a deck of cards). #define NO_BERSERK_PENALTY -1 -struct monsters; -struct ait_hp_loss; - -struct activity_interrupt_data -{ - activity_interrupt_payload_type apt; - const void *data; - std::string context; - - activity_interrupt_data() - : apt(AIP_NONE), data(NULL), context() - { - } - activity_interrupt_data(const int *i) - : apt(AIP_INT), data(i), context() - { - } - activity_interrupt_data(const char *s) - : apt(AIP_STRING), data(s), context() - { - } - activity_interrupt_data(const std::string &s) - : apt(AIP_STRING), data(s.c_str()), context() - { - } - activity_interrupt_data(const monsters *m, const std::string &ctx = "") - : apt(AIP_MONSTER), data(m), context(ctx) - { - } - activity_interrupt_data(const ait_hp_loss *ahl) - : apt(AIP_HP_LOSS), data(ahl), context() - { - } - activity_interrupt_data(const activity_interrupt_data &a) - : apt(a.apt), data(a.data), context(a.context) - { - } -}; - class item_def; class melee_attack; class coord_def; @@ -223,14 +183,6 @@ public: } }; -struct ait_hp_loss -{ - int hp; - int hurt_type; // KILLED_BY_POISON, etc. - - ait_hp_loss(int _hp, int _ht) : hp(_hp), hurt_type(_ht) { } -}; - struct coord_def { int x; @@ -351,126 +303,6 @@ struct dice_def dice_def( int n = 0, int s = 0 ) : num(n), size(s) {} }; -struct ray_def -{ -public: - double accx; - double accy; - double slope; - // Quadrant 1: down-right - // Quadrant 2: down-left - // Quadrant 3: up-left - // Quadrant 4: up-right - int quadrant; - int fullray_idx; // for cycling: where did we come from? - -public: - ray_def(); - int x() const { return static_cast<int>(accx); } - int y() const { return static_cast<int>(accy); } - coord_def pos() const { return coord_def(x(), y()); } - - // returns the direction taken (0,1,2) - int advance(bool shorten = false, const coord_def *p = NULL); - int advance_through(const coord_def &point); - void advance_and_bounce(); - void regress(); - -private: - int raw_advance(); - double reflect(bool x, double oldc, double newc) const; - double reflect(double x, double c) const; - void set_reflect_point(const double oldx, const double oldy, - double *newx, double *newy, - bool blocked_x, bool blocked_y); -}; - -// output from direction() function: -struct dist -{ - bool isValid; // valid target chosen? - bool isTarget; // target (true), or direction (false)? - bool isMe; // selected self (convenience: tx == you.x_pos, - // ty == you.y_pos) - bool isEndpoint; // Does the player want the attack to stop at (tx,ty)? - bool isCancel; // user cancelled (usually <ESC> key) - bool choseRay; // user wants a specific beam - int tx,ty; // target x,y or logical extension of beam to map edge - int dx,dy; // delta x and y if direction - always -1,0,1 - ray_def ray; // ray chosen if necessary - - // internal use - ignore - int prev_target; // previous target - - // target - source (source == you.pos()) - coord_def target() const - { - return coord_def(tx, ty); - } -}; - -struct bolt -{ - // INPUT parameters set by caller - int range; // minimum range - int rangeMax; // maximum range - int type; // missile gfx - int colour; - int flavour; - int source_x, source_y; // beam origin - dice_def damage; - int ench_power, hit; - int target_x, target_y; // intended target - char thrower; // what kind of thing threw this? - char ex_size; // explosion radius (0==none) - int beam_source; // NON_MONSTER or monster index # - std::string name; - bool is_beam; // beams? (can hits multiple targets?) - bool is_explosion; - bool is_big_cloud; // expands into big_cloud at endpoint - bool is_enchant; // no block/dodge, but mag resist - bool is_energy; // mostly energy/non-physical attack - bool is_launched; // was fired from launcher? - bool is_thrown; // was thrown from hand? - bool target_first; // targeting by direction - bool aimed_at_spot; // aimed at (x,y), should not cross - std::string aux_source; // source of KILL_MISC beams - - // OUTPUT parameters (tracing, ID) - bool obvious_effect; // did an 'obvious' effect happen? - bool effect_known; // did we _know_ this would happen? - int fr_count, foe_count; // # of times a friend/foe is "hit" - int fr_power, foe_power; // total levels/hit dice affected - - // INTERNAL use - should not usually be set outside of beam.cc - bool is_tracer; // is this a tracer? - bool aimed_at_feet; // this was aimed at self! - bool msg_generated; // an appropriate msg was already mpr'd - bool in_explosion_phase; // explosion phase (as opposed to beam phase) - bool smart_monster; // tracer firer can guess at other mons. resists? - bool can_see_invis; // tracer firer can see invisible? - mon_attitude_type attitude; // attitude of whoever fired tracer - int foe_ratio; // 100* foe ratio (see mons_should_fire()) - bool chose_ray; // do we want a specific ray? - ray_def ray; // shoot on this specific ray - -public: - // A constructor to try and fix some of the bugs that occur because - // this struct never seems to be properly initialized. Definition - // is over in beam.cc. - bolt(); - - void set_target(const dist &); - - // Returns YOU_KILL or MON_KILL, depending on the source of the beam. - killer_type killer() const; - - coord_def target() const - { - return (coord_def(target_x, target_y)); - } -}; - struct run_check_dir { unsigned char grid; @@ -540,26 +372,6 @@ private: bool terse, bool ident ) const; }; -class input_history -{ -public: - input_history(size_t size); - - void new_input(const std::string &s); - void clear(); - - const std::string *prev(); - const std::string *next(); - - void go_end(); -private: - typedef std::list<std::string> string_list; - - string_list history; - string_list::iterator pos; - size_t maxsize; -}; - class runrest { public: @@ -606,6 +418,8 @@ private: typedef std::vector<delay_queue_item> delay_queue_type; +class KillMaster; + class player : public actor { public: @@ -736,7 +550,16 @@ public: FixedVector<unique_item_status_type, 50> unique_items; FixedVector<bool, NUM_MONSTERS> unique_creatures; - KillMaster kills; + // NOTE: The kills member is a pointer to a KillMaster object, + // rather than the object itself, so that we can get away with + // just a foward declare of the KillMaster class, rather than + // having to #include Kills.h and thus make every single .cc file + // dependant on Kills.h. Having a pointer means that we have + // to do our own implementations of copying the player object, + // since the default implementations will lead to the kills member + // pointing to freed memory, or worse yet lead to the same piece of + // memory being freed twice. + KillMaster* kills; level_area_type level_type; std::string level_type_name; @@ -797,6 +620,11 @@ public: public: player(); + player(const player &other); + ~player(); + + void copy_from(const player &other); + void init(); bool is_valid() const; @@ -928,21 +756,6 @@ public: void clear() { init(SPELL_NO_SPELL); } }; -struct mon_attack_def -{ - mon_attack_type type; - mon_attack_flavour flavour; - int damage; - - static mon_attack_def attk(int damage, - mon_attack_type type = AT_HIT, - mon_attack_flavour flav = AF_PLAIN) - { - mon_attack_def def = { type, flav, damage }; - return (def); - } -}; - class ghost_demon; class level_id; @@ -1328,48 +1141,6 @@ public: extern struct crawl_environment env; -// Track various aspects of Crawl game state. -struct game_state -{ - bool mouse_enabled; // True if mouse input is currently relevant. - - bool waiting_for_command; // True when the game is waiting for a command. - bool terminal_resized; // True if the term was resized and we need to - // take action to handle it. - - bool io_inited; // Is curses or the equivalent initialised? - bool need_save; // Set to true when game has started. - bool saving_game; // Set to true while in save_game. - bool updating_scores; // Set to true while updating hiscores. - - int seen_hups; // Set to true if SIGHUP received. - - bool map_stat_gen; // Set if we're generating stats on maps. - - bool unicode_ok; // Is unicode support available? - - std::string (*glyph2strfn)(unsigned glyph); - int (*multibyte_strlen)(const std::string &s); - void (*terminal_resize_handler)(); - void (*terminal_resize_check)(); - - game_state() : mouse_enabled(false), waiting_for_command(false), - terminal_resized(false), io_inited(false), need_save(false), - saving_game(false), updating_scores(false), - seen_hups(0), map_stat_gen(false), unicode_ok(false), - glyph2strfn(NULL), multibyte_strlen(NULL), - terminal_resize_handler(NULL), terminal_resize_check(NULL) - { - } - - void check_term_size() const - { - if (terminal_resize_check) - (*terminal_resize_check)(); - } -}; -extern game_state crawl_state; - struct ghost_demon { public: @@ -1398,100 +1169,6 @@ private: extern std::vector<ghost_demon> ghosts; -struct system_environment -{ - std::string crawl_name; - std::string crawl_pizza; - std::string crawl_rc; - std::string crawl_dir; - std::string morgue_dir; - std::string crawl_base; // Directory from argv[0], may be used to - // locate datafiles. - std::string home; // only used by MULTIUSER systems - bool board_with_nail; // Easter Egg silliness - -#ifdef DGL_SIMPLE_MESSAGING - std::string messagefile; // File containing messages from other users. - bool have_messages; // There are messages waiting to be read. - unsigned message_check_tick; -#endif - - std::string scorefile; - std::vector<std::string> cmd_args; - - int map_gen_iters; -}; - -extern system_environment SysEnv; - -struct crawl_view_geometry -{ -public: - coord_def termsz; // Size of the terminal. - coord_def viewp; // Left-top pos of viewport. - coord_def viewsz; // Size of the viewport (play area). - coord_def hudp; // Left-top pos of status area. - coord_def hudsz; // Size of the status area. - coord_def msgp; // Left-top pos of the message pane. - coord_def msgsz; // Size of the message pane. - - coord_def vgrdc; // What grid pos is at the centre of the view - // usually you.pos(). - - coord_def viewhalfsz; - - coord_def glos1, glos2; // LOS limit grid coords (inclusive) - coord_def vlos1, vlos2; // LOS limit viewport coords (inclusive) - - coord_def mousep; // Where the mouse is. - - static const int message_min_lines = 7; - static const int hud_min_width = 41; - static const int hud_min_gutter = 3; - static const int hud_max_gutter = 6; - -private: - coord_def last_player_pos; - -public: - crawl_view_geometry(); - void init_geometry(); - - void init_view(); - void set_player_at(const coord_def &c, bool force_centre = false); - - coord_def view_centre() const - { - return viewp + viewhalfsz; - } - - bool in_grid_los(const coord_def &c) const - { - return (c.x >= glos1.x && c.x <= glos2.x - && c.y >= glos1.y && c.y <= glos2.y); - } - - bool in_view_los(const coord_def &c) const - { - return (c.x >= vlos1.x && c.x <= vlos2.x - && c.y >= vlos1.y && c.y <= vlos2.y); - } - - bool in_view_viewport(const coord_def &c) const - { - return (c.x >= viewp.x && c.y >= viewp.y - && c.x < viewp.x + viewsz.x - && c.y < viewp.y + viewsz.y); - } - - bool in_grid_viewport(const coord_def &c) const - { - return in_view_viewport(c - vgrdc + view_centre()); - } -}; - -extern crawl_view_geometry crawl_view; - struct message_filter { int channel; // Use -1 to match any channel. @@ -1932,17 +1609,4 @@ private: extern game_options Options; -struct tagHeader -{ - short tagID; - long offset; -}; - -extern const struct coord_def Compass[8]; -extern const char* god_gain_power_messages[MAX_NUM_GODS][MAX_GOD_ABILITIES]; - -typedef int keycode_type; - -typedef FixedArray < item_type_id_state_type, 4, 50 > id_arr; - #endif // EXTERNS_H diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index 2a3ef7d577..c9c0fb6d79 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -52,7 +52,9 @@ #include "itemname.h" #include "itemprop.h" #include "item_use.h" +#include "Kills.h" #include "macro.h" +#include "message.h" #include "misc.h" #include "monplace.h" #include "mon-pick.h" @@ -69,7 +71,9 @@ #include "spells3.h" #include "spells4.h" #include "spl-cast.h" +#include "spl-util.h" #include "stuff.h" +#include "transfor.h" #include "tutorial.h" #include "view.h" diff --git a/crawl-ref/source/fight.h b/crawl-ref/source/fight.h index 58ecd98160..e4d25eda9f 100644 --- a/crawl-ref/source/fight.h +++ b/crawl-ref/source/fight.h @@ -18,6 +18,18 @@ #include "externs.h" #include "randart.h" +enum unarmed_attack_type +{ + UNAT_NO_ATTACK, // 0 + UNAT_KICK, + UNAT_HEADBUTT, + UNAT_TAILSLAP, + UNAT_PUNCH, + UNAT_BITE +}; + +struct mon_attack_def; + // added Sept 18, 2000 -- bwr /* *********************************************************************** * called from: item_use.cc diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc index 1627aecbd6..326d59706e 100644 --- a/crawl-ref/source/files.cc +++ b/crawl-ref/source/files.cc @@ -60,10 +60,13 @@ #include "cloud.h" #include "clua.h" #include "debug.h" +#include "direct.h" #include "dungeon.h" +#include "initfile.h" #include "itemname.h" #include "itemprop.h" #include "items.h" +#include "Kills.h" #include "libutil.h" #include "mapmark.h" #include "message.h" @@ -73,12 +76,16 @@ #include "mstuff2.h" #include "mtransit.h" #include "notes.h" +#include "output.h" +#include "place.h" #include "player.h" #include "randart.h" #include "skills2.h" #include "stash.h" +#include "state.h" #include "stuff.h" #include "tags.h" +#include "terrain.h" #include "travel.h" #include "tutorial.h" #include "view.h" @@ -172,7 +179,7 @@ bool is_packed_save(const std::string &name) player read_character_info(const std::string &savefile) { player fromfile; - player backup = you; + player backup; FILE *charf = fopen(savefile.c_str(), "rb"); if (!charf) @@ -181,12 +188,13 @@ player read_character_info(const std::string &savefile) char majorVersion = 0; char minorVersion = 0; + backup.copy_from(you); if (determine_version(charf, majorVersion, minorVersion) && majorVersion == SAVE_MAJOR_VERSION) { restore_tagged_file(charf, TAGTYPE_PLAYER_NAME, minorVersion); - fromfile = you; - you = backup; + fromfile.copy_from(you); + you .copy_from(backup); } fclose(charf); @@ -1040,7 +1048,7 @@ void save_game(bool leave_game, const char *farewellmsg) FILE *killf = fopen(killFile.c_str(), "wb"); if (killf) { - you.kills.save(killf); + you.kills->save(killf); fclose(killf); DO_CHMOD_PRIVATE(killFile.c_str()); } @@ -1239,7 +1247,7 @@ void restore_game(void) FILE *killf = fopen(killFile.c_str(), "rb"); if (killf) { - you.kills.load(killf); + you.kills->load(killf); fclose(killf); } diff --git a/crawl-ref/source/files.h b/crawl-ref/source/files.h index d8f79b34c7..32bdaf1728 100644 --- a/crawl-ref/source/files.h +++ b/crawl-ref/source/files.h @@ -20,6 +20,13 @@ #include <string> #include <vector> +enum load_mode_type +{ + LOAD_START_GAME, + LOAD_RESTART_GAME, + LOAD_ENTER_LEVEL +}; + // referenced in files - newgame - ouch - overmap: #define MAX_LEVELS 50 diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc index 12b7e905b0..0bd634dc44 100644 --- a/crawl-ref/source/food.cc +++ b/crawl-ref/source/food.cc @@ -29,6 +29,7 @@ #include "clua.h" #include "debug.h" #include "delay.h" +#include "initfile.h" #include "invent.h" #include "items.h" #include "itemname.h" @@ -36,9 +37,11 @@ #include "item_use.h" #include "it_use2.h" #include "macro.h" +#include "message.h" #include "misc.h" #include "mon-util.h" #include "mutation.h" +#include "output.h" #include "player.h" #include "religion.h" #include "skills2.h" diff --git a/crawl-ref/source/food.h b/crawl-ref/source/food.h index 764f577ee0..94dceeceec 100644 --- a/crawl-ref/source/food.h +++ b/crawl-ref/source/food.h @@ -14,6 +14,33 @@ #ifndef FOOD_H #define FOOD_H +enum food_type +{ + FOOD_MEAT_RATION, // 0 + FOOD_BREAD_RATION, + FOOD_PEAR, + FOOD_APPLE, + FOOD_CHOKO, + FOOD_HONEYCOMB, // 5 + FOOD_ROYAL_JELLY, + FOOD_SNOZZCUMBER, + FOOD_PIZZA, + FOOD_APRICOT, + FOOD_ORANGE, // 10 + FOOD_BANANA, + FOOD_STRAWBERRY, + FOOD_RAMBUTAN, + FOOD_LEMON, + FOOD_GRAPE, // 15 + FOOD_SULTANA, + FOOD_LYCHEE, + FOOD_BEEF_JERKY, + FOOD_CHEESE, + FOOD_SAUSAGE, // 20 + FOOD_CHUNK, + NUM_FOODS +}; + // last updated 19jun2000 {dlb} /* *********************************************************************** diff --git a/crawl-ref/source/ghost.cc b/crawl-ref/source/ghost.cc index bd4f3b84b7..3e4746a984 100644 --- a/crawl-ref/source/ghost.cc +++ b/crawl-ref/source/ghost.cc @@ -14,8 +14,8 @@ #include "randart.h" #include "skills2.h" #include "stuff.h" -#include "misc.h" #include "mtransit.h" +#include "place.h" #include "player.h" #include <vector> diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc index 4b9a274217..ffd64530a1 100644 --- a/crawl-ref/source/hiscores.cc +++ b/crawl-ref/source/hiscores.cc @@ -45,11 +45,14 @@ #include "itemprop.h" #include "items.h" #include "libutil.h" -#include "misc.h" +#include "message.h" #include "mon-util.h" +#include "ouch.h" +#include "place.h" #include "player.h" #include "religion.h" #include "shopping.h" +#include "state.h" #include "stuff.h" #include "tags.h" #include "version.h" diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index 04e560c402..540b10742e 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -22,6 +22,7 @@ #include <string> #include <ctype.h> +#include "chardump.h" #include "clua.h" #include "delay.h" #include "direct.h" @@ -29,11 +30,15 @@ #include "files.h" #include "defines.h" #include "invent.h" +#include "item_use.h" +#include "itemprop.h" #include "libutil.h" +#include "message.h" #include "mon-util.h" #include "player.h" #include "religion.h" #include "stash.h" +#include "state.h" #include "stuff.h" #include "travel.h" #include "items.h" diff --git a/crawl-ref/source/initfile.h b/crawl-ref/source/initfile.h index c159bdb42d..9877e1bd0c 100644 --- a/crawl-ref/source/initfile.h +++ b/crawl-ref/source/initfile.h @@ -19,6 +19,12 @@ #include "enum.h" +enum drop_mode_type +{ + DM_SINGLE, + DM_MULTI +}; + god_type str_to_god(std::string god); int str_to_colour( const std::string &str, int default_colour = -1, bool accept_number = true ); @@ -44,6 +50,32 @@ void apply_ascii_display(bool ascii); * *********************************************************************** */ void get_system_environment(void); +struct system_environment +{ + std::string crawl_name; + std::string crawl_pizza; + std::string crawl_rc; + std::string crawl_dir; + std::string morgue_dir; + std::string crawl_base; // Directory from argv[0], may be used to + // locate datafiles. + std::string home; // only used by MULTIUSER systems + bool board_with_nail; // Easter Egg silliness + +#ifdef DGL_SIMPLE_MESSAGING + std::string messagefile; // File containing messages from other users. + bool have_messages; // There are messages waiting to be read. + unsigned message_check_tick; +#endif + + std::string scorefile; + std::vector<std::string> cmd_args; + + int map_gen_iters; +}; + +extern system_environment SysEnv; + // last updated 16feb2001 {gdl} /* *********************************************************************** diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index 74a2a74bab..23d47a1504 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -31,9 +31,12 @@ #include "clua.h" #include "describe.h" +#include "food.h" +#include "initfile.h" #include "itemprop.h" #include "items.h" #include "macro.h" +#include "message.h" #include "player.h" #include "shopping.h" #include "stuff.h" diff --git a/crawl-ref/source/invent.h b/crawl-ref/source/invent.h index d9739b4793..d21379c22f 100644 --- a/crawl-ref/source/invent.h +++ b/crawl-ref/source/invent.h @@ -19,6 +19,14 @@ #include "menu.h" #include "enum.h" +enum object_selector +{ + OSEL_ANY = -1, + OSEL_WIELD = -2, + OSEL_UNIDENT = -3, + OSEL_EQUIP = -4 +}; + #define PROMPT_ABORT -1 #define PROMPT_GOT_SPECIAL -2 diff --git a/crawl-ref/source/it_use2.cc b/crawl-ref/source/it_use2.cc index d05bc34b02..a893ca4ceb 100644 --- a/crawl-ref/source/it_use2.cc +++ b/crawl-ref/source/it_use2.cc @@ -37,6 +37,7 @@ #include "skills2.h" #include "spells2.h" #include "spl-cast.h" +#include "spl-util.h" #include "stuff.h" #include "view.h" diff --git a/crawl-ref/source/it_use2.h b/crawl-ref/source/it_use2.h index b5e49770b1..408e32b847 100644 --- a/crawl-ref/source/it_use2.h +++ b/crawl-ref/source/it_use2.h @@ -15,6 +15,36 @@ #include "externs.h" +enum potion_type +{ + POT_HEALING, // 0 + POT_HEAL_WOUNDS, + POT_SPEED, + POT_MIGHT, + POT_GAIN_STRENGTH, + POT_GAIN_DEXTERITY, // 5 + POT_GAIN_INTELLIGENCE, + POT_LEVITATION, + POT_POISON, + POT_SLOWING, + POT_PARALYSIS, // 10 + POT_CONFUSION, + POT_INVISIBILITY, + POT_PORRIDGE, + POT_DEGENERATION, + POT_DECAY, // 15 + POT_WATER, + POT_EXPERIENCE, + POT_MAGIC, + POT_RESTORE_ABILITIES, + POT_STRONG_POISON, // 20 + POT_BERSERK_RAGE, + POT_CURE_MUTATION, + POT_MUTATION, + POT_BLOOD, + POT_RESISTANCE, + NUM_POTIONS +}; /* *********************************************************************** * called from: ability - beam - decks - item_use - misc - religion - diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc index 7119f13e41..417fd7f2d7 100644 --- a/crawl-ref/source/it_use3.cc +++ b/crawl-ref/source/it_use3.cc @@ -34,6 +34,7 @@ #include "itemname.h" #include "itemprop.h" #include "mapmark.h" +#include "message.h" #include "misc.h" #include "monplace.h" #include "monstuff.h" diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 5148cd9d65..ffaefc2522 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -51,6 +51,7 @@ #include "itemname.h" #include "itemprop.h" #include "macro.h" +#include "message.h" #include "misc.h" #include "monplace.h" #include "monstuff.h" @@ -67,6 +68,7 @@ #include "spells3.h" #include "spl-book.h" #include "spl-cast.h" +#include "spl-util.h" #include "stuff.h" #include "transfor.h" #include "tutorial.h" diff --git a/crawl-ref/source/item_use.h b/crawl-ref/source/item_use.h index 3597d42510..0f564ba452 100644 --- a/crawl-ref/source/item_use.h +++ b/crawl-ref/source/item_use.h @@ -20,6 +20,23 @@ #include "externs.h" #include "enum.h" +enum fire_type +{ + FIRE_NONE = 0x0000, + FIRE_LAUNCHER = 0x0001, + FIRE_DART = 0x0002, + FIRE_STONE = 0x0004, + FIRE_DAGGER = 0x0008, + FIRE_JAVELIN = 0x0010, + FIRE_SPEAR = 0x0020, + FIRE_HAND_AXE = 0x0040, + FIRE_CLUB = 0x0080, + FIRE_ROCK = 0x0100, + FIRE_NET = 0x0200 +}; + +struct bolt; +struct dist; // last updated 12may2000 {dlb} /* *********************************************************************** diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc index 73d44a9c81..0fa28e52c2 100644 --- a/crawl-ref/source/itemname.cc +++ b/crawl-ref/source/itemname.cc @@ -28,7 +28,9 @@ #include "externs.h" #include "decks.h" +#include "food.h" #include "invent.h" +#include "it_use2.h" #include "itemprop.h" #include "macro.h" #include "mon-util.h" diff --git a/crawl-ref/source/itemname.h b/crawl-ref/source/itemname.h index e3dbdd23d4..33ce92f5fd 100644 --- a/crawl-ref/source/itemname.h +++ b/crawl-ref/source/itemname.h @@ -16,6 +16,66 @@ #include "externs.h" +enum item_type_id_type +{ + IDTYPE_WANDS = 0, + IDTYPE_SCROLLS, + IDTYPE_JEWELLERY, + IDTYPE_POTIONS, + NUM_IDTYPE +}; + +enum item_type_id_state_type // used for values in id[4][50] +{ + ID_UNKNOWN_TYPE = 0, + ID_MON_TRIED_TYPE, + ID_TRIED_TYPE, + ID_KNOWN_TYPE +}; + +// [dshaligram] If you edit potion colours/descriptions, also update +// itemname.cc. +enum potion_description_colour_type +{ + PDC_CLEAR, + PDC_BLUE, + PDC_BLACK, + PDC_SILVERY, + PDC_CYAN, + PDC_PURPLE, + PDC_ORANGE, + PDC_INKY, + PDC_RED, + PDC_YELLOW, + PDC_GREEN, + PDC_BROWN, + PDC_PINK, + PDC_WHITE, + PDC_NCOLOURS +}; + +// [dshaligram] If you edit potion colours/descriptions, also update +// itemname.cc. +enum potion_description_qualifier_type +{ + PDQ_NONE, + PDQ_BUBBLING, + PDQ_FUMING, + PDQ_FIZZY, + PDQ_VISCOUS, + PDQ_LUMPY, + PDQ_SMOKY, + PDQ_GLOWING, + PDQ_SEDIMENTED, + PDQ_METALLIC, + PDQ_MURKY, + PDQ_GLUGGY, + PDQ_OILY, + PDQ_SLIMY, + PDQ_EMULSIFIED, + PDQ_NQUALS +}; + bool is_vowel( const char chr ); /* *********************************************************************** @@ -45,6 +105,8 @@ std::string make_name( unsigned long seed, bool all_caps ); * *********************************************************************** */ void init_properties(); +typedef FixedArray < item_type_id_state_type, NUM_IDTYPE, 50 > id_arr; + id_arr& get_typeid_array(); item_type_id_state_type get_ident_type(object_class_type basetype, int subtype); diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index 0cfaa6adce..3b78905ef3 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -24,6 +24,8 @@ #include "externs.h" +#include "decks.h" +#include "food.h" #include "items.h" #include "itemprop.h" #include "macro.h" @@ -2340,28 +2342,6 @@ bool is_shield_incompatible(const item_def &weapon, const item_def *shield) && !is_range_weapon(weapon); } -bool is_deck(const item_def &item) -{ - return item.base_type == OBJ_MISCELLANY - && (item.sub_type >= MISC_DECK_OF_ESCAPE && - item.sub_type <= MISC_DECK_OF_DEFENSE); -} - -deck_rarity_type deck_rarity(const item_def &item) -{ - ASSERT( is_deck(item) ); - switch (item.colour) - { - case BLACK: case BLUE: case GREEN: case CYAN: case RED: - default: - return DECK_RARITY_COMMON; - case MAGENTA: case BROWN: - return DECK_RARITY_RARE; - case LIGHTMAGENTA: - return DECK_RARITY_LEGENDARY; - } -} - std::string item_base_name(const item_def &item) { switch ( item.base_type ) diff --git a/crawl-ref/source/itemprop.h b/crawl-ref/source/itemprop.h index 7c051d0b70..61c4cbe41d 100644 --- a/crawl-ref/source/itemprop.h +++ b/crawl-ref/source/itemprop.h @@ -14,6 +14,553 @@ #include "externs.h" +enum armour_type +{ + ARM_ROBE, // 0 + ARM_LEATHER_ARMOUR, + ARM_RING_MAIL, + ARM_SCALE_MAIL, + ARM_CHAIN_MAIL, + ARM_SPLINT_MAIL, // 5 + ARM_BANDED_MAIL, + ARM_PLATE_MAIL, + ARM_SHIELD, + ARM_CLOAK, + ARM_HELMET, // 10 + ARM_GLOVES, + ARM_BOOTS, + ARM_BUCKLER, + ARM_LARGE_SHIELD, + ARM_DRAGON_HIDE, // 15 + ARM_TROLL_HIDE, + ARM_CRYSTAL_PLATE_MAIL, + ARM_DRAGON_ARMOUR, + ARM_TROLL_LEATHER_ARMOUR, + ARM_ICE_DRAGON_HIDE, // 20 + ARM_ICE_DRAGON_ARMOUR, + ARM_STEAM_DRAGON_HIDE, + ARM_STEAM_DRAGON_ARMOUR, + ARM_MOTTLED_DRAGON_HIDE, + ARM_MOTTLED_DRAGON_ARMOUR, // 25 + ARM_STORM_DRAGON_HIDE, + ARM_STORM_DRAGON_ARMOUR, + ARM_GOLD_DRAGON_HIDE, + ARM_GOLD_DRAGON_ARMOUR, + ARM_ANIMAL_SKIN, // 30 + ARM_SWAMP_DRAGON_HIDE, + ARM_SWAMP_DRAGON_ARMOUR, + ARM_STUDDED_LEATHER_ARMOUR, + ARM_CAP, + ARM_CENTAUR_BARDING, // 35 + ARM_NAGA_BARDING, + + NUM_ARMOURS +}; + +enum armour_property_type +{ + PARM_AC, // 0 + PARM_EVASION +}; + +enum boot_type // used in pluses2 +{ + TBOOT_BOOTS = 0, + TBOOT_NAGA_BARDING, + TBOOT_CENTAUR_BARDING, + NUM_BOOT_TYPES +}; + +enum brand_type // equivalent to (you.inv[].special or mitm[].special) % 30 +{ + SPWPN_NORMAL, // 0 + SPWPN_FLAMING, + SPWPN_FREEZING, + SPWPN_HOLY_WRATH, + SPWPN_ELECTROCUTION, + SPWPN_ORC_SLAYING, // 5 + SPWPN_VENOM, + SPWPN_PROTECTION, + SPWPN_DRAINING, + SPWPN_SPEED, + SPWPN_VORPAL, // 10 + SPWPN_FLAME, + SPWPN_FROST, + SPWPN_VAMPIRICISM, + SPWPN_DISRUPTION, + SPWPN_PAIN, // 15 + SPWPN_DISTORTION, + SPWPN_REACHING, // 17 + SPWPN_RETURNING, + SPWPN_CONFUSE, + SPWPN_RANDART_I = 25, // 25 + SPWPN_RANDART_II, + SPWPN_RANDART_III, + SPWPN_RANDART_IV, + SPWPN_RANDART_V, + NUM_SPECIAL_WEAPONS, + SPWPN_DUMMY_CRUSHING, // ONLY TEMPORARY USAGE -- converts to VORPAL + + // everything above this point is a special artefact wield: + SPWPN_SINGING_SWORD = 181, // 181 + SPWPN_WRATH_OF_TROG, + SPWPN_SCYTHE_OF_CURSES, + SPWPN_MACE_OF_VARIABILITY, + SPWPN_GLAIVE_OF_PRUNE, // 185 + SPWPN_SCEPTRE_OF_TORMENT, + SPWPN_SWORD_OF_ZONGULDROK, + + // these three are not generated randomly {dlb} + SPWPN_SWORD_OF_CEREBOV, + SPWPN_STAFF_OF_DISPATER, + SPWPN_SCEPTRE_OF_ASMODEUS, // 190 + + SPWPN_SWORD_OF_POWER, + SPWPN_KNIFE_OF_ACCURACY, + SPWPN_STAFF_OF_OLGREB, + SPWPN_VAMPIRES_TOOTH, + SPWPN_STAFF_OF_WUCAD_MU // 195 +}; + +enum corpse_type +{ + CORPSE_BODY, // 0 + CORPSE_SKELETON +}; + +enum hands_reqd_type +{ + HANDS_ONE, + HANDS_HALF, + HANDS_TWO, + + HANDS_DOUBLE // not a level, marks double ended weapons (== half) +}; + +enum helmet_type +{ + THELM_HELMET = 0x0000, + THELM_HELM = 0x0001, + THELM_CAP = 0x0002, + THELM_WIZARD_HAT = 0x0003, + THELM_NUM_TYPES = 4, + + THELM_SPECIAL = 0x0004, // type used only for artefacts (mask, hat) + THELM_TYPE_MASK = 0x00ff, + + THELM_DESC_PLAIN = 0x0000, + THELM_DESC_WINGED = 0x0100, + THELM_DESC_HORNED = 0x0200, + THELM_DESC_CRESTED = 0x0300, + THELM_DESC_PLUMED = 0x0400, + THELM_DESC_SPIKED = 0x0500, + THELM_DESC_VISORED = 0x0600, + THELM_DESC_JEWELLED = 0x0700, + + THELM_DESC_MASK = 0xff00 +}; + +enum jewellery_type +{ + RING_FIRST_RING = 0, + + RING_REGENERATION = RING_FIRST_RING, // 0 + RING_PROTECTION, + RING_PROTECTION_FROM_FIRE, + RING_POISON_RESISTANCE, + RING_PROTECTION_FROM_COLD, + RING_STRENGTH, // 5 + RING_SLAYING, + RING_SEE_INVISIBLE, + RING_INVISIBILITY, + RING_HUNGER, + RING_TELEPORTATION, // 10 + RING_EVASION, + RING_SUSTAIN_ABILITIES, + RING_SUSTENANCE, + RING_DEXTERITY, + RING_INTELLIGENCE, // 15 + RING_WIZARDRY, + RING_MAGICAL_POWER, + RING_LEVITATION, + RING_LIFE_PROTECTION, + RING_PROTECTION_FROM_MAGIC, // 20 + RING_FIRE, + RING_ICE, + RING_TELEPORT_CONTROL, // 23 + + NUM_RINGS, // 24, keep as last ring; can overlap + // safely with first amulet. + + AMU_FIRST_AMULET = 35, + AMU_RAGE = AMU_FIRST_AMULET, // 35 + AMU_RESIST_SLOW, + AMU_CLARITY, + AMU_WARDING, + AMU_RESIST_CORROSION, + AMU_THE_GOURMAND, // 40 + AMU_CONSERVATION, + AMU_CONTROLLED_FLIGHT, + AMU_INACCURACY, + AMU_RESIST_MUTATION, + + NUM_JEWELLERY +}; + +enum launch_retval +{ + LRET_FUMBLED = 0, // must be left as 0 + LRET_LAUNCHED, + LRET_THROWN +}; + +enum misc_item_type +{ + MISC_BOTTLED_EFREET, // 0 + MISC_CRYSTAL_BALL_OF_SEEING, + MISC_AIR_ELEMENTAL_FAN, + MISC_LAMP_OF_FIRE, + MISC_STONE_OF_EARTH_ELEMENTALS, + MISC_LANTERN_OF_SHADOWS, + MISC_HORN_OF_GERYON, + MISC_BOX_OF_BEASTS, + MISC_CRYSTAL_BALL_OF_ENERGY, + MISC_EMPTY_EBONY_CASKET, + MISC_CRYSTAL_BALL_OF_FIXATION, + MISC_DISC_OF_STORMS, + + // pure decks + MISC_DECK_OF_ESCAPE, + MISC_DECK_OF_DESTRUCTION, + MISC_DECK_OF_DUNGEONS, + MISC_DECK_OF_SUMMONING, + MISC_DECK_OF_WONDERS, + MISC_DECK_OF_PUNISHMENT, + + // mixed decks + MISC_DECK_OF_WAR, + MISC_DECK_OF_CHANGES, + MISC_DECK_OF_DEFENSE, + + MISC_RUNE_OF_ZOT, + + NUM_MISCELLANY // mv: used for random generation +}; + +enum missile_type +{ + MI_STONE, // 0 + MI_ARROW, + MI_BOLT, + MI_DART, + MI_NEEDLE, + MI_LARGE_ROCK, + MI_SLING_BULLET, + MI_JAVELIN, + MI_THROWING_NET, + NUM_MISSILES, + MI_NONE // was MI_EGGPLANT... used for launch type detection +}; + +enum rune_type +{ + // Note: that runes DIS-SWAMP have the same numeric value as the branch + RUNE_DIS = BRANCH_DIS, + RUNE_GEHENNA = BRANCH_GEHENNA, + RUNE_COCYTUS = BRANCH_COCYTUS, + RUNE_TARTARUS = BRANCH_TARTARUS, + RUNE_SLIME_PITS = BRANCH_SLIME_PITS, + RUNE_VAULTS = BRANCH_VAULTS, + RUNE_SNAKE_PIT = BRANCH_SNAKE_PIT, + RUNE_ELVEN_HALLS = BRANCH_ELVEN_HALLS, // unused + RUNE_TOMB = BRANCH_TOMB, + RUNE_SWAMP = BRANCH_SWAMP, + RUNE_SHOALS = BRANCH_SHOALS, + + // Runes 50 and 51 are for Pandemonium (general demon) and the Abyss + RUNE_DEMONIC = 50, + RUNE_ABYSSAL, + + // Runes 60-63 correspond to the Pandemonium demonlords, + // and are equal to the corresponding vault. + RUNE_MNOLEG = 60, + RUNE_LOM_LOBON, + RUNE_CEREBOV, + RUNE_GLOORX_VLOQ, + NUM_RUNE_TYPES, // should always be last + RUNE_NONE +}; + +enum scroll_type +{ + SCR_IDENTIFY, // 0 + SCR_TELEPORTATION, + SCR_FEAR, + SCR_NOISE, + SCR_REMOVE_CURSE, + SCR_DETECT_CURSE, // 5 + SCR_SUMMONING, + SCR_ENCHANT_WEAPON_I, + SCR_ENCHANT_ARMOUR, + SCR_TORMENT, + SCR_RANDOM_USELESSNESS, // 10 + SCR_CURSE_WEAPON, + SCR_CURSE_ARMOUR, + SCR_IMMOLATION, + SCR_BLINKING, + SCR_PAPER, // 15 + SCR_MAGIC_MAPPING, + SCR_FORGETFULNESS, + SCR_ACQUIREMENT, + SCR_ENCHANT_WEAPON_II, + SCR_VORPALISE_WEAPON, // 20 + SCR_RECHARGING, + SCR_ENCHANT_WEAPON_III, + NUM_SCROLLS +}; + +enum special_armour_type +{ + SPARM_NORMAL, // 0 + SPARM_RUNNING, + SPARM_FIRE_RESISTANCE, + SPARM_COLD_RESISTANCE, + SPARM_POISON_RESISTANCE, + SPARM_SEE_INVISIBLE, // 5 + SPARM_DARKNESS, + SPARM_STRENGTH, + SPARM_DEXTERITY, + SPARM_INTELLIGENCE, + SPARM_PONDEROUSNESS, // 10 + SPARM_LEVITATION, + SPARM_MAGIC_RESISTANCE, + SPARM_PROTECTION, + SPARM_STEALTH, + SPARM_RESISTANCE, // 15 + SPARM_POSITIVE_ENERGY, + SPARM_ARCHMAGI, + SPARM_PRESERVATION, // 18 + SPARM_RANDART_I = 25, // must remain at 25 for now - how high do they go? {dlb} + SPARM_RANDART_II = 26, // 26 + SPARM_RANDART_III = 27, // 27 + SPARM_RANDART_IV = 28, // 28 + SPARM_RANDART_V = 29 // 29 - highest value found thus far {dlb} +}; + +enum special_missile_type // to separate from weapons in general {dlb} +{ + SPMSL_NORMAL, // 0 + SPMSL_FLAME, // 1 + SPMSL_ICE, // 2 + SPMSL_POISONED, // 3 + SPMSL_POISONED_II, // 4 - unused + SPMSL_CURARE // 5 +}; + +enum special_ring_type // jewellery mitm[].special values +{ + SPRING_RANDART = 200, + SPRING_UNRANDART = 201 +}; + +enum special_wield_type // you.special_wield +{ + SPWLD_NONE, // 0 + SPWLD_SING, + SPWLD_TROG, + SPWLD_CURSE, + SPWLD_VARIABLE, // 4 + SPWLD_PRUNE, // 5 - implicit in it_use3::special_wielded() {dlb} + SPWLD_TORMENT, // 6 + SPWLD_ZONGULDROK, + SPWLD_POWER, + SPWLD_WUCAD_MU, // 9 + SPWLD_OLGREB, // 10 + SPWLD_SHADOW = 50, // 50 + SPWLD_NOISE // further differentiation useless -> removed (jpeg) +}; + +enum stave_type +{ + // staves + STAFF_WIZARDRY = 0, + STAFF_POWER, + STAFF_FIRE, + STAFF_COLD, + STAFF_POISON, + STAFF_ENERGY, + STAFF_DEATH, + STAFF_CONJURATION, + STAFF_ENCHANTMENT, + STAFF_SUMMONING, + STAFF_AIR, + STAFF_EARTH, + STAFF_CHANNELING, + // rods + STAFF_SMITING, // must be first rod! + STAFF_SPELL_SUMMONING, + STAFF_DESTRUCTION_I, + STAFF_DESTRUCTION_II, + STAFF_DESTRUCTION_III, + STAFF_DESTRUCTION_IV, + STAFF_WARDING, + STAFF_DISCOVERY, + STAFF_DEMONOLOGY, + STAFF_STRIKING, + STAFF_VENOM, + NUM_STAVES // must remain last member {dlb} +}; + +enum weapon_type +{ +// Base weapons + WPN_CLUB, // 0 + WPN_MACE, + WPN_FLAIL, + WPN_DAGGER, + WPN_MORNINGSTAR, + WPN_SHORT_SWORD, // 5 + WPN_LONG_SWORD, + WPN_GREAT_SWORD, + WPN_SCIMITAR, + WPN_HAND_AXE, + WPN_BATTLEAXE, // 10 + WPN_SPEAR, + WPN_HALBERD, + WPN_SLING, + WPN_BOW, + WPN_CROSSBOW, // 15 + WPN_HAND_CROSSBOW, + WPN_GLAIVE, + WPN_QUARTERSTAFF, +// these three not created ordinarily + WPN_SCYTHE, + WPN_GIANT_CLUB, // 20 + WPN_GIANT_SPIKED_CLUB, +// "rare" weapons - some have special cases and are uncommon + WPN_EVENINGSTAR, + WPN_QUICK_BLADE, + WPN_KATANA, + WPN_EXECUTIONERS_AXE, // 25 + WPN_DOUBLE_SWORD, + WPN_TRIPLE_SWORD, + WPN_HAMMER, + WPN_ANCUS, + WPN_WHIP, // 30 + WPN_SABRE, + WPN_DEMON_BLADE, + WPN_DEMON_WHIP, + WPN_DEMON_TRIDENT, + WPN_BROAD_AXE, // 35 +// base items (continued) + WPN_WAR_AXE, + WPN_TRIDENT, + WPN_SPIKED_FLAIL, + WPN_GREAT_MACE, + WPN_DIRE_FLAIL, // 40 + WPN_KNIFE, + WPN_BLOWGUN, + WPN_FALCHION, + WPN_BLESSED_BLADE, // 44 + WPN_LONGBOW, + WPN_LAJATANG, + WPN_LOCHABER_AXE, + + NUM_WEAPONS, // 48 - must be last regular member {dlb} + +// special cases + WPN_UNARMED = 500, // 500 + WPN_UNKNOWN = 1000, // 1000 + WPN_RANDOM +}; + +enum weapon_description_type +{ + DWPN_PLAIN = 0, // 0 - added to round out enum {dlb} + DWPN_RUNED = 1, // 1 + DWPN_GLOWING, + DWPN_ORCISH, + DWPN_ELVEN, + DWPN_DWARVEN // 5 +}; + +enum weapon_property_type +{ + PWPN_DAMAGE, // 0 + PWPN_HIT, + PWPN_SPEED, + PWPN_ACQ_WEIGHT +}; + +enum vorpal_damage_type +{ + // Types of damage a weapon can do... currently assuming that anything + // with BLUDGEON always does "AND" with any other specified types, + // and and sets not including BLUDGEON are "OR". + DAM_BASH = 0x0000, // non-melee weapon blugeoning + DAM_BLUDGEON = 0x0001, // crushing + DAM_SLICE = 0x0002, // slicing/chopping + DAM_PIERCE = 0x0004, // stabbing/piercing + DAM_WHIP = 0x0008, // whip slashing (no butcher) + + // These are used for vorpal weapon desc (don't set more than one) + DVORP_NONE = 0x0000, // used for non-melee weapons + DVORP_CRUSHING = 0x1000, + DVORP_SLICING = 0x2000, + DVORP_PIERCING = 0x3000, + DVORP_CHOPPING = 0x4000, // used for axes + DVORP_SLASHING = 0x5000, // used for whips + DVORP_STABBING = 0x6000, // used for knives/daggers + + DVORP_CLAWING = 0x7000, // claw damage + + // These are shortcuts to tie vorpal/damage types for easy setting... + // as above, setting more than one vorpal type is trouble. + DAMV_NON_MELEE = DVORP_NONE | DAM_BASH, // launchers + DAMV_CRUSHING = DVORP_CRUSHING | DAM_BLUDGEON, + DAMV_SLICING = DVORP_SLICING | DAM_SLICE, + DAMV_PIERCING = DVORP_PIERCING | DAM_PIERCE, + DAMV_CHOPPING = DVORP_CHOPPING | DAM_SLICE, + DAMV_SLASHING = DVORP_SLASHING | DAM_WHIP, + DAMV_STABBING = DVORP_STABBING | DAM_PIERCE, + + DAM_MASK = 0x0fff, // strips vorpal specification + DAMV_MASK = 0xf000 // strips non-vorpal specification +}; + +// NOTE: This order is very special! Its basically the same as ZAP_*, +// and there are bits of the code that still use that fact.. see zap_wand(). +enum wand_type // mitm[].subtype +{ + WAND_FLAME, // 0 + WAND_FROST, + WAND_SLOWING, + WAND_HASTING, + WAND_MAGIC_DARTS, + WAND_HEALING, // 5 + WAND_PARALYSIS, + WAND_FIRE, + WAND_COLD, + WAND_CONFUSION, + WAND_INVISIBILITY, // 10 + WAND_DIGGING, + WAND_FIREBALL, + WAND_TELEPORTATION, + WAND_LIGHTNING, + WAND_POLYMORPH_OTHER, // 15 + WAND_ENSLAVEMENT, + WAND_DRAINING, + WAND_RANDOM_EFFECTS, + WAND_DISINTEGRATION, + NUM_WANDS // must remain last member {dlb} +}; + +enum zap_count_type +{ + ZAPCOUNT_EMPTY = -1, + ZAPCOUNT_UNKNOWN = -2 +}; + void init_properties(void); // Returns true if this item should be preserved as far as possible. @@ -162,9 +709,6 @@ bool is_shield(const item_def &item); bool is_shield_incompatible(const item_def &weapon, const item_def *shield = NULL); -bool is_deck(const item_def &item); -deck_rarity_type deck_rarity(const item_def &item); - // Only works for armour/weapons/missiles std::string item_base_name(const item_def &item); const char* weapon_base_name(unsigned char subtype); diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index bc35e2828d..ec95804282 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -40,6 +40,7 @@ #include "direct.h" #include "dgnevent.h" #include "effects.h" +#include "food.h" #include "hiscores.h" #include "invent.h" #include "it_use2.h" @@ -47,6 +48,7 @@ #include "itemname.h" #include "itemprop.h" #include "libutil.h" +#include "message.h" #include "misc.h" #include "monplace.h" #include "monstuff.h" @@ -55,6 +57,7 @@ #include "mutation.h" #include "notes.h" #include "overmap.h" +#include "place.h" #include "player.h" #include "randart.h" #include "religion.h" @@ -62,8 +65,11 @@ #include "skills.h" #include "spl-cast.h" #include "spl-book.h" +#include "spl-util.h" #include "stuff.h" #include "stash.h" +#include "terrain.h" +#include "transfor.h" #include "tutorial.h" #include "view.h" diff --git a/crawl-ref/source/items.h b/crawl-ref/source/items.h index 6d970ab454..f223c35382 100644 --- a/crawl-ref/source/items.h +++ b/crawl-ref/source/items.h @@ -17,6 +17,18 @@ #include "externs.h" +// Various ways to get the acquirement effect. +enum acquirement_agent_type +{ + AQ_SCROLL = 0, + + // Empty space for the gods + + AQ_CARD_GENIE = 100, + + AQ_WIZMODE = 200 +}; + bool is_valid_item( const item_def &item ); bool dec_inv_item_quantity( int obj, int amount ); diff --git a/crawl-ref/source/libunix.cc b/crawl-ref/source/libunix.cc index 372f10380c..2349c12f05 100644 --- a/crawl-ref/source/libunix.cc +++ b/crawl-ref/source/libunix.cc @@ -47,6 +47,7 @@ #include "enum.h" #include "externs.h" #include "files.h" +#include "state.h" #include "stuff.h" #include "view.h" diff --git a/crawl-ref/source/libw32c.cc b/crawl-ref/source/libw32c.cc index c7d22928a0..c50d095067 100644 --- a/crawl-ref/source/libw32c.cc +++ b/crawl-ref/source/libw32c.cc @@ -68,12 +68,13 @@ #include <string.h> #include <stdio.h> #include "AppHdr.h" -#include "version.h" #include "cio.h" #include "defines.h" +#include "libutil.h" +#include "state.h" #include "stuff.h" +#include "version.h" #include "view.h" -#include "libutil.h" char oldTitle[80]; diff --git a/crawl-ref/source/luadgn.cc b/crawl-ref/source/luadgn.cc index 3430c0976b..9e4188a1cb 100644 --- a/crawl-ref/source/luadgn.cc +++ b/crawl-ref/source/luadgn.cc @@ -6,17 +6,21 @@ */ #include "AppHdr.h" + +#include <sstream> + #include "clua.h" #include "direct.h" +#include "dungeon.h" #include "files.h" +#include "initfile.h" #include "luadgn.h" #include "mapdef.h" #include "mapmark.h" #include "maps.h" #include "stuff.h" #include "tags.h" -#include "dungeon.h" -#include <sstream> +#include "terrain.h" // Lua interpreter for the dungeon builder. CLua dlua(false); diff --git a/crawl-ref/source/macro.cc b/crawl-ref/source/macro.cc index 264958a993..219a43943e 100644 --- a/crawl-ref/source/macro.cc +++ b/crawl-ref/source/macro.cc @@ -46,6 +46,7 @@ #include "cio.h" #include "externs.h" +#include "message.h" #include "stuff.h" // for trim_string: diff --git a/crawl-ref/source/makefile.obj b/crawl-ref/source/makefile.obj index eaa7f8f55a..cc3e36a36f 100644 --- a/crawl-ref/source/makefile.obj +++ b/crawl-ref/source/makefile.obj @@ -58,6 +58,7 @@ notes.o \ ouch.o \ output.o \ overmap.o \ +place.o \ player.o \ randart.o \ religion.o \ @@ -75,7 +76,9 @@ sqldbm.o \ stash.o \ stuff.o \ tags.o \ +terrain.o \ transfor.o \ +traps.o \ travel.o \ tutorial.o \ view.o \ diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc index 4f5600ffff..9a46a60065 100644 --- a/crawl-ref/source/makeitem.cc +++ b/crawl-ref/source/makeitem.cc @@ -11,6 +11,10 @@ #include "externs.h" #include "makeitem.h" +#include "decks.h" +#include "describe.h" +#include "food.h" +#include "it_use2.h" #include "itemname.h" #include "itemprop.h" #include "items.h" diff --git a/crawl-ref/source/makeitem.h b/crawl-ref/source/makeitem.h index 9dbf3a14fe..0b567ab841 100644 --- a/crawl-ref/source/makeitem.h +++ b/crawl-ref/source/makeitem.h @@ -9,6 +9,17 @@ #define MAKEITEM_H #include "dungeon.h" +#include "itemprop.h" + +enum item_make_species_type +{ + MAKE_ITEM_ELVEN = 1, + MAKE_ITEM_DWARVEN = 2, + MAKE_ITEM_ORCISH = 3, + + MAKE_ITEM_NO_RACE = 100, + MAKE_ITEM_RANDOM_RACE = 250 +}; int items( int allow_uniques, object_class_type force_class, int force_type, bool dont_place, int item_level, int item_race, diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc index 057809689f..f661c6f18a 100644 --- a/crawl-ref/source/mapdef.cc +++ b/crawl-ref/source/mapdef.cc @@ -22,9 +22,11 @@ #include "mapdef.h" #include "mapmark.h" #include "maps.h" +#include "message.h" #include "misc.h" #include "monplace.h" #include "mon-util.h" +#include "place.h" #include "stuff.h" #include "dungeon.h" diff --git a/crawl-ref/source/mapdef.h b/crawl-ref/source/mapdef.h index bfeb112566..919ed43a51 100644 --- a/crawl-ref/source/mapdef.h +++ b/crawl-ref/source/mapdef.h @@ -16,8 +16,31 @@ #include "luadgn.h" #include "enum.h" #include "externs.h" +#include "makeitem.h" #include "travel.h" +// [dshaligram] Maps can be mirrored; for every orientation, there must be +// a suitable mirror. +enum map_section_type // see maps.cc and dungeon.cc {dlb} +{ + MAP_NONE = -1, + MAP_NORTH = 1, // 1 + MAP_SOUTH, + MAP_EAST, + MAP_WEST, + MAP_NORTHWEST, // 5 + MAP_NORTHEAST, + MAP_SOUTHWEST, + MAP_SOUTHEAST, + MAP_ENCOMPASS, + + // A "floating" vault is placed somewhat like a minivault, away from + // the edges, although in other respects it behaves like a regular vault. + MAP_FLOAT, + + MAP_NUM_SECTION_TYPES +}; + struct raw_range { branch_type branch; diff --git a/crawl-ref/source/mapmark.h b/crawl-ref/source/mapmark.h index 79099c5842..81c1e1d060 100644 --- a/crawl-ref/source/mapmark.h +++ b/crawl-ref/source/mapmark.h @@ -9,6 +9,8 @@ ////////////////////////////////////////////////////////////////////////// // Map markers +struct tagHeader; + class map_marker { public: diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc index dbb8a4d501..7b01a4971f 100644 --- a/crawl-ref/source/maps.cc +++ b/crawl-ref/source/maps.cc @@ -26,7 +26,9 @@ #include "monplace.h" #include "mapdef.h" #include "misc.h" +#include "state.h" #include "stuff.h" +#include "terrain.h" static int write_vault(map_def &mdef, map_type mt, vault_placement &, diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc index a6cd0e4347..576b4517ec 100644 --- a/crawl-ref/source/menu.cc +++ b/crawl-ref/source/menu.cc @@ -10,6 +10,7 @@ #include "cio.h" #include "menu.h" #include "macro.h" +#include "message.h" #include "tutorial.h" #include "view.h" #include "initfile.h" diff --git a/crawl-ref/source/message.cc b/crawl-ref/source/message.cc index fef6efa68a..49a92b0f9d 100644 --- a/crawl-ref/source/message.cc +++ b/crawl-ref/source/message.cc @@ -24,18 +24,22 @@ #endif #include "externs.h" + #include "cio.h" +#include "delay.h" #include "initfile.h" #include "libutil.h" #include "macro.h" -#include "delay.h" -#include "stuff.h" -#include "travel.h" -#include "view.h" +#include "message.h" +#include "monstuff.h" #include "notes.h" -#include "stash.h" #include "religion.h" +#include "stash.h" +#include "state.h" +#include "stuff.h" +#include "travel.h" #include "tutorial.h" +#include "view.h" // circular buffer for keeping past messages message_item Store_Message[ NUM_STORED_MESSAGES ]; // buffer of old messages diff --git a/crawl-ref/source/message.h b/crawl-ref/source/message.h index 92ad895d21..3eb6d9dd2f 100644 --- a/crawl-ref/source/message.h +++ b/crawl-ref/source/message.h @@ -18,7 +18,8 @@ #include <streambuf> #include <iostream> -#include "externs.h" +#include "enum.h" +#include "mpr.h" struct message_item { msg_channel_type channel; // message channel @@ -45,18 +46,6 @@ void mesclr( bool force = false ); void more(void); -// last updated 12may2000 {dlb} -/* *********************************************************************** - * called from: ability - acr - bang - beam - chardump - command - debug - - * decks - direct - effects - fight - files - food - it_use2 - - * it_use3 - item_use - items - macro - misc - monplace - - * monstuff - mstuff2 - mutation - ouch - overmap - player - - * religion - shopping - skills - spell - spl-book - spells - - * spells1 - spells2 - spells3 - spells4 - stuff - transfor - - * view - * *********************************************************************** */ -void mpr(const char *inf, msg_channel_type channel = MSGCH_PLAIN, int param=0); - class formatted_string; void formatted_mpr(const formatted_string& fs, @@ -74,11 +63,6 @@ void mpr_comma_separated_list(const std::string prefix, const msg_channel_type channel = MSGCH_PLAIN, const int param = 0); -// 4.1-style mpr, currently named mprf for minimal disruption. -void mprf( msg_channel_type channel, int param, const char *format, ... ); -void mprf( msg_channel_type channel, const char *format, ... ); -void mprf( const char *format, ... ); - class no_messages { public: diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 3811cb6a61..4b3a6a8f4a 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -35,48 +35,42 @@ #endif #include "externs.h" +#include "misc.h" #include "abyss.h" #include "branch.h" -#include "chardump.h" -#include "cloud.h" #include "clua.h" +#include "cloud.h" #include "delay.h" #include "dgnevent.h" -#include "fight.h" +#include "direct.h" +#include "dungeon.h" #include "files.h" #include "food.h" -#include "hiscores.h" #include "it_use2.h" -#include "items.h" #include "itemprop.h" +#include "items.h" #include "lev-pand.h" -#include "macro.h" -#include "makeitem.h" -#include "mapmark.h" -#include "monplace.h" +#include "message.h" #include "mon-util.h" #include "monstuff.h" -#include "mstuff2.h" -#include "notes.h" #include "ouch.h" -#include "overmap.h" +#include "place.h" #include "player.h" #include "religion.h" #include "shopping.h" #include "skills.h" #include "skills2.h" #include "spells3.h" -#include "spl-cast.h" +#include "stash.h" #include "stuff.h" +#include "terrain.h" #include "transfor.h" +#include "traps.h" #include "travel.h" #include "tutorial.h" #include "view.h" -bool scramble(void); -static void dart_trap(bool trap_known, int trapped, bolt &pbolt, bool poison); - // void place_chunks(int mcls, unsigned char rot_status, unsigned char chx, // unsigned char chy, unsigned char ch_col) void turn_corpse_into_chunks( item_def &item ) @@ -151,246 +145,6 @@ void turn_corpse_into_chunks( item_def &item ) } } // end place_chunks() -bool grid_is_wall( dungeon_feature_type grid ) -{ - return (grid == DNGN_ROCK_WALL - || grid == DNGN_STONE_WALL - || grid == DNGN_METAL_WALL - || grid == DNGN_GREEN_CRYSTAL_WALL - || grid == DNGN_WAX_WALL - || grid == DNGN_PERMAROCK_WALL); -} - -bool grid_is_stone_stair(dungeon_feature_type grid) -{ - switch (grid) - { - case DNGN_STONE_STAIRS_UP_I: - case DNGN_STONE_STAIRS_UP_II: - case DNGN_STONE_STAIRS_UP_III: - case DNGN_STONE_STAIRS_DOWN_I: - case DNGN_STONE_STAIRS_DOWN_II: - case DNGN_STONE_STAIRS_DOWN_III: - return (true); - default: - return (false); - } -} - -bool grid_is_rock_stair(dungeon_feature_type grid) -{ - switch (grid) - { - case DNGN_ROCK_STAIRS_UP: - case DNGN_ROCK_STAIRS_DOWN: - return (true); - default: - return (false); - } -} - -bool grid_sealable_portal(dungeon_feature_type grid) -{ - switch (grid) - { - case DNGN_ENTER_HELL: - case DNGN_ENTER_ABYSS: - case DNGN_ENTER_PANDEMONIUM: - case DNGN_ENTER_LABYRINTH: - case DNGN_ENTER_PORTAL_VAULT: - return (true); - default: - return (false); - } -} - -bool grid_is_portal(dungeon_feature_type grid) -{ - return (grid == DNGN_ENTER_PORTAL_VAULT || grid == DNGN_EXIT_PORTAL_VAULT); -} - -command_type grid_stair_direction(dungeon_feature_type grid) -{ - switch (grid) - { - case DNGN_STONE_STAIRS_UP_I: - case DNGN_STONE_STAIRS_UP_II: - case DNGN_STONE_STAIRS_UP_III: - case DNGN_ROCK_STAIRS_UP: - case DNGN_RETURN_FROM_ORCISH_MINES: - case DNGN_RETURN_FROM_HIVE: - case DNGN_RETURN_FROM_LAIR: - case DNGN_RETURN_FROM_SLIME_PITS: - case DNGN_RETURN_FROM_VAULTS: - case DNGN_RETURN_FROM_CRYPT: - case DNGN_RETURN_FROM_HALL_OF_BLADES: - case DNGN_RETURN_FROM_ZOT: - case DNGN_RETURN_FROM_TEMPLE: - case DNGN_RETURN_FROM_SNAKE_PIT: - case DNGN_RETURN_FROM_ELVEN_HALLS: - case DNGN_RETURN_FROM_TOMB: - case DNGN_RETURN_FROM_SWAMP: - case DNGN_RETURN_FROM_SHOALS: - case DNGN_RETURN_RESERVED_2: - case DNGN_RETURN_RESERVED_3: - case DNGN_RETURN_RESERVED_4: - case DNGN_ENTER_SHOP: - case DNGN_EXIT_HELL: - case DNGN_EXIT_PORTAL_VAULT: - return (CMD_GO_UPSTAIRS); - - case DNGN_ENTER_PORTAL_VAULT: - case DNGN_ENTER_HELL: - case DNGN_ENTER_LABYRINTH: - case DNGN_STONE_STAIRS_DOWN_I: - case DNGN_STONE_STAIRS_DOWN_II: - case DNGN_STONE_STAIRS_DOWN_III: - case DNGN_ROCK_STAIRS_DOWN: - case DNGN_ENTER_DIS: - case DNGN_ENTER_GEHENNA: - case DNGN_ENTER_COCYTUS: - case DNGN_ENTER_TARTARUS: - case DNGN_ENTER_ABYSS: - case DNGN_EXIT_ABYSS: - case DNGN_ENTER_PANDEMONIUM: - case DNGN_EXIT_PANDEMONIUM: - case DNGN_TRANSIT_PANDEMONIUM: - case DNGN_ENTER_ORCISH_MINES: - case DNGN_ENTER_HIVE: - case DNGN_ENTER_LAIR: - case DNGN_ENTER_SLIME_PITS: - case DNGN_ENTER_VAULTS: - case DNGN_ENTER_CRYPT: - case DNGN_ENTER_HALL_OF_BLADES: - case DNGN_ENTER_ZOT: - case DNGN_ENTER_TEMPLE: - case DNGN_ENTER_SNAKE_PIT: - case DNGN_ENTER_ELVEN_HALLS: - case DNGN_ENTER_TOMB: - case DNGN_ENTER_SWAMP: - case DNGN_ENTER_SHOALS: - case DNGN_ENTER_RESERVED_2: - case DNGN_ENTER_RESERVED_3: - case DNGN_ENTER_RESERVED_4: - return (CMD_GO_DOWNSTAIRS); - - default: - return (CMD_NO_CMD); - } -} - -bool grid_is_opaque( dungeon_feature_type grid ) -{ - return (grid < DNGN_MINSEE && grid != DNGN_ORCISH_IDOL); -} - -bool grid_is_solid( dungeon_feature_type grid ) -{ - return (grid < DNGN_MINMOVE); -} - -bool grid_is_solid( int x, int y ) -{ - return (grid_is_solid(grd[x][y])); -} - -bool grid_is_solid(const coord_def &c) -{ - return (grid_is_solid(grd(c))); -} - -bool grid_is_trap(dungeon_feature_type grid) -{ - return (grid == DNGN_TRAP_MECHANICAL || grid == DNGN_TRAP_MAGICAL - || grid == DNGN_TRAP_III); -} - -bool grid_is_water( dungeon_feature_type grid ) -{ - return (grid == DNGN_SHALLOW_WATER || grid == DNGN_DEEP_WATER); -} - -bool grid_is_watery( dungeon_feature_type grid ) -{ - return (grid_is_water(grid) || grid == DNGN_BLUE_FOUNTAIN); -} - -bool grid_destroys_items( dungeon_feature_type grid ) -{ - return (grid == DNGN_LAVA || grid == DNGN_DEEP_WATER); -} - -// returns 0 if grid is not an altar, else it returns the GOD_* type -god_type grid_altar_god( dungeon_feature_type grid ) -{ - if (grid >= DNGN_ALTAR_ZIN && grid <= DNGN_ALTAR_BEOGH) - return (static_cast<god_type>( grid - DNGN_ALTAR_ZIN + 1 )); - - return (GOD_NO_GOD); -} - -// returns DNGN_FLOOR for non-gods, otherwise returns the altar for -// the god. -dungeon_feature_type altar_for_god( god_type god ) -{ - if (god == GOD_NO_GOD || god >= NUM_GODS) - return (DNGN_FLOOR); // Yeah, lame. Tell me about it. - - return static_cast<dungeon_feature_type>(DNGN_ALTAR_ZIN + god - 1); -} - -bool grid_is_branch_stairs( dungeon_feature_type grid ) -{ - return ((grid >= DNGN_ENTER_ORCISH_MINES && grid <= DNGN_ENTER_RESERVED_4) - || (grid >= DNGN_ENTER_DIS && grid <= DNGN_ENTER_TARTARUS)); -} - -int grid_secret_door_appearance( int gx, int gy ) -{ - int ret = DNGN_FLOOR; - - for (int dx = -1; dx <= 1; dx++) - { - for (int dy = -1; dy <= 1; dy++) - { - // only considering orthogonal grids - if ((abs(dx) + abs(dy)) % 2 == 0) - continue; - - const dungeon_feature_type targ = grd[gx + dx][gy + dy]; - - if (!grid_is_wall( targ )) - continue; - - if (ret == DNGN_FLOOR) - ret = targ; - else if (ret != targ) - ret = ((ret < targ) ? ret : targ); - } - } - - return ((ret == DNGN_FLOOR) ? DNGN_ROCK_WALL - : ret); -} - -const char *grid_item_destruction_message( dungeon_feature_type grid ) -{ - return grid == DNGN_DEEP_WATER? "You hear a splash." - : grid == DNGN_LAVA ? "You hear a sizzling splash." - : "You hear a crunching noise."; -} - -// Returns true if exits from this type of level involve going upstairs. -bool level_type_exits_up(level_area_type type) -{ - return (type == LEVEL_LABYRINTH || type == LEVEL_PORTAL_VAULT); -} - -bool level_type_exits_down(level_area_type type) -{ - return (type == LEVEL_PANDEMONIUM || type == LEVEL_ABYSS); -} - void search_around( bool only_adjacent ) { int i; @@ -454,181 +208,6 @@ void search_around( bool only_adjacent ) return; } // end search_around() -static coord_def dgn_find_nearest_square( - const coord_def &pos, - bool (*acceptable)(const coord_def &), - bool (*traversable)(const coord_def &) = NULL) -{ - memset(travel_point_distance, 0, sizeof(travel_distance_grid_t)); - - std::list<coord_def> points[2]; - int iter = 0; - points[iter].push_back(pos); - - while (!points[iter].empty()) - { - for (std::list<coord_def>::iterator i = points[iter].begin(); - i != points[iter].end(); ++i) - { - const coord_def &p = *i; - - if (p != pos && acceptable(p)) - return (p); - - travel_point_distance[p.x][p.y] = 1; - for (int yi = -1; yi <= 1; ++yi) - { - for (int xi = -1; xi <= 1; ++xi) - { - if (!xi && !yi) - continue; - - const coord_def np = p + coord_def(xi, yi); - if (!in_bounds(np) || travel_point_distance[np.x][np.y]) - continue; - - if (traversable && !traversable(np)) - continue; - - points[!iter].push_back(np); - } - } - } - - points[iter].clear(); - iter = !iter; - } - - coord_def unfound; - return (unfound); -} - -static bool item_safe_square(const coord_def &pos) -{ - const dungeon_feature_type feat = grd(pos); - return (is_traversable(feat) && !grid_destroys_items(feat)); -} - -// Moves an item on the floor to the nearest adjacent floor-space. -static bool dgn_shift_item(const coord_def &pos, item_def &item) -{ - const coord_def np = dgn_find_nearest_square(pos, item_safe_square); - if (in_bounds(np) && np != pos) - { - int index = item.index(); - move_item_to_grid(&index, np.x, np.y); - return (true); - } - return (false); -} - -static bool is_critical_feature(dungeon_feature_type feat) -{ - return (grid_stair_direction(feat) != CMD_NO_CMD - || grid_altar_god(feat) != GOD_NO_GOD); -} - -static bool is_feature_shift_target(const coord_def &pos) -{ - return (grd(pos) == DNGN_FLOOR && !dungeon_events.has_listeners_at(pos)); -} - -static bool dgn_shift_feature(const coord_def &pos) -{ - const dungeon_feature_type dfeat = grd(pos); - if (!is_critical_feature(dfeat) && !env.markers.find(pos, MAT_ANY)) - return (false); - - const coord_def dest = - dgn_find_nearest_square(pos, is_feature_shift_target); - if (in_bounds(dest) && dest != pos) - { - grd(dest) = dfeat; - - if (dfeat == DNGN_ENTER_SHOP) - { - if (shop_struct *s = get_shop(pos.x, pos.y)) - { - s->x = dest.x; - s->y = dest.y; - } - } - env.markers.move(pos, dest); - dungeon_events.move_listeners(pos, dest); - } - return (true); -} - -static void dgn_check_terrain_items(const coord_def &pos, bool preserve_items) -{ - const dungeon_feature_type grid = grd(pos); - if (grid_is_solid(grid) || grid_destroys_items(grid)) - { - int item = igrd(pos); - bool did_destroy = false; - while (item != NON_ITEM) - { - const int curr = item; - item = mitm[item].link; - - // Game-critical item. - if (preserve_items || item_is_critical(mitm[curr])) - dgn_shift_item(pos, mitm[curr]); - else - { - destroy_item(curr); - did_destroy = true; - } - } - if (did_destroy && player_can_hear(pos)) - mprf(MSGCH_SOUND, grid_item_destruction_message(grid)); - } -} - -static void dgn_check_terrain_monsters(const coord_def &pos) -{ - const int mindex = mgrd(pos); - if (mindex != NON_MONSTER) - { - monsters *mons = &menv[mindex]; - if (grid_is_solid(grd(pos))) - monster_teleport(mons, true, false); - else - mons_check_pool(mons, KILL_MISC, -1); - } -} - -void dungeon_terrain_changed(const coord_def &pos, - dungeon_feature_type nfeat, - bool affect_player, - bool preserve_features, - bool preserve_items) -{ - if (nfeat != DNGN_UNSEEN) - { - if (preserve_features) - dgn_shift_feature(pos); - unnotice_feature(level_pos(level_id::current(), pos)); - grd(pos) = nfeat; - env.grid_colours(pos) = BLACK; - if (is_notable_terrain(nfeat) && see_grid(pos)) - seen_notable_thing(nfeat, pos.x, pos.y); - } - - dgn_check_terrain_items(pos, preserve_items); - if (affect_player && pos == you.pos()) - { - if (!grid_is_solid(grd(pos))) - { - if (!you.flies()) - move_player_to_grid(pos.x, pos.y, false, true, false); - } - else - you_teleport_now(true, false); - } - dgn_check_terrain_monsters(pos); -} - void in_a_cloud() { int cl = env.cgrid[you.x_pos][you.y_pos]; @@ -817,133 +396,6 @@ void curare_hits_player(int agent, int degree) } } -// returns the number of a net on a given square -// if trapped only stationary ones are counted -// otherwise the first net found is returned -int get_trapping_net(int x, int y, bool trapped) -{ - int net, next; - - for (net = igrd[x][y]; net != NON_ITEM; net = next) - { - next = mitm[net].link; - - if (mitm[net].base_type == OBJ_MISSILES - && mitm[net].sub_type == MI_THROWING_NET - && (!trapped || item_is_stationary(mitm[net]))) - { - return (net); - } - } - return (NON_ITEM); -} - -// if there are more than one net on this square -// split off one of them for checking/setting values -static void maybe_split_nets(item_def &item, int x, int y) -{ - if (item.quantity == 1) - { - set_item_stationary(item); - return; - } - - item_def it; - - it.base_type = item.base_type; - it.sub_type = item.sub_type; - it.plus = item.plus; - it.plus2 = item.plus2; - it.flags = item.flags; - it.special = item.special; - it.quantity = --item.quantity; - item_colour(it); - - item.quantity = 1; - set_item_stationary(item); - - copy_item_to_grid( it, x, y ); -} - -void mark_net_trapping(int x, int y) -{ - int net = get_trapping_net(x,y); - if (net == NON_ITEM) - { - net = get_trapping_net(x,y, false); - if (net != NON_ITEM) - maybe_split_nets(mitm[net], x, y); - } -} - -void monster_caught_in_net(monsters *mon, bolt &pbolt) -{ - if (mon->body_size(PSIZE_BODY) >= SIZE_GIANT) - return; - - if (mons_is_insubstantial(mon->type)) - { - if (mons_near(mon) && player_monster_visible(mon)) - mprf("The net passes right through %s!", mon->name(DESC_NOCAP_THE).c_str()); - return; - } - - const monsters* mons = static_cast<const monsters*>(mon); - bool mon_flies = mons->flies(); - if (mon_flies && !mons_is_confused(mons)) - { - simple_monster_message(mon, " darts out from under the net!"); - return; - } - - if (mons->type == MONS_OOZE || mons->type == MONS_PULSATING_LUMP) - { - simple_monster_message(mon, " oozes right through the net!"); - return; - } - - if (!mons_is_caught(mon) && mon->add_ench(ENCH_HELD)) - { - if (mons_near(mon) && !player_monster_visible(mon)) - mpr("Something gets caught in the net!"); - else - simple_monster_message(mon, " is caught in the net!"); - - if (mon_flies) - { - simple_monster_message(mon, " falls like a stone!"); - mons_check_pool(mon, pbolt.killer(), pbolt.beam_source); - } - } -} - -void player_caught_in_net() -{ - if (you.body_size(PSIZE_BODY) >= SIZE_GIANT) - return; - - if (you.flies() && !you.confused()) - { - mpr("You dart out from under the net!"); - return; - } - - if (!you.attribute[ATTR_HELD]) - { - you.attribute[ATTR_HELD] = 10; - mpr("You become entangled in the net!"); - - // I guess levitation works differently, keeping both you - // and the net hovering above the floor - if (you.flies()) - { - mpr("You fall like a stone!"); - fall_into_a_pool(you.x_pos, you.y_pos, false, grd[you.x_pos][you.y_pos]); - } - } - -} - void merfolk_start_swimming(void) { if (you.attribute[ATTR_TRANSFORMATION] != TRAN_NONE) @@ -1619,449 +1071,6 @@ void new_level(void) #endif } -static void dart_trap(bool trap_known, int trapped, bolt &pbolt, bool poison) -{ - int damage_taken = 0; - int trap_hit, your_dodge; - - if (one_chance_in(5) || (trap_known && !one_chance_in(4))) - { - mprf( "You avoid triggering a%s trap.", pbolt.name.c_str() ); - return; - } - - if (you.equip[EQ_SHIELD] != -1 && one_chance_in(3)) - exercise( SK_SHIELDS, 1 ); - - std::string msg = "A" + pbolt.name + " shoots out and "; - - if (random2( 20 + 5 * you.shield_blocks * you.shield_blocks ) - < player_shield_class()) - { - you.shield_blocks++; - msg += "hits your shield."; - mpr(msg.c_str()); - } - else - { - // note that this uses full ( not random2limit(foo,40) ) - // player_evasion. - trap_hit = (20 + (you.your_level * 2)) * random2(200) / 100; - - your_dodge = player_evasion() + random2(you.dex) / 3 - - 2 + (you.duration[DUR_REPEL_MISSILES] * 10); - - if (trap_hit >= your_dodge && you.duration[DUR_DEFLECT_MISSILES] == 0) - { - msg += "hits you!"; - mpr(msg.c_str()); - - if (poison && random2(100) < 50 - (3 * player_AC()) / 2 - && !player_res_poison()) - { - poison_player( 1 + random2(3) ); - } - - damage_taken = roll_dice( pbolt.damage ); - damage_taken -= random2( player_AC() + 1 ); - - if (damage_taken > 0) - ouch( damage_taken, 0, KILLED_BY_TRAP, pbolt.name.c_str() ); - } - else - { - msg += "misses you."; - mpr(msg.c_str()); - } - - if (player_light_armour(true) && coinflip()) - exercise( SK_DODGING, 1 ); - } - - pbolt.target_x = you.x_pos; - pbolt.target_y = you.y_pos; - - if (coinflip()) - itrap( pbolt, trapped ); -} // end dart_trap() - -// -// itrap takes location from target_x, target_y of bolt strcture. -// - -void itrap( struct bolt &pbolt, int trapped ) -{ - object_class_type base_type = OBJ_MISSILES; - int sub_type = MI_DART; - - switch (env.trap[trapped].type) - { - case TRAP_DART: - base_type = OBJ_MISSILES; - sub_type = MI_DART; - break; - case TRAP_ARROW: - base_type = OBJ_MISSILES; - sub_type = MI_ARROW; - break; - case TRAP_BOLT: - base_type = OBJ_MISSILES; - sub_type = MI_BOLT; - break; - case TRAP_SPEAR: - base_type = OBJ_WEAPONS; - sub_type = WPN_SPEAR; - break; - case TRAP_AXE: - base_type = OBJ_WEAPONS; - sub_type = WPN_HAND_AXE; - break; - case TRAP_NEEDLE: - base_type = OBJ_MISSILES; - sub_type = MI_NEEDLE; - break; - case TRAP_NET: - base_type = OBJ_MISSILES; - sub_type = MI_THROWING_NET; - break; - default: - return; - } - - trap_item( base_type, sub_type, pbolt.target_x, pbolt.target_y ); - - return; -} // end itrap() - -void handle_traps(char trt, int i, bool trap_known) -{ - struct bolt beam; - - switch (trt) - { - case TRAP_DART: - beam.name = " dart"; - beam.damage = dice_def( 1, 4 + (you.your_level / 2) ); - dart_trap(trap_known, i, beam, false); - break; - - case TRAP_NEEDLE: - beam.name = " needle"; - beam.damage = dice_def( 1, 0 ); - dart_trap(trap_known, i, beam, true); - break; - - case TRAP_ARROW: - beam.name = "n arrow"; - beam.damage = dice_def( 1, 7 + you.your_level ); - dart_trap(trap_known, i, beam, false); - break; - - case TRAP_BOLT: - beam.name = " bolt"; - beam.damage = dice_def( 1, 13 + you.your_level ); - dart_trap(trap_known, i, beam, false); - break; - - case TRAP_SPEAR: - beam.name = " spear"; - beam.damage = dice_def( 1, 10 + you.your_level ); - dart_trap(trap_known, i, beam, false); - break; - - case TRAP_AXE: - beam.name = "n axe"; - beam.damage = dice_def( 1, 15 + you.your_level ); - dart_trap(trap_known, i, beam, false); - break; - - case TRAP_TELEPORT: - mpr("You enter a teleport trap!"); - - if (scan_randarts(RAP_PREVENT_TELEPORTATION)) - mpr("You feel a weird sense of stasis."); - else - you_teleport_now( true ); - break; - - case TRAP_AMNESIA: - mpr("You feel momentarily disoriented."); - if (!wearing_amulet(AMU_CLARITY)) - forget_map(random2avg(100, 2)); - break; - - case TRAP_BLADE: - if (trap_known && one_chance_in(3)) - mpr("You avoid triggering a blade trap."); - else if (random2limit(player_evasion(), 40) - + (random2(you.dex) / 3) + (trap_known ? 3 : 0) > 8) - { - mpr("A huge blade swings just past you!"); - } - else - { - mpr("A huge blade swings out and slices into you!"); - ouch( (you.your_level * 2) + random2avg(29, 2) - - random2(1 + player_AC()), 0, KILLED_BY_TRAP, " blade" ); - } - break; - - case TRAP_NET: - - if (trap_known && one_chance_in(3)) - mpr("A net swings high above you."); - else - { - if (random2limit(player_evasion(), 40) - + (random2(you.dex) / 3) + (trap_known ? 3 : 0) > 12) - { - mpr("A net drops to the ground!"); - } - else - { - mpr("A large net falls onto you!"); - player_caught_in_net(); - } - - trap_item( OBJ_MISSILES, MI_THROWING_NET, env.trap[i].x, env.trap[i].y ); - if (you.attribute[ATTR_HELD]) - mark_net_trapping(you.x_pos, you.y_pos); - - grd[env.trap[i].x][env.trap[i].y] = DNGN_FLOOR; - env.trap[i].type = TRAP_UNASSIGNED; - } - break; - - case TRAP_ZOT: - default: - mpr((trap_known) ? "You enter the Zot trap." - : "Oh no! You have blundered into a Zot trap!"); - miscast_effect( SPTYP_RANDOM, random2(30) + you.your_level, - 75 + random2(100), 3, "a Zot trap" ); - break; - } - learned_something_new(TUT_SEEN_TRAP, you.x_pos, you.y_pos); -} // end handle_traps() - -void disarm_trap( struct dist &disa ) -{ - if (you.duration[DUR_BERSERKER]) - { - canned_msg(MSG_TOO_BERSERK); - return; - } - - int i, j; - - for (i = 0; i < MAX_TRAPS; i++) - { - if (env.trap[i].x == you.x_pos + disa.dx - && env.trap[i].y == you.y_pos + disa.dy) - { - break; - } - - if (i == MAX_TRAPS - 1) - { - mpr("Error - couldn't find that trap."); - return; - } - } - - if (trap_category(env.trap[i].type) == DNGN_TRAP_MAGICAL) - { - mpr("You can't disarm that trap."); - return; - } - - if (random2(you.skills[SK_TRAPS_DOORS] + 2) <= random2(you.your_level + 5)) - { - mpr("You failed to disarm the trap."); - - you.turn_is_over = true; - - if (random2(you.dex) > 5 + random2(5 + you.your_level)) - exercise(SK_TRAPS_DOORS, 1 + random2(you.your_level / 5)); - else - { - if (env.trap[i].type == TRAP_NET && - (env.trap[i].x != you.x_pos || env.trap[i].y != you.y_pos)) - { - if (coinflip()) - return; - - mpr("You stumble into the trap!"); - move_player_to_grid( env.trap[i].x, env.trap[i].y, true, false, true); - } - else - handle_traps(env.trap[i].type, i, false); - - if (coinflip()) - exercise(SK_TRAPS_DOORS, 1); - } - - return; - } - - mpr("You have disarmed the trap."); - - struct bolt beam; - - beam.target_x = you.x_pos + disa.dx; - beam.target_y = you.y_pos + disa.dy; - - if (env.trap[i].type == TRAP_NET) - trap_item( OBJ_MISSILES, MI_THROWING_NET, beam.target_x, beam.target_y ); - else if (env.trap[i].type != TRAP_BLADE - && trap_category(env.trap[i].type) == DNGN_TRAP_MECHANICAL) - { - const int num_to_make = 10 + random2(you.skills[SK_TRAPS_DOORS]); - for (j = 0; j < num_to_make; j++) - { - // places items (eg darts), which will automatically stack - itrap(beam, i); - } - } - - grd[you.x_pos + disa.dx][you.y_pos + disa.dy] = DNGN_FLOOR; - env.trap[i].type = TRAP_UNASSIGNED; - you.turn_is_over = true; - - // reduced from 5 + random2(5) - exercise(SK_TRAPS_DOORS, 1 + random2(5) + (you.your_level / 5)); -} // end disarm_trap() - -// attempts to take a net off a given monster -// Do not expect gratitude for this! -// ---------------------------------- -void remove_net_from(monsters *mon) -{ - you.turn_is_over = true; - - int net = get_trapping_net(mon->x, mon->y); - - if (net == NON_ITEM) - { - mon->del_ench(ENCH_HELD, true); - return; - } - - // factor in whether monster is paralysed or invisible - int paralys = 0; - if (mons_is_paralysed(mon)) // makes this easier - paralys = random2(5); - - int invis = 0; - if (!player_monster_visible(mon)) // makes this harder - invis = 3 + random2(5); - - bool net_destroyed = false; - if ( random2(you.skills[SK_TRAPS_DOORS] + 2) + paralys - <= random2( 2*mon->body_size(PSIZE_BODY) + 3 ) + invis) - { - if (one_chance_in(you.skills[SK_TRAPS_DOORS] + you.dex/2)) - { - mitm[net].plus--; - mpr("You tear at the net."); - if (mitm[net].plus < -7) - { - mpr("Whoops! The net comes apart in your hands!"); - mon->del_ench(ENCH_HELD, true); - destroy_item(net); - net_destroyed = true; - } - } - - if (!net_destroyed) - { - if (player_monster_visible(mon)) - { - mprf("You fail to remove the net from %s.", - mon->name(DESC_NOCAP_THE).c_str()); - } - else - mpr("You fail to remove the net."); - } - - if (random2(you.dex) > 5 + random2( 2*mon->body_size(PSIZE_BODY) )) - exercise(SK_TRAPS_DOORS, 1 + random2(mon->body_size(PSIZE_BODY)/2)); - return; - } - - mon->del_ench(ENCH_HELD, true); - remove_item_stationary(mitm[net]); - - if (player_monster_visible(mon)) - mprf("You free %s.", mon->name(DESC_NOCAP_THE).c_str()); - else - mpr("You loosen the net."); - -} - -void free_self_from_net(bool damage_net) -{ - int net = get_trapping_net(you.x_pos, you.y_pos); - - if (net == NON_ITEM) // really shouldn't happen! - { - you.attribute[ATTR_HELD] = 0; - return; - } - int hold = mitm[net].plus; - - if (damage_net) - { - mpr("You struggle against the net."); - int damage = 1; - - // extra damage for cutting weapons - if (you.equip[EQ_WEAPON] != -1 - && can_cut_meat(you.inv[you.equip[EQ_WEAPON]])) - { - damage++; - } - - if (you.body_size(PSIZE_BODY) > SIZE_MEDIUM) - damage++; - - if (hold < 0 && !one_chance_in(-hold/2)) - damage++; - - if (you.duration[DUR_BERSERKER]) - damage *= 2; - - mitm[net].plus -= damage; - - if (mitm[net].plus < -7) - { - mpr("You rip the net and break free!"); - dec_mitm_item_quantity( net, 1 ); - - you.attribute[ATTR_HELD] = 0; - return; - } - } - else // you try to escape - { - mpr("You struggle to escape from the net."); - you.attribute[ATTR_HELD]--; - - if (you.body_size(PSIZE_BODY) < SIZE_MEDIUM) - you.attribute[ATTR_HELD]--; - - if (hold < 0 && !one_chance_in(-hold/2)) - you.attribute[ATTR_HELD]--; - - if (you.attribute[ATTR_HELD] <= 0) - { - mpr("You break free from the net!"); - you.attribute[ATTR_HELD] = 0; - remove_item_stationary(mitm[net]); - return; - } - } -} - std::string weird_writing() { int temp_rand; // for probability determinations {dlb} @@ -2121,114 +1130,6 @@ std::string weird_writing() return result; } -// returns true if we manage to scramble free. -bool fall_into_a_pool( int entry_x, int entry_y, bool allow_shift, - unsigned char terrain ) -{ - bool escape = false; - FixedVector< char, 2 > empty; - - if (you.species == SP_MERFOLK && terrain == DNGN_DEEP_WATER) - { - // These can happen when we enter deep water directly -- bwr - merfolk_start_swimming(); - return (false); - } - - // sanity check - if (terrain != DNGN_LAVA && beogh_water_walk()) - return (false); - - mprf("You fall into the %s!", - (terrain == DNGN_LAVA) ? "lava" : - (terrain == DNGN_DEEP_WATER) ? "water" - : "programming rift"); - - more(); - mesclr(); - - if (terrain == DNGN_LAVA) - { - const int resist = player_res_fire(); - - if (resist <= 0) - { - mpr( "The lava burns you to a cinder!" ); - ouch( INSTANT_DEATH, 0, KILLED_BY_LAVA ); - } - else - { - // should boost # of bangs per damage in the future {dlb} - mpr( "The lava burns you!" ); - ouch( (10 + roll_dice(2,50)) / resist, 0, KILLED_BY_LAVA ); - } - - expose_player_to_element( BEAM_LAVA, 14 ); - } - - // a distinction between stepping and falling from you.duration[DUR_LEVITATION] - // prevents stepping into a thin stream of lava to get to the other side. - if (scramble()) - { - if (allow_shift) - { - if (empty_surrounds( you.x_pos, you.y_pos, DNGN_FLOOR, 1, - false, empty )) - { - escape = true; - } - else - { - escape = false; - } - } - else - { - // back out the way we came in, if possible - if (grid_distance( you.x_pos, you.y_pos, entry_x, entry_y ) == 1 - && (entry_x != empty[0] || entry_y != empty[1]) - && mgrd[entry_x][entry_y] == NON_MONSTER) - { - escape = true; - empty[0] = entry_x; - empty[1] = entry_y; - } - else // zero or two or more squares away, with no way back - { - escape = false; - } - } - } - else - { - mpr("You try to escape, but your burden drags you down!"); - } - - if (escape) - { - const coord_def pos(empty[0], empty[1]); - if (in_bounds(pos) && !is_grid_dangerous(grd(pos))) - { - mpr("You manage to scramble free!"); - move_player_to_grid( empty[0], empty[1], false, false, true ); - - if (terrain == DNGN_LAVA) - expose_player_to_element( BEAM_LAVA, 14 ); - - return (true); - } - } - - mpr("You drown..."); - - if (terrain == DNGN_LAVA) - ouch( INSTANT_DEATH, 0, KILLED_BY_LAVA ); - else if (terrain == DNGN_DEEP_WATER) - ouch( INSTANT_DEATH, 0, KILLED_BY_WATER ); - - return (false); -} // end fall_into_a_pool() - bool scramble(void) { int max_carry = carrying_capacity(); @@ -2316,101 +1217,6 @@ bool go_berserk(bool intentional) return true; } // end go_berserk() -bool trap_item(object_class_type base_type, char sub_type, - char beam_x, char beam_y) -{ - item_def item; - - item.base_type = base_type; - item.sub_type = sub_type; - item.plus = 0; - item.plus2 = 0; - item.flags = 0; - item.special = 0; - item.quantity = 1; - - if (base_type == OBJ_MISSILES) - { - if (sub_type == MI_NEEDLE) - set_item_ego_type( item, OBJ_MISSILES, SPMSL_POISONED ); - else - set_item_ego_type( item, OBJ_MISSILES, SPMSL_NORMAL ); - } - else - { - set_item_ego_type( item, OBJ_WEAPONS, SPWPN_NORMAL ); - } - - item_colour(item); - - if (igrd[beam_x][beam_y] != NON_ITEM) - { - if (items_stack( item, mitm[ igrd[beam_x][beam_y] ] )) - { - inc_mitm_item_quantity( igrd[beam_x][beam_y], 1 ); - return (false); - } - - // don't want to go overboard here. Will only generate up to three - // separate trap items, or less if there are other items present. - if (mitm[ igrd[beam_x][beam_y] ].link != NON_ITEM - && (item.base_type != OBJ_MISSILES || item.sub_type != MI_THROWING_NET)) - { - if (mitm[ mitm[ igrd[beam_x][beam_y] ].link ].link != NON_ITEM) - return (false); - } - } // end of if igrd != NON_ITEM - - return (!copy_item_to_grid( item, beam_x, beam_y, 1 )); -} // end trap_item() - -// returns appropriate trap symbol for a given trap type {dlb} -dungeon_feature_type trap_category(trap_type type) -{ - switch (type) - { - case TRAP_TELEPORT: - case TRAP_AMNESIA: - case TRAP_ZOT: - return (DNGN_TRAP_MAGICAL); - - case TRAP_DART: - case TRAP_ARROW: - case TRAP_SPEAR: - case TRAP_AXE: - case TRAP_BLADE: - case TRAP_BOLT: - case TRAP_NEEDLE: - case TRAP_NET: - default: // what *would* be the default? {dlb} - return (DNGN_TRAP_MECHANICAL); - } -} // end trap_category() - -// returns index of the trap for a given (x,y) coordinate pair {dlb} -int trap_at_xy(int which_x, int which_y) -{ - - for (int which_trap = 0; which_trap < MAX_TRAPS; which_trap++) - { - if (env.trap[which_trap].x == which_x && - env.trap[which_trap].y == which_y && - env.trap[which_trap].type != TRAP_UNASSIGNED) - { - return (which_trap); - } - } - - // no idea how well this will be handled elsewhere: {dlb} - return (-1); -} // end trap_at_xy() - -trap_type trap_type_at_xy(int x, int y) -{ - const int idx = trap_at_xy(x, y); - return (idx == -1? NUM_TRAPS : env.trap[idx].type); -} - bool is_damaging_cloud(cloud_type type) { switch (type) @@ -2559,150 +1365,6 @@ bool i_feel_safe(bool announce, bool want_move) return true; } -// Do not attempt to use level_id if level_type != LEVEL_DUNGEON -std::string short_place_name(level_id id) -{ - return id.describe(); -} - -int place_branch(unsigned short place) -{ - const unsigned branch = (unsigned) ((place >> 8) & 0xFF); - const int lev = place & 0xFF; - return lev == 0xFF? -1 : (int) branch; -} - -int place_depth(unsigned short place) -{ - const int lev = place & 0xFF; - return lev == 0xFF? -1 : lev; -} - -unsigned short get_packed_place( branch_type branch, int subdepth, - level_area_type level_type ) -{ - unsigned short place = (unsigned short) - ( (static_cast<int>(branch) << 8) | (subdepth & 0xFF) ); - if (level_type != LEVEL_DUNGEON) - place = (unsigned short) ( (static_cast<int>(level_type) << 8) | 0xFF ); - return place; -} - -unsigned short get_packed_place() -{ - return get_packed_place( you.where_are_you, - subdungeon_depth(you.where_are_you, you.your_level), - you.level_type ); -} - -bool single_level_branch( branch_type branch ) -{ - return - branch >= 0 && branch < NUM_BRANCHES - && branches[branch].depth == 1; -} - -std::string place_name( unsigned short place, bool long_name, - bool include_number ) -{ - - unsigned char branch = (unsigned char) ((place >> 8) & 0xFF); - int lev = place & 0xFF; - - std::string result; - if (lev == 0xFF) - { - switch (branch) - { - case LEVEL_ABYSS: - return ( long_name ? "The Abyss" : "Abyss" ); - case LEVEL_PANDEMONIUM: - return ( long_name ? "Pandemonium" : "Pan" ); - case LEVEL_LABYRINTH: - return ( long_name ? "a Labyrinth" : "Lab" ); - case LEVEL_PORTAL_VAULT: - return ( long_name ? "a Portal Chamber" : "Port" ); - default: - return ( long_name ? "Buggy Badlands" : "Bug" ); - } - } - - result = (long_name ? - branches[branch].longname : branches[branch].abbrevname); - - if ( include_number && branches[branch].depth != 1 ) - { - char buf[200]; - if ( long_name ) - { - // decapitalize 'the' - if ( result.find("The") == 0 ) - result[0] = 't'; - snprintf( buf, sizeof buf, "Level %d of %s", - lev, result.c_str() ); - } - else if (lev) - snprintf( buf, sizeof buf, "%s:%d", result.c_str(), lev ); - else - snprintf( buf, sizeof buf, "%s:$", result.c_str() ); - - result = buf; - } - return result; -} - -// Takes a packed 'place' and returns a compact stringified place name. -// XXX: This is done in several other places; a unified function to -// describe places would be nice. -std::string short_place_name(unsigned short place) -{ - return place_name( place, false, true ); -} - -// Prepositional form of branch level name. For example, "in the -// Abyss" or "on level 3 of the Main Dungeon". -std::string prep_branch_level_name(unsigned short packed_place) -{ - std::string place = place_name( packed_place, true, true ); - if (place.length() && place != "Pandemonium") - place[0] = tolower(place[0]); - return (place.find("level") == 0? - "on " + place - : "in " + place); -} - -// Use current branch and depth -std::string prep_branch_level_name() -{ - return prep_branch_level_name( get_packed_place() ); -} - -int absdungeon_depth(branch_type branch, int subdepth) -{ - if (branch >= BRANCH_VESTIBULE_OF_HELL && branch <= BRANCH_THE_PIT) - return subdepth + 27 - (branch == BRANCH_VESTIBULE_OF_HELL); - else - { - --subdepth; - while ( branch != BRANCH_MAIN_DUNGEON ) - { - subdepth += branches[branch].startdepth; - branch = branches[branch].parent_branch; - } - } - return subdepth; -} - -int subdungeon_depth(branch_type branch, int depth) -{ - return depth - absdungeon_depth(branch, 0); -} - -int player_branch_depth() -{ - return subdungeon_depth(you.where_are_you, you.your_level); -} - static const char *shop_types[] = { "weapon", "armour", diff --git a/crawl-ref/source/misc.h b/crawl-ref/source/misc.h index a0dc140417..48145be182 100644 --- a/crawl-ref/source/misc.h +++ b/crawl-ref/source/misc.h @@ -1,5 +1,5 @@ /* - * File: misc.cc + * File: misc.h * Summary: Misc functions. * Written by: Linley Henzell * @@ -16,16 +16,15 @@ #include "externs.h" -#include "travel.h" + +struct bolt; +struct dist; // last updated 08jan2001 {gdl} /* *********************************************************************** * called from: ability - decks - fight - it_use2 - spells1 * *********************************************************************** */ bool go_berserk(bool intentional); -bool trap_item(object_class_type base_type, char sub_type, - char beam_x, char beam_y); - // last updated 12may2000 {dlb} /* *********************************************************************** @@ -36,14 +35,6 @@ void search_around( bool only_adjacent = false ); // last updated 12may2000 {dlb} /* *********************************************************************** - * called from: acr - * *********************************************************************** */ -void disarm_trap(struct dist &disa); -void remove_net_from( monsters *mon ); -void free_self_from_net( bool damage_net = true ); - -// last updated 12may2000 {dlb} -/* *********************************************************************** * called from: acr - effects - spells3 * *********************************************************************** */ void down_stairs(int old_level, dungeon_feature_type force_stair = DNGN_UNSEEN); @@ -53,24 +44,6 @@ void down_stairs(int old_level, dungeon_feature_type force_stair = DNGN_UNSEEN); /* *********************************************************************** * called from: acr * *********************************************************************** */ -bool fall_into_a_pool( int entry_x, int entry_y, bool allow_shift, - unsigned char terrain ); - - -// last updated 12may2000 {dlb} -/* *********************************************************************** - * called from: acr - misc - * *********************************************************************** */ -void handle_traps(char trt, int i, bool trap_known); -int get_trapping_net(int x, int y, bool trapped = true); -void mark_net_trapping(int x, int y); -void monster_caught_in_net(monsters *mon, bolt &pbolt); -void player_caught_in_net(void); - -// last updated 12may2000 {dlb} -/* *********************************************************************** - * called from: acr - * *********************************************************************** */ void in_a_cloud(void); // Created Sept 1, 2000 -- bwr @@ -81,13 +54,6 @@ void merfolk_start_swimming(void); // last updated 12may2000 {dlb} /* *********************************************************************** - * called from: misc - mstuff2 - * *********************************************************************** */ -void itrap(struct bolt &pbolt, int trapped); - - -// last updated 12may2000 {dlb} -/* *********************************************************************** * called from: acr - misc - player - stuff * *********************************************************************** */ void new_level(void); @@ -103,13 +69,6 @@ void trackers_init_new_level(bool transit); void turn_corpse_into_chunks( item_def &item ); -// last updated 3jun2000 {dlb} -/* *********************************************************************** - * called from: acr - misc - mstuff2 - spells3 - * *********************************************************************** */ -int trap_at_xy(int which_x, int which_y); - - // last updated 12may2000 {dlb} /* *********************************************************************** * called from: acr @@ -130,43 +89,9 @@ std::string weird_colours(unsigned char coll); std::string weird_writing(); -// last updated 3jun2000 {dlb} -/* *********************************************************************** - * called from: acr - misc - mstuff2 - spells2 - spells3 - * *********************************************************************** */ -dungeon_feature_type trap_category(trap_type type); - -int trap_at_xy(int x, int y); -trap_type trap_type_at_xy(int x, int y); - -bool grid_is_wall(dungeon_feature_type grid); -bool grid_is_opaque(dungeon_feature_type grid); -bool grid_is_solid(dungeon_feature_type grid); -bool grid_is_stone_stair(dungeon_feature_type grid); -bool grid_is_rock_stair(dungeon_feature_type grid); -bool grid_is_solid(int x, int y); -bool grid_is_solid(const coord_def &c); -bool grid_is_trap(dungeon_feature_type grid); -command_type grid_stair_direction(dungeon_feature_type grid); -bool grid_sealable_portal(dungeon_feature_type grid); -bool grid_is_portal(dungeon_feature_type grid); - -bool grid_is_water(dungeon_feature_type grid); -bool grid_is_watery(dungeon_feature_type grid); -god_type grid_altar_god( dungeon_feature_type grid ); -dungeon_feature_type altar_for_god( god_type god ); -bool grid_is_branch_stairs( dungeon_feature_type grid ); -int grid_secret_door_appearance( int gx, int gy ); -bool grid_destroys_items( dungeon_feature_type grid ); - -bool level_type_exits_up(level_area_type type); -bool level_type_exits_down(level_area_type type); - std::string cloud_name(cloud_type type); bool is_damaging_cloud(cloud_type type); -const char *grid_item_destruction_message( dungeon_feature_type grid ); - void curare_hits_player(int agent, int degree); bool mons_is_safe(const struct monsters *mon, bool want_move = false); @@ -177,44 +102,6 @@ void setup_environment_effects(); // Lava smokes, swamp water mists. void run_environment_effects(); -// Terrain changed under 'pos', perform necessary effects. -void dungeon_terrain_changed(const coord_def &pos, - dungeon_feature_type feat = DNGN_UNSEEN, - bool affect_player = true, - bool preserve_features = false, - bool preserve_items = false); - -////////////////////////////////////////////////////////////////////// -// Places and names -// -unsigned short get_packed_place(); - -unsigned short get_packed_place( branch_type branch, int subdepth, - level_area_type level_type ); - -int place_branch(unsigned short place); -int place_depth(unsigned short place); -std::string short_place_name(unsigned short place); -std::string short_place_name(level_id id); -std::string place_name( unsigned short place, bool long_name = false, - bool include_number = true ); - -// Prepositional form of branch level name. For example, "in the -// Abyss" or "on level 3 of the Main Dungeon". -std::string prep_branch_level_name(unsigned short packed_place); -std::string prep_branch_level_name(); - -// Get displayable depth in the current branch, given the absolute -// depth. -int subdungeon_depth(branch_type branch, int depth); - -// Get absolute depth given the displayable depth in the branch. -int absdungeon_depth(branch_type branch, int subdepth); - -// Get displayable depth in the current branch. -int player_branch_depth(); - -bool single_level_branch(branch_type branch); ////////////////////////////////////////////////////////////////////// int str_to_shoptype(const std::string &s); @@ -227,4 +114,6 @@ coord_def pick_adjacent_free_square(int x, int y); int speed_to_duration(int speed); +bool scramble(void); + #endif diff --git a/crawl-ref/source/mon-pick.cc b/crawl-ref/source/mon-pick.cc index 50ad85f64b..9c8e17620a 100644 --- a/crawl-ref/source/mon-pick.cc +++ b/crawl-ref/source/mon-pick.cc @@ -17,6 +17,7 @@ #include "externs.h" #include "branch.h" #include "misc.h" +#include "place.h" // NB - When adding new branches or levels above 50, you must // change pre-game deletion routine in new_game in newgame.cc diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index b1988ba32e..fd097c2963 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -39,6 +39,7 @@ #include "itemprop.h" #include "items.h" #include "Kills.h" +#include "message.h" #include "misc.h" #include "monplace.h" #include "mstuff2.h" @@ -47,6 +48,8 @@ #include "randart.h" #include "spl-util.h" #include "stuff.h" +#include "terrain.h" +#include "traps.h" #include "view.h" //jmf: moved from inside function diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h index 61e9d9099b..08269c8146 100644 --- a/crawl-ref/source/mon-util.h +++ b/crawl-ref/source/mon-util.h @@ -17,8 +17,232 @@ #include "externs.h" #include "enum.h" +enum corpse_effect_type +{ + CE_NOCORPSE, // 0 + CE_CLEAN, // 1 + CE_CONTAMINATED, // 2 + CE_POISONOUS, // 3 + CE_HCL, // 4 + CE_MUTAGEN_RANDOM, // 5 + CE_MUTAGEN_GOOD, // 6 - may be worth implementing {dlb} + CE_MUTAGEN_BAD, // 7 - may be worth implementing {dlb} + CE_RANDOM, // 8 - not used, but may be worth implementing {dlb} + CE_ROTTEN = 50 // 50 - must remain at 50 for now {dlb} +}; + +enum gender_type +{ + GENDER_NEUTER, + GENDER_MALE, + GENDER_FEMALE +}; + +enum mon_attack_type +{ + AT_NONE, + AT_HIT, // including weapon attacks + AT_BITE, + AT_STING, + AT_SPORE, + AT_TOUCH, + AT_ENGULF, + AT_CLAW, + AT_TAIL_SLAP, + AT_BUTT, + + AT_SHOOT // attack representing missile damage for M_ARCHER +}; + +enum mon_attack_flavour +{ + AF_PLAIN, + AF_ACID, + AF_BLINK, + AF_COLD, + AF_CONFUSE, + AF_DISEASE, + AF_DRAIN_DEX, + AF_DRAIN_STR, + AF_DRAIN_XP, + AF_ELEC, + AF_FIRE, + AF_HUNGER, + AF_MUTATE, + AF_BAD_MUTATE, + AF_PARALYSE, + AF_POISON, + AF_POISON_NASTY, + AF_POISON_MEDIUM, + AF_POISON_STRONG, + AF_POISON_STR, + AF_ROT, + AF_VAMPIRIC, + AF_KLOWN, + AF_DISTORT, + AF_RAGE +}; + +// properties of the monster class (other than resists/vulnerabilities) +enum mons_class_flags +{ + M_NO_FLAGS = 0, + + M_SPELLCASTER = (1<< 0), // any non-physical-attack powers, + M_ACTUAL_SPELLS = (1<< 1), // monster is a wizard, + M_PRIEST = (1<< 2), // monster is a priest + M_FIGHTER = (1<< 3), // monster is skilled fighter + + M_FLIES = (1<< 4), // will crash to ground if paralysed? + M_LEVITATE = (1<< 5), // ... but not if this is set + M_INVIS = (1<< 6), // is created invis + M_SEE_INVIS = (1<< 7), // can see invis + M_SENSE_INVIS = (1<< 8), // can sense invisible things + M_SPEAKS = (1<< 9), // uses talking code + M_CONFUSED = (1<<10), // monster is perma-confused, + M_BATTY = (1<<11), // monster is batty + M_SPLITS = (1<<12), // monster can split + M_AMPHIBIOUS = (1<<13), // monster can swim in water, + M_THICK_SKIN = (1<<14), // monster has more effective AC, + M_HUMANOID = (1<<15), // for Glamour + M_COLD_BLOOD = (1<<16), // susceptible to cold + M_WARM_BLOOD = (1<<17), // no effect currently + M_REGEN = (1<<18), // regenerates quickly + M_BURROWS = (1<<19), // monster digs through rock + M_EVIL = (1<<20), // monster vulnerable to holy spells + + M_UNIQUE = (1<<21), // monster is a unique + M_ACID_SPLASH = (1<<22), // Passive acid splash when hit. + + M_ARCHER = (1<<23), // gets various archery boosts + + M_SPECIAL_ABILITY = (1<<26), // XXX: eventually make these spells? + + M_NO_SKELETON = (1<<29), // boneless corpses + M_NO_EXP_GAIN = (1<<31) // worth 0 xp +}; + +enum mon_event_type +{ + ME_EVAL, // 0, evaluate monster AI state + ME_DISTURB, // noisy + ME_ANNOY, // annoy at range + ME_ALERT, // alert to presence + ME_WHACK, // physical attack + ME_SHOT, // attack at range + ME_SCARE, // frighten monster + ME_CORNERED // cannot flee +}; + +enum mon_intel_type // Must be in increasing intelligence order +{ + I_PLANT = 0, + I_INSECT, + I_ANIMAL, + I_NORMAL, + I_HIGH +}; + +// order of these is important: +enum mon_itemuse_type +{ + MONUSE_NOTHING, + MONUSE_EATS_ITEMS, + MONUSE_OPEN_DOORS, + MONUSE_STARTING_EQUIPMENT, + MONUSE_WEAPONS_ARMOUR, + MONUSE_MAGIC_ITEMS +}; + +// now saved in an unsigned long. +enum mon_resist_flags +{ + MR_NO_FLAGS = 0, + + // resistances + // Notes: + // - negative energy is mostly handled via mons_has_life_force() + // - acid is handled mostly by genus (jellies) plus non-living + // - asphyx-resistance replaces hellfrost resistance. + MR_RES_ELEC = (1<< 0), + MR_RES_POISON = (1<< 1), + MR_RES_FIRE = (1<< 2), + MR_RES_HELLFIRE = (1<< 3), + MR_RES_COLD = (1<< 4), + MR_RES_ASPHYX = (1<< 5), + MR_RES_ACID = (1<< 6), + + // vulnerabilities + MR_VUL_ELEC = (1<< 7), + MR_VUL_POISON = (1<< 8), + MR_VUL_FIRE = (1<< 9), + MR_VUL_COLD = (1<<10), + + // melee armour resists/vulnerabilities + // XXX: how to do combos (bludgeon/slice, bludgeon/pierce) + MR_RES_PIERCE = (1<<11), + MR_RES_SLICE = (1<<12), + MR_RES_BLUDGEON = (1<<13), + + MR_VUL_PIERCE = (1<<14), + MR_VUL_SLICE = (1<<15), + MR_VUL_BLUDGEON = (1<<16) +}; + +enum shout_type +{ + S_SILENT, // silent + S_SHOUT, // shout + S_BARK, // bark + S_SHOUT2, // shout twice (e.g. two-headed ogres) + S_ROAR, // roar + S_SCREAM, // scream + S_BELLOW, // bellow (?) + S_SCREECH, // screech + S_BUZZ, // buzz + S_MOAN, // moan + S_WHINE, // irritating whine (mosquito) + S_CROAK, // frog croak + S_GROWL, // for bears + S_HISS, // for snakes and lizards + + // Loudness setting for shouts that are only defined in dat/shout.txt + S_VERY_SOFT, + S_SOFT, + S_NORMAL, + S_LOUD, + S_VERY_LOUD, + + NUM_SHOUTS, + S_RANDOM +}; + +enum zombie_size_type +{ + Z_NOZOMBIE, + Z_SMALL, + Z_BIG +}; + +struct bolt; + // ($pellbinder) (c) D.G.S.E. 1998 +struct mon_attack_def +{ + mon_attack_type type; + mon_attack_flavour flavour; + int damage; + + static mon_attack_def attk(int damage, + mon_attack_type type = AT_HIT, + mon_attack_flavour flav = AF_PLAIN) + { + mon_attack_def def = { type, flav, damage }; + return (def); + } +}; + struct monsterentry { short mc; // monster number diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc index 7ad2cf81f3..df14577fe7 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -20,10 +20,11 @@ #include "monstuff.h" #include "mon-pick.h" #include "mon-util.h" -#include "misc.h" #include "player.h" #include "stuff.h" #include "spells4.h" +#include "terrain.h" +#include "traps.h" #include "view.h" // NEW place_monster -- note that power should be set to: diff --git a/crawl-ref/source/monplace.h b/crawl-ref/source/monplace.h index 1869b7cfdb..a7170e05e0 100644 --- a/crawl-ref/source/monplace.h +++ b/crawl-ref/source/monplace.h @@ -18,6 +18,79 @@ #include "dungeon.h" #include "FixVec.h" +enum band_type +{ + BAND_NO_BAND = 0, + BAND_KOBOLDS = 1, + BAND_ORCS, + BAND_ORC_KNIGHT, + BAND_KILLER_BEES, + BAND_FLYING_SKULLS, // 5 + BAND_SLIME_CREATURES, + BAND_YAKS, + BAND_UGLY_THINGS, + BAND_HELL_HOUNDS, + BAND_JACKALS, // 10 + BAND_HELL_KNIGHTS, + BAND_ORC_HIGH_PRIEST, + BAND_GNOLLS, // 13 + BAND_BUMBLEBEES = 16, + BAND_CENTAURS, + BAND_YAKTAURS, + BAND_INSUBSTANTIAL_WISPS, + BAND_OGRE_MAGE, // 20 + BAND_DEATH_YAKS, + BAND_NECROMANCER, + BAND_BALRUG, + BAND_CACODEMON, + BAND_EXECUTIONER, // 25 + BAND_HELLWING, + BAND_DEEP_ELF_FIGHTER, + BAND_DEEP_ELF_KNIGHT, + BAND_DEEP_ELF_HIGH_PRIEST, + BAND_KOBOLD_DEMONOLOGIST, // 30 + BAND_NAGAS, + BAND_WAR_DOGS, + BAND_GREY_RATS, + BAND_GREEN_RATS, + BAND_ORANGE_RATS, // 35 + BAND_SHEEP, + BAND_GHOULS, + BAND_DEEP_TROLLS, + BAND_HOGS, + BAND_HELL_HOGS, // 40 + BAND_GIANT_MOSQUITOES, + BAND_BOGGARTS, + BAND_BLINK_FROGS, + BAND_SKELETAL_WARRIORS, // 44 + BAND_DRACONIAN, // 45 + BAND_PANDEMONIUM_DEMON, + NUM_BANDS // always last +}; + +enum demon_class_type +{ + DEMON_LESSER, // 0: Class V + DEMON_COMMON, // 1: Class II-IV + DEMON_GREATER, // 2: Class I + DEMON_RANDOM // any of the above +}; + +enum dragon_class_type +{ + DRAGON_LIZARD, + DRAGON_DRACONIAN, + DRAGON_DRAGON +}; + +enum proximity_type // proximity to player to create monster +{ + PROX_ANYWHERE, + PROX_CLOSE_TO_PLAYER, + PROX_AWAY_FROM_PLAYER, + PROX_NEAR_STAIRS +}; + // last updated 13mar2001 {gdl} /* *********************************************************************** * called from: acr - lev-pand - monplace - dungeon diff --git a/crawl-ref/source/monspeak.cc b/crawl-ref/source/monspeak.cc index 90a7556e66..04da8f22fe 100644 --- a/crawl-ref/source/monspeak.cc +++ b/crawl-ref/source/monspeak.cc @@ -28,6 +28,7 @@ #include "fight.h" #include "insult.h" #include "itemname.h" +#include "message.h" #include "misc.h" #include "monplace.h" #include "monstuff.h" diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 0e51695aa6..35e369c353 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -38,11 +38,13 @@ #include "describe.h" #include "fight.h" #include "hiscores.h" +#include "it_use2.h" #include "itemname.h" #include "items.h" #include "itemprop.h" +#include "Kills.h" #include "makeitem.h" -#include "misc.h" +#include "message.h" #include "monplace.h" #include "monspeak.h" #include "mon-pick.h" @@ -57,6 +59,8 @@ #include "spells2.h" #include "spells4.h" #include "stuff.h" +#include "terrain.h" +#include "traps.h" #include "tutorial.h" #include "view.h" #include "stash.h" @@ -800,7 +804,7 @@ void monster_die(monsters *monster, killer_type killer, int i, bool silent) if (killer != KILL_RESET && killer != KILL_DISMISSED) { - you.kills.record_kill(monster, killer, pet_kill); + you.kills->record_kill(monster, killer, pet_kill); if (monster->has_ench(ENCH_ABJ)) { diff --git a/crawl-ref/source/monstuff.h b/crawl-ref/source/monstuff.h index 9612fed7af..c1167ee0d2 100644 --- a/crawl-ref/source/monstuff.h +++ b/crawl-ref/source/monstuff.h @@ -16,6 +16,28 @@ #include "mon-util.h" +enum mon_dam_level_type +{ + MDAM_OKAY, + MDAM_LIGHTLY_DAMAGED, + MDAM_MODERATELY_DAMAGED, + MDAM_HEAVILY_DAMAGED, + MDAM_HORRIBLY_DAMAGED, + MDAM_ALMOST_DEAD, + MDAM_DEAD +}; + +enum mon_desc_type // things that cross categorical lines {dlb} +{ + MDSC_LEAVES_HIDE, // 0 + MDSC_REGENERATES, + MDSC_NOMSG_WOUNDS +}; + +#define YOU_KILL(x) ((x) == KILL_YOU || (x) == KILL_YOU_MISSILE \ + || (x) == KILL_YOU_CONF) +#define MON_KILL(x) ((x) == KILL_MON || (x) == KILL_MON_MISSILE) + // useful macro #define SAME_ATTITUDE(x) (mons_friendly(x)? BEH_FRIENDLY: \ mons_neutral(x)? BEH_NEUTRAL : BEH_HOSTILE) diff --git a/crawl-ref/source/mpr.h b/crawl-ref/source/mpr.h new file mode 100644 index 0000000000..0054dd7b35 --- /dev/null +++ b/crawl-ref/source/mpr.h @@ -0,0 +1,91 @@ +/* + * File: mpr.h + * Summary: Functions used to print simple messages. + * Written by: Linley Henzell + * + * Modified for Crawl Reference by $Author: j-p-e-g $ on $Date: 2007-09-02 05:40:44 -0700 (Sun, 02 Sep 2007) $ + * + * Change History (most recent first): + * + * <2> 9/11/07 MPC Split off from message.h + * <2> 5/08/99 JDJ mpr takes a const char* instead of a char array. + * <1> -/--/-- LRH Created + */ + +#ifndef MPR_H +#define MPR_H + +// if you mess with this list, you'll need to make changes in initfile.cc +// to message_channel_names, and probably also to message.cc to colour +// everything properly +enum msg_channel_type +{ + MSGCH_PLAIN, // regular text + MSGCH_PROMPT, // various prompts + MSGCH_GOD, // god/religion (param is god) + MSGCH_PRAY, // praying messages (param is god) + MSGCH_DURATION, // effect down/warnings + MSGCH_DANGER, // serious life threats (ie very large HP attacks) + MSGCH_WARN, // much less serious threats + MSGCH_FOOD, // hunger notices + MSGCH_RECOVERY, // recovery from disease/stat/poison condition + MSGCH_SOUND, // messages about things the player hears + MSGCH_TALK, // monster talk (param is monster type) + MSGCH_INTRINSIC_GAIN, // player level/stat/species-power gains + MSGCH_MUTATION, // player gain/lose mutations + MSGCH_MONSTER_SPELL, // monsters casting spells + MSGCH_MONSTER_ENCHANT,// monsters enchantments up and down + MSGCH_MONSTER_DAMAGE, // monster damage reports (param is level) + MSGCH_MONSTER_TARGET, // message marking the monster as a target + MSGCH_ROTTEN_MEAT, // messages about chunks/corpses becoming rotten + MSGCH_EQUIPMENT, // equipment listing messages + MSGCH_FLOOR_ITEMS, // like equipment, but lists of floor items + MSGCH_MULTITURN_ACTION, // delayed action messages + MSGCH_EXAMINE, // messages describing monsters, features, items + MSGCH_EXAMINE_FILTER, // "less important" instances of the above + MSGCH_DIAGNOSTICS, // various diagnostic messages + MSGCH_TUTORIAL, // messages for tutorial + NUM_MESSAGE_CHANNELS // always last +}; + +enum msg_colour_type +{ + MSGCOL_BLACK = 0, // the order of these colours is important + MSGCOL_BLUE, + MSGCOL_GREEN, + MSGCOL_CYAN, + MSGCOL_RED, + MSGCOL_MAGENTA, + MSGCOL_BROWN, + MSGCOL_LIGHTGRAY, + MSGCOL_DARKGRAY, + MSGCOL_LIGHTBLUE, + MSGCOL_LIGHTGREEN, + MSGCOL_LIGHTCYAN, + MSGCOL_LIGHTMAGENTA, + MSGCOL_YELLOW, + MSGCOL_WHITE, + MSGCOL_DEFAULT, // use default colour + MSGCOL_ALTERNATE, // use secondary default colour scheme + MSGCOL_MUTED, // don't print messages + MSGCOL_PLAIN // same as plain channel +}; + +// last updated 12may2000 {dlb} +/* *********************************************************************** + * called from: ability - acr - bang - beam - chardump - command - debug - + * decks - direct - effects - fight - files - food - it_use2 - + * it_use3 - item_use - items - macro - misc - monplace - + * monstuff - mstuff2 - mutation - ouch - overmap - player - + * religion - shopping - skills - spell - spl-book - spells - + * spells1 - spells2 - spells3 - spells4 - stuff - transfor - + * view + * *********************************************************************** */ +void mpr(const char *inf, msg_channel_type channel = MSGCH_PLAIN, int param=0); + +// 4.1-style mpr, currently named mprf for minimal disruption. +void mprf( msg_channel_type channel, int param, const char *format, ... ); +void mprf( msg_channel_type channel, const char *format, ... ); +void mprf( const char *format, ... ); + +#endif diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc index e456590f99..7b1fa70ce2 100644 --- a/crawl-ref/source/mstuff2.cc +++ b/crawl-ref/source/mstuff2.cc @@ -32,6 +32,7 @@ #include "itemname.h" #include "itemprop.h" #include "items.h" +#include "message.h" #include "misc.h" #include "monplace.h" #include "monstuff.h" @@ -42,6 +43,7 @@ #include "spl-cast.h" #include "spl-util.h" #include "stuff.h" +#include "traps.h" #include "view.h" static int monster_abjuration(const monsters *mons, bool test); diff --git a/crawl-ref/source/mstuff2.h b/crawl-ref/source/mstuff2.h index c89f3ec272..9c75055bd4 100644 --- a/crawl-ref/source/mstuff2.h +++ b/crawl-ref/source/mstuff2.h @@ -20,6 +20,7 @@ #include <string> #include "externs.h" +struct bolt; /* beam_colour = _pass[0]; diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc index d40a37df1a..56e85d48d7 100644 --- a/crawl-ref/source/newgame.cc +++ b/crawl-ref/source/newgame.cc @@ -73,15 +73,19 @@ #include "branch.h" #include "cio.h" #include "command.h" +#include "describe.h" #include "files.h" #include "fight.h" +#include "food.h" #include "initfile.h" +#include "it_use2.h" #include "itemname.h" #include "itemprop.h" #include "items.h" #include "macro.h" #include "makeitem.h" #include "menu.h" +#include "place.h" #include "player.h" #include "randart.h" #include "skills.h" diff --git a/crawl-ref/source/notes.cc b/crawl-ref/source/notes.cc index f221bc9501..37fcc9a502 100644 --- a/crawl-ref/source/notes.cc +++ b/crawl-ref/source/notes.cc @@ -11,13 +11,14 @@ #include "branch.h" #include "cio.h" +#include "describe.h" #include "files.h" #include "Kills.h" #include "hiscores.h" #include "message.h" -#include "misc.h" #include "mon-pick.h" #include "mutation.h" +#include "place.h" #include "religion.h" #include "skills2.h" #include "spl-util.h" diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index 2b88f53b8d..ed81b0e3bf 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -62,6 +62,7 @@ #include "itemprop.h" #include "items.h" #include "macro.h" +#include "message.h" #include "misc.h" #include "mon-util.h" #include "monstuff.h" @@ -72,6 +73,7 @@ #include "shopping.h" #include "skills2.h" #include "spells4.h" +#include "state.h" #include "stuff.h" #include "tutorial.h" #include "view.h" diff --git a/crawl-ref/source/ouch.h b/crawl-ref/source/ouch.h index 6d0662696d..42dd31c35e 100644 --- a/crawl-ref/source/ouch.h +++ b/crawl-ref/source/ouch.h @@ -21,6 +21,46 @@ #include "enum.h" +enum kill_method_type +{ + KILLED_BY_MONSTER, // 0 + KILLED_BY_POISON, + KILLED_BY_CLOUD, + KILLED_BY_BEAM, // 3 + KILLED_BY_DEATHS_DOOR, // should be deprecated, but you never know {dlb} + KILLED_BY_LAVA, // 5 + KILLED_BY_WATER, + KILLED_BY_STUPIDITY, + KILLED_BY_WEAKNESS, + KILLED_BY_CLUMSINESS, + KILLED_BY_TRAP, // 10 + KILLED_BY_LEAVING, + KILLED_BY_WINNING, + KILLED_BY_QUITTING, + KILLED_BY_DRAINING, + KILLED_BY_STARVATION, // 15 + KILLED_BY_FREEZING, + KILLED_BY_BURNING, + KILLED_BY_WILD_MAGIC, + KILLED_BY_XOM, + KILLED_BY_STATUE, // 20 + KILLED_BY_ROTTING, + KILLED_BY_TARGETTING, + KILLED_BY_SPORE, + KILLED_BY_TSO_SMITING, + KILLED_BY_PETRIFICATION, // 25 + KILLED_BY_SOMETHING = 27, + KILLED_BY_FALLING_DOWN_STAIRS, + KILLED_BY_ACID, + KILLED_BY_CURARE, + KILLED_BY_MELTING, + KILLED_BY_BLEEDING, + KILLED_BY_BEOGH_SMITING, + + NUM_KILLBY +}; + + // last updated 12may2000 {dlb} /* *********************************************************************** * called from: bang - beam - effects - spells diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index cc2c44a2b8..eb3d7de1a0 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -24,17 +24,21 @@ #include "abl-show.h" #include "describe.h" +#include "direct.h" #include "format.h" #include "fight.h" #include "initfile.h" #include "itemname.h" +#include "itemprop.h" #include "items.h" #include "menu.h" +#include "message.h" #include "ouch.h" #include "player.h" #include "religion.h" #include "skills2.h" #include "stuff.h" +#include "transfor.h" static int bad_ench_colour( int lvl, int orange, int red ) { diff --git a/crawl-ref/source/output.h b/crawl-ref/source/output.h index 5108d3c8d1..189f3eb492 100644 --- a/crawl-ref/source/output.h +++ b/crawl-ref/source/output.h @@ -16,6 +16,32 @@ #include "menu.h" +enum status_redraw_flag_type +{ + REDRAW_HUNGER = 0x00000001, + REDRAW_BURDEN = 0x00000002, + REDRAW_LINE_1_MASK = 0x00000003, + + REDRAW_PRAYER = 0x00000100, + REDRAW_REPEL_UNDEAD = 0x00000200, + REDRAW_BREATH = 0x00000400, + REDRAW_REPEL_MISSILES = 0x00000800, + REDRAW_REGENERATION = 0x00001000, + REDRAW_INSULATION = 0x00002000, + REDRAW_FLY = 0x00004000, + REDRAW_INVISIBILITY = 0x00008000, + REDRAW_LINE_2_MASK = 0x0000ff00, + + REDRAW_CONFUSION = 0x00010000, + REDRAW_POISONED = 0x00020000, + REDRAW_LIQUID_FLAMES = 0x00040000, + REDRAW_DISEASED = 0x00080000, + REDRAW_CONTAMINATED = 0x00100000, + REDRAW_SWIFTNESS = 0x00200000, + REDRAW_SPEED = 0x00400000, + REDRAW_LINE_3_MASK = 0x007f0000 +}; + #ifdef DGL_SIMPLE_MESSAGING void update_message_status(); #endif diff --git a/crawl-ref/source/overmap.cc b/crawl-ref/source/overmap.cc index ae3155fed9..b414e4e443 100644 --- a/crawl-ref/source/overmap.cc +++ b/crawl-ref/source/overmap.cc @@ -28,12 +28,15 @@ #include "branch.h" #include "dgnevent.h" #include "direct.h" +#include "dungeon.h" #include "files.h" #include "menu.h" #include "misc.h" #include "religion.h" #include "shopping.h" +#include "state.h" #include "stuff.h" +#include "terrain.h" #include "view.h" typedef std::map<branch_type, level_id> stair_map_type; diff --git a/crawl-ref/source/place.cc b/crawl-ref/source/place.cc new file mode 100644 index 0000000000..b5b8587f20 --- /dev/null +++ b/crawl-ref/source/place.cc @@ -0,0 +1,172 @@ +/* + * File: place.cc + * Summary: Place related functions. + * Written by: Linley Henzell + * + * Modified for Crawl Reference by $Author: j-p-e-g $ on $Date: 2007-09-03 06:41:30 -0700 (Mon, 03 Sep 2007) $ + * + * Change History (most recent first): + * + * <1> 9/11/07 MPC Split from misc.cc + */ + +#include "externs.h" +#include "place.h" + +#include "branch.h" +#include "travel.h" + +// Do not attempt to use level_id if level_type != LEVEL_DUNGEON +std::string short_place_name(level_id id) +{ + return id.describe(); +} + +int place_branch(unsigned short place) +{ + const unsigned branch = (unsigned) ((place >> 8) & 0xFF); + const int lev = place & 0xFF; + return lev == 0xFF? -1 : (int) branch; +} + +int place_depth(unsigned short place) +{ + const int lev = place & 0xFF; + return lev == 0xFF? -1 : lev; +} + +unsigned short get_packed_place( branch_type branch, int subdepth, + level_area_type level_type ) +{ + unsigned short place = (unsigned short) + ( (static_cast<int>(branch) << 8) | (subdepth & 0xFF) ); + if (level_type != LEVEL_DUNGEON) + place = (unsigned short) ( (static_cast<int>(level_type) << 8) | 0xFF ); + return place; +} + +unsigned short get_packed_place() +{ + return get_packed_place( you.where_are_you, + subdungeon_depth(you.where_are_you, you.your_level), + you.level_type ); +} + +bool single_level_branch( branch_type branch ) +{ + return + branch >= 0 && branch < NUM_BRANCHES + && branches[branch].depth == 1; +} + +std::string place_name( unsigned short place, bool long_name, + bool include_number ) +{ + + unsigned char branch = (unsigned char) ((place >> 8) & 0xFF); + int lev = place & 0xFF; + + std::string result; + if (lev == 0xFF) + { + switch (branch) + { + case LEVEL_ABYSS: + return ( long_name ? "The Abyss" : "Abyss" ); + case LEVEL_PANDEMONIUM: + return ( long_name ? "Pandemonium" : "Pan" ); + case LEVEL_LABYRINTH: + return ( long_name ? "a Labyrinth" : "Lab" ); + case LEVEL_PORTAL_VAULT: + return ( long_name ? "a Portal Chamber" : "Port" ); + default: + return ( long_name ? "Buggy Badlands" : "Bug" ); + } + } + + result = (long_name ? + branches[branch].longname : branches[branch].abbrevname); + + if ( include_number && branches[branch].depth != 1 ) + { + char buf[200]; + if ( long_name ) + { + // decapitalize 'the' + if ( result.find("The") == 0 ) + result[0] = 't'; + snprintf( buf, sizeof buf, "Level %d of %s", + lev, result.c_str() ); + } + else if (lev) + snprintf( buf, sizeof buf, "%s:%d", result.c_str(), lev ); + else + snprintf( buf, sizeof buf, "%s:$", result.c_str() ); + + result = buf; + } + return result; +} + +// Takes a packed 'place' and returns a compact stringified place name. +// XXX: This is done in several other places; a unified function to +// describe places would be nice. +std::string short_place_name(unsigned short place) +{ + return place_name( place, false, true ); +} + +// Prepositional form of branch level name. For example, "in the +// Abyss" or "on level 3 of the Main Dungeon". +std::string prep_branch_level_name(unsigned short packed_place) +{ + std::string place = place_name( packed_place, true, true ); + if (place.length() && place != "Pandemonium") + place[0] = tolower(place[0]); + return (place.find("level") == 0? + "on " + place + : "in " + place); +} + +// Use current branch and depth +std::string prep_branch_level_name() +{ + return prep_branch_level_name( get_packed_place() ); +} + +int absdungeon_depth(branch_type branch, int subdepth) +{ + if (branch >= BRANCH_VESTIBULE_OF_HELL && branch <= BRANCH_THE_PIT) + return subdepth + 27 - (branch == BRANCH_VESTIBULE_OF_HELL); + else + { + --subdepth; + while ( branch != BRANCH_MAIN_DUNGEON ) + { + subdepth += branches[branch].startdepth; + branch = branches[branch].parent_branch; + } + } + return subdepth; +} + +int subdungeon_depth(branch_type branch, int depth) +{ + return depth - absdungeon_depth(branch, 0); +} + +int player_branch_depth() +{ + return subdungeon_depth(you.where_are_you, you.your_level); +} + +// Returns true if exits from this type of level involve going upstairs. +bool level_type_exits_up(level_area_type type) +{ + return (type == LEVEL_LABYRINTH || type == LEVEL_PORTAL_VAULT); +} + +bool level_type_exits_down(level_area_type type) +{ + return (type == LEVEL_PANDEMONIUM || type == LEVEL_ABYSS); +} diff --git a/crawl-ref/source/place.h b/crawl-ref/source/place.h new file mode 100644 index 0000000000..32eba39987 --- /dev/null +++ b/crawl-ref/source/place.h @@ -0,0 +1,53 @@ +/* + * File: place.h + * Summary: Place related functions. + * Written by: Linley Henzell + * + * Modified for Crawl Reference by $Author: j-p-e-g $ on $Date: 2007-09-03 06:41:30 -0700 (Mon, 03 Sep 2007) $ + * + * Change History (most recent first): + * + * <1> 9/11/07 MPC Split from misc.h + */ + +#ifndef PLACE_H +#define PLACE_H + +#include "enum.h" + +////////////////////////////////////////////////////////////////////// +// Places and names +// +unsigned short get_packed_place(); + +unsigned short get_packed_place( branch_type branch, int subdepth, + level_area_type level_type ); + +int place_branch(unsigned short place); +int place_depth(unsigned short place); +std::string short_place_name(unsigned short place); +std::string short_place_name(level_id id); +std::string place_name( unsigned short place, bool long_name = false, + bool include_number = true ); + +// Prepositional form of branch level name. For example, "in the +// Abyss" or "on level 3 of the Main Dungeon". +std::string prep_branch_level_name(unsigned short packed_place); +std::string prep_branch_level_name(); + +// Get displayable depth in the current branch, given the absolute +// depth. +int subdungeon_depth(branch_type branch, int depth); + +// Get absolute depth given the displayable depth in the branch. +int absdungeon_depth(branch_type branch, int subdepth); + +// Get displayable depth in the current branch. +int player_branch_depth(); + +bool single_level_branch(branch_type branch); + +bool level_type_exits_up(level_area_type type); +bool level_type_exits_down(level_area_type type); + +#endif diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 4c47f44685..6ac2ef50c9 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -41,7 +41,9 @@ #include "itemname.h" #include "itemprop.h" #include "items.h" +#include "Kills.h" #include "macro.h" +#include "message.h" #include "misc.h" #include "monstuff.h" #include "mon-util.h" @@ -58,7 +60,9 @@ #include "spl-util.h" #include "spells4.h" #include "stuff.h" +#include "terrain.h" #include "transfor.h" +#include "traps.h" #include "travel.h" #include "tutorial.h" #include "view.h" @@ -4769,12 +4773,12 @@ bool rot_player( int amount ) } -int count_worn_ego( special_armour_type ego ) +int count_worn_ego( int which_ego ) { int result = 0; for ( int slot = EQ_CLOAK; slot <= EQ_BODY_ARMOUR; ++slot ) if (you.equip[slot] != -1 && - get_armour_ego_type(you.inv[you.equip[slot]]) == ego) + get_armour_ego_type(you.inv[you.equip[slot]]) == which_ego) result++; return result; } @@ -4896,8 +4900,31 @@ actor::~actor() player::player() { init(); + kills = new KillMaster(); } +player::player(const player &other) +{ + init(); + *this = other; + + kills = new KillMaster(*(other.kills)); +} + +void player::copy_from(const player &other) +{ + if (this == &other) + return; + + KillMaster *_kills = kills; + + *this = other; + + kills = _kills; + *kills = *(other.kills); +} + + // player struct initialization void player::init() { @@ -5039,6 +5066,11 @@ void player::init() exp_available = 25; } +player::~player() +{ + delete kills; +} + bool player::is_valid() const { // Check if there's a name. diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h index a346cd9a38..1bc1bf72bc 100644 --- a/crawl-ref/source/player.h +++ b/crawl-ref/source/player.h @@ -16,6 +16,14 @@ #include "externs.h" +enum genus_type +{ + GENPC_DRACONIAN, // 0 + GENPC_ELVEN, // 1 + GENPC_DWARVEN, // 2 + GENPC_OGRE +}; + bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift, bool force ); @@ -424,7 +432,7 @@ void run_macro(const char *macroname = NULL); int player_ghost_base_movement_speed(); -int count_worn_ego( special_armour_type ego ); +int count_worn_ego( int which_ego ); int stat_modifier( stat_type stat ); #endif diff --git a/crawl-ref/source/randart.h b/crawl-ref/source/randart.h index 5af4023cf9..f57151b6de 100644 --- a/crawl-ref/source/randart.h +++ b/crawl-ref/source/randart.h @@ -15,6 +15,41 @@ #include "enum.h" #include "externs.h" +enum randart_prop_type +{ + RAP_BRAND, // 0 + RAP_AC, + RAP_EVASION, + RAP_STRENGTH, + RAP_INTELLIGENCE, + RAP_DEXTERITY, // 5 + RAP_FIRE, + RAP_COLD, + RAP_ELECTRICITY, + RAP_POISON, + RAP_NEGATIVE_ENERGY, // 10 + RAP_MAGIC, + RAP_EYESIGHT, + RAP_INVISIBLE, + RAP_LEVITATE, + RAP_BLINK, // 15 + RAP_CAN_TELEPORT, + RAP_BERSERK, + RAP_MAPPING, + RAP_NOISES, + RAP_PREVENT_SPELLCASTING, // 20 + RAP_CAUSE_TELEPORTATION, + RAP_PREVENT_TELEPORTATION, + RAP_ANGRY, + RAP_METABOLISM, + RAP_MUTAGENIC, // 25 + RAP_ACCURACY, + RAP_DAMAGE, + RAP_CURSED, + RAP_STEALTH, + RAP_NUM_PROPERTIES +}; + // used in files.cc, newgame.cc, randart.cc {dlb} #define NO_UNRANDARTS 53 #define RA_PROPERTIES 30 diff --git a/crawl-ref/source/ray.h b/crawl-ref/source/ray.h new file mode 100644 index 0000000000..0c2895574b --- /dev/null +++ b/crawl-ref/source/ray.h @@ -0,0 +1,50 @@ +/* + * File: ray.h + * Summary: Ray definition + * Written by: Linley Henzell + * + * Modified for Crawl Reference by $Author: j-p-e-g $ on $Date: 2007-09-10 11:21:32 -0700 (Mon, 10 Sep 2007) $ + * + * Change History (most recent first): + * + * <1> 7/11/07 MPC Split off from externs.h + */ + +#ifndef RAY_H +#define RAY_H + +struct ray_def +{ +public: + double accx; + double accy; + double slope; + // Quadrant 1: down-right + // Quadrant 2: down-left + // Quadrant 3: up-left + // Quadrant 4: up-right + int quadrant; + int fullray_idx; // for cycling: where did we come from? + +public: + ray_def(); + int x() const { return static_cast<int>(accx); } + int y() const { return static_cast<int>(accy); } + coord_def pos() const { return coord_def(x(), y()); } + + // returns the direction taken (0,1,2) + int advance(bool shorten = false, const coord_def *p = NULL); + int advance_through(const coord_def &point); + void advance_and_bounce(); + void regress(); + +private: + int raw_advance(); + double reflect(bool x, double oldc, double newc) const; + double reflect(double x, double c) const; + void set_reflect_point(const double oldx, const double oldy, + double *newx, double *newy, + bool blocked_x, bool blocked_y); +}; + +#endif diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index a960a4b778..ee7893204a 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -49,6 +49,7 @@ #include "item_use.h" #include "items.h" #include "makeitem.h" +#include "message.h" #include "misc.h" #include "monplace.h" #include "monstuff.h" @@ -65,7 +66,10 @@ #include "spells3.h" #include "spl-book.h" #include "spl-cast.h" +#include "spl-util.h" +#include "state.h" #include "stuff.h" +#include "terrain.h" #include "tutorial.h" #include "view.h" diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc index 9873fcec93..8b7f000c5e 100644 --- a/crawl-ref/source/shopping.cc +++ b/crawl-ref/source/shopping.cc @@ -27,7 +27,9 @@ #include "externs.h" #include "cio.h" #include "describe.h" +#include "food.h" #include "invent.h" +#include "it_use2.h" #include "items.h" #include "itemname.h" #include "itemprop.h" diff --git a/crawl-ref/source/skills2.cc b/crawl-ref/source/skills2.cc index 81cae1c4f6..860573feab 100644 --- a/crawl-ref/source/skills2.cc +++ b/crawl-ref/source/skills2.cc @@ -36,6 +36,7 @@ #include "randart.h" #include "religion.h" #include "stuff.h" +#include "transfor.h" #include "view.h" /* jmf: some references for words I used below: diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc index 11db9b44d8..7b71d46c16 100644 --- a/crawl-ref/source/spells1.cc +++ b/crawl-ref/source/spells1.cc @@ -34,6 +34,7 @@ #include "it_use2.h" #include "itemname.h" #include "itemprop.h" +#include "message.h" #include "misc.h" #include "monplace.h" #include "monstuff.h" @@ -45,6 +46,9 @@ #include "spells4.h" #include "spl-util.h" #include "stuff.h" +#include "terrain.h" +#include "transfor.h" +#include "traps.h" #include "view.h" static bool abyss_blocks_teleport(bool cblink) diff --git a/crawl-ref/source/spells1.h b/crawl-ref/source/spells1.h index 0f6e1756b3..b9146d8ffd 100644 --- a/crawl-ref/source/spells1.h +++ b/crawl-ref/source/spells1.h @@ -16,6 +16,7 @@ #include "externs.h" #include "direct.h" +struct bolt; // last updated 24may2000 {dlb} /* *********************************************************************** diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 58113f4026..033c6fbf36 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -35,6 +35,7 @@ #include "itemname.h" #include "itemprop.h" #include "items.h" +#include "message.h" #include "misc.h" #include "monplace.h" #include "monstuff.h" @@ -46,6 +47,8 @@ #include "spells4.h" #include "spl-cast.h" #include "stuff.h" +#include "terrain.h" +#include "traps.h" #include "view.h" static int raise_corpse( int corps, int corx, int cory, beh_type corps_beh, diff --git a/crawl-ref/source/spells2.h b/crawl-ref/source/spells2.h index f6a7cbb145..a19c83a76f 100644 --- a/crawl-ref/source/spells2.h +++ b/crawl-ref/source/spells2.h @@ -15,6 +15,7 @@ #include "enum.h" +struct dist; // last updated 24may2000 {dlb} /* *********************************************************************** diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc index 326823f743..1ea5f76ee5 100644 --- a/crawl-ref/source/spells3.cc +++ b/crawl-ref/source/spells3.cc @@ -29,15 +29,18 @@ #include "direct.h" #include "debug.h" #include "delay.h" +#include "food.h" #include "itemname.h" #include "itemprop.h" #include "items.h" #include "it_use2.h" +#include "message.h" #include "misc.h" #include "monplace.h" #include "mon-pick.h" #include "monstuff.h" #include "mon-util.h" +#include "place.h" #include "player.h" #include "randart.h" #include "religion.h" @@ -46,6 +49,7 @@ #include "spl-cast.h" #include "spl-util.h" #include "stuff.h" +#include "traps.h" #include "view.h" static bool monster_on_level(int monster); diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index d798305400..c8d51b2eec 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -37,7 +37,6 @@ #include "invent.h" #include "makeitem.h" #include "message.h" -#include "misc.h" #include "monplace.h" #include "monstuff.h" #include "mon-util.h" @@ -52,6 +51,9 @@ #include "spl-cast.h" #include "spl-util.h" #include "stuff.h" +#include "terrain.h" +#include "transfor.h" +#include "traps.h" #include "view.h" enum DEBRIS // jmf: add for shatter, dig, and Giants to throw diff --git a/crawl-ref/source/spells4.h b/crawl-ref/source/spells4.h index 5429741883..515c8cc5a6 100644 --- a/crawl-ref/source/spells4.h +++ b/crawl-ref/source/spells4.h @@ -16,6 +16,8 @@ #include "externs.h" +struct bolt; + std::string your_hand(bool plural); bool backlight_monsters(int x, int y, int pow, int garbage); int make_a_normal_cloud(int x, int y, int pow, cloud_type ctype, diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc index 534022a0d9..c3d52c0451 100644 --- a/crawl-ref/source/spl-book.cc +++ b/crawl-ref/source/spl-book.cc @@ -34,6 +34,7 @@ #include "itemprop.h" #include "items.h" #include "it_use3.h" +#include "message.h" #include "player.h" #include "religion.h" #include "spl-cast.h" diff --git a/crawl-ref/source/spl-book.h b/crawl-ref/source/spl-book.h index d09f4acf8a..ede00e0aee 100644 --- a/crawl-ref/source/spl-book.h +++ b/crawl-ref/source/spl-book.h @@ -18,6 +18,13 @@ #include "menu.h" #include "FixVec.h" +enum read_book_action_type +{ + RBOOK_USE_STAFF, + RBOOK_MEMORISE, + RBOOK_READ_SPELL +}; + // updated 24may2000 {dlb} /* *********************************************************************** * called from: dungeon - effects - shopping diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 1a5f611d69..9fc260e9d6 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -35,6 +35,7 @@ #include "itemname.h" #include "itemprop.h" #include "macro.h" +#include "message.h" #include "monplace.h" #include "monstuff.h" #include "mutation.h" diff --git a/crawl-ref/source/spl-cast.h b/crawl-ref/source/spl-cast.h index eeaa6578bc..350a07d6da 100644 --- a/crawl-ref/source/spl-cast.h +++ b/crawl-ref/source/spl-cast.h @@ -16,6 +16,26 @@ #include "enum.h" +enum spflag_type +{ + SPFLAG_NONE = 0x0000, + SPFLAG_DIR_OR_TARGET = 0x0001, // use DIR_NONE targeting + SPFLAG_TARGET = 0x0002, // use DIR_TARGET targeting + SPFLAG_GRID = 0x0004, // use DIR_GRID targeting + SPFLAG_DIR = 0x0008, // use DIR_DIR targeting + SPFLAG_TARGETING_MASK = 0x000f, // used to test for targeting + SPFLAG_HELPFUL = 0x0010, // TARG_FRIENDS used + SPFLAG_NOT_SELF = 0x0020, // aborts on isMe + SPFLAG_UNHOLY = 0x0040 // counts at "unholy" +}; + +enum spret_type +{ + SPRET_ABORT = 0, // should be left as 0 + SPRET_FAIL, + SPRET_SUCCESS +}; + int list_spells(); int spell_fail( spell_type spell ); int calc_spell_power(spell_type spell, bool apply_intel, diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc index 236ea1f35f..ee09d5b374 100644 --- a/crawl-ref/source/spl-util.cc +++ b/crawl-ref/source/spl-util.cc @@ -23,6 +23,7 @@ #include "externs.h" +#include "beam.h" #include "direct.h" #include "debug.h" #include "stuff.h" @@ -33,6 +34,9 @@ #include "notes.h" #include "player.h" #include "spl-book.h" +#include "spl-cast.h" +#include "spl-util.h" +#include "terrain.h" #include "view.h" diff --git a/crawl-ref/source/spl-util.h b/crawl-ref/source/spl-util.h index 0b3b1d35ae..a29feb3a73 100644 --- a/crawl-ref/source/spl-util.h +++ b/crawl-ref/source/spl-util.h @@ -18,6 +18,30 @@ #include "enum.h" // just for NUM_SPELL_TYPES and TARG_ENEMY #include "direct.h" // just for DIR_NONE +enum spschool_flag_type +{ + SPTYP_NONE = 0, // "0" is reserved for no type at all {dlb} + SPTYP_CONJURATION = 1, // was 11, but only for old typematch routine {dlb} + SPTYP_ENCHANTMENT = 1<<1, + SPTYP_FIRE = 1<<2, + SPTYP_ICE = 1<<3, + SPTYP_TRANSMIGRATION = 1<<4, + SPTYP_NECROMANCY = 1<<5, + SPTYP_SUMMONING = 1<<6, + SPTYP_DIVINATION = 1<<7, + SPTYP_TRANSLOCATION = 1<<8, + SPTYP_POISON = 1<<9, + SPTYP_EARTH = 1<<10, + SPTYP_AIR = 1<<11, + SPTYP_HOLY = 1<<12, //jmf: moved to accomodate "random" miscast f/x + SPTYP_LAST_EXPONENT = 12, //jmf: ``NUM_SPELL_TYPES'' kinda useless + NUM_SPELL_TYPES = 14, + SPTYP_RANDOM = 1<<14 +}; + +struct bolt; +struct dist; + struct spell_desc { int id; diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc index 4fde168fe2..376fce0dd7 100644 --- a/crawl-ref/source/stash.cc +++ b/crawl-ref/source/stash.cc @@ -12,6 +12,7 @@ #include "clua.h" #include "describe.h" #include "direct.h" +#include "food.h" #include "itemname.h" #include "itemprop.h" #include "files.h" @@ -20,13 +21,17 @@ #include "Kills.h" #include "libutil.h" #include "menu.h" +#include "message.h" #include "misc.h" #include "overmap.h" +#include "place.h" #include "shopping.h" #include "spl-book.h" #include "stash.h" #include "stuff.h" #include "tags.h" +#include "terrain.h" +#include "traps.h" #include "travel.h" #include "tutorial.h" #include "view.h" diff --git a/crawl-ref/source/stash.h b/crawl-ref/source/stash.h index 3d639a6491..8841911b74 100644 --- a/crawl-ref/source/stash.h +++ b/crawl-ref/source/stash.h @@ -15,9 +15,10 @@ #include <vector> #include "externs.h" -#include "misc.h" #include "travel.h" +class input_history; + // Stash definitions void stash_init_new_level(); diff --git a/crawl-ref/source/state.h b/crawl-ref/source/state.h new file mode 100644 index 0000000000..de2c1b8f3a --- /dev/null +++ b/crawl-ref/source/state.h @@ -0,0 +1,58 @@ +/* + * File: state.h + * Summary: Game state. + * Written by: Linley Henzell + * + * Modified for Crawl Reference by $Author: j-p-e-g $ on $Date: 2007-09-10 11:21:32 -0700 (Mon, 10 Sep 2007) $ + * + * Change History (most recent first): + * + * <1> 7/11/07 MPC Split off from externs.h + */ + +#ifndef STATE_H +#define STATE_H + +// Track various aspects of Crawl game state. +struct game_state +{ + bool mouse_enabled; // True if mouse input is currently relevant. + + bool waiting_for_command; // True when the game is waiting for a command. + bool terminal_resized; // True if the term was resized and we need to + // take action to handle it. + + bool io_inited; // Is curses or the equivalent initialised? + bool need_save; // Set to true when game has started. + bool saving_game; // Set to true while in save_game. + bool updating_scores; // Set to true while updating hiscores. + + int seen_hups; // Set to true if SIGHUP received. + + bool map_stat_gen; // Set if we're generating stats on maps. + + bool unicode_ok; // Is unicode support available? + + std::string (*glyph2strfn)(unsigned glyph); + int (*multibyte_strlen)(const std::string &s); + void (*terminal_resize_handler)(); + void (*terminal_resize_check)(); + + game_state() : mouse_enabled(false), waiting_for_command(false), + terminal_resized(false), io_inited(false), need_save(false), + saving_game(false), updating_scores(false), + seen_hups(0), map_stat_gen(false), unicode_ok(false), + glyph2strfn(NULL), multibyte_strlen(NULL), + terminal_resize_handler(NULL), terminal_resize_check(NULL) + { + } + + void check_term_size() const + { + if (terminal_resize_check) + (*terminal_resize_check)(); + } +}; +extern game_state crawl_state; + +#endif diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc index 251e9cd9b9..d622d39406 100644 --- a/crawl-ref/source/stuff.cc +++ b/crawl-ref/source/stuff.cc @@ -17,7 +17,9 @@ #include "database.h" #include "direct.h" #include "message.h" +#include "misc.h" #include "monplace.h" +#include "state.h" #include "stuff.h" #include "view.h" @@ -56,6 +58,7 @@ #include "branch.h" #include "delay.h" #include "externs.h" +#include "itemprop.h" #include "items.h" #include "macro.h" #include "misc.h" diff --git a/crawl-ref/source/tags.h b/crawl-ref/source/tags.h index f07ada57ab..40244224e9 100644 --- a/crawl-ref/source/tags.h +++ b/crawl-ref/source/tags.h @@ -16,6 +16,36 @@ #include <stdio.h> #include "externs.h" +enum tag_type // used during save/load process to identify data blocks +{ + TAG_VERSION = 0, // should NEVER be read in! + TAG_YOU = 1, // 'you' structure + TAG_YOU_ITEMS, // your items + TAG_YOU_DUNGEON, // dungeon specs (stairs, branches, features) + TAG_LEVEL, // various grids & clouds + TAG_LEVEL_ITEMS, // items/traps + TAG_LEVEL_MONSTERS, // monsters + TAG_GHOST, // ghost + TAG_LEVEL_ATTITUDE, // monster attitudes + TAG_LOST_MONSTERS, // monsters in transit + NUM_TAGS +}; + +enum tag_file_type // file types supported by tag system +{ + TAGTYPE_PLAYER=0, // Foo.sav + TAGTYPE_LEVEL, // Foo.00a, .01a, etc. + TAGTYPE_GHOST, // bones.xxx + + TAGTYPE_PLAYER_NAME // Used only to read the player name +}; + +struct tagHeader +{ + short tagID; + long offset; +}; + // last updated 22jan2001 {gdl} /* *********************************************************************** * called from: files tags diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc new file mode 100644 index 0000000000..cdca9d6017 --- /dev/null +++ b/crawl-ref/source/terrain.cc @@ -0,0 +1,543 @@ +/* + * File: terrain.cc + * Summary: Terrain related functions. + * Written by: Linley Henzell + * + * Modified for Crawl Reference by $Author: j-p-e-g $ on $Date: 2007-09-03 06:41:30 -0700 (Mon, 03 Sep 2007) $ + * + * Change History (most recent first): + * + * <1> 9/11/07 MPC Split from misc.cc + */ + +#include "externs.h" +#include "terrain.h" + +#include "dgnevent.h" +#include "itemprop.h" +#include "items.h" +#include "message.h" +#include "misc.h" +#include "monplace.h" +#include "monstuff.h" +#include "mstuff2.h" +#include "ouch.h" +#include "overmap.h" +#include "player.h" +#include "religion.h" +#include "spells3.h" +#include "stuff.h" +#include "view.h" + +bool grid_is_wall( dungeon_feature_type grid ) +{ + return (grid == DNGN_ROCK_WALL + || grid == DNGN_STONE_WALL + || grid == DNGN_METAL_WALL + || grid == DNGN_GREEN_CRYSTAL_WALL + || grid == DNGN_WAX_WALL + || grid == DNGN_PERMAROCK_WALL); +} + +bool grid_is_stone_stair(dungeon_feature_type grid) +{ + switch (grid) + { + case DNGN_STONE_STAIRS_UP_I: + case DNGN_STONE_STAIRS_UP_II: + case DNGN_STONE_STAIRS_UP_III: + case DNGN_STONE_STAIRS_DOWN_I: + case DNGN_STONE_STAIRS_DOWN_II: + case DNGN_STONE_STAIRS_DOWN_III: + return (true); + default: + return (false); + } +} + +bool grid_is_rock_stair(dungeon_feature_type grid) +{ + switch (grid) + { + case DNGN_ROCK_STAIRS_UP: + case DNGN_ROCK_STAIRS_DOWN: + return (true); + default: + return (false); + } +} + +bool grid_sealable_portal(dungeon_feature_type grid) +{ + switch (grid) + { + case DNGN_ENTER_HELL: + case DNGN_ENTER_ABYSS: + case DNGN_ENTER_PANDEMONIUM: + case DNGN_ENTER_LABYRINTH: + case DNGN_ENTER_PORTAL_VAULT: + return (true); + default: + return (false); + } +} + +bool grid_is_portal(dungeon_feature_type grid) +{ + return (grid == DNGN_ENTER_PORTAL_VAULT || grid == DNGN_EXIT_PORTAL_VAULT); +} + +command_type grid_stair_direction(dungeon_feature_type grid) +{ + switch (grid) + { + case DNGN_STONE_STAIRS_UP_I: + case DNGN_STONE_STAIRS_UP_II: + case DNGN_STONE_STAIRS_UP_III: + case DNGN_ROCK_STAIRS_UP: + case DNGN_RETURN_FROM_ORCISH_MINES: + case DNGN_RETURN_FROM_HIVE: + case DNGN_RETURN_FROM_LAIR: + case DNGN_RETURN_FROM_SLIME_PITS: + case DNGN_RETURN_FROM_VAULTS: + case DNGN_RETURN_FROM_CRYPT: + case DNGN_RETURN_FROM_HALL_OF_BLADES: + case DNGN_RETURN_FROM_ZOT: + case DNGN_RETURN_FROM_TEMPLE: + case DNGN_RETURN_FROM_SNAKE_PIT: + case DNGN_RETURN_FROM_ELVEN_HALLS: + case DNGN_RETURN_FROM_TOMB: + case DNGN_RETURN_FROM_SWAMP: + case DNGN_RETURN_FROM_SHOALS: + case DNGN_RETURN_RESERVED_2: + case DNGN_RETURN_RESERVED_3: + case DNGN_RETURN_RESERVED_4: + case DNGN_ENTER_SHOP: + case DNGN_EXIT_HELL: + case DNGN_EXIT_PORTAL_VAULT: + return (CMD_GO_UPSTAIRS); + + case DNGN_ENTER_PORTAL_VAULT: + case DNGN_ENTER_HELL: + case DNGN_ENTER_LABYRINTH: + case DNGN_STONE_STAIRS_DOWN_I: + case DNGN_STONE_STAIRS_DOWN_II: + case DNGN_STONE_STAIRS_DOWN_III: + case DNGN_ROCK_STAIRS_DOWN: + case DNGN_ENTER_DIS: + case DNGN_ENTER_GEHENNA: + case DNGN_ENTER_COCYTUS: + case DNGN_ENTER_TARTARUS: + case DNGN_ENTER_ABYSS: + case DNGN_EXIT_ABYSS: + case DNGN_ENTER_PANDEMONIUM: + case DNGN_EXIT_PANDEMONIUM: + case DNGN_TRANSIT_PANDEMONIUM: + case DNGN_ENTER_ORCISH_MINES: + case DNGN_ENTER_HIVE: + case DNGN_ENTER_LAIR: + case DNGN_ENTER_SLIME_PITS: + case DNGN_ENTER_VAULTS: + case DNGN_ENTER_CRYPT: + case DNGN_ENTER_HALL_OF_BLADES: + case DNGN_ENTER_ZOT: + case DNGN_ENTER_TEMPLE: + case DNGN_ENTER_SNAKE_PIT: + case DNGN_ENTER_ELVEN_HALLS: + case DNGN_ENTER_TOMB: + case DNGN_ENTER_SWAMP: + case DNGN_ENTER_SHOALS: + case DNGN_ENTER_RESERVED_2: + case DNGN_ENTER_RESERVED_3: + case DNGN_ENTER_RESERVED_4: + return (CMD_GO_DOWNSTAIRS); + + default: + return (CMD_NO_CMD); + } +} + +bool grid_is_opaque( dungeon_feature_type grid ) +{ + return (grid < DNGN_MINSEE && grid != DNGN_ORCISH_IDOL); +} + +bool grid_is_solid( dungeon_feature_type grid ) +{ + return (grid < DNGN_MINMOVE); +} + +bool grid_is_solid( int x, int y ) +{ + return (grid_is_solid(grd[x][y])); +} + +bool grid_is_solid(const coord_def &c) +{ + return (grid_is_solid(grd(c))); +} + +bool grid_is_trap(dungeon_feature_type grid) +{ + return (grid == DNGN_TRAP_MECHANICAL || grid == DNGN_TRAP_MAGICAL + || grid == DNGN_TRAP_III); +} + +bool grid_is_water( dungeon_feature_type grid ) +{ + return (grid == DNGN_SHALLOW_WATER || grid == DNGN_DEEP_WATER); +} + +bool grid_is_watery( dungeon_feature_type grid ) +{ + return (grid_is_water(grid) || grid == DNGN_BLUE_FOUNTAIN); +} + +bool grid_destroys_items( dungeon_feature_type grid ) +{ + return (grid == DNGN_LAVA || grid == DNGN_DEEP_WATER); +} + +// returns 0 if grid is not an altar, else it returns the GOD_* type +god_type grid_altar_god( dungeon_feature_type grid ) +{ + if (grid >= DNGN_ALTAR_ZIN && grid <= DNGN_ALTAR_BEOGH) + return (static_cast<god_type>( grid - DNGN_ALTAR_ZIN + 1 )); + + return (GOD_NO_GOD); +} + +// returns DNGN_FLOOR for non-gods, otherwise returns the altar for +// the god. +dungeon_feature_type altar_for_god( god_type god ) +{ + if (god == GOD_NO_GOD || god >= NUM_GODS) + return (DNGN_FLOOR); // Yeah, lame. Tell me about it. + + return static_cast<dungeon_feature_type>(DNGN_ALTAR_ZIN + god - 1); +} + +bool grid_is_branch_stairs( dungeon_feature_type grid ) +{ + return ((grid >= DNGN_ENTER_ORCISH_MINES && grid <= DNGN_ENTER_RESERVED_4) + || (grid >= DNGN_ENTER_DIS && grid <= DNGN_ENTER_TARTARUS)); +} + +int grid_secret_door_appearance( int gx, int gy ) +{ + int ret = DNGN_FLOOR; + + for (int dx = -1; dx <= 1; dx++) + { + for (int dy = -1; dy <= 1; dy++) + { + // only considering orthogonal grids + if ((abs(dx) + abs(dy)) % 2 == 0) + continue; + + const dungeon_feature_type targ = grd[gx + dx][gy + dy]; + + if (!grid_is_wall( targ )) + continue; + + if (ret == DNGN_FLOOR) + ret = targ; + else if (ret != targ) + ret = ((ret < targ) ? ret : targ); + } + } + + return ((ret == DNGN_FLOOR) ? DNGN_ROCK_WALL + : ret); +} + +const char *grid_item_destruction_message( dungeon_feature_type grid ) +{ + return grid == DNGN_DEEP_WATER? "You hear a splash." + : grid == DNGN_LAVA ? "You hear a sizzling splash." + : "You hear a crunching noise."; +} + +static coord_def dgn_find_nearest_square( + const coord_def &pos, + bool (*acceptable)(const coord_def &), + bool (*traversable)(const coord_def &) = NULL) +{ + memset(travel_point_distance, 0, sizeof(travel_distance_grid_t)); + + std::list<coord_def> points[2]; + int iter = 0; + points[iter].push_back(pos); + + while (!points[iter].empty()) + { + for (std::list<coord_def>::iterator i = points[iter].begin(); + i != points[iter].end(); ++i) + { + const coord_def &p = *i; + + if (p != pos && acceptable(p)) + return (p); + + travel_point_distance[p.x][p.y] = 1; + for (int yi = -1; yi <= 1; ++yi) + { + for (int xi = -1; xi <= 1; ++xi) + { + if (!xi && !yi) + continue; + + const coord_def np = p + coord_def(xi, yi); + if (!in_bounds(np) || travel_point_distance[np.x][np.y]) + continue; + + if (traversable && !traversable(np)) + continue; + + points[!iter].push_back(np); + } + } + } + + points[iter].clear(); + iter = !iter; + } + + coord_def unfound; + return (unfound); +} + +static bool item_safe_square(const coord_def &pos) +{ + const dungeon_feature_type feat = grd(pos); + return (is_traversable(feat) && !grid_destroys_items(feat)); +} + +// Moves an item on the floor to the nearest adjacent floor-space. +static bool dgn_shift_item(const coord_def &pos, item_def &item) +{ + const coord_def np = dgn_find_nearest_square(pos, item_safe_square); + if (in_bounds(np) && np != pos) + { + int index = item.index(); + move_item_to_grid(&index, np.x, np.y); + return (true); + } + return (false); +} + +static bool is_critical_feature(dungeon_feature_type feat) +{ + return (grid_stair_direction(feat) != CMD_NO_CMD + || grid_altar_god(feat) != GOD_NO_GOD); +} + +static bool is_feature_shift_target(const coord_def &pos) +{ + return (grd(pos) == DNGN_FLOOR && !dungeon_events.has_listeners_at(pos)); +} + +static bool dgn_shift_feature(const coord_def &pos) +{ + const dungeon_feature_type dfeat = grd(pos); + if (!is_critical_feature(dfeat) && !env.markers.find(pos, MAT_ANY)) + return (false); + + const coord_def dest = + dgn_find_nearest_square(pos, is_feature_shift_target); + if (in_bounds(dest) && dest != pos) + { + grd(dest) = dfeat; + + if (dfeat == DNGN_ENTER_SHOP) + { + if (shop_struct *s = get_shop(pos.x, pos.y)) + { + s->x = dest.x; + s->y = dest.y; + } + } + env.markers.move(pos, dest); + dungeon_events.move_listeners(pos, dest); + } + return (true); +} + +static void dgn_check_terrain_items(const coord_def &pos, bool preserve_items) +{ + const dungeon_feature_type grid = grd(pos); + if (grid_is_solid(grid) || grid_destroys_items(grid)) + { + int item = igrd(pos); + bool did_destroy = false; + while (item != NON_ITEM) + { + const int curr = item; + item = mitm[item].link; + + // Game-critical item. + if (preserve_items || item_is_critical(mitm[curr])) + dgn_shift_item(pos, mitm[curr]); + else + { + destroy_item(curr); + did_destroy = true; + } + } + if (did_destroy && player_can_hear(pos)) + mprf(MSGCH_SOUND, grid_item_destruction_message(grid)); + } +} + +static void dgn_check_terrain_monsters(const coord_def &pos) +{ + const int mindex = mgrd(pos); + if (mindex != NON_MONSTER) + { + monsters *mons = &menv[mindex]; + if (grid_is_solid(grd(pos))) + monster_teleport(mons, true, false); + else + mons_check_pool(mons, KILL_MISC, -1); + } +} + +void dungeon_terrain_changed(const coord_def &pos, + dungeon_feature_type nfeat, + bool affect_player, + bool preserve_features, + bool preserve_items) +{ + if (nfeat != DNGN_UNSEEN) + { + if (preserve_features) + dgn_shift_feature(pos); + unnotice_feature(level_pos(level_id::current(), pos)); + grd(pos) = nfeat; + env.grid_colours(pos) = BLACK; + if (is_notable_terrain(nfeat) && see_grid(pos)) + seen_notable_thing(nfeat, pos.x, pos.y); + } + + dgn_check_terrain_items(pos, preserve_items); + if (affect_player && pos == you.pos()) + { + if (!grid_is_solid(grd(pos))) + { + if (!you.flies()) + move_player_to_grid(pos.x, pos.y, false, true, false); + } + else + you_teleport_now(true, false); + } + dgn_check_terrain_monsters(pos); +} + +// returns true if we manage to scramble free. +bool fall_into_a_pool( int entry_x, int entry_y, bool allow_shift, + unsigned char terrain ) +{ + bool escape = false; + FixedVector< char, 2 > empty; + + if (you.species == SP_MERFOLK && terrain == DNGN_DEEP_WATER) + { + // These can happen when we enter deep water directly -- bwr + merfolk_start_swimming(); + return (false); + } + + // sanity check + if (terrain != DNGN_LAVA && beogh_water_walk()) + return (false); + + mprf("You fall into the %s!", + (terrain == DNGN_LAVA) ? "lava" : + (terrain == DNGN_DEEP_WATER) ? "water" + : "programming rift"); + + more(); + mesclr(); + + if (terrain == DNGN_LAVA) + { + const int resist = player_res_fire(); + + if (resist <= 0) + { + mpr( "The lava burns you to a cinder!" ); + ouch( INSTANT_DEATH, 0, KILLED_BY_LAVA ); + } + else + { + // should boost # of bangs per damage in the future {dlb} + mpr( "The lava burns you!" ); + ouch( (10 + roll_dice(2,50)) / resist, 0, KILLED_BY_LAVA ); + } + + expose_player_to_element( BEAM_LAVA, 14 ); + } + + // a distinction between stepping and falling from you.duration[DUR_LEVITATION] + // prevents stepping into a thin stream of lava to get to the other side. + if (scramble()) + { + if (allow_shift) + { + if (empty_surrounds( you.x_pos, you.y_pos, DNGN_FLOOR, 1, + false, empty )) + { + escape = true; + } + else + { + escape = false; + } + } + else + { + // back out the way we came in, if possible + if (grid_distance( you.x_pos, you.y_pos, entry_x, entry_y ) == 1 + && (entry_x != empty[0] || entry_y != empty[1]) + && mgrd[entry_x][entry_y] == NON_MONSTER) + { + escape = true; + empty[0] = entry_x; + empty[1] = entry_y; + } + else // zero or two or more squares away, with no way back + { + escape = false; + } + } + } + else + { + mpr("You try to escape, but your burden drags you down!"); + } + + if (escape) + { + const coord_def pos(empty[0], empty[1]); + if (in_bounds(pos) && !is_grid_dangerous(grd(pos))) + { + mpr("You manage to scramble free!"); + move_player_to_grid( empty[0], empty[1], false, false, true ); + + if (terrain == DNGN_LAVA) + expose_player_to_element( BEAM_LAVA, 14 ); + + return (true); + } + } + + mpr("You drown..."); + + if (terrain == DNGN_LAVA) + ouch( INSTANT_DEATH, 0, KILLED_BY_LAVA ); + else if (terrain == DNGN_DEEP_WATER) + ouch( INSTANT_DEATH, 0, KILLED_BY_WATER ); + + return (false); +} // end fall_into_a_pool() + diff --git a/crawl-ref/source/terrain.h b/crawl-ref/source/terrain.h new file mode 100644 index 0000000000..d4acdb743c --- /dev/null +++ b/crawl-ref/source/terrain.h @@ -0,0 +1,57 @@ +/* + * File: terrain.h + * Summary: Terrain related functions. + * Written by: Linley Henzell + * + * Modified for Crawl Reference by $Author: j-p-e-g $ on $Date: 2007-09-03 06:41:30 -0700 (Mon, 03 Sep 2007) $ + * + * Change History (most recent first): + * + * <1> 9/11/07 MPC Split from misc.h + */ + +#ifndef TERRAIN_H +#define TERRAIN_H + +#include "enum.h" + +class coord_def; + +// last updated 12may2000 {dlb} +/* *********************************************************************** + * called from: acr + * *********************************************************************** */ +bool fall_into_a_pool( int entry_x, int entry_y, bool allow_shift, + unsigned char terrain ); + + +bool grid_is_wall(dungeon_feature_type grid); +bool grid_is_opaque(dungeon_feature_type grid); +bool grid_is_solid(dungeon_feature_type grid); +bool grid_is_stone_stair(dungeon_feature_type grid); +bool grid_is_rock_stair(dungeon_feature_type grid); +bool grid_is_solid(int x, int y); +bool grid_is_solid(const coord_def &c); +bool grid_is_trap(dungeon_feature_type grid); +command_type grid_stair_direction(dungeon_feature_type grid); +bool grid_sealable_portal(dungeon_feature_type grid); +bool grid_is_portal(dungeon_feature_type grid); + +bool grid_is_water(dungeon_feature_type grid); +bool grid_is_watery(dungeon_feature_type grid); +god_type grid_altar_god( dungeon_feature_type grid ); +dungeon_feature_type altar_for_god( god_type god ); +bool grid_is_branch_stairs( dungeon_feature_type grid ); +int grid_secret_door_appearance( int gx, int gy ); +bool grid_destroys_items( dungeon_feature_type grid ); + +const char *grid_item_destruction_message( dungeon_feature_type grid ); + +// Terrain changed under 'pos', perform necessary effects. +void dungeon_terrain_changed(const coord_def &pos, + dungeon_feature_type feat = DNGN_UNSEEN, + bool affect_player = true, + bool preserve_features = false, + bool preserve_items = false); + +#endif diff --git a/crawl-ref/source/transfor.cc b/crawl-ref/source/transfor.cc index 0266b66d15..538c3012f1 100644 --- a/crawl-ref/source/transfor.cc +++ b/crawl-ref/source/transfor.cc @@ -25,6 +25,7 @@ #include "itemprop.h" #include "items.h" #include "misc.h" +#include "output.h" #include "player.h" #include "skills2.h" #include "stuff.h" diff --git a/crawl-ref/source/transfor.h b/crawl-ref/source/transfor.h index cc9e44de78..e53e06ea52 100644 --- a/crawl-ref/source/transfor.h +++ b/crawl-ref/source/transfor.h @@ -19,6 +19,21 @@ #include "FixVec.h" #include "enum.h" +enum transformation_type +{ + TRAN_NONE, // 0 + TRAN_SPIDER, + TRAN_BLADE_HANDS, + TRAN_STATUE, + TRAN_ICE_BEAST, + TRAN_DRAGON, // 5 + TRAN_LICH, + TRAN_SERPENT_OF_HELL, + TRAN_AIR, + TRAN_BAT, + NUM_TRANSFORMATIONS // must remain last member {dlb} +}; + bool transform_can_butcher_barehanded(transformation_type tt); // last updated 12may2000 {dlb} diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc new file mode 100644 index 0000000000..9168f1e585 --- /dev/null +++ b/crawl-ref/source/traps.cc @@ -0,0 +1,701 @@ +/* + * File: traps.cc + * Summary: Traps related functions. + * Written by: Linley Henzell + * + * Modified for Crawl Reference by $Author: j-p-e-g $ on $Date: 2007-09-03 06:41:30 -0700 (Mon, 03 Sep 2007) $ + * + * Change History (most recent first): + * + * <1> 9/11/07 MPC Split from misc.cc + */ + +#include "externs.h" +#include "traps.h" + +#include "beam.h" +#include "direct.h" +#include "it_use2.h" +#include "items.h" +#include "itemprop.h" +#include "makeitem.h" +#include "mon-util.h" +#include "monstuff.h" +#include "ouch.h" +#include "player.h" +#include "randart.h" +#include "skills.h" +#include "spells3.h" +#include "spl-cast.h" +#include "spl-util.h" +#include "terrain.h" +#include "tutorial.h" +#include "view.h" + +static void dart_trap(bool trap_known, int trapped, bolt &pbolt, bool poison); + +// returns the number of a net on a given square +// if trapped only stationary ones are counted +// otherwise the first net found is returned +int get_trapping_net(int x, int y, bool trapped) +{ + int net, next; + + for (net = igrd[x][y]; net != NON_ITEM; net = next) + { + next = mitm[net].link; + + if (mitm[net].base_type == OBJ_MISSILES + && mitm[net].sub_type == MI_THROWING_NET + && (!trapped || item_is_stationary(mitm[net]))) + { + return (net); + } + } + return (NON_ITEM); +} + +// if there are more than one net on this square +// split off one of them for checking/setting values +static void maybe_split_nets(item_def &item, int x, int y) +{ + if (item.quantity == 1) + { + set_item_stationary(item); + return; + } + + item_def it; + + it.base_type = item.base_type; + it.sub_type = item.sub_type; + it.plus = item.plus; + it.plus2 = item.plus2; + it.flags = item.flags; + it.special = item.special; + it.quantity = --item.quantity; + item_colour(it); + + item.quantity = 1; + set_item_stationary(item); + + copy_item_to_grid( it, x, y ); +} + +void mark_net_trapping(int x, int y) +{ + int net = get_trapping_net(x,y); + if (net == NON_ITEM) + { + net = get_trapping_net(x,y, false); + if (net != NON_ITEM) + maybe_split_nets(mitm[net], x, y); + } +} + +void monster_caught_in_net(monsters *mon, bolt &pbolt) +{ + if (mon->body_size(PSIZE_BODY) >= SIZE_GIANT) + return; + + if (mons_is_insubstantial(mon->type)) + { + if (mons_near(mon) && player_monster_visible(mon)) + mprf("The net passes right through %s!", mon->name(DESC_NOCAP_THE).c_str()); + return; + } + + const monsters* mons = static_cast<const monsters*>(mon); + bool mon_flies = mons->flies(); + if (mon_flies && !mons_is_confused(mons)) + { + simple_monster_message(mon, " darts out from under the net!"); + return; + } + + if (mons->type == MONS_OOZE || mons->type == MONS_PULSATING_LUMP) + { + simple_monster_message(mon, " oozes right through the net!"); + return; + } + + if (!mons_is_caught(mon) && mon->add_ench(ENCH_HELD)) + { + if (mons_near(mon) && !player_monster_visible(mon)) + mpr("Something gets caught in the net!"); + else + simple_monster_message(mon, " is caught in the net!"); + + if (mon_flies) + { + simple_monster_message(mon, " falls like a stone!"); + mons_check_pool(mon, pbolt.killer(), pbolt.beam_source); + } + } +} + +void player_caught_in_net() +{ + if (you.body_size(PSIZE_BODY) >= SIZE_GIANT) + return; + + if (you.flies() && !you.confused()) + { + mpr("You dart out from under the net!"); + return; + } + + if (!you.attribute[ATTR_HELD]) + { + you.attribute[ATTR_HELD] = 10; + mpr("You become entangled in the net!"); + + // I guess levitation works differently, keeping both you + // and the net hovering above the floor + if (you.flies()) + { + mpr("You fall like a stone!"); + fall_into_a_pool(you.x_pos, you.y_pos, false, grd[you.x_pos][you.y_pos]); + } + } + +} + +static void dart_trap(bool trap_known, int trapped, bolt &pbolt, bool poison) +{ + int damage_taken = 0; + int trap_hit, your_dodge; + + if (one_chance_in(5) || (trap_known && !one_chance_in(4))) + { + mprf( "You avoid triggering a%s trap.", pbolt.name.c_str() ); + return; + } + + if (you.equip[EQ_SHIELD] != -1 && one_chance_in(3)) + exercise( SK_SHIELDS, 1 ); + + std::string msg = "A" + pbolt.name + " shoots out and "; + + if (random2( 20 + 5 * you.shield_blocks * you.shield_blocks ) + < player_shield_class()) + { + you.shield_blocks++; + msg += "hits your shield."; + mpr(msg.c_str()); + } + else + { + // note that this uses full ( not random2limit(foo,40) ) + // player_evasion. + trap_hit = (20 + (you.your_level * 2)) * random2(200) / 100; + + your_dodge = player_evasion() + random2(you.dex) / 3 + - 2 + (you.duration[DUR_REPEL_MISSILES] * 10); + + if (trap_hit >= your_dodge && you.duration[DUR_DEFLECT_MISSILES] == 0) + { + msg += "hits you!"; + mpr(msg.c_str()); + + if (poison && random2(100) < 50 - (3 * player_AC()) / 2 + && !player_res_poison()) + { + poison_player( 1 + random2(3) ); + } + + damage_taken = roll_dice( pbolt.damage ); + damage_taken -= random2( player_AC() + 1 ); + + if (damage_taken > 0) + ouch( damage_taken, 0, KILLED_BY_TRAP, pbolt.name.c_str() ); + } + else + { + msg += "misses you."; + mpr(msg.c_str()); + } + + if (player_light_armour(true) && coinflip()) + exercise( SK_DODGING, 1 ); + } + + pbolt.target_x = you.x_pos; + pbolt.target_y = you.y_pos; + + if (coinflip()) + itrap( pbolt, trapped ); +} // end dart_trap() + +// +// itrap takes location from target_x, target_y of bolt strcture. +// + +void itrap( struct bolt &pbolt, int trapped ) +{ + object_class_type base_type = OBJ_MISSILES; + int sub_type = MI_DART; + + switch (env.trap[trapped].type) + { + case TRAP_DART: + base_type = OBJ_MISSILES; + sub_type = MI_DART; + break; + case TRAP_ARROW: + base_type = OBJ_MISSILES; + sub_type = MI_ARROW; + break; + case TRAP_BOLT: + base_type = OBJ_MISSILES; + sub_type = MI_BOLT; + break; + case TRAP_SPEAR: + base_type = OBJ_WEAPONS; + sub_type = WPN_SPEAR; + break; + case TRAP_AXE: + base_type = OBJ_WEAPONS; + sub_type = WPN_HAND_AXE; + break; + case TRAP_NEEDLE: + base_type = OBJ_MISSILES; + sub_type = MI_NEEDLE; + break; + case TRAP_NET: + base_type = OBJ_MISSILES; + sub_type = MI_THROWING_NET; + break; + default: + return; + } + + trap_item( base_type, sub_type, pbolt.target_x, pbolt.target_y ); + + return; +} // end itrap() + +void handle_traps(char trt, int i, bool trap_known) +{ + struct bolt beam; + + switch (trt) + { + case TRAP_DART: + beam.name = " dart"; + beam.damage = dice_def( 1, 4 + (you.your_level / 2) ); + dart_trap(trap_known, i, beam, false); + break; + + case TRAP_NEEDLE: + beam.name = " needle"; + beam.damage = dice_def( 1, 0 ); + dart_trap(trap_known, i, beam, true); + break; + + case TRAP_ARROW: + beam.name = "n arrow"; + beam.damage = dice_def( 1, 7 + you.your_level ); + dart_trap(trap_known, i, beam, false); + break; + + case TRAP_BOLT: + beam.name = " bolt"; + beam.damage = dice_def( 1, 13 + you.your_level ); + dart_trap(trap_known, i, beam, false); + break; + + case TRAP_SPEAR: + beam.name = " spear"; + beam.damage = dice_def( 1, 10 + you.your_level ); + dart_trap(trap_known, i, beam, false); + break; + + case TRAP_AXE: + beam.name = "n axe"; + beam.damage = dice_def( 1, 15 + you.your_level ); + dart_trap(trap_known, i, beam, false); + break; + + case TRAP_TELEPORT: + mpr("You enter a teleport trap!"); + + if (scan_randarts(RAP_PREVENT_TELEPORTATION)) + mpr("You feel a weird sense of stasis."); + else + you_teleport_now( true ); + break; + + case TRAP_AMNESIA: + mpr("You feel momentarily disoriented."); + if (!wearing_amulet(AMU_CLARITY)) + forget_map(random2avg(100, 2)); + break; + + case TRAP_BLADE: + if (trap_known && one_chance_in(3)) + mpr("You avoid triggering a blade trap."); + else if (random2limit(player_evasion(), 40) + + (random2(you.dex) / 3) + (trap_known ? 3 : 0) > 8) + { + mpr("A huge blade swings just past you!"); + } + else + { + mpr("A huge blade swings out and slices into you!"); + ouch( (you.your_level * 2) + random2avg(29, 2) + - random2(1 + player_AC()), 0, KILLED_BY_TRAP, " blade" ); + } + break; + + case TRAP_NET: + + if (trap_known && one_chance_in(3)) + mpr("A net swings high above you."); + else + { + if (random2limit(player_evasion(), 40) + + (random2(you.dex) / 3) + (trap_known ? 3 : 0) > 12) + { + mpr("A net drops to the ground!"); + } + else + { + mpr("A large net falls onto you!"); + player_caught_in_net(); + } + + trap_item( OBJ_MISSILES, MI_THROWING_NET, env.trap[i].x, env.trap[i].y ); + if (you.attribute[ATTR_HELD]) + mark_net_trapping(you.x_pos, you.y_pos); + + grd[env.trap[i].x][env.trap[i].y] = DNGN_FLOOR; + env.trap[i].type = TRAP_UNASSIGNED; + } + break; + + case TRAP_ZOT: + default: + mpr((trap_known) ? "You enter the Zot trap." + : "Oh no! You have blundered into a Zot trap!"); + miscast_effect( SPTYP_RANDOM, random2(30) + you.your_level, + 75 + random2(100), 3, "a Zot trap" ); + break; + } + learned_something_new(TUT_SEEN_TRAP, you.x_pos, you.y_pos); +} // end handle_traps() + +void disarm_trap( struct dist &disa ) +{ + if (you.duration[DUR_BERSERKER]) + { + canned_msg(MSG_TOO_BERSERK); + return; + } + + int i, j; + + for (i = 0; i < MAX_TRAPS; i++) + { + if (env.trap[i].x == you.x_pos + disa.dx + && env.trap[i].y == you.y_pos + disa.dy) + { + break; + } + + if (i == MAX_TRAPS - 1) + { + mpr("Error - couldn't find that trap."); + return; + } + } + + if (trap_category(env.trap[i].type) == DNGN_TRAP_MAGICAL) + { + mpr("You can't disarm that trap."); + return; + } + + if (random2(you.skills[SK_TRAPS_DOORS] + 2) <= random2(you.your_level + 5)) + { + mpr("You failed to disarm the trap."); + + you.turn_is_over = true; + + if (random2(you.dex) > 5 + random2(5 + you.your_level)) + exercise(SK_TRAPS_DOORS, 1 + random2(you.your_level / 5)); + else + { + if (env.trap[i].type == TRAP_NET && + (env.trap[i].x != you.x_pos || env.trap[i].y != you.y_pos)) + { + if (coinflip()) + return; + + mpr("You stumble into the trap!"); + move_player_to_grid( env.trap[i].x, env.trap[i].y, true, false, true); + } + else + handle_traps(env.trap[i].type, i, false); + + if (coinflip()) + exercise(SK_TRAPS_DOORS, 1); + } + + return; + } + + mpr("You have disarmed the trap."); + + struct bolt beam; + + beam.target_x = you.x_pos + disa.dx; + beam.target_y = you.y_pos + disa.dy; + + if (env.trap[i].type == TRAP_NET) + trap_item( OBJ_MISSILES, MI_THROWING_NET, beam.target_x, beam.target_y ); + else if (env.trap[i].type != TRAP_BLADE + && trap_category(env.trap[i].type) == DNGN_TRAP_MECHANICAL) + { + const int num_to_make = 10 + random2(you.skills[SK_TRAPS_DOORS]); + for (j = 0; j < num_to_make; j++) + { + // places items (eg darts), which will automatically stack + itrap(beam, i); + } + } + + grd[you.x_pos + disa.dx][you.y_pos + disa.dy] = DNGN_FLOOR; + env.trap[i].type = TRAP_UNASSIGNED; + you.turn_is_over = true; + + // reduced from 5 + random2(5) + exercise(SK_TRAPS_DOORS, 1 + random2(5) + (you.your_level / 5)); +} // end disarm_trap() + +// attempts to take a net off a given monster +// Do not expect gratitude for this! +// ---------------------------------- +void remove_net_from(monsters *mon) +{ + you.turn_is_over = true; + + int net = get_trapping_net(mon->x, mon->y); + + if (net == NON_ITEM) + { + mon->del_ench(ENCH_HELD, true); + return; + } + + // factor in whether monster is paralysed or invisible + int paralys = 0; + if (mons_is_paralysed(mon)) // makes this easier + paralys = random2(5); + + int invis = 0; + if (!player_monster_visible(mon)) // makes this harder + invis = 3 + random2(5); + + bool net_destroyed = false; + if ( random2(you.skills[SK_TRAPS_DOORS] + 2) + paralys + <= random2( 2*mon->body_size(PSIZE_BODY) + 3 ) + invis) + { + if (one_chance_in(you.skills[SK_TRAPS_DOORS] + you.dex/2)) + { + mitm[net].plus--; + mpr("You tear at the net."); + if (mitm[net].plus < -7) + { + mpr("Whoops! The net comes apart in your hands!"); + mon->del_ench(ENCH_HELD, true); + destroy_item(net); + net_destroyed = true; + } + } + + if (!net_destroyed) + { + if (player_monster_visible(mon)) + { + mprf("You fail to remove the net from %s.", + mon->name(DESC_NOCAP_THE).c_str()); + } + else + mpr("You fail to remove the net."); + } + + if (random2(you.dex) > 5 + random2( 2*mon->body_size(PSIZE_BODY) )) + exercise(SK_TRAPS_DOORS, 1 + random2(mon->body_size(PSIZE_BODY)/2)); + return; + } + + mon->del_ench(ENCH_HELD, true); + remove_item_stationary(mitm[net]); + + if (player_monster_visible(mon)) + mprf("You free %s.", mon->name(DESC_NOCAP_THE).c_str()); + else + mpr("You loosen the net."); + +} + +void free_self_from_net(bool damage_net) +{ + int net = get_trapping_net(you.x_pos, you.y_pos); + + if (net == NON_ITEM) // really shouldn't happen! + { + you.attribute[ATTR_HELD] = 0; + return; + } + int hold = mitm[net].plus; + + if (damage_net) + { + mpr("You struggle against the net."); + int damage = 1; + + // extra damage for cutting weapons + if (you.equip[EQ_WEAPON] != -1 + && can_cut_meat(you.inv[you.equip[EQ_WEAPON]])) + { + damage++; + } + + if (you.body_size(PSIZE_BODY) > SIZE_MEDIUM) + damage++; + + if (hold < 0 && !one_chance_in(-hold/2)) + damage++; + + if (you.duration[DUR_BERSERKER]) + damage *= 2; + + mitm[net].plus -= damage; + + if (mitm[net].plus < -7) + { + mpr("You rip the net and break free!"); + dec_mitm_item_quantity( net, 1 ); + + you.attribute[ATTR_HELD] = 0; + return; + } + } + else // you try to escape + { + mpr("You struggle to escape from the net."); + you.attribute[ATTR_HELD]--; + + if (you.body_size(PSIZE_BODY) < SIZE_MEDIUM) + you.attribute[ATTR_HELD]--; + + if (hold < 0 && !one_chance_in(-hold/2)) + you.attribute[ATTR_HELD]--; + + if (you.attribute[ATTR_HELD] <= 0) + { + mpr("You break free from the net!"); + you.attribute[ATTR_HELD] = 0; + remove_item_stationary(mitm[net]); + return; + } + } +} + +bool trap_item(object_class_type base_type, char sub_type, + char beam_x, char beam_y) +{ + item_def item; + + item.base_type = base_type; + item.sub_type = sub_type; + item.plus = 0; + item.plus2 = 0; + item.flags = 0; + item.special = 0; + item.quantity = 1; + + if (base_type == OBJ_MISSILES) + { + if (sub_type == MI_NEEDLE) + set_item_ego_type( item, OBJ_MISSILES, SPMSL_POISONED ); + else + set_item_ego_type( item, OBJ_MISSILES, SPMSL_NORMAL ); + } + else + { + set_item_ego_type( item, OBJ_WEAPONS, SPWPN_NORMAL ); + } + + item_colour(item); + + if (igrd[beam_x][beam_y] != NON_ITEM) + { + if (items_stack( item, mitm[ igrd[beam_x][beam_y] ] )) + { + inc_mitm_item_quantity( igrd[beam_x][beam_y], 1 ); + return (false); + } + + // don't want to go overboard here. Will only generate up to three + // separate trap items, or less if there are other items present. + if (mitm[ igrd[beam_x][beam_y] ].link != NON_ITEM + && (item.base_type != OBJ_MISSILES || item.sub_type != MI_THROWING_NET)) + { + if (mitm[ mitm[ igrd[beam_x][beam_y] ].link ].link != NON_ITEM) + return (false); + } + } // end of if igrd != NON_ITEM + + return (!copy_item_to_grid( item, beam_x, beam_y, 1 )); +} // end trap_item() + +// returns appropriate trap symbol for a given trap type {dlb} +dungeon_feature_type trap_category(trap_type type) +{ + switch (type) + { + case TRAP_TELEPORT: + case TRAP_AMNESIA: + case TRAP_ZOT: + return (DNGN_TRAP_MAGICAL); + + case TRAP_DART: + case TRAP_ARROW: + case TRAP_SPEAR: + case TRAP_AXE: + case TRAP_BLADE: + case TRAP_BOLT: + case TRAP_NEEDLE: + case TRAP_NET: + default: // what *would* be the default? {dlb} + return (DNGN_TRAP_MECHANICAL); + } +} // end trap_category() + +// returns index of the trap for a given (x,y) coordinate pair {dlb} +int trap_at_xy(int which_x, int which_y) +{ + + for (int which_trap = 0; which_trap < MAX_TRAPS; which_trap++) + { + if (env.trap[which_trap].x == which_x && + env.trap[which_trap].y == which_y && + env.trap[which_trap].type != TRAP_UNASSIGNED) + { + return (which_trap); + } + } + + // no idea how well this will be handled elsewhere: {dlb} + return (-1); +} // end trap_at_xy() + +trap_type trap_type_at_xy(int x, int y) +{ + const int idx = trap_at_xy(x, y); + return (idx == -1? NUM_TRAPS : env.trap[idx].type); +} + diff --git a/crawl-ref/source/traps.h b/crawl-ref/source/traps.h new file mode 100644 index 0000000000..4ca0c815d9 --- /dev/null +++ b/crawl-ref/source/traps.h @@ -0,0 +1,65 @@ +/* + * File: traps.h + * Summary: Traps related functions. + * Written by: Linley Henzell + * + * Modified for Crawl Reference by $Author: j-p-e-g $ on $Date: 2007-09-03 06:41:30 -0700 (Mon, 03 Sep 2007) $ + * + * Change History (most recent first): + * + * <1> 9/11/07 MPC Split from misc.h + */ + +#ifndef TRAPS_H +#define TRAPS_H + +#include "enum.h" + +struct dist; +struct bolt; +class monsters; + +bool trap_item(object_class_type base_type, char sub_type, + char beam_x, char beam_y); + +// last updated 12may2000 {dlb} +/* *********************************************************************** + * called from: acr + * *********************************************************************** */ +void disarm_trap(struct dist &disa); +void remove_net_from( monsters *mon ); +void free_self_from_net( bool damage_net = true ); + +// last updated 12may2000 {dlb} +/* *********************************************************************** + * called from: acr - misc + * *********************************************************************** */ +void handle_traps(char trt, int i, bool trap_known); +int get_trapping_net(int x, int y, bool trapped = true); +void mark_net_trapping(int x, int y); +void monster_caught_in_net(monsters *mon, bolt &pbolt); +void player_caught_in_net(void); + +// last updated 12may2000 {dlb} +/* *********************************************************************** + * called from: misc - mstuff2 + * *********************************************************************** */ +void itrap(struct bolt &pbolt, int trapped); + +// last updated 3jun2000 {dlb} +/* *********************************************************************** + * called from: acr - misc - mstuff2 - spells3 + * *********************************************************************** */ +int trap_at_xy(int which_x, int which_y); + + +// last updated 3jun2000 {dlb} +/* *********************************************************************** + * called from: acr - misc - mstuff2 - spells2 - spells3 + * *********************************************************************** */ +dungeon_feature_type trap_category(trap_type type); + +int trap_at_xy(int x, int y); +trap_type trap_type_at_xy(int x, int y); + +#endif diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 381aa76727..eb87f9ea47 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -21,14 +21,19 @@ #include "dgnevent.h" #include "direct.h" #include "itemname.h" +#include "itemprop.h" #include "items.h" +#include "message.h" #include "misc.h" #include "mon-util.h" #include "monstuff.h" #include "overmap.h" +#include "place.h" #include "player.h" #include "stash.h" #include "stuff.h" +#include "terrain.h" +#include "traps.h" #include "travel.h" #include "tutorial.h" #include "view.h" diff --git a/crawl-ref/source/travel.h b/crawl-ref/source/travel.h index bd6b9d52e6..592c9f08f1 100644 --- a/crawl-ref/source/travel.h +++ b/crawl-ref/source/travel.h @@ -16,6 +16,38 @@ # include <vector> # include <map> +enum run_check_type +{ + RCHECK_LEFT, + RCHECK_FRONT, + RCHECK_RIGHT +}; + +enum run_dir_type +{ + RDIR_UP = 0, + RDIR_UP_RIGHT, + RDIR_RIGHT, + RDIR_DOWN_RIGHT, + RDIR_DOWN, + RDIR_DOWN_LEFT, + RDIR_LEFT, + RDIR_UP_LEFT, + RDIR_REST +}; + +enum run_mode_type +{ + RMODE_INTERLEVEL = -4, // Interlevel travel (Ctrl+G) + RMODE_EXPLORE_GREEDY = -3, // Explore + grab items (Tab/Ctrl+I) + RMODE_EXPLORE = -2, // Exploring (Ctrl+O) + RMODE_TRAVEL = -1, // Classic or Plain Old travel + RMODE_NOT_RUNNING = 0, // must remain equal to 0 + RMODE_CONTINUE, + RMODE_START, + RMODE_REST_DURATION = 100 +}; + /* *********************************************************************** * Initialises the travel subsystem. * diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc index f2dcbe2cfe..bf3c356482 100644 --- a/crawl-ref/source/tutorial.cc +++ b/crawl-ref/source/tutorial.cc @@ -9,6 +9,7 @@ #include "cio.h" #include "command.h" #include "files.h" +#include "food.h" #include "initfile.h" #include "itemname.h" #include "itemprop.h" @@ -27,6 +28,7 @@ #include "spl-book.h" #include "spl-util.h" #include "stuff.h" +#include "terrain.h" #include "view.h" static species_type get_tutorial_species(unsigned int type); diff --git a/crawl-ref/source/unrand.h b/crawl-ref/source/unrand.h index 218086775c..2775c2283a 100644 --- a/crawl-ref/source/unrand.h +++ b/crawl-ref/source/unrand.h @@ -15,6 +15,7 @@ #define UNRAND_H #include "defines.h" +#include "itemprop.h" /* List of "unrandom" artefacts. Not the same as "fixed" artefacts, which are diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 13dd0d5ffb..ee5dc4c530 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -49,6 +49,7 @@ #include "itemprop.h" #include "luadgn.h" #include "macro.h" +#include "message.h" #include "misc.h" #include "monstuff.h" #include "mon-util.h" @@ -58,6 +59,8 @@ #include "stuff.h" #include "spells4.h" #include "stash.h" +#include "state.h" +#include "terrain.h" #include "travel.h" #include "tutorial.h" diff --git a/crawl-ref/source/view.h b/crawl-ref/source/view.h index a595da556e..6f9e9f70b5 100644 --- a/crawl-ref/source/view.h +++ b/crawl-ref/source/view.h @@ -18,6 +18,46 @@ #include "externs.h" +// various elemental colour schemes... used for abstracting random short lists +// MUST match the order in initfile.cc or breakage results. +enum element_type +{ + EC_FIRE = 32, // fiery colours (must be first and > highest colour) + EC_ICE, // icy colours + EC_EARTH, // earthy colours + EC_ELECTRICITY, // electrical side of air + EC_AIR, // non-electric and general air magic + EC_POISON, // used only for venom mage and stalker stuff + EC_WATER, // used only for the elemental + EC_MAGIC, // general magical effect + EC_MUTAGENIC, // transmute, poly, radiation effects + EC_WARP, // teleportation and anything similar + EC_ENCHANT, // magical enhancements + EC_HEAL, // holy healing (not necromantic stuff) + EC_HOLY, // general "good" god effects + EC_DARK, // darkness + EC_DEATH, // currently only assassin (and equal to EC_NECRO) + EC_NECRO, // necromancy stuff + EC_UNHOLY, // demonology stuff + EC_VEHUMET, // vehumet's odd-ball colours + EC_BEOGH, // Beogh altar colours + EC_CRYSTAL, // colours of crystal + EC_BLOOD, // colours of blood + EC_SMOKE, // colours of smoke + EC_SLIME, // colours of slime + EC_JEWEL, // colourful + EC_ELVEN, // used for colouring elf fabric items + EC_DWARVEN, // used for colouring dwarf fabric items + EC_ORCISH, // used for colouring orc fabric items + EC_GILA, // gila monster colours + EC_FLOOR, // colour of the area's floor + EC_ROCK, // colour of the area's rock + EC_STONE, // colour of the area's stone + EC_MIST, // colour of mist + EC_SHIMMER_BLUE, // shimmering colours of blue. + EC_RANDOM // any colour (except BLACK) +}; + #define BORDER_COLOR BROWN void init_char_table(char_set_type set); @@ -153,6 +193,7 @@ void view_update_at(const coord_def &pos); void viewwindow(bool draw_it, bool do_updates); void fire_monster_alerts(); +struct ray_def; bool find_ray( int sourcex, int sourcey, int targetx, int targety, bool allow_fallback, ray_def& ray, int cycle_dir = 0, bool find_shortest = false ); diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc index deb949009b..ec62a0273f 100644 --- a/crawl-ref/source/xom.cc +++ b/crawl-ref/source/xom.cc @@ -13,6 +13,7 @@ #include "it_use2.h" #include "items.h" #include "makeitem.h" +#include "message.h" #include "misc.h" #include "mon-util.h" #include "monplace.h" @@ -23,6 +24,7 @@ #include "religion.h" #include "spells3.h" #include "spl-cast.h" +#include "spl-util.h" #include "stuff.h" #include "view.h" |