Attached Files |
0001-New-sub-command-in-map-mode-that-allows-to-annotate-.patch [^] (4,125 bytes) 2012-03-24 23:11 [Show Content] [Hide Content]From e68d9d2c0dd85bb792881783ad9c58406aea2b39 Mon Sep 17 00:00:00 2001
From: Policarpo Caballero <policarpocp@gmail.com>
Date: Sat, 24 Mar 2012 22:58:32 +0100
Subject: [PATCH] New sub-command in map mode, that allows to annotate levels.
Now is possible too levels while the player isn't on them. In map mode ('X'), pressing '!' will run this command.
---
crawl-ref/source/cmd-keys.h | 1 +
crawl-ref/source/cmd-name.h | 1 +
crawl-ref/source/dat/database/help.txt | 1 +
crawl-ref/source/dgn-overview.cc | 5 +++++
crawl-ref/source/dgn-overview.h | 1 +
crawl-ref/source/enum.h | 1 +
crawl-ref/source/viewmap.cc | 13 +++++++++++++
7 files changed, 23 insertions(+)
diff --git a/crawl-ref/source/cmd-keys.h b/crawl-ref/source/cmd-keys.h
index f51bf38..dc35fc3 100644
--- a/crawl-ref/source/cmd-keys.h
+++ b/crawl-ref/source/cmd-keys.h
@@ -326,6 +326,7 @@
{'S', CMD_MAP_GOTO_TARGET},
{',', CMD_MAP_GOTO_TARGET},
{';', CMD_MAP_GOTO_TARGET},
+{'!', CMD_MAP_ANNOTATE_LEVEL},
{ESCAPE, CMD_MAP_EXIT_MAP},
#ifdef CLUA_BINDINGS
{CONTROL('I'), CMD_AUTOFIGHT},
diff --git a/crawl-ref/source/cmd-name.h b/crawl-ref/source/cmd-name.h
index 73dff5d..d461746 100644
--- a/crawl-ref/source/cmd-name.h
+++ b/crawl-ref/source/cmd-name.h
@@ -157,6 +157,7 @@
{CMD_MAP_FIND_STASH, "CMD_MAP_FIND_STASH"},
{CMD_MAP_FIND_STASH_REVERSE, "CMD_MAP_FIND_STASH_REVERSE"},
{CMD_MAP_GOTO_TARGET, "CMD_MAP_GOTO_TARGET"},
+{CMD_MAP_ANNOTATE_LEVEL, "CMD_MAP_ANNOTATE_LEVEL"},
{CMD_MAP_WIZARD_TELEPORT, "CMD_MAP_WIZARD_TELEPORT"},
{CMD_MAP_HELP, "CMD_MAP_HELP"},
{CMD_MAP_FORGET, "CMD_MAP_FORGET"},
diff --git a/crawl-ref/source/dat/database/help.txt b/crawl-ref/source/dat/database/help.txt
index 2dd3e3d..1434cdf 100644
--- a/crawl-ref/source/dat/database/help.txt
+++ b/crawl-ref/source/dat/database/help.txt
@@ -122,6 +122,7 @@ level-map
<w>_</w> : Cycle through altars.
<h>Other</h>
+<w>!</w> : Annotate level
<w>Ctrl-C</w> : Clear item and monster memory.
<w>Ctrl-F</w> : Forget level map.{{
if you.wizard() then
diff --git a/crawl-ref/source/dgn-overview.cc b/crawl-ref/source/dgn-overview.cc
index b602295..e9cbb56 100644
--- a/crawl-ref/source/dgn-overview.cc
+++ b/crawl-ref/source/dgn-overview.cc
@@ -1035,6 +1035,11 @@ void annotate_level()
li = li2;
}
+ do_annotate(li);
+}
+
+void do_annotate(level_id& li)
+{
if (!get_level_annotation(li).empty())
{
mpr("Current level annotation: " +
diff --git a/crawl-ref/source/dgn-overview.h b/crawl-ref/source/dgn-overview.h
index bd68b97..eaee4aa 100644
--- a/crawl-ref/source/dgn-overview.h
+++ b/crawl-ref/source/dgn-overview.h
@@ -39,6 +39,7 @@ bool level_annotation_has(std::string str,
level_id li = level_id::current());
void annotate_level();
+void do_annotate(level_id& li);
class writer;
class reader;
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index b197852..67184e5 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -762,6 +762,7 @@ enum command_type
CMD_MAP_FIND_STASH_REVERSE,
CMD_MAP_GOTO_TARGET,
+ CMD_MAP_ANNOTATE_LEVEL,
CMD_MAP_WIZARD_TELEPORT,
diff --git a/crawl-ref/source/viewmap.cc b/crawl-ref/source/viewmap.cc
index 32f81a8..3f6c426 100644
--- a/crawl-ref/source/viewmap.cc
+++ b/crawl-ref/source/viewmap.cc
@@ -15,6 +15,7 @@
#include "command.h"
#include "coord.h"
#include "coordit.h"
+#include "dgn-overview.h"
#include "env.h"
#include "map_knowledge.h"
#include "fprop.h"
@@ -1200,6 +1201,18 @@ bool show_map(level_pos &lpos,
break;
}
}
+ case CMD_MAP_ANNOTATE_LEVEL:
+ {
+ if (lpos.id.level_type != LEVEL_DUNGEON)
+ {
+ mpr("You can't annotate this level.");
+ }
+ else
+ {
+ do_annotate(lpos.id);
+ }
+ break;
+ }
#ifdef WIZARD
case CMD_MAP_WIZARD_TELEPORT:
--
1.7.9.4
0001-Several-improvements-to-CMD_MAP_ANNOTATE_LEVEL.patch [^] (2,576 bytes) 2012-03-25 21:45 [Show Content] [Hide Content]From 337319d6e885f9ec86301457cef0a7a6d0da7dba Mon Sep 17 00:00:00 2001
From: Policarpo Caballero <policarpocp@gmail.com>
Date: Sun, 25 Mar 2012 21:31:28 +0200
Subject: [PATCH] Several improvements to CMD_MAP_ANNOTATE_LEVEL.
- The message window doesn't appear in the middle of the map. Now,
the game sitches to the normal-mode, then returns to map-mode.
- The message "You can't annotate this level." can be seen.
- The description in dat/database/help.txt has been corrected.
- The command appears in docs/keybind.txt.
---
crawl-ref/docs/keybind.txt | 1 +
crawl-ref/source/dat/database/help.txt | 2 +-
crawl-ref/source/viewmap.cc | 9 +++++++++
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/crawl-ref/docs/keybind.txt b/crawl-ref/docs/keybind.txt
index 8a6a4ba..4574764 100644
--- a/crawl-ref/docs/keybind.txt
+++ b/crawl-ref/docs/keybind.txt
@@ -180,6 +180,7 @@ e CMD_MAP_EXCLUDE_AREA (cycle through radii and toggle off/on)
+ CMD_MAP_SCROLL_DOWN
- CMD_MAP_SCROLL_UP
., \r, ; CMD_MAP_GOTO_TARGET
+! CMD_MAP_ANNOTATE_LEVEL
ESCAPE CMD_MAP_EXIT_MAP
Move cursor one step in a given direction
diff --git a/crawl-ref/source/dat/database/help.txt b/crawl-ref/source/dat/database/help.txt
index 1434cdf..8f0a571 100644
--- a/crawl-ref/source/dat/database/help.txt
+++ b/crawl-ref/source/dat/database/help.txt
@@ -122,7 +122,7 @@ level-map
<w>_</w> : Cycle through altars.
<h>Other</h>
-<w>!</w> : Annotate level
+<w>!</w> : Annotate level.
<w>Ctrl-C</w> : Clear item and monster memory.
<w>Ctrl-F</w> : Forget level map.{{
if you.wizard() then
diff --git a/crawl-ref/source/viewmap.cc b/crawl-ref/source/viewmap.cc
index 46ac3f7..cb52591 100644
--- a/crawl-ref/source/viewmap.cc
+++ b/crawl-ref/source/viewmap.cc
@@ -18,6 +18,7 @@
#include "dgn-overview.h"
#include "env.h"
#include "map_knowledge.h"
+#include "message.h"
#include "fprop.h"
#include "exclude.h"
#include "feature.h"
@@ -1197,11 +1198,19 @@ bool show_map(level_pos &lpos,
break;
case CMD_MAP_ANNOTATE_LEVEL:
+ le.go_to(original);
+ redraw_screen();
+ le.go_to(lpos.id);
+
if (lpos.id.level_type != LEVEL_DUNGEON)
+ {
mpr("You can't annotate this level.");
+ more();
+ }
else
do_annotate(lpos.id);
+ redraw_map = true;
break;
#ifdef WIZARD
--
1.7.9.4
|