Changeset 1887
- Timestamp:
- 11/18/08 02:09:13 (2 months ago)
- Files:
-
- drizzle/DrizzlePrp/src/automation/realmyst.java (modified) (5 diffs)
- drizzle/DrizzlePrp/src/export3ds/FaceArray.java (modified) (4 diffs)
- drizzle/DrizzlePrp/src/export3ds/Material.java (modified) (1 diff)
- drizzle/DrizzlePrp/src/export3ds/Meshdata.java (modified) (2 diffs)
- drizzle/DrizzlePrp/src/export3ds/TextureMap.java (modified) (2 diffs)
- drizzle/DrizzlePrp/src/export3ds/Typeid.java (modified) (2 diffs)
- drizzle/DrizzlePrp/src/export3ds/UOffset.java (added)
- drizzle/DrizzlePrp/src/export3ds/UScale.java (added)
- drizzle/DrizzlePrp/src/export3ds/VOffset.java (added)
- drizzle/DrizzlePrp/src/export3ds/VScale.java (added)
- drizzle/DrizzlePrp/src/filesearcher/search.java (modified) (1 diff)
- drizzle/DrizzlePrp/src/gui/Gui.form (modified) (1 diff)
- drizzle/DrizzlePrp/src/gui/Gui.java (modified) (7 diffs)
- drizzle/DrizzlePrp/src/realmyst/Bstr.java (modified) (1 diff)
- drizzle/DrizzlePrp/src/realmyst/Count2.java (modified) (2 diffs)
- drizzle/DrizzlePrp/src/realmyst/Count3Undone.java (modified) (6 diffs)
- drizzle/DrizzlePrp/src/realmyst/Idx.java (modified) (2 diffs)
- drizzle/DrizzlePrp/src/realmyst/Matrix.java (modified) (1 diff)
- drizzle/DrizzlePrp/src/realmyst/Mdb.java (modified) (9 diffs)
- drizzle/DrizzlePrp/src/realmyst/Sdb.java (modified) (1 diff)
- drizzle/DrizzlePrp/src/shared/Flt.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
drizzle/DrizzlePrp/src/automation/realmyst.java
r1848 r1887 11 11 import java.util.Vector; 12 12 import java.io.File; 13 import java.util.HashMap; 13 14 14 15 public class realmyst 15 16 { 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 } 16 278 public static Vector<Mdb> filterMdbsByRoom(Vector<Mdb> mdbs, String[] rooms) 17 279 { … … 44 306 return result; 45 307 } 46 public static Vector<Hsm> rea lAllHsms(String folder)308 public static Vector<Hsm> readAllHsms(String folder) 47 309 { 48 310 File f = new File(folder+"/scn/maps"); … … 248 510 { 249 511 Primary main = Primary.createNull(); 250 main.meshdata.mat = Material.create("defaultmat");512 Material mat = Material.create("defaultmat"); 251 513 252 514 //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); 254 518 255 519 for(Mdb mdb: mdbs) … … 272 536 } 273 537 274 public static NamedObj createNamedObj(Mdb mdb) 538 public static NamedObj createNamedObj(Mdb mdb)//, Primary main, Sdb sdb) 275 539 { 276 540 /*Vertex[] verts = new Vertex[bunch.length]; … … 317 581 Flt u = mdb.trips[i].x; 318 582 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); 320 588 } 321 589 drizzle/DrizzlePrp/src/export3ds/FaceArray.java
r1842 r1887 7 7 8 8 import shared.*; 9 import java.util.Vector; 9 10 10 11 public class FaceArray extends tdsobj … … 12 13 public short facecount; 13 14 public tdsface[] faces; 14 public MeshMatGroup mat; 15 //public MeshMatGroup mat; 16 public Vector<MeshMatGroup> mats = new Vector<MeshMatGroup>(); 15 17 16 18 private FaceArray(){} 17 19 20 public static FaceArray createNull() 21 { 22 FaceArray result = new FaceArray(); 23 return result; 24 } 18 25 public static FaceArray create(ShortTriplet[] faces, String matname) 19 26 { … … 34 41 facesToApplyTo[i] = (short)i; 35 42 } 36 result.mat = MeshMatGroup.create(matname, facesToApplyTo);43 result.mats.add(MeshMatGroup.create(matname, facesToApplyTo)); 37 44 return result; 38 45 } … … 42 49 c.writeShort(facecount); 43 50 c.writeArray(faces); 44 mat.compile(c); 51 //mat.compile(c); 52 c.writeVector(mats); 45 53 } 46 54 drizzle/DrizzlePrp/src/export3ds/Material.java
r1847 r1887 16 16 17 17 public TextureMap texturemap; 18 18 19 19 20 private Material(){} drizzle/DrizzlePrp/src/export3ds/Meshdata.java
r1842 r1887 11 11 public class Meshdata extends tdsobj 12 12 { 13 public Material mat; 13 //public Material mat; 14 public Vector<Material> mats = new Vector(); 14 15 //public NamedObj obj; 15 public Vector<NamedObj> objs = new Vector <NamedObj>();16 public Vector<NamedObj> objs = new Vector(); 16 17 17 18 private Meshdata(){} … … 25 26 public void innercompile(IBytedeque c) 26 27 { 27 mat.compile(c); 28 //mat.compile(c); 29 c.writeVector(mats); 28 30 //obj.compile(c); 29 31 c.writeVector(objs); drizzle/DrizzlePrp/src/export3ds/TextureMap.java
r1847 r1887 13 13 public TextureFilename texturefilename; 14 14 15 public UOffset uoffset; 16 public VOffset voffset; 17 public UScale uscale; 18 public VScale vscale; 19 15 20 private TextureMap(){} 16 21 … … 27 32 { 28 33 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); 29 39 } 30 40 drizzle/DrizzlePrp/src/export3ds/Typeid.java
r1847 r1887 29 29 texturefilename, 30 30 uvcoords, 31 uoffset, 32 voffset, 33 uscale, 34 vscale, 31 35 ; 32 36 public static pair[] pairs = { … … 49 53 p((short)0xa200, texturemap), 50 54 p((short)0xa300, texturefilename), 55 p((short)0xa358, uoffset), 56 p((short)0xa35a, voffset), 57 p((short)0xa356, uscale), 58 p((short)0xa354, vscale), 51 59 }; 52 60 drizzle/DrizzlePrp/src/filesearcher/search.java
r1847 r1887 25 25 public static boolean searchForString(File f, String searchstr) 26 26 { 27 return (searchForStringPos(f,searchstr)!=-1); 28 } 29 public static int searchForStringPos(File f, String searchstr) 30 { 27 31 byte[] data = FileUtils.ReadFile(f); 28 32 String filedata = b.BytesToString(data); 29 33 int index = filedata.indexOf(searchstr); 30 return (index!=-1); 34 //return (index!=-1); 35 return index; 31 36 } 32 37 public static Vector<File> getallfiles(String folder, boolean recurse) drizzle/DrizzlePrp/src/gui/Gui.form
r1885 r1887 2971 2971 </Constraints> 2972 2972 </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> 2973 2995 </SubComponents> 2974 2996 </Container> drizzle/DrizzlePrp/src/gui/Gui.java
r1885 r1887 585 585 jButton109 = new javax.swing.JButton(); 586 586 jButton110 = new javax.swing.JButton(); 587 textfieldState29 = new shared.State.TextfieldState(); 588 textfieldState30 = new shared.State.TextfieldState(); 587 589 jPanel12 = new javax.swing.JPanel(); 588 590 jButton50 = new javax.swing.JButton(); … … 2505 2507 jButton110.setBounds(380, 160, 63, 36); 2506 2508 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 2507 2519 tabsState3.addTab("realMyst", jPanel10); 2508 2520 … … 4108 4120 //m.state.curstate.writeToFile = true; 4109 4121 4110 Vector<realmyst.Hsm> hsms = automation.realmyst.rea lAllHsms(outfol);4122 Vector<realmyst.Hsm> hsms = automation.realmyst.readAllHsms(outfol); 4111 4123 //automation.realmyst.save3dsFile(mdbs); 4112 4124 automation.realmyst.saveDdsFiles(hsms,"c:/hsmout"); … … 4115 4127 4116 4128 private 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(); 4118 4133 String[] searchstrs = { 4119 4134 //6910138.vdb … … 4160 4175 "myst..base_mountain" 4161 4176 }; 4177 searchstrs = searchstr.split(sep); 4178 //String[] searchstrs2 = new String[]{this.textfieldState29.getText()}; 4162 4179 Vector<File> files = filesearcher.search.getallfiles(folder, false); 4163 4180 for(File f: files) 4164 4181 { 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) 4167 4185 { 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 } 4171 4201 } 4172 4202 } … … 4178 4208 4179 4209 Vector<realmyst.Sdb> sdbs = automation.realmyst.readAllSdbs(outfol); 4180 String[] mystrooms = automation.realmyst.findRoomInfo(sdbs,"Myst");4181 4210 4182 4211 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); 4187 4217 4188 4218 }//GEN-LAST:event_jButton110ActionPerformed … … 4478 4508 private shared.State.TextfieldState textfieldState27; 4479 4509 private shared.State.TextfieldState textfieldState28; 4510 private shared.State.TextfieldState textfieldState29; 4480 4511 private shared.State.TextfieldState textfieldState3; 4512 private shared.State.TextfieldState textfieldState30; 4481 4513 private shared.State.TextfieldState textfieldState4; 4482 4514 private shared.State.TextfieldState textfieldState5; drizzle/DrizzlePrp/src/realmyst/Bstr.java
r1834 r1887 33 33 byte[] string; 34 34 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 } 35 49 public Bstr(IBytestream c) 36 50 { drizzle/DrizzlePrp/src/realmyst/Count2.java
r1848 r1887 31 31 public Bstr s4; 32 32 public byte b5; 33 public Bstr s6;33 public Bstr textureFilename; 34 34 public int u7; 35 35 36 //texture 36 37 public Count2(IBytestream c) //has hsm filename. 37 38 { … … 47 48 s4 = new Bstr(c); 48 49 b5 = c.readByte(); e.ensure((int)b5,0); 49 s6= new Bstr(c);50 textureFilename = new Bstr(c); 50 51 u7 = c.readInt(); //e.ensure(u7,0x800000,0x18800000,0x10800000,0x10900000,0x20800000,0x900000); 51 52 int dummy=0; drizzle/DrizzlePrp/src/realmyst/Count3Undone.java
r1850 r1887 27 27 int size; 28 28 29 int possibility; 29 public int possibility; 30 public int[] possibilities; 30 31 32 public StringAndByte sb2; 33 public StringAndByte[] sb3a; 34 public int u7; 35 public int u5; 36 public subcount3[] subs; 31 37 public static int numhandled=0; 32 38 public static int numignored=0; 33 39 40 //material, I think. 34 41 //sub_409d40, I think, because it reads a sub_40cb70 (4x4 matrix). 35 42 public Count3Undone(IBytestream c) … … 60 67 int u1 = c.readInt(); e.ensure(u1,1); 61 68 62 StringAndBytesb2 = new StringAndByte(c);69 sb2 = new StringAndByte(c); 63 70 //int bytecount = c.readInt(); 64 71 //if(bytecount>256) return; … … 76 83 // int dummy=0; 77 84 //} 78 StringAndByte[]sb3a = c.readArray(StringAndByte.class, u3);85 sb3a = c.readArray(StringAndByte.class, u3); 79 86 int u4 = c.readInt(); e.ensure(u4,3); 80 intu5 = c.readInt(); e.ensure(u5,0,1);87 u5 = c.readInt(); e.ensure(u5,0,1); 81 88 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 83 97 try{ 84 98 numignored++; 85 sub count3[] subs = c.readArray(subcount3.class, u7);99 subs = c.readArray(subcount3.class, u7); 86 100 numignored--; 87 101 numhandled++; … … 209 223 public static class subcount3 210 224 { 211 int esiPlus120;225 public int esiPlus120; 212 226 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; 213 240 214 241 public static int numignored = 0; … … 241 268 //m.msg("count3: u8b="+Integer.toString(u8b)+" u9="+Integer.toString(u9)); 242 269 //if(true)return; 243 Fltu14 = new Flt(c);244 Fltu15 = new Flt(c);270 u14 = new Flt(c); 271 u15 = new Flt(c); 245 272 if((u12&0x20)!=0) 246 273 { 247 Fltf200 = new Flt(c);274 f200 = new Flt(c); 248 275 int dummy=0; 249 276 } … … 258 285 if((esiPlus120&0x4000)!=0) 259 286 { 260 Fltf203 = 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 Fltf19 = new Flt(c); //often the previous ones are all 0.0 and this is 1.0267 Fltf20 = new Flt(c);268 Fltf21 = new Flt(c);269 Fltf22 = new Flt(c);270 Fltf23 = 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; 273 300 if((esiPlus120&0x10)!=0) 274 301 { drizzle/DrizzlePrp/src/realmyst/Idx.java
r1834 r1887 46 46 RoomIndex = new IdxBlock(c); 47 47 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; 48 59 //idxblocks = c.readArray(IdxBlock.class, blockcount); 49 60 //c.toString(); … … 95 106 indexes = c.readInts(indexcount); 96 107 } 108 109 public String toString() 110 { 111 return name.toString(); 112 } 97 113 } 98 114 } drizzle/DrizzlePrp/src/realmyst/Matrix.java
r1850 r1887 23 23 public class Matrix 24 24 { 25 Flt[][] values = new Flt[4][4];25 public Flt[][] values = new Flt[4][4]; 26 26 27 27 public Matrix(IBytestream c) drizzle/DrizzlePrp/src/realmyst/Mdb.java
r1847 r1887 31 31 public Sixlet start; 32 32 public Sixlet[] bunch; 33 public Quat[] quats; 33 34 public Face[] fs; 34 IntsIndex ii;35 IntsFullIndex ifi;35 public IntsIndex ii; 36 public IntsFullIndex ifi; 36 37 public wha[] whas; 37 38 public Vertex[] trips; 39 public Face[] fs2; 40 public int[] extra; 38 41 39 42 40 43 static Primary main; 44 public String sourceName; 41 45 public Mdb(IBytestream c) 42 46 { … … 46 50 { 47 51 int curfilenum = realmyst.rmcontext.get().curnum; 52 sourceName = c.sourceName; 48 53 49 54 //tag = c.readInt(); … … 56 61 filesize = c.readInt(); //filesize (including header) 57 62 u2 = c.readInt(); e.ensure(u2,1);//=1? 58 name = new Bstr(c );63 name = new Bstr(c,true); 59 64 String trap = 60 65 //"aurora..sn_TOWER_observe_roof01" 61 66 //"aurora..switchtube" 62 "aurora..boltref03" 67 //"aurora..boltref03" 68 //"myst..portfloor" 69 "myst..portstairstep" 63 70 ; 64 71 if(name.toString().toLowerCase().startsWith(trap.toLowerCase())) … … 113 120 int s2 = c.readInt(); //4 114 121 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. 116 123 if(s1!=2) 117 124 { … … 196 203 197 204 198 Face[] fs2=null;205 //Face[] fs2=null; 199 206 //if(u7!=267) 200 207 if(u7==1||u7==11||u7==9) … … 218 225 //int u33 = c.readInt(); //5 5 5 219 226 227 228 //maps faces to material indexes, use IntsFullIndex. 220 229 //IntsIndex: 221 230 int u26 = c.readInt(); 222 231 //int[] extra = c.readInts(u26-1); //n-1 extra ints. 223 232 //int u32 = c.readInt(); 224 int[]extra = c.readInts(u26);233 extra = c.readInts(u26); 225 234 226 235 //if(u7!=267) … … 246 255 public static class IntsFullIndex 247 256 { 248 int[] values;257 &
