Challenge modes: OHKO and Gloom

This commit is contained in:
2025-05-18 00:59:34 -05:00
parent a3f892975f
commit bc0f396275
6 changed files with 104 additions and 32 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -208,18 +208,37 @@ OnInitFileSelect:
JSL EnableForceBlank
RTL
;--------------------------------------------------------------------------------
OnGloomDamage:
LDA.b #$01
STA.l UpdateHUDFlag
LDA.l MaximumHealth
SEC : SBC.b #$08
STA.l CurrentHealth
BEQ +
STA.l MaximumHealth
+ RTL
;--------------------------------------------------------------------------------
OnLinkDamaged:
JSL IncrementDamageTakenCounter_Arb
LDA.l ChallengeModes : AND.b #$03 : CMP.b #$02 : BEQ .gloom
JML OHKOTimer
.gloom
STZ.b $00
JML OnGloomDamage
;--------------------------------------------------------------------------------
;OnEnterWater:
; JSL UnequipCapeQuiet ; what we wrote over
;RTL
;--------------------------------------------------------------------------------
OnLinkDamagedFromPit:
LDA.l ChallengeModes : AND.b #$03 : CMP.b #$02 : BEQ .gloom
JSL OHKOTimer
BRA +
.gloom
JSL OnGloomDamage
CLC : ADC.b #$08 : STA.l CurrentHealth
LDA.l AllowAccidentalMajorGlitch
+ LDA.l AllowAccidentalMajorGlitch
BEQ ++
-- LDA.b #$14 : STA.b GameSubMode ; thing we wrote over
@@ -231,7 +250,12 @@ OnLinkDamagedFromPit:
RTL
;--------------------------------------------------------------------------------
OnLinkDamagedFromPitOutdoors:
LDA.l ChallengeModes : AND.b #$03 : CMP.b #$02 : BEQ .gloom
JML OHKOTimer ; make sure this is last
.gloom
JSL OnGloomDamage
CLC : ADC.b #$08
RTL
;--------------------------------------------------------------------------------
OnOWTransition:
JSL FloodGateReset

View File

@@ -451,6 +451,15 @@ HUDHex4Digit_Long:
REP #$20
RTL
;================================================================================
ClearHearts:
LDA.w #!BlankTile
LDX.b #$14
- STA.l HUDTileMapBuffer+$066, X
STA.l HUDTileMapBuffer+$0A6, X
DEX #2
BPL -
RTS
;================================================================================
UpdateHearts:
PHB
@@ -461,6 +470,22 @@ UpdateHearts:
PHX
PLB
; OHKO mode
LDA.l ChallengeModes : AND.w #$0003 : CMP.w #$0001 : BNE +
LDA.w #$240A
STA.l HUDTileMapBuffer+$068
INC
STA.l HUDTileMapBuffer+$06A
INC
STA.l HUDTileMapBuffer+$06C
JMP .skip_partial
+
; Gloom mode
LDA.l ChallengeModes : AND.w #$0003 : CMP.w #$0002 : BNE +
JSR ClearHearts
+
LDA.w MaximumHealth
LSR
LSR
@@ -484,7 +509,7 @@ UpdateHearts:
LDA.l HUDHeartColors_index : ASL : TAX
LDA.l HUDHeartColors_masks_game_hud,X
PLX
ORA.w #$20A0
ORA.l HeartIcon
CPY.b #$01
BPL .add_heart
@@ -528,14 +553,14 @@ UpdateHearts:
LDA.l HUDHeartColors_index : ASL : TAX
LDA.l HUDHeartColors_masks_game_hud,X
ORA.w #$20A1
ORA.l HalfHeartIcon
STA.b (Scrap09)
BRA .skip_partial
.more_than_half
LDA.l HUDHeartColors_index : ASL : TAX
LDA.l HUDHeartColors_masks_game_hud,X
ORA.w #$20A0
ORA.l HeartIcon
STA.b (Scrap09)
.skip_partial
@@ -555,7 +580,7 @@ CheckHeartPalette:
PHX
LDA.l HUDHeartColors_index : ASL : TAX
LDA.l HUDHeartColors_masks_game_hud,X
ORA.w #$20A0
ORA.l HeartIcon
PLX
RTS

View File

@@ -91,7 +91,23 @@ SmithSword:
db $02 ; #$02 = Tempered Sword (default)
;--------------------------------------------------------------------------------
; 0x18002B- 0x180030 (Unused)
; 0x18002B (Unused)
;--------------------------------------------------------------------------------
; 0x18002C (Reserved for Allowed Item on B)
;--------------------------------------------------------------------------------
org $B0802D
ChallengeModes:
; p--- mmdd
; p - permadeath
; m - movement modes (0 - normal, 1 - permanent ice physics)
; d - damage modes (0 - normal, 1 - ohko, 2 - gloom)
db $00
;--------------------------------------------------------------------------------
; 0x18002E (Reserved for Ganon Vulnerability Item)
;--------------------------------------------------------------------------------
; 0x18002F (Reserved for Special Weapons)
;--------------------------------------------------------------------------------
; 0x180030 (Unused)
;--------------------------------------------------------------------------------
org $B08031 ; PC 0x180031
EnableEasterEggs:
@@ -2628,8 +2644,14 @@ org $B0F032 ; PC 0x187032
RomSpeed:
db $01 ; $01 = FastROM (default) | $00 = SlowROM
org $B0F033 ; PC 0x187033
HeartIcon:
dw $20A0
HalfHeartIcon:
dw $20A1
;--------------------------------------------------------------------------------
; 0x187033 - 18703F (unused)
; 0x187037 - 18703F (unused)
;--------------------------------------------------------------------------------
org $B0F040 ; PC 0x187040

View File

@@ -163,6 +163,7 @@ RTL
;--------------------------------------------------------------------------------
OHKOTimer:
LDA.l OHKOFlag : BNE .kill
LDA.l ChallengeModes : AND.b #$03 : CMP.b #$01 : BEQ .kill
LDA.l TimeoutBehavior : CMP.b #$02 : BNE +
LDA.l ClockStatus : AND.b #$02 : BEQ +
.kill