diff options
-rw-r--r-- | crawl-ref/source/misc.cc | 49 | ||||
-rw-r--r-- | crawl-ref/source/rltiles/tool/main.cc | 1 | ||||
-rw-r--r-- | crawl-ref/source/rltiles/tool/tile.cc | 53 | ||||
-rw-r--r-- | crawl-ref/source/rltiles/tool/tile.h | 11 | ||||
-rw-r--r-- | crawl-ref/source/rltiles/tool/tile_page.cc | 3 | ||||
-rw-r--r-- | crawl-ref/source/rltiles/tool/tile_page.h | 4 |
6 files changed, 77 insertions, 44 deletions
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index aabdcea2a9..2f56f29fb1 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -69,6 +69,7 @@ REVISION("$Rev$"); #include "shopping.h" #include "skills.h" #include "skills2.h" +#include "spells1.h" #include "spells3.h" #include "stash.h" #include "state.h" @@ -1479,13 +1480,16 @@ static int runes_in_pack(std::vector<int> &runes) for (int i = 0; i < ENDOFPACK; i++) { - if (is_valid_item( you.inv[i] ) + if (is_valid_item(you.inv[i]) && you.inv[i].base_type == OBJ_MISCELLANY && you.inv[i].sub_type == MISC_RUNE_OF_ZOT) { num_runes += you.inv[i].quantity; - for (int q = 1; runes.size() < 3 && q < you.inv[i].quantity; ++q) - runes.push_back(you.inv[i].plus); + for (int q = 1; + runes.size() < 3 && q <= you.inv[i].quantity; ++q) + { + runes.push_back(i); + } } } @@ -2133,17 +2137,46 @@ void down_stairs( int old_level, dungeon_feature_type force_stair, switch (NUMBER_OF_RUNES_NEEDED) { case 1: - mpr("You need a Rune to enter this place."); + mpr("You need a rune to enter this place."); break; default: - mprf( "You need at least %d Runes to enter this place.", - NUMBER_OF_RUNES_NEEDED ); + mprf("You need at least %d runes to enter this place.", + NUMBER_OF_RUNES_NEEDED); } return; } - // TODO: This needs a better message! - mpr("The gate opens wide!"); + + ASSERT(runes.size() >= 3); + + mprf("You insert %s into the lock.", + you.inv[runes[0]].name(DESC_NOCAP_THE).c_str()); +#ifdef USE_TILE + tiles.add_overlay(you.pos(), tileidx_zap(GREEN)); + update_screen(); +#else + you.flash_colour = LIGHTGREEN; + viewwindow(true, false); +#endif + mpr("The lock glows an eerie green colour!"); + more(); + + mprf("You insert %s into the lock.", + you.inv[runes[1]].name(DESC_NOCAP_THE).c_str()); + big_cloud(CLOUD_PURP_SMOKE, KC_YOU, you.pos(), 20, 7 + random2(7)); + viewwindow(true, false); + mpr("Heavy smoke blows from the lock!"); + more(); + + mprf("You insert %s into the lock.", + you.inv[runes[2]].name(DESC_NOCAP_THE).c_str()); + + if (silenced(you.pos())) + mpr("The gate opens wide!"); + else + mpr("With a loud hiss the gate opens wide!"); + more(); + you.opened_zot = true; } diff --git a/crawl-ref/source/rltiles/tool/main.cc b/crawl-ref/source/rltiles/tool/main.cc index 8b4b60ce43..c94e2d17a2 100644 --- a/crawl-ref/source/rltiles/tool/main.cc +++ b/crawl-ref/source/rltiles/tool/main.cc @@ -1,3 +1,4 @@ +#include <stdio.h> #include "tile_list_processor.h" int main(int argc, char **argv) diff --git a/crawl-ref/source/rltiles/tool/tile.cc b/crawl-ref/source/rltiles/tool/tile.cc index 2b44e6e80a..69bfdeaef6 100644 --- a/crawl-ref/source/rltiles/tool/tile.cc +++ b/crawl-ref/source/rltiles/tool/tile.cc @@ -71,7 +71,7 @@ void tile::set_shrink(bool new_shrink) m_shrink = new_shrink; } -void tile::resize(int new_width, int new_height) +void tile::resize(unsigned int new_width, unsigned int new_height) { delete[] m_pixels; m_width = new_width; @@ -126,11 +126,12 @@ void tile::corpsify() int separate_x = 3; int separate_y = 4; - // force all corpses into 32x32, even if bigger. + // Force all corpses into 32x32, even if bigger. corpsify(32, 32, separate_x, separate_y, red_blood); } -static int corpse_cut_height(int x, int width, int height) +static unsigned int _corpse_cut_height(unsigned int x, unsigned int width, + unsigned int height) { unsigned int cy = height / 2 + 2; @@ -148,10 +149,11 @@ static int corpse_cut_height(int x, int width, int height) // Adapted from rltiles' cp_monst_32 and then ruthlessly rewritten for clarity. // rltiles can be found at http://rltiles.sourceforge.net -void tile::corpsify(int corpse_width, int corpse_height, - int cut_separate, int cut_height, const tile_colour &wound) +void tile::corpsify(unsigned int corpse_width, unsigned int corpse_height, + unsigned int cut_separate, unsigned int cut_height, + const tile_colour &wound) { - int wound_height = std::min(2, cut_height); + unsigned int wound_height = std::min(2, (int) cut_height); // Make a temporary backup tile orig(*this); @@ -182,11 +184,11 @@ void tile::corpsify(int corpse_width, int corpse_height, // Amount to scale height by to fake a projection. float height_proj = 2.0f; - for (int y = 0; y < corpse_height; y++) - { - for (int x = 0; x < corpse_width; x++) + for (unsigned int y = 0; y < corpse_height; y++) + for (unsigned int x = 0; x < corpse_width; x++) { - int cy = corpse_cut_height(x, corpse_width, corpse_height); + unsigned int cy = _corpse_cut_height(x, corpse_width, + corpse_height); if (y > cy - cut_height && y <= cy) continue; @@ -220,29 +222,26 @@ void tile::corpsify(int corpse_width, int corpse_height, get_pixel(x,y) = mapped; flags(x, y) = true; } - } // Add some colour to the cut wound - for (int x = 0; x < corpse_width; x++) + for (unsigned int x = 0; x < corpse_width; x++) { - unsigned int cy = corpse_cut_height(x, corpse_width, corpse_height); - if (flags(x, cy-cut_height)) + unsigned int cy = _corpse_cut_height(x, corpse_width, corpse_height); + if (flags(x, cy - cut_height)) { unsigned int start = cy - cut_height + 1; - for (int y = start; y < start + wound_height; y++) - { + for (unsigned int y = start; y < start + wound_height; y++) get_pixel(x, y) = wound; - } } } // Add diagonal shadowing... - for (int y = 1; y < corpse_height; y++) + for (unsigned int y = 1; y < corpse_height; y++) { for (int x = 1; x < corpse_width; x++) { - if (!flags(x, y) && flags(x-1, y-1) && - get_pixel(x,y) == tile_colour::transparent) + if (!flags(x, y) && flags(x-1, y-1) + && get_pixel(x,y) == tile_colour::transparent) { get_pixel(x, y) = tile_colour::black; } @@ -250,24 +249,22 @@ void tile::corpsify(int corpse_width, int corpse_height, } // Extend shadow... - for (int y = 3; y < corpse_height; y++) - { - for (int x = 3; x < corpse_width; x++) + for (unsigned int y = 3; y < corpse_height; y++) + for (unsigned int x = 3; x < corpse_width; x++) { // Extend shadow if there are two real pixels along // the diagonal. Also, don't extend if the top or // left pixel is not filled in. This prevents lone // shadow pixels only connected via diagonals. - if (get_pixel(x-1,y-1) == tile_colour::black && - flags(x-2, y-2) && flags(x-3, y-3) && - get_pixel(x-1, y) == tile_colour::black && - get_pixel(x, y-1) == tile_colour::black) + if (get_pixel(x-1,y-1) == tile_colour::black + && flags(x-2, y-2) && flags(x-3, y-3) + && get_pixel(x-1, y) == tile_colour::black + && get_pixel(x, y-1) == tile_colour::black) { get_pixel(x, y) = tile_colour::black; } } - } delete[] flags; } diff --git a/crawl-ref/source/rltiles/tool/tile.h b/crawl-ref/source/rltiles/tool/tile.h index 782b7118da..26754992e0 100644 --- a/crawl-ref/source/rltiles/tool/tile.h +++ b/crawl-ref/source/rltiles/tool/tile.h @@ -17,12 +17,13 @@ public: void unload(); bool valid() const; - void resize(int new_width, int new_height); + void resize(unsigned int new_width, unsigned int new_height); void add_rim(const tile_colour &rim); void corpsify(); - void corpsify(int corpse_width, int corpse_height, - int cut_separate, int cut_height, const tile_colour &wound); + void corpsify(unsigned int corpse_width, unsigned int corpse_height, + unsigned int cut_separate, unsigned int cut_height, + const tile_colour &wound); void copy(const tile &img); bool compose(const tile &img); @@ -42,8 +43,8 @@ public: tile_colour &get_pixel(unsigned int x, unsigned int y); protected: - int m_width; - int m_height; + unsigned int m_width; + unsigned int m_height; std::string m_filename; std::string m_enumname; std::string m_parts_ctg; diff --git a/crawl-ref/source/rltiles/tool/tile_page.cc b/crawl-ref/source/rltiles/tool/tile_page.cc index 22e475348e..aac5115f7f 100644 --- a/crawl-ref/source/rltiles/tool/tile_page.cc +++ b/crawl-ref/source/rltiles/tool/tile_page.cc @@ -1,5 +1,6 @@ #include "tile_page.h" #include "tile_colour.h" +#include <stdio.h> #include <string.h> #include "tile.h" @@ -82,7 +83,7 @@ bool tile_page::place_images() m_texcoords.push_back(ycur); m_texcoords.push_back(xcur + tilew); m_texcoords.push_back(ycur + tileh); - + // Only add downwards, stretching out xmax as we go. xmax = std::max(xmax, xcur + (int)tilew); xcur = xmin; diff --git a/crawl-ref/source/rltiles/tool/tile_page.h b/crawl-ref/source/rltiles/tool/tile_page.h index 9f13651a1d..1fb6fb0511 100644 --- a/crawl-ref/source/rltiles/tool/tile_page.h +++ b/crawl-ref/source/rltiles/tool/tile_page.h @@ -18,8 +18,8 @@ public: std::vector<int> m_texcoords; std::vector<int> m_offsets; protected: - int m_width; - int m_height; + unsigned int m_width; + unsigned int m_height; }; #endif |