Mercurial > hg > early-roguelike
comparison arogue7/io.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 |
---|---|
28 */ | 28 */ |
29 | 29 |
30 static char msgbuf[BUFSIZ]; | 30 static char msgbuf[BUFSIZ]; |
31 static int newpos = 0; | 31 static int newpos = 0; |
32 | 32 |
33 void doadd(char *fmt, va_list ap); | |
34 | |
33 /*VARARGS1*/ | 35 /*VARARGS1*/ |
36 void | |
34 msg(char *fmt, ...) | 37 msg(char *fmt, ...) |
35 { | 38 { |
36 va_list ap; | 39 va_list ap; |
37 /* | 40 /* |
38 * if the string is "", just clear the line | 41 * if the string is "", just clear the line |
56 } | 59 } |
57 | 60 |
58 /* | 61 /* |
59 * add things to the current message | 62 * add things to the current message |
60 */ | 63 */ |
64 void | |
61 addmsg(char *fmt, ...) | 65 addmsg(char *fmt, ...) |
62 { | 66 { |
63 va_list ap; | 67 va_list ap; |
64 | 68 |
65 va_start(ap, fmt); | 69 va_start(ap, fmt); |
69 | 73 |
70 /* | 74 /* |
71 * Display a new msg (giving him a chance to see the previous one if it | 75 * Display a new msg (giving him a chance to see the previous one if it |
72 * is up there with the --More--) | 76 * is up there with the --More--) |
73 */ | 77 */ |
74 endmsg() | 78 void |
79 endmsg(void) | |
75 { | 80 { |
76 /* Needed to track where we are for 5.0 (PC) curses */ | 81 /* Needed to track where we are for 5.0 (PC) curses */ |
77 register int x, y; | 82 register int x, y; |
78 | 83 |
79 strcpy(huh, msgbuf); | 84 strcpy(huh, msgbuf); |
109 draw(cw); | 114 draw(cw); |
110 clearok(msgw, FALSE); | 115 clearok(msgw, FALSE); |
111 draw(msgw); | 116 draw(msgw); |
112 } | 117 } |
113 | 118 |
119 void | |
114 doadd(char *fmt, va_list ap) | 120 doadd(char *fmt, va_list ap) |
115 { | 121 { |
116 | 122 |
117 /* | 123 /* |
118 * Do the printf into buf | 124 * Do the printf into buf |
125 * step_ok: | 131 * step_ok: |
126 * returns true if it is ok for type to step on ch | 132 * returns true if it is ok for type to step on ch |
127 * flgptr will be NULL if we don't know what the monster is yet! | 133 * flgptr will be NULL if we don't know what the monster is yet! |
128 */ | 134 */ |
129 | 135 |
130 step_ok(y, x, can_on_monst, flgptr) | 136 bool |
131 register int y, x, can_on_monst; | 137 step_ok(int y, int x, int can_on_monst, struct thing *flgptr) |
132 register struct thing *flgptr; | |
133 { | 138 { |
134 /* can_on_monst = MONSTOK if all we care about are physical obstacles */ | 139 /* can_on_monst = MONSTOK if all we care about are physical obstacles */ |
135 register struct linked_list *item; | 140 register struct linked_list *item; |
136 register struct thing *tp; | 141 register struct thing *tp; |
137 char ch; | 142 char ch; |
186 /* | 191 /* |
187 * shoot_ok: | 192 * shoot_ok: |
188 * returns true if it is ok for type to shoot over ch | 193 * returns true if it is ok for type to shoot over ch |
189 */ | 194 */ |
190 | 195 |
191 shoot_ok(ch) | 196 bool |
197 shoot_ok(char ch) | |
192 { | 198 { |
193 switch (ch) | 199 switch (ch) |
194 { | 200 { |
195 case ' ': | 201 case ' ': |
196 case '|': | 202 case '|': |
207 * readchar: | 213 * readchar: |
208 * flushes stdout so that screen is up to date and then returns | 214 * flushes stdout so that screen is up to date and then returns |
209 * getchar. | 215 * getchar. |
210 */ | 216 */ |
211 | 217 |
212 readchar() | 218 int |
219 readchar(void) | |
213 { | 220 { |
214 int ch; | 221 int ch; |
215 | 222 |
216 ch = md_readchar(cw); | 223 ch = md_readchar(cw); |
217 | 224 |
225 } | 232 } |
226 | 233 |
227 /* | 234 /* |
228 * status: | 235 * status: |
229 * Display the important stats line. Keep the cursor where it was. | 236 * Display the important stats line. Keep the cursor where it was. |
230 */ | 237 * display: if TRUE, display unconditionally |
231 | 238 */ |
232 status(display) | 239 |
233 bool display; /* is TRUE, display unconditionally */ | 240 void |
241 status(bool display) | |
234 { | 242 { |
235 register struct stats *stat_ptr, *max_ptr; | 243 register struct stats *stat_ptr, *max_ptr; |
236 register int oy, ox, temp; | 244 register int oy, ox, temp; |
237 register char *pb; | 245 register char *pb; |
238 static char buf[LINELEN]; | 246 static char buf[LINELEN]; |
356 | 364 |
357 /* | 365 /* |
358 * wait_for | 366 * wait_for |
359 * Sit around until the guy types the right key | 367 * Sit around until the guy types the right key |
360 */ | 368 */ |
361 wait_for(ch) | 369 void |
362 register char ch; | 370 wait_for(char ch) |
363 { | 371 { |
364 register char c; | 372 register char c; |
365 | 373 |
366 if (ch == '\n') | 374 if (ch == '\n') |
367 while ((c = wgetch(msgw)) != '\n' && c != '\r') | 375 while ((c = wgetch(msgw)) != '\n' && c != '\r') |
381 * pertain only the the useful information to be displayed. | 389 * pertain only the the useful information to be displayed. |
382 * If redraw is non-zero, we wait for the character "redraw" to be | 390 * If redraw is non-zero, we wait for the character "redraw" to be |
383 * typed and then redraw the starting screen. | 391 * typed and then redraw the starting screen. |
384 */ | 392 */ |
385 | 393 |
386 over_win(oldwin, newin, maxy, maxx, cursory, cursorx, redraw) | 394 void |
387 WINDOW *oldwin, *newin; | 395 over_win(WINDOW *oldwin, WINDOW *newin, int maxy, int maxx, int cursory, |
388 int maxy, maxx, cursory, cursorx; | 396 int cursorx, char redraw) |
389 char redraw; | |
390 { | 397 { |
391 static char blanks[LINELEN+1]; | 398 static char blanks[LINELEN+1]; |
392 register int line, i; | 399 register int line, i; |
393 WINDOW *ow; /* Overlay window */ | 400 WINDOW *ow; /* Overlay window */ |
394 | 401 |
434 /* | 441 /* |
435 * show_win: | 442 * show_win: |
436 * function used to display a window and wait before returning | 443 * function used to display a window and wait before returning |
437 */ | 444 */ |
438 | 445 |
439 show_win(scr, message) | 446 void |
440 register WINDOW *scr; | 447 show_win(WINDOW *scr, char *message) |
441 char *message; | |
442 { | 448 { |
443 mvwaddstr(scr, 0, 0, message); | 449 mvwaddstr(scr, 0, 0, message); |
444 touchwin(scr); | 450 touchwin(scr); |
445 wmove(scr, hero.y, hero.x); | 451 wmove(scr, hero.y, hero.x); |
446 draw(scr); | 452 draw(scr); |
451 | 457 |
452 /* | 458 /* |
453 * dbotline: | 459 * dbotline: |
454 * Displays message on bottom line and waits for a space to return | 460 * Displays message on bottom line and waits for a space to return |
455 */ | 461 */ |
456 dbotline(scr,message) | 462 void |
457 WINDOW *scr; | 463 dbotline(WINDOW *scr, char *message) |
458 char *message; | |
459 { | 464 { |
460 mvwaddstr(scr,lines-1,0,message); | 465 mvwaddstr(scr,lines-1,0,message); |
461 draw(scr); | 466 draw(scr); |
462 wait_for(' '); | 467 wait_for(' '); |
463 } | 468 } |
465 | 470 |
466 /* | 471 /* |
467 * restscr: | 472 * restscr: |
468 * Restores the screen to the terminal | 473 * Restores the screen to the terminal |
469 */ | 474 */ |
470 restscr(scr) | 475 void |
471 WINDOW *scr; | 476 restscr(WINDOW *scr) |
472 { | 477 { |
473 clearok(scr,TRUE); | 478 clearok(scr,TRUE); |
474 touchwin(scr); | 479 touchwin(scr); |
475 } | 480 } |
476 | 481 |
479 * Read a byte, short, or long machine independently | 484 * Read a byte, short, or long machine independently |
480 * Always returns the value as an unsigned long. | 485 * Always returns the value as an unsigned long. |
481 */ | 486 */ |
482 | 487 |
483 unsigned long | 488 unsigned long |
484 netread(error, size, stream) | 489 netread(int *error, int size, FILE *stream) |
485 int *error; | |
486 int size; | |
487 FILE *stream; | |
488 { | 490 { |
489 unsigned long result = 0L, /* What we read in */ | 491 unsigned long result = 0L, /* What we read in */ |
490 partial; /* Partial value */ | 492 partial; /* Partial value */ |
491 int nextc, /* The next byte */ | 493 int nextc, /* The next byte */ |
492 i; /* To index through the result a byte at a time */ | 494 i; /* To index through the result a byte at a time */ |
517 | 519 |
518 | 520 |
519 /* | 521 /* |
520 * netwrite: | 522 * netwrite: |
521 * Write out a byte, short, or long machine independently. | 523 * Write out a byte, short, or long machine independently. |
522 */ | 524 * value: What to write |
523 | 525 * size: How much to write out |
524 netwrite(value, size, stream) | 526 * stream: Where to write it |
525 unsigned long value; /* What to write */ | 527 */ |
526 int size; /* How much to write out */ | 528 |
527 FILE *stream; /* Where to write it */ | 529 int |
530 netwrite(unsigned long value, int size, FILE *stream) | |
528 { | 531 { |
529 int i; /* Goes through value one byte at a time */ | 532 int i; /* Goes through value one byte at a time */ |
530 char outc; /* The next character to be written */ | 533 char outc; /* The next character to be written */ |
531 | 534 |
532 /* Be sure we have a right sized chunk */ | 535 /* Be sure we have a right sized chunk */ |