diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c908016..d27e809 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -5,4 +5,7 @@ file(GLOB db_extractor_src "db_extractor/*")
add_executable(db_extractor ${db_extractor_src})
file(GLOB obj_extractor_src "obj_extractor/*")
-add_executable(obj_extractor ${obj_extractor_src})
\ No newline at end of file
+add_executable(obj_extractor ${obj_extractor_src})
+
+file(GLOB script2txt_src "script2txt/*")
+add_executable(script2txt ${script2txt_src})
diff --git a/src/obj_extractor/objects.h b/src/obj_extractor/objects.h
index 1701381..a0e377e 100644
--- a/src/obj_extractor/objects.h
+++ b/src/obj_extractor/objects.h
@@ -91,21 +91,23 @@ struct SegmentObjects : public Segment
}
};
+struct Vector4
+{
+ float x;
+ float y;
+ float z;
+ float w;
+};
+
struct Common
{
- float unk2[2];
- uint32_t unk3[2];
- float unk4[2];
- uint32_t unk5[2];
- float unk6[8];
+ Vector4 m_rotate_z[3];
+ Vector4 position;
void load(FILE *f)
{
- FREAD(unk2);
- FREAD(unk3);
- FREAD(unk4);
- FREAD(unk5);
- FREAD(unk6);
+ FREAD(m_rotate_z);
+ FREAD(position);
}
};
diff --git a/src/script2txt/script2txt.cpp b/src/script2txt/script2txt.cpp
new file mode 100644
index 0000000..c2cdc74
--- /dev/null
+++ b/src/script2txt/script2txt.cpp
@@ -0,0 +1,62 @@
+/*
+ * AIM script2txt
+ * Copyright (C) 2015 lzwdgc
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include
+#include
+
+using namespace std;
+
+int main(int argc, char *argv[])
+{
+ if (argc != 2)
+ {
+ cout << "Usage:\n" << argv[0] << " script.scr";
+ return 1;
+ }
+ string path = argv[1];
+ FILE *f = fopen(path.c_str(), "rb");
+ if (!f)
+ {
+ cout << "Cannot open the file: " << argv[1];
+ return 2;
+ }
+ uint32_t size = 0;
+ uint32_t dummy = 0;
+ fread(&size, sizeof(uint32_t), 1, f);
+ fread(&size, sizeof(uint32_t), 1, f);
+ fread(&size, sizeof(uint32_t), 1, f);
+ fread(&dummy, sizeof(uint32_t), 1, f);
+ string buf(size, 0);
+ fread(&buf[0], size, 1, f);
+ fclose(f);
+ path += ".txt";
+ f = fopen(path.c_str(), "w");
+ if (!f)
+ {
+ cout << "Cannot open the file: " << argv[1];
+ return 3;
+ }
+ const char *ptr = &buf[0];
+ while (ptr < &buf[0] + size)
+ {
+ fprintf(f, "%s\n", ptr);
+ ptr += strlen(ptr) + 1;
+ }
+ fclose(f);
+ return 0;
+}
\ No newline at end of file