Merge branch 'master' of https://github.com/pret/pokecrystal
# Conflicts: # engine/items/mart.asm
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@ INCLUDE "constants.asm"
|
||||
|
||||
SECTION "Events", ROMX
|
||||
|
||||
OverworldLoop:: ; 966b0
|
||||
OverworldLoop::
|
||||
xor a
|
||||
ld [wMapStatus], a
|
||||
.loop
|
||||
@@ -21,99 +21,83 @@ OverworldLoop:: ; 966b0
|
||||
dw EnterMap
|
||||
dw HandleMap
|
||||
dw .done
|
||||
; 966cb
|
||||
|
||||
DisableEvents: ; 966cb
|
||||
DisableEvents:
|
||||
xor a
|
||||
ld [wScriptFlags3], a
|
||||
ret
|
||||
; 966d0
|
||||
|
||||
EnableEvents:: ; 966d0
|
||||
EnableEvents::
|
||||
ld a, $ff
|
||||
ld [wScriptFlags3], a
|
||||
ret
|
||||
; 966d6
|
||||
|
||||
CheckBit5_ScriptFlags3: ; 966d6
|
||||
CheckBit5_ScriptFlags3:
|
||||
ld hl, wScriptFlags3
|
||||
bit 5, [hl]
|
||||
ret
|
||||
; 966dc
|
||||
|
||||
DisableWarpsConnxns: ; 966dc
|
||||
DisableWarpsConnxns:
|
||||
ld hl, wScriptFlags3
|
||||
res 2, [hl]
|
||||
ret
|
||||
; 966e2
|
||||
|
||||
DisableCoordEvents: ; 966e2
|
||||
DisableCoordEvents:
|
||||
ld hl, wScriptFlags3
|
||||
res 1, [hl]
|
||||
ret
|
||||
; 966e8
|
||||
|
||||
DisableStepCount: ; 966e8
|
||||
DisableStepCount:
|
||||
ld hl, wScriptFlags3
|
||||
res 0, [hl]
|
||||
ret
|
||||
; 966ee
|
||||
|
||||
DisableWildEncounters: ; 966ee
|
||||
DisableWildEncounters:
|
||||
ld hl, wScriptFlags3
|
||||
res 4, [hl]
|
||||
ret
|
||||
; 966f4
|
||||
|
||||
EnableWarpsConnxns: ; 966f4
|
||||
EnableWarpsConnxns:
|
||||
ld hl, wScriptFlags3
|
||||
set 2, [hl]
|
||||
ret
|
||||
; 966fa
|
||||
|
||||
EnableCoordEvents: ; 966fa
|
||||
EnableCoordEvents:
|
||||
ld hl, wScriptFlags3
|
||||
set 1, [hl]
|
||||
ret
|
||||
; 96700
|
||||
|
||||
EnableStepCount: ; 96700
|
||||
EnableStepCount:
|
||||
ld hl, wScriptFlags3
|
||||
set 0, [hl]
|
||||
ret
|
||||
; 96706
|
||||
|
||||
EnableWildEncounters: ; 96706
|
||||
EnableWildEncounters:
|
||||
ld hl, wScriptFlags3
|
||||
set 4, [hl]
|
||||
ret
|
||||
; 9670c
|
||||
|
||||
CheckWarpConnxnScriptFlag: ; 9670c
|
||||
CheckWarpConnxnScriptFlag:
|
||||
ld hl, wScriptFlags3
|
||||
bit 2, [hl]
|
||||
ret
|
||||
; 96712
|
||||
|
||||
CheckCoordEventScriptFlag: ; 96712
|
||||
CheckCoordEventScriptFlag:
|
||||
ld hl, wScriptFlags3
|
||||
bit 1, [hl]
|
||||
ret
|
||||
; 96718
|
||||
|
||||
CheckStepCountScriptFlag: ; 96718
|
||||
CheckStepCountScriptFlag:
|
||||
ld hl, wScriptFlags3
|
||||
bit 0, [hl]
|
||||
ret
|
||||
; 9671e
|
||||
|
||||
CheckWildEncountersScriptFlag: ; 9671e
|
||||
CheckWildEncountersScriptFlag:
|
||||
ld hl, wScriptFlags3
|
||||
bit 4, [hl]
|
||||
ret
|
||||
; 96724
|
||||
|
||||
StartMap: ; 96724
|
||||
StartMap:
|
||||
xor a
|
||||
ld [wScriptVar], a
|
||||
xor a
|
||||
@@ -123,7 +107,7 @@ StartMap: ; 96724
|
||||
call ByteFill
|
||||
farcall InitCallReceiveDelay
|
||||
call ClearJoypad
|
||||
EnterMap: ; 9673e
|
||||
EnterMap:
|
||||
xor a
|
||||
ld [wXYComparePointer], a
|
||||
ld [wXYComparePointer + 1], a
|
||||
@@ -149,15 +133,13 @@ EnterMap: ; 9673e
|
||||
ld a, 2 ; HandleMap
|
||||
ld [wMapStatus], a
|
||||
ret
|
||||
; 9676d
|
||||
|
||||
UnusedWait30Frames: ; 9676d
|
||||
UnusedWait30Frames:
|
||||
ld c, 30
|
||||
call DelayFrames
|
||||
ret
|
||||
; 96773
|
||||
|
||||
HandleMap: ; 96773
|
||||
HandleMap:
|
||||
call ResetOverworldDelay
|
||||
call HandleMapTimeAndJoypad
|
||||
farcall HandleCmdQueue ; no need to farcall
|
||||
@@ -173,9 +155,8 @@ HandleMap: ; 96773
|
||||
call HandleMapBackground
|
||||
call CheckPlayerState
|
||||
ret
|
||||
; 96795
|
||||
|
||||
MapEvents: ; 96795
|
||||
MapEvents:
|
||||
ld a, [wMapEventStatus]
|
||||
ld hl, .jumps
|
||||
rst JumpTable
|
||||
@@ -184,39 +165,33 @@ MapEvents: ; 96795
|
||||
.jumps
|
||||
dw .events
|
||||
dw .no_events
|
||||
; 967a1
|
||||
|
||||
.events ; 967a1
|
||||
.events
|
||||
call PlayerEvents
|
||||
call DisableEvents
|
||||
farcall ScriptEvents
|
||||
ret
|
||||
; 967ae
|
||||
|
||||
.no_events ; 967ae
|
||||
.no_events
|
||||
ret
|
||||
; 967af
|
||||
|
||||
MaxOverworldDelay: ; 967af
|
||||
MaxOverworldDelay:
|
||||
db 2
|
||||
; 967b0
|
||||
|
||||
ResetOverworldDelay: ; 967b0
|
||||
ResetOverworldDelay:
|
||||
ld a, [MaxOverworldDelay]
|
||||
ld [wOverworldDelay], a
|
||||
ret
|
||||
; 967b7
|
||||
|
||||
NextOverworldFrame: ; 967b7
|
||||
NextOverworldFrame:
|
||||
ld a, [wOverworldDelay]
|
||||
and a
|
||||
ret z
|
||||
ld c, a
|
||||
call DelayFrames
|
||||
ret
|
||||
; 967c1
|
||||
|
||||
HandleMapTimeAndJoypad: ; 967c1
|
||||
HandleMapTimeAndJoypad:
|
||||
ld a, [wMapEventStatus]
|
||||
cp 1 ; no events
|
||||
ret z
|
||||
@@ -225,23 +200,20 @@ HandleMapTimeAndJoypad: ; 967c1
|
||||
call GetJoypad
|
||||
call TimeOfDayPals
|
||||
ret
|
||||
; 967d1
|
||||
|
||||
HandleMapObjects: ; 967d1
|
||||
HandleMapObjects:
|
||||
farcall HandleNPCStep ; engine/map_objects.asm
|
||||
farcall _HandlePlayerStep
|
||||
call _CheckObjectEnteringVisibleRange
|
||||
ret
|
||||
; 967e1
|
||||
|
||||
HandleMapBackground: ; 967e1
|
||||
HandleMapBackground:
|
||||
farcall _UpdateSprites
|
||||
farcall ScrollScreen
|
||||
farcall PlaceMapNameSign
|
||||
ret
|
||||
; 967f4
|
||||
|
||||
CheckPlayerState: ; 967f4
|
||||
CheckPlayerState:
|
||||
ld a, [wPlayerStepFlags]
|
||||
bit 5, a ; in the middle of step
|
||||
jr z, .events
|
||||
@@ -259,17 +231,15 @@ CheckPlayerState: ; 967f4
|
||||
ld a, 1 ; no events
|
||||
ld [wMapEventStatus], a
|
||||
ret
|
||||
; 96812
|
||||
|
||||
_CheckObjectEnteringVisibleRange: ; 96812
|
||||
_CheckObjectEnteringVisibleRange:
|
||||
ld hl, wPlayerStepFlags
|
||||
bit 6, [hl]
|
||||
ret z
|
||||
farcall CheckObjectEnteringVisibleRange
|
||||
ret
|
||||
; 9681f
|
||||
|
||||
PlayerEvents: ; 9681f
|
||||
PlayerEvents:
|
||||
xor a
|
||||
; If there's already a player event, don't interrupt it.
|
||||
ld a, [wScriptRunning]
|
||||
@@ -318,9 +288,8 @@ PlayerEvents: ; 9681f
|
||||
.ok2
|
||||
scf
|
||||
ret
|
||||
; 96867
|
||||
|
||||
CheckTrainerBattle3: ; 96867
|
||||
CheckTrainerBattle3:
|
||||
nop
|
||||
nop
|
||||
call CheckTrainerBattle2
|
||||
@@ -333,9 +302,8 @@ CheckTrainerBattle3: ; 96867
|
||||
.nope
|
||||
xor a
|
||||
ret
|
||||
; 96874
|
||||
|
||||
CheckTileEvent: ; 96874
|
||||
CheckTileEvent:
|
||||
; Check for warps, coord events, or wild battles.
|
||||
|
||||
call CheckWarpConnxnScriptFlag
|
||||
@@ -399,9 +367,8 @@ CheckTileEvent: ; 96874
|
||||
call GetMapScriptsBank
|
||||
call CallScript
|
||||
ret
|
||||
; 968c7
|
||||
|
||||
CheckWildEncounterCooldown:: ; 968c7
|
||||
CheckWildEncounterCooldown::
|
||||
ld hl, wWildEncounterCooldown
|
||||
ld a, [hl]
|
||||
and a
|
||||
@@ -410,35 +377,30 @@ CheckWildEncounterCooldown:: ; 968c7
|
||||
ret z
|
||||
scf
|
||||
ret
|
||||
; 968d1
|
||||
|
||||
SetUpFiveStepWildEncounterCooldown: ; 968d1
|
||||
SetUpFiveStepWildEncounterCooldown:
|
||||
ld a, 5
|
||||
ld [wWildEncounterCooldown], a
|
||||
ret
|
||||
; 968d7
|
||||
|
||||
ret_968d7: ; 968d7
|
||||
ret_968d7:
|
||||
ret
|
||||
;968d8
|
||||
|
||||
SetMinTwoStepWildEncounterCooldown: ; 968d8
|
||||
SetMinTwoStepWildEncounterCooldown:
|
||||
ld a, [wWildEncounterCooldown]
|
||||
cp 2
|
||||
ret nc
|
||||
ld a, 2
|
||||
ld [wWildEncounterCooldown], a
|
||||
ret
|
||||
; 968e4
|
||||
|
||||
Dummy_CheckScriptFlags3Bit5: ; 968e4
|
||||
Dummy_CheckScriptFlags3Bit5:
|
||||
call CheckBit5_ScriptFlags3
|
||||
ret z
|
||||
call ret_2f3e
|
||||
ret
|
||||
; 968ec
|
||||
|
||||
RunSceneScript: ; 968ec
|
||||
RunSceneScript:
|
||||
ld a, [wCurrMapSceneScriptCount]
|
||||
and a
|
||||
jr z, .nope
|
||||
@@ -485,9 +447,8 @@ endr
|
||||
.nope
|
||||
xor a
|
||||
ret
|
||||
; 9693a
|
||||
|
||||
CheckTimeEvents: ; 9693a
|
||||
CheckTimeEvents:
|
||||
ld a, [wLinkMode]
|
||||
and a
|
||||
jr nz, .nothing
|
||||
@@ -517,15 +478,13 @@ CheckTimeEvents: ; 9693a
|
||||
call CallScript
|
||||
scf
|
||||
ret
|
||||
; 96970
|
||||
|
||||
.unused ; 96970
|
||||
.unused
|
||||
ld a, 8
|
||||
scf
|
||||
ret
|
||||
; 96974
|
||||
|
||||
OWPlayerInput: ; 96974
|
||||
OWPlayerInput:
|
||||
|
||||
call PlayerMovement
|
||||
ret c
|
||||
@@ -552,9 +511,8 @@ OWPlayerInput: ; 96974
|
||||
pop af
|
||||
scf
|
||||
ret
|
||||
; 96999
|
||||
|
||||
CheckAPressOW: ; 96999
|
||||
CheckAPressOW:
|
||||
ld a, [hJoyPressed]
|
||||
and A_BUTTON
|
||||
ret z
|
||||
@@ -566,17 +524,15 @@ CheckAPressOW: ; 96999
|
||||
ret c
|
||||
xor a
|
||||
ret
|
||||
; 969ac
|
||||
|
||||
PlayTalkObject: ; 969ac
|
||||
PlayTalkObject:
|
||||
push de
|
||||
ld de, SFX_READ_TEXT_2
|
||||
call PlaySFX
|
||||
pop de
|
||||
ret
|
||||
; 969b5
|
||||
|
||||
TryObjectEvent: ; 969b5
|
||||
TryObjectEvent:
|
||||
farcall CheckFacingObject
|
||||
jr c, .IsObject
|
||||
xor a
|
||||
@@ -627,9 +583,8 @@ TryObjectEvent: ; 969b5
|
||||
dbw OBJECTTYPE_5, .five
|
||||
dbw OBJECTTYPE_6, .six
|
||||
db -1
|
||||
; 96a04
|
||||
|
||||
.script ; 96a04
|
||||
.script
|
||||
ld hl, MAPOBJECT_SCRIPT_POINTER
|
||||
add hl, bc
|
||||
ld a, [hli]
|
||||
@@ -638,9 +593,8 @@ TryObjectEvent: ; 969b5
|
||||
call GetMapScriptsBank
|
||||
call CallScript
|
||||
ret
|
||||
; 96a12
|
||||
|
||||
.itemball ; 96a12
|
||||
.itemball
|
||||
ld hl, MAPOBJECT_SCRIPT_POINTER
|
||||
add hl, bc
|
||||
ld a, [hli]
|
||||
@@ -653,36 +607,30 @@ TryObjectEvent: ; 969b5
|
||||
ld a, PLAYEREVENT_ITEMBALL
|
||||
scf
|
||||
ret
|
||||
; 96a29
|
||||
|
||||
.trainer ; 96a29
|
||||
.trainer
|
||||
call TalkToTrainer
|
||||
ld a, PLAYEREVENT_TALKTOTRAINER
|
||||
scf
|
||||
ret
|
||||
; 96a30
|
||||
|
||||
.three ; 96a30
|
||||
.three
|
||||
xor a
|
||||
ret
|
||||
; 96a32
|
||||
|
||||
.four ; 96a32
|
||||
.four
|
||||
xor a
|
||||
ret
|
||||
; 96a34
|
||||
|
||||
.five ; 96a34
|
||||
.five
|
||||
xor a
|
||||
ret
|
||||
; 96a36
|
||||
|
||||
.six ; 96a36
|
||||
.six
|
||||
xor a
|
||||
ret
|
||||
; 96a38
|
||||
|
||||
TryBGEvent: ; 96a38
|
||||
TryBGEvent:
|
||||
call CheckFacingBGEvent
|
||||
jr c, .is_bg_event
|
||||
xor a
|
||||
@@ -704,7 +652,6 @@ TryBGEvent: ; 96a38
|
||||
dw .ifnotset
|
||||
dw .itemifset
|
||||
dw .copy
|
||||
; 96a59
|
||||
|
||||
.up
|
||||
ld b, OW_UP
|
||||
@@ -784,9 +731,8 @@ TryBGEvent: ; 96a38
|
||||
.dontread
|
||||
xor a
|
||||
ret
|
||||
; 96ad8
|
||||
|
||||
CheckBGEventFlag: ; 96ad8
|
||||
CheckBGEventFlag:
|
||||
ld hl, wEngineBuffer4
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
@@ -802,16 +748,14 @@ CheckBGEventFlag: ; 96ad8
|
||||
and a
|
||||
pop hl
|
||||
ret
|
||||
; 96af0
|
||||
|
||||
PlayerMovement: ; 96af0
|
||||
PlayerMovement:
|
||||
farcall DoPlayerMovement
|
||||
ld a, c
|
||||
ld hl, .pointers
|
||||
rst JumpTable
|
||||
ld a, c
|
||||
ret
|
||||
; 96afd
|
||||
|
||||
.pointers
|
||||
dw .zero
|
||||
@@ -824,34 +768,30 @@ PlayerMovement: ; 96af0
|
||||
dw .seven
|
||||
|
||||
.zero
|
||||
.four ; 96b0d
|
||||
.four
|
||||
xor a
|
||||
ld c, a
|
||||
ret
|
||||
; 96b10
|
||||
|
||||
.seven ; 96b10
|
||||
.seven
|
||||
call ret_968d7 ; mobile
|
||||
xor a
|
||||
ld c, a
|
||||
ret
|
||||
; 96b16
|
||||
|
||||
.one ; 96b16
|
||||
.one
|
||||
ld a, 5
|
||||
ld c, a
|
||||
scf
|
||||
ret
|
||||
; 96b1b
|
||||
|
||||
.two ; 96b1b
|
||||
.two
|
||||
ld a, 9
|
||||
ld c, a
|
||||
scf
|
||||
ret
|
||||
; 96b20
|
||||
|
||||
.three ; 96b20
|
||||
.three
|
||||
; force the player to move in some direction
|
||||
ld a, BANK(Script_ForcedMovement)
|
||||
ld hl, Script_ForcedMovement
|
||||
@@ -860,17 +800,15 @@ PlayerMovement: ; 96af0
|
||||
ld c, a
|
||||
scf
|
||||
ret
|
||||
; 96b2b
|
||||
|
||||
.five
|
||||
.six ; 96b2b
|
||||
.six
|
||||
ld a, -1
|
||||
ld c, a
|
||||
and a
|
||||
ret
|
||||
; 96b30
|
||||
|
||||
CheckMenuOW: ; 96b30
|
||||
CheckMenuOW:
|
||||
xor a
|
||||
ld [hMenuReturn], a
|
||||
ld [hMenuReturn + 1], a
|
||||
@@ -899,36 +837,30 @@ CheckMenuOW: ; 96b30
|
||||
call CallScript
|
||||
scf
|
||||
ret
|
||||
; 96b58
|
||||
|
||||
StartMenuScript: ; 96b58
|
||||
StartMenuScript:
|
||||
callasm StartMenu
|
||||
jump StartMenuCallback
|
||||
; 96b5f
|
||||
|
||||
SelectMenuScript: ; 96b5f
|
||||
SelectMenuScript:
|
||||
callasm SelectMenu
|
||||
jump SelectMenuCallback
|
||||
; 96b66
|
||||
|
||||
StartMenuCallback:
|
||||
SelectMenuCallback: ; 96b66
|
||||
SelectMenuCallback:
|
||||
copybytetovar hMenuReturn
|
||||
ifequal HMENURETURN_SCRIPT, .Script
|
||||
ifequal HMENURETURN_ASM, .Asm
|
||||
end
|
||||
; 96b72
|
||||
|
||||
.Script: ; 96b72
|
||||
.Script:
|
||||
ptjump wQueuedScriptBank
|
||||
; 96b75
|
||||
|
||||
.Asm: ; 96b75
|
||||
.Asm:
|
||||
ptcallasm wQueuedScriptBank
|
||||
end
|
||||
; 96b79
|
||||
|
||||
CountStep: ; 96b79
|
||||
CountStep:
|
||||
; Don't count steps in link communication rooms.
|
||||
ld a, [wLinkMode]
|
||||
and a
|
||||
@@ -993,16 +925,14 @@ CountStep: ; 96b79
|
||||
ld a, 8
|
||||
scf
|
||||
ret
|
||||
; 96bd3
|
||||
|
||||
; unused
|
||||
.unreferenced ; 96bd3
|
||||
.unreferenced
|
||||
ld a, 7
|
||||
scf
|
||||
ret
|
||||
; 96bd7
|
||||
|
||||
DoRepelStep: ; 96bd7
|
||||
DoRepelStep:
|
||||
ld a, [wRepelEffect]
|
||||
and a
|
||||
ret z
|
||||
@@ -1016,9 +946,8 @@ DoRepelStep: ; 96bd7
|
||||
call CallScript
|
||||
scf
|
||||
ret
|
||||
; 96beb
|
||||
|
||||
DoPlayerEvent: ; 96beb
|
||||
DoPlayerEvent:
|
||||
ld a, [wScriptRunning]
|
||||
and a
|
||||
ret z
|
||||
@@ -1042,9 +971,8 @@ DoPlayerEvent: ; 96beb
|
||||
ld a, [hl]
|
||||
ld [wScriptPos + 1], a
|
||||
ret
|
||||
; 96c0c
|
||||
|
||||
PlayerEventScriptPointers: ; 96c0c
|
||||
PlayerEventScriptPointers:
|
||||
dba Invalid_0x96c2d ; 0
|
||||
dba SeenByTrainerScript ; 1
|
||||
dba TalkToTrainerScript ; 2
|
||||
@@ -1056,55 +984,45 @@ PlayerEventScriptPointers: ; 96c0c
|
||||
dba HatchEggScript ; 8
|
||||
dba ChangeDirectionScript ; 9
|
||||
dba Invalid_0x96c2d ; 10
|
||||
; 96c2d
|
||||
|
||||
Invalid_0x96c2d: ; 96c2d
|
||||
Invalid_0x96c2d:
|
||||
end
|
||||
; 96c2e
|
||||
|
||||
; unused
|
||||
end
|
||||
; 96c2f
|
||||
|
||||
HatchEggScript: ; 96c2f
|
||||
HatchEggScript:
|
||||
callasm OverworldHatchEgg
|
||||
end
|
||||
; 96c34
|
||||
|
||||
WarpToNewMapScript: ; 96c34
|
||||
WarpToNewMapScript:
|
||||
warpsound
|
||||
newloadmap MAPSETUP_DOOR
|
||||
end
|
||||
; 96c38
|
||||
|
||||
FallIntoMapScript: ; 96c38
|
||||
FallIntoMapScript:
|
||||
newloadmap MAPSETUP_FALL
|
||||
playsound SFX_KINESIS
|
||||
applymovement PLAYER, MovementData_0x96c48
|
||||
playsound SFX_STRENGTH
|
||||
scall LandAfterPitfallScript
|
||||
end
|
||||
; 96c48
|
||||
|
||||
MovementData_0x96c48: ; 96c48
|
||||
MovementData_0x96c48:
|
||||
skyfall
|
||||
step_end
|
||||
; 96c4a
|
||||
|
||||
LandAfterPitfallScript: ; 96c4a
|
||||
LandAfterPitfallScript:
|
||||
earthquake 16
|
||||
end
|
||||
; 96c4d
|
||||
|
||||
EdgeWarpScript: ; 4
|
||||
reloadandreturn MAPSETUP_CONNECTION
|
||||
; 96c4f
|
||||
|
||||
ChangeDirectionScript: ; 9
|
||||
deactivatefacing 3
|
||||
callasm EnableWildEncounters
|
||||
end
|
||||
; 96c56
|
||||
|
||||
INCLUDE "engine/overworld/scripting.asm"
|
||||
|
||||
|
@@ -1,14 +1,13 @@
|
||||
; More overworld event handling.
|
||||
|
||||
|
||||
WarpToSpawnPoint:: ; 97c28
|
||||
WarpToSpawnPoint::
|
||||
ld hl, wStatusFlags2
|
||||
res STATUSFLAGS2_SAFARI_GAME_F, [hl]
|
||||
res STATUSFLAGS2_BUG_CONTEST_TIMER_F, [hl]
|
||||
ret
|
||||
; 97c30
|
||||
|
||||
RunMemScript:: ; 97c30
|
||||
RunMemScript::
|
||||
; If there is no script here, we don't need to be here.
|
||||
ld a, [wMapReentryScriptQueueFlag]
|
||||
and a
|
||||
@@ -29,9 +28,8 @@ RunMemScript:: ; 97c30
|
||||
call ByteFill
|
||||
pop af
|
||||
ret
|
||||
; 97c4f
|
||||
|
||||
LoadScriptBDE:: ; 97c4f
|
||||
LoadScriptBDE::
|
||||
; If there's already a script here, don't overwrite.
|
||||
ld hl, wMapReentryScriptQueueFlag
|
||||
ld a, [hl]
|
||||
@@ -48,9 +46,8 @@ LoadScriptBDE:: ; 97c4f
|
||||
ld [hl], d
|
||||
scf
|
||||
ret
|
||||
; 97c5f
|
||||
|
||||
TryTileCollisionEvent:: ; 97c5f
|
||||
TryTileCollisionEvent::
|
||||
call GetFacingTileCoord
|
||||
ld [wEngineBuffer1], a
|
||||
ld c, a
|
||||
@@ -98,10 +95,9 @@ TryTileCollisionEvent:: ; 97c5f
|
||||
ld a, $ff
|
||||
scf
|
||||
ret
|
||||
; 97cc0
|
||||
|
||||
|
||||
RandomEncounter:: ; 97cc0
|
||||
RandomEncounter::
|
||||
; Random encounter
|
||||
|
||||
call CheckWildEncounterCooldown
|
||||
@@ -139,16 +135,14 @@ RandomEncounter:: ; 97cc0
|
||||
call CallScript
|
||||
scf
|
||||
ret
|
||||
; 97cf9
|
||||
|
||||
WildBattleScript: ; 97cf9
|
||||
WildBattleScript:
|
||||
randomwildmon
|
||||
startbattle
|
||||
reloadmapafterbattle
|
||||
end
|
||||
; 97cfd
|
||||
|
||||
CanUseSweetScent:: ; 97cfd
|
||||
CanUseSweetScent::
|
||||
ld hl, wStatusFlags
|
||||
bit STATUSFLAGS_NO_WILD_ENCOUNTERS_F, [hl]
|
||||
jr nz, .no
|
||||
@@ -170,17 +164,15 @@ CanUseSweetScent:: ; 97cfd
|
||||
.no
|
||||
and a
|
||||
ret
|
||||
; 97d23
|
||||
|
||||
_TryWildEncounter_BugContest: ; 97d23
|
||||
_TryWildEncounter_BugContest:
|
||||
call TryWildEncounter_BugContest
|
||||
ret nc
|
||||
call ChooseWildEncounter_BugContest
|
||||
farcall CheckRepelEffect
|
||||
ret
|
||||
; 97d31
|
||||
|
||||
ChooseWildEncounter_BugContest:: ; 97d31
|
||||
ChooseWildEncounter_BugContest::
|
||||
; Pick a random mon out of ContestMons.
|
||||
|
||||
.loop
|
||||
@@ -232,9 +224,8 @@ ChooseWildEncounter_BugContest:: ; 97d31
|
||||
|
||||
xor a
|
||||
ret
|
||||
; 97d64
|
||||
|
||||
TryWildEncounter_BugContest: ; 97d64
|
||||
TryWildEncounter_BugContest:
|
||||
ld a, [wPlayerStandingTile]
|
||||
call CheckSuperTallGrassTile
|
||||
ld b, 40 percent
|
||||
@@ -251,13 +242,12 @@ TryWildEncounter_BugContest: ; 97d64
|
||||
ld a, 1
|
||||
and a
|
||||
ret
|
||||
; 97d87
|
||||
|
||||
|
||||
INCLUDE "data/wild/bug_contest_mons.asm"
|
||||
|
||||
|
||||
DoBikeStep:: ; 97db3
|
||||
DoBikeStep::
|
||||
nop
|
||||
nop
|
||||
; If the bike shop owner doesn't have our number, or
|
||||
@@ -322,9 +312,8 @@ DoBikeStep:: ; 97db3
|
||||
.NoCall:
|
||||
xor a
|
||||
ret
|
||||
; 97df9
|
||||
|
||||
ClearCmdQueue:: ; 97df9
|
||||
ClearCmdQueue::
|
||||
ld hl, wCmdQueue
|
||||
ld de, 6
|
||||
ld c, 4
|
||||
@@ -335,9 +324,8 @@ ClearCmdQueue:: ; 97df9
|
||||
dec c
|
||||
jr nz, .loop
|
||||
ret
|
||||
; 97e08
|
||||
|
||||
HandleCmdQueue:: ; 97e08
|
||||
HandleCmdQueue::
|
||||
ld hl, wCmdQueue
|
||||
xor a
|
||||
.loop
|
||||
@@ -359,18 +347,16 @@ HandleCmdQueue:: ; 97e08
|
||||
cp CMDQUEUE_CAPACITY
|
||||
jr nz, .loop
|
||||
ret
|
||||
; 97e25
|
||||
|
||||
Unreferenced_GetNthCmdQueueEntry: ; 97e25
|
||||
Unreferenced_GetNthCmdQueueEntry:
|
||||
ld hl, wCmdQueue
|
||||
ld bc, CMDQUEUE_ENTRY_SIZE
|
||||
call AddNTimes
|
||||
ld b, h
|
||||
ld c, l
|
||||
ret
|
||||
; 97e31
|
||||
|
||||
WriteCmdQueue:: ; 97e31
|
||||
WriteCmdQueue::
|
||||
push bc
|
||||
push de
|
||||
call .GetNextEmptyEntry
|
||||
@@ -385,9 +371,8 @@ WriteCmdQueue:: ; 97e31
|
||||
xor a
|
||||
ld [hl], a
|
||||
ret
|
||||
; 97e45
|
||||
|
||||
.GetNextEmptyEntry: ; 97e45
|
||||
.GetNextEmptyEntry:
|
||||
ld hl, wCmdQueue
|
||||
ld de, CMDQUEUE_ENTRY_SIZE
|
||||
ld c, CMDQUEUE_CAPACITY
|
||||
@@ -406,9 +391,8 @@ WriteCmdQueue:: ; 97e31
|
||||
sub c
|
||||
and a
|
||||
ret
|
||||
; 97e5c
|
||||
|
||||
DelCmdQueue:: ; 97e5c
|
||||
DelCmdQueue::
|
||||
ld hl, wCmdQueue
|
||||
ld de, CMDQUEUE_ENTRY_SIZE
|
||||
ld c, CMDQUEUE_CAPACITY
|
||||
@@ -427,16 +411,14 @@ DelCmdQueue:: ; 97e5c
|
||||
ld [hl], a
|
||||
scf
|
||||
ret
|
||||
; 97e72
|
||||
|
||||
_DelCmdQueue: ; 97e72
|
||||
_DelCmdQueue:
|
||||
ld hl, CMDQUEUE_TYPE
|
||||
add hl, bc
|
||||
ld [hl], 0
|
||||
ret
|
||||
; 97e79
|
||||
|
||||
HandleQueuedCommand: ; 97e79
|
||||
HandleQueuedCommand:
|
||||
ld hl, CMDQUEUE_TYPE
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
@@ -459,62 +441,54 @@ HandleQueuedCommand: ; 97e79
|
||||
pop af
|
||||
rst FarCall
|
||||
ret
|
||||
; 97e94
|
||||
|
||||
.Jumptable: ; 97e94
|
||||
.Jumptable:
|
||||
dba CmdQueue_Null
|
||||
dba CmdQueue_Null2
|
||||
dba CmdQueue_StoneTable
|
||||
dba CmdQueue_Type3
|
||||
dba CmdQueue_Type4
|
||||
; 97ea3
|
||||
|
||||
CmdQueueAnonymousJumptable: ; 97ea3
|
||||
CmdQueueAnonymousJumptable:
|
||||
ld hl, CMDQUEUE_05
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
pop hl
|
||||
rst JumpTable
|
||||
ret
|
||||
; 97eab
|
||||
|
||||
CmdQueueAnonJT_Increment: ; 97eab
|
||||
CmdQueueAnonJT_Increment:
|
||||
ld hl, CMDQUEUE_05
|
||||
add hl, bc
|
||||
inc [hl]
|
||||
ret
|
||||
; 97eb1
|
||||
|
||||
CmdQueueAnonJT_Decrement: ; 97eb1
|
||||
CmdQueueAnonJT_Decrement:
|
||||
ld hl, CMDQUEUE_05
|
||||
add hl, bc
|
||||
dec [hl]
|
||||
ret
|
||||
; 97eb7
|
||||
|
||||
CmdQueue_Null: ; 97eb7
|
||||
CmdQueue_Null:
|
||||
ret
|
||||
; 97eb8
|
||||
|
||||
CmdQueue_Null2: ; 97eb8
|
||||
CmdQueue_Null2:
|
||||
call ret_2f3e
|
||||
ret
|
||||
; 97ebc
|
||||
|
||||
CmdQueue_Type4: ; 97ebc
|
||||
CmdQueue_Type4:
|
||||
call CmdQueueAnonymousJumptable
|
||||
; anonymous dw
|
||||
dw .zero
|
||||
dw .one
|
||||
; 97ec3
|
||||
|
||||
.zero ; 97ec3
|
||||
.zero
|
||||
ld a, [hSCY]
|
||||
ld hl, 4
|
||||
add hl, bc
|
||||
ld [hl], a
|
||||
call CmdQueueAnonJT_Increment
|
||||
.one ; 97ecd
|
||||
.one
|
||||
ld hl, 1
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
@@ -545,21 +519,19 @@ CmdQueue_Type4: ; 97ebc
|
||||
ld [hSCY], a
|
||||
call _DelCmdQueue
|
||||
ret
|
||||
; 97ef9
|
||||
|
||||
CmdQueue_Type3: ; 97ef9
|
||||
CmdQueue_Type3:
|
||||
call CmdQueueAnonymousJumptable
|
||||
; anonymous dw
|
||||
dw .zero
|
||||
dw .one
|
||||
dw .two
|
||||
; 97f02
|
||||
|
||||
.zero ; 97f02
|
||||
.zero
|
||||
call .IsPlayerFacingDown
|
||||
jr z, .PlayerNotFacingDown
|
||||
call CmdQueueAnonJT_Increment
|
||||
.one ; 97f0a
|
||||
.one
|
||||
call .IsPlayerFacingDown
|
||||
jr z, .PlayerNotFacingDown
|
||||
call CmdQueueAnonJT_Increment
|
||||
@@ -569,9 +541,8 @@ CmdQueue_Type3: ; 97ef9
|
||||
ld a, [hl]
|
||||
ld [wd173], a
|
||||
ret
|
||||
; 97f1b
|
||||
|
||||
.two ; 97f1b
|
||||
.two
|
||||
call .IsPlayerFacingDown
|
||||
jr z, .PlayerNotFacingDown
|
||||
call CmdQueueAnonJT_Decrement
|
||||
@@ -581,27 +552,24 @@ CmdQueue_Type3: ; 97ef9
|
||||
ld a, [hl]
|
||||
ld [wd173], a
|
||||
ret
|
||||
; 97f2c
|
||||
|
||||
.PlayerNotFacingDown: ; 97f2c
|
||||
.PlayerNotFacingDown:
|
||||
ld a, $7f
|
||||
ld [wd173], a
|
||||
ld hl, 5
|
||||
add hl, bc
|
||||
ld [hl], 0
|
||||
ret
|
||||
; 97f38
|
||||
|
||||
.IsPlayerFacingDown: ; 97f38
|
||||
.IsPlayerFacingDown:
|
||||
push bc
|
||||
ld bc, wPlayerStruct
|
||||
call GetSpriteDirection
|
||||
and a
|
||||
pop bc
|
||||
ret
|
||||
; 97f42
|
||||
|
||||
CmdQueue_StoneTable: ; 97f42
|
||||
CmdQueue_StoneTable:
|
||||
ld de, wPlayerStruct
|
||||
ld a, NUM_OBJECT_STRUCTS
|
||||
.loop
|
||||
@@ -647,4 +615,3 @@ CmdQueue_StoneTable: ; 97f42
|
||||
.fall_down_hole
|
||||
pop af
|
||||
ret
|
||||
; 97f7e
|
||||
|
@@ -1,4 +1,4 @@
|
||||
ReanchorBGMap_NoOAMUpdate:: ; 6454
|
||||
ReanchorBGMap_NoOAMUpdate::
|
||||
call DelayFrame
|
||||
ld a, [hOAMUpdate]
|
||||
push af
|
||||
@@ -50,13 +50,13 @@ ReanchorBGMap_NoOAMUpdate:: ; 6454
|
||||
call ApplyBGMapAnchorToObjects
|
||||
ret
|
||||
|
||||
.LoadBGMapAddrIntoHRAM: ; 64b9
|
||||
.LoadBGMapAddrIntoHRAM:
|
||||
ld [hBGMapAddress + 1], a
|
||||
xor a
|
||||
ld [hBGMapAddress], a
|
||||
ret
|
||||
|
||||
LoadFonts_NoOAMUpdate:: ; 64bf
|
||||
LoadFonts_NoOAMUpdate::
|
||||
ld a, [hOAMUpdate]
|
||||
push af
|
||||
ld a, $1
|
||||
@@ -76,7 +76,7 @@ LoadFonts_NoOAMUpdate:: ; 64bf
|
||||
call LoadStandardFont
|
||||
ret
|
||||
|
||||
HDMATransfer_FillBGMap0WithBlack: ; 64db
|
||||
HDMATransfer_FillBGMap0WithBlack:
|
||||
ld a, [rSVBK]
|
||||
push af
|
||||
ld a, BANK(wDecompressScratch)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
GetLandmarkCoords: ; 0x1ca896
|
||||
GetLandmarkCoords:
|
||||
; Return coordinates (d, e) of landmark e.
|
||||
push hl
|
||||
ld l, e
|
||||
@@ -12,10 +12,9 @@ GetLandmarkCoords: ; 0x1ca896
|
||||
ld d, [hl]
|
||||
pop hl
|
||||
ret
|
||||
; 0x1ca8a5
|
||||
|
||||
|
||||
GetLandmarkName:: ; 0x1ca8a5
|
||||
GetLandmarkName::
|
||||
; Copy the name of landmark e to wStringBuffer1.
|
||||
push hl
|
||||
push de
|
||||
@@ -44,13 +43,12 @@ GetLandmarkName:: ; 0x1ca8a5
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
; 0x1ca8c3
|
||||
|
||||
|
||||
INCLUDE "data/maps/landmarks.asm"
|
||||
|
||||
|
||||
RegionCheck: ; 0x1caea1
|
||||
RegionCheck:
|
||||
; Checks if the player is in Kanto or Johto.
|
||||
; If in Johto, returns 0 in e.
|
||||
; If in Kanto, returns 1 in e.
|
||||
|
@@ -1,4 +1,4 @@
|
||||
_LoadMapPart:: ; 4d15b
|
||||
_LoadMapPart::
|
||||
ld hl, wSurroundingTiles
|
||||
ld a, [wMetatileStandingY]
|
||||
and a
|
||||
|
@@ -1,4 +1,4 @@
|
||||
ObjectActionPairPointers: ; 445f
|
||||
ObjectActionPairPointers:
|
||||
; entries correspond to OBJECT_ACTION_* constants
|
||||
dw SetFacingStanding, SetFacingStanding
|
||||
dw SetFacingStandAction, SetFacingCurrent
|
||||
@@ -17,34 +17,30 @@ ObjectActionPairPointers: ; 445f
|
||||
dw SetFacingBoulderDust, SetFacingStanding
|
||||
dw SetFacingGrassShake, SetFacingStanding
|
||||
dw SetFacingSkyfall, SetFacingCurrent
|
||||
; 44a3
|
||||
|
||||
SetFacingStanding: ; 44a3
|
||||
SetFacingStanding:
|
||||
ld hl, OBJECT_FACING_STEP
|
||||
add hl, bc
|
||||
ld [hl], STANDING
|
||||
ret
|
||||
; 44aa
|
||||
|
||||
SetFacingCurrent: ; 44aa
|
||||
SetFacingCurrent:
|
||||
call GetSpriteDirection
|
||||
or FACING_STEP_DOWN_0 ; useless
|
||||
ld hl, OBJECT_FACING_STEP
|
||||
add hl, bc
|
||||
ld [hl], a
|
||||
ret
|
||||
; 44b5
|
||||
|
||||
SetFacingStandAction: ; 44b5
|
||||
SetFacingStandAction:
|
||||
ld hl, OBJECT_FACING_STEP
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
and 1
|
||||
jr nz, SetFacingStepAction
|
||||
jp SetFacingCurrent
|
||||
; 44c1
|
||||
|
||||
SetFacingStepAction: ; 44c1
|
||||
SetFacingStepAction:
|
||||
ld hl, OBJECT_FLAGS1
|
||||
add hl, bc
|
||||
bit SLIDING_F, [hl]
|
||||
@@ -69,9 +65,8 @@ SetFacingStepAction: ; 44c1
|
||||
add hl, bc
|
||||
ld [hl], a
|
||||
ret
|
||||
; 44e4
|
||||
|
||||
SetFacingSkyfall: ; 44e4
|
||||
SetFacingSkyfall:
|
||||
ld hl, OBJECT_FLAGS1
|
||||
add hl, bc
|
||||
bit SLIDING_F, [hl]
|
||||
@@ -96,9 +91,8 @@ SetFacingSkyfall: ; 44e4
|
||||
add hl, bc
|
||||
ld [hl], a
|
||||
ret
|
||||
; 4508
|
||||
|
||||
SetFacingBumpAction: ; 4508
|
||||
SetFacingBumpAction:
|
||||
ld hl, OBJECT_FLAGS1
|
||||
add hl, bc
|
||||
bit SLIDING_F, [hl]
|
||||
@@ -122,9 +116,8 @@ SetFacingBumpAction: ; 4508
|
||||
add hl, bc
|
||||
ld [hl], a
|
||||
ret
|
||||
; 4529
|
||||
|
||||
SetFacingCounterclockwiseSpin: ; 4529
|
||||
SetFacingCounterclockwiseSpin:
|
||||
call CounterclockwiseSpinAction
|
||||
ld hl, OBJECT_FACING
|
||||
add hl, bc
|
||||
@@ -134,14 +127,12 @@ SetFacingCounterclockwiseSpin: ; 4529
|
||||
add hl, bc
|
||||
ld [hl], a
|
||||
ret
|
||||
; 4539
|
||||
|
||||
SetFacingCounterclockwiseSpin2: ; 4539
|
||||
SetFacingCounterclockwiseSpin2:
|
||||
call CounterclockwiseSpinAction
|
||||
jp SetFacingStanding
|
||||
; 453f
|
||||
|
||||
CounterclockwiseSpinAction: ; 453f
|
||||
CounterclockwiseSpinAction:
|
||||
; Here, OBJECT_STEP_FRAME consists of two 2-bit components,
|
||||
; using only bits 0,1 and 4,5.
|
||||
; bits 0,1 is a timer (4 overworld frames)
|
||||
@@ -179,13 +170,11 @@ CounterclockwiseSpinAction: ; 453f
|
||||
add hl, bc
|
||||
ld [hl], a
|
||||
ret
|
||||
; 456a
|
||||
|
||||
.Directions: ; 456a
|
||||
.Directions:
|
||||
db OW_DOWN, OW_RIGHT, OW_UP, OW_LEFT
|
||||
; 456e
|
||||
|
||||
SetFacingFish: ; 456e
|
||||
SetFacingFish:
|
||||
call GetSpriteDirection
|
||||
rrca
|
||||
rrca
|
||||
@@ -194,30 +183,26 @@ SetFacingFish: ; 456e
|
||||
add hl, bc
|
||||
ld [hl], a
|
||||
ret
|
||||
; 457b
|
||||
|
||||
SetFacingShadow: ; 457b
|
||||
SetFacingShadow:
|
||||
ld hl, OBJECT_FACING_STEP
|
||||
add hl, bc
|
||||
ld [hl], FACING_SHADOW
|
||||
ret
|
||||
; 4582
|
||||
|
||||
SetFacingEmote: ; 4582 emote
|
||||
ld hl, OBJECT_FACING_STEP
|
||||
add hl, bc
|
||||
ld [hl], FACING_EMOTE
|
||||
ret
|
||||
; 4589
|
||||
|
||||
SetFacingBigDollSym: ; 4589
|
||||
SetFacingBigDollSym:
|
||||
ld hl, OBJECT_FACING_STEP
|
||||
add hl, bc
|
||||
ld [hl], FACING_BIG_DOLL_SYM
|
||||
ret
|
||||
; 4590
|
||||
|
||||
SetFacingBounce: ; 4590
|
||||
SetFacingBounce:
|
||||
ld hl, OBJECT_STEP_FRAME
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
@@ -230,16 +215,14 @@ SetFacingBounce: ; 4590
|
||||
add hl, bc
|
||||
ld [hl], FACING_STEP_UP_0
|
||||
ret
|
||||
; 45a4
|
||||
|
||||
SetFacingFreezeBounce: ; 45a4
|
||||
SetFacingFreezeBounce:
|
||||
ld hl, OBJECT_FACING_STEP
|
||||
add hl, bc
|
||||
ld [hl], FACING_STEP_DOWN_0
|
||||
ret
|
||||
; 45ab
|
||||
|
||||
SetFacingWeirdTree: ; 45ab
|
||||
SetFacingWeirdTree:
|
||||
ld hl, OBJECT_STEP_FRAME
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
@@ -253,16 +236,14 @@ SetFacingWeirdTree: ; 45ab
|
||||
add hl, bc
|
||||
ld [hl], a
|
||||
ret
|
||||
; 45be
|
||||
|
||||
SetFacingBigDollAsym: ; 45be
|
||||
SetFacingBigDollAsym:
|
||||
ld hl, OBJECT_FACING_STEP
|
||||
add hl, bc
|
||||
ld [hl], FACING_BIG_DOLL_ASYM
|
||||
ret
|
||||
; 45c5
|
||||
|
||||
SetFacingBigDoll: ; 45c5
|
||||
SetFacingBigDoll:
|
||||
ld a, [wVariableSprites + SPRITE_BIG_DOLL - SPRITE_VARS]
|
||||
ld d, FACING_BIG_DOLL_SYM ; symmetric
|
||||
cp SPRITE_BIG_SNORLAX
|
||||
@@ -276,9 +257,8 @@ SetFacingBigDoll: ; 45c5
|
||||
add hl, bc
|
||||
ld [hl], d
|
||||
ret
|
||||
; 45da
|
||||
|
||||
SetFacingBoulderDust: ; 45da
|
||||
SetFacingBoulderDust:
|
||||
ld hl, OBJECT_STEP_FRAME
|
||||
add hl, bc
|
||||
inc [hl]
|
||||
@@ -293,9 +273,8 @@ SetFacingBoulderDust: ; 45da
|
||||
.ok
|
||||
ld [hl], a
|
||||
ret
|
||||
; 45ed
|
||||
|
||||
SetFacingGrassShake: ; 45ed
|
||||
SetFacingGrassShake:
|
||||
ld hl, OBJECT_STEP_FRAME
|
||||
add hl, bc
|
||||
inc [hl]
|
||||
@@ -310,4 +289,3 @@ SetFacingGrassShake: ; 45ed
|
||||
.ok
|
||||
ld [hl], a
|
||||
ret
|
||||
; 4600
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
LoadObjectMasks: ; 2454f
|
||||
LoadObjectMasks:
|
||||
ld hl, wObjectMasks
|
||||
xor a
|
||||
ld bc, NUM_OBJECTS
|
||||
@@ -29,7 +29,7 @@ LoadObjectMasks: ; 2454f
|
||||
jr nz, .loop
|
||||
ret
|
||||
|
||||
CheckObjectFlag: ; 2457d (9:457d)
|
||||
CheckObjectFlag:
|
||||
ld hl, MAPOBJECT_SPRITE
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
@@ -62,7 +62,7 @@ CheckObjectFlag: ; 2457d (9:457d)
|
||||
scf
|
||||
ret
|
||||
|
||||
GetObjectTimeMask: ; 245a7 (9:45a7)
|
||||
GetObjectTimeMask:
|
||||
call CheckObjectTime
|
||||
ld a, -1
|
||||
ret c
|
||||
|
@@ -1,4 +1,4 @@
|
||||
RunMapSetupScript:: ; 15363
|
||||
RunMapSetupScript::
|
||||
ld a, [hMapEntryMethod]
|
||||
and $f
|
||||
dec a
|
||||
@@ -12,11 +12,10 @@ RunMapSetupScript:: ; 15363
|
||||
ld l, a
|
||||
call ReadMapSetupScript
|
||||
ret
|
||||
; 15377
|
||||
|
||||
INCLUDE "data/maps/setup_scripts.asm"
|
||||
|
||||
ReadMapSetupScript: ; 1541d
|
||||
ReadMapSetupScript:
|
||||
.loop
|
||||
ld a, [hli]
|
||||
cp -1
|
||||
@@ -58,9 +57,8 @@ ReadMapSetupScript: ; 1541d
|
||||
|
||||
pop hl
|
||||
jr .loop
|
||||
; 15440
|
||||
|
||||
MapSetupCommands: ; 15440
|
||||
MapSetupCommands:
|
||||
; entries correspond to command indexes in constants/map_setup_constants.asm
|
||||
dba EnableLCD ; 00
|
||||
dba DisableLCD ; 01
|
||||
@@ -108,51 +106,44 @@ MapSetupCommands: ; 15440
|
||||
dba RetainOldPalettes ; 2b
|
||||
dba DontScrollText ; 2c
|
||||
dba ReturnFromMapSetupScript ; 2d
|
||||
; 154ca
|
||||
|
||||
|
||||
DontScrollText: ; 154ca
|
||||
DontScrollText:
|
||||
xor a
|
||||
ld [wDisableTextAcceleration], a
|
||||
ret
|
||||
; 154cf
|
||||
|
||||
ActivateMapAnims: ; 154cf
|
||||
ActivateMapAnims:
|
||||
ld a, $1
|
||||
ld [hMapAnims], a
|
||||
ret
|
||||
; 154d3
|
||||
|
||||
SuspendMapAnims: ; 154d3
|
||||
SuspendMapAnims:
|
||||
xor a
|
||||
ld [hMapAnims], a
|
||||
ret
|
||||
; 154d7
|
||||
|
||||
LoadObjectsRunCallback_02: ; 154d7
|
||||
LoadObjectsRunCallback_02:
|
||||
ld a, MAPCALLBACK_OBJECTS
|
||||
call RunMapCallback
|
||||
farcall LoadObjectMasks
|
||||
farcall InitializeVisibleSprites
|
||||
ret
|
||||
; 154ea (5:54ea)
|
||||
|
||||
; unused
|
||||
ret
|
||||
; 154eb
|
||||
|
||||
DelayClearingOldSprites: ; 154eb
|
||||
DelayClearingOldSprites:
|
||||
ld hl, wPlayerSpriteSetupFlags
|
||||
set PLAYERSPRITESETUP_RESET_ACTION_F, [hl]
|
||||
ret
|
||||
; 154f1
|
||||
|
||||
DelayLoadingNewSprites: ; 154f1
|
||||
DelayLoadingNewSprites:
|
||||
ld hl, wPlayerSpriteSetupFlags
|
||||
set PLAYERSPRITESETUP_SKIP_RELOAD_GFX_F, [hl]
|
||||
ret
|
||||
|
||||
CheckReplaceKrisSprite: ; 154f7
|
||||
CheckReplaceKrisSprite:
|
||||
nop
|
||||
call .CheckBiking
|
||||
jr c, .ok
|
||||
@@ -166,7 +157,7 @@ CheckReplaceKrisSprite: ; 154f7
|
||||
call ReplaceKrisSprite
|
||||
ret
|
||||
|
||||
.CheckBiking: ; 1550c (5:550c)
|
||||
.CheckBiking:
|
||||
and a
|
||||
ld hl, wBikeFlags
|
||||
bit BIKEFLAGS_ALWAYS_ON_BIKE_F, [hl]
|
||||
@@ -176,7 +167,7 @@ CheckReplaceKrisSprite: ; 154f7
|
||||
scf
|
||||
ret
|
||||
|
||||
.CheckSurfing2: ; 1551a (5:551a)
|
||||
.CheckSurfing2:
|
||||
ld a, [wPlayerState]
|
||||
cp PLAYER_NORMAL
|
||||
jr z, .nope
|
||||
@@ -208,7 +199,7 @@ CheckReplaceKrisSprite: ; 154f7
|
||||
and a
|
||||
ret
|
||||
|
||||
.CheckSurfing: ; 1554e (5:554e)
|
||||
.CheckSurfing:
|
||||
call CheckOnWater
|
||||
jr nz, .ret_nc
|
||||
ld a, [wPlayerState]
|
||||
@@ -224,19 +215,17 @@ CheckReplaceKrisSprite: ; 154f7
|
||||
.ret_nc
|
||||
and a
|
||||
ret
|
||||
; 15567
|
||||
|
||||
FadeOldMapMusic: ; 15567
|
||||
FadeOldMapMusic:
|
||||
ld a, 6
|
||||
call SkipMusic
|
||||
ret
|
||||
; 1556d
|
||||
|
||||
RetainOldPalettes: ; 1556d
|
||||
RetainOldPalettes:
|
||||
farcall _UpdateTimePals
|
||||
ret
|
||||
|
||||
RotatePalettesRightMapAndMusic: ; 15574
|
||||
RotatePalettesRightMapAndMusic:
|
||||
ld e, 0
|
||||
ld a, [wMusicFadeID]
|
||||
ld d, 0
|
||||
@@ -245,9 +234,8 @@ RotatePalettesRightMapAndMusic: ; 15574
|
||||
ld [wMusicFade], a
|
||||
call RotateThreePalettesRight
|
||||
ret
|
||||
; 15587
|
||||
|
||||
ForceMapMusic: ; 15587
|
||||
ForceMapMusic:
|
||||
ld a, [wPlayerState]
|
||||
cp PLAYER_BIKE
|
||||
jr nz, .notbiking
|
||||
@@ -257,4 +245,3 @@ ForceMapMusic: ; 15587
|
||||
.notbiking
|
||||
call TryRestartMapMusic
|
||||
ret
|
||||
; 1559a
|
||||
|
@@ -1,4 +1,4 @@
|
||||
MovementPointers: ; 5075
|
||||
MovementPointers:
|
||||
; entries correspond to macros/scripts/movement.asm enumeration
|
||||
dw Movement_turn_head_down ; 00
|
||||
dw Movement_turn_head_up ; 01
|
||||
@@ -90,38 +90,33 @@ MovementPointers: ; 5075
|
||||
dw Movement_rock_smash ; 57
|
||||
dw Movement_return_dig ; 58
|
||||
dw Movement_skyfall_top ; 59
|
||||
; 5129
|
||||
|
||||
|
||||
Movement_teleport_from: ; 5129
|
||||
Movement_teleport_from:
|
||||
ld hl, OBJECT_STEP_TYPE
|
||||
add hl, bc
|
||||
ld [hl], STEP_TYPE_TELEPORT_FROM
|
||||
ret
|
||||
; 5130
|
||||
|
||||
Movement_teleport_to: ; 5130
|
||||
Movement_teleport_to:
|
||||
ld hl, OBJECT_STEP_TYPE
|
||||
add hl, bc
|
||||
ld [hl], STEP_TYPE_TELEPORT_TO
|
||||
ret
|
||||
; 5137
|
||||
|
||||
Movement_skyfall: ; 5137
|
||||
Movement_skyfall:
|
||||
ld hl, OBJECT_STEP_TYPE
|
||||
add hl, bc
|
||||
ld [hl], STEP_TYPE_SKYFALL
|
||||
ret
|
||||
; 513e
|
||||
|
||||
Movement_skyfall_top: ; 513e
|
||||
Movement_skyfall_top:
|
||||
ld hl, OBJECT_STEP_TYPE
|
||||
add hl, bc
|
||||
ld [hl], STEP_TYPE_SKYFALL_TOP
|
||||
ret
|
||||
; 5145
|
||||
|
||||
Movement_step_dig: ; 5145
|
||||
Movement_step_dig:
|
||||
call GetSpriteDirection
|
||||
rlca
|
||||
rlca
|
||||
@@ -142,9 +137,8 @@ Movement_step_dig: ; 5145
|
||||
add hl, bc
|
||||
ld [hl], STANDING
|
||||
ret
|
||||
; 516a
|
||||
|
||||
Movement_return_dig: ; 516a
|
||||
Movement_return_dig:
|
||||
call GetSpriteDirection
|
||||
rlca
|
||||
rlca
|
||||
@@ -162,9 +156,8 @@ Movement_return_dig: ; 516a
|
||||
add hl, bc
|
||||
ld [hl], STEP_TYPE_RETURN_DIG
|
||||
ret
|
||||
; 5189
|
||||
|
||||
Movement_fish_got_bite: ; 5189
|
||||
Movement_fish_got_bite:
|
||||
ld hl, OBJECT_ACTION
|
||||
add hl, bc
|
||||
ld [hl], OBJECT_ACTION_FISHING
|
||||
@@ -172,9 +165,8 @@ Movement_fish_got_bite: ; 5189
|
||||
add hl, bc
|
||||
ld [hl], STEP_TYPE_GOT_BITE
|
||||
ret
|
||||
; 5196
|
||||
|
||||
Movement_rock_smash: ; 5196
|
||||
Movement_rock_smash:
|
||||
call JumpMovementPointer
|
||||
ld hl, OBJECT_STEP_DURATION
|
||||
add hl, bc
|
||||
@@ -186,9 +178,8 @@ Movement_rock_smash: ; 5196
|
||||
add hl, bc
|
||||
ld [hl], STEP_TYPE_ROCK_SMASH
|
||||
ret
|
||||
; 51ab
|
||||
|
||||
Movement_fish_cast_rod: ; 51ab
|
||||
Movement_fish_cast_rod:
|
||||
ld hl, OBJECT_ACTION
|
||||
add hl, bc
|
||||
ld [hl], OBJECT_ACTION_FISHING
|
||||
@@ -196,16 +187,14 @@ Movement_fish_cast_rod: ; 51ab
|
||||
add hl, bc
|
||||
ld [hl], STEP_TYPE_SLEEP
|
||||
ret
|
||||
; 51b8
|
||||
|
||||
Movement_step_loop: ; 51b8
|
||||
Movement_step_loop:
|
||||
ld hl, OBJECT_MOVEMENT_BYTE_INDEX
|
||||
add hl, bc
|
||||
ld [hl], $0
|
||||
jp ContinueReadingMovement
|
||||
; 51c1
|
||||
|
||||
Movement_step_end: ; 51c1
|
||||
Movement_step_end:
|
||||
call RestoreDefaultMovement
|
||||
ld hl, OBJECT_MOVEMENTTYPE
|
||||
add hl, bc
|
||||
@@ -222,9 +211,8 @@ Movement_step_end: ; 51c1
|
||||
add hl, bc
|
||||
ld [hl], STEP_TYPE_SLEEP
|
||||
ret
|
||||
; 51db
|
||||
|
||||
Movement_48: ; 51db
|
||||
Movement_48:
|
||||
call RestoreDefaultMovement
|
||||
ld hl, OBJECT_MOVEMENTTYPE
|
||||
add hl, bc
|
||||
@@ -246,9 +234,8 @@ Movement_48: ; 51db
|
||||
ld hl, wVramState
|
||||
res 7, [hl]
|
||||
ret
|
||||
; 51fd
|
||||
|
||||
Movement_remove_object: ; 51fd
|
||||
Movement_remove_object:
|
||||
call DeleteMapObject
|
||||
ld hl, wObjectFollow_Leader
|
||||
ld a, [hMapObjectIndexBuffer]
|
||||
@@ -260,9 +247,8 @@ Movement_remove_object: ; 51fd
|
||||
ld hl, wVramState
|
||||
res 7, [hl]
|
||||
ret
|
||||
; 5210
|
||||
|
||||
Movement_4b: ; 5210
|
||||
Movement_4b:
|
||||
ld hl, OBJECT_ACTION
|
||||
add hl, bc
|
||||
ld [hl], OBJECT_ACTION_STAND
|
||||
@@ -274,48 +260,47 @@ Movement_4b: ; 5210
|
||||
ld hl, wVramState
|
||||
res 7, [hl]
|
||||
ret
|
||||
; 5222
|
||||
|
||||
Movement_step_sleep_1: ; 5222
|
||||
Movement_step_sleep_1:
|
||||
ld a, 1
|
||||
jr Movement_step_sleep_common
|
||||
|
||||
Movement_step_sleep_2: ; 5226
|
||||
Movement_step_sleep_2:
|
||||
ld a, 2
|
||||
jr Movement_step_sleep_common
|
||||
|
||||
Movement_step_sleep_3: ; 522a
|
||||
Movement_step_sleep_3:
|
||||
ld a, 3
|
||||
jr Movement_step_sleep_common
|
||||
|
||||
Movement_step_sleep_4: ; 522e
|
||||
Movement_step_sleep_4:
|
||||
ld a, 4
|
||||
jr Movement_step_sleep_common
|
||||
|
||||
Movement_step_sleep_5: ; 5232
|
||||
Movement_step_sleep_5:
|
||||
ld a, 5
|
||||
jr Movement_step_sleep_common
|
||||
|
||||
Movement_step_sleep_6: ; 5236
|
||||
Movement_step_sleep_6:
|
||||
ld a, 6
|
||||
jr Movement_step_sleep_common
|
||||
|
||||
Movement_step_sleep_7: ; 523a
|
||||
Movement_step_sleep_7:
|
||||
ld a, 7
|
||||
jr Movement_step_sleep_common
|
||||
|
||||
Movement_step_sleep_8: ; 523e
|
||||
Movement_step_sleep_8:
|
||||
ld a, 8
|
||||
jr Movement_step_sleep_common
|
||||
|
||||
Movement_step_sleep: ; 5242
|
||||
Movement_step_sleep:
|
||||
; parameters:
|
||||
; duration (DecimalParam)
|
||||
|
||||
call JumpMovementPointer
|
||||
jr Movement_step_sleep_common
|
||||
|
||||
Movement_step_sleep_common: ; 5247
|
||||
Movement_step_sleep_common:
|
||||
ld hl, OBJECT_STEP_DURATION
|
||||
add hl, bc
|
||||
ld [hl], a
|
||||
@@ -332,9 +317,8 @@ Movement_step_sleep_common: ; 5247
|
||||
add hl, bc
|
||||
ld [hl], STANDING
|
||||
ret
|
||||
; 525f
|
||||
|
||||
Movement_step_bump: ; 525f
|
||||
Movement_step_bump:
|
||||
ld a, 1
|
||||
ld hl, OBJECT_STEP_DURATION
|
||||
add hl, bc
|
||||
@@ -352,9 +336,8 @@ Movement_step_bump: ; 525f
|
||||
add hl, bc
|
||||
ld [hl], STANDING
|
||||
ret
|
||||
; 5279
|
||||
|
||||
Movement_tree_shake: ; 5279
|
||||
Movement_tree_shake:
|
||||
ld a, 24
|
||||
ld hl, OBJECT_STEP_DURATION
|
||||
add hl, bc
|
||||
@@ -372,86 +355,76 @@ Movement_tree_shake: ; 5279
|
||||
add hl, bc
|
||||
ld [hl], STANDING
|
||||
ret
|
||||
; 5293
|
||||
|
||||
Movement_remove_sliding: ; 5293
|
||||
Movement_remove_sliding:
|
||||
ld hl, OBJECT_FLAGS1
|
||||
add hl, bc
|
||||
res SLIDING_F, [hl]
|
||||
jp ContinueReadingMovement
|
||||
; 529c
|
||||
|
||||
Movement_set_sliding: ; 529c
|
||||
Movement_set_sliding:
|
||||
ld hl, OBJECT_FLAGS1
|
||||
add hl, bc
|
||||
set SLIDING_F, [hl]
|
||||
jp ContinueReadingMovement
|
||||
; 52a5
|
||||
|
||||
Movement_remove_fixed_facing: ; 52a5
|
||||
Movement_remove_fixed_facing:
|
||||
ld hl, OBJECT_FLAGS1
|
||||
add hl, bc
|
||||
res FIXED_FACING_F, [hl]
|
||||
jp ContinueReadingMovement
|
||||
; 52ae
|
||||
|
||||
Movement_fix_facing: ; 52ae
|
||||
Movement_fix_facing:
|
||||
ld hl, OBJECT_FLAGS1
|
||||
add hl, bc
|
||||
set FIXED_FACING_F, [hl]
|
||||
jp ContinueReadingMovement
|
||||
; 52b7
|
||||
|
||||
Movement_show_object: ; 52b7
|
||||
Movement_show_object:
|
||||
ld hl, OBJECT_FLAGS1
|
||||
add hl, bc
|
||||
res INVISIBLE_F, [hl]
|
||||
jp ContinueReadingMovement
|
||||
; 52c0
|
||||
|
||||
Movement_hide_object: ; 52c0
|
||||
Movement_hide_object:
|
||||
ld hl, OBJECT_FLAGS1
|
||||
add hl, bc
|
||||
set INVISIBLE_F, [hl]
|
||||
jp ContinueReadingMovement
|
||||
; 52c9
|
||||
|
||||
Movement_hide_emote: ; 52c9
|
||||
Movement_hide_emote:
|
||||
call DespawnEmote
|
||||
jp ContinueReadingMovement
|
||||
; 52cf
|
||||
|
||||
Movement_show_emote: ; 52cf
|
||||
Movement_show_emote:
|
||||
call SpawnEmote
|
||||
jp ContinueReadingMovement
|
||||
; 52d5
|
||||
|
||||
Movement_step_shake: ; 52d5
|
||||
Movement_step_shake:
|
||||
; parameters:
|
||||
; displacement (DecimalParam)
|
||||
|
||||
call JumpMovementPointer
|
||||
call ShakeScreen
|
||||
jp ContinueReadingMovement
|
||||
; 52de
|
||||
|
||||
Movement_turn_head_down: ; 52de
|
||||
Movement_turn_head_down:
|
||||
ld a, OW_DOWN
|
||||
jr TurnHead
|
||||
|
||||
Movement_turn_head_up: ; 52e2
|
||||
Movement_turn_head_up:
|
||||
ld a, OW_UP
|
||||
jr TurnHead
|
||||
|
||||
Movement_turn_head_left: ; 52e6
|
||||
Movement_turn_head_left:
|
||||
ld a, OW_LEFT
|
||||
jr TurnHead
|
||||
|
||||
Movement_turn_head_right: ; 52ea
|
||||
Movement_turn_head_right:
|
||||
ld a, OW_RIGHT
|
||||
jr TurnHead
|
||||
|
||||
TurnHead: ; 52ee
|
||||
TurnHead:
|
||||
ld hl, OBJECT_FACING
|
||||
add hl, bc
|
||||
ld [hl], a
|
||||
@@ -464,269 +437,220 @@ TurnHead: ; 52ee
|
||||
add hl, bc
|
||||
ld [hl], STANDING
|
||||
ret
|
||||
; 5300
|
||||
|
||||
Movement_slow_step_down: ; 5300
|
||||
Movement_slow_step_down:
|
||||
ld a, STEP_SLOW << 2 | DOWN
|
||||
jp NormalStep
|
||||
; 5305
|
||||
|
||||
Movement_slow_step_up: ; 5305
|
||||
Movement_slow_step_up:
|
||||
ld a, STEP_SLOW << 2 | UP
|
||||
jp NormalStep
|
||||
; 530a
|
||||
|
||||
Movement_slow_step_left: ; 530a
|
||||
Movement_slow_step_left:
|
||||
ld a, STEP_SLOW << 2 | LEFT
|
||||
jp NormalStep
|
||||
; 530f
|
||||
|
||||
Movement_slow_step_right: ; 530f
|
||||
Movement_slow_step_right:
|
||||
ld a, STEP_SLOW << 2 | RIGHT
|
||||
jp NormalStep
|
||||
; 5314
|
||||
|
||||
Movement_step_down: ; 5314
|
||||
Movement_step_down:
|
||||
ld a, STEP_WALK << 2 | DOWN
|
||||
jp NormalStep
|
||||
; 5319
|
||||
|
||||
Movement_step_up: ; 5319
|
||||
Movement_step_up:
|
||||
ld a, STEP_WALK << 2 | UP
|
||||
jp NormalStep
|
||||
; 531e
|
||||
|
||||
Movement_step_left: ; 531e
|
||||
Movement_step_left:
|
||||
ld a, STEP_WALK << 2 | LEFT
|
||||
jp NormalStep
|
||||
; 5323
|
||||
|
||||
Movement_step_right: ; 5323
|
||||
Movement_step_right:
|
||||
ld a, STEP_WALK << 2 | RIGHT
|
||||
jp NormalStep
|
||||
; 5328
|
||||
|
||||
Movement_big_step_down: ; 5328
|
||||
Movement_big_step_down:
|
||||
ld a, STEP_BIKE << 2 | DOWN
|
||||
jp NormalStep
|
||||
; 532d
|
||||
|
||||
Movement_big_step_up: ; 532d
|
||||
Movement_big_step_up:
|
||||
ld a, STEP_BIKE << 2 | UP
|
||||
jp NormalStep
|
||||
; 5332
|
||||
|
||||
Movement_big_step_left: ; 5332
|
||||
Movement_big_step_left:
|
||||
ld a, STEP_BIKE << 2 | LEFT
|
||||
jp NormalStep
|
||||
; 5337
|
||||
|
||||
Movement_big_step_right: ; 5337
|
||||
Movement_big_step_right:
|
||||
ld a, STEP_BIKE << 2 | RIGHT
|
||||
jp NormalStep
|
||||
; 533c
|
||||
|
||||
|
||||
Movement_turn_away_down: ; 533c
|
||||
Movement_turn_away_down:
|
||||
ld a, STEP_SLOW << 2 | DOWN
|
||||
jp TurningStep
|
||||
; 5341
|
||||
|
||||
Movement_turn_away_up: ; 5341
|
||||
Movement_turn_away_up:
|
||||
ld a, STEP_SLOW << 2 | UP
|
||||
jp TurningStep
|
||||
; 5346
|
||||
|
||||
Movement_turn_away_left: ; 5346
|
||||
Movement_turn_away_left:
|
||||
ld a, STEP_SLOW << 2 | LEFT
|
||||
jp TurningStep
|
||||
; 534b
|
||||
|
||||
Movement_turn_away_right: ; 534b
|
||||
Movement_turn_away_right:
|
||||
ld a, STEP_SLOW << 2 | RIGHT
|
||||
jp TurningStep
|
||||
; 5350
|
||||
|
||||
Movement_turn_in_down: ; 5350
|
||||
Movement_turn_in_down:
|
||||
ld a, STEP_WALK << 2 | DOWN
|
||||
jp TurningStep
|
||||
; 5355
|
||||
|
||||
Movement_turn_in_up: ; 5355
|
||||
Movement_turn_in_up:
|
||||
ld a, STEP_WALK << 2 | UP
|
||||
jp TurningStep
|
||||
; 535a
|
||||
|
||||
Movement_turn_in_left: ; 535a
|
||||
Movement_turn_in_left:
|
||||
ld a, STEP_WALK << 2 | LEFT
|
||||
jp TurningStep
|
||||
; 535f
|
||||
|
||||
Movement_turn_in_right: ; 535f
|
||||
Movement_turn_in_right:
|
||||
ld a, STEP_WALK << 2 | RIGHT
|
||||
jp TurningStep
|
||||
; 5364
|
||||
|
||||
Movement_turn_waterfall_down: ; 5364
|
||||
Movement_turn_waterfall_down:
|
||||
ld a, STEP_BIKE << 2 | DOWN
|
||||
jp TurningStep
|
||||
; 5369
|
||||
|
||||
Movement_turn_waterfall_up: ; 5369
|
||||
Movement_turn_waterfall_up:
|
||||
ld a, STEP_BIKE << 2 | UP
|
||||
jp TurningStep
|
||||
; 536e
|
||||
|
||||
Movement_turn_waterfall_left: ; 536e
|
||||
Movement_turn_waterfall_left:
|
||||
ld a, STEP_BIKE << 2 | LEFT
|
||||
jp TurningStep
|
||||
; 5373
|
||||
|
||||
Movement_turn_waterfall_right: ; 5373
|
||||
Movement_turn_waterfall_right:
|
||||
ld a, STEP_BIKE << 2 | RIGHT
|
||||
jp TurningStep
|
||||
; 5378
|
||||
|
||||
|
||||
Movement_slow_slide_step_down: ; 5378
|
||||
Movement_slow_slide_step_down:
|
||||
ld a, STEP_SLOW << 2 | DOWN
|
||||
jp SlideStep
|
||||
; 537d
|
||||
|
||||
Movement_slow_slide_step_up: ; 537d
|
||||
Movement_slow_slide_step_up:
|
||||
ld a, STEP_SLOW << 2 | UP
|
||||
jp SlideStep
|
||||
; 5382
|
||||
|
||||
Movement_slow_slide_step_left: ; 5382
|
||||
Movement_slow_slide_step_left:
|
||||
ld a, STEP_SLOW << 2 | LEFT
|
||||
jp SlideStep
|
||||
; 5387
|
||||
|
||||
Movement_slow_slide_step_right: ; 5387
|
||||
Movement_slow_slide_step_right:
|
||||
ld a, STEP_SLOW << 2 | RIGHT
|
||||
jp SlideStep
|
||||
; 538c
|
||||
|
||||
Movement_slide_step_down: ; 538c
|
||||
Movement_slide_step_down:
|
||||
ld a, STEP_WALK << 2 | DOWN
|
||||
jp SlideStep
|
||||
; 5391
|
||||
|
||||
Movement_slide_step_up: ; 5391
|
||||
Movement_slide_step_up:
|
||||
ld a, STEP_WALK << 2 | UP
|
||||
jp SlideStep
|
||||
; 5396
|
||||
|
||||
Movement_slide_step_left: ; 5396
|
||||
Movement_slide_step_left:
|
||||
ld a, STEP_WALK << 2 | LEFT
|
||||
jp SlideStep
|
||||
; 539b
|
||||
|
||||
Movement_slide_step_right: ; 539b
|
||||
Movement_slide_step_right:
|
||||
ld a, STEP_WALK << 2 | RIGHT
|
||||
jp SlideStep
|
||||
; 53a0
|
||||
|
||||
Movement_fast_slide_step_down: ; 53a0
|
||||
Movement_fast_slide_step_down:
|
||||
ld a, STEP_BIKE << 2 | DOWN
|
||||
jp SlideStep
|
||||
; 53a5
|
||||
|
||||
Movement_fast_slide_step_up: ; 53a5
|
||||
Movement_fast_slide_step_up:
|
||||
ld a, STEP_BIKE << 2 | UP
|
||||
jp SlideStep
|
||||
; 53aa
|
||||
|
||||
Movement_fast_slide_step_left: ; 53aa
|
||||
Movement_fast_slide_step_left:
|
||||
ld a, STEP_BIKE << 2 | LEFT
|
||||
jp SlideStep
|
||||
; 53af
|
||||
|
||||
Movement_fast_slide_step_right: ; 53af
|
||||
Movement_fast_slide_step_right:
|
||||
ld a, STEP_BIKE << 2 | RIGHT
|
||||
jp SlideStep
|
||||
; 53b4
|
||||
|
||||
|
||||
Movement_slow_jump_step_down: ; 53b4
|
||||
Movement_slow_jump_step_down:
|
||||
ld a, STEP_SLOW << 2 | DOWN
|
||||
jp JumpStep
|
||||
; 53b9
|
||||
|
||||
Movement_slow_jump_step_up: ; 53b9
|
||||
Movement_slow_jump_step_up:
|
||||
ld a, STEP_SLOW << 2 | UP
|
||||
jp JumpStep
|
||||
; 53be
|
||||
|
||||
Movement_slow_jump_step_left: ; 53be
|
||||
Movement_slow_jump_step_left:
|
||||
ld a, STEP_SLOW << 2 | LEFT
|
||||
jp JumpStep
|
||||
; 53c3
|
||||
|
||||
Movement_slow_jump_step_right: ; 53c3
|
||||
Movement_slow_jump_step_right:
|
||||
ld a, STEP_SLOW << 2 | RIGHT
|
||||
jp JumpStep
|
||||
; 53c8
|
||||
|
||||
Movement_jump_step_down: ; 53c8
|
||||
Movement_jump_step_down:
|
||||
ld a, STEP_WALK << 2 | DOWN
|
||||
jp JumpStep
|
||||
; 53cd
|
||||
|
||||
Movement_jump_step_up: ; 53cd
|
||||
Movement_jump_step_up:
|
||||
ld a, STEP_WALK << 2 | UP
|
||||
jp JumpStep
|
||||
; 53d2
|
||||
|
||||
Movement_jump_step_left: ; 53d2
|
||||
Movement_jump_step_left:
|
||||
ld a, STEP_WALK << 2 | LEFT
|
||||
jp JumpStep
|
||||
; 53d7
|
||||
|
||||
Movement_jump_step_right: ; 53d7
|
||||
Movement_jump_step_right:
|
||||
ld a, STEP_WALK << 2 | RIGHT
|
||||
jp JumpStep
|
||||
; 53dc
|
||||
|
||||
Movement_fast_jump_step_down: ; 53dc
|
||||
Movement_fast_jump_step_down:
|
||||
ld a, STEP_BIKE << 2 | DOWN
|
||||
jp JumpStep
|
||||
; 53e1
|
||||
|
||||
Movement_fast_jump_step_up: ; 53e1
|
||||
Movement_fast_jump_step_up:
|
||||
ld a, STEP_BIKE << 2 | UP
|
||||
jp JumpStep
|
||||
; 53e6
|
||||
|
||||
Movement_fast_jump_step_left: ; 53e6
|
||||
Movement_fast_jump_step_left:
|
||||
ld a, STEP_BIKE << 2 | LEFT
|
||||
jp JumpStep
|
||||
; 53eb
|
||||
|
||||
Movement_fast_jump_step_right: ; 53eb
|
||||
Movement_fast_jump_step_right:
|
||||
ld a, STEP_BIKE << 2 | RIGHT
|
||||
jp JumpStep
|
||||
; 53f0
|
||||
|
||||
|
||||
Movement_turn_step_down: ; 53f0
|
||||
Movement_turn_step_down:
|
||||
ld a, OW_DOWN
|
||||
jr TurnStep
|
||||
|
||||
Movement_turn_step_up: ; 53f4
|
||||
Movement_turn_step_up:
|
||||
ld a, OW_UP
|
||||
jr TurnStep
|
||||
|
||||
Movement_turn_step_left: ; 53f8
|
||||
Movement_turn_step_left:
|
||||
ld a, OW_LEFT
|
||||
jr TurnStep
|
||||
|
||||
Movement_turn_step_right: ; 53fc
|
||||
Movement_turn_step_right:
|
||||
ld a, OW_RIGHT
|
||||
jr TurnStep
|
||||
|
||||
TurnStep: ; 5400
|
||||
TurnStep:
|
||||
ld hl, OBJECT_1D ; new facing
|
||||
add hl, bc
|
||||
ld [hl], a
|
||||
@@ -739,9 +663,8 @@ TurnStep: ; 5400
|
||||
add hl, bc
|
||||
ld [hl], STEP_TYPE_HALF_STEP
|
||||
ret
|
||||
; 5412
|
||||
|
||||
NormalStep: ; 5412
|
||||
NormalStep:
|
||||
call InitStep
|
||||
call UpdateTallGrassFlags
|
||||
ld hl, OBJECT_ACTION
|
||||
@@ -776,9 +699,8 @@ NormalStep: ; 5412
|
||||
add hl, bc
|
||||
ld [hl], STEP_TYPE_PLAYER_WALK
|
||||
ret
|
||||
; 5446
|
||||
|
||||
TurningStep: ; 5446
|
||||
TurningStep:
|
||||
call InitStep
|
||||
call UpdateTallGrassFlags
|
||||
|
||||
@@ -801,10 +723,9 @@ TurningStep: ; 5446
|
||||
add hl, bc
|
||||
ld [hl], STEP_TYPE_PLAYER_WALK
|
||||
ret
|
||||
; 5468
|
||||
|
||||
|
||||
SlideStep: ; 5468
|
||||
SlideStep:
|
||||
call InitStep
|
||||
call UpdateTallGrassFlags
|
||||
|
||||
@@ -827,10 +748,9 @@ SlideStep: ; 5468
|
||||
add hl, bc
|
||||
ld [hl], STEP_TYPE_PLAYER_WALK
|
||||
ret
|
||||
; 548a
|
||||
|
||||
|
||||
JumpStep: ; 548a
|
||||
JumpStep:
|
||||
call InitStep
|
||||
ld hl, OBJECT_1F
|
||||
add hl, bc
|
||||
@@ -861,4 +781,3 @@ JumpStep: ; 548a
|
||||
add hl, bc
|
||||
ld [hl], STEP_TYPE_PLAYER_JUMP
|
||||
ret
|
||||
; 54b8
|
||||
|
@@ -1,4 +1,4 @@
|
||||
CanObjectMoveInDirection: ; 6ec1
|
||||
CanObjectMoveInDirection:
|
||||
|
||||
ld hl, OBJECT_PALETTE
|
||||
add hl, bc
|
||||
@@ -57,10 +57,9 @@ CanObjectMoveInDirection: ; 6ec1
|
||||
.move_anywhere
|
||||
and a
|
||||
ret
|
||||
; 6f07
|
||||
|
||||
|
||||
WillObjectBumpIntoWater: ; 6f07
|
||||
WillObjectBumpIntoWater:
|
||||
call Function6f5f
|
||||
ret c
|
||||
ld hl, OBJECT_NEXT_MAP_X
|
||||
@@ -82,9 +81,8 @@ WillObjectBumpIntoWater: ; 6f07
|
||||
jr z, WillObjectBumpIntoTile
|
||||
scf
|
||||
ret
|
||||
; 6f2c
|
||||
|
||||
WillObjectBumpIntoLand: ; 6f2c
|
||||
WillObjectBumpIntoLand:
|
||||
call Function6f5f
|
||||
ret c
|
||||
ld hl, OBJECT_NEXT_TILE
|
||||
@@ -95,9 +93,8 @@ WillObjectBumpIntoLand: ; 6f2c
|
||||
jr z, WillObjectBumpIntoTile
|
||||
scf
|
||||
ret
|
||||
; 6f3e
|
||||
|
||||
WillObjectBumpIntoTile: ; 6f3e
|
||||
WillObjectBumpIntoTile:
|
||||
ld hl, OBJECT_NEXT_TILE
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
@@ -117,13 +114,11 @@ WillObjectBumpIntoTile: ; 6f3e
|
||||
ret z
|
||||
scf
|
||||
ret
|
||||
; 6f5b
|
||||
|
||||
.data_6f5b
|
||||
db DOWN_MASK, UP_MASK, RIGHT_MASK, LEFT_MASK
|
||||
; 6f5f
|
||||
|
||||
Function6f5f: ; 6f5f
|
||||
Function6f5f:
|
||||
ld hl, OBJECT_STANDING_TILE
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
@@ -142,13 +137,11 @@ Function6f5f: ; 6f5f
|
||||
ret z
|
||||
scf
|
||||
ret
|
||||
; 6f7b
|
||||
|
||||
.data_6f7b
|
||||
db UP_MASK, DOWN_MASK, LEFT_MASK, RIGHT_MASK
|
||||
; 6f7f
|
||||
|
||||
Function6f7f: ; 6f7f
|
||||
Function6f7f:
|
||||
ld d, a
|
||||
and $f0
|
||||
cp $b0
|
||||
@@ -168,14 +161,12 @@ Function6f7f: ; 6f7f
|
||||
ld a, [hl]
|
||||
scf
|
||||
ret
|
||||
; 6f99
|
||||
|
||||
.data_6f99
|
||||
db 8, 4, 1, 2
|
||||
db 10, 6, 9, 5
|
||||
; 6fa1
|
||||
|
||||
Function6fa1: ; 6fa1
|
||||
Function6fa1:
|
||||
ld hl, OBJECT_DIRECTION_WALKING
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
@@ -224,11 +215,10 @@ Function6fa1: ; 6fa1
|
||||
.not_land
|
||||
scf
|
||||
ret
|
||||
; 6fd9
|
||||
|
||||
|
||||
|
||||
CheckFacingObject:: ; 6fd9
|
||||
CheckFacingObject::
|
||||
|
||||
call GetFacingTileCoord
|
||||
|
||||
@@ -267,10 +257,9 @@ CheckFacingObject:: ; 6fd9
|
||||
.standing
|
||||
scf
|
||||
ret
|
||||
; 7009
|
||||
|
||||
|
||||
WillObjectBumpIntoSomeoneElse: ; 7009
|
||||
WillObjectBumpIntoSomeoneElse:
|
||||
ld hl, OBJECT_NEXT_MAP_X
|
||||
add hl, bc
|
||||
ld d, [hl]
|
||||
@@ -278,7 +267,6 @@ WillObjectBumpIntoSomeoneElse: ; 7009
|
||||
add hl, bc
|
||||
ld e, [hl]
|
||||
jr IsNPCAtCoord
|
||||
; 7015
|
||||
|
||||
Unreferenced_Function7015:
|
||||
ld a, [hMapObjectIndexBuffer]
|
||||
@@ -287,7 +275,7 @@ Unreferenced_Function7015:
|
||||
call IsNPCAtCoord
|
||||
ret
|
||||
|
||||
.CheckWillBeFacingNPC: ; 7021
|
||||
.CheckWillBeFacingNPC:
|
||||
ld hl, OBJECT_NEXT_MAP_X
|
||||
add hl, bc
|
||||
ld d, [hl]
|
||||
@@ -315,9 +303,8 @@ Unreferenced_Function7015:
|
||||
.left
|
||||
dec d
|
||||
ret
|
||||
; 7041
|
||||
|
||||
IsNPCAtCoord: ; 7041
|
||||
IsNPCAtCoord:
|
||||
ld bc, wObjectStructs
|
||||
xor a
|
||||
.loop
|
||||
@@ -390,9 +377,8 @@ IsNPCAtCoord: ; 7041
|
||||
.setcarry
|
||||
scf
|
||||
ret
|
||||
; 70a4
|
||||
|
||||
HasObjectReachedMovementLimit: ; 70a4
|
||||
HasObjectReachedMovementLimit:
|
||||
ld hl, OBJECT_RADIUS
|
||||
add hl, bc
|
||||
ld a, [hl]
|
||||
@@ -450,9 +436,8 @@ HasObjectReachedMovementLimit: ; 70a4
|
||||
.yes
|
||||
scf
|
||||
ret
|
||||
; 70ed
|
||||
|
||||
IsObjectMovingOffEdgeOfScreen: ; 70ed
|
||||
IsObjectMovingOffEdgeOfScreen:
|
||||
ld hl, OBJECT_NEXT_MAP_X
|
||||
add hl, bc
|
||||
ld a, [wXCoord]
|
||||
@@ -481,7 +466,6 @@ IsObjectMovingOffEdgeOfScreen: ; 70ed
|
||||
.yes
|
||||
scf
|
||||
ret
|
||||
; 7113
|
||||
|
||||
Unreferenced_Function7113:
|
||||
ld a, [wPlayerStandingMapX]
|
||||
@@ -547,10 +531,9 @@ Unreferenced_Function7113:
|
||||
.yes
|
||||
scf
|
||||
ret
|
||||
; 7171
|
||||
|
||||
|
||||
Function7171: ; 7171
|
||||
Function7171:
|
||||
ld hl, OBJECT_NEXT_MAP_X
|
||||
add hl, bc
|
||||
ld a, d
|
||||
@@ -571,4 +554,3 @@ Function7171: ; 7171
|
||||
.nope
|
||||
and a
|
||||
ret
|
||||
; 718d
|
||||
|
@@ -1,13 +1,12 @@
|
||||
GetEmote2bpp: ; 1412a
|
||||
GetEmote2bpp:
|
||||
ld a, $1
|
||||
ld [rVBK], a
|
||||
call Get2bpp
|
||||
xor a
|
||||
ld [rVBK], a
|
||||
ret
|
||||
; 14135
|
||||
|
||||
_ReplaceKrisSprite:: ; 14135
|
||||
_ReplaceKrisSprite::
|
||||
call GetPlayerSprite
|
||||
ld a, [wUsedSprites]
|
||||
ld [hUsedSpriteIndex], a
|
||||
@@ -15,7 +14,6 @@ _ReplaceKrisSprite:: ; 14135
|
||||
ld [hUsedSpriteTile], a
|
||||
call GetUsedSprite
|
||||
ret
|
||||
; 14146
|
||||
|
||||
Function14146: ; mobile
|
||||
ld hl, wSpriteFlags
|
||||
@@ -27,7 +25,6 @@ Function14146: ; mobile
|
||||
pop af
|
||||
ld [wSpriteFlags], a
|
||||
ret
|
||||
; 14157
|
||||
|
||||
Function14157: ; mobile
|
||||
ld hl, wSpriteFlags
|
||||
@@ -39,15 +36,13 @@ Function14157: ; mobile
|
||||
pop af
|
||||
ld [wSpriteFlags], a
|
||||
ret
|
||||
; 14168
|
||||
|
||||
RefreshSprites:: ; 14168
|
||||
RefreshSprites::
|
||||
call .Refresh
|
||||
call LoadUsedSpritesGFX
|
||||
ret
|
||||
; 1416f
|
||||
|
||||
.Refresh: ; 1416f
|
||||
.Refresh:
|
||||
xor a
|
||||
ld bc, wUsedSpritesEnd - wUsedSprites
|
||||
ld hl, wUsedSprites
|
||||
@@ -56,9 +51,8 @@ RefreshSprites:: ; 14168
|
||||
call AddMapSprites
|
||||
call LoadAndSortSprites
|
||||
ret
|
||||
; 14183
|
||||
|
||||
GetPlayerSprite: ; 14183
|
||||
GetPlayerSprite:
|
||||
; Get Chris or Kris's sprite.
|
||||
ld hl, ChrisStateSprites
|
||||
ld a, [wPlayerSpriteSetupFlags]
|
||||
@@ -98,7 +92,7 @@ GetPlayerSprite: ; 14183
|
||||
INCLUDE "data/sprites/player_sprites.asm"
|
||||
|
||||
|
||||
AddMapSprites: ; 141c9
|
||||
AddMapSprites:
|
||||
call GetMapEnvironment
|
||||
call CheckOutdoorMap
|
||||
jr z, .outdoor
|
||||
@@ -108,10 +102,9 @@ AddMapSprites: ; 141c9
|
||||
.outdoor
|
||||
call AddOutdoorSprites
|
||||
ret
|
||||
; 141d9
|
||||
|
||||
|
||||
AddIndoorSprites: ; 141d9
|
||||
AddIndoorSprites:
|
||||
ld hl, wMap1ObjectSprite
|
||||
ld a, 1
|
||||
.loop
|
||||
@@ -125,10 +118,9 @@ AddIndoorSprites: ; 141d9
|
||||
cp NUM_OBJECTS
|
||||
jr nz, .loop
|
||||
ret
|
||||
; 141ee
|
||||
|
||||
|
||||
AddOutdoorSprites: ; 141ee
|
||||
AddOutdoorSprites:
|
||||
ld a, [wMapGroup]
|
||||
dec a
|
||||
ld c, a
|
||||
@@ -148,18 +140,16 @@ AddOutdoorSprites: ; 141ee
|
||||
dec c
|
||||
jr nz, .loop
|
||||
ret
|
||||
; 14209
|
||||
|
||||
|
||||
LoadUsedSpritesGFX: ; 14209
|
||||
LoadUsedSpritesGFX:
|
||||
ld a, MAPCALLBACK_SPRITES
|
||||
call RunMapCallback
|
||||
call GetUsedSprites
|
||||
call .LoadMiscTiles
|
||||
ret
|
||||
; 14215
|
||||
|
||||
.LoadMiscTiles: ; 14215
|
||||
.LoadMiscTiles:
|
||||
ld a, [wSpriteFlags]
|
||||
bit 6, a
|
||||
ret nz
|
||||
@@ -174,18 +164,16 @@ LoadUsedSpritesGFX: ; 14209
|
||||
.outdoor
|
||||
farcall LoadEmote
|
||||
ret
|
||||
; 14236
|
||||
|
||||
|
||||
|
||||
SafeGetSprite: ; 14236
|
||||
SafeGetSprite:
|
||||
push hl
|
||||
call GetSprite
|
||||
pop hl
|
||||
ret
|
||||
; 1423c
|
||||
|
||||
GetSprite: ; 1423c
|
||||
GetSprite:
|
||||
call GetMonSprite
|
||||
ret c
|
||||
|
||||
@@ -211,10 +199,9 @@ GetSprite: ; 1423c
|
||||
ld l, [hl]
|
||||
ld h, a
|
||||
ret
|
||||
; 14259
|
||||
|
||||
|
||||
GetMonSprite: ; 14259
|
||||
GetMonSprite:
|
||||
; Return carry if a monster sprite was loaded.
|
||||
|
||||
cp SPRITE_POKEMON
|
||||
@@ -275,10 +262,9 @@ GetMonSprite: ; 14259
|
||||
ld h, 0
|
||||
and a
|
||||
ret
|
||||
; 142a7
|
||||
|
||||
|
||||
_DoesSpriteHaveFacings:: ; 142a7
|
||||
_DoesSpriteHaveFacings::
|
||||
; Checks to see whether we can apply a facing to a sprite.
|
||||
; Returns carry unless the sprite is a Pokemon or a Still Sprite.
|
||||
cp SPRITE_POKEMON
|
||||
@@ -303,10 +289,9 @@ _DoesSpriteHaveFacings:: ; 142a7
|
||||
.only_down
|
||||
and a
|
||||
ret
|
||||
; 142c4
|
||||
|
||||
|
||||
_GetSpritePalette:: ; 142c4
|
||||
_GetSpritePalette::
|
||||
ld a, c
|
||||
call GetMonSprite
|
||||
jr c, .is_pokemon
|
||||
@@ -324,18 +309,16 @@ _GetSpritePalette:: ; 142c4
|
||||
xor a
|
||||
ld c, a
|
||||
ret
|
||||
; 142db
|
||||
|
||||
|
||||
LoadAndSortSprites: ; 142db
|
||||
LoadAndSortSprites:
|
||||
call LoadSpriteGFX
|
||||
call SortUsedSprites
|
||||
call ArrangeUsedSprites
|
||||
ret
|
||||
; 142e5
|
||||
|
||||
|
||||
AddSpriteGFX: ; 142e5
|
||||
AddSpriteGFX:
|
||||
; Add any new sprite ids to a list of graphics to be loaded.
|
||||
; Return carry if the list is full.
|
||||
|
||||
@@ -372,10 +355,9 @@ AddSpriteGFX: ; 142e5
|
||||
pop hl
|
||||
and a
|
||||
ret
|
||||
; 14306
|
||||
|
||||
|
||||
LoadSpriteGFX: ; 14306
|
||||
LoadSpriteGFX:
|
||||
; Bug: b is not preserved, so it's useless as a next count.
|
||||
; Uncomment the lines below to fix.
|
||||
|
||||
@@ -401,10 +383,9 @@ LoadSpriteGFX: ; 14306
|
||||
; pop bc
|
||||
ld a, l
|
||||
ret
|
||||
; 1431e
|
||||
|
||||
|
||||
SortUsedSprites: ; 1431e
|
||||
SortUsedSprites:
|
||||
; Bubble-sort sprites by type.
|
||||
|
||||
; Run backwards through wUsedSprites to find the last one.
|
||||
@@ -473,10 +454,9 @@ SortUsedSprites: ; 1431e
|
||||
|
||||
.quit
|
||||
ret
|
||||
; 14355
|
||||
|
||||
|
||||
ArrangeUsedSprites: ; 14355
|
||||
ArrangeUsedSprites:
|
||||
; Get the length of each sprite and space them out in VRAM.
|
||||
; Crystal introduces a second table in VRAM bank 0.
|
||||
|
||||
@@ -533,10 +513,9 @@ ArrangeUsedSprites: ; 14355
|
||||
|
||||
.quit
|
||||
ret
|
||||
; 14386
|
||||
|
||||
|
||||
GetSpriteLength: ; 14386
|
||||
GetSpriteLength:
|
||||
; Return the length of sprite type a in tiles.
|
||||
|
||||
cp WALKING_SPRITE
|
||||
@@ -556,10 +535,9 @@ GetSpriteLength: ; 14386
|
||||
.OneDirection:
|
||||
ld a, 4
|
||||
ret
|
||||
; 1439b
|
||||
|
||||
|
||||
GetUsedSprites: ; 1439b
|
||||
GetUsedSprites:
|
||||
ld hl, wUsedSprites
|
||||
ld c, SPRITE_GFX_LIST_CAPACITY
|
||||
|
||||
@@ -594,9 +572,8 @@ GetUsedSprites: ; 1439b
|
||||
|
||||
.done
|
||||
ret
|
||||
; 143c8
|
||||
|
||||
GetUsedSprite: ; 143c8
|
||||
GetUsedSprite:
|
||||
ld a, [hUsedSpriteIndex]
|
||||
call SafeGetSprite
|
||||
ld a, [hUsedSpriteTile]
|
||||
@@ -639,9 +616,8 @@ endr
|
||||
|
||||
.done
|
||||
ret
|
||||
; 14406
|
||||
|
||||
.GetTileAddr: ; 14406
|
||||
.GetTileAddr:
|
||||
; Return the address of tile (a) in (hl).
|
||||
and $7f
|
||||
ld l, a
|
||||
@@ -656,9 +632,8 @@ endr
|
||||
adc HIGH(vTiles0)
|
||||
ld h, a
|
||||
ret
|
||||
; 14418
|
||||
|
||||
.CopyToVram: ; 14418
|
||||
.CopyToVram:
|
||||
ld a, [rVBK]
|
||||
push af
|
||||
ld a, [wSpriteFlags]
|
||||
@@ -673,9 +648,8 @@ endr
|
||||
pop af
|
||||
ld [rVBK], a
|
||||
ret
|
||||
; 1442f
|
||||
|
||||
LoadEmote:: ; 1442f
|
||||
LoadEmote::
|
||||
; Get the address of the pointer to emote c.
|
||||
ld a, c
|
||||
ld bc, 6 ; sizeof(emote)
|
||||
@@ -703,7 +677,6 @@ LoadEmote:: ; 1442f
|
||||
ret z
|
||||
call GetEmote2bpp
|
||||
ret
|
||||
; 1444d
|
||||
|
||||
|
||||
INCLUDE "data/sprites/emotes.asm"
|
||||
|
@@ -1,4 +1,4 @@
|
||||
DoPlayerMovement:: ; 80000
|
||||
DoPlayerMovement::
|
||||
|
||||
call .GetDPad
|
||||
ld a, movement_step_sleep
|
||||
@@ -30,7 +30,6 @@ DoPlayerMovement:: ; 80000
|
||||
or D_DOWN
|
||||
ld [wCurInput], a
|
||||
ret
|
||||
; 8002d
|
||||
|
||||
.TranslateIntoMovement:
|
||||
ld a, [wPlayerState]
|
||||
@@ -112,9 +111,8 @@ DoPlayerMovement:: ; 80000
|
||||
call .StandInPlace
|
||||
xor a
|
||||
ret
|
||||
; 800b7
|
||||
|
||||
.CheckTile: ; 800b7
|
||||
.CheckTile:
|
||||
; Tiles such as waterfalls and warps move the player
|
||||
; in a given direction, overriding input.
|
||||
|
||||
@@ -227,9 +225,8 @@ DoPlayerMovement:: ; 80000
|
||||
ld a, 5
|
||||
scf
|
||||
ret
|
||||
; 80147
|
||||
|
||||
.CheckTurning: ; 80147
|
||||
.CheckTurning:
|
||||
; If the player is turning, change direction first. This also lets
|
||||
; the player change facing without moving by tapping a direction.
|
||||
|
||||
@@ -257,9 +254,8 @@ DoPlayerMovement:: ; 80000
|
||||
.not_turning
|
||||
xor a
|
||||
ret
|
||||
; 8016b
|
||||
|
||||
.TryStep: ; 8016b
|
||||
.TryStep:
|
||||
|
||||
; Surfing actually calls .TrySurf directly instead of passing through here.
|
||||
ld a, [wPlayerState]
|
||||
@@ -323,9 +319,8 @@ DoPlayerMovement:: ; 80000
|
||||
.bump
|
||||
xor a
|
||||
ret
|
||||
; 801c0
|
||||
|
||||
.TrySurf: ; 801c0
|
||||
.TrySurf:
|
||||
|
||||
call .CheckSurfPerms
|
||||
ld [wd040], a
|
||||
@@ -359,9 +354,8 @@ DoPlayerMovement:: ; 80000
|
||||
.surf_bump
|
||||
xor a
|
||||
ret
|
||||
; 801f3
|
||||
|
||||
.TryJump: ; 801f3
|
||||
.TryJump:
|
||||
ld a, [wPlayerStandingTile]
|
||||
ld e, a
|
||||
and $f0
|
||||
@@ -399,9 +393,8 @@ DoPlayerMovement:: ; 80000
|
||||
db FACE_DOWN | FACE_LEFT ; COLL_HOP_DOWN_LEFT
|
||||
db FACE_UP | FACE_RIGHT ; COLL_HOP_UP_RIGHT
|
||||
db FACE_UP | FACE_LEFT ; COLL_HOP_UP_LEFT
|
||||
; 80226
|
||||
|
||||
.CheckWarp: ; 80226
|
||||
.CheckWarp:
|
||||
|
||||
; Bug: Since no case is made for STANDING here, it will check
|
||||
; [.edgewarps + $ff]. This resolves to $3e at $8035a.
|
||||
@@ -450,7 +443,6 @@ DoPlayerMovement:: ; 80000
|
||||
db COLL_WARP_CARPET_UP
|
||||
db COLL_WARP_CARPET_LEFT
|
||||
db COLL_WARP_CARPET_RIGHT
|
||||
; 8025f
|
||||
|
||||
.DoStep:
|
||||
ld e, a
|
||||
@@ -529,27 +521,24 @@ DoPlayerMovement:: ; 80000
|
||||
db $80 + UP
|
||||
db $80 + LEFT
|
||||
db $80 + RIGHT
|
||||
; 802b3
|
||||
|
||||
.StandInPlace: ; 802b3
|
||||
.StandInPlace:
|
||||
ld a, 0
|
||||
ld [wPlayerTurningDirection], a
|
||||
ld a, movement_step_sleep
|
||||
ld [wMovementAnimation], a
|
||||
xor a
|
||||
ret
|
||||
; 802bf
|
||||
|
||||
._WalkInPlace: ; 802bf
|
||||
._WalkInPlace:
|
||||
ld a, 0
|
||||
ld [wPlayerTurningDirection], a
|
||||
ld a, movement_step_bump
|
||||
ld [wMovementAnimation], a
|
||||
xor a
|
||||
ret
|
||||
; 802cb
|
||||
|
||||
.CheckForced: ; 802cb
|
||||
.CheckForced:
|
||||
; When sliding on ice, input is forced to remain in the same direction.
|
||||
|
||||
call CheckStandingOnIce
|
||||
@@ -572,9 +561,8 @@ DoPlayerMovement:: ; 80000
|
||||
|
||||
.forced_dpad
|
||||
db D_DOWN, D_UP, D_LEFT, D_RIGHT
|
||||
; 802ec
|
||||
|
||||
.GetAction: ; 802ec
|
||||
.GetAction:
|
||||
; Poll player input and update movement info.
|
||||
|
||||
ld hl, .table
|
||||
@@ -631,9 +619,8 @@ DoPlayerMovement:: ; 80000
|
||||
dw wTileUp
|
||||
db DOWN, FACE_DOWN, 0, 1
|
||||
dw wTileDown
|
||||
; 80341
|
||||
|
||||
.CheckNPC: ; 80341
|
||||
.CheckNPC:
|
||||
; Returns 0 if there is an NPC in front that you can't move
|
||||
; Returns 1 if there is no NPC in front
|
||||
; Returns 2 if there is a movable NPC in front
|
||||
@@ -668,9 +655,8 @@ DoPlayerMovement:: ; 80000
|
||||
.no_bump
|
||||
ld a, 2
|
||||
ret
|
||||
; 8036f
|
||||
|
||||
.CheckStrengthBoulder: ; 8036f
|
||||
.CheckStrengthBoulder:
|
||||
|
||||
ld hl, wBikeFlags
|
||||
bit BIKEFLAGS_STRENGTH_ACTIVE_F, [hl]
|
||||
@@ -706,9 +692,8 @@ DoPlayerMovement:: ; 80000
|
||||
.not_boulder
|
||||
xor a
|
||||
ret
|
||||
; 8039e
|
||||
|
||||
.CheckLandPerms: ; 8039e
|
||||
.CheckLandPerms:
|
||||
; Return 0 if walking onto land and tile permissions allow it.
|
||||
; Otherwise, return carry.
|
||||
|
||||
@@ -728,9 +713,8 @@ DoPlayerMovement:: ; 80000
|
||||
.NotWalkable:
|
||||
scf
|
||||
ret
|
||||
; 803b4
|
||||
|
||||
.CheckSurfPerms: ; 803b4
|
||||
.CheckSurfPerms:
|
||||
; Return 0 if moving in water, or 1 if moving onto land.
|
||||
; Otherwise, return carry.
|
||||
|
||||
@@ -750,17 +734,15 @@ DoPlayerMovement:: ; 80000
|
||||
.NotSurfable:
|
||||
scf
|
||||
ret
|
||||
; 803ca
|
||||
|
||||
.BikeCheck: ; 803ca
|
||||
.BikeCheck:
|
||||
ld a, [wPlayerState]
|
||||
cp PLAYER_BIKE
|
||||
ret z
|
||||
cp PLAYER_SKATE
|
||||
ret
|
||||
; 803d3
|
||||
|
||||
.CheckWalkable: ; 803d3
|
||||
.CheckWalkable:
|
||||
; Return 0 if tile a is land. Otherwise, return carry.
|
||||
|
||||
call GetTileCollision
|
||||
@@ -768,9 +750,8 @@ DoPlayerMovement:: ; 80000
|
||||
ret z
|
||||
scf
|
||||
ret
|
||||
; 803da
|
||||
|
||||
.CheckSurfable: ; 803da
|
||||
.CheckSurfable:
|
||||
; Return 0 if tile a is water, or 1 if land.
|
||||
; Otherwise, return carry.
|
||||
|
||||
@@ -796,27 +777,24 @@ DoPlayerMovement:: ; 80000
|
||||
.Neither:
|
||||
scf
|
||||
ret
|
||||
; 803ee
|
||||
|
||||
.BumpSound: ; 803ee
|
||||
.BumpSound:
|
||||
|
||||
call CheckSFX
|
||||
ret c
|
||||
ld de, SFX_BUMP
|
||||
call PlaySFX
|
||||
ret
|
||||
; 803f9
|
||||
|
||||
.GetOutOfWater: ; 803f9
|
||||
.GetOutOfWater:
|
||||
push bc
|
||||
ld a, PLAYER_NORMAL
|
||||
ld [wPlayerState], a
|
||||
call ReplaceKrisSprite ; UpdateSprites
|
||||
pop bc
|
||||
ret
|
||||
; 80404
|
||||
|
||||
CheckStandingOnIce:: ; 80404
|
||||
CheckStandingOnIce::
|
||||
ld a, [wPlayerTurningDirection]
|
||||
cp 0
|
||||
jr z, .not_ice
|
||||
@@ -836,9 +814,8 @@ CheckStandingOnIce:: ; 80404
|
||||
.not_ice
|
||||
and a
|
||||
ret
|
||||
; 80422
|
||||
|
||||
StopPlayerForEvent:: ; 80422
|
||||
StopPlayerForEvent::
|
||||
ld hl, wPlayerNextMovement
|
||||
ld a, movement_step_sleep
|
||||
cp [hl]
|
||||
@@ -848,4 +825,3 @@ StopPlayerForEvent:: ; 80422
|
||||
ld a, 0
|
||||
ld [wPlayerTurningDirection], a
|
||||
ret
|
||||
; 80430
|
||||
|
@@ -1,4 +1,4 @@
|
||||
BlankScreen: ; 8000
|
||||
BlankScreen:
|
||||
call DisableSpriteUpdates
|
||||
xor a
|
||||
ld [hBGMapMode], a
|
||||
@@ -16,7 +16,7 @@ BlankScreen: ; 8000
|
||||
call SetPalettes
|
||||
ret
|
||||
|
||||
SpawnPlayer: ; 8029
|
||||
SpawnPlayer:
|
||||
ld a, -1
|
||||
ld [wObjectFollow_Leader], a
|
||||
ld [wObjectFollow_Follower], a
|
||||
@@ -51,13 +51,13 @@ SpawnPlayer: ; 8029
|
||||
ld [wCenteredObject], a
|
||||
ret
|
||||
|
||||
PlayerObjectTemplate: ; 8071
|
||||
PlayerObjectTemplate:
|
||||
; A dummy map object used to initialize the player object.
|
||||
; Shorter than the actual amount copied by two bytes.
|
||||
; Said bytes seem to be unused.
|
||||
object_event -4, -4, SPRITE_CHRIS, SPRITEMOVEDATA_PLAYER, 15, 15, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, 0, -1
|
||||
|
||||
CopyDECoordsToMapObject:: ; 807e
|
||||
CopyDECoordsToMapObject::
|
||||
push de
|
||||
ld a, b
|
||||
call GetMapObject
|
||||
@@ -70,7 +70,7 @@ CopyDECoordsToMapObject:: ; 807e
|
||||
ld [hl], e
|
||||
ret
|
||||
|
||||
PlayerSpawn_ConvertCoords: ; 808f
|
||||
PlayerSpawn_ConvertCoords:
|
||||
push bc
|
||||
ld a, [wXCoord]
|
||||
add 4
|
||||
@@ -82,7 +82,7 @@ PlayerSpawn_ConvertCoords: ; 808f
|
||||
call CopyDECoordsToMapObject
|
||||
ret
|
||||
|
||||
WriteObjectXY:: ; 80a1
|
||||
WriteObjectXY::
|
||||
ld a, b
|
||||
call CheckObjectVisibility
|
||||
ret c
|
||||
@@ -99,7 +99,7 @@ WriteObjectXY:: ; 80a1
|
||||
and a
|
||||
ret
|
||||
|
||||
RefreshPlayerCoords: ; 80b8
|
||||
RefreshPlayerCoords:
|
||||
ld a, [wXCoord]
|
||||
add 4
|
||||
ld d, a
|
||||
@@ -127,7 +127,7 @@ RefreshPlayerCoords: ; 80b8
|
||||
ret nz ; wtf
|
||||
ret
|
||||
|
||||
CopyObjectStruct:: ; 80e7
|
||||
CopyObjectStruct::
|
||||
call CheckObjectMask
|
||||
and a
|
||||
ret nz ; masked
|
||||
@@ -161,12 +161,12 @@ CopyObjectStruct:: ; 80e7
|
||||
set 5, [hl]
|
||||
ret
|
||||
|
||||
CopyMapObjectToObjectStruct: ; 8116
|
||||
CopyMapObjectToObjectStruct:
|
||||
call .CopyMapObjectToTempObject
|
||||
call CopyTempObjectToObjectStruct
|
||||
ret
|
||||
|
||||
.CopyMapObjectToTempObject: ; 811d
|
||||
.CopyMapObjectToTempObject:
|
||||
ld a, [hObjectStructIndexBuffer]
|
||||
ld hl, MAPOBJECT_OBJECT_STRUCT_ID
|
||||
add hl, bc
|
||||
@@ -223,7 +223,7 @@ CopyMapObjectToObjectStruct: ; 8116
|
||||
ld [wTempObjectCopyRadius], a
|
||||
ret
|
||||
|
||||
InitializeVisibleSprites: ; 8177
|
||||
InitializeVisibleSprites:
|
||||
ld bc, wMapObjects + OBJECT_LENGTH
|
||||
ld a, 1
|
||||
.loop
|
||||
@@ -281,10 +281,10 @@ InitializeVisibleSprites: ; 8177
|
||||
jr nz, .loop
|
||||
ret
|
||||
|
||||
.ret ; 81c9
|
||||
.ret
|
||||
ret
|
||||
|
||||
CheckObjectEnteringVisibleRange:: ; 81ca
|
||||
CheckObjectEnteringVisibleRange::
|
||||
nop
|
||||
ld a, [wPlayerStepDirection]
|
||||
cp STANDING
|
||||
@@ -293,21 +293,21 @@ CheckObjectEnteringVisibleRange:: ; 81ca
|
||||
rst JumpTable
|
||||
ret
|
||||
|
||||
.dw ; 81d6
|
||||
.dw
|
||||
dw .Down
|
||||
dw .Up
|
||||
dw .Left
|
||||
dw .Right
|
||||
|
||||
.Up: ; 81de
|
||||
.Up:
|
||||
ld a, [wYCoord]
|
||||
sub 1
|
||||
jr .Vertical
|
||||
|
||||
.Down: ; 81e5
|
||||
.Down:
|
||||
ld a, [wYCoord]
|
||||
add 9
|
||||
.Vertical: ; 81ea
|
||||
.Vertical:
|
||||
ld d, a
|
||||
ld a, [wXCoord]
|
||||
ld e, a
|
||||
@@ -355,15 +355,15 @@ CheckObjectEnteringVisibleRange:: ; 81ca
|
||||
jr nz, .loop_v
|
||||
ret
|
||||
|
||||
.Left: ; 8232
|
||||
.Left:
|
||||
ld a, [wXCoord]
|
||||
sub 1
|
||||
jr .Horizontal
|
||||
|
||||
.Right: ; 8239
|
||||
.Right:
|
||||
ld a, [wXCoord]
|
||||
add 10
|
||||
.Horizontal: ; 823e
|
||||
.Horizontal:
|
||||
ld e, a
|
||||
ld a, [wYCoord]
|
||||
ld d, a
|
||||
@@ -411,7 +411,7 @@ CheckObjectEnteringVisibleRange:: ; 81ca
|
||||
jr nz, .loop_h
|
||||
ret
|
||||
|
||||
CopyTempObjectToObjectStruct: ; 8286
|
||||
CopyTempObjectToObjectStruct:
|
||||
ld a, [wTempObjectCopyMapObjectIndex]
|
||||
ld hl, OBJECT_MAP_OBJECT_INDEX
|
||||
add hl, de
|
||||
@@ -461,7 +461,7 @@ CopyTempObjectToObjectStruct: ; 8286
|
||||
and a
|
||||
ret
|
||||
|
||||
.InitYCoord: ; 82d5
|
||||
.InitYCoord:
|
||||
ld hl, OBJECT_INIT_Y
|
||||
add hl, de
|
||||
ld [hl], a
|
||||
@@ -481,7 +481,7 @@ CopyTempObjectToObjectStruct: ; 8286
|
||||
ld [hl], a
|
||||
ret
|
||||
|
||||
.InitXCoord: ; 82f1
|
||||
.InitXCoord:
|
||||
ld hl, OBJECT_INIT_X
|
||||
add hl, de
|
||||
ld [hl], a
|
||||
@@ -499,7 +499,7 @@ CopyTempObjectToObjectStruct: ; 8286
|
||||
ld [hl], a
|
||||
ret
|
||||
|
||||
.InitRadius: ; 830d
|
||||
.InitRadius:
|
||||
ld h, a
|
||||
inc a
|
||||
and $f
|
||||
@@ -513,7 +513,7 @@ CopyTempObjectToObjectStruct: ; 8286
|
||||
ld [hl], a
|
||||
ret
|
||||
|
||||
TrainerWalkToPlayer: ; 831e
|
||||
TrainerWalkToPlayer:
|
||||
ld a, [hLastTalked]
|
||||
call InitMovementBuffer
|
||||
ld a, movement_step_sleep
|
||||
@@ -533,7 +533,7 @@ TrainerWalkToPlayer: ; 831e
|
||||
call AppendToMovementBuffer
|
||||
ret
|
||||
|
||||
.GetPathToPlayer: ; 8341
|
||||
.GetPathToPlayer:
|
||||
push de
|
||||
push bc
|
||||
; get player object struct, load to de
|
||||
@@ -577,7 +577,7 @@ TrainerWalkToPlayer: ; 831e
|
||||
call ComputePathToWalkToPlayer
|
||||
ret
|
||||
|
||||
SurfStartStep: ; 8379
|
||||
SurfStartStep:
|
||||
call InitMovementBuffer
|
||||
call .GetMovementData
|
||||
call AppendToMovementBuffer
|
||||
@@ -585,7 +585,7 @@ SurfStartStep: ; 8379
|
||||
call AppendToMovementBuffer
|
||||
ret
|
||||
|
||||
.GetMovementData: ; 8388
|
||||
.GetMovementData:
|
||||
ld a, [wPlayerDirection]
|
||||
srl a
|
||||
srl a
|
||||
@@ -603,7 +603,7 @@ SurfStartStep: ; 8379
|
||||
slow_step LEFT
|
||||
slow_step RIGHT
|
||||
|
||||
FollowNotExact:: ; 839e
|
||||
FollowNotExact::
|
||||
push bc
|
||||
ld a, c
|
||||
call CheckObjectVisibility
|
||||
@@ -690,7 +690,7 @@ FollowNotExact:: ; 839e
|
||||
ld [hl], STEP_TYPE_00
|
||||
ret
|
||||
|
||||
GetRelativeFacing:: ; 8417
|
||||
GetRelativeFacing::
|
||||
; Determines which way map object e would have to turn to face map object d. Returns carry if it's impossible for whatever reason.
|
||||
ld a, d
|
||||
call GetMapObject
|
||||
@@ -715,7 +715,7 @@ GetRelativeFacing:: ; 8417
|
||||
scf
|
||||
ret
|
||||
|
||||
.GetFacing_e_relativeto_d: ; 8439
|
||||
.GetFacing_e_relativeto_d:
|
||||
; Determines which way object e would have to turn to face object d. Returns carry if it's impossible.
|
||||
; load the coordinates of object d into bc
|
||||
ld a, d
|
||||
@@ -796,7 +796,7 @@ GetRelativeFacing:: ; 8417
|
||||
scf
|
||||
ret
|
||||
|
||||
QueueFollowerFirstStep: ; 848a
|
||||
QueueFollowerFirstStep:
|
||||
call .QueueFirstStep
|
||||
jr c, .same
|
||||
ld [wFollowMovementQueue], a
|
||||
|
@@ -1,4 +1,4 @@
|
||||
_HandlePlayerStep:: ; d497 (3:5497)
|
||||
_HandlePlayerStep::
|
||||
ld a, [wPlayerStepFlags]
|
||||
and a
|
||||
ret z
|
||||
@@ -34,7 +34,7 @@ _HandlePlayerStep:: ; d497 (3:5497)
|
||||
ld [wPlayerBGMapOffsetY], a
|
||||
ret
|
||||
|
||||
ScrollScreen:: ; d4d2 (3:54d2)
|
||||
ScrollScreen::
|
||||
ld a, [wPlayerStepVectorX]
|
||||
ld d, a
|
||||
ld a, [wPlayerStepVectorY]
|
||||
@@ -47,7 +47,7 @@ ScrollScreen:: ; d4d2 (3:54d2)
|
||||
ld [hSCY], a
|
||||
ret
|
||||
|
||||
HandlePlayerStep: ; d4e5 (3:54e5)
|
||||
HandlePlayerStep:
|
||||
ld hl, wHandlePlayerStep
|
||||
ld a, [hl]
|
||||
and a
|
||||
@@ -58,7 +58,7 @@ HandlePlayerStep: ; d4e5 (3:54e5)
|
||||
rst JumpTable
|
||||
ret
|
||||
|
||||
.Jumptable: ; d4f2 (3:54f2)
|
||||
.Jumptable:
|
||||
dw GetMovementPermissions
|
||||
dw BufferScreen
|
||||
dw .mobile
|
||||
@@ -72,17 +72,17 @@ HandlePlayerStep: ; d4e5 (3:54e5)
|
||||
dw .fail1
|
||||
dw .fail1
|
||||
|
||||
.fail1 ; d508 (3:5508)
|
||||
.fail1
|
||||
ret
|
||||
|
||||
.mobile ; d509 (3:5509)
|
||||
.mobile
|
||||
farcall StubbedTrainerRankings_StepCount
|
||||
ret
|
||||
|
||||
.fail2 ; d510 (3:5510)
|
||||
.fail2
|
||||
ret
|
||||
|
||||
UpdatePlayerCoords: ; d511 (3:5511)
|
||||
UpdatePlayerCoords:
|
||||
ld a, [wPlayerStepDirection]
|
||||
and a
|
||||
jr nz, .check_step_down
|
||||
@@ -111,7 +111,7 @@ UpdatePlayerCoords: ; d511 (3:5511)
|
||||
inc [hl]
|
||||
ret
|
||||
|
||||
UpdateOverworldMap: ; d536 (3:5536)
|
||||
UpdateOverworldMap:
|
||||
ld a, [wPlayerStepDirection]
|
||||
and a
|
||||
jr z, .step_down
|
||||
@@ -147,7 +147,7 @@ UpdateOverworldMap: ; d536 (3:5536)
|
||||
call ScrollMapLeft
|
||||
ret
|
||||
|
||||
.ScrollOverworldMapDown: ; d571 (3:5571)
|
||||
.ScrollOverworldMapDown:
|
||||
ld a, [wBGMapAnchor]
|
||||
add 2 * BG_MAP_WIDTH
|
||||
ld [wBGMapAnchor], a
|
||||
@@ -168,7 +168,7 @@ UpdateOverworldMap: ; d536 (3:5536)
|
||||
.done_down
|
||||
ret
|
||||
|
||||
.Add6ToOverworldMapAnchor: ; d595 (3:5595)
|
||||
.Add6ToOverworldMapAnchor:
|
||||
ld hl, wOverworldMapAnchor
|
||||
ld a, [wMapWidth]
|
||||
add 6
|
||||
@@ -178,7 +178,7 @@ UpdateOverworldMap: ; d536 (3:5536)
|
||||
inc [hl]
|
||||
ret
|
||||
|
||||
.ScrollOverworldMapUp: ; d5a2 (3:55a2)
|
||||
.ScrollOverworldMapUp:
|
||||
ld a, [wBGMapAnchor]
|
||||
sub 2 * BG_MAP_WIDTH
|
||||
ld [wBGMapAnchor], a
|
||||
@@ -199,7 +199,7 @@ UpdateOverworldMap: ; d536 (3:5536)
|
||||
.done_up
|
||||
ret
|
||||
|
||||
.Sub6FromOverworldMapAnchor: ; d5c6 (3:55c6)
|
||||
.Sub6FromOverworldMapAnchor:
|
||||
ld hl, wOverworldMapAnchor
|
||||
ld a, [wMapWidth]
|
||||
add 6
|
||||
@@ -211,7 +211,7 @@ UpdateOverworldMap: ; d536 (3:5536)
|
||||
dec [hl]
|
||||
ret
|
||||
|
||||
.ScrollOverworldMapLeft: ; d5d5 (3:55d5)
|
||||
.ScrollOverworldMapLeft:
|
||||
ld a, [wBGMapAnchor]
|
||||
ld e, a
|
||||
and $e0
|
||||
@@ -231,7 +231,7 @@ UpdateOverworldMap: ; d536 (3:5536)
|
||||
.done_left
|
||||
ret
|
||||
|
||||
.DecrementwOverworldMapAnchor: ; d5f4 (3:55f4)
|
||||
.DecrementwOverworldMapAnchor:
|
||||
ld hl, wOverworldMapAnchor
|
||||
ld a, [hl]
|
||||
sub 1
|
||||
@@ -240,7 +240,7 @@ UpdateOverworldMap: ; d536 (3:5536)
|
||||
dec [hl]
|
||||
ret
|
||||
|
||||
.ScrollOverworldMapRight: ; d5fe (3:55fe)
|
||||
.ScrollOverworldMapRight:
|
||||
ld a, [wBGMapAnchor]
|
||||
ld e, a
|
||||
and $e0
|
||||
@@ -260,7 +260,7 @@ UpdateOverworldMap: ; d536 (3:5536)
|
||||
.done_right
|
||||
ret
|
||||
|
||||
.IncrementwOverworldMapAnchor: ; d61d (3:561d)
|
||||
.IncrementwOverworldMapAnchor:
|
||||
ld hl, wOverworldMapAnchor
|
||||
ld a, [hl]
|
||||
add 1
|
||||
|
@@ -1,4 +1,4 @@
|
||||
SelectMenu:: ; 13327
|
||||
SelectMenu::
|
||||
|
||||
call CheckRegisteredItem
|
||||
jr c, .NotRegistered
|
||||
@@ -11,16 +11,14 @@ SelectMenu:: ; 13327
|
||||
call MapTextbox
|
||||
call WaitButton
|
||||
jp CloseText
|
||||
; 13340
|
||||
|
||||
|
||||
ItemMayBeRegisteredText: ; 13340
|
||||
ItemMayBeRegisteredText:
|
||||
text_jump UnknownText_0x1c1cf3
|
||||
db "@"
|
||||
; 13345
|
||||
|
||||
|
||||
CheckRegisteredItem: ; 13345
|
||||
CheckRegisteredItem:
|
||||
|
||||
ld a, [wWhichRegisteredItem]
|
||||
and a
|
||||
@@ -86,10 +84,9 @@ CheckRegisteredItem: ; 13345
|
||||
ld [wRegisteredItem], a
|
||||
scf
|
||||
ret
|
||||
; 133a6
|
||||
|
||||
|
||||
.CheckRegisteredNo: ; 133a6
|
||||
.CheckRegisteredNo:
|
||||
ld a, [wWhichRegisteredItem]
|
||||
and REGISTERED_NUMBER
|
||||
dec a
|
||||
@@ -102,10 +99,9 @@ CheckRegisteredItem: ; 13345
|
||||
.NotEnoughItems:
|
||||
scf
|
||||
ret
|
||||
; 133b6
|
||||
|
||||
|
||||
.IsSameItem: ; 133b6
|
||||
.IsSameItem:
|
||||
ld a, [wRegisteredItem]
|
||||
cp [hl]
|
||||
jr nz, .NotSameItem
|
||||
@@ -116,10 +112,9 @@ CheckRegisteredItem: ; 13345
|
||||
.NotSameItem:
|
||||
scf
|
||||
ret
|
||||
; 133c3
|
||||
|
||||
|
||||
UseRegisteredItem: ; 133c3
|
||||
UseRegisteredItem:
|
||||
|
||||
farcall CheckItemMenu
|
||||
ld a, [wItemAttributeParamBuffer]
|
||||
@@ -136,25 +131,22 @@ UseRegisteredItem: ; 133c3
|
||||
dw .Current
|
||||
dw .Party
|
||||
dw .Overworld
|
||||
; 133df
|
||||
|
||||
.NoFunction: ; 133df
|
||||
.NoFunction:
|
||||
call OpenText
|
||||
call CantUseItem
|
||||
call CloseText
|
||||
and a
|
||||
ret
|
||||
; 133ea
|
||||
|
||||
.Current: ; 133ea
|
||||
.Current:
|
||||
call OpenText
|
||||
call DoItemEffect
|
||||
call CloseText
|
||||
and a
|
||||
ret
|
||||
; 133f5
|
||||
|
||||
.Party: ; 133f5
|
||||
.Party:
|
||||
call RefreshScreen
|
||||
call FadeToMenu
|
||||
call DoItemEffect
|
||||
@@ -162,9 +154,8 @@ UseRegisteredItem: ; 133c3
|
||||
call CloseText
|
||||
and a
|
||||
ret
|
||||
; 13406
|
||||
|
||||
.Overworld: ; 13406
|
||||
.Overworld:
|
||||
call RefreshScreen
|
||||
ld a, 1
|
||||
ld [wUsingItemWithSelect], a
|
||||
@@ -178,9 +169,8 @@ UseRegisteredItem: ; 133c3
|
||||
ld a, HMENURETURN_SCRIPT
|
||||
ld [hMenuReturn], a
|
||||
ret
|
||||
; 13422
|
||||
|
||||
.CantUse: ; 13422
|
||||
.CantUse:
|
||||
call RefreshScreen
|
||||
|
||||
._cantuse
|
||||
@@ -188,4 +178,3 @@ UseRegisteredItem: ; 133c3
|
||||
call CloseText
|
||||
and a
|
||||
ret
|
||||
; 1342d
|
||||
|
@@ -1,7 +1,7 @@
|
||||
INCLUDE "data/maps/spawn_points.asm"
|
||||
|
||||
|
||||
LoadSpawnPoint: ; 1531f
|
||||
LoadSpawnPoint:
|
||||
; loads the spawn point in wDefaultSpawnpoint
|
||||
push hl
|
||||
push de
|
||||
@@ -26,10 +26,9 @@ LoadSpawnPoint: ; 1531f
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
; 15344
|
||||
|
||||
|
||||
IsSpawnPoint: ; 15344
|
||||
IsSpawnPoint:
|
||||
; Checks if the map loaded in de is a spawn point. Returns carry if it's a spawn point.
|
||||
ld hl, SpawnPoints
|
||||
ld c, 0
|
||||
@@ -59,4 +58,3 @@ IsSpawnPoint: ; 15344
|
||||
.yes
|
||||
scf
|
||||
ret
|
||||
; 15363
|
||||
|
@@ -1,4 +1,4 @@
|
||||
CheckWarpCollision:: ; 1499a
|
||||
CheckWarpCollision::
|
||||
; Is this tile a warp?
|
||||
ld a, [wPlayerStandingTile]
|
||||
cp COLL_PIT
|
||||
@@ -14,9 +14,8 @@ CheckWarpCollision:: ; 1499a
|
||||
.warp
|
||||
scf
|
||||
ret
|
||||
; 149af
|
||||
|
||||
CheckDirectionalWarp:: ; 149af
|
||||
CheckDirectionalWarp::
|
||||
; If this is a directional warp, clear carry (press the designated button to warp).
|
||||
; Else, set carry (immediate warp).
|
||||
ld a, [wPlayerStandingTile]
|
||||
@@ -34,17 +33,15 @@ CheckDirectionalWarp:: ; 149af
|
||||
.directional
|
||||
xor a
|
||||
ret
|
||||
; 149c6
|
||||
|
||||
CheckWarpFacingDown: ; 149c6
|
||||
CheckWarpFacingDown:
|
||||
ld de, 1
|
||||
ld hl, .blocks
|
||||
ld a, [wPlayerStandingTile]
|
||||
call IsInArray
|
||||
ret
|
||||
; 149d3
|
||||
|
||||
.blocks ; 149d3
|
||||
.blocks
|
||||
db COLL_DOOR
|
||||
db COLL_DOOR_79
|
||||
db COLL_STAIRCASE
|
||||
@@ -55,17 +52,15 @@ CheckWarpFacingDown: ; 149c6
|
||||
db COLL_DOOR_75
|
||||
db COLL_DOOR_7D
|
||||
db -1
|
||||
; 149dd
|
||||
|
||||
CheckGrassCollision:: ; 149dd
|
||||
CheckGrassCollision::
|
||||
ld a, [wPlayerStandingTile]
|
||||
ld hl, .blocks
|
||||
ld de, 1
|
||||
call IsInArray
|
||||
ret
|
||||
; 149ea
|
||||
|
||||
.blocks ; 149ea
|
||||
.blocks
|
||||
db COLL_CUT_08
|
||||
db COLL_TALL_GRASS
|
||||
db COLL_LONG_GRASS
|
||||
@@ -77,17 +72,15 @@ CheckGrassCollision:: ; 149dd
|
||||
db COLL_GRASS_4B
|
||||
db COLL_GRASS_4C
|
||||
db -1
|
||||
; 149f5
|
||||
|
||||
CheckCutCollision: ; 149f5
|
||||
CheckCutCollision:
|
||||
ld a, c
|
||||
ld hl, .blocks
|
||||
ld de, 1
|
||||
call IsInArray
|
||||
ret
|
||||
; 14a00
|
||||
|
||||
.blocks ; 14a00
|
||||
.blocks
|
||||
db COLL_CUT_TREE
|
||||
db COLL_CUT_TREE_1A
|
||||
db COLL_TALL_GRASS_10
|
||||
@@ -95,9 +88,8 @@ CheckCutCollision: ; 149f5
|
||||
db COLL_LONG_GRASS
|
||||
db COLL_LONG_GRASS_1C
|
||||
db -1
|
||||
; 14a07
|
||||
|
||||
GetWarpSFX:: ; 14a07
|
||||
GetWarpSFX::
|
||||
ld a, [wPlayerStandingTile]
|
||||
ld de, SFX_ENTER_DOOR
|
||||
cp COLL_DOOR
|
||||
@@ -107,4 +99,3 @@ GetWarpSFX:: ; 14a07
|
||||
ret z
|
||||
ld de, SFX_EXIT_BUILDING
|
||||
ret
|
||||
; 14a1a
|
||||
|
@@ -1,21 +1,19 @@
|
||||
_InitializeStartDay: ; 113d6
|
||||
_InitializeStartDay:
|
||||
call InitializeStartDay
|
||||
ret
|
||||
; 113da
|
||||
|
||||
ClearDailyTimers: ; 113da
|
||||
ClearDailyTimers:
|
||||
xor a
|
||||
ld [wLuckyNumberDayBuffer], a
|
||||
ld [wUnusedTwoDayTimer], a
|
||||
ld [wDailyResetTimer], a
|
||||
ret
|
||||
; 113e5
|
||||
|
||||
InitCallReceiveDelay:: ; 113e5
|
||||
InitCallReceiveDelay::
|
||||
xor a
|
||||
ld [wTimeCyclesSinceLastCall], a
|
||||
|
||||
NextCallReceiveDelay: ; 113e9
|
||||
NextCallReceiveDelay:
|
||||
ld a, [wTimeCyclesSinceLastCall]
|
||||
cp 3
|
||||
jr c, .okay
|
||||
@@ -28,13 +26,11 @@ NextCallReceiveDelay: ; 113e9
|
||||
add hl, de
|
||||
ld a, [hl]
|
||||
jp RestartReceiveCallDelay
|
||||
; 113fd
|
||||
|
||||
.ReceiveCallDelays:
|
||||
db 20, 10, 5, 3
|
||||
; 11401
|
||||
|
||||
CheckReceiveCallTimer: ; 11401
|
||||
CheckReceiveCallTimer:
|
||||
call CheckReceiveCallDelay ; check timer
|
||||
ret nc
|
||||
ld hl, wTimeCyclesSinceLastCall
|
||||
@@ -47,12 +43,11 @@ CheckReceiveCallTimer: ; 11401
|
||||
call NextCallReceiveDelay ; restart timer
|
||||
scf
|
||||
ret
|
||||
; 11413
|
||||
|
||||
InitOneDayCountdown: ; 11413
|
||||
InitOneDayCountdown:
|
||||
ld a, 1
|
||||
|
||||
InitNDaysCountdown: ; 11415
|
||||
InitNDaysCountdown:
|
||||
ld [hl], a
|
||||
push hl
|
||||
call UpdateTime
|
||||
@@ -60,9 +55,8 @@ InitNDaysCountdown: ; 11415
|
||||
inc hl
|
||||
call CopyDayToHL
|
||||
ret
|
||||
; 11420
|
||||
|
||||
CheckDayDependentEventHL: ; 11420
|
||||
CheckDayDependentEventHL:
|
||||
inc hl
|
||||
push hl
|
||||
call CalcDaysSince
|
||||
@@ -71,32 +65,28 @@ CheckDayDependentEventHL: ; 11420
|
||||
dec hl
|
||||
call UpdateTimeRemaining
|
||||
ret
|
||||
; 1142e
|
||||
|
||||
RestartReceiveCallDelay: ; 1142e
|
||||
RestartReceiveCallDelay:
|
||||
ld hl, wReceiveCallDelay_MinsRemaining
|
||||
ld [hl], a
|
||||
call UpdateTime
|
||||
ld hl, wReceiveCallDelay_StartTime
|
||||
call CopyDayHourMinToHL
|
||||
ret
|
||||
; 1143c
|
||||
|
||||
CheckReceiveCallDelay: ; 1143c
|
||||
CheckReceiveCallDelay:
|
||||
ld hl, wReceiveCallDelay_StartTime
|
||||
call CalcMinsHoursDaysSince
|
||||
call GetMinutesSinceIfLessThan60
|
||||
ld hl, wReceiveCallDelay_MinsRemaining
|
||||
call UpdateTimeRemaining
|
||||
ret
|
||||
; 1144c
|
||||
|
||||
RestartDailyResetTimer: ; 1144c
|
||||
RestartDailyResetTimer:
|
||||
ld hl, wDailyResetTimer
|
||||
jp InitOneDayCountdown
|
||||
; 11452
|
||||
|
||||
CheckDailyResetTimer:: ; 11452
|
||||
CheckDailyResetTimer::
|
||||
ld hl, wDailyResetTimer
|
||||
call CheckDayDependentEventHL
|
||||
ret nc
|
||||
@@ -128,18 +118,16 @@ endr
|
||||
call SampleKenjiBreakCountdown
|
||||
.DontRestartKenjiBreakCountdown:
|
||||
jr RestartDailyResetTimer
|
||||
; 11485
|
||||
|
||||
SampleKenjiBreakCountdown: ; 11485
|
||||
SampleKenjiBreakCountdown:
|
||||
; Generate a random number between 3 and 6
|
||||
call Random
|
||||
and %11
|
||||
add 3
|
||||
ld [wKenjiBreakTimer], a
|
||||
ret
|
||||
; 11490
|
||||
|
||||
StartBugContestTimer: ; 11490
|
||||
StartBugContestTimer:
|
||||
ld a, BUG_CONTEST_MINUTES
|
||||
ld [wBugContestMinsRemaining], a
|
||||
ld a, BUG_CONTEST_SECONDS
|
||||
@@ -148,10 +136,9 @@ StartBugContestTimer: ; 11490
|
||||
ld hl, wBugContestStartTime
|
||||
call CopyDayHourMinSecToHL
|
||||
ret
|
||||
; 114a4
|
||||
|
||||
|
||||
CheckBugContestTimer:: ; 114a4 (4:54a4)
|
||||
CheckBugContestTimer::
|
||||
ld hl, wBugContestStartTime
|
||||
call CalcSecsMinsHoursDaysSince
|
||||
ld a, [wDaysSince]
|
||||
@@ -186,14 +173,13 @@ CheckBugContestTimer:: ; 114a4 (4:54a4)
|
||||
ret
|
||||
|
||||
|
||||
InitializeStartDay: ; 114dd
|
||||
InitializeStartDay:
|
||||
call UpdateTime
|
||||
ld hl, wTimerEventStartDay
|
||||
call CopyDayToHL
|
||||
ret
|
||||
; 114e7
|
||||
|
||||
CheckPokerusTick:: ; 114e7
|
||||
CheckPokerusTick::
|
||||
ld hl, wTimerEventStartDay
|
||||
call CalcDaysSince
|
||||
call GetDaysSince
|
||||
@@ -204,9 +190,8 @@ CheckPokerusTick:: ; 114e7
|
||||
.done
|
||||
xor a
|
||||
ret
|
||||
; 114fc
|
||||
|
||||
SetUnusedTwoDayTimer: ; 114fc
|
||||
SetUnusedTwoDayTimer:
|
||||
ld a, 2
|
||||
ld hl, wUnusedTwoDayTimer
|
||||
ld [hl], a
|
||||
@@ -214,22 +199,19 @@ SetUnusedTwoDayTimer: ; 114fc
|
||||
ld hl, wUnusedTwoDayTimerStartDate
|
||||
call CopyDayToHL
|
||||
ret
|
||||
; 1150c
|
||||
|
||||
CheckUnusedTwoDayTimer: ; 1150c
|
||||
CheckUnusedTwoDayTimer:
|
||||
ld hl, wUnusedTwoDayTimerStartDate
|
||||
call CalcDaysSince
|
||||
call GetDaysSince
|
||||
ld hl, wUnusedTwoDayTimer
|
||||
call UpdateTimeRemaining
|
||||
ret
|
||||
; 1151c
|
||||
|
||||
; unused
|
||||
ld hl, wDailyFlags
|
||||
set DAILYFLAGS_FISH_SWARM_F, [hl]
|
||||
ret
|
||||
; 11522
|
||||
|
||||
; unused
|
||||
and a
|
||||
@@ -238,15 +220,13 @@ CheckUnusedTwoDayTimer: ; 1150c
|
||||
ret nz
|
||||
scf
|
||||
ret
|
||||
; 1152b
|
||||
|
||||
RestartLuckyNumberCountdown: ; 1152b
|
||||
RestartLuckyNumberCountdown:
|
||||
call .GetDaysUntilNextFriday
|
||||
ld hl, wLuckyNumberDayBuffer
|
||||
jp InitNDaysCountdown
|
||||
; 11534
|
||||
|
||||
.GetDaysUntilNextFriday: ; 11534
|
||||
.GetDaysUntilNextFriday:
|
||||
call GetWeekday
|
||||
ld c, a
|
||||
ld a, FRIDAY
|
||||
@@ -259,14 +239,12 @@ RestartLuckyNumberCountdown: ; 1152b
|
||||
|
||||
.earlier
|
||||
ret
|
||||
; 11542
|
||||
|
||||
_CheckLuckyNumberShowFlag: ; 11542
|
||||
_CheckLuckyNumberShowFlag:
|
||||
ld hl, wLuckyNumberDayBuffer
|
||||
jp CheckDayDependentEventHL
|
||||
; 11548
|
||||
|
||||
DoMysteryGiftIfDayHasPassed: ; 11548
|
||||
DoMysteryGiftIfDayHasPassed:
|
||||
ld a, BANK(sMysteryGiftTimer)
|
||||
call GetSRAMBank
|
||||
ld hl, sMysteryGiftTimer
|
||||
@@ -294,9 +272,8 @@ DoMysteryGiftIfDayHasPassed: ; 11548
|
||||
ld [sMysteryGiftTimer + 1], a
|
||||
call CloseSRAM
|
||||
ret
|
||||
; 11586
|
||||
|
||||
UpdateTimeRemaining: ; 11586
|
||||
UpdateTimeRemaining:
|
||||
; If the amount of time elapsed exceeds the capacity of its
|
||||
; unit, skip this part.
|
||||
cp -1
|
||||
@@ -318,9 +295,8 @@ UpdateTimeRemaining: ; 11586
|
||||
ld [hl], a
|
||||
scf
|
||||
ret
|
||||
; 11599
|
||||
|
||||
GetSecondsSinceIfLessThan60: ; 11599
|
||||
GetSecondsSinceIfLessThan60:
|
||||
ld a, [wDaysSince]
|
||||
and a
|
||||
jr nz, GetTimeElapsed_ExceedsUnitLimit
|
||||
@@ -331,9 +307,8 @@ GetSecondsSinceIfLessThan60: ; 11599
|
||||
jr nz, GetTimeElapsed_ExceedsUnitLimit
|
||||
ld a, [wSecondsSince]
|
||||
ret
|
||||
; 115ae
|
||||
|
||||
GetMinutesSinceIfLessThan60: ; 115ae
|
||||
GetMinutesSinceIfLessThan60:
|
||||
ld a, [wDaysSince]
|
||||
and a
|
||||
jr nz, GetTimeElapsed_ExceedsUnitLimit
|
||||
@@ -342,45 +317,38 @@ GetMinutesSinceIfLessThan60: ; 115ae
|
||||
jr nz, GetTimeElapsed_ExceedsUnitLimit
|
||||
ld a, [wMinutesSince]
|
||||
ret
|
||||
; 115be
|
||||
|
||||
GetHoursSinceIfLessThan24: ; 115be
|
||||
GetHoursSinceIfLessThan24:
|
||||
ld a, [wDaysSince]
|
||||
and a
|
||||
jr nz, GetTimeElapsed_ExceedsUnitLimit
|
||||
ld a, [wHoursSince]
|
||||
ret
|
||||
; 115c8
|
||||
|
||||
GetDaysSince: ; 115c8
|
||||
GetDaysSince:
|
||||
ld a, [wDaysSince]
|
||||
ret
|
||||
; 115cc
|
||||
|
||||
GetTimeElapsed_ExceedsUnitLimit: ; 115cc
|
||||
GetTimeElapsed_ExceedsUnitLimit:
|
||||
ld a, -1
|
||||
ret
|
||||
; 115cf
|
||||
|
||||
CalcDaysSince: ; 115cf
|
||||
CalcDaysSince:
|
||||
xor a
|
||||
jr _CalcDaysSince
|
||||
; 115d2
|
||||
|
||||
CalcHoursDaysSince: ; 115d2
|
||||
CalcHoursDaysSince:
|
||||
inc hl
|
||||
xor a
|
||||
jr _CalcHoursDaysSince
|
||||
; 115d6
|
||||
|
||||
CalcMinsHoursDaysSince: ; 115d6
|
||||
CalcMinsHoursDaysSince:
|
||||
inc hl
|
||||
inc hl
|
||||
xor a
|
||||
jr _CalcMinsHoursDaysSince
|
||||
; 115db
|
||||
|
||||
CalcSecsMinsHoursDaysSince: ; 115db
|
||||
CalcSecsMinsHoursDaysSince:
|
||||
inc hl
|
||||
inc hl
|
||||
inc hl
|
||||
@@ -394,7 +362,7 @@ CalcSecsMinsHoursDaysSince: ; 115db
|
||||
dec hl
|
||||
ld [wSecondsSince], a ; seconds since
|
||||
|
||||
_CalcMinsHoursDaysSince: ; 115eb
|
||||
_CalcMinsHoursDaysSince:
|
||||
ld a, [hMinutes]
|
||||
ld c, a
|
||||
sbc [hl]
|
||||
@@ -405,7 +373,7 @@ _CalcMinsHoursDaysSince: ; 115eb
|
||||
dec hl
|
||||
ld [wMinutesSince], a ; minutes since
|
||||
|
||||
_CalcHoursDaysSince: ; 115f8
|
||||
_CalcHoursDaysSince:
|
||||
ld a, [hHours]
|
||||
ld c, a
|
||||
sbc [hl]
|
||||
@@ -426,9 +394,8 @@ _CalcDaysSince:
|
||||
ld [hl], c ; current days
|
||||
ld [wDaysSince], a ; days since
|
||||
ret
|
||||
; 11613
|
||||
|
||||
CopyDayHourMinSecToHL: ; 11613
|
||||
CopyDayHourMinSecToHL:
|
||||
ld a, [wCurDay]
|
||||
ld [hli], a
|
||||
ld a, [hHours]
|
||||
@@ -438,23 +405,20 @@ CopyDayHourMinSecToHL: ; 11613
|
||||
ld a, [hSeconds]
|
||||
ld [hli], a
|
||||
ret
|
||||
; 11621
|
||||
|
||||
CopyDayToHL: ; 11621
|
||||
CopyDayToHL:
|
||||
ld a, [wCurDay]
|
||||
ld [hl], a
|
||||
ret
|
||||
; 11626
|
||||
|
||||
CopyDayHourToHL: ; 11626
|
||||
CopyDayHourToHL:
|
||||
ld a, [wCurDay]
|
||||
ld [hli], a
|
||||
ld a, [hHours]
|
||||
ld [hli], a
|
||||
ret
|
||||
; 1162e
|
||||
|
||||
CopyDayHourMinToHL: ; 1162e
|
||||
CopyDayHourMinToHL:
|
||||
ld a, [wCurDay]
|
||||
ld [hli], a
|
||||
ld a, [hHours]
|
||||
@@ -462,4 +426,3 @@ CopyDayHourMinToHL: ; 1162e
|
||||
ld a, [hMinutes]
|
||||
ld [hli], a
|
||||
ret
|
||||
; 11639
|
||||
|
@@ -1,4 +1,4 @@
|
||||
_GetVarAction:: ; 80648 (20:4648)
|
||||
_GetVarAction::
|
||||
ld a, c
|
||||
cp NUM_VARS
|
||||
jr c, .valid
|
||||
@@ -28,13 +28,12 @@ _GetVarAction:: ; 80648 (20:4648)
|
||||
call _de_
|
||||
ret
|
||||
|
||||
.loadstringbuffer2 ; 8066c (20:466c)
|
||||
.loadstringbuffer2
|
||||
ld de, wStringBuffer2
|
||||
ld [de], a
|
||||
ret
|
||||
; 80671 (20:4671)
|
||||
|
||||
.VarActionTable: ; 80671
|
||||
.VarActionTable:
|
||||
; entries correspond to VAR_* constants
|
||||
; RETVAR_STRBUF2: copy [de] to wStringBuffer2
|
||||
; RETVAR_ADDR_DE: return address in de
|
||||
@@ -67,51 +66,45 @@ _GetVarAction:: ; 80648 (20:4648)
|
||||
dwb wBuenasPassword, RETVAR_ADDR_DE
|
||||
dwb wKenjiBreakTimer, RETVAR_STRBUF2
|
||||
dwb NULL, RETVAR_STRBUF2
|
||||
; 806c5
|
||||
|
||||
.CountCaughtMons: ; 806c5
|
||||
.CountCaughtMons:
|
||||
; Caught mons.
|
||||
ld hl, wPokedexCaught
|
||||
ld b, wEndPokedexCaught - wPokedexCaught
|
||||
call CountSetBits
|
||||
ld a, [wd265]
|
||||
jp .loadstringbuffer2
|
||||
; 806d3
|
||||
|
||||
.CountSeenMons: ; 806d3
|
||||
.CountSeenMons:
|
||||
; Seen mons.
|
||||
ld hl, wPokedexSeen
|
||||
ld b, wEndPokedexSeen - wPokedexSeen
|
||||
call CountSetBits
|
||||
ld a, [wd265]
|
||||
jp .loadstringbuffer2
|
||||
; 806e1
|
||||
|
||||
.CountBadges: ; 806e1
|
||||
.CountBadges:
|
||||
; Number of owned badges.
|
||||
ld hl, wBadges
|
||||
ld b, 2
|
||||
call CountSetBits
|
||||
ld a, [wd265]
|
||||
jp .loadstringbuffer2
|
||||
; 806ef
|
||||
|
||||
.PlayerFacing: ; 806ef
|
||||
.PlayerFacing:
|
||||
; The direction the player is facing.
|
||||
ld a, [wPlayerDirection]
|
||||
and $c
|
||||
rrca
|
||||
rrca
|
||||
jp .loadstringbuffer2
|
||||
; 806f9
|
||||
|
||||
.DayOfWeek: ; 806f9
|
||||
.DayOfWeek:
|
||||
; The day of the week.
|
||||
call GetWeekday
|
||||
jp .loadstringbuffer2
|
||||
; 806ff
|
||||
|
||||
.UnownCaught: ; 806ff
|
||||
.UnownCaught:
|
||||
; Number of unique Unown caught.
|
||||
call .count
|
||||
ld a, b
|
||||
@@ -129,9 +122,8 @@ _GetVarAction:: ; 80648 (20:4648)
|
||||
cp NUM_UNOWN
|
||||
jr c, .loop
|
||||
ret
|
||||
; 80715
|
||||
|
||||
.BoxFreeSpace: ; 80715
|
||||
.BoxFreeSpace:
|
||||
; Remaining slots in the current box.
|
||||
ld a, BANK(sBoxCount)
|
||||
call GetSRAMBank
|
||||
@@ -142,10 +134,8 @@ _GetVarAction:: ; 80648 (20:4648)
|
||||
call CloseSRAM
|
||||
ld a, b
|
||||
jp .loadstringbuffer2
|
||||
; 80728
|
||||
|
||||
.BattleResult: ; 80728
|
||||
.BattleResult:
|
||||
ld a, [wBattleResult]
|
||||
and $ff ^ BATTLERESULT_BITMASK
|
||||
jp .loadstringbuffer2
|
||||
; 80730
|
||||
|
@@ -1,5 +1,5 @@
|
||||
|
||||
HandleNewMap: ; 1045b0
|
||||
HandleNewMap:
|
||||
call Clearwc7e8
|
||||
call ResetMapBufferEventFlags
|
||||
call ResetFlashIfOutOfCave
|
||||
@@ -7,7 +7,7 @@ HandleNewMap: ; 1045b0
|
||||
call ResetBikeFlags
|
||||
ld a, MAPCALLBACK_NEWMAP
|
||||
call RunMapCallback
|
||||
InitCommandQueue: ; 1045c4
|
||||
InitCommandQueue:
|
||||
farcall ClearCmdQueue
|
||||
ld a, MAPCALLBACK_CMDQUEUE
|
||||
call RunMapCallback
|
||||
@@ -16,7 +16,7 @@ InitCommandQueue: ; 1045c4
|
||||
ret
|
||||
|
||||
|
||||
EnterMapConnection: ; 1045d6
|
||||
EnterMapConnection:
|
||||
; Return carry if a connection has been entered.
|
||||
ld a, [wPlayerStepDirection]
|
||||
and a
|
||||
@@ -150,9 +150,8 @@ EnterMapConnection: ; 1045d6
|
||||
.done
|
||||
scf
|
||||
ret
|
||||
; 1046c6
|
||||
|
||||
LoadWarpData: ; 1046c6
|
||||
LoadWarpData:
|
||||
call .SaveDigWarp
|
||||
call .SetSpawn
|
||||
ld a, [wNextWarp]
|
||||
@@ -163,7 +162,7 @@ LoadWarpData: ; 1046c6
|
||||
ld [wMapNumber], a
|
||||
ret
|
||||
|
||||
.SaveDigWarp: ; 1046df (41:46df)
|
||||
.SaveDigWarp:
|
||||
call GetMapEnvironment
|
||||
call CheckOutdoorMap
|
||||
ret nz
|
||||
@@ -195,7 +194,7 @@ LoadWarpData: ; 1046c6
|
||||
ld [wDigMapNumber], a
|
||||
ret
|
||||
|
||||
.SetSpawn: ; 104718 (41:4718)
|
||||
.SetSpawn:
|
||||
call GetMapEnvironment
|
||||
call CheckOutdoorMap
|
||||
ret nz
|
||||
@@ -227,7 +226,7 @@ LoadWarpData: ; 1046c6
|
||||
ld [wLastSpawnMapNumber], a
|
||||
ret
|
||||
|
||||
LoadMapTimeOfDay: ; 104750
|
||||
LoadMapTimeOfDay:
|
||||
ld hl, wVramState
|
||||
res 6, [hl]
|
||||
ld a, $1
|
||||
@@ -239,7 +238,7 @@ LoadMapTimeOfDay: ; 104750
|
||||
call .PushAttrMap
|
||||
ret
|
||||
|
||||
.ClearBGMap: ; 104770 (41:4770)
|
||||
.ClearBGMap:
|
||||
ld a, HIGH(vBGMap0)
|
||||
ld [wBGMapAnchor + 1], a
|
||||
xor a ; LOW(vBGMap0)
|
||||
@@ -267,7 +266,7 @@ LoadMapTimeOfDay: ; 104750
|
||||
call ByteFill
|
||||
ret
|
||||
|
||||
.PushAttrMap: ; 1047a3 (41:47a3)
|
||||
.PushAttrMap:
|
||||
decoord 0, 0
|
||||
call .copy
|
||||
ld a, [hCGB]
|
||||
@@ -298,7 +297,7 @@ LoadMapTimeOfDay: ; 104750
|
||||
ld [rVBK], a
|
||||
ret
|
||||
|
||||
LoadGraphics: ; 1047cf
|
||||
LoadGraphics:
|
||||
call LoadTileset
|
||||
call LoadTilesetGFX
|
||||
xor a
|
||||
@@ -310,12 +309,11 @@ LoadGraphics: ; 1047cf
|
||||
farcall LoadOverworldFont
|
||||
ret
|
||||
|
||||
LoadMapPalettes: ; 1047eb
|
||||
LoadMapPalettes:
|
||||
ld b, SCGB_MAPPALS
|
||||
jp GetSGBLayout
|
||||
; 1047f0
|
||||
|
||||
RefreshMapSprites: ; 1047f0
|
||||
RefreshMapSprites:
|
||||
call ClearSprites
|
||||
farcall ReturnFromMapSetupScript
|
||||
call GetMovementPermissions
|
||||
@@ -333,7 +331,7 @@ RefreshMapSprites: ; 1047f0
|
||||
ld [wPlayerSpriteSetupFlags], a
|
||||
ret
|
||||
|
||||
CheckMovingOffEdgeOfMap:: ; 104820 (41:4820)
|
||||
CheckMovingOffEdgeOfMap::
|
||||
ld a, [wPlayerStepDirection]
|
||||
cp STANDING
|
||||
ret z
|
||||
@@ -391,7 +389,7 @@ CheckMovingOffEdgeOfMap:: ; 104820 (41:4820)
|
||||
ret
|
||||
|
||||
|
||||
GetCoordOfUpperLeftCorner:: ; 10486d
|
||||
GetCoordOfUpperLeftCorner::
|
||||
ld hl, wOverworldMapBlocks
|
||||
ld a, [wXCoord]
|
||||
bit 0, a
|
||||
@@ -436,4 +434,3 @@ GetCoordOfUpperLeftCorner:: ; 10486d
|
||||
and $1
|
||||
ld [wMetatileStandingX], a
|
||||
ret
|
||||
; 1048ba
|
||||
|
@@ -1,4 +1,4 @@
|
||||
LoadWildMonData: ; 29ff8
|
||||
LoadWildMonData:
|
||||
call _GrassWildmonLookup
|
||||
jr c, .copy
|
||||
ld hl, wMornEncounterRate
|
||||
@@ -25,7 +25,7 @@ LoadWildMonData: ; 29ff8
|
||||
ld [wWaterEncounterRate], a
|
||||
ret
|
||||
|
||||
FindNest: ; 2a01f
|
||||
FindNest:
|
||||
; Parameters:
|
||||
; e: 0 = Johto, 1 = Kanto
|
||||
; wNamedObjectIndexBuffer: species
|
||||
@@ -51,9 +51,8 @@ FindNest: ; 2a01f
|
||||
call .FindGrass
|
||||
ld hl, KantoWaterWildMons
|
||||
jp .FindWater
|
||||
; 2a052
|
||||
|
||||
.FindGrass: ; 2a052
|
||||
.FindGrass:
|
||||
ld a, [hl]
|
||||
cp -1
|
||||
ret z
|
||||
@@ -76,9 +75,8 @@ FindNest: ; 2a01f
|
||||
ld bc, GRASS_WILDDATA_LENGTH
|
||||
add hl, bc
|
||||
jr .FindGrass
|
||||
; 2a06e
|
||||
|
||||
.FindWater: ; 2a06e
|
||||
.FindWater:
|
||||
ld a, [hl]
|
||||
cp -1
|
||||
ret z
|
||||
@@ -99,9 +97,8 @@ FindNest: ; 2a01f
|
||||
ld bc, WATER_WILDDATA_LENGTH
|
||||
add hl, bc
|
||||
jr .FindWater
|
||||
; 2a088
|
||||
|
||||
.SearchMapForMon: ; 2a088
|
||||
.SearchMapForMon:
|
||||
inc hl
|
||||
.ScanMapLoop:
|
||||
push af
|
||||
@@ -119,9 +116,8 @@ FindNest: ; 2a01f
|
||||
.found
|
||||
pop af
|
||||
jp .AppendNest
|
||||
; 2a09c
|
||||
|
||||
.AppendNest: ; 2a09c
|
||||
.AppendNest:
|
||||
push de
|
||||
call GetWorldMapLocation
|
||||
ld c, a
|
||||
@@ -144,9 +140,8 @@ FindNest: ; 2a01f
|
||||
pop de
|
||||
and a
|
||||
ret
|
||||
; 2a0b7
|
||||
|
||||
.RoamMon1: ; 2a0b7
|
||||
.RoamMon1:
|
||||
ld a, [wRoamMon1Species]
|
||||
ld b, a
|
||||
ld a, [wNamedObjectIndexBuffer]
|
||||
@@ -161,9 +156,8 @@ FindNest: ; 2a01f
|
||||
ld [de], a
|
||||
inc de
|
||||
ret
|
||||
; 2a0cf
|
||||
|
||||
.RoamMon2: ; 2a0cf
|
||||
.RoamMon2:
|
||||
ld a, [wRoamMon2Species]
|
||||
ld b, a
|
||||
ld a, [wNamedObjectIndexBuffer]
|
||||
@@ -178,9 +172,8 @@ FindNest: ; 2a01f
|
||||
ld [de], a
|
||||
inc de
|
||||
ret
|
||||
; 2a0e7
|
||||
|
||||
TryWildEncounter:: ; 2a0e7
|
||||
TryWildEncounter::
|
||||
; Try to trigger a wild encounter.
|
||||
call .EncounterRate
|
||||
jr nc, .no_battle
|
||||
@@ -198,18 +191,16 @@ TryWildEncounter:: ; 2a0e7
|
||||
ld a, 1
|
||||
and a
|
||||
ret
|
||||
; 2a103
|
||||
|
||||
.EncounterRate: ; 2a103
|
||||
.EncounterRate:
|
||||
call GetMapEncounterRate
|
||||
call ApplyMusicEffectOnEncounterRate
|
||||
call ApplyCleanseTagEffectOnEncounterRate
|
||||
call Random
|
||||
cp b
|
||||
ret
|
||||
; 2a111
|
||||
|
||||
GetMapEncounterRate: ; 2a111
|
||||
GetMapEncounterRate:
|
||||
ld hl, wMornEncounterRate
|
||||
call CheckOnWater
|
||||
ld a, wWaterEncounterRate - wMornEncounterRate
|
||||
@@ -221,9 +212,8 @@ GetMapEncounterRate: ; 2a111
|
||||
add hl, bc
|
||||
ld b, [hl]
|
||||
ret
|
||||
; 2a124
|
||||
|
||||
ApplyMusicEffectOnEncounterRate:: ; 2a124
|
||||
ApplyMusicEffectOnEncounterRate::
|
||||
; Pokemon March and Ruins of Alph signal double encounter rate.
|
||||
; Pokemon Lullaby halves encounter rate.
|
||||
ld a, [wMapMusic]
|
||||
@@ -239,9 +229,8 @@ ApplyMusicEffectOnEncounterRate:: ; 2a124
|
||||
.double
|
||||
sla b
|
||||
ret
|
||||
; 2a138
|
||||
|
||||
ApplyCleanseTagEffectOnEncounterRate:: ; 2a138
|
||||
ApplyCleanseTagEffectOnEncounterRate::
|
||||
; Cleanse Tag halves encounter rate.
|
||||
ld hl, wPartyMon1Item
|
||||
ld de, PARTYMON_STRUCT_LENGTH
|
||||
@@ -259,9 +248,8 @@ ApplyCleanseTagEffectOnEncounterRate:: ; 2a138
|
||||
.cleansetag
|
||||
srl b
|
||||
ret
|
||||
; 2a14f
|
||||
|
||||
ChooseWildEncounter: ; 2a14f
|
||||
ChooseWildEncounter:
|
||||
call LoadWildMonDataPointer
|
||||
jp nc, .nowildbattle
|
||||
call CheckEncounterRoamMon
|
||||
@@ -355,11 +343,10 @@ ChooseWildEncounter: ; 2a14f
|
||||
.startwildbattle
|
||||
xor a
|
||||
ret
|
||||
; 2a1cb
|
||||
|
||||
INCLUDE "data/wild/probabilities.asm"
|
||||
|
||||
CheckRepelEffect:: ; 2a1df
|
||||
CheckRepelEffect::
|
||||
; If there is no active Repel, there's no need to be here.
|
||||
ld a, [wRepelEffect]
|
||||
and a
|
||||
@@ -389,13 +376,12 @@ endr
|
||||
.encounter
|
||||
scf
|
||||
ret
|
||||
; 2a200
|
||||
|
||||
LoadWildMonDataPointer: ; 2a200
|
||||
LoadWildMonDataPointer:
|
||||
call CheckOnWater
|
||||
jr z, _WaterWildmonLookup
|
||||
|
||||
_GrassWildmonLookup: ; 2a205
|
||||
_GrassWildmonLookup:
|
||||
ld hl, SwarmGrassWildMons
|
||||
ld bc, GRASS_WILDDATA_LENGTH
|
||||
call _SwarmWildmonCheck
|
||||
@@ -406,7 +392,7 @@ _GrassWildmonLookup: ; 2a205
|
||||
ld bc, GRASS_WILDDATA_LENGTH
|
||||
jr _NormalWildmonOK
|
||||
|
||||
_WaterWildmonLookup: ; 2a21d
|
||||
_WaterWildmonLookup:
|
||||
ld hl, SwarmWaterWildMons
|
||||
ld bc, WATER_WILDDATA_LENGTH
|
||||
call _SwarmWildmonCheck
|
||||
@@ -467,17 +453,15 @@ _NoSwarmWildmon:
|
||||
_NormalWildmonOK:
|
||||
call CopyCurrMapDE
|
||||
jr LookUpWildmonsForMapDE
|
||||
; 2a27f
|
||||
|
||||
CopyCurrMapDE: ; 2a27f
|
||||
CopyCurrMapDE:
|
||||
ld a, [wMapGroup]
|
||||
ld d, a
|
||||
ld a, [wMapNumber]
|
||||
ld e, a
|
||||
ret
|
||||
; 2a288
|
||||
|
||||
LookUpWildmonsForMapDE: ; 2a288
|
||||
LookUpWildmonsForMapDE:
|
||||
.loop
|
||||
push hl
|
||||
ld a, [hl]
|
||||
@@ -505,10 +489,9 @@ LookUpWildmonsForMapDE: ; 2a288
|
||||
pop hl
|
||||
scf
|
||||
ret
|
||||
; 2a2a0
|
||||
|
||||
|
||||
InitRoamMons: ; 2a2a0
|
||||
InitRoamMons:
|
||||
; initialize wRoamMon structs
|
||||
|
||||
; species
|
||||
@@ -540,10 +523,9 @@ InitRoamMons: ; 2a2a0
|
||||
ld [wRoamMon2HP], a
|
||||
|
||||
ret
|
||||
; 2a2ce
|
||||
|
||||
|
||||
CheckEncounterRoamMon: ; 2a2ce
|
||||
CheckEncounterRoamMon:
|
||||
push hl
|
||||
; Don't trigger an encounter if we're on water.
|
||||
call CheckOnWater
|
||||
@@ -589,10 +571,9 @@ CheckEncounterRoamMon: ; 2a2ce
|
||||
pop hl
|
||||
and a
|
||||
ret
|
||||
; 2a30d
|
||||
|
||||
|
||||
UpdateRoamMons: ; 2a30d
|
||||
UpdateRoamMons:
|
||||
ld a, [wRoamMon1MapGroup]
|
||||
cp GROUP_N_A
|
||||
jr z, .SkipRaikou
|
||||
@@ -633,10 +614,9 @@ UpdateRoamMons: ; 2a30d
|
||||
|
||||
.Finished:
|
||||
jp _BackUpMapIndices
|
||||
; 2a355
|
||||
|
||||
|
||||
.Update: ; 2a355
|
||||
.Update:
|
||||
ld hl, RoamMaps
|
||||
.loop
|
||||
; Are we at the end of the table?
|
||||
@@ -693,7 +673,7 @@ UpdateRoamMons: ; 2a30d
|
||||
ld c, [hl]
|
||||
ret
|
||||
|
||||
JumpRoamMons: ; 2a394
|
||||
JumpRoamMons:
|
||||
ld a, [wRoamMon1MapGroup]
|
||||
cp GROUP_N_A
|
||||
jr z, .SkipRaikou
|
||||
@@ -726,7 +706,7 @@ JumpRoamMons: ; 2a394
|
||||
.Finished:
|
||||
jp _BackUpMapIndices
|
||||
|
||||
JumpRoamMon: ; 2a3cd
|
||||
JumpRoamMon:
|
||||
.loop
|
||||
ld hl, RoamMaps
|
||||
.innerloop1 ; This loop happens to be unnecessary.
|
||||
@@ -760,9 +740,8 @@ JumpRoamMon: ; 2a3cd
|
||||
ld b, a
|
||||
ld c, [hl]
|
||||
ret
|
||||
; 2a3f6
|
||||
|
||||
_BackUpMapIndices: ; 2a3f6
|
||||
_BackUpMapIndices:
|
||||
ld a, [wRoamMons_CurrentMapNumber]
|
||||
ld [wRoamMons_LastMapNumber], a
|
||||
ld a, [wRoamMons_CurrentMapGroup]
|
||||
@@ -772,13 +751,12 @@ _BackUpMapIndices: ; 2a3f6
|
||||
ld a, [wMapGroup]
|
||||
ld [wRoamMons_CurrentMapGroup], a
|
||||
ret
|
||||
; 2a40f
|
||||
|
||||
|
||||
INCLUDE "data/wild/roammon_maps.asm"
|
||||
|
||||
|
||||
ValidateTempWildMonSpecies: ; 2a4a0
|
||||
ValidateTempWildMonSpecies:
|
||||
; Due to a development oversight, this function is called with the wild Pokemon's level, not its species, in a.
|
||||
and a
|
||||
jr z, .nowildmon ; = 0
|
||||
@@ -790,11 +768,10 @@ ValidateTempWildMonSpecies: ; 2a4a0
|
||||
.nowildmon
|
||||
scf
|
||||
ret
|
||||
; 2a4ab
|
||||
|
||||
; Finds a rare wild Pokemon in the route of the trainer calling, then checks if it's been Seen already.
|
||||
; The trainer will then tell you about the Pokemon if you haven't seen it.
|
||||
RandomUnseenWildMon: ; 2a4ab
|
||||
RandomUnseenWildMon:
|
||||
farcall GetCallerLocation
|
||||
ld d, b
|
||||
ld e, c
|
||||
@@ -865,9 +842,8 @@ RandomUnseenWildMon: ; 2a4ab
|
||||
; I just saw some rare @ in @ . I'll call you if I see another rare #MON, OK?
|
||||
text_jump UnknownText_0x1bd34b
|
||||
db "@"
|
||||
; 0x2a51f
|
||||
|
||||
RandomPhoneWildMon: ; 2a51f
|
||||
RandomPhoneWildMon:
|
||||
farcall GetCallerLocation
|
||||
ld d, b
|
||||
ld e, c
|
||||
@@ -905,9 +881,8 @@ RandomPhoneWildMon: ; 2a51f
|
||||
ld de, wStringBuffer4
|
||||
ld bc, MON_NAME_LENGTH
|
||||
jp CopyBytes
|
||||
; 2a567
|
||||
|
||||
RandomPhoneMon: ; 2a567
|
||||
RandomPhoneMon:
|
||||
; Get a random monster owned by the trainer who's calling.
|
||||
farcall GetCallerLocation
|
||||
ld hl, TrainerGroups
|
||||
@@ -989,7 +964,6 @@ RandomPhoneMon: ; 2a567
|
||||
ld de, wStringBuffer4
|
||||
ld bc, MON_NAME_LENGTH
|
||||
jp CopyBytes
|
||||
; 2a5e9
|
||||
|
||||
|
||||
INCLUDE "data/wild/johto_grass.asm"
|
||||
|
Reference in New Issue
Block a user