Changeset 1300


Ignore:
Timestamp:
Apr 26, 2012, 8:20:48 PM (8 years ago)
Author:
sam
Message:

core: prefix some member variables with m_ for clarity.

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/monsterz/board.cpp

    r1198 r1300  
    131131    Ticker::Ref(data->score);
    132132
    133     position = ivec3(24, 72, 1);
    134     bbox[0] = position;
    135     bbox[1] = bbox[0] + vec3(384, 384, 0);
     133    m_position = ivec3(24, 72, 1);
     134    m_bbox[0] = m_position;
     135    m_bbox[1] = m_bbox[0] + vec3(384, 384, 0);
    136136
    137137    Input::TrackMouse(this);
     
    163163    case BoardData::HUNT_IDLE:
    164164        /* Should we start dragging something? */
    165         if (buttons[0] && !data->oldbuttons[0] && mousepos.x != -1)
    166         {
    167             ivec2 cell = mousepos / data->size;
     165        if (buttons[0] && !data->oldbuttons[0] && m_mousepos.x != -1)
     166        {
     167            ivec2 cell = m_mousepos / data->size;
    168168            if (data->pairs[cell.x][cell.y].piece->Grab(ivec2(0, 0)))
    169169            {
    170170                Sampler::PlaySample(data->click);
    171171                data->grabbed = data->pairs[cell.x][cell.y];
    172                 data->src_cell = mousepos / data->size;
     172                data->src_cell = m_mousepos / data->size;
    173173                data->dst_cell = ivec2(-1);
    174174                data->state = BoardData::HUNT_GRAB;
     
    180180
    181181    case BoardData::HUNT_GRAB:
    182         if (mousepos.x != -1)
     182        if (m_mousepos.x != -1)
    183183        {
    184184            /* Mouse is still in the window, keep grabbing */
    185             data->grabbed.piece->Grab(mousepos - data->oldmouse);
     185            data->grabbed.piece->Grab(m_mousepos - data->oldmouse);
    186186            ivec2 cur_pos = data->grabbed.piece->GetPos()
    187187                          + data->grabbed.piece->GetOffset();
     
    221221
    222222        /* Mouse released, or exited window, or dragged too far. */
    223         if (!buttons[0] || mousepos.x == -1 ||
     223        if (!buttons[0] || m_mousepos.x == -1 ||
    224224             sqlen(data->src_cell * data->size - data->grabbed.piece->GetPos()
    225225                  - data->grabbed.piece->GetOffset()) > 100 * 100)
     
    246246    }
    247247
    248     data->oldmouse = mousepos;
     248    data->oldmouse = m_mousepos;
    249249    data->oldbuttons = buttons;
    250250}
     
    254254    Entity::TickDraw(deltams);
    255255
    256     Scene::GetDefault()->AddTile(data->board, 0, position, 0, vec2(1.0f));
     256    Scene::GetDefault()->AddTile(data->board, 0, m_position, 0, vec2(1.0f));
    257257    Scene::GetDefault()->AddTile(data->screen, 0, ivec3(0, 0, 10), 0, vec2(1.0f));
    258258
  • trunk/monsterz/interface.cpp

    r1198 r1300  
    6060    data->state = InterfaceData::INIT;
    6161
    62     position = ivec3(0, 0, 1);
    63     bbox[0] = position;
    64     bbox[1] = bbox[0] + vec3(640, 480, 0);
     62    m_position = ivec3(0, 0, 1);
     63    m_bbox[0] = m_position;
     64    m_bbox[1] = m_bbox[0] + vec3(640, 480, 0);
    6565}
    6666
  • trunk/monsterz/title.cpp

    r1198 r1300  
    136136{
    137137    /* FIXME: this should not be hardcoded */
    138     position = ivec3(0, 0, 1);
    139     bbox[0] = position;
    140     bbox[1] = bbox[0] + vec3(640, 480, 0);
     138    m_position = ivec3(0, 0, 1);
     139    m_bbox[0] = m_position;
     140    m_bbox[1] = m_bbox[0] + vec3(640, 480, 0);
    141141
    142142    srand(rand() ^ time(NULL));
     
    144144    data->logo = Tiler::Register(PNG_TITLE_LOGO, ivec2(380, 181), ivec2(0));
    145145    data->logo_sprite = new Sprite(data->logo, 0);
    146     data->logo_sprite->position = vec3(640 / 2 - 380 / 2, 250, 10);
     146    data->logo_sprite->m_position = vec3(640 / 2 - 380 / 2, 250, 10);
    147147    Ticker::Ref(data->logo_sprite);
    148148
    149149    data->ground = Tiler::Register(PNG_TITLE_GROUND, ivec2(384, 80), ivec2(0));
    150     data->ground_pos = ivec2((bbox[1] - bbox[0]).xy / vec2(2, 4))
     150    data->ground_pos = ivec2((m_bbox[1] - m_bbox[0]).xy / vec2(2, 4))
    151151                     - ivec2(192, 80);
    152152
    153153    data->rocks = Tiler::Register(PNG_TITLE_ROCKS, ivec2(640, 155), ivec2(0));
    154     data->rocks_pos = ivec2((bbox[1] - bbox[0]).xy / vec2(2, 2))
     154    data->rocks_pos = ivec2((m_bbox[1] - m_bbox[0]).xy / vec2(2, 2))
    155155                    - ivec2(320, 240);
    156156
     
    170170    data->timer = RandF(2000.0f, 3000.0f);
    171171    /* Time needed for the eagle to cross the screen */
    172     data->eagle.duration = (bbox[1].x - bbox[0].x + 16) * STEP_EAGLE;
     172    data->eagle.duration = (m_bbox[1].x - m_bbox[0].x + 16) * STEP_EAGLE;
    173173    data->eagle.timer = RandF(data->eagle.duration, 4 * data->eagle.duration);
    174174
    175175    for (int n = 0; n < MAX_CLOUDS; n++)
    176176    {
    177         data->cloudpos[n] = vec2(RandF((bbox[1] - bbox[0]).x),
    178                                  RandF(80) + (bbox[1] - bbox[0]).y - 300);
     177        data->cloudpos[n] = vec2(RandF((m_bbox[1] - m_bbox[0]).x),
     178                                 RandF(80) + (m_bbox[1] - m_bbox[0]).y - 300);
    179179        data->cloudspeed[n] = vec2(RandF(-0.01f, 0.01f));
    180180    }
     
    206206    for (int n = 0; n < MAX_CLOUDS; n++)
    207207    {
    208         float wrap = bbox[1].x - bbox[0].x;
     208        float wrap = m_bbox[1].x - m_bbox[0].x;
    209209        data->cloudpos[n].x += deltams * data->cloudspeed[n].x;
    210210        if (data->cloudpos[n].x > wrap)
     
    333333                                     vec2(1.0f));
    334334        Scene::GetDefault()->AddTile(data->clouds, cloudid,
    335                                      ivec3(data->cloudpos[n].x - bbox[1].x
    336                                                                + bbox[0].x,
     335                                     ivec3(data->cloudpos[n].x - m_bbox[1].x
     336                                                               + m_bbox[0].x,
    337337                                           data->cloudpos[n].y, 2), 0,
    338338                                     vec2(1.0f));
     
    401401int Title::IsClicked() const
    402402{
    403     return clicked[0];
     403    return m_clicked[0];
    404404}
    405405
  • trunk/mrpigeon/blueenemy.cpp

    r1211 r1300  
    2929    enemy_casualblueattack = Tiler::Register("mrpigeon/gfx/enemy_CasualBLUE_walkAttack.png", ivec2(16,24), ivec2(0)); /* 6 frames */
    3030
    31     position = vec3(512, 81, 0);
    32     velocity = vec3(-0.15f, 0, 0);
     31    m_position = vec3(512, 81, 0);
     32    m_velocity = vec3(-0.15f, 0, 0);
    3333}
    3434
     
    4141    enemytime = fmod(deltams + enemytime, 700.0f);;
    4242
    43     position += velocity * deltams;
     43    m_position += m_velocity * deltams;
    4444}
    4545
     
    4949
    5050    /* + 48 because of vertical flip */
    51     Scene::GetDefault()->AddTile(position.x > 255 ? enemy_casualblue : enemy_casualblueattack, (int)(enemytime * 6 / 700.0f), position + vec3(48.0f, 0, 0), 0, vec2(-3.0f, 3.0f));
     51    Scene::GetDefault()->AddTile(m_position.x > 255 ? enemy_casualblue : enemy_casualblueattack, (int)(enemytime * 6 / 700.0f), m_position + vec3(48.0f, 0, 0), 0, vec2(-3.0f, 3.0f));
    5252}
    5353
  • trunk/mrpigeon/mrpigeon.cpp

    r1211 r1300  
    5050    deco_floorrails = Tiler::Register("mrpigeon/gfx/DECO_floorRails3x.png", ivec2(72,24), ivec2(0));
    5151
    52     position = vec3(0, 0, 0);
    53     bbox[0] = position;
    54     bbox[1] = vec3(512, 384, 0);
     52    m_position = vec3(0, 0, 0);
     53    m_bbox[0] = m_position;
     54    m_bbox[1] = vec3(512, 384, 0);
    5555    Input::TrackMouse(this);
    5656}
     
    9292    for (int i = 0; i < 10; i++)
    9393    {
    94         if (enemies[i] && enemies[i]->position.x < -100.0f)
     94        if (enemies[i] && enemies[i]->m_position.x < -100.0f)
    9595        {
    9696            Ticker::Unref(enemies[i]);
  • trunk/mrpigeon/player.cpp

    r1211 r1300  
    3333    active_set(NULL),
    3434    active_frame(0),
    35     velocity(0.0f),
    3635    walktime(0.0f),
    3736    flytime(0.0f)
     
    4948    player_walkraisefist = Tiler::Register("mrpigeon/gfx/player_WalkRaiseFist.png", ivec2(16,32), ivec2(0)); /* 8 frames */
    5049
    51     position = vec3(120.0f, 400.0f, 5.0f);
     50    m_position = vec3(120.0f, 400.0f, 5.0f);
     51    m_velocity = vec3(0.f);
    5252    state = FALLING;
    5353}
     
    6464            for (int i = 0; i < 10; i++)
    6565                if (enemies[i]
    66                      && enemies[i]->position.x > position.x + 60.0f - 30.0f
    67                      && enemies[i]->position.x < position.x + 60.0f + 30.0f)
     66                     && enemies[i]->m_position.x > m_position.x + 60.0f - 30.0f
     67                     && enemies[i]->m_position.x < m_position.x + 60.0f + 30.0f)
    6868                {
    6969                    must_kick = true;
     
    7777            else
    7878            {
    79                 velocity.y = JUMPVEL;
     79                m_velocity.y = JUMPVEL;
    8080                state = JUMPING;
    8181            }
     
    8787        break;
    8888    case FALLING:
    89         velocity.y = -JUMPVEL;
     89        m_velocity.y = -JUMPVEL;
    9090        state = DASHDOWN;
    9191        break;
     
    103103    flytime = fmod(deltams + flytime, 400.0f);;
    104104
    105     vec3 oldvel = velocity;
     105    vec3 oldvel = m_velocity;
    106106    switch (state)
    107107    {
     
    116116        break;
    117117    case FALLING:
    118         velocity.y -= deltams * GRAVITY;
    119         position += (oldvel + velocity) * (0.5 * deltams);
    120         if (position.y < 81.0f)
    121         {
    122             position.y = 81.0f;
     118        m_velocity.y -= deltams * GRAVITY;
     119        m_position += (oldvel + m_velocity) * (0.5 * deltams);
     120        if (m_position.y < 81.0f)
     121        {
     122            m_position.y = 81.0f;
    123123            state = WALKING;
    124124        }
    125125        break;
    126126    case JUMPING:
    127         velocity.y -= deltams * GRAVITY;
    128         position += (oldvel + velocity) * (0.5 * deltams);
    129         if (velocity.y < 0.0f)
     127        m_velocity.y -= deltams * GRAVITY;
     128        m_position += (oldvel + m_velocity) * (0.5 * deltams);
     129        if (m_velocity.y < 0.0f)
    130130            state = FALLING;
    131131        break;
     
    134134        if (walktime >= LEN_KICKAIR)
    135135        {
    136             velocity.y = 0.0f;
     136            m_velocity.y = 0.0f;
    137137            state = FALLING;
    138138        }
    139139        break;
    140140    case DASHDOWN:
    141         velocity.y -= deltams * GRAVITY;
    142         position += (oldvel + velocity) * (0.5 * deltams);
    143         if (position.y < 81.0f)
    144         {
    145             position.y = 81.0f;
     141        m_velocity.y -= deltams * GRAVITY;
     142        m_position += (oldvel + m_velocity) * (0.5 * deltams);
     143        if (m_position.y < 81.0f)
     144        {
     145            m_position.y = 81.0f;
    146146            state = FUNKING;
    147147        }
     
    188188    Scene::GetDefault()->AddTile(pigeon_flying, (int)(flytime * 2 / 400.0f), ivec3(81, 147, 5), 0, vec2(3.0f));
    189189
    190     Scene::GetDefault()->AddTile(active_set, active_frame, ivec3(position), 0, vec2(3.0f));
     190    Scene::GetDefault()->AddTile(active_set, active_frame, ivec3(m_position), 0, vec2(3.0f));
    191191}
    192192
  • trunk/mrpigeon/redenemy.cpp

    r1211 r1300  
    3030    enemy_casualredfall = Tiler::Register("mrpigeon/gfx/enemy_CasualRED_fall.png", ivec2(16,24), ivec2(0));
    3131
    32     position = vec3(512, 81, 0);
    33     velocity = vec3(-0.15f, 0, 0);
     32    m_position = vec3(512, 81, 0);
     33    m_velocity = vec3(-0.15f, 0, 0);
    3434}
    3535
     
    4242    enemytime = fmod(deltams + enemytime, 700.0f);;
    4343
    44     position += velocity * deltams;
     44    m_position += m_velocity * deltams;
    4545}
    4646
     
    5050
    5151    /* + 48 because of vertical flip */
    52     Scene::GetDefault()->AddTile(enemy_casualred, (int)(enemytime * 6 / 700.0f), position + vec3(48.0f, 0, 0), 0, vec2(-3.0f, 3.0f));
     52    Scene::GetDefault()->AddTile(enemy_casualred, (int)(enemytime * 6 / 700.0f), m_position + vec3(48.0f, 0, 0), 0, vec2(-3.0f, 3.0f));
    5353}
    5454
  • trunk/src/gradient.cpp

    r1234 r1300  
    4545{
    4646    /* FIXME: this should not be hardcoded */
    47     position = aa;
    48     bbox[0] = aa;
    49     bbox[1] = bb;
     47    m_position = aa;
     48    m_bbox[0] = aa;
     49    m_bbox[1] = bb;
    5050
    5151    data->shader = NULL;
  • trunk/src/input.cpp

    r1136 r1300  
    121121    for (int n = 0; n < data->nentities; n++)
    122122    {
    123         if (coord.x < data->entities[n]->bbox[0].x
    124              || coord.x >= data->entities[n]->bbox[1].x
    125              || coord.y < data->entities[n]->bbox[0].y
    126              || coord.y >= data->entities[n]->bbox[1].y)
     123        if (coord.x < data->entities[n]->m_bbox[0].x
     124             || coord.x >= data->entities[n]->m_bbox[1].x
     125             || coord.y < data->entities[n]->m_bbox[0].y
     126             || coord.y >= data->entities[n]->m_bbox[1].y)
    127127            continue;
    128128
    129         if (!top || top->bbox[1].z < data->entities[n]->bbox[1].z)
     129        if (!top || top->m_bbox[1].z < data->entities[n]->m_bbox[1].z)
    130130            top = data->entities[n];
    131131    }
     
    135135        if (data->entities[n] == top)
    136136        {
    137             data->entities[n]->mousepos = coord - (ivec2)top->bbox[0].xy;
     137            data->entities[n]->m_mousepos = coord - (ivec2)top->m_bbox[0].xy;
    138138            if (top != data->lastfocus)
    139                 data->entities[n]->pressed = data->buttons;
     139                data->entities[n]->m_pressed = data->buttons;
    140140            else
    141                 data->entities[n]->clicked = ivec3(0);
     141                data->entities[n]->m_clicked = ivec3(0);
    142142        }
    143143        else
    144144        {
    145             data->entities[n]->mousepos = ivec2(-1);
     145            data->entities[n]->m_mousepos = ivec2(-1);
    146146            /* FIXME */
    147             data->entities[n]->released = ivec3(0);
    148             data->entities[n]->pressed = ivec3(0);
    149             data->entities[n]->clicked = ivec3(0);
     147            data->entities[n]->m_released = ivec3(0);
     148            data->entities[n]->m_pressed = ivec3(0);
     149            data->entities[n]->m_clicked = ivec3(0);
    150150        }
    151151    }
     
    160160    if (data->lastfocus)
    161161    {
    162         if (!data->lastfocus->pressed[index])
    163             data->lastfocus->clicked[index] = 1;
    164         data->lastfocus->pressed[index] = 1;
    165         data->lastfocus->released[index] = 0;
     162        if (!data->lastfocus->m_pressed[index])
     163            data->lastfocus->m_clicked[index] = 1;
     164        data->lastfocus->m_pressed[index] = 1;
     165        data->lastfocus->m_released[index] = 0;
    166166    }
    167167}
     
    173173    if (data->lastfocus)
    174174    {
    175         if (data->lastfocus->pressed[index])
    176             data->lastfocus->released[index] = 1;
    177         data->lastfocus->pressed[index] = 0;
    178         data->lastfocus->clicked[index] = 0;
     175        if (data->lastfocus->m_pressed[index])
     176            data->lastfocus->m_released[index] = 1;
     177        data->lastfocus->m_pressed[index] = 0;
     178        data->lastfocus->m_clicked[index] = 0;
    179179    }
    180180}
  • trunk/src/sprite.cpp

    r1198 r1300  
    5151    Entity::TickDraw(deltams);
    5252
    53     Scene::GetDefault()->AddTile(data->tileset, data->id, position,
     53    Scene::GetDefault()->AddTile(data->tileset, data->id, m_position,
    5454                                 0, vec2(1.0f));
    5555}
  • trunk/src/worldentity.cpp

    r1046 r1300  
    2626WorldEntity::WorldEntity()
    2727{
    28     position = vec3(0);
    29     rotation = vec3(0);
    30     velocity = vec3(0);
    31     bbox[0] = bbox[1] = vec3(0);
     28    m_position = vec3(0);
     29    m_rotation = vec3(0);
     30    m_velocity = vec3(0);
     31    m_bbox[0] = m_bbox[1] = vec3(0);
    3232
    33     mousepos = ivec2(0);
    34     mousebuttons = ivec3(0);
    35     pressed = ivec3(0);
    36     clicked = ivec3(0);
    37     released = ivec3(0);
     33    m_mousepos = ivec2(0);
     34    m_mousebuttons = ivec3(0);
     35    m_pressed = ivec3(0);
     36    m_clicked = ivec3(0);
     37    m_released = ivec3(0);
    3838}
    3939
  • trunk/src/worldentity.h

    r866 r1300  
    2525{
    2626public:
    27     vec3 position;
    28     vec3 rotation;
    29     vec3 velocity;
    30     vec3 bbox[2];
     27    vec3 m_position;
     28    vec3 m_rotation;
     29    vec3 m_velocity;
     30    vec3 m_bbox[2];
    3131
    32     ivec2 mousepos;
    33     ivec3 mousebuttons;
    34     ivec3 pressed, clicked, released;
     32    ivec2 m_mousepos;
     33    ivec3 m_mousebuttons;
     34    ivec3 m_pressed, m_clicked, m_released;
    3535
    3636protected:
  • trunk/test/tutorial/03_fractal.cpp

    r1242 r1300  
    154154#endif
    155155
    156         position = ivec3(0, 0, 0);
    157         bbox[0] = position;
    158         bbox[1] = ivec3(m_window_size, 0);
     156        m_position = ivec3(0, 0, 0);
     157        m_bbox[0] = m_position;
     158        m_bbox[1] = ivec3(m_window_size, 0);
    159159        Input::TrackMouse(this);
    160160
     
    209209        m_frame = (m_frame + 1) % 4;
    210210
    211         f64cmplx worldmouse = m_center + ScreenToWorldOffset(mousepos);
     211        f64cmplx worldmouse = m_center + ScreenToWorldOffset(m_mousepos);
    212212
    213213        ivec3 buttons = Input::GetMouseButtons();
     
    217217            if (!m_drag)
    218218            {
    219                 m_oldmouse = mousepos;
     219                m_oldmouse = m_mousepos;
    220220                m_drag = true;
    221221            }
    222222            m_translate = ScreenToWorldOffset(m_oldmouse)
    223                         - ScreenToWorldOffset(mousepos);
     223                        - ScreenToWorldOffset(m_mousepos);
    224224            /* XXX: the purpose of this hack is to avoid translating by
    225225             * an exact number of pixels. If this were to happen, the step()
     
    228228             * would have tie rankings in the distance calculation. */
    229229            m_translate *= 1023.0 / 1024.0;
    230             m_oldmouse = mousepos;
     230            m_oldmouse = m_mousepos;
    231231        }
    232232        else
     
    241241        }
    242242
    243         if ((buttons[0] || buttons[2]) && mousepos.x != -1)
     243        if ((buttons[0] || buttons[2]) && m_mousepos.x != -1)
    244244        {
    245245            double zoom = buttons[0] ? -0.0005 : 0.0005;
     
    275275            m_center += m_translate;
    276276            m_center = (m_center - worldmouse) * zoom + worldmouse;
    277             worldmouse = m_center + ScreenToWorldOffset(mousepos);
     277            worldmouse = m_center + ScreenToWorldOffset(m_mousepos);
    278278#endif
    279279
Note: See TracChangeset for help on using the changeset viewer.