Esempio n. 1
0
 public void rot(int ai[], int ai1[], int i, int j, int k, int l) {
   if (k != 0) {
     for (int i1 = 0; i1 < l; i1++) {
       int j1 = ai[i1];
       int k1 = ai1[i1];
       ai[i1] = i + (int) ((float) (j1 - i) * m.cos(k) - (float) (k1 - j) * m.sin(k));
       ai1[i1] = j + (int) ((float) (j1 - i) * m.sin(k) + (float) (k1 - j) * m.cos(k));
     }
   }
 }
Esempio n. 2
0
  public void s(Graphics2D rd, int i, int j, int k, int l, int i1, int j1, int k1) {
    int ai[] = new int[n];
    int ai1[] = new int[n];
    int ai2[] = new int[n];
    for (int l1 = 0; l1 < n; l1++) {
      ai[l1] = ox[l1] + i;
      ai2[l1] = oy[l1] + j;
      ai1[l1] = oz[l1] + k;
    }

    rot(ai, ai2, i, j, i1, n);
    rot(ai2, ai1, j, k, j1, n);
    rot(ai, ai1, i, k, l, n);
    int i2 = (int) ((double) (float) m.cgrnd[0] / 1.5D);
    int j2 = (int) ((double) (float) m.cgrnd[1] / 1.5D);
    int k2 = (int) ((double) (float) m.cgrnd[2] / 1.5D);
    for (int l2 = 0; l2 < n; l2++) {
      ai2[l2] = m.ground;
    }

    if (k1 == 0) {
      int i3 = 0;
      int j3 = 0;
      int k3 = 0;
      int l3 = 0;
      for (int l4 = 0; l4 < n; l4++) {
        int l5 = 0;
        int k6 = 0;
        int j7 = 0;
        int i8 = 0;
        for (int k8 = 0; k8 < n; k8++) {
          if (ai[l4] >= ai[k8]) {
            l5++;
          }
          if (ai[l4] <= ai[k8]) {
            k6++;
          }
          if (ai1[l4] >= ai1[k8]) {
            j7++;
          }
          if (ai1[l4] <= ai1[k8]) {
            i8++;
          }
        }

        if (l5 == n) {
          i3 = ai[l4];
        }
        if (k6 == n) {
          j3 = ai[l4];
        }
        if (j7 == n) {
          k3 = ai1[l4];
        }
        if (i8 == n) {
          l3 = ai1[l4];
        }
      }

      int i5 = (i3 + j3) / 2;
      int i6 = (k3 + l3) / 2;
      for (int l6 = t.nt - 1; l6 >= 0; l6--) {
        int k7 = 0;
        if (Math.abs(t.zy[l6]) != 90
            && Math.abs(t.xy[l6]) != 90
            && Math.abs(i5 - (t.x[l6] - m.x)) < t.radx[l6]
            && Math.abs(i6 - (t.z[l6] - m.z)) < t.radz[l6]) {
          k7++;
        }
        if (k7 == 0) {
          continue;
        }
        for (int j8 = 0; j8 < n; j8++) {
          ai2[j8] = t.y[l6] - m.y;
          if (t.zy[l6] != 0) {
            ai2[j8] +=
                ((float) (ai1[j8] - (t.z[l6] - m.z - t.radz[l6])) * m.sin(t.zy[l6]))
                        / m.sin(90 - t.zy[l6])
                    - ((float) t.radz[l6] * m.sin(t.zy[l6])) / m.sin(90 - t.zy[l6]);
          }
          if (t.xy[l6] != 0) {
            ai2[j8] +=
                ((float) (ai[j8] - (t.x[l6] - m.x - t.radx[l6])) * m.sin(t.xy[l6]))
                        / m.sin(90 - t.xy[l6])
                    - ((float) t.radx[l6] * m.sin(t.xy[l6])) / m.sin(90 - t.xy[l6]);
          }
        }

        i2 = (int) ((double) (float) t.c[l6][0] / 1.5D);
        j2 = (int) ((double) (float) t.c[l6][1] / 1.5D);
        k2 = (int) ((double) (float) t.c[l6][2] / 1.5D);
        break;
      }
    }
    boolean flag = true;
    int ai3[] = new int[n];
    int ai4[] = new int[n];
    if (k1 == 2) {
      i2 = 80;
      j2 = 80;
      k2 = 80;
    } else {
      for (int i4 = 0; i4 < m.nsp; i4++) {
        for (int j5 = 0; j5 < n; j5++) {
          if (Math.abs(ai[j5] - m.spx[i4]) < m.sprad[i4]
              && Math.abs(ai1[j5] - m.spz[i4]) < m.sprad[i4]) {
            flag = false;
          }
        }
      }
    }
    if (flag) {
      rot(ai, ai1, m.cx, m.cz, m.xz, n);
      rot(ai2, ai1, m.cy, m.cz, m.zy, n);
      int j4 = 0;
      int k5 = 0;
      int j6 = 0;
      int i7 = 0;
      for (int l7 = 0; l7 < n; l7++) {
        ai3[l7] = xs(ai[l7], ai1[l7]);
        ai4[l7] = ys(ai2[l7], ai1[l7]);
        if (ai4[l7] < 0 || ai1[l7] < 10) {
          j4++;
        }
        if (ai4[l7] > m.h || ai1[l7] < 10) {
          k5++;
        }
        if (ai3[l7] < 0 || ai1[l7] < 10) {
          j6++;
        }
        if (ai3[l7] > m.w || ai1[l7] < 10) {
          i7++;
        }
      }

      if (j6 == n || j4 == n || k5 == n || i7 == n) {
        flag = false;
      }
    }
    if (flag) {
      int k4 = 0;
      do {
        if (av > m.fade[k4]) {
          i2 = (i2 * m.fogd + m.cfade[0]) / (m.fogd + 1);
          j2 = (j2 * m.fogd + m.cfade[1]) / (m.fogd + 1);
          k2 = (k2 * m.fogd + m.cfade[2]) / (m.fogd + 1);
        }
      } while (++k4 < 8);
      rd.setColor(new Color(i2, j2, k2));
      rd.fillPolygon(ai3, ai4, n);
    }
  }