Changeset 18


Ignore:
Timestamp:
Nov 10, 2005, 9:44:53 PM (18 years ago)
Author:
Sam Hocevar
Message:
  • renamed RC_C RC_S RC_L to RC_8 RC_16 RC_32
Location:
abuse/trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/include/objects.hpp

    r16 r18  
    2828
    2929
    30 #define RC_C 0
    31 #define RC_S 1
    32 #define RC_L 2
     30#define RC_8 0
     31#define RC_16 1
     32#define RC_32 2
    3333
    3434
  • abuse/trunk/src/level.cpp

    r17 r18  
    918918      fp->seek(se->offset,0);
    919919      last=NULL;
    920       if (fp->read_uint8()==RC_S)    //  read type array, this should be type RC_S
     920      if (fp->read_uint8()==RC_16)    //  read type array, this should be type RC_16
    921921      {
    922922        for (i=0;i<total_objs;i++)
     
    934934        {
    935935          fp->seek(se->offset,0);
    936           if (fp->read_uint8()==RC_S)    //  read state array, this should be type RC_S
     936          if (fp->read_uint8()==RC_16)    //  read state array, this should be type RC_16
    937937          {
    938938            game_object *l=first;
     
    974974                switch (t)
    975975                {
    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;
     976                  case RC_8 : f->set_var(j,fp->read_uint8()); break;
     977                  case RC_16 : f->set_var(j,fp->read_uint16()); break;
     978                  case RC_32 : f->set_var(j,fp->read_uint32()); break;
    979979                }
    980980
     
    11291129        fp->seek(se->offset,0);
    11301130        last=NULL;
    1131         if (fp->read_uint8()==RC_S)    //  read type array, this should be type RC_S
     1131        if (fp->read_uint8()==RC_16)    //  read type array, this should be type RC_16
    11321132        {
    11331133          int i=0;
     
    11451145          {
    11461146            fp->seek(se->offset,0);
    1147             if (fp->read_uint8()==RC_S)    //  read state array, this should be type RC_S
     1147            if (fp->read_uint8()==RC_16)    //  read state array, this should be type RC_16
    11481148            {
    11491149              game_object *l=first;
     
    11771177              for (;k<ot;k++)
    11781178              {
    1179                 if (fp->read_uint8()!=RC_L) abort=1;
     1179                if (fp->read_uint8()!=RC_32) abort=1;
    11801180                else
    11811181                {
     
    12171217                  switch (t)
    12181218                  {
    1219                     case RC_C :
     1219                    case RC_8 :
    12201220                    { f->set_var(j,fp->read_uint8()); } break;
    1221                     case RC_S :
     1221                    case RC_16 :
    12221222                    { f->set_var(j,fp->read_uint16()); } break;
    1223                     case RC_L :
     1223                    case RC_32 :
    12241224                    { f->set_var(j,fp->read_uint32()); } break;
    12251225                  }
     
    16671667  for (;i<tv;i++)
    16681668  {
    1669     fp->write_uint8(RC_L);
     1669    fp->write_uint8(RC_32);
    16701670    for (v=player_list;v;v=v->next)
    16711671      fp->write_uint32(v->get_view_var_value(i));
    16721672  }
    16731673
    1674   fp->write_uint8(RC_L);
     1674  fp->write_uint8(RC_32);
    16751675  fp->write_uint32(rand_on);
    16761676
    1677   fp->write_uint8(RC_L);
     1677  fp->write_uint8(RC_32);
    16781678  fp->write_uint32(total_weapons);
    16791679  for (v=player_list;v;v=v->next)
     
    17501750      {
    17511751        fp->seek(se->offset,0);
    1752         if (fp->read_uint8()==RC_L)
     1752        if (fp->read_uint8()==RC_32)
    17531753        {
    17541754          for (v=player_list;v;v=v->next)
     
    17661766    {
    17671767      fp->seek(se->offset,0);
    1768       if (fp->read_uint8()==RC_L)
     1768      if (fp->read_uint8()==RC_32)
    17691769        rand_on=fp->read_uint32();
    17701770    } else rand_on=0;
     
    17741774    {
    17751775      fp->seek(se->offset,0);
    1776       if (fp->read_uint8()==RC_L)
     1776      if (fp->read_uint8()==RC_32)
    17771777      {
    17781778        int32_t m=fp->read_uint32();  // read how many weapons exsisted when last saved
     
    19091909
    19101910
    1911   fp->write_uint8(RC_S);                                    // save type info for each record
     1911  fp->write_uint8(RC_16);                                    // save type info for each record
    19121912  for (o=save_list;o;o=o->next) fp->write_uint16(o->me->type());   
    19131913
    1914   fp->write_uint8(RC_S);                                    // save state info for each record
     1914  fp->write_uint8(RC_16);                                    // save state info for each record
    19151915  for (o=save_list;o;o=o->next) fp->write_uint16(o->me->reduced_state());
    19161916
     
    19201920    for (i=0;i<figures[o->me->otype]->tv;i++)
    19211921    {
    1922       fp->write_uint8(RC_L);                           // for now the only type allowed is int32_t
     1922      fp->write_uint8(RC_32);                           // for now the only type allowed is int32_t
    19231923      fp->write_uint32(o->me->lvars[i]);
    19241924    }
     
    19331933      switch (t)
    19341934      {         
    1935         case RC_C :
     1935        case RC_8 :
    19361936        { fp->write_uint8(o->me->get_var(i)); } break;
    1937         case RC_S :
     1937        case RC_16 :
    19381938        { fp->write_uint16(o->me->get_var(i)); } break;
    1939         case RC_L :
     1939        case RC_32 :
    19401940        { fp->write_uint32(o->me->get_var(i)); } break;
    19411941      }
     
    19631963void level::write_links(bFILE *fp, object_node *save_list, object_node *exclude_list)
    19641964{
    1965   fp->write_uint8(RC_L); 
     1965  fp->write_uint8(RC_32); 
    19661966  fp->write_uint32(total_object_links(save_list));
    19671967
     
    19831983  }
    19841984
    1985   fp->write_uint8(RC_L); 
     1985  fp->write_uint8(RC_32); 
    19861986  fp->write_uint32(total_light_links(save_list));
    19871987
     
    20072007  {
    20082008    fp->seek(se->offset,0);
    2009     if (fp->read_uint8()==RC_L)
     2009    if (fp->read_uint8()==RC_32)
    20102010    {
    20112011      int32_t t=fp->read_uint32();
     
    20322032  {
    20332033    fp->seek(se->offset,0);
    2034     if (fp->read_uint8()==RC_L)
     2034    if (fp->read_uint8()==RC_32)
    20352035    {
    20362036      int32_t t=fp->read_uint32();
     
    20542054{
    20552055  // save background scroll rate
    2056   fp->write_uint8(RC_L);
     2056  fp->write_uint8(RC_32);
    20572057  fp->write_uint32(bg_xmul);
    20582058  fp->write_uint32(bg_xdiv);
     
    20602060  fp->write_uint32(bg_ydiv);
    20612061
    2062   fp->write_uint8(RC_L);
     2062  fp->write_uint8(RC_32);
    20632063  int ta=0;
    20642064  area_controller *a=area_list;
     
    20802080    fp->write_uint32(a->view_yoff_speed);
    20812081  }
    2082   fp->write_uint8(RC_L);
     2082  fp->write_uint8(RC_32);
    20832083  fp->write_uint32(tick_counter());
    20842084}
     
    20902090  {
    20912091    fp->seek(se->offset,0);
    2092     if (fp->read_uint8()!=RC_L)
     2092    if (fp->read_uint8()!=RC_32)
    20932093    { bg_xmul=bg_ymul=1; bg_xdiv=bg_ydiv=8; }
    20942094    else
     
    21052105  {
    21062106    fp->seek(se->offset,0);
    2107     if (fp->read_uint8()==RC_L)
     2107    if (fp->read_uint8()==RC_32)
    21082108    {
    21092109      area_controller *l=NULL,*p;
     
    21362136  {
    21372137    fp->seek(se->offset,0);
    2138     if (fp->read_uint8()==RC_L)   
     2138    if (fp->read_uint8()==RC_32)   
    21392139      set_tick_counter(fp->read_uint32());
    21402140    else set_tick_counter(0);
  • abuse/trunk/src/objects.cpp

    r16 r18  
    4646
    4747obj_desc object_descriptions[TOTAL_OBJECT_VARS]={
    48                                 {"fade_dir",      RC_C },
    49                                 {"frame_dir",     RC_C },
    50                                 {"direction",     RC_C },
    51                                 {"gravity_on",    RC_C },
    52                                 {"fade_count",    RC_C },
    53 
    54                                 {"fade_max",      RC_C },
    55                                 {"active",        RC_C },
    56                                 {"flags",         RC_C },
    57                                 {"aitype",        RC_C },
    58                                 {"xvel",          RC_L },
    59 
    60                                 {"fxvel",         RC_C },
    61                                 {"yvel",          RC_L },
    62                                 {"fyvel",         RC_C },
    63                                 {"xacel",         RC_L },
    64                                 {"fxacel",        RC_C },
    65 
    66                                 {"yacel",         RC_L },
    67                                 {"fyacel",        RC_C },
    68                                 {"x",             RC_L },
    69                                 {"fx",            RC_C },
    70                                 {"y",             RC_L },
    71 
    72                                 {"fy",            RC_C },
    73                                 {"hp",            RC_S },
    74                                 {"mp",            RC_S },
    75                                 {"fmp",           RC_S },
    76                                 {"cur_frame",     RC_S },
    77 
    78                                 {"aistate",       RC_S },
    79                                 {"aistate_time",  RC_S },
    80                                 {"targetable",    RC_C }
     48                                {"fade_dir",      RC_8 },
     49                                {"frame_dir",     RC_8 },
     50                                {"direction",     RC_8 },
     51                                {"gravity_on",    RC_8 },
     52                                {"fade_count",    RC_8 },
     53
     54                                {"fade_max",      RC_8 },
     55                                {"active",        RC_8 },
     56                                {"flags",         RC_8 },
     57                                {"aitype",        RC_8 },
     58                                {"xvel",          RC_32 },
     59
     60                                {"fxvel",         RC_8 },
     61                                {"yvel",          RC_32 },
     62                                {"fyvel",         RC_8 },
     63                                {"xacel",         RC_32 },
     64                                {"fxacel",        RC_8 },
     65
     66                                {"yacel",         RC_32 },
     67                                {"fyacel",        RC_8 },
     68                                {"x",             RC_32 },
     69                                {"fx",            RC_8 },
     70                                {"y",             RC_32 },
     71
     72                                {"fy",            RC_8 },
     73                                {"hp",            RC_16 },
     74                                {"mp",            RC_16 },
     75                                {"fmp",           RC_16 },
     76                                {"cur_frame",     RC_16 },
     77
     78                                {"aistate",       RC_16 },
     79                                {"aistate_time",  RC_16 },
     80                                {"targetable",    RC_8 }
    8181
    8282                              };
     
    234234  switch (type)
    235235  {
    236     case RC_C :
     236    case RC_8 :
    237237    { return 1; } break;
    238     case RC_S :
     238    case RC_16 :
    239239    { return 2; } break;
    240     case RC_L :
     240    case RC_32 :
    241241    { return 4; } break;
    242242  }             
Note: See TracChangeset for help on using the changeset viewer.