From d20c8d5d313e6c845ccd91554661bbfd1eb75d0d Mon Sep 17 00:00:00 2001 From: Kara Alexandra Date: Wed, 15 Mar 2023 22:06:02 -0500 Subject: [PATCH] Initial trolls: - random dash timer - random bomb timer - flute sometimes summons chickens - ice physics while carrying things - lowered i-frames with increased hearts/armor - Blind impervious (TODO: allow hitting with bunny pots) --- LTTP_RND_GeneralBugfixes.asm | 1 + cuccostorm.asm | 6 ++- data/damage_table.bin | Bin 2048 -> 2048 bytes hooks.asm | 33 ++++++++++++++--- special_weapons.asm | 6 ++- swordswap.asm | 6 +++ trolls.asm | 70 +++++++++++++++++++++++++++++++++++ 7 files changed, 115 insertions(+), 7 deletions(-) create mode 100644 trolls.asm diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index ea21b89..a30a74c 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -158,6 +158,7 @@ incsrc msu.asm incsrc dungeonmap.asm incsrc special_weapons.asm incsrc variable_ganon_vulnerability.asm +incsrc trolls.asm if !FEATURE_NEW_TEXT incsrc textrenderer.asm endif diff --git a/cuccostorm.asm b/cuccostorm.asm index 1ffbd5c..17a9133 100644 --- a/cuccostorm.asm +++ b/cuccostorm.asm @@ -9,7 +9,11 @@ CuccoStorm: SEP #$30 ; set 8-bit accumulator index registers LDA.l CuccoStormer : BEQ + ; only if storm is on - LDA.b GameMode : CMP.b #$09 : BNE + ; only if outdoors + LDA.b GameMode : CMP.b #$09 : BNE .check ; only if outdoors + .indoors + LDA.b #$00 : STA.l CuccoStormer ; turn off cucco storm if indoors + BRA + + .check LDA.l LoopFrames : AND.b #$7F : BNE + ; check every 128 frames - diff --git a/data/damage_table.bin b/data/damage_table.bin index fe0d0465f40829219ca48e7091286fd8da03960b..5860da15baa6b6c32d409b4825dcfa97406eff3f 100644 GIT binary patch delta 16 XcmZn=Xb{*?z{bqL$gsJXt(Or1B(?+v delta 16 XcmZn=Xb{*?z{bodD7d+pt(Or1C6ojw diff --git a/hooks.asm b/hooks.asm index 3645958..9639120 100644 --- a/hooks.asm +++ b/hooks.asm @@ -2014,11 +2014,11 @@ JSL.l Overworld_LoadNewTiles : NOP #$02 org $02EC2E ;<- 016C2E JSL.l Overworld_LoadNewTiles : NOP #$02 ;================================================================================ -org $07A3E2 ;<- 3A3E2 Bank07.asm:5764 (LDA.b #$80 : STA $03F0) -JSL.l FreeDuckCheck : BEQ + - NOP - skip 3 ; a JSR we need to keep -+ +; org $07A3E2 ;<- 3A3E2 Bank07.asm:5764 (LDA.b #$80 : STA $03F0) +; JSL.l FreeDuckCheck : BEQ + +; NOP +; skip 3 ; a JSR we need to keep +; + ;================================================================================ org $07A9AC ; <- 3A9AC - Bank07.asm:6628 (LDA $0C : ORA $0E : STA $00 : AND.b #$0C : BEQ BRANCH_BETA) JML.l MirrorBonk @@ -2623,3 +2623,26 @@ JSL.l TransferVRAMStripes ;=================================================================================================== org $9BF029+1 : db $10 +;-------------------------------------------------------------------------------- +; Various nonsense +;-------------------------------------------------------------------------------- +org $0780B9 ; LDA.b #$3A : STA.w $031F +JSL CalcIFrames +NOP + +org $09814E ; LDA.w Bomb_timer : STA.w $039F, X +JSL SetBombTimer +NOP #2 + +org $07B282 ; LDA.b #$1D : STA.w $0374 +JSL SetDashTimer +NOP + +org $07A3E7 ; LDA.b #$13 : JSR PlaySFX_Set2 : ... +JSL ProcessFlute +BCS + +RTS +NOP #14 : + + +org $08E073 ; LDA.b #$0E : STA.b $10 +JSL FluteMap diff --git a/special_weapons.asm b/special_weapons.asm index d46184b..548573e 100644 --- a/special_weapons.asm +++ b/special_weapons.asm @@ -274,7 +274,8 @@ Utility_CheckHammerHelmasaurKingMask: RTL ;-------------------------------------------------------------------------------- Utility_CheckImpervious: - LDA $0E20, X : CMP.b #$CB : BNE .normal + LDA $0E20, X : CMP.b #$CE : BEQ .blind + CMP.b #$CB : BNE .normal .trinexx LDA SpecialWeapons : CMP #$01 : BEQ + CMP #$03 : BEQ + @@ -282,6 +283,9 @@ Utility_CheckImpervious: CMP #$05 : BEQ + CMP #$06 : BEQ .check_sidenexx BRA .normal +.blind + LDA $0301 : AND.b #$0A : BNE .impervious ; impervious to hammer + BRA .normal + LDA $0301 : AND.b #$0A : BNE .impervious ; impervious to hammer .check_sidenexx diff --git a/swordswap.asm b/swordswap.asm index 6875ffe..b760f04 100644 --- a/swordswap.asm +++ b/swordswap.asm @@ -9,6 +9,10 @@ LoadSwordForDamage: CMP.b #$04 : !BLT + : DEC : + ; if it's gold sword, change it to tempered RTL .notMoth + CMP.b #$CE : BNE .notBlind + LDA.b #$01 + RTL + .notBlind JSR.w LoadModifiedSwordLevel ; load normal sword value RTL ;================================================================================ @@ -81,8 +85,10 @@ LoadModifiedIceFloorValue: LDA.b LinkState : CMP.b #$01 : BEQ + : CMP.b #$17 : BEQ + : CMP.b #$1C : BEQ + LDA.b LinkSpeed : CMP.b #$02 : BEQ + LDA.b LinkSlipping : BNE + + LDA.w $0308 : BIT #$80 : BNE .yes LDA.l ChallengeModes : BIT #$01 : BEQ ++ LDA.l RoomIndex : CMP #$16 : BEQ ++ ; swamp supertile with current -- fine for temporary physics but impossible without boots for permanent + .yes LDA.w TileActIce : ORA.l IceModifier : ORA.b #$10 : RTS ++ : LDA.w TileActIce : ORA.l IceModifier : RTS + : LDA.w TileActIce diff --git a/trolls.asm b/trolls.asm new file mode 100644 index 0000000..0784ff0 --- /dev/null +++ b/trolls.asm @@ -0,0 +1,70 @@ +IFrameData: + db $00, $14, $28 +CalcIFrames: + LDA.l ArmorEquipment + PHX : TAX + LDA.l MaximumHealth : LSR #3 + CLC : ADC.l IFrameData, X + EOR.b #$FF + CLC : ADC.b #$3E + PLX + STA.w $031F + RTL + +SetBombTimer: + JSL GetRandomInt + STA.w $039F, X + RTL + +SetDashTimer: + JSL GetRandomInt + AND.b #$3F + STA.w $0374 + RTL + +ProcessFlute: + LDA.b $1B + BNE .play_and_leave ; indoors + LDA.b $10 + CMP.b #$0B + BEQ .play_and_leave ; special overworld + JSL GetRandomInt + BIT #$08 + BNE .cucco +.normal + LDA.b $8A + AND.b #$40 + BNE .play_and_leave ; dark world + JSR PlayDuck + SEC : RTL ; light world; play duck sound and resume normal behavior +.cucco + JSR PlayCluck ; outdoors; play cucco sound + LDA.b #$01 + STA.l $7F50C5 ; turn on cucco storm + CLC : RTL ; do not summon duck +.play_and_leave + JSR PlayDuck + CLC : RTL + +PlayDuck: + LDA.b #$13 + STA.w $0CF8 + JSL Sound_SetSfxPanWithPlayerCoords + ORA.w $0CF8 + STA.w $012E + RTS + +PlayCluck: + LDA.b #$30 + STA.w $0CF8 + JSL Sound_SetSfxPanWithPlayerCoords + ORA.w $0CF8 + STA.w $012E + RTS + +FluteMap: + LDA.b #$00 + STA.l $7F50C5 ; turn off cuccos + LDA.b #$0E + STA.b $10 + RTL