| 148 | 
  | 
        MESH *mp | 
| 149 | 
  | 
) | 
| 150 | 
  | 
{ | 
| 151 | 
+ | 
        int             advance = 1; | 
| 152 | 
  | 
        int             pn; | 
| 153 | 
  | 
        MESHPATCH       *pp; | 
| 154 | 
  | 
 | 
| 155 | 
  | 
        if (*tip == OVOID) {                    /* check for first index */ | 
| 156 | 
  | 
                *tip = 0; | 
| 157 | 
< | 
                return(mp->npatches > 0);       /* assumes 1 local triangle */ | 
| 157 | 
> | 
                advance = 0; | 
| 158 | 
  | 
        } | 
| 159 | 
  | 
        pn = *tip >> 10; | 
| 160 | 
< | 
        if (pn >= mp->npatches)                 /* past end? */ | 
| 161 | 
< | 
                return(0); | 
| 162 | 
< | 
        pp = &mp->patch[pn]; | 
| 163 | 
< | 
        if (!(*tip & 0x200)) {                  /* local triangle? */ | 
| 164 | 
< | 
                if ((*tip & 0x1ff) < pp->ntris-1) { | 
| 165 | 
< | 
                        ++*tip; | 
| 166 | 
< | 
                        return(1); | 
| 160 | 
> | 
        while (pn < mp->npatches) { | 
| 161 | 
> | 
                pp = &mp->patch[pn]; | 
| 162 | 
> | 
                if (!(*tip & 0x200)) {          /* local triangle? */ | 
| 163 | 
> | 
                        if ((*tip & 0x1ff) < pp->ntris - advance) { | 
| 164 | 
> | 
                                *tip += advance; | 
| 165 | 
> | 
                                return(1); | 
| 166 | 
> | 
                        } | 
| 167 | 
> | 
                        *tip &= ~0x1ff;         /* move on to single-joiners */ | 
| 168 | 
> | 
                        *tip |= 0x200; | 
| 169 | 
> | 
                        advance = 0; | 
| 170 | 
  | 
                } | 
| 171 | 
< | 
                *tip &= ~0x1ff;                 /* move on to single-joiners */ | 
| 172 | 
< | 
                *tip |= 0x200; | 
| 173 | 
< | 
                if (pp->nj1tris)                /* is there at least one? */ | 
| 174 | 
< | 
                        return(1); | 
| 175 | 
< | 
        } | 
| 176 | 
< | 
        if (!(*tip & 0x100)) {                  /* single joiner? */ | 
| 177 | 
< | 
                if ((*tip & 0xff) < pp->nj1tris-1) { | 
| 178 | 
< | 
                        ++*tip; | 
| 175 | 
< | 
                        return(1); | 
| 171 | 
> | 
                if (!(*tip & 0x100)) {          /* single joiner? */ | 
| 172 | 
> | 
                        if ((*tip & 0xff) < pp->nj1tris - advance) { | 
| 173 | 
> | 
                                *tip += advance; | 
| 174 | 
> | 
                                return(1); | 
| 175 | 
> | 
                        } | 
| 176 | 
> | 
                        *tip &= ~0xff;          /* move on to double-joiners */ | 
| 177 | 
> | 
                        *tip |= 0x100; | 
| 178 | 
> | 
                        advance = 0; | 
| 179 | 
  | 
                } | 
| 180 | 
< | 
                *tip &= ~0xff;                  /* move on to double-joiners */ | 
| 181 | 
< | 
                *tip |= 0x100; | 
| 179 | 
< | 
                if (pp->nj2tris)                /* is there one? */ | 
| 180 | 
> | 
                if ((*tip & 0xff) < pp->nj2tris - advance) { | 
| 181 | 
> | 
                        *tip += advance; | 
| 182 | 
  | 
                        return(1); | 
| 183 | 
+ | 
                } | 
| 184 | 
+ | 
                *tip = ++pn << 10;              /* first in next patch */ | 
| 185 | 
+ | 
                advance = 0; | 
| 186 | 
  | 
        } | 
| 187 | 
< | 
        if ((*tip & 0xff) < pp->nj2tris-1) {    /* double-joiner? */ | 
| 183 | 
< | 
                ++*tip; | 
| 184 | 
< | 
                return(1); | 
| 185 | 
< | 
        } | 
| 186 | 
< | 
        *tip = ++pn << 10;                      /* first in next patch */ | 
| 187 | 
< | 
        return(pn < mp->npatches); | 
| 187 | 
> | 
        return(0);                              /* out of patches */ | 
| 188 | 
  | 
} | 
| 189 | 
  | 
 | 
| 190 | 
  | 
int |