Support for GT Big Key Credit

Support for Rain state prevention without rails
This commit is contained in:
aerinon
2020-11-19 16:27:47 -07:00
parent 94561e01c2
commit 6c7f5e46a3
10 changed files with 125 additions and 95 deletions

View File

@@ -34,6 +34,7 @@ incsrc overrides.asm
incsrc edges.asm
incsrc math.asm
incsrc hudadditions.asm
incsrc dr_lobby.asm
warnpc $279700
incsrc doortables.asm

View File

@@ -562,23 +562,26 @@ db $01, $02, $03, $04, $05, $06, $0a, $14
; 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
TotalLocationsLow: ;27f070
db $08, $08, $06, $06, $02, $00, $04, $08, $08, $08, $06, $08, $02, $07
TotalLocationsHigh: ;27f07e
db $00, $00, $00, $00, $00, $01, $01, $00, $00, $00, $00, $00, $01, $02
;27F08C
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
TotalKeys: ;27f020
db $04, $04, $02, $04, $04, $06, $06, $06, $05, $06, $01, $03, $06, $08, $00, $00
ChestKeys: ;27f030
db $01, $01, $00, $01, $02, $01, $06, $03, $03, $02, $01, $01, $04, $04, $00, $00
BigKeyStatus: ;27f040 (status 2 indicate BnC guard)
dw $0002, $0002, $0001, $0001, $0000, $0001, $0001, $0001, $0001, $0001, $0001, $0001, $0001, $0001, $0000, $0000
DungeonReminderTable: ;27f060
dw $2D50, $2D50, $2D51, $2D52, $2D54, $2D56, $2D55, $2D5A, $2D57, $2D59, $2D53, $2D58, $2D5B, $2D5C, $0000, $0000
TotalLocationsLow: ;27f080
db $08, $08, $06, $06, $02, $00, $04, $08, $08, $08, $06, $08, $02, $07, $00, $00
TotalLocationsHigh: ;27f090
db $00, $00, $00, $00, $00, $01, $01, $00, $00, $00, $00, $00, $01, $02, $00, $00
org $27f0a0
TotalLocations:
db $08, $08, $06, $06, $02, $0a, $0e, $08, $08, $08, $06, $08, $0c, $1b, $00, $00
; no more room here
; Vert 0,6,0 Horz 2,0,8
org $27f090
org $27f0b0
CoordIndex: ; Horizontal 1st
db 2, 0 ; Coordinate Index $20-$23
OppCoordIndex:
@@ -598,7 +601,16 @@ dw $007f, $0077 ; Left/Top camera bounds when at edge or layout frozen
dw $0007, $000b ; Left/Top camera bounds when not frozen + appropriate low byte $22/$20 (preadj. by #$78/#$6c)
dw $00ff, $010b ; Right/Bot camera bounds when not frozen + appropriate low byte $20/$22
dw $017f, $0187 ; Right/Bot camera bound when at edge or layout frozen
;27f0ae next free byte
;27f0ce next free byte
org $27f0f0
RemoveRainDoorsRoom:
dw $0060, $0062, $ffff ; ffff indicates end of list
RainDoorMatch: ; org $27f0f6 and f8 for now
dw $0081, $0061 ; not xba'd
BlockSanctuaryDoorInRain: ;27f0fa
dw $0000
org $27f100
TilesetTable:
@@ -641,3 +653,8 @@ db $00,$07,$20,$20,$07,$07,$07,$07,$07,$20,$20,$07,$20,$20,$20,$20
db $07,$07,$02,$02,$02,$02,$07,$07,$07,$20,$20,$07,$20,$20,$20,$07
;27f300
;
org $27ff00
SancDarkWorldFlag:
db 0

9
dr_lobby.asm Normal file
View File

@@ -0,0 +1,9 @@
CheckDarkWorldSanc:
STA $A0 : STA $048E ; what we wrote over
LDA.l SancDarkWorldFlag : BEQ +
SEP #$30
LDA $A0 : CMP #$12 : BNE ++
LDA.l $7EF357 : BNE ++ ; moon pearl?
LDA #$17 : STA $5D : INC $02E0 : LDA.b #$40 : STA !DARK_WORLD
++ REP #$30
+ RTL

View File

@@ -153,6 +153,12 @@ JSL StoreTempBunnyState
org $08c450 ; <- ancilla_receive_item.asm : 146-148 (STY $5D : STZ $02D8)
JSL RetrieveBunnyState : NOP
org $02d9ce ; <- Bank02.asm : Dungeon_LoadEntrance 10829 (STA $A0 : STA $048E)
JSL CheckDarkWorldSanc : NOP
org $01891e ; <- Bank 01.asm : 991 Dungeon_LoadType2Object (LDA $00 : XBA : AND.w #$00FF)
JSL RainPrevention : NOP #2
; 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
; Hera BK door back can be seen with Pot clipping - likely useful for no logic seeds

View File

@@ -34,7 +34,8 @@ GfxFixer:
}
FixAnimatedTiles:
LDA.L DRMode : cmp #$02 : bne +
LDA.L DRMode : CMP #$02 : BNE +
LDA $040C : CMP.b #$FF : BEQ +
PHX
LDX $A0 : LDA.l TilesetTable, x
CMP $0AA1 : beq ++
@@ -74,6 +75,7 @@ CgramAuxToMain: ; ripped this from bank02 because it ended with rts
OverridePaletteHeader:
lda.l DRMode : cmp #$02 : bne +
lda.l DRFlags : and #$20 : bne +
cpx #$01c2 : !bge +
rep #$20
txa : lsr : tax

View File

@@ -95,12 +95,18 @@ DrHudDungeonItemsAdditions:
+ stx $00
txa : lsr : tax
lda.w #$24f5 : sta $1644, y
lda.l $7ef37c, x : beq +
lda.l GenericKeys : bne +
lda.l $7ef37c, x : and #$00FF : beq +
jsr ConvertToDisplay2 : sta $1644, y
+ iny #2 : lda.w #$24f5 : sta $1644, y
phx : ldx $00
lda $7ef368 : and.l $0098c0, x : beq + ; must have map
plx : lda.l ChestKeys, x : jsr ConvertToDisplay2 : sta $1644, y ; small key totals
plx : sep #$30 : lda.l ChestKeys, x : sta $02
lda.l GenericKeys : bne +++
lda $02 : !sub $7ef4e0, x : sta $02
+++ lda $02
rep #$30
jsr ConvertToDisplay2 : sta $1644, y ; small key totals
bra .skipStack
+ plx
.skipStack iny #2
@@ -131,15 +137,18 @@ DrHudDungeonItemsAdditions:
+ lda $7ef364 : and.l $0098c0, x : beq + ; must have compass
phx ; total chest counts
txa : lsr : tax
lda.l TotalLocationsHigh, x : jsr ConvertToDisplay2 : sta $1644, y : iny #2
lda.l TotalLocationsLow, x : jsr ConvertToDisplay2 : sta $1644, y
sep #$30
lda.l TotalLocations, x : !sub $7EF4BF, x : JSR HudHexToDec2DigitCopy
rep #$30
lda $06 : jsr ConvertToDisplay2 : sta $1644, y : iny #2
lda $07 : jsr ConvertToDisplay2 : sta $1644, y
plx
bra .skipBlanks
+ lda.w #$24f5 : sta $1644, y : iny #2 : sta $1644, y
.skipBlanks iny #2
cpx #$001a : beq +
lda.w #$24f5 : sta $1644, y ; blank out spot
+ inx #2 : cpx #$001b : bcc -
+ inx #2 : cpx #$001b : !bge ++ : brl -
++
plp : ply : plx : rtl
}
@@ -203,4 +212,27 @@ HudHexToDec4DigitCopy:
DEC : BNE -
+
STY $07 ; Store 1s digit
RTS
;================================================================================
; 8-bit registers
; in: A(b) - Byte to Convert
; out: $06 - $07 (high - low)
;================================================================================
HudHexToDec2DigitCopy: ; modified
PHY
LDY.b #$00
-
CMP.b #10 : !BLT +
INY
SBC.b #10 : BRA -
+
STY $06 : LDY #$00 ; Store 10s digit and reset Y
CMP.b #1 : !BLT +
-
INY
DEC : BNE -
+
STY $07 ; Store 1s digit
PLY
RTS

View File

@@ -121,20 +121,19 @@ KeyGet:
lda $a0 : cmp #$87 : bne +
jsr ShouldKeyBeCountedForDungeon : bcc -
jsl CountChestKeyLong : bra -
+ phy
jsr KeyGetPlayer : sta !MULTIWORLD_ITEM_PLAYER_ID
jsl.l $0791b3 ; Player_HaltDashAttackLong
jsl.l Link_ReceiveItem
pla : sta $00
lda !MULTIWORLD_ITEM_PLAYER_ID : bne .end
phx
lda $040c : lsr : tax
lda $00 : cmp KeyTable, x : bne +
- plx : pla : rtl
+ cmp #$af : beq - ; universal key
cmp #$24 : beq - ; small key for this dungeon
plx
.end
+ sty $00
jsr KeyGetPlayer : sta !MULTIWORLD_ITEM_PLAYER_ID
lda !MULTIWORLD_ITEM_PLAYER_ID : bne .receive
phx
lda $040c : lsr : tax
lda $00 : cmp KeyTable, x : bne +
- JSL.l FullInventoryExternal : jsl CountChestKeyLong : plx : pla : rtl
+ cmp #$af : beq - ; universal key
cmp #$24 : beq - ; small key for this dungeon
plx
.receive
jsl.l $0791b3 ; Player_HaltDashAttackLong
jsl.l Link_ReceiveItem
pla : dec : rtl
}

View File

@@ -121,3 +121,22 @@ RetrieveBunnyState:
LDA $5F : BEQ +
STA $5D
+ RTL
RainPrevention:
LDA $00 : XBA : AND #$00FF ; what we wrote over
PHA
LDA $7EF3C5 : AND #$00FF : CMP #$0002 : !BGE .done ; only in rain states (0 or 1)
LDA.l $7EF3C6 : AND #$0004 : BNE .done ; zelda's been rescued
LDA.l BlockSanctuaryDoorInRain : BEQ .done ;flagged
LDA $A0 : CMP #$0012 : BNE + ;we're in the sanctuary
LDA.l $7EF3CC : AND #$00FF : CMP #$0001 : BEQ .done ; zelda is following
LDA $00 : CMP #$02A1 : BNE .done
PLA : LDA #$0008 : RTL
+ LDA.l BlockCastleDoorsInRain : BEQ .done ;flagged
LDX #$FFFE
- INX #2 : LDA.l RemoveRainDoorsRoom, X : CMP #$FFFF : BEQ .done
CMP $A0 : BNE -
LDA.l RainDoorMatch, X : CMP $00 : BNE -
PLA : LDA #$0008 : RTL
.done PLA : RTL

View File

@@ -86,66 +86,10 @@ IcePalaceBombosNE:
%DrawBombosPlatform(14, 18, 1, 0)
RTL
CastleEastEntrance:
LDA $7EF3C5 : CMP.b #$02 : !BLT + : RTL : + ; only apply in rain states (0 or 1)
LDA.l BlockCastleDoorsInRain : BNE + : RTL : +
CastleEastEntrance: ; new solution (see Rain Prevention)
RTL
REP #$20 ; 16 A
LDA.w #$08e1 ; square peg
%writeTileAt(11,21,0,1)
%writeTileAt(11,26,0,1)
%writeTileAt(20,21,0,1)
%writeTileAt(20,26,0,1)
INC ;horizontal rail
%writeTileAt(12,21,0,1)
%writeTileAt(13,21,0,1)
%writeTileAt(14,21,0,1)
%writeTileAt(15,21,0,1)
%writeTileAt(16,21,0,1)
%writeTileAt(17,21,0,1)
%writeTileAt(18,21,0,1)
%writeTileAt(19,21,0,1)
INC ;vertical rail
%writeTileAt(11,22,0,1)
%writeTileAt(11,23,0,1)
%writeTileAt(11,24,0,1)
%writeTileAt(11,25,0,1)
%writeTileAt(20,22,0,1)
%writeTileAt(20,23,0,1)
%writeTileAt(20,24,0,1)
%writeTileAt(20,25,0,1)
SEP #$20 ; 8 A
RTL
CastleWestEntrance:
LDA $7EF3C5 : CMP.b #$02 : !BLT + : RTL : + ; only apply in rain states (0 or 1)
LDA.l BlockCastleDoorsInRain : BNE + : RTL : +
REP #$20 ; 16 A
LDA.w #$08e1 ; square peg
%writeTileAt(11,21,1,1)
%writeTileAt(11,26,1,1)
%writeTileAt(20,21,1,1)
%writeTileAt(20,26,1,1)
INC ;horizontal rail
%writeTileAt(12,21,1,1)
%writeTileAt(13,21,1,1)
%writeTileAt(14,21,1,1)
%writeTileAt(15,21,1,1)
%writeTileAt(16,21,1,1)
%writeTileAt(17,21,1,1)
%writeTileAt(18,21,1,1)
%writeTileAt(19,21,1,1)
INC ;vertical rail
%writeTileAt(11,22,1,1)
%writeTileAt(11,23,1,1)
%writeTileAt(11,24,1,1)
%writeTileAt(11,25,1,1)
%writeTileAt(20,22,1,1)
%writeTileAt(20,23,1,1)
%writeTileAt(20,24,1,1)
%writeTileAt(20,25,1,1)
SEP #$20 ; 8 A
CastleWestEntrance: ; new solution (see Rain Prevention)
RTL
PoDFallingBridge:

View File

@@ -459,6 +459,7 @@ CreditsLine151:
CreditsLine152:
;GAME STATS
db $0B, $13, $06, $00, $0C, $04, $9F, $12, $13, $00, $13, $12
print "GT Big Key Credit Start: ", pc
CreditsLine153:
;GT BIG KEY $$$$/22
db $02, $37, $63, $70, $9F, $5E, $65, $63, $9F, $67, $61, $75, $9F, $9F, $9F, $9F, $9F, $9F, $9F, $9F, $9F, $9F, $9F, $9F, $9F, $9F, $9F, $A2, $55, $55