Mercurial > hg > early-roguelike
comparison srogue/move.c @ 217:94a0d9dd5ce1
Super-Rogue: convert to ANSI-style function declarations.
This fixes most of the build warnings.
| author | John "Elwin" Edwards |
|---|---|
| date | Sun, 31 Jan 2016 13:45:07 -0500 |
| parents | 2128c7dc8a40 |
| children | e52a8a7ad4c5 |
comparison
equal
deleted
inserted
replaced
| 216:b24545357d2e | 217:94a0d9dd5ce1 |
|---|---|
| 12 * All rights reserved. | 12 * All rights reserved. |
| 13 * | 13 * |
| 14 * See the file LICENSE.TXT for full copyright and licensing information. | 14 * See the file LICENSE.TXT for full copyright and licensing information. |
| 15 */ | 15 */ |
| 16 | 16 |
| 17 #include <string.h> | |
| 17 #include <ctype.h> | 18 #include <ctype.h> |
| 18 #include "rogue.h" | 19 #include "rogue.h" |
| 19 #include "rogue.ext" | 20 #include "rogue.ext" |
| 20 | 21 |
| 21 /* | 22 /* |
| 27 /* | 28 /* |
| 28 * do_run: | 29 * do_run: |
| 29 * Start the hero running | 30 * Start the hero running |
| 30 */ | 31 */ |
| 31 | 32 |
| 32 do_run(ch) | 33 void |
| 33 char ch; | 34 do_run(char ch) |
| 34 { | 35 { |
| 35 running = TRUE; | 36 running = TRUE; |
| 36 after = FALSE; | 37 after = FALSE; |
| 37 runch = ch; | 38 runch = ch; |
| 38 } | 39 } |
| 41 * do_move: | 42 * do_move: |
| 42 * Check to see that a move is legal. If it is handle the | 43 * Check to see that a move is legal. If it is handle the |
| 43 * consequences (fighting, picking up, etc.) | 44 * consequences (fighting, picking up, etc.) |
| 44 */ | 45 */ |
| 45 | 46 |
| 46 do_move(dy, dx) | 47 void |
| 47 int dy, dx; | 48 do_move(int dy, int dx) |
| 48 { | 49 { |
| 49 reg int ch; | 50 reg int ch; |
| 50 reg struct room *rp; | 51 reg struct room *rp; |
| 51 | 52 |
| 52 firstmove = FALSE; | 53 firstmove = FALSE; |
| 207 | 208 |
| 208 /* | 209 /* |
| 209 * Called to illuminate a room. | 210 * Called to illuminate a room. |
| 210 * If it is dark, remove anything that might move. | 211 * If it is dark, remove anything that might move. |
| 211 */ | 212 */ |
| 212 light(cp) | 213 void |
| 213 struct coord *cp; | 214 light(struct coord *cp) |
| 214 { | 215 { |
| 215 reg struct room *rp; | 216 reg struct room *rp; |
| 216 reg int j, k, x, y; | 217 reg int j, k, x, y; |
| 217 reg char ch, rch; | 218 reg char ch, rch; |
| 218 reg struct linked_list *item; | 219 reg struct linked_list *item; |
| 289 | 290 |
| 290 /* | 291 /* |
| 291 * show: | 292 * show: |
| 292 * returns what a certain thing will display as to the un-initiated | 293 * returns what a certain thing will display as to the un-initiated |
| 293 */ | 294 */ |
| 294 show(y, x) | 295 char |
| 295 int y, x; | 296 show(int y, int x) |
| 296 { | 297 { |
| 297 reg char ch = winat(y, x); | 298 reg char ch = winat(y, x); |
| 298 reg struct linked_list *it; | 299 reg struct linked_list *it; |
| 299 reg struct thing *tp; | 300 reg struct thing *tp; |
| 300 reg struct trap *ta; | 301 reg struct trap *ta; |
| 328 | 329 |
| 329 /* | 330 /* |
| 330 * be_trapped: | 331 * be_trapped: |
| 331 * Hero or monster stepped on a trap. | 332 * Hero or monster stepped on a trap. |
| 332 */ | 333 */ |
| 333 be_trapped(tc, th) | 334 int |
| 334 struct thing *th; | 335 be_trapped(struct coord *tc, struct thing *th) |
| 335 struct coord *tc; | |
| 336 { | 336 { |
| 337 reg struct trap *trp; | 337 reg struct trap *trp; |
| 338 reg int ch, ishero; | 338 reg int ch, ishero; |
| 339 struct linked_list *mon; | 339 struct linked_list *mon; |
| 340 char stuckee[35], seeit, sayso; | 340 char stuckee[35], seeit, sayso; |
| 341 | 341 |
| 342 if ((trp = trap_at(tc->y, tc->x)) == NULL) | 342 if ((trp = trap_at(tc->y, tc->x)) == NULL) |
| 343 return; | 343 return 0; |
| 344 ishero = (th == &player); | 344 ishero = (th == &player); |
| 345 if (ishero) { | 345 if (ishero) { |
| 346 strcpy(stuckee, "You"); | 346 strcpy(stuckee, "You"); |
| 347 count = running = FALSE; | 347 count = running = FALSE; |
| 348 } | 348 } |
| 489 goto goner; | 489 goto goner; |
| 490 } | 490 } |
| 491 if ((trp->tr_flags & ISGONE) && rnd(100) < 10) { | 491 if ((trp->tr_flags & ISGONE) && rnd(100) < 10) { |
| 492 nlmove = TRUE; | 492 nlmove = TRUE; |
| 493 if (rnd(100) < 15) | 493 if (rnd(100) < 15) |
| 494 teleport(rndspot); /* teleport away */ | 494 teleport(rndspot, th); /* teleport away */ |
| 495 else if(rnd(100) < 15 && level > 2) { | 495 else if(rnd(100) < 15 && level > 2) { |
| 496 level -= rnd(2) + 1; | 496 level -= rnd(2) + 1; |
| 497 new_level(NORMLEV); | 497 new_level(NORMLEV); |
| 498 msg("You here a faint groan from below."); | 498 msg("You here a faint groan from below."); |
| 499 } | 499 } |
| 517 | 517 |
| 518 /* | 518 /* |
| 519 * dip_it: | 519 * dip_it: |
| 520 * Dip an object into a magic pool | 520 * Dip an object into a magic pool |
| 521 */ | 521 */ |
| 522 dip_it() | 522 void |
| 523 dip_it(void) | |
| 523 { | 524 { |
| 524 reg struct linked_list *what; | 525 reg struct linked_list *what; |
| 525 reg struct object *ob; | 526 reg struct object *ob; |
| 526 reg struct trap *tp; | 527 reg struct trap *tp; |
| 527 reg int wh; | 528 reg int wh; |
| 652 /* | 653 /* |
| 653 * trap_at: | 654 * trap_at: |
| 654 * Find the trap at (y,x) on screen. | 655 * Find the trap at (y,x) on screen. |
| 655 */ | 656 */ |
| 656 struct trap * | 657 struct trap * |
| 657 trap_at(y, x) | 658 trap_at(int y, int x) |
| 658 int y, x; | |
| 659 { | 659 { |
| 660 reg struct trap *tp, *ep; | 660 reg struct trap *tp, *ep; |
| 661 | 661 |
| 662 ep = &traps[ntraps]; | 662 ep = &traps[ntraps]; |
| 663 for (tp = traps; tp < ep; tp += 1) | 663 for (tp = traps; tp < ep; tp += 1) |
| 671 /* | 671 /* |
| 672 * rndmove: | 672 * rndmove: |
| 673 * move in a random direction if the monster/person is confused | 673 * move in a random direction if the monster/person is confused |
| 674 */ | 674 */ |
| 675 struct coord * | 675 struct coord * |
| 676 rndmove(who) | 676 rndmove(struct thing *who) |
| 677 struct thing *who; | |
| 678 { | 677 { |
| 679 reg int x, y, ex, ey, ch; | 678 reg int x, y, ex, ey, ch; |
| 680 int nopen = 0; | 679 int nopen = 0; |
| 681 struct linked_list *item; | 680 struct linked_list *item; |
| 682 static struct coord ret; /* what we will be returning */ | 681 static struct coord ret; /* what we will be returning */ |
| 718 | 717 |
| 719 /* | 718 /* |
| 720 * isatrap: | 719 * isatrap: |
| 721 * Returns TRUE if this character is some kind of trap | 720 * Returns TRUE if this character is some kind of trap |
| 722 */ | 721 */ |
| 723 isatrap(ch) | 722 bool |
| 724 char ch; | 723 isatrap(char ch) |
| 725 { | 724 { |
| 726 switch(ch) { | 725 switch(ch) { |
| 727 case POST: | 726 case POST: |
| 728 case DARTTRAP: | 727 case DARTTRAP: |
| 729 case POOL: | 728 case POOL: |
