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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -2875,7 +2875,7 @@ Function56a3: ; 56a3
; 56cd ; 56cd
Function56cd: ; 56cd Function56cd: ; 56cd
ld a, [wd14c] ld a, [wFollowNotExactPersonX]
ld d, a ld d, a
ld hl, OBJECT_SPRITE_X_OFFSET ld hl, OBJECT_SPRITE_X_OFFSET
add hl, bc add hl, bc
@@ -2907,7 +2907,7 @@ Function56cd: ; 56cd
.ok3 .ok3
ld [hUsedSpriteIndex], a ld [hUsedSpriteIndex], a
ld a, [wd14d] ld a, [wFollowNotExactPersonY]
ld e, a ld e, a
ld hl, OBJECT_SPRITE_Y_OFFSET ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc add hl, bc
@@ -3357,9 +3357,9 @@ Function5958: ; 5958
push hl push hl
push de push de
push bc push bc
ld a, [wd14c] ld a, [wFollowNotExactPersonX]
ld d, a ld d, a
ld a, [wd14d] ld a, [wFollowNotExactPersonY]
ld e, a ld e, a
ld bc, ObjectStructs ld bc, ObjectStructs
ld a, NUM_OBJECT_STRUCTS ld a, NUM_OBJECT_STRUCTS
@@ -3391,8 +3391,8 @@ Function5958: ; 5958
jr nz, .loop jr nz, .loop
xor a xor a
ld [wd14c], a ld [wFollowNotExactPersonX], a
ld [wd14d], a ld [wFollowNotExactPersonY], a
pop bc pop bc
pop de pop de
pop hl pop hl
@@ -3544,7 +3544,7 @@ PRIORITY_HIGH EQU $30
add 8 add 8
ld e, a ld e, a
ld a, [wd14c] ld a, [wFollowNotExactPersonX]
add e add e
ld [hFFBF], a ld [hFFBF], a
@@ -3559,7 +3559,7 @@ PRIORITY_HIGH EQU $30
add 12 add 12
ld e, a ld e, a
ld a, [wd14d] ld a, [wFollowNotExactPersonY]
add e add e
ld [hFFC0], a 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 ld [wJumptableIndex], a
ret ret
; 10364 (4:4364) ; 10364 (4:4364)
TossMenu: ; 10364 TossMenu: ; 10364
ld hl, Text_ThrowAwayHowMany ld hl, Text_ThrowAwayHowMany
call Pack_PrintTextNoScroll call Pack_PrintTextNoScroll
@@ -534,7 +535,7 @@ TossMenu: ; 10364
ret ret
; 1039d ; 1039d
Function1039d: ; 1039d ResetPocketCursorPositions: ; 1039d
; unreferenced ; unreferenced
ld a, [wCurrPocket] ld a, [wCurrPocket]
and a 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 .shutdown
call PC_PlayShutdownSound call PC_PlayShutdownSound
call ExitMenu call ExitMenu
call WriteBackup call CloseWindow
ret ret
; 155d6 ; 155d6

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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