Changeset 494 for abuse/trunk/src/imlib
- Timestamp:
- Apr 17, 2011, 11:56:44 PM (12 years ago)
- Location:
- abuse/trunk/src/imlib
- Files:
-
- 62 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/src/imlib/bitmap.h
r57 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/conio.h
r57 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/convert.cpp
r124 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 26 27 if (STReq(argv[1],"2unix")) 27 28 { strip=1; add=0; } 28 else { strip=0; add=1; }29 else { strip=0; add=1; } 29 30 printf("Converting...\n"); 30 for (i=2; i<argc;i++)31 for (i=2; i<argc; i++) 31 32 { 32 33 printf(" %s\n",argv[i]); -
abuse/trunk/src/imlib/dprint.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/dprint.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/event.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/filesel.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 34 35 { 35 36 int i=0; 36 for (; i<tf;i++)37 for (; i<tf; i++) 37 38 free(f[i]); 38 for (i=0; i<td;i++)39 for (i=0; i<td; i++) 39 40 free(d[i]); 40 41 if (tf) free(f); … … 63 64 wid=0; 64 65 int i=0; 65 for (; i<tf;i++)66 for (; i<tf; i++) 66 67 if ((int)strlen(f[i])>wid) wid=strlen(f[i]); 67 for (i=0; i<td;i++)68 for (i=0; i<td; i++) 68 69 if ((int)strlen(d[i])+2>wid) wid=strlen(d[i])+2; 69 70 sx=0; … … 109 110 wid=0; 110 111 int i=0; 111 for (; i<tf;i++)112 for (; i<tf; i++) 112 113 if ((int)strlen(f[i])>wid) wid=strlen(f[i]); 113 for (i=0; i<td;i++)114 for (i=0; i<td; i++) 114 115 if ((int)strlen(d[i])+2>wid) wid=strlen(d[i])+2; 115 116 reconfigure(); -
abuse/trunk/src/imlib/filesel.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/filter.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 26 27 27 28 int dk=to->darkest(1); 28 for (int i=0; i<nc;i++,p++,r+=3,g+=3,b+=3)29 for (int i=0; i<nc; i++,p++,r+=3,g+=3,b+=3) 29 30 { 30 31 *p=to->find_closest(*r,*g,*b); … … 40 41 { 41 42 int i; 42 for (i=0; i<nc;i++)43 for (i=0; i<nc; i++) 43 44 fdat[i]=i; 44 45 } … … 48 49 int i; 49 50 CONDITION(minv>=0 && minv<nc,"Bad minv"); 50 for (i=0; i<minv;i++)51 for (i=0; i<minv; i++) 51 52 fdat[i]=blank; 52 53 } … … 56 57 int i; 57 58 CONDITION(maxv>=0 && maxv<nc,"bad maxv value in filter::max_thresh"); 58 for (i=nc-1; i>=maxv;i--)59 for (i=nc-1; i>=maxv; i--) 59 60 fdat[i]=(unsigned) blank; 60 61 } … … 83 84 CONDITION(im,"null image passed in filter::apply\n"); 84 85 im->lock(); 85 for (y=im->height()-1; y>=0;y--)86 for (y=im->height()-1; y>=0; y--) 86 87 { 87 88 c=im->scan_line(y); 88 for (x=im->width()-1; x>=0;x--)89 for (x=im->width()-1; x>=0; x--) 89 90 { 90 91 CONDITION((unsigned) c[x]<nc,"not enough filter colors"); … … 122 123 int colors=1<<color_bits; 123 124 color_table=(unsigned char *)malloc(colors*colors*colors); 124 for (r=0; r<colors;r++)125 for (r=0; r<colors; r++) 125 126 { 126 127 if (stat_fun) stat_fun(r); 127 128 rv=r<<lshift; 128 for (g=0; g<colors;g++)129 for (g=0; g<colors; g++) 129 130 { 130 131 gv=g<<lshift; 131 for (b=0; b<colors;b++)132 for (b=0; b<colors; b++) 132 133 { 133 134 bv=b<<lshift; 134 135 best=0x7fffffff; 135 for (i=0,pp=(unsigned char *)pal->addr(); i<max;i++)136 for (i=0,pp=(unsigned char *)pal->addr(); i<max; i++) 136 137 { 137 138 register long rd=*(pp++)-rv, 138 139 gd=*(pp++)-gv, 139 140 bd=*(pp++)-bv; 140 141 141 142 dist_sqr=(long)rd*rd+(long)bd*bd+(long)gd*gd; 142 143 if (dist_sqr<best) … … 220 221 for(i = 0, source = &pg2[x1], dest = &pg1[x]; 221 222 i < xl; 222 i++, source++, dest++) 223 i++, source++, dest++) 223 224 { 224 225 if(!transparent || *source != current_background) -
abuse/trunk/src/imlib/filter.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/fonts.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 66 67 int ch; 67 68 68 for (ch=0; ch<256;ch++)69 for (ch=0; ch<256; ch++) 69 70 { 70 71 tmp.clear(); … … 78 79 { 79 80 int ch; 80 for (ch=0; ch<256;ch++)81 for (ch=0; ch<256; ch++) 81 82 delete let[ch]; 82 83 } -
abuse/trunk/src/imlib/fonts.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/glview.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 49 50 i++; 50 51 } 51 for (j=0; j<100;j++)52 for (j=0; j<100; j++) 52 53 { 53 for (k=1; k<t;k++)54 for (k=1; k<t; k++) 54 55 { 55 56 im[k]->put_image(screen,0,0); … … 58 59 screen->bar(0,0,im[k]->width(),im[k]->height(),0); 59 60 } 60 for (k=t-1; k>0;k--)61 for (k=t-1; k>0; k--) 61 62 { 62 63 im[k]->put_image(screen,0,0); -
abuse/trunk/src/imlib/guistat.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 92 93 if (len2>len1) len3=len2; else len3=len1; 93 94 wx-=len3/2; 94 95 95 96 96 97 gui_status_node *p=first->next; 97 98 while (p && !p->stat_win) p=p->next; -
abuse/trunk/src/imlib/guistat.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/image.cpp
r490 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 1127 1128 { 1128 1129 int16_t x, y, i, j; 1129 uint8_t dt_matrix[]={ 0, 136, 24, 170,1130 uint8_t dt_matrix[]={ 0, 136, 24, 170, 1130 1131 68, 204, 102, 238, 1131 1132 51, 187, 17, 153, … … 1348 1349 { 1349 1350 char st[100]; 1350 int16_t ledx[]={ 1, 2, 1, 2, 3, 3, 3, 3, 1, 2, 0, 0, 0, 0};1351 int16_t ledy[]={ 3, 3, 0, 0, 1, 2, 4, 6, 7, 7, 4, 6, 1, 2};1352 1353 int16_t dig[]={ 2+4+8+16+32+64, 4+8, 2+4+1+32+16, 2+4+1+8+16, 64+1+4+8,1351 int16_t ledx[]={ 1, 2, 1, 2, 3, 3, 3, 3, 1, 2, 0, 0, 0, 0}; 1352 int16_t ledy[]={ 3, 3, 0, 0, 1, 2, 4, 6, 7, 7, 4, 6, 1, 2}; 1353 1354 int16_t dig[]={ 2+4+8+16+32+64, 4+8, 2+4+1+32+16, 2+4+1+8+16, 64+1+4+8, 1354 1355 2+64+1+8+16, 64+32+1+8+16, 2+4+8, 1+2+4+8+16+32+64, 64+2+4+1+8, 1}; 1355 1356 int16_t xx, yy, zz; … … 1372 1373 } 1373 1374 1374 uint8_t dither_matrix[]={ 0, 136, 24, 170,1375 uint8_t dither_matrix[]={ 0, 136, 24, 170, 1375 1376 68, 204, 102, 238, 1376 1377 51, 187, 17, 153, -
abuse/trunk/src/imlib/image.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/include.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 19 20 unsigned int j; 20 21 int append=0,i; 21 for (j=0; j<strlen(name);j++)22 for (j=0; j<strlen(name); j++) 22 23 if (toupper(tmp_name[j])<'A' || toupper(tmp_name[j])>'Z') 23 24 tmp_name[j]='_'; … … 41 42 fprintf(fp,"unsigned char %s_palette[256*3] = {\n ",tmp_name); 42 43 unsigned char *p=(unsigned char *)pal->addr(); 43 for (i=0; i<768;i++,p++)44 for (i=0; i<768; i++,p++) 44 45 { 45 46 fprintf(fp,"%d",(int)*p); … … 55 56 im->width(),im->height()); 56 57 int x,y,max=im->width()*im->height()-1; 57 for (y=0,i=0; y<im->height();y++)58 for (x=0; x<im->width();x++,i++)58 for (y=0,i=0; y<im->height(); y++) 59 for (x=0; x<im->width(); x++,i++) 59 60 { 60 61 fprintf(fp,"%d",(int)im->pixel(x,y)); -
abuse/trunk/src/imlib/include.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/input.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 32 33 void button_box::remap(filter *f) 33 34 { 34 for (button *b=buttons; b;b=(button *)b->next)35 for (button *b=buttons; b; b=(button *)b->next) 35 36 b->remap(f); 36 37 } … … 39 40 { 40 41 if (search_id==id) return this; 41 for (ifield *i=(ifield *)buttons; i;i=i->next)42 for (ifield *i=(ifield *)buttons; i; i=i->next) 42 43 if (search_id==i->id) return i; 43 44 return NULL; … … 70 71 b->area(x1,y1,x2,y2); 71 72 int xp1,yp1,xp2,yp2; 72 for (b=(button *)b->next; b;b=(button *)b->next)73 for (b=(button *)b->next; b; b=(button *)b->next) 73 74 { 74 75 b->area(xp1,yp1,xp2,yp2); … … 83 84 void button_box::draw_first(image *screen) 84 85 { 85 for (button *b=buttons; b;b=(button *)b->next)86 for (button *b=buttons; b; b=(button *)b->next) 86 87 b->draw_first(screen); 87 88 } … … 102 103 char *button_box::read() 103 104 { 104 for (button *b=buttons; b;b=(button *)b->next)105 for (button *b=buttons; b; b=(button *)b->next) 105 106 { 106 107 if (*((int *)b->read())==0) … … 118 119 int x1,y1,x2,y2; 119 120 int found=0; 120 for (button *b=buttons; !found && b;b=(button *)b->next) // see if the user clicked on a button121 for (button *b=buttons; !found && b; b=(button *)b->next) // see if the user clicked on a button 121 122 { 122 123 b->area(x1,y1,x2,y2); … … 128 129 int total=0; 129 130 button *b2=buttons; 130 for (; b2;b2=(button *)b2->next)131 for (; b2; b2=(button *)b2->next) 131 132 if (*((int *)b2->read())==0) 132 133 total++; … … 136 137 if (total>maxdown) 137 138 { 138 for (b2=buttons; total>maxdown && b2;b2=(button *)b2->next)139 for (b2=buttons; total>maxdown && b2; b2=(button *)b2->next) 139 140 if ((b!=b2 || maxdown==0) && *((int *)b2->read())==0) 140 141 { … … 168 169 button *b=buttons; 169 170 int x_on=x,x1,y1,x2,y2; 170 for (; b;b=(button *)b->next)171 for (; b; b=(button *)b->next) 171 172 { 172 173 b->area(x1,y1,x2,y2); … … 181 182 button *b=buttons; 182 183 int y_on=y,x1,y1,x2,y2; 183 for (; b;b=(button *)b->next)184 for (; b; b=(button *)b->next) 184 185 { 185 186 b->area(x1,y1,x2,y2); … … 285 286 case JK_BACKSPACE : if (cur) 286 287 { draw_cur(wm->dark_color(),screen); cur--; 287 for (xx=cur; xx<(int)strlen(format)-1;xx++)288 for (xx=cur; xx<(int)strlen(format)-1; xx++) 288 289 data[xx]=data[xx+1]; 289 290 data[strlen(format)-1]=' '; … … 295 296 { 296 297 draw_cur(wm->dark_color(),screen); 297 for (xx=strlen(format)-1; xx>cur && xx>0;xx--)298 for (xx=strlen(format)-1; xx>cur && xx>0; xx--) 298 299 data[xx]=data[xx-1]; 299 300 data[cur]=ev.key; … … 473 474 int fw=wm->font()->width(),fh=wm->font()->height(),maxw=0; 474 475 char *info=text; 475 for (w=fw,h=fh+1; *info;info++)476 for (w=fw,h=fh+1; *info; info++) 476 477 { 477 478 if (w>maxw) maxw=w; -
abuse/trunk/src/imlib/input.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/jdir.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/jrand.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 24 25 int i; 25 26 unsigned short *tp=rtable; 26 for (i=0; i<RAND_TABLE_SIZE;i++,tp++)27 for (i=0; i<RAND_TABLE_SIZE; i++,tp++) 27 28 { 28 29 rseed=rseed*0x41c64e6d+12345; -
abuse/trunk/src/imlib/jrand.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/jwindow.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 43 44 int WindowManager::window_in_area(int x1, int y1, int x2, int y2) 44 45 { 45 for (Jwindow *f=first; f;f=f->next)46 for (Jwindow *f=first; f; f=f->next) 46 47 if (f->x<=x2 && f->y<=y2 && f->x+f->l-1>=x1 && f->y+f->h-1>=y1) 47 48 return 1; … … 64 65 { 65 66 Jwindow *p; 66 for (p=first; p;p=p->next)67 for (p=first; p; p=p->next) 67 68 { 68 69 if (!p->is_hidden()) … … 77 78 { 78 79 Jwindow *p; 79 for (p=first; p;p=p->next)80 for (p=first; p; p=p->next) 80 81 if (p->is_hidden()) 81 82 show_window(p); … … 89 90 else 90 91 { 91 for (k=first; k->next!=j;k=k->next)92 for (k=first; k->next!=j; k=k->next) 92 93 k->screen->add_dirty(j->x-k->x,j->y-k->y, 93 94 j->x+j->l-1-k->x,j->y+j->h-1-k->y); … … 120 121 if (state==inputing) 121 122 { 122 for (ev.window=NULL,j=first; j;j=j->next)123 for (ev.window=NULL,j=first; j; j=j->next) 123 124 if (!j->is_hidden() && ev.mouse_move.x>=j->x && ev.mouse_move.y>=j->y && 124 125 ev.mouse_move.x<j->x+j->l && ev.mouse_move.y<j->y+j->h) … … 148 149 ev.type=EV_CLOSE_WINDOW; 149 150 else if (movew) 150 { 151 { 151 152 int red=0; 152 153 if (ev.window==first) // see if we need to raise the window … … 159 160 { 160 161 Jwindow *last=first; 161 for (; last->next!=ev.window;last=last->next);162 for (; last->next!=ev.window; last=last->next); 162 163 if (ev.window->next) 163 164 red=1; … … 169 170 { 170 171 Jwindow *last=first; 171 for (; last->next;last=last->next);172 for (; last->next; last=last->next); 172 173 last->next=ev.window; 173 174 } … … 177 178 Jwindow *j=ev.window; 178 179 /* screen->add_dirty(j->x,j->y,j->x+j->l-1,j->y+j->h-1); 179 for (p=first; p!=j;p=p->next)180 p->screen->add_dirty(j->x-p->x,j->y-p->y,j->x+j->l-1-p->x,j->y+j->h-1-p->y); */180 for (p=first; p!=j; p=p->next) 181 p->screen->add_dirty(j->x-p->x,j->y-p->y,j->x+j->l-1-p->x,j->y+j->h-1-p->y); */ 181 182 j->screen->add_dirty(0,0,j->l-1,j->h-1); 182 183 flush_screen(); … … 209 210 if (ev.type==EV_REDRAW) 210 211 { 211 for (j=first; j;j=j->next)212 for (j=first; j; j=j->next) 212 213 j->screen->add_dirty(ev.redraw.x1-j->x,ev.redraw.y1-j->y, 213 214 ev.redraw.x2-j->x,ev.redraw.y2-j->y); … … 228 229 Jwindow *p; 229 230 screen->add_dirty(j->x,j->y,j->x+j->l-1,j->y+j->h-1); 230 for (p=first; p!=j;p=p->next)231 for (p=first; p!=j; p=p->next) 231 232 p->screen->add_dirty(j->x-p->x,j->y-p->y,j->x+j->l-1-p->x,j->y+j->h-1-p->y); 232 233 j->resize(l,h); … … 559 560 ifield *InputManager::unlink(int id) // unlinks ID from fields list and return the pointer to it 560 561 { 561 for (ifield *i=first,*last=NULL; i;i=i->next)562 for (ifield *i=first,*last=NULL; i; i=i->next) 562 563 { 563 564 if (i->id==id) … … 615 616 if ((ev.type==EV_MOUSE_BUTTON && ev.mouse_button==1) || ev.type==EV_MOUSE_MOVE) 616 617 { 617 for (i=first; i;i=i->next)618 for (i=first; i; i=i->next) 618 619 { 619 620 i->area(x1,y1,x2,y2); … … 725 726 void InputManager::remap(filter *f) 726 727 { 727 for (ifield *i=first; i;i=i->next)728 for (ifield *i=first; i; i=i->next) 728 729 i->remap(f); 729 730 redraw(); … … 747 748 { 748 749 ifield *f; 749 for (f=first; f;f=f->next)750 for (f=first; f; f=f->next) 750 751 { 751 752 ifield *ret=f->find(id); -
abuse/trunk/src/imlib/jwindow.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 175 176 JCFont *font() { return fnt; } 176 177 int has_mouse() { return eh->has_mouse(); } 177 void mouse_status(int &x, int &y, int &button) { eh->mouse_status(x,y,button); }178 void mouse_status(int &x, int &y, int &button) { eh->mouse_status(x,y,button); } 178 179 void set_mouse_shape(image *im, int centerx, int centery) 179 180 { eh->set_mouse_shape(im,centerx,centery); } -
abuse/trunk/src/imlib/keys.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/keys.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/linked.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/linked.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 15 16 // example compare function 16 17 // virtual int compare(void *n1, int field) 17 // { return ((classname *) n1)->data > data);}18 // { return ((classname *) n1)->data > data); } 18 19 // should return (1 if n1 is greater than (self)) else return 0 19 20 // field is the value determined by linked_list::set_sort_field … … 48 49 if (first) \ 49 50 for (controll=(type *)(first); \ 50 (!x || (controll)!=(type *)(first)); \51 (!x || (controll)!=(type *)(first)); \ 51 52 controll=(type *)(controll->next()),x++) 52 53 53 54 #define loop_forct(type,controll,first,cond,x) int x=0; if (first) for \ 54 (controll=(type *)(first); cond && (!x || controll!=(type *)(first));\55 (controll=(type *)(first); cond && (!x || controll!=(type *)(first)); \ 55 56 controll=(type *)(controll->next()),x++) 56 57 … … 59 60 class linked_node *nextp, *lastp; 60 61 public: 61 virtual int compare(void *n1, int field) { return(0);} // default is = (equal)62 class linked_node *next() { return nextp;}63 class linked_node *last() { return lastp;}64 void set_next(class linked_node *p) { nextp=p;}65 void set_last(class linked_node *p) { lastp=p;}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; } 66 67 virtual ~linked_node() { ; } 67 68 linked_node() { nextp=NULL; lastp=NULL; } … … 90 91 void add_end(class linked_node *p); 91 92 void insert(class linked_node *p); 92 void set_sort_field(int x) { sortby=x;} // this is passed to compare93 class linked_node *current() { return cn;}94 class linked_node *first() { return fn;}95 class linked_node *last() { return fn->last();}93 void set_sort_field(int x) { sortby=x; } // this is passed to compare 94 class linked_node *current() { return cn; } 95 class linked_node *first() { return fn; } 96 class linked_node *last() { return fn->last(); } 96 97 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;}98 void set_current(class linked_node *p) { cn=p; } 99 void go_first() { cn=fn; } 100 void go_end() { cn=fn->last(); } 101 void go_next() { cn=cn->next(); } 102 void go_last() { cn=cn->last(); } 103 int number_nodes() { return nn; } 103 104 int node_number(linked_node *p); 104 105 int unlink(linked_node *p); -
abuse/trunk/src/imlib/macs.h
r490 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/main.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/morph.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 34 35 morph_point8 *m8=(morph_point8 *)p; 35 36 screen->lock(); 36 for (i=0; i<total;i++,m8++)37 for (i=0; i<total; i++,m8++) 37 38 { 38 39 xx=x+trans(m8->x1,m8->x2,frame_on); … … 40 41 41 42 if (xx>=x1 && xx<=x2 && yy>=y1 && yy<=y2) 42 { 43 { 43 44 pal->get(m8->start_color,r1,g1,b1); 44 45 pal->get(m8->end_color,r2,g2,b2); … … 47 48 g=trans(g1,g2,frame_on)>>3, 48 49 b=trans(b1,b2,frame_on)>>3; 49 50 50 51 *(screen->scan_line(yy)+xx)=fli->lookup_color(r,g,b); 51 52 } … … 125 126 126 127 127 for (i=0; i<patches;i++)128 for (i=0; i<patches; i++) 128 129 { 129 130 pats[i].patch_data=NULL; … … 133 134 im->clear(); 134 135 jmorph::show_step_frame(im,0,0,i,fli,pal); 135 for (j=0; j<4;j++)136 { 137 for (y=0; y<h;y++)138 for (sl=im->scan_line(y),x=0; x<w;x++,sl++)139 { 136 for (j=0; j<4; j++) 137 { 138 for (y=0; y<h; y++) 139 for (sl=im->scan_line(y),x=0; x<w; x++,sl++) 140 { 140 141 mark_color=-1; 141 142 tot=r=g=b=0; 142 143 tot=r=g=b=0; 143 144 if (x!=0 && *(sl-1)) 144 145 { tot++; 145 146 r+=pal->red(*(sl-1)); 146 147 g+=pal->green(*(sl-1)); 147 b+=pal->blue(*(sl-1)); 148 } 148 b+=pal->blue(*(sl-1)); 149 } 149 150 if (x!=w-1 && *(sl+1)) 150 151 { tot++; 151 152 r+=pal->red(*(sl+1)); 152 153 g+=pal->green(*(sl+1)); 153 b+=pal->blue(*(sl+1)); 154 } 154 b+=pal->blue(*(sl+1)); 155 } 155 156 if (y!=0 && im->pixel(x,y-1)) 156 157 { tot++; … … 166 167 } 167 168 168 if (*sl && tot==0) // kill any separate pixels 169 if (*sl && tot==0) // kill any separate pixels 169 170 mark_color=0; 170 171 else if (*sl) … … 174 175 g/=tot; 175 176 b/=tot; 176 177 177 178 dist=((int)ored-r)*((int)ored-r)+((int)og-g)*((int)og-g)+((int)ob-b)*((int)ob-b); 178 179 if (i>0 && i<patches-1 && dist>3000) 179 180 { 180 181 // printf("adding blur at %d %d to frame %d, dist=%d\n",x,y,i,dist); 181 mark_color=fli->lookup_color(r>>3,g>>3,b>>3); 182 mark_color=fli->lookup_color(r>>3,g>>3,b>>3); 182 183 } 183 184 } 184 else if (*sl==0 && tot>=3) 185 mark_color=fli->lookup_color((r/tot)>>3,(g/tot)>>3,(b/tot)>>3); 185 else if (*sl==0 && tot>=3) 186 mark_color=fli->lookup_color((r/tot)>>3,(g/tot)>>3,(b/tot)>>3); 186 187 if (mark_color>=0) 187 { 188 { 188 189 pats[i].patches++; 189 190 pats[i].patch_data=(unsigned char *)realloc(pats[i].patch_data,3*pats[i].patches); 190 cur_patch=pats[i].patch_data+ (pats[i].patches-1)*3; 191 cur_patch=pats[i].patch_data+ (pats[i].patches-1)*3; 191 192 *(cur_patch++)=x; 192 193 *(cur_patch++)=y; 193 *sl=mark_color; 194 *(cur_patch++)=*sl; 195 } 194 *sl=mark_color; 195 *(cur_patch++)=*sl; 196 } 196 197 } 197 198 } … … 214 215 { 215 216 morph_point8 *p_on=(morph_point8 *)p; 216 for (i=0; i<total;i++,p_on++)217 for (i=0; i<total; i++,p_on++) 217 218 { 218 219 pixelx=(long)((int)p_on->x2-(int)p_on->x1)*(long)frame_on/8+p_on->x1+x; … … 232 233 { 233 234 morph_point16 *p_on=(morph_point16 *)p; 234 for (i=0; i<total;i++,p_on++)235 for (i=0; i<total; i++,p_on++) 235 236 { 236 237 pixelx=(long)((int)p_on->x2-(int)p_on->x1)*(long)frame_on/8+p_on->x1+x; … … 266 267 end_map=(unsigned char *)malloc(w*h); 267 268 268 for (frame_on=2; frame_on<frames-1;frame_on++)269 for (frame_on=2; frame_on<frames-1; frame_on++) 269 270 { 270 271 memset(middle_map,0,w*h*sizeof(morph_point8 *)); // initialize them middle pointers NULL … … 272 273 273 274 morph_point8 *p_on=(morph_point8 *)p; // p is the array of morph points 274 for (i=0; i<total;i++,p_on++)275 for (i=0; i<total; i++,p_on++) 275 276 { 276 277 pixelx=(long)((int)p_on->x2-(int)p_on->x1)*(long) frame_on /(long) frames +p_on->x1; … … 284 285 int skipped=0; 285 286 286 for (pixely=0; pixely<h;pixely++)287 { 288 for (pixelx=0; pixelx<w;pixelx++)287 for (pixely=0; pixely<h; pixely++) 288 { 289 for (pixelx=0; pixelx<w; pixelx++) 289 290 { 290 291 if (middle_map[pixelx+pixely*w]==NULL) // we are checking for 'duds' (misplaced black pixels) 291 { 292 int tot; 292 { 293 int tot; 293 294 if (pixelx>0) if (middle_map[pixelx-1+pixely*w]) tot=1; else tot=0; 294 if (pixelx<w-1) if (middle_map[pixelx+1+pixely*w]) tot++; 295 if (pixely>0) if (middle_map[pixelx+(pixely-1)*w]) tot++; 296 if (pixely<h-1) if (middle_map[pixelx+(pixely+1)*w]) tot++; 297 298 if (tot>=3) // it is surronded by 3 non black squares, this is a dud 299 { 300 int distance,shortest_distance,shortest_end_x,shortest_end_y; 295 if (pixelx<w-1) if (middle_map[pixelx+1+pixely*w]) tot++; 296 if (pixely>0) if (middle_map[pixelx+(pixely-1)*w]) tot++; 297 if (pixely<h-1) if (middle_map[pixelx+(pixely+1)*w]) tot++; 298 299 if (tot>=3) // it is surronded by 3 non black squares, this is a dud 300 { 301 int distance,shortest_distance,shortest_end_x,shortest_end_y; 301 302 morph_point8 *shortest=NULL; 302 303 for (k=0; k<w;k++)304 for (l=0; l<h;l++)305 { 303 304 for (k=0; k<w; k++) 305 for (l=0; l<h; l++) 306 { 306 307 other=middle_map[k+(l)*w]; 307 308 if (other) 308 309 { 309 310 int end_x=frames*(pixelx-other->x1)/frame_on+other->x1, 310 end_y=frames*(pixely-other->y1)/frame_on+other->y1; 311 end_y=frames*(pixely-other->y1)/frame_on+other->y1; 311 312 if (end_x>=0 && end_y>=0 && end_x<w && end_y<h && end_map[end_x+end_y*w]) 312 313 { … … 318 319 shortest=other; 319 320 shortest_end_x=end_x; 320 shortest_end_y=end_y; 321 shortest_end_y=end_y; 321 322 } 322 323 } 323 324 } 324 } 325 } 325 326 if (shortest) 326 327 { 327 328 total++; 328 p=(void *)realloc(p,sizeof(morph_point8)*total); 329 p=(void *)realloc(p,sizeof(morph_point8)*total); 329 330 morph_point8 *mod=((morph_point8 *)p)+total-1; 330 331 mod->x1=shortest->x1; 331 332 mod->y1=shortest->y1; 332 mod->start_color=shortest->start_color; 333 mod->start_color=shortest->start_color; 333 334 334 335 mod->x2=shortest_end_x; 335 mod->y2=shortest_end_y; 336 mod->end_color=end_map[shortest_end_x+shortest_end_y*w]; 337 } 336 mod->y2=shortest_end_y; 337 mod->end_color=end_map[shortest_end_x+shortest_end_y*w]; 338 } 338 339 else 339 { 340 { 340 341 skipped++; 341 342 printf("skiped so far : %d (frame %d)\n",skipped,frame_on); 342 343 } 343 344 345 } 344 345 346 } 346 347 } 347 348 } … … 372 373 p=(void *)malloc(sizeof(morph_point16)*total); 373 374 374 for (i=0; i<total;i++)375 for (i=0; i<total; i++) 375 376 { 376 377 ((morph_point16 *)p+i)->x1=fp->read_uint16(); … … 402 403 { 403 404 morph_point8 *p_on=(morph_point8 *)p; 404 for (i=0; i<total;i++,p_on++)405 for (i=0; i<total; i++,p_on++) 405 406 { 406 407 pixelx=(long)((int)p_on->x2-(int)p_on->x1)*(long)frame_on/(long)frames+p_on->x1+x; … … 420 421 { 421 422 morph_point16 *p_on=(morph_point16 *)p; 422 for (i=0; i<total;i++,p_on++)423 for (i=0; i<total; i++,p_on++) 423 424 { 424 425 pixelx=(long)((int)p_on->x2-(int)p_on->x1)*(long)frame_on/(long)frames+p_on->x1+x; … … 446 447 { 447 448 morph_point8 *p_on=(morph_point8 *)p; 448 for (i=0; i<total;i++,p_on++)449 for (i=0; i<total; i++,p_on++) 449 450 { 450 451 pixelx=(long)((int)p_on->x2-(int)p_on->x1)*(long)frame_on/(long)frames+p_on->x1+x; … … 452 453 453 454 if (pixelx>=0 && pixely>=0 && pixelx<width && pixely<height) 454 { 455 { 455 456 scolor=addr+((int)p_on->start_color)*3; 456 457 ecolor=addr+((int)p_on->end_color)*3; 457 458 pix=screen+pixelx*3+pixely*3*width; 458 *pix=(((int)*(ecolor++))-((int)*scolor))*frame_on/frames+*scolor; scolor++; pix++; 459 *pix=(((int)*(ecolor++))-((int)*scolor))*frame_on/frames+*scolor; scolor++; pix++; 459 *pix=(((int)*(ecolor++))-((int)*scolor))*frame_on/frames+*scolor; scolor++; pix++; 460 *pix=(((int)*(ecolor++))-((int)*scolor))*frame_on/frames+*scolor; scolor++; pix++; 460 461 *pix=((int)(*ecolor)-(int)(*scolor))*frame_on/frames+*scolor; 461 462 } … … 465 466 { 466 467 morph_point16 *p_on=(morph_point16 *)p; 467 for (i=0; i<total;i++,p_on++)468 for (i=0; i<total; i++,p_on++) 468 469 { 469 470 pixelx=(long)((int)p_on->x2-(int)p_on->x1)*(long)frame_on/(long)frames+p_on->x1+x; … … 471 472 472 473 if (pixelx>=0 && pixely>=0 && pixelx<width && pixely<height) 473 { 474 { 474 475 scolor=addr+((int)p_on->start_color)*3; 475 476 ecolor=addr+((int)p_on->end_color)*3; 476 477 pix=screen+pixelx*3+pixely*3*width; 477 *pix=(((int)*(ecolor++))-((int)*scolor))*frame_on/frames+*scolor; scolor++; pix++; 478 *pix=(((int)*(ecolor++))-((int)*scolor))*frame_on/frames+*scolor; scolor++; pix++; 478 *pix=(((int)*(ecolor++))-((int)*scolor))*frame_on/frames+*scolor; scolor++; pix++; 479 *pix=(((int)*(ecolor++))-((int)*scolor))*frame_on/frames+*scolor; scolor++; pix++; 479 480 *pix=((int)(*ecolor)-(int)(*scolor))*frame_on/frames+*scolor; 480 481 } … … 511 512 512 513 // first found out how many hints we have to follow 513 for (y=0; y<hint1->height();y++)514 for (y=0; y<hint1->height(); y++) 514 515 { sl=hint1->scan_line(y); 515 for (x=hint1->width(); x;x--,sl++)516 for (x=hint1->width(); x; x--,sl++) 516 517 if (*sl) hint_hist1[*sl]++; 517 518 } 518 for (y=0; y<hint2->height();y++)519 for (y=0; y<hint2->height(); y++) 519 520 { sl=hint2->scan_line(y); 520 for (x=hint2->width(); x;x--,sl++)521 for (x=hint2->width(); x; x--,sl++) 521 522 if (*sl) hint_hist2[*sl]++; 522 523 } 523 524 524 525 // check the user and see if the mask match up 525 for (x=0; x<256;x++)526 for (x=0; x<256; x++) 526 527 { 527 528 if ((hint_hist1[x]!=0 && hint_hist2[x]==0) || … … 548 549 plist=(void *)malloc(sizeof(morph_point16)*total); 549 550 CHECK(plist); 550 for (i=0,color=0; i<total_hints;i++)551 for (i=0,color=0; i<total_hints; i++) 551 552 { 552 553 color++; while (!hint_hist1[color]) color++; … … 555 556 total2=hint_hist2[color]; 556 557 if (total1>total2) points=total1; else points=total2; 557 for (j=0; j<points;j++)558 for (j=0; j<points; j++) 558 559 { 559 560 if (total1) // are there any more pixels left in this image? … … 620 621 621 622 int sx2,sy2,sec; 622 for (i=0; i<aneal_steps;i++)623 { 624 for (j=0,first_point=0; j<total_hints;j++)623 for (i=0; i<aneal_steps; i++) 624 { 625 for (j=0,first_point=0; j<total_hints; j++) 625 626 { 626 627 if (small) … … 630 631 start=crange[hint_color].start; 631 632 range=crange[hint_color].end-start+1; 632 for(k=crange[hint_color].start; k<=crange[hint_color].end;k++)633 for(k=crange[hint_color].start; k<=crange[hint_color].end; k++) 633 634 { 634 635 swap_point=rand()%range+start; … … 709 710 else 710 711 { 711 for (i=0; i<total;i++)712 for (i=0; i<total; i++) 712 713 { fp->write_uint16(((morph_point16 *)p+i)->x1); 713 714 fp->write_uint16(((morph_point16 *)p+i)->y1); … … 752 753 { 753 754 morph_point8 *m8=mor->small_points(); 754 755 for (i=0; i<total;i++,m8++)756 { 755 756 for (i=0; i<total; i++,m8++) 757 { 757 758 x1=(int)m8->x1; 758 759 x2=(int)m8->x2; … … 764 765 points[i].y=y1<<8; 765 766 points[i].dx=(x2-x1)<<5; 766 points[i].dy=(y2-y1)<<5; 767 points[i].dy=(y2-y1)<<5; 767 768 768 769 unsigned char r1,g1,b1,r2,g2,b2; … … 775 776 points[i].dr=(long)((int)r2-(int)r1)<<5; 776 777 points[i].dg=(long)((int)g2-(int)g1)<<5; 777 points[i].db=(long)((int)b2-(int)b1)<<5; 778 points[i].db=(long)((int)b2-(int)b1)<<5; 778 779 } 779 780 } … … 781 782 { 782 783 morph_point8 *m8=mor->small_points(); 783 for (i=0; i<total;i++,m8++)784 { 784 for (i=0; i<total; i++,m8++) 785 { 785 786 x1=(int)m8->x1; 786 787 x2=(int)m8->x2; … … 792 793 points[i].y=y2<<8; 793 794 points[i].dx=(x1-x2)<<5; 794 points[i].dy=(y1-y2)<<5; 795 points[i].dy=(y1-y2)<<5; 795 796 796 797 unsigned char r1,g1,b1,r2,g2,b2; … … 803 804 points[i].dr=(long)((int)r2-(int)r1)<<5; 804 805 points[i].dg=(long)((int)g2-(int)g1)<<5; 805 points[i].db=(long)((int)b2-(int)b1)<<5; 806 points[i].db=(long)((int)b2-(int)b1)<<5; 806 807 } 807 808 } … … 825 826 if (face_dir>0) 826 827 { 827 for (i=0,ss=points; i<total;i++,ss++)828 for (i=0,ss=points; i<total; i++,ss++) 828 829 { 829 830 px=x+(ss->x>>(16-8)); … … 839 840 } 840 841 841 for (j=0; j<tp;j++,sl++)842 for (j=0; j<tp; j++,sl++) 842 843 { 843 844 px=x+*(sl++); … … 848 849 } else 849 850 { 850 for (i=0,ss=points; i<total;i++,ss++)851 for (i=0,ss=points; i<total; i++,ss++) 851 852 { 852 853 px=x+ww-(ss->x>>(16-8)); … … 862 863 } 863 864 864 for (j=0; j<tp;j++,sl++)865 for (j=0; j<tp; j++,sl++) 865 866 { 866 867 px=x+(ww-(int)(*(sl++))); … … 879 880 step_struct *s=points; 880 881 int i; 881 for (i=0; i<total;i++,s++)882 for (i=0; i<total; i++,s++) 882 883 { 883 884 s->dx=-s->dx; … … 899 900 pats=(morph_patch *)malloc(sizeof(morph_patch)*patches); 900 901 901 for (i=0; i<patches;i++)902 for (i=0; i<patches; i++) 902 903 { 903 904 pats[i].patches=fp->read_uint16(); -
abuse/trunk/src/imlib/morph.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/mouse.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/palette.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 56 57 unsigned char *cl=(unsigned char *)addr(); 57 58 int c=0,d=0x100000,i,nd; 58 for (i=0; i<256;i++)59 for (i=0; i<256; i++) 59 60 { 60 61 nd=((int)r-(int)(*cl))*((int)r-(int)(*cl)); cl++; … … 72 73 unsigned char *cl=(unsigned char *)addr()+3; 73 74 int c=1,d=0x7fffffff,i,nd; 74 for (i=1; i<256;i++)75 for (i=1; i<256; i++) 75 76 { 76 77 nd=((int)r-(int)(*cl))*((int)r-(int)(*cl)); cl++; … … 87 88 { 88 89 int i,ub,mask,find; 89 for (i=0,ub=0,mask=128,find=-1; i<ncolors && find<0;i++)90 for (i=0,ub=0,mask=128,find=-1; i<ncolors && find<0; i++) 90 91 { 91 92 if (usd[ub]&mask) … … 114 115 unsigned char r,g,b,gr; 115 116 116 for (i=0; i<256;i++)117 for (i=0; i<256; i++) 117 118 { 118 119 get(i,r,g,b); … … 126 127 int i,c; 127 128 set(0,0,0,0); 128 for (i=1; i<ncolors;i++)129 for (i=1; i<ncolors; i++) 129 130 { c=(int)((double)i/(double)ncolors*(double)255); 130 131 set(i,c,c,c); … … 136 137 int i,v; 137 138 CHECK(ncolors==256); 138 for (i=0; i<64;i++)139 for (i=0; i<64; i++) 139 140 { 140 141 if (i==0) v=0; … … 156 157 { 157 158 int i; 158 for (i=0; i<ncolors;i++) set_used(i);159 for (i=0; i<ncolors; i++) set_used(i); 159 160 } 160 161 … … 162 163 { 163 164 int i; 164 for (i=0; i<ncolors;i++) set_unused(i);165 for (i=0; i<ncolors; i++) set_unused(i); 165 166 } 166 167 … … 171 172 int i; 172 173 p=new palette(ncolors); 173 for (i=0; i<ncolors;i++)174 for (i=0; i<ncolors; i++) 174 175 { 175 176 if (used(i)) … … 213 214 if (!closest_only) 214 215 { 215 for (i=ncolors-1,f=-1,u=-1; i>=0 && f<0;i--)216 for (i=ncolors-1,f=-1,u=-1; i>=0 && f<0; i--) 216 217 { 217 218 if (used(i)) … … 235 236 else 236 237 { 237 for (i=0,f=0,u=10000; i<ncolors;i++)238 for (i=0,f=0,u=10000; i<ncolors; i++) 238 239 { c=(pal[i].red-r)*(pal[i].red-r)+ 239 240 (pal[i].green-g)*(pal[i].green-g)+ … … 254 255 set(0,0,0,0); 255 256 set_used(0); 256 for (i=1; i<ncolors;i++)257 for (i=1; i<ncolors; i++) 257 258 set_unused(i); 258 259 if (ncolors==256) 259 for (i=0; i<ncolors;i++)260 for (i=0; i<ncolors; i++) 260 261 set(i,RED3(i),GREEN3(i),BLUE2(i)); 261 262 else if (ncolors==16) 262 for (i=0; i<ncolors;i++)263 for (i=0; i<ncolors; i++) 263 264 set(i,255-(i&3),255-((i&4)>>2),255-((i&8)>>3)); 264 265 else 265 for (i=0; i<ncolors;i++)266 for (i=0; i<ncolors; i++) 266 267 set(i,255-(i%3),255-((i+1)%3),255-((i+2)%3)); 267 268 } … … 275 276 276 277 m=-amount; 277 for (i=0; i<ncolors*3;i++)278 for (i=0; i<ncolors*3; i++) 278 279 ((unsigned char *) pal)[i]>>=m; 279 280 } … … 281 282 { 282 283 m=amount; 283 for (i=0; i<ncolors*3;i++)284 for (i=0; i<ncolors*3; i++) 284 285 ((unsigned char *) pal)[i]<<=m; 285 286 } … … 319 320 { 320 321 /* if (!is_leaf()) 321 { for (i=0; i<8;i++)322 { for (i=0; i<8; i++) 322 323 if (children[i]) 323 324 { delete children[i]; … … 349 350 } 350 351 else 351 { for (i=0; i<8;i++)352 { for (i=0; i<8; i++) 352 353 if (children[i]) 353 354 children[i]->total(tnodes,tr,tg,tb); … … 363 364 be_childish(); 364 365 else 365 for (i=0; i<8;i++) children[i]=NULL;366 for (i=0; i<8; i++) children[i]=NULL; 366 367 padre=dad; 367 368 red=r; green=g; blue=b; … … 377 378 { 378 379 if (!who->is_leaf()) 379 { for (x=0; x<8;x++)380 { for (x=0; x<8; x++) 380 381 if (who->children[x]) 381 382 { … … 393 394 int pruned,lev,x,r,g,b,t; 394 395 quant_node *p=NULL,*f=NULL; 395 for (pruned=0,lev=8; lev>1 && !pruned;lev--)396 for (pruned=0,lev=8; lev>1 && !pruned; lev--) 396 397 { 397 398 p=(quant_node *)level[lev-1].first(); … … 400 401 { 401 402 f=p->father(); 402 for (x=0; x<8 && !pruned;x++)403 for (x=0; x<8 && !pruned; x++) 403 404 if (f->children[x]) 404 405 if (f->children[x]->next()!=p->next()) // if this son is not me! … … 469 470 quant_node *pn; 470 471 p=new palette(mx); 471 for (x=0,i=7; i>=0;i++)472 for (x=0,i=7; i>=0; i++) 472 473 for (pn=(quant_node *)level[i].first(); 473 pn!=(quant_node *)level[i].first(); pn=(quant_node *)pn->next())474 pn!=(quant_node *)level[i].first(); pn=(quant_node *)pn->next()) 474 475 if (pn->is_leaf()) 475 476 p->set(x++,pn->red,pn->green,pn->blue); … … 492 493 brv=0; bri=0; 493 494 494 for (i=0; i<(unsigned int)ncolors;i++)495 for (i=0; i<(unsigned int)ncolors; i++) 495 496 { if (all || used(i)) 496 497 { … … 512 513 brv=(long)258*(long)258*(long)258; bri=0; 513 514 514 for (i=0; i<(unsigned int)ncolors;i++)515 for (i=0; i<(unsigned int)ncolors; i++) 515 516 { if (all || used(i)) 516 517 { … … 536 537 uint8_t x; 537 538 int i; 538 for (i=0; i<ncolors;i++)539 for (i=0; i<ncolors; i++) 539 540 { 540 541 x=(( dest_r-(int)*sl)*fade_on/total_fades+*sl); -
abuse/trunk/src/imlib/palette.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 86 87 void total(int &tnodes, int &tr, int &tg, int &tb); 87 88 // void prune(); 88 void set(int r,int g,int b) { red=r; green=g; blue=b; }89 void set(int r,int g,int b) { red=r; green=g; blue=b; } 89 90 unsigned char red,green,blue; 90 91 ~quant_node(); -
abuse/trunk/src/imlib/pcxread.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 77 78 int y,run_length,x; 78 79 unsigned char *sl,code; 79 for (y=0; y<im->height();y++)80 for (y=0; y<im->height(); y++) 80 81 { 81 82 sl=im->scan_line(y); 82 for (x=0; x<im->width();)83 for (x=0; x<im->width(); ) 83 84 { 84 85 run_length=1; … … 94 95 fputc(code,fp); 95 96 fputc(sl[x],fp); 96 97 97 98 } 98 99 x+=run_length; -
abuse/trunk/src/imlib/pcxread.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/pmenu.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 39 40 int total=0,tx,tw; 40 41 pmenu_item *p=top; 41 for (; p;p=p->next) total++;42 for (; p; p=p->next) total++; 42 43 43 44 tw=w/(total+1); 44 45 tx=tw/2; 45 46 46 for (p=top; p;p=p->next,tx+=tw)47 for (p=top; p; p=p->next,tx+=tw) 47 48 p->draw_self(bar,itemx(p),1,itemw(p),1,p==active); 48 49 /* } 49 50 else 50 51 { 51 for (p=top; p;p=p->next,tx+=tw)52 for (p=top; p; p=p->next,tx+=tw) 52 53 p->draw(bar,itemx(p),1,itemw(p),1,p==active); 53 54 }*/ … … 119 120 pmenu_item *psub_menu::find_id(int search_id) 120 121 { 121 for (pmenu_item *f=first; f;f=f->next)122 for (pmenu_item *f=first; f; f=f->next) 122 123 { 123 124 pmenu_item *ret=f->find_id(search_id); … … 129 130 pmenu_item *psub_menu::find_key(int key) 130 131 { 131 for (pmenu_item *f=first; f;f=f->next)132 for (pmenu_item *f=first; f; f=f->next) 132 133 { 133 134 pmenu_item *ret=f->find_key(key); … … 165 166 int tw=wm->font()->width(),th=wm->font()->height(); 166 167 w=h=0; 167 for (pmenu_item *p=first; p;p=p->next)168 for (pmenu_item *p=first; p; p=p->next) 168 169 { 169 170 if (p->name()) … … 205 206 int has_flags=0; 206 207 pmenu_item *p=first; 207 for (; p;p=p->next) if (p->on_off) has_flags=1;208 for (; p; p=p->next) if (p->on_off) has_flags=1; 208 209 x=has_flags ? 3+wm->font()->width() : 3; 209 210 y=3; 210 211 211 for (p=first; p;p=p->next,i++,y+=wm->font()->height()+1)212 for (p=first; p; p=p->next,i++,y+=wm->font()->height()+1) 212 213 p->draw(win,x,y,w-6,0,i==active); 213 214 … … 232 233 { 233 234 parent->screen->bar(bx,y,x+w-1,y+wm->font()->height()+1,wm->dark_color()); 234 wm->font()->put_string(parent->screen,x+1,y+1,n,wm->medium_color()); 235 wm->font()->put_string(parent->screen,x+1,y+1,n,wm->medium_color()); 235 236 if (on_off && *on_off) wm->font()->put_string(parent->screen,bx+1,y+1,"*",wm->medium_color()); 236 237 } … … 288 289 289 290 int total=0,tw,i=0,x=0; 290 for (pmenu_item *pp=top; pp;pp=pp->next,i++)291 for (pmenu_item *pp=top; pp; pp=pp->next,i++) 291 292 { if (pp==p) x=i; 292 293 total++; … … 316 317 317 318 int has_flags=0,dx=3; 318 for (pmenu_item *p=first; p;p=p->next) if (p->on_off) has_flags=1;319 for (pmenu_item *p=first; p; p=p->next) if (p->on_off) has_flags=1; 319 320 if (has_flags) dx+=wm->font()->width(); 320 321 … … 378 379 else 379 380 { 380 for (pmenu_item *p=top; p;p=p->next)381 for (pmenu_item *p=top; p; p=p->next) 381 382 { 382 383 if (!p->next) return p; … … 390 391 { 391 392 if (win && ev.window==win) return 1; else 392 for (pmenu_item *p=first; p;p=p->next)393 for (pmenu_item *p=first; p; p=p->next) 393 394 if (p->own_event(ev)) 394 395 return 1; … … 415 416 else 416 417 { 417 for (pmenu_item *p=top; p && !yes;p=p->next) // event in submenu?418 for (pmenu_item *p=top; p && !yes; p=p->next) // event in submenu? 418 419 if (p->own_event(ev)) yes=1; 419 420 } … … 425 426 case EV_KEY : 426 427 { 427 for (pmenu_item *p=top; p;p=p->next)428 for (pmenu_item *p=top; p; p=p->next) 428 429 { 429 430 pmenu_item *r=p->find_key(ev.key); -
abuse/trunk/src/imlib/pmenu.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/readwav.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/readwav.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/scroller.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 60 61 61 62 screen->lock(); 62 for (int yc=ich; yc;yc--,y++)63 for (int yc=ich; yc; yc--,y++) 63 64 { 64 65 if (y>=cy1 && y<=cy2) 65 66 { 66 67 uint8_t *sl=screen->scan_line(y)+x; 67 for (int xc=icw,xo=x; xc;xc--,xo++,sl++,buf++)68 for (int xc=icw,xo=x; xc; xc--,xo++,sl++,buf++) 68 69 { 69 70 if (xo>=cx1 && xo<=cx2) … … 183 184 { 184 185 if (ev.mouse_button && drag==-1) 185 { 186 { 186 187 if (mx>=b1x() && mx<b1x()+bw() && my>=b1y()-2 && my<b1y()+bh()) 187 188 { … … 201 202 draw_widget(screen,0); 202 203 scroll_event(sx,screen); 203 } 204 } 204 205 } 205 206 else … … 215 216 drag=sx; 216 217 inm->grab_focus(this); 217 } 218 } 218 219 else if (t>1) 219 220 { … … 224 225 sx=nx; 225 226 draw_widget(screen,0); 226 scroll_event(sx,screen); 227 } 227 scroll_event(sx,screen); 228 } 228 229 } 229 230 } else handle_inside_event(ev,screen,inm); … … 286 287 sx++; 287 288 draw_widget(screen,0); 288 scroll_event(sx,screen); 289 scroll_event(sx,screen); 289 290 } 290 291 } … … 297 298 sx--; 298 299 draw_widget(screen,0); 299 scroll_event(sx,screen); 300 scroll_event(sx,screen); 300 301 } 301 302 } … … 308 309 sx--; 309 310 draw_widget(screen,0); 310 scroll_event(sx,screen); 311 scroll_event(sx,screen); 311 312 } 312 313 } … … 319 320 sx++; 320 321 draw_widget(screen,0); 321 scroll_event(sx,screen); 322 scroll_event(sx,screen); 322 323 } 323 324 } … … 332 333 sx=x; 333 334 draw_widget(screen,0); 334 scroll_event(sx,screen); 335 scroll_event(sx,screen); 335 336 } 336 337 } … … 363 364 int xa,ya,xo=0,yo; 364 365 if (vert) { xa=0; ya=30; yo=x+5; yo=y+5; } else { xa=30; ya=0; xo=x+5; yo=y+5; } 365 for (int i=newx,c=0; c<30 && i<100;i++,c++)366 for (int i=newx,c=0; c<30 && i<100; i++,c++) 366 367 { 367 368 char st[10]; … … 396 397 lis=(pick_list_item *)malloc(sizeof(pick_list_item)*num_entries); 397 398 int i=0; 398 for (; i<num_entries;i++)399 for (; i<num_entries; i++) 399 400 { 400 401 lis[i].name=List[i]; … … 403 404 qsort((void *)lis,num_entries,sizeof(pick_list_item),lis_sort); 404 405 405 for (i=0; i<t;i++)406 for (i=0; i<t; i++) 406 407 if ((int)strlen(List[i])>wid) 407 408 wid=strlen(List[i]); … … 441 442 key_hist[(int)(key_hist_total++)]=ev.key; 442 443 443 for (int i=0; i<t && found==-1;i++)444 for (int i=0; i<t && found==-1; i++) 444 445 { 445 446 if ((int)strlen(lis[i].name)>=key_hist_total && memcmp(lis[i].name,key_hist,key_hist_total)==0) … … 466 467 draw_widget(screen,0); 467 468 } 468 scroll_event(sx,screen); 469 scroll_event(sx,screen); 469 470 } 470 471 … … 480 481 draw_widget(screen,0); 481 482 } 482 scroll_event(sx,screen); 483 scroll_event(sx,screen); 483 484 } 484 485 … … 494 495 int th=(h+tex->height()-1)/tex->height(); 495 496 int dy=y; 496 for (int j=0; j<th;j++,dy+=tex->height())497 for (int i=0,dx=x; i<tw;i++,dx+=tex->width())497 for (int j=0; j<th; j++,dy+=tex->height()) 498 for (int i=0,dx=x; i<tw; i++,dx+=tex->width()) 498 499 tex->put_image(screen,dx,dy); 499 500 … … 502 503 503 504 int dy=y; 504 for (int i=0; i<th;i++,dy+=wm->font()->height()+1)505 for (int i=0; i<th; i++,dy+=wm->font()->height()+1) 505 506 { 506 507 if (i+newx==cur_sel) … … 548 549 if (m) 549 550 { 550 for (int i=0; i<t;i++)551 for (int i=0; i<t; i++) 551 552 if (get_select(i)) return i; 552 553 return -1; … … 609 610 draw_background(screen); 610 611 611 for (int i=newx; i<newx+vis();i++)612 for (int i=newx; i<newx+vis(); i++) 612 613 { 613 614 if (i<t) … … 657 658 { 658 659 if (m) 659 { 660 { 660 661 if (ev.mouse_button) 661 662 { … … 670 671 } else if (ok_to_select(me)) 671 672 { 672 if (cur_sel==me) 673 if (cur_sel==me) 673 674 note_selection(screen,inm,me); 674 675 else -
abuse/trunk/src/imlib/scroller.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 45 46 46 47 virtual int activate_on_mouse_move() { return 1; } 47 virtual void handle_inside_event(event &ev, image *screen, InputManager *inm) { ;}48 virtual void handle_inside_event(event &ev, image *screen, InputManager *inm) { ; } 48 49 virtual void scroll_event(int newx, image *screen); 49 50 virtual void handle_up(image *screen, InputManager *inm); -
abuse/trunk/src/imlib/specs.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 76 77 free( spec_prefix ); 77 78 } 78 79 79 80 if( prefix ) 80 81 { … … 396 397 { 397 398 int wr=0; 398 for (char const *s=mode; *s;s++)399 for (char const *s=mode; *s; s++) 399 400 if (toupper(*s)=='A' || toupper(*s)=='W') 400 401 wr=1; … … 428 429 flags=access=0; 429 430 char const *s=access_string; 430 for (; *s;s++)431 for (; *s; s++) 431 432 if (toupper(*s)=='R') access=O_RDONLY; 432 433 433 for (s=access_string; *s;s++)434 for (s=access_string; *s; s++) 434 435 if (toupper(*s)=='W') 435 436 { … … 439 440 } 440 441 441 for (s=access_string; *s;s++)442 for (s=access_string; *s; s++) 442 443 if (toupper(*s)=='A') 443 444 access|=O_APPEND|O_WRONLY; … … 489 490 if (current_offset+start_offset != spec_main_offset) 490 491 spec_main_offset = lseek(fd, start_offset+current_offset, SEEK_SET); 491 492 492 493 len = ::read(fd,(char*)buf,count); 493 494 break; … … 495 496 if (current_offset+start_offset != spec_main_offset) 496 497 spec_main_offset = lseek(fd, start_offset+current_offset, SEEK_SET); 497 498 498 499 len = ::read(fd,(char*)buf,count); 499 500 ::write(fast_load_fd,(char*)&len,sizeof(len)); … … 505 506 break; 506 507 } 507 508 508 509 spec_main_offset += len; 509 510 } … … 663 664 if (total) 664 665 { 665 for (i=0,e=entries; i<total;i++,e++) // calculate the size of directory info666 for (i=0,e=entries; i<total; i++,e++) // calculate the size of directory info 666 667 { 667 668 o+=1+1+strlen((*e)->name)+1 +1 +8; 668 669 } 669 670 670 for (i=0,e=entries; i<total;i++,e++) // calculate offset for each entry671 for (i=0,e=entries; i<total; i++,e++) // calculate offset for each entry 671 672 { 672 673 (*e)->offset=o; … … 680 681 int i; 681 682 spec_entry **e; 682 for (i=0,e=entries; i<total;i++,e++)683 for (i=0,e=entries; i<total; i++,e++) 683 684 if (!strcmp((*e)->name,name) && (*e)->type==type) 684 685 return (*e); … … 690 691 int i; 691 692 spec_entry **e; 692 for (i=0,e=entries; i<total;i++,e++)693 for (i=0,e=entries; i<total; i++,e++) 693 694 if (!strcmp((*e)->name,name)) 694 695 return (*e); … … 700 701 int i; 701 702 spec_entry **e; 702 for (i=0,e=entries; i<total;i++,e++)703 for (i=0,e=entries; i<total; i++,e++) 703 704 if (!strcmp((*e)->name,name)) 704 705 return i; … … 710 711 int i; 711 712 spec_entry **e; 712 for (i=0,e=entries; i<total;i++,e++)713 for (i=0,e=entries; i<total; i++,e++) 713 714 if ((*e)->type==type) 714 715 return (*e); … … 720 721 int i,x=0; 721 722 spec_entry **e; 722 for (i=0,e=entries; i<total;i++,e++)723 for (i=0,e=entries; i<total; i++,e++) 723 724 if ((*e)->type==type) x++; 724 725 return x; … … 729 730 int i; 730 731 spec_entry **e; 731 for (i=0,e=entries; i<total;i++,e++)732 for (i=0,e=entries; i<total; i++,e++) 732 733 if ((*e)->type==type) 733 734 return i; … … 740 741 int i; 741 742 printf("[ Entry type ][ Entry name ][ Size ][ Offset ]\n"); 742 for (i=0,se=entries; i<total;i++,se++)743 for (i=0,se=entries; i<total; i++,se++) 743 744 (*se)->print(); 744 745 } … … 759 760 760 761 int i; 761 for (i=0; i<total;i++)762 for (i=0; i<total; i++) 762 763 { 763 764 fp->read(buf,2); … … 772 773 char *dp=(char *)data; 773 774 fp->seek(start,SEEK_SET); 774 for (i=0; i<total;i++)775 for (i=0; i<total; i++) 775 776 { 776 777 spec_entry *se=(spec_entry *)dp; … … 858 859 spec_entry **e; 859 860 long i; 860 for (i=total-1,e=entries; i>=0;i--,e++)861 for (i=total-1,e=entries; i>=0; i--,e++) 861 862 return (*e)->offset+(*e)->size; 862 863 … … 878 879 879 880 int i; 880 for (i=0,e=entries; i<total;i++,e++)881 for (i=0,e=entries; i<total; i++,e++) 881 882 { 882 883 if (fp->write(&(*e)->type,1)!=1) return 0; … … 965 966 { 966 967 int i; 967 for (i=0; i<total && entries[i]!=e;i++); // find the entry in the array first968 for (i=0; i<total && entries[i]!=e; i++); // find the entry in the array first 968 969 969 970 if (entries[i]==e) // make sre it was found … … 971 972 delete e; 972 973 total--; 973 for (; i<total;i++) // compact the pointer array974 for (; i<total; i++) // compact the pointer array 974 975 entries[i]=entries[i+1]; 975 976 entries=(spec_entry **)realloc(entries,sizeof(spec_entry *)*total); … … 991 992 { 992 993 int i; 993 for (i=0; i<total;i++)994 for (i=0; i<total; i++) 994 995 delete entries[i]; 995 996 -
abuse/trunk/src/imlib/specs.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 177 178 void *data; 178 179 long size; 179 // spec_directory(char *filename); ; ; not allowed anymore, user must construct file first!180 // spec_directory(char *filename); ; ; not allowed anymore, user must construct file first! 180 181 spec_directory(FILE *fp); 181 182 spec_directory(bFILE *fp); … … 203 204 char *data_name, 204 205 unsigned long data_size, 205 char *link_filename=NULL); */206 char *link_filename=NULL); */ 206 207 207 208 uint16_t read_uint16(FILE *fp); -
abuse/trunk/src/imlib/sprite.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 49 50 50 51 void sprite_controller::remove_sprites() 51 { sprite *sp; loopt(sprite,sp,sprites.first(),sp->restore_background(); ); }52 { sprite *sp; loopt(sprite,sp,sprites.first(),sp->restore_background(); ); } 52 53 53 54 void sprite_controller::put_sprites() 54 { sprite *sp; loopt(sprite,sp,sprites.first(),sp->draw(); ); }55 { sprite *sp; loopt(sprite,sp,sprites.first(),sp->draw(); ); } 55 56 56 57 void sprite_controller::get_backgrounds() 57 { sprite *sp; loopt(sprite,sp,sprites.first(),sp->get_background(); ); }58 { sprite *sp; loopt(sprite,sp,sprites.first(),sp->get_background(); ); } 58 59 59 60 void sprite::change_visual(image *Visual, int delete_old) -
abuse/trunk/src/imlib/sprite.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/status.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 59 60 int t=percentage*40/100; 60 61 int i=0; 61 for (; i<t;i++)62 for (; i<t; i++) 62 63 s[len+i] = '.'; 63 for (; i<40;i++)64 for (; i<40; i++) 64 65 s[len+i] = ' '; 65 66 s[len+i++] = ']'; -
abuse/trunk/src/imlib/status.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 21 22 virtual void pop() = 0; 22 23 virtual void force_display() { ; } 23 virtual ~status_manager() { }24 virtual ~status_manager() { } 24 25 } ; 25 26 -
abuse/trunk/src/imlib/supmorph.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 39 40 40 41 dp=hint1->t_data(); 41 for (y=0; y<h1;y++)42 for (y=0; y<h1; y++) 42 43 { 43 44 x=0; … … 56 57 // hint2 image2 57 58 dp=hint2->t_data(); 58 for (y=0; y<h2;y++)59 for (y=0; y<h2; y++) 59 60 { 60 61 x=0; … … 78 79 unsigned char hint_color[256],total_hints=0; 79 80 80 for (y=0; y<256;y++,h1p++,h2p++)81 for (y=0; y<256; y++,h1p++,h2p++) 81 82 if (*h1p) 82 83 { … … 100 101 /**************** Now scan the images again setup hints *********************/ 101 102 dp=hint1->t_data(); 102 for (y=0; y<h1;y++)103 for (y=0; y<h1; y++) 103 104 { 104 105 x=0; … … 122 123 123 124 dp=hint2->t_data(); 124 for (y=0; y<h2;y++)125 for (y=0; y<h2; y++) 125 126 { 126 127 x=0; … … 144 145 145 146 /********* if hint sizes don't match duplicate the smaller until sizes are equal **********/ 146 for (start=0,x=0; x<total_hints;x++)147 for (start=0,x=0; x<total_hints; x++) 147 148 { 148 149 y=hint_color[x]; 149 150 int dups; 150 for (dp=movers+start1[y]*4,dups=totals[y]-hints1[y]; dups;dups--)151 for (dp=movers+start1[y]*4,dups=totals[y]-hints1[y]; dups; dups--) 151 152 { 152 153 *dp=*(dp-4); dp++; // copy previous x,y position 153 154 *dp=*(dp-4); dp++; 154 dp+=2; 155 dp+=2; 155 156 } 156 157 start1[y]-=2*totals[y]-hints1[y]; // set the start back to the begining of hint range 157 158 } 158 159 159 for (start=0,x=0; x<total_hints;x++)160 for (start=0,x=0; x<total_hints; x++) 160 161 { 161 162 y=hint_color[x]; 162 163 int dups; 163 for (dp=movers+start2[y]*4+2,dups=totals[y]-hints2[y]; dups;dups--)164 for (dp=movers+start2[y]*4+2,dups=totals[y]-hints2[y]; dups; dups--) 164 165 { 165 166 *dp=*(dp-4); dp++; // copy previous x,y position 166 167 *dp=*(dp-4); dp++; 167 dp+=2; 168 dp+=2; 168 169 } 169 170 start2[y]-=hints2[y]; // set the start back to the begining of hint range … … 173 174 /******* Now apply simulated annealing to solve for a smaller total distance ********/ 174 175 int rand_on=0; 175 for (y=0; y<aneal_steps;y++)176 for (y=0; y<aneal_steps; y++) 176 177 { 177 178 if (stat_fun) 178 179 stat_fun(y); 179 180 dp=movers; 180 for (x=0; x<total_hints;x++)181 for (x=0; x<total_hints; x++) 181 182 { 182 183 int hc=hint_color[x]; 183 184 int a,z=totals[hc]; 184 185 unsigned char *range_start=dp; 185 for (a=0; a<z;a++,dp+=4)186 for (a=0; a<z; a++,dp+=4) 186 187 { 187 188 unsigned char *swap=range_start+(rtable[((rand_on++)&(RAND_TABLE_SIZE-1))]%z)*4; … … 210 211 w=m->w; h=m->h; 211 212 212 for (i=0; i<t;i++,p++)213 for (i=0; i<t; i++,p++) 213 214 { 214 215 x1=*(d++); … … 266 267 memset(hole,0,w*h); 267 268 unsigned char *paddr=(unsigned char *)pal->addr(); 268 for (ss=steps,i=0; i<t;i++,ss++)269 for (ss=steps,i=0; i<t; i++,ss++) 269 270 { 270 271 ix=(ss->x>>(16)); … … 289 290 290 291 unsigned char *ll=hole+1,*tl=hole+w+1,*nl=hole+w*2+1; 291 for (iy=1; iy<h-1;iy++) // now scan the for holes to fill292 { 293 for (ix=1; ix<w-1;ix++,ll++,tl++,nl++)292 for (iy=1; iy<h-1; iy++) // now scan the for holes to fill 293 { 294 for (ix=1; ix<w-1; ix++,ll++,tl++,nl++) 294 295 { 295 296 if (x+ix>=x1 && x+ix<=x2 && y+iy>=y1 && y+iy<=y2) … … 301 302 if (*(tl+1)) t++; 302 303 if (*ll) t++; 303 if (*nl) t++; */304 if (*nl) t++; */ 304 305 305 306 if (*(tl-1)) { t++; pa=paddr+(*(tl-1))*3; r+=*(pa++); g+=*(pa++); b+=*(pa++); } 306 307 if (*(tl+1)) { t++; pa=paddr+(*(tl+1))*3; r+=*(pa++); g+=*(pa++); b+=*(pa++); } 307 308 if (*(ll)) { t++; pa=paddr+(*ll)*3; r+=*(pa++); g+=*(pa++); b+=*(pa++); } 308 if (*(nl)) { t++; pa=paddr+(*nl)*3; r+=*(pa++); g+=*(pa++); b+=*(pa++); } 309 if (*(nl)) { t++; pa=paddr+(*nl)*3; r+=*(pa++); g+=*(pa++); b+=*(pa++); } 309 310 310 311 if (*tl) -
abuse/trunk/src/imlib/supmorph.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/system.h
r97 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 21 22 ((( ((uint32_t)(x)) )&0x0000ff00)<<8)|(( ((uint32_t)(x)) )<<24)) 22 23 23 #if SDL_BYTEORDER == SDL_BIG_ENDIAN 24 #if SDL_BYTEORDER == SDL_BIG_ENDIAN 24 25 #define LONG int32_t 25 26 #define uint16_to_intel(x) uint16_swap(x) -
abuse/trunk/src/imlib/timage.cpp
r490 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 16 17 uint8_t *dp=data; 17 18 int y,x; 18 for (y=0; y<h;y++)19 for (y=0; y<h; y++) 19 20 { 20 21 x=0; … … 40 41 uint8_t *d=im->scan_line(0),*dp=data,*dline; 41 42 int y,x; 42 for (y=0; y<h;y++)43 for (y=0; y<h; y++) 43 44 { 44 45 x=0; … … 75 76 76 77 // first we must find out how much data to allocate 77 for (y=0; y<im->height();y++)78 for (y=0; y<im->height(); y++) 78 79 { 79 80 sl=im->scan_line(y); … … 104 105 CONDITION(datap,"malloc error for trans_image::data"); 105 106 106 for (y=0; y<hh;y++) // now actually make the runs107 for (y=0; y<hh; y++) // now actually make the runs 107 108 { 108 109 sl=im->scan_line(y); … … 145 146 while (line) // skip scan line data until we get to the line of interest 146 147 { 147 for (ix=0; ix<w;)148 for (ix=0; ix<w; ) 148 149 { 149 150 ix+=*datap; // skip blank space … … 165 166 uint8_t *screen_line=screen->scan_line(y)+x; 166 167 167 for (ix=0; ix<w;)168 for (ix=0; ix<w; ) 168 169 { 169 170 int skip=*datap; // how much space to skip? … … 275 276 int sw=screen->width()-w; 276 277 x1-=x; x2-=x; 277 for (; ysteps>0;ysteps--)278 for (; ysteps>0; ysteps--) 278 279 { 279 280 int ix,slam_length; 280 for (ix=0; ix<w;)281 for (ix=0; ix<w; ) 281 282 { 282 283 int blank=(*datap); … … 343 344 screen->lock(); 344 345 screen_skip = screen->width() - w; 345 for (; ysteps;ysteps--)346 { 347 for (ix=0; ix<w;)346 for (; ysteps; ysteps--) 347 { 348 for (ix=0; ix<w; ) 348 349 { 349 350 skip=*datap; // skip leading blank space … … 387 388 int sw=screen->width(); 388 389 x1-=x; x2-=x; 389 for (; ysteps>0;ysteps--)390 for (; ysteps>0; ysteps--) 390 391 { 391 392 int ix,slam_length; 392 for (ix=0; ix<w;)393 for (ix=0; ix<w; ) 393 394 { 394 395 ix+=(*datap); // skip over empty space … … 452 453 int sw=screen->width(); 453 454 x1-=x; x2-=x; 454 for (; ysteps>0;ysteps--)455 for (; ysteps>0; ysteps--) 455 456 { 456 457 int ix,slam_length; 457 for (ix=0; ix<w;)458 for (ix=0; ix<w; ) 458 459 { 459 460 ix+=(*datap); // skip over empty space … … 530 531 int sw=screen->width(); 531 532 x1-=x; x2-=x; 532 for (; ysteps>0;ysteps--)533 for (; ysteps>0; ysteps--) 533 534 { 534 535 int ix,slam_length; 535 for (ix=0; ix<w;)536 for (ix=0; ix<w; ) 536 537 { 537 538 ix+=(*datap); // skip over empty space … … 612 613 long fixmul=(frame_on<<16)/total_frames; 613 614 screen->lock(); 614 for (; ysteps>0;ysteps--,y++)615 for (; ysteps>0; ysteps--,y++) 615 616 { 616 617 screen_line=screen->scan_line(y); 617 618 618 for (ix=0; ix<w;)619 for (ix=0; ix<w; ) 619 620 { 620 621 ix+=(*datap); // skip over empty space … … 706 707 707 708 long fixmul=(frame_on<<16)/total_frames; 708 for (; ysteps>0;ysteps--,y++)709 for (; ysteps>0; ysteps--,y++) 709 710 { 710 711 screen_line=screen->scan_line(y); 711 712 712 for (ix=0; ix<w;)713 for (ix=0; ix<w; ) 713 714 { 714 715 ix+=(*datap); // skip over empty space … … 790 791 791 792 screen->lock(); 792 for (; ysteps>0;ysteps--,y++)793 for (; ysteps>0; ysteps--,y++) 793 794 { 794 795 screen_line=screen->scan_line(y); 795 796 796 for (ix=0; ix<w;)797 for (ix=0; ix<w; ) 797 798 { 798 799 ix+=(*datap); // skip over empty space … … 861 862 862 863 screen->lock(); 863 for (; ysteps>0;ysteps--,y++)864 for (; ysteps>0; ysteps--,y++) 864 865 { 865 866 screen_line=screen->scan_line(y); … … 867 868 868 869 869 for (ix=0; ix<w;)870 for (ix=0; ix<w; ) 870 871 { 871 872 ix+=(*datap); // skip over empty space … … 959 960 else if (y+ysteps==y2-1) ysteps--; 960 961 /* { 961 for (int x=0; x<w;)962 for (int x=0; x<w; ) 962 963 { 963 964 int skip=*datap; datap++; … … 980 981 int sw=screen->width(); 981 982 x1-=x; x2-=x; 982 for (; ysteps>0;ysteps--)983 for (; ysteps>0; ysteps--) 983 984 { 984 985 int ix,slam_length; 985 for (ix=0; ix<w;)986 for (ix=0; ix<w; ) 986 987 { 987 988 ix+=(*datap); // skip over empty space … … 1036 1037 uint8_t *d=data; 1037 1038 int t=0; 1038 for (int y=0; y<h;y++)1039 for (int y=0; y<h; y++) 1039 1040 { 1040 1041 int x=0; -
abuse/trunk/src/imlib/timage.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/timing.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/tools.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 17 18 { delete old_pal; 18 19 delete map; 19 for (int i=0; i<total_icons;i++)20 for (int i=0; i<total_icons; i++) 20 21 delete icons[i]; // delete visual object, which should be a "shell" 21 22 } … … 37 38 ids=Ids; 38 39 total_icons=total_ic; 39 for (int i=0; i<total_ic;i++)40 for (int i=0; i<total_ic; i++) 40 41 { 41 42 if (icons[i]->width()>iw) iw=icons[i]->width(); -
abuse/trunk/src/imlib/tools.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/video.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public -
abuse/trunk/src/imlib/visobj.cpp
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 39 40 int fw=wm->font()->width(),fh=wm->font()->height(),maxw=0; 40 41 char *info=st; 41 for (w=fw,h=fh+1; *info;info++)42 for (w=fw,h=fh+1; *info; info++) 42 43 { 43 44 if (w>maxw) maxw=w; -
abuse/trunk/src/imlib/visobj.h
r481 r494 2 2 * Abuse - dark 2D side-scrolling platform game 3 3 * Copyright (c) 1995 Crack dot Com 4 * Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net> 4 5 * 5 6 * This software was released into the Public Domain. As with most public … … 20 21 virtual int width() = 0; 21 22 virtual int height() = 0; 22 virtual ~visual_object() { }23 virtual ~visual_object() { } 23 24 } ; 24 25
Note: See TracChangeset
for help on using the changeset viewer.