-
Notifications
You must be signed in to change notification settings - Fork 1k
/
Route8Gate.asm
72 lines (66 loc) · 1.74 KB
/
Route8Gate.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
Route8Gate_Script:
call EnableAutoTextBoxDrawing
ld hl, Route8Gate_ScriptPointers
ld a, [wRoute8GateCurScript]
jp CallFunctionInTable
Route8Gate_ScriptPointers:
def_script_pointers
dw_const Route8GateDefaultScript, SCRIPT_ROUTE8GATE_DEFAULT
dw_const Route8GatePlayerMovingScript, SCRIPT_ROUTE8GATE_PLAYER_MOVING
Route8GateMovePlayerRightScript:
ld hl, wStatusFlags5
set BIT_SCRIPTED_MOVEMENT_STATE, [hl]
ld a, D_RIGHT
ld [wSimulatedJoypadStatesEnd], a
ld a, $1
ld [wSimulatedJoypadStatesIndex], a
xor a
ld [wSpritePlayerStateData2MovementByte1], a
ld [wOverrideSimulatedJoypadStatesMask], a
ret
Route8GateDefaultScript:
ld a, [wStatusFlags1]
bit BIT_GAVE_SAFFRON_GUARDS_DRINK, a
ret nz
ld hl, .PlayerInCoordsArray
call ArePlayerCoordsInArray
ret nc
ld a, PLAYER_DIR_LEFT
ld [wPlayerMovingDirection], a
xor a
ldh [hJoyHeld], a
farcall RemoveGuardDrink
ldh a, [hItemToRemoveID]
and a
jr nz, .have_drink
ld a, TEXT_ROUTE8GATE_GUARD_GEE_IM_THIRSTY
ldh [hTextID], a
call DisplayTextID
call Route8GateMovePlayerRightScript
ld a, SCRIPT_ROUTE8GATE_PLAYER_MOVING
ld [wRoute8GateCurScript], a
ret
.have_drink
ld hl, wStatusFlags1
set BIT_GAVE_SAFFRON_GUARDS_DRINK, [hl]
ld a, TEXT_ROUTE8GATE_GUARD_GIVE_DRINK
ldh [hTextID], a
jp DisplayTextID
.PlayerInCoordsArray:
dbmapcoord 2, 3
dbmapcoord 2, 4
db -1 ; end
Route8GatePlayerMovingScript:
ld a, [wSimulatedJoypadStatesIndex]
and a
ret nz
call Delay3
xor a
ld [wJoyIgnore], a
ld [wRoute8GateCurScript], a
ret
Route8Gate_TextPointers:
def_text_pointers
dw_const SaffronGateGuardText, TEXT_ROUTE8GATE_GUARD
dw_const SaffronGateGuardGeeImThirstyText, TEXT_ROUTE8GATE_GUARD_GEE_IM_THIRSTY
dw_const SaffronGateGuardGiveDrinkText, TEXT_ROUTE8GATE_GUARD_GIVE_DRINK