# Conflicts:
#	engine/items/mart.asm
This commit is contained in:
Rangi
2018-06-24 21:23:51 -04:00
1206 changed files with 14376 additions and 24565 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -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

View File

@@ -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)

View File

@@ -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.

View File

@@ -1,4 +1,4 @@
_LoadMapPart:: ; 4d15b
_LoadMapPart::
ld hl, wSurroundingTiles
ld a, [wMetatileStandingY]
and a

View File

@@ -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

View File

@@ -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

View File

@@ -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

File diff suppressed because it is too large Load Diff

View File

@@ -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

View File

@@ -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"

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

Some files were not shown because too many files have changed in this diff Show More