writebackup --> closewindow; game corner prize vendors; others

This commit is contained in:
PikalaxALT 2015-12-24 22:58:42 -05:00
parent 1df28a6beb
commit a5e928eb98
44 changed files with 2604 additions and 2600 deletions

View File

@ -2932,7 +2932,7 @@ ForcePlayerMonChoice: ; 3d227
call ClearPalettes
call DelayFrame
call _LoadHPBar
call WriteBackup
call CloseWindow
call GetMemSGBLayout
call SetPalettes
call SendOutPkmnText
@ -5368,7 +5368,7 @@ BattleMenuPKMN_Loop:
call ClearPalettes
call DelayFrame
call _LoadHPBar
call WriteBackup
call CloseWindow
call LoadTileMapToTempTileMap
call GetMemSGBLayout
call SetPalettes
@ -5451,7 +5451,7 @@ TryPlayerSwitch: ; 3e358
call DelayFrame
call ClearSprites
call _LoadHPBar
call WriteBackup
call CloseWindow
call GetMemSGBLayout
call SetPalettes
ld a, [CurPartyMon]
@ -5464,7 +5464,7 @@ PlayerSwitch: ; 3e3ad
jr z, .not_linked
call LoadStandardMenuDataHeader
call LinkBattleSendReceiveAction
call WriteBackup
call CloseWindow
.not_linked
call ParseEnemyAction

View File

@ -8961,7 +8961,7 @@ BattleCommand_BatonPass: ; 379c9
; Return to battle scene
call ClearPalettes
callba _LoadBattleFontsHPBar
call WriteBackup
call CloseWindow
call ClearSprites
hlcoord 1, 0
lb bc, 4, 10
@ -9030,7 +9030,7 @@ BatonPass_LinkPlayerSwitch: ; 37a67
call LoadStandardMenuDataHeader
ld hl, LinkBattleSendReceiveAction
call CallBattleCore
call WriteBackup
call CloseWindow
xor a
ld [wPlayerAction], a
@ -9061,7 +9061,7 @@ BatonPass_LinkEnemySwitch: ; 37a82
add BATTLEACTION_SWITCH1
ld [wBattleAction], a
.switch
jp WriteBackup
jp CloseWindow
; 37aab

View File

@ -2331,7 +2331,7 @@ _ChangeBox: ; e35aa (38:75aa)
call BillsPC_ChangeBoxSubmenu
jr .loop
.done
call WriteBackup
call CloseWindow
ret
BillsPC_ClearTilemap: ; e35e2 (38:75e2)

View File

@ -201,7 +201,7 @@ DoEggStep:: ; 16f3e
; 16f5e
OverworldHatchEgg:: ; 16f5e
call ResetWindow
call RefreshScreen
call LoadStandardMenuDataHeader
call HatchEggs
call ExitAllMenus

View File

@ -228,28 +228,27 @@ HandleMapTimeAndJoypad: ; 967c1
Function967d1: ; 967d1
callba Function576a ; engine/map_objects.asm
callba Functiond497
call Function96812
callba _HandlePlayerStep
call _CheckObjectEnteringVisibleRange
ret
; 967e1
Function967e1: ; 967e1
callba _UpdateSprites
callba Functiond4d2
callba ScrollScreen
callba PlaceMapNameSign
ret
; 967f4
Function967f4: ; 967f4
ld a, [wPlayerStepFlags]
bit 5, a
bit 5, a ; in the middle of step
jr z, .events
bit 6, a
bit 6, a ; stopping step
jr z, .noevents
bit 4, a
bit 4, a ; in midair
jr nz, .noevents
call EnableEvents
.events
ld a, 0 ; events
ld [MapEventStatus], a
@ -261,17 +260,15 @@ Function967f4: ; 967f4
ret
; 96812
Function96812: ; 96812
_CheckObjectEnteringVisibleRange: ; 96812
ld hl, wPlayerStepFlags
bit 6, [hl]
ret z
callba Function81ca
callba CheckObjectEnteringVisibleRange
ret
; 9681f
PlayerEvents: ; 9681f
xor a
; If there's already a player event, don't interrupt it.
ld a, [ScriptRunning]

View File

@ -34,7 +34,7 @@ InitGender: ; 48dcb (12:4dcb)
call LoadMenuDataHeader
call WaitBGMap2
call VerticalMenu
call WriteBackup
call CloseWindow
ld a, [wMenuCursorY]
dec a
ld [PlayerGender], a

View File

@ -362,13 +362,13 @@ Continue: ; 5d65
call DelayFrames
call ConfirmContinue
jr nc, .Check1Pass
call WriteBackup
call CloseWindow
jr .FailToLoad
.Check1Pass
call Continue_CheckRTC_RestartClock
jr nc, .Check2Pass
call WriteBackup
call CloseWindow
jr .FailToLoad
.Check2Pass
@ -380,7 +380,7 @@ Continue: ; 5d65
ld [MusicFadeIDHi], a
call ClearBGPalettes
call Continue_MobileAdapterMenu
call WriteBackup
call CloseWindow
call ClearTileMap
ld c, 20
call DelayFrames
@ -832,7 +832,7 @@ Function60e9: ; Unreferenced
ld a, [wMenuCursorY]
dec a
call CopyNameFromMenu
call WriteBackup
call CloseWindow
ret
; 60fa

View File

@ -315,7 +315,7 @@ _KrisMailBoxMenu: ; 0x447a0
jr z, .nomail
call LoadStandardMenuDataHeader
call MailboxPC
jp WriteBackup
jp CloseWindow
.nomail
ld hl, .EmptyMailboxText

View File

@ -17,7 +17,7 @@ MainMenu: ; 49cdc
ld hl, .MenuDataHeader
call LoadMenuDataHeader
call MainMenuJoypadLoop
call WriteBackup
call CloseWindow
jr c, .quit
call ClearTileMap
ld a, [MenuSelection]

View File

@ -2875,7 +2875,7 @@ Function56a3: ; 56a3
; 56cd
Function56cd: ; 56cd
ld a, [wd14c]
ld a, [wFollowNotExactPersonX]
ld d, a
ld hl, OBJECT_SPRITE_X_OFFSET
add hl, bc
@ -2907,7 +2907,7 @@ Function56cd: ; 56cd
.ok3
ld [hUsedSpriteIndex], a
ld a, [wd14d]
ld a, [wFollowNotExactPersonY]
ld e, a
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
@ -3357,9 +3357,9 @@ Function5958: ; 5958
push hl
push de
push bc
ld a, [wd14c]
ld a, [wFollowNotExactPersonX]
ld d, a
ld a, [wd14d]
ld a, [wFollowNotExactPersonY]
ld e, a
ld bc, ObjectStructs
ld a, NUM_OBJECT_STRUCTS
@ -3391,8 +3391,8 @@ Function5958: ; 5958
jr nz, .loop
xor a
ld [wd14c], a
ld [wd14d], a
ld [wFollowNotExactPersonX], a
ld [wFollowNotExactPersonY], a
pop bc
pop de
pop hl
@ -3544,7 +3544,7 @@ PRIORITY_HIGH EQU $30
add 8
ld e, a
ld a, [wd14c]
ld a, [wFollowNotExactPersonX]
add e
ld [hFFBF], a
@ -3559,7 +3559,7 @@ PRIORITY_HIGH EQU $30
add 12
ld e, a
ld a, [wd14d]
ld a, [wFollowNotExactPersonY]
add e
ld [hFFC0], a

1808
engine/move_mon.asm Executable file

File diff suppressed because it is too large Load Diff

View File

@ -508,6 +508,7 @@ UseItem: ; 10311
ld [wJumptableIndex], a
ret
; 10364 (4:4364)
TossMenu: ; 10364
ld hl, Text_ThrowAwayHowMany
call Pack_PrintTextNoScroll
@ -534,7 +535,7 @@ TossMenu: ; 10364
ret
; 1039d
Function1039d: ; 1039d
ResetPocketCursorPositions: ; 1039d
; unreferenced
ld a, [wCurrPocket]
and a

271
engine/player_step.asm Executable file
View File

@ -0,0 +1,271 @@
_HandlePlayerStep:: ; d497 (3:5497)
ld a, [wPlayerStepFlags]
and a
ret z
bit 7, a ; starting step
jr nz, .update_overworld_map
bit 6, a ; finishing step
jr nz, .update_player_coords
bit 5, a ; ongoing step
jr nz, .finish
ret
.update_overworld_map
ld a, 4
ld [wHandlePlayerStep], a
call UpdateOverworldMap
jr .finish
.update_player_coords
call UpdatePlayerCoords
jr .finish
.finish
call HandlePlayerStep
ld a, [wPlayerStepVectorX]
ld d, a
ld a, [wPlayerStepVectorY]
ld e, a
ld a, [wFollowNotExactPersonX]
sub d
ld [wFollowNotExactPersonX], a
ld a, [wFollowNotExactPersonY]
sub e
ld [wFollowNotExactPersonY], a
ret
ScrollScreen:: ; d4d2 (3:54d2)
ld a, [wPlayerStepVectorX]
ld d, a
ld a, [wPlayerStepVectorY]
ld e, a
ld a, [hSCX]
add d
ld [hSCX], a
ld a, [hSCY]
add e
ld [hSCY], a
ret
HandlePlayerStep: ; d4e5 (3:54e5)
ld hl, wHandlePlayerStep
ld a, [hl]
and a
ret z
dec [hl]
ld a, [hl]
ld hl, .Jumptable
rst JumpTable
ret
.Jumptable: ; d4f2 (3:54f2)
jumptable_start
jumptable GetMovementPermissions
jumptable BufferScreen
jumptable .mobile
jumptable .fail2
; The rest are never used. Ever.
jumptable .fail1
jumptable .fail1
jumptable .fail1
jumptable .fail1
jumptable .fail1
jumptable .fail1
jumptable .fail1
.fail1: ; d508 (3:5508)
ret
.mobile: ; d509 (3:5509)
callba MobileFn_10602e
ret
.fail2: ; d510 (3:5510)
ret
UpdatePlayerCoords: ; d511 (3:5511)
ld a, [wPlayerStepDirection]
and a
jr nz, .check_step_down
ld hl, YCoord
inc [hl]
ret
.check_step_down
cp UP
jr nz, .check_step_left
ld hl, YCoord
dec [hl]
ret
.check_step_left
cp LEFT
jr nz, .check_step_right
ld hl, XCoord
dec [hl]
ret
.check_step_right
cp RIGHT
ret nz
ld hl, XCoord
inc [hl]
ret
UpdateOverworldMap: ; d536 (3:5536)
ld a, [wPlayerStepDirection]
and a
jr z, .step_down
cp UP
jr z, .step_up
cp LEFT
jr z, .step_left
cp RIGHT
jr z, .step_right
ret
.step_down
call .ScrollOverworldMapDown
call LoadMapPart
call ScrollMapUp
ret
.step_up
call .ScrollOverworldMapUp
call LoadMapPart
call ScrollMapDown
ret
.step_left
call .ScrollOverworldMapLeft
call LoadMapPart
call ScrollMapRight
ret
.step_right
call .ScrollOverworldMapRight
call LoadMapPart
call ScrollMapLeft
ret
.ScrollOverworldMapDown: ; d571 (3:5571)
ld a, [wBGMapAnchor]
add 2 * BG_MAP_WIDTH
ld [wBGMapAnchor], a
jr nc, .not_overflowed
ld a, [wBGMapAnchor + 1]
inc a
and $3
or VBGMap0 / $100
ld [wBGMapAnchor + 1], a
.not_overflowed
ld hl, wMetatileStandingY
inc [hl]
ld a, [hl]
cp 2 ; was 1
jr nz, .done_down
ld [hl], 0
call .Add6ToOverworldMapAnchor
.done_down
ret
.Add6ToOverworldMapAnchor: ; d595 (3:5595)
ld hl, wOverworldMapAnchor
ld a, [MapWidth]
add 6
add [hl]
ld [hli], a
ret nc
inc [hl]
ret
.ScrollOverworldMapUp: ; d5a2 (3:55a2)
ld a, [wBGMapAnchor]
sub 2 * BG_MAP_WIDTH
ld [wBGMapAnchor], a
jr nc, .not_underflowed
ld a, [wBGMapAnchor + 1]
dec a
and $3
or VBGMap0 / $100
ld [wBGMapAnchor + 1], a
.not_underflowed
ld hl, wMetatileStandingY
dec [hl]
ld a, [hl]
cp -1 ; was 0
jr nz, .done_up
ld [hl], $1
call .Sub6FromOverworldMapAnchor
.done_up
ret
.Sub6FromOverworldMapAnchor: ; d5c6 (3:55c6)
ld hl, wOverworldMapAnchor
ld a, [MapWidth]
add 6
ld b, a
ld a, [hl]
sub b
ld [hli], a
ret nc
dec [hl]
ret
.ScrollOverworldMapLeft: ; d5d5 (3:55d5)
ld a, [wBGMapAnchor]
ld e, a
and $e0
ld d, a
ld a, e
sub $2
and $1f
or d
ld [wBGMapAnchor], a
ld hl, wMetatileStandingX
dec [hl]
ld a, [hl]
cp -1
jr nz, .done_left
ld [hl], 1
call .DecrementwOverworldMapAnchor
.done_left
ret
.DecrementwOverworldMapAnchor: ; d5f4 (3:55f4)
ld hl, wOverworldMapAnchor
ld a, [hl]
sub 1
ld [hli], a
ret nc
dec [hl]
ret
.ScrollOverworldMapRight: ; d5fe (3:55fe)
ld a, [wBGMapAnchor]
ld e, a
and $e0
ld d, a
ld a, e
add $2
and $1f
or d
ld [wBGMapAnchor], a
ld hl, wMetatileStandingX
inc [hl]
ld a, [hl]
cp 2
jr nz, .done_right
ld [hl], 0
call .IncrementwOverworldMapAnchor
.done_right
ret
.IncrementwOverworldMapAnchor: ; d61d (3:561d)
ld hl, wOverworldMapAnchor
ld a, [hl]
add 1
ld [hli], a
ret nc
inc [hl]
ret

View File

@ -23,7 +23,7 @@ PokemonCenterPC: ; 1559a
.shutdown
call PC_PlayShutdownSound
call ExitMenu
call WriteBackup
call CloseWindow
ret
; 155d6

View File

@ -215,7 +215,7 @@ SaveTheGame_yesorno: ; 14baf
call PlaceYesNoBox
ld a, [wMenuCursorY]
dec a
call WriteBackup
call CloseWindow
push af
call ret_d90
pop af

View File

@ -150,7 +150,7 @@ ScriptCommandTable: ; 96cb1
dw Script_repeattext ; 4d
dw Script_yesorno ; 4e
dw Script_loadmenudata ; 4f
dw Script_writebackup ; 50
dw Script_closewindow ; 50
dw Script_jumptextfaceplayer ; 51
IF _CRYSTAL
dw Script_farjumptext ; 52
@ -480,10 +480,10 @@ Script_loadmenudata: ; 96efa
ret
; 96f0f
Script_writebackup: ; 96f0f
Script_closewindow: ; 96f0f
; script command 0x50
call WriteBackup
call CloseWindow
call UpdateSprites
ret
; 96f16
@ -3038,7 +3038,7 @@ Script_refreshscreen: ; 97b20
; parameters:
; dummy (SingleByteParam)
call ResetWindow
call RefreshScreen
call GetScriptByte
ret
; 97b27

View File

@ -155,7 +155,7 @@ UseRegisteredItem: ; 133c3
; 133f5
.Party ; 133f5
call ResetWindow
call RefreshScreen
call FadeToMenu
call DoItemEffect
call CloseSubmenu
@ -165,7 +165,7 @@ UseRegisteredItem: ; 133c3
; 13406
.Overworld ; 13406
call ResetWindow
call RefreshScreen
ld a, 1
ld [wUsingItemWithSelect], a
call DoItemEffect
@ -181,7 +181,7 @@ UseRegisteredItem: ; 133c3
; 13422
.CantUse ; 13422
call ResetWindow
call RefreshScreen
._cantuse
call CantUseItem

View File

@ -1712,7 +1712,7 @@ Slots_AskBet: ; 9307c (24:707c)
ld hl, .MenuDataHeader
call LoadMenuDataHeader
call VerticalMenu
call WriteBackup
call CloseWindow
ret c
ld a, [wMenuCursorY]
ld b, a
@ -1802,7 +1802,7 @@ Slots_AskPlayAgain: ; 930e9 (24:70e9)
call PlaceYesNoBox
ld a, [wMenuCursorY]
dec a
call WriteBackup
call CloseWindow
and a
jr nz, .exit_slots
and a

View File

@ -604,7 +604,7 @@ Function129f4: ; 129f4
call MenuTextBox
callba SelectQuantityToToss
push af
call WriteBackup
call CloseWindow
call ExitMenu
pop af
jr c, .asm_12a42
@ -1322,7 +1322,7 @@ MonMenu_Whirlpool: ; 12e7f
; 12e94
MonMenu_Waterfall: ; 12e94
callba Functioncade
callba WaterfallFunction
ld a, [wFieldMoveSucceeded]
cp $1
jr nz, .Fail

View File

@ -1811,7 +1811,7 @@ CoinVendor_SellCoinsMenuScript: ; 0xbcde4
special Special_DisplayMoneyAndCoinBalance
loadmenudata CoinVendor_MenuDataHeader
verticalmenu
writebackup
closewindow
if_equal $1, CoinVendor_Buy50CoinsScript
if_equal $2, CoinVendor_Buy500CoinsScript
jump CoinVendor_CancelScript

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