Changeset 534


Ignore:
Timestamp:
Apr 22, 2011, 7:32:17 PM (6 years ago)
Author:
sam
Message:

imlib: remove a lot of dead code, especially from the linked list and
the WAV reader.

Location:
abuse/trunk/src
Files:
1 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/clisp.h

    r494 r534  
    1010
    1111#ifndef __CLISP_HPP_
    12 #ifndef SCADALISP
     12
    1313int get_lprop_number(void *sybol, int def);  // returns def if symbol undefined or not number type
    1414
     
    5858
    5959#endif
    60 #endif
  • abuse/trunk/src/configuration.cpp

    r512 r534  
    6464        return 0;
    6565
    66 #ifdef SCADALISP
    67     strcpy( tmp, symbol_name( k ) );
    68 #else
    6966    strcpy( tmp, lstring_value( symbol_name( k ) ) );
    70 #endif
    7167
    7268    for( char *c = tmp; *c; c++ )
  • abuse/trunk/src/imlib/image.cpp

    r526 r534  
    690690    int x1 = 6000, y1 = 6000, x2 = -1, y2 = -1;
    691691
    692     for (int i = dirties.number_nodes(); i--; )
     692    for (int i = dirties.Count(); i--; )
    693693    {
    694694        x1 = Min(x1, p->dx1); y1 = Min(y1, p->dy1);
    695695        x2 = Max(x1, p->dx1); y2 = Max(y1, p->dy1);
    696         dirty_rect *tmp = (dirty_rect *)p->next();
     696        dirty_rect *tmp = (dirty_rect *)p->Next();
    697697        dirties.unlink(p);
    698698        delete p;
     
    716716        return;
    717717
    718     int i = dirties.number_nodes();
     718    int i = dirties.Count();
    719719    if (!i)
    720720        return;
     
    722722    for (p = (dirty_rect *)dirties.first(); i; i--, p = next)
    723723    {
    724         next = (dirty_rect *)p->next();
     724        next = (dirty_rect *)p->Next();
    725725
    726726        // are the two touching?
     
    815815        return;
    816816
    817     int i = dirties.number_nodes();
     817    int i = dirties.Count();
    818818    if (!i)
    819819        dirties.add_front(new dirty_rect(x1, y1, x2 - 1, y2 - 1));
     
    831831        if (x1<=p->dx1 && y1<=p->dy1 && x2>=p->dx2+1 && y2>=p->dy2+1)
    832832        {
    833           dirty_rect *tmp=(dirty_rect*) p->next();
     833          dirty_rect *tmp=(dirty_rect*) p->Next();
    834834          dirties.unlink(p);
    835835          delete p;
     
    867867              return ;
    868868            }
    869             p=(dirty_rect *)p->next();
    870           } else p=(dirty_rect *)p->next();
     869            p=(dirty_rect *)p->Next();
     870          } else p=(dirty_rect *)p->Next();
    871871
    872872      }
  • abuse/trunk/src/imlib/jwindow.h

    r518 r534  
    4848  void remap(filter *f);
    4949  ifield *unlink(int id);     // unlinks ID from fields list and return the pointer to it
    50   ifield *current() { return active; }
    5150  void clear_current();
    5251  void grab_focus(ifield *i);
  • abuse/trunk/src/imlib/linked.cpp

    r494 r534  
    1717#include "linked.h"
    1818
    19 //
    20 // take a node out of the linked list, but do not dispose of the memory
    21 //
    22 int linked_list::unlink(linked_node *p)
     19linked_list::linked_list()
     20  : m_first(NULL),
     21    m_count(0)
    2322{
    24   linked_node *q;
    25   if (first())        // if there are any nodes..
    26   {
    27     if (first()==p)  // if they want to unlinkt the first node
    28     {
    29       fn->last()->set_next(fn->next());   // set the first's last's next to the first's next
    30       fn->next()->set_last(fn->last());    // set the first next's last to the first last
    31       if (fn->next()==fn)                   // if there is ony one node
    32       { fn=NULL; cn=NULL; }                   // clear the list
    33       else fn=p->next();                  // else point the first pointer to the next node
    34       nn--;                              // decrement the number of nodes in the list
    35       return 1;
    36     }
    37     else
    38     {
    39       q=first()->next();
    40       while (q!=p && q!=first())    // find the node in the list
    41     q=q->next();
    42       if (q!=first())                  // is it in the list at all?
    43       {  q->last()->set_next(q->next());   // yes unlink the pointers
    44      q->next()->set_last(q->last());
    45      nn--;
    46       return 1;
    47       }                                    // decrement the number of nodes
    48     }
    49   }
    50   return 0;
     23    ;
    5124}
    5225
    53 
    5426//
    55 // clear all the nodes in a linked list and dispose of the
     27// Clear all the nodes in a linked list and dispose of the
    5628// memory for each one by calling its destructor
    5729//
    5830linked_list::~linked_list()
    5931{
    60   if (fn)
    61     fn->last()->set_next(NULL);  // set the last nodes next to NULL
    62                                  // so we can go until we hit NULL
    63   while (fn != NULL)          // repeat until we get to that node
    64   {
    65     cn=fn->next();
    66     delete fn;                // delete the old node
    67     fn=cn;
    68   }
    69   cn=NULL;                   // clear the list
    70   nn=0;                     // set the number of nodes to 0
     32    if (m_first)
     33        m_first->Prev()->SetNext(NULL); // set the prev nodes next to NULL
     34                                        // so we can go until we hit NULL
     35    while (m_first != NULL)
     36    {
     37        linked_node *tmp = m_first->Next();
     38        delete m_first;
     39        m_first = tmp;
     40    }
    7141}
    7242
    7343//
    74 // return the index of a given node in a linked list, by starting at the
    75 // node and parsing backwards
     44// Take a node out of the linked list, but do not dispose of the memory
    7645//
    77 int linked_list::node_number(linked_node *p)
     46int linked_list::unlink(linked_node *p)
    7847{
    79   int x;
    80   x=1;
    81   while (p!=first())
    82   { x++; p=p->last(); }
    83   return x;
     48    if (!m_count)
     49        return 0;
     50
     51    linked_node *q = m_first;
     52
     53    while (q != p) // find the node in the list
     54    {
     55        q = q->Next();
     56        if (q == m_first)
     57            return 0; // not in the list!
     58    }
     59
     60    q->Prev()->SetNext(q->Next());
     61    q->Next()->SetPrev(q->Prev());
     62
     63    if (p == m_first) // if they want to unlink the first node
     64        m_first = (m_first->Next() == m_first) ? NULL : p->Next();
     65
     66    m_count--;
     67    return 1;
    8468}
    8569
     70//
     71// Add a node to the end of a linked_list
     72//
     73void linked_list::add_end(class linked_node *p)
     74{
     75    if (m_first)
     76        p->SetPrev(m_first->Prev());
     77    else
     78        m_first = p;
     79    p->SetNext(m_first);
    8680
    87 // this function returns a pointer to the xth node
    88 class linked_node *linked_list::get_node(int x)
    89 {
    90   class linked_node *p;
    91   p=fn;             // start tat the first node
    92   while (x--!=1) p=p->next();  // go forward X-1 nodes
    93   return p;
     81    if (m_first != p)
     82        m_first->Prev()->SetNext(p);
     83    m_first->SetPrev(p);
     84
     85    m_count++;
    9486}
    9587
    96 
    97 // this function adds a node to the end of a linked_list
    98 void linked_list::add_end(class linked_node *p)
    99 {
    100   nn++;
    101   if (fn==NULL)        // if there are no nodes, then this one becomes the first
    102   { fn=p;
    103     fn->set_next(fn);  // and it poits to itself for first and last
    104     fn->set_last(fn);
    105   }
    106   else
    107   {
    108     p->set_last(fn->last());  // otherwise add it in at the end
    109     p->set_next(fn);
    110     fn->last()->set_next(p);
    111     fn->set_last(p);          // the first's last pointer points to the node we just added
    112   }
    113 }
    114 
    115 
    116 // to add a node at the fron of the list, just add it at the end and set
     88// Add a node at the front of the list: just add it at the end and set
    11789// the first pointer to it
    11890void linked_list::add_front(class linked_node *p)
    11991{
    120   add_end(p);
    121   fn=p;
     92    add_end(p);
     93    m_first = p;
    12294}
    12395
    124 
    125 // insert adds a node in the list according to is sort value
    126 void linked_list::insert(class linked_node *p)
    127 {
    128   class linked_node *q;
    129 
    130   // if there are nodes, or it belongs at the beginin call add front
    131   if ((fn==NULL) || (p->compare(fn,sortby)>0))
    132     add_front(p);
    133   // else if it goes at the ned call add_end
    134   else if (p->compare(fn->last(),sortby)<=0)
    135     add_end(p);
    136   else      // otherwise we have to find the right spot for it.
    137   {
    138     nn++;
    139     q=fn;
    140     while (q!=fn->last())  // q starts at the front
    141     { q=q->next();
    142       if (p->compare(q,sortby)>0)  // repeat until we find a value greater than the one we are inserting
    143       { p->set_next(q);
    144     p->set_last(q->last());     // insert it with pointers here
    145     q->last()->set_next(p);
    146     q->set_last(p);
    147     q=fn->last();         // set q to the last node so we finish the loop
    148       }
    149     }
    150   }
    151 }
    152 
    153 linked_list::linked_list(linked_node *first)
    154 { linked_node *prev;
    155   fn=first; cn=first; sortby=1; nn=0;
    156   if (first)
    157   { cn=first;
    158     do
    159     {
    160       nn++;
    161       prev=cn;
    162       cn=cn->next();
    163     } while (cn && cn!=first);
    164     if (cn==NULL)
    165     {
    166       fn->set_last(prev);
    167       prev->set_next(fn);
    168     }
    169     cn=first;
    170 
    171   }
    172 }
  • abuse/trunk/src/imlib/linked.h

    r519 r534  
    1111// linked.h  - linked list and linked list node classes
    1212// written June 2, 1992 by Jonathan Clark  (at home)
    13 // these classes provide the basic groundwork for any future linked list
    14 // please derive your own linked_node subclass and define the virtual
    15 // function compare.
    16 // example compare function
    17 //   virtual int compare(void *n1, int field)
    18 //        { return ((classname *) n1)->data > data); }
    19 //  should return (1 if n1 is greater than (self)) else return 0
    20 //  field is the value determined by linked_list::set_sort_field
    21 //  this defaults to 1
    2213
     14#ifndef __LINKED_H__
     15#define __LINKED_H__
    2316
    24 #ifndef linkman
    25 #define linkman
    2617#include <stdio.h>
    2718#include <stdlib.h>
    2819#include <string.h>
    2920
    30 #define loop(controll,first,inside) { controll=first; \
    31   if (first) do { inside controll=controll->next(); } \
    32   while (controll!=first); }
    33 
    34 #define loopt(type,controll,first,inside) { controll=(type *)(first); \
    35   if (first) do { inside controll=(type *)(controll->next()); } \
    36   while (controll!=(type *)(first)); }
    37 
    38 
    39 #define loop_rev(controll,last,inside) { controll=last; \
    40   if (first) do { inside controll=controll->last(); } \
    41   while (controll!=last); }
    42 
    43 #define loopct(type,controll,first,cond,inside) { controll=(type *)first; \
    44   if (first && (cond)) do { inside controll=(type *)controll->next(); } \
    45   while (controll!=(type *)first && (cond)); }
    46 
    47 #define loop_fort(type,controll,first,x) \
    48   int x=0; \
    49   if (first) \
    50      for (controll=(type *)(first); \
    51           (!x || (controll)!=(type *)(first)); \
    52           controll=(type *)(controll->next()),x++)
    53 
    54 #define loop_forct(type,controll,first,cond,x) int x=0; if (first) for \
    55   (controll=(type *)(first); cond && (!x || controll!=(type *)(first)); \
    56   controll=(type *)(controll->next()),x++)
    57 
    5821class linked_node
    5922{
    60   class linked_node *nextp, *lastp;
     23    friend class linked_list;
     24
    6125public:
    62   virtual int compare(void *n1, int field)     { return(0); }  // default is = (equal)
    63   class linked_node *next()              { return nextp; }
    64   class linked_node *last()              { return lastp; }
    65   void set_next(class linked_node *p)    { nextp=p; }
    66   void set_last(class linked_node *p)    { lastp=p; }
    67   virtual ~linked_node() { ; }
    68   linked_node() { nextp=NULL; lastp=NULL; }
     26    linked_node() { m_next = m_prev = NULL; }
     27    virtual ~linked_node() { ; }
     28
     29    inline class linked_node *Next() { return m_next; }
     30    inline class linked_node *Prev() { return m_prev; }
     31    inline void SetNext(class linked_node *p) { m_next = p; }
     32    inline void SetPrev(class linked_node *p) { m_prev = p; }
     33
     34private:
     35    class linked_node *m_next, *m_prev;
    6936};
    7037
     
    8350class linked_list
    8451{
    85   class linked_node *fn, *cn;     // first and current nodes
    86   int nn; char sortby;
    87 public :
    88   linked_list(linked_node *first=NULL);
    89   void add_front(class linked_node *p);
    90   void add_end(class linked_node *p);
    91   void insert(class linked_node *p);
    92   void set_sort_field(int x) { sortby=x; }   // this is passed to compare
    93   class linked_node *current() { return cn; }
    94   class linked_node *first() { return fn; }
    95   class linked_node *last() { return fn->last(); }
    96   class linked_node *get_node(int x);
    97   void set_current(class linked_node *p) { cn=p; }
    98   void go_first() { cn=fn; }
    99   void go_end() { cn=fn->last(); }
    100   void go_next() { cn=cn->next(); }
    101   void go_last() { cn=cn->last(); }
    102   int number_nodes()  { return nn; }
    103   int node_number(linked_node *p);
    104   int unlink(linked_node *p);
    105   ~linked_list();
     52public:
     53    linked_list();
     54    ~linked_list();
     55
     56    void add_front(class linked_node *p);
     57    void add_end(class linked_node *p);
     58    int unlink(linked_node *p);
     59
     60    inline class linked_node *first() { return m_first; }
     61    inline class linked_node *prev() { return m_first->Prev(); }
     62    inline size_t Count() { return m_count; }
     63
     64private:
     65    linked_node *m_first;
     66    size_t m_count;
    10667};
    10768
    10869#endif
    10970
    110 
    111 
  • abuse/trunk/src/imlib/palette.cpp

    r524 r534  
    404404    for (x=0; x<8 && !pruned; x++)
    405405      if (f->children[x])
    406         if (f->children[x]->next()!=p->next())        // if this son is not me!
     406        if (f->children[x]->Next()!=p->Next())        // if this son is not me!
    407407        pruned=1;                   //  I have a brother! stop
    408        p=(quant_node *)p->next();
     408       p=(quant_node *)p->Next();
    409409      } while (p != level[lev-1].first() && !pruned);
    410410    }
     
    473473  for (x=0,i=7; i>=0; i++)
    474474    for (pn=(quant_node *)level[i].first();
    475      pn!=(quant_node *)level[i].first(); pn=(quant_node *)pn->next())
     475     pn!=(quant_node *)level[i].first(); pn=(quant_node *)pn->Next())
    476476      if (pn->is_leaf())
    477477    p->set(x++,pn->red,pn->green,pn->blue);
  • abuse/trunk/src/imlib/readwav.cpp

    r524 r534  
    1919struct wav_chunk
    2020{
    21   char id[4];
    22   unsigned long size;
    23   char type[4];
    24 } ;
     21    char id[4];
     22    uint32_t size;
     23    char type[4];
     24};
    2525
    2626struct wav_tag
    2727{
    28   char id[4];
    29   unsigned long size;
    30 } ;
     28    char id[4];
     29    uint32_t size;
     30};
    3131
    3232
    3333struct wav_format
    3434{
    35   unsigned short fmt_tag,channels;
    36   unsigned long samplesps,avg_bytesps;
    37   unsigned short align;
    38 } ;
    39 
     35    uint16_t fmt_tag, channels;
     36    uint32_t samplesps, avg_bytesps;
     37    uint16_t align;
     38};
    4039
    4140struct pcm_wave
    4241{
    43   wav_format wf;
    44   unsigned short bitsps;
    45 } ;
     42    wav_format wf;
     43    uint16_t bitsps;
     44};
    4645
    47 
    48 
    49 
    50 void read_chunk(wav_chunk &chunk, bFILE *fp)
     46static void read_chunk(wav_chunk &chunk, bFILE *fp)
    5147{
    52   fp->read(&chunk.id,4);
    53   chunk.size=fp->read_uint32();
    54   fp->read(&chunk.type,4);
     48    fp->read(&chunk.id, 4);
     49    chunk.size = fp->read_uint32();
     50    fp->read(&chunk.type, 4);
    5551}
    5652
    57 void read_tag(wav_tag &tag, bFILE *fp)
     53static void read_tag(wav_tag &tag, bFILE *fp)
    5854{
    59   fp->read(&tag.id,4);
    60   tag.size=fp->read_uint32();
     55    fp->read(&tag.id, 4);
     56    tag.size = fp->read_uint32();
    6157}
    6258
    63 void read_wav_format(wav_format &fmt, bFILE *fp)
     59static void read_pcm(pcm_wave &pcm, bFILE *fp)
    6460{
    65   fmt.fmt_tag=fp->read_uint16();
    66   fmt.channels=fp->read_uint16();
    67   fmt.samplesps=fp->read_uint32();
    68   fmt.avg_bytesps=fp->read_uint32();
    69   fmt.align=fp->read_uint16();
     61    pcm.wf.fmt_tag = fp->read_uint16();
     62    pcm.wf.channels = fp->read_uint16();
     63    pcm.wf.samplesps = fp->read_uint32();
     64    pcm.wf.avg_bytesps = fp->read_uint32();
     65    pcm.wf.align = fp->read_uint16();
     66    pcm.bitsps = fp->read_uint16();
    7067}
    7168
     69uint8_t *read_wav(char const *filename, int &sample_rate, int &data_size)
     70{
     71    bFILE *fp = open_file(filename, "rb");
     72    if (fp->open_failure())
     73    {
     74        delete fp;
     75        return NULL;
     76    }
    7277
    73 void read_pcm(pcm_wave &pcm, bFILE *fp)
    74 {
    75   read_wav_format(pcm.wf,fp);
    76   pcm.bitsps=fp->read_uint16();
     78    wav_chunk chunk;
     79    read_chunk(chunk, fp);
     80    if (memcmp(chunk.type, "WAVE", 4) != 0)
     81    {
     82        printf("Bad WAV file (chunk) %s\n", filename);
     83        delete fp;
     84        return NULL;
     85    }
     86
     87    wav_tag tag;
     88    read_tag(tag, fp);
     89    if (memcmp(tag.id, "fmt ", 4) != 0)
     90    {
     91        printf( "fmt tag missing, bad file (%s)\n", filename);
     92        delete fp;
     93        return NULL;
     94    }
     95
     96    pcm_wave pcm;
     97    read_pcm(pcm, fp);
     98
     99    fp->seek(tag.size - 16, SEEK_CUR);  // seek to offset of sample
     100
     101    read_tag(tag, fp);
     102
     103    if (memcmp(tag.id, "data", 4) != 0)
     104    {
     105        printf("Bad Wav file (tag), %s\n", filename);
     106        delete fp;
     107        return NULL;
     108    }
     109
     110    data_size = tag.size;
     111    uint8_t *ret = (uint8_t *)malloc(tag.size);
     112    ERROR(ret, "Malloc error");
     113
     114    sample_rate = pcm.wf.samplesps;
     115    ERROR((unsigned int)fp->read(ret, tag.size) == tag.size, "Premature end of file");
     116    ERROR(pcm.bitsps == 8, "Only 8-bit samples supported");
     117    ERROR(pcm.wf.channels == 1, "Only mono samples supported");
     118    ERROR(pcm.wf.align == 1, "Bad block alignment");
     119    delete fp;
     120    return ret;
    77121}
    78122
    79 
    80 
    81 void write_wav(char *filename, long sample_rate, long data_size, unsigned char *data)
    82 {
    83   bFILE *fp=open_file(filename,"wb");
    84   if (fp->open_failure())
    85   {
    86     printf("Unable to open %s for writing\n", filename);
    87     delete fp;
    88     exit(1);
    89   }
    90 
    91   /***************  Write the chunk ***************************/
    92   fp->write((void *)"RIFF",4);
    93   fp->write_uint32(data_size+36);
    94   fp->write((void *)"WAVE",4);
    95 
    96 
    97   /************** Write the tag *******************************/
    98   fp->write((void *)"fmt ",4);
    99   fp->write_uint32(16);
    100 
    101 
    102   /************** Write PCM ***********************************/
    103   fp->write_uint16(1);          // format_tag
    104   fp->write_uint16(1);          // mono recording
    105   fp->write_uint32(sample_rate);
    106   fp->write_uint32(sample_rate);   // average bytes per sec
    107   fp->write_uint16(1);    // alignment? Don't know what this does?
    108   fp->write_uint16(8);    // 8 bits per sample
    109 
    110   /************* Write data tag ******************************/
    111   fp->write((void *)"data",4);
    112   fp->write_uint32(data_size);
    113 
    114   /************ Now write sample data ************************/
    115   fp->write(data,data_size);
    116 
    117   delete fp;
    118 }
    119 
    120 
    121 
    122 unsigned char *read_wav(char *filename, long &sample_rate, long &data_size)
    123 {
    124   unsigned char *data;
    125   wav_chunk chunk;
    126   wav_tag tag;
    127   pcm_wave pcm;
    128 
    129   bFILE *fp=open_file(filename,"rb");
    130   if (fp->open_failure())
    131   { delete fp; return NULL; }
    132   read_chunk(chunk,fp);
    133   if (memcmp(chunk.type,"WAVE",4)!=0)
    134   {
    135     printf("Bad WAV file (chunk) %s\n",filename);
    136     delete fp;
    137     return NULL;
    138   }
    139 
    140   read_tag(tag,fp);
    141   if (memcmp(tag.id,"fmt ",4)!=0)
    142   {
    143     printf( "fmt tag missing, bad file (%s)\n",filename);
    144     delete fp;
    145     return NULL;
    146   }
    147 
    148 
    149   read_pcm(pcm,fp);
    150 
    151   fp->seek(tag.size-16,SEEK_CUR);  // seek to offset of sample
    152 
    153   read_tag(tag,fp);
    154 
    155   if (memcmp(tag.id,"data",4)!=0)
    156   {
    157     printf("Bad Wav file (tag), %s\n",filename);
    158     delete fp;
    159     return NULL;
    160   }
    161 
    162   data_size=tag.size;
    163   data=(unsigned char *)malloc(tag.size);
    164   ERROR(data,"Malloc error");
    165 
    166   sample_rate=pcm.wf.samplesps;
    167   ERROR((unsigned int)fp->read(data,tag.size)==tag.size,"Premature end of file");
    168   ERROR(pcm.bitsps==8,"Only 8-bit samples supported");
    169   ERROR(pcm.wf.channels==1,"Only mono samples supported");
    170   ERROR(pcm.wf.align==1,"Bad block alignment");
    171   delete fp;
    172   return data;
    173 }
    174 
    175 
    176 
  • abuse/trunk/src/imlib/readwav.h

    r494 r534  
    99 */
    1010
    11 #ifndef __READ_WAV_HPP_
    12 #define __READ_WAV_HPP_
     11#ifndef __READ_WAV_H__
     12#define __READ_WAV_H__
     13
    1314#include "specs.h"
    14 unsigned char *read_wav(char *filename, long &sample_rate, long &data_size);
    15 void write_wav(char *filename, long sample_rate, long data_size, unsigned char *data);
    16 
     15uint8_t *read_wav(char const *filename, int &sample_rate, int &data_size);
    1716
    1817#endif
    1918
    20 
    21 
  • abuse/trunk/src/imlib/specs.h

    r529 r534  
    218218#endif
    219219
    220 
    221 
    222 
    223 
    224 
    225 
  • abuse/trunk/src/imlib/sprite.cpp

    r524 r534  
    5050{ sprites.add_end(sp); }
    5151
     52#define loopt(type,controll,first,inside) { controll=(type *)(first); \
     53  if (first) do { inside controll=(type *)(controll->Next()); } \
     54  while (controll!=(type *)(first)); }
     55
    5256void sprite_controller::remove_sprites()
    5357{ sprite *sp; loopt(sprite,sp,sprites.first(),sp->restore_background(); ); }
     
    8286  delete sp;
    8387}
     88
  • abuse/trunk/src/imlib/video.cpp

    r524 r534  
    2929    else
    3030    {
    31         int count = im->m_special->dirties.number_nodes();
     31        int count = im->m_special->dirties.Count();
    3232        dirty_rect *dr = (dirty_rect *)(im->m_special->dirties.first());
    3333        while(count > 0)
     
    3636                           dr->dx1, dr->dy1, dr->dx2 + 1, dr->dy2 + 1);
    3737            dirty_rect *tmp = dr;
    38             dr = (dirty_rect *)(dr->next());
     38            dr = (dirty_rect *)(dr->Next());
    3939            im->m_special->dirties.unlink(tmp);
    4040            delete tmp;
  • abuse/trunk/src/objects.cpp

    r533 r534  
    2727#include "lisp_gc.h"
    2828#include "profile.h"
    29 
    30 #ifdef SCADALISP
    31 #define LCAR(x)        CAR(x)
    32 #define LCDR(x)        CDR(x)
    33 #else
    34 #define LCAR(x)        (x)->car
    35 #define LCDR(x)        (x)->cdr
    36 #endif /* SCADALISP */
    3729
    3830char **object_names;
     
    538530    current_object = o;
    539531  } else damage_fun(amount,from,hitx,hity,push_xvel,push_yvel);
    540 #ifdef SCADALISP
    541   ENDLOCAL();
    542 #endif
    543532}
    544533
  • abuse/trunk/src/sdlport/sound.cpp

    r494 r534  
    218218    if( sound_enabled )
    219219    {
    220         long sample_speed;
     220        int sample_speed;
    221221
    222222#ifdef USE_SDL_MIXER
  • abuse/trunk/src/sdlport/sound.h

    r494 r534  
    99 */
    1010
    11 #ifndef __SOUND_HPP_
    12 #define __SOUND_HPP_
     11#ifndef __SOUND_H__
     12#define __SOUND_H__
    1313
    1414#ifdef USE_SDL_MIXER
    15 #include <SDL/SDL_mixer.h>
     15#   include <SDL/SDL_mixer.h>
    1616#endif
    1717
     
    2323int sound_init(int argc, char **argv);
    2424void sound_uninit();
    25 void print_sound_options();                         // print the options avaible for sound
     25void print_sound_options(); // print the options avaible for sound
    2626
    2727class sound_effect
    2828{
    29   long size;
    30   void *data;
     29public:
     30    sound_effect(char *filename);
     31    void play(int volume = 127, int pitch = 128, int panpot = 128);
     32    ~sound_effect();
     33
     34private:
     35    void *data;
    3136#ifdef USE_SDL_MIXER
    32   Mix_Chunk* chunk;
     37    Mix_Chunk* chunk;
    3338#endif
    34 public :
    35   sound_effect(char *filename);
    36   void play(int volume=127, int pitch=128, int panpot=128);
    37   ~sound_effect();
    38 } ;
    39 
     39    int size;
     40};
    4041
    4142class song
    4243{
    43   char *Name;
    44   unsigned char *data;
    45   unsigned long song_id;
     44public:
     45    char const *name() { return Name; }
     46    song(char const *filename);
     47    void play(unsigned char volume=127);
     48    void stop(long fadeout_time=0); // time in ms
     49    int playing();
     50    void set_volume(int volume);
     51    ~song();
     52
     53private:
     54    char *Name;
     55    unsigned char *data;
     56    unsigned long song_id;
    4657#ifdef USE_SDL_MIXER
    47   Mix_Music* music;
    48   SDL_RWops* rw;
     58    Mix_Music* music;
     59    SDL_RWops* rw;
    4960#endif
    50 public :
    51   char const *name() { return Name; }
    52   song(char const *filename);
    53   void play(unsigned char volume=127);
    54   void stop(long fadeout_time=0);                                        // time in ms
    55   int playing();
    56   void set_volume(int volume);
    57   ~song();
    58 } ;
     61};
     62
    5963#endif
    6064
    61 
    62 
    63 
    64 
    65 
    66 
    67 
    68 
    69 
    70 
Note: See TracChangeset for help on using the changeset viewer.