forked from ArchipelagoMW/z3randomizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
heartpieces.asm
594 lines (552 loc) · 16.7 KB
/
heartpieces.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
;================================================================================
; Randomize Heart Pieces
;--------------------------------------------------------------------------------
HeartPieceGet:
PHX : PHY
LDY $0E80, X ; load item value into Y register
BNE +
; if for any reason the item value is 0 reload it, just in case
JSL.l LoadHeartPieceRoomValue : TAY
+
JSL.l MaybeMarkDigSpotCollected
.skipLoad
JSL.l HeartPieceGetPlayer : STA !MULTIWORLD_ITEM_PLAYER_ID
STZ $02E9 ; 0 = Receiving item from an NPC or message
CPY.b #$26 : BNE .notHeart ; don't add a 1/4 heart if it's not a heart piece
LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE .notHeart
LDA $7EF36B : INC A : AND.b #$03 : STA $7EF36B : BNE .unfinished_heart ; add up heart quarters
BRA .giveItem
.notHeart
.giveItem
JSL.l $0791B3 ; Player_HaltDashAttackLong
JSL.l Link_ReceiveItem
CLC ; return false
BRL .done ; finished
.unfinished_heart
SEC ; return true
.done
JSL MaybeUnlockTabletAnimation
PLY : PLX
RTL
;--------------------------------------------------------------------------------
HeartContainerGet:
PHX : PHY
JSL.l AddInventory_incrementBossSwordLong
LDY $0E80, X ; load item value into Y register
BNE +
; if for any reason the item value is 0 reload it, just in case
JSL.l LoadHeartContainerRoomValue : TAY
+
BRA HeartPieceGet_skipLoad
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
DrawHeartPieceGFX:
PHP
JSL.l Sprite_IsOnscreen : BCC .offscreen
PHA : PHY
LDA !REDRAW : BEQ .skipInit ; skip init if already ready
JSL.l HeartPieceSpritePrep
BRL .done ; don't draw on the init frame
.skipInit
LDA $0E80, X ; Retrieve stored item type
.skipLoad
JSL.l DrawDynamicTile
CMP #$03 : BNE +
PHA : LDA $0E60, X : ORA.b #$20 : STA $0E60, X : PLA
+
JSL.l Sprite_DrawShadowLong
.done
PLY : PLA
.offscreen
PLP
RTL
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
DrawHeartContainerGFX:
PHP
JSL.l Sprite_IsOnscreen : BCC DrawHeartPieceGFX_offscreen
PHA : PHY
LDA !REDRAW : BEQ .skipInit ; skip init if already ready
JSL.l HeartContainerSpritePrep
BRA DrawHeartPieceGFX_done ; don't draw on the init frame
.skipInit
LDA $0E80, X ; Retrieve stored item type
BRA DrawHeartPieceGFX_skipLoad
;--------------------------------------------------------------------------------
HeartContainerSound:
LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE +
CPY.b #$20 : BEQ + ; Skip for Crystal
CPY.b #$37 : BEQ + ; Skip for Pendants
CPY.b #$38 : BEQ +
CPY.b #$39 : BEQ +
JSL.l CheckIfBossRoom : BCC + ; Skip if not in a boss room
LDA.b #$2E
SEC
RTL
+
CLC
RTL
;--------------------------------------------------------------------------------
NormalItemSkipSound:
LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
SEC
RTL
+
LDA $0C5E, X ; thing we wrote over
CPY.b #$20 : BEQ + ; Skip for Crystal
CPY.b #$37 : BEQ + ; Skip for Pendants
CPY.b #$38 : BEQ +
CPY.b #$39 : BEQ +
PHA
JSL.l CheckIfBossRoom
PLA
RTL
+
CLC
RTL
;--------------------------------------------------------------------------------
HeartUpgradeSpawnDecision: ; this should return #$00 to make the hp spawn
LDA !FORCE_HEART_SPAWN : BEQ .normal_behavior
DEC : STA !FORCE_HEART_SPAWN
LDA #$00
RTL
.normal_behavior
LDA $7EF280, X
RTL
;--------------------------------------------------------------------------------
SaveHeartCollectedStatus:
LDA !SKIP_HEART_SAVE : BEQ .normal_behavior
DEC : STA !SKIP_HEART_SAVE
RTL
.normal_behavior
LDA $7EF280, X : ORA.b #$40 : STA $7EF280, X
RTL
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
HeartPieceSpritePrep:
PHA
LDA ServerRequestMode : BEQ + : : +
LDA #$01 : STA !REDRAW
LDA $5D : CMP #$14 : BEQ .skip ; skip if we're mid-mirror
LDA #$00 : STA !REDRAW
JSL.l HeartPieceGetPlayer : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
JSL.l LoadHeartPieceRoomValue ; load item type
STA $0E80, X ; Store item type
JSL.l PrepDynamicTile
.skip
PLA
RTL
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
HeartContainerSpritePrep:
PHA
LDA #$00 : STA !REDRAW
JSL.l HeartPieceGetPlayer : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
JSL.l LoadHeartContainerRoomValue ; load item type
STA $0E80, X ; Store item type
JSL.l PrepDynamicTile
PLA
RTL
;--------------------------------------------------------------------------------
LoadHeartPieceRoomValue:
LDA $1B : BEQ .outdoors ; check if we're indoors or outdoors
.indoors
JSL.l LoadIndoorValue
BRL .done
.outdoors
JSL.l LoadOutdoorValue
.done
RTL
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
HPItemReset:
PHA
LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE .skip
PLA
JSL $09AD58 ; GiveRupeeGift - thing we wrote over
BRA .done
.skip
PLA
.done
PHA : LDA #$01 : STA !REDRAW : PLA
RTL
;--------------------------------------------------------------------------------
MaybeMarkDigSpotCollected:
PHA : PHP
LDA $1B : BNE +
REP #$20 ; set 16-bit accumulator
LDA $8A
CMP.w #$2A : BNE +
LDA !HAS_GROVE_ITEM : ORA.w #$0001 : STA !HAS_GROVE_ITEM
+
PLP : PLA
RTL
;--------------------------------------------------------------------------------
macro GetPossiblyEncryptedItem(ItemLabel,TableLabel)
LDA IsEncrypted : BNE ?encrypted
LDA.l <ItemLabel>
BRA ?done
?encrypted:
PHX : PHP
REP #$30 ; set 16-bit accumulator & index registers
LDA $00 : PHA : LDA $02 : PHA
LDA.w #<TableLabel> : STA $00
LDA.w #<TableLabel>>>16 : STA $02
LDA.w #<ItemLabel>-<TableLabel>
JSL RetrieveValueFromEncryptedTable
PLX : STX $02 : PLX : STX $00
PLP : PLX
?done:
endmacro
GetEncryptedPlayerID:
PHX
TAX
LDA $00 : PHA : LDA $02 : PHA
LDA.w #ItemPlayerTable : STA $00
LDA.w #ItemPlayerTable>>16 : STA $02
TXA
JSL RetrieveValueFromEncryptedTable
PLX : STX $02 : PLX : STX $00
PLX
RTL
macro GetPossiblyEncryptedPlayerID(PlayerLabel)
LDA IsEncrypted : BNE ?encrypted
LDA.l <PlayerLabel>
BRA ?done
?encrypted:
PHP : REP #$30 ; set 16-bit accumulator & index registers
LDA.w #<PlayerLabel>-ItemPlayerTable
JSL GetEncryptedPlayerID
AND.w #$00FF
PLP
?done:
endmacro
LoadIndoorValue:
PHP
REP #$20 ; set 16-bit accumulator
LDA $A0 ; these are all decimal because i got them that way
CMP.w #225 : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Forest_Thieves, HeartPieceIndoorValues)
BRL .done
+ CMP.w #226 : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Lumberjack_Tree, HeartPieceIndoorValues)
BRL .done
+ CMP.w #234 : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Spectacle_Cave, HeartPieceIndoorValues)
BRL .done
+ CMP.w #283 : BNE +
LDA $22 : XBA : AND.w #$0001 ; figure out where link is
BNE ++
%GetPossiblyEncryptedItem(HeartPiece_Circle_Bushes, HeartPieceIndoorValues)
BRL .done
++
%GetPossiblyEncryptedItem(HeartPiece_Graveyard_Warp, HeartPieceIndoorValues)
BRL .done
+ CMP.w #294 : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Mire_Warp, HeartPieceIndoorValues)
BRL .done
+ CMP.w #295 : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Smith_Pegs, HeartPieceIndoorValues)
BRL .done
+ CMP.w #135 : BNE +
%GetPossiblyEncryptedItem(StandingKey_Hera, HeartPieceIndoorValues)
BRL .done
+
LDA.w #$0017 ; default to a normal hp
.done
AND.w #$00FF ; the loads are words but the values are 1-byte so we need to clear the top half of the accumulator - no guarantee it was 8-bit before
PLP
RTL
;--------------------------------------------------------------------------------
;225 - HeartPiece_Forest_Thieves
;226 - HeartPiece_Lumberjack_Tree
;234 - HeartPiece_Spectacle_Cave
;283 - HeartPiece_Circle_Bushes
;283 - HeartPiece_Graveyard_Warp
;294 - HeartPiece_Mire_Warp
;295 - HeartPiece_Smith_Pegs
;--------------------------------------------------------------------------------
LoadOutdoorValue:
PHP
REP #$20 ; set 16-bit accumulator
LDA $8A
CMP.w #$03 : BNE +
LDA $22 : CMP.w #1890 : !BLT ++
%GetPossiblyEncryptedItem(HeartPiece_Spectacle, HeartPieceOutdoorValues)
BRL .done
++
%GetPossiblyEncryptedItem(EtherItem, SpriteItemValues)
BRL .done
+ CMP.w #$05 : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Mountain_Warp, HeartPieceOutdoorValues)
BRL .done
+ CMP.w #$28 : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Maze, HeartPieceOutdoorValues)
BRL .done
+ CMP.w #$2A : BNE +
%GetPossiblyEncryptedItem(HauntedGroveItem, HeartPieceOutdoorValues)
BRL .done
+ CMP.w #$30 : BNE +
LDA $22 : CMP.w #512 : !BGE ++
%GetPossiblyEncryptedItem(HeartPiece_Desert, HeartPieceOutdoorValues)
BRL .done
++
%GetPossiblyEncryptedItem(BombosItem, SpriteItemValues)
BRL .done
+ CMP.w #$35 : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Lake, HeartPieceOutdoorValues)
BRL .done
+ CMP.w #$3B : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Swamp, HeartPieceOutdoorValues)
BRL .done
+ CMP.w #$42 : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Cliffside, HeartPieceOutdoorValues)
BRL .done
+ CMP.w #$4A : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Cliffside, HeartPieceOutdoorValues)
BRL .done
+ CMP.w #$5B : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Pyramid, HeartPieceOutdoorValues)
BRL .done
+ CMP.w #$68 : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Digging, HeartPieceOutdoorValues)
BRL .done
+ CMP.w #$81 : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Zora, HeartPieceOutdoorValues)
BRL .done
+
LDA.w #$0017 ; default to a normal hp
.done
AND.w #$00FF ; the loads are words but the values are 1-byte so we need to clear the top half of the accumulator - no guarantee it was 8-bit before
PLP
RTL
;--------------------------------------------------------------------------------
;$03 - HeartPiece_Spectacle
;$05 - HeartPiece_Mountain_Warp
;$28 - HeartPiece_Maze
;$30 - HeartPiece_Desert
;$35 - HeartPiece_Lake
;$3B - HeartPiece_Swamp
;$42 - HeartPiece_Cliffside - not really but the gfx load weird otherwise
;$4A - HeartPiece_Cliffside
;$5B - HeartPiece_Pyramid
;$68 - HeartPiece_Digging
;$81 - HeartPiece_Zora
;--------------------------------------------------------------------------------
LoadHeartContainerRoomValue:
LoadBossValue:
PHP
REP #$20 ; set 16-bit accumulator
LDA $A0 ; these are all decimal because i got them that way
CMP.w #200 : BNE +
%GetPossiblyEncryptedItem(HeartContainer_ArmosKnights, HeartContainerBossValues)
BRL .done
+ CMP.w #51 : BNE +
%GetPossiblyEncryptedItem(HeartContainer_Lanmolas, HeartContainerBossValues)
BRL .done
+ CMP.w #7 : BNE +
%GetPossiblyEncryptedItem(HeartContainer_Moldorm, HeartContainerBossValues)
BRL .done
+ CMP.w #90 : BNE +
%GetPossiblyEncryptedItem(HeartContainer_HelmasaurKing, HeartContainerBossValues)
BRL .done
+ CMP.w #6 : BNE +
%GetPossiblyEncryptedItem(HeartContainer_Arrghus, HeartContainerBossValues)
BRL .done
+ CMP.w #41 : BNE +
%GetPossiblyEncryptedItem(HeartContainer_Mothula, HeartContainerBossValues)
BRL .done
+ CMP.w #172 : BNE +
%GetPossiblyEncryptedItem(HeartContainer_Blind, HeartContainerBossValues)
BRL .done
+ CMP.w #222 : BNE +
%GetPossiblyEncryptedItem(HeartContainer_Kholdstare, HeartContainerBossValues)
BRL .done
+ CMP.w #144 : BNE +
%GetPossiblyEncryptedItem(HeartContainer_Vitreous, HeartContainerBossValues)
BRL .done
+ CMP.w #164 : BNE +
%GetPossiblyEncryptedItem(HeartContainer_Trinexx, HeartContainerBossValues)
BRL .done
+
LDA.w #$003E ; default to a normal boss heart
.done
AND.w #$00FF ; the loads are words but the values are 1-byte so we need to clear the top half of the accumulator - no guarantee it was 8-bit before
PLP
RTL
;--------------------------------------------------------------------------------
CheckIfBossRoom:
;--------------------------------------------------------------------------------
; Carry set if we're in a boss room, unset otherwise.
;--------------------------------------------------------------------------------
REP #$20 ; set 16-bit accumulator
LDA $A0 ; these are all decimal because i got them that way
CMP.w #200 : BNE +
SEC : BRL .done
+ CMP.w #51 : BNE +
SEC : BRL .done
+ CMP.w #7 : BNE +
SEC : BRL .done
+ CMP.w #90 : BNE +
SEC : BRL .done
+ CMP.w #6 : BNE +
SEC : BRL .done
+ CMP.w #41 : BNE +
SEC : BRL .done
+ CMP.w #172 : BNE +
SEC : BRL .done
+ CMP.w #222 : BNE +
SEC : BRL .done
+ CMP.w #144 : BNE +
SEC : BRL .done
+ CMP.w #164 : BNE +
SEC : BRL .done
+
CLC
.done
SEP #$20 ; set 8-bit accumulator
RTL
;--------------------------------------------------------------------------------
;#200 - Eastern Palace - Armos Knights
;#51 - Desert Palace - Lanmolas
;#7 - Tower of Hera - Moldorm
;#32 - Agahnim's Tower - Agahnim I
;#90 - Palace of Darkness - Helmasaur King
;#6 - Swamp Palace - Arrghus
;#41 - Skull Woods - Mothula
;#172 - Thieves' Town - Blind
;#222 - Ice Palace - Kholdstare
;#144 - Misery Mire - Vitreous
;#164 - Turtle Rock - Trinexx
;#13 - Ganon's Tower - Agahnim II
;#0 - Pyramid of Power - Ganon
;--------------------------------------------------------------------------------
;JSL $06DD40 ; DashKey_Draw
;JSL $06DBF8 ; Sprite_PrepAndDrawSingleLargeLong
;JSL $06DC00 ; Sprite_PrepAndDrawSingleSmallLong ; draw first cell correctly
;JSL $00D51B ; GetAnimatedSpriteTile
;JSL $00D52D ; GetAnimatedSpriteTile.variable
;================================================================================
HeartPieceGetPlayer:
{
PHY
LDA $1B : BNE +
BRL .outdoors
+
PHP
REP #$20 ; set 16-bit accumulator
LDA $A0 ; these are all decimal because i got them that way
CMP.w #135 : BNE +
%GetPossiblyEncryptedPlayerID(StandingKey_Hera_Player)
BRL .done
+ CMP.w #200 : BNE +
%GetPossiblyEncryptedPlayerID(HeartContainer_ArmosKnights_Player)
BRL .done
+ CMP.w #51 : BNE +
%GetPossiblyEncryptedPlayerID(HeartContainer_Lanmolas_Player)
BRL .done
+ CMP.w #7 : BNE +
%GetPossiblyEncryptedPlayerID(HeartContainer_Moldorm_Player)
BRL .done
+ CMP.w #90 : BNE +
%GetPossiblyEncryptedPlayerID(HeartContainer_HelmasaurKing_Player)
BRL .done
+ CMP.w #6 : BNE +
%GetPossiblyEncryptedPlayerID(HeartContainer_Arrghus_Player)
BRL .done
+ CMP.w #41 : BNE +
%GetPossiblyEncryptedPlayerID(HeartContainer_Mothula_Player)
BRL .done
+ CMP.w #172 : BNE +
%GetPossiblyEncryptedPlayerID(HeartContainer_Blind_Player)
BRL .done
+ CMP.w #222 : BNE +
%GetPossiblyEncryptedPlayerID(HeartContainer_Kholdstare_Player)
BRL .done
+ CMP.w #144 : BNE +
%GetPossiblyEncryptedPlayerID(HeartContainer_Vitreous_Player)
BRL .done
+ CMP.w #164 : BNE +
%GetPossiblyEncryptedPlayerID(HeartContainer_Trinexx_Player)
BRL .done
+ CMP.w #225 : BNE +
%GetPossiblyEncryptedPlayerID(HeartPiece_Forest_Thieves_Player)
BRL .done
+ CMP.w #226 : BNE +
%GetPossiblyEncryptedPlayerID(HeartPiece_Lumberjack_Tree_Player)
BRL .done
+ CMP.w #234 : BNE +
%GetPossiblyEncryptedPlayerID(HeartPiece_Spectacle_Cave_Player)
BRL .done
+ CMP.w #283 : BNE +
LDA $22 : XBA : AND.w #$0001 ; figure out where link is
BNE ++
%GetPossiblyEncryptedPlayerID(HeartPiece_Circle_Bushes_Player)
BRL .done
++
%GetPossiblyEncryptedPlayerID(HeartPiece_Graveyard_Warp_Player)
BRL .done
+ CMP.w #294 : BNE +
%GetPossiblyEncryptedPlayerID(HeartPiece_Mire_Warp_Player)
BRL .done
+ CMP.w #295 : BNE +
%GetPossiblyEncryptedPlayerID(HeartPiece_Smith_Pegs_Player)
BRL .done
LDA.w #$0000
BRL .done
.outdoors
PHP
REP #$20 ; set 16-bit accumulator
LDA $8A
CMP.w #$03 : BNE +
LDA $22 : CMP.w #1890 : !BLT ++
%GetPossiblyEncryptedPlayerID(HeartPiece_Spectacle_Player)
BRL .done
++
%GetPossiblyEncryptedPlayerID(EtherItem_Player)
BRL .done
+ CMP.w #$05 : BNE +
%GetPossiblyEncryptedPlayerID(HeartPiece_Mountain_Warp_Player)
BRL .done
+ CMP.w #$28 : BNE +
%GetPossiblyEncryptedPlayerID(HeartPiece_Maze_Player)
BRL .done
+ CMP.w #$2A : BNE +
%GetPossiblyEncryptedPlayerID(HauntedGroveItem_Player)
BRL .done
+ CMP.w #$30 : BNE +
LDA $22 : CMP.w #512 : !BGE ++
%GetPossiblyEncryptedPlayerID(HeartPiece_Desert_Player)
BRL .done
++
%GetPossiblyEncryptedPlayerID(BombosItem_Player)
BRL .done
+ CMP.w #$35 : BNE +
%GetPossiblyEncryptedPlayerID(HeartPiece_Lake_Player)
BRL .done
+ CMP.w #$3B : BNE +
%GetPossiblyEncryptedPlayerID(HeartPiece_Swamp_Player)
BRL .done
+ CMP.w #$42 : BNE +
%GetPossiblyEncryptedPlayerID(HeartPiece_Cliffside_Player)
BRL .done
+ CMP.w #$4A : BNE +
%GetPossiblyEncryptedPlayerID(HeartPiece_Cliffside_Player)
BRL .done
+ CMP.w #$5B : BNE +
%GetPossiblyEncryptedPlayerID(HeartPiece_Pyramid_Player)
BRL .done
+ CMP.w #$68 : BNE +
%GetPossiblyEncryptedPlayerID(HeartPiece_Digging_Player)
BRL .done
+ CMP.w #$81 : BNE +
%GetPossiblyEncryptedPlayerID(HeartPiece_Zora_Player)
BRL .done
+
LDA.w #$0000
.done
AND.w #$00FF ; the loads are words but the values are 1-byte so we need to clear the top half of the accumulator - no guarantee it was 8-bit before
PLP
PLY
RTL
}