Ignore:
Timestamp:
Apr 29, 2012, 11:55:32 PM (8 years ago)
Author:
sam
Message:

core: tick methods now use seconds, like any sane system.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/monsterz/piece.cpp

    r1198 r1310  
    223223    case PieceData::MOVE:
    224224        data->state = PieceData::UNGRAB;
    225         data->speed = 0.4f;
     225        data->speed = 400.f;
    226226        data->timer = 0.0f;
    227227        data->off = data->off_src = data->off + data->pos - pos;
     
    241241    case PieceData::MOVE:
    242242        data->state = PieceData::MOVE;
    243         data->speed = 0.3f;
     243        data->speed = 300.f;
    244244        data->timer = 0.0f;
    245245        data->pos_src = data->pos;
     
    253253}
    254254
    255 void Piece::TickGame(float deltams)
    256 {
    257     data->timers.blink -= deltams;
     255void Piece::TickGame(float seconds)
     256{
     257    data->timers.blink -= seconds;
    258258    if (data->timers.blink < 0.0f)
    259259        data->timers.blink = RandF(DELAY_BLINK, 2 * DELAY_BLINK);
    260260
    261     data->timers.idle -= deltams;
     261    data->timers.idle -= seconds;
    262262    if (data->timers.idle < 0.0f)
    263263        data->timers.idle = data->timers.idle_max
    264264                          = RandF(DELAY_IDLE, 2 * DELAY_IDLE);
    265265
    266     data->timers.pop -= deltams;
    267 
    268     switch (data->state)
    269     {
    270     case PieceData::IDLE:
    271     case PieceData::GRAB:
    272         break;
    273     case PieceData::UNGRAB:
    274     case PieceData::MOVE:
    275     {
    276         data->timer += deltams;
     266    data->timers.pop -= seconds;
     267
     268    switch (data->state)
     269    {
     270    case PieceData::IDLE:
     271    case PieceData::GRAB:
     272        break;
     273    case PieceData::UNGRAB:
     274    case PieceData::MOVE:
     275    {
     276        data->timer += seconds;
    277277
    278278        ivec2 trip = data->pos_dst - data->pos_src;
     
    299299            data->timer = 0.0f;
    300300        }
    301         if (data->timer > pos_time + 200.0f && data->timer > off_time + 200.0f)
     301        if (data->timer > pos_time + .2f && data->timer > off_time + .2f)
    302302            data->state = PieceData::IDLE;
    303303        break;
     
    314314            {
    315315                float angle = RandF(-1.2f, 1.2f);
    316                 float speed = RandF(0.3f, 0.5f);
     316                float speed = RandF(300.f, 500.f);
    317317                vec3 vel(speed * sinf(angle), speed * cosf(angle), 0.0f);
    318318                data->emitter->AddParticle(pieceid, pos, vel);
     
    326326        break;
    327327    }
    328     Entity::TickGame(deltams);
    329 }
    330 
    331 void Piece::TickDraw(float deltams)
    332 {
    333     Entity::TickDraw(deltams);
     328    Entity::TickGame(seconds);
     329}
     330
     331void Piece::TickDraw(float seconds)
     332{
     333    Entity::TickDraw(seconds);
    334334
    335335    int pieceid = data->pieceid, off = 0;
Note: See TracChangeset for help on using the changeset viewer.