Changeset 579 for abuse/trunk
- Timestamp:
- May 5, 2011, 12:36:33 PM (12 years ago)
- Location:
- abuse/trunk/src
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/src/clisp.cpp
r555 r579 1592 1592 exit(0); 1593 1593 } 1594 return color_table-> lookup_color(r>>3,g>>3,b>>3);1594 return color_table->Lookup(r >> 3, g >> 3, b >> 3); 1595 1595 } break; 1596 1596 case 173 : … … 1735 1735 else 1736 1736 { 1737 if (color_table)delete color_table;1738 color_table =new color_filter(se,fp);1737 delete color_table; 1738 color_table = new ColorFilter(se, fp); 1739 1739 } 1740 1740 delete fp; -
abuse/trunk/src/dev.cpp
r555 r579 106 106 public : 107 107 cached_image(int Id) { id=Id; } 108 virtual void draw(image *screen, int x, int y, filter *f)108 virtual void draw(image *screen, int x, int y, Filter *f) 109 109 { 110 110 if (f) 111 f-> put_image(screen,cache.img(id),x,y,1);111 f->PutImage(screen, cache.img(id), vec2i(x, y)); 112 112 else 113 113 cache.img(id)->put_image(screen,x,y); -
abuse/trunk/src/endgame.cpp
r555 r579 121 121 b3=b1+(b2-b1)*fade256/256; 122 122 123 uint8_t c=color_table-> lookup_color(r3>>3,g3>>3,b3>>3);123 uint8_t c=color_table->Lookup(r3>>3,g3>>3,b3>>3); 124 124 125 125 *sl=*(white_light+((*l)/2+28+jrand()%4)*256+c); -
abuse/trunk/src/gui.cpp
r555 r579 110 110 int g=80; 111 111 screen->bar(0,0,144,20,0); 112 wm->font()->put_string(screen,0,0,symbol_str(key),color_table-> lookup_color(g>>3,g>>3,g>>3));112 wm->font()->put_string(screen,0,0,symbol_str(key),color_table->Lookup(g>>3,g>>3,g>>3)); 113 113 } else if (!active && key[0]) 114 114 { -
abuse/trunk/src/imlib/filter.cpp
r555 r579 18 18 #include "filter.h" 19 19 20 filter::filter(palette *from, palette *to) // creates a conversion filter from one palette to another 20 Filter::Filter(int colors) 21 21 { 22 nc=from->pal_size() > to->pal_size() ? from->pal_size() : to->pal_size(); 23 unsigned char *p=fdat=(unsigned char *)malloc(nc); 24 unsigned char *r,*g,*b; 25 r=g=b=(unsigned char *)from->addr(); 26 g++; 27 b+=2; 28 29 int dk=to->darkest(1); 30 for (int i=0; i<nc; i++,p++,r+=3,g+=3,b+=3) 31 { 32 *p=to->find_closest(*r,*g,*b); 33 34 // make sure non-blacks don't get remapped to the transparency 35 if ((*r!=0 || *g!=0 || *b!=0) && (to->red(*p)==0 && to->green(*p)==0 && to->blue(*p)==0)) 36 *p=dk; 37 } 38 22 CONDITION(colors >= 0 && colors <= 256, "bad colors value"); 23 m_size = colors; 24 m_table = (uint8_t *)malloc(m_size); 25 memset(m_table, 0, m_size * sizeof(*m_table)); 39 26 } 40 27 41 void filter::clear() 28 // Creates a conversion filter from one palette to another 29 Filter::Filter(palette *from, palette *to) 42 30 { 43 int i; 44 for (i=0; i<nc; i++) 45 fdat[i]=i; 31 m_size = Max(from->pal_size(), to->pal_size()); 32 m_table = (uint8_t *)malloc(m_size); 33 34 uint8_t *dst = m_table; 35 uint8_t *src = (uint8_t *)from->addr(); 36 int dk = to->darkest(1); 37 38 for (int i = 0; i < m_size; i++) 39 { 40 int r = *src++; 41 int g = *src++; 42 int b = *src++; 43 int color = to->find_closest(r, g, b); 44 45 // Make sure non-blacks don't get remapped to the transparency 46 if ((r || g || b) && to->red(color) == 0 47 && to->green(color) == 0 && to->blue(color) == 0) 48 color = dk; 49 50 *dst++ = color; 51 } 46 52 } 47 53 48 void filter::max_threshold(int minv, char blank)54 Filter::~Filter() 49 55 { 50 int i; 51 CONDITION(minv>=0 && minv<nc,"Bad minv"); 52 for (i=0; i<minv; i++) 53 fdat[i]=blank; 56 free(m_table); 54 57 } 55 58 56 void filter::min_threshold(int maxv, char blank)59 void Filter::Set(int color_num, int change_to) 57 60 { 58 int i; 59 CONDITION(maxv>=0 && maxv<nc,"bad maxv value in filter::max_thresh"); 60 for (i=nc-1; i>=maxv; i--) 61 fdat[i]=(unsigned) blank; 61 CONDITION(color_num >= 0 && color_num < m_size, "Bad colors_num"); 62 m_table[color_num] = change_to; 62 63 } 63 64 64 65 void filter::set(int color_num, char change_to) 65 void Filter::Apply(image *im) 66 66 { 67 CONDITION(color_num>=0 && color_num<nc,"Bad colors_num"); 68 fdat[color_num]=(unsigned) change_to; 67 im->Lock(); 68 uint8_t *dst = im->scan_line(0); 69 int npixels = im->Size().x * im->Size().y; 70 while (npixels--) 71 { 72 CONDITION(*dst < m_size, "not enough filter colors"); 73 *dst = m_table[*dst]; 74 dst++; 75 } 76 im->Unlock(); 69 77 } 70 78 71 72 filter::filter(int colors) 73 { 74 CONDITION(colors>=0 && colors<=256,"bad colors value"); 75 nc=colors; 76 fdat=(unsigned char *)malloc(nc); 77 clear(); 78 } 79 80 void filter::apply(image *im) 81 { 82 int x,y; 83 unsigned char *c; 84 CONDITION(im,"null image passed in filter::apply\n"); 85 im->Lock(); 86 for (y=im->Size().y-1; y>=0; y--) 87 { 88 c=im->scan_line(y); 89 for (x=im->Size().x-1; x>=0; x--) 90 { 91 CONDITION((unsigned) c[x]<nc,"not enough filter colors"); 92 c[x]=fdat[(unsigned) c[x]]; 93 } 94 } 95 im->Unlock(); 96 } 97 98 99 palette *compare_pal; 100 101 int color_compare(void *c1, void *c2) 102 { 103 long v1,v2; 104 unsigned char r1,g1,b1,r2,g2,b2; 105 compare_pal->get( *((unsigned char *)c1),r1,g1,b1); 106 compare_pal->get( *((unsigned char *)c2),r2,g2,b2); 107 v1=(int)r1*(int)r1+(int)g1*(int)g1+(int)b1*(int)b1; 108 v2=(int)r2*(int)r2+(int)g2*(int)g2+(int)b2*(int)b2; 109 if (v1<v2) return -1; 110 else if (v1>v2) return 1; 111 else return 0; 112 } 113 114 color_filter::color_filter(palette *pal, int color_bits, void (*stat_fun)(int)) 115 { 116 color_bits=5; // hard code 5 for now 117 int r,g,b,rv,gv,bv, 118 c=0,i,max=pal->pal_size(), 119 lshift=8-color_bits; 120 unsigned char *pp; 121 122 long dist_sqr,best; 123 int colors=1<<color_bits; 124 color_table=(unsigned char *)malloc(colors*colors*colors); 125 for (r=0; r<colors; r++) 126 { 127 if (stat_fun) stat_fun(r); 128 rv=r<<lshift; 129 for (g=0; g<colors; g++) 130 { 131 gv=g<<lshift; 132 for (b=0; b<colors; b++) 133 { 134 bv=b<<lshift; 135 best=0x7fffffff; 136 for (i=0,pp=(unsigned char *)pal->addr(); i<max; i++) 137 { 138 register long rd=*(pp++)-rv, 139 gd=*(pp++)-gv, 140 bd=*(pp++)-bv; 141 142 dist_sqr=(long)rd*rd+(long)bd*bd+(long)gd*gd; 143 if (dist_sqr<best) 144 { best=dist_sqr; 145 c=i; 146 } 147 } 148 color_table[r*colors*colors+g*colors+b]=c; 149 } 150 } 151 } 152 } 153 154 color_filter::color_filter(spec_entry *e, bFILE *fp) 155 { 156 fp->seek(e->offset,0); 157 fp->read_uint16(); 158 int colors=32; 159 color_table=(unsigned char *)malloc(colors*colors*colors); 160 fp->read(color_table,colors*colors*colors); 161 } 162 163 int color_filter::size() 164 { 165 int colors=32; 166 return 2+colors*colors*colors; 167 } 168 169 int color_filter::write(bFILE *fp) 170 { 171 int colors=32; 172 fp->write_uint16(colors); 173 return fp->write(color_table,colors*colors*colors)==colors*colors*colors; 174 } 175 176 177 void filter::put_image(image *screen, image *im, short x, short y, 178 char transparent) 79 /* This is only ever used in the editor, when showing the toolbar. It 80 * does not look like it's very useful. */ 81 void Filter::PutImage(image *screen, image *im, vec2i pos) 179 82 { 180 83 int cx1, cy1, cx2, cy2, x1 = 0, y1 = 0, 181 84 x2 = im->Size().x, y2 = im->Size().y; 182 85 screen->GetClip(cx1, cy1, cx2, cy2); 183 86 184 // see if the image gets clipped off the screen 185 if(x >= cx2 || y >= cy2 || x + (x2 - x1) <= cx1 || y + (y2 - y1) <= cy1) 87 // See if the image gets clipped off the screen 88 if(pos.x >= cx2 || pos.y >= cy2 || 89 pos.x + (x2 - x1) <= cx1 || pos.y + (y2 - y1) <= cy1) 186 90 return; 187 91 188 if(x < cx1) 189 { 190 x1 += (cx1 - x); 191 x = cx1; 192 } 193 if(y < cy1) 194 { 195 y1 += (cy1 - y); 196 y = cy1; 197 } 198 199 if(x + x2 - x1 >= cx2) 200 x2 = cx2 - x + x1; 201 202 if(y + y2 - y1 >= cy2) 203 y2 = cy2 - y + y1; 92 x1 += Max(cx1 - pos.x, 0); 93 y1 += Max(cy1 - pos.y, 0); 94 pos.x = Max(pos.x, cx1); 95 pos.y = Max(pos.y, cy1); 96 x2 = Min(x2, cx2 - pos.x + x1); 97 y2 = Min(y2, cy2 - pos.y + y1); 204 98 205 99 if(x1 >= x2 || y1 >= y2) … … 209 103 int yl = y2 - y1; 210 104 211 screen->AddDirty( x, y, x + xl,y + yl);105 screen->AddDirty(pos.x, pos.y, pos.x + xl, pos.y + yl); 212 106 213 107 screen->Lock(); 214 108 im->Lock(); 215 109 216 uint8_t *pg1 = screen->scan_line(y), *source, *dest;217 uint8_t *pg2 = im->scan_line(y1);218 int i;219 110 for(int j = 0; j < yl; j++) 220 111 { 221 for(i = 0, source = &pg2[x1], dest = &pg1[x]; 222 i < xl; 223 i++, source++, dest++) 224 { 225 if (!transparent || *source) 226 *dest=fdat[*source]; 227 } 228 pg1 = screen->next_line(y + j, pg1); 229 pg2 = im->next_line(y1 + j, pg2); 112 uint8_t *source = im->scan_line(y1 + j) + x1; 113 uint8_t *dest = screen->scan_line(pos.y + j) + pos.x; 114 115 for(int i = 0; i < xl; i++, source++, dest++) 116 if (*source) 117 *dest = m_table[*source]; 230 118 } 231 119 … … 234 122 } 235 123 124 ColorFilter::ColorFilter(palette *pal, int color_bits) 125 { 126 int max = pal->pal_size(); 127 int mul = 1 << (8 - color_bits); 128 m_size = 1 << color_bits; 129 m_table = (uint8_t *)malloc(m_size * m_size * m_size); 130 131 /* For each colour in the RGB cube, find the nearest palette element. */ 132 for (int r = 0; r < m_size; r++) 133 for (int g = 0; g < m_size; g++) 134 for (int b = 0; b < m_size; b++) 135 { 136 int best = 256 * 256 * 3; 137 int color = 0; 138 uint8_t *pp = (uint8_t *)pal->addr(); 139 140 for (int i = 0; i < max; i++) 141 { 142 int rd = *pp++ - r * mul, 143 gd = *pp++ - g * mul, 144 bd = *pp++ - b * mul; 145 146 int dist = rd * rd + bd * bd + gd * gd; 147 if (dist < best) 148 { 149 best = dist; 150 color = i; 151 } 152 } 153 m_table[(r * m_size + g) * m_size + b] = color; 154 } 155 } 156 157 ColorFilter::ColorFilter(spec_entry *e, bFILE *fp) 158 { 159 fp->seek(e->offset, 0); 160 m_size = fp->read_uint16(); 161 m_table = (uint8_t *)malloc(m_size * m_size * m_size); 162 fp->read(m_table, m_size * m_size * m_size); 163 } 164 165 ColorFilter::~ColorFilter() 166 { 167 free(m_table); 168 } 169 170 size_t ColorFilter::DiskUsage() 171 { 172 return sizeof(uint16_t) + m_size * m_size * m_size; 173 } 174 175 int ColorFilter::Write(bFILE *fp) 176 { 177 fp->write_uint16(m_size); 178 int bytes = m_size * m_size * m_size; 179 return fp->write(m_table, bytes) == bytes; 180 } 181 -
abuse/trunk/src/imlib/filter.h
r555 r579 16 16 #include "specs.h" 17 17 18 class filter18 class Filter 19 19 { 20 unsigned char *fdat;21 int nc;22 20 public : 23 filter(int colors=256); 24 filter(palette *from, palette *to); // creates a conversion filter from one palette to another 25 void set(int color_num, char change_to); 26 unsigned char get_mapping(int color_num) { return fdat[color_num]; } 27 void apply(image *im); 28 void max_threshold(int minv, char blank=0); 29 void min_threshold(int maxv, char blank=0); 30 void put_image(image *screen, image *im, short x, short y, char transparent=0); 31 void clear(); 32 ~filter() { free(fdat); } 33 } ; 21 Filter(int colors = 256); 22 Filter(palette *from, palette *to); 23 ~Filter(); 34 24 35 class color_filter 25 void Set(int color_num, int change_to); 26 int GetMapping(int color_num) { return m_table[color_num]; } 27 void Apply(image *im); 28 void PutImage(image *screen, image *im, vec2i pos); 29 30 private: 31 int m_size; 32 uint8_t *m_table; 33 }; 34 35 class ColorFilter 36 36 { 37 unsigned char *color_table;38 37 public: 39 int size(); 40 int write(bFILE *fp); 41 color_filter(spec_entry *e, bFILE *fp); 42 color_filter(palette *pal, int color_bits=6, void (*stat_fun)(int)=NULL); 43 unsigned char lookup_color(int r, int g, int b) 44 { return color_table[r*32*32+g*32+b]; } 45 unsigned char *table() { return color_table; } 46 int total_colors() { return 32; } 47 unsigned char *get_table() { return color_table; } 48 ~color_filter() { free(color_table); } 49 } ; 38 ColorFilter(spec_entry *e, bFILE *fp); 39 ColorFilter(palette *pal, int color_bits); 40 ~ColorFilter(); 41 42 size_t DiskUsage(); 43 int Write(bFILE *fp); 44 int Lookup(int r, int g, int b) 45 { 46 return m_table[(r * m_size + g) * m_size + b]; 47 } 48 49 private: 50 int m_size; 51 uint8_t *m_table; 52 }; 50 53 51 54 #endif 52 55 53 54 55 -
abuse/trunk/src/imlib/input.cpp
r555 r579 19 19 #include "input.h" 20 20 21 void button::remap( filter *f)21 void button::remap(Filter *f) 22 22 { 23 23 if (visual) 24 24 { 25 f-> apply(visual);25 f->Apply(visual); 26 26 if (pressed) 27 f-> apply(pressed);27 f->Apply(pressed); 28 28 } 29 29 } … … 33 33 } 34 34 35 void button_box::remap( filter *f)35 void button_box::remap(Filter *f) 36 36 { 37 37 for (button *b=buttons; b; b=(button *)b->next) -
abuse/trunk/src/imlib/input.h
r555 r579 32 32 virtual void handle_event(event &ev, image *screen, InputManager *im); 33 33 void change_visual(image *new_visual); 34 virtual void remap( filter *f);34 virtual void remap(Filter *f); 35 35 virtual ~button() { if (text) free(text); } 36 36 void push(); … … 48 48 void add_button(button *b); 49 49 void press_button(int id); // if button box doesn't contain id, nothing happens 50 virtual void remap( filter *f);50 virtual void remap(Filter *f); 51 51 virtual void move(int newx, int newy); 52 52 virtual void area(int &x1, int &y1, int &x2, int &y2); -
abuse/trunk/src/imlib/jwindow.cpp
r555 r579 725 725 } 726 726 727 void InputManager::remap( filter *f)727 void InputManager::remap(Filter *f) 728 728 { 729 729 for (ifield *i=first; i; i=i->next) -
abuse/trunk/src/imlib/jwindow.h
r555 r579 46 46 void redraw(); 47 47 void add(ifield *i); 48 void remap( filter *f);48 void remap(Filter *f); 49 49 ifield *unlink(int id); // unlinks ID from fields list and return the pointer to it 50 50 void clear_current(); … … 76 76 virtual void handle_event(event &ev, image *screen, InputManager *im) = 0; 77 77 virtual int selectable() { return 1; } 78 virtual void remap( filter *f) { ; }78 virtual void remap(Filter *f) { ; } 79 79 virtual char *read() = 0; 80 80 virtual ifield *find(int search_id) { if (id==search_id) return this; else return NULL; } -
abuse/trunk/src/imlib/supmorph.cpp
r555 r579 259 259 260 260 261 int smorph_player::show(image *screen, int x, int y, color_filter *fil, palette *pal,261 int smorph_player::show(image *screen, int x, int y, ColorFilter *fil, palette *pal, 262 262 int blur_threshold) 263 263 { … … 279 279 if (px>=x1 && px < x2 && py>=y1 && py < y2) 280 280 { 281 hole[ix+iy*w]=*(screen->scan_line(py)+px)=fil-> lookup_color(ss->r>>(19),281 hole[ix+iy*w]=*(screen->scan_line(py)+px)=fil->Lookup(ss->r>>(19), 282 282 ss->g>>(19), 283 283 ss->b>>(19)); … … 323 323 dist+=((int)(*pa)-b)*((int)(*pa)-b); 324 324 if (dist>blur_threshold) 325 *(tl)=*(screen->scan_line(y+iy)+x+ix)=fil-> lookup_color(r>>3,g>>3,b>>3);325 *(tl)=*(screen->scan_line(y+iy)+x+ix)=fil->Lookup(r>>3,g>>3,b>>3); 326 326 } else *(tl)=*(screen->scan_line(y+iy)+x+ix)=0; // kill single pixels 327 327 } 328 328 else if (t>=3) 329 *(tl)=*(screen->scan_line(y+iy)+x+ix)=fil-> lookup_color((r/t)>>3,(g/t)>>3,(b/t)>>3);329 *(tl)=*(screen->scan_line(y+iy)+x+ix)=fil->Lookup((r/t)>>3,(g/t)>>3,(b/t)>>3); 330 330 } 331 331 } -
abuse/trunk/src/imlib/supmorph.h
r555 r579 37 37 int w,h,f_left,t; 38 38 smorph_player(super_morph *m, palette *pal, image *i1, image *i2, int frames, int dir); 39 int show(image *screen, int x, int y, color_filter *fil, palette *pal, int blur_threshold);39 int show(image *screen, int x, int y, ColorFilter *fil, palette *pal, int blur_threshold); 40 40 ~smorph_player() { free(hole); free(steps); } 41 41 } ; -
abuse/trunk/src/imlib/tools.cpp
r555 r579 29 29 { 30 30 delete map; 31 map=new filter(old_pal,pal);31 map=new Filter(old_pal,pal); 32 32 draw_first(screen); 33 33 } … … 47 47 if (icons[i]->height()>ih) ih=icons[i]->height(); 48 48 } 49 map=new filter(icon_palette,pal);49 map=new Filter(icon_palette,pal); 50 50 old_pal=icon_palette->copy(); 51 51 reconfigure(); -
abuse/trunk/src/imlib/tools.h
r555 r579 20 20 class tool_picker : public spicker 21 21 { 22 filter *map;22 Filter *map; 23 23 visual_object **icons; 24 24 int *ids; -
abuse/trunk/src/imlib/transimage.cpp
r555 r579 149 149 image *blend, vec2i bpos, uint8_t *map, 150 150 uint8_t *map2, int amount, int nframes, 151 uint8_t *tint, color_filter *f, palette *pal)151 uint8_t *tint, ColorFilter *f, palette *pal) 152 152 { 153 153 vec2i pos1, pos2; … … 262 262 uint8_t b = ((((int)p1[2] - p2[2]) * mul) >> 16) + p2[2]; 263 263 264 *sl++ = f-> lookup_color(r >> 3, g >> 3, b >> 3);264 *sl++ = f->Lookup(r >> 3, g >> 3, b >> 3); 265 265 } 266 266 } … … 296 296 // Used when eg. the player teleports, or in rocket trails 297 297 void TransImage::PutFade(image *screen, vec2i pos, int amount, int nframes, 298 color_filter *f, palette *pal)298 ColorFilter *f, palette *pal) 299 299 { 300 300 PutImageGeneric<FADE>(screen, pos, 0, NULL, 0, NULL, NULL, … … 303 303 304 304 void TransImage::PutFadeTint(image *screen, vec2i pos, int amount, int nframes, 305 uint8_t *tint, color_filter *f, palette *pal)305 uint8_t *tint, ColorFilter *f, palette *pal) 306 306 { 307 307 PutImageGeneric<FADE_TINT>(screen, pos, 0, NULL, 0, NULL, NULL, … … 318 318 // Assumes that the blend image completely covers the transparent image. 319 319 void TransImage::PutBlend(image *screen, vec2i pos, image *blend, vec2i bpos, 320 int amount, color_filter *f, palette *pal)320 int amount, ColorFilter *f, palette *pal) 321 321 { 322 322 PutImageGeneric<BLEND>(screen, pos, 0, blend, bpos, NULL, NULL, -
abuse/trunk/src/imlib/transimage.h
r555 r579 40 40 void PutDoubleRemap(image *screen, vec2i pos, uint8_t *map, uint8_t *map2); 41 41 void PutFade(image *screen, vec2i pos, int amount, int nframes, 42 color_filter *f, palette *pal);42 ColorFilter *f, palette *pal); 43 43 void PutFadeTint(image *screen, vec2i pos, int amount, int nframes, 44 uint8_t *tint, color_filter *f, palette *pal);44 uint8_t *tint, ColorFilter *f, palette *pal); 45 45 void PutColor(image *screen, vec2i pos, uint8_t color); 46 46 void PutFilled(image *screen, vec2i pos, uint8_t color); 47 47 void PutPredator(image *screen, vec2i pos); 48 48 void PutBlend(image *screen, vec2i pos, image *blend, vec2i bpos, 49 int blend_amount, color_filter *f, palette *pal);49 int blend_amount, ColorFilter *f, palette *pal); 50 50 void PutScanLine(image *screen, vec2i pos, int line); 51 51 … … 63 63 uint8_t *map1, uint8_t *map2, int amount, 64 64 int nframes, uint8_t *tint, 65 color_filter *f, palette *pal);65 ColorFilter *f, palette *pal); 66 66 67 67 vec2i m_size; -
abuse/trunk/src/imlib/visobj.h
r555 r579 18 18 { 19 19 public : 20 virtual void draw(image *screen, int x, int y, filter *f) = 0;20 virtual void draw(image *screen, int x, int y, Filter *f) = 0; 21 21 virtual int width() = 0; 22 22 virtual int height() = 0; … … 32 32 33 33 image_visual(image *img) { im=img; } 34 virtual void draw(image *screen, int x, int y, filter *f);34 virtual void draw(image *screen, int x, int y, Filter *f); 35 35 virtual int width() { return im->Size().x; } 36 36 virtual int height() { return im->Size().y; } … … 45 45 public : 46 46 string_visual(char *string, int Color); 47 virtual void draw(image *screen, int x, int y, filter *f);47 virtual void draw(image *screen, int x, int y, Filter *f); 48 48 virtual int width(); 49 49 virtual int height(); -
abuse/trunk/src/items.cpp
r555 r579 258 258 for (l=0; l<AUTOTILE_WIDTH*AUTOTILE_HEIGHT; l++) 259 259 micro_image->PutPixel(vec2i(l % AUTOTILE_WIDTH, l / AUTOTILE_WIDTH), 260 color_table-> lookup_color((r[l]/(t[l]*4/5))>>3,260 color_table->Lookup((r[l]/(t[l]*4/5))>>3, 261 261 (g[l]/(t[l]*4/5))>>3, 262 262 (b[l]/(t[l]*4/5))>>3)); -
abuse/trunk/src/light.cpp
r555 r579 198 198 bs+=ba; if (bs>255) bs=255; else if (bs<0) bs=0; 199 199 } 200 filter f(pal,&npal);201 filter f2(&npal,pal);200 Filter f(pal,&npal); 201 Filter f2(&npal,pal); 202 202 203 203 for (i=0; i<256; i++,tint++) 204 *tint=f2. get_mapping(f.get_mapping(i));204 *tint=f2.GetMapping(f.GetMapping(i)); 205 205 } 206 206 -
abuse/trunk/src/loader2.cpp
r559 r579 57 57 int title_screen; 58 58 59 color_filter *color_table;59 ColorFilter *color_table; 60 60 61 61 -
abuse/trunk/src/loader2.h
r555 r579 65 65 /******************************** COLOR *****************************************/ 66 66 extern palette *pal; 67 extern color_filter *color_table;67 extern ColorFilter *color_table; 68 68 extern int light_connection_color; 69 69 -
abuse/trunk/src/menu.cpp
r577 r579 71 71 uint8_t g=((*(paddr++))-g_to)*percent/256+g_to; 72 72 uint8_t b=((*(paddr++))-b_to)*percent/256+b_to; 73 *sl=color_table-> lookup_color((r)>>3,(g)>>3,(b)>>3);73 *sl=color_table->Lookup((r)>>3,(g)>>3,(b)>>3); 74 74 } 75 75 } … … 99 99 uint8_t g=(*(paddr++))*amount/256; 100 100 uint8_t b=(*(paddr++))*amount/256; 101 *sl=color_table-> lookup_color((r)>>3,(g)>>3,(b)>>3);101 *sl=color_table->Lookup((r)>>3,(g)>>3,(b)>>3); 102 102 } 103 103 } -
abuse/trunk/src/sdlport/mouse.cpp
r555 r579 54 54 image *im; 55 55 int br, dr; 56 filter f;56 Filter f; 57 57 but = 0; 58 58 cx = cy = 0; … … 63 63 br = pal->brightest( 1 ); 64 64 dr = pal->darkest( 1 ); 65 f. set( 1, br );66 f. set( 2, dr );65 f.Set( 1, br ); 66 f.Set( 2, dr ); 67 67 im = new image(vec2i(8, 10), def_mouse); 68 f. apply( im );68 f.Apply( im ); 69 69 sp = new sprite(Screen, im, 100, 100); 70 70 mx = Screen->Size().x / 2;
Note: See TracChangeset
for help on using the changeset viewer.