Exemplo n.º 1
0
 private void nmod(boolean nocatch) {
   for (Iterator<MD> i = nmod.iterator(); i.hasNext(); ) {
     MD md = i.next();
     try {
       if (md.real == null) {
         FastMesh.MeshRes mr = md.mod.get().layer(FastMesh.MeshRes.class);
         if (mr == null)
           throw (new Sprite.ResourceException("Model resource contains no mesh", md.mod.get()));
         md.real = new Model(mr.m, md.id);
         /* This is really ugly, but I can't really think of
          * anything less ugly right now. */
         if (md.mod.get().name.equals("gfx/borka/male")
             || md.mod.get().name.equals("gfx/borka/female")) md.real.z = -1;
         this.mod.add(md.real);
       }
       for (Iterator<ResData> o = md.tex.iterator(); o.hasNext(); ) {
         ResData res = o.next();
         md.real.addlay(
             Material.fromres(
                 (eqowner == null) ? null : eqowner.glob(),
                 res.res.get(),
                 new MessageBuf(res.sdt)));
         o.remove();
       }
       i.remove();
     } catch (Loading e) {
       if (nocatch) throw (e);
     }
   }
   if (nmod.isEmpty()) nmod = null;
 }
 /*    */ 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;
   /*    */ }