summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tags.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-09 14:24:11 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-09 14:24:11 +0000
commitf2a95ba0d453ba6685ed29201beda8a2f703ab79 (patch)
treee7201beb995472236921334a363644e5782d648b /crawl-ref/source/tags.cc
parent447bc8ac9d8557be01da02c40349e4301f42c089 (diff)
downloadcrawl-ref-f2a95ba0d453ba6685ed29201beda8a2f703ab79.tar.gz
crawl-ref-f2a95ba0d453ba6685ed29201beda8a2f703ab79.zip
Monsters get multilevel resists (incomplete). Monster data needs to be
adjusted per monster to hand out the right resists. The current MR_RES_FIRE gives one level of resistance only. Added a real ghost structure, discarded the old ghost values array. Adjusted bones file format so bones will work out-of-the-box with Hearse. Breaks bones format, older bones will be rejected. Fixed some maps with bad DEPTHs. Added more safe answers in Y/N prompts, added a check to make it less likely that Crawl will spin in a tight loop reading input from a closed tty. (Experimental) !a will override existing foe of friendlies in LOS. Blademasters no longer pick up stuff to throw (Erik). Zombies of swimming things are also swimming things. Currently applies only to zombies explicitly placed in .des files, since fish zombies cannot be generated otherwise (can of worms). Morgue is now saved before showing the inventory and other boring end-of-game stuff. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3231 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/tags.cc')
-rw-r--r--crawl-ref/source/tags.cc124
1 files changed, 100 insertions, 24 deletions
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index c962301856..041429135a 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -75,6 +75,7 @@
#include "enum.h"
#include "externs.h"
#include "files.h"
+#include "ghost.h"
#include "itemname.h"
#include "itemprop.h"
#include "mapmark.h"
@@ -132,6 +133,13 @@ static void tag_read_ghost(tagHeader &th, char minorVersion);
static void marshallGhost(tagHeader &th, const ghost_demon &ghost);
static ghost_demon unmarshallGhost( tagHeader &th );
+
+static void marshallResists(tagHeader &, const mon_resist_def &);
+static void unmarshallResists(tagHeader &, mon_resist_def &);
+
+static void marshallSpells(tagHeader &, const monster_spells &);
+static void unmarshallSpells(tagHeader &, monster_spells &);
+
static void marshall_monster(tagHeader &th, const monsters &m);
static void unmarshall_monster(tagHeader &th, monsters &m);
@@ -1757,9 +1765,7 @@ static void marshall_monster(tagHeader &th, const monsters &m)
for (int j = 0; j < NUM_MONSTER_SLOTS; j++)
marshallShort(th, m.inv[j]);
- for (int j = 0; j < NUM_MONSTER_SPELL_SLOTS; ++j)
- marshallShort(th, m.spells[j]);
-
+ marshallSpells(th, m.spells);
marshallByte(th, m.god);
if (m.type == MONS_PLAYER_GHOST || m.type == MONS_PANDEMONIUM_DEMON)
@@ -2022,8 +2028,7 @@ static void unmarshall_monster(tagHeader &th, monsters &m)
for (int j = 0; j < NUM_MONSTER_SLOTS; j++)
m.inv[j] = unmarshallShort(th);
- for (int j = 0; j < NUM_MONSTER_SPELL_SLOTS; ++j)
- m.spells[j] = static_cast<spell_type>( unmarshallShort(th) );
+ unmarshallSpells(th, m.spells);
m.god = (god_type) unmarshallByte(th);
@@ -2210,24 +2215,74 @@ static void tag_missing_level_tiles()
// ------------------------------- ghost tags ---------------------------- //
-static void marshallGhost(tagHeader &th, const ghost_demon &ghost)
+static void marshallResists(tagHeader &th, const mon_resist_def &res)
{
- marshallString(th, ghost.name.c_str(), 20);
+ marshallByte(th, res.elec);
+ marshallByte(th, res.poison);
+ marshallByte(th, res.fire);
+ marshallByte(th, res.steam);
+ marshallByte(th, res.cold);
+ marshallByte(th, res.hellfire);
+ marshallByte(th, res.asphyx);
+ marshallByte(th, res.acid);
+ marshallByte(th, res.sticky_flame);
+ marshallByte(th, res.pierce);
+ marshallByte(th, res.slice);
+ marshallByte(th, res.bludgeon);
+}
- // how many ghost values?
- marshallByte(th, NUM_GHOST_VALUES);
+static void unmarshallResists(tagHeader &th, mon_resist_def &res)
+{
+ res.elec = unmarshallByte(th);
+ res.poison = unmarshallByte(th);
+ res.fire = unmarshallByte(th);
+ res.steam = unmarshallByte(th);
+ res.cold = unmarshallByte(th);
+ res.hellfire = unmarshallByte(th);
+ res.asphyx = unmarshallByte(th);
+ res.acid = unmarshallByte(th);
+ res.sticky_flame = unmarshallByte(th);
+ res.pierce = unmarshallByte(th);
+ res.slice = unmarshallByte(th);
+ res.bludgeon = unmarshallByte(th);
+}
- for (int i = 0; i < NUM_GHOST_VALUES; i++)
- marshallShort( th, ghost.values[i] );
+static void marshallSpells(tagHeader &th, const monster_spells &spells)
+{
+ for (int j = 0; j < NUM_MONSTER_SPELL_SLOTS; ++j)
+ marshallShort(th, spells[j]);
}
-static void tag_construct_ghost(tagHeader &th)
+static void unmarshallSpells(tagHeader &th, monster_spells &spells)
{
- // How many ghosts?
- marshallShort(th, ghosts.size());
+ for (int j = 0; j < NUM_MONSTER_SPELL_SLOTS; ++j)
+ spells[j] = static_cast<spell_type>( unmarshallShort(th) );
+}
- for (int i = 0, size = ghosts.size(); i < size; ++i)
- marshallGhost(th, ghosts[i]);
+static void marshallGhost(tagHeader &th, const ghost_demon &ghost)
+{
+ marshallString(th, ghost.name.c_str(), 20);
+
+ marshallShort(th, ghost.species);
+ marshallShort(th, ghost.job);
+ marshallShort(th, ghost.best_skill);
+ marshallShort(th, ghost.best_skill_level);
+ marshallShort(th, ghost.xl);
+ marshallShort(th, ghost.max_hp);
+ marshallShort(th, ghost.ev);
+ marshallShort(th, ghost.ac);
+ marshallShort(th, ghost.damage);
+ marshallShort(th, ghost.speed);
+ marshallByte(th, ghost.see_invis);
+ marshallShort(th, ghost.brand);
+
+ marshallResists(th, ghost.resists);
+
+ marshallByte(th, ghost.spellcaster);
+ marshallByte(th, ghost.cycle_colours);
+ marshallShort(th, ghost.fly);
+
+ marshallSpells(th, ghost.spells);
}
static ghost_demon unmarshallGhost( tagHeader &th )
@@ -2236,18 +2291,39 @@ static ghost_demon unmarshallGhost( tagHeader &th )
ghost.name = unmarshallString(th, 20);
- // how many ghost values?
- int count_c = unmarshallByte(th);
-
- if (count_c > NUM_GHOST_VALUES)
- count_c = NUM_GHOST_VALUES;
+ ghost.species = static_cast<species_type>( unmarshallShort(th) );
+ ghost.job = static_cast<job_type>( unmarshallShort(th) );
+ ghost.best_skill = static_cast<skill_type>( unmarshallShort(th) );
+ ghost.best_skill_level = unmarshallShort(th);
+ ghost.xl = unmarshallShort(th);
+ ghost.max_hp = unmarshallShort(th);
+ ghost.ev = unmarshallShort(th);
+ ghost.ac = unmarshallShort(th);
+ ghost.damage = unmarshallShort(th);
+ ghost.speed = unmarshallShort(th);
+ ghost.see_invis = unmarshallByte(th);
+ ghost.brand = static_cast<brand_type>( unmarshallShort(th) );
+
+ unmarshallResists(th, ghost.resists);
+
+ ghost.spellcaster = unmarshallByte(th);
+ ghost.cycle_colours = unmarshallByte(th);
+ ghost.fly = static_cast<flight_type>( unmarshallShort(th) );
+
+ unmarshallSpells(th, ghost.spells);
- for (int i = 0; i < count_c; i++)
- ghost.values[i] = unmarshallShort(th);
-
return (ghost);
}
+static void tag_construct_ghost(tagHeader &th)
+{
+ // How many ghosts?
+ marshallShort(th, ghosts.size());
+
+ for (int i = 0, size = ghosts.size(); i < size; ++i)
+ marshallGhost(th, ghosts[i]);
+}
+
static void tag_read_ghost(tagHeader &th, char minorVersion)
{
int nghosts = unmarshallShort(th);