annotate xrogue/command.c @ 133:e6179860cb76

Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
author John "Elwin" Edwards
date Tue, 21 Apr 2015 08:55:20 -0400
parents
children ce0cf824c192
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
133
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
2 command.c - Read and execute the user commands
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
3
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
4 XRogue: Expeditions into the Dungeons of Doom
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
5 Copyright (C) 1991 Robert Pietkivitch
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
6 All rights reserved.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
7
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
8 Based on "Advanced Rogue"
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
9 Copyright (C) 1984, 1985 Michael Morgan, Ken Dalka and AT&T
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
10 All rights reserved.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
11
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
12 Based on "Rogue: Exploring the Dungeons of Doom"
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
13 Copyright (C) 1980, 1981 Michael Toy, Ken Arnold and Glenn Wichman
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
14 All rights reserved.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
15
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
16 See the file LICENSE.TXT for full copyright and licensing information.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
17 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
18
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
19 #include <curses.h>
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
20 #include <ctype.h>
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
21 #include <signal.h>
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
22 #include "mach_dep.h"
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
23 #include "rogue.h"
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
24
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
25 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
26 * command:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
27 * Process the user commands
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
28 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
29
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
30 command()
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
31 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
32 unsigned int ch;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
33 struct linked_list *item;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
34 unsigned int countch = 0, direction = 0, newcount = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
35 int segment = 1;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
36 int monst_limit, monst_current;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
37
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
38 monst_limit = monst_current = 1;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
39 while (playing) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
40 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
41 * Let the daemons start up, but only do them once a round
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
42 * (round = 10 segments).
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
43 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
44 if (segment >= 10) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
45 do_daemons(BEFORE);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
46 do_fuses(BEFORE);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
47 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
48
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
49 after = TRUE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
50 do {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
51 /* One more tick of the clock. */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
52 if (segment >= 10 && after && (++turns % DAYLENGTH) == 0) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
53 daytime ^= TRUE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
54 if (levtype == OUTSIDE) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
55 if (daytime) msg("A bright star flares above the horizon.");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
56 else msg("The bright star travels beyond the horizon.");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
57 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
58 light(&hero);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
59 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
60
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
61 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
62 * Don't bother with these updates unless the player's going
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
63 * to do something.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
64 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
65 if (player.t_action == A_NIL && player.t_no_move <= 1) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
66 look(after, FALSE);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
67 lastscore = purse;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
68 wmove(cw, hero.y, hero.x);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
69 if (!((running || count) && jump)) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
70 status(FALSE);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
71 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
72 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
73
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
74 /* Draw the screen */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
75 if (!((running || count) && jump)) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
76 wmove(cw, hero.y, hero.x);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
77 draw(cw);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
78 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
79
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
80 after = TRUE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
81
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
82 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
83 * Read command or continue run
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
84 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
85 if (--player.t_no_move <= 0) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
86 take = 0; /* Nothing here to start with */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
87 player.t_no_move = 0; /* Be sure we don't go too negative */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
88 if (!running) door_stop = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
89
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
90 /* Was the player being held? */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
91 if (player.t_action == A_FREEZE) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
92 player.t_action = A_NIL;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
93 msg("You can move again.");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
94 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
95
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
96 if (player.t_action != A_NIL) ch = player.t_action;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
97 else if (running) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
98 char scratch;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
99
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
100 /* If in a corridor or maze, if we are at a turn with
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
101 * only one way to go, turn that way.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
102 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
103 scratch = winat(hero.y, hero.x);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
104 if ((scratch==PASSAGE||scratch==DOOR||levtype==MAZELEV) &&
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
105 off(player, ISHUH) &&
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
106 off(player, ISBLIND)) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
107 int y, x;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
108 if (getdelta(runch, &y, &x) == TRUE) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
109 corr_move(y, x);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
110 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
111 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
112 ch = runch;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
113 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
114 else if (count) ch = countch;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
115 else {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
116 ch = wgetch(cw);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
117 if (mpos != 0 && !running) /* Erase message if its there */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
118 msg("");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
119 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
120
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
121 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
122 * check for prefixes
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
123 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
124 if (isascii(ch) && isdigit(ch))
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
125 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
126 count = 0;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
127 newcount = TRUE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
128 while (isascii(ch) && isdigit(ch))
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
129 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
130 count = count * 10 + (ch - '0');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
131 ch = wgetch(cw);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
132 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
133 countch = ch;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
134 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
135 * turn off count for commands which don't make sense
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
136 * to repeat
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
137 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
138 switch (ch) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
139 case 'h': case 'j': case 'k': case 'l':
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
140 case 'y': case 'u': case 'b': case 'n':
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
141 case 'H': case 'J': case 'K': case 'L':
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
142 case 'Y': case 'U': case 'B': case 'N':
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
143 case C_SEARCH: case '.':
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
144 break;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
145 default:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
146 count = 0;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
147 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
148 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
149
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
150 /* Save current direction */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
151 if (!running) { /* If running, it is already saved */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
152 switch (ch) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
153 case 'h': case 'j': case 'k': case 'l':
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
154 case 'y': case 'u': case 'b': case 'n':
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
155 case 'H': case 'J': case 'K': case 'L':
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
156 case 'Y': case 'U': case 'B': case 'N':
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
157 runch = tolower(ch);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
158 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
159 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
160
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
161 /* Perform the action */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
162 switch (ch) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
163 case 'f':
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
164 if (!on(player, ISBLIND))
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
165 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
166 door_stop = TRUE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
167 firstmove = TRUE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
168 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
169 if (count && !newcount)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
170 ch = direction;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
171 else
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
172 ch = wgetch(cw);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
173 switch (ch)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
174 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
175 case 'h': case 'j': case 'k': case 'l':
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
176 case 'y': case 'u': case 'b': case 'n':
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
177 ch = toupper(ch);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
178 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
179 direction = ch;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
180 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
181 newcount = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
182
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
183 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
184 * execute a command
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
185 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
186 if (count && !running)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
187 count--;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
188
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
189 switch (ch) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
190 case '!' : shell();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
191 case KEY_LEFT : do_move(0, -1);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
192 when KEY_DOWN : do_move(1, 0);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
193 when KEY_UP : do_move(-1, 0);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
194 when KEY_RIGHT : do_move(0, 1);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
195 when KEY_HOME : do_move(-1, -1);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
196 when KEY_A1 : do_move(-1, -1);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
197 when KEY_PPAGE : do_move(-1, 1);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
198 when KEY_A3 : do_move(-1, 1);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
199 when KEY_END : do_move(1, -1);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
200 when KEY_C1 : do_move(1, -1);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
201 when KEY_NPAGE : do_move(1, 1);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
202 when KEY_C3 : do_move(1, 1);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
203 #ifdef CTL_RIGHT
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
204 when CTL_RIGHT : do_run('l');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
205 when CTL_LEFT : do_run('h');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
206 when CTL_UP : do_run('k');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
207 when CTL_DOWN : do_run('j');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
208 when CTL_HOME : do_run('y');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
209 when CTL_PGUP : do_run('u');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
210 when CTL_END : do_run('b');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
211 when CTL_PGDN : do_run('n');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
212 #endif
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
213 when 'h' : do_move(0, -1);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
214 when 'j' : do_move(1, 0);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
215 when 'k' : do_move(-1, 0);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
216 when 'l' : do_move(0, 1);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
217 when 'y' : do_move(-1, -1);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
218 when 'u' : do_move(-1, 1);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
219 when 'b' : do_move(1, -1);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
220 when 'n' : do_move(1, 1);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
221 when 'H' : do_run('h');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
222 when 'J' : do_run('j');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
223 when 'K' : do_run('k');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
224 when 'L' : do_run('l');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
225 when 'Y' : do_run('y');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
226 when 'U' : do_run('u');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
227 when 'B' : do_run('b');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
228 when 'N' : do_run('n');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
229 when A_ATTACK:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
230 /* Is our attackee still there? */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
231 if (isalpha(winat(player.t_newpos.y,
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
232 player.t_newpos.x))) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
233 /* Our friend is still here */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
234 player.t_action = A_NIL;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
235 fight(&player.t_newpos, cur_weapon, FALSE);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
236 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
237 else { /* Our monster has moved */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
238 player.t_action = A_NIL;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
239 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
240 when A_PICKUP:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
241 player.t_action = A_NIL;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
242 if (add_pack((struct linked_list *)NULL, FALSE)) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
243 char tch;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
244 tch = mvwinch(stdscr, hero.y, hero.x);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
245 if (tch != FLOOR && tch != PASSAGE) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
246 player.t_action = A_PICKUP; /*get more */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
247 player.t_no_move += 2 * movement(&player);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
248 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
249 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
250 when A_THROW:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
251 if (player.t_action == A_NIL) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
252 item = get_item(pack, "throw", ALL, FALSE, FALSE);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
253 if (item != NULL && get_dir(&player.t_newpos)) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
254 player.t_action = A_THROW;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
255 player.t_using = item;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
256 player.t_no_move = 2 * movement(&player);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
257 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
258 else
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
259 after = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
260 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
261 else {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
262 missile(player.t_newpos.y, player.t_newpos.x,
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
263 player.t_using, &player);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
264 player.t_action = A_NIL;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
265 player.t_using = 0;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
266 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
267 when 'a' :
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
268 if (player.t_action == A_NIL) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
269 if (get_dir(&player.t_newpos)) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
270 player.t_action = 'a';
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
271 player.t_no_move = 1 + movement(&player);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
272 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
273 else
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
274 after = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
275 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
276 else {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
277 affect();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
278 player.t_action = A_NIL;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
279 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
280 when 'A' : choose_qst();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
281 when 'F' : /* frighten a monster */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
282 if (player.t_action == A_NIL) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
283 player.t_action = 'F';
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
284 player.t_no_move = 2*movement(&player);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
285 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
286 else {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
287 after = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
288 player.t_action = A_NIL;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
289 fright();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
290 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
291 when 'g' : /* Give command: give slime-molds to monsters */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
292 if (player.t_action == A_NIL) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
293 player.t_action = 'g';
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
294 player.t_no_move = 2*movement(&player);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
295 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
296 else {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
297 after = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
298 player.t_action = A_NIL;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
299 give();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
300 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
301 when 'G' :
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
302 if (player.t_action == A_NIL) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
303 player.t_action = 'G';
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
304 player.t_no_move = movement(&player);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
305 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
306 else {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
307 player.t_action = A_NIL;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
308 gsense();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
309 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
310 when 'i' : after = FALSE; inventory(pack, ALL);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
311 when 'I' : after = FALSE; picky_inven();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
312 when 'm' : nameitem((struct linked_list *)NULL, TRUE);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
313 when 'o' : option();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
314 when 'O' : msg("Charactor type: %s Quest item: %s", char_class[char_type].name, rel_magic[quest_item].mi_name);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
315 when ',' :
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
316 case 'P' :
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
317 if (levtype != POSTLEV) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
318 /* We charge 2 movement units per item */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
319 player.t_no_move =
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
320 2 * grab(hero.y, hero.x) * movement(&player);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
321 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
322 else {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
323 /* Let's quote the wise guy a price */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
324 buy_it();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
325 after = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
326 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
327 when 'Q' : after = FALSE; quit(0);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
328 when 'S' :
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
329 after = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
330 if (save_game())
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
331 exit_game(EXIT_CLS | EXIT_ENDWIN);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
332 when 'v' : after = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
333 msg("Advanced xrogue, Version %s ", release);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
334 when 'X' : /* trap sense */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
335 after = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
336 if (player.t_action == A_NIL) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
337 player.t_action = 'X';
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
338 player.t_no_move = movement(&player);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
339 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
340 else {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
341 xsense();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
342 player.t_action = A_NIL;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
343 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
344 when '.' :
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
345 player.t_no_move = movement(&player); /* Rest */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
346 player.t_action = A_NIL;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
347 when ' ' : after = FALSE; /* Do Nothing */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
348 when '>' : after = FALSE; d_level();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
349 when '<' : after = FALSE; u_level();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
350 when '=' : after = FALSE; display();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
351 when '?' : after = FALSE; help();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
352
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
353 /* no character descriptions yet until updated (help.c) */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
354 /* when '\\' : after = FALSE; ident_hero(); */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
355 when '\\' : msg("Charon (the Boatman) looks at you... ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
356
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
357 when '/' : after = FALSE; identify(NULL);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
358 when C_COUNT : count_gold();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
359 when C_DIP : dip_it();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
360 when C_DROP : player.t_action = C_DROP;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
361 drop((struct linked_list *)NULL);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
362 when C_EAT : eat();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
363 when C_QUAFF : quaff(-1, NULL, NULL, TRUE);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
364 when C_READ : read_scroll(-1, NULL, TRUE);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
365 when C_SETTRAP : set_trap(&player, hero.y, hero.x);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
366 when C_SEARCH :
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
367 if (player.t_action == A_NIL) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
368 player.t_action = C_SEARCH;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
369 player.t_no_move = 2 + movement(&player);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
370 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
371 else {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
372 search(FALSE, FALSE);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
373 player.t_action = A_NIL;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
374 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
375 when C_TAKEOFF : take_off();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
376 when C_USE : use_mm(-1);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
377 when C_WEAR : wear();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
378 when C_WIELD : wield();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
379 when C_ZAP : if (!player_zap(NULL, FALSE)) after=FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
380 when C_CAST : cast();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
381 when C_CHANT : chant();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
382 when C_PRAY : pray();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
383 when CTRL('B') : msg("Current score: %d",
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
384 pstats.s_exp + (long) purse);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
385 when CTRL('E') : msg("Current food level: %d(2000)",
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
386 food_left);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
387 when CTRL('L') : after = FALSE; clearok(curscr, TRUE);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
388 touchwin(cw);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
389 when CTRL('N') : nameit();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
390 when CTRL('O') : after = FALSE; opt_player();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
391 when CTRL('R') : after = FALSE; msg(huh);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
392 when CTRL('T') :
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
393 if (player.t_action == A_NIL) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
394 if (get_dir(&player.t_newpos)) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
395 player.t_action = CTRL('T');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
396 player.t_no_move = 2 * movement(&player);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
397 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
398 else
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
399 after = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
400 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
401 else {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
402 steal();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
403 player.t_action = A_NIL;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
404 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
405 when ESC : /* Escape */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
406 door_stop = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
407 count = 0;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
408 after = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
409 when '#':
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
410 if (levtype == POSTLEV) /* buy something */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
411 buy_it();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
412 after = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
413 when '$':
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
414 if (levtype == POSTLEV) /* price something */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
415 price_it();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
416 after = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
417 when '%':
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
418 if (levtype == POSTLEV) /* sell something */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
419 sell_it();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
420 after = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
421 when '+': /* instant karma! */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
422 switch (rnd(100)) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
423 case 0: msg("You waste some time. ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
424 when 5: msg("An oak tree in the garden. ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
425 when 10: msg("Character is what you become in the dark. ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
426 when 15: msg("May you live all the days of your life. ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
427 when 20: msg("A hero is no braver than an ordinary man, but he is brave five minutes longer. ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
428 when 25: msg("Get down! ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
429 when 30: msg("Go back to sleep. ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
430 when 35: msg("Be here now. ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
431 when 40: msg("Choose the rock that feels right to you. ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
432 when 45: msg("Wait... ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
433 when 50: msg("You take a break (yawn)... ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
434 when 55: msg("Without danger there is no pleasure. ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
435 when 60: msg("Define meaningless? ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
436 when 65: msg("Don't push your luck! ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
437 when 70: msg("Gung ho. ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
438 when 75: msg("You are inside a computer. ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
439 when 80: msg("Directive is now required... ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
440 when 85: msg("Charon (the Boatman) awaits you... ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
441 when 95: msg(nothing);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
442 otherwise: msg("");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
443 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
444 after = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
445 when CTRL('P') :
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
446 after = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
447 if (wizard)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
448 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
449 wizard = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
450 trader = 0;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
451 msg("Not wizard any more");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
452 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
453 else
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
454 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
455 if (waswizard || passwd())
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
456 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
457 msg("Welcome, O Mighty Wizard! ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
458 wizard = waswizard = TRUE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
459 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
460 else
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
461 msg("Sorry");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
462 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
463
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
464 otherwise :
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
465 after = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
466 if (wizard) switch (ch) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
467 case 'M' : create_obj(TRUE, 0, 0);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
468 when 'V' : msg("vlevel = %d turns = %d",
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
469 vlevel, turns);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
470 when CTRL('A') : activity();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
471 when CTRL('C') : do_teleport();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
472 when CTRL('D') : level++;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
473 take_with();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
474 new_level(NORMLEV);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
475 when CTRL('F') : overlay(stdscr,cw);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
476 when CTRL('G') :
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
477 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
478 item=get_item(pack,"charge",STICK,FALSE,FALSE);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
479 if (item != NULL) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
480 (OBJPTR(item))->o_charges=10000;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
481 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
482 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
483 when CTRL('H') :
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
484 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
485 register int i, j;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
486 register struct object *obj;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
487
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
488 for (i = 0; i < 9; i++)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
489 raise_level();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
490 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
491 * Give the rogue a sword
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
492 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
493 if (cur_weapon==NULL || cur_weapon->o_type !=
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
494 RELIC) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
495 if (player.t_ctype == C_THIEF ||
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
496 player.t_ctype == C_ASSASSIN ||
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
497 player.t_ctype == C_MONK)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
498 item = spec_item(WEAPON, BASWORD, 20, 20);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
499 else
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
500 item = spec_item(WEAPON,TWOSWORD, 20, 20);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
501 if (add_pack(item, TRUE))
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
502 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
503 cur_weapon = OBJPTR(item);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
504 (OBJPTR(item))->o_flags |= (ISKNOW|ISPROT);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
505 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
506 else
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
507 o_discard(item);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
508 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
509 * And his suit of armor
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
510 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
511 if (player.t_ctype == C_THIEF ||
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
512 player.t_ctype == C_ASSASSIN ||
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
513 player.t_ctype == C_MONK)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
514 j = PADDED_ARMOR;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
515 else
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
516 j = PLATE_ARMOR;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
517 item = spec_item(ARMOR, j, 20, 0);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
518 obj = OBJPTR(item);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
519 obj->o_flags |= (ISKNOW | ISPROT);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
520 obj->o_weight = armors[j].a_wght;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
521 if (add_pack(item, TRUE))
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
522 cur_armor = obj;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
523 else
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
524 o_discard(item);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
525 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
526 purse += 20000;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
527 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
528 when CTRL('I') : inventory(lvl_obj, ALL);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
529 when CTRL('J') : teleport();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
530 when CTRL('K') : whatis((struct linked_list *)NULL);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
531 when CTRL('W') : wanderer();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
532 when CTRL('X') : overlay(mw,cw);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
533 when CTRL('Y') : msg("food left: %d\tfood level: %d",
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
534 food_left, foodlev);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
535 otherwise :
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
536 msg("Illegal wizard command '%s'.", unctrl(ch));
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
537 count = 0;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
538 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
539 else
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
540 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
541 msg("Illegal command '%s'.", unctrl(ch));
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
542 count = 0;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
543 after = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
544 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
545 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
546
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
547 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
548 * If he ran into something to take, let him pick it up.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
549 * unless it's a trading post
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
550 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
551 if (auto_pickup && take != 0 && levtype != POSTLEV) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
552 /* get ready to pick it up */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
553 player.t_action = A_PICKUP;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
554 player.t_no_move += 2 * movement(&player);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
555 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
556 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
557
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
558 /* If he was fighting, let's stop (for now) */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
559 if (player.t_quiet < 0) player.t_quiet = 0;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
560
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
561 if (!running)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
562 door_stop = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
563
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
564 if (after && segment >= 10) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
565 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
566 * Kick off the rest if the daemons and fuses
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
567 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
568
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
569 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
570 * If player is infested, take off a hit point
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
571 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
572 if (on(player, HASINFEST)) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
573 pstats.s_hpt -= infest_dam;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
574 if (pstats.s_hpt == 50 || pstats.s_hpt == 25)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
575 msg("You feel yourself withering away... ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
576 if (pstats.s_hpt < 1) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
577 msg("You die a festering mass. --More--");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
578 wait_for(' ');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
579 pstats.s_hpt = -1;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
580 death(D_INFESTATION);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
581 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
582 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
583
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
584 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
585 * The eye of Vecna is a constant drain on the player
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
586 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
587 if (cur_relic[EYE_VECNA]) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
588 pstats.s_hpt -= 1;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
589 if (pstats.s_hpt == 50 || pstats.s_hpt == 25)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
590 msg("You feel Vecna's eye looking about. ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
591 if (pstats.s_hpt <= 10 && pstats.s_hpt >= 3)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
592 msg("Vecna's eye moves about very quickly. ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
593 if (pstats.s_hpt < 1) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
594 msg("Vecna's curse is upon you! --More--");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
595 wait_for(' ');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
596 pstats.s_hpt = -1;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
597 death(D_RELIC);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
598 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
599 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
600
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
601 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
602 * if player has body rot then take off three hits
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
603 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
604 if (on(player, DOROT)) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
605 pstats.s_hpt -= rnd(3)+1;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
606 if (pstats.s_hpt == 50 || pstats.s_hpt == 25)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
607 msg("Something really begins to stink and smell! ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
608 if (pstats.s_hpt < 1) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
609 msg("You keel over with rot. --More--");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
610 wait_for(' ');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
611 pstats.s_hpt = -1;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
612 death(D_ROT);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
613 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
614 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
615 do_daemons(AFTER);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
616 do_fuses(AFTER);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
617 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
618 } while (after == FALSE);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
619
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
620 /* Make the monsters go */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
621 if (--monst_current <= 0)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
622 monst_current = monst_limit = runners(monst_limit);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
623
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
624 if (++segment > 10) segment = 1;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
625 reap(); /* bury all the dead monsters */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
626 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
627 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
628
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
629 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
630 * display
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
631 * tell the player what is at a certain coordinates assuming
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
632 * it can be seen.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
633 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
634 display()
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
635 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
636 coord c;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
637 struct linked_list *item;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
638 struct thing *tp;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
639 int what;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
640
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
641 msg("What do you want to display (* for help)?");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
642 c = get_coordinates();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
643 mpos = 0;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
644 if (!cansee(c.y, c.x)) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
645 msg("You can't see what is there.");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
646 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
647 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
648 what = mvwinch(cw, c.y, c.x);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
649 if (isalpha(what)) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
650 item = find_mons(c.y, c.x);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
651 tp = THINGPTR(item);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
652 msg("%s", monster_name(tp));
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
653 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
654 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
655 if ((item = find_obj(c.y, c.x)) != NULL) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
656 msg("%s", inv_name(OBJPTR(item), FALSE));
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
657 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
658 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
659 identify(what);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
660 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
661
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
662 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
663 * quit:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
664 * Have player make certain, then exit.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
665 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
666
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
667 /*UNUSED*/
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
668 void
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
669 quit(sig)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
670 int sig;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
671 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
672 register int oy, ox;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
673
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
674 NOOP(sig);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
675
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
676 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
677 * Reset the signal in case we got here via an interrupt
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
678 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
679
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
680 if ((VOID(*)())signal(SIGINT, quit) != (VOID(*)())quit)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
681 mpos = 0;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
682
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
683 getyx(cw, oy, ox);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
684 if (level < 1) { /* if not down in the dungeon proper; exit the game */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
685 wclear(hw);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
686 wmove(hw, lines-1, 0);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
687 draw(hw);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
688 wmove(hw, 12, 30);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
689 wprintw(hw, "Good-bye!");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
690 draw(hw);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
691 exit_game(EXIT_ENDWIN);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
692 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
693 msg("Really quit? <yes or no> "); /* otherwise ask about quitting */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
694 draw(cw);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
695 prbuf[0] = '\0';
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
696 if ((get_str(prbuf, msgw) == NORM) && strcmp(prbuf, "yes") == 0) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
697 clear();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
698 move(lines-1, 0);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
699 draw(stdscr);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
700 score(pstats.s_exp + (long) purse, CHICKEN, 0);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
701 exit_game(EXIT_ENDWIN);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
702 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
703 else {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
704 signal(SIGINT, quit);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
705 wmove(msgw, 0, 0);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
706 wclrtoeol(msgw);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
707 draw(msgw);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
708 status(FALSE);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
709 wmove(cw, oy, ox);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
710 draw(cw);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
711 mpos = 0;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
712 count = 0;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
713 running = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
714 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
715 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
716
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
717 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
718 * bugkill:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
719 * killed by a program bug instead of voluntarily.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
720 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
721
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
722 bugkill(sig)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
723 int sig;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
724 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
725 signal(sig, quit); /* If we get it again, give up */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
726 if (levtype == OUTSIDE) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
727 msg("Oh no! You walk right into a flying swarm of nasty little bugs!! ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
728 msg("One of them penetrates your brain!!! --More--");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
729 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
730 else {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
731 msg("Charon (the Boatman) has finally come for you... --More--");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
732 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
733 wait_for(' ');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
734 pstats.s_hpt = -1;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
735 death(D_SIGNAL); /* Killed by a bug */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
736 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
737
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
738 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
739 * search:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
740 * Player gropes about him to find hidden things.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
741 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
742
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
743 search(is_thief, door_chime)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
744 register bool is_thief, door_chime;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
745 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
746 register int x, y;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
747 register char ch, /* The trap or door character */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
748 sch; /* Trap or door character (as seen on screen) */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
749 register unsigned char mch; /* Monster, if a monster is on the trap or door */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
750 register struct linked_list *item;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
751 register struct thing *mp; /* Status on surrounding monster */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
752
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
753 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
754 * Look all around the hero, if there is something hidden there,
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
755 * give him a chance to find it. If its found, display it.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
756 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
757 if (on(player, ISBLIND))
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
758 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
759 for (x = hero.x - 1; x <= hero.x + 1; x++)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
760 for (y = hero.y - 1; y <= hero.y + 1; y++)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
761 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
762 if (y==hero.y && x==hero.x)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
763 continue;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
764
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
765 if (x < 0 || y < 0 || x >= cols || y >= lines)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
766 continue;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
767
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
768 /* Mch and ch will be the same unless there is a monster here */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
769 mch = winat(y, x);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
770 ch = mvwinch(stdscr, y, x);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
771 sch = mvwinch(cw, y, x); /* What's on the screen */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
772
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
773 if (door_chime == FALSE && isatrap(ch)) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
774 register struct trap *tp;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
775
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
776 /* Is there a monster on the trap? */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
777 if (mch != ch && (item = find_mons(y, x)) != NULL) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
778 mp = THINGPTR(item);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
779 if (sch == mch) sch = mp->t_oldch;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
780 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
781 else mp = NULL;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
782
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
783 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
784 * is this one found already?
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
785 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
786 if (isatrap(sch))
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
787 continue; /* give him chance for other traps */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
788 tp = trap_at(y, x);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
789 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
790 * if the thief set it then don't display it.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
791 * if its not a thief he has 50/50 shot
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
792 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
793 if((tp->tr_flags&ISTHIEFSET) || (!is_thief && rnd(100)>50))
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
794 continue; /* give him chance for other traps */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
795 tp->tr_flags |= ISFOUND;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
796
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
797 /* Let's update the screen */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
798 if (mp != NULL && mvwinch(cw, y, x) == mch)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
799 mp->t_oldch = ch; /* Will change when monst moves */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
800 else mvwaddch(cw, y, x, ch);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
801
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
802 count = 0;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
803 running = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
804
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
805 /* Stop what we were doing */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
806 player.t_no_move = movement(&player);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
807 player.t_action = A_NIL;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
808 player.t_using = NULL;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
809
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
810 if (fight_flush) flushinp();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
811 msg(tr_name(tp->tr_type));
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
812 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
813 else if (ch == SECRETDOOR) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
814 if (door_chime == TRUE || (!is_thief && rnd(100) < 20)) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
815 struct room *rp;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
816 coord cp;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
817
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
818 /* Is there a monster on the door? */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
819 if (mch != ch && (item = find_mons(y, x)) != NULL) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
820 mp = THINGPTR(item);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
821
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
822 /* Screen will change when monster moves */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
823 if (sch == mch) mp->t_oldch = ch;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
824 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
825 mvaddch(y, x, DOOR);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
826 count = 0;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
827 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
828 * if its the entrance to a treasure room, wake it up
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
829 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
830 cp.y = y;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
831 cp.x = x;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
832 rp = roomin(&cp);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
833 if (rp->r_flags & ISTREAS)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
834 wake_room(rp);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
835
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
836 /* Make sure we don't shoot into the room */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
837 if (door_chime == FALSE) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
838 count = 0;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
839 running = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
840
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
841 /* Stop what we were doing */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
842 player.t_no_move = movement(&player);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
843 player.t_action = A_NIL;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
844 player.t_using = NULL;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
845 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
846 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
847 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
848 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
849 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
850
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
851 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
852 * d_level:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
853 * He wants to go down a level
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
854 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
855
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
856 d_level()
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
857 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
858 bool no_phase=FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
859 char position = winat(hero.y, hero.x);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
860 int au;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
861
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
862
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
863 /* If we are on a trading post, go to a trading post level. */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
864 if (position == POST) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
865 take_with(); /* Take charmed monsters with you while shopping */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
866 new_level(POSTLEV);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
867 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
868 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
869
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
870 /* Dive for gold */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
871 if (position == POOL) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
872 if (rnd(300) < 2) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
873 msg("Oh no!!! You drown in the pool!!! --More--");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
874 pstats.s_hpt = -1;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
875 wait_for(' ');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
876 death(D_DROWN);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
877 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
878 else if (rnd(125) < 25) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
879 au = rnd(350) + (level * 10);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
880 msg("You dive under the water momentarily.. ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
881 msg("You found %d gold pieces! ", au);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
882 purse = purse + au;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
883 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
884 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
885 else return; /* doesn't happen all of the time */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
886 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
887
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
888 /* Going down traps is hazardous */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
889 switch (position) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
890 case WORMHOLE:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
891 case TRAPDOOR:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
892 case MAZETRAP:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
893 case DARTTRAP:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
894 case SLEEPTRAP:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
895 case ARROWTRAP:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
896 case BEARTRAP:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
897 case TELTRAP:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
898 msg ("You find yourself in some sort of quicksand!? ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
899 msg ("Hey! There are rock maggots in here!! ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
900 player.t_no_move += movement(&player) * FREEZETIME;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
901 player.t_action = A_FREEZE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
902 msg("You can't move. "); /* spare monks */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
903 if (!ISWEARING(R_HEALTH) && player.t_ctype != C_MONK) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
904 turn_on(player, DOROT);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
905 msg("You feel your skin starting to rot and peel away!! ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
906 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
907 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
908 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
909
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
910 /* If we are at a top-level trading post, we probably can't go down */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
911 if (levtype == POSTLEV && level == 0 && position != STAIRS) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
912 msg("I see no way down.");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
913 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
914 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
915
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
916 if (winat(hero.y, hero.x) != STAIRS) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
917 if (off(player, CANINWALL) || /* Must use stairs if can't phase */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
918 (levtype == OUTSIDE && rnd(100) < 90)) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
919 msg("I see no way down.");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
920 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
921 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
922 if (levtype == OUTSIDE) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
923 level++;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
924 take_with();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
925 new_level(NORMLEV);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
926 if (no_phase) unphase();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
927 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
928 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
929
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
930 /* Is there any dungeon left below? */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
931 if (level >= nfloors) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
932 msg("There is only solid rock below.");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
933 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
934 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
935
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
936 extinguish(unphase); /* Using phase to go down gets rid of it */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
937 no_phase = TRUE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
938 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
939
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
940 /* Is this the bottom? */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
941 if (level >= nfloors) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
942 msg("The stairway only goes up.");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
943 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
944 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
945
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
946 level++;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
947 take_with();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
948 new_level(NORMLEV);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
949 if (no_phase) unphase();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
950 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
951
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
952 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
953 * u_level:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
954 * He wants to go up a level
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
955 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
956
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
957 u_level()
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
958 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
959 bool no_phase = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
960 register struct linked_list *item;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
961 char position = winat(hero.y, hero.x);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
962 struct thing *tp;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
963 struct object *obj;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
964
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
965 /* You can go up into the outside if standing on top of a worm hole */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
966 if (position == WORMHOLE) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
967 prev_max = 1000;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
968 level--;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
969 if (level <= 0) level = 1;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
970 msg("You find yourself in strange surroundings... ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
971 if (wizard) addmsg("Going up through a worm hole. ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
972 take_with();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
973 new_level(OUTSIDE);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
974 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
975 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
976
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
977 if (winat(hero.y, hero.x) != STAIRS) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
978 if (off(player, CANINWALL)) { /* Must use stairs if can't phase */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
979 msg("I see no way up.");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
980 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
981 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
982
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
983 extinguish(unphase);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
984 no_phase = TRUE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
985 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
986
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
987 if (position != STAIRS) return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
988
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
989 if (level == 0 || levtype == OUTSIDE) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
990 msg("The stairway only goes down.");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
991 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
992 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
993
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
994 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
995 * does he have the item he was quested to get?
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
996 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
997 if (level == 1) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
998 for (item = pack; item != NULL; item = next(item)) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
999 obj = OBJPTR(item);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1000 if (obj->o_type == RELIC && obj->o_which == quest_item)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1001 total_winner();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1002 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1003 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1004 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1005 * check to see if he trapped a UNIQUE, If he did then put it back
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1006 * in the monster table for next time
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1007 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1008 for (item = tlist; item != NULL; item = next(item)) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1009 tp = THINGPTR(item);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1010 if (on(*tp, ISUNIQUE))
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1011 monsters[tp->t_index].m_normal = TRUE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1012 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1013 t_free_list(tlist); /* Monsters that fell below are long gone! */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1014
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1015 if (levtype != POSTLEV)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1016 level--;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1017 if (level > 0) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1018 take_with();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1019 new_level(NORMLEV);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1020 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1021 else if (cur_max > level) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1022 prev_max = 1000; /* flag used in n_level.c */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1023 level--;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1024 if (level <= 0) level = 1;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1025 msg("You emerge into the %s. ", daytime ? "eerie light" : "dark night");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1026 if (wizard) msg("Going up: cur_max=%d level=%d. ", cur_max, level);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1027 take_with();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1028 new_level(OUTSIDE); /* Leaving the dungeon for outside */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1029 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1030 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1031 else {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1032 prev_max = 1; /* flag used in n_level.c */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1033 level = -1; /* Indicate that we are new to the outside */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1034 msg("You emerge into the %s. ", daytime ? "eerie light" : "dark night");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1035 if (wizard) msg("Going up: cur_max=%d level=%d. ", cur_max, level);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1036 take_with();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1037 new_level(OUTSIDE);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1038 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1039 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1040
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1041 if (no_phase) unphase();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1042 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1043
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1044 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1045 * Let him escape for a while
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1046 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1047
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1048 shell()
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1049 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1050 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1051 * Set the terminal back to original mode
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1052 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1053 wclear(hw);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1054 wmove(hw, lines-1, 0);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1055 draw(hw);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1056 endwin();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1057 in_shell = TRUE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1058 fflush(stdout);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1059
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1060 md_shellescape();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1061
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1062 printf(retstr);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1063 fflush(stdout);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1064 noecho();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1065 crmode();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1066 in_shell = FALSE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1067 wait_for('\n');
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1068 restscr(cw);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1069 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1070
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1071 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1072 * see what we want to name -- an item or a monster.
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1073 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1074 nameit()
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1075 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1076 char answer;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1077
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1078 msg("Name monster or item (m or i)? ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1079 answer = wgetch(cw);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1080 mpos = 0;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1081
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1082 while (answer != 'm' && answer != 'i' && answer != ESC) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1083 mpos = 0;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1084 msg("Please specify m or i, for monster or item - ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1085 answer = wgetch(cw);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1086 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1087
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1088 switch (answer) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1089 case 'm': namemonst();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1090 when 'i': nameitem((struct linked_list *)NULL, FALSE);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1091 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1092 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1093
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1094 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1095 * allow a user to call a potion, scroll, or ring something
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1096 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1097
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1098 nameitem(item, mark)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1099 struct linked_list *item;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1100 bool mark;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1101 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1102 register struct object *obj;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1103 register char **guess = NULL, *elsewise = NULL;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1104 register bool *know;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1105
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1106 if (item == NULL) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1107 if (mark) item = get_item(pack, "mark", ALL, FALSE, FALSE);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1108 else item = get_item(pack, "name", CALLABLE, FALSE, FALSE);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1109 if (item == NULL) return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1110 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1111 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1112 * Make certain that it is somethings that we want to wear
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1113 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1114 obj = OBJPTR(item);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1115 switch (obj->o_type)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1116 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1117 case RING:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1118 guess = r_guess;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1119 know = r_know;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1120 elsewise = (r_guess[obj->o_which] != NULL ?
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1121 r_guess[obj->o_which] : r_stones[obj->o_which]);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1122 when POTION:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1123 guess = p_guess;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1124 know = p_know;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1125 elsewise = (p_guess[obj->o_which] != NULL ?
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1126 p_guess[obj->o_which] : p_colors[obj->o_which]);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1127 when SCROLL:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1128 guess = s_guess;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1129 know = s_know;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1130 elsewise = (s_guess[obj->o_which] != NULL ?
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1131 s_guess[obj->o_which] : s_names[obj->o_which]);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1132 when STICK:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1133 guess = ws_guess;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1134 know = ws_know;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1135 elsewise = (ws_guess[obj->o_which] != NULL ?
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1136 ws_guess[obj->o_which] : ws_made[obj->o_which]);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1137 when MM:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1138 guess = m_guess;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1139 know = m_know;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1140 elsewise = (m_guess[obj->o_which] != NULL ?
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1141 m_guess[obj->o_which] : "nothing");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1142 otherwise:
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1143 if (!mark) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1144 msg("You can't call that anything.");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1145 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1146 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1147 else know = (bool *) 0;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1148 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1149 if ((obj->o_flags & ISPOST) || (know && know[obj->o_which]) && !mark) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1150 msg("That has already been identified.");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1151 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1152 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1153 if (mark) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1154 if (obj->o_mark[0]) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1155 addmsg(terse ? "M" : "Was m");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1156 msg("arked \"%s\"", obj->o_mark);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1157 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1158 msg(terse ? "Mark it: " : "What do you want to mark it? ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1159 prbuf[0] = '\0';
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1160 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1161 else {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1162 if (elsewise) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1163 addmsg(terse ? "N" : "Was n");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1164 msg("amed \"%s\"", elsewise);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1165 strcpy(prbuf, elsewise);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1166 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1167 else prbuf[0] = '\0';
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1168 msg(terse ? "Name it: " : "What do you want to name it? ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1169 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1170 if (get_str(prbuf, msgw) == NORM) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1171 if (mark) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1172 strncpy((char *)obj->o_mark, prbuf, MARKLEN-1);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1173 obj->o_mark[MARKLEN-1] = '\0';
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1174 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1175 else if (prbuf[0] != '\0') {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1176 if (guess[obj->o_which] != NULL)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1177 free(guess[obj->o_which]);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1178 guess[obj->o_which] = new((unsigned int) strlen(prbuf) + 1);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1179 strcpy(guess[obj->o_which], prbuf);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1180 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1181 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1182 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1183
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1184 /* Name a monster */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1185
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1186 namemonst()
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1187 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1188 register struct thing *tp;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1189 struct linked_list *item;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1190 coord c;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1191
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1192 /* Find the monster */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1193 msg("Choose the monster (* for help)");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1194 c = get_coordinates();
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1195
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1196 /* Make sure we can see it and that it is a monster. */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1197 mpos = 0;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1198 if (!cansee(c.y, c.x)) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1199 msg("You can't see what is there.");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1200 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1201 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1202
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1203 if (isalpha(mvwinch(cw, c.y, c.x))) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1204 item = find_mons(c.y, c.x);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1205 if (item != NULL) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1206 tp = THINGPTR(item);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1207 if (tp->t_name == NULL)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1208 strcpy(prbuf, monsters[tp->t_index].m_name);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1209 else
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1210 strcpy(prbuf, tp->t_name);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1211
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1212 addmsg(terse ? "N" : "Was n");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1213 msg("amed \"%s\"", prbuf);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1214 msg(terse ? "Name it: " : "What do you want to name it? ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1215
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1216 if (get_str(prbuf, msgw) == NORM) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1217 if (prbuf[0] != '\0') {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1218 if (tp->t_name != NULL)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1219 free(tp->t_name);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1220 tp->t_name = new((unsigned int) strlen(prbuf) + 1);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1221 strcpy(tp->t_name, prbuf);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1222 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1223 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1224 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1225 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1226 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1227
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1228 msg("There is no monster there to name.");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1229 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1230
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1231 count_gold()
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1232 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1233 if (player.t_action != C_COUNT) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1234 msg("You take a break to count your money.. ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1235 player.t_using = NULL;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1236 player.t_action = C_COUNT; /* We are counting */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1237 if (purse > 500000) msg("This may take some time... 10, 20, 30...");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1238 player.t_no_move = (purse/75000 + 1) * movement(&player);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1239 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1240 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1241 if (purse > 10000)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1242 msg("You have %ld pieces of gold. ", purse);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1243 else if (purse == 1)
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1244 msg("You have 1 piece of gold. ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1245 else
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1246 msg("You have %ld gold pieces. ", purse);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1247 player.t_action = A_NIL;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1248 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1249
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1250 /*
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1251 * Teleport somewhere, anywhere...
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1252 */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1253
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1254 do_teleport()
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1255 {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1256 int tlev;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1257 prbuf[0] = '\0';
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1258 msg("To which level do you wish to teleport? ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1259 if(get_str(prbuf,msgw) == NORM) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1260 tlev = atoi(prbuf);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1261 if (quest_item == ALTERAN_CARD || wizard) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1262 if (wizard && (tlev < 1 || tlev > LEVEL)) { /* wizard */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1263 mpos = 0;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1264 msg("The power of teleportation does have its limitations. ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1265 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1266 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1267 else if (!wizard && (tlev < 10 || tlev > LEVEL)) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1268 mpos = 0;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1269 msg("The power of teleportation does have its limitations. ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1270 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1271 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1272 else if (tlev >= LEVEL-100 && tlev < LEVEL-50) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1273 levtype = OUTSIDE;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1274 level = LEVEL-100;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1275 prev_max = 1000; /* a flag for going outside */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1276 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1277 else if (tlev >= LEVEL-150 && tlev < LEVEL-100) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1278 levtype = MAZELEV;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1279 level = LEVEL-150;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1280 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1281 else if (tlev >= LEVEL-200 && tlev < LEVEL-150) {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1282 levtype = POSTLEV;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1283 level = LEVEL-200;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1284 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1285 else {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1286 levtype = NORMLEV;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1287 level = tlev;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1288 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1289 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1290 else if (tlev < 40 || tlev > 399) { /* not quest item or wizard */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1291 mpos = 0;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1292 msg("The power of teleportation does have its limitations. ");
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1293 return;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1294 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1295 else {
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1296 levtype = NORMLEV;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1297 level = tlev;
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1298 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1299
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1300 /* okay, now send him off */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1301 cur_max = level; /* deepest he's been */
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1302 new_level(levtype);
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1303 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1304 }
e6179860cb76 Import XRogue 8.0 from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff changeset
1305