Add custom collision ZS source
This commit is contained in:
110
Dungeons/Collision/custom_collision.asm
Normal file
110
Dungeons/Collision/custom_collision.asm
Normal file
@@ -0,0 +1,110 @@
|
||||
;Custom dungeon collision code
|
||||
;mostly written by kan
|
||||
;put together by Jared_Brian_
|
||||
;meant to be used with the ZScream collision editor
|
||||
;12-18-2021
|
||||
|
||||
; Format:
|
||||
; dw <offset> : db width, height
|
||||
; dw <tile data>, ...
|
||||
;
|
||||
; if <offset> == $F0F0, start doing single tiles
|
||||
; format:
|
||||
; dw <offset> : db <data>
|
||||
;
|
||||
; if <offset> == $FFFF, stop
|
||||
|
||||
RoomPointer = $258090
|
||||
|
||||
org $01B95B
|
||||
JSL CustomRoomCollision
|
||||
NOP #6
|
||||
|
||||
org $258000
|
||||
CustomRoomCollision_easyout:
|
||||
{
|
||||
RTL
|
||||
}
|
||||
|
||||
CustomRoomCollision:
|
||||
{
|
||||
LDA $B4 : CMP.w #$2000 : BNE .notEndOfTable
|
||||
INC $0200
|
||||
.notEndOfTable
|
||||
|
||||
REP #$30
|
||||
LDA.b $A0 : ASL : ADC.b $A0 : TAX
|
||||
LDA.l RoomPointer, X : BEQ .easyout
|
||||
|
||||
STA.b $08
|
||||
|
||||
LDA.l RoomPointer+1, X : STA.b $09
|
||||
|
||||
PHB
|
||||
|
||||
PEA.w $7F7F
|
||||
PLB
|
||||
PLB
|
||||
|
||||
LDY.w #$0000
|
||||
|
||||
.read_next
|
||||
LDA.b [$08],Y
|
||||
INY
|
||||
INY
|
||||
CMP.w #$F0F0
|
||||
BCC .new_rectangle
|
||||
|
||||
.single_tiles
|
||||
CMP.w #$FFFF
|
||||
BEQ .done
|
||||
|
||||
TAX
|
||||
|
||||
SEP #$20
|
||||
LDA.b [$08],Y
|
||||
STA.w $2000,X
|
||||
REP #$20
|
||||
INY
|
||||
LDA.b [$08],Y
|
||||
INY
|
||||
INY
|
||||
BRA .single_tiles
|
||||
|
||||
.done
|
||||
PLB
|
||||
RTL
|
||||
|
||||
.new_rectangle
|
||||
STA.b $02 ; beginning of row
|
||||
|
||||
LDA.b [$08],Y ; number of rows and columns
|
||||
STA.b $06
|
||||
|
||||
INY
|
||||
INY
|
||||
|
||||
.next_row
|
||||
REP #$21
|
||||
LDA.b $02
|
||||
TAX
|
||||
ADC.w #64
|
||||
STA.b $02
|
||||
|
||||
SEP #$20
|
||||
LDA.b $06 : STA $0C; save number of columns
|
||||
|
||||
.next_column
|
||||
LDA.b [$08],Y
|
||||
STA.w $2000,X
|
||||
INY
|
||||
INX
|
||||
DEC.b $0C
|
||||
BNE .next_column
|
||||
|
||||
DEC.b $07
|
||||
BNE .next_row
|
||||
|
||||
REP #$21
|
||||
JMP .read_next
|
||||
}
|
||||
@@ -51,6 +51,8 @@ incsrc "Dungeons/spike_subtype.asm"
|
||||
incsrc "Dungeons/attract_scenes.asm"
|
||||
print "End of attract_scenes.asm ", pc
|
||||
|
||||
incsrc "Collision/custom_collision.asm"
|
||||
|
||||
incsrc "Collision/CollisionTablesExpanded.asm"
|
||||
incsrc "Collision/GlobalCollisionTables.asm"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user