Mercurial > hg > early-roguelike
comparison srogue/disply.c @ 36:2128c7dc8a40
Import Super-Rogue 9.0 from the Roguelike Restoration Project (r1490)
author | elwin |
---|---|
date | Thu, 25 Nov 2010 12:21:41 +0000 |
parents | |
children | 94a0d9dd5ce1 |
comparison
equal
deleted
inserted
replaced
35:05018c63a721 | 36:2128c7dc8a40 |
---|---|
1 /* | |
2 * various display routines and flag checking functions | |
3 * | |
4 * @(#)disply.c 9.0 (rdk) 7/17/84 | |
5 * | |
6 * Super-Rogue | |
7 * Copyright (C) 1984 Robert D. Kindelberger | |
8 * All rights reserved. | |
9 * | |
10 * See the file LICENSE.TXT for full copyright and licensing information. | |
11 */ | |
12 | |
13 #include "rogue.h" | |
14 #include <ctype.h> | |
15 #include "rogue.ext" | |
16 | |
17 /* | |
18 * displevl: | |
19 * Display detailed level for wizard and scroll | |
20 */ | |
21 displevl() | |
22 { | |
23 reg char ch, mch; | |
24 reg int i,j; | |
25 reg struct room *rp; | |
26 | |
27 for (rp = rooms; rp < &rooms[MAXROOMS]; rp++) | |
28 rp->r_flags &= ~ISDARK; | |
29 | |
30 for (i = 0; i < LINES - 2; i++) { | |
31 for (j = 0; j < COLS - 1; j++) { | |
32 ch = mvinch(i,j); | |
33 if (isatrap(ch)) { | |
34 struct trap *what; | |
35 | |
36 what = trap_at(i, j); | |
37 if (what != NULL) | |
38 what->tr_flags |= ISFOUND; | |
39 } | |
40 else if (ch == SECRETDOOR) { | |
41 ch = DOOR; | |
42 mvaddch(i, j, ch); | |
43 } | |
44 else if (illeg_ch(ch)) { | |
45 ch = FLOOR; | |
46 mvaddch(i, j, ch); | |
47 } | |
48 if (mvwinch(mw, i, j) != ' ') { | |
49 struct linked_list *what; | |
50 struct thing *it; | |
51 | |
52 what = find_mons(i, j); | |
53 if (what == NULL) { | |
54 ch = FLOOR; | |
55 mvaddch(i, j, ch); | |
56 } | |
57 else { | |
58 it = THINGPTR(what); | |
59 it->t_oldch = ch; | |
60 } | |
61 } | |
62 mch = mvwinch(cw, i, j); | |
63 if (isalpha(mch)) | |
64 ch = mch; | |
65 mvwaddch(cw, i, j, ch); | |
66 } | |
67 } | |
68 nochange = FALSE; /* display status again */ | |
69 draw(cw); | |
70 } | |
71 | |
72 /* | |
73 * dispmons: | |
74 * Show monsters for wizard and potion | |
75 */ | |
76 dispmons() | |
77 { | |
78 reg int ch, y, x; | |
79 reg struct thing *it; | |
80 reg struct linked_list *item; | |
81 | |
82 for (item = mlist; item != NULL; item = next(item)) { | |
83 it = THINGPTR(item); | |
84 y = it->t_pos.y; | |
85 x = it->t_pos.x; | |
86 mvwaddch(cw, y, x, it->t_type); | |
87 it->t_flags |= ISFOUND; | |
88 if (it->t_type == 'M') /* if a mimic */ | |
89 it->t_disguise = 'M'; /* give it away */ | |
90 } | |
91 draw(cw); | |
92 } | |
93 | |
94 /* | |
95 * winat: | |
96 * Get whatever character is at a location on the screen | |
97 */ | |
98 winat(y, x) | |
99 int x, y; | |
100 { | |
101 reg char ch; | |
102 | |
103 if (mvwinch(mw,y,x) == ' ') | |
104 ch = mvinch(y, x); /* non-monsters */ | |
105 else | |
106 ch = winch(mw); /* monsters */ | |
107 return ch; | |
108 } | |
109 | |
110 /* | |
111 * cordok: | |
112 * Returns TRUE if coordinate is on usable screen | |
113 */ | |
114 cordok(y, x) | |
115 int y, x; | |
116 { | |
117 if (x < 0 || y < 0 || x >= COLS || y >= LINES - 1) | |
118 return FALSE; | |
119 return TRUE; | |
120 } | |
121 | |
122 /* | |
123 * pl_on: | |
124 * Returns TRUE if the player's flag is set | |
125 */ | |
126 pl_on(what) | |
127 long what; | |
128 { | |
129 return (player.t_flags & what); | |
130 } | |
131 | |
132 | |
133 /* | |
134 * pl_off: | |
135 * Returns TRUE when player's flag is reset | |
136 */ | |
137 pl_off(what) | |
138 long what; | |
139 { | |
140 return (!(player.t_flags & what)); | |
141 } | |
142 | |
143 | |
144 /* | |
145 * o_on: | |
146 * Returns TRUE in the objects flag is set | |
147 */ | |
148 o_on(what,bit) | |
149 struct object *what; | |
150 long bit; | |
151 { | |
152 reg int flag; | |
153 | |
154 flag = FALSE; | |
155 if (what != NULL) | |
156 flag = (what->o_flags & bit); | |
157 return flag; | |
158 } | |
159 | |
160 | |
161 /* | |
162 * o_off: | |
163 * Returns TRUE is the objects flag is reset | |
164 */ | |
165 o_off(what,bit) | |
166 struct object *what; | |
167 long bit; | |
168 { | |
169 reg int flag; | |
170 | |
171 flag = FALSE; | |
172 if (what != NULL) | |
173 flag = !(what->o_flags & bit); | |
174 return flag; | |
175 } | |
176 | |
177 | |
178 /* | |
179 * setoflg: | |
180 * Set the specified flag for the object | |
181 */ | |
182 setoflg(what,bit) | |
183 struct object *what; | |
184 long bit; | |
185 { | |
186 what->o_flags |= bit; | |
187 } | |
188 | |
189 | |
190 /* | |
191 * resoflg: | |
192 * Reset the specified flag for the object | |
193 */ | |
194 resoflg(what,bit) | |
195 struct object *what; | |
196 long bit; | |
197 { | |
198 what->o_flags &= ~bit; | |
199 } |