diff options
author | Stephen Simpson <megazig@gmail.com> | 2011-10-10 16:12:27 -0500 |
---|---|---|
committer | Stephen Simpson <megazig@gmail.com> | 2011-10-10 16:12:27 -0500 |
commit | 5f3eca3f6074605272b7bdde4a685d2f0934d6a7 (patch) | |
tree | 858805a7c4f495e202a5e954c7a320db57e83da1 /src/soundPlayer.S | |
parent | a61758720db96f59e0fb82aab9f326d37e186a11 (diff) | |
parent | c83ed47633a037acd6cdab7d37087bca5edd6daa (diff) | |
download | kamek-5f3eca3f6074605272b7bdde4a685d2f0934d6a7.tar.gz kamek-5f3eca3f6074605272b7bdde4a685d2f0934d6a7.zip |
Merge branch 'level-select' of ssh://treeki.shacknet.nu:30000/Kamek into level-select
Diffstat (limited to 'src/soundPlayer.S')
-rw-r--r-- | src/soundPlayer.S | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/src/soundPlayer.S b/src/soundPlayer.S new file mode 100644 index 0000000..0fa028a --- /dev/null +++ b/src/soundPlayer.S @@ -0,0 +1,85 @@ +#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 f1,1; .set f2,2 +.set f3,3; .set f4,4; .set f5,5; .set f6,6; .set f8,8 +.set f31,31; .set f30,30 +#endif + + +.text + +.extern OSReport +.extern Actor_GetVec3WithValuesAdded +.extern ConvertStagePositionIntoScreenPosition__Maybe +.extern AnotherSoundRelatedFunction +.extern YetAnotherSoundPlayer +.extern CheckIfPlayingSound +.extern StopSound + +.align 4 + + + +# PlaySound(dActor_c *, int soundID) +# There's somehardcoding in here, might need to fix that for NTSC versions. + + +.global PlaySound +PlaySound: + stwu r1, -0x30(r1) + mflr r0 + mr r20, r4 + + # Gets Player Position + mr r4, r3 # object + stw r0, 0x34(r1) + addi r3, r1, 0x10 # dest + stw r31, 0x2C(r1) + bl Actor_GetVec3WithValuesAdded + + # Gives an accurate position for the sound + lwz r31, -0x5944(r13) + addi r3, r1, 8 + addi r4, r1, 0x10 + bl ConvertStagePositionIntoScreenPosition__Maybe + + # Checks if the passed sound is already playing + lis r4, 0x8043 + lwz r3, 0xA768(r4) + mr r4, r20 + bl CheckIfPlayingSound + + # Go away if it is + cmpwi r3, 0 + bne GoAwaySoundGuy + + # If we're good to go, play the sound! + mr r3, r31 + addi r5, r1, 8 + mr r4, r20 + li r6, 0 + bl YetAnotherSoundPlayer + + b GoAwaySoundGuy + + + +GoAwaySoundGuy: + lwz r0, 0x34(r1) + lwz r31, 0x2C(r1) + mtlr r0 + addi r1, r1, 0x30 + blr + + +.global StopSound +StopSound: + + lwz r3, 0xA768(r13) + b StopSound +
\ No newline at end of file |