diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 2a80069..8d62bbc 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -124,7 +124,7 @@ incsrc doorframefixes.asm ;incsrc shopkeeper.asm incsrc cuccostorm.asm incsrc roomloading.asm -incsrc graphicsoverride.asm +incsrc icepalacegraphics.asm incsrc hashalphabet.asm ; <- TAKE OUT THE EXTRA ORGS IN HERE - THIS IS WHY WE COULDN'T ADD MORE FILES EARLIER warnpc $A18000 diff --git a/graphicsoverride.asm b/graphicsoverride.asm deleted file mode 100644 index 830d319..0000000 --- a/graphicsoverride.asm +++ /dev/null @@ -1,62 +0,0 @@ -macro OverwriteVramTile(firstTileIndex, count) - LDA.w #+512*8*8*4/16 - LDX.b # - JSR UploadTileToVram -endmacro - -GraphicsOverrideHook: - JSL .resumeOriginalCode - - LDA $0A ; Floor tileset loaded - CMP #$0A ; Floor tileset index used by Ice and Mire - BEQ .loadedIceOrMireFloor - RTL - -.loadedIceOrMireFloor - LDA $040C ; Load dungeon number - CMP #$12 ; Ice Palace - BEQ .isInIcePalace - RTL - -.isInIcePalace - ; We've just loading the floor tiles in Ice Palace. - ; Replace the bridge tiles with the bombos medallion - - LDA.b #IcePalaceMedallionGfx>>16 - STA $02 - REP #$20 - LDA.w #IcePalaceMedallionGfx - STA $00 - - %OverwriteVramTile($CA, 2) - %OverwriteVramTile($DA, 2) - - SEP #$20 - RTL - -.resumeOriginalCode - ; Overwritten instructions: - PHB - LDA.b #$00 - PHA - PLB - LDA.b #$80 - JML GraphicsOverrideResume - -; A = VRAM word address to upload to (Actual VRAM address / 2) -; X = Tiles to upload -; $00-$02 = Pointer to graphics data -UploadTileToVram: - ; TODO: This should probably be optimized with a DMA - STA $2116 - TXA : ASL #4 : TAX ; X = Amount of words to upload (Tiles to upload * 16) -- LDA [$00] - STA $2118 - INC $00 - INC $00 - DEX - BNE - - RTS - -IcePalaceMedallionGfx: - incbin ice_bombos_floor.bin \ No newline at end of file diff --git a/hooks.asm b/hooks.asm index 08b75bd..c08a101 100644 --- a/hooks.asm +++ b/hooks.asm @@ -1945,17 +1945,9 @@ org $02C2F3 ; <- Bank02.asm:10391 (JSL Dungeon_LoadRoom) ;================================================================================ ; Hook for graphicsoverride.asm ;-------------------------------------------------------------------------------- -org $00E1DB ; <- Bank00.asm:4866 (PHB : PHK : PLB : LDA.b #$80) - JML GraphicsOverrideHook - NOP - GraphicsOverrideResume: -;-------------------------------------------------------------------------------- -org $028BE7 ; <- Bank02.asm:2299 (JSL Dungeon_LoadRoom) - JSL LoadRoomHook -;-------------------------------------------------------------------------------- -org $029309 ; <- Bank02.asm:3533 (JSL Dungeon_LoadRoom) - JSL LoadRoomHook -;-------------------------------------------------------------------------------- -org $02C2F3 ; <- Bank02.asm:10391 (JSL Dungeon_LoadRoom) - JSL LoadRoomHook +org $00E64D ; <- Bank00.asm:5656 (STZ $00 : STX $01 : STA $02) + JML BgGraphicsLoading + BgGraphicsLoadingCancel: + RTS : NOP + BgGraphicsLoadingResume: ;================================================================================ \ No newline at end of file diff --git a/ice_bombos_floor.bin b/ice_bombos_floor.bin deleted file mode 100644 index 87b992b..0000000 Binary files a/ice_bombos_floor.bin and /dev/null differ diff --git a/ice_palace_floor.bin b/ice_palace_floor.bin new file mode 100644 index 0000000..4729f17 Binary files /dev/null and b/ice_palace_floor.bin differ diff --git a/icepalacegraphics.asm b/icepalacegraphics.asm new file mode 100644 index 0000000..89aedb4 --- /dev/null +++ b/icepalacegraphics.asm @@ -0,0 +1,47 @@ +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 + JML BgGraphicsLoadingResume + +.useSpecialIcePalaceFile + ; We're loading the floor tiles in Ice Palace. Instead of the normal file, + ; load another one that replaces the bridge tiles with the Bombos medallion + + LDA $FFFFFF + + LDA.b #IcePalaceFloorGfx>>16 + STA $02 + REP #$20 + LDA.w #IcePalaceFloorGfx + STA $00 + LDX.b #64*2 ; Tiles to load * 2 +- + ; Unrolled loop to upload half a tile + LDA [$00] : STA $2118 : INC $00 : INC $00 + LDA [$00] : STA $2118 : INC $00 : INC $00 + LDA [$00] : STA $2118 : INC $00 : INC $00 + LDA [$00] : STA $2118 : INC $00 : INC $00 + LDA [$00] : STA $2118 : INC $00 : INC $00 + LDA [$00] : STA $2118 : INC $00 : INC $00 + LDA [$00] : STA $2118 : INC $00 : INC $00 + LDA [$00] : STA $2118 : INC $00 : INC $00 + DEX + BNE - + + SEP #$20 + JML BgGraphicsLoadingCancel + +IcePalaceFloorGfx: + incbin ice_palace_floor.bin \ No newline at end of file