Package starlight.taliis.core.files

Examples of starlight.taliis.core.files.adt


    openedFile of = fm.getActiveFile();
   
    if(of==null || !(of.obj instanceof adt)) return;
   
    // get data
    adt obj = (adt)of.obj;
   
    waterHeightDialog a=new waterHeightDialog(null);
    float height=a.heightval;
    for(int i=0;i<256;i++){
      if(!obj.mcnk[i].mclq.isempty){
View Full Code Here


    mReplace.add(miFixLines);
  }

// action listener
  public void actionPerformed(ActionEvent e) {
    adt obj;
    openedFile os = fm.getActiveFile();

    if(os.obj instanceof adt) {
      obj = (adt)os.obj; 
    }
    else return;
 
    // kill all waters
    if(e.getSource()==miKillWater) {
      if(obj.getVersion()==adt.ADT_VERSION_NORMAL
         || obj.getVersion()==adt.ADT_VERSION_EXPANSION_TBC) {
       
        for(int c=0; c<256; c++) {
          obj.mcnk[c].mclq = new MCLQ();
          obj.mcnk[c].setFlags(obj.mcnk[c].getFlags() & 0x3);
        }
      } 
      else {
        System.err.println("ADT Version is not suported jet.");
      }
    }
    // kill all shadows
    else if(e.getSource()==miKillShadows) {
      if(obj.getVersion()==adt.ADT_VERSION_NORMAL
         || obj.getVersion()==adt.ADT_VERSION_EXPANSION_TBC) {
         
        for(int c=0; c<256; c++) {
          obj.mcnk[c].mcsh= new MCSH();
        }
      } 
      else {
        System.err.println("ADT Version is not suported jet.");
      }
    }
   
   
    else if(e.getSource()==miInjectAlpha) {
      Vector<openedFile> choices = fm.getFileList();
      openedFile result = (openedFile) JOptionPane.showInputDialog(
        miInjectAlpha.getComponent(),
                "Chose a Source File:\n",
                "Inject",
                JOptionPane.PLAIN_MESSAGE,
                null,
                choices.toArray(),
                null);
     
      if(result==null) return;
      if(result.obj instanceof adt) {
        adt injObj = (adt) result.obj;
        obj.mtex=injObj.mtex;
        for(int c=0; c<256; c++) {
          obj.mcnk[c].setNLayers(injObj.mcnk[c].getNLayers());
          obj.mcnk[c].mcal=injObj.mcnk[c].mcal;
          obj.mcnk[c].mcly=injObj.mcnk[c].mcly;
        }   
      }
    }
   
   
    else if(e.getSource()==miInjectDoodads) {
      Vector<openedFile> choices = fm.getFileList();
      openedFile result = (openedFile) JOptionPane.showInputDialog(
        miInject.getComponent(),
                "Chose a Source File:\n",
                "Inject",
                JOptionPane.PLAIN_MESSAGE,
                null,
                choices.toArray(),
                null);
     
      if(result==null) return;
      float xpos,ypos,oldy,oldx;
      //get new position
      ypos=533.33f*Integer.parseInt(os.f.getAbsolutePath().substring(os.f.getAbsolutePath().length()-6, os.f.getAbsolutePath().length()-4));
      xpos=533.33f*Integer.parseInt(os.f.getAbsolutePath().substring(os.f.getAbsolutePath().length()-9, os.f.getAbsolutePath().length()-7));
      //get old position
      oldy=533.33f*Integer.parseInt(result.f.getAbsolutePath().substring(result.f.getAbsolutePath().length()-6, result.f.getAbsolutePath().length()-4));
      oldx=533.33f*Integer.parseInt(result.f.getAbsolutePath().substring(result.f.getAbsolutePath().length()-9, result.f.getAbsolutePath().length()-7));     
     
     
      if(result.obj instanceof adt) {
        adt injObj = (adt) result.obj;

        injObj.mddf.render();
        injObj.modf.render();
        injObj.mwmo.render();
        injObj.mmdx.render();
        injObj.mmid.render();
        injObj.mwid.render();
        try {
          MDDF mddf=new MDDF(injObj.mddf.buff);
          MODF modf=new MODF(injObj.modf.buff);
          MWMO mwmo=new MWMO(injObj.mwmo.buff);
          MMDX mmdx=new MMDX(injObj.mmdx.buff);
          MMID mmid=new MMID(injObj.mmid.buff);
          MWID mwid=new MWID(injObj.mwid.buff);
          {
          obj.mddf=mddf;
          obj.modf=modf;
          obj.mwmo=mwmo;
          obj.mmdx=mmdx;
          obj.mmid=mmid;
          obj.mwid=mwid;
          }
           
            for(int i=0;i<obj.mddf.entrys.length;i++)
            {
              float newval;
              newval=(obj.mddf.entrys[i].translate(obj.mddf.entrys[i].getY())-(xpos-oldx));
              obj.mddf.entrys[i].setY(obj.mddf.entrys[i].translate(newval));
              newval=(obj.mddf.entrys[i].translate(obj.mddf.entrys[i].getX())-(ypos-oldy));
              obj.mddf.entrys[i].setX(obj.mddf.entrys[i].translate(newval));
            }
           
            for(int i=0;i<obj.modf.entrys.length;i++)
            {
              float newval;
              newval=(obj.modf.entrys[i].translate(obj.modf.entrys[i].getY())-(xpos-oldx));
              obj.modf.entrys[i].setY(obj.modf.entrys[i].translate(newval));
              newval=(obj.modf.entrys[i].translate(obj.modf.entrys[i].getX())-(ypos-oldy));
              obj.modf.entrys[i].setX(obj.modf.entrys[i].translate(newval));
            }
           
         
        } catch (ChunkNotFoundException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
        }
       
        for(int c=0; c<256; c++) {
          obj.mcnk[c].setNDoodad(injObj.mcnk[c].getNDoodad());
          injObj.mcnk[c].mcrf.render();
          try{
            MCRF mcrf=new MCRF(injObj.mcnk[c].mcrf.buff);
            obj.mcnk[c].mcrf=mcrf;
          }
           catch (ChunkNotFoundException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
          }
        }
      }
    }
   
    // inject heightmap
    else if(e.getSource()==miInject) {
      Vector<openedFile> choices = fm.getFileList();
      openedFile result = (openedFile) JOptionPane.showInputDialog(
        miInject.getComponent(),
                "Chose a Source File:\n",
                "Inject",
                JOptionPane.PLAIN_MESSAGE,
                null,
                choices.toArray(),
                null);
     
      if(result==null) return;
      if(result.obj instanceof adt) {
        adt injObj = (adt) result.obj;
        for(int c=0; c<256; c++) {
          obj.mcnk[c].mcvt = injObj.mcnk[c].mcvt;
          obj.mcnk[c].setHeightOffs(
            injObj.mcnk[c].getHeightOffs()
          );
View Full Code Here

                choices.toArray(),
                null);
     
      if(result==null) return;
      if(result.obj instanceof adt) {
        adt injObj = (adt) result.obj;
        short heightmap[]=new short[16*16];
        for(int c=0; c<256; c++) {
          float temp = 0;
          for(int i=0;i<145;i++){
            temp+=injObj.mcnk[c].mcvt.getVal(i)+injObj.mcnk[c].getPosZ();
View Full Code Here

    // get file
    openedFile of = fm.getActiveFile();

    if (of == null || !(of.obj instanceof adt))
      return null;
    adt obj = (adt) of.obj;
    // create buffered image

    BufferedImage img = new BufferedImage(1024, 1024, BufferedImage.TYPE_INT_RGB);
    for(int x=0; x<16; x++) {
      for(int y=0; y<16; y++) {
View Full Code Here

    if (of == null || !(of.obj instanceof adt))
      return;

    // get data
    adt obj = (adt) of.obj;
    BufferedImage img = new BufferedImage(1024, 1024, BufferedImage.TYPE_INT_RGB);
    for(int TextureID=0;TextureID<obj.mtex.entrys.length;TextureID++){
       
        String filename = of.f.getAbsolutePath();
        File f = new File(filename +"_"+TextureID+"_"+ ".png");
View Full Code Here

    openedFile of = fm.getActiveFile();
   
    if(of==null || !(of.obj instanceof adt)) return;
   
    // get data
    adt obj = (adt)of.obj;
   
    // create buffered image
    BufferedImage img = new BufferedImage(1024, 1024, BufferedImage.TYPE_INT_RGB);
    for(int TextureID=0;TextureID<obj.mtex.entrys.length;TextureID++){
        img = new BufferedImage(1024, 1024, BufferedImage.TYPE_INT_RGB);
View Full Code Here

    String tmp[] = path.replace("\\", "/").split("/");
    FileName = tmp[tmp.length-1];
   
    if(FileName.endsWith("adt")) {
      System.out.println("Open adt File: " + FileName);
      obj = new adt( fileLoader.openBuffer(path) );
    }
    else if(FileName.endsWith("dbc")) {
      System.out.println("Open dbc File: " + FileName);
      obj = new dbc( fileLoader.openBuffer(path) );
    }
View Full Code Here

    DefaultMutableTreeNode top;
    DefaultMutableTreeNode category = null;
      DefaultMutableTreeNode book = null;
     
      if(obj.getClass()==adt.class) {
        adt o = (adt)obj;
        top = new DefaultMutableTreeNode(new MenueEntry(FileName, 0, this, pack));
       
    // files
        category = new DefaultMutableTreeNode(new MenueEntry("Files", 1, this, folder));
        top.add(category);
View Full Code Here

   
    // check adt file
    if(e.getSource()==miCheck) {
      openedFile os = fm.getActiveFile();
      if(os.obj instanceof adt) {
        adt f = (adt)os.obj;
       
        adtChecker check = new adtChecker(f);
        check.check();
      }
    }
View Full Code Here

      imp();
  }
 
  private void extract() {
    System.out.println("Open " + inF);
    adt obj = new adt( fileLoader.openBuffer(inF) );
   
    // Setup output picture
    BufferedImage img = new BufferedImage(16*64, 16*64, BufferedImage.TYPE_BYTE_BINARY);
   
    for(int x=0; x<16; x++) {
View Full Code Here

TOP

Related Classes of starlight.taliis.core.files.adt

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.