Austin
New member
You may have noticed some sprites drawing in front of the player or each other when they really shouldn't. Joe just gave me the following fix for that problem.
In the HandleUpdateObjects.asm file, edit the UpdateDrawOrder section (around Line 705) to the following:
In the HandleUpdateObjects.asm file, edit the UpdateDrawOrder section (around Line 705) to the following:
Code:
UpdateDrawOrder:
LDX #$1
OrderLoop:
LDY drawOrder,x
;;;;;;;;;;;;;;;;;;;;;;;
TXA
PHA ;; push x to stack becuse we are about to corrupt it
LDX Object_type,y
LDA Object_y_hi,y
CLC
ADC ObjectBboxTop,x
CLC
ADC ObjectHeight,x
STA temp
PLA
TAX
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; what would drawOrder-1 be? if it is 0, would would have to become 0f.
LDY drawOrder-1,x
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
TXA
PHA
LDX Object_type,y
LDA Object_y_hi,y
CLC
ADC ObjectBboxTop,x
CLC
ADC ObjectHeight,x
STA temp1
PLA
TAX
LDA temp1
CMP temp
BCS doneWithSwapItem
LDA drawOrder,x
STA drawOrder-1,x
TYA
STA drawOrder,x
doneWithSwapItem:
INX
CPX #TOTAL_MAX_OBJECTS
BNE OrderLoop
RTS