Ignore:
Timestamp:
Nov 10, 2005, 8:08:09 PM (18 years ago)
Author:
Sam Hocevar
Message:
  • shitloads of long -> int32_t changes for 64 bit safety.
File:
1 edited

Legend:

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

    r2 r16  
    2424#endif
    2525
     26#include <limits.h>
    2627#include <time.h>
    2728
     
    3031game_object *level::attacker(game_object *who)
    3132{
    32   long d=0x7fffffff;
     33  int32_t d=0x7fffffff;
    3334  game_object *c=NULL;
    3435  view *f=the_game->first_view;
     
    3738    if (f->focus)
    3839    {
    39       long tmp_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);
    4041      if (tmp_d<d)
    4142      {
     
    198199}
    199200
    200 int level::add_actives(long x1, long y1, long x2, long y2)
     201int level::add_actives(int32_t x1, int32_t y1, int32_t x2, int32_t y2)
    201202{
    202203  int t=0;
     
    210211    if (!o->active)
    211212    {
    212       long xr=figures[o->otype]->rangex,
     213      int32_t xr=figures[o->otype]->rangex,
    213214           yr=figures[o->otype]->rangey;
    214215
     
    242243
    243244
    244 int level::add_drawables(long x1, long y1, long x2, long y2)
     245int level::add_drawables(int32_t x1, int32_t y1, int32_t x2, int32_t y2)
    245246{
    246247  int t=0,ft=0;
     
    256257    if (ft || !o->active)
    257258    {
    258       long xr=figures[o->otype]->draw_rangex,
     259      int32_t xr=figures[o->otype]->draw_rangex,
    259260      yr=figures[o->otype]->draw_rangey;
    260261
     
    322323void level::wall_push()
    323324{
    324   long sx1,sy1,sx2,sy2,xv,yv;
     325  int32_t sx1,sy1,sx2,sy2,xv,yv;
    325326  game_object *o=first_active;
    326327  for (;o;o=o->next_active)
     
    362363    if (abs(subject->x-target->x)<b1+b2)
    363364    {
    364       long tmove=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;
    365366      if (subject->x>target->x)
    366367        xv=tmove/2;
     
    382383{
    383384  game_object *target,*reciever=NULL;
    384   long sx1,sy1,sx2,sy2,tx1,ty1,tx2,ty2,hitx,hity,
     385  int32_t sx1,sy1,sx2,sy2,tx1,ty1,tx2,ty2,hitx,hity,
    385386      s_centerx,t_centerx;
    386387
     
    416417              for (t_dat=t_damage->data,j=(int)t_damage->tot-1;j>0 && !hit;j--)
    417418              {
    418                 long x1,y1,x2,y2,          // define the two line segments to check
     419                int32_t x1,y1,x2,y2,          // define the two line segments to check
    419420                xp1,yp1,xp2,yp2;
    420421
     
    459460*/
    460461
    461 game_object *level::boundary_setback(game_object *subject, long x1, long y1, long &x2, long &y2)
     462game_object *level::boundary_setback(game_object *subject, int32_t x1, int32_t y1, int32_t &x2, int32_t &y2)
    462463{
    463464  game_object *l=NULL;
    464   long tx1,ty1,tx2,ty2,t_centerx;
     465  int32_t tx1,ty1,tx2,ty2,t_centerx;
    465466  game_object *target=first_active;
    466467  game_object **blist=block_list;
     
    485486        while(iter-->0)
    486487        {
    487           long xp1=target->x+target->tx(*t_dat);  t_dat++;           
    488           long yp1=target->y+target->ty(*t_dat);  t_dat++;
    489           long xp2=target->x+target->tx(*t_dat);
    490           long yp2=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]);
    491492
    492493          // now check to see if (x1,y1-x2,y2) intercest with (xp1,yp1-xp2,yp2)
     
    511512
    512513
    513 game_object *level::all_boundary_setback(game_object *subject, long x1, long y1, long &x2, long &y2)
     514game_object *level::all_boundary_setback(game_object *subject, int32_t x1, int32_t y1, int32_t &x2, int32_t &y2)
    514515{
    515516  game_object *l=NULL;
    516   long tx1,ty1,tx2,ty2,t_centerx;
     517  int32_t tx1,ty1,tx2,ty2,t_centerx;
    517518  game_object *target=first_active;
    518519  game_object **blist=all_block_list;
     
    537538        while(iter-->0)
    538539        {
    539           long xp1=target->x+target->tx(*t_dat);  t_dat++;           
    540           long yp1=target->y+target->ty(*t_dat);  t_dat++;
    541           long xp2=target->x+target->tx(*t_dat);
    542           long yp2=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]);
    543544
    544545          // now check to see if (x1,y1-x2,y2) intercest with (xp1,yp1-xp2,yp2)
     
    566567void level::interpolate_draw_objects(view *v)
    567568{
    568   long old_x,old_y;
     569  int32_t old_x,old_y;
    569570  current_view=v;
    570571 
     
    607608  {
    608609    if (!rcheck) rcheck=open_file("rcheck","rb");
    609     long x=rcheck->read_long();
     610    int32_t x=rcheck->read_long();
    610611    if (x!=rand_on)
    611612      dprintf("off!\n");
     
    645646      {     
    646647        area_controller *a,*smallest=NULL;
    647         long smallest_size=0xfffffff;
     648        int32_t smallest_size=0xffffffff;
    648649        for (a=area_list;a;a=a->next)
    649650          if (o->x>=a->x && o->y>=a->y && o->x<=a->x+a->w && o->y<=a->y+a->h)
    650651          {
    651             long size=a->w*a->h;
     652            int32_t size=a->w*a->h;
    652653            if (size<smallest_size)
    653654            {
     
    693694        if (o->otype!=current_start_type)
    694695        {
    695           long fmp=o->fmp();     
     696          int32_t fmp=o->fmp();     
    696697          int reduce=figures[o->otype]->morph_power;
    697698          if (reduce)
     
    767768void level::draw_areas(view *v)
    768769{
    769   long sx1,sy1,sx2,sy2;
     770  int32_t sx1,sy1,sx2,sy2;
    770771  area_controller *a=area_list;
    771772  for (;a;a=a->next)
     
    807808
    808809
    809 void calc_bgsize(unsigned short fgw, unsigned short  fgh, unsigned short  &bgw, unsigned short  &bgh)
     810void calc_bgsize(uint16_t fgw, uint16_t  fgh, uint16_t  &bgw, uint16_t  &bgh)
    810811{
    811812  bgw=fgw/ASPECT+8;
     
    822823  }
    823824
    824   unsigned short *new_fg,*new_bg;
    825   new_fg=(unsigned 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));
    827828
    828829  int x,y,miny=(h<fg_height)? h : fg_height,minx=(w<fg_width)? w : fg_width;
    829830 
    830   unsigned short nbw,nbh;
     831  uint16_t nbw,nbh;
    831832  calc_bgsize(w,h,nbw,nbh);
    832833 
    833   new_bg=(unsigned 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));
    835836
    836837  for (y=0;y<miny;y++)
     
    885886    fp->seek(se->offset,0);
    886887    /******************************* Read debug info ******************************/
    887     short old_tot=fp->read_short(); 
    888     unsigned 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");   
    889890    char old_name[150];     
    890891    for (i=0;i<old_tot;i++)
     
    10171018  {
    10181019    fp->seek(se->offset,0);
    1019     short old_tot=fp->read_short();
     1020    int16_t old_tot=fp->read_short();
    10201021    se=sd->find("describe_names");
    10211022    if (!se || !old_tot)
    10221023      return ;
    10231024
    1024     unsigned short *o_remap=(unsigned short *)jmalloc(old_tot*2,"obj remap array");   
    1025     unsigned 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");   
    10261027    memset(o_backmap,0xff,total_objects*2);
    10271028    char old_name[150];     
     
    10411042    se=sd->find("describe_states");
    10421043    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");
    10451046    fp->seek(se->offset,0);
    10461047    int i=0;
    10471048    for (;i<old_tot;i++)
    10481049    {
    1049       short t=fp->read_short();
     1050      int16_t t=fp->read_short();
    10501051      s_remap_totals[i]=t;
    10511052      if (t)
    10521053      {
    1053         s_remap[i]=(short *)jmalloc(t*sizeof(short),"state remap");
     1054        s_remap[i]=(int16_t *)jmalloc(t*sizeof(int16_t),"state remap");
    10541055        int j=0;
    10551056        for (;j<t;j++)
     
    10761077    }
    10771078
    1078     short **v_remap=NULL;
    1079     short *v_remap_totals=NULL;
     1079    int16_t **v_remap=NULL;
     1080    int16_t *v_remap_totals=NULL;
    10801081    int load_vars=1;
    10811082    se=sd->find("describe_lvars");
    10821083    if (se)
    10831084    {
    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");
    10861087
    10871088      fp->seek(se->offset,0);
     
    10891090      for (;i<old_tot;i++)
    10901091      {
    1091         short t=fp->read_short();
     1092        int16_t t=fp->read_short();
    10921093        v_remap_totals[i]=t;
    10931094        if (t)
    10941095        {
    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));
    10971098        } else { v_remap[i]=NULL; }
    10981099        int j=0;
     
    11721173            for (;o && !abort;o=o->next)
    11731174            {
    1174               short ot=fp->read_short();
     1175              int16_t ot=fp->read_short();
    11751176              int k=0;
    11761177              for (;k<ot;k++)
     
    11791180                else
    11801181                {
    1181                   long v=fp->read_long();
     1182                  int32_t v=fp->read_long();
    11821183                  if (o->otype!=0xffff)     // non-exstant object
    11831184                  {
     
    13091310    fg_width=fp->read_long();
    13101311    fg_height=fp->read_long();
    1311     map_fg=(unsigned short *)jmalloc(2*fg_width*fg_height,"Map fg : loaded");
     1312    map_fg=(uint16_t *)jmalloc(2*fg_width*fg_height,"Map fg : loaded");
    13121313    fp->read((char *)map_fg,2*fg_width*fg_height);
    13131314    int t=fg_width*fg_height;
    1314     unsigned short *map=map_fg;
     1315    uint16_t *map=map_fg;
    13151316    while (t) { *map=lstl(*map); map++; t--; }
    13161317  } else
     
    13271328    bg_width=fp->read_long();
    13281329    bg_height=fp->read_long();
    1329     map_bg=(unsigned short *)jmalloc(2*bg_width*bg_height,"Map bg : loaded");
     1330    map_bg=(uint16_t *)jmalloc(2*bg_width*bg_height,"Map bg : loaded");
    13301331    fp->read((char *)map_bg,2*bg_width*bg_height);
    13311332    int t=bg_width*bg_height;
    1332     unsigned short *map=map_bg;
     1333    uint16_t *map=map_bg;
    13331334    while (t) { *map=lstl(*map); map++; t--; }
    13341335  } else
     
    13421343    fg_width=bg_width;
    13431344    fg_height=bg_height;
    1344     map_fg=(unsigned short *)jmalloc(2*fg_width*fg_height,"Map fg : loaded");
     1345    map_fg=(uint16_t *)jmalloc(2*fg_width*fg_height,"Map fg : loaded");
    13451346    memset(map_fg,0,2*fg_width*fg_height);
    13461347  }
     
    13501351    bg_width=fg_width/8+8;
    13511352    bg_height=fg_height/8+8;
    1352     map_bg=(unsigned short *)jmalloc(2*bg_width*bg_height,"Map bg : loaded");
     1353    map_bg=(uint16_t *)jmalloc(2*bg_width*bg_height,"Map bg : loaded");
    13531354    memset(map_bg,0,2*bg_width*bg_height);
    13541355  }
     
    13561357
    13571358  /***************** Check map for non exsistant tiles **************************/
    1358   long i,w;
    1359   unsigned short *m; 
     1359  int32_t i,w;
     1360  uint16_t *m; 
    13601361  spec_entry *load_all=sd->find("player_info");
    13611362  for (i=0,w=fg_width*fg_height,m=map_fg;i<w;i++,m++)
     
    15691570 
    15701571
    1571   // how many objects are we goint to save, use a long to specify how many
     1572  // how many objects are we goint to save, use a int32_t to specify how many
    15721573  sd.add_by_hand(new spec_entry(SPEC_DATA_ARRAY,"object_list",NULL,4,0));
    15731574 
    1574   long t=0;
     1575  int32_t t=0;
    15751576  object_node *o=save_list;
    15761577  for (;o;o=o->next)
     
    16541655void level::write_player_info(bFILE *fp, object_node *save_list)
    16551656{
    1656   long t=0;
     1657  int32_t t=0;
    16571658  view *v=player_list;
    16581659  for (;v;v=v->next) t++;
     
    17251726    }
    17261727
    1727     long total_players=fp->read_long();
     1728    int32_t total_players=fp->read_long();
    17281729    view *last=NULL;
    17291730    int i=0;
     
    17751776      if (fp->read_byte()==RC_L)
    17761777      {
    1777         long m=fp->read_long();  // read how many weapons exsisted when last saved
     1778        int32_t m=fp->read_long();  // read how many weapons exsisted when last saved
    17781779        int i;
    17791780        for (v=player_list;v;v=v->next)   
     
    17811782          for (i=0;i<m;i++)
    17821783          {
    1783             long x=fp->read_long();
     1784            int32_t x=fp->read_long();
    17841785            if (i<total_weapons)
    17851786            {
     
    17941795      for (v=player_list;v;v=v->next)     
    17951796      {
    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));
    17981799      }
    17991800    }
     
    19021903  }
    19031904 
    1904   long t=0;
     1905  int32_t t=0;
    19051906  object_node *o=save_list;
    19061907  for (;o;o=o->next) t++;
     
    19191920    for (i=0;i<figures[o->me->otype]->tv;i++)
    19201921    {
    1921       fp->write_byte(RC_L);                           // for now the only type allowed is long
     1922      fp->write_byte(RC_L);                           // for now the only type allowed is int32_t
    19221923      fp->write_long(o->me->lvars[i]);
    19231924    }
     
    19441945
    19451946
    1946 long level::total_object_links(object_node *list)
    1947 {
    1948   long tl=0;
     1947int32_t level::total_object_links(object_node *list)
     1948{
     1949  int32_t tl=0;
    19491950  for (object_node *o=list;o;o=o->next)
    19501951    tl+=o->me->total_objects();
     
    19521953}
    19531954
    1954 long level::total_light_links(object_node *list)
    1955 {
    1956   long tl=0;
     1955int32_t level::total_light_links(object_node *list)
     1956{
     1957  int32_t tl=0;
    19571958  for (object_node *o=list;o;o=o->next)
    19581959    tl+=o->me->total_lights();
     
    19741975    {
    19751976      fp->write_long(x);
    1976       long x=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);
    19771978      if (x)
    19781979        fp->write_long(x);
    19791980      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))));
    19811982    }
    19821983  }
     
    20082009    if (fp->read_byte()==RC_L)
    20092010    {
    2010       long t=fp->read_long();
     2011      int32_t t=fp->read_long();
    20112012      while (t)
    20122013      {
    2013         long x1=fp->read_long();
     2014        int32_t x1=fp->read_long();
    20142015        CONDITION(x1>=0,"expected x1 for object link to be > 0\n");
    2015         long x2=fp->read_long();
     2016        int32_t x2=fp->read_long();
    20162017        game_object *p,*q=number_to_object_in_list(x1,save_list);
    20172018        if (x2>0)
     
    20332034    if (fp->read_byte()==RC_L)
    20342035    {
    2035       long t=fp->read_long();
     2036      int32_t t=fp->read_long();
    20362037      while (t)
    20372038      {
    2038         long x1=fp->read_long();
    2039         long x2=fp->read_long();
     2039        int32_t x1=fp->read_long();
     2040        int32_t x2=fp->read_long();
    20402041        game_object *p=number_to_object_in_list(x1,save_list);
    20412042        if (p)
     
    21072108    {
    21082109      area_controller *l=NULL,*p;
    2109       long ta=fp->read_long();
     2110      int32_t ta=fp->read_long();
    21102111      int i=0;
    21112112      for (;i<ta;i++)
    21122113      {
    2113         long x,y,w,h;
     2114        int32_t x,y,w,h;
    21142115        x=fp->read_long();
    21152116        y=fp->read_long();
     
    22032204                        else
    22042205                        {
    2205                                 long size = fp->file_size();
     2206                                int32_t size = fp->file_size();
    22062207                                uchar *buf = (uchar *)jmalloc(0x1000,"copy buf");
    22072208                                int tr = 1;
     
    23672368  calc_bgsize(fg_width,fg_height,bg_width,bg_height);
    23682369 
    2369   map_bg=(unsigned short *)jmalloc(sizeof(short)*bg_width*bg_height,"map bg");
    2370   map_fg=(unsigned 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);
    23762377
    23772378  int i; 
     
    25762577}
    25772578
    2578 game_object *level::find_object(long x, long y)
    2579 {
    2580   long x1,y1,x2,y2; 
     2579game_object *level::find_object(int32_t x, int32_t y)
     2580{
     2581  int32_t x1,y1,x2,y2; 
    25812582  game_object *o=first;
    25822583  for (;o;o=o->next)
     
    25892590}
    25902591
    2591 long last_tile_hit_x,last_tile_hit_y;
     2592int32_t last_tile_hit_x,last_tile_hit_y;
    25922593
    25932594#define remapx(x) (x==0 ? -1 : x==tl-1 ? tl+1 : x)
    25942595#define remapy(y) (y==0 ? -1 : y==th-1 ? th+1 : y)
    25952596
    2596 void level::foreground_intersect(long x1, long y1, long &x2, long &y2)
     2597void level::foreground_intersect(int32_t x1, int32_t y1, int32_t &x2, int32_t &y2)
    25972598{
    25982599/*  if (x1==x2)
     
    26012602  }  */
    26022603
    2603   long tl=the_game->ftile_width(),th=the_game->ftile_height(),
     2604  int32_t tl=the_game->ftile_width(),th=the_game->ftile_height(),
    26042605    j,
    26052606    xp1,yp1,xp2,yp2,    // starting and ending points of block line segment
    26062607    swap;               // temp var
    2607   long blockx1,blocky1,blockx2,blocky2,block,bx,by;
     2608  int32_t blockx1,blocky1,blockx2,blocky2,block,bx,by;
    26082609  point_list *block_list;
    26092610  unsigned char *bdat;
     
    26422643        bdat=block_list->data;
    26432644        unsigned char *ins=f->points->inside;
    2644         long xo=bx*tl,yo=by*th;
     2645        int32_t xo=bx*tl,yo=by*th;
    26452646        for (j=0;j<total-1;j++,ins++)
    26462647        {
     
    26562657
    26572658
    2658           long ox2=x2,oy2=y2;
     2659          int32_t ox2=x2,oy2=y2;
    26592660          if (*ins)       
    26602661            setback_intersect(x1,y1,x2,y2,xp1,yp1,xp2,yp2,1);
     
    26742675
    26752676
    2676 void level::vforeground_intersect(long x1, long y1, long &y2)
    2677 {
    2678   long tl=f_wid,th=f_hi,
     2677void level::vforeground_intersect(int32_t x1, int32_t y1, int32_t &y2)
     2678{
     2679  int32_t tl=f_wid,th=f_hi,
    26792680    j,
    26802681    xp1,yp1,xp2,yp2;    // starting and ending points of block line segment temp var
    2681   long blocky1,blocky2,block,bx,by,checkx;
     2682  int32_t blocky1,blocky2,block,bx,by,checkx;
    26822683  point_list *block_list;
    26832684  unsigned char *bdat;
     
    27172718    unsigned char *ins=f->points->inside;
    27182719
    2719 //    long xo=bx*tl,yo=by*th;
     2720//    int32_t xo=bx*tl,yo=by*th;
    27202721    for (j=0;j<total-1;j++,ins++)
    27212722    {
     
    27312732
    27322733
    2733       long oy2=y2;
     2734      int32_t oy2=y2;
    27342735      if (*ins)   
    27352736        setback_intersect(checkx,y1,checkx,y2,xp1,yp1,xp2,yp2,1);
     
    27482749
    27492750
    2750 void level::send_signal(long signal)
     2751void level::send_signal(int32_t signal)
    27512752{
    27522753  if (signal)   // signal 0 is never sent!
     
    27612762int level::crush(game_object *by_who, int xamount, int yamount)
    27622763{
    2763   long xv,yv,crushed=0; 
     2764  int32_t xv,yv,crushed=0; 
    27642765  game_object *o=first_active;
    27652766  for (;o;o=o->next_active)
     
    27982799{
    27992800  int failed=0;
    2800   long xv,yv;
     2801  int32_t xv,yv;
    28012802  game_object *o=first_active;
    28022803  for (;o;o=o->next_active) 
     
    28052806    {     
    28062807      // check to see if the platform is going up and will run into us.     
    2807       long tvx,tvy;
     2808      int32_t tvx,tvy;
    28082809      if (yamount<0)
    28092810      {
     
    28482849int level::push_characters(game_object *by_who, int xamount, int yamount)
    28492850{
    2850   long xv,yv;
     2851  int32_t xv,yv;
    28512852  int failed=0;
    28522853  game_object *o=first_active;
     
    28572858      xv=-xamount;   
    28582859      yv=-yamount;
    2859       long tvx,tvy;
     2860      int32_t tvx,tvy;
    28602861      if (xv>0) tvx=xv+1; else if (xv<0) tvx=xv-1; else tvx=0;
    28612862      if (yv>0) tvy=yv+1; else if (yv<0) tvx=yv-1; else tvy=0;
     
    28772878game_object *level::find_xrange(int x, int y, int type, int xd)
    28782879{
    2879   long find_ydist=100000;
     2880  int32_t find_ydist=100000;
    28802881  game_object *find=NULL;
    28812882  game_object *o=first_active;
     
    29002901game_object *level::find_xclosest(int x, int y, int type, game_object *who)
    29012902{
    2902   long find_ydist=100000,find_xdist=0xffffff;
     2903  int32_t find_ydist=100000,find_xdist=0xffffff;
    29032904  game_object *find=NULL;
    29042905  game_object *o=first_active;
     
    29302931game_object *level::find_closest(int x, int y, int type, game_object *who)
    29312932{
    2932   long find_dist=100000;
     2933  int32_t find_dist=100000;
    29332934  game_object *find=NULL;
    29342935  game_object *o=first_active;
     
    29852986}
    29862987
    2987 void level::hurt_radius(long x, long y,long r, long m, game_object *from, game_object *exclude,
     2988void level::hurt_radius(int32_t x, int32_t y,int32_t r, int32_t m, game_object *from, game_object *exclude,
    29882989                        int max_push)
    29892990{
     
    29942995    if (o!=exclude && o->hurtable())
    29952996    {
    2996       long y1=o->y,y2=o->y-o->picture()->height();
    2997       long cx=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);
    29982999      if (cx<cy1)
    29993000        d1=cx+cy1-(cx>>1);
     
    30563057      if (v!=exclude)
    30573058      {
    3058         long cx=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;
    30593060        if (cx<cy)
    30603061          d=cx+cy-(cx>>1);
     
    31523153
    31533154
    3154 game_object *level::find_object_in_area(long x, long y, long x1, long y1, long x2, long y2,
     3155game_object *level::find_object_in_area(int32_t x, int32_t y, int32_t x1, int32_t y1, int32_t x2, int32_t y2,
    31553156                                     Cell *list, game_object *exclude)
    31563157{
    31573158  game_object *closest=NULL;
    3158   long closest_distance=0xfffffff,distance,xo,yo;
     3159  int32_t closest_distance=0xfffffff,distance,xo,yo;
    31593160  game_object *o=first_active;
    31603161  for (;o;o=o->next_active)
    31613162  {
    3162     long xp1,yp1,xp2,yp2;
     3163    int32_t xp1,yp1,xp2,yp2;
    31633164    o->picture_space(xp1,yp1,xp2,yp2);
    31643165
     
    31883189
    31893190
    3190 game_object *level::find_object_in_angle(long x, long y, long start_angle, long end_angle,
     3191game_object *level::find_object_in_angle(int32_t x, int32_t y, int32_t start_angle, int32_t end_angle,
    31913192                                    void *list, game_object *exclude)
    31923193{
    31933194  game_object *closest=NULL;
    3194   long closest_distance=0xfffffff,distance,xo,yo;
     3195  int32_t closest_distance=0xfffffff,distance,xo,yo;
    31953196  game_object *o=first_active;
    31963197  for (;o;o=o->next_active)
    31973198  {
    3198     long angle=lisp_atan2(o->y-y,o->x-x);
     3199    int32_t angle=lisp_atan2(o->y-y,o->x-x);
    31993200    if (((start_angle<=end_angle && (angle>=start_angle && angle<=end_angle))
    32003201        || (start_angle>end_angle && (angle>=start_angle || angle<=end_angle)))
     
    32503251    for (;o;o=o->next)
    32513252    {
    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);
    32543255    }
    32553256    fclose(fp);
     
    32583259
    32593260
    3260 area_controller::area_controller(long X, long Y, long W, long H, area_controller *Next)
     3261area_controller::area_controller(int32_t X, int32_t Y, int32_t W, int32_t H, area_controller *Next)
    32613262{
    32623263  x=X; y=Y; w=W; h=H;
Note: See TracChangeset for help on using the changeset viewer.