Movement constants, script stack

This commit is contained in:
PikalaxALT 2015-11-16 11:53:26 -05:00
parent 8290f851fd
commit fb88b2ccf8
11 changed files with 377 additions and 358 deletions

View File

@ -3,34 +3,34 @@ PLAYER EQU 0
LAST_TALKED EQU -2 LAST_TALKED EQU -2
const_def const_def
const VAR_STRINGBUFFER2 const VAR_STRINGBUFFER2 ; 00
const VAR_PARTYCOUNT const VAR_PARTYCOUNT ; 01
const VAR_BATTLERESULT const VAR_BATTLERESULT ; 02
const VAR_BATTLETYPE const VAR_BATTLETYPE ; 03
const VAR_TIMEOFDAY const VAR_TIMEOFDAY ; 04
const VAR_DEXCAUGHT const VAR_DEXCAUGHT ; 05
const VAR_DEXSEEN const VAR_DEXSEEN ; 06
const VAR_BADGES const VAR_BADGES ; 07
const VAR_MOVEMENT const VAR_MOVEMENT ; 08
const VAR_FACING const VAR_FACING ; 09
const VAR_HOUR const VAR_HOUR ; 0a
const VAR_WEEKDAY const VAR_WEEKDAY ; 0b
const VAR_MAPGROUP const VAR_MAPGROUP ; 0c
const VAR_MAPNUMBER const VAR_MAPNUMBER ; 0d
const VAR_UNOWNCOUNT const VAR_UNOWNCOUNT ; 0e
const VAR_ROOFPALETTE const VAR_ROOFPALETTE ; 0f
const VAR_BOXSPACE const VAR_BOXSPACE ; 10
const VAR_CONTESTMINUTES const VAR_CONTESTMINUTES ; 11
const VAR_XCOORD const VAR_XCOORD ; 12
const VAR_YCOORD const VAR_YCOORD ; 13
const VAR_SPECIALPHONECALL const VAR_SPECIALPHONECALL ; 14
const VAR_15 const VAR_15 ; 15
const VAR_KURT_APRICORNS const VAR_KURT_APRICORNS ; 16
const VAR_CALLERID const VAR_CALLERID ; 17
const VAR_BLUECARDBALANCE const VAR_BLUECARDBALANCE ; 18
const VAR_BUENASPASSWORD const VAR_BUENASPASSWORD ; 19
const VAR_KENJI_BREAK const VAR_KENJI_BREAK ; 1a
NUM_VARS EQU const_value NUM_VARS EQU const_value ; 1b
RETVAR_STRBUF2 EQU (0 << 6) RETVAR_STRBUF2 EQU (0 << 6)
RETVAR_ADDR_DE EQU (1 << 6) RETVAR_ADDR_DE EQU (1 << 6)

View File

@ -269,24 +269,24 @@ MAX_OUTDOOR_SPRITES EQU 23
const_def const_def
const STEP_TYPE_00 const STEP_TYPE_00
const STEP_TYPE_01 const STEP_TYPE_STANDING
const STEP_TYPE_02 ; walking const STEP_TYPE_NPC_WALK
const STEP_TYPE_03 ; stationary const STEP_TYPE_03
const STEP_TYPE_04 const STEP_TYPE_04
const STEP_TYPE_05 const STEP_TYPE_05
const STEP_TYPE_06 const STEP_TYPE_PLAYER_WALK
const STEP_TYPE_07 const STEP_TYPE_07
const STEP_TYPE_08 const STEP_TYPE_NPC_JUMP
const STEP_TYPE_09 const STEP_TYPE_PLAYER_JUMP
const STEP_TYPE_0A ; half step const STEP_TYPE_HALF_STEP
const STEP_TYPE_0B ; bump const STEP_TYPE_BUMP
const STEP_TYPE_TELEPORT_FROM const STEP_TYPE_TELEPORT_FROM
const STEP_TYPE_TELEPORT_TO const STEP_TYPE_TELEPORT_TO
const STEP_TYPE_SKYFALL const STEP_TYPE_SKYFALL
const STEP_TYPE_0F const STEP_TYPE_0F
const STEP_TYPE_10 const STEP_TYPE_GOT_BITE
const STEP_TYPE_11 const STEP_TYPE_ROCK_SMASH
const STEP_TYPE_12 const STEP_TYPE_RETURN_DIG
const STEP_TYPE_13 const STEP_TYPE_13
const STEP_TYPE_14 const STEP_TYPE_14
const STEP_TYPE_15 const STEP_TYPE_15
@ -297,14 +297,14 @@ MAX_OUTDOOR_SPRITES EQU 23
const_def const_def
const PERSON_ACTION_00 const PERSON_ACTION_00
const PERSON_ACTION_01 const PERSON_ACTION_STAND
const PERSON_ACTION_02 const PERSON_ACTION_STEP
const PERSON_ACTION_03 const PERSON_ACTION_BUMP
const PERSON_ACTION_04 const PERSON_ACTION_SPIN
const PERSON_ACTION_05 const PERSON_ACTION_SPIN_FLICKER
const PERSON_ACTION_06 const PERSON_ACTION_FISHING
const PERSON_ACTION_07 const PERSON_ACTION_07
const PERSON_ACTION_08 const PERSON_ACTION_EMOTE
const PERSON_ACTION_09 const PERSON_ACTION_09
const PERSON_ACTION_0A const PERSON_ACTION_0A
const PERSON_ACTION_0B const PERSON_ACTION_0B
@ -335,7 +335,7 @@ MAX_OUTDOOR_SPRITES EQU 23
const FACING_11 const FACING_11
const FACING_12 const FACING_12
const FACING_13 const FACING_13
const FACING_14 const FACING_EMOTE
const FACING_15 const FACING_15
const FACING_16 const FACING_16
const FACING_17 const FACING_17

View File

@ -27,7 +27,7 @@ Predef_StartBattle: ; 8c20f
ld [rSVBK], a ld [rSVBK], a
ld hl, wMapPals ld hl, wMapPals
ld bc, $0040 ld bc, 8 palettes
xor a xor a
call ByteFill call ByteFill
@ -308,9 +308,11 @@ StartTrainerBattle_Flash: ; 8c3ab (23:43ab)
StartTrainerBattle_SetUpForWavyOutro: ; 8c3e8 (23:43e8) StartTrainerBattle_SetUpForWavyOutro: ; 8c3e8 (23:43e8)
callba Function5602 callba Function5602
ld a, $5 ld a, $5 ; BANK(LYOverrides)
ld [rSVBK], a ld [rSVBK], a
call StartTrainerBattle_NextScene call StartTrainerBattle_NextScene
ld a, $43 ld a, $43
ld [hLCDStatCustom], a ld [hLCDStatCustom], a
xor a xor a
@ -342,8 +344,8 @@ StartTrainerBattle_SineWave: ; 8c408 (23:4408)
ld d, [hl] ld d, [hl]
add [hl] add [hl]
ld [hl], a ld [hl], a
ld a, $90 ld a, LYOverridesEnd - LYOverrides
ld bc, wd100 ld bc, LYOverrides
ld e, $0 ld e, $0
.loop .loop
@ -364,7 +366,7 @@ StartTrainerBattle_SineWave: ; 8c408 (23:4408)
StartTrainerBattle_SetUpForSpinOutro: ; 8c43d (23:443d) StartTrainerBattle_SetUpForSpinOutro: ; 8c43d (23:443d)
callba Function5602 callba Function5602
ld a, $5 ld a, $5 ; BANK(LYOverrides)
ld [rSVBK], a ld [rSVBK], a
call StartTrainerBattle_NextScene call StartTrainerBattle_NextScene
xor a xor a
@ -507,7 +509,7 @@ endr
StartTrainerBattle_SetUpForRandomScatterOutro: ; 8c578 (23:4578) StartTrainerBattle_SetUpForRandomScatterOutro: ; 8c578 (23:4578)
callba Function5602 callba Function5602
ld a, $5 ld a, $5 ; BANK(LYOverrides)
ld [rSVBK], a ld [rSVBK], a
call StartTrainerBattle_NextScene call StartTrainerBattle_NextScene
ld a, $10 ld a, $10
@ -739,10 +741,12 @@ WipeLYOverrides: ; 8c6d8
push af push af
ld a, $5 ld a, $5
ld [rSVBK], a ld [rSVBK], a
ld hl, LYOverrides ld hl, LYOverrides
call .wipe call .wipe
ld hl, LYOverridesBackup ld hl, LYOverridesBackup
call .wipe call .wipe
pop af pop af
ld [rSVBK], a ld [rSVBK], a
ret ret

View File

@ -8,44 +8,44 @@ sprite_movement_data: macro
dn \6, 0 dn \6, 0
endm endm
; function, facing, action, flags1, flags2, palette flags ; function, facing, action, flags1, flags2, palette flags
sprite_movement_data SPRITEMOVEFN_00, DOWN, PERSON_ACTION_01, $02, $00, %0000 ; 00 sprite_movement_data SPRITEMOVEFN_00, DOWN, PERSON_ACTION_STAND, $02, $00, %0000 ; 00
sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_01, $0c, $00, %0000 ; 01 sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_STAND, $0c, $00, %0000 ; 01
sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_XY, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 02 sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_XY, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 02
sprite_movement_data SPRITEMOVEFN_SLOW_RANDOM_SPIN, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 03 sprite_movement_data SPRITEMOVEFN_SLOW_RANDOM_SPIN, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 03
sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_Y, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 04 sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_Y, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 04
sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_X, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 05 sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_X, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 05
sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 06 sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 06
sprite_movement_data SPRITEMOVEFN_STANDING, UP, PERSON_ACTION_01, $00, $00, %0000 ; 07 sprite_movement_data SPRITEMOVEFN_STANDING, UP, PERSON_ACTION_STAND, $00, $00, %0000 ; 07
sprite_movement_data SPRITEMOVEFN_STANDING, LEFT, PERSON_ACTION_01, $00, $00, %0000 ; 08 sprite_movement_data SPRITEMOVEFN_STANDING, LEFT, PERSON_ACTION_STAND, $00, $00, %0000 ; 08
sprite_movement_data SPRITEMOVEFN_STANDING, RIGHT, PERSON_ACTION_01, $00, $00, %0000 ; 09 sprite_movement_data SPRITEMOVEFN_STANDING, RIGHT, PERSON_ACTION_STAND, $00, $00, %0000 ; 09
sprite_movement_data SPRITEMOVEFN_FAST_RANDOM_SPIN, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 0a sprite_movement_data SPRITEMOVEFN_FAST_RANDOM_SPIN, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 0a
sprite_movement_data SPRITEMOVEFN_OBEY_DPAD, DOWN, PERSON_ACTION_01, $02, $00, %0000 ; 0b sprite_movement_data SPRITEMOVEFN_OBEY_DPAD, DOWN, PERSON_ACTION_STAND, $02, $00, %0000 ; 0b
sprite_movement_data SPRITEMOVEFN_08, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 0c sprite_movement_data SPRITEMOVEFN_08, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 0c
sprite_movement_data SPRITEMOVEFN_09, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 0d sprite_movement_data SPRITEMOVEFN_09, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 0d
sprite_movement_data SPRITEMOVEFN_0A, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 0e sprite_movement_data SPRITEMOVEFN_0A, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 0e
sprite_movement_data SPRITEMOVEFN_0B, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 0f sprite_movement_data SPRITEMOVEFN_0B, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 0f
sprite_movement_data SPRITEMOVEFN_0C, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 10 sprite_movement_data SPRITEMOVEFN_0C, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 10
sprite_movement_data SPRITEMOVEFN_0D, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 11 sprite_movement_data SPRITEMOVEFN_0D, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 11
sprite_movement_data SPRITEMOVEFN_0E, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 12 sprite_movement_data SPRITEMOVEFN_0E, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 12
sprite_movement_data SPRITEMOVEFN_FOLLOW, DOWN, PERSON_ACTION_01, $02, $00, %0000 ; 13 sprite_movement_data SPRITEMOVEFN_FOLLOW, DOWN, PERSON_ACTION_STAND, $02, $00, %0000 ; 13
sprite_movement_data SPRITEMOVEFN_SCRIPTED, DOWN, PERSON_ACTION_01, $02, $00, %0000 ; 14 sprite_movement_data SPRITEMOVEFN_SCRIPTED, DOWN, PERSON_ACTION_STAND, $02, $00, %0000 ; 14
sprite_movement_data SPRITEMOVEFN_BIG_SNORLAX, DOWN, PERSON_ACTION_09, $2e, $01, %1100 ; 15 sprite_movement_data SPRITEMOVEFN_BIG_SNORLAX, DOWN, PERSON_ACTION_09, $2e, $01, %1100 ; 15
sprite_movement_data SPRITEMOVEFN_BOUNCE, DOWN, PERSON_ACTION_0A, $2e, $00, %0000 ; 16 sprite_movement_data SPRITEMOVEFN_BOUNCE, DOWN, PERSON_ACTION_0A, $2e, $00, %0000 ; 16
sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_01, $0c, $00, %0000 ; 17 sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_STAND, $0c, $00, %0000 ; 17
sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_01, $2e, $10, %0000 ; 18 sprite_movement_data SPRITEMOVEFN_STANDING, DOWN, PERSON_ACTION_STAND, $2e, $10, %0000 ; 18
sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_01, $2e, $00, %0100 ; 19 sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_STAND, $2e, $00, %0100 ; 19
sprite_movement_data SPRITEMOVEFN_FOLLOWNOTEXACT, DOWN, PERSON_ACTION_01, $02, $00, %0000 ; 1a sprite_movement_data SPRITEMOVEFN_FOLLOWNOTEXACT, DOWN, PERSON_ACTION_STAND, $02, $00, %0000 ; 1a
sprite_movement_data SPRITEMOVEFN_SHADOW, DOWN, PERSON_ACTION_00, $8e, $01, %0000 ; 1b sprite_movement_data SPRITEMOVEFN_SHADOW, DOWN, PERSON_ACTION_00, $8e, $01, %0000 ; 1b
sprite_movement_data SPRITEMOVEFN_EMOTE, DOWN, PERSON_ACTION_08, $8e, $02, %0000 ; 1c sprite_movement_data SPRITEMOVEFN_EMOTE, DOWN, PERSON_ACTION_EMOTE, $8e, $02, %0000 ; 1c
sprite_movement_data SPRITEMOVEFN_SCREENSHAKE, DOWN, PERSON_ACTION_00, $82, $00, %0000 ; 1d sprite_movement_data SPRITEMOVEFN_SCREENSHAKE, DOWN, PERSON_ACTION_00, $82, $00, %0000 ; 1d
sprite_movement_data SPRITEMOVEFN_SPIN_COUNTERCLOCKWISE, LEFT, PERSON_ACTION_01, $00, $00, %0000 ; 1e sprite_movement_data SPRITEMOVEFN_SPIN_COUNTERCLOCKWISE, LEFT, PERSON_ACTION_STAND, $00, $00, %0000 ; 1e
sprite_movement_data SPRITEMOVEFN_SPIN_CLOCKWISE, RIGHT, PERSON_ACTION_01, $00, $00, %0000 ; 1f sprite_movement_data SPRITEMOVEFN_SPIN_CLOCKWISE, RIGHT, PERSON_ACTION_STAND, $00, $00, %0000 ; 1f
sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_0C, $2e, $01, %1100 ; 20 sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_0C, $2e, $01, %1100 ; 20
sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_0D, $2e, $01, %1100 ; 21 sprite_movement_data SPRITEMOVEFN_STRENGTH, DOWN, PERSON_ACTION_0D, $2e, $01, %1100 ; 21
sprite_movement_data SPRITEMOVEFN_BOULDERDUST, DOWN, PERSON_ACTION_0E, $8e, $01, %0000 ; 22 sprite_movement_data SPRITEMOVEFN_BOULDERDUST, DOWN, PERSON_ACTION_0E, $8e, $01, %0000 ; 22
sprite_movement_data SPRITEMOVEFN_GRASS, DOWN, PERSON_ACTION_0F, $8e, $02, %0000 ; 23 sprite_movement_data SPRITEMOVEFN_GRASS, DOWN, PERSON_ACTION_0F, $8e, $02, %0000 ; 23
sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_XY, DOWN, PERSON_ACTION_01, $00, $00, %0010 ; 24 sprite_movement_data SPRITEMOVEFN_RANDOM_WALK_XY, DOWN, PERSON_ACTION_STAND, $00, $00, %0010 ; 24
sprite_movement_data SPRITEMOVEFN_00, DOWN, PERSON_ACTION_01, $00, $00, %0000 ; 25 sprite_movement_data SPRITEMOVEFN_00, DOWN, PERSON_ACTION_STAND, $00, $00, %0000 ; 25
; 4357 ; 4357
@ -167,7 +167,7 @@ Function43f3: ; 43f3
bit 5, [hl] bit 5, [hl]
jr nz, .bit5 jr nz, .bit5
cp STEP_TYPE_01 cp STEP_TYPE_STANDING
jr z, .one jr z, .one
jr .ok jr .ok
@ -186,7 +186,7 @@ Function43f3: ; 43f3
ld a, [hl] ld a, [hl]
and a and a
ret z ret z
cp STEP_TYPE_01 cp STEP_TYPE_STANDING
ret z ret z
.ok .ok
@ -246,22 +246,22 @@ endr
Pointers445f: ; 445f Pointers445f: ; 445f
dw SetFacingStanding, SetFacingStanding ; 00 dw SetFacingStanding, SetFacingStanding ; 00
dw Function44b5, SetFacingCurrent ; 01 dw Function44b5, SetFacingCurrent ; 01 standing?
dw Function44c1, SetFacingCurrent ; 02 dw Function44c1, SetFacingCurrent ; 02 walking?
dw Function4508, SetFacingCurrent ; 03 dw Function4508, SetFacingCurrent ; 03 bumping?
dw Function4529, SetFacingCurrent ; 04 dw Function4529, SetFacingCurrent ; 04
dw Function4539, SetFacingStanding ; 05 dw Function4539, SetFacingStanding ; 05
dw Function456e, Function456e ; 06 dw Function456e, Function456e ; 06
dw Function457b, SetFacingStanding ; 07 dw Function457b, SetFacingStanding ; 07
dw Function4582, Function4582 ; 08 dw Function4582, Function4582 ; 08
dw Function4589, Function4589 ; 09 dw Function4589, Function4589 ; 09
dw Function4590, Function45a4 ; 0a dw Function4590, Function45a4 ; 0a
dw Function45ab, SetFacingCurrent ; 0c dw Function45ab, SetFacingCurrent ; 0c
dw Function45be, Function45be ; 0b dw Function45be, Function45be ; 0b
dw Function45c5, Function45c5 ; 0d dw Function45c5, Function45c5 ; 0d
dw Function45da, SetFacingStanding ; 0e dw Function45da, SetFacingStanding ; 0e
dw Function45ed, SetFacingStanding ; 0f dw Function45ed, SetFacingStanding ; 0f
dw Function44e4, SetFacingCurrent ; 10 dw Function44e4, SetFacingCurrent ; 10
; 44a3 ; 44a3
SetFacingStanding: ; 44a3 SetFacingStanding: ; 44a3
@ -444,10 +444,10 @@ Function457b: ; 457b
ret ret
; 4582 ; 4582
Function4582: ; 4582 Function4582: ; 4582 emote
ld hl, OBJECT_FACING_STEP ld hl, OBJECT_FACING_STEP
add hl, bc add hl, bc
ld [hl], FACING_14 ld [hl], FACING_EMOTE
ret ret
; 4589 ; 4589
@ -930,7 +930,7 @@ Function47bc: ; 47bc
call Function467b call Function467b
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_01 ld [hl], STEP_TYPE_STANDING
ret ret
; 47dd ; 47dd
@ -1033,7 +1033,7 @@ Function47dd: ; 47dd
call Function467b call Function467b
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_01 ld [hl], PERSON_ACTION_STAND
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_05 ld [hl], STEP_TYPE_05
@ -1206,7 +1206,7 @@ Function47dd: ; 47dd
ld [hl], STANDING ld [hl], STANDING
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_01 ld [hl], PERSON_ACTION_STAND
ret ret
; 4958 ; 4958
@ -1258,7 +1258,7 @@ Function47dd: ; 47dd
.MovementSpinRepeat: ; 499c .MovementSpinRepeat: ; 499c
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_01 ld [hl], PERSON_ACTION_STAND
ld hl, OBJECT_RANGE ld hl, OBJECT_RANGE
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
@ -1354,7 +1354,7 @@ Function47dd: ; 47dd
call ._MovementShadow_Grass_Emote_BoulderDust call ._MovementShadow_Grass_Emote_BoulderDust
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_08 ld [hl], PERSON_ACTION_EMOTE
ld hl, OBJECT_STEP_DURATION ld hl, OBJECT_STEP_DURATION
add hl, bc add hl, bc
ld [hl], 0 ld [hl], 0
@ -1500,9 +1500,9 @@ endr
call Function463f call Function463f
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_02 ld [hl], PERSON_ACTION_STEP
ld hl, wd4cf ld hl, wCenteredObject
ld a, [hMapObjectIndexBuffer] ld a, [hMapObjectIndexBuffer]
cp [hl] cp [hl]
jr z, .load_6 jr z, .load_6
@ -1515,7 +1515,7 @@ endr
.load_6 .load_6
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_06 ld [hl], STEP_TYPE_PLAYER_WALK
ret ret
.NewDuration: ; 4b17 .NewDuration: ; 4b17
@ -1541,7 +1541,7 @@ SetRandomStepDuration: ; 4b2d
ld [hl], STANDING ld [hl], STANDING
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_01 ld [hl], PERSON_ACTION_STAND
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_03 ld [hl], STEP_TYPE_03
@ -1552,19 +1552,19 @@ Pointers4b45: ; 4b45
; These pointers use OBJECT_STEP_TYPE. See constants/sprite_constants.asm ; These pointers use OBJECT_STEP_TYPE. See constants/sprite_constants.asm
dw Function47bc ; 00 dw Function47bc ; 00
dw Function47dd ; 01 dw Function47dd ; 01
dw Function4e2b ; 02 dw Function4e2b ; 02 npc walk
dw Function4ddd ; 03 dw Function4ddd ; 03
dw Function4e21 ; 04 dw Function4e21 ; 04
dw Function4e0c ; 05 dw Function4e0c ; 05
dw Function4e56 ; 06 dw Function4e56 ; 06 player walk
dw Function4e47 ; 07 dw Function4e47 ; 07
dw Function4b86 ; 08 dw Function4b86 ; 08 npc jump step
dw Function4bbf ; 09 dw Function4bbf ; 09 player jump step
dw Function4e83 ; 0a dw Function4e83 ; 0a half step
dw Function4dff ; 0b dw Function4dff ; 0b
dw Function4c18 ; 0c dw Function4c18 ; 0c teleport from
dw Function4c89 ; 0d dw Function4c89 ; 0d teleport to
dw Function4d14 ; 0e dw Function4d14 ; 0e skyfall
dw Function4ecd ; 0f dw Function4ecd ; 0f
dw Function4d7e ; 10 dw Function4d7e ; 10
dw Function4daf ; 11 dw Function4daf ; 11
@ -1585,7 +1585,7 @@ Function4b79: ; 4b79
ret nz ret nz
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_01 ld [hl], STEP_TYPE_STANDING
ret ret
; 4b86 ; 4b86
@ -1622,7 +1622,7 @@ Function4ba9: ; 4ba9
call Function4600 call Function4600
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_01 ld [hl], STEP_TYPE_STANDING
ret ret
; 4bbf ; 4bbf
@ -1674,7 +1674,7 @@ Function4bfd: ; 4bfd
call Function4600 call Function4600
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_01 ld [hl], STEP_TYPE_STANDING
ret ret
; 4c18 ; 4c18
@ -1698,7 +1698,7 @@ Function4c23: ; 4c23
Function4c32: ; 4c32 Function4c32: ; 4c32
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_04 ld [hl], PERSON_ACTION_SPIN
ld hl, OBJECT_STEP_DURATION ld hl, OBJECT_STEP_DURATION
add hl, bc add hl, bc
dec [hl] dec [hl]
@ -1724,7 +1724,7 @@ Function4c42: ; 4c42
Function4c5d: ; 4c5d Function4c5d: ; 4c5d
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_04 ld [hl], PERSON_ACTION_SPIN
ld hl, OBJECT_31 ld hl, OBJECT_31
add hl, bc add hl, bc
inc [hl] inc [hl]
@ -1745,7 +1745,7 @@ Function4c5d: ; 4c5d
ld [hl], 0 ld [hl], 0
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_01 ld [hl], STEP_TYPE_STANDING
ret ret
; 4c89 ; 4c89
@ -1795,7 +1795,7 @@ Function4cb3: ; 4cb3
Function4cc9: ; 4cc9 Function4cc9: ; 4cc9
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_04 ld [hl], PERSON_ACTION_SPIN
ld hl, OBJECT_31 ld hl, OBJECT_31
add hl, bc add hl, bc
inc [hl] inc [hl]
@ -1823,7 +1823,7 @@ Function4ceb: ; 4ceb
Function4cf5: ; 4cf5 Function4cf5: ; 4cf5
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_04 ld [hl], PERSON_ACTION_SPIN
ld hl, OBJECT_STEP_DURATION ld hl, OBJECT_STEP_DURATION
add hl, bc add hl, bc
dec [hl] dec [hl]
@ -1837,7 +1837,7 @@ Function4d01: ; 4d01
ld [hl], 0 ld [hl], 0
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_01 ld [hl], STEP_TYPE_STANDING
ret ret
; 4d14 ; 4d14
@ -1865,7 +1865,7 @@ Function4d2e: ; 4d2e
ret nz ret nz
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_02 ld [hl], PERSON_ACTION_STEP
ld hl, OBJECT_STEP_FRAME ld hl, OBJECT_STEP_FRAME
add hl, bc add hl, bc
ld [hl], 0 ld [hl], 0
@ -1902,7 +1902,7 @@ Function4d6b: ; 4d6b
ld [hl], 0 ld [hl], 0
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_01 ld [hl], STEP_TYPE_STANDING
ret ret
; 4d7e ; 4d7e
@ -1936,7 +1936,7 @@ Function4d94: ; 4d94
ld [hl], 0 ld [hl], 0
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_01 ld [hl], STEP_TYPE_STANDING
ret ret
; 4daf ; 4daf
@ -1950,7 +1950,7 @@ Function4db5: ; 4db5
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
and %00000001 and %00000001
ld a, PERSON_ACTION_01 ld a, PERSON_ACTION_STAND
jr z, .yes jr z, .yes
ld a, PERSON_ACTION_00 ld a, PERSON_ACTION_00
@ -1966,9 +1966,9 @@ Function4dc8: ; 4dc8
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
and %00000001 and %00000001
ld a, PERSON_ACTION_04 ld a, PERSON_ACTION_SPIN
jr z, .yes jr z, .yes
ld a, PERSON_ACTION_05 ld a, PERSON_ACTION_SPIN_FLICKER
.yes .yes
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
@ -1987,7 +1987,7 @@ Function4ddd: ; 4ddd
ret nz ret nz
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_01 ld [hl], STEP_TYPE_STANDING
ret ret
; 4df0 ; 4df0
@ -2009,7 +2009,7 @@ Function4dff: ; 4dff
ret nz ret nz
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_01 ld [hl], STEP_TYPE_STANDING
ret ret
; 4e0c ; 4e0c
@ -2048,7 +2048,7 @@ Function4e2b: ; 4e2b
ld [hl], STANDING ld [hl], STANDING
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_01 ld [hl], STEP_TYPE_STANDING
ret ret
; 4e47 ; 4e47
@ -2089,7 +2089,7 @@ Function4e65: ; 4e65
ld [hl], STANDING ld [hl], STANDING
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_01 ld [hl], STEP_TYPE_STANDING
ret ret
; 4e83 ; 4e83
@ -2138,7 +2138,7 @@ Function4ec0: ; 4ec0
ret nz ret nz
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_01 ld [hl], STEP_TYPE_STANDING
ret ret
; 4ecd ; 4ecd
@ -2170,7 +2170,7 @@ Function4ecd: ; 4ecd
ld [hl], STANDING ld [hl], STANDING
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_01 ld [hl], STEP_TYPE_STANDING
ret ret
; 4f04 ; 4f04
@ -2302,7 +2302,7 @@ Function4f99: ; 4f99
ld [hl], 0 ld [hl], 0
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_01 ld [hl], STEP_TYPE_STANDING
ret ret
; 4fb2 ; 4fb2
@ -2731,17 +2731,19 @@ Function55e0:: ; 55e0
ret ret
; 5602 ; 5602
Function5602: ; 5602 Function5602: ; 5602, called at battle start
call Function5645 call Function5645 ; clear sprites
ld a, 0 ld a, PLAYER
call Function5629 call Function5629 ; respawn player
ld a, [wd459] ld a, [wd459]
bit 7, a bit 7, a
jr z, .ok jr z, .ok
ld a, [hLastTalked] ld a, [hLastTalked]
and a and a
jr z, .ok jr z, .ok
call Function5629 call Function5629 ; respawn opponent
.ok .ok
call _UpdateSprites call _UpdateSprites
@ -2749,9 +2751,9 @@ Function5602: ; 5602
; 561d ; 561d
Function561d: ; 561d Function561d: ; 561d
call Function5645 call Function5645 ; clear sprites
ld a, 0 ld a, PLAYER
call Function5629 call Function5629 ; respawn player
call _UpdateSprites call _UpdateSprites
ret ret
; 5629 ; 5629
@ -2783,7 +2785,7 @@ Function5645: ; 5645
ld bc, ObjectStructs ld bc, ObjectStructs
.loop .loop
ld [hMapObjectIndexBuffer], a ld [hMapObjectIndexBuffer], a
call Function5680 call SetFacing_Standing
ld hl, OBJECT_STRUCT_LENGTH ld hl, OBJECT_STRUCT_LENGTH
add hl, bc add hl, bc
ld b, h ld b, h
@ -2799,9 +2801,9 @@ Function565c: ; 565c
push bc push bc
call Function56cd call Function56cd
pop bc pop bc
jr c, Function5680 jr c, SetFacing_Standing
call Function56a3 call Function56a3
jr c, Function5680 jr c, SetFacing_Standing
call Function5688 call Function5688
callba Function4440 callba Function4440
xor a xor a
@ -2810,13 +2812,13 @@ Function565c: ; 565c
Function5673: ; 5673 Function5673: ; 5673
call Function56a3 call Function56a3
jr c, Function5680 jr c, SetFacing_Standing
callba Function4440 callba Function4440 ; no need to farcall
xor a xor a
ret ret
; 5680 ; 5680
Function5680: ; 5680 SetFacing_Standing: ; 5680
ld hl, OBJECT_FACING_STEP ld hl, OBJECT_FACING_STEP
add hl, bc add hl, bc
ld [hl], STANDING ld [hl], STANDING

View File

@ -87,7 +87,7 @@ MovementPointers: ; 5075
dw Movement_step_shake ; 55 dw Movement_step_shake ; 55
dw Movement_56 ; 56 dw Movement_56 ; 56
dw Movement_rock_smash ; 57 dw Movement_rock_smash ; 57
dw Movement_return_dig ; 58 dw Movement_return_dig ; 58
dw Movement_59 ; 59 dw Movement_59 ; 59
; 5129 ; 5129
@ -129,7 +129,7 @@ Movement_step_dig: ; 5145
ld [hl], a ld [hl], a
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_04 ld [hl], PERSON_ACTION_SPIN
call GetMovementByte call GetMovementByte
ld hl, OBJECT_STEP_DURATION ld hl, OBJECT_STEP_DURATION
add hl, bc add hl, bc
@ -159,17 +159,17 @@ Movement_return_dig: ; 516a
ld [hl], STANDING ld [hl], STANDING
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_12 ld [hl], STEP_TYPE_RETURN_DIG
ret ret
; 5189 ; 5189
Movement_fish_got_bite: ; 5189 Movement_fish_got_bite: ; 5189
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_06 ld [hl], PERSON_ACTION_FISHING
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_10 ld [hl], STEP_TYPE_GOT_BITE
ret ret
; 5196 ; 5196
@ -180,20 +180,20 @@ Movement_rock_smash: ; 5196
ld [hl], a ld [hl], a
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_01 ld [hl], PERSON_ACTION_STAND
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_11 ld [hl], STEP_TYPE_ROCK_SMASH
ret ret
; 51ab ; 51ab
Movement_fish_cast_rod: ; 51ab Movement_fish_cast_rod: ; 51ab
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_06 ld [hl], PERSON_ACTION_FISHING
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_01 ld [hl], STEP_TYPE_STANDING
ret ret
; 51b8 ; 51b8
@ -219,7 +219,7 @@ Movement_step_end: ; 51c1
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_01 ld [hl], STEP_TYPE_STANDING
ret ret
; 51db ; 51db
@ -264,7 +264,7 @@ Movement_remove_person: ; 51fd
Movement_4b: ; 5210 Movement_4b: ; 5210
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_01 ld [hl], PERSON_ACTION_STAND
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
@ -325,7 +325,7 @@ Movement_step_sleep_common: ; 5247
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_01 ld [hl], PERSON_ACTION_STAND
ld hl, OBJECT_DIRECTION_WALKING ld hl, OBJECT_DIRECTION_WALKING
add hl, bc add hl, bc
@ -341,11 +341,11 @@ Movement_step_bump: ; 525f
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_0B ld [hl], STEP_TYPE_BUMP
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_03 ld [hl], PERSON_ACTION_BUMP
ld hl, OBJECT_DIRECTION_WALKING ld hl, OBJECT_DIRECTION_WALKING
add hl, bc add hl, bc
@ -457,7 +457,7 @@ TurnHead: ; 52ee
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_01 ld [hl], PERSON_ACTION_STAND
ld hl, OBJECT_DIRECTION_WALKING ld hl, OBJECT_DIRECTION_WALKING
add hl, bc add hl, bc
@ -732,11 +732,11 @@ HalfStep: ; 5400
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_02 ld [hl], PERSON_ACTION_STEP
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_0A ld [hl], STEP_TYPE_HALF_STEP
ret ret
; 5412 ; 5412
@ -745,7 +745,7 @@ NormalStep: ; 5412
call Function463f call Function463f
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_02 ld [hl], PERSON_ACTION_STEP
ld hl, OBJECT_NEXT_TILE ld hl, OBJECT_NEXT_TILE
add hl, bc add hl, bc
@ -760,20 +760,20 @@ NormalStep: ; 5412
call ShakeGrass call ShakeGrass
.skip_grass .skip_grass
ld hl, wd4cf ld hl, wCenteredObject
ld a, [hMapObjectIndexBuffer] ld a, [hMapObjectIndexBuffer]
cp [hl] cp [hl]
jr z, .step_type_06 jr z, .player
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_02 ld [hl], STEP_TYPE_NPC_WALK
ret ret
.step_type_06 .player
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_06 ld [hl], STEP_TYPE_PLAYER_WALK
ret ret
; 5446 ; 5446
@ -783,22 +783,22 @@ TurningStep: ; 5446
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_04 ld [hl], PERSON_ACTION_SPIN
ld hl, wd4cf ld hl, wCenteredObject
ld a, [hMapObjectIndexBuffer] ld a, [hMapObjectIndexBuffer]
cp [hl] cp [hl]
jr z, .step_type_06 jr z, .player
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_02 ld [hl], STEP_TYPE_NPC_WALK
ret ret
.step_type_06 .player
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_06 ld [hl], STEP_TYPE_PLAYER_WALK
ret ret
; 5468 ; 5468
@ -809,22 +809,22 @@ SlideStep: ; 5468
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_01 ld [hl], PERSON_ACTION_STAND
ld hl, wd4cf ld hl, wCenteredObject
ld a, [hMapObjectIndexBuffer] ld a, [hMapObjectIndexBuffer]
cp [hl] cp [hl]
jr z, .step_type_06 jr z, .player
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_02 ld [hl], STEP_TYPE_NPC_WALK
ret ret
.step_type_06 .player
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_06 ld [hl], STEP_TYPE_PLAYER_WALK
ret ret
; 548a ; 548a
@ -841,23 +841,23 @@ JumpStep: ; 548a
ld hl, OBJECT_ACTION ld hl, OBJECT_ACTION
add hl, bc add hl, bc
ld [hl], PERSON_ACTION_02 ld [hl], PERSON_ACTION_STEP
call SpawnShadow call SpawnShadow
ld hl, wd4cf ld hl, wCenteredObject
ld a, [hMapObjectIndexBuffer] ld a, [hMapObjectIndexBuffer]
cp [hl] cp [hl]
jr z, .step_type_09 jr z, .player
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_08 ld [hl], STEP_TYPE_NPC_JUMP
ret ret
.step_type_09 .player
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_09 ld [hl], STEP_TYPE_PLAYER_JUMP
ret ret
; 54b8 ; 54b8

View File

@ -496,9 +496,9 @@ Function14da0: ; 14da0
ValidateSave: ; 14da9 ValidateSave: ; 14da9
ld a, BANK(s1_a008) ld a, BANK(s1_a008)
call GetSRAMBank call GetSRAMBank
ld a, $63 ld a, 99
ld [s1_a008], a ld [s1_a008], a
ld a, $7f ld a, " "
ld [s1_ad0f], a ld [s1_ad0f], a
jp CloseSRAM jp CloseSRAM
; 14dbb ; 14dbb
@ -564,9 +564,9 @@ Function14e13: ; 14e13
ValidateBackupSave: ; 14e2d ValidateBackupSave: ; 14e2d
ld a, BANK(s0_b208) ld a, BANK(s0_b208)
call GetSRAMBank call GetSRAMBank
ld a, $63 ld a, 99
ld [s0_b208], a ld [s0_b208], a
ld a, $7f ld a, " "
ld [s0_bf0f], a ld [s0_bf0f], a
call CloseSRAM call CloseSRAM
ret ret
@ -661,7 +661,7 @@ TryLoadSaveFile: ; 14ea5 (5:4ea5)
.corrupt .corrupt
ld a, [Options] ld a, [Options]
push af push af
set 4, a set NO_TEXT_SCROLL, a
ld [Options], a ld [Options], a
ld hl, UnknownText_0x1529c ld hl, UnknownText_0x1529c
call PrintText call PrintText
@ -735,10 +735,10 @@ Function14f84: ; 14f84
ld a, BANK(s1_a008) ld a, BANK(s1_a008)
call GetSRAMBank call GetSRAMBank
ld a, [s1_a008] ld a, [s1_a008]
cp $63 cp 99
jr nz, .nope jr nz, .nope
ld a, [s1_ad0f] ld a, [s1_ad0f]
cp $7f cp " "
jr nz, .nope jr nz, .nope
ld hl, sOptions ld hl, sOptions
ld de, Options ld de, Options
@ -757,10 +757,10 @@ Function14faf: ; 14faf
ld a, BANK(s0_b208) ld a, BANK(s0_b208)
call GetSRAMBank call GetSRAMBank
ld a, [s0_b208] ld a, [s0_b208]
cp $63 cp 99
jr nz, .nope jr nz, .nope
ld a, [s0_bf0f] ld a, [s0_bf0f]
cp $7f cp " "
jr nz, .nope jr nz, .nope
ld hl, sBackupOptions ld hl, sBackupOptions
ld de, Options ld de, Options

View File

@ -241,7 +241,7 @@ ENDC
dw Script_trainerclassname dw Script_trainerclassname
dw Script_name dw Script_name
dw Script_wait dw Script_wait
dw Script_unknown0xa9 dw Script_check_save
; 0x96e05 ; 0x96e05
StartScript: ; 0x96e05 StartScript: ; 0x96e05
@ -415,10 +415,10 @@ Script_repeattext: ; 0x96ebb
call GetScriptByte call GetScriptByte
ld h, a ld h, a
cp -1 cp -1
jr nz, .done ; 0x96ec5 $11 jr nz, .done
ld a, l ld a, l
cp -1 cp -1
jr nz, .done ; 0x96eca $c jr nz, .done
ld hl, wd44e ld hl, wd44e
ld a, [hli] ld a, [hli]
ld b, a ld b, a
@ -456,7 +456,7 @@ Script_yesorno: ; 0x96eed
call YesNoBox call YesNoBox
ld a, 0 ld a, 0
jr c, .no ; 0x96ef2 $2 jr c, .no
ld a, 1 ld a, 1
.no .no
ld [ScriptVar], a ld [ScriptVar], a
@ -567,12 +567,12 @@ Script_verbosegiveitem: ; 0x96f60
; 0x96f76 ; 0x96f76
Function96f76: ; 96f76 ret_96f76: ; 96f76
ret ret
; 96f77 ; 96f77
GiveItemScript: ; 96f77 GiveItemScript: ; 96f77
callasm Function96f76 callasm ret_96f76
writetext ReceivedItemText writetext ReceivedItemText
iffalse .Full iffalse .Full
waitbutton waitbutton
@ -792,16 +792,16 @@ Script_askforphonenumber: ; 0x970be
; number (SingleByteParam) ; number (SingleByteParam)
call YesNoBox call YesNoBox
jr c, .refused ; 0x970c1 $13 jr c, .refused
call GetScriptByte call GetScriptByte
ld c, a ld c, a
callba AddPhoneNumber callba AddPhoneNumber
jr c, .phonefull ; 0x970cd $3 jr c, .phonefull
xor a xor a
jr .done ; 0x970d0 $9 jr .done
.phonefull .phonefull
ld a, 1 ld a, 1
jr .done ; 0x970d4 $5 jr .done
.refused .refused
call GetScriptByte call GetScriptByte
ld a, 2 ld a, 2
@ -1196,7 +1196,7 @@ ApplyPersonFacing: ; 0x9728b
ld a, d ld a, d
push de push de
call CheckObjectVisibility call CheckObjectVisibility
jr c, .not_visible ; 0x97290 $27 jr c, .not_visible
ld hl, OBJECT_SPRITE ld hl, OBJECT_SPRITE
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
@ -1207,13 +1207,13 @@ ApplyPersonFacing: ; 0x9728b
ld hl, OBJECT_FLAGS1 ld hl, OBJECT_FLAGS1
add hl, bc add hl, bc
bit 2, [hl] bit 2, [hl]
jr nz, .not_visible ; 0x972a4 $13 jr nz, .not_visible
pop de pop de
ld a, e ld a, e
call SetSpriteDirection call SetSpriteDirection
ld hl, VramState ld hl, VramState
bit 6, [hl] bit 6, [hl]
jr nz, .text_state ; 0x972b0 $3 jr nz, .text_state
call .DisableTextTiles call .DisableTextTiles
.text_state .text_state
call UpdateSprites call UpdateSprites
@ -1235,7 +1235,7 @@ ApplyPersonFacing: ; 0x9728b
dec bc dec bc
ld a, b ld a, b
or c or c
jr nz, .loop ; 0x972cb $f8 jr nz, .loop
ret ret
; 0x972ce ; 0x972ce
@ -1299,9 +1299,9 @@ ApplyEventActionAppearDisappear: ; 0x9730b
ld d, [hl] ld d, [hl]
ld a, -1 ld a, -1
cp e cp e
jr nz, .okay ; 0x9731a $5 jr nz, .okay
cp d cp d
jr nz, .okay ; 0x9731d $2 jr nz, .okay
xor a xor a
ret ret
.okay .okay
@ -1391,7 +1391,7 @@ Script_loademote: ; 0x97384
call GetScriptByte call GetScriptByte
cp -1 cp -1
jr nz, .not_var_emote ; 0x97389 $3 jr nz, .not_var_emote
ld a, [ScriptVar] ld a, [ScriptVar]
.not_var_emote .not_var_emote
ld c, a ld c, a
@ -1563,21 +1563,21 @@ Script_returnafterbattle: ; 0x97459
ld a, [wBattleResult] ld a, [wBattleResult]
and $3f and $3f
cp $1 cp $1
jr nz, .notblackedout ; 0x97466 $8 jr nz, .notblackedout
ld b, BANK(Script_BattleWhiteout) ld b, BANK(Script_BattleWhiteout)
ld hl, Script_BattleWhiteout ld hl, Script_BattleWhiteout
jp ScriptJump jp ScriptJump
.notblackedout .notblackedout
bit 0, d bit 0, d
jr z, .was_wild ; 0x97472 $8 jr z, .was_wild
callba MomTriesToBuySomething callba MomTriesToBuySomething
jr .done ; 0x9747a $12 jr .done
.was_wild .was_wild
ld a, [wBattleResult] ld a, [wBattleResult]
bit 7, a bit 7, a
jr z, .done ; 0x97481 $b jr z, .done
ld b, BANK(Script_SpecialBillCall) ld b, BANK(Script_SpecialBillCall)
ld de, Script_SpecialBillCall ld de, Script_SpecialBillCall
callba LoadScriptBDE callba LoadScriptBDE
@ -1643,12 +1643,18 @@ Script_2ptcall: ; 0x974be
; fallthrough ; fallthrough
ScriptCall: ; 0x974cb ScriptCall: ; 0x974cb
; Bug: The script stack has a capacity of 5 scripts, yet there is
; nothing to stop you from pushing a sixth script. The high part
; of the script address can then be overwritten by modifications
; to ScriptDelay, causing the script to return to the rst/interrupt
; space.
push de push de
ld hl, wd43c ld hl, wScriptStackSize
ld e, [hl] ld e, [hl]
inc [hl] inc [hl]
ld d, $0 ld d, $0
ld hl, wd43d ld hl, wScriptStackBA1
rept 3 rept 3
add hl, de add hl, de
endr endr
@ -1751,8 +1757,8 @@ Script_if_equal: ; 0x97540
call GetScriptByte call GetScriptByte
ld hl, ScriptVar ld hl, ScriptVar
cp [hl] cp [hl]
jr z, Script_2jump ; 0x97547 $b5 jr z, Script_2jump
jr SkipTwoScriptBytes ; 0x97549 $4b jr SkipTwoScriptBytes
; 0x9754b ; 0x9754b
Script_if_not_equal: ; 0x9754b Script_if_not_equal: ; 0x9754b
@ -1764,8 +1770,8 @@ Script_if_not_equal: ; 0x9754b
call GetScriptByte call GetScriptByte
ld hl, ScriptVar ld hl, ScriptVar
cp [hl] cp [hl]
jr nz, Script_2jump ; 0x97552 $aa jr nz, Script_2jump
jr SkipTwoScriptBytes ; 0x97554 $40 jr SkipTwoScriptBytes
; 0x97556 ; 0x97556
Script_if_greater_than: ; 0x97556 Script_if_greater_than: ; 0x97556
@ -1778,8 +1784,8 @@ Script_if_greater_than: ; 0x97556
ld b, a ld b, a
call GetScriptByte call GetScriptByte
cp b cp b
jr c, Script_2jump ; 0x9755e $9e jr c, Script_2jump
jr SkipTwoScriptBytes ; 0x97560 $34 jr SkipTwoScriptBytes
; 0x97562 ; 0x97562
Script_if_less_than: ; 0x97562 Script_if_less_than: ; 0x97562
@ -1792,8 +1798,8 @@ Script_if_less_than: ; 0x97562
ld b, a ld b, a
ld a, [ScriptVar] ld a, [ScriptVar]
cp b cp b
jr c, Script_2jump ; 0x9756a $92 jr c, Script_2jump
jr SkipTwoScriptBytes ; 0x9756c $28 jr SkipTwoScriptBytes
; 0x9756e ; 0x9756e
Script_jumpstd: ; 0x9756e Script_jumpstd: ; 0x9756e
@ -1802,7 +1808,7 @@ Script_jumpstd: ; 0x9756e
; predefined_script (MultiByteParam) ; predefined_script (MultiByteParam)
call StdScript call StdScript
jr ScriptJump ; 0x97571 $2a jr ScriptJump
; 0x97573 ; 0x97573
Script_callstd: ; 0x97573 Script_callstd: ; 0x97573
@ -1870,7 +1876,7 @@ Script_checktriggers: ; 0x975c2
; script command 0x13 ; script command 0x13
call CheckTriggers call CheckTriggers
jr z, .asm_975cb ; 0x975c5 $4 jr z, .asm_975cb
ld [ScriptVar], a ld [ScriptVar], a
ret ret
.asm_975cb .asm_975cb
@ -1892,7 +1898,7 @@ Script_checkmaptriggers: ; 0x975d1
call GetMapTrigger call GetMapTrigger
ld a, d ld a, d
or e or e
jr z, .asm_975e5 ; 0x975de $5 jr z, .asm_975e5
ld a, [de] ld a, [de]
ld [ScriptVar], a ld [ScriptVar], a
ret ret
@ -1911,7 +1917,7 @@ Script_dotrigger: ; 0x975eb
ld b, a ld b, a
ld a, [MapNumber] ld a, [MapNumber]
ld c, a ld c, a
jr Unknown_975fd ; 0x975f3 $8 jr Unknown_975fd
; 0x975f5 ; 0x975f5
Script_domaptrigger: ; 0x975f5 Script_domaptrigger: ; 0x975f5
@ -1931,7 +1937,7 @@ Unknown_975fd: ; 0x975fd
call GetMapTrigger call GetMapTrigger
ld a, d ld a, d
or e or e
jr z, .asm_97608 ; 0x97602 $4 jr z, .asm_97608
call GetScriptByte call GetScriptByte
ld [de], a ld [de], a
.asm_97608 .asm_97608
@ -2012,28 +2018,31 @@ Script_random: ; 0x97640
ld [ScriptVar], a ld [ScriptVar], a
and a and a
ret z ret z
ld c, a ld c, a
call Function97673 call .Divide256byC
and a and a
jr z, .asm_9765f ; 0x9764d $10 jr z, .no_restriction ; 256 % b == 0
ld b, a ld b, a
xor a xor a
sub b sub b
ld b, a ld b, a
.asm_97653 .loop
push bc push bc
call Random call Random
pop bc pop bc
ld a, [$ffe1] ld a, [hRandomAdd]
cp b cp b
jr nc, .asm_97653 ; 0x9765b $f6 jr nc, .loop
jr .asm_97666 ; 0x9765d $7 jr .finish
.asm_9765f
.no_restriction
push bc push bc
call Random call Random
pop bc pop bc
ld a, [$ffe1] ld a, [hRandomAdd]
.asm_97666
.finish
push af push af
ld a, [ScriptVar] ld a, [ScriptVar]
ld c, a ld c, a
@ -2043,14 +2052,14 @@ Script_random: ; 0x97640
ret ret
; 0x97673 ; 0x97673
Function97673: ; 0x97673 .Divide256byC: ; 0x97673
xor a xor a
ld b, a ld b, a
sub c sub c
.asm_97676 .mod_loop
inc b inc b
sub c sub c
jr nc, .asm_97676 ; 0x97678 $fc jr nc, .mod_loop
dec b dec b
add c add c
ret ret
@ -2119,7 +2128,7 @@ Script_pokenamemem: ; 0x976ae
call GetScriptByte call GetScriptByte
and a and a
jr nz, .gotit ; 0x976b2 $3 jr nz, .gotit
ld a, [ScriptVar] ld a, [ScriptVar]
.gotit .gotit
ld [wd265], a ld [wd265], a
@ -2149,13 +2158,13 @@ Script_itemtotext: ; 0x976d5
call GetScriptByte call GetScriptByte
and a and a
jr nz, .ok ; 0x976d9 $3 jr nz, .ok
ld a, [ScriptVar] ld a, [ScriptVar]
.ok .ok
ld [wd265], a ld [wd265], a
call GetItemName call GetItemName
ld de, StringBuffer1 ld de, StringBuffer1
jr ConvertMemToText ; 0x976e7 $d7 jr ConvertMemToText
; 0x976e9 ; 0x976e9
Script_mapnametotext: ; 0x976e9 Script_mapnametotext: ; 0x976e9
@ -2183,7 +2192,7 @@ Script_displaylocation: ; 0x97701
; memory (SingleByteParam) ; memory (SingleByteParam)
call GetScriptByte call GetScriptByte
jr ConvertLandmarkToText ; 0x97704 $ee jr ConvertLandmarkToText
; 0x97706 ; 0x97706
Script_trainertotext: ; 0x97706 Script_trainertotext: ; 0x97706
@ -2198,7 +2207,7 @@ Script_trainertotext: ; 0x97706
call GetScriptByte call GetScriptByte
ld b, a ld b, a
callba GetTrainerName callba GetTrainerName
jr ConvertMemToText ; 0x97714 $aa jr ConvertMemToText
; 0x97716 ; 0x97716
Script_name: ; 0x97716 Script_name: ; 0x97716
@ -2227,7 +2236,7 @@ Script_trainerclassname: ; 0x9772b
ld a, TRAINER_NAME ld a, TRAINER_NAME
ld [wNamedObjectTypeBuffer], a ld [wNamedObjectTypeBuffer], a
jr ContinueToGetName ; 0x97730 $ea jr ContinueToGetName
; 0x97732 ; 0x97732
Script_readmoney: ; 0x97732 Script_readmoney: ; 0x97732
@ -2344,7 +2353,7 @@ Script_giveitem: ; 0x977ca
call GetScriptByte call GetScriptByte
cp ITEM_FROM_MEM cp ITEM_FROM_MEM
jr nz, .ok ; 0x977cf $3 jr nz, .ok
ld a, [ScriptVar] ld a, [ScriptVar]
.ok .ok
ld [CurItem], a ld [CurItem], a
@ -2352,7 +2361,7 @@ Script_giveitem: ; 0x977ca
ld [wItemQuantityChangeBuffer], a ld [wItemQuantityChangeBuffer], a
ld hl, NumItems ld hl, NumItems
call ReceiveItem call ReceiveItem
jr nc, .full ; 0x977e3 $6 jr nc, .full
ld a, $1 ld a, $1
ld [ScriptVar], a ld [ScriptVar], a
ret ret
@ -2718,7 +2727,7 @@ Script_checkevent: ; 0x979a4
call EventFlagAction call EventFlagAction
ld a, c ld a, c
and a and a
jr z, .false ; 0x979b3 $2 jr z, .false
ld a, 1 ld a, 1
.false .false
ld [ScriptVar], a ld [ScriptVar], a
@ -2766,7 +2775,7 @@ Script_checkflag: ; 0x979d7
call _EngineFlagAction call _EngineFlagAction
ld a, c ld a, c
and a and a
jr z, .false ; 0x979e6 $2 jr z, .false
ld a, 1 ld a, 1
.false .false
ld [ScriptVar], a ld [ScriptVar], a
@ -2835,7 +2844,7 @@ Script_warp: ; 0x97a1d
; This seems to be some sort of error handling case. ; This seems to be some sort of error handling case.
call GetScriptByte call GetScriptByte
and a and a
jr z, .not_ok ; 0x97a21 $27 jr z, .not_ok
ld [MapGroup], a ld [MapGroup], a
call GetScriptByte call GetScriptByte
ld [MapNumber], a ld [MapNumber], a
@ -3080,14 +3089,14 @@ Script_pause: ; 0x97b47
call GetScriptByte call GetScriptByte
and a and a
jr z, .loop ; 0x97b4b $3 jr z, .loop
ld [ScriptDelay], a ld [ScriptDelay], a
.loop .loop
ld c, 2 ld c, 2
call DelayFrames call DelayFrames
ld hl, ScriptDelay ld hl, ScriptDelay
dec [hl] dec [hl]
jr nz, .loop ; 0x97b59 $f5 jr nz, .loop
ret ret
; 0x97b5c ; 0x97b5c
@ -3098,7 +3107,7 @@ Script_deactivatefacing: ; 0x97b5c
call GetScriptByte call GetScriptByte
and a and a
jr z, .no_time ; 0x97b60 $3 jr z, .no_time
ld [ScriptDelay], a ld [ScriptDelay], a
.no_time .no_time
ld a, SCRIPT_WAIT ld a, SCRIPT_WAIT
@ -3149,14 +3158,14 @@ Script_return: ; 0x97b8c
ExitScriptSubroutine: ; 0x97b9a ExitScriptSubroutine: ; 0x97b9a
; Return carry if there's no parent to return to. ; Return carry if there's no parent to return to.
ld hl, wd43c ld hl, wScriptStackSize
ld a, [hl] ld a, [hl]
and a and a
jr z, .done ; 0x97b9f $1d jr z, .done
dec [hl] dec [hl]
ld e, [hl] ld e, [hl]
ld d, $0 ld d, $0
ld hl, wd43d ld hl, wScriptStackBA1
rept 3 rept 3
add hl,de add hl,de
endr endr
@ -3181,7 +3190,7 @@ Script_resetfuncs: ; 0x97bc0
; script command 0x93 ; script command 0x93
xor a xor a
ld [wd43c], a ld [wScriptStackSize], a
ld [ScriptRunning], a ld [ScriptRunning], a
ld a, SCRIPT_OFF ld a, SCRIPT_OFF
ld [ScriptMode], a ld [ScriptMode], a
@ -3231,22 +3240,22 @@ Script_wait: ; 0x97c05
call DelayFrames call DelayFrames
pop af pop af
dec a dec a
jr nz, .loop ; 0x97c11 $f6 jr nz, .loop
pop bc pop bc
ret ret
; 0x97c15 ; 0x97c15
Script_unknown0xa9: ; 0x97c15 Script_check_save: ; 0x97c15
; script command 0xa9 ; script command 0xa9
callba Function4cffe callba CheckSave
ld a, c ld a, c
ld [ScriptVar], a ld [ScriptVar], a
ret ret
; 0x97c20 ; 0x97c20
Function97c20: ; 97c20 unreferenced ; 97c20 unreferenced
ld a, [.byte] ld a, [.byte]
ld [ScriptVar], a ld [ScriptVar], a
ret ret

View File

@ -1068,7 +1068,7 @@ wait: macro
db \1 ; duration db \1 ; duration
endm endm
enum unknown0xa9_command enum check_save_command
unknown0xa9: macro check_save: macro
db unknown0xa9_command db check_save_command
endm endm

146
main.asm
View File

@ -2154,7 +2154,7 @@ Function6ec1: ; 6ec1
push hl push hl
push bc push bc
call Function7009 call WillPersonBumpIntoSomeoneElse
pop bc pop bc
pop hl pop hl
ret c ret c
@ -2163,12 +2163,12 @@ Function6ec1: ; 6ec1
bit 5, [hl] bit 5, [hl]
jr nz, .bit_5 jr nz, .bit_5
push hl push hl
call Function70a4 call HasPersonReachedMovementLimit
pop hl pop hl
ret c ret c
push hl push hl
call Function70ed call IsPersonMovingOffEdgeOfScreen
pop hl pop hl
ret c ret c
@ -2388,7 +2388,7 @@ CheckFacingObject:: ; 6fd9
; 7009 ; 7009
Function7009: ; 7009 WillPersonBumpIntoSomeoneElse: ; 7009
ld hl, OBJECT_NEXT_MAP_X ld hl, OBJECT_NEXT_MAP_X
add hl, bc add hl, bc
ld d, [hl] ld d, [hl]
@ -2401,11 +2401,11 @@ Function7009: ; 7009
Function7015: ; unreferenced Function7015: ; unreferenced
ld a, [hMapObjectIndexBuffer] ld a, [hMapObjectIndexBuffer]
call GetObjectStruct call GetObjectStruct
call Function7021 call .CheckWillBeFacingNPC
call IsNPCAtCoord call IsNPCAtCoord
ret ret
Function7021: ; 7021 .CheckWillBeFacingNPC: ; 7021
ld hl, OBJECT_NEXT_MAP_X ld hl, OBJECT_NEXT_MAP_X
add hl, bc add hl, bc
ld d, [hl] ld d, [hl]
@ -2510,14 +2510,14 @@ IsNPCAtCoord: ; 7041
ret ret
; 70a4 ; 70a4
Function70a4: ; 70a4 HasPersonReachedMovementLimit: ; 70a4
ld hl, OBJECT_RADIUS ld hl, OBJECT_RADIUS
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
and a and a
jr z, .asm_70e9 jr z, .nope
and $f and $f
jr z, .asm_70c7 jr z, .check_y
ld e, a ld e, a
ld d, a ld d, a
ld hl, OBJECT_INIT_X ld hl, OBJECT_INIT_X
@ -2532,17 +2532,17 @@ Function70a4: ; 70a4
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
cp d cp d
jr z, .asm_70eb jr z, .yes
cp e cp e
jr z, .asm_70eb jr z, .yes
.asm_70c7 .check_y
ld hl, OBJECT_RADIUS ld hl, OBJECT_RADIUS
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
swap a swap a
and $f and $f
jr z, .asm_70e9 jr z, .nope
ld e, a ld e, a
ld d, a ld d, a
ld hl, OBJECT_INIT_Y ld hl, OBJECT_INIT_Y
@ -2557,46 +2557,46 @@ Function70a4: ; 70a4
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
cp d cp d
jr z, .asm_70eb jr z, .yes
cp e cp e
jr z, .asm_70eb jr z, .yes
.asm_70e9 .nope
xor a xor a
ret ret
.asm_70eb .yes
scf scf
ret ret
; 70ed ; 70ed
Function70ed: ; 70ed IsPersonMovingOffEdgeOfScreen: ; 70ed
ld hl, OBJECT_NEXT_MAP_X ld hl, OBJECT_NEXT_MAP_X
add hl, bc add hl, bc
ld a, [XCoord] ld a, [XCoord]
cp [hl] cp [hl]
jr z, .asm_70fe jr z, .check_y
jr nc, .asm_7111 jr nc, .yes
add $9 add $9
cp [hl] cp [hl]
jr c, .asm_7111 jr c, .yes
.asm_70fe .check_y
ld hl, OBJECT_NEXT_MAP_Y ld hl, OBJECT_NEXT_MAP_Y
add hl, bc add hl, bc
ld a, [YCoord] ld a, [YCoord]
cp [hl] cp [hl]
jr z, .asm_710f jr z, .nope
jr nc, .asm_7111 jr nc, .yes
add $8 add $8
cp [hl] cp [hl]
jr c, .asm_7111 jr c, .yes
.asm_710f .nope
and a and a
ret ret
.asm_7111 .yes
scf scf
ret ret
; 7113 ; 7113
@ -2611,46 +2611,46 @@ Function7113: ; unreferenced
.loop .loop
ld [hObjectStructIndexBuffer], a ld [hObjectStructIndexBuffer], a
call GetObjectSprite call GetObjectSprite
jr z, .asm_7160 jr z, .next
ld hl, OBJECT_MOVEMENTTYPE ld hl, OBJECT_MOVEMENTTYPE
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
cp SPRITEMOVEDATA_SNORLAX cp SPRITEMOVEDATA_SNORLAX
jr nz, .asm_7136 jr nz, .not_snorlax
call Function7171 call Function7171
jr c, .asm_716f jr c, .yes
jr .asm_7160 jr .next
.asm_7136 .not_snorlax
ld hl, OBJECT_NEXT_MAP_Y ld hl, OBJECT_NEXT_MAP_Y
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
cp e cp e
jr nz, .asm_714e jr nz, .check_current_coords
ld hl, OBJECT_NEXT_MAP_X ld hl, OBJECT_NEXT_MAP_X
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
cp d cp d
jr nz, .asm_714e jr nz, .check_current_coords
ld a, [hObjectStructIndexBuffer] ld a, [hObjectStructIndexBuffer]
cp $0 cp $0
jr z, .asm_7160 jr z, .next
jr .asm_716f jr .yes
.asm_714e .check_current_coords
ld hl, OBJECT_MAP_Y ld hl, OBJECT_MAP_Y
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
cp e cp e
jr nz, .asm_7160 jr nz, .next
ld hl, OBJECT_MAP_X ld hl, OBJECT_MAP_X
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
cp d cp d
jr nz, .asm_7160 jr nz, .next
jr .asm_716f jr .yes
.asm_7160 .next
ld hl, OBJECT_STRUCT_LENGTH ld hl, OBJECT_STRUCT_LENGTH
add hl, bc add hl, bc
ld b, h ld b, h
@ -2662,7 +2662,7 @@ Function7113: ; unreferenced
xor a xor a
ret ret
.asm_716f .yes
scf scf
ret ret
; 7171 ; 7171
@ -2673,20 +2673,20 @@ Function7171: ; 7171
add hl, bc add hl, bc
ld a, d ld a, d
sub [hl] sub [hl]
jr c, .asm_718b jr c, .nope
cp $2 cp $2
jr nc, .asm_718b jr nc, .nope
ld hl, OBJECT_NEXT_MAP_Y ld hl, OBJECT_NEXT_MAP_Y
add hl, bc add hl, bc
ld a, e ld a, e
sub [hl] sub [hl]
jr c, .asm_718b jr c, .nope
cp $2 cp $2
jr nc, .asm_718b jr nc, .nope
scf scf
ret ret
.asm_718b .nope
and a and a
ret ret
; 718d ; 718d
@ -3221,14 +3221,14 @@ GetSpawnCoord: ; 8029
call GetMapObject call GetMapObject
ld hl, MAPOBJECT_COLOR ld hl, MAPOBJECT_COLOR
add hl, bc add hl, bc
ln e, (1 << 3) | PAL_OW_RED, $0 ln e, (1 << 3) | PAL_OW_RED, PERSONTYPE_SCRIPT
ld a, [wPlayerSpriteSetupFlags] ld a, [wPlayerSpriteSetupFlags]
bit 2, a bit 2, a
jr nz, .ok jr nz, .ok
ld a, [PlayerGender] ld a, [PlayerGender]
bit 0, a bit 0, a
jr z, .ok jr z, .ok
ln e, (1 << 3) | PAL_OW_BLUE, $0 ln e, (1 << 3) | PAL_OW_BLUE, PERSONTYPE_SCRIPT
.ok .ok
ld [hl], e ld [hl], e
@ -3239,8 +3239,8 @@ GetSpawnCoord: ; 8029
ld [hObjectStructIndexBuffer], a ld [hObjectStructIndexBuffer], a
ld de, ObjectStructs ld de, ObjectStructs
call CopyMapObjectToObjectStruct call CopyMapObjectToObjectStruct
ld a, $0 ld a, PLAYER
ld [wd4cf], a ld [wCenteredObject], a
ret ret
; 8071 ; 8071
@ -3322,7 +3322,7 @@ RefreshPlayerCoords: ; 80b8
ld e, a ld e, a
ld a, [wObjectFollow_Leader] ld a, [wObjectFollow_Leader]
cp $0 cp $0
ret nz ret nz ; wtf
ret ret
; 80e7 ; 80e7
@ -5306,15 +5306,15 @@ FlyFunction: ; ca3b
farscall Script_AbortBugContest farscall Script_AbortBugContest
special WarpToSpawnPoint special WarpToSpawnPoint
callasm DelayLoadingNewSprites callasm DelayLoadingNewSprites
writecode VAR_MOVEMENT, $0 writecode VAR_MOVEMENT, PLAYER_NORMAL
newloadmap MAPSETUP_FLY newloadmap MAPSETUP_FLY
callasm Function8cb33 callasm Function8cb33
special WaitSFX special WaitSFX
callasm Functioncacb callasm .ReturnFromFly
end end
; 0xcacb ; 0xcacb
Functioncacb: ; cacb .ReturnFromFly: ; cacb
callba Function561d callba Function561d
call DelayFrame call DelayFrame
call ReplaceKrisSprite call ReplaceKrisSprite
@ -5574,7 +5574,7 @@ UsedDigOrEscapeRopeScript: ; 0xcc3c
applymovement PLAYER, .DigOut applymovement PLAYER, .DigOut
farscall Script_AbortBugContest farscall Script_AbortBugContest
special WarpToSpawnPoint special WarpToSpawnPoint
writecode VAR_MOVEMENT, $0 writecode VAR_MOVEMENT, PLAYER_NORMAL
newloadmap MAPSETUP_DOOR newloadmap MAPSETUP_DOOR
playsound SFX_WARP_FROM playsound SFX_WARP_FROM
applymovement PLAYER, .DigReturn applymovement PLAYER, .DigReturn
@ -5671,7 +5671,7 @@ Script_UsedTeleport: ; 0xccbb
applymovement PLAYER, .TeleportFrom applymovement PLAYER, .TeleportFrom
farscall Script_AbortBugContest farscall Script_AbortBugContest
special WarpToSpawnPoint special WarpToSpawnPoint
writecode VAR_MOVEMENT, $0 writecode VAR_MOVEMENT, PLAYER_NORMAL
newloadmap MAPSETUP_TELEPORT newloadmap MAPSETUP_TELEPORT
playsound SFX_WARP_FROM playsound SFX_WARP_FROM
applymovement PLAYER, .TeleportTo applymovement PLAYER, .TeleportTo
@ -6336,17 +6336,17 @@ Script_NotEvenANibble_FallThrough: ; 0xd02d
Script_GotABite: ; 0xd035 Script_GotABite: ; 0xd035
scall Script_FishCastRod scall Script_FishCastRod
callasm Fishing_CheckFacingUp callasm Fishing_CheckFacingUp
iffalse .FacingUp iffalse .NotFacingUp
applymovement PLAYER, MovementData_0xd062 applymovement PLAYER, .Movement_FacingUp
jump .FightTheHookedPokemon jump .FightTheHookedPokemon
; 0xd046 ; 0xd046
.FacingUp: ; 0xd046 .NotFacingUp: ; 0xd046
applymovement PLAYER, MovementData_0xd05c applymovement PLAYER, .Movement_NotFacingUp
.FightTheHookedPokemon: ; 0xd04a .FightTheHookedPokemon: ; 0xd04a
pause 40 pause 40
applymovement PLAYER, MovementData_0xd069 applymovement PLAYER, .Movement_RestoreRod
writetext UnknownText_0xd0a4 writetext UnknownText_0xd0a4
callasm PutTheRodAway callasm PutTheRodAway
loadmovesprites loadmovesprites
@ -6356,7 +6356,7 @@ Script_GotABite: ; 0xd035
end end
; 0xd05c ; 0xd05c
MovementData_0xd05c: ; d05c .Movement_NotFacingUp: ; d05c
fish_got_bite fish_got_bite
fish_got_bite fish_got_bite
fish_got_bite fish_got_bite
@ -6365,7 +6365,7 @@ MovementData_0xd05c: ; d05c
step_end step_end
; d062 ; d062
MovementData_0xd062: ; d062 .Movement_FacingUp: ; d062
fish_got_bite fish_got_bite
fish_got_bite fish_got_bite
fish_got_bite fish_got_bite
@ -6375,7 +6375,7 @@ MovementData_0xd062: ; d062
step_end step_end
; d069 ; d069
MovementData_0xd069: ; d069 .Movement_RestoreRod: ; d069
hide_emote hide_emote
fish_cast_rod fish_cast_rod
step_end step_end
@ -6384,7 +6384,7 @@ MovementData_0xd069: ; d069
Fishing_CheckFacingUp: ; d06c Fishing_CheckFacingUp: ; d06c
ld a, [PlayerDirection] ld a, [PlayerDirection]
and $c and $c
cp $4 cp OW_UP
ld a, $1 ld a, $1
jr z, .up jr z, .up
xor a xor a
@ -6532,7 +6532,7 @@ BikeFunction: ; d0b3
Script_GetOnBike: ; 0xd13e Script_GetOnBike: ; 0xd13e
reloadmappart reloadmappart
special UpdateTimePals special UpdateTimePals
writecode VAR_MOVEMENT, $1 writecode VAR_MOVEMENT, PLAYER_BIKE
writetext UnknownText_0xd17c writetext UnknownText_0xd17c
closetext closetext
loadmovesprites loadmovesprites
@ -6541,7 +6541,7 @@ Script_GetOnBike: ; 0xd13e
; 0xd14e ; 0xd14e
Script_GetOnBike_Register: ; 0xd14e Script_GetOnBike_Register: ; 0xd14e
writecode VAR_MOVEMENT, $1 writecode VAR_MOVEMENT, PLAYER_BIKE
loadmovesprites loadmovesprites
special ReplaceKrisSprite special ReplaceKrisSprite
end end
@ -6554,11 +6554,11 @@ Functiond156: ; unreferenced
Script_GetOffBike: ; 0xd158 Script_GetOffBike: ; 0xd158
reloadmappart reloadmappart
special UpdateTimePals special UpdateTimePals
writecode VAR_MOVEMENT, $0 writecode VAR_MOVEMENT, PLAYER_NORMAL
writetext UnknownText_0xd181 writetext UnknownText_0xd181
closetext closetext
UnknownScript_0xd163: FinishGettingOffBike:
loadmovesprites loadmovesprites
special ReplaceKrisSprite special ReplaceKrisSprite
special PlayMapMusic special PlayMapMusic
@ -6566,8 +6566,8 @@ UnknownScript_0xd163:
; 0xd16b ; 0xd16b
Script_GetOffBike_Register: ; 0xd16b Script_GetOffBike_Register: ; 0xd16b
writecode VAR_MOVEMENT, $0 writecode VAR_MOVEMENT, PLAYER_NORMAL
jump UnknownScript_0xd163 jump FinishGettingOffBike
; 0xd171 ; 0xd171
UnknownScript_0xd171: ; 0xd171 UnknownScript_0xd171: ; 0xd171
@ -29402,7 +29402,7 @@ endr
ret ret
Function4cffe:: ; 4cffe CheckSave:: ; 4cffe
ld a, BANK(s1_a008) ld a, BANK(s1_a008)
call GetSRAMBank call GetSRAMBank
ld a, [s1_a008] ld a, [s1_a008]

View File

@ -62,7 +62,7 @@ SECTION "SRAM Bank 1", SRAM, BANK [1]
sOptions:: ds OptionsEnd - Options sOptions:: ds OptionsEnd - Options
s1_a008:: ds 1 s1_a008:: ds 1 ; loaded with 99, used to check save corruption
sGameData:: sGameData::
sPlayerData:: ds wPlayerDataEnd - wPlayerData sPlayerData:: ds wPlayerDataEnd - wPlayerData
@ -75,7 +75,7 @@ sGameDataEnd::
; ad0d ; ad0d
sChecksum:: ds 2 sChecksum:: ds 2
s1_ad0f:: ds 1 s1_ad0f:: ds 1 ; loaded with 0x7f, used to check save corruption
; ad10 ; ad10
box sBox box sBox

View File

@ -2108,9 +2108,13 @@ ScriptBank:: ; d439
ScriptPos:: ; d43a ScriptPos:: ; d43a
ds 2 ds 2
wd43c:: ds 1 wScriptStackSize:: ds 1
wd43d:: ds 16 wScriptStackBA1:: ds 3
wScriptStackBA2:: ds 3
wScriptStackBA3:: ds 3
wScriptStackBA4:: ds 3
wScriptStackBA5:: ds 3
ds 1
ScriptDelay:: ; d44d ScriptDelay:: ; d44d
ds 1 ds 1
@ -2201,7 +2205,7 @@ CurDay:: ; d4cb
ds 1 ds 1
wObjectFollow_Leader:: ds 1 wObjectFollow_Leader:: ds 1
wObjectFollow_Follower:: ds 1 wObjectFollow_Follower:: ds 1
wd4cf:: ds 1 wCenteredObject:: ds 1
wd4d0:: ds 1 wd4d0:: ds 1
wd4d1:: ds 1 wd4d1:: ds 1
ds 4 ds 4