Changeset 310

Show
Ignore:
Timestamp:
07/08/07 17:11:01 (1 year ago)
Author:
takkaria
Message:

Make magic mapping circular (radius 30) and detections circular (radius 22). (closes #18)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/cave.c

    r305 r310  
    33673367 
    33683368/* 
    3369  * Map the current panel (plus some) ala "magic mapping" 
     3369 * Map a radius 30 area around the player. 
    33703370 * 
    33713371 * We must never attempt to map the outer dungeon walls, or we 
     
    33743374void map_area(void) 
    33753375{ 
    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++) 
    33953382                { 
    33963383                        /* All non-walls are "checked" */ 
    33973384                        if (cave_feat[y][x] < FEAT_SECRET) 
    33983385                        { 
     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 
    33993391                                /* Memorize normal features */ 
    34003392                                if (cave_feat[y][x] > FEAT_INVIS) 
  • trunk/src/spells2.c

    r305 r310  
    915915 
    916916 
    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. 
    920928 */ 
    921929bool detect_traps(void) 
     
    926934 
    927935 
    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++) 
    932940                { 
    933941                        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; 
    934945 
    935946                        /* Detect invisible traps */ 
     
    973984 
    974985/* 
    975  * Detect all doors on current panel 
     986 * Detect all doors inside radius 22. 
    976987 */ 
    977988bool detect_doors(void) 
     
    982993 
    983994 
    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++) 
    988999                { 
    9891000                        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; 
    9901004 
    9911005                        /* Detect secret doors */ 
     
    10261040 
    10271041/* 
    1028  * Detect all stairs on current panel 
     1042 * Detect all stairs inside radius 22. 
    10291043 */ 
    10301044bool detect_stairs(void) 
     
    10351049 
    10361050 
    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++) 
    10411055                { 
    10421056                        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; 
    10431060 
    10441061                        /* Detect stairs */ 
     
    10701087 
    10711088/* 
    1072  * Detect any treasure on the current panel 
     1089 * Detect any treasure inside radius 22. 
    10731090 */ 
    10741091bool detect_treasure(void) 
     
    10791096 
    10801097 
    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++) 
    10851102                { 
    10861103                        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; 
    10871107 
    10881108                        /* Notice embedded gold */ 
     
    11231143 
    11241144/* 
    1125  * Detect all "gold" objects on the current panel 
     1145 * Detect all "gold" objects inside radius 22. 
    11261146 */ 
    11271147bool detect_objects_gold(void) 
     
    11481168 
    11491169                /* 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; 
    11511171 
    11521172                /* Detect "gold" objects */ 
     
    11761196 
    11771197/* 
    1178  * Detect all "normal" objects on the current panel 
     1198 * Detect all "normal" objects inisde radius 22. 
    11791199 */ 
    11801200bool detect_objects_normal(void) 
     
    12011221 
    12021222                /* 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; 
    12041224 
    12051225                /* Detect "real" objects */ 
     
    12291249 
    12301250/* 
    1231  * Detect all "magic" objects on the current panel
     1251 * Detect all "magic" objects inside radius 22
    12321252 * 
    12331253 * This will light up all spaces with "magic" items, including artifacts, 
     
    12601280 
    12611281                /* 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; 
    12631283 
    12641284                /* Examine the tval */ 
     
    12961316 
    12971317/* 
    1298  * Detect all "normal" monsters on the current panel 
     1318 * Detect all "normal" monsters inside radius 22. 
    12991319 */ 
    13001320bool detect_monsters_normal(void) 
     
    13191339 
    13201340                /* 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; 
    13221342 
    13231343                /* Detect all non-invisible monsters */ 
     
    13511371 
    13521372/* 
    1353  * Detect all "invisible" monsters on current panel 
     1373 * Detect all "invisible" monsters inside radius 22. 
    13541374 */ 
    13551375bool detect_monsters_invis(void) 
     
    13751395 
    13761396                /* 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; 
    13781398 
    13791399                /* Detect invisible monsters */ 
     
    14181438 
    14191439/* 
    1420  * Detect all "evil" monsters on current panel 
     1440 * Detect all "evil" monsters inside radius 22. 
    14211441 */ 
    14221442bool detect_monsters_evil(void) 
     
    14421462 
    14431463                /* 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; 
    14451465 
    14461466                /* Detect evil monsters */