Changeset 422


Ignore:
Timestamp:
Feb 7, 2011, 9:21:50 PM (9 years ago)
Author:
sam
Message:

Start splitting the animations into smaller pieces.

Location:
trunk/monsterz
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/monsterz/monsterz.h

    r384 r422  
    1919static char const * const PNG_ICONS = "monsterz/gfx/icons.png";
    2020static char const * const PNG_TITLE = "monsterz/gfx/title0.png";
     21static char const * const PNG_CLOUDS = "monsterz/gfx/titleclouds.png";
     22static char const * const PNG_STARS = "monsterz/gfx/titlestars.png";
    2123static char const * const PNG_TITLEANIM[] =
    2224{
  • trunk/monsterz/title.cpp

    r337 r422  
    3131
    3232private:
    33     int title, logo;
     33    int title, stars, clouds, logo;
    3434    int anim[6];
    3535    int event[7];
     
    5151    }
    5252    period, nextperiod;
     53
     54    float2 cloudpos[5];
     55    float2 cloudspeed[5];
    5356
    5457    float timer, length;
     
    109112    data->logo = Tiler::Register(PNG_LOGO, 380, 181, 1.0f);
    110113    data->title = Tiler::Register(PNG_TITLE, 384, 384, 1.0f);
     114    data->stars = Tiler::Register(PNG_STARS, 384, 144, 1.0f);
     115    data->clouds = Tiler::Register(PNG_CLOUDS, 160, 32, 1.0f);
    111116    for (int n = 0; n < 6; n++)
    112117        data->anim[n] = Tiler::Register(PNG_TITLEANIM[n],
     
    120125    data->timer = RandF(2000.0f, 3000.0f);
    121126
     127    for (int n = 0; n < 5; n++)
     128    {
     129        data->cloudpos[n] = float2(RandF(384), RandF(130, 190));
     130        data->cloudspeed[n] = RandF(-0.01f, 0.01f);
     131    }
     132
    122133    position = int3(24, 72, 1);
    123134    bbox[0] = position;
     
    140151    static int const t1[] = { 31, 26, 7, 7, 32, 6, 31 };
    141152    static int const t2[] = { 2, 4, 11, 4, 6, 2 };
     153
     154    for (int n = 0; n < 5; n++)
     155    {
     156        data->cloudpos[n].x += deltams * data->cloudspeed[n].x;
     157        if (data->cloudpos[n].x > 384.0f)
     158            data->cloudpos[n].x -= 384.0f;
     159        else if (data->cloudpos[n].x < 0.0f)
     160            data->cloudpos[n].x += 384.0f;
     161    }
    142162
    143163    switch (data->state)
     
    235255    Scene::GetDefault()->AddTile((data->title << 16) | backid, 24, 72, 1, 0);
    236256
     257    /* The stars */
     258    if (data->period != TitleData::DAY)
     259    {
     260        Scene::GetDefault()->AddTile((data->stars << 16) | 0,
     261                                     24 + 0, 72 + 240, 2, 0);
     262    }
     263
     264    /* The clouds. FIXME: tune color grading later */
     265    int cloudoff = data->period == TitleData::DAY ? 0 : 3;
     266
     267    for (int n = 0; n < 5; n++)
     268    {
     269        int cloudid = n * 4 + cloudoff;
     270        Scene::GetDefault()->AddTile((data->clouds << 16) | cloudid,
     271                                     24 + data->cloudpos[n].x,
     272                                     72 + data->cloudpos[n].y, 2, 0);
     273        Scene::GetDefault()->AddTile((data->clouds << 16) | cloudid,
     274                                     24 + data->cloudpos[n].x - 384.0f,
     275                                     72 + data->cloudpos[n].y, 2, 0);
     276    }
     277
    237278    /* Maybe an animation? */
    238279    int tiler = 0;
     
    265306
    266307    /* The logo, on top of the rest. */
    267     Scene::GetDefault()->AddTile((data->logo << 16) | 0, 26, 250, 2, 0);
     308    Scene::GetDefault()->AddTile((data->logo << 16) | 0, 26, 250, 3, 0);
    268309}
    269310
     
    278319    Tiler::Deregister(data->logo);
    279320    Tiler::Deregister(data->title);
     321    Tiler::Deregister(data->stars);
     322    Tiler::Deregister(data->clouds);
    280323    for (int n = 0; n < 6; n++)
    281324        Tiler::Deregister(data->anim[n]);
  • trunk/monsterz/title.h

    r332 r422  
    2828    virtual ~Title();
    2929
     30    char const *GetName() { return "<title>"; }
     31
    3032    int IsClicked() const;
    3133
Note: See TracChangeset for help on using the changeset viewer.