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
|
FieldDebug_ChangeTransportation:
ld hl, .ChangeTransportationMenuHeader
call LoadMenuHeader
ld a, [wPlayerState]
call GetActiveTransportation
ld [wMenuCursorBuffer], a
dec a
call CopyNameFromMenu
call VerticalMenu
jp c, .exit
ld a, [wMenuCursorY]
call SetTransportation
ld hl, wPlayerState
cp [hl]
jr z, .exit
cp PLAYER_SURF
jr z, .check_surf
ld [wPlayerState], a
and a
jr z, .walking
ld a, [wMenuCursorY]
dec a
call CopyNameFromMenu
call CloseWindow
call CloseWindow
ld hl, .PlayerTransportationString2
call MenuTextBox
jr .update_sprite
.walking
ld a, -1
ld [wSkatingDirection], a
call CloseWindow
call CloseWindow
call PlayMapMusic
ld hl, .PlayerTransportationString1
call MenuTextBox
.update_sprite
callab GetPlayerSprite
ld a, BUTTONS
call FieldDebug_WaitJoypadInput
call CloseWindow
ld a, FIELDDEBUG_RETURN_CLEANUP
ret
.check_surf
call FieldDebug_CheckFacingSurfable
jr c, .cannot_surf
ld [wPlayerState], a
call FieldDebug_SetSurfDirection
ld a, [wMenuCursorY]
dec a
call CopyNameFromMenu
call CloseWindow
call CloseWindow
ld hl, .PlayerTransportationString2
call MenuTextBox
jr .update_sprite
.cannot_surf
ld hl, .CannotSurfString
call MenuTextBox
ld a, BUTTONS
call FieldDebug_WaitJoypadInput
call CloseWindow
.exit
call CloseWindow
ld a, FIELDDEBUG_RETURN_REOPEN
ret
.ChangeTransportationMenuHeader:
db MENU_BACKUP_TILES
menu_coords 3, 3, 12, 13
dw .ChangeTransportationMenuData
db 1
.ChangeTransportationMenuData:
db STATICMENU_WRAP | STATICMENU_CURSOR
db 4
db "あるき@"
db "じてんしゃ@"
db "スケボー@"
db "ラプラス@"
.PlayerTransportationString1:
text "<PLAYER>は@"
text_low
text_from_ram wStringBuffer2
text "から おりた"
prompt
.PlayerTransportationString2:
text "<PLAYER>は@"
text_low
text_from_ram wStringBuffer2
text "に のった"
prompt
.CannotSurfString:
text "ここでは のることが"
next "できません"
prompt
SetTransportation:
ld hl, TransportationList
dec a
ld c, a
ld b, 0
add hl, bc
ld a, [hl]
ret
GetActiveTransportation:
ld hl, TransportationList
ld b, 1
.loop
cp [hl]
jr z, .got_transportation
inc hl
inc b
jr .loop
.got_transportation
ld a, b
ret
TransportationList:
db PLAYER_NORMAL
db PLAYER_BIKE
db PLAYER_SKATE
db PLAYER_SURF
FieldDebug_CheckFacingSurfable:
push af
call GetFacingTileCoord
and COLLISION_TYPE_MASK
cp OLD_COLLISION_TYPE_WATER ; happens to match COLLISION_TYPE_WATER
jr z, .surfable
cp OLD_COLLISION_TYPE_WATER2
jr z, .surfable
; not surfable
pop af
scf
ret
.surfable
pop af
and a
ret
FieldDebug_SetSurfDirection:
ld a, [wPlayerWalking]
srl a
srl a
ld e, a
ld d, 0
ld hl, .Directions
add hl, de
ld a, [hl]
ld [wPlayerMovement], a
ret
.Directions:
db SLOW_STEP_DOWN
db SLOW_STEP_UP
db SLOW_STEP_LEFT
db SLOW_STEP_RIGHT
|