Changeset 494 for abuse/trunk
- Timestamp:
- Apr 17, 2011, 11:56:44 PM (12 years ago)
- Location:
- abuse/trunk/src
- Files:
-
- 217 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/src/ability.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 / elcontrol / 0, 0, 0, 0, 0, 0, 0, 0, 0, 27 28 / no type / 0, 0, 0, 0, 0, 0, 0, 0, 0 28 } ; */29 } ; */ 29 30 30 31 … … 41 42 42 43 long abil_def[TOTAL_ABILITIES]= 43 { 6, 3, 4, 2, -16, 10, 6, 0,44 { 6, 3, 4, 2, -16, 10, 6, 0, 44 45 /* hp starta stopa jumpxv jumpyv run_tops jmp_tops blood_type */ 45 46 -
abuse/trunk/src/ability.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/ant.cpp
r493 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 … … 51 52 static int ant_congestion(game_object *o) 52 53 { 53 for (game_object *d=current_level->first_active_object(); d;d=d->next_active)54 for (game_object *d=current_level->first_active_object(); d; d=d->next_active) 54 55 { 55 56 if (d->otype==o->otype && abs(o->x-d->x)<30 && abs(o->x-d->y)<20) return 1; … … 409 410 o->x+=speed; 410 411 if (!o->next_picture()) o->set_state((character_state)S_top_walk); 411 412 412 413 } else o->set_aistate(ANT_FALL_DOWN); 413 414 } -
abuse/trunk/src/ant.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/automap.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 … … 103 104 104 105 screen->set_clip(window_xstart,window_ystart,window_xend,window_yend); 105 /* for (i=draw_xstart,j=draw_ystart,x=sx,y=sy; y<=ey;j+=AUTOTILE_HEIGHT,y++)106 /* for (i=draw_xstart,j=draw_ystart,x=sx,y=sy; y<=ey; j+=AUTOTILE_HEIGHT,y++) 106 107 foretiles[cur_lev->get_fg(x,y)]->micro_image->put_image(screen,i,j,0); 107 108 108 for (i=draw_xstart+ex*AUTOTILE_WIDTH,j=draw_ystart,y=sy,x=ex; y<=ey;j+=AUTOTILE_HEIGHT,y++)109 for (i=draw_xstart+ex*AUTOTILE_WIDTH,j=draw_ystart,y=sy,x=ex; y<=ey; j+=AUTOTILE_HEIGHT,y++) 109 110 foretiles[cur_lev->get_fg(x,y)]->micro_image->put_image(screen,i,j,0); 110 111 111 for (i=draw_xstart,j=draw_ystart,x=sx,y=sy; x<=ex;i+=AUTOTILE_WIDTH,x++)112 for (i=draw_xstart,j=draw_ystart,x=sx,y=sy; x<=ex; i+=AUTOTILE_WIDTH,x++) 112 113 foretiles[cur_lev->get_fg(x,y)]->micro_image->put_image(screen,i,j,0); 113 114 114 for (i=draw_xstart,j=draw_ystart+ey*AUTOTILE_HEIGHT,x=sx,y=ex; x<=ex;i+=AUTOTILE_WIDTH,x++)115 for (i=draw_xstart,j=draw_ystart+ey*AUTOTILE_HEIGHT,x=sx,y=ex; x<=ex; i+=AUTOTILE_WIDTH,x++) 115 116 foretiles[cur_lev->get_fg(x,y)]->micro_image->put_image(screen,i,j,0); */ 116 117 … … 118 119 119 120 unsigned short *fgline; 120 for (j=draw_ystart,y=sy; y<=ey;j+=AUTOTILE_HEIGHT,y++)121 for (j=draw_ystart,y=sy; y<=ey; j+=AUTOTILE_HEIGHT,y++) 121 122 { 122 123 fgline=cur_lev->get_fgline(y)+sx; 123 for (i=draw_xstart,x=sx; x<=ex;i+=AUTOTILE_WIDTH,x++,fgline++)124 for (i=draw_xstart,x=sx; x<=ex; i+=AUTOTILE_WIDTH,x++,fgline++) 124 125 { 125 126 if ((*fgline)&0x8000) … … 199 200 switch(ev.key) 200 201 { 201 case 'A' : 202 case 'A' : 202 203 case 'a' : 203 204 toggle_window(); 204 break; 205 } 206 break; 205 break; 206 } 207 break; 207 208 case EV_CLOSE_WINDOW : 208 209 wm->close_window(automap_window); 209 210 automap_window=NULL; 210 break; 211 } 212 } 213 } 214 215 216 217 218 219 220 211 break; 212 } 213 } 214 } 215 216 217 218 219 220 221 -
abuse/trunk/src/automap.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/bus_type.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/cache.cpp
r493 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 … … 54 55 55 56 int i,total=0; 56 for (i=0; i<total_files;i++)57 for (i=0; i<total_files; i++) 57 58 { 58 59 int failed=0; … … 82 83 fp->write_uint16(total); 83 84 total=0; 84 for (i=0; i<total_files;i++)85 for (i=0; i<total_files; i++) 85 86 { 86 87 uint32_t crc; … … 111 112 short total=fp->read_uint16(); 112 113 int i; 113 for (i=0; i<total;i++)114 for (i=0; i<total; i++) 114 115 { 115 116 char name[256]; … … 126 127 void CrcManager::clean_up() 127 128 { 128 for (int i=0; i<total_files;i++)129 for (int i=0; i<total_files; i++) 129 130 delete files[i]; 130 131 if (total_files) … … 153 154 int CrcManager::get_filenumber(char const *filename) 154 155 { 155 for (int i=0; i<total_files;i++)156 for (int i=0; i<total_files; i++) 156 157 if (!strcmp(filename,files[i]->filename)) return i; 157 158 total_files++; … … 237 238 size+=2; // total filenames 238 239 int i; 239 for (i=0; i<crc_manager.total_filenames();i++)240 for (i=0; i<crc_manager.total_filenames(); i++) 240 241 size+=strlen(crc_manager.get_filename(i))+2; // filename + 0 + size of string 241 242 242 243 size+=4; // number of entries saved 243 244 244 for (i=0; i<total;i++)245 for (i=0; i<total; i++) 245 246 if (list[i].last_access>0) // don't save unaccessed counts 246 247 size+=2+4+1; // filenumber & offset & type … … 256 257 int *ordered_ids=(int *)malloc(sizeof(int)*total); 257 258 int i; 258 for (i=0; i<total;i++) ordered_ids[i]=i;259 for (i=0; i<total; i++) ordered_ids[i]=i; 259 260 qsort(ordered_ids,total,sizeof(int),c_sorter); 260 261 … … 262 263 { 263 264 fp->write_uint16(crc_manager.total_filenames()); 264 for (i=0; i<crc_manager.total_filenames();i++)265 for (i=0; i<crc_manager.total_filenames(); i++) 265 266 { 266 267 int l=strlen(crc_manager.get_filename(i))+1; … … 270 271 271 272 int tsaved=0; 272 for (i=0; i<total;i++)273 for (i=0; i<total; i++) 273 274 if (list[i].last_access>0) tsaved++; 274 275 fp->write_uint32(tsaved); 275 276 276 for (i=0; i<total;i++)277 for (i=0; i<total; i++) 277 278 { 278 279 int id=ordered_ids[i]; … … 348 349 { 349 350 int i; 350 for (i=0; i<total_objects;i++)351 for (i=0; i<total_objects; i++) 351 352 { 352 353 if (figures[i]->get_cflag(CFLAG_NEED_CACHE_IN)) … … 428 429 game_object *f; 429 430 int i; 430 for (i=0; i<total_objects;i++) // mark all types as not needing loading431 for (i=0; i<total_objects; i++) // mark all types as not needing loading 431 432 figures[i]->set_cflag(CFLAG_NEED_CACHE_IN,0); 432 433 433 for (f=lev->first_object(); f;f=f->next) // go through each object and get requested items to cache in434 for (f=lev->first_object(); f; f=f->next) // go through each object and get requested items to cache in 434 435 preload_cache_object(f->otype); 435 436 … … 437 438 int j; 438 439 uint16_t *fg_line; 439 for (j=0; j<lev->foreground_height();j++)440 for (j=0; j<lev->foreground_height(); j++) 440 441 { 441 442 fg_line=lev->get_fgline(j); 442 for (i=0; i<lev->foreground_width();i++,fg_line++)443 for (i=0; i<lev->foreground_width(); i++,fg_line++) 443 444 { 444 445 int id=foretiles[fgvalue(*fg_line)]; … … 453 454 454 455 uint16_t *bg_line; 455 for (j=0; j<lev->background_height();j++)456 for (j=0; j<lev->background_height(); j++) 456 457 { 457 458 bg_line=lev->get_bgline(j); 458 for (i=0; i<lev->background_width();i++,bg_line++)459 for (i=0; i<lev->background_width(); i++,bg_line++) 459 460 { 460 461 int id=backtiles[bgvalue(*bg_line)]; … … 474 475 { 475 476 int j; 476 for (j=0; j<this->total;j++)477 for (j=0; j<this->total; j++) 477 478 if (list[j].last_access>=0) // reset all loaded cache items to 0, all non-load to -1 478 479 list[j].last_access=0; … … 500 501 501 502 int i; 502 for (i=0; i<tnames;i++)503 for (i=0; i<tnames; i++) 503 504 { 504 505 fp->read(name,fp->read_uint8()); … … 506 507 507 508 int j; 508 for (j=0; j<crc_manager.total_filenames();j++)509 for (j=0; j<crc_manager.total_filenames(); j++) 509 510 if (!strcmp(crc_manager.get_filename(j),name)) 510 511 fnum_remap[i]=j; 511 512 } 512 513 513 514 int tsaved = fp->read_uint32(); 514 515 … … 519 520 520 521 sorted_id_list=(int *)malloc(sizeof(int)*total); 521 for (j=0; j<total;j++) sorted_id_list[j]=j;522 for (j=0; j<total; j++) sorted_id_list[j]=j; 522 523 qsort(sorted_id_list,total,sizeof(int),s_offset_compare); 523 524 524 for (i=0; i<tsaved;i++)525 for (i=0; i<tsaved; i++) 525 526 { 526 527 fp->read_uint8(); // read type … … 533 534 534 535 // search for a match 535 j=search(sorted_id_list,file_num,offset); 536 j=search(sorted_id_list,file_num,offset); 536 537 if (j!=-1) 537 { 538 { 538 539 if (list[j].last_access<0) // if not loaded 539 540 list[j].last_access=-2; // mark as needing loading … … 546 547 free(sorted_id_list); // was used for searching, no longer needed 547 548 548 for (j=0; j<total;j++)549 for (j=0; j<total; j++) 549 550 if (list[j].last_access==0) 550 551 unmalloc(list+j); // free any cache entries that are not accessed at all in the level … … 553 554 ful=0; 554 555 int tcached=0; 555 for (j=0; j<total;j++) // now load all of the objects until full556 for (j=0; j<total; j++) // now load all of the objects until full 556 557 { 557 558 // stat_man->update(j*70/total+25); … … 585 586 586 587 last_access=tmatches+1; 587 for (i=0; i<tsaved;i++) // reorder the last access of each cache to reflect prioirties588 for (i=0; i<tsaved; i++) // reorder the last access of each cache to reflect prioirties 588 589 { 589 590 if (priority[i]!=-1) … … 605 606 { 606 607 int j; 607 for (j=0; j<total;j++) // now load all of the objects until full, don't free old stuff608 for (j=0; j<total; j++) // now load all of the objects until full, don't free old stuff 608 609 { 609 610 // stat_man->update(j*70/total+25); … … 646 647 { 647 648 int i=0; 648 for (; i<total;i++)649 for (; i<total; i++) 649 650 { 650 651 if (list[i].last_access>=poll_start_access) … … 742 743 void CacheList::empty() 743 744 { 744 for (int i=0; i<total;i++)745 for (int i=0; i<total; i++) 745 746 { 746 747 if (list[i].file_number>=0 && list[i].last_access!=-1) … … 830 831 int i; 831 832 CacheItem *ci=list; 832 for (i=0,id=-1; i<total && id<0;i++,ci++) // scan list for a free id833 for (i=0,id=-1; i<total && id<0; i++,ci++) // scan list for a free id 833 834 { 834 835 if (ci->file_number<0) … … 840 841 int add_size=20; 841 842 list=(CacheItem *)realloc(list,(sizeof(CacheItem)*(total+add_size))); 842 for (i=0; i<add_size;i++)843 for (i=0; i<add_size; i++) 843 844 { 844 845 list[total+i].file_number=-1; // mark new entries as new … … 873 874 cache_read_file=NULL; 874 875 875 cache_file=new jFILE(lfname,"ab"); 876 cache_file=new jFILE(lfname,"ab"); 876 877 } else cache_file=new jFILE(lfname,"wb"); // first time we opened 877 878 } … … 990 991 if (rm_dups) 991 992 { 992 for (i=0; i<total;i++)993 for (i=0; i<total; i++) 993 994 if (list[i].file_number == fn && (unsigned)list[i].offset == se->offset) 994 995 return i; … … 1009 1010 CacheItem *ci=list; 1010 1011 last_access=-1; 1011 for (j=0; j<total;j++,ci++)1012 for (j=0; j<total; j++,ci++) 1012 1013 { 1013 1014 if (ci->last_access>=0) … … 1229 1230 new_old=NULL; 1230 1231 ci=list; 1231 for (int i=0; i<total;i++,ci++)1232 for (int i=0; i<total; i++,ci++) 1232 1233 { 1233 1234 if (ci->last_access<old && ci->last_access>0 && ci->last_access>new_old_accessed) -
abuse/trunk/src/cache.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/chars.cpp
r493 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 "morph_pose", 47 48 48 49 "walking", 49 50 50 51 51 52 "weapon_draw", … … 150 151 cflags|=1<<CFLAG_CACHED_IN; 151 152 152 for (i=0; i<ts;i++)153 for (i=0; i<ts; i++) 153 154 { 154 155 if (seq[i]) … … 250 251 /* locate a free index in the index list */ 251 252 int free_index=tiv; 252 for (int i=0; i<tiv;i++)253 for (int i=0; i<tiv; i++) 253 254 if (!vars[i] && i<tiv) free_index=i; 254 255 if (free_index==tiv) … … 279 280 { 280 281 int i=0; 281 for (; i<TOTAL_OBJECT_VARS;i++)282 for (; i<TOTAL_OBJECT_VARS; i++) 282 283 { 283 284 if (!strcmp(object_descriptions[i].name,name)) 284 285 return 1; 285 286 } 286 for (i=0; i<tiv;i++)287 for (i=0; i<tiv; i++) 287 288 if (!strcmp(lstring_value(((LSymbol *)vars[i])->GetName()),name)) 288 289 return 1; … … 321 322 draw_rangex=draw_rangey=0; 322 323 323 for (i=0; i<TOTAL_ABILITIES;i++)324 for (i=0; i<TOTAL_ABILITIES; i++) 324 325 abil[i]=get_ability_default((ability)i); 325 326 void *field=args; 326 327 PtrRef r7(field); 327 for (; field;field=CDR(field))328 for (; field; field=CDR(field)) 328 329 { 329 330 void *f=CAR(CAR(field)); … … 334 335 void *l=CDR(CAR(field)); 335 336 PtrRef r4(l); 336 for (i=0; i<TOTAL_ABILITIES;i++)337 for (i=0; i<TOTAL_ABILITIES; i++) 337 338 { 338 339 Cell *ab=assoc(LSymbol::FindOrCreate(ability_names[i]),l); … … 345 346 void *l=CDR(CAR(field)); 346 347 PtrRef r4(l); 347 for (i=0; i<TOTAL_OFUNS;i++)348 for (i=0; i<TOTAL_OFUNS; i++) 348 349 { 349 350 Cell *ab=assoc(LSymbol::FindOrCreate(ofun_names[i]),l); … … 356 357 void *l=CDR(CAR(field)); 357 358 PtrRef r4(l); 358 for (i=0; i<TOTAL_CFLAGS;i++)359 for (i=0; i<TOTAL_CFLAGS; i++) 359 360 { 360 361 Cell *ab=assoc(LSymbol::FindOrCreate(cflag_names[i]),l); … … 502 503 char *name=lstring_value(lcar(lcar(mf))); 503 504 int t=default_simple.total_vars(),find=-1; 504 for (int i=0; find<0 && i<t;i++)505 for (int i=0; find<0 && i<t; i++) 505 506 if (!strcmp(default_simple.var_name(i),name)) 506 507 find=i; … … 510 511 printf("fields : no such var name \"%s\"\n",name); 511 512 printf("current possiblities are : \n"); 512 for (int i=0; i<t;i++) printf("\"%s\" ",default_simple.var_name(i));513 for (int i=0; i<t; i++) printf("\"%s\" ",default_simple.var_name(i)); 513 514 printf("\n"); 514 515 exit(0); … … 551 552 character_type::~character_type() 552 553 { 553 for (int i=0; i<ts;i++)554 for (int i=0; i<ts; i++) 554 555 if (seq[i]) 555 556 delete seq[i]; … … 558 559 if (total_fields) 559 560 { 560 for (int i=0; i<total_fields;i++)561 for (int i=0; i<total_fields; i++) 561 562 delete fields[i]; 562 563 free(fields); -
abuse/trunk/src/chars.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 … … 26 27 dead, 27 28 dieing, 28 stopped, 29 stopped, 29 30 start_run_jump, run_jump, run_jump_fall, end_run_jump, 30 31 flinch_up, flinch_down, -
abuse/trunk/src/chat.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/chat.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/clisp.cpp
r493 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 … … 187 188 188 189 int i; 189 for (i=0; i<MAX_STATE;i++)190 for (i=0; i<MAX_STATE; i++) 190 191 LSymbol::FindOrCreate(state_names[i])->SetNumber(i); 191 for (i=0; i<TOTAL_ABILITIES;i++)192 for (i=0; i<TOTAL_ABILITIES; i++) 192 193 LSymbol::FindOrCreate(ability_names[i])->SetNumber(i); 193 for (i=0; i<TOTAL_CFLAGS;i++)194 for (i=0; i<TOTAL_CFLAGS; i++) 194 195 LSymbol::FindOrCreate(cflag_names[i])->SetNumber(i); 195 196 … … 682 683 game_object *old_cur=current_object; 683 684 void *ret=NULL; 684 for (int i=0; i<old_cur->total_objects();i++)685 { 685 for (int i=0; i<old_cur->total_objects(); i++) 686 { 686 687 current_object=old_cur->get_object(i); 687 688 ret=eval(CAR(args)); … … 716 717 args=CDR(args); 717 718 time_marker start; 718 for (int x=0; x<trials;x++)719 for (int x=0; x<trials; x++) 719 720 { 720 721 clear_tmp(); … … 955 956 956 957 char *s=filename,*tp; 957 958 for (tp=tmp; *s;s++,tp++)958 959 for (tp=tmp; *s; s++,tp++) 959 960 { 960 961 if (*s=='/' || *s=='\\') … … 975 976 { 976 977 PtrRef r1(fl),r2(dl); 977 978 for (i=tfiles-1; i>=0;i--) { push_onto_list(LString::Create(files[i]),fl); free(files[i]); }978 979 for (i=tfiles-1; i>=0; i--) { push_onto_list(LString::Create(files[i]),fl); free(files[i]); } 979 980 free(files); 980 981 981 for (i=tdirs-1; i>=0;i--) { push_onto_list(LString::Create(dirs[i]),dl); free(dirs[i]); }982 for (i=tdirs-1; i>=0; i--) { push_onto_list(LString::Create(dirs[i]),dl); free(dirs[i]); } 982 983 free(dirs); 983 984 984 985 push_onto_list(dl,rl); 985 986 push_onto_list(fl,rl); … … 1009 1010 if (last>=first) 1010 1011 { 1011 for (i=last; i>=first;i--)1012 for (i=last; i>=first; i--) 1012 1013 { 1013 1014 sprintf(name2,"%s%04ld.pcx",name,i); … … 1016 1017 } else 1017 1018 { 1018 for (i=last; i<=first;i++)1019 for (i=last; i<=first; i++) 1019 1020 { 1020 1021 sprintf(name2,"%s%04ld.pcx",name,i); … … 1490 1491 if (!v) dprintf("Can't use reset_player on non-players\n"); 1491 1492 else 1492 v->reset_player(); 1493 v->reset_player(); 1493 1494 } break; 1494 1495 case 153 : … … 1524 1525 if (ang1>ang2) 1525 1526 { 1526 if (ang<ang1 && ang>ang2) 1527 if (ang<ang1 && ang>ang2) 1527 1528 return 0; 1528 else if (ang>=ang1) 1529 else if (ang>=ang1) 1529 1530 f=(ang-ang1)*tframes/(359-ang1+ang2+1); 1530 1531 else … … 1629 1630 int x=current_object->total_objects(); 1630 1631 game_object *who=(game_object *)lpointer_value(CAR(args)); 1631 for (int i=0; i<x;i++)1632 for (int i=0; i<x; i++) 1632 1633 if (current_object->get_object(i)==who) return 1; 1633 1634 return 0; … … 1654 1655 if (x<0 || y<0 || x>=current_level->foreground_width() || y>=current_level->foreground_width()) 1655 1656 lbreak("%d %d is out of range of fg map",x,y); 1656 else 1657 else 1657 1658 current_level->put_fg(x,y,type); 1658 1659 } break; … … 1672 1673 if (x<0 || y<0 || x>=current_level->background_width() || y>=current_level->background_width()) 1673 1674 lbreak("%d %d is out of range of fg map",x,y); 1674 else 1675 else 1675 1676 current_level->put_bg(x,y,type); 1676 1677 } break; … … 1906 1907 int ga=lnumber_value(CAR(args)); args=CDR(args); 1907 1908 int ba=lnumber_value(CAR(args)); 1908 for (int i=0; i<256;i++)1909 for (int i=0; i<256; i++) 1909 1910 { 1910 1911 r=(int)*addr+ra; if (r>255) r=255; else if (r<0) r=0; *addr=(uint8_t)r; addr++; … … 1930 1931 if (x<0 || x>=total_weapons) 1931 1932 { lbreak("weapon out of range (%d)\n",x); exit(0); } 1932 v->current_weapon=x; 1933 v->current_weapon=x; 1933 1934 } 1934 1935 } break; … … 1945 1946 1946 1947 case 233 : 1947 { int x=0; view *v=player_list; for (; v;v=v->next,x++); return x; } break;1948 { int x=0; view *v=player_list; for (; v; v=v->next,x++); return x; } break; 1948 1949 1949 1950 case 234 : … … 2246 2247 { 2247 2248 view *v=player_list; 2248 for (; v;v=v->next)2249 for (; v; v=v->next) 2249 2250 if (v->kills>=main_net_cfg->kills) 2250 2251 return 1; 2251 2252 2252 2253 2253 2254 } else return 0; … … 2256 2257 { 2257 2258 view *v=player_list; 2258 for (; v;v=v->next)2259 for (; v; v=v->next) 2259 2260 { 2260 2261 v->tkills+=v->kills; … … 2267 2268 v->reset_player(); 2268 2269 v->focus->set_aistate(0); 2269 current_object=o; 2270 current_object=o; 2270 2271 } 2271 2272 … … 2323 2324 case L_NUMBER : 2324 2325 { return lnumber_value(v); } break; 2325 default : return def; 2326 default : return def; 2326 2327 } 2327 2328 } else return def; -
abuse/trunk/src/clisp.h
r492 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/collide.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 … … 51 52 { 52 53 collide_patch *next; 53 for (collide_patch *p=first; p;p=next)54 for (collide_patch *p=first; p; p=next) 54 55 { 55 56 next=p->next; … … 161 162 int32_t sx1,sy1,sx2,sy2,tx1,ty1,tx2,ty2,hitx=0,hity=0,t_centerx; 162 163 163 for (int l=0; l<attack_total;l++)164 for (int l=0; l<attack_total; l++) 164 165 { 165 166 subject=attack_list[l]; … … 168 169 169 170 170 for (int j=0; j<target_total && !rec;j++)171 { 172 target=target_list[j]; 171 for (int j=0; j<target_total && !rec; j++) 172 { 173 target=target_list[j]; 173 174 target->picture_space(tx1,ty1,tx2,ty2); 174 175 if (!(sx2<tx1 || sy2<ty1 || sx1>tx2 || sy1>ty2)) // check to see if picture spaces collide … … 181 182 t_centerx=target->x_center(); 182 183 point_list *s_hit,*t_damage; 183 184 184 185 s_hit=subject->current_figure()->hit; 185 186 … … 191 192 unsigned char *s_dat=s_hit->data,*t_dat; 192 193 int i,j; 193 for (i=(int)s_hit->tot-1; i>0 && !rec;i--)194 { 195 for (t_dat=t_damage->data,j=(int)t_damage->tot-1; j>0 && !rec;j--)194 for (i=(int)s_hit->tot-1; i>0 && !rec; i--) 195 { 196 for (t_dat=t_damage->data,j=(int)t_damage->tot-1; j>0 && !rec; j--) 196 197 { 197 198 int32_t x1,y1,x2,y2, // define the two line segments to check 198 199 xp1,yp1,xp2,yp2; 199 200 200 xp1=target->x+target->tx(*t_dat); t_dat++; 201 xp1=target->x+target->tx(*t_dat); t_dat++; 201 202 yp1=target->y+target->ty(*t_dat); t_dat++; 202 203 xp2=target->x+target->tx(*t_dat); … … 207 208 x2=subject->x+subject->tx(s_dat[2]); 208 209 y2=subject->y+subject->ty(s_dat[3]); 209 210 210 211 211 212 // ok, now we know which line segemnts to check for intersection 212 213 // now check to see if (x1,y1-x2,y2) intercest with (xp1,yp1-xp2,yp2) 213 int32_t _x2=x2,_y2=y2; 214 int32_t _x2=x2,_y2=y2; 214 215 setback_intersect(x1, y1, x2, y2, xp1, yp1, xp2, yp2,0); 215 216 … … 223 224 } 224 225 s_dat+=2; 225 } 226 } 226 227 } 227 228 } -
abuse/trunk/src/compiled.cpp
r492 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/compiled.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 … … 29 30 S_LINK_SND,S_DELETE_SND; 30 31 31 32 32 33 33 34 void compiled_init(); -
abuse/trunk/src/configuration.cpp
r492 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/configuration.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/console.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 … … 35 36 char *s=screen; 36 37 int dx,dy,xa=fnt->width(),ya=fnt->height(),i,j; 37 for (j=0,dy=wy(); j<h;j++,dy+=ya)38 { 39 for (i=0,dx=wx(); i<w;i++,s++,dx+=xa)38 for (j=0,dy=wy(); j<h; j++,dy+=ya) 39 { 40 for (i=0,dx=wx(); i<w; i++,s++,dx+=xa) 40 41 { 41 42 if (*s) -
abuse/trunk/src/console.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 … … 46 47 public : 47 48 shell_term(JCFont *font, int width, int height, char const *Name); 48 virtual ~shell_term() { };49 virtual ~shell_term() { }; 49 50 int handle_event(event &ev); 50 51 virtual void prompt(); -
abuse/trunk/src/control.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 … … 40 41 set_state(stopped); 41 42 42 the_game->change_logos(abilities,cur_char); */43 the_game->change_logos(abilities,cur_char); */ 43 44 44 45 } -
abuse/trunk/src/control.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/cop.cpp
r493 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 … … 154 155 int best_diff=200,best_num=0; 155 156 int iy=f[1],ix=f[6*2]; 156 157 157 158 int best_angle=lisp_atan2(q->y-iy-v->pointer_y,v->pointer_x-q->x-ix); 158 for (i=0; i<24;i++,f+=2) // check all the angles to see which would best fit animation wise159 for (i=0; i<24; i++,f+=2) // check all the angles to see which would best fit animation wise 159 160 { 160 161 int this_angle=lisp_atan2(f[1]-iy,f[0]-ix); … … 174 175 else 175 176 o->lvars[point_angle]=lisp_atan2(q->y-fb[1]-v->pointer_y,v->pointer_x-(q->x+fb[0])); 176 177 177 178 178 179 if (q->direction<0) … … 302 303 o->lvars[fire_delay1]=6; 303 304 if (player_fire_weapon(o,ammo_type(o->otype),NULL,o->lvars[point_angle], 304 o->otype==DFRIS ? large_fire_off : small_fire_off )) 305 o->otype==DFRIS ? large_fire_off : small_fire_off )) 305 306 ret=LNumber::Create(-1); 306 307 else ret=LNumber::Create(0); … … 328 329 { 329 330 o->lvars[fire_delay1]=2; 330 if (player_fire_weapon(o,PLASMA,NULL,o->lvars[point_angle],small_fire_off)) 331 if (player_fire_weapon(o,PLASMA,NULL,o->lvars[point_angle],small_fire_off)) 331 332 ret=LNumber::Create(-1); 332 333 else ret=LNumber::Create(0); … … 383 384 { 384 385 game_object *other=current_object->total_objects() ? current_object->get_object(0) : 0; 385 for (p=current_level->first_active_object(); p;p=p->next_active)386 for (p=current_level->first_active_object(); p; p=p->next_active) 386 387 { 387 388 xd=abs(p->x-o->x); … … 389 390 if (xd<160 && yd<130 && bad_guy_array[p->otype] && p!=other) 390 391 { 391 if (p->targetable() && 392 if (p->targetable() && 392 393 !(p->otype==S_ROCKET && p->total_objects() && p->get_object(0)==bot)) // don't track onto own missles 393 394 { … … 402 403 } 403 404 } 404 if (player_fire_weapon(o,ROCKET,target,o->lvars[point_angle],large_fire_off)) 405 if (player_fire_weapon(o,ROCKET,target,o->lvars[point_angle],large_fire_off)) 405 406 ret=LNumber::Create(-1); 406 407 else ret=LNumber::Create(0); … … 530 531 531 532 if (o->current_frame==0) o->current_frame=9; 532 o->current_frame--; 533 o->current_frame--; 533 534 534 535 /* if (o->lvars[special_power]==FAST_POWER) … … 545 546 } 546 547 else */ o->y+=3; 547 548 548 549 549 550 } else if (ym<0) … … 568 569 else 569 570 { o->set_state(run_jump); 570 o->set_yvel(get_ability(o->otype,jump_yvel)); 571 o->set_yvel(get_ability(o->otype,jump_yvel)); 571 572 } 572 573 } … … 633 634 { 634 635 o->set_aistate(2); // go to deing state 635 o->set_state(dead); 636 o->set_state(dead); 636 637 } 637 638 else 638 639 { 639 if (o->hp()<40 && (current_level->tick_counter()%16)==0) // if low on health play heart beat 640 if (o->hp()<40 && (current_level->tick_counter()%16)==0) // if low on health play heart beat 640 641 the_game->play_sound(S_LOW_HEALTH_SND,127,o->x,o->y); 641 642 else if (o->hp()<15 && (current_level->tick_counter()%8)==0) // if low on health play heart beat … … 651 652 top->x=o->x; 652 653 top->y=o->y+29-top->picture()->height(); 653 654 654 655 if ((but&2) && !o->lvars[is_teleporting] && o->state!=S_climbing && o->state!=S_climb_off) 655 656 { … … 662 663 663 664 current_object=top; 664 void *ret=eval_function((LSymbol *)figures[top->otype]->get_fun(OFUN_USER_FUN),args); 665 void *ret=eval_function((LSymbol *)figures[top->otype]->get_fun(OFUN_USER_FUN),args); 665 666 current_object=o; 666 v->add_ammo(v->current_weapon,lnumber_value(ret)); 667 } 668 } 667 v->add_ammo(v->current_weapon,lnumber_value(ret)); 668 } 669 } 669 670 } else if (o->aistate()==3) 670 671 { … … 693 694 { 694 695 game_object *other=o->get_object(0); 695 for (; f;f=f->next)696 for (; f; f=f->next) 696 697 { 697 698 int mex=f->focus->x; … … 702 703 if (f->focus->state==S_climbing) 703 704 f->focus->x=(o->x+other->x)/2; 704 f->focus->lvars[in_climbing_area]=mey-o->y; 705 f->focus->lvars[in_climbing_area]=mey-o->y; 705 706 } 706 707 } … … 803 804 int ra,ga,ba; 804 805 805 for (int i=0; i<256;i++)806 for (int i=0; i<256; i++) 806 807 { 807 808 ra=(int)*addr+r; if (ra>255) ra=255; else if (ra<0) r=0; *addr=(uint8_t)ra; addr++; … … 877 878 else 878 879 o->draw_predator(); 879 880 880 881 if (o->controller() && o->controller()->local_player()) 881 882 cache.img(S_sneaky_image)->put_image(screen,o->controller()->cx2-20, … … 956 957 } 957 958 return true_symbol; 958 } 959 } 959 960 960 961 … … 1002 1003 int tp=0; 1003 1004 view *f=player_list; 1004 for (; f;f=f->next)1005 for (; f; f=f->next) 1005 1006 { 1006 1007 sorted_players[tp]=f; … … 1019 1020 1020 1021 int i; 1021 for (i=0; i<tp;i++)1022 for (i=0; i<tp; i++) 1022 1023 { 1023 1024 int color=lnumber_value(((LArray *)((LSymbol *)l_player_text_color)->GetValue())->Get(sorted_players[i]->get_tint())); … … 1048 1049 1049 1050 view *v=player_list; int tp=0,i; 1050 for (v=player_list; v;v=v->next) tp++;1051 for (v=player_list; v; v=v->next) tp++; 1051 1052 1052 1053 int y=(y1+y2)/2-(tp+2)*fnt->height()/2,x=x1+10; … … 1059 1060 y+=fnt->height(); 1060 1061 v=player_list; 1061 for (i=0; i<tp;i++)1062 for (i=0; i<tp; i++) 1062 1063 { 1063 1064 enum { NAME_LEN=18 } ; -
abuse/trunk/src/cop.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/crc.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 { 44 45 l-=nr; 45 for (c=buffer; nr;nr--,c++)46 for (c=buffer; nr; nr--,c++) 46 47 { 47 48 crc1+=*c; -
abuse/trunk/src/crc.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/demo.cpp
r484 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 … … 100 101 base->packet.packet_reset(); // reset input buffer 101 102 view *p=player_list; // get current inputs 102 for (; p;p=p->next)103 for (; p; p=p->next) 103 104 if (p->local_player()) 104 105 p->get_input(); … … 139 140 140 141 view *v=player_list; 141 for (; v;v=v->next) { if (v->focus) v->reset_player(); }142 for (; v; v=v->next) { if (v->focus) v->reset_player(); } 142 143 143 144 last_demo_mx=last_demo_my=last_demo_mbut=0; … … 208 209 209 210 view *v=player_list; 210 for (; v;v=v->next) // reset all the players211 for (; v; v=v->next) // reset all the players 211 212 { if (v->focus) { v->reset_player(); v->focus->set_aistate(0); } } 212 213 delete current_level; -
abuse/trunk/src/demo.h
r492 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/dev.cpp
r492 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 … … 126 127 }; 127 128 128 int dev_mode_ids[DEV_MODES]={ ID_DMODE_DRAW,ID_DMODE_PICK, ID_DMODE_AREA};129 int dev_mode_ids[DEV_MODES]={ ID_DMODE_DRAW,ID_DMODE_PICK, ID_DMODE_AREA}; 129 130 130 131 int edit_mode=ID_DMODE_DRAW; … … 208 209 int total=0,number=0; 209 210 game_object *c; 210 for (c=current_level->first_object(); c;c=c->next)211 for (c=current_level->first_object(); c; c=c->next) 211 212 { 212 213 if (c->otype==who->otype) … … 256 257 int type=-1; // see if this type exsists 257 258 int i; 258 for (i=0; i<total_objects;i++)259 for (i=0; i<total_objects; i++) 259 260 if (!strcmp(object_names[i],name)) 260 261 type=i; … … 272 273 else 273 274 first=search_object->next; 274 for (; !find && first;first=first->next)275 for (; !find && first; first=first->next) 275 276 if (first->otype==type) 276 277 find=first; … … 278 279 if (!find) 279 280 { 280 for (first=current_level->first_object(); first && !find;first=first->next)281 for (first=current_level->first_object(); first && !find; first=first->next) 281 282 { 282 283 if (first->otype==type) … … 359 360 dev_backward=cache.reg(artf,"backward",SPEC_IMAGE,0); 360 361 361 for (int i=0; i<DEV_MODES;i++)362 for (int i=0; i<DEV_MODES; i++) 362 363 dev_mode_icon[i]=cache.reg(artf,dev_mode_icon_names[i],SPEC_IMAGE,0); 363 364 … … 394 395 screen->lock(); 395 396 im->lock(); 396 for (iy=iy_start; new_height>0;new_height--,y++,iy+=ystep)397 for (iy=iy_start; new_height>0; new_height--,y++,iy+=ystep) 397 398 { 398 399 sl1=im->scan_line(iy>>16); 399 400 sl2=screen->scan_line(y)+x; 400 for (ix=ix_start,sx=0; sx<new_width;sx++,ix+=xstep,sl2++)401 for (ix=ix_start,sx=0; sx<new_width; sx++,ix+=xstep,sl2++) 401 402 *sl2=sl1[ix>>16]; 402 403 } … … 436 437 uint8_t d; 437 438 screen->lock(); 438 for (iy=iy_start; new_height>0;new_height--,y++,iy+=ystep)439 for (iy=iy_start; new_height>0; new_height--,y++,iy+=ystep) 439 440 { 440 441 sl1=im->scan_line(iy>>16); 441 442 sl2=screen->scan_line(y)+x; 442 for (ix=ix_start,sx=0; sx<new_width;sx++,ix+=xstep,sl2++)443 for (ix=ix_start,sx=0; sx<new_width; sx++,ix+=xstep,sl2++) 443 444 { 444 445 d=sl1[ix>>16]; … … 476 477 if (dev&DRAW_LINKS) 477 478 { 478 for (light_source *f=first_light_source; f;f=f->next)479 for (light_source *f=first_light_source; f; f=f->next) 479 480 { 480 481 if (f->x-vx>=0 && f->x-vx<=(v->cx2-v->cx1+1) && f->y-vy>=0 && f->y-vy<=(v->cy2-v->cy1+1)) … … 506 507 game_object *o; 507 508 if (show_names) 508 for (o=current_level->first_object(); o;o=o->next)509 for (o=current_level->first_object(); o; o=o->next) 509 510 { 510 511 the_game->game_to_mouse(o->x,o->y,current_view,x1,y1); … … 516 517 { 517 518 // draw connections between objects 518 for (o=current_level->first_object(); o;o=o->next)519 for (o=current_level->first_object(); o; o=o->next) 519 520 { 520 521 the_game->game_to_mouse(o->x,o->y,current_view,x1,y1); 521 522 522 523 int i=0; 523 for (; i<o->total_objects();i++)524 for (; i<o->total_objects(); i++) 524 525 { 525 526 game_object *other=o->get_object(i); … … 528 529 } 529 530 530 for (i=0; i<o->total_lights();i++)531 for (i=0; i<o->total_lights(); i++) 531 532 { 532 533 light_source *l=o->get_light(i); … … 547 548 548 549 the_game->game_to_mouse(selected_object->x,selected_object->y,current_view,x1,y1); 549 for (int i=0; i<selected_object->total_objects();i++)550 for (int i=0; i<selected_object->total_objects(); i++) 550 551 { 551 552 game_object *other=selected_object->get_object(i); … … 563 564 image *i=cache.img(light_buttons[0]); 564 565 int l=i->width()/2,h=i->height()/2; 565 for (light_source *f=first_light_source; f;f=f->next)566 for (light_source *f=first_light_source; f; f=f->next) 566 567 { 567 568 if (x>=f->x-l && x<=f->x+l && y>=f->y-h && y<=f->y+h) … … 585 586 tbw_on=1; 586 587 int setx=0; 587 for (int i=0; i<DEV_MODES;i++)588 for (int i=0; i<DEV_MODES; i++) 588 589 { 589 590 if (edit_mode==dev_mode_ids[i]) … … 686 687 static int get_omenu_item(int x) 687 688 { 688 for (int i=0; i<total_objects;i++)689 for (int i=0; i<total_objects; i++) 689 690 if (listable_objs[x]==object_names[i]) 690 691 return i; … … 833 834 prop->load("defaults.prp"); 834 835 835 for (i=1; i<argc;i++)836 for (i=1; i<argc; i++) 836 837 { 837 838 if (!strcmp(argv[i],"-edit")) … … 968 969 eval(p); 969 970 l_user_stack.pop(1); 970 for (int i=0; i<total_pals;i++)971 for (int i=0; i<total_pals; i++) 971 972 pal_wins[i]->close_window(); 972 973 } … … 986 987 987 988 sscanf(command,"%s",fword); 988 for (st=command; *st && *st!=' ';st++);989 for (st=command; *st && *st!=' '; st++); 989 990 if (*st) st++; 990 991 if (!strcmp(fword,"active")) … … 1007 1008 { 1008 1009 view *f=NULL; 1009 for (f=player_list; f;f=f->next)1010 for (f=player_list; f; f=f->next) 1010 1011 { 1011 1012 int i; 1012 for (i=0; i<total_weapons;i++)1013 for (i=0; i<total_weapons; i++) 1013 1014 f->weapons[i]=-1; 1014 1015 … … 1058 1059 l=(l+the_game->btile_width()-1)/the_game->btile_width(); 1059 1060 h=(h+the_game->btile_height()-1)/the_game->btile_height(); 1060 for (y=0,i=cur_bg; y<h;y++)1061 for (x=0; x<l;x++)1061 for (y=0,i=cur_bg; y<h; y++) 1062 for (x=0; x<l; x++) 1062 1063 the_game->put_bg(rx+x,ry+y,i++); 1063 1064 dprintf("%dx%d\n",l,h); … … 1069 1070 { 1070 1071 view *v=the_game->first_view; 1071 for (; v;v=v->next)1072 for (; v; v=v->next) 1072 1073 { 1073 1074 v->pan_x=0; … … 1165 1166 sscanf(command,"%s%s",fword,oname); // read the type of object to create 1166 1167 int x,t=-1; 1167 for (x=0; x<total_objects;x++) // find the object type by name1168 for (x=0; x<total_objects; x++) // find the object type by name 1168 1169 if (!strcmp(object_names[x],oname)) 1169 1170 t=x; … … 1209 1210 { 1210 1211 int32_t i,j; 1211 for (i=0; i<current_level->foreground_width();i++)1212 for (j=0; j<current_level->foreground_height();j++)1212 for (i=0; i<current_level->foreground_width(); i++) 1213 for (j=0; j<current_level->foreground_height(); j++) 1213 1214 current_level->clear_fg(i,j); 1214 1215 } … … 1371 1372 int maxl=0; 1372 1373 int i=0; 1373 for (; i<figures[o->otype]->total_fields;i++)1374 for (; i<figures[o->otype]->total_fields; i++) 1374 1375 if( strlen(figures[o->otype]->fields[i]->descript_name) > (unsigned)maxl ) 1375 1376 maxl=strlen(figures[o->otype]->fields[i]->descript_name); … … 1377 1378 int owh=wh; 1378 1379 ifield *first=NULL,*last=NULL; 1379 for (i=0; i<figures[o->otype]->total_fields;i++)1380 for (i=0; i<figures[o->otype]->total_fields; i++) 1380 1381 { 1381 1382 char tmp[200]; 1382 1383 strcpy(tmp,figures[o->otype]->fields[i]->descript_name); 1383 for (int j=maxl-strlen(figures[o->otype]->fields[i]->descript_name); j;j--)1384 for (int j=maxl-strlen(figures[o->otype]->fields[i]->descript_name); j; j--) 1384 1385 strcat(tmp," "); 1385 1386 int er; … … 1475 1476 { 1476 1477 ifield *f=aiw->inm->get(DEV_AI_OK)->next; 1477 for (int i=0; i<figures[o->otype]->total_fields;i++)1478 for (int i=0; i<figures[o->otype]->total_fields; i++) 1478 1479 { 1479 1480 x=atoi(f->read()); … … 1561 1562 int32_t mx=last_demo_mx,my=last_demo_my; 1562 1563 view *v=the_game->view_in(mx,my); 1563 for (area_controller *a=current_level->area_list; a;a=a->next)1564 for (area_controller *a=current_level->area_list; a; a=a->next) 1564 1565 { 1565 1566 int32_t x1,y1,x2,y2; … … 1639 1640 if (!current_level) return ; 1640 1641 1641 for (x=0; x<total_pals;x++)1642 for (x=0; x<total_pals; x++) 1642 1643 pal_wins[x]->handle_event(ev); 1643 1644 if (ev.type==EV_MOUSE_MOVE) … … 2327 2328 case ID_GOD_MODE : 2328 2329 { 2329 for (view *v=player_list; v;v=v->next)2330 for (view *v=player_list; v; v=v->next) 2330 2331 v->god=!v->god; 2331 2332 } break; … … 2404 2405 { 2405 2406 area_controller *a=current_level->area_list,*l=NULL; 2406 for (; a!=current_area && a;a=a->next) { l=a; }2407 for (; a!=current_area && a; a=a->next) { l=a; } 2407 2408 l->next=a->next; 2408 2409 delete a; … … 2420 2421 if (edit_object) 2421 2422 { 2422 for (int i=0; i<edit_object->total_objects();i++)2423 for (int i=0; i<edit_object->total_objects(); i++) 2423 2424 edit_object->remove_object(edit_object->get_object(0)); 2424 2425 the_game->need_refresh(); … … 2430 2431 if (edit_object) 2431 2432 { 2432 for (int i=0; i<edit_object->total_lights();i++)2433 for (int i=0; i<edit_object->total_lights(); i++) 2433 2434 edit_object->remove_light(edit_object->get_light(0)); 2434 2435 the_game->need_refresh(); … … 3004 3005 int th=the_game->ftile_height()/scale,tw=the_game->ftile_width()/scale; 3005 3006 3006 for (i=0; i<w*h;i++)3007 for (i=0; i<w*h; i++) 3007 3008 { 3008 3009 im->clear(); … … 3031 3032 { 3032 3033 int i,dr=0; 3033 for (i=0; i<w*h;i++)3034 for (i=0; i<w*h; i++) 3034 3035 { 3035 3036 if (pat[i]==d || pat[i]==last_selected) … … 3123 3124 the_game->ftile_on(me->x,me->y,xs,ys); 3124 3125 3125 for (xx=xs; xx<xs+w;xx++)3126 for (xx=xs; xx<xs+w; xx++) 3126 3127 { 3127 for (yy=ys; yy<ys+h;yy++)3128 for (yy=ys; yy<ys+h; yy++) 3128 3129 { 3129 3130 if (xx>=0 && yy>=0 && xx<current_level->foreground_width() && … … 3159 3160 npat=(unsigned short *)malloc(sizeof(unsigned short)*(w+xa)*(h+ya)); 3160 3161 memset(npat,0,sizeof(unsigned short)*(w+xa)*(h+ya)); 3161 for (i=0; i<(w+xa);i++)3162 for (j=0; j<(h+ya);j++)3162 for (i=0; i<(w+xa); i++) 3163 for (j=0; j<(h+ya); j++) 3163 3164 if (i+j*w<w*h) 3164 3165 npat[i+j*(w+xa)]=pat[i+j*w]; … … 3183 3184 fprintf(fp,"(add_palette \"%s\" %ld %ld %ld %ld %ld ",name,(long)w,(long)h,(long)x,(long)y,(long)scale); 3184 3185 int i; 3185 for (i=0; i<w*h;i++)3186 for (i=0; i<w*h; i++) 3186 3187 fprintf(fp,"%d ",pat[i]&0x7fff); 3187 3188 fprintf(fp,")\n"); … … 3199 3200 3200 3201 int i; 3201 for (i=0; i<total_pals;i++)3202 for (i=0; i<total_pals; i++) 3202 3203 { 3203 3204 pal_wins[i]->save(fp); … … 3212 3213 { 3213 3214 int i; 3214 for (i=0; i<total_pals;i++)3215 for (i=0; i<total_pals; i++) 3215 3216 if (win==pal_wins[i]->me) return 1; 3216 3217 return 0; … … 3323 3324 { 3324 3325 int t=0; 3325 for (int j=0; j<MAX_STATE;j++)3326 for (int j=0; j<MAX_STATE; j++) 3326 3327 { 3327 3328 if (figures[type]->has_sequence((character_state)j)) … … 3341 3342 { 3342 3343 int find=-1; 3343 for (int i=0; i<total_objects;i++)3344 for (int i=0; i<total_objects; i++) 3344 3345 { 3345 3346 if (!strcmp(name,object_names[i])) … … 3357 3358 int t=0,s=0; 3358 3359 int i=0; 3359 for (; i<nforetiles;i++)3360 for (; i<nforetiles; i++) 3360 3361 { 3361 3362 if (foretiles[i]>=0) … … 3371 3372 3372 3373 t=0; s=0; 3373 for (i=0; i<nbacktiles;i++)3374 for (i=0; i<nbacktiles; i++) 3374 3375 { 3375 3376 if (backtiles[i]>=0) … … 3385 3386 3386 3387 t=0; s=0; 3387 for (i=0; i<total_objects;i++)3388 for (i=0; i<total_objects; i++) 3388 3389 { 3389 3390 t++; … … 3422 3423 3423 3424 static pmi filemenu[]={ 3424 { "menu1_load", ID_LEVEL_LOAD,NULL,-1},3425 { NULL,0,NULL,-1},3426 { "menu1_save", ID_LEVEL_SAVE,NULL,-1},3427 { "menu1_saveas", ID_LEVEL_SAVEAS,NULL,-1},3428 { "menu1_savegame", ID_GAME_SAVE,NULL,-1},3429 { "menu1_new", ID_LEVEL_NEW,NULL,-1},3430 { "menu1_resize", ID_LEVEL_RESIZE,NULL,-1},3431 { NULL,0,NULL,-1},3432 { "menu1_suspend",ID_SUSPEND,NULL,-1},3433 { "menu1_toggle",ID_PLAY_MODE,NULL,-1},3434 { NULL,0,NULL,-1},3435 { "menu1_savepal",ID_EDIT_SAVE,NULL,-1},3436 // { "menu1_startc",ID_CACHE_PROFILE,NULL,-1},3437 // { "menu1_endc",ID_CACHE_PROFILE_END,NULL,-1},3438 { NULL,0,NULL,-1},3439 { "menu1_quit", ID_QUIT,NULL,-1},3440 { NULL,-1,NULL,-1}3425 { "menu1_load", ID_LEVEL_LOAD,NULL,-1}, 3426 { NULL,0,NULL,-1}, 3427 { "menu1_save", ID_LEVEL_SAVE,NULL,-1}, 3428 { "menu1_saveas", ID_LEVEL_SAVEAS,NULL,-1}, 3429 { "menu1_savegame", ID_GAME_SAVE,NULL,-1}, 3430 { "menu1_new", ID_LEVEL_NEW,NULL,-1}, 3431 { "menu1_resize", ID_LEVEL_RESIZE,NULL,-1}, 3432 { NULL,0,NULL,-1}, 3433 { "menu1_suspend",ID_SUSPEND,NULL,-1}, 3434 { "menu1_toggle",ID_PLAY_MODE,NULL,-1}, 3435 { NULL,0,NULL,-1}, 3436 { "menu1_savepal",ID_EDIT_SAVE,NULL,-1}, 3437 // { "menu1_startc",ID_CACHE_PROFILE,NULL,-1}, 3438 // { "menu1_endc",ID_CACHE_PROFILE_END,NULL,-1}, 3439 { NULL,0,NULL,-1}, 3440 { "menu1_quit", ID_QUIT,NULL,-1}, 3441 { NULL,-1,NULL,-1} 3441 3442 }; 3442 3443 3443 3444 3444 3445 static pmi editmenu[]={ 3445 { "menu2_light", ID_TOGGLE_LIGHT,NULL,-1},3446 { "menu2_scroll", ID_SET_SCROLL,NULL,-1},3447 { "menu2_center", ID_CENTER_PLAYER,NULL,-1},3448 { "menu2_addpal", ID_ADD_PALETTE,NULL,-1},3449 { "menu2_delay", ID_TOGGLE_DELAY,NULL,-1},3450 3451 { "menu2_god", ID_GOD_MODE,NULL,-1},3452 { "menu2_clear", ID_CLEAR_WEAPONS,NULL,-1},3453 { "menu2_mscroll", ID_MOUSE_SCROLL,&mouse_scrolling,-1},3454 { "menu2_lock", ID_LOCK_PALETTES,&palettes_locked,-1},3455 { "menu2_raise", ID_RAISE_ALL,&raise_all,-1},3456 { "menu2_names", ID_TOGGLE_NAMES,&show_names,-1},3457 3458 { NULL,0,NULL,-1},3459 { "menu2_map", ID_TOGGLE_MAP,NULL,-1},3460 // { "Shrink to 320x200 (F10)", ID_SMALL_MODE,NULL,-1},3461 { "menu2_view", ID_DISABLE_VIEW_SHIFT,&view_shift_disabled,-1},3462 // { "Ultra Smooth draw (U)", ID_INTERPOLATE_DRAW, &interpolate_draw,'U'},3463 { "menu2_alight", ID_DISABLE_AUTOLIGHT, &disable_autolight,'A'},3464 { "menu2_fps", ID_SHOW_FPS, &fps_on,-1},3465 // { NULL,0,NULL,-1},3466 // { "Record demo", ID_RECORD_DEMO,NULL,-1},3467 // { "Play demo", ID_PLAY_DEMO,NULL,-1},3468 { NULL,-1,NULL,-1}3446 { "menu2_light", ID_TOGGLE_LIGHT,NULL,-1}, 3447 { "menu2_scroll", ID_SET_SCROLL,NULL,-1}, 3448 { "menu2_center", ID_CENTER_PLAYER,NULL,-1}, 3449 { "menu2_addpal", ID_ADD_PALETTE,NULL,-1}, 3450 { "menu2_delay", ID_TOGGLE_DELAY,NULL,-1}, 3451 3452 { "menu2_god", ID_GOD_MODE,NULL,-1}, 3453 { "menu2_clear", ID_CLEAR_WEAPONS,NULL,-1}, 3454 { "menu2_mscroll", ID_MOUSE_SCROLL,&mouse_scrolling,-1}, 3455 { "menu2_lock", ID_LOCK_PALETTES,&palettes_locked,-1}, 3456 { "menu2_raise", ID_RAISE_ALL,&raise_all,-1}, 3457 { "menu2_names", ID_TOGGLE_NAMES,&show_names,-1}, 3458 3459 { NULL,0,NULL,-1}, 3460 { "menu2_map", ID_TOGGLE_MAP,NULL,-1}, 3461 // { "Shrink to 320x200 (F10)", ID_SMALL_MODE,NULL,-1}, 3462 { "menu2_view", ID_DISABLE_VIEW_SHIFT,&view_shift_disabled,-1}, 3463 // { "Ultra Smooth draw (U)", ID_INTERPOLATE_DRAW, &interpolate_draw,'U'}, 3464 { "menu2_alight", ID_DISABLE_AUTOLIGHT, &disable_autolight,'A'}, 3465 { "menu2_fps", ID_SHOW_FPS, &fps_on,-1}, 3466 // { NULL,0,NULL,-1}, 3467 // { "Record demo", ID_RECORD_DEMO,NULL,-1}, 3468 // { "Play demo", ID_PLAY_DEMO,NULL,-1}, 3469 { NULL,-1,NULL,-1} 3469 3470 }; 3470 3471 … … 3473 3474 // Window Menus 3474 3475 static pmi winmenu[]={ 3475 { "menu3_fore", ID_WIN_FORE, &forew_on,-1},3476 { "menu3_back", ID_WIN_BACK, &backw_on,-1},3477 { "menu3_layers", ID_WIN_LAYERS, &show_menu_on,-1},3478 { "menu3_light", ID_WIN_LIGHTING,&ledit_on,-1},3479 { "menu3_pal", ID_WIN_PALETTES,&pmenu_on,-1},3480 { "menu3_objs", ID_WIN_OBJECTS, &omenu_on,-1},3481 // { "menu3_console", ID_WIN_CONSOLE, &commandw_on,-1},3482 { "menu3_toolbar", ID_WIN_TOOLBAR, &tbw_on,-1},3483 // { "Search (s)", ID_SEARCH, &searchw_on,-1},3484 { "menu3_prof", ID_PROFILE, &profile_on,-1},3485 { "menu3_save", ID_SAVE_WINDOWS,NULL,-1},3486 { NULL,-1,NULL,-1}3476 { "menu3_fore", ID_WIN_FORE, &forew_on,-1}, 3477 { "menu3_back", ID_WIN_BACK, &backw_on,-1}, 3478 { "menu3_layers", ID_WIN_LAYERS, &show_menu_on,-1}, 3479 { "menu3_light", ID_WIN_LIGHTING,&ledit_on,-1}, 3480 { "menu3_pal", ID_WIN_PALETTES,&pmenu_on,-1}, 3481 { "menu3_objs", ID_WIN_OBJECTS, &omenu_on,-1}, 3482 // { "menu3_console", ID_WIN_CONSOLE, &commandw_on,-1}, 3483 { "menu3_toolbar", ID_WIN_TOOLBAR, &tbw_on,-1}, 3484 // { "Search (s)", ID_SEARCH, &searchw_on,-1}, 3485 { "menu3_prof", ID_PROFILE, &profile_on,-1}, 3486 { "menu3_save", ID_SAVE_WINDOWS,NULL,-1}, 3487 { NULL,-1,NULL,-1} 3487 3488 }; 3488 3489 … … 3491 3492 /* 3492 3493 static pmi filemenu[]={ 3493 { "Load Level", ID_LEVEL_LOAD,NULL,-1},3494 { NULL,0,NULL,-1},3495 { "Save Level (S)", ID_LEVEL_SAVE,NULL,-1},3496 { "Save level as", ID_LEVEL_SAVEAS,NULL,-1},3497 { "Save game", ID_GAME_SAVE,NULL,-1},3498 { "New level", ID_LEVEL_NEW,NULL,-1},3499 { "Resize map", ID_LEVEL_RESIZE,NULL,-1},3500 { NULL,0,NULL,-1},3501 { "Suspend non-players",ID_SUSPEND,NULL,-1},3502 { "Play mode toggle (TAB)",ID_PLAY_MODE,NULL,-1},3503 { NULL,0,NULL,-1},3504 { "Save Palettes ",ID_EDIT_SAVE,NULL,-1},3505 { "Start cache profile ",ID_CACHE_PROFILE,NULL,-1},3506 { "End cache profile ",ID_CACHE_PROFILE_END,NULL,-1},3507 { NULL,0,NULL,-1},3508 { "Quit (Q)", ID_QUIT,NULL,-1},3509 { NULL,-1,NULL,-1}3494 { "Load Level", ID_LEVEL_LOAD,NULL,-1}, 3495 { NULL,0,NULL,-1}, 3496 { "Save Level (S)", ID_LEVEL_SAVE,NULL,-1}, 3497 { "Save level as", ID_LEVEL_SAVEAS,NULL,-1}, 3498 { "Save game", ID_GAME_SAVE,NULL,-1}, 3499 { "New level", ID_LEVEL_NEW,NULL,-1}, 3500 { "Resize map", ID_LEVEL_RESIZE,NULL,-1}, 3501 { NULL,0,NULL,-1}, 3502 { "Suspend non-players",ID_SUSPEND,NULL,-1}, 3503 { "Play mode toggle (TAB)",ID_PLAY_MODE,NULL,-1}, 3504 { NULL,0,NULL,-1}, 3505 { "Save Palettes ",ID_EDIT_SAVE,NULL,-1}, 3506 { "Start cache profile ",ID_CACHE_PROFILE,NULL,-1}, 3507 { "End cache profile ",ID_CACHE_PROFILE_END,NULL,-1}, 3508 { NULL,0,NULL,-1}, 3509 { "Quit (Q)", ID_QUIT,NULL,-1}, 3510 { NULL,-1,NULL,-1} 3510 3511 }; 3511 3512 3512 3513 3513 3514 static pmi editmenu[]={ 3514 { "Toggle light", ID_TOGGLE_LIGHT,NULL,-1},3515 { "Set scroll rate", ID_SET_SCROLL,NULL,-1},3516 { "Center on player (c)", ID_CENTER_PLAYER,NULL,-1},3517 { "Add palette", ID_ADD_PALETTE,NULL,-1},3518 { "Toggle Delays (D)", ID_TOGGLE_DELAY,NULL,-1},3519 3520 { "God mode", ID_GOD_MODE,NULL,-1},3521 { "Clear weapons (z)", ID_CLEAR_WEAPONS,NULL,-1},3522 { "Mouse scroll", ID_MOUSE_SCROLL,&mouse_scrolling,-1},3523 { "Lock palette windows", ID_LOCK_PALETTES,&palettes_locked,-1},3524 { "Raise all foreground", ID_RAISE_ALL,&raise_all,-1},3525 { "Toggle object names", ID_TOGGLE_NAMES,&show_names,-1},3526 3527 { NULL,0,NULL,-1},3528 { "Toggle map (m)", ID_TOGGLE_MAP,NULL,-1},3529 // { "Shrink to 320x200 (F10)", ID_SMALL_MODE,NULL,-1},3530 { "Disable view shifts", ID_DISABLE_VIEW_SHIFT,&view_shift_disabled,-1},3531 // { "Ultra Smooth draw (U)", ID_INTERPOLATE_DRAW, &interpolate_draw,'U'},3532 { "Disable Autolight (A)", ID_DISABLE_AUTOLIGHT, &disable_autolight,'A'},3533 { "Show FPS/Obj count", ID_SHOW_FPS, &fps_on,-1},3534 // { NULL,0,NULL,-1},3535 // { "Record demo", ID_RECORD_DEMO,NULL,-1},3536 // { "Play demo", ID_PLAY_DEMO,NULL,-1},3537 { NULL,-1,NULL,-1}3515 { "Toggle light", ID_TOGGLE_LIGHT,NULL,-1}, 3516 { "Set scroll rate", ID_SET_SCROLL,NULL,-1}, 3517 { "Center on player (c)", ID_CENTER_PLAYER,NULL,-1}, 3518 { "Add palette", ID_ADD_PALETTE,NULL,-1}, 3519 { "Toggle Delays (D)", ID_TOGGLE_DELAY,NULL,-1}, 3520 3521 { "God mode", ID_GOD_MODE,NULL,-1}, 3522 { "Clear weapons (z)", ID_CLEAR_WEAPONS,NULL,-1}, 3523 { "Mouse scroll", ID_MOUSE_SCROLL,&mouse_scrolling,-1}, 3524 { "Lock palette windows", ID_LOCK_PALETTES,&palettes_locked,-1}, 3525 { "Raise all foreground", ID_RAISE_ALL,&raise_all,-1}, 3526 { "Toggle object names", ID_TOGGLE_NAMES,&show_names,-1}, 3527 3528 { NULL,0,NULL,-1}, 3529 { "Toggle map (m)", ID_TOGGLE_MAP,NULL,-1}, 3530 // { "Shrink to 320x200 (F10)", ID_SMALL_MODE,NULL,-1}, 3531 { "Disable view shifts", ID_DISABLE_VIEW_SHIFT,&view_shift_disabled,-1}, 3532 // { "Ultra Smooth draw (U)", ID_INTERPOLATE_DRAW, &interpolate_draw,'U'}, 3533 { "Disable Autolight (A)", ID_DISABLE_AUTOLIGHT, &disable_autolight,'A'}, 3534 { "Show FPS/Obj count", ID_SHOW_FPS, &fps_on,-1}, 3535 // { NULL,0,NULL,-1}, 3536 // { "Record demo", ID_RECORD_DEMO,NULL,-1}, 3537 // { "Play demo", ID_PLAY_DEMO,NULL,-1}, 3538 { NULL,-1,NULL,-1} 3538 3539 }; 3539 3540 … … 3542 3543 // Window Menus 3543 3544 static pmi winmenu[]={ 3544 { "Foreground (f)", ID_WIN_FORE, &forew_on,-1},3545 { "Background (b)", ID_WIN_BACK, &backw_on,-1},3546 { "Draw layers (L)", ID_WIN_LAYERS, &show_menu_on,-1},3547 { "Lighting (l)", ID_WIN_LIGHTING,&ledit_on,-1},3548 { "Palettes (p)", ID_WIN_PALETTES,&pmenu_on,-1},3549 { "Objects (o)", ID_WIN_OBJECTS, &omenu_on,-1},3550 { "Console (/)", ID_WIN_CONSOLE, &commandw_on,-1},3551 { "Tool Bar (a)", ID_WIN_TOOLBAR, &tbw_on,-1},3552 // { "Search (s)", ID_SEARCH, &searchw_on,-1},3553 { "Profile (P)", ID_PROFILE, &profile_on,-1},3554 { "Save positions", ID_SAVE_WINDOWS,NULL,-1},3555 { NULL,-1,NULL,-1}3545 { "Foreground (f)", ID_WIN_FORE, &forew_on,-1}, 3546 { "Background (b)", ID_WIN_BACK, &backw_on,-1}, 3547 { "Draw layers (L)", ID_WIN_LAYERS, &show_menu_on,-1}, 3548 { "Lighting (l)", ID_WIN_LIGHTING,&ledit_on,-1}, 3549 { "Palettes (p)", ID_WIN_PALETTES,&pmenu_on,-1}, 3550 { "Objects (o)", ID_WIN_OBJECTS, &omenu_on,-1}, 3551 { "Console (/)", ID_WIN_CONSOLE, &commandw_on,-1}, 3552 { "Tool Bar (a)", ID_WIN_TOOLBAR, &tbw_on,-1}, 3553 // { "Search (s)", ID_SEARCH, &searchw_on,-1}, 3554 { "Profile (P)", ID_PROFILE, &profile_on,-1}, 3555 { "Save positions", ID_SAVE_WINDOWS,NULL,-1}, 3556 { NULL,-1,NULL,-1} 3556 3557 }; 3557 3558 … … 3609 3610 dev_controll::~dev_controll() 3610 3611 { 3611 for (int i=0; i<total_pals;i++)3612 for (int i=0; i<total_pals; i++) 3612 3613 delete pal_wins[i]; 3613 3614 if (total_pals) -
abuse/trunk/src/dev.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 … … 131 132 dv = dev; 132 133 } 133 virtual ~dev_term() { };134 virtual ~dev_term() { }; 134 135 virtual void execute(char *st); 135 136 } ; -
abuse/trunk/src/devsel.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 … … 93 94 94 95 screen->bar(x,y,x+l-1,y+h-1,wm->black()); 95 for (int i=newx; i<newx+th*wid;i++)96 for (int i=newx; i<newx+th*wid; i++) 96 97 { 97 98 xo=x+((i-newx)%wid)*xw; … … 100 101 int blank=0; 101 102 if (i<t) 102 { 103 { 103 104 switch (type) 104 105 { … … 124 125 else 125 126 scale_put(the_game->get_bg(i)->im,screen,xo,yo,xw,ya); 126 127 127 128 } break; 128 129 case SPEC_CHARACTER : … … 163 164 { 164 165 case SPEC_FORETILE : 165 { return cur_fg;} break;166 { return cur_fg; } break; 166 167 case SPEC_BACKTILE : 167 { return cur_bg;} break;168 { return cur_bg; } break; 168 169 case SPEC_CHARACTER : 169 { return cur_char;} break;170 { return cur_char; } break; 170 171 } 171 172 return 0; … … 177 178 { 178 179 case SPEC_FORETILE : 179 { cur_fg=x;} break;180 { cur_fg=x; } break; 180 181 case SPEC_BACKTILE : 181 { cur_bg=x;} break;182 { cur_bg=x; } break; 182 183 case SPEC_CHARACTER : 183 { cur_char=x;} break;184 { cur_char=x; } break; 184 185 } 185 186 } -
abuse/trunk/src/devsel.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/director.cpp
r492 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 … … 65 66 66 67 word_start=buf; 67 for (word_len=0,word_start=buf,word_size=0; *buf && *buf!=' ' && *buf!='\r' && *buf!='\n' &&68 *buf!='\t' && (*buf!='\\' || buf[1]!='n'); buf++,word_size+=w,word_len++);68 for (word_len=0,word_start=buf,word_size=0; *buf && *buf!=' ' && *buf!='\r' && *buf!='\n' && 69 *buf!='\t' && (*buf!='\\' || buf[1]!='n'); buf++,word_size+=w,word_len++); 69 70 70 71 if (word_size<x2-x1) // make sure the word can fit on the screen … … 161 162 white_light+32*256, 162 163 wm->bright_color() 163 164 164 165 )) 165 166 text=NULL; … … 167 168 { 168 169 if ((int)(cur_time.diff_time(text_time)*1000)>scroll_speed) 169 { 170 { 170 171 text_y+=text_step; 171 172 delete text_time; 172 173 if (text) 173 text_time=new time_marker; 174 text_time=new time_marker; 174 175 else 175 176 text_time=NULL; 176 177 } 177 } else text_time=new time_marker; 178 } else text_time=new time_marker; 178 179 } else if (arg==text_symbol) done=1; 179 180 wm->flush_screen(); 180 181 wm->flush_screen(); 181 182 while (wm->event_waiting()) 182 { 183 event ev; 183 { 184 event ev; 184 185 wm->get_event(ev); 185 186 if (ev.type==EV_KEY) … … 204 205 case JK_ESC : set_abort(1); done=1; break; 205 206 case JK_ENTER : done=1; break; 206 } 207 } 207 } 208 } 208 209 } 209 210 } -
abuse/trunk/src/director.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/endgame.cpp
r492 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 { 44 45 mask_line *p=(mask_line *)malloc(mask->height()*sizeof(mask_line)); 45 for (int y=0; y<mask->height();y++)46 for (int y=0; y<mask->height(); y++) 46 47 { 47 48 // find the start of the run.. … … 63 64 uint16_t *rem=p[y].remap; 64 65 uint8_t *lrem=p[y].light; 65 for (x=0; x<size;x++,rem++)66 for (x=0; x<size; x++,rem++) 66 67 { 67 68 *(lrem++)=*(sl_start++); … … 90 91 uint8_t *l; 91 92 92 for (; y<mask_height;y++)93 for (; y<mask_height; y++) 93 94 { 94 95 mask_line *n=p+y; … … 100 101 if (sx+n->x<x1) x1=sx+n->x; 101 102 int x=0; 102 for (; x<n->size;x++,sl++,rem++,l++)103 for (; x<n->size; x++,sl++,rem++,l++) 103 104 { 104 105 r=*rem; … … 117 118 118 119 uint8_t c=color_table->lookup_color(r3>>3,g3>>3,b3>>3); 119 120 120 121 *sl=*(white_light+((*l)/2+28+jrand()%4)*256+c); 121 122 … … 162 163 int explo_frames1[8],explo_frames2[7]; 163 164 164 for (i=0; i<8;i++)165 for (i=0; i<8; i++) 165 166 { char nm[100]; sprintf(nm,"small_wite%04d.pcx",i+1); 166 167 explo_frames1[i]=cache.reg("art/exp1.spe",nm,SPEC_CHARACTER,1); 167 168 } 168 169 169 for (i=0; i<7;i++)170 for (i=0; i<7; i++) 170 171 { char nm[100]; sprintf(nm,"small_fire%04d.pcx",i+1); 171 172 explo_frames2[i]=cache.reg("art/exp1.spe",nm,SPEC_CHARACTER,1); … … 183 184 184 185 screen->clear(); 185 int c[4]={ pal->find_closest(222,222,22),186 int c[4]={ pal->find_closest(222,222,22), 186 187 pal->find_closest(200,200,200), 187 188 pal->find_closest(100,100,100), … … 189 190 uint16_t sinfo[800*3],*si; 190 191 191 for (si=sinfo,i=0; i<800;i++)192 for (si=sinfo,i=0; i<800; i++) 192 193 { 193 194 *(si++)=jrand()%320; … … 199 200 if (old_pal) 200 201 { 201 for (i=0; i<256;i++)202 for (i=0; i<256; i++) 202 203 paddr[i]=(old_pal->red(i)<<16)|(old_pal->green(i)<<8)|(old_pal->blue(i)); 203 204 } 204 205 else 205 206 { 206 for (i=0; i<256;i++)207 for (i=0; i<256; i++) 207 208 paddr[i]=(pal->red(i)<<16)|(pal->green(i)<<8)|(pal->blue(i)); 208 209 } … … 219 220 220 221 221 for (i=0; i<80;)222 for (i=0; i<80; ) 222 223 { 223 224 time_marker new_time; … … 230 231 screen->clear(); 231 232 int j; 232 for (si=sinfo,j=0; j<800;j++,si+=3)233 for (si=sinfo,j=0; j<800; j++,si+=3) 233 234 screen->putpixel(dx+si[0],dy+si[1],si[2]); 234 235 … … 271 272 272 273 ex_char *clist=NULL; 273 for (i=0; i<200;)274 for (i=0; i<200; ) 274 275 { 275 276 time_marker new_time; … … 282 283 screen->clear(); 283 284 int j; 284 for (si=sinfo,j=0; j<800;j++,si+=3)285 for (si=sinfo,j=0; j<800; j++,si+=3) 285 286 screen->putpixel(dx+si[0],dy+si[1],si[2]); 286 287 … … 305 306 306 307 ex_char *c=clist,*last=NULL; 307 for (; c;)308 for (; c; ) 308 309 { 309 310 c->frame++; … … 318 319 { 319 320 last=c; 320 if (c->char_num) 321 cache.fig(explo_frames2[c->frame])->forward->put_image(screen,c->x,c->y); 321 if (c->char_num) 322 cache.fig(explo_frames2[c->frame])->forward->put_image(screen,c->x,c->y); 322 323 323 324 c->x-=3; 324 325 c=c->next; 325 } 326 } 326 327 } 327 328 … … 336 337 screen->clear(); 337 338 int j; 338 for (si=sinfo,j=0; j<800;j++,si+=3)339 for (si=sinfo,j=0; j<800; j++,si+=3) 339 340 screen->putpixel(si[0],si[1],si[2]); 340 341 … … 367 368 368 369 uint8_t cmap[32]; 369 for (i=0; i<32;i++)370 for (i=0; i<32; i++) 370 371 cmap[i]=pal->find_closest(i*256/32,i*256/32,i*256/32); 371 372 … … 376 377 377 378 ev.type=EV_SPURIOUS; 378 for (i=0; i<320 && ev.type!=EV_KEY;i++)379 for (i=0; i<320 && ev.type!=EV_KEY; i++) 379 380 { 380 381 screen->clear(); 381 382 int j; 382 for (si=sinfo,j=0; j<800;j++,si+=3)383 for (si=sinfo,j=0; j<800; j++,si+=3) 383 384 screen->putpixel(dx+si[0],dy+si[1],si[2]); 384 385 … … 396 397 397 398 398 for (i=0; i<cache.img(mask)->height();i++)399 for (i=0; i<cache.img(mask)->height(); i++) 399 400 { 400 401 free(p[i].remap); … … 441 442 uint8_t cmap[32]; 442 443 int i; 443 for (i=0; i<32;i++)444 for (i=0; i<32; i++) 444 445 cmap[i]=pal->find_closest(i*256/32,i*256/32,i*256/32); 445 446 446 447 event ev; ev.type=EV_SPURIOUS; 447 448 time_marker start; 448 for (i=0; i<320 && ev.type!=EV_KEY;i++)449 for (i=0; i<320 && ev.type!=EV_KEY; i++) 449 450 { 450 451 im->put_image(screen,dx,dy); … … 493 494 uint8_t cmap[32]; 494 495 int i; 495 for (i=0; i<32;i++)496 for (i=0; i<32; i++) 496 497 cmap[i]=pal->find_closest(i*256/32,i*256/32,i*256/32); 497 498 498 499 event ev; ev.type=EV_SPURIOUS; 499 500 time_marker start; 500 for (i=0; i<320 && ev.type!=EV_KEY;i++)501 for (i=0; i<320 && ev.type!=EV_KEY; i++) 501 502 { 502 503 im->put_image(screen,dx,dy); -
abuse/trunk/src/exitproc.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/extend.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 … … 52 53 if (!ls) return ; 53 54 ls->known=1; 54 for (int i=0; i<tlights;i++) if (lights[i]==ls) return;55 for (int i=0; i<tlights; i++) if (lights[i]==ls) return; 55 56 tlights++; 56 57 lights=(light_source **)realloc(lights,sizeof(light_source *)*tlights); … … 61 62 { 62 63 if (!o) return ; 63 for (int i=0; i<tobjs;i++) if (objs[i]==o) return;64 for (int i=0; i<tobjs; i++) if (objs[i]==o) return; 64 65 o->set_flags(o->flags()|KNOWN_FLAG); 65 66 if(_team != -1) … … 75 76 void simple_object::remove_light(light_source *ls) 76 77 { 77 for (int i=0; i<tlights;i++)78 for (int i=0; i<tlights; i++) 78 79 { 79 80 if (lights[i]==ls) 80 81 { 81 82 tlights--; 82 for (int j=i; j<tlights;j++) // don't even think about it :)83 for (int j=i; j<tlights; j++) // don't even think about it :) 83 84 lights[j]=lights[j+1]; 84 85 lights=(light_source **)realloc(lights,sizeof(light_source *)*tlights); … … 90 91 void simple_object::remove_object(game_object *o) 91 92 { 92 for (int i=0; i<tobjs;i++)93 for (int i=0; i<tobjs; i++) 93 94 { 94 95 if (objs[i]==o) 95 96 { 96 97 tobjs--; 97 for (int j=i; j<tobjs;j++) // don't even think about it :)98 for (int j=i; j<tobjs; j++) // don't even think about it :) 98 99 objs[j]=objs[j+1]; 99 100 objs=(game_object **)realloc(objs,sizeof(game_object *)*tobjs); -
abuse/trunk/src/extend.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/fakelib.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/fnt6x13.cpp
r56 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/game.cpp
r493 r494 1 1 /* 2 * Abuse - dark 2D side -scrolling platform game2 * 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/game.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/gamma.cpp
r492 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 … … 93 94 int tc = 32; 94 95 95 for(; i < tc; i++)96 for(; i < tc; i++) 96 97 { 97 98 gray_pal->set(i, i * 4, i * 4, i * 4); -
abuse/trunk/src/gamma.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/go.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 return new text_field(5,ystart+H*0,ELEVATOR_SPEED,"speed", "#####",speed, 35 36 new text_field(5,ystart+H*1,ELEVATOR_DIR,"heading dir", "#####",dir, 36 new text_field(5,ystart+H*2,ELEVATOR_DIRECTION,"facing dir", "#####",direction, 37 new text_field(5,ystart+H*2,ELEVATOR_DIRECTION,"facing dir", "#####",direction, 37 38 NULL))); 38 39 } … … 105 106 trans_image *p=picture(); 106 107 107 for (i=sy1; i<=sy2;i++)108 for (i=sy1; i<=sy2; i++) 108 109 p->put_scan_line(screen,sx,i,0); 109 110 } … … 147 148 int i; 148 149 game_object **o=current_level->obj; 149 for (i=current_level->first_object(); i>=0;i=o[i]->next_active)150 for (i=current_level->first_object(); i>=0; i=o[i]->next_active) 150 151 { 151 152 if (o[i]->type()==O_elcontrol) … … 168 169 switch (state) 169 170 { 170 case stopped : 171 case stopped : 171 172 { 172 173 long x1,y1,x2,y2; … … 204 205 set_state(still_jump); // we can start moving now 205 206 dir=dir+dir; 206 } 207 } 207 208 break; 208 209 case still_jump : // just stopped, open the doors … … 263 264 int i; 264 265 activate=-1; // if we can't fnd the name then go focus 265 for (i=0; i<TOTAL_OBJECTS;i++)266 for (i=0; i<TOTAL_OBJECTS; i++) 266 267 if (!strcmp(name,object_names[i])) 267 268 activate=i; … … 312 313 else 313 314 { 314 for (i=current_level->first_object(); i>=0;i=o[i]->next_active)315 for (i=current_level->first_object(); i>=0; i=o[i]->next_active) 315 316 { 316 317 long x1,y1,x2,y2; 317 318 if (o[i]->type()==activate) 318 { 319 { 319 320 o[i]->picture_space(x1,y1,x2,y2); 320 321 if (x+xrange>=x1 && x-xrange<=x2 && y+yrange>=y1 && y-yrange<=y2) 321 { 322 { 322 323 current_level->send_signal(signal); 323 324 return 1; // only send one signal! 324 } 325 } 325 326 } 326 327 } … … 360 361 signal=atoi(inm->get(SENSOR_SIGNAL)->read()); 361 362 get_activate(inm->get(SENSOR_ACTIVATE)->read()); 362 } 363 363 } 364 -
abuse/trunk/src/go.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/gui.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 blist=cur_but=butts; 27 28 act=0; 28 for (ifield *b=blist; b;b=b->next) { b->x=x; b->y=y; }29 for (ifield *b=blist; b; b=b->next) { b->x=x; b->y=y; } 29 30 while (cur_but && start_on--) cur_but=cur_but->next; 30 31 if (!cur_but) cur_but=blist; … … 38 39 y2=-10000; 39 40 int X1,Y1,X2,Y2; 40 for (ifield *b=blist; b;b=b->next)41 for (ifield *b=blist; b; b=b->next) 41 42 { 42 43 b->area(X1,Y1,X2,Y2); … … 52 53 { 53 54 ifield *last=NULL; 54 for (ifield *b=blist; b;b=b->next)55 for (ifield *b=blist; b; b=b->next) 55 56 { 56 57 if (b->id==id) -
abuse/trunk/src/gui.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/help.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/help.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/id.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 … … 49 50 DEV_LEDIT_R1, 50 51 DEV_LEDIT_R2, 51 52 52 53 53 54 DEV_MUSIC_PICKLIST, … … 127 128 ID_IPX, 128 129 ID_SPLIT_SCREEN, 129 130 130 131 ID_VOLUME, 131 132 ID_SFX_UP, … … 136 137 ID_MUSIC_OFF, 137 138 ID_SFX_CHANNELS, 138 139 139 140 ID_LIGHT_DETAIL, 140 141 ID_SCREEN_SIZE, … … 226 227 DEV_AREA_VIEW_XOFF_SPEED, 227 228 DEV_AREA_VIEW_YOFF_SPEED, 228 229 229 230 ID_START_GAME, 230 231 ID_EASY, … … 237 238 ID_RAISE_ALL, 238 239 SHOW_LINKS, 239 240 240 241 ID_RED_PICKER, 241 242 ID_GREEN_PICKER, … … 253 254 ID_PLAY_DEMO_OK, 254 255 ID_PLAY_DEMO_FILENAME 255 256 256 257 257 258 }; 258 259 -
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; … …