Ticket #710: rect-telepathy.patch

File rect-telepathy.patch, 2.1 KB (added by rhinocesaurus, 11 years ago)

Ok, this patch makes ESP rectangular. Moved the rectangular detection constants to defines.h, hope that's the best place to put them - I'm new at this.

  • src/defines.h

     
    287287#define MAX_SIGHT       20      /* Maximum view distance */ 
    288288#define MAX_RANGE       18      /* Maximum range (spells, etc) */ 
    289289 
     290/* 
     291 * Useful constants for the area around the player to detect. 
     292 * This is instead of using circular detection spells. 
     293 */ 
     294#define DETECT_DIST_X   40      /* Detect 40 grids to the left & right */ 
     295#define DETECT_DIST_Y   22      /* Detect 22 grids to the top & bottom */ 
    290296 
    291297 
    292298/* 
  • src/monster/monster2.c

     
    10231023 
    10241024        monster_lore *l_ptr = &l_list[m_ptr->r_idx]; 
    10251025 
    1026         int d; 
     1026        int d, dy, dx; 
    10271027 
    10281028        /* Current location */ 
    10291029        int fy = m_ptr->fy; 
     
    10341034 
    10351035        /* Seen by vision */ 
    10361036        bool easy = FALSE; 
     1037                 
     1038        /* Extract player location */ 
     1039        int py = p_ptr->py; 
     1040        int px = p_ptr->px; 
    10371041 
     1042        /* Distance components */ 
     1043        dy = (py > fy) ? (py - fy) : (fy - py); 
     1044        dx = (px > fx) ? (px - fx) : (fx - px); 
    10381045 
    10391046        /* Compute distance */ 
    10401047        if (full) 
    10411048        { 
    1042                 int py = p_ptr->py; 
    1043                 int px = p_ptr->px; 
    1044  
    1045                 /* Distance components */ 
    1046                 int dy = (py > fy) ? (py - fy) : (fy - py); 
    1047                 int dx = (px > fx) ? (px - fx) : (fx - px); 
    1048  
    10491049                /* Approximate distance */ 
    10501050                d = (dy > dx) ? (dy + (dx>>1)) : (dx + (dy>>1)); 
    10511051 
     
    10691069 
    10701070 
    10711071        /* Nearby */ 
    1072         if (d <= MAX_SIGHT) 
     1072        if (dx <= DETECT_DIST_X && dy <= DETECT_DIST_Y) 
    10731073        { 
    10741074                /* Basic telepathy */ 
    10751075                if (p_ptr->state.telepathy) 
  • src/spells2.c

     
    888888 
    889889/*** Detection spells ***/ 
    890890 
    891 /* 
    892  * Useful constants for the area around the player to detect. 
    893  * This is instead of using circular detection spells. 
    894  */ 
    895 #define DETECT_DIST_X   40      /* Detect 42 grids to the left & right */ 
    896 #define DETECT_DIST_Y   22      /* Detect 22 grids to the top & bottom */ 
    897891 
    898  
    899  
    900892/* 
    901893 * Map an area around the player. 
    902894 *