summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/debug.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-02 01:10:42 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-02 01:10:42 +0000
commit695043d0e495b29b0a7aa9e24acd93bdbf2e3e9f (patch)
tree2cb5e0ac7a399a90d678fad13f03a7f4262cd81d /crawl-ref/source/debug.cc
parentf861f518dc8853c8a6e28a9a8902b8cf3b85e2f3 (diff)
downloadcrawl-ref-695043d0e495b29b0a7aa9e24acd93bdbf2e3e9f.tar.gz
crawl-ref-695043d0e495b29b0a7aa9e24acd93bdbf2e3e9f.zip
Add new wizard targeting command 'm', to move monsters around (or to
move the player like wizard blink if there's no monster at the chosen square). Two monsters can be made to swap positions, and unseen monsters/squares can be targeted. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5423 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/debug.cc')
-rw-r--r--crawl-ref/source/debug.cc79
1 files changed, 79 insertions, 0 deletions
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index e2e369fd25..5d3a23f408 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -75,6 +75,7 @@
#include "monspeak.h"
#include "monstuff.h"
#include "mon-util.h"
+#include "mstuff2.h"
#include "mutation.h"
#include "newgame.h"
#include "ouch.h"
@@ -3796,6 +3797,84 @@ void wizard_give_monster_item(monsters *mon)
}
#endif
+#ifdef WIZARD
+
+static void _move_player(int x, int y)
+{
+ // no longer held in net
+ clear_trapping_net();
+
+ if (!you.can_pass_through_feat(grd[x][y]))
+ grd[x][y] = DNGN_FLOOR;
+ move_player_to_grid(x, y, false, true, true);
+}
+
+static void _move_monster(int x, int y, int mid1)
+{
+ dist moves;
+ direction(moves, DIR_NONE, TARG_ANY, -1, true, false,
+ "Move monster to where?");
+
+ if (!moves.isValid || !in_bounds(moves.tx, moves.ty))
+ return;
+
+ struct monsters* mon1 = &menv[mid1];
+ if (mons_is_caught(mon1))
+ mons_clear_trapping_net(mon1);
+
+ int mid2 = mgrd[moves.tx][moves.ty];
+ struct monsters* mon2 = NULL;
+
+ if (mid2 != NON_MONSTER)
+ {
+ mon2 = &menv[mid2];
+
+ if (mons_is_caught(mon2))
+ mons_clear_trapping_net(mon2);
+ }
+
+ mon1->x = moves.tx;
+ mon1->y = moves.ty;
+ mgrd[moves.tx][moves.ty] = mid1;
+ mon1->check_redraw(moves.target());
+
+ mgrd[x][y] = mid2;
+
+ if (mon2 != NULL)
+ {
+ mon2->x = x;
+ mon2->y = y;
+
+ mon1->check_redraw(coord_def(x, y));
+ }
+}
+
+void wizard_move_player_or_monster(int x, int y)
+{
+ crawl_state.cancel_cmd_again();
+ crawl_state.cancel_cmd_repeat();
+
+ static bool already_moving = false;
+
+ if (already_moving)
+ {
+ mpr("Already doing a move command.");
+ return;
+ }
+
+ already_moving = true;
+
+ int mid = mgrd[x][y];
+
+ if (mid == NON_MONSTER)
+ _move_player(x, y);
+ else
+ _move_monster(x, y, mid);
+
+ already_moving = false;
+}
+#endif
+
#ifdef DEBUG_DIAGNOSTICS
// Map statistics generation.