From be3c17673ad861f3bfdbb62b9816d9ddfafb017f Mon Sep 17 00:00:00 2001 From: Colin Noga Date: Wed, 13 Jul 2011 13:15:37 -0500 Subject: Adding sprite spawner upgrade, and hammer bros throwing stuff --- src/growup.s | 5 +- src/spritespawner.cpp | 47 +-- src/spritetex.S | 1034 +++++++++++++++++++++++++++++-------------------- 3 files changed, 631 insertions(+), 455 deletions(-) mode change 100644 => 100755 src/growup.s mode change 100644 => 100755 src/spritespawner.cpp mode change 100644 => 100755 src/spritetex.S (limited to 'src') diff --git a/src/growup.s b/src/growup.s old mode 100644 new mode 100755 index f1cff50..724ee4c --- a/src/growup.s +++ b/src/growup.s @@ -1102,12 +1102,11 @@ PipeGeneratorSpawn: li r4, 0 blr + .global LakituBomb LakituBomb: - li r3, 0x85 - li r4, 0x3000 - slwi r4, r4, 16 + li r3, 0x33 blr diff --git a/src/spritespawner.cpp b/src/spritespawner.cpp old mode 100644 new mode 100755 index d9ee51a..7468bbb --- a/src/spritespawner.cpp +++ b/src/spritespawner.cpp @@ -14,7 +14,8 @@ struct SpriteSpawner { // Any variables you add to the class go here; starting at offset 0x3D0 u64 eventFlag; // 0x3D0 u16 type; // 0x3D4 - u8 lastEvState; // 0x3D6 + u32 inheritSet; // 0x3D6 + u8 lastEvState; // 0x3DA }; struct EventTable_t { @@ -43,42 +44,34 @@ void SpriteSpawner_Update(SpriteSpawner *self); bool SpriteSpawner_Create(SpriteSpawner *self) { OSReport("I exist, dammit!"); - char eventNum = (self->settings >> 24) & 0xFF; + char eventNum = (self->settings >> 28) & 0xF; + OSReport("Event to activate: %d", eventNum); + self->eventFlag = (u64)1 << (eventNum - 1); + self->type = (self->settings >> 16) & 0xFFF; - self->type = (self->settings) & 0xFFFF; - - self->lastEvState = 0xFF; - + short tempSet = self->settings & 0xFFFF; + self->inheritSet = (tempSet & 3) | ((tempSet & 0xC) << 2) | ((tempSet & 0x30) << 4) | ((tempSet & 0xC0) << 6) | ((tempSet & 0x300) << 8) | ((tempSet & 0xC00) << 10) | ((tempSet & 0x3000) << 12) | ((tempSet & 0xC000) << 14); + SpriteSpawner_Update(self); return true; } bool SpriteSpawner_Execute(SpriteSpawner *self) { + OSReport("Events: %08x%08x", EventTable->events >> 32, EventTable->events & 0xFFFFFFFF); SpriteSpawner_Update(self); return true; } void SpriteSpawner_Update(SpriteSpawner *self) { - - u8 newEvState = 0; - if (EventTable->events & self->eventFlag) - newEvState = 1; - - if (newEvState == self->lastEvState) - return; - - u8 offState; - if (newEvState == ACTIVATE) - { - offState = (newEvState == 1) ? 1 : 0; - + + if (EventTable->events & self->eventFlag) + { // Put an action for when the event turns on here - int spriteset = 0; VEC pos; pos.x = self->x; pos.y = self->y; @@ -86,16 +79,8 @@ void SpriteSpawner_Update(SpriteSpawner *self) { OSReport("Spawning Sprite: %d at %f,%f,%f\n", self->type, pos.x, pos.y, pos.z); - CreateActor(self->type, spriteset, pos, 0, 0); - } - - else - { - offState = (newEvState == 1) ? 0 : 1; - - // Put an action for when the event turns off here - + CreateActor(self->type, self->inheritSet, pos, 0, 0); + + EventTable->events = EventTable->events & ~self->eventFlag; } - - self->lastEvState = newEvState; } diff --git a/src/spritetex.S b/src/spritetex.S old mode 100644 new mode 100755 index 55c00af..c636943 --- a/src/spritetex.S +++ b/src/spritetex.S @@ -1,5 +1,5 @@ .extern sprintf -.extern GenerateRandomNumber +.extern GenerateRandomNumber #ifndef __MWERKS__ .set r0,0; .set r1,1; .set r2,2; .set r3,3; .set r4,4 @@ -27,10 +27,10 @@ GetTexFilenameForR5: stw r0, 0x24(sp) stw r3, 0x1C(sp) stw r4, 0x18(sp) - stw r6, 0x14(sp) - stw r7, 0x10(sp) - stw r8, 0xC(sp) - stw r9, 0x8(sp) + stw r6, 0x14(sp) + stw r7, 0x10(sp) + stw r8, 0xC(sp) + stw r9, 0x8(sp) lis r3, TexFilenameBuffer@h ori r3, r3, TexFilenameBuffer@l @@ -47,109 +47,109 @@ GetTexFilenameForR5: lwz r0, 0x24(sp) lwz r3, 0x1C(sp) lwz r4, 0x18(sp) - lwz r6, 0x14(sp) - lwz r7, 0x10(sp) - lwz r8, 0xC(sp) - lwz r9, 0x8(sp) + lwz r6, 0x14(sp) + lwz r7, 0x10(sp) + lwz r8, 0xC(sp) + lwz r9, 0x8(sp) mtlr r0 addi sp, sp, 0x20 blr -.global TEX_YoshiEggSetColour -TEX_YoshiEggSetColour: - +.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) - + 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) + 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: - + 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 - + 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 @@ -161,20 +161,20 @@ TEX_YoshiHack: 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) + lwz r6, 0x10(sp) + lwz r7, 0x0C(sp) + lwz r8, 0x08(sp) + lwz r9, 0x04(sp) mtlr r0 addi sp, sp, 0x30 blr - + @@ -200,8 +200,8 @@ TEX_Goomba: srwi r5, r5, 24 andi. r5, r5, 0xF b GetTexFilenameForR5 - - + + .global TEX_BigGoomba TEX_BigGoomba: lwz r5, 4(r30) @@ -279,8 +279,8 @@ TEX_Spiny: srwi r5, r5, 24 andi. r5, r5, 0xF b GetTexFilenameForR5 - - + + .global TEX_SpinyShell TEX_SpinyShell: lwz r5, 4(r3) @@ -309,7 +309,7 @@ TEX_Coaster: TEX_Koopa: lwz r5, 4(r29) srwi r5, r5, 24 - andi. r5, r5, 0xF + andi. r5, r5, 0xF b GetTexFilenameForR5 @@ -319,8 +319,8 @@ TEX_Gabon: srwi r5, r5, 24 andi. r5, r5, 0xF b GetTexFilenameForR5 - - + + .global TEX_Gabon_Spike TEX_Gabon_Spike: andis. r4, r4, 0xFFF0 @@ -353,18 +353,18 @@ TEX_Switch: .global TEX_WiggleShroom TEX_WiggleShroom: lwz r5, -0x520(r3) - # This sprite is pretty complex - # The register with THIS is r29 - # before the loading function, - # it passes it into r3, and then mr's - # it into r30. r3 is then overwritten. - # Then, it puts r31 into r5, r30 partly - # into r3 and partly into r4. Why? - # So, the possibilities for THIS are - # r30, r3, and r4, no? In the next function, - # r30 is stored over before our getFile, as - # are r29/r28. - + # This sprite is pretty complex + # The register with THIS is r29 + # before the loading function, + # it passes it into r3, and then mr's + # it into r30. r3 is then overwritten. + # Then, it puts r31 into r5, r30 partly + # into r3 and partly into r4. Why? + # So, the possibilities for THIS are + # r30, r3, and r4, no? In the next function, + # r30 is stored over before our getFile, as + # are r29/r28. + srwi r5, r5, 24 andi. r5, r5, 0xF b GetTexFilenameForR5 @@ -416,7 +416,7 @@ TEX_Bomb: srwi r5, r5, 24 andi. r5, r5, 0xF b GetTexFilenameForR5 - + .global TEX_ParaBomb TEX_ParaBomb: @@ -476,7 +476,7 @@ TEX_Boo: TEX_Midway: lwz r5, 4(r29) srwi r5, r5, 24 - andi. r5, r5, 0xFF + andi. r5, r5, 0xFF b GetTexFilenameForR5 @@ -492,10 +492,10 @@ TEX_Goal: TEX_StretchMush: lwz r5, 4(r30) srwi r5, r5, 24 - andi. r5, r5, 0xF + andi. r5, r5, 0xF b GetTexFilenameForR5 - - + + .global TEX_BlockSlide TEX_BlockSlide: lwz r5, 4(r28) @@ -513,91 +513,91 @@ TEX_Spinner: .global TEX_Platforms -TEX_Platforms: - - li r5, 1 +TEX_Platforms: + + li r5, 1 b GetTexFilenameForR5 -# cmpwi r0, 9 -# blt ReplacePlatforms -# -# lwzx r5, r5, r0 -# blr - - -ReplacePlatforms: - +# cmpwi r0, 9 +# blt ReplacePlatforms +# +# lwzx r5, r5, r0 +# blr + + +ReplacePlatforms: + lwz r5, 4(r29) srwi r5, r5, 4 andi. r5, r5, 0xF b GetTexFilenameForR5 - + .global TEX_Platform_ShifterH -TEX_Platform_ShifterH: - - stw r5, 0x504(r30) - lwz r5, 4(r30) - stw r5, 0x3D8(r30) - blr - +TEX_Platform_ShifterH: + + stw r5, 0x504(r30) + lwz r5, 4(r30) + stw r5, 0x3D8(r30) + blr + .global TEX_Platform_ShifterF -TEX_Platform_ShifterF: - - stw r4, 0x504(r30) - lwz r4, 4(r30) - stw r4, 0x3D8(r30) - blr - +TEX_Platform_ShifterF: + + stw r4, 0x504(r30) + lwz r4, 4(r30) + stw r4, 0x3D8(r30) + blr + .global TEX_Platform_ShifterL -TEX_Platform_ShifterL: - - stw r5, 0x504(r28) - lwz r5, 4(r28) - stw r5, 0x3D8(r28) - blr - +TEX_Platform_ShifterL: + + stw r5, 0x504(r28) + lwz r5, 4(r28) + stw r5, 0x3D8(r28) + blr + .global TEX_Platform_ShifterR -TEX_Platform_ShifterR: - - stw r4, 0x504(r31) - lwz r4, 4(r31) - stw r4, 0x3D8(r31) - blr - +TEX_Platform_ShifterR: + + stw r4, 0x504(r31) + lwz r4, 4(r31) + stw r4, 0x3D8(r31) + blr + .global TEX_Platform_ShifterS -TEX_Platform_ShifterS: - - stw r30, 0x4C4(r27) - lwz r30, 4(r27) - stw r30, 0x398(r27) - blr - +TEX_Platform_ShifterS: + + stw r30, 0x4C4(r27) + lwz r30, 4(r27) + stw r30, 0x398(r27) + blr + .global TEX_Platform_ShifterK -TEX_Platform_ShifterK: - - stw r4, 0x5A4(r27) - lwz r4, 4(r27) - stw r4, 0x478(r27) - blr - +TEX_Platform_ShifterK: + + stw r4, 0x5A4(r27) + lwz r4, 4(r27) + stw r4, 0x478(r27) + blr + .global TEX_Platform_ShifterW -TEX_Platform_ShifterW: - - stw r0, 0x504(r29) - lwz r0, 4(r29) - stw r0, 0x3D8(r29) - blr - +TEX_Platform_ShifterW: + + stw r0, 0x504(r29) + lwz r0, 4(r29) + stw r0, 0x3D8(r29) + blr + .global TEX_Platform_ShifterSL -TEX_Platform_ShifterSL: - - stw r4, 0x504(r29) - lwz r4, 4(r29) - stw r4, 0x3D8(r29) - blr - - - +TEX_Platform_ShifterSL: + + stw r4, 0x504(r29) + lwz r4, 4(r29) + stw r4, 0x3D8(r29) + blr + + + .global TEX_PokeyA TEX_PokeyA: @@ -611,199 +611,199 @@ TEX_PokeyA: TEX_PokeyB: lwz r5, 4(r29) srwi r5, r5, 24 - andi. r5, r5, 0xF - + andi. r5, r5, 0xF + b GetTexFilenameForR5 - - -.global TEX_PokeySnowman -TEX_PokeySnowman: - + + +.global TEX_PokeySnowman +TEX_PokeySnowman: + lwz r10, 4(r30) srwi r10, r10, 24 - andi. r10, r10, 0xF - - cmpwi r10, 0x2 - bne SnowmanPokey - - lwz r10, 4(r30) - # r10 is the current height - andi. r10, r10, 0xF - - # Find it - lis r11, SnowmanTable@h - ori r11, r11, SnowmanTable@l - slwi r10, r10, 2 # size *= 4 (size of float) - lfsx f0, r11, r10 # get it from the array - - blr - - -SnowmanPokey: - - lfs f0, 0x54(r31) + andi. r10, r10, 0xF + + cmpwi r10, 0x2 + bne SnowmanPokey + + lwz r10, 4(r30) + # r10 is the current height + andi. r10, r10, 0xF + + # Find it + lis r11, SnowmanTable@h + ori r11, r11, SnowmanTable@l + slwi r10, r10, 2 # size *= 4 (size of float) + lfsx f0, r11, r10 # get it from the array + blr - - - - -.global TEX_PokeySnowmanPosF -TEX_PokeySnowmanPosF: - - lwz r10, 4(r31) - andi. r10, r10, 0xF - - lis r11, SnowmanTable@h - ori r11, r11, SnowmanTable@l - slwi r10, r10, 2 # size *= 4 (size of float) - lfsx f2, r11, r10 # get it from the array - - fmuls f0, f0, f2 - stfs f0, 0xB0(r30) - blr - -.global TEX_PokeySnowmanPosE -TEX_PokeySnowmanPosE: - - lwz r10, 4(r31) - andi. r10, r10, 0xF - - lis r11, SnowmanTable@h - ori r11, r11, SnowmanTable@l - slwi r10, r10, 2 # size *= 4 (size of float) - lfsx f2, r11, r10 # get it from the array - - fmuls f31, f31, f2 - stfs f31, 0xB0(r29) - blr - -.global TEX_PokeySnowmanPosD -TEX_PokeySnowmanPosD: - - lwz r10, 4(r31) - andi. r10, r10, 0xF - - lis r11, SnowmanTable@h - ori r11, r11, SnowmanTable@l - slwi r10, r10, 2 # size *= 4 (size of float) - lfsx f2, r11, r10 # get it from the array - - fmuls f1, f1, f2 - stfs f1, 0xB0(r30) - blr - - -.global TEX_PokeySnowmanPosC -TEX_PokeySnowmanPosC: - - lwz r10, 4(r31) - andi. r10, r10, 0xF - - lis r11, SnowmanTable@h - ori r11, r11, SnowmanTable@l - slwi r10, r10, 2 # size *= 4 (size of float) - lfsx f2, r11, r10 # get it from the array - - fmuls f0, f0, f2 - stfs f0, 0xB0(r31) - blr - - -.global TEX_PokeySnowmanPosB -TEX_PokeySnowmanPosB: - - lwz r10, 4(r31) - andi. r10, r10, 0xF - - lis r11, SnowmanTable@h - ori r11, r11, SnowmanTable@l - slwi r10, r10, 2 # size *= 4 (size of float) - lfsx f0, r11, r10 # get it from the array - - fmuls f1, f1, f0 - stfs f1, 0x18(r1) - blr - - - -.global TEX_PokeySnowmanPosA -TEX_PokeySnowmanPosA: - - lwz r10, 4(r31) - andi. r10, r10, 0xF - - lis r11, SnowmanTable@h - ori r11, r11, SnowmanTable@l - slwi r10, r10, 2 # size *= 4 (size of float) - lfsx f0, r11, r10 # get it from the array - - fmuls f3, f3, f0 - stfs f3, 0x168(r31) - blr - - -.global TEX_PokeySnowmanPos -TEX_PokeySnowmanPos: - - mr r3, r30 - - lwz r10, 4(r30) - andi. r10, r10, 0xF - - lis r11, SnowmanTable@h - ori r11, r11, SnowmanTable@l - slwi r10, r10, 2 # size *= 4 (size of float) - lfsx f0, r11, r10 # get it from the array - - lis r5, AddAmount@h - ori r5, r5, AddAmount@l - slwi r6, r6, 2 # size *= 4 (size of float) - lfsx f3, r5, r6 # get it from the array - - lfs f2, 0xB0(r30) - fmuls f3, f3, f0 - fmuls f3, f3, f0 - fmuls f3, f3, f0 - fsubs f2, f2, f3 - stfs f2, 0xB0(r30) - - blr - -SnowmanPokeyPos: - - fsubs f0, f0, f31 - fsubs f0, f0, f31 - fsubs f1, f1, f31 - fsubs f1, f1, f31 - - - lfs f2, 8(r1) - fadds f2, f2, f31 - stfs f2, 8(r1) + + +SnowmanPokey: + + lfs f0, 0x54(r31) blr - + + + + +.global TEX_PokeySnowmanPosF +TEX_PokeySnowmanPosF: + + lwz r10, 4(r31) + andi. r10, r10, 0xF + + lis r11, SnowmanTable@h + ori r11, r11, SnowmanTable@l + slwi r10, r10, 2 # size *= 4 (size of float) + lfsx f2, r11, r10 # get it from the array + + fmuls f0, f0, f2 + stfs f0, 0xB0(r30) + blr + +.global TEX_PokeySnowmanPosE +TEX_PokeySnowmanPosE: + + lwz r10, 4(r31) + andi. r10, r10, 0xF + + lis r11, SnowmanTable@h + ori r11, r11, SnowmanTable@l + slwi r10, r10, 2 # size *= 4 (size of float) + lfsx f2, r11, r10 # get it from the array + + fmuls f31, f31, f2 + stfs f31, 0xB0(r29) + blr + +.global TEX_PokeySnowmanPosD +TEX_PokeySnowmanPosD: + + lwz r10, 4(r31) + andi. r10, r10, 0xF + + lis r11, SnowmanTable@h + ori r11, r11, SnowmanTable@l + slwi r10, r10, 2 # size *= 4 (size of float) + lfsx f2, r11, r10 # get it from the array + + fmuls f1, f1, f2 + stfs f1, 0xB0(r30) + blr + + +.global TEX_PokeySnowmanPosC +TEX_PokeySnowmanPosC: + + lwz r10, 4(r31) + andi. r10, r10, 0xF + + lis r11, SnowmanTable@h + ori r11, r11, SnowmanTable@l + slwi r10, r10, 2 # size *= 4 (size of float) + lfsx f2, r11, r10 # get it from the array + + fmuls f0, f0, f2 + stfs f0, 0xB0(r31) + blr + + +.global TEX_PokeySnowmanPosB +TEX_PokeySnowmanPosB: + + lwz r10, 4(r31) + andi. r10, r10, 0xF + + lis r11, SnowmanTable@h + ori r11, r11, SnowmanTable@l + slwi r10, r10, 2 # size *= 4 (size of float) + lfsx f0, r11, r10 # get it from the array + + fmuls f1, f1, f0 + stfs f1, 0x18(r1) + blr + + + +.global TEX_PokeySnowmanPosA +TEX_PokeySnowmanPosA: + + lwz r10, 4(r31) + andi. r10, r10, 0xF + + lis r11, SnowmanTable@h + ori r11, r11, SnowmanTable@l + slwi r10, r10, 2 # size *= 4 (size of float) + lfsx f0, r11, r10 # get it from the array + + fmuls f3, f3, f0 + stfs f3, 0x168(r31) + blr + + +.global TEX_PokeySnowmanPos +TEX_PokeySnowmanPos: + + mr r3, r30 + + lwz r10, 4(r30) + andi. r10, r10, 0xF + + lis r11, SnowmanTable@h + ori r11, r11, SnowmanTable@l + slwi r10, r10, 2 # size *= 4 (size of float) + lfsx f0, r11, r10 # get it from the array + + lis r5, AddAmount@h + ori r5, r5, AddAmount@l + slwi r6, r6, 2 # size *= 4 (size of float) + lfsx f3, r5, r6 # get it from the array + + lfs f2, 0xB0(r30) + fmuls f3, f3, f0 + fmuls f3, f3, f0 + fmuls f3, f3, f0 + fsubs f2, f2, f3 + stfs f2, 0xB0(r30) + + blr + +SnowmanPokeyPos: + + fsubs f0, f0, f31 + fsubs f0, f0, f31 + fsubs f1, f1, f31 + fsubs f1, f1, f31 + + + lfs f2, 8(r1) + fadds f2, f2, f31 + stfs f2, 8(r1) + blr + .global TEX_PokeyC TEX_PokeyC: - - lwz r5, 4(r30) - andis. r5, r5, 0xFFF0 + + lwz r5, 4(r30) + andis. r5, r5, 0xFFF0 or r5, r5, r31 or r5, r5, r0 - - lwz r0, 0x524(r30) - slwi r0, r0, 8 - or r5, r5, r0 - + + lwz r0, 0x524(r30) + slwi r0, r0, 8 + or r5, r5, r0 + blr - - + + .global TEX_PokeyNoSand TEX_PokeyNoSand: - cmpwi r3, 0x20 + cmpwi r3, 0x20 blr - - + + .global TEX_CloudBounce TEX_CloudBounce: @@ -811,74 +811,266 @@ TEX_CloudBounce: srwi r5, r5, 24 andi. r5, r5, 0xF b GetTexFilenameForR5 - - + + .global TEX_SpikeBall TEX_SpikeBall: lwz r5, 4(r30) srwi r5, r5, 24 andi. r5, r5, 0xF b GetTexFilenameForR5 + + +.global TEX_Huckit +TEX_Huckit: + lwz r5, 4(r29) + srwi r5, r5, 24 + andi. r5, r5, 0xF + b GetTexFilenameForR5 + + +.global TEX_HuckitBalls +TEX_HuckitBalls: + lwz r5, 4(r30) + srwi r5, r5, 24 + andi. r5, r5, 0xF + b GetTexFilenameForR5 + + + + + +.global HammerTime +HammerTime: + lwz r8, 4(r31) + srwi r8, r8, 8 + andi. r8, r8, 0xF + cmpwi r8, 1 + beq ThrowBobomb + cmpwi r8, 2 + beq ThrowGoomba + + cmpwi r8, 3 + beq ThrowSpiny + + cmpwi r8, 4 + beq ThrowCoin + + cmpwi r8, 5 + beq ThrowLemmyBall + blr -.data -TexFilenameBuffer: - .long 0,0,0,0 - -TexFormatString: - .string "g3d/t%02d.brres" -ConvertFloat: - .word 0x43300000,0x0,0x43300000,0x80000000 +ThrowBobomb: + li r3, 133 + lis r4, 0x3000 + ori r4, r4, 0x0041 + blr -.align 4 +ThrowGoomba: + li r3, 0x33 + li r4, 1 + blr + +ThrowSpiny: + li r3, 0x39 + li r4, 1 + blr -SnowmanTable: - .float 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5 +ThrowCoin: + li r3, 10 + mflr r8 + mr r9, r5 + bl GenerateRandomNumber + mr r5, r9 -AddAmount: - .float 32.0 + mtlr r8 + cmpwi r3, 1 + beq ThrowItem -.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 + li r3, 0x193 + li r4, 0 + li r6, 0 + li r7, 0 + blr + +ThrowItem: + li r3, 6 + mflr r8 + mr r9, r5 + bl GenerateRandomNumber + mtlr r8 + mr r5, r9 -YoshiStrings: - .long Y_TexGreen, Y_TexRed, Y_TexYellow, Y_TexBlue, Y_TexPurple, Y_TexOrange, Y_TexSkyBlue, Y_TexBlack, Y_TexWhite + li r4, 0 -.align 4 + mr r4, r3 + li r3, 0x3C + li r6, 0 + li r7, 0 + blr + + +ThrowLemmyBall: + li r3, 0x232 + li r4, 0 + blr + + +.global HammerLaunch +HammerLaunch: + mr r3, r30 + # r31 is the new actor currently + # r30 is self, all others are volatile + + lwz r5, 4(r30) + lwz r8, 0x348(r30) + + srwi r5, r5, 8 + andi. r5, r5, 0xF + + cmpwi r5, 0 + beqlr + + lis r7, LaunchAngle@h + ori r7, r7, LaunchAngle@l + +# lfs f0, 0(r7) +# stfs f0, 0xDC(r31) +# stfs f0, 0xE0(r31) +# stfs f0, 0xE4(r31) + + # Nybble 11 is for y right now + li r6, 0 + slwi r6, r6, 2 # size *= 4 (size of float) + lfsx f0, r7, r6 # get it from the array + + stfs f0, 0xEC(r31) + + cmpwi r5, 5 + beq LemmyLaunch + + li r6, 1 + slwi r6, r6, 2 # size *= 4 (size of float) + + cmpwi r8, 0 + bne FacingLeft + + # Nybble 12 is for x right now + lfsx f0, r7, r6 # get it from the array + + stfs f0, 0xE8(r31) + + blr + + +FacingLeft: + + lis r7, LaunchAngleLeft@h + ori r7, r7, LaunchAngleLeft@l + + # Nybble 12 is for x right now + lfsx f0, r7, r6 # get it from the array + + stfs f0, 0xE8(r31) + li r7, 270 + sth r7, 0x102(r31) + + blr + + +LemmyLaunch: + + li r6, 2 + slwi r6, r6, 2 # size *= 4 (size of float) + + cmpwi r8, 0 + bne FacingLeft + + # Nybble 12 is for x right now + lfsx f0, r7, r6 # get it from the array + + stfs f0, 0xE8(r31) + blr + + +.global HammerSpin +HammerSpin: +# sth r3, 0x100(r31) + blr + + + + +.data +TexFilenameBuffer: + .long 0,0,0,0 + +TexFormatString: + .string "g3d/t%02d.brres" + +ConvertFloat: + .word 0x43300000,0x0,0x43300000,0x80000000 + +.align 4 + +SnowmanTable: + .float 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5 + +AddAmount: + .float 32.0 + +LaunchAngle: + .float 4.0, 2.5, 1.5 + +LaunchAngleLeft: + .float -4.0, -2.5, -1.5 + + + +.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