summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-10-20 22:19:59 +0200
committerTreeki <treeki@gmail.com>2012-10-20 22:19:59 +0200
commitec09fdfd64399c52ae492ac07dc6f84f9522965e (patch)
tree55333d1862bca026a3f8121904776c1ddcd17c6c /src
parent528bd247ac9be5f9f6f081359d797d9decb069db (diff)
downloadkamek-ec09fdfd64399c52ae492ac07dc6f84f9522965e.tar.gz
kamek-ec09fdfd64399c52ae492ac07dc6f84f9522965e.zip
fixed tileset fixer
Diffstat (limited to 'src')
-rw-r--r--src/tilesetfixer.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/tilesetfixer.cpp b/src/tilesetfixer.cpp
index 71bea9d..2fdb99e 100644
--- a/src/tilesetfixer.cpp
+++ b/src/tilesetfixer.cpp
@@ -3,14 +3,20 @@
const char *GetTilesetName(void *cls, int areaNum, int slotNum);
-void DoFixes(int slotNumber);
+void DoFixes(int areaNumber, int slotNumber);
void SwapObjData(u8 *data, int slotNumber);
+extern "C" void *OriginalTilesetLoadingThing(void *, void *, int, int);
+
// Main hook
-void TilesetFixerHack() {
- for (int i = 1; i < 4; i++) {
- DoFixes(i);
+void *TilesetFixerHack(void *cls, void *heap, int areaNum, int layerNum) {
+ if (layerNum == 0) {
+ for (int i = 1; i < 4; i++) {
+ DoFixes(areaNum, i);
+ }
}
+
+ return OriginalTilesetLoadingThing(cls, heap, areaNum, layerNum);
}
@@ -23,9 +29,9 @@ struct ObjLookupEntry {
};
-void DoFixes(int slotNumber) {
+void DoFixes(int areaNumber, int slotNumber) {
// This is where it all starts
- const char *tsName = GetTilesetName(BGDatClass, GetAreaNum(), slotNumber);
+ const char *tsName = GetTilesetName(BGDatClass, areaNumber, slotNumber);
if (tsName == 0 || tsName[0] == 0) {
return;