From 3b616a5f8b7d49c59c45f09b59c1129b43002f3d Mon Sep 17 00:00:00 2001
From: Treeki <treeki@gmail.com>
Date: Fri, 7 Sep 2012 21:20:15 +0200
Subject: untested retextures/re-effects/re-sounds for igapuku and tobipuku

---
 spritetex.yaml  | 66 ++++++++++++++++++++++++++++++++++++++++++++++
 src/spritetex.S | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 147 insertions(+)

diff --git a/spritetex.yaml b/spritetex.yaml
index d6d7ebf..88d0d55 100644
--- a/spritetex.yaml
+++ b/spritetex.yaml
@@ -641,3 +641,69 @@ hooks:
     src_addr_pal: 0x80887FB4
     target_func: 'ChangeWindyColour'
 
+
+  - name: TobiPukuBypass
+    type: branch_insn
+    branch_type: bl
+    src_addr_pal: 0x808BB34C
+    target_func: 'TobiPukuBypass'
+
+  - name: TEX_TobiPuku
+    type: branch_insn
+    branch_type: bl
+    src_addr_pal: 0x80AB2288
+    target_func: 'TEX_TobiPuku'
+
+  - name: TobiPukuSoundChangeB
+    type: branch_insn
+    branch_type: bl
+    src_addr_pal: 0x80AB2648
+    target_func: 'TobiPukuSoundChange'
+
+  - name: TobiPukuSoundChange
+    type: branch_insn
+    branch_type: bl
+    src_addr_pal: 0x80AB2690
+    target_func: 'TobiPukuSoundChange'
+
+  - name: TobiPukuEffectChange
+    type: branch_insn
+    branch_type: bl
+    src_addr_pal: 0x80AB2618
+    target_func: 'TobiPukuEffectChange'
+
+
+  - name: IgaPukuBypass
+    type: branch_insn
+    branch_type: bl
+    src_addr_pal: 0x80ABC0C0
+    target_func: 'IgaPukuBypass'
+
+  - name: TEX_IgaPuku
+    type: branch_insn
+    branch_type: bl
+    src_addr_pal: 0x80AB2288
+    target_func: 'TEX_IgaPuku'
+
+
+  - name: IgaPukuNoEffect1
+    type: branch_insn
+    branch_type: bl
+    src_addr_pal: 0x80A251BC
+    target_func: 'IgaPukuNoEffect1'
+
+  - name: IgaPukuChangeEffect2
+    type: branch_insn
+    branch_type: bl
+    src_addr_pal: 0x80A251E8
+    target_func: 'IgaPukuChangeEffect2'
+
+
+  - name: IgaPukuSoundChange
+    type: branch_insn
+    branch_type: bl
+    src_addr_pal: 0x80A25238
+    target_func: 'IgaPukuSoundChange'
+
+
+
diff --git a/src/spritetex.S b/src/spritetex.S
index cd7d169..692a381 100755
--- a/src/spritetex.S
+++ b/src/spritetex.S
@@ -193,6 +193,85 @@ TEX_Bush:
 	b GetTexFilenameForR5
 
 
+.global TEX_TobiPuku
+TEX_TobiPuku:
+	lwz r5, 4(r28)
+	andi. r5, r5, 0xF
+	b GetTexFilenameForR5
+
+.global TobiPukuBypass
+TobiPukuBypass:
+	slwi r4, r30, 28
+	lwz r5, 4(r29)
+	clrlwi r5, r5, 28
+	or r4, r4, r5
+	blr
+
+.global TobiPukuEffectChange
+TobiPukuEffectChange:
+	lwz r9, 4(r30)
+	clrlwi r9, r9, 28
+	cmpwi r9, 1
+	bne dontChangeEff_
+	lis r4, magmawave@h
+	ori r4, r4, magmawave@l
+dontChangeEff_:
+	bctr
+
+.data
+magmawave: .string "Wm_en_magmawave"
+.text
+
+.global TobiPukuSoundChange
+TobiPukuSoundChange:
+	lwz r9, 4(r30)
+	clrlwi r9, r9, 28
+	cmpwi r9, 1
+	li r4, 644
+	beqlr
+	li r4, 476
+	blr
+
+.global IgaPukuBypass
+IgaPukuBypass:
+	lwz r4, 4(r29)
+	clrrwi r4, r4, 24
+	ori r4, r4, 0x10
+	blr
+
+.global IgaPukuNoEffect1
+IgaPukuNoEffect1:
+	lwz r9, 4(r29)
+	srwi r9, r9, 24
+	cmpwi r9, 1
+	beqlr
+	bctr
+
+.global IgaPukuChangeEffect2
+IgaPukuChangeEffect2:
+	lwz r9, 4(r29)
+	srwi r9, r9, 24
+	cmpwi r9, 1
+	bne dontChangeEff
+	lis r4, firepillarsign@h
+	ori r4, r4, firepillarsign@l
+dontChangeEff:
+	bctr
+
+.data
+firepillarsign: .string "Wm_ob_firespillarunder"
+.text
+
+.global IgaPukuSoundChange
+IgaPukuSoundChange:
+	lwz r9, 4(r29)
+	srwi r9, r9, 24
+	cmpwi r9, 1
+	li r4, 479
+	bnelr
+	li r4, 644
+	blr
+
 # The below was added by Tempus
 
 
@@ -264,6 +343,8 @@ TEX_CheepChomp:
 TEX_PokeyB:
 .global TEX_Huckit
 TEX_Huckit:
+.global TEX_IgaPuku
+TEX_IgaPuku:
 	lwz r5, 4(r29)
 	srwi r5, r5, 24
 	andi. r5, r5, 0xF
-- 
cgit v1.2.3


From 580de9e9de67983a7a7908e4395046f3ae6e5be3 Mon Sep 17 00:00:00 2001
From: Treeki <treeki@gmail.com>
Date: Mon, 10 Sep 2012 22:42:39 +0200
Subject: behind Layer2 z-order for magic platforms

---
 src/magicplatform.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/magicplatform.cpp b/src/magicplatform.cpp
index 4997945..e4f3dc0 100644
--- a/src/magicplatform.cpp
+++ b/src/magicplatform.cpp
@@ -141,6 +141,11 @@ int daEnMagicPlatform_c::onCreate() {
 
 	doesMoveInfinitely = (settings & 0x10000000);
 
+	if (settings & 0xE0000000) {
+		int putItBehind = settings >> 29;
+		pos.z = -3600.0f - (putItBehind * 16);
+	}
+
 	setupMovement();
 
 	findSourceArea();
-- 
cgit v1.2.3