Mercurial > hg > early-roguelike
comparison srogue/rooms.c @ 225:4f6e056438eb
Merge the GCC5 and build fix branches.
| author | John "Elwin" Edwards |
|---|---|
| date | Wed, 02 Mar 2016 21:28:34 -0500 |
| parents | 94a0d9dd5ce1 |
| children | e52a8a7ad4c5 |
comparison
equal
deleted
inserted
replaced
| 224:4d0f53998e8a | 225:4f6e056438eb |
|---|---|
| 15 */ | 15 */ |
| 16 | 16 |
| 17 #include "rogue.h" | 17 #include "rogue.h" |
| 18 #include "rogue.ext" | 18 #include "rogue.ext" |
| 19 | 19 |
| 20 void horiz(int cnt); | |
| 21 void vert(int cnt); | |
| 22 | |
| 20 /* | 23 /* |
| 21 * do_rooms: | 24 * do_rooms: |
| 22 * Place the rooms in the dungeon | 25 * Place the rooms in the dungeon |
| 23 */ | 26 */ |
| 24 do_rooms() | 27 void |
| 28 do_rooms(void) | |
| 25 { | 29 { |
| 26 int mloops, mchance, nummons, left_out, roomtries; | 30 int mloops, mchance, nummons, left_out, roomtries; |
| 27 bool treas = FALSE; | 31 bool treas = FALSE; |
| 28 reg int i; | 32 reg int i; |
| 29 reg struct room *rp; | 33 reg struct room *rp; |
| 129 | 133 |
| 130 /* | 134 /* |
| 131 * add_mon: | 135 * add_mon: |
| 132 * Add a monster to a room | 136 * Add a monster to a room |
| 133 */ | 137 */ |
| 134 add_mon(rm, treas) | 138 void |
| 135 struct room *rm; | 139 add_mon(struct room *rm, bool treas) |
| 136 bool treas; | |
| 137 { | 140 { |
| 138 reg struct thing *tp; | 141 reg struct thing *tp; |
| 139 reg struct linked_list *item; | 142 reg struct linked_list *item; |
| 140 struct coord mp; | 143 struct coord mp; |
| 141 int chance; | 144 int chance; |
| 163 | 166 |
| 164 /* | 167 /* |
| 165 * draw_room: | 168 * draw_room: |
| 166 * Draw a box around a room | 169 * Draw a box around a room |
| 167 */ | 170 */ |
| 168 draw_room(rp) | 171 void |
| 169 struct room *rp; | 172 draw_room(struct room *rp) |
| 170 { | 173 { |
| 171 reg int j, k; | 174 reg int j, k; |
| 172 | 175 |
| 173 move(rp->r_pos.y, rp->r_pos.x+1); | 176 move(rp->r_pos.y, rp->r_pos.x+1); |
| 174 vert(rp->r_max.y-2); /* Draw left side */ | 177 vert(rp->r_max.y-2); /* Draw left side */ |
| 195 | 198 |
| 196 /* | 199 /* |
| 197 * horiz: | 200 * horiz: |
| 198 * draw a horizontal line | 201 * draw a horizontal line |
| 199 */ | 202 */ |
| 200 horiz(cnt) | 203 void |
| 201 int cnt; | 204 horiz(int cnt) |
| 202 { | 205 { |
| 203 while (cnt-- > 0) | 206 while (cnt-- > 0) |
| 204 addch('-'); | 207 addch('-'); |
| 205 } | 208 } |
| 206 | 209 |
| 207 | 210 |
| 208 /* | 211 /* |
| 209 * vert: | 212 * vert: |
| 210 * draw a vertical line | 213 * draw a vertical line |
| 211 */ | 214 */ |
| 212 vert(cnt) | 215 void |
| 213 int cnt; | 216 vert(int cnt) |
| 214 { | 217 { |
| 215 reg int x, y; | 218 reg int x, y; |
| 216 | 219 |
| 217 getyx(stdscr, y, x); | 220 getyx(stdscr, y, x); |
| 218 x--; | 221 x--; |
| 226 /* | 229 /* |
| 227 * rnd_pos: | 230 * rnd_pos: |
| 228 * pick a random spot in a room | 231 * pick a random spot in a room |
| 229 */ | 232 */ |
| 230 struct coord * | 233 struct coord * |
| 231 rnd_pos(rp) | 234 rnd_pos(struct room *rp) |
| 232 struct room *rp; | |
| 233 { | 235 { |
| 234 reg int y, x, i; | 236 reg int y, x, i; |
| 235 static struct coord spot; | 237 static struct coord spot; |
| 236 | 238 |
| 237 i = 0; | 239 i = 0; |
| 247 | 249 |
| 248 /* | 250 /* |
| 249 * rf_on: | 251 * rf_on: |
| 250 * Returns TRUE if flag is set for room stuff | 252 * Returns TRUE if flag is set for room stuff |
| 251 */ | 253 */ |
| 252 rf_on(rm, bit) | 254 bool |
| 253 struct room *rm; | 255 rf_on(struct room *rm, long bit) |
| 254 long bit; | |
| 255 { | 256 { |
| 256 return (rm->r_flags & bit); | 257 return (rm->r_flags & bit); |
| 257 } | 258 } |
