Disable Overworld Overlay

View previous topic View next topic Go down

Disable Overworld Overlay

Post by qwertymodo on Tue 2 Aug 2016 - 2:01

I've looked through the compendium and the asm docs, and I can't seem to find the code location to modify/disable the rain/cloud overlays (I'm looking to hook into the existing triggers with custom code, not simply disable them entirely, preferably on a screen-by-screen basis). Can anybody point me in the right direction there?
avatar
qwertymodo



Since : 2014-10-21

Back to top Go down

Re: Disable Overworld Overlay

Post by  on Tue 2 Aug 2016 - 2:49

XaserLE wrote an asm file to enable/disable overlays on areas of your wish a while back!

Code:
;this is for getting the overlays work in certain areas, i use bank 0x3F for the whole code
;WRITTEN: by XaserLE
;THANKS TO: -MathOnNapkins
; -an unknown author of a rain activation code that helped a little
;TODO:
; -missing: silent rain sound in dungeons. for that we need to save a rain indicator in free ram and hook into the dungeon load routine
; -rain doesn't work with overworld warping (teleporter/mirror)

;header
lorom

;THIS IS FOR KEEPING AN OVERLAY APPEARED WHEN GOING FROM ONE AREA TO ANOTHER WITHOUT THE BLANK OUT
ORG $02AC18 ; go to the code that makes sure the overlay keeps appeared in transition from overworld area to overworld area
BRA $00 ; overwrites an "BCS $03" that won't keep the overlay appeared if we are not in the beginning mode
 ; only at the beginning an overlay keeps appeared when going from on area to another without a blank out

;THIS IS THE OVERLAY-CODE
 ; IMPORTANT: If the overlay is drawn correctly depends on the GFX# in this area (look at hyrule magic).
 ;     Rain seems to work various GFX#'s, but clouds for example on 33, 47 and maybe more.

ORG $02AFA3 ; go to beginning of the overlay code (command 293F00)

JSL $3F9180 ; overwrite this with a long jump to expanded space
BRA $62 ; after long jump we return and branch after the piece of code that loads the rain overlay (command A29F00)

ORG $3F9180 ; go to expanded space

LDA $7EF3C5     ; load game state
AND #$00FF      ;
CMP #$0002      ; test for beginning
BCS $04    ; if not beginning, jump to next test
LDX #$009F      ;
RTL ;

LDA $8A         ; load actual area

CMP #$0000 ;
BNE $04 ;
LDX #$009F      ;
RTL ;

CMP #$0002 ;
BNE $04 ;
LDX #$009E      ;
RTL ;

LDA $8A         ; load actual area again

;for paste©
;CMP #$0003 ;
;BNE $04 ;
;LDX #$0095      ;
;RTL ;

CMP #$0003 ;
BNE $04 ;
LDX #$0095      ;
RTL ;

CMP #$0005 ;
BNE $04 ;
LDX #$0095      ;
RTL ;

CMP #$0007 ;
BNE $04 ;
LDX #$0095      ;
RTL ;

CMP #$000A ;
BNE $04 ;
LDX #$009D      ;
RTL ;

CMP #$0040 ;
BNE $04 ;
LDX #$009D      ;
RTL ;

CMP #$0043 ;
BNE $04 ;
LDX #$009C      ;
RTL ;

CMP #$0045 ;
BNE $04 ;
LDX #$009C      ;
RTL ;

CMP #$0047 ;
BNE $04 ;
LDX #$009C      ;
RTL ;

;dark world evil swamp, so test for evil-swamp-dungeon-is-opened is needed
CMP #$0070 ;
BNE $0D ;
LDA $7EF2F0     ; test if evil swamp dungeon already opened
AND #$0020      ;
BNE $03        ; if yes, don't load the rain overlay
LDX #$009F      ;
RTL ;

LDA $8A         ; load actual area again

CMP #$005B ;
BNE $04 ;
LDX #$0096      ;
RTL ;

;no match
RTL ;

;Between the above and the next code there should be enough space to test every area or to test for self-defined events
;in some areas. If you still need more, you need to move it more forward.

;THIS IS THE BLANK-OUT-CODE

ORG $02AADB ; go to beginning of the overlay code (command 293F)

JSL $3F9700 ; overwrite this with a long jump to expanded space
CMP #$01 ; in the new routine i will set the accumulator to 0x01 to indicate that we used the blank out, otherwise 0x00
BEQ $02 ; so if we want to use the blank out, branch to this routine in the original code
BRA $0F ; we don't want to use the blank out, jump to the routine after the RTS in the original code

ORG $3F9700 ; go to expanded space
 ; IMPORTANT: accumulator holds the area that we come from, NOT the actual, the game did this
 ; if want a blank out in an area, you need this when going in AND out

;test where we COME FROM

;for paste©
;CMP #$40 ;
;BNE $03 ;
;LDA #$01 ;
;RTL

CMP #$00 ; test if we come from this area
BNE $03 ; if not, jump to next area
LDA #$01 ; set blank out indicator
RTL

CMP #$02 ; test if we come from this area
BNE $03 ; if not, jump to next area
LDA #$01 ; set blank out indicator
RTL

CMP #$0A ; test if we go in this area
BNE $03 ; if not, jump to next area
LDA #$01 ; set blank out indicator
RTL

CMP #$40 ;
BNE $03 ;
LDA #$01 ;
RTL

;test where we GO TO
LDA $8A         ; load ACTUAL area

;for paste©
;CMP #$40 ;
;BNE $03 ;
;LDA #$01 ;
;RTL

CMP #$00 ; test if we come from this area
BNE $03 ; if not, jump to next area
LDA #$01 ; set blank out indicator
RTL

CMP #$02 ; test if we come from this area
BNE $03 ; if not, jump to next area
LDA #$01 ; set blank out indicator
RTL

CMP #$0A ; test if we go in this area
BNE $03 ; if not, jump to next area
LDA #$01 ; set blank out indicator
RTL

CMP #$40 ;
BNE $03 ;
LDA #$01 ;
RTL

;no match
LDA #$00 ; unset blank out indicator
RTL

;Between the above and the next code there should be enough space to test every area or to test for self-defined events
;in some areas. If you still need more, you need to move it more forward.

;THIS IS THE RAIN-ANIMATION-CODE

;-----------------------------------------------------------------------------------------------------------
;first of all a little helper: if you don't want this flash lights during the rain, uncomment the next lines
;ORG $02A4E7
;BEQ $14
;ORG $02A4F7
;BEQ $04
;ORG $02A506
;BRA $02
;if want to set back to normal, here is the original code, uncomment it and out-comment the modified above
;ORG $02A4E7
;BEQ $1D
;ORG $02A4F7
;BEQ $0D
;ORG $02A506
;LDA #$32
;-----------------------------------------------------------------------------------------------------------

ORG $02A4CD ; go to beginning of the rain animation code (command A58A)

JSL $3F9C00 ; overwrite this with a long jump to expanded space
CMP #$01 ; in the new routine i will set the accumulator to 0x01 to indicate that we used the rain animation, otherwise 0x00
BEQ $0E ; so if we want to use the rain animation, branch to this routine in the original code
BRA $55 ; we don't want to use the rain animation, jump to the RTL in the original code

ORG $3F9C00 ; go to expanded space

LDA $7EF3C5     ; load game state
CMP #$02    ; test for beginning
BCS $03    ; if not beginning, jump to next test
LDA #$01 ; set rain animation indicator
RTL

LDA $8A         ; load ACTUAL area

;for paste©
;CMP #$00 ; test if we are in this area
;BNE $03 ; if not, jump to next area
;LDA #$01 ; set rain animation indicator
;RTL

CMP #$00 ; test if we are in this area
BNE $03 ; if not, jump to next area
LDA #$01 ; set rain animation indicator
RTL

;dark world evil swamp, so test for evil-swamp-dungeon-is-opened is needed
CMP #$70        
BNE $0E
LDA $7EF2F0 ; test if evil swamp dungeon already opened
AND #$20        ; if yes, don't animate the rain
BNE $03
LDA #$01 ; set rain animation indicator
RTL
LDA #$00 ; unset rain animation indicator
RTL

LDA $8A         ; load ACTUAL area again

;no match
LDA #$00 ; unset rain animation indicator
RTL

;Between the above and the next code there should be enough space to test every area or to test for self-defined events
;in some areas. If you still need more, you need to move it more forward.

;THIS IS THE MOUNTAIN-FLASHLIGHTS-CODE

ORG $0EF587 ; go to beginning of the flashlights code (command A58A)

JSL $3FA100 ; overwrite this with a long jump to expanded space
CMP #$01 ; in the new routine i will set the accumulator to 0x01 to indicate that we used the flashlights, otherwise 0x00
BEQ $06 ; so if we want to use the flashlights, branch to this routine in the original code
BRA $02 ; we don't want to use the flashlights, jump to the branch to the RTL in the original code

ORG $3FA100 ; go to expanded space

LDA $8A         ; load ACTUAL area

;for paste©
;CMP #$45 ;
;BNE $03 ;
;LDA #$01 ;
;RTL

CMP #$43 ; test if we are in this area
BNE $03 ; if not, jump to next area
LDA #$01 ; set flashlights indicator
RTL

CMP #$45 ;
BNE $03 ;
LDA #$01 ;
RTL

CMP #$47 ;
BNE $03 ;
LDA #$01 ;
RTL

;no match
LDA #$00 ; unset flashlights indicator
RTL

Found here:

[You must be registered and logged in to see this link.]

^^I believe with your current group status you should have access to the topic which lies in the 'Lost Woods' section of the forums.

Hope this is what you are looking for! Wink




Since : 2012-06-19

Back to top Go down

Re: Disable Overworld Overlay

Post by qwertymodo on Tue 2 Aug 2016 - 15:08

Yep, that got me what I wanted (disable all overlays except the mountain clouds once you get the master sword).  Now there's only one weird bug and a lot of playtesting standing in the way of what is probably the final feature addition to PW 1.2.  Still a handful of other unrelated bugfixes to tackle, but it's getting close Smile
avatar
qwertymodo



Since : 2014-10-21

Back to top Go down

Re: Disable Overworld Overlay

Post by qwertymodo on Wed 3 Aug 2016 - 0:38

Ok, so it's *almost* completely working.  However, when I warp to the Icy World, the snow BG is disabled, however the lightning flashing effect is not, which ends up loading the wrong tiles since the snow BG isn't loaded.  Any ideas where that's at?  Also, the rumbling SFX is playing, even though I have it set to SFX $05 (silence), which I have confirmed by logging writes to $012D.  I'd like to disable that if possible.

avatar
qwertymodo



Since : 2014-10-21

Back to top Go down

Re: Disable Overworld Overlay

Post by qwertymodo on Wed 3 Aug 2016 - 18:35

Ok, so I found the rumble code

Code:
82a501 ldx #$36               A:2024 X:0009 Y:0028 S:01fc D:0000 DB:80 nvMXdiZC V: 70 H:1178 F:51
82a503 stx $012e     [80012e] A:2024 X:0036 Y:0028 S:01fc D:0000 DB:80 nvMXdizC V: 70 H:1190 F:51

Now I just need to figure out how to disable the flashing.  I get the feeling that there's custom code involved since PW has that effect on the entire Icy World overworld instead of just specific areas like Death Mountain and Misery Mire in aLttP.  If anybody happens to know where that code is, I'd appreciate it.
avatar
qwertymodo



Since : 2014-10-21

Back to top Go down

Re: Disable Overworld Overlay

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum