Changeset 1887

Show
Ignore:
Timestamp:
11/18/08 02:09:13 (2 months ago)
Author:
ddb174
Message:

Improved realMyst UV and textures.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • drizzle/DrizzlePrp/src/automation/realmyst.java

    r1848 r1887  
    1111import java.util.Vector; 
    1212import java.io.File; 
     13import java.util.HashMap; 
    1314 
    1415public class realmyst 
    1516{ 
     17    public static void testrun2(Vector<Sdb> sdbs, Vector<Mdb> mdbs) 
     18    { 
     19        Primary main = Primary.createNull(); 
     20        HashMap<Integer, Count3Undone> materialmap = new HashMap(); 
     21        for(Sdb sdb: sdbs) 
     22        { 
     23            if(!sdb.sourceName.endsWith("70919002.vdb")) continue; 
     24             
     25            for(int matindex=0;matindex<sdb.count3s.length;matindex++) 
     26            { 
     27                Count3Undone c3 = sdb.count3s[matindex]; 
     28                 
     29                if(c3.possibilities.length!=1) continue; 
     30                int textureIndex = c3.possibilities[0]; 
     31                if(textureIndex==-1) continue; 
     32 
     33                //create material. 
     34                String textureFilename = sdb.count2s[textureIndex].textureFilename.toString(); 
     35                String matname = c3.sb2.str.toString(); 
     36                //String matname = "mat"+Integer.toString(matindex); 
     37                Material mat = Material.create(matname); 
     38                mat.texturemap = TextureMap.create(textureFilename+".dds"); 
     39                //apply uv transform while we're here. 
     40                Matrix matrix = null; 
     41                if(c3.subs!=null && c3.subs.length>0) matrix = c3.subs[0].m400; 
     42                if(matrix!=null) 
     43                { 
     44                    Flt uscale = matrix.values[0][0]; 
     45                    Flt vscale = matrix.values[1][1]; 
     46                    Flt uoffset = matrix.values[0][3]; 
     47                    Flt voffset = matrix.values[1][3]; 
     48                    voffset.multModify(-1.0f); 
     49                    mat.texturemap.uoffset = UOffset.create(uoffset.toJavaFloat()); 
     50                    mat.texturemap.voffset = VOffset.create(voffset.toJavaFloat()); 
     51                    mat.texturemap.uscale = UScale.create(uscale.toJavaFloat()); 
     52                    mat.texturemap.vscale = VScale.create(vscale.toJavaFloat()); 
     53                } 
     54 
     55                main.meshdata.mats.add(mat); 
     56                     
     57                materialmap.put(matindex, c3); 
     58            } 
     59             
     60        } 
     61         
     62        for(Mdb mdb: mdbs) 
     63        { 
     64            if(!mdb.name.toString().equals("myst..portstairstep")) continue; 
     65             
     66            NamedObj namedobj = createnamedobj(mdb,materialmap); 
     67            main.meshdata.objs.add(namedobj); 
     68        } 
     69         
     70        //save 3ds file. 
     71        IBytedeque out = new Bytedeque2(); 
     72        main.compile(out); 
     73        byte[] filedata = out.getAllBytes(); 
     74        FileUtils.WriteFile("c:/hsmout/000test.3ds", filedata); 
     75    } 
     76    public static NamedObj createnamedobj(Mdb mdb, HashMap<Integer, Count3Undone> materialmap) 
     77    { 
     78        String ignorereason = ""; 
     79        if(mdb.fs==null) ignorereason += "Skipping NamedObj because it has no fs. "; 
     80        if(mdb.bunch==null) ignorereason += "Skipping NamedObj because it has no bunch. "; 
     81        if(mdb.whas==null) ignorereason += "Skipping NamedObj because it has no whas. "; 
     82        if(mdb.trips==null) ignorereason += "NamedObj has no trips."; 
     83        if(!ignorereason.equals("")) throw new ignore(ignorereason); 
     84         
     85        Vertex[] verts = new Vertex[mdb.fs.length]; 
     86        for(int i=0;i<mdb.fs.length;i++) 
     87        { 
     88            int to = mdb.fs[i].v2; 
     89            int from = mdb.fs[i].v3; 
     90            Flt x= mdb.bunch[to].f1; 
     91            Flt y= mdb.bunch[to].f2; 
     92            Flt z= mdb.bunch[to].f3; 
     93            verts[i] = Vertex.createFromFlts(x, y, z); 
     94        } 
     95 
     96        FltPair[] uvcoords = new FltPair[mdb.trips.length]; 
     97        for(int i=0;i<mdb.trips.length;i++) 
     98        { 
     99            Flt u = mdb.trips[i].x; 
     100            Flt v = mdb.trips[i].y; 
     101            Flt w = mdb.trips[i].z; 
     102            Flt u2 = Flt.createFromJavaFloat(1.0f - u.toJavaFloat()); //v = 1 - v; 
     103            Flt v2 = Flt.createFromJavaFloat(1.0f - v.toJavaFloat()); //v = 1 - v; 
     104            Flt w2 = Flt.createFromJavaFloat(1.0f - w.toJavaFloat()); //v = 1 - v; 
     105            uvcoords[i] = FltPair.createFromFlts(u, v2); 
     106        } 
     107 
     108        ShortTriplet[] faces = new ShortTriplet[mdb.whas.length]; 
     109        for(int i=0;i<mdb.whas.length;i++) 
     110        { 
     111            int v1 = mdb.whas[i].u6; 
     112            int v2 = mdb.whas[i].u7; 
     113            int v3 = mdb.whas[i].u8; 
     114            faces[i] = ShortTriplet.createFromShorts((short)v1, (short)v2, (short)v3); 
     115            Flt uscale = mdb.whas[i].f12; 
     116            //uvcoords[v1].u.multModify(uscale); 
     117            //uvcoords[v2].u.multModify(uscale); 
     118            //uvcoords[v3].u.multModify(uscale); 
     119        } 
     120 
     121        String objname = mdb.name.toString(); 
     122         
     123        NamedObj newobj = NamedObj.createNull(objname); 
     124        newobj.namedTriangleObject = NamedTriangleObject.createNull(); 
     125        newobj.namedTriangleObject.points = PointArray.create(verts); 
     126        //newobj.namedTriangleObject.faces = FaceArray.create(faces, "defaultmat"); 
     127        newobj.namedTriangleObject.faces = FaceArray.createNull(); 
     128        newobj.namedTriangleObject.faces.facecount = check.intToShort(faces.length); 
     129        newobj.namedTriangleObject.faces.faces = new FaceArray.tdsface[faces.length]; 
     130        for(int i=0;i<faces.length;i++) 
     131        { 
     132            short v1 = faces[i].p; 
     133            short v2 = faces[i].q; 
     134            short v3 = faces[i].r; 
     135            short flags = 0; 
     136            newobj.namedTriangleObject.faces.faces[i] = new FaceArray.tdsface(v1,v2,v3,flags); 
     137        } 
     138        for(int curmat=0;curmat<mdb.ii.count;curmat++) 
     139        { 
     140            int curmatindex = mdb.ii.indices[curmat]; 
     141            Count3Undone c3= materialmap.get(curmatindex); 
     142            String curmatname = c3.sb2.str.toString(); 
     143            int curmatvertcount = 0; 
     144            for(int i=0;i<mdb.ifi.values.length;i++) 
     145            { 
     146                if(mdb.ifi.values[i]==curmatindex) curmatvertcount++; 
     147            } 
     148            short[] facesToApplyTo = new short[curmatvertcount]; 
     149            int curface = 0; 
     150            for(int i=0;i<mdb.ifi.values.length;i++) 
     151            { 
     152                if(mdb.ifi.values[i]==curmatindex) 
     153                { 
     154                    facesToApplyTo[curface] = (short)i; 
     155                    curface++; 
     156                     
     157                    //apply uv transform while we're here. 
     158                    //Matrix matrix = c3.subs[0].m400; 
     159                    //Flt uscale = matrix.values[0][0]; 
     160                    //Flt vscale = matrix.values[1][1]; 
     161                    //Flt uoffset = matrix.values[0][3]; 
     162                    //Flt voffset = matrix.values[1][3]; 
     163                    //int v1 = mdb.whas[i].u6; 
     164                    //int v2 = mdb.whas[i].u7; 
     165                    //int v3 = mdb.whas[i].u8; 
     166                    //uvcoords[v1].u.multModify(uscale); 
     167                    //uvcoords[v1].u.addModify(uoffset); 
     168                    //uvcoords[v2].u.multModify(uscale); 
     169                    //uvcoords[v2].u.addModify(uoffset); 
     170                    //uvcoords[v3].u.multModify(uscale); 
     171                    //uvcoords[v3].u.addModify(uoffset); 
     172                } 
     173            } 
     174            MeshMatGroup mmg = MeshMatGroup.create(curmatname, facesToApplyTo); 
     175            newobj.namedTriangleObject.faces.mats.add(mmg); 
     176        } 
     177         
     178         
     179        for(ShortTriplet face: faces) 
     180        { 
     181            if(face.p >= verts.length || face.q>= verts.length || face.r>=verts.length) 
     182            { 
     183                int dummy=0; 
     184            } 
     185        } 
     186        if(uvcoords.length!=0) 
     187        { 
     188            if(uvcoords.length!=verts.length) 
     189            { 
     190                int dummy=0; 
     191            } 
     192            else 
     193            { 
     194                if(uvcoords.length!=0) newobj.namedTriangleObject.uvcoords = UvVerts.create(uvcoords); 
     195                 
     196            } 
     197        } 
     198 
     199        return newobj; 
     200    } 
     201    public static void testrun(Vector<Sdb> sdbs, Vector<Mdb> mdbs) 
     202    { 
     203        Primary main = Primary.createNull(); 
     204        //main.meshdata.mat = Material.create("defaultmat"); 
     205        //add texture filename... 
     206        //main.meshdata.mat.texturemap = TextureMap.create("active.hsm.dds"); 
     207 
     208        String[] mystrooms = automation.realmyst.findRoomInfo(sdbs,"Myst"); 
     209        //Vector<realmyst.Mdb> mystmdbs = automation.realmyst.filterMdbsByRoom(mdbs, mystrooms); 
     210        //automation.realmyst.save3dsFile(mystmdbs); 
     211        int matnum = 0; 
     212        for(Sdb sdb: sdbs) 
     213        { 
     214            if(sdb.sourceName.endsWith("70919002.vdb")) 
     215            { 
     216                int i=0; 
     217                for(Count2 c2: sdb.count2s) 
     218                { 
     219                    String texsrch = "stonestep.hsm";//"GBdock.hsm"; 
     220                    if(c2.textureFilename.toString().equals(texsrch)) 
     221                    { 
     222                        int dummy=0; 
     223                    } 
     224                    i++; 
     225                } 
     226                int j=0; 
     227                for(Count3Undone c3: sdb.count3s) 
     228                { 
     229                    int textureIndex = c3.possibility; 
     230                    if(textureIndex!=-1) 
     231                    { 
     232                        String textureFilename = sdb.count2s[textureIndex].textureFilename.toString(); 
     233                        String name = c3.sb2.str.toString(); 
     234                        if(textureIndex==185) 
     235                        { 
     236                            int dummy=0; 
     237                        } 
     238                        if(name.startsWith("myst..portstairstep"))//"myst..portfloor")) 
     239                        { 
     240                            int dummy=0; 
     241                        } 
     242                        for(Mdb mdb: mdbs) 
     243                        { 
     244                            String mdbname = mdb.name.toString(); 
     245                            if(name.equals(mdbname)) 
     246                            { 
     247                                matnum++; 
     248                                String matname = "mat"+Integer.toString(matnum); 
     249                                Material mat = Material.create(matname); 
     250                                mat.texturemap = TextureMap.create(textureFilename+".dds"); 
     251                                main.meshdata.mats.add(mat); 
     252                                 
     253                                try 
     254                                { 
     255                                    NamedObj obj = createNamedObj(mdb);//, main, sdb); 
     256                                    obj.namedTriangleObject.faces.mats.get(0).name = Ntstring.createFromString(matname); 
     257                                    main.meshdata.objs.add(obj); 
     258                                } 
     259                                catch(ignore e) 
     260                                { 
     261                                    int dummy=0; 
     262                                } 
     263                                int dummy=0; 
     264                            } 
     265                        } 
     266                    } 
     267                    j++; 
     268                } 
     269            } 
     270        } 
     271         
     272        IBytedeque out = new Bytedeque2(); 
     273        main.compile(out); 
     274        byte[] filedata = out.getAllBytes(); 
     275        FileUtils.WriteFile("c:/hsmout/000test.3ds", filedata); 
     276         
     277    } 
    16278    public static Vector<Mdb> filterMdbsByRoom(Vector<Mdb> mdbs, String[] rooms) 
    17279    { 
     
    44306        return result; 
    45307    } 
    46     public static Vector<Hsm> realAllHsms(String folder) 
     308    public static Vector<Hsm> readAllHsms(String folder) 
    47309    { 
    48310        File f = new File(folder+"/scn/maps"); 
     
    248510    { 
    249511        Primary main = Primary.createNull(); 
    250         main.meshdata.mat = Material.create("defaultmat"); 
     512        Material mat = Material.create("defaultmat"); 
    251513         
    252514        //add texture filename... 
    253         main.meshdata.mat.texturemap = TextureMap.create("active.hsm.dds"); 
     515        mat.texturemap = TextureMap.create("active.hsm.dds"); 
     516         
     517        main.meshdata.mats.add(mat); 
    254518         
    255519        for(Mdb mdb: mdbs) 
     
    272536    } 
    273537     
    274     public static NamedObj createNamedObj(Mdb mdb) 
     538    public static NamedObj createNamedObj(Mdb mdb)//, Primary main, Sdb sdb) 
    275539    { 
    276540        /*Vertex[] verts = new Vertex[bunch.length]; 
     
    317581            Flt u = mdb.trips[i].x; 
    318582            Flt v = mdb.trips[i].y; 
    319             uvcoords[i] = FltPair.createFromFlts(u, v); 
     583            Flt w = mdb.trips[i].z; 
     584            Flt u2 = Flt.createFromJavaFloat(1.0f - u.toJavaFloat()); //v = 1 - v; 
     585            Flt v2 = Flt.createFromJavaFloat(1.0f - v.toJavaFloat()); //v = 1 - v; 
     586            Flt w2 = Flt.createFromJavaFloat(1.0f - w.toJavaFloat()); //v = 1 - v; 
     587            uvcoords[i] = FltPair.createFromFlts(u, v2); 
    320588        } 
    321589 
  • drizzle/DrizzlePrp/src/export3ds/FaceArray.java

    r1842 r1887  
    77 
    88import shared.*; 
     9import java.util.Vector; 
    910 
    1011public class FaceArray extends tdsobj 
     
    1213    public short facecount; 
    1314    public tdsface[] faces; 
    14     public MeshMatGroup mat; 
     15    //public MeshMatGroup mat; 
     16    public Vector<MeshMatGroup> mats = new Vector<MeshMatGroup>(); 
    1517     
    1618    private FaceArray(){} 
    1719     
     20    public static FaceArray createNull() 
     21    { 
     22        FaceArray result = new FaceArray(); 
     23        return result; 
     24    } 
    1825    public static FaceArray create(ShortTriplet[] faces, String matname) 
    1926    { 
     
    3441            facesToApplyTo[i] = (short)i; 
    3542        } 
    36         result.mat = MeshMatGroup.create(matname, facesToApplyTo); 
     43        result.mats.add(MeshMatGroup.create(matname, facesToApplyTo)); 
    3744        return result; 
    3845    } 
     
    4249        c.writeShort(facecount); 
    4350        c.writeArray(faces); 
    44         mat.compile(c); 
     51        //mat.compile(c); 
     52        c.writeVector(mats); 
    4553    } 
    4654     
  • drizzle/DrizzlePrp/src/export3ds/Material.java

    r1847 r1887  
    1616     
    1717    public TextureMap texturemap; 
     18     
    1819     
    1920    private Material(){} 
  • drizzle/DrizzlePrp/src/export3ds/Meshdata.java

    r1842 r1887  
    1111public class Meshdata extends tdsobj 
    1212{ 
    13     public Material mat; 
     13    //public Material mat; 
     14    public Vector<Material> mats = new Vector(); 
    1415    //public NamedObj obj; 
    15     public Vector<NamedObj> objs = new Vector<NamedObj>(); 
     16    public Vector<NamedObj> objs = new Vector(); 
    1617     
    1718    private Meshdata(){} 
     
    2526    public void innercompile(IBytedeque c) 
    2627    { 
    27         mat.compile(c); 
     28        //mat.compile(c); 
     29        c.writeVector(mats); 
    2830        //obj.compile(c); 
    2931        c.writeVector(objs); 
  • drizzle/DrizzlePrp/src/export3ds/TextureMap.java

    r1847 r1887  
    1313    public TextureFilename texturefilename; 
    1414     
     15    public UOffset uoffset; 
     16    public VOffset voffset; 
     17    public UScale uscale; 
     18    public VScale vscale; 
     19 
    1520    private TextureMap(){} 
    1621     
     
    2732    { 
    2833        texturefilename.compile(c); 
     34 
     35        if(uoffset!=null) uoffset.compile(c); 
     36        if(voffset!=null) voffset.compile(c); 
     37        if(uscale!=null) uscale.compile(c); 
     38        if(vscale!=null) vscale.compile(c); 
    2939    } 
    3040     
  • drizzle/DrizzlePrp/src/export3ds/Typeid.java

    r1847 r1887  
    2929    texturefilename, 
    3030    uvcoords, 
     31    uoffset, 
     32    voffset, 
     33    uscale, 
     34    vscale, 
    3135    ; 
    3236    public static pair[] pairs = { 
     
    4953        p((short)0xa200, texturemap), 
    5054        p((short)0xa300, texturefilename), 
     55        p((short)0xa358, uoffset), 
     56        p((short)0xa35a, voffset), 
     57        p((short)0xa356, uscale), 
     58        p((short)0xa354, vscale), 
    5159    }; 
    5260     
  • drizzle/DrizzlePrp/src/filesearcher/search.java

    r1847 r1887  
    2525    public static boolean searchForString(File f, String searchstr) 
    2626    { 
     27        return (searchForStringPos(f,searchstr)!=-1); 
     28    } 
     29    public static int searchForStringPos(File f, String searchstr) 
     30    { 
    2731        byte[] data = FileUtils.ReadFile(f); 
    2832        String filedata = b.BytesToString(data); 
    2933        int index = filedata.indexOf(searchstr); 
    30         return (index!=-1); 
     34        //return (index!=-1); 
     35        return index; 
    3136    } 
    3237    public static Vector<File> getallfiles(String folder, boolean recurse) 
  • drizzle/DrizzlePrp/src/gui/Gui.form

    r1885 r1887  
    29712971              </Constraints> 
    29722972            </Component> 
     2973            <Component class="shared.State.TextfieldState" name="textfieldState29"> 
     2974              <Properties> 
     2975                <Property name="text" type="java.lang.String" value="textfieldState29"/> 
     2976                <Property name="name" type="java.lang.String" value="searchString" noResource="true"/> 
     2977              </Properties> 
     2978              <Constraints> 
     2979                <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription"> 
     2980                  <AbsoluteConstraints x="650" y="40" width="130" height="-1"/> 
     2981                </Constraint> 
     2982              </Constraints> 
     2983            </Component> 
     2984            <Component class="shared.State.TextfieldState" name="textfieldState30"> 
     2985              <Properties> 
     2986                <Property name="text" type="java.lang.String" value="textfieldState30"/> 
     2987                <Property name="name" type="java.lang.String" value="searchPath" noResource="true"/> 
     2988              </Properties> 
     2989              <Constraints> 
     2990                <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription"> 
     2991                  <AbsoluteConstraints x="650" y="10" width="-1" height="-1"/> 
     2992                </Constraint> 
     2993              </Constraints> 
     2994            </Component> 
    29732995          </SubComponents> 
    29742996        </Container> 
  • drizzle/DrizzlePrp/src/gui/Gui.java

    r1885 r1887  
    585585        jButton109 = new javax.swing.JButton(); 
    586586        jButton110 = new javax.swing.JButton(); 
     587        textfieldState29 = new shared.State.TextfieldState(); 
     588        textfieldState30 = new shared.State.TextfieldState(); 
    587589        jPanel12 = new javax.swing.JPanel(); 
    588590        jButton50 = new javax.swing.JButton(); 
     
    25052507                jButton110.setBounds(380, 160, 63, 36); 
    25062508 
     2509                textfieldState29.setText("textfieldState29"); 
     2510                textfieldState29.setName("searchString"); // NOI18N 
     2511                jPanel10.add(textfieldState29); 
     2512                textfieldState29.setBounds(650, 40, 130, 20); 
     2513 
     2514                textfieldState30.setText("textfieldState30"); 
     2515                textfieldState30.setName("searchPath"); // NOI18N 
     2516                jPanel10.add(textfieldState30); 
     2517                textfieldState30.setBounds(650, 10, 87, 20); 
     2518 
    25072519                tabsState3.addTab("realMyst", jPanel10); 
    25082520 
     
    41084120    //m.state.curstate.writeToFile = true; 
    41094121     
    4110     Vector<realmyst.Hsm> hsms = automation.realmyst.realAllHsms(outfol); 
     4122    Vector<realmyst.Hsm> hsms = automation.realmyst.readAllHsms(outfol); 
    41114123    //automation.realmyst.save3dsFile(mdbs); 
    41124124    automation.realmyst.saveDdsFiles(hsms,"c:/hsmout"); 
     
    41154127 
    41164128private void jButton109ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton109ActionPerformed 
    4117     String folder = "G:/prps/realmysttest2/sdb"; 
     4129    //String folder = "G:/prps/realmysttest2/sdb"; 
     4130    String sep = ";"; 
     4131    String folder = this.textfieldState30.getText(); 
     4132    String searchstr = this.textfieldState29.getText(); 
    41184133    String[] searchstrs = { 
    41194134        //6910138.vdb 
     
    41604175        "myst..base_mountain" 
    41614176    }; 
     4177    searchstrs = searchstr.split(sep); 
     4178    //String[] searchstrs2 = new String[]{this.textfieldState29.getText()}; 
    41624179    Vector<File> files = filesearcher.search.getallfiles(folder, false); 
    41634180    for(File f: files) 
    41644181    { 
    4165         boolean allfound = filesearcher.search.searchForStrings(f, searchstrs); 
    4166         if(allfound) 
     4182        //boolean allfound = filesearcher.search.searchForStrings(f, searchstrs); 
     4183        //if(allfound) 
     4184        if(searchstrs.length<2) 
    41674185        { 
    4168             String filename = f.getName(); 
    4169             m.msg("String found in file:"+filename); 
    4170             int dummy=0; 
     4186            int pos = filesearcher.search.searchForStringPos(f, searchstr); 
     4187            if(pos!=-1) 
     4188            { 
     4189                String filename = f.getName(); 
     4190                m.msg("String found in file:"+filename+"  at pos 0x"+Integer.toHexString(pos)); 
     4191                int dummy=0; 
     4192            } 
     4193        } 
     4194        else 
     4195        { 
     4196            boolean allfound = filesearcher.search.searchForStrings(f, searchstrs); 
     4197            if(allfound) 
     4198            { 
     4199                m.msg("Strings all found in file:"+f.getName()); 
     4200            } 
    41714201        } 
    41724202    } 
     
    41784208     
    41794209    Vector<realmyst.Sdb> sdbs = automation.realmyst.readAllSdbs(outfol); 
    4180     String[] mystrooms = automation.realmyst.findRoomInfo(sdbs,"Myst"); 
    41814210     
    41824211    Vector<realmyst.Mdb> mdbs = automation.realmyst.readAllMdbs(outfol); 
    4183     Vector<realmyst.Mdb> mystmdbs = automation.realmyst.filterMdbsByRoom(mdbs, mystrooms); 
    4184      
    4185     automation.realmyst.save3dsFile(mystmdbs); 
    4186  
     4212    //String[] mystrooms = automation.realmyst.findRoomInfo(sdbs,"Myst"); 
     4213    //Vector<realmyst.Mdb> mystmdbs = automation.realmyst.filterMdbsByRoom(mdbs, mystrooms); 
     4214    //automation.realmyst.save3dsFile(mystmdbs); 
     4215 
     4216    automation.realmyst.testrun2(sdbs,mdbs); 
    41874217     
    41884218}//GEN-LAST:event_jButton110ActionPerformed 
     
    44784508    private shared.State.TextfieldState textfieldState27; 
    44794509    private shared.State.TextfieldState textfieldState28; 
     4510    private shared.State.TextfieldState textfieldState29; 
    44804511    private shared.State.TextfieldState textfieldState3; 
     4512    private shared.State.TextfieldState textfieldState30; 
    44814513    private shared.State.TextfieldState textfieldState4; 
    44824514    private shared.State.TextfieldState textfieldState5; 
  • drizzle/DrizzlePrp/src/realmyst/Bstr.java

    r1834 r1887  
    3333    byte[] string; 
    3434     
     35    public Bstr(IBytestream c, boolean lastByteShouldBeNulled) 
     36    { 
     37        strlen = c.readInt(); 
     38        string = new byte[strlen]; 
     39        for(int i=0;i<strlen;i++) 
     40        { 
     41            string[i] = c.readByte(); 
     42        } 
     43         
     44        if(lastByteShouldBeNulled) 
     45        { 
     46            string[strlen-1] = 0; 
     47        } 
     48    } 
    3549    public Bstr(IBytestream c) 
    3650    { 
  • drizzle/DrizzlePrp/src/realmyst/Count2.java

    r1848 r1887  
    3131    public Bstr s4; 
    3232    public byte b5; 
    33     public Bstr s6
     33    public Bstr textureFilename
    3434    public int u7; 
    3535     
     36    //texture 
    3637    public Count2(IBytestream c) //has hsm filename. 
    3738    { 
     
    4748        s4 = new Bstr(c); 
    4849        b5 = c.readByte(); e.ensure((int)b5,0); 
    49         s6 = new Bstr(c); 
     50        textureFilename = new Bstr(c); 
    5051        u7 = c.readInt(); //e.ensure(u7,0x800000,0x18800000,0x10800000,0x10900000,0x20800000,0x900000); 
    5152        int dummy=0; 
  • drizzle/DrizzlePrp/src/realmyst/Count3Undone.java

    r1850 r1887  
    2727    int size; 
    2828     
    29     int possibility; 
     29    public int possibility; 
     30    public int[] possibilities; 
    3031     
     32    public StringAndByte sb2; 
     33    public StringAndByte[] sb3a; 
     34    public int u7; 
     35    public int u5; 
     36    public subcount3[] subs; 
    3137    public static int numhandled=0; 
    3238    public static int numignored=0; 
    3339     
     40    //material, I think. 
    3441    //sub_409d40, I think, because it reads a sub_40cb70 (4x4 matrix). 
    3542    public Count3Undone(IBytestream c) 
     
    6067        int u1 = c.readInt();  e.ensure(u1,1); 
    6168         
    62         StringAndByte sb2 = new StringAndByte(c); 
     69        sb2 = new StringAndByte(c); 
    6370        //int bytecount = c.readInt(); 
    6471        //if(bytecount>256) return; 
     
    7683        //    int dummy=0; 
    7784        //} 
    78         StringAndByte[] sb3a = c.readArray(StringAndByte.class, u3); 
     85        sb3a = c.readArray(StringAndByte.class, u3); 
    7986        int u4 = c.readInt(); e.ensure(u4,3); 
    80         int u5 = c.readInt(); e.ensure(u5,0,1); 
     87        u5 = c.readInt(); e.ensure(u5,0,1); 
    8188        int u6 = c.readInt(); e.ensure(u6,655,645,557,649,521,533,544,512,644,556,535,513,520,549,133,524,23,6,525,516,517,29,7,15,5,37,21,13,12,45,9,4,36,1,0,33,8,141);//e.ensure(u6,5,8,4,13,37,12,36,21,9,1,33); //13 
    82         int u7 = c.readInt(); e.ensure(u7,1,2,3,4,5,6); 
     89        u7 = c.readInt(); e.ensure(u7,1,2,3,4,5,6); 
     90        IBytestream c2 = c.Fork(); 
     91        { 
     92            int curpos = c2.getAbsoluteOffset(); 
     93            byte[] rawdata2 = c2.readBytes(size-(curpos-startpos)-(4*u7)); 
     94            possibilities = c2.readInts(u7); 
     95        } 
     96         
    8397        try{ 
    8498            numignored++; 
    85             subcount3[] subs = c.readArray(subcount3.class, u7); 
     99            subs = c.readArray(subcount3.class, u7); 
    86100            numignored--; 
    87101            numhandled++; 
     
    209223    public static class subcount3 
    210224    { 
    211         int esiPlus120; 
     225        public int esiPlus120; 
    212226        int ending; 
     227        public Flt u14; 
     228        public Flt u15; 
     229        public Flt f200; 
     230        public Flt f203; 
     231        public Flt f16; 
     232        public Flt f17; 
     233        public Flt f18; 
     234        public Flt f19; 
     235        public Flt f20; 
     236        public Flt f21; 
     237        public Flt f22; 
     238        public Flt f23; 
     239        public Matrix m400; 
    213240         
    214241        public static int numignored = 0; 
     
    241268            //m.msg("count3: u8b="+Integer.toString(u8b)+" u9="+Integer.toString(u9)); 
    242269            //if(true)return; 
    243             Flt u14 = new Flt(c); 
    244             Flt u15 = new Flt(c); 
     270            u14 = new Flt(c); 
     271            u15 = new Flt(c); 
    245272            if((u12&0x20)!=0) 
    246273            { 
    247                 Flt f200 = new Flt(c); 
     274                f200 = new Flt(c); 
    248275                int dummy=0; 
    249276            } 
     
    258285            if((esiPlus120&0x4000)!=0) 
    259286            { 
    260                 Flt f203 = new Flt(c); 
    261                 int dummy=0; 
    262             } 
    263             Flt u16 = new Flt(c); 
    264             Flt u17 = new Flt(c); 
    265             Flt u18 = new Flt(c); 
    266             Flt f19 = new Flt(c); //often the previous ones are all 0.0 and this is 1.0 
    267             Flt f20 = new Flt(c); 
    268             Flt f21 = new Flt(c); 
    269             Flt f22 = new Flt(c); 
    270             Flt f23 = new Flt(c); 
    271  
    272             Matrix m400=null; 
     287                f203 = new Flt(c); 
     288                int dummy=0; 
     289            } 
     290            f16 = new Flt(c); 
     291            f17 = new Flt(c); 
     292            f18 = new Flt(c); 
     293            f19 = new Flt(c); //often the previous ones are all 0.0 and this is 1.0 
     294            f20 = new Flt(c); 
     295            f21 = new Flt(c); 
     296            f22 = new Flt(c); 
     297            f23 = new Flt(c); 
     298 
     299            //Matrix m400=null; 
    273300            if((esiPlus120&0x10)!=0) 
    274301            { 
  • drizzle/DrizzlePrp/src/realmyst/Idx.java

    r1834 r1887  
    4646        RoomIndex = new IdxBlock(c); 
    4747        NamedGroupIndex = new IdxBlock(c); 
     48        int saveGroupCount = 0; 
     49        for(IdxEntry entry: SaveGroupIndex.entries) 
     50        { 
     51            saveGroupCount += entry.indexcount; 
     52        } 
     53        int roomCount = 0; 
     54        for(IdxEntry entry: RoomIndex.entries) 
     55        { 
     56            roomCount += entry.indexcount; 
     57        } 
     58        int dummy=0; 
    4859        //idxblocks = c.readArray(IdxBlock.class, blockcount); 
    4960        //c.toString(); 
     
    95106            indexes = c.readInts(indexcount); 
    96107        } 
     108         
     109        public String toString() 
     110        { 
     111            return name.toString(); 
     112        } 
    97113    } 
    98114} 
  • drizzle/DrizzlePrp/src/realmyst/Matrix.java

    r1850 r1887  
    2323public class Matrix 
    2424{ 
    25     Flt[][] values = new Flt[4][4]; 
     25    public Flt[][] values = new Flt[4][4]; 
    2626     
    2727    public Matrix(IBytestream c) 
  • drizzle/DrizzlePrp/src/realmyst/Mdb.java

    r1847 r1887  
    3131    public Sixlet start; 
    3232    public Sixlet[] bunch; 
     33    public Quat[] quats; 
    3334    public Face[] fs;     
    34     IntsIndex ii; 
    35     IntsFullIndex ifi; 
     35    public IntsIndex ii; 
     36    public IntsFullIndex ifi; 
    3637    public wha[] whas; 
    3738    public Vertex[] trips; 
     39    public Face[] fs2; 
     40    public int[] extra; 
    3841     
    3942     
    4043    static Primary main; 
     44    public String sourceName; 
    4145    public Mdb(IBytestream c) 
    4246    { 
     
    4650    { 
    4751        int curfilenum = realmyst.rmcontext.get().curnum; 
     52        sourceName = c.sourceName; 
    4853         
    4954        //tag = c.readInt(); 
     
    5661        filesize = c.readInt(); //filesize (including header) 
    5762        u2 = c.readInt(); e.ensure(u2,1);//=1? 
    58         name = new Bstr(c); 
     63        name = new Bstr(c,true); 
    5964        String trap =  
    6065                //"aurora..sn_TOWER_observe_roof01" 
    6166                //"aurora..switchtube" 
    62                 "aurora..boltref03" 
     67                //"aurora..boltref03" 
     68                //"myst..portfloor" 
     69                "myst..portstairstep" 
    6370                ; 
    6471        if(name.toString().toLowerCase().startsWith(trap.toLowerCase())) 
     
    113120            int s2 = c.readInt(); //4 
    114121            bunch = c.readArray(Sixlet.class, s2); //vertex and vertex normal (vertex normal is average of face normals of adjacent faces.) 
    115             Quat[] quats = null; //I think this is actually a RGBA colour. 
     122            quats = null; //I think this is actually a RGBA colour. 
    116123            if(s1!=2) 
    117124            { 
     
    196203         
    197204         
    198         Face[] fs2=null; 
     205        //Face[] fs2=null; 
    199206        //if(u7!=267) 
    200207        if(u7==1||u7==11||u7==9) 
     
    218225        //int u33 = c.readInt(); //5  5  5 
    219226         
     227         
     228        //maps faces to material indexes, use IntsFullIndex. 
    220229        //IntsIndex: 
    221230        int u26 = c.readInt(); 
    222231        //int[] extra = c.readInts(u26-1); //n-1 extra ints. 
    223232        //int u32 = c.readInt(); 
    224         int[] extra = c.readInts(u26); 
     233        extra = c.readInts(u26); 
    225234 
    226235        //if(u7!=267) 
     
    246255    public static class IntsFullIndex 
    247256    { 
    248         int[] values; 
     257  &