Changeset 310
- Timestamp:
- 07/08/07 17:11:01 (1 year ago)
- Files:
-
- trunk/src/cave.c (modified) (2 diffs)
- trunk/src/spells2.c (modified) (20 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/cave.c
r305 r310 3367 3367 3368 3368 /* 3369 * Map the current panel (plus some) ala "magic mapping"3369 * Map a radius 30 area around the player. 3370 3370 * 3371 3371 * We must never attempt to map the outer dungeon walls, or we … … 3374 3374 void map_area(void) 3375 3375 { 3376 int i, x, y, y1, y2, x1, x2; 3377 3378 3379 /* Pick an area to map */ 3380 y1 = Term->offset_y - randint(10); 3381 y2 = Term->offset_y + SCREEN_HGT + randint(10); 3382 x1 = Term->offset_x - randint(20); 3383 x2 = Term->offset_x + SCREEN_WID + randint(20); 3384 3385 /* Efficiency -- shrink to fit legal bounds */ 3386 if (y1 < 1) y1 = 1; 3387 if (y2 > DUNGEON_HGT-1) y2 = DUNGEON_HGT-1; 3388 if (x1 < 1) x1 = 1; 3389 if (x2 > DUNGEON_WID-1) x2 = DUNGEON_WID-1; 3390 3391 /* Scan that area */ 3392 for (y = y1; y < y2; y++) 3393 { 3394 for (x = x1; x < x2; x++) 3376 int i, x, y; 3377 3378 /* Scan the dungeon */ 3379 for (y = 1; y < DUNGEON_HGT - 1; y++) 3380 { 3381 for (x = 1; x < DUNGEON_WID - 1; x++) 3395 3382 { 3396 3383 /* All non-walls are "checked" */ 3397 3384 if (cave_feat[y][x] < FEAT_SECRET) 3398 3385 { 3386 if (!in_bounds_fully(y, x)) continue; 3387 3388 /* Restrict to being in a certain radius */ 3389 if (distance(p_ptr->py, p_ptr->px, y, x) > 30) continue; 3390 3399 3391 /* Memorize normal features */ 3400 3392 if (cave_feat[y][x] > FEAT_INVIS) trunk/src/spells2.c
r305 r310 915 915 916 916 917 918 /* 919 * Detect all traps on current panel 917 /* 918 * Old covered area on a 80x24 screen was around 66*22 = 1452 919 * New covered area from circular detection 3.14*22*22 = 1962 920 * 921 * A slight gain, but I think an OK one. 922 */ 923 #define DET_RADIUS 22 924 925 926 /* 927 * Detect all traps inside radius 22. 920 928 */ 921 929 bool detect_traps(void) … … 926 934 927 935 928 /* Scan the current panel*/929 for (y = Term->offset_y; y < Term->offset_y + SCREEN_HGT; y++)930 { 931 for (x = Term->offset_x; x < Term->offset_x + SCREEN_WID; x++)936 /* Scan the dungeon */ 937 for (y = 1; y < DUNGEON_HGT - 1; y++) 938 { 939 for (x = 1; x < DUNGEON_WID - 1; x++) 932 940 { 933 941 if (!in_bounds_fully(y, x)) continue; 942 943 /* Restrict to being in a certain radius */ 944 if (distance(p_ptr->py, p_ptr->px, y, x) > DET_RADIUS) continue; 934 945 935 946 /* Detect invisible traps */ … … 973 984 974 985 /* 975 * Detect all doors on current panel986 * Detect all doors inside radius 22. 976 987 */ 977 988 bool detect_doors(void) … … 982 993 983 994 984 /* Scan the panel*/985 for (y = Term->offset_y; y < Term->offset_y + SCREEN_HGT; y++)986 { 987 for (x = Term->offset_x; x < Term->offset_x + SCREEN_WID; x++)995 /* Scan the dungeon */ 996 for (y = 1; y < DUNGEON_HGT - 1; y++) 997 { 998 for (x = 1; x < DUNGEON_WID - 1; x++) 988 999 { 989 1000 if (!in_bounds_fully(y, x)) continue; 1001 1002 /* Restrict to being in a certain radius */ 1003 if (distance(p_ptr->py, p_ptr->px, y, x) > DET_RADIUS) continue; 990 1004 991 1005 /* Detect secret doors */ … … 1026 1040 1027 1041 /* 1028 * Detect all stairs on current panel1042 * Detect all stairs inside radius 22. 1029 1043 */ 1030 1044 bool detect_stairs(void) … … 1035 1049 1036 1050 1037 /* Scan the panel*/1038 for (y = Term->offset_y; y < Term->offset_y + SCREEN_HGT; y++)1039 { 1040 for (x = Term->offset_x; x < Term->offset_x + SCREEN_WID; x++)1051 /* Scan the dungeon */ 1052 for (y = 1; y < DUNGEON_HGT - 1; y++) 1053 { 1054 for (x = 1; x < DUNGEON_WID - 1; x++) 1041 1055 { 1042 1056 if (!in_bounds_fully(y, x)) continue; 1057 1058 /* Restrict to being in a certain radius */ 1059 if (distance(p_ptr->py, p_ptr->px, y, x) > DET_RADIUS) continue; 1043 1060 1044 1061 /* Detect stairs */ … … 1070 1087 1071 1088 /* 1072 * Detect any treasure on the current panel1089 * Detect any treasure inside radius 22. 1073 1090 */ 1074 1091 bool detect_treasure(void) … … 1079 1096 1080 1097 1081 /* Scan the current panel*/1082 for (y = Term->offset_y; y < Term->offset_y + SCREEN_HGT; y++)1083 { 1084 for (x = Term->offset_x; x < Term->offset_x + SCREEN_WID; x++)1098 /* Scan the dungeon */ 1099 for (y = 1; y < DUNGEON_HGT - 1; y++) 1100 { 1101 for (x = 1; x < DUNGEON_WID - 1; x++) 1085 1102 { 1086 1103 if (!in_bounds_fully(y, x)) continue; 1104 1105 /* Restrict to being in a certain radius */ 1106 if (distance(p_ptr->py, p_ptr->px, y, x) > DET_RADIUS) continue; 1087 1107 1088 1108 /* Notice embedded gold */ … … 1123 1143 1124 1144 /* 1125 * Detect all "gold" objects on the current panel1145 * Detect all "gold" objects inside radius 22. 1126 1146 */ 1127 1147 bool detect_objects_gold(void) … … 1148 1168 1149 1169 /* Only detect nearby objects */ 1150 if ( !panel_contains(y, x)) continue;1170 if (distance(p_ptr->py, p_ptr->px, y, x) > DET_RADIUS) continue; 1151 1171 1152 1172 /* Detect "gold" objects */ … … 1176 1196 1177 1197 /* 1178 * Detect all "normal" objects on the current panel1198 * Detect all "normal" objects inisde radius 22. 1179 1199 */ 1180 1200 bool detect_objects_normal(void) … … 1201 1221 1202 1222 /* Only detect nearby objects */ 1203 if ( !panel_contains(y, x)) continue;1223 if (distance(p_ptr->py, p_ptr->px, y, x) > DET_RADIUS) continue; 1204 1224 1205 1225 /* Detect "real" objects */ … … 1229 1249 1230 1250 /* 1231 * Detect all "magic" objects on the current panel.1251 * Detect all "magic" objects inside radius 22. 1232 1252 * 1233 1253 * This will light up all spaces with "magic" items, including artifacts, … … 1260 1280 1261 1281 /* Only detect nearby objects */ 1262 if ( !panel_contains(y, x)) continue;1282 if (distance(p_ptr->py, p_ptr->px, y, x) > DET_RADIUS) continue; 1263 1283 1264 1284 /* Examine the tval */ … … 1296 1316 1297 1317 /* 1298 * Detect all "normal" monsters on the current panel1318 * Detect all "normal" monsters inside radius 22. 1299 1319 */ 1300 1320 bool detect_monsters_normal(void) … … 1319 1339 1320 1340 /* Only detect nearby monsters */ 1321 if ( !panel_contains(y, x)) continue;1341 if (distance(p_ptr->py, p_ptr->px, y, x) > DET_RADIUS) continue; 1322 1342 1323 1343 /* Detect all non-invisible monsters */ … … 1351 1371 1352 1372 /* 1353 * Detect all "invisible" monsters on current panel1373 * Detect all "invisible" monsters inside radius 22. 1354 1374 */ 1355 1375 bool detect_monsters_invis(void) … … 1375 1395 1376 1396 /* Only detect nearby monsters */ 1377 if ( !panel_contains(y, x)) continue;1397 if (distance(p_ptr->py, p_ptr->px, y, x) > DET_RADIUS) continue; 1378 1398 1379 1399 /* Detect invisible monsters */ … … 1418 1438 1419 1439 /* 1420 * Detect all "evil" monsters on current panel1440 * Detect all "evil" monsters inside radius 22. 1421 1441 */ 1422 1442 bool detect_monsters_evil(void) … … 1442 1462 1443 1463 /* Only detect nearby monsters */ 1444 if ( !panel_contains(y, x)) continue;1464 if (distance(p_ptr->py, p_ptr->px, y, x) > DET_RADIUS) continue; 1445 1465 1446 1466 /* Detect evil monsters */
