Changeset 494 for abuse/trunk


Ignore:
Timestamp:
Apr 17, 2011, 11:56:44 PM (12 years ago)
Author:
Sam Hocevar
Message:

style: remove trailing spaces, fix copyright statements.

Location:
abuse/trunk/src
Files:
217 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/ability.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    2627/ elcontrol /    0,      0,    0,    0,       0,     0,        0,       0,       0,
    2728/ no type  /     0,      0,    0,    0,       0,     0,        0,       0,       0
    28 } ;*/
     29} ; */
    2930
    3031
     
    4142
    4243long abil_def[TOTAL_ABILITIES]=
    43    {6,   3,     4,    2,    -16,   10,       6,         0,
     44   { 6,   3,     4,    2,    -16,   10,       6,         0,
    4445/* hp starta stopa jumpxv  jumpyv run_tops jmp_tops blood_type */
    4546
  • abuse/trunk/src/ability.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/ant.cpp

    r493 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    5152static int ant_congestion(game_object *o)
    5253{
    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)
    5455  {
    5556    if (d->otype==o->otype && abs(o->x-d->x)<30 && abs(o->x-d->y)<20) return 1;
     
    409410        o->x+=speed;
    410411        if (!o->next_picture()) o->set_state((character_state)S_top_walk);
    411    
     412
    412413      } else o->set_aistate(ANT_FALL_DOWN);
    413414    }
  • abuse/trunk/src/ant.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/automap.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    103104
    104105  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++)
    106107    foretiles[cur_lev->get_fg(x,y)]->micro_image->put_image(screen,i,j,0);
    107108
    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++)
    109110    foretiles[cur_lev->get_fg(x,y)]->micro_image->put_image(screen,i,j,0);
    110111
    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++)
    112113    foretiles[cur_lev->get_fg(x,y)]->micro_image->put_image(screen,i,j,0);
    113114
    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++)
    115116    foretiles[cur_lev->get_fg(x,y)]->micro_image->put_image(screen,i,j,0); */
    116117
     
    118119
    119120  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++)
    121122  {
    122123    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++)
    124125    {
    125126      if ((*fgline)&0x8000)
     
    199200        switch(ev.key)
    200201    {
    201       case 'A' :   
     202      case 'A' :
    202203      case 'a' :
    203204          toggle_window();
    204         break;   
    205     }
    206     break;   
     205        break;
     206    }
     207    break;
    207208      case EV_CLOSE_WINDOW :
    208209        wm->close_window(automap_window);
    209210    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  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/bus_type.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/cache.cpp

    r493 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    5455
    5556  int i,total=0;
    56   for (i=0;i<total_files;i++)
     57  for (i=0; i<total_files; i++)
    5758  {
    5859    int failed=0;
     
    8283  fp->write_uint16(total);
    8384  total=0;
    84   for (i=0;i<total_files;i++)
     85  for (i=0; i<total_files; i++)
    8586  {
    8687    uint32_t crc;
     
    111112    short total=fp->read_uint16();
    112113    int i;
    113     for (i=0;i<total;i++)
     114    for (i=0; i<total; i++)
    114115    {
    115116      char name[256];
     
    126127void CrcManager::clean_up()
    127128{
    128   for (int i=0;i<total_files;i++)
     129  for (int i=0; i<total_files; i++)
    129130    delete files[i];
    130131  if (total_files)
     
    153154int CrcManager::get_filenumber(char const *filename)
    154155{
    155   for (int i=0;i<total_files;i++)
     156  for (int i=0; i<total_files; i++)
    156157    if (!strcmp(filename,files[i]->filename)) return i;
    157158  total_files++;
     
    237238  size+=2;        // total filenames
    238239  int i;
    239   for (i=0;i<crc_manager.total_filenames();i++)
     240  for (i=0; i<crc_manager.total_filenames(); i++)
    240241      size+=strlen(crc_manager.get_filename(i))+2;    // filename + 0 + size of string
    241242
    242243  size+=4;       // number of entries saved
    243244
    244   for (i=0;i<total;i++)
     245  for (i=0; i<total; i++)
    245246    if (list[i].last_access>0)       // don't save unaccessed counts
    246247      size+=2+4+1;                   // filenumber & offset & type
     
    256257    int *ordered_ids=(int *)malloc(sizeof(int)*total);
    257258    int i;
    258     for (i=0;i<total;i++) ordered_ids[i]=i;
     259    for (i=0; i<total; i++) ordered_ids[i]=i;
    259260    qsort(ordered_ids,total,sizeof(int),c_sorter);
    260261
     
    262263    {
    263264      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++)
    265266      {
    266267    int l=strlen(crc_manager.get_filename(i))+1;
     
    270271
    271272      int tsaved=0;
    272       for (i=0;i<total;i++)
     273      for (i=0; i<total; i++)
    273274        if (list[i].last_access>0) tsaved++;
    274275      fp->write_uint32(tsaved);
    275276
    276       for (i=0;i<total;i++)
     277      for (i=0; i<total; i++)
    277278      {
    278279    int id=ordered_ids[i];
     
    348349{
    349350  int i;
    350   for (i=0;i<total_objects;i++)
     351  for (i=0; i<total_objects; i++)
    351352  {
    352353    if (figures[i]->get_cflag(CFLAG_NEED_CACHE_IN))
     
    428429  game_object *f;
    429430  int i;
    430   for (i=0;i<total_objects;i++)                       // mark all types as not needing loading
     431  for (i=0; i<total_objects; i++)                       // mark all types as not needing loading
    431432    figures[i]->set_cflag(CFLAG_NEED_CACHE_IN,0);
    432433
    433   for (f=lev->first_object();f;f=f->next)               // go through each object and get requested items to cache in
     434  for (f=lev->first_object(); f; f=f->next)               // go through each object and get requested items to cache in
    434435    preload_cache_object(f->otype);
    435436
     
    437438  int j;
    438439  uint16_t *fg_line;
    439   for (j=0;j<lev->foreground_height();j++)
     440  for (j=0; j<lev->foreground_height(); j++)
    440441  {
    441442    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++)
    443444    {
    444445      int id=foretiles[fgvalue(*fg_line)];
     
    453454
    454455  uint16_t *bg_line;
    455   for (j=0;j<lev->background_height();j++)
     456  for (j=0; j<lev->background_height(); j++)
    456457  {
    457458    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++)
    459460    {
    460461      int id=backtiles[bgvalue(*bg_line)];
     
    474475{
    475476  int j;
    476   for (j=0;j<this->total;j++)
     477  for (j=0; j<this->total; j++)
    477478    if (list[j].last_access>=0)      // reset all loaded cache items to 0, all non-load to -1
    478479      list[j].last_access=0;
     
    500501
    501502    int i;
    502     for (i=0;i<tnames;i++)
     503    for (i=0; i<tnames; i++)
    503504    {
    504505      fp->read(name,fp->read_uint8());
     
    506507
    507508      int j;
    508       for (j=0;j<crc_manager.total_filenames();j++)
     509      for (j=0; j<crc_manager.total_filenames(); j++)
    509510        if (!strcmp(crc_manager.get_filename(j),name))
    510511          fnum_remap[i]=j;
    511512    }
    512    
     513
    513514    int tsaved = fp->read_uint32();
    514515
     
    519520
    520521    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;
    522523    qsort(sorted_id_list,total,sizeof(int),s_offset_compare);
    523524
    524     for (i=0;i<tsaved;i++)
     525    for (i=0; i<tsaved; i++)
    525526    {
    526527      fp->read_uint8(); // read type
     
    533534
    534535      // search for a match
    535       j=search(sorted_id_list,file_num,offset);   
     536      j=search(sorted_id_list,file_num,offset);
    536537      if (j!=-1)
    537       {   
     538      {
    538539        if (list[j].last_access<0)  // if not loaded
    539540          list[j].last_access=-2;      // mark as needing loading
     
    546547    free(sorted_id_list);            // was used for searching, no longer needed
    547548
    548     for (j=0;j<total;j++)
     549    for (j=0; j<total; j++)
    549550      if (list[j].last_access==0)
    550551        unmalloc(list+j);             // free any cache entries that are not accessed at all in the level
     
    553554    ful=0;
    554555    int tcached=0;
    555     for (j=0;j<total;j++)    // now load all of the objects until full
     556    for (j=0; j<total; j++)    // now load all of the objects until full
    556557    {
    557558//      stat_man->update(j*70/total+25);
     
    585586
    586587    last_access=tmatches+1;
    587     for (i=0;i<tsaved;i++)      // reorder the last access of each cache to reflect prioirties
     588    for (i=0; i<tsaved; i++)      // reorder the last access of each cache to reflect prioirties
    588589    {
    589590      if (priority[i]!=-1)
     
    605606  {
    606607    int j;
    607     for (j=0;j<total;j++)    // now load all of the objects until full, don't free old stuff
     608    for (j=0; j<total; j++)    // now load all of the objects until full, don't free old stuff
    608609    {
    609610//      stat_man->update(j*70/total+25);
     
    646647  {
    647648    int i=0;
    648     for (;i<total;i++)
     649    for (; i<total; i++)
    649650    {
    650651      if (list[i].last_access>=poll_start_access)
     
    742743void CacheList::empty()
    743744{
    744   for (int i=0;i<total;i++)
     745  for (int i=0; i<total; i++)
    745746  {
    746747    if (list[i].file_number>=0 && list[i].last_access!=-1)
     
    830831    int i;
    831832    CacheItem *ci=list;
    832     for (i=0,id=-1;i<total && id<0;i++,ci++)        // scan list for a free id
     833    for (i=0,id=-1; i<total && id<0; i++,ci++)        // scan list for a free id
    833834    {
    834835      if (ci->file_number<0)
     
    840841      int add_size=20;
    841842      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++)
    843844      {
    844845        list[total+i].file_number=-1;         // mark new entries as new
     
    873874    cache_read_file=NULL;
    874875
    875     cache_file=new jFILE(lfname,"ab");   
     876    cache_file=new jFILE(lfname,"ab");
    876877      } else cache_file=new jFILE(lfname,"wb");     // first time we opened
    877878    }
     
    990991    if (rm_dups)
    991992    {
    992         for (i=0;i<total;i++)
     993        for (i=0; i<total; i++)
    993994            if (list[i].file_number == fn && (unsigned)list[i].offset == se->offset)
    994995                return i;
     
    10091010  CacheItem *ci=list;
    10101011  last_access=-1;
    1011   for (j=0;j<total;j++,ci++)
     1012  for (j=0; j<total; j++,ci++)
    10121013  {
    10131014    if (ci->last_access>=0)
     
    12291230    new_old=NULL;
    12301231    ci=list;
    1231     for (int i=0;i<total;i++,ci++)
     1232    for (int i=0; i<total; i++,ci++)
    12321233    {
    12331234      if (ci->last_access<old && ci->last_access>0 && ci->last_access>new_old_accessed)
  • abuse/trunk/src/cache.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/chars.cpp

    r493 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    4546
    4647                   "morph_pose",
    47            
     48
    4849                   "walking",
    49            
     50
    5051
    5152                   "weapon_draw",
     
    150151  cflags|=1<<CFLAG_CACHED_IN;
    151152
    152   for (i=0;i<ts;i++)
     153  for (i=0; i<ts; i++)
    153154  {
    154155    if (seq[i])
     
    250251    /* locate a free index in the index list */
    251252    int free_index=tiv;
    252     for (int i=0;i<tiv;i++)
     253    for (int i=0; i<tiv; i++)
    253254      if (!vars[i] && i<tiv) free_index=i;
    254255    if (free_index==tiv)
     
    279280{
    280281  int i=0;
    281   for (;i<TOTAL_OBJECT_VARS;i++)
     282  for (; i<TOTAL_OBJECT_VARS; i++)
    282283  {
    283284    if (!strcmp(object_descriptions[i].name,name))
    284285      return 1;
    285286  }
    286   for (i=0;i<tiv;i++)
     287  for (i=0; i<tiv; i++)
    287288    if (!strcmp(lstring_value(((LSymbol *)vars[i])->GetName()),name))
    288289      return 1;
     
    321322  draw_rangex=draw_rangey=0;
    322323
    323   for (i=0;i<TOTAL_ABILITIES;i++)
     324  for (i=0; i<TOTAL_ABILITIES; i++)
    324325    abil[i]=get_ability_default((ability)i);
    325326  void *field=args;
    326327  PtrRef r7(field);
    327   for (;field;field=CDR(field))
     328  for (; field; field=CDR(field))
    328329  {
    329330    void *f=CAR(CAR(field));
     
    334335      void *l=CDR(CAR(field));
    335336      PtrRef r4(l);
    336       for (i=0;i<TOTAL_ABILITIES;i++)
     337      for (i=0; i<TOTAL_ABILITIES; i++)
    337338      {
    338339    Cell *ab=assoc(LSymbol::FindOrCreate(ability_names[i]),l);
     
    345346      void *l=CDR(CAR(field));
    346347      PtrRef r4(l);
    347       for (i=0;i<TOTAL_OFUNS;i++)
     348      for (i=0; i<TOTAL_OFUNS; i++)
    348349      {
    349350    Cell *ab=assoc(LSymbol::FindOrCreate(ofun_names[i]),l);
     
    356357      void *l=CDR(CAR(field));
    357358      PtrRef r4(l);
    358       for (i=0;i<TOTAL_CFLAGS;i++)
     359      for (i=0; i<TOTAL_CFLAGS; i++)
    359360      {
    360361    Cell *ab=assoc(LSymbol::FindOrCreate(cflag_names[i]),l);
     
    502503      char *name=lstring_value(lcar(lcar(mf)));
    503504      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++)
    505506        if (!strcmp(default_simple.var_name(i),name))
    506507      find=i;
     
    510511    printf("fields : no such var name \"%s\"\n",name);
    511512    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));
    513514    printf("\n");
    514515    exit(0);
     
    551552character_type::~character_type()
    552553{
    553   for (int i=0;i<ts;i++)
     554  for (int i=0; i<ts; i++)
    554555    if (seq[i])
    555556      delete seq[i];
     
    558559  if (total_fields)
    559560  {
    560     for (int i=0;i<total_fields;i++)
     561    for (int i=0; i<total_fields; i++)
    561562      delete fields[i];
    562563    free(fields);
  • abuse/trunk/src/chars.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    2627    dead,
    2728    dieing,
    28     stopped,       
     29    stopped,
    2930    start_run_jump, run_jump, run_jump_fall, end_run_jump,
    3031    flinch_up, flinch_down,
  • abuse/trunk/src/chat.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/chat.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/clisp.cpp

    r493 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    187188
    188189  int i;
    189   for (i=0;i<MAX_STATE;i++)
     190  for (i=0; i<MAX_STATE; i++)
    190191    LSymbol::FindOrCreate(state_names[i])->SetNumber(i);
    191   for (i=0;i<TOTAL_ABILITIES;i++)
     192  for (i=0; i<TOTAL_ABILITIES; i++)
    192193    LSymbol::FindOrCreate(ability_names[i])->SetNumber(i);
    193   for (i=0;i<TOTAL_CFLAGS;i++)
     194  for (i=0; i<TOTAL_CFLAGS; i++)
    194195    LSymbol::FindOrCreate(cflag_names[i])->SetNumber(i);
    195196
     
    682683      game_object *old_cur=current_object;
    683684      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      {
    686687    current_object=old_cur->get_object(i);
    687688    ret=eval(CAR(args));
     
    716717      args=CDR(args);
    717718      time_marker start;
    718       for (int x=0;x<trials;x++)
     719      for (int x=0; x<trials; x++)
    719720      {
    720721    clear_tmp();
     
    955956
    956957    char *s=filename,*tp;
    957    
    958     for (tp=tmp;*s;s++,tp++)
     958
     959    for (tp=tmp; *s; s++,tp++)
    959960    {
    960961      if (*s=='/' || *s=='\\')
     
    975976      {
    976977    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]); }
    979980    free(files);
    980981
    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]); }
    982983    free(dirs);
    983    
     984
    984985    push_onto_list(dl,rl);
    985986    push_onto_list(fl,rl);
     
    10091010      if (last>=first)
    10101011      {
    1011         for (i=last;i>=first;i--)
     1012        for (i=last; i>=first; i--)
    10121013        {
    10131014          sprintf(name2,"%s%04ld.pcx",name,i);
     
    10161017      } else
    10171018      {
    1018         for (i=last;i<=first;i++)
     1019        for (i=last; i<=first; i++)
    10191020        {
    10201021          sprintf(name2,"%s%04ld.pcx",name,i);
     
    14901491      if (!v) dprintf("Can't use reset_player on non-players\n");
    14911492      else
    1492         v->reset_player();   
     1493        v->reset_player();
    14931494    } break;
    14941495    case 153 :
     
    15241525      if (ang1>ang2)
    15251526      {
    1526         if (ang<ang1 && ang>ang2)     
     1527        if (ang<ang1 && ang>ang2)
    15271528      return 0;
    1528     else if (ang>=ang1)   
     1529    else if (ang>=ang1)
    15291530      f=(ang-ang1)*tframes/(359-ang1+ang2+1);
    15301531    else
     
    16291630      int x=current_object->total_objects();
    16301631      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++)
    16321633        if (current_object->get_object(i)==who) return 1;
    16331634      return 0;
     
    16541655      if (x<0 || y<0 || x>=current_level->foreground_width() || y>=current_level->foreground_width())
    16551656        lbreak("%d %d is out of range of fg map",x,y);
    1656       else   
     1657      else
    16571658        current_level->put_fg(x,y,type);
    16581659    } break;
     
    16721673      if (x<0 || y<0 || x>=current_level->background_width() || y>=current_level->background_width())
    16731674        lbreak("%d %d is out of range of fg map",x,y);
    1674       else   
     1675      else
    16751676        current_level->put_bg(x,y,type);
    16761677    } break;
     
    19061907      int ga=lnumber_value(CAR(args)); args=CDR(args);
    19071908      int ba=lnumber_value(CAR(args));
    1908       for (int i=0;i<256;i++)
     1909      for (int i=0; i<256; i++)
    19091910      {
    19101911    r=(int)*addr+ra; if (r>255) r=255; else if (r<0) r=0; *addr=(uint8_t)r; addr++;
     
    19301931    if (x<0 || x>=total_weapons)
    19311932    { lbreak("weapon out of range (%d)\n",x); exit(0); }
    1932     v->current_weapon=x;   
     1933    v->current_weapon=x;
    19331934      }
    19341935    } break;
     
    19451946
    19461947    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;
    19481949
    19491950    case 234 :
     
    22462247      {
    22472248    view *v=player_list;
    2248     for (;v;v=v->next)
     2249    for (; v; v=v->next)
    22492250       if (v->kills>=main_net_cfg->kills)
    22502251         return 1;
    2251    
     2252
    22522253
    22532254      } else return 0;
     
    22562257    {
    22572258      view *v=player_list;
    2258       for (;v;v=v->next)
     2259      for (; v; v=v->next)
    22592260      {
    22602261    v->tkills+=v->kills;
     
    22672268    v->reset_player();
    22682269    v->focus->set_aistate(0);
    2269     current_object=o;   
     2270    current_object=o;
    22702271      }
    22712272
     
    23232324      case L_NUMBER :
    23242325      { return lnumber_value(v); } break;
    2325       default : return def;       
     2326      default : return def;
    23262327    }
    23272328  } else return def;
  • abuse/trunk/src/clisp.h

    r492 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/collide.cpp

    r490 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    5152{
    5253  collide_patch *next;
    53   for (collide_patch *p=first;p;p=next)
     54  for (collide_patch *p=first; p; p=next)
    5455  {
    5556    next=p->next;
     
    161162  int32_t sx1,sy1,sx2,sy2,tx1,ty1,tx2,ty2,hitx=0,hity=0,t_centerx;
    162163
    163   for (int l=0;l<attack_total;l++)
     164  for (int l=0; l<attack_total; l++)
    164165  {
    165166    subject=attack_list[l];
     
    168169
    169170
    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];
    173174      target->picture_space(tx1,ty1,tx2,ty2);
    174175      if (!(sx2<tx1 || sy2<ty1 || sx1>tx2 || sy1>ty2))  // check to see if picture spaces collide
     
    181182      t_centerx=target->x_center();
    182183      point_list *s_hit,*t_damage;
    183    
     184
    184185      s_hit=subject->current_figure()->hit;
    185186
     
    191192      unsigned char *s_dat=s_hit->data,*t_dat;
    192193      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--)
    196197        {
    197198          int32_t x1,y1,x2,y2,          // define the two line segments to check
    198199          xp1,yp1,xp2,yp2;
    199200
    200           xp1=target->x+target->tx(*t_dat);  t_dat++;   
     201          xp1=target->x+target->tx(*t_dat);  t_dat++;
    201202          yp1=target->y+target->ty(*t_dat);  t_dat++;
    202203          xp2=target->x+target->tx(*t_dat);
     
    207208          x2=subject->x+subject->tx(s_dat[2]);
    208209          y2=subject->y+subject->ty(s_dat[3]);
    209    
     210
    210211
    211212          // ok, now we know which line segemnts to check for intersection
    212213          // 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;
    214215          setback_intersect(x1, y1, x2, y2, xp1, yp1, xp2, yp2,0);
    215216
     
    223224        }
    224225        s_dat+=2;
    225       }       
     226      }
    226227    }
    227228      }
  • abuse/trunk/src/compiled.cpp

    r492 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/compiled.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    2930        S_LINK_SND,S_DELETE_SND;
    3031
    31    
     32
    3233
    3334void compiled_init();
  • abuse/trunk/src/configuration.cpp

    r492 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/configuration.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/console.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    3536    char *s=screen;
    3637    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)
    4041      {
    4142    if (*s)
  • abuse/trunk/src/console.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    4647  public :
    4748  shell_term(JCFont *font, int width, int height, char const *Name);
    48   virtual ~shell_term() {};
     49  virtual ~shell_term() { };
    4950  int handle_event(event &ev);
    5051  virtual void prompt();
  • abuse/trunk/src/control.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    4041  set_state(stopped);
    4142
    42   the_game->change_logos(abilities,cur_char);*/
     43  the_game->change_logos(abilities,cur_char); */
    4344
    4445}
  • abuse/trunk/src/control.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/cop.cpp

    r493 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    154155    int best_diff=200,best_num=0;
    155156    int iy=f[1],ix=f[6*2];
    156    
     157
    157158    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 wise
     159    for (i=0; i<24; i++,f+=2)             // check all the angles to see which would best fit animation wise
    159160    {
    160161      int this_angle=lisp_atan2(f[1]-iy,f[0]-ix);
     
    174175    else
    175176      o->lvars[point_angle]=lisp_atan2(q->y-fb[1]-v->pointer_y,v->pointer_x-(q->x+fb[0]));
    176    
     177
    177178
    178179    if (q->direction<0)
     
    302303    o->lvars[fire_delay1]=6;
    303304    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 ))
    305306          ret=LNumber::Create(-1);
    306307    else ret=LNumber::Create(0);
     
    328329      {
    329330    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))
    331332          ret=LNumber::Create(-1);
    332333    else ret=LNumber::Create(0);
     
    383384    {
    384385      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)
    386387      {
    387388        xd=abs(p->x-o->x);
     
    389390        if (xd<160 && yd<130 && bad_guy_array[p->otype] && p!=other)
    390391        {
    391           if (p->targetable() &&       
     392          if (p->targetable() &&
    392393          !(p->otype==S_ROCKET && p->total_objects() && p->get_object(0)==bot))  // don't track onto own missles
    393394          {
     
    402403      }
    403404    }
    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))
    405406          ret=LNumber::Create(-1);
    406407    else ret=LNumber::Create(0);
     
    530531
    531532    if (o->current_frame==0) o->current_frame=9;
    532       o->current_frame--;   
     533      o->current_frame--;
    533534
    534535/*    if (o->lvars[special_power]==FAST_POWER)
     
    545546    }
    546547    else */ o->y+=3;
    547    
     548
    548549
    549550      } else if (ym<0)
     
    568569      else
    569570      { 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));
    571572      }
    572573    }
     
    633634      {
    634635    o->set_aistate(2);                // go to deing state
    635     o->set_state(dead);   
     636    o->set_state(dead);
    636637      }
    637638      else
    638639      {
    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
    640641      the_game->play_sound(S_LOW_HEALTH_SND,127,o->x,o->y);
    641642    else if (o->hp()<15 && (current_level->tick_counter()%8)==0) // if low on health play heart beat
     
    651652    top->x=o->x;
    652653    top->y=o->y+29-top->picture()->height();
    653    
     654
    654655    if ((but&2) && !o->lvars[is_teleporting] && o->state!=S_climbing && o->state!=S_climb_off)
    655656    {
     
    662663
    663664      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);
    665666      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      }
    669670    } else if (o->aistate()==3)
    670671    {
     
    693694  {
    694695    game_object *other=o->get_object(0);
    695     for (;f;f=f->next)
     696    for (; f; f=f->next)
    696697    {
    697698      int mex=f->focus->x;
     
    702703    if (f->focus->state==S_climbing)
    703704      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;
    705706      }
    706707    }
     
    803804    int ra,ga,ba;
    804805
    805     for (int i=0;i<256;i++)
     806    for (int i=0; i<256; i++)
    806807    {
    807808      ra=(int)*addr+r; if (ra>255) ra=255; else if (ra<0) r=0; *addr=(uint8_t)ra; addr++;
     
    877878    else
    878879      o->draw_predator();
    879    
     880
    880881    if (o->controller() && o->controller()->local_player())
    881882      cache.img(S_sneaky_image)->put_image(screen,o->controller()->cx2-20,
     
    956957  }
    957958  return true_symbol;
    958 }   
     959}
    959960
    960961
     
    10021003  int tp=0;
    10031004  view *f=player_list;
    1004   for (;f;f=f->next)
     1005  for (; f; f=f->next)
    10051006  {
    10061007    sorted_players[tp]=f;
     
    10191020
    10201021    int i;
    1021     for (i=0;i<tp;i++)
     1022    for (i=0; i<tp; i++)
    10221023    {
    10231024      int color=lnumber_value(((LArray *)((LSymbol *)l_player_text_color)->GetValue())->Get(sorted_players[i]->get_tint()));
     
    10481049
    10491050  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++;
    10511052
    10521053  int y=(y1+y2)/2-(tp+2)*fnt->height()/2,x=x1+10;
     
    10591060  y+=fnt->height();
    10601061  v=player_list;
    1061   for (i=0;i<tp;i++)
     1062  for (i=0; i<tp; i++)
    10621063  {
    10631064    enum { NAME_LEN=18 } ;
  • abuse/trunk/src/cop.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/crc.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    4344    {
    4445      l-=nr;
    45       for (c=buffer;nr;nr--,c++)
     46      for (c=buffer; nr; nr--,c++)
    4647      {
    4748    crc1+=*c;
  • abuse/trunk/src/crc.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/demo.cpp

    r484 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    100101      base->packet.packet_reset();       // reset input buffer
    101102      view *p=player_list;               // get current inputs
    102       for (;p;p=p->next)
     103      for (; p; p=p->next)
    103104        if (p->local_player())
    104105          p->get_input();
     
    139140
    140141  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(); }
    142143
    143144  last_demo_mx=last_demo_my=last_demo_mbut=0;
     
    208209
    209210      view *v=player_list;
    210       for (;v;v=v->next)  // reset all the players
     211      for (; v; v=v->next)  // reset all the players
    211212      { if (v->focus) { v->reset_player(); v->focus->set_aistate(0); } }
    212213      delete current_level;
  • abuse/trunk/src/demo.h

    r492 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/dev.cpp

    r492 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    126127};
    127128
    128 int dev_mode_ids[DEV_MODES]={ID_DMODE_DRAW,ID_DMODE_PICK, ID_DMODE_AREA};
     129int dev_mode_ids[DEV_MODES]={ ID_DMODE_DRAW,ID_DMODE_PICK, ID_DMODE_AREA};
    129130
    130131int edit_mode=ID_DMODE_DRAW;
     
    208209  int total=0,number=0;
    209210  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)
    211212  {
    212213    if (c->otype==who->otype)
     
    256257    int type=-1;    // see if this type exsists
    257258    int i;
    258     for (i=0;i<total_objects;i++)
     259    for (i=0; i<total_objects; i++)
    259260      if (!strcmp(object_names[i],name))
    260261        type=i;
     
    272273      else
    273274        first=search_object->next;
    274       for (;!find && first;first=first->next)
     275      for (; !find && first; first=first->next)
    275276        if (first->otype==type)
    276277      find=first;
     
    278279      if (!find)
    279280      {
    280     for (first=current_level->first_object();first && !find;first=first->next)
     281    for (first=current_level->first_object(); first && !find; first=first->next)
    281282    {
    282283      if (first->otype==type)
     
    359360  dev_backward=cache.reg(artf,"backward",SPEC_IMAGE,0);
    360361
    361   for (int i=0;i<DEV_MODES;i++)
     362  for (int i=0; i<DEV_MODES; i++)
    362363    dev_mode_icon[i]=cache.reg(artf,dev_mode_icon_names[i],SPEC_IMAGE,0);
    363364
     
    394395  screen->lock();
    395396  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)
    397398  {
    398399    sl1=im->scan_line(iy>>16);
    399400    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++)
    401402      *sl2=sl1[ix>>16];
    402403  }
     
    436437  uint8_t d;
    437438  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)
    439440  {
    440441    sl1=im->scan_line(iy>>16);
    441442    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++)
    443444    {
    444445      d=sl1[ix>>16];
     
    476477    if (dev&DRAW_LINKS)
    477478    {
    478       for (light_source *f=first_light_source;f;f=f->next)
     479      for (light_source *f=first_light_source; f; f=f->next)
    479480      {
    480481    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))
     
    506507    game_object *o;
    507508    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)
    509510      {
    510511    the_game->game_to_mouse(o->x,o->y,current_view,x1,y1);
     
    516517    {
    517518      // 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)
    519520      {
    520521    the_game->game_to_mouse(o->x,o->y,current_view,x1,y1);
    521522
    522523    int i=0;
    523     for (;i<o->total_objects();i++)
     524    for (; i<o->total_objects(); i++)
    524525    {
    525526      game_object *other=o->get_object(i);
     
    528529    }
    529530
    530     for (i=0;i<o->total_lights();i++)
     531    for (i=0; i<o->total_lights(); i++)
    531532    {
    532533      light_source *l=o->get_light(i);
     
    547548
    548549      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++)
    550551      {
    551552    game_object *other=selected_object->get_object(i);
     
    563564  image *i=cache.img(light_buttons[0]);
    564565  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)
    566567  {
    567568    if (x>=f->x-l && x<=f->x+l && y>=f->y-h && y<=f->y+h)
     
    585586    tbw_on=1;
    586587    int setx=0;
    587     for (int i=0;i<DEV_MODES;i++)
     588    for (int i=0; i<DEV_MODES; i++)
    588589    {
    589590      if (edit_mode==dev_mode_ids[i])
     
    686687static int get_omenu_item(int x)
    687688{
    688   for (int i=0;i<total_objects;i++)
     689  for (int i=0; i<total_objects; i++)
    689690    if (listable_objs[x]==object_names[i])
    690691      return i;
     
    833834  prop->load("defaults.prp");
    834835
    835   for (i=1;i<argc;i++)
     836  for (i=1; i<argc; i++)
    836837  {
    837838    if (!strcmp(argv[i],"-edit"))
     
    968969    eval(p);
    969970    l_user_stack.pop(1);
    970     for (int i=0;i<total_pals;i++)
     971    for (int i=0; i<total_pals; i++)
    971972      pal_wins[i]->close_window();
    972973  }
     
    986987
    987988  sscanf(command,"%s",fword);
    988   for (st=command;*st && *st!=' ';st++);
     989  for (st=command; *st && *st!=' '; st++);
    989990  if (*st) st++;
    990991  if (!strcmp(fword,"active"))
     
    10071008  {
    10081009    view *f=NULL;
    1009     for (f=player_list;f;f=f->next)
     1010    for (f=player_list; f; f=f->next)
    10101011    {
    10111012      int i;
    1012       for (i=0;i<total_weapons;i++)
     1013      for (i=0; i<total_weapons; i++)
    10131014    f->weapons[i]=-1;
    10141015
     
    10581059    l=(l+the_game->btile_width()-1)/the_game->btile_width();
    10591060    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++)
    10621063            the_game->put_bg(rx+x,ry+y,i++);
    10631064    dprintf("%dx%d\n",l,h);
     
    10691070  {
    10701071    view *v=the_game->first_view;
    1071     for (;v;v=v->next)
     1072    for (; v; v=v->next)
    10721073    {
    10731074      v->pan_x=0;
     
    11651166    sscanf(command,"%s%s",fword,oname);       // read the type of object to create
    11661167    int x,t=-1;
    1167     for (x=0;x<total_objects;x++)             // find the object type by name
     1168    for (x=0; x<total_objects; x++)             // find the object type by name
    11681169       if (!strcmp(object_names[x],oname))
    11691170         t=x;
     
    12091210  {
    12101211    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++)
    12131214        current_level->clear_fg(i,j);
    12141215  }
     
    13711372    int maxl=0;
    13721373    int i=0;
    1373     for (;i<figures[o->otype]->total_fields;i++)
     1374    for (; i<figures[o->otype]->total_fields; i++)
    13741375      if( strlen(figures[o->otype]->fields[i]->descript_name) > (unsigned)maxl )
    13751376        maxl=strlen(figures[o->otype]->fields[i]->descript_name);
     
    13771378    int owh=wh;
    13781379    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++)
    13801381    {
    13811382      char tmp[200];
    13821383      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--)
    13841385        strcat(tmp," ");
    13851386      int er;
     
    14751476      {
    14761477    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++)
    14781479    {
    14791480      x=atoi(f->read());
     
    15611562    int32_t mx=last_demo_mx,my=last_demo_my;
    15621563    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)
    15641565    {
    15651566      int32_t x1,y1,x2,y2;
     
    16391640  if (!current_level) return ;
    16401641
    1641   for (x=0;x<total_pals;x++)
     1642  for (x=0; x<total_pals; x++)
    16421643    pal_wins[x]->handle_event(ev);
    16431644  if (ev.type==EV_MOUSE_MOVE)
     
    23272328    case ID_GOD_MODE :
    23282329    {
    2329       for (view *v=player_list;v;v=v->next)
     2330      for (view *v=player_list; v; v=v->next)
    23302331        v->god=!v->god;
    23312332    } break;
     
    24042405        {
    24052406          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; }
    24072408          l->next=a->next;
    24082409          delete a;
     
    24202421      if (edit_object)
    24212422      {
    2422         for (int i=0;i<edit_object->total_objects();i++)
     2423        for (int i=0; i<edit_object->total_objects(); i++)
    24232424          edit_object->remove_object(edit_object->get_object(0));
    24242425        the_game->need_refresh();
     
    24302431      if (edit_object)
    24312432      {
    2432         for (int i=0;i<edit_object->total_lights();i++)
     2433        for (int i=0; i<edit_object->total_lights(); i++)
    24332434          edit_object->remove_light(edit_object->get_light(0));
    24342435        the_game->need_refresh();
     
    30043005    int th=the_game->ftile_height()/scale,tw=the_game->ftile_width()/scale;
    30053006
    3006     for (i=0;i<w*h;i++)
     3007    for (i=0; i<w*h; i++)
    30073008    {
    30083009      im->clear();
     
    30313032  {
    30323033    int i,dr=0;
    3033     for (i=0;i<w*h;i++)
     3034    for (i=0; i<w*h; i++)
    30343035    {
    30353036      if (pat[i]==d || pat[i]==last_selected)
     
    31233124        the_game->ftile_on(me->x,me->y,xs,ys);
    31243125
    3125         for (xx=xs;xx<xs+w;xx++)
     3126        for (xx=xs; xx<xs+w; xx++)
    31263127        {
    3127           for (yy=ys;yy<ys+h;yy++)
     3128          for (yy=ys; yy<ys+h; yy++)
    31283129          {
    31293130        if (xx>=0 && yy>=0 && xx<current_level->foreground_width() &&
     
    31593160  npat=(unsigned short *)malloc(sizeof(unsigned short)*(w+xa)*(h+ya));
    31603161  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++)
    31633164      if (i+j*w<w*h)
    31643165        npat[i+j*(w+xa)]=pat[i+j*w];
     
    31833184  fprintf(fp,"(add_palette \"%s\" %ld %ld %ld %ld %ld ",name,(long)w,(long)h,(long)x,(long)y,(long)scale);
    31843185  int i;
    3185   for (i=0;i<w*h;i++)
     3186  for (i=0; i<w*h; i++)
    31863187    fprintf(fp,"%d ",pat[i]&0x7fff);
    31873188  fprintf(fp,")\n");
     
    31993200
    32003201    int i;
    3201     for (i=0;i<total_pals;i++)
     3202    for (i=0; i<total_pals; i++)
    32023203    {
    32033204      pal_wins[i]->save(fp);
     
    32123213{
    32133214  int i;
    3214   for (i=0;i<total_pals;i++)
     3215  for (i=0; i<total_pals; i++)
    32153216    if (win==pal_wins[i]->me) return 1;
    32163217  return 0;
     
    33233324{
    33243325  int t=0;
    3325   for (int j=0;j<MAX_STATE;j++)
     3326  for (int j=0; j<MAX_STATE; j++)
    33263327  {
    33273328    if (figures[type]->has_sequence((character_state)j))
     
    33413342{
    33423343  int find=-1;
    3343   for (int i=0;i<total_objects;i++)
     3344  for (int i=0; i<total_objects; i++)
    33443345  {
    33453346    if (!strcmp(name,object_names[i]))
     
    33573358  int t=0,s=0;
    33583359  int i=0;
    3359   for (;i<nforetiles;i++)
     3360  for (; i<nforetiles; i++)
    33603361  {
    33613362    if (foretiles[i]>=0)
     
    33713372
    33723373  t=0; s=0;
    3373   for (i=0;i<nbacktiles;i++)
     3374  for (i=0; i<nbacktiles; i++)
    33743375  {
    33753376    if (backtiles[i]>=0)
     
    33853386
    33863387  t=0; s=0;
    3387   for (i=0;i<total_objects;i++)
     3388  for (i=0; i<total_objects; i++)
    33883389  {
    33893390    t++;
     
    34223423
    34233424static 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}
    34413442    };
    34423443
    34433444
    34443445static 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}
    34693470};
    34703471
     
    34733474// Window Menus
    34743475static 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}
    34873488    };
    34883489
     
    34913492/*
    34923493static 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}
    35103511    };
    35113512
    35123513
    35133514static 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}
    35383539};
    35393540
     
    35423543// Window Menus
    35433544static 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}
    35563557    };
    35573558
     
    36093610dev_controll::~dev_controll()
    36103611{
    3611   for (int i=0;i<total_pals;i++)
     3612  for (int i=0; i<total_pals; i++)
    36123613    delete pal_wins[i];
    36133614  if (total_pals)
  • abuse/trunk/src/dev.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    131132    dv = dev;
    132133  }
    133   virtual ~dev_term() {};
     134  virtual ~dev_term() { };
    134135  virtual void execute(char *st);
    135136} ;
  • abuse/trunk/src/devsel.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    9394
    9495  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++)
    9697  {
    9798    xo=x+((i-newx)%wid)*xw;
     
    100101      int blank=0;
    101102      if (i<t)
    102       {   
     103      {
    103104    switch (type)
    104105    {
     
    124125        else
    125126          scale_put(the_game->get_bg(i)->im,screen,xo,yo,xw,ya);
    126    
     127
    127128      } break;
    128129      case SPEC_CHARACTER :
     
    163164  {
    164165    case SPEC_FORETILE :
    165     {return cur_fg;} break;
     166    { return cur_fg; } break;
    166167    case SPEC_BACKTILE :
    167     {return cur_bg;} break;
     168    { return cur_bg; } break;
    168169    case SPEC_CHARACTER :
    169     {return cur_char;} break;
     170    { return cur_char; } break;
    170171  }
    171172  return 0;
     
    177178  {
    178179    case SPEC_FORETILE :
    179     {cur_fg=x;} break;
     180    { cur_fg=x; } break;
    180181    case SPEC_BACKTILE :
    181     {cur_bg=x;} break;
     182    { cur_bg=x; } break;
    182183    case SPEC_CHARACTER :
    183     {cur_char=x;} break;
     184    { cur_char=x; } break;
    184185  }
    185186}
  • abuse/trunk/src/devsel.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/director.cpp

    r492 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    6566
    6667      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++);
    6970
    7071      if (word_size<x2-x1) // make sure the word can fit on the screen
     
    161162            white_light+32*256,
    162163            wm->bright_color()
    163        
     164
    164165            ))
    165166        text=NULL;
     
    167168      {
    168169    if ((int)(cur_time.diff_time(text_time)*1000)>scroll_speed)
    169     {   
     170    {
    170171      text_y+=text_step;
    171172      delete text_time;
    172173      if (text)
    173         text_time=new time_marker;   
     174        text_time=new time_marker;
    174175      else
    175176        text_time=NULL;
    176177    }
    177       } else text_time=new time_marker;   
     178      } else text_time=new time_marker;
    178179    } else if (arg==text_symbol) done=1;
    179    
    180     wm->flush_screen();   
     180
     181    wm->flush_screen();
    181182    while (wm->event_waiting())
    182     {   
    183       event ev;   
     183    {
     184      event ev;
    184185      wm->get_event(ev);
    185186      if (ev.type==EV_KEY)
     
    204205        case JK_ESC : set_abort(1); done=1; break;
    205206        case JK_ENTER : done=1; break;
    206       }   
    207     }   
     207      }
     208    }
    208209      }
    209210    }
  • abuse/trunk/src/director.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/endgame.cpp

    r492 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    4344{
    4445  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++)
    4647  {
    4748    // find the start of the run..
     
    6364    uint16_t *rem=p[y].remap;
    6465    uint8_t *lrem=p[y].light;
    65     for (x=0;x<size;x++,rem++)
     66    for (x=0; x<size; x++,rem++)
    6667    {
    6768      *(lrem++)=*(sl_start++);
     
    9091  uint8_t *l;
    9192
    92   for (;y<mask_height;y++)
     93  for (; y<mask_height; y++)
    9394  {
    9495    mask_line *n=p+y;
     
    100101    if (sx+n->x<x1) x1=sx+n->x;
    101102    int x=0;
    102     for (;x<n->size;x++,sl++,rem++,l++)
     103    for (; x<n->size; x++,sl++,rem++,l++)
    103104    {
    104105      r=*rem;
     
    117118
    118119      uint8_t c=color_table->lookup_color(r3>>3,g3>>3,b3>>3);
    119                
     120
    120121      *sl=*(white_light+((*l)/2+28+jrand()%4)*256+c);
    121122
     
    162163  int explo_frames1[8],explo_frames2[7];
    163164
    164   for (i=0;i<8;i++)
     165  for (i=0; i<8; i++)
    165166  { char nm[100]; sprintf(nm,"small_wite%04d.pcx",i+1);
    166167    explo_frames1[i]=cache.reg("art/exp1.spe",nm,SPEC_CHARACTER,1);
    167168  }
    168169
    169   for (i=0;i<7;i++)
     170  for (i=0; i<7; i++)
    170171  { char nm[100]; sprintf(nm,"small_fire%04d.pcx",i+1);
    171172    explo_frames2[i]=cache.reg("art/exp1.spe",nm,SPEC_CHARACTER,1);
     
    183184
    184185  screen->clear();
    185   int c[4]={pal->find_closest(222,222,22),
     186  int c[4]={ pal->find_closest(222,222,22),
    186187        pal->find_closest(200,200,200),
    187188        pal->find_closest(100,100,100),
     
    189190  uint16_t sinfo[800*3],*si;
    190191
    191   for (si=sinfo,i=0;i<800;i++)
     192  for (si=sinfo,i=0; i<800; i++)
    192193  {
    193194    *(si++)=jrand()%320;
     
    199200  if (old_pal)
    200201  {
    201     for (i=0;i<256;i++)
     202    for (i=0; i<256; i++)
    202203      paddr[i]=(old_pal->red(i)<<16)|(old_pal->green(i)<<8)|(old_pal->blue(i));
    203204  }
    204205  else
    205206  {
    206     for (i=0;i<256;i++)
     207    for (i=0; i<256; i++)
    207208      paddr[i]=(pal->red(i)<<16)|(pal->green(i)<<8)|(pal->blue(i));
    208209  }
     
    219220
    220221
    221   for (i=0;i<80;)
     222  for (i=0; i<80; )
    222223  {
    223224    time_marker new_time;
     
    230231      screen->clear();
    231232      int j;
    232       for (si=sinfo,j=0;j<800;j++,si+=3)
     233      for (si=sinfo,j=0; j<800; j++,si+=3)
    233234        screen->putpixel(dx+si[0],dy+si[1],si[2]);
    234235
     
    271272
    272273  ex_char *clist=NULL;
    273   for (i=0;i<200;)
     274  for (i=0; i<200; )
    274275  {
    275276    time_marker new_time;
     
    282283      screen->clear();
    283284      int j;
    284       for (si=sinfo,j=0;j<800;j++,si+=3)
     285      for (si=sinfo,j=0; j<800; j++,si+=3)
    285286        screen->putpixel(dx+si[0],dy+si[1],si[2]);
    286287
     
    305306
    306307      ex_char *c=clist,*last=NULL;
    307       for (;c;)
     308      for (; c; )
    308309      {
    309310    c->frame++;
     
    318319    {
    319320      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);
    322323
    323324      c->x-=3;
    324325      c=c->next;
    325     }   
     326    }
    326327      }
    327328
     
    336337  screen->clear();
    337338  int j;
    338   for (si=sinfo,j=0;j<800;j++,si+=3)
     339  for (si=sinfo,j=0; j<800; j++,si+=3)
    339340    screen->putpixel(si[0],si[1],si[2]);
    340341
     
    367368
    368369  uint8_t cmap[32];
    369   for (i=0;i<32;i++)
     370  for (i=0; i<32; i++)
    370371    cmap[i]=pal->find_closest(i*256/32,i*256/32,i*256/32);
    371372
     
    376377
    377378  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++)
    379380  {
    380381    screen->clear();
    381382    int j;
    382     for (si=sinfo,j=0;j<800;j++,si+=3)
     383    for (si=sinfo,j=0; j<800; j++,si+=3)
    383384      screen->putpixel(dx+si[0],dy+si[1],si[2]);
    384385
     
    396397
    397398
    398   for (i=0;i<cache.img(mask)->height();i++)
     399  for (i=0; i<cache.img(mask)->height(); i++)
    399400  {
    400401    free(p[i].remap);
     
    441442  uint8_t cmap[32];
    442443  int i;
    443   for (i=0;i<32;i++)
     444  for (i=0; i<32; i++)
    444445    cmap[i]=pal->find_closest(i*256/32,i*256/32,i*256/32);
    445446
    446447  event ev; ev.type=EV_SPURIOUS;
    447448  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++)
    449450  {
    450451    im->put_image(screen,dx,dy);
     
    493494  uint8_t cmap[32];
    494495  int i;
    495   for (i=0;i<32;i++)
     496  for (i=0; i<32; i++)
    496497    cmap[i]=pal->find_closest(i*256/32,i*256/32,i*256/32);
    497498
    498499  event ev; ev.type=EV_SPURIOUS;
    499500  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++)
    501502  {
    502503    im->put_image(screen,dx,dy);
  • abuse/trunk/src/exitproc.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/extend.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    5253  if (!ls) return ;
    5354  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;
    5556  tlights++;
    5657  lights=(light_source **)realloc(lights,sizeof(light_source *)*tlights);
     
    6162{
    6263  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;
    6465  o->set_flags(o->flags()|KNOWN_FLAG);
    6566  if(_team != -1)
     
    7576void simple_object::remove_light(light_source *ls)
    7677{
    77   for (int i=0;i<tlights;i++)
     78  for (int i=0; i<tlights; i++)
    7879  {
    7980    if (lights[i]==ls)
    8081    {
    8182      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 :)
    8384        lights[j]=lights[j+1];
    8485      lights=(light_source **)realloc(lights,sizeof(light_source *)*tlights);
     
    9091void simple_object::remove_object(game_object *o)
    9192{
    92   for (int i=0;i<tobjs;i++)
     93  for (int i=0; i<tobjs; i++)
    9394  {
    9495    if (objs[i]==o)
    9596    {
    9697      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 :)
    9899        objs[j]=objs[j+1];
    99100      objs=(game_object **)realloc(objs,sizeof(game_object *)*tobjs);
  • abuse/trunk/src/extend.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/fakelib.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/fnt6x13.cpp

    r56 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/game.cpp

    r493 r494  
    11/*
    2  *  Abuse - dark 2D side - scrolling platform game
     2 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/game.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/gamma.cpp

    r492 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    9394        int tc = 32;
    9495
    95         for(;i < tc; i++)
     96        for(; i < tc; i++)
    9697        {
    9798            gray_pal->set(i, i * 4, i * 4, i * 4);
  • abuse/trunk/src/gamma.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/go.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    3435  return new text_field(5,ystart+H*0,ELEVATOR_SPEED,"speed",              "#####",speed,
    3536         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,
    3738            NULL)));
    3839}
     
    105106    trans_image *p=picture();
    106107
    107     for (i=sy1;i<=sy2;i++)
     108    for (i=sy1; i<=sy2; i++)
    108109      p->put_scan_line(screen,sx,i,0);
    109110  }
     
    147148  int i;
    148149  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)
    150151  {
    151152    if (o[i]->type()==O_elcontrol)
     
    168169    switch (state)
    169170    {
    170       case stopped :   
     171      case stopped :
    171172      {
    172173        long x1,y1,x2,y2;
     
    204205      set_state(still_jump);              // we can start moving now
    205206      dir=dir+dir;
    206     }   
     207    }
    207208    break;
    208209      case still_jump :                       // just stopped, open the doors
     
    263264  int i;
    264265  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++)
    266267    if (!strcmp(name,object_names[i]))
    267268      activate=i;
     
    312313  else
    313314  {
    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)
    315316    {
    316317      long x1,y1,x2,y2;
    317318      if (o[i]->type()==activate)
    318       {   
     319      {
    319320    o[i]->picture_space(x1,y1,x2,y2);
    320321    if (x+xrange>=x1 && x-xrange<=x2 && y+yrange>=y1 && y-yrange<=y2)
    321     {   
     322    {
    322323          current_level->send_signal(signal);
    323324      return 1;          // only send one signal!
    324     }   
     325    }
    325326      }
    326327    }
     
    360361  signal=atoi(inm->get(SENSOR_SIGNAL)->read());
    361362  get_activate(inm->get(SENSOR_ACTIVATE)->read());
    362 }           
    363 
     363}
     364
  • abuse/trunk/src/go.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/gui.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    2627  blist=cur_but=butts;
    2728  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; }
    2930  while (cur_but && start_on--) cur_but=cur_but->next;
    3031  if (!cur_but) cur_but=blist;
     
    3839  y2=-10000;
    3940  int X1,Y1,X2,Y2;
    40   for (ifield *b=blist;b;b=b->next)
     41  for (ifield *b=blist; b; b=b->next)
    4142  {
    4243    b->area(X1,Y1,X2,Y2);
     
    5253{
    5354  ifield *last=NULL;
    54   for (ifield *b=blist;b;b=b->next)
     55  for (ifield *b=blist; b; b=b->next)
    5556  {
    5657    if (b->id==id)
  • abuse/trunk/src/gui.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/help.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/help.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/id.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    4950    DEV_LEDIT_R1,
    5051    DEV_LEDIT_R2,
    51    
     52
    5253
    5354    DEV_MUSIC_PICKLIST,
     
    127128    ID_IPX,
    128129    ID_SPLIT_SCREEN,
    129    
     130
    130131    ID_VOLUME,
    131132    ID_SFX_UP,
     
    136137    ID_MUSIC_OFF,
    137138    ID_SFX_CHANNELS,
    138    
     139
    139140    ID_LIGHT_DETAIL,
    140141    ID_SCREEN_SIZE,
     
    226227    DEV_AREA_VIEW_XOFF_SPEED,
    227228    DEV_AREA_VIEW_YOFF_SPEED,
    228    
     229
    229230    ID_START_GAME,
    230231    ID_EASY,
     
    237238    ID_RAISE_ALL,
    238239    SHOW_LINKS,
    239    
     240
    240241    ID_RED_PICKER,
    241242    ID_GREEN_PICKER,
     
    253254    ID_PLAY_DEMO_OK,
    254255    ID_PLAY_DEMO_FILENAME
    255    
    256    
     256
     257
    257258};
    258259
  • abuse/trunk/src/imlib/bitmap.h

    r57 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/conio.h

    r57 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/convert.cpp

    r124 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    2627  if (STReq(argv[1],"2unix"))
    2728  { strip=1; add=0; }
    28   else {strip=0; add=1; }
     29  else { strip=0; add=1; }
    2930  printf("Converting...\n");
    30   for (i=2;i<argc;i++)
     31  for (i=2; i<argc; i++)
    3132  {
    3233    printf("  %s\n",argv[i]);
  • abuse/trunk/src/imlib/dprint.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/dprint.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/event.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/filesel.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    3435{
    3536  int i=0;
    36   for (;i<tf;i++)
     37  for (; i<tf; i++)
    3738    free(f[i]);
    38   for (i=0;i<td;i++)
     39  for (i=0; i<td; i++)
    3940    free(d[i]);
    4041  if (tf) free(f);
     
    6364      wid=0;
    6465      int i=0;
    65       for (;i<tf;i++)
     66      for (; i<tf; i++)
    6667      if ((int)strlen(f[i])>wid) wid=strlen(f[i]);
    67       for (i=0;i<td;i++)
     68      for (i=0; i<td; i++)
    6869      if ((int)strlen(d[i])+2>wid) wid=strlen(d[i])+2;
    6970      sx=0;
     
    109110  wid=0;
    110111  int i=0;
    111   for (;i<tf;i++)
     112  for (; i<tf; i++)
    112113    if ((int)strlen(f[i])>wid) wid=strlen(f[i]);
    113   for (i=0;i<td;i++)
     114  for (i=0; i<td; i++)
    114115    if ((int)strlen(d[i])+2>wid) wid=strlen(d[i])+2;
    115116  reconfigure();
  • abuse/trunk/src/imlib/filesel.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/filter.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    2627
    2728  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)
    2930  {
    3031    *p=to->find_closest(*r,*g,*b);
     
    4041{
    4142  int i;
    42   for (i=0;i<nc;i++)
     43  for (i=0; i<nc; i++)
    4344    fdat[i]=i;
    4445}
     
    4849  int i;
    4950  CONDITION(minv>=0 && minv<nc,"Bad minv");
    50   for (i=0;i<minv;i++)
     51  for (i=0; i<minv; i++)
    5152    fdat[i]=blank;
    5253}
     
    5657  int i;
    5758  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--)
    5960    fdat[i]=(unsigned) blank;
    6061}
     
    8384  CONDITION(im,"null image passed in filter::apply\n");
    8485  im->lock();
    85   for (y=im->height()-1;y>=0;y--)
     86  for (y=im->height()-1; y>=0; y--)
    8687  {
    8788    c=im->scan_line(y);
    88     for (x=im->width()-1;x>=0;x--)
     89    for (x=im->width()-1; x>=0; x--)
    8990    {
    9091      CONDITION((unsigned) c[x]<nc,"not enough filter colors");
     
    122123  int colors=1<<color_bits;
    123124  color_table=(unsigned char *)malloc(colors*colors*colors);
    124   for (r=0;r<colors;r++)
     125  for (r=0; r<colors; r++)
    125126  {
    126127    if (stat_fun) stat_fun(r);
    127128    rv=r<<lshift;
    128     for (g=0;g<colors;g++)
     129    for (g=0; g<colors; g++)
    129130    {
    130131      gv=g<<lshift;
    131       for (b=0;b<colors;b++)
     132      for (b=0; b<colors; b++)
    132133      {
    133134    bv=b<<lshift;
    134135        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++)
    136137        {
    137138          register long rd=*(pp++)-rv,
    138139                        gd=*(pp++)-gv,
    139140                        bd=*(pp++)-bv;
    140    
     141
    141142          dist_sqr=(long)rd*rd+(long)bd*bd+(long)gd*gd;
    142143          if (dist_sqr<best)
     
    220221        for(i = 0, source = &pg2[x1], dest = &pg1[x];
    221222            i < xl;
    222             i++, source++, dest++)   
     223            i++, source++, dest++)
    223224        {
    224225            if(!transparent || *source != current_background)
  • abuse/trunk/src/imlib/filter.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/fonts.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    6667  int ch;
    6768
    68   for (ch=0;ch<256;ch++)
     69  for (ch=0; ch<256; ch++)
    6970  {
    7071    tmp.clear();
     
    7879{
    7980  int ch;
    80   for (ch=0;ch<256;ch++)
     81  for (ch=0; ch<256; ch++)
    8182    delete let[ch];
    8283}
  • abuse/trunk/src/imlib/fonts.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/glview.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    4950    i++;
    5051  }
    51   for (j=0;j<100;j++)
     52  for (j=0; j<100; j++)
    5253  {
    53     for (k=1;k<t;k++)
     54    for (k=1; k<t; k++)
    5455    {
    5556      im[k]->put_image(screen,0,0);
     
    5859      screen->bar(0,0,im[k]->width(),im[k]->height(),0);
    5960    }
    60     for (k=t-1;k>0;k--)
     61    for (k=t-1; k>0; k--)
    6162    {
    6263      im[k]->put_image(screen,0,0);
  • abuse/trunk/src/imlib/guistat.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    9293    if (len2>len1) len3=len2; else len3=len1;
    9394    wx-=len3/2;
    94    
    95    
     95
     96
    9697    gui_status_node *p=first->next;
    9798    while (p && !p->stat_win) p=p->next;
  • abuse/trunk/src/imlib/guistat.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/image.cpp

    r490 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    11271128{
    11281129  int16_t x, y, i, j;
    1129   uint8_t dt_matrix[]={0,  136, 24, 170,
     1130  uint8_t dt_matrix[]={ 0,  136, 24, 170,
    11301131           68, 204, 102, 238,
    11311132           51, 187, 17, 153,
     
    13481349{
    13491350  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,
    13541355             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};
    13551356  int16_t xx, yy, zz;
     
    13721373}
    13731374
    1374 uint8_t dither_matrix[]={0,  136, 24, 170,
     1375uint8_t dither_matrix[]={ 0,  136, 24, 170,
    13751376             68, 204, 102, 238,
    13761377             51, 187, 17, 153,
  • abuse/trunk/src/imlib/image.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/include.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    1920  unsigned int j;
    2021  int append=0,i;
    21   for (j=0;j<strlen(name);j++)
     22  for (j=0; j<strlen(name); j++)
    2223    if (toupper(tmp_name[j])<'A' || toupper(tmp_name[j])>'Z')
    2324      tmp_name[j]='_';
     
    4142      fprintf(fp,"unsigned char %s_palette[256*3] = {\n    ",tmp_name);
    4243      unsigned char *p=(unsigned char *)pal->addr();
    43       for (i=0;i<768;i++,p++)
     44      for (i=0; i<768; i++,p++)
    4445      {
    4546    fprintf(fp,"%d",(int)*p);
     
    5556            im->width(),im->height());
    5657    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++)
    5960      {
    6061        fprintf(fp,"%d",(int)im->pixel(x,y));
  • abuse/trunk/src/imlib/include.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/input.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    3233void button_box::remap(filter *f)
    3334{
    34   for (button *b=buttons;b;b=(button *)b->next)
     35  for (button *b=buttons; b; b=(button *)b->next)
    3536    b->remap(f);
    3637}
     
    3940{
    4041  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)
    4243    if (search_id==i->id) return i;
    4344  return NULL;
     
    7071    b->area(x1,y1,x2,y2);
    7172    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)
    7374    {
    7475      b->area(xp1,yp1,xp2,yp2);
     
    8384void button_box::draw_first(image *screen)
    8485{
    85   for (button *b=buttons;b;b=(button *)b->next)
     86  for (button *b=buttons; b; b=(button *)b->next)
    8687    b->draw_first(screen);
    8788}
     
    102103char *button_box::read()
    103104{
    104   for (button *b=buttons;b;b=(button *)b->next)
     105  for (button *b=buttons; b; b=(button *)b->next)
    105106  {
    106107    if (*((int *)b->read())==0)
     
    118119      int x1,y1,x2,y2;
    119120      int found=0;
    120       for (button *b=buttons;!found && b;b=(button *)b->next)  // see if the user clicked on a button
     121      for (button *b=buttons; !found && b; b=(button *)b->next)  // see if the user clicked on a button
    121122      {
    122123    b->area(x1,y1,x2,y2);
     
    128129      int total=0;
    129130      button *b2=buttons;
    130       for (;b2;b2=(button *)b2->next)
     131      for (; b2; b2=(button *)b2->next)
    131132        if (*((int *)b2->read())==0)
    132133          total++;
     
    136137        if (total>maxdown)
    137138        {
    138           for (b2=buttons;total>maxdown && b2;b2=(button *)b2->next)
     139          for (b2=buttons; total>maxdown && b2; b2=(button *)b2->next)
    139140            if ((b!=b2 || maxdown==0) && *((int *)b2->read())==0)
    140141        {
     
    168169  button *b=buttons;
    169170  int x_on=x,x1,y1,x2,y2;
    170   for (;b;b=(button *)b->next)
     171  for (; b; b=(button *)b->next)
    171172  {
    172173    b->area(x1,y1,x2,y2);
     
    181182  button *b=buttons;
    182183  int y_on=y,x1,y1,x2,y2;
    183   for (;b;b=(button *)b->next)
     184  for (; b; b=(button *)b->next)
    184185  {
    185186    b->area(x1,y1,x2,y2);
     
    285286      case JK_BACKSPACE : if (cur)
    286287         { 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++)
    288289             data[xx]=data[xx+1];
    289290           data[strlen(format)-1]=' ';
     
    295296         {
    296297           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--)
    298299             data[xx]=data[xx-1];
    299300           data[cur]=ev.key;
     
    473474    int fw=wm->font()->width(),fh=wm->font()->height(),maxw=0;
    474475    char *info=text;
    475     for (w=fw,h=fh+1;*info;info++)
     476    for (w=fw,h=fh+1; *info; info++)
    476477    {
    477478      if (w>maxw) maxw=w;
  • abuse/trunk/src/imlib/input.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/jdir.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/jrand.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    2425  int i;
    2526  unsigned short *tp=rtable;
    26   for (i=0;i<RAND_TABLE_SIZE;i++,tp++)
     27  for (i=0; i<RAND_TABLE_SIZE; i++,tp++)
    2728  {
    2829    rseed=rseed*0x41c64e6d+12345;
  • abuse/trunk/src/imlib/jrand.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/jwindow.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    4344int WindowManager::window_in_area(int x1, int y1, int x2, int y2)
    4445{
    45   for (Jwindow *f=first;f;f=f->next)
     46  for (Jwindow *f=first; f; f=f->next)
    4647    if (f->x<=x2 && f->y<=y2 && f->x+f->l-1>=x1 && f->y+f->h-1>=y1)
    4748      return 1;
     
    6465{
    6566  Jwindow *p;
    66   for (p=first;p;p=p->next)
     67  for (p=first; p; p=p->next)
    6768  {
    6869    if (!p->is_hidden())
     
    7778{
    7879  Jwindow *p;
    79   for (p=first;p;p=p->next)
     80  for (p=first; p; p=p->next)
    8081    if (p->is_hidden())
    8182      show_window(p);
     
    8990  else
    9091  {
    91     for (k=first;k->next!=j;k=k->next)
     92    for (k=first; k->next!=j; k=k->next)
    9293      k->screen->add_dirty(j->x-k->x,j->y-k->y,
    9394                   j->x+j->l-1-k->x,j->y+j->h-1-k->y);
     
    120121  if (state==inputing)
    121122  {
    122     for (ev.window=NULL,j=first;j;j=j->next)
     123    for (ev.window=NULL,j=first; j; j=j->next)
    123124      if (!j->is_hidden() && ev.mouse_move.x>=j->x && ev.mouse_move.y>=j->y &&
    124125          ev.mouse_move.x<j->x+j->l && ev.mouse_move.y<j->y+j->h)
     
    148149        ev.type=EV_CLOSE_WINDOW;
    149150      else if (movew)
    150       {   
     151      {
    151152    int red=0;
    152153    if (ev.window==first)       // see if we need to raise the window
     
    159160    {
    160161      Jwindow *last=first;
    161       for (;last->next!=ev.window;last=last->next);
     162      for (; last->next!=ev.window; last=last->next);
    162163      if (ev.window->next)
    163164        red=1;
     
    169170    {
    170171      Jwindow *last=first;
    171       for (;last->next;last=last->next);
     172      for (; last->next; last=last->next);
    172173      last->next=ev.window;
    173174    }
     
    177178      Jwindow *j=ev.window;
    178179/*      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); */
    181182      j->screen->add_dirty(0,0,j->l-1,j->h-1);
    182183      flush_screen();
     
    209210  if (ev.type==EV_REDRAW)
    210211  {
    211     for (j=first;j;j=j->next)
     212    for (j=first; j; j=j->next)
    212213       j->screen->add_dirty(ev.redraw.x1-j->x,ev.redraw.y1-j->y,
    213214             ev.redraw.x2-j->x,ev.redraw.y2-j->y);
     
    228229  Jwindow *p;
    229230  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)
    231232    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);
    232233  j->resize(l,h);
     
    559560ifield *InputManager::unlink(int id)     // unlinks ID from fields list and return the pointer to it
    560561{
    561   for (ifield *i=first,*last=NULL;i;i=i->next)
     562  for (ifield *i=first,*last=NULL; i; i=i->next)
    562563  {
    563564    if (i->id==id)
     
    615616    if ((ev.type==EV_MOUSE_BUTTON && ev.mouse_button==1) || ev.type==EV_MOUSE_MOVE)
    616617    {
    617       for (i=first;i;i=i->next)
     618      for (i=first; i; i=i->next)
    618619      {
    619620    i->area(x1,y1,x2,y2);
     
    725726void InputManager::remap(filter *f)
    726727{
    727   for (ifield *i=first;i;i=i->next)
     728  for (ifield *i=first; i; i=i->next)
    728729   i->remap(f);
    729730  redraw();
     
    747748{
    748749  ifield *f;
    749   for (f=first;f;f=f->next)
     750  for (f=first; f; f=f->next)
    750751  {
    751752    ifield *ret=f->find(id);
  • abuse/trunk/src/imlib/jwindow.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    175176    JCFont *font() { return fnt; }
    176177    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); }
    178179    void set_mouse_shape(image *im, int centerx, int centery)
    179180    { eh->set_mouse_shape(im,centerx,centery); }
  • abuse/trunk/src/imlib/keys.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/keys.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/linked.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/linked.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    1516// example compare function
    1617//   virtual int compare(void *n1, int field)
    17 //        {return ((classname *) n1)->data > data);}
     18//        { return ((classname *) n1)->data > data); }
    1819//  should return (1 if n1 is greater than (self)) else return 0
    1920//  field is the value determined by linked_list::set_sort_field
     
    4849  if (first) \
    4950     for (controll=(type *)(first); \
    50           (!x || (controll)!=(type *)(first));\
     51          (!x || (controll)!=(type *)(first)); \
    5152          controll=(type *)(controll->next()),x++)
    5253
    5354#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)); \
    5556  controll=(type *)(controll->next()),x++)
    5657
     
    5960  class linked_node *nextp, *lastp;
    6061public:
    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; }
    6667  virtual ~linked_node() { ; }
    6768  linked_node() { nextp=NULL; lastp=NULL; }
     
    9091  void add_end(class linked_node *p);
    9192  void insert(class linked_node *p);
    92   void set_sort_field(int x) {sortby=x;}   // this is passed to compare
    93   class linked_node *current() {return cn;}
    94   class linked_node *first() {return fn;}
    95   class linked_node *last() {return fn->last();}
     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(); }
    9697  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; }
    103104  int node_number(linked_node *p);
    104105  int unlink(linked_node *p);
  • abuse/trunk/src/imlib/macs.h

    r490 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/main.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/morph.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    3435    morph_point8 *m8=(morph_point8 *)p;
    3536    screen->lock();
    36     for (i=0;i<total;i++,m8++)
     37    for (i=0; i<total; i++,m8++)
    3738    {
    3839      xx=x+trans(m8->x1,m8->x2,frame_on);
     
    4041
    4142      if (xx>=x1 && xx<=x2 && yy>=y1 && yy<=y2)
    42       {   
     43      {
    4344    pal->get(m8->start_color,r1,g1,b1);
    4445    pal->get(m8->end_color,r2,g2,b2);
     
    4748             g=trans(g1,g2,frame_on)>>3,
    4849         b=trans(b1,b2,frame_on)>>3;
    49    
     50
    5051        *(screen->scan_line(yy)+xx)=fli->lookup_color(r,g,b);
    5152      }
     
    125126
    126127
    127   for (i=0;i<patches;i++)
     128  for (i=0; i<patches; i++)
    128129  {
    129130    pats[i].patch_data=NULL;
     
    133134      im->clear();
    134135      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      {
    140141        mark_color=-1;
    141    
    142         tot=r=g=b=0;         
     142
     143        tot=r=g=b=0;
    143144        if (x!=0 && *(sl-1))
    144145        { tot++;
    145146          r+=pal->red(*(sl-1));
    146147          g+=pal->green(*(sl-1));
    147           b+=pal->blue(*(sl-1));       
    148         }   
     148          b+=pal->blue(*(sl-1));
     149        }
    149150        if (x!=w-1 && *(sl+1))
    150151        { tot++;
    151152          r+=pal->red(*(sl+1));
    152153          g+=pal->green(*(sl+1));
    153           b+=pal->blue(*(sl+1));   
    154         }   
     154          b+=pal->blue(*(sl+1));
     155        }
    155156        if (y!=0 && im->pixel(x,y-1))
    156157        { tot++;
     
    166167        }
    167168
    168         if (*sl && tot==0)  // kill any separate pixels   
     169        if (*sl && tot==0)  // kill any separate pixels
    169170          mark_color=0;
    170171        else if (*sl)
     
    174175          g/=tot;
    175176          b/=tot;
    176    
     177
    177178          dist=((int)ored-r)*((int)ored-r)+((int)og-g)*((int)og-g)+((int)ob-b)*((int)ob-b);
    178179          if (i>0 && i<patches-1 && dist>3000)
    179180          {
    180181//        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);
    182183          }
    183184        }
    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);
    186187        if (mark_color>=0)
    187         {   
     188        {
    188189          pats[i].patches++;
    189190          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;
    191192          *(cur_patch++)=x;
    192193          *(cur_patch++)=y;
    193           *sl=mark_color;   
    194           *(cur_patch++)=*sl;   
    195         }   
     194          *sl=mark_color;
     195          *(cur_patch++)=*sl;
     196        }
    196197      }
    197198      }
     
    214215  {
    215216    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++)
    217218    {
    218219      pixelx=(long)((int)p_on->x2-(int)p_on->x1)*(long)frame_on/8+p_on->x1+x;
     
    232233  {
    233234    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++)
    235236    {
    236237      pixelx=(long)((int)p_on->x2-(int)p_on->x1)*(long)frame_on/8+p_on->x1+x;
     
    266267  end_map=(unsigned char *)malloc(w*h);
    267268
    268   for (frame_on=2;frame_on<frames-1;frame_on++)
     269  for (frame_on=2; frame_on<frames-1; frame_on++)
    269270  {
    270271    memset(middle_map,0,w*h*sizeof(morph_point8 *));            // initialize them middle pointers NULL
     
    272273
    273274    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++)
    275276    {
    276277      pixelx=(long)((int)p_on->x2-(int)p_on->x1)*(long) frame_on  /(long) frames  +p_on->x1;
     
    284285    int skipped=0;
    285286
    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++)
    289290      {
    290291    if (middle_map[pixelx+pixely*w]==NULL)  // we are checking for 'duds'  (misplaced black pixels)
    291     {   
    292       int tot;   
     292    {
     293      int tot;
    293294      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;
    301302        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          {
    306307                other=middle_map[k+(l)*w];
    307308        if (other)
    308309        {
    309310          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;
    311312          if (end_x>=0 && end_y>=0 && end_x<w && end_y<h && end_map[end_x+end_y*w])
    312313          {
     
    318319              shortest=other;
    319320              shortest_end_x=end_x;
    320               shortest_end_y=end_y;       
     321              shortest_end_y=end_y;
    321322            }
    322323          }
    323324        }
    324           }   
     325          }
    325326        if (shortest)
    326327        {
    327328          total++;
    328           p=(void *)realloc(p,sizeof(morph_point8)*total);       
     329          p=(void *)realloc(p,sizeof(morph_point8)*total);
    329330          morph_point8 *mod=((morph_point8 *)p)+total-1;
    330331          mod->x1=shortest->x1;
    331332          mod->y1=shortest->y1;
    332           mod->start_color=shortest->start_color;       
     333          mod->start_color=shortest->start_color;
    333334
    334335          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        }
    338339        else
    339         {   
     340        {
    340341            skipped++;
    341342          printf("skiped so far : %d (frame %d)\n",skipped,frame_on);
    342343        }
    343    
    344 
    345       }   
     344
     345
     346      }
    346347    }
    347348      }
     
    372373    p=(void *)malloc(sizeof(morph_point16)*total);
    373374
    374     for (i=0;i<total;i++)
     375    for (i=0; i<total; i++)
    375376    {
    376377      ((morph_point16 *)p+i)->x1=fp->read_uint16();
     
    402403  {
    403404    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++)
    405406    {
    406407      pixelx=(long)((int)p_on->x2-(int)p_on->x1)*(long)frame_on/(long)frames+p_on->x1+x;
     
    420421  {
    421422    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++)
    423424    {
    424425      pixelx=(long)((int)p_on->x2-(int)p_on->x1)*(long)frame_on/(long)frames+p_on->x1+x;
     
    446447  {
    447448    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++)
    449450    {
    450451      pixelx=(long)((int)p_on->x2-(int)p_on->x1)*(long)frame_on/(long)frames+p_on->x1+x;
     
    452453
    453454      if (pixelx>=0 && pixely>=0 && pixelx<width && pixely<height)
    454       {   
     455      {
    455456        scolor=addr+((int)p_on->start_color)*3;
    456457        ecolor=addr+((int)p_on->end_color)*3;
    457458        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++;
    460461        *pix=((int)(*ecolor)-(int)(*scolor))*frame_on/frames+*scolor;
    461462      }
     
    465466  {
    466467    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++)
    468469    {
    469470      pixelx=(long)((int)p_on->x2-(int)p_on->x1)*(long)frame_on/(long)frames+p_on->x1+x;
     
    471472
    472473      if (pixelx>=0 && pixely>=0 && pixelx<width && pixely<height)
    473       {   
     474      {
    474475        scolor=addr+((int)p_on->start_color)*3;
    475476        ecolor=addr+((int)p_on->end_color)*3;
    476477        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++;
    479480        *pix=((int)(*ecolor)-(int)(*scolor))*frame_on/frames+*scolor;
    480481      }
     
    511512
    512513  // 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++)
    514515  { sl=hint1->scan_line(y);
    515     for (x=hint1->width();x;x--,sl++)
     516    for (x=hint1->width(); x; x--,sl++)
    516517      if (*sl) hint_hist1[*sl]++;
    517518  }
    518   for (y=0;y<hint2->height();y++)
     519  for (y=0; y<hint2->height(); y++)
    519520  { sl=hint2->scan_line(y);
    520     for (x=hint2->width();x;x--,sl++)
     521    for (x=hint2->width(); x; x--,sl++)
    521522      if (*sl) hint_hist2[*sl]++;
    522523  }
    523524
    524525  // check the user and see if the mask match up
    525   for (x=0;x<256;x++)
     526  for (x=0; x<256; x++)
    526527  {
    527528    if ((hint_hist1[x]!=0 && hint_hist2[x]==0) ||
     
    548549    plist=(void *)malloc(sizeof(morph_point16)*total);
    549550  CHECK(plist);
    550   for (i=0,color=0;i<total_hints;i++)
     551  for (i=0,color=0; i<total_hints; i++)
    551552  {
    552553    color++; while (!hint_hist1[color]) color++;
     
    555556    total2=hint_hist2[color];
    556557    if (total1>total2) points=total1; else points=total2;
    557     for (j=0;j<points;j++)
     558    for (j=0; j<points; j++)
    558559    {
    559560      if (total1)  // are there any more pixels left in this image?
     
    620621
    621622  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++)
    625626    {
    626627      if (small)
     
    630631      start=crange[hint_color].start;
    631632      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++)
    633634      {
    634635        swap_point=rand()%range+start;
     
    709710  else
    710711  {
    711     for (i=0;i<total;i++)
     712    for (i=0; i<total; i++)
    712713    { fp->write_uint16(((morph_point16 *)p+i)->x1);
    713714      fp->write_uint16(((morph_point16 *)p+i)->y1);
     
    752753      {
    753754    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    {
    757758      x1=(int)m8->x1;
    758759      x2=(int)m8->x2;
     
    764765      points[i].y=y1<<8;
    765766      points[i].dx=(x2-x1)<<5;
    766       points[i].dy=(y2-y1)<<5;       
     767      points[i].dy=(y2-y1)<<5;
    767768
    768769      unsigned char r1,g1,b1,r2,g2,b2;
     
    775776      points[i].dr=(long)((int)r2-(int)r1)<<5;
    776777      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;
    778779    }
    779780      }
     
    781782      {
    782783    morph_point8 *m8=mor->small_points();
    783     for (i=0;i<total;i++,m8++)
    784     {         
     784    for (i=0; i<total; i++,m8++)
     785    {
    785786      x1=(int)m8->x1;
    786787      x2=(int)m8->x2;
     
    792793      points[i].y=y2<<8;
    793794      points[i].dx=(x1-x2)<<5;
    794       points[i].dy=(y1-y2)<<5;       
     795      points[i].dy=(y1-y2)<<5;
    795796
    796797      unsigned char r1,g1,b1,r2,g2,b2;
     
    803804      points[i].dr=(long)((int)r2-(int)r1)<<5;
    804805      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;
    806807    }
    807808      }
     
    825826  if (face_dir>0)
    826827  {
    827     for (i=0,ss=points;i<total;i++,ss++)
     828    for (i=0,ss=points; i<total; i++,ss++)
    828829    {
    829830      px=x+(ss->x>>(16-8));
     
    839840    }
    840841
    841     for (j=0;j<tp;j++,sl++)
     842    for (j=0; j<tp; j++,sl++)
    842843    {
    843844      px=x+*(sl++);
     
    848849  } else
    849850  {
    850     for (i=0,ss=points;i<total;i++,ss++)
     851    for (i=0,ss=points; i<total; i++,ss++)
    851852    {
    852853      px=x+ww-(ss->x>>(16-8));
     
    862863    }
    863864
    864     for (j=0;j<tp;j++,sl++)
     865    for (j=0; j<tp; j++,sl++)
    865866    {
    866867      px=x+(ww-(int)(*(sl++)));
     
    879880  step_struct *s=points;
    880881  int i;
    881   for (i=0;i<total;i++,s++)
     882  for (i=0; i<total; i++,s++)
    882883  {
    883884    s->dx=-s->dx;
     
    899900  pats=(morph_patch *)malloc(sizeof(morph_patch)*patches);
    900901
    901   for (i=0;i<patches;i++)
     902  for (i=0; i<patches; i++)
    902903  {
    903904    pats[i].patches=fp->read_uint16();
  • abuse/trunk/src/imlib/morph.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/mouse.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/palette.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    5657   unsigned char *cl=(unsigned char *)addr();
    5758   int c=0,d=0x100000,i,nd;
    58    for (i=0;i<256;i++)
     59   for (i=0; i<256; i++)
    5960   {
    6061     nd=((int)r-(int)(*cl))*((int)r-(int)(*cl)); cl++;
     
    7273   unsigned char *cl=(unsigned char *)addr()+3;
    7374   int c=1,d=0x7fffffff,i,nd;
    74    for (i=1;i<256;i++)
     75   for (i=1; i<256; i++)
    7576   {
    7677     nd=((int)r-(int)(*cl))*((int)r-(int)(*cl)); cl++;
     
    8788{
    8889  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++)
    9091  {
    9192    if (usd[ub]&mask)
     
    114115  unsigned char r,g,b,gr;
    115116
    116   for (i=0;i<256;i++)
     117  for (i=0; i<256; i++)
    117118  {
    118119    get(i,r,g,b);
     
    126127  int i,c;
    127128  set(0,0,0,0);
    128   for (i=1;i<ncolors;i++)
     129  for (i=1; i<ncolors; i++)
    129130  { c=(int)((double)i/(double)ncolors*(double)255);
    130131    set(i,c,c,c);
     
    136137  int i,v;
    137138  CHECK(ncolors==256);
    138   for (i=0;i<64;i++)
     139  for (i=0; i<64; i++)
    139140  {
    140141    if (i==0) v=0;
     
    156157{
    157158  int i;
    158   for (i=0;i<ncolors;i++) set_used(i);
     159  for (i=0; i<ncolors; i++) set_used(i);
    159160}
    160161
     
    162163{
    163164  int i;
    164   for (i=0;i<ncolors;i++) set_unused(i);
     165  for (i=0; i<ncolors; i++) set_unused(i);
    165166}
    166167
     
    171172  int i;
    172173  p=new palette(ncolors);
    173   for (i=0;i<ncolors;i++)
     174  for (i=0; i<ncolors; i++)
    174175  {
    175176    if (used(i))
     
    213214  if (!closest_only)
    214215  {
    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--)
    216217    {
    217218      if (used(i))
     
    235236    else
    236237    {
    237       for (i=0,f=0,u=10000;i<ncolors;i++)
     238      for (i=0,f=0,u=10000; i<ncolors; i++)
    238239      { c=(pal[i].red-r)*(pal[i].red-r)+
    239240      (pal[i].green-g)*(pal[i].green-g)+
     
    254255  set(0,0,0,0);
    255256  set_used(0);
    256   for (i=1;i<ncolors;i++)
     257  for (i=1; i<ncolors; i++)
    257258    set_unused(i);
    258259  if (ncolors==256)
    259     for (i=0;i<ncolors;i++)
     260    for (i=0; i<ncolors; i++)
    260261      set(i,RED3(i),GREEN3(i),BLUE2(i));
    261262  else if (ncolors==16)
    262     for (i=0;i<ncolors;i++)
     263    for (i=0; i<ncolors; i++)
    263264      set(i,255-(i&3),255-((i&4)>>2),255-((i&8)>>3));
    264265  else
    265     for (i=0;i<ncolors;i++)
     266    for (i=0; i<ncolors; i++)
    266267      set(i,255-(i%3),255-((i+1)%3),255-((i+2)%3));
    267268}
     
    275276
    276277    m=-amount;
    277     for (i=0;i<ncolors*3;i++)
     278    for (i=0; i<ncolors*3; i++)
    278279      ((unsigned char *) pal)[i]>>=m;
    279280  }
     
    281282  {
    282283    m=amount;
    283     for (i=0;i<ncolors*3;i++)
     284    for (i=0; i<ncolors*3; i++)
    284285      ((unsigned char *) pal)[i]<<=m;
    285286  }
     
    319320{
    320321/*  if (!is_leaf())
    321   { for (i=0;i<8;i++)
     322  { for (i=0; i<8; i++)
    322323      if (children[i])
    323324      {    delete children[i];
     
    349350  }
    350351  else
    351   { for (i=0;i<8;i++)
     352  { for (i=0; i<8; i++)
    352353      if (children[i])
    353354    children[i]->total(tnodes,tr,tg,tb);
     
    363364    be_childish();
    364365  else
    365     for (i=0;i<8;i++) children[i]=NULL;
     366    for (i=0; i<8; i++) children[i]=NULL;
    366367  padre=dad;
    367368  red=r; green=g; blue=b;
     
    377378  {
    378379    if (!who->is_leaf())
    379     { for (x=0;x<8;x++)
     380    { for (x=0; x<8; x++)
    380381    if (who->children[x])
    381382    {
     
    393394  int pruned,lev,x,r,g,b,t;
    394395  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--)
    396397  {
    397398    p=(quant_node *)level[lev-1].first();
     
    400401      {
    401402    f=p->father();
    402     for (x=0;x<8 && !pruned;x++)
     403    for (x=0; x<8 && !pruned; x++)
    403404      if (f->children[x])
    404405        if (f->children[x]->next()!=p->next())        // if this son is not me!
     
    469470  quant_node *pn;
    470471  p=new palette(mx);
    471   for (x=0,i=7;i>=0;i++)
     472  for (x=0,i=7; i>=0; i++)
    472473    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())
    474475      if (pn->is_leaf())
    475476    p->set(x++,pn->red,pn->green,pn->blue);
     
    492493  brv=0; bri=0;
    493494
    494   for (i=0;i<(unsigned int)ncolors;i++)
     495  for (i=0; i<(unsigned int)ncolors; i++)
    495496  { if (all || used(i))
    496497    {
     
    512513  brv=(long)258*(long)258*(long)258; bri=0;
    513514
    514   for (i=0;i<(unsigned int)ncolors;i++)
     515  for (i=0; i<(unsigned int)ncolors; i++)
    515516  { if (all || used(i))
    516517    {
     
    536537  uint8_t x;
    537538  int i;
    538   for (i=0;i<ncolors;i++)
     539  for (i=0; i<ncolors; i++)
    539540  {
    540541    x=(( dest_r-(int)*sl)*fade_on/total_fades+*sl);
  • abuse/trunk/src/imlib/palette.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    8687  void total(int &tnodes, int &tr, int &tg, int &tb);
    8788//  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; }
    8990  unsigned char red,green,blue;
    9091  ~quant_node();
  • abuse/trunk/src/imlib/pcxread.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    7778  int y,run_length,x;
    7879  unsigned char *sl,code;
    79   for (y=0;y<im->height();y++)
     80  for (y=0; y<im->height(); y++)
    8081  {
    8182    sl=im->scan_line(y);
    82     for (x=0;x<im->width();)
     83    for (x=0; x<im->width(); )
    8384    {
    8485      run_length=1;
     
    9495    fputc(code,fp);
    9596    fputc(sl[x],fp);
    96    
     97
    9798      }
    9899      x+=run_length;
  • abuse/trunk/src/imlib/pcxread.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/pmenu.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    3940  int total=0,tx,tw;
    4041  pmenu_item *p=top;
    41   for (;p;p=p->next) total++;
     42  for (; p; p=p->next) total++;
    4243
    4344  tw=w/(total+1);
    4445  tx=tw/2;
    4546
    46   for (p=top;p;p=p->next,tx+=tw)
     47  for (p=top; p; p=p->next,tx+=tw)
    4748    p->draw_self(bar,itemx(p),1,itemw(p),1,p==active);
    4849/*  }
    4950  else
    5051  {
    51     for (p=top;p;p=p->next,tx+=tw)
     52    for (p=top; p; p=p->next,tx+=tw)
    5253      p->draw(bar,itemx(p),1,itemw(p),1,p==active);
    5354  }*/
     
    119120pmenu_item *psub_menu::find_id(int search_id)
    120121{
    121   for (pmenu_item *f=first;f;f=f->next)
     122  for (pmenu_item *f=first; f; f=f->next)
    122123  {
    123124    pmenu_item *ret=f->find_id(search_id);
     
    129130pmenu_item *psub_menu::find_key(int key)
    130131{
    131   for (pmenu_item *f=first;f;f=f->next)
     132  for (pmenu_item *f=first; f; f=f->next)
    132133  {
    133134    pmenu_item *ret=f->find_key(key);
     
    165166  int tw=wm->font()->width(),th=wm->font()->height();
    166167  w=h=0;
    167   for (pmenu_item *p=first;p;p=p->next)
     168  for (pmenu_item *p=first; p; p=p->next)
    168169  {
    169170    if (p->name())
     
    205206  int has_flags=0;
    206207  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;
    208209  x=has_flags ? 3+wm->font()->width() : 3;
    209210  y=3;
    210211
    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)
    212213    p->draw(win,x,y,w-6,0,i==active);
    213214
     
    232233      {
    233234    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());
    235236    if (on_off && *on_off) wm->font()->put_string(parent->screen,bx+1,y+1,"*",wm->medium_color());
    236237      }
     
    288289
    289290  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++)
    291292  { if (pp==p) x=i;
    292293    total++;
     
    316317
    317318  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;
    319320  if (has_flags) dx+=wm->font()->width();
    320321
     
    378379  else
    379380  {
    380     for (pmenu_item *p=top;p;p=p->next)
     381    for (pmenu_item *p=top; p; p=p->next)
    381382    {
    382383      if (!p->next) return p;
     
    390391{
    391392  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)
    393394      if (p->own_event(ev))
    394395        return 1;
     
    415416    else
    416417    {
    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?
    418419      if (p->own_event(ev)) yes=1;
    419420    }
     
    425426    case EV_KEY :
    426427    {
    427       for (pmenu_item *p=top;p;p=p->next)
     428      for (pmenu_item *p=top; p; p=p->next)
    428429      {
    429430    pmenu_item *r=p->find_key(ev.key);
  • abuse/trunk/src/imlib/pmenu.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/readwav.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/readwav.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/scroller.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    6061
    6162  screen->lock();
    62   for (int yc=ich;yc;yc--,y++)
     63  for (int yc=ich; yc; yc--,y++)
    6364  {
    6465    if (y>=cy1 && y<=cy2)
    6566    {
    6667      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++)
    6869      {
    6970    if (xo>=cx1 && xo<=cx2)
     
    183184    {
    184185      if (ev.mouse_button && drag==-1)
    185       {   
     186      {
    186187    if (mx>=b1x() && mx<b1x()+bw() && my>=b1y()-2 && my<b1y()+bh())
    187188    {
     
    201202        draw_widget(screen,0);
    202203        scroll_event(sx,screen);
    203       }   
     204      }
    204205    }
    205206    else
     
    215216          drag=sx;
    216217          inm->grab_focus(this);
    217         }   
     218        }
    218219        else if (t>1)
    219220        {
     
    224225        sx=nx;
    225226        draw_widget(screen,0);
    226         scroll_event(sx,screen);       
    227           }       
     227        scroll_event(sx,screen);
     228          }
    228229        }
    229230      } else handle_inside_event(ev,screen,inm);
     
    286287    sx++;
    287288    draw_widget(screen,0);
    288     scroll_event(sx,screen);   
     289    scroll_event(sx,screen);
    289290  }
    290291}
     
    297298    sx--;
    298299    draw_widget(screen,0);
    299     scroll_event(sx,screen);   
     300    scroll_event(sx,screen);
    300301  }
    301302}
     
    308309    sx--;
    309310    draw_widget(screen,0);
    310     scroll_event(sx,screen);   
     311    scroll_event(sx,screen);
    311312  }
    312313}
     
    319320    sx++;
    320321    draw_widget(screen,0);
    321     scroll_event(sx,screen);   
     322    scroll_event(sx,screen);
    322323  }
    323324}
     
    332333    sx=x;
    333334    draw_widget(screen,0);
    334     scroll_event(sx,screen);   
     335    scroll_event(sx,screen);
    335336  }
    336337}
     
    363364  int xa,ya,xo=0,yo;
    364365  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++)
    366367  {
    367368    char st[10];
     
    396397  lis=(pick_list_item *)malloc(sizeof(pick_list_item)*num_entries);
    397398  int i=0;
    398   for (;i<num_entries;i++)
     399  for (; i<num_entries; i++)
    399400  {
    400401    lis[i].name=List[i];
     
    403404  qsort((void *)lis,num_entries,sizeof(pick_list_item),lis_sort);
    404405
    405   for (i=0;i<t;i++)
     406  for (i=0; i<t; i++)
    406407    if ((int)strlen(List[i])>wid)
    407408      wid=strlen(List[i]);
     
    441442      key_hist[(int)(key_hist_total++)]=ev.key;
    442443
    443     for (int i=0;i<t && found==-1;i++)
     444    for (int i=0; i<t && found==-1; i++)
    444445    {
    445446      if ((int)strlen(lis[i].name)>=key_hist_total && memcmp(lis[i].name,key_hist,key_hist_total)==0)
     
    466467    draw_widget(screen,0);
    467468  }
    468   scroll_event(sx,screen);   
     469  scroll_event(sx,screen);
    469470}
    470471
     
    480481    draw_widget(screen,0);
    481482  }
    482   scroll_event(sx,screen);   
     483  scroll_event(sx,screen);
    483484}
    484485
     
    494495    int th=(h+tex->height()-1)/tex->height();
    495496    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())
    498499        tex->put_image(screen,dx,dy);
    499500
     
    502503
    503504  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)
    505506  {
    506507    if (i+newx==cur_sel)
     
    548549  if (m)
    549550  {
    550     for (int i=0;i<t;i++)
     551    for (int i=0; i<t; i++)
    551552      if (get_select(i)) return i;
    552553    return -1;
     
    609610  draw_background(screen);
    610611
    611   for (int i=newx;i<newx+vis();i++)
     612  for (int i=newx; i<newx+vis(); i++)
    612613  {
    613614    if (i<t)
     
    657658      {
    658659    if (m)
    659     {   
     660    {
    660661      if (ev.mouse_button)
    661662      {
     
    670671    } else if (ok_to_select(me))
    671672    {
    672       if (cur_sel==me)   
     673      if (cur_sel==me)
    673674        note_selection(screen,inm,me);
    674675      else
  • abuse/trunk/src/imlib/scroller.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    4546
    4647  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) { ; }
    4849  virtual void scroll_event(int newx, image *screen);
    4950  virtual void handle_up(image *screen, InputManager *inm);
  • abuse/trunk/src/imlib/specs.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    7677        free( spec_prefix );
    7778    }
    78    
     79
    7980    if( prefix )
    8081    {
     
    396397{
    397398  int wr=0;
    398   for (char const *s=mode;*s;s++)
     399  for (char const *s=mode; *s; s++)
    399400    if (toupper(*s)=='A' || toupper(*s)=='W')
    400401      wr=1;
     
    428429 flags=access=0;
    429430 char const *s=access_string;
    430   for (;*s;s++)
     431  for (; *s; s++)
    431432    if (toupper(*s)=='R') access=O_RDONLY;
    432433
    433   for (s=access_string;*s;s++)
     434  for (s=access_string; *s; s++)
    434435    if (toupper(*s)=='W')
    435436    {
     
    439440    }
    440441
    441   for (s=access_string;*s;s++)
     442  for (s=access_string; *s; s++)
    442443    if (toupper(*s)=='A')
    443444      access|=O_APPEND|O_WRONLY;
     
    489490            if (current_offset+start_offset != spec_main_offset)
    490491                spec_main_offset = lseek(fd, start_offset+current_offset, SEEK_SET);
    491            
     492
    492493            len = ::read(fd,(char*)buf,count);
    493494            break;
     
    495496            if (current_offset+start_offset != spec_main_offset)
    496497                spec_main_offset = lseek(fd, start_offset+current_offset, SEEK_SET);
    497            
     498
    498499            len = ::read(fd,(char*)buf,count);
    499500            ::write(fast_load_fd,(char*)&len,sizeof(len));
     
    505506            break;
    506507        }
    507        
     508
    508509        spec_main_offset += len;
    509510    }
     
    663664  if (total)
    664665  {
    665     for (i=0,e=entries;i<total;i++,e++)          // calculate the size of directory info
     666    for (i=0,e=entries; i<total; i++,e++)          // calculate the size of directory info
    666667    {
    667668      o+=1+1+strlen((*e)->name)+1 +1 +8;
    668669    }
    669670
    670     for (i=0,e=entries;i<total;i++,e++)          // calculate offset for each entry
     671    for (i=0,e=entries; i<total; i++,e++)          // calculate offset for each entry
    671672    {
    672673      (*e)->offset=o;
     
    680681  int i;
    681682  spec_entry **e;
    682   for (i=0,e=entries;i<total;i++,e++)
     683  for (i=0,e=entries; i<total; i++,e++)
    683684    if (!strcmp((*e)->name,name) && (*e)->type==type)
    684685      return (*e);
     
    690691  int i;
    691692  spec_entry **e;
    692   for (i=0,e=entries;i<total;i++,e++)
     693  for (i=0,e=entries; i<total; i++,e++)
    693694    if (!strcmp((*e)->name,name))
    694695      return (*e);
     
    700701  int i;
    701702  spec_entry **e;
    702   for (i=0,e=entries;i<total;i++,e++)
     703  for (i=0,e=entries; i<total; i++,e++)
    703704    if (!strcmp((*e)->name,name))
    704705      return i;
     
    710711  int i;
    711712  spec_entry **e;
    712   for (i=0,e=entries;i<total;i++,e++)
     713  for (i=0,e=entries; i<total; i++,e++)
    713714    if ((*e)->type==type)
    714715      return (*e);
     
    720721  int i,x=0;
    721722  spec_entry **e;
    722   for (i=0,e=entries;i<total;i++,e++)
     723  for (i=0,e=entries; i<total; i++,e++)
    723724    if ((*e)->type==type) x++;
    724725  return x;
     
    729730  int i;
    730731  spec_entry **e;
    731   for (i=0,e=entries;i<total;i++,e++)
     732  for (i=0,e=entries; i<total; i++,e++)
    732733    if ((*e)->type==type)
    733734      return i;
     
    740741  int i;
    741742  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++)
    743744    (*se)->print();
    744745}
     
    759760
    760761    int i;
    761     for (i=0;i<total;i++)
     762    for (i=0; i<total; i++)
    762763    {
    763764      fp->read(buf,2);
     
    772773    char *dp=(char *)data;
    773774    fp->seek(start,SEEK_SET);
    774     for (i=0;i<total;i++)
     775    for (i=0; i<total; i++)
    775776    {
    776777      spec_entry *se=(spec_entry *)dp;
     
    858859  spec_entry **e;
    859860  long i;
    860   for (i=total-1,e=entries;i>=0;i--,e++)
     861  for (i=total-1,e=entries; i>=0; i--,e++)
    861862    return (*e)->offset+(*e)->size;
    862863
     
    878879
    879880  int i;
    880   for (i=0,e=entries;i<total;i++,e++)
     881  for (i=0,e=entries; i<total; i++,e++)
    881882  {
    882883    if (fp->write(&(*e)->type,1)!=1)                 return 0;
     
    965966{
    966967  int i;
    967   for (i=0;i<total && entries[i]!=e;i++);            // find the entry in the array first
     968  for (i=0; i<total && entries[i]!=e; i++);            // find the entry in the array first
    968969
    969970  if (entries[i]==e)                                 // make sre it was found
     
    971972    delete e;
    972973    total--;
    973     for (;i<total;i++)                               // compact the pointer array
     974    for (; i<total; i++)                               // compact the pointer array
    974975      entries[i]=entries[i+1];
    975976    entries=(spec_entry **)realloc(entries,sizeof(spec_entry *)*total);
     
    991992{
    992993  int i;
    993   for (i=0;i<total;i++)
     994  for (i=0; i<total; i++)
    994995    delete entries[i];
    995996
  • abuse/trunk/src/imlib/specs.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    177178  void *data;
    178179  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!
    180181  spec_directory(FILE *fp);
    181182  spec_directory(bFILE *fp);
     
    203204                         char *data_name,
    204205                         unsigned long data_size,
    205                          char *link_filename=NULL);*/
     206                         char *link_filename=NULL); */
    206207
    207208uint16_t read_uint16(FILE *fp);
  • abuse/trunk/src/imlib/sprite.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    4950
    5051void 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(); ); }
    5253
    5354void sprite_controller::put_sprites()
    54 { sprite *sp; loopt(sprite,sp,sprites.first(),sp->draw();); }
     55{ sprite *sp; loopt(sprite,sp,sprites.first(),sp->draw(); ); }
    5556
    5657void 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(); ); }
    5859
    5960void sprite::change_visual(image *Visual, int delete_old)
  • abuse/trunk/src/imlib/sprite.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
  • abuse/trunk/src/imlib/status.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    5960    int t=percentage*40/100;
    6061    int i=0;
    61     for (;i<t;i++)
     62    for (; i<t; i++)
    6263      s[len+i] = '.';
    63     for (;i<40;i++)
     64    for (; i<40; i++)
    6465        s[len+i] = ' ';
    6566    s[len+i++] = ']';
  • abuse/trunk/src/imlib/status.h

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    2122  virtual void pop() = 0;
    2223  virtual void force_display() { ; }
    23   virtual ~status_manager() {}
     24  virtual ~status_manager() { }
    2425} ;
    2526
  • abuse/trunk/src/imlib/supmorph.cpp

    r481 r494  
    22 *  Abuse - dark 2D side-scrolling platform game
    33 *  Copyright (c) 1995 Crack dot Com
     4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
    45 *
    56 *  This software was released into the Public Domain. As with most public
     
    3940
    4041  dp=hint1->t_data();
    41   for (y=0;y<h1;y++)
     42  for (y=0; y<h1; y++)
    4243  {
    4344    x=0;