Ignore:
Timestamp:
May 16, 2011, 2:37:43 AM (9 years ago)
Author:
Sam Hocevar
Message:

game: convert a few View members to vec2i.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/dev.cpp

    r671 r674  
    230230static void single_render()
    231231{
    232   // enlarge clip area
    233   the_game->first_view->cx2=the_game->first_view->cx1+
    234                             (the_game->first_view->cx2-the_game->first_view->cx1+1)*2;
    235   the_game->first_view->cy2=the_game->first_view->cy1+
    236                             (the_game->first_view->cy2-the_game->first_view->cy1+1)*2;
    237   delete small_render;
    238   small_render=NULL;
    239   small_render_on=0;
     232    // enlarge clip area
     233    view *v = the_game->first_view;
     234    v->m_bb = v->m_aa + 2 * (v->m_bb - v->m_aa + vec2i(1));
     235    delete small_render;
     236    small_render = NULL;
     237    small_render_on = 0;
    240238}
    241239
    242240static void double_render()
    243241{
    244   small_render_on=1;
    245   // reduce clip area
    246   the_game->first_view->cx2=the_game->first_view->cx1+
    247                             (the_game->first_view->cx2-the_game->first_view->cx1+1)/2;
    248   the_game->first_view->cy2=the_game->first_view->cy1+
    249                             (the_game->first_view->cy2-the_game->first_view->cy1+1)/2;
    250 
    251   small_render=new image(vec2i(the_game->first_view->cx2-the_game->first_view->cx1+1, the_game->first_view->cy2-the_game->first_view->cy1+1),NULL,2);
     242    // reduce clip area
     243    view *v = the_game->first_view;
     244    v->m_bb = v->m_aa + (v->m_bb - v->m_aa + vec2i(1)) / 2;
     245    small_render = new image(v->m_bb - v->m_aa + vec2i(1), NULL, 2);
     246    small_render_on = 1;
    252247}
    253248
     
    478473      for (light_source *f=first_light_source; f; f=f->next)
    479474      {
    480     if (f->x-vx>=0 && f->x-vx<=(v->cx2-v->cx1+1) && f->y-vy>=0 && f->y-vy<=(v->cy2-v->cy1+1))
     475    if (f->x-vx>=0 && f->x-vx<=(v->m_bb.x-v->m_aa.x+1) && f->y-vy>=0 && f->y-vy<=(v->m_bb.y-v->m_aa.y+1))
    481476    {
    482477      image *im = cache.img(light_buttons[f->type]);
    483       main_screen->PutImage(im, vec2i(f->x - vx + v->cx1 - im->Size().x / 2,
    484                                       f->y - vy + v->cy1 - im->Size().y / 2), 1);
    485       main_screen->Rectangle(vec2i(f->x1 - vx + v->cx1, f->y1 - vy + v->cy1),
    486                              vec2i(f->x2 - vx + v->cx1, f->y2 - vy + v->cy1),
     478      main_screen->PutImage(im, vec2i(f->x - vx, f->y - vy)
     479                                  + v->m_aa - im->Size() / 2);
     480      main_screen->Rectangle(vec2i(f->x1 - vx, f->y1 - vy) + v->m_aa,
     481                             vec2i(f->x2 - vx, f->y2 - vy) + v->m_aa,
    487482                             wm->medium_color());
    488483    }
Note: See TracChangeset for help on using the changeset viewer.