[CF-Devel] synchronizing multipart animation

crossfire-devel-admin at archives.real-time.com crossfire-devel-admin at archives.real-time.com
Mon May 26 02:32:49 CDT 2003


  I put the below change into CVS.


Andreas Vogl wrote:
>
     
      There is an age-old bug in the Crossfire server which causes
     
     >
     
      multi-part animations to ge out of sunchronization.
     
     >
     
      I have noticed that it happens a lot more often nowadays,
     
     >
     
      to the point where it really gets annoying.
     
     >
     
      I manage to reproduce it reliably when I enter scorn zoo
     
     >
     
      (downstairs) repeadedly and run around there. 
     
     >
     
     
     >
     
      I have no idea what is really causing the sync error,
     
     >
     
      but the root problems is obvious: Multi part animations
     
     >
     
      start in the same state, but they don't run synchronized.
     
     >
     
     
     >
     
      I've written a trivial change which makes all multi-tails
     
     >
     
      copy the animation state from their head, instead of
     
     >
     
      running their own animation cycles.
     
     >
     
      I've tested it and have never again seen multi-parts getting
     
     >
     
      out of synchronization.
     
     >
     
     
     >
     
     
     >
     
      AndreasV
     
     >
     
     
     >
     
      Below is the new, modified code from the animate_object()
     
     >
     
      function of "common/anim.c":
     
     >
     
     
     >
     
     
     >
     
      void animate_object(object *op, int dir) {
     
     >
     
          int max_state;  /* Max animation state object should be drawn in */
     
     >
     
          int base_state; /* starting index # to draw from */
     
     >
     
     
     >
     
          if(!op->animation_id || !NUM_ANIMATIONS(op)) {
     
     >
     
      	LOG(llevError,"Object lacks animation.\n");
     
     >
     
      	dump_object(op);
     
     >
     
      	return;
     
     >
     
          }
     
     >
     
     
     >
     
          if (op->head && op->head != op) {
     
     >
     
              /* all multi-tail parts run synchronized with their head */
     
     >
     
              dir = op->head->direction;
     
     >
     
     
     >
     
              if (NUM_ANIMATIONS(op) == NUM_ANIMATIONS(op->head))
     
     >
     
                  op->state = op->head->state;
     
     >
     
              else
     
     >
     
                  ++op->state;
     
     >
     
          }
     
     >
     
          else {
     
     >
     
              ++op->state;    /* increase draw state */
     
     >
     
          }
     
     >
     
     
     >
     
          /* If object is turning, then max animation state is half through the
     
     >
     
           * animations.  Otherwise, we can use all the animations.
     
     >
     
           */
     
     >
     
          max_state=NUM_ANIMATIONS(op)/ NUM_FACINGS(op);
     
     >
     
          base_state=0;
     
     >
     
          ...
     
     >
     
          ...
     
     >
     
          [rest of the funtion stay the same]
     
     >
     
     
     >
     
     
     >
     
     
     


_______________________________________________
crossfire-devel mailing list
     
     crossfire-devel at lists.real-time.com
     
     
     https://mailman.real-time.com/mailman/listinfo/crossfire-devel
     
     
    


More information about the crossfire mailing list