Changeset 719


Ignore:
Timestamp:
Sep 23, 2013, 11:03:03 PM (9 years ago)
Author:
Sam Hocevar
Message:

core: use vec2::zero and ivec2::zero in a few places.

Location:
abuse/branches/lol/src
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • abuse/branches/lol/src/automap.cpp

    r715 r719  
    145145
    146146  // set the clip back to full window size because soemthing else could mess with the area
    147   automap_window->m_surf->SetClip(ivec2(0), screen->Size());
     147  automap_window->m_surf->SetClip(ivec2::zero, screen->Size());
    148148}
    149149
     
    160160        old_dy = -1000;
    161161
    162         automap_window = wm->CreateWindow(ivec2(0), ivec2(w * AUTOTILE_WIDTH,
     162        automap_window = wm->CreateWindow(ivec2::zero, ivec2(w * AUTOTILE_WIDTH,
    163163                                          h * AUTOTILE_HEIGHT), "Map");
    164164        automap_window->m_surf->Bar(ivec2(17, 1), ivec2(17 + 8 * 6 + 3, 6),
  • abuse/branches/lol/src/chars.h

    r642 r719  
    9090    ~CharacterType();
    9191
    92   uint16_t ts,tiv,tv; // total states, total index vars, total local vars
    93   sequence **seq;   // [0..ts-1]
     92  int ts, tiv, tv; // total states, total index vars, total local vars
     93  sequence **seq;  // [0..ts-1]
    9494  LSymbol **seq_syms;  // symbol describing what this state is [0..ts-1]
    9595
  • abuse/branches/lol/src/cop.cpp

    r716 r719  
    587587      o->set_state((character_state)S_climbing);
    588588      o->set_gravity(0);
    589       o->m_vel = ivec2(0);
    590       o->m_accel = ivec2(0);
     589      o->m_vel = ivec2::zero;
     590      o->m_accel = ivec2::zero;
    591591      return 0;
    592592    } else
  • abuse/branches/lol/src/game.cpp

    r718 r719  
    120120    widgets << new AButton(ivec2(0, 0), ID_QUIT_OK, "Quit");
    121121    widgets << new AInfoField(ivec2(0, wm->font()->Size().y * 2), ID_NULL, no_space_msg);
    122     AWindow *no_space = wm->CreateWindow(ivec2(0), ivec2(-1), "ERROR", widgets);
     122    AWindow *no_space = wm->CreateWindow(ivec2::zero, ivec2(-1), "ERROR", widgets);
    123123
    124124    Event ev;
     
    19691969void Game::draw(int scene_mode)
    19701970{
    1971     main_screen->AddDirty(ivec2(0), ivec2(xres, yres));
     1971    main_screen->AddDirty(ivec2::zero, ivec2(xres, yres));
    19721972
    19731973    main_screen->clear();
  • abuse/branches/lol/src/gui.cpp

    r716 r719  
    103103        int g = 80;
    104104        screen->Bar(ivec2(0, 0), ivec2(144, 20), 0);
    105         wm->font()->PutString(screen, ivec2(0), symbol_str(key),
     105        wm->font()->PutString(screen, ivec2::zero, symbol_str(key),
    106106                              color_table->Lookup(u8vec3(g >> 3, g >> 3, g >> 3)));
    107107    }
  • abuse/branches/lol/src/imlib/filesel.cpp

    r716 r719  
    141141    widgets << new AButton(ivec2(100, wh3), cancel_id, cancel_name);
    142142    widgets << new AFilePicker(ivec2(15, wh3 + wm->font()->Size().y + 10), filename_id, 8);
    143     return wm->CreateWindow(ivec2(0), ivec2(-1), FILENAME_str, widgets);
     143    return wm->CreateWindow(ivec2::zero, ivec2(-1), FILENAME_str, widgets);
    144144}
    145145
  • abuse/branches/lol/src/imlib/filter.cpp

    r709 r719  
    3939
    4040        // Make sure non-blacks don't get remapped to the transparency
    41         if (color != u8vec3(0) && to->GetColor(n) == u8vec3(0))
     41        if (color != u8vec3::zero && to->GetColor(n) == u8vec3::zero)
    4242            n = dk;
    4343
     
    7272void Filter::PutImage(AImage *screen, AImage *im, ivec2 pos)
    7373{
    74     ivec2 aa = ivec2(0), bb = im->Size(), caa, cbb;
     74    ivec2 aa = ivec2::zero, bb = im->Size(), caa, cbb;
    7575    screen->GetClip(caa, cbb);
    7676
     
    7979        return;
    8080
    81     aa += lol::max(caa - pos, ivec2(0));
     81    aa += lol::max(caa - pos, ivec2::zero);
    8282    pos = lol::max(pos, caa);
    8383    bb = lol::min(bb, cbb - pos + aa);
  • abuse/branches/lol/src/imlib/fonts.cpp

    r715 r719  
    4545    {
    4646        tmp.clear();
    47         tmp.PutPart(letters, ivec2(0),
     47        tmp.PutPart(letters, ivec2::zero,
    4848                    ivec2(ch % 32, ch / 32) * m_size,
    4949                    ivec2(ch % 32 + 1, ch / 32 + 1) * m_size, 1);
  • abuse/branches/lol/src/imlib/image.cpp

    r711 r719  
    2424image_descriptor::image_descriptor(ivec2 size, int keep_dirties)
    2525{
    26     m_aa = ivec2(0);
     26    m_aa = ivec2::zero;
    2727    m_bb = size;
    2828    m_size = size;
     
    115115        for(int j = 0; j < m_size.y; j++)
    116116            memset(scan_line(j), color, m_size.x);
    117     AddDirty(ivec2(0), m_size);
     117    AddDirty(ivec2::zero, m_size);
    118118}
    119119
     
    198198void AImage::PutImage(AImage *im, ivec2 pos, int transparent)
    199199{
    200     PutPart(im, pos, ivec2(0), im->m_size, transparent);
     200    PutPart(im, pos, ivec2::zero, im->m_size, transparent);
    201201}
    202202
     
    210210    // see if the are to be put is outside of actual image, if so adjust
    211211    // to fit in the image
    212     pos += lol::min(aa, ivec2(0));
    213     aa += lol::min(aa, ivec2(0));
     212    pos += lol::min(aa, ivec2::zero);
     213    aa += lol::min(aa, ivec2::zero);
    214214    bb = lol::min(bb, im->m_size);
    215215    // return if it was adjusted so that nothing will be put
     
    221221        return;
    222222
    223     aa += lol::max(caa - pos, ivec2(0));
    224     pos += lol::max(caa - pos, ivec2(0));
     223    aa += lol::max(caa - pos, ivec2::zero);
     224    pos += lol::max(caa - pos, ivec2::zero);
    225225    bb = lol::min(bb, cbb - pos + aa);
    226226    if (!(aa < bb))
     
    272272    else
    273273    {
    274         aa = ivec2(0);
     274        aa = ivec2::zero;
    275275        bb = m_size;
    276276    }
     
    348348        return;
    349349
    350     aa = lol::max(aa, ivec2(0));
     350    aa = lol::max(aa, ivec2::zero);
    351351    bb = lol::min(bb, m_size);
    352352
     
    441441        return;
    442442
    443     aa = lol::max(aa, ivec2(0));
     443    aa = lol::max(aa, ivec2::zero);
    444444    bb = lol::min(bb, m_size);
    445445
  • abuse/branches/lol/src/imlib/palette.cpp

    r708 r719  
    146146void Palette::defaults()
    147147{
    148     m_colors[0] = u8vec3(0);
     148    m_colors[0] = u8vec3::zero;
    149149    m_used[0] = 1;
    150150
  • abuse/branches/lol/src/imlib/sprite.cpp

    r711 r719  
    3232    m_save = new AImage(visual->Size());
    3333
    34     if (m_pos + visual->Size() >= ivec2(0) && m_pos < ivec2(xres, yres))
    35         m_save->PutPart(m_screen, ivec2(0), m_pos, m_pos + m_save->Size());
     34    if (m_pos + visual->Size() >= ivec2::zero && m_pos < ivec2(xres, yres))
     35        m_save->PutPart(m_screen, ivec2::zero, m_pos, m_pos + m_save->Size());
    3636}
    3737
     
    5252    }
    5353
    54     if (m_pos + visual->Size() >= ivec2(0) && m_pos < ivec2(xres, yres))
    55         m_save->PutPart(m_screen, ivec2(0), m_pos, m_pos + m_save->Size());
     54    if (m_pos + visual->Size() >= ivec2::zero && m_pos < ivec2(xres, yres))
     55        m_save->PutPart(m_screen, ivec2::zero, m_pos, m_pos + m_save->Size());
    5656}
    5757
  • abuse/branches/lol/src/imlib/transimage.cpp

    r709 r719  
    102102    memset(im->scan_line(0), 0, m_size.x * m_size.y);
    103103
    104     PutImage(im, ivec2(0));
     104    PutImage(im, ivec2::zero);
    105105    return im;
    106106}
     
    265265void TransImage::PutImage(AImage *screen, ivec2 pos)
    266266{
    267     PutImageGeneric<NORMAL>(screen, pos, 0, NULL, ivec2(0), NULL, NULL,
     267    PutImageGeneric<NORMAL>(screen, pos, 0, NULL, ivec2::zero, NULL, NULL,
    268268                            0, 1, NULL, NULL, NULL);
    269269}
     
    271271void TransImage::PutRemap(AImage *screen, ivec2 pos, uint8_t *map)
    272272{
    273     PutImageGeneric<REMAP>(screen, pos, 0, NULL, ivec2(0), map, NULL,
     273    PutImageGeneric<REMAP>(screen, pos, 0, NULL, ivec2::zero, map, NULL,
    274274                           0, 1, NULL, NULL, NULL);
    275275}
     
    278278                            uint8_t *map, uint8_t *map2)
    279279{
    280     PutImageGeneric<REMAP2>(screen, pos, 0, NULL, ivec2(0), map, map2,
     280    PutImageGeneric<REMAP2>(screen, pos, 0, NULL, ivec2::zero, map, map2,
    281281                            0, 1, NULL, NULL, NULL);
    282282}
     
    286286                         ColorFilter *f, Palette *pal)
    287287{
    288     PutImageGeneric<FADE>(screen, pos, 0, NULL, ivec2(0), NULL, NULL,
     288    PutImageGeneric<FADE>(screen, pos, 0, NULL, ivec2::zero, NULL, NULL,
    289289                          amount, nframes, NULL, f, pal);
    290290}
     
    293293                             uint8_t *tint, ColorFilter *f, Palette *pal)
    294294{
    295     PutImageGeneric<FADE_TINT>(screen, pos, 0, NULL, ivec2(0), NULL, NULL,
     295    PutImageGeneric<FADE_TINT>(screen, pos, 0, NULL, ivec2::zero, NULL, NULL,
    296296                               amount, nframes, tint, f, pal);
    297297}
     
    299299void TransImage::PutColor(AImage *screen, ivec2 pos, uint8_t color)
    300300{
    301     PutImageGeneric<COLOR>(screen, pos, color, NULL, ivec2(0), NULL, NULL,
     301    PutImageGeneric<COLOR>(screen, pos, color, NULL, ivec2::zero, NULL, NULL,
    302302                           0, 1, NULL, NULL, NULL);
    303303}
     
    314314void TransImage::PutFilled(AImage *screen, ivec2 pos, uint8_t color)
    315315{
    316     PutImageGeneric<FILLED>(screen, pos, color, NULL, ivec2(0), NULL, NULL,
     316    PutImageGeneric<FILLED>(screen, pos, color, NULL, ivec2::zero, NULL, NULL,
    317317                            0, 1, NULL, NULL, NULL);
    318318}
     
    320320void TransImage::PutPredator(AImage *screen, ivec2 pos)
    321321{
    322     PutImageGeneric<PREDATOR>(screen, pos, 0, NULL, ivec2(0), NULL, NULL,
     322    PutImageGeneric<PREDATOR>(screen, pos, 0, NULL, ivec2::zero, NULL, NULL,
    323323                              0, 1, NULL, NULL, NULL);
    324324}
     
    326326void TransImage::PutScanLine(AImage *screen, ivec2 pos, int line)
    327327{
    328     PutImageGeneric<SCANLINE>(screen, pos, 0, NULL, ivec2(0), NULL, NULL,
     328    PutImageGeneric<SCANLINE>(screen, pos, 0, NULL, ivec2::zero, NULL, NULL,
    329329                              line, 1, NULL, NULL, NULL);
    330330}
  • abuse/branches/lol/src/imlib/window.cpp

    r716 r719  
    101101    {
    102102        j->show();
    103         j->m_surf->AddDirty(ivec2(0), j->m_size);
     103        j->m_surf->AddDirty(ivec2::zero, j->m_size);
    104104    }
    105105}
     
    180180      for (p=m_first; p!=j; p=p->next)
    181181        p->m_surf->AddDirty(j->x-p->x,j->y-p->y,j->x+j->l-p->x,j->y+j->h-p->y); */
    182                     j->m_surf->AddDirty(ivec2(0), j->m_size);
     182                    j->m_surf->AddDirty(ivec2::zero, j->m_size);
    183183                    flush_screen();
    184184                }
     
    240240    j->m_pos.x = x;
    241241    j->m_pos.y = y;
    242     j->m_surf->AddDirty(ivec2(0), j->m_size);
     242    j->m_surf->AddDirty(ivec2::zero, j->m_size);
    243243}
    244244
     
    250250    m_surf = screen;
    251251    hi = Hi; low = Low; med = Med; m_first = NULL; m_pal = pal; m_grab = NULL;
    252     bk = pal->FindClosest(u8vec3(0));
     252    bk = pal->FindClosest(u8vec3::zero);
    253253    state = inputing; fnt = Font;  wframe_fnt = Font;
    254254    memset(key_state, 0, sizeof(key_state));
     
    383383AWindow::AWindow(ivec2 pos, ivec2 size, String const &name, AWidgetList const &widgets)
    384384{
    385     m_size = ivec2(0);
     385    m_size = ivec2::zero;
    386386    _hidden = false;
    387387    _moveable = true;
  • abuse/branches/lol/src/light.cpp

    r709 r719  
    253253            for (int intensity = 63; intensity >= 0; intensity--)
    254254            {
    255                 if (rgb != u8vec3(0))
     255                if (rgb != u8vec3::zero)
    256256                    white_light[intensity*256+color] = pal->FindClosest(rgb);
    257257                else
     
    501501LightPatch *MakePatchList(ivec2 size, ivec2 screen)
    502502{
    503     LightPatch *first = new LightPatch(ivec2(0), size - ivec2(1), nullptr);
     503    LightPatch *first = new LightPatch(ivec2::zero, size - ivec2(1), nullptr);
    504504
    505505    // determine which lights will have effect
    506506    for (LightSource *f = first_light_source; f; f = f->m_next)
    507507    {
    508         ivec2 p1 = lol::max(f->m_p1 - screen, ivec2(0));
     508        ivec2 p1 = lol::max(f->m_p1 - screen, ivec2::zero);
    509509        ivec2 p2 = lol::min(f->m_p2 - screen, size - ivec2(1));
    510510
  • abuse/branches/lol/src/loadgame.cpp

    r715 r719  
    201201            thumbnails[start_num] = new AImage(ivec2(160, 100));
    202202            thumbnails[start_num]->clear();
    203             console_font->PutString(thumbnails[start_num], ivec2(0), symbol_str("no_saved"));
     203            console_font->PutString(thumbnails[start_num], ivec2::zero, symbol_str("no_saved"));
    204204            total_saved++;
    205205            if (!first) first=thumbnails[start_num];
  • abuse/branches/lol/src/menu.cpp

    r715 r719  
    7676    main_screen->Line(ivec2(bb.x - 1, aa.y + 1), bb - ivec2(1), dr);
    7777    main_screen->Line(ivec2(aa.x + 1, bb.y - 1), bb - ivec2(1), dr);
    78     TintArea(aa + ivec2(1), bb, u8vec3(0), amount);
     78    TintArea(aa + ivec2(1), bb, u8vec3::zero, amount);
    7979}
    8080
     
    612612    inm->clear_current();
    613613
    614     main_screen->AddDirty(ivec2(0), ivec2(320, 200));
     614    main_screen->AddDirty(ivec2::zero, ivec2(320, 200));
    615615
    616616    Event ev;
  • abuse/branches/lol/src/sdlport/hmi.cpp

    r616 r719  
    300300
    301301    // Write Midi file header
    302     uint8_t midi_header[] = { 0x4D, 0x54, 0x68, 0x64, 0x00, 0x00, 0x00, 0x06, 0x00, 0x01, 0x00, (num_tracks + 1), 0x00, 0xC0 };
     302    uint8_t midi_header[] = { 0x4D, 0x54, 0x68, 0x64, 0x00, 0x00, 0x00, 0x06, 0x00, 0x01, 0x00, (uint8_t)(num_tracks + 1), 0x00, 0xC0 };
    303303    memcpy(output_buffer_ptr, midi_header, 14);
    304304    output_buffer_ptr += 14;
  • abuse/branches/lol/src/transp.cpp

    r709 r719  
    2525    ivec2 pos(x, y);
    2626
    27     aa += lol::max(caa - pos, ivec2(0));
    28     bb -= lol::max(caa - pos, ivec2(0));
     27    aa += lol::max(caa - pos, ivec2::zero);
     28    bb -= lol::max(caa - pos, ivec2::zero);
    2929    pos = lol::max(caa, pos);
    3030
    3131    bb = lol::min(bb, cbb - ivec2(1) - pos);
    3232
    33     if (!(bb >= ivec2(0)))
     33    if (!(bb >= ivec2::zero))
    3434        return;
    3535    screen->AddDirty(pos, pos + bb);
  • abuse/branches/lol/src/view.cpp

    r716 r719  
    196196  no_ytop=0;
    197197  no_ybottom=0;
    198     m_lastlastpos = m_lastpos = focus ? focus->m_pos : ivec2(0);
     198    m_lastlastpos = m_lastpos = focus ? focus->m_pos : ivec2::zero;
    199199  last_hp=last_ammo=-1;
    200200  last_type=-1;
     
    215215
    216216  player_number=number;
    217     m_aa = ivec2(0);
     217    m_aa = ivec2::zero;
    218218    m_bb = ivec2(100);
    219219    m_focus = focus;
Note: See TracChangeset for help on using the changeset viewer.