From a6df2167268ad72d9007126ba022eee481bd1d97 Mon Sep 17 00:00:00 2001 From: Treeki Date: Thu, 7 Apr 2011 20:54:38 +0200 Subject: cleaning up spritetex code --- spritetex.s | 185 -------------------------------------------------------- spritetex.yaml | 2 +- src/spritetex.S | 143 ++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 137 insertions(+), 193 deletions(-) delete mode 100644 spritetex.s diff --git a/spritetex.s b/spritetex.s deleted file mode 100644 index e5164de..0000000 --- a/spritetex.s +++ /dev/null @@ -1,185 +0,0 @@ -.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 - - -.global TEX_Koopa -TEX_Koopa: - lwz %r5, 4(%r30) - andi. r5, r5, 0xF - b GetTexFilenameForR5 - - -.global TEX_Gabon -TEX_Gabon: - lwz %r5, 4(%r30) - srwi %r5, %r5, 24 - andi. r5, r5, 0xF - b GetTexFilenameForR5 - - -.global TEX_Podoboo -TEX_Podoboo: - lwz %r5, 4(%r27) - srwi %r5, %r5, 24 - andi. r5, r5, 0xF - b GetTexFilenameForR5 - - -.global TEX_Switch -TEX_Switch: - lwz %r5, 4(%r30) - srwi %r5, %r5, 16 - andi. r5, r5, 0xF - b GetTexFilenameForR5 - - -.global TEX_WiggleShroom -TEX_WiggleShroom: - lwz %r5, 4(%r31) - srwi %r5, %r5, 24 - andi. r5, r5, 0xF - b GetTexFilenameForR5 - - diff --git a/spritetex.yaml b/spritetex.yaml index 2d909f0..aaa2a2d 100644 --- a/spritetex.yaml +++ b/spritetex.yaml @@ -1,5 +1,5 @@ --- -source_files: [spritetex.s] +source_files: [../src/spritetex.s] hooks: # - name: TEX_WoodBox # type: branch_insn diff --git a/src/spritetex.S b/src/spritetex.S index 681f763..65aeefc 100644 --- a/src/spritetex.S +++ b/src/spritetex.S @@ -20,25 +20,25 @@ 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) @@ -63,6 +63,135 @@ TEX_Bush: 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 + + +.global TEX_Koopa +TEX_Koopa: + lwz r5, 4(r30) + andi. r5, r5, 0xF + b GetTexFilenameForR5 + + +.global TEX_Gabon +TEX_Gabon: + lwz r5, 4(r30) + srwi r5, r5, 24 + andi. r5, r5, 0xF + b GetTexFilenameForR5 + + +.global TEX_Podoboo +TEX_Podoboo: + lwz r5, 4(r27) + srwi r5, r5, 24 + andi. r5, r5, 0xF + b GetTexFilenameForR5 + + +.global TEX_Switch +TEX_Switch: + lwz r5, 4(r30) + srwi r5, r5, 16 + andi. r5, r5, 0xF + b GetTexFilenameForR5 + + +.global TEX_WiggleShroom +TEX_WiggleShroom: + lwz r5, 4(r31) + srwi r5, r5, 24 + andi. r5, r5, 0xF + b GetTexFilenameForR5 + @@ -71,5 +200,5 @@ TexFilenameBuffer: .long 0,0,0,0 TexFormatString: - .string "g3d/t%02d.brres" + .string "g3d/t02d.brres" -- cgit v1.2.3