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