Exemple #1
0
void update_screen(coord x, coord y)
{
  coord sx, sy, px, py;

  /* Find the current general section. */
  get_current_section_coordinates(d.px, d.py, &sx, &sy);

#ifdef UPDATE_PANEL_VIEW
  coord opsx, opsy;

  /* Memorize the old panel view. */
  opsx = d.psx;
  opsy = d.psy;
  
  /* Adjust the panel view. */
  while (sx < d.psx)
    d.psx--;
  while (d.psx + 4 < sx)
    d.psx++;
  while (sy < d.psy)
    d.psy--;
  while (d.psy + 1 < sy)
    d.psy++;

  /* Repaint the whole screen map if necessary. */
  if (opsx != d.psx || opsy != d.psy)
    paint_map();
#endif

  /* Make the immediate surroundings known. */
  for (px = x - 1; px <= x + 1; px++)
    for (py = y - 1; py <= y + 1; py++)
      know(px, py);

  /* Check whether the PC is in a room or not. */
  get_current_section(d.px, d.py, &sx, &sy);

  /* Make rooms known. */
  if (sx != -1 && sy != -1)
    know_section(sx, sy);

  move_dungeon();

  draw_dungeon();
  draw_monsters();
  draw_actor(&d.pa);

  draw_player_status();

  flip();
}
Exemple #2
0
void _draw()
{
    int state = statestack_top();

    io::clear_screen();

    view_t view;

    if (state == STATE_EXAMINE)
    {
        view = compute_view(target_cursor_position(), VIEW_WIDTH, VIEW_HEIGHT,
                            current_dungeon->width, current_dungeon->height);
    }
    else
    {
        view = compute_view(player.pos, VIEW_WIDTH, VIEW_HEIGHT,
                            current_dungeon->width, current_dungeon->height);
    }

    compute_fov(current_dungeon, player.pos.x, player.pos.y);
    draw_dungeon(current_dungeon, view);

    if (inside_view(view, player.pos))
    {
        if (player.flag & CF_INVISIBLE)
            draw_symbol_hilite(player.symbol, player.pos.x - view.x, player.pos.y - view.y);
        else
            draw_symbol(player.symbol, player.pos.x - view.x, player.pos.y - view.y);
    }

    if (state == STATE_EXAMINE || state == STATE_CAST_SPELL || state == STATE_ZAP_WAND)
    {
        draw_target_cursor(view);
    }

    draw_stats();

    erase_msg_buffer();
    flush_turn_log(false);

    io::flush();
}