diff options
Diffstat (limited to 'scripts')
116 files changed, 545 insertions, 545 deletions
| diff --git a/scripts/agatha.asm b/scripts/agatha.asm index b31fc412..a8f9e137 100755 --- a/scripts/agatha.asm +++ b/scripts/agatha.asm @@ -24,7 +24,7 @@ AgathaScript_76443: ; 76443 (1d:6443)  AgathaScript_76459: ; 76459 (1d:6459)  	ld [wd09f], a  	ld bc, $2 -	predef_jump Func_ee9e +	predef_jump ReplaceTileBlock  AgathaScript_76464: ; 76464 (1d:6464)  	xor a @@ -33,7 +33,7 @@ AgathaScript_76464: ; 76464 (1d:6464)  AgathaScriptPointers: ; 76469 (1d:6469)  	dw AgathaScript0 -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw AgathaScript2  	dw AgathaScript3  	dw AgathaScript4 @@ -41,8 +41,8 @@ AgathaScriptPointers: ; 76469 (1d:6469)  AgathaScript4: ; 76473 (1d:6473)  	ret  asm_76474: ; 76474 (1d:6474) -	ld hl, wccd3 -	ld a, $40 +	ld hl, wSimulatedJoypadStatesEnd +	ld a, D_UP  	ld [hli], a  	ld [hli], a  	ld [hli], a @@ -50,8 +50,8 @@ asm_76474: ; 76474 (1d:6474)  	ld [hli], a  	ld [hl], a  	ld a, $6 -	ld [wcd38], a -	call Func_3486 +	ld [wSimulatedJoypadStatesIndex], a +	call StartSimulatingJoypadStates  	ld a, $3  	ld [W_AGATHACURSCRIPT], a  	ld [W_CURMAPSCRIPT], a @@ -64,8 +64,8 @@ AgathaScript0: ; 76490 (1d:6490)  	xor a  	ld [hJoyPressed], a  	ld [hJoyHeld], a -	ld [wccd3], a -	ld [wcd38], a +	ld [wSimulatedJoypadStatesEnd], a +	ld [wSimulatedJoypadStatesIndex], a  	ld a, [wWhichTrade] ; wWhichTrade  	cp $3  	jr c, .asm_764b4 @@ -77,11 +77,11 @@ AgathaScript0: ; 76490 (1d:6490)  	ld a, $2  	ld [H_DOWNARROWBLINKCNT2], a ; $ff8c  	call DisplayTextID -	ld a, $40 -	ld [wccd3], a +	ld a, D_UP +	ld [wSimulatedJoypadStatesEnd], a  	ld a, $1 -	ld [wcd38], a -	call Func_3486 +	ld [wSimulatedJoypadStatesIndex], a +	call StartSimulatingJoypadStates  	ld a, $3  	ld [W_AGATHACURSCRIPT], a  	ld [W_CURMAPSCRIPT], a @@ -95,7 +95,7 @@ CoordsData_764d1: ; 764d1 (1d:64d1)  	db $FF  AgathaScript3: ; 764da (1d:64da) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	call Delay3 diff --git a/scripts/battlecenterm.asm b/scripts/battlecenterm.asm index b65380d2..5ab697a1 100755 --- a/scripts/battlecenterm.asm +++ b/scripts/battlecenterm.asm @@ -9,7 +9,7 @@ BattleCenterMScript: ; 4fd10 (13:7d10)  	ld [$ff8d], a  	ld a, $1  	ld [$ff8c], a -	call Func_34ae +	call SetSpriteFacingDirection  	ld hl, wd72d  	bit 0, [hl]  	set 0, [hl] diff --git a/scripts/billshouse.asm b/scripts/billshouse.asm index 3a8a33c0..14882d1a 100755 --- a/scripts/billshouse.asm +++ b/scripts/billshouse.asm @@ -57,7 +57,7 @@ BillsHouseScript3: ; 1e7c5 (7:67c5)  	ld a, $f0  	ld [wJoyIgnore], a  	ld a, $2 -	ld [wcf13], a +	ld [wSpriteIndex], a  	ld a, $c  	ld [$ffeb], a  	ld a, $40 @@ -66,7 +66,7 @@ BillsHouseScript3: ; 1e7c5 (7:67c5)  	ld [$ffed], a  	ld a, $5  	ld [$ffee], a -	call Func_32f9 +	call SetSpritePosition1  	ld a, $62  	ld [wcc4d], a  	predef ShowObject diff --git a/scripts/bruno.asm b/scripts/bruno.asm index d0382fa4..ffe05bce 100755 --- a/scripts/bruno.asm +++ b/scripts/bruno.asm @@ -24,7 +24,7 @@ BrunoScript_762ec: ; 762ec (1d:62ec)  BrunoScript_76302: ; 76302 (1d:6302)  	ld [wd09f], a  	ld bc, $2 -	predef_jump Func_ee9e +	predef_jump ReplaceTileBlock  BrunoScript_7630d: ; 7630d (1d:630d)  	xor a @@ -33,7 +33,7 @@ BrunoScript_7630d: ; 7630d (1d:630d)  BrunoScriptPointers: ; 76312 (1d:6312)  	dw BrunoScript0 -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw BrunoScript2  	dw BrunoScript3  	dw BrunoScript4 @@ -41,8 +41,8 @@ BrunoScriptPointers: ; 76312 (1d:6312)  BrunoScript4: ; 7631c (1d:631c)  	ret  asm_7631d: ; 7631d (1d:631d) -	ld hl, wccd3 -	ld a, $40 +	ld hl, wSimulatedJoypadStatesEnd +	ld a, D_UP  	ld [hli], a  	ld [hli], a  	ld [hli], a @@ -50,8 +50,8 @@ asm_7631d: ; 7631d (1d:631d)  	ld [hli], a  	ld [hl], a  	ld a, $6 -	ld [wcd38], a -	call Func_3486 +	ld [wSimulatedJoypadStatesIndex], a +	call StartSimulatingJoypadStates  	ld a, $3  	ld [W_BRUNOCURSCRIPT], a  	ld [W_CURMAPSCRIPT], a @@ -64,8 +64,8 @@ BrunoScript0: ; 76339 (1d:6339)  	xor a  	ld [hJoyPressed], a  	ld [hJoyHeld], a -	ld [wccd3], a -	ld [wcd38], a +	ld [wSimulatedJoypadStatesEnd], a +	ld [wSimulatedJoypadStatesIndex], a  	ld a, [wWhichTrade] ; wWhichTrade  	cp $3  	jr c, .asm_7635d @@ -77,11 +77,11 @@ BrunoScript0: ; 76339 (1d:6339)  	ld a, $2  	ld [H_DOWNARROWBLINKCNT2], a ; $ff8c  	call DisplayTextID -	ld a, $40 -	ld [wccd3], a +	ld a, D_UP +	ld [wSimulatedJoypadStatesEnd], a  	ld a, $1 -	ld [wcd38], a -	call Func_3486 +	ld [wSimulatedJoypadStatesIndex], a +	call StartSimulatingJoypadStates  	ld a, $3  	ld [W_BRUNOCURSCRIPT], a  	ld [W_CURMAPSCRIPT], a @@ -95,7 +95,7 @@ CoordsData_7637a: ; 7637a (1d:637a)  	db $FF  BrunoScript3: ; 76383 (1d:6383) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	call Delay3 diff --git a/scripts/celadongamecorner.asm b/scripts/celadongamecorner.asm index 9746f54e..e8d90a5a 100755 --- a/scripts/celadongamecorner.asm +++ b/scripts/celadongamecorner.asm @@ -34,7 +34,7 @@ CeladonGameCornerScript_48bec: ; 48bec (12:4bec)  	ld a, $2a  	ld [wd09f], a  	ld bc, $0208 -	predef_jump Func_ee9e +	predef_jump ReplaceTileBlock  CeladonGameCornerScript_48c07: ; 48c07 (12:4c07)  	xor a @@ -236,7 +236,7 @@ CeladonGameCornerText5: ; 48d4a (12:4d4a)  	ld hl, wd77e  	set 2, [hl]  	ld a, $1 -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	ld hl, Received10CoinsText  	jr .asm_c7d1a ; 0x48d87  .asm_d0957 ; 0x48d89 @@ -409,9 +409,9 @@ CeladonGameCornerText11: ; 48e9d (12:4e9d)  	set 7, [hl]  	ld hl, CeladonGameCornerText_48ed3  	ld de, CeladonGameCornerText_48ed3 -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	ldh a, [$8c] -	ld [wcf13], a +	ld [wSpriteIndex], a  	call EngageMapTrainer  	call InitBattleEnemyParameters  	xor a @@ -437,7 +437,7 @@ CeladonGameCornerText13: ; 48ed8 (12:4ed8)  CeladonGameCornerText12: ; 48edd (12:4edd)  	db $08 ; asm  	ld a, $1 -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	ld hl, CeladonGameCornerText_48f09  	call PrintText  	call WaitForSoundToFinish @@ -449,7 +449,7 @@ CeladonGameCornerText12: ; 48edd (12:4edd)  	ld a, $43  	ld [wd09f], a  	ld bc, $0208 -	predef Func_ee9e +	predef ReplaceTileBlock  	jp TextScriptEnd  CeladonGameCornerText_48f09: ; 48f09 (12:4f09) diff --git a/scripts/celadongym.asm b/scripts/celadongym.asm index 6d44175e..b1b1060c 100755 --- a/scripts/celadongym.asm +++ b/scripts/celadongym.asm @@ -31,7 +31,7 @@ CeladonGymText_48943: ; 48943 (12:4943)  CeladonGymScriptPointers: ; 4894e (12:494e)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  	dw CeladonGymScript3 @@ -177,9 +177,9 @@ CeladonGymText1: ; 48a11 (12:4a11)  	set 7, [hl]  	ld hl, CeladonGymText_48a63  	ld de, CeladonGymText_48a63 -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	ldh a, [$8c] -	ld [wcf13], a +	ld [wSpriteIndex], a  	call EngageMapTrainer  	call InitBattleEnemyParameters  	ld a, $4 diff --git a/scripts/celadonmansion3.asm b/scripts/celadonmansion3.asm index 73cd45ed..47190c92 100755 --- a/scripts/celadonmansion3.asm +++ b/scripts/celadonmansion3.asm @@ -51,7 +51,7 @@ DirectorText: ; 487b2 (12:47b2)  	db $8 ; asm  	callab DisplayDiploma  	ld a, $1 -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	jp TextScriptEnd  GameFreakPCText1: ; 487eb (12:47eb) diff --git a/scripts/celadonmartelevator.asm b/scripts/celadonmartelevator.asm index 1e32647d..ff835765 100755 --- a/scripts/celadonmartelevator.asm +++ b/scripts/celadonmartelevator.asm @@ -9,13 +9,13 @@ CeladonMartElevatorScript: ; 48600 (12:4600)  	res 7, [hl]  	call nz, CeladonMartElevatorScript_48654  	xor a -	ld [wcf0c], a +	ld [wAutoTextBoxDrawingControl], a  	inc a -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	ret  CeladonMartElevatorScript_4861c: ; 4861c (12:461c) -	ld hl, wd3af +	ld hl, wWarpEntries  	ld a, [wd73b]  	ld b, a  	ld a, [wd73c] diff --git a/scripts/celadonmartroof.asm b/scripts/celadonmartroof.asm index 37025525..fa34b8cd 100755 --- a/scripts/celadonmartroof.asm +++ b/scripts/celadonmartroof.asm @@ -230,7 +230,7 @@ CeladonMartRoofText2: ; 4856c (12:456c)  	and a  	jr z, .asm_914b9 ; 0x48574  	ld a, $1 -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	ld hl, CeladonMartRoofText4  	call PrintText  	call YesNoChoice diff --git a/scripts/ceruleancity.asm b/scripts/ceruleancity.asm index 419dbd8c..97824662 100755 --- a/scripts/ceruleancity.asm +++ b/scripts/ceruleancity.asm @@ -64,7 +64,7 @@ CeruleanCityScript0: ; 194c8 (6:54c8)  	ld hl, CeruleanCityCoords2  	call ArePlayerCoordsInArray  	ret nc -	ld a, [wd700] +	ld a, [wWalkBikeSurfState]  	and a  	jr z, .asm_19512 ; 0x19508 $8  	ld a, $ff @@ -85,7 +85,7 @@ CeruleanCityScript0: ; 194c8 (6:54c8)  	ld [$ff8c], a  	ld a, $5  	ld [$ff8b], a -	call Func_3500 +	call GetPointerWithinSpriteStateData2  	ld [hl], $19  .asm_19535  	ld a, $5 @@ -117,7 +117,7 @@ CeruleanCityScript_1955d: ; 1955d (6:555d)  	ld [$ff8c],a  	xor a  	ld [$ff8d],a -	jp Func_34a6 ; face object +	jp SetSpriteFacingDirectionAndDelay ; face object  CeruleanCityScript1: ; 19567 (6:5567)  	ld a, [wd730] @@ -133,7 +133,7 @@ CeruleanCityScript1: ; 19567 (6:5567)  	set 7, [hl]  	ld hl, CeruleanCityText_1966d  	ld de, CeruleanCityText_19672 -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	ld a, SONY1 + $c8  	ld [W_CUROPPONENT], a @@ -209,7 +209,7 @@ CeruleanCityScript3: ; 19610 (6:5610)  	predef HideObject  	xor a  	ld [wJoyIgnore], a -	call Func_2307 +	call PlayDefaultMusic  	ld a, $0  	ld [W_CERULEANCITYCURSCRIPT], a  	ret @@ -277,9 +277,9 @@ CeruleanCityText2: ; 1967c (6:567c)  	set 7, [hl]  	ld hl, CeruleanCityText_196ee  	ld de, CeruleanCityText_196ee -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	ld a, [$ff8c] -	ld [wcf13], a +	ld [wSpriteIndex], a  	call EngageMapTrainer  	call InitBattleEnemyParameters  	ld a, $4 @@ -296,7 +296,7 @@ CeruleanCityText2: ; 1967c (6:567c)  	jr .Done  .Success  	ld a, $1 -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	ld hl, ReceivedTM28Text  	call PrintText  	callba Func_74872 diff --git a/scripts/ceruleancity2.asm b/scripts/ceruleancity2.asm index 57c9ea4a..e65ef2c5 100755 --- a/scripts/ceruleancity2.asm +++ b/scripts/ceruleancity2.asm @@ -2,7 +2,7 @@ Func_74872: ; 74872 (1d:4872)  ; code similar to this appears in a lot of banks; this particular  ; one is called after you beat the Rocket that gives you TM28 DIG.  ; the screen then fades out, he disappears, and fades back in -	call GBFadeIn1 +	call GBFadeOutToBlack  	ld a, $07  	ld [wcc4d], a  	predef ShowObject @@ -12,5 +12,5 @@ Func_74872: ; 74872 (1d:4872)  	ld a, $06  	ld [wcc4d], a  	predef HideObject -	call GBFadeOut1 +	call GBFadeInFromBlack  	ret diff --git a/scripts/ceruleangym.asm b/scripts/ceruleangym.asm index 19296fe2..079844f3 100755 --- a/scripts/ceruleangym.asm +++ b/scripts/ceruleangym.asm @@ -31,7 +31,7 @@ CeruleanGymScript_5c6ed: ; 5c6ed (17:46ed)  CeruleanGymScriptPointers: ; 5c6f8 (17:46f8)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  	dw CeruleanGymScript3 @@ -126,9 +126,9 @@ CeruleanGymText1: ; 5c771 (17:4771)  	set 7, [hl]  	ld hl, CeruleanGymText_5c7d8  	ld de, CeruleanGymText_5c7d8 -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	ldh a, [$8c] -	ld [wcf13], a +	ld [wSpriteIndex], a  	call EngageMapTrainer  	call InitBattleEnemyParameters  	ld a, $2 diff --git a/scripts/ceruleanhouse2.asm b/scripts/ceruleanhouse2.asm index a45c0fda..3fa72183 100755 --- a/scripts/ceruleanhouse2.asm +++ b/scripts/ceruleanhouse2.asm @@ -1,8 +1,8 @@  CeruleanHouse2Script: ; 74e09 (1d:4e09)  	ld a, $1 -	ld [wcf0c], a +	ld [wAutoTextBoxDrawingControl], a  	dec a -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	ret  CeruleanHouse2TextPointers: ; 74e13 (1d:4e13) @@ -27,7 +27,7 @@ CeruleanHouse2Text1: ; 74e15 (1d:4e15)  	ld [wcf8c], a  	xor a  	ld [wcf93], a -	ld [wcc35], a +	ld [wMenuItemToSwap], a  	ld a, SPECIALLISTMENU  	ld [wListMenuID], a  	call DisplayListMenuID diff --git a/scripts/cinnabargym.asm b/scripts/cinnabargym.asm index 8ce02e81..48133c52 100755 --- a/scripts/cinnabargym.asm +++ b/scripts/cinnabargym.asm @@ -187,13 +187,13 @@ CinnabarGymTextPointers: ; 7589f (1d:589f)  CinnabarGymScript_758b7: ; 758b7 (1d:58b7)  	ld a, [H_DOWNARROWBLINKCNT2] ; $ff8c -	ld [wcf13], a +	ld [wSpriteIndex], a  	call EngageMapTrainer  	call InitBattleEnemyParameters  	ld hl, wd72d  	set 6, [hl]  	set 7, [hl] -	ld a, [wcf13] +	ld a, [wSpriteIndex]  	cp $1  	jr z, .asm_758d4  	ld a, $2 @@ -224,7 +224,7 @@ CinnabarGymText1: ; 758df (1d:58df)  	call PrintText  	ld hl, BlaineEndBattleText  	ld de, BlaineEndBattleText -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	ld a, $7  	ld [W_GYMLEADERNO], a  	jp CinnabarGymScript_758b7 @@ -267,7 +267,7 @@ CinnabarGymText2: ; 75939 (1d:5939)  	call PrintText  	ld hl, CinnabarGymText_75964  	ld de, CinnabarGymText_75964 ; $5964 XXX -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	jp CinnabarGymScript_758b7  .asm_46bb4 ; 0x75956  	ld hl, CinnabarGymText_75969 @@ -296,7 +296,7 @@ CinnabarGymText3: ; 7596e (1d:596e)  	call PrintText  	ld hl, CinnabarGymText_75999  	ld de, CinnabarGymText_75999 ; $5999 XXX -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	jp CinnabarGymScript_758b7  .asm_4b406 ; 0x7598b  	ld hl, CinnabarGymText_7599e @@ -325,7 +325,7 @@ CinnabarGymText4: ; 759a3 (1d:59a3)  	call PrintText  	ld hl, CinnabarGymText_759ce  	ld de, CinnabarGymText_759ce ; $59ce XXX -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	jp CinnabarGymScript_758b7  .asm_c0673 ; 0x759c0  	ld hl, CinnabarGymText_759d3 @@ -354,7 +354,7 @@ CinnabarGymText5: ; 759d8 (1d:59d8)  	call PrintText  	ld hl, CinnabarGymText_75a03  	ld de, CinnabarGymText_75a03 ; $5a03 XXX -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	jp CinnabarGymScript_758b7  .asm_5cfd7 ; 0x759f5  	ld hl, CinnabarGymText_75a08 @@ -383,7 +383,7 @@ CinnabarGymText6: ; 75a0d (1d:5a0d)  	call PrintText  	ld hl, CinnabarGymText_75a38  	ld de, CinnabarGymText_75a38 -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	jp CinnabarGymScript_758b7  .asm_776b4 ; 0x75a2a  	ld hl, CinnabarGymText_75a3d @@ -412,7 +412,7 @@ CinnabarGymText7: ; 75a42 (1d:5a42)  	call PrintText  	ld hl, CinnabarGymText_75a6d  	ld de, CinnabarGymText_75a6d -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	jp CinnabarGymScript_758b7  .asm_2f755 ; 0x75a5f  	ld hl, CinnabarGymText_75a72 @@ -441,7 +441,7 @@ CinnabarGymText8: ; 75a77 (1d:5a77)  	call PrintText  	ld hl, CinnabarGymText_75aa2  	ld de, CinnabarGymText_75aa2 ; $5aa2 XXX -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	jp CinnabarGymScript_758b7  .asm_d87be ; 0x75a94  	ld hl, CinnabarGymText_75aa7 diff --git a/scripts/cinnabarisland.asm b/scripts/cinnabarisland.asm index 8d27198b..33a497c4 100755 --- a/scripts/cinnabarisland.asm +++ b/scripts/cinnabarisland.asm @@ -32,10 +32,10 @@ CinnabarIslandScript0: ; 1ca38 (7:4a38)  	xor a  	ld [hJoyHeld], a  	ld a, $1 -	ld [wcd38], a -	ld a, $80 -	ld [wccd3], a -	call Func_3486 +	ld [wSimulatedJoypadStatesIndex], a +	ld a, D_DOWN +	ld [wSimulatedJoypadStatesEnd], a +	call StartSimulatingJoypadStates  	xor a  	ld [wSpriteStateData1 + 9], a  	ld [wJoyIgnore], a @@ -44,7 +44,7 @@ CinnabarIslandScript0: ; 1ca38 (7:4a38)  	ret  CinnabarIslandScript1: ; 1ca73 (7:4a73) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	call Delay3 diff --git a/scripts/copycatshouse2f.asm b/scripts/copycatshouse2f.asm index ea1e91b3..b7a1255c 100755 --- a/scripts/copycatshouse2f.asm +++ b/scripts/copycatshouse2f.asm @@ -16,7 +16,7 @@ CopycatsHouse2FText1: ; 5cc82 (17:4c82)  	bit 0, a  	jr nz, .asm_7ccf3 ; 0x5cc88  	ld a, $1 -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	ld hl, CopycatsHouse2FText_5ccd4  	call PrintText  	ld b, POKE_DOLL diff --git a/scripts/daycarem.asm b/scripts/daycarem.asm index 373a9349..3190ba0a 100755 --- a/scripts/daycarem.asm +++ b/scripts/daycarem.asm @@ -24,13 +24,13 @@ DayCareMText1: ; 56254 (15:6254)  	ld hl, DayCareMText_56414  	call PrintText  	xor a -	ld [wcfcb], a +	ld [wUpdateSpritesEnabled], a  	ld [wd07d], a -	ld [wcc35], a +	ld [wMenuItemToSwap], a  	call DisplayPartyMenu  	push af  	call GBPalWhiteOutWithDelay3 -	call Func_3dbe +	call RestoreScreenTilesAndReloadTilePatterns  	call LoadGBPal  	pop af  	ld hl, DayCareMText_56437 @@ -65,7 +65,7 @@ DayCareMScript_562e1: ; 562e1 (15:62e1)  	ld a, $3  	ld [wcc49], a  	call LoadMonData -	callab Func_58f43 +	callab CalcLevelFromExperience  	ld a, d  	cp MAX_LEVEL  	jr c, .asm_56315 diff --git a/scripts/fightingdojo.asm b/scripts/fightingdojo.asm index 5f244781..4a55347e 100755 --- a/scripts/fightingdojo.asm +++ b/scripts/fightingdojo.asm @@ -16,7 +16,7 @@ FightingDojoScript_5cd70: ; 5cd70 (17:4d70)  FightingDojoScriptPointers: ; 5cd7b (17:4d7b)  	dw FightingDojoScript1 -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  	dw FightingDojoScript3 @@ -48,7 +48,7 @@ FightingDojoScript1: ; 5cd83 (17:4d83)  	ld [$ff8c], a  	ld a, $8  	ld [$ff8d], a -	call Func_34a6 +	call SetSpriteFacingDirectionAndDelay  	ld a, $1  	ld [$ff8c], a  	call DisplayTextID @@ -67,7 +67,7 @@ FightingDojoScript3: ; 5cdc6 (17:4dc6)  	ld [$ff8c], a  	ld a, $8  	ld [$ff8d], a -	call Func_34a6 +	call SetSpriteFacingDirectionAndDelay  .asm_5cde4  	ld a, $f0 @@ -147,9 +147,9 @@ FightingDojoText1: ; 5ce44 (17:4e44)  	set 7, [hl]  	ld hl, FightingDojoText_5ce93  	ld de, FightingDojoText_5ce93 -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	ldh a, [$8c] -	ld [wcf13], a +	ld [wSpriteIndex], a  	call EngageMapTrainer  	call InitBattleEnemyParameters  	ld a, $3 diff --git a/scripts/fuchsiagym.asm b/scripts/fuchsiagym.asm index 09a767eb..43d977d7 100755 --- a/scripts/fuchsiagym.asm +++ b/scripts/fuchsiagym.asm @@ -32,7 +32,7 @@ FuchsiaGymScript_75477: ; 75477 (1d:5477)  FuchsiaGymScriptPointers: ; 75482 (1d:5482)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  	dw FuchsiaGymScript3 @@ -166,9 +166,9 @@ FuchsiaGymText1: ; 75534 (1d:5534)  	set 7, [hl]  	ld hl, UnnamedText_75586  	ld de, UnnamedText_75586 -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	ldh a, [$8c] -	ld [wcf13], a +	ld [wSpriteIndex], a  	call EngageMapTrainer  	call InitBattleEnemyParameters  	ld a, $5 diff --git a/scripts/gary.asm b/scripts/gary.asm index f909a618..fa331152 100755 --- a/scripts/gary.asm +++ b/scripts/gary.asm @@ -29,12 +29,12 @@ GaryScript0: ; 75f47 (1d:5f47)  GaryScript1: ; 75f48 (1d:5f48)  	ld a, $ff  	ld [wJoyIgnore], a -	ld hl, wccd3 +	ld hl, wSimulatedJoypadStatesEnd  	ld de, RLEMovement75f63  	call DecodeRLEList  	dec a -	ld [wcd38], a -	call Func_3486 +	ld [wSimulatedJoypadStatesIndex], a +	call StartSimulatingJoypadStates  	ld a, $2  	ld [W_GARYCURSCRIPT], a  	ret @@ -46,7 +46,7 @@ RLEMovement75f63: ; 75f63 (1d:5f63)  	db $ff  GaryScript2: ; 75f6a (1d:5f6a) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	call Delay3 @@ -63,7 +63,7 @@ GaryScript2: ; 75f6a (1d:5f6a)  	set 7, [hl]  	ld hl, GaryText_760f9  	ld de, GaryText_760fe -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	ld a, SONY3 + $c8  	ld [W_CUROPPONENT], a @@ -140,12 +140,12 @@ GaryScript5: ; 7601a (1d:601a)  	ld [$ff8c], a  	ld a, $8  	ld [$ff8d], a -	call Func_34a6 +	call SetSpriteFacingDirectionAndDelay  	ld a, $2  	ld [$ff8c], a  	xor a  	ld [$ff8d], a -	call Func_34a6 ; face object +	call SetSpriteFacingDirectionAndDelay ; face object  	ld a, $3  	ld [$ff8c], a  	call GaryScript_760c8 @@ -158,7 +158,7 @@ GaryScript6: ; 76047 (1d:6047)  	ld [$ff8c], a  	ld a, $c  	ld [$ff8d], a -	call Func_34a6 ; face object +	call SetSpriteFacingDirectionAndDelay ; face object  	ld a, $4  	ld [$ff8c], a  	call GaryScript_760c8 @@ -171,7 +171,7 @@ GaryScript7: ; 7605f (1d:605f)  	ld [$ff8c], a  	xor a  	ld [$ff8d], a -	call Func_34a6 ; face object +	call SetSpriteFacingDirectionAndDelay ; face object  	ld a, $5  	ld [$ff8c], a  	call GaryScript_760c8 @@ -200,12 +200,12 @@ GaryScript8: ; 76083 (1d:6083)  GaryScript9: ; 76099 (1d:6099)  	ld a, $ff  	ld [wJoyIgnore], a -	ld hl, wccd3 +	ld hl, wSimulatedJoypadStatesEnd  	ld de, RLEMovement760b4  	call DecodeRLEList  	dec a -	ld [wcd38], a -	call Func_3486 +	ld [wSimulatedJoypadStatesIndex], a +	call StartSimulatingJoypadStates  	ld a, $a  	ld [W_GARYCURSCRIPT], a  	ret @@ -216,7 +216,7 @@ RLEMovement760b4 ; 760b4 (1d:60b4)  	db $ff  GaryScript10: ; 760b9 (1d:60b9) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	xor a diff --git a/scripts/halloffameroom.asm b/scripts/halloffameroom.asm index 1273305e..fb5cad3a 100755 --- a/scripts/halloffameroom.asm +++ b/scripts/halloffameroom.asm @@ -62,12 +62,12 @@ HallofFameRoomScript2: ; 5a4bb (16:64bb)  HallofFameRoomScript0: ; 5a50d (16:650d)  	ld a, $ff  	ld [wJoyIgnore], a -	ld hl, wccd3 +	ld hl, wSimulatedJoypadStatesEnd  	ld de, RLEMovement5a528  	call DecodeRLEList  	dec a -	ld [wcd38], a -	call Func_3486 +	ld [wSimulatedJoypadStatesIndex], a +	call StartSimulatingJoypadStates  	ld a, $1  	ld [W_HALLOFFAMEROOMCURSCRIPT], a  	ret @@ -77,7 +77,7 @@ RLEMovement5a528: ; 5a528 (16:6528)  	db $ff  HallofFameRoomScript1: ; 5a52b (16:652b) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	ld a, $1 @@ -87,7 +87,7 @@ HallofFameRoomScript1: ; 5a52b (16:652b)  	call SetSpriteMovementBytesToFF  	ld a, $8  	ld [$ff8d], a -	call Func_34a6 +	call SetSpriteFacingDirectionAndDelay  	call Delay3  	xor a  	ld [wJoyIgnore], a diff --git a/scripts/lance.asm b/scripts/lance.asm index 90295042..f2523098 100755 --- a/scripts/lance.asm +++ b/scripts/lance.asm @@ -34,7 +34,7 @@ LanceScript_5a2de: ; 5a2de (16:62de)  	ld bc, $603  LanceScript_5a2f0: ; 5a2f0 (16:62f0) -	predef_jump Func_ee9e +	predef_jump ReplaceTileBlock  LanceScript_5a2f5: ; 5a2f5 (16:62f5)  	xor a @@ -43,7 +43,7 @@ LanceScript_5a2f5: ; 5a2f5 (16:62f5)  LanceScriptPointers: ; 5a2fa (16:62fa)  	dw LanceScript0 -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw LanceScript2  	dw LanceScript3  	dw LanceScript4 @@ -99,12 +99,12 @@ LanceScript2: ; 5a349 (16:6349)  LanceScript_5a35b: ; 5a35b (16:635b)  	ld a, $ff  	ld [wJoyIgnore], a -	ld hl, wccd3 +	ld hl, wSimulatedJoypadStatesEnd  	ld de, RLEList_5a379  	call DecodeRLEList  	dec a -	ld [wcd38], a -	call Func_3486 +	ld [wSimulatedJoypadStatesIndex], a +	call StartSimulatingJoypadStates  	ld a, $3  	ld [W_LANCECURSCRIPT], a  	ld [W_CURMAPSCRIPT], a @@ -118,7 +118,7 @@ RLEList_5a379: ; 5a379 (16:6379)  	db $FF  LanceScript3: ; 5a382 (16:6382) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	call Delay3 diff --git a/scripts/lorelei.asm b/scripts/lorelei.asm index 670b6b66..ab769d94 100755 --- a/scripts/lorelei.asm +++ b/scripts/lorelei.asm @@ -25,7 +25,7 @@ LoreleiScript_76191: ; 76191 (1d:6191)  .asm_761ab  	ld [wd09f], a  	ld bc, $2 -	predef_jump Func_ee9e +	predef_jump ReplaceTileBlock  LoreleiScript_761b6: ; 761b6 (1d:61b6)  	xor a @@ -34,7 +34,7 @@ LoreleiScript_761b6: ; 761b6 (1d:61b6)  LoreleiScriptPointers: ; 761bb (1d:61bb)  	dw LoreleiScript0 -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw LoreleiScript2  	dw LoreleiScript3  	dw LoreleiScript4 @@ -42,8 +42,8 @@ LoreleiScriptPointers: ; 761bb (1d:61bb)  LoreleiScript4: ; 761c5 (1d:61c5)  	ret  asm_761c6: ; 761c6 (1d:61c6) -	ld hl, wccd3 -	ld a, $40 +	ld hl, wSimulatedJoypadStatesEnd +	ld a, D_UP  	ld [hli], a  	ld [hli], a  	ld [hli], a @@ -51,8 +51,8 @@ asm_761c6: ; 761c6 (1d:61c6)  	ld [hli], a  	ld [hl], a  	ld a, $6 -	ld [wcd38], a -	call Func_3486 +	ld [wSimulatedJoypadStatesIndex], a +	call StartSimulatingJoypadStates  	ld a, $3  	ld [W_LORELEICURSCRIPT], a  	ld [W_CURMAPSCRIPT], a @@ -64,8 +64,8 @@ LoreleiScript0: ; 761e2 (1d:61e2)  	xor a  	ld [hJoyPressed], a  	ld [hJoyHeld], a -	ld [wccd3], a -	ld [wcd38], a +	ld [wSimulatedJoypadStatesEnd], a +	ld [wSimulatedJoypadStatesIndex], a  	ld a, [wWhichTrade] ; wWhichTrade  	cp $3  	jr c, .asm_76206 @@ -77,11 +77,11 @@ LoreleiScript0: ; 761e2 (1d:61e2)  	ld a, $2  	ld [H_DOWNARROWBLINKCNT2], a ; $ff8c  	call DisplayTextID -	ld a, $40 -	ld [wccd3], a +	ld a, D_UP +	ld [wSimulatedJoypadStatesEnd], a  	ld a, $1 -	ld [wcd38], a -	call Func_3486 +	ld [wSimulatedJoypadStatesIndex], a +	call StartSimulatingJoypadStates  	ld a, $3  	ld [W_LORELEICURSCRIPT], a  	ld [W_CURMAPSCRIPT], a @@ -95,7 +95,7 @@ CoordsData_76223: ; 76223 (1d:6223)  	db $FF  LoreleiScript3: ; 7622c (1d:622c) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	call Delay3 diff --git a/scripts/mansion1.asm b/scripts/mansion1.asm index ee1b42b4..3e067a98 100755 --- a/scripts/mansion1.asm +++ b/scripts/mansion1.asm @@ -43,7 +43,7 @@ Mansion1Script_4430b: ; 4430b (11:430b)  	ld a, $e  	ld [wd09f], a  asm_44310: ; 44310 (11:4310) -	predef Func_ee9e +	predef ReplaceTileBlock  	ret  Mansion1Script_Switches: ; 44316 (11:4316) @@ -58,7 +58,7 @@ Mansion1Script_Switches: ; 44316 (11:4316)  Mansion1ScriptPointers: ; 44326 (11:4326)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  Mansion1TextPointers: ; 4432c (11:432c) @@ -106,7 +106,7 @@ Mansion1Text4: ; 4435a (11:435a)  	and a  	jr nz, .asm_4438c ; 0x44368 $22  	ld a, $1 -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	ld hl, wd126  	set 5, [hl]  	ld hl, MansionSwitchPressedText diff --git a/scripts/mansion2.asm b/scripts/mansion2.asm index 30261637..c643d229 100755 --- a/scripts/mansion2.asm +++ b/scripts/mansion2.asm @@ -40,7 +40,7 @@ Mansion2Script_51fee: ; 51fee (14:5fee)  Mansion2Script_5202f: ; 5202f (14:602f)  	ld [wd09f], a -	predef_jump Func_ee9e +	predef_jump ReplaceTileBlock  Mansion2Script_Switches: ; 52037 (14:6037)  	ld a, [wSpriteStateData1 + 9] @@ -54,7 +54,7 @@ Mansion2Script_Switches: ; 52037 (14:6037)  Mansion2ScriptPointers: ; 52047 (14:6047)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  Mansion2TextPointers: ; 5204d (14:604d) @@ -112,7 +112,7 @@ Mansion2Text5: ; 52087 (14:6087)  	and a  	jr nz, .asm_520b9 ; 0x52095 $22  	ld a, $1 -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	ld hl, wd126  	set 5, [hl]  	ld hl, Mansion2Text_520c7 diff --git a/scripts/mansion3.asm b/scripts/mansion3.asm index 4e9c2271..6ad02dd9 100755 --- a/scripts/mansion3.asm +++ b/scripts/mansion3.asm @@ -34,13 +34,13 @@ Mansion3Script_52204: ; 52204 (14:6204)  Mansion3ScriptPointers: ; 52235 (14:6235)  	dw Mansion3Script0 -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  Mansion3Script0: ; 5223b (14:623b)  	ld hl, CoordsData_52254  	call Mansion3Script_5225b -	ld a, [wd71e] +	ld a, [wWhichDungeonWarp]  	and a  	jp z, CheckFightingMapTrainers  	cp $3 @@ -48,7 +48,7 @@ Mansion3Script0: ; 5223b (14:623b)  	jr nz, .asm_52250  	ld a, $d6  .asm_52250 -	ld [wd71d], a +	ld [wDungeonWarpDestinationMap], a  	ret  CoordsData_52254: ; 52254 (14:6254) @@ -59,14 +59,14 @@ CoordsData_52254: ; 52254 (14:6254)  Mansion3Script_5225b: ; 5225b (14:625b)  	xor a -	ld [wd71e], a +	ld [wWhichDungeonWarp], a  	ld a, [wd72d]  	bit 4, a  	ret nz  	call ArePlayerCoordsInArray  	ret nc  	ld a, [wWhichTrade] ; wWhichTrade -	ld [wd71e], a +	ld [wWhichDungeonWarp], a  	ld hl, wd72d  	set 4, [hl]  	ld hl, wd732 diff --git a/scripts/mansion4.asm b/scripts/mansion4.asm index cfd78c5f..b89af5f2 100755 --- a/scripts/mansion4.asm +++ b/scripts/mansion4.asm @@ -56,7 +56,7 @@ Mansion4Script_Switches: ; 52420 (14:6420)  Mansion4ScriptPointers: ; 52430 (14:6430)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  Mansion4TextPointers: ; 52436 (14:6436) diff --git a/scripts/mtmoon1.asm b/scripts/mtmoon1.asm index 42f98d98..def597ba 100755 --- a/scripts/mtmoon1.asm +++ b/scripts/mtmoon1.asm @@ -9,7 +9,7 @@ MtMoon1Script: ; 499c8 (12:59c8)  MtMoon1ScriptPointers: ; 499db (12:59db)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  MtMoon1TextPointers: ; 499e1 (12:59e1) diff --git a/scripts/mtmoon3.asm b/scripts/mtmoon3.asm index 8d6aaeed..f0124be0 100755 --- a/scripts/mtmoon3.asm +++ b/scripts/mtmoon3.asm @@ -47,7 +47,7 @@ MtMoon3Script_49d58: ; 49d58 (12:5d58)  MtMoon3ScriptPointers: ; 49d63 (12:5d63)  	dw MtMoon3Script0 -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  	dw MtMoon3Script3  	dw MtMoon3Script4 @@ -138,7 +138,7 @@ MtMoon3Script5: ; 49dfb (12:5dfb)  	ld a, $f0  	ld [wJoyIgnore], a  	ld a, $1 -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	ld a, $a  	ld [H_DOWNARROWBLINKCNT2], a ; $ff8c  	call DisplayTextID @@ -228,9 +228,9 @@ MtMoon3Text1: ; 49e79 (12:5e79)  	set 7, [hl]  	ld hl, MtMoon3Text_49f8a  	ld de, MtMoon3Text_49f8a -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	ldh a, [$8c] -	ld [wcf13], a +	ld [wSpriteIndex], a  	call EngageMapTrainer  	call InitBattleEnemyParameters  	ld a, $3 @@ -270,7 +270,7 @@ MtMoon3Text5: ; 49edf (12:5edf)  MtMoon3Text6: ; 49ee9 (12:5ee9)  	db $08 ; asm  	ld a, $1 -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	ld hl, MtMoon3Text_49f24  	call PrintText  	call YesNoChoice @@ -299,7 +299,7 @@ MtMoon3Text_49f24: ; 49f24 (12:5f24)  MtMoon3Text7: ; 49f29 (12:5f29)  	db $08 ; asm  	ld a, $1 -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	ld hl, MtMoon3Text_49f64  	call PrintText  	call YesNoChoice diff --git a/scripts/museum1f.asm b/scripts/museum1f.asm index e593cf39..a701e1a4 100755 --- a/scripts/museum1f.asm +++ b/scripts/museum1f.asm @@ -1,8 +1,8 @@  Museum1FScript: ; 5c0f7 (17:40f7)  	ld a, $1 -	ld [wcf0c], a +	ld [wAutoTextBoxDrawingControl], a  	xor a -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	ld hl, Museum1FScriptPointers  	ld a, [W_MUSEUM1FCURSCRIPT]  	jp CallFunctionInTable @@ -115,10 +115,10 @@ Museum1FText1: ; 5c135 (17:4135)  	ld hl, Museum1FText_5c21a ; $421a  	call PrintText  	ld a, $1 -	ld [wcd38], a +	ld [wSimulatedJoypadStatesIndex], a  	ld a, $80 -	ld [wccd3], a -	call Func_3486 +	ld [wSimulatedJoypadStatesEnd], a +	call StartSimulatingJoypadStates  	call UpdateSprites  	jr asm_d1145  .asm_0b094 diff --git a/scripts/namerater.asm b/scripts/namerater.asm index ca357ad1..c9e3bfb4 100755 --- a/scripts/namerater.asm +++ b/scripts/namerater.asm @@ -50,12 +50,12 @@ NameRaterText1: ; 1da56 (7:5a56)  	call PrintText  	xor a  	ld [wd07d], a -	ld [wcfcb], a -	ld [wcc35], a +	ld [wUpdateSpritesEnabled], a +	ld [wMenuItemToSwap], a  	call DisplayPartyMenu  	push af  	call GBPalWhiteOutWithDelay3 -	call Func_3dbe +	call RestoreScreenTilesAndReloadTilePatterns  	call LoadGBPal  	pop af  	jr c, .asm_1daae ; 0x1da80 $2c diff --git a/scripts/oakslab.asm b/scripts/oakslab.asm index fb56aade..574c6814 100755 --- a/scripts/oakslab.asm +++ b/scripts/oakslab.asm @@ -3,9 +3,9 @@ OaksLabScript: ; 1cb0e (7:4b0e)  	bit 6, a  	call nz, OaksLabScript_1d076  	ld a, $1 -	ld [wcf0c], a +	ld [wAutoTextBoxDrawingControl], a  	xor a -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	ld hl, OaksLabScriptPointers  	ld a, [W_OAKSLABCURSCRIPT]  	jp CallFunctionInTable @@ -35,7 +35,7 @@ OaksLabScript0: ; 1cb4e (7:4b4e)  	ld a, [wd74b]  	bit 7, a  	ret z -	ld a, [wcf10] +	ld a, [wNPCMovementScriptFunctionNum]  	and a  	ret nz  	ld a, $31 @@ -50,7 +50,7 @@ OaksLabScript0: ; 1cb4e (7:4b4e)  OaksLabScript1: ; 1cb6e (7:4b6e)  	ld a, $8 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	ld de, OakEntryMovement  	call MoveSprite @@ -78,22 +78,22 @@ OaksLabScript2: ; 1cb82 (7:4b82)  OaksLabScript3: ; 1cba2 (7:4ba2)  	call Delay3 -	ld hl, wccd3 +	ld hl, wSimulatedJoypadStatesEnd  	ld de, PlayerEntryMovementRLE  	call DecodeRLEList  	dec a -	ld [wcd38], a -	call Func_3486 +	ld [wSimulatedJoypadStatesIndex], a +	call StartSimulatingJoypadStates  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	xor a  	ld [$ff8d], a -	call Func_34a6 ; face object +	call SetSpriteFacingDirectionAndDelay  	ld a, $5 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	xor a  	ld [$ff8d], a -	call Func_34a6 ; face object +	call SetSpriteFacingDirectionAndDelay  	ld a, $4  	ld [W_OAKSLABCURSCRIPT], a @@ -103,7 +103,7 @@ PlayerEntryMovementRLE: ; 1cbcf (7:4bcf)  	db $40, $8, $ff  OaksLabScript4: ; 1cbd2 (7:4bd2) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	ld hl, wd747 @@ -111,14 +111,14 @@ OaksLabScript4: ; 1cbd2 (7:4bd2)  	ld hl, wd74b  	set 0, [hl]  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	ld a, $4  	ld [$ff8d], a -	call Func_34a6 ; face object +	call SetSpriteFacingDirectionAndDelay  	call UpdateSprites  	ld hl, W_FLAGS_D733  	res 1, [hl] -	call Func_2307 +	call PlayDefaultMusic  	ld a, $5  	ld [W_OAKSLABCURSCRIPT], a @@ -156,24 +156,24 @@ OaksLabScript6: ; 1cc36 (7:4c36)  	cp $6  	ret nz  	ld a, $5 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	xor a  	ld [$ff8d], a -	call Func_34a6 ; face object +	call SetSpriteFacingDirectionAndDelay  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	xor a  	ld [$ff8d], a -	call Func_34a6 ; face object +	call SetSpriteFacingDirectionAndDelay  	call UpdateSprites  	ld a, $c  	ld [$ff8c], a  	call DisplayTextID  	ld a, $1 -	ld [wcd38], a +	ld [wSimulatedJoypadStatesIndex], a  	ld a, $40 -	ld [wccd3], a -	call Func_3486 +	ld [wSimulatedJoypadStatesEnd], a +	call StartSimulatingJoypadStates  	ld a, $8  	ld [wd528], a @@ -182,7 +182,7 @@ OaksLabScript6: ; 1cc36 (7:4c36)  	ret  OaksLabScript7: ; 1cc72 (7:4c72) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	call Delay3 @@ -231,10 +231,10 @@ OaksLabScript8: ; 1cc80 (7:4c80)  	jr nz, .asm_1ccf3 ; 0x1cccd $24  	push hl  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	ld a, $4  	ld [$ff8b], a -	call Func_34fc +	call GetPointerWithinSpriteStateData1  	push hl  	ld [hl], $4c  	inc hl @@ -256,7 +256,7 @@ OaksLabScript8: ; 1cc80 (7:4c80)  .asm_1ccf3  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	call MoveSprite  	ld a, $9 @@ -270,10 +270,10 @@ OaksLabScript9: ; 1cd00 (7:4d00)  	ld a, $fc  	ld [wJoyIgnore], a  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	ld a, $4  	ld [$ff8d], a -	call Func_34a6 ; face object +	call SetSpriteFacingDirectionAndDelay  	ld a, $d  	ld [$ff8c], a  	call DisplayTextID @@ -299,10 +299,10 @@ OaksLabScript9: ; 1cd00 (7:4d00)  	ld [wd11e], a  	call GetMonName  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	ld a, $4  	ld [$ff8d], a -	call Func_34a6 ; face object +	call SetSpriteFacingDirectionAndDelay  	ld a, $e  	ld [$ff8c], a  	call DisplayTextID @@ -320,10 +320,10 @@ OaksLabScript10: ; 1cd6d (7:4d6d)  	cp $6  	ret nz  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	xor a  	ld [$ff8d], a -	call Func_34a6 ; face object +	call SetSpriteFacingDirectionAndDelay  	ld a, $8  	ld [wd528], a  	ld c, BANK(Music_MeetRival) @@ -337,14 +337,14 @@ OaksLabScript10: ; 1cd6d (7:4d6d)  	ld a, $1  	swap a  	ld [$ff95], a -	predef Func_f929 +	predef CalcPositionOfPlayerRelativeToNPC  	ld a, [$ff95]  	dec a  	ld [$ff95], a -	predef Func_f8ba -	ld de, wcc97 +	predef FindPathToPlayer +	ld de, wNPCMovementDirections2  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	call MoveSprite  	ld a, $b @@ -374,11 +374,11 @@ OaksLabScript11: ; 1cdb9 (7:4db9)  .done  	ld [W_TRAINERNO], a  	ld a, $1 -	ld [wcf13], a -	call Func_32ef +	ld [wSpriteIndex], a +	call GetSpritePosition1  	ld hl, OaksLabText_1d3be  	ld de, OaksLabText_1d3c3 -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	ld hl, wd72d  	set 6, [hl]  	set 7, [hl] @@ -397,13 +397,13 @@ OaksLabScript12: ; 1ce03 (7:4e03)  	ld [wd528], a  	call UpdateSprites  	ld a, $1 -	ld [wcf13], a -	call Func_32f9 +	ld [wSpriteIndex], a +	call SetSpritePosition1  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	xor a  	ld [$ff8d], a -	call Func_34a6 ; face object +	call SetSpriteFacingDirectionAndDelay  	predef HealParty  	ld hl, wd74b  	set 3, [hl] @@ -420,7 +420,7 @@ OaksLabScript13: ; 1ce32 (7:4e32)  	call DisplayTextID  	callba Music_RivalAlternateStart  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	ld de, .RivalExitMovement  	call MoveSprite  	ld a, [W_XCOORD] @@ -450,7 +450,7 @@ OaksLabScript14: ; 1ce6d (7:4e6d)  	predef HideObject  	xor a  	ld [wJoyIgnore], a -	call Func_2307 ; reset to map music +	call PlayDefaultMusic ; reset to map music  	ld a, $12  	ld [W_OAKSLABCURSCRIPT], a  	jr .done ; 0x1ce8a $23 @@ -491,17 +491,17 @@ OaksLabScript15: ; 1ceb0 (7:4eb0)  	ld a, $2a  	ld [wcc4d], a  	predef ShowObject -	ld a, [wcd37] +	ld a, [wNPCMovementDirections2Index]  	ld [wd157], a  	ld b, $0  	ld c, a -	ld hl, wcc97 +	ld hl, wNPCMovementDirections2  	ld a, $40  	call FillMemory  	ld [hl], $ff  	ld a, $1 -	ld [$ff8c], a -	ld de, wcc97 +	ld [H_SPRITEINDEX], a +	ld de, wNPCMovementDirections2  	call MoveSprite  	ld a, $10 @@ -510,22 +510,22 @@ OaksLabScript15: ; 1ceb0 (7:4eb0)  OaksLabScript_1cefd ; 1cefd (7:4efd)  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	ld a, $4  	ld [$ff8d], a -	call Func_34a6 ; face object +	call SetSpriteFacingDirectionAndDelay  	ld a, $8 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	xor a  	ld [$ff8d], a -	jp Func_34a6 ; face object +	jp SetSpriteFacingDirectionAndDelay  OaksLabScript16: ; 1cf12 (7:4f12)  	ld a, [wd730]  	bit 0, a  	ret nz  	call EnableAutoTextBoxDrawing -	call Func_2307 +	call PlayDefaultMusic  	ld a, $fc  	ld [wJoyIgnore], a  	call OaksLabScript_1cefd @@ -558,10 +558,10 @@ OaksLabScript16: ; 1cf12 (7:4f12)  	ld [$ff8c], a  	call DisplayTextID  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	ld a, $c  	ld [$ff8d], a -	call Func_34a6 ; face object +	call SetSpriteFacingDirectionAndDelay  	call Delay3  	ld a, $1b  	ld [$ff8c], a @@ -579,7 +579,7 @@ OaksLabScript16: ; 1cf12 (7:4f12)  	ld a, [wd157]  	ld b, $0  	ld c, a -	ld hl, wcc97 +	ld hl, wNPCMovementDirections2  	xor a  	call FillMemory  	ld [hl], $ff @@ -588,8 +588,8 @@ OaksLabScript16: ; 1cf12 (7:4f12)  	call PlaySound  	callba Music_RivalAlternateStart  	ld a, $1 -	ld [$ff8c], a -	ld de, wcc97 +	ld [H_SPRITEINDEX], a +	ld de, wNPCMovementDirections2  	call MoveSprite  	ld a, $11 @@ -600,7 +600,7 @@ OaksLabScript17: ; 1cfd4 (7:4fd4)  	ld a, [wd730]  	bit 0, a  	ret nz -	call Func_2307 +	call PlayDefaultMusic  	ld a, $2a  	ld [wcc4d], a  	predef HideObject @@ -652,7 +652,7 @@ OaksLabScript_1d02b: ; 1d02b (7:502b)  	cp $3  	jr nz, .asm_1d045 ; 0x1d038 $b  	ld a, $4 -	ld [wcd37], a +	ld [wNPCMovementDirections2Index], a  	ld a, $30  	ld b, $b  	jr .asm_1d068 ; 0x1d043 $23 @@ -660,13 +660,13 @@ OaksLabScript_1d02b: ; 1d02b (7:502b)  	cp $1  	jr nz, .asm_1d054 ; 0x1d047 $b  	ld a, $2 -	ld [wcd37], a +	ld [wNPCMovementDirections2Index], a  	ld a, $30  	ld b, $9  	jr .asm_1d068 ; 0x1d052 $14  .asm_1d054  	ld a, $3 -	ld [wcd37], a +	ld [wNPCMovementDirections2Index], a  	ld b, $a  	ld a, [W_XCOORD]  	cp $4 @@ -680,8 +680,8 @@ OaksLabScript_1d02b: ; 1d02b (7:502b)  	ld a, b  	ld [$ffed], a  	ld a, $1 -	ld [wcf13], a -	call Func_32f9 +	ld [wSpriteIndex], a +	call SetSpritePosition1  	ret  OaksLabScript_1d076: ; 1d076 (7:5076) @@ -801,7 +801,7 @@ OaksLabScript_1d133: ; 1d133 (7:5133)  	ld [wcf91], a  	ld [wd11e], a  	ld a, b -	ld [wcf13], a +	ld [wSpriteIndex], a  	ld a, [wd74b]  	bit 2, a  	jp nz, OaksLabScript_1d22d @@ -817,17 +817,17 @@ OaksLabText39: ; 1d152 (7:5152)  OaksLabScript_1d157: ; 1d157 (7:5157)  	ld a, $5 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	ld a, $9  	ld [$ff8b], a -	call Func_34fc +	call GetPointerWithinSpriteStateData1  	ld [hl], $0  	; manually fixed some disassembler issues around here  	ld a, $1 -	ld [$FF8c], a +	ld [H_SPRITEINDEX], a  	ld a, $9  	ld [$ff8b], a -	call Func_34fc +	call GetPointerWithinSpriteStateData1  	ld [hl], $c  	ld hl, wd730  	set 6, [hl] @@ -837,7 +837,7 @@ OaksLabScript_1d157: ; 1d157 (7:5157)  	call ReloadMapData  	ld c, $a  	call DelayFrames -	ld a, [wcf13] +	ld a, [wSpriteIndex]  	cp $2  	jr z, OaksLabLookAtCharmander  	cp $3 @@ -868,7 +868,7 @@ OaksLabBulbasaurText: ; 1d1ae (7:51ae)  OaksLabMonChoiceMenu: ; 1d1b3 (7:51b3)  	call PrintText  	ld a, $1 -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	call YesNoChoice ; yes/no menu  	ld a, [wCurrentMenuItem]  	and a @@ -877,7 +877,7 @@ OaksLabMonChoiceMenu: ; 1d1b3 (7:51b3)  	ld [W_PLAYERSTARTER], a  	ld [wd11e], a  	call GetMonName -	ld a, [wcf13] +	ld a, [wSpriteIndex]  	cp $2  	jr nz, asm_1d1db ; 0x1d1d5 $4  	ld a, $2b @@ -893,7 +893,7 @@ asm_1d1e5: ; 1d1e5 (7:51e5)  	ld [wcc4d], a  	predef HideObject  	ld a, $1 -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	ld hl, OaksLabMonEnergeticText  	call PrintText  	ld hl, OaksLabReceivedMonText @@ -924,10 +924,10 @@ OaksLabReceivedMonText: ; 1d227 (7:5227)  OaksLabScript_1d22d: ; 1d22d (7:522d)  	ld a, $5 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	ld a, $9  	ld [$ff8b], a -	call Func_34fc +	call GetPointerWithinSpriteStateData1  	ld [hl], $0  	ld hl, OaksLabLastMonText  	call PrintText @@ -956,7 +956,7 @@ OaksLabText5: ; 1d248 (7:5248)  	ld hl, OaksLabText_1d31d  	call PrintText  	ld a, $1 -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	predef DisplayDexRating  	jp .asm_0f042  .asm_b28b0 ; 0x1d279 diff --git a/scripts/pallettown.asm b/scripts/pallettown.asm index 16098dcf..e7bd2f57 100755 --- a/scripts/pallettown.asm +++ b/scripts/pallettown.asm @@ -68,7 +68,7 @@ PalletTownScript2: ; 18ed2 (6:4ed2)  	ld [$FF8C],a  	ld a,4  	ld [$FF8D],a -	call Func_34a6 +	call SetSpriteFacingDirectionAndDelay  	call Delay3  	ld a,1  	ld [W_YCOORD],a @@ -77,11 +77,11 @@ PalletTownScript2: ; 18ed2 (6:4ed2)  	ld a,1  	swap a  	ld [$FF95],a -	predef Func_f929 +	predef CalcPositionOfPlayerRelativeToNPC  	ld hl,$FF95  	dec [hl] -	predef Func_f8ba ; load Oak’s movement into wcc97 -	ld de,wcc97 +	predef FindPathToPlayer ; load Oak’s movement into wNPCMovementDirections2 +	ld de,wNPCMovementDirections2  	ld a,1 ; oak  	ld [$FF8C],a  	call MoveSprite @@ -109,13 +109,13 @@ PalletTownScript3: ; 18f12 (6:4f12)  	ld a,$FF  	ld [wJoyIgnore],a  	ld a,1 -	ld [wcf13],a +	ld [wSpriteIndex],a  	xor a -	ld [wcf10],a +	ld [wNPCMovementScriptFunctionNum],a  	ld a,1 -	ld [wcc57],a +	ld [wNPCMovementScriptPointerTableNum],a  	ld a,[H_LOADEDROMBANK] -	ld [wcc58],a +	ld [wNPCMovementScriptBank],a  	; trigger the next script  	ld a,4 @@ -123,7 +123,7 @@ PalletTownScript3: ; 18f12 (6:4f12)  	ret  PalletTownScript4: ; 18f4b (6:4f4b) -	ld a,[wcc57] +	ld a,[wNPCMovementScriptPointerTableNum]  	and a  	ret nz @@ -171,7 +171,7 @@ PalletTownText1: ; 18f96 (6:4f96)  	and a  	jr nz,.next  	ld a,1 -	ld [wcc3c],a +	ld [wDoNotWaitForButtonPressAfterDisplayingText],a  	ld hl,OakAppearsText  	jr .done  .next diff --git a/scripts/pewtercity.asm b/scripts/pewtercity.asm index e7a143f9..ba32454a 100755 --- a/scripts/pewtercity.asm +++ b/scripts/pewtercity.asm @@ -42,18 +42,18 @@ CoordsData_19277: ; 19277 (6:5277)  	db $ff  PewterCityScript1: ; 19280 (6:5280) -	ld a, [wcc57] +	ld a, [wNPCMovementScriptPointerTableNum]  	and a  	ret nz  	ld a, $3 -	ld [$ff8c], a -	ld a, $4 +	ld [H_SPRITEINDEX], a +	ld a, SPRITE_FACING_UP  	ld [$ff8d], a -	call Func_34a6 -	ld a, $34 +	call SetSpriteFacingDirectionAndDelay +	ld a, ($3 << 4) | SPRITE_FACING_UP  	ld [$ff8d], a -	call Func_34b9 -	call Func_2307 +	call SetSpriteImageIndexAfterSettingFacingDirection +	call PlayDefaultMusic  	ld hl, wFlags_0xcd60  	set 4, [hl]  	ld a, $d @@ -68,8 +68,8 @@ PewterCityScript1: ; 19280 (6:5280)  	ld a, $11  	ld [$ffee], a  	ld a, $3 -	ld [wcf13], a -	call Func_32f9 +	ld [wSpriteIndex], a +	call SetSpritePosition1  	ld a, $3  	ld [$ff8c], a  	ld de, MovementData_PewterMuseumGuyExit ; $52ce @@ -94,8 +94,8 @@ PewterCityScript2: ; 192d3 (6:52d3)  PewterCityScript3: ; 192e9 (6:52e9)  	ld a, $3 -	ld [wcf13], a -	call Func_32fe +	ld [wSpriteIndex], a +	call SetSpritePosition2  	ld a, $3  	ld [wcc4d], a  	predef ShowObject @@ -106,18 +106,18 @@ PewterCityScript3: ; 192e9 (6:52e9)  	ret  PewterCityScript4: ; 19305 (6:5305) -	ld a, [wcc57] +	ld a, [wNPCMovementScriptPointerTableNum]  	and a  	ret nz  	ld a, $5  	ld [$ff8c], a -	ld a, $8 +	ld a, SPRITE_FACING_LEFT  	ld [$ff8d], a -	call Func_34a6 -	ld a, $18 +	call SetSpriteFacingDirectionAndDelay +	ld a, ($1 << 4) | SPRITE_FACING_LEFT  	ld [$ff8d], a -	call Func_34b9 -	call Func_2307 +	call SetSpriteImageIndexAfterSettingFacingDirection +	call PlayDefaultMusic  	ld hl, wFlags_0xcd60  	set 4, [hl]  	ld a, $e @@ -132,8 +132,8 @@ PewterCityScript4: ; 19305 (6:5305)  	ld a, $10  	ld [$ffee], a  	ld a, $5 -	ld [wcf13], a -	call Func_32f9 +	ld [wSpriteIndex], a +	call SetSpritePosition1  	ld a, $5  	ld [$ff8c], a  	ld de, MovementData_PewterGymGuyExit @@ -158,8 +158,8 @@ PewterCityScript5: ; 19359 (6:5359)  PewterCityScript6: ; 1936f (6:536f)  	ld a, $5 -	ld [wcf13], a -	call Func_32fe +	ld [wSpriteIndex], a +	call SetSpritePosition2  	ld a, $4  	ld [wcc4d], a  	predef ShowObject @@ -210,14 +210,14 @@ PewterCityText3: ; 193b1 (6:53b1)  	xor a  	ldh [$b3], a  	ldh [$b4], a -	ld [wcf10], a +	ld [wNPCMovementScriptFunctionNum], a  	ld a, $2 -	ld [wcc57], a +	ld [wNPCMovementScriptPointerTableNum], a  	ldh a, [$b8] -	ld [wcc58], a +	ld [wNPCMovementScriptBank], a  	ld a, $3 -	ld [wcf13], a -	call Func_32f4 +	ld [wSpriteIndex], a +	call GetSpritePosition2  	ld a, $1  	ld [W_PEWTERCITYCURSCRIPT], a  .asm_ac429 ; 0x193ee @@ -274,14 +274,14 @@ PewterCityText5: ; 19436 (6:5436)  	call PrintText  	xor a  	ldh [$b4], a -	ld [wcf10], a +	ld [wNPCMovementScriptFunctionNum], a  	ld a, $3 -	ld [wcc57], a +	ld [wNPCMovementScriptPointerTableNum], a  	ldh a, [$b8] -	ld [wcc58], a +	ld [wNPCMovementScriptBank], a  	ld a, $5 -	ld [wcf13], a -	call Func_32f4 +	ld [wSpriteIndex], a +	call GetSpritePosition2  	ld a, $4  	ld [W_PEWTERCITYCURSCRIPT], a  	jp TextScriptEnd diff --git a/scripts/pewtergym.asm b/scripts/pewtergym.asm index 2feb9817..21d3fe74 100755 --- a/scripts/pewtergym.asm +++ b/scripts/pewtergym.asm @@ -31,7 +31,7 @@ PewterGymScript_5c3bf: ; 5c3bf (17:43bf)  PewterGymScriptPointers: ; 5c3ca (17:43ca)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  	dw PewterGymScript3 @@ -126,9 +126,9 @@ PewterGymText1: ; 5c44e (17:444e)  	set 7, [hl]  	ld hl, PewterGymText_5c4bc  	ld de, PewterGymText_5c4bc -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	ldh a, [$8c] -	ld [wcf13], a +	ld [wSpriteIndex], a  	call EngageMapTrainer  	call InitBattleEnemyParameters  	ld a, $1 diff --git a/scripts/pewtermart.asm b/scripts/pewtermart.asm index 4e867aee..8fe99d94 100755 --- a/scripts/pewtermart.asm +++ b/scripts/pewtermart.asm @@ -1,7 +1,7 @@  PewterMartScript: ; 74cad (1d:4cad)  	call EnableAutoTextBoxDrawing  	ld a, $1 -	ld [wcf0c], a +	ld [wAutoTextBoxDrawingControl], a  	ret  PewterMartTextPointers: ; 74cb6 (1d:4cb6) diff --git a/scripts/pewterpokecenter.asm b/scripts/pewterpokecenter.asm index 252c6d5b..2f4fd7af 100755 --- a/scripts/pewterpokecenter.asm +++ b/scripts/pewterpokecenter.asm @@ -18,7 +18,7 @@ PewterPokecenterText2: ; 5c596 (17:4596)  PewterPokecenterText3: ; 5c59b (17:459b)  	db $8  	ld a, $1 -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	ld hl, PewterPokecenterText5  	call PrintText  	ld a, $ff @@ -61,7 +61,7 @@ PewterPokecenterText3: ; 5c59b (17:459b)  	jr nz, .asm_5c5d1 ; 0x5c5f6 $d9  	ld c, $30  	call DelayFrames -	call Func_2307 +	call PlayDefaultMusic  	jp TextScriptEnd  PewterPokecenterText5: ; 5c603 (17:4603) diff --git a/scripts/pokemontower2.asm b/scripts/pokemontower2.asm index f370d7b7..3c9ec72d 100755 --- a/scripts/pokemontower2.asm +++ b/scripts/pokemontower2.asm @@ -46,7 +46,7 @@ PokemonTower2Script0: ; 6050f (18:450f)  	ld [$ff8c], a  	ld a, b  	ld [$ff8d], a -	call Func_34a6 +	call SetSpriteFacingDirectionAndDelay  	ld a, $1  	ld [$ff8c], a  	call DisplayTextID @@ -104,7 +104,7 @@ PokemonTower2Script2: ; 605bb (18:45bb)  	predef HideObject  	xor a  	ld [wJoyIgnore], a -	call Func_2307 +	call PlayDefaultMusic  	ld a, $0  	ld [W_POKEMONTOWER2CURSCRIPT], a  	ld [W_CURMAPSCRIPT], a @@ -130,7 +130,7 @@ PokemonTower2Text1: ; 605df (18:45df)  	set 7, [hl]  	ld hl, PokemonTower2Text_60632  	ld de, PokemonTower2Text_60637 ; XXX $4637 -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	ld a, SONY2 + $c8  	ld [W_CUROPPONENT], a diff --git a/scripts/pokemontower3.asm b/scripts/pokemontower3.asm index f05623fb..8df5bfc5 100755 --- a/scripts/pokemontower3.asm +++ b/scripts/pokemontower3.asm @@ -9,7 +9,7 @@ PokemonTower3Script: ; 606cc (18:46cc)  PokemonTower3ScriptPointers: ; 606df (18:46df)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  PokemonTower3TextPointers: ; 606e5 (18:46e5) diff --git a/scripts/pokemontower4.asm b/scripts/pokemontower4.asm index e48b9681..760bb604 100755 --- a/scripts/pokemontower4.asm +++ b/scripts/pokemontower4.asm @@ -9,7 +9,7 @@ PokemonTower4Script: ; 607f6 (18:47f6)  PokemonTower4ScriptPointers: ; 60809 (18:4809)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  PokemonTower4TextPointers: ; 6080f (18:480f) diff --git a/scripts/pokemontower5.asm b/scripts/pokemontower5.asm index 317690a2..b70f9e28 100755 --- a/scripts/pokemontower5.asm +++ b/scripts/pokemontower5.asm @@ -9,7 +9,7 @@ PokemonTower5Script: ; 60932 (18:4932)  PokemonTower5ScriptPointers: ; 60945 (18:4945)  	dw PokemonTower5Script0 -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  PokemonTower5Script0: ; 6094b (18:494b) @@ -33,10 +33,10 @@ PokemonTower5Script0: ; 6094b (18:494b)  	ld hl, wd72e  	set 4, [hl]  	predef HealParty -	call GBFadeOut2 +	call GBFadeOutToWhite  	call Delay3  	call Delay3 -	call GBFadeIn2 +	call GBFadeInFromWhite  	ld a, $7  	ld [H_DOWNARROWBLINKCNT2], a ; $ff8c  	call DisplayTextID diff --git a/scripts/pokemontower6.asm b/scripts/pokemontower6.asm index fe33ce29..58968d17 100755 --- a/scripts/pokemontower6.asm +++ b/scripts/pokemontower6.asm @@ -16,7 +16,7 @@ PokemonTower6Script_60b02: ; 60b02 (18:4b02)  PokemonTower6ScriptPointers: ; 60b0d (18:4b0d)  	dw PokemonTower6Script0 -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  	dw PokemonTower6Script3  	dw PokemonTower6Script4 @@ -57,7 +57,7 @@ PokemonTower6Script4: ; 60b48 (18:4b48)  	call UpdateSprites  	ld a, $f0  	ld [wJoyIgnore], a -	ld a, [wcf0b] +	ld a, [wBattleResult]  	and a  	jr nz, .asm_60b82  	ld hl, wd768 @@ -73,12 +73,12 @@ PokemonTower6Script4: ; 60b48 (18:4b48)  	ret  .asm_60b82  	ld a, $1 -	ld [wcd38], a +	ld [wSimulatedJoypadStatesIndex], a  	ld a, $10 -	ld [wccd3], a +	ld [wSimulatedJoypadStatesEnd], a  	xor a  	ld [wSpriteStateData2 + $06], a -	ld [wcd3b], a +	ld [wOverrideSimulatedJoypadStatesMask], a  	ld hl, wd730  	set 7, [hl]  	ld a, $3 @@ -87,7 +87,7 @@ PokemonTower6Script4: ; 60b48 (18:4b48)  	ret  PokemonTower6Script3: ; 60ba1 (18:4ba1) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	call Delay3 diff --git a/scripts/pokemontower7.asm b/scripts/pokemontower7.asm index 431855cb..cc736a08 100755 --- a/scripts/pokemontower7.asm +++ b/scripts/pokemontower7.asm @@ -16,7 +16,7 @@ PokemonTower7Script_60d18: ; 60d18 (18:4d18)  PokemonTower7ScriptPointers: ; 60d23 (18:4d23)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw PokemonTower7Script2  	dw PokemonTower7Script3  	dw PokemonTower7Script4 @@ -30,7 +30,7 @@ PokemonTower7Script2: ; 60d23 (18:4d23)  	call EndTrainerBattle  	ld a, $f0  	ld [wJoyIgnore], a -	ld a, [wcf13] +	ld a, [wSpriteIndex]  	ld [H_DOWNARROWBLINKCNT2], a ; $ff8c  	call DisplayTextID  	call PokemonTower7Script_60db6 @@ -44,7 +44,7 @@ PokemonTower7Script3: ; 60d56 (18:4d56)  	bit 0, a  	ret nz  	ld hl, W_MISSABLEOBJECTLIST -	ld a, [wcf13] +	ld a, [wSpriteIndex]  	ld b, a  .missableObjectsListLoop  	ld a, [hli] @@ -55,7 +55,7 @@ PokemonTower7Script3: ; 60d56 (18:4d56)  	predef HideObject  	xor a  	ld [wJoyIgnore], a -	ld [wcf13], a +	ld [wSpriteIndex], a  	ld [wTrainerHeaderFlagBit], a  	ld [wda38], a  	ld a, $0 @@ -74,7 +74,7 @@ PokemonTower7Script4: ; 60d86 (18:4d86)  	ld a, $95  	ld [H_DOWNARROWBLINKCNT1], a ; $ff8b  	ld a, $1 -	ld [wd42f], a +	ld [wDestinationWarpID], a  	ld a, LAVENDER_TOWN  	ld [wLastMap], a  	ld hl, wd72d @@ -86,7 +86,7 @@ PokemonTower7Script4: ; 60d86 (18:4d86)  PokemonTower7Script_60db6: ; 60db6 (18:4db6)  	ld hl, CoordsData_60de3 ; $4de3 -	ld a, [wcf13] +	ld a, [wSpriteIndex]  	dec a  	swap a  	ld d, $0 @@ -106,7 +106,7 @@ PokemonTower7Script_60db6: ; 60db6 (18:4db6)  	ld a, [hli]  	ld d, [hl]  	ld e, a -	ld a, [wcf13] +	ld a, [wSpriteIndex]  	ld [H_DOWNARROWBLINKCNT2], a ; $ff8c  	jp MoveSprite  .asm_60dde diff --git a/scripts/powerplant.asm b/scripts/powerplant.asm index b90ba7a1..ec4f89b3 100755 --- a/scripts/powerplant.asm +++ b/scripts/powerplant.asm @@ -9,7 +9,7 @@ PowerPlantScript: ; 1e2c6 (7:62c6)  PowerPlantScriptPointers: ; 1e2d9 (7:62d9)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  PowerPlantTextPointers: ; 1e2df (7:62df) diff --git a/scripts/redshouse1f.asm b/scripts/redshouse1f.asm index 0e3e331b..7b3f1f87 100755 --- a/scripts/redshouse1f.asm +++ b/scripts/redshouse1f.asm @@ -25,7 +25,7 @@ MomWakeUpText: ; 48185 (12:4185)  MomHealPokemon: ; 4818a (12:418a)  	ld hl, MomHealText1  	call PrintText -	call GBFadeOut2 +	call GBFadeOutToWhite  	call ReloadMapData  	predef HealParty  	ld a, MUSIC_PKMN_HEALED @@ -38,7 +38,7 @@ MomHealPokemon: ; 4818a (12:418a)  	ld a, [wd35b]  	ld [wc0ee], a  	call PlaySound -	call GBFadeIn2 +	call GBFadeInFromWhite  	ld hl, MomHealText2  	jp PrintText diff --git a/scripts/rockethideout1.asm b/scripts/rockethideout1.asm index 43e4fd26..499f77ef 100755 --- a/scripts/rockethideout1.asm +++ b/scripts/rockethideout1.asm @@ -30,11 +30,11 @@ RocketHideout1Script_44be0: ; 44be0 (11:4be0)  .asm_44c03  	ld [wd09f], a  	ld bc, $080c -	predef_jump Func_ee9e +	predef_jump ReplaceTileBlock  RocketHideout1ScriptPointers: ; 44c0e (11:4c0e)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  RocketHideout1TextPointers: ; 44c14 (11:4c14) diff --git a/scripts/rockethideout2.asm b/scripts/rockethideout2.asm index aa8d31a4..99754658 100755 --- a/scripts/rockethideout2.asm +++ b/scripts/rockethideout2.asm @@ -9,7 +9,7 @@ RocketHideout2Script: ; 44e27 (11:4e27)  RocketHideout2ScriptPointers: ; 44e3a (11:4e3a)  	dw RocketHideout2Script0 -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  	dw RocketHideout2Script3 @@ -19,12 +19,12 @@ RocketHideout2Script0: ; 44e42 (11:4e42)  	ld a, [W_XCOORD]  	ld c, a  	ld hl, RocketHideout2ArrowTilePlayerMovement -	call Func_3442 +	call DecodeArrowMovementRLE  	cp $ff  	jp z, CheckFightingMapTrainers  	ld hl, wd736  	set 7, [hl] -	call Func_3486 +	call StartSimulatingJoypadStates  	ld a, (SFX_02_52 - SFX_Headers_02) / 3  	call PlaySound  	ld a, $ff @@ -306,7 +306,7 @@ RocketHideout2ArrowMovement36: ; 44fbb (11:4fbb)  	db $FF  RocketHideout2Script3: ; 44fc2 (11:4fc2) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	jr nz, LoadSpinnerArrowTiles  	xor a @@ -333,7 +333,7 @@ LoadSpinnerArrowTiles: ; 44fd7 (11:4fd7)  	jr z, .asm_44ff6  	ld hl, GymSpinnerArrows ; $5053  .asm_44ff6 -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	bit 0, a  	jr nz, .asm_45001  	ld de, $18 diff --git a/scripts/rockethideout3.asm b/scripts/rockethideout3.asm index e3223a85..6dc467ab 100755 --- a/scripts/rockethideout3.asm +++ b/scripts/rockethideout3.asm @@ -9,7 +9,7 @@ RocketHideout3Script: ; 45225 (11:5225)  RocketHideout3ScriptPointers: ; 45238 (11:5238)  	dw RocketHideout3Script0 -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  	dw RocketHideout3Script3 @@ -19,12 +19,12 @@ RocketHideout3Script0: ; 45240 (11:5240)  	ld a, [W_XCOORD]  	ld c, a  	ld hl, RocketHideout3ArrowTilePlayerMovement -	call Func_3442 +	call DecodeArrowMovementRLE  	cp $ff  	jp z, CheckFightingMapTrainers  	ld hl, wd736  	set 7, [hl] -	call Func_3486 +	call StartSimulatingJoypadStates  	ld a, (SFX_02_52 - SFX_Headers_02) / 3  	call PlaySound  	ld a, $ff @@ -136,7 +136,7 @@ RocketHideout3ArrowMovement12: ; 452e1 (11:52e1)  	db $FF  RocketHideout3Script3 ; 452e4 (11:452e4) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	jp nz, LoadSpinnerArrowTiles  	xor a diff --git a/scripts/rockethideout4.asm b/scripts/rockethideout4.asm index 5c99f3a1..097512c3 100755 --- a/scripts/rockethideout4.asm +++ b/scripts/rockethideout4.asm @@ -31,7 +31,7 @@ RocketHideout4Script_45473: ; 45473 (11:5473)  .asm_45498  	ld [wd09f], a  	ld bc, $050c -	predef_jump Func_ee9e +	predef_jump ReplaceTileBlock  RocketHideout4Script_454a3: ; 454a3 (11:54a3)  	xor a @@ -42,7 +42,7 @@ RocketHideout4Script_454a3: ; 454a3 (11:54a3)  RocketHideout4ScriptPointers: ; 454ae (11:54ae)c  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  	dw RocketHideout4Script3 @@ -58,7 +58,7 @@ RocketHideout4Script3: ; 454b6 (11:54b6)  	ld a, $a  	ld [H_SPRITEHEIGHT], a  	call DisplayTextID -	call GBFadeIn1 +	call GBFadeOutToBlack  	ld a, $83  	ld [wcc4d], a  	predef HideObject @@ -66,7 +66,7 @@ RocketHideout4Script3: ; 454b6 (11:54b6)  	ld [wcc4d], a  	predef ShowObject  	call UpdateSprites -	call GBFadeOut1 +	call GBFadeInFromBlack  	xor a  	ld [wJoyIgnore], a  	ld hl, wd126 @@ -130,9 +130,9 @@ RocketHideout4Text1: ; 4553a (11:553a)  	set 7, [hl]  	ld hl, RocketHideout4Text_4557f  	ld de, RocketHideout4Text_4557f -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	ldh a, [$8c] -	ld [wcf13], a +	ld [wSpriteIndex], a  	call EngageMapTrainer  	call InitBattleEnemyParameters  	xor a diff --git a/scripts/rockethideoutelevator.asm b/scripts/rockethideoutelevator.asm index 73313dd7..e7bc24f3 100755 --- a/scripts/rockethideoutelevator.asm +++ b/scripts/rockethideoutelevator.asm @@ -9,13 +9,13 @@ RocketHideoutElevatorScript: ; 45710 (11:5710)  	res 7, [hl]  	call nz, RocketHideoutElevatorScript_4575f  	xor a -	ld [wcf0c], a +	ld [wAutoTextBoxDrawingControl], a  	inc a -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	ret  RocketHideoutElevatorScript_4572c: ; 4572c (11:572c) -	ld hl, wd3af +	ld hl, wWarpEntries  	ld a, [wd73b]  	ld b, a  	ld a, [wd73c] diff --git a/scripts/rocktunnel1.asm b/scripts/rocktunnel1.asm index ad6e493f..1d514a05 100755 --- a/scripts/rocktunnel1.asm +++ b/scripts/rocktunnel1.asm @@ -9,7 +9,7 @@ RockTunnel1Script: ; 444dc (11:44dc)  RockTunnel1ScriptPointers: ; 444ef (11:44ef)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  RockTunnel1TextPointers: ; 444f5 (11:44f5) diff --git a/scripts/rocktunnel2.asm b/scripts/rocktunnel2.asm index a35a7325..98b804a7 100755 --- a/scripts/rocktunnel2.asm +++ b/scripts/rocktunnel2.asm @@ -9,7 +9,7 @@ RockTunnel2Script: ; 45feb (11:5feb)  RockTunnel2ScriptPointers: ; 45ffe (11:5ffe)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  RockTunnel2TextPointers: ; 46004 (11:6004) diff --git a/scripts/route10.asm b/scripts/route10.asm index e5e0dec2..c587b1df 100755 --- a/scripts/route10.asm +++ b/scripts/route10.asm @@ -9,7 +9,7 @@ Route10Script: ; 59336 (16:5336)  Route10ScriptPointers: ; 59349 (16:5349)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  Route10TextPointers: ; 5934f (16:534f) diff --git a/scripts/route11.asm b/scripts/route11.asm index fb50937e..629a6efd 100755 --- a/scripts/route11.asm +++ b/scripts/route11.asm @@ -9,7 +9,7 @@ Route11Script: ; 5944c (16:544c)  Route11ScriptPointers: ; 5945f (16:545f)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  Route11TextPointers: ; 59465 (16:5465) diff --git a/scripts/route12.asm b/scripts/route12.asm index b7ec451a..a38f6b83 100755 --- a/scripts/route12.asm +++ b/scripts/route12.asm @@ -16,7 +16,7 @@ Route12Script_59606: ; 59606 (16:5606)  Route12ScriptPointers: ; 59611 (16:5611)  	dw Route12Script0 -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  	dw Route12Script3 @@ -47,7 +47,7 @@ Route12Script3: ; 5964c (16:564c)  	cp $ff  	jr z, Route12Script_59606  	call UpdateSprites -	ld a, [wcf0b] +	ld a, [wBattleResult]  	cp $2  	jr z, .asm_59664  	ld a, $e diff --git a/scripts/route12gateupstairs.asm b/scripts/route12gateupstairs.asm index 94a4f9a2..c4c05cd6 100755 --- a/scripts/route12gateupstairs.asm +++ b/scripts/route12gateupstairs.asm @@ -75,5 +75,5 @@ Route12GateUpstairsScript_495c9: ; 495c9 (12:55c9)  	call PrintText  	xor a  .asm_495d8 -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	jp TextScriptEnd diff --git a/scripts/route13.asm b/scripts/route13.asm index b78b7cb2..21862dfc 100755 --- a/scripts/route13.asm +++ b/scripts/route13.asm @@ -9,7 +9,7 @@ Route13Script: ; 5581e (15:581e)  Route13ScriptPointers: ; 55831 (15:5831)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  Route13TextPointers: ; 55837 (15:5837) diff --git a/scripts/route14.asm b/scripts/route14.asm index 9d8d8fcb..d430f858 100755 --- a/scripts/route14.asm +++ b/scripts/route14.asm @@ -9,7 +9,7 @@ Route14Script: ; 559d3 (15:59d3)  Route14ScriptPointers: ; 559e6 (15:59e6)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  Route14TextPointers: ; 559ec (15:59ec) diff --git a/scripts/route15.asm b/scripts/route15.asm index 789ace21..733d4a1c 100755 --- a/scripts/route15.asm +++ b/scripts/route15.asm @@ -9,7 +9,7 @@ Route15Script: ; 597ae (16:57ae)  Route15ScriptPointers: ; 597c1 (16:57c1)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  Route15TextPointers: ; 597c7 (16:57c7) diff --git a/scripts/route16.asm b/scripts/route16.asm index 01bd35ad..59f8cb24 100755 --- a/scripts/route16.asm +++ b/scripts/route16.asm @@ -16,7 +16,7 @@ Route16Script_59946: ; 59946 (16:5946)  Route16ScriptPointers: ; 59951 (16:5951)  	dw Route16Script0 -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  	dw Route16Script3 @@ -48,7 +48,7 @@ Route16Script3: ; 5998f (16:598f)  	cp $ff  	jp z, Route16Script_59946  	call UpdateSprites -	ld a, [wcf0b] +	ld a, [wBattleResult]  	cp $2  	jr z, .asm_599a8  	ld a, $b diff --git a/scripts/route16gate.asm b/scripts/route16gate.asm index e7179ea7..54bca413 100755 --- a/scripts/route16gate.asm +++ b/scripts/route16gate.asm @@ -28,13 +28,13 @@ Route16GateScript0: ; 496d7 (12:56d7)  	jr z, .asm_4970e ; 0x496f1 $1b  	ld a, [wWhichTrade]  	dec a -	ld [wcd38], a +	ld [wSimulatedJoypadStatesIndex], a  	ld b, $0  	ld c, a  	ld a, $40 -	ld hl, wccd3 +	ld hl, wSimulatedJoypadStatesEnd  	call FillMemory -	call Func_3486 +	call StartSimulatingJoypadStates  	ld a, $1  	ld [W_ROUTE16GATECURSCRIPT], a  	ret @@ -51,7 +51,7 @@ CoordsData_49714: ; 49714 (12:5714)  	db $FF  Route16GateScript1: ; 4971d (12:571d) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	ld a, $f0 @@ -62,16 +62,16 @@ Route16GateScript2: ; 49727 (12:5727)  	ld [H_SPRITEHEIGHT], a  	call DisplayTextID  	ld a, $1 -	ld [wcd38], a +	ld [wSimulatedJoypadStatesIndex], a  	ld a, $10 -	ld [wccd3], a -	call Func_3486 +	ld [wSimulatedJoypadStatesEnd], a +	call StartSimulatingJoypadStates  	ld a, $3  	ld [W_ROUTE16GATECURSCRIPT], a  	ret  Route16GateScript3: ; 49741 (12:5741) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	xor a diff --git a/scripts/route17.asm b/scripts/route17.asm index 78ceb2ae..ffd00634 100755 --- a/scripts/route17.asm +++ b/scripts/route17.asm @@ -9,7 +9,7 @@ Route17Script: ; 55b7a (15:5b7a)  Route17ScriptPointers: ; 55b8d (15:5b8d)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  Route17TextPointers: ; 55b93 (15:5b93) diff --git a/scripts/route18.asm b/scripts/route18.asm index a0e4487a..de2fe19a 100755 --- a/scripts/route18.asm +++ b/scripts/route18.asm @@ -9,7 +9,7 @@ Route18Script: ; 59ac7 (16:5ac7)  Route18ScriptPointers: ; 59ada (16:5ada)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  Route18TextPointers: ; 59ae0 (16:5ae0) diff --git a/scripts/route18gate.asm b/scripts/route18gate.asm index 03c4b921..1500f578 100755 --- a/scripts/route18gate.asm +++ b/scripts/route18gate.asm @@ -28,13 +28,13 @@ Route18GateScript0: ; 4988f (12:588f)  	jr z, .asm_498c6 ; 0x498a9 $1b  	ld a, [wWhichTrade]  	dec a -	ld [wcd38], a +	ld [wSimulatedJoypadStatesIndex], a  	ld b, $0  	ld c, a  	ld a, $40 -	ld hl, wccd3 +	ld hl, wSimulatedJoypadStatesEnd  	call FillMemory -	call Func_3486 +	call StartSimulatingJoypadStates  	ld a, $1  	ld [W_ROUTE18GATECURSCRIPT], a  	ret @@ -51,7 +51,7 @@ CoordsData_498cc: ; 498cc (12:58cc)  	db $FF  Route18GateScript1: ; 498d5 (12:58d5) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	ld a, $f0 @@ -62,16 +62,16 @@ Route18GateScript2: ; 498df (12:58df)  	ld [H_SPRITEHEIGHT], a  	call DisplayTextID  	ld a, $1 -	ld [wcd38], a +	ld [wSimulatedJoypadStatesIndex], a  	ld a, $10 -	ld [wccd3], a -	call Func_3486 +	ld [wSimulatedJoypadStatesEnd], a +	call StartSimulatingJoypadStates  	ld a, $3  	ld [W_ROUTE18GATECURSCRIPT], a  	ret  Route18GateScript3: ; 498f9 (12:58f9) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	xor a diff --git a/scripts/route19.asm b/scripts/route19.asm index 6c749b03..40c7aeb3 100755 --- a/scripts/route19.asm +++ b/scripts/route19.asm @@ -9,7 +9,7 @@ Route19Script: ; 55d44 (15:5d44)  Route19ScriptPointers: ; 55d57 (15:5d57)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  Route19TextPointers: ; 55d5d (15:5d5d) diff --git a/scripts/route20.asm b/scripts/route20.asm index 7e8df3da..47edf376 100755 --- a/scripts/route20.asm +++ b/scripts/route20.asm @@ -58,7 +58,7 @@ Route20Script_50d14: ; 50d14 (14:4d14)  Route20ScriptPointers: ; 50d1c (14:4d1c)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  Route20TextPointers: ; 50d22 (14:4d22) diff --git a/scripts/route21.asm b/scripts/route21.asm index 034282f8..de2046dc 100755 --- a/scripts/route21.asm +++ b/scripts/route21.asm @@ -9,7 +9,7 @@ Route21Script: ; 55eeb (15:5eeb)  Route21ScriptPointers: ; 55efe (15:5efe)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  Route21TextPointers: ; 55f04 (15:5f04) diff --git a/scripts/route22.asm b/scripts/route22.asm index aba6a479..233d42c3 100755 --- a/scripts/route22.asm +++ b/scripts/route22.asm @@ -45,7 +45,7 @@ Route22MoveRivalSprite: ; 50ee6 (14:4ee6)  	call MoveSprite  	ld a, $c  	ld [$ff8d], a -	jp Func_34a6 +	jp SetSpriteFacingDirectionAndDelay  Route22RivalMovementData: ; 50efb (14:4efb)  	db $C0,$C0,$C0,$C0,$FF ; move right 4 times @@ -83,7 +83,7 @@ Route22Script0: ; 50f00 (14:4f00)  	xor a  	ld [wcd50], a  	predef EmotionBubble -	ld a, [wd700] +	ld a, [wWalkBikeSurfState]  	and a  	jr z, .asm_50f4e ; 0x50f44 $8  	ld a, $ff @@ -117,7 +117,7 @@ Route22Script1: ; 50f62 (14:4f62)  	ld [$ff8d], a  	ld a, $1  	ld [$ff8c], a -	call Func_34a6 +	call SetSpriteFacingDirectionAndDelay  	xor a  	ld [wJoyIgnore], a  	ld a, $1 @@ -128,7 +128,7 @@ Route22Script1: ; 50f62 (14:4f62)  	set 7, [hl]  	ld hl, Route22RivalDefeatedText1  	ld de, Route22Text_511bc -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	ld a, SONY1 + $c8  	ld [W_CUROPPONENT], a  	ld hl, StarterMons_50faf ; $4faf @@ -158,7 +158,7 @@ Route22Script2: ; 50fb5 (14:4fb5)  	ld [$ff8d], a  	ld a, $1  	ld [$ff8c], a -	call Func_34a6 +	call SetSpriteFacingDirectionAndDelay  	ld a, $f0  	ld [wJoyIgnore], a  	ld hl, wd7eb @@ -208,7 +208,7 @@ Route22Script3: ; 5102a (14:502a)  	ld a, $22  	ld [wcc4d], a  	predef HideObject -	call Func_2307 +	call PlayDefaultMusic  	ld hl, wd7eb  	res 0, [hl]  	res 7, [hl] @@ -222,7 +222,7 @@ Route22Script_5104e: ; 5104e (14:504e)  	xor a  	ld [wcd50], a  	predef EmotionBubble -	ld a, [wd700] +	ld a, [wWalkBikeSurfState]  	and a  	jr z, .skipYVisibilityTesta  	ld a, $ff @@ -259,7 +259,7 @@ Route22Script4: ; 51087 (14:5087)  	ld a, $c  .asm_510a8  	ld [$ff8d], a -	call Func_34a6 +	call SetSpriteFacingDirectionAndDelay  	xor a  	ld [wJoyIgnore], a  	ld a, $2 @@ -270,7 +270,7 @@ Route22Script4: ; 51087 (14:5087)  	set 7, [hl]  	ld hl, Route22RivalDefeatedText2 ; $51cb  	ld de, Route22Text_511d0 ; $51d0 -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	ld a, SONY2 + $c8  	ld [W_CUROPPONENT], a ; wd059  	ld hl, StarterMons_510d9 ; $50d9 @@ -303,7 +303,7 @@ Route22Script5: ; 510df (14:50df)  	ld a, $c  .asm_51102  	ld [$ff8d], a -	call Func_34a6 +	call SetSpriteFacingDirectionAndDelay  	ld a, $f0  	ld [wJoyIgnore], a  	ld hl, wd7eb @@ -353,7 +353,7 @@ Route22Script6: ; 51151 (14:5151)  	ld a, $23  	ld [wcc4d], a  	predef HideObject -	call Func_2307 +	call PlayDefaultMusic  	ld hl, wd7eb  	res 1, [hl]  	res 7, [hl] diff --git a/scripts/route22gate.asm b/scripts/route22gate.asm index 107926cf..6618d6a2 100755 --- a/scripts/route22gate.asm +++ b/scripts/route22gate.asm @@ -34,15 +34,15 @@ Route22GateScriptCoords: ; 1e6b5 (7:66b5)  Route22GateScript_1e6ba: ; 1e6ba (7:66ba)  	ld a, $1 -	ld [wcd38], a +	ld [wSimulatedJoypadStatesIndex], a  	ld a, $80 -	ld [wccd3], a +	ld [wSimulatedJoypadStatesEnd], a  	ld [wSpriteStateData1 + 9], a  	ld [wJoyIgnore], a -	jp Func_3486 +	jp StartSimulatingJoypadStates  Route22GateScript1: ; 1e6cd (7:66cd) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	xor a diff --git a/scripts/route23.asm b/scripts/route23.asm index 55184600..17525071 100755 --- a/scripts/route23.asm +++ b/scripts/route23.asm @@ -118,16 +118,16 @@ CascadeBadgeText: ; 512cb (14:52cb)  Route23Script_512d8: ; 512d8 (14:52d8)  	ld a, $1 -	ld [wcd38], a +	ld [wSimulatedJoypadStatesIndex], a  	ld a, $80 -	ld [wccd3], a +	ld [wSimulatedJoypadStatesEnd], a  	xor a  	ld [wSpriteStateData1 + 9], a  	ld [wJoyIgnore], a -	jp Func_3486 +	jp StartSimulatingJoypadStates  Route23Script1: ; 512ec (14:52ec) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  Route23Script2: ; 512f1 (14:52f1) diff --git a/scripts/route24.asm b/scripts/route24.asm index cafb3f8e..6916cbe7 100755 --- a/scripts/route24.asm +++ b/scripts/route24.asm @@ -16,7 +16,7 @@ Route24Script_513c0: ; 513c0 (14:53c0)  Route24ScriptPointers: ; 513cb (14:53cb)  	dw Route24Script0 -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  	dw Route24Script3  	dw Route24Script4 @@ -38,10 +38,10 @@ Route24Script0: ; 513d5 (14:53d5)  	res 1, [hl]  	ret z  	ld a, $80 -	ld [wccd3], a +	ld [wSimulatedJoypadStatesEnd], a  	ld a, $1 -	ld [wcd38], a -	call Func_3486 +	ld [wSimulatedJoypadStatesIndex], a +	call StartSimulatingJoypadStates  	ld a, $4  	ld [W_ROUTE24CURSCRIPT], a  	ld [W_CURMAPSCRIPT], a @@ -51,7 +51,7 @@ CoordsData_5140e: ; 5140e (14:540e)  	db $0F,$0A,$FF  Route24Script4: ; 51411 (14:5411) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	call Delay3 @@ -169,9 +169,9 @@ Route24Text1: ; 514a4 (14:54a4)  	set 7, [hl]  	ld hl, Route24Text_5152b  	ld de, Route24Text_5152b -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	ld a, [$ff8c] -	ld [wcf13], a +	ld [wSpriteIndex], a  	call EngageMapTrainer  	call InitBattleEnemyParameters  	xor a diff --git a/scripts/route25.asm b/scripts/route25.asm index 088be3a2..720259ca 100755 --- a/scripts/route25.asm +++ b/scripts/route25.asm @@ -38,7 +38,7 @@ Route25Script_515e1: ; 515e1 (14:55e1)  Route25ScriptPointers: ; 51622 (14:5622)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  Route25TextPointers: ; 51628 (14:5628) diff --git a/scripts/route3.asm b/scripts/route3.asm index 5cd35fd9..acb2afce 100755 --- a/scripts/route3.asm +++ b/scripts/route3.asm @@ -9,7 +9,7 @@ Route3Script: ; 554f8 (15:54f8)  Route3ScriptPointers: ; 5550b (15:550b)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  Route3TextPointers: ; 55511 (15:5511) diff --git a/scripts/route4.asm b/scripts/route4.asm index fa234590..5eafb4f7 100755 --- a/scripts/route4.asm +++ b/scripts/route4.asm @@ -9,7 +9,7 @@ Route4Script: ; 55658 (15:5658)  Route4ScriptPointers: ; 5566b (15:566b)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  Route4TextPointers: ; 55671 (15:5671) diff --git a/scripts/route5gate.asm b/scripts/route5gate.asm index 0e8d0d1c..bee70e77 100755 --- a/scripts/route5gate.asm +++ b/scripts/route5gate.asm @@ -10,10 +10,10 @@ Route5GateScriptPointers: ; 1df3f (7:5f3f)  Route5GateScript_1df43: ; 1df43 (7:5f43)  	ld a, $40 -	ld [wccd3], a +	ld [wSimulatedJoypadStatesEnd], a  	ld a, $1 -	ld [wcd38], a -	jp Func_3486 +	ld [wSimulatedJoypadStatesIndex], a +	jp StartSimulatingJoypadStates  Route5GateScript0: ; 1df50 (7:5f50)  	ld a, [wd728] @@ -51,7 +51,7 @@ CoordsData_1df8f: ; 1df8f (7:5f8f)  	db $ff  Route5GateScript1: ; 1df94 (7:5f94) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	call Delay3 diff --git a/scripts/route6.asm b/scripts/route6.asm index 018c1b80..ee6258cd 100755 --- a/scripts/route6.asm +++ b/scripts/route6.asm @@ -9,7 +9,7 @@ Route6Script: ; 590b0 (16:50b0)  Route6ScriptPointers: ; 590c3 (16:50c3)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  Route6TextPointers: ; 590c9 (16:50c9) diff --git a/scripts/route6gate.asm b/scripts/route6gate.asm index 9945f80f..44d03a75 100755 --- a/scripts/route6gate.asm +++ b/scripts/route6gate.asm @@ -43,7 +43,7 @@ CoordsData_1e08c: ; 1e08c (7:608c)  	db $02,$04,$FF  Route6GateScript1: ; 1e091 (7:6091) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	call Delay3 @@ -56,12 +56,12 @@ Route6GateScript_1e0a1: ; 1e0a1 (7:60a1)  	ld hl, wd730  	set 7, [hl]  	ld a, $80 -	ld [wccd3], a +	ld [wSimulatedJoypadStatesEnd], a  	ld a, $1 -	ld [wcd38], a +	ld [wSimulatedJoypadStatesIndex], a  	xor a  	ld [wSpriteStateData2 + $06], a -	ld [wcd3b], a +	ld [wOverrideSimulatedJoypadStatesMask], a  	ret  Route6GateTextPointers: ; 1e0b8 (7:60b8) diff --git a/scripts/route7gate.asm b/scripts/route7gate.asm index c9599706..beab96bf 100755 --- a/scripts/route7gate.asm +++ b/scripts/route7gate.asm @@ -13,12 +13,12 @@ Route7GateScript_1e111: ; 1e111 (7:6111)  	ld hl, wd730  	set 7, [hl]  	ld a, $20 -	ld [wccd3], a +	ld [wSimulatedJoypadStatesEnd], a  	ld a, $1 -	ld [wcd38], a +	ld [wSimulatedJoypadStatesIndex], a  	xor a  	ld [wSpriteStateData2 + $06], a -	ld [wcd3b], a +	ld [wOverrideSimulatedJoypadStatesMask], a  	ret  Route7GateScript0: ; 1e128 (7:6128) @@ -57,7 +57,7 @@ CoordsData_1e167: ; 1e167 (7:6167)  	db $ff  Route7GateScript1: ; 1e16c (7:616c) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	call Delay3 diff --git a/scripts/route8.asm b/scripts/route8.asm index bf41b5ae..eed57c7b 100755 --- a/scripts/route8.asm +++ b/scripts/route8.asm @@ -9,7 +9,7 @@ Route8Script: ; 591b6 (16:51b6)  Route8ScriptPointers: ; 591c9 (16:51c9)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  Route8TextPointers: ; 591cf (16:51cf) diff --git a/scripts/route8gate.asm b/scripts/route8gate.asm index aff001b4..8ea12f04 100755 --- a/scripts/route8gate.asm +++ b/scripts/route8gate.asm @@ -12,12 +12,12 @@ Route8GateScript_1e1d7: ; 1e1d7 (7:61d7)  	ld hl, wd730  	set 7, [hl]  	ld a, $10 -	ld [wccd3], a +	ld [wSimulatedJoypadStatesEnd], a  	ld a, $1 -	ld [wcd38], a +	ld [wSimulatedJoypadStatesIndex], a  	xor a  	ld [wSpriteStateData2 + $06], a -	ld [wcd3b], a +	ld [wOverrideSimulatedJoypadStatesMask], a  	ret  Route8GateScript0: ; 1e1ee (7:61ee) @@ -55,7 +55,7 @@ CoordsData_1e22c: ; 1e22c (7:622c)  	db $ff  Route8GateScript1: ; 1e231 (7:6231) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	call Delay3 diff --git a/scripts/route9.asm b/scripts/route9.asm index f14abef8..77b216c6 100755 --- a/scripts/route9.asm +++ b/scripts/route9.asm @@ -9,7 +9,7 @@ Route9Script: ; 556bc (15:56bc)  Route9ScriptPointers: ; 556cf (15:56cf)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  Route9TextPointers: ; 556d5 (15:56d5) diff --git a/scripts/safarizoneentrance.asm b/scripts/safarizoneentrance.asm index ffc7f402..8ae81f81 100755 --- a/scripts/safarizoneentrance.asm +++ b/scripts/safarizoneentrance.asm @@ -121,14 +121,14 @@ SafariZoneEntranceScript_752a3: ; 752a3 (1d:52a3)  	push af  	ld b, $0  	ld a, c -	ld [wcd38], a -	ld hl, wccd3 +	ld [wSimulatedJoypadStatesIndex], a +	ld hl, wSimulatedJoypadStatesEnd  	pop af  	call FillMemory -	jp Func_3486 +	jp StartSimulatingJoypadStates  SafariZoneEntranceScript_752b4: ; 752b4 (1d:52b4) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret diff --git a/scripts/saffrongym.asm b/scripts/saffrongym.asm index 336d40e9..7c2eb559 100755 --- a/scripts/saffrongym.asm +++ b/scripts/saffrongym.asm @@ -31,7 +31,7 @@ SaffronGymText_5d048: ; 5d048 (17:5048)  SaffronGymScriptPointers: ; 5d053 (17:5053)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  	dw SaffronGymScript3 @@ -178,9 +178,9 @@ SaffronGymText1: ; 5d118 (17:5118)  	set 7, [hl]  	ld hl, SaffronGymText_5d167  	ld de, SaffronGymText_5d167 -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	ldh a, [$8c] -	ld [wcf13], a +	ld [wSpriteIndex], a  	call EngageMapTrainer  	call InitBattleEnemyParameters  	ld a, $6 diff --git a/scripts/seafoamislands1.asm b/scripts/seafoamislands1.asm index 55bbd43e..1fe0852b 100755 --- a/scripts/seafoamislands1.asm +++ b/scripts/seafoamislands1.asm @@ -34,7 +34,7 @@ SeafoamIslands1Script: ; 447e9 (11:47e9)  	predef_jump ShowObject  .asm_4483b  	ld a, $9f -	ld [wd71d], a +	ld [wDungeonWarpDestinationMap], a  	ld hl, Seafoam1HolesCoords  	jp Func_46981 diff --git a/scripts/seafoamislands2.asm b/scripts/seafoamislands2.asm index b14c16d8..e392620a 100755 --- a/scripts/seafoamislands2.asm +++ b/scripts/seafoamislands2.asm @@ -32,7 +32,7 @@ SeafoamIslands2Script: ; 46315 (11:6315)  	predef_jump ShowObject  .asm_46362  	ld a, $a0 -	ld [wd71d], a +	ld [wDungeonWarpDestinationMap], a  	ld hl, Seafoam2HolesCoords  	jp Func_46981 diff --git a/scripts/seafoamislands3.asm b/scripts/seafoamislands3.asm index aa7b3615..ba34a2c3 100755 --- a/scripts/seafoamislands3.asm +++ b/scripts/seafoamislands3.asm @@ -32,7 +32,7 @@ SeafoamIslands3Script: ; 46451 (11:6451)  	predef_jump ShowObject  .asm_4649e  	ld a, $a1 -	ld [wd71d], a +	ld [wDungeonWarpDestinationMap], a  	ld hl, Seafoam3HolesCoords  	jp Func_46981 diff --git a/scripts/seafoamislands4.asm b/scripts/seafoamislands4.asm index ac573994..a56382dd 100755 --- a/scripts/seafoamislands4.asm +++ b/scripts/seafoamislands4.asm @@ -33,7 +33,7 @@ SeafoamIslands4Script: ; 4658d (11:658d)  	jr .asm_465ed ; 0x465da $11  .asm_465dc  	ld a, $a2 -	ld [wd71d], a +	ld [wDungeonWarpDestinationMap], a  	ld hl, Seafoam4HolesCoords  	call Func_46981  	ld a, [wd732] @@ -66,12 +66,12 @@ SeafoamIslands4Script0: ; 46603 (11:6603)  	ld a, [W_XCOORD]  	cp $f  	ret nz -	ld hl, wccd3 +	ld hl, wSimulatedJoypadStatesEnd  	ld de, RLEMovement46632  	call DecodeRLEList  	dec a -	ld [wcd38], a -	call Func_3486 +	ld [wSimulatedJoypadStatesIndex], a +	call StartSimulatingJoypadStates  	ld hl, W_FLAGS_D733  	set 2, [hl]  	ld a, $1 @@ -85,7 +85,7 @@ RLEMovement46632: ; 46632 (11:6632)  	db $ff  SeafoamIslands4Script1: ; 46639 (11:6639) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	ld a, $0 @@ -108,10 +108,10 @@ SeafoamIslands4Script2: ; 46644 (11:6644)  .asm_4665e  	ld de, RLEData_46688  .asm_46661 -	ld hl, wccd3 +	ld hl, wSimulatedJoypadStatesEnd  	call DecodeRLEList  	dec a -	ld [wcd38], a +	ld [wSimulatedJoypadStatesIndex], a  	xor a  	ld [wSpriteStateData2 + $06], a  	ld hl, wd730 @@ -130,7 +130,7 @@ RLEData_46688: ; 46688 (11:6688)  	db $80,$06,$10,$02,$80,$04,$FF  SeafoamIslands4Script3: ; 4668f (11:668f) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	ld a, $0 diff --git a/scripts/seafoamislands5.asm b/scripts/seafoamislands5.asm index bea63321..b554034b 100755 --- a/scripts/seafoamislands5.asm +++ b/scripts/seafoamislands5.asm @@ -44,10 +44,10 @@ SeafoamIslands5Script0: ; 467c7 (11:67c7)  .asm_467e6  	ld a, $1  .asm_467e8 -	ld [wcd38], a +	ld [wSimulatedJoypadStatesIndex], a  	ld a, $40 -	ld [wccd3], a -	call Func_3486 +	ld [wSimulatedJoypadStatesEnd], a +	call StartSimulatingJoypadStates  	ld hl, W_FLAGS_D733  	res 2, [hl]  	ld a, $1 @@ -62,7 +62,7 @@ CoordsData_467fe: ; 467fe (11:67fe)  	db $FF  SeafoamIslands5Script1: ; 46807 (11:6807) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	xor a @@ -89,11 +89,11 @@ SeafoamIslands5Script2: ; 46816 (11:6816)  .asm_46837  	ld de, RLEMovementData_46852  .asm_4683a -	ld hl, wccd3 +	ld hl, wSimulatedJoypadStatesEnd  	call DecodeRLEList  	dec a -	ld [wcd38], a -	call Func_3486 +	ld [wSimulatedJoypadStatesIndex], a +	call StartSimulatingJoypadStates  	ld a, $3  .asm_46849  	ld [W_SEAFOAMISLANDS5CURSCRIPT], a @@ -117,7 +117,7 @@ RLEMovementData_46859: ; 46859 (11:6859)  	db $FF  SeafoamIslands5Script3: ; 46860 (11:6860) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	ld b, a  	cp $1  	call z, SeaFoamIslands5Script_46872 @@ -130,8 +130,8 @@ SeafoamIslands5Script3: ; 46860 (11:6860)  SeaFoamIslands5Script_46872: ; 46872 (11:6872)  	xor a -	ld [wd700], a -	ld [wd11a], a +	ld [wWalkBikeSurfState], a +	ld [wWalkBikeSurfStateCopy], a  	jp ForceBikeOrSurf  SeafoamIslands5TextPointers: ; 4687c (11:687c) diff --git a/scripts/silphco10.asm b/scripts/silphco10.asm index c831655f..7d044aca 100755 --- a/scripts/silphco10.asm +++ b/scripts/silphco10.asm @@ -22,7 +22,7 @@ SilphCo10Script_5a14f: ; 5a14f (16:614f)  	ld a, $54  	ld [wd09f], a  	ld bc, $405 -	predef_jump Func_ee9e +	predef_jump ReplaceTileBlock  DataTable_5a173: ; 5a173 (16:6173)  	db $04,$05,$FF @@ -37,7 +37,7 @@ SilphCo10Text_5a176: ; 5a176 (16:6176)  SilphCo10ScriptPointers: ; 5a180 (16:6180)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  SilphCo10TextPointers: ; 5a186 (16:6186) diff --git a/scripts/silphco11.asm b/scripts/silphco11.asm index b63bc523..43ae72f6 100755 --- a/scripts/silphco11.asm +++ b/scripts/silphco11.asm @@ -22,14 +22,14 @@ SilphCo11Script_62110: ; 62110 (18:6110)  	ld a, $20  	ld [wd09f], a  	ld bc, $603 -	predef_jump Func_ee9e +	predef_jump ReplaceTileBlock  DataTable_62134: ; 62134 (18:6134)  	db $06,$03,$FF  SilphCo11Script_62137: ; 62137 (18:6137)  	push hl -	ld hl, wd73f +	ld hl, wCardKeyDoorY  	ld a, [hli]  	ld b, a  	ld a, [hl] @@ -53,7 +53,7 @@ SilphCo11Script_62137: ; 62137 (18:6137)  	ld a, [hli]  	cp c  	jr nz, .asm_62143 -	ld hl, wd73f +	ld hl, wCardKeyDoorY  	xor a  	ld [hli], a  	ld [hl], a @@ -116,7 +116,7 @@ SilphCo11Script_621c8: ; 621c8 (18:61c8)  SilphCo11ScriptPointers: ; 621cf (18:61cf)  	dw SilphCo11Script0 -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  	dw SilphCo11Script3  	dw SilphCo11Script4 @@ -160,7 +160,7 @@ SilphCo11Script_6221a: ; 6221a (18:621a)  	ld [H_DOWNARROWBLINKCNT2], a ; $ff8c  	ld a, b  	ld [$ff8d], a -	jp Func_34a6 +	jp SetSpriteFacingDirectionAndDelay  SilphCo11Script5: ; 62227 (18:6227)  	ld a, [W_ISINBATTLE] ; W_ISINBATTLE @@ -182,11 +182,11 @@ SilphCo11Script5: ; 62227 (18:6227)  	ld a, $6  	ld [H_DOWNARROWBLINKCNT2], a ; $ff8c  	call DisplayTextID -	call GBFadeIn1 +	call GBFadeOutToBlack  	call SilphCo11Script_6216d  	call UpdateSprites  	call Delay3 -	call GBFadeOut1 +	call GBFadeInFromBlack  	ld hl, wd838  	set 7, [hl]  	xor a @@ -221,9 +221,9 @@ SilphCo11Script4: ; 62293 (18:6293)  	set 7, [hl]  	ld hl, SilphCo10Text_62330 ; $6330  	ld de, SilphCo10Text_62330 ; $6330 -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	ld a, [H_DOWNARROWBLINKCNT2] ; $ff8c -	ld [wcf13], a +	ld [wSpriteIndex], a  	call EngageMapTrainer  	call InitBattleEnemyParameters  	xor a diff --git a/scripts/silphco2.asm b/scripts/silphco2.asm index 20d689e6..63803acd 100755 --- a/scripts/silphco2.asm +++ b/scripts/silphco2.asm @@ -23,7 +23,7 @@ SilphCo2Script_59d07: ; 59d07 (16:5d07)  	ld a, $54  	ld [wd09f], a  	ld bc, $0202 -	predef Func_ee9e +	predef ReplaceTileBlock  	pop af  .asm_59d2e  	bit 6, a @@ -31,14 +31,14 @@ SilphCo2Script_59d07: ; 59d07 (16:5d07)  	ld a, $54  	ld [wd09f], a  	ld bc, $0502 -	predef_jump Func_ee9e +	predef_jump ReplaceTileBlock  DataTable_59d3e: ; 59d3e (16:5d3e)  	db $02,$02,$05,$02,$FF  SilphCo2Script_59d43: ; 59d43 (16:5d43)  	push hl -	ld hl, wd73f +	ld hl, wCardKeyDoorY  	ld a, [hli]  	ld b, a  	ld a, [hl] @@ -62,7 +62,7 @@ SilphCo2Script_59d43: ; 59d43 (16:5d43)  	ld a, [hli]  	cp c  	jr nz, .asm_59d4f -	ld hl, wd73f +	ld hl, wCardKeyDoorY  	xor a  	ld [hli], a  	ld [hl], a @@ -87,7 +87,7 @@ SilphCo2Script_59d6f: ; 59d6f (16:5d6f)  SilphCo2ScriptPointers: ; 59d80 (16:5d80)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  SilphCo2TextPointers: ; 59d86 (16:5d86) diff --git a/scripts/silphco3.asm b/scripts/silphco3.asm index 5527d923..7b0c67c1 100755 --- a/scripts/silphco3.asm +++ b/scripts/silphco3.asm @@ -23,7 +23,7 @@ SilphCo3Script_59f71: ; 59f71 (16:5f71)  	ld a, $5f  	ld [wd09f], a  	ld bc, $404 -	predef Func_ee9e +	predef ReplaceTileBlock  	pop af  .asm_59f98  	bit 1, a @@ -31,7 +31,7 @@ SilphCo3Script_59f71: ; 59f71 (16:5f71)  	ld a, $5f  	ld [wd09f], a  	ld bc, $408 -	predef_jump Func_ee9e +	predef_jump ReplaceTileBlock  DataTable_59fa8: ; 59fa8 (16:5fa8)  	db $04,$04,$04,$08,$FF @@ -51,7 +51,7 @@ SilphCo3Script_59fad: ; 59fad (16:5fad)  SilphCo3ScriptPointers: ; 59fbe (16:5fbe)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  SilphCo3TextPointers: ; 59fc4 (16:5fc4) diff --git a/scripts/silphco4.asm b/scripts/silphco4.asm index 718077ce..15a46dd3 100755 --- a/scripts/silphco4.asm +++ b/scripts/silphco4.asm @@ -23,7 +23,7 @@ SilphCo4Script_19d21: ; 19d21 (6:5d21)  	ld a, $54  	ld [wd09f], a  	ld bc, $0602 -	predef Func_ee9e +	predef ReplaceTileBlock  	pop af  .asm_19d48  	bit 1, a @@ -31,14 +31,14 @@ SilphCo4Script_19d21: ; 19d21 (6:5d21)  	ld a, $54  	ld [wd09f], a  	ld bc, $0406 -	predef_jump Func_ee9e +	predef_jump ReplaceTileBlock  SilphCo4Data19d58: ; 19d58 (6:5d58)  	db $06, $02, $04, $06, $ff  SilphCo4Script_19d5d: ; 19d5d (6:5d5d)  	push hl -	ld hl, wd73f +	ld hl, wCardKeyDoorY  	ld a, [hli]  	ld b, a  	ld a, [hl] @@ -62,7 +62,7 @@ SilphCo4Script_19d5d: ; 19d5d (6:5d5d)  	ld a, [hli]  	cp c  	jr nz, .asm_19d69 ; 0x19d7c $eb -	ld hl, wd73f +	ld hl, wCardKeyDoorY  	xor a  	ld [hli], a  	ld [hl], a @@ -87,7 +87,7 @@ SilphCo4Script_19d89: ; 19d89 (6:5d89)  SilphCo4ScriptPointers: ; 19d9a (6:5d9a)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  SilphCo4TextPointers: ; 19da0 (6:5da0) diff --git a/scripts/silphco5.asm b/scripts/silphco5.asm index 709af20b..0b63708b 100755 --- a/scripts/silphco5.asm +++ b/scripts/silphco5.asm @@ -23,7 +23,7 @@ SilphCo5Script_19f4d: ; 19f4d (6:5f4d)  	ld a, $5f  	ld [wd09f], a  	ld bc, $0203 -	predef Func_ee9e +	predef ReplaceTileBlock  	pop af  .asm_19f74  	bit 1, a @@ -32,7 +32,7 @@ SilphCo5Script_19f4d: ; 19f4d (6:5f4d)  	ld a, $5f  	ld [wd09f], a  	ld bc, $0603 -	predef Func_ee9e +	predef ReplaceTileBlock  	pop af  .asm_19f87  	bit 2, a @@ -40,7 +40,7 @@ SilphCo5Script_19f4d: ; 19f4d (6:5f4d)  	ld a, $5f  	ld [wd09f], a  	ld bc, $0507 -	predef_jump Func_ee9e +	predef_jump ReplaceTileBlock  SilphCo5Coords: ; 19f97 (6:5f97) ; coords?  	db $02, $03, $06, $03, $05, $07, $ff @@ -65,7 +65,7 @@ SilphCo5Script_19f9e: ; 19f9e (6:5f9e)  SilphCo5ScriptPointers: ; 19fb6 (6:5fb6)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  SilphCo5TextPointers: ; 19fbc (6:5fbc) diff --git a/scripts/silphco6.asm b/scripts/silphco6.asm index 4a9477c6..137e31be 100755 --- a/scripts/silphco6.asm +++ b/scripts/silphco6.asm @@ -22,7 +22,7 @@ SilphCo6Script_1a1bf: ; 1a1bf (6:61bf)  	ld a, $5f  	ld [wd09f], a  	ld bc, $0602 -	predef_jump Func_ee9e +	predef_jump ReplaceTileBlock  SilphCo6Coords1: ; 1a1e3 (6:61e3)  	db $06, $02 @@ -38,7 +38,7 @@ SilphCo6Script_1a1e6: ; 1a1e6 (6:61e6)  SilphCo6ScriptPointers: ; 1a1f0 (6:61f0)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  SilphCo6TextPointers: ; 1a1f6 (6:61f6) diff --git a/scripts/silphco7.asm b/scripts/silphco7.asm index bd611763..2fc3c51a 100755 --- a/scripts/silphco7.asm +++ b/scripts/silphco7.asm @@ -23,7 +23,7 @@ SilphCo7Script_51b77: ; 51b77 (14:5b77)  	ld a, $54  	ld [wd09f], a  	ld bc, $305 -	predef Func_ee9e +	predef ReplaceTileBlock  	pop af  .asm_51b9e  	bit 5, a @@ -32,7 +32,7 @@ SilphCo7Script_51b77: ; 51b77 (14:5b77)  	ld a, $54  	ld [wd09f], a  	ld bc, $20a -	predef Func_ee9e +	predef ReplaceTileBlock  	pop af  .asm_51bb1  	bit 6, a @@ -40,14 +40,14 @@ SilphCo7Script_51b77: ; 51b77 (14:5b77)  	ld a, $54  	ld [wd09f], a  	ld bc, $60a -	predef_jump Func_ee9e +	predef_jump ReplaceTileBlock  DataTable_51bc1: ; 51bc1 (14:5bc1)  	db $03,$05,$02,$0A,$06,$0A,$FF  SilphCo7Text_51bc8: ; 51bc8 (14:5bc8)  	push hl -	ld hl, wd73f +	ld hl, wCardKeyDoorY  	ld a, [hli]  	ld b, a  	ld a, [hl] @@ -71,7 +71,7 @@ SilphCo7Text_51bc8: ; 51bc8 (14:5bc8)  	ld a, [hli]  	cp c  	jr nz, .asm_51bd4 -	ld hl, wd73f +	ld hl, wCardKeyDoorY  	xor a  	ld [hli], a  	ld [hl], a @@ -110,7 +110,7 @@ SilphCo7Text_51c10: ; 51c10 (14:5c10)  SilphCo7ScriptPointers: ; 51c17 (14:5c17)  	dw SilphCo7Script0 -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  	dw SilphCo7Script3  	dw SilphCo7Script4 @@ -177,7 +177,7 @@ SilphCo7Script3: ; 51c82 (14:5c82)  	set 7, [hl]  	ld hl, SilphCo7Text14 ; $5ec8  	ld de, SilphCo7Text_51ecd ; $5ecd -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	ld a, SONY2 + $c8  	ld [W_CUROPPONENT], a ; wd059  	ld a, [W_RIVALSTARTER] ; wd715 @@ -211,7 +211,7 @@ SilphCo7Script4: ; 51cc8 (14:5cc8)  	ld [H_DOWNARROWBLINKCNT2], a ; $ff8c  	ld a, $4  	ld [$ff8d], a -	call Func_34a6 +	call SetSpriteFacingDirectionAndDelay  	ld a, $f  	ld [H_DOWNARROWBLINKCNT2], a ; $ff8c  	call DisplayTextID @@ -244,7 +244,7 @@ SilphCo7Script5: ; 51d25 (14:5d25)  	ld a, $a7  	ld [wcc4d], a  	predef HideObject -	call Func_2307 +	call PlayDefaultMusic  	xor a  	ld [wJoyIgnore], a  	jp SilphCo7Text_51c10 @@ -323,7 +323,7 @@ SilphCo7Text1:  	ld bc, (LAPRAS << 8) | 15  	call GivePokemon  	jr nc, .done -	ld a, [wccd3] +	ld a, [wSimulatedJoypadStatesEnd]  	and a  	call z, WaitForTextScrollButtonPress  	call EnableAutoTextBoxDrawing diff --git a/scripts/silphco8.asm b/scripts/silphco8.asm index cc508e61..ebca9b95 100755 --- a/scripts/silphco8.asm +++ b/scripts/silphco8.asm @@ -22,14 +22,14 @@ SilphCo8Script_5651a: ; 5651a (15:651a)  	ld a, $5f  	ld [wd09f], a  	ld bc, $403 -	predef_jump Func_ee9e +	predef_jump ReplaceTileBlock  DataTable_5653e: ; 5653e (15:653e)  	db $04,$03,$FF  SilphCo8Script_56541: ; 56541 (15:6541)  	push hl -	ld hl, wd73f +	ld hl, wCardKeyDoorY  	ld a, [hli]  	ld b, a  	ld a, [hl] @@ -53,7 +53,7 @@ SilphCo8Script_56541: ; 56541 (15:6541)  	ld a, [hli]  	cp c  	jr nz, .asm_5654d -	ld hl, wd73f +	ld hl, wCardKeyDoorY  	xor a  	ld [hli], a  	ld [hl], a @@ -73,7 +73,7 @@ SilphCo8Script_5656d: ; 5656d (15:656d)  SilphCo8ScriptPointers: ; 56577 (15:6577)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  SilphCo8TextPointers: ; 5657d (15:657d) diff --git a/scripts/silphco9.asm b/scripts/silphco9.asm index c4f7a895..e8b16927 100755 --- a/scripts/silphco9.asm +++ b/scripts/silphco9.asm @@ -23,7 +23,7 @@ SilphCo9Script_5d7d1: ; 5d7d1 (17:57d1)  	ld a, $5f  	ld [wd09f], a  	ld bc, $401 -	predef Func_ee9e +	predef ReplaceTileBlock  	pop af  .asm_5d7f8  	bit 1, a @@ -32,7 +32,7 @@ SilphCo9Script_5d7d1: ; 5d7d1 (17:57d1)  	ld a, $54  	ld [wd09f], a  	ld bc, $209 -	predef Func_ee9e +	predef ReplaceTileBlock  	pop af  .asm_5d80b  	bit 2, a @@ -41,7 +41,7 @@ SilphCo9Script_5d7d1: ; 5d7d1 (17:57d1)  	ld a, $54  	ld [wd09f], a  	ld bc, $509 -	predef Func_ee9e +	predef ReplaceTileBlock  	pop af  .asm_5d81e  	bit 3, a @@ -49,14 +49,14 @@ SilphCo9Script_5d7d1: ; 5d7d1 (17:57d1)  	ld a, $5f  	ld [wd09f], a  	ld bc, $605 -	predef_jump Func_ee9e +	predef_jump ReplaceTileBlock  DataTable_5d82e: ; 5d82e (17:582e)  	db $04,$01,$02,$09,$05,$09,$06,$05,$FF  SilphCo9Script_5d837: ; 5d837 (17:5837)  	push hl -	ld hl, wd73f +	ld hl, wCardKeyDoorY  	ld a, [hli]  	ld b, a  	ld a, [hl] @@ -80,7 +80,7 @@ SilphCo9Script_5d837: ; 5d837 (17:5837)  	ld a, [hli]  	cp c  	jr nz, .asm_5d843 -	ld hl, wd73f +	ld hl, wCardKeyDoorY  	xor a  	ld [hli], a  	ld [hl], a @@ -117,7 +117,7 @@ SilphCo9Script_5d863: ; 5d863 (17:5863)  SilphCo9ScriptPointers: ; 5d885 (17:5885)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  SilphCo9TextPointers: ; 5d88b (17:588b) @@ -164,9 +164,9 @@ SilphCo9Text1: ; 5d8b8 (17:58b8)  	ld hl, SilphCo9Text_5d8e5  	call PrintText  	predef HealParty -	call GBFadeOut2 +	call GBFadeOutToWhite  	call Delay3 -	call GBFadeIn2 +	call GBFadeInFromWhite  	ld hl, SilphCo9Text_5d8ea  	call PrintText  	jr .asm_b6e28 ; 0x5d8da diff --git a/scripts/silphcoelevator.asm b/scripts/silphcoelevator.asm index 853d7357..48d406cc 100755 --- a/scripts/silphcoelevator.asm +++ b/scripts/silphcoelevator.asm @@ -9,13 +9,13 @@ SilphCoElevatorScript: ; 457c0 (11:57c0)  	res 7, [hl]  	call nz, SilphCoElevatorScript_45827  	xor a -	ld [wcf0c], a +	ld [wAutoTextBoxDrawingControl], a  	inc a -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	ret  SilphCoElevatorScript_457dc: ; 457dc (11:57dc) -	ld hl, wd3af +	ld hl, wWarpEntries  	ld a, [wd73b]  	ld b, a  	ld a, [wd73c] diff --git a/scripts/ssanne10.asm b/scripts/ssanne10.asm index 60eb28f2..8f3ff9a4 100755 --- a/scripts/ssanne10.asm +++ b/scripts/ssanne10.asm @@ -9,7 +9,7 @@ SSAnne10Script: ; 61d55 (18:5d55)  SSAnne10ScriptPointers: ; 61d68 (18:5d68)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  SSAnne10TextPointers: ; 61d6e (18:5d6e) diff --git a/scripts/ssanne2.asm b/scripts/ssanne2.asm index f3822ec7..c5943a54 100755 --- a/scripts/ssanne2.asm +++ b/scripts/ssanne2.asm @@ -79,7 +79,7 @@ SSAnne2Script_61416: ; 61416 (18:5416)  	ld [$ff8d], a  	ld a, $2  	ld [H_DOWNARROWBLINKCNT2], a ; $ff8c -	jp Func_34a6 +	jp SetSpriteFacingDirectionAndDelay  SSAnne2Script1: ; 61430 (18:5430)  	ld a, [wd730] @@ -163,7 +163,7 @@ SSAnne2Script3: ; 614be (18:54be)  	ld a, $71  	ld [wcc4d], a  	predef HideObject -	call Func_2307 +	call PlayDefaultMusic  	ld a, $4  	ld [W_SSANNE2CURSCRIPT], a  	ret @@ -186,7 +186,7 @@ SSAnne2Text2: ; 614e6 (18:54e6)  	set 7, [hl]  	ld hl, SSAnneRivalDefeatedText  	ld de, SSAnneRivalWonText -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	jp TextScriptEnd  SSAnneRivalBeforeBattleText: ; 61500 (18:5500) diff --git a/scripts/ssanne5.asm b/scripts/ssanne5.asm index ea7ff282..96b94c52 100755 --- a/scripts/ssanne5.asm +++ b/scripts/ssanne5.asm @@ -9,7 +9,7 @@ SSAnne5Script: ; 616ae (18:56ae)  SSAnne5ScriptPointers: ; 616c1 (18:56c1)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  SSAnne5TextPointers: ; 616c7 (18:56c7) diff --git a/scripts/ssanne7.asm b/scripts/ssanne7.asm index b708b4fd..1ca97ce2 100755 --- a/scripts/ssanne7.asm +++ b/scripts/ssanne7.asm @@ -64,7 +64,7 @@ SSAnne7RubText: ; 618ec (18:58ec)  	ld a, [wc026]  	cp MUSIC_PKMN_HEALED  	jr z, .asm_61910 ; 0x61915 $f9 -	call Func_2307 +	call PlayDefaultMusic  	ld hl, wd803  	set 1, [hl]  	ld hl, wd72d diff --git a/scripts/ssanne8.asm b/scripts/ssanne8.asm index a2abb4bb..ff7fc57b 100755 --- a/scripts/ssanne8.asm +++ b/scripts/ssanne8.asm @@ -9,7 +9,7 @@ SSAnne8Script: ; 61976 (18:5976)  SSAnne8ScriptPointers: ; 61989 (18:5989)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  SSAnne8TextPointers: ; 6198f (18:598f) diff --git a/scripts/ssanne9.asm b/scripts/ssanne9.asm index 2ec0f28c..db34fcf2 100755 --- a/scripts/ssanne9.asm +++ b/scripts/ssanne9.asm @@ -1,8 +1,8 @@  SSAnne9Script: ; 61b4b (18:5b4b)  	ld a, $1 -	ld [wcf0c], a +	ld [wAutoTextBoxDrawingControl], a  	xor a -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	ld hl, SSAnne9TrainerHeaders  	ld de, SSAnne9ScriptPointers  	ld a, [W_SSANNE9CURSCRIPT] @@ -12,7 +12,7 @@ SSAnne9Script: ; 61b4b (18:5b4b)  SSAnne9ScriptPointers: ; 61b64 (18:5b64)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  SSAnne9TextPointers: ; 61b6a (18:5b6a) diff --git a/scripts/unknowndungeon3.asm b/scripts/unknowndungeon3.asm index 2ca624a8..d2078916 100755 --- a/scripts/unknowndungeon3.asm +++ b/scripts/unknowndungeon3.asm @@ -9,7 +9,7 @@ UnknownDungeon3Script: ; 45ef0 (11:5ef0)  UnknownDungeon3ScriptPointers: ; 45f03 (11:5f03)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  UnknownDungeon3TextPointers: ; 45f09 (11:5f09) diff --git a/scripts/vermilioncity.asm b/scripts/vermilioncity.asm index da70b819..5309c7f6 100755 --- a/scripts/vermilioncity.asm +++ b/scripts/vermilioncity.asm @@ -61,10 +61,10 @@ VermilionCityScript0: ; 197e6 (6:57e6)  	ret nz  .asm_19810  	ld a, $40 -	ld [wccd3], a +	ld [wSimulatedJoypadStatesEnd], a  	ld a, $1 -	ld [wcd38], a -	call Func_3486 +	ld [wSimulatedJoypadStatesIndex], a +	call StartSimulatingJoypadStates  	ld a, $1  	ld [W_VERMILIONCITYCURSCRIPT], a  	ret @@ -85,17 +85,17 @@ VermilionCityScript2: ; 19833 (6:5833)  	ld a, $ff  	ld [wJoyIgnore], a  	ld a, $40 -	ld [wccd3], a +	ld [wSimulatedJoypadStatesEnd], a  	ld [wccd4], a  	ld a, $2 -	ld [wcd38], a -	call Func_3486 +	ld [wSimulatedJoypadStatesIndex], a +	call StartSimulatingJoypadStates  	ld a, $3  	ld [W_VERMILIONCITYCURSCRIPT], a  	ret  VermilionCityScript3: ; 1984e (6:584e) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	xor a @@ -106,7 +106,7 @@ VermilionCityScript3: ; 1984e (6:584e)  	ret  VermilionCityScript1: ; 1985f (6:585f) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	ld c, $a diff --git a/scripts/vermiliondock.asm b/scripts/vermiliondock.asm index 03dc4377..dca1c66c 100755 --- a/scripts/vermiliondock.asm +++ b/scripts/vermiliondock.asm @@ -5,7 +5,7 @@ VermilionDockScript: ; 1db52 (7:5b52)  	jr nz, .asm_1db8d ; 0x1db5a $31  	bit 0, [hl]  	ret z -	ld a, [wd42f] +	ld a, [wDestinationWarpID]  	cp $1  	ret nz  	bit 2, [hl] @@ -14,23 +14,23 @@ VermilionDockScript: ; 1db52 (7:5b52)  	call Delay3  	ld hl, wd730  	set 7, [hl] -	ld hl, wccd3 +	ld hl, wSimulatedJoypadStatesEnd  	ld a, $40  	ld [hli], a  	ld [hli], a  	ld [hl], a  	ld a, $3 -	ld [wcd38], a +	ld [wSimulatedJoypadStatesIndex], a  	xor a  	ld [wSpriteStateData2 + $06], a -	ld [wcd3b], a +	ld [wOverrideSimulatedJoypadStatesMask], a  	dec a  	ld [wJoyIgnore], a  	ret  .asm_1db8d  	bit 5, [hl]  	ret nz -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	ld [wJoyIgnore], a @@ -66,7 +66,7 @@ VermilionDock_1db9b: ; 1db9b (7:5b9b)  	ld [$ff49], a  	ld a, $58  	ld [wTrainerEngageDistance], a -	ld hl, wd526 +	ld hl, wMapViewVRAMPointer  	ld c, [hl]  	inc hl  	ld b, [hl] @@ -75,16 +75,16 @@ VermilionDock_1db9b: ; 1db9b (7:5b9b)  	ld a, (SFX_02_54 - SFX_Headers_02) / 3  	call PlaySoundWaitForCurrent  	ld a, $ff -	ld [wcfcb], a +	ld [wUpdateSpritesEnabled], a  	ld d, $0  	ld e, $8  .asm_1dbfa  	ld hl, $0002  	add hl, bc  	ld a, l -	ld [wd526], a +	ld [wMapViewVRAMPointer], a  	ld a, h -	ld [wd527], a +	ld [wMapViewVRAMPointer + 1], a  	push hl  	push de  	call ScheduleEastColumnRedraw @@ -106,19 +106,19 @@ VermilionDock_1db9b: ; 1db9b (7:5b9b)  	jr nz, .asm_1dbfa ; 0x1dc22 $d6  	xor a  	ld [$ff4a], a -	ld [$ffb0], a +	ld [hVBlankWY], a  	call VermilionDock_1dc94  	ld a, $90 -	ld [$ffb0], a +	ld [hVBlankWY], a  	ld a, $1 -	ld [wcfcb], a +	ld [wUpdateSpritesEnabled], a  	pop hl  	pop bc  	ld [hl], b  	dec hl  	ld [hl], c  	call LoadPlayerSpriteGraphics -	ld hl, wd3ae +	ld hl, wNumberOfWarps  	dec [hl]  	ret diff --git a/scripts/vermiliongym.asm b/scripts/vermiliongym.asm index fa6b2fc2..6178dafb 100755 --- a/scripts/vermiliongym.asm +++ b/scripts/vermiliongym.asm @@ -40,7 +40,7 @@ VermilionGymScript_5ca6d: ; 5ca6d (17:4a6d)  .asm_5ca7f  	ld [wd09f], a  	ld bc, $202 -	predef_jump Func_ee9e +	predef_jump ReplaceTileBlock  VermilionGymScript_5ca8a: ; 5ca8a (17:4a8a)  	xor a @@ -51,7 +51,7 @@ VermilionGymScript_5ca8a: ; 5ca8a (17:4a8a)  VermilionGymScriptPointers: ; 5ca95 (17:4a95)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  	dw VermilionGymScript3 @@ -156,9 +156,9 @@ VermilionGymText1: ; 5cb1d (17:4b1d)  	set 7, [hl]  	ld hl, ReceivedThunderbadgeText  	ld de, ReceivedThunderbadgeText -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	ldh a, [$8c] -	ld [wcf13], a +	ld [wSpriteIndex], a  	call EngageMapTrainer  	call InitBattleEnemyParameters  	ld a, $3 diff --git a/scripts/victoryroad1.asm b/scripts/victoryroad1.asm index cebd8070..b6d2bf3e 100755 --- a/scripts/victoryroad1.asm +++ b/scripts/victoryroad1.asm @@ -17,11 +17,11 @@ VictoryRoad1Script: ; 5da0a (17:5a0a)  	ld a, $1d  	ld [wd09f], a  	ld bc, $604 -	predef_jump Func_ee9e +	predef_jump ReplaceTileBlock  VictoryRoad1ScriptPointers: ; 5da3a (17:5a3a)  	dw VictoryRoad1Script0 -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  VictoryRoad1Script0: ; 5da40 (17:5a40) diff --git a/scripts/victoryroad2.asm b/scripts/victoryroad2.asm index cf52e3a3..4aab61ca 100755 --- a/scripts/victoryroad2.asm +++ b/scripts/victoryroad2.asm @@ -36,12 +36,12 @@ VictoryRoad2Script_517c9: ; 517c9 (14:57c9)  VictoryRoad2Script_517e2: ; 517e2 (14:57e2)  	ld [wd09f], a -	predef Func_ee9e +	predef ReplaceTileBlock  	ret  VictoryRoad2ScriptPointers: ; 517eb (14:57eb)  	dw VictoryRoad2Script0 -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  VictoryRoad2Script0: ; 517f1 (14:57f1) diff --git a/scripts/victoryroad3.asm b/scripts/victoryroad3.asm index e35e9131..99926498 100755 --- a/scripts/victoryroad3.asm +++ b/scripts/victoryroad3.asm @@ -19,11 +19,11 @@ VictoryRoad3Script_44996: ; 44996 (11:4996)  	ld a, $1d  	ld [wd09f], a  	ld bc, $503 -	predef_jump Func_ee9e +	predef_jump ReplaceTileBlock  VictoryRoad3ScriptPointers: ; 449b1 (11:49b1)  	dw VictoryRoad3Script0 -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  VictoryRoad3Script0: ; 449b7 (11:49b7) @@ -61,7 +61,7 @@ VictoryRoad3Script0: ; 449b7 (11:49b7)  .asm_449fe  	ld a, $c2 -	ld [wd71d], a +	ld [wDungeonWarpDestinationMap], a  	ld hl, .coordsData_449f9 ; $49f9  	call Func_46981  	ld a, [wWhichTrade] ; wWhichTrade diff --git a/scripts/viridiancity.asm b/scripts/viridiancity.asm index 7a769280..d0b2b4ae 100755 --- a/scripts/viridiancity.asm +++ b/scripts/viridiancity.asm @@ -108,7 +108,7 @@ ViridianCityScript2: ; 1908f (6:508f)  	ret  ViridianCityScript3: ; 190c1 (6:50c1) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	call Delay3 @@ -117,11 +117,11 @@ ViridianCityScript3: ; 190c1 (6:50c1)  	ret  ViridianCityScript_190cf: ; 190cf (6:50cf) -	call Func_3486 +	call StartSimulatingJoypadStates  	ld a, $1 -	ld [wcd38], a +	ld [wSimulatedJoypadStatesIndex], a  	ld a, $80 -	ld [wccd3], a +	ld [wSimulatedJoypadStatesEnd], a  	xor a  	ld [wSpriteStateData1 + 9], a  	ld [wJoyIgnore], a diff --git a/scripts/viridianforest.asm b/scripts/viridianforest.asm index 3744fc78..4ec1c0aa 100755 --- a/scripts/viridianforest.asm +++ b/scripts/viridianforest.asm @@ -9,7 +9,7 @@ ViridianForestScript: ; 6110d (18:510d)  ViridianForestScriptPointers: ; 61120 (18:5120)  	dw CheckFightingMapTrainers -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  ViridianForestTextPointers: ; 61126 (18:5126) diff --git a/scripts/viridiangym.asm b/scripts/viridiangym.asm index 65ad3553..3aa23b43 100755 --- a/scripts/viridiangym.asm +++ b/scripts/viridiangym.asm @@ -24,7 +24,7 @@ ViridianGymScript_748d6: ; 748d6 (1d:48d6)  ViridianGymScriptPointers: ; 748e1 (1d:48e1)  	dw ViridianGymScript0 -	dw Func_324c +	dw DisplayEnemyTrainerTextAndStartBattle  	dw EndTrainerBattle  	dw ViridianGymScript3  	dw ViridianGymScript4 @@ -35,10 +35,10 @@ ViridianGymScript0: ; 748eb (1d:48eb)  	ld a, [W_XCOORD] ; wd362  	ld c, a  	ld hl, ViridianGymArrowTilePlayerMovement -	call Func_3442 +	call DecodeArrowMovementRLE  	cp $ff  	jp z, CheckFightingMapTrainers -	call Func_3486 +	call StartSimulatingJoypadStates  	ld hl, wd736  	set 7, [hl]  	ld a, (SFX_02_52 - SFX_Headers_02) / 3 @@ -121,7 +121,7 @@ ViridianGymArrowMovement12: ; 74968 (1d:4968)  	db $20,$0C,$FF  ViridianGymScript4: ; 7496b (1d:496b) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	jr nz, .asm_74980  	xor a @@ -286,16 +286,16 @@ ViridianGymText1: ; 74a69 (1d:4a69)  	jr .asm_6dff7 ; 0x74a7b  .asm_9fc95 ; 0x74a7d  	ld a, $1 -	ld [wcc3c], a +	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	ld hl, ViridianGymText_74ad9  	call PrintText -	call GBFadeIn1 +	call GBFadeOutToBlack  	ld a, $32  	ld [wcc4d], a  	predef HideObject  	call UpdateSprites  	call Delay3 -	call GBFadeOut1 +	call GBFadeInFromBlack  	jr .asm_6dff7 ; 0x74a9e  .asm_6de66 ; 0x74aa0  	ld hl, ViridianGymText_74ace @@ -305,9 +305,9 @@ ViridianGymText1: ; 74a69 (1d:4a69)  	set 7, [hl]  	ld hl, ViridianGymText_74ad3  	ld de, ViridianGymText_74ad3 -	call PreBattleSaveRegisters +	call SaveEndBattleTextPointers  	ldh a, [$8c] -	ld [wcf13], a +	ld [wSpriteIndex], a  	call EngageMapTrainer  	call InitBattleEnemyParameters  	ld a, $8 diff --git a/scripts/viridianmart.asm b/scripts/viridianmart.asm index a02231f8..d33dfe81 100755 --- a/scripts/viridianmart.asm +++ b/scripts/viridianmart.asm @@ -30,12 +30,12 @@ ViridianMartScript0: ; 1d49b (7:549b)  	ld a, $4  	ld [$ff8c], a  	call DisplayTextID -	ld hl, wccd3 +	ld hl, wSimulatedJoypadStatesEnd  	ld de, RLEMovement1d4bb  	call DecodeRLEList  	dec a -	ld [wcd38], a -	call Func_3486 +	ld [wSimulatedJoypadStatesIndex], a +	call StartSimulatingJoypadStates  	ld a, $1  	ld [W_VIRIDIANMARKETCURSCRIPT], a  	ret @@ -46,7 +46,7 @@ RLEMovement1d4bb: ; 1d4bb (7:54bb)  	db $ff  ViridianMartScript1: ; 1d4c0 (7:54c0) -	ld a, [wcd38] +	ld a, [wSimulatedJoypadStatesIndex]  	and a  	ret nz  	call Delay3 | 
