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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/monsterz/title.cpp

    r1300 r1310  
    168168    data->period = TitleData::DAY;
    169169    data->nextperiod = TitleData::DAY;
    170     data->timer = RandF(2000.0f, 3000.0f);
     170    data->timer = RandF(2.0f, 3.0f);
    171171    /* Time needed for the eagle to cross the screen */
    172172    data->eagle.duration = (m_bbox[1].x - m_bbox[0].x + 16) * STEP_EAGLE;
     
    177177        data->cloudpos[n] = vec2(RandF((m_bbox[1] - m_bbox[0]).x),
    178178                                 RandF(80) + (m_bbox[1] - m_bbox[0]).y - 300);
    179         data->cloudspeed[n] = vec2(RandF(-0.01f, 0.01f));
     179        data->cloudspeed[n] = vec2(RandF(-10.f, 10.f));
    180180    }
    181181
     
    189189}
    190190
    191 void Title::TickGame(float deltams)
    192 {
    193     Entity::TickGame(deltams);
    194 
    195     data->timer -= deltams;
    196     data->eagle.timer -= deltams;
     191void Title::TickGame(float seconds)
     192{
     193    Entity::TickGame(seconds);
     194
     195    data->timer -= seconds;
     196    data->eagle.timer -= seconds;
    197197
    198198    /* Probability of playing an animation given the current period */
     
    207207    {
    208208        float wrap = m_bbox[1].x - m_bbox[0].x;
    209         data->cloudpos[n].x += deltams * data->cloudspeed[n].x;
     209        data->cloudpos[n].x += seconds * data->cloudspeed[n].x;
    210210        if (data->cloudpos[n].x > wrap)
    211211            data->cloudpos[n].x -= wrap;
     
    243243            data->state = TitleData::EVENT;
    244244            data->nframes = t1[data->animid];
    245             data->timer = data->length = data->nframes * 100.0f;
     245            data->timer = data->length = data->nframes * .1f;
    246246        }
    247247        else if (RandF() < p2[data->period])
     
    284284            data->state = TitleData::ANIM;
    285285            data->nframes = t2[data->animid];
    286             data->timer = data->length = data->nframes * 100.0f;
     286            data->timer = data->length = data->nframes * .1f;
    287287        }
    288288        else
     
    305305}
    306306
    307 void Title::TickDraw(float deltams)
    308 {
    309     Entity::TickDraw(deltams);
     307void Title::TickDraw(float seconds)
     308{
     309    Entity::TickDraw(seconds);
    310310
    311311    /* The background, always here. */
     
    342342    if (data->eagle.timer >= 0.0f)
    343343    {
    344         int eagleid = (int)(data->eagle.timer / 100) % 6;
     344        int eagleid = (int)(data->eagle.timer * 10.f) % 6;
    345345        if (data->period != TitleData::DAY)
    346346            eagleid += 6;
    347         float phase = sinf(data->eagle.timer * (2.0f * M_PI / 100 / 6));
     347        float phase = sinf(data->eagle.timer * (2.0f * M_PI * 10.f / 6));
    348348        int x = (data->eagle.duration - data->eagle.timer) / STEP_EAGLE;
    349349        int y = data->eagle.y + 5.0f * sinf(phase);
Note: See TracChangeset for help on using the changeset viewer.