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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

146
main.asm
View File

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

View File

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

View File

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