comparison xrogue/rooms.c @ 220:f54901b9c39b

XRogue: convert to ANSI-style function declarations.
author John "Elwin" Edwards
date Wed, 02 Mar 2016 21:13:26 -0500
parents ce0cf824c192
children
comparison
equal deleted inserted replaced
219:f9ef86cf22b2 220:f54901b9c39b
18 18
19 #include <stdlib.h> 19 #include <stdlib.h>
20 #include <curses.h> 20 #include <curses.h>
21 #include "rogue.h" 21 #include "rogue.h"
22 22
23 do_rooms() 23 void horiz(int cnt);
24 void vert(int cnt);
25
26 void
27 do_rooms(void)
24 { 28 {
25 register int i; 29 register int i;
26 register struct room *rp; 30 register struct room *rp;
27 register struct linked_list *item; 31 register struct linked_list *item;
28 register struct thing *tp; 32 register struct thing *tp;
105 register struct object *cur; 109 register struct object *cur;
106 coord tp; 110 coord tp;
107 111
108 has_gold = TRUE; /* This room has gold in it */ 112 has_gold = TRUE; /* This room has gold in it */
109 113
110 item = spec_item(GOLD, NULL, NULL, NULL); 114 item = spec_item(GOLD, 0, 0, 0);
111 cur = OBJPTR(item); 115 cur = OBJPTR(item);
112 116
113 /* Put the gold into the level list of items */ 117 /* Put the gold into the level list of items */
114 attach(lvl_obj, item); 118 attach(lvl_obj, item);
115 119
175 * Given a room pointer and a pointer to a door, supposedly in that room, 179 * Given a room pointer and a pointer to a door, supposedly in that room,
176 * return the coordinates of the entrance to the doorway. 180 * return the coordinates of the entrance to the doorway.
177 */ 181 */
178 182
179 coord * 183 coord *
180 doorway(rp, door) 184 doorway(struct room *rp, coord *door)
181 register struct room *rp;
182 register coord *door;
183 { 185 {
184 register int misses = 0; 186 register int misses = 0;
185 static coord answer; 187 static coord answer;
186 188
187 /* Do we have decent parameters? */ 189 /* Do we have decent parameters? */
206 208
207 /* 209 /*
208 * Draw a box around a room 210 * Draw a box around a room
209 */ 211 */
210 212
211 draw_room(rp) 213 void
212 register struct room *rp; 214 draw_room(struct room *rp)
213 { 215 {
214 register int j, k; 216 register int j, k;
215 217
216 move(rp->r_pos.y, rp->r_pos.x+1); 218 move(rp->r_pos.y, rp->r_pos.x+1);
217 vert(rp->r_max.y-2); /* Draw left side */ 219 vert(rp->r_max.y-2); /* Draw left side */
234 /* 236 /*
235 * horiz: 237 * horiz:
236 * draw a horizontal line 238 * draw a horizontal line
237 */ 239 */
238 240
239 horiz(cnt) 241 void
240 register int cnt; 242 horiz(int cnt)
241 { 243 {
242 while (cnt--) 244 while (cnt--)
243 addch(HORZWALL); 245 addch(HORZWALL);
244 } 246 }
245 247
246 /* 248 /*
247 * rnd_pos: 249 * rnd_pos:
248 * pick a random spot in a room 250 * pick a random spot in a room
249 */ 251 */
250 252
251 rnd_pos(rp, cp) 253 void
252 register struct room *rp; 254 rnd_pos(struct room *rp, coord *cp)
253 register coord *cp;
254 { 255 {
255 cp->x = rp->r_pos.x + rnd(rp->r_max.x-2) + 1; 256 cp->x = rp->r_pos.x + rnd(rp->r_max.x-2) + 1;
256 cp->y = rp->r_pos.y + rnd(rp->r_max.y-2) + 1; 257 cp->y = rp->r_pos.y + rnd(rp->r_max.y-2) + 1;
257 } 258 }
258 259
263 * Find what room some coordinates are in. NULL means they aren't 264 * Find what room some coordinates are in. NULL means they aren't
264 * in any room. 265 * in any room.
265 */ 266 */
266 267
267 struct room * 268 struct room *
268 roomin(cp) 269 roomin(coord *cp)
269 register coord *cp;
270 { 270 {
271 register struct room *rp; 271 register struct room *rp;
272 272
273 for (rp = rooms; rp < &rooms[MAXROOMS]; rp++) 273 for (rp = rooms; rp < &rooms[MAXROOMS]; rp++)
274 if (inroom(rp, cp)) 274 if (inroom(rp, cp))
279 /* 279 /*
280 * vert: 280 * vert:
281 * draw a vertical line 281 * draw a vertical line
282 */ 282 */
283 283
284 vert(cnt) 284 void
285 register int cnt; 285 vert(int cnt)
286 { 286 {
287 register int x, y; 287 register int x, y;
288 288
289 getyx(stdscr, y, x); 289 getyx(stdscr, y, x);
290 x--; 290 x--;