コード例 #1
0
ファイル: ui-map.c プロジェクト: pnd10/angband
/**
 * Apply text lighting effects
 */
static void grid_get_attr(grid_data *g, int *a)
{
    feature_type *f_ptr = &f_info[g->f_idx];

	/* Save the high-bit, since it's used for attr inversion in GCU */
	int a0 = *a & 0x80;

	/* Remove the high bit so we can add it back again at the end */
	*a = (*a & 0x7F);

	/* Never play with fg colours for treasure */
	if (!feat_is_treasure(g->f_idx)) {

		/* Tint trap detection borders */
		if (g->trapborder)
			*a = (g->in_view ? COLOUR_L_GREEN : COLOUR_GREEN);

		/* Only apply lighting effects when the attr is white --
		 * this is to stop e.g. doors going grey when out of LOS */
		if (*a == COLOUR_WHITE) {
			/* If it's a floor tile then we'll tint based on lighting. */
			if (tf_has(f_ptr->flags, TF_TORCH))
				switch (g->lighting) {
					case LIGHTING_TORCH: *a = COLOUR_YELLOW; break;
					case LIGHTING_LIT: *a = COLOUR_L_DARK; break;
					case LIGHTING_DARK: *a = COLOUR_L_DARK; break;
					default: break;
				}

			/* If it's another kind of tile, only tint when unlit. */
			else if (g->lighting == LIGHTING_DARK ||
					 g->lighting == LIGHTING_LIT)
				*a = COLOUR_L_DARK;
		} else if (feat_is_magma(g->f_idx) || feat_is_quartz(g->f_idx)) {
			if (!g->in_view) {
				*a = COLOUR_L_DARK;
			}
		}
	}

	/* Hybrid or block walls -- for GCU, then for everyone else */
	if (a0) {
		*a = a0 | *a;
	} else if (use_graphics == GRAPHICS_NONE && feat_is_wall(g->f_idx)) {
		if (OPT(hybrid_walls))
			*a = *a + (MAX_COLORS * BG_DARK);
		else if (OPT(solid_walls))
			*a = *a + (MAX_COLORS * BG_SAME);
	}
}
コード例 #2
0
ファイル: ui-map.c プロジェクト: NickMcConnell/angband
/**
 * Apply text lighting effects
 */
static void grid_get_attr(struct grid_data *g, int *a)
{
	/* Save the high-bit, since it's used for attr inversion in GCU */
	int a0 = *a & 0x80;

	/* Remove the high bit so we can add it back again at the end */
	*a = (*a & 0x7F);

	/* Never play with fg colours for treasure */
	if (!feat_is_treasure(g->f_idx)) {
		/* Only apply lighting effects when the attr is white and it's a 
		 * floor or wall */
		if ((*a == COLOUR_WHITE) &&
			(feat_is_floor(g->f_idx) || feat_is_wall(g->f_idx))) {
			/* If it's a floor tile then we'll tint based on lighting. */
			if (feat_is_torch(g->f_idx))
				switch (g->lighting) {
					case LIGHTING_TORCH: *a = COLOUR_YELLOW; break;
					case LIGHTING_LIT: *a = COLOUR_L_DARK; break;
					case LIGHTING_DARK: *a = COLOUR_L_DARK; break;
					default: break;
				}

			/* If it's another kind of tile, only tint when unlit. */
			else if (g->lighting == LIGHTING_DARK ||
					 g->lighting == LIGHTING_LIT)
				*a = COLOUR_L_DARK;
		} else if (feat_is_magma(g->f_idx) || feat_is_quartz(g->f_idx)) {
			if (!g->in_view) {
				*a = COLOUR_L_DARK;
			}
		}
	}

	/* Hybrid or block walls -- for GCU, then for everyone else */
	if (a0) {
		*a = a0 | *a;
	} else if (use_graphics == GRAPHICS_NONE && feat_is_wall(g->f_idx)) {
		if (OPT(player, hybrid_walls))
			*a = *a + (MAX_COLORS * BG_DARK);
		else if (OPT(player, solid_walls))
			*a = *a + (MAX_COLORS * BG_SAME);
	}
}
コード例 #3
0
/**
 * True if the square is a magma wall.
 */
bool square_ismagma(struct chunk *c, int y, int x)
{
	return feat_is_magma(c->squares[y][x].feat);
}