summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-09 10:13:51 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-09 10:13:51 +0000
commitcd08ab62d681ee480339a2f26d833bf9d4104dda (patch)
tree0ea72e62d6fa7f5d30c0b827150821d79946971f
parentff184229db597309592f1efc2ff089fa1b79418a (diff)
downloadcrawl-ref-cd08ab62d681ee480339a2f26d833bf9d4104dda.tar.gz
crawl-ref-cd08ab62d681ee480339a2f26d833bf9d4104dda.zip
Decouple zap_type from wand_type prepatory to a big beam() rewrite.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7200 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/beam.h71
-rw-r--r--crawl-ref/source/enum.h69
-rw-r--r--crawl-ref/source/externs.h6
-rw-r--r--crawl-ref/source/itemprop.h15
-rw-r--r--crawl-ref/source/items.cc37
5 files changed, 102 insertions, 96 deletions
diff --git a/crawl-ref/source/beam.h b/crawl-ref/source/beam.h
index ec42152515..0cf97ad563 100644
--- a/crawl-ref/source/beam.h
+++ b/crawl-ref/source/beam.h
@@ -32,78 +32,7 @@ enum mon_resist_type
MON_OTHER // monster unaffected, but for other reasons
};
-// must match wand subtypes! (see item_def::zap())
-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
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 0d71e89bba..93f2dc684f 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -2895,6 +2895,75 @@ enum friendly_pickup_type
FRIENDLY_PICKUP_ALL
};
+enum zap_type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ANDBLAST,
+ ZAP_MAGMA,
+ ZAP_POISON_ARROW,
+ ZAP_BREATHE_STICKY_FLAME,
+ ZAP_BREATHE_LIGHTNING,
+ ZAP_PETRIFY,
+ ZAP_HELLFROST,
+ NUM_ZAPS
+};
+
enum montravel_target_type
{
MTRAV_NONE = 0,
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 420e5d2fef..c479855a49 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -462,10 +462,8 @@ public:
unsigned long ignore_flags = 0x0) const;
bool has_spells() const;
bool cursed() const;
- int book_number() const;
- int zap() const; // what kind of beam it shoots (if wand).
- // XXX should really return zap_type!
-
+ int book_number() const;
+ zap_type zap() const; // what kind of beam it shoots (if wand).
// Returns index in mitm array. Results are undefined if this item is
// not in the array!
diff --git a/crawl-ref/source/itemprop.h b/crawl-ref/source/itemprop.h
index c31e9e11fa..65ff241f7b 100644
--- a/crawl-ref/source/itemprop.h
+++ b/crawl-ref/source/itemprop.h
@@ -535,32 +535,29 @@ enum vorpal_damage_type
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 item_def::zap().
-enum wand_type // mitm[].subtype
+enum wand_type
{
- WAND_FLAME, // 0
+ WAND_FLAME,
WAND_FROST,
WAND_SLOWING,
WAND_HASTING,
WAND_MAGIC_DARTS,
- WAND_HEALING, // 5
+ WAND_HEALING,
WAND_PARALYSIS,
WAND_FIRE,
WAND_COLD,
WAND_CONFUSION,
- WAND_INVISIBILITY, // 10
+ WAND_INVISIBILITY,
WAND_DIGGING,
WAND_FIREBALL,
WAND_TELEPORTATION,
WAND_LIGHTNING,
- WAND_POLYMORPH_OTHER, // 15
+ WAND_POLYMORPH_OTHER,
WAND_ENSLAVEMENT,
WAND_DRAINING,
WAND_RANDOM_EFFECTS,
WAND_DISINTEGRATION,
- NUM_WANDS // must remain last member {dlb}
+ NUM_WANDS
};
enum zap_count_type
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 992bb6a5ad..8475a11b17 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -2475,29 +2475,42 @@ bool item_def::launched_by(const item_def &launcher) const
return (sub_type == mt || (mt == MI_STONE && sub_type == MI_SLING_BULLET));
}
-int item_def::zap() const
+zap_type item_def::zap() const
{
if (base_type != OBJ_WANDS)
return (ZAP_DEBUGGING_RAY);
- zap_type result;
- switch (sub_type)
- {
- case WAND_ENSLAVEMENT: result = ZAP_ENSLAVEMENT; break;
- case WAND_DRAINING: result = ZAP_NEGATIVE_ENERGY; break;
- case WAND_DISINTEGRATION: result = ZAP_DISINTEGRATION; break;
-
+ zap_type result = ZAP_DEBUGGING_RAY;
+ switch (static_cast<wand_type>(sub_type))
+ {
+ case WAND_FLAME: result = ZAP_FLAME; break;
+ case WAND_FROST: result = ZAP_FROST; break;
+ case WAND_SLOWING: result = ZAP_SLOWING; break;
+ case WAND_HASTING: result = ZAP_HASTING; break;
+ case WAND_MAGIC_DARTS: result = ZAP_MAGIC_DARTS; break;
+ case WAND_HEALING: result = ZAP_HEALING; break;
+ case WAND_PARALYSIS: result = ZAP_PARALYSIS; break;
+ case WAND_FIRE: result = ZAP_FIRE; break;
+ case WAND_COLD: result = ZAP_COLD; break;
+ case WAND_CONFUSION: result = ZAP_CONFUSION; break;
+ case WAND_INVISIBILITY: result = ZAP_INVISIBILITY; break;
+ case WAND_DIGGING: result = ZAP_DIGGING; break;
+ case WAND_FIREBALL: result = ZAP_FIREBALL; break;
+ case WAND_TELEPORTATION: result = ZAP_TELEPORTATION; break;
+ case WAND_LIGHTNING: result = ZAP_LIGHTNING; break;
+ case WAND_POLYMORPH_OTHER: result = ZAP_POLYMORPH_OTHER; break;
+ case WAND_ENSLAVEMENT: result = ZAP_ENSLAVEMENT; break;
+ case WAND_DRAINING: result = ZAP_NEGATIVE_ENERGY; break;
+ case WAND_DISINTEGRATION: result = ZAP_DISINTEGRATION; break;
case WAND_RANDOM_EFFECTS:
- result = static_cast<zap_type>(random2(16));
+ result = static_cast<zap_type>(random2(ZAP_LAST_RANDOM + 1));
if (one_chance_in(20))
result = ZAP_NEGATIVE_ENERGY;
if (one_chance_in(17))
result = ZAP_ENSLAVEMENT;
break;
- default:
- result = static_cast<zap_type>(sub_type);
- break;
+ case NUM_WANDS: break;
}
return (result);
}