Esempio n. 1
0
static void ChunkyToPlanar() {
  BitmapT *dst = screen[c2p.active];
  PixmapT *src = chunky[c2p.active];

  switch (c2p.phase) {
    case 0:
      /* Initialize chunky to planar. */
      custom->bltamod = 2;
      custom->bltbmod = 2;
      custom->bltdmod = 0;
      custom->bltcdat = 0xf0f0;
      custom->bltafwm = -1;
      custom->bltalwm = -1;

      /* Swap 4x2, pass 1. */
      custom->bltapt = src->pixels;
      custom->bltbpt = src->pixels + 2;
      custom->bltdpt = dst->planes[0];

      custom->bltcon0 = (SRCA | SRCB | DEST) | (ABC | ABNC | ANBC | NABNC);
      custom->bltcon1 = 4 << BSHIFTSHIFT;
      custom->bltsize = 1;
      break;

    case 1:
      custom->bltsize = 1 | (976 << 6);
      break;

    case 2:
      /* Swap 4x2, pass 2. */
      // custom->bltapt = src->pixels + WIDTH * HEIGHT / 2;
      // custom->bltbpt = src->pixels + WIDTH * HEIGHT / 2 + 2;
      custom->bltdpt = dst->planes[2] + WIDTH * HEIGHT / 4;

      custom->bltcon0 = (SRCA | SRCB | DEST) | (ABC | ABNC | ANBC | NABNC) | (4 << ASHIFTSHIFT);
      custom->bltcon1 = BLITREVERSE;
      custom->bltsize = 1;
      break;

    case 3:
      custom->bltsize = 1 | (977 << 6);
      break;

    case 4:
      CopInsSet32(bplptr[0], dst->planes[0]);
      CopInsSet32(bplptr[1], dst->planes[0]);
      CopInsSet32(bplptr[2], dst->planes[2]);
      CopInsSet32(bplptr[3], dst->planes[2]);
      CopInsSet32(bplptr[4], dst->planes[4]);
      break;

    default:
      return;
  }

  c2p.phase++;
}
Esempio n. 2
0
static void SetupLines(WORD f) {
  WORD y0 = rotate(f);

  /* first line */
  {
    LONG y = (WORD)twister->bytesPerRow * y0;
    APTR *planes = twister->planes;
    CopInsT **bpl = bplptr[active];
    WORD n = DEPTH;

    while (--n >= 0)
      CopInsSet32(*bpl++, (*planes++) + y);
  }

  /* consecutive lines */
  {
    WORD **modptr = (WORD **)bplmod[active];
    WORD y1, i, m;

    for (i = 1; i < HEIGHT; i++, y0 = y1, f += 2) {
      WORD *mod = *modptr++;

      y1 = rotate(f);
      m = ((y1 - y0) - 1) * (WIDTH / 8);

      mod[1] = m;
      mod[3] = m;
    }
  }
}
Esempio n. 3
0
static void Render() {
  BitmapClearArea(screen[active], 
                  STRUCT(Area2D, 0, 0, MAX_W * 2 + SIZE, MAX_H * 2 + SIZE));
  DrawPlotter();

  WaitVBlank();
  ITER(i, 0, DEPTH - 1, CopInsSet32(bplptr[i], screen[active]->planes[i]));
  active ^= 1;
}
Esempio n. 4
0
static void Render() {
  // LONG lines = ReadLineCounter();

  ClearCliparts();
  DrawCliparts();
  
  // Log("neons: %ld\n", ReadLineCounter() - lines);

  WaitVBlank();
  ITER(i, 0, DEPTH - 1, CopInsSet32(bplptr[i], screen[active]->planes[i]));
  active ^= 1;
}
Esempio n. 5
0
static void MakeCopperList(CopListT **ptr, WORD n) {
  CopListT *cp = NewCopList(100 + HEIGHT * 5 + (31 * HEIGHT / 3));
  WORD *pixels = texture->pixels;
  WORD i, j, k;

  CopInit(cp);
  CopSetupGfxSimple(cp, MODE_LORES, DEPTH, X(STARTX), Y(0), WIDTH, HEIGHT);
  CopSetupBitplanes(cp, bplptr[n], twister, DEPTH);
  CopSetupSprites(cp, sprptr[n]);
  CopMove16(cp, dmacon, DMAF_SETCLR|DMAF_RASTER);
  CopMove16(cp, diwstrt, 0x2c81);
  CopMove16(cp, diwstop, 0x2bc1);
  CopSetColor(cp, 0, &gradient->colors[0]);

  for (i = 0, k = 0; i < HEIGHT; i++) {
    CopWait(cp, Y(i), 0);
    bplmod[n][i] = CopMove16(cp, bpl1mod, -32);
    CopMove16(cp, bpl2mod, -32);
    CopMove16(cp, bpldat[0], 0);

    CopSetColor(cp, 0, &gradient->colors[i]);

    if ((i % 3) == 0) {
      colors[n][k++] = CopSetRGB(cp, 1, *pixels++);
      for (j = 2; j < 32; j++)
        CopSetRGB(cp, j, *pixels++);
    }
  }

  CopEnd(cp);

  CopInsSet32(sprptr[n][4], left[0]->data);
  CopInsSet32(sprptr[n][5], left[1]->data);
  CopInsSet32(sprptr[n][6], right[0]->data);
  CopInsSet32(sprptr[n][7], right[1]->data);

  *ptr = cp;
}
Esempio n. 6
0
static void Load() {
  screen = NewBitmap(WIDTH, HEIGHT, DEPTH, FALSE);
  cp = NewCopList(100);
  nullspr = NewSprite(0, FALSE);
  pointer = CloneSystemPointer();

  CopInit(cp);
  CopMakePlayfield(cp, NULL, screen, DEPTH);
  CopMakeDispWin(cp, X(0), Y(0), WIDTH, HEIGHT);
  CopMakeSprites(cp, sprptr, nullspr);
  CopEnd(cp);

  CopInsSet32(sprptr[0], pointer->data);
  UpdateSpritePos(pointer, X(0), Y(0));
}
Esempio n. 7
0
static void SetupLinePointers() {
  CopInsT **ins = linebpl[active];
  APTR plane = scroll->planes[0];
  LONG stride = scroll->bytesPerRow;
  LONG bplsize = scroll->bplSize;
  WORD y = (LONG)(frameCount / 2 + 8) % (WORD)scroll->height;
  APTR start = plane + (WORD)stride * y;
  APTR end = plane + bplsize;
  WORD n = HEIGHT;

  while (--n >= 0) {
    if (start >= end)
      start -= bplsize;
    CopInsSet32(*ins++, start);
    start += stride;
  }
}
Esempio n. 8
0
static void MoveSprite() {
  static UWORD counter = 0;
  static UWORD x = X(0);
  static UWORD y[3] = { Y(113), Y(110), Y(101) };
  static WORD direction = 1;
  WORD i = (WORD)(counter * 2 / 50) % 4;

  if (x >= X(304))
    direction = -1;
  if (x <= X(0))
    direction = 1;
  x += direction;

  if (i > 2)
    i = 4 - i;

  UpdateSprite(sprite[i], x, y[i]);

  if (sprptr[0])
    CopInsSet32(sprptr[0], sprite[i]->data);

  counter++;
}
Esempio n. 9
0
static void Render() {
  // LONG lines = ReadLineCounter();
  {
    BlitterClear(screen, active);
    DrawSpans(screen->planes[active]);
    BlitterFill(screen, active);
  }
  // Log("anim: %ld\n", ReadLineCounter() - lines);

  WaitVBlank();

  {
    WORD n = DEPTH;

    while (--n >= 0) {
      WORD i = (active + n + 1 - DEPTH) % (DEPTH + 1);
      if (i < 0)
        i += DEPTH + 1;
      CopInsSet32(bplptr[n], screen->planes[i]);
    }
  }

  active = (active + 1) % (DEPTH + 1);
}