home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / program / c / xaes_new / sizing.c < prev    next >
C/C++ Source or Header  |  1994-10-26  |  2KB  |  72 lines

  1. /********************************************************************
  2.  *                                                                1.10*
  3.  *    Sizing fixing and positioning routine                            *
  4.  *                                                                    *
  5.  *    Copyright (C) 1994, Bitgate Software                            *
  6.  *                                                                    *
  7.  *    These routines simply reposition objects that have been fixed    *
  8.  *    by the Extended Object routine.                                    *
  9.  *                                                                    *
  10.  ********************************************************************/
  11.  
  12. #include <stdlib.h>
  13. #include "xaes.h"
  14.  
  15. #ifndef __SIZING__
  16. #define __SIZING__
  17. #endif
  18.  
  19. GLOBAL void position_fix(OBJECT *obj)
  20. {
  21.     int object = 1, objc, parent;
  22.     int i, j;
  23.  
  24.     object = 1;
  25.  
  26.     do {
  27.         object++;
  28.         parent = object;
  29.         if ((obj[parent].ob_state & DRAW3D) && !(obj[parent].ob_state & ALREADYMOD)) {
  30.             for (objc = obj[parent].ob_head; objc>=0 && objc!=parent; objc = obj[objc].ob_next) {
  31.                 if ((obj[parent].ob_state & DRAW3D) && (objc!=1)) {
  32.                     if (!(obj[objc].ob_state & ALREADYMOD)) {
  33.                         EXTINFO *ex = (EXTINFO *) obj[parent].ob_spec.userblk->ub_parm;
  34.  
  35.                         if (ex->te_thickness < 0) {
  36.                             obj[objc].ob_x += (abs(ex->te_thickness));
  37.                             obj[objc].ob_y += (abs(ex->te_thickness));
  38.                             obj[objc].ob_state |= ALREADYMOD;
  39.                         }
  40.                     }
  41.                 }
  42.             }
  43.  
  44.             while(parent >= 0) {
  45.                 objc = parent;
  46.                 parent = -1;
  47.  
  48.                 i = objc;
  49.  
  50.                 do {
  51.                     if ((obj[parent].ob_state & DRAW3D) && (i!=1)) {
  52.                         EXTINFO *ex = (EXTINFO *) obj[parent].ob_spec.userblk->ub_parm;
  53.  
  54.                         if (!(obj[i].ob_state & ALREADYMOD)) {
  55.                             if (ex->te_thickness < 0) {
  56.                                 obj[i].ob_x += (abs(ex->te_thickness));
  57.                                 obj[i].ob_y += (abs(ex->te_thickness));
  58.                                 obj[i].ob_state |= ALREADYMOD;
  59.                             }
  60.                         }
  61.                     }
  62.  
  63.                     if ((j = obj[i].ob_next) >= 0 && obj[j].ob_tail == i) {
  64.                         parent = j;
  65.                         i = obj[j].ob_head;
  66.                     } else
  67.                         i = j;
  68.                 } while(i>=0 && i!=objc);
  69.             }
  70.         }
  71.     } while(!(obj[object].ob_flags & LASTOB));
  72. }