Changeset 123


Ignore:
Timestamp:
Mar 18, 2008, 12:05:08 AM (11 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?.
Location:
abuse/trunk/src
Files:
34 edited

Legend:

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

    r106 r123  
    445445    wm->set_mouse_position(0,0);
    446446    screen->clear();
    447     image *im=cash.img(cash.reg("art/frame.spe","end_level_screen",SPEC_IMAGE,1));
     447    image *im=cache.img(cache.reg("art/frame.spe","end_level_screen",SPEC_IMAGE,1));
    448448    im->put_image(screen,0,0);
    449449
  • abuse/trunk/src/automap.cpp

    r115 r123  
    127127        int id=foretiles[ (*fgline)&0x7fff];
    128128        if (id>=0)
    129           cash.foret(id)->micro_image->put_image(screen,i,j,0);
     129          cache.foret(id)->micro_image->put_image(screen,i,j,0);
    130130        else
    131           cash.foret(foretiles[0])->micro_image->put_image(screen,i,j,0);
     131          cache.foret(foretiles[0])->micro_image->put_image(screen,i,j,0);
    132132      }
    133133      else
  • abuse/trunk/src/cache.cpp

    r86 r123  
    3636                   if ((x)->last_access<0) { normalize(); (x)->last_access=1; } }
    3737
    38 crc_manager crc_man;
     38CrcManager crc_manager;
    3939
    4040int past_startup=0;
     
    4242int crc_man_write_crc_file(char const *filename)
    4343{
    44   return crc_man.write_crc_file(filename);
    45 }
    46 
    47 int crc_manager::write_crc_file(char const *filename)  // return 0 on failure
     44  return crc_manager.write_crc_file(filename);
     45}
     46
     47int CrcManager::write_crc_file(char const *filename)  // return 0 on failure
    4848{
    4949  char msg[100];
     
    9898}
    9999
    100 int crc_manager::load_crc_file(char const *filename)
     100int CrcManager::load_crc_file(char const *filename)
    101101{
    102102  bFILE *fp=open_file(filename,"rb");
     
    122122}
    123123
    124 void crc_manager::clean_up()
     124void CrcManager::clean_up()
    125125{
    126126  for (int i=0;i<total_files;i++)
     
    132132}
    133133
    134 crced_file::~crced_file()
     134CrcedFile::~CrcedFile()
    135135{
    136136  jfree(filename);
    137137}
    138138
    139 crced_file::crced_file(char const *name)
     139CrcedFile::CrcedFile(char const *name)
    140140{
    141141  filename=strcpy((char *)jmalloc(strlen(name)+1,"crc_file"),name);
     
    143143}
    144144
    145 crc_manager::crc_manager()
     145CrcManager::CrcManager()
    146146{
    147147  total_files=0;
     
    149149}
    150150
    151 int crc_manager::get_filenumber(char const *filename)
     151int CrcManager::get_filenumber(char const *filename)
    152152{
    153153  for (int i=0;i<total_files;i++)
    154154    if (!strcmp(filename,files[i]->filename)) return i;
    155155  total_files++;
    156   files=(crced_file **)jrealloc(files,total_files*sizeof(crced_file *),"crc_file_list");
    157   files[total_files-1]=new crced_file(filename);
     156  files=(CrcedFile **)jrealloc(files,total_files*sizeof(CrcedFile *),"crc_file_list");
     157  files[total_files-1]=new CrcedFile(filename);
    158158  return total_files-1;
    159159}
    160160
    161 char *crc_manager::get_filename(int32_t filenumber)
     161char *CrcManager::get_filename(int32_t filenumber)
    162162{
    163163  CHECK(filenumber>=0 && filenumber<total_files);
     
    165165}
    166166
    167 uint32_t crc_manager::get_crc(int32_t filenumber, int &failed)
     167uint32_t CrcManager::get_crc(int32_t filenumber, int &failed)
    168168{   
    169169  CHECK(filenumber>=0 && filenumber<total_files);
     
    177177}
    178178
    179 void crc_manager::set_crc(int32_t filenumber, uint32_t crc)
     179void CrcManager::set_crc(int32_t filenumber, uint32_t crc)
    180180{
    181181  CHECK(filenumber>=0 && filenumber<total_files);
     
    184184}
    185185
    186 void cache_list::unmalloc(cache_item *i)
     186void CacheList::unmalloc(CacheItem *i)
    187187{
    188188  switch (i->type)
     
    206206
    207207
    208 void cache_list::prof_init()
     208void CacheList::prof_init()
    209209{
    210210  if (prof_data)
     
    217217static int c_sorter(const void *a, const void *b)
    218218{
    219   return cash.compare(*(int *)a,*(int *)b);
    220 }
    221 
    222 int cache_list::compare(int a, int b)
     219  return cache.compare(*(int *)a,*(int *)b);
     220}
     221
     222int CacheList::compare(int a, int b)
    223223{
    224224  if (prof_data[a]<prof_data[b])
     
    230230
    231231
    232 int cache_list::prof_size()
     232int CacheList::prof_size()
    233233{
    234234  int size=0;     // count up the size for a spec enrty
    235235  size+=2;        // total filenames
    236236  int i;
    237   for (i=0;i<crc_man.total_filenames();i++)
    238       size+=strlen(crc_man.get_filename(i))+2;    // filename + 0 + size of string
     237  for (i=0;i<crc_manager.total_filenames();i++)
     238      size+=strlen(crc_manager.get_filename(i))+2;    // filename + 0 + size of string
    239239
    240240  size+=4;       // number of entries saved
     
    248248
    249249
    250 void cache_list::prof_write(bFILE *fp)
     250void CacheList::prof_write(bFILE *fp)
    251251{
    252252  if (prof_data)
     
    259259    if (fp)
    260260    {
    261       fp->write_uint16(crc_man.total_filenames());
    262       for (i=0;i<crc_man.total_filenames();i++)
     261      fp->write_uint16(crc_manager.total_filenames());
     262      for (i=0;i<crc_manager.total_filenames();i++)
    263263      {
    264         int l=strlen(crc_man.get_filename(i))+1;
     264        int l=strlen(crc_manager.get_filename(i))+1;
    265265        fp->write_uint8(l);
    266         fp->write(crc_man.get_filename(i),l);
     266        fp->write(crc_manager.get_filename(i),l);
    267267      }
    268268
     
    290290}
    291291
    292 void cache_list::prof_uninit()
     292void CacheList::prof_uninit()
    293293{
    294294  if (prof_data)
     
    304304static int s_offset_compare(const void *a, const void *b)
    305305{
    306   return cash.offset_compare(*(int *)a,*(int *)b);
    307 }
    308 
    309 int cache_list::offset_compare(int a, int b)
     306  return cache.offset_compare(*(int *)a,*(int *)b);
     307}
     308
     309int CacheList::offset_compare(int a, int b)
    310310{
    311311  if (list[a].offset<list[b].offset)
     
    321321
    322322
    323 int cache_list::search(int *sarray, uint16_t filenum, int32_t offset)
     323int CacheList::search(int *sarray, uint16_t filenum, int32_t offset)
    324324{
    325325  int x1=0,x2=total-1;
     
    328328  {
    329329    split=(x1+x2)/2;
    330     cache_item *e=list+sarray[split];
     330    CacheItem *e=list+sarray[split];
    331331
    332332    if (e->offset<offset)      // search to the right   
     
    359359}
    360360
    361 void cache_list::note_need(int id)
     361void CacheList::note_need(int id)
    362362{
    363363  if (list[id].last_access<0)
     
    367367}
    368368
    369 void cache_list::preload_cache_object(int type)
     369void CacheList::preload_cache_object(int type)
    370370{
    371371  if (type<0xffff)
     
    384384        push_onto_list(new_lisp_number(type),call_with);
    385385
    386         void *cache_list=eval_function((lisp_symbol *)cache_fun,call_with);
    387         p_ref r1(cache_list);
    388 
    389         if (cache_list && lcar(cache_list))
    390         {
    391           void *obj_list=lcar(cache_list);
     386        void *CacheList=eval_function((lisp_symbol *)cache_fun,call_with);
     387        p_ref r1(CacheList);
     388
     389        if (CacheList && lcar(CacheList))
     390        {
     391          void *obj_list=lcar(CacheList);
    392392          while (obj_list)
    393393          {
     
    400400          }
    401401        }
    402         if (cache_list && lcdr(cache_list))
    403         {
    404           void *id_list=lcar(lcdr(cache_list));
     402        if (CacheList && lcdr(CacheList))
     403        {
     404          void *id_list=lcar(lcdr(CacheList));
    405405          while (id_list)
    406406          {
     
    422422}
    423423
    424 void cache_list::preload_cache(level *lev)
     424void CacheList::preload_cache(level *lev)
    425425{
    426426  game_object *f;
     
    469469}
    470470
    471 void cache_list::load_cache_prof_info(char *filename, level *lev)
     471void CacheList::load_cache_prof_info(char *filename, level *lev)
    472472{
    473473  int j;
     
    504504
    505505          int j;
    506           for (j=0;j<crc_man.total_filenames();j++)
    507             if (!strcmp(crc_man.get_filename(j),name))
     506          for (j=0;j<crc_manager.total_filenames();j++)
     507            if (!strcmp(crc_manager.get_filename(j),name))
    508508              fnum_remap[i]=j;
    509509        }
     
    634634
    635635
    636 void cache_list::prof_poll_start()
     636void CacheList::prof_poll_start()
    637637{
    638638  poll_start_access=last_access; 
    639639}
    640640
    641 void cache_list::prof_poll_end()
     641void CacheList::prof_poll_end()
    642642{
    643643  if (prof_data)
     
    652652}
    653653
    654 void cache_list::unreg(int id)
     654void CacheList::unreg(int id)
    655655{
    656656  if (list[id].file_number)
     
    671671}
    672672
    673 void cache_list::create_lcache()
     673void CacheList::create_lcache()
    674674{
    675675#ifdef WIN32
     
    718718}
    719719
    720 cache_list::cache_list()
     720CacheList::CacheList()
    721721{
    722722  // start out with a decent sized cache buffer because it's going to get allocated anyway.
     
    734734}
    735735
    736 cache_list::~cache_list()
     736CacheList::~CacheList()
    737737{
    738738}
    739739
    740 void cache_list::empty()
     740void CacheList::empty()
    741741{
    742742  for (int i=0;i<total;i++)
     
    778778}
    779779
    780 void cache_list::locate(cache_item *i, int local_only)
    781 {
    782 //  dprintf("cache in %s, type %d, offset %d\n",crc_man.get_filename(i->file_number),i->type,i->offset);
     780void CacheList::locate(CacheItem *i, int local_only)
     781{
     782//  dprintf("cache in %s, type %d, offset %d\n",crc_manager.get_filename(i->file_number),i->type,i->offset);
    783783  if (i->file_number!=last_file)
    784784  {
     
    786786    if (last_dir) delete last_dir;
    787787    if (local_only)
    788       fp=new jFILE(crc_man.get_filename(i->file_number),"rb");
     788      fp=new jFILE(crc_manager.get_filename(i->file_number),"rb");
    789789    else
    790       fp=open_file(crc_man.get_filename(i->file_number),"rb");
     790      fp=open_file(crc_manager.get_filename(i->file_number),"rb");
    791791
    792792
    793793    if (fp->open_failure())
    794794    {
    795       printf("Ooch. Could not open file %s\n",crc_man.get_filename(i->file_number));
     795      printf("Ooch. Could not open file %s\n",crc_manager.get_filename(i->file_number));
    796796      delete fp;
    797797      exit(0);
     
    810810}
    811811
    812 int32_t cache_list::alloc_id()
     812int32_t CacheList::alloc_id()
    813813{
    814814  int id;
     
    827827  {
    828828    int i;
    829     cache_item *ci=list;
     829    CacheItem *ci=list;
    830830    for (i=0,id=-1;i<total && id<0;i++,ci++)        // scan list for a free id
    831831    {
     
    837837    {
    838838      int add_size=20;
    839       list=(cache_item *)jrealloc(list,(sizeof(cache_item)*(total+add_size)),"Cache list");
     839      list=(CacheItem *)jrealloc(list,(sizeof(CacheItem)*(total+add_size)),"Cache list");
    840840      for (i=0;i<add_size;i++)
    841841      {
     
    856856
    857857
    858 int32_t cache_list::reg_lisp_block(Cell *block)
     858int32_t CacheList::reg_lisp_block(Cell *block)
    859859{
    860860  uint32_t s;
    861861  if (lcache_number==-1)
    862     lcache_number=crc_man.get_filenumber(lfname);
     862    lcache_number=crc_manager.get_filenumber(lfname);
    863863
    864864  if (can_cache_lisp())
     
    882882    }
    883883  }
    884   int id=alloc_id(),fn=crc_man.get_filenumber(lfname);
    885   cache_item *ci=list+id;
     884  int id=alloc_id(),fn=crc_manager.get_filenumber(lfname);
     885  CacheItem *ci=list+id;
    886886  CHECK(id<total && list[id].file_number<0);
    887887
     
    903903}
    904904
    905 int32_t cache_list::reg_object(char const *filename, void *object, int type, int rm_dups)
     905int32_t CacheList::reg_object(char const *filename, void *object, int type, int rm_dups)
    906906{
    907907  char *name;
     
    917917extern int total_files_open;
    918918
    919 int32_t cache_list::reg(char const *filename, char const *name, int type, int rm_dups)
    920 {
    921         int id=alloc_id(),i,fn=crc_man.get_filenumber(filename);
    922         cache_item *ci=list+id;
     919int32_t CacheList::reg(char const *filename, char const *name, int type, int rm_dups)
     920{
     921        int id=alloc_id(),i,fn=crc_manager.get_filenumber(filename);
     922        CacheItem *ci=list+id;
    923923        CHECK(id<total && list[id].file_number<0);
    924924
     
    10021002
    10031003
    1004 void cache_list::normalize()
     1004void CacheList::normalize()
    10051005{
    10061006  int j;
    1007   cache_item *ci=list;
     1007  CacheItem *ci=list;
    10081008  last_access=-1;
    10091009  for (j=0;j<total;j++,ci++)
     
    10171017}
    10181018
    1019 backtile *cache_list::backt(int id)
    1020 {
    1021   cache_item *me=list+id;
     1019backtile *CacheList::backt(int id)
     1020{
     1021  CacheItem *me=list+id;
    10221022  CONDITION(id<total && id>=0 && me->file_number>=0,"Bad id");
    10231023
     
    10401040
    10411041
    1042 foretile *cache_list::foret(int id)
    1043 {
    1044   cache_item *me=list+id;
     1042foretile *CacheList::foret(int id)
     1043{
     1044  CacheItem *me=list+id;
    10451045  CONDITION(id<total && id>=0 && me->file_number>=0,"Bad id");
    10461046
     
    10621062}
    10631063
    1064 figure *cache_list::fig(int id)
    1065 {
    1066   cache_item *me=list+id;
     1064figure *CacheList::fig(int id)
     1065{
     1066  CacheItem *me=list+id;
    10671067//  CONDITION(id<total && id>=0 && me->file_number>=0,"Bad id");
    10681068  if (me->last_access>=0) 
     
    10831083}
    10841084
    1085 image *cache_list::img(int id)
    1086 {
    1087   cache_item *me=list+id;
     1085image *CacheList::img(int id)
     1086{
     1087  CacheItem *me=list+id;
    10881088  CONDITION(id<total && id>=0 && me->file_number>=0,"Bad id");
    10891089  if (me->last_access>=0) 
     
    11061106}
    11071107
    1108 sound_effect *cache_list::sfx(int id)
    1109 {
    1110   cache_item *me=list+id;
     1108sound_effect *CacheList::sfx(int id)
     1109{
     1110  CacheItem *me=list+id;
    11111111  CONDITION(id<total && id>=0 && me->file_number>=0,"Bad id");
    11121112  if (me->last_access>=0) 
     
    11181118  {
    11191119    touch(me);                                           // hold me, feel me, be me!
    1120     char *fn=crc_man.get_filename(me->file_number);
     1120    char *fn=crc_manager.get_filename(me->file_number);
    11211121    int sp=alloc_space; alloc_space=ALLOC_SPACE_CACHE;
    11221122    me->data=(void *)new sound_effect(fn);
     
    11271127
    11281128
    1129 part_frame *cache_list::part(int id)
    1130 {
    1131   cache_item *me=list+id;
     1129part_frame *CacheList::part(int id)
     1130{
     1131  CacheItem *me=list+id;
    11321132  CONDITION(id<total && id>=0 && me->file_number>=0,"Bad id");
    11331133  if (me->last_access>=0) 
     
    11491149
    11501150
    1151 Cell *cache_list::lblock(int id)
    1152 {
    1153   cache_item *me=list+id;
     1151Cell *CacheList::lblock(int id)
     1152{
     1153  CacheItem *me=list+id;
    11541154  CONDITION(id<total && id>=0 && me->file_number>=0,"Bad id");
    11551155  if (!can_cache_lisp()) return (Cell *)me->data;
     
    11701170    if (!cache_read_file)
    11711171    {
    1172       cache_read_file=new jFILE(crc_man.get_filename(me->file_number),"rb");
     1172      cache_read_file=new jFILE(crc_manager.get_filename(me->file_number),"rb");
    11731173     
    11741174      int cache_size=80*1024;                   // 80K
     
    12021202}
    12031203
    1204 cache_list cash;
     1204CacheList cache;
    12051205
    12061206void free_up_memory()
    12071207{
    1208   cash.free_oldest();
    1209 }
    1210 
    1211 void cache_list::free_oldest()
     1208  cache.free_oldest();
     1209}
     1210
     1211void CacheList::free_oldest()
    12121212{
    12131213  uint32_t i,old_time=last_access;
    1214   cache_item *ci=list,*oldest=NULL;
     1214  CacheItem *ci=list,*oldest=NULL;
    12151215  ful=1;
    12161216
     
    12381238
    12391239
    1240 void cache_list::show_accessed()
     1240void CacheList::show_accessed()
    12411241{
    12421242  int old=last_access,new_old_accessed;
    1243   cache_item *ci,*new_old;
     1243  CacheItem *ci,*new_old;
    12441244 
    12451245  do
     
    12611261      old=ci->last_access;
    12621262      printf("type=(%20s) file=(%20s) access=(%6ld)\n",spec_types[ci->type],
    1263              crc_man.get_filename(ci->file_number),
     1263             crc_manager.get_filename(ci->file_number),
    12641264             (long int)ci->last_access);
    12651265    }
     
    12681268
    12691269
    1270 int cache_list::loaded(int id)
    1271 {
    1272   cache_item *me=list+id;
     1270int CacheList::loaded(int id)
     1271{
     1272  CacheItem *me=list+id;
    12731273  CONDITION(id<total && id>=0 && me->file_number>=0,"Bad id");
    12741274  if (me->last_access>=0) 
     
    12791279
    12801280
    1281 char_tint *cache_list::ctint(int id)
    1282 {
    1283   cache_item *me=list+id;
     1281char_tint *CacheList::ctint(int id)
     1282{
     1283  CacheItem *me=list+id;
    12841284  CONDITION(id<total && id>=0 && me->file_number>=0,"Bad id" && me->type==SPEC_PALETTE);
    12851285  if (me->last_access>=0) 
  • abuse/trunk/src/cache.hpp

    r66 r123  
    2121
    2222class level;
    23 /* Cache item types :
    2423
    25       foretile,backtile,character,
    26       sound,
    27       image,trans_image
     24class CrcedFile
     25{
     26    friend class CrcManager;
    2827
    29 */
     28protected:
     29    CrcedFile(char const *name);
     30    ~CrcedFile();
    3031
    31 
    32 
    33 struct cache_item
    34 {
    35   void *data;
    36   int32_t last_access;   
    37   uint8_t type;
    38   int16_t file_number;
    39   int32_t offset;
     32    int crc_calculated;
     33    uint32_t crc;
     34    char *filename;
    4035} ;
    4136
     37// stores crc for each file open to avoid redundant calculations
     38class CrcManager
     39{
     40private:
     41    int total_files;
     42    CrcedFile **files;
    4243
     44public:
     45    CrcManager();
    4346
    44 class crced_file
     47    int get_filenumber(char const *filename);
     48    uint32_t get_crc(int32_t filenumber, int &failed);
     49    void set_crc(int32_t filenumber, uint32_t crc);
     50    char *get_filename(int32_t filenumber);
     51    void clean_up();
     52    int total_filenames() { return total_files; }
     53    int write_crc_file(char const *filename);
     54    int load_crc_file(char const *filename);
     55};
     56
     57/* Cache item types:
     58 *  - foretile
     59 *  - backtile
     60 *  - character
     61 *  - sound
     62 *  - image
     63 *  - trans_image
     64 */
     65
     66struct CacheItem
    4567{
    46   public :
    47   int crc_calculated;
    48   uint32_t crc;
    49   char *filename;
    50   crced_file(char const *name);
    51   ~crced_file();
    52 } ;
     68    friend class CacheList;
    5369
    54 class crc_manager  // stores crc for each file open so redundant calculations are not done
     70protected:
     71    void *data;
     72    int32_t last_access;   
     73    uint8_t type;
     74    int16_t file_number;
     75    int32_t offset;
     76};
     77
     78class CacheList
    5579{
    56   int total_files;
    57   crced_file **files;
    58   public :
    59   crc_manager();
    60   int get_filenumber(char const *filename);
    61   uint32_t get_crc(int32_t filenumber, int &failed);
    62   void set_crc(int32_t filenumber, uint32_t crc);
    63   char *get_filename(int32_t filenumber);
    64   void clean_up();
    65   int total_filenames() { return total_files; }
    66   int write_crc_file(char const *filename);
    67   int load_crc_file(char const *filename);
    68 } ;
     80private:
     81    CacheItem *list;
     82    int32_t total, last_registered, last_access, poll_start_access;
     83    int16_t last_file; // for speed leave the last file accessed open
    6984
     85    bFILE *fp,*cache_file,*cache_read_file;
     86    spec_directory *last_dir;
     87    int32_t last_offset; // store the last offset so we don't have to seek if
     88                         // we don't need to
    7089
     90    int16_t lcache_number;
     91    int32_t alloc_id();
     92    void locate(CacheItem *i, int local_only = 0); // set up file and offset for this item
     93    void normalize();
     94    void unmalloc(CacheItem *i);
     95    int used, // flag set when disk is accessed
     96        ful;  // set when stuff has to be thrown out
     97    int *prof_data; // holds counts for each id
     98    void preload_cache_object(int type);
     99    void preload_cache(level *lev);
    71100
    72 class cache_list
    73 {
    74   cache_item *list;
    75   int32_t total,last_registered,last_access,poll_start_access;
    76   int16_t last_file;           // for speed leave the last file accessed open
     101public:
     102    CacheList();
     103    ~CacheList();
    77104
    78   bFILE *fp,*cache_file,*cache_read_file;
    79   spec_directory *last_dir;
    80   int32_t last_offset;          // store the last offset so we don't have to seek if
    81                              // we don't need to
    82  
     105    void create_lcache();
     106    void free_oldest();
     107    int in_use() { if (used) { used = 0; return 1; } else return 0; }
     108    int full() { if (ful) { ful = 0; return 1; } else return 0; }
     109    int32_t reg_object(char const *filename, void *object, int type,
     110                       int rm_dups); // lisp object
     111    int32_t reg(char const *filename, char const *name, int type = -1,
     112                int rm_dups = 0); // returns id to item
     113    int32_t reg_lisp_block(Cell *block);
     114    int loaded(int id);
     115    void unreg(int id);
     116    void note_need(int id);
    83117
    84   int16_t lcache_number;
    85   int32_t alloc_id();
    86   void locate(cache_item *i, int local_only=0);    // set up file and offset for this item
    87   void normalize();
    88   void unmalloc(cache_item *i);
    89   int used,                                 // flag set when disk is accessed
    90       ful;                                  // set when stuff has to be thrown out
    91   int *prof_data;                           // holds counts for each id
    92   void preload_cache_object(int type);
    93   void preload_cache(level *lev);
    94 public :
    95   void create_lcache();
    96   cache_list();
    97   void free_oldest();
    98   int in_use() { if (used) { used=0; return 1; } else return 0; }
    99   int full() { if (ful) { ful=0; return 1; } else return 0; }
    100   int32_t reg_object(char const *filename, void *object, int type, int rm_dups);      // lisp object
    101   int32_t reg(char const *filename, char const *name, int type=-1, int rm_dups=0);          // returns id to item
    102   int32_t reg_lisp_block(Cell *block);
    103   int loaded(int id);
    104   void unreg(int id);
    105   void note_need(int id);
     118    backtile *backt(int id);
     119    foretile *foret(int id);
     120    figure *fig(int id);
     121    image *img(int id);
     122    part_frame *part(int id);
     123    sound_effect *sfx(int id);
     124    Cell *lblock(int id);
     125    char_tint *ctint(int id);
    106126
    107   backtile       *backt(int id);
    108   foretile       *foret(int id);
    109   figure          *fig(int id);
    110   image           *img(int id);
    111   part_frame     *part(int id);
    112   sound_effect    *sfx(int id);
    113   Cell         *lblock(int id);
    114   char_tint     *ctint(int id);
     127    void prof_init();
     128    void prof_write(bFILE *fp);
     129    void prof_uninit();
     130    int  prof_size(); // sizeof of spec entry that will be saved
     131    void prof_poll_start();
     132    void prof_poll_end();
     133    int  prof_is_on() { return prof_data != NULL; }   // so level knows weither to save prof info or not
     134    int compare(int a, int b); // compares usage count (used by qsort)
     135    int offset_compare(int a, int b);
    115136
    116   void prof_init();
    117   void prof_write(bFILE *fp);
    118   void prof_uninit();
    119   int  prof_size();                   // sizeof of spec entry that will be saved
    120   void prof_poll_start();
    121   void prof_poll_end();
    122   int  prof_is_on() { return prof_data!=NULL; }   // so level knows weither to save prof info or not
    123   int compare(int a, int b);          // compares the ussage counts of 2 entries (used by qsort)
    124   int offset_compare(int a, int b);
     137    void load_cache_prof_info(char *filename, level *lev);
     138    // sarray is a index table sorted by offset/filenum
     139    int search(int *sarray, uint16_t filenum, int32_t offset);
    125140
    126   void load_cache_prof_info(char *filename, level *lev);
    127   int search(int *sarray, uint16_t filenum, int32_t offset);  // sarray is a index table sorted by offset/filenum
     141    void show_accessed();
     142    void empty();
     143};
    128144
    129   void show_accessed();
    130   void empty();
    131   ~cache_list();
    132 } ;
    133 
    134 extern cache_list cash;
    135 extern crc_manager crc_man;
    136 
     145extern CacheList cache;
     146extern CrcManager crc_manager;
    137147
    138148#endif
    139149
    140 
    141 
    142 
    143 
    144 
  • abuse/trunk/src/chars.cpp

    r56 r123  
    419419      char *fn=lstring_value(eval(CAR(CDR(CAR(field)))));
    420420      char *o=lstring_value(eval(CAR(CDR(CDR(CAR(field))))));
    421       logo=cash.reg(fn,o,SPEC_IMAGE,1);
     421      logo=cache.reg(fn,o,SPEC_IMAGE,1);
    422422    } else if (f==l_vars)
    423423    {
     
    456456  {
    457457    mrph=lcdr(mrph);
    458     morph_mask=cash.reg_object(fn,lcar(mrph),SPEC_IMAGE,1);
     458    morph_mask=cache.reg_object(fn,lcar(mrph),SPEC_IMAGE,1);
    459459    morph_power=lnumber_value(lcar(lcdr(mrph)));
    460460  } else morph_mask=-1;
     
    536536  }
    537537  else
    538     logo=cash.reg_object(fn,lcdr(lg),SPEC_IMAGE,1); 
     538    logo=cache.reg_object(fn,lcdr(lg),SPEC_IMAGE,1); 
    539539    */
    540540}
  • abuse/trunk/src/clisp.cpp

    r112 r123  
    13851385      int sp=current_space;
    13861386      current_space=PERM_SPACE;
    1387       int id=cash.reg(lstring_value(lcar(args)),NULL,SPEC_EXTERN_SFX,1);
     1387      int id=cache.reg(lstring_value(lcar(args)),NULL,SPEC_EXTERN_SFX,1);
    13881388      if (sym)
    13891389        set_symbol_number(sym,id);    // set the symbol value to sfx id                             
     
    13991399      a=CDR(a);
    14001400      if (!a)
    1401         cash.sfx(id)->play(127);
     1401        cache.sfx(id)->play(127);
    14021402      else
    14031403      {
     
    14141414          int32_t y=lnumber_value(lcar(a));
    14151415          the_game->play_sound(id,vol,x,y);
    1416         } else cash.sfx(id)->play(vol);       
     1416        } else cache.sfx(id)->play(vol);       
    14171417      }
    14181418
     
    16611661    {
    16621662//      char *fn=lstring_value(CAR(args)); args=CDR(args);     
    1663 //      stat_bar=cash.reg_object(fn,CAR(args),SPEC_IMAGE,1);
     1663//      stat_bar=cache.reg_object(fn,CAR(args),SPEC_IMAGE,1);
    16641664    } break;
    16651665    case 192 :
     
    17881788      char *fn=lstring_value(CAR(args)); args=CDR(args);
    17891789      char *name=lstring_value(CAR(args));
    1790       big_font_pict=cash.reg(fn,name,SPEC_IMAGE,1);     
     1790      big_font_pict=cache.reg(fn,name,SPEC_IMAGE,1);     
    17911791    } break;
    17921792    case 204 :
     
    17941794      char *fn=lstring_value(CAR(args)); args=CDR(args);
    17951795      char *name=lstring_value(CAR(args));
    1796       small_font_pict=cash.reg(fn,name,SPEC_IMAGE,1);     
     1796      small_font_pict=cache.reg(fn,name,SPEC_IMAGE,1);     
    17971797    } break;
    17981798    case 205 :
     
    18001800      char *fn=lstring_value(CAR(args)); args=CDR(args);
    18011801      char *name=lstring_value(CAR(args));
    1802       console_font_pict=cash.reg(fn,name,SPEC_IMAGE,1);     
     1802      console_font_pict=cache.reg(fn,name,SPEC_IMAGE,1);     
    18031803    } break;
    18041804    case 206 :
     
    18381838      char *fn=lstring_value(CAR(args)); args=CDR(args);
    18391839      char *name=lstring_value(CAR(args)); args=CDR(args);
    1840       return cash.reg(fn,name,SPEC_IMAGE,1);
     1840      return cache.reg(fn,name,SPEC_IMAGE,1);
    18411841    } break;
    18421842    case 216 :
     
    18451845      int32_t y1=lnumber_value(CAR(args)); args=lcdr(args);
    18461846      int32_t id=lnumber_value(CAR(args));
    1847       cash.img(id)->put_image(screen,x1,y1,1);
     1847      cache.img(id)->put_image(screen,x1,y1,1);
    18481848    } break;
    18491849    case 217 :
     
    19121912    case 227 :
    19131913    {
    1914       return cash.reg(lstring_value(CAR(args)),"palette",SPEC_PALETTE,1);
     1914      return cache.reg(lstring_value(CAR(args)),"palette",SPEC_PALETTE,1);
    19151915    } break;
    19161916    case 228 :
     
    21522152    case 268 :
    21532153    {
    2154       return cash.img(lnumber_value(CAR(args)))->width();
     2154      return cache.img(lnumber_value(CAR(args)))->width();
    21552155    } break;
    21562156    case 269 :
    21572157    {
    2158       return cash.img(lnumber_value(CAR(args)))->height();
     2158      return cache.img(lnumber_value(CAR(args)))->height();
    21592159    } break;
    21602160    case 270 :
     
    21852185      c_target=id;
    21862186      if (screen)
    2187         wm->set_mouse_shape(cash.img(c_target)->copy(),x,y);
     2187        wm->set_mouse_shape(cache.img(c_target)->copy(),x,y);
    21882188    } break;
    21892189    case 276 :
  • abuse/trunk/src/cop.cpp

    r112 r123  
    824824        player_draw(just_fired,o->controller()->player_number);
    825825        if (o->controller() && o->controller()->local_player())
    826           cash.img(S_health_image)->put_image(screen,o->controller()->cx2-20,
     826          cache.img(S_health_image)->put_image(screen,o->controller()->cx2-20,
    827827                                            o->controller()->cy1+5,1);
    828828      } break;
     
    845845        o->state=(character_state)old_state;
    846846        if (o->controller() && o->controller()->local_player())
    847           cash.img(S_fast_image)->put_image(screen,o->controller()->cx2-20,
     847          cache.img(S_fast_image)->put_image(screen,o->controller()->cx2-20,
    848848                                            o->controller()->cy1+5,1);
    849849      } break;
     
    866866
    867867        if (o->controller() && o->controller()->local_player())
    868           cash.img(S_fly_image)->put_image(screen,o->controller()->cx2-20,
     868          cache.img(S_fly_image)->put_image(screen,o->controller()->cx2-20,
    869869                                            o->controller()->cy1+5,1);
    870870      } break;
     
    879879         
    880880        if (o->controller() && o->controller()->local_player())
    881           cash.img(S_sneaky_image)->put_image(screen,o->controller()->cx2-20,
     881          cache.img(S_sneaky_image)->put_image(screen,o->controller()->cx2-20,
    882882                                            o->controller()->cy1+5,1);
    883883      } break;
     
    10421042  wm->set_mouse_position(0,0);
    10431043  screen->clear();
    1044   image *im=cash.img(cash.reg("art/frame.spe","end_level_screen",SPEC_IMAGE,1));
     1044  image *im=cache.img(cache.reg("art/frame.spe","end_level_screen",SPEC_IMAGE,1));
    10451045  im->put_image(screen,0,0);
    10461046  int x1=im->width()+1,y1=0,y2=screen->height();
  • abuse/trunk/src/demo.cpp

    r106 r123  
    203203    {
    204204/*
    205       fade_in(cash.img(cash.reg("art/help.spe","sell6",SPEC_IMAGE,1)),8);
     205      fade_in(cache.img(cache.reg("art/help.spe","sell6",SPEC_IMAGE,1)),8);
    206206      milli_wait(2000);
    207207      fade_out(8);
  • 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)
  • abuse/trunk/src/devsel.cpp

    r120 r123  
    3030    case SPEC_FORETILE :
    3131    {
    32       return cash.foret(foretiles[0])->im->width()/scale;
     32      return cache.foret(foretiles[0])->im->width()/scale;
    3333    } break;
    3434    case SPEC_BACKTILE :
    3535    {
    36       return cash.backt(backtiles[0])->im->width()/scale;
     36      return cache.backt(backtiles[0])->im->width()/scale;
    3737    } break;
    3838    default :
     
    4747    case SPEC_FORETILE :
    4848    {
    49       return cash.foret(foretiles[0])->im->height()/scale;
     49      return cache.foret(foretiles[0])->im->height()/scale;
    5050    } break;
    5151    case SPEC_BACKTILE :
    5252    {
    53       return cash.backt(backtiles[0])->im->height()/scale;
     53      return cache.backt(backtiles[0])->im->height()/scale;
    5454    } break;
    5555    default :
  • abuse/trunk/src/endgame.cpp

    r106 r123  
    147147{
    148148  int i;
    149   int planet=cash.reg("art/endgame.spe","planet",SPEC_IMAGE,1);
    150   int planet2=cash.reg("art/endgame.spe","dead_planet",SPEC_IMAGE,1);
    151   int mask=cash.reg("art/endgame.spe","mask",SPEC_IMAGE,1);
    152   int ship=cash.reg("art/endgame.spe","ship",SPEC_IMAGE,1);
     149  int planet=cache.reg("art/endgame.spe","planet",SPEC_IMAGE,1);
     150  int planet2=cache.reg("art/endgame.spe","dead_planet",SPEC_IMAGE,1);
     151  int mask=cache.reg("art/endgame.spe","mask",SPEC_IMAGE,1);
     152  int ship=cache.reg("art/endgame.spe","ship",SPEC_IMAGE,1);
    153153
    154154
     
    158158 
    159159
    160   mask_line *p=make_mask_lines(cash.img(mask),cash.img(planet)->width()); 
     160  mask_line *p=make_mask_lines(cache.img(mask),cache.img(planet)->width()); 
    161161
    162162  int explo_frames1[8],explo_frames2[7];
     
    164164  for (i=0;i<8;i++)
    165165  { char nm[100]; sprintf(nm,"small_wite%04d.pcx",i+1);
    166     explo_frames1[i]=cash.reg("art/exp1.spe",nm,SPEC_CHARACTER,1);
     166    explo_frames1[i]=cache.reg("art/exp1.spe",nm,SPEC_CHARACTER,1);
    167167  }
    168168
    169169  for (i=0;i<7;i++)
    170170  { char nm[100]; sprintf(nm,"small_fire%04d.pcx",i+1);
    171     explo_frames2[i]=cash.reg("art/exp1.spe",nm,SPEC_CHARACTER,1);
     171    explo_frames2[i]=cache.reg("art/exp1.spe",nm,SPEC_CHARACTER,1);
    172172  }
    173173
    174174  int eoff=0,coff=0;
    175175
    176   int ex=xres/2-cash.img(mask)->width()/2;
    177   int ey=yres/2-cash.img(mask)->height()/2;
     176  int ex=xres/2-cache.img(mask)->width()/2;
     177  int ey=yres/2-cache.img(mask)->height()/2;
    178178  fade_out(16);
    179179
     
    211211
    212212
    213   scan_map(screen,ex,ey,cash.img(planet),cash.img(planet2),0,paddr,p,cash.img(mask)->height(),eoff,coff);     
    214   image *tcopy=cash.img(planet)->copy();
     213  scan_map(screen,ex,ey,cache.img(planet),cache.img(planet2),0,paddr,p,cache.img(mask)->height(),eoff,coff);     
     214  image *tcopy=cache.img(planet)->copy();
    215215  fade_in(NULL,32);
    216216
     
    225225    {
    226226      if ((i%10)==0 && (sound_avail&SFX_INITIALIZED))
    227         cash.sfx(space_snd)->play(64);
     227        cache.sfx(space_snd)->play(64);
    228228
    229229      old_time.get_time();
     
    235235      if (i>=30 && i<=37)
    236236      {
    237         cash.img(planet)->put_image(tcopy,0,0);
    238         cash.fig(explo_frames1[i-30])->forward->put_image(tcopy,100,50);
     237        cache.img(planet)->put_image(tcopy,0,0);
     238        cache.fig(explo_frames1[i-30])->forward->put_image(tcopy,100,50);
    239239        scan_map(screen,ex,ey,tcopy,
    240                cash.img(planet2),
     240               cache.img(planet2),
    241241               0,paddr,
    242                p,cash.img(mask)->height(),eoff,coff);     
     242               p,cache.img(mask)->height(),eoff,coff);     
    243243      }
    244244      else
    245         scan_map(screen,ex,ey,cash.img(planet),
    246                cash.img(planet2),
     245        scan_map(screen,ex,ey,cache.img(planet),
     246               cache.img(planet2),
    247247               0,paddr,
    248                p,cash.img(mask)->height(),eoff,coff);     
     248               p,cache.img(mask)->height(),eoff,coff);     
    249249      if (i>38)
    250250      {
    251251        int t=i-38;
    252         image *s=cash.img(ship);
     252        image *s=cache.img(ship);
    253253        int nw=s->width()*(t+2)/16,
    254254            nh=s->height()*(t+2)/16;
    255255
    256256
    257         scale_put_trans(s,screen,ex-(i-38)*5,ey+cash.img(mask)->height()/2+t*4,nw,nh);
     257        scale_put_trans(s,screen,ex-(i-38)*5,ey+cache.img(mask)->height()/2+t*4,nw,nh);
    258258        if (i==77)
    259259          if (sound_avail&SFX_INITIALIZED)
    260             cash.sfx(zip_snd)->play(127);
     260            cache.sfx(zip_snd)->play(127);
    261261      }
    262262       
     
    277277    {
    278278      if ((i%10)==0 && (sound_avail&SFX_INITIALIZED))
    279         cash.sfx(space_snd)->play(64);
     279        cache.sfx(space_snd)->play(64);
    280280
    281281      old_time.get_time();
     
    286286
    287287     
    288       scan_map(screen,ex,ey,cash.img(planet),
    289                cash.img(planet2),i*256/200,paddr,p,cash.img(mask)->height(),eoff,coff);     
     288      scan_map(screen,ex,ey,cache.img(planet),
     289               cache.img(planet2),i*256/200,paddr,p,cache.img(mask)->height(),eoff,coff);     
    290290
    291291      eoff+=2; if (eoff>=320) eoff-=320;
     
    295295      if (i<150 || (i<170 && ((i-149)%2)==0) || (i<180 && ((i-149)%4)==0) || (i<190 && ((i-149)%8)==0))
    296296      {
    297         clist=new ex_char(ex+jrand()%(cash.img(mask)->width()-cash.img(mask)->width()/3),
    298                         ey+jrand()%(cash.img(mask)->height()-cash.img(mask)->height()/3),0,1,clist);
     297        clist=new ex_char(ex+jrand()%(cache.img(mask)->width()-cache.img(mask)->width()/3),
     298                        ey+jrand()%(cache.img(mask)->height()-cache.img(mask)->height()/3),0,1,clist);
    299299        if (sound_avail&SFX_INITIALIZED)
    300           cash.sfx(explo_snd)->play(127);
     300          cache.sfx(explo_snd)->play(127);
    301301      }
    302302
    303 //      clist=new ex_char(ex+jrand()%(cash.img(mask)->width(),
    304 //                      ey+jrand()%(cash.img(mask)->height(),0,1,clist);
     303//      clist=new ex_char(ex+jrand()%(cache.img(mask)->width(),
     304//                      ey+jrand()%(cache.img(mask)->height(),0,1,clist);
    305305
    306306      ex_char *c=clist,*last=NULL;
     
    319319          last=c;
    320320          if (c->char_num)     
    321             cash.fig(explo_frames2[c->frame])->forward->put_image(screen,c->x,c->y);     
     321            cache.fig(explo_frames2[c->frame])->forward->put_image(screen,c->x,c->y);     
    322322
    323323          c->x-=3;
     
    347347    {
    348348      if ((i%10)==0 && (sound_avail&SFX_INITIALIZED))
    349         cash.sfx(space_snd)->play(64);
     349        cache.sfx(space_snd)->play(64);
    350350
    351351      old_time.get_time();
    352       scan_map(screen,ex,ey,cash.img(planet),
    353                cash.img(planet2),
     352      scan_map(screen,ex,ey,cache.img(planet),
     353               cache.img(planet2),
    354354               256,paddr,
    355                p,cash.img(mask)->height(),eoff,coff);     
     355               p,cache.img(mask)->height(),eoff,coff);     
    356356      eoff+=2; if (eoff>=320) eoff-=320;
    357357      coff+=1; if (coff>=320) coff-=320;     
     
    383383      screen->putpixel(dx+si[0],dy+si[1],si[2]);
    384384
    385     scan_map(screen,ex,ey,cash.img(planet),
    386              cash.img(planet2),
     385    scan_map(screen,ex,ey,cache.img(planet),
     386             cache.img(planet2),
    387387             256,paddr,
    388              p,cash.img(mask)->height(),eoff,coff);     
     388             p,cache.img(mask)->height(),eoff,coff);     
    389389    text_draw(205-i,dx+10,dy,dx+319-10,dy+199,lstring_value(end_plot),wm->font(),cmap,wm->bright_color());
    390390    wm->flush_screen();
     
    396396
    397397
    398   for (i=0;i<cash.img(mask)->height();i++)
     398  for (i=0;i<cache.img(mask)->height();i++)
    399399  {
    400400    jfree(p[i].remap);
     
    412412
    413413
    414   wm->set_mouse_shape(cash.img(c_normal)->copy(),1,1);
     414  wm->set_mouse_shape(cache.img(c_normal)->copy(),1,1);
    415415  the_game->set_state(MENU_STATE);
    416416}
     
    425425  screen->clear();
    426426
    427   image *im=cash.img(cash.reg("art/endgame.spe","tbc",SPEC_IMAGE,1));
     427  image *im=cache.img(cache.reg("art/endgame.spe","tbc",SPEC_IMAGE,1));
    428428
    429429  void *to_be=symbol_value(make_find_symbol("to_be_continued"));
     
    482482  screen->clear();
    483483
    484   image *im=cash.img(cash.reg("art/endgame.spe","end.pcx",SPEC_IMAGE,1));
     484  image *im=cache.img(cache.reg("art/endgame.spe","end.pcx",SPEC_IMAGE,1));
    485485
    486486  int dx=(xres+1)/2-320/2,dy=(yres+1)/2-200/2;
     
    526526  show_sell(1);
    527527
    528   wm->set_mouse_shape(cash.img(c_normal)->copy(),1,1);
     528  wm->set_mouse_shape(cache.img(c_normal)->copy(),1,1);
    529529  the_game->set_state(MENU_STATE);
    530530}
  • abuse/trunk/src/game.cpp

    r121 r123  
    5858#define SHIFT_DOWN_DEFAULT 30
    5959
    60 extern crc_manager *net_crcs;
     60extern CrcManager *net_crcs;
     61
    6162game *the_game;
    6263WindowManager *wm = NULL;
     
    172173
    173174    if(v > 0)
    174         cash.sfx(id)->play(v, 128, p);
     175        cache.sfx(id)->play(v, 128, p);
    175176}
    176177
     
    438439
    439440    if(playing_state(state) &&  !(dev & EDIT_MODE))
    440         wm->set_mouse_shape(cash.img(c_target)->copy(), 8, 8);
     441        wm->set_mouse_shape(cache.img(c_target)->copy(), 8, 8);
    441442    else
    442         wm->set_mouse_shape(cash.img(c_normal)->copy(), 1, 1);
     443        wm->set_mouse_shape(cache.img(c_normal)->copy(), 1, 1);
    443444
    444445    if(old_state == SCENE_STATE && new_state != SCENE_STATE)
     
    470471        if(but) but = 1;
    471472        int dx = 20, dy = 5;
    472         image *jim = cash.img(joy_picts[but * 9+(y + 1)*3 + x + 1]);
     473        image *jim = cache.img(joy_picts[but * 9+(y + 1)*3 + x + 1]);
    473474        joy_win->screen->bar(dx, dy, dx + jim->width()+6, dy + jim->height()+6, wm->black());
    474475        jim->put_image(joy_win->screen, dx + 3, dy + 3);
     
    710711      if(state == SCENE_STATE)
    711712        screen->set_clip(v->cx1, v->cy1, v->cx2, v->cy2);
    712       image *tit = cash.img(title_screen);
     713      image *tit = cache.img(title_screen);
    713714      tit->put_image(screen, screen->width()/2 - tit->width()/2,
    714715                    screen->height()/2 - tit->height()/2);
     
    10851086    if(dev_cont)
    10861087    dev_cont->dev_draw(v);
    1087     if(cash.in_use())
    1088     cash.img(vmm_image)->put_image(screen, v->cx1, v->cy2 - cash.img(vmm_image)->height()+1);
     1088    if(cache.in_use())
     1089    cache.img(vmm_image)->put_image(screen, v->cx1, v->cy2 - cache.img(vmm_image)->height()+1);
    10891090
    10901091    if(dev & DRAW_LIGHTS)
     
    12531254
    12541255        if(DEFINEDP(logo_snd) && (sound_avail & SFX_INITIALIZED))
    1255             cash.sfx(lnumber_value(logo_snd))->play(sfx_volume);
     1256            cache.sfx(lnumber_value(logo_snd))->play(sfx_volume);
    12561257
    12571258        // This must be a dynamic allocated image because if it
     
    12631264        wm->set_mouse_shape(blank->copy(), 0, 0); // hide mouse
    12641265        delete blank;
    1265         fade_in(cash.img(cdc_logo), 32);
     1266        fade_in(cache.img(cdc_logo), 32);
    12661267
    12671268        milli_wait(900);
     
    13311332                if((i % 5) == 0 && DEFINEDP(space_snd) && (sound_avail & SFX_INITIALIZED))
    13321333                {
    1333                     cash.sfx(lnumber_value(space_snd))->play(sfx_volume * 90 / 127);
     1334                    cache.sfx(lnumber_value(space_snd))->play(sfx_volume * 90 / 127);
    13341335                }
    13351336            }
     
    13521353
    13531354        if(title_screen >= 0)
    1354             fade_in(cash.img(title_screen), 32);
    1355 
    1356         wm->set_mouse_shape(cash.img(c_normal)->copy(), 1, 1);
     1355            fade_in(cache.img(title_screen), 32);
     1356
     1357        wm->set_mouse_shape(cache.img(c_normal)->copy(), 1, 1);
    13571358    }
    13581359}
     
    14501451  recalc_local_view_space();   // now that we know what size the screen is...
    14511452
    1452   dark_color = get_color(cash.img(window_colors)->pixel(2, 0));
    1453   bright_color = get_color(cash.img(window_colors)->pixel(0, 0));
    1454   med_color = get_color(cash.img(window_colors)->pixel(1, 0));
    1455 
    1456   morph_dark_color = get_color(cash.img(window_colors)->pixel(2, 1));
    1457   morph_bright_color = get_color(cash.img(window_colors)->pixel(0, 1));
    1458   morph_med_color = get_color(cash.img(window_colors)->pixel(1, 1));
     1453  dark_color = get_color(cache.img(window_colors)->pixel(2, 0));
     1454  bright_color = get_color(cache.img(window_colors)->pixel(0, 0));
     1455  med_color = get_color(cache.img(window_colors)->pixel(1, 0));
     1456
     1457  morph_dark_color = get_color(cache.img(window_colors)->pixel(2, 1));
     1458  morph_bright_color = get_color(cache.img(window_colors)->pixel(0, 1));
     1459  morph_med_color = get_color(cache.img(window_colors)->pixel(1, 1));
    14591460  morph_sel_frame_color = pal->find_closest(255, 255, 0);
    14601461  light_connection_color = morph_sel_frame_color;
     
    14791480
    14801481  if(console_font_pict == -1) console_font_pict = font_pict;
    1481   game_font = new JCFont(cash.img(font_pict));
    1482 
    1483   console_font = new JCFont(cash.img(console_font_pict));
     1482  game_font = new JCFont(cache.img(font_pict));
     1483
     1484  console_font = new JCFont(cache.img(console_font_pict));
    14841485
    14851486  wm = new WindowManager(screen, pal, bright_color,
     
    15321533    if(title_screen >= 0)
    15331534    {
    1534       image *tit = cash.img(title_screen);
     1535      image *tit = cache.img(title_screen);
    15351536      tit->put_image(screen, screen->width()/2 - tit->width()/2,
    15361537                    screen->height()/2 - tit->height()/2);
     
    16101611    {
    16111612      for(view *f = first_view; f; f = f->next)
    1612         cash.img(pause_image)->put_image(screen, (f->cx1 + f->cx2)/2 - cash.img(pause_image)->width()/2,
     1613        cache.img(pause_image)->put_image(screen, (f->cx1 + f->cx2)/2 - cache.img(pause_image)->width()/2,
    16131614                   f->cy1 + 5, 1);
    16141615    }
     
    16171618  }
    16181619
    1619   if(state == RUN_STATE && cash.prof_is_on())
    1620     cash.prof_poll_end();
     1620  if(state == RUN_STATE && cache.prof_is_on())
     1621    cache.prof_poll_end();
    16211622
    16221623  wm->flush_screen();
     
    20972098        v->update_scroll();
    20982099
    2099       cash.prof_poll_start();
     2100      cache.prof_poll_start();
    21002101      current_level->tick();
    21012102      sbar.step();
     
    21982199{
    21992200    screen->add_dirty(0, 0, xres, yres);
    2200 //    image *bt = cash.img(border_tile);
     2201//    image *bt = cache.img(border_tile);
    22012202//    int tw = bt->width(), th = bt->height();
    22022203  screen->clear();
     
    22192220            screen->height()-wm->font()->height()-5, helpstr);
    22202221    }*/
    2221 /*    int dc = cash.img(window_colors)->pixel(0, 2);
    2222     int mc = cash.img(window_colors)->pixel(1, 2);
    2223     int bc = cash.img(window_colors)->pixel(2, 2);
     2222/*    int dc = cache.img(window_colors)->pixel(0, 2);
     2223    int mc = cache.img(window_colors)->pixel(1, 2);
     2224    int bc = cache.img(window_colors)->pixel(2, 2);
    22242225    screen->line(0, 0, screen->width()-1, 0, dc);
    22252226    screen->line(0, 0, 0, screen->height()-1, dc);
     
    27332734
    27342735
    2735     cash.empty();
     2736    cache.empty();
    27362737
    27372738
  • abuse/trunk/src/game.hpp

    r120 r123  
    100100
    101101  backtile *get_bg(int x) { if (x<0 || x>=nbacktiles || backtiles[x]<0)
    102                            return cash.backt(backtiles[BLACK]);
    103                            else return cash.backt(backtiles[x]); }
     102                           return cache.backt(backtiles[BLACK]);
     103                           else return cache.backt(backtiles[x]); }
    104104  foretile *get_fg(int x) { if (x<0 || x>=nforetiles || foretiles[x]<0)
    105                            return cash.foret(foretiles[BLACK]); else
    106                            return cash.foret(foretiles[x]); }
     105                           return cache.foret(foretiles[BLACK]); else
     106                           return cache.foret(foretiles[x]); }
    107107
    108108  void ftile_on(int screenx, int screeny, int32_t &x, int32_t &y);
  • abuse/trunk/src/gamma.cpp

    r120 r123  
    131131
    132132        int sh = wm->font()->height() + 35;
    133         button *but = new button(5, 5 + sh * 3, ID_GAMMA_OK, cash.img(ok_button),
     133        button *but = new button(5, 5 + sh * 3, ID_GAMMA_OK, cache.img(ok_button),
    134134            new info_field(35, 10 + sh * 3, ID_NULL, lang_string("gamma_msg"), 0));
    135135
  • abuse/trunk/src/gui.cpp

    r120 r123  
    9090 
    9191  if (up && !active)
    92     cash.img(u)->put_image(screen,x1,y1);
     92    cache.img(u)->put_image(screen,x1,y1);
    9393  else if (up && active)
    94     cash.img(ua)->put_image(screen,x1,y1);
     94    cache.img(ua)->put_image(screen,x1,y1);
    9595  else if (!up && !active)
    96     cash.img(d)->put_image(screen,x1,y1);
    97   else cash.img(da)->put_image(screen,x1,y1);
     96    cache.img(d)->put_image(screen,x1,y1);
     97  else cache.img(da)->put_image(screen,x1,y1);
    9898
    9999  if (act!=active && active && activate_id!=-1)
     
    127127    wm->push_event(new event(id,(char *)this));
    128128    if (S_BUTTON_PRESS_SND)
    129       cash.sfx(S_BUTTON_PRESS_SND)->play(sfx_volume);
     129      cache.sfx(S_BUTTON_PRESS_SND)->play(sfx_volume);
    130130  }
    131131}
     
    134134{
    135135  x1=x; y1=y;
    136   x2=x+cash.img(u)->width()-1;
    137   y2=y+cash.img(u)->height()-1;
     136  x2=x+cache.img(u)->width()-1;
     137  y2=y+cache.img(u)->height()-1;
    138138}
    139139
  • abuse/trunk/src/help.cpp

    r56 r123  
    2323void draw_help()
    2424{
    25   image *im=cash.img(help_screens[help_page]);
     25  image *im=cache.img(help_screens[help_page]);
    2626  int x1=xres/2-im->width()/2,y1=yres/2-im->height()/2;
    2727  int x2=x1+im->width(),y2=y1+im->height();
  • abuse/trunk/src/innet.cpp

    r120 r123  
    310310                                      case CLIENT_CRC_WAITER :
    311311                                      {         
    312                                                                 crc_man.write_crc_file(NET_CRC_FILENAME);       // return 0 on failure
     312                                                                crc_manager.write_crc_file(NET_CRC_FILENAME);       // return 0 on failure
    313313                                                                client_type=1;                                  // confirmation byte
    314314                                                                new_sock->write(&client_type,1);
  • abuse/trunk/src/level.cpp

    r115 r123  
    21582158void level::write_cache_prof_info()
    21592159{
    2160   if (cash.prof_is_on())
     2160  if (cache.prof_is_on())
    21612161  {
    21622162    char pf_name[100];
     
    21682168
    21692169    spec_directory sd;
    2170     sd.add_by_hand(new spec_entry(SPEC_DATA_ARRAY,"cache profile info",NULL,cash.prof_size(),0));
     2170    sd.add_by_hand(new spec_entry(SPEC_DATA_ARRAY,"cache profile info",NULL,cache.prof_size(),0));
    21712171    sd.calc_offsets();
    21722172    jFILE *fp2=sd.write(pf_name);
     
    21752175    else
    21762176    {
    2177       cash.prof_write(fp2);
     2177      cache.prof_write(fp2);
    21782178      delete fp2;
    21792179    }
     
    21942194
    21952195
    2196     cash.load_cache_prof_info(pf_name,this);
     2196    cache.load_cache_prof_info(pf_name,this);
    21972197  }
    21982198}
  • abuse/trunk/src/lisp/lisp.cpp

    r62 r123  
    21922192
    21932193#ifndef NO_LIBS
    2194       intptr_t a=cash.reg_lisp_block(lcar(lcdr(arg_list)));
    2195       intptr_t b=cash.reg_lisp_block(block_list);
     2194      intptr_t a=cache.reg_lisp_block(lcar(lcdr(arg_list)));
     2195      intptr_t b=cache.reg_lisp_block(block_list);
    21962196      lisp_user_function *ufun=new_lisp_user_function(a,b);
    21972197#else
     
    24482448                                sprintf(msg,"(load \"%s\")",st);
    24492449                                if (stat_man) stat_man->push(msg,NULL);
    2450                                 crc_man.get_filenumber(st);               // make sure this file gets crc'ed
     2450                                crc_manager.get_filenumber(st);               // make sure this file gets crc'ed
    24512451                        #endif
    24522452                                void *compiled_form=NULL;
     
    29512951
    29522952#ifndef NO_LIBS
    2953   void *fun_arg_list=cash.lblock(fun->alist);
    2954   void *block_list=cash.lblock(fun->blist);
     2953  void *fun_arg_list=cache.lblock(fun->alist);
     2954  void *block_list=cache.lblock(fun->blist);
    29552955  p_ref r9(block_list),r10(fun_arg_list);
    29562956#else
  • abuse/trunk/src/loader2.cpp

    r66 r123  
    149149        if (sd.entries[i]->type==SPEC_FORETILE)
    150150        {
    151           foretiles[fon]=cash.reg(filename,sd.entries[i]->name);
     151          foretiles[fon]=cache.reg(filename,sd.entries[i]->name);
    152152          fon++;
    153153          nforetiles++;
     
    155155        if (sd.entries[i]->type==SPEC_BACKTILE)
    156156        {
    157           backtiles[bon]=cash.reg(filename,sd.entries[i]->name);
     157          backtiles[bon]=cache.reg(filename,sd.entries[i]->name);
    158158          bon++;
    159159          nbacktiles++;
     
    252252              {
    253253                dprintf("Warning : background tile %d redefined\n",num);
    254                 cash.unreg(backtiles[num]);
     254                cache.unreg(backtiles[num]);
    255255              }
    256               backtiles[num]=cash.reg(fn,spe->name,SPEC_BACKTILE);           
     256              backtiles[num]=cache.reg(fn,spe->name,SPEC_BACKTILE);           
    257257            }
    258258            break;
     
    263263              {
    264264                dprintf("Warning : foreground tile %d redefined\n",num);
    265                 cash.unreg(foretiles[num]);
     265                cache.unreg(foretiles[num]);
    266266              }
    267               foretiles[num]=cash.reg(fn,spe->name,SPEC_FORETILE);
     267              foretiles[num]=cache.reg(fn,spe->name,SPEC_FORETILE);
    268268            }
    269269            break;
     
    334334  char const *cs;
    335335
    336   c_mouse1=cash.reg("art/dev.spe","c_mouse1",SPEC_IMAGE,0);
    337   c_mouse2=cash.reg("art/dev.spe","c_mouse2",SPEC_IMAGE,0);
    338   c_normal=cash.reg("art/dev.spe","c_normal",SPEC_IMAGE,0);
    339   c_target=cash.reg("art/dev.spe","c_target",SPEC_IMAGE,0);
     336  c_mouse1=cache.reg("art/dev.spe","c_mouse1",SPEC_IMAGE,0);
     337  c_mouse2=cache.reg("art/dev.spe","c_mouse2",SPEC_IMAGE,0);
     338  c_normal=cache.reg("art/dev.spe","c_normal",SPEC_IMAGE,0);
     339  c_target=cache.reg("art/dev.spe","c_target",SPEC_IMAGE,0);
    340340
    341341
     
    357357    char nm[10];
    358358    sprintf(nm,"l%d",z);
    359     light_buttons[z]=cash.reg("art/dev.spe",nm,SPEC_IMAGE,0);
     359    light_buttons[z]=cache.reg("art/dev.spe",nm,SPEC_IMAGE,0);
    360360  }
    361361
     
    372372    ff="art/frame.spe";
    373373
    374   ok_button   =      cash.reg(ff,"dev_ok",SPEC_IMAGE);
    375   cancel_button  =   cash.reg(ff,"cancel",SPEC_IMAGE);
    376 
    377 //  clouds      =      cash.reg(ff,"clouds",SPEC_IMAGE);
    378 
    379   lower_volume=      cash.reg(ff,"lower_volume",SPEC_IMAGE);
    380   raise_volume=      cash.reg(ff,"raise_volume",SPEC_IMAGE);
    381   music_button=      cash.reg(ff,"music",SPEC_IMAGE);
    382   sfx_button=        cash.reg(ff,"sound_fx",SPEC_IMAGE);
    383   record_button=     cash.reg(ff,"record",SPEC_IMAGE); 
    384   play_button=       cash.reg(ff,"play",SPEC_IMAGE);
    385   window_colors=     cash.reg(ff,"window_colors",SPEC_IMAGE);
    386   pause_image=       cash.reg(ff,"pause_image",SPEC_IMAGE);
    387   vmm_image=         cash.reg(ff,"vmm",SPEC_IMAGE);
    388   border_tile=       cash.reg(ff,"border_tile",SPEC_IMAGE);
    389   window_texture=    cash.reg(ff,"window_texture",SPEC_IMAGE);
     374  ok_button   =      cache.reg(ff,"dev_ok",SPEC_IMAGE);
     375  cancel_button  =   cache.reg(ff,"cancel",SPEC_IMAGE);
     376
     377//  clouds      =      cache.reg(ff,"clouds",SPEC_IMAGE);
     378
     379  lower_volume=      cache.reg(ff,"lower_volume",SPEC_IMAGE);
     380  raise_volume=      cache.reg(ff,"raise_volume",SPEC_IMAGE);
     381  music_button=      cache.reg(ff,"music",SPEC_IMAGE);
     382  sfx_button=        cache.reg(ff,"sound_fx",SPEC_IMAGE);
     383  record_button=     cache.reg(ff,"record",SPEC_IMAGE); 
     384  play_button=       cache.reg(ff,"play",SPEC_IMAGE);
     385  window_colors=     cache.reg(ff,"window_colors",SPEC_IMAGE);
     386  pause_image=       cache.reg(ff,"pause_image",SPEC_IMAGE);
     387  vmm_image=         cache.reg(ff,"vmm",SPEC_IMAGE);
     388  border_tile=       cache.reg(ff,"border_tile",SPEC_IMAGE);
     389  window_texture=    cache.reg(ff,"window_texture",SPEC_IMAGE);
    390390 
    391391
     
    405405      int i=0;
    406406      for (;v;v=CDR(v),i++)
    407         help_screens[i]=cash.reg(ff,lstring_value(CAR(v)),SPEC_IMAGE);     
     407        help_screens[i]=cache.reg(ff,lstring_value(CAR(v)),SPEC_IMAGE);     
    408408    }
    409409    else
     
    424424
    425425  if (DEFINEDP(symbol_value(l_title_screen)))
    426     title_screen=cash.reg_object(NULL,symbol_value(l_title_screen),SPEC_IMAGE,1);
     426    title_screen=cache.reg_object(NULL,symbol_value(l_title_screen),SPEC_IMAGE,1);
    427427  else title_screen=-1;
    428428
    429429  if (DEFINEDP(symbol_value(l_cdc_logo)))
    430     cdc_logo=cash.reg_object(NULL,symbol_value(l_cdc_logo),SPEC_IMAGE,1);
     430    cdc_logo=cache.reg_object(NULL,symbol_value(l_cdc_logo),SPEC_IMAGE,1);
    431431  else cdc_logo=-1;
    432432 
     
    452452  ERROR(big_font_pict!=-1 || small_font_pict!=-1,
    453453        "No font loaded (use load_big_font or load_small_font)!");
    454   f_wid=cash.foret(foretiles[0])->im->width();
    455   f_hi=cash.foret(foretiles[0])->im->height();
    456   b_wid=cash.backt(backtiles[0])->im->width();
    457   b_hi=cash.backt(backtiles[0])->im->height();
     454  f_wid=cache.foret(foretiles[0])->im->width();
     455  f_hi=cache.foret(foretiles[0])->im->height();
     456  b_wid=cache.backt(backtiles[0])->im->width();
     457  b_hi=cache.backt(backtiles[0])->im->height();
    458458
    459459#if 0
  • abuse/trunk/src/loadgame.cpp

    r120 r123  
    4444  {
    4545    sprintf(name,"nums%04d.pcx",i+1);
    46     save_buts[i]=cash.reg("art/icons.spe",name,SPEC_IMAGE,1);
     46    save_buts[i]=cache.reg("art/icons.spe",name,SPEC_IMAGE,1);
    4747  }
    4848}
     
    5959  ico_button *buts[MAX_SAVE_GAMES];
    6060  int y = 0, i;
    61   int ih=cash.img(save_buts[0])->height();
     61  int ih=cache.img(save_buts[0])->height();
    6262  int x=0;
    6363  for (i=0;i<total_saved;i++,y+=ih)
     
    9292  if (last_free) return last_free;    // if there are any slots not created yet...
    9393       
    94   int w=cash.img(save_buts[0])->width();
     94  int w=cache.img(save_buts[0])->width();
    9595  int mx=last_demo_mx-w/2;
    9696  if((unsigned)(mx + w + 10) > xres) mx = xres - w - 10;
     
    202202
    203203        int i;
    204 /*  int ih=cash.img(save_buts[0])->height();
     204/*  int ih=cache.img(save_buts[0])->height();
    205205  ico_button *buts[MAX_SAVE_GAMES];
    206206  int y=0;
  • abuse/trunk/src/menu.cpp

    r120 r123  
    310310                s = "sfx/ambtech1.wav";
    311311                if(sound_avail & SFX_INITIALIZED)
    312                     cash.sfx(cash.reg(s, s, SPEC_EXTERN_SFX, 1))
     312                    cache.sfx(cache.reg(s, s, SPEC_EXTERN_SFX, 1))
    313313                        ->play(sfx_volume);
    314314                break;
     
    320320                s = "sfx/ambtech1.wav";
    321321                if(sound_avail & SFX_INITIALIZED)
    322                     cash.sfx(cash.reg(s, s, SPEC_EXTERN_SFX, 1))
     322                    cache.sfx(cache.reg(s, s, SPEC_EXTERN_SFX, 1))
    323323                        ->play(sfx_volume);
    324324                break;
     
    398398    while (ss && !quit)
    399399    {
    400       int im=cash.reg_object("art/help.spe",CAR(ss),SPEC_IMAGE,1);
    401       fade_in(cash.img(im),16);
     400      int im=cache.reg_object("art/help.spe",CAR(ss),SPEC_IMAGE,1);
     401      fade_in(cache.img(im),16);
    402402
    403403      event ev;
     
    411411      ss=CDR(ss);
    412412    }
    413     wm->set_mouse_shape(cash.img(c_normal)->copy(),1,1);
     413    wm->set_mouse_shape(cache.img(c_normal)->copy(),1,1);
    414414  }
    415415}
     
    510510          if (title_screen>=0)
    511511          {
    512             image *tit=cash.img(title_screen);
     512            image *tit=cache.img(title_screen);
    513513              tit->put_image(screen,screen->width()/2-tit->width()/2,
    514514                                              screen->height()/2-tit->height()/2);
     
    537537  int a,b,c;
    538538  sprintf(name,"%s%04d.pcx",base,num*3+1);
    539   a=cash.reg("art/icons.spe",name,SPEC_IMAGE,1);
     539  a=cache.reg("art/icons.spe",name,SPEC_IMAGE,1);
    540540
    541541  sprintf(name,"%s%04d.pcx",base,num*3+2);
    542   b=cash.reg("art/icons.spe",name,SPEC_IMAGE,1);
     542  b=cache.reg("art/icons.spe",name,SPEC_IMAGE,1);
    543543
    544544  sprintf(name,"%s%04d.pcx",base,num*3+3);
    545   c=cash.reg("art/icons.spe",name,SPEC_IMAGE,1);
    546 
    547   h=cash.img(a)->height();
     545  c=cache.reg("art/icons.spe",name,SPEC_IMAGE,1);
     546
     547  h=cache.img(a)->height();
    548548
    549549  return new ico_button(x,y,id,b,b,a,c,next,-1,key);
  • abuse/trunk/src/morpher.cpp

    r56 r123  
    5555
    5656    fleft=frames;
    57     trans_image *h1=new trans_image(cash.img(t1->morph_mask),"morph tmp"),
    58                 *h2=new trans_image(cash.img(t2->morph_mask),"morph tmp");
     57    trans_image *h1=new trans_image(cache.img(t1->morph_mask),"morph tmp"),
     58                *h2=new trans_image(cache.img(t2->morph_mask),"morph tmp");
    5959    super_morph *sm=new super_morph(h1,h2,anneal,stat_fun);
    6060    if (sm->t)
  • abuse/trunk/src/netcfg.cpp

    r120 r123  
    261261  image *screen_backup=screen->copy();
    262262
    263   image *ns=cash.img(cash.reg("art/frame.spe","net_screen",SPEC_IMAGE,1));
     263  image *ns=cache.img(cache.reg("art/frame.spe","net_screen",SPEC_IMAGE,1));
    264264  int ns_w=ns->width(),ns_h=ns->height();
    265265  int x=(xres+1)/2-ns_w/2,y=(yres+1)/2-ns_h/2;
     
    326326int net_configuration::get_options(int server)
    327327{
    328   image *ns=cash.img(cash.reg("art/frame.spe","net_screen",SPEC_IMAGE,1));
     328  image *ns=cache.img(cache.reg("art/frame.spe","net_screen",SPEC_IMAGE,1));
    329329  int ns_w=ns->width(),ns_h=ns->height();
    330330  int x=(xres+1)/2-ns_w/2,y=(yres+1)/2-ns_h/2;
    331331  ns->put_image(screen,x,y);
    332332  JCFont *fnt=wm->font();
    333   image *ok_image=cash.img(cash.reg("art/frame.spe","dev_ok",SPEC_IMAGE,1))->copy(),
    334     *cancel_image=cash.img(cash.reg("art/frame.spe","cancel",SPEC_IMAGE,1))->copy();
     333  image *ok_image=cache.img(cache.reg("art/frame.spe","dev_ok",SPEC_IMAGE,1))->copy(),
     334    *cancel_image=cache.img(cache.reg("art/frame.spe","cancel",SPEC_IMAGE,1))->copy();
    335335
    336336  ifield *list=NULL;
     
    445445  screen->clear();
    446446 
    447   image *ns=cash.img(cash.reg("art/frame.spe","net_screen",SPEC_IMAGE,1));
     447  image *ns=cache.img(cache.reg("art/frame.spe","net_screen",SPEC_IMAGE,1));
    448448  int ns_w=ns->width(),ns_h=ns->height();
    449449  int x=(xres+1)/2-ns_w/2,y=(yres+1)/2-ns_h/2;
  • abuse/trunk/src/nfclient.cpp

    r56 r123  
    3030void remove_client(int client_number) { ; }
    3131
    32 crc_manager *net_crcs=NULL;
     32CrcManager *net_crcs = NULL;
    3333extern net_protocol *prot;
    3434
     
    8888    if (!fail2)
    8989    {   
    90       int local_file_num=crc_man.get_filenumber(local_filename);
    91       uint32_t local_crc=crc_man.get_crc(local_file_num,fail1);
     90      int local_file_num=crc_manager.get_filenumber(local_filename);
     91      uint32_t local_crc=crc_manager.get_crc(local_file_num,fail1);
    9292      if (fail1)
    9393      {
     
    9696        {
    9797          local_crc=crc_file(fp);
    98           crc_man.set_crc(local_file_num,local_crc);
     98          crc_manager.set_crc(local_file_num,local_crc);
    9999        } else fail3=1;
    100100        delete fp;     
     
    214214    }
    215215
    216     net_crcs=new crc_manager();
     216    net_crcs=new CrcManager();
    217217    if (!net_crcs->load_crc_file(NET_CRC_FILENAME))
    218218    {
  • abuse/trunk/src/objects.cpp

    r112 r123  
    692692                       y-cpict->height()+1-current_vyadd,
    693693                       fade_count(),fade_max(),
    694                        cash.ctint(tint_id)->data,
     694                       cache.ctint(tint_id)->data,
    695695                       color_table,the_game->current_palette());
    696696
     
    700700                       (direction<0 ? x-(cpict->width()-x_center()-1) : x-x_center())-current_vxadd,
    701701                       y-cpict->height()+1-current_vyadd,
    702                        cash.ctint(tint_id)->data);
     702                       cache.ctint(tint_id)->data);
    703703}
    704704
     
    712712                       y-cpict->height()+1-current_vyadd,
    713713                       fade_count(),fade_max(),
    714                        cash.ctint(tint_id)->data,
     714                       cache.ctint(tint_id)->data,
    715715                       color_table,the_game->current_palette());
    716716
     
    720720                       (direction<0 ? x-(cpict->width()-x_center()-1) : x-x_center())-current_vxadd,
    721721                       y-cpict->height()+1-current_vyadd,
    722                        cash.ctint(tint_id)->data,
    723                        cash.ctint(tint2)->data);
     722                       cache.ctint(tint_id)->data,
     723                       cache.ctint(tint2)->data);
    724724}
    725725
  • abuse/trunk/src/old.nfclient.cpp

    r56 r123  
    9898        pk.write_uint8(NFS_CRC_OPEN);
    9999        int fail;
    100         uint32_t crc=crc_man.get_crc(crc_man.get_filenumber(filename),fail); // skip crc calc if we can
     100        uint32_t crc=crc_manager.get_crc(crc_manager.get_filenumber(filename),fail); // skip crc calc if we can
    101101        if (fail) crc=crc_file(local_test);
    102102        pk.write_uint32(crc);
  • abuse/trunk/src/old.nfserver.cpp

    r56 r123  
    119119      packet opk;
    120120      int fail;
    121       uint32_t my_crc=crc_man.get_crc(crc_man.get_filenumber(fn),fail);
     121      uint32_t my_crc=crc_manager.get_crc(crc_manager.get_filenumber(fn),fail);
    122122      if (fail)
    123123      {
     
    132132        {
    133133          my_crc=crc_file(fp);
    134           crc_man.set_crc(crc_man.get_filenumber(fn),my_crc);
     134          crc_manager.set_crc(crc_manager.get_filenumber(fn),my_crc);
    135135          delete fp;
    136136        }       
  • abuse/trunk/src/particle.cpp

    r115 r123  
    110110  for (i=0;i<sd.total;i++)
    111111    if (sd.entries[i]->type==SPEC_PARTICLE)
    112       frames[on++]=cash.reg(fn,sd.entries[i]->name,SPEC_PARTICLE,1);
     112      frames[on++]=cache.reg(fn,sd.entries[i]->name,SPEC_PARTICLE,1);
    113113
    114114}
     
    161161  for (part_animation *p=first_anim;p;p=p->next)
    162162  {
    163     cash.part(p->seq->frames[p->frame])->draw(screen,p->x-v->xoff()+v->cx1,p->y-v->yoff()+v->cy1,p->dir);
     163    cache.part(p->seq->frames[p->frame])->draw(screen,p->x-v->xoff()+v->cx1,p->y-v->yoff()+v->cy1,p->dir);
    164164  }
    165165}
  • abuse/trunk/src/scene.cpp

    r106 r123  
    6464  scene_frame *next; 
    6565  scene_frame(char *&s);
    66   ~scene_frame() { cash.unreg(picture); }
     66  ~scene_frame() { cache.unreg(picture); }
    6767} ;
    6868
     
    7373  expect(get_token(s,tmp_name),sWORD,s);
    7474
    75   picture=cash.reg(scene_filename,tmp_name);
     75  picture=cache.reg(scene_filename,tmp_name);
    7676  if (picture<0)
    7777  {
     
    213213  void set_seq(char *seq_name)
    214214  { current_seq=seq_list->get_seq(seq_name); }
    215   int x() { return the_game->screenx(me->x)-cash.fig(current_frame->picture)->xcfg; }       
    216   int y() { return the_game->screeny(me->y)-cash.fig(current_frame->picture)->forward->height(); }
     215  int x() { return the_game->screenx(me->x)-cache.fig(current_frame->picture)->xcfg; }       
     216  int y() { return the_game->screeny(me->y)-cache.fig(current_frame->picture)->forward->height(); }
    217217  int next_frame();  // true if sequence is done
    218218  ~scene_character() { jfree(n); delete seq_list; if (last_frame) delete last_frame; }     
     
    250250  while (p)
    251251  {   
    252     if (x()+cash.fig(p->picture)->width()-1>x2)
    253       x2=x()+cash.fig(p->picture)->width()-1;
    254     if (y()+cash.fig(p->picture)->height()-1>y2)
    255       y2=y()+cash.fig(p->picture)->height()-1;
     252    if (x()+cache.fig(p->picture)->width()-1>x2)
     253      x2=x()+cache.fig(p->picture)->width()-1;
     254    if (y()+cache.fig(p->picture)->height()-1>y2)
     255      y2=y()+cache.fig(p->picture)->height()-1;
    256256    p=p->next;
    257257  } 
     
    261261void scene_character::draw()
    262262{
    263   cash.fig(current_frame->picture)->forward->put_image(screen,x(),y());
     263  cache.fig(current_frame->picture)->forward->put_image(screen,x(),y());
    264264 
    265265}
  • abuse/trunk/src/seq.cpp

    r66 r123  
    1919  for (int i=0;i<total;i++)
    2020  {
    21     if (cash.loaded(seq[i]))
    22       t+=cash.fig(seq[i])->size();   
     21    if (cache.loaded(seq[i]))
     22      t+=cache.fig(seq[i])->size();   
    2323  }
    2424  return t;
     
    3030  for (i=0;i<total;i++)
    3131  {
    32     cash.note_need(seq[i]);
     32    cache.note_need(seq[i]);
    3333  }
    3434  return 1;
     
    4444  seq=(int *) jmalloc(sizeof(int)*total,"sequence ptr array");
    4545  if (item_type(pict_list)==L_STRING)
    46     seq[0]=cash.reg_object(filename,pict_list,SPEC_CHARACTER2,1);
     46    seq[0]=cache.reg_object(filename,pict_list,SPEC_CHARACTER2,1);
    4747  else
    4848  {
     
    5050    for (i=0;i<total;i++)
    5151    {
    52       seq[i]=cash.reg_object(filename,lcar(pict_list),SPEC_CHARACTER2,1);
     52      seq[i]=cache.reg_object(filename,lcar(pict_list),SPEC_CHARACTER2,1);
    5353      pict_list=lcdr(pict_list);
    5454    }
     
    106106      {
    107107        sprintf(imname,"%s%04d.pcx",t,j);
    108         seq[i++]=cash.reg(filename,imname,SPEC_CHARACTER,1);
     108        seq[i++]=cache.reg(filename,imname,SPEC_CHARACTER,1);
    109109      }           
    110110      get_token(s,t);      // right paren
    111111    }
    112112    else
    113       seq[i++]=cash.reg(filename,t,SPEC_CHARACTER,1);
     113      seq[i++]=cache.reg(filename,t,SPEC_CHARACTER,1);
    114114  }
    115115}*/
  • abuse/trunk/src/seq.hpp

    r57 r123  
    3030  int last_frame(short &current) { current--; if (current<0) { current=total-1; return 0; } return 1; }
    3131  trans_image  *get_frame(short current, int direction)
    32    { if (direction>0) return cash.fig(seq[current])->forward;
    33                  else return cash.fig(seq[current])->backward; }
    34   figure *get_figure(short current) { return cash.fig(seq[current]); }
     32   { if (direction>0) return cache.fig(seq[current])->forward;
     33                 else return cache.fig(seq[current])->backward; }
     34  figure *get_figure(short current) { return cache.fig(seq[current]); }
    3535  int cache_in();
    36   int x_center(short current) { return (short) (cash.fig(seq[current])->xcfg); }
     36  int x_center(short current) { return (short) (cache.fig(seq[current])->xcfg); }
    3737  int length() { return total; }
    38   int get_advance(int current) { return cash.fig(seq[current])->advance; }
     38  int get_advance(int current) { return cache.fig(seq[current])->advance; }
    3939  int size();
    4040  ~sequence();
  • abuse/trunk/src/statbar.cpp

    r106 r123  
    5050  {
    5151    sprintf(iname,"bweap%04d.pcx",i+1);
    52     bweap[i]=cash.reg(sbname,iname,SPEC_IMAGE);
     52    bweap[i]=cache.reg(sbname,iname,SPEC_IMAGE);
    5353
    5454    sprintf(iname,"dweap%04d.pcx",i+1);
    55     dweap[i]=cash.reg(sbname,iname,SPEC_IMAGE);   
     55    dweap[i]=cache.reg(sbname,iname,SPEC_IMAGE);   
    5656  }
    5757
     
    5959  {
    6060    sprintf(iname,"bnum%02d",i);
    61     bnum[i]=cash.reg(sbname,iname,SPEC_IMAGE);
     61    bnum[i]=cache.reg(sbname,iname,SPEC_IMAGE);
    6262  }
    6363
    6464 
    65   sbar=cash.reg(sbname,"sbar",SPEC_IMAGE);
    66   sbar_select=cash.reg(sbname,"sbar_select",SPEC_IMAGE);
    67   sbar_numpad=cash.reg(sbname,"sbar_numpad",SPEC_IMAGE);
     65  sbar=cache.reg(sbname,"sbar",SPEC_IMAGE);
     66  sbar_select=cache.reg(sbname,"sbar_select",SPEC_IMAGE);
     67  sbar_numpad=cache.reg(sbname,"sbar_numpad",SPEC_IMAGE);
    6868}
    6969
     
    7676  }
    7777
    78   image *im=cash.img(*offset);
     78  image *im=cache.img(*offset);
    7979  int dw=small_render ? im->width()*2 : im->width();
    8080  int dh=small_render ? im->height()*2 : im->height();
    8181
    8282  int n=num/100;   
    83   scale_put(cash.img(offset[n]),screen,x,y,dw,dh);
     83  scale_put(cache.img(offset[n]),screen,x,y,dw,dh);
    8484  num-=n*100;
    8585
    8686  x+=dw; n=num/10;
    87   scale_put(cash.img(offset[n]),screen,x,y,dw,dh);
     87  scale_put(cache.img(offset[n]),screen,x,y,dw,dh);
    8888  num-=n*10;
    8989
    9090  x+=dw;
    91   scale_put(cash.img(offset[num]),screen,x,y,dw,dh);
     91  scale_put(cache.img(offset[num]),screen,x,y,dw,dh);
    9292}
    9393
     
    101101    if (!playing_state(the_game->state)) return ;
    102102
    103     image *sb=cash.img(sbar);
     103    image *sb=cache.img(sbar);
    104104   
    105105    // status bar width & height
     
    114114
    115115    // weapon icon width & height
    116     int ww=small_render ? cash.img(bweap[0])->width()*2 : cash.img(bweap[0])->width();
    117     int wh=small_render ? cash.img(bweap[0])->height()*2 : cash.img(bweap[0])->height();
     116    int ww=small_render ? cache.img(bweap[0])->width()*2 : cache.img(bweap[0])->width();
     117    int wh=small_render ? cache.img(bweap[0])->height()*2 : cache.img(bweap[0])->height();
    118118   
    119119
    120120    // numpad y offset
    121121    int np_yo=small_render ? 42 : 21;
    122     int np_w=small_render ? cash.img(sbar_numpad)->width()*2 : cash.img(sbar_numpad)->width();
    123     int np_h=small_render ? cash.img(sbar_numpad)->height()*2 : cash.img(sbar_numpad)->height();
     122    int np_w=small_render ? cache.img(sbar_numpad)->width()*2 : cache.img(sbar_numpad)->width();
     123    int np_h=small_render ? cache.img(sbar_numpad)->height()*2 : cache.img(sbar_numpad)->height();
    124124
    125125    // selection bar width * height
    126     int sel_w=small_render ? cash.img(sbar_select)->width()*2 : cash.img(sbar_select)->width();
    127     int sel_h=small_render ? cash.img(sbar_select)->height()*2 : cash.img(sbar_select)->height();
     126    int sel_w=small_render ? cache.img(sbar_select)->width()*2 : cache.img(sbar_select)->width();
     127    int sel_h=small_render ? cache.img(sbar_select)->height()*2 : cache.img(sbar_select)->height();
    128128
    129129    int sel_off=small_render ?  8 : 4;
     
    147147      {
    148148        if (v->current_weapon==i)
    149         scale_put_trans(cash.img(bweap[i]),screen,x_on,sy,ww,wh);
     149        scale_put_trans(cache.img(bweap[i]),screen,x_on,sy,ww,wh);
    150150        else
    151         scale_put_trans(cash.img(dweap[i]),screen,x_on,sy,ww,wh);
     151        scale_put_trans(cache.img(dweap[i]),screen,x_on,sy,ww,wh);
    152152       
    153         scale_put_trans(cash.img(sbar_numpad),screen,x_on-2,sy+np_yo,np_w,np_h);
     153        scale_put_trans(cache.img(sbar_numpad),screen,x_on-2,sy+np_yo,np_w,np_h);
    154154
    155155        if (v->current_weapon==i)
     
    159159       
    160160        if (i==icon_in_selection)
    161         scale_put_trans(cash.img(sbar_select),screen,x_on+sel_off,sy,sel_w,sel_h);
     161        scale_put_trans(cache.img(sbar_select),screen,x_on+sel_off,sy,sel_w,sel_h);
    162162      }
    163163    }
     
    176176  }
    177177
    178   image *sb=cash.img(sbar); 
     178  image *sb=cache.img(sbar); 
    179179
    180180  // status bar width & height
     
    246246    {
    247247      if ((current_level->tick_counter()&4)==0)
    248         wm->set_mouse_shape(cash.img(c_mouse1)->copy(),4,4);
    249       else wm->set_mouse_shape(cash.img(c_mouse2)->copy(),4,4);   
     248        wm->set_mouse_shape(cache.img(c_mouse1)->copy(),4,4);
     249      else wm->set_mouse_shape(cache.img(c_mouse2)->copy(),4,4);   
    250250      changed_cursor=1;
    251251    } else if (changed_cursor)
    252252    {
    253253      if (!(dev&EDIT_MODE))
    254         wm->set_mouse_shape(cash.img(c_target)->copy(),8,8);
     254        wm->set_mouse_shape(cache.img(c_target)->copy(),8,8);
    255255      else
    256         wm->set_mouse_shape(cash.img(c_normal)->copy(),1,1);
     256        wm->set_mouse_shape(cache.img(c_normal)->copy(),1,1);
    257257      changed_cursor=0;     
    258258    }
     
    272272  if (sbar>0 && total_weapons)
    273273  {
    274     image *sb=cash.img(sbar); 
     274    image *sb=cache.img(sbar); 
    275275
    276276    // status bar width & height
  • abuse/trunk/src/ui/volumewindow.cpp

    r120 r123  
    1717{
    1818    char const *ff = "art/frame.spe";
    19     u_u = cash.reg(ff, "u_u", SPEC_IMAGE, 1),
    20     u_d = cash.reg(ff, "u_u", SPEC_IMAGE, 1),
    21     u_ua = cash.reg(ff, "u_ua", SPEC_IMAGE, 1),
    22     u_da = cash.reg(ff, "u_da", SPEC_IMAGE, 1),
    23     d_u = cash.reg(ff, "d_u", SPEC_IMAGE, 1),
    24     d_d = cash.reg(ff, "d_u", SPEC_IMAGE, 1),
    25     d_ua = cash.reg(ff, "d_ua", SPEC_IMAGE, 1),
    26     d_da = cash.reg(ff, "d_da", SPEC_IMAGE, 1),
    27     slider = cash.reg(ff, "volume_slide", SPEC_IMAGE, 1);
     19    u_u = cache.reg(ff, "u_u", SPEC_IMAGE, 1),
     20    u_d = cache.reg(ff, "u_u", SPEC_IMAGE, 1),
     21    u_ua = cache.reg(ff, "u_ua", SPEC_IMAGE, 1),
     22    u_da = cache.reg(ff, "u_da", SPEC_IMAGE, 1),
     23    d_u = cache.reg(ff, "d_u", SPEC_IMAGE, 1),
     24    d_d = cache.reg(ff, "d_u", SPEC_IMAGE, 1),
     25    d_ua = cache.reg(ff, "d_ua", SPEC_IMAGE, 1),
     26    d_da = cache.reg(ff, "d_da", SPEC_IMAGE, 1),
     27    slider = cache.reg(ff, "volume_slide", SPEC_IMAGE, 1);
    2828    x = prop->getd("volume_x", xres / 2 - 20);
    2929    y = prop->getd("volume_y", yres / 2 - 50);
     
    3636   
    3737    //reconfigure();
    38     bg = cash.reg(ff, "vcontrol", SPEC_IMAGE, 1);
    39     l = cash.img(bg)->width();
    40     h = cash.img(bg)->height();
     38    bg = cache.reg(ff, "vcontrol", SPEC_IMAGE, 1);
     39    l = cache.img(bg)->width();
     40    h = cache.img(bg)->height();
    4141    screen = new image(l, h, NULL, 2);
    4242    redraw();
     
    4545void VolumeWindow::redraw()
    4646{
    47     cash.img(bg)->put_image(screen, 0, 0);
     47    cache.img(bg)->put_image(screen, 0, 0);
    4848    draw_music_vol();
    4949    draw_sfx_vol();
     
    5757    if(t != 0)
    5858    {
    59         cash.img(slider)->put_image(screen, x1, y1);   
     59        cache.img(slider)->put_image(screen, x1, y1);   
    6060//      screen->bar(x1,y1,dx,y2,c1);
    6161    }
Note: See TracChangeset for help on using the changeset viewer.