/*    */ public Sprite create(Sprite.Owner owner, Resource res, Message sdt) {
   /* 61 */ int m = sdt.uint8();
   /* 62 */ GrowingPlant spr = new GrowingPlant(owner, res);
   /* 63 */ spr.addnegative();
   /* 64 */ Random rnd = owner.mkrandoom();
   /* 65 */ for (int i = 0; i < this.num; i++) {
     /* 66 */ Coord c =
         new Coord(rnd.nextInt(this.neg.bs.x), rnd.nextInt(this.neg.bs.y)).add(this.neg.bc);
     /* 67 */ Tex s = this.strands[m][rnd.nextInt(this.strands[m].length)];
     /* 68 */ spr.add(s, 0, MapView.m2s(c), new Coord(s.sz().x / 2, s.sz().y).inv());
     /*    */ }
   /* 70 */ return spr;
   /*    */ }
 public Sprite create(Owner owner, Resource res, Message sdt) {
   int m = sdt.uint8();
   GrowingPlant spr = new GrowingPlant(owner, res);
   spr.addnegative();
   Random rnd = owner.mkrandoom();
   int n = Config.simple_plants ? 1 : num;
   for (int i = 0; i < n; i++) {
     Coord c;
     if (Config.simple_plants) {
       c = neg.bc.add(neg.bs).sub(5, 5);
     } else {
       c = new Coord(rnd.nextInt(neg.bs.x), rnd.nextInt(neg.bs.y)).add(neg.bc);
     }
     Tex s = strands[m][rnd.nextInt(strands[m].length)];
     spr.add(s, 0, MapView.m2s(c), new Coord(s.sz().x / 2, s.sz().y).inv());
   }
   return (spr);
 }
Esempio n. 3
0
  /* XXX: Some strange javac bug seems to make it resolve the
   * trans() references to the wrong signature, thus the name
   * distinction. */
  public void _faces(
      MapMesh m, Tile t, int z, Surface.Vertex[] v, float[] tcx, float[] tcy, int[] f) {
    Tex tex = t.tex();
    float tl = tex.tcx(0),
        tt = tex.tcy(0),
        tw = tex.tcx(tex.sz().x) - tl,
        th = tex.tcy(tex.sz().y) - tt;
    GLState st = stfor(tex, z, t.t != 'g');
    MeshBuf buf = MapMesh.Model.get(m, st);

    MeshBuf.Tex btex = buf.layer(MeshBuf.tex);
    MeshVertex[] mv = new MeshVertex[v.length];
    for (int i = 0; i < v.length; i++) {
      mv[i] = new MeshVertex(buf, v[i]);
      btex.set(mv[i], new Coord3f(tl + (tw * tcx[i]), tt + (th * tcy[i]), 0));
    }
    for (int i = 0; i < f.length; i += 3) buf.new Face(mv[f[i]], mv[f[i + 1]], mv[f[i + 2]]);
  }