summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-21 14:07:52 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-21 14:07:52 +0000
commitd882d2b68da1c133faa3e9be92e1435a60d4009a (patch)
tree40f68468ec0742d339cbb985fc4bdb990b3db9d0
parentcbb457d13f09655c81aa5a0e942fbb34f4a76712 (diff)
downloadcrawl-ref-d882d2b68da1c133faa3e9be92e1435a60d4009a.tar.gz
crawl-ref-d882d2b68da1c133faa3e9be92e1435a60d4009a.zip
Add tile options to configure minimap colours.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3314 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/docs/crawl_options.txt48
-rw-r--r--crawl-ref/init.txt17
-rw-r--r--crawl-ref/source/externs.h17
-rw-r--r--crawl-ref/source/initfile.cc137
-rw-r--r--crawl-ref/source/libgui.cc78
5 files changed, 274 insertions, 23 deletions
diff --git a/crawl-ref/docs/crawl_options.txt b/crawl-ref/docs/crawl_options.txt
index 9ec85e28ca..f6db0d72d0 100644
--- a/crawl-ref/docs/crawl_options.txt
+++ b/crawl-ref/docs/crawl_options.txt
@@ -71,7 +71,12 @@ The contents of this text are:
4-n Macro related Options.
flush.failure, flush.command, flush.message
4-o Tiles Options.
- show_items
+ show_items, title_screen, tile_player_col,
+ tile_monster_col, tile_friendly_col, tile_item_col,
+ tile_unseen_col, tile_floor_col, tile_wall_col,
+ tile_mapped_wall_col, tile_door_col, tile_downstairs_col,
+ tile_upstairs_col, tile_spec_feature_col, tile_trap_col,
+ tile_water_col, tile_lava_col, tile_excluded_col
5- Character Dump.
5-a Items and Kills.
kill_map, dump_kill_places, dump_item_origins,
@@ -1230,6 +1235,8 @@ flush.message = false
4-o Tiles Options
---------------------
+In non-tile games the tile options are ignored.
+
show_items = <glyphs>
This option controls the order and presence of items in the tiles
inventory. By default, its value is !?/%=([)X}+\_. The underscore
@@ -1239,6 +1246,45 @@ title_screen = true
When this is set to true, the graphical title screen will be
displayed.
+tile_player_col = white
+tile_monster_col = red
+tile_friendly_col = lightred
+tile_item_col = green
+tile_unseen_col = black
+tile_floor_col = lightgrey
+tile_wall_col = darkgrey
+tile_mapped_wall_col = blue
+tile_door_col = brown
+tile_downstairs_col = magenta
+tile_upstairs_col = blue
+tile_feature_col = cyan
+tile_trap_col = yellow
+tile_water_col = grey
+tile_lava_col = grey
+tile_excluded_col = darkcyan
+
+ These options allow configuring the colours used for the minimap of
+ the dungeon level.
+ tile_player_col - colour of player position, as well as of
+ map centre during level map mode ('X')
+ tile_monster_col - colour of hostile monsters
+ tile_friendly_col - colour of friendly monsters
+ tile_item_col - colour of known or detected items
+ tile_unseen_col - colour of unseen areas (usually stone)
+ tile_wall_col - colour of any wall type
+ tile_mapped_wall_col - colour of walls detected via magic mapping
+ tile_door_col - colour of known doors, open or closed
+ tile_downstairs_col - colour of downstairs, including branch stairs
+ tile_upstairs_col - colour of upstairs, including branch stairs
+ tile_feature_col - colour of any non-stair feature
+ (altar, shop, portal, fountain, ...)
+ tile_trap_col - colour of known traps of any type
+ tile_water_col - colour of both shallow and deep water
+ tile_lava_col - colour of lava
+ tile_excluded_col - colour of squares excluded for autotravel
+ (will only override tile_floor_col colour)
+
+
5- Character Dump.
===================
diff --git a/crawl-ref/init.txt b/crawl-ref/init.txt
index c1ab4c6481..82ed0db105 100644
--- a/crawl-ref/init.txt
+++ b/crawl-ref/init.txt
@@ -239,6 +239,23 @@ message_colour = yellow:fails to return
show_items = !?/%=([)X}+\_.
# title_screen = false
+# tile_player_col = white
+# tile_monster_col = red
+# tile_friendly_col = lightred
+# tile_item_col = green
+# tile_unseen_col = black
+# tile_floor_col = lightgrey
+# tile_wall_col = darkgrey
+# tile_mapped_wall_col = blue
+# tile_door_col = brown
+# tile_downstairs_col = magenta
+# tile_upstairs_col = blue
+# tile_feature_col = cyan
+# tile_trap_col = yellow
+# tile_water_col = grey
+# tile_lava_col = grey
+# tile_excluded_col = darkcyan
+
##### 5- Dump File #################################################
#
##### 5-a Items and Kill List ###################
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 42faecea03..8e88d1e462 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -1748,6 +1748,23 @@ public:
#ifdef USE_TILE
char show_items[20];
bool title_screen;
+ // minimap colours
+ char tile_player_col;
+ char tile_monster_col;
+ char tile_friendly_col;
+ char tile_item_col;
+ char tile_unseen_col;
+ char tile_floor_col;
+ char tile_wall_col;
+ char tile_mapped_wall_col;
+ char tile_door_col;
+ char tile_downstairs_col;
+ char tile_upstairs_col;
+ char tile_feature_col;
+ char tile_trap_col;
+ char tile_water_col;
+ char tile_lava_col;
+ char tile_excluded_col;
#endif
#ifdef WIN32TILES
bool use_dos_char;
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index 587a89ba4b..552bec13fd 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -29,6 +29,9 @@
#include "Kills.h"
#include "files.h"
#include "defines.h"
+#ifdef USE_TILE
+ #include "guic.h"
+#endif
#include "invent.h"
#include "item_use.h"
#include "itemprop.h"
@@ -72,6 +75,41 @@ god_type str_to_god(std::string god)
return (GOD_NO_GOD);
}
+#ifdef USE_TILE
+const std::string tile_cols[24] =
+{
+ "black", "darkgrey", "grey", "lightgrey", "white",
+ "blue", "lightblue", "darkblue",
+ "green", "lightgreen", "darkgreen",
+ "cyan", "lightcyan", "darkcyan",
+ "red", "lightred", "darkred",
+ "magenta", "lightmagenta", "darkmagenta",
+ "yellow", "lightyellow", "darkyellow", "brown"
+};
+
+static unsigned int str_to_tile_colour(std::string colour)
+{
+ if (colour.empty())
+ return (0);
+
+ lowercase(colour);
+
+ if (colour == "darkgray")
+ colour = "darkgrey";
+ else if (colour == "gray")
+ colour = "grey";
+ else if (colour == "lightgray")
+ colour = "lightgrey";
+
+ for (unsigned int i=0; i<24; i++)
+ {
+ if (tile_cols[i] == colour)
+ return (i);
+ }
+ return (0);
+}
+#endif
+
const std::string cols[16] =
{
"black", "blue", "green", "cyan", "red", "magenta", "brown",
@@ -749,7 +787,24 @@ void game_options::reset_options()
#ifdef USE_TILE
show_items[0] = '0';
- title_screen = true;
+ title_screen = true;
+ // minimap colours
+ tile_player_col = MAP_WHITE;
+ tile_monster_col = MAP_RED;
+ tile_friendly_col = MAP_LTRED;
+ tile_item_col = MAP_GREEN;
+ tile_unseen_col = MAP_BLACK;
+ tile_floor_col = MAP_LTGREY;
+ tile_wall_col = MAP_DKGREY;
+ tile_mapped_wall_col = MAP_BLUE;
+ tile_door_col = MAP_BROWN;
+ tile_downstairs_col = MAP_MAGENTA;
+ tile_upstairs_col = MAP_BLUE;
+ tile_feature_col = MAP_CYAN;
+ tile_trap_col = MAP_YELLOW;
+ tile_water_col = MAP_MDGREY;
+ tile_lava_col = MAP_MDGREY;
+ tile_excluded_col = MAP_DKCYAN;
#endif
#ifdef WIN32TILES
@@ -2628,6 +2683,86 @@ void game_options::read_option_line(const std::string &str, bool runscript)
{
title_screen = read_bool(field, title_screen);
}
+ else if (key == "tile_player_col")
+ {
+ tile_player_col =
+ str_to_tile_colour(field);
+ }
+ else if (key == "tile_monster_col")
+ {
+ tile_monster_col =
+ str_to_tile_colour(field);
+ }
+ else if (key == "tile_friendly_col")
+ {
+ tile_friendly_col =
+ str_to_tile_colour(field);
+ }
+ else if (key == "tile_item_col")
+ {
+ tile_item_col =
+ str_to_tile_colour(field);
+ }
+ else if (key == "tile_unseen_col")
+ {
+ tile_unseen_col =
+ str_to_tile_colour(field);
+ }
+ else if (key == "tile_floor_col")
+ {
+ tile_floor_col =
+ str_to_tile_colour(field);
+ }
+ else if (key == "tile_wall_col")
+ {
+ tile_wall_col =
+ str_to_tile_colour(field);
+ }
+ else if (key == "tile_mapped_wall_col")
+ {
+ tile_mapped_wall_col =
+ str_to_tile_colour(field);
+ }
+ else if (key == "tile_door_col")
+ {
+ tile_door_col =
+ str_to_tile_colour(field);
+ }
+ else if (key == "tile_downstairs_col")
+ {
+ tile_downstairs_col =
+ str_to_tile_colour(field);
+ }
+ else if (key == "tile_upstairs_col")
+ {
+ tile_upstairs_col =
+ str_to_tile_colour(field);
+ }
+ else if (key == "tile_feature_col")
+ {
+ tile_feature_col =
+ str_to_tile_colour(field);
+ }
+ else if (key == "tile_trap_col")
+ {
+ tile_trap_col =
+ str_to_tile_colour(field);
+ }
+ else if (key == "tile_water_col")
+ {
+ tile_water_col =
+ str_to_tile_colour(field);
+ }
+ else if (key == "tile_lava_col")
+ {
+ tile_lava_col =
+ str_to_tile_colour(field);
+ }
+ else if (key == "tile_excluded_col")
+ {
+ tile_excluded_col =
+ str_to_tile_colour(field);
+ }
#endif
#ifdef WIN32TILES
diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc
index 7291d4db16..bf0b31b6c1 100644
--- a/crawl-ref/source/libgui.cc
+++ b/crawl-ref/source/libgui.cc
@@ -186,20 +186,55 @@ static int gmap_min_y, gmap_max_y;
static int gmap_ox, gmap_oy;
// redefine color constants with shorter name to save space
-#define PX_0 MAP_BLACK //unseen
-#define PX_F MAP_LTGREY //floor
-#define PX_W MAP_DKGREY //walls
-#define PX_D MAP_BROWN //doors
-#define PX_WB MAP_LTBLUE //blue wall
-#define PX_I MAP_GREEN //items
-#define PX_M MAP_RED //monsters
-#define PX_US MAP_BLUE //upstair
-#define PX_DS MAP_MAGENTA //downstair
-#define PX_SS MAP_CYAN //special stair
-#define PX_WT MAP_MDGREY //water
-#define PX_LV MAP_MDGREY //lava
-#define PX_T MAP_YELLOW //trap
-#define PX_MS MAP_CYAN //misc
+#define PX_0 0
+#define PX_F 1
+#define PX_W 2
+#define PX_D 3
+#define PX_WB 4
+#define PX_I 5
+#define PX_M 6
+#define PX_US 7
+#define PX_DS 8
+#define PX_SS 9
+#define PX_WT 10
+#define PX_LV 11
+#define PX_T 12
+#define PX_MS 13
+
+static char gmap_to_colour(char gm)
+{
+ switch(gm)
+ {
+ case PX_0: // unseen
+ default:
+ return Options.tile_unseen_col;
+ case PX_F: // floor
+ return Options.tile_floor_col;
+ case PX_W: // walls
+ return Options.tile_wall_col;
+ case PX_WB: // walls detected by Magic Mapping
+ return Options.tile_mapped_wall_col;
+ case PX_D: // doors
+ return Options.tile_door_col;
+ case PX_I: // items
+ return Options.tile_item_col;
+ case PX_M: // (hostile) monsters
+ return Options.tile_monster_col;
+ case PX_US: // upstairs
+ return Options.tile_upstairs_col;
+ case PX_DS: // downstairs
+ return Options.tile_downstairs_col;
+ case PX_MS: // misc. features (altars, portals, fountains, ...)
+ case PX_SS: // special stairs (?)
+ return Options.tile_feature_col;
+ case PX_WT: // water
+ return Options.tile_water_col;
+ case PX_LV: // lava
+ return Options.tile_lava_col;
+ case PX_T: // traps
+ return Options.tile_trap_col;
+ }
+}
static const char gmap_col[256] = {
/* 0x00 */ PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, PX_0, PX_0,
@@ -320,11 +355,11 @@ void GmapUpdate(int x, int y, int what, bool upd_tile)
int c;
if (x == you.x_pos && y == you.y_pos)
- c = MAP_WHITE; // player position always in white
+ c = Options.tile_player_col; // player position always in white
else if (mgrd[x][y] != NON_MONSTER && mons_friendly(&menv[mgrd[x][y]])
&& upd_tile)
{
- c = MAP_LTRED; // friendly monsters subtly different from hostiles
+ c = Options.tile_friendly_col; // friendly monsters subtly different from hostiles
}
else
{
@@ -340,15 +375,15 @@ void GmapUpdate(int x, int y, int what, bool upd_tile)
// In some cases (like smoke), update the gmap with the ground color
// instead. This keeps it prettier in the case of lava + smoke.
case '#':
- c = gmap_col[grid_symbol & 0xff];
+ c = gmap_to_colour(gmap_col[grid_symbol & 0xff]);
break;
default:
- c = gmap_col[what & 0xff];
+ c = gmap_to_colour(gmap_col[what & 0xff]);
break;
}
- if ((c == MAP_LTGREY || c == MAP_BROWN) && is_excluded( coord_def(x,y) ))
- c = MAP_DKCYAN;
+ if (c == Options.tile_floor_col && is_excluded( coord_def(x,y) ))
+ c = Options.tile_excluded_col;
}
int oldc = gmap_data[x][y];
@@ -441,7 +476,8 @@ void GmapDisplay(int linex, int liney)
{
ox += linex - gmap_min_x;
oy += liney - gmap_min_y;
- buf2[ ox + oy * GXM] = MAP_WHITE; // highlight centre of the map
+ // highlight centre of the map
+ buf2[ ox + oy * GXM] = Options.tile_player_col;
}
region_map->flag = true;