Ignore:
Timestamp:
Jul 23, 2011, 11:14:40 PM (9 years ago)
Author:
sam
Message:

tileset: replace the Tiler ID system with real TileSet objects. The only
thing that is still broken is the Layer <--> Map interface.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/scene.cpp

    r784 r790  
    2929struct Tile
    3030{
    31     uint32_t prio, code;
    32     int x, y, z, o;
     31    TileSet *tileset;
     32    uint32_t prio;
     33    int id, x, y, z, o;
    3334};
    3435
     
    114115}
    115116
    116 void Scene::AddTile(uint32_t code, int x, int y, int z, int o)
     117void Scene::AddTile(TileSet *tileset, int id, int x, int y, int z, int o)
    117118{
    118119    if ((data->ntiles % 1024) == 0)
     
    121122    /* FIXME: this sorting only works for a 45-degree camera */
    122123    data->tiles[data->ntiles].prio = -y - 2 * 32 * z + (o ? 0 : 32);
    123     data->tiles[data->ntiles].code = code;
     124    data->tiles[data->ntiles].tileset = tileset;
     125    data->tiles[data->ntiles].id = id;
    124126    data->tiles[data->ntiles].x = x;
    125127    data->tiles[data->ntiles].y = y;
     
    274276        /* Count how many quads will be needed */
    275277        for (n = i + 1; n < data->ntiles; n++)
    276             if (data->tiles[i].code >> 16 != data->tiles[n].code >> 16)
     278            if (data->tiles[i].tileset != data->tiles[n].tileset)
    277279                break;
    278280
     
    283285        for (int j = i; j < n; j++)
    284286        {
    285             Tiler::BlitTile(data->tiles[j].code, data->tiles[j].x,
    286                             data->tiles[j].y, data->tiles[j].z, data->tiles[j].o,
     287            data->tiles[i].tileset->BlitTile(data->tiles[j].id,
     288                            data->tiles[j].x, data->tiles[j].y,
     289                            data->tiles[j].z, data->tiles[j].o,
    287290                            vertex + 18 * (j - i), texture + 12 * (j - i));
    288291        }
     
    291294
    292295        /* Bind texture */
    293         Tiler::Bind(data->tiles[i].code);
     296        data->tiles[i].tileset->Bind();
    294297
    295298        /* Bind vertex, color and texture coordinate buffers */
Note: See TracChangeset for help on using the changeset viewer.