From e11ac2c130e4389e1fd05a661212f1ade9e77ed4 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 ++- damage_table.bin | Bin 2048 -> 2048 bytes hooks.asm | 34 ++++++++++++++--- special_weapons.asm | 6 ++- swordswap.asm | 6 +++ trolls.asm | 70 +++++++++++++++++++++++++++++++++++ 7 files changed, 116 insertions(+), 7 deletions(-) create mode 100644 trolls.asm diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 90a02c9..0da7f0a 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -227,6 +227,7 @@ org $A28000 ; contrib area incsrc contrib.asm incsrc special_weapons.asm incsrc variable_ganon_vulnerability.asm +incsrc trolls.asm warnpc $A38000 org $A38000 diff --git a/cuccostorm.asm b/cuccostorm.asm index 2d40f39..c682c48 100644 --- a/cuccostorm.asm +++ b/cuccostorm.asm @@ -23,7 +23,11 @@ CuccoStorm: SEP #$30 ; set 8-bit accumulator index registers LDA.l !CUCCO_STORM : BEQ + ; only if storm is on - LDA.b $10 : CMP.b #$09 : BNE + ; only if outdoors + LDA.b $10 : CMP.b #$09 : BEQ .check ; only if outdoors + .indoors + LDA.b #$00 : STA.l !CUCCO_STORM ; turn off cucco storm if indoors + BRA + + .check LDA.l LoopFrames : AND.b #$7F : BNE + ; check every 128 frames - diff --git a/damage_table.bin b/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 26f1187..4578028 100755 --- a/hooks.asm +++ b/hooks.asm @@ -2397,11 +2397,11 @@ 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 MirrorBonk @@ -3071,3 +3071,27 @@ NOP org $02D7D2 ; BEQ .face_up NOP #2 ; this fixes Link's direction after mirroring and falling after entering through back of tavern + +;-------------------------------------------------------------------------------- +; 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 a261901..d7313cd 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 fdc46fe..95f98e7 100644 --- a/swordswap.asm +++ b/swordswap.asm @@ -36,6 +36,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 ;================================================================================ @@ -115,8 +119,10 @@ LoadModifiedIceFloorValue: LDA $5D : CMP #$01 : BEQ + : CMP #$17 : BEQ + : CMP #$1C : BEQ + LDA $5E : CMP #$02 : BEQ + LDA $5B : BNE + + LDA.w $0308 : BIT #$80 : BNE .yes LDA.l $30802D : BIT #$01 : BEQ ++ LDA $A0 : CMP #$16 : BEQ ++ ; swamp supertile with current -- fine for temporary physics but impossible without boots for permanent + .yes LDA.w $0348 : ORA $7F50C7 : ORA #$10 : RTS ++ : LDA.w $0348 : ORA $7F50C7 : RTS + : LDA.w $0348 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