comparison arogue5/move.c @ 63:0ed67132cf10

Import Advanced Rogue 5.8 from the Roguelike Restoration Project (r1490)
author elwin
date Thu, 09 Aug 2012 22:58:48 +0000
parents
children a0a57cf42810
comparison
equal deleted inserted replaced
62:0ef99244acb8 63:0ed67132cf10
1 /*
2 * Hero movement commands
3 *
4 * Advanced Rogue
5 * Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka and AT&T
6 * All rights reserved.
7 *
8 * Based on "Super-Rogue"
9 * Copyright (C) 1984 Robert D. Kindelberger
10 * All rights reserved.
11 *
12 * Based on "Rogue: Exploring the Dungeons of Doom"
13 * Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
14 * All rights reserved.
15 *
16 * See the file LICENSE.TXT for full copyright and licensing information.
17 */
18
19 #include "curses.h"
20 #include <ctype.h>
21 #include "rogue.h"
22
23 /*
24 * Used to hold the new hero position
25 */
26
27 static coord nh;
28
29 static const char Moves[3][3] = {
30 { 'y', 'k', 'u' },
31 { 'h', '\0', 'l' },
32 { 'b', 'j', 'n' }
33 };
34
35 /*
36 * be_trapped:
37 * The guy stepped on a trap.... Make him pay.
38 */
39
40 be_trapped(th, tc)
41 register struct thing *th;
42 register coord *tc;
43 {
44 register struct trap *tp;
45 register char ch;
46 register const char *mname = NULL;
47 register bool is_player = (th == &player),
48 can_see;
49 register struct linked_list *mitem = NULL;
50
51
52 /* Can the player see the creature? */
53 can_see = (cansee(tc->y, tc->x) && (is_player || !invisible(th)));
54
55 tp = trap_at(tc->y, tc->x);
56 /*
57 * if he's wearing boots of elvenkind, he won't set off the trap
58 * unless its a magic pool (they're not really traps)
59 */
60 if (is_player &&
61 cur_misc[WEAR_BOOTS] != NULL &&
62 cur_misc[WEAR_BOOTS]->o_which == MM_ELF_BOOTS &&
63 tp->tr_type != POOL)
64 return '\0';
65
66 /*
67 * if the creature is flying then it won't set off the trap
68 */
69 if (on(*th, ISFLY))
70 return '\0';
71
72 tp->tr_flags |= ISFOUND;
73
74 if (!is_player) {
75 mitem = find_mons(th->t_pos.y, th->t_pos.x);
76 mname = monsters[th->t_index].m_name;