예제 #1
0
void ZamEQ2Plugin::d_run(const float** inputs, float** outputs, uint32_t frames)
{
	float srate = d_getSampleRate();

	lowshelf(0, 0, srate, freql, gainl);
        peq(1, 0, srate, freq1, gain1, q1);
        peq(2, 0, srate, freq2, gain2, q2);
        highshelf(3, 0, srate, freqh, gainh);

        for (uint32_t i = 0; i < frames; i++) {
                double tmp,tmpl, tmph;
                double in = inputs[0][i];
                in = sanitize_denormal(in);

                //lowshelf
                tmpl = (gainl == 0.f) ? in : run_filter(0, 0, in);

                //highshelf
                tmph = (gainh == 0.f) ? tmpl : run_filter(3, 0, tmpl);

                //parametric1
                tmp = (gain1 == 0.f) ? tmph : run_filter(1, 0, tmph);

		//parametric2
		tmpl = (gain2 == 0.f) ? tmp : run_filter(2, 0, tmp);

                outputs[0][i] = inputs[0][i];
                outputs[0][i] = (float) tmpl;
		outputs[0][i] *= from_dB(master);
	}
}
예제 #2
0
bool
should_spikes_raise_for_pos (struct pos *p, struct pos *pk)
{
  struct pos pb1, pb2, np;

  return peq (pk, p)
    || (peq (pk, prel (p, &pb1, -1, 0))
        && is_strictly_traversable (prel (p, &np, -1, +0)))
    || (peq (pk, prel (p, &pb2, -2, 0))
        && is_strictly_traversable (prel (p, &np, -1, +0))
        && is_strictly_traversable (prel (p, &np, -2, +0)));
}
예제 #3
0
void
draw_floor_corner_02 (ALLEGRO_BITMAP *bitmap, struct pos *p,
                      enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *floor_corner_02 = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: floor_corner_02 = dc_floor_corner_02; break;
    case EGA: floor_corner_02 = de_floor_corner_02; break;
    case VGA: floor_corner_02 = dv_floor_corner_02; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: floor_corner_02 = pc_floor_corner_02; break;
    case EGA: floor_corner_02 = pe_floor_corner_02; break;
    case VGA: floor_corner_02 = pv_floor_corner_02; break;
    }
    break;
  }

  if (vm == VGA) floor_corner_02 = apply_hue_palette (floor_corner_02);
  if (hgc) floor_corner_02 = apply_palette (floor_corner_02, hgc_palette);
  if (peq (p, &mouse_pos))
    floor_corner_02 = apply_palette (floor_corner_02, selection_palette);

  struct coord c; floor_corner_02_coord (p, &c);
  if (con (p)->fg == CLOSER_FLOOR) c.y += 1;
  draw_bitmapc (floor_corner_02, bitmap, &c, 0);
}
예제 #4
0
void
draw_skeleton_floor_right (ALLEGRO_BITMAP *bitmap, struct pos *p,
                           enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *skeleton_floor_right = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: skeleton_floor_right = dc_skeleton_floor_right; break;
    case EGA: skeleton_floor_right = de_skeleton_floor_right; break;
    case VGA: skeleton_floor_right = dv_skeleton_floor_right; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: skeleton_floor_right = pc_skeleton_floor_right; break;
    case EGA: skeleton_floor_right = pe_skeleton_floor_right; break;
    case VGA: skeleton_floor_right = pv_skeleton_floor_right; break;
    }
    break;
  }

  if (vm == VGA) skeleton_floor_right = apply_hue_palette (skeleton_floor_right);
  if (hgc) skeleton_floor_right = apply_palette (skeleton_floor_right, hgc_palette);
  if (peq (p, &mouse_pos))
    skeleton_floor_right = apply_palette (skeleton_floor_right, selection_palette);

  struct coord c;
  draw_bitmapc (skeleton_floor_right, bitmap, skeleton_floor_right_coord (p, &c), 0);
}
예제 #5
0
void
draw_arch_top_top (ALLEGRO_BITMAP *bitmap, struct pos *p,
                   enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *arch_top_top = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: arch_top_top = dc_arch_top_top; break;
    case EGA: arch_top_top = de_arch_top_top; break;
    case VGA: arch_top_top = dv_arch_top_top; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: arch_top_top = pc_arch_top_top; break;
    case EGA: arch_top_top = pe_arch_top_top; break;
    case VGA: arch_top_top = pv_arch_top_top; break;
    }
    break;
  }

  if (vm == VGA) arch_top_top = apply_hue_palette (arch_top_top);
  if (hgc) arch_top_top = apply_palette (arch_top_top, hgc_palette);
  if (peq (p, &mouse_pos))
    arch_top_top = apply_palette (arch_top_top, selection_palette);

  struct coord c;
  draw_bitmapc (arch_top_top, bitmap, arch_top_top_coord (p, &c), 0);
}
예제 #6
0
파일: room.c 프로젝트: oitofelix/mininim
void
redraw_drawn_rectangle (struct drawn_rectangle *dr, struct pos *p,
                        enum em em, enum vm vm)
{
  if (dr->w <= 0 || dr->h <= 0) return;

  push_clipping_rectangle (dr->bitmap, dr->x, dr->y, dr->w, dr->h);

  struct coord tl, br;
  new_coord (&tl, &global_level, room_view, dr->x, dr->y);
  new_coord (&br, &global_level, room_view, dr->x + dr->w - 1,
             dr->y + dr->h - 1);

  struct pos ptl, pbr;
  posf (&tl, &ptl);
  posf (&br, &pbr);

  pos2room (&ptl, room_view, &ptl);
  pos2room (&pbr, room_view, &pbr);
  struct pos p0 = ptl;
  for (p0.floor = pbr.floor; p0.floor >= ptl.floor; p0.floor--)
    for (p0.place = ptl.place; p0.place <= pbr.place; p0.place++)
      if (! peq (&p0, p)) draw_confg (dr->bitmap, &p0, em, vm);

  pop_clipping_rectangle ();
}
예제 #7
0
파일: mirror.c 프로젝트: oitofelix/mininim
void
draw_floor_reflex (ALLEGRO_BITMAP *bitmap, struct pos *p,
                   enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *floor_right = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: floor_right = dc_floor_right; break;
    case EGA: floor_right = de_floor_right; break;
    case VGA: floor_right = dv_floor_right; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: floor_right = pc_floor_right; break;
    case EGA: floor_right = pe_floor_right; break;
    case VGA: floor_right = pv_floor_right; break;
    }
    break;
  }

  if (vm == VGA) floor_right = apply_hue_palette (floor_right);
  if (hgc) floor_right = apply_palette (floor_right, hgc_palette);
  if (peq (p, &mouse_pos))
    floor_right = apply_palette (floor_right, selection_palette);

  struct pos pl; prel (p, &pl, +0, -1);
  struct coord c;
  int h = al_get_bitmap_height (floor_right);
  draw_bitmap_regionc (floor_right, bitmap, 0, 2, 17, h - 9,
                       floor_reflex_coord (&pl, &c), 0);
}
예제 #8
0
void
draw_pillar_fg (ALLEGRO_BITMAP *bitmap, struct pos *p,
                enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *pillar_fg = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: pillar_fg = dc_pillar_fg; break;
    case EGA: pillar_fg = de_pillar_fg; break;
    case VGA: pillar_fg = dv_pillar_fg; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: pillar_fg = pc_pillar_fg; break;
    case EGA: pillar_fg = pe_pillar_fg; break;
    case VGA: pillar_fg = pv_pillar_fg; break;
    }
    break;
  }

  if (vm == VGA) pillar_fg = apply_hue_palette (pillar_fg);
  if (hgc) pillar_fg = apply_palette (pillar_fg, hgc_palette);
  if (peq (p, &mouse_pos))
    pillar_fg = apply_palette (pillar_fg, selection_palette);

  struct coord c;
  draw_bitmapc (pillar_fg, bitmap, pillar_coord (p, &c), 0);
}
예제 #9
0
파일: door.c 프로젝트: allisson128/mininim
void
draw_door_grid (ALLEGRO_BITMAP *bitmap, struct pos *p, int i,
                enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *door_grid = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: door_grid = dc_door_grid_cache[i]; break;
    case EGA: door_grid = de_door_grid_cache[i]; break;
    case VGA: door_grid = dv_door_grid_cache[i]; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: door_grid = pc_door_grid_cache[i]; break;
    case EGA: door_grid = pe_door_grid_cache[i]; break;
    case VGA: door_grid = pv_door_grid_cache[i]; break;
    }
    break;
  }

  if (vm == VGA) door_grid = apply_hue_palette (door_grid);

  if (hgc) door_grid = apply_palette (door_grid, hgc_palette);

  if (peq (p, &mouse_pos))
    door_grid = apply_palette (door_grid, selection_palette);

  struct coord c;
  draw_bitmapc (door_grid, bitmap, door_grid_coord_base (p, &c), 0);
}
예제 #10
0
void
draw_spikes_fg_01 (ALLEGRO_BITMAP *bitmap, struct pos *p,
                   enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *spikes_fg_01 = NULL;
  pos2coord_f spikes_fg_01_coord = NULL;

  switch (em) {
  case DUNGEON:
    spikes_fg_01_coord = d_spikes_fg_01_coord;
    switch (vm) {
    case CGA: spikes_fg_01 = dc_spikes_fg_01; break;
    case EGA: spikes_fg_01 = de_spikes_fg_01; break;
    case VGA: spikes_fg_01 = dv_spikes_fg_01; break;
    }
    break;
  case PALACE:
    spikes_fg_01_coord = p_spikes_fg_01_coord;
    switch (vm) {
    case CGA: spikes_fg_01 = pc_spikes_fg_01; break;
    case EGA: spikes_fg_01 = pe_spikes_fg_01; break;
    case VGA: spikes_fg_01 = pv_spikes_fg_01; break;
    }
    break;
  }

  if (vm == VGA) spikes_fg_01 = apply_hue_palette (spikes_fg_01);
  if (hgc) spikes_fg_01 = apply_palette (spikes_fg_01, hgc_palette);
  if (peq (p, &mouse_pos))
    spikes_fg_01 = apply_palette (spikes_fg_01, selection_palette);

  struct coord c;
  draw_bitmapc (spikes_fg_01, bitmap, spikes_fg_01_coord (p, &c), 0);
}
예제 #11
0
void
draw_unpressed_closer_floor_base (ALLEGRO_BITMAP *bitmap, struct pos *p,
                                  enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *unpressed_closer_floor_base = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: unpressed_closer_floor_base = dc_unpressed_closer_floor_base; break;
    case EGA: unpressed_closer_floor_base = de_unpressed_closer_floor_base; break;
    case VGA: unpressed_closer_floor_base = dv_unpressed_closer_floor_base; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: unpressed_closer_floor_base = pc_unpressed_closer_floor_base; break;
    case EGA: unpressed_closer_floor_base = pe_unpressed_closer_floor_base; break;
    case VGA: unpressed_closer_floor_base = pv_unpressed_closer_floor_base; break;
    }
    break;
  }

  if (vm == VGA) unpressed_closer_floor_base = apply_hue_palette (unpressed_closer_floor_base);
  if (hgc) unpressed_closer_floor_base = apply_palette (unpressed_closer_floor_base, hgc_palette);
  if (peq (p, &mouse_pos)) unpressed_closer_floor_base = apply_palette (unpressed_closer_floor_base, selection_palette);

  struct coord c;
  draw_bitmapc (unpressed_closer_floor_base, bitmap,
                floor_base_coord (p, &c), 0);
}
예제 #12
0
void
draw_broken_floor_left (ALLEGRO_BITMAP *bitmap, struct pos *p,
                        enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *broken_floor_left = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: broken_floor_left = dc_broken_floor_left; break;
    case EGA: broken_floor_left = de_broken_floor_left; break;
    case VGA: broken_floor_left = dv_broken_floor_left; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: broken_floor_left = pc_broken_floor_left; break;
    case EGA: broken_floor_left = pe_broken_floor_left; break;
    case VGA: broken_floor_left = pv_broken_floor_left; break;
    }
    break;
  }

  if (vm == VGA) broken_floor_left = apply_hue_palette (broken_floor_left);
  if (hgc) broken_floor_left = apply_palette (broken_floor_left, hgc_palette);
  if (peq (p, &mouse_pos))
    broken_floor_left = apply_palette (broken_floor_left, selection_palette);

  struct coord c;
  draw_bitmapc (broken_floor_left, bitmap, floor_left_coord (p, &c), 0);
}
예제 #13
0
void
draw_right_mark (ALLEGRO_BITMAP *bitmap, struct pos *p, int r,
                 enum vm vm)
{
  ALLEGRO_BITMAP *wall_mark_top_right = NULL,
    *wall_mark_bottom_right = NULL;

  if (vm == VGA) {
    wall_mark_top_right = apply_hue_palette (dv_wall_mark_top_right);
    wall_mark_bottom_right = apply_hue_palette (dv_wall_mark_bottom_right);
  } else {
    wall_mark_top_right = de_wall_mark_top_right;
    wall_mark_bottom_right = de_wall_mark_bottom_right;
  }

  if (peq (p, &mouse_pos)) {
    wall_mark_top_right = apply_palette (wall_mark_top_right, selection_palette);
    wall_mark_bottom_right = apply_palette (wall_mark_bottom_right, selection_palette);
  }

  ALLEGRO_BITMAP *wall_mark;
  const int floor_offset[4] = {52, 42, 31, 21};

  if (r % 2) wall_mark = wall_mark_bottom_right;
  else wall_mark = wall_mark_top_right;

  struct coord c;
  c.room = p->room;
  c.x = 32 * p->place + 8 * ((r > 1) ? 1 : 0)
    + ((r < 2) ? 24 : r1 - 3);
  c.y = 63 * p->floor + 56 - floor_offset[r];
  draw_bitmapc (wall_mark, bitmap, &c, 0);
}
예제 #14
0
파일: door.c 프로젝트: allisson128/mininim
void
draw_door_pole_base (ALLEGRO_BITMAP *bitmap, struct pos *p,
                     enum em em, enum vm vm)
{
  struct coord c;

  ALLEGRO_BITMAP *door_pole_base = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: door_pole_base = dc_door_pole_base; break;
    case EGA: door_pole_base = de_door_pole_base; break;
    case VGA: door_pole_base = dv_door_pole_base; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: door_pole_base = pc_door_pole_base; break;
    case EGA: door_pole_base = pe_door_pole_base; break;
    case VGA: door_pole_base = pv_door_pole_base; break;
    }
    break;
  }

  if (vm == VGA) door_pole_base = apply_hue_palette (door_pole_base);
  if (hgc) door_pole_base = apply_palette (door_pole_base, hgc_palette);
  if (peq (p, &mouse_pos))
    door_pole_base = apply_palette (door_pole_base, selection_palette);

  draw_bitmapc (door_pole_base, bitmap, door_pole_base_coord (p, &c), 0);
}
예제 #15
0
파일: box.c 프로젝트: allisson128/mininim
void
draw_box (ALLEGRO_BITMAP* bitmap, struct pos *p, enum vm vm)
{
  struct coord c;
  if (! peq (&mouse_pos, p)) return;

  ALLEGRO_BITMAP *box = get_box_frame (anim_cycle % 3, vm);
  draw_bitmapc (box, bitmap, box_coord (p, &c), 0);
}
예제 #16
0
파일: fight.c 프로젝트: oitofelix/mininim
bool
is_pos_seeing (struct pos *p0, struct anim *k1, enum dir dir)
{
  struct coord m0, m1, mt1, mb1; struct pos p, p1, pk, pke;
  con_m (p0, &m0);

  coord_f cf;
  if (is_kid_climb (&k1->f) || is_anim_fall (&k1->f)) {
    coord2room (_mt (&k1->f, &mt1), m0.room, &mt1);
    coord2room (_m (&k1->f, &m1), m0.room, &m1);
    coord2room (_mbo (&k1->f, &mb1), m0.room, &mb1);

    double dt, dm, db;
    dt = (mt1.room == m0.room) ? dist_coord (&m0, &mt1) : INFINITY;
    dm = (m1.room == m0.room) ? dist_coord (&m0, &m1) : INFINITY;
    db = (mb1.room == m0.room) ? dist_coord (&m0, &mb1) : INFINITY;

    if (dt <= dm && dt <= db)
      cf = (dir == LEFT) ? _tr : _tl;
    else if (db <= dt && db <= dm)
      cf = (dir == LEFT) ? _br : _bl;
    else cf = (dir == LEFT) ? _mr : _ml;
  } else cf = (dir == LEFT) ? _mr : _ml;

  surveyo (cf, -8, +0, pos, &k1->f, &m1, NULL, NULL);

  coord2room (&m0, p0->room, &m0);
  coord2room (&m1, p0->room, &m1);
  pos (&m1, &p1);

  if (dir == LEFT) {
    if (is_opaque_at_left (p0)) return false;
    if (is_opaque_at_right (&p1)) return false;
    if (peqr (&p1, p0, +0, -1)) return true;
    prel (p0, &pk, +0, -1);
    prel (&p1, &pke, +0, +1);
  } else {
    if (is_opaque_at_right (p0)) return false;
    if (is_opaque_at_left (&p1)) return false;
    if (peqr (&p1, p0, +0, +1)) return true;
    prel (p0, &pk, +0, +1);
    prel (&p1, &pke, +0, -1);
  }

  if (peq (p0, &p1)) return true;

  first_confg (&pk, &pke, opaque_cs, &p);

  return p0->room == p1.room
    && m1.room == m0.room
    && p1.floor == p0->floor
    && ! (dir == LEFT && m1.x > m0.x)
    && ! (dir == RIGHT && m1.x < m0.x)
    && p.room == -1;
}
예제 #17
0
파일: room.c 프로젝트: oitofelix/mininim
void
draw_no_floor_selection (ALLEGRO_BITMAP *bitmap, struct pos *p)
{
  if (peq (p, &mouse_pos)) {
    struct rect r;
    new_rect (&r, p->room, p->place * PLACE_WIDTH + 25,
              p->floor * PLACE_HEIGHT - 13,
              PLACE_WIDTH, PLACE_HEIGHT);
    draw_filled_rect (bitmap, &r, NO_FLOOR_SELECTION_COLOR);
  }
}
예제 #18
0
파일: door.c 프로젝트: allisson128/mininim
bool
should_draw_door_grid (struct pos *p, struct frame *f)
{
  struct pos pl, pa, pmt, ptb;

  struct anim *a = (struct anim *) f->id;

  struct pos *hang_pos = &a->hang_pos;

  survey (_mt, pos, f, NULL, &pmt, NULL);
  survey (_tb, pos, f, NULL, &ptb, NULL);

  prel (p, &pl, +0, -1);
  prel (p, &pa, -1, +0);

  return
    (((peq (&ptb, p) || peq (&ptb, &pl)
       || peq (&ptb, &pa))
      && (peq (&pmt, p) || peq (&pmt, &pl)
          || peq (&pmt, &pa)))
     || is_kid_successfully_climbing_at_pos
     (f, hang_pos, p)
     || (is_kid_turn_run (f)
         && f->dir == LEFT))
    && ! is_kid_successfully_climbing_at_pos
    (f, hang_pos, &pa);
}
예제 #19
0
void
draw_broken_floor_fg (ALLEGRO_BITMAP *bitmap, struct pos *p,
                      enum em em, enum vm vm)
{
  struct coord c;
  int i;
  for (i = 0; i < anima_nmemb; i++) {
    struct anim *a = &anima[i];
    struct pos pmt;
    survey (_mt, pos, &a->f, NULL, &pmt, NULL);
    if (peq (&pmt, p) && is_anim_dead (&a->f)) return;
  }

  ALLEGRO_BITMAP *broken_floor_front = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: broken_floor_front = dc_broken_floor_front; break;
    case EGA: broken_floor_front = de_broken_floor_front; break;
    case VGA: broken_floor_front = dv_broken_floor_front; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: broken_floor_front = pc_broken_floor_front; break;
    case EGA: broken_floor_front = pe_broken_floor_front; break;
    case VGA: broken_floor_front = pv_broken_floor_front; break;
    }
    break;
  }

  if (vm == VGA) broken_floor_front = apply_hue_palette (broken_floor_front);
  if (hgc) broken_floor_front = apply_palette (broken_floor_front, hgc_palette);
  if (peq (p, &mouse_pos))
    broken_floor_front = apply_palette (broken_floor_front, selection_palette);

  draw_bitmapc (broken_floor_front, bitmap,
                broken_floor_front_coord (p, &c), 0);
}
예제 #20
0
void
update_cache_pos (struct pos *p, enum em em, enum vm vm)
{
  struct pos q = *p;
  int x, y;

  for (q.room = 1; q.room < ROOMS; q.room++) {
    for (y = mr.h - 1; y >= 0; y--)
      for (x = 0; x < mr.w; x++)
        if (mr.cell[x][y].room == q.room)
          for (q.floor = FLOORS; q.floor >= -1; q.floor--)
            for (q.place = -1; q.place < PLACES; q.place++)
              if (peq (&q, p) && ! has_room_changed (q.room)) {
                ALLEGRO_BITMAP *bitmap = mr.cell[x][y].cache;

                room_view = q.room;
                mr.dx = x;
                mr.dy = y;
                con_caching = true;

                push_clipping_rectangle
                  (bitmap,
                   PLACE_WIDTH * q.place - 1,
                   PLACE_HEIGHT * q.floor - 17,
                   2 * PLACE_WIDTH + 1, PLACE_HEIGHT + 3 + 17);

                clear_bitmap (bitmap, TRANSPARENT_COLOR);

                struct pos p0 = q;
                for (p0.floor = q.floor + 1; p0.floor >= q.floor - 1;
                     p0.floor--)
                  for (p0.place = q.place - 2; p0.place <= q.place + 1;
                       p0.place++)
                    draw_conbg (bitmap, &p0, em, vm);

                for (p0.floor = q.floor + 1; p0.floor >= q.floor - 1;
                     p0.floor--)
                  for (p0.place = q.place - 2; p0.place <= q.place + 1;
                       p0.place++)
                    draw_confg (bitmap, &p0, em, vm);

                pop_clipping_rectangle ();

                con_caching = false;
                goto next_room;
              }
  next_room:;
  }
}
예제 #21
0
void
draw_www_base (ALLEGRO_BITMAP *bitmap, struct pos *p,
               enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *wall_center_base = NULL;

  if (vm == VGA) wall_center_base = apply_hue_palette (dv_wall_center_base);
  else if (em == DUNGEON) wall_center_base = de_wall_center_base;
  else wall_center_base = pe_wall_center_base;

  if (peq (p, &mouse_pos))
    wall_center_base = apply_palette (wall_center_base, selection_palette);

  struct coord c;
  draw_bitmapc (wall_center_base, bitmap, wall_base_coord (p, &c), 0);
}
예제 #22
0
void
draw_wws_left (ALLEGRO_BITMAP *bitmap, struct pos *p,
               enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *wall_right = NULL;

  if (vm == VGA) wall_right = apply_hue_palette (dv_wall_right);
  else if (em == DUNGEON) wall_right = de_wall_right;
  else wall_right = pe_wall_right;

  if (peq (p, &mouse_pos))
    wall_right = apply_palette (wall_right, selection_palette);

  struct coord c;
  draw_bitmapc (wall_right, bitmap, wall_coord (p, &c), 0);
}
예제 #23
0
void
draw_random_block (ALLEGRO_BITMAP *bitmap, struct pos *p,
                   enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *wall_random_block = NULL;

  if (vm == VGA) wall_random_block = apply_hue_palette (dv_wall_random_block);
  else if (em == DUNGEON) wall_random_block = de_wall_random_block;
  else wall_random_block = pe_wall_random_block;

  if (peq (p, &mouse_pos))
    wall_random_block = apply_palette (wall_random_block, selection_palette);

  struct coord c;
  draw_bitmapc (wall_random_block, bitmap, wall_random_block_coord (p, &c), 0);
}
예제 #24
0
void
loose_floor_fall_debug (void)
{
  int i;
  for (i = 0; i < loose_floor_nmemb; i++) {
    struct loose_floor *l = &loose_floor[i];
    if (l->action != FALL_LOOSE_FLOOR) continue;
    struct pos pv; pos2room (&l->p, room_view, &pv);
    struct coord cv; coord2room (&l->f.c, room_view, &cv);
    printf ("(%i,%i,%i) == (%i,%i,%i) <%i,%i,%i> <%i,%i,%i> ? %i ? %i\n",
            l->p.room, l->p.floor, l->p.place,
            pv.room, pv.floor, pv.place,
            l->f.c.room, l->f.c.x, l->f.c.y,
            cv.room, cv.x, cv.y,
            peq (&l->p, &pv),
            cpos (&l->p, &pv));
    draw_falling_loose_floor (screen, &loose_floor[i].p, em, vm);
  }
}
예제 #25
0
bool
is_pos_visible (struct pos *p)
{
  struct pos np; npos (p, &np);

  if (is_room_visible (np.room)) return true;

  int y;
  for (y = mr.h - 1; y >= 0; y--)
    if (mr.cell[0][y].room) {
      struct pos p1;
      new_pos (&p1, p->l, mr.cell[0][y].room, -1, -1);
      p1.place = -1;
      for (p1.floor = 0; p1.floor < FLOORS; p1.floor++)
        if (peq (p, &p1)) return true;
    }

  return false;
}
예제 #26
0
파일: mirror.c 프로젝트: oitofelix/mininim
void
draw_mirror (ALLEGRO_BITMAP *bitmap, struct pos *p,
                 enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *mirror = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: mirror = dc_mirror; break;
    case EGA: mirror = de_mirror; break;
    case VGA: mirror = dv_mirror; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: mirror = pc_mirror; break;
    case EGA: mirror = pe_mirror; break;
    case VGA: mirror = pv_mirror; break;
    }
    break;
  }

  /* make mirror black */
  struct rect r;
  new_rect (&r, p->room, PLACE_WIDTH * p->place + 2,
            PLACE_HEIGHT * p->floor + 3,
            PLACE_WIDTH - 10, PLACE_HEIGHT - 16);
  draw_filled_rect (bitmap, &r, BLACK);

  /* draw floor reflex */
  draw_floor_reflex (bitmap, p, em, vm);

  /* draw mirror properly */
  if (vm == VGA) mirror = apply_hue_palette (mirror);
  if (hgc) mirror = apply_palette (mirror, hgc_palette);
  if (peq (p, &mouse_pos))
    mirror = apply_palette (mirror, selection_palette);

  struct coord c;
  draw_bitmapc (mirror, bitmap, mirror_coord (p, &c), 0);
}
예제 #27
0
static void
draw_left_01 (ALLEGRO_BITMAP *bitmap, struct pos *p, struct chopper *ch,
              enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *chopper = NULL;
  palette blood_palette = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: chopper = dc_chopper_00; break;
    case EGA: chopper = de_chopper_00; break;
    case VGA: chopper = dv_chopper_00; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: chopper = pc_chopper_00; break;
    case EGA: chopper = pe_chopper_00; break;
    case VGA: chopper = pv_chopper_00; break;
    }
    break;
  }

  if (vm == VGA) chopper = apply_hue_palette (chopper);
  if (hgc) chopper = apply_palette (chopper, hgc_palette);
  if (peq (p, &mouse_pos)) chopper = apply_palette (chopper, selection_palette);

  struct coord c;
  draw_bitmapc (chopper, bitmap, chopper_coord (p, &c), 0);
  if (ch->blood) {
    blood_palette = get_blood_palette (vm);
    ALLEGRO_BITMAP *blood = apply_palette (chopper_blood_00, blood_palette);
    if (hgc) blood = apply_palette (blood, hgc_palette);
    draw_bitmapc (blood, bitmap, blood_01_coord (p, &c), 0);
  }
}
예제 #28
0
static void
draw_fg_05 (ALLEGRO_BITMAP *bitmap, struct pos *p, struct chopper *ch,
                    enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *fg = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA: fg = dc_chopper_fg_04; break;
    case EGA: fg = de_chopper_fg_04; break;
    case VGA: fg = dv_chopper_fg_04; break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA: fg = pc_chopper_fg_04; break;
    case EGA: fg = pe_chopper_fg_04; break;
    case VGA: fg = pv_chopper_fg_04; break;
    }
    break;
  }

  if (vm == VGA) fg = apply_hue_palette (fg);
  if (hgc) fg = apply_palette (fg, hgc_palette);
  if (peq (p, &mouse_pos)) fg = apply_palette (fg, selection_palette);

  struct coord c;
  draw_bitmapc (fg, bitmap, chopper_coord (p, &c), 0);
  if (ch->blood) {
    int h = al_get_bitmap_height (chopper_blood_04);
    palette blood_palette = get_blood_palette (vm);
    ALLEGRO_BITMAP *blood = apply_palette (chopper_blood_04, blood_palette);
    if (hgc) blood = apply_palette (blood, hgc_palette);
    draw_bitmap_regionc (blood, bitmap, 0, 0, 2, h, blood_05_coord (p, &c), 0);
  }
}
예제 #29
0
void
draw_left_mark (ALLEGRO_BITMAP *bitmap, struct pos *p, int r,
                enum vm vm)
{
  ALLEGRO_BITMAP *wall_mark_top_left = NULL,
    *wall_mark_bottom_left = NULL;

  if (vm == VGA) {
    wall_mark_top_left = apply_hue_palette (dv_wall_mark_top_left);
    wall_mark_bottom_left = apply_hue_palette (dv_wall_mark_bottom_left);
  } else {
    wall_mark_top_left = de_wall_mark_top_left;
    wall_mark_bottom_left = de_wall_mark_bottom_left;
  }

  if (peq (p, &mouse_pos)) {
    wall_mark_top_left = apply_palette (wall_mark_top_left, selection_palette);
    wall_mark_bottom_left = apply_palette (wall_mark_bottom_left, selection_palette);
  }

  ALLEGRO_BITMAP *wall_mark = wall_mark_top_left;
  const int floor_offset[5] = {58, 41, 37, 20, 16};
  int place_offset = 0;

  if (r % 2) wall_mark = wall_mark_bottom_left;
  if (r > 3) place_offset = r3 - r2 + 6;
  else if (r > 1) place_offset = r1 - r0 + 6;

  struct coord c;
  c.room = p->room;
  c.x = 32 * p->place + place_offset +
    8 * (((r == 2) || (r == 3)) ? 1 : 0);
  c.y = 63 * p->floor + 61 - floor_offset[r];

  draw_bitmapc (wall_mark, bitmap, &c, 0);
}
예제 #30
0
파일: door.c 프로젝트: allisson128/mininim
void
xdraw_door_grid (ALLEGRO_BITMAP *bitmap, struct pos *p, int i,
                 enum em em, enum vm vm)
{
  ALLEGRO_BITMAP *door_grid = NULL,
    *door_grid_tip = NULL;

  switch (em) {
  case DUNGEON:
    switch (vm) {
    case CGA:
      door_grid = dc_door_grid;
      door_grid_tip = dc_door_grid_tip;
      break;
    case EGA:
      door_grid = de_door_grid;
      door_grid_tip = de_door_grid_tip;
      break;
    case VGA:
      door_grid = dv_door_grid;
      door_grid_tip = dv_door_grid_tip;
      break;
    }
    break;
  case PALACE:
    switch (vm) {
    case CGA:
      door_grid = pc_door_grid;
      door_grid_tip = pc_door_grid_tip;
      break;
    case EGA:
      door_grid = pe_door_grid;
      door_grid_tip = pe_door_grid_tip;
      break;
    case VGA:
      door_grid = pv_door_grid;
      door_grid_tip = pv_door_grid_tip;
      break;
    }
    break;
  }

  if (vm == VGA) {
    door_grid = apply_hue_palette (door_grid);
    door_grid_tip = apply_hue_palette (door_grid_tip);
  }

  if (hgc) {
    door_grid = apply_palette (door_grid, hgc_palette);
    door_grid_tip = apply_palette (door_grid_tip, hgc_palette);
  }

  if (peq (p, &mouse_pos)) {
    door_grid = apply_palette (door_grid, selection_palette);
    door_grid_tip = apply_palette (door_grid_tip, selection_palette);
  }

  int q = i / 8;
  int r = i % 8;
  int w = al_get_bitmap_width (door_grid);
  int j;

  struct coord c;
  draw_bitmap_regionc (door_grid, bitmap, 0, 7 - r, w, r + 1,
                       door_grid_coord_base (p, &c), 0);
  for (j = 0; j <= q; j++)
    draw_bitmapc (door_grid, bitmap, door_grid_coord (p, &c, j, i), 0);
  draw_bitmapc (door_grid_tip, bitmap, door_grid_tip_coord (p, &c, i), 0);
}