//
// $Id: ScrollingScene.java,v 1.1 2002/02/17 23:48:38 mdb Exp $

package com.threerings.miso.scene;

import com.threerings.media.tile.NoSuchTileException;
import com.threerings.media.tile.NoSuchTileSetException;
import com.threerings.media.tile.ObjectTile;
import com.threerings.media.tile.Tile;

import com.threerings.miso.tile.BaseTile;
import com.threerings.miso.util.MisoContext;

/**
 * Provides an infinite array of tiles in which to scroll.
 */
public class ScrollingScene implements DisplayMisoScene
{
    public ScrollingScene (MisoContext ctx)
        throws NoSuchTileSetException, NoSuchTileException
    {
        // grab our four repeating tiles
        _tiles[0] = (BaseTile)ctx.getTileManager().getTile(11, 0);
        _tiles[1] = (BaseTile)ctx.getTileManager().getTile(12, 0);
        _tiles[2] = (BaseTile)ctx.getTileManager().getTile(13, 0);
        _tiles[3] = (BaseTile)ctx.getTileManager().getTile(14, 0);
    }

    // documentation inherited from interface
    public BaseTile getBaseTile (int x, int y)
    {
        int tidx = 2 * (Math.abs(x) % 2) + Math.abs(y) % 2;
        return _tiles[tidx];
    }

    // documentation inherited from interface
    public Tile getFringeTile (int x, int y)
    {
        return null;
    }

    // documentation inherited from interface
    public ObjectTile getObjectTile (int x, int y)
    {
        return null;
    }

    // documentation inherited from interface
    public String getObjectAction (int column, int row)
    {
        return null;
    }

    protected BaseTile[] _tiles = new BaseTile[4];
}

@@ -28,17 +28,17 @@
 ava,v 1.
-1
+2
  2002/02
@@ -43,18 +43,18 @@
 02/1
-7 23:48:38
+9 20:02:16
  mdb
@@ -93,24 +93,50 @@
 iso.scene;%0A%0A
+import java.util.Random;%0A%0A
 import com.t
@@ -742,17 +742,17 @@
 etTile(1
-1
+5
 , 0);%0A  
@@ -813,12 +813,12 @@
 le(1
-2, 0
+5, 1
 );%0A 
@@ -880,12 +880,12 @@
 le(1
-3, 0
+5, 2
 );%0A 
@@ -947,12 +947,79 @@
 le(1
-4, 0
+5, 3);%0A        _tiles%5B4%5D = (BaseTile)ctx.getTileManager().getTile(15, 4
 );%0A 
@@ -1135,58 +1135,148 @@
     
-int tidx = 2 * (Math.abs(x) %25 2) + Math.abs(y
+long seed = ((x%5Ey) %5E multiplier) & mask;%0A        long hash = (seed * multiplier + addend) & mask;%0A        int tidx = (int)((hash %3E%3E 10
 ) %25 
-2
+5)
 ;%0A  
@@ -1748,14 +1748,219 @@
 aseTile%5B
-4%5D
+5%5D;%0A    protected Random _rand = new Random();%0A%0A    protected final static long multiplier = 0x5DEECE66DL;%0A    protected final static long addend = 0xBL;%0A    protected final static long mask = (1L %3C%3C 48) - 1
 ;%0A%7D%0A

Pick tiles pseudo randomly based on the coordinates.