summaryrefslogtreecommitdiffstats
path: root/src/modelinfo/ModelIndices.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modelinfo/ModelIndices.cpp')
-rw-r--r--src/modelinfo/ModelIndices.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/modelinfo/ModelIndices.cpp b/src/modelinfo/ModelIndices.cpp
new file mode 100644
index 00000000..9a8aaead
--- /dev/null
+++ b/src/modelinfo/ModelIndices.cpp
@@ -0,0 +1,32 @@
+#include "common.h"
+#include "patcher.h"
+#include "ModelIndices.h"
+
+#define X(name, var, addr) int16 &var = *(int16*)addr;
+ MODELINDICES
+#undef X
+
+void
+InitModelIndices(void)
+{
+#define X(name, var, addr) var = -1;
+ MODELINDICES
+#undef X
+}
+
+void
+MatchModelString(const char *modelname, int16 id)
+{
+#define X(name, var, addr) \
+ if(strcmp(name, modelname) == 0){ \
+ var = id; \
+ return; \
+ }
+ MODELINDICES
+#undef X
+}
+
+STARTPATCHES
+ InjectHook(0x48EB60, InitModelIndices, PATCH_JUMP);
+ InjectHook(0x48F030, MatchModelString, PATCH_JUMP);
+ENDPATCHES