Mercurial > hg > early-roguelike
comparison arogue5/maze.c @ 218:56e748983fa8
Advanced Rogue 5: convert to ANSI function declarations.
This still leaves over a thousand lines of warning messages, mostly
related to the return types of daemons and fuses.
author | John "Elwin" Edwards |
---|---|
date | Sun, 07 Feb 2016 14:39:21 -0500 |
parents | 0ed67132cf10 |
children | 0250220d8cdd |
comparison
equal
deleted
inserted
replaced
217:94a0d9dd5ce1 | 218:56e748983fa8 |
---|---|
28 | 28 |
29 static char *frontier, | 29 static char *frontier, |
30 *bits; | 30 *bits; |
31 static int maze_lines, | 31 static int maze_lines, |
32 maze_cols; | 32 maze_cols; |
33 char *moffset(), | 33 |
34 *foffset(); | 34 void draw_maze(void); |
35 int findcells(int y, int x); | |
36 char *foffset(int y, int x); | |
37 char *moffset(int y, int x); | |
38 void rmwall(int newy, int newx, int oldy, int oldx); | |
35 | 39 |
36 | 40 |
37 /* | 41 /* |
38 * crankout: | 42 * crankout: |
39 * Does actual drawing of maze to window | 43 * Does actual drawing of maze to window |
40 */ | 44 */ |
41 crankout() | 45 void |
46 crankout(void) | |
42 { | 47 { |
43 reg int x, y; | 48 reg int x, y; |
44 | 49 |
45 for (y = 0; y < LINES - 3; y++) { | 50 for (y = 0; y < LINES - 3; y++) { |
46 move(y + 1, 0); | 51 move(y + 1, 0); |
69 | 74 |
70 /* | 75 /* |
71 * domaze: | 76 * domaze: |
72 * Draw the maze on this level. | 77 * Draw the maze on this level. |
73 */ | 78 */ |
74 do_maze() | 79 void |
80 do_maze(void) | |
75 { | 81 { |
76 reg int least; | 82 reg int least; |
77 reg struct room *rp; | 83 reg struct room *rp; |
78 reg struct linked_list *item; | 84 reg struct linked_list *item; |
79 reg struct object *obj; | 85 reg struct object *obj; |
93 rp->r_max.y = LINES - 3; | 99 rp->r_max.y = LINES - 3; |
94 draw_maze(); /* put maze into window */ | 100 draw_maze(); /* put maze into window */ |
95 /* | 101 /* |
96 * add some gold to make it worth looking for | 102 * add some gold to make it worth looking for |
97 */ | 103 */ |
98 item = spec_item(GOLD, NULL, NULL, NULL); | 104 item = spec_item(GOLD, 0, 0, 0); |
99 obj = OBJPTR(item); | 105 obj = OBJPTR(item); |
100 obj->o_count *= (rnd(10) + 1); /* add in one large hunk */ | 106 obj->o_count *= (rnd(10) + 1); /* add in one large hunk */ |
101 attach(lvl_obj, item); | 107 attach(lvl_obj, item); |
102 cnt = 0; | 108 cnt = 0; |
103 do { | 109 do { |
106 mvaddch(tp.y, tp.x, GOLD); | 112 mvaddch(tp.y, tp.x, GOLD); |
107 obj->o_pos = tp; | 113 obj->o_pos = tp; |
108 /* | 114 /* |
109 * add in some food to make sure he has enough | 115 * add in some food to make sure he has enough |
110 */ | 116 */ |
111 item = spec_item(FOOD, NULL, NULL, NULL); | 117 item = spec_item(FOOD, 0, 0, 0); |
112 obj = OBJPTR(item); | 118 obj = OBJPTR(item); |
113 attach(lvl_obj, item); | 119 attach(lvl_obj, item); |
114 do { | 120 do { |
115 rnd_pos(rp, &tp); | 121 rnd_pos(rp, &tp); |
116 } until (mvinch(tp.y, tp.x) == FLOOR || cnt++ > 5000); | 122 } until (mvinch(tp.y, tp.x) == FLOOR || cnt++ > 5000); |
131 | 137 |
132 /* | 138 /* |
133 * draw_maze: | 139 * draw_maze: |
134 * Generate and draw the maze on the screen | 140 * Generate and draw the maze on the screen |
135 */ | 141 */ |
136 draw_maze() | 142 void |
143 draw_maze(void) | |
137 { | 144 { |
138 reg int i, j, more; | 145 reg int i, j, more; |
139 reg char *ptr; | 146 reg char *ptr; |
140 | 147 |
141 maze_lines = (LINES - 3) / 2; | 148 maze_lines = (LINES - 3) / 2; |
167 | 174 |
168 /* | 175 /* |
169 * findcells: | 176 * findcells: |
170 * Figure out cells to open up | 177 * Figure out cells to open up |
171 */ | 178 */ |
172 findcells(y,x) | 179 int |
173 reg int x, y; | 180 findcells(int y, int x) |
174 { | 181 { |
175 reg int rtpos, i; | 182 reg int rtpos, i; |
176 | 183 |
177 *foffset(y, x) = FALSE; | 184 *foffset(y, x) = FALSE; |
178 border_cells.num_pos = 0; | 185 border_cells.num_pos = 0; |
219 /* | 226 /* |
220 * foffset: | 227 * foffset: |
221 * Calculate memory address for frontier | 228 * Calculate memory address for frontier |
222 */ | 229 */ |
223 char * | 230 char * |
224 foffset(y, x) | 231 foffset(int y, int x) |
225 int y, x; | |
226 { | 232 { |
227 | 233 |
228 return (frontier + (y * maze_cols) + x); | 234 return (frontier + (y * maze_cols) + x); |
229 } | 235 } |
230 | 236 |
234 * Returns true if the player can see the specified location within | 240 * Returns true if the player can see the specified location within |
235 * the confines of a maze (within one column or row) | 241 * the confines of a maze (within one column or row) |
236 */ | 242 */ |
237 | 243 |
238 bool | 244 bool |
239 maze_view(y, x) | 245 maze_view(int y, int x) |
240 int y, x; | |
241 { | 246 { |
242 register int start, goal, delta, ycheck = 0, xcheck = 0, absy, absx, see_radius; | 247 register int start, goal, delta, ycheck = 0, xcheck = 0, absy, absx, see_radius; |
243 register bool row; | 248 register bool row; |
244 char ch; /* What we are standing on (or near) */ | 249 char ch; /* What we are standing on (or near) */ |
245 | 250 |
340 /* | 345 /* |
341 * moffset: | 346 * moffset: |
342 * Calculate memory address for bits | 347 * Calculate memory address for bits |
343 */ | 348 */ |
344 char * | 349 char * |
345 moffset(y, x) | 350 moffset(int y, int x) |
346 int y, x; | |
347 { | 351 { |
348 | 352 |
349 return (bits + (y * (COLS - 1)) + x); | 353 return (bits + (y * (COLS - 1)) + x); |
350 } | 354 } |
351 | 355 |
354 | 358 |
355 /* | 359 /* |
356 * rmwall: | 360 * rmwall: |
357 * Removes appropriate walls from the maze | 361 * Removes appropriate walls from the maze |
358 */ | 362 */ |
359 rmwall(newy, newx, oldy, oldx) | 363 void |
360 int newy, newx, oldy, oldx; | 364 rmwall(int newy, int newx, int oldy, int oldx) |
361 { | 365 { |
362 reg int xdif,ydif; | 366 reg int xdif,ydif; |
363 | 367 |
364 xdif = newx - oldx; | 368 xdif = newx - oldx; |
365 ydif = newy - oldy; | 369 ydif = newy - oldy; |