From 81bf3bb8e013301d4d0b2d4b00f069b82b8db536 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Wed, 6 Dec 2006 12:44:53 +0000 Subject: 'C' creates monsters on a targeted square in wizmode. 'D' kill-resets targeted monsters. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@582 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/debug.cc | 12 +++++++++--- crawl-ref/source/debug.h | 2 +- crawl-ref/source/delay.cc | 33 +++++++++++++++++++++------------ crawl-ref/source/direct.cc | 34 ++++++++++++++++++++++++++++++++++ crawl-ref/source/monplace.cc | 9 ++++++++- crawl-ref/source/monplace.h | 3 ++- 6 files changed, 75 insertions(+), 18 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index 4bf1be657e..7db5242383 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -601,7 +601,7 @@ void create_spec_monster(void) // //--------------------------------------------------------------- #ifdef WIZARD -void create_spec_monster_name(void) +void create_spec_monster_name(int x, int y) { int mon = debug_prompt_for_monster(); @@ -614,8 +614,14 @@ void create_spec_monster_name(void) } else { - create_monster(mon, 0, BEH_SLEEP, - you.x_pos, you.y_pos, MHITNOT, 250, false); + const bool force_place = x != -1 && y != -1; + if (x == -1) + x = you.x_pos; + if (y == -1) + y = you.y_pos; + + create_monster(mon, 0, BEH_SLEEP, x, y, + MHITNOT, 250, false, force_place); } } // end create_spec_monster_name() #endif diff --git a/crawl-ref/source/debug.h b/crawl-ref/source/debug.h index 922d4c3a7d..f9516020a9 100644 --- a/crawl-ref/source/debug.h +++ b/crawl-ref/source/debug.h @@ -91,7 +91,7 @@ void create_spec_monster(void); /* *********************************************************************** * called from: acr * *********************************************************************** */ -void create_spec_monster_name(void); +void create_spec_monster_name(int x = -1, int y = -1); // last updated 12may2000 {dlb} diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc index 13d2968ee6..329067ea34 100644 --- a/crawl-ref/source/delay.cc +++ b/crawl-ref/source/delay.cc @@ -887,6 +887,25 @@ static bool should_stop_activity(const delay_queue_item &item, (Options.activity_interrupts[item.type][ai])); } +inline static void monster_warning(activity_interrupt_type ai, + const activity_interrupt_data &at, + int atype) +{ + if ( ai == AI_SEE_MONSTER && is_run_delay(atype) ) + { + const monsters* mon = static_cast(at.data); +#ifndef DEBUG_DIAGNOSTICS + mprf(MSGCH_WARN, "%s comes into view.", ptr_monam(mon, DESC_CAP_A)); +#else + mprf(MSGCH_WARN, + "%s in view: (%d,%d), see_grid: %s", + ptr_monam(mon, DESC_PLAIN), + mon->x, mon->y, + see_grid(mon->x, mon->y)? "yes" : "no"); +#endif + } +} + void interrupt_activity( activity_interrupt_type ai, const activity_interrupt_data &at ) { @@ -899,12 +918,7 @@ void interrupt_activity( activity_interrupt_type ai, if (should_stop_activity(item, ai, at)) { - if ( ai == AI_SEE_MONSTER && is_run_delay(item.type) ) - { - const monsters* mon = static_cast(at.data); - mprf(MSGCH_WARN, "%s comes into view.", - ptr_monam(mon, DESC_CAP_A)); - } + monster_warning(ai, at, item.type); stop_delay(); return; } @@ -924,12 +938,7 @@ void interrupt_activity( activity_interrupt_type ai, { if (is_run_delay( you.delay_queue[j].type )) { - if ( ai == AI_SEE_MONSTER ) - { - const monsters* mon = static_cast(at.data); - mprf(MSGCH_WARN, "%s comes into view.", - ptr_monam(mon, DESC_CAP_A)); - } + monster_warning(ai, at, you.delay_queue[j].type); stop_delay(); return; } diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc index 247632b56a..43422bc458 100644 --- a/crawl-ref/source/direct.cc +++ b/crawl-ref/source/direct.cc @@ -486,6 +486,36 @@ void look_around(struct dist &moves, bool justLooking, int first_move, int mode) switch (keyin) { #ifdef WIZARD + case 'C': + targChosen = true; + mx = you.x_pos + cx - VIEW_CX; + my = you.y_pos + cy - VIEW_CY; + if (!in_bounds(mx, my)) + break; + if (mgrd[mx][my] != NON_MONSTER) + { + mprf("%s won't like that.", + ptr_monam(&menv[mgrd[mx][my]], DESC_CAP_A)); + break; + } + create_spec_monster_name(mx, my); + viewwindow(true, false); + break; + + case 'D': + targChosen = true; + mx = you.x_pos + cx - VIEW_CX; + my = you.y_pos + cy - VIEW_CY; + if (!in_bounds(mx, my)) + break; + mid = mgrd[mx][my]; + + if (mid == NON_MONSTER) + break; + monster_die(&menv[mid], KILL_RESET, 0); + viewwindow(true, false); + break; + case 'F': targChosen = true; mx = you.x_pos + cx - VIEW_CX; @@ -1558,5 +1588,9 @@ static void describe_cell(int mx, int my) } std::string feature_desc = feature_description(mx, my); +#ifdef DEBUG_DIAGNOSTICS + mprf("(%d,%d): %s", mx, my, feature_desc.c_str()); +#else mpr(feature_desc.c_str()); +#endif } diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc index 65cea78bb2..1a601fb7c1 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -1295,10 +1295,17 @@ coord_def find_newmons_square(int mons_class, int x, int y) } int create_monster( int cls, int dur, int beha, int cr_x, int cr_y, - int hitting, int zsec, bool permit_bands ) + int hitting, int zsec, bool permit_bands, + bool force_place ) { int summd = -1; coord_def pos = find_newmons_square(cls, cr_x, cr_y); + if (force_place && !grid_is_solid(grd[cr_x][cr_y]) + && mgrd[cr_x][cr_y] == NON_MONSTER) + { + pos.x = cr_x; + pos.y = cr_y; + } if (pos.x != -1 && pos.y != -1) { diff --git a/crawl-ref/source/monplace.h b/crawl-ref/source/monplace.h index 5dfb00e4b7..2bc26d5398 100644 --- a/crawl-ref/source/monplace.h +++ b/crawl-ref/source/monplace.h @@ -49,7 +49,8 @@ int mons_place( int mon_type, char behaviour, int target, bool summoned, * spells2 - spells3 - spells4 * *********************************************************************** */ int create_monster( int cls, int dur, int beha, int cr_x, int cr_y, - int hitting, int zsec, bool permit_bands = false ); + int hitting, int zsec, bool permit_bands = false, + bool force_place = false ); // last updated 12may2000 {dlb} -- cgit v1.2.3-54-g00ecf