forked from KatDevsGames/z3randomizer
-
Notifications
You must be signed in to change notification settings - Fork 6
/
elder.asm
70 lines (57 loc) · 1.59 KB
/
elder.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
NewElderCode:
{
LDA $8A : CMP #$1B : BEQ .newCodeContinue
;Restore Jump we can keep the RTL so JML
JML $05F0CD
.newCodeContinue
PHB : PHK : PLB
LDA.b #$07 : STA $0F50, X ;Palette
JSR Elder_Draw
JSL Sprite_PlayerCantPassThrough
JSR Elder_Code
PLB
RTL
Elder_Draw:
{
LDA.b #$02 : STA $06 : STZ $07 ;Number of Tiles
LDA $0DC0, X : ASL #04
ADC.b #.animation_states : STA $08
LDA.b #.animation_states>>8 : ADC.b #$00 : STA $09
JSL Sprite_DrawMultiple_player_deferred
JSL Sprite_DrawShadowLong
RTS
.animation_states
;Frame0
dw 0, -9 : db $C6, $00, $00, $02
dw 0, 0 : db $C8, $00, $00, $02
;Frame1
dw 0, -8 : db $C6, $00, $00, $02
dw 0, 0 : db $CA, $40, $00, $02
}
Elder_Code:
{
!GOAL_ELDER = "$7EF41A"
LDA GoalItemRequirement : ORA GoalItemRequirement+1 : BEQ .despawn
LDA InvincibleGanon : CMP #$05 : BEQ .despawn
LDA TurnInGoalItems : BNE +
.despawn
STZ $0DD0, X ; despawn self
RTS
+
LDA.b #$96
LDY.b #$01
JSL Sprite_ShowSolicitedMessageIfPlayerFacing_PreserveMessage : BCC .dont_show
REP #$20
LDA.l !GOAL_COUNTER
CMP.l GoalItemRequirement : !BLT +
SEP #$20
JSL.l ActivateGoal
+
SEP #$20
LDA #$01
STA.l !GOAL_ELDER
.dont_show
.done
LDA $1A : LSR #5 : AND.b #$01 : STA $0DC0, X
RTS
}