summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorColin Noga <Tempus@Spectrum-Song.local>2011-05-16 12:25:12 -0500
committerColin Noga <Tempus@Spectrum-Song.local>2011-05-16 12:25:12 -0500
commitb01edd3af9ccfdb05bbed628b1824779d2a59171 (patch)
tree5fca89195cc6f3a343c78b5678dae2a095d25790 /src
parent7c5d2a4dd2a81282c38a6bbddacb3fe9c12808c4 (diff)
parent92541f002c9db098323bfdc544b18a89ae5da61c (diff)
downloadkamek-b01edd3af9ccfdb05bbed628b1824779d2a59171.tar.gz
kamek-b01edd3af9ccfdb05bbed628b1824779d2a59171.zip
Merge branch 'level-select' of treeki:newergit/Kamek into level-select
Diffstat (limited to '')
-rw-r--r--src/switchblock.S72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/switchblock.S b/src/switchblock.S
new file mode 100644
index 0000000..f219ee4
--- /dev/null
+++ b/src/switchblock.S
@@ -0,0 +1,72 @@
+.text
+
+#ifndef __MWERKS__
+.set r0,0; .set r1,1; .set r2,2; .set r3,3; .set r4,4
+.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9
+.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14
+.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19
+.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24
+.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29
+.set r30,30; .set r31,31; .set f0,0; .set f2,2; .set f3,3
+#endif
+
+.align 4
+.extern GameMgr
+.extern BG_GM_ptr
+
+.global BG_GM_InitRedSwitchFlag_Patch
+BG_GM_InitRedSwitchFlag_Patch:
+ lis r5, GameMgr@h
+ ori r5, r5, GameMgr@l
+ lwz r5, 0(r5)
+
+ addis r4, r3, 9
+ lbz r0, 0x380(r5)
+ stb r0, 0xAA8(r4)
+ blr
+
+.global ProcessTileNum_EndPatch
+ProcessTileNum_EndPatch:
+ lis r5, BG_GM_ptr@h
+ ori r5, r5, BG_GM_ptr@l
+ lwz r5, 0(r5)
+ addis r5, r5, 9
+ lbz r5, 0xAA8(r3)
+
+ cmplwi r30, 0x58
+ bne not_red
+ andi. r3, r5, 1
+ beq not_red
+ li r3, 0x57
+ b ptnReturn
+not_red:
+ cmplwi r30, 0x5A
+ bne not_green
+ andi. r3, r5, 2
+ beq not_green
+ li r3, 0x59
+ b ptnReturn
+not_green:
+ cmplwi r30, 0x56
+ bne not_yellow
+ andi. r3, r5, 4
+ beq not_yellow
+ li r3, 0x55
+ b ptnReturn
+not_yellow:
+ cmplwi r30, 0x54
+ bne not_blue
+ andi. r3, r5, 8
+ beq not_blue
+ li r3, 0x53
+ b ptnReturn
+not_blue:
+ mr r3, r30
+ptnReturn:
+ lwz r0, 0x14(r1)
+ lwz r31, 0xC(r1)
+ lwz r30, 0x8(r1)
+ mtlr r0
+ addi sp, sp, 0x10
+ blr
+