Ignore:
Timestamp:
Jan 25, 2011, 3:19:13 PM (11 years ago)
Author:
sam
Message:

Replace a few hardcoded time values with <monsterz.h> constants.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/monsterz/piece.cpp

    r285 r287  
    151151    case PieceData::IDLE:
    152152        data->state = PieceData::BLINK;
    153         data->timer = 400.0f; /* Duration of a blink */
     153        data->timer = DELAY_BLINK;
    154154        return 1;
    155155    default:
     
    169169    case PieceData::POP:
    170170        data->state = PieceData::POP;
    171         data->timer = 600.0f;
     171        data->timer = DELAY_DUH + DELAY_POP;
    172172        return 1;
    173173    default:
     
    314314        break;
    315315    case PieceData::POP:
    316         if (data->timer < 60)
    317             id = data->id + 9;
    318         else if (data->timer < 120)
    319             id = data->id + 8;
    320         else if (data->timer < 180)
    321             id = data->id + 7;
    322         else if (data->timer < 240)
    323             id = data->id + 6;
    324         else
    325             id = data->id + 5;
    326         break;
     316    {
     317        int off = 4 - (data->timer * 5 / DELAY_POP);
     318        if (off < 0) off = 0;
     319        if (off > 4) off = 4;
     320        id = data->id + 5 + off;
     321        break;
     322    }
    327323    case PieceData::DEAD:
    328324        break;
Note: See TracChangeset for help on using the changeset viewer.