示例#1
0
void
draw_animated_foreground (ALLEGRO_BITMAP *bitmap, int room)
{
  int room_view_bkp = room_view;
  room_view = room;

  struct pos p;
  p.room = room_view;

  for (p.floor = FLOORS; p.floor >= -1; p.floor--)
    for (p.place = -1; p.place < PLACES; p.place++) {
      if (con (&p)->fg != MIRROR) continue;
      update_mirror_bitmap (bitmap, &p);
      draw_mirror (bitmap, &p, em, vm);
    }

  /* loose_floor_fall_debug (); */

  for (p.floor = FLOORS; p.floor >= -1; p.floor--)
    for (p.place = -1; p.place < PLACES; p.place++) {
      draw_falling_loose_floor (bitmap, &p, em, vm);
    }

  draw_anims (bitmap, em, vm);

  for (p.floor = FLOORS; p.floor >= -1; p.floor--)
    for (p.place = -1; p.place < PLACES; p.place++) {
      draw_potion (bitmap, &p, em, vm);
      if (is_sword (&p)) draw_sword (bitmap, &p, vm);
    }

  room_view = room_view_bkp;
}
示例#2
0
文件: room.c 项目: oitofelix/mininim
void
draw_confg_left (ALLEGRO_BITMAP *bitmap, struct pos *p,
                 enum em em, enum vm vm)
{
  enum carpet_design d;

  switch (fake (p)) {
  case NO_FLOOR: return;
  case FLOOR: draw_floor_left (bitmap, p, em, vm); break;
  case BROKEN_FLOOR: draw_broken_floor_left (bitmap, p, em, vm); break;
  case SKELETON_FLOOR: draw_skeleton_floor_left (bitmap, p, em, vm); break;
  case LOOSE_FLOOR: draw_loose_floor_left (bitmap, p, em, vm); break;
  case SPIKES_FLOOR: draw_spikes_floor_left (bitmap, p, em, vm); break;
  case OPENER_FLOOR: draw_opener_floor_left (bitmap, p, em, vm); break;
  case CLOSER_FLOOR: draw_closer_floor_left (bitmap, p, em, vm); break;
  case STUCK_FLOOR: draw_pressed_closer_floor_left (bitmap, p, em, vm); break;
  case HIDDEN_FLOOR: return;
  case PILLAR: draw_pillar_left (bitmap, p, em, vm); break;
  case BIG_PILLAR_BOTTOM:
    draw_big_pillar_bottom_left (bitmap, p, em, vm); break;
  case BIG_PILLAR_TOP:
    draw_big_pillar_top_left (bitmap, p, em, vm); break;
  case WALL:
    if (con_caching) draw_wall_left (bitmap, p, em, vm);
    else draw_wall_left_cache (bitmap, p);
    break;
  case DOOR: draw_door_left (bitmap, p, em, vm); break;
  case LEVEL_DOOR: draw_level_door_left (bitmap, p, em, vm); break;
  case CHOPPER: draw_chopper_left (bitmap, p, em, vm); break;
  case ARCH_BOTTOM:
    draw_floor_left (bitmap, p, em, vm);
    draw_arch_bottom (bitmap, p, em, vm); break;
  case ARCH_TOP_MID: draw_arch_top_mid (bitmap, p, em, vm); break;
  case ARCH_TOP_SMALL: draw_arch_top_small (bitmap, p, em, vm); break;
  case ARCH_TOP_LEFT: draw_arch_top_left (bitmap, p, em, vm); break;
  case ARCH_TOP_RIGHT: draw_arch_top_right (bitmap, p, em, vm); break;
  case CARPET:
    draw_floor_left (bitmap, p, em, vm);
    draw_door_pole (bitmap, p, em, vm);
    break;
  case TCARPET:
    d = ext (p);
    if (d == ARCH_CARPET_RIGHT_00 || d == ARCH_CARPET_RIGHT_01)
      draw_arch_top_right_end (bitmap, p, em, vm);
    else draw_door_pole (bitmap, p, em, vm);
    break;
  case MIRROR:
    draw_floor_left (bitmap, p, em, vm);
    draw_mirror (bitmap, p, em, vm);
    break;
  default: assert (false); break;
  }
}
示例#3
0
void draw_scene(GLdouble secs, int passes, GLenum cullFace, 
		GLuint stencilVal, GLuint mirror)
{
  GLenum newCullFace;
  int passesPerMirror, passesPerMirrorRem;
  unsigned int curMirror, drawMirrors;
  int i;

  /* one pass to draw the real scene */
  passes--;

  /* only draw in my designated locations */
  glStencilFunc(GL_EQUAL, stencilVal, 0xffffffff);

  /* draw things which may obscure the mirrors first */
  draw_sphere(secs);
  draw_cone();

  /* now draw the appropriate number of mirror reflections.  for
   * best results, we perform a depth-first traversal by allocating
   * a number of passes for each of the mirrors. */
  if (mirror != 0xffffffff) {
    passesPerMirror = passes / (nMirrors - 1);
    passesPerMirrorRem = passes % (nMirrors - 1);
    if (passes > nMirrors - 1) drawMirrors = nMirrors - 1;
    else drawMirrors = passes;
  } else {
    /* mirror == -1 means that this is the initial scene (there was no 
     * mirror) */
    passesPerMirror = passes / nMirrors;
    passesPerMirrorRem = passes % nMirrors;
    if (passes > nMirrors) drawMirrors = nMirrors;
    else drawMirrors = passes;
  }
  for (i = 0; drawMirrors > 0; i++) {
    curMirror = i % nMirrors;
    if (curMirror == mirror) continue;
    drawMirrors--;

    /* draw mirror into stencil buffer but not color or depth buffers */
    glColorMask(0, 0, 0, 0);
    glDepthMask(0);
    glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); 
    draw_mirror(&mirrors[curMirror]);
    glColorMask(1, 1, 1, 1);
    glDepthMask(1);
    glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);

    /* draw reflected scene */
    newCullFace = reflect_through_mirror(&mirrors[curMirror], cullFace);
    if (passesPerMirrorRem) {
      draw_scene(secs, passesPerMirror + 1, newCullFace, stencilVal + 1, 
		 curMirror);      
      passesPerMirrorRem--;
    } else {
      draw_scene(secs, passesPerMirror, newCullFace, stencilVal + 1, 
		 curMirror);
    }
    undo_reflect_through_mirror(&mirrors[curMirror], cullFace);

    /* back to our stencil value */
    glStencilFunc(GL_EQUAL, stencilVal, 0xffffffff);    
  }

  draw_room(); 
}