Changeset 653
- Timestamp:
- May 14, 2011, 4:00:53 PM (12 years ago)
- Location:
- abuse/trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/src/go.h
r555 r653 39 39 elevator(FILE *fp, unsigned char *state_remap); 40 40 virtual int size(); 41 virtual void rec ieve_signal(long signal) {; }41 virtual void receive_signal(long signal) { (void)signal; } 42 42 virtual game_objects type() { return O_elevator; } 43 43 virtual ifield *make_fields(int ystart, ifield *Next); -
abuse/trunk/src/imlib/image.h
r650 r653 25 25 { 26 26 public : 27 int16_t dx1,dy1,dx2,dy2;28 dirty_rect(int16_t x1, int16_t y1, int16_t x2, int16_t y2)29 { dx1=x1; dy1=y1; dx2=x2; dy2=y2;30 if(x2<x1 || y2<y1)31 printf("add incorrect dirty\n");32 }33 virtual int16_t compare(void *n1, int16_t field)34 { return((dirty_rect *)n1)->dy1>dy1; }35 } 27 int16_t dx1, dy1, dx2, dy2; 28 dirty_rect(int16_t x1, int16_t y1, int16_t x2, int16_t y2) 29 { 30 dx1 = x1; dy1 = y1; dx2 = x2; dy2 = y2; 31 if (x2 < x1 || y2 < y1) 32 printf("add incorrect dirty\n"); 33 } 34 virtual int compare(void *n1) { return ((dirty_rect *)n1)->dy1 > dy1; } 35 }; 36 36 37 37 class image_descriptor -
abuse/trunk/src/imlib/input.h
r643 r653 103 103 virtual void area(int &x1, int &y1, int &x2, int &y2); 104 104 virtual void draw_first(image *screen); 105 virtual void draw(int active, image *screen) { ; } 106 virtual void handle_event(Event &ev, image *screen, InputManager *im) { ; } 105 virtual void draw(int active, image *screen) { (void)active; (void)screen; } 106 virtual void handle_event(Event &ev, image *screen, InputManager *im) 107 { 108 (void)ev; (void)screen; (void)im; 109 } 107 110 virtual char *read() { return text; } 108 111 virtual int selectable() { return 0; } -
abuse/trunk/src/imlib/jwindow.h
r649 r653 77 77 virtual void handle_event(Event &ev, image *screen, InputManager *im) = 0; 78 78 virtual int selectable() { return 1; } 79 virtual void remap(Filter *f) { ; }79 virtual void remap(Filter *f) { (void)f; } 80 80 virtual char *read() = 0; 81 81 virtual ifield *find(int search_id) { if (id==search_id) return this; else return NULL; } 82 virtual ifield *unlink(int id) { return NULL; }82 virtual ifield *unlink(int id) { (void)id; return NULL; } 83 83 virtual ~ifield(); 84 84 } ; -
abuse/trunk/src/imlib/palette.cpp
r555 r653 56 56 } 57 57 58 int palette::find_closest(u nsigned char r, unsigned char g, unsigned charb)58 int palette::find_closest(uint8_t r, uint8_t g, uint8_t b) 59 59 { 60 60 unsigned char *cl=(unsigned char *)addr(); … … 71 71 } 72 72 73 74 int palette::find_closest_non0(unsigned char r, unsigned char g, unsigned char b) 75 { 76 unsigned char *cl=(unsigned char *)addr()+3; 77 int c=1,d=0x7fffffff,i,nd; 78 for (i=1; i<256; i++) 79 { 80 nd=((int)r-(int)(*cl))*((int)r-(int)(*cl)); cl++; 81 nd+=((int)g-(int)(*cl))*((int)g-(int)(*cl)); cl++; 82 nd+=((int)b-(int)(*cl))*((int)b-(int)(*cl)); cl++; 83 if (nd<d) 84 { c=i; d=nd; } 85 } 86 return c; 87 } 88 89 90 int palette::find_color(unsigned char r, unsigned char g, unsigned char b) 73 int palette::find_color(uint8_t r, uint8_t g, uint8_t b) 91 74 { 92 75 int i,ub,mask,find; … … 210 193 b=color_num%8; 211 194 return (usd[x]&(128>>b)); 212 }213 214 int palette::add_color(unsigned int r, int unsigned g, int unsigned b, int closest_only)215 {216 int i,f,u,c;217 if (!closest_only)218 {219 for (i=ncolors-1,f=-1,u=-1; i>=0 && f<0; i--)220 {221 if (used(i))222 {223 if (pal[i].red==r && pal[i].green==g && pal[i].blue==b)224 f=i;225 }226 else227 u=i;228 }229 } else { f=-1; u=-1; }230 if (f<0)231 {232 if (u>=0)233 { pal[u].red=r;234 pal[u].green=g;235 pal[u].blue=b;236 set_used(u);237 f=u;238 }239 else240 {241 for (i=0,f=0,u=10000; i<ncolors; i++)242 { c=(pal[i].red-r)*(pal[i].red-r)+243 (pal[i].green-g)*(pal[i].green-g)+244 (pal[i].blue-b)*(pal[i].blue-b);245 if (c<u)246 { f=i;247 u=c;248 }249 }250 }251 }252 return f;253 195 } 254 196 … … 430 372 } 431 373 432 void quant_palette::add_color(unsigned char r, unsigned char g, unsigned char b)433 {434 quant_node **p,*fat;435 int lev,cn,stop;436 p=&root;437 lev=0;438 stop=0;439 fat=NULL;440 if (nc>=mx-1)441 prune();442 while (!stop)443 {444 lev++;445 if (!(*p))446 {447 if (lev>2 && !fat)448 printf("h");449 (*p)=new quant_node(lev,fat);450 level[lev-1].add_end(*p);451 }452 453 if (!(*p)->is_leaf())454 {455 cn=((r&(256>>lev))!=0)<<2;456 cn+=((g&(256>>lev))!=0)<<1;457 cn+=((b&(256>>lev))!=0);458 fat=(*p);459 p=&((*p)->children[cn]);460 } else stop=1;461 462 }463 (*p)->set(r,g,b);464 if (!(*p)->tot)465 nc++;466 (*p)->tot++;467 }468 469 palette *quant_palette::create_pal()470 {471 palette *p;472 int i,x;473 quant_node *pn;474 p=new palette(mx);475 for (x=0,i=7; i>=0; i++)476 for (pn=(quant_node *)level[i].first();477 pn!=(quant_node *)level[i].first(); pn=(quant_node *)pn->Next())478 if (pn->is_leaf())479 p->set(x++,pn->red,pn->green,pn->blue);480 return p;481 }482 483 374 quant_palette::~quant_palette() 484 375 { … … 490 381 } 491 382 492 u nsigned charpalette::brightest(int all)493 { u nsigned charr,g,b,bri;383 uint8_t palette::brightest(int all) 384 { uint8_t r,g,b,bri; 494 385 unsigned i; 495 386 long brv; … … 510 401 } 511 402 512 u nsigned charpalette::darkest(int all, int noblack)513 { u nsigned charr,g,b,bri;403 uint8_t palette::darkest(int all, int noblack) 404 { uint8_t r,g,b,bri; 514 405 unsigned i; 515 406 long brv,x; -
abuse/trunk/src/imlib/palette.h
r555 r653 59 59 void set_all_used(); 60 60 void set_all_unused(); 61 void set_background(unsigned char b) { bg=b; } 62 int background(unsigned char b) { return bg; } 63 int add_color(unsigned int r, unsigned int g, unsigned int b, 64 int closest_only=0); 65 int find_color(unsigned char r, unsigned char g, unsigned char b); 66 int find_closest(unsigned char r, unsigned char g, unsigned char b); 67 int find_closest_non0(unsigned char r, unsigned char g, unsigned char b); 61 int find_color(uint8_t r, uint8_t g, uint8_t b); 62 int find_closest(uint8_t r, uint8_t g, uint8_t b); 68 63 palette *copy(); 69 u nsigned charbrightest(int all=0);70 u nsigned chardarkest(int all=0, int noblack=1);64 uint8_t brightest(int all=0); 65 uint8_t darkest(int all=0, int noblack=1); 71 66 int write(bFILE *fp); 72 67 int size(); … … 101 96 void re_delete(quant_node *who, int lev); 102 97 public : 103 void add_color(unsigned char r, unsigned char g, unsigned char b);104 98 quant_palette(int max_colors=256); 105 palette *create_pal();106 99 ~quant_palette(); 107 100 } ; -
abuse/trunk/src/level.cpp
r643 r653 399 399 void level::check_collisions() 400 400 { 401 game_object *target,*rec iever=NULL;401 game_object *target,*receiver=NULL; 402 402 int32_t sx1,sy1,sx2,sy2,tx1,ty1,tx2,ty2,hitx,hity, 403 403 s_centerx,t_centerx; … … 409 409 410 410 int hit=0; 411 rec iever=NULL;411 receiver=NULL; 412 412 for (target=first_active; target; target=target->next_active) 413 413 { … … 456 456 if (x2!=_x2 || _y2!=y2) 457 457 { 458 rec iever=target;458 receiver=target; 459 459 hitx=((x1+x2)/2+(xp1+xp2)/2)/2; 460 460 hity=((y1+y1)/2+(yp1+yp2)/2)/2; … … 467 467 } 468 468 } 469 if (rec iever)470 { 471 rec iever->do_damage((int)subject->current_figure()->hit_damage,subject,hitx,hity,0,0);472 subject->note_attack(rec iever);469 if (receiver) 470 { 471 receiver->do_damage((int)subject->current_figure()->hit_damage,subject,hitx,hity,0,0); 472 subject->note_attack(receiver); 473 473 hit=1; 474 474 } … … 2769 2769 game_object *o=first_active; 2770 2770 for (; o; o=o->next_active) 2771 o->rec ieve_signal(signal);2771 o->receive_signal(signal); 2772 2772 } 2773 2773 } -
abuse/trunk/src/objects.h
r555 r653 63 63 int decide(); // returns 0 if you want to be deleted 64 64 int type() { return otype; } 65 ifield *make_fields(int ystart, ifield *Next) { return NULL ; } 66 void gather_input(InputManager *inm) { ; } 65 ifield *make_fields(int ystart, ifield *Next) 66 { 67 (void)ystart; (void)Next; 68 return NULL; 69 } 70 void gather_input(InputManager *inm) { (void)inm; } 67 71 int hurt_all() { return figures[otype]->get_cflag(CFLAG_HURT_ALL); } 68 72 int stoppable() { return figures[otype]->get_cflag(CFLAG_STOPPABLE); } … … 87 91 88 92 void note_attack(game_object *whom); 89 void rec ieve_signal(long singal) {; }93 void receive_signal(long signal) { (void)signal; } 90 94 int push_range(); 91 95 int can_hurt(game_object *who); // collision checking will ask first to see if you
Note: See TracChangeset
for help on using the changeset viewer.