More platforms, fixed graphics when switching floors
This commit is contained in:
16
hooks.asm
16
hooks.asm
@@ -1943,11 +1943,23 @@ org $02C2F3 ; <- Bank02.asm:10391 (JSL Dungeon_LoadRoom)
|
||||
;================================================================================
|
||||
|
||||
;================================================================================
|
||||
; Hook for graphicsoverride.asm
|
||||
; Hooks into the "Reloading all graphics" routine
|
||||
;--------------------------------------------------------------------------------
|
||||
org $00E64D ; <- Bank00.asm:5656 (STZ $00 : STX $01 : STA $02)
|
||||
JML BgGraphicsLoading
|
||||
BgGraphicsLoadingCancel:
|
||||
RTS : NOP
|
||||
BgGraphicsLoadingResume:
|
||||
;================================================================================
|
||||
;================================================================================
|
||||
|
||||
;================================================================================
|
||||
; Hook when updating the floor tileset in dungeons (such as between floors)
|
||||
;--------------------------------------------------------------------------------
|
||||
org $00DF62 ; <- Bank00.asm:4672 (LDX.w #$0000 : LDY.w #$0040)
|
||||
JML ReloadingFloors
|
||||
NOP : NOP
|
||||
ReloadingFloorsResume:
|
||||
org $00DF6E ; <- A few instructions later, right after JSR Do3To4High16Bit
|
||||
ReloadingFloorsCancel:
|
||||
;================================================================================
|
||||
|
||||
|
||||
@@ -1,18 +1,24 @@
|
||||
ShouldOverrideFileLoad:
|
||||
; Y = Graphics file being loaded
|
||||
CPY #$0A ; 0A = Ice/Mire floor file
|
||||
BNE .no
|
||||
|
||||
LDA $040C ; Dungeon number
|
||||
CMP #$12 ; Ice Palace
|
||||
BEQ .yes
|
||||
.no
|
||||
CLC : RTS
|
||||
.yes
|
||||
SEC : RTS
|
||||
|
||||
BgGraphicsLoading:
|
||||
; Instructions overwritten
|
||||
STZ $00
|
||||
STX $01
|
||||
STA $02
|
||||
|
||||
; Y = Graphics file being loaded
|
||||
CPY #$0A ; 0A = Ice/Mire floor file
|
||||
BNE .useDefaultGraphics
|
||||
|
||||
LDA $040C ; Dungeon number
|
||||
CMP #$12 ; Ice Palace
|
||||
BEQ .useSpecialIcePalaceFile
|
||||
|
||||
.useDefaultGraphics
|
||||
JSR ShouldOverrideFileLoad
|
||||
BCS .useSpecialIcePalaceFile
|
||||
JML BgGraphicsLoadingResume
|
||||
|
||||
.useSpecialIcePalaceFile
|
||||
@@ -43,5 +49,35 @@ BgGraphicsLoading:
|
||||
SEP #$20
|
||||
JML BgGraphicsLoadingCancel
|
||||
|
||||
ReloadingFloors:
|
||||
SEP #$30 ; 8 AXY
|
||||
LDA $7EC2F8 ; Floor file that has been decompressed
|
||||
TAY
|
||||
JSR ShouldOverrideFileLoad
|
||||
REP #$30 ; 16 AXY
|
||||
BCS .replaceWithSpecialIcePalaceFile
|
||||
|
||||
; Instructions overwritten by hook
|
||||
LDX.w #$0000
|
||||
LDY.w #$0040
|
||||
|
||||
JML ReloadingFloorsResume
|
||||
|
||||
.replaceWithSpecialIcePalaceFile
|
||||
; Block move our hardcoded graphics into the output buffer
|
||||
LDX.w #IcePalaceFloorGfx ; Source
|
||||
LDY.w #$0000 ; Target
|
||||
LDA.w #$0800 ; Length
|
||||
PHB
|
||||
MVN $7F, IcePalaceFloorGfx>>16
|
||||
PLB
|
||||
|
||||
; Pretend that we ran the original routine
|
||||
LDX.w #$0800
|
||||
LDA.w #$6600
|
||||
STA $03
|
||||
|
||||
JML ReloadingFloorsCancel
|
||||
|
||||
IcePalaceFloorGfx:
|
||||
incbin ice_palace_floor.bin
|
||||
@@ -7,7 +7,9 @@ LoadRoomHook:
|
||||
JSL $00879c ; UseImplicitRegIndexedLocalJumpTable
|
||||
; Callback routines:
|
||||
dl NoCallback ; 00
|
||||
dl IcePalace1 ; 01
|
||||
dl IcePalaceBombosSE ; 01
|
||||
dl IcePalaceBombosSW ; 02
|
||||
dl IcePalaceBombosNE ; 03
|
||||
|
||||
NoCallback:
|
||||
RTL
|
||||
@@ -25,42 +27,48 @@ macro writeTile()
|
||||
INX #2
|
||||
endmacro
|
||||
|
||||
!IP_BORDER = #$08D0
|
||||
!IP_ICON_1 = #$0CCA
|
||||
!IP_ICON_2 = #$0CCB
|
||||
!IP_ICON_3 = #$0CDA
|
||||
!IP_ICON_4 = #$0CDB
|
||||
|
||||
!IP1_X = 14
|
||||
!IP1_Y = 18
|
||||
|
||||
IcePalace1:
|
||||
!BOMBOS_BORDER = #$08D0
|
||||
!BOMBOS_ICON_1 = #$0CCA
|
||||
!BOMBOS_ICON_2 = #$0CCB
|
||||
!BOMBOS_ICON_3 = #$0CDA
|
||||
!BOMBOS_ICON_4 = #$0CDB
|
||||
macro DrawBombosPlatform(roomX, roomY, quadX, quadY)
|
||||
REP #$30 ; 16 AXY
|
||||
%setTilePointer(!IP1_X, !IP1_Y, 1, 1)
|
||||
LDA.w !IP_BORDER
|
||||
%writeTile()
|
||||
%writeTile()
|
||||
%writeTile()
|
||||
%writeTile()
|
||||
%setTilePointer(<roomX>, <roomY>, <quadX>, <quadY>)
|
||||
LDA.w !BOMBOS_BORDER
|
||||
%writeTile()
|
||||
%writeTile()
|
||||
%writeTile()
|
||||
%writeTile()
|
||||
|
||||
%setTilePointer(!IP1_X, !IP1_Y+1, 1, 1)
|
||||
%writeTile()
|
||||
LDA.w !IP_ICON_1 : %writeTile()
|
||||
LDA.w !IP_ICON_2 : %writeTile()
|
||||
LDA.w !IP_BORDER : %writeTile()
|
||||
%setTilePointer(<roomX>, <roomY>+1, <quadX>, <quadY>)
|
||||
%writeTile()
|
||||
LDA.w !BOMBOS_ICON_1 : %writeTile()
|
||||
LDA.w !BOMBOS_ICON_2 : %writeTile()
|
||||
LDA.w !BOMBOS_BORDER : %writeTile()
|
||||
|
||||
%setTilePointer(!IP1_X, !IP1_Y+2, 1, 1)
|
||||
%writeTile()
|
||||
LDA.w !IP_ICON_3 : %writeTile()
|
||||
LDA.w !IP_ICON_4 : %writeTile()
|
||||
LDA.w !IP_BORDER : %writeTile()
|
||||
%setTilePointer(<roomX>, <roomY>+2, <quadX>, <quadY>)
|
||||
%writeTile()
|
||||
LDA.w !BOMBOS_ICON_3 : %writeTile()
|
||||
LDA.w !BOMBOS_ICON_4 : %writeTile()
|
||||
LDA.w !BOMBOS_BORDER : %writeTile()
|
||||
|
||||
%setTilePointer(!IP1_X, !IP1_Y+3, 1, 1)
|
||||
%writeTile()
|
||||
%writeTile()
|
||||
%writeTile()
|
||||
%writeTile()
|
||||
%setTilePointer(<roomX>, <roomY>+3, <quadX>, <quadY>)
|
||||
%writeTile()
|
||||
%writeTile()
|
||||
%writeTile()
|
||||
%writeTile()
|
||||
SEP #$30 ; 8 AXY
|
||||
endMacro
|
||||
|
||||
IcePalaceBombosSE:
|
||||
%DrawBombosPlatform(14, 18, 1, 1)
|
||||
RTL
|
||||
IcePalaceBombosSW:
|
||||
%DrawBombosPlatform(14, 18, 0, 1)
|
||||
RTL
|
||||
IcePalaceBombosNE:
|
||||
%DrawBombosPlatform(14, 18, 1, 0)
|
||||
RTL
|
||||
|
||||
RoomCallbackTable:
|
||||
@@ -71,13 +79,13 @@ RoomCallbackTable:
|
||||
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 04x
|
||||
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 05x
|
||||
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 06x
|
||||
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 07x
|
||||
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $02, $00 ; 07x
|
||||
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 08x
|
||||
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 09x
|
||||
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0Ax
|
||||
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0Bx
|
||||
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0Cx
|
||||
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0Dx
|
||||
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $03, $00 ; 0Dx
|
||||
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0Ex
|
||||
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0Fx
|
||||
db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0Fx
|
||||
|
||||
Reference in New Issue
Block a user