comparison arogue5/move.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 a0a57cf42810
children e52a8a7ad4c5
comparison
equal deleted inserted replaced
217:94a0d9dd5ce1 218:56e748983fa8
35 /* 35 /*
36 * be_trapped: 36 * be_trapped:
37 * The guy stepped on a trap.... Make him pay. 37 * The guy stepped on a trap.... Make him pay.
38 */ 38 */
39 39
40 be_trapped(th, tc) 40 char
41 register struct thing *th; 41 be_trapped(struct thing *th, coord *tc)
42 register coord *tc;
43 { 42 {
44 register struct trap *tp; 43 register struct trap *tp;
45 register char ch; 44 register char ch;
46 register const char *mname = NULL; 45 register const char *mname = NULL;
47 register bool is_player = (th == &player), 46 register bool is_player = (th == &player),
351 * blue_light: 350 * blue_light:
352 * magically light up a room (or level or make it dark) 351 * magically light up a room (or level or make it dark)
353 */ 352 */
354 353
355 bool 354 bool
356 blue_light(blessed, cursed) 355 blue_light(bool blessed, bool cursed)
357 bool blessed, cursed;
358 { 356 {
359 register struct room *rp; 357 register struct room *rp;
360 bool ret_val=FALSE; /* Whether or not affect is known */ 358 bool ret_val=FALSE; /* Whether or not affect is known */
361 359
362 rp = roomin(&hero); /* What room is hero in? */ 360 rp = roomin(&hero); /* What room is hero in? */
411 * corr_move: 409 * corr_move:
412 * Check to see that a move is legal. If so, return correct character. 410 * Check to see that a move is legal. If so, return correct character.
413 * If not, if player came from a legal place, then try to turn him. 411 * If not, if player came from a legal place, then try to turn him.
414 */ 412 */
415 413
416 corr_move(dy, dx) 414 void
417 int dy, dx; 415 corr_move(int dy, int dx)
418 { 416 {
419 int legal=0; /* Number of legal alternatives */ 417 int legal=0; /* Number of legal alternatives */
420 register int y, x, /* Indexes though possible positions */ 418 register int y, x, /* Indexes though possible positions */
421 locy = 0, locx = 0; /* Hold delta of chosen location */ 419 locy = 0, locx = 0; /* Hold delta of chosen location */
422 420
489 487
490 /* 488 /*
491 * dip_it: 489 * dip_it:
492 * Dip an object into a magic pool 490 * Dip an object into a magic pool
493 */ 491 */
494 dip_it() 492 void
493 dip_it(void)
495 { 494 {
496 reg struct linked_list *what; 495 reg struct linked_list *what;
497 reg struct object *ob; 496 reg struct object *ob;
498 reg struct trap *tp; 497 reg struct trap *tp;
499 reg int wh, i; 498 reg int wh, i;
665 * do_move: 664 * do_move:
666 * Check to see that a move is legal. If it is handle the 665 * Check to see that a move is legal. If it is handle the
667 * consequences (fighting, picking up, etc.) 666 * consequences (fighting, picking up, etc.)
668 */ 667 */
669 668
670 do_move(dy, dx) 669 void
671 int dy, dx; 670 do_move(int dy, int dx)
672 { 671 {
673 register struct room *rp, *orp; 672 register struct room *rp, *orp;
674 register char ch; 673 register char ch;
675 coord old_hero; 674 coord old_hero;
676 int i, wasfirstmove; 675 int i, wasfirstmove;
876 /* 875 /*
877 * do_run: 876 * do_run:
878 * Start the hero running 877 * Start the hero running
879 */ 878 */
880 879
881 do_run(ch) 880 void
882 char ch; 881 do_run(char ch)
883 { 882 {
884 firstmove = TRUE; 883 firstmove = TRUE;
885 running = TRUE; 884 running = TRUE;
886 after = FALSE; 885 after = FALSE;
887 runch = ch; 886 runch = ch;
892 * Takes a movement character (eg. h, j, k, l) and returns the 891 * Takes a movement character (eg. h, j, k, l) and returns the
893 * y and x delta corresponding to it in the remaining arguments. 892 * y and x delta corresponding to it in the remaining arguments.
894 * Returns TRUE if it could find it, FALSE otherwise. 893 * Returns TRUE if it could find it, FALSE otherwise.
895 */ 894 */
896 bool 895 bool
897 getdelta(match, dy, dx) 896 getdelta(char match, int *dy, int *dx)
898 char match;
899 int *dy, *dx;
900 { 897 {
901 register y, x; 898 int y, x;
902 899
903 for (y = 0; y < 3; y++) 900 for (y = 0; y < 3; y++)
904 for (x = 0; x < 3; x++) 901 for (x = 0; x < 3; x++)
905 if (Moves[y][x] == match) { 902 if (Moves[y][x] == match) {
906 *dy = y - 1; 903 *dy = y - 1;
913 910
914 /* 911 /*
915 * isatrap: 912 * isatrap:
916 * Returns TRUE if this character is some kind of trap 913 * Returns TRUE if this character is some kind of trap
917 */ 914 */
918 isatrap(ch) 915 bool
919 reg char ch; 916 isatrap(char ch)
920 { 917 {
921 switch(ch) { 918 switch(ch) {
922 case DARTTRAP: 919 case DARTTRAP:
923 case TELTRAP: 920 case TELTRAP:
924 case TRAPDOOR: 921 case TRAPDOOR:
934 /* 931 /*
935 * Called to illuminate a room. 932 * Called to illuminate a room.
936 * If it is dark, remove anything that might move. 933 * If it is dark, remove anything that might move.
937 */ 934 */
938 935
939 light(cp) 936 void
940 coord *cp; 937 light(coord *cp)
941 { 938 {
942 register struct room *rp; 939 register struct room *rp;
943 register int j, k, x, y; 940 register int j, k, x, y;
944 register char ch, rch, sch; 941 register char ch, rch, sch;
945 register struct linked_list *item; 942 register struct linked_list *item;
1111 * lit_room: 1108 * lit_room:
1112 * Called to see if the specified room is lit up or not. 1109 * Called to see if the specified room is lit up or not.
1113 */ 1110 */
1114 1111
1115 bool 1112 bool
1116 lit_room(rp) 1113 lit_room(struct room *rp)
1117 register struct room *rp;
1118 { 1114 {
1119 register struct linked_list *fire_item; 1115 register struct linked_list *fire_item;
1120 register struct thing *fire_creature; 1116 register struct thing *fire_creature;
1121 1117
1122 if (!(rp->r_flags & ISDARK)) return(TRUE); /* A definitely lit room */ 1118 if (!(rp->r_flags & ISDARK)) return(TRUE); /* A definitely lit room */
1148 * rndmove: 1144 * rndmove:
1149 * move in a random direction if the monster/person is confused 1145 * move in a random direction if the monster/person is confused
1150 */ 1146 */
1151 1147
1152 coord * 1148 coord *
1153 rndmove(who) 1149 rndmove(struct thing *who)
1154 struct thing *who;
1155 { 1150 {
1156 register int x, y; 1151 register int x, y;
1157 register int ex, ey, nopen = 0; 1152 register int ex, ey, nopen = 0;
1158 static coord ret; /* what we will be returning */ 1153 static coord ret; /* what we will be returning */
1159 static coord dest; 1154 static coord dest;
1190 /* 1185 /*
1191 * set_trap: 1186 * set_trap:
1192 * set a trap at (y, x) on screen. 1187 * set a trap at (y, x) on screen.
1193 */ 1188 */
1194 1189
1195 set_trap(tp, y, x) 1190 void
1196 register struct thing *tp; 1191 set_trap(struct thing *tp, int y, int x)
1197 register int y, x;
1198 { 1192 {
1199 register bool is_player = (tp == &player); 1193 register bool is_player = (tp == &player);
1200 register char selection = rnd(7) + '1'; 1194 register char selection = rnd(7) + '1';
1201 register char ch = 0, och; 1195 register char ch = 0, och;
1202 int thief_bonus = 0; 1196 int thief_bonus = 0;
1328 /* 1322 /*
1329 * show: 1323 * show:
1330 * returns what a certain thing will display as to the un-initiated 1324 * returns what a certain thing will display as to the un-initiated
1331 */ 1325 */
1332 1326
1333 show(y, x) 1327 char
1334 register int y, x; 1328 show(int y, int x)
1335 { 1329 {
1336 register char ch = CCHAR( winat(y, x) ); 1330 register char ch = CCHAR( winat(y, x) );
1337 register struct linked_list *it; 1331 register struct linked_list *it;
1338 register struct thing *tp; 1332 register struct thing *tp;
1339 1333
1369 * trap_at: 1363 * trap_at:
1370 * find the trap at (y,x) on screen. 1364 * find the trap at (y,x) on screen.
1371 */ 1365 */
1372 1366
1373 struct trap * 1367 struct trap *
1374 trap_at(y, x) 1368 trap_at(int y, int x)
1375 register int y, x;
1376 { 1369 {
1377 register struct trap *tp, *ep; 1370 register struct trap *tp, *ep;
1378 1371
1379 ep = &traps[ntraps]; 1372 ep = &traps[ntraps];
1380 for (tp = traps; tp < ep; tp++) 1373 for (tp = traps; tp < ep; tp++)