Browse Source

line 3 is the same for type 0 and type 1, type 0 models(maps) now fully works

master
Gauvain "GovanifY" Roussel-Tarbouriech 1 year ago
parent
commit
ef4498c5ab
No account linked to committer's email address
1 changed files with 33 additions and 12 deletions
  1. 33
    12
      kh2vif.cpp

+ 33
- 12
kh2vif.cpp View File

@@ -31,7 +31,7 @@ int main(int argc, char *argv[]) {
31 31
     int vertices_arg = 0;
32 32
     int vertex_affiliation = 0;
33 33
 
34
-    int junk = 1;
34
+    int junk = 0;
35 35
     int map = 0;
36 36
     char *objname = argv[1];
37 37
     printf("kh2vif\n-- If you don't know what a VIF packet be prepared to be "
@@ -256,6 +256,11 @@ int main(int argc, char *argv[]) {
256 256
                 dsm_mem.push_back(line);
257 257
             }
258 258
             dsm_mem.push_back(".EndUnpack");
259
+        } else {
260
+            // For some reason this is only specified in maps, should look at
261
+            // how necessary this truly is later
262
+            dsm_mem.push_back(
263
+                "mscnt; We tell the game the microcode continues");
259 264
         }
260 265
         dsm_mem.push_back("vifnop");
261 266
         dsm_mem.push_back("vifnop; We wait for data to be kicked in");
@@ -269,20 +274,36 @@ int main(int argc, char *argv[]) {
269 274
     // h3: 1 not because 1 value but 1 array of 4, padding needs to be
270 275
     // checked!
271 276
 
272
-    line = ".int " + std::to_string(face_count * 3) + ", 4, " +
273
-           std::to_string(4 + (face_count * 3) + vertex_count) + ", " +
274
-           std::to_string(int(4 + (face_count * 3) + vertex_count +
275
-                              ceil(float(bones.size()) / 4))) +
276
-           "; Number of u+v+flag+index, their offset, offset of vertex "
277
-           "affiliation header, offset of mat definition(end)";
277
+    if (!map) {
278
+        line = ".int " + std::to_string(face_count * 3) + ", 4, " +
279
+               std::to_string(4 + (face_count * 3) + vertex_count) + ", " +
280
+               std::to_string(int(4 + (face_count * 3) + vertex_count +
281
+                                  ceil(float(bones.size()) / 4))) +
282
+               "; Number of u+v+flag+index, their offset, offset of vertex "
283
+               "affiliation header, offset of mat definition(end)";
284
+    } else {
285
+        line = ".int " + std::to_string(face_count * 3) +
286
+               ", 4, 0, 0; Number of u+v+flag+index, their offset, offset of "
287
+               "vertex "
288
+               "affiliation header, offset of mat definition(end)";
289
+    }
278 290
     dsm_mem[tmpheader] = line;
279 291
     dsm_mem[tmpheader + 1] =
280 292
         ".int 0, 0, 0, 0; Nobody care about vertices merging and colors";
281
-    line = ".int " + std::to_string(vertex_count) + ", " +
282
-           std::to_string(4 + (face_count * 3)) + ", 0, " +
283
-           std::to_string(bones.size()) +
284
-           "; Number of vertices, their offset, reserved and number of array "
285
-           "attribution";
293
+    if (!map) {
294
+        line =
295
+            ".int " + std::to_string(vertex_count) + ", " +
296
+            std::to_string(4 + (face_count * 3)) + ", 0, " +
297
+            std::to_string(bones.size()) +
298
+            "; Number of vertices, their offset, reserved and number of array "
299
+            "attribution";
300
+    } else {
301
+        line = ".int " + std::to_string(vertex_count) + ", " +
302
+               std::to_string(4 + (face_count * 3)) +
303
+               ", 0, 0; Number of vertices, their offset, reserved and number "
304
+               "of array "
305
+               "attribution";
306
+    }
286 307
     dsm_mem[tmpheader + 2] = line;
287 308
     line = "unpack[mr] V3_32, " + std::to_string(4 + (face_count * 3)) +
288 309
            ", *; Vertex definition";

Loading…
Cancel
Save