Skip to content

WIP: Add skateboard transportation method #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion constants/item_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
const FIRE_STONE ; 16
const THUNDERSTONE ; 17
const WATER_STONE ; 18
const ITEM_19 ; 19
const SKATEBOARD ; 19
const HP_UP ; 1a
const PROTEIN ; 1b
const IRON ; 1c
Expand Down
2 changes: 2 additions & 0 deletions constants/sprite_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@
const SPRITE_ENTEI ; 64
const SPRITE_RAIKOU ; 65
const SPRITE_STANDING_YOUNGSTER ; 66
const SPRITE_KRIS_SKATE ; 67
const SPRITE_CHRIS_SKATE ; 68

; SpriteMons indexes (see data/sprites/sprite_mons.asm)
const_def $80
Expand Down
4 changes: 2 additions & 2 deletions data/items/attributes.asm
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ ItemAttributes:
item_attribute 2100, HELD_NONE, 0, CANT_SELECT, ITEM, ITEMMENU_PARTY, ITEMMENU_NOUSE
; WATER_STONE
item_attribute 2100, HELD_NONE, 0, CANT_SELECT, ITEM, ITEMMENU_PARTY, ITEMMENU_NOUSE
; ITEM_19
item_attribute $9999, HELD_NONE, 0, NO_LIMITS, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE
; SKATEBOARD
item_attribute 1000, HELD_NONE, 0, CANT_TOSS, KEY_ITEM, ITEMMENU_CLOSE, ITEMMENU_NOUSE
; HP_UP
item_attribute 9800, HELD_NONE, 0, CANT_SELECT, ITEM, ITEMMENU_PARTY, ITEMMENU_NOUSE
; PROTEIN
Expand Down
2 changes: 1 addition & 1 deletion data/items/catch_rate_items.asm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
; item associated with the table entry is used instead.

TimeCapsule_CatchRateItems:
db ITEM_19, LEFTOVERS
db SKATEBOARD, LEFTOVERS
db ITEM_2D, BITTER_BERRY
db ITEM_32, GOLD_BERRY
db ITEM_5A, BERRY
Expand Down
7 changes: 4 additions & 3 deletions data/items/descriptions.asm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ItemDescriptions:
dw FireStoneDesc
dw ThunderStoneDesc
dw WaterStoneDesc
dw TeruSama2Desc
dw SkateboardDesc
dw HPUpDesc
dw ProteinDesc
dw IronDesc
Expand Down Expand Up @@ -351,8 +351,9 @@ WaterStoneDesc:
db "Evolves certain"
next "kinds of #MON.@"

TeruSama2Desc:
db "?@"
SkateboardDesc:
db "A skateboard for"
next "moving in style.@"

HPUpDesc:
db "Raises the HP of"
Expand Down
2 changes: 1 addition & 1 deletion data/items/names.asm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ItemNames::
db "FIRE STONE@"
db "THUNDERSTONE@"
db "WATER STONE@"
db "TERU-SAMA@"
db "SKATEBOARD@"
db "HP UP@"
db "PROTEIN@"
db "IRON@"
Expand Down
2 changes: 2 additions & 0 deletions data/sprites/sprites.asm
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,5 @@ OverworldSprites:
overworld_sprite EnteiSpriteGFX, 4, STILL_SPRITE, PAL_OW_RED
overworld_sprite RaikouSpriteGFX, 4, STILL_SPRITE, PAL_OW_RED
overworld_sprite StandingYoungsterSpriteGFX, 12, STANDING_SPRITE, PAL_OW_BLUE
overworld_sprite KrisSkateSpriteGFX, 12, WALKING_SPRITE, PAL_OW_BLUE
overworld_sprite ChrisSkateSpriteGFX, 12, WALKING_SPRITE, PAL_OW_BLUE
138 changes: 138 additions & 0 deletions engine/events/overworld.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1620,6 +1620,93 @@ UnusedNothingHereText: ; unused
text_far _UnusedNothingHereText
text_end


SkateFunction:
call .TrySkate
and $7f
ld [wFieldMoveSucceeded], a
ret

.TrySkate:
call .CheckEnvironment
jr c, .CannotUseSkateboard
ld a, [wPlayerState]
cp PLAYER_NORMAL
jr z, .GetOnSkateboard
cp PLAYER_SKATE
jr z, .GetOffSkateboard
jr .CannotUseSkateboard

.GetOnSkateboard:
ld hl, Script_GetOnSkateboard
ld de, Script_GetOnSkateboard_Register
call .CheckIfRegistered
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

.GetOffSkateboard:
ld hl, wBikeFlags
bit BIKEFLAGS_ALWAYS_ON_BIKE_F, [hl]
jr nz, .CantGetOffSkateboard
ld hl, Script_GetOffSkateboard
ld de, Script_GetOffSkateboard_Register
call .CheckIfRegistered
ld a, BANK(Script_GetOffSkateboard)
jr .done

.CantGetOffSkateboard:
ld hl, Script_CantGetOffSkateboard
jr .done

.CannotUseSkateboard:
ld a, $0
ret

.done
call QueueScript
ld a, $1
ret

.CheckIfRegistered:
ld a, [wUsingItemWithSelect]
and a
ret z
ld h, d
ld l, e
ret

.CheckEnvironment:
call GetMapEnvironment
call CheckOutdoorMap
jr z, .ok
cp CAVE
jr z, .ok
cp GATE
jr z, .ok
jr .nope

.ok
call GetPlayerStandingTile
and WALLTILE | WATERTILE ; can't use our bike in a wall or on water
jr nz, .nope
xor a
ret

.nope
scf
ret

BikeFunction:
call .TryBike
and $7f
Expand Down Expand Up @@ -1722,6 +1809,22 @@ Script_GetOnBike_Register:
special ReplaceKrisSprite
end

Script_GetOnSkateboard:
reloadmappart
special UpdateTimePals
loadvar VAR_MOVEMENT, PLAYER_SKATE
writetext GotOnSkateboardText
waitbutton
closetext
special ReplaceKrisSprite
end

Script_GetOnSkateboard_Register:
loadvar VAR_MOVEMENT, PLAYER_SKATE
closetext
special ReplaceKrisSprite
end

; unused
nop
ret
Expand Down Expand Up @@ -1761,6 +1864,41 @@ GotOffBikeText:
text_far _GotOffBikeText
text_end

Script_GetOffSkateboard:
reloadmappart
special UpdateTimePals
loadvar VAR_MOVEMENT, PLAYER_NORMAL
writetext GotOffSkateboardText
waitbutton

FinishGettingOffSkateboard:
closetext
special ReplaceKrisSprite
special PlayMapMusic
end

Script_GetOffSkateboard_Register:
loadvar VAR_MOVEMENT, PLAYER_NORMAL
sjump FinishGettingOffSkateboard

Script_CantGetOffSkateboard:
writetext .CantGetOffSkateboardText
waitbutton
closetext
end

.CantGetOffSkateboardText:
text_far _CantGetOffBikeText
text_end

GotOnSkateboardText:
text_far _GotOffBikeText
text_end

GotOffSkateboardText:
text_far _GotOffBikeText
text_end

TryCutOW::
ld d, CUT
call CheckPartyMove
Expand Down
6 changes: 5 additions & 1 deletion engine/items/item_effects.asm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ItemEffects:
dw EvoStoneEffect ; FIRE_STONE
dw EvoStoneEffect ; THUNDERSTONE
dw EvoStoneEffect ; WATER_STONE
dw NoEffect ; ITEM_19
dw SkateboardEffect ; SKATEBOARD
dw VitaminEffect ; HP_UP
dw VitaminEffect ; PROTEIN
dw VitaminEffect ; IRON
Expand Down Expand Up @@ -1143,6 +1143,10 @@ BicycleEffect:
farcall BikeFunction
ret

SkateboardEffect:
farcall SkateFunction
ret

EvoStoneEffect:
ld b, PARTYMENUACTION_EVO_STONE
call UseItem_SelectMon
Expand Down
6 changes: 6 additions & 0 deletions gfx/sprites.asm
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,9 @@ SuicuneSpriteGFX:: INCBIN "gfx/sprites/suicune.2bpp"
EnteiSpriteGFX:: INCBIN "gfx/sprites/entei.2bpp"
RaikouSpriteGFX:: INCBIN "gfx/sprites/raikou.2bpp"
StandingYoungsterSpriteGFX:: INCBIN "gfx/sprites/standing_youngster.2bpp"


SECTION "Sprites 3", ROMX

KrisSkateSpriteGFX:: INCBIN "gfx/sprites/kris_skateboard.2bpp"
ChrisSkateSpriteGFX:: INCBIN "gfx/sprites/chris_skateboard.2bpp"
Binary file added gfx/sprites/chris_skateboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gfx/sprites/kris_skateboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.