Ignore:
Timestamp:
Nov 10, 2005, 9:41:13 PM (17 years ago)
Author:
Sam Hocevar
Message:
  • absolute shitloads of 64 bit fixes.
File:
1 edited

Legend:

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

    r16 r17  
    608608  {
    609609    if (!rcheck) rcheck=open_file("rcheck","rb");
    610     int32_t x=rcheck->read_long();
     610    int32_t x=rcheck->read_uint32();
    611611    if (x!=rand_on)
    612612      dprintf("off!\n");
     
    618618      rcheck_lp=open_file("rcheck.lp","wb");
    619619    }
    620     rcheck->write_long(rand_on);
     620    rcheck->write_uint32(rand_on);
    621621  } else
    622622  {
     
    761761}
    762762
    763 void level::set_tick_counter(ulong x)
     763void level::set_tick_counter(uint32_t x)
    764764{
    765765  ctick=x;
     
    867867  {
    868868    fp->seek(se->offset,0);
    869     if (RC_type_size(fp->read_byte())!=size)
     869    if (RC_type_size(fp->read_uint8())!=size)
    870870      return 0;
    871871    else return 1;
     
    886886    fp->seek(se->offset,0);
    887887    /******************************* Read debug info ******************************/
    888     int16_t old_tot=fp->read_short(); 
     888    int16_t old_tot=fp->read_uint16(); 
    889889    uint16_t *o_remap=(uint16_t *)jmalloc(old_tot*2,"obj remap array");   
    890890    char old_name[150];     
    891891    for (i=0;i<old_tot;i++)
    892892    {
    893       fp->read(old_name,fp->read_byte());    // read the name
     893      fp->read(old_name,fp->read_uint8());    // read the name
    894894      for (o_remap[i]=0xffff,j=0;j<total_objects;j++)  // check for matching current name
    895895      {
     
    901901
    902902    /***************************** Read state names *********************************/
    903     int old_stot=fp->read_short();
     903    int old_stot=fp->read_uint16();
    904904    unsigned char *s_remap=(unsigned char *)jmalloc(old_stot,"state remap array");
    905905    for (i=0;i<old_stot;i++)
    906906    {
    907       fp->read(old_name,fp->read_byte());
     907      fp->read(old_name,fp->read_uint8());
    908908      s_remap[i]=stopped;           // non exsitant states get mapped into stopped state
    909909      for (j=0;j<MAX_STATE;j++)                  // see if old state exist now
     
    911911         s_remap[i]=j;
    912912    }
    913     total_objs=fp->read_long();   
     913    total_objs=fp->read_uint32();   
    914914
    915915    se=sd->find("type");
     
    918918      fp->seek(se->offset,0);
    919919      last=NULL;
    920       if (fp->read_byte()==RC_S)    //  read type array, this should be type RC_S
     920      if (fp->read_uint8()==RC_S)    //  read type array, this should be type RC_S
    921921      {
    922922        for (i=0;i<total_objs;i++)
    923923        {
    924           ushort t=fp->read_short();
     924          uint16_t t=fp->read_uint16();
    925925          game_object *p=new game_object(o_remap[t],1);
    926926          clear_tmp();
     
    934934        {
    935935          fp->seek(se->offset,0);
    936           if (fp->read_byte()==RC_S)    //  read state array, this should be type RC_S
     936          if (fp->read_uint8()==RC_S)    //  read state array, this should be type RC_S
    937937          {
    938938            game_object *l=first;
    939939            for (i=0;i<total_objs;i++,l=l->next)
    940940            {
    941               character_state s=(character_state)s_remap[fp->read_short()];
     941              character_state s=(character_state)s_remap[fp->read_uint16()];
    942942              if (l->otype!=0xffff)
    943943              {
     
    965965            fp->seek(se->offset,0);
    966966            int t=object_descriptions[j].type;
    967             if (fp->read_byte()!=t)
     967            if (fp->read_uint8()!=t)
    968968              dprintf("Warning : load level -> var '%s' size changed\n");
    969969            else
     
    974974                switch (t)
    975975                {
    976                   case RC_C : f->set_var(j,fp->read_byte()); break;
    977                   case RC_S : f->set_var(j,fp->read_short()); break;
    978                   case RC_L : f->set_var(j,fp->read_long()); break;
     976                  case RC_C : f->set_var(j,fp->read_uint8()); break;
     977                  case RC_S : f->set_var(j,fp->read_uint16()); break;
     978                  case RC_L : f->set_var(j,fp->read_uint32()); break;
    979979                }
    980980
     
    10181018  {
    10191019    fp->seek(se->offset,0);
    1020     int16_t old_tot=fp->read_short();
     1020    int16_t old_tot=fp->read_uint16();
    10211021    se=sd->find("describe_names");
    10221022    if (!se || !old_tot)
     
    10291029    for (i=0;i<old_tot;i++)
    10301030    {
    1031       fp->read(old_name,fp->read_byte());    // read the name
     1031      fp->read(old_name,fp->read_uint8());    // read the name
    10321032      for (o_remap[i]=0xffff,j=0;j<total_objects;j++)  // check for matching current name
    10331033      {
     
    10481048    for (;i<old_tot;i++)
    10491049    {
    1050       int16_t t=fp->read_short();
     1050      int16_t t=fp->read_uint16();
    10511051      s_remap_totals[i]=t;
    10521052      if (t)
     
    10621062      for (;j<t;j++)
    10631063      {
    1064         fp->read(old_name,fp->read_byte());
     1064        fp->read(old_name,fp->read_uint8());
    10651065        int new_type=o_remap[i];       
    10661066        if (new_type<total_objects)     // make sure old object still exsist
     
    10901090      for (;i<old_tot;i++)
    10911091      {
    1092         int16_t t=fp->read_short();
     1092        int16_t t=fp->read_uint16();
    10931093        v_remap_totals[i]=t;
    10941094        if (t)
     
    11001100        for (;j<t;j++)
    11011101        {
    1102           fp->read(old_name,fp->read_byte());
     1102          fp->read(old_name,fp->read_uint8());
    11031103          int new_type=o_remap[i];
    11041104          if (new_type!=0xffff)        // make sure old object still exsist
     
    11221122    if (se)
    11231123    {
    1124       total_objs=fp->read_long();   
     1124      total_objs=fp->read_uint32();   
    11251125
    11261126      se=sd->find("type");
     
    11291129        fp->seek(se->offset,0);
    11301130        last=NULL;
    1131         if (fp->read_byte()==RC_S)    //  read type array, this should be type RC_S
     1131        if (fp->read_uint8()==RC_S)    //  read type array, this should be type RC_S
    11321132        {
    11331133          int i=0;
    11341134          for (;i<total_objs;i++)
    11351135          {
    1136             ushort t=fp->read_short();
     1136            uint16_t t=fp->read_uint16();
    11371137            game_object *p=new game_object(o_remap[t],1);
    11381138            clear_tmp();
     
    11451145          {
    11461146            fp->seek(se->offset,0);
    1147             if (fp->read_byte()==RC_S)    //  read state array, this should be type RC_S
     1147            if (fp->read_uint8()==RC_S)    //  read state array, this should be type RC_S
    11481148            {
    11491149              game_object *l=first;
    11501150              for (i=0;i<total_objs;i++,l=l->next)
    11511151              {
    1152                 int st=fp->read_short();
     1152                int st=fp->read_uint16();
    11531153                if (l->otype==0xffff)
    11541154                  l->state=stopped;
     
    11731173            for (;o && !abort;o=o->next)
    11741174            {
    1175               int16_t ot=fp->read_short();
     1175              int16_t ot=fp->read_uint16();
    11761176              int k=0;
    11771177              for (;k<ot;k++)
    11781178              {
    1179                 if (fp->read_byte()!=RC_L) abort=1;
     1179                if (fp->read_uint8()!=RC_L) abort=1;
    11801180                else
    11811181                {
    1182                   int32_t v=fp->read_long();
     1182                  int32_t v=fp->read_uint32();
    11831183                  if (o->otype!=0xffff)     // non-exstant object
    11841184                  {
     
    12081208              fp->seek(se->offset,0);
    12091209              int t=object_descriptions[j].type;
    1210               if (fp->read_byte()!=t)
     1210              if (fp->read_uint8()!=t)
    12111211                dprintf("Warning : load level -> var '%s' size changed\n");
    12121212              else
     
    12181218                  {
    12191219                    case RC_C :
    1220                     { f->set_var(j,fp->read_byte()); } break;
     1220                    { f->set_var(j,fp->read_uint8()); } break;
    12211221                    case RC_S :
    1222                     { f->set_var(j,fp->read_short()); } break;
     1222                    { f->set_var(j,fp->read_uint16()); } break;
    12231223                    case RC_L :
    1224                     { f->set_var(j,fp->read_long()); } break;
     1224                    { f->set_var(j,fp->read_uint32()); } break;
    12251225                  }
    12261226                 
     
    12931293  {
    12941294    fp->seek(e->offset,0);
    1295     int len=fp->read_byte();   // read the length of the string
     1295    int len=fp->read_uint8();   // read the length of the string
    12961296    first_name=(char *)jmalloc(len,"level first name");
    12971297    fp->read(first_name,len);    // read the string
     
    13081308  {   
    13091309    fp->seek(e->offset,0);
    1310     fg_width=fp->read_long();
    1311     fg_height=fp->read_long();
     1310    fg_width=fp->read_uint32();
     1311    fg_height=fp->read_uint32();
    13121312    map_fg=(uint16_t *)jmalloc(2*fg_width*fg_height,"Map fg : loaded");
    13131313    fp->read((char *)map_fg,2*fg_width*fg_height);
     
    13261326  {
    13271327    fp->seek(e->offset,0);
    1328     bg_width=fp->read_long();
    1329     bg_height=fp->read_long();
     1328    bg_width=fp->read_uint32();
     1329    bg_height=fp->read_uint32();
    13301330    map_bg=(uint16_t *)jmalloc(2*bg_width*bg_height,"Map bg : loaded");
    13311331    fp->read((char *)map_bg,2*bg_width*bg_height);
     
    16441644  eh->font()->put_string(i,80-strlen(buf)*eh->font()->width()/2,100+eh->font()->height(),buf);
    16451645
    1646   fp->write_short(i->width());
    1647   fp->write_short(i->height());
     1646  fp->write_uint16(i->width());
     1647  fp->write_uint16(i->height());
    16481648  int y=0;
    16491649  for (;y<i->height();y++)
     
    16581658  view *v=player_list;
    16591659  for (;v;v=v->next) t++;
    1660   fp->write_long(t);
     1660  fp->write_uint32(t);
    16611661
    16621662  for (v=player_list;v;v=v->next)
    1663     fp->write_long(object_to_number_in_list(v->focus,save_list));
     1663    fp->write_uint32(object_to_number_in_list(v->focus,save_list));
    16641664
    16651665  int tv=total_view_vars();
     
    16671667  for (;i<tv;i++)
    16681668  {
    1669     fp->write_byte(RC_L);
     1669    fp->write_uint8(RC_L);
    16701670    for (v=player_list;v;v=v->next)
    1671       fp->write_long(v->get_view_var_value(i));
    1672   }
    1673 
    1674   fp->write_byte(RC_L);
    1675   fp->write_long(rand_on);
    1676 
    1677   fp->write_byte(RC_L);
    1678   fp->write_long(total_weapons);
     1671      fp->write_uint32(v->get_view_var_value(i));
     1672  }
     1673
     1674  fp->write_uint8(RC_L);
     1675  fp->write_uint32(rand_on);
     1676
     1677  fp->write_uint8(RC_L);
     1678  fp->write_uint32(total_weapons);
    16791679  for (v=player_list;v;v=v->next)
    16801680    for (i=0;i<total_weapons;i++)
    1681       fp->write_long(v->weapons[i]);
     1681      fp->write_uint32(v->weapons[i]);
    16821682
    16831683  for (v=player_list;v;v=v->next)
    16841684  {
    16851685    int len=strlen(v->name)+1;
    1686     fp->write_byte(len);
     1686    fp->write_uint8(len);
    16871687    fp->write(v->name,len);
    16881688  }
     
    17261726    }
    17271727
    1728     int32_t total_players=fp->read_long();
     1728    int32_t total_players=fp->read_uint32();
    17291729    view *last=NULL;
    17301730    int i=0;
    17311731    for (;i<total_players;i++)   
    17321732    {
    1733       game_object *o=number_to_object_in_list(fp->read_long(),save_list);
     1733      game_object *o=number_to_object_in_list(fp->read_uint32(),save_list);
    17341734      v=new view(o,NULL,0);
    17351735      if (o) o->set_controller(v);
     
    17501750      {
    17511751        fp->seek(se->offset,0);
    1752         if (fp->read_byte()==RC_L)
     1752        if (fp->read_uint8()==RC_L)
    17531753        {
    17541754          for (v=player_list;v;v=v->next)
    1755             v->set_view_var_value(i,fp->read_long());
     1755            v->set_view_var_value(i,fp->read_uint32());
    17561756        }
    17571757      } else
     
    17661766    {
    17671767      fp->seek(se->offset,0);
    1768       if (fp->read_byte()==RC_L)
    1769         rand_on=fp->read_long();
     1768      if (fp->read_uint8()==RC_L)
     1769        rand_on=fp->read_uint32();
    17701770    } else rand_on=0;
    17711771
     
    17741774    {
    17751775      fp->seek(se->offset,0);
    1776       if (fp->read_byte()==RC_L)
    1777       {
    1778         int32_t m=fp->read_long();  // read how many weapons exsisted when last saved
     1776      if (fp->read_uint8()==RC_L)
     1777      {
     1778        int32_t m=fp->read_uint32();  // read how many weapons exsisted when last saved
    17791779        int i;
    17801780        for (v=player_list;v;v=v->next)   
     
    17821782          for (i=0;i<m;i++)
    17831783          {
    1784             int32_t x=fp->read_long();
     1784            int32_t x=fp->read_uint32();
    17851785            if (i<total_weapons)
    17861786            {
     
    18061806      for (v=player_list;v;v=v->next)     
    18071807      {
    1808         uchar len=fp->read_byte();
     1808        uint8_t len=fp->read_uint8();
    18091809        fp->read(v->name,len);
    18101810      }
     
    18541854  // record information in the file about what the data structures look like
    18551855  // right now, so if they change later, they don't get get screwed up
    1856   fp->write_short(total_objects);   // mark how many objects we know about right now 
     1856  fp->write_uint16(total_objects);   // mark how many objects we know about right now 
    18571857
    18581858  int i=0;
    18591859  for (;i<total_objects;i++)   // loop through all the object types we know of
    18601860  {   
    1861     fp->write_byte(strlen(object_names[i])+1);                    // sizeof name   
     1861    fp->write_uint8(strlen(object_names[i])+1);                    // sizeof name   
    18621862    fp->write(object_names[i],strlen(object_names[i])+1);      // write object name
    18631863  }
     
    18711871    for (;j<figures[i]->ts;j++)
    18721872      if (figures[i]->seq[j]) total++;
    1873     fp->write_short(total);
     1873    fp->write_uint16(total);
    18741874
    18751875    for (j=0;j<figures[i]->ts;j++)
     
    18771877      {
    18781878        char *state_name=lstring_value(symbol_name(figures[i]->seq_syms[j]));
    1879         fp->write_byte(strlen(state_name)+1);
     1879        fp->write_uint8(strlen(state_name)+1);
    18801880        fp->write(state_name,strlen(state_name)+1);
    18811881      }
     
    18861886  for (i=0;i<total_objects;i++)
    18871887  {
    1888     fp->write_short(figures[i]->tv);
     1888    fp->write_uint16(figures[i]->tv);
    18891889    int j,x;
    18901890   
     
    18961896        {
    18971897          char *var_name=lstring_value(symbol_name(figures[i]->vars[j]));
    1898           fp->write_byte(strlen(var_name)+1);
     1898          fp->write_uint8(strlen(var_name)+1);
    18991899          fp->write(var_name,strlen(var_name)+1);
    19001900        }
     
    19061906  object_node *o=save_list;
    19071907  for (;o;o=o->next) t++;
    1908   fp->write_long(t);
    1909 
    1910 
    1911   fp->write_byte(RC_S);                                    // save type info for each record
    1912   for (o=save_list;o;o=o->next) fp->write_short(o->me->type());   
    1913 
    1914   fp->write_byte(RC_S);                                    // save state info for each record
    1915   for (o=save_list;o;o=o->next) fp->write_short(o->me->reduced_state());
     1908  fp->write_uint32(t);
     1909
     1910
     1911  fp->write_uint8(RC_S);                                    // save type info for each record
     1912  for (o=save_list;o;o=o->next) fp->write_uint16(o->me->type());   
     1913
     1914  fp->write_uint8(RC_S);                                    // save state info for each record
     1915  for (o=save_list;o;o=o->next) fp->write_uint16(o->me->reduced_state());
    19161916
    19171917  for (o=save_list;o;o=o->next)                            // save lvars
    19181918  {
    1919     fp->write_short(figures[o->me->otype]->tv);
     1919    fp->write_uint16(figures[o->me->otype]->tv);
    19201920    for (i=0;i<figures[o->me->otype]->tv;i++)
    19211921    {
    1922       fp->write_byte(RC_L);                           // for now the only type allowed is int32_t
    1923       fp->write_long(o->me->lvars[i]);
     1922      fp->write_uint8(RC_L);                           // for now the only type allowed is int32_t
     1923      fp->write_uint32(o->me->lvars[i]);
    19241924    }
    19251925  }
     
    19281928  {
    19291929    int t=object_descriptions[i].type;
    1930     fp->write_byte(t);
     1930    fp->write_uint8(t);
    19311931    for (o=save_list;o;o=o->next)
    19321932    {
     
    19341934      {         
    19351935        case RC_C :
    1936         { fp->write_byte(o->me->get_var(i)); } break;
     1936        { fp->write_uint8(o->me->get_var(i)); } break;
    19371937        case RC_S :
    1938         { fp->write_short(o->me->get_var(i)); } break;
     1938        { fp->write_uint16(o->me->get_var(i)); } break;
    19391939        case RC_L :
    1940         { fp->write_long(o->me->get_var(i)); } break;
     1940        { fp->write_uint32(o->me->get_var(i)); } break;
    19411941      }
    19421942    }
     
    19631963void level::write_links(bFILE *fp, object_node *save_list, object_node *exclude_list)
    19641964{
    1965   fp->write_byte(RC_L); 
    1966   fp->write_long(total_object_links(save_list));
     1965  fp->write_uint8(RC_L); 
     1966  fp->write_uint32(total_object_links(save_list));
    19671967
    19681968  int x=1;
     
    19741974    for (;i<o->me->total_objects();i++)
    19751975    {
    1976       fp->write_long(x);
     1976      fp->write_uint32(x);
    19771977      int32_t x=object_to_number_in_list(o->me->get_object(i),save_list);
    19781978      if (x)
    1979         fp->write_long(x);
     1979        fp->write_uint32(x);
    19801980      else                            // save links to excluded items as negative
    1981         fp->write_long((int32_t)(-(object_to_number_in_list(o->me,exclude_list))));
    1982     }
    1983   }
    1984 
    1985   fp->write_byte(RC_L); 
    1986   fp->write_long(total_light_links(save_list));
     1981        fp->write_uint32((int32_t)(-(object_to_number_in_list(o->me,exclude_list))));
     1982    }
     1983  }
     1984
     1985  fp->write_uint8(RC_L); 
     1986  fp->write_uint32(total_light_links(save_list));
    19871987
    19881988  x=1;
     
    19921992    for (;i<o->me->total_lights();i++)
    19931993    {
    1994       fp->write_long(x);
    1995       fp->write_long(light_to_number(o->me->get_light(i)));
     1994      fp->write_uint32(x);
     1995      fp->write_uint32(light_to_number(o->me->get_light(i)));
    19961996    }
    19971997  }
     
    20072007  {
    20082008    fp->seek(se->offset,0);
    2009     if (fp->read_byte()==RC_L)
    2010     {
    2011       int32_t t=fp->read_long();
     2009    if (fp->read_uint8()==RC_L)
     2010    {
     2011      int32_t t=fp->read_uint32();
    20122012      while (t)
    20132013      {
    2014         int32_t x1=fp->read_long();
     2014        int32_t x1=fp->read_uint32();
    20152015        CONDITION(x1>=0,"expected x1 for object link to be > 0\n");
    2016         int32_t x2=fp->read_long();
     2016        int32_t x2=fp->read_uint32();
    20172017        game_object *p,*q=number_to_object_in_list(x1,save_list);
    20182018        if (x2>0)
     
    20322032  {
    20332033    fp->seek(se->offset,0);
    2034     if (fp->read_byte()==RC_L)
    2035     {
    2036       int32_t t=fp->read_long();
     2034    if (fp->read_uint8()==RC_L)
     2035    {
     2036      int32_t t=fp->read_uint32();
    20372037      while (t)
    20382038      {
    2039         int32_t x1=fp->read_long();
    2040         int32_t x2=fp->read_long();
     2039        int32_t x1=fp->read_uint32();
     2040        int32_t x2=fp->read_uint32();
    20412041        game_object *p=number_to_object_in_list(x1,save_list);
    20422042        if (p)
     
    20542054{
    20552055  // save background scroll rate
    2056   fp->write_byte(RC_L);
    2057   fp->write_long(bg_xmul);
    2058   fp->write_long(bg_xdiv);
    2059   fp->write_long(bg_ymul);
    2060   fp->write_long(bg_ydiv);
    2061 
    2062   fp->write_byte(RC_L);
     2056  fp->write_uint8(RC_L);
     2057  fp->write_uint32(bg_xmul);
     2058  fp->write_uint32(bg_xdiv);
     2059  fp->write_uint32(bg_ymul);
     2060  fp->write_uint32(bg_ydiv);
     2061
     2062  fp->write_uint8(RC_L);
    20632063  int ta=0;
    20642064  area_controller *a=area_list;
    20652065  for (;a;a=a->next) ta++;
    2066   fp->write_long(ta);
     2066  fp->write_uint32(ta);
    20672067  for (a=area_list;a;a=a->next)
    20682068  {
    2069     fp->write_long(a->x);
    2070     fp->write_long(a->y);
    2071     fp->write_long(a->w);
    2072     fp->write_long(a->h);
    2073     fp->write_long(a->active);
    2074 
    2075     fp->write_long(a->ambient);
    2076     fp->write_long(a->view_xoff);
    2077     fp->write_long(a->view_yoff);
    2078     fp->write_long(a->ambient_speed);
    2079     fp->write_long(a->view_xoff_speed);
    2080     fp->write_long(a->view_yoff_speed);
    2081   }
    2082   fp->write_byte(RC_L);
    2083   fp->write_long(tick_counter());
     2069    fp->write_uint32(a->x);
     2070    fp->write_uint32(a->y);
     2071    fp->write_uint32(a->w);
     2072    fp->write_uint32(a->h);
     2073    fp->write_uint32(a->active);
     2074
     2075    fp->write_uint32(a->ambient);
     2076    fp->write_uint32(a->view_xoff);
     2077    fp->write_uint32(a->view_yoff);
     2078    fp->write_uint32(a->ambient_speed);
     2079    fp->write_uint32(a->view_xoff_speed);
     2080    fp->write_uint32(a->view_yoff_speed);
     2081  }
     2082  fp->write_uint8(RC_L);
     2083  fp->write_uint32(tick_counter());
    20842084}
    20852085
     
    20902090  {
    20912091    fp->seek(se->offset,0);
    2092     if (fp->read_byte()!=RC_L)
     2092    if (fp->read_uint8()!=RC_L)
    20932093    { bg_xmul=bg_ymul=1; bg_xdiv=bg_ydiv=8; }
    20942094    else
    20952095    {
    2096       bg_xmul=fp->read_long();
    2097       bg_xdiv=fp->read_long();
    2098       bg_ymul=fp->read_long();
    2099       bg_ydiv=fp->read_long();
     2096      bg_xmul=fp->read_uint32();
     2097      bg_xdiv=fp->read_uint32();
     2098      bg_ymul=fp->read_uint32();
     2099      bg_ydiv=fp->read_uint32();
    21002100    }
    21012101  } else { bg_xmul=bg_ymul=1; bg_xdiv=bg_ydiv=8; }
     
    21052105  {
    21062106    fp->seek(se->offset,0);
    2107     if (fp->read_byte()==RC_L)
     2107    if (fp->read_uint8()==RC_L)
    21082108    {
    21092109      area_controller *l=NULL,*p;
    2110       int32_t ta=fp->read_long();
     2110      int32_t ta=fp->read_uint32();
    21112111      int i=0;
    21122112      for (;i<ta;i++)
    21132113      {
    21142114        int32_t x,y,w,h;
    2115         x=fp->read_long();
    2116         y=fp->read_long();
    2117         w=fp->read_long();
    2118         h=fp->read_long();     
     2115        x=fp->read_uint32();
     2116        y=fp->read_uint32();
     2117        w=fp->read_uint32();
     2118        h=fp->read_uint32();   
    21192119        p=new area_controller(x,y,w,h,NULL);
    21202120        if (l) l->next=p;
    21212121        else area_list=p;
    21222122        l=p;
    2123         p->active=fp->read_long();
    2124         p->ambient=fp->read_long();
    2125         p->view_xoff=fp->read_long();
    2126         p->view_yoff=fp->read_long();
    2127         p->ambient_speed=fp->read_long();
    2128         p->view_xoff_speed=fp->read_long();
    2129         p->view_yoff_speed=fp->read_long();
     2123        p->active=fp->read_uint32();
     2124        p->ambient=fp->read_uint32();
     2125        p->view_xoff=fp->read_uint32();
     2126        p->view_yoff=fp->read_uint32();
     2127        p->ambient_speed=fp->read_uint32();
     2128        p->view_xoff_speed=fp->read_uint32();
     2129        p->view_yoff_speed=fp->read_uint32();
    21302130      }
    21312131    }
     
    21362136  {
    21372137    fp->seek(se->offset,0);
    2138     if (fp->read_byte()==RC_L)   
    2139       set_tick_counter(fp->read_long());
     2138    if (fp->read_uint8()==RC_L)   
     2139      set_tick_counter(fp->read_uint32());
    21402140    else set_tick_counter(0);
    21412141  } else set_tick_counter(0);
     
    22052205                        {
    22062206                                int32_t size = fp->file_size();
    2207                                 uchar *buf = (uchar *)jmalloc(0x1000,"copy buf");
     2207                                uint8_t *buf = (uint8_t *)jmalloc(0x1000,"copy buf");
    22082208                                int tr = 1;
    22092209                                while( size && tr )
     
    22482248                        if( first_name )
    22492249                        {
    2250                                 fp->write_byte( strlen( first_name ) + 1 );
     2250                                fp->write_uint8( strlen( first_name ) + 1 );
    22512251                                fp->write( first_name, strlen( first_name ) + 1 );
    22522252                        }
    22532253                        else
    22542254                        {
    2255                                 fp->write_byte( 1 );
    2256                                 fp->write_byte( 0 );
     2255                                fp->write_uint8( 1 );
     2256                                fp->write_uint8( 0 );
    22572257                        }
    22582258
    2259                         fp->write_long( fg_width );
    2260                         fp->write_long( fg_height );
     2259                        fp->write_uint32( fg_width );
     2260                        fp->write_uint32( fg_height );
    22612261
    22622262                        int t  = fg_width * fg_height;
    2263                         ushort *rm = map_fg;
     2263                        uint16_t *rm = map_fg;
    22642264                        for (;t;t--,rm++)
    22652265                        {
    2266                                 ushort x = *rm;
     2266                                uint16_t x = *rm;
    22672267                                x = lstl(x);            // convert to intel endianess
    22682268                                *rm = x;
     
    22742274                        for (;t;t--,rm++)
    22752275                        {
    2276                                 ushort x = *rm;
     2276                                uint16_t x = *rm;
    22772277                                x = lstl( x );            // convert to intel endianess
    22782278                                *rm = x;
    22792279                        }
    22802280
    2281                         fp->write_long( bg_width );
    2282                         fp->write_long( bg_height );
     2281                        fp->write_uint32( bg_width );
     2282                        fp->write_uint32( bg_height );
    22832283                        t = bg_width * bg_height;
    22842284                        rm = map_bg;
     
    22862286                        for (;t;t--,rm++)
    22872287                        {
    2288                                 ushort x=*rm;
     2288                                uint16_t x=*rm;
    22892289                                x = lstl( x );          // convert to intel endianess
    22902290                                *rm = x;
     
    22972297                        for (;t;t--,rm++)
    22982298                        {
    2299                                 ushort x = *rm;
     2299                                uint16_t x = *rm;
    23002300                                x = lstl( x );          // convert to intel endianess
    23012301                                *rm = x;
Note: See TracChangeset for help on using the changeset viewer.