Changeset 17 for abuse/trunk
- Timestamp:
- Nov 10, 2005, 9:41:13 PM (18 years ago)
- Location:
- abuse/trunk/src
- Files:
-
- 87 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/src/cache.cpp
r10 r17 67 67 } 68 68 69 fp->write_ short(total);69 fp->write_uint16(total); 70 70 total=0; 71 71 for (i=0;i<total_files;i++) 72 72 { 73 u longcrc;73 uint32_t crc; 74 74 int failed=0; 75 75 crc=get_crc(i,failed); 76 76 if (!failed) 77 77 { 78 fp->write_ long(crc);79 u charlen=strlen(get_filename(i))+1;80 fp->write_ byte(len);78 fp->write_uint32(crc); 79 uint8_t len=strlen(get_filename(i))+1; 80 fp->write_uint8(len); 81 81 fp->write(get_filename(i),len); 82 82 total++; … … 96 96 } else 97 97 { 98 short total=fp->read_ short();98 short total=fp->read_uint16(); 99 99 int i; 100 100 for (i=0;i<total;i++) 101 101 { 102 102 char name[256]; 103 u long crc=fp->read_long();104 u char len=fp->read_byte();103 uint32_t crc=fp->read_uint32(); 104 uint8_t len=fp->read_uint8(); 105 105 fp->read(name,len); 106 106 set_crc(get_filenumber(name),crc); … … 148 148 } 149 149 150 char *crc_manager::get_filename( longfilenumber)150 char *crc_manager::get_filename(int32_t filenumber) 151 151 { 152 152 CHECK(filenumber>=0 && filenumber<total_files); … … 154 154 } 155 155 156 u long crc_manager::get_crc(longfilenumber, int &failed)156 uint32_t crc_manager::get_crc(int32_t filenumber, int &failed) 157 157 { 158 158 CHECK(filenumber>=0 && filenumber<total_files); … … 166 166 } 167 167 168 void crc_manager::set_crc( long filenumber, ulongcrc)168 void crc_manager::set_crc(int32_t filenumber, uint32_t crc) 169 169 { 170 170 CHECK(filenumber>=0 && filenumber<total_files); … … 248 248 if (fp) 249 249 { 250 fp->write_ short(crc_man.total_filenames());250 fp->write_uint16(crc_man.total_filenames()); 251 251 for (i=0;i<crc_man.total_filenames();i++) 252 252 { 253 253 int l=strlen(crc_man.get_filename(i))+1; 254 fp->write_ byte(l);254 fp->write_uint8(l); 255 255 fp->write(crc_man.get_filename(i),l); 256 256 } … … 259 259 for (i=0;i<total;i++) 260 260 if (list[i].last_access>0) tsaved++; 261 fp->write_ long(tsaved);261 fp->write_uint32(tsaved); 262 262 263 263 for (i=0;i<total;i++) … … 266 266 if (list[id].last_access>0) // don't save unaccessed counts 267 267 { 268 fp->write_ byte(list[id].type); // save type, if type changed on reload268 fp->write_uint8(list[id].type); // save type, if type changed on reload 269 269 // don't cache in-> its a different refrence 270 fp->write_ short(list[id].file_number);271 fp->write_ long(list[id].offset);270 fp->write_uint16(list[id].file_number); 271 fp->write_uint32(list[id].offset); 272 272 } 273 273 } … … 310 310 311 311 312 int cache_list::search(int *sarray, u short filenum, longoffset)312 int cache_list::search(int *sarray, uint16_t filenum, int32_t offset) 313 313 { 314 314 int x1=0,x2=total-1; … … 423 423 424 424 int j; 425 u short *fg_line;425 uint16_t *fg_line; 426 426 for (j=0;j<lev->foreground_height();j++) 427 427 { … … 439 439 } 440 440 441 u short *bg_line;441 uint16_t *bg_line; 442 442 for (j=0;j<lev->background_height();j++) 443 443 { … … 481 481 int *fnum_remap; // remaps old filenumbers into current ones 482 482 483 tnames=fp->read_ short();483 tnames=fp->read_uint16(); 484 484 if (tnames) /// make sure there isn't bad info in the file 485 485 { … … 489 489 for (i=0;i<tnames;i++) 490 490 { 491 fp->read(name,fp->read_ byte());491 fp->read(name,fp->read_uint8()); 492 492 fnum_remap[i]=-1; // initialize the map to no-map 493 493 … … 498 498 } 499 499 500 long tsaved=fp->read_long();500 uint32_t tsaved=fp->read_uint32(); 501 501 502 502 … … 511 511 for (i=0;i<tsaved;i++) 512 512 { 513 u char type=fp->read_byte();514 short file_num=fp->read_ short();513 uint8_t type=fp->read_uint8(); 514 short file_num=fp->read_uint16(); 515 515 if (file_num>=tnames) // bad data? 516 516 file_num=-1; 517 517 else file_num=fnum_remap[file_num]; 518 518 519 u long offset=fp->read_long();519 uint32_t offset=fp->read_uint32(); 520 520 521 521 // search for a match … … 805 805 } 806 806 807 longcache_list::alloc_id()807 int32_t cache_list::alloc_id() 808 808 { 809 809 int id; … … 851 851 852 852 853 longcache_list::reg_lisp_block(Cell *block)853 int32_t cache_list::reg_lisp_block(Cell *block) 854 854 { 855 longs;855 uint32_t s; 856 856 if (lcache_number==-1) 857 857 lcache_number=crc_man.get_filenumber(lfname); … … 893 893 894 894 s=block_size(block); 895 cache_file->write_ long(s);895 cache_file->write_uint32(s); 896 896 write_level(cache_file,block); 897 897 return id; 898 898 } 899 899 900 longcache_list::reg_object(char *filename, void *object, int type, int rm_dups)900 int32_t cache_list::reg_object(char *filename, void *object, int type, int rm_dups) 901 901 { 902 902 char *name; … … 912 912 extern int total_files_open; 913 913 914 longcache_list::reg(char *filename, char *name, int type, int rm_dups)914 int32_t cache_list::reg(char *filename, char *name, int type, int rm_dups) 915 915 { 916 916 int id=alloc_id(),i,fn=crc_man.get_filenumber(filename); … … 1169 1169 int cache_size=80*1024; // 80K 1170 1170 cache_read_file->set_read_buffer_size(cache_size); 1171 u charmini_buf;1171 uint8_t mini_buf; 1172 1172 cache_read_file->read(&mini_buf,1); // prime the buffer 1173 1173 } … … 1177 1177 int sp=alloc_space; alloc_space=ALLOC_SPACE_CACHE; 1178 1178 1179 long size=cache_read_file->read_long();1179 uint32_t size=cache_read_file->read_uint32(); 1180 1180 void *space; 1181 1181 … … 1206 1206 void cache_list::free_oldest() 1207 1207 { 1208 longi,old_time=last_access;1208 uint32_t i,old_time=last_access; 1209 1209 cache_item *ci=list,*oldest=NULL; 1210 1210 ful=1; … … 1257 1257 printf("type=(%20s) file=(%20s) access=(%6ld)\n",spec_types[ci->type], 1258 1258 crc_man.get_filename(ci->file_number), 1259 ci->last_access);1259 (long int)ci->last_access); 1260 1260 } 1261 1261 } while (new_old); -
abuse/trunk/src/clisp.cpp
r16 r17 20 20 #include "netcfg.hpp" 21 21 22 extern u charmajor_version;23 extern u charminor_version;22 extern uint8_t major_version; 23 extern uint8_t minor_version; 24 24 extern int has_joystick; 25 25 … … 60 60 61 61 *l_statbar_logo_x,*l_statbar_logo_y; 62 u charchatting_enabled=0;62 uint8_t chatting_enabled=0; 63 63 64 64 extern void scatter_line(int x1, int y1, int x2, int y2, int c, int s); … … 1909 1909 { 1910 1910 palette *p=pal->copy(); 1911 u char *addr=(uchar*)p->addr();1911 uint8_t *addr=(uint8_t *)p->addr(); 1912 1912 int r,g,b; 1913 1913 int ra=lnumber_value(CAR(args)); args=CDR(args); … … 1916 1916 for (int i=0;i<256;i++) 1917 1917 { 1918 r=(int)*addr+ra; if (r>255) r=255; else if (r<0) r=0; *addr=(u char)r; addr++;1919 g=(int)*addr+ga; if (g>255) g=255; else if (g<0) g=0; *addr=(u char)g; addr++;1920 b=(int)*addr+ba; if (b>255) b=255; else if (b<0) b=0; *addr=(u char)b; addr++;1918 r=(int)*addr+ra; if (r>255) r=255; else if (r<0) r=0; *addr=(uint8_t)r; addr++; 1919 g=(int)*addr+ga; if (g>255) g=255; else if (g<0) g=0; *addr=(uint8_t)g; addr++; 1920 b=(int)*addr+ba; if (b>255) b=255; else if (b<0) b=0; *addr=(uint8_t)b; addr++; 1921 1921 } 1922 1922 p->load(); -
abuse/trunk/src/compiled.cpp
r2 r17 6 6 extern int total_objects; 7 7 8 u char *bad_guy_array=NULL;// list flaging each character saying they are a bad bug or not8 uint8_t *bad_guy_array=NULL; // list flaging each character saying they are a bad bug or not 9 9 // mainly used by the rocket to find targets 10 10 11 longS_fall_start,S_falling,S_landing,S_pounce_wait,11 int32_t S_fall_start,S_falling,S_landing,S_pounce_wait, 12 12 S_turn_around,S_fire_wait,S_ceil_fire,S_top_walk, 13 13 S_blown_back_dead,S_jump_up,S_hiding,S_weapon_fire, … … 28 28 int compile_error=0; 29 29 30 longc_state(char *name)30 int32_t c_state(char *name) 31 31 { 32 32 void *sym=find_symbol(name); … … 114 114 { 115 115 b=symbol_value(b); 116 bad_guy_array=(u char*)jmalloc(total_objects,"bad_guy_array");116 bad_guy_array=(uint8_t *)jmalloc(total_objects,"bad_guy_array"); 117 117 memset(bad_guy_array,0,total_objects); 118 118 while (b) 119 119 { 120 longx=lnumber_value(CAR(b));120 int32_t x=lnumber_value(CAR(b)); 121 121 if (x>=0 && x<total_objects) 122 122 bad_guy_array[x]=1; -
abuse/trunk/src/cop.cpp
r16 r17 797 797 798 798 palette *p=pal->copy(); 799 u char *addr=(uchar*)p->addr();799 uint8_t *addr=(uint8_t *)p->addr(); 800 800 int ra,ga,ba; 801 801 802 802 for (int i=0;i<256;i++) 803 803 { 804 ra=(int)*addr+r; if (ra>255) ra=255; else if (ra<0) r=0; *addr=(u char)ra; addr++;805 ga=(int)*addr+g; if (ga>255) ga=255; else if (ga<0) g=0; *addr=(u char)ga; addr++;806 ba=(int)*addr+b; if (ba>255) ba=255; else if (ba<0) b=0; *addr=(u char)ba; addr++;804 ra=(int)*addr+r; if (ra>255) ra=255; else if (ra<0) r=0; *addr=(uint8_t)ra; addr++; 805 ga=(int)*addr+g; if (ga>255) ga=255; else if (ga<0) g=0; *addr=(uint8_t)ga; addr++; 806 ba=(int)*addr+b; if (ba>255) ba=255; else if (ba<0) b=0; *addr=(uint8_t)ba; addr++; 807 807 } 808 808 p->load(); -
abuse/trunk/src/crc.cpp
r2 r17 1 1 #include "crc.hpp" 2 2 3 u nsigned short calc_crc(unsigned char *buf, longlen)3 uint16_t calc_crc(uint8_t *buf, int len) 4 4 { 5 u nsigned charc1=0,c2=0;5 uint8_t c1=0,c2=0; 6 6 while (len) 7 7 { … … 16 16 17 17 18 u longcrc_file(bFILE *fp)18 uint32_t crc_file(bFILE *fp) 19 19 { 20 u charcrc1=0,crc2=0,crc3=0,crc4=0;20 uint8_t crc1=0,crc2=0,crc3=0,crc4=0; 21 21 22 22 int size=0x1000; 23 u char *buffer=(uchar*)jmalloc(size,"crc_buffer"),*c;23 uint8_t *buffer=(uint8_t *)jmalloc(size,"crc_buffer"),*c; 24 24 long l=fp->file_size(); 25 25 long cur_pos=fp->tell(); -
abuse/trunk/src/demo.cpp
r16 r17 62 62 the_game->load_level(name); 63 63 record_file->write((void *)"DEMO,VERSION:2",14); 64 record_file->write_ byte(strlen(name)+1);64 record_file->write_uint8(strlen(name)+1); 65 65 record_file->write(name,strlen(name)+1); 66 66 … … 68 68 if (DEFINEDP(symbol_value(l_difficulty))) 69 69 { 70 if (symbol_value(l_difficulty)==l_easy) record_file->write_ byte(0);71 else if (symbol_value(l_difficulty)==l_medium) record_file->write_ byte(1);72 else if (symbol_value(l_difficulty)==l_hard) record_file->write_ byte(2);73 else record_file->write_ byte(3);74 } else record_file->write_ byte(3);70 if (symbol_value(l_difficulty)==l_easy) record_file->write_uint8(0); 71 else if (symbol_value(l_difficulty)==l_medium) record_file->write_uint8(1); 72 else if (symbol_value(l_difficulty)==l_hard) record_file->write_uint8(2); 73 else record_file->write_uint8(3); 74 } else record_file->write_uint8(3); 75 75 76 76 … … 94 94 p->get_input(); 95 95 96 base->packet.write_ byte(SCMD_SYNC);97 base->packet.write_ short(make_sync());96 base->packet.write_uint8(SCMD_SYNC); 97 base->packet.write_uint16(make_sync()); 98 98 demo_man.save_packet(base->packet.packet_data(),base->packet.packet_size()); 99 99 process_packet_commands(base->packet.packet_data(),base->packet.packet_size()); … … 102 102 case PLAYING : 103 103 { 104 u charbuf[1500];104 uint8_t buf[1500]; 105 105 int size; 106 106 if (get_packet(buf,size)) // get starting inputs … … 138 138 int demo_manager::start_playing(char *filename) 139 139 { 140 u charsig[15];140 uint8_t sig[15]; 141 141 record_file=open_file(filename,"rb"); 142 142 if (record_file->open_failure()) { delete record_file; return 0; } … … 232 232 if (state==RECORDING) 233 233 { 234 u short ps=lstl(packet_size);234 uint16_t ps=lstl(packet_size); 235 235 if (record_file->write(&ps,2)!=2 || 236 236 record_file->write(packet,packet_size)!=packet_size) … … 247 247 if (state==PLAYING) 248 248 { 249 u short ps;249 uint16_t ps; 250 250 if (record_file->read(&ps,2)!=2) 251 251 { -
abuse/trunk/src/dev.cpp
r16 r17 405 405 new_height-=y+new_height-cy2; 406 406 407 u chard;407 uint8_t d; 408 408 for (iy=iy_start;new_height>0;new_height--,y++,iy+=ystep) 409 409 { … … 568 568 jfree(ch); 569 569 char buf[100]; 570 sprintf(buf,"%8ld %8ld", j_allocated(),j_available());570 sprintf(buf,"%8ld %8ld",(long int)j_allocated(),(long int)j_available()); 571 571 eh->font()->put_string(memprof->screen,memprof->x1(),memprof->y2()-eh->font()->height(),buf); 572 572 -
abuse/trunk/src/director.cpp
r2 r17 25 25 26 26 27 int text_draw(int y, int x1, int y1, int x2, int y2, char *buf, JCFont *font, u char*cmap, char color)27 int text_draw(int y, int x1, int y1, int x2, int y2, char *buf, JCFont *font, uint8_t *cmap, char color) 28 28 { 29 29 short cx1,cy1,cx2,cy2,word_size,word_len; -
abuse/trunk/src/endgame.cpp
r2 r17 21 21 { 22 22 int x,size; 23 u short *remap;24 u char*light;23 uint16_t *remap; 24 uint8_t *light; 25 25 } ; 26 26 27 27 28 int text_draw(int y, int x1, int y1, int x2, int y2, char *buf, JCFont *font, u char*cmap, char color);28 int text_draw(int y, int x1, int y1, int x2, int y2, char *buf, JCFont *font, uint8_t *cmap, char color); 29 29 30 30 mask_line *make_mask_lines(image *mask, int map_width) … … 34 34 { 35 35 // find the start of the run.. 36 u char*sl=mask->scan_line(y);36 uint8_t *sl=mask->scan_line(y); 37 37 int x=0; 38 38 while (*sl==0) { sl++; x++; } … … 42 42 // find the length of the run 43 43 int size=0; 44 u char*sl_start=sl;44 uint8_t *sl_start=sl; 45 45 while (*sl!=0 && x<mask->width()) { sl++; x++; size++; } 46 46 p[y].size=size; 47 47 48 48 // now calculate remap for line 49 p[y].remap=(u short *)jmalloc(size*2,"mask remap");50 p[y].light=(u char*)jmalloc(size,"mask light");51 u short *rem=p[y].remap;52 u char*lrem=p[y].light;49 p[y].remap=(uint16_t *)jmalloc(size*2,"mask remap"); 50 p[y].light=(uint8_t *)jmalloc(size,"mask light"); 51 uint16_t *rem=p[y].remap; 52 uint8_t *lrem=p[y].light; 53 53 for (x=0;x<size;x++,rem++) 54 54 { … … 69 69 70 70 71 void scan_map(image *screen, int sx, int sy, image *im1, image *im2, int fade256, long*paddr, mask_line *p, int mask_height,71 void scan_map(image *screen, int sx, int sy, image *im1, image *im2, int fade256, int32_t *paddr, mask_line *p, int mask_height, 72 72 int xoff, int coff) 73 73 { 74 74 int x1=10000,x2=0; 75 75 int iw=im1->width(); 76 u short r,off;76 uint16_t r,off; 77 77 int y=0; 78 u char*l;78 uint8_t *l; 79 79 80 80 for (;y<mask_height;y++) 81 81 { 82 82 mask_line *n=p+y; 83 u char*sl=screen->scan_line(y+sy)+sx+n->x;84 u char*sl2=im1->scan_line(y);85 u char*sl3=im2->scan_line(y);83 uint8_t *sl=screen->scan_line(y+sy)+sx+n->x; 84 uint8_t *sl2=im1->scan_line(y); 85 uint8_t *sl3=im2->scan_line(y); 86 86 l=n->light; 87 u short *rem=n->remap;87 uint16_t *rem=n->remap; 88 88 if (sx+n->x<x1) x1=sx+n->x; 89 89 int x=0; … … 95 95 if (off>=iw) off-=iw; 96 96 97 longp1=*(paddr+sl2[off]);98 longp2=*(paddr+sl3[off]);97 int32_t p1=*(paddr+sl2[off]); 98 int32_t p2=*(paddr+sl3[off]); 99 99 100 100 int r1=p1>>16,g1=(p1>>8)&0xff,b1=p1&0xff; … … 104 104 b3=b1+(b2-b1)*fade256/256; 105 105 106 u charc=color_table->lookup_color(r3>>3,g3>>3,b3>>3);106 uint8_t c=color_table->lookup_color(r3>>3,g3>>3,b3>>3); 107 107 108 108 *sl=*(white_light+((*l)/2+28+jrand()%4)*256+c); … … 123 123 class ex_char { 124 124 public : 125 u charframe,char_num;125 uint8_t frame,char_num; 126 126 int x,y; 127 127 ex_char *next; … … 175 175 pal->find_closest(100,100,100), 176 176 pal->find_closest(64,64,64)}; 177 u short sinfo[800*3],*si;177 uint16_t sinfo[800*3],*si; 178 178 179 179 for (si=sinfo,i=0;i<800;i++) … … 184 184 screen->putpixel(si[-3],si[-2],si[-1]); 185 185 } 186 longpaddr[256];186 int32_t paddr[256]; 187 187 if (old_pal) 188 188 { … … 354 354 355 355 356 u charcmap[32];356 uint8_t cmap[32]; 357 357 for (i=0;i<32;i++) 358 358 cmap[i]=pal->find_closest(i*256/32,i*256/32,i*256/32); … … 428 428 fade_in(NULL,32); 429 429 430 u charcmap[32];430 uint8_t cmap[32]; 431 431 int i; 432 432 for (i=0;i<32;i++) … … 480 480 fade_in(im,32); 481 481 482 u charcmap[32];482 uint8_t cmap[32]; 483 483 int i; 484 484 for (i=0;i<32;i++) -
abuse/trunk/src/extend.cpp
r2 r17 4 4 5 5 Simple object (power ups, non-moving objects) 6 longx,y;7 schardirection;8 u short otype,state9 u short current_frame;6 int32_t x,y; 7 int8_t direction; 8 uint16_t otype,state 9 uint16_t current_frame; 10 10 extension * 11 11 12 12 13 13 Moving object (simple lisp controlled characters) 14 u charflags;15 longxvel,yvel,xacel,yacel;16 u charfx,fy,fxvel,fyvel,fxacel,fyacel,aitype;17 u short aistate,aistate_time;18 u nsigned short hp,mp,14 uint8_t flags; 15 int32_t xvel,yvel,xacel,yacel; 16 uint8_t fx,fy,fxvel,fyvel,fxacel,fyacel,aitype; 17 uint16_t aistate,aistate_time; 18 uint16_t hp,mp, 19 19 extension * 20 20 21 21 22 22 Complex objects (can controll lights, other characters, and have a neural net ai) 23 u chartobjs,tlights;23 uint8_t tobjs,tlights; 24 24 object_list * 25 25 light_list * 26 26 nnet_info * 27 scharfade_dir, frame_dir;28 u nsigned charfade_count,fade_max;27 int8_t fade_dir, frame_dir; 28 uint8_t fade_count,fade_max; 29 29 morph_char *morph_status; 30 30 -
abuse/trunk/src/game.cpp
r16 r17 71 71 72 72 int registered=0; 73 extern u charchatting_enabled;73 extern uint8_t chatting_enabled; 74 74 75 75 extern int confirm_quit(); … … 686 686 } 687 687 688 void remap_area(image *screen, int x1, int y1, int x2, int y2, u char*remap)689 { 690 u char *sl=(uchar*)screen->scan_line(y1)+x1;688 void remap_area(image *screen, int x1, int y1, int x2, int y2, uint8_t *remap) 689 { 690 uint8_t *sl=(uint8_t *)screen->scan_line(y1)+x1; 691 691 int x,y,a=screen->width()-(x2-x1+1); 692 u charc;692 uint8_t c; 693 693 for (y=y1;y<=y2;y++) 694 694 { … … 826 826 827 827 int bh=current_level->background_height(),bw=current_level->background_width(); 828 u short *bl;828 uint16_t *bl; 829 829 for (draw_y=yo,y=y1;y<=y2;y++,draw_y+=yinc) 830 830 { … … 853 853 // server_check(); 854 854 855 u charrescan=0;855 uint8_t rescan=0; 856 856 857 857 int fw,fh; … … 918 918 if (!(draw_y<ncy1 ||draw_y+yinc>=ncy2)) 919 919 { 920 u short *cl=current_level->get_fgline(y)+x1;921 u char*sl1=screen->scan_line(draw_y)+xo;920 uint16_t *cl=current_level->get_fgline(y)+x1; 921 uint8_t *sl1=screen->scan_line(draw_y)+xo; 922 922 for (x=x1,draw_x=xo;x<=x2;x++,cl++,sl1+=xinc,draw_x+=xinc) 923 923 { … … 929 929 // else fort_num=0; 930 930 931 u char*sl2=get_fg(fort_num)->micro_image->scan_line(0);932 u char*sl3=sl1;931 uint8_t *sl2=get_fg(fort_num)->micro_image->scan_line(0); 932 uint8_t *sl3=sl1; 933 933 memcpy(sl3,sl2,AUTOTILE_WIDTH); sl2+=AUTOTILE_WIDTH; sl3+=scr_w; 934 934 memcpy(sl3,sl2,AUTOTILE_WIDTH); sl2+=AUTOTILE_WIDTH; sl3+=scr_w; … … 949 949 { 950 950 951 u short *cl;951 uint16_t *cl; 952 952 if (y<fg_h) 953 953 cl=current_level->get_fgline(y)+x1; 954 954 else cl=NULL; 955 u char*sl1=draw_y<ncy1 ? 0 : screen->scan_line(draw_y)+xo;955 uint8_t *sl1=draw_y<ncy1 ? 0 : screen->scan_line(draw_y)+xo; 956 956 957 957 for (x=x1,draw_x=xo;x<=x2;x++,draw_x+=xinc,cl++,sl1+=xinc) … … 1007 1007 for (y=y1,draw_y=yo;y<=y2;y++,draw_y+=yinc) 1008 1008 { 1009 u short *cl=current_level->get_fgline(y)+x1;1009 uint16_t *cl=current_level->get_fgline(y)+x1; 1010 1010 for (x=x1,draw_x=xo;x<=x2;x++,draw_x+=xinc,cl++) 1011 1011 { … … 1041 1041 for (y=y1,draw_y=yo;y<=y2;y++,draw_y+=yinc) 1042 1042 { 1043 u short *cl;1043 uint16_t *cl; 1044 1044 if (y<fg_h) 1045 1045 cl=current_level->get_fgline(y)+x1; … … 1053 1053 { 1054 1054 point_list *p=get_fg(fort_num)->points; 1055 u char*d=p->data;1055 uint8_t *d=p->data; 1056 1056 if (p->tot) 1057 1057 { … … 1202 1202 for (i=0;i<steps;i++) 1203 1203 { 1204 u char *sl1=(uchar*)pal->addr();1205 u char *sl2=(uchar*)old_pal->addr();1204 uint8_t *sl1=(uint8_t *)pal->addr(); 1205 uint8_t *sl2=(uint8_t *)old_pal->addr(); 1206 1206 int j; 1207 1207 int v=(i+1)*256/steps; … … 1226 1226 for (i=0;i<steps;i++) 1227 1227 { 1228 u char *sl1=(uchar*)pal->addr();1229 u char *sl2=(uchar*)old_pal->addr();1228 uint8_t *sl1=(uint8_t *)pal->addr(); 1229 uint8_t *sl2=(uint8_t *)old_pal->addr(); 1230 1230 int j; 1231 1231 int v=(steps-i)*256/steps; … … 1248 1248 } 1249 1249 1250 int text_draw(int y, int x1, int y1, int x2, int y2, char *buf, JCFont *font, u char*cmap, char color);1250 int text_draw(int y, int x1, int y1, int x2, int y2, char *buf, JCFont *font, uint8_t *cmap, char color); 1251 1251 1252 1252 void do_title() … … 1311 1311 1312 1312 fade_in( NULL, 16 ); 1313 u charcmap[32];1313 uint8_t cmap[32]; 1314 1314 for( i = 0; i < 32; i++ ) 1315 1315 cmap[i] = pal->find_closest( i * 256 / 32, i * 256 / 32, i * 256 / 32 ); … … 1733 1733 { 1734 1734 if( chat && chat->chat_event( ev ) ) 1735 base->packet.write_ byte( SCMD_CHAT_KEYPRESS );1735 base->packet.write_uint8( SCMD_CHAT_KEYPRESS ); 1736 1736 else 1737 base->packet.write_ byte( SCMD_KEYPRESS );1737 base->packet.write_uint8( SCMD_KEYPRESS ); 1738 1738 } 1739 1739 else 1740 base->packet.write_ byte( SCMD_EXT_KEYPRESS );1741 base->packet.write_ byte( client_number() );1740 base->packet.write_uint8( SCMD_EXT_KEYPRESS ); 1741 base->packet.write_uint8( client_number() ); 1742 1742 if( ev.key > 256 ) 1743 base->packet.write_ byte( ev.key - 256 );1743 base->packet.write_uint8( ev.key - 256 ); 1744 1744 else 1745 base->packet.write_ byte( ev.key );1745 base->packet.write_uint8( ev.key ); 1746 1746 } 1747 1747 } … … 1752 1752 { 1753 1753 if( ev.key < 256 ) 1754 base->packet.write_ byte( SCMD_KEYRELEASE );1754 base->packet.write_uint8( SCMD_KEYRELEASE ); 1755 1755 else 1756 base->packet.write_ byte( SCMD_EXT_KEYRELEASE );1757 base->packet.write_ byte( client_number() );1756 base->packet.write_uint8( SCMD_EXT_KEYRELEASE ); 1757 base->packet.write_uint8( client_number() ); 1758 1758 if( ev.key > 255 ) 1759 base->packet.write_ byte( ev.key - 256 );1759 base->packet.write_uint8( ev.key - 256 ); 1760 1760 else 1761 base->packet.write_ byte( ev.key );1761 base->packet.write_uint8( ev.key ); 1762 1762 } 1763 1763 } … … 2032 2032 2033 2033 2034 base->packet.write_ byte(SCMD_SYNC);2035 base->packet.write_ short(make_sync());2034 base->packet.write_uint8(SCMD_SYNC); 2035 base->packet.write_uint16(make_sync()); 2036 2036 2037 2037 if (base->join_list) 2038 base->packet.write_ byte(SCMD_RELOAD);2038 base->packet.write_uint8(SCMD_RELOAD); 2039 2039 2040 2040 // printf("save tick %d, pk size=%d, rand_on=%d, sync=%d\n",current_level->tick_counter(), … … 2049 2049 if (!(dev&EDIT_MODE) && current_level) 2050 2050 { 2051 u charbuf[PACKET_MAX_SIZE+1];2051 uint8_t buf[PACKET_MAX_SIZE+1]; 2052 2052 int size; 2053 2053 -
abuse/trunk/src/gamma.cpp
r4 r17 220 220 for( int i = 0; i < 256; i++ ) 221 221 { 222 u charoldr, oldg, oldb;222 uint8_t oldr, oldg, oldb; 223 223 old_pal->get( i, oldr, oldg, oldb ); 224 224 pal->set( i, (int)( pow( oldr / 255.0, gamma ) * 255 ), -
abuse/trunk/src/go.cpp
r2 r17 60 60 { 61 61 load(fp,state_remap); 62 allow_dir=read_ short(fp);62 allow_dir=read_uint16(fp); 63 63 } 64 64 … … 118 118 { 119 119 load(fp,state_remap); 120 dir=read_ short(fp);121 speed=read_ short(fp);120 dir=read_uint16(fp); 121 speed=read_uint16(fp); 122 122 } 123 123 … … 125 125 { 126 126 game_object::save(fp); 127 write_ short(fp,dir);128 write_ short(fp,speed);127 write_uint16(fp,dir); 128 write_uint16(fp,speed); 129 129 } 130 130 … … 268 268 void sensor::save(FILE *fp) 269 269 { game_object::save(fp); 270 write_ short(fp,xrange);271 write_ short(fp,yrange);272 write_ short(fp,signal);273 274 write_ byte(fp,strlen(aname())+1);270 write_uint16(fp,xrange); 271 write_uint16(fp,yrange); 272 write_uint16(fp,signal); 273 274 write_uint8(fp,strlen(aname())+1); 275 275 fwrite(aname(),strlen(aname())+1,1,fp); 276 276 } … … 279 279 { 280 280 load(fp,state_remap); 281 xrange=read_ short(fp);282 yrange=read_ short(fp);283 signal=read_ short(fp);281 xrange=read_uint16(fp); 282 yrange=read_uint16(fp); 283 signal=read_uint16(fp); 284 284 285 285 char name[200]; 286 fread(name,read_ byte(fp),1,fp);286 fread(name,read_uint8(fp),1,fp); 287 287 get_activate(name); 288 288 } -
abuse/trunk/src/imlib/filter.cpp
r2 r17 172 172 { 173 173 fp->seek(e->offset,0); 174 fp->read_ short();174 fp->read_uint16(); 175 175 int colors=32; 176 176 color_table=(unsigned char *)jmalloc(colors*colors*colors,"color_filter : loaded"); … … 187 187 { 188 188 int colors=32; 189 fp->write_ short(colors);189 fp->write_uint16(colors); 190 190 return fp->write(color_table,colors*colors*colors)==colors*colors*colors; 191 191 } … … 220 220 screen->add_dirty(x,y,x+xl-1,y+yl-1); 221 221 222 u char*pg1=screen->scan_line(y),*source,*dest;223 u char*pg2=im->scan_line(y1);222 uint8_t *pg1=screen->scan_line(y),*source,*dest; 223 uint8_t *pg2=im->scan_line(y1); 224 224 int i; 225 225 for (int j=0;j<yl;j++) -
abuse/trunk/src/imlib/gifread.cpp
r4 r17 15 15 16 16 struct { 17 u nsigned short int Width;18 u nsigned short int Height;19 u nsigned charColorMap[3][256];20 u nsigned short int BitPixel;21 u nsigned short int ColorResolution;22 u nsigned short int Background;23 u nsigned short int AspectRatio;17 uint16_t Width; 18 uint16_t Height; 19 uint8_t ColorMap[3][256]; 20 uint16_t BitPixel; 21 uint16_t ColorResolution; 22 uint16_t Background; 23 uint16_t AspectRatio; 24 24 } GifScreen; 25 25 26 26 struct { 27 u nsigned short int w,h;28 u nsigned charcolor_info,background,reserved;27 uint16_t w,h; 28 uint8_t color_info,background,reserved; 29 29 } gif_screen; 30 30 31 31 struct { 32 u nsigned short int xoff,yoff,w,h;33 u nsigned charcolor_info;32 uint16_t xoff,yoff,w,h; 33 uint8_t color_info; 34 34 } gif_image; 35 35 … … 37 37 { 38 38 char buf[100],er; 39 u nsigned charsep;39 uint8_t sep; 40 40 unsigned int ncolors; 41 41 FILE *fp; … … 53 53 if (!strcmp("GIF87a",buf)) 54 54 { 55 fread(( char*)&gif_screen.w,2,1,fp);56 gif_screen.w= int_to_local(gif_screen.w);57 fread(( char*)&gif_screen.h,2,1,fp);58 gif_screen.h= int_to_local(gif_screen.h);59 fread(( char*)&gif_screen.color_info,1,1,fp);60 fread(( char*)&gif_screen.background,1,1,fp);61 if (fread(( char*)&gif_screen.reserved,1,1,fp)==1)55 fread((uint8_t *)&gif_screen.w,2,1,fp); 56 gif_screen.w=uint16_to_local(gif_screen.w); 57 fread((uint8_t *)&gif_screen.h,2,1,fp); 58 gif_screen.h=uint16_to_local(gif_screen.h); 59 fread((uint8_t *)&gif_screen.color_info,1,1,fp); 60 fread((uint8_t *)&gif_screen.background,1,1,fp); 61 if (fread((uint8_t *)&gif_screen.reserved,1,1,fp)==1) 62 62 { 63 63 if (gif_screen.color_info&128) … … 69 69 if (pal) 70 70 { 71 if (fread(( char*)pal->addr(),1,ncolors*3,fp)!=ncolors*3) er=imREAD_ERROR;71 if (fread((uint8_t *)pal->addr(),1,ncolors*3,fp)!=ncolors*3) er=imREAD_ERROR; 72 72 } else er=imMEMORY_ERROR; 73 73 } … … 75 75 { do 76 76 { 77 if (fread(( char*)&sep,1,1,fp)!=1)77 if (fread((uint8_t *)&sep,1,1,fp)!=1) 78 78 er=imREAD_ERROR; 79 79 } while (!er && sep!=','); 80 fread(( char*)&gif_image.xoff,2,1,fp);81 gif_image.xoff= int_to_local(gif_image.xoff);82 fread(( char*)&gif_image.yoff,2,1,fp);83 gif_image.yoff= int_to_local(gif_image.yoff);84 fread(( char*)&gif_image.w,2,1,fp);85 gif_image.w= int_to_local(gif_image.w);86 fread(( char*)&gif_image.h,2,1,fp);87 gif_image.h= int_to_local(gif_image.h);88 if (!er && (fread(( char*)&gif_image.color_info,1,1,fp)==1))80 fread((uint8_t *)&gif_image.xoff,2,1,fp); 81 gif_image.xoff=uint16_to_local(gif_image.xoff); 82 fread((uint8_t *)&gif_image.yoff,2,1,fp); 83 gif_image.yoff=uint16_to_local(gif_image.yoff); 84 fread((uint8_t *)&gif_image.w,2,1,fp); 85 gif_image.w=uint16_to_local(gif_image.w); 86 fread((uint8_t *)&gif_image.h,2,1,fp); 87 gif_image.h=uint16_to_local(gif_image.h); 88 if (!er && (fread((uint8_t *)&gif_image.color_info,1,1,fp)==1)) 89 89 { 90 90 if (gif_image.color_info&128) … … 95 95 pal = new palette(ncolors); 96 96 if (pal) 97 { if (fread(( char*)pal->addr(),1,ncolors*3,fp)!=ncolors*3) er=imREAD_ERROR;97 { if (fread((uint8_t *)pal->addr(),1,ncolors*3,fp)!=ncolors*3) er=imREAD_ERROR; 98 98 } else er=imMEMORY_ERROR; 99 99 } -
abuse/trunk/src/imlib/glread.cpp
r2 r17 9 9 { 10 10 image *im,*sub; 11 u nsigned short length,y;12 u nsigned charsize,first,width,height,gsize,last;11 uint16_t length,y; 12 uint8_t size,first,width,height,gsize,last; 13 13 FILE *fp; 14 14 fp=fopen(fn,"rb"); 15 15 if (!fp) return NULL; 16 fread(&length,1,2,fp); length= int_to_local(length);16 fread(&length,1,2,fp); length=uint16_to_local(length); 17 17 fread(&size,1,1,fp); 18 18 fread(&first,1,1,fp); … … 45 45 image *im; 46 46 char x[4],bpp; 47 u nsigned char*sl=NULL,esc,c,n,marker,vmode;48 u nsigned short w,h,len,bufsize,blocks,sn,esize,edesc;47 uint8_t *sl=NULL,esc,c,n,marker,vmode; 48 uint16_t w,h,len,bufsize,blocks,sn,esize,edesc; 49 49 int xx,yy; 50 50 FILE *fp; … … 55 55 fread(&w,1,2,fp); 56 56 fread(&h,1,2,fp); 57 w= int_to_local(w); h=int_to_local(h);57 w=uint16_to_local(w); h=uint16_to_local(h); 58 58 fread(x,1,4,fp); 59 59 fread(&bpp,1,1,fp); … … 66 66 fread(&vmode,1,1,fp); 67 67 fread(&edesc,1,2,fp); 68 edesc= int_to_local(edesc);68 edesc=uint16_to_local(edesc); 69 69 fread(&esize,1,2,fp); 70 esize= int_to_local(esize);70 esize=uint16_to_local(esize); 71 71 if (esize==768 && !pal) 72 72 { pal=new palette(1<<bpp); … … 77 77 fseek(fp,esize,SEEK_CUR); 78 78 fread(&blocks,1,2,fp); 79 blocks= int_to_local(blocks);79 blocks=uint16_to_local(blocks); 80 80 81 81 yy=h; xx=w; … … 84 84 { 85 85 fread(&bufsize,1,2,fp); 86 bufsize= int_to_local(bufsize);86 bufsize=uint16_to_local(bufsize); 87 87 fread(&len,1,2,fp); 88 len= int_to_local(len);88 len=uint16_to_local(len); 89 89 fread(&esc,1,1,fp); 90 90 while (yy>=0 && len) … … 113 113 { 114 114 fread(&sn,1,2,fp); 115 sn= int_to_local(sn);115 sn=uint16_to_local(sn); 116 116 fread(&c,1,1,fp); 117 117 while (sn-- && yy>=0 && len) -
abuse/trunk/src/imlib/image.cpp
r2 r17 12 12 #include <stdlib.h> 13 13 14 extern u nsigned charcurrent_background;14 extern uint8_t current_background; 15 15 char *imerr_messages[]={"No error", 16 16 "Error occured while reading", … … 23 23 24 24 25 short imerror=0;26 short swpfile_num=0;27 28 short current_error()25 int16_t imerror=0; 26 int16_t swpfile_num=0; 27 28 int16_t current_error() 29 29 { return imerror; } 30 30 … … 48 48 } 49 49 50 void set_error( short x)50 void set_error(int16_t x) 51 51 { imerror=x; } 52 52 53 short last_error()54 { 55 short ec;53 int16_t last_error() 54 { 55 int16_t ec; 56 56 ec=imerror; 57 57 imerror=0; … … 62 62 63 63 64 image_descriptor::image_descriptor( short length, short height,64 image_descriptor::image_descriptor(int16_t length, int16_t height, 65 65 int keep_dirties, int static_memory) 66 66 … … 72 72 } 73 73 74 void image::change_size( short new_width, short new_height, unsigned char*page)74 void image::change_size(int16_t new_width, int16_t new_height, uint8_t *page) 75 75 { 76 76 delete_page(); … … 97 97 } 98 98 99 u nsigned char image::pixel(short x, short y)99 uint8_t image::pixel(int16_t x, int16_t y) 100 100 { 101 101 CONDITION(x>=0 && x<width() && y>=0 && y<height(), … … 104 104 } 105 105 106 void image::putpixel( short x, short y, char color)106 void image::putpixel(int16_t x, int16_t y, char color) 107 107 { 108 108 CONDITION(x>=0 && x<width() && y>=0 && y<height(), … … 116 116 117 117 118 image::image( short width, short height, unsigned char *page_buffer, short create_descriptor)118 image::image(int16_t width, int16_t height, uint8_t *page_buffer, int16_t create_descriptor) 119 119 { 120 120 w=width; … … 132 132 image::image(spec_entry *e, bFILE *fp) 133 133 { 134 short i;134 int16_t i; 135 135 fp->seek(e->offset,0); 136 w=fp->read_ short();137 h=fp->read_ short();136 w=fp->read_uint16(); 137 h=fp->read_uint16(); 138 138 special=NULL; 139 139 make_page(w,h,NULL); … … 145 145 image::image(bFILE *fp) 146 146 { 147 short i;148 w=fp->read_ short();149 h=fp->read_ short();147 int16_t i; 148 w=fp->read_uint16(); 149 h=fp->read_uint16(); 150 150 special=NULL; 151 151 make_page(w,h,NULL); … … 172 172 void image_init() 173 173 { 174 u nsigned charbt[2];175 u nsigned short wrd,*up;174 uint8_t bt[2]; 175 uint16_t wrd,*up; 176 176 bt[0]=1; 177 177 bt[1]=0; 178 up=(u nsigned short *)bt;179 wrd= int_to_intel(*up);178 up=(uint16_t *)bt; 179 wrd=uint16_to_intel(*up); 180 180 if (wrd!=0x01) 181 181 { printf("Compiled under wrong ENDING-nes, edit system.h and try again\n"); … … 187 187 188 188 189 long image::total_pixels(unsigned charbackground)190 { 191 short i,j;192 longco;193 u nsigned char*c;189 int32_t image::total_pixels(uint8_t background) 190 { 191 int16_t i,j; 192 int32_t co; 193 uint8_t *c; 194 194 for (co=0,i=height()-1;i>=0;i--) 195 195 { c=scan_line(i); … … 200 200 } 201 201 202 void image::clear( short color)203 { 204 short i;202 void image::clear(int16_t color) 203 { 204 int16_t i; 205 205 if (color==-1) color=current_background; 206 206 if (special) … … 220 220 { 221 221 image *im; 222 u nsigned char*c,*dat;222 uint8_t *c,*dat; 223 223 int i; 224 dat=(u nsigned char*)jmalloc(width(),"image copy");224 dat=(uint8_t *)jmalloc(width(),"image copy"); 225 225 im=new image(width(),height()); 226 226 for (i=height()-1;i>=0;i--) … … 236 236 237 237 238 void image::line( short x1, short y1,short x2, short y2, unsigned charcolor)239 { 240 short i,xc,yc,er,n,m,xi,yi,xcxi,ycyi,xcyi;238 void image::line(int16_t x1, int16_t y1,int16_t x2, int16_t y2, uint8_t color) 239 { 240 int16_t i,xc,yc,er,n,m,xi,yi,xcxi,ycyi,xcyi; 241 241 unsigned dcy,dcx; 242 242 // check to make sure that both endpoint are on the screen 243 243 244 short cx1,cy1,cx2,cy2;244 int16_t cx1,cy1,cx2,cy2; 245 245 246 246 // check to see if the line is completly clipped off … … 378 378 379 379 380 void image::put_image(image *screen, short x, short y, char transparent)381 { 382 short i,j,xl,yl;383 u nsigned char*pg1,*pg2,*source,*dest;380 void image::put_image(image *screen, int16_t x, int16_t y, char transparent) 381 { 382 int16_t i,j,xl,yl; 383 uint8_t *pg1,*pg2,*source,*dest; 384 384 if (screen->special) // the screen is clipped then we onl want to put 385 385 // part of the image … … 417 417 } 418 418 419 void image::fill_image(image *screen, short x1, short y1, short x2, short y2, short allign)420 { 421 short i,j,w,xx,start,xl,starty;422 u nsigned char*pg1,*pg2;419 void image::fill_image(image *screen, int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t allign) 420 { 421 int16_t i,j,w,xx,start,xl,starty; 422 uint8_t *pg1,*pg2; 423 423 CHECK(x1<=x2 && y1<=y2); // we should have gotten this 424 424 … … 467 467 468 468 469 void image::put_part(image *screen, short x, short y,470 short x1, short y1, short x2, short y2, char transparent)471 { 472 short xl,yl,j,i;473 short cx1,cy1,cx2,cy2;474 u nsigned char*pg1,*pg2,*source,*dest;469 void image::put_part(image *screen, int16_t x, int16_t y, 470 int16_t x1, int16_t y1, int16_t x2, int16_t y2, char transparent) 471 { 472 int16_t xl,yl,j,i; 473 int16_t cx1,cy1,cx2,cy2; 474 uint8_t *pg1,*pg2,*source,*dest; 475 475 CHECK(x1<=x2 && y1<=y2); 476 476 … … 533 533 } 534 534 535 void image::put_part_xrev(image *screen, short x, short y,536 short x1, short y1, short x2, short y2, char transparent)537 { 538 short xl,yl,j,i;539 short cx1,cy1,cx2,cy2;540 u nsigned char*pg1,*pg2,*source,*dest;535 void image::put_part_xrev(image *screen, int16_t x, int16_t y, 536 int16_t x1, int16_t y1, int16_t x2, int16_t y2, char transparent) 537 { 538 int16_t xl,yl,j,i; 539 int16_t cx1,cy1,cx2,cy2; 540 uint8_t *pg1,*pg2,*source,*dest; 541 541 CHECK(x1<=x2 && y1<=y2); 542 542 … … 596 596 597 597 598 void image::put_part_masked(image *screen, image *mask, short x, short y,599 short maskx, short masky,600 short x1, short y1, short x2, short y2)601 { 602 short xl,yl,j,i,ml,mh;603 short cx1,cy1,cx2,cy2;604 u nsigned char*pg1,*pg2,*pg3;598 void image::put_part_masked(image *screen, image *mask, int16_t x, int16_t y, 599 int16_t maskx, int16_t masky, 600 int16_t x1, int16_t y1, int16_t x2, int16_t y2) 601 { 602 int16_t xl,yl,j,i,ml,mh; 603 int16_t cx1,cy1,cx2,cy2; 604 uint8_t *pg1,*pg2,*pg3; 605 605 CHECK(x1<=x2 && y1<=y2); 606 606 … … 658 658 659 659 660 u nsigned charimage::brightest_color(palette *pal)661 { u nsigned char*p,r,g,b,bri;662 short i,j;663 longbrv;660 uint8_t image::brightest_color(palette *pal) 661 { uint8_t *p,r,g,b,bri; 662 int16_t i,j; 663 int32_t brv; 664 664 brv=0; bri=0; 665 665 for (j=0;j<h;j++) … … 668 668 for (i=0;i<w;i++) 669 669 { pal->get(p[i],r,g,b); 670 if (( long)r*(long)g*(long)b>brv)671 { brv=( long)r*(long)g*(long)b;670 if ((int32_t)r*(int32_t)g*(int32_t)b>brv) 671 { brv=(int32_t)r*(int32_t)g*(int32_t)b; 672 672 bri=p[i]; 673 673 } … … 677 677 } 678 678 679 u nsigned char image::darkest_color(palette *pal, short noblack)680 { u nsigned char*p,r,g,b,bri;681 short i,j;682 longbrv,x;683 brv=( long)258*(long)258*(long)258; bri=0;679 uint8_t image::darkest_color(palette *pal, int16_t noblack) 680 { uint8_t *p,r,g,b,bri; 681 int16_t i,j; 682 int32_t brv,x; 683 brv=(int32_t)258*(int32_t)258*(int32_t)258; bri=0; 684 684 for (j=0;j<h;j++) 685 685 { … … 687 687 for (i=0;i<w;i++) 688 688 { pal->get(p[i],r,g,b); 689 x=( long)r*(long)g*(long)b;689 x=(int32_t)r*(int32_t)g*(int32_t)b; 690 690 if (x<brv && (x || !noblack)) 691 691 { brv=x; … … 697 697 } 698 698 699 void image::rectangle( short x1, short y1,short x2, short y2, unsigned charcolor)699 void image::rectangle(int16_t x1, int16_t y1,int16_t x2, int16_t y2, uint8_t color) 700 700 { 701 701 line(x1,y1,x2,y1,color); … … 705 705 } 706 706 707 void image::set_clip( short x1, short y1, short x2, short y2)707 void image::set_clip(int16_t x1, int16_t y1, int16_t x2, int16_t y2) 708 708 { 709 709 // If the image does not already have an Image descriptor, allocate one. … … 718 718 } 719 719 720 void image::get_clip ( short &x1, short &y1, short &x2, short &y2)720 void image::get_clip (int16_t &x1, int16_t &y1, int16_t &x2, int16_t &y2) 721 721 { 722 722 if (special) … … 726 726 } 727 727 728 void image::in_clip ( short x1, short y1, short x2, short y2)728 void image::in_clip (int16_t x1, int16_t y1, int16_t x2, int16_t y2) 729 729 { 730 730 if (special) … … 747 747 { 748 748 dirty_rect *p,*q; 749 short x1,y1,x2,y2,nn;749 int16_t x1,y1,x2,y2,nn; 750 750 x1=6000; y1=6000; 751 751 x2=0; y2=0; … … 769 769 void image_descriptor::delete_dirty(int x1, int y1, int x2, int y2) 770 770 { 771 short i,ax1,ay1,ax2,ay2;771 int16_t i,ax1,ay1,ax2,ay2; 772 772 dirty_rect *p,*next; 773 773 if (keep_dirt) … … 869 869 void image_descriptor::add_dirty(int x1, int y1, int x2, int y2) 870 870 { 871 short i;871 int16_t i; 872 872 dirty_rect *p; 873 873 if (keep_dirt) … … 941 941 } 942 942 943 void image::bar ( short x1, short y1, short x2, short y2, unsigned charcolor)944 { 945 short y;943 void image::bar (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color) 944 { 945 int16_t y; 946 946 if (x1>x2 || y1>y2) return ; 947 947 if (special) … … 964 964 } 965 965 966 void image::xor_bar ( short x1, short y1, short x2, short y2, unsigned charcolor)967 { 968 short y,x;966 void image::xor_bar (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color) 967 { 968 int16_t y,x; 969 969 if (x1>x2 || y1>y2) return ; 970 970 if (special) … … 983 983 return ; 984 984 985 u nsigned char*sl=scan_line(y1)+x1;985 uint8_t *sl=scan_line(y1)+x1; 986 986 for (y=y1;y<=y2;y++) 987 987 { 988 u nsigned char*s=sl;988 uint8_t *s=sl; 989 989 for (x=x1;x<=x2;x++,s++) 990 990 *s=(*s)^color; … … 996 996 997 997 998 void image::unpack_scanline( short line, char bitsperpixel)999 { 1000 short x;1001 u nsigned char*sl,*ex,mask,bt,sh;1002 ex=(u nsigned char*)jmalloc(width(),"image::unpacked scanline");998 void image::unpack_scanline(int16_t line, char bitsperpixel) 999 { 1000 int16_t x; 1001 uint8_t *sl,*ex,mask,bt,sh; 1002 ex=(uint8_t *)jmalloc(width(),"image::unpacked scanline"); 1003 1003 sl=scan_line(line); 1004 1004 memcpy(ex,sl,width()); … … 1018 1018 void image::dither(palette *pal) 1019 1019 { 1020 short x,y,i,j;1021 u nsigned chardt_matrix[]={0, 136,24, 170,1020 int16_t x,y,i,j; 1021 uint8_t dt_matrix[]={0, 136,24, 170, 1022 1022 68, 204,102,238, 1023 1023 51, 187, 17,153, 1024 1024 119,255, 85,221}; 1025 1025 1026 u nsigned char*sl;1026 uint8_t *sl; 1027 1027 for (y=height()-1;y>=0;y--) 1028 1028 { … … 1049 1049 } 1050 1050 1051 void image::resize( short new_width, short new_height)1051 void image::resize(int16_t new_width, int16_t new_height) 1052 1052 { 1053 1053 int old_width=width(),old_height=height(); 1054 u nsigned char *im=(unsigned char*)jmalloc(width()*height(),"image::resized");1054 uint8_t *im=(uint8_t *)jmalloc(width()*height(),"image::resized"); 1055 1055 memcpy(im,scan_line(0),width()*height()); 1056 1056 … … 1060 1060 h=new_height; 1061 1061 1062 u nsigned char*sl1,*sl2;1063 short y,y2,x2;1062 uint8_t *sl1,*sl2; 1063 int16_t y,y2,x2; 1064 1064 double yc,xc,yd,xd; 1065 1065 … … 1080 1080 } 1081 1081 1082 void image::scroll( short x1, short y1, short x2, short y2, short xd, short yd)1083 { 1084 short cx1,cy1,cx2,cy2;1082 void image::scroll(int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t xd, int16_t yd) 1083 { 1084 int16_t cx1,cy1,cx2,cy2; 1085 1085 CHECK(x1>=0 && y1>=0 && x1<x2 && y1<y2 && x2<width() && y2<height()); 1086 1086 if (special) … … 1089 1089 x1=max(x1,cx1); y1=max(cy1,y1); x2=min(x2,cx2); y2=min(y2,cy2); 1090 1090 } 1091 short xsrc,ysrc,xdst,ydst,xtot=x2-x1-abs(xd)+1,ytot,xt;1092 u nsigned char*src,*dst;1091 int16_t xsrc,ysrc,xdst,ydst,xtot=x2-x1-abs(xd)+1,ytot,xt; 1092 uint8_t *src,*dst; 1093 1093 if (xd<0) { xsrc=x1-xd; xdst=x1; } else { xsrc=x2-xd; xdst=x2; } 1094 1094 if (yd<0) { ysrc=y1-yd; ydst=y1; } else { ysrc=y2-yd; ydst=y2; } … … 1107 1107 1108 1108 1109 image *image::create_smooth( short smoothness)1110 { 1111 short i,j,k,l,t,d;1109 image *image::create_smooth(int16_t smoothness) 1110 { 1111 int16_t i,j,k,l,t,d; 1112 1112 image *im; 1113 1113 CHECK(smoothness>=0); … … 1129 1129 } 1130 1130 1131 void image::wiget_bar( short x1, short y1, short x2, short y2,1132 u nsigned char light, unsigned char med, unsigned chardark)1131 void image::wiget_bar(int16_t x1, int16_t y1, int16_t x2, int16_t y2, 1132 uint8_t light, uint8_t med, uint8_t dark) 1133 1133 { 1134 1134 line(x1,y1,x2,y1,light); … … 1142 1142 { 1143 1143 public : 1144 short x,y;1144 int16_t x,y; 1145 1145 fill_rec *last; 1146 fill_rec( short X, short Y, fill_rec *Last)1146 fill_rec(int16_t X, int16_t Y, fill_rec *Last) 1147 1147 { x=X; y=Y; last=Last; } 1148 1148 } ; 1149 1149 1150 void image::flood_fill( short x, short y, unsigned charcolor)1151 { 1152 u nsigned char*sl,*above,*below;1150 void image::flood_fill(int16_t x, int16_t y, uint8_t color) 1151 { 1152 uint8_t *sl,*above,*below; 1153 1153 fill_rec *recs=NULL,*r; 1154 u nsigned charfcolor;1154 uint8_t fcolor; 1155 1155 sl=scan_line(y); 1156 1156 fcolor=sl[x]; … … 1231 1231 #define LED_L 5 1232 1232 #define LED_H 5 1233 void image::burn_led( short x, short y, long num, short color, short scale)1233 void image::burn_led(int16_t x, int16_t y, int32_t num, int16_t color, int16_t scale) 1234 1234 { 1235 1235 char st[100]; 1236 short ledx[]={1,2,1,2,3,3,3,3,1,2,0,0,0,0};1237 short ledy[]={3,3,0,0,1,2,4,6,7,7,4,6,1,2};1238 1239 short dig[]={2+4+8+16+32+64,4+8,2+4+1+32+16,2+4+1+8+16,64+1+4+8,1236 int16_t ledx[]={1,2,1,2,3,3,3,3,1,2,0,0,0,0}; 1237 int16_t ledy[]={3,3,0,0,1,2,4,6,7,7,4,6,1,2}; 1238 1239 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, 1240 1240 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}; 1241 short xx,yy,zz;1242 sprintf(st,"%8ld", num);1241 int16_t xx,yy,zz; 1242 sprintf(st,"%8ld",(long int)num); 1243 1243 for (xx=0;xx<8;xx++) 1244 1244 { … … 1258 1258 } 1259 1259 1260 u nsigned chardither_matrix[]={0, 136,24, 170,1260 uint8_t dither_matrix[]={0, 136,24, 170, 1261 1261 68, 204,102,238, 1262 1262 51, 187, 17,153, 1263 1263 119,255, 85,221}; 1264 1264 1265 image *image::copy_part_dithered ( short x1, short y1, short x2, short y2)1266 { 1267 short x,y,cx1,cy1,cx2,cy2,ry,rx,bo,dity,ditx;1265 image *image::copy_part_dithered (int16_t x1, int16_t y1, int16_t x2, int16_t y2) 1266 { 1267 int16_t x,y,cx1,cy1,cx2,cy2,ry,rx,bo,dity,ditx; 1268 1268 image *ret; 1269 u nsigned char*sl1,*sl2;1269 uint8_t *sl1,*sl2; 1270 1270 get_clip(cx1,cy1,cx2,cy2); 1271 1271 if (y1<cy1) y1=cy1; … … 1304 1304 void image::flip_x() 1305 1305 { 1306 u nsigned char *rev=(unsigned char*)jmalloc(width(),"image tmp::flipped_x"),*sl;1306 uint8_t *rev=(uint8_t *)jmalloc(width(),"image tmp::flipped_x"),*sl; 1307 1307 CONDITION(rev,"memory allocation"); 1308 1308 int y,x,i; … … 1318 1318 void image::flip_y() 1319 1319 { 1320 u nsigned char *rev=(unsigned char*)jmalloc(width(),"image::flipped_y"),*sl;1320 uint8_t *rev=(uint8_t *)jmalloc(width(),"image::flipped_y"),*sl; 1321 1321 CONDITION(rev,"memory allocation"); 1322 1322 int y; … … 1329 1329 } 1330 1330 1331 void image::make_color(u nsigned charcolor)1332 { 1333 u nsigned char*sl;1331 void image::make_color(uint8_t color) 1332 { 1333 uint8_t *sl; 1334 1334 int y,x; 1335 1335 for (y=0;y<height();y++) -
abuse/trunk/src/imlib/include/image.hpp
r2 r17 19 19 #define imMAX_ERROR 7 20 20 21 short current_error();21 int16_t current_error(); 22 22 void clear_errors(); 23 void set_error( short x);24 short last_error();23 void set_error(int16_t x); 24 int16_t last_error(); 25 25 void make_block(size_t size); 26 26 void image_init(); … … 30 30 typedef struct image_color_t 31 31 { 32 u nsigned short r;33 u nsigned short g;34 u nsigned short b;32 uint16_t r; 33 uint16_t g; 34 uint16_t b; 35 35 } image_color; 36 36 … … 41 41 { 42 42 public : 43 short dx1,dy1,dx2,dy2;44 dirty_rect( short x1, short y1, short x2, short y2)43 int16_t dx1,dy1,dx2,dy2; 44 dirty_rect(int16_t x1, int16_t y1, int16_t x2, int16_t y2) 45 45 { dx1=x1; dy1=y1; dx2=x2; dy2=y2; 46 46 if (x2<x1 || y2<y1) 47 47 printf("add inccorect dirty\n"); 48 48 } 49 virtual short compare(void *n1, short field)49 virtual int16_t compare(void *n1, int16_t field) 50 50 { return ((dirty_rect *)n1)->dy1>dy1; } 51 51 } ; … … 53 53 class image_descriptor 54 54 { 55 short l,h;56 short clipx1, clipy1, clipx2, clipy2;55 int16_t l,h; 56 int16_t clipx1, clipy1, clipx2, clipy2; 57 57 public : 58 u nsigned charkeep_dirt,59 58 uint8_t keep_dirt, 59 static_mem; // if this flag is set then don't free memory on exit 60 60 61 61 linked_list dirties; 62 62 void *extended_descriptor; // type depends on current system 63 63 64 image_descriptor( short length, short height,64 image_descriptor(int16_t length, int16_t height, 65 65 int keep_dirties=1, int static_memory=0); 66 short bound_x1(short x1) { return x1<clipx1 ? clipx1 : x1; }67 short bound_y1(short y1) { return y1<clipy1 ? clipy1 : y1; }68 short bound_x2(short x2) { return x2>clipx2 ? clipx2 : x2; }69 short bound_y2(short y2) { return y2>clipy2 ? clipy2 : y2; }70 short x1_clip() { return clipx1; }71 short y1_clip() { return clipy1; }72 short x2_clip() { return clipx2; }73 short y2_clip() { return clipy2; }74 void dirty_area( short x1, short y1, short x2, short y2) { ;}75 void clean_area( short x1, short y1, short x2, short y2) { ; }66 int16_t bound_x1(int16_t x1) { return x1<clipx1 ? clipx1 : x1; } 67 int16_t bound_y1(int16_t y1) { return y1<clipy1 ? clipy1 : y1; } 68 int16_t bound_x2(int16_t x2) { return x2>clipx2 ? clipx2 : x2; } 69 int16_t bound_y2(int16_t y2) { return y2>clipy2 ? clipy2 : y2; } 70 int16_t x1_clip() { return clipx1; } 71 int16_t y1_clip() { return clipy1; } 72 int16_t x2_clip() { return clipx2; } 73 int16_t y2_clip() { return clipy2; } 74 void dirty_area(int16_t x1, int16_t y1, int16_t x2, int16_t y2) { ;} 75 void clean_area(int16_t x1, int16_t y1, int16_t x2, int16_t y2) { ; } 76 76 void clear_dirties(); 77 short get_dirty_area(short &x1, short &y1, short &x2, short &y2) { return 0; }78 void get_clip( short &x1, short &y1, short &x2, short &y2)77 int16_t get_dirty_area(int16_t &x1, int16_t &y1, int16_t &x2, int16_t &y2) { return 0; } 78 void get_clip(int16_t &x1, int16_t &y1, int16_t &x2, int16_t &y2) 79 79 { x1=clipx1; y1=clipy1; x2=clipx2; y2=clipy2; } 80 void set_clip( short x1, short y1, short x2, short y2)80 void set_clip(int16_t x1, int16_t y1, int16_t x2, int16_t y2) 81 81 { if (x2<x1) x2=x1; 82 82 if (y2<y1) y2=y1; … … 89 89 void add_dirty(int x1, int y1, int x2, int y2); 90 90 void delete_dirty(int x1, int y1, int x2, int y2); 91 void resize( short length, short height)91 void resize(int16_t length, int16_t height) 92 92 { l=length; h=height; clipx1=0; clipy1=0; clipx2=l-1; clipy2=h-1; } 93 93 } ; … … 95 95 class image : public linked_node 96 96 { 97 u nsigned char*data;98 short w,h;99 void make_page( short width, short height, unsigned char*page_buffer);97 uint8_t *data; 98 int16_t w,h; 99 void make_page(int16_t width, int16_t height, uint8_t *page_buffer); 100 100 void delete_page(); 101 101 public : … … 103 103 image(spec_entry *e, bFILE *fp); 104 104 image(bFILE *fp); 105 image( short width, short height, // required106 u nsigned char*page_buffer=NULL,107 short create_descriptor=0); // 0=no, 1=yes, 2=yes & keep dirties108 u nsigned char pixel (short x, short y);109 void putpixel (short x, short y, char color);110 u nsigned char *scan_line (short y) { return data+y*w; }111 u nsigned char *next_line (short lasty, unsigned char*last_scan)105 image(int16_t width, int16_t height, // required 106 uint8_t *page_buffer=NULL, 107 int16_t create_descriptor=0); // 0=no, 1=yes, 2=yes & keep dirties 108 uint8_t pixel (int16_t x, int16_t y); 109 void putpixel (int16_t x, int16_t y, char color); 110 uint8_t *scan_line (int16_t y) { return data+y*w; } 111 uint8_t *next_line (int16_t lasty, uint8_t *last_scan) 112 112 { return last_scan+w; } 113 long total_pixels (unsigned charbackground=0);114 image 115 void clear (short color=-1); // -1 is background color116 void 117 short width () { return (short)w; }118 short height () { return (short)h; }119 void scroll (short x1, short y1, short x2, short y2, short xd, short yd);120 void fill_image (image *screen, short x1, short y1, short x2, short y2,121 short allign=1);122 void put_image (image *screen, short x, short y, char transparent=0);123 void put_part (image *screen, short x, short y, short x1, short y1,124 short x2, short y2, char transparent=0);125 void put_part_xrev (image *screen, short x, short y, short x1, short y1,126 short x2, short y2, char transparent=0);127 void put_part_masked (image *screen, image *mask, short x, short y,128 short maskx, short masky, short x1, short y1, short x2, short y2);129 image *copy_part_dithered (short x1, short y1, short x2, short y2);130 void bar (short x1, short y1, short x2, short y2, unsigned charcolor);131 void xor_bar (short x1, short y1, short x2, short y2, unsigned charcolor);132 void wiget_bar (short x1, short y1, short x2, short y2,133 u nsigned char light, unsigned char med, unsigned chardark);134 void line (short x1, short y1, short x2, short y2, unsigned charcolor);135 void rectangle (short x1, short y1, short x2, short y2, unsigned charcolor);136 void burn_led (short x, short y, long num, short color, short scale=1);137 void set_clip (short x1, short y1, short x2, short y2);138 void get_clip (short &x1,short &y1,short &x2,short &y2);139 void in_clip (short x1, short y1, short x2, short y2);113 int32_t total_pixels (uint8_t background=0); 114 image *copy (); // makes a copy of an image 115 void clear (int16_t color=-1); // -1 is background color 116 void to_24bit (palette &pal); 117 int16_t width () { return (int16_t)w; } 118 int16_t height () { return (int16_t)h; } 119 void scroll (int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t xd, int16_t yd); 120 void fill_image (image *screen, int16_t x1, int16_t y1, int16_t x2, int16_t y2, 121 int16_t allign=1); 122 void put_image (image *screen, int16_t x, int16_t y, char transparent=0); 123 void put_part (image *screen, int16_t x, int16_t y, int16_t x1, int16_t y1, 124 int16_t x2, int16_t y2, char transparent=0); 125 void put_part_xrev (image *screen, int16_t x, int16_t y, int16_t x1, int16_t y1, 126 int16_t x2, int16_t y2, char transparent=0); 127 void put_part_masked (image *screen, image *mask, int16_t x, int16_t y, 128 int16_t maskx, int16_t masky, int16_t x1, int16_t y1, int16_t x2, int16_t y2); 129 image *copy_part_dithered (int16_t x1, int16_t y1, int16_t x2, int16_t y2); 130 void bar (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color); 131 void xor_bar (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color); 132 void wiget_bar (int16_t x1, int16_t y1, int16_t x2, int16_t y2, 133 uint8_t light, uint8_t med, uint8_t dark); 134 void line (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color); 135 void rectangle (int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint8_t color); 136 void burn_led (int16_t x, int16_t y, int32_t num, int16_t color, int16_t scale=1); 137 void set_clip (int16_t x1, int16_t y1, int16_t x2, int16_t y2); 138 void get_clip (int16_t &x1,int16_t &y1,int16_t &x2,int16_t &y2); 139 void in_clip (int16_t x1, int16_t y1, int16_t x2, int16_t y2); 140 140 141 void 142 void 141 void dirt_off () { if (special && special->keep_dirt) special->keep_dirt=0; } 142 void dirt_on () { if (special) special->keep_dirt=1; } 143 143 144 void 144 void add_dirty (int x1, int y1, int x2, int y2) 145 145 { if (special) special->add_dirty(x1,y1,x2,y2); } 146 void 146 void delete_dirty (int x1, int y1, int x2, int y2) 147 147 { if (special) special->delete_dirty(x1,y1,x2,y2); } 148 void 149 void 150 void resize (short new_width, short new_height);151 void change_size (short new_width, short new_height, unsigned char*page=NULL);152 void flood_fill (short x, short y, unsigned charcolor);153 image *create_smooth (short smoothness=1); // 0 no smoothness154 void unpack_scanline (short line, char bitsperpixel=1);155 u nsigned charbrightest_color (palette *pal);156 void flip_x();157 void 158 void make_color (unsigned charcolor);159 u nsigned char darkest_color (palette *pal, short noblack=0);148 void clear_dirties () { if (special) special->clear_dirties(); } 149 void dither (palette *pal); // use a b&w palette! 150 void resize (int16_t new_width, int16_t new_height); 151 void change_size (int16_t new_width, int16_t new_height, uint8_t *page=NULL); 152 void flood_fill (int16_t x, int16_t y, uint8_t color); 153 image *create_smooth (int16_t smoothness=1); // 0 no smoothness 154 void unpack_scanline (int16_t line, char bitsperpixel=1); 155 uint8_t brightest_color (palette *pal); 156 void flip_x (); 157 void flip_y (); 158 void make_color (uint8_t color); 159 uint8_t darkest_color (palette *pal, int16_t noblack=0); 160 160 161 161 ~image(); -
abuse/trunk/src/imlib/include/jmalloc.hpp
r2 r17 8 8 enum {ALLOC_SPACE_STATIC,ALLOC_SPACE_CACHE}; 9 9 extern int alloc_space; 10 void *jmalloc( longsize, char *what_for);11 void *jrealloc(void *ptr, longsize, char *what_for);10 void *jmalloc(int32_t size, char *what_for); 11 void *jrealloc(void *ptr, int32_t size, char *what_for); 12 12 void jfree(void *ptr); 13 13 void mem_report(char *filename); 14 void jmalloc_init( longmin_size);14 void jmalloc_init(int32_t min_size); 15 15 void jmalloc_uninit(); 16 longj_allocated();17 longj_available();16 int32_t j_allocated(); 17 int32_t j_available(); 18 18 extern void free_up_memory(); 19 19 #else -
abuse/trunk/src/imlib/include/jwindow.hpp
r2 r17 69 69 struct jwindow_properties 70 70 { 71 uchar moveable, 72 hidden; 73 71 uint8_t moveable, 72 hidden; 74 73 } ; 75 74 -
abuse/trunk/src/imlib/include/macs.hpp
r2 r17 24 24 #endif 25 25 26 #define uchar unsigned char27 #define schar signed char26 //#define uchar unsigned char 27 //#define schar signed char 28 28 //#define ushort unsigned short 29 typedef unsigned short int ushort;30 #define sshort signed short29 //typedef unsigned short int ushort; 30 //#define sshort signed short 31 31 //#define ulong unsigned long 32 typedef unsigned long int ulong;32 //typedef unsigned long int ulong; 33 33 34 34 #endif -
abuse/trunk/src/imlib/include/packet.hpp
r2 r17 5 5 { 6 6 public : 7 u char*buf;8 longbuf_size,ro,wo,rend;7 uint8_t *buf; 8 int32_t buf_size,ro,wo,rend; 9 9 int pre_size; 10 10 void make_bigger(int max); … … 12 12 int get_read_position() { return ro; } 13 13 void set_read_position(int x) { ro=x; } 14 int read(u char*buffer, int size);15 int write(u char*buffer, int size);14 int read(uint8_t *buffer, int size); 15 int write(uint8_t *buffer, int size); 16 16 int eop() { return ro>=rend; } 17 17 void reset(); 18 18 packet(int prefix_size=2); 19 19 void get_string(char *st, int len); 20 int advance( longoffset);20 int advance(int32_t offset); 21 21 22 void write_ long(ulongx); // writes can't fail...23 void write_ short(ushort x);24 void write_ byte(ucharx);22 void write_uint32(uint32_t x); // writes can't fail... 23 void write_uint16(uint16_t x); 24 void write_uint8(uint8_t x); 25 25 void insert_into(packet &pk); 26 26 int size() { return rend-pre_size; } -
abuse/trunk/src/imlib/include/scroller.hpp
r2 r17 51 51 protected : 52 52 int r,c,m,last_sel,cur_sel; 53 u char*select;53 uint8_t *select; 54 54 public : 55 55 spicker(int X, int Y, int ID, int Rows, int Cols, int Vert, int MultiSelect, ifield *Next); -
abuse/trunk/src/imlib/include/specs.hpp
r7 r17 97 97 98 98 // these read and writes, allways read/write Intel endian-ness 99 uint16_t read_ short();100 uint32_t read_ long();101 uint8_t read_ byte();99 uint16_t read_uint16(); 100 uint32_t read_uint32(); 101 uint8_t read_uint8(); 102 102 double read_double(); 103 void write_ short(uint16_t x);104 void write_ long(uint32_t x);105 void write_ byte(uint8_t x);103 void write_uint16(uint16_t x); 104 void write_uint32(uint32_t x); 105 void write_uint8(uint8_t x); 106 106 void write_double(double x); 107 107 void set_read_buffer_size(long size); … … 194 194 char *link_filename=NULL);*/ 195 195 196 uint16_t read_ short(FILE *fp);197 uint32_t read_ long(FILE *fp);198 uint32_t read_other_ long(FILE *fp);199 uint16_t read_other_ short(FILE *fp);200 uint8_t read_ byte(FILE *fp);201 202 void write_ short(FILE *fp, uint16_t x);203 void write_ long(FILE *fp, uint32_t x);204 void write_other_ short(FILE *fp, uint16_t x);205 void write_other_ long(FILE *fp, uint32_t x);206 void write_ byte(FILE *fp, uint8_t x);196 uint16_t read_uint16(FILE *fp); 197 uint32_t read_uint32(FILE *fp); 198 uint32_t read_other_uint32(FILE *fp); 199 uint16_t read_other_uint16(FILE *fp); 200 uint8_t read_uint8(FILE *fp); 201 202 void write_uint16(FILE *fp, uint16_t x); 203 void write_uint32(FILE *fp, uint32_t x); 204 void write_other_uint16(FILE *fp, uint16_t x); 205 void write_other_uint32(FILE *fp, uint32_t x); 206 void write_uint8(FILE *fp, uint8_t x); 207 207 208 208 void set_spec_main_file(char *filename, int Search_order); -
abuse/trunk/src/imlib/include/system.h
r7 r17 30 30 31 31 32 #define short_swap(x) (((((uint16_t) (x)))<<8)|((((uint16_t) (x)))>>8))33 #define long_swap(x) \32 #define uint16_swap(x) (((((uint16_t) (x)))<<8)|((((uint16_t) (x)))>>8)) 33 #define uint32_swap(x) \ 34 34 ((( ((uint32_t)(x)) )>>24)|((( ((uint32_t)(x)) )&0x00ff0000)>>8)| \ 35 35 ((( ((uint32_t)(x)) )&0x0000ff00)<<8)|(( ((uint32_t)(x)) )<<24)) … … 37 37 #if defined BIG_ENDIANS 38 38 #define LONG int32_t 39 #define int_to_intel(x) short_swap(x)40 #define int_to_local(x) int_to_intel(x)41 #define big_ long_to_local(x) (x)42 #define big_ short_to_local(x) (x)43 #define long_to_intel(x) long_swap(x)44 #define long_to_local(x) long_to_intel(x)39 #define uint16_to_intel(x) uint16_swap(x) 40 #define uint16_to_local(x) uint16_to_intel(x) 41 #define big_uint32_to_local(x) (x) 42 #define big_uint16_to_local(x) (x) 43 #define uint32_to_intel(x) uint32_swap(x) 44 #define uint32_to_local(x) uint32_to_intel(x) 45 45 #else 46 46 #define LONG int32_t 47 #define int_to_intel(x) (x)48 #define int_to_local(x) (x)49 #define long_to_local(x) (x)50 #define long_to_intel(x) (x)51 #define big_ long_to_local(x) long_swap(x)52 #define big_ short_to_local(x) short_swap(x)47 #define uint16_to_intel(x) (x) 48 #define uint16_to_local(x) (x) 49 #define uint32_to_local(x) (x) 50 #define uint32_to_intel(x) (x) 51 #define big_uint32_to_local(x) uint32_swap(x) 52 #define big_uint16_to_local(x) uint16_swap(x) 53 53 #endif 54 54 55 #define bltl(x) big_ long_to_local(x)56 #define bstl(x) big_ short_to_local(x)57 #define lltl(x) long_to_intel(x)58 #define lstl(x) int_to_intel(x)55 #define bltl(x) big_uint32_to_local(x) 56 #define bstl(x) big_uint16_to_local(x) 57 #define lltl(x) uint32_to_intel(x) 58 #define lstl(x) uint16_to_intel(x) 59 59 60 60 #endif -
abuse/trunk/src/imlib/include/timage.hpp
r2 r17 28 28 // if screen x & y offset already calculated save a mul 29 29 // and no clipping, but fast use this 30 void put_image_offseted(image *screen, u char*s_off);30 void put_image_offseted(image *screen, uint8_t *s_off); 31 31 void put_image_filled(image *screen, int x, int y, 32 u charfill_color);32 uint8_t fill_color); 33 33 void put_fade(image *screen, int x, int y, 34 34 int frame_on, int total_frames, … … 36 36 void put_fade_tint(image *screen, int x, int y, 37 37 int frame_on, int total_frames, 38 u char*tint,38 uint8_t *tint, 39 39 color_filter *f, palette *pal); 40 40 void put_color(image *screen, int x, int y, int color); -
abuse/trunk/src/imlib/jmalloc.cpp
r8 r17 13 13 14 14 #include "jmalloc.hpp" 15 #define uchar unsigned char16 15 #define JM_SMALL_SIZE 128 // above 128 bytes is considered to be a big block and no hashing is done 17 16 int alloc_space=ALLOC_SPACE_STATIC; … … 29 28 struct memory_node 30 29 { 31 longsize;30 int32_t size; 32 31 #ifdef MEM_CHECK 33 32 char *name; // name is allocated on regular heap … … 40 39 struct small_block 41 40 { 42 u nsigned longsize; // size of blocks...41 uint32_t size; // size of blocks... 43 42 uint32_t alloc_list; // bit field saying weither each block is allocated or not. 44 43 small_block *next; // next small block of same size … … 54 53 public : 55 54 56 longblock_size; // size of this memory_block55 int32_t block_size; // size of this memory_block 57 56 small_block *sblocks[JM_SMALL_SIZE]; 58 57 small_block *cblocks[JM_SMALL_SIZE]; … … 61 60 memory_node *sfirst,*slast, 62 61 *cfirst; 63 u nsigned charblock_type;64 65 void init(void *block, long Block_size, uchartype);66 void *static_alloc( longsize, char *name);67 void *cache_alloc( longsize, char *name);62 uint8_t block_type; 63 64 void init(void *block, int32_t Block_size, uint8_t type); 65 void *static_alloc(int32_t size, char *name); 66 void *cache_alloc(int32_t size, char *name); 68 67 void static_free(void *ptr); 69 68 void cache_free(void *ptr); 70 longavailable();71 longallocated();72 longpointer_size(void *ptr);69 int32_t available(); 70 int32_t allocated(); 71 int32_t pointer_size(void *ptr); 73 72 void report(FILE *fp); 74 73 void inspect(); … … 90 89 int block_manager::valid_static_ptr(void *ptr) 91 90 { 92 void *next=(void *)(*((( long*)ptr)-1));91 void *next=(void *)(*(((int32_t *)ptr)-1)); 93 92 if (next && ((small_block *)next)->size<JM_SMALL_SIZE) // small allocation 94 93 { … … 111 110 int block_manager::valid_cache_ptr(void *ptr) 112 111 { 113 void *next=(void *)(*((( long*)ptr)-1));112 void *next=(void *)(*(((int32_t *)ptr)-1)); 114 113 if (next && ((small_block *)next)->size<JM_SMALL_SIZE) // small allocation 115 114 { … … 274 273 } 275 274 276 longblock_manager::pointer_size(void *ptr)275 int32_t block_manager::pointer_size(void *ptr) 277 276 { 278 277 void *next=(void *)(*(((intptr_t *)ptr)-1)); … … 282 281 } 283 282 284 longblock_manager::available()285 { 286 longsize=0;283 int32_t block_manager::available() 284 { 285 int32_t size=0; 287 286 memory_node *f; 288 287 for (f=sfirst;f;f=f->next) … … 294 293 } 295 294 296 longblock_manager::allocated()297 { 298 longsize=0;295 int32_t block_manager::allocated() 296 { 297 int32_t size=0; 299 298 memory_node *f; 300 299 for (f=sfirst;f;f=f->next) … … 306 305 } 307 306 308 void block_manager::init(void *block, long Block_size, uchartype)307 void block_manager::init(void *block, int32_t Block_size, uint8_t type) 309 308 { 310 309 block_size=Block_size; … … 326 325 } 327 326 328 void *block_manager::static_alloc( longsize, char *name)327 void *block_manager::static_alloc(int32_t size, char *name) 329 328 { 330 329 if (size<JM_SMALL_SIZE) … … 345 344 break_mem_fun(); 346 345 #endif 347 long *addr=(long*)(((char *)s)+sizeof(small_block));348 *addr=( long)s;346 intptr_t *addr=(intptr_t *)(((char *)s)+sizeof(small_block)); 347 *addr=(intptr_t)s; 349 348 return (void *)(addr+1); // return first block 350 349 } else … … 360 359 s->name[i]=strcpy((char *)malloc(strlen(name)+1),name); 361 360 #endif 362 *(( long *)addr)=(long)s;361 *((intptr_t *)addr)=(intptr_t)s; 363 362 364 363 #ifdef MEM_CHECK … … 406 405 407 406 408 void *block_manager::cache_alloc( longsize, char *name)407 void *block_manager::cache_alloc(int32_t size, char *name) 409 408 { 410 409 if (size<JM_SMALL_SIZE) … … 424 423 425 424 #endif 426 long *addr=(long*)(((char *)s)+sizeof(small_block));427 *addr=( long)s;425 intptr_t *addr=(intptr_t *)(((char *)s)+sizeof(small_block)); 426 *addr=(intptr_t)s; 428 427 #ifdef MEM_CHECK 429 428 if ((intptr_t)s==break_mem_point) … … 445 444 break_mem_fun(); 446 445 #endif 447 *(( long *)addr)=(long)s;446 *((intptr_t *)addr)=(intptr_t)s; 448 447 return (void *)(addr+4); 449 448 } … … 461 460 if (!s) // no current cache space for object, see if we can enlarge the cache space 462 461 { 463 longsize_avail=-slast->size;462 int32_t size_avail=-slast->size; 464 463 size_avail-=sizeof(memory_node); 465 464 … … 491 490 { 492 491 memory_node *p=s; // store this position 493 longpsize=s->size-size-sizeof(memory_node);492 int32_t psize=s->size-size-sizeof(memory_node); 494 493 s=(memory_node *)(((char *)s)+psize+sizeof(memory_node)); 495 494 p->size=-psize; … … 515 514 { 516 515 // see if this was a small_block allocation 517 void *next=(void *)(*((( long*)ptr)-1));516 void *next=(void *)(*(((int32_t *)ptr)-1)); 518 517 if (next && ((small_block *)next)->size<JM_SMALL_SIZE) // small allocation 519 518 { … … 598 597 { 599 598 // see if this was a small_block allocation 600 void *next=(void *)(*((( long*)ptr)-1));599 void *next=(void *)(*(((int32_t *)ptr)-1)); 601 600 if (next && next<ptr) // small allocation 602 601 { … … 696 695 " - add memory to your system\n"; 697 696 698 void jmalloc_init( longmin_size)697 void jmalloc_init(int32_t min_size) 699 698 { 700 699 fprintf(stderr,"Disabling memory manager, using libc instead\n"); … … 709 708 710 709 #ifdef __POWERPC__ 711 longsize=jmalloc_max_size-0x10000;710 int32_t size=jmalloc_max_size-0x10000; 712 711 for (mem=NULL;!mem && size>0x10000;) 713 712 { … … 718 717 mem = malloc(size); 719 718 #else 720 longsize=jmalloc_max_size;719 int32_t size=jmalloc_max_size; 721 720 for (mem=NULL;!mem && size>0x4000;) 722 721 { … … 768 767 769 768 770 longj_available()771 { 772 longsize=0;769 int32_t j_available() 770 { 771 int32_t size=0; 773 772 for (int i=0;i<bmanage_total;i++) 774 773 size+=bmanage[i].available(); … … 776 775 } 777 776 778 longj_allocated()779 { 780 longsize=0;777 int32_t j_allocated() 778 { 779 int32_t size=0; 781 780 for (int i=0;i<bmanage_total;i++) 782 781 size+=bmanage[i].allocated(); … … 785 784 786 785 787 void *jmalloc( longsize, char *name)786 void *jmalloc(int32_t size, char *name) 788 787 { 789 788 if (!bmanage_total) … … 838 837 839 838 840 void *jrealloc(void *ptr, longsize, char *name)839 void *jrealloc(void *ptr, int32_t size, char *name) 841 840 { 842 841 if (!ptr) return jmalloc(size,name); … … 845 844 if (size==0) { jfree(ptr); return NULL; } 846 845 847 longold_size=0;846 int32_t old_size=0; 848 847 for (int i=0;i<bmanage_total;i++) 849 848 if (ptr>=(void *)bmanage[i].sfirst && … … 912 911 913 912 914 longsmall_ptr_size(void *ptr)915 { 916 return ((small_block *)((( long*)ptr)[-1]))->size;913 int32_t small_ptr_size(void *ptr) 914 { 915 return ((small_block *)(((int32_t *)ptr)[-1]))->size; 917 916 } 918 917 -
abuse/trunk/src/imlib/lbmread.cpp
r4 r17 20 20 else 21 21 { 22 long size=read_other_long(fp);22 int32_t size=read_other_uint32(fp); 23 23 fread(type,1,4,fp); 24 24 if (memcmp(type,"PBM ",4)) … … 30 30 else 31 31 { 32 longssize;32 int32_t ssize; 33 33 char stype[4]; 34 short w=0,h=0,x,y,tcolor,pagew,pageh;34 int16_t w=0,h=0,x,y,tcolor,pagew,pageh; 35 35 char planes,masking,compr=0,padl,xa,ya; 36 36 … … 38 38 { 39 39 fread(stype,1,4,fp); 40 ssize=read_other_ long(fp);40 ssize=read_other_uint32(fp); 41 41 if (ssize &1) ssize++; // specs say all chunks are padded by 2 42 42 if (!memcmp(stype,"BMHD",4)) 43 43 { 44 w=read_other_ short(fp);45 h=read_other_ short(fp);46 x=read_other_ short(fp);47 y=read_other_ short(fp);44 w=read_other_uint16(fp); 45 h=read_other_uint16(fp); 46 x=read_other_uint16(fp); 47 y=read_other_uint16(fp); 48 48 planes=fgetc(fp); 49 49 masking=fgetc(fp); 50 50 compr=fgetc(fp); 51 51 padl=fgetc(fp); 52 tcolor=read_other_ short(fp);52 tcolor=read_other_uint16(fp); 53 53 xa=fgetc(fp); 54 54 ya=fgetc(fp); 55 pagew=read_other_ short(fp);56 pageh=read_other_ short(fp);55 pagew=read_other_uint16(fp); 56 pageh=read_other_uint16(fp); 57 57 } else if (!memcmp(stype,"CMAP",4)) 58 58 { -
abuse/trunk/src/imlib/mdlread.cpp
r2 r17 11 11 // images. All images should be sized so they will fit on an mdl screen 12 12 // but no checking of that is done hhere. 13 void write_mdl(image **images, short total_images, palette *pal,char *fn,14 short firstpage, short images_per_page)13 void write_mdl(image **images, int16_t total_images, palette *pal,char *fn, 14 int16_t firstpage, int16_t images_per_page) 15 15 { 16 16 FILE *fp; 17 17 char buf[18]; 18 u nsigned short xy[2],x;18 uint16_t xy[2],x; 19 19 char name[13],page; 20 20 unsigned char *c; 21 short i;21 int16_t i; 22 22 palette *np; 23 23 clear_errors(); … … 43 43 memset(buf,0,6); // each image has 6 bytes of reserved 0 44 44 fwrite(buf,6,1,fp); 45 xy[0]= int_to_intel(i%100+20); xy[1]=int_to_intel(30); // the x and y position on the screen45 xy[0]=uint16_to_intel(i%100+20); xy[1]=uint16_to_intel(30); // the x and y position on the screen 46 46 fwrite(xy,4,1,fp); 47 47 sprintf(name,"JC%-10d",i); // set the name of the image … … 51 51 52 52 fwrite(&page,1,1,fp); // put all of the image on the first page 53 xy[0]= int_to_intel(images[i]->width()*images[i]->height()+4); // calc the size of the image53 xy[0]=uint16_to_intel(images[i]->width()*images[i]->height()+4); // calc the size of the image 54 54 55 55 fwrite(xy,2,1,fp); 56 xy[0]= int_to_intel(images[i]->width());56 xy[0]=uint16_to_intel(images[i]->width()); 57 57 fwrite(xy,2,1,fp); 58 xy[0]= int_to_intel(images[i]->height());58 xy[0]=uint16_to_intel(images[i]->height()); 59 59 fwrite(xy,2,1,fp); 60 for (x=0;x<(u nsigned short)images[i]->height();x++) // write all the scan_lines for the60 for (x=0;x<(uint16_t)images[i]->height();x++) // write all the scan_lines for the 61 61 { c=images[i]->scan_line(x); // image 62 62 fwrite(c,images[i]->width(),1,fp); … … 67 67 } 68 68 69 short mdl_total_images(char *fn)69 int16_t mdl_total_images(char *fn) 70 70 { 71 71 char buf[800]; 72 u nsigned short xy[2],t;72 uint16_t xy[2],t; 73 73 FILE *fp; 74 74 fp=fopen(fn,"rb"); … … 92 92 { 93 93 fread(xy,2,1,fp); 94 xy[0]= int_to_local(xy[0]);94 xy[0]=uint16_to_local(xy[0]); 95 95 fseek(fp,xy[0],SEEK_CUR); 96 96 t++; … … 104 104 // and a palette that is read form the file 105 105 // to load image numbers 4 through 9 let start =4, end=9 106 image **read_mdl(char *fn, palette *&pal, short startn, short endn, short &total)106 image **read_mdl(char *fn, palette *&pal, int16_t startn, int16_t endn, int16_t &total) 107 107 { 108 108 FILE *fp; 109 109 image **im; 110 110 char buf[50]; 111 u nsigned short xy[2],i,j;111 uint16_t xy[2],i,j; 112 112 clear_errors(); 113 113 make_block(sizeof(FILE)); … … 147 147 set_error(imFILE_CORRUPTED); 148 148 fread(xy,2,1,fp); 149 xy[0]= int_to_local(xy[0]);149 xy[0]=uint16_to_local(xy[0]); 150 150 fseek(fp,xy[0],SEEK_CUR); 151 151 startn--; if (endn>0) endn--; … … 161 161 else 162 162 { 163 j= int_to_local(j);163 j=uint16_to_local(j); 164 164 j-=4; 165 165 xy[0]=5; xy[1]=5; 166 166 if (fread(xy,1,4,fp)!=4) set_error(imFILE_CORRUPTED); 167 167 make_block(sizeof(image)); 168 xy[0]= int_to_local(xy[0]);169 xy[1]= int_to_local(xy[1]);168 xy[0]=uint16_to_local(xy[0]); 169 xy[1]=uint16_to_local(xy[1]); 170 170 im[startn]=new image(xy[0],xy[1]); 171 171 total++; -
abuse/trunk/src/imlib/morph.cpp
r2 r17 355 355 for (i=0;i<total;i++) 356 356 { 357 ((morph_point16 *)p+i)->x1=fp->read_ short();358 ((morph_point16 *)p+i)->y1=fp->read_ short();359 ((morph_point16 *)p+i)->x2=fp->read_ short();360 ((morph_point16 *)p+i)->y2=fp->read_ short();357 ((morph_point16 *)p+i)->x1=fp->read_uint16(); 358 ((morph_point16 *)p+i)->y1=fp->read_uint16(); 359 ((morph_point16 *)p+i)->x2=fp->read_uint16(); 360 ((morph_point16 *)p+i)->y2=fp->read_uint16(); 361 361 fp->read( &((morph_point16 *)p+i)->start_color,1); 362 362 fp->read( &((morph_point16 *)p+i)->end_color,1); … … 365 365 small=0; 366 366 } 367 w[0]=fp->read_ short();368 h[0]=fp->read_ short();369 w[1]=fp->read_ short();370 h[1]=fp->read_ short();367 w[0]=fp->read_uint16(); 368 h[0]=fp->read_uint16(); 369 w[1]=fp->read_uint16(); 370 h[1]=fp->read_uint16(); 371 371 } 372 372 … … 678 678 679 679 680 fp->write_ long(total);680 fp->write_uint32(total); 681 681 if (small) 682 682 { … … 691 691 { 692 692 for (i=0;i<total;i++) 693 { fp->write_ short(((morph_point16 *)p+i)->x1);694 fp->write_ short(((morph_point16 *)p+i)->y1);695 fp->write_ short(((morph_point16 *)p+i)->x2);696 fp->write_ short(((morph_point16 *)p+i)->y2);693 { fp->write_uint16(((morph_point16 *)p+i)->x1); 694 fp->write_uint16(((morph_point16 *)p+i)->y1); 695 fp->write_uint16(((morph_point16 *)p+i)->x2); 696 fp->write_uint16(((morph_point16 *)p+i)->y2); 697 697 fp->write( &((morph_point16 *)p+i)->start_color,1); 698 698 fp->write( &((morph_point16 *)p+i)->end_color,1); 699 699 } 700 700 } 701 fp->write_ short(w[0]);702 fp->write_ short(h[0]);703 fp->write_ short(w[1]);704 fp->write_ short(h[1]);701 fp->write_uint16(w[0]); 702 fp->write_uint16(h[0]); 703 fp->write_uint16(w[1]); 704 fp->write_uint16(h[1]); 705 705 return 1; 706 706 } … … 877 877 int i; 878 878 879 patches=fp->read_ short();879 patches=fp->read_uint16(); 880 880 pats=(morph_patch *)jmalloc(sizeof(morph_patch)*patches,"patched_morph::points"); 881 881 882 882 for (i=0;i<patches;i++) 883 883 { 884 pats[i].patches=fp->read_ short();884 pats[i].patches=fp->read_uint16(); 885 885 if (pats[i].patches) 886 886 { -
abuse/trunk/src/imlib/packet.cpp
r2 r17 5 5 6 6 7 int packet::advance( longoffset)7 int packet::advance(int32_t offset) 8 8 { 9 9 ro+=offset; … … 11 11 } 12 12 13 void packet::write_ long(ulongx)13 void packet::write_uint32(uint32_t x) 14 14 { 15 15 x=lltl(x); 16 write((u char*)&x,4);16 write((uint8_t *)&x,4); 17 17 } 18 18 19 void packet::write_ short(ushort x)19 void packet::write_uint16(uint16_t x) 20 20 { 21 21 x=lstl(x); 22 write((u char*)&x,2);22 write((uint8_t *)&x,2); 23 23 } 24 24 25 void packet::write_ byte(ucharx)25 void packet::write_uint8(uint8_t x) 26 26 { 27 27 write(&x,1); … … 41 41 42 42 buf_size=1000; 43 buf=(u char*)jmalloc(buf_size,"packet buffer");43 buf=(uint8_t *)jmalloc(buf_size,"packet buffer"); 44 44 reset(); 45 45 … … 72 72 { 73 73 buf_size=max; 74 buf=(u char*)jrealloc(buf,max,"packet buffer");74 buf=(uint8_t *)jrealloc(buf,max,"packet buffer"); 75 75 } 76 76 } 77 77 78 int packet::read(u char*buffer, int size)78 int packet::read(uint8_t *buffer, int size) 79 79 { 80 80 if (size>rend-ro) … … 90 90 91 91 92 int packet::write(u char*buffer, int size)92 int packet::write(uint8_t *buffer, int size) 93 93 { 94 94 if (size>buf_size-wo) -
abuse/trunk/src/imlib/palette.cpp
r15 r17 12 12 palette::palette(bFILE *fp) 13 13 { 14 ncolors=fp->read_ short();14 ncolors=fp->read_uint16(); 15 15 pal=(color *)jmalloc(sizeof(color)*ncolors,"palette"); 16 16 usd=(unsigned char *)jmalloc(ncolors/8+1,"palette used array"); … … 23 23 { 24 24 fp->seek(e->offset,0); 25 ncolors=fp->read_ short();25 ncolors=fp->read_uint16(); 26 26 pal=(color *)jmalloc(sizeof(color)*ncolors,"palette"); 27 27 usd=(unsigned char *)jmalloc(ncolors/8+1,"palette used array"); … … 38 38 int palette::write(bFILE *fp) 39 39 { 40 fp->write_ short(ncolors);40 fp->write_uint16(ncolors); 41 41 return fp->write(pal,sizeof(color)*ncolors)==ncolors; 42 42 } -
abuse/trunk/src/imlib/pcxread.cpp
r2 r17 18 18 if (!fread(&PCX_header.encoding,1,1,fp)) return 0; 19 19 if (!fread(&PCX_header.bits_per_pixel,1,1,fp)) return 0; 20 PCX_header.xmin=read_ short(fp);21 PCX_header.ymin=read_ short(fp);22 PCX_header.xmax=read_ short(fp);23 PCX_header.ymax=read_ short(fp);24 PCX_header.hres=read_ short(fp);25 PCX_header.vres=read_ short(fp);20 PCX_header.xmin=read_uint16(fp); 21 PCX_header.ymin=read_uint16(fp); 22 PCX_header.xmax=read_uint16(fp); 23 PCX_header.ymax=read_uint16(fp); 24 PCX_header.hres=read_uint16(fp); 25 PCX_header.vres=read_uint16(fp); 26 26 if (!fread(PCX_header.palette,1,48,fp)) return 0; 27 27 if (!fread(&PCX_header.reserved,1,1,fp)) return 0; 28 28 if (!fread(&PCX_header.color_planes,1,1,fp)) return 0; 29 PCX_header.bytes_per_line=read_ short(fp);30 PCX_header.palette_type=read_ short(fp);29 PCX_header.bytes_per_line=read_uint16(fp); 30 PCX_header.palette_type=read_uint16(fp); 31 31 if (!fread(PCX_header.filter,1,58,fp)) return 0; 32 32 return 1; … … 39 39 if (!fwrite(&PCX_header.encoding,1,1,fp)) return 0; 40 40 if (!fwrite(&PCX_header.bits_per_pixel,1,1,fp)) return 0; 41 write_ short(fp,PCX_header.xmin);42 write_ short(fp,PCX_header.ymin);43 write_ short(fp,PCX_header.xmax);44 write_ short(fp,PCX_header.ymax);45 write_ short(fp,PCX_header.hres);46 write_ short(fp,PCX_header.vres);41 write_uint16(fp,PCX_header.xmin); 42 write_uint16(fp,PCX_header.ymin); 43 write_uint16(fp,PCX_header.xmax); 44 write_uint16(fp,PCX_header.ymax); 45 write_uint16(fp,PCX_header.hres); 46 write_uint16(fp,PCX_header.vres); 47 47 if (!fwrite(PCX_header.palette,1,48,fp)) return 0; 48 48 if (!fwrite(&PCX_header.reserved,1,1,fp)) return 0; 49 49 if (!fwrite(&PCX_header.color_planes,1,1,fp)) return 0; 50 write_ short(fp,PCX_header.bytes_per_line);51 write_ short(fp,PCX_header.palette_type);50 write_uint16(fp,PCX_header.bytes_per_line); 51 write_uint16(fp,PCX_header.palette_type); 52 52 if (!fwrite(PCX_header.filter,1,58,fp)) return 0; 53 53 return 1; -
abuse/trunk/src/imlib/readwav.cpp
r2 r17 38 38 { 39 39 fp->read(&chunk.id,4); 40 chunk.size=fp->read_ long();40 chunk.size=fp->read_uint32(); 41 41 fp->read(&chunk.type,4); 42 42 } … … 45 45 { 46 46 fp->read(&tag.id,4); 47 tag.size=fp->read_ long();47 tag.size=fp->read_uint32(); 48 48 } 49 49 50 50 void read_wav_format(wav_format &fmt, bFILE *fp) 51 51 { 52 fmt.fmt_tag=fp->read_ short();53 fmt.channels=fp->read_ short();54 fmt.samplesps=fp->read_ long();55 fmt.avg_bytesps=fp->read_ long();56 fmt.align=fp->read_ short();52 fmt.fmt_tag=fp->read_uint16(); 53 fmt.channels=fp->read_uint16(); 54 fmt.samplesps=fp->read_uint32(); 55 fmt.avg_bytesps=fp->read_uint32(); 56 fmt.align=fp->read_uint16(); 57 57 } 58 58 … … 61 61 { 62 62 read_wav_format(pcm.wf,fp); 63 pcm.bitsps=fp->read_ short();63 pcm.bitsps=fp->read_uint16(); 64 64 } 65 65 … … 78 78 /*************** Write the chunk ***************************/ 79 79 fp->write((void *)"RIFF",4); 80 fp->write_ long(data_size+36);80 fp->write_uint32(data_size+36); 81 81 fp->write((void *)"WAVE",4); 82 82 … … 84 84 /************** Write the tag *******************************/ 85 85 fp->write((void *)"fmt ",4); 86 fp->write_ long(16);86 fp->write_uint32(16); 87 87 88 88 89 89 /************** Write PCM ***********************************/ 90 fp->write_ short(1); // format_tag91 fp->write_ short(1); // mono recording92 fp->write_ long(sample_rate);93 fp->write_ long(sample_rate); // average bytes per sec94 fp->write_ short(1); // allignment? Don't know what this does?95 fp->write_ short(8); // 8 bits per sample90 fp->write_uint16(1); // format_tag 91 fp->write_uint16(1); // mono recording 92 fp->write_uint32(sample_rate); 93 fp->write_uint32(sample_rate); // average bytes per sec 94 fp->write_uint16(1); // allignment? Don't know what this does? 95 fp->write_uint16(8); // 8 bits per sample 96 96 97 97 /************* Write data tag ******************************/ 98 98 fp->write((void *)"data",4); 99 fp->write_ long(data_size);99 fp->write_uint32(data_size); 100 100 101 101 /************ Now write sample data ************************/ -
abuse/trunk/src/imlib/readxwd.cpp
r2 r17 106 106 107 107 108 int bs_int(int s); 109 long bs_long(long s); 110 short bs_short(short s ); 108 int32_t bs_int32(int32_t s); 109 int16_t bs_int16(int16_t s ); 111 110 112 111 … … 325 324 326 325 327 short bs_ short(short s )326 short bs_int16(short s ) 328 327 { 329 328 short ss; … … 338 337 } 339 338 340 int bs_int(int i)341 { 342 int ii;343 u nsigned char*bp, t;339 int32_t bs_int32(int32_t l ) 340 { 341 int32_t ii; 342 uint8_t *bp, t; 344 343 345 344 ii = i; 346 bp = (u nsigned char*) ⅈ345 bp = (uint8_t *) ⅈ 347 346 t = bp[0]; 348 347 bp[0] = bp[3]; … … 352 351 bp[2] = t; 353 352 return ii; 354 }355 356 long bs_long(long l )357 {358 return bs_int( l );359 353 } 360 354 … … 374 368 FILE *fp; 375 369 int i,bytes; 376 u nsigned charpal_quad[4];370 uint8_t pal_quad[4]; 377 371 // fp=fopen("d:\\windows\\256color.bmp","rb"); 378 372 // fread(&bmp,1,sizeof(bmp),fp); … … 411 405 { 412 406 image *ni; 413 u nsigned char*sl1,*sl2;407 uint8_t *sl1,*sl2; 414 408 int i,x; 415 u nsigned charr,g,b;409 uint8_t r,g,b; 416 410 printf("Creating image size (%d, %d)\n",im->width()*3,im->height()); 417 411 ni=new image(im->width()*3,im->height()); … … 429 423 } 430 424 431 u nsigned charaddb(int n1, int n2)425 uint8_t addb(int n1, int n2) 432 426 { int n3; 433 427 n3=n1+n2; … … 441 435 { 442 436 image *i24; 443 u nsigned charmin[3],max[3],mid[3],*ad,*sl,*sl2,crimp;437 uint8_t min[3],max[3],mid[3],*ad,*sl,*sl2,crimp; 444 438 int i,j,x,y,delta; 445 439 (void *)ad=pal->addr(); … … 523 517 image *im,*i24; 524 518 palette *pal; 525 u nsigned char*sl;519 uint8_t *sl; 526 520 FILE *fp; 527 521 char def_name[10],*dev_name,*fname=NULL; 528 u nsigned charcp[500],mp[500],yp[500],kp[500];522 uint8_t cp[500],mp[500],yp[500],kp[500]; 529 523 strcpy(def_name,"\\dev\\lp"); // set the default output device to /dev/lp 530 524 // since we are in vpix, however we will use the backslash -
abuse/trunk/src/imlib/scroller.cpp
r4 r17 4 4 5 5 6 u nsigned charhs_left_arrow[10*8]={6 uint8_t hs_left_arrow[10*8]={ 7 7 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 8 8 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, … … 13 13 14 14 15 u nsigned charhs_right_arrow[10*8]={15 uint8_t hs_right_arrow[10*8]={ 16 16 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 17 17 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, … … 22 22 23 23 24 u nsigned charvs_up_arrow[8*10]={24 uint8_t vs_up_arrow[8*10]={ 25 25 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0, 26 26 0, 0, 0, 1, 1, 1, 1, 2, 0, 0, 1, 2, 1, 1, 2, … … 31 31 32 32 33 u nsigned charvs_down_arrow[8*10]={33 uint8_t vs_down_arrow[8*10]={ 34 34 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 1, 1, 2, 0, 35 35 0, 0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 1, 1, 2, … … 39 39 0, 0, 0, 0, 0}; 40 40 41 void show_icon(image *screen, window_manager *wm, int x, int y, int icw, int ich, u nsigned char*buf)41 void show_icon(image *screen, window_manager *wm, int x, int y, int icw, int ich, uint8_t *buf) 42 42 { 43 43 short cx1,cy1,cx2,cy2; 44 44 screen->get_clip(cx1,cy1,cx2,cy2); 45 u nsigned charremap[3];45 uint8_t remap[3]; 46 46 remap[0]=wm->medium_color(); 47 47 remap[1]=wm->bright_color(); … … 52 52 if (y>=cy1 && y<=cy2) 53 53 { 54 u nsigned char*sl=screen->scan_line(y)+x;54 uint8_t *sl=screen->scan_line(y)+x; 55 55 for (int xc=icw,xo=x;xc;xc--,xo++,sl++,buf++) 56 56 { … … 88 88 int scroller::bw() { if (vert) return 12; else return 14; } 89 89 90 u nsigned char*scroller::b1()90 uint8_t *scroller::b1() 91 91 { 92 92 if (vert) return vs_up_arrow; … … 94 94 } 95 95 96 u nsigned char*scroller::b2()96 uint8_t *scroller::b2() 97 97 { 98 98 if (vert) return vs_down_arrow; … … 553 553 if (m) 554 554 { 555 select=(u char*)jmalloc((t+7)/8,"selection bit array");555 select=(uint8_t *)jmalloc((t+7)/8,"selection bit array"); 556 556 memset(select,0,(t+7)/8); 557 557 } else cur_sel=0; -
abuse/trunk/src/imlib/specs.cpp
r7 r17 595 595 596 596 597 uint8_t bFILE::read_ byte()597 uint8_t bFILE::read_uint8() 598 598 { uint8_t x; 599 599 read(&x,1); … … 601 601 } 602 602 603 uint16_t bFILE::read_ short()603 uint16_t bFILE::read_uint16() 604 604 { 605 605 uint16_t x; 606 606 read(&x,2); 607 return int_to_local(x);608 } 609 610 611 uint32_t bFILE::read_ long()607 return uint16_to_local(x); 608 } 609 610 611 uint32_t bFILE::read_uint32() 612 612 { 613 613 uint32_t x; 614 614 read(&x,4); 615 return long_to_local(x);616 } 617 618 void bFILE::write_ byte(uint8_t x)615 return uint32_to_local(x); 616 } 617 618 void bFILE::write_uint8(uint8_t x) 619 619 { 620 620 write(&x,1); 621 621 } 622 622 623 void bFILE::write_ short(uint16_t x)623 void bFILE::write_uint16(uint16_t x) 624 624 { 625 x= int_to_local(x);625 x=uint16_to_local(x); 626 626 write(&x,2); 627 627 } 628 628 629 629 630 void bFILE::write_ long(uint32_t x)631 { 632 x= long_to_local(x);630 void bFILE::write_uint32(uint32_t x) 631 { 632 x=uint32_to_local(x); 633 633 write(&x,4); 634 634 } … … 637 637 { 638 638 double a; 639 write_ long((long)(modf(x,&a)*(double)(1<<32-1)));640 write_ long((long)a);639 write_uint32((long)(modf(x,&a)*(double)(1<<32-1))); 640 write_uint32((long)a); 641 641 } 642 642 … … 644 644 { 645 645 long a,b; 646 a=read_ long();647 b=read_ long();646 a=read_uint32(); 647 b=read_uint32(); 648 648 return (double)b+a/(double)(1<<32-1); 649 649 } … … 762 762 if (!strcmp(buf,SPEC_SIGNATURE)) 763 763 { 764 total=fp->read_ short();764 total=fp->read_uint16(); 765 765 entries=(spec_entry **)jmalloc(sizeof(spec_entry *)*total,"spec_directory::entries"); 766 766 long start=fp->tell(); … … 793 793 fp->read(&flags,1); 794 794 795 se->size=fp->read_ long();796 se->offset=fp->read_ long();795 se->size=fp->read_uint32(); 796 se->offset=fp->read_uint32(); 797 797 dp+=((sizeof(spec_entry)+len)+3)&(~3); 798 798 } … … 880 880 881 881 if (fp->write(sig,sizeof(sig))!=sizeof(sig)) return 0; 882 fp->write_ short(total);882 fp->write_uint16(total); 883 883 884 884 … … 891 891 if (fp->write(&flags,1)!=1) return 0; 892 892 893 data_size= long_to_intel((*e)->size);893 data_size=uint32_to_intel((*e)->size); 894 894 if (fp->write((char *)&data_size,4)!=4) return 0; 895 offset= long_to_intel((*e)->offset);895 offset=uint32_to_intel((*e)->offset); 896 896 if (fp->write((char *)&offset,4)!=4) return 0; 897 897 … … 913 913 } 914 914 915 uint16_t read_ short(FILE *fp)915 uint16_t read_uint16(FILE *fp) 916 916 { 917 917 uint16_t x; 918 918 fread(&x,1,2,fp); 919 return int_to_local(x);920 } 921 922 uint32_t read_ long(FILE *fp)919 return uint16_to_local(x); 920 } 921 922 uint32_t read_uint32(FILE *fp) 923 923 { 924 924 uint32_t x; 925 925 fread(&x,1,4,fp); 926 return long_to_local(x);927 } 928 void write_ short(FILE *fp, uint16_t x)929 { 930 x= int_to_local(x);926 return uint32_to_local(x); 927 } 928 void write_uint16(FILE *fp, uint16_t x) 929 { 930 x=uint16_to_local(x); 931 931 fwrite(&x,1,2,fp); 932 932 } 933 933 934 void write_ long(FILE *fp, uint32_t x)935 { 936 x= long_to_local(x);934 void write_uint32(FILE *fp, uint32_t x) 935 { 936 x=uint32_to_local(x); 937 937 fwrite(&x,1,4,fp); 938 938 } 939 939 940 uint8_t read_ byte(FILE *fp) { return fgetc(fp)&0xff; }941 void write_ byte(FILE *fp, uint8_t x) { fputc((unsigned char)x,fp); }942 943 uint32_t read_other_ long(FILE *fp)940 uint8_t read_uint8(FILE *fp) { return fgetc(fp)&0xff; } 941 void write_uint8(FILE *fp, uint8_t x) { fputc((unsigned char)x,fp); } 942 943 uint32_t read_other_int32(FILE *fp) 944 944 { 945 945 uint32_t x; 946 946 fread(&x,1,4,fp); 947 return big_ long_to_local(x);948 } 949 950 uint16_t read_other_ short(FILE *fp)947 return big_uint32_to_local(x); 948 } 949 950 uint16_t read_other_uint16(FILE *fp) 951 951 { 952 952 uint16_t x; 953 953 fread(&x,1,2,fp); 954 return big_ short_to_local(x);955 } 956 957 958 void write_other_ short(FILE *fp, uint16_t x)959 { 960 x=big_ short_to_local(x);954 return big_uint16_to_local(x); 955 } 956 957 958 void write_other_uint16(FILE *fp, uint16_t x) 959 { 960 x=big_uint16_to_local(x); 961 961 fwrite(&x,1,2,fp); 962 962 } 963 963 964 void write_other_ long(FILE *fp, uint32_t x)965 { 966 x=big_ long_to_local(x);964 void write_other_int32(FILE *fp, uint32_t x) 965 { 966 x=big_uint32_to_local(x); 967 967 fwrite(&x,1,4,fp); 968 968 } -
abuse/trunk/src/imlib/targa.cpp
r4 r17 14 14 } 15 15 16 u nsigned charid,color_map,im_type;16 uint8_t id,color_map,im_type; 17 17 18 id=fp->read_ byte();19 color_map=fp->read_ byte();20 im_type=fp->read_ byte();18 id=fp->read_uint8(); 19 color_map=fp->read_uint8(); 20 im_type=fp->read_uint8(); 21 21 22 22 if (color_map!=0) … … 32 32 } 33 33 34 fp->read_ short();35 fp->read_ short();36 fp->read_ byte();34 fp->read_uint16(); 35 fp->read_uint16(); 36 fp->read_uint8(); 37 37 38 fp->read_ short();39 fp->read_ short();38 fp->read_uint16(); 39 fp->read_uint16(); 40 40 41 41 42 int w=fp->read_ short();43 int h=fp->read_ short();44 u nsigned char bpp=fp->read_byte();45 u nsigned char im_des=fp->read_byte();42 int w=fp->read_uint16(); 43 int h=fp->read_uint16(); 44 uint8_t bpp=fp->read_uint8(); 45 uint8_t im_des=fp->read_uint8(); 46 46 47 47 if (bpp!=32) … … 54 54 55 55 int x,y; 56 u nsigned charctrl;57 u nsigned charbgra[4],*sl,c,lr=0,lg=0,lb=0,ll=0,lc=0;56 uint8_t ctrl; 57 uint8_t bgra[4],*sl,c,lr=0,lg=0,lb=0,ll=0,lc=0; 58 58 59 59 … … 68 68 for (x=0;x<w;) 69 69 { 70 ctrl=fp->read_ byte();70 ctrl=fp->read_uint8(); 71 71 if (ctrl&0x80) 72 72 { -
abuse/trunk/src/imlib/timage.cpp
r2 r17 3 3 void trans_image::make_color(int c) 4 4 { 5 u nsigned char*dp=data;5 uint8_t *dp=data; 6 6 int y,x; 7 7 for (y=0;y<h;y++) … … 25 25 { 26 26 image *im=new image(w,h); 27 u nsigned char*d=im->scan_line(0),*dp=data,*dline;27 uint8_t *d=im->scan_line(0),*dp=data,*dline; 28 28 int y,x; 29 29 for (y=0;y<h;y++) … … 54 54 { 55 55 int size=0,x,y; 56 u nsigned char*sl,*datap,*marker;56 uint8_t *sl,*datap,*marker; 57 57 w=im->width(); 58 58 h=im->height(); … … 84 84 char st[80]; 85 85 sprintf(st,"trans_image::data (%s)",name); 86 data=(u nsigned char*)jmalloc(size,st);86 data=(uint8_t *)jmalloc(size,st); 87 87 #else 88 data=(u nsigned char*)jmalloc(size,"");88 data=(uint8_t *)jmalloc(size,""); 89 89 #endif 90 90 int ww=im->width(),hh=im->height(); … … 125 125 void trans_image::put_scan_line(image *screen, int x, int y, int line) // always transparent 126 126 { 127 short x1,y1,x2,y2;127 int16_t x1,y1,x2,y2; 128 128 screen->get_clip(x1,y1,x2,y2); 129 129 if (y+line<y1 || y+line>y2 || x>x2 || x+w-1<x1) // clipped off completely? 130 130 return; 131 131 132 u nsigned char*datap=data;132 uint8_t *datap=data; 133 133 int ix; 134 134 while (line) // skip scan line data until we get to the line of interest … … 151 151 152 152 // now slam this list of runs to the screen 153 u nsigned char*screen_line=screen->scan_line(y)+x;153 uint8_t *screen_line=screen->scan_line(y)+x; 154 154 155 155 for (ix=0;ix<w;) … … 202 202 203 203 204 inline u nsigned char*trans_image::clip_y(image *screen, int x1, int y1, int x2, int y2,204 inline uint8_t *trans_image::clip_y(image *screen, int x1, int y1, int x2, int y2, 205 205 int x, int &y, int &ysteps) 206 206 { … … 209 209 return NULL; 210 210 211 register u nsigned char*datap=data;211 register uint8_t *datap=data; 212 212 213 213 … … 245 245 246 246 void trans_image::put_image_filled(image *screen, int x, int y, 247 u charfill_color)248 { 249 short x1,y1,x2,y2;247 uint8_t fill_color) 248 { 249 int16_t x1,y1,x2,y2; 250 250 int chop_length,ysteps; 251 251 252 252 screen->get_clip(x1,y1,x2,y2); 253 register u nsigned char*datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;253 register uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line; 254 254 if (!datap) return ; // if clip_y says nothing to draw, return 255 255 … … 316 316 } 317 317 318 void trans_image::put_image_offseted(image *screen, u char*s_off) // if screen x & y offset already calculated save a mul318 void trans_image::put_image_offseted(image *screen, uint8_t *s_off) // if screen x & y offset already calculated save a mul 319 319 { 320 320 int ix,ysteps=height(); 321 321 int screen_skip=screen->width()-w; 322 u charskip,*datap=data;322 uint8_t skip,*datap=data; 323 323 for (;ysteps;ysteps--) 324 324 { … … 353 353 void trans_image::put_image(image *screen, int x, int y) 354 354 { 355 short x1,y1,x2,y2;355 int16_t x1,y1,x2,y2; 356 356 int chop_length,ysteps; 357 357 358 358 screen->get_clip(x1,y1,x2,y2); 359 register u nsigned char*datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;359 register uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line; 360 360 if (!datap) return ; // if clip_y says nothing to draw, return 361 361 … … 414 414 } 415 415 416 void trans_image::put_remaped(image *screen, int x, int y, u nsigned char*remap)417 { 418 short x1,y1,x2,y2;416 void trans_image::put_remaped(image *screen, int x, int y, uint8_t *remap) 417 { 418 int16_t x1,y1,x2,y2; 419 419 int chop_length,ysteps; 420 420 421 421 screen->get_clip(x1,y1,x2,y2); 422 register u nsigned char*datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;422 register uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line; 423 423 if (!datap) return ; // if clip_y says nothing to draw, return 424 424 … … 470 470 counter=slam_length; 471 471 472 register u nsigned char*sl=screen_line+ix,*sl2=datap;472 register uint8_t *sl=screen_line+ix,*sl2=datap; 473 473 ix+=slam_length; 474 474 datap+=slam_length; … … 490 490 491 491 492 void trans_image::put_double_remaped(image *screen, int x, int y, u nsigned char *remap, unsigned char*remap2)493 { 494 short x1,y1,x2,y2;492 void trans_image::put_double_remaped(image *screen, int x, int y, uint8_t *remap, uint8_t *remap2) 493 { 494 int16_t x1,y1,x2,y2; 495 495 int chop_length,ysteps; 496 496 497 497 screen->get_clip(x1,y1,x2,y2); 498 register u nsigned char*datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;498 register uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line; 499 499 if (!datap) return ; // if clip_y says nothing to draw, return 500 500 … … 546 546 counter=slam_length; 547 547 548 register u nsigned char*sl=screen_line+ix,*sl2=datap;548 register uint8_t *sl=screen_line+ix,*sl2=datap; 549 549 ix+=slam_length; 550 550 datap+=slam_length; … … 570 570 color_filter *f, palette *pal) 571 571 { 572 short x1,y1,x2,y2;572 int16_t x1,y1,x2,y2; 573 573 int ix,slam_length,chop_length,ysteps; 574 574 575 575 screen->get_clip(x1,y1,x2,y2); 576 u nsigned char*datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),576 uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps), 577 577 *screen_line; 578 578 if (!datap) return ; 579 579 580 u nsigned char *screen_run,*paddr=(unsigned char*)pal->addr(),580 uint8_t *screen_run,*paddr=(uint8_t *)pal->addr(), 581 581 *caddr1,*caddr2,r_dest,g_dest,b_dest; 582 582 … … 659 659 void trans_image::put_fade_tint(image *screen, int x, int y, 660 660 int frame_on, int total_frames, 661 u char*tint,661 uint8_t *tint, 662 662 color_filter *f, palette *pal) 663 663 { 664 short x1,y1,x2,y2;664 int16_t x1,y1,x2,y2; 665 665 int ix,slam_length,chop_length,ysteps; 666 666 667 667 screen->get_clip(x1,y1,x2,y2); 668 u nsigned char*datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),668 uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps), 669 669 *screen_line; 670 670 if (!datap) return ; 671 671 672 u nsigned char *screen_run,*paddr=(unsigned char*)pal->addr(),672 uint8_t *screen_run,*paddr=(uint8_t *)pal->addr(), 673 673 *caddr1,*caddr2,r_dest,g_dest,b_dest; 674 674 … … 753 753 void trans_image::put_color(image *screen, int x, int y, int color) 754 754 { 755 short x1,y1,x2,y2;755 int16_t x1,y1,x2,y2; 756 756 int ix,slam_length,chop_length,ysteps; 757 757 758 758 screen->get_clip(x1,y1,x2,y2); 759 u nsigned char*datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),759 uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps), 760 760 *screen_line; 761 761 if (!datap) return ; … … 819 819 820 820 { 821 short x1,y1,x2,y2;821 int16_t x1,y1,x2,y2; 822 822 int ix,slam_length,chop_length,ysteps; 823 u nsigned char *paddr=(unsigned char*)pal->addr();823 uint8_t *paddr=(uint8_t *)pal->addr(); 824 824 825 825 screen->get_clip(x1,y1,x2,y2); 826 u nsigned char*datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),826 uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps), 827 827 *blend_line,*screen_line; 828 828 if (!datap) return ; … … 876 876 else chop_length=slam_length; 877 877 878 u nsigned char*screen_run=screen_line+x+ix,878 uint8_t *screen_run=screen_line+x+ix, 879 879 *blend_run=blend_line+x+ix-blendx, 880 880 *caddr1,*caddr2,r_dest,g_dest,b_dest; … … 918 918 void trans_image::put_predator(image *screen, int x, int y) 919 919 { 920 short x1,y1,x2,y2;920 int16_t x1,y1,x2,y2; 921 921 int chop_length,ysteps; 922 922 923 923 screen->get_clip(x1,y1,x2,y2); 924 register u nsigned char*datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line;924 register uint8_t *datap=clip_y(screen,x1,y1,x2,y2,x,y,ysteps),*screen_line; 925 925 if (!datap) return ; // if clip_y says nothing to draw, return 926 926 … … 1002 1002 int trans_image::size() 1003 1003 { 1004 u char*d=data;1004 uint8_t *d=data; 1005 1005 int t=0; 1006 1006 for (int y=0;y<h;y++) -
abuse/trunk/src/imlib/xwdread.cpp
r4 r17 123 123 int bit_order, byte_swap; 124 124 char buf[4]; 125 unsigned char *byteP; 126 unsigned short *shortP; 127 unsigned long *longP; 128 129 130 int bs_int(int s); 131 long bs_long(long s); 132 short bs_short(short s ); 125 uint8_t *byteP; 126 uint16_t *shortP; 127 uint32_t *longP; 128 129 130 uint32_t bs_uint32(uint32_t s); 131 uint16_t bs_uint16(uint16_t s ); 133 132 134 133 … … 136 135 { 137 136 /* Assume X11 headers are larger than X10 ones. */ 138 u nsigned charheader[sizeof(X11WDFileHeader)];137 uint8_t header[sizeof(X11WDFileHeader)]; 139 138 image *im; 140 139 X11WDFileHeader *h11P; … … 142 141 unsigned int i; 143 142 int dummy1, dummy2, dummy3; 144 u nsigned short minred, maxred;143 uint16_t minred, maxred; 145 144 X11XColor x11col; 146 145 … … 275 274 pixel_mask = ( 1 << bits_per_pixel ) - 1; 276 275 277 byteP = (u nsigned char*) buf;278 shortP = (u nsigned short *) buf;279 longP = (u nsigned long*) buf;276 byteP = (uint8_t *) buf; 277 shortP = (uint16_t *) buf; 278 longP = (uint32_t *) buf; 280 279 return im; 281 280 } … … 284 283 { 285 284 int i,j; 286 u nsigned char*sl;285 uint8_t *sl; 287 286 #if BYTE_ORDER!=BIG_ENDIAN 288 287 printf("little guys\n"); … … 314 313 break; 315 314 316 case 16: *shortP= short_swap(*shortP); break;317 318 case 32: *longP= long_swap(*longP); break;315 case 16: *shortP=uint16_swap(*shortP); break; 316 317 case 32: *longP=uint32_swap(*longP); break; 319 318 320 319 default: … … 357 356 358 357 359 short bs_short(short s )360 { 361 short ss;362 u nsigned char*bp, t;358 uint16_t bs_uint16(uint16_t s ) 359 { 360 uint16_t ss; 361 uint8_t *bp, t; 363 362 364 363 ss = s; 365 bp = (u nsigned char*) &ss;364 bp = (uint8_t *) &ss; 366 365 t = bp[0]; 367 366 bp[0] = bp[1]; … … 370 369 } 371 370 372 int bs_int(int i)373 { 374 int ii;375 u nsigned char*bp, t;376 377 ii = i;378 bp = (u nsigned char*) ⅈ371 uint32_t bs_uint32(uint32_t l ) 372 { 373 uint32_t ii; 374 uint8_t *bp, t; 375 376 ii = l; 377 bp = (uint8_t *) ⅈ 379 378 t = bp[0]; 380 379 bp[0] = bp[3]; … … 386 385 } 387 386 388 long bs_long(long l )389 {390 return bs_int( l );391 }392 393 387 struct BMP_header 394 388 { 395 389 char id[2]; 396 390 long filesize; 397 short reserved[2];391 int16_t reserved[2]; 398 392 long headersize,infosize,width,height; 399 short biplanes,bits;393 int16_t biplanes,bits; 400 394 long bicompression, bisizeimage, bixpelspermeter, biypelspermeter, 401 395 biclrused,biclrimportant; … … 405 399 { 406 400 if (!fread(&bmp.id,1,2,fp)) return 0; // 2 0 407 bmp.filesize=read_ long(fp); // 4 4401 bmp.filesize=read_uint32(fp); // 4 4 408 402 if (!fread(bmp.reserved,1,4,fp)) return 0; // 4 8 409 bmp.headersize=read_ long(fp); // 4 12410 bmp.infosize=read_ long(fp); // 4 16411 bmp.width=read_ long(fp); // 4 20412 bmp.height=read_ long(fp); // 4 24413 bmp.biplanes=read_ short(fp); // 2 26414 bmp.bits=read_ short(fp); // 2 28415 bmp.bicompression=read_ long(fp); // 4 32416 bmp.bisizeimage=read_ long(fp); // 4 36417 bmp.bixpelspermeter=read_ long(fp); // 4 40418 bmp.biypelspermeter=read_ long(fp); // 4 44419 bmp.biclrused=read_ long(fp); // 4 48420 bmp.biclrimportant=read_ long(fp); // 4 52403 bmp.headersize=read_uint32(fp); // 4 12 404 bmp.infosize=read_uint32(fp); // 4 16 405 bmp.width=read_uint32(fp); // 4 20 406 bmp.height=read_uint32(fp); // 4 24 407 bmp.biplanes=read_uint16(fp); // 2 26 408 bmp.bits=read_uint16(fp); // 2 28 409 bmp.bicompression=read_uint32(fp); // 4 32 410 bmp.bisizeimage=read_uint32(fp); // 4 36 411 bmp.bixpelspermeter=read_uint32(fp); // 4 40 412 bmp.biypelspermeter=read_uint32(fp); // 4 44 413 bmp.biclrused=read_uint32(fp); // 4 48 414 bmp.biclrimportant=read_uint32(fp); // 4 52 421 415 return 1; 422 416 … … 460 454 return NULL; 461 455 462 u nsigned char*sl;456 uint8_t *sl; 463 457 int trailer=im->width()%4; 464 458 if (trailer==1) trailer=3; 465 459 else if (trailer==3) trailer=1; 466 u charbuf[9];460 uint8_t buf[9]; 467 461 for (i=im->height();i;i--) 468 462 { … … 487 481 image *im; 488 482 FILE *fp; 489 u nsigned charpal_quad[4];483 uint8_t pal_quad[4]; 490 484 char *scrap; 491 485 int bytes,i; … … 530 524 { 531 525 if (!fwrite(&bmp.id,1,2,fp)) return 0; 532 write_ long(fp,bmp.filesize);526 write_uint32(fp,bmp.filesize); 533 527 if (!fwrite(bmp.reserved,1,4,fp)) return 0; 534 write_ long(fp,bmp.headersize);535 write_ long(fp,bmp.infosize);536 write_ long(fp,bmp.width);537 write_ long(fp,bmp.height);538 write_ short(fp,bmp.biplanes);539 write_ short(fp,bmp.bits);540 write_ long(fp,bmp.bicompression);541 write_ long(fp,bmp.bisizeimage);542 write_ long(fp,bmp.bixpelspermeter);543 write_ long(fp,bmp.biypelspermeter);544 write_ long(fp,bmp.biclrused);545 write_ long(fp,bmp.biclrimportant);528 write_uint32(fp,bmp.headersize); 529 write_uint32(fp,bmp.infosize); 530 write_uint32(fp,bmp.width); 531 write_uint32(fp,bmp.height); 532 write_uint16(fp,bmp.biplanes); 533 write_uint16(fp,bmp.bits); 534 write_uint32(fp,bmp.bicompression); 535 write_uint32(fp,bmp.bisizeimage); 536 write_uint32(fp,bmp.bixpelspermeter); 537 write_uint32(fp,bmp.biypelspermeter); 538 write_uint32(fp,bmp.biclrused); 539 write_uint32(fp,bmp.biclrimportant); 546 540 return 1; 547 541 … … 552 546 FILE *fp; 553 547 int i,bytes; 554 u nsigned charpal_quad[4];548 uint8_t pal_quad[4]; 555 549 fp=fopen(filename,"wb"); 556 550 if (!fp) -
abuse/trunk/src/include/cache.hpp
r2 r17 23 23 { 24 24 void *data; 25 longlast_access;26 u nsigned chartype;27 short file_number;28 longoffset;25 int32_t last_access; 26 uint8_t type; 27 int16_t file_number; 28 int32_t offset; 29 29 } ; 30 30 … … 35 35 public : 36 36 int crc_calculated; 37 u longcrc;37 uint32_t crc; 38 38 char *filename; 39 39 crced_file(char *name); … … 48 48 crc_manager(); 49 49 int get_filenumber(char *filename); 50 u long get_crc(longfilenumber, int &failed);51 void set_crc( long filenumber, ulongcrc);52 char *get_filename( longfilenumber);50 uint32_t get_crc(int32_t filenumber, int &failed); 51 void set_crc(int32_t filenumber, uint32_t crc); 52 char *get_filename(int32_t filenumber); 53 53 void clean_up(); 54 54 int total_filenames() { return total_files; } … … 62 62 { 63 63 cache_item *list; 64 longtotal,last_registered,last_access,poll_start_access;65 short last_file; // for speed leave the last file accessed open64 int32_t total,last_registered,last_access,poll_start_access; 65 int16_t last_file; // for speed leave the last file accessed open 66 66 67 67 bFILE *fp,*cache_file,*cache_read_file; 68 68 spec_directory *last_dir; 69 longlast_offset; // store the last offset so we don't have to seek if69 int32_t last_offset; // store the last offset so we don't have to seek if 70 70 // we don't need to 71 71 72 72 73 short lcache_number;74 longalloc_id();73 int16_t lcache_number; 74 int32_t alloc_id(); 75 75 void locate(cache_item *i, int local_only=0); // set up file and offset for this item 76 76 void normalize(); … … 87 87 int in_use() { if (used) { used=0; return 1; } else return 0; } 88 88 int full() { if (ful) { ful=0; return 1; } else return 0; } 89 longreg_object(char *filename, void *object, int type, int rm_dups); // lisp object90 longreg(char *filename, char *name, int type=-1, int rm_dups=0); // returns id to item91 longreg_lisp_block(Cell *block);89 int32_t reg_object(char *filename, void *object, int type, int rm_dups); // lisp object 90 int32_t reg(char *filename, char *name, int type=-1, int rm_dups=0); // returns id to item 91 int32_t reg_lisp_block(Cell *block); 92 92 int loaded(int id); 93 93 void unreg(int id); … … 114 114 115 115 void load_cache_prof_info(char *filename, level *lev); 116 int search(int *sarray, u short filenum, longoffset); // sarray is a index table sorted by offset/filenum116 int search(int *sarray, uint16_t filenum, int32_t offset); // sarray is a index table sorted by offset/filenum 117 117 118 118 void show_accessed(); -
abuse/trunk/src/include/compiled.hpp
r2 r17 25 25 void compiled_uninit(); 26 26 27 extern u char *bad_guy_array;// list flaging each character saying they are a bad bug or not27 extern uint8_t *bad_guy_array; // list flaging each character saying they are a bad bug or not 28 28 // mainly used by the rocket to find targets 29 29 -
abuse/trunk/src/include/crc.hpp
r2 r17 4 4 #include "macs.hpp" 5 5 6 u nsigned short calc_crc(unsigned char *buf, longlen);7 u longcrc_file(bFILE *fp);6 uint16_t calc_crc(uint8_t *buf, int len); 7 uint32_t crc_file(bFILE *fp); 8 8 9 9 -
abuse/trunk/src/include/extend.hpp
r16 r17 23 23 { 24 24 public : 25 scharFade_dir;26 u charFade_count,Fade_max;27 u charFlags,grav_on,targetable_on;25 int8_t Fade_dir; 26 uint8_t Fade_count,Fade_max; 27 uint8_t Flags,grav_on,targetable_on; 28 28 int32_t Xvel,Yvel,Xacel,Yacel; 29 u charFx,Fy,Fxvel,Fyvel,Fxacel,Fyacel;30 u charAitype;31 u short Aistate,Aistate_time;32 u nsigned short Hp,Mp,Fmp;33 scharFrame_dir;29 uint8_t Fx,Fy,Fxvel,Fyvel,Fxacel,Fyacel; 30 uint8_t Aitype; 31 uint16_t Aistate,Aistate_time; 32 uint16_t Hp,Mp,Fmp; 33 int8_t Frame_dir; 34 34 35 35 36 u chartobjs,tlights;36 uint8_t tobjs,tlights; 37 37 game_object **objs,*link; 38 38 light_source **lights; … … 50 50 int32_t x,y, 51 51 last_x,last_y; // used for frame interpolation on fast machines 52 schardirection,active;53 u short otype;52 int8_t direction,active; 53 uint16_t otype; 54 54 character_state state; 55 55 short current_frame; … … 60 60 61 61 int keep_ai_info() { return 1; } 62 u char flags(){ return Flags; }62 uint8_t flags() { return Flags; } 63 63 int32_t xvel() { return Xvel; } 64 64 int32_t yvel() { return Yvel; } … … 66 66 int32_t yacel() { return Yacel; } 67 67 68 u char fx(){ return Fx; }69 u char fy(){ return Fy; }70 u char fxvel(){ return Fxvel; }71 u char fyvel(){ return Fyvel; }72 u char fxacel(){ return Fxacel; }73 u char fyacel(){ return Fyacel; }68 uint8_t fx() { return Fx; } 69 uint8_t fy() { return Fy; } 70 uint8_t fxvel() { return Fxvel; } 71 uint8_t fyvel() { return Fyvel; } 72 uint8_t fxacel() { return Fxacel; } 73 uint8_t fyacel() { return Fyacel; } 74 74 75 u char sfx(){ return Fx; } // x & y should always be positive76 u char sfy(){ return Fy; }77 u char sfxvel(){ if (Xvel>=0) return Fxvel; else return -Fxvel; }78 u char sfyvel(){ if (Yvel>=0) return Fyvel; else return -Fyvel; }79 u char sfxacel(){ if (Xacel>=0) return Fxacel; else return -Fxacel; }80 u char sfyacel(){ if (Yacel>=0) return Fyacel; else return -Fyacel; }75 uint8_t sfx() { return Fx; } // x & y should always be positive 76 uint8_t sfy() { return Fy; } 77 uint8_t sfxvel() { if (Xvel>=0) return Fxvel; else return -Fxvel; } 78 uint8_t sfyvel() { if (Yvel>=0) return Fyvel; else return -Fyvel; } 79 uint8_t sfxacel() { if (Xacel>=0) return Fxacel; else return -Fxacel; } 80 uint8_t sfyacel() { if (Yacel>=0) return Fyacel; else return -Fyacel; } 81 81 82 u char aitype(){ return Aitype; }83 u short aistate(){ return Aistate; }84 u short aistate_time(){ return Aistate_time; }85 u short hp(){ return Hp; }86 u short mp(){ return Mp; }87 u short fmp(){ return Fmp; }88 schar fade_dir(){ return Fade_dir; }89 schar frame_dir(){ return Frame_dir; }90 u char fade_count(){ return Fade_count; }91 u char fade_max(){ return Fade_max; }92 u char total_objects(){ return tobjs; }93 u char total_lights(){ return tlights; }82 uint8_t aitype() { return Aitype; } 83 uint16_t aistate() { return Aistate; } 84 uint16_t aistate_time() { return Aistate_time; } 85 uint16_t hp() { return Hp; } 86 uint16_t mp() { return Mp; } 87 uint16_t fmp() { return Fmp; } 88 int8_t fade_dir() { return Fade_dir; } 89 int8_t frame_dir() { return Frame_dir; } 90 uint8_t fade_count() { return Fade_count; } 91 uint8_t fade_max() { return Fade_max; } 92 uint8_t total_objects() { return tobjs; } 93 uint8_t total_lights() { return tlights; } 94 94 95 95 morph_char *morph_status() { return mc; } … … 100 100 view *controller() { return Controller; } 101 101 102 void set_targetable(u char x){ targetable_on=x; }103 void set_flags(u char f){ Flags=f; }102 void set_targetable(uint8_t x) { targetable_on=x; } 103 void set_flags(uint8_t f) { Flags=f; } 104 104 void set_xvel(int32_t xv) { Xvel=xv; } 105 105 void set_yvel(int32_t yv) { Yvel=yv; } 106 106 void set_xacel(int32_t xa) { Xacel=xa; } 107 107 void set_yacel(int32_t ya) { Yacel=ya; } 108 void set_fx(u char x){ Fx=x; }109 void set_fy(u char y){ Fy=y; }110 void set_fxvel(u char xv){ Fxvel=abs(xv); }111 void set_fyvel(u char yv){ Fyvel=abs(yv); }112 void set_fxacel(u char xa){ Fxacel=abs(xa); }113 void set_fyacel(u char ya){ Fyacel=abs(ya); }114 void set_aitype(u char t){ Aitype=t; }115 void set_aistate(u short s) { Aistate=s; }116 void set_aistate_time(u short t) { Aistate_time=t; }117 void set_hp(u short h) { Hp=h; }118 void set_mp(u short m) { Mp=m; }119 void set_fmp(u short m) { Fmp=m; }108 void set_fx(uint8_t x) { Fx=x; } 109 void set_fy(uint8_t y) { Fy=y; } 110 void set_fxvel(uint8_t xv) { Fxvel=abs(xv); } 111 void set_fyvel(uint8_t yv) { Fyvel=abs(yv); } 112 void set_fxacel(uint8_t xa) { Fxacel=abs(xa); } 113 void set_fyacel(uint8_t ya) { Fyacel=abs(ya); } 114 void set_aitype(uint8_t t) { Aitype=t; } 115 void set_aistate(uint16_t s) { Aistate=s; } 116 void set_aistate_time(uint16_t t) { Aistate_time=t; } 117 void set_hp(uint16_t h) { Hp=h; } 118 void set_mp(uint16_t m) { Mp=m; } 119 void set_fmp(uint16_t m) { Fmp=m; } 120 120 121 121 122 122 123 void set_fade_count(u char f){ Fade_count=f; }124 void set_fade_max(u char m){ Fade_max=m; }125 void set_fade_dir( schard) { Fade_dir=d; }123 void set_fade_count(uint8_t f) { Fade_count=f; } 124 void set_fade_max(uint8_t m) { Fade_max=m; } 125 void set_fade_dir(int8_t d) { Fade_dir=d; } 126 126 127 void set_frame_dir( schard) { Frame_dir=d; }127 void set_frame_dir(int8_t d) { Frame_dir=d; } 128 128 void add_light(light_source *ls); 129 129 void add_object(game_object *o); -
abuse/trunk/src/include/fakelib.hpp
r2 r17 5 5 #define jrealloc(x,y,z) realloc(x,y) 6 6 #define jfree(x) free(x) 7 #define uchar unsigned char8 #define schar signed char9 #define sshort signed short10 7 11 8 #ifdef __sgi 12 9 #include <sys/bsd_types.h> 13 10 #else 14 #define ulong unsigned long 15 #define ushort unsigned short 11 #include <stdint.h> 16 12 #endif 17 13 -
abuse/trunk/src/include/game.hpp
r16 r17 66 66 jwindow *top_menu,*joy_win,*last_input; 67 67 JCFont *game_font; 68 u charkeymap[512/8];68 uint8_t keymap[512/8]; 69 69 70 70 public : -
abuse/trunk/src/include/items.hpp
r2 r17 15 15 public : 16 16 boundary(bFILE *fp,char *er_name); 17 u nsigned char*inside; // tells which side of the line is on the inside17 uint8_t *inside; // tells which side of the line is on the inside 18 18 boundary(boundary *p); // flips the *inside list 19 19 ~boundary() { if (tot) jfree(inside); } … … 23 23 { 24 24 public : 25 u nsigned short next;25 uint16_t next; 26 26 image *im; 27 27 backtile(spec_entry *e, bFILE *fp); 28 28 backtile(bFILE *fp); 29 longsize() { return 2+4+im->width()*im->height(); }29 int32_t size() { return 2+4+im->width()*im->height(); } 30 30 ~backtile() { delete im; } 31 31 } ; … … 35 35 public : 36 36 trans_image *im; 37 u nsigned short next;38 u nsigned chardamage;39 u charylevel; // for fast intersections, this is the y level offset for the ground37 uint16_t next; 38 uint8_t damage; 39 uint8_t ylevel; // for fast intersections, this is the y level offset for the ground 40 40 // if ground is not level this is 255 41 41 boundary *points; … … 44 44 45 45 foretile(bFILE *fp); 46 longsize() { return im->width()*im->height()+4+2+1+points->size(); }46 int32_t size() { return im->width()*im->height()+4+2+1+points->size(); } 47 47 ~foretile() { delete im; delete points; delete micro_image; } 48 48 } ; … … 52 52 public : 53 53 trans_image *forward,*backward; 54 u nsigned charhit_damage,xcfg;55 signed charadvance;54 uint8_t hit_damage,xcfg; 55 int8_t advance; 56 56 point_list *hit; 57 57 boundary *f_damage,*b_damage; … … 62 62 int height() { return forward->height(); } 63 63 64 /* longsize(int type) // taken from spaint items64 /* int32_t size(int type) // taken from spaint items 65 65 { 66 66 if … … 80 80 { 81 81 public : 82 u chardata[256];82 uint8_t data[256]; 83 83 ~char_tint() { ; } 84 84 char_tint(bFILE *fp); // should be a palette entry -
abuse/trunk/src/include/level.hpp
r16 r17 38 38 class level // contain map info and objects 39 39 { 40 u nsigned short *map_fg, // just big 2d arrays41 42 43 40 uint16_t *map_fg, // just big 2d arrays 41 *map_bg, 42 bg_width,bg_height, 43 fg_width,fg_height; 44 44 char *Name,*first_name; 45 45 int32_t total_objs; … … 64 64 int all_block_list_size,all_block_total; 65 65 void add_all_block(game_object *who); 66 u longctick;66 uint32_t ctick; 67 67 68 68 public : 69 69 char *original_name() { if (first_name) return first_name; else return Name; } 70 u longtick_counter() { return ctick; }71 void set_tick_counter(u longx);70 uint32_t tick_counter() { return ctick; } 71 void set_tick_counter(uint32_t x); 72 72 area_controller *area_list; 73 73 … … 80 80 game_object *first_object() { return first; } 81 81 game_object *first_active_object() { return first_active; } 82 u nsigned short foreground_width() { return fg_width; }83 u nsigned short foreground_height() { return fg_height; }84 u nsigned short background_width() { return bg_width; }85 u nsigned short background_height() { return bg_height; }82 uint16_t foreground_width() { return fg_width; } 83 uint16_t foreground_height() { return fg_height; } 84 uint16_t background_width() { return bg_width; } 85 uint16_t background_height() { return bg_height; } 86 86 int load_failed() { return map_fg==NULL; } 87 87 level(spec_directory *sd, bFILE *fp, char *lev_name); … … 98 98 return (*(map_fg+x+y*fg_width))&0x4000; } 99 99 void fg_set_raised(int x, int y, int r) { CHECK(x>=0 && y>=0 && x<fg_width && y<fg_height); 100 u short v=(*(map_fg+x+y*fg_width))&(0xffff-0x4000);100 uint16_t v=(*(map_fg+x+y*fg_width))&(0xffff-0x4000); 101 101 if (r) (*(map_fg+x+y*fg_width))=v|0x4000; 102 102 else (*(map_fg+x+y*fg_width))=v; … … 106 106 void clear_fg(int32_t x, int32_t y) { *(map_fg+x+y*fg_width)&=0x7fff; } 107 107 108 u nsigned short *get_fgline(int y) { CHECK(y>=0 && y<fg_height); return map_fg+y*fg_width; }109 u nsigned short *get_bgline(int y) { CHECK(y>=0 && y<bg_height); return map_bg+y*bg_width; }110 u nsigned short get_fg(int x, int y) { if (x>=0 && y>=0 && x<fg_width && y<fg_height)108 uint16_t *get_fgline(int y) { CHECK(y>=0 && y<fg_height); return map_fg+y*fg_width; } 109 uint16_t *get_bgline(int y) { CHECK(y>=0 && y<bg_height); return map_bg+y*bg_width; } 110 uint16_t get_fg(int x, int y) { if (x>=0 && y>=0 && x<fg_width && y<fg_height) 111 111 return fgvalue(*(map_fg+x+y*fg_width)); 112 112 else return 0; 113 113 } 114 u nsigned short get_bg(int x, int y) { if (x>=0 && y>=0 && x<bg_width && y<bg_height)114 uint16_t get_bg(int x, int y) { if (x>=0 && y>=0 && x<bg_width && y<bg_height) 115 115 return *(map_bg+x+y*bg_width); 116 116 else return 0; 117 117 } 118 void put_fg(int x, int y, u nsigned short tile) { *(map_fg+x+y*fg_width)=tile; }119 void put_bg(int x, int y, u nsigned short tile) { *(map_bg+x+y*bg_width)=tile; }118 void put_fg(int x, int y, uint16_t tile) { *(map_fg+x+y*fg_width)=tile; } 119 void put_bg(int x, int y, uint16_t tile) { *(map_bg+x+y*bg_width)=tile; } 120 120 void draw_objects(view *v); 121 121 void interpolate_draw_objects(view *v); -
abuse/trunk/src/include/light.hpp
r16 r17 8 8 9 9 #define TTINTS 9 10 extern u char*tints[TTINTS];11 extern u nsigned char*white_light,*white_light_initial,*green_light,*trans_table;12 extern short ambient_ramp;10 extern uint8_t *tints[TTINTS]; 11 extern uint8_t *white_light,*white_light_initial,*green_light,*trans_table; 12 extern int16_t ambient_ramp; 13 13 #define REVERSE_GREEN_TINT 8 14 14 15 extern short shutdown_lighting_value,shutdown_lighting;15 extern int16_t shutdown_lighting_value,shutdown_lighting; 16 16 17 17 class light_source … … 63 63 light_patch *find_patch(int screenx, int screeny, light_patch *list); 64 64 int calc_light_value(int32_t x, int32_t y, light_patch *which); 65 void light_screen(image *sc, int32_t screenx, int32_t screeny, u char *light_lookup, ushort ambient);66 void double_light_screen(image *sc, int32_t screenx, int32_t screeny, u char *light_lookup, ushort ambient,65 void light_screen(image *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient); 66 void double_light_screen(image *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient, 67 67 image *out, int32_t out_x, int32_t out_y); 68 68 -
abuse/trunk/src/include/netface.hpp
r2 r17 96 96 struct net_packet 97 97 { 98 u nsigned chardata[PACKET_MAX_SIZE];98 uint8_t data[PACKET_MAX_SIZE]; 99 99 int packet_prefix_size() { return 5; } // 2 byte size, 2 byte check sum, 1 byte packet order 100 u nsigned short packet_size() { unsigned short size=(*(unsigned short *)data); return lstl(size); }101 u nsigned chartick_received() { return data[4]; }102 void set_tick_received(u nsigned charx) { data[4]=x; }103 u nsigned char*packet_data() { return data+packet_prefix_size(); }104 u nsigned short get_checksum() { unsigned short cs=*((unsigned short *)data+1); return lstl(cs); }105 u nsigned short calc_checksum()100 uint16_t packet_size() { uint16_t size=(*(uint16_t *)data); return lstl(size); } 101 uint8_t tick_received() { return data[4]; } 102 void set_tick_received(uint8_t x) { data[4]=x; } 103 uint8_t *packet_data() { return data+packet_prefix_size(); } 104 uint16_t get_checksum() { uint16_t cs=*((uint16_t *)data+1); return lstl(cs); } 105 uint16_t calc_checksum() 106 106 { 107 *((u nsigned short *)data+1)=0;107 *((uint16_t *)data+1)=0; 108 108 int i,size=packet_prefix_size()+packet_size(); 109 u nsigned charc1=0,c2=0,*p=data;109 uint8_t c1=0,c2=0,*p=data; 110 110 for (i=0;i<size;i++,p++) 111 111 { … … 113 113 c2+=c1; 114 114 } 115 u nsigned short cs=( (((unsigned short)c1)<<8) | c2);116 *((u nsigned short *)data+1)=lstl(cs);115 uint16_t cs=( (((uint16_t)c1)<<8) | c2); 116 *((uint16_t *)data+1)=lstl(cs); 117 117 return cs; 118 118 } … … 129 129 } 130 130 } 131 void write_ byte(unsigned charx) { add_to_packet(&x,1); }132 void write_ short(unsigned short x) { x=lstl(x); add_to_packet(&x,2); }133 void write_ long(unsigned longx) { x=lltl(x); add_to_packet(&x,4); }131 void write_uint8(uint8_t x) { add_to_packet(&x,1); } 132 void write_uint16(uint16_t x) { x=lstl(x); add_to_packet(&x,2); } 133 void write_uint32(uint32_t x) { x=lltl(x); add_to_packet(&x,4); } 134 134 135 void set_packet_size(u nsigned short x) { *((unsigned short *)data)=lstl(x); }135 void set_packet_size(uint16_t x) { *((uint16_t *)data)=lstl(x); } 136 136 137 137 … … 143 143 last_packet; // last tick data (in case a client misses input, we can resend) 144 144 145 short mem_lock;146 short calc_crcs;147 short get_lsf;148 short wait_reload;149 short need_reload;150 short input_state;// COLLECTING or PROCESSING151 short current_tick;// set by engine, used by driver to confirm packet is not left over145 int16_t mem_lock; 146 int16_t calc_crcs; 147 int16_t get_lsf; 148 int16_t wait_reload; 149 int16_t need_reload; 150 int16_t input_state; // COLLECTING or PROCESSING 151 int16_t current_tick; // set by engine, used by driver to confirm packet is not left over 152 152 153 153 join_struct *join_list; -
abuse/trunk/src/include/particle.hpp
r2 r17 17 17 { 18 18 short x,y; 19 u charcolor;19 uint8_t color; 20 20 } ; 21 21 -
abuse/trunk/src/include/transp.hpp
r2 r17 3 3 #include "image.hpp" 4 4 #include "macs.hpp" 5 void transp_put(image *im, image *screen, u char*table, int x, int y);5 void transp_put(image *im, image *screen, uint8_t *table, int x, int y); 6 6 7 7 #endif -
abuse/trunk/src/include/view.hpp
r16 r17 14 14 int32_t cx1,cy1,cx2,cy2,shift_down,shift_right,pan_x,pan_y; 15 15 int32_t new_weapon; 16 u charsend_view,send_weapon_change;16 uint8_t send_view,send_weapon_change; 17 17 } ; 18 18 … … 23 23 class view 24 24 { 25 u charkeymap[512/8];25 uint8_t keymap[512/8]; 26 26 char chat_buf[60]; 27 27 public : … … 80 80 view *next; // next viewable player (singly linked list) 81 81 void get_input(); 82 int process_input(char cmd, u char*&pk);82 int process_input(char cmd, uint8_t *&pk); 83 83 84 84 void add_ammo (int weapon_type, int total); … … 115 115 void recalc_local_view_space(); 116 116 117 void process_packet_commands(u char*pk, int size);117 void process_packet_commands(uint8_t *pk, int size); 118 118 119 119 object_node *make_player_onodes(int player_num=-1); -
abuse/trunk/src/innet.cpp
r4 r17 210 210 211 211 if (!sock) { printf("set_file_server::connect failed\n"); return 0; } 212 u charcmd=CLIENT_CRC_WAITER;212 uint8_t cmd=CLIENT_CRC_WAITER; 213 213 if ( (sock->write(&cmd,1)!=1 && printf("set_file_server::writefailed\n")) || 214 214 (sock->read(&cmd,1)!=1 && printf("set_file_server::read failed\n"))) // wait for confirmation that crc's are written … … 291 291 if (new_sock) 292 292 { 293 u charclient_type;293 uint8_t client_type; 294 294 if (new_sock->read(&client_type,1)!=1) 295 295 { … … 316 316 case CLIENT_LSF_WAITER : // wants to know which .lsp file to start with 317 317 { 318 u charlen=strlen(lsf);318 uint8_t len=strlen(lsf); 319 319 new_sock->write(&len,1); 320 320 new_sock->write(lsf,len); … … 352 352 if (!sock) return 0; 353 353 354 u charctype=CLIENT_LSF_WAITER;355 u charlen;354 uint8_t ctype=CLIENT_LSF_WAITER; 355 uint8_t len; 356 356 357 357 if (sock->write(&ctype,1)!=1 || … … 391 391 } 392 392 393 u charctype=CLIENT_ABUSE;394 u short port=lstl(main_net_cfg->port+1),cnum;395 396 u charreg;393 uint8_t ctype=CLIENT_ABUSE; 394 uint16_t port=lstl(main_net_cfg->port+1),cnum; 395 396 uint8_t reg; 397 397 if (sock->write(&ctype,1)!=1 || // send server out game port 398 398 sock->read(®,1)!=1) // is remote engine registered? … … 427 427 strcpy(uname,get_login()); 428 428 else strcpy(uname,"unknown"); 429 u charlen=strlen(uname)+1;429 uint8_t len=strlen(uname)+1; 430 430 short nkills; 431 431 -
abuse/trunk/src/items.cpp
r2 r17 18 18 } 19 19 20 inside=(u nsigned char*)jmalloc(tot,"Boundary point list");20 inside=(uint8_t *)jmalloc(tot,"Boundary point list"); 21 21 } 22 22 23 u nsigned char*point_on;23 uint8_t *point_on; 24 24 25 25 for (i=0,point_on=data;i<tot-1;i++) … … 34 34 35 35 int j,xp1,yp1,xp2,yp2,maxx,maxy,minx,miny; 36 u nsigned char*point2,segs_left=0,segs_right=0,segs_down=0;36 uint8_t *point2,segs_left=0,segs_right=0,segs_down=0; 37 37 int skip_next=0; 38 38 int check_left=0,check_right=0,check_down=0; … … 101 101 { 102 102 int x1,y1,x2,y2,checkx,checky,i; 103 u nsigned char*point_on;103 uint8_t *point_on; 104 104 if (tot) 105 105 { 106 inside=(u nsigned char*)jmalloc(tot,"Boundary point list");106 inside=(uint8_t *)jmalloc(tot,"Boundary point list"); 107 107 } else inside=NULL; 108 108 for (i=0,point_on=data;i<tot-1;i++) … … 117 117 118 118 int j,xp1,yp1,xp2,yp2,maxx,maxy,minx,miny; 119 u nsigned char*point2,segs_left=0,segs_right=0,segs_down=0;119 uint8_t *point2,segs_left=0,segs_right=0,segs_down=0; 120 120 int skip_next=0; 121 121 int check_left=0,check_right=0,check_down=0; … … 186 186 { 187 187 im=load_image(fp); 188 next=fp->read_ short();188 next=fp->read_uint16(); 189 189 } 190 190 … … 192 192 { 193 193 im=load_image(e,fp); 194 next=fp->read_ short();194 next=fp->read_uint16(); 195 195 } 196 196 197 197 foretile::foretile(bFILE *fp) 198 198 { 199 u nsigned char*sl;199 uint8_t *sl; 200 200 image *img=load_image(fp); 201 201 … … 203 203 // create the micro image of the fore tile by aveginging the color values in 2 x 2 space 204 204 // and storeing teh closest match 205 // u nsigned char *buffer=(unsigned char*)µ_image;205 // uint8_t *buffer=(uint8_t *)µ_image; 206 206 int x,y,w=img->width(),h=img->height(),l; 207 207 int r[AUTOTILE_WIDTH*AUTOTILE_HEIGHT], … … 250 250 delete img; 251 251 252 next=fp->read_ short();252 next=fp->read_uint16(); 253 253 fp->read(&damage,1); 254 254 … … 285 285 point_list p(fp); 286 286 advance=0; 287 } else advance=fp->read_ byte();287 } else advance=fp->read_uint8(); 288 288 289 289 f_damage=new boundary(fp,"fig bound"); … … 296 296 { 297 297 palette *p=new palette(fp); 298 u char *t=data,*p_addr=(uchar*)p->addr();298 uint8_t *t=data,*p_addr=(uint8_t *)p->addr(); 299 299 for (int i=0;i<256;i++,t++,p_addr+=3) 300 300 *t=pal->find_closest(*p_addr,p_addr[1],p_addr[2]); -
abuse/trunk/src/lcache.cpp
r4 r17 48 48 { 49 49 int type=item_type(level); 50 fp->write_ byte(type);50 fp->write_uint8(type); 51 51 52 52 … … 54 54 { 55 55 case L_NUMBER : 56 { fp->write_ long(lnumber_value(level)); } break;56 { fp->write_uint32(lnumber_value(level)); } break; 57 57 case L_CHARACTER : 58 { fp->write_ short(lcharacter_value(level)); } break;58 { fp->write_uint16(lcharacter_value(level)); } break; 59 59 case L_STRING : 60 60 { long l=strlen(lstring_value(level))+1; 61 fp->write_ long(l);61 fp->write_uint32(l); 62 62 fp->write(lstring_value(level),l); 63 63 } break; 64 64 case L_SYMBOL : 65 { fp->write_ long((long)level); } break;65 { fp->write_uint32((long)level); } break; 66 66 case L_CONS_CELL : 67 67 { 68 if (!level) fp->write_ long(0);68 if (!level) fp->write_uint32(0); 69 69 else 70 70 { … … 74 74 if (b) 75 75 { 76 fp->write_ long(-t); // negative number means dotted list76 fp->write_uint32(-t); // negative number means dotted list 77 77 write_level(fp,b); // save end of dotted list 78 78 } 79 else fp->write_ long(t);79 else fp->write_uint32(t); 80 80 81 81 for (b=level;b && item_type(b)==L_CONS_CELL;b=CDR(b)) … … 88 88 Cell *load_block(bFILE *fp) 89 89 { 90 int type=fp->read_ byte();90 int type=fp->read_uint8(); 91 91 switch (type) 92 92 { 93 93 case L_NUMBER : 94 { return new_lisp_number(fp->read_ long()); } break;94 { return new_lisp_number(fp->read_uint32()); } break; 95 95 case L_CHARACTER : 96 { return new_lisp_character(fp->read_ short()); } break;96 { return new_lisp_character(fp->read_uint16()); } break; 97 97 case L_STRING : 98 { long l=fp->read_ long();98 { long l=fp->read_uint32(); 99 99 lisp_string *s=new_lisp_string(l); 100 100 fp->read(lstring_value(s),l); … … 102 102 } break; 103 103 case L_SYMBOL : 104 { return (void *)fp->read_ long(); } break;104 { return (void *)fp->read_uint32(); } break; 105 105 case L_CONS_CELL : 106 106 { 107 long t=fp->read_ long();107 long t=fp->read_uint32(); 108 108 if (!t) return NULL; 109 109 else -
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 &n