Changeset 313


Ignore:
Timestamp:
Jan 31, 2011, 2:50:49 AM (10 years ago)
Author:
sam
Message:

Rework tile handling. This possibly breaks deushax pretty rudely.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/monsterz/board.cpp

    r311 r313  
    196196    Entity::TickDraw(deltams);
    197197
    198     Scene::GetDefault()->AddTile((data->screen << 16) | 0, 0, 1050, 0, 0);
    199     Scene::GetDefault()->AddTile((data->board << 16) | 0, 24, 912, 1, 0);
     198    Scene::GetDefault()->AddTile((data->screen << 16) | 0, 0, 0, 0, 0);
     199    Scene::GetDefault()->AddTile((data->board << 16) | 0, 24, 72, 1, 0);
    200200
    201201    if (data->mouse.x >= 0 && data->mouse.y >= 0)
    202202    {
    203         int x = data->mouse.x - 2;
    204         int y = data->mouse.y + 59;
    205         Scene::GetDefault()->AddTile((data->tiles << 16) | 22, x, y, 10, 0);
     203        int2 m = data->mouse + int2(-6, 6 - 48);
     204        Scene::GetDefault()->AddTile((data->tiles << 16) | 22, m.x, m.y, 10, 0);
    206205    }
    207206}
  • trunk/monsterz/piece.cpp

    r311 r313  
    282282        if (data->timer < 0.0f)
    283283        {
    284             float3 pos(data->pos.x + 24, data->pos.y + 177, 5);
     284            float3 pos(data->pos.x + 24, data->pos.y + 72, 5);
    285285            int start = data->id + 12;
    286286            int stop = data->id + 15;
     
    308308    int id = data->id;
    309309    int x = data->pos.x + 24;
    310     int y = data->pos.y + 177;
     310    int y = data->pos.y + 72;
    311311    int z = 2;
    312312
  • trunk/src/scene.cpp

    r289 r313  
    9797        data->tiles = (Tile *)realloc(data->tiles,
    9898                                      (data->ntiles + 1024) * sizeof(Tile));
     99    /* FIXME: this sorting only works for a 45-degree camera */
    99100    data->tiles[data->ntiles].prio = -y - 2 * 32 * z + (o ? 0 : 32);
    100101    data->tiles[data->ntiles].code = code;
  • trunk/src/tileset.cpp

    r280 r313  
    157157    float dilate = data->dilate;
    158158
    159     int off = o ? data->h : 0;
    160159    int dx = data->w;
    161     int dy = data->h * 38 / 32; /* Magic... fix this one day */
    162     int dy2 = data->h * 70 / 32;
     160    int dy = o ? 0 : data->h;
     161    int dz = o ? data->h : 0;
    163162
    164163    if (!data->img)
     
    167166        glBegin(GL_QUADS);
    168167            glTexCoord2f(tx, ty);
    169             glVertex3f(x, dilate * (y - dy - off), dilate * (z + off));
     168            glVertex3f(x, dilate * (y + dy), dilate * (z + dz));
    170169            glTexCoord2f(tx + data->tx, ty);
    171             glVertex3f(x + dx, dilate * (y - dy - off), dilate * (z + off));
     170            glVertex3f(x + dx, dilate * (y + dy), dilate * (z + dz));
    172171            glTexCoord2f(tx + data->tx, ty + data->ty);
    173             glVertex3f(x + dx, dilate * (y - dy2), dilate * z);
     172            glVertex3f(x + dx, dilate * y, dilate * z);
    174173            glTexCoord2f(tx, ty + data->ty);
    175             glVertex3f(x, dilate * (y - dy2), dilate * z);
     174            glVertex3f(x, dilate * y, dilate * z);
    176175        glEnd();
    177176    }
Note: See TracChangeset for help on using the changeset viewer.