Add SecretObject to object_handler

To be used with Book of Secrets to allow for special objects which react to the item
This commit is contained in:
scawful
2024-03-30 23:14:19 -04:00
parent 34334bc30c
commit 33cec3b1d2

View File

@@ -1,30 +1,52 @@
; =========================================================
; Dungeon Object Handler ; Dungeon Object Handler
org $018262 ;object id 0x31 org $018262
dw ExpandedObject dw ExpandedObject ; Object ID 0x31
dw SecretObject ; Object ID 0x32
; #_018650: dw RoomDraw_WeirdUglyPot ID 230 ; #_018650: dw RoomDraw_WeirdUglyPot ID 230
org $018650 org $018650
dw HeavyPot dw HeavyPot
; Item ID 22B
; Heavy Pot grahics
; Currently modified to look like normal pot
org $00A9AC
dw $0D28, $0D38, $4D28, $4D38
; org $01B306 ; RoomDraw_WeirdGloveRequiredPot
; LDA.w #$1010
; Bank01 Free Space ; Bank01 Free Space
org $01B53C org $01B53C
ExpandedObject: ExpandedObject:
JSL NewObjectsCode {
RTS JSL NewObjectsCode
RTS
}
SecretObject:
{
JSL HandleSecretObjects
RTS
}
HeavyPot: HeavyPot:
LDA.w #$1010 {
PHX : LDX.w $042C LDA.w #$1010
LDA.w #$1111 : STA $0500, X PHX : LDX.w $042C
; Store this object's position in the object buffer to $0520, X LDA.w #$1111 : STA $0500, X
LDA $BA : STA $0520, X ; Store object's position in the object buffer to $0520, X
; Store it's tilemap position. LDA $BA : STA $0520, X
TYA : STA $0540, X ; Store tilemap position.
JMP $B350 TYA : STA $0540, X
JMP $B350
}
warnpc $01B560 warnpc $01B560
; =========================================================
org $2C8000 org $2C8000
NewObjectsCode: NewObjectsCode:
{ {
@@ -132,32 +154,34 @@ NewObjectsCode:
incbin Data/small_statue.bin incbin Data/small_statue.bin
} }
; May need to make this a table ; May need to make this a table
; This modifies object 0xOE to use the spritesheets for the object ; This modifies object 0xOE to use the spritesheets for the object
CustomDrawConfig: CustomDrawConfig:
{ {
PHA PHA
LDA $03 : AND #$00FF : CMP.w #$000E : BEQ .custom_config LDA $03 : AND #$00FF : CMP.w #$000E : BEQ .custom_config
TYA : LSR : AND #$00FF
CMP #$000E : BNE .no_spriteset
LDA #$000E : STA $03
.custom_config
PLA
ORA.w #$0300 : JMP .return
.no_spriteset
PLA
.return
RTS
}
TYA : LSR : AND #$00FF ; =========================================================
; Secret Object Handler
; Disappears if Link uses the Book of Secrets near them
CMP #$000E : BNE .no_spriteset HandleSecretObjects:
LDA #$000E : STA $03 {
.custom_config ; TODO: Implement the Book of Secrets check
PLA ; TODO: Add object draw code
ORA.w #$0300 : JMP .return ; TODO: Implement the object's disappearance
.no_spriteset RTL
PLA
.return
RTS
} }
pushpc pushpc
; Item ID 22B
org $00A9AC
dw $0D28, $0D38, $4D28, $4D38
; org $01B306 ; RoomDraw_WeirdGloveRequiredPot
; LDA.w #$1010