-
Notifications
You must be signed in to change notification settings - Fork 0
/
0x31CustomObject.asm
155 lines (108 loc) · 3.29 KB
/
0x31CustomObject.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
; ==============================================================================
pushpc
org $018262 ;object id 0x31
dw ExpandedObject31
org $01B541
ExpandedObject31:
JSL NewObjectsCode31
RTS
pullpc
; ==============================================================================
NewObjectsCode31:
{
PHB : PHK : PLB
PHX
; $00 Will be used for tilecount and tiletoskip!!
LDA $00 : PHA ; Store $00 value Not sure if needed.
LDA $02 : PHA ; Store $00 value Not sure if needed.
LDA $B2 : ASL #2 : ORA $B4
; Get the offset for the object data based on the object height.
ASL : TAX
LDA .objOffset, X
TAX
.lineLoop
LDA .objData, X : BEQ .done
PHY ; Keep current position in the buffer.
STA $00 ; We save the tilecount + tiletoskip.
.tileLoop
INX : INX
LDA .objData, X : BEQ +
STA [$BF], Y
+
; If it is one of the slime objects, set the collision to 0x00.
; Doesn't currently work because it gets replaced by something else later.
;CPX.w .slimeStart : BCC .noCollision
;PHX
;TYA : LSR : TAX
;SEP #$20 ; Set A in 8bit mode.
;LDA.b #$00 : STA.l $7F2000, X
;REP #$20 ; Set A in 16bit mode.
;PLX
;.noCollision
INY : INY
LDA $00 : DEC : STA $00 : AND #$001F : BNE +
LDA $00 : XBA : AND #$00FF : STA $00
PLA ; Pull back position.
CLC : ADC $00 : TAY
INX : INX
BRA .lineLoop
+
BRA .tileLoop
.done
PLA : STA $02
PLA : STA $00 ; Not sure if needed.
PLX
PLB
RTL
;Format =
;[xoffset][uuuc cccc] ;32 tiles max width
;u = unused
;c = tiles count on the line
;0x0000 for end the copy
;xoffset (0x0080) = one full line
;[vhop ppcc][cccc cccc]
.objOffset
dw .north-.objData ; 0x00
dw .south-.objData ; 0x01
dw .east-.objData ; 0x02
dw .west-.objData ; 0x03
.slimeStart
dw .slime1-.objData ; 0x04
dw .slime2-.objData ; 0x05
dw .slime3-.objData ; 0x06
dw .slime4-.objData ; 0x07
dw .slime5-.objData ; 0x08
dw .slime6-.objData ; 0x09
dw .slime7-.objData ; 0x0A
dw .slime8-.objData ; 0x0B
.potStart
dw .EmptyPot-.objData ; 0x0C
.objData
.north
incbin objects/northPillar.bin
.south
incbin objects/southPillar.bin
.east
incbin objects/eastPillar.bin
.west
incbin objects/westPillar.bin
.slime1
incbin objects/slime1.bin
.slime2
incbin objects/slime2.bin
.slime3
incbin objects/slime3.bin
.slime4
incbin objects/slime4.bin
.slime5
incbin objects/slime5.bin
.slime6
incbin objects/slime6.bin
.slime7
incbin objects/slime7.bin
.slime8
incbin objects/slime8.bin
.EmptyPot
incbin objects/EmptyPot.bin
}
; ==============================================================================