Merge remote-tracking branch 'codemann/OWMain' into codemann_OWMain

This commit is contained in:
2026-01-31 08:47:00 -06:00
3 changed files with 122 additions and 27 deletions

View File

@@ -508,6 +508,45 @@ org $8AC3B6
JMP WorldMap_CalculateOAMCoordinates_exit_successfully JMP WorldMap_CalculateOAMCoordinates_exit_successfully
warnpc $8AC433 warnpc $8AC433
; most of this function is copied from the original, but rearranged
org $8AB7F3
FluteMenu_HandleSprites:
LDA.l $7EC108 : PHA
LDA.l $7EC109 : PHA
LDA.l $7EC10A : PHA
LDA.l $7EC10B : PHA
JSL FluteMenu_MoveLinkSprite ; override vanilla (LDA.b $1A : AND.b #$10)
BEQ .continue
JSR WorldMap_CalculateOAMCoordinates : BCC .continue
LDA.b Scrap0E : SEC : SBC.b #$04 : STA.b Scrap0E
LDA.b Scrap0F : SEC : SBC.b #$04 : STA.b Scrap0F
LDA.b #$00 : STA.b Scrap0D
LDA.b #$3E : STA.b Scrap0C
JSL OWMapFluteCancelIcon ; override vanilla (LDA.b #$02 : STA.b Scrap0B)
LDX.b #$10 : JSR WorldMap_HandleSpriteBlink
.continue
warnpc $8AB831
; most of this function is copied from the original, but rearranged
org $8ABF78
WorldMap_HandleSprites:
LDA.l $7EC108 : PHA
LDA.l $7EC109 : PHA
LDA.l $7EC10A : PHA
LDA.l $7EC10B : PHA
JSL WorldMap_SkipHandleSprites ; override vanilla (LDA.b $1A : AND.b #$10)
BEQ .continue
JSR WorldMap_CalculateOAMCoordinates : BCC .continue
LDA.b Scrap0E : SEC : SBC.b #$04 : STA.b Scrap0E
LDA.b Scrap0F : SEC : SBC.b #$04 : STA.b Scrap0F
LDA.b #$00 : STA.b Scrap0D
LDA.b #$3E : STA.b Scrap0C
LDA.b #$02 : STA.b Scrap0B
LDX.b #$00 : JSR WorldMap_HandleSpriteBlink
.continue
warnpc $8ABFB6
pullpc pullpc
WorldMap_LoadChrHalfSlot: WorldMap_LoadChrHalfSlot:

View File

@@ -78,8 +78,6 @@ org $8ab7af ;LDA $F2 : ORA $F0 : AND #$C0
jml OWFluteCancel2 : nop jml OWFluteCancel2 : nop
org $8ab90d ;JSL $02E99D org $8ab90d ;JSL $02E99D
jsl OWFluteCancel jsl OWFluteCancel
org $8ab816
JSL OWMapFluteCancelIcon
; allows Frog sprite to spawn in LW and also allows his friend to spawn in their house ; allows Frog sprite to spawn in LW and also allows his friend to spawn in their house
org $868a76 ; < 30a76 - sprite_prep.asm:785 (LDA $7EF3CA : AND.w #$40) org $868a76 ; < 30a76 - sprite_prep.asm:785 (LDA $7EF3CA : AND.w #$40)
@@ -107,6 +105,9 @@ org $8aba6c ; < ? - Bank0a.asm:474 ()
jsl OWMapWorldCheck16 : nop jsl OWMapWorldCheck16 : nop
; Custom Overworld Map ; Custom Overworld Map
org $8ABA52
JSL OverworldMap_InitGfx_InitScrap
org $8ABA99 org $8ABA99
WorldMap_LoadDarkWorldMap: WorldMap_LoadDarkWorldMap:
LDA.b GameMode : CMP.b #$14 ; attract module LDA.b GameMode : CMP.b #$14 ; attract module
@@ -121,15 +122,14 @@ BEQ .vanilla_light
warnpc $8ABAB5 warnpc $8ABAB5
.vanilla_light ; $0ABAB5 .vanilla_light ; $0ABAB5
org $8ABD12
JSL MoveZoomedInPositionY
org $8ABD2F
JSL MoveZoomedInPositionX
org $8ABB32 org $8ABB32
JSL LoadMapOppositeWorld JSL LoadMapOppositeWorld
org $8ABF78
JSL WorldMap_SkipHandleSprites
org $8ABA22
JSL MoveLinkMapSprite
org $8ABFF0 org $8ABFF0
JSL MoveMirrorPortalMapSprite JSL MoveMirrorPortalMapSprite
; Could insert similar hooks at $8AB860 and $8AB8AC for flute spots ; Could insert similar hooks at $8AB860 and $8AB8AC for flute spots
@@ -356,7 +356,7 @@ OWFluteCancel2:
} }
OWMapFluteCancelIcon: OWMapFluteCancelIcon:
{ {
STA.b Scrap0B : LDX.b #$10 ; what we wrote over LDA.b #$02 : STA.b Scrap0B ; what we wrote over
LDA.l OWFlags+1 : AND.b #$01 : BEQ .return LDA.l OWFlags+1 : AND.b #$01 : BEQ .return
LDA.b GameSubMode : CMP.b #$0A : BNE .return LDA.b GameSubMode : CMP.b #$0A : BNE .return
LDA.b FrameCounter : AND.b #$10 : BNE .return LDA.b FrameCounter : AND.b #$10 : BNE .return
@@ -515,6 +515,12 @@ GetOWMapTilemapOffsetToCopy:
dw $0400+$0210 ; bottom right dw $0400+$0210 ; bottom right
} }
OverworldMap_InitGfx_InitScrap:
{
STZ.b ScrapBuffer72 ; clear tile swap flag
LDA.b #$11 : STA.b MAINDESQ ; what we wrote over
RTL
}
LoadMapDarkOrCustom_long: LoadMapDarkOrCustom_long:
{ {
PHB : LDA.b #WorldMap_DarkWorldTilemap>>16 : PHA : PLB PHB : LDA.b #WorldMap_DarkWorldTilemap>>16 : PHA : PLB
@@ -543,27 +549,22 @@ LoadMapOppositeWorld:
LDA.b Joy1B_New : AND.b #$70 ; what we wrote over LDA.b Joy1B_New : AND.b #$70 ; what we wrote over
RTL RTL
} }
FluteMenu_MoveLinkSprite:
{
JSR MoveMapSprite
BRA WorldMap_SkipHandleSprites_vanilla
}
WorldMap_SkipHandleSprites: WorldMap_SkipHandleSprites:
{ {
LDA.l OWFlags : AND.b #!FLAG_OW_ADJUST_DYNAMIC_MAP_SPRITE_POSITION : BEQ .vanilla JSR MoveMapSprite : BEQ .vanilla
LDA.b ScrapBuffer72 : BEQ .vanilla ; skip draw if no tile swap LDA.b ScrapBuffer72 : BEQ .vanilla ; skip draw if no tile swap
PLA : PLA : PEA.w $C3AF ; exit without drawing sprites PLA : PLA : PEA.w $C39B ; exit without drawing sprites
RTL RTL
.vanilla .vanilla
LDA.b FrameCounter : AND.b #$10 ; what we wrote over LDA.b FrameCounter : AND.b #$10 ; what we wrote over
RTL RTL
} }
MoveLinkMapSprite:
{
STA.l $7EC10A ; what we overwrote
SEP #$20
STZ.b ScrapBuffer72
JSR MoveMapSprite
REP #$20
RTL
}
MoveMirrorPortalMapSprite: MoveMirrorPortalMapSprite:
{ {
STA.l $7EC109 ; what we overwrote STA.l $7EC109 ; what we overwrote
@@ -571,9 +572,54 @@ MoveMirrorPortalMapSprite:
RTL RTL
} }
MoveZoomedInPositionY:
{
LDA.l OWFlags : AND.w #!FLAG_OW_ADJUST_DYNAMIC_MAP_SPRITE_POSITION : BEQ .vanilla
SEP #$20
JSR MoveMapSprite_Setup
JSR MoveMapSprite_GetYCoordHighByte
PHA
REP #$20
LDA.l $7EC108 : XBA
SEP #$20
PLA : XBA
REP #$20
RTL
.vanilla
LDA.l $7EC108 ; what we overwrote
RTL
}
MoveZoomedInPositionX:
{
LDA.l OWFlags : AND.w #!FLAG_OW_ADJUST_DYNAMIC_MAP_SPRITE_POSITION : BEQ .vanilla
SEP #$20
JSR MoveMapSprite_Setup
JSR MoveMapSprite_GetXCoordHighByte
PHA
REP #$20
LDA.l $7EC10A : XBA
SEP #$20
PLA : XBA
REP #$20
RTL
.vanilla
LDA.l $7EC10A ; what we overwrote
RTL
}
MoveMapSprite: MoveMapSprite:
{ {
LDA.l OWFlags : AND.b #!FLAG_OW_ADJUST_DYNAMIC_MAP_SPRITE_POSITION : BEQ .return LDA.l OWFlags : AND.b #!FLAG_OW_ADJUST_DYNAMIC_MAP_SPRITE_POSITION : BEQ .return
PHP
JSR MoveMapSprite_Setup
JSR MoveMapSprite_GetXCoordHighByte : STA.l $7EC10B
JSR MoveMapSprite_GetYCoordHighByte : STA.l $7EC109
PLP
.return
RTS
}
MoveMapSprite_Setup:
{
LDA.l $7EC10B : AND.b #$0E : LSR LDA.l $7EC10B : AND.b #$0E : LSR
STA.b Scrap00 STA.b Scrap00
LDA.l $7EC109 : AND.b #$0E : ASL : ASL LDA.l $7EC109 : AND.b #$0E : ASL : ASL
@@ -592,12 +638,17 @@ MoveMapSprite:
TAX TAX
AND.b #$07 : ASL AND.b #$07 : ASL
STA.b Scrap00 STA.b Scrap00
LDA.l $7EC10B : AND.b #$01 : ORA.b Scrap00 : STA.l $7EC10B RTS
TXA }
AND.b #$38 : LSR : LSR MoveMapSprite_GetXCoordHighByte:
STA.b Scrap00 {
LDA.l $7EC109 : AND.b #$01 : ORA.b Scrap00 : STA.l $7EC109 LDA.l $7EC10B : AND.b #$01 : ORA.b Scrap00
.return RTS
}
MoveMapSprite_GetYCoordHighByte:
{
TXA : AND.b #$38 : LSR : LSR : STA.b Scrap00
LDA.l $7EC109 : AND.b #$01 : ORA.b Scrap00
RTS RTS
} }
@@ -1290,6 +1341,7 @@ OWWorldTerrainUpdate: ; x = owid of destination screen, y = 1 for land to water,
STZ.w RandoOverworldForceTrans STZ.w RandoOverworldForceTrans
CMP.b #$02 : BNE + CMP.b #$02 : BNE +
DEC : STA.w LinkDeepWater : STZ.w LinkSwimDirection DEC : STA.w LinkDeepWater : STZ.w LinkSwimDirection
LDA.b FlagBY : AND.b #$7F : STA.b FlagBY
LDA.b #$04 : BRA .set_state LDA.b #$04 : BRA .set_state
+ +
CMP.b #$03 : BNE ++ CMP.b #$03 : BNE ++
@@ -1310,6 +1362,7 @@ OWWorldTerrainUpdate: ; x = owid of destination screen, y = 1 for land to water,
LDA.b #$01 : STA.w LinkDeepWater LDA.b #$01 : STA.w LinkDeepWater
LDA.l FlippersEquipment : BEQ .no_flippers ; check if flippers obtained LDA.l FlippersEquipment : BEQ .no_flippers ; check if flippers obtained
LDA.b LinkState : CMP.b #$17 : BEQ .no_flippers ; check if bunny LDA.b LinkState : CMP.b #$17 : BEQ .no_flippers ; check if bunny
LDA.b FlagBY : AND.b #$7F : STA.b FlagBY
LDA.b #$04 : STA.b LinkState : STZ.w LinkSwimDirection : RTS LDA.b #$04 : STA.b LinkState : STZ.w LinkSwimDirection : RTS
.no_flippers .no_flippers
PHX PHX

View File

@@ -65,6 +65,8 @@ LinkSubPixelVelocty = $7E002A ; Word length
LinkAnimationStep = $7E002E ; LinkAnimationStep = $7E002E ;
LinkDirection = $7E002F ; $00 = Up | $02 = Down | $04 = Left | $06 = Right LinkDirection = $7E002F ; $00 = Up | $02 = Down | $04 = Left | $06 = Right
; ;
FlagBY = $7E003A ; Bitfield for B and Y buttons.
;
OAMOffsetY = $7E0044 ; OAMOffsetY = $7E0044 ;
OAMOffsetX = $7E0045 ; OAMOffsetX = $7E0045 ;
LinkIncapacitatedTimer = $7E0046 ; Countdown when Link takes damage, not same as I-frames LinkIncapacitatedTimer = $7E0046 ; Countdown when Link takes damage, not same as I-frames
@@ -779,6 +781,7 @@ endmacro
%assertRAM(LinkRecoilZ, $7E0029) %assertRAM(LinkRecoilZ, $7E0029)
%assertRAM(LinkAnimationStep, $7E002E) %assertRAM(LinkAnimationStep, $7E002E)
%assertRAM(LinkDirection, $7E002F) %assertRAM(LinkDirection, $7E002F)
%assertRAM(FlagBY, $7E003A)
%assertRAM(OAMOffsetY, $7E0044) %assertRAM(OAMOffsetY, $7E0044)
%assertRAM(OAMOffsetX, $7E0045) %assertRAM(OAMOffsetX, $7E0045)
%assertRAM(LinkIncapacitatedTimer, $7E0046) %assertRAM(LinkIncapacitatedTimer, $7E0046)