Merge Unstable into EdgeWork

This commit is contained in:
aerinon
2020-04-24 14:02:47 -06:00
43 changed files with 1520 additions and 309 deletions

View File

@@ -22,6 +22,7 @@ incsrc keydoors.asm
incsrc overrides.asm
incsrc edges.asm
incsrc math.asm
incsrc hudadditions.asm
warnpc $279000
; Data Section

View File

@@ -1,3 +1,23 @@
org $279500
TilesetTable:
; 0 1 2 3 4 5 6 7 8 9 a b c d e f --Offset Ruler
db $13,$04,$04,$06,$0d,$ff,$08,$05,$06,$07,$07,$07,$0e,$0e,$0b,$ff
db $13,$04,$04,$0d,$0d,$0d,$08,$05,$06,$07,$07,$07,$0e,$0e,$0b,$0b
db $04,$04,$04,$0d,$0d,$ff,$08,$05,$08,$09,$07,$07,$06,$ff,$0b,$06
db $04,$05,$04,$12,$08,$08,$08,$08,$08,$09,$07,$07,$06,$0e,$0b,$0b
db $04,$04,$04,$12,$0a,$0a,$08,$ff,$ff,$09,$07,$07,$0e,$0e,$0b,$0b
db $04,$04,$04,$12,$08,$01,$09,$09,$09,$09,$07,$0e,$0e,$0e,$0b,$0b
db $04,$04,$04,$12,$0a,$0a,$08,$09,$09,$ff,$07,$0e,$0e,$0e,$0b,$ff
db $04,$04,$04,$12,$12,$12,$08,$05,$ff,$ff,$ff,$0e,$0e,$0e,$0b,$0b
db $04,$04,$04,$12,$12,$12,$ff,$05,$ff,$05,$ff,$0e,$0e,$0e,$0b,$ff
db $0c,$0c,$0c,$0c,$ff,$0e,$0e,$0c,$0c,$05,$ff,$0e,$0e,$0e,$0b,$0b
db $0c,$0c,$0c,$0c,$0d,$0e,$0e,$05,$05,$05,$05,$0a,$0a,$ff,$0b,$0b
db $04,$0c,$0c,$0c,$0d,$0d,$0d,$0d,$05,$05,$05,$0a,$0a,$ff,$0b,$0b
db $04,$0c,$0c,$0c,$0d,$0d,$0d,$0d,$05,$05,$ff,$0a,$0a,$ff,$0b,$ff
db $04,$0c,$0c,$ff,$ff,$0d,$0d,$ff,$05,$05,$05,$0a,$0a,$ff,$0b,$06
db $04,$06,$06,$06,$06,$06,$06,$06,$06,$ff,$06,$06,$ff,$06,$06,$06
db $06,$06,$03,$03,$03,$03,$ff,$ff,$06,$06,$06,$06,$ff,$06,$06,$06
org $279700
KeyDoorOffset:
; 0 1 2 3 4 5 6 7 8 9 a b c d e f --Offset Ruler
@@ -544,4 +564,21 @@ db $a0,$a0,$50 ; DP Main Lobby
db $58,$50,$30, $98,$50,$70 ; TT Ambush
db $58,$50,$30 ; TT Nook
MultDivInfo: ; (1placeholder, 1, 2, 3, 4, 5, 6, 10, 20)
db $01, $01, $02, $03, $04, $05, $06, $0a, $14
db $01, $01, $02, $03, $04, $05, $06, $0a, $14
; dungeon tables
; HC HC EP DP AT SP PD MM SW IP TH TT TR GT
org $27f000
CompassBossIndicator:
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
TotalKeys: ;27f01c
db $04, $04, $02, $04, $04, $06, $06, $06, $05, $06, $01, $03, $06, $08
ChestKeys: ;27f02a
db $01, $01, $00, $01, $02, $01, $06, $03, $03, $02, $01, $01, $04, $04
BigKeyStatus: ;27f038 (status 2 indicate BnC guard)
dw $0002, $0002, $0001, $0001, $0000, $0001, $0001, $0001, $0001, $0001, $0001, $0001, $0001, $0001
DungeonReminderTable: ;27f054
dw $2D50, $2D50, $2D51, $2D52, $2D54, $2D56, $2D55, $2D5A, $2D57, $2D59, $2D53, $2D58, $2D5B, $2D5C
;27f070

View File

@@ -38,7 +38,7 @@ org $029396 ; <- 11384 - Bank02.asm : 3641 (LDA $01C322, X)
jsl StraightStairLayerFix
; Graphics fix
org $02895d
org $02895d ; Bank 02 line 1812 (JSL Dungeon_LoadRoom : JSL Dungeon_InitStarTileChr : JSL $00D6F9 : INC $B0)
Splicer:
jsl GfxFixer
lda $b1 : beq .done
@@ -46,10 +46,14 @@ rts
nop #5
.done
org $00fda4
org $00d377 ;Bank 00 line 3185
DecompDungAnimatedTiles:
org $00fda4 ;Bank 00 line 8882
Dungeon_InitStarTileCh:
org $00d6ae ;(PC: 56ae)
LoadTransAuxGfx:
org $00d739 ;
LoadTransAuxGfx_Alt:
org $00df5a ;(PC: 5f5a)
PrepTransAuxGfx:
org $0ffd65 ;(PC: 07fd65)
@@ -86,7 +90,31 @@ org $2081f2
jsl MirrorCheckOverride2
org $20825c
jsl MirrorCheckOverride2
org $07a955 ; <- Bank07.asm : around 6564 (JP is a bit different) (STZ $05FC : STZ $05FD)
jsl BlockEraseFix
nop #2
org $02b82a
jsl FixShopCode
org $1ddeea ; <- Bank1D.asm : 286 (JSL Sprite_LoadProperties)
jsl VitreousKeyReset
org $1ed024 ; f5024 sprite_guruguru_bar.asm : 27 (LDA $040C : CMP.b #$12 : INY #2
jsl GuruguruFix : bra .next
nop #3
.next
; also rando's hooks.asm line 1360
org $a0ee11 ; <- 6FC4C - headsup_display.asm : 836 (LDA $7EF36E : AND.w #$00FF : ADD.w #$0007 : AND.w #$FFF8 : TAX)
jsl DrHudOverride
org $098638 ; rando's hooks.asm line 2192
jsl CountChestKeys
org $06D192 ; rando's hooks.asm line 457
jsl CountAbsorbedKeys
; rando's hooks.asm line 1020
org $05FC7E ; <- 2FC7E - sprite_dash_item.asm : 118 (LDA $7EF36F : INC A : STA $7EF36F)
jsl CountBonkItem
; These two, if enabled together, have implications for vanilla BK doors in IP/Hera/Mire
; IPBJ is common enough to consider not doing this. Mire is not a concern for vanilla - maybe glitched modes

View File

@@ -1,11 +1,24 @@
GfxFixer:
{
lda $b1 : bne .stage2
lda DRMode : bne +
jsl LoadRoomHook ;this is the code we overwrote
jsl Dungeon_InitStarTileCh
jsl LoadTransAuxGfx_Alt
inc $b0
rtl
+ lda $b1 : bne .stage2
jsl LoadRoomHook ; this is the rando version - let's only call this guy once - may fix star tiles and slower loads
jsl Dungeon_InitStarTileCh
jsl LoadTransAuxGfx
jsl Dungeon_LoadCustomTileAttr
jsl PrepTransAuxGfx
lda DRMode : cmp #$02 : bne + ; only do this in crossed mode
ldx $a0 : lda TilesetTable, x
cmp $0aa1 : beq + ; already eq no need to decomp
sta $0aa1
tax : lda $02802e, x : tay
jsl DecompDungAnimatedTiles
+
lda #$09 : sta $17 : sta $0710
jsl Palette_SpriteAux3
jsl Palette_SpriteAux2

97
asm/hudadditions.asm Normal file
View File

@@ -0,0 +1,97 @@
DrHudOverride:
{
jsl.l NewDrawHud
jsr HudAdditions
rtl
}
HudAdditions:
{
ldx $040c : cpx #$ff : bne + : rts : +
lda DRMode : bne + : rts : +
phb : phk : plb
lda $7ef364 : and.l $0098c0, x : beq +
lda CompassBossIndicator, x : and #$00ff : cmp $a0 : bne +
lda $1a : and #$0010 : beq +
lda #$345e : sta $7ec790 : bra .next
+ lda #$207f : sta $7ec790
.next lda DRMode : and #$0002 : bne + : plb : rts : +
lda $7ef36d : and #$00ff : beq +
lda DungeonReminderTable, x : bra .reminder
+ lda #$207f
.reminder sta $7ec702
+ lda DRFlags : and #$0004 : beq .restore
lda $7ef368 : and.l $0098c0, x : beq .restore
lda #$2811 : sta $7ec740
lda $7ef366 : and.l $0098c0, x : bne .check
lda BigKeyStatus, x : bne + ; change this, if bk status changes to one byte
lda #$2574 : bra ++
+ cmp #$0002 : bne +
lda #$2420 : bra ++
+ lda #$207f : bra ++
.check lda #$2826
++ sta $7ec742
txa : lsr : tax
lda $7ef4e0, x : jsr ConvertToDisplay : sta $7ec7a2
lda #$2830 : sta $7ec7a4
lda ChestKeys, x : jsr ConvertToDisplay : sta $7ec7a6
lda #$2871 : sta $7ec780
lda TotalKeys, x
sep #$20 : !sub $7ef4b0, x : rep #$20
jsr ConvertToDisplay : sta $7ec782
.restore
plb : rts
}
ConvertToDisplay:
and #$00ff : cmp #$000a : !blt +
!add #$2553 : rts
+ !add #$2490 : rts
CountChestKeys:
jsl ItemDowngradeFix
jsr CountChest
rtl
CountChest:
lda !MULTIWORLD_ITEM_PLAYER_ID : bne .end
cpy #$24 : beq +
cpy #$a0 : !blt .end
cpy #$ae : !bge .end
pha : phx
tya : and #$0f : bne ++
inc a
++ tax : bra .count
+ pha : phx
lda $040c : lsr : tax
.count
lda $7ef4b0, x : inc : sta $7ef4b0, x
lda $7ef4e0, x : inc : sta $7ef4e0, x
.restore plx : pla
.end rts
CountAbsorbedKeys:
jsl IncrementSmallKeysNoPrimary : phx
lda $040c : cmp #$ff : beq +
lsr : tax
lda $7ef4b0, x : inc : sta $7ef4b0, x
+ plx : rtl
CountBonkItem:
jsl GiveBonkItem
lda $a0 ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte
cmp #115 : bne + ; Desert Bonk Key
lda.l BonkKey_Desert
bra ++
+ : cmp #140 : bne + ; GTower Bonk Key
lda.l BonkKey_GTower
bra ++
+ lda.b #$24 ; default to small key
++
phy : tay : jsr CountChest : ply
rtl

View File

@@ -12,8 +12,9 @@
CheckIfDoorsOpen: {
jsr TrapDoorFixer ; see normal.asm
; note we are 16bit mode right now
lda $040c : cmp #$00ff : bne .gtg
lda $a0 : dec : tax : and #$000f ; hijacked code
lda DRMode : beq +
lda $040c : cmp #$00ff : bne .gtg
+ lda $a0 : dec : tax : and #$000f ; hijacked code
sec : rtl ; set carry to indicate normal behavior
.gtg

View File

@@ -50,4 +50,27 @@ MirrorCheckOverride:
+ lda DRScroll : rtl
MirrorCheckOverride2:
lda $7ef353 : and #$02 : rtl
lda $7ef353 : and #$02 : rtl
BlockEraseFix:
lda $7ef353 : and #$02 : beq +
stz $05fc : stz $05fd
+ rtl
FixShopCode:
cpx #$300 : !bge +
sta $7ef000, x
+ rtl
VitreousKeyReset:
lda DRMode : beq +
stz $0cba, x
+ jsl $0db818 ;restore old code
rtl
GuruguruFix:
lda $a0 : cmp #$df : !bge +
and #$0f : cmp #$0e : !blt +
iny #2
+ rtl

View File

@@ -7,6 +7,7 @@ RecordStairType: {
}
SpiralWarp: {
lda DRMode : beq .abort ; abort if not DR
lda $040c : cmp.b #$ff : beq .abort ; abort if not in dungeon
lda $045e : cmp #$5e : beq .gtg ; abort if not spiral - intended room is in A!
cmp #$5f : beq .gtg
@@ -66,6 +67,16 @@ SpiralWarp: {
ldy #$01 : jsr SetCamera
stz $045e ; clear the staircase flag
; animated tiles fix
lda DRMode : cmp #$02 : bne + ; only do this in crossed mode
ldx $a0 : lda TilesetTable, x
cmp $0aa1 : beq + ; already eq no need to decomp
sta $0aa1
tax : lda $02802e, x : tay
jsl DecompDungAnimatedTiles
+
ply : plx : plb ; pull the stuff we pushed
lda $a2 : and #$0f ; this is the code we are hijacking
rtl