jep-hack/engine/overworld/map_setup.asm
Llinos Evans 093bda0253 Strong Arm, Water Sport, and more HMs.
This adds Rock Climb functionality to Strong Arm and Dive functionality to Water Sport, as discussed in the server. HMs have been added, but we need 16bit Items to add Wind Ride, and I haven't finished their functionality.

The Rock Climb tile is a bit terrible, it's not easy to notice. Maybe change so that it works well with yellow or another colour?

This does not build due to issues with effect_commands.asm, but since Zeta is meant to be working on the mapping and Water Sport anyway, it seems to be up his alley.

I ported over much of the underwater assets Rangi was using as they looked very pretty. I imagine it'll be fun to utilise going forward. May as well, right?

I shall now lay down in a dark room.

Review: c21561ea71 (diff-5508f3b794fc68821ba35e94b6a293b2aaaa16c02a1b34fac70d03fd2f74c4b2R113)
2024-12-28 06:26:01 +00:00

212 lines
2.8 KiB
NASM

RunMapSetupScript::
ldh a, [hMapEntryMethod]
and $f
dec a
ld c, a
ld b, 0
ld hl, MapSetupScripts
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
call ReadMapSetupScript
ret
INCLUDE "data/maps/setup_scripts.asm"
ReadMapSetupScript:
.loop
ld a, [hli]
cp -1 ; end?
ret z
push hl
ld c, a
ld b, 0
ld hl, MapSetupCommands
add hl, bc
add hl, bc
add hl, bc
; bank
ld b, [hl]
inc hl
; address
ld a, [hli]
ld h, [hl]
ld l, a
; Bit 7 of the bank indicates a parameter.
; This is left unused.
bit 7, b
jr z, .go
pop de
ld a, [de]
ld c, a
inc de
push de
.go
ld a, b
and $7f
rst FarCall
pop hl
jr .loop
INCLUDE "data/maps/setup_script_pointers.asm"
EnableTextAcceleration:
xor a
ld [wDisableTextAcceleration], a
ret
ActivateMapAnims:
ld a, TRUE
ldh [hMapAnims], a
ret
SuspendMapAnims:
xor a ; FALSE
ldh [hMapAnims], a
ret
LoadMapObjects:
ld a, MAPCALLBACK_OBJECTS
call RunMapCallback
farcall LoadObjectMasks
farcall InitializeVisibleSprites
ret
ResetPlayerObjectAction:
ld hl, wPlayerSpriteSetupFlags
set PLAYERSPRITESETUP_RESET_ACTION_F, [hl]
ret
SkipUpdateMapSprites:
ld hl, wPlayerSpriteSetupFlags
set PLAYERSPRITESETUP_SKIP_RELOAD_GFX_F, [hl]
ret
CheckUpdatePlayerSprite:
nop
call .CheckBiking
jr c, .ok
call .CheckSurfing
jr c, .ok
call .CheckDiving
jr c, .ok
call .CheckSurfing2
jr c, .ok
ret
.ok
call UpdatePlayerSprite
ret
.CheckBiking:
and a
ld hl, wBikeFlags
bit BIKEFLAGS_ALWAYS_ON_BIKE_F, [hl]
ret z
ld a, PLAYER_BIKE
ld [wPlayerState], a
scf
ret
.CheckDiving:
ld a, [wMapTileset]
cp TILESET_UNDERWATER
jr nz, .not_underwater
ld a, PLAYER_WATER_SPORT
ld [wPlayerState], a
scf
ret
.not_underwater
and a
ret
.CheckSurfing2:
ld a, [wPlayerState]
cp PLAYER_NORMAL
jr z, .nope
cp PLAYER_SKATE
jr z, .nope
cp PLAYER_SURF
jr z, .surfing
cp PLAYER_SURF_PIKA
jr z, .surfing
call GetMapEnvironment
cp INDOOR
jr z, .no_biking
cp ENVIRONMENT_5
jr z, .no_biking
cp DUNGEON
jr z, .no_biking
jr .nope
.no_biking
ld a, [wPlayerState]
cp PLAYER_BIKE
jr nz, .nope
.surfing
ld a, PLAYER_NORMAL
ld [wPlayerState], a
scf
ret
.nope
and a
ret
.CheckSurfing:
call CheckOnWater
jr nz, .nope2
ld a, [wPlayerState]
cp PLAYER_SURF
jr z, .is_surfing
cp PLAYER_SURF_PIKA
jr z, .is_surfing
ld a, PLAYER_SURF
ld [wPlayerState], a
.is_surfing
scf
ret
.nope2
and a
ret
FadeOutMapMusic:
ld a, 6
call SkipMusic
ret
ApplyMapPalettes:
farcall _UpdateTimePals
ret
FadeMapMusicAndPalettes:
ld e, LOW(MUSIC_NONE)
ld a, [wMusicFadeID]
ld d, HIGH(MUSIC_NONE)
ld a, [wMusicFadeID + 1]
ld a, $4
ld [wMusicFade], a
call RotateThreePalettesRight
ret
ForceMapMusic:
ld a, [wPlayerState]
cp PLAYER_BIKE
jr nz, .notbiking
call MinVolume
ld a, $88
ld [wMusicFade], a
.notbiking
call TryRestartMapMusic
ret