Changeset 337


Ignore:
Timestamp:
Feb 2, 2011, 9:45:57 PM (10 years ago)
Author:
sam
Message:

Fix an off-by-one error in animation frame computations.

Location:
trunk/monsterz
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/monsterz/piece.cpp

    r316 r337  
    340340    case PieceData::POP:
    341341    {
    342         int off = 4 - (data->timer * 5 / DELAY_POP);
     342        int off = 4 - (int)(data->timer * 5 / DELAY_POP);
    343343        if (off < 0) off = 0;
    344344        if (off > 4) off = 4;
  • trunk/monsterz/title.cpp

    r336 r337  
    248248        pos = animpos[data->animid];
    249249        pos.y = 384 - animsize[data->animid].y - pos.y; // Hack
    250         id = data->nframes - 1 - (data->nframes * data->timer / data->length);
     250        id = (data->length - data->timer) * data->nframes / data->length;
    251251        if (id < 0) id = 0;
    252252        if (id > data->nframes - 1) id = data->nframes - 1;
     
    256256        pos = eventpos[data->animid];
    257257        pos.y = 384 - eventsize[data->animid].y - pos.y; // Hack
    258         id = data->nframes - 1 - (data->nframes * data->timer / data->length);
     258        id = (data->length - data->timer) * data->nframes / data->length;
    259259        if (id < 0) id = 0;
    260260        if (id > data->nframes - 1) id = data->nframes - 1;
Note: See TracChangeset for help on using the changeset viewer.