예제 #1
0
파일: stars.c 프로젝트: jolfzverb/mininim
static struct star *
star_coord (struct pos *p, int i, struct star *s)
{
  s->x = PLACE_WIDTH * p->place + 16 + prandom_pos_uniq (p, 2 * i, 1, 28);
  s->y = PLACE_HEIGHT * p->floor - 3 + prandom_pos_uniq (p, 2 * i + 1, 1, 21);
  return s;
}
예제 #2
0
파일: stars.c 프로젝트: allisson128/mininim
void
draw_princess_room_stars (ALLEGRO_BITMAP *bitmap, enum vm vm)
{
  int i, min_x = INT_MAX, min_y = INT_MAX,
    max_x = INT_MIN, max_y = INT_MIN;

  static struct star s[6] = {
    {20,97,0}, {16,104,1}, {23,110,0},
    {17,116,1}, {24,120,2}, {18,128,2}};

  static struct stars stars = {.b = NULL, .s = s, .count = 6};

  if (! stars.b) {
    for (i = 0; i < 6; i++) {
      min_x = min_int (min_x, stars.s[i].x);
      min_y = min_int (min_y, stars.s[i].y);
      max_x = max_int (max_x, stars.s[i].x);
      max_y = max_int (max_y, stars.s[i].y);
    }

    stars.b = create_bitmap (max_x - min_x + 1, max_y - min_y + 1);
    clear_bitmap (stars.b, TRANSPARENT_COLOR);
    stars.c.x = min_x;
    stars.c.y = min_y;

    redraw_stars_bitmap (&stars, vm);
  }

  if (vm != mr.last.vm) redraw_stars_bitmap (&stars, vm);

  draw_stars (bitmap, &stars, vm);
}

void
draw_balcony_stars (ALLEGRO_BITMAP *bitmap, struct pos *p, enum vm vm)
{
  if (con (p)->bg != BALCONY) return;
  struct pos np; npos (p, &np);

  if (! np.room) return;

  struct stars *stars = &mr.cell[mr.dx][mr.dy].stars[np.floor][np.place];

  if (vm != mr.last.vm) redraw_stars_bitmap (stars, vm);

  draw_stars (bitmap, stars, vm);
}

static struct star *
star_coord (struct pos *p, int i, struct star *s)
{
  s->x = PLACE_WIDTH * p->place + 16 + prandom_pos_uniq (p, 2 * i, 1, 28);
  s->y = PLACE_HEIGHT * p->floor - 3 + prandom_pos_uniq (p, 2 * i + 1, 1, 21);
  return s;
}