Difference for socket/request.c from version 1.52 to 1.53


version 1.52 version 1.53
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_init_c =   * static char *rcsid_init_c =
  *    "$Id: request.c,v 1.52 2003/09/13 05:02:14 mwedel Exp $";   *    "$Id: request.c,v 1.53 2003/10/08 07:20:37 mwedel Exp $";
  */   */
   
 /*  /*
Line 307
 
Line 307
   * - Use the animation elements from 0 to 8 for smoothing.    * - Use the animation elements from 0 to 8 for smoothing.
   */    */
 void AskSmooth (char *buf, int len, NewSocket *ns){  void AskSmooth (char *buf, int len, NewSocket *ns){
      char* name;  
      char* defaultsmooth="default_smoothed.111";       char* defaultsmooth="default_smoothed.111";
      char smoothname[MAX_BUF];  
      char reply[MAX_BUF];       char reply[MAX_BUF];
      SockList sl;       SockList sl;
      int i;  
      archetype* at;  
      uint16 smoothface;       uint16 smoothface;
      int facenbr;       int facenbr;
      facenbr=atoi (buf);       facenbr=atoi (buf);
Line 1059
 
Line 1055
  * it was.   * it was.
  * sl is the socklist this data is going into.   * sl is the socklist this data is going into.
  * ns is the socket we are working on - all the info we care   * ns is the socket we are working on - all the info we care
  * about is in this socket structure, so know need to pass the   * about is in this socket structure, so now need not pass the
  * entire player object.   * entire player object.
  * mx and my are map coordinate offsets for map mp   * mx and my are map coordinate offsets for map mp
  * sx and sy are the offsets into the socket structure that   * sx and sy are the offsets into the socket structure that
  * holds the old values.   * holds the old values.
  * layer is the layer to update, with 2 being the floor and 0 the   * layer is the layer to update, with 2 being the floor and 0 the
  * top layer (this matches what the GET_MAP_FACE and GET_MAP_FACE_OBJ   * top layer (this matches what the GET_MAP_FACE and GET_MAP_FACE_OBJ)
  * take.  Interesting to note that before this function, the map1 function   * take.  Interesting to note that before this function, the map1 function
  * numbers the spaces differently - I think this was a leftover from   * numbers the spaces differently - I think this was a leftover from
  * the map command, where the faces stack up.  Sinces that is no longer   * the map command, where the faces stack up.  Sinces that is no longer
Line 1092
 
Line 1088
      * 1) the heads[] values will get used even if the space is not visible.       * 1) the heads[] values will get used even if the space is not visible.
      * 2) its possible the head is not on the same map as a part, and I'd       * 2) its possible the head is not on the same map as a part, and I'd
      *    rather not need to do the map translation overhead.       *    rather not need to do the map translation overhead.
        * 3) We need to do some extra checking to make sure that we will
        * otherwise send the image as this layer, eg, either it matches
        * the head value, or is not multipart.
      */       */
     if (head) {      if (head) {
  for (i=0; i<MAP_LAYERS; i++)   for (i=0; i<MAP_LAYERS; i++) {
      if (GET_MAP_FACE_OBJ(mp, mx, my, i) &&       ob = GET_MAP_FACE_OBJ(mp, mx, my, i);
  GET_MAP_FACE_OBJ(mp, mx, my, i)->face == head->face) {       if (!ob) continue;
   
        if (ob->head) ob=ob->head;
   
        if (ob->face == head->face &&
    (ob == head && !ob->more)) {
      heads[(sy * MAX_HEAD_POS + sx) * MAX_LAYERS + layer] = NULL;       heads[(sy * MAX_HEAD_POS + sx) * MAX_LAYERS + layer] = NULL;
      head = NULL;       head = NULL;
      break;       break;
      }       }
     }      }
       }
   
     ob = head;      ob = head;
     if (!ob) ob = GET_MAP_FACE_OBJ(mp, mx, my, layer);      if (!ob) ob = GET_MAP_FACE_OBJ(mp, mx, my, layer);
Line 1201
 
Line 1206
  }   }
     } /* else not already head object or blank face */      } /* else not already head object or blank face */
   
       /* This is a real hack.  Basically, if we have nothing to send for this layer,
        * but there is a head on the next layer, send that instead.
        * Without this, what happens is you can get the case where the player stands
        * on the same space as the head.  However, if you have overlapping big objects
        * of the same type, what happens then is it doesn't think it needs to send
        * This tends to make stacking also work/look better.
        */
       if (!face_num && layer > 0 && heads[(sy * MAX_HEAD_POS + sx) * MAX_LAYERS + layer -1]) {
    face_num = heads[(sy * MAX_HEAD_POS + sx) * MAX_LAYERS + layer -1]->face->number;
    heads[(sy * MAX_HEAD_POS + sx) * MAX_LAYERS + layer -1] = NULL;
       }
   
       /* Another hack - because of heads and whatnot, this face may match one
        * we already sent for a lower layer.  In that case, don't send
        * this one.
        */
       if (face_num && layer<MAP_LAYERS && ns->lastmap.cells[sx][sy].faces[layer+1] == face_num) {
    face_num = 0;
       }
   
     /* We've gotten what face we want to use for the object.  Now see if      /* We've gotten what face we want to use for the object.  Now see if
      * if it has changed since we last sent it to the client.       * if it has changed since we last sent it to the client.
      */       */
Line 1237
 
Line 1262
 {  {
     object *ob, *head;      object *ob, *head;
     int smoothlevel; /* old face_num;*/      int smoothlevel; /* old face_num;*/
     int bx, by,i;  
   
     /* If there is a multipart object stored away, treat that as more important.      /* If there is a multipart object stored away, treat that as more important.
      * If not, then do the normal processing.       * If not, then do the normal processing.
Line 1371
 
Line 1395
       */        */
      if (ax >= pl->contr->socket.mapx || ay >= pl->contr->socket.mapy) {       if (ax >= pl->contr->socket.mapx || ay >= pl->contr->socket.mapy) {
  oldlen = sl.len;   oldlen = sl.len;
   
         if (pl->contr->socket.ext_mapinfos){          if (pl->contr->socket.ext_mapinfos){
             SockList_AddShort(&esl, emask);              SockList_AddShort(&esl, emask);
         }          }
Line 1479
 
Line 1504
  eoldlen = esl.len;   eoldlen = esl.len;
  emask = (ax & 0x3f) << 10 | (ay & 0x3f) << 4;   emask = (ax & 0x3f) << 10 | (ay & 0x3f) << 4;
  SockList_AddShort(&sl, mask);    SockList_AddShort(&sl, mask);
   
         if (pl->contr->socket.ext_mapinfos)          if (pl->contr->socket.ext_mapinfos)
             SockList_AddShort(&esl, emask);              SockList_AddShort(&esl, emask);
   
Line 1516
 
Line 1542
  /* Middle face */   /* Middle face */
  if (update_space(&sl, &pl->contr->socket, m, nx, ny, ax, ay, 1))   if (update_space(&sl, &pl->contr->socket, m, nx, ny, ax, ay, 1))
      mask |= 0x2;        mask |= 0x2;
   
         if (pl->contr->socket.EMI_smooth)          if (pl->contr->socket.EMI_smooth)
             if (update_smooth(&esl, &pl->contr->socket, m, nx, ny, ax, ay, 1)){              if (update_smooth(&esl, &pl->contr->socket, m, nx, ny, ax, ay, 1)){
                 emask |= 0x2;                  emask |= 0x2;
Line 1730
 
Line 1757
      */       */
     for(x=0; x<mx; x++) {      for(x=0; x<mx; x++) {
  for(y=0; y<my; y++) {   for(y=0; y<my; y++) {
      if ((x+dx) < 0 || x >= ns->mapx || (y+dy) < 0 || y >= ns->mapy) {       if ((x+dx) < 0 || (x+dx) >= ns->mapx || (y+dy) < 0 || (y + dy) >= ns->mapy) {
  memset(&(newmap.cells[x][y]), 0, sizeof(struct MapCell));   memset(&(newmap.cells[x][y]), 0, sizeof(struct MapCell));
      }       }
      else {       else {
Line 1739
 
Line 1766
      }       }
  }   }
     }      }
   
     memcpy(&(ns->lastmap), &newmap,sizeof(struct Map));      memcpy(&(ns->lastmap), &newmap,sizeof(struct Map));
     ns->sent_scroll = 1;      ns->sent_scroll = 1;
 }  }


Legend:
line(s) removed in v.1.52 
line(s) changed
 line(s) added in v.1.53

File made using version 1.98 of cvs2html by leaf at 2011-07-21 19:37