Changeset 263


Ignore:
Timestamp:
Jan 23, 2011, 2:21:15 PM (10 years ago)
Author:
sam
Message:

Spawn new pieces at the correct coordinates for a free fall.

Location:
trunk/monsterz
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/monsterz/board.cpp

    r261 r263  
    217217    b->Goto(cell_a * 48, 0.3f);
    218218
    219     /* Remove matching tiles */
    220     do for (int j = 8; j--;) for (int i = 0; i < 8; i++)
    221     {
    222         if (list[i][j])
    223         {
     219    /* Remove matching pieces */
     220    do
     221    {
     222//        Mash *mash = new Mash(data->game);
     223//        Ticker::Ref(mash);
     224
     225        for (int j = 8; j--;) for (int i = 0; i < 8; i++)
     226        {
     227            if (!list[i][j])
     228                continue;
     229
     230            /* The mash becomes the new owner of the disappearing piece */
     231//            mash->AddPiece(data->pieces[i][j], Int2(i, j));
    224232            Ticker::Unref(data->pieces[i][j]);
     233
     234            Int2 newpos = data->pieces[i][7]->GetPos() + Int2(0, 48);
     235
    225236            for (int j2 = j + 1; j2 < 8; j2++)
    226237            {
     
    231242            }
    232243            data->pieces[i][7] = new Piece(data->game, Int2(i, 7), 25 + 5 * (rand() % 7));
     244            data->pieces[i][7]->SetPos(newpos);
     245            data->pieces[i][7]->Goto(Int2(i, 7) * 48, 0.1f);
    233246            Ticker::Ref(data->pieces[i][7]);
    234247            list[i][7] = 0;
  • trunk/monsterz/piece.cpp

    r261 r263  
    6565{
    6666    data->cell = cell;
     67}
     68
     69Int2 Piece::GetCell() const
     70{
     71    return data->cell;
     72}
     73
     74void Piece::SetPos(Int2 pos)
     75{
     76    data->pos = pos;
    6777}
    6878
  • trunk/monsterz/piece.h

    r261 r263  
    2424
    2525    void SetCell(Int2 cell);
     26    Int2 GetCell() const;
     27    void SetPos(Int2 pos);
    2628    Int2 GetPos() const;
    2729    int GetId() const;
Note: See TracChangeset for help on using the changeset viewer.