comparison xrogue/move.c @ 304:e52a8a7ad4c5

Fix many compiler warnings. There should only be two changes in behavior: arogue7/fight.c, arogue7/fight.c: a to-hit bonus is now correctly applied to characters who are not monks instead of monks who are not empty-handed. urogue/fight.c: fixed an interaction with the "debug" macro that could cause the wrong message to be displayed.
author John "Elwin" Edwards
date Wed, 14 Apr 2021 18:55:33 -0400
parents f54901b9c39b
children
comparison
equal deleted inserted replaced
303:e06ebc407615 304:e52a8a7ad4c5
317 rnd_pos(&rooms[rm], &th->t_pos); 317 rnd_pos(&rooms[rm], &th->t_pos);
318 } until(winat(th->t_pos.y, th->t_pos.x) == FLOOR); 318 } until(winat(th->t_pos.y, th->t_pos.x) == FLOOR);
319 319
320 /* Put it there */ 320 /* Put it there */
321 mvwaddch(mw, th->t_pos.y, th->t_pos.x, th->t_type); 321 mvwaddch(mw, th->t_pos.y, th->t_pos.x, th->t_type);
322 th->t_oldch = mvwinch(cw, th->t_pos.y, th->t_pos.x); 322 th->t_oldch = mvwinch(cw, th->t_pos.y, th->t_pos.x) & A_CHARTEXT;
323 /* 323 /*
324 * check to see if room that creature appears in should 324 * check to see if room that creature appears in should
325 * light up 325 * light up
326 */ 326 */
327 if (on(*th, HASFIRE)) { 327 if (on(*th, HASFIRE)) {
883 player.t_action = A_NIL; 883 player.t_action = A_NIL;
884 return; 884 return;
885 } 885 }
886 if (running && ce(hero, move_nh)) 886 if (running && ce(hero, move_nh))
887 after = running = FALSE; 887 after = running = FALSE;
888 ch = winat(move_nh.y, move_nh.x); 888 ch = winat(move_nh.y, move_nh.x) & A_CHARTEXT;
889 889
890 /* Take care of hero trying to move close to something frightening */ 890 /* Take care of hero trying to move close to something frightening */
891 if (on(player, ISFLEE)) { 891 if (on(player, ISFLEE)) {
892 if (rnd(100) < 12) { 892 if (rnd(100) < 12) {
893 turn_off(player, ISFLEE); 893 turn_off(player, ISFLEE);
967 do_chase(tp); 967 do_chase(tp);
968 968
969 /* Did we succeed? */ 969 /* Did we succeed? */
970 if (ce(tp->t_pos, current)) { 970 if (ce(tp->t_pos, current)) {
971 /* Reset our idea of what ch is */ 971 /* Reset our idea of what ch is */
972 ch = winat(move_nh.y, move_nh.x); 972 ch = winat(move_nh.y, move_nh.x) & A_CHARTEXT;
973 973
974 /* Let it be known that we made the switch */ 974 /* Let it be known that we made the switch */
975 changed = TRUE; 975 changed = TRUE;
976 old_hero = current; 976 old_hero = current;
977 977
1138 /* Are we moving out of a corridor? */ 1138 /* Are we moving out of a corridor? */
1139 switch (runch) { 1139 switch (runch) {
1140 case 'h': 1140 case 'h':
1141 case 'l': 1141 case 'l':
1142 if (old_hero.y + 1 < lines - 2) { 1142 if (old_hero.y + 1 < lines - 2) {
1143 wall_check = winat(old_hero.y + 1, old_hero.x); 1143 wall_check = winat(old_hero.y + 1, old_hero.x) & A_CHARTEXT;
1144 if (!isrock(wall_check)) call_light = TRUE; 1144 if (!isrock(wall_check)) call_light = TRUE;
1145 } 1145 }
1146 if (old_hero.y - 1 > 0) { 1146 if (old_hero.y - 1 > 0) {
1147 wall_check = winat(old_hero.y - 1, old_hero.x); 1147 wall_check = winat(old_hero.y - 1, old_hero.x) & A_CHARTEXT;
1148 if (!isrock(wall_check)) call_light = TRUE; 1148 if (!isrock(wall_check)) call_light = TRUE;
1149 } 1149 }
1150 break; 1150 break;
1151 case 'j': 1151 case 'j':
1152 case 'k': 1152 case 'k':
1153 if (old_hero.x + 1 < cols) { 1153 if (old_hero.x + 1 < cols) {
1154 wall_check = winat(old_hero.y, old_hero.x + 1); 1154 wall_check = winat(old_hero.y, old_hero.x + 1) & A_CHARTEXT;
1155 if (!isrock(wall_check)) call_light = TRUE; 1155 if (!isrock(wall_check)) call_light = TRUE;
1156 } 1156 }
1157 if (old_hero.x - 1 >= 0) { 1157 if (old_hero.x - 1 >= 0) {
1158 wall_check = winat(old_hero.y, old_hero.x - 1); 1158 wall_check = winat(old_hero.y, old_hero.x - 1) & A_CHARTEXT;
1159 if (!isrock(wall_check)) call_light = TRUE; 1159 if (!isrock(wall_check)) call_light = TRUE;
1160 } 1160 }
1161 break; 1161 break;
1162 default: 1162 default:
1163 call_light = TRUE; 1163 call_light = TRUE;
1175 else if (rp != NULL && orp == NULL){/* Entering a room */ 1175 else if (rp != NULL && orp == NULL){/* Entering a room */
1176 light(&hero); 1176 light(&hero);
1177 if (rp->r_flags & ISTREAS) 1177 if (rp->r_flags & ISTREAS)
1178 wake_room(rp); 1178 wake_room(rp);
1179 } 1179 }
1180 ch = winat(old_hero.y, old_hero.x); 1180 ch = winat(old_hero.y, old_hero.x) & A_CHARTEXT;
1181 wmove(cw, unc(old_hero)); 1181 wmove(cw, unc(old_hero));
1182 waddch(cw, ch); 1182 waddch(cw, ch);
1183 wmove(cw, unc(hero)); 1183 wmove(cw, unc(hero));
1184 waddch(cw, PLAYER); 1184 waddch(cw, PLAYER);
1185 } 1185 }
1270 1270
1271 see_radius = 1; 1271 see_radius = 1;
1272 1272
1273 /* If we are looking at the hero in a rock, broaden our sights */ 1273 /* If we are looking at the hero in a rock, broaden our sights */
1274 if (&hero == cp || &player.t_oldpos == cp) { 1274 if (&hero == cp || &player.t_oldpos == cp) {
1275 ch = winat(hero.y, hero.x); 1275 ch = winat(hero.y, hero.x) & A_CHARTEXT;
1276 if (isrock(ch)) see_radius = 2; 1276 if (isrock(ch)) see_radius = 2;
1277 ch = winat(player.t_oldpos.y, player.t_oldpos.x); 1277 ch = winat(player.t_oldpos.y, player.t_oldpos.x) & A_CHARTEXT;
1278 if (isrock(ch)) see_radius = 2; 1278 if (isrock(ch)) see_radius = 2;
1279 } 1279 }
1280 1280
1281 jlow = max(0, cp->y - see_radius - rp->r_pos.y); 1281 jlow = max(0, cp->y - see_radius - rp->r_pos.y);
1282 jhigh = min(rp->r_max.y, cp->y + see_radius + 1 - rp->r_pos.y); 1282 jhigh = min(rp->r_max.y, cp->y + see_radius + 1 - rp->r_pos.y);
1345 item = wake_monster(y, x); 1345 item = wake_monster(y, x);
1346 tp = THINGPTR(item); 1346 tp = THINGPTR(item);
1347 1347
1348 /* Previously not seen -- now can see it */ 1348 /* Previously not seen -- now can see it */
1349 if (tp->t_oldch == ' ' && cansee(tp->t_pos.y, tp->t_pos.x)) 1349 if (tp->t_oldch == ' ' && cansee(tp->t_pos.y, tp->t_pos.x))
1350 tp->t_oldch = mvinch(y, x); 1350 tp->t_oldch = mvinch(y, x) & A_CHARTEXT;
1351 1351
1352 /* Previously seen -- now can't see it */ 1352 /* Previously seen -- now can't see it */
1353 else if (!cansee(tp->t_pos.y, tp->t_pos.x) && 1353 else if (!cansee(tp->t_pos.y, tp->t_pos.x) &&
1354 roomin(&tp->t_pos) != NULL) 1354 roomin(&tp->t_pos) != NULL)
1355 switch (tp->t_oldch) { 1355 switch (tp->t_oldch) {
1377 if ((!lit_room(rp) && (levtype != OUTSIDE)) || 1377 if ((!lit_room(rp) && (levtype != OUTSIDE)) ||
1378 (levtype == OUTSIDE && !daytime) || 1378 (levtype == OUTSIDE && !daytime) ||
1379 on(player, ISBLIND) || 1379 on(player, ISBLIND) ||
1380 (rp->r_flags & FORCEDARK) || 1380 (rp->r_flags & FORCEDARK) ||
1381 (levtype == MAZELEV && !see_here && see_before)) { 1381 (levtype == MAZELEV && !see_here && see_before)) {
1382 sch = mvwinch(cw, y, x); /* What's seen */ 1382 sch = mvwinch(cw, y, x) & A_CHARTEXT; /* What's seen */
1383 rch = mvinch(y, x); /* What's really there */ 1383 rch = mvinch(y, x) & A_CHARTEXT; /* What's really there */
1384 switch (rch) { 1384 switch (rch) {
1385 case DOOR: 1385 case DOOR:
1386 case SECRETDOOR: 1386 case SECRETDOOR:
1387 case STAIRS: 1387 case STAIRS:
1388 case TRAPDOOR: 1388 case TRAPDOOR:
1596 if (is_player && player.t_ctype != C_THIEF && player.t_ctype !=C_ASSASSIN) { 1596 if (is_player && player.t_ctype != C_THIEF && player.t_ctype !=C_ASSASSIN) {
1597 msg("Only thieves and assassins can set traps. "); 1597 msg("Only thieves and assassins can set traps. ");
1598 return; 1598 return;
1599 } 1599 }
1600 can_traps: 1600 can_traps:
1601 switch (och = mvinch(y, x)) { 1601 switch (och = mvinch(y, x) & A_CHARTEXT) {
1602 case WALL: 1602 case WALL:
1603 case FLOOR: 1603 case FLOOR:
1604 case PASSAGE: 1604 case PASSAGE:
1605 break; 1605 break;
1606 default: 1606 default:
1773 */ 1773 */
1774 1774
1775 char 1775 char
1776 show(int y, int x) 1776 show(int y, int x)
1777 { 1777 {
1778 register unsigned char ch = winat(y, x); 1778 register unsigned char ch = winat(y, x) & A_CHARTEXT;
1779 register struct linked_list *it; 1779 register struct linked_list *it;
1780 register struct thing *tp; 1780 register struct thing *tp;
1781 1781
1782 if (isatrap(ch)) { 1782 if (isatrap(ch)) {
1783 register struct trap *trp = trap_at(y, x); 1783 register struct trap *trp = trap_at(y, x);
1785 return (trp->tr_flags & ISFOUND) ? ch : trp->tr_show; 1785 return (trp->tr_flags & ISFOUND) ? ch : trp->tr_show;
1786 } 1786 }
1787 else if (isalpha(ch)) { 1787 else if (isalpha(ch)) {
1788 if ((it = find_mons(y, x)) == NULL) { 1788 if ((it = find_mons(y, x)) == NULL) {
1789 msg("Show: Can't find monster in show (%d, %d)", y, x); 1789 msg("Show: Can't find monster in show (%d, %d)", y, x);
1790 return(mvwinch(stdscr, y, x)); 1790 return(mvwinch(stdscr, y, x) & A_CHARTEXT);
1791 } 1791 }
1792 tp = THINGPTR(it); 1792 tp = THINGPTR(it);
1793 1793
1794 if (on(*tp, ISDISGUISE)) ch = tp->t_disguise; /* As a mimic */ 1794 if (on(*tp, ISDISGUISE)) ch = tp->t_disguise; /* As a mimic */
1795 1795
1796 /* Hide invisible creatures */ 1796 /* Hide invisible creatures */
1797 else if (invisible(tp)) { 1797 else if (invisible(tp)) {
1798 /* We can't see surprise-type creatures through "see invisible" */ 1798 /* We can't see surprise-type creatures through "see invisible" */
1799 if (off(player,CANSEE) || on(*tp,CANSURPRISE)) 1799 if (off(player,CANSEE) || on(*tp,CANSURPRISE))
1800 ch = mvwinch(stdscr, y, x); /* Invisible */ 1800 ch = mvwinch(stdscr, y, x) & A_CHARTEXT; /* Invisible */
1801 } 1801 }
1802 else if (on(*tp, CANINWALL)) { 1802 else if (on(*tp, CANINWALL)) {
1803 if (isrock(mvwinch(stdscr, y, x))) ch = winch(stdscr); /* As Xorn */ 1803 if (isrock(mvwinch(stdscr, y, x))) ch = winch(stdscr); /* As Xorn */
1804 } 1804 }
1805 } 1805 }