From 86b23638c773f42f1b7c56adb31eb16d1c417913 Mon Sep 17 00:00:00 2001 From: Colin Noga Date: Sun, 26 Jun 2011 11:18:52 -0500 Subject: Trying again to merge changes --- NewerProject.yaml | 2 + kamek_pal.x | 2 +- spritetex.yaml | 57 ++++++++++++++++++++ src/spritetex.S | 159 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 219 insertions(+), 1 deletion(-) diff --git a/NewerProject.yaml b/NewerProject.yaml index 367d0c5..4f95d8d 100644 --- a/NewerProject.yaml +++ b/NewerProject.yaml @@ -18,3 +18,5 @@ modules: # - processed/replay.yaml - processed/growup.yaml - processed/levelspecial.yaml + - processed/eventlooper.yaml + - processed/spritespawner.yaml diff --git a/kamek_pal.x b/kamek_pal.x index f3da9bf..d255c9a 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -15,7 +15,7 @@ SECTIONS { MarioSize = 0x8042BB54; AlwaysDrawFlag = 0x80064540; AlwaysDrawBranch = 0x80064544; - + GenerateRandomNumber = 0x800B2EE0; _savefpr_14 = 0x802DCF98; _savefpr_15 = 0x802DCF9C; diff --git a/spritetex.yaml b/spritetex.yaml index a9c107c..4d49a8a 100644 --- a/spritetex.yaml +++ b/spritetex.yaml @@ -477,3 +477,60 @@ hooks: src_addr_pal: 0x80AB6054 target_func: 'TEX_SpikeBall' + + + + + + + + + + + + - name: TEX_YoshiEggSetColour + type: branch_insn + branch_type: bl + src_addr_pal: 0x80911050 + target_func: 'TEX_YoshiEggSetColour' + + - name: TEX_YoshiEggSetBrres + type: branch_insn + branch_type: bl + src_addr_pal: 0x809113D0 + target_func: 'TEX_YoshiEggSetBrres' + + - name: TEX_YoshiEggSetFrame + type: branch_insn + branch_type: bl + src_addr_pal: 0x809114B4 + target_func: 'TEX_YoshiEggSetFrame' + + - name: TEX_YoshiEggEffect + type: branch_insn + branch_type: bl + src_addr_pal: 0x80911658 + target_func: 'TEX_YoshiEggEffect' + + - name: TEX_YoshiSetColour + type: branch_insn + branch_type: bl + src_addr_pal: 0x8005E9C8 + target_func: 'TEX_YoshiSetColour' + + - name: TEX_YoshiHack + type: branch_insn + branch_type: bl + src_addr_pal: 0x800FE58C + target_func: 'TEX_YoshiHack' + + - name: TEX_YoshiColourOrderA + type: patch + data: '3F8000004000000040400000' + addr_pal: 0x8093DAB4 + + - name: TEX_YoshiColourOrderB + type: patch + data: '00000003000000010000000200000000' + addr_pal: 0x8093DAD8 + diff --git a/src/spritetex.S b/src/spritetex.S index bf7a02f..55c00af 100644 --- a/src/spritetex.S +++ b/src/spritetex.S @@ -1,4 +1,5 @@ .extern sprintf +.extern GenerateRandomNumber #ifndef __MWERKS__ .set r0,0; .set r1,1; .set r2,2; .set r3,3; .set r4,4 @@ -55,6 +56,125 @@ GetTexFilenameForR5: blr +.global TEX_YoshiEggSetColour +TEX_YoshiEggSetColour: + + stwu sp, -0x30(sp) + mflr r0 + stw r0, 0x24(sp) + mr r9, r3 + stw r4, 0x18(sp) + stw r5, 0x14(sp) + stw r6, 0x10(sp) + stw r7, 0x0C(sp) + + li r3, 10 + bl GenerateRandomNumber + stw r3, 0x5F8(r9) + + lwz r0, 0x24(sp) + mr r3, r9 + lwz r4, 0x18(sp) + lwz r5, 0x14(sp) + lwz r6, 0x10(sp) + lwz r7, 0x0C(sp) + mtlr r0 + addi sp, sp, 0x30 + blr + + +.global TEX_YoshiEggSetBrres +TEX_YoshiEggSetBrres: + + lwz r5, 0x5F8(r27) + clrlwi r5, r5, 28 + + cmpwi r5, 4 + blt YoshiEggOne + + cmpwi r5, 8 + blt YoshiEggTwo + + li r5, 2 + b GetTexFilenameForR5 + + +YoshiEggOne: + li r5, 0 + b GetTexFilenameForR5 + +YoshiEggTwo: + li r5, 1 + b GetTexFilenameForR5 + + + +.global TEX_YoshiEggSetFrame +TEX_YoshiEggSetFrame: + + lwz r5, 0x5F8(r27) + clrlwi r5, r5, 30 + blr + + +.global TEX_YoshiEggEffect +TEX_YoshiEggEffect: + + lwz r0, 0x5F8(r3) + clrlwi r0, r0, 30 + blr + + +.global TEX_YoshiSetColour +TEX_YoshiSetColour: + + lwz r4, 0x5F8(r31) + oris r4, r4, 1 + blr + + +.global TEX_YoshiHack +TEX_YoshiHack: + + stwu sp, -0x30(sp) + mflr r0 + stw r0, 0x24(sp) + stw r3, 0x1C(sp) + stw r4, 0x18(sp) + stw r5, 0x14(sp) + stw r6, 0x10(sp) + stw r7, 0x0C(sp) + stw r8, 0x08(sp) + stw r9, 0x04(sp) + + lwz r5, 0x24C(r31) + clrlwi r5, r5, 28 + + 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 + + lis r4, YoshiArc@h + ori r4, r4, YoshiArc@l + + lwz r0, 0x24(sp) + lwz r3, 0x1C(sp) + lwz r6, 0x10(sp) + lwz r7, 0x0C(sp) + lwz r8, 0x08(sp) + lwz r9, 0x04(sp) + mtlr r0 + addi sp, sp, 0x30 + blr + @@ -723,3 +843,42 @@ AddAmount: .float 32.0 .align 4 + +YoshiArc: + .string "Y_TexGreen" +.align 4 + +Y_TexGreen: + .string "Y_TexGreen" +.align 4 +Y_TexRed: + .string "Y_TexRed" +.align 4 +Y_TexYellow: + .string "Y_TexYellow" +.align 4 +Y_TexBlue: + .string "Y_TexBlue" +.align 4 +Y_TexPurple: + .string "Y_TexPurple" +.align 4 +Y_TexOrange: + .string "Y_TexOrange" +.align 4 +Y_TexSkyBlue: + .string "Y_TexSkyBlue" +.align 4 +Y_TexBlack: + .string "Y_TexBlack" +.align 4 +Y_TexWhite: + .string "Y_TexWhite" +.align 4 + +YoshiStrings: + .long Y_TexGreen, Y_TexRed, Y_TexYellow, Y_TexBlue, Y_TexPurple, Y_TexOrange, Y_TexSkyBlue, Y_TexBlack, Y_TexWhite + +.align 4 + + -- cgit v1.2.3