Changeset 287


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

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

Location:
trunk/monsterz
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/monsterz/board.cpp

    r284 r287  
    172172                {
    173173                    Sampler::PlaySample(data->whip);
    174                     data->whipdelay = 300.0f;
     174                    data->whipdelay = DELAY_WHIP;
    175175                }
    176176                if (data->dst_cell != Int2(-1))
  • trunk/monsterz/mash.cpp

    r286 r287  
    9999            for (int n = 0; n < data->npieces; n++)
    100100                data->pieces[n]->Pop();
    101             data->timer = 400.0f;
     101            data->timer = DELAY_DUH;
    102102            data->state = MashData::DUH;
    103103        }
  • trunk/monsterz/monsterz.h

    r279 r287  
    1717static char const * const WAV_POP = "monsterz/pop.wav";
    1818static char const * const WAV_WHIP = "monsterz/whip.wav";
     19
     20/* Duration of a blink */
     21static int const DELAY_BLINK = 400;
     22/* Wait time until the next whip sound is allowed */
     23static int const DELAY_WHIP = 300;
     24/* Delay between a monster's surprise face and its explosion */
     25static int const DELAY_DUH = 300;
     26/* Duration of the explosion */
     27static int const DELAY_POP = 400;
  • 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.