Ignore:
Timestamp:
Mar 18, 2008, 12:05:08 AM (12 years ago)
Author:
Sam Hocevar
Message:
  • Cleaned up cache.cpp.
  • Renamed stupid "cash" variable into "cache".
  • Rename cache_list and crc_manager into CacheList? and CrcManager?.
File:
1 edited

Legend:

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

    r120 r123  
    103103  {
    104104    if (f)
    105       f->put_image(screen,cash.img(id),x,y,1);
     105      f->put_image(screen,cache.img(id),x,y,1);
    106106    else
    107       cash.img(id)->put_image(screen,x,y);
    108   }
    109   virtual int width() { return cash.img(id)->width(); }
    110   virtual int height() { return cash.img(id)->height(); }
     107      cache.img(id)->put_image(screen,x,y);
     108  }
     109  virtual int width() { return cache.img(id)->width(); }
     110  virtual int height() { return cache.img(id)->height(); }
    111111} ;
    112112
     
    158158    image *ok_image, *cancel_image;
    159159
    160     ok_image = cash.img(cash.reg("art/frame.spe", "dev_ok",
     160    ok_image = cache.img(cache.reg("art/frame.spe", "dev_ok",
    161161                                 SPEC_IMAGE, 1))->copy();
    162     cancel_image = cash.img(cash.reg("art/frame.spe", "cancel",
     162    cancel_image = cache.img(cache.reg("art/frame.spe", "cancel",
    163163                                     SPEC_IMAGE, 1))->copy();
    164164
     
    343343{
    344344  char const *artf="art/dev.spe";
    345   dev_del=cash.reg(artf,"dev_del",SPEC_IMAGE,0);
    346   dev_move=cash.reg(artf,"dev_move",SPEC_IMAGE,0);
    347   dev_char_left=cash.reg(artf,"dev_char_left",SPEC_IMAGE,0);
    348   dev_char_right=cash.reg(artf,"dev_char_right",SPEC_IMAGE,0);
    349   dev_back=cash.reg(artf,"dev_back",SPEC_IMAGE,0);
    350   dev_front=cash.reg(artf,"dev_front",SPEC_IMAGE,0);
    351   dev_ok=cash.reg(artf,"dev_ok",SPEC_IMAGE,0);
    352   dev_copy=cash.reg(artf,"dev_copy",SPEC_IMAGE,0);
    353   dev_brain=cash.reg(artf,"brain",SPEC_IMAGE,0);
    354   dev_lights=cash.reg(artf,"lights",SPEC_IMAGE,0);
    355   dev_objects=cash.reg(artf,"objects",SPEC_IMAGE,0);
    356   dev_ai=cash.reg(artf,"ai",SPEC_IMAGE,0);
    357   dev_forward=cash.reg(artf,"forward",SPEC_IMAGE,0);
    358   dev_backward=cash.reg(artf,"backward",SPEC_IMAGE,0);
     345  dev_del=cache.reg(artf,"dev_del",SPEC_IMAGE,0);
     346  dev_move=cache.reg(artf,"dev_move",SPEC_IMAGE,0);
     347  dev_char_left=cache.reg(artf,"dev_char_left",SPEC_IMAGE,0);
     348  dev_char_right=cache.reg(artf,"dev_char_right",SPEC_IMAGE,0);
     349  dev_back=cache.reg(artf,"dev_back",SPEC_IMAGE,0);
     350  dev_front=cache.reg(artf,"dev_front",SPEC_IMAGE,0);
     351  dev_ok=cache.reg(artf,"dev_ok",SPEC_IMAGE,0);
     352  dev_copy=cache.reg(artf,"dev_copy",SPEC_IMAGE,0);
     353  dev_brain=cache.reg(artf,"brain",SPEC_IMAGE,0);
     354  dev_lights=cache.reg(artf,"lights",SPEC_IMAGE,0);
     355  dev_objects=cache.reg(artf,"objects",SPEC_IMAGE,0);
     356  dev_ai=cache.reg(artf,"ai",SPEC_IMAGE,0);
     357  dev_forward=cache.reg(artf,"forward",SPEC_IMAGE,0);
     358  dev_backward=cache.reg(artf,"backward",SPEC_IMAGE,0);
    359359
    360360  for (int i=0;i<DEV_MODES;i++)
    361     dev_mode_icon[i]=cash.reg(artf,dev_mode_icon_names[i],SPEC_IMAGE,0);
     361    dev_mode_icon[i]=cache.reg(artf,dev_mode_icon_names[i],SPEC_IMAGE,0);
    362362
    363363}
     
    479479    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))
    480480    {
    481       image *im=cash.img(light_buttons[f->type]);
     481      image *im=cache.img(light_buttons[f->type]);
    482482      im->put_image(screen,f->x-vx+v->cx1-im->width()/2,f->y-vy+v->cy1-im->height()/2,1);
    483483      screen->rectangle(f->x1-vx+v->cx1,f->y1-vy+v->cy1,f->x2-vx+v->cx1,f->y2-vy+v->cy1,
     
    496496    if (selected_light)
    497497    {
    498       image *i=cash.img(light_buttons[0]);
     498      image *i=cache.img(light_buttons[0]);
    499499      int l=i->width()/2,h=i->height()/2;
    500500      int32_t rx1,ry1;
     
    562562static light_source *find_light(int32_t x, int32_t y)
    563563{
    564   image *i=cash.img(light_buttons[0]);
     564  image *i=cache.img(light_buttons[0]);
    565565  int l=i->width()/2,h=i->height()/2;
    566566  for (light_source *f=first_light_source;f;f=f->next)
     
    732732                                         yres / wm->font()->height() / 2,
    733733                                         listable_objs, total_listable, 0,
    734                                          NULL, cash.img(window_texture)));
     734                                         NULL, cache.img(window_texture)));
    735735}
    736736
     
    773773                                         yres / wm->font()->height() / 2,
    774774                                         pwin_list, total_pals, 0, NULL,
    775                                          cash.img(window_texture)));
     775                                         cache.img(window_texture)));
    776776}
    777777
     
    853853    }
    854854
    855     int bw = cash.img(dev_forward)->width();
     855    int bw = cache.img(dev_forward)->width();
    856856    /* FIXME: previous code had 1,1 instead of 0,0 -- investigate */
    857857    search_window = wm->new_window(prop->getd("searchw x", -30),
     
    861861                       prop->get("search name", ""),
    862862        new button(bw, wm->font()->height() + 5, ID_SEARCH_BACKWARD,
    863                    cash.img(dev_backward),
     863                   cache.img(dev_backward),
    864864        new button(bw * 3, wm->font()->height() + 5, ID_SEARCH_FOREWARD,
    865                    cash.img(dev_forward), NULL))), "SEARCH");
     865                   cache.img(dev_forward), NULL))), "SEARCH");
    866866
    867867    /* FIXME: shouldn't this be 1? */
     
    11931193    {
    11941194      current_level->delete_object(selected_object);
    1195       if (S_DELETE_SND>0) cash.sfx(S_DELETE_SND)->play(sfx_volume/2);
     1195      if (S_DELETE_SND>0) cache.sfx(S_DELETE_SND)->play(sfx_volume/2);
    11961196      selected_object=NULL;
    11971197    }
     
    12041204    {
    12051205          current_level->remove_light(selected_light);
    1206       if (S_DELETE_SND>0) cash.sfx(S_DELETE_SND)->play(sfx_volume/2);
     1206      if (S_DELETE_SND>0) cache.sfx(S_DELETE_SND)->play(sfx_volume/2);
    12071207    }
    12081208    else
     
    13971397                            prop->getd("light create y", 0), -1, -1,
    13981398        new button_box(0, 0, DEV_LIGHT_BUTTON_BOX, 1,
    1399             new button(bw * 0, bh * 0, DEV_LIGHT0, cash.img(light_buttons[0]),
    1400             new button(bw * 1, bh * 0, DEV_LIGHT1, cash.img(light_buttons[1]),
    1401             new button(bw * 2, bh * 0, DEV_LIGHT2, cash.img(light_buttons[2]),
    1402             new button(bw * 0, bh * 1, DEV_LIGHT3, cash.img(light_buttons[3]),
    1403             new button(bw * 1, bh * 1, DEV_LIGHT4, cash.img(light_buttons[4]),
    1404             new button(bw * 2, bh * 1, DEV_LIGHT5, cash.img(light_buttons[5]),
    1405             new button(bw * 0, bh * 2, DEV_LIGHT6, cash.img(light_buttons[6]),
    1406             new button(bw * 1, bh * 2, DEV_LIGHT7, cash.img(light_buttons[7]),
    1407             new button(bw * 2, bh * 2, DEV_LIGHT8, cash.img(light_buttons[8]),
    1408             new button(bw * 0, bh * 3, DEV_LIGHT9, cash.img(light_buttons[9]),
    1409             new button(bw * 1, bh * 3, DEV_AMBIENT, cash.img(light_buttons[11]),
     1399            new button(bw * 0, bh * 0, DEV_LIGHT0, cache.img(light_buttons[0]),
     1400            new button(bw * 1, bh * 0, DEV_LIGHT1, cache.img(light_buttons[1]),
     1401            new button(bw * 2, bh * 0, DEV_LIGHT2, cache.img(light_buttons[2]),
     1402            new button(bw * 0, bh * 1, DEV_LIGHT3, cache.img(light_buttons[3]),
     1403            new button(bw * 1, bh * 1, DEV_LIGHT4, cache.img(light_buttons[4]),
     1404            new button(bw * 2, bh * 1, DEV_LIGHT5, cache.img(light_buttons[5]),
     1405            new button(bw * 0, bh * 2, DEV_LIGHT6, cache.img(light_buttons[6]),
     1406            new button(bw * 1, bh * 2, DEV_LIGHT7, cache.img(light_buttons[7]),
     1407            new button(bw * 2, bh * 2, DEV_LIGHT8, cache.img(light_buttons[8]),
     1408            new button(bw * 0, bh * 3, DEV_LIGHT9, cache.img(light_buttons[9]),
     1409            new button(bw * 1, bh * 3, DEV_AMBIENT, cache.img(light_buttons[11]),
    14101410            NULL))))))))))),
    14111411        new text_field(0, bh * 4, DEV_LIGHTW, "W ", "******",
     
    14541454               prop->getd("ai y",0),
    14551455               -1,-1,
    1456        new button(wl,owh-20,DEV_AI_OK,cash.img(dev_ok),first),"ai");
     1456       new button(wl,owh-20,DEV_AI_OK,cache.img(dev_ok),first),"ai");
    14571457
    14581458  }
     
    14621462               prop->getd("ai y",0),
    14631463               -1,-1,
    1464        new button(wl,wh-20,DEV_AI_OK,cash.img(dev_ok),
     1464       new button(wl,wh-20,DEV_AI_OK,cache.img(dev_ok),
    14651465       new text_field(wl,wh+th*0, DEV_AI_XVEL,    symbol_str("ai_xvel"),"#####",(double)o->xvel(),
    14661466       new text_field(wl,wh+th*1, DEV_AI_YVEL,    symbol_str("ai_yvel"),"#####",(double)o->yvel(),
     
    16351635    {
    16361636      if (area_win) close_area_win(0);
    1637       int wl=0,wh=0,th=wm->font()->height()+12,bw=cash.img(dev_ok)->width()+10;
     1637      int wl=0,wh=0,th=wm->font()->height()+12,bw=cache.img(dev_ok)->width()+10;
    16381638      area_win=wm->new_window(prop->getd("area_box x",0),
    16391639                  prop->getd("area_box y",0),
    16401640                  -1,-1,
    16411641
    1642                   new button(wl+bw*0,wh-8,DEV_AREA_OK,cash.img(dev_ok),
    1643                   new button(wl+bw*1,wh-8,DEV_AREA_DELETE,cash.img(dev_del),
     1642                  new button(wl+bw*0,wh-8,DEV_AREA_OK,cache.img(dev_ok),
     1643                  new button(wl+bw*1,wh-8,DEV_AREA_DELETE,cache.img(dev_del),
    16441644
    16451645                  new text_field(wl,wh+th*1,DEV_AREA_AMBIENT,         symbol_str("a_ambient"),"******",current_area->ambient,
     
    19701970                 prop->getd("oedit y",0),
    19711971                 -1,-1,new button_box(0,0,ID_NULL,1,
    1972         new button(bw*0,0,DEV_OEDIT_OK,cash.img(dev_ok),
    1973         new button(bw*1,0,DEV_OEDIT_MOVE,cash.img(dev_move),
    1974         new button(bw*2,0,DEV_OEDIT_FRONT,cash.img(dev_front),
    1975             new button(bw*3,0,DEV_OEDIT_BACK,cash.img(dev_back),
    1976             new button(bw*4,0,DEV_OEDIT_COPY,cash.img(dev_copy),
    1977         new button(bw*0,bh*1,DEV_OEDIT_DELETE,cash.img(dev_del),
     1972        new button(bw*0,0,DEV_OEDIT_OK,cache.img(dev_ok),
     1973        new button(bw*1,0,DEV_OEDIT_MOVE,cache.img(dev_move),
     1974        new button(bw*2,0,DEV_OEDIT_FRONT,cache.img(dev_front),
     1975            new button(bw*3,0,DEV_OEDIT_BACK,cache.img(dev_back),
     1976            new button(bw*4,0,DEV_OEDIT_COPY,cache.img(dev_copy),
     1977        new button(bw*0,bh*1,DEV_OEDIT_DELETE,cache.img(dev_del),
    19781978               NULL)))))),
    1979            new button(bw*5,bh*0,DEV_OEDIT_AI,cash.img(dev_ai),
     1979           new button(bw*5,bh*0,DEV_OEDIT_AI,cache.img(dev_ai),
    19801980
    19811981           new button_box(bw*1,bh*1,DEV_OEDIT_CHAR_BOX,0,
    1982            new button(bw*1,bh*1,DEV_OEDIT_LEFT,cash.img(dev_char_left),
    1983            new button(bw*2,bh*1,DEV_OEDIT_RIGHT,cash.img(dev_char_right),NULL)),
    1984 
    1985            new button(bw*3,bh*1,DEV_OBJECTS_DELETE,cash.img(dev_objects),
    1986            new button(bw*4,bh*1,DEV_LIGHTS_DELETE,cash.img(dev_lights),NULL))))),
     1982           new button(bw*1,bh*1,DEV_OEDIT_LEFT,cache.img(dev_char_left),
     1983           new button(bw*2,bh*1,DEV_OEDIT_RIGHT,cache.img(dev_char_right),NULL)),
     1984
     1985           new button(bw*3,bh*1,DEV_OBJECTS_DELETE,cache.img(dev_objects),
     1986           new button(bw*4,bh*1,DEV_LIGHTS_DELETE,cache.img(dev_lights),NULL))))),
    19871987                 symbol_str("l_EDIT"));
    19881988
     
    20082008                 -1,-1,
    20092009              new button_box(0,0,ID_NULL,1,
    2010                    new button(bw*0,0,DEV_LEDIT_OK,cash.img(dev_ok),
    2011                new button(bw*1,0,DEV_LEDIT_MOVE,cash.img(dev_move),
    2012                   new button(bw*2,0,DEV_LEDIT_COPY,cash.img(dev_copy),
    2013             new button(bw*3,0,DEV_LEDIT_DEL,cash.img(dev_del),NULL)))),
     2010                   new button(bw*0,0,DEV_LEDIT_OK,cache.img(dev_ok),
     2011               new button(bw*1,0,DEV_LEDIT_MOVE,cache.img(dev_move),
     2012                  new button(bw*2,0,DEV_LEDIT_COPY,cache.img(dev_copy),
     2013            new button(bw*3,0,DEV_LEDIT_DEL,cache.img(dev_del),NULL)))),
    20142014            new text_field(0,bh,DEV_LEDIT_W,      "W ","******",edit_light->xshift,
    20152015            new text_field(0,bh+th*1,DEV_LEDIT_H, "H ","******",edit_light->yshift,
     
    21522152    case ID_CACHE_PROFILE :
    21532153    {
    2154       if (current_level && !cash.prof_is_on())
    2155       {
    2156         cash.prof_init();
     2154      if (current_level && !cache.prof_is_on())
     2155      {
     2156        cache.prof_init();
    21572157        the_game->show_help("Cache profiling is now on.");
    21582158      }
     
    21622162    case ID_CACHE_PROFILE_END :  // ask the user for a file name to save as
    21632163    {
    2164       if (cash.prof_is_on())
    2165       {
    2166         cash.prof_uninit();
     2164      if (cache.prof_is_on())
     2165      {
     2166        cache.prof_uninit();
    21672167        the_game->show_help(symbol_str("prof_off"));
    21682168      } else the_game->show_help(symbol_str("prof"));
     
    27542754    {
    27552755      link_object->add_object(selected_object);
    2756       if (S_LINK_SND>0) cash.sfx(S_LINK_SND)->play(sfx_volume/2);
     2756      if (S_LINK_SND>0) cache.sfx(S_LINK_SND)->play(sfx_volume/2);
    27572757      the_game->need_refresh();
    27582758    }
     
    34213421    if (foretiles[i]>=0)
    34223422    {
    3423       if (cash.loaded(foretiles[i]))
     3423      if (cache.loaded(foretiles[i]))
    34243424      {
    34253425    t++;
    3426     s+=cash.foret(foretiles[i])->size();
     3426    s+=cache.foret(foretiles[i])->size();
    34273427      }
    34283428    }
     
    34353435    if (backtiles[i]>=0)
    34363436    {
    3437       if (cash.loaded(foretiles[i]))
     3437      if (cache.loaded(foretiles[i]))
    34383438      {
    34393439    t++;
    3440     s+=cash.backt(backtiles[i])->size();
     3440    s+=cache.backt(backtiles[i])->size();
    34413441      }
    34423442    }
     
    34663466    listable_objs=NULL;
    34673467  }
    3468   crc_man.clean_up();
     3468  crc_manager.clean_up();
    34693469
    34703470}
     
    36413641  if (dev&EDIT_MODE)
    36423642  {
    3643     wm->set_mouse_shape(cash.img(c_normal)->copy(),1,1);
     3643    wm->set_mouse_shape(cache.img(c_normal)->copy(),1,1);
    36443644    pal->load();
    36453645  }
     
    36473647  {
    36483648    if (dev&MAP_MODE) dev-=MAP_MODE;                        // no map mode while playing!
    3649     wm->set_mouse_shape(cash.img(c_target)->copy(),8,8);
     3649    wm->set_mouse_shape(cache.img(c_target)->copy(),8,8);
    36503650  }
    36513651  if ((dev&EDIT_MODE) && !dev_menu)
Note: See TracChangeset for help on using the changeset viewer.