Changeset 17 for abuse/trunk/src/level.cpp
- Timestamp:
- Nov 10, 2005, 9:41:13 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/src/level.cpp
r16 r17 608 608 { 609 609 if (!rcheck) rcheck=open_file("rcheck","rb"); 610 int32_t x=rcheck->read_ long();610 int32_t x=rcheck->read_uint32(); 611 611 if (x!=rand_on) 612 612 dprintf("off!\n"); … … 618 618 rcheck_lp=open_file("rcheck.lp","wb"); 619 619 } 620 rcheck->write_ long(rand_on);620 rcheck->write_uint32(rand_on); 621 621 } else 622 622 { … … 761 761 } 762 762 763 void level::set_tick_counter(u longx)763 void level::set_tick_counter(uint32_t x) 764 764 { 765 765 ctick=x; … … 867 867 { 868 868 fp->seek(se->offset,0); 869 if (RC_type_size(fp->read_ byte())!=size)869 if (RC_type_size(fp->read_uint8())!=size) 870 870 return 0; 871 871 else return 1; … … 886 886 fp->seek(se->offset,0); 887 887 /******************************* Read debug info ******************************/ 888 int16_t old_tot=fp->read_ short();888 int16_t old_tot=fp->read_uint16(); 889 889 uint16_t *o_remap=(uint16_t *)jmalloc(old_tot*2,"obj remap array"); 890 890 char old_name[150]; 891 891 for (i=0;i<old_tot;i++) 892 892 { 893 fp->read(old_name,fp->read_ byte()); // read the name893 fp->read(old_name,fp->read_uint8()); // read the name 894 894 for (o_remap[i]=0xffff,j=0;j<total_objects;j++) // check for matching current name 895 895 { … … 901 901 902 902 /***************************** Read state names *********************************/ 903 int old_stot=fp->read_ short();903 int old_stot=fp->read_uint16(); 904 904 unsigned char *s_remap=(unsigned char *)jmalloc(old_stot,"state remap array"); 905 905 for (i=0;i<old_stot;i++) 906 906 { 907 fp->read(old_name,fp->read_ byte());907 fp->read(old_name,fp->read_uint8()); 908 908 s_remap[i]=stopped; // non exsitant states get mapped into stopped state 909 909 for (j=0;j<MAX_STATE;j++) // see if old state exist now … … 911 911 s_remap[i]=j; 912 912 } 913 total_objs=fp->read_ long();913 total_objs=fp->read_uint32(); 914 914 915 915 se=sd->find("type"); … … 918 918 fp->seek(se->offset,0); 919 919 last=NULL; 920 if (fp->read_ byte()==RC_S) // read type array, this should be type RC_S920 if (fp->read_uint8()==RC_S) // read type array, this should be type RC_S 921 921 { 922 922 for (i=0;i<total_objs;i++) 923 923 { 924 u short t=fp->read_short();924 uint16_t t=fp->read_uint16(); 925 925 game_object *p=new game_object(o_remap[t],1); 926 926 clear_tmp(); … … 934 934 { 935 935 fp->seek(se->offset,0); 936 if (fp->read_ byte()==RC_S) // read state array, this should be type RC_S936 if (fp->read_uint8()==RC_S) // read state array, this should be type RC_S 937 937 { 938 938 game_object *l=first; 939 939 for (i=0;i<total_objs;i++,l=l->next) 940 940 { 941 character_state s=(character_state)s_remap[fp->read_ short()];941 character_state s=(character_state)s_remap[fp->read_uint16()]; 942 942 if (l->otype!=0xffff) 943 943 { … … 965 965 fp->seek(se->offset,0); 966 966 int t=object_descriptions[j].type; 967 if (fp->read_ byte()!=t)967 if (fp->read_uint8()!=t) 968 968 dprintf("Warning : load level -> var '%s' size changed\n"); 969 969 else … … 974 974 switch (t) 975 975 { 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; 979 979 } 980 980 … … 1018 1018 { 1019 1019 fp->seek(se->offset,0); 1020 int16_t old_tot=fp->read_ short();1020 int16_t old_tot=fp->read_uint16(); 1021 1021 se=sd->find("describe_names"); 1022 1022 if (!se || !old_tot) … … 1029 1029 for (i=0;i<old_tot;i++) 1030 1030 { 1031 fp->read(old_name,fp->read_ byte()); // read the name1031 fp->read(old_name,fp->read_uint8()); // read the name 1032 1032 for (o_remap[i]=0xffff,j=0;j<total_objects;j++) // check for matching current name 1033 1033 { … … 1048 1048 for (;i<old_tot;i++) 1049 1049 { 1050 int16_t t=fp->read_ short();1050 int16_t t=fp->read_uint16(); 1051 1051 s_remap_totals[i]=t; 1052 1052 if (t) … … 1062 1062 for (;j<t;j++) 1063 1063 { 1064 fp->read(old_name,fp->read_ byte());1064 fp->read(old_name,fp->read_uint8()); 1065 1065 int new_type=o_remap[i]; 1066 1066 if (new_type<total_objects) // make sure old object still exsist … … 1090 1090 for (;i<old_tot;i++) 1091 1091 { 1092 int16_t t=fp->read_ short();1092 int16_t t=fp->read_uint16(); 1093 1093 v_remap_totals[i]=t; 1094 1094 if (t) … … 1100 1100 for (;j<t;j++) 1101 1101 { 1102 fp->read(old_name,fp->read_ byte());1102 fp->read(old_name,fp->read_uint8()); 1103 1103 int new_type=o_remap[i]; 1104 1104 if (new_type!=0xffff) // make sure old object still exsist … … 1122 1122 if (se) 1123 1123 { 1124 total_objs=fp->read_ long();1124 total_objs=fp->read_uint32(); 1125 1125 1126 1126 se=sd->find("type"); … … 1129 1129 fp->seek(se->offset,0); 1130 1130 last=NULL; 1131 if (fp->read_ byte()==RC_S) // read type array, this should be type RC_S1131 if (fp->read_uint8()==RC_S) // read type array, this should be type RC_S 1132 1132 { 1133 1133 int i=0; 1134 1134 for (;i<total_objs;i++) 1135 1135 { 1136 u short t=fp->read_short();1136 uint16_t t=fp->read_uint16(); 1137 1137 game_object *p=new game_object(o_remap[t],1); 1138 1138 clear_tmp(); … … 1145 1145 { 1146 1146 fp->seek(se->offset,0); 1147 if (fp->read_ byte()==RC_S) // read state array, this should be type RC_S1147 if (fp->read_uint8()==RC_S) // read state array, this should be type RC_S 1148 1148 { 1149 1149 game_object *l=first; 1150 1150 for (i=0;i<total_objs;i++,l=l->next) 1151 1151 { 1152 int st=fp->read_ short();1152 int st=fp->read_uint16(); 1153 1153 if (l->otype==0xffff) 1154 1154 l->state=stopped; … … 1173 1173 for (;o && !abort;o=o->next) 1174 1174 { 1175 int16_t ot=fp->read_ short();1175 int16_t ot=fp->read_uint16(); 1176 1176 int k=0; 1177 1177 for (;k<ot;k++) 1178 1178 { 1179 if (fp->read_ byte()!=RC_L) abort=1;1179 if (fp->read_uint8()!=RC_L) abort=1; 1180 1180 else 1181 1181 { 1182 int32_t v=fp->read_ long();1182 int32_t v=fp->read_uint32(); 1183 1183 if (o->otype!=0xffff) // non-exstant object 1184 1184 { … … 1208 1208 fp->seek(se->offset,0); 1209 1209 int t=object_descriptions[j].type; 1210 if (fp->read_ byte()!=t)1210 if (fp->read_uint8()!=t) 1211 1211 dprintf("Warning : load level -> var '%s' size changed\n"); 1212 1212 else … … 1218 1218 { 1219 1219 case RC_C : 1220 { f->set_var(j,fp->read_ byte()); } break;1220 { f->set_var(j,fp->read_uint8()); } break; 1221 1221 case RC_S : 1222 { f->set_var(j,fp->read_ short()); } break;1222 { f->set_var(j,fp->read_uint16()); } break; 1223 1223 case RC_L : 1224 { f->set_var(j,fp->read_ long()); } break;1224 { f->set_var(j,fp->read_uint32()); } break; 1225 1225 } 1226 1226 … … 1293 1293 { 1294 1294 fp->seek(e->offset,0); 1295 int len=fp->read_ byte(); // read the length of the string1295 int len=fp->read_uint8(); // read the length of the string 1296 1296 first_name=(char *)jmalloc(len,"level first name"); 1297 1297 fp->read(first_name,len); // read the string … … 1308 1308 { 1309 1309 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(); 1312 1312 map_fg=(uint16_t *)jmalloc(2*fg_width*fg_height,"Map fg : loaded"); 1313 1313 fp->read((char *)map_fg,2*fg_width*fg_height); … … 1326 1326 { 1327 1327 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(); 1330 1330 map_bg=(uint16_t *)jmalloc(2*bg_width*bg_height,"Map bg : loaded"); 1331 1331 fp->read((char *)map_bg,2*bg_width*bg_height); … … 1644 1644 eh->font()->put_string(i,80-strlen(buf)*eh->font()->width()/2,100+eh->font()->height(),buf); 1645 1645 1646 fp->write_ short(i->width());1647 fp->write_ short(i->height());1646 fp->write_uint16(i->width()); 1647 fp->write_uint16(i->height()); 1648 1648 int y=0; 1649 1649 for (;y<i->height();y++) … … 1658 1658 view *v=player_list; 1659 1659 for (;v;v=v->next) t++; 1660 fp->write_ long(t);1660 fp->write_uint32(t); 1661 1661 1662 1662 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)); 1664 1664 1665 1665 int tv=total_view_vars(); … … 1667 1667 for (;i<tv;i++) 1668 1668 { 1669 fp->write_ byte(RC_L);1669 fp->write_uint8(RC_L); 1670 1670 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); 1679 1679 for (v=player_list;v;v=v->next) 1680 1680 for (i=0;i<total_weapons;i++) 1681 fp->write_ long(v->weapons[i]);1681 fp->write_uint32(v->weapons[i]); 1682 1682 1683 1683 for (v=player_list;v;v=v->next) 1684 1684 { 1685 1685 int len=strlen(v->name)+1; 1686 fp->write_ byte(len);1686 fp->write_uint8(len); 1687 1687 fp->write(v->name,len); 1688 1688 } … … 1726 1726 } 1727 1727 1728 int32_t total_players=fp->read_ long();1728 int32_t total_players=fp->read_uint32(); 1729 1729 view *last=NULL; 1730 1730 int i=0; 1731 1731 for (;i<total_players;i++) 1732 1732 { 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); 1734 1734 v=new view(o,NULL,0); 1735 1735 if (o) o->set_controller(v); … … 1750 1750 { 1751 1751 fp->seek(se->offset,0); 1752 if (fp->read_ byte()==RC_L)1752 if (fp->read_uint8()==RC_L) 1753 1753 { 1754 1754 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()); 1756 1756 } 1757 1757 } else … … 1766 1766 { 1767 1767 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(); 1770 1770 } else rand_on=0; 1771 1771 … … 1774 1774 { 1775 1775 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 saved1776 if (fp->read_uint8()==RC_L) 1777 { 1778 int32_t m=fp->read_uint32(); // read how many weapons exsisted when last saved 1779 1779 int i; 1780 1780 for (v=player_list;v;v=v->next) … … 1782 1782 for (i=0;i<m;i++) 1783 1783 { 1784 int32_t x=fp->read_ long();1784 int32_t x=fp->read_uint32(); 1785 1785 if (i<total_weapons) 1786 1786 { … … 1806 1806 for (v=player_list;v;v=v->next) 1807 1807 { 1808 u char len=fp->read_byte();1808 uint8_t len=fp->read_uint8(); 1809 1809 fp->read(v->name,len); 1810 1810 } … … 1854 1854 // record information in the file about what the data structures look like 1855 1855 // 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 now1856 fp->write_uint16(total_objects); // mark how many objects we know about right now 1857 1857 1858 1858 int i=0; 1859 1859 for (;i<total_objects;i++) // loop through all the object types we know of 1860 1860 { 1861 fp->write_ byte(strlen(object_names[i])+1); // sizeof name1861 fp->write_uint8(strlen(object_names[i])+1); // sizeof name 1862 1862 fp->write(object_names[i],strlen(object_names[i])+1); // write object name 1863 1863 } … … 1871 1871 for (;j<figures[i]->ts;j++) 1872 1872 if (figures[i]->seq[j]) total++; 1873 fp->write_ short(total);1873 fp->write_uint16(total); 1874 1874 1875 1875 for (j=0;j<figures[i]->ts;j++) … … 1877 1877 { 1878 1878 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); 1880 1880 fp->write(state_name,strlen(state_name)+1); 1881 1881 } … … 1886 1886 for (i=0;i<total_objects;i++) 1887 1887 { 1888 fp->write_ short(figures[i]->tv);1888 fp->write_uint16(figures[i]->tv); 1889 1889 int j,x; 1890 1890 … … 1896 1896 { 1897 1897 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); 1899 1899 fp->write(var_name,strlen(var_name)+1); 1900 1900 } … … 1906 1906 object_node *o=save_list; 1907 1907 for (;o;o=o->next) t++; 1908 fp->write_ long(t);1909 1910 1911 fp->write_ byte(RC_S); // save type info for each record1912 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 record1915 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()); 1916 1916 1917 1917 for (o=save_list;o;o=o->next) // save lvars 1918 1918 { 1919 fp->write_ short(figures[o->me->otype]->tv);1919 fp->write_uint16(figures[o->me->otype]->tv); 1920 1920 for (i=0;i<figures[o->me->otype]->tv;i++) 1921 1921 { 1922 fp->write_ byte(RC_L); // for now the only type allowed is int32_t1923 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]); 1924 1924 } 1925 1925 } … … 1928 1928 { 1929 1929 int t=object_descriptions[i].type; 1930 fp->write_ byte(t);1930 fp->write_uint8(t); 1931 1931 for (o=save_list;o;o=o->next) 1932 1932 { … … 1934 1934 { 1935 1935 case RC_C : 1936 { fp->write_ byte(o->me->get_var(i)); } break;1936 { fp->write_uint8(o->me->get_var(i)); } break; 1937 1937 case RC_S : 1938 { fp->write_ short(o->me->get_var(i)); } break;1938 { fp->write_uint16(o->me->get_var(i)); } break; 1939 1939 case RC_L : 1940 { fp->write_ long(o->me->get_var(i)); } break;1940 { fp->write_uint32(o->me->get_var(i)); } break; 1941 1941 } 1942 1942 } … … 1963 1963 void level::write_links(bFILE *fp, object_node *save_list, object_node *exclude_list) 1964 1964 { 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)); 1967 1967 1968 1968 int x=1; … … 1974 1974 for (;i<o->me->total_objects();i++) 1975 1975 { 1976 fp->write_ long(x);1976 fp->write_uint32(x); 1977 1977 int32_t x=object_to_number_in_list(o->me->get_object(i),save_list); 1978 1978 if (x) 1979 fp->write_ long(x);1979 fp->write_uint32(x); 1980 1980 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)); 1987 1987 1988 1988 x=1; … … 1992 1992 for (;i<o->me->total_lights();i++) 1993 1993 { 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))); 1996 1996 } 1997 1997 } … … 2007 2007 { 2008 2008 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(); 2012 2012 while (t) 2013 2013 { 2014 int32_t x1=fp->read_ long();2014 int32_t x1=fp->read_uint32(); 2015 2015 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(); 2017 2017 game_object *p,*q=number_to_object_in_list(x1,save_list); 2018 2018 if (x2>0) … … 2032 2032 { 2033 2033 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(); 2037 2037 while (t) 2038 2038 { 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(); 2041 2041 game_object *p=number_to_object_in_list(x1,save_list); 2042 2042 if (p) … … 2054 2054 { 2055 2055 // 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); 2063 2063 int ta=0; 2064 2064 area_controller *a=area_list; 2065 2065 for (;a;a=a->next) ta++; 2066 fp->write_ long(ta);2066 fp->write_uint32(ta); 2067 2067 for (a=area_list;a;a=a->next) 2068 2068 { 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()); 2084 2084 } 2085 2085 … … 2090 2090 { 2091 2091 fp->seek(se->offset,0); 2092 if (fp->read_ byte()!=RC_L)2092 if (fp->read_uint8()!=RC_L) 2093 2093 { bg_xmul=bg_ymul=1; bg_xdiv=bg_ydiv=8; } 2094 2094 else 2095 2095 { 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(); 2100 2100 } 2101 2101 } else { bg_xmul=bg_ymul=1; bg_xdiv=bg_ydiv=8; } … … 2105 2105 { 2106 2106 fp->seek(se->offset,0); 2107 if (fp->read_ byte()==RC_L)2107 if (fp->read_uint8()==RC_L) 2108 2108 { 2109 2109 area_controller *l=NULL,*p; 2110 int32_t ta=fp->read_ long();2110 int32_t ta=fp->read_uint32(); 2111 2111 int i=0; 2112 2112 for (;i<ta;i++) 2113 2113 { 2114 2114 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(); 2119 2119 p=new area_controller(x,y,w,h,NULL); 2120 2120 if (l) l->next=p; 2121 2121 else area_list=p; 2122 2122 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(); 2130 2130 } 2131 2131 } … … 2136 2136 { 2137 2137 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()); 2140 2140 else set_tick_counter(0); 2141 2141 } else set_tick_counter(0); … … 2205 2205 { 2206 2206 int32_t size = fp->file_size(); 2207 u char *buf = (uchar*)jmalloc(0x1000,"copy buf");2207 uint8_t *buf = (uint8_t *)jmalloc(0x1000,"copy buf"); 2208 2208 int tr = 1; 2209 2209 while( size && tr ) … … 2248 2248 if( first_name ) 2249 2249 { 2250 fp->write_ byte( strlen( first_name ) + 1 );2250 fp->write_uint8( strlen( first_name ) + 1 ); 2251 2251 fp->write( first_name, strlen( first_name ) + 1 ); 2252 2252 } 2253 2253 else 2254 2254 { 2255 fp->write_ byte( 1 );2256 fp->write_ byte( 0 );2255 fp->write_uint8( 1 ); 2256 fp->write_uint8( 0 ); 2257 2257 } 2258 2258 2259 fp->write_ long( fg_width );2260 fp->write_ long( fg_height );2259 fp->write_uint32( fg_width ); 2260 fp->write_uint32( fg_height ); 2261 2261 2262 2262 int t = fg_width * fg_height; 2263 u short *rm = map_fg;2263 uint16_t *rm = map_fg; 2264 2264 for (;t;t--,rm++) 2265 2265 { 2266 u short x = *rm;2266 uint16_t x = *rm; 2267 2267 x = lstl(x); // convert to intel endianess 2268 2268 *rm = x; … … 2274 2274 for (;t;t--,rm++) 2275 2275 { 2276 u short x = *rm;2276 uint16_t x = *rm; 2277 2277 x = lstl( x ); // convert to intel endianess 2278 2278 *rm = x; 2279 2279 } 2280 2280 2281 fp->write_ long( bg_width );2282 fp->write_ long( bg_height );2281 fp->write_uint32( bg_width ); 2282 fp->write_uint32( bg_height ); 2283 2283 t = bg_width * bg_height; 2284 2284 rm = map_bg; … … 2286 2286 for (;t;t--,rm++) 2287 2287 { 2288 u short x=*rm;2288 uint16_t x=*rm; 2289 2289 x = lstl( x ); // convert to intel endianess 2290 2290 *rm = x; … … 2297 2297 for (;t;t--,rm++) 2298 2298 { 2299 u short x = *rm;2299 uint16_t x = *rm; 2300 2300 x = lstl( x ); // convert to intel endianess 2301 2301 *rm = x;
Note: See TracChangeset
for help on using the changeset viewer.