Changeset 16 for abuse/trunk/src/level.cpp
- Timestamp:
- Nov 10, 2005, 8:08:09 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/src/level.cpp
r2 r16 24 24 #endif 25 25 26 #include <limits.h> 26 27 #include <time.h> 27 28 … … 30 31 game_object *level::attacker(game_object *who) 31 32 { 32 longd=0x7fffffff;33 int32_t d=0x7fffffff; 33 34 game_object *c=NULL; 34 35 view *f=the_game->first_view; … … 37 38 if (f->focus) 38 39 { 39 longtmp_d=abs(f->focus->x-who->x)+abs(f->focus->y-who->y);40 int32_t tmp_d=abs(f->focus->x-who->x)+abs(f->focus->y-who->y); 40 41 if (tmp_d<d) 41 42 { … … 198 199 } 199 200 200 int level::add_actives( long x1, long y1, long x2, longy2)201 int level::add_actives(int32_t x1, int32_t y1, int32_t x2, int32_t y2) 201 202 { 202 203 int t=0; … … 210 211 if (!o->active) 211 212 { 212 longxr=figures[o->otype]->rangex,213 int32_t xr=figures[o->otype]->rangex, 213 214 yr=figures[o->otype]->rangey; 214 215 … … 242 243 243 244 244 int level::add_drawables( long x1, long y1, long x2, longy2)245 int level::add_drawables(int32_t x1, int32_t y1, int32_t x2, int32_t y2) 245 246 { 246 247 int t=0,ft=0; … … 256 257 if (ft || !o->active) 257 258 { 258 longxr=figures[o->otype]->draw_rangex,259 int32_t xr=figures[o->otype]->draw_rangex, 259 260 yr=figures[o->otype]->draw_rangey; 260 261 … … 322 323 void level::wall_push() 323 324 { 324 longsx1,sy1,sx2,sy2,xv,yv;325 int32_t sx1,sy1,sx2,sy2,xv,yv; 325 326 game_object *o=first_active; 326 327 for (;o;o=o->next_active) … … 362 363 if (abs(subject->x-target->x)<b1+b2) 363 364 { 364 longtmove=b1+b2-abs(subject->x-target->x),xv,yv=0,xv2;365 int32_t tmove=b1+b2-abs(subject->x-target->x),xv,yv=0,xv2; 365 366 if (subject->x>target->x) 366 367 xv=tmove/2; … … 382 383 { 383 384 game_object *target,*reciever=NULL; 384 longsx1,sy1,sx2,sy2,tx1,ty1,tx2,ty2,hitx,hity,385 int32_t sx1,sy1,sx2,sy2,tx1,ty1,tx2,ty2,hitx,hity, 385 386 s_centerx,t_centerx; 386 387 … … 416 417 for (t_dat=t_damage->data,j=(int)t_damage->tot-1;j>0 && !hit;j--) 417 418 { 418 longx1,y1,x2,y2, // define the two line segments to check419 int32_t x1,y1,x2,y2, // define the two line segments to check 419 420 xp1,yp1,xp2,yp2; 420 421 … … 459 460 */ 460 461 461 game_object *level::boundary_setback(game_object *subject, long x1, long y1, long &x2, long&y2)462 game_object *level::boundary_setback(game_object *subject, int32_t x1, int32_t y1, int32_t &x2, int32_t &y2) 462 463 { 463 464 game_object *l=NULL; 464 longtx1,ty1,tx2,ty2,t_centerx;465 int32_t tx1,ty1,tx2,ty2,t_centerx; 465 466 game_object *target=first_active; 466 467 game_object **blist=block_list; … … 485 486 while(iter-->0) 486 487 { 487 longxp1=target->x+target->tx(*t_dat); t_dat++;488 longyp1=target->y+target->ty(*t_dat); t_dat++;489 longxp2=target->x+target->tx(*t_dat);490 longyp2=target->y+target->ty(t_dat[1]);488 int32_t xp1=target->x+target->tx(*t_dat); t_dat++; 489 int32_t yp1=target->y+target->ty(*t_dat); t_dat++; 490 int32_t xp2=target->x+target->tx(*t_dat); 491 int32_t yp2=target->y+target->ty(t_dat[1]); 491 492 492 493 // now check to see if (x1,y1-x2,y2) intercest with (xp1,yp1-xp2,yp2) … … 511 512 512 513 513 game_object *level::all_boundary_setback(game_object *subject, long x1, long y1, long &x2, long&y2)514 game_object *level::all_boundary_setback(game_object *subject, int32_t x1, int32_t y1, int32_t &x2, int32_t &y2) 514 515 { 515 516 game_object *l=NULL; 516 longtx1,ty1,tx2,ty2,t_centerx;517 int32_t tx1,ty1,tx2,ty2,t_centerx; 517 518 game_object *target=first_active; 518 519 game_object **blist=all_block_list; … … 537 538 while(iter-->0) 538 539 { 539 longxp1=target->x+target->tx(*t_dat); t_dat++;540 longyp1=target->y+target->ty(*t_dat); t_dat++;541 longxp2=target->x+target->tx(*t_dat);542 longyp2=target->y+target->ty(t_dat[1]);540 int32_t xp1=target->x+target->tx(*t_dat); t_dat++; 541 int32_t yp1=target->y+target->ty(*t_dat); t_dat++; 542 int32_t xp2=target->x+target->tx(*t_dat); 543 int32_t yp2=target->y+target->ty(t_dat[1]); 543 544 544 545 // now check to see if (x1,y1-x2,y2) intercest with (xp1,yp1-xp2,yp2) … … 566 567 void level::interpolate_draw_objects(view *v) 567 568 { 568 longold_x,old_y;569 int32_t old_x,old_y; 569 570 current_view=v; 570 571 … … 607 608 { 608 609 if (!rcheck) rcheck=open_file("rcheck","rb"); 609 longx=rcheck->read_long();610 int32_t x=rcheck->read_long(); 610 611 if (x!=rand_on) 611 612 dprintf("off!\n"); … … 645 646 { 646 647 area_controller *a,*smallest=NULL; 647 long smallest_size=0xfffffff;648 int32_t smallest_size=0xffffffff; 648 649 for (a=area_list;a;a=a->next) 649 650 if (o->x>=a->x && o->y>=a->y && o->x<=a->x+a->w && o->y<=a->y+a->h) 650 651 { 651 longsize=a->w*a->h;652 int32_t size=a->w*a->h; 652 653 if (size<smallest_size) 653 654 { … … 693 694 if (o->otype!=current_start_type) 694 695 { 695 longfmp=o->fmp();696 int32_t fmp=o->fmp(); 696 697 int reduce=figures[o->otype]->morph_power; 697 698 if (reduce) … … 767 768 void level::draw_areas(view *v) 768 769 { 769 longsx1,sy1,sx2,sy2;770 int32_t sx1,sy1,sx2,sy2; 770 771 area_controller *a=area_list; 771 772 for (;a;a=a->next) … … 807 808 } 808 809 809 void calc_bgsize(u nsigned short fgw, unsigned short fgh, unsigned short &bgw, unsigned short &bgh)810 void calc_bgsize(uint16_t fgw, uint16_t fgh, uint16_t &bgw, uint16_t &bgh) 810 811 { 811 812 bgw=fgw/ASPECT+8; … … 822 823 } 823 824 824 u nsigned short *new_fg,*new_bg;825 new_fg=(u nsigned short *)jmalloc(w*h*sizeof(short),"Map fg : resized");826 memset(new_fg,0,w*h*sizeof( short));825 uint16_t *new_fg,*new_bg; 826 new_fg=(uint16_t *)jmalloc(w*h*sizeof(int16_t),"Map fg : resized"); 827 memset(new_fg,0,w*h*sizeof(int16_t)); 827 828 828 829 int x,y,miny=(h<fg_height)? h : fg_height,minx=(w<fg_width)? w : fg_width; 829 830 830 u nsigned short nbw,nbh;831 uint16_t nbw,nbh; 831 832 calc_bgsize(w,h,nbw,nbh); 832 833 833 new_bg=(u nsigned short *)jmalloc((int)nbw*(int)nbh*sizeof(short),"map bg : resized");834 memset(new_bg,0,(int)nbw*(int)nbh*sizeof( short));834 new_bg=(uint16_t *)jmalloc((int)nbw*(int)nbh*sizeof(int16_t),"map bg : resized"); 835 memset(new_bg,0,(int)nbw*(int)nbh*sizeof(int16_t)); 835 836 836 837 for (y=0;y<miny;y++) … … 885 886 fp->seek(se->offset,0); 886 887 /******************************* Read debug info ******************************/ 887 short old_tot=fp->read_short();888 u nsigned short *o_remap=(unsigned short *)jmalloc(old_tot*2,"obj remap array");888 int16_t old_tot=fp->read_short(); 889 uint16_t *o_remap=(uint16_t *)jmalloc(old_tot*2,"obj remap array"); 889 890 char old_name[150]; 890 891 for (i=0;i<old_tot;i++) … … 1017 1018 { 1018 1019 fp->seek(se->offset,0); 1019 short old_tot=fp->read_short();1020 int16_t old_tot=fp->read_short(); 1020 1021 se=sd->find("describe_names"); 1021 1022 if (!se || !old_tot) 1022 1023 return ; 1023 1024 1024 u nsigned short *o_remap=(unsigned short *)jmalloc(old_tot*2,"obj remap array");1025 u nsigned short *o_backmap=(unsigned short *)jmalloc(total_objects*2,"obj remap array");1025 uint16_t *o_remap=(uint16_t *)jmalloc(old_tot*2,"obj remap array"); 1026 uint16_t *o_backmap=(uint16_t *)jmalloc(total_objects*2,"obj remap array"); 1026 1027 memset(o_backmap,0xff,total_objects*2); 1027 1028 char old_name[150]; … … 1041 1042 se=sd->find("describe_states"); 1042 1043 if (!se) { jfree(o_remap); jfree(o_backmap); return ; } 1043 short **s_remap=(short **)jmalloc(old_tot*sizeof(short *),"big state remap array");1044 short *s_remap_totals=(short *)jmalloc(old_tot*sizeof(short),"big state rmp totals");1044 int16_t **s_remap=(int16_t **)jmalloc(old_tot*sizeof(int16_t *),"big state remap array"); 1045 int16_t *s_remap_totals=(int16_t *)jmalloc(old_tot*sizeof(int16_t),"big state rmp totals"); 1045 1046 fp->seek(se->offset,0); 1046 1047 int i=0; 1047 1048 for (;i<old_tot;i++) 1048 1049 { 1049 short t=fp->read_short();1050 int16_t t=fp->read_short(); 1050 1051 s_remap_totals[i]=t; 1051 1052 if (t) 1052 1053 { 1053 s_remap[i]=( short *)jmalloc(t*sizeof(short),"state remap");1054 s_remap[i]=(int16_t *)jmalloc(t*sizeof(int16_t),"state remap"); 1054 1055 int j=0; 1055 1056 for (;j<t;j++) … … 1076 1077 } 1077 1078 1078 short **v_remap=NULL;1079 short *v_remap_totals=NULL;1079 int16_t **v_remap=NULL; 1080 int16_t *v_remap_totals=NULL; 1080 1081 int load_vars=1; 1081 1082 se=sd->find("describe_lvars"); 1082 1083 if (se) 1083 1084 { 1084 v_remap=( short **)jmalloc(old_tot*sizeof(short *),"big var remap array");1085 v_remap_totals=( short *)jmalloc(old_tot*sizeof(short),"big var rmp totals");1085 v_remap=(int16_t **)jmalloc(old_tot*sizeof(int16_t *),"big var remap array"); 1086 v_remap_totals=(int16_t *)jmalloc(old_tot*sizeof(int16_t),"big var rmp totals"); 1086 1087 1087 1088 fp->seek(se->offset,0); … … 1089 1090 for (;i<old_tot;i++) 1090 1091 { 1091 short t=fp->read_short();1092 int16_t t=fp->read_short(); 1092 1093 v_remap_totals[i]=t; 1093 1094 if (t) 1094 1095 { 1095 v_remap[i]=( short *)jmalloc(t*sizeof(short),"var remap");1096 memset(v_remap[i],0xff,t*sizeof( short));1096 v_remap[i]=(int16_t *)jmalloc(t*sizeof(int16_t),"var remap"); 1097 memset(v_remap[i],0xff,t*sizeof(int16_t)); 1097 1098 } else { v_remap[i]=NULL; } 1098 1099 int j=0; … … 1172 1173 for (;o && !abort;o=o->next) 1173 1174 { 1174 short ot=fp->read_short();1175 int16_t ot=fp->read_short(); 1175 1176 int k=0; 1176 1177 for (;k<ot;k++) … … 1179 1180 else 1180 1181 { 1181 longv=fp->read_long();1182 int32_t v=fp->read_long(); 1182 1183 if (o->otype!=0xffff) // non-exstant object 1183 1184 { … … 1309 1310 fg_width=fp->read_long(); 1310 1311 fg_height=fp->read_long(); 1311 map_fg=(u nsigned short *)jmalloc(2*fg_width*fg_height,"Map fg : loaded");1312 map_fg=(uint16_t *)jmalloc(2*fg_width*fg_height,"Map fg : loaded"); 1312 1313 fp->read((char *)map_fg,2*fg_width*fg_height); 1313 1314 int t=fg_width*fg_height; 1314 u nsigned short *map=map_fg;1315 uint16_t *map=map_fg; 1315 1316 while (t) { *map=lstl(*map); map++; t--; } 1316 1317 } else … … 1327 1328 bg_width=fp->read_long(); 1328 1329 bg_height=fp->read_long(); 1329 map_bg=(u nsigned short *)jmalloc(2*bg_width*bg_height,"Map bg : loaded");1330 map_bg=(uint16_t *)jmalloc(2*bg_width*bg_height,"Map bg : loaded"); 1330 1331 fp->read((char *)map_bg,2*bg_width*bg_height); 1331 1332 int t=bg_width*bg_height; 1332 u nsigned short *map=map_bg;1333 uint16_t *map=map_bg; 1333 1334 while (t) { *map=lstl(*map); map++; t--; } 1334 1335 } else … … 1342 1343 fg_width=bg_width; 1343 1344 fg_height=bg_height; 1344 map_fg=(u nsigned short *)jmalloc(2*fg_width*fg_height,"Map fg : loaded");1345 map_fg=(uint16_t *)jmalloc(2*fg_width*fg_height,"Map fg : loaded"); 1345 1346 memset(map_fg,0,2*fg_width*fg_height); 1346 1347 } … … 1350 1351 bg_width=fg_width/8+8; 1351 1352 bg_height=fg_height/8+8; 1352 map_bg=(u nsigned short *)jmalloc(2*bg_width*bg_height,"Map bg : loaded");1353 map_bg=(uint16_t *)jmalloc(2*bg_width*bg_height,"Map bg : loaded"); 1353 1354 memset(map_bg,0,2*bg_width*bg_height); 1354 1355 } … … 1356 1357 1357 1358 /***************** Check map for non exsistant tiles **************************/ 1358 longi,w;1359 u nsigned short *m;1359 int32_t i,w; 1360 uint16_t *m; 1360 1361 spec_entry *load_all=sd->find("player_info"); 1361 1362 for (i=0,w=fg_width*fg_height,m=map_fg;i<w;i++,m++) … … 1569 1570 1570 1571 1571 // how many objects are we goint to save, use a longto specify how many1572 // how many objects are we goint to save, use a int32_t to specify how many 1572 1573 sd.add_by_hand(new spec_entry(SPEC_DATA_ARRAY,"object_list",NULL,4,0)); 1573 1574 1574 longt=0;1575 int32_t t=0; 1575 1576 object_node *o=save_list; 1576 1577 for (;o;o=o->next) … … 1654 1655 void level::write_player_info(bFILE *fp, object_node *save_list) 1655 1656 { 1656 longt=0;1657 int32_t t=0; 1657 1658 view *v=player_list; 1658 1659 for (;v;v=v->next) t++; … … 1725 1726 } 1726 1727 1727 longtotal_players=fp->read_long();1728 int32_t total_players=fp->read_long(); 1728 1729 view *last=NULL; 1729 1730 int i=0; … … 1775 1776 if (fp->read_byte()==RC_L) 1776 1777 { 1777 longm=fp->read_long(); // read how many weapons exsisted when last saved1778 int32_t m=fp->read_long(); // read how many weapons exsisted when last saved 1778 1779 int i; 1779 1780 for (v=player_list;v;v=v->next) … … 1781 1782 for (i=0;i<m;i++) 1782 1783 { 1783 longx=fp->read_long();1784 int32_t x=fp->read_long(); 1784 1785 if (i<total_weapons) 1785 1786 { … … 1794 1795 for (v=player_list;v;v=v->next) 1795 1796 { 1796 memset(v->last_weapons,0xff,total_weapons*sizeof( long));1797 memset(v->weapons,0xff,total_weapons*sizeof( long));1797 memset(v->last_weapons,0xff,total_weapons*sizeof(int32_t)); 1798 memset(v->weapons,0xff,total_weapons*sizeof(int32_t)); 1798 1799 } 1799 1800 } … … 1902 1903 } 1903 1904 1904 longt=0;1905 int32_t t=0; 1905 1906 object_node *o=save_list; 1906 1907 for (;o;o=o->next) t++; … … 1919 1920 for (i=0;i<figures[o->me->otype]->tv;i++) 1920 1921 { 1921 fp->write_byte(RC_L); // for now the only type allowed is long1922 fp->write_byte(RC_L); // for now the only type allowed is int32_t 1922 1923 fp->write_long(o->me->lvars[i]); 1923 1924 } … … 1944 1945 1945 1946 1946 longlevel::total_object_links(object_node *list)1947 { 1948 longtl=0;1947 int32_t level::total_object_links(object_node *list) 1948 { 1949 int32_t tl=0; 1949 1950 for (object_node *o=list;o;o=o->next) 1950 1951 tl+=o->me->total_objects(); … … 1952 1953 } 1953 1954 1954 longlevel::total_light_links(object_node *list)1955 { 1956 longtl=0;1955 int32_t level::total_light_links(object_node *list) 1956 { 1957 int32_t tl=0; 1957 1958 for (object_node *o=list;o;o=o->next) 1958 1959 tl+=o->me->total_lights(); … … 1974 1975 { 1975 1976 fp->write_long(x); 1976 longx=object_to_number_in_list(o->me->get_object(i),save_list);1977 int32_t x=object_to_number_in_list(o->me->get_object(i),save_list); 1977 1978 if (x) 1978 1979 fp->write_long(x); 1979 1980 else // save links to excluded items as negative 1980 fp->write_long(( long)(-(object_to_number_in_list(o->me,exclude_list))));1981 fp->write_long((int32_t)(-(object_to_number_in_list(o->me,exclude_list)))); 1981 1982 } 1982 1983 } … … 2008 2009 if (fp->read_byte()==RC_L) 2009 2010 { 2010 longt=fp->read_long();2011 int32_t t=fp->read_long(); 2011 2012 while (t) 2012 2013 { 2013 longx1=fp->read_long();2014 int32_t x1=fp->read_long(); 2014 2015 CONDITION(x1>=0,"expected x1 for object link to be > 0\n"); 2015 longx2=fp->read_long();2016 int32_t x2=fp->read_long(); 2016 2017 game_object *p,*q=number_to_object_in_list(x1,save_list); 2017 2018 if (x2>0) … … 2033 2034 if (fp->read_byte()==RC_L) 2034 2035 { 2035 longt=fp->read_long();2036 int32_t t=fp->read_long(); 2036 2037 while (t) 2037 2038 { 2038 longx1=fp->read_long();2039 longx2=fp->read_long();2039 int32_t x1=fp->read_long(); 2040 int32_t x2=fp->read_long(); 2040 2041 game_object *p=number_to_object_in_list(x1,save_list); 2041 2042 if (p) … … 2107 2108 { 2108 2109 area_controller *l=NULL,*p; 2109 longta=fp->read_long();2110 int32_t ta=fp->read_long(); 2110 2111 int i=0; 2111 2112 for (;i<ta;i++) 2112 2113 { 2113 longx,y,w,h;2114 int32_t x,y,w,h; 2114 2115 x=fp->read_long(); 2115 2116 y=fp->read_long(); … … 2203 2204 else 2204 2205 { 2205 longsize = fp->file_size();2206 int32_t size = fp->file_size(); 2206 2207 uchar *buf = (uchar *)jmalloc(0x1000,"copy buf"); 2207 2208 int tr = 1; … … 2367 2368 calc_bgsize(fg_width,fg_height,bg_width,bg_height); 2368 2369 2369 map_bg=(u nsigned short *)jmalloc(sizeof(short)*bg_width*bg_height,"map bg");2370 map_fg=(u nsigned short *)jmalloc(sizeof(short)*fg_width*fg_height,"map fg");2371 2372 2373 2374 memset(map_bg,0,sizeof( short)*bg_width*bg_height);2375 memset(map_fg,0,sizeof( short)*fg_width*fg_height);2370 map_bg=(uint16_t *)jmalloc(sizeof(int16_t)*bg_width*bg_height,"map bg"); 2371 map_fg=(uint16_t *)jmalloc(sizeof(int16_t)*fg_width*fg_height,"map fg"); 2372 2373 2374 2375 memset(map_bg,0,sizeof(int16_t)*bg_width*bg_height); 2376 memset(map_fg,0,sizeof(int16_t)*fg_width*fg_height); 2376 2377 2377 2378 int i; … … 2576 2577 } 2577 2578 2578 game_object *level::find_object( long x, longy)2579 { 2580 longx1,y1,x2,y2;2579 game_object *level::find_object(int32_t x, int32_t y) 2580 { 2581 int32_t x1,y1,x2,y2; 2581 2582 game_object *o=first; 2582 2583 for (;o;o=o->next) … … 2589 2590 } 2590 2591 2591 longlast_tile_hit_x,last_tile_hit_y;2592 int32_t last_tile_hit_x,last_tile_hit_y; 2592 2593 2593 2594 #define remapx(x) (x==0 ? -1 : x==tl-1 ? tl+1 : x) 2594 2595 #define remapy(y) (y==0 ? -1 : y==th-1 ? th+1 : y) 2595 2596 2596 void level::foreground_intersect( long x1, long y1, long &x2, long&y2)2597 void level::foreground_intersect(int32_t x1, int32_t y1, int32_t &x2, int32_t &y2) 2597 2598 { 2598 2599 /* if (x1==x2) … … 2601 2602 } */ 2602 2603 2603 longtl=the_game->ftile_width(),th=the_game->ftile_height(),2604 int32_t tl=the_game->ftile_width(),th=the_game->ftile_height(), 2604 2605 j, 2605 2606 xp1,yp1,xp2,yp2, // starting and ending points of block line segment 2606 2607 swap; // temp var 2607 longblockx1,blocky1,blockx2,blocky2,block,bx,by;2608 int32_t blockx1,blocky1,blockx2,blocky2,block,bx,by; 2608 2609 point_list *block_list; 2609 2610 unsigned char *bdat; … … 2642 2643 bdat=block_list->data; 2643 2644 unsigned char *ins=f->points->inside; 2644 longxo=bx*tl,yo=by*th;2645 int32_t xo=bx*tl,yo=by*th; 2645 2646 for (j=0;j<total-1;j++,ins++) 2646 2647 { … … 2656 2657 2657 2658 2658 longox2=x2,oy2=y2;2659 int32_t ox2=x2,oy2=y2; 2659 2660 if (*ins) 2660 2661 setback_intersect(x1,y1,x2,y2,xp1,yp1,xp2,yp2,1); … … 2674 2675 2675 2676 2676 void level::vforeground_intersect( long x1, long y1, long&y2)2677 { 2678 longtl=f_wid,th=f_hi,2677 void level::vforeground_intersect(int32_t x1, int32_t y1, int32_t &y2) 2678 { 2679 int32_t tl=f_wid,th=f_hi, 2679 2680 j, 2680 2681 xp1,yp1,xp2,yp2; // starting and ending points of block line segment temp var 2681 longblocky1,blocky2,block,bx,by,checkx;2682 int32_t blocky1,blocky2,block,bx,by,checkx; 2682 2683 point_list *block_list; 2683 2684 unsigned char *bdat; … … 2717 2718 unsigned char *ins=f->points->inside; 2718 2719 2719 // longxo=bx*tl,yo=by*th;2720 // int32_t xo=bx*tl,yo=by*th; 2720 2721 for (j=0;j<total-1;j++,ins++) 2721 2722 { … … 2731 2732 2732 2733 2733 longoy2=y2;2734 int32_t oy2=y2; 2734 2735 if (*ins) 2735 2736 setback_intersect(checkx,y1,checkx,y2,xp1,yp1,xp2,yp2,1); … … 2748 2749 2749 2750 2750 void level::send_signal( longsignal)2751 void level::send_signal(int32_t signal) 2751 2752 { 2752 2753 if (signal) // signal 0 is never sent! … … 2761 2762 int level::crush(game_object *by_who, int xamount, int yamount) 2762 2763 { 2763 longxv,yv,crushed=0;2764 int32_t xv,yv,crushed=0; 2764 2765 game_object *o=first_active; 2765 2766 for (;o;o=o->next_active) … … 2798 2799 { 2799 2800 int failed=0; 2800 longxv,yv;2801 int32_t xv,yv; 2801 2802 game_object *o=first_active; 2802 2803 for (;o;o=o->next_active) … … 2805 2806 { 2806 2807 // check to see if the platform is going up and will run into us. 2807 longtvx,tvy;2808 int32_t tvx,tvy; 2808 2809 if (yamount<0) 2809 2810 { … … 2848 2849 int level::push_characters(game_object *by_who, int xamount, int yamount) 2849 2850 { 2850 longxv,yv;2851 int32_t xv,yv; 2851 2852 int failed=0; 2852 2853 game_object *o=first_active; … … 2857 2858 xv=-xamount; 2858 2859 yv=-yamount; 2859 longtvx,tvy;2860 int32_t tvx,tvy; 2860 2861 if (xv>0) tvx=xv+1; else if (xv<0) tvx=xv-1; else tvx=0; 2861 2862 if (yv>0) tvy=yv+1; else if (yv<0) tvx=yv-1; else tvy=0; … … 2877 2878 game_object *level::find_xrange(int x, int y, int type, int xd) 2878 2879 { 2879 longfind_ydist=100000;2880 int32_t find_ydist=100000; 2880 2881 game_object *find=NULL; 2881 2882 game_object *o=first_active; … … 2900 2901 game_object *level::find_xclosest(int x, int y, int type, game_object *who) 2901 2902 { 2902 longfind_ydist=100000,find_xdist=0xffffff;2903 int32_t find_ydist=100000,find_xdist=0xffffff; 2903 2904 game_object *find=NULL; 2904 2905 game_object *o=first_active; … … 2930 2931 game_object *level::find_closest(int x, int y, int type, game_object *who) 2931 2932 { 2932 longfind_dist=100000;2933 int32_t find_dist=100000; 2933 2934 game_object *find=NULL; 2934 2935 game_object *o=first_active; … … 2985 2986 } 2986 2987 2987 void level::hurt_radius( long x, long y,long r, longm, game_object *from, game_object *exclude,2988 void level::hurt_radius(int32_t x, int32_t y,int32_t r, int32_t m, game_object *from, game_object *exclude, 2988 2989 int max_push) 2989 2990 { … … 2994 2995 if (o!=exclude && o->hurtable()) 2995 2996 { 2996 longy1=o->y,y2=o->y-o->picture()->height();2997 longcx=abs(o->x-x),cy1=abs(y1-y),d1,d2,cy2=abs(y2-y);2997 int32_t y1=o->y,y2=o->y-o->picture()->height(); 2998 int32_t cx=abs(o->x-x),cy1=abs(y1-y),d1,d2,cy2=abs(y2-y); 2998 2999 if (cx<cy1) 2999 3000 d1=cx+cy1-(cx>>1); … … 3056 3057 if (v!=exclude) 3057 3058 { 3058 longcx=abs(v->x_center()-o->x),cy=abs(v->y_center()-o->y),d;3059 int32_t cx=abs(v->x_center()-o->x),cy=abs(v->y_center()-o->y),d; 3059 3060 if (cx<cy) 3060 3061 d=cx+cy-(cx>>1); … … 3152 3153 3153 3154 3154 game_object *level::find_object_in_area( long x, long y, long x1, long y1, long x2, longy2,3155 game_object *level::find_object_in_area(int32_t x, int32_t y, int32_t x1, int32_t y1, int32_t x2, int32_t y2, 3155 3156 Cell *list, game_object *exclude) 3156 3157 { 3157 3158 game_object *closest=NULL; 3158 longclosest_distance=0xfffffff,distance,xo,yo;3159 int32_t closest_distance=0xfffffff,distance,xo,yo; 3159 3160 game_object *o=first_active; 3160 3161 for (;o;o=o->next_active) 3161 3162 { 3162 longxp1,yp1,xp2,yp2;3163 int32_t xp1,yp1,xp2,yp2; 3163 3164 o->picture_space(xp1,yp1,xp2,yp2); 3164 3165 … … 3188 3189 3189 3190 3190 game_object *level::find_object_in_angle( long x, long y, long start_angle, longend_angle,3191 game_object *level::find_object_in_angle(int32_t x, int32_t y, int32_t start_angle, int32_t end_angle, 3191 3192 void *list, game_object *exclude) 3192 3193 { 3193 3194 game_object *closest=NULL; 3194 longclosest_distance=0xfffffff,distance,xo,yo;3195 int32_t closest_distance=0xfffffff,distance,xo,yo; 3195 3196 game_object *o=first_active; 3196 3197 for (;o;o=o->next_active) 3197 3198 { 3198 longangle=lisp_atan2(o->y-y,o->x-x);3199 int32_t angle=lisp_atan2(o->y-y,o->x-x); 3199 3200 if (((start_angle<=end_angle && (angle>=start_angle && angle<=end_angle)) 3200 3201 || (start_angle>end_angle && (angle>=start_angle || angle<=end_angle))) … … 3250 3251 for (;o;o=o->next) 3251 3252 { 3252 fprintf(fp,"%3d %s %4ld %4ld %4ld %4ld %04d\n",i++,object_names[o->otype], o->x,o->y,3253 o->xvel(),o->yvel(),o->current_frame);3253 fprintf(fp,"%3d %s %4ld %4ld %4ld %4ld %04d\n",i++,object_names[o->otype],(long)o->x,(long)o->y, 3254 (long)o->xvel(),(long)o->yvel(),o->current_frame); 3254 3255 } 3255 3256 fclose(fp); … … 3258 3259 3259 3260 3260 area_controller::area_controller( long X, long Y, long W, longH, area_controller *Next)3261 area_controller::area_controller(int32_t X, int32_t Y, int32_t W, int32_t H, area_controller *Next) 3261 3262 { 3262 3263 x=X; y=Y; w=W; h=H;
Note: See TracChangeset
for help on using the changeset viewer.