summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2009-10-12 12:30:59 +0200
committerAdam Borowski <kilobyte@angband.pl>2009-10-12 12:30:59 +0200
commitbb38340278573cc3d3a39f5312348a68669d7009 (patch)
tree15e500dd83a968fbbac21b61802421d8bead41f8 /crawl-ref
parent667a7541a925a8adaebcfb673aed22c7eeb73eae (diff)
parentea87539549413ac9595762ec09fcbab4b3f0032b (diff)
downloadcrawl-ref-bb38340278573cc3d3a39f5312348a68669d7009.tar.gz
crawl-ref-bb38340278573cc3d3a39f5312348a68669d7009.zip
Merge branch 'master' into trees
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/.gitignore2
-rw-r--r--crawl-ref/CREDITS.txt51
-rw-r--r--crawl-ref/docs/changelog.txt45
-rw-r--r--crawl-ref/source/AppHdr.h61
-rw-r--r--crawl-ref/source/Crawl.xcodeproj/project.pbxproj460
-rw-r--r--crawl-ref/source/abl-show.cc13
-rw-r--r--crawl-ref/source/acr.cc5
-rw-r--r--crawl-ref/source/arena.cc3
-rw-r--r--crawl-ref/source/arena.h1
-rw-r--r--crawl-ref/source/artefact.cc5
-rw-r--r--crawl-ref/source/beam.cc17
-rw-r--r--crawl-ref/source/bitary.cc76
-rw-r--r--crawl-ref/source/bitary.h35
-rw-r--r--crawl-ref/source/branch.cc1
-rw-r--r--crawl-ref/source/chardump.cc2
-rw-r--r--crawl-ref/source/cio.cc4
-rw-r--r--crawl-ref/source/cio.h1
-rw-r--r--crawl-ref/source/cloud.cc74
-rw-r--r--crawl-ref/source/cloud.h2
-rw-r--r--crawl-ref/source/clua.cc40
-rw-r--r--crawl-ref/source/clua.h2
-rw-r--r--crawl-ref/source/command.cc8
-rw-r--r--crawl-ref/source/crash-u.cc102
-rw-r--r--crawl-ref/source/ctest.h2
-rw-r--r--crawl-ref/source/dat/clua/dungeon.lua29
-rw-r--r--crawl-ref/source/dat/clua/lm_fog.lua2
-rw-r--r--crawl-ref/source/dat/clua/ziggurat.lua8
-rw-r--r--crawl-ref/source/dat/crypt.des158
-rw-r--r--crawl-ref/source/dat/database/godspeak.txt23
-rw-r--r--crawl-ref/source/dat/icecave.des83
-rw-r--r--crawl-ref/source/dat/trove.des6
-rw-r--r--crawl-ref/source/database.h1
-rw-r--r--crawl-ref/source/debug.cc5
-rw-r--r--crawl-ref/source/decks.cc1
-rw-r--r--crawl-ref/source/defines.h2
-rw-r--r--crawl-ref/source/delay.cc86
-rw-r--r--crawl-ref/source/describe.cc18
-rw-r--r--crawl-ref/source/directn.cc3
-rw-r--r--crawl-ref/source/dungeon.cc5
-rw-r--r--crawl-ref/source/effects.cc18
-rw-r--r--crawl-ref/source/enum.h18
-rw-r--r--crawl-ref/source/fight.cc5
-rw-r--r--crawl-ref/source/files.cc19
-rw-r--r--crawl-ref/source/food.cc62
-rw-r--r--crawl-ref/source/ghost.cc1
-rw-r--r--crawl-ref/source/hiscores.cc1
-rw-r--r--crawl-ref/source/initfile.cc11
-rw-r--r--crawl-ref/source/invent.cc2
-rw-r--r--crawl-ref/source/it_use3.cc13
-rw-r--r--crawl-ref/source/item_use.cc1
-rw-r--r--crawl-ref/source/itemname.cc8
-rw-r--r--crawl-ref/source/itemprop.cc5
-rw-r--r--crawl-ref/source/items.cc20
-rw-r--r--crawl-ref/source/items.h1
-rw-r--r--crawl-ref/source/kills.cc5
-rw-r--r--crawl-ref/source/libdos.cc4
-rw-r--r--crawl-ref/source/libgui.cc11
-rw-r--r--crawl-ref/source/libunix.cc7
-rw-r--r--crawl-ref/source/libunix.h4
-rw-r--r--crawl-ref/source/libutil.cc3
-rw-r--r--crawl-ref/source/libw32c.cc6
-rw-r--r--crawl-ref/source/los.cc464
-rw-r--r--crawl-ref/source/luadgn.h1
-rw-r--r--crawl-ref/source/macro.cc1
-rw-r--r--crawl-ref/source/makefile715
-rw-r--r--crawl-ref/source/makefile.mgw236
-rw-r--r--crawl-ref/source/makefile.mgw_unix238
-rw-r--r--crawl-ref/source/makefile.obj1
-rw-r--r--crawl-ref/source/makefile.osx40
-rw-r--r--crawl-ref/source/makefile.unix325
-rw-r--r--crawl-ref/source/makefile_tiles.mgw292
-rw-r--r--crawl-ref/source/makefile_tiles.mgw_unix274
-rw-r--r--crawl-ref/source/makefile_tiles.unix371
-rw-r--r--crawl-ref/source/makeitem.cc2
-rw-r--r--crawl-ref/source/mapdef.cc1
-rw-r--r--crawl-ref/source/mapmark.cc1
-rw-r--r--crawl-ref/source/maps.cc1
-rw-r--r--crawl-ref/source/menu.cc3
-rw-r--r--crawl-ref/source/menu.h1
-rw-r--r--crawl-ref/source/message.cc2
-rw-r--r--crawl-ref/source/mgrow.cc1
-rw-r--r--crawl-ref/source/misc.cc5
-rw-r--r--crawl-ref/source/mon-data.h12
-rw-r--r--crawl-ref/source/mon-util.cc3
-rw-r--r--crawl-ref/source/monplace.cc1
-rw-r--r--crawl-ref/source/monspeak.cc9
-rw-r--r--crawl-ref/source/monstuff.cc60
-rw-r--r--crawl-ref/source/mstuff2.cc67
-rw-r--r--crawl-ref/source/mstuff2.h3
-rw-r--r--crawl-ref/source/mtransit.cc1
-rw-r--r--crawl-ref/source/mtransit.h1
-rw-r--r--crawl-ref/source/mutation.cc22
-rw-r--r--crawl-ref/source/newgame.cc62
-rw-r--r--crawl-ref/source/notes.cc2
-rw-r--r--crawl-ref/source/ouch.cc7
-rw-r--r--crawl-ref/source/output.cc4
-rw-r--r--crawl-ref/source/overmap.cc1
-rw-r--r--crawl-ref/source/platform.h288
-rw-r--r--crawl-ref/source/player.cc25
-rw-r--r--crawl-ref/source/ray.cc340
-rw-r--r--crawl-ref/source/ray.h47
-rw-r--r--crawl-ref/source/religion.cc230
-rw-r--r--crawl-ref/source/religion.h3
-rw-r--r--crawl-ref/source/rltiles/dc-item.txt1
-rw-r--r--crawl-ref/source/rltiles/item/amulet/i-spirit.pngbin0 -> 221 bytes
-rw-r--r--crawl-ref/source/rltiles/makefile.unix46
-rw-r--r--crawl-ref/source/shopping.cc5
-rw-r--r--crawl-ref/source/skills.cc1
-rw-r--r--crawl-ref/source/skills2.cc4
-rw-r--r--crawl-ref/source/spells1.cc11
-rw-r--r--crawl-ref/source/spells2.cc1
-rw-r--r--crawl-ref/source/spells3.cc6
-rw-r--r--crawl-ref/source/spells4.cc2
-rw-r--r--crawl-ref/source/spl-book.cc7
-rw-r--r--crawl-ref/source/spl-cast.cc5
-rw-r--r--crawl-ref/source/spl-util.cc6
-rw-r--r--crawl-ref/source/stash.cc3
-rw-r--r--crawl-ref/source/stash.h1
-rw-r--r--crawl-ref/source/state.cc1
-rw-r--r--crawl-ref/source/stuff.cc7
-rw-r--r--crawl-ref/source/tags.cc2
-rw-r--r--crawl-ref/source/terrain.cc2
-rw-r--r--crawl-ref/source/tile2.cc10
-rw-r--r--crawl-ref/source/tilepick.cc1
-rw-r--r--crawl-ref/source/tilereg.cc2
-rw-r--r--crawl-ref/source/tilesdl.h2
-rw-r--r--crawl-ref/source/tiletex.cc1
-rw-r--r--crawl-ref/source/transfor.cc1
-rw-r--r--crawl-ref/source/traps.cc3
-rw-r--r--crawl-ref/source/travel.cc2
-rw-r--r--crawl-ref/source/tutorial.cc2
-rw-r--r--crawl-ref/source/tutorial.h1
-rw-r--r--crawl-ref/source/util/Makefile26
-rw-r--r--crawl-ref/source/util/includes.sh114
-rw-r--r--crawl-ref/source/util/lua/src/Makefile34
-rw-r--r--crawl-ref/source/util/sqlite/Makefile19
-rw-r--r--crawl-ref/source/view.cc13
-rw-r--r--crawl-ref/source/view.h2
-rw-r--r--crawl-ref/source/xom.cc1096
-rw-r--r--crawl-ref/source/xom.h56
140 files changed, 4024 insertions, 3302 deletions
diff --git a/crawl-ref/.gitignore b/crawl-ref/.gitignore
index 4559f61126..7dee25444b 100644
--- a/crawl-ref/.gitignore
+++ b/crawl-ref/.gitignore
@@ -30,6 +30,7 @@ source/dat/tiles/gui.png
# The Crawl executable.
source/crawl
+source/crawl.exe
# Level-compiler generated files.
source/util/*.cc
@@ -44,3 +45,4 @@ dat
source/build
*.pbxuser
*.perspectivev3
+*.mode1v3
diff --git a/crawl-ref/CREDITS.txt b/crawl-ref/CREDITS.txt
index d2fa9a5154..56b726f146 100644
--- a/crawl-ref/CREDITS.txt
+++ b/crawl-ref/CREDITS.txt
@@ -15,29 +15,30 @@ Lawrence Ramsey, Enne Walker) would like to thank:
We'd also like to thank members of the Dungeon Crawl community who have
contributed to Dungeon Crawl Stone Soup:
-Warwick Allison R. Dan Henry Dylan O'Donnell
-Juha Arpiainen Benoit Hudson Stefan O'Rear
-Roy Axenov Iainuki Yuuma Oohara
-Max Bane Ilyak Charles Otto
-Bill Beher Mitsuhiro Itakura Erik Piper
-Alexander Beisig Mikko Juola Lemuel Pitkin
-Erik Inge Bolsø Jarmo Kielosto Derek Ray
-Peter Borgmann Kornel Kisielewicz Remsleep
-Adam Borowski Vambola Kotkas David Rose
-Jude Brown Vsevolod Kozlov Sebastian Salman
-Trent W. Buck Ryan Kusnery Brett Scarborough
-Terje Bø Jukka Kuusisto Darshan Shaligram
-Aaron Curtis Maciej Lapinski Robert Shimmin
-Denzi Jordan Lewis Sigurd
-Rachel Elizabeth Dillon Icy Lich Edgar Simo
-Mike Drinen Jesse Luehrs Solf
-Kieron Dunbar Markus Maier Johan Strandell
-Christopher Evenstar Arien Malec Roman Sêk
-Ben Goetter Shawn M Moore Marc H. Thoben
-Rob Grant Eva Myers Matt Titus
-John Greenberg Wille Mäntylä Robert Vollmert
-GreyKnight Onia Ninara Steven Wheeler
-Shayne Halvorson Erkki Nurmi Jeremey Wilson
-Ciaran Hamilton Mattias Nyberg Yelve Yakut
-Chris Hamons nyra Zooko
+Warwick Allison Benoit Hudson Stefan O'Rear
+Juha Arpiainen Iainuki Yuuma Oohara
+Roy Axenov Ilyak Charles Otto
+Max Bane Mitsuhiro Itakura Erik Piper
+Bill Beher Mikko Juola Lemuel Pitkin
+Alexander Beisig Jarmo Kielosto Derek Ray
+Erik Inge Bolsø Kornel Kisielewicz Remsleep
+Peter Borgmann Vambola Kotkas David Rose
+Adam Borowski Vsevolod Kozlov Sebastian Salman
+Jude Brown Ryan Kusnery Brett Scarborough
+Trent W. Buck Jukka Kuusisto Darshan Shaligram
+Terje Bø Maciej Lapinski Robert Shimmin
+Aaron Curtis Jordan Lewis Sigurd
+Denzi Icy Lich Edgar Simo
+Rachel Elizabeth Dillon Jesse Luehrs Solf
+Mike Drinen Markus Maier Johan Strandell
+Kieron Dunbar Arien Malec Roman Sêk
+Christopher Evenstar Neil 'Mu' Middleton Marc H. Thoben
+Ben Goetter Shawn M Moore Matt Titus
+Rob Grant Eva Myers Robert Vollmert
+John Greenberg Wille Mäntylä Steven Wheeler
+GreyKnight Onia Ninara Jeremey Wilson
+Shayne Halvorson Erkki Nurmi Yelve Yakut
+Ciaran Hamilton Mattias Nyberg Zooko
+Chris Hamons nyra
+R. Dan Henry Dylan O'Donnell
diff --git a/crawl-ref/docs/changelog.txt b/crawl-ref/docs/changelog.txt
index 07c95eca40..be46ad98e9 100644
--- a/crawl-ref/docs/changelog.txt
+++ b/crawl-ref/docs/changelog.txt
@@ -7,6 +7,7 @@ Stone Soup 0.6
* Added potions of brilliance and agility.
* Several new uniques.
* Overhaul Wanderers.
+* Healers now start unarmed.
* Starting stats and equipment, and hp gain, are no longer assigned randomly.
* Round all aptitudes to multiples of 10.
* New memorisation interface.
@@ -20,6 +21,7 @@ Stone Soup 0.6
* Let toadstools grow on corpses.
* All worms apart from brain worms are mindless and cannot be pacified.
* Hungry ghosts eat corpses.
+* All spectral things can use stairs again.
* (Very) ugly things get random resistances and attack flavours.
* Abort some teleportation attempts with -TELE without losing the turn.
* Weapons of holy wrath cannot be cursed.
@@ -39,7 +41,48 @@ Stone Soup 0.6
* Add some tiles "animations" whenever the screen is redrawn.
* Tiles: re-added doll editing screen ('-' command).
* Tiles: added clickable spells display (toggle with '_' command).
-* All spectral things can use stairs again.
+
+
+Stone Soup 0.5.2 (20091008)
+---------------------------
+
+Disclaimer: These are merely the highlights, not an exhaustive list of changes.
+
+* Fixed tiles crashes with certain resolutions.
+* Fixed Mac build sometimes not finding the graphics files.
+* Fixed NSLayoutManager crash with OSX.
+* OSX executables no longer require installation of fink.
+* DCSS now builds on FreeBSD straight out of the box.
+* DCSS now uses git for version control.
+* Fixed Lee's Rapid Deconstruction having no effect at low levels.
+* Fixed weird beam tiles for unknown beam types.
+* Fixed Xom's infinite teleportation journeys.
+* Fixed disconnected pan vaults.
+* Fixed missile +1 enchantment not reducing mulch rate.
+* Fixed some issues with melded equipment.
+* Fixed casting of spells on slot 'I' being impossible.
+* Fixed temporary unlinked item bug.
+* Fixed monsters being unable to pick up or carry healing potions.
+* Fixed mummy monsters drinking potions.
+* Fixed stationary monsters floundering in shallow water.
+* Fixed minivaults sometimes being placed without overlapping floor squares.
+* Fixed friendly fire among monsters.
+* Fixed insane damage dealt by Pain card.
+* Fixed clawed butchering both removing gloves and unwielding weapon.
+* Fixed submerged shapeshifters not unsubmerging properly.
+* Fixed monster mephitic cloud not working against the player properly.
+* Removed entry vaults with lethal fog generators for now.
+* Get rid of out of depth eels in fountains.
+* Greatly tweak ice cave vaults.
+* Some other vault tweaks.
+* All worms except brain worm and all wasps are now mindless.
+* Demonspawn Troggies don't get Channeling anymore.
+* Z does not show spell list automatically anymore.
+* Added an option "darken_beyond_range" (defaults to true) for spell ranges.
+* Default "force_more_message = You fall through a shaft" to true.
+* Reintroduced out of sight mouseover descriptions for Tiles.
+* Replaced post-explosion -More- prompt with a delay.
+* In the ASCII version, colour silenced grids cyan.
Stone Soup 0.5.1 (20090728)
---------------------------
diff --git a/crawl-ref/source/AppHdr.h b/crawl-ref/source/AppHdr.h
index a6a70bf45b..6a7a4adf48 100644
--- a/crawl-ref/source/AppHdr.h
+++ b/crawl-ref/source/AppHdr.h
@@ -19,19 +19,7 @@
#ifndef APPHDR_H
#define APPHDR_H
-// Very simple OS detection, done via predefined macros
-// For a list of predefined macros, see
-// http://predef.sourceforge.net/
-#if defined(__MACH__)
- #ifndef OSX
- #define OSX
- #endif
-#endif
-#if defined(__FreeBSD__)
- #ifndef FREEBSD
- #define FREEBSD
- #endif
-#endif
+#include "platform.h"
// The maximum memory that the user-script Lua interpreter can
// allocate, in kilobytes. This limit is enforced to prevent
@@ -59,24 +47,43 @@
//
// #define DISABLE_STICKY_STARTUP_OPTIONS
-// OS X's Terminal.app has color handling problems; dark grey is
-// especially bad, so we'll want to remap that. OS X is otherwise
-// Unix-ish, so we shouldn't need other special handling.
-#if defined(OSX)
+//
+// Define 'UNIX' if the target OS is UNIX-like.
+//
+#if defined(TARGET_OS_MACOSX) || defined(TARGET_OS_LINUX) || \
+ defined(TARGET_OS_FREEBSD) || defined(TARGET_OS_NETBSD) || \
+ defined(TARGET_OS_OPENBSD) || defined(TARGET_COMPILER_CYGWIN) || \
+ defined(TARGET_OS_SOLARIS)
#ifndef UNIX
#define UNIX
#endif
+#endif
+
+//
+// OS X's Terminal.app has color handling problems; dark grey is
+// especially bad, so we'll want to remap that. OS X is otherwise
+// Unix-ish, so we shouldn't need other special handling.
+//
+#if defined(TARGET_OS_MACOSX)
#define USE_8_COLOUR_TERM_MAP
#define COL_TO_REPLACE_DARKGREY BLUE
#endif
+//
// FreeBSD
-// There's no /usr/bin/zip in FreeBSD.
-#if defined(FREEBSD)
- #ifndef UNIX
- #define UNIX
- #endif
+//
+#if defined(TARGET_OS_FREEBSD)
+
+ // There's no /usr/bin/zip in FreeBSD.
#define SAVE_PACKAGE_NONE
+
+#endif
+
+//
+// MinGW
+//
+#if defined(TARGET_COMPILER_MINGW)
+ #define REGEX_PCRE
#endif
// =========================================================================
@@ -91,8 +98,10 @@
//
// #define DGAMELAUNCH
+#ifndef TARGET_COMPILER_MINGW
#define MULTIUSER
#define USE_UNIX_SIGNALS
+#endif
// If this is defined, Crawl will attempt to save and exit when it
// receives a hangup signal.
@@ -128,7 +137,9 @@
//
// For now, we'll make it default to on for Linux (who should have
// no problems with compiling this).
+#ifndef TARGET_COMPILER_MINGW
#define USE_MORE_SECURE_SEED
+#endif
// Use POSIX regular expressions
#ifndef REGEX_PCRE
@@ -159,7 +170,7 @@
#include "libunix.h"
-#elif defined(DOS)
+#elif defined(TARGET_OS_DOS)
#define SHORT_FILE_NAMES
#define EOL "\r\n"
#define CHARACTER_SET A_ALTCHARSET
@@ -183,7 +194,7 @@
// linked in. This is optional.
#define REGEX_PCRE
-#elif defined(WIN32CONSOLE) || defined(WIN32TILES)
+#elif defined(TARGET_OS_WINDOWS)
#if defined(WIN32CONSOLE)
#include "libw32c.h"
#endif
@@ -505,7 +516,7 @@ inline void UNUSED(const volatile T &)
}
// And now headers we want precompiled
-#include <externs.h>
+#include "externs.h"
#include "version.h"
#endif
diff --git a/crawl-ref/source/Crawl.xcodeproj/project.pbxproj b/crawl-ref/source/Crawl.xcodeproj/project.pbxproj
index 6b5b69956f..bbcc108353 100644
--- a/crawl-ref/source/Crawl.xcodeproj/project.pbxproj
+++ b/crawl-ref/source/Crawl.xcodeproj/project.pbxproj
@@ -366,6 +366,7 @@
B032D705106C029D0002D70D /* SDL_image.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = B0B5DF221066ED0E0020B21F /* SDL_image.framework */; };
B032D706106C029D0002D70D /* SDL.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = B0B5DF241066ED0E0020B21F /* SDL.framework */; };
B032D707106C029D0002D70D /* Freetype2.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = B0B5E17B106706E40020B21F /* Freetype2.framework */; };
+ B06FC50E1081D287008347BD /* bitary.cc in Sources */ = {isa = PBXBuildFile; fileRef = B06FC50C1081D287008347BD /* bitary.cc */; };
B07818DE1075D979008C3B64 /* sqldbm.cc in Sources */ = {isa = PBXBuildFile; fileRef = B07818DC1075D979008C3B64 /* sqldbm.cc */; };
B07818DF1075D979008C3B64 /* sqldbm.cc in Sources */ = {isa = PBXBuildFile; fileRef = B07818DC1075D979008C3B64 /* sqldbm.cc */; };
B082657810731AB5006EEC5A /* sqlite3.c in Sources */ = {isa = PBXBuildFile; fileRef = B082657610731AB5006EEC5A /* sqlite3.c */; };
@@ -386,6 +387,16 @@
D2AE25F90DA262DD00E15489 /* crawl in Copy Wrapper Script */ = {isa = PBXBuildFile; fileRef = D2AE25EE0DA2624E00E15489 /* crawl */; };
D2F272350DA1C5AD00445FE9 /* dat in Resources */ = {isa = PBXBuildFile; fileRef = D2F271FE0DA1C5AD00445FE9 /* dat */; };
D2F2725B0DA1C61600445FE9 /* docs in Resources */ = {isa = PBXBuildFile; fileRef = D2F2723F0DA1C61600445FE9 /* docs */; };
+ E1424F74107FAE1100E2A9CD /* ctest.cc in Sources */ = {isa = PBXBuildFile; fileRef = B0CFB313106DF67F005F9CC3 /* ctest.cc */; };
+ E1424F75107FAE4900E2A9CD /* los.cc in Sources */ = {isa = PBXBuildFile; fileRef = E14D930A107FA77200E3F5FE /* los.cc */; };
+ E1424F7E107FAEC700E2A9CD /* losparam.cc in Sources */ = {isa = PBXBuildFile; fileRef = E14D930B107FA77200E3F5FE /* losparam.cc */; };
+ E1424F7F107FAEC700E2A9CD /* mon-los.cc in Sources */ = {isa = PBXBuildFile; fileRef = E14D930C107FA77200E3F5FE /* mon-los.cc */; };
+ E1424F80107FAEC700E2A9CD /* ray.cc in Sources */ = {isa = PBXBuildFile; fileRef = E14D930D107FA77200E3F5FE /* ray.cc */; };
+ E14D930F107FA77200E3F5FE /* los.cc in Sources */ = {isa = PBXBuildFile; fileRef = E14D930A107FA77200E3F5FE /* los.cc */; };
+ E14D9310107FA77200E3F5FE /* losparam.cc in Sources */ = {isa = PBXBuildFile; fileRef = E14D930B107FA77200E3F5FE /* losparam.cc */; };
+ E14D9311107FA77200E3F5FE /* mon-los.cc in Sources */ = {isa = PBXBuildFile; fileRef = E14D930C107FA77200E3F5FE /* mon-los.cc */; };
+ E14D9312107FA77200E3F5FE /* ray.cc in Sources */ = {isa = PBXBuildFile; fileRef = E14D930D107FA77200E3F5FE /* ray.cc */; };
+ E14D9313107FA77200E3F5FE /* sha256.cc in Sources */ = {isa = PBXBuildFile; fileRef = E14D930E107FA77200E3F5FE /* sha256.cc */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -840,6 +851,18 @@
B02C576010670ED2006AC96D /* SDLMain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLMain.m; sourceTree = "<group>"; };
B02C57901067129A006AC96D /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
B032D527106C01AF0002D70D /* Dungeon Crawl Stone Soup.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Dungeon Crawl Stone Soup.app"; sourceTree = BUILT_PRODUCTS_DIR; };
+ B06FC50C1081D287008347BD /* bitary.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = bitary.cc; sourceTree = "<group>"; };
+ B06FC50D1081D287008347BD /* bitary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bitary.h; sourceTree = "<group>"; };
+ B06FC5101081D2C0008347BD /* arena.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = arena.h; sourceTree = "<group>"; };
+ B06FC5111081D2C0008347BD /* defines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = defines.h; sourceTree = "<group>"; };
+ B06FC5121081D2C0008347BD /* fixary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fixary.h; sourceTree = "<group>"; };
+ B06FC5131081D2C0008347BD /* fixvec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fixvec.h; sourceTree = "<group>"; };
+ B06FC5141081D2C0008347BD /* ghost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ghost.h; sourceTree = "<group>"; };
+ B06FC5151081D2C0008347BD /* los.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = los.h; sourceTree = "<group>"; };
+ B06FC5161081D2C0008347BD /* losparam.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = losparam.h; sourceTree = "<group>"; };
+ B06FC5171081D2C0008347BD /* sha256.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sha256.h; sourceTree = "<group>"; };
+ B06FC5181081D2C0008347BD /* spl-data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "spl-data.h"; sourceTree = "<group>"; };
+ B06FC5191081D2C0008347BD /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = "<group>"; };
B07818DC1075D979008C3B64 /* sqldbm.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sqldbm.cc; sourceTree = "<group>"; };
B07818DD1075D979008C3B64 /* sqldbm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sqldbm.h; sourceTree = "<group>"; };
B082656F10731A95006EEC5A /* libSQLite.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSQLite.a; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -908,6 +931,11 @@
D2F271F80DA1C58C00445FE9 /* Crawl-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Crawl-Info.plist"; sourceTree = "<group>"; };
D2F271FE0DA1C5AD00445FE9 /* dat */ = {isa = PBXFileReference; lastKnownFileType = folder; path = dat; sourceTree = "<group>"; };
D2F2723F0DA1C61600445FE9 /* docs */ = {isa = PBXFileReference; lastKnownFileType = folder; name = docs; path = ../docs; sourceTree = SOURCE_ROOT; };
+ E14D930A107FA77200E3F5FE /* los.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = los.cc; sourceTree = "<group>"; };
+ E14D930B107FA77200E3F5FE /* losparam.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = losparam.cc; sourceTree = "<group>"; };
+ E14D930C107FA77200E3F5FE /* mon-los.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = "mon-los.cc"; sourceTree = "<group>"; };
+ E14D930D107FA77200E3F5FE /* ray.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ray.cc; sourceTree = "<group>"; };
+ E14D930E107FA77200E3F5FE /* sha256.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sha256.cc; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -1069,19 +1097,20 @@
7B352EF00B001F5B00CABB32 /* Crawl */ = {
isa = PBXGroup;
children = (
- B07818DC1075D979008C3B64 /* sqldbm.cc */,
- B07818DD1075D979008C3B64 /* sqldbm.h */,
- B0826648107333BB006EEC5A /* AppHdr.h */,
7B237E0D0A8EC9D000580F30 /* abl-show.cc */,
7B237E290A8EC9D000580F30 /* abl-show.h */,
7B237E280A8EC9D000580F30 /* abyss.cc */,
7B237E650A8EC9D000580F30 /* abyss.h */,
+ 7B237E270A8EC9D000580F30 /* acr.cc */,
+ B0826648107333BB006EEC5A /* AppHdr.h */,
93B134C20F256113007DB230 /* arena.cc */,
+ B06FC5101081D2C0008347BD /* arena.h */,
D2A72B28101173C000E1A883 /* artefact.cc */,
D2A72B29101173C000E1A883 /* artefact.h */,
- 7B237E270A8EC9D000580F30 /* acr.cc */,
7B237E2C0A8EC9D000580F30 /* beam.cc */,
7B237E2D0A8EC9D000580F30 /* beam.h */,
+ B06FC50C1081D287008347BD /* bitary.cc */,
+ B06FC50D1081D287008347BD /* bitary.h */,
7BA3DBB90B3D90A700B5B3D7 /* branch.cc */,
7BA3DBBA0B3D90A700B5B3D7 /* branch.h */,
7B237E2A0A8EC9D000580F30 /* chardump.cc */,
@@ -1104,6 +1133,7 @@
7B237E1A0A8EC9D000580F30 /* debug.h */,
7B237E490A8EC9D000580F30 /* decks.cc */,
7B237E1C0A8EC9D000580F30 /* decks.h */,
+ B06FC5111081D2C0008347BD /* defines.h */,
7B237E660A8EC9D000580F30 /* delay.cc */,
7B237E430A8EC9D000580F30 /* delay.h */,
7B237E4A0A8EC9D000580F30 /* describe.cc */,
@@ -1120,11 +1150,14 @@
7B237E510A8EC9D000580F30 /* fight.h */,
7B237E0E0A8EC9D000580F30 /* files.cc */,
7B237E500A8EC9D000580F30 /* files.h */,
+ B06FC5121081D2C0008347BD /* fixary.h */,
+ B06FC5131081D2C0008347BD /* fixvec.h */,
7B237E540A8EC9D000580F30 /* food.cc */,
7B237E550A8EC9D000580F30 /* food.h */,
7BDEBB340BB4CB93008DF39F /* format.cc */,
7BDEBB350BB4CB93008DF39F /* format.h */,
7BDEBB2A0BB4CB1D008DF39F /* ghost.cc */,
+ B06FC5141081D2C0008347BD /* ghost.h */,
7B237DF30A8EC9D000580F30 /* hiscores.cc */,
7B237DF20A8EC9D000580F30 /* hiscores.h */,
7B237DF10A8EC9D000580F30 /* initfile.cc */,
@@ -1151,6 +1184,10 @@
7B237E630A8EC9D000580F30 /* libunix.h */,
7B237E620A8EC9D000580F30 /* libutil.cc */,
7B237E250A8EC9D000580F30 /* libutil.h */,
+ E14D930A107FA77200E3F5FE /* los.cc */,
+ B06FC5151081D2C0008347BD /* los.h */,
+ E14D930B107FA77200E3F5FE /* losparam.cc */,
+ B06FC5161081D2C0008347BD /* losparam.h */,
7BF8556E0C9C919100B7C520 /* luadgn.cc */,
7BF8556F0C9C919100B7C520 /* luadgn.h */,
7B237E380A8EC9D000580F30 /* macro.cc */,
@@ -1169,6 +1206,7 @@
7B4896610CD3A5D2004A5F43 /* mgrow.h */,
7B237DFC0A8EC9D000580F30 /* misc.cc */,
7B237DE90A8EC9D000580F30 /* misc.h */,
+ E14D930C107FA77200E3F5FE /* mon-los.cc */,
7B237DE80A8EC9D000580F30 /* mon-pick.cc */,
7B237DE70A8EC9D000580F30 /* mon-pick.h */,
7B237DFF0A8EC9D000580F30 /* mon-util.cc */,
@@ -1204,9 +1242,12 @@
7B237E0A0A8EC9D000580F30 /* player.h */,
6232EBE00DACA55C004F7E9C /* quiver.cc */,
6232EBE10DACA55C004F7E9C /* quiver.h */,
+ E14D930D107FA77200E3F5FE /* ray.cc */,
7B6164270C9CA8E80054B3D9 /* ray.h */,
7B237E3B0A8EC9D000580F30 /* religion.cc */,
7B237E3A0A8EC9D000580F30 /* religion.h */,
+ E14D930E107FA77200E3F5FE /* sha256.cc */,
+ B06FC5171081D2C0008347BD /* sha256.h */,
7B237E390A8EC9D000580F30 /* shopping.cc */,
7B237E5E0A8EC9D000580F30 /* shopping.h */,
7B237E5D0A8EC9D000580F30 /* skills.cc */,
@@ -1225,16 +1266,19 @@
7B237E300A8EC9D000580F30 /* spl-book.h */,
7B237E2F0A8EC9D000580F30 /* spl-cast.cc */,
7B237E2E0A8EC9D000580F30 /* spl-cast.h */,
+ B06FC5181081D2C0008347BD /* spl-data.h */,
D274AC580FE66EFC00C9C1AE /* spl-mis.cc */,
D274AC590FE66EFC00C9C1AE /* spl-mis.h */,
7B237E070A8EC9D000580F30 /* spl-util.cc */,
7B237E060A8EC9D000580F30 /* spl-util.h */,
+ B07818DC1075D979008C3B64 /* sqldbm.cc */,
+ B07818DD1075D979008C3B64 /* sqldbm.h */,
7B237E200A8EC9D000580F30 /* stash.cc */,
7B237E1F0A8EC9D000580F30 /* stash.h */,
7B54B51A0CA8217900612805 /* state.cc */,
7B6164280C9CA8E80054B3D9 /* state.h */,
- 7BD2221E0CC2D51300B475D8 /* store.h */,
7BD2221F0CC2D51300B475D8 /* store.cc */,
+ 7BD2221E0CC2D51300B475D8 /* store.h */,
7B237E1E0A8EC9D000580F30 /* stuff.cc */,
7B237E1D0A8EC9D000580F30 /* stuff.h */,
7B237E240A8EC9D000580F30 /* tags.cc */,
@@ -1247,9 +1291,10 @@
7B61642C0C9CA8E80054B3D9 /* traps.h */,
7B237DF50A8EC9D000580F30 /* travel.cc */,
7B237DF40A8EC9D000580F30 /* travel.h */,
- 93B134610F255926007DB230 /* version.cc */,
7BDEBB2F0BB4CB5C008DF39F /* tutorial.cc */,
7BDEBB300BB4CB5C008DF39F /* tutorial.h */,
+ 93B134610F255926007DB230 /* version.cc */,
+ B06FC5191081D2C0008347BD /* version.h */,
7B237E140A8EC9D000580F30 /* view.cc */,
7B237E130A8EC9D000580F30 /* view.h */,
4CEF15890C128CA5002C7D7A /* xom.cc */,
@@ -1308,10 +1353,10 @@
D25C91790FF035AF00D9E8AD /* Tiles */ = {
isa = PBXGroup;
children = (
- B02C575F10670ED2006AC96D /* SDLMain.h */,
- B02C576010670ED2006AC96D /* SDLMain.m */,
B02C574310670C63006AC96D /* libgui.cc */,
B02C574410670C63006AC96D /* libgui.h */,
+ B02C575F10670ED2006AC96D /* SDLMain.h */,
+ B02C576010670ED2006AC96D /* SDLMain.m */,
D2660E070FF0868B00986331 /* tile2.cc */,
D2660E080FF0868B00986331 /* tilebuf.cc */,
D2660E090FF0868B00986331 /* tilebuf.h */,
@@ -1334,7 +1379,9 @@
D25C917A0FF035D100D9E8AD /* rltiles */ = {
isa = PBXGroup;
children = (
- B0B5DFD21066FA240020B21F /* tiledef_defines.h */,
+ D2660C000FF0749200986331 /* dc-dngn.txt */,
+ D2660C010FF0749200986331 /* dc-main.txt */,
+ D2660C020FF0749200986331 /* dc-player.txt */,
B0B5DFD31066FA240020B21F /* tiledef-dngn.cc */,
B0B5DFD41066FA240020B21F /* tiledef-dngn.h */,
B0B5DFD51066FA240020B21F /* tiledef-gui.cc */,
@@ -1345,9 +1392,7 @@
B0B5DFDA1066FA240020B21F /* tiledef-player.h */,
B0B5DFDB1066FA240020B21F /* tiledef-unrand.cc */,
B0B5DFDC1066FA240020B21F /* tiledef-unrand.h */,
- D2660C000FF0749200986331 /* dc-dngn.txt */,
- D2660C010FF0749200986331 /* dc-main.txt */,
- D2660C020FF0749200986331 /* dc-player.txt */,
+ B0B5DFD21066FA240020B21F /* tiledef_defines.h */,
D25C91840FF0366F00D9E8AD /* tool */,
);
name = rltiles;
@@ -1642,101 +1687,107 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 7BBC4A080B0F783C00F27D45 /* levcomp.ypp in Sources */,
- 7BBC4A070B0F783C00F27D45 /* levcomp.lpp in Sources */,
- 7B237E6D0A8EC9D000580F30 /* maps.cc in Sources */,
- 93B134C30F256113007DB230 /* arena.cc in Sources */,
- 7B237E6F0A8EC9D000580F30 /* mon-pick.cc in Sources */,
- 7B237E750A8EC9D000580F30 /* overmap.cc in Sources */,
- 7B237E780A8EC9D000580F30 /* initfile.cc in Sources */,
- 7B237E7A0A8EC9D000580F30 /* hiscores.cc in Sources */,
- 7B237E7C0A8EC9D000580F30 /* travel.cc in Sources */,
- 7B237E7E0A8EC9D000580F30 /* lev-pand.cc in Sources */,
- 7B237E800A8EC9D000580F30 /* newgame.cc in Sources */,
- 7B237E820A8EC9D000580F30 /* mutation.cc in Sources */,
- 7B237E830A8EC9D000580F30 /* misc.cc in Sources */,
- 7B237E860A8EC9D000580F30 /* mon-util.cc in Sources */,
- 7B237E880A8EC9D000580F30 /* it_use3.cc in Sources */,
- 7B237E8A0A8EC9D000580F30 /* itemname.cc in Sources */,
- 7B237E8B0A8EC9D000580F30 /* command.cc in Sources */,
- 7B237E8E0A8EC9D000580F30 /* spl-util.cc in Sources */,
- 7B237E920A8EC9D000580F30 /* player.cc in Sources */,
7B237E940A8EC9D000580F30 /* abl-show.cc in Sources */,
- 7B237E950A8EC9D000580F30 /* files.cc in Sources */,
- 7B237E960A8EC9D000580F30 /* directn.cc in Sources */,
- 7B237E9B0A8EC9D000580F30 /* view.cc in Sources */,
- 7B237E9C0A8EC9D000580F30 /* spl-book.cc in Sources */,
- 7B237E9E0A8EC9D000580F30 /* spells4.cc in Sources */,
- 7B237EA50A8EC9D000580F30 /* stuff.cc in Sources */,
- 7B237EA70A8EC9D000580F30 /* stash.cc in Sources */,
- 7B237EA90A8EC9D000580F30 /* transfor.cc in Sources */,
- 7B237EAB0A8EC9D000580F30 /* tags.cc in Sources */,
- 7B237EAD0A8EC9D000580F30 /* item_use.cc in Sources */,
- 7B237EAE0A8EC9D000580F30 /* acr.cc in Sources */,
7B237EAF0A8EC9D000580F30 /* abyss.cc in Sources */,
- 7B237EB10A8EC9D000580F30 /* chardump.cc in Sources */,
+ 7B237EAE0A8EC9D000580F30 /* acr.cc in Sources */,
+ 93B134C30F256113007DB230 /* arena.cc in Sources */,
+ D2A72B2A101173C000E1A883 /* artefact.cc in Sources */,
7B237EB30A8EC9D000580F30 /* beam.cc in Sources */,
- 7B237EB60A8EC9D000580F30 /* spl-cast.cc in Sources */,
- 7B237EB80A8EC9D000580F30 /* output.cc in Sources */,
- 7B237EBA0A8EC9D000580F30 /* ouch.cc in Sources */,
- 7B237EBC0A8EC9D000580F30 /* message.cc in Sources */,
- 7B237EBE0A8EC9D000580F30 /* menu.cc in Sources */,
- 7B237EBF0A8EC9D000580F30 /* macro.cc in Sources */,
- 7B237EC00A8EC9D000580F30 /* shopping.cc in Sources */,
- 7B237EC20A8EC9D000580F30 /* religion.cc in Sources */,
- 7B237EC30A8EC9D000580F30 /* spells3.cc in Sources */,
- 7B237EC50A8EC9D000580F30 /* spells2.cc in Sources */,
- 7B237EC60A8EC9D000580F30 /* mstuff2.cc in Sources */,
- 7B237EC80A8EC9D000580F30 /* monstuff.cc in Sources */,
- 7B237ECD0A8EC9D000580F30 /* spells1.cc in Sources */,
- 7B237ECF0A8EC9D000580F30 /* skills2.cc in Sources */,
+ 7BA3DBBB0B3D90A700B5B3D7 /* branch.cc in Sources */,
+ 7B237EB10A8EC9D000580F30 /* chardump.cc in Sources */,
+ 7BF855620C9C912B00B7C520 /* cio.cc in Sources */,
+ 7B237EE00A8EC9D000580F30 /* cloud.cc in Sources */,
+ 7B237EDE0A8EC9D000580F30 /* clua.cc in Sources */,
+ 7B237E8B0A8EC9D000580F30 /* command.cc in Sources */,
+ D274AC550FE66EEC00C9C1AE /* crash-u.cc in Sources */,
+ E1424F74107FAE1100E2A9CD /* ctest.cc in Sources */,
+ 7B973FFD0BE3AA8400AAE35B /* database.cc in Sources */,
+ 7B237EEF0A8EC9D000580F30 /* debug.cc in Sources */,
7B237ED00A8EC9D000580F30 /* decks.cc in Sources */,
+ 7B237EED0A8EC9D000580F30 /* delay.cc in Sources */,
7B237ED10A8EC9D000580F30 /* describe.cc in Sources */,
- 7B237ED20A8EC9D000580F30 /* monspeak.cc in Sources */,
- 7B237ED40A8EC9D000580F30 /* monplace.cc in Sources */,
- 7B237ED60A8EC9D000580F30 /* kills.cc in Sources */,
+ 7BF8556B0C9C916800B7C520 /* dgnevent.cc in Sources */,
+ 7B237E960A8EC9D000580F30 /* directn.cc in Sources */,
+ 7B237EEE0A8EC9D000580F30 /* dungeon.cc in Sources */,
7B237ED90A8EC9D000580F30 /* effects.cc in Sources */,
7B237EDA0A8EC9D000580F30 /* fight.cc in Sources */,
+ 7B237E950A8EC9D000580F30 /* files.cc in Sources */,
7B237EDB0A8EC9D000580F30 /* food.cc in Sources */,
- 7B237EDE0A8EC9D000580F30 /* clua.cc in Sources */,
- 7B237EE00A8EC9D000580F30 /* cloud.cc in Sources */,
- 7B237EE10A8EC9D000580F30 /* items.cc in Sources */,
- 7B237EE40A8EC9D000580F30 /* skills.cc in Sources */,
- 7B237EE60A8EC9D000580F30 /* it_use2.cc in Sources */,
+ 7BDEBB360BB4CB93008DF39F /* format.cc in Sources */,
+ 7BDEBB2B0BB4CB1D008DF39F /* ghost.cc in Sources */,
+ 7B237E7A0A8EC9D000580F30 /* hiscores.cc in Sources */,
+ 7B237E780A8EC9D000580F30 /* initfile.cc in Sources */,
7B237EE80A8EC9D000580F30 /* invent.cc in Sources */,
- 7B237EE90A8EC9D000580F30 /* libutil.cc in Sources */,
- 7B237EEB0A8EC9D000580F30 /* libunix.cc in Sources */,
- 7B237EED0A8EC9D000580F30 /* delay.cc in Sources */,
- 7B237EEE0A8EC9D000580F30 /* dungeon.cc in Sources */,
- 7B237EEF0A8EC9D000580F30 /* debug.cc in Sources */,
- 7B237EF10A8EC9D000580F30 /* mt19937ar.cc in Sources */,
+ 7B237EE60A8EC9D000580F30 /* it_use2.cc in Sources */,
+ 7B237E880A8EC9D000580F30 /* it_use3.cc in Sources */,
+ 7B237EAD0A8EC9D000580F30 /* item_use.cc in Sources */,
+ 7B237E8A0A8EC9D000580F30 /* itemname.cc in Sources */,
7BC222E70ABBB286003A7D9A /* itemprop.cc in Sources */,
- 7BD75A350AC214A200B74F6E /* notes.cc in Sources */,
- 7B352EA00B00183400CABB32 /* mapdef.cc in Sources */,
- 7BA3DBBB0B3D90A700B5B3D7 /* branch.cc in Sources */,
- 7BDEBB290BB4CB0B008DF39F /* mtransit.cc in Sources */,
- 7BDEBB2B0BB4CB1D008DF39F /* ghost.cc in Sources */,
- 7BDEBB310BB4CB5C008DF39F /* tutorial.cc in Sources */,
- 7BDEBB360BB4CB93008DF39F /* format.cc in Sources */,
- 7B973FFD0BE3AA8400AAE35B /* database.cc in Sources */,
+ 7B237EE10A8EC9D000580F30 /* items.cc in Sources */,
+ 7B237ED60A8EC9D000580F30 /* kills.cc in Sources */,
+ 7B237E7E0A8EC9D000580F30 /* lev-pand.cc in Sources */,
+ 7BBC4A070B0F783C00F27D45 /* levcomp.lpp in Sources */,
+ 7BBC4A080B0F783C00F27D45 /* levcomp.ypp in Sources */,
+ 7B237EEB0A8EC9D000580F30 /* libunix.cc in Sources */,
+ 7B237EE90A8EC9D000580F30 /* libutil.cc in Sources */,
+ E14D930F107FA77200E3F5FE /* los.cc in Sources */,
+ E14D9310107FA77200E3F5FE /* losparam.cc in Sources */,
+ 7BF855700C9C919100B7C520 /* luadgn.cc in Sources */,
+ 7B237EBF0A8EC9D000580F30 /* macro.cc in Sources */,
7B9740070BE3AC8000AAE35B /* makeitem.cc in Sources */,
- 4CEF158A0C128CA5002C7D7A /* xom.cc in Sources */,
- 7BF855620C9C912B00B7C520 /* cio.cc in Sources */,
+ 7B352EA00B00183400CABB32 /* mapdef.cc in Sources */,
7BF855670C9C914D00B7C520 /* mapmark.cc in Sources */,
- 7BF8556B0C9C916800B7C520 /* dgnevent.cc in Sources */,
- 7BF855700C9C919100B7C520 /* luadgn.cc in Sources */,
- 7B61642E0C9CA8E80054B3D9 /* place.cc in Sources */,
- 7B6164320C9CA8E80054B3D9 /* terrain.cc in Sources */,
- 7B6164340C9CA8E80054B3D9 /* traps.cc in Sources */,
- 7B54B51B0CA8217900612805 /* state.cc in Sources */,
- 7BD222200CC2D51300B475D8 /* store.cc in Sources */,
+ 7B237E6D0A8EC9D000580F30 /* maps.cc in Sources */,
+ 7B237EBE0A8EC9D000580F30 /* menu.cc in Sources */,
+ 7B237EBC0A8EC9D000580F30 /* message.cc in Sources */,
7B4896620CD3A5D2004A5F43 /* mgrow.cc in Sources */,
+ 7B237E830A8EC9D000580F30 /* misc.cc in Sources */,
+ E14D9311107FA77200E3F5FE /* mon-los.cc in Sources */,
+ 7B237E6F0A8EC9D000580F30 /* mon-pick.cc in Sources */,
+ 7B237E860A8EC9D000580F30 /* mon-util.cc in Sources */,
+ 7B237ED40A8EC9D000580F30 /* monplace.cc in Sources */,
+ 7B237ED20A8EC9D000580F30 /* monspeak.cc in Sources */,
+ 7B237EC80A8EC9D000580F30 /* monstuff.cc in Sources */,
+ 7B237EC60A8EC9D000580F30 /* mstuff2.cc in Sources */,
+ 7B237EF10A8EC9D000580F30 /* mt19937ar.cc in Sources */,
+ 7BDEBB290BB4CB0B008DF39F /* mtransit.cc in Sources */,
+ 7B237E820A8EC9D000580F30 /* mutation.cc in Sources */,
+ 7B237E800A8EC9D000580F30 /* newgame.cc in Sources */,
+ 7BD75A350AC214A200B74F6E /* notes.cc in Sources */,
+ 7B237EBA0A8EC9D000580F30 /* ouch.cc in Sources */,
+ 7B237EB80A8EC9D000580F30 /* output.cc in Sources */,
+ 7B237E750A8EC9D000580F30 /* overmap.cc in Sources */,
+ 7B61642E0C9CA8E80054B3D9 /* place.cc in Sources */,
+ 7B237E920A8EC9D000580F30 /* player.cc in Sources */,
6232EBE20DACA55C004F7E9C /* quiver.cc in Sources */,
- 93B134650F25595F007DB230 /* version.cc in Sources */,
- D274AC550FE66EEC00C9C1AE /* crash-u.cc in Sources */,
+ E14D9312107FA77200E3F5FE /* ray.cc in Sources */,
+ 7B237EC20A8EC9D000580F30 /* religion.cc in Sources */,
+ E14D9313107FA77200E3F5FE /* sha256.cc in Sources */,
+ 7B237EC00A8EC9D000580F30 /* shopping.cc in Sources */,
+ 7B237EE40A8EC9D000580F30 /* skills.cc in Sources */,
+ 7B237ECF0A8EC9D000580F30 /* skills2.cc in Sources */,
+ 7B237ECD0A8EC9D000580F30 /* spells1.cc in Sources */,
+ 7B237EC50A8EC9D000580F30 /* spells2.cc in Sources */,
+ 7B237EC30A8EC9D000580F30 /* spells3.cc in Sources */,
+ 7B237E9E0A8EC9D000580F30 /* spells4.cc in Sources */,
+ 7B237E9C0A8EC9D000580F30 /* spl-book.cc in Sources */,
+ 7B237EB60A8EC9D000580F30 /* spl-cast.cc in Sources */,
D274AC5A0FE66EFC00C9C1AE /* spl-mis.cc in Sources */,
- D2A72B2A101173C000E1A883 /* artefact.cc in Sources */,
+ 7B237E8E0A8EC9D000580F30 /* spl-util.cc in Sources */,
B07818DF1075D979008C3B64 /* sqldbm.cc in Sources */,
+ 7B237EA70A8EC9D000580F30 /* stash.cc in Sources */,
+ 7B54B51B0CA8217900612805 /* state.cc in Sources */,
+ 7BD222200CC2D51300B475D8 /* store.cc in Sources */,
+ 7B237EA50A8EC9D000580F30 /* stuff.cc in Sources */,
+ 7B237EAB0A8EC9D000580F30 /* tags.cc in Sources */,
+ 7B6164320C9CA8E80054B3D9 /* terrain.cc in Sources */,
+ 7B237EA90A8EC9D000580F30 /* transfor.cc in Sources */,
+ 7B6164340C9CA8E80054B3D9 /* traps.cc in Sources */,
+ 7B237E7C0A8EC9D000580F30 /* travel.cc in Sources */,
+ 7BDEBB310BB4CB5C008DF39F /* tutorial.cc in Sources */,
+ 93B134650F25595F007DB230 /* version.cc in Sources */,
+ 7B237E9B0A8EC9D000580F30 /* view.cc in Sources */,
+ 4CEF158A0C128CA5002C7D7A /* xom.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1744,117 +1795,122 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- B032D68F106C02150002D70D /* levcomp.ypp in Sources */,
- B032D690106C02150002D70D /* levcomp.lpp in Sources */,
- B032D691106C02150002D70D /* SDLMain.m in Sources */,
- B032D692106C02150002D70D /* tiledef-dngn.cc in Sources */,
- B032D693106C02150002D70D /* tiledef-gui.cc in Sources */,
- B032D694106C02150002D70D /* tiledef-main.cc in Sources */,
- B032D695106C02150002D70D /* tiledef-player.cc in Sources */,
- B032D696106C02150002D70D /* tiledef-unrand.cc in Sources */,
- B032D697106C02150002D70D /* libgui.cc in Sources */,
- B032D698106C02150002D70D /* tilesdl.cc in Sources */,
- B032D699106C02150002D70D /* maps.cc in Sources */,
- B032D69A106C02150002D70D /* arena.cc in Sources */,
- B032D69B106C02150002D70D /* mon-pick.cc in Sources */,
- B032D69C106C02150002D70D /* overmap.cc in Sources */,
- B032D69D106C02150002D70D /* initfile.cc in Sources */,
- B032D69E106C02150002D70D /* hiscores.cc in Sources */,
- B032D69F106C02150002D70D /* travel.cc in Sources */,
- B032D6A0106C02150002D70D /* lev-pand.cc in Sources */,
- B032D6A1106C02150002D70D /* newgame.cc in Sources */,
- B032D6A2106C02150002D70D /* mutation.cc in Sources */,
- B032D6A3106C02150002D70D /* misc.cc in Sources */,
- B032D6A4106C02150002D70D /* mon-util.cc in Sources */,
- B032D6A5106C02150002D70D /* it_use3.cc in Sources */,
- B032D6A6106C02150002D70D /* itemname.cc in Sources */,
- B032D6A7106C02150002D70D /* command.cc in Sources */,
- B032D6A8106C02150002D70D /* spl-util.cc in Sources */,
- B032D6A9106C02150002D70D /* player.cc in Sources */,
B032D6AA106C02150002D70D /* abl-show.cc in Sources */,
- B032D6AB106C02150002D70D /* files.cc in Sources */,
- B032D6AC106C02150002D70D /* directn.cc in Sources */,
- B032D6AD106C02150002D70D /* view.cc in Sources */,
- B032D6AE106C02150002D70D /* spl-book.cc in Sources */,
- B032D6AF106C02150002D70D /* spells4.cc in Sources */,
- B032D6B0106C02150002D70D /* stuff.cc in Sources */,
- B032D6B1106C02150002D70D /* stash.cc in Sources */,
- B032D6B2106C02150002D70D /* transfor.cc in Sources */,
- B032D6B3106C02150002D70D /* tags.cc in Sources */,
- B032D6B4106C02150002D70D /* item_use.cc in Sources */,
- B032D6B5106C02150002D70D /* acr.cc in Sources */,
B032D6B6106C02150002D70D /* abyss.cc in Sources */,
- B032D6B7106C02150002D70D /* chardump.cc in Sources */,
+ B032D6B5106C02150002D70D /* acr.cc in Sources */,
+ B032D69A106C02150002D70D /* arena.cc in Sources */,
+ B032D6FA106C02150002D70D /* artefact.cc in Sources */,
B032D6B8106C02150002D70D /* beam.cc in Sources */,
- B032D6B9106C02150002D70D /* spl-cast.cc in Sources */,
- B032D6BA106C02150002D70D /* output.cc in Sources */,
- B032D6BB106C02150002D70D /* ouch.cc in Sources */,
- B032D6BC106C02150002D70D /* message.cc in Sources */,
- B032D6BD106C02150002D70D /* menu.cc in Sources */,
- B032D6BE106C02150002D70D /* macro.cc in Sources */,
- B032D6BF106C02150002D70D /* shopping.cc in Sources */,
- B032D6C0106C02150002D70D /* religion.cc in Sources */,
- B032D6C1106C02150002D70D /* spells3.cc in Sources */,
- B032D6C2106C02150002D70D /* spells2.cc in Sources */,
- B032D6C3106C02150002D70D /* mstuff2.cc in Sources */,
- B032D6C4106C02150002D70D /* monstuff.cc in Sources */,
- B032D6C5106C02150002D70D /* spells1.cc in Sources */,
- B032D6C6106C02150002D70D /* skills2.cc in Sources */,
+ B06FC50E1081D287008347BD /* bitary.cc in Sources */,
+ B032D6DD106C02150002D70D /* branch.cc in Sources */,
+ B032D6B7106C02150002D70D /* chardump.cc in Sources */,
+ B032D6E5106C02150002D70D /* cio.cc in Sources */,
+ B032D6D0106C02150002D70D /* cloud.cc in Sources */,
+ B032D6CF106C02150002D70D /* clua.cc in Sources */,
+ B032D6A7106C02150002D70D /* command.cc in Sources */,
+ B032D6F1106C02150002D70D /* crash-u.cc in Sources */,
+ B0CFB315106DF67F005F9CC3 /* ctest.cc in Sources */,
+ B032D6E2106C02150002D70D /* database.cc in Sources */,
+ B032D6D8106C02150002D70D /* debug.cc in Sources */,
B032D6C7106C02150002D70D /* decks.cc in Sources */,
+ B032D6D6106C02150002D70D /* delay.cc in Sources */,
B032D6C8106C02150002D70D /* describe.cc in Sources */,
- B032D6C9106C02150002D70D /* monspeak.cc in Sources */,
- B032D6CA106C02150002D70D /* monplace.cc in Sources */,
- B032D6CB106C02150002D70D /* kills.cc in Sources */,
+ B032D6E7106C02150002D70D /* dgnevent.cc in Sources */,
+ B032D6AC106C02150002D70D /* directn.cc in Sources */,
+ B032D6D7106C02150002D70D /* dungeon.cc in Sources */,
B032D6CC106C02150002D70D /* effects.cc in Sources */,
B032D6CD106C02150002D70D /* fight.cc in Sources */,
+ B032D6AB106C02150002D70D /* files.cc in Sources */,
B032D6CE106C02150002D70D /* food.cc in Sources */,
- B032D6CF106C02150002D70D /* clua.cc in Sources */,
- B032D6D0106C02150002D70D /* cloud.cc in Sources */,
- B032D6D1106C02150002D70D /* items.cc in Sources */,
- B032D6D2106C02150002D70D /* skills.cc in Sources */,
- B032D6D3106C02150002D70D /* it_use2.cc in Sources */,
+ B032D6E1106C02150002D70D /* format.cc in Sources */,
+ B032D6DF106C02150002D70D /* ghost.cc in Sources */,
+ B032D69E106C02150002D70D /* hiscores.cc in Sources */,
+ B032D69D106C02150002D70D /* initfile.cc in Sources */,
B032D6D4106C02150002D70D /* invent.cc in Sources */,
- B032D6D5106C02150002D70D /* libutil.cc in Sources */,
- B032D6D6106C02150002D70D /* delay.cc in Sources */,
- B032D6D7106C02150002D70D /* dungeon.cc in Sources */,
- B032D6D8106C02150002D70D /* debug.cc in Sources */,
- B032D6D9106C02150002D70D /* mt19937ar.cc in Sources */,
+ B032D6D3106C02150002D70D /* it_use2.cc in Sources */,
+ B032D6A5106C02150002D70D /* it_use3.cc in Sources */,
+ B032D6B4106C02150002D70D /* item_use.cc in Sources */,
+ B032D6A6106C02150002D70D /* itemname.cc in Sources */,
B032D6DA106C02150002D70D /* itemprop.cc in Sources */,
- B032D6DB106C02150002D70D /* notes.cc in Sources */,
- B032D6DC106C02150002D70D /* mapdef.cc in Sources */,
- B032D6DD106C02150002D70D /* branch.cc in Sources */,
- B032D6DE106C02150002D70D /* mtransit.cc in Sources */,
- B032D6DF106C02150002D70D /* ghost.cc in Sources */,
- B032D6E0106C02150002D70D /* tutorial.cc in Sources */,
- B032D6E1106C02150002D70D /* format.cc in Sources */,
- B032D6E2106C02150002D70D /* database.cc in Sources */,
+ B032D6D1106C02150002D70D /* items.cc in Sources */,
+ B032D6CB106C02150002D70D /* kills.cc in Sources */,
+ B032D6A0106C02150002D70D /* lev-pand.cc in Sources */,
+ B032D690106C02150002D70D /* levcomp.lpp in Sources */,
+ B032D68F106C02150002D70D /* levcomp.ypp in Sources */,
+ B032D697106C02150002D70D /* libgui.cc in Sources */,
+ B032D6D5106C02150002D70D /* libutil.cc in Sources */,
+ E1424F75107FAE4900E2A9CD /* los.cc in Sources */,
+ E1424F7E107FAEC700E2A9CD /* losparam.cc in Sources */,
+ B032D6E8106C02150002D70D /* luadgn.cc in Sources */,
+ B032D6BE106C02150002D70D /* macro.cc in Sources */,
B032D6E3106C02150002D70D /* makeitem.cc in Sources */,
- B032D6E4106C02150002D70D /* xom.cc in Sources */,
- B032D6E5106C02150002D70D /* cio.cc in Sources */,
+ B032D6DC106C02150002D70D /* mapdef.cc in Sources */,
B032D6E6106C02150002D70D /* mapmark.cc in Sources */,
- B032D6E7106C02150002D70D /* dgnevent.cc in Sources */,
- B032D6E8106C02150002D70D /* luadgn.cc in Sources */,
- B032D6E9106C02150002D70D /* place.cc in Sources */,
- B032D6EA106C02150002D70D /* terrain.cc in Sources */,
- B032D6EB106C02150002D70D /* traps.cc in Sources */,
- B032D6EC106C02150002D70D /* state.cc in Sources */,
- B032D6ED106C02150002D70D /* store.cc in Sources */,
+ B032D699106C02150002D70D /* maps.cc in Sources */,
+ B032D6BD106C02150002D70D /* menu.cc in Sources */,
+ B032D6BC106C02150002D70D /* message.cc in Sources */,
B032D6EE106C02150002D70D /* mgrow.cc in Sources */,
+ B032D6A3106C02150002D70D /* misc.cc in Sources */,
+ E1424F7F107FAEC700E2A9CD /* mon-los.cc in Sources */,
+ B032D69B106C02150002D70D /* mon-pick.cc in Sources */,
+ B032D6A4106C02150002D70D /* mon-util.cc in Sources */,
+ B032D6CA106C02150002D70D /* monplace.cc in Sources */,
+ B032D6C9106C02150002D70D /* monspeak.cc in Sources */,
+ B032D6C4106C02150002D70D /* monstuff.cc in Sources */,
+ B032D6C3106C02150002D70D /* mstuff2.cc in Sources */,
+ B032D6D9106C02150002D70D /* mt19937ar.cc in Sources */,
+ B032D6DE106C02150002D70D /* mtransit.cc in Sources */,
+ B032D6A2106C02150002D70D /* mutation.cc in Sources */,
+ B032D6A1106C02150002D70D /* newgame.cc in Sources */,
+ B032D6DB106C02150002D70D /* notes.cc in Sources */,
+ B032D6BB106C02150002D70D /* ouch.cc in Sources */,
+ B032D6BA106C02150002D70D /* output.cc in Sources */,
+ B032D69C106C02150002D70D /* overmap.cc in Sources */,
+ B032D6E9106C02150002D70D /* place.cc in Sources */,
+ B032D6A9106C02150002D70D /* player.cc in Sources */,
B032D6EF106C02150002D70D /* quiver.cc in Sources */,
- B032D6F0106C02150002D70D /* version.cc in Sources */,
- B032D6F1106C02150002D70D /* crash-u.cc in Sources */,
+ E1424F80107FAEC700E2A9CD /* ray.cc in Sources */,
+ B032D6C0106C02150002D70D /* religion.cc in Sources */,
+ B032D691106C02150002D70D /* SDLMain.m in Sources */,
+ B032D6BF106C02150002D70D /* shopping.cc in Sources */,
+ B032D6D2106C02150002D70D /* skills.cc in Sources */,
+ B032D6C6106C02150002D70D /* skills2.cc in Sources */,
+ B032D6C5106C02150002D70D /* spells1.cc in Sources */,
+ B032D6C2106C02150002D70D /* spells2.cc in Sources */,
+ B032D6C1106C02150002D70D /* spells3.cc in Sources */,
+ B032D6AF106C02150002D70D /* spells4.cc in Sources */,
+ B032D6AE106C02150002D70D /* spl-book.cc in Sources */,
+ B032D6B9106C02150002D70D /* spl-cast.cc in Sources */,
B032D6F2106C02150002D70D /* spl-mis.cc in Sources */,
+ B032D6A8106C02150002D70D /* spl-util.cc in Sources */,
+ B07818DE1075D979008C3B64 /* sqldbm.cc in Sources */,
+ B082657810731AB5006EEC5A /* sqlite3.c in Sources */,
+ B032D6B1106C02150002D70D /* stash.cc in Sources */,
+ B032D6EC106C02150002D70D /* state.cc in Sources */,
+ B032D6ED106C02150002D70D /* store.cc in Sources */,
+ B032D6B0106C02150002D70D /* stuff.cc in Sources */,
+ B032D6B3106C02150002D70D /* tags.cc in Sources */,
+ B032D6EA106C02150002D70D /* terrain.cc in Sources */,
B032D6F3106C02150002D70D /* tile2.cc in Sources */,
B032D6F4106C02150002D70D /* tilebuf.cc in Sources */,
+ B032D692106C02150002D70D /* tiledef-dngn.cc in Sources */,
+ B032D693106C02150002D70D /* tiledef-gui.cc in Sources */,
+ B032D694106C02150002D70D /* tiledef-main.cc in Sources */,
+ B032D695106C02150002D70D /* tiledef-player.cc in Sources */,
+ B032D696106C02150002D70D /* tiledef-unrand.cc in Sources */,
B032D6F5106C02150002D70D /* tilefont.cc in Sources */,
B032D6F6106C02150002D70D /* tilemcache.cc in Sources */,
B032D6F7106C02150002D70D /* tilepick.cc in Sources */,
B032D6F8106C02150002D70D /* tilereg.cc in Sources */,
+ B032D698106C02150002D70D /* tilesdl.cc in Sources */,
B032D6F9106C02150002D70D /* tiletex.cc in Sources */,
- B032D6FA106C02150002D70D /* artefact.cc in Sources */,
- B0CFB315106DF67F005F9CC3 /* ctest.cc in Sources */,
- B082657810731AB5006EEC5A /* sqlite3.c in Sources */,
- B07818DE1075D979008C3B64 /* sqldbm.cc in Sources */,
+ B032D6B2106C02150002D70D /* transfor.cc in Sources */,
+ B032D6EB106C02150002D70D /* traps.cc in Sources */,
+ B032D69F106C02150002D70D /* travel.cc in Sources */,
+ B032D6E0106C02150002D70D /* tutorial.cc in Sources */,
+ B032D6F0106C02150002D70D /* version.cc in Sources */,
+ B032D6AD106C02150002D70D /* view.cc in Sources */,
+ B032D6E4106C02150002D70D /* xom.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1913,7 +1969,6 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "$(PROJECT_DIR)/AppHdr.h";
GCC_PREPROCESSOR_DEFINITIONS = (
- OSX,
CLUA_BINDINGS,
DB_NDBM,
);
@@ -1931,10 +1986,10 @@
1DEB928A08733DD80010E9CD /* Development */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ ARCHS = "$(NATIVE_ARCH_ACTUAL)";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 2;
GCC_PREPROCESSOR_DEFINITIONS = (
- OSX,
DEBUG,
FULLDEBUG,
DEBUG_ITEM_SCAN,
@@ -1963,12 +2018,12 @@
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
MACOSX_DEPLOYMENT_TARGET_ppc = 10.4;
- MACOSX_DEPLOYMENT_TARGET_x86_64 = 10.5;
+ MACOSX_DEPLOYMENT_TARGET_x86_64 = 10.6;
PREBINDING = NO;
- SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
+ SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk;
SDKROOT_ppc = /Developer/SDKs/MacOSX10.4u.sdk;
- SDKROOT_x86_64 = /Developer/SDKs/MacOSX10.5.sdk;
+ SDKROOT_x86_64 = /Developer/SDKs/MacOSX10.6.sdk;
WARNING_CFLAGS = "";
};
name = Development;
@@ -2039,7 +2094,6 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "$(PROJECT_DIR)/AppHdr.h";
GCC_PREPROCESSOR_DEFINITIONS = (
- OSX,
CLUA_BINDINGS,
DB_NDBM,
WIZARD,
@@ -2061,10 +2115,10 @@
7B97C0200A8ECFD700CE8936 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ ARCHS = "$(NATIVE_ARCH_ACTUAL)";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
- OSX,
DEBUG,
FULLDEBUG,
DEBUG_ITEM_SCAN,
@@ -2093,12 +2147,12 @@
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
MACOSX_DEPLOYMENT_TARGET_ppc = 10.4;
- MACOSX_DEPLOYMENT_TARGET_x86_64 = 10.5;
+ MACOSX_DEPLOYMENT_TARGET_x86_64 = 10.6;
PREBINDING = NO;
- SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
+ SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk;
SDKROOT_ppc = /Developer/SDKs/MacOSX10.4u.sdk;
- SDKROOT_x86_64 = /Developer/SDKs/MacOSX10.5.sdk;
+ SDKROOT_x86_64 = /Developer/SDKs/MacOSX10.6.sdk;
WARNING_CFLAGS = "";
};
name = Debug;
@@ -2112,7 +2166,6 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "$(PROJECT_DIR)/AppHdr.h";
GCC_PREPROCESSOR_DEFINITIONS = (
- OSX,
CLUA_BINDINGS,
DB_NDBM,
WIZARD,
@@ -2131,9 +2184,9 @@
7B97C0250A8ED2AB00CE8936 /* Wizard */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ ARCHS = "$(NATIVE_ARCH_ACTUAL)";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_PREPROCESSOR_DEFINITIONS = (
- OSX,
WIZARD,
DEBUG,
DEBUG_ITEM_SCAN,
@@ -2161,12 +2214,12 @@
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
MACOSX_DEPLOYMENT_TARGET_ppc = 10.4;
- MACOSX_DEPLOYMENT_TARGET_x86_64 = 10.5;
+ MACOSX_DEPLOYMENT_TARGET_x86_64 = 10.6;
PREBINDING = NO;
- SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
+ SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk;
SDKROOT_ppc = /Developer/SDKs/MacOSX10.4u.sdk;
- SDKROOT_x86_64 = /Developer/SDKs/MacOSX10.5.sdk;
+ SDKROOT_x86_64 = /Developer/SDKs/MacOSX10.6.sdk;
WARNING_CFLAGS = "";
};
name = Wizard;
@@ -2180,7 +2233,6 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "$(PROJECT_DIR)/AppHdr.h";
GCC_PREPROCESSOR_DEFINITIONS = (
- OSX,
CLUA_BINDINGS,
DB_NDBM,
);
@@ -2196,8 +2248,8 @@
7B97C0270A8ED34400CE8936 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1)";
- ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1 = "ppc i386";
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)";
+ ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 2;
GCC_PREPROCESSOR_DEFINITIONS = OSX;
@@ -2224,12 +2276,12 @@
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
MACOSX_DEPLOYMENT_TARGET_ppc = 10.4;
- MACOSX_DEPLOYMENT_TARGET_x86_64 = 10.5;
+ MACOSX_DEPLOYMENT_TARGET_x86_64 = 10.6;
PREBINDING = NO;
- SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
+ SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
SDKROOT_i386 = /Developer/SDKs/MacOSX10.4u.sdk;
SDKROOT_ppc = /Developer/SDKs/MacOSX10.4u.sdk;
- SDKROOT_x86_64 = /Developer/SDKs/MacOSX10.5.sdk;
+ SDKROOT_x86_64 = /Developer/SDKs/MacOSX10.6.sdk;
WARNING_CFLAGS = "";
};
name = Release;
@@ -2360,7 +2412,6 @@
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
- GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
SQLITE_OMIT_AUTHORIZATION,
@@ -2389,6 +2440,7 @@
);
PREBINDING = NO;
PRODUCT_NAME = SQLite;
+ WARNING_CFLAGS = "-w";
};
name = Development;
};
@@ -2428,6 +2480,7 @@
);
PREBINDING = NO;
PRODUCT_NAME = SQLite;
+ WARNING_CFLAGS = "-w";
ZERO_LINK = NO;
};
name = Release;
@@ -2440,7 +2493,6 @@
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
- GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
SQLITE_OMIT_AUTHORIZATION,
@@ -2469,6 +2521,7 @@
);
PREBINDING = NO;
PRODUCT_NAME = SQLite;
+ WARNING_CFLAGS = "-w";
};
name = Debug;
};
@@ -2506,6 +2559,7 @@
);
PREBINDING = NO;
PRODUCT_NAME = SQLite;
+ WARNING_CFLAGS = "-w";
};
name = Wizard;
};
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index 822ac0bb4f..005e83db52 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -15,7 +15,7 @@ REVISION("$Rev$");
#include <stdio.h>
#include <ctype.h>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
@@ -45,7 +45,6 @@ REVISION("$Rev$");
#include "player.h"
#include "religion.h"
#include "skills.h"
-#include "skills2.h"
#include "spl-cast.h"
#include "spl-util.h"
#include "spells1.h"
@@ -106,8 +105,8 @@ ability_type god_abilities[MAX_NUM_GODS][MAX_GOD_ABILITIES] =
{ ABIL_NON_ABILITY, ABIL_TSO_DIVINE_SHIELD, ABIL_NON_ABILITY,
ABIL_TSO_CLEANSING_FLAME, ABIL_TSO_SUMMON_DIVINE_WARRIOR },
// Kikubaaqudgha
- { ABIL_KIKU_RECEIVE_CORPSE, ABIL_NON_ABILITY,
- ABIL_NON_ABILITY, ABIL_NON_ABILITY, ABIL_NON_ABILITY },
+ { ABIL_KIKU_RECEIVE_CORPSES, ABIL_NON_ABILITY, ABIL_NON_ABILITY,
+ ABIL_NON_ABILITY, ABIL_NON_ABILITY },
// Yredelemnul
{ ABIL_YRED_ANIMATE_REMAINS, ABIL_YRED_RECALL_UNDEAD_SLAVES,
ABIL_YRED_ANIMATE_DEAD, ABIL_YRED_DRAIN_LIFE, ABIL_YRED_ENSLAVE_SOUL },
@@ -241,7 +240,7 @@ static const ability_def Ability_List[] =
8, 0, 150, 4, ABFLAG_NONE },
// Kikubaaqudgha
- { ABIL_KIKU_RECEIVE_CORPSE, "Recieve Corpses", 5, 0, 1000, 2, ABFLAG_NONE },
+ { ABIL_KIKU_RECEIVE_CORPSES, "Receive Corpses", 5, 0, 1000, 2, ABFLAG_NONE },
// Yredelemnul
{ ABIL_YRED_INJURY_MIRROR, "Injury Mirror", 0, 0, 0, 0, ABFLAG_PIETY },
@@ -729,7 +728,7 @@ static talent _get_talent(ability_type ability, bool check_confused)
case ABIL_BEOGH_SMITING:
case ABIL_MAKHLEB_MINOR_DESTRUCTION:
case ABIL_SIF_MUNA_FORGET_SPELL:
- case ABIL_KIKU_RECEIVE_CORPSE:
+ case ABIL_KIKU_RECEIVE_CORPSES:
case ABIL_YRED_ANIMATE_DEAD:
case ABIL_MAKHLEB_LESSER_SERVANT_OF_MAKHLEB:
case ABIL_ELYVILON_GREATER_HEALING_SELF:
@@ -1627,7 +1626,7 @@ static bool _do_ability(const ability_def& abil)
exercise(SK_INVOCATIONS, 8 + random2(10));
break;
- case ABIL_KIKU_RECEIVE_CORPSE:
+ case ABIL_KIKU_RECEIVE_CORPSES:
receive_corpses(you.skills[SK_INVOCATIONS] * 4, you.pos());
exercise(SK_INVOCATIONS, (coinflip() ? 3 : 2));
break;
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 4eb680190f..988da0c579 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -29,7 +29,7 @@ REVISION("$Rev$");
#include <sstream>
#include <iostream>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <dos.h>
#include <conio.h>
#include <file.h>
@@ -67,7 +67,6 @@ REVISION("$Rev$");
#include "initfile.h"
#include "invent.h"
#include "item_use.h"
-#include "it_use2.h"
#include "it_use3.h"
#include "itemname.h"
#include "itemprop.h"
@@ -465,7 +464,7 @@ static void _do_wizard_command(int wiz_command, bool silent_fail)
case CONTROL('G'): save_ghost(true); break;
case CONTROL('H'): wizard_set_hunger_state(); break;
case CONTROL('I'): debug_item_statistics(); break;
- case CONTROL('X'): wizard_set_xl(); break;
+ case CONTROL('L'): wizard_set_xl(); break;
case 'O': debug_test_explore(); break;
case 'S': wizard_set_skill_level(); break;
diff --git a/crawl-ref/source/arena.cc b/crawl-ref/source/arena.cc
index d5cfe0e218..f022265b73 100644
--- a/crawl-ref/source/arena.cc
+++ b/crawl-ref/source/arena.cc
@@ -9,7 +9,6 @@ REVISION("$Rev$");
#include "externs.h"
#include "arena.h"
#include "artefact.h"
-#include "chardump.h"
#include "cio.h"
#include "command.h"
#include "dungeon.h"
@@ -25,8 +24,6 @@ REVISION("$Rev$");
#include "monstuff.h"
#include "monplace.h"
#include "mstuff2.h"
-#include "output.h"
-#include "skills2.h"
#include "spl-mis.h"
#include "spl-util.h"
#include "state.h"
diff --git a/crawl-ref/source/arena.h b/crawl-ref/source/arena.h
index 76b7ea900c..039e2bca3c 100644
--- a/crawl-ref/source/arena.h
+++ b/crawl-ref/source/arena.h
@@ -6,7 +6,6 @@
#ifndef ARENA_H
#define ARENA_H
-#include "AppHdr.h"
#include "enum.h"
class level_id;
diff --git a/crawl-ref/source/artefact.cc b/crawl-ref/source/artefact.cc
index fc35e4d7a4..b612ae9226 100644
--- a/crawl-ref/source/artefact.cc
+++ b/crawl-ref/source/artefact.cc
@@ -1226,7 +1226,8 @@ static bool _init_artefact_book(item_def &book)
book.plus2 = plus2;
if (book.sub_type == BOOK_RANDART_LEVEL)
- book_good = make_book_level_randart(book);
+ // The parameters to this call are encoded in book.plus and plus2
+ book_good = make_book_level_randart(book, book.plus, book.plus2);
else
book_good = make_book_theme_randart(book);
@@ -1676,9 +1677,7 @@ int find_okay_unrandart(unsigned char aclass, unsigned char atype,
unrand_special_type get_unrand_specialness(int unrand_index)
{
if (unrand_index < UNRAND_START || unrand_index > UNRAND_LAST)
- {
return (UNRANDSPEC_NORMAL);
- }
if (unranddata[unrand_index].flags & UNRAND_FLAG_SPECIAL)
return (UNRANDSPEC_SPECIAL);
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 3fb98b446c..d323bb995a 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -18,7 +18,7 @@ REVISION("$Rev$");
#include <algorithm>
#include <cmath>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <dos.h>
#include <conio.h>
#endif
@@ -57,7 +57,6 @@ REVISION("$Rev$");
#include "terrain.h"
#include "transfor.h"
#include "traps.h"
-#include "tutorial.h"
#include "view.h"
#include "xom.h"
@@ -2836,9 +2835,15 @@ void fire_tracer(const monsters *monster, bolt &pbolt, bool explode_only)
pbolt.is_tracer = false;
}
-bool check_line_of_sight( const coord_def& source, const coord_def& target )
+/**
+ * Checks whether target is in sight of source.
+ *
+ * Only used from cast_chain_lightning currently.
+ * XXX: Move to los.cc; integrate with other LOS code.
+ */
+bool check_line_of_sight(const coord_def& source, const coord_def& target)
{
- const int dist = grid_distance( source, target );
+ const int dist = grid_distance(source, target);
// Can always see one square away.
if (dist <= 1)
@@ -2851,7 +2856,7 @@ bool check_line_of_sight( const coord_def& source, const coord_def& target )
// Note that we are guaranteed to be within the player LOS range,
// so fallback is unnecessary.
ray_def ray;
- return find_ray( source, target, false, ray );
+ return find_ray(source, target, false, ray);
}
// When a mimic is hit by a ranged attack, it teleports away (the slow
@@ -3225,6 +3230,7 @@ void bolt::affect_place_explosion_clouds()
case BEAM_POTION_GREY_SMOKE:
case BEAM_POTION_BLUE_SMOKE:
case BEAM_POTION_PURP_SMOKE:
+ case BEAM_POTION_RAIN:
case BEAM_POTION_MUTAGENIC:
cl_type = beam2cloud(flavour);
break;
@@ -6034,6 +6040,7 @@ std::string beam_type_name(beam_type type)
case BEAM_POTION_GREY_SMOKE: return ("grey smoke");
case BEAM_POTION_BLUE_SMOKE: return ("blue smoke");
case BEAM_POTION_PURP_SMOKE: return ("purple smoke");
+ case BEAM_POTION_RAIN: return ("rain");
case BEAM_POTION_RANDOM: return ("random potion");
case BEAM_POTION_MUTAGENIC: return ("mutagenic fog");
case BEAM_VISUAL: return ("visual effects");
diff --git a/crawl-ref/source/bitary.cc b/crawl-ref/source/bitary.cc
new file mode 100644
index 0000000000..d822dcd327
--- /dev/null
+++ b/crawl-ref/source/bitary.cc
@@ -0,0 +1,76 @@
+/*
+ * File: bitary.cc
+ * Summary: Bit array data type.
+ * Created by: Robert Vollmert
+ */
+
+#include "AppHdr.h"
+
+#include "bitary.h"
+
+#include "debug.h"
+
+#define LONGSIZE (sizeof(unsigned long)*8)
+
+bit_array::bit_array(unsigned long s)
+ : size(s)
+{
+ nwords = (int) ((size + LONGSIZE - 1) / LONGSIZE);
+ data = new unsigned long[nwords];
+ reset();
+}
+
+bit_array::~bit_array()
+{
+ delete[] data;
+}
+
+void bit_array::reset()
+{
+ for (int w = 0; w < nwords; ++w)
+ data[w] = 0;
+}
+
+bool bit_array::get(unsigned long index) const
+{
+ ASSERT(index < size);
+ int w = index / LONGSIZE;
+ int b = index % LONGSIZE;
+ return (data[w] & (1UL << b));
+}
+
+void bit_array::set(unsigned long index, bool value)
+{
+ ASSERT(index < size);
+ int w = index / LONGSIZE;
+ int b = index % LONGSIZE;
+ if (value)
+ data[w] |= (1UL << b);
+ else
+ data[w] &= ~(1UL << b);
+}
+
+bit_array& bit_array::operator |= (const bit_array& other)
+{
+ ASSERT(size == other.size);
+ for (int w = 0; w < nwords; ++w)
+ data[w] |= other.data[w];
+ return (*this);
+}
+
+bit_array& bit_array::operator &= (const bit_array& other)
+{
+ ASSERT(size == other.size);
+ for (int w = 0; w < nwords; ++w)
+ data[w] &= other.data[w];
+ return (*this);
+}
+
+bit_array bit_array::operator & (const bit_array& other) const
+{
+ ASSERT(size == other.size);
+ bit_array res = bit_array(size);
+ for (int w = 0; w < nwords; ++w)
+ res.data[w] = data[w] & other.data[w];
+ return (res);
+}
diff --git a/crawl-ref/source/bitary.h b/crawl-ref/source/bitary.h
new file mode 100644
index 0000000000..110a9e846c
--- /dev/null
+++ b/crawl-ref/source/bitary.h
@@ -0,0 +1,35 @@
+/*
+ * File: bitary.h
+ * Summary: Bit array data type.
+ * Created by: Robert Vollmert
+ *
+ * Just contains the operations required by los.cc
+ * for the moment.
+ */
+
+#ifndef BITARY_H
+#define BITARY_H
+
+struct bit_array
+{
+public:
+ bit_array(unsigned long size = 0);
+ ~bit_array();
+
+ void reset();
+
+ bool get(unsigned long index) const;
+ void set(unsigned long index, bool value = true);
+
+ bit_array& operator |= (const bit_array& other);
+ bit_array& operator &= (const bit_array& other);
+ bit_array operator & (const bit_array& other) const;
+
+protected:
+ unsigned long size;
+ int nwords;
+ unsigned long *data;
+};
+
+#endif
+
diff --git a/crawl-ref/source/branch.cc b/crawl-ref/source/branch.cc
index 85d2632eee..84fcd8b2c9 100644
--- a/crawl-ref/source/branch.cc
+++ b/crawl-ref/source/branch.cc
@@ -7,7 +7,6 @@
REVISION("$Rev$");
#include "branch.h"
-#include "cloud.h"
#include "externs.h"
#include "mon-pick.h"
#include "place.h"
diff --git a/crawl-ref/source/chardump.cc b/crawl-ref/source/chardump.cc
index 35c0aa7904..bc686d06aa 100644
--- a/crawl-ref/source/chardump.cc
+++ b/crawl-ref/source/chardump.cc
@@ -20,7 +20,7 @@ REVISION("$Rev$");
#endif
#include <ctype.h>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/cio.cc b/crawl-ref/source/cio.cc
index da4367103b..7299d405a7 100644
--- a/crawl-ref/source/cio.cc
+++ b/crawl-ref/source/cio.cc
@@ -156,7 +156,7 @@ void get_input_line( char *const buff, int len )
#else
// [dshaligram] Turn on the cursor for DOS.
-#ifdef DOS
+#ifdef TARGET_OS_DOS
_setcursortype(_NORMALCURSOR);
#endif
@@ -186,7 +186,7 @@ void get_input_line( char *const buff, int len )
// we want to use in cancelable_get_line() and menus.
int c_getch()
{
-#if defined(DOS) || defined(UNIX) || defined(WIN32CONSOLE)
+#if defined(TARGET_OS_DOS) || defined(UNIX) || defined(WIN32CONSOLE)
return getch_ck();
#else
return m_getch();
diff --git a/crawl-ref/source/cio.h b/crawl-ref/source/cio.h
index 2be53a04cb..e8b27e37d2 100644
--- a/crawl-ref/source/cio.h
+++ b/crawl-ref/source/cio.h
@@ -7,7 +7,6 @@
#ifndef CIO_H
#define CIO_H
-#include "AppHdr.h"
#include "enum.h"
#include "externs.h"
#include "defines.h"
diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc
index 40f92bb4e4..8715e04d00 100644
--- a/crawl-ref/source/cloud.cc
+++ b/crawl-ref/source/cloud.cc
@@ -15,10 +15,8 @@ REVISION("$Rev$");
#include "branch.h"
#include "cloud.h"
-#include "it_use2.h"
#include "mapmark.h"
#include "ouch.h"
-#include "place.h"
#include "player.h"
#include "spells4.h"
#include "stuff.h"
@@ -38,11 +36,14 @@ static int _actual_spread_rate(cloud_type type, int spread_rate)
case CLOUD_GREY_SMOKE:
case CLOUD_BLACK_SMOKE:
return 22;
+ case CLOUD_RAIN:
+ return 11;
default:
return 0;
}
}
+#ifdef DEBUG
static bool _killer_whose_match(kill_category whose, killer_type killer)
{
switch (whose)
@@ -61,6 +62,7 @@ static bool _killer_whose_match(kill_category whose, killer_type killer)
}
return (false);
}
+#endif
static void _new_cloud( int cloud, cloud_type type, const coord_def& p,
int decay, kill_category whose, killer_type killer,
@@ -192,10 +194,10 @@ void manage_clouds()
int dissipate = you.time_taken;
// Fire clouds dissipate faster over water,
- // cold clouds dissipate faster over lava.
+ // rain and cold clouds dissipate faster over lava.
if (cloud.type == CLOUD_FIRE && grd(cloud.pos) == DNGN_DEEP_WATER)
dissipate *= 4;
- else if (cloud.type == CLOUD_COLD && grd(cloud.pos) == DNGN_LAVA)
+ else if ((cloud.type == CLOUD_COLD || cloud.type == CLOUD_RAIN) && grd(cloud.pos) == DNGN_LAVA)
dissipate *= 4;
expose_items_to_element(cloud2beam(cloud.type), cloud.pos, 2);
@@ -209,6 +211,34 @@ void delete_cloud( int cloud )
cloud_struct& c = env.cloud[cloud];
if (c.type != CLOUD_NONE)
{
+ if (c.type == CLOUD_RAIN)
+ {
+ // Rain clouds can occasionally leave shallow water or deepen it:
+ // If we're near lava, chance of leaving water is lower;
+ // if we're near deep water already, chance of leaving water
+ // is slightly higher.
+ if (one_chance_in((5 + count_neighbours(c.pos, DNGN_LAVA)) -
+ count_neighbours(c.pos, DNGN_DEEP_WATER)))
+ {
+ dungeon_feature_type feat;
+
+ if (grd(c.pos) == DNGN_FLOOR)
+ feat = DNGN_SHALLOW_WATER;
+ else if (grd(c.pos) == DNGN_SHALLOW_WATER && you.pos() != c.pos
+ && one_chance_in(3))
+ // Don't drown the player!
+ feat = DNGN_DEEP_WATER;
+ else
+ feat = grd(c.pos);
+
+ if (grd(c.pos) != feat)
+ {
+ if (you.pos() == c.pos)
+ mpr("The rain has left you waist-deep in water!");
+ dungeon_terrain_changed(c.pos, feat);
+ }
+ }
+ }
c.type = CLOUD_NONE;
c.decay = 0;
c.whose = KC_OTHER;
@@ -438,6 +468,8 @@ cloud_type beam2cloud(beam_type flavour)
return CLOUD_MIASMA;
case BEAM_CHAOS:
return CLOUD_CHAOS;
+ case BEAM_POTION_RAIN:
+ return CLOUD_RAIN;
case BEAM_POTION_MUTAGENIC:
return CLOUD_MUTAGENIC;
case BEAM_RANDOM:
@@ -463,6 +495,7 @@ beam_type cloud2beam(cloud_type flavour)
case CLOUD_STEAM: return BEAM_STEAM;
case CLOUD_MIASMA: return BEAM_MIASMA;
case CLOUD_CHAOS: return BEAM_CHAOS;
+ case CLOUD_RAIN: return BEAM_POTION_RAIN;
case CLOUD_MUTAGENIC: return BEAM_POTION_MUTAGENIC;
case CLOUD_RANDOM: return BEAM_RANDOM;
}
@@ -718,6 +751,13 @@ void in_a_cloud()
ouch(hurted, cl, KILLED_BY_CLOUD, "foul pestilence");
break;
+ case CLOUD_RAIN:
+ if (you.duration[DUR_FIRE_SHIELD])
+ you.duration[DUR_FIRE_SHIELD] = 1;
+
+ mpr("You are standing in the rain.");
+ break;
+
case CLOUD_MUTAGENIC:
mpr("You are engulfed in a mutagenic fog!");
@@ -782,6 +822,7 @@ bool is_harmless_cloud(cloud_type type)
case CLOUD_BLUE_SMOKE:
case CLOUD_PURP_SMOKE:
case CLOUD_MIST:
+ case CLOUD_RAIN:
case CLOUD_DEBUGGING:
return (true);
default:
@@ -789,6 +830,29 @@ bool is_harmless_cloud(cloud_type type)
}
}
+bool in_what_cloud(cloud_type type)
+{
+ int cl = env.cgrid(you.pos());
+
+ if (env.cgrid(you.pos()) == EMPTY_CLOUD)
+ return (false);
+
+ if (env.cloud[cl].type == type)
+ return (true);
+
+ return (false);
+}
+
+cloud_type in_what_cloud()
+{
+ int cl = env.cgrid(you.pos());
+
+ if (env.cgrid(you.pos()) == EMPTY_CLOUD)
+ return (CLOUD_NONE);
+
+ return (env.cloud[cl].type);
+}
+
std::string cloud_name(cloud_type type)
{
switch (type)
@@ -819,6 +883,8 @@ std::string cloud_name(cloud_type type)
return "thin mist";
case CLOUD_CHAOS:
return "seething chaos";
+ case CLOUD_RAIN:
+ return "rain";
case CLOUD_MUTAGENIC:
return "mutagenic fog";
default:
diff --git a/crawl-ref/source/cloud.h b/crawl-ref/source/cloud.h
index 726c4be001..f9fa6d6d18 100644
--- a/crawl-ref/source/cloud.h
+++ b/crawl-ref/source/cloud.h
@@ -66,6 +66,8 @@ std::string cloud_name(cloud_type type);
bool is_damaging_cloud(cloud_type type, bool temp = false);
bool is_harmless_cloud(cloud_type type);
+bool in_what_cloud (cloud_type type);
+cloud_type in_what_cloud ();
// fog generator
void place_fog_machine(fog_machine_type fm_type, cloud_type cl_type,
diff --git a/crawl-ref/source/clua.cc b/crawl-ref/source/clua.cc
index 77022ff1f7..11ac031f5d 100644
--- a/crawl-ref/source/clua.cc
+++ b/crawl-ref/source/clua.cc
@@ -27,7 +27,6 @@ REVISION("$Rev$");
#include "itemprop.h"
#include "items.h"
#include "item_use.h"
-#include "it_use2.h"
#include "libutil.h"
#include "macro.h"
#include "mapdef.h"
@@ -45,7 +44,6 @@ REVISION("$Rev$");
#include "stuff.h"
#include "transfor.h"
#include "travel.h"
-#include "view.h"
#include <cstring>
#include <map>
@@ -769,6 +767,10 @@ LUARET1(you_good_god, boolean,
LUARET1(you_evil_god, boolean,
lua_isstring(ls, 1) ? is_evil_god(str_to_god(lua_tostring(ls, 1)))
: is_evil_god(you.religion))
+LUARET1(you_god_likes_fresh_corpses, boolean,
+ lua_isstring(ls, 1) ?
+ god_likes_fresh_corpses(str_to_god(lua_tostring(ls, 1))) :
+ god_likes_fresh_corpses(you.religion))
LUARET1(you_god_likes_butchery, boolean,
lua_isstring(ls, 1) ?
god_likes_butchery(str_to_god(lua_tostring(ls, 1))) :
@@ -909,8 +911,9 @@ static const struct luaL_reg you_lib[] =
{ "flying", you_flying },
{ "transform", you_transform },
- { "god_likes_butchery", you_god_likes_butchery },
- { "can_consume_corpses", you_can_consume_corpses },
+ { "god_likes_fresh_corpses", you_god_likes_fresh_corpses },
+ { "god_likes_butchery", you_god_likes_butchery },
+ { "can_consume_corpses", you_can_consume_corpses },
{ "stop_activity", you_stop_activity },
{ "taking_stairs", you_taking_stairs },
@@ -2527,14 +2530,14 @@ MDEF(hd)
static const char *_monuse_names[] =
{
- "nothing", "open_doors", "starting_equipment",
- "weapons_armour", "magic_items"
+ "nothing", "open_doors", "starting_equipment", "weapons_armour",
+ "magic_items"
};
-static const char *_monuse_to_str(mon_itemuse_type ityp)
+static const char *_monuse_to_str(mon_itemuse_type utyp)
{
COMPILE_CHECK(ARRAYSZ(_monuse_names) == NUM_MONUSE, c1);
- return _monuse_names[ityp];
+ return _monuse_names[utyp];
}
MDEF(muse)
@@ -2546,6 +2549,26 @@ MDEF(muse)
return (0);
}
+static const char *_moneat_names[] =
+{
+ "nothing", "items", "corpses", "food"
+};
+
+static const char *_moneat_to_str(mon_itemeat_type etyp)
+{
+ COMPILE_CHECK(ARRAYSZ(_moneat_names) == NUM_MONEAT, c1);
+ return _moneat_names[etyp];
+}
+
+MDEF(meat)
+{
+ if (const monsterentry *me = mons->find_monsterentry())
+ {
+ PLUARET(string, _moneat_to_str(me->gmon_eat));
+ }
+ return (0);
+}
+
static int l_mons_do_dismiss(lua_State *ls)
{
// dismiss is only callable from dlua, not from managed VMs (i.e.
@@ -2582,6 +2605,7 @@ static MonsAccessor mons_attrs[] =
{ "y" , l_mons_y },
{ "hd" , l_mons_hd },
{ "muse", l_mons_muse },
+ { "meat", l_mons_meat },
{ "dismiss", l_mons_dismiss },
{ "experience", l_mons_experience },
};
diff --git a/crawl-ref/source/clua.h b/crawl-ref/source/clua.h
index e171181b94..a6ed4ac413 100644
--- a/crawl-ref/source/clua.h
+++ b/crawl-ref/source/clua.h
@@ -7,8 +7,6 @@
#ifndef __CLUA_H__
#define __CLUA_H__
-#include "AppHdr.h"
-
extern "C" {
#include <lua.h>
#include <lauxlib.h>
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index d37827a6ad..2e022f4200 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -29,7 +29,6 @@ REVISION("$Rev$");
#include "initfile.h"
#include "invent.h"
#include "itemname.h"
-#include "item_use.h"
#include "items.h"
#include "libutil.h"
#include "menu.h"
@@ -228,7 +227,7 @@ static void _print_version(void)
// Read in information about changes in comparison to the latest version.
FILE* fp = fopen(datafile_path(fname, false).c_str(), "r");
-#if defined(DOS)
+#if defined(TARGET_OS_DOS)
if (!fp)
{
#ifdef DEBUG_FILES
@@ -1977,7 +1976,7 @@ static int _show_keyhelp_menu(const std::vector<formatted_string> &lines,
std::string fname = canonicalise_file_separator(help_files[i].name);
FILE* fp = fopen(datafile_path(fname, false).c_str(), "r");
-#if defined(DOS)
+#if defined(TARGET_OS_DOS)
if (!fp)
{
#ifdef DEBUG_FILES
@@ -2381,7 +2380,7 @@ int list_wizard_commands(bool do_redraw_screen)
"<w>s</w> : gain 20000 skill points\n"
"<w>S</w> : set skill to level\n"
"<w>x</w> : gain an experience level\n"
- "<w>Ctrl-X</w> : change experience level\n"
+ "<w>Ctrl-L</w> : change experience level\n"
"<w>$</w> : get 1000 gold\n"
"<w>]</w> : get a mutation\n"
"<w>[</w> : get a demonspawn mutation\n"
@@ -2443,6 +2442,7 @@ int list_wizard_commands(bool do_redraw_screen)
"<w>F</w> : combat stats with fsim_kit\n"
"<w>Ctrl-F</w> : combat stats (monster vs PC)\n"
"<w>Ctrl-I</w> : item generation stats\n"
+ "<w>Ctrl-X</w> : Xom effect stats\n"
"<w>O</w> : measure exploration time\n"
"\n"
"<w>?</w> : list wizard commands\n",
diff --git a/crawl-ref/source/crash-u.cc b/crawl-ref/source/crash-u.cc
index cdda8d8b76..052a2ea3ef 100644
--- a/crawl-ref/source/crash-u.cc
+++ b/crawl-ref/source/crash-u.cc
@@ -11,10 +11,33 @@ REVISION("$Rev$");
#include <signal.h>
#endif
-#ifdef __GLIBC__
+#if defined(UNIX)
+
+#include <cxxabi.h>
+
+#if !defined(TARGET_OS_MACOSX) && \
+ !defined(TARGET_OS_WINDOWS) && \
+ !defined(TARGET_COMPILER_CYGWIN)
#include <execinfo.h>
#endif
+#ifdef TARGET_OS_MACOSX
+#include <dlfcn.h>
+
+typedef int (*backtrace_t)(void * *, int);
+typedef char **(*backtrace_symbols_t)(void * const *, int);
+
+// Used to convert from void* to function pointer (without a
+// compiler warning).
+template <typename TO, typename FROM> TO nasty_cast(FROM f) {
+ union {
+ FROM f; TO t;
+ } u; u.f = f; return u.t;
+}
+#endif // TARGET_OS_MACOSX
+
+#endif // defined(UNIX) || defined(TARGET_OS_MACOSX)
+
#include "crash.h"
#include "externs.h"
@@ -24,6 +47,7 @@ REVISION("$Rev$");
/////////////////////////////////////////////////////////////////////////////
// Code for printing out debugging info on a crash.
////////////////////////////////////////////////////////////////////////////
+#ifdef USE_UNIX_SIGNALS
static int _crash_signal = 0;
static int _recursion_depth = 0;
@@ -76,6 +100,7 @@ static void _crash_signal_handler(int sig_num)
signal(sig_num, SIG_DFL);
raise(sig_num);
}
+#endif
void init_crash_handler()
{
@@ -126,26 +151,38 @@ void init_crash_handler()
void dump_crash_info(FILE* file)
{
+#if defined(UNIX)
const char *name = strsignal(_crash_signal);
if (name == NULL)
name = "INVALID";
fprintf(file, "Crash caused by signal #%d: %s" EOL EOL, _crash_signal,
name);
+#endif
}
-#ifdef __GLIBC__
-// NOTE: This should work on OS X, according to
-// http://developer.apple.com/DOCUMENTATION/DARWIN/Reference/ManPages/man3/backtrace_symbols.3.html
-
+#if defined(UNIX) && !defined(TARGET_COMPILER_CYGWIN)
void write_stack_trace(FILE* file, int ignore_count)
{
void* frames[50];
- int num_frames = backtrace(frames, ARRAYSZ(frames));
+#if defined (TARGET_OS_MACOSX)
+ backtrace_t backtrace;
+ backtrace_symbols_t backtrace_symbols;
+ backtrace = nasty_cast<backtrace_t, void*>(dlsym(RTLD_DEFAULT, "backtrace"));
+ backtrace_symbols = nasty_cast<backtrace_symbols_t, void*>(dlsym(RTLD_DEFAULT, "backtrace_symbols"));
+ if (!backtrace || !backtrace_symbols)
+ {
+ fprintf(stderr, "Couldn't get a stack trace." EOL);
+ fprintf(file, "Couldn't get a stack trace." EOL);
+ return;
+ }
+#endif
+ int num_frames = backtrace(frames, ARRAYSZ(frames));
char **symbols = backtrace_symbols(frames, num_frames);
+#if !defined(TARGET_OS_MACOSX)
if (symbols == NULL)
{
fprintf(stderr, "Out of memory." EOL);
@@ -156,15 +193,60 @@ void write_stack_trace(FILE* file, int ignore_count)
backtrace_symbols_fd(frames, num_frames, fileno(file));
return;
}
+#endif
- for (int i = ignore_count; i < num_frames; i++)
- {
- fprintf(file, "%s" EOL, symbols[i]);
+ fprintf(file, "Obtained %d stack frames." EOL, num_frames);
+
+ // Now we prettify the printout to even show demangled C++ function names.
+ std::string bt = "";
+ for (int i = 0; i < num_frames; i++) {
+#if defined (TARGET_OS_MACOSX)
+ char *addr = ::strstr(symbols[i], "0x");
+ char *mangled = ::strchr(addr, ' ') + 1;
+ char *offset = ::strchr(addr, '+');
+ char *postmangle = ::strchr(mangled, ' ');
+ if (mangled)
+ *(mangled - 1) = 0;
+ bt += addr;
+ int status;
+ bt += ": ";
+ if (addr && mangled)
+ {
+ if (postmangle)
+ *postmangle = '\0';
+ char *realname = abi::__cxa_demangle(mangled, 0, 0, &status);
+ if (realname)
+ bt += realname;
+ else
+ bt += mangled;
+ bt += " ";
+ bt += offset;
+ free(realname);
+ }
+#else // TARGET_OS_MACOSX
+ bt += symbols[i];
+ int status;
+ // Extract the identifier from symbols[i]. It's inside of parens.
+ char *firstparen = ::strchr(symbols[i], '(');
+ char *lastparen = ::strchr(symbols[i], '+');
+ if (firstparen != 0 && lastparen != 0 && firstparen < lastparen)
+ {
+ bt += ": ";
+ *lastparen = '\0';
+ char *realname = abi::__cxa_demangle(firstparen + 1, 0, 0, &status);
+ if (realname != NULL)
+ bt += realname;
+ free(realname);
+ }
+#endif
+ bt += EOL;
}
+ fprintf(file, "%s", bt.c_str());
+
free(symbols);
}
-#else // ifdef __GLIBC__
+#else // defined(UNIX)
void write_stack_trace(FILE* file, int ignore_count)
{
const char* msg = "Unable to get stack trace on this platform." EOL;
diff --git a/crawl-ref/source/ctest.h b/crawl-ref/source/ctest.h
index 0cc1d1ad55..6caa3cf00c 100644
--- a/crawl-ref/source/ctest.h
+++ b/crawl-ref/source/ctest.h
@@ -1,8 +1,6 @@
#ifndef CTEST_H
#define CTEST_H
-#include "AppHdr.h"
-
#ifdef DEBUG_DIAGNOSTICS
namespace crawl_tests
diff --git a/crawl-ref/source/dat/clua/dungeon.lua b/crawl-ref/source/dat/clua/dungeon.lua
index 7b9f1426da..5d178b891d 100644
--- a/crawl-ref/source/dat/clua/dungeon.lua
+++ b/crawl-ref/source/dat/clua/dungeon.lua
@@ -360,4 +360,31 @@ end
-- Turn persistant data into a human readable string.
function persist_to_string()
return table_to_string(dgn.persist)
-end \ No newline at end of file
+end
+
+-- List of useful scrolls, with some reasonable weights.
+-- Attention: total weight is 1000 = 3*120 + 7*70 + 4*30 + 30
+-- When changing the list or the weights, please keep the total weight at 1000.
+dgn.good_scrolls = [[
+ w:80 scroll of identify / scroll of identify q:2 w:30 /
+ scroll of identify q:3 w:10 /
+ w:80 scroll of teleportation / scroll of teleportation q:2 w:30 /
+ / scroll of teleportation q:3 w:10 /
+ w:80 scroll of fog / scroll of fog q:2 w:30 / scroll of fog q:3 w:10 /
+ w:50 scroll of remove curse / scroll of remove curse q:2 w:20 /
+ w:50 scroll of enchant weapon I / scroll of enchant weapon I q:2 w:20 /
+ w:50 scroll of enchant weapon II / scroll of enchant weapon II q:2 w:20 /
+ w:50 scroll of blinking / scroll of blinking q:2 w:20 /
+ w:50 scroll of enchant armour / scroll of enchant armour q:2 w:20 /
+ w:50 scroll of recharging / scroll of recharging q:2 w:20 /
+ w:50 scroll of silence / scroll of silence q:2 w:20 /
+ w:20 scroll of magic mapping / scroll of magic mapping q:2 w:10 /
+ w:20 scroll of detect curse / scroll of detect curse q:2 w:10 /
+ w:20 scroll of holy word / scroll of holy word q:2 w:10 /
+ w:20 scroll of enchant weapon III / scroll of enchant weapon III q:2 w:10 /
+ w:10 scroll of acquirement / scroll of acquirement q:2 w:4 /
+ scroll of acquirement q:3 w:1/
+ w:5 scroll of vorpalise weapon /
+ w:5 scroll of immolation /
+ w:5 scroll of vulnerability
+ ]] \ No newline at end of file
diff --git a/crawl-ref/source/dat/clua/lm_fog.lua b/crawl-ref/source/dat/clua/lm_fog.lua
index 4f1ad793e1..876af34c5c 100644
--- a/crawl-ref/source/dat/clua/lm_fog.lua
+++ b/crawl-ref/source/dat/clua/lm_fog.lua
@@ -21,7 +21,7 @@
--
-- cloud_type: The name of the cloud type to use. Possible cloud types are:
-- flame, noxious fumes, freezing vapour, poison gases,
--- grey smoke, blue smoke, purple smoke, steam,
+-- grey smoke, blue smoke, purple smoke, steam, rain,
-- foul pestilence, black smoke, mutagenic fog, thin mist (the default).
-- walk_dist: The distance to move over the course of one random walk.
-- defaults to 0.
diff --git a/crawl-ref/source/dat/clua/ziggurat.lua b/crawl-ref/source/dat/clua/ziggurat.lua
index b8dff21ab1..cc409a7565 100644
--- a/crawl-ref/source/dat/clua/ziggurat.lua
+++ b/crawl-ref/source/dat/clua/ziggurat.lua
@@ -495,8 +495,12 @@ local function ziggurat_create_loot_at(c)
loot_depth = you.absdepth() - 1
end
- local good_loot = dgn.item_spec("*")
- local super_loot = dgn.item_spec("|")
+ -- dgn.good_scrolls is a list of items with total weight 1000
+ local good_loot = dgn.item_spec("* w:7000 / " .. dgn.good_scrolls)
+ local super_loot = dgn.item_spec("| w:7000 / potion of experience w:200 /" ..
+ "potion of cure mutation w:200 /" ..
+ "potion of porridge w:100 / wand of healing w:10" ..
+ "wand of hasting w:10" .. dgn.good_scrolls)
local loot_spots = find_free_space(nloot * 4)
diff --git a/crawl-ref/source/dat/crypt.des b/crawl-ref/source/dat/crypt.des
index 61669a3784..1587ed5cf2 100644
--- a/crawl-ref/source/dat/crypt.des
+++ b/crawl-ref/source/dat/crypt.des
@@ -588,7 +588,7 @@ NAME: david_glass_crypt
ORIENT: float
TAGS: no_item_gen no_rotate
PLACE: Crypt:5
-SUBST: m : mn
+SUBST: m : mnn
MONS: lich / ancient lich
MONS: skeletal dragon / curse skull / curse toe
MONS: flying skull / skeletal warrior / w:40 nothing
@@ -616,6 +616,162 @@ MAP
ENDMAP
##############################################################################
+# Four quadrants (by mu)
+# burial horde (NE), chapel of kikubaaqudgha (NW), catacombs (SE), crematory (SW)
+#
+NAME: quadcrypt_mu
+ORIENT: encompass
+TAGS: no_monster_gen no_item_gen no_pool_fixup no_rotate no_vmirror no_hmirror
+PLACE: Crypt:5
+WEIGHT: 10000
+####### chapel garden
+SUBST: F = f ?
+SUBST: f = p:1 .:1
+KFEAT: p = .
+KMONS: p = w:2 col:darkgrey plant / w:1 col:lightgrey plant
+####### hidden skeleton; sometimes good pain weapon, but draining short sword
+KFEAT: ! = .
+KMONS: ! = skeletal warrior ; w:2 dagger ego:pain | short sword ego:draining |\
+ w:2 sabre ego:pain | w:1 quick blade ego:pain
+KFEAT: A = .
+KFEAT: D = .
+KFEAT: E = .
+KFEAT: G = .
+KFEAT: H = .
+KFEAT: I = .
+KFEAT: J = .
+KFEAT: P = .
+KFEAT: Z = .
+KFEAT: Q = .
+KFEAT: R = .
+KFEAT: S = .
+KFEAT: t = .
+KFEAT: X = .
+KFEAT: b = .
+KFEAT: 8 = .
+KFEAT: o = granite_statue
+KFEAT: _ = altar_kikubaaqudgha
+KFEAT: ~ = bolt trap / blade trap / needle trap / axe trap
+SUBST: s = v =
+SUBST: B = b %
+KITEM: b = any book
+SUBST: ? = $ % * |:1
+SUBST: u = U Y
+SUBST: ; = ..~
+KMONS: 8 = iron golem
+####### NW monsters (chapel).
+KMONS: A = ancient lich / w:2 mummy priest
+KMONS: D = lich / w:5 ancient lich
+KMONS: E = iron golem
+KMONS: G = flayed ghost / hungry ghost / phantom
+####### NE monsters (horde). On a coinflip, either vampires or mummies.
+: if crawl.coinflip() == 0 then
+KMONS: H = vampire mage
+KMONS: I = vampire knight
+KMONS: J = vampire
+KMONS: P = large zombie / small zombie / large skeleton / small skeleton
+: else
+KMONS: H = sphinx
+KMONS: I = guardian mummy
+KMONS: J = guardian mummy / mummy
+KMONS: P = large skeleton / mummy
+: end
+####### SE monsters (catacombs). Either corporeal or incorporeal undead.
+: if crawl.coinflip() == 0 then
+KMONS: Z = curse skull
+KMONS: Q = skeletal dragon
+KMONS: R = skeletal warrior
+KMONS: S = large zombie / small zombie / large skeleton / small skeleton
+: else
+KMONS: Z = curse skull
+KMONS: Q = spectral iron dragon
+KMONS: R = spectral warrior
+KMONS: S = phantom / wraith / freezing wraith / flayed ghost / wight
+: end
+####### SW monsters (crematory). Either fiery undead or hellish.
+: if crawl.coinflip() == 0 then
+KMONS: t = w:20 flaming corpse / fire giant skeleton / dragon skeleton
+KMONS: X = w:1 curse skull / w:19 flaming corpse
+: else
+KMONS: t = w:20 hell knight / smoke demon / red devil
+KMONS: X = w:1 curse skull / w:19 hell knight
+: end
+####### Randomisation of secret doors; there is a chance of no door at all.
+SUBST: K : Kvvv
+SUBST: ' : 'vvv
+SUBST: " : "v
+NSUBST: K = 1:= / *:v
+NSUBST: ' = 1:= / *:v
+NSUBST: " = 1:= / *:v
+MAP
+vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
+vccccccccccccccccccccccccc......"...Bvvvvvvvvvvvvvvvvvvvvvv
+vc..D..c.....c....Bc;;+;;c.ffff.vvvBDvvvvvvvvvvvvvvvvvvvvvv
+vc.c.c.+.....+....cc;;+;;c.ffFf.vvvv"vvvvvvvvvvvvvnP=.....v
+vc.._..+...D.c....Bc;;c;;m.ffFf.v????||$$$.vvvvv..nPn|????v
+vc.c.c.c.....c....cc..c..c.ffff.v$$$$$$$$$.vvvv...nPn$$$$$v
+vc.....ccc=ccc....Bc..cGGc.ffff.vnnnnnnnnn=vvv..H.nPn$$$$$v
+vc.....c.....c....cc..c..c.ffff.v;;;;;;;;;;vv.....nPn$$$$$v
+vc.....c?....c..A.Bc..c..m..fff.v;;;;;;;;;;vv.uvu.nPn$$$$$v
+vc.....c|?...c....cc..c..c...ff.v;;vvvvvvvvv..vvv.nPnnnnnnv
+vc.....c||?EEcBcBcc...c..c....f.v;;;;;;;;;;+..uvu.nPPPPPPPv
+vc++cccccccccccccc...cc..c......v;;;;;;;;;;+......nnnnnnn=v
+vc.....G............cc...m..G...vvvvvvvvvvvv.H............v
+vc.....G...........cc...cc......v....vvvvvvv..............v
+vccccccccccccccccccc...cc...ff..v.JJ...vvvvvv....v..v..v..v
+vc.....;;;;;;.........cc..fffff.v.......vvvvv.............v
+vc......;;;;.........ccE..fffff.vv+vv....vvvvv...v..v..v..v
+vccmcccmm++mmcccmcccmc...fffff..v...vvv...vvvvv...........v
+v.......f..f............fffffff.v.....vv...vvvvv..........v
+v....ffff..ffff.........fffFfff.v......v...vvvvvvvvvvvv++vv
+v.G.ffff...ffff...G....ffffffff.v......vv...v;..;.I;..;..;v
+v...ffff...fffff.......fffffff..v.......v...+.;..;..;..;..v
+v....ffff....ffff.......f.ffff..v.......v...+..;..;..;..;.v
+v......f.f....ffff..............v.......v...v;..;.I;..;..;v
+vvvvvvvvvvvvvv==vvvvvvvvvvvvvvvvvvvvvvv=vvvvvvvvvvvvvvvvvvv
+vvvvvvvvvvvvv....v??llv??llv??llvvvvvvo.ovvvWWWWWWW.......v
+vvvvvlllvvvvv....v?.tlv?.tlv?.tlvvvv.......vvWWWWWWZ.mmmm;v
+vvv.......vvv....v....v....v....vvv.........vvWWWWWWWm*|m.v
+vv.........vv....v....v....v....vv...........vWWWWWWWW*|m;v
+v..ccc.ccc..vv++vvv==vvv==vvv==vvv...R.Q.R...vvWWWWmWW%|m.v
+v...lc.cl...v...................vo...........ovWWWWmmmmmm;v
+v..t.c.c.t..+.;;;;;;;;;;;;;;;;;.=......U......=...........v
+v...........v...................vo...........ov...........v
+v.cccc.cccc.vvvvvvvvvKvvvvvvvvvvvv.........vvvvvvvvvvvvvvvv
+v.cll...llc.v??......<vvvvvvvvvvvv.........+..;=..........v
+v.clt...tlc.K???.....Kvvvvvvvvvvvvv........+.;.vvvvvvvvvv.v
+v.c...X...c.v????|KKvvwwwwwwwwvvvvvv.......v;...vvvW.R.%v.v
+v...........vRRRRKvwwwwwwwwwwwwwwvvvvvo.ovvv=v...vvW...%v.v
+v..ccc.ccc..vRRKvvwwwwwwwwwwwwwwwwvvvvv=vvvv.vv...vv...$v.v
+v..lc...cl..vvvvwwwwwwwwwwwwwwwwwwwwvvv<v....vvv...vvv=vv.v
+v.t.......t.vvvwwwwwwwwwwwwwwwwwwwwwwvvvv.vvvvvvv...vv....v
+v....lll....vvvwwwwwwwwwwwwwwwwwwwwwwvvvv.v%RWvvvv...vvvv.v
+v....lml....vvwwwwwwwwwwwwwwwwwwwwwwwwvvv.v..Wvvvvv...vvv.v
+v....lll....vwwwwwwwwwwwwwwwwwwwwwwwwwwvv.v.vvvvvvvv...vv.v
+v...........vwwwwwwwwwwwwwwwwwwwwwwwwwwvv.v.v%R.Wv%vv...vvv
+vvvv++vvvvvvvwwwwwww..8..wwwwwwwwwwwwwwvv.v.v...WvRWvv...vv
+v........stvwwwwww.........wwwwwwwwwwwwwv.v=v=vvvv=vvvv...v
+v...ll...vsvwwwww...........wwwwwwwwwwwwv............vvv..v
+v...ll...stvwwww.............wwwwwwwwwwwvvvvvvvvvvvvvvvvv+v
+v...ll...vsvwwww.............wwww..;;.;;+.;;.....R......v.v
+v...ll...stvwww...............ww...;;.;;+.;;.V.S.R.V....v.v
+v.llllll.vsvwww...................wwwwwwv.;;...S........v.v
+v.llllll.stvwww8.............8...wwwwwwwv.;;.V.S.R.V....v.v
+v...ll...vsvwww.................wwwwwwwwv.;;.....R......v.v
+v.t.ll...vtvvww...............wwwwwwwwwvvvvvv''vvvvvvv+vv+v
+v.t.ll...v.*vwww.{...........wwwwwwwwwwv...;...'o$.....vv.v
+v...ll...v.%vwww..[..........wwwwwwwwwwv....;..v$;....vvv.v
+v........=.*vvwww..(........wwwwwwwwwwvv..W..;.v..;..vvv..v
+vvvvvvvvvvvvvvvwww.........wwwwwwwwwwvv..SW...;v.S.;vvv.S.v
+vvvvvvvvvvvvvvvwwwww..8..wwwwwwwwwwwwv;.WWWWW..'...vvv;...v
+vvvvvvvvvvvvvvvvwwwwwwwwwwwwwwwwwwwwvv.;..W....v..vvv..;..v
+vvvvvvvvvvvvvvvvvvwwwwwwwwwwwwwwwwvvv...;.W....v+vvv....;$v
+vvvvvvvvvvvvvvvvvvvwwwwwwwwwwwwwwvv!s....;..R..'........$ov
+vvvvvvvvvvvvvvvvvvvvvvwwwwwwwwvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
+vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
+ENDMAP
+
+##############################################################################
# The three Tomb levels: these should generally be of a confusing layout.
##############################################################################
diff --git a/crawl-ref/source/dat/database/godspeak.txt b/crawl-ref/source/dat/database/godspeak.txt
index df4689dbe7..c5045dda27 100644
--- a/crawl-ref/source/dat/database/godspeak.txt
+++ b/crawl-ref/source/dat/database/godspeak.txt
@@ -176,6 +176,21 @@ Xom tricks other gods for their servants.
Xom momentarily opens a gate.
%%%%
+# changing the scenery
+Xom scenery
+
+Xom briefly touches your surroundings.
+
+Xom adds some personal touches to your environment.
+
+Xom complains about the scenery!
+
+Xom alters the dungeon around you.
+
+"There, this looks better."
+
+"Just a minor improvement..."
+%%%%
##################
# Xom nastiness
##################
@@ -238,6 +253,10 @@ Xom decides to rearrange the pieces.
"This might be better!"
%%%%
+Xom swap weapons
+
+@Xom rearrange the pieces@
+%%%%
Xom teleportation journey
"Whee!"
@@ -278,6 +297,10 @@ Xom hostile monster
You hear Xom's maniacal laughter.
%%%%
+Xom animate monster weapon
+
+@Xom hostile monster@
+%%%%
Xom banishment
"You have grown too comfortable in your little world, mortal!"
diff --git a/crawl-ref/source/dat/icecave.des b/crawl-ref/source/dat/icecave.des
index 7c382cf14d..3bf6e45a26 100644
--- a/crawl-ref/source/dat/icecave.des
+++ b/crawl-ref/source/dat/icecave.des
@@ -280,7 +280,7 @@ ENDMAP
# The destination vaults ############
#
-# Currently, there are four cave vaults (each of weight 8) and three
+# Currently, there are five cave vaults (each of weight 6) and three
# cavern vaults (each of weight 5).
############################################################################
@@ -298,7 +298,7 @@ ENDMAP
NAME: ice_cave_small_01
TAGS: ice_cave no_item_gen no_monster_gen no_pool_fixup
ORIENT: encompass
-WEIGHT: 8
+WEIGHT: 6
# Randomize the layout slightly.
SHUFFLE: "'
SUBST: "=. , ':x .:1
@@ -378,7 +378,7 @@ ENDMAP
NAME: ice_cave_small_02
TAGS: ice_cave no_item_gen no_monster_gen no_pool_fixup
ORIENT: encompass
-WEIGHT: 8
+WEIGHT: 6
# Randomize the layout slightly.
SHUFFLE: "'
SUBST: "=. , ':x .:1
@@ -440,7 +440,7 @@ ENDMAP
NAME: ice_cave_small_03
TAGS: ice_cave no_item_gen no_monster_gen no_pool_fixup
ORIENT: encompass
-WEIGHT: 8
+WEIGHT: 6
KFEAT: _ = altar_kikubaaqudgha
SUBST: - = ........-
KFEAT: - = alarm trap
@@ -516,7 +516,7 @@ ENDMAP
NAME: ice_cave_small_04
TAGS: ice_cave no_item_gen no_monster_gen no_pool_fixup
ORIENT: encompass
-WEIGHT: 8
+WEIGHT: 6
NSUBST: . = 9:1 / 1:2 / *:.
SHUFFLE: Qq / Zz / Nn / Bb / Mm
SUBST: Q=2, Z=2, N=., B=., M=.
@@ -599,6 +599,79 @@ xxxxxxxxxxxxxxxxxcccccccccccccccxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ENDMAP
+NAME: ice_cave_tombish
+# This is an ice cave which is also a tomb of a necromancer who likes staying
+# alive and simulacrums, or just a chillout of an ice fiend. By Zaba.
+# Weighted as a small cave, although this is pretty tough. --Eino
+TAGS: ice_cave no_item_gen no_monster_gen
+ORIENT: encompass
+WEIGHT: 6
+# S is either an ice statue or a granite statue.
+SUBST: S = GGS
+KMONS: S = ice statue
+# I is an ice statue with loot underneath.
+KITEM: I = any scroll q:3
+KMONS: I = ice statue
+MONS: ice devil / blue devil / nothing w:7
+# FIXME: I can't quite make up more simulacrums
+MONS: grizzly bear simulacrum / bear simulacrum / dragon simulacrum /\
+ human simulacrum / golden dragon simulacrum w:1
+MONS: Ice Fiend w:2 / necromancer
+ITEM: any potion / any scroll / any weapon good_item / any armour good_item
+KFEAT: ' = alarm trap / net trap / arrow trap / bolt trap w:5 / floor w:5
+: ice_cave_colours(_G)
+: ice_cave_milestone(_G)
+: ice_cave_random_monster_list_undead_demon(_G)
+MAP
+ xxxxx
+ xx...xx
+ xx.....xx
+ x...A...x
+ x...<...x
+ xx.....xx
+ xx...xx
+ x...xx
+ xx...x
+ xx...x
+ x...xx
+ xxxx...xxxx
+ xxIx.....xIxx
+ xx...........xx
+ x.............x
+xx.............xx
+x.......1.......x
+x....1.....1....x
+x.......U.......x
+x....1.....1....x
+x.......1.......x
+xx.............xx
+ x.cnnc...cnnc.x
+ xxc11c...c11cxx
+ xc11cc+cc11cx
+ ccc+c...c+ccc
+ c...c...c...c
+ccc.ccc...ccc.ccc
+c...c2c...c2c...c
+c+ccc+c...c+ccc+c
+c'c2+.......+2c'c
+c'ccc.G...G.ccc'c
+c'c2+.......+2c'c
+c'ccc.G...G.ccc'c
+c'c2+.......+2c'c
+c'ccc.G...G.ccc'c
+c'c2+.......+2c'c
+c+cccccc+cccccc+c
+c...............c
+ccccS.ccccc.Scccc
+ cc.cd3dc.cc
+ c.cdUdc.c
+ c.cdddc.c
+ c.cc+cc.c
+ c.'''''.c
+ ccccScccc
+ ccc
+ENDMAP
+
############################################################################
# sprawling caverns
#
diff --git a/crawl-ref/source/dat/trove.des b/crawl-ref/source/dat/trove.des
index f6300bf18b..27eb8cad66 100644
--- a/crawl-ref/source/dat/trove.des
+++ b/crawl-ref/source/dat/trove.des
@@ -18,9 +18,9 @@ function trove_portal(e)
local entry_fee = 5 * math.floor(200 + d(3,200) / 3 + d(10) * d(10) * d(10))
local desc_long = [[ Once upon a time, an enterprising thief and wizard, terrified of being caught committing an act of burglary, created a system of portals leading into the secret treasure troves and chambers of the rich. Too scared to loot them himself, he instead charged an extortionate fee for entry to anyone who wanted to rifle through them.
-The secrets of the gateways died with him when his fellow thieves, disgusted at his betrayal of their 'ideals', had him murdered.
+The secrets of the gateways died with him when his fellow thieves, disgusted at his betrayal of their 'ideals', had him murdered. With his death, the now-uncontrolled portals began moving rapidly from one dimension to the next, stopping only long enough to absorb magical energy.
]]
- local timeout_turns = crawl.random_range(1600, 2800)
+ local timeout_turns = crawl.random_range(1600, 3000)
local messager =
timed_msg {
visible = true,
@@ -87,7 +87,7 @@ function place_fog(e, type, strength)
end
}}
-default-depth: D:7-, Elf:1-, Vault:1-
+default-depth: D:14-, Elf:1-, Vault:1-
##############################################################################
#
diff --git a/crawl-ref/source/database.h b/crawl-ref/source/database.h
index f711f67fe5..f45df352f9 100644
--- a/crawl-ref/source/database.h
+++ b/crawl-ref/source/database.h
@@ -8,7 +8,6 @@
#ifndef DATABASE_H
#define DATABASE_H
-#include "AppHdr.h"
#include "externs.h"
#include <list>
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index 9472203741..0fa8f1b7f0 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -19,7 +19,7 @@ REVISION("$Rev$");
#include <algorithm>
#include <errno.h>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
@@ -58,7 +58,6 @@ REVISION("$Rev$");
#include "monspeak.h"
#include "monstuff.h"
#include "mon-util.h"
-#include "mstuff2.h"
#include "mutation.h"
#include "newgame.h"
#include "ouch.h"
@@ -103,7 +102,7 @@ static void _dump_levgen();
#if DEBUG
static void _BreakStrToDebugger(const char *mesg)
{
-#if defined(OSX) || defined(__MINGW32__)
+#if defined(TARGET_OS_MACOSX) || defined(TARGET_COMPILER_MINGW)
fprintf(stderr, mesg);
// raise(SIGINT); // this is what DebugStr() does on OS X according to Tech Note 2030
int* p = NULL; // but this gives us a stack crawl...
diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc
index 19378ab9b2..a743dbe952 100644
--- a/crawl-ref/source/decks.cc
+++ b/crawl-ref/source/decks.cc
@@ -33,7 +33,6 @@ REVISION("$Rev$");
#include "monstuff.h"
#include "mutation.h"
#include "ouch.h"
-#include "output.h"
#include "player.h"
#include "religion.h"
#include "skills2.h"
diff --git a/crawl-ref/source/defines.h b/crawl-ref/source/defines.h
index 5ee9daadd7..2ef5a2fee9 100644
--- a/crawl-ref/source/defines.h
+++ b/crawl-ref/source/defines.h
@@ -177,7 +177,7 @@ const int MAX_SEC_ENCHANT = 2;
#define igrd env.igrid
// colors, such pretty colors ...
-#ifndef DOS
+#ifndef TARGET_OS_DOS
#define BLACK 0
#define BLUE 1
#define GREEN 2
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index 87cea6699b..81f53d1f2c 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -82,7 +82,6 @@ static bool _recite_mons_useless(const monsters *mon)
// Power is maximum 50.
static int _recite_to_monsters(coord_def where, int pow, int, actor *)
{
-
monsters *mons = monster_at(where);
if (mons == NULL)
@@ -354,9 +353,8 @@ void stop_delay( bool stop_stair_travel )
{
case DELAY_BUTCHER:
case DELAY_BOTTLE_BLOOD:
- case DELAY_OFFER_CORPSE:
{
- // Corpse keeps track of work in plus2 field, see handle_delay(). -- bwr
+ // Corpse keeps track of work in plus2 field, see handle_delay(). - bwr
bool multiple_corpses = false;
bool butcher_swap_setup = false;
int butcher_swap_weapon = 0;
@@ -364,8 +362,7 @@ void stop_delay( bool stop_stair_travel )
for (unsigned int i = 1; i < you.delay_queue.size(); ++i)
{
if (you.delay_queue[i].type == DELAY_BUTCHER
- || you.delay_queue[i].type == DELAY_BOTTLE_BLOOD
- || you.delay_queue[i].type == DELAY_OFFER_CORPSE)
+ || you.delay_queue[i].type == DELAY_BOTTLE_BLOOD)
{
multiple_corpses = true;
}
@@ -538,8 +535,7 @@ void stop_delay( bool stop_stair_travel )
static bool _is_butcher_delay(int delay)
{
- return (delay == DELAY_BUTCHER || delay == DELAY_BOTTLE_BLOOD
- || delay == DELAY_OFFER_CORPSE);
+ return (delay == DELAY_BUTCHER || delay == DELAY_BOTTLE_BLOOD);
}
void stop_butcher_delay()
@@ -665,8 +661,7 @@ bool is_being_butchered(const item_def &item, bool just_first)
for (unsigned int i = 0; i < you.delay_queue.size(); ++i)
{
if (you.delay_queue[i].type == DELAY_BUTCHER
- || you.delay_queue[i].type == DELAY_BOTTLE_BLOOD
- || you.delay_queue[i].type == DELAY_OFFER_CORPSE)
+ || you.delay_queue[i].type == DELAY_BOTTLE_BLOOD)
{
const item_def &corpse = mitm[ you.delay_queue[i].parm1 ];
if (&corpse == &item)
@@ -788,31 +783,34 @@ void handle_delay()
case DELAY_ARMOUR_ON:
mpr("You start putting on your armour.", MSGCH_MULTITURN_ACTION);
break;
+
case DELAY_ARMOUR_OFF:
mpr("You start removing your armour.", MSGCH_MULTITURN_ACTION);
break;
+
case DELAY_BUTCHER:
case DELAY_BOTTLE_BLOOD:
if (!is_valid_item(mitm[delay.parm1]))
break;
+
mprf(MSGCH_MULTITURN_ACTION, "You start %s the %s.",
(delay.type == DELAY_BOTTLE_BLOOD ? "bottling blood from"
: "butchering"),
mitm[delay.parm1].name(DESC_PLAIN).c_str());
// Also for bottling blood - just in case.
- if (you.duration[DUR_PRAYER]
- && god_hates_butchery(you.religion))
- {
+ if (you.duration[DUR_PRAYER])
did_god_conduct(DID_DEDICATED_BUTCHERY, 10);
- }
break;
+
case DELAY_MEMORISE:
mpr("You start memorising the spell.", MSGCH_MULTITURN_ACTION);
break;
+
case DELAY_PASSWALL:
mpr("You begin to meditate on the wall.", MSGCH_MULTITURN_ACTION);
break;
+
case DELAY_RECITE:
mprf(MSGCH_PLAIN, "You %s",
_get_recite_speech("start", you.num_turns + delay.duration).c_str());
@@ -820,9 +818,11 @@ void handle_delay()
if (apply_area_visible(_recite_to_monsters, delay.parm1))
viewwindow(true, false);
break;
+
default:
break;
}
+
delay.started = true;
}
@@ -858,8 +858,7 @@ void handle_delay()
return;
}
}
- else if (delay.type == DELAY_BUTCHER || delay.type == DELAY_BOTTLE_BLOOD
- || delay.type == DELAY_OFFER_CORPSE)
+ else if (delay.type == DELAY_BUTCHER || delay.type == DELAY_BOTTLE_BLOOD)
{
if (delay.type == DELAY_BOTTLE_BLOOD && you.experience_level < 6)
{
@@ -915,16 +914,6 @@ void handle_delay()
}
}
- if (delay.type == DELAY_OFFER_CORPSE)
- {
- // Don't attempt to offer a rotten corpse.
- _pop_delay();
-
- // Chain onto the next delay.
- handle_delay();
- return;
- }
-
delay.parm2 = 99; // Don't give the message twice.
// Vampires won't continue bottling rotting corpses.
@@ -942,18 +931,6 @@ void handle_delay()
mitm[ delay.parm1 ].plus2++;
}
}
- else if (delay.type == DELAY_OFFER_CORPSE)
- {
-#ifdef DEBUG_DIAGNOSTICS
- mprf("Corpse %d no longer valid!", delay.parm1);
-#endif
- // Don't attempt to offer an invalid item.
- _pop_delay();
-
- // Chain onto the next delay.
- handle_delay();
- return;
- }
else
{
// Corpse is no longer valid! End the butchering normally
@@ -1349,37 +1326,6 @@ static void _finish_delay(const delay_queue_item &delay)
break;
}
- case DELAY_OFFER_CORPSE:
- {
- if (!you.duration[DUR_PRAYER])
- {
- stop_delay();
- return;
- }
-
- if (food_is_rotten(mitm[delay.parm1]))
- {
- simple_god_message(coinflip() ? " refuses to accept that"
- " mouldy sacrifice!"
- : " demands fresh blood!",
- you.religion);
- _pop_delay();
- // Chain onto the next delay.
- handle_delay();
- }
- else
- {
- offer_corpse(delay.parm1);
- StashTrack.update_stash(); // Don't stash-track this corpse anymore.
- }
- // If we were interrupted while butchering (by poisoning, for
- // example) then resumed butchering and finished, swap back from
- // butchering tool if appropriate.
- if (you.delay_queue.size() == 1)
- handle_interrupted_swap(true);
- break;
- }
-
case DELAY_DROP_ITEM:
// Note: checking if item is droppable is assumed to
// be done before setting up this delay... this includes
@@ -2111,8 +2057,8 @@ activity_interrupt_type get_activity_interrupt(const std::string &name)
static const char *delay_names[] =
{
"not_delayed", "eat", "vampire_feed", "armour_on", "armour_off",
- "jewellery_on", "memorise", "butcher", "bottle_blood", "offer_corpse",
- "weapon_swap", "passwall", "drop_item", "multidrop", "ascending_stairs",
+ "jewellery_on", "memorise", "butcher", "bottle_blood", "weapon_swap",
+ "passwall", "drop_item", "multidrop", "ascending_stairs",
"descending_stairs", "recite", "run", "rest", "travel", "macro",
"macro_process_key", "interruptible", "uninterruptible"
};
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 3ed643d310..462320deee 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -16,7 +16,7 @@ REVISION("$Rev$");
#include <iomanip>
#include <numeric>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
@@ -31,7 +31,6 @@ REVISION("$Rev$");
#include "food.h"
#include "ghost.h"
#include "invent.h"
-#include "it_use2.h"
#include "itemname.h"
#include "itemprop.h"
#include "items.h"
@@ -3128,7 +3127,7 @@ std::string describe_favour(god_type which_god)
: _describe_favour_generic(which_god);
}
-static std::string _religion_help( god_type god )
+static std::string _religion_help(god_type god)
{
std::string result = "";
@@ -3183,6 +3182,12 @@ static std::string _religion_help( god_type god )
}
break;
+ case GOD_BEOGH:
+ result += "You can pray to sacrifice all orcish remains on your "
+ "square. Inscribe orcish remains with !p, !* or =p to avoid "
+ "sacrificing them accidentally.";
+ break;
+
case GOD_NEMELEX_XOBEH:
result += "You can pray to sacrifice all items on your square. "
"Inscribe items with !p, !* or =p to avoid sacrificing "
@@ -3201,13 +3206,14 @@ static std::string _religion_help( god_type god )
break;
}
- if (god_likes_butchery(god))
+ if (god_likes_fresh_corpses(god))
{
if (!result.empty())
result += " ";
- result += "You can sacrifice corpses by dissecting"
- " them during prayer.";
+ result += "You can pray to sacrifice all fresh corpses on your "
+ "square. Inscribe fresh corpses with !p, !* or =p to avoid "
+ "sacrificing them accidentally.";
}
return result;
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index c15a6f09a8..f90b2f0ea6 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -17,7 +17,7 @@ REVISION("$Rev$");
#include <stdio.h>
#include <algorithm>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
@@ -44,7 +44,6 @@ REVISION("$Rev$");
#include "shopping.h"
#include "state.h"
#include "stuff.h"
-#include "spells4.h"
#include "stash.h"
#ifdef USE_TILE
#include "tiles.h"
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 4f07e96f12..1a22de6180 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -27,7 +27,6 @@ REVISION("$Rev$");
#include "directn.h"
#include "dungeon.h"
#include "files.h"
-#include "food.h"
#include "itemname.h"
#include "itemprop.h"
#include "items.h"
@@ -39,20 +38,16 @@ REVISION("$Rev$");
#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 "religion.h"
#include "spells3.h"
-#include "spl-book.h"
#include "state.h"
#include "stuff.h"
#include "tags.h"
#include "terrain.h"
-#include "tiles.h"
#include "traps.h"
#include "travel.h"
#include "view.h"
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index acfd160e10..6c4dc207bc 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -24,7 +24,6 @@ REVISION("$Rev$");
#include "cloud.h"
#include "decks.h"
#include "delay.h"
-#include "describe.h"
#include "directn.h"
#include "dgnevent.h"
#include "food.h"
@@ -43,7 +42,6 @@ REVISION("$Rev$");
#include "monstuff.h"
#include "mon-util.h"
#include "mutation.h"
-#include "newgame.h"
#include "notes.h"
#include "ouch.h"
#include "player.h"
@@ -212,16 +210,18 @@ int torment_player(int pow, int caster)
if (kiku_shielding_player)
{
- if(!player_res_torment())
+ if (!player_res_torment())
{
if (random2(600) < you.piety) // 13.33% to 33.33% chance
{
hploss = 0;
- simple_god_message(" shields you entirely from torment!");
- } else if (random2(250) < you.piety) { // 24% to 80% chance
- hploss -= random2(hploss - 1);
simple_god_message(" shields you from torment!");
}
+ else if (random2(250) < you.piety) // 24% to 80% chance
+ {
+ hploss -= random2(hploss - 1);
+ simple_god_message(" partially shields you from torment!");
+ }
}
}
@@ -262,7 +262,11 @@ int torment_player(int pow, int caster)
case TORMENT_XOM:
type = KILLED_BY_XOM;
- aux = "Xom's torment";
+ aux = "Xom's torment";
+ break;
+
+ case TORMENT_KIKUBAAQUDGHA:
+ aux = "Kikubaaqudgha's torment";
break;
}
}
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 58c2c95b13..9fdfcfc2b0 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -58,7 +58,7 @@ enum ability_type
ABIL_TSO_DIVINE_SHIELD = 120, // 120
ABIL_TSO_CLEANSING_FLAME,
ABIL_TSO_SUMMON_DIVINE_WARRIOR,
- ABIL_KIKU_RECEIVE_CORPSE = 130, // 130
+ ABIL_KIKU_RECEIVE_CORPSES = 130, // 130
ABIL_YRED_INJURY_MIRROR = 139,
ABIL_YRED_ANIMATE_REMAINS, // 140
ABIL_YRED_RECALL_UNDEAD_SLAVES,
@@ -262,6 +262,7 @@ enum beam_type // beam[].flavour
BEAM_POTION_MUTAGENIC,
BEAM_POTION_BLUE_SMOKE,
BEAM_POTION_PURP_SMOKE, // 60
+ BEAM_POTION_RAIN,
BEAM_POTION_RANDOM,
BEAM_LAST_REAL = BEAM_POTION_RANDOM,
@@ -440,6 +441,7 @@ enum cloud_type
CLOUD_MIASMA,
CLOUD_MIST,
CLOUD_CHAOS,
+ CLOUD_RAIN,
CLOUD_MUTAGENIC,
CLOUD_RANDOM = 98,
CLOUD_DEBUGGING = 99 // 99: used once as 'nonexistent cloud' {dlb}
@@ -837,7 +839,6 @@ enum delay_type
DELAY_MEMORISE,
DELAY_BUTCHER,
DELAY_BOTTLE_BLOOD,
- DELAY_OFFER_CORPSE,
DELAY_WEAPON_SWAP, // for easy_butcher
DELAY_PASSWALL,
DELAY_DROP_ITEM,
@@ -2937,12 +2938,13 @@ enum targetting_type
enum torment_source_type
{
- TORMENT_GENERIC = -1,
- TORMENT_CARDS = -2, // Symbol of torment
- TORMENT_SPWLD = -3, // Special wield torment
- TORMENT_SCROLL = -4,
- TORMENT_SPELL = -5, // SPELL_SYMBOL_OF_TORMENT
- TORMENT_XOM = -6 // Xom effect
+ TORMENT_GENERIC = -1,
+ TORMENT_CARDS = -2, // Symbol of torment
+ TORMENT_SPWLD = -3, // Special wield torment
+ TORMENT_SCROLL = -4,
+ TORMENT_SPELL = -5, // SPELL_SYMBOL_OF_TORMENT
+ TORMENT_XOM = -6, // Xom effect
+ TORMENT_KIKUBAAQUDGHA = -7 // Kikubaaqudgha effect
};
enum trap_type // env.trap_type[]
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index ef190433ea..1426d83ad6 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -14,7 +14,7 @@ REVISION("$Rev$");
#include <stdio.h>
#include <algorithm>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
@@ -29,7 +29,6 @@ REVISION("$Rev$");
#include "effects.h"
#include "food.h"
#include "invent.h"
-#include "it_use2.h"
#include "items.h"
#include "itemname.h"
#include "itemprop.h"
@@ -40,7 +39,6 @@ REVISION("$Rev$");
#include "message.h"
#include "misc.h"
#include "monplace.h"
-#include "mon-pick.h"
#include "monstuff.h"
#include "mon-util.h"
#include "mstuff2.h"
@@ -52,7 +50,6 @@ REVISION("$Rev$");
#include "skills.h"
#include "spells1.h"
#include "spells3.h"
-#include "spells4.h"
#include "spl-mis.h"
#include "spl-util.h"
#include "state.h"
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc
index b6a87e8cd3..2e627db619 100644
--- a/crawl-ref/source/files.cc
+++ b/crawl-ref/source/files.cc
@@ -22,7 +22,7 @@ REVISION("$Rev$");
#include <algorithm>
#include <functional>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#include <file.h>
#endif
@@ -32,7 +32,7 @@ REVISION("$Rev$");
#include <unistd.h>
#endif
-#ifdef __MINGW32__
+#ifdef TARGET_COMPILER_MINGW
#include <io.h>
#endif
@@ -51,7 +51,6 @@ REVISION("$Rev$");
#include "effects.h"
#include "ghost.h"
#include "initfile.h"
-#include "itemname.h"
#include "itemprop.h"
#include "items.h"
#include "kills.h"
@@ -70,7 +69,6 @@ REVISION("$Rev$");
#include "overmap.h"
#include "place.h"
#include "player.h"
-#include "skills2.h"
#include "stash.h"
#include "state.h"
#include "stuff.h"
@@ -80,7 +78,6 @@ REVISION("$Rev$");
#include "travel.h"
#include "tutorial.h"
#include "view.h"
-#include "xom.h"
#if _MSC_VER
#include <direct.h>
@@ -91,7 +88,7 @@ REVISION("$Rev$");
#endif
#ifndef HAVE_STAT
-#if defined(UNIX) || defined(__MINGW32__) || defined(DOS)
+#if defined(UNIX) || defined(TARGET_COMPILER_MINGW) || defined(TARGET_OS_DOS)
#define HAVE_STAT
#endif
#endif
@@ -145,7 +142,7 @@ static bool _is_uid_file(const std::string &name, const std::string &ext)
{
std::string save_suffix = get_savedir_filename("", "", "");
save_suffix += ext;
-#ifdef DOS
+#ifdef TARGET_OS_DOS
// Grumble grumble. Hang all retarded operating systems.
uppercase(save_suffix);
#endif
@@ -201,7 +198,7 @@ static inline bool _is_good_filename(const std::string &s)
return (s != "." && s != "..");
}
-#if defined(DOS)
+#if defined(TARGET_OS_DOS)
// Abbreviates a given file name to DOS style "xxxxxx~1.txt".
// Does not take into account files with differing suffixes or files
// with a prepended path with more than one separator.
@@ -412,7 +409,7 @@ static int _create_directory(const char *dir)
{
#if defined(MULTIUSER)
return mkdir(dir, SHARED_FILES_CHMOD_PUBLIC | 0111);
-#elif defined(DOS)
+#elif defined(TARGET_OS_DOS)
return mkdir(dir, 0755);
#elif defined(_MSC_VER)
return _mkdir(dir);
@@ -517,7 +514,7 @@ std::string datafile_path(std::string basename,
#else
!SysEnv.crawl_dir.empty()? SysEnv.crawl_dir : "",
#endif
-#ifdef OSX
+#ifdef TARGET_OS_MACOSX
SysEnv.crawl_base + "../Resources/",
#endif
};
@@ -789,7 +786,7 @@ std::string get_savedir_filename(const std::string &prefix,
result += extension;
}
-#ifdef DOS
+#ifdef TARGET_OS_DOS
uppercase(result);
#endif
return result;
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index cb5d951f17..e31cf2963b 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -15,7 +15,7 @@ REVISION("$Rev$");
#include <stdio.h>
#include <ctype.h>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
@@ -28,7 +28,6 @@ REVISION("$Rev$");
#include "debug.h"
#include "delay.h"
#include "effects.h"
-#include "initfile.h"
#include "invent.h"
#include "items.h"
#include "itemname.h"
@@ -358,36 +357,32 @@ static bool _butcher_corpse(int corpse_id, bool first_corpse = true,
const bool can_sac = you.duration[DUR_PRAYER]
&& god_likes_butchery(you.religion);
- if (can_sac && !rotten)
+ if (can_sac)
{
- start_delay(DELAY_OFFER_CORPSE, 0, corpse_id);
-
- // Kiku torments if you butcher a corpse while praying.
- if (you.religion == GOD_KIKUBAAQUDGHA
- && you.piety >= piety_breakpoint(4))
+ if (!rotten)
{
- simple_god_message(" inflicts torment against the living!");
- torment(TORMENT_GENERIC, you.pos());
- you.piety -= 8 + random2(4); // 8 to 12
+ offer_and_butcher_corpse(corpse_id);
+
+ // Kikubaaqudgha torments if you butcher a fresh corpse
+ // while praying.
+ if (you.religion == GOD_KIKUBAAQUDGHA
+ && you.piety >= piety_breakpoint(4))
+ {
+ simple_god_message(" inflicts torment against the living!");
+ torment(TORMENT_KIKUBAAQUDGHA, you.pos());
+ you.piety -= 8 + random2(4); // 8 to 12
+ }
}
+ else
+ simple_god_message(" refuses to accept that mouldy sacrifice!");
}
else
{
- if (can_sac && rotten)
- {
- simple_god_message(coinflip() ? " refuses to accept that"
- " mouldy sacrifice!"
- : " demands fresh blood!",
- you.religion);
- }
-
// Start work on the first corpse we butcher.
if (first_corpse)
mitm[corpse_id].plus2++;
- int work_req = 4 - mitm[corpse_id].plus2;
- if (work_req < 0)
- work_req = 0;
+ int work_req = std::max(0, 4 - mitm[corpse_id].plus2);
delay_type dtype = DELAY_BUTCHER;
if (!force_butcher && !rotten
@@ -2270,10 +2265,10 @@ void vampire_nutrition_per_turn(const item_def &corpse, int feeding)
break;
case MONS_ELF:
- food_value += random2avg((you.experience_level * 10)/duration, 2);
+ food_value += random2avg((you.experience_level * 10) / duration, 2);
- // Elven blood gives a bit of mana at the end of feeding, but
- // only from fairly fresh corpses.
+ // Elven blood gives a bit of mana at the end of feeding,
+ // but only from fairly fresh corpses.
if (corpse.special > 150)
{
if (end_feeding)
@@ -2298,7 +2293,6 @@ void vampire_nutrition_per_turn(const item_def &corpse, int feeding)
case CE_CONTAMINATED:
food_value /= 2;
-
if (start_feeding)
mpr("Somehow this blood was not very filling!");
else if (end_feeding && corpse.special > 150)
@@ -2306,11 +2300,11 @@ void vampire_nutrition_per_turn(const item_def &corpse, int feeding)
break;
case CE_POISONOUS:
- make_hungry(food_value/2, false);
- // Always print this message - maybe you lost poison res.
- // due to feeding.
+ make_hungry(food_value / 2, false);
+ // Always print this message - maybe you lost poison
+ // resistance due to feeding.
mpr("Blech - this blood tastes nasty!");
- if (poison_player( 1 + random2(3) ))
+ if (poison_player(1 + random2(3)))
xom_is_stimulated(random2(128));
stop_delay();
return;
@@ -2320,7 +2314,7 @@ void vampire_nutrition_per_turn(const item_def &corpse, int feeding)
if (start_feeding)
mpr("This blood tastes really weird!");
mutate(RANDOM_MUTATION);
- did_god_conduct( DID_DELIBERATE_MUTATING, 10);
+ did_god_conduct(DID_DELIBERATE_MUTATING, 10);
xom_is_stimulated(100);
// Sometimes heal by one hp.
if (end_feeding && corpse.special > 150 && coinflip())
@@ -2332,14 +2326,14 @@ void vampire_nutrition_per_turn(const item_def &corpse, int feeding)
if (start_feeding)
mpr("This blood tastes *really* weird.");
give_bad_mutation();
- did_god_conduct( DID_DELIBERATE_MUTATING, 10);
+ did_god_conduct(DID_DELIBERATE_MUTATING, 10);
xom_is_stimulated(random2(200));
// No healing from bad mutagenic blood.
break;
case CE_HCL:
- rot_player( 5 + random2(5) );
- if (disease_player( 50 + random2(100) ))
+ rot_player(5 + random2(5));
+ if (disease_player(50 + random2(100)))
xom_is_stimulated(random2(100));
stop_delay();
break;
diff --git a/crawl-ref/source/ghost.cc b/crawl-ref/source/ghost.cc
index 527dd1e90a..f78487fed4 100644
--- a/crawl-ref/source/ghost.cc
+++ b/crawl-ref/source/ghost.cc
@@ -22,7 +22,6 @@ REVISION("$Rev$");
#include "place.h"
#include "player.h"
#include "religion.h"
-#include "view.h"
#include <vector>
#define MAX_GHOST_DAMAGE 50
diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc
index 793b38d1cc..f094715974 100644
--- a/crawl-ref/source/hiscores.cc
+++ b/crawl-ref/source/hiscores.cc
@@ -55,7 +55,6 @@ REVISION("$Rev$");
#include "stuff.h"
#include "tags.h"
#include "version.h"
-#include "view.h"
#include "skills2.h"
#define SCORE_VERSION "0.1"
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index 42ea9f3a90..cf175bc4db 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -537,7 +537,6 @@ void game_options::set_default_activity_interrupts()
"interrupt_memorise = interrupt_armour_on, stat",
"interrupt_butcher = interrupt_armour_on, teleport, stat",
"interrupt_bottle_blood = interrupt_butcher",
- "interrupt_offer_corpse = interrupt_butcher, hungry",
"interrupt_vampire_feed = interrupt_butcher",
"interrupt_passwall = interrupt_butcher",
"interrupt_multidrop = interrupt_butcher",
@@ -655,17 +654,17 @@ void game_options::reset_options()
#if defined(SAVE_DIR_PATH)
save_dir = SAVE_DIR_PATH "/saves/";
morgue_dir = SAVE_DIR_PATH "/morgue/";
-#elif defined(OSX)
+#elif defined(TARGET_OS_MACOSX)
std::string tmp_path_base = std::string(getenv("HOME")) + "/Library/Application Support/" CRAWL;
save_dir = tmp_path_base + "/saves/";
morgue_dir = tmp_path_base + "/morgue/";
-#elif !defined(DOS)
+#elif !defined(TARGET_OS_DOS)
save_dir = "saves/";
#else
save_dir.clear();
#endif
-#if !defined(SHORT_FILE_NAMES) && !defined(SAVE_DIR_PATH) && !defined(OSX)
+#if !defined(SHORT_FILE_NAMES) && !defined(SAVE_DIR_PATH) && !defined(TARGET_OS_MACOSX)
morgue_dir = "morgue/";
#endif
@@ -813,7 +812,7 @@ void game_options::reset_options()
#endif
easy_exit_menu = true;
-#ifdef DOS
+#ifdef TARGET_OS_DOS
dos_use_background_intensity = false;
#else
dos_use_background_intensity = true;
@@ -3248,7 +3247,7 @@ std::string game_options::resolve_include(
// favoured file separator.
parent_file = canonicalise_file_separator(parent_file);
included_file = canonicalise_file_separator(included_file);
-#if defined(DOS)
+#if defined(TARGET_OS_DOS)
get_dos_compatible_file_name(&included_file);
#endif
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index da8c03e877..aad492a8cf 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -15,7 +15,7 @@ REVISION("$Rev$");
#include <sstream>
#include <iomanip>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc
index e76cc41675..2d22aaa6b7 100644
--- a/crawl-ref/source/it_use3.cc
+++ b/crawl-ref/source/it_use3.cc
@@ -27,7 +27,6 @@ REVISION("$Rev$");
#include "invent.h"
#include "items.h"
#include "item_use.h"
-#include "it_use2.h"
#include "itemname.h"
#include "itemprop.h"
#include "los.h"
@@ -35,7 +34,6 @@ REVISION("$Rev$");
#include "message.h"
#include "monplace.h"
#include "misc.h"
-#include "overmap.h"
#include "player.h"
#include "religion.h"
#include "skills.h"
@@ -44,7 +42,6 @@ REVISION("$Rev$");
#include "spells2.h"
#include "spl-book.h"
#include "spl-cast.h"
-#include "spl-util.h"
#include "state.h"
#include "stuff.h"
#include "view.h"
@@ -442,6 +439,16 @@ static bool _disc_of_storms(void)
zapping(which_zap, 30 + you.skills[SK_EVOCATIONS] * 2, beam);
}
+
+ for (radius_iterator ri(you.pos(), LOS_RADIUS, false); ri; ++ri)
+ {
+ if (grd(*ri) < DNGN_MAXWALL)
+ continue;
+
+ if (one_chance_in(60 - you.skills[SK_EVOCATIONS]))
+ place_cloud(CLOUD_RAIN, *ri,
+ random2(you.skills[SK_EVOCATIONS]), KC_YOU);
+ }
}
return (rc);
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index f074ea20a0..4d3a0c5974 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -61,7 +61,6 @@ REVISION("$Rev$");
#include "spl-util.h"
#include "state.h"
#include "stuff.h"
-#include "tiles.h"
#include "transfor.h"
#include "traps.h"
#include "tutorial.h"
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index f25cfc89c6..982b98c137 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -14,7 +14,7 @@ REVISION("$Rev$");
#include <ctype.h>
#include <string.h>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
#include "clua.h"
@@ -23,11 +23,9 @@ REVISION("$Rev$");
#include "artefact.h"
#include "decks.h"
-#include "describe.h"
#include "food.h"
#include "initfile.h"
#include "invent.h"
-#include "it_use2.h"
#include "item_use.h"
#include "itemprop.h"
#include "items.h"
@@ -2605,6 +2603,8 @@ bool is_useless_item(const item_def &item, bool temp)
case POT_POISON:
case POT_STRONG_POISON:
// If you're poison resistant, poison is only useless.
+ // Spriggans could argue, but it's too small gain for possible
+ // player confusion.
return (player_res_poison(false));
}
@@ -2625,7 +2625,7 @@ bool is_useless_item(const item_def &item, bool temp)
{
case AMU_RAGE:
return (you.is_undead
- && (!temp || you.species == SP_VAMPIRE
+ && (you.species != SP_VAMPIRE || temp
&& you.hunger_state <= HS_SATIATED)
|| you.religion == GOD_TROG);
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index 99db6bd23e..1094b2dd83 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -14,7 +14,7 @@ REVISION("$Rev$");
#include <stdlib.h>
#include <stdio.h>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
@@ -26,17 +26,14 @@ REVISION("$Rev$");
#include "invent.h"
#include "items.h"
#include "itemprop.h"
-#include "it_use2.h"
#include "macro.h"
#include "mon-util.h"
#include "monstuff.h"
#include "notes.h"
#include "player.h"
#include "quiver.h"
-#include "skills2.h"
#include "stuff.h"
#include "transfor.h"
-#include "view.h"
#include "xom.h"
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index d6bcc32ed1..2e0d7a7015 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -16,7 +16,7 @@ REVISION("$Rev$");
#include <stdio.h>
#include <ctype.h>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
@@ -26,7 +26,6 @@ REVISION("$Rev$");
#include "artefact.h"
#include "beam.h"
#include "branch.h"
-#include "cloud.h"
#include "debug.h"
#include "delay.h"
#include "dgnevent.h"
@@ -44,11 +43,9 @@ REVISION("$Rev$");
#include "misc.h"
#include "monplace.h"
#include "monstuff.h"
-#include "mstuff2.h"
#include "mon-util.h"
#include "mutation.h"
#include "notes.h"
-#include "overmap.h"
#include "place.h"
#include "player.h"
#include "quiver.h"
@@ -56,14 +53,11 @@ REVISION("$Rev$");
#include "shopping.h"
#include "skills2.h"
#include "spl-book.h"
-#include "spl-util.h"
#include "state.h"
#include "stuff.h"
#include "stash.h"
-#include "tiles.h"
#include "state.h"
#include "terrain.h"
-#include "transfor.h"
#include "tutorial.h"
#include "view.h"
#include "xom.h"
@@ -1481,6 +1475,13 @@ static void _got_item(item_def& item, int quant)
_check_note_item(item);
}
+void note_inscribe_item(item_def &item)
+{
+ _autoinscribe_item(item);
+ _origin_freeze(item, you.pos());
+ _check_note_item(item);
+}
+
// Returns quantity of items moved into player's inventory and -1 if
// the player's inventory is full.
int move_item_to_player( int obj, int quant_got, bool quiet,
@@ -1643,10 +1644,7 @@ int move_item_to_player( int obj, int quant_got, bool quiet,
if (!item.slot)
item.slot = index_to_letter(item.link);
- _autoinscribe_item( item );
-
- _origin_freeze(item, you.pos());
- _check_note_item(item);
+ note_inscribe_item(item);
item.quantity = quant_got;
if (is_blood_potion(mitm[obj]))
diff --git a/crawl-ref/source/items.h b/crawl-ref/source/items.h
index fc33f88062..aa70cee2f7 100644
--- a/crawl-ref/source/items.h
+++ b/crawl-ref/source/items.h
@@ -38,6 +38,7 @@ void inc_mitm_item_quantity(int obj, int amount);
bool move_item_to_grid( int *const obj, const coord_def& p );
void move_item_stack_to_grid( const coord_def& from, const coord_def& to );
+void note_inscribe_item(item_def &item);
int move_item_to_player( int obj, int quant_got, bool quiet = false,
bool ignore_burden = false );
void mark_items_non_pickup_at(const coord_def &pos);
diff --git a/crawl-ref/source/kills.cc b/crawl-ref/source/kills.cc
index a70c627585..6b7aef270d 100644
--- a/crawl-ref/source/kills.cc
+++ b/crawl-ref/source/kills.cc
@@ -9,13 +9,11 @@ REVISION("$Rev$");
#include <algorithm>
-#include "chardump.h"
#include "describe.h"
#include "mon-util.h"
#include "monstuff.h"
#include "files.h"
#include "ghost.h"
-#include "itemname.h"
#include "place.h"
#include "travel.h"
#include "tags.h"
@@ -398,6 +396,9 @@ std::string apostrophise(const std::string &name)
if (name.empty())
return (name);
+ if (name == "it" || name == "It")
+ return (name + "s");
+
const char lastc = name[name.length() - 1];
return (name + (lastc == 's' ? "'" : "'s"));
}
diff --git a/crawl-ref/source/libdos.cc b/crawl-ref/source/libdos.cc
index 00b804f5b5..b14137241a 100644
--- a/crawl-ref/source/libdos.cc
+++ b/crawl-ref/source/libdos.cc
@@ -15,7 +15,7 @@ REVISION("$Rev$");
#include <termios.h>
#include <conio.h>
-#if defined(DOS)
+#if defined(TARGET_OS_DOS)
static bool cursor_is_enabled = true;
@@ -138,4 +138,4 @@ void putwch(unsigned c)
putch(static_cast<char>(c));
}
-#endif /* #if defined(DOS) */
+#endif /* #if defined(TARGET_OS_DOS) */
diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc
index e548d111dd..189a44e8c4 100644
--- a/crawl-ref/source/libgui.cc
+++ b/crawl-ref/source/libgui.cc
@@ -14,22 +14,11 @@ REVISION("$Rev$");
#include "cio.h"
#include "defines.h"
-#include "describe.h"
#include "directn.h"
-#include "files.h"
-#include "food.h"
-#include "itemname.h"
#include "itemprop.h"
-#include "items.h"
-#include "it_use2.h"
#include "externs.h"
#include "tilereg.h"
-#include "initfile.h"
#include "message.h"
-#include "misc.h"
-#include "mon-util.h"
-#include "newgame.h"
-#include "player.h"
#include "stash.h"
#include "state.h"
#include "stuff.h"
diff --git a/crawl-ref/source/libunix.cc b/crawl-ref/source/libunix.cc
index d2f7a0c36d..03c1631b9a 100644
--- a/crawl-ref/source/libunix.cc
+++ b/crawl-ref/source/libunix.cc
@@ -32,7 +32,6 @@ REVISION("$Rev$");
#include "enum.h"
#include "externs.h"
#include "files.h"
-#include "initfile.h"
#include "state.h"
#include "stuff.h"
#include "view.h"
@@ -627,7 +626,7 @@ void unixcurses_shutdown()
/* Convert value to string */
-int itoa(int value, char *strptr, int radix)
+extern "C" char *itoa(int value, char *strptr, int radix)
{
unsigned int bitmask = 32768;
int ctr = 0;
@@ -662,7 +661,7 @@ int itoa(int value, char *strptr, int radix)
strptr[ctr] = (char) NULL;
}
- return (OK); /* Me? Fail? Nah. */
+ return strptr;
}
int cprintf(const char *format,...)
@@ -1132,7 +1131,7 @@ int wherey()
}
-int stricmp( const char *str1, const char *str2 )
+extern "C" int stricmp( const char *str1, const char *str2 )
{
return (strcmp(str1, str2));
}
diff --git a/crawl-ref/source/libunix.h b/crawl-ref/source/libunix.h
index 0d6a623d9c..11d5c8a019 100644
--- a/crawl-ref/source/libunix.h
+++ b/crawl-ref/source/libunix.h
@@ -35,12 +35,12 @@ int clrscr(void);
int cprintf(const char *format,...);
int gotoxy_sys(int x, int y);
void fakecursorxy(int x, int y);
-int itoa(int value, char *strptr, int radix);
+extern "C" char *itoa(int value, char *strptr, int radix);
int kbhit(void);
int putch(unsigned char chr);
int putwch(unsigned chr);
void put_colour_ch(int colour, unsigned ch);
-int stricmp(const char *str1, const char *str2);
+extern "C" int stricmp(const char *str1, const char *str2);
int translate_keypad(int keyin);
int wherex(void);
int wherey(void);
diff --git a/crawl-ref/source/libutil.cc b/crawl-ref/source/libutil.cc
index 6c3e60be9d..b1bae48d62 100644
--- a/crawl-ref/source/libutil.cc
+++ b/crawl-ref/source/libutil.cc
@@ -8,7 +8,6 @@ REVISION("$Rev$");
#include "defines.h"
#include "directn.h"
-#include "initfile.h"
#include "itemname.h" // is_vowel()
#include "libutil.h"
#include "externs.h"
@@ -32,7 +31,7 @@ REVISION("$Rev$");
#ifdef REGEX_PCRE
// Statically link pcre on Windows
- #if defined(WIN32CONSOLE) || defined(WIN32TILES) || defined(DOS)
+ #if defined(WIN32CONSOLE) || defined(WIN32TILES) || defined(TARGET_OS_DOS)
#define PCRE_STATIC
#endif
diff --git a/crawl-ref/source/libw32c.cc b/crawl-ref/source/libw32c.cc
index 9dccba9c83..1c0c4d9b59 100644
--- a/crawl-ref/source/libw32c.cc
+++ b/crawl-ref/source/libw32c.cc
@@ -58,7 +58,7 @@ REVISION("$Rev$");
// END -- WINDOWS INCLUDES
-#ifdef __MINGW32__
+#ifdef TARGET_COMPILER_MINGW
#include <signal.h>
#endif
@@ -289,7 +289,7 @@ static void init_colors(char *windowTitle)
// if not found, quit.
}
-#ifdef __MINGW32__
+#ifdef TARGET_COMPILER_MINGW
static void install_sighandlers()
{
signal(SIGINT, SIG_IGN);
@@ -369,7 +369,7 @@ void init_libw32c(void)
// TODO: Respect changing cursor size manually while Crawl is running.
have_initial_cci = GetConsoleCursorInfo( outbuf, &initial_cci );
-#ifdef __MINGW32__
+#ifdef TARGET_COMPILER_MINGW
install_sighandlers();
#endif
diff --git a/crawl-ref/source/los.cc b/crawl-ref/source/los.cc
index f7a77bd82f..64f04818dc 100644
--- a/crawl-ref/source/los.cc
+++ b/crawl-ref/source/los.cc
@@ -1,6 +1,6 @@
/*
- * File: los.cc
- * Summary: Line-of-sight algorithm.
+ * File: los.cc
+ * Summary: Line-of-sight algorithm.
*/
#include "AppHdr.h"
@@ -11,7 +11,7 @@ REVISION("$Rev$");
#include <cmath>
#include <algorithm>
-#include "cloud.h"
+#include "bitary.h"
#include "debug.h"
#include "directn.h"
#include "externs.h"
@@ -24,8 +24,6 @@ REVISION("$Rev$");
// The LOS code now uses raycasting -- haranp
#define LONGSIZE (sizeof(unsigned long)*8)
-#define LOS_MAX_RANGE_X 9
-#define LOS_MAX_RANGE_Y 9
#define LOS_MAX_RANGE 9
// the following two constants represent the 'middle' of the sh array.
@@ -38,24 +36,44 @@ const int sh_xo = 9; // X and Y origins for the sh array
const int sh_yo = 9;
const coord_def sh_o = coord_def(sh_xo, sh_yo);
-unsigned long* los_blockrays = NULL;
-unsigned long* dead_rays = NULL;
-unsigned long* smoke_rays = NULL;
-std::vector<short> ray_coord_x;
-std::vector<short> ray_coord_y;
-std::vector<short> compressed_ray_x;
-std::vector<short> compressed_ray_y;
-std::vector<int> raylengths;
-std::vector<ray_def> fullrays;
+// These store all unique (in terms of footprint) full rays.
+// The footprint of fullray[i] consists of fullray[i].length cells,
+// whose coordinates are stored in ray_coords after the
+// coordinates of fullray[i-1].
+// These are filled during precomputation (_register_ray).
+struct los_ray;
+std::vector<los_ray> fullrays;
+std::vector<coord_def> ray_coords;
+
+// These store certain unique subsequences of ray_coords.
+// Filled during precomputation (_create_blockrays)
+std::vector<coord_def> compressed_ray;
+
+// 3D bit array indexed by x coord, y coord, cellray index.
+// Bit los_blockrays[x][y][i] is set iff a wall at (x,y) blocks
+// the cellray starting at compressed_ray[i].
+typedef FixedArray<bit_array*, LOS_MAX_RANGE+1, LOS_MAX_RANGE+1> blockrays_t;
+blockrays_t los_blockrays;
+
+// Temporary arrays used in losight() to track which rays
+// are blocked or have seen a smoke cloud.
+// Allocated when doing the precomputations.
+bit_array *dead_rays = NULL;
+bit_array *smoke_rays = NULL;
void clear_rays_on_exit()
{
- delete[] dead_rays;
- delete[] smoke_rays;
- delete[] los_blockrays;
+ delete dead_rays;
+ delete smoke_rays;
+ for (int x = 0; x <= LOS_MAX_RANGE; x++)
+ for (int y = 0; y <= LOS_MAX_RANGE; y++)
+ delete los_blockrays[x][y];
}
-int _los_radius_squared = LOS_RADIUS * LOS_RADIUS + 1;
+// pre-squared LOS radius
+#define LOS_RADIUS2 (LOS_RADIUS * LOS_RADIUS + 1)
+
+int _los_radius_squared = LOS_RADIUS2;
void setLOSRadius(int newLR)
{
@@ -68,122 +86,126 @@ int get_los_radius_squared()
return _los_radius_squared;
}
-bool _get_bit_in_long_array( const unsigned long* data, int where )
-{
- int wordloc = where / LONGSIZE;
- int bitloc = where % LONGSIZE;
- return ((data[wordloc] & (1UL << bitloc)) != 0);
-}
-
-static void _set_bit_in_long_array( unsigned long* data, int where )
-{
- int wordloc = where / LONGSIZE;
- int bitloc = where % LONGSIZE;
- data[wordloc] |= (1UL << bitloc);
-}
-
-bool double_is_zero( const double x )
+bool double_is_zero(const double x)
{
return (x > -EPSILON_VALUE) && (x < EPSILON_VALUE);
}
-// Check if the passed ray has already been created.
-static bool _is_duplicate_ray( int len, int xpos[], int ypos[] )
+struct los_ray : ray_def
{
- int cur_offset = 0;
- for (unsigned int i = 0; i < raylengths.size(); ++i)
+ unsigned int start;
+ unsigned int length;
+
+ los_ray(double ax, double ay, double s)
+ : ray_def(ax, ay, s, QUAD_SE), length(0)
{
- // Only compare equal-length rays.
- if (raylengths[i] != len)
- {
- cur_offset += raylengths[i];
- continue;
- }
+ }
- int j;
- for (j = 0; j < len; ++j)
+ // Shoot a ray from the given start point (accx, accy) with the given
+ // slope, bounded by the given pre-squared LOS radius.
+ std::vector<coord_def> footprint(int radius2)
+ {
+ std::vector<coord_def> cs;
+ los_ray copy = *this;
+ coord_def c;
+ int cellnum;
+ for (cellnum = 0; true; ++cellnum)
{
- if (ray_coord_x[j + cur_offset] != xpos[j]
- || ray_coord_y[j + cur_offset] != ypos[j])
- {
+ copy.raw_advance_0();
+ c = copy.pos();
+ if (c.abs() > radius2)
break;
- }
+ cs.push_back(c);
}
+ return cs;
+ }
- // Exact duplicate?
- if (j == len)
- return (true);
-
- // Move to beginning of next ray.
- cur_offset += raylengths[i];
+ coord_def operator[](unsigned int i)
+ {
+ ASSERT(0 <= i && i < length);
+ return ray_coords[start+i];
}
- return (false);
+};
+
+// Check if the passed rays have identical footprint.
+static bool _is_same_ray(los_ray ray, std::vector<coord_def> newray)
+{
+ if (ray.length != newray.size())
+ return false;
+ for (unsigned int i = 0; i < ray.length; i++)
+ if (ray[i] != newray[i])
+ return false;
+ return true;
+}
+
+// Check if the passed ray has already been created.
+static bool _is_duplicate_ray(std::vector<coord_def> newray)
+{
+ for (unsigned int i = 0; i < fullrays.size(); ++i)
+ if (_is_same_ray(fullrays[i], newray))
+ return true;
+ return false;
}
// Is starta...lengtha a subset of startb...lengthb?
-static bool _is_subset( int starta, int startb, int lengtha, int lengthb )
+static bool _is_subset(int starta, int startb, int lengtha, int lengthb)
{
int cura = starta, curb = startb;
int enda = starta + lengtha, endb = startb + lengthb;
while (cura < enda && curb < endb)
{
- if (ray_coord_x[curb] > ray_coord_x[cura])
+ if (ray_coords[curb].x > ray_coords[cura].x)
return (false);
- if (ray_coord_y[curb] > ray_coord_y[cura])
+ if (ray_coords[curb].y > ray_coords[cura].y)
return (false);
- if (ray_coord_x[cura] == ray_coord_x[curb]
- && ray_coord_y[cura] == ray_coord_y[curb])
- {
- ++cura;
- }
+ if (ray_coords[cura] == ray_coords[curb])
+ ++cura;
- ++curb;
+ ++curb;
}
return (cura == enda);
}
// Returns a vector which lists all the nonduped cellrays (by index).
+// A cellray c in a fullray f is duped if there is a fullray g
+// such that g contains c and g[:c] is a subset of f[:c].
static std::vector<int> _find_nonduped_cellrays()
{
- // A cellray c in a fullray f is duped if there is a fullray g
- // such that g contains c and g[:c] is a subset of f[:c].
- int raynum, cellnum, curidx, testidx, testray, testcell;
bool is_duplicate;
-
std::vector<int> result;
- for (curidx = 0, raynum = 0;
- raynum < static_cast<int>(raylengths.size());
- curidx += raylengths[raynum++])
+
+ for (unsigned int r = 0; r < fullrays.size(); ++r)
{
- for (cellnum = 0; cellnum < raylengths[raynum]; ++cellnum)
+ los_ray ray = fullrays[r];
+ for (unsigned int i = 0; i < ray.length; ++i)
{
- // Is the cellray raynum[cellnum] duplicated?
+ // Is the cellray ray[0..i] duplicated?
is_duplicate = false;
+
// XXX: We should really check everything up to now
// completely, and all further rays to see if they're
// proper subsets.
- const int curx = ray_coord_x[curidx + cellnum];
- const int cury = ray_coord_y[curidx + cellnum];
- for (testidx = 0, testray = 0; testray < raynum;
- testidx += raylengths[testray++])
+
+ // Test against all previous fullrays.
+ for (unsigned int s = 0; s < r; ++s)
{
+ los_ray prev = fullrays[s];
+
// Scan ahead to see if there's an intersect.
- for (testcell = 0; testcell < raylengths[raynum]; ++testcell)
+ for (unsigned int j = 0; j < prev.length; ++j)
{
- const int testx = ray_coord_x[testidx + testcell];
- const int testy = ray_coord_y[testidx + testcell];
- // We can short-circuit sometimes.
- if (testx > curx || testy > cury)
+ // Short-circuit if we've passed ray[i]
+ // in either coordinate.
+ if (prev[j].x > ray[i].x || prev[j].y > ray[i].y)
break;
- // Bingo!
- if (testx == curx && testy == cury)
+ if (prev[j] == ray[i])
{
- is_duplicate = _is_subset(testidx, curidx,
- testcell, cellnum);
+ is_duplicate = _is_subset(prev.start, ray.start,
+ j, i);
break;
}
}
@@ -191,117 +213,81 @@ static std::vector<int> _find_nonduped_cellrays()
break; // No point in checking further rays.
}
if (!is_duplicate)
- result.push_back(curidx + cellnum);
+ result.push_back(ray.start + i);
}
}
return result;
}
// Create and register the ray defined by the arguments.
-// Return true if the ray was actually registered (i.e., not a duplicate.)
-static bool _register_ray( double accx, double accy, double slope )
+static void _register_ray(double accx, double accy, double slope)
{
- int xpos[LOS_MAX_RANGE * 2 + 1], ypos[LOS_MAX_RANGE * 2 + 1];
- int raylen = shoot_ray(accx, accy, slope, LOS_MAX_RANGE, xpos, ypos);
-
- // Early out if ray already exists.
- if (_is_duplicate_ray(raylen, xpos, ypos))
- return (false);
+ los_ray ray = los_ray(accx, accy, slope);
+ std::vector<coord_def> coords = ray.footprint(LOS_RADIUS2);
- // Not duplicate, register.
- for (int i = 0; i < raylen; ++i)
- {
- // Create the cellrays.
- ray_coord_x.push_back(xpos[i]);
- ray_coord_y.push_back(ypos[i]);
- }
+ if (_is_duplicate_ray(coords))
+ return;
- // Register the fullray.
- raylengths.push_back(raylen);
- ray_def ray;
- ray.accx = accx;
- ray.accy = accy;
- ray.slope = slope;
- ray.quadrant = 0;
+ ray.start = ray_coords.size();
+ ray.length = coords.size();
+ for (unsigned int i = 0; i < coords.size(); i++)
+ ray_coords.push_back(coords[i]);
fullrays.push_back(ray);
-
- return (true);
}
static void _create_blockrays()
{
// determine nonduplicated rays
- std::vector<int> nondupe_cellrays = _find_nonduped_cellrays();
- const unsigned int num_nondupe_rays = nondupe_cellrays.size();
- const unsigned int num_nondupe_words =
- (num_nondupe_rays + LONGSIZE - 1) / LONGSIZE;
- const unsigned int num_cellrays = ray_coord_x.size();
- const unsigned int num_words = (num_cellrays + LONGSIZE - 1) / LONGSIZE;
-
- // first build all the rays: easier to do blocking calculations there
- unsigned long* full_los_blockrays;
- full_los_blockrays = new unsigned long[num_words * (LOS_MAX_RANGE_X+1) *
- (LOS_MAX_RANGE_Y+1)];
- memset((void*)full_los_blockrays, 0, sizeof(unsigned long) * num_words *
- (LOS_MAX_RANGE_X+1) * (LOS_MAX_RANGE_Y+1));
+ std::vector<int> nondupe_cellrays = _find_nonduped_cellrays();
+ const int num_nondupe_rays = nondupe_cellrays.size();
+ const int num_cellrays = ray_coords.size();
+ blockrays_t full_los_blockrays;
- int cur_offset = 0;
+ for (int x = 0; x <= LOS_MAX_RANGE; ++x)
+ for (int y = 0; y <= LOS_MAX_RANGE; ++y)
+ {
+ full_los_blockrays[x][y] = new bit_array(num_cellrays);
+ los_blockrays[x][y] = new bit_array(num_nondupe_rays);
+ }
- for (unsigned int ray = 0; ray < raylengths.size(); ++ray)
+ // first build all the rays: easier to do blocking calculations there
+ for (unsigned int r = 0; r < fullrays.size(); ++r)
{
- for (int i = 0; i < raylengths[ray]; ++i)
+ los_ray ray = fullrays[r];
+ for (unsigned int i = 0; i < ray.length; ++i)
{
- // every cell blocks...
- unsigned long* const inptr = full_los_blockrays +
- (ray_coord_x[i + cur_offset] * (LOS_MAX_RANGE_Y + 1) +
- ray_coord_y[i + cur_offset]) * num_words;
-
- // ...all following cellrays
- for (int j = i+1; j < raylengths[ray]; ++j)
- _set_bit_in_long_array( inptr, j + cur_offset );
-
+ coord_def p = ray[i];
+ // every cell blocks all following cellrays
+ for (unsigned int j = i + 1; j < ray.length; ++j)
+ full_los_blockrays(p)->set(ray.start+j);
}
- cur_offset += raylengths[ray];
}
// we've built the basic blockray array; now compress it, keeping
// only the nonduplicated cellrays.
- // allocate and clear memory
- los_blockrays = new unsigned long[num_nondupe_words * (LOS_MAX_RANGE_X+1) * (LOS_MAX_RANGE_Y + 1)];
- memset((void*)los_blockrays, 0, sizeof(unsigned long) * num_nondupe_words *
- (LOS_MAX_RANGE_X+1) * (LOS_MAX_RANGE_Y+1));
-
// we want to only keep the cellrays from nondupe_cellrays.
- compressed_ray_x.resize(num_nondupe_rays);
- compressed_ray_y.resize(num_nondupe_rays);
- for (unsigned int i = 0; i < num_nondupe_rays; ++i)
- {
- compressed_ray_x[i] = ray_coord_x[nondupe_cellrays[i]];
- compressed_ray_y[i] = ray_coord_y[nondupe_cellrays[i]];
- }
- unsigned long* oldptr = full_los_blockrays;
- unsigned long* newptr = los_blockrays;
- for (int x = 0; x <= LOS_MAX_RANGE_X; ++x)
- for (int y = 0; y <= LOS_MAX_RANGE_Y; ++y)
- {
- for (unsigned int i = 0; i < num_nondupe_rays; ++i)
- if (_get_bit_in_long_array(oldptr, nondupe_cellrays[i]))
- _set_bit_in_long_array(newptr, i);
+ compressed_ray.resize(num_nondupe_rays);
+ for (int i = 0; i < num_nondupe_rays; ++i)
+ compressed_ray[i] = ray_coords[nondupe_cellrays[i]];
- oldptr += num_words;
- newptr += num_nondupe_words;
- }
+ for (int x = 0; x <= LOS_MAX_RANGE; ++x)
+ for (int y = 0; y <= LOS_MAX_RANGE; ++y)
+ for (int i = 0; i < num_nondupe_rays; ++i)
+ los_blockrays[x][y]->set(i,
+ full_los_blockrays[x][y]->get(nondupe_cellrays[i]));
// we can throw away full_los_blockrays now
- delete[] full_los_blockrays;
+ for (int x = 0; x <= LOS_MAX_RANGE; ++x)
+ for (int y = 0; y <= LOS_MAX_RANGE; ++y)
+ delete full_los_blockrays[x][y];
- dead_rays = new unsigned long[num_nondupe_words];
- smoke_rays = new unsigned long[num_nondupe_words];
+ dead_rays = new bit_array(num_nondupe_rays);
+ smoke_rays = new bit_array(num_nondupe_rays);
#ifdef DEBUG_DIAGNOSTICS
mprf( MSGCH_DIAGNOSTICS, "Cellrays: %d Fullrays: %u Compressed: %u",
- num_cellrays, raylengths.size(), num_nondupe_rays );
+ num_cellrays, fullrays.size(), num_nondupe_rays );
#endif
}
@@ -337,8 +323,8 @@ void raycast()
// register perpendiculars FIRST, to make them top choice
// when selecting beams
- _register_ray( 0.5, 0.5, 1000.0 );
- _register_ray( 0.5, 0.5, 0.0 );
+ _register_ray(0.5, 0.5, 1000.0);
+ _register_ray(0.5, 0.5, 0.0);
// For a slope of M = y/x, every x we move on the X axis means
// that we move y on the y axis. We want to look at the resolution
@@ -349,24 +335,24 @@ void raycast()
// Changing the order a bit. We want to order by the complexity
// of the beam, which is log(x) + log(y) ~ xy.
std::vector<std::pair<int,int> > xyangles;
- for ( int xangle = 1; xangle <= 2*LOS_MAX_RANGE; ++xangle )
- for ( int yangle = 1; yangle <= 2*LOS_MAX_RANGE; ++yangle )
+ for (int xangle = 1; xangle <= 2*LOS_MAX_RANGE; ++xangle)
+ for (int yangle = 1; yangle <= 2*LOS_MAX_RANGE; ++yangle)
{
- if ( _gcd(xangle, yangle) == 1 )
+ if (_gcd(xangle, yangle) == 1)
xyangles.push_back(std::pair<int,int>(xangle, yangle));
}
- std::sort( xyangles.begin(), xyangles.end(), complexity_lt );
- for ( unsigned int i = 0; i < xyangles.size(); ++i )
+ std::sort(xyangles.begin(), xyangles.end(), complexity_lt);
+ for (unsigned int i = 0; i < xyangles.size(); ++i)
{
const int xangle = xyangles[i].first;
const int yangle = xyangles[i].second;
const double slope = ((double)(yangle)) / xangle;
const double rslope = ((double)(xangle)) / yangle;
- for ( int intercept = 1; intercept <= 2*yangle; ++intercept )
+ for (int intercept = 1; intercept <= 2*yangle; ++intercept )
{
- double xstart = ((double)(intercept)) / (2*yangle);
+ double xstart = ((double)intercept) / (2*yangle);
double ystart = 1;
// now move back just inside the cell
@@ -374,9 +360,9 @@ void raycast()
xstart -= EPSILON_VALUE * xangle;
ystart -= EPSILON_VALUE * yangle;
- _register_ray( xstart, ystart, slope );
+ _register_ray(xstart, ystart, slope);
// also draw the identical ray in octant 2
- _register_ray( ystart, xstart, rslope );
+ _register_ray(ystart, xstart, rslope);
}
}
@@ -384,27 +370,26 @@ void raycast()
_create_blockrays();
}
-static void _set_ray_quadrant( ray_def& ray, int sx, int sy, int tx, int ty )
+static void _set_ray_quadrant(ray_def& ray, int sx, int sy, int tx, int ty)
{
if ( tx >= sx && ty >= sy )
- ray.quadrant = 0;
+ ray.quadrant = QUAD_SE;
else if ( tx < sx && ty >= sy )
- ray.quadrant = 1;
+ ray.quadrant = QUAD_SW;
else if ( tx < sx && ty < sy )
- ray.quadrant = 2;
+ ray.quadrant = QUAD_NW;
else if ( tx >= sx && ty < sy )
- ray.quadrant = 3;
+ ray.quadrant = QUAD_NE;
else
mpr("Bad ray quadrant!", MSGCH_DIAGNOSTICS);
}
-static int _cyclic_offset( unsigned int ui, int cycle_dir, int startpoint,
- int maxvalue )
+static int _cyclic_offset(int i, int cycle_dir, int startpoint,
+ int maxvalue)
{
- const int i = (int)ui;
- if ( startpoint < 0 )
+ if (startpoint < 0)
return i;
- switch ( cycle_dir )
+ switch (cycle_dir)
{
case 1:
return (i + startpoint + 1) % maxvalue;
@@ -461,11 +446,11 @@ static bool _superior_ray(int shortest, int imbalance,
// If find_shortest is true, examine all rays that hit the target and
// take the shortest (starting at ray.fullray_idx).
-bool find_ray( const coord_def& source, const coord_def& target,
- bool allow_fallback, ray_def& ray, int cycle_dir,
- bool find_shortest, bool ignore_solid )
+bool find_ray(const coord_def& source, const coord_def& target,
+ bool allow_fallback, ray_def& ray, int cycle_dir,
+ bool find_shortest, bool ignore_solid)
{
- int cellray, inray;
+ unsigned int cellray, inray;
const int sourcex = source.x;
const int sourcey = source.y;
@@ -476,6 +461,7 @@ bool find_ray( const coord_def& source, const coord_def& target,
const int signy = ((targety - sourcey >= 0) ? 1 : -1);
const int absx = signx * (targetx - sourcex);
const int absy = signy * (targety - sourcey);
+ const coord_def abs = coord_def(absx, absy);
int cur_offset = 0;
int shortest = INFINITE_DISTANCE;
@@ -484,19 +470,15 @@ bool find_ray( const coord_def& source, const coord_def& target,
double slope_diff = VERTICAL_SLOPE * 10.0;
std::vector<coord_def> unaliased_ray;
- for ( unsigned int fray = 0; fray < fullrays.size(); ++fray )
+ for (unsigned int fray = 0; fray < fullrays.size(); ++fray)
{
- const int fullray = _cyclic_offset( fray, cycle_dir, ray.fullray_idx,
- fullrays.size() );
- // Yeah, yeah, this is O(n^2). I know.
- cur_offset = 0;
- for (int i = 0; i < fullray; ++i)
- cur_offset += raylengths[i];
-
- for (cellray = 0; cellray < raylengths[fullray]; ++cellray)
+ const int fullray = _cyclic_offset(fray, cycle_dir, ray.fullray_idx,
+ fullrays.size());
+ los_ray lray = fullrays[fullray];
+
+ for (cellray = 0; cellray < lray.length; ++cellray)
{
- if (ray_coord_x[cellray + cur_offset] == absx
- && ray_coord_y[cellray + cur_offset] == absy)
+ if (lray[cellray] == abs)
{
if (find_shortest)
{
@@ -510,8 +492,8 @@ bool find_ray( const coord_def& source, const coord_def& target,
int real_length = 0;
for (inray = 0; inray <= cellray; ++inray)
{
- const int xi = signx * ray_coord_x[inray + cur_offset];
- const int yi = signy * ray_coord_y[inray + cur_offset];
+ const int xi = signx * ray_coords[inray + cur_offset].x;
+ const int yi = signy * ray_coords[inray + cur_offset].y;
if (inray < cellray && !ignore_solid
&& grid_is_solid(grd[sourcex + xi][sourcey + yi]))
{
@@ -575,7 +557,7 @@ bool find_ray( const coord_def& source, const coord_def& target,
}
const double ray_slope_diff = find_shortest ?
- fabs(_slope_factor(fullrays[fullray]) - want_slope) : 0.0;
+ fabs(_slope_factor(lray) - want_slope) : 0.0;
if (!blocked
&& (!find_shortest
@@ -584,7 +566,7 @@ bool find_ray( const coord_def& source, const coord_def& target,
slope_diff, ray_slope_diff)))
{
// Success!
- ray = fullrays[fullray];
+ ray = lray;
ray.fullray_idx = fullray;
shortest = real_length;
@@ -730,18 +712,14 @@ bool cell_see_cell(const coord_def& p1, const coord_def& p2)
void _losight_quadrant(env_show_grid& sh, const los_param& dat, int sx, int sy)
{
- const unsigned int num_cellrays = compressed_ray_x.size();
- const unsigned int num_words = (num_cellrays + LONGSIZE - 1) / LONGSIZE;
+ const unsigned int num_cellrays = compressed_ray.size();
// clear out the dead rays array
- memset( (void*)dead_rays, 0, sizeof(unsigned long) * num_words);
- memset( (void*)smoke_rays, 0, sizeof(unsigned long) * num_words);
+ dead_rays->reset();
+ smoke_rays->reset();
- // kill all blocked rays
- const unsigned long* inptr = los_blockrays;
-
- for (int x = 0; x <= LOS_MAX_RANGE_X; ++x)
- for (int y = 0; y <= LOS_MAX_RANGE_Y; ++y, inptr += num_words)
+ for (int x = 0; x <= LOS_MAX_RANGE; ++x)
+ for (int y = 0; y <= LOS_MAX_RANGE; ++y)
{
coord_def p = coord_def(sx*x, sy*y);
if (!dat.los_bounds(p))
@@ -752,46 +730,31 @@ void _losight_quadrant(env_show_grid& sh, const los_param& dat, int sx, int sy)
{
case OPC_OPAQUE:
// then block the appropriate rays
- for (unsigned int i = 0; i < num_words; ++i)
- dead_rays[i] |= inptr[i];
+ *dead_rays |= *los_blockrays[x][y];
break;
case OPC_HALF:
// block rays which have already seen a cloud
- for (unsigned int i = 0; i < num_words; ++i)
- {
- dead_rays[i] |= (smoke_rays[i] & inptr[i]);
- smoke_rays[i] |= inptr[i];
- }
+ *dead_rays |= (*smoke_rays & *los_blockrays[x][y]);
+ *smoke_rays |= *los_blockrays[x][y];
break;
default:
break;
}
}
- // ray calculation done, now work out which cells in this
- // quadrant are visible
- unsigned int rayidx = 0;
- for (unsigned int wordloc = 0; wordloc < num_words; ++wordloc)
+ // Ray calculation done. Now work out which cells in this
+ // quadrant are visible.
+ for (unsigned int rayidx = 0; rayidx < num_cellrays; ++rayidx)
{
- const unsigned long curword = dead_rays[wordloc];
- // Note: the last word may be incomplete
- for (unsigned int bitloc = 0; bitloc < LONGSIZE; ++bitloc)
+ // make the cells seen by this ray at this point visible
+ if (!dead_rays->get(rayidx))
{
- // make the cells seen by this ray at this point visible
- if ( ((curword >> bitloc) & 1UL) == 0 )
- {
- // this ray is alive!
- const coord_def p = coord_def(sx * compressed_ray_x[rayidx],
- sy * compressed_ray_y[rayidx]);
- // update shadow map
- if (dat.los_bounds(p))
- {
- sh(p+sh_o) = dat.appearance(p);
- }
- }
- ++rayidx;
- if (rayidx == num_cellrays)
- break;
+ // this ray is alive!
+ const coord_def p = coord_def(sx * compressed_ray[rayidx].x,
+ sy * compressed_ray[rayidx].y);
+ // update shadow map
+ if (dat.los_bounds(p))
+ sh(p+sh_o) = dat.appearance(p);
}
}
}
@@ -807,9 +770,7 @@ void losight(env_show_grid& sh, const los_param& dat)
const int quadrant_y[4] = { 1, 1, -1, -1 };
for (int q = 0; q < 4; ++q)
- {
_losight_quadrant(sh, dat, quadrant_x[q], quadrant_y[q]);
- }
// center is always visible
const coord_def o = coord_def(0,0);
@@ -844,9 +805,9 @@ void calc_show_los()
}
}
-bool see_grid( const env_show_grid &show,
- const coord_def &c,
- const coord_def &pos )
+bool see_grid(const env_show_grid &show,
+ const coord_def &c,
+ const coord_def &pos)
{
if (c == pos)
return (true);
@@ -862,7 +823,7 @@ bool see_grid( const env_show_grid &show,
}
// Answers the question: "Is a grid within character's line of sight?"
-bool see_grid( const coord_def &p )
+bool see_grid(const coord_def &p)
{
return ((crawl_state.arena || crawl_state.arena_suspended)
&& crawl_view.in_grid_los(p))
@@ -871,14 +832,13 @@ bool see_grid( const coord_def &p )
// Answers the question: "Would a grid be within character's line of sight,
// even if all translucent/clear walls were made opaque?"
-bool see_grid_no_trans( const coord_def &p )
+bool see_grid_no_trans(const coord_def &p)
{
return see_grid(env.no_trans_show, you.pos(), p);
}
// Is the grid visible, but a translucent wall is in the way?
-bool trans_wall_blocking( const coord_def &p )
+bool trans_wall_blocking(const coord_def &p)
{
return see_grid(p) && !see_grid_no_trans(p);
}
-
diff --git a/crawl-ref/source/luadgn.h b/crawl-ref/source/luadgn.h
index 22216e5ac6..2f87436482 100644
--- a/crawl-ref/source/luadgn.h
+++ b/crawl-ref/source/luadgn.h
@@ -7,7 +7,6 @@
#ifndef LUADGN_H
#define LUADGN_H
-#include "AppHdr.h"
#include "clua.h"
// Defined in acr.cc
diff --git a/crawl-ref/source/macro.cc b/crawl-ref/source/macro.cc
index 4c2c5b40bf..eeb5442f58 100644
--- a/crawl-ref/source/macro.cc
+++ b/crawl-ref/source/macro.cc
@@ -39,7 +39,6 @@ REVISION("$Rev$");
#include <cstdlib>
#include "cio.h"
-#include "delay.h"
#include "externs.h"
#include "message.h"
#include "state.h"
diff --git a/crawl-ref/source/makefile b/crawl-ref/source/makefile
index 03861c74db..437d4a2076 100644
--- a/crawl-ref/source/makefile
+++ b/crawl-ref/source/makefile
@@ -1,55 +1,696 @@
-#Makefile chooser. Choose one:
+#
+# Dungeon Crawl Stone Soup
+# GNU Makefile
+#
+# largely written by Steven Noonan <steven@uplinklabs.net>
+# (if something breaks, blame him.)
+#
-MAKEFILE ?= makefile.unix
-#MAKEFILE ?= makefile.dos
-#MAKEFILE ?= makefile.osx
-#MAKEFILE ?= makefile.mgw
-#MAKEFILE ?= makefile_tiles.mgw
-#MAKEFILE ?= makefile_tiles.unix
+GAME = crawl
-#These are for cross-compiling purposes on crawl.develz.org, here for convenience:
+CC = gcc
+CXX = g++
+DELETE = rm -f
+COPY = cp
-#MAKEFILE ?= makefile.mgw_unix
-#MAKEFILE ?= makefile_tiles.mgw_unix
+export CC
+export CXX
-all:
- +$(MAKE) -f $(MAKEFILE)
+#
+# Platform Detection
+#
+# Use the variable OSNAME if you need to add something that's
+# platform-specific.
+# The valid OSNAME values are currently:
+# 'WIN32': alias for MinGW and Cygwin
+# 'MacOS': alias for Darwin (Mac OS X)
+# and non-translated values from other platforms (values from
+# 'uname -s' call). So Linux is simply 'Linux', etc.
+#
+UNAME_S := $(shell uname -s | cut -d'_' -f1)
+OSNAME =
+ifeq ($(UNAME_S),MINGW32)
+OSNAME = WIN32
+endif
+ifeq ($(UNAME_S),CYGWIN)
+OSNAME = WIN32
+endif
+ifeq ($(UNAME_S),Darwin)
+OSNAME = MacOS
+endif
+ifeq ($(OSNAME),)
+OSNAME = $(UNAME_S)
+endif
-profile:
- +$(MAKE) -f $(MAKEFILE) EXTRA_FLAGS='-pg'
+ifeq ($(OSNAME),WIN32)
+GAME = crawl.exe
+endif
-noopt:
- +$(MAKE) -f $(MAKEFILE)
+TILES = n
-install:
- +$(MAKE) -f $(MAKEFILE) install
+#
+# Set up object file dependencies for $(GAME) target.
+#
+include makefile.obj
+
+# Works for Mac OS X and Linux.
+OBJECTS += crash-u.o
+
+ifneq ($(TILES),n)
+OBJECTS += libgui.o tile2.o tilereg.o tilepick.o tilesdl.o tilefont.o tiletex.o tilemcache.o tilebuf.o
+else
+ifneq ($(UNAME_S),MINGW32)
+OBJECTS += libunix.o
+else
+OBJECTS += libw32c.o
+endif
+endif
+
+# To get stack trace symbols.
+# Note that MinGW doesn't support -rdynamic.
+ifeq ($(OSNAME),WIN32)
+LDFLAGS :=
+else
+LDFLAGS := -rdynamic
+endif
+
+# Change this to y (case-sensitive!) if you want to use Unicode glyphs
+# in the map, and you have libncursesw available.
+UNICODE_GLYPHS = n
+# Usually, it can be autodetected for you:
+ifneq ($(shell ls /usr/include/ncursesw 2> /dev/null),)
+UNICODE_GLYPHS = y
+endif
+
+
+# If you're using UNICODE_GLYPHS=y, and have a preferred Unicode
+# (UTF-8) locale you want Crawl to use, you can set it here. The
+# default is en_US.UTF-8. If you'd prefer that Crawl use the locale
+# as set in your environment LC_* variables, use UNICODE_LOCALE = .
+UNICODE_LOCALE =
+
+# If you have lex and yacc, set DOYACC to y (lowercase y).
+DOYACC := y
+
+# Permissions to set on the game executable.
+MCHMOD := 2755
+
+# Permissions to set on the save directory.
+MCHMOD_SAVEDIR := 775
+
+# The user:group to install the game as.
+INSTALL_UGRP := games:games
+
+INSTALLDIR := /usr/games/crawl
+
+# If you're installing Crawl for multiple users, you *must* set this to a
+# valid path before building Crawl. This is not necessary if you are building
+# Crawl for a single user.
+
+# SAVEDIR := /usr/games/crawl/saves/
+# DATADIR := /usr/games/crawl/data/
+
+PCH := n
+
+# libpcre
+PCRESRC := util/pcre/
+PCRELIB := pcre
+PCRELIBA := lib$(PCRELIB).a
+FPCRELIBA := $(PCRESRC)$(PCRELIBA)
+
+# LUA
+LUASRC := util/lua/src/
+LUALIB := lua
+LUALIBA := lib$(LUALIB).a
+FLUALIBA := $(LUASRC)$(LUALIBA)
+
+# SQLite
+SQLSRC := util/sqlite/
+SQLLIB := sqlite3
+SQLLIBA := lib$(SQLLIB).a
+FSQLLIBA := $(SQLSRC)$(SQLLIBA)
+
+LIBDBM := $(FSQLLIBA)
+EXTRA_INCLUDES += -I$(SQLSRC)
+EXTRA_DEPENDS += $(FSQLLIBA)
+
+LIB := -L$(LUASRC) -l$(LUALIB) $(LIBDBM)
+
+INCLUDES += -Iutil -I. -I$(LUASRC) $(EXTRA_INCLUDES)
+
+ifeq ($(OSNAME),MacOS)
+
+# Compatibility level for Mac OS X
+#
+SDK_VER=10.4
+GCC_VER=4.0
+
+# FIXME: The '-arch i386' is only here until
+# SDL 1.2.14 is available
+#
+ARCHS=-arch i386
+
+# Mac OS X 10.4 adds a 'u' on the end of the SDK name. Everything
+# else is much easier to predict the name of.
+ifeq ($(SDK_VER),10.4)
+SDKROOT=/Developer/SDKs/MacOSX$(SDK_VER)u.sdk
+else
+SDKROOT=/Developer/SDKs/MacOSX$(SDK_VER).sdk
+endif
+
+ifneq ($(GCC_VER),)
+GCC = gcc-$(GCC_VER)
+GCXX = g++-$(GCC_VER)
+else
+GCC = gcc
+GCXX = g++
+endif
+
+CC = $(GCC) $(ARCHS) -isysroot $(SDKROOT) -mmacosx-version-min=$(SDK_VER)
+CXX = $(GCXX) $(ARCHS) -isysroot $(SDKROOT) -mmacosx-version-min=$(SDK_VER)
+
+endif # MacOS
+
+
+#
+# Tiles build stuff
+#
+ifneq ($(TILES),n)
+
+RLTILES = rltiles
+
+DEFINES += -DUSE_TILE
+INCLUDES += -I$(RLTILES)
+
+ifeq ($(OSNAME),MacOS)
+
+# Handle the tile build dependencies for Mac a bit
+# differently than other platforms.
+
+LIB += -framework OpenGL -framework AppKit
+
+# SDL has a goof in the stock SDL_config.h which checks whether
+# __MACOSX__ is defined. It's not one of Apple's stock markers,
+# so we define it ourselves here.
+#
+DEFINES += -D__MACOSX__
+
+EXTRA_OBJECTS += SDLMain.o
+
+# If the /Library/Frameworks folder exists, add a -F flag
+#
+ifneq ($(shell ls -a /Library/Frameworks 2> /dev/null),)
+LIB += -F/Library/Frameworks/
+endif
+
+# Check if our dependencies exist as frameworks. If so, use their
+# headers and link to them.
+#
+ifneq ($(shell ls /Library/Frameworks/SDL.framework 2> /dev/null),)
+INCLUDES += -I/Library/Frameworks/SDL.framework/Headers
+LIB += -framework SDL
+endif
+ifneq ($(shell ls /Library/Frameworks/SDL_image.framework 2> /dev/null),)
+INCLUDES += -I/Library/Frameworks/SDL_image.framework/Headers
+LIB += -framework SDL_image
+endif
+ifneq ($(shell ls /Library/Frameworks/Freetype2.framework 2> /dev/null),)
+INCLUDES += -I/Library/Frameworks/Freetype2.framework/Headers
+LIB += -framework Freetype2
+endif
+ifneq ($(shell ls /Library/Frameworks/libpng.framework 2> /dev/null),)
+INCLUDES += -I/Library/Frameworks/libpng.framework/Headers
+LIB += -framework libpng
+endif
+
+else # MacOS
+
+# Okay, we have to assume we're on something else that
+# uses standard UNIX-like methods for finding libs.
+#
+# For instance, on Linux and most other UNIX-likes,
+# the app pkg-config can provide the appropriate
+# CFLAGS and LDFLAGS.
+#
+
+ifneq ($(shell which pkg-config 2> /dev/null),)
+
+# If pkg-config is available, it's the surest way to find where
+# the contributing libraries are located.
+#
+
+PNG_INCLUDE := $(shell pkg-config libpng --cflags-only-I)
+PNG_CFLAGS := $(shell pkg-config libpng --cflags-only-other)
+PNG_LDFLAGS := $(shell pkg-config libpng --libs)
+
+FREETYPE_INCLUDE := $(shell pkg-config freetype2 --cflags-only-I)
+FREETYPE_CFLAGS := $(shell pkg-config freetype2 --cflags-only-other)
+FREETYPE_LDFLAGS := $(shell pkg-config freetype2 --libs)
+
+SDL_INCLUDE := $(shell pkg-config sdl --cflags-only-I)
+SDL_CFLAGS := $(shell pkg-config sdl --cflags-only-other)
+SDL_LDFLAGS := $(shell pkg-config sdl --libs)
+
+else # pkg-config
+
+# Ugh, pkg-config isn't available. We're probably on MinGW, Cygwin,
+# or some other stupid platform. We've got to assume that the
+# libraries are either in the standard paths or are in /opt/<lib>/.
+#
+
+PNG_INCLUDE := -I/opt/libpng/include
+PNG_CFLAGS :=
+PNG_LDFLAGS := -L/opt/libpng/lib -lpng
+
+FREETYPE_INCLUDE := -I/opt/freetype/include
+FREETYPE_CFLAGS :=
+FREETYPE_LDFLAGS := -L/opt/freetype/lib -lfreetype
+
+ifneq ($(which sdl-config 2> /dev/null),)
+
+# sdl-config is our second best bet...
+#
+SDL_INCLUDE := $(shell sdl-config --cflags | tr ' ' '\n' | grep ^[-]I | tr '\n' ' ')
+SDL_CFLAGS := $(shell sdl-config --cflags | tr ' ' '\n' | grep -v ^[-]I | tr '\n' ' ')
+SDL_LDFLAGS := $(shell sdl-config --libs)
+
+else # sdl-config
+
+# Fine, we have to make some REALLY ugly assumptions...
+#
+SDL_INCLUDE := -I/opt/sdl/include/SDL
+SDL_CFLAGS :=
+SDL_LDFLAGS := -L/opt/sdl/lib -lSDL -lSDLmain
+
+endif # sdl-config
+endif # pkg-config
+
+LIB += $(PNG_LDFLAGS) $(FREETYPE_LDFLAGS) $(SDL_LDFLAGS) -lSDL_image
+LIB += -lGL -lGLU
+
+DEFINES += $(PNG_CFLAGS) $(FREETYPE_CFLAGS) $(SDL_CFLAGS)
+INCLUDES += $(PNG_INCLUDE) $(FREETYPE_INCLUDE) $(SDL_INCLUDE)
+
+endif # MacOS
+
+endif # TILES
+
+
+CFWARN := -Wall -Wno-parentheses -Wwrite-strings -Wshadow -pedantic
+CFOTHERS = -fno-strict-aliasing -fsigned-char $(EXTRA_FLAGS) $(DEFINES) -DCLUA_BINDINGS -pipe $(SDL_CFLAGS)
+
+#
+# Figure out the build settings for this type of build
+#
+
+# Crawl defaults
+# Optimized, no debugging.
+FULLDEBUG=n
+WIZARD=n
+DEBUG=n
+OPTIMIZE=y
+
+# Debug
+# No optimization, full debugging.
+ifeq ($(MAKECMDGOALS),debug)
+FULLDEBUG=y
+WIZARD=y
+DEBUG=y
+OPTIMIZE=n
+endif
+
+# Wizard
+# Optimized, with wizard mode.
+ifeq ($(MAKECMDGOALS),wizard)
+FULLDEBUG=n
+WIZARD=y
+DEBUG=y
+OPTIMIZE=y
+endif
+
+# Profile
+# Optimized, with full debugging.
+ifeq ($(MAKECMDGOALS),profile)
+FULLDEBUG=y
+WIZARD=y
+DEBUG=y
+OPTIMIZE=y
+endif
+
+ifeq ($(FULLDEBUG),y)
+DEFINES += -DFULLDEBUG
+endif
+ifeq ($(DEBUG),y)
+EXTRA_FLAGS += -ggdb
+endif
+ifeq ($(WIZARD),y)
+DEFINES += -DWIZARD
+endif
+ifeq ($(OPTIMIZE),y)
+CFOPTIMIZE := -O2
+else
+CFOPTIMIZE := -O0
+endif
+ifneq ($(PCH),n)
+CFWARN += -Winvalid-pch
+endif
+
+# Cygwin has a panic attack if we do this...
+ifneq ($(UNAME_S),CYGWIN)
+CFWARN += -Wuninitialized
+else
+CFWARN += -Wno-uninitialized
+endif
+
+ifneq ($(strip $(SAVEDIR)),)
+CFOTHERS += '-DSAVE_DIR_PATH="$(strip $(SAVEDIR))"'
+endif
+
+ifneq ($(strip $(DATADIR)),)
+CFOTHERS += '-DDATA_DIR_PATH="$(strip $(DATADIR))"'
+endif
+
+ifeq ($(strip $(UNICODE_GLYPHS)),y)
+# Include path for (n)curses with Unicode support.
+INCLUDES += -I/usr/include/ncursesw
+
+# Your ncurses library may include Unicode support, and you may not have a
+# separate libncursesw; in that case, change this line accordingly.
+LIBCURS = ncursesw
+CFOTHERS += -DUNICODE_GLYPHS
+
+ifneq ($(strip $(UNICODE_LOCALE)),)
+ifneq ($(strip $(UNICODE_LOCALE)),.)
+CFOTHERS += -DUNICODE_LOCALE=\"$(strip $(UNICODE_LOCALE))\"
+else
+CFOTHERS += -DUNICODE_LOCALE=\"\"
+endif
+endif
+
+# The standard ncurses library also supports Unicode on Mac OS/Darwin.
+ifeq ($(shell uname),Darwin)
+LIBCURS = ncurses
+endif
+
+else
+# Include path for curses or ncurses (non-Unicode).
+INCLUDES += -I/usr/include/ncurses
+LIBCURS = ncurses
+endif
+
+ifeq ($(OSNAME),WIN32)
+ifneq ($(TILES),n)
+CFOTHERS += -DWIN32TILES
+else
+CFOTHERS += -DWIN32CONSOLE
+endif
+endif
+
+ifeq ($(OSNAME),WIN32)
+INCLUDES += -Iutil/pcre
+LIB += $(FPCRELIBA)
+else
+LIB += -l$(LIBCURS)
+endif
+
+CFLAGS := $(CFOPTIMIZE) $(CFWARN) $(INCLUDES) $(CFOTHERS)
+YCFLAGS := $(CFOPTIMIZE) $(CFOTHERS) $(INCLUDES)
+
+UTIL = util/
+
+OBJECTS := $(UTIL)levcomp.tab.o $(UTIL)levcomp.lex.o $(OBJECTS)
+
+LEX := $(shell which flex 2> /dev/null)
+YACC := $(shell which bison 2> /dev/null)
+
+ifeq ($(strip $(LEX)),)
+DOYACC := n
+endif
+ifeq ($(strip $(YACC)),)
+DOYACC := n
+endif
+
+ifneq ($(findstring $(MAKEFLAGS),s),s)
+ifndef V
+ QUIET_CC = @echo ' ' CC $@;
+ QUIET_CXX = @echo ' ' CXX $@;
+ QUIET_PCH = @echo ' ' PCH $@;
+ QUIET_LINK = @echo ' ' LINK $@;
+ QUIET_COPY = @echo ' ' COPY $@;
+ QUIET_DEPEND = @echo ' ' DEPEND $@;
+ export V
+endif
+endif
+
+ifneq ($(TILES),n)
+TILEDEFS = dngn main player gui unrand
+TILEDEFPRES = $(TILEDEFS:%=$(RLTILES)/tiledef-%)
+TILEDEFTXTS = $(TILEDEFPRES:%=%.txt)
+TILEDEFOBJS = $(TILEDEFPRES:%=%.o)
+TILEDEFSRCS = $(TILEDEFPRES:%=%.cc)
+TILEDEFHDRS = $(TILEDEFPRES:%=%.h)
+
+TILEFILES = \
+ main.png \
+ player.png \
+ dngn.png \
+ gui.png
+ORIGTILEFILES = $(TILEFILES:%=$(RLTILES)/%)
+DESTTILEFILES = $(TILEFILES:%=dat/tiles/%)
+
+EXTRA_DEPENDS += $(DESTTILEFILES)
+OBJECTS += $(TILEDEFOBJS)
+endif
+
+GAME_DEPENDS := $(LUASRC)$(LUALIBA) $(EXTRA_DEPENDS) $(OBJECTS) $(EXTRA_OBJECTS)
+SRC_PKG_BASE := stone_soup
+SRC_VERSION := $(shell egrep 'VER_NUM *".*"' version.h | cut -d'"' -f2)
+PKG_SRC_DIR := $(SRC_PKG_BASE)-$(SRC_VERSION)-src
+SRC_PKG_TAR := $(PKG_SRC_DIR).tbz2
+SRC_PKG_ZIP := $(PKG_SRC_DIR).zip
+
+ifeq ($(UNAME_S),MINGW32)
+GAME_DEPENDS += $(FPCRELIBA)
+endif
+
+PKG_TIDY_LIST := $(UTIL)*.o $(LEVCOMP) *.o \
+ $(UTIL)*.tab.cc $(UTIL)*.tab.h $(UTIL)*.lex.cc *.ixx
+PKG_EXCLUDES := $(PWD)/misc/src-pkg-excludes.lst
+
+##########################################################################
+
+all: $(GAME)
+
+test: $(GAME)
+ $(PWD)/$(GAME) -test
+
+##########################################################################
+# Dependencies
+
+DEPENDENCY_MKF := makefile.dep
+
+ifeq ($(shell which fastdep 2> /dev/null),)
+depend: $(OBJECTS:.o=.cc)
+ rm -f $(DEPENDENCY_MKF).tmp
+ @for i in $^; do \
+ echo ' ' DEP $$i; \
+ $(CXX) -MM $(CFLAGS) $$i >>$(DEPENDENCY_MKF).tmp 2>/dev/null; \
+ done
+ mv -f $(DEPENDENCY_MKF).tmp $(DEPENDENCY_MKF)
+else
+depend: $(DEPENDENCY_MKF)
+
+%.dep: $(OBJECTS:.o=.cc)
+ $(QUIET_DEPEND)fastdep $(DEFINES) $(INCLUDES) *.h $(OBJECTS:.o=.cc) > $@
+endif
+
+-include $(DEPENDENCY_MKF)
+
+##########################################################################
+# The level compiler
+#
+
+ifeq ($(strip $(DOYACC)),y)
+
+prebuildyacc: $(UTIL)levcomp.tab.cc $(UTIL)levcomp.tab.h $(UTIL)levcomp.lex.cc
+ $(QUIET_COPY)$(COPY) $^ prebuilt/
+
+$(UTIL)levcomp.tab.cc: $(UTIL)levcomp.ypp
+ +@$(MAKE) -C $(UTIL) levcomp.tab.cc
+
+$(UTIL)levcomp.lex.cc: $(UTIL)levcomp.lpp
+ +@$(MAKE) -C $(UTIL) levcomp.lex.cc
+
+else
+
+# Pull the level-compiler stuff up from prebuilt/
+
+$(UTIL)levcomp.tab.cc: prebuilt/levcomp.tab.cc
+ $(QUIET_COPY)$(COPY) prebuilt/*.h $(UTIL)
+ $(QUIET_COPY)$(COPY) $< $@
+
+$(UTIL)levcomp.lex.cc: prebuilt/levcomp.lex.cc
+ $(QUIET_COPY)$(COPY) $< $@
+
+endif
+
+##########################################################################
+
+
+##########################################################################
+# The actual build targets
+#
+
+install: $(GAME)
+ifeq ($(DATADIR),)
+ $(error DATADIR not set! Set DATADIR and run make clean install again)
+endif
+ [ -d $(INSTALLDIR) ] || mkdir -p $(INSTALLDIR)
+ $(COPY) $(GAME) $(INSTALLDIR)
+ chown $(INSTALL_UGRP) $(INSTALLDIR)/$(GAME)
+ chmod $(MCHMOD) $(INSTALLDIR)/$(GAME)
+ mkdir -p $(DATADIR)/dat
+ mkdir -p $(DATADIR)/dat/lua
+ mkdir -p $(DATADIR)/dat/clua
+ mkdir -p $(DATADIR)/dat/descript
+ mkdir -p $(DATADIR)/dat/database
+ $(COPY) dat/*.des $(DATADIR)/dat
+ $(COPY) dat/lua/*.lua $(DATADIR)/dat/lua
+ $(COPY) dat/clua/*.lua $(DATADIR)/dat/clua
+ $(COPY) dat/descript/*.txt $(DATADIR)/dat/descript
+ $(COPY) dat/database/*.txt $(DATADIR)/dat/database
+ mkdir -p $(DATADIR)/settings
+ $(COPY) ../settings/* $(DATADIR)/settings/
+ mkdir -p $(DATADIR)/docs
+ $(COPY) ../docs/*.txt $(DATADIR)/docs
+ chown -R $(INSTALL_UGRP) $(DATADIR)
+ifneq ($(SAVEDIR),)
+ mkdir -p $(SAVEDIR)
+ chown $(INSTALL_UGRP) $(SAVEDIR)
+ chmod $(MCHMOD_SAVEDIR) $(SAVEDIR)
+endif
clean:
- +$(MAKE) -f $(MAKEFILE) clean
+ +$(MAKE) -C $(UTIL) clean
+ $(DELETE) *.o
+ $(DELETE) *.ixx
+
+clean-lua:
+ +$(MAKE) -C $(LUASRC) clean
+
+clean-sql:
+ +$(MAKE) -C $(SQLSRC) clean
+
+distclean: clean clean-lua clean-sql clean-rltiles
+ $(DELETE) bones.*
+ $(DELETE) morgue.txt
+ $(DELETE) scores
+ $(DELETE) $(GAME)
+ $(DELETE) *.sav
+ $(DELETE) core
+ $(DELETE) *.0*
+ $(DELETE) *.lab
+ $(DELETE) $(DEPENDENCY_MKF)
+
+$(GAME): $(GAME_DEPENDS)
+ $(QUIET_LINK)$(CXX) $(LDFLAGS) $(EXTRA_OBJECTS) $(OBJECTS) -o $(GAME) $(LIB)
+
+.PHONY : debug profile wizard
+
+debug: $(GAME)
+profile: $(GAME)
+wizard: $(GAME)
+
+# [ds] Note we don't use the standard CFLAGS here; that's intentional, most
+# flex/bison combos I've tried don't produce code that passes the warnings
+# test.
+
+$(UTIL)%.o: $(UTIL)%.cc
+ $(QUIET_CXX)$(CXX) $(YCFLAGS) -o $@ -c $<
+
+ifneq ($(PCH),n)
+%.h.gch: %.h
+ $(QUIET_PCH)$(CXX) $(CFLAGS) -c $< -o $@
+
+CC_DEP := AppHdr.h.gch
+endif
+
+$(OBJECTS:%.o=%.cc): $(CC_DEP) $(TILEDEFHDRS)
+
+%.o: %.m
+ $(QUIET_CXX)$(CC) $(CFLAGS) -c $< -o $@
+
+%.o: %.cc
+ $(QUIET_CXX)$(CXX) $(CFLAGS) -c $< -o $@
+
+#############################################################################
+# Build PCRE
+
+$(FPCRELIBA):
+ +@$(MAKE) -C $(PCRESRC)
+
+#############################################################################
+# Build Lua
+
+$(FLUALIBA):
+ +@$(MAKE) -C $(LUASRC) crawl_unix
+
+#############################################################################
+# Build SQLite
+
+$(FSQLLIBA):
+ +@$(MAKE) -C $(SQLSRC)
+
+#############################################################################
+# Build unrandart data
+art-data.h: art-data.txt util/art-data.pl art-func.h
+ util/art-data.pl
+
+#############################################################################
+# RLTiles
+#
+
+.PHONY: rltile-build
+rltile-build:
+ $(MAKE) -C $(RLTILES) -f makefile.unix all
+
+$(TILEDEFSRCS): rltile-build
+$(TILEDEFHDRS): rltile-build
+$(ORIGTILEFILES): rltile-build
+
+dat/tiles/%.png: $(RLTILES)/%.png
+ $(QUIET_COPY)$(COPY) $< $@
-distclean:
- +$(MAKE) -f $(MAKEFILE) distclean
+clean-rltiles:
+ +$(MAKE) -C $(RLTILES) -f makefile.unix distclean
-depend:
- +$(MAKE) -f $(MAKEFILE) depend
+#############################################################################
+# Packaging a source tarball for release
+#
-# WIZARD mode currently includes asserts, bounds checking, item checking and
-# monster checking.
-wizard:
- +$(MAKE) -f $(MAKEFILE) debug EXTRA_FLAGS='-g -DWIZARD -DDEBUG -DDEBUG_ITEM_SCAN -DDEBUG_MONS_SCAN'
+# To package, you *must* have lex and yacc to generate the intermediates.
+ifeq ($(DOYACC),y)
+package-source: distclean prebuildyacc pkgtidy depend removeold vlink \
+ pkgtarbz2 pkgzip
-# DEBUG mode includes WIZARD mode as well as copious debugging input
-debug:
- +$(MAKE) -f $(MAKEFILE) DEBUG_CRAWL=y debug EXTRA_FLAGS='-g -DFULLDEBUG -DWIZARD'
+pkgtidy:
+ $(DELETE) $(PKG_TIDY_LIST)
-# [dshaligram] The individual makefile need not necessarily support
-# package-source; only makefile.unix does at the moment.
-package-source:
- +$(MAKE) -f $(MAKEFILE) package-source
+removeold:
+ if [ -f ../../$(SRC_PKG_TAR) ]; then $(DELETE) ../../$(SRC_PKG_TAR); fi
+ if [ -f ../../$(SRC_PKG_ZIP) ]; then $(DELETE) ../../$(SRC_PKG_ZIP); fi
-prebuildyacc:
- +$(MAKE) -f $(MAKEFILE) prebuildyacc
+# [ds] Existing directory names could produce a bad package!
+vlink:
+ cd .. && WHERE=$$PWD && cd .. && \
+ ( [ -e $(PKG_SRC_DIR) ] || ln -sf $$WHERE $(PKG_SRC_DIR) )
-# DO NOT DELETE THIS LINE -- $(MAKE) depend depends on it.
+pkgtarbz2:
+ cd ../.. && tar -ch --bzip2 -f $(SRC_PKG_TAR) \
+ -X $(PKG_EXCLUDES) $(PKG_SRC_DIR)
+pkgzip:
+ cd ../.. && zip -rq $(SRC_PKG_ZIP) $(PKG_SRC_DIR) \
+ -x@$(PKG_EXCLUDES)
+endif
diff --git a/crawl-ref/source/makefile.mgw b/crawl-ref/source/makefile.mgw
deleted file mode 100644
index ec353b9415..0000000000
--- a/crawl-ref/source/makefile.mgw
+++ /dev/null
@@ -1,236 +0,0 @@
-# -*- Makefile -*- for Dungeon Crawl (Win32, MinGW)
-
-# makefile.obj includes a list of object files needed to build Crawl.
-include makefile.obj
-
-ifeq ($(DEBUG_CRAWL),)
-OPATH := rel
-else
-OPATH := dbg
-endif
-
-# need .exe so make will find the right file
-APPNAME = $(OPATH)\crawl.exe
-CXX = g++
-DELETE = del
-COPY = copy
-OS_TYPE = WIN32CONSOLE
-
-INSTALLDIR := $(OPATH)
-
-# If you don't have flex or bison, set DOYACC to N or empty.
-DOYACC := n
-
-LEX := flex
-YACC := bison -y
-
-ifeq ($(LUASRC),)
-LUASRC := util\lua\src
-endif
-
-LUALIB = lua
-LUALIBA = lib$(LUALIB).a
-
-SQLSRC := util\sqlite
-SQLLIB := sqlite3
-SQLIBA := lib$(SQLLIB).a
-FSQLLIBA := $(SQLLIB)\$(SQLIBA)
-
-PCRESRC := util\pcre
-PCRELIB := pcre
-PCRELIBA := lib$(PCRELIB).a
-
-LIB = -static -lwinmm -L$(LUASRC) -l$(LUALIB) -L$(SQLSRC) -l$(SQLLIB) -L$(PCRESRC) -lpcre
-INCLUDES := -Iutil -I. -I$(LUASRC) -I$(SQLSRC) -I$(PCRESRC)
-
-CFWARN := -Wall -Wwrite-strings -Wshadow -pedantic
-
-CFOTHERS := -fsigned-char \
- -fstrict-aliasing \
- -pedantic \
- -O2 \
- -D$(OS_TYPE) $(EXTRA_FLAGS) \
- -DWINMM_PLAY_SOUNDS -DCLUA_BINDINGS
-
-CFLAGS := $(INCLUDES) $(CFWARN) $(CFOTHERS)
-YCFLAGS := $(INCLUDES) $(CFOTHERS)
-
-OBJECTS := $(OBJECTS) libw32c.o crash-w.o
-
-LDFLAGS =
-
-#LIB = -lcurso -lpano
-
-UTIL = util/
-
-YTABC := levcomp.tab.c
-YTABH := levcomp.tab.h
-
-
-ifeq ($(LEX),)
-DOYACC :=
-endif
-
-ifeq ($(YACC),)
-DOYACC :=
-endif
-
-RESOURCE := $(UTIL)crawl.rc
-RESOURCEOBJ := crawlres.o
-WINDRES := windres.exe
-
-# Do the levcomp stuff first because that's the most likely to fail.
-OBJECTS := levcomp.tab.o levcomp.lex.o \
- $(OBJECTS) $(RESOURCEOBJ)
-
-OBJECTS := $(foreach file,$(OBJECTS),$(OPATH)/$(file))
-
-GAME_DEPENDS := prepare $(LUASRC)\$(LUALIBA) $(FSQLLIBA) $(PCRESRC)\$(PCRELIBA) $(OBJECTS)
-
-##########################################################################
-
-all: $(APPNAME)
-
-prepare:
- if not exist $(OPATH) mkdir $(OPATH)
-
-DEPENDENCY_MKF := makefile.dep
--include $(DEPENDENCY_MKF)
-
-##########################################################################
-# The level compiler
-#
-ifeq ($(DOYACC),y)
-
-# [ds] A plague on the broken copy command on Windoze.
-prebuildyacc: $(UTIL)levcomp.lex.cc $(UTIL)levcomp.tab.cc $(UTIL)levcomp.tab.h
- $(subst /,\,for %%f in ($^) do $(COPY) %%f prebuilt)
-
-$(UTIL)levcomp.tab.cc: $(UTIL)levcomp.ypp
- $(subst /,\, cd $(UTIL)) && $(YACC) -d -b levcomp levcomp.ypp
- $(subst /,\, cd $(UTIL)) && move $(YTABC) levcomp.tab.cc
-
-$(UTIL)levcomp.lex.cc: $(UTIL)levcomp.lpp
- $(subst /,\, cd $(UTIL) && $(LEX) -olevcomp.lex.cc levcomp.lpp)
-
-else
-
-$(UTIL)levcomp.tab.cc: prebuilt/levcomp.tab.cc
- $(subst /,\,$(COPY) prebuilt/*.h $(UTIL))
- $(subst /,\,$(COPY) $< $@)
-
-$(UTIL)levcomp.lex.cc: prebuilt/levcomp.lex.cc
- $(subst /,\,$(COPY) $< $@)
-
-endif
-
-##########################################################################
-
-install: $(APPNAME)
-ifneq ($(OPATH),$(INSTALLDIR))
- $(COPY) $(APPNAME) ${INSTALLDIR}
-endif
- mkdir $(INSTALLDIR)\dat 2>nul || echo "" >nul
- mkdir $(INSTALLDIR)\dat\lua 2>null || echo "">nul
- mkdir $(INSTALLDIR)\dat\clua 2>null || echo "">nul
- mkdir $(INSTALLDIR)\dat\descript 2>null || echo "">nul
- mkdir $(INSTALLDIR)\dat\database 2>null || echo "">nul
- mkdir $(INSTALLDIR)\settings 2>null || echo "">nul
- mkdir $(INSTALLDIR)\docs 2>null || echo "">nul
- copy /y dat\*.des $(INSTALLDIR)\dat
- copy /y dat\lua\*.lua $(INSTALLDIR)\dat\lua
- copy /y dat\clua\*.lua $(INSTALLDIR)\dat\clua
- copy /y dat\descript\*.txt $(INSTALLDIR)\dat\descript
- copy /y dat\database\*.txt $(INSTALLDIR)\dat\database
- copy /y ..\settings\* $(INSTALLDIR)\settings
- copy /y ..\docs\* $(INSTALLDIR)\docs
- copy /y ..\* $(INSTALLDIR)
- $(DELETE) $(INSTALLDIR)\*.sh
-
-clean:
- $(DELETE) $(OPATH)\*.o
- $(subst /,\,$(DELETE) $(UTIL)*.o)
- $(subst /,\,$(DELETE) $(UTIL)*.exe)
- $(subst /,\,$(DELETE) $(UTIL)*.lex.cc)
- $(subst /,\,$(DELETE) $(UTIL)*.tab.cc)
- $(subst /,\,$(DELETE) $(UTIL)*.tab.h)
- $(subst /,\,$(DELETE) $(UTIL)*.tab.c)
- $(subst /,\,$(DELETE) *.ixx)
-
-clean-lua:
- cd $(LUASRC) && $(MAKE) clean_win
-
-clean-sql:
- cd $(SQLSRC) && $(MAKE) "RM_F=del /f" clean
-
-clean-pcre:
- cd $(PCRESRC) && $(MAKE) clean
-
-distclean: clean clean-lua clean-sql clean-pcre
- $(DELETE) $(OPATH)\*.o
- $(DELETE) *.o
- $(DELETE) bones.*
- $(DELETE) $(OPATH)\bones.*
- $(DELETE) morgue.txt
- $(DELETE) $(OPATH)\morgue.txt
- $(DELETE) scores
- $(DELETE) $(OPATH)\scores
- $(DELETE) crawl.exe
- $(DELETE) $(subst /,\,$(APPNAME))
- $(DELETE) *.sav
- $(DELETE) $(OPATH)\*.sav
- $(DELETE) core
- $(DELETE) $(OPATH)\core
- $(DELETE) *.0*
- $(DELETE) $(OPATH)\*.0*
- $(DELETE) *.lab
- $(DELETE) $(OPATH)\*.lab
-
-$(APPNAME): $(GAME_DEPENDS)
- ${CXX} ${LDFLAGS} $(CFLAGS) $(OBJECTS) -o $(APPNAME) $(LIB)
- strip $(APPNAME)
-
-debug: $(GAME_DEPENDS)
- ${CXX} ${LDFLAGS} $(CFLAGS) $(OBJECTS) -o $(APPNAME) $(LIB)
-
-profile: $(GAME_DEPENDS)
- ${CXX} -g -p ${LDFLAGS} $(CFLAGS) $(OBJECTS) -o $(APPNAME) $(LIB)
-
-$(OPATH)/%.o: %.cc
- ${CXX} ${CFLAGS} -o $@ -c $<
-
-$(OPATH)/%.o: $(UTIL)%.cc
- $(CXX) $(YCFLAGS) -o $@ -c $<
-
-#############################################################################
-# Build Lua
-
-$(LUASRC)\$(LUALIBA):
- @echo Building Lua...
- @cd $(LUASRC) && $(MAKE) crawl_mingw
-
-#############################################################################
-# Build SQLite
-
-$(FSQLLIBA):
- @echo Building SQLite
- cd $(SQLSRC) && $(MAKE)
-
-#############################################################################
-# Build unrandart data
-art-data.h: art-data.txt util/art-data.pl art-func.h
- util/art-data.pl
-
-#############################################################################
-# Build PCRE
-
-$(PCRESRC)\$(PCRELIBA):
- @echo Building PCRE...
- @cd $(PCRESRC) && $(MAKE)
-
-##########################################################################
-# Resources
-#
-
-$(OPATH)/$(RESOURCEOBJ): $(RESOURCE)
- $(WINDRES) $< $@
diff --git a/crawl-ref/source/makefile.mgw_unix b/crawl-ref/source/makefile.mgw_unix
deleted file mode 100644
index 036b90109e..0000000000
--- a/crawl-ref/source/makefile.mgw_unix
+++ /dev/null
@@ -1,238 +0,0 @@
-# -*- Makefile -*- for Dungeon Crawl (Cross-compiling MinGW for crawl.develz.org)
-
-# makefile.obj includes a list of object files needed to build Crawl.
-include makefile.obj
-
-OPATH := build
-
-# need .exe so make will find the right file
-APPNAME = $(OPATH)/crawl.exe
-CXX = i586-mingw32msvc-g++
-DELETE = rm -f
-COPY = cp
-OS_TYPE = WIN32CONSOLE
-
-ifeq ($(INSTALLDIR),)
-INSTALLDIR := crawl-mingw32
-endif
-
-# If you don't have flex or bison, set DOYACC to N or empty.
-DOYACC := n
-
-LEX := flex
-YACC := bison -y
-
-ifeq ($(LUASRC),)
-LUASRC := util/lua/src
-endif
-
-LUALIB = lua
-LUALIBA = lib$(LUALIB).a
-
-SQLSRC := util/sqlite
-SQLLIB := sqlite3
-SQLIBA := lib$(SQLLIB).a
-FSQLLIBA := $(SQLLIB)/$(SQLIBA)
-
-PCRESRC := util/pcre
-PCRELIB := pcre
-PCRELIBA := lib$(PCRELIB).a
-
-LIB = -static -L$(HOME)/source/mingw32/lib -lwinmm -L$(LUASRC) -l$(LUALIB) -L$(SQLSRC) -l$(SQLLIB) -L$(PCRESRC) -l$(PCRELIB)
-INCLUDES := -Iutil -I. -I$(HOME)/source/mingw32/include -I$(LUASRC) -I$(SQLSRC) -I$(PCRESRC)
-
-CFWARN := -Wwrite-strings
-
-CFOTHERS := -fsigned-char \
- -fstrict-aliasing \
- -pedantic \
- -O2 \
- -D$(OS_TYPE) $(EXTRA_FLAGS) \
- -DWINMM_PLAY_SOUNDS -DCLUA_BINDINGS -DWIZARD
-
-CFLAGS := $(INCLUDES) $(CFWARN) $(CFOTHERS)
-YCFLAGS := $(INCLUDES) $(CFOTHERS)
-
-OBJECTS := $(OBJECTS) libw32c.o crash-w.o
-
-LDFLAGS =
-
-#LIB = -lcurso -lpano
-
-UTIL = util/
-
-YTABC := levcomp.tab.c
-YTABH := levcomp.tab.h
-
-
-ifeq ($(LEX),)
-DOYACC :=
-endif
-
-ifeq ($(YACC),)
-DOYACC :=
-endif
-
-RESOURCE := $(UTIL)crawl.rc
-RESOURCEOBJ := crawlres.o
-WINDRES := i586-mingw32msvc-windres
-
-# Do the levcomp stuff first because that's the most likely to fail.
-OBJECTS := levcomp.tab.o levcomp.lex.o \
- $(OBJECTS) $(RESOURCEOBJ)
-
-OBJECTS := $(foreach file,$(OBJECTS),$(OPATH)/$(file))
-
-GAME_DEPENDS := prepare $(LUASRC)/$(LUALIBA) $(FSQLLIBA) $(PCRESRC)/$(PCRELIBA) $(OBJECTS)
-
-##########################################################################
-
-all: $(APPNAME)
-
-prepare:
- mkdir -p $(OPATH)
-
-DEPENDENCY_MKF := makefile.dep
--include $(DEPENDENCY_MKF)
-
-##########################################################################
-# The level compiler
-#
-ifeq ($(DOYACC),y)
-
-# [ds] A plague on the broken copy command on Windoze.
-prebuildyacc: $(UTIL)levcomp.lex.cc $(UTIL)levcomp.tab.cc $(UTIL)levcomp.tab.h
- $(COPY) $^ prebuilt/
-
-$(UTIL)levcomp.tab.cc: $(UTIL)levcomp.ypp
- cd $(UTIL) && $(YACC) -d -b levcomp levcomp.ypp \
- && mv $(YTABC) levcomp.tab.cc || false
-
-$(UTIL)levcomp.lex.cc: $(UTIL)levcomp.lpp
- cd $(UTIL) && $(LEX) -olevcomp.lex.cc levcomp.lpp
-
-else
-
-$(UTIL)levcomp.tab.cc: prebuilt/levcomp.tab.cc
- $(COPY) prebuilt/*.h $(UTIL)
- $(COPY) $< $@
-
-$(UTIL)levcomp.lex.cc: prebuilt/levcomp.lex.cc
- $(COPY) $< $@
-
-endif
-
-##########################################################################
-
-install: $(APPNAME)
-ifneq ($(OPATH),$(INSTALLDIR))
- mkdir -p $(INSTALLDIR)
- $(COPY) $(APPNAME) ${INSTALLDIR}
-endif
- mkdir -p $(INSTALLDIR)/dat
- mkdir -p $(INSTALLDIR)/dat/clua
- mkdir -p $(INSTALLDIR)/dat/database
- mkdir -p $(INSTALLDIR)/dat/descript
- mkdir -p $(INSTALLDIR)/dat/lua
- mkdir -p $(INSTALLDIR)/docs
- mkdir -p $(INSTALLDIR)/settings
- $(COPY) dat/*.des $(INSTALLDIR)/dat/
- $(COPY) dat/clua/*.lua $(INSTALLDIR)/dat/clua/
- $(COPY) dat/database/*.txt $(INSTALLDIR)/dat/database/
- $(COPY) dat/descript/*.txt $(INSTALLDIR)/dat/descript/
- $(COPY) dat/lua/*.lua $(INSTALLDIR)/dat/lua/
- $(COPY) ../docs/*.txt $(INSTALLDIR)/docs/
- $(COPY) ../docs/changes.stone_soup $(INSTALLDIR)/docs/
- $(COPY) ../CREDITS.txt $(INSTALLDIR)/
- $(COPY) ../README.txt ../README.pdf $(INSTALLDIR)/
- $(COPY) ../licence.txt $(INSTALLDIR)/LICENCE.txt
- $(COPY) ../settings/* $(INSTALLDIR)/settings/
-
-clean:
- $(DELETE) $(OPATH)/*.o
- $(DELETE) $(UTIL)*.o
- $(DELETE) $(UTIL)*.exe
- $(DELETE) $(UTIL)*.lex.cc
- $(DELETE) $(UTIL)*.tab.cc
- $(DELETE) $(UTIL)*.tab.h
- $(DELETE) $(UTIL)*.tab.c
- $(DELETE) *.ixx
-
-clean-lua:
- cd $(LUASRC) && $(MAKE) clean_win
-
-clean-sql:
- cd $(SQLSRC) && $(MAKE) clean
-
-clean-pcre:
- cd $(PCRESRC) && $(MAKE) clean
-
-distclean: clean clean-lua clean-sql clean-pcre
- $(DELETE) $(OPATH)/*.o
- $(DELETE) *.o
- $(DELETE) bones.*
- $(DELETE) $(OPATH)/bones.*
- $(DELETE) morgue.txt
- $(DELETE) $(OPATH)/morgue.txt
- $(DELETE) scores
- $(DELETE) $(OPATH)/scores
- $(DELETE) crawl.exe
- $(DELETE) $(APPNAME)
- $(DELETE) *.sav
- $(DELETE) $(OPATH)/*.sav
- $(DELETE) core
- $(DELETE) $(OPATH)/core
- $(DELETE) *.0*
- $(DELETE) $(OPATH)/*.0*
- $(DELETE) *.lab
- $(DELETE) $(OPATH)/*.lab
-
-$(APPNAME): $(GAME_DEPENDS)
- ${CXX} ${LDFLAGS} $(CFLAGS) $(OBJECTS) -o $(APPNAME) $(LIB)
- i586-mingw32msvc-strip $(APPNAME)
-
-debug: $(GAME_DEPENDS)
- ${CXX} ${LDFLAGS} $(CFLAGS) $(OBJECTS) -o $(APPNAME) $(LIB)
-
-profile: $(GAME_DEPENDS)
- ${CXX} -g -p ${LDFLAGS} $(CFLAGS) $(OBJECTS) -o $(APPNAME) $(LIB)
-
-$(OPATH)/%.o: %.cc
- ${CXX} ${CFLAGS} -o $@ -c $<
-
-$(OPATH)/%.o: $(UTIL)%.cc
- $(CXX) $(YCFLAGS) -o $@ -c $<
-
-#############################################################################
-# Build Lua
-
-$(LUASRC)/$(LUALIBA):
- @echo Building Lua...
- @cd $(LUASRC) && $(MAKE) crawl_mingw
-
-#############################################################################
-# Build SQLite
-
-$(FSQLLIBA):
- @echo Building SQLite
- cd $(SQLSRC) && $(MAKE)
-
-#############################################################################
-# Build unrandart data
-art-data.h: art-data.txt util/art-data.pl art-func.h
- util/art-data.pl
-
-#############################################################################
-# Build PCRE
-
-$(PCRESRC)/$(PCRELIBA):
- @echo Building PCRE...
- @cd $(PCRESRC) && $(MAKE)
-
-##########################################################################
-# Resources
-#
-
-$(OPATH)/$(RESOURCEOBJ): $(RESOURCE)
- $(WINDRES) $< $@
-
diff --git a/crawl-ref/source/makefile.obj b/crawl-ref/source/makefile.obj
index aaa4f4d168..d2e6447573 100644
--- a/crawl-ref/source/makefile.obj
+++ b/crawl-ref/source/makefile.obj
@@ -5,6 +5,7 @@ artefact.o \
acr.o \
arena.o \
beam.o \
+bitary.o \
branch.o \
chardump.o \
cio.o \
diff --git a/crawl-ref/source/makefile.osx b/crawl-ref/source/makefile.osx
deleted file mode 100644
index f1ada8a14a..0000000000
--- a/crawl-ref/source/makefile.osx
+++ /dev/null
@@ -1,40 +0,0 @@
-# -*- Makefile -*- for Dungeon Crawl
-
-PROJECT = Crawl.xcodeproj
-GAME = Crawl
-
-all: $(GAME)
-
-# Xcode handles dependencies, so install does _not_ have to depend on building.
-install:
- xcodebuild -project $(PROJECT) -target $(GAME) -configuration Release install
-
-clean:
- xcodebuild -project $(PROJECT) -target $(GAME) -configuration Release clean
- xcodebuild -project $(PROJECT) -target $(GAME) -configuration Debug clean
- xcodebuild -project $(PROJECT) -target $(GAME) -configuration Wizard clean
-
-distclean: clean
- rm -f bones.*
- rm -f morgue.txt
- rm -f scores
- rm -f $(GAME)
- rm -f *.sav
- rm -f core
- rm -f *.0*
- rm -f *.lab
-
-$(GAME):
- xcodebuild -project $(PROJECT) -target $(GAME) -configuration Release build
-
-debug:
- xcodebuild -project $(PROJECT) -target $(GAME) -configuration Debug build
-
-wizard:
- xcodebuild -project $(PROJECT) -target $(GAME) -configuration Wizard build
-
-devel:
- xcodebuild -project $(PROJECT) -target $(GAME) -configuration Development build
-
-devclean:
- xcodebuild -project $(PROJECT) -target $(GAME) -configuration Development clean
diff --git a/crawl-ref/source/makefile.unix b/crawl-ref/source/makefile.unix
deleted file mode 100644
index 19b20ad7da..0000000000
--- a/crawl-ref/source/makefile.unix
+++ /dev/null
@@ -1,325 +0,0 @@
-# -*- Makefile -*- for Dungeon Crawl (unix)
-
-GAME = crawl
-
-# this file contains a list of the libraries.
-# it will make a variable called OBJECTS that contains all the libraries
-include makefile.obj
-
-OBJECTS += libunix.o crash-u.o
-
-CXX = g++
-DELETE = rm -f
-COPY = cp
-OS_TYPE = UNIX
-# To get stack trace symbols.
-LDFLAGS = -rdynamic
-
-# Change this to y (case-sensitive!) if you want to use Unicode glyphs
-# in the map, and you have libncursesw available.
-UNICODE_GLYPHS = n
-
-# If you're using UNICODE_GLYPHS=y, and have a preferred Unicode
-# (UTF-8) locale you want Crawl to use, you can set it here. The
-# default is en_US.UTF-8. If you'd prefer that Crawl use the locale
-# as set in your environment LC_* variables, use UNICODE_LOCALE = .
-UNICODE_LOCALE =
-
-# If you have lex and yacc, set DOYACC to y (lowercase y).
-DOYACC := y
-
-# Permissions to set on the game executable.
-MCHMOD := 2755
-
-# Permissions to set on the save directory.
-MCHMOD_SAVEDIR := 775
-
-# The user:group to install the game as.
-INSTALL_UGRP := games:games
-
-INSTALLDIR := /usr/games/crawl
-
-# If you're installing Crawl for multiple users, you *must* set this to a
-# valid path before building Crawl. This is not necessary if you are building
-# Crawl for a single user.
-
-# SAVEDIR := /usr/games/crawl/saves/
-# DATADIR := /usr/games/crawl/data/
-
-LEX := flex
-YACC := bison -y
-
-LUASRC := util/lua/src
-LUALIB = lua
-LUALIBA = l$(LUALIB).a
-
-SQLSRC := util/sqlite
-SQLLIB := sqlite3
-SQLLIBA := lib$(SQLLIB).a
-FSQLLIBA := $(SQLSRC)/$(SQLLIBA)
-
-LIBDBM := $(FSQLLIBA)
-EXTRA_INCLUDES += -I$(SQLSRC)
-EXTRA_DEPENDS += $(FSQLLIBA)
-
-LIB = -l$(LIBCURS) -L$(LUASRC) -l$(LUALIB) $(LIBDBM)
-
-INCLUDES := $(INCLUDES) -Iutil -I. -I$(LUASRC) $(EXTRA_INCLUDES)
-
-CFWARN := -Wall -Wno-parentheses -Wwrite-strings -Wshadow -pedantic
-
-CFOTHERS := -fsigned-char -D$(OS_TYPE) $(EXTRA_FLAGS) -DCLUA_BINDINGS
-
-ifneq ($(HURRY),y)
-ifneq ($(DEBUG_CRAWL),y)
-CFWARN += -Wuninitialized
-CFOTHERS += -O2
-endif
-endif
-
-ifneq ($(strip $(SAVEDIR)),)
-CFOTHERS += '-DSAVE_DIR_PATH="$(strip $(SAVEDIR))"'
-endif
-
-ifneq ($(strip $(DATADIR)),)
-CFOTHERS += '-DDATA_DIR_PATH="$(strip $(DATADIR))"'
-endif
-
-ifeq ($(strip $(UNICODE_GLYPHS)),y)
-# Include path for (n)curses with Unicode support.
-INCLUDES += -I/usr/include/ncursesw
-
-# Your ncurses library may include Unicode support, and you may not have a
-# separate libncursesw; in that case, change this line accordingly.
-LIBCURS = ncursesw
-CFOTHERS += -DUNICODE_GLYPHS
-
-ifneq ($(strip $(UNICODE_LOCALE)),)
-ifneq ($(strip $(UNICODE_LOCALE)),.)
-CFOTHERS += -DUNICODE_LOCALE=\"$(strip $(UNICODE_LOCALE))\"
-else
-CFOTHERS += -DUNICODE_LOCALE=\"\"
-endif
-endif
-
-# The standard ncurses library also supports Unicode on Mac OS/Darwin.
-ifeq ($(shell uname),Darwin)
-LIBCURS = ncurses
-endif
-
-else
-# Include path for curses or ncurses (non-Unicode).
-INCLUDES += -I/usr/include/ncurses
-LIBCURS = ncurses
-endif
-
-CFLAGS := $(INCLUDES) $(CFWARN) $(CFOTHERS)
-YCFLAGS := $(INCLUDES) $(CFOTHERS)
-
-UTIL = util/
-
-YTABC := levcomp.tab.c
-YTABH := levcomp.tab.h
-
-OBJECTS := $(UTIL)levcomp.tab.o $(UTIL)levcomp.lex.o $(OBJECTS)
-
-ifeq ($(strip $(LEX)),)
-DOYACC :=
-endif
-
-ifeq ($(strip $(YACC)),)
-DOYACC :=
-endif
-
-GAME_DEPENDS := $(LUASRC)$(LUALIBA) $(EXTRA_DEPENDS) $(OBJECTS)
-SRC_PKG_BASE := stone_soup
-SRC_VERSION := $(shell egrep 'VER_NUM *".*"' version.h | \
- egrep -o '[0-9]\.[0-9](\.[0-9])?')
-PKG_SRC_DIR := $(SRC_PKG_BASE)-$(SRC_VERSION)-src
-SRC_PKG_TAR := $(PKG_SRC_DIR).tbz2
-SRC_PKG_ZIP := $(PKG_SRC_DIR).zip
-
-PKG_TIDY_LIST := $(UTIL)*.o $(LEVCOMP) *.o \
- $(UTIL)*.tab.cc $(UTIL)*.tab.h $(UTIL)*.lex.cc *.ixx
-PKG_EXCLUDES := $(PWD)/misc/src-pkg-excludes.lst
-
-##########################################################################
-
-all: $(GAME)
-
-test: $(GAME)
- $(PWD)/$(GAME) -test
-
-##########################################################################
-# Dependencies
-
-DEPENDENCY_MKF := makefile.dep
-
-depend: $(OBJECTS:.o=.cc)
- rm -f $(DEPENDENCY_MKF).tmp
- @for i in $^; do \
- echo "Updating dependencies for $$i"; \
- $(CXX) -MM $(CFLAGS) $$i >>$(DEPENDENCY_MKF).tmp 2>/dev/null; \
- done
- mv -f $(DEPENDENCY_MKF).tmp $(DEPENDENCY_MKF)
-
--include $(DEPENDENCY_MKF)
-
-##########################################################################
-# The level compiler
-#
-
-ifeq ($(DOYACC),y)
-
-prebuildyacc: $(UTIL)levcomp.tab.cc $(UTIL)levcomp.tab.h $(UTIL)levcomp.lex.cc
- $(COPY) $^ prebuilt/
-
-$(UTIL)levcomp.tab.cc: $(UTIL)levcomp.ypp
- cd $(UTIL) && $(YACC) -d -b levcomp levcomp.ypp \
- && mv $(YTABC) levcomp.tab.cc || false
-
-$(UTIL)levcomp.lex.cc: $(UTIL)levcomp.lpp
- cd $(UTIL) && $(LEX) -olevcomp.lex.cc levcomp.lpp
-
-else
-
-# Pull the level-compiler stuff up from prebuilt/
-
-$(UTIL)levcomp.tab.cc: prebuilt/levcomp.tab.cc
- $(COPY) prebuilt/*.h $(UTIL)
- $(COPY) $< $@
-
-
-$(UTIL)levcomp.lex.cc: prebuilt/levcomp.lex.cc
- $(COPY) $< $@
-
-endif
-
-##########################################################################
-
-
-##########################################################################
-# The actual build targets
-#
-
-install: $(GAME)
-ifeq ($(DATADIR),)
- $(error DATADIR not set! Set DATADIR and run make clean install again)
-endif
- [ -d $(INSTALLDIR) ] || mkdir -p $(INSTALLDIR)
- $(COPY) $(GAME) $(INSTALLDIR)
- chown $(INSTALL_UGRP) $(INSTALLDIR)/$(GAME)
- chmod ${MCHMOD} ${INSTALLDIR}/$(GAME)
- mkdir -p $(DATADIR)/dat
- mkdir -p $(DATADIR)/dat/lua
- mkdir -p $(DATADIR)/dat/clua
- mkdir -p $(DATADIR)/dat/descript
- mkdir -p $(DATADIR)/dat/database
- $(COPY) dat/*.des $(DATADIR)/dat
- $(COPY) dat/lua/*.lua $(DATADIR)/dat/lua
- $(COPY) dat/clua/*.lua $(DATADIR)/dat/clua
- $(COPY) dat/descript/*.txt $(DATADIR)/dat/descript
- $(COPY) dat/database/*.txt $(DATADIR)/dat/database
- mkdir -p $(DATADIR)/settings
- $(COPY) ../settings/* $(DATADIR)/settings/
- mkdir -p $(DATADIR)/docs
- $(COPY) ../docs/*.txt $(DATADIR)/docs
- chown -R $(INSTALL_UGRP) $(DATADIR)
-ifneq ($(SAVEDIR),)
- mkdir -p $(SAVEDIR)
- chown $(INSTALL_UGRP) $(SAVEDIR)
- chmod $(MCHMOD_SAVEDIR) $(SAVEDIR)
-endif
-
-clean:
- $(DELETE) *.o
- $(DELETE) $(UTIL)*.o
- $(DELETE) $(LEVCOMP)
- $(DELETE) $(UTIL)*.tab.cc $(UTIL)*.tab.c $(UTIL)*.tab.h $(UTIL)*.lex.cc
- $(DELETE) *.ixx
-
-clean-lua:
- +$(MAKE) -C $(LUASRC) clean
-
-clean-sql:
- +$(MAKE) -C $(SQLSRC) clean
-
-distclean: clean clean-lua clean-sql
- $(DELETE) bones.*
- $(DELETE) morgue.txt
- $(DELETE) scores
- $(DELETE) $(GAME)
- $(DELETE) *.sav
- $(DELETE) core
- $(DELETE) *.0*
- $(DELETE) *.lab
- $(DELETE) $(DEPENDENCY_MKF)
-
-$(GAME): $(GAME_DEPENDS)
- ${CXX} ${LDFLAGS} $(CFLAGS) $(OBJECTS) -o $(GAME) $(LIB)
-
-.PHONY : debug
-
-debug: $(GAME)
-
-profile: $(GAME_DEPENDS)
- ${CXX} -g -p ${LDFLAGS} $(CFLAGS) $(OBJECTS) -o $(GAME) $(LIB)
-
-.cc.o:
- ${CXX} ${CFLAGS} -c $<
-
-# [ds] Note we don't use the standard CFLAGS here; that's intentional, most
-# flex/bison combos I've tried don't produce code that passes the warnings
-# test.
-$(UTIL)%.o: $(UTIL)%.cc
- $(CXX) $(YCFLAGS) -o $@ -c $<
-
-#############################################################################
-# Build Lua
-
-$(LUASRC)$(LUALIBA):
- echo Building Lua...
- +$(MAKE) -C $(LUASRC) crawl_unix
-
-#############################################################################
-# Build SQLite
-
-$(FSQLLIBA):
- echo Building SQLite
- +$(MAKE) -C $(SQLSRC)
-
-#############################################################################
-# Build unrandart data
-art-data.h: art-data.txt util/art-data.pl art-func.h
- util/art-data.pl
-
-#############################################################################
-# Packaging a source tarball for release
-#
-
-# To package, you *must* have lex and yacc to generate the intermediates.
-ifeq ($(DOYACC),y)
-package-source: distclean prebuildyacc pkgtidy depend removeold vlink \
- pkgtarbz2 pkgzip
-
-pkgtidy:
- $(DELETE) $(PKG_TIDY_LIST)
-
-removeold:
- if [ -f ../../$(SRC_PKG_TAR) ]; then $(DELETE) ../../$(SRC_PKG_TAR); fi
- if [ -f ../../$(SRC_PKG_ZIP) ]; then $(DELETE) ../../$(SRC_PKG_ZIP); fi
-
-# [ds] Existing directory names could produce a bad package!
-vlink:
- cd .. && WHERE=$$PWD && cd .. && \
- ( [ -e $(PKG_SRC_DIR) ] || ln -sf $$WHERE $(PKG_SRC_DIR) )
-
-pkgtarbz2:
- cd ../.. && tar -ch --bzip2 -f $(SRC_PKG_TAR) \
- -X $(PKG_EXCLUDES) $(PKG_SRC_DIR)
-
-pkgzip:
- cd ../.. && zip -rq $(SRC_PKG_ZIP) $(PKG_SRC_DIR) \
- -x@$(PKG_EXCLUDES)
-
-endif
diff --git a/crawl-ref/source/makefile_tiles.mgw b/crawl-ref/source/makefile_tiles.mgw
deleted file mode 100644
index 93fe6eaeb0..0000000000
--- a/crawl-ref/source/makefile_tiles.mgw
+++ /dev/null
@@ -1,292 +0,0 @@
-# -*- Makefile -*- for Dungeon Crawl (Win32, MinGW)
-
-# makefile.obj includes a list of object files needed to build Crawl.
-include makefile.obj
-
-ifeq ($(DEBUG_CRAWL),)
-OPATH := rel
-else
-OPATH := dbg
-endif
-
-# need .exe so make will find the right file
-APPNAME = $(OPATH)\crawl.exe
-CXX = g++
-DELETE = del
-COPY = copy
-OS_TYPE = WIN32TILES
-EXTRA_DEFINES = -DUSE_TILE -DCLUA_BINDINGS
-
-SDL_PREFIX ?= C:/mingw
-SDL_CFLAGS := -D_GNU_SOURCE=1 -Dmain=SDL_main -I$(SDL_PREFIX)/include/SDL
-SDL_LDFLAGS := -lmingw32 -lSDLmain -lSDL -mwindows
-
-INSTALLDIR := $(OPATH)
-
-# If you don't have flex or bison, set DOYACC to N or empty.
-DOYACC := n
-
-LEX := flex
-YACC := bison -y
-
-ifeq ($(LUASRC),)
-LUASRC := util\lua\src
-endif
-
-LUALIB = lua
-LUALIBA = lib$(LUALIB).a
-
-SQLSRC := util\sqlite
-SQLLIB := sqlite3
-SQLIBA := lib$(SQLLIB).a
-FSQLLIBA := $(SQLLIB)\$(SQLIBA)
-
-PCRESRC := util\pcre
-PCRELIB := pcre
-PCRELIBA := lib$(PCRELIB).a
-
-RLTILES = rltiles
-EXTRA_INCLUDES += -I$(RLTILES)
-
-TILEDEFS = dngn main player gui unrand
-TILEDEFPRES = $(TILEDEFS:%=$(RLTILES)/tiledef-%)
-TILEDEFOBJS = $(TILEDEFPRES:%=%.o)
-TILEDEFSRCS = $(TILEDEFPRES:%=%.cc)
-TILEDEFHDRS = $(TILEDEFPRES:%=%.h)
-
-OBJECTS += $(TILEDEFOBJS)
-
-TILEFILES = \
- main.png \
- player.png \
- dngn.png \
- gui.png
-
-DESTTILEFILES = $(TILEFILES:%=dat/tiles/%)
-
-LIB = -lwinmm -mwindows -lcomctl32 -L$(LUASRC) -l$(LUALIB) -L$(SQLSRC) -l$(SQLLIB) -L$(PCRESRC) -l$(PCRELIB) -lpng $(SDL_LDFLAGS) -lopengl32 -lglu32 -lSDL_image -lfreetype
-INCLUDES := -Iutil -I. -I$(LUASRC) -I$(SQLSRC) -I$(PCRESRC) $(EXTRA_INCLUDES)
-
-CFWARN := -Wall -Wwrite-strings -pedantic
-
-CFOTHERS := -fsigned-char \
- -fstrict-aliasing \
- -pedantic \
- -O2 \
- -D$(OS_TYPE) $(EXTRA_FLAGS) \
- -DWINMM_PLAY_SOUNDS -DCLUA_BINDINGS \
- -DWINVER=0x0400 -D_WIN32_IE=0x0400 \
- $(EXTRA_DEFINES) \
-
-CFLAGS := $(INCLUDES) $(CFWARN) $(CFOTHERS) $(SDL_CFLAGS)
-YCFLAGS := $(INCLUDES) $(CFOTHERS)
-
-OBJECTS := $(OBJECTS) libgui.o tilepick.o tile2.o tilereg.o tilesdl.o tilefont.o tiletex.o tilemcache.o tilebuf.o crash-w.o
-
-LDFLAGS =
-
-UTIL = util/
-
-YTABC := levcomp.tab.c
-YTABH := levcomp.tab.h
-
-ifeq ($(LEX),)
-DOYACC :=
-endif
-
-ifeq ($(YACC),)
-DOYACC :=
-endif
-
-RESOURCE := $(UTIL)crawl.rc
-RESOURCEOBJ := crawlres.o
-WINDRES := windres.exe
-
-# Do the levcomp stuff first because that's the most likely to fail.
-OBJECTS := levcomp.tab.o levcomp.lex.o \
- $(OBJECTS) $(RESOURCEOBJ)
-
-OBJECTS := $(foreach file,$(OBJECTS),$(OPATH)/$(file))
-
-GAME_DEPENDS := prepare $(LUASRC)\$(LUALIBA) $(FSQLLIBA) $(PCRESRC)\$(PCRELIBA) $(TILEHEADERS) $(DESTTILEFILES) $(OBJECTS)
-
-##########################################################################
-
-all: $(APPNAME)
-
-prepare:
- if not exist $(OPATH) mkdir $(OPATH)
-
-DEPENDENCY_MKF := makefile.dep
--include $(DEPENDENCY_MKF)
-
-##########################################################################
-# The level compiler
-#
-ifeq ($(DOYACC),y)
-
-# [ds] A plague on the broken copy command on Windoze.
-prebuildyacc: $(UTIL)levcomp.lex.cc $(UTIL)levcomp.tab.cc $(UTIL)levcomp.tab.h
- $(subst /,\,for %%f in ($^) do $(COPY) %%f prebuilt)
-
-$(UTIL)levcomp.tab.cc: $(UTIL)levcomp.ypp
- $(subst /,\, cd $(UTIL)) && $(YACC) -d -b levcomp levcomp.ypp
- $(subst /,\, cd $(UTIL)) && move $(YTABC) levcomp.tab.cc
-
-$(UTIL)levcomp.lex.cc: $(UTIL)levcomp.lpp
- $(subst /,\, cd $(UTIL) && $(LEX) -olevcomp.lex.cc levcomp.lpp)
-
-else
-
-$(UTIL)levcomp.tab.cc: prebuilt/levcomp.tab.cc
- $(subst /,\,$(COPY) prebuilt/*.h $(UTIL))
- $(subst /,\,$(COPY) $< $@)
-
-$(UTIL)levcomp.lex.cc: prebuilt/levcomp.lex.cc
- $(subst /,\,$(COPY) $< $@)
-
-endif
-
-##########################################################################
-# RLTiles
-#
-
-ORIGTILEFILES = $(TILEFILES:%=$(RLTILES)/%)
-
-makerltiles:
- pushd $(RLTILES) && $(MAKE) -f makefile.mgw all
- mkdir $(OPATH)\rltiles 2>nul || echo.>nul
-
-$(TILEDEFSRCS): makerltiles
-
-$(TILEDEFHDRS): makerltiles
-
-$(ORIGTILEFILES): makerltiles
-
-dat/tiles/%.png: rltiles/%.png
- $(subst /,\,$(COPY) $< $@)
-
-clean-rltiles:
- pushd $(RLTILES) && $(MAKE) -f makefile.mgw distclean
-
-##########################################################################
-
-
-##########################################################################
-
-install: $(APPNAME)
-ifneq ($(OPATH),$(INSTALLDIR))
- $(COPY) $(APPNAME) ${INSTALLDIR}
-endif
- mkdir $(INSTALLDIR)\dat 2>nul || echo "" >nul
- mkdir $(INSTALLDIR)\dat\lua 2>null || echo "">nul
- mkdir $(INSTALLDIR)\dat\clua 2>null || echo "">nul
- mkdir $(INSTALLDIR)\dat\descript 2>null || echo "">nul
- mkdir $(INSTALLDIR)\dat\database 2>null || echo "">nul
- mkdir $(INSTALLDIR)\settings 2>null || echo "">nul
- mkdir $(INSTALLDIR)\docs 2>null || echo "">nul
- copy /y dat\*.des $(INSTALLDIR)\dat
- copy /y dat\lua\*.lua $(INSTALLDIR)\dat\lua
- copy /y dat\clua\*.lua $(INSTALLDIR)\dat\clua
- copy /y dat\descript\*.txt $(INSTALLDIR)\dat\descript
- copy /y dat\database\*.txt $(INSTALLDIR)\dat\database
- copy /y ..\settings\* $(INSTALLDIR)\settings
- copy /y ..\docs\* $(INSTALLDIR)\docs
- mkdir $(INSTALLDIR)\dat\tiles 2>nul || echo "" > nul
- copy /y dat\tiles\*.* $(INSTALLDIR)\dat\tiles
- copy /y ..\* $(INSTALLDIR)
- $(DELETE) $(INSTALLDIR)\*.sh
-
-clean:
- $(DELETE) $(OPATH)\*.o
- $(subst /,\,$(DELETE) $(UTIL)*.o)
- $(subst /,\,$(DELETE) $(UTIL)*.exe)
- $(subst /,\,$(DELETE) $(UTIL)*.lex.cc)
- $(subst /,\,$(DELETE) $(UTIL)*.tab.cc)
- $(subst /,\,$(DELETE) $(UTIL)*.tab.h)
- $(subst /,\,$(DELETE) $(UTIL)*.tab.c)
- $(subst /,\,$(DELETE) *.ixx)
-
-clean-lua:
- cd $(LUASRC) && $(MAKE) clean_win
-
-clean-sql:
- cd $(SQLSRC) && $(MAKE) "RM_F=del /f" clean
-
-clean-pcre:
- cd $(PCRESRC) && $(MAKE)
-
-distclean: clean clean-lua clean-sql clean-pcre clean-rltiles
- $(DELETE) dbg\*.o
- $(DELETE) rel\*.o
- $(DELETE) *.o
- $(DELETE) bones.*
- $(DELETE) $(OPATH)\bones.*
- $(DELETE) morgue.txt
- $(DELETE) $(OPATH)\morgue.txt
- $(DELETE) scores
- $(DELETE) $(OPATH)\scores
- $(DELETE) crawl.exe
- $(DELETE) $(subst /,\,$(APPNAME))
- $(DELETE) *.sav
- $(DELETE) $(OPATH)\*.sav
- $(DELETE) core
- $(DELETE) $(OPATH)\core
- $(DELETE) *.0*
- $(DELETE) $(OPATH)\*.0*
- $(DELETE) *.lab
- $(DELETE) $(OPATH)\*.lab
-
-$(APPNAME): $(GAME_DEPENDS)
- ${CXX} ${LDFLAGS} $(CFLAGS) $(OBJECTS) -o $(APPNAME) $(LIB)
- strip $(APPNAME)
-
-debug: $(GAME_DEPENDS)
- ${CXX} ${LDFLAGS} $(CFLAGS) $(OBJECTS) -o $(APPNAME) $(LIB)
-
-profile: $(GAME_DEPENDS)
- ${CXX} -g -p ${LDFLAGS} $(CFLAGS) $(OBJECTS) -o $(APPNAME) $(LIB)
-
-$(OPATH)/%.o: %.cc $(TILEDEFHDRS)
- ${CXX} ${CFLAGS} -o $@ -c $<
-
-# STL is bad in debug. Always compile this file with optimizations.
-$(OPATH)/tilebuf.o: tilebuf.cc $(TILEDEFHDRS)
- ${CXX} ${CFLAGS} -O2 -o $@ -c $<
-
-
-$(OPATH)/%.o: $(UTIL)%.cc $(TILEDEFHDRS)
- $(CXX) $(YCFLAGS) -o $@ -c $<
-
-#############################################################################
-# Build Lua
-
-$(LUASRC)\$(LUALIBA):
- @echo Building Lua...
- @cd $(LUASRC) && $(MAKE) crawl_mingw
-
-#############################################################################
-# Build SQLite
-
-$(FSQLLIBA):
- @echo Building SQLite
- cd $(SQLSRC) && $(MAKE)
-
-#############################################################################
-# Build unrandart data
-art-data.h: art-data.txt util/art-data.pl art-func.h
- util/art-data.pl
-
-#############################################################################
-# Build PCRE
-
-$(PCRESRC)\$(PCRELIBA):
- @echo Building PCRE...
- @cd $(PCRESRC) && $(MAKE)
-
-##########################################################################
-# Resources
-#
-
-$(OPATH)/$(RESOURCEOBJ): $(RESOURCE)
- $(WINDRES) $< $@
diff --git a/crawl-ref/source/makefile_tiles.mgw_unix b/crawl-ref/source/makefile_tiles.mgw_unix
deleted file mode 100644
index e1c5996b95..0000000000
--- a/crawl-ref/source/makefile_tiles.mgw_unix
+++ /dev/null
@@ -1,274 +0,0 @@
-# -*- Makefile -*- for Dungeon Crawl (Cross-compiling MinGW for crawl.develz.org)
-
-# makefile.obj includes a list of object files needed to build Crawl.
-include makefile.obj
-
-OPATH := build
-
-# need .exe so make will find the right file
-APPNAME = $(OPATH)/crawl.exe
-CXX = i586-mingw32msvc-g++
-DELETE = rm -f
-COPY = cp
-OS_TYPE = WIN32TILES
-EXTRA_DEFINES = -DUSE_TILE -DCLUA_BINDINGS -DWIZARD
-
-SDL_PREFIX ?= $(HOME)/source/mingw32
-SDL_CFLAGS := -D_GNU_SOURCE=1 -Dmain=SDL_main -I$(SDL_PREFIX)/include/SDL
-SDL_LDFLAGS := -lmingw32 -lSDLmain -lSDL.dll -lSDL_image -lopengl32 -lglu32
-
-ifeq ($(INSTALLDIR),)
-INSTALLDIR := crawl-mingw32
-endif
-
-# If you don't have flex or bison, set DOYACC to N or empty.
-DOYACC := n
-
-LEX := flex
-YACC := bison -y
-
-ifeq ($(LUASRC),)
-LUASRC := util/lua/src
-endif
-
-LUALIB = lua
-LUALIBA = lib$(LUALIB).a
-
-SQLSRC := util/sqlite
-SQLLIB := sqlite3
-SQLIBA := lib$(SQLLIB).a
-FSQLLIBA := $(SQLLIB)/$(SQLIBA)
-
-PCRESRC := util/pcre
-PCRELIB := pcre
-PCRELIBA := lib$(PCRELIB).a
-
-RLTILES = rltiles
-EXTRA_INCLUDES += -I$(RLTILES)
-
-TILEDEFS = dngn main player unrand
-TILEDEFPRES = $(TILEDEFS:%=$(RLTILES)/tiledef-%)
-TILEDEFOBJS = $(TILEDEFPRES:%=%.o)
-TILEDEFSRCS = $(TILEDEFPRES:%=%.cc)
-TILEDEFHDRS = $(TILEDEFPRES:%=%.h)
-
-OBJECTS += $(TILEDEFOBJS)
-
-TILEFILES = \
- main.png \
- player.png \
- dngn.png
-
-DESTTILEFILES = $(TILEFILES:%=dat/tiles/%)
-
-LIB = -static -L$(HOME)/source/mingw32/lib -lwinmm -mwindows -lcomctl32 -L$(LUASRC) -l$(LUALIB) -L$(SQLSRC) -l$(SQLLIB) -L$(PCRESRC) -l$(PCRELIB) $(SDL_LDFLAGS) -lfreetype
-INCLUDES := -Iutil -I. -I$(HOME)/source/mingw32/include -I$(LUASRC) -I$(SQLSRC) -I$(PCRESRC) $(EXTRA_INCLUDES)
-
-CFWARN := -Wwrite-strings
-
-CFOTHERS := -fsigned-char \
- -fstrict-aliasing \
- -pedantic \
- -O2 \
- -D$(OS_TYPE) $(EXTRA_FLAGS) \
- -DWINMM_PLAY_SOUNDS -DCLUA_BINDINGS \
- -DWINVER=0x0400 -D_WIN32_IE=0x0400 \
- $(EXTRA_DEFINES)
-
-CFLAGS := $(INCLUDES) $(CFWARN) $(CFOTHERS) $(SDL_CFLAGS)
-YCFLAGS := $(INCLUDES) $(CFOTHERS)
-
-OBJECTS := $(OBJECTS) libgui.o tilepick.o tile2.o tilereg.o tilesdl.o tilefont.o tiletex.o tilemcache.o tilebuf.o crash-w.o
-
-LDFLAGS =
-
-UTIL = util/
-
-YTABC := levcomp.tab.c
-YTABH := levcomp.tab.h
-
-ifeq ($(LEX),)
-DOYACC :=
-endif
-
-ifeq ($(YACC),)
-DOYACC :=
-endif
-
-RESOURCE := $(UTIL)crawl.rc
-RESOURCEOBJ := crawlres.o
-WINDRES := i586-mingw32msvc-windres
-
-# Do the levcomp stuff first because that's the most likely to fail.
-OBJECTS := levcomp.tab.o levcomp.lex.o \
- $(OBJECTS) $(RESOURCEOBJ)
-
-OBJECTS := $(foreach file,$(OBJECTS),$(OPATH)/$(file))
-
-GAME_DEPENDS := prepare $(LUASRC)/$(LUALIBA) $(FSQLLIBA) $(PCRESRC)/$(PCRELIBA) $(TILEHEADERS) $(DESTTILEFILES) $(OBJECTS)
-
-##########################################################################
-
-all: $(APPNAME)
-
-prepare:
- mkdir -p $(OPATH)
-
-DEPENDENCY_MKF := makefile.dep
--include $(DEPENDENCY_MKF)
-
-##########################################################################
-# The level compiler
-#
-ifeq ($(DOYACC),y)
-
-# [ds] A plague on the broken copy command on Windoze.
-prebuildyacc: $(UTIL)levcomp.lex.cc $(UTIL)levcomp.tab.cc $(UTIL)levcomp.tab.h
- $(COPY) $^ prebuilt/
-
-$(UTIL)levcomp.tab.cc: $(UTIL)levcomp.ypp
- cd $(UTIL) && $(YACC) -d -b levcomp levcomp.ypp \
- && mv $(YTABC) levcomp.tab.cc || false
-
-$(UTIL)levcomp.lex.cc: $(UTIL)levcomp.lpp
- cd $(UTIL) && $(LEX) -olevcomp.lex.cc levcomp.lpp
-
-else
-
-$(UTIL)levcomp.tab.cc: prebuilt/levcomp.tab.cc
- $(COPY) prebuilt/*.h $(UTIL)
- $(COPY) $< $@
-
-$(UTIL)levcomp.lex.cc: prebuilt/levcomp.lex.cc
- $(COPY) $< $@
-endif
-
-##########################################################################
-# RLTiles
-#
-
-ORIGTILEFILES = $(TILEFILES:%=$(RLTILES)/%)
-
-makerltiles:
- pushd $(RLTILES) && $(MAKE) -f makefile.unix all
- mkdir -p $(OPATH)/rltiles
-
-$(TILEDEFSRCS): makerltiles
-
-$(TILEDEFHDRS): makerltiles
-
-$(ORIGTILEFILES): makerltiles
-
-dat/tiles/%.png: rltiles/%.png
- mkdir -p dat/tiles
- $(COPY) $< $@
-
-clean-rltiles:
- pushd $(RLTILES) && $(MAKE) -f makefile.unix distclean
-
-##########################################################################
-
-
-##########################################################################
-
-install: $(APPNAME)
-ifneq ($(OPATH),$(INSTALLDIR))
- mkdir -p $(INSTALLDIR)
- $(COPY) $(APPNAME) ${INSTALLDIR}
-endif
- mkdir -p $(INSTALLDIR)/dat
- mkdir -p $(INSTALLDIR)/dat/clua
- mkdir -p $(INSTALLDIR)/dat/database
- mkdir -p $(INSTALLDIR)/dat/descript
- mkdir -p $(INSTALLDIR)/dat/lua
- mkdir -p $(INSTALLDIR)/dat/tiles
- mkdir -p $(INSTALLDIR)/docs
- mkdir -p $(INSTALLDIR)/settings
- $(COPY) dat/*.des $(INSTALLDIR)/dat/
- $(COPY) dat/clua/*.lua $(INSTALLDIR)/dat/clua/
- $(COPY) dat/database/*.txt $(INSTALLDIR)/dat/database/
- $(COPY) dat/descript/*.txt $(INSTALLDIR)/dat/descript/
- $(COPY) dat/lua/*.lua $(INSTALLDIR)/dat/lua/
- $(COPY) dat/tiles/*.png dat/tiles/*.ttf $(INSTALLDIR)/dat/tiles/
- $(COPY) ../docs/*.txt $(INSTALLDIR)/docs/
- $(COPY) ../docs/changes.stone_soup $(INSTALLDIR)/docs/
- $(COPY) ../CREDITS.txt $(INSTALLDIR)/
- $(COPY) ../README.txt ../README.pdf $(INSTALLDIR)/
- $(COPY) ../licence.txt $(INSTALLDIR)/LICENCE.txt
- $(COPY) ../settings/* $(INSTALLDIR)/settings/
-
-clean:
- $(DELETE) $(OPATH)/*.o
- $(DELETE) $(UTIL)*.o
- $(DELETE) $(UTIL)*.exe
- $(DELETE) $(UTIL)*.lex.cc
- $(DELETE) $(UTIL)*.tab.cc
- $(DELETE) $(UTIL)*.tab.h
- $(DELETE) $(UTIL)*.tab.c
- $(DELETE) *.ixx
-
-clean-lua:
- cd $(LUASRC) && $(MAKE) clean_win
-
-clean-sql:
- cd $(SQLSRC) && $(MAKE) clean
-
-clean-pcre:
- cd $(PCRESRC) && $(MAKE) clean
-
-distclean: clean clean-lua clean-sql clean-pcre clean-rltiles
-
-$(APPNAME): $(GAME_DEPENDS)
- ${CXX} ${LDFLAGS} $(CFLAGS) $(OBJECTS) -o $(APPNAME) $(LIB)
- i586-mingw32msvc-strip $(APPNAME)
-
-debug: $(GAME_DEPENDS)
- ${CXX} ${LDFLAGS} $(CFLAGS) $(OBJECTS) -o $(APPNAME) $(LIB)
-
-profile: $(GAME_DEPENDS)
- ${CXX} -g -p ${LDFLAGS} $(CFLAGS) $(OBJECTS) -o $(APPNAME) $(LIB)
-
-$(OPATH)/%.o: %.cc $(TILEDEFHDRS)
- ${CXX} ${CFLAGS} -o $@ -c $<
-
-# STL is bad in debug. Always compile this file with optimizations.
-$(OPATH)/tilebuf.o: tilebuf.cc $(TILEDEFHDRS)
- ${CXX} ${CFLAGS} -O2 -o $@ -c $<
-
-
-$(OPATH)/%.o: $(UTIL)%.cc $(TILEDEFHDRS)
- $(CXX) $(YCFLAGS) -o $@ -c $<
-
-#############################################################################
-# Build Lua
-
-$(LUASRC)/$(LUALIBA):
- @echo Building Lua...
- @cd $(LUASRC) && $(MAKE) crawl_mingw
-
-#############################################################################
-# Build SQLite
-
-$(FSQLLIBA):
- @echo Building SQLite
- cd $(SQLSRC) && $(MAKE)
-
-#############################################################################
-# Build unrandart data
-art-data.h: art-data.txt util/art-data.pl art-func.h
- util/art-data.pl
-
-#############################################################################
-# Build PCRE
-
-$(PCRESRC)/$(PCRELIBA):
- @echo Building PCRE...
- @cd $(PCRESRC) && $(MAKE)
-
-##########################################################################
-# Resources
-#
-
-$(OPATH)/$(RESOURCEOBJ): $(RESOURCE)
- $(WINDRES) $< $@
-
diff --git a/crawl-ref/source/makefile_tiles.unix b/crawl-ref/source/makefile_tiles.unix
deleted file mode 100644
index 9d39f5442c..0000000000
--- a/crawl-ref/source/makefile_tiles.unix
+++ /dev/null
@@ -1,371 +0,0 @@
-# -*- Makefile -*- for Dungeon Crawl (unix)
-
-GAME = crawl
-
-# this file contains a list of the libraries.
-# it will make a variable called OBJECTS that contains all the libraries
-include makefile.obj
-
-OBJECTS += libgui.o tilepick.o tile2.o tilereg.o tilesdl.o tilefont.o tiletex.o tilemcache.o tilebuf.o crash-u.o
-
-SDL_CFLAGS := $(shell sdl-config --cflags)
-
-CXX = g++
-DELETE = rm -f
-COPY = cp
-OS_TYPE = UNIX
-EXTRA_INCLUDES := -DUSE_TILE -DCLUA_BINDINGS
-# To get stack trace symbols.
-LDFLAGS = -rdynamic
-
-# Change this to y if you want to use Unicode glyphs in the map, and you have
-# libncursesw available.
-UNICODE_GLYPHS = n
-
-# OSX vs. Linux differences:
-ifeq ($(strip $(OSX)),y)
-PNG_INCLUDE := -I/sw/include
-FREETYPE_INCLUDE := -I/sw/include/freetype2
-
-# Note: gcc on OS X will *always* include the dynamic library
-# version of any lib if it exists in the path. Therefore, all non-standard
-# libraries have to be linked explicitly by full path rather than searched
-# for.
-LIB_BASE := /sw/lib
-FREETYPE_LIB := $(LIB_BASE)/freetype2/lib/libfreetype.a
-
-SW_LIB_LIST := SDL SDL_image SDLmain png tiff jpeg
-LIB_LIST := $(SW_LIB_LIST:%=$(LIB_BASE)/lib%.a) $(FREETYPE_LIB)
-
-# The list of frameworks that SDL would normally dynamically load and need to
-# be included explicitly if SDL is linked statically.
-FRAMEWORK_LIST := Cocoa Carbon AudioUnit IOKit OpenGL QuickTime
-
-EXTRA_LIBS := $(FRAMEWORK_LIST:%=-Wl,-framework,%) $(LIB_LIST) -lz
-
-EXTRA_INCLUDES += -I/sw/include
-else
-PNG_INCLUDE := $(shell pkg-config libpng --cflags)
-PNG_LDFLAGS := $(shell pkg-config libpng --libs)
-FREETYPE_INCLUDE := $(shell pkg-config freetype2 --cflags)
-FREETYPE_LDFLAGS := $(shell pkg-config freetype2 --libs)
-SDL_LDFLAGS := $(shell sdl-config --libs) -lSDLmain
-EXTRA_LIBS := $(PNG_LDFLAGS) $(SDL_LDFLAGS) $(FREETYPE_LDFLAGS) -lGL -lGLU -lSDL_image
-endif
-
-# If you have lex and yacc, set DOYACC to y (lowercase y).
-DOYACC := y
-
-# Permissions to set on the game executable.
-MCHMOD := 2755
-
-# Permissions to set on the save directory.
-MCHMOD_SAVEDIR := 775
-
-# The user:group to install the game as.
-INSTALL_UGRP := games:games
-
-INSTALLDIR := /usr/games/crawl
-
-# If you're installing Crawl for multiple users, you *must* set this to a
-# valid path before building Crawl. This is not necessary if you are building
-# Crawl for a single user.
-
-# SAVEDIR := /usr/games/crawl/saves/
-# DATADIR := /usr/games/crawl/data/
-
-LEX := flex
-YACC := bison -y
-
-LUASRC := util/lua/src
-LUALIB = lua
-LUALIBA = l$(LUALIB).a
-
-SQLSRC := util/sqlite
-SQLLIB := sqlite3
-SQLLIBA := lib$(SQLLIB).a
-FSQLLIBA := $(SQLSRC)/$(SQLLIBA)
-
-# Note: link sqlite with the full path to the .a, so OSX uses the right one.
-LIBDBM := $(FSQLLIBA)
-EXTRA_INCLUDES += -I$(SQLSRC)
-EXTRA_DEPENDS += $(FSQLLIBA)
-
-RLTILES = rltiles
-
-EXTRA_INCLUDES += -I$(RLTILES)
-
-TILEDEFS = dngn main player gui unrand
-TILEDEFPRES = $(TILEDEFS:%=$(RLTILES)/tiledef-%)
-TILEDEFOBJS = $(TILEDEFPRES:%=%.o)
-TILEDEFSRCS = $(TILEDEFPRES:%=%.cc)
-TILEDEFHDRS = $(TILEDEFPRES:%=%.h)
-
-OBJECTS += $(TILEDEFOBJS)
-
-TILEFILES = \
- main.png \
- player.png \
- dngn.png \
- gui.png
-DESTTILEFILES = $(TILEFILES:%=dat/tiles/%)
-
-EXTRA_DEPENDS += $(DESTTILEFILES)
-
-LIB = -L$(LUASRC) -l$(LUALIB) $(LIBDBM) $(EXTRA_LIBS)
-
-INCLUDES := $(INCLUDES) -Iutil -I. -I$(LUASRC) $(EXTRA_INCLUDES) $(PNG_INCLUDE) $(FREETYPE_INCLUDE)
-
-CFWARN := -Wall -Wwrite-strings -Wshadow -pedantic -Wno-parentheses
-
-CFOTHERS := -fsigned-char -D$(OS_TYPE) $(EXTRA_FLAGS) -DCLUA_BINDINGS
-
-ifneq ($(HURRY),y)
-ifneq ($(DEBUG_CRAWL),y)
-CFWARN += -Wuninitialized
-CFOTHERS += -O2
-endif
-endif
-
-ifneq ($(strip $(SAVEDIR)),)
-CFOTHERS += '-DSAVE_DIR_PATH="$(strip $(SAVEDIR))"'
-endif
-
-ifneq ($(strip $(DATADIR)),)
-CFOTHERS += '-DDATA_DIR_PATH="$(strip $(DATADIR))"'
-endif
-
-CFLAGS := $(INCLUDES) $(CFWARN) $(CFOTHERS) $(SDL_CFLAGS)
-YCFLAGS := $(INCLUDES) $(CFOTHERS)
-
-UTIL = util/
-
-YTABC := levcomp.tab.c
-YTABH := levcomp.tab.h
-
-OBJECTS := $(UTIL)levcomp.tab.o $(UTIL)levcomp.lex.o $(OBJECTS)
-
-ifeq ($(strip $(LEX)),)
-DOYACC :=
-endif
-
-ifeq ($(strip $(YACC)),)
-DOYACC :=
-endif
-
-GAME_DEPENDS := $(LUASRC)$(LUALIBA) $(EXTRA_DEPENDS) $(OBJECTS)
-SRC_PKG_BASE := stone_soup
-SRC_VERSION := $(shell egrep 'VER_NUM *".*"' version.h | \
- egrep -o '[0-9]\.[0-9](\.[0-9])?')
-PKG_SRC_DIR := $(SRC_PKG_BASE)-$(SRC_VERSION)-src
-SRC_PKG_TAR := $(PKG_SRC_DIR).tbz2
-SRC_PKG_ZIP := $(PKG_SRC_DIR).zip
-
-PKG_TIDY_LIST := $(UTIL)*.o $(LEVCOMP) *.o \
- $(UTIL)*.tab.cc $(UTIL)*.tab.h $(UTIL)*.lex.cc *.ixx
-PKG_EXCLUDES := $(PWD)/misc/src-pkg-excludes.lst
-
-##########################################################################
-
-all: $(GAME)
-
-##########################################################################
-# Dependencies
-
-DEPENDENCY_MKF := makefile.dep
-
-depend: $(OBJECTS:.o=.cc)
- rm -f $(DEPENDENCY_MKF).tmp
- @for i in $^; do \
- echo "Updating dependencies for $$i"; \
- $(CXX) -MM $(CFLAGS) $$i >>$(DEPENDENCY_MKF).tmp 2>/dev/null; \
- done
- mv -f $(DEPENDENCY_MKF).tmp $(DEPENDENCY_MKF)
-
--include $(DEPENDENCY_MKF)
-
-##########################################################################
-# The level compiler
-#
-
-ifeq ($(DOYACC),y)
-
-prebuildyacc: $(UTIL)levcomp.tab.cc $(UTIL)levcomp.tab.h $(UTIL)levcomp.lex.cc
- $(COPY) $^ prebuilt/
-
-$(UTIL)levcomp.tab.cc: $(UTIL)levcomp.ypp
- cd $(UTIL) && $(YACC) -d -b levcomp levcomp.ypp \
- && mv $(YTABC) levcomp.tab.cc || false
-
-$(UTIL)levcomp.lex.cc: $(UTIL)levcomp.lpp
- cd $(UTIL) && $(LEX) -olevcomp.lex.cc levcomp.lpp
-
-else
-
-# Pull the level-compiler stuff up from prebuilt/
-
-$(UTIL)levcomp.tab.cc: prebuilt/levcomp.tab.cc
- $(COPY) prebuilt/*.h $(UTIL)
- $(COPY) $< $@
-
-
-$(UTIL)levcomp.lex.cc: prebuilt/levcomp.lex.cc
- $(COPY) $< $@
-
-endif
-
-##########################################################################
-# RLTiles
-#
-
-ORIGTILEFILES = $(TILEFILES:%=$(RLTILES)/%)
-
-makerltiles:
- +$(MAKE) -C rltiles -f makefile.unix all
-
-$(TILEDEFSRCS): makerltiles
-
-$(TILEDEFHDRS): makerltiles
-
-$(ORIGTILEFILES): makerltiles
-
-dat/tiles/%.png: $(RLTILES)/%.png
- $(COPY) $< $@
-
-clean-rltiles:
- +$(MAKE) -C $(RLTILES) -f makefile.unix distclean && cd ..
-
-##########################################################################
-
-
-##########################################################################
-# The actual build targets
-#
-
-install: $(GAME)
-ifeq ($(DATADIR),)
- $(error DATADIR not set! Set DATADIR and run make clean install again)
-endif
- [ -d $(INSTALLDIR) ] || mkdir -p $(INSTALLDIR)
- $(COPY) $(GAME) $(INSTALLDIR)
- chown $(INSTALL_UGRP) $(INSTALLDIR)/$(GAME)
- chmod ${MCHMOD} ${INSTALLDIR}/$(GAME)
- mkdir -p $(DATADIR)/dat
- mkdir -p $(DATADIR)/dat/lua
- mkdir -p $(DATADIR)/dat/clua
- mkdir -p $(DATADIR)/dat/descript
- mkdir -p $(DATADIR)/dat/database
- $(COPY) dat/*.des $(DATADIR)/dat
- $(COPY) dat/lua/*.lua $(DATADIR)/dat/lua
- $(COPY) dat/clua/*.lua $(DATADIR)/dat/clua
- $(COPY) dat/descript/*.txt $(DATADIR)/dat/descript
- $(COPY) dat/database/*.txt $(DATADIR)/dat/database
- mkdir -p $(DATADIR)/settings
- $(COPY) ../settings/* $(DATADIR)/settings/
- mkdir -p $(DATADIR)/docs
- $(COPY) ../docs/*.txt $(DATADIR)/docs
- mkdir -p $(DATADIR)/dat/tiles
- $(COPY) dat/tiles/* $(DATADIR)/dat/tiles
- chown -R $(INSTALL_UGRP) $(DATADIR)
-ifneq ($(SAVEDIR),)
- mkdir -p $(SAVEDIR)
- chown $(INSTALL_UGRP) $(SAVEDIR)
- chmod $(MCHMOD_SAVEDIR) $(SAVEDIR)
-endif
-
-clean:
- $(DELETE) *.o
- $(DELETE) $(UTIL)*.o
- $(DELETE) $(LEVCOMP)
- $(DELETE) $(UTIL)*.tab.cc $(UTIL)*.tab.c $(UTIL)*.tab.h $(UTIL)*.lex.cc
- $(DELETE) *.ixx
-
-clean-lua:
- +$(MAKE) -C $(LUASRC) clean
-
-clean-sql:
- +$(MAKE) -C $(SQLSRC) clean
-
-distclean: clean clean-lua clean-sql clean-rltiles
- $(DELETE) bones.*
- $(DELETE) morgue.txt
- $(DELETE) scores
- $(DELETE) $(GAME)
- $(DELETE) *.sav
- $(DELETE) core
- $(DELETE) *.0*
- $(DELETE) *.lab
- $(DELETE) $(DEPENDENCY_MKF)
-
-$(GAME): $(GAME_DEPENDS)
- ${CXX} ${LDFLAGS} $(CFLAGS) $(OBJECTS) -o $(GAME) $(LIB)
-
-.PHONY : debug
-
-debug: $(GAME)
-
-profile: $(GAME_DEPENDS)
- ${CXX} -g -p ${LDFLAGS} $(CFLAGS) $(OBJECTS) -o $(GAME) $(LIB)
-
-%.o: %.cc $(TILEDEFHDRS)
- ${CXX} ${CFLAGS} -c $< -o $@
-
-# STL is bad in debug. Always compile this file with optimizations.
-tilebuf.o: tilebuf.cc $(TILEDEFHDRS)
- ${CXX} ${CFLAGS} -O2 -c $< -o $@
-
-# [ds] Note we don't use the standard CFLAGS here; that's intentional, most
-# flex/bison combos I've tried don't produce code that passes the warnings
-# test.
-$(UTIL)%.o: $(UTIL)%.cc $(TILEDEFHDRS)
- $(CXX) $(YCFLAGS) -o $@ -c $<
-
-#############################################################################
-# Build Lua
-
-$(LUASRC)$(LUALIBA):
- echo Building Lua...
- +$(MAKE) -C $(LUASRC) crawl_unix
-
-#############################################################################
-# Build SQLite
-
-$(FSQLLIBA):
- echo Building SQLite
- +$(MAKE) -C $(SQLSRC)
-
-#############################################################################
-# Build unrandart data
-art-data.h: art-data.txt util/art-data.pl art-func.h
- util/art-data.pl
-
-#############################################################################
-# Packaging a source tarball for release
-#
-
-# To package, you *must* have lex and yacc to generate the intermediates.
-ifeq ($(DOYACC),y)
-package-source: distclean prebuildyacc pkgtidy depend removeold vlink \
- pkgtarbz2 pkgzip
-
-pkgtidy:
- $(DELETE) $(PKG_TIDY_LIST)
-
-removeold:
- if [ -f ../../$(SRC_PKG_TAR) ]; then $(DELETE) ../../$(SRC_PKG_TAR); fi
- if [ -f ../../$(SRC_PKG_ZIP) ]; then $(DELETE) ../../$(SRC_PKG_ZIP); fi
-
-# [ds] Existing directory names could produce a bad package!
-vlink:
- cd .. && WHERE=$$PWD && cd .. && \
- ( [ -e $(PKG_SRC_DIR) ] || ln -sf $$WHERE $(PKG_SRC_DIR) )
-
-pkgtarbz2:
- cd ../.. && tar -ch --bzip2 -f $(SRC_PKG_TAR) \
- -X $(PKG_EXCLUDES) $(PKG_SRC_DIR)
-
-pkgzip:
- cd ../.. && zip -rq $(SRC_PKG_ZIP) $(PKG_SRC_DIR) \
- -x@$(PKG_EXCLUDES)
-
-endif
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index fdb344ccff..a3b7329c91 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -18,8 +18,6 @@ REVISION("$Rev$");
#include "describe.h"
#include "dungeon.h"
#include "food.h"
-#include "it_use2.h"
-#include "itemname.h"
#include "itemprop.h"
#include "items.h"
#include "misc.h"
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc
index 49ea350a1a..face8ab8d7 100644
--- a/crawl-ref/source/mapdef.cc
+++ b/crawl-ref/source/mapdef.cc
@@ -27,7 +27,6 @@ REVISION("$Rev$");
#include "mapdef.h"
#include "mapmark.h"
#include "maps.h"
-#include "message.h"
#include "misc.h"
#include "monplace.h"
#include "mon-util.h"
diff --git a/crawl-ref/source/mapmark.cc b/crawl-ref/source/mapmark.cc
index befa8df2e3..22376bc2be 100644
--- a/crawl-ref/source/mapmark.cc
+++ b/crawl-ref/source/mapmark.cc
@@ -17,7 +17,6 @@ REVISION("$Rev$");
#include "luadgn.h"
#include "stuff.h"
#include "tags.h"
-#include "view.h"
////////////////////////////////////////////////////////////////////////
// Dungeon markers
diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc
index 3d50bfdb0b..15279c6917 100644
--- a/crawl-ref/source/maps.cc
+++ b/crawl-ref/source/maps.cc
@@ -24,7 +24,6 @@ REVISION("$Rev$");
#include "message.h"
#include "monplace.h"
#include "mapdef.h"
-#include "misc.h"
#include "state.h"
#include "stuff.h"
#include "terrain.h"
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc
index ff8d358a61..a952dc580f 100644
--- a/crawl-ref/source/menu.cc
+++ b/crawl-ref/source/menu.cc
@@ -26,7 +26,6 @@ REVISION("$Rev$");
#endif
#include "tutorial.h"
#include "view.h"
-#include "initfile.h"
MenuDisplay::MenuDisplay(Menu *menu) : m_menu(menu)
{
@@ -1321,7 +1320,7 @@ int slider_menu::item_colour(int index, const MenuEntry *me) const
int colour = Menu::item_colour(index, me);
if (index == selected && selected != -1)
{
-#if defined(WIN32CONSOLE) || defined(DOS)
+#if defined(WIN32CONSOLE) || defined(TARGET_OS_DOS)
colour = dos_brand(colour, CHATTR_REVERSE);
#elif defined(USE_TILE)
colour = (colour == WHITE ? YELLOW : WHITE);
diff --git a/crawl-ref/source/menu.h b/crawl-ref/source/menu.h
index bb989a2576..08b39eaae7 100644
--- a/crawl-ref/source/menu.h
+++ b/crawl-ref/source/menu.h
@@ -11,7 +11,6 @@
#include <vector>
#include <algorithm>
#include <time.h>
-#include "AppHdr.h"
#include "externs.h"
#include "format.h"
#include "defines.h"
diff --git a/crawl-ref/source/message.cc b/crawl-ref/source/message.cc
index 15782c450c..8f898d8571 100644
--- a/crawl-ref/source/message.cc
+++ b/crawl-ref/source/message.cc
@@ -14,7 +14,7 @@ REVISION("$Rev$");
#include <cstring>
#include <sstream>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/mgrow.cc b/crawl-ref/source/mgrow.cc
index be96e4dadc..2d0d701089 100644
--- a/crawl-ref/source/mgrow.cc
+++ b/crawl-ref/source/mgrow.cc
@@ -8,7 +8,6 @@
REVISION("$Rev$");
#include "enum.h"
-#include "ghost.h"
#include "mgrow.h"
#include "mon-util.h"
#include "monstuff.h"
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index e0e49b5f83..4f0e6f1bf5 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -17,7 +17,7 @@ REVISION("$Rev$");
#include <unistd.h>
#endif
-#ifdef __MINGW32__
+#ifdef TARGET_COMPILER_MINGW
#include <io.h>
#endif
@@ -25,7 +25,7 @@ REVISION("$Rev$");
#include <cstdio>
#include <cmath>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
@@ -46,7 +46,6 @@ REVISION("$Rev$");
#include "fight.h"
#include "files.h"
#include "food.h"
-#include "format.h"
#include "hiscores.h"
#include "itemprop.h"
#include "items.h"
diff --git a/crawl-ref/source/mon-data.h b/crawl-ref/source/mon-data.h
index 28753c13a1..106987988f 100644
--- a/crawl-ref/source/mon-data.h
+++ b/crawl-ref/source/mon-data.h
@@ -1718,8 +1718,8 @@ static monsterentry mondata[] = {
MONS_GIANT_BEETLE, 'B', BLUE, "giant beetle",
M_NO_SKELETON,
MR_VUL_POISON,
- 1000, 10, MONS_GIANT_BEETLE, MONS_GIANT_BEETLE, MH_NATURAL, -3,
- { {AT_BITE, AF_PLAIN, 20}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK },
+ 1000, 12, MONS_GIANT_BEETLE, MONS_GIANT_BEETLE, MH_NATURAL, -3,
+ { {AT_BITE, AF_PLAIN, 30}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK },
{ 5, 7, 6, 0 },
10, 3, MST_NO_SPELLS, CE_POISONOUS, Z_BIG, S_SILENT, I_INSECT,
HT_LAND, 5, DEFAULT_ENERGY, MONUSE_NOTHING, MONEAT_NOTHING, SIZE_MEDIUM
@@ -1729,8 +1729,8 @@ static monsterentry mondata[] = {
MONS_BOULDER_BEETLE, 'B', LIGHTGREY, "boulder beetle",
M_NO_SKELETON,
MR_VUL_POISON,
- 2500, 10, MONS_GIANT_BEETLE, MONS_BOULDER_BEETLE, MH_NATURAL, -3,
- { {AT_BITE, AF_PLAIN, 35}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK },
+ 2500, 12, MONS_GIANT_BEETLE, MONS_BOULDER_BEETLE, MH_NATURAL, -3,
+ { {AT_BITE, AF_PLAIN, 45}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK },
{ 9, 3, 5, 0 },
20, 2, MST_NO_SPELLS, CE_POISONOUS, Z_BIG, S_SILENT, I_INSECT,
HT_LAND, 3, DEFAULT_ENERGY, MONUSE_NOTHING, MONEAT_NOTHING, SIZE_LARGE
@@ -1740,8 +1740,8 @@ static monsterentry mondata[] = {
MONS_BORING_BEETLE, 'B', BROWN, "boring beetle",
M_NO_SKELETON | M_BURROWS,
MR_VUL_POISON,
- 1300, 10, MONS_GIANT_BEETLE, MONS_BORING_BEETLE, MH_NATURAL, -3,
- { {AT_BITE, AF_PLAIN, 26}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK },
+ 1300, 12, MONS_GIANT_BEETLE, MONS_BORING_BEETLE, MH_NATURAL, -3,
+ { {AT_BITE, AF_PLAIN, 35}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK },
{ 8, 3, 5, 0 },
13, 4, MST_NO_SPELLS, CE_POISONOUS, Z_BIG, S_SILENT, I_INSECT,
HT_LAND, 6, DEFAULT_ENERGY, MONUSE_NOTHING, MONEAT_NOTHING, SIZE_LARGE
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 90abce1842..e5c4cca512 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -50,7 +50,6 @@ REVISION("$Rev$");
#include "state.h"
#include "stuff.h"
#include "terrain.h"
-#include "tiles.h"
#include "traps.h"
#include "tutorial.h"
#include "view.h"
@@ -8037,7 +8036,7 @@ bool monsters::mutate()
// (very) ugly thing.
if (type == MONS_UGLY_THING || type == MONS_VERY_UGLY_THING)
{
- ugly_thing_energy_mutate(this);
+ ugly_thing_mutate(this);
return (true);
}
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc
index 72597b1746..dbe77740de 100644
--- a/crawl-ref/source/monplace.cc
+++ b/crawl-ref/source/monplace.cc
@@ -27,7 +27,6 @@ REVISION("$Rev$");
#include "religion.h"
#include "state.h"
#include "stuff.h"
-#include "spells4.h"
#include "terrain.h"
#include "traps.h"
#include "view.h"
diff --git a/crawl-ref/source/monspeak.cc b/crawl-ref/source/monspeak.cc
index 84f762f44d..51857107ef 100644
--- a/crawl-ref/source/monspeak.cc
+++ b/crawl-ref/source/monspeak.cc
@@ -13,7 +13,7 @@ REVISION("$Rev$");
#include <stdio.h>
#include <algorithm>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
@@ -22,20 +22,13 @@ REVISION("$Rev$");
#include "beam.h"
#include "database.h"
#include "debug.h"
-#include "fight.h"
#include "ghost.h"
-#include "itemname.h"
#include "message.h"
-#include "misc.h"
-#include "monplace.h"
#include "monstuff.h"
#include "mon-util.h"
-#include "mstuff2.h"
#include "newgame.h"
#include "player.h"
#include "religion.h"
-#include "spells2.h"
-#include "spells4.h"
#include "state.h"
#include "stuff.h"
#include "view.h"
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 37224b5310..c3db1f7e04 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -13,7 +13,7 @@ REVISION("$Rev$");
#include <stdio.h>
#include <algorithm>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
@@ -45,7 +45,6 @@ REVISION("$Rev$");
#include "monplace.h"
#include "monspeak.h"
#include "mon-los.h"
-#include "mon-pick.h"
#include "mon-util.h"
#include "mutation.h"
#include "mstuff2.h"
@@ -55,7 +54,6 @@ REVISION("$Rev$");
#include "spl-mis.h"
#include "spl-util.h"
#include "spells3.h"
-#include "spells4.h"
#include "state.h"
#include "stuff.h"
#include "terrain.h"
@@ -5431,10 +5429,11 @@ static bool _is_player_or_mon_sanct(const monsters* monster)
|| is_sanctuary(monster->pos()));
}
-bool mons_avoids_cloud(const monsters *monster, cloud_type cl_type,
+bool mons_avoids_cloud(const monsters *monster, cloud_struct cloud,
bool placement)
{
bool extra_careful = placement;
+ cloud_type cl_type = cloud.type;
if (placement)
extra_careful = true;
@@ -5520,6 +5519,28 @@ bool mons_avoids_cloud(const monsters *monster, cloud_type cl_type,
return (false);
break;
+ case CLOUD_RAIN:
+ // Fiery monsters dislike the rain.
+ if (monster->is_fiery() && extra_careful)
+ return (true);
+
+ // We don't care about what's underneath the rain cloud if we can fly.
+ if (monster->flight_mode() != FL_NONE)
+ return (false);
+
+ // These don't care about deep water.
+ if (monster_habitable_grid(monster, DNGN_DEEP_WATER))
+ return (false);
+
+ // This position could become deep water, and they might drown.
+ if (grd(cloud.pos) == DNGN_SHALLOW_WATER)
+ return (true);
+
+ // Otherwise, it's safe for everyone else.
+ return (false);
+
+ break;
+
default:
break;
}
@@ -5554,7 +5575,7 @@ bool mons_avoids_cloud(const monsters *monster, int cloud_num,
*cl_type = cloud.type;
// Is the target cloud okay?
- if (!mons_avoids_cloud(monster, cloud.type, placement))
+ if (!mons_avoids_cloud(monster, cloud, placement))
return (false);
// If we're already in a cloud that we'd want to avoid then moving
@@ -5569,7 +5590,7 @@ bool mons_avoids_cloud(const monsters *monster, int cloud_num,
const cloud_struct &our_cloud = env.cloud[our_cloud_num];
- return (!mons_avoids_cloud(monster, our_cloud.type, true));
+ return (!mons_avoids_cloud(monster, our_cloud, true));
}
//---------------------------------------------------------------
@@ -5812,9 +5833,10 @@ static bool _handle_special_ability(monsters *monster, bolt & beem)
{
case MONS_UGLY_THING:
case MONS_VERY_UGLY_THING:
- // A (very) ugly thing's proximity to others of its kind can
- // mutate it into a different (very) ugly thing.
- used = ugly_thing_proximity_mutate(monster);
+ // A (very) ugly thing's proximity to you if you're glowing, or
+ // to others of its kind, can mutate it into a different (very)
+ // ugly thing.
+ used = ugly_thing_mutate(monster, true);
break;
case MONS_ORC_KNIGHT:
@@ -7903,12 +7925,6 @@ static void _handle_monster_move(monsters *monster)
if (mons_cannot_move(monster) || !_monster_move(monster))
monster->speed_increment -= non_move_energy;
- else if (monster->pos() == old_pos)
- {
- // There was nowhere the monster could move to, so it
- // did nothing.
- monster->speed_increment -= non_move_energy;
- }
}
update_beholders(monster);
@@ -9428,6 +9444,20 @@ static void _mons_in_cloud(monsters *monster)
hurted += (10 * random2avg(12, 3)) / speed; // 3
break;
+ case CLOUD_RAIN:
+ if (monster->is_fiery())
+ {
+ if (!silenced(monster->pos()))
+ simple_monster_message(monster, " sizzles in the rain!");
+ else
+ simple_monster_message(monster, " steams in the rain!");
+
+ hurted += ((4 * random2(3)) - random2(monster->ac));
+ wake = true;
+ }
+
+ break;
+
case CLOUD_MUTAGENIC:
simple_monster_message(monster, " is engulfed in a mutagenic fog!");
diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc
index a4ad05224b..d39aff5257 100644
--- a/crawl-ref/source/mstuff2.cc
+++ b/crawl-ref/source/mstuff2.cc
@@ -40,7 +40,6 @@ REVISION("$Rev$");
#include "religion.h"
#include "spells1.h"
#include "spells3.h"
-#include "spells4.h"
#include "spl-cast.h"
#include "spl-mis.h"
#include "spl-util.h"
@@ -2484,50 +2483,72 @@ bool orange_statue_effects(monsters *mons)
return (false);
}
-void ugly_thing_energy_mutate(monsters *ugly)
+bool ugly_thing_mutate(monsters *ugly, bool proximity)
{
- simple_monster_message(ugly,
- " basks in the mutagenic energy and changes!");
- ugly->uglything_mutate();
-}
+ bool success = false;
-bool ugly_thing_proximity_mutate(monsters *ugly)
-{
- if (one_chance_in(9))
+ std::string src = "";
+
+ if (!proximity)
+ success = true;
+ else if (one_chance_in(8))
{
- int mutate_chance = 0;
+ int you_mutate_chance = 0;
+ int mon_mutate_chance = 0;
for (adjacent_iterator ri(ugly->pos()); ri; ++ri)
{
- monsters *ugly_near = monster_at(*ri);
+ if (you.pos() == *ri)
+ you_mutate_chance = get_contamination_level();
+ else
+ {
+ monsters *ugly_near = monster_at(*ri);
- if (ugly_near == NULL)
- continue;
+ if (ugly_near == NULL
+ || ugly_near->type != MONS_UGLY_THING
+ && ugly_near->type != MONS_VERY_UGLY_THING)
+ {
+ continue;
+ }
- if (ugly_near->type == MONS_UGLY_THING
- || ugly_near->type == MONS_VERY_UGLY_THING)
- {
if (coinflip())
- mutate_chance++;
+ mon_mutate_chance++;
if (ugly_near->type == MONS_VERY_UGLY_THING)
{
if (coinflip())
- mutate_chance++;
+ mon_mutate_chance++;
}
}
}
- if (!one_chance_in(mutate_chance + 1))
+ you_mutate_chance = std::min(16, you_mutate_chance);
+ mon_mutate_chance = std::min(16, mon_mutate_chance);
+
+ if (!one_chance_in(you_mutate_chance + mon_mutate_chance + 1))
{
- simple_monster_message(ugly,
- " basks in the mutagenic energy from its kin and changes!");
- ugly->uglything_mutate();
+ const bool proximity_you =
+ (you_mutate_chance > mon_mutate_chance) ? true :
+ (you_mutate_chance == mon_mutate_chance) ? coinflip()
+ : false;
- return (true);
+ src = proximity_you ? " from you" : " from its kin";
+
+ success = true;
}
}
+ if (success)
+ {
+ simple_monster_message(ugly,
+ make_stringf(" basks in the mutagenic energy%s and changes!",
+ src.c_str()).c_str());
+
+ ugly->uglything_mutate();
+
+ return (true);
+ }
+
return (false);
}
diff --git a/crawl-ref/source/mstuff2.h b/crawl-ref/source/mstuff2.h
index 4265c75e30..0529d03c86 100644
--- a/crawl-ref/source/mstuff2.h
+++ b/crawl-ref/source/mstuff2.h
@@ -27,8 +27,7 @@ bool monster_random_space(const monsters *monster, coord_def& target,
bool monster_random_space(monster_type mon, coord_def& target,
bool forbid_sanctuary = false);
void monster_teleport(monsters *monster, bool instan, bool silent = false);
-void ugly_thing_energy_mutate(monsters *ugly);
-bool ugly_thing_proximity_mutate(monsters *ugly);
+bool ugly_thing_mutate(monsters *ugly, bool proximity = false);
bool orc_battle_cry(monsters *chief);
bool orange_statue_effects(monsters *mons);
bool silver_statue_effects(monsters *mons);
diff --git a/crawl-ref/source/mtransit.cc b/crawl-ref/source/mtransit.cc
index fa230fab96..9f06b61832 100644
--- a/crawl-ref/source/mtransit.cc
+++ b/crawl-ref/source/mtransit.cc
@@ -16,7 +16,6 @@ REVISION("$Rev$");
#include "items.h"
#include "monplace.h"
#include "mon-util.h"
-#include "monstuff.h"
#include "stuff.h"
#define MAX_LOST 100
diff --git a/crawl-ref/source/mtransit.h b/crawl-ref/source/mtransit.h
index 7bd6c81522..ef7a113553 100644
--- a/crawl-ref/source/mtransit.h
+++ b/crawl-ref/source/mtransit.h
@@ -7,7 +7,6 @@
#ifndef MTRANSIT_H
#define MTRANSIT_H
-#include "AppHdr.h"
#include "travel.h"
#include <map>
#include <list>
diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc
index 2e31042c3c..e984c88972 100644
--- a/crawl-ref/source/mutation.cc
+++ b/crawl-ref/source/mutation.cc
@@ -14,7 +14,7 @@ REVISION("$Rev$");
#include <sstream>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
@@ -41,7 +41,6 @@ REVISION("$Rev$");
#include "stuff.h"
#include "transfor.h"
#include "tutorial.h"
-#include "view.h"
#include "xom.h"
static int _body_covered();
@@ -1308,6 +1307,12 @@ formatted_string describe_mutations()
// Breathe poison replaces spit poison.
if (!you.mutation[MUT_BREATHE_POISON])
result += "You can spit poison." EOL;
+ if (you.experience_level > 2)
+ {
+ std::ostringstream num;
+ num << you.experience_level/3;
+ result += "Your serpentine skin is tough (AC +" + num.str() + ")." EOL;
+ }
have_any = true;
break;
@@ -1468,6 +1473,17 @@ formatted_string describe_mutations()
have_any = true;
}
+ if (player_genus(GENPC_DRACONIAN))
+ {
+ int ac = (you.experience_level < 8) ? 2 :
+ (you.species == SP_GREY_DRACONIAN)
+ ? (you.experience_level - 4) / 2 + 1 :
+ you.experience_level / 4 + 1;
+ std::ostringstream num;
+ num << ac;
+ result += "Your scales are hard (AC +" + num.str() + ")." EOL;
+ }
+
result += "</lightblue>";
if (beogh_water_walk())
@@ -1904,6 +1920,7 @@ static mutation_type _get_random_mutation(bool prefer_good,
return (chosen);
}
+#ifdef DEBUG
static bool _is_random(mutation_type which_mutation)
{
return (which_mutation == RANDOM_MUTATION
@@ -1911,6 +1928,7 @@ static bool _is_random(mutation_type which_mutation)
|| which_mutation == RANDOM_GOOD_MUTATION
|| which_mutation == RANDOM_BAD_MUTATION);
}
+#endif
// Tries to give you the mutation by deleting a conflicting
// one, or clears out conflicting mutations if we should give
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc
index d2838111b0..e8219cb908 100644
--- a/crawl-ref/source/newgame.cc
+++ b/crawl-ref/source/newgame.cc
@@ -16,7 +16,7 @@ REVISION("$Rev$");
#include <time.h>
#include <algorithm>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#include <dos.h>
#endif
@@ -37,11 +37,8 @@ REVISION("$Rev$");
#include "describe.h"
#include "dungeon.h"
#include "files.h"
-#include "fight.h"
#include "food.h"
#include "initfile.h"
-#include "it_use2.h"
-#include "item_use.h"
#include "itemname.h"
#include "itemprop.h"
#include "items.h"
@@ -49,7 +46,6 @@ REVISION("$Rev$");
#include "makeitem.h"
#include "menu.h"
#include "misc.h"
-#include "place.h"
#include "player.h"
#include "religion.h"
#include "skills.h"
@@ -58,10 +54,8 @@ REVISION("$Rev$");
#include "spl-util.h"
#include "state.h"
#include "stuff.h"
-#include "tiles.h"
#include "tutorial.h"
#include "version.h"
-#include "view.h"
extern std::string init_file_error;
@@ -536,12 +530,12 @@ int give_first_conjuration_book()
}
else if (you.skills[SK_FIRE_MAGIC] == 0 && you.skills[SK_EARTH_MAGIC] == 0)
{
- // If we're here its because we were going to default to the
+ // If we're here it's because we were going to default to the
// fire/earth book... but we don't have those skills. So we
// choose randomly based on the species weighting, again
- // ignoring air/earth which are secondary in these books. -- bwr
- if (random2( species_skills( SK_ICE_MAGIC, you.species ) )
- < random2( species_skills( SK_FIRE_MAGIC, you.species ) ))
+ // ignoring air/earth which are secondary in these books. - bwr
+ if (random2(species_skills(SK_ICE_MAGIC, you.species)) <
+ random2(species_skills(SK_FIRE_MAGIC, you.species)))
{
book = BOOK_CONJURATIONS_II;
}
@@ -2391,8 +2385,8 @@ static bool _choose_weapon()
if (claws_allowed)
{
- for (int i = 3; i >= 0; i--)
- startwep[i+1] = startwep[i];
+ for (int i = 3; i >= 0; --i)
+ startwep[i + 1] = startwep[i];
startwep[0] = WPN_UNARMED;
}
@@ -3328,7 +3322,7 @@ static bool _validate_player_name(bool verbose)
bool validate_player_name(const char* name, bool verbose)
{
-#if defined(DOS) || defined(WIN32CONSOLE) || defined(WIN32TILES)
+#if defined(TARGET_OS_DOS) || defined(WIN32CONSOLE) || defined(WIN32TILES)
// Quick check for CON -- blows up real good under DOS/Windows.
if (stricmp(name, "con") == 0
|| stricmp(name, "nul") == 0
@@ -3474,26 +3468,30 @@ static bool _give_wanderer_weapon(int & slot, int wpn_skill, int plus)
// Now fill in the type according to the random wpn_skill.
switch (wpn_skill)
{
- case SK_MACES_FLAILS:
- you.inv[slot].sub_type = WPN_MACE;
- break;
-
- case SK_POLEARMS:
- you.inv[slot].sub_type = WPN_SPEAR;
- break;
-
case SK_SHORT_BLADES:
you.inv[slot].sub_type = WPN_SHORT_SWORD;
break;
+ case SK_MACES_FLAILS:
+ you.inv[slot].sub_type = WPN_MACE;
+ break;
+
case SK_AXES:
you.inv[slot].sub_type = WPN_HAND_AXE;
break;
+ case SK_POLEARMS:
+ you.inv[slot].sub_type = WPN_SPEAR;
+ break;
+
case SK_STAVES:
you.inv[slot].sub_type = WPN_QUARTERSTAFF;
break;
+ case SK_DARTS:
+ you.inv[slot].sub_type = WPN_BLOWGUN;
+ break;
+
case SK_BOWS:
you.inv[slot].sub_type = WPN_BOW;
break;
@@ -3501,10 +3499,6 @@ static bool _give_wanderer_weapon(int & slot, int wpn_skill, int plus)
case SK_CROSSBOWS:
you.inv[slot].sub_type = WPN_HAND_CROSSBOW;
break;
-
- case SK_DARTS:
- you.inv[slot].sub_type = WPN_BLOWGUN;
- break;
}
int offset = plus ? 1 : 0;
@@ -4174,7 +4168,7 @@ void _wanderer_decent_equipment(skill_type & skill,
// If we already gave an item for this type, just give the player
// a consumable.
- if((skill == SK_DODGING || skill == SK_STEALTH)
+ if ((skill == SK_DODGING || skill == SK_STEALTH)
&& gift_skills.find(SK_ARMOUR) != gift_skills.end())
{
skill = SK_TRAPS_DOORS;
@@ -4200,7 +4194,7 @@ void _wanderer_decent_equipment(skill_type & skill,
int max_sklev = 0;
skill_type max_skill = SK_NONE;
- for (int i = 0;i < total_weapons; ++i)
+ for (int i = 0; i < total_weapons; ++i)
{
if (you.skills[combined_weapon_skills[i]] >= max_sklev)
{
@@ -5346,7 +5340,17 @@ bool _give_items_skills()
if (you.has_claws())
you.equip[EQ_WEAPON] = -1; // Trolls/Ghouls fight unarmed.
else
- _newgame_make_item(0, EQ_WEAPON, OBJ_WEAPONS, WPN_HAND_AXE);
+ {
+ // Races skilled with maces/flails get one, the others axes.
+ weapon_type startwep = WPN_HAND_AXE;
+ if (species_skills(SK_MACES_FLAILS, you.species) <
+ species_skills(SK_AXES, you.species))
+ {
+ startwep = (player_genus(GENPC_OGRE)) ? WPN_ANKUS : WPN_MACE;
+ }
+
+ _newgame_make_item(0, EQ_WEAPON, OBJ_WEAPONS, startwep);
+ }
// ARMOUR
_newgame_make_item(1, EQ_BODY_ARMOUR, OBJ_ARMOUR, ARM_ANIMAL_SKIN);
diff --git a/crawl-ref/source/notes.cc b/crawl-ref/source/notes.cc
index 20a64451db..748da46ac2 100644
--- a/crawl-ref/source/notes.cc
+++ b/crawl-ref/source/notes.cc
@@ -19,8 +19,6 @@ REVISION("$Rev$");
#include "files.h"
#include "kills.h"
#include "hiscores.h"
-#include "message.h"
-#include "mon-pick.h"
#include "mutation.h"
#include "place.h"
#include "religion.h"
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index 205f9b2286..27b382fa6c 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -15,7 +15,7 @@ REVISION("$Rev$");
#include <ctype.h>
#include <time.h>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#include <file.h>
#endif
@@ -28,7 +28,7 @@ REVISION("$Rev$");
#include "ouch.h"
-#ifdef __MINGW32__
+#ifdef TARGET_COMPILER_MINGW
#include <io.h>
#endif
@@ -887,7 +887,7 @@ static void _maybe_spawn_jellies(int dam, const char* aux,
}
-
+#ifdef WIZARD
static void _wizard_restore_life()
{
if (you.hp <= 0)
@@ -909,6 +909,7 @@ static void _wizard_restore_life()
you.redraw_intelligence = true;
}
}
+#endif
// death_source should be set to NON_MONSTER for non-monsters. {dlb}
void ouch(int dam, int death_source, kill_method_type death_type,
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index e036ab19ca..7ec43683b7 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -12,7 +12,7 @@ REVISION("$Rev$");
#include <stdlib.h>
#include <sstream>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
@@ -28,7 +28,6 @@ REVISION("$Rev$");
#include "initfile.h"
#include "itemname.h"
#include "itemprop.h"
-#include "items.h"
#include "item_use.h"
#include "menu.h"
#include "message.h"
@@ -44,7 +43,6 @@ REVISION("$Rev$");
#include "skills2.h"
#include "stuff.h"
#include "transfor.h"
-#include "tiles.h"
#include "travel.h"
#include "view.h"
diff --git a/crawl-ref/source/overmap.cc b/crawl-ref/source/overmap.cc
index 30c526ee15..bb59e46571 100644
--- a/crawl-ref/source/overmap.cc
+++ b/crawl-ref/source/overmap.cc
@@ -27,7 +27,6 @@ REVISION("$Rev$");
#include "files.h"
#include "initfile.h"
#include "menu.h"
-#include "misc.h"
#include "religion.h"
#include "shopping.h"
#include "state.h"
diff --git a/crawl-ref/source/platform.h b/crawl-ref/source/platform.h
new file mode 100644
index 0000000000..65d4a7d712
--- /dev/null
+++ b/crawl-ref/source/platform.h
@@ -0,0 +1,288 @@
+/*
+ * CrissCross
+ * A multi-purpose cross-platform library.
+ *
+ * A product of Uplink Laboratories.
+ *
+ * (c) 2006-2009 Steven Noonan.
+ * Licensed under the New BSD License.
+ *
+ */
+
+/*
+ *
+ * Preprocessor Definitions
+ * ------------------------
+ *
+ * TARGET_CPU_ARM
+ * ARM processor
+ * TARGET_CPU_ALPHA
+ * DEC Alpha processor
+ * TARGET_CPU_SPARC
+ * Sun Microsystems SPARC processor
+ * TARGET_CPU_X86
+ * Intel x86 processor
+ * TARGET_CPU_IA64
+ * Intel Itanic processor
+ * TARGET_CPU_X64
+ * Intel 64-bit processor
+ * TARGET_CPU_PPC
+ * IBM PowerPC processor
+ *
+ * TARGET_OS_WINDOWS
+ * Windows
+ * TARGET_OS_LINUX
+ * Linux
+ * TARGET_OS_MACOSX
+ * Mac OS X
+ * TARGET_OS_FREEBSD
+ * FreeBSD
+ * TARGET_OS_NETBSD
+ * NetBSD
+ * TARGET_OS_OPENBSD
+ * OpenBSD
+ * TARGET_OS_NDSFIRMWARE
+ * Nintendo DS firmware
+ *
+ * TARGET_COMPILER_GCC
+ * GNU C++ Compiler
+ * TARGET_COMPILER_MINGW
+ * GCC for MinGW
+ * TARGET_COMPILER_VC
+ * Visual C++
+ * TARGET_COMPILER_ICC
+ * Intel C++ Compiler
+ *
+ * TARGET_BIG_ENDIAN
+ * Running on a big endian byte order architecture.
+ * TARGET_LITTLE_ENDIAN
+ * Running on a little endian byte order architecture.
+ *
+ */
+
+#ifndef __included_cc_platform_detect_h
+#define __included_cc_platform_detect_h
+
+#undef PROCESSOR_DETECTED
+#undef COMPILER_DETECTED
+#undef OS_DETECTED
+
+/* ------------------- *
+* PROCESSOR DETECTION *
+* ------------------- */
+
+/* Carbon defines this for us on Mac, apparently... */
+#if defined (TARGET_CPU_PPC)
+#define PROCESSOR_DETECTED
+#endif
+
+/* ARM */
+#if !defined (PROCESSOR_DETECTED)
+#if defined (__arm__)
+#define PROCESSOR_DETECTED
+#define TARGET_CPU_ARM
+#define TARGET_LITTLE_ENDIAN
+#endif
+#endif
+
+/* DEC Alpha */
+#if !defined (PROCESSOR_DETECTED)
+#if defined (__alpha) || defined (__alpha__)
+#define PROCESSOR_DETECTED
+#define TARGET_CPU_ALPHA
+#define TARGET_LITTLE_ENDIAN /* How should bi-endianness be handled? */
+#endif
+#endif
+
+/* Sun SPARC */
+#if !defined (PROCESSOR_DETECTED)
+#if defined (__sparc) || defined (__sparc__)
+#define PROCESSOR_DETECTED
+#define TARGET_CPU_SPARC
+#define TARGET_BIG_ENDIAN
+#endif
+#endif
+
+/* PowerPC */
+#if !defined (PROCESSOR_DETECTED)
+#if defined (_ARCH_PPC) || defined (__ppc__) || defined (__ppc64__) || defined (__PPC) || defined (powerpc) || defined (__PPC__) || defined (__powerpc64__) || defined (__powerpc64)
+#define PROCESSOR_DETECTED
+#if defined (__ppc64__) || defined (__powerpc64__) || defined (__powerpc64)
+#define TARGET_CPU_PPC 64
+#else
+#define TARGET_CPU_PPC 32
+#endif
+#define TARGET_BIG_ENDIAN
+#endif
+#endif
+
+/* x86_64 or AMD64 or x64 */
+#if !defined (PROCESSOR_DETECTED)
+#if defined (__x86_64__) || defined (__x86_64) || defined (__amd64) || defined (__amd64__) || defined (_AMD64_) || defined (_M_X64)
+#define PROCESSOR_DETECTED
+#define TARGET_CPU_X64
+#define TARGET_CPU_X86_64
+#define TARGET_LITTLE_ENDIAN
+#endif
+#endif
+
+/* Intel x86 */
+#if !defined (PROCESSOR_DETECTED)
+#if defined (__i386__) || defined (__i386) || defined (i386) || defined (_X86_) || defined (_M_IX86)
+#define PROCESSOR_DETECTED
+#define TARGET_CPU_X86
+#define TARGET_LITTLE_ENDIAN
+#endif
+#endif
+
+/* IA64 */
+#if !defined (PROCESSOR_DETECTED)
+#if defined (__ia64__) || defined (_IA64) || defined (__ia64) || defined (_M_IA64)
+#define PROCESSOR_DETECTED
+#define TARGET_CPU_IA64
+#define TARGET_LITTLE_ENDIAN
+#endif
+#endif
+
+/* ------------------- *
+* COMPILER DETECTION *
+* ------------------- */
+
+#if !defined (COMPILER_DETECTED)
+#if defined (__GNUC__)
+#define COMPILER_DETECTED
+#define TARGET_COMPILER_GCC
+#endif
+#if defined (__CYGWIN__) || defined (__CYGWIN32__)
+#define TARGET_COMPILER_CYGWIN
+#endif
+#if defined (__MINGW32__)
+#define TARGET_COMPILER_MINGW
+#endif
+#if defined (__DJGPP__)
+#define TARGET_COMPILER_DJGPP
+#endif
+#endif
+
+#if !defined (COMPILER_DETECTED)
+#if defined (__INTEL_COMPILER) || defined (__ICL)
+#define COMPILER_DETECTED
+#define TARGET_COMPILER_ICC
+#endif
+#endif
+
+#if !defined (COMPILER_DETECTED)
+#if defined (_MSC_VER)
+#define COMPILER_DETECTED
+#define TARGET_COMPILER_VC
+#endif
+#endif
+
+#if !defined (COMPILER_DETECTED)
+#if defined (__BORLANDC__)
+/* Earlier Borland compilers break terribly */
+#if __BORLANDC__ >= 0x0600
+#define COMPILER_DETECTED
+#define TARGET_COMPILER_BORLAND
+#endif
+#endif
+#endif
+
+/* ------------ *
+* OS DETECTION *
+* ------------ */
+
+#if !defined (OS_DETECTED)
+#if defined (TARGET_COMPILER_VC) || defined (_WIN32) || defined (_WIN64)
+#define OS_DETECTED
+#define TARGET_OS_WINDOWS
+#endif
+#endif
+
+#if !defined (OS_DETECTED)
+#if defined (__linux__) || defined (linux) || defined (__linux) || defined (__gnu_linux__) || defined (__CYGWIN__)
+#define OS_DETECTED
+#define TARGET_OS_LINUX
+#endif
+#endif
+
+#if !defined (OS_DETECTED)
+#if defined (TARGET_CPU_ARM)
+#define OS_DETECTED
+#define TARGET_OS_NDSFIRMWARE
+#endif
+#endif
+
+#if !defined (OS_DETECTED)
+#if defined (MSDOS) || defined (__DOS__) || defined (__DJGPP__)
+#define OS_DETECTED
+#define TARGET_OS_DOS
+#endif
+#endif
+
+#if !defined (OS_DETECTED)
+#if defined (__sun__)
+#define OS_DETECTED
+#define TARGET_OS_SOLARIS
+#endif
+#endif
+
+#if !defined (OS_DETECTED)
+#if defined (__FreeBSD__)
+#define OS_DETECTED
+#define TARGET_OS_FREEBSD
+#endif
+#endif
+
+#if !defined (OS_DETECTED)
+#if defined (__NetBSD__)
+#define OS_DETECTED
+#define TARGET_OS_NETBSD
+#endif
+#endif
+
+#if !defined (OS_DETECTED)
+#if defined (__OpenBSD__)
+#define OS_DETECTED
+#define TARGET_OS_OPENBSD
+#endif
+#endif
+
+#if !defined (OS_DETECTED)
+#if defined (__APPLE__) || defined (__MACH__)
+#define OS_DETECTED
+#define TARGET_OS_MACOSX
+#endif
+#endif
+
+#if defined (_LP64) || defined (__LP64__) || defined (_M_X64) || defined(_M_IA64)
+#define TARGET_CPU_BITS 64
+#else
+#define TARGET_CPU_BITS 32
+#endif
+
+#if defined (TARGET_CPU_PPC)
+#if TARGET_CPU_PPC == 32
+#define TARGET_CPU_BITS 32
+#elif TARGET_CPU_PPC == 64
+#define TARGET_CPU_BITS 64
+#endif
+#endif
+
+#if !defined (PROCESSOR_DETECTED)
+#error "Could not detect target CPU."
+#endif
+
+#if !defined (COMPILER_DETECTED)
+#error "Could not detect target compiler."
+#endif
+
+#if !defined (OS_DETECTED)
+#error "Could not detect target OS."
+#endif
+
+#if !defined (TARGET_CPU_BITS)
+#error "Could not detect 32-bit/64-bit architecture."
+#endif
+
+#endif
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 72bf5841b7..f86d010662 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -9,7 +9,7 @@ REVISION("$Rev$");
#include "player.h"
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
@@ -25,7 +25,6 @@ REVISION("$Rev$");
#include "artefact.h"
#include "branch.h"
-#include "cio.h"
#include "cloud.h"
#include "clua.h"
#include "delay.h"
@@ -48,7 +47,6 @@ REVISION("$Rev$");
#include "notes.h"
#include "ouch.h"
#include "output.h"
-#include "place.h"
#include "quiver.h"
#include "religion.h"
#include "skills.h"
@@ -1807,6 +1805,10 @@ int player_spec_fire()
if (you.duration[DUR_FIRE_SHIELD])
sf++;
+ // if it's raining... {due}
+ if (in_what_cloud(CLOUD_RAIN))
+ sf--;
+
return sf;
}
@@ -2878,7 +2880,10 @@ int player_sust_abil(bool calc_unid)
int carrying_capacity(burden_state_type bs)
{
- int cap = 3500 + (you.strength * 100) + (player_is_airborne() ? 1000 : 0);
+ int cap = (2 * you.body_weight()) + (you.strength * 200)
+ + (player_is_airborne() ? 1000 : 0);
+ // We are nice to the lighter species in that strength adds absolutely
+ // instead of relatively to body weight. --dpeg
if (bs == BS_UNENCUMBERED)
return ((cap * 5) / 6);
@@ -5284,15 +5289,15 @@ int get_contamination_level()
if (glow > 60)
return (glow / 20 + 2);
if (glow > 40)
- return 4;
+ return (4);
if (glow > 25)
- return 3;
+ return (3);
if (glow > 15)
- return 2;
+ return (2);
if (glow > 5)
- return 1;
+ return (1);
- return 0;
+ return (0);
}
// controlled is true if the player actively did something to cause
@@ -7320,7 +7325,7 @@ bool player::can_see(const actor *target) const
bool player::backlit(bool check_haloed) const
{
- return (get_contamination_level() >= 1 || duration[DUR_BACKLIGHT]
+ return (get_contamination_level() > 0 || duration[DUR_BACKLIGHT]
|| (check_haloed ? haloed() : false));
}
diff --git a/crawl-ref/source/ray.cc b/crawl-ref/source/ray.cc
index a4bb3b21f0..6fea3ec663 100644
--- a/crawl-ref/source/ray.cc
+++ b/crawl-ref/source/ray.cc
@@ -8,106 +8,37 @@ REVISION("$Rev$");
#include "ray.h"
-#include <cmath>
+#include <math.h>
#include "los.h"
#include "terrain.h"
-// Advance a ray in quadrant 0.
-// note that slope must be nonnegative!
-// returns 0 if the advance was in x, 1 if it was in y, 2 if it was
-// the diagonal
-static int _find_next_intercept(double* accx, double* accy, const double slope)
+int ifloor(double d)
{
+ return static_cast<int>(floor(d));
+}
- // handle perpendiculars
- if ( double_is_zero(slope) )
- {
- *accx += 1.0;
- return 0;
- }
- if ( slope > 100.0 )
- {
- *accy += 1.0;
- return 1;
- }
-
- const double xtarget = (static_cast<int>(*accx) + 1);
- const double ytarget = (static_cast<int>(*accy) + 1);
- const double xdistance = xtarget - *accx;
- const double ydistance = ytarget - *accy;
- double distdiff = (xdistance * slope - ydistance);
-
- // exact corner
- if ( double_is_zero( distdiff ) )
- {
- // move somewhat away from the corner
- if ( slope > 1.0 )
- {
- *accx = xtarget + EPSILON_VALUE * 2;
- *accy = ytarget + EPSILON_VALUE * 2 * slope;
- }
- else
- {
- *accx = xtarget + EPSILON_VALUE * 2 / slope;
- *accy = ytarget + EPSILON_VALUE * 2;
- }
- return 2;
- }
-
- // move to the boundary
- double traveldist;
- int rc = -1;
- if ( distdiff > 0.0 )
- {
- traveldist = ydistance / slope;
- rc = 1;
- }
- else
- {
- traveldist = xdistance;
- rc = 0;
- }
-
- // and a little into the next cell, taking care
- // not to go too far
- if ( distdiff < 0.0 )
- distdiff = -distdiff;
- traveldist += std::min(EPSILON_VALUE * 10.0, 0.5 * distdiff / slope);
-
- *accx += traveldist;
- *accy += traveldist * slope;
- return rc;
+ray_def::ray_def(double ax, double ay, double s, quad_type q, int idx)
+ : accx(ax), accy(ay), slope(s), quadrant(q), fullray_idx(idx)
+{
}
-// Shoot a ray from the given start point (accx, accy) with the given
-// slope, bounded by LOS radius. Store the visited cells in
-// xpos[] and ypos[], and return the number of cells visited.
-int shoot_ray(double accx, double accy, const double slope,
- int maxrange, int xpos[], int ypos[])
+int ray_def::x() const
{
- int curx, cury;
- int cellnum;
- for (cellnum = 0; true; ++cellnum)
- {
- _find_next_intercept(&accx, &accy, slope);
- curx = static_cast<int>(accx);
- cury = static_cast<int>(accy);
- if (curx*curx + cury*cury > get_los_radius_squared())
- break;
+ return ifloor(accx);
+}
- xpos[cellnum] = curx;
- ypos[cellnum] = cury;
- }
- return cellnum;
+int ray_def::y() const
+{
+ return ifloor(accy);
}
-ray_def::ray_def()
- : accx(0.0), accy(0.0), slope(0.0), quadrant(0), fullray_idx(-1)
+coord_def ray_def::pos() const
{
+ return coord_def(x(), y());
}
-double ray_def::reflect(double p, double c) const
+double _reflect(double p, double c)
{
return (c + c - p);
}
@@ -115,111 +46,109 @@ double ray_def::reflect(double p, double c) const
double ray_def::reflect(bool rx, double oldx, double newx) const
{
if (rx ? fabs(slope) > 1.0 : fabs(slope) < 1.0)
- return (reflect(oldx, floor(oldx) + 0.5));
+ return (_reflect(oldx, floor(oldx) + 0.5));
const double flnew = floor(newx);
const double flold = floor(oldx);
- return (reflect(oldx,
- flnew > flold? flnew :
- flold > flnew? flold :
- (newx + oldx) / 2));
+ return (_reflect(oldx,
+ flnew > flold ? flnew :
+ flold > flnew ? flold :
+ (newx + oldx) / 2));
}
void ray_def::set_reflect_point(const double oldx, const double oldy,
- double *newx, double *newy,
bool blocked_x, bool blocked_y)
{
if (blocked_x == blocked_y)
{
// What to do?
- *newx = oldx;
- *newy = oldy;
+ accx = oldx;
+ accy = oldy;
return;
}
if (blocked_x)
{
- ASSERT(int(oldy) != int(*newy));
- *newy = oldy;
- *newx = reflect(true, oldx, *newx);
+ ASSERT(int(oldy) != int(accy));
+ accy = oldy;
+ accx = reflect(true, oldx, accx);
}
else
{
- ASSERT(int(oldx) != int(*newx));
- *newx = oldx;
- *newy = reflect(false, oldy, *newy);
+ ASSERT(int(oldx) != int(accx));
+ accx = oldx;
+ accy = reflect(false, oldy, accy);
}
}
void ray_def::advance_and_bounce()
{
- // 0 = down-right, 1 = down-left, 2 = up-left, 3 = up-right
- int bouncequad[4][3] =
+ quad_type bouncequad[4][3] =
{
- { 1, 3, 2 }, { 0, 2, 3 }, { 3, 1, 0 }, { 2, 0, 1 }
+ // ADV_X ADV_Y ADV_XY
+ { QUAD_SW, QUAD_NE, QUAD_NW }, // QUAD_SE
+ { QUAD_SE, QUAD_NW, QUAD_NE }, // QUAD_SW
+ { QUAD_NE, QUAD_SW, QUAD_SE }, // QUAD_NW
+ { QUAD_NW, QUAD_SE, QUAD_SW } // QUAD_NE
};
int oldx = x(), oldy = y();
const double oldaccx = accx, oldaccy = accy;
- int rc = advance(false);
+ adv_type rc = advance(false);
int newx = x(), newy = y();
- ASSERT( grid_is_solid(grd[newx][newy]) );
+ ASSERT(grid_is_solid(grd[newx][newy]));
const bool blocked_x = grid_is_solid(grd[oldx][newy]);
const bool blocked_y = grid_is_solid(grd[newx][oldy]);
- if ( double_is_zero(slope) || slope > 100.0 )
- quadrant = bouncequad[quadrant][2];
- else if ( rc != 2 )
+ if (double_is_zero(slope) || slope > 100.0)
+ quadrant = bouncequad[quadrant][ADV_XY];
+ else if (rc != ADV_XY)
quadrant = bouncequad[quadrant][rc];
else
{
- ASSERT( (oldx != newx) && (oldy != newy) );
- if ( blocked_x && blocked_y )
+ ASSERT((oldx != newx) && (oldy != newy));
+ if (blocked_x && blocked_y)
quadrant = bouncequad[quadrant][rc];
- else if ( blocked_x )
- quadrant = bouncequad[quadrant][1];
+ else if (blocked_x)
+ quadrant = bouncequad[quadrant][ADV_Y];
else
- quadrant = bouncequad[quadrant][0];
+ quadrant = bouncequad[quadrant][ADV_X];
}
- set_reflect_point(oldaccx, oldaccy, &accx, &accy, blocked_x, blocked_y);
+ set_reflect_point(oldaccx, oldaccy, blocked_x, blocked_y);
}
double ray_def::get_degrees() const
{
if (slope > 100.0)
{
- if (quadrant == 3 || quadrant == 2)
+ if (quadrant == QUAD_NW || quadrant == QUAD_NE)
return (90.0);
else
return (270.0);
}
else if (double_is_zero(slope))
{
- if (quadrant == 0 || quadrant == 3)
+ if (quadrant == QUAD_SE || quadrant == QUAD_NE)
return (0.0);
else
return (180.0);
}
- double deg = atan(slope) * 180.0 / M_PI;
+ double deg = atan(slope) * 180.0 / M_PI; // 0 < deg < 90
switch (quadrant)
{
- case 0:
+ case QUAD_SE:
return (360.0 - deg);
-
- case 1:
+ case QUAD_SW:
return (180.0 + deg);
-
- case 2:
+ case QUAD_NW:
return (180.0 - deg);
-
- case 3:
+ case QUAD_NE:
+ default:
return (deg);
}
- ASSERT(!"ray has illegal quadrant");
- return (0.0);
}
void ray_def::set_degrees(double deg)
@@ -236,27 +165,27 @@ void ray_def::set_degrees(double deg)
slope = 0.0;
if (deg < 90.0 || deg > 270.0)
- quadrant = 0; // right/east
+ quadrant = QUAD_SE;
else
- quadrant = 1; // left/west
+ quadrant = QUAD_SW;
}
else if (_slope > 0)
{
slope = _slope;
if (deg >= 180.0 && deg <= 270.0)
- quadrant = 1;
+ quadrant = QUAD_SW;
else
- quadrant = 3;
+ quadrant = QUAD_NE;
}
else
{
slope = -_slope;
if (deg >= 90 && deg <= 180)
- quadrant = 2;
+ quadrant = QUAD_NW;
else
- quadrant = 0;
+ quadrant = QUAD_SE;
}
if (slope > 1000.0)
@@ -265,18 +194,18 @@ void ray_def::set_degrees(double deg)
void ray_def::regress()
{
- int opp_quadrant[4] = { 2, 3, 0, 1 };
+ quad_type opp_quadrant[4] = { QUAD_NW, QUAD_NE, QUAD_SE, QUAD_SW };
quadrant = opp_quadrant[quadrant];
advance(false);
quadrant = opp_quadrant[quadrant];
}
-int ray_def::advance_through(const coord_def &target)
+adv_type ray_def::advance_through(const coord_def &target)
{
return (advance(true, &target));
}
-int ray_def::advance(bool shortest_possible, const coord_def *target)
+adv_type ray_def::advance(bool shortest_possible, const coord_def *target)
{
if (!shortest_possible)
return (raw_advance());
@@ -284,19 +213,19 @@ int ray_def::advance(bool shortest_possible, const coord_def *target)
// If we want to minimise the number of moves on the ray, look one
// step ahead and see if we can get a diagonal.
- const coord_def old(static_cast<int>(accx), static_cast<int>(accy));
- const int ret = raw_advance();
+ const coord_def old = pos();
+ const adv_type ret = raw_advance();
- if (ret == 2 || (target && pos() == *target))
+ if (ret == ADV_XY || (target && pos() == *target))
return (ret);
const double maccx = accx, maccy = accy;
- if (raw_advance() != 2)
+ if (raw_advance() != ADV_XY)
{
- const coord_def second(static_cast<int>(accx), static_cast<int>(accy));
+ const coord_def second = pos();
// If we can convert to a diagonal, do so.
if ((second - old).abs() == 2)
- return (2);
+ return (ADV_XY);
}
// No diagonal, so roll back.
@@ -306,37 +235,110 @@ int ray_def::advance(bool shortest_possible, const coord_def *target)
return (ret);
}
-int ray_def::raw_advance()
+// Advance a ray in quadrant 0.
+// note that slope must be nonnegative!
+// returns 0 if the advance was in x, 1 if it was in y, 2 if it was
+// the diagonal
+adv_type ray_def::raw_advance_0()
{
- int rc;
- switch (quadrant)
+ // handle perpendiculars
+ if (double_is_zero(slope))
{
- case 0:
- // going down-right
- rc = _find_next_intercept(&accx, &accy, slope);
- return rc;
- case 1:
- // going down-left
- accx = 100.0 - EPSILON_VALUE/10.0 - accx;
- rc = _find_next_intercept(&accx, &accy, slope);
- accx = 100.0 - EPSILON_VALUE/10.0 - accx;
- return rc;
- case 2:
- // going up-left
- accx = 100.0 - EPSILON_VALUE/10.0 - accx;
- accy = 100.0 - EPSILON_VALUE/10.0 - accy;
- rc = _find_next_intercept(&accx, &accy, slope);
- accx = 100.0 - EPSILON_VALUE/10.0 - accx;
- accy = 100.0 - EPSILON_VALUE/10.0 - accy;
- return rc;
- case 3:
- // going up-right
- accy = 100.0 - EPSILON_VALUE/10.0 - accy;
- rc = _find_next_intercept(&accx, &accy, slope);
- accy = 100.0 - EPSILON_VALUE/10.0 - accy;
- return rc;
- default:
- return -1;
+ accx += 1.0;
+ return ADV_X;
+ }
+ if (slope > 100.0)
+ {
+ accy += 1.0;
+ return ADV_Y;
+ }
+
+ const double xtarget = ifloor(accx) + 1;
+ const double ytarget = ifloor(accy) + 1;
+ const double xdistance = xtarget - accx;
+ const double ydistance = ytarget - accy;
+ double distdiff = xdistance * slope - ydistance;
+
+ // exact corner
+ if (double_is_zero(distdiff))
+ {
+ // move somewhat away from the corner
+ if (slope > 1.0)
+ {
+ accx = xtarget + EPSILON_VALUE * 2;
+ accy = ytarget + EPSILON_VALUE * 2 * slope;
+ }
+ else
+ {
+ accx = xtarget + EPSILON_VALUE * 2 / slope;
+ accy = ytarget + EPSILON_VALUE * 2;
+ }
+ return ADV_XY;
+ }
+
+ // move to the boundary
+ double traveldist;
+ adv_type rc;
+ if (distdiff > 0.0)
+ {
+ traveldist = ydistance / slope;
+ rc = ADV_Y;
+ }
+ else
+ {
+ traveldist = xdistance;
+ rc = ADV_X;
}
+
+ // and a little into the next cell, taking care
+ // not to go too far
+ if (distdiff < 0.0)
+ distdiff = -distdiff;
+ traveldist += std::min(EPSILON_VALUE * 10.0, 0.5 * distdiff / slope);
+
+ accx += traveldist;
+ accy += traveldist * slope;
+ return rc;
}
+/*
+ * Mirror ray into quadrant 0 or back.
+ * this.quadrant itself is not touched (used for the flip back).
+ */
+void ray_def::flip()
+{
+ int signx[] = {1, -1, -1, 1};
+ int signy[] = {1, 1, -1, -1};
+ accx *= signx[quadrant];
+ accy *= signy[quadrant];
+}
+
+adv_type ray_def::raw_advance()
+{
+ adv_type rc;
+ flip();
+ rc = raw_advance_0();
+ flip();
+ return rc;
+}
+
+// Shoot a ray from the given start point (accx, accy) with the given
+// slope, bounded by the given pre-squared LOS radius.
+// Store the visited cells in pos[], and
+// return the number of cells visited.
+int ray_def::footprint(int radius2, coord_def cpos[]) const
+{
+ ray_def copy = *this;
+ coord_def c;
+ int cellnum;
+ for (cellnum = 0; true; ++cellnum)
+ {
+ copy.raw_advance();
+ c = copy.pos();
+ if (c.abs() > radius2)
+ break;
+
+ cpos[cellnum] = c;
+ }
+ return cellnum;
+}
diff --git a/crawl-ref/source/ray.h b/crawl-ref/source/ray.h
index 8816c20171..0bf5609b7f 100644
--- a/crawl-ref/source/ray.h
+++ b/crawl-ref/source/ray.h
@@ -7,8 +7,22 @@
#ifndef RAY_H
#define RAY_H
-int shoot_ray(double accx, double accy, const double slope,
- int maxrange, int xpos[], int ypos[]);
+// quadrant
+enum quad_type
+{
+ QUAD_SE = 0,
+ QUAD_SW = 1,
+ QUAD_NW = 2,
+ QUAD_NE = 3
+};
+
+// direction of advance:
+enum adv_type
+{
+ ADV_X = 0, // changed x
+ ADV_Y = 1, // changed y
+ ADV_XY = 2 // changed x and y (diagonal)
+};
struct ray_def
{
@@ -16,32 +30,35 @@ public:
double accx;
double accy;
double slope;
- int quadrant; // 0 down-right, 1 down-left, 2 up-left, 3 up-right
+ quad_type 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);
+ ray_def(double accx = 0.0, double accy = 0.0, double slope = 0.0,
+ quad_type quadrant = QUAD_SE, int fullray_idx = -1);
+ int x() const;
+ int y() const;
+ coord_def pos() const;
+
+ // returns the direction taken
+ adv_type advance(bool shorten = false, const coord_def *p = NULL);
+ adv_type advance_through(const coord_def &point);
void advance_and_bounce();
void regress();
+ int footprint(int radius2, coord_def pos[]) const;
+
// Gets/sets the slope in terms of degrees, with 0 = east, 90 = north,
// 180 = west, 270 = south, 360 = east, -90 = south, etc
double get_degrees() const;
void set_degrees(double deg);
-private:
- int raw_advance();
+protected:
+ adv_type raw_advance_0();
+ void flip();
+ adv_type 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);
};
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 842202c414..270a4ca04b 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -16,7 +16,7 @@ REVISION("$Rev$");
#include <stdio.h>
#include <cmath>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <dos.h>
#endif
@@ -595,10 +595,10 @@ std::string get_god_likes(god_type which_god, bool verbose)
break;
}
- if (god_likes_butchery(which_god))
+ if (god_likes_fresh_corpses(which_god))
{
- snprintf(info, INFO_SIZE, "you butcher corpses while praying%s",
- verbose ? " (press <w>pc</w> to do so)" : "");
+ snprintf(info, INFO_SIZE, "you sacrifice fresh corpses%s",
+ verbose ? " (by standing over them and <w>p</w>raying)" : "");
likes.push_back(info);
}
@@ -818,8 +818,8 @@ std::string get_god_dislikes(god_type which_god, bool /*verbose*/)
case GOD_ZIN:
dislikes.push_back("you deliberately mutate yourself");
dislikes.push_back("you polymorph monsters");
- dislikes.push_back("you eat the flesh of sentient beings");
dislikes.push_back("you use chaotic magic or items");
+ dislikes.push_back("you eat the flesh of sentient beings");
break;
case GOD_SHINING_ONE:
@@ -1390,7 +1390,7 @@ static void _give_nemelex_gift()
deck.colour = deck_rarity_to_color(rarity);
deck.inscription = "god gift";
- move_item_to_grid( &thing_created, you.pos() );
+ move_item_to_grid(&thing_created, you.pos());
simple_god_message(" grants you a gift!");
more();
@@ -2387,7 +2387,7 @@ static bool _god_accepts_prayer(god_type god)
return (true);
}
- if (god_likes_butchery(god))
+ if (god_likes_fresh_corpses(god) || god_likes_butchery(god))
return (true);
switch (god)
@@ -2504,24 +2504,25 @@ void pray()
you.duration[DUR_PRAYER] *= 2;
}
- if (you.religion == GOD_FEAWN)
- {
- if (you.duration[DUR_SLOW] < you.duration[DUR_PRAYER])
- slow_player(you.duration[DUR_PRAYER]);
- mprf(MSGCH_GOD, "You feel in touch with plants.");
- }
-
if (you.religion == GOD_ZIN || you.religion == GOD_BEOGH
|| you.religion == GOD_NEMELEX_XOBEH || you.religion == GOD_JIYVA)
{
you.duration[DUR_PRAYER] = 1;
}
- else if (you.religion == GOD_YREDELEMNUL || you.religion == GOD_ELYVILON)
+ else if (you.religion == GOD_ELYVILON || you.religion == GOD_YREDELEMNUL)
you.duration[DUR_PRAYER] = 20;
+ else if (you.religion == GOD_FEAWN)
+ {
+ if (you.duration[DUR_SLOW] < you.duration[DUR_PRAYER])
+ slow_player(you.duration[DUR_PRAYER]);
+ mprf(MSGCH_GOD, "You feel in touch with plants.");
+ }
- // Beoghites and Nemelexites offer the items they're standing on.
+ // Gods who like fresh corpses, Beoghites and Nemelexites offer the
+ // items they're standing on.
if (altar_god == GOD_NO_GOD
- && (you.religion == GOD_BEOGH || you.religion == GOD_NEMELEX_XOBEH))
+ && (god_likes_fresh_corpses(you.religion)
+ || you.religion == GOD_BEOGH || you.religion == GOD_NEMELEX_XOBEH))
{
offer_items();
}
@@ -2938,25 +2939,15 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known,
}
break;
- case DID_DEDICATED_BUTCHERY: // a.k.a. field sacrifice
+ case DID_DEDICATED_BUTCHERY:
switch (you.religion)
{
case GOD_ELYVILON:
simple_god_message(" does not appreciate your butchering the "
"dead during prayer!");
retval = true;
- piety_change = -10;
- penance = 10;
- break;
-
- case GOD_OKAWARU:
- case GOD_MAKHLEB:
- case GOD_TROG:
- case GOD_LUGONU:
- simple_god_message(" accepts your offering.");
- retval = true;
- if (random2(level + 10) > 5)
- piety_change = 1;
+ piety_change = -level;
+ penance = level;
break;
default:
@@ -2968,7 +2959,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known,
switch (you.religion)
{
case GOD_ELYVILON:
- // killing only disapproved during prayer
+ // Killing is only disapproved of during prayer.
if (you.duration[DUR_PRAYER])
{
simple_god_message(" does not appreciate your shedding "
@@ -3015,7 +3006,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known,
simple_god_message(" accepts your kill.");
retval = true;
- // Holy gods are easier to please this way
+ // Holy gods are easier to please this way.
if (random2(level + 18 - (is_good_god(you.religion) ? 0 :
you.experience_level / 2)) > 4)
piety_change = 1;
@@ -3039,7 +3030,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known,
simple_god_message(" accepts your kill.");
retval = true;
- // Holy gods are easier to please this way
+ // Holy gods are easier to please this way.
if (random2(level + 18 - (is_good_god(you.religion) ? 0 :
you.experience_level / 2)) > 3)
{
@@ -6951,7 +6942,7 @@ static bool _bless_weapon(god_type god, brand_type brand, int colour)
if (god == GOD_KIKUBAAQUDGHA)
{
- torment(TORMENT_GENERIC, you.pos());
+ torment(TORMENT_KIKUBAAQUDGHA, you.pos());
// Bloodify surrounding squares (75% chance).
for (radius_iterator ri(you.pos(), 2, true, true); ri; ++ri)
@@ -7160,6 +7151,9 @@ bool god_hates_attacking_friend(god_type god, int species)
bool god_likes_items(god_type god)
{
+ if (god_likes_fresh_corpses(god))
+ return (true);
+
switch (god)
{
case GOD_ZIN: case GOD_SHINING_ONE: case GOD_BEOGH: case GOD_NEMELEX_XOBEH:
@@ -7167,6 +7161,7 @@ bool god_likes_items(god_type god)
case GOD_NO_GOD: case NUM_GODS: case GOD_RANDOM: case GOD_NAMELESS:
mprf(MSGCH_ERROR, "Bad god, no biscuit! %d", static_cast<int>(god) );
+
default:
return (false);
}
@@ -7177,6 +7172,13 @@ static bool _god_likes_item(god_type god, const item_def& item)
if (!god_likes_items(god))
return (false);
+ if (god_likes_fresh_corpses(god))
+ {
+ return (item.base_type == OBJ_CORPSES
+ && item.sub_type == CORPSE_BODY
+ && !food_is_rotten(item));
+ }
+
switch (god)
{
case GOD_ZIN:
@@ -7224,93 +7226,107 @@ static void _give_sac_group_feedback(int which)
}
// God effects of sacrificing one item from a stack (e.g., a weapon, one
-// out of 20 arrows, etc.) Does not modify the actual item in any way.
+// out of 20 arrows, etc.). Does not modify the actual item in any way.
static piety_gain_t _sacrifice_one_item_noncount(const item_def& item)
{
piety_gain_t relative_piety_gain = PIETY_NONE;
- // item_value() multiplies by quantity.
- const int value = item_value(item) / item.quantity;
-
- switch (you.religion)
- {
- case GOD_SHINING_ONE:
- gain_piety(1);
- relative_piety_gain = PIETY_SOME;
- break;
-
- case GOD_BEOGH:
+ if (god_likes_fresh_corpses(you.religion))
{
- const int item_orig = item.orig_monnum - 1;
-
- int chance = 4;
-
- if (item_orig == MONS_SAINT_ROKA)
- chance += 12;
- else if (item_orig == MONS_ORC_HIGH_PRIEST)
- chance += 8;
- else if (item_orig == MONS_ORC_PRIEST)
- chance += 4;
-
- if (food_is_rotten(item))
- chance--;
- else if (item.sub_type == CORPSE_SKELETON)
- chance -= 2;
-
- if (x_chance_in_y(chance, 20))
+ if (x_chance_in_y(13, 19))
{
gain_piety(1);
relative_piety_gain = PIETY_SOME;
}
- break;
}
-
- case GOD_NEMELEX_XOBEH:
- if (you.attribute[ATTR_CARD_COUNTDOWN] && x_chance_in_y(value, 800))
+ else
+ {
+ switch (you.religion)
{
- you.attribute[ATTR_CARD_COUNTDOWN]--;
-#if DEBUG_DIAGNOSTICS || DEBUG_CARDS || DEBUG_SACRIFICE
- mprf(MSGCH_DIAGNOSTICS, "Countdown down to %d",
- you.attribute[ATTR_CARD_COUNTDOWN]);
-#endif
- }
- // Nemelex piety gain is fairly fast... at least
- // when you have low piety.
- if (item.base_type == OBJ_CORPSES && one_chance_in(2 + you.piety/50)
- || x_chance_in_y(value/2 + 1, 30 + you.piety/2))
+ case GOD_SHINING_ONE:
+ gain_piety(1);
+ relative_piety_gain = PIETY_SOME;
+ break;
+
+ case GOD_BEOGH:
{
- if (is_artefact(item))
- {
- gain_piety(2);
- relative_piety_gain = PIETY_LOTS;
- }
- else
+ const int item_orig = item.orig_monnum - 1;
+
+ int chance = 4;
+
+ if (item_orig == MONS_SAINT_ROKA)
+ chance += 12;
+ else if (item_orig == MONS_ORC_HIGH_PRIEST)
+ chance += 8;
+ else if (item_orig == MONS_ORC_PRIEST)
+ chance += 4;
+
+ if (food_is_rotten(item))
+ chance--;
+ else if (item.sub_type == CORPSE_SKELETON)
+ chance -= 2;
+
+ if (x_chance_in_y(chance, 20))
{
gain_piety(1);
relative_piety_gain = PIETY_SOME;
}
+ break;
}
- if (item.base_type == OBJ_FOOD && item.sub_type == FOOD_CHUNK
- || is_blood_potion(item))
- {
- // Count chunks and blood potions towards decks of Summoning.
- you.sacrifice_value[OBJ_CORPSES] += value;
- }
- else if (item.base_type == OBJ_CORPSES)
+ case GOD_NEMELEX_XOBEH:
{
+ // item_value() multiplies by quantity.
+ const int value = item_value(item) / item.quantity;
+
+ if (you.attribute[ATTR_CARD_COUNTDOWN] && x_chance_in_y(value, 800))
+ {
+ you.attribute[ATTR_CARD_COUNTDOWN]--;
+#if DEBUG_DIAGNOSTICS || DEBUG_CARDS || DEBUG_SACRIFICE
+ mprf(MSGCH_DIAGNOSTICS, "Countdown down to %d",
+ you.attribute[ATTR_CARD_COUNTDOWN]);
+#endif
+ }
+ // Nemelex piety gain is fairly fast... at least when you
+ // have low piety.
+ if (item.base_type == OBJ_CORPSES && one_chance_in(2 + you.piety/50)
+ || x_chance_in_y(value/2 + 1, 30 + you.piety/2))
+ {
+ if (is_artefact(item))
+ {
+ gain_piety(2);
+ relative_piety_gain = PIETY_LOTS;
+ }
+ else
+ {
+ gain_piety(1);
+ relative_piety_gain = PIETY_SOME;
+ }
+ }
+
+ if (item.base_type == OBJ_FOOD && item.sub_type == FOOD_CHUNK
+ || is_blood_potion(item))
+ {
+ // Count chunks and blood potions towards decks of
+ // Summoning.
+ you.sacrifice_value[OBJ_CORPSES] += value;
+ }
+ else if (item.base_type == OBJ_CORPSES)
+ {
#if DEBUG_GIFTS || DEBUG_CARDS || DEBUG_SACRIFICE
- mprf(MSGCH_DIAGNOSTICS, "Corpse mass is %d",
- item_mass(item));
+ mprf(MSGCH_DIAGNOSTICS, "Corpse mass is %d",
+ item_mass(item));
#endif
- you.sacrifice_value[item.base_type] += item_mass(item);
+ you.sacrifice_value[item.base_type] += item_mass(item);
+ }
+ else
+ you.sacrifice_value[item.base_type] += value;
+ break;
}
- else
- you.sacrifice_value[item.base_type] += value;
- break;
- default:
- break;
+ default:
+ break;
+ }
}
return (relative_piety_gain);
@@ -7490,7 +7506,9 @@ void offer_items()
{
// Zin was handled above, and the other gods don't care about
// sacrifices.
- if (you.religion == GOD_SHINING_ONE)
+ if (god_likes_fresh_corpses(you.religion))
+ simple_god_message(" only cares about fresh corpses!");
+ else if (you.religion == GOD_SHINING_ONE)
simple_god_message(" only cares about evil items!");
else if (you.religion == GOD_BEOGH)
simple_god_message(" only cares about orcish remains!");
@@ -7746,13 +7764,17 @@ bool god_hates_killing(god_type god, const monsters* mon)
return (retval);
}
-bool god_likes_butchery(god_type god)
+bool god_likes_fresh_corpses(god_type god)
{
return (god == GOD_OKAWARU
|| god == GOD_MAKHLEB
|| god == GOD_TROG
- || god == GOD_LUGONU
- || (god == GOD_KIKUBAAQUDGHA && you.piety >= piety_breakpoint(4)));
+ || god == GOD_LUGONU);
+}
+
+bool god_likes_butchery(god_type god)
+{
+ return (god == GOD_KIKUBAAQUDGHA && you.piety >= piety_breakpoint(4));
}
bool god_hates_butchery(god_type god)
@@ -7850,10 +7872,10 @@ static void _god_smites_you(god_type god, const char *message,
}
}
-void offer_corpse(int corpse)
+void offer_and_butcher_corpse(int corpse)
{
// We always give the "good" (piety-gain) message when doing
- // dedicated butchery. Uh, call it a feature.
+ // dedicated butchery. Uh, call it a feature.
_print_sacrifice_message(you.religion, mitm[corpse], PIETY_SOME);
did_god_conduct(DID_DEDICATED_BUTCHERY, 10);
diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h
index 9aabab95a1..4583ac2095 100644
--- a/crawl-ref/source/religion.h
+++ b/crawl-ref/source/religion.h
@@ -77,7 +77,7 @@ void excommunication(god_type new_god = GOD_NO_GOD);
void gain_piety(int pgn);
void god_speaks(god_type god, const char *mesg);
void lose_piety(int pgn);
-void offer_corpse(int corpse);
+void offer_and_butcher_corpse(int corpse);
std::string god_prayer_reaction();
void pray();
void end_prayer();
@@ -93,6 +93,7 @@ std::string god_hates_your_god_reaction(god_type god,
god_type your_god = you.religion);
bool god_hates_cannibalism(god_type god);
bool god_hates_killing(god_type god, const monsters* mon);
+bool god_likes_fresh_corpses(god_type god);
bool god_likes_butchery(god_type god);
bool god_hates_butchery(god_type god);
harm_protection_type god_protects_from_harm(god_type god, bool actual = true);
diff --git a/crawl-ref/source/rltiles/dc-item.txt b/crawl-ref/source/rltiles/dc-item.txt
index 66815bc865..6a188bb941 100644
--- a/crawl-ref/source/rltiles/dc-item.txt
+++ b/crawl-ref/source/rltiles/dc-item.txt
@@ -553,6 +553,7 @@ i-conservation AMU_CONSERVATION
i-c-flight AMU_CONTROLLED_FLIGHT
i-inaccuracy AMU_INACCURACY
i-r-mutation AMU_RESIST_MUTATION
+i-spirit AMU_SPIRIT_SHIELD
%rim 1
%shrink 1
diff --git a/crawl-ref/source/rltiles/item/amulet/i-spirit.png b/crawl-ref/source/rltiles/item/amulet/i-spirit.png
new file mode 100644
index 0000000000..02f96048b5
--- /dev/null
+++ b/crawl-ref/source/rltiles/item/amulet/i-spirit.png
Binary files differ
diff --git a/crawl-ref/source/rltiles/makefile.unix b/crawl-ref/source/rltiles/makefile.unix
index 721c467410..0d35c801ff 100644
--- a/crawl-ref/source/rltiles/makefile.unix
+++ b/crawl-ref/source/rltiles/makefile.unix
@@ -1,19 +1,32 @@
+ifeq ($(shell uname -s),Darwin)
+SDL_CFLAGS := -I/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL_image.framework/Headers
+SDL_LDFLAGS := -framework SDL -framework SDL_image
+
+PNG_CFLAGS := -I/Library/Frameworks/libpng.framework/Headers
+PNG_LDFLAGS := -framework libpng
+
+CFLAGS := -F/Library/Frameworks $(SDL_CFLAGS) $(PNG_CFLAGS)
+LDFLAGS := -F/Library/Frameworks $(SDL_LDFLAGS) $(PNG_LDFLAGS)
+
+# FIXME: We need 32-bit until SDL 1.2.14 comes out
+CXX ?= g++ -m32
+
+else
+
SDL_CFLAGS := $(shell sdl-config --cflags)
SDL_LDFLAGS := $(shell sdl-config --libs)
-ifeq ($(strip $(OSX)),y)
-PNG_INCLUDE := -I/sw/include
-PNG_LIB := -L/sw/lib
-else
-PNG_INCLUDE :=
-PNG_LIB :=
-endif
+PNG_INCLUDE := $(shell pkg-config libpng --cflags)
+PNG_LIB := $(shell pkg-config libpng --libs)
CFLAGS := $(SDL_CFLAGS) $(PNG_INCLUDE)
LDFLAGS := $(SDL_LDFLAGS) $(PNGLIB) -lSDL_image -lpng
-CXX = g++
+CXX ?= g++
+
+endif
+
DELETE = rm -f
TOOLDIR := tool
@@ -25,21 +38,30 @@ HEADERS := $(INPUTS:%=tiledef-%.h)
SOURCE := $(INPUTS:%=tiledef-%.cc)
IMAGES := $(INPUTS:%=%.png)
+ifneq ($(findstring $(MAKEFLAGS),s),s)
+ifndef V
+ QUIET_CXX = @echo ' ' CXX $@;
+ QUIET_GEN = @echo ' ' GEN $*;
+ QUIET_LINK = @echo ' ' LINK $@;
+ export V
+endif
+endif
+
BASE_OBJECTS := tile_colour.o tile.o tile_page.o tile_list_processor.o main.o
OBJECTS := $(BASE_OBJECTS:%=$(TOOLDIR)/%)
all: $(TILEGEN) $(HEADERS) $(SOURCE) $(IMAGES)
tiledef-%.h tiledef-%.cc %.png: dc-%.txt $(TILEGEN)
- $(TILEGEN) $<
+ $(QUIET_GEN)$(TILEGEN) $<
clean:
$(DELETE) $(HEADERS) $(OBJECTS) $(TILEGEN) $(SOURCE) $(IMAGES)
distclean: clean
-.cc.o:
- ${CXX} ${CFLAGS} -c $< -o $@
+%.o: %.cc
+ $(QUIET_CXX)$(CXX) $(CFLAGS) -c $< -o $@
$(TILEGEN): $(OBJECTS)
- ${CXX} ${LDFLAGS} $(OBJECTS) -o $@
+ $(QUIET_LINK)$(CXX) $(LDFLAGS) $(OBJECTS) -o $@
diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc
index 6c97957cdd..c4959d66fd 100644
--- a/crawl-ref/source/shopping.cc
+++ b/crawl-ref/source/shopping.cc
@@ -7,7 +7,6 @@
#include "AppHdr.h"
REVISION("$Rev$");
-#include "chardump.h"
#include "shopping.h"
#include "message.h"
@@ -15,7 +14,7 @@ REVISION("$Rev$");
#include <stdlib.h>
#include <string.h>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
@@ -25,7 +24,6 @@ REVISION("$Rev$");
#include "describe.h"
#include "food.h"
#include "invent.h"
-#include "it_use2.h"
#include "items.h"
#include "itemname.h"
#include "itemprop.h"
@@ -37,7 +35,6 @@ REVISION("$Rev$");
#include "spl-book.h"
#include "stash.h"
#include "stuff.h"
-#include "view.h"
static bool _purchase( int shop, int item_got, int cost, bool id);
diff --git a/crawl-ref/source/skills.cc b/crawl-ref/source/skills.cc
index 815440616f..f353e0dff4 100644
--- a/crawl-ref/source/skills.cc
+++ b/crawl-ref/source/skills.cc
@@ -16,7 +16,6 @@ REVISION("$Rev$");
#include "externs.h"
#include "itemprop.h"
-#include "macro.h"
#include "notes.h"
#include "output.h"
#include "player.h"
diff --git a/crawl-ref/source/skills2.cc b/crawl-ref/source/skills2.cc
index f50ff8d5b1..b3465e58be 100644
--- a/crawl-ref/source/skills2.cc
+++ b/crawl-ref/source/skills2.cc
@@ -17,7 +17,7 @@ REVISION("$Rev$");
#include <stdlib.h>
#include <ctype.h>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
@@ -30,9 +30,7 @@ REVISION("$Rev$");
#include "menu.h"
#include "player.h"
#include "stuff.h"
-#include "transfor.h"
#include "tutorial.h"
-#include "view.h"
typedef std::string (*string_fn)();
typedef std::map<std::string, string_fn> skill_op_map;
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index ba43290b3e..8d503e2ca9 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -31,7 +31,6 @@ REVISION("$Rev$");
#include "los.h"
#include "message.h"
#include "misc.h"
-#include "monplace.h"
#include "monstuff.h"
#include "mon-util.h"
#include "player.h"
@@ -332,7 +331,7 @@ void cast_chain_lightning(int pow)
if (invalid_monster(monster))
continue;
- dist = grid_distance( source, monster->pos() );
+ dist = grid_distance(source, monster->pos());
// check for the source of this arc
if (!dist)
@@ -345,7 +344,7 @@ void cast_chain_lightning(int pow)
if (dist > min_dist)
continue;
- if (!check_line_of_sight( source, monster->pos() ))
+ if (!check_line_of_sight(source, monster->pos()))
continue;
count++;
@@ -1464,6 +1463,12 @@ void cast_teleport_control(int power)
void cast_ring_of_flames(int power)
{
+ // You shouldn't be able to cast this in the rain. {due}
+ if (in_what_cloud(CLOUD_RAIN))
+ {
+ mpr("Your spell sizzles in the rain.");
+ return;
+ }
_increase_duration(DUR_FIRE_SHIELD,
5 + (power / 10) + (random2(power) / 5), 50,
"The air around you leaps into flame!");
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index ce26de1e21..364aa2484c 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -46,7 +46,6 @@ REVISION("$Rev$");
#include "terrain.h"
#include "traps.h"
#include "view.h"
-#include "xom.h"
int detect_traps(int pow)
{
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index 23b49dd8f5..0e552a2355 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -30,15 +30,12 @@ REVISION("$Rev$");
#include "itemname.h"
#include "itemprop.h"
#include "items.h"
-#include "item_use.h"
#include "los.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 "quiver.h"
#include "religion.h"
@@ -731,7 +728,8 @@ bool receive_corpses(int pow, coord_def where)
if (corpses_generated)
{
- simple_god_message(" delivers you corpses!");
+ simple_god_message(corpses_generated > 1 ? " delivers you corpses!"
+ : " delivers you a corpse!");
maybe_update_stashes();
return (true);
}
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index 406047cff1..b3180963a7 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -21,14 +21,12 @@ REVISION("$Rev$");
#include "cloud.h"
#include "debug.h"
#include "delay.h"
-#include "describe.h"
#include "directn.h"
#include "dungeon.h"
#include "effects.h"
#include "invent.h"
#include "it_use2.h"
#include "item_use.h"
-#include "itemname.h"
#include "itemprop.h"
#include "items.h"
#include "los.h"
diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc
index 9d545e6a19..33087ddb77 100644
--- a/crawl-ref/source/spl-book.cc
+++ b/crawl-ref/source/spl-book.cc
@@ -15,7 +15,7 @@ REVISION("$Rev$");
#include <algorithm>
#include <iomanip>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
@@ -31,13 +31,11 @@ REVISION("$Rev$");
#include "itemname.h"
#include "itemprop.h"
#include "items.h"
-#include "it_use3.h"
#include "kills.h"
#include "macro.h"
#include "message.h"
#include "player.h"
#include "religion.h"
-#include "skills2.h"
#include "spl-cast.h"
#include "spl-mis.h"
#include "spl-util.h"
@@ -2256,16 +2254,13 @@ bool make_book_level_randart(item_def &book, int level, int num_spells,
// Being called from make_item_randart()
ASSERT(book.sub_type == BOOK_RANDART_LEVEL);
- ASSERT(level == -1 && num_spells == -1);
// Re-read owner, if applicable.
if (owner.empty() && book.props.exists("owner"))
owner = book.props["owner"].get_string();
- level = book.plus;
ASSERT(level > 0 && level <= 9);
- num_spells = book.plus2;
ASSERT(num_spells > 0 && num_spells <= SPELLBOOK_SIZE);
int god_discard = 0;
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 56ea04f0d0..b4edf1fb05 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -17,10 +17,8 @@ REVISION("$Rev$");
#include "beam.h"
#include "describe.h"
#include "effects.h"
-#include "fight.h"
#include "food.h"
#include "format.h"
-#include "initfile.h"
#include "invent.h"
#include "it_use2.h"
#include "item_use.h"
@@ -36,7 +34,6 @@ REVISION("$Rev$");
#include "mutation.h"
#include "ouch.h"
#include "player.h"
-#include "quiver.h"
#include "religion.h"
#include "skills.h"
#include "skills2.h"
@@ -53,7 +50,7 @@ REVISION("$Rev$");
#include "tutorial.h"
#include "view.h"
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc
index 716dce7479..b727117eb8 100644
--- a/crawl-ref/source/spl-util.cc
+++ b/crawl-ref/source/spl-util.cc
@@ -23,23 +23,19 @@ REVISION("$Rev$");
#include "directn.h"
#include "debug.h"
#include "stuff.h"
-#include "itemname.h"
#include "los.h"
#include "macro.h"
-#include "misc.h"
#include "monstuff.h"
#include "notes.h"
#include "player.h"
#include "religion.h"
#include "spells4.h"
-#include "spl-book.h"
#include "spl-cast.h"
#include "spl-util.h"
#include "terrain.h"
-#include "view.h"
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc
index ead169d16f..d35a5a9751 100644
--- a/crawl-ref/source/stash.cc
+++ b/crawl-ref/source/stash.cc
@@ -8,7 +8,6 @@
REVISION("$Rev$");
#include "artefact.h"
-#include "branch.h"
#include "chardump.h"
#include "cio.h"
#include "clua.h"
@@ -30,7 +29,6 @@ REVISION("$Rev$");
#include "mon-util.h"
#include "monstuff.h"
#include "notes.h"
-#include "overmap.h"
#include "place.h"
#include "shopping.h"
#include "spl-book.h"
@@ -41,7 +39,6 @@ REVISION("$Rev$");
#include "traps.h"
#include "travel.h"
#include "tutorial.h"
-#include "view.h"
#include <cctype>
#include <cstdio>
diff --git a/crawl-ref/source/stash.h b/crawl-ref/source/stash.h
index 1232e1a46b..8a50b0d77f 100644
--- a/crawl-ref/source/stash.h
+++ b/crawl-ref/source/stash.h
@@ -7,7 +7,6 @@
#ifndef STASH_H
#define STASH_H
-#include "AppHdr.h"
#include "shopping.h"
#include <string>
diff --git a/crawl-ref/source/state.cc b/crawl-ref/source/state.cc
index e5fb1362d5..21b500954c 100644
--- a/crawl-ref/source/state.cc
+++ b/crawl-ref/source/state.cc
@@ -17,7 +17,6 @@ REVISION("$Rev$");
#include "menu.h" // For print_formatted_paragraph()
#include "message.h"
#include "mon-util.h"
-#include "output.h"
#include "player.h"
#include "religion.h"
#include "state.h"
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc
index fecb00a578..0571f3f253 100644
--- a/crawl-ref/source/stuff.cc
+++ b/crawl-ref/source/stuff.cc
@@ -48,7 +48,7 @@ REVISION("$Rev$");
#include "sha256.h"
#endif
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
@@ -72,7 +72,6 @@ REVISION("$Rev$");
#include "output.h"
#include "player.h"
#include "religion.h"
-#include "skills2.h"
#include "tutorial.h"
#include "view.h"
@@ -755,7 +754,7 @@ void cio_init()
init_libw32c();
#endif
-#ifdef DOS
+#ifdef TARGET_OS_DOS
init_libdos();
#endif
@@ -828,7 +827,7 @@ void end(int exit_code, bool print_error, const char *format, ...)
error.clear();
}
-#if defined(WIN32CONSOLE) || defined(DOS) || defined(DGL_PAUSE_AFTER_ERROR)
+#if defined(WIN32CONSOLE) || defined(TARGET_OS_DOS) || defined(DGL_PAUSE_AFTER_ERROR)
if (exit_code && !crawl_state.arena
&& !crawl_state.seen_hups && !crawl_state.test)
{
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index db02547cc9..4729730a1f 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -60,7 +60,6 @@
#include "AppHdr.h"
REVISION("$Rev$");
-#include "abl-show.h"
#include "artefact.h"
#include "branch.h"
#include "describe.h"
@@ -72,7 +71,6 @@ REVISION("$Rev$");
#include "itemname.h"
#include "itemprop.h"
#include "mapmark.h"
-#include "monstuff.h"
#include "mon-util.h"
#include "mtransit.h"
#include "quiver.h"
diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc
index 527ee90e14..69f9ec4240 100644
--- a/crawl-ref/source/terrain.cc
+++ b/crawl-ref/source/terrain.cc
@@ -22,7 +22,7 @@ REVISION("$Rev$");
#include "message.h"
#include "misc.h"
#include "monplace.h"
-#include "monstuff.h"
+#include "mon-util.h"
#include "mstuff2.h"
#include "ouch.h"
#include "overmap.h"
diff --git a/crawl-ref/source/tile2.cc b/crawl-ref/source/tile2.cc
index e1ac72c874..2b76eb6500 100644
--- a/crawl-ref/source/tile2.cc
+++ b/crawl-ref/source/tile2.cc
@@ -12,20 +12,10 @@ REVISION("$Rev$");
#include <string.h>
#include "branch.h"
-#include "describe.h"
-#include "directn.h"
-#include "dungeon.h"
-#include "files.h"
-#include "ghost.h"
-#include "tilereg.h"
#include "itemprop.h"
-#include "it_use2.h"
-#include "place.h"
#include "player.h"
-#include "spells3.h"
#include "stuff.h"
#include "tiles.h"
-#include "transfor.h"
void tile_default_flv(level_area_type lev, branch_type br, tile_flavour &flv)
{
diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc
index 67fae5303a..5373fd9284 100644
--- a/crawl-ref/source/tilepick.cc
+++ b/crawl-ref/source/tilepick.cc
@@ -17,6 +17,7 @@ REVISION("$Rev$");
#include "items.h"
#include "itemprop.h"
#include "kills.h"
+#include "los.h"
#include "macro.h"
#include "monstuff.h"
#include "mon-util.h"
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index 17b6a75002..3a7650eac5 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -14,9 +14,9 @@ REVISION("$Rev$");
#include "files.h"
#include "food.h"
#include "itemname.h"
-#include "it_use2.h"
#include "item_use.h"
#include "items.h"
+#include "los.h"
#include "macro.h"
#include "message.h"
#include "misc.h"
diff --git a/crawl-ref/source/tilesdl.h b/crawl-ref/source/tilesdl.h
index 867c1cf0df..e7cede1863 100644
--- a/crawl-ref/source/tilesdl.h
+++ b/crawl-ref/source/tilesdl.h
@@ -205,7 +205,7 @@ protected:
// Main interface for tiles functions
extern TilesFramework tiles;
-#ifdef __MINGW32__
+#ifdef TARGET_COMPILER_MINGW
#ifndef alloca
// Srsly, MinGW, wtf?
void *alloca(size_t);
diff --git a/crawl-ref/source/tiletex.cc b/crawl-ref/source/tiletex.cc
index c42d3a168d..39993ca9e0 100644
--- a/crawl-ref/source/tiletex.cc
+++ b/crawl-ref/source/tiletex.cc
@@ -2,7 +2,6 @@
REVISION("$Rev$");
#include "files.h"
-#include "tiles.h"
#include "tiletex.h"
#include <SDL.h>
diff --git a/crawl-ref/source/transfor.cc b/crawl-ref/source/transfor.cc
index 11b15bd239..fcadaef4dd 100644
--- a/crawl-ref/source/transfor.cc
+++ b/crawl-ref/source/transfor.cc
@@ -21,7 +21,6 @@ REVISION("$Rev$");
#include "item_use.h"
#include "itemprop.h"
#include "items.h"
-#include "misc.h"
#include "output.h"
#include "player.h"
#include "skills2.h"
diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc
index 398c2c0625..d1dc8fb92a 100644
--- a/crawl-ref/source/traps.cc
+++ b/crawl-ref/source/traps.cc
@@ -18,7 +18,6 @@ REVISION("$Rev$");
#include "delay.h"
#include "describe.h"
#include "directn.h"
-#include "it_use2.h"
#include "itemname.h"
#include "itemprop.h"
#include "items.h"
@@ -30,10 +29,8 @@ REVISION("$Rev$");
#include "monstuff.h"
#include "mtransit.h"
#include "ouch.h"
-#include "place.h"
#include "player.h"
#include "skills.h"
-#include "spells3.h"
#include "spl-mis.h"
#include "spl-util.h"
#include "state.h"
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index bdecfa1fae..4eed07c72f 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -55,7 +55,7 @@ REVISION("$Rev$");
#include <memory>
#include <sstream>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <dos.h>
#endif
diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc
index 7844de77c7..14fc9ca3d4 100644
--- a/crawl-ref/source/tutorial.cc
+++ b/crawl-ref/source/tutorial.cc
@@ -39,13 +39,11 @@ REVISION("$Rev$");
#include "monstuff.h"
#include "mutation.h"
#include "newgame.h"
-#include "output.h"
#include "player.h"
#include "religion.h"
#include "shopping.h"
#include "skills2.h"
#include "spl-book.h"
-#include "spl-util.h"
#include "stuff.h"
#include "tags.h"
#include "terrain.h"
diff --git a/crawl-ref/source/tutorial.h b/crawl-ref/source/tutorial.h
index 9619dd26af..e1065f9ac9 100644
--- a/crawl-ref/source/tutorial.h
+++ b/crawl-ref/source/tutorial.h
@@ -14,7 +14,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include "AppHdr.h"
#include "externs.h"
class formatted_string;
diff --git a/crawl-ref/source/util/Makefile b/crawl-ref/source/util/Makefile
new file mode 100644
index 0000000000..2e61683b21
--- /dev/null
+++ b/crawl-ref/source/util/Makefile
@@ -0,0 +1,26 @@
+YACC := bison -y
+LEX := flex
+
+ifneq ($(findstring $(MAKEFLAGS),s),s)
+ifndef V
+ QUIET_YACC = @echo ' ' YACC $@;
+ QUIET_LEX = @echo ' ' LEX $@;
+ export V
+endif
+endif
+
+all: levcomp.tab.cc levcomp.lex.cc
+
+clean:
+ rm -f levcomp.tab.cc levcomp.tab.h
+ rm -f levcomp.lex.cc
+ rm -f *.o
+
+%.tab.cc: %.tab.c
+ @mv $< $@
+
+%.lex.cc: %.lpp
+ $(QUIET_LEX)$(LEX) -o$@ $<
+
+%.tab.c: %.ypp
+ $(QUIET_YACC)$(YACC) -d -b $* $<
diff --git a/crawl-ref/source/util/includes.sh b/crawl-ref/source/util/includes.sh
new file mode 100644
index 0000000000..69b40037f8
--- /dev/null
+++ b/crawl-ref/source/util/includes.sh
@@ -0,0 +1,114 @@
+# A bunch of shell functions that help finding unnecessary includes.
+# Relies on appropriate versions of etags, grep, tr, awk and maybe bash.
+#
+# To use:
+# $ . util/include.sh
+# $ checkall
+
+# Tries to list all names defined in the header file $1.
+# Indented names are assumed to be members that don't need to be checked,
+# which will fail for indented declarations with #ifdefs.
+_wrap_etags()
+{
+ tmp=$1.etags.h
+ # clean up const member functions since they confuse etags
+ sed -e 's/) const\;/)\;/' < $1 > $tmp
+ etags --declarations $tmp -o -
+ rm $tmp
+}
+
+names ()
+{
+ b=$(basename $1 .h);
+ {
+ _wrap_etags $1 \
+ | grep '\(^[#a-z]\|^ *[0-9A-Z_][0-9A-Z_][0-9A-Z_]\)' \
+ | grep -v '^'$b'\.h' \
+ | tr '\177' '\t' | awk '{ print $(NF-1) }' \
+ # etags misses namespace declarations
+ grep namespace $1 | awk '{ print $NF }'
+ # and some function definitions...
+ grep '^[a-z]' $1 | grep '(' | cut -d'(' -f 1 | awk '{ print $NF }'
+ } | sed -e 's/^\**//;s/[^a-zA-Z0-9]$//' | sort | uniq
+}
+
+# lists possible uses in $2 of names defined in $1
+mightuse ()
+{
+ for n in $(names $1);
+ do
+ if grep -F $n $2; then
+ return 0;
+ fi;
+ done;
+ return 1
+}
+
+# checks whether source file $2 #include's $1
+includes ()
+{
+ grep '#include "'$1'"' $2
+}
+
+# echo arguments if $2 includes $1 put shouldn't
+check ()
+{
+ if includes $1 $2 > /dev/null && ! mightuse $1 $2 > /dev/null; then
+ echo $1 $2;
+ fi
+}
+
+# run check on all source for a given header
+# should really cache the result of "names"
+checkhdr ()
+{
+ for src in *.cc; do
+ check $1 $src
+ done
+}
+
+# run check on all pairs
+checkall ()
+{
+ for hdr in *.h; do
+ if [ $hdr = AppHdr.h ]; then
+ continue;
+ fi
+ checkhdr $hdr
+ done
+}
+
+# remove #include of $1 from $2
+remove ()
+{
+ b=$(basename $1 .h)
+ re='^#include "'$b'\.h"$'
+ if grep "$re" $2 > /dev/null; then
+ sed -e '/^#include "'$b'\.h"$/d' < $2 > $2.rmincl
+ mv $2.rmincl $2
+ fi
+}
+
+# remove doubtful includes for a list as output by checkall.
+removelst ()
+{
+ while read hdr src; do
+ remove $hdr $src
+ done
+}
+
+# remove special includes
+cleanup ()
+{
+ sed -e '/^quiver.h debug.cc$/d;
+ /^quiver.h command.cc$/d;
+ /^quiver.h it_use2.cc$/d;
+ /^quiver.h output.cc$/d;
+ /^ghost.h kills.cc$/d;
+ /^cmd-name.h macro.cc$/d;
+ /^cmd-keys.h macro.cc$/d;
+ /^mon-spll.h mon-util.cc$/d;
+ /^AppHdr.h /d;
+ / artefact.cc/d'
+}
+
diff --git a/crawl-ref/source/util/lua/src/Makefile b/crawl-ref/source/util/lua/src/Makefile
index d5f5222207..8460bb7f67 100644
--- a/crawl-ref/source/util/lua/src/Makefile
+++ b/crawl-ref/source/util/lua/src/Makefile
@@ -9,12 +9,21 @@
# Your platform. See PLATS for possible values.
PLAT= none
-CC= gcc
-CFLAGS= -O2 -Wall $(MYCFLAGS)
-AR= ar rcu
-RANLIB= ranlib
-RM= rm -f
-LIBS= -lm $(MYLIBS)
+ifneq ($(findstring $(MAKEFLAGS),s),s)
+ifndef V
+ QUIET_CC = @echo ' ' CC $@;
+ QUIET_AR = @echo ' ' AR $@;
+ QUIET_LINK = @echo ' ' LINK $@;
+ export V
+endif
+endif
+
+CC ?= gcc
+CFLAGS = -O2 -Wall $(MYCFLAGS)
+AR = ar rcu
+RANLIB = ranlib
+RM = rm -f
+LIBS = -lm $(MYLIBS)
MYCFLAGS=
MYLDFLAGS=
@@ -46,19 +55,22 @@ default: $(PLAT)
all: $(ALL_T)
+%.o: %.c
+ $(QUIET_CC)$(CC) -c $(CFLAGS) -o $@ $<
+
o: $(ALL_O)
a: $(ALL_A)
$(LUA_A): $(CORE_O) $(LIB_O)
- $(AR) $@ $?
- $(RANLIB) $@
+ $(QUIET_AR)$(AR) $@ $?
+ @$(RANLIB) $@
$(LUA_T): $(LUA_O) $(LUA_A)
- $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
+ $(QUIET_LINK)$(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
$(LUAC_T): $(LUAC_O) $(LUA_A)
- $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
+ $(QUIET_LINK)$(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
clean:
$(RM) $(ALL_T) $(ALL_O)
@@ -116,7 +128,7 @@ mingw:
$(MAKE) "LUAC_T=luac.exe" luac.exe
crawl_unix:
- $(MAKE) "LUA_A=liblua.a" \
+ @$(MAKE) "LUA_A=liblua.a" \
"MYCFLAGS=" "MYLIBS=" "MYLDFLAGS=" liblua.a
crawl_mingw: crawl_unix
diff --git a/crawl-ref/source/util/sqlite/Makefile b/crawl-ref/source/util/sqlite/Makefile
index 01a73c4392..ab7b00d8e0 100644
--- a/crawl-ref/source/util/sqlite/Makefile
+++ b/crawl-ref/source/util/sqlite/Makefile
@@ -1,8 +1,16 @@
# -*- Makefile -*- for stripped down SQLite 3 static lib.
+ifneq ($(findstring $(MAKEFLAGS),s),s)
+ifndef V
+ QUIET_CC = @echo ' ' CC $@;
+ QUIET_AR = @echo ' ' AR $@;
+ export V
+endif
+endif
+
LIBSQL = libsqlite3.a
AR = ar rcu
-CC = gcc
+CC ?= gcc
RANLIB = ranlib
RM_F = rm -f
@@ -22,7 +30,8 @@ CFLAGS = -DSQLITE_OMIT_AUTHORIZATION \
-DSQLITE_OMIT_SCHEMA_VERSION_PRAGMAS \
-DSQLITE_OMIT_TCL_VARIABLE \
-DSQLITE_OMIT_LOAD_EXTENSION \
- -DTHREADSAFE=0
+ -DTHREADSAFE=0 \
+ -w
all: $(LIBSQL)
@@ -31,8 +40,8 @@ clean:
$(RM_F) *.a
$(LIBSQL): sqlite3.o
- $(AR) $@ $^
- $(RANLIB) $@
+ $(QUIET_AR)$(AR) $@ $^
+ @$(RANLIB) $@
%.o: %.c
- $(CC) $(CFLAGS) -o $@ -c $<
+ $(QUIET_CC)$(CC) $(CFLAGS) -o $@ -c $<
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 931324c5d1..e9499f2181 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -14,7 +14,7 @@ REVISION("$Rev$");
#include <sstream>
#include <algorithm>
-#ifdef DOS
+#ifdef TARGET_OS_DOS
#include <conio.h>
#endif
@@ -33,10 +33,8 @@ REVISION("$Rev$");
#include "dungeon.h"
#include "format.h"
#include "ghost.h"
-#include "initfile.h"
#include "itemprop.h"
#include "los.h"
-#include "luadgn.h"
#include "macro.h"
#include "message.h"
#include "misc.h"
@@ -51,10 +49,8 @@ REVISION("$Rev$");
#include "player.h"
#include "religion.h"
#include "skills.h"
-#include "skills2.h"
#include "stuff.h"
#include "spells3.h"
-#include "spells4.h"
#include "stash.h"
#include "tiles.h"
#include "state.h"
@@ -322,7 +318,7 @@ bool is_notable_terrain(dungeon_feature_type ftype)
return (Feature[ftype].is_notable());
}
-#if defined(WIN32CONSOLE) || defined(DOS) || defined(USE_TILE)
+#if defined(WIN32CONSOLE) || defined(TARGET_OS_DOS) || defined(USE_TILE)
static unsigned _colflag2brand(int colflag)
{
switch (colflag)
@@ -358,7 +354,7 @@ unsigned real_colour(unsigned raw_colour)
if (is_element_colour( raw_colour ))
raw_colour = colflags | element_colour( raw_colour );
-#if defined(WIN32CONSOLE) || defined(DOS) || defined(USE_TILE)
+#if defined(WIN32CONSOLE) || defined(TARGET_OS_DOS) || defined(USE_TILE)
if (colflags)
{
unsigned brand = _colflag2brand(colflags);
@@ -616,7 +612,7 @@ static char _get_travel_colour( const coord_def& p )
Options.tc_disconnected;
}
-#if defined(WIN32CONSOLE) || defined(DOS) || defined(USE_TILE)
+#if defined(WIN32CONSOLE) || defined(TARGET_OS_DOS) || defined(USE_TILE)
static unsigned short _dos_reverse_brand(unsigned short colour)
{
if (Options.dos_use_background_intensity)
@@ -1699,6 +1695,7 @@ inline static void _update_cloud_grid(int cloudno)
which_colour = DARKGREY;
break;
+ case CLOUD_RAIN:
case CLOUD_MIST:
which_colour = ETC_MIST;
break;
diff --git a/crawl-ref/source/view.h b/crawl-ref/source/view.h
index 6f4dac75ff..9c146226b6 100644
--- a/crawl-ref/source/view.h
+++ b/crawl-ref/source/view.h
@@ -197,7 +197,7 @@ dungeon_char_type dchar_by_name(const std::string &name);
void handle_terminal_resize(bool redraw = true);
-#if defined(WIN32CONSOLE) || defined(DOS) || defined(USE_TILE)
+#if defined(WIN32CONSOLE) || defined(TARGET_OS_DOS) || defined(USE_TILE)
unsigned short dos_brand( unsigned short colour,
unsigned brand = CHATTR_REVERSE);
#endif
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index a49571aae8..49c1e6c4ef 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -28,9 +28,11 @@ REVISION("$Rev$");
#include "mutation.h"
#include "notes.h"
#include "ouch.h"
+#include "item_use.h" // for safe_to_remove_or_wear()
+#include "output.h" // for the monster list
+#include "quiver.h" // to update the quiver if necessary
#include "player.h"
#include "religion.h"
-#include "spells1.h"
#include "spells2.h"
#include "spells3.h"
#include "spl-book.h"
@@ -112,6 +114,17 @@ static const char *_xom_message_arrays[NUM_XOM_MESSAGE_TYPES][6] =
}
};
+static const char *describe_xom_mood()
+{
+ return (you.piety > 180) ? "Xom's teddy bear." :
+ (you.piety > 150) ? "a beloved toy of Xom." :
+ (you.piety > 120) ? "a favourite toy of Xom." :
+ (you.piety > 80) ? "a toy of Xom." :
+ (you.piety > 50) ? "a plaything of Xom." :
+ (you.piety > 20) ? "a special plaything of Xom."
+ : "a very special plaything of Xom.";
+}
+
const char *describe_xom_favour(bool upper)
{
std::string favour;
@@ -120,15 +133,7 @@ const char *describe_xom_favour(bool upper)
else if (you.gift_timeout < 1)
favour = "a BORING thing.";
else
- {
- favour = (you.piety > 180) ? "Xom's teddy bear." :
- (you.piety > 150) ? "a beloved toy of Xom." :
- (you.piety > 120) ? "a favourite toy of Xom." :
- (you.piety > 80) ? "a toy of Xom." :
- (you.piety > 50) ? "a plaything of Xom." :
- (you.piety > 20) ? "a special plaything of Xom."
- : "a very special plaything of Xom.";
- }
+ favour = describe_xom_mood();
if (upper)
favour = uppercase_first(favour);
@@ -466,7 +471,8 @@ static bool _transformation_check(const spell_type spell)
return transform(0, tran, true, true);
}
-static bool _xom_makes_you_cast_random_spell(int sever, int tension)
+static int _xom_makes_you_cast_random_spell(int sever, int tension,
+ bool debug = false)
{
int spellenum = std::max(1, sever);
@@ -483,7 +489,7 @@ static bool _xom_makes_you_cast_random_spell(int sever, int tension)
// You may still get results such as "The spell fizzles" or
// "Nothing appears to happen", but those should be rarer now.
if (!_spell_weapon_check(spell))
- return (false);
+ return (XOM_DID_NOTHING);
}
else
{
@@ -499,7 +505,7 @@ static bool _xom_makes_you_cast_random_spell(int sever, int tension)
// a chance we might try something else.
const int explored = _exploration_estimate();
if (explored > 80 && x_chance_in_y(explored, 100))
- return (false);
+ return (XOM_DID_NOTHING);
}
}
@@ -507,7 +513,10 @@ static bool _xom_makes_you_cast_random_spell(int sever, int tension)
if (spell == FAKE_SPELL_MAGIC_MAPPING)
{
if (you.level_type == LEVEL_PANDEMONIUM)
- return (false);
+ return (XOM_DID_NOTHING);
+
+ if (debug)
+ return (XOM_GOOD_MAPPING);
god_speaks(GOD_XOM, _get_xom_speech("spell effect").c_str());
@@ -523,16 +532,22 @@ static bool _xom_makes_you_cast_random_spell(int sever, int tension)
const int power = stepdown_value( sever, 10, 10, 40, 45 );
magic_mapping( 5 + power, 50 + random2avg( power * 2, 2 ), false );
- return (true);
+ return (XOM_GOOD_MAPPING);
}
// Don't attempt to cast spells the undead cannot memorise.
if (you_cannot_memorise(spell))
- return (false);
+ return (XOM_DID_NOTHING);
// Don't attempt to transform the player if the transformation will fail.
if (!_transformation_check(spell))
- return (false);
+ return (XOM_DID_NOTHING);
+
+ const int result = (tension > 0 ? XOM_GOOD_SPELL_TENSION
+ : XOM_GOOD_SPELL_CALM);
+
+ if (debug)
+ return (result);
god_speaks(GOD_XOM, _get_xom_speech("spell effect").c_str());
@@ -548,7 +563,7 @@ static bool _xom_makes_you_cast_random_spell(int sever, int tension)
take_note(Note(NOTE_XOM_EFFECT, you.piety, tension, spell_buf), true);
your_spells(spell, sever, false);
- return (true);
+ return (result);
}
static void _try_brand_switch(const int item_index)
@@ -682,7 +697,9 @@ static object_class_type _get_unrelated_wield_class(object_class_type ref)
return (objtype);
}
-static bool _xom_annoyance_gift(int power)
+// Gift an item the player can't currently use. It can still be really
+// good or even acquirement level.
+static bool _xom_annoyance_gift(int power, bool debug = false)
{
god_acting gdact(GOD_XOM);
@@ -693,6 +710,9 @@ static bool _xom_annoyance_gift(int power)
// Xom has a sense of humour.
if (coinflip() && weapon && weapon->cursed())
{
+ if (debug)
+ return (true);
+
// If you are wielding a cursed item then Xom will give you
// an item of that same type. Ha ha!
god_speaks(GOD_XOM, _get_xom_speech("cursed gift").c_str());
@@ -707,6 +727,9 @@ static bool _xom_annoyance_gift(int power)
const item_def *gloves = you.slot_item(EQ_GLOVES);
if (coinflip() && gloves && gloves->cursed())
{
+ if (debug)
+ return (true);
+
// If you are wearing cursed gloves, then Xom will give you
// a ring. Ha ha!
god_speaks(GOD_XOM, _get_xom_speech("cursed gift").c_str());
@@ -717,6 +740,9 @@ static bool _xom_annoyance_gift(int power)
const item_def *amulet = you.slot_item(EQ_AMULET);
if (coinflip() && amulet && amulet->cursed())
{
+ if (debug)
+ return (true);
+
// If you are wearing a cursed amulet, then Xom will give
// you an amulet. Ha ha!
god_speaks(GOD_XOM, _get_xom_speech("cursed gift").c_str());
@@ -729,6 +755,9 @@ static bool _xom_annoyance_gift(int power)
if (coinflip() && ((left_ring && left_ring->cursed())
|| (right_ring && right_ring->cursed())))
{
+ if (debug)
+ return (true);
+
// If you are wearing a cursed ring, then Xom will give you
// a ring. Ha ha!
god_speaks(GOD_XOM, _get_xom_speech("ring gift").c_str());
@@ -738,6 +767,9 @@ static bool _xom_annoyance_gift(int power)
if (one_chance_in(5) && weapon)
{
+ if (debug)
+ return (true);
+
// Xom will give you a wielded item of a type different from
// what you are currently wielding.
god_speaks(GOD_XOM, _get_xom_speech("weapon gift").c_str());
@@ -753,14 +785,6 @@ static bool _xom_annoyance_gift(int power)
}
}
- return (false);
-}
-
-static bool _xom_give_item(int power)
-{
- if (_xom_annoyance_gift(power))
- return (true);
-
const item_def *cloak = you.slot_item(EQ_CLOAK);
if (coinflip() && cloak && cloak->cursed())
{
@@ -774,7 +798,16 @@ static bool _xom_give_item(int power)
return (true);
}
- god_speaks(GOD_XOM, _get_xom_speech("general gift").c_str());
+ return (false);
+}
+
+static int _xom_give_item(int power, bool debug = false)
+{
+ if (_xom_annoyance_gift(power, debug))
+ return (XOM_GOOD_ANNOYANCE_GIFT);
+
+ if (!debug)
+ god_speaks(GOD_XOM, _get_xom_speech("general gift").c_str());
// There are two kinds of Xom gifts: acquirement and random object.
// The result from acquirement is very good (usually as good or
@@ -783,6 +816,9 @@ static bool _xom_give_item(int power)
// and nature is not very Xomlike...
if (x_chance_in_y(power, 256))
{
+ if (debug)
+ return (XOM_GOOD_ACQUIREMENT);
+
const object_class_type types[] = {
OBJ_WEAPONS, OBJ_ARMOUR, OBJ_JEWELLERY, OBJ_BOOKS,
OBJ_STAVES, OBJ_WANDS, OBJ_MISCELLANY, OBJ_FOOD, OBJ_GOLD
@@ -792,12 +828,15 @@ static bool _xom_give_item(int power)
}
else
{
+ if (debug)
+ return (XOM_GOOD_RANDOM_ITEM);
+
// Random-type random object.
_xom_make_item(OBJ_RANDOM, OBJ_RANDOM, power * 3);
}
more();
- return (true);
+ return (XOM_GOOD_RANDOM_ITEM);
}
static bool _choose_mutatable_monster(const monsters* mon)
@@ -828,7 +867,7 @@ static bool _is_chaos_upgradeable(const item_def &item,
if (item.orig_monnum < 0)
{
god_type iorig = static_cast<god_type>(-item.orig_monnum);
- if ((iorig > GOD_NO_GOD && iorig < NUM_GODS)
+ if (iorig > GOD_NO_GOD && iorig < NUM_GODS
&& (is_good_god(iorig) || iorig == GOD_BEOGH))
{
return (false);
@@ -1044,8 +1083,11 @@ static bool _player_is_dead()
|| you.did_escape_death());
}
-static bool _xom_do_potion()
+static int _xom_do_potion(bool debug = false)
{
+ if (debug)
+ return (XOM_GOOD_POTION);
+
potion_type pot = POT_HEALING;
while (true)
{
@@ -1118,10 +1160,10 @@ static bool _xom_do_potion()
potion_effect(pot, 150);
- return (true);
+ return (XOM_GOOD_POTION);
}
-static bool _xom_confuse_monsters(int sever)
+static int _xom_confuse_monsters(int sever, bool debug = false)
{
bool rc = false;
monsters *monster;
@@ -1137,6 +1179,9 @@ static bool _xom_confuse_monsters(int sever)
continue;
}
+ if (debug)
+ return (XOM_GOOD_CONFUSION);
+
if (monster->add_ench(mon_enchant(ENCH_CONFUSION, 0,
KC_FRIENDLY, random2(sever))))
{
@@ -1149,17 +1194,20 @@ static bool _xom_confuse_monsters(int sever)
}
}
- if (rc == true)
+ if (rc)
{
take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, "confuse monster(s)"),
true);
+ return (XOM_GOOD_CONFUSION);
}
- return (rc);
+ return (XOM_DID_NOTHING);
}
-static bool _xom_send_allies(int sever)
+static int _xom_send_allies(int sever, bool debug = false)
{
- bool rc = false;
+ if (debug)
+ return (XOM_GOOD_ALLIES);
+
// The number of allies is dependent on severity, though heavily
// randomised.
int numdemons = sever;
@@ -1264,17 +1312,19 @@ static bool _xom_send_allies(int sever)
hostiletype == 3 ? "hostile " : "",
only_demonic ? "demon" : "monster",
num_actually_summoned > 1 ? "s" : "");
+
take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, summ_buf), true);
- rc = true;
+ return (XOM_GOOD_ALLIES);
}
- return (rc);
+ return (XOM_DID_NOTHING);
}
-static bool _xom_send_one_ally(int sever)
+static int _xom_send_one_ally(int sever, bool debug = false)
{
- bool rc = false;
+ if (debug)
+ return (XOM_GOOD_SINGLE_ALLY);
const monster_type mon = _xom_random_demon(sever);
const bool is_demonic = (mons_class_holiness(mon) == MH_DEMONIC);
@@ -1310,21 +1360,23 @@ static bool _xom_send_one_ally(int sever)
menv[summons].name(DESC_PLAIN).c_str());
take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, summ_buf), true);
- rc = true;
+ return (XOM_GOOD_SINGLE_ALLY);
}
- return (rc);
+ return (XOM_DID_NOTHING);
}
-static bool _xom_polymorph_nearby_monster(bool helpful)
+static int _xom_polymorph_nearby_monster(bool helpful, bool debug = false)
{
- bool rc = false;
if (there_are_monsters_nearby(false, false))
{
monsters *mon = choose_random_nearby_monster(0,
_choose_mutatable_monster);
if (mon)
{
+ if (debug)
+ return (helpful ? XOM_GOOD_POLYMORPH : XOM_BAD_POLYMORPH);
+
const char* lookup = (helpful ? "good monster polymorph"
: "bad monster polymorph");
god_speaks(GOD_XOM, _get_xom_speech(lookup).c_str());
@@ -1369,11 +1421,11 @@ static bool _xom_polymorph_nearby_monster(bool helpful)
take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, poly.c_str()),
true);
}
- rc = true;
+ return (helpful ? XOM_GOOD_POLYMORPH : XOM_BAD_POLYMORPH);
}
}
- return (rc);
+ return (XOM_DID_NOTHING);
}
static void _confuse_monster(monsters mons, int sever)
@@ -1430,13 +1482,168 @@ static bool _swap_monsters(monsters *m1, monsters *m2)
return (true);
}
+static bool _art_is_safe(item_def item)
+{
+ int prop_str = artefact_wpn_property(item, ARTP_STRENGTH);
+ int prop_int = artefact_wpn_property(item, ARTP_INTELLIGENCE);
+ int prop_dex = artefact_wpn_property(item, ARTP_DEXTERITY);
+
+ return (prop_str >= 0 && prop_int >= 0 && prop_dex >= 0);
+}
+
+static int _xom_swap_weapons(bool debug = false)
+{
+ if (player_stair_delay())
+ return (XOM_DID_NOTHING);
+
+ item_def *wpn = you.weapon();
+
+ if (!wpn)
+ return (XOM_DID_NOTHING);
+
+ if (you.duration[DUR_BERSERKER]
+ || wpn->base_type != OBJ_WEAPONS
+ || get_weapon_brand(*wpn) == SPWPN_DISTORTION
+ || !safe_to_remove_or_wear(*wpn, true, true))
+ {
+ return (XOM_DID_NOTHING);
+ }
+
+ std::vector<monsters *> mons_wpn;
+ for (unsigned i = 0; i < MAX_MONSTERS; ++i)
+ {
+ monsters* m = &menv[i];
+
+ if (!m->alive())
+ continue;
+
+ if (!see_grid(m->pos()))
+ continue;
+
+ if (!wpn || mons_wont_attack(m) || mons_is_summoned(m)
+ || mons_itemuse(m) < MONUSE_STARTING_EQUIPMENT
+ || (m->flags & MF_HARD_RESET))
+ {
+ continue;
+ }
+
+ const int mweap = m->inv[MSLOT_WEAPON];
+ if (mweap == NON_ITEM)
+ continue;
+
+ const item_def weapon = mitm[mweap];
+
+ // Let's be nice about this.
+ if (weapon.base_type == OBJ_WEAPONS
+ && !(weapon.flags & ISFLAG_SUMMONED)
+ && you.can_wield(weapon, true) && m->can_wield(*wpn, true)
+ && !get_weapon_brand(weapon) != SPWPN_DISTORTION
+ && (!is_artefact(weapon) || _art_is_safe(weapon)))
+ {
+ mons_wpn.push_back(m);
+ }
+ }
+ if (mons_wpn.empty())
+ return (XOM_DID_NOTHING);
+
+ if (debug)
+ return (XOM_BAD_SWAP_WEAPONS);
+
+ god_speaks(GOD_XOM, _get_xom_speech("swap weapons").c_str());
+
+ const int num_mons = mons_wpn.size();
+ // Pick a random monster...
+ monsters *mon = mons_wpn[random2(num_mons)];
+
+ // ...and get its weapon.
+ int monwpn = mon->inv[MSLOT_WEAPON];
+ int mywpn = you.equip[EQ_WEAPON];
+ ASSERT (monwpn != NON_ITEM);
+ ASSERT (mywpn != -1);
+
+ unwield_item();
+
+ item_def &myweapon = you.inv[mywpn];
+
+ int index = get_item_slot(10);
+ if (index == NON_ITEM)
+ return (XOM_DID_NOTHING);
+
+ // Move monster's old item to player's inventory as last step.
+ mon->unequip(*(mon->mslot_item(MSLOT_WEAPON)), MSLOT_WEAPON, 0, true);
+ mon->inv[MSLOT_WEAPON] = NON_ITEM;
+ mitm[index] = myweapon;
+
+ unwind_var<int> save_speedinc(mon->speed_increment);
+ if (!mon->pickup_item(mitm[index], false, true))
+ {
+ mpr("Monster wouldn't take item.", MSGCH_ERROR);
+ mon->inv[MSLOT_WEAPON] = monwpn;
+ mon->equip(mitm[monwpn], MSLOT_WEAPON, 0);
+ unlink_item(index);
+ destroy_item(myweapon);
+ return (XOM_DID_NOTHING);
+ }
+ // Mark the weapon as thrown, so that we'll autograb it once the
+ // monster is dead.
+ mitm[index].flags |= ISFLAG_THROWN;
+
+ mprf("%s wields %s!",
+ mon->name(DESC_CAP_THE).c_str(),
+ myweapon.name(DESC_NOCAP_YOUR).c_str());
+ mon->equip(myweapon, MSLOT_WEAPON, 0);
+
+ // Item is gone from player's inventory.
+ dec_inv_item_quantity(mywpn, myweapon.quantity);
+
+ mitm[monwpn].pos.reset();
+ mitm[monwpn].link = NON_ITEM;
+
+ int freeslot = find_free_slot(mitm[monwpn]);
+ if (freeslot < 0 || freeslot >= ENDOFPACK
+ || is_valid_item(you.inv[freeslot]))
+ {
+ // Something is terribly wrong.
+ return (XOM_DID_NOTHING);
+ }
+
+ item_def &myitem = you.inv[freeslot];
+ // Copy item.
+ myitem = mitm[monwpn];
+ myitem.link = freeslot;
+ myitem.pos.set(-1, -1);
+ // Remove "dropped by ally" flag.
+ myitem.flags &= ~(ISFLAG_DROPPED_BY_ALLY);
+
+ if (!myitem.slot)
+ myitem.slot = index_to_letter(myitem.link);
+
+ origin_set_monster(myitem, mon);
+ note_inscribe_item(myitem);
+ dec_mitm_item_quantity(monwpn, myitem.quantity);
+ you.m_quiver->on_inv_quantity_changed(freeslot, myitem.quantity);
+ burden_change();
+
+ mprf("You wield %s %s!",
+ mon->name(DESC_NOCAP_ITS).c_str(),
+ you.inv[freeslot].name(DESC_PLAIN).c_str());
+
+ you.equip[EQ_WEAPON] = freeslot;
+ wield_effects(freeslot, true);
+
+ you.wield_change = true;
+ you.m_quiver->on_weapon_changed();
+
+ return (XOM_BAD_SWAP_WEAPONS);
+}
+
// Swap places with a random monster and, depending on severity, also
// between monsters. This can be pretty bad if there are a lot of
// hostile monsters around.
-static bool _xom_rearrange_pieces(int sever)
+static int _xom_rearrange_pieces(int sever, bool debug = false)
{
if (player_stair_delay())
- return (false);
+ return (XOM_DID_NOTHING);
std::vector<monsters *> mons;
for (unsigned i = 0; i < MAX_MONSTERS; ++i)
@@ -1452,7 +1659,10 @@ static bool _xom_rearrange_pieces(int sever)
mons.push_back(m);
}
if (mons.empty())
- return (false);
+ return (XOM_DID_NOTHING);
+
+ if (debug)
+ return (XOM_GOOD_SWAP_MONSTERS);
god_speaks(GOD_XOM, _get_xom_speech("rearrange the pieces").c_str());
@@ -1494,15 +1704,95 @@ static bool _xom_rearrange_pieces(int sever)
}
take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, "swap monsters"), true);
- return (true);
+ return (XOM_GOOD_SWAP_MONSTERS);
}
-static bool _xom_give_mutations(bool good)
+static int _xom_animate_monster_weapon(int sever, bool debug = false)
{
- bool rc = false;
+ std::vector<monsters *> mons_wpn;
+ for (unsigned i = 0; i < MAX_MONSTERS; ++i)
+ {
+ monsters* m = &menv[i];
+
+ if (!m->alive())
+ continue;
+
+ if (!see_grid(m->pos()))
+ continue;
+
+ if (mons_wont_attack(m) || mons_is_summoned(m)
+ || mons_itemuse(m) < MONUSE_STARTING_EQUIPMENT
+ || (m->flags & MF_HARD_RESET))
+ {
+ continue;
+ }
+
+ const int mweap = m->inv[MSLOT_WEAPON];
+ if (mweap == NON_ITEM)
+ continue;
+
+ const item_def weapon = mitm[mweap];
+
+ if (weapon.base_type == OBJ_WEAPONS
+ && !(weapon.flags & ISFLAG_SUMMONED)
+ && weapon.quantity == 1
+ && !is_range_weapon(weapon)
+ && !is_special_unrandom_artefact(weapon)
+ && !get_weapon_brand(weapon) != SPWPN_DISTORTION)
+ {
+ mons_wpn.push_back(m);
+ }
+ }
+ if (mons_wpn.empty())
+ return (XOM_DID_NOTHING);
+ if (debug)
+ return (XOM_GOOD_ANIMATE_MON_WPN);
+
+ god_speaks(GOD_XOM, _get_xom_speech("animate monster weapon").c_str());
+
+ const int num_mons = mons_wpn.size();
+ // Pick a random monster...
+ monsters *mon = mons_wpn[random2(num_mons)];
+
+ // ...and get its weapon.
+ const int wpn = mon->inv[MSLOT_WEAPON];
+ ASSERT(wpn != NON_ITEM);
+
+ const int dur = std::min(2 + (random2(sever) / 5), 6);
+ const int monster = create_monster(
+ mgen_data(MONS_DANCING_WEAPON, BEH_FRIENDLY,
+ dur, SPELL_TUKIMAS_DANCE,
+ mon->pos(), mon->mindex(), 0, GOD_XOM));
+
+ if (monster == -1)
+ return (XOM_DID_NOTHING);
+
+ // Make the monster unwield its weapon.
+ mon->unequip(*(mon->mslot_item(MSLOT_WEAPON)), MSLOT_WEAPON, 0, true);
+ mon->inv[MSLOT_WEAPON] = NON_ITEM;
+
+ mprf("%s %s dances into the air!",
+ apostrophise(mon->name(DESC_CAP_THE)).c_str(),
+ mitm[wpn].name(DESC_PLAIN).c_str());
+
+ destroy_item(menv[monster].inv[MSLOT_WEAPON]);
+
+ menv[monster].inv[MSLOT_WEAPON] = wpn;
+ mitm[wpn].set_holding_monster(monster);
+ menv[monster].colour = mitm[wpn].colour;
+
+ return (XOM_GOOD_ANIMATE_MON_WPN);
+}
+
+static int _xom_give_mutations(bool good, bool debug = false)
+{
+ bool rc = false;
if (you.can_safely_mutate())
{
+ if (debug)
+ return (good ? XOM_GOOD_MUTATION : XOM_BAD_MUTATION);
+
const char* lookup = (good ? "good mutations" : "random mutations");
god_speaks(GOD_XOM, _get_xom_speech(lookup).c_str());
@@ -1539,13 +1829,18 @@ static bool _xom_give_mutations(bool good)
}
}
- return (rc);
+ if (rc)
+ return (good ? XOM_GOOD_MUTATION : XOM_BAD_MUTATION);
+
+ return (XOM_DID_NOTHING);
}
// Summons a permanent ally.
-static bool _xom_send_major_ally(int sever)
+static int _xom_send_major_ally(int sever, bool debug = false)
{
- bool rc = false;
+ if (debug)
+ return (XOM_GOOD_MAJOR_ALLY);
+
const monster_type mon = _xom_random_demon(sever);
const bool is_demonic = (mons_class_holiness(mon) == MH_DEMONIC);
@@ -1582,16 +1877,16 @@ static bool _xom_send_major_ally(int sever)
menv[summons].name(DESC_PLAIN).c_str());
take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, summ_buf), true);
- rc = true;
+ return (XOM_GOOD_MAJOR_ALLY);
}
- return (rc);
+ return (XOM_DID_NOTHING);
}
-static bool _xom_throw_divine_lightning()
+static int _xom_throw_divine_lightning(bool debug = false)
{
if (!player_in_a_dangerous_place())
- return (false);
+ return (XOM_DID_NOTHING);
// Make sure there's at least one enemy within the lightning radius.
bool found_hostile = false;
@@ -1609,7 +1904,10 @@ static bool _xom_throw_divine_lightning()
// No hostiles within radius.
if (!found_hostile)
- return (false);
+ return (XOM_DID_NOTHING);
+
+ if (debug)
+ return (XOM_GOOD_LIGHTNING);
bool protection = false;
if (you.hp <= random2(201))
@@ -1656,17 +1954,188 @@ static bool _xom_throw_divine_lightning()
"divine lightning%s", protection ? " (protected)" : "");
take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, lightning_buf), true);
- return (true);
+ return (XOM_GOOD_LIGHTNING);
+}
+
+static int _xom_change_scenery(bool debug = false)
+{
+ std::vector<coord_def> candidates;
+ for (radius_iterator ri(you.pos(), LOS_RADIUS, false, true); ri; ++ri)
+ {
+ if (!in_bounds(*ri) || !see_grid(*ri))
+ continue;
+
+ dungeon_feature_type feat = grd(*ri);
+ if (feat >= DNGN_FOUNTAIN_BLUE && feat <= DNGN_DRY_FOUNTAIN_BLOOD)
+ candidates.push_back(*ri);
+ else if (feat >= DNGN_CLOSED_DOOR && feat <= DNGN_SECRET_DOOR
+ || feat == DNGN_OPEN_DOOR && you.pos() != *ri)
+ {
+ candidates.push_back(*ri);
+ }
+ }
+
+ const std::string speech = _get_xom_speech("scenery");
+ if (candidates.empty())
+ {
+ if (!one_chance_in(8))
+ return (XOM_DID_NOTHING);
+
+ // Place one or more altars to Xom.
+ coord_def place;
+ bool success = false;
+ const int max_altars = std::max(1, random2(random2(14)));
+ for (int tries = max_altars; tries > 0; --tries)
+ {
+ if ((random_near_space(you.pos(), place)
+ || random_near_space(you.pos(), place, true))
+ && grd(place) == DNGN_FLOOR && see_grid(place))
+ {
+ if (debug)
+ return (XOM_GOOD_SCENERY);
+
+ grd(place) = DNGN_ALTAR_XOM;
+ success = true;
+ }
+ }
+
+ if (success)
+ {
+ god_speaks(GOD_XOM, speech.c_str());
+ return (XOM_GOOD_SCENERY);
+ }
+ return (XOM_DID_NOTHING);
+ }
+
+ if (debug)
+ return (XOM_GOOD_SCENERY);
+
+ const int fountain_diff = (DNGN_DRY_FOUNTAIN_BLUE - DNGN_FOUNTAIN_BLUE);
+
+ std::random_shuffle(candidates.begin(), candidates.end());
+ int doors_open = 0;
+ int doors_close = 0;
+ int fountains_flow = 0;
+ int fountains_blood = 0;
+ for (unsigned int i = 0; i < candidates.size(); ++i)
+ {
+ coord_def pos = candidates[i];
+ switch (grd(pos))
+ {
+ case DNGN_CLOSED_DOOR:
+ case DNGN_DETECTED_SECRET_DOOR:
+ case DNGN_SECRET_DOOR:
+ grd(pos) = DNGN_OPEN_DOOR;
+ doors_open++;
+ break;
+ case DNGN_OPEN_DOOR:
+ grd(pos) = DNGN_CLOSED_DOOR;
+ doors_close++;
+ break;
+ case DNGN_DRY_FOUNTAIN_BLUE:
+ case DNGN_DRY_FOUNTAIN_SPARKLING:
+ case DNGN_DRY_FOUNTAIN_BLOOD:
+ {
+ if (x_chance_in_y(fountains_flow, 5))
+ continue;
+
+ grd(pos) = (dungeon_feature_type) (grd(pos) - fountain_diff);
+ fountains_flow++;
+ break;
+ }
+ case DNGN_FOUNTAIN_BLUE:
+ if (x_chance_in_y(fountains_blood, 3))
+ continue;
+
+ grd(pos) = DNGN_FOUNTAIN_BLOOD;
+ fountains_blood++;
+ break;
+ default:
+ break;
+ }
+ }
+ if (!doors_open && !doors_close && !fountains_flow && !fountains_blood)
+ return (XOM_DID_NOTHING);
+
+ god_speaks(GOD_XOM, speech.c_str());
+
+ std::vector<std::string> effects;
+ if (doors_open > 0)
+ {
+ snprintf(info, INFO_SIZE, "%s door%s burst%s open",
+ doors_open == 1 ? "A" :
+ doors_open == 2 ? "Two"
+ : "Several",
+ doors_open == 1 ? "" : "s",
+ doors_open == 1 ? "s" : "");
+ effects.push_back(info);
+ }
+ if (doors_close > 0)
+ {
+ snprintf(info, INFO_SIZE, "%s%s door%s slam%s shut",
+ doors_close == 1 ? "a" :
+ doors_close == 2 ? "two"
+ : "several",
+ doors_open > 0 ? (doors_close == 1 ? "nother" : " other")
+ : "",
+ doors_close == 1 ? "" : "s",
+ doors_close == 1 ? "s" : "");
+ std::string closed = info;
+ if (effects.empty())
+ closed = uppercase_first(closed);
+ effects.push_back(closed);
+ }
+ if (!effects.empty())
+ {
+ mprf("%s!",
+ comma_separated_line(effects.begin(), effects.end(),
+ ", and ").c_str());
+ effects.clear();
+ }
+
+ if (fountains_flow > 0)
+ {
+ snprintf(info, INFO_SIZE,
+ "%s fountain%s start%s reflowing",
+ fountains_flow == 1 ? "A" : "Some",
+ fountains_flow == 1 ? "" : "s",
+ fountains_flow == 1 ? "s" : "");
+ effects.push_back(info);
+ }
+ if (fountains_blood > 0)
+ {
+ snprintf(info, INFO_SIZE,
+ "%s%s fountain%s start%s gushing blood",
+ fountains_blood == 1 ? "a" : "some",
+ fountains_flow > 0 ? (fountains_blood == 1 ? "nother"
+ : " other")
+ : "",
+ fountains_blood == 1 ? "" : "s",
+ fountains_blood == 1 ? "s" : "");
+
+ std::string fountains = info;
+ if (effects.empty())
+ fountains = uppercase_first(fountains);
+ effects.push_back(fountains);
+ }
+ if (!effects.empty())
+ {
+ mprf("%s!",
+ comma_separated_line(effects.begin(), effects.end(),
+ ", and ").c_str());
+ }
+
+ return (XOM_GOOD_SCENERY);
}
// The nicer stuff. Note: these things are not necessarily nice.
-static bool _xom_is_good(int sever, int tension)
+static int _xom_is_good(int sever, int tension, bool debug = false)
{
- bool done = false;
+ int done = XOM_DID_NOTHING;
// Did Xom (already) kill the player?
if (_player_is_dead())
- return (true);
+ return (XOM_PLAYER_DEAD);
god_acting gdact(GOD_XOM);
@@ -1675,48 +2144,49 @@ static bool _xom_is_good(int sever, int tension)
// Don't make the player go berserk etc. if there's no danger.
if (tension > random2(3) && x_chance_in_y(2, sever))
- done = _xom_do_potion();
+ done = _xom_do_potion(debug);
else if (x_chance_in_y(3, sever))
{
// There are a lot less non-tension spells than tension ones,
// so use them more rarely.
if (tension > 0 || one_chance_in(3))
- done = _xom_makes_you_cast_random_spell(sever, tension);
+ done = _xom_makes_you_cast_random_spell(sever, tension, debug);
}
- else if (x_chance_in_y(4, sever))
- done = _xom_confuse_monsters(sever);
+ else if (tension > 0 && x_chance_in_y(4, sever))
+ done = _xom_confuse_monsters(sever, debug);
// It's pointless to send in help if there's no danger.
else if (tension > random2(5) && x_chance_in_y(5, sever))
- done = _xom_send_one_ally(sever);
- else if (x_chance_in_y(6, sever))
- {
- _xom_give_item(sever);
- done = true;
- }
+ done = _xom_send_one_ally(sever, debug);
+ else if (tension < random2(5) && x_chance_in_y(6, sever))
+ done = _xom_change_scenery(debug);
+ else if (x_chance_in_y(7, sever))
+ done = _xom_give_item(sever, debug);
// It's pointless to send in help if there's no danger.
- else if (tension > random2(10) && x_chance_in_y(7, sever))
- done = _xom_send_allies(sever);
- else if (x_chance_in_y(8, sever))
- done = _xom_polymorph_nearby_monster(true);
- else if (tension > 0 && x_chance_in_y(9, sever))
- done = _xom_rearrange_pieces(sever);
- else if (random2(tension) < 15 && x_chance_in_y(10, sever))
- {
- _xom_give_item(sever);
- done = true;
- }
- else if (x_chance_in_y(11, sever) && you.level_type != LEVEL_ABYSS)
+ else if (tension > random2(10) && x_chance_in_y(8, sever))
+ done = _xom_send_allies(sever, debug);
+ else if (tension > random2(8) && x_chance_in_y(9, sever))
+ done = _xom_animate_monster_weapon(sever, debug);
+ else if (x_chance_in_y(10, sever))
+ done = _xom_polymorph_nearby_monster(true, debug);
+ else if (tension > 0 && x_chance_in_y(11, sever))
+ done = _xom_rearrange_pieces(sever, debug);
+ else if (random2(tension) < 15 && x_chance_in_y(12, sever))
+ done = _xom_give_item(sever, debug);
+ else if (x_chance_in_y(13, sever) && you.level_type != LEVEL_ABYSS)
{
// Try something else if teleportation is impossible.
if (scan_artefacts(ARTP_PREVENT_TELEPORTATION))
- return (false);
+ return (XOM_DID_NOTHING);
// This is not very interesting if the level is already fully
// explored (presumably cleared). Even then, it may occasionally
// happen.
const int explored = _exploration_estimate(true);
if (explored >= 80 && x_chance_in_y(explored, 120))
- return (false);
+ return (XOM_DID_NOTHING);
+
+ if (debug)
+ return (XOM_GOOD_TELEPORT);
// The Xom teleportation train takes you on instant teleportation
// to a few random areas, stopping randomly but most likely in
@@ -1743,29 +2213,32 @@ static bool _xom_is_good(int sever, int tension)
#endif
"");
take_note(Note(NOTE_XOM_EFFECT, you.piety, tension, tele_buf), true);
- done = true;
+ done = XOM_GOOD_TELEPORT;
}
- else if (random2(tension) < 5 && x_chance_in_y(12, sever))
+ else if (random2(tension) < 5 && x_chance_in_y(14, sever))
{
+ if (debug)
+ return (XOM_GOOD_VITRIFY);
+
// This can fail with radius 1, or in open areas.
- if (vitrify_area(random2avg(sever/4,2) + 1))
+ if (vitrify_area(random2avg(sever/4, 2) + 1))
{
god_speaks(GOD_XOM, _get_xom_speech("vitrification").c_str());
take_note(Note(NOTE_XOM_EFFECT, you.piety, tension,
"vitrification"), true);
- done = true;
+ done = XOM_GOOD_VITRIFY;
}
}
- else if (random2(tension) < 5 && x_chance_in_y(13, sever)
+ else if (random2(tension) < 5 && x_chance_in_y(15, sever)
&& x_chance_in_y(16, how_mutated()))
{
- done = _xom_give_mutations(true);
+ done = _xom_give_mutations(true, debug);
}
// It's pointless to send in help if there's no danger.
- else if (tension > random2(15) && x_chance_in_y(14, sever))
- done = _xom_send_major_ally(sever);
- else if (tension > 0 && x_chance_in_y(15, sever))
- done = _xom_throw_divine_lightning();
+ else if (tension > random2(15) && x_chance_in_y(16, sever))
+ done = _xom_send_major_ally(sever, debug);
+ else if (tension > 0 && x_chance_in_y(17, sever))
+ done = _xom_throw_divine_lightning(debug);
return (done);
}
@@ -1861,8 +2334,10 @@ static void _xom_zero_miscast()
messages.push_back("Dim shapes swim through the green crystal wall.");
if (in_view[DNGN_METAL_WALL])
+ {
messages.push_back("Tendrils of electricity crawl over the metal "
"wall!");
+ }
if (in_view[DNGN_FOUNTAIN_BLUE] || in_view[DNGN_FOUNTAIN_SPARKLING])
{
@@ -2151,7 +2626,8 @@ static void _get_hand_type(std::string &hand, bool &can_plural)
can_plural = plural_vec[choice];
}
-static void _xom_miscast(const int max_level, const bool nasty)
+static int _xom_miscast(const int max_level, const bool nasty,
+ bool debug = false)
{
ASSERT(max_level >= 0 && max_level <= 3);
@@ -2172,7 +2648,19 @@ static void _xom_miscast(const int max_level, const bool nasty)
const char* speech_str = speeches[max_level];
const char* cause_str = causes[max_level];
- const int level = random2(max_level + 1);
+ const int level = (nasty ? 1 + random2(max_level)
+ : random2(max_level + 1));
+
+ if (debug)
+ {
+ switch (level)
+ {
+ case 0: return (XOM_BAD_MISCAST_PSEUDO);
+ case 1: return (XOM_BAD_MISCAST_MINOR);
+ case 2: return (XOM_BAD_MISCAST_MAJOR);
+ case 3: return (XOM_BAD_MISCAST_NASTY);
+ }
+ }
// Take a note.
std::string desc = "miscast effect";
@@ -2188,7 +2676,7 @@ static void _xom_miscast(const int max_level, const bool nasty)
{
god_speaks(GOD_XOM, _get_xom_speech(speech_str).c_str());
_xom_zero_miscast();
- return;
+ return (XOM_BAD_MISCAST_PSEUDO);
}
std::string hand_str;
@@ -2204,10 +2692,16 @@ static void _xom_miscast(const int max_level, const bool nasty)
MiscastEffect(&you, -GOD_XOM, SPTYP_RANDOM, level, cause_str, NH_DEFAULT,
lethality_margin, hand_str, can_plural);
+
+ // Not worth distinguishing unless debugging.
+ return (XOM_BAD_MISCAST_MAJOR);
}
-static bool _xom_lose_stats()
+static int _xom_lose_stats(bool debug = false)
{
+ if (debug)
+ return (XOM_BAD_STATLOSS);
+
stat_type stat = STAT_RANDOM;
int max = 3;
@@ -2233,7 +2727,7 @@ static bool _xom_lose_stats()
while (max < 2 && (++tries < 30));
if (tries >= 30)
- return (false);
+ return (XOM_DID_NOTHING);
}
god_speaks(GOD_XOM, _get_xom_speech("lose stats").c_str());
@@ -2252,22 +2746,24 @@ static bool _xom_lose_stats()
take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, stat_buf), true);
- return (true);
+ return (XOM_BAD_STATLOSS);
}
-static bool _xom_chaos_upgrade_nearby_monster()
+static int _xom_chaos_upgrade_nearby_monster(bool debug = false)
{
- bool rc = false;
-
monsters *mon = choose_random_nearby_monster(0, _choose_chaos_upgrade);
if (!mon)
- return (false);
+ return (XOM_DID_NOTHING);
+
+ if (debug)
+ return (XOM_BAD_CHAOS_UPGRADE);
god_speaks(GOD_XOM, _get_xom_speech("chaos upgrade").c_str());
mon_inv_type slots[] = {MSLOT_WEAPON, MSLOT_ALT_WEAPON, MSLOT_MISSILE};
+ bool rc = false;
for (int i = 0; i < 3 && !rc; ++i)
{
item_def* const item = mon->mslot_item(slots[i]);
@@ -2283,21 +2779,27 @@ static bool _xom_chaos_upgrade_nearby_monster()
behaviour_event(mon, ME_ALERT, MHITYOU);
if (rc)
+ {
take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, "chaos upgrade"), true);
+ return (XOM_BAD_CHAOS_UPGRADE);
+ }
- return (rc);
+ return (XOM_DID_NOTHING);
}
-static bool _xom_player_confusion_effect(int sever)
+static int _xom_player_confusion_effect(int sever, bool debug = false)
{
if (!_xom_feels_nasty())
{
// Don't confuse the player if standing next to lava or deep water.
for (adjacent_iterator ai; ai; ++ai)
if (in_bounds(*ai) && is_grid_dangerous(grd(*ai)))
- return (false);
+ return (XOM_DID_NOTHING);
}
+ if (debug)
+ return (XOM_BAD_CONFUSION);
+
bool rc = false;
// Looks like this will *always* succeed?
@@ -2341,7 +2843,7 @@ static bool _xom_player_confusion_effect(int sever)
take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, conf_msg.c_str()), true);
}
- return (rc);
+ return (rc ? XOM_BAD_CONFUSION : XOM_DID_NOTHING);
}
static bool _valid_floor_grid(coord_def pos)
@@ -2508,13 +3010,13 @@ static bool _move_stair(coord_def stair_pos, bool away)
return (true);
}
-static bool _repel_stairs()
+static int _xom_repel_stairs(bool debug = false)
{
// Repeating the effect while it's still active is boring.
if (you.duration[DUR_REPEL_STAIRS_MOVE]
|| you.duration[DUR_REPEL_STAIRS_CLIMB])
{
- return (false);
+ return (XOM_DID_NOTHING);
}
std::vector<coord_def> stairs_avail;
@@ -2533,7 +3035,10 @@ static bool _repel_stairs()
// Should only happen if there are stairs in view.
if (stairs_avail.empty())
- return (false);
+ return (XOM_DID_NOTHING);
+
+ if (debug)
+ return (XOM_BAD_STAIRS);
// Don't mention staircases if there aren't any nearby.
std::string stair_msg = _get_xom_speech("repel stairs");
@@ -2579,20 +3084,22 @@ static bool _repel_stairs()
else
take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, "repel stairs"), true);
- return (true);
+ return (XOM_BAD_STAIRS);
}
-static bool _xom_draining_torment_effect(int sever)
+static int _xom_draining_torment_effect(int sever, bool debug = false)
{
const std::string speech = _get_xom_speech("draining or torment");
const bool nasty = _xom_feels_nasty();
- bool rc = false;
+ int rc = XOM_DID_NOTHING;
if (one_chance_in(4))
{
// XP drain effect (25%).
if (player_prot_life() < 3 && (nasty || you.experience > 0))
{
+ if (debug)
+ return (XOM_BAD_DRAINING);
god_speaks(GOD_XOM, speech.c_str());
drain_exp();
@@ -2602,7 +3109,7 @@ static bool _xom_draining_torment_effect(int sever)
drain_exp();
take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, "draining"), true);
- rc = true;
+ return (XOM_BAD_DRAINING);
}
}
else
@@ -2610,6 +3117,9 @@ static bool _xom_draining_torment_effect(int sever)
// Torment effect (75%).
if (!player_res_torment())
{
+ if (debug)
+ return (XOM_BAD_TORMENT);
+
god_speaks(GOD_XOM, speech.c_str());
torment_player(0, TORMENT_XOM);
@@ -2619,20 +3129,24 @@ static bool _xom_draining_torment_effect(int sever)
"torment (%d/%d hp)", you.hp, you.hp_max);
take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, torment_buf), true);
- rc = true;
+ return (XOM_BAD_TORMENT);
}
}
return (rc);
}
-static bool _xom_summon_hostiles(int sever)
+static int _xom_summon_hostiles(int sever, bool debug = false)
{
bool rc = false;
const std::string speech = _get_xom_speech("hostile monster");
+ int result = XOM_DID_NOTHING;
// Nasty, but fun.
if (player_weapon_wielded() && one_chance_in(4))
{
+ if (debug)
+ return (XOM_BAD_ANIMATE_WPN);
+
const item_def& weapon = *you.weapon();
const std::string wep_name = weapon.name(DESC_PLAIN);
rc = cast_tukimas_dance(100, GOD_XOM, true);
@@ -2643,16 +3157,20 @@ static bool _xom_summon_hostiles(int sever)
snprintf(wpn_buf, sizeof(wpn_buf),
"animates weapon (%s)", wep_name.c_str());
take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, wpn_buf), true);
+ result = XOM_BAD_ANIMATE_WPN;
}
}
else
{
+ if (debug)
+ return (XOM_BAD_SUMMON_DEMONS);
+
// The number of demons is dependent on severity, though heavily
// randomised.
int numdemons = sever;
- for (int i = 0; i < 3; i++)
- numdemons = random2(numdemons+1);
- numdemons = std::min(numdemons+1,14);
+ for (int i = 0; i < 3; ++i)
+ numdemons = random2(numdemons + 1);
+ numdemons = std::min(numdemons + 1, 14);
int num_summoned = 0;
for (int i = 0; i < numdemons; ++i)
@@ -2676,18 +3194,19 @@ static bool _xom_summon_hostiles(int sever)
take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, summ_buf), true);
rc = true;
+ result = XOM_BAD_SUMMON_DEMONS;
}
}
if (rc)
god_speaks(GOD_XOM, speech.c_str());
- return (rc);
+ return (result);
}
-static bool _xom_is_bad(int sever, int tension)
+static int _xom_is_bad(int sever, int tension, bool debug = false)
{
- bool done = false;
+ int done = XOM_DID_NOTHING;
bool nasty = (sever >= 5 && _xom_feels_nasty());
god_acting gdact(GOD_XOM);
@@ -2695,51 +3214,60 @@ static bool _xom_is_bad(int sever, int tension)
// Rough estimate of how bad a Xom effect hits the player,
// scaled between 1 (harmless) and 5 (disastrous).
int badness = 1;
- while (!done)
+ while (done == XOM_DID_NOTHING)
{
// Did Xom kill the player?
if (_player_is_dead())
- return (true);
+ return (XOM_PLAYER_DEAD);
if (!nasty && x_chance_in_y(3, sever))
- {
- _xom_miscast(0, nasty);
- done = true;
- }
+ done = _xom_miscast(0, nasty, debug);
else if (!nasty && x_chance_in_y(4, sever))
+ done = _xom_miscast(1, nasty, debug);
+ // It's pointless to confuse player if there's no danger nearby.
+ else if (tension > 0 && x_chance_in_y(5, sever))
{
- _xom_miscast(1, nasty);
- done = true;
+ done = _xom_player_confusion_effect(sever, debug);
+ badness = (random2(tension) > 5 ? 2 : 1);
}
- else if (x_chance_in_y(5, sever))
+ else if (x_chance_in_y(6, sever))
{
- done = _xom_lose_stats();
+ done = _xom_lose_stats(debug);
badness = 2;
}
- else if (x_chance_in_y(6, sever))
+ else if (tension > 0 && x_chance_in_y(7, sever))
+ done = _xom_swap_weapons(debug);
+ else if (x_chance_in_y(8, sever))
{
- _xom_miscast(2, nasty);
+ done = _xom_miscast(2, nasty, debug);
badness = 2;
- done = true;
}
- else if (x_chance_in_y(7, sever) && you.level_type != LEVEL_ABYSS)
+ else if (x_chance_in_y(9, sever))
+ {
+ done = _xom_chaos_upgrade_nearby_monster(debug);
+ badness = 2 + coinflip();
+ }
+ else if (x_chance_in_y(10, sever) && you.level_type != LEVEL_ABYSS)
{
// Try something else if teleportation is impossible.
if (scan_artefacts(ARTP_PREVENT_TELEPORTATION))
- return (false);
+ return (XOM_DID_NOTHING);
// This is not particularly exciting if the level is already
// fully explored (presumably cleared). If Xom is feeling
// nasty, this is likelier to happen if the level is
// unexplored.
const int explored = _exploration_estimate(true);
- if (nasty && explored >= 50 && coinflip()
- || explored >= 80 + random2(20))
+ if (nasty && (explored >= 40 || tension > 10)
+ || explored >= 60 + random2(40))
{
- done = false;
+ done = XOM_DID_NOTHING;
continue;
}
+ if (debug)
+ return (XOM_BAD_TELEPORT);
+
// The Xom teleportation train takes you on instant
// teleportation to a few random areas, stopping if either
// an area is dangerous to you or randomly.
@@ -2769,63 +3297,54 @@ static bool _xom_is_bad(int sever, int tension)
#endif
take_note(Note(NOTE_XOM_EFFECT, you.piety, tension, tele_buf),
true);
- done = true;
- }
- else if (x_chance_in_y(8, sever))
- {
- done = _xom_chaos_upgrade_nearby_monster();
- badness = 2 + coinflip();
- }
- else if (random2(tension) < 10 && x_chance_in_y(9, sever))
- {
- done = _xom_give_mutations(false);
- badness = 3;
+ done = XOM_BAD_TELEPORT;
}
- else if (x_chance_in_y(10, sever))
+ else if (x_chance_in_y(11, sever))
{
- done = _xom_polymorph_nearby_monster(false);
+ done = _xom_polymorph_nearby_monster(false, debug);
badness = 3;
}
- else if (tension > 0 && x_chance_in_y(11, sever))
+ else if (tension > 0 && x_chance_in_y(12, sever))
{
- done = _repel_stairs();
+ done = _xom_repel_stairs(debug);
badness = (you.duration[DUR_REPEL_STAIRS_CLIMB] ? 3 : 2);
}
- // It's pointless to confuse player if there's no danger nearby.
- else if (tension > 0 && x_chance_in_y(12, sever))
+ else if (random2(tension) < 11 && x_chance_in_y(13, sever))
{
- done = _xom_player_confusion_effect(sever);
- badness = (random2(tension) > 5 ? 2 : 1);
+ done = _xom_give_mutations(false, debug);
+ badness = 3;
}
- else if (x_chance_in_y(13, sever))
+ else if (x_chance_in_y(14, sever))
{
- done = _xom_draining_torment_effect(sever);
+ done = _xom_draining_torment_effect(sever, debug);
badness = (random2(tension) > 5 ? 3 : 2);
}
- else if (x_chance_in_y(14, sever))
+ else if (x_chance_in_y(15, sever))
{
- done = _xom_summon_hostiles(sever);
+ done = _xom_summon_hostiles(sever, debug);
badness = 3 + coinflip();
}
- else if (x_chance_in_y(15, sever))
+ else if (x_chance_in_y(16, sever))
{
- _xom_miscast(3, nasty);
+ done = _xom_miscast(3, nasty, debug);
badness = 4 + coinflip();
- done = true;
}
else if (one_chance_in(sever) && you.level_type != LEVEL_ABYSS)
{
- god_speaks(GOD_XOM, _get_xom_speech("banishment").c_str());
- // handles note taking
- banished(DNGN_ENTER_ABYSS, "Xom");
- badness = 5;
- done = true;
+ if (!debug)
+ {
+ god_speaks(GOD_XOM, _get_xom_speech("banishment").c_str());
+ // handles note taking
+ banished(DNGN_ENTER_ABYSS, "Xom");
+ badness = 5;
+ }
+ done = XOM_BAD_BANISHMENT;
}
}
// If we got here because Xom was bored, reset gift timeout according
// to the badness of the effect.
- if (done && _xom_is_bored())
+ if (done && !debug && _xom_is_bored())
{
const int interest = random2avg(badness*60, 2);
you.gift_timeout = std::min(interest, 255);
@@ -2964,7 +3483,7 @@ static void _handle_accidental_death(const int orig_hp,
you.teleport(true);
}
-void xom_acts(bool niceness, int sever, int tension)
+int xom_acts(bool niceness, int sever, int tension, bool debug)
{
#if defined(DEBUG_DIAGNOSTICS) || defined(DEBUG_RELIGION) || defined(DEBUG_XOM)
mprf(MSGCH_DIAGNOSTICS, "xom_acts(%u, %d, %d); piety: %u, interest: %u\n",
@@ -2988,7 +3507,7 @@ void xom_acts(bool niceness, int sever, int tension)
mpr("Player is already dead, skipping Xom act.",
MSGCH_DIAGNOSTICS);
}
- return;
+ return (XOM_PLAYER_DEAD);
}
#else
ASSERT(!_player_is_dead());
@@ -3040,15 +3559,19 @@ void xom_acts(bool niceness, int sever, int tension)
#endif
const bool was_bored = _xom_is_bored();
+ int result = XOM_DID_NOTHING;
if (niceness && !one_chance_in(20))
{
// Good stuff.
- while (!_xom_is_good(sever, tension))
- ;
+ while (result == XOM_DID_NOTHING)
+ result = _xom_is_good(sever, tension, debug);
+
+ if (debug)
+ return (result);
}
else
{
- if (was_bored && Options.note_xom_effects)
+ if (!debug && was_bored && Options.note_xom_effects)
take_note(Note(NOTE_MESSAGE, 0, 0, "XOM is BORED!"), true);
#ifdef NOTE_DEBUG_XOM
else if (niceness)
@@ -3059,8 +3582,11 @@ void xom_acts(bool niceness, int sever, int tension)
#endif
// Bad mojo.
- while (!_xom_is_bad(sever, tension))
- ;
+ while (result == XOM_DID_NOTHING)
+ result = _xom_is_bad(sever, tension, debug);
+
+ if (debug)
+ return (result);
}
_handle_accidental_death(orig_hp, orig_stats, orig_mutation);
@@ -3099,6 +3625,9 @@ void xom_acts(bool niceness, int sever, int tension)
const std::string msg = "You are now " + new_xom_favour;
god_speaks(you.religion, msg.c_str());
}
+
+ // Not true, but also not important now.
+ return (result);
}
static void _xom_check_less_runes(int runes_gone)
@@ -3235,3 +3764,200 @@ void xom_death_message(const kill_method_type killed_by)
// All others just get ignored by Xom.
}
+
+#ifdef WIZARD
+struct xom_effect_count
+{
+ std::string effect;
+ int count;
+
+ xom_effect_count(std::string e, int c) : effect(e), count(c) {};
+};
+
+static bool _sort_xom_effects(const xom_effect_count &a,
+ const xom_effect_count &b)
+{
+ if (a.count == b.count)
+ return (a.effect < b.effect);
+
+ return (a.count > b.count);
+}
+
+static const char* _xom_effect_to_name(int effect)
+{
+ ASSERT(effect < XOM_PLAYER_DEAD);
+
+ // See xom.h
+ static const char* _xom_effect_names[] =
+ {
+ "nothing",
+ // good acts
+ "potion", "spell (tension)", "spell (no tension)", "mapping",
+ "confuse monsters", "single ally", "animate monster weapon",
+ "annoyance gift", "random item gift", "acquirement", "summon allies",
+ "polymorph", "swap monsters", "teleportation", "vitrification",
+ "mutation", "permanent ally", "lightning", "change scenery",
+ // bad acts
+ "miscast (pseudo)", "miscast (minor)", "miscast (major)",
+ "miscast (nasty)", "stat loss", "teleportation", "swap weapons",
+ "chaos upgrade", "mutation", "polymorph", "repel stairs", "confusion",
+ "draining", "torment", "animate weapon", "summon demons", "banishment"
+ };
+
+ std::string result = "";
+ if (effect > XOM_DID_NOTHING && effect < XOM_PLAYER_DEAD)
+ {
+ if (effect <= XOM_LAST_GOOD_ACT)
+ result = "GOOD: ";
+ else
+ result = "BAD: ";
+ }
+ result += _xom_effect_names[effect];
+
+ return (result.c_str());
+}
+
+// Loops over the entire piety spectrum and calls xom_acts() multiple
+// times for each value, then prints the results into a file.
+// TODO: Allow specification of niceness, tension, boredness, and repeats.
+void debug_xom_effects()
+{
+ // Repeat N times.
+ const int N = 10;
+
+ FILE *ostat = fopen("xom_debug.stat", "a");
+ if (!ostat)
+ {
+ mprf(MSGCH_ERROR, "Can't write 'xom_debug.stat'. Aborting.");
+ return;
+ }
+
+ const int real_piety = you.piety;
+ const god_type real_god = you.religion;
+ you.religion = GOD_XOM;
+ const int tension = get_tension(GOD_XOM);
+
+ fprintf(ostat, "---- STARTING XOM DEBUG TESTING ----\n");
+ fprintf(ostat, "%s\n", dump_overview_screen(false).c_str());
+ fprintf(ostat, screenshot().c_str());
+ fprintf(ostat, "\n%s\n", mpr_monster_list().c_str());
+ fprintf(ostat, " --> Tension: %d\n", tension);
+
+ if (you.penance[GOD_XOM])
+ fprintf(ostat, "You are under Xom's penance!\n");
+ else if (_xom_is_bored())
+ fprintf(ostat, "Xom is BORED.\n");
+
+ std::vector<int> mood_effects;
+ std::vector<std::vector<int> > all_effects;
+ std::vector<std::string> moods;
+ std::vector<int> mood_good_acts;
+
+ std::string old_mood = "";
+ std::string mood = "";
+
+ // Add an empty list to later add all effects to.
+ all_effects.push_back(mood_effects);
+ moods.push_back("total");
+ mood_good_acts.push_back(0); // count total good acts
+
+ int mood_good = 0;
+ for (int p = 0; p <= MAX_PIETY; ++p)
+ {
+ you.piety = p;
+ int sever = abs(p - HALF_MAX_PIETY);
+ mood = describe_xom_mood();
+ if (old_mood != mood)
+ {
+ if (old_mood != "")
+ {
+ all_effects.push_back(mood_effects);
+ mood_effects.clear();
+ mood_good_acts.push_back(mood_good);
+ mood_good_acts[0] += mood_good;
+ mood_good = 0;
+ }
+ moods.push_back(mood);
+ old_mood = mood;
+ }
+
+ // Repeat N times.
+ for (int i = 0; i < N; ++i)
+ {
+ bool niceness = xom_is_nice(tension);
+ int result = xom_acts(niceness, sever, tension, true);
+ mood_effects.push_back(result);
+ all_effects[0].push_back(result);
+
+ if (result <= XOM_LAST_GOOD_ACT)
+ mood_good++;
+ }
+ }
+ all_effects.push_back(mood_effects);
+ mood_effects.clear();
+ mood_good_acts.push_back(mood_good);
+ mood_good_acts[0] += mood_good;
+
+ const int num_moods = moods.size();
+ std::vector<xom_effect_count> xom_ec_pairs;
+ for (int i = 0; i < num_moods; ++i)
+ {
+ mood_effects = all_effects[i];
+ const int total = mood_effects.size();
+
+ if (i == 0)
+ fprintf(ostat, "\nTotal effects (all piety ranges)\n");
+ else
+ fprintf(ostat, "\nMood: You are %s\n", moods[i].c_str());
+
+ fprintf(ostat, "GOOD%7.2f%%\n",
+ (100.0 * (float) mood_good_acts[i] / (float) total));
+ fprintf(ostat, "BAD %7.2f%%\n",
+ (100.0 * (float) (total - mood_good_acts[i]) / (float) total));
+
+ std::sort(mood_effects.begin(), mood_effects.end());
+
+ xom_ec_pairs.clear();
+ int old_effect = XOM_DID_NOTHING;
+ int count = 0;
+ for (int k = 0; k < total; ++k)
+ {
+ if (mood_effects[k] != old_effect)
+ {
+ if (count > 0)
+ {
+ std::string name = _xom_effect_to_name(old_effect);
+ xom_effect_count xec = xom_effect_count(name, count);
+ xom_ec_pairs.push_back(xec);
+ }
+ old_effect = mood_effects[k];
+ count = 1;
+ }
+ else
+ count++;
+ }
+
+ if (count > 0)
+ {
+ std::string name = _xom_effect_to_name(old_effect);
+ xom_effect_count xec = xom_effect_count(name, count);
+ xom_ec_pairs.push_back(xec);
+ }
+
+ std::sort(xom_ec_pairs.begin(), xom_ec_pairs.end(), _sort_xom_effects);
+ for (unsigned int k = 0; k < xom_ec_pairs.size(); ++k)
+ {
+ xom_effect_count xec = xom_ec_pairs[k];
+ fprintf(ostat, "%7.2f%% %s\n",
+ (100.0 * (float) xec.count / (float) total),
+ xec.effect.c_str());
+ }
+ }
+ fprintf(ostat, "---- FINISHED XOM DEBUG TESTING ----\n");
+ fclose(ostat);
+ mpr("Results written into 'xom_debug.stat'.");
+
+ you.piety = real_piety;
+ you.religion = real_god;
+}
+#endif
diff --git a/crawl-ref/source/xom.h b/crawl-ref/source/xom.h
index ab0e13d66a..047f5196b5 100644
--- a/crawl-ref/source/xom.h
+++ b/crawl-ref/source/xom.h
@@ -18,6 +18,56 @@ enum xom_message_type
NUM_XOM_MESSAGE_TYPES
};
+enum xom_event_type
+{
+ XOM_DID_NOTHING = 0,
+
+ // good acts
+ XOM_GOOD_POTION,
+ XOM_GOOD_SPELL_TENSION,
+ XOM_GOOD_SPELL_CALM,
+ XOM_GOOD_MAPPING,
+ XOM_GOOD_CONFUSION, // 5
+ XOM_GOOD_SINGLE_ALLY,
+ XOM_GOOD_ANIMATE_MON_WPN,
+ XOM_GOOD_ANNOYANCE_GIFT,
+ XOM_GOOD_RANDOM_ITEM,
+ XOM_GOOD_ACQUIREMENT, // 10
+ XOM_GOOD_ALLIES,
+ XOM_GOOD_POLYMORPH,
+ XOM_GOOD_SWAP_MONSTERS,
+ XOM_GOOD_TELEPORT,
+ XOM_GOOD_VITRIFY, // 15
+ XOM_GOOD_MUTATION,
+ XOM_GOOD_MAJOR_ALLY,
+ XOM_GOOD_LIGHTNING,
+ XOM_GOOD_SCENERY,
+ XOM_LAST_GOOD_ACT = XOM_GOOD_SCENERY, // 19
+
+ // bad acts
+ XOM_BAD_MISCAST_PSEUDO, // 20
+ XOM_BAD_MISCAST_MINOR,
+ XOM_BAD_MISCAST_MAJOR,
+ XOM_BAD_MISCAST_NASTY,
+ XOM_BAD_STATLOSS,
+ XOM_BAD_TELEPORT, // 25
+ XOM_BAD_SWAP_WEAPONS,
+ XOM_BAD_CHAOS_UPGRADE,
+ XOM_BAD_MUTATION,
+ XOM_BAD_POLYMORPH,
+ XOM_BAD_STAIRS, // 30
+ XOM_BAD_CONFUSION,
+ XOM_BAD_DRAINING,
+ XOM_BAD_TORMENT,
+ XOM_BAD_ANIMATE_WPN,
+ XOM_BAD_SUMMON_DEMONS, // 35
+ XOM_BAD_BANISHMENT,
+ XOM_LAST_BAD_ACT = XOM_BAD_BANISHMENT, // 36
+
+ XOM_PLAYER_DEAD = 100, // player already dead (shouldn't happen)
+ NUM_XOM_EVENTS
+};
+
void xom_tick();
void xom_is_stimulated(int maxinterestingness,
xom_message_type message_type = XM_NORMAL,
@@ -25,7 +75,7 @@ void xom_is_stimulated(int maxinterestingness,
void xom_is_stimulated(int maxinterestingness, const std::string& message,
bool force_message = false);
bool xom_is_nice(int tension = -1);
-void xom_acts(bool niceness, int sever, int tension = -1);
+int xom_acts(bool niceness, int sever, int tension = -1, bool debug = false);
const char *describe_xom_favour(bool upper = false);
inline void xom_acts(int sever, int tension = -1)
@@ -36,4 +86,8 @@ inline void xom_acts(int sever, int tension = -1)
void xom_check_lost_item(const item_def& item);
void xom_check_destroyed_item(const item_def& item, int cause = -1);
void xom_death_message(const kill_method_type killed_by);
+#ifdef WIZARD
+void debug_xom_effects();
+#endif
+
#endif