Ejemplo n.º 1
0
void Floor::display_walls() {
   if (tt_programmer->floor_not_scrollable()) return;
   if (at_front_wall) {
      if (at_left_wall) {
         display_wall(LEFT_CORNER_SPRITE);
      } else if (at_right_wall) {
         display_wall(RIGHT_CORNER_SPRITE);
      } else {
         display_wall(FRONT_WALL_SPRITE);
      };
   };
};
Ejemplo n.º 2
0
void			engine(t_data *d)
{
	int		count;
	float	ray_a;
	float	int_h;
	float	int_v;
	float	w_dis;

	count = 0;
	while (count != WIDTH)
	{
		ray_a = d->p.a - (FOV / 2) + ((float)count * SUBRAY);
		ray_a += (ray_a < 0) ? 360 : 0;
		ray_a -= (ray_a >= 360) ? 360 : 0;
		int_h = ray_caster_h(d, ray_a);
		int_v = ray_caster_v(d, ray_a);
		if (int_h < int_v)
			d->l.color = (ray_a <= WEST) ? BLUE : RED;
		else
			d->l.color = (ray_a <= NORTH || ray_a > SOUTH) ? GREEN : YELLOW;
		w_dis = (int_h < int_v) ? int_h : int_v;
		display_wall(d, w_dis, count);
		count++;
	}
}
Ejemplo n.º 3
0
// Pretty-prints the tile at the given position.
static void display_tile(Coords pos)
{
	Tile *tile = &TILE(pos);

	int light = shadowed(pos) ? 0 :
		L2(pos - player.pos) <= player.radius ? 7777 :
		min(tile->light, 7777);
	printf("\033[38;5;%dm", 232 + light / 338);
	print_at(pos, tile_glyphs[tile->type]);

	if (IS_DIGGABLE(pos) && !IS_DOOR(pos))
		display_wall(pos);
	if (IS_WIRE(pos) && !IS_DOOR(pos))
		display_wire(pos);
	if (tile->item)
		print_at(pos, item_glyphs[tile->item]);
	if (!tile->revealed)
		print_at(pos, " ");
}