Changeset 808

Show
Ignore:
Timestamp:
03/19/08 18:42:43 (5 months ago)
Author:
GabeCunningham
Message:

Fix #222: Display trap detection borders as a colored dot. Thanks to Big Al for the original patch.

Files:

Legend:

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

    r789 r808  
    501501                                        /* Use "gray" */ 
    502502                                        if (*a == TERM_WHITE) *a = TERM_SLATE; 
     503                                        else if (*a == TERM_L_GREEN) *a = TERM_GREEN; 
    503504                                        break; 
    504505                                case GRAPHICS_ADAM_BOLT: 
     
    577578 
    578579 
     580/*  
     581 * Checks if a square is at the (inner) edge of a trap detect area  
     582 */  
     583static bool dtrap_edge(int y, int x)  
     584{  
     585        /* Check if the square is a dtrap in the first place */  
     586        if (!cave_info2[y][x] & CAVE2_DTRAP) return FALSE;  
     587 
     588        /* Check for non-dtrap adjacent grids */  
     589        if (in_bounds(y + 1, x    ) && (!cave_info2[y + 1][x    ] & CAVE2_DTRAP)) return TRUE;  
     590        if (in_bounds(y    , x + 1) && (!cave_info2[y    ][x + 1] & CAVE2_DTRAP)) return TRUE;  
     591        if (in_bounds(y - 1, x    ) && (!cave_info2[y - 1][x    ] & CAVE2_DTRAP)) return TRUE;  
     592        if (in_bounds(y    , x - 1) && (!cave_info2[y    ][x - 1] & CAVE2_DTRAP)) return TRUE;  
     593 
     594        return FALSE;  
     595}  
     596 
     597 
    579598/* 
    580599 * This function takes a pointer to a grid info struct describing the  
     
    623642        c = f_ptr->x_char; 
    624643 
     644        /* Check for trap detection boundaries */ 
     645        if (g->trapborder && g->f_idx == FEAT_FLOOR) a = TERM_L_GREEN; 
     646 
    625647        /* Special lighting effects */ 
    626648        if (g->f_idx <= FEAT_INVIS && view_special_lite) 
     
    630652        if (g->f_idx > FEAT_INVIS && view_granite_lite)  
    631653                special_wall_display(&a, &c, g->in_view, g->f_idx); 
    632  
     654                 
    633655        /* Save the terrain info for the transparency effects */ 
    634656        (*tap) = a; 
     
    809831 
    810832 
     833 
     834 
    811835/* 
    812836 * This function takes a grid location (x, y) and extracts information the 
     
    859883{ 
    860884        object_type *o_ptr; 
    861         byte info
     885        byte info, info2
    862886 
    863887        assert(x < DUNGEON_WID); 
     
    865889 
    866890        info = cave_info[y][x]; 
     891        info2 = cave_info2[y][x]; 
    867892         
    868893        /* Default "clear" values, others will be set later where appropriate. */ 
     
    877902        g->m_idx = (g->is_player) ? 0 : cave_m_idx[y][x]; 
    878903        g->hallucinate = p_ptr->timed[TMD_IMAGE] ? TRUE : FALSE; 
     904        g->trapborder = (dtrap_edge(y, x)) ? TRUE : FALSE; 
    879905 
    880906        /* If the grid is memorised or can currently be seen */ 
     
    38873913 
    38883914 
    3889  
  • trunk/src/spells2.c

    r796 r808  
    10451045                                cave_info[y][x] |= (CAVE_MARK); 
    10461046 
    1047                                 /* Redraw */ 
    1048                                 lite_spot(y, x); 
    1049  
    10501047                                /* We found something to detect */ 
    10511048                                detect = TRUE; 
     
    10561053                } 
    10571054        } 
     1055 
     1056        /* Rescan the map for the new dtrap edge */  
     1057        for (y = y1-1; y < y2+1; y++)  
     1058        {  
     1059                for (x = x1-1; x < x2+1; x++)  
     1060                {  
     1061                        if (!in_bounds_fully(y, x)) continue;  
     1062                  
     1063                        /* Redraw */  
     1064                        lite_spot(y, x);  
     1065                }  
     1066        }  
     1067                  
    10581068 
    10591069        /* Describe */ 
  • trunk/src/types.h

    r789 r808  
    10991099        bool is_player; 
    11001100        bool hallucinate; 
     1101        bool trapborder; 
    11011102} grid_data; 
    11021103