summaryrefslogtreecommitdiff
path: root/spritetex.s
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--spritetex.s144
1 files changed, 144 insertions, 0 deletions
diff --git a/spritetex.s b/spritetex.s
new file mode 100644
index 0000000..fc66898
--- /dev/null
+++ b/spritetex.s
@@ -0,0 +1,144 @@
+.align 4
+.global GetTexFilenameForR5, TexFilenameBuffer, TexFormatString
+GetTexFilenameForR5:
+ # obj number should be put into r5
+ # returned filename is in r5
+ # this makes it easy to use with dRes_c::GetResource
+
+ stwu %sp, -0x10(%sp)
+ mflr %r0
+ stw %r0, 0x14(%sp)
+ stw %r3, 0xC(%sp)
+ stw %r4, 0x8(%sp)
+
+ lis %r3, TexFilenameBuffer@h
+ ori %r3, %r3, TexFilenameBuffer@l
+
+ lis %r4, TexFormatString@h
+ ori %r4, %r4, TexFormatString@l
+
+ crclr 4*cr1+eq
+ bl sprintf
+
+ lis %r5, TexFilenameBuffer@h
+ ori %r5, %r5, TexFilenameBuffer@l
+
+ lwz %r0, 0x14(%sp)
+ lwz %r3, 0xC(%sp)
+ lwz %r4, 0x8(%sp)
+ mtlr %r0
+ addi %sp, %sp, 0x10
+ blr
+
+
+TexFilenameBuffer:
+ .long 0,0,0,0
+
+TexFormatString:
+ .string "g3d/t%02d.brres"
+
+
+
+.global TEX_WoodBox
+TEX_WoodBox:
+ lwz %r5, 4(%r30)
+ srwi %r5, %r5, 24
+ b GetTexFilenameForR5
+
+
+.global TEX_Bush
+TEX_Bush:
+ srwi %r5, %r27, 28
+ b GetTexFilenameForR5
+
+
+
+# The below was added by Tempus
+
+
+.global TEX_Goomba
+TEX_Goomba:
+ lwz %r5, 4(%r3)
+ srwi %r5, %r5, 24
+ andi. r5, r5, 0xF
+ b GetTexFilenameForR5
+
+
+.global TEX_Barrel
+TEX_Barrel:
+ lwz %r5, 4(%r30)
+ srwi %r5, %r5, 24
+ andi. r5, r5, 0xF
+ b GetTexFilenameForR5
+
+
+.global TEX_Blooper
+TEX_Blooper:
+ lwz %r5, 4(%r30)
+ srwi %r5, %r5, 24
+ andi. r5, r5, 0xF
+ b GetTexFilenameForR5
+
+
+.global TEX_BigBlock
+TEX_BigBlock:
+ lwz %r5, 4(%r30)
+ srwi %r5, %r5, 24
+ andi. r5, r5, 0xF
+ b GetTexFilenameForR5
+
+
+.global TEX_Thwomp
+TEX_Thwomp:
+ lwz %r5, 4(%r30)
+ srwi %r5, %r5, 24
+ andi. r5, r5, 0xF
+ b GetTexFilenameForR5
+
+
+.global TEX_GiantBuzzy
+TEX_GiantBuzzy:
+ lwz %r5, 4(%r30)
+ srwi %r5, %r5, 24
+ andi. r5, r5, 0xF
+ b GetTexFilenameForR5
+
+
+.global TEX_Buzzy
+TEX_Buzzy:
+ lwz %r5, 4(%r30)
+ srwi %r5, %r5, 24
+ andi. r5, r5, 0xF
+ b GetTexFilenameForR5
+
+
+.global TEX_SpikeTop
+TEX_SpikeTop:
+ lwz %r5, 4(%r30)
+ srwi %r5, %r5, 24
+ andi. r5, r5, 0xF
+ b GetTexFilenameForR5
+
+
+.global TEX_Spiny
+TEX_Spiny:
+ lwz %r5, 4(%r31)
+ srwi %r5, %r5, 24
+ andi. r5, r5, 0xF
+ b GetTexFilenameForR5
+
+
+.global TEX_SpringBlock
+TEX_SpringBlock:
+ lwz %r5, 4(%r31)
+ srwi %r5, %r5, 24
+ andi. r5, r5, 0xF
+ b GetTexFilenameForR5
+
+
+.global TEX_Coaster
+TEX_Coaster:
+ lwz %r5, 4(%r5)
+ srwi %r5, %r5, 24
+ andi. r5, r5, 0xF
+ b GetTexFilenameForR5