diff options
author | pikalaxalt <PikalaxALT@gmail.com> | 2016-06-22 09:43:39 -0400 |
---|---|---|
committer | pikalaxalt <PikalaxALT@gmail.com> | 2016-06-22 09:43:39 -0400 |
commit | 60bd94e78434bd97bb7ee1391b50c4df85adc9c5 (patch) | |
tree | 98147dabfa9064fafacd6f84070e703dfcb08e62 | |
parent | 5a85ac7ca3bd50f3d63b25a3aca4e97fe341195d (diff) |
Bike scripts
-rwxr-xr-x | event/overworld.asm | 145 | ||||
-rw-r--r-- | main.asm | 11 | ||||
-rw-r--r-- | wram.asm | 2 |
3 files changed, 153 insertions, 5 deletions
diff --git a/event/overworld.asm b/event/overworld.asm index ed7a3179..04f3514e 100755 --- a/event/overworld.asm +++ b/event/overworld.asm @@ -1566,10 +1566,149 @@ Text_NothingHereToFish: text_jump Text_NothingHereToFish_ db "@" -BikeFunction: ; d0c0 + + call Functiond0c9 + and $7f + ld [wFieldMoveSucceeded], a + ret + +Functiond0c9: ; d0c9 (3:50c9) + call CheckBikePermission + jr c, .cant_bike + ld a, [wPlayerBikeSurfState] + cp PLAYER_NORMAL + jr z, .get_on_bike + cp PLAYER_BIKE + jr z, .get_off_bike + jr .cant_bike + +.get_on_bike + ld hl, Script_GetOnBike + ld de, Script_GetOnBike_Register + call ChooseScriptBasedOnWhetherBikeIsRegistered + call QueueScript + xor a + ld [wMusicFade], a + ld de, MUSIC_NONE + call PlayMusic + call DelayFrame + call MaxVolume + ld de, MUSIC_BICYCLE + ld a, e + ld [wMapMusic], a + call PlayMusic + ld a, $1 + ret + +.get_off_bike + ld hl, wBikeFlags + bit 1, [hl] + jr nz, .asm_d118 + ld hl, Script_GetOffBike + ld de, Script_GetOffBike_Register + call ChooseScriptBasedOnWhetherBikeIsRegistered + ld a, $3 + jr .queue_off + +.asm_d118 + ld hl, Script_CantGetOffBike + jr .queue_off + +.cant_bike + ld a, $0 + ret + +.queue_off + call QueueScript + ld a, $1 + ret + +ChooseScriptBasedOnWhetherBikeIsRegistered: ; d126 (3:5126) + ld a, [wUsingItemWithSelect] + and a + ret z + ld h, d + ld l, e + ret + +CheckBikePermission: ; d12e (3:512e) + call GetMapPermission + call CheckOutdoorMap + jr z, .asm_d140 + cp CAVE + jr z, .asm_d140 + cp GATE + jr z, .asm_d140 + jr .asm_d149 + +.asm_d140 + call GetPlayerStandingTile + and $f + jr nz, .asm_d149 + xor a + ret + +.asm_d149 + scf + ret + +Script_GetOnBike: ; d14b + reloadmappart + special UpdateTimePals + writecode VAR_MOVEMENT, PLAYER_BIKE + writetext Text_GotOnTheBike + waitbutton + closetext + special ReplacePlayerSprite + end + +Script_GetOnBike_Register: + writecode VAR_MOVEMENT, PLAYER_BIKE + closetext + special ReplacePlayerSprite + end + + nop + ret + +Script_GetOffBike: + reloadmappart + special UpdateTimePals + writecode VAR_MOVEMENT, PLAYER_NORMAL + writetext Text_GotOffTheBike + waitbutton +FinishGettingOffBike: + closetext + special ReplacePlayerSprite + special PlayMapMusic + end + +Script_GetOffBike_Register: + writecode VAR_MOVEMENT, PLAYER_NORMAL + jump FinishGettingOffBike + +Script_CantGetOffBike: ; d17e + writetext Text_CantGetOffBike + waitbutton + closetext + end + +Text_CantGetOffBike: + text_jump Text_CantGetOffBike_ + db "@" + +Text_GotOnTheBike: + text_jump Text_GotOnTheBike_ + db "@" + +Text_GotOffTheBike: + text_jump Text_GotOffTheBike_ + db "@" + +TryCutOW: ; d193 IF DEF(GOLD) - dr $d0c0, $d1e2 + dr $d193, $d1e2 ENDC IF DEF(SILVER) - dr $d0be, $d1e0 + dr $d191, $d1e0 ENDC @@ -1469,7 +1469,16 @@ Text_NotEvenANibble_:: dr $194329, $19433d Text_NothingHereToFish_:: - dr $19433d, $195610 + dr $19433d, $19435e + +Text_CantGetOffBike_:: + dr $19435e, $194376 + +Text_GotOnTheBike_:: + dr $194376, $19438b + +Text_GotOffTheBike_:: + dr $19438b, $195610 ClockTimeUnknownText_:: ; 195610 dr $195610, $195624 @@ -2368,7 +2368,7 @@ wcfe7:: ds 1 ; cfe7 wcfe8:: ds 1 ; cfe8 wBattleResult:: ds 1 ; cfe9 wcfea:: ds 1 ; cfea -wcfeb:: ds 1 ; cfeb +wUsingItemWithSelect:: ds 1 ; cfeb wcfec:: ds 1 ; cfec wcfed:: ds 1 ; cfed wcfee:: ds 1 ; cfee |