diff options
106 files changed, 773 insertions, 671 deletions
| diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index 63ea170d..7764603d 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -163,7 +163,7 @@ DrawFrameBlock: ; 78000 (1e:4000)  PlayAnimation: ; 780f1 (1e:40f1)  	xor a -	ld [$FF8B],a +	ld [$FF8B],a ; it looks like nothing reads this  	ld [W_SUBANIMTRANSFORM],a  	ld a,[W_ANIMATIONID] ; get animation number  	dec a diff --git a/engine/battle/core.asm b/engine/battle/core.asm index bdb20bb0..2f407290 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -1310,7 +1310,7 @@ SevenSpacesText: ; 3c8d7 (f:48d7)  ; if a is 8, the slide is to the right, else it is to the left  ; bug: when this is called, [H_AUTOBGTRANSFERENABLED] is non-zero, so there is screen tearing  SlideTrainerPicOffScreen: ; 3c8df (f:48df) -	ld [$FF8B], a +	ld [hSlideAmount], a  	ld c, a  .slideStepLoop ; each iteration, the trainer pic is slid one tile left/right  	push bc @@ -1318,10 +1318,10 @@ SlideTrainerPicOffScreen: ; 3c8df (f:48df)  	ld b, 7 ; number of rows  .rowLoop  	push hl -	ld a, [$FF8B] +	ld a, [hSlideAmount]  	ld c, a  .columnLoop -	ld a, [$FF8B] +	ld a, [hSlideAmount]  	cp 8  	jr z, .slideRight  .slideLeft ; slide player sprite off screen @@ -1590,14 +1590,14 @@ TryRunningFromBattle: ; 3cab9 (f:4ab9)  	ld a, [hl]  	ld [H_MULTIPLICAND + 2], a  	ld a, [de] -	ld [$ff8d], a +	ld [hEnemySpeed], a  	inc de  	ld a, [de] -	ld [$ff8e], a +	ld [hEnemySpeed + 1], a  	call LoadScreenTilesFromBuffer1  	ld de, H_MULTIPLICAND + 1 -	ld hl, $ff8d -	ld c, $2 +	ld hl, hEnemySpeed +	ld c, 2  	call StringCmp  	jr nc, .canEscape ; jump if player speed greater than enemy speed  	xor a @@ -1609,9 +1609,9 @@ TryRunningFromBattle: ; 3cab9 (f:4ab9)  	ld [H_DIVIDEND], a  	ld a, [H_PRODUCT + 3]  	ld [H_DIVIDEND + 1], a -	ld a, [$ff8d] +	ld a, [hEnemySpeed]  	ld b, a -	ld a, [$ff8e] +	ld a, [hEnemySpeed + 1]  ; divide enemy speed by 4  	srl b  	rr a @@ -6411,7 +6411,7 @@ LoadPlayerBackPic: ; 3ec92 (f:6c92)  	predef ScaleSpriteByTwo  	ld hl, wOAMBuffer  	xor a -	ld [$FF8B], a ; initial tile number +	ld [hOAMTile], a ; initial tile number  	ld b, $7 ; 7 columns  	ld e, $a0 ; X for the left-most column  .loop ; each loop iteration writes 3 OAM entries in a vertical column @@ -6425,16 +6425,16 @@ LoadPlayerBackPic: ; 3ec92 (f:6c92)  	add d ; increase Y by height of tile  	ld d, a  	inc hl -	ld a, [$FF8B] +	ld a, [hOAMTile]  	ld [hli], a ; OAM tile number  	inc a ; increment tile number -	ld [$FF8B], a +	ld [hOAMTile], a  	inc hl  	dec c  	jr nz, .innerLoop -	ld a, [$FF8B] +	ld a, [hOAMTile]  	add $4 ; increase tile number by 4 -	ld [$FF8B], a +	ld [hOAMTile], a  	ld a, $8 ; width of tile  	add e ; increase X by width of tile  	ld e, a diff --git a/engine/battle/wild_encounters.asm b/engine/battle/wild_encounters.asm index 87512583..03dc6fb6 100644 --- a/engine/battle/wild_encounters.asm +++ b/engine/battle/wild_encounters.asm @@ -89,7 +89,7 @@ TryDoWildEncounter: ; 13870 (4:7870)  	jr .willEncounter  .lastRepelStep  	ld [wRepelRemainingSteps], a -	ld a, $d2 +	ld a, 210  	ld [H_DOWNARROWBLINKCNT2], a  	call EnableAutoTextBoxDrawing  	call DisplayTextID diff --git a/engine/items/items.asm b/engine/items/items.asm index b65e8f1e..7617ba6c 100755 --- a/engine/items/items.asm +++ b/engine/items/items.asm @@ -556,11 +556,11 @@ ItemUseSurfboard: ; d9b4 (3:59b4)  	jp PrintText  .tryToStopSurfing  	xor a -	ld [$ff8c],a +	ld [hSpriteIndexOrTextID],a  	ld d,16 ; talking range in pixels (normal range)  	call IsSpriteInFrontOfPlayer2  	res 7,[hl] -	ld a,[$ff8c] +	ld a,[hSpriteIndexOrTextID]  	and a ; is there a sprite in the way?  	jr nz,.cannotStopSurfing  	ld hl,TilePairCollisionsWater diff --git a/engine/items/tm_prices.asm b/engine/items/tm_prices.asm index 4decc82d..6bb7f711 100755 --- a/engine/items/tm_prices.asm +++ b/engine/items/tm_prices.asm @@ -1,7 +1,6 @@  GetMachinePrice: ; 7bf86 (1e:7f86)  ; Input:  [wcf91] = Item Id of a TM -; Output: Stores the 2-byte TM price in [H_DOWNARROWBLINKCNT1] and [H_DOWNARROWBLINKCNT2] -;         as a BCD +; Output: Stores the TM price at hItemPrice  	ld a, [wcf91] ; a contains TM item id  	sub TM_01  	ret c @@ -17,10 +16,10 @@ GetMachinePrice: ; 7bf86 (1e:7f86)  	swap a  .highNybbleIsPrice  	and $f0 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hItemPrice + 1], a  	xor a -	ld [H_DOWNARROWBLINKCNT1], a -	ld [$ff8d], a +	ld [hItemPrice], a +	ld [hItemPrice + 2], a  	ret  INCLUDE "data/tm_prices.asm" diff --git a/engine/menu/pokedex.asm b/engine/menu/pokedex.asm index 56543c91..80eedecd 100755 --- a/engine/menu/pokedex.asm +++ b/engine/menu/pokedex.asm @@ -512,25 +512,25 @@ ShowPokedexDataInternal: ; 402e2 (10:42e2)  	inc de  	inc de ; de = address of upper byte of weight  	push de -; put weight in big-endian order at $ff8b -	ld hl,$ff8b -	ld a,[hl] ; save existing value of [$ff8b] +; put weight in big-endian order at hDexWeight +	ld hl,hDexWeight +	ld a,[hl] ; save existing value of [hDexWeight]  	push af  	ld a,[de] ; a = upper byte of weight -	ld [hli],a ; store upper byte of weight in [$ff8b] -	ld a,[hl] ; save existing value of [$ff8c] +	ld [hli],a ; store upper byte of weight in [hDexWeight] +	ld a,[hl] ; save existing value of [hDexWeight + 1]  	push af  	dec de  	ld a,[de] ; a = lower byte of weight -	ld [hl],a ; store lower byte of weight in [$ff8c] -	ld de,$ff8b +	ld [hl],a ; store lower byte of weight in [hDexWeight + 1] +	ld de,hDexWeight  	hlCoord 11, 8  	ld bc,$0205 ; no leading zeroes, right-aligned, 2 bytes, 5 digits  	call PrintNumber ; print weight  	hlCoord 14, 8 -	ld a,[$ff8c] +	ld a,[hDexWeight + 1]  	sub a,10 -	ld a,[$ff8b] +	ld a,[hDexWeight]  	sbc a,0  	jr nc,.next  	ld [hl],"0" ; if the weight is less than 10, put a 0 before the decimal point @@ -540,9 +540,9 @@ ShowPokedexDataInternal: ; 402e2 (10:42e2)  	ld [hld],a ; make space for the decimal point by moving the last digit forward one tile  	ld [hl],$f2 ; decimal point tile  	pop af -	ld [$ff8c],a ; restore original value of [$ff8c] +	ld [hDexWeight + 1],a ; restore original value of [hDexWeight + 1]  	pop af -	ld [$ff8b],a ; restore original value of [$ff8b] +	ld [hDexWeight],a ; restore original value of [hDexWeight]  	pop hl  	inc hl ; hl = address of pokedex description text  	bcCoord 1, 11 diff --git a/engine/menu/prize_menu.asm b/engine/menu/prize_menu.asm index fff8e4c4..f7206a7f 100755 --- a/engine/menu/prize_menu.asm +++ b/engine/menu/prize_menu.asm @@ -58,13 +58,13 @@ WhichPrizeTextPtr: ; 52789 (14:6789)  GetPrizeMenuId: ; 5278e (14:678e)  ; determine which one among the three  ; prize-texts has been selected -; using the text ID (stored in [$FF8C]) +; using the text ID (stored in [hSpriteIndexOrTextID])  ; load the three prizes at wd13d-wd13f  ; load the three prices at wd141-wd146  ; display the three prizes' names  ; (distinguishing between Pokemon names  ; and Items (specifically TMs) names) -	ld a,[$FF8C] +	ld a,[hSpriteIndexOrTextID]  	sub a,$03       ; prize-texts' id are 3, 4 and 5  	ld [wd12f],a    ; prize-texts' id (relative, i.e. 0, 1 or 2)  	add a diff --git a/engine/menu/start_sub_menus.asm b/engine/menu/start_sub_menus.asm index 11b7fa90..2804ef7b 100755 --- a/engine/menu/start_sub_menus.asm +++ b/engine/menu/start_sub_menus.asm @@ -524,7 +524,7 @@ StartMenu_TrainerInfo: ; 13460 (4:7460)  DrawTrainerInfo: ; 1349a (4:749a)  	ld de,RedPicFront  	ld bc,(BANK(RedPicFront) << 8) | $01 -	predef Predef3B +	predef DisplayPicCenteredOrUpperRight  	call DisableLCD  	hlCoord 0, 2  	ld a," " diff --git a/engine/oak_speech.asm b/engine/oak_speech.asm index df092d4c..bd7f672e 100755 --- a/engine/oak_speech.asm +++ b/engine/oak_speech.asm @@ -34,9 +34,9 @@ SetDefaultNames: ; 60ca (1:60ca)  OakSpeech: ; 6115 (1:6115)  	ld a,$FF  	call PlaySound ; stop music -	ld a, BANK(Music_Routes2) ; bank of song +	ld a, BANK(Music_Routes2)  	ld c,a -	ld a, MUSIC_ROUTES2 ; song # +	ld a, MUSIC_ROUTES2  	call PlayMusic  	call ClearScreen  	call LoadTextBoxTilePatterns @@ -54,50 +54,49 @@ OakSpeech: ; 6115 (1:6115)  	xor a  	ld [hTilesetType],a  	ld a,[wd732] -	bit 1,a ; XXX when is bit 1 set? -	jp nz,Func_61bc ; easter egg: skip the intro +	bit 1,a ; possibly a debug mode bit +	jp nz,.skipChoosingNames  	ld de,ProfOakPic  	ld bc, (Bank(ProfOakPic) << 8) | $00 -	call IntroPredef3B   ; displays Oak pic? +	call IntroDisplayPicCenteredOrUpperRight  	call FadeInIntroPic  	ld hl,OakSpeechText1 -	call PrintText      ; prints text box +	call PrintText  	call GBFadeOutToWhite  	call ClearScreen  	ld a,NIDORINO -	ld [wd0b5],a    ; pic displayed is stored at this location +	ld [wd0b5],a  	ld [wcf91],a -	call GetMonHeader      ; this is also related to the pic -	hlCoord 6, 4     ; position on tilemap the pic is displayed -	call LoadFlippedFrontSpriteByMonIndex      ; displays pic? +	call GetMonHeader +	hlCoord 6, 4 +	call LoadFlippedFrontSpriteByMonIndex  	call MovePicLeft  	ld hl,OakSpeechText2 -	call PrintText      ; Prints text box +	call PrintText  	call GBFadeOutToWhite  	call ClearScreen  	ld de,RedPicFront  	ld bc,(Bank(RedPicFront) << 8) | $00 -	call IntroPredef3B      ; displays player pic? +	call IntroDisplayPicCenteredOrUpperRight  	call MovePicLeft  	ld hl,IntroducePlayerText  	call PrintText -	call LoadDefaultNamesPlayer ; brings up NewName/Red/etc menu +	call ChoosePlayerName  	call GBFadeOutToWhite  	call ClearScreen  	ld de,Rival1Pic  	ld bc,(Bank(Rival1Pic) << 8) | $00 -	call IntroPredef3B ; displays rival pic +	call IntroDisplayPicCenteredOrUpperRight  	call FadeInIntroPic  	ld hl,IntroduceRivalText  	call PrintText -	call LoadDefaultNamesRival - -Func_61bc: ; 61bc (1:61bc) +	call ChooseRivalName +.skipChoosingNames  	call GBFadeOutToWhite  	call ClearScreen  	ld de,RedPicFront  	ld bc,(Bank(RedPicFront) << 8) | $00 -	call IntroPredef3B +	call IntroDisplayPicCenteredOrUpperRight  	call GBFadeInFromWhite  	ld a,[wd72d]  	and a @@ -120,12 +119,12 @@ Func_61bc: ; 61bc (1:61bc)  	call CopyVideoData  	ld de,ShrinkPic1  	ld bc,(BANK(ShrinkPic1) << 8) | $00 -	call IntroPredef3B +	call IntroDisplayPicCenteredOrUpperRight  	ld c,4  	call DelayFrames  	ld de,ShrinkPic2  	ld bc,(BANK(ShrinkPic2) << 8) | $00 -	call IntroPredef3B +	call IntroDisplayPicCenteredOrUpperRight  	call ResetPlayerSpriteData  	ld a,[H_LOADEDROMBANK]  	push af @@ -207,10 +206,12 @@ MovePicLeft: ; 6288 (1:6288)  	ld [rWX],a  	jr .next -Predef3B: ; 62a1 (1:62a1) +DisplayPicCenteredOrUpperRight: ; 62a1 (1:62a1)  	call GetPredefRegisters -IntroPredef3B: ; 62a4 (1:62a4) -; bank of sprite given in b +IntroDisplayPicCenteredOrUpperRight: ; 62a4 (1:62a4) +; b = bank +; de = address of compressed pic +; c: 0 = centred, non-zero = upper-right  	push bc  	ld a,b  	call UncompressSpriteFromDE diff --git a/engine/oak_speech2.asm b/engine/oak_speech2.asm index b27a6987..f881b43b 100755 --- a/engine/oak_speech2.asm +++ b/engine/oak_speech2.asm @@ -1,29 +1,29 @@ -LoadDefaultNamesPlayer: ; 695d (1:695d) -	call Func_6a12 +ChoosePlayerName: ; 695d (1:695d) +	call OakSpeechSlidePicRight  	ld de, DefaultNamesPlayer  	call DisplayIntroNameTextBox  	ld a, [wCurrentMenuItem]  	and a -	jr z, .asm_697a +	jr z, .customName  	ld hl, DefaultNamesPlayerList -	call Func_6ad6 +	call GetDefaultName  	ld de, wPlayerName -	call Func_69ec -	jr .asm_6999 -.asm_697a +	call OakSpeechSlidePicLeft +	jr .done +.customName  	ld hl, wPlayerName  	xor a ; NAME_PLAYER_SCREEN  	ld [wNamingScreenType], a  	call DisplayNamingScreen  	ld a, [wcf4b] -	cp $50 -	jr z, .asm_697a +	cp "@" +	jr z, .customName  	call ClearScreen  	call Delay3  	ld de, RedPicFront  	ld b, BANK(RedPicFront) -	call IntroPredef3B -.asm_6999 +	call IntroDisplayPicCenteredOrUpperRight +.done  	ld hl, YourNameIsText  	jp PrintText @@ -31,32 +31,32 @@ YourNameIsText: ; 699f (1:699f)  	TX_FAR _YourNameIsText  	db "@" -LoadDefaultNamesRival: ; 69a4 (1:69a4) -	call Func_6a12 +ChooseRivalName: ; 69a4 (1:69a4) +	call OakSpeechSlidePicRight  	ld de, DefaultNamesRival  	call DisplayIntroNameTextBox  	ld a, [wCurrentMenuItem]  	and a -	jr z, .asm_69c1 +	jr z, .customName  	ld hl, DefaultNamesRivalList -	call Func_6ad6 +	call GetDefaultName  	ld de, W_RIVALNAME -	call Func_69ec -	jr .asm_69e1 -.asm_69c1 +	call OakSpeechSlidePicLeft +	jr .done +.customName  	ld hl, W_RIVALNAME  	ld a, NAME_RIVAL_SCREEN  	ld [wNamingScreenType], a  	call DisplayNamingScreen  	ld a, [wcf4b] -	cp $50 -	jr z, .asm_69c1 +	cp "@" +	jr z, .customName  	call ClearScreen  	call Delay3  	ld de, Rival1Pic  	ld b, $13 -	call IntroPredef3B -.asm_69e1 +	call IntroDisplayPicCenteredOrUpperRight +.done  	ld hl, HisNameIsText  	jp PrintText @@ -64,11 +64,11 @@ HisNameIsText: ; 69e7 (1:69e7)  	TX_FAR _HisNameIsText  	db "@" -Func_69ec: ; 69ec (1:69ec) +OakSpeechSlidePicLeft: ; 69ec (1:69ec)  	push de  	hlCoord 0, 0 -	ld bc, $c0b -	call ClearScreenArea +	lb bc, 12, 11 +	call ClearScreenArea ; clear the name list text box  	ld c, 10  	call DelayFrames  	pop de @@ -77,77 +77,83 @@ Func_69ec: ; 69ec (1:69ec)  	call CopyData  	call Delay3  	hlCoord 12, 4 -	ld de, $67d +	lb de, 6, 6 * SCREEN_WIDTH + 5  	ld a, $ff -	jr asm_6a19 +	jr OakSpeechSlidePicCommon -Func_6a12: ; 6a12 (1:6a12) +OakSpeechSlidePicRight: ; 6a12 (1:6a12)  	hlCoord 5, 4 -	ld de, $67d +	lb de, 6, 6 * SCREEN_WIDTH + 5  	xor a -asm_6a19: ; 6a19 (1:6a19) + +OakSpeechSlidePicCommon: ; 6a19 (1:6a19)  	push hl  	push de  	push bc -	ld [$ff8d], a +	ld [hSlideDirection], a  	ld a, d -	ld [H_DOWNARROWBLINKCNT1], a +	ld [hSlideAmount], a  	ld a, e -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSlidingRegionSize], a  	ld c, a -	ld a, [$ff8d] +	ld a, [hSlideDirection]  	and a -	jr nz, .asm_6a2d -	ld d, $0 +	jr nz, .next +; If sliding right, point hl to the end of the pic's tiles. +	ld d, 0  	add hl, de -.asm_6a2d +.next  	ld d, h  	ld e, l -.asm_6a2f +.loop  	xor a  	ld [H_AUTOBGTRANSFERENABLED], a -	ld a, [$ff8d] +	ld a, [hSlideDirection]  	and a -	jr nz, .asm_6a3c +	jr nz, .slideLeft +; sliding right  	ld a, [hli]  	ld [hld], a  	dec hl -	jr .asm_6a3f -.asm_6a3c +	jr .next2 +.slideLeft  	ld a, [hld]  	ld [hli], a  	inc hl -.asm_6a3f +.next2  	dec c -	jr nz, .asm_6a2f -	ld a, [$ff8d] +	jr nz, .loop +	ld a, [hSlideDirection]  	and a -	jr z, .asm_6a4a +	jr z, .next3 +; If sliding left, we need to zero the last tile in the pic (there is no need +; to take a corresponding action when sliding right because hl initially points +; to a 0 tile in that case).  	xor a  	dec hl  	ld [hl], a -.asm_6a4a -	ld a, $1 +.next3 +	ld a, 1  	ld [H_AUTOBGTRANSFERENABLED], a  	call Delay3 -	ld a, [H_DOWNARROWBLINKCNT2] +	ld a, [hSlidingRegionSize]  	ld c, a  	ld h, d  	ld l, e -	ld a, [$ff8d] +	ld a, [hSlideDirection]  	and a -	jr nz, .asm_6a5e +	jr nz, .slideLeft2  	inc hl -	jr .asm_6a5f -.asm_6a5e +	jr .next4 +.slideLeft2  	dec hl -.asm_6a5f +.next4  	ld d, h  	ld e, l -	ld a, [H_DOWNARROWBLINKCNT1] +	ld a, [hSlideAmount]  	dec a -	ld [H_DOWNARROWBLINKCNT1], a -	jr nz, .asm_6a2f +	ld [hSlideAmount], a +	jr nz, .loop  	pop bc  	pop de  	pop hl @@ -229,22 +235,24 @@ DefaultNamesRival:  	db   "@"  ENDC -Func_6ad6: ; 6ad6 (1:6ad6) +GetDefaultName: ; 6ad6 (1:6ad6) +; a = name index +; hl = name list  	ld b, a -	ld c, $0 -.asm_6ad9 +	ld c, 0 +.loop  	ld d, h  	ld e, l -.asm_6adb +.innerLoop  	ld a, [hli] -	cp $50 -	jr nz, .asm_6adb +	cp "@" +	jr nz, .innerLoop  	ld a, b  	cp c -	jr z, .asm_6ae7 +	jr z, .foundName  	inc c -	jr .asm_6ad9 -.asm_6ae7 +	jr .loop +.foundName  	ld h, d  	ld l, e  	ld de, wcd6d diff --git a/engine/overworld/item.asm b/engine/overworld/item.asm index b00405bf..eb6d743a 100644 --- a/engine/overworld/item.asm +++ b/engine/overworld/item.asm @@ -1,7 +1,7 @@ -PickupItem: +PickUpItem:  	call EnableAutoTextBoxDrawing -	ld a, [H_DOWNARROWBLINKCNT2] +	ld a, [hSpriteIndexOrTextID]  	ld b, a  	ld hl, W_MISSABLEOBJECTLIST  .missableObjectsListLoop @@ -18,7 +18,7 @@ PickupItem:  	ld [$ffdb], a  	ld hl, W_MAPSPRITEEXTRADATA -	ld a, [H_DOWNARROWBLINKCNT2] +	ld a, [hSpriteIndexOrTextID]  	dec a  	add a  	ld d, 0 diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm index df39d112..33411dfc 100755 --- a/engine/overworld/map_sprites.asm +++ b/engine/overworld/map_sprites.asm @@ -39,7 +39,7 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871)  	ld b,$10 ; number of sprite slots  	ld hl,wSpriteStateData2 + $0d  	xor a -	ld [$ff8e],a ; 4-tile sprite counter +	ld [hFourTileSpriteCount],a  .copyPictureIDLoop ; loop to copy picture ID from $C2XD to $C2XE  	ld a,[hli] ; $C2XD (sprite picture ID)  	ld [hld],a ; $C2XE @@ -98,14 +98,14 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871)  	cp a,SPRITE_BALL ; is it a 4-tile sprite?  	jr c,.notFourTileSprite  	pop af -	ld a,[$ff8e] ; 4-tile sprite counter +	ld a,[hFourTileSpriteCount]  	add a,11  	jr .storeVRAMSlot  .notFourTileSprite  	pop af  .storeVRAMSlot  	ld [hl],a ; store VRAM slot at $C2XE -	ld [$ff8d],a ; used to determine if it's 4-tile sprite later +	ld [hVRAMSlot],a ; used to determine if it's 4-tile sprite later  	ld a,b ; a = current sprite picture ID  	dec a  	add a @@ -128,7 +128,7 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871)  	push bc  	ld hl,vNPCSprites ; VRAM base address  	ld bc,$c0 ; number of bytes per VRAM slot -	ld a,[$ff8d] +	ld a,[hVRAMSlot]  	cp a,11 ; is it a 4-tile sprite?  	jr nc,.fourTileSpriteVRAMAddr  	ld d,a @@ -142,13 +142,13 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871)  	jr .loadStillTilePattern  .fourTileSpriteVRAMAddr  	ld hl,vSprites + $7c0 ; address for second 4-tile sprite -	ld a,[$ff8e] ; 4-tile sprite counter -	and a ; is it the first 4-tile sprite? +	ld a,[hFourTileSpriteCount] +	and a  	jr nz,.loadStillTilePattern  ; if it's the first 4-tile sprite  	ld hl,vSprites + $780 ; address for first 4-tile sprite  	inc a -	ld [$ff8e],a ; 4-tile sprite counter +	ld [hFourTileSpriteCount],a  .loadStillTilePattern  	pop bc  	pop de @@ -168,7 +168,7 @@ LoadMapSpriteTilePatterns: ; 17871 (5:7871)  .skipFirstLoad  	pop de  	pop hl -	ld a,[$ff8d] +	ld a,[hVRAMSlot]  	cp a,11 ; is it a 4-tile sprite?  	jr nc,.skipSecondLoad ; if so, there is no second block  	push de diff --git a/engine/predefs.asm b/engine/predefs.asm index 1af240ce..17f94b73 100755 --- a/engine/predefs.asm +++ b/engine/predefs.asm @@ -111,7 +111,7 @@ PredefPointers:: ; 4fe79 (13:7e79)  	add_predef InternalClockTradeAnim  	add_predef TrainerEngage  	add_predef IndexToPokedex -	add_predef Predef3B; 3B display pic? +	add_predef DisplayPicCenteredOrUpperRight; 3B display pic?  	add_predef UsedCut  	add_predef ShowPokedexData  	add_predef WriteMonMoves @@ -144,7 +144,7 @@ PredefPointers:: ; 4fe79 (13:7e79)  	add_predef GetTileTwoStepsInFrontOfPlayer  	add_predef CheckForCollisionWhenPushingBoulder  	add_predef PrintStrengthTxt -	add_predef PickupItem +	add_predef PickUpItem  	add_predef PrintMoveType  	add_predef LoadMovePPs  	add_predef DrawHP ; 5F @@ -969,10 +969,10 @@ PokeCenterSignText:: ; 24ef (0:24ef)  	TX_FAR _PokeCenterSignText  	db "@" -Predef5CText:: ; 24f4 (0:24f4) +PickUpItemText:: ; 24f4 (0:24f4)  ; XXX better label (what does predef $5C do?)  	TX_ASM -	predef PickupItem +	predef PickUpItem  	jp TextScriptEnd @@ -1050,7 +1050,7 @@ Func_28cb:: ; 28cb (0:28cb)  	jp PlaySound  ; this function is used to display sign messages, sprite dialog, etc. -; INPUT: [$ff8c] = sprite ID or text ID +; INPUT: [hSpriteIndexOrTextID] = sprite ID or text ID  DisplayTextID:: ; 2920 (0:2920)  	ld a,[H_LOADEDROMBANK]  	push af @@ -1069,7 +1069,7 @@ DisplayTextID:: ; 2920 (0:2920)  	ld h,[hl]  	ld l,a ; hl = map text pointer  	ld d,$00 -	ld a,[$ff8c] ; text ID +	ld a,[hSpriteIndexOrTextID] ; text ID  	ld [wSpriteIndex],a  	and a  	jp z,DisplayStartMenu @@ -1083,7 +1083,7 @@ DisplayTextID:: ; 2920 (0:2920)  	jp z,DisplayRepelWoreOffText  	ld a,[W_NUMSPRITES]  	ld e,a -	ld a,[$ff8c] ; sprite ID +	ld a,[hSpriteIndexOrTextID] ; sprite ID  	cp e  	jr z,.spriteHandling  	jr nc,.skipSpriteHandling @@ -1096,7 +1096,7 @@ DisplayTextID:: ; 2920 (0:2920)  	pop bc  	pop de  	ld hl,W_MAPSPRITEDATA ; NPC text entries -	ld a,[$ff8c] +	ld a,[hSpriteIndexOrTextID]  	dec a  	add a  	add l @@ -1235,10 +1235,12 @@ LoadItemList:: ; 2a5a (0:2a5a)  	ret  DisplayPokemonCenterDialogue:: ; 2a72 (0:2a72) +; zeroing these doesn't appear to serve any purpose  	xor a  	ld [$ff8b],a  	ld [$ff8c],a  	ld [$ff8d],a +  	inc hl  	ld a,[H_LOADEDROMBANK]  	push af @@ -2487,8 +2489,8 @@ CheckForEngagingTrainers:: ; 3306 (0:3306)  	ld c, a  	call TrainerFlagAction        ; read trainer flag  	ld a, c -	and a -	jr nz, .trainerAlreadyFought +	and a ; has the trainer already been defeated? +	jr nz, .continue  	push hl  	push de  	push hl @@ -2507,7 +2509,7 @@ CheckForEngagingTrainers:: ; 3306 (0:3306)  	ld a, [wTrainerSpriteOffset]  	and a  	ret nz        ; break if the trainer is engaging -.trainerAlreadyFought +.continue  	ld hl, $c  	add hl, de  	ld d, h @@ -2737,7 +2739,7 @@ SetSpriteFacingDirection:: ; 34ae (0:34ae)  	ld a, $9  	ld [H_SPRITEDATAOFFSET], a  	call GetPointerWithinSpriteStateData1 -	ld a, [$ff8d] +	ld a, [hSpriteFacingDirection]  	ld [hl], a  	ret @@ -2858,18 +2860,18 @@ DecodeRLEList:: ; 350c (0:350c)  	inc a                        ; include sentinel in counting  	ret -; sets movement byte 1 for sprite [$FF8C] to $FE and byte 2 to [$FF8D] +; sets movement byte 1 for sprite [H_SPRITEINDEX] to $FE and byte 2 to [hSpriteMovementByte2]  SetSpriteMovementBytesToFE:: ; 3533 (0:3533)  	push hl  	call GetSpriteMovementByte1Pointer  	ld [hl], $fe  	call GetSpriteMovementByte2Pointer -	ld a, [$ff8d] +	ld a, [hSpriteMovementByte2]  	ld [hl], a  	pop hl  	ret -; sets both movement bytes for sprite [$FF8C] to $FF +; sets both movement bytes for sprite [H_SPRITEINDEX] to $FF  SetSpriteMovementBytesToFF:: ; 3541 (0:3541)  	push hl  	call GetSpriteMovementByte1Pointer @@ -2879,20 +2881,20 @@ SetSpriteMovementBytesToFF:: ; 3541 (0:3541)  	pop hl  	ret -; returns the sprite movement byte 1 pointer for sprite [$FF8C] in hl +; returns the sprite movement byte 1 pointer for sprite [H_SPRITEINDEX] in hl  GetSpriteMovementByte1Pointer:: ; 354e (0:354e)  	ld h,$C2 -	ld a,[H_SPRITEINDEX] ; the sprite to move +	ld a,[H_SPRITEINDEX]  	swap a  	add a,6  	ld l,a  	ret -; returns the sprite movement byte 2 pointer for sprite [$FF8C] in hl +; returns the sprite movement byte 2 pointer for sprite [H_SPRITEINDEX] in hl  GetSpriteMovementByte2Pointer:: ; 3558 (0:3558)  	push de  	ld hl,W_MAPSPRITEDATA -	ld a,[$FF8C] ; the sprite to move +	ld a,[H_SPRITEINDEX]  	dec a  	add a  	ld d,0 diff --git a/home/copy2.asm b/home/copy2.asm index e5f28383..f872ebbc 100644 --- a/home/copy2.asm +++ b/home/copy2.asm @@ -1,10 +1,10 @@  FarCopyData2:: -; Identical to FarCopyData, but uses $ff8b +; Identical to FarCopyData, but uses hROMBankTemp  ; as temp space instead of wBuffer. -	ld [$ff8b],a +	ld [hROMBankTemp],a  	ld a,[H_LOADEDROMBANK]  	push af -	ld a,[$ff8b] +	ld a,[hROMBankTemp]  	ld [H_LOADEDROMBANK],a  	ld [MBC1RomBank],a  	call CopyData @@ -15,10 +15,10 @@ FarCopyData2::  FarCopyData3::  ; Copy bc bytes from a:de to hl. -	ld [$ff8b],a +	ld [hROMBankTemp],a  	ld a,[H_LOADEDROMBANK]  	push af -	ld a,[$ff8b] +	ld a,[hROMBankTemp]  	ld [H_LOADEDROMBANK],a  	ld [MBC1RomBank],a  	push hl @@ -38,10 +38,10 @@ FarCopyData3::  FarCopyDataDouble::  ; Expand bc bytes of 1bpp image data  ; from a:hl to 2bpp data at de. -	ld [$ff8b],a +	ld [hROMBankTemp],a  	ld a,[H_LOADEDROMBANK]  	push af -	ld a,[$ff8b] +	ld a,[hROMBankTemp]  	ld [H_LOADEDROMBANK],a  	ld [MBC1RomBank],a  .loop @@ -70,7 +70,7 @@ CopyVideoData::  	ld [H_AUTOBGTRANSFERENABLED], a  	ld a, [H_LOADEDROMBANK] -	ld [$ff8b], a +	ld [hROMBankTemp], a  	ld a, b  	ld [H_LOADEDROMBANK], a @@ -94,7 +94,7 @@ CopyVideoData::  .done  	ld [H_VBCOPYSIZE], a  	call DelayFrame -	ld a, [$ff8b] +	ld a, [hROMBankTemp]  	ld [H_LOADEDROMBANK], a  	ld [MBC1RomBank], a  	pop af @@ -119,7 +119,7 @@ CopyVideoDataDouble::  	xor a ; disable auto-transfer while copying  	ld [H_AUTOBGTRANSFERENABLED], a  	ld a, [H_LOADEDROMBANK] -	ld [$ff8b], a +	ld [hROMBankTemp], a  	ld a, b  	ld [H_LOADEDROMBANK], a @@ -143,7 +143,7 @@ CopyVideoDataDouble::  .done  	ld [H_VBCOPYDOUBLESIZE], a  	call DelayFrame -	ld a, [$ff8b] +	ld a, [hROMBankTemp]  	ld [H_LOADEDROMBANK], a  	ld [MBC1RomBank], a  	pop af diff --git a/home/overworld.asm b/home/overworld.asm index f4d6d695..da514763 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -444,7 +444,7 @@ CheckWarpsCollision:: ; 0706 (0:0706)  	ld a,[hli]  	ld [wDestinationWarpID],a  	ld a,[hl] -	ld [$ff8b],a ; save target map +	ld [hWarpDestinationMap],a  	jr WarpFound2  .retry1  	inc hl @@ -466,7 +466,7 @@ WarpFound1:: ; 0735 (0:0735)  	ld a,[hli]  	ld [wDestinationWarpID],a  	ld a,[hli] -	ld [$ff8b],a ; save target map +	ld [hWarpDestinationMap],a  WarpFound2:: ; 073c (0:073c)  	ld a,[wNumberOfWarps] @@ -481,8 +481,8 @@ WarpFound2:: ; 073c (0:073c)  	ld [wLastMap],a  	ld a,[W_CURMAPWIDTH]  	ld [wd366],a -	ld a,[$ff8b] ; destination map number -	ld [W_CURMAP],a ; change current map to destination map +	ld a,[hWarpDestinationMap] +	ld [W_CURMAP],a  	cp a,ROCK_TUNNEL_1  	jr nz,.notRockTunnel  	ld a,$06 @@ -493,11 +493,11 @@ WarpFound2:: ; 073c (0:073c)  	jr .done  ; for maps that can have the 0xFF destination map, which means to return to the outside map; not all these maps are necessarily indoors, though  .indoorMaps -	ld a,[$ff8b] ; destination map +	ld a,[hWarpDestinationMap] ; destination map  	cp a,$ff  	jr z,.goBackOutside  ; if not going back to the previous map -	ld [W_CURMAP],a ; current map number +	ld [W_CURMAP],a  	callba IsPlayerStandingOnWarpPadOrHole  	ld a,[wcd5b]  	dec a ; is the player on a warp pad? @@ -539,22 +539,22 @@ CheckMapConnections:: ; 07ba (0:07ba)  	jr nz,.checkEastMap  	ld a,[W_MAPCONN3PTR]  	ld [W_CURMAP],a -	ld a,[wd38f] ; new X coordinate upon entering west map +	ld a,[wWestConnectedMapXAlignment] ; new X coordinate upon entering west map  	ld [W_XCOORD],a  	ld a,[W_YCOORD]  	ld c,a -	ld a,[wd38e] ; Y adjustment upon entering west map +	ld a,[wWestConnectedMapYAlignment] ; Y adjustment upon entering west map  	add c  	ld c,a  	ld [W_YCOORD],a -	ld a,[wd390] ; pointer to upper left corner of map without adjustment for Y position +	ld a,[wWestConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for Y position  	ld l,a -	ld a,[wd391] +	ld a,[wWestConnectedMapViewPointer + 1]  	ld h,a  	srl c  	jr z,.savePointer1  .pointerAdjustmentLoop1 -	ld a,[wd38d] ; width of connected map +	ld a,[wWestConnectedMapWidth] ; width of connected map  	add a,$06  	ld e,a  	ld d,$00 @@ -575,22 +575,22 @@ CheckMapConnections:: ; 07ba (0:07ba)  	jr nz,.checkNorthMap  	ld a,[W_MAPCONN4PTR]  	ld [W_CURMAP],a -	ld a,[wd39a] ; new X coordinate upon entering east map +	ld a,[wEastConnectedMapXAlignment] ; new X coordinate upon entering east map  	ld [W_XCOORD],a  	ld a,[W_YCOORD]  	ld c,a -	ld a,[wd399] ; Y adjustment upon entering east map +	ld a,[wEastConnectedMapYAlignment] ; Y adjustment upon entering east map  	add c  	ld c,a  	ld [W_YCOORD],a -	ld a,[wd39b] ; pointer to upper left corner of map without adjustment for Y position +	ld a,[wEastConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for Y position  	ld l,a -	ld a,[wd39c] +	ld a,[wEastConnectedMapViewPointer + 1]  	ld h,a  	srl c  	jr z,.savePointer2  .pointerAdjustmentLoop2 -	ld a,[wd398] +	ld a,[wEastConnectedMapWidth]  	add a,$06  	ld e,a  	ld d,$00 @@ -610,19 +610,19 @@ CheckMapConnections:: ; 07ba (0:07ba)  	jr nz,.checkSouthMap  	ld a,[W_MAPCONN1PTR]  	ld [W_CURMAP],a -	ld a,[wd378] ; new Y coordinate upon entering north map +	ld a,[wNorthConnectedMapYAlignment] ; new Y coordinate upon entering north map  	ld [W_YCOORD],a  	ld a,[W_XCOORD]  	ld c,a -	ld a,[wd379] ; X adjustment upon entering north map +	ld a,[wNorthConnectedMapXAlignment] ; X adjustment upon entering north map  	add c  	ld c,a  	ld [W_XCOORD],a -	ld a,[wd37a] ; pointer to upper left corner of map without adjustment for X position +	ld a,[wNorthConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for X position  	ld l,a -	ld a,[wd37b] +	ld a,[wNorthConnectedMapViewPointer + 1]  	ld h,a -	ld b,$00 +	ld b,0  	srl c  	add hl,bc  	ld a,l @@ -637,19 +637,19 @@ CheckMapConnections:: ; 07ba (0:07ba)  	jr nz,.didNotEnterConnectedMap  	ld a,[W_MAPCONN2PTR]  	ld [W_CURMAP],a -	ld a,[wd383] ; new Y coordinate upon entering south map +	ld a,[wSouthConnectedMapYAlignment] ; new Y coordinate upon entering south map  	ld [W_YCOORD],a  	ld a,[W_XCOORD]  	ld c,a -	ld a,[wd384] ; X adjustment upon entering south map +	ld a,[wSouthConnectedMapXAlignment] ; X adjustment upon entering south map  	add c  	ld c,a  	ld [W_XCOORD],a -	ld a,[wd385] ; pointer to upper left corner of map without adjustment for X position +	ld a,[wSouthConnectedMapViewPointer] ; pointer to upper left corner of map without adjustment for X position  	ld l,a -	ld a,[wd386] +	ld a,[wSouthConnectedMapViewPointer + 1]  	ld h,a -	ld b,$00 +	ld b,0  	srl c  	add hl,bc  	ld a,l @@ -884,9 +884,9 @@ LoadTileBlockMap:: ; 09fc (0:09fc)  ; a 3-byte border at the edges of the map is kept so that there is space for map connections  	ld hl,wOverworldMap  	ld a,[W_CURMAPWIDTH] -	ld [$ff8c],a +	ld [hMapWidth],a  	add a,$06 ; border (east and west) -	ld [$ff8b],a ; map width + border +	ld [hMapStride],a ; map width + border  	ld b,$00  	ld c,a  ; make space for north border (next 3 lines) @@ -903,7 +903,7 @@ LoadTileBlockMap:: ; 09fc (0:09fc)  	ld b,a  .rowLoop ; copy one row each iteration  	push hl -	ld a,[$ff8c] ; map width (without border) +	ld a,[hMapWidth] ; map width (without border)  	ld c,a  .rowInnerLoop  	ld a,[de] @@ -913,7 +913,7 @@ LoadTileBlockMap:: ; 09fc (0:09fc)  	jr nz,.rowInnerLoop  ; add the map width plus the border to the base address of the current row to get the next row's address  	pop hl -	ld a,[$ff8b] ; map width + border +	ld a,[hMapStride] ; map width + border  	add l  	ld l,a  	jr nc,.noCarry @@ -926,72 +926,72 @@ LoadTileBlockMap:: ; 09fc (0:09fc)  	cp a,$ff  	jr z,.southConnection  	call SwitchToMapRomBank -	ld a,[wd372] +	ld a,[wNorthConnectionStripSrc]  	ld l,a -	ld a,[wd373] +	ld a,[wNorthConnectionStripSrc + 1]  	ld h,a -	ld a,[wd374] +	ld a,[wNorthConnectionStripDest]  	ld e,a -	ld a,[wd375] +	ld a,[wNorthConnectionStripDest + 1]  	ld d,a -	ld a,[wd376] -	ld [$ff8b],a -	ld a,[wd377] -	ld [$ff8c],a +	ld a,[wNorthConnectionStripWidth] +	ld [hNorthSouthConnectionStripWidth],a +	ld a,[wNorthConnectedMapWidth] +	ld [hNorthSouthConnectedMapWidth],a  	call LoadNorthSouthConnectionsTileMap  .southConnection  	ld a,[W_MAPCONN2PTR]  	cp a,$ff  	jr z,.westConnection  	call SwitchToMapRomBank -	ld a,[wd37d] +	ld a,[wSouthConnectionStripSrc]  	ld l,a -	ld a,[wd37e] +	ld a,[wSouthConnectionStripSrc + 1]  	ld h,a -	ld a,[wd37f] +	ld a,[wSouthConnectionStripDest]  	ld e,a -	ld a,[wd380] +	ld a,[wSouthConnectionStripDest + 1]  	ld d,a -	ld a,[wd381] -	ld [$ff8b],a -	ld a,[wd382] -	ld [$ff8c],a +	ld a,[wSouthConnectionStripWidth] +	ld [hNorthSouthConnectionStripWidth],a +	ld a,[wSouthConnectedMapWidth] +	ld [hNorthSouthConnectedMapWidth],a  	call LoadNorthSouthConnectionsTileMap  .westConnection  	ld a,[W_MAPCONN3PTR]  	cp a,$ff  	jr z,.eastConnection  	call SwitchToMapRomBank -	ld a,[wd388] +	ld a,[wWestConnectionStripSrc]  	ld l,a -	ld a,[wd389] +	ld a,[wWestConnectionStripSrc + 1]  	ld h,a -	ld a,[wd38a] +	ld a,[wWestConnectionStripDest]  	ld e,a -	ld a,[wd38b] +	ld a,[wWestConnectionStripDest + 1]  	ld d,a -	ld a,[wd38c] +	ld a,[wWestConnectionStripHeight]  	ld b,a -	ld a,[wd38d] -	ld [$ff8b],a +	ld a,[wWestConnectedMapWidth] +	ld [hEastWestConnectedMapWidth],a  	call LoadEastWestConnectionsTileMap  .eastConnection  	ld a,[W_MAPCONN4PTR]  	cp a,$ff  	jr z,.done  	call SwitchToMapRomBank -	ld a,[wd393] +	ld a,[wEastConnectionStripSrc]  	ld l,a -	ld a,[wd394] +	ld a,[wEastConnectionStripSrc + 1]  	ld h,a -	ld a,[wd395] +	ld a,[wEastConnectionStripDest]  	ld e,a -	ld a,[wd396] +	ld a,[wEastConnectionStripDest + 1]  	ld d,a -	ld a,[wd397] +	ld a,[wEastConnectionStripHeight]  	ld b,a -	ld a,[wd398] -	ld [$ff8b],a +	ld a,[wEastConnectedMapWidth] +	ld [hEastWestConnectedMapWidth],a  	call LoadEastWestConnectionsTileMap  .done  	ret @@ -1001,7 +1001,7 @@ LoadNorthSouthConnectionsTileMap:: ; 0ade (0:0ade)  .loop  	push de  	push hl -	ld a,[$ff8b] ; width of connection +	ld a,[hNorthSouthConnectionStripWidth]  	ld b,a  .innerLoop  	ld a,[hli] @@ -1011,7 +1011,7 @@ LoadNorthSouthConnectionsTileMap:: ; 0ade (0:0ade)  	jr nz,.innerLoop  	pop hl  	pop de -	ld a,[$ff8c] ; width of connected map +	ld a,[hNorthSouthConnectedMapWidth]  	add l  	ld l,a  	jr nc,.noCarry1 @@ -1040,7 +1040,7 @@ LoadEastWestConnectionsTileMap:: ; 0b02 (0:0b02)  	jr nz,.innerLoop  	pop de  	pop hl -	ld a,[$ff8b] ; width of connected map +	ld a,[hEastWestConnectedMapWidth]  	add l  	ld l,a  	jr nc,.noCarry1 @@ -2022,7 +2022,7 @@ LoadMapHeader:: ; 107c (0:107c)  	ld b,a  	res 7,a  	ld [W_CURMAPTILESET],a -	ld [$ff8b],a +	ld [hPreviousTileset],a  	bit 7,b  	ret nz  	ld hl,MapHeaderPointers @@ -2191,24 +2191,24 @@ LoadMapHeader:: ; 107c (0:107c)  	ld a,[hli]  	ld [de],a ; store movement byte 1 at C2X6  	ld a,[hli] -	ld [$ff8d],a ; save movement byte 2 +	ld [hLoadSpriteTemp1],a ; save movement byte 2  	ld a,[hli] -	ld [$ff8e],a ; save text ID and flags byte +	ld [hLoadSpriteTemp2],a ; save text ID and flags byte  	push bc  	push hl  	ld b,$00  	ld hl,W_MAPSPRITEDATA  	add hl,bc -	ld a,[$ff8d] +	ld a,[hLoadSpriteTemp1]  	ld [hli],a ; store movement byte 2 in byte 0 of sprite entry -	ld a,[$ff8e] +	ld a,[hLoadSpriteTemp2]  	ld [hl],a ; this appears pointless, since the value is overwritten immediately after -	ld a,[$ff8e] -	ld [$ff8d],a +	ld a,[hLoadSpriteTemp2] +	ld [hLoadSpriteTemp1],a  	and a,$3f  	ld [hl],a ; store text ID in byte 1 of sprite entry  	pop hl -	ld a,[$ff8d] +	ld a,[hLoadSpriteTemp1]  	bit 6,a  	jr nz,.trainerSprite  	bit 7,a @@ -2216,25 +2216,25 @@ LoadMapHeader:: ; 107c (0:107c)  	jr .regularSprite  .trainerSprite  	ld a,[hli] -	ld [$ff8d],a ; save trainer class +	ld [hLoadSpriteTemp1],a ; save trainer class  	ld a,[hli] -	ld [$ff8e],a ; save trainer number (within class) +	ld [hLoadSpriteTemp2],a ; save trainer number (within class)  	push hl  	ld hl,W_MAPSPRITEEXTRADATA  	add hl,bc -	ld a,[$ff8d] +	ld a,[hLoadSpriteTemp1]  	ld [hli],a ; store trainer class in byte 0 of the entry -	ld a,[$ff8e] +	ld a,[hLoadSpriteTemp2]  	ld [hl],a ; store trainer number in byte 1 of the entry  	pop hl  	jr .nextSprite  .itemBallSprite  	ld a,[hli] -	ld [$ff8d],a ; save item number +	ld [hLoadSpriteTemp1],a ; save item number  	push hl  	ld hl,W_MAPSPRITEEXTRADATA  	add hl,bc -	ld a,[$ff8d] +	ld a,[hLoadSpriteTemp1]  	ld [hli],a ; store item number in byte 0 of the entry  	xor a  	ld [hl],a ; zero byte 1, since it is not used @@ -1,9 +1,3 @@ - -H_SPRITEWIDTH            EQU $FF8B ; in tiles -H_SPRITEINTERLACECOUNTER EQU $FF8B -H_SPRITEHEIGHT           EQU $FF8C ; in tiles -H_SPRITEOFFSET           EQU $FF8D -  hSoftReset EQU $FF8A  ; Initialized to 16.  ; Decremented each input iteration if the player @@ -12,8 +6,28 @@ hSoftReset EQU $FF8A  hBaseTileID EQU $FF8B +; 3-byte BCD number  hItemPrice EQU $FF8B +hDexWeight EQU $FF8B + +hWarpDestinationMap EQU $FF8B + +hOAMTile EQU $FF8B + +hROMBankTemp EQU $FF8B + +hPreviousTileset EQU $FF8B + +hEastWestConnectedMapWidth EQU $FF8B + +hSlideAmount EQU $FF8B + +H_SPRITEWIDTH            EQU $FF8B ; in tiles +H_SPRITEINTERLACECOUNTER EQU $FF8B +H_SPRITEHEIGHT           EQU $FF8C ; in tiles +H_SPRITEOFFSET           EQU $FF8D +  ; counters for blinking down arrow  H_DOWNARROWBLINKCNT1 EQU $FF8B  H_DOWNARROWBLINKCNT2 EQU $FF8C @@ -21,11 +35,40 @@ H_DOWNARROWBLINKCNT2 EQU $FF8C  H_SPRITEDATAOFFSET EQU $FF8B  H_SPRITEINDEX      EQU $FF8C +hMapStride EQU $FF8B +hMapWidth  EQU $FF8C + +hNorthSouthConnectionStripWidth EQU $FF8B +hNorthSouthConnectedMapWidth    EQU $FF8C +  ; DisplayTextID's argument  hSpriteIndexOrTextID EQU $FF8C  hPartyMonIndex EQU $FF8C +; the total number of tiles being shifted each time the pic slides by one tile +hSlidingRegionSize EQU $FF8C + +; 2 bytes +hEnemySpeed EQU $FF8D + +hVRAMSlot EQU $FF8D + +hFourTileSpriteCount EQU $FF8E + +; -1 = left +;  0 = right +hSlideDirection EQU $FF8D + +hSpriteFacingDirection EQU $FF8D + +hSpriteMovementByte2 EQU $FF8D + +hSpriteImageIndex EQU $FF8D + +hLoadSpriteTemp1 EQU $FF8D +hLoadSpriteTemp2 EQU $FF8E +  hHalveItemPrices EQU $FF8E  hSpriteOffset2 EQU $FF8F @@ -13,6 +13,10 @@ dex    EQUS "db $5f, $50" ; End a Pokedex entry.  percent EQUS "* $ff / 100" +lb: MACRO ; r, hi, lo +	ld \1, (\2) << 8 + (\3) +	ENDM +  ; Constant enumeration is useful for monsters, items, moves, etc.  const_def: MACRO @@ -530,7 +534,7 @@ ENDM  SOUTH_MAP_CONNECTION: MACRO  	db \1 ; map id  	dw \6 + \4 ; "Conection Strip" location -	dw wOverworldMap + 3 + (\8 + 3) * (\7 + 6) + \3 ; current map positoin +	dw wOverworldMap + 3 + (\8 + 3) * (\7 + 6) + \3 ; current map position  	db \5 ; width of connection strip  	db \2 ; map width  	db 0  ; y alignment (y coordinate of player when entering map) @@ -996,7 +996,7 @@ DisplayTextIDInit: ; 7096 (1:7096)  	ld a,[wAutoTextBoxDrawingControl]  	bit 0,a  	jr nz,.skipDrawingTextBoxBorder -	ld a,[$ff8c] ; text ID (or sprite ID) +	ld a,[hSpriteIndexOrTextID] ; text ID (or sprite ID)  	and a  	jr nz,.notStartMenu  ; if text ID is 0 (i.e. the start menu) @@ -2094,7 +2094,7 @@ IsPlayerStandingOnWarp: ; c35f (3:435f)  	ld a, [hli] ; target warp  	ld [wDestinationWarpID], a  	ld a, [hl] ; target map -	ld [$ff8b], a +	ld [hWarpDestinationMap], a  	ld hl, wd736  	set 2, [hl] ; standing on warp flag  	ret @@ -2593,7 +2593,7 @@ ApplyOutOfBattlePoisonDamage: ; c69c (3:469c)  	ld [wJoyIgnore], a  	call EnableAutoTextBoxDrawing  	ld a, $d0 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	pop de  	pop hl @@ -2640,7 +2640,7 @@ ApplyOutOfBattlePoisonDamage: ; c69c (3:469c)  	jr nz, .noBlackOut  	call EnableAutoTextBoxDrawing  	ld a, $d1 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd72e  	set 5, [hl] @@ -2692,7 +2692,7 @@ LoadTilesetHeader: ; c754 (3:4754)  	jr c, .asm_c797  	ld a, [W_CURMAPTILESET]  	ld b, a -	ld a, [$ff8b] +	ld a, [hPreviousTileset]  	cp b  	jr z, .done  .asm_c797 @@ -3454,15 +3454,15 @@ TryPushingBoulder: ; f225 (3:7225)  	bit 1, a ; has boulder dust animation from previous push played yet?  	ret nz  	xor a -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call IsSpriteInFrontOfPlayer -	ld a, [$ff8c] +	ld a, [hSpriteIndexOrTextID]  	ld [wBoulderSpriteIndex], a  	and a  	jp z, ResetBoulderPushFlags  	ld hl, wSpriteStateData1 + 1  	ld d, $0 -	ld a, [$ff8c] +	ld a, [hSpriteIndexOrTextID]  	swap a  	ld e, a  	add hl, de diff --git a/scripts/agatha.asm b/scripts/agatha.asm index cc209553..e65b1fa2 100755 --- a/scripts/agatha.asm +++ b/scripts/agatha.asm @@ -76,7 +76,7 @@ AgathaScript0: ; 76490 (1d:6490)  	jr z, AgathaScript_76474  .asm_764b4  	ld a, $2 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, D_UP  	ld [wSimulatedJoypadStatesEnd], a @@ -112,7 +112,7 @@ AgathaScript2: ; 764ed (1d:64ed)  	cp $ff  	jp z, AgathaScript_76464  	ld a, $1 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, $1  	ld [W_GARYCURSCRIPT], a diff --git a/scripts/billshouse.asm b/scripts/billshouse.asm index 5de02d83..115b3b19 100755 --- a/scripts/billshouse.asm +++ b/scripts/billshouse.asm @@ -23,7 +23,7 @@ BillsHouseScript1: ; 1e783 (7:6783)  	ld de, MovementData_1e7a0  .notDown  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	call MoveSprite  	ld a, $2  	ld [W_BILLSHOUSECURSCRIPT], a @@ -82,7 +82,7 @@ BillsHouseScript3: ; 1e7c5 (7:67c5)  	ld c, 8  	call DelayFrames  	ld a, $2 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	ld de, MovementData_1e807  	call MoveSprite  	ld a, $4 @@ -113,7 +113,7 @@ BillsHouseScript4: ; 1e80d (7:680d)  BillsHouseScript5: ; 1e827 (7:6827)  	ld a, $4 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, $0  	ld [W_BILLSHOUSECURSCRIPT], a diff --git a/scripts/bruno.asm b/scripts/bruno.asm index 257a830b..bd28917c 100755 --- a/scripts/bruno.asm +++ b/scripts/bruno.asm @@ -76,7 +76,7 @@ BrunoScript0: ; 76339 (1d:6339)  	jr z, BrunoScript_7631d  .asm_7635d  	ld a, $2 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, D_UP  	ld [wSimulatedJoypadStatesEnd], a @@ -112,7 +112,7 @@ BrunoScript2: ; 76396 (1d:6396)  	cp $ff  	jp z, BrunoScript_7630d  	ld a, $1 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	jp DisplayTextID  BrunoTextPointers: ; 763a8 (1d:63a8) diff --git a/scripts/celadongamecorner.asm b/scripts/celadongamecorner.asm index 3bcdf3a3..b9c006d1 100755 --- a/scripts/celadongamecorner.asm +++ b/scripts/celadongamecorner.asm @@ -58,10 +58,10 @@ CeladonGameCornerScript1: ; 48c19 (12:4c19)  	ld a, $f0  	ld [wJoyIgnore], a  	ld a, $d -	ld [H_SPRITEHEIGHT], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, $b -	ld [H_SPRITEHEIGHT], a +	ld [H_SPRITEINDEX], a  	call SetSpriteMovementBytesToFF  	ld de, MovementData_48c5a  	ld a, [W_YCOORD] @@ -76,7 +76,7 @@ CeladonGameCornerScript1: ; 48c19 (12:4c19)  	ld de, MovementData_48c63  .asm_48c4d  	ld a, $b -	ld [H_DOWNARROWBLINKCNT2], a +	ld [H_SPRITEINDEX], a  	call MoveSprite  	ld a, $2  	ld [W_CELADONGAMECORNERCURSCRIPT], a diff --git a/scripts/celadongym.asm b/scripts/celadongym.asm index 4793bf14..b978b272 100755 --- a/scripts/celadongym.asm +++ b/scripts/celadongym.asm @@ -44,7 +44,7 @@ CeladonGymScript3: ; 48956 (12:4956)  CeladonGymText_48963: ; 48963 (12:4963)  	ld a, $9 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd77c  	set 1, [hl] @@ -52,14 +52,14 @@ CeladonGymText_48963: ; 48963 (12:4963)  	call GiveItem  	jr nc, .BagFull  	ld a, $a -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd77c  	set 0, [hl]  	jr .asm_4898c  .BagFull  	ld a, $b -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  .asm_4898c  	ld hl, W_OBTAINEDBADGES diff --git a/scripts/ceruleancity.asm b/scripts/ceruleancity.asm index 3565b809..20873a81 100755 --- a/scripts/ceruleancity.asm +++ b/scripts/ceruleancity.asm @@ -28,7 +28,7 @@ CeruleanCityScript4: ; 194a7 (6:54a7)  	ld hl, wd75b  	set 7, [hl]  	ld a, $2 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	xor a  	ld [wJoyIgnore], a @@ -55,7 +55,7 @@ CeruleanCityScript0: ; 194c8 (6:54c8)  	ld [wSpriteStateData1 + $29], a  	call Delay3  	ld a, $2 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	jp DisplayTextID  .asm_194f7  	ld a, [wd75a] @@ -82,9 +82,9 @@ CeruleanCityScript0: ; 194c8 (6:54c8)  	cp $14  	jr z, .asm_19535  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	ld a, $5 -	ld [$ff8b], a +	ld [H_SPRITEDATAOFFSET], a  	call GetPointerWithinSpriteStateData2  	ld [hl], $19  .asm_19535 @@ -93,7 +93,7 @@ CeruleanCityScript0: ; 194c8 (6:54c8)  	predef ShowObject  	ld de, CeruleanCityMovement1  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	call MoveSprite  	ld a, $1  	ld [W_CERULEANCITYCURSCRIPT], a @@ -117,9 +117,9 @@ CeruleanCityMovement1: ; 19559 (6:5559)  CeruleanCityScript_1955d: ; 1955d (6:555d)  	ld a,1 -	ld [$ff8c],a +	ld [H_SPRITEINDEX],a  	xor a ; SPRITE_FACING_DOWN -	ld [$ff8d],a +	ld [hSpriteFacingDirection],a  	jp SetSpriteFacingDirectionAndDelay ; face object  CeruleanCityScript1: ; 19567 (6:5567) @@ -129,7 +129,7 @@ CeruleanCityScript1: ; 19567 (6:5567)  	xor a  	ld [wJoyIgnore], a  	ld a, $1 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd72d  	set 6, [hl] @@ -173,14 +173,14 @@ CeruleanCityScript2: ; 195b1 (6:55b1)  	ld hl, wd75a  	set 0, [hl]  	ld a, $1 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, $ff  	ld [wc0ee], a  	call PlaySound  	callba Music_RivalAlternateStart  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	call SetSpriteMovementBytesToFF  	ld a, [W_XCOORD]  	cp $14 @@ -191,7 +191,7 @@ CeruleanCityScript2: ; 195b1 (6:55b1)  	ld de, CeruleanCityMovement3  .asm_195f3  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	call MoveSprite  	ld a, $3  	ld [W_CERULEANCITYCURSCRIPT], a @@ -295,7 +295,7 @@ CeruleanCityText2: ; 1967c (6:567c)  	ld hl, CeruleanCityText_196ee  	ld de, CeruleanCityText_196ee  	call SaveEndBattleTextPointers -	ld a, [$ff8c] +	ld a, [hSpriteIndexOrTextID]  	ld [wSpriteIndex], a  	call EngageMapTrainer  	call InitBattleEnemyParameters diff --git a/scripts/ceruleangym.asm b/scripts/ceruleangym.asm index a6cb4c64..2343af03 100755 --- a/scripts/ceruleangym.asm +++ b/scripts/ceruleangym.asm @@ -44,7 +44,7 @@ CeruleanGymScript3: ; 5c700 (17:4700)  CeruleanGymScript_5c70d: ; 5c70d (17:470d)  	ld a, $5 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd75e  	set 7, [hl] @@ -52,14 +52,14 @@ CeruleanGymScript_5c70d: ; 5c70d (17:470d)  	call GiveItem  	jr nc, .BagFull  	ld a, $6 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd75e  	set 6, [hl]  	jr .asm_5c736  .BagFull  	ld a, $7 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  .asm_5c736  	ld hl, W_OBTAINEDBADGES diff --git a/scripts/cinnabargym.asm b/scripts/cinnabargym.asm index b3d6def6..dbede0d3 100755 --- a/scripts/cinnabargym.asm +++ b/scripts/cinnabargym.asm @@ -37,7 +37,7 @@ CinnabarGymScript_75792: ; 75792 (1d:5792)  	ret  CinnabarGymScript_757a0: ; 757a0 (1d:57a0) -	ld a, [H_DOWNARROWBLINKCNT2] +	ld a, [hSpriteIndexOrTextID]  	ld [wTrainerHeaderFlagBit], a  	ret @@ -51,7 +51,7 @@ CinnabarGymScript0: ; 757ae (1d:57ae)  	ld a, [wda38]  	and a  	ret z -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	cp $4  	jr nz, .asm_757c3  	ld a, $4 @@ -86,7 +86,7 @@ CinnabarGymScript1: ; 757dc (1d:57dc)  	ld [wJoyIgnore], a  	ld a, [wda38]  	ld [wTrainerHeaderFlagBit], a -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	jp DisplayTextID  CinnabarGymScript_757f1: ; 757f1 (1d:57f1) @@ -139,7 +139,7 @@ CinnabarGymScript3: ; 7584a (1d:584a)  	ld [wJoyIgnore], a  CinnabarGymScript3_75857: ; 75857 (1d:5857)  	ld a, $a -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd79a  	set 1, [hl] @@ -147,14 +147,14 @@ CinnabarGymScript3_75857: ; 75857 (1d:5857)  	call GiveItem  	jr nc, .BagFull  	ld a, $b -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd79a  	set 0, [hl]  	jr .asm_75880  .BagFull  	ld a, $c -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  .asm_75880  	ld hl, W_OBTAINEDBADGES @@ -189,7 +189,7 @@ CinnabarGymTextPointers: ; 7589f (1d:589f)  	dw TM38NoRoomText  CinnabarGymScript_758b7: ; 758b7 (1d:58b7) -	ld a, [H_DOWNARROWBLINKCNT2] +	ld a, [hSpriteIndexOrTextID]  	ld [wSpriteIndex], a  	call EngageMapTrainer  	call InitBattleEnemyParameters diff --git a/scripts/cinnabarisland.asm b/scripts/cinnabarisland.asm index 33a497c4..70ea25a5 100755 --- a/scripts/cinnabarisland.asm +++ b/scripts/cinnabarisland.asm @@ -27,7 +27,7 @@ CinnabarIslandScript0: ; 1ca38 (7:4a38)  	ld a, $8  	ld [wd528], a  	ld a, $8 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	xor a  	ld [hJoyHeld], a diff --git a/scripts/fightingdojo.asm b/scripts/fightingdojo.asm index 1b118f55..8a4a0464 100755 --- a/scripts/fightingdojo.asm +++ b/scripts/fightingdojo.asm @@ -45,12 +45,12 @@ FightingDojoScript1: ; 5cd83 (17:4d83)  	ld a, $1  	ld [wd528], a  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	ld a, SPRITE_FACING_LEFT -	ld [$ff8d], a +	ld [hSpriteFacingDirection], a  	call SetSpriteFacingDirectionAndDelay  	ld a, $1 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ret @@ -64,9 +64,9 @@ FightingDojoScript3: ; 5cdc6 (17:4dc6)  	ld a, $1  	ld [wd528], a  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	ld a, SPRITE_FACING_LEFT -	ld [$ff8d], a +	ld [hSpriteFacingDirection], a  	call SetSpriteFacingDirectionAndDelay  .asm_5cde4 @@ -76,7 +76,7 @@ FightingDojoScript3: ; 5cdc6 (17:4dc6)  	or $3e  	ld [wd7b1], a  	ld a, $8 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	xor a  	ld [wJoyIgnore], a @@ -148,7 +148,7 @@ FightingDojoText1: ; 5ce44 (17:4e44)  	ld hl, FightingDojoText_5ce93  	ld de, FightingDojoText_5ce93  	call SaveEndBattleTextPointers -	ld a, [H_SPRITEINDEX] +	ld a, [hSpriteIndexOrTextID]  	ld [wSpriteIndex], a  	call EngageMapTrainer  	call InitBattleEnemyParameters diff --git a/scripts/fuchsiagym.asm b/scripts/fuchsiagym.asm index f88f0055..843e7293 100755 --- a/scripts/fuchsiagym.asm +++ b/scripts/fuchsiagym.asm @@ -44,7 +44,7 @@ FuchsiaGymScript3: ; 7548a (1d:548a)  	ld [wJoyIgnore], a  FuchsiaGymScript3_75497: ; 75497 (1d:5497)  	ld a, $9 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd792  	set 1, [hl] @@ -52,14 +52,14 @@ FuchsiaGymScript3_75497: ; 75497 (1d:5497)  	call GiveItem  	jr nc, .BagFull  	ld a, $a -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd792  	set 0, [hl]  	jr .asm_754c0  .BagFull  	ld a, $b -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  .asm_754c0  	ld hl, W_OBTAINEDBADGES diff --git a/scripts/fuchsiahouse2.asm b/scripts/fuchsiahouse2.asm index 12b49297..f758b49e 100755 --- a/scripts/fuchsiahouse2.asm +++ b/scripts/fuchsiahouse2.asm @@ -3,7 +3,7 @@ FuchsiaHouse2Script: ; 750b5 (1d:50b5)  FuchsiaHouse2TextPointers: ; 750b8 (1d:50b8)  	dw FuchsiaHouse2Text1 -	dw Predef5CText +	dw PickUpItemText  	dw BoulderText  	dw FuchsiaHouse2Text4  	dw FuchsiaHouse2Text5 diff --git a/scripts/gary.asm b/scripts/gary.asm index 59989b5f..476a59b0 100755 --- a/scripts/gary.asm +++ b/scripts/gary.asm @@ -55,7 +55,7 @@ GaryScript2: ; 75f6a (1d:5f6a)  	ld hl, W_OPTIONS  	res 7, [hl]  	ld a, $1 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	call Delay3  	ld hl, wd72d @@ -99,10 +99,10 @@ GaryScript3: ; 75fbb (1d:5fbb)  	ld a, $f0  	ld [wJoyIgnore], a  	ld a, $1 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call GaryScript_760c8  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	call SetSpriteMovementBytesToFF  	ld a, $4  	ld [W_GARYCURSCRIPT], a @@ -111,14 +111,14 @@ GaryScript3: ; 75fbb (1d:5fbb)  GaryScript4: ; 75fe4 (1d:5fe4)  	callba Music_Cities1AlternateTempo  	ld a, $2 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call GaryScript_760c8  	ld a, $2 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	call SetSpriteMovementBytesToFF  	ld de, MovementData_76014  	ld a, $2 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	call MoveSprite  	ld a, HS_CHAMPIONS_ROOM_OAK  	ld [wcc4d], a @@ -142,17 +142,17 @@ GaryScript5: ; 7601a (1d:601a)  	ld a, $2  	ld [wd528], a  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	ld a, SPRITE_FACING_LEFT -	ld [$ff8d], a +	ld [hSpriteFacingDirection], a  	call SetSpriteFacingDirectionAndDelay  	ld a, $2 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	xor a ; SPRITE_FACING_DOWN -	ld [$ff8d], a -	call SetSpriteFacingDirectionAndDelay ; face object +	ld [hSpriteFacingDirection], a +	call SetSpriteFacingDirectionAndDelay  	ld a, $3 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call GaryScript_760c8  	ld a, $6  	ld [W_GARYCURSCRIPT], a @@ -160,12 +160,12 @@ GaryScript5: ; 7601a (1d:601a)  GaryScript6: ; 76047 (1d:6047)  	ld a, $2 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	ld a, SPRITE_FACING_RIGHT -	ld [$ff8d], a -	call SetSpriteFacingDirectionAndDelay ; face object +	ld [hSpriteFacingDirection], a +	call SetSpriteFacingDirectionAndDelay  	ld a, $4 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call GaryScript_760c8  	ld a, $7  	ld [W_GARYCURSCRIPT], a @@ -173,16 +173,16 @@ GaryScript6: ; 76047 (1d:6047)  GaryScript7: ; 7605f (1d:605f)  	ld a, $2 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	xor a ; SPRITE_FACING_DOWN -	ld [$ff8d], a -	call SetSpriteFacingDirectionAndDelay ; face object +	ld [hSpriteFacingDirection], a +	call SetSpriteFacingDirectionAndDelay  	ld a, $5 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call GaryScript_760c8  	ld de, MovementData_76080  	ld a, $2 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	call MoveSprite  	ld a, $8  	ld [W_GARYCURSCRIPT], a diff --git a/scripts/halloffameroom.asm b/scripts/halloffameroom.asm index cb2c1fad..680ebdd9 100755 --- a/scripts/halloffameroom.asm +++ b/scripts/halloffameroom.asm @@ -83,10 +83,10 @@ HallofFameRoomScript1: ; 5a52b (16:652b)  	ld a, $1  	ld [wd528], a  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	call SetSpriteMovementBytesToFF -	ld a, SPRITE_FACING_LEFT -	ld [$ff8d], a +	ld a, $8 +	ld [hSpriteFacingDirection], a  	call SetSpriteFacingDirectionAndDelay  	call Delay3  	xor a @@ -94,7 +94,7 @@ HallofFameRoomScript1: ; 5a52b (16:652b)  	inc a  	ld [wd528], a  	ld a, $1 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, $ff  	ld [wJoyIgnore], a diff --git a/scripts/lance.asm b/scripts/lance.asm index c11bec2f..e335914b 100755 --- a/scripts/lance.asm +++ b/scripts/lance.asm @@ -64,7 +64,7 @@ LanceScript0: ; 5a305 (16:6305)  	cp $3  	jr nc, .asm_5a325  	ld a, $1 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	jp DisplayTextID  .asm_5a325  	cp $5 @@ -93,7 +93,7 @@ LanceScript2: ; 5a349 (16:6349)  	cp $ff  	jp z, LanceScript_5a2f5  	ld a, $1 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	jp DisplayTextID  LanceScript_5a35b: ; 5a35b (16:635b) diff --git a/scripts/lorelei.asm b/scripts/lorelei.asm index 7e800467..1f1fcde0 100755 --- a/scripts/lorelei.asm +++ b/scripts/lorelei.asm @@ -77,7 +77,7 @@ LoreleiScript0: ; 761e2 (1d:61e2)  	jr z, LoreleiScript_761c6  .asm_76206  	ld a, $2 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, D_UP  	ld [wSimulatedJoypadStatesEnd], a @@ -112,7 +112,7 @@ LoreleiScript2: ; 7623f (1d:623f)  	cp $ff  	jp z, LoreleiScript_761b6  	ld a, $1 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	jp DisplayTextID  LoreleiTextPointers: ; 76251 (1d:6251) diff --git a/scripts/mansion1.asm b/scripts/mansion1.asm index d658b425..6673e03b 100755 --- a/scripts/mansion1.asm +++ b/scripts/mansion1.asm @@ -53,7 +53,7 @@ Mansion1Script_Switches: ; 44316 (11:4316)  	xor a  	ld [hJoyHeld], a  	ld a, $4 -	ld [H_SPRITEHEIGHT], a +	ld [hSpriteIndexOrTextID], a  	jp DisplayTextID  Mansion1ScriptPointers: ; 44326 (11:4326) @@ -63,8 +63,8 @@ Mansion1ScriptPointers: ; 44326 (11:4326)  Mansion1TextPointers: ; 4432c (11:432c)  	dw Mansion1Text1 -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText  	dw Mansion1Text4  Mansion1TrainerHeaders: ; 44334 (11:4334) diff --git a/scripts/mansion2.asm b/scripts/mansion2.asm index 40827be1..27ccbdfb 100755 --- a/scripts/mansion2.asm +++ b/scripts/mansion2.asm @@ -49,7 +49,7 @@ Mansion2Script_Switches: ; 52037 (14:6037)  	xor a  	ld [hJoyHeld], a  	ld a, $5 -	ld [H_SPRITEHEIGHT], a +	ld [hSpriteIndexOrTextID], a  	jp DisplayTextID  Mansion2ScriptPointers: ; 52047 (14:6047) @@ -59,7 +59,7 @@ Mansion2ScriptPointers: ; 52047 (14:6047)  Mansion2TextPointers: ; 5204d (14:604d)  	dw Mansion2Text1 -	dw Predef5CText +	dw PickUpItemText  	dw Mansion2Text3  	dw Mansion2Text4  	dw Mansion2Text5 diff --git a/scripts/mansion3.asm b/scripts/mansion3.asm index dfecde99..fa31718f 100755 --- a/scripts/mansion3.asm +++ b/scripts/mansion3.asm @@ -80,14 +80,14 @@ Mansion3Script_Switches: ; 5227a (14:627a)  	xor a  	ld [hJoyHeld], a  	ld a, $6 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	jp DisplayTextID  Mansion3TextPointers: ; 5228a (14:628a)  	dw Mansion3Text1  	dw Mansion3Text2 -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText  	dw Mansion3Text5  	dw Mansion3Text6 diff --git a/scripts/mansion4.asm b/scripts/mansion4.asm index c23cb2d7..68e74fd5 100755 --- a/scripts/mansion4.asm +++ b/scripts/mansion4.asm @@ -51,7 +51,7 @@ Mansion4Script_Switches: ; 52420 (14:6420)  	xor a  	ld [hJoyHeld], a  	ld a, $9 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	jp DisplayTextID  Mansion4ScriptPointers: ; 52430 (14:6430) @@ -62,12 +62,12 @@ Mansion4ScriptPointers: ; 52430 (14:6430)  Mansion4TextPointers: ; 52436 (14:6436)  	dw Mansion4Text1  	dw Mansion4Text2 -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText  	dw Mansion4Text7 -	dw Predef5CText +	dw PickUpItemText  	dw Mansion3Text6  Mansion4TrainerHeaders: ; 52448 (14:6448) diff --git a/scripts/mtmoon1.asm b/scripts/mtmoon1.asm index 6c9fcd88..868b70d1 100755 --- a/scripts/mtmoon1.asm +++ b/scripts/mtmoon1.asm @@ -20,12 +20,12 @@ MtMoon1TextPointers: ; 499e1 (12:59e1)  	dw MtMoon1Text5  	dw MtMoon1Text6  	dw MtMoon1Text7 -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText  	dw MtMoon1Text14  MtMoon1TrainerHeaders: ; 499fd (12:59fd) diff --git a/scripts/mtmoon3.asm b/scripts/mtmoon3.asm index 7c6e987e..ee163738 100755 --- a/scripts/mtmoon3.asm +++ b/scripts/mtmoon3.asm @@ -66,7 +66,7 @@ MtMoon3Script0: ; 49d6f (12:5d6f)  	xor a  	ld [hJoyHeld], a  	ld a, $1 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	jp DisplayTextID  MtMoon3Script_49d91: ; 49d91 (12:5d91) @@ -92,7 +92,7 @@ MtMoon3Script3: ; 49d9a (12:5d9a)  MtMoon3Script4: ; 49dba (12:5dba)  	ld a, $1 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [H_SPRITEINDEX], a  	call SetSpriteMovementBytesToFF  	ld hl, CoordsData_49dea  	call ArePlayerCoordsInArray @@ -106,7 +106,7 @@ MtMoon3Script4: ; 49dba (12:5dba)  	ld de, MovementData_49df8  .asm_49dda  	ld a, $1 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [H_SPRITEINDEX], a  	call MoveSprite  	ld a, $5  	ld [W_MTMOON3CURSCRIPT], a @@ -140,7 +140,7 @@ MtMoon3Script5: ; 49dfb (12:5dfb)  	ld a, $1  	ld [wDoNotWaitForButtonPressAfterDisplayingText], a  	ld a, $a -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, [wd7f6]  	bit 6, a @@ -167,8 +167,8 @@ MtMoon3TextPointers: ; 49e34 (12:5e34)  	dw MtMoon3Text5  	dw MtMoon3Text6  	dw MtMoon3Text7 -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText  	dw MtMoon3Text_49f99  MtMoon3TrainerHeaders: ; 49e48 (12:5e48) diff --git a/scripts/museum1f.asm b/scripts/museum1f.asm index 26c7f02d..38c3f717 100755 --- a/scripts/museum1f.asm +++ b/scripts/museum1f.asm @@ -25,7 +25,7 @@ Museum1FScript0: ; 5c10d (17:410d)  	xor a  	ld [hJoyHeld], a  	ld a, $1 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	jp DisplayTextID  Museum1FScript1: ; 5c12a (17:412a) @@ -69,7 +69,7 @@ Museum1FText1: ; 5c135 (17:4135)  	call PrintText  	jp Museum1FScriptEnd  .asm_3ded4 -	ld a, $13 +	ld a, MONEY_BOX  	ld [wTextBoxID], a  	call DisplayTextBoxID  	xor a @@ -96,15 +96,15 @@ Museum1FText1: ; 5c135 (17:4135)  	ld hl, wd754  	set 0, [hl]  	xor a -	ld [wWhichTrade], a -	ld [wTrainerEngageDistance], a +	ld [wMuseumPriceTemp], a +	ld [wMuseumPriceTemp + 1], a  	ld a, $50 -	ld [wTrainerFacingDirection], a -	ld hl, wTrainerFacingDirection +	ld [wMuseumPriceTemp + 2], a +	ld hl, wMuseumPriceTemp + 2  	ld de, wPlayerMoney + 2  	ld c, $3  	predef SubBCDPredef -	ld a, $13 +	ld a, MONEY_BOX  	ld [wTextBoxID], a  	call DisplayTextBoxID  	ld a, (SFX_02_5a - SFX_Headers_02) / 3 diff --git a/scripts/oakslab.asm b/scripts/oakslab.asm index 992b6887..5463b879 100755 --- a/scripts/oakslab.asm +++ b/scripts/oakslab.asm @@ -89,13 +89,13 @@ OaksLabScript3: ; 1cba2 (7:4ba2)  	call StartSimulatingJoypadStates  	ld a, $1  	ld [H_SPRITEINDEX], a -	xor a ; SPRITE_FACING_DOWN -	ld [$ff8d], a +	xor a +	ld [hSpriteFacingDirection], a  	call SetSpriteFacingDirectionAndDelay  	ld a, $5  	ld [H_SPRITEINDEX], a -	xor a ; SPRITE_FACING_DOWN -	ld [$ff8d], a +	xor a +	ld [hSpriteFacingDirection], a  	call SetSpriteFacingDirectionAndDelay  	ld a, $4 @@ -117,7 +117,7 @@ OaksLabScript4: ; 1cbd2 (7:4bd2)  	ld a, $1  	ld [H_SPRITEINDEX], a  	ld a, SPRITE_FACING_UP -	ld [$ff8d], a +	ld [hSpriteFacingDirection], a  	call SetSpriteFacingDirectionAndDelay  	call UpdateSprites  	ld hl, W_FLAGS_D733 @@ -132,19 +132,19 @@ OaksLabScript5: ; 1cbfd (7:4bfd)  	ld a, $fc  	ld [wJoyIgnore], a  	ld a, $11 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	call Delay3  	ld a, $12 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	call Delay3  	ld a, $13 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	call Delay3  	ld a, $14 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd74b  	set 1, [hl] @@ -162,16 +162,16 @@ OaksLabScript6: ; 1cc36 (7:4c36)  	ld a, $5  	ld [H_SPRITEINDEX], a  	xor a ; SPRITE_FACING_DOWN -	ld [$ff8d], a +	ld [hSpriteFacingDirection], a  	call SetSpriteFacingDirectionAndDelay  	ld a, $1  	ld [H_SPRITEINDEX], a  	xor a -	ld [$ff8d], a +	ld [hSpriteFacingDirection], a  	call SetSpriteFacingDirectionAndDelay  	call UpdateSprites  	ld a, $c -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, $1  	ld [wSimulatedJoypadStatesIndex], a @@ -261,7 +261,7 @@ OaksLabScript8: ; 1cc80 (7:4c80)  	ld a, $1  	ld [H_SPRITEINDEX], a  	ld a, $4 -	ld [$ff8b], a +	ld [H_SPRITEDATAOFFSET], a  	call GetPointerWithinSpriteStateData1  	push hl  	ld [hl], $4c @@ -302,10 +302,10 @@ OaksLabScript9: ; 1cd00 (7:4d00)  	ld a, $1  	ld [H_SPRITEINDEX], a  	ld a, SPRITE_FACING_UP -	ld [$ff8d], a +	ld [hSpriteFacingDirection], a  	call SetSpriteFacingDirectionAndDelay  	ld a, $d -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, [wTrainerEngageDistance]  	cp $2 @@ -331,10 +331,10 @@ OaksLabScript9: ; 1cd00 (7:4d00)  	ld a, $1  	ld [H_SPRITEINDEX], a  	ld a, SPRITE_FACING_UP -	ld [$ff8d], a +	ld [hSpriteFacingDirection], a  	call SetSpriteFacingDirectionAndDelay  	ld a, $e -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd74b  	set 2, [hl] @@ -352,7 +352,7 @@ OaksLabScript10: ; 1cd6d (7:4d6d)  	ld a, $1  	ld [H_SPRITEINDEX], a  	xor a ; SPRITE_FACING_DOWN -	ld [$ff8d], a +	ld [hSpriteFacingDirection], a  	call SetSpriteFacingDirectionAndDelay  	ld a, $8  	ld [wd528], a @@ -360,7 +360,7 @@ OaksLabScript10: ; 1cd6d (7:4d6d)  	ld a, MUSIC_MEET_RIVAL  	call PlayMusic  	ld a, $f -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, $1  	ld [hNPCPlayerRelativePosPerspective], a @@ -432,7 +432,7 @@ OaksLabScript12: ; 1ce03 (7:4e03)  	ld a, $1  	ld [H_SPRITEINDEX], a  	xor a ; SPRITE_FACING_DOWN -	ld [$ff8d], a +	ld [hSpriteFacingDirection], a  	call SetSpriteFacingDirectionAndDelay  	predef HealParty  	ld hl, wd74b @@ -446,7 +446,7 @@ OaksLabScript13: ; 1ce32 (7:4e32)  	ld c, 20  	call DelayFrames  	ld a, $10 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	callba Music_RivalAlternateStart  	ld a, $1 @@ -522,7 +522,7 @@ OaksLabScript15: ; 1ceb0 (7:4eb0)  	call PlaySound  	callba Music_RivalAlternateStart  	ld a, $15 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	call OaksLabScript_1d02b  	ld a, HS_OAKS_LAB_RIVAL @@ -549,12 +549,12 @@ OaksLabScript_1cefd: ; 1cefd (7:4efd)  	ld a, $1  	ld [H_SPRITEINDEX], a  	ld a, SPRITE_FACING_UP -	ld [$ff8d], a +	ld [hSpriteFacingDirection], a  	call SetSpriteFacingDirectionAndDelay  	ld a, $8  	ld [H_SPRITEINDEX], a  	xor a ; SPRITE_FACING_DOWN -	ld [$ff8d], a +	ld [hSpriteFacingDirection], a  	jp SetSpriteFacingDirectionAndDelay  OaksLabScript16: ; 1cf12 (7:4f12) @@ -567,21 +567,21 @@ OaksLabScript16: ; 1cf12 (7:4f12)  	ld [wJoyIgnore], a  	call OaksLabScript_1cefd  	ld a, $16 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	call DelayFrame  	call OaksLabScript_1cefd  	ld a, $17 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	call DelayFrame  	call OaksLabScript_1cefd  	ld a, $18 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	call DelayFrame  	ld a, $19 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	call Delay3  	ld a, HS_POKEDEX_1 @@ -592,16 +592,16 @@ OaksLabScript16: ; 1cf12 (7:4f12)  	predef HideObject  	call OaksLabScript_1cefd  	ld a, $1a -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, $1  	ld [H_SPRITEINDEX], a  	ld a, SPRITE_FACING_RIGHT -	ld [$ff8d], a +	ld [hSpriteFacingDirection], a  	call SetSpriteFacingDirectionAndDelay  	call Delay3  	ld a, $1b -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd74b  	set 5, [hl] @@ -856,13 +856,13 @@ OaksLabScript_1d157: ; 1d157 (7:5157)  	ld a, $5  	ld [H_SPRITEINDEX], a  	ld a, $9 -	ld [$ff8b], a +	ld [H_SPRITEDATAOFFSET], a  	call GetPointerWithinSpriteStateData1  	ld [hl], $0  	ld a, $1  	ld [H_SPRITEINDEX], a  	ld a, $9 -	ld [$ff8b], a +	ld [H_SPRITEDATAOFFSET], a  	call GetPointerWithinSpriteStateData1  	ld [hl], $c  	ld hl, wd730 @@ -962,7 +962,7 @@ OaksLabScript_1d22d: ; 1d22d (7:522d)  	ld a, $5  	ld [H_SPRITEINDEX], a  	ld a, $9 -	ld [$ff8b], a +	ld [H_SPRITEDATAOFFSET], a  	call GetPointerWithinSpriteStateData1  	ld [hl], $0  	ld hl, OaksLabLastMonText diff --git a/scripts/pallettown.asm b/scripts/pallettown.asm index 5b042066..327a32ff 100755 --- a/scripts/pallettown.asm +++ b/scripts/pallettown.asm @@ -67,7 +67,7 @@ PalletTownScript2: ; 18ed2 (6:4ed2)  	ld a,1  	ld [H_SPRITEINDEX],a  	ld a,SPRITE_FACING_UP -	ld [$FF8D],a +	ld [hSpriteFacingDirection],a  	call SetSpriteFacingDirectionAndDelay  	call Delay3  	ld a,1 diff --git a/scripts/pewtercity.asm b/scripts/pewtercity.asm index 460eab5c..94d23caa 100755 --- a/scripts/pewtercity.asm +++ b/scripts/pewtercity.asm @@ -31,7 +31,7 @@ PewterCityScript_1925e: ; 1925e (6:525e)  	ld a, $f0  	ld [wJoyIgnore], a  	ld a, $5 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	jp DisplayTextID  CoordsData_19277: ; 19277 (6:5277) @@ -48,16 +48,16 @@ PewterCityScript1: ; 19280 (6:5280)  	ld a, $3  	ld [H_SPRITEINDEX], a  	ld a, SPRITE_FACING_UP -	ld [$ff8d], a +	ld [hSpriteFacingDirection], a  	call SetSpriteFacingDirectionAndDelay  	ld a, ($3 << 4) | SPRITE_FACING_UP -	ld [$ff8d], a +	ld [hSpriteImageIndex], a  	call SetSpriteImageIndexAfterSettingFacingDirection  	call PlayDefaultMusic  	ld hl, wFlags_0xcd60  	set 4, [hl]  	ld a, $d -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, $3c  	ld [$ffeb], a @@ -71,7 +71,7 @@ PewterCityScript1: ; 19280 (6:5280)  	ld [wSpriteIndex], a  	call SetSpritePosition1  	ld a, $3 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	ld de, MovementData_PewterMuseumGuyExit  	call MoveSprite  	ld a, $2 @@ -114,18 +114,18 @@ PewterCityScript4: ; 19305 (6:5305)  	and a  	ret nz  	ld a, $5 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	ld a, SPRITE_FACING_LEFT -	ld [$ff8d], a +	ld [hSpriteFacingDirection], a  	call SetSpriteFacingDirectionAndDelay  	ld a, ($1 << 4) | SPRITE_FACING_LEFT -	ld [$ff8d], a +	ld [hSpriteImageIndex], a  	call SetSpriteImageIndexAfterSettingFacingDirection  	call PlayDefaultMusic  	ld hl, wFlags_0xcd60  	set 4, [hl]  	ld a, $e -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, $3c  	ld [$ffeb], a @@ -139,7 +139,7 @@ PewterCityScript4: ; 19305 (6:5305)  	ld [wSpriteIndex], a  	call SetSpritePosition1  	ld a, $5 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	ld de, MovementData_PewterGymGuyExit  	call MoveSprite  	ld a, $5 diff --git a/scripts/pewtergym.asm b/scripts/pewtergym.asm index f4b2ad28..9f1493d4 100755 --- a/scripts/pewtergym.asm +++ b/scripts/pewtergym.asm @@ -44,7 +44,7 @@ PewterGymScript3: ; 5c3d2 (17:43d2)  PewterGymScript_5c3df: ; 5c3df (17:43df)  	ld a, $4 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd755  	set 7, [hl] @@ -52,14 +52,14 @@ PewterGymScript_5c3df: ; 5c3df (17:43df)  	call GiveItem  	jr nc, .BagFull  	ld a, $5 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd755  	set 6, [hl]  	jr .asm_5c408  .BagFull  	ld a, $6 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  .asm_5c408  	ld hl, W_OBTAINEDBADGES diff --git a/scripts/pokemontower2.asm b/scripts/pokemontower2.asm index 286b8202..8520b10b 100755 --- a/scripts/pokemontower2.asm +++ b/scripts/pokemontower2.asm @@ -31,7 +31,7 @@ PokemonTower2Script0: ; 6050f (18:450f)  	call PlayMusic  	ld hl, wd764  	res 6, [hl] -	ld a, [wWhichTrade] +	ld a, [wCoordIndex]  	cp $1  	ld a, $8  	ld b, SPRITE_FACING_DOWN @@ -43,12 +43,12 @@ PokemonTower2Script0: ; 6050f (18:450f)  .asm_60544  	ld [wd528], a  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	ld a, b -	ld [$ff8d], a +	ld [hSpriteFacingDirection], a  	call SetSpriteFacingDirectionAndDelay  	ld a, $1 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	xor a  	ld [hJoyHeld], a @@ -69,7 +69,7 @@ PokemonTower2Script1: ; 60563 (18:4563)  	ld hl, wd764  	set 7, [hl]  	ld a, $1 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld de, MovementData_605b2  	ld a, [wd764] @@ -78,7 +78,7 @@ PokemonTower2Script1: ; 60563 (18:4563)  	ld de, MovementData_605a9  .asm_60589  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	call MoveSprite  	ld a, $ff  	ld [wc0ee], a diff --git a/scripts/pokemontower3.asm b/scripts/pokemontower3.asm index 2cf58381..9d08aec4 100755 --- a/scripts/pokemontower3.asm +++ b/scripts/pokemontower3.asm @@ -16,7 +16,7 @@ PokemonTower3TextPointers: ; 606e5 (18:46e5)  	dw PokemonTower3Text1  	dw PokemonTower3Text2  	dw PokemonTower3Text3 -	dw Predef5CText +	dw PickUpItemText  PokemonTower3TrainerHeaders: ; 606ed (18:46ed)  PokemonTower3TrainerHeader0: ; 606ed (18:46ed) diff --git a/scripts/pokemontower4.asm b/scripts/pokemontower4.asm index 4f375657..c4732397 100755 --- a/scripts/pokemontower4.asm +++ b/scripts/pokemontower4.asm @@ -16,9 +16,9 @@ PokemonTower4TextPointers: ; 6080f (18:480f)  	dw PokemonTower4Text1  	dw PokemonTower4Text2  	dw PokemonTower4Text3 -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText  PokemonTower4TrainerHeaders: ; 6081b (18:481b)  PokemonTower4TrainerHeader0: ; 6081b (18:481b) diff --git a/scripts/pokemontower5.asm b/scripts/pokemontower5.asm index 34dd3204..9ef5d419 100755 --- a/scripts/pokemontower5.asm +++ b/scripts/pokemontower5.asm @@ -38,7 +38,7 @@ PokemonTower5Script0: ; 6094b (18:494b)  	call Delay3  	call GBFadeInFromWhite  	ld a, $7 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	xor a  	ld [wJoyIgnore], a @@ -57,7 +57,7 @@ PokemonTower5TextPointers: ; 6099b (18:499b)  	dw PokemonTower5Text3  	dw PokemonTower5Text4  	dw PokemonTower5Text5 -	dw Predef5CText +	dw PickUpItemText  	dw PokemonTower5Text7  PokemonTower5TrainerHeaders: ; 609a9 (18:49a9) diff --git a/scripts/pokemontower6.asm b/scripts/pokemontower6.asm index e0e75cb1..e9412fb0 100755 --- a/scripts/pokemontower6.asm +++ b/scripts/pokemontower6.asm @@ -31,7 +31,7 @@ PokemonTower6Script0: ; 60b17 (18:4b17)  	xor a  	ld [hJoyHeld], a  	ld a, $6 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, MAROWAK  	ld [W_CUROPPONENT], a @@ -63,7 +63,7 @@ PokemonTower6Script4: ; 60b48 (18:4b48)  	ld hl, wd768  	set 7, [hl]  	ld a, $7 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	xor a  	ld [wJoyIgnore], a @@ -100,8 +100,8 @@ PokemonTower6TextPointers: ; 60bb1 (18:4bb1)  	dw PokemonTower6Text1  	dw PokemonTower6Text2  	dw PokemonTower6Text3 -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText  	dw PokemonTower6Text6  	dw PokemonTower6Text7 diff --git a/scripts/pokemontower7.asm b/scripts/pokemontower7.asm index 0f9741ab..60635f20 100755 --- a/scripts/pokemontower7.asm +++ b/scripts/pokemontower7.asm @@ -31,7 +31,7 @@ PokemonTower7Script2: ; 60d23 (18:4d23)  	ld a, $f0  	ld [wJoyIgnore], a  	ld a, [wSpriteIndex] -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	call PokemonTower7Script_60db6  	ld a, $3 @@ -72,7 +72,7 @@ PokemonTower7Script4: ; 60d86 (18:4d86)  	ld a, SPRITE_FACING_UP  	ld [wSpriteStateData1 + 9], a  	ld a, LAVENDER_HOUSE_1 -	ld [H_DOWNARROWBLINKCNT1], a +	ld [hWarpDestinationMap], a  	ld a, $1  	ld [wDestinationWarpID], a  	ld a, LAVENDER_TOWN @@ -107,7 +107,7 @@ PokemonTower7Script_60db6: ; 60db6 (18:4db6)  	ld d, [hl]  	ld e, a  	ld a, [wSpriteIndex] -	ld [H_DOWNARROWBLINKCNT2], a +	ld [H_SPRITEINDEX], a  	jp MoveSprite  .asm_60dde  	inc hl diff --git a/scripts/powerplant.asm b/scripts/powerplant.asm index 25597654..0026d525 100755 --- a/scripts/powerplant.asm +++ b/scripts/powerplant.asm @@ -22,11 +22,11 @@ PowerPlantTextPointers: ; 1e2df (7:62df)  	dw PowerPlantText7  	dw PowerPlantText8  	dw PowerPlantText9 -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText  PowerPlantTrainerHeaders: ; 1e2fb (7:62fb)  PowerPlantTrainerHeader0: ; 1e2fb (7:62fb) diff --git a/scripts/rockethideout1.asm b/scripts/rockethideout1.asm index fe5a47e6..967ab77b 100755 --- a/scripts/rockethideout1.asm +++ b/scripts/rockethideout1.asm @@ -43,8 +43,8 @@ RocketHideout1TextPointers: ; 44c14 (11:4c14)  	dw RocketHideout1Text3  	dw RocketHideout1Text4  	dw RocketHideout1Text5 -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText  RocketHideout1TrainerHeaders: ; 44c22 (11:4c22)  RocketHideout1TrainerHeader0: ; 44c22 (11:4c22) diff --git a/scripts/rockethideout2.asm b/scripts/rockethideout2.asm index bb4dd3ec..c2184bdb 100755 --- a/scripts/rockethideout2.asm +++ b/scripts/rockethideout2.asm @@ -415,10 +415,10 @@ SpinnerArrowAnimTiles: ; 45087 (11:5087)  RocketHideout2TextPointers: ; 450c7 (11:50c7)  	dw RocketHideout2Text1 -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText  RocketHideout2TrainerHeaders: ; 450d1 (11:50d1)  RocketHideout2TrainerHeader0: ; 450d1 (11:50d1) diff --git a/scripts/rockethideout3.asm b/scripts/rockethideout3.asm index f2f7ed91..b025acd0 100755 --- a/scripts/rockethideout3.asm +++ b/scripts/rockethideout3.asm @@ -146,8 +146,8 @@ RocketHideout3Script3: ; 452e4 (11:452e4)  RocketHideout3TextPointers: ; 452fa (11:52fa)  	dw RocketHideout3Text1  	dw RocketHideout3Text2 -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText  RocketHideout3TrainerHeaders: ; 45302 (11:5302)  RocketHideout3TrainerHeader0: ; 45302 (11:5302) diff --git a/scripts/rockethideout4.asm b/scripts/rockethideout4.asm index 613e2476..635c6095 100755 --- a/scripts/rockethideout4.asm +++ b/scripts/rockethideout4.asm @@ -56,7 +56,7 @@ RocketHideout4Script3: ; 454b6 (11:54b6)  	ld hl, wd81b  	set 7, [hl]  	ld a, $a -	ld [H_SPRITEHEIGHT], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	call GBFadeOutToBlack  	ld a, HS_ROCKET_HIDEOUT_4_GIOVANNI @@ -81,11 +81,11 @@ RocketHideout4TextPointers: ; 45501 (11:5501)  	dw RocketHideout4Text2  	dw RocketHideout4Text3  	dw RocketHideout4Text4 -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText  	dw RocketHideout4Text10  RocketHideout4TrainerHeaders: ; 45515 (11:5515) diff --git a/scripts/route12.asm b/scripts/route12.asm index eed676b3..8fe9d8f7 100755 --- a/scripts/route12.asm +++ b/scripts/route12.asm @@ -28,7 +28,7 @@ Route12Script0: ; 59619 (16:5619)  	res 6, [hl]  	jp z, CheckFightingMapTrainers  	ld a, $d -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, SNORLAX  	ld [W_CUROPPONENT], a @@ -51,7 +51,7 @@ Route12Script3: ; 5964c (16:564c)  	cp $2  	jr z, .asm_59664  	ld a, $e -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  .asm_59664  	ld hl, wd7d8 @@ -71,8 +71,8 @@ Route12TextPointers: ; 59675 (16:5675)  	dw Route12Text6  	dw Route12Text7  	dw Route12Text8 -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText  	dw Route12Text11  	dw Route12Text12  	dw Route12Text13 diff --git a/scripts/route15.asm b/scripts/route15.asm index 3aa23bbb..fe70d2b4 100755 --- a/scripts/route15.asm +++ b/scripts/route15.asm @@ -23,7 +23,7 @@ Route15TextPointers: ; 597c7 (16:57c7)  	dw Route15Text8  	dw Route15Text9  	dw Route15Text10 -	dw Predef5CText +	dw PickUpItemText  	dw Route15Text12  Route15TrainerHeaders: ; 597df (16:57df) diff --git a/scripts/route16.asm b/scripts/route16.asm index b6c49a96..cdf436a5 100755 --- a/scripts/route16.asm +++ b/scripts/route16.asm @@ -28,7 +28,7 @@ Route16Script0: ; 59959 (16:5959)  	res 0, [hl]  	jp z, CheckFightingMapTrainers  	ld a, $a -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, SNORLAX  	ld [W_CUROPPONENT], a @@ -52,7 +52,7 @@ Route16Script3: ; 5998f (16:598f)  	cp $2  	jr z, .asm_599a8  	ld a, $b -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  .asm_599a8  	ld hl, wd7e0 diff --git a/scripts/route16gate.asm b/scripts/route16gate.asm index 8e3d8e5b..801e577e 100755 --- a/scripts/route16gate.asm +++ b/scripts/route16gate.asm @@ -19,14 +19,14 @@ Route16GateScript0: ; 496d7 (12:56d7)  	call ArePlayerCoordsInArray  	ret nc  	ld a, $3 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	xor a  	ld [hJoyHeld], a -	ld a, [wWhichTrade] +	ld a, [wCoordIndex]  	cp $1  	jr z, .asm_4970e -	ld a, [wWhichTrade] +	ld a, [wCoordIndex]  	dec a  	ld [wSimulatedJoypadStatesIndex], a  	ld b, $0 @@ -59,7 +59,7 @@ Route16GateScript1: ; 4971d (12:571d)  Route16GateScript2: ; 49727 (12:5727)  	ld a, $1 -	ld [H_SPRITEHEIGHT], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, $1  	ld [wSimulatedJoypadStatesIndex], a diff --git a/scripts/route18gate.asm b/scripts/route18gate.asm index 0301327b..060a6bbf 100755 --- a/scripts/route18gate.asm +++ b/scripts/route18gate.asm @@ -19,17 +19,17 @@ Route18GateScript0: ; 4988f (12:588f)  	call ArePlayerCoordsInArray  	ret nc  	ld a, $2 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	xor a  	ld [hJoyHeld], a -	ld a, [wWhichTrade] +	ld a, [wCoordIndex]  	cp $1  	jr z, .asm_498c6 -	ld a, [wWhichTrade] +	ld a, [wCoordIndex]  	dec a  	ld [wSimulatedJoypadStatesIndex], a -	ld b, $0 +	ld b, 0  	ld c, a  	ld a, D_UP  	ld hl, wSimulatedJoypadStatesEnd @@ -59,7 +59,7 @@ Route18GateScript1: ; 498d5 (12:58d5)  Route18GateScript2: ; 498df (12:58df)  	ld a, $1 -	ld [H_SPRITEHEIGHT], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, $1  	ld [wSimulatedJoypadStatesIndex], a diff --git a/scripts/route2.asm b/scripts/route2.asm index fdc5eb6c..62ef3050 100755 --- a/scripts/route2.asm +++ b/scripts/route2.asm @@ -2,8 +2,8 @@ Route2Script: ; 554e3 (15:54e3)  	jp EnableAutoTextBoxDrawing  Route2TextPointers: ; 554e6 (15:54e6) -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText  	dw Route2Text3  	dw Route2Text4 diff --git a/scripts/route22.asm b/scripts/route22.asm index 84fb5634..f125030e 100755 --- a/scripts/route22.asm +++ b/scripts/route22.asm @@ -43,8 +43,8 @@ Route22MoveRivalSprite: ; 50ee6 (14:4ee6)  	inc de  .asm_50ef1  	call MoveSprite -	ld a, $c -	ld [$ff8d], a +	ld a, SPRITE_FACING_RIGHT +	ld [hSpriteFacingDirection], a  	jp SetSpriteFacingDirectionAndDelay  Route22RivalMovementData: ; 50efb (14:4efb) @@ -61,7 +61,7 @@ Route22Script0: ; 50f00 (14:4f00)  	ld hl, .Route22RivalBattleCoords  	call ArePlayerCoordsInArray  	ret nc -	ld a, [wWhichTrade] +	ld a, [wCoordIndex]  	ld [wcf0d], a  	xor a  	ld [hJoyHeld], a @@ -98,7 +98,7 @@ Route22Script0: ; 50f00 (14:4f00)  	ld a, MUSIC_MEET_RIVAL  	call PlayMusic  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	call Route22MoveRivalSprite  	ld a, $1  	ld [W_ROUTE22CURSCRIPT], a @@ -113,19 +113,19 @@ Route22Script1: ; 50f62 (14:4f62)  	jr nz, .asm_50f78  	ld a, $4  	ld [wd528], a -	ld a, $4 +	ld a, SPRITE_FACING_UP  	jr .asm_50f7a  .asm_50f78 -	ld a, $c +	ld a, SPRITE_FACING_RIGHT  .asm_50f7a -	ld [$ff8d], a +	ld [hSpriteFacingDirection], a  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	call SetSpriteFacingDirectionAndDelay  	xor a  	ld [wJoyIgnore], a  	ld a, $1 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd72d  	set 6, [hl] @@ -159,16 +159,16 @@ Route22Script2: ; 50fb5 (14:4fb5)  .notDown  	ld a, SPRITE_FACING_RIGHT  .done -	ld [$ff8d], a +	ld [hSpriteFacingDirection], a  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	call SetSpriteFacingDirectionAndDelay  	ld a, $f0  	ld [wJoyIgnore], a  	ld hl, wd7eb  	set 5, [hl]  	ld a, $1 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, $ff  	ld [wc0ee], a @@ -194,7 +194,7 @@ Route22Script_5100d: ; 5100d (14:500d)  	ld de, Route22RivalExitMovementData2  Route22MoveRival1: ; 51010 (14:5010)  	ld a, $1 -	ld [H_SPRITEHEIGHT], a +	ld [H_SPRITEINDEX], a  	jp MoveSprite  Route22RivalExitMovementData1: ; 51017 (14:5017) @@ -255,7 +255,7 @@ Route22Script_5104e: ; 5104e (14:504e)  	call PlaySound  	callba Music_RivalAlternateTempo  	ld a, $2 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [H_SPRITEINDEX], a  	call Route22MoveRivalSprite  	ld a, $4  	ld [W_ROUTE22CURSCRIPT], a @@ -266,25 +266,25 @@ Route22Script4: ; 51087 (14:5087)  	bit 0, a  	ret nz  	ld a, $2 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [H_SPRITEINDEX], a  	ld a, [wcf0d]  	cp $1  	jr nz, .asm_510a1  	ld a, $4  	ld [wd528], a -	ld a, $4 +	ld a, SPRITE_FACING_UP  	jr .asm_510a8  .asm_510a1  	ld a, $2  	ld [wd528], a -	ld a, $c +	ld a, SPRITE_FACING_RIGHT  .asm_510a8 -	ld [$ff8d], a +	ld [hSpriteFacingDirection], a  	call SetSpriteFacingDirectionAndDelay  	xor a  	ld [wJoyIgnore], a  	ld a, $2 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd72d  	set 6, [hl] @@ -310,27 +310,27 @@ Route22Script5: ; 510df (14:50df)  	cp $ff  	jp z, Route22Script_50ece  	ld a, $2 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [H_SPRITEINDEX], a  	ld a, [wcf0d]  	cp $1  	jr nz, .asm_510fb  	ld a, $4  	ld [wd528], a -	ld a, $4 +	ld a, SPRITE_FACING_UP  	jr .asm_51102  .asm_510fb  	ld a, $2  	ld [wd528], a -	ld a, $c +	ld a, SPRITE_FACING_RIGHT  .asm_51102 -	ld [$ff8d], a +	ld [hSpriteFacingDirection], a  	call SetSpriteFacingDirectionAndDelay  	ld a, $f0  	ld [wJoyIgnore], a  	ld hl, wd7eb  	set 6, [hl]  	ld a, $2 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, $ff  	ld [wc0ee], a @@ -356,7 +356,7 @@ Route22Script_51142: ; 51142 (14:5142)  	ld de, MovementData_5114d  Route22MoveRival2: ; 51145 (14:5145)  	ld a, $2 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [H_SPRITEINDEX], a  	jp MoveSprite  MovementData_5114c: ; 5114c (14:514c) diff --git a/scripts/route22gate.asm b/scripts/route22gate.asm index 513a106b..8b24c820 100755 --- a/scripts/route22gate.asm +++ b/scripts/route22gate.asm @@ -24,7 +24,7 @@ Route22GateScript0: ; 1e6a4 (7:66a4)  	xor a  	ld [hJoyHeld], a  	ld a, $1 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	jp DisplayTextID  Route22GateScriptCoords: ; 1e6b5 (7:66b5) diff --git a/scripts/route23.asm b/scripts/route23.asm index 5ed038c2..eeaf2a2b 100755 --- a/scripts/route23.asm +++ b/scripts/route23.asm @@ -49,9 +49,9 @@ Route23Script0: ; 51219 (14:5219)  	ret nc  .asm_51237  	ld a, e -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	ld a, c -	ld [wWhichTrade], a +	ld [wWhichBadge], a  	ld b, $2  	ld hl, wd7ed  	predef FlagActionPredef @@ -69,21 +69,21 @@ YCoordsData_51255: ; 51255 (14:5255)  Route23Script_5125d: ; 5125d (14:525d)  	ld hl, BadgeTextPointers -	ld a, [wWhichTrade] +	ld a, [wWhichBadge]  	ld c, a -	ld b, $0 +	ld b, 0  	add hl, bc  	add hl, bc  	ld a, [hli]  	ld h, [hl]  	ld l, a  	ld de, wcd6d -.asm_5126e +.copyTextLoop  	ld a, [hli]  	ld [de], a  	inc de -	cp $50 -	jr nz, .asm_5126e +	cp "@" +	jr nz, .copyTextLoop  	ret  BadgeTextPointers: ; 51276 (14:5276) @@ -188,9 +188,9 @@ Route23Text7: ; 5133d (14:533d)  	jp TextScriptEnd  Route23Script_51346: ; 51346 (14:5346) -	ld [wWhichTrade], a +	ld [wWhichBadge], a  	call Route23Script_5125d -	ld a, [wWhichTrade] +	ld a, [wWhichBadge]  	inc a  	ld c, a  	ld b, $2 @@ -208,7 +208,7 @@ Route23Script_51346: ; 51346 (14:5346)  .asm_5136e  	ld hl, VictoryRoadGuardText2  	call PrintText -	ld a, [wWhichTrade] +	ld a, [wWhichBadge]  	ld c, a  	ld b, $1  	ld hl, wd7ed diff --git a/scripts/route24.asm b/scripts/route24.asm index 7bb9f3cd..f6822a35 100755 --- a/scripts/route24.asm +++ b/scripts/route24.asm @@ -31,7 +31,7 @@ Route24Script0: ; 513d5 (14:53d5)  	xor a  	ld [hJoyHeld], a  	ld a, $1 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd7f0  	bit 1, [hl] @@ -70,7 +70,7 @@ Route24Script3: ; 51422 (14:5422)  	ld hl, wd7ef  	set 1, [hl]  	ld a, $1 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	xor a  	ld [wJoyIgnore], a @@ -87,7 +87,7 @@ Route24TextPointers: ; 5144b (14:544b)  	dw Route24Text5  	dw Route24Text6  	dw Route24Text7 -	dw Predef5CText +	dw PickUpItemText  Route24TrainerHeaders: ; 5145b (14:545b)  Route24TrainerHeader0: ; 5145b (14:545b) @@ -170,7 +170,7 @@ Route24Text1: ; 514a4 (14:54a4)  	ld hl, Route24Text_5152b  	ld de, Route24Text_5152b  	call SaveEndBattleTextPointers -	ld a, [$ff8c] +	ld a, [hSpriteIndexOrTextID]  	ld [wSpriteIndex], a  	call EngageMapTrainer  	call InitBattleEnemyParameters diff --git a/scripts/route25.asm b/scripts/route25.asm index 383652c8..5f544365 100755 --- a/scripts/route25.asm +++ b/scripts/route25.asm @@ -51,7 +51,7 @@ Route25TextPointers: ; 51628 (14:5628)  	dw Route25Text7  	dw Route25Text8  	dw Route25Text9 -	dw Predef5CText +	dw PickUpItemText  	dw Route25Text11  Route25TrainerHeaders: ; 5163e (14:563e) diff --git a/scripts/route4.asm b/scripts/route4.asm index c4a1e956..10d3882d 100755 --- a/scripts/route4.asm +++ b/scripts/route4.asm @@ -15,7 +15,7 @@ Route4ScriptPointers: ; 5566b (15:566b)  Route4TextPointers: ; 55671 (15:5671)  	dw Route4Text1  	dw Route4Text2 -	dw Predef5CText +	dw PickUpItemText  	dw PokeCenterSignText  	dw Route4Text5  	dw Route4Text6 diff --git a/scripts/route5gate.asm b/scripts/route5gate.asm index 2c751fa8..1ccf27af 100755 --- a/scripts/route5gate.asm +++ b/scripts/route5gate.asm @@ -31,7 +31,7 @@ Route5GateScript0: ; 1df50 (7:5f50)  	and a  	jr nz, .asm_1df82  	ld a, $2 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	call Route5GateScript_1df43  	ld a, $1 @@ -39,7 +39,7 @@ Route5GateScript0: ; 1df50 (7:5f50)  	ret  .asm_1df82  	ld a, $3 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd728  	set 6, [hl] diff --git a/scripts/route6gate.asm b/scripts/route6gate.asm index 82e2414a..d1aed2df 100755 --- a/scripts/route6gate.asm +++ b/scripts/route6gate.asm @@ -25,7 +25,7 @@ Route6GateScript0: ; 1e04e (7:604e)  	and a  	jr nz, .asm_1e080  	ld a, $2 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	call Route6GateScript_1e0a1  	ld a, $1 @@ -35,7 +35,7 @@ Route6GateScript0: ; 1e04e (7:604e)  	ld hl, wd728  	set 6, [hl]  	ld a, $3 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	jp DisplayTextID  CoordsData_1e08c: ; 1e08c (7:608c) diff --git a/scripts/route7gate.asm b/scripts/route7gate.asm index 4a05acc3..d73dc566 100755 --- a/scripts/route7gate.asm +++ b/scripts/route7gate.asm @@ -37,7 +37,7 @@ Route7GateScript0: ; 1e128 (7:6128)  	and a  	jr nz, .asm_1e15a  	ld a, $2 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	call Route7GateScript_1e111  	ld a, $1 @@ -45,7 +45,7 @@ Route7GateScript0: ; 1e128 (7:6128)  	ret  .asm_1e15a  	ld a, $3 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd728  	set 6, [hl] diff --git a/scripts/route8gate.asm b/scripts/route8gate.asm index de0a856f..261a7a1e 100755 --- a/scripts/route8gate.asm +++ b/scripts/route8gate.asm @@ -36,7 +36,7 @@ Route8GateScript0: ; 1e1ee (7:61ee)  	and a  	jr nz, .asm_1e220  	ld a, $2 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	call Route8GateScript_1e1d7  	ld a, $1 @@ -46,7 +46,7 @@ Route8GateScript0: ; 1e1ee (7:61ee)  	ld hl, wd728  	set 6, [hl]  	ld a, $3 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	jp DisplayTextID  CoordsData_1e22c: ; 1e22c (7:622c) diff --git a/scripts/route9.asm b/scripts/route9.asm index 539e1a3f..d6050970 100755 --- a/scripts/route9.asm +++ b/scripts/route9.asm @@ -22,7 +22,7 @@ Route9TextPointers: ; 556d5 (15:56d5)  	dw Route9Text7  	dw Route9Text8  	dw Route9Text9 -	dw Predef5CText +	dw PickUpItemText  	dw Route9Text11  Route9TrainerHeaders: ; 556eb (15:56eb) diff --git a/scripts/safarizonecenter.asm b/scripts/safarizonecenter.asm index 6ff60ec6..40042038 100755 --- a/scripts/safarizonecenter.asm +++ b/scripts/safarizonecenter.asm @@ -2,7 +2,7 @@ SafariZoneCenterScript: ; 45bb2 (11:5bb2)  	jp EnableAutoTextBoxDrawing  SafariZoneCenterTextPointers: ; 45bb5 (11:5bb5) -	dw Predef5CText +	dw PickUpItemText  	dw SafariZoneCenterText2  	dw SafariZoneCenterText3 diff --git a/scripts/safarizoneeast.asm b/scripts/safarizoneeast.asm index 3e6df139..55ea5aa6 100755 --- a/scripts/safarizoneeast.asm +++ b/scripts/safarizoneeast.asm @@ -2,10 +2,10 @@ SafariZoneEastScript: ; 4586b (11:586b)  	jp EnableAutoTextBoxDrawing  SafariZoneEastTextPointers: ; 4586e (11:586e) -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText  	dw SafariZoneEastText5  	dw SafariZoneEastText6  	dw SafariZoneEastText7 diff --git a/scripts/safarizoneentrance.asm b/scripts/safarizoneentrance.asm index 2edbe61b..e89630fc 100755 --- a/scripts/safarizoneentrance.asm +++ b/scripts/safarizoneentrance.asm @@ -18,7 +18,7 @@ SafariZoneEntranceScriptPointers: ; 751d9 (1d:51d9)  	call ArePlayerCoordsInArray  	ret nc  	ld a, $3 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, $ff  	ld [wJoyIgnore], a @@ -56,7 +56,7 @@ SafariZoneEntranceScriptPointers: ; 751d9 (1d:51d9)  	ld [wJoyIgnore], a  	call UpdateSprites  	ld a, $4 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, $ff  	ld [wJoyIgnore], a @@ -83,7 +83,7 @@ SafariZoneEntranceScriptPointers: ; 751d9 (1d:51d9)  	ld a, $f0  	ld [wJoyIgnore], a  	ld a, $6 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	xor a  	ld [W_NUMSAFARIBALLS], a @@ -95,7 +95,7 @@ SafariZoneEntranceScriptPointers: ; 751d9 (1d:51d9)  	jr .asm_75286  .asm_7527f  	ld a, $5 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  .asm_75286  	ret diff --git a/scripts/safarizonenorth.asm b/scripts/safarizonenorth.asm index 74790e76..6ea5f902 100755 --- a/scripts/safarizonenorth.asm +++ b/scripts/safarizonenorth.asm @@ -2,8 +2,8 @@ SafariZoneNorthScript: ; 459ab (11:59ab)  	jp EnableAutoTextBoxDrawing  SafariZoneNorthTextPointers: ; 459ae (11:59ae) -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText  	dw SafariZoneNorthText3  	dw SafariZoneNorthText4  	dw SafariZoneNorthText5 diff --git a/scripts/safarizonewest.asm b/scripts/safarizonewest.asm index 1465af56..db2c6427 100755 --- a/scripts/safarizonewest.asm +++ b/scripts/safarizonewest.asm @@ -2,10 +2,10 @@ SafariZoneWestScript: ; 4a1b5 (12:61b5)  	jp EnableAutoTextBoxDrawing  SafariZoneWestTextPointers: ; 4a1b8 (12:61b8) -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText  	dw SafariZoneWestText5  	dw SafariZoneWestText6  	dw SafariZoneWestText7 diff --git a/scripts/saffrongym.asm b/scripts/saffrongym.asm index 7e4f4447..349eda5e 100755 --- a/scripts/saffrongym.asm +++ b/scripts/saffrongym.asm @@ -44,7 +44,7 @@ SaffronGymScript3: ; 5d05b (17:505b)  SaffronGymText_5d068: ; 5d068 (17:5068)  	ld a, $a -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd7b3  	set 1, [hl] @@ -52,14 +52,14 @@ SaffronGymText_5d068: ; 5d068 (17:5068)  	call GiveItem  	jr nc, .BagFull  	ld a, $b -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd7b3  	set 0, [hl]  	jr .asm_5d091  .BagFull  	ld a, $c -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  .asm_5d091  	ld hl, W_OBTAINEDBADGES diff --git a/scripts/silphco10.asm b/scripts/silphco10.asm index 46630014..47700664 100755 --- a/scripts/silphco10.asm +++ b/scripts/silphco10.asm @@ -44,9 +44,9 @@ SilphCo10TextPointers: ; 5a186 (16:6186)  	dw SilphCo10Text1  	dw SilphCo10Text2  	dw SilphCo10Text3 -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText  SilphCo10TrainerHeaders: ; 5a192 (16:6192)  SilphCo10TrainerHeader0: ; 5a192 (16:6192) diff --git a/scripts/silphco11.asm b/scripts/silphco11.asm index 473c9d11..b4f94b13 100755 --- a/scripts/silphco11.asm +++ b/scripts/silphco11.asm @@ -170,17 +170,17 @@ SilphCo11Script0: ; 621db (18:61db)  	ld hl, CoordsData_62211  	call ArePlayerCoordsInArray  	jp nc, CheckFightingMapTrainers -	ld a, [wWhichTrade] +	ld a, [wCoordIndex]  	ld [wcf0d], a  	xor a  	ld [hJoyHeld], a  	ld a, $f0  	ld [wJoyIgnore], a  	ld a, $3 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, $3 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [H_SPRITEINDEX], a  	call SetSpriteMovementBytesToFF  	ld de, MovementData_62216  	call MoveSprite @@ -201,9 +201,9 @@ MovementData_62216: ; 62216 (18:6216)  SilphCo11Script_6221a: ; 6221a (18:621a)  	ld [wd528], a  	ld a, $3 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [H_SPRITEINDEX], a  	ld a, b -	ld [$ff8d], a +	ld [hSpriteFacingDirection], a  	jp SetSpriteFacingDirectionAndDelay  SilphCo11Script5: ; 62227 (18:6227) @@ -214,17 +214,17 @@ SilphCo11Script5: ; 62227 (18:6227)  	cp $1  	jr z, .asm_6223c  	ld a, $2 -	ld b, $c +	ld b, SPRITE_FACING_RIGHT  	jr .asm_62240  .asm_6223c  	ld a, $8 -	ld b, $0 +	ld b, SPRITE_FACING_DOWN  .asm_62240  	call SilphCo11Script_6221a  	ld a, $f0  	ld [wJoyIgnore], a  	ld a, $6 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	call GBFadeOutToBlack  	call SilphCo11Script_6216d @@ -242,17 +242,17 @@ SilphCo11Script3: ; 6226a (18:626a)  	bit 0, a  	ret nz  	ld a, $3 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [H_SPRITEINDEX], a  	call SetSpriteMovementBytesToFF  	ld a, [wcf0d]  	cp $1  	jr z, .asm_62284  	ld a, $2 -	ld b, $c +	ld b, SPRITE_FACING_RIGHT  	jr .asm_62288  .asm_62284  	ld a, $8 -	ld b, $0 +	ld b, SPRITE_FACING_DOWN  .asm_62288  	call SilphCo11Script_6221a  	call Delay3 @@ -266,7 +266,7 @@ SilphCo11Script4: ; 62293 (18:6293)  	ld hl, SilphCo10Text_62330  	ld de, SilphCo10Text_62330  	call SaveEndBattleTextPointers -	ld a, [H_DOWNARROWBLINKCNT2] +	ld a, [H_SPRITEINDEX]  	ld [wSpriteIndex], a  	call EngageMapTrainer  	call InitBattleEnemyParameters diff --git a/scripts/silphco3.asm b/scripts/silphco3.asm index bc36ed39..4bd1edd1 100755 --- a/scripts/silphco3.asm +++ b/scripts/silphco3.asm @@ -58,7 +58,7 @@ SilphCo3TextPointers: ; 59fc4 (16:5fc4)  	dw SilphCo3Text1  	dw SilphCo3Text2  	dw SilphCo3Text3 -	dw Predef5CText +	dw PickUpItemText  SilphCo3TrainerHeaders: ; 59fcc (16:5fcc)  SilphCo3TrainerHeader0: ; 59fcc (16:5fcc) diff --git a/scripts/silphco4.asm b/scripts/silphco4.asm index 866afd54..a3953e27 100755 --- a/scripts/silphco4.asm +++ b/scripts/silphco4.asm @@ -95,9 +95,9 @@ SilphCo4TextPointers: ; 19da0 (6:5da0)  	dw SilphCo4Text2  	dw SilphCo4Text3  	dw SilphCo4Text4 -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText  SilphCo4TrainerHeaders: ; 19dae (6:5dae)  SilphCo4TrainerHeader0: ; 19dae (6:5dae) diff --git a/scripts/silphco5.asm b/scripts/silphco5.asm index 750072ab..1ed6006f 100755 --- a/scripts/silphco5.asm +++ b/scripts/silphco5.asm @@ -74,9 +74,9 @@ SilphCo5TextPointers: ; 19fbc (6:5fbc)  	dw SilphCo5Text3  	dw SilphCo5Text4  	dw SilphCo5Text5 -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText  	dw SilphCo5Text9  	dw SilphCo5Text10  	dw SilphCo5Text11 diff --git a/scripts/silphco6.asm b/scripts/silphco6.asm index 0ff5ee50..fe1e6224 100755 --- a/scripts/silphco6.asm +++ b/scripts/silphco6.asm @@ -50,8 +50,8 @@ SilphCo6TextPointers: ; 1a1f6 (6:61f6)  	dw SilphCo6Text6  	dw SilphCo6Text7  	dw SilphCo6Text8 -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText  SilphCo6TrainerHeaders: ; 1a20a (6:620a)  SilphCo6TrainerHeader0: ; 1a20a (6:620a) diff --git a/scripts/silphco7.asm b/scripts/silphco7.asm index 483429c0..8538d37f 100755 --- a/scripts/silphco7.asm +++ b/scripts/silphco7.asm @@ -136,10 +136,10 @@ SilphCo7Script0: ; 51c23 (14:5c23)  	ld a, MUSIC_MEET_RIVAL  	call PlayMusic  	ld a, $9 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, $9 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [H_SPRITEINDEX], a  	call SetSpriteMovementBytesToFF  	ld de, MovementData_51c7d  	ld a, [wWhichTrade] @@ -149,7 +149,7 @@ SilphCo7Script0: ; 51c23 (14:5c23)  	inc de  .asm_51c6c  	ld a, $9 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [H_SPRITEINDEX], a  	call MoveSprite  	ld a, $3  	jp SilphCo7Text_51c10 @@ -173,7 +173,7 @@ SilphCo7Script3: ; 51c82 (14:5c82)  	xor a  	ld [wJoyIgnore], a  	ld a, $d -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	call Delay3  	ld hl, wd72d @@ -212,12 +212,12 @@ SilphCo7Script4: ; 51cc8 (14:5cc8)  	ld a, $4  	ld [wd528], a  	ld a, $9 -	ld [H_DOWNARROWBLINKCNT2], a -	ld a, $4 -	ld [$ff8d], a +	ld [H_SPRITEINDEX], a +	ld a, SPRITE_FACING_UP +	ld [hSpriteFacingDirection], a  	call SetSpriteFacingDirectionAndDelay  	ld a, $f -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, $ff  	ld [wc0ee], a @@ -230,7 +230,7 @@ SilphCo7Script4: ; 51cc8 (14:5cc8)  	ld de, MovementData_51d1a  .asm_51d0e  	ld a, $9 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [H_SPRITEINDEX], a  	call MoveSprite  	ld a, $5  	jp SilphCo7Text_51c10 @@ -272,9 +272,9 @@ SilphCo7TextPointers: ; 51d3f (14:5d3f)  	dw SilphCo7Text7  	dw SilphCo7Text8  	dw SilphCo7Text9 -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText  	dw SilphCo7Text13  	dw SilphCo7Text14  	dw SilphCo7Text15 diff --git a/scripts/ssanne10.asm b/scripts/ssanne10.asm index 4dee3bb7..031315c3 100755 --- a/scripts/ssanne10.asm +++ b/scripts/ssanne10.asm @@ -21,9 +21,9 @@ SSAnne10TextPointers: ; 61d6e (18:5d6e)  	dw SSAnne10Text6  	dw SSAnne10Text7  	dw SSAnne10Text8 -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText  SSAnne10TrainerHeaders: ; 61d84 (18:5d84)  SSAnne10TrainerHeader0: ; 61d84 (18:5d84) diff --git a/scripts/ssanne2.asm b/scripts/ssanne2.asm index 16d560b5..d4651a22 100755 --- a/scripts/ssanne2.asm +++ b/scripts/ssanne2.asm @@ -30,14 +30,14 @@ SSAnne2Script0: ; 613be (18:53be)  	ld c, BANK(Music_MeetRival)  	ld a, MUSIC_MEET_RIVAL  	call PlayMusic -	ld a, [wWhichTrade] +	ld a, [wCoordIndex]  	ld [$ffdb], a  	ld a, HS_SS_ANNE_2_RIVAL  	ld [wcc4d], a  	predef ShowObject  	call Delay3  	ld a, $2 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	call SetSpriteMovementBytesToFF  	xor a  	ld [hJoyHeld], a @@ -79,11 +79,11 @@ SSAnne2Script_61416: ; 61416 (18:5416)  	ld a, SPRITE_FACING_RIGHT  	jr .asm_61427  .asm_61426 -	xor a +	xor a ; SPRITE_FACING_DOWN  .asm_61427 -	ld [$ff8d], a +	ld [hSpriteFacingDirection], a  	ld a, $2 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [H_SPRITEINDEX], a  	jp SetSpriteFacingDirectionAndDelay  SSAnne2Script1: ; 61430 (18:5430) @@ -94,7 +94,7 @@ SSAnne2Script1: ; 61430 (18:5430)  	xor a  	ld [wJoyIgnore], a  	ld a, $2 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	call Delay3  	ld a, SONY2 + $c8 @@ -129,10 +129,10 @@ SSAnne2Script2: ; 6146d (18:546d)  	ld a, $f0  	ld [wJoyIgnore], a  	ld a, $3 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, $2 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	call SetSpriteMovementBytesToFF  	ld a, [W_XCOORD]  	cp $25 @@ -143,7 +143,7 @@ SSAnne2Script2: ; 6146d (18:546d)  	ld de, MovementData_614b7  .asm_6149a  	ld a, $2 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	call MoveSprite  	ld a, $ff  	ld [wc0ee], a diff --git a/scripts/ssanne8.asm b/scripts/ssanne8.asm index 27c76a2f..7885135b 100755 --- a/scripts/ssanne8.asm +++ b/scripts/ssanne8.asm @@ -22,7 +22,7 @@ SSAnne8TextPointers: ; 6198f (18:598f)  	dw SSAnne8Text7  	dw SSAnne8Text8  	dw SSAnne8Text9 -	dw Predef5CText +	dw PickUpItemText  	dw SSAnne8Text11  SSAnne8TrainerHeaders: ; 619a5 (18:59a5) diff --git a/scripts/ssanne9.asm b/scripts/ssanne9.asm index 6e8b86c6..0cee1e08 100755 --- a/scripts/ssanne9.asm +++ b/scripts/ssanne9.asm @@ -21,10 +21,10 @@ SSAnne9TextPointers: ; 61b6a (18:5b6a)  	dw SSAnne9Text3  	dw SSAnne9Text4  	dw SSAnne9Text5 -	dw Predef5CText +	dw PickUpItemText  	dw SSAnne9Text7  	dw SSAnne9Text8 -	dw Predef5CText +	dw PickUpItemText  	dw SSAnne9Text10  	dw SSAnne9Text11  	dw SSAnne9Text12 diff --git a/scripts/tradecenter.asm b/scripts/tradecenter.asm index 0a5cc100..22a61095 100755 --- a/scripts/tradecenter.asm +++ b/scripts/tradecenter.asm @@ -2,13 +2,13 @@ TradeCenterScript: ; 4fd10 (13:7d10)  	call EnableAutoTextBoxDrawing  	ld a, [$ffaa]  	cp $2 -	ld a, $8 -	jr z, .asm_4fd1d -	ld a, $c -.asm_4fd1d -	ld [$ff8d], a +	ld a, SPRITE_FACING_LEFT +	jr z, .next +	ld a, SPRITE_FACING_RIGHT +.next +	ld [hSpriteFacingDirection], a  	ld a, $1 -	ld [$ff8c], a +	ld [H_SPRITEINDEX], a  	call SetSpriteFacingDirection  	ld hl, wd72d  	bit 0, [hl] diff --git a/scripts/unknowndungeon1.asm b/scripts/unknowndungeon1.asm index 008a7bd7..696ddafa 100755 --- a/scripts/unknowndungeon1.asm +++ b/scripts/unknowndungeon1.asm @@ -2,6 +2,6 @@ UnknownDungeon1Script: ; 74d0c (1d:4d0c)  	jp EnableAutoTextBoxDrawing  UnknownDungeon1TextPointers: ; 74d0f (1d:4d0f) -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText diff --git a/scripts/unknowndungeon2.asm b/scripts/unknowndungeon2.asm index c8249b27..f3cbb6a5 100755 --- a/scripts/unknowndungeon2.asm +++ b/scripts/unknowndungeon2.asm @@ -2,6 +2,6 @@ UnknownDungeon2Script: ; 45e0b (11:5e0b)  	jp EnableAutoTextBoxDrawing  UnknownDungeon2TextPointers: ; 45e0e (11:5e0e) -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText diff --git a/scripts/unknowndungeon3.asm b/scripts/unknowndungeon3.asm index 055c9d0f..1c87aa39 100755 --- a/scripts/unknowndungeon3.asm +++ b/scripts/unknowndungeon3.asm @@ -14,8 +14,8 @@ UnknownDungeon3ScriptPointers: ; 45f03 (11:5f03)  UnknownDungeon3TextPointers: ; 45f09 (11:5f09)  	dw UnknownDungeon3Text1 -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText  UnknownDungeon3TrainerHeaders: ; 45f0f (11:5f0f)  UnknownDungeon3TrainerHeader0: ; 45f0f (11:5f0f) diff --git a/scripts/vermilioncity.asm b/scripts/vermilioncity.asm index 83fe2a8c..6b9f94f7 100755 --- a/scripts/vermilioncity.asm +++ b/scripts/vermilioncity.asm @@ -49,7 +49,7 @@ VermilionCityScript0: ; 197e6 (6:57e6)  	ld [hJoyHeld], a  	ld [wcf0d], a  	ld a, $3 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld a, [wd803]  	bit 2, a diff --git a/scripts/vermiliongym.asm b/scripts/vermiliongym.asm index 3515c29c..193b3a06 100755 --- a/scripts/vermiliongym.asm +++ b/scripts/vermiliongym.asm @@ -64,7 +64,7 @@ VermilionGymScript3: ; 5ca9d (17:4a9d)  VermilionGymScript_5caaa: ; 5caaa (17:4aaa)  	ld a, $6 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd773  	set 7, [hl] @@ -72,14 +72,14 @@ VermilionGymScript_5caaa: ; 5caaa (17:4aaa)  	call GiveItem  	jr nc, .BagFull  	ld a, $7 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd773  	set 6, [hl]  	jr .asm_5cad3  .BagFull  	ld a, $8 -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  .asm_5cad3  	ld hl, W_OBTAINEDBADGES diff --git a/scripts/victoryroad1.asm b/scripts/victoryroad1.asm index 68a3502f..4f1df52f 100755 --- a/scripts/victoryroad1.asm +++ b/scripts/victoryroad1.asm @@ -43,8 +43,8 @@ CoordsData_5da5c: ; 5da5c (17:5a5c)  VictoryRoad1TextPointers: ; 5da5f (17:5a5f)  	dw VictoryRoad1Text1  	dw VictoryRoad1Text2 -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText  	dw BoulderText  	dw BoulderText  	dw BoulderText diff --git a/scripts/victoryroad2.asm b/scripts/victoryroad2.asm index 1fc2af7e..51346032 100755 --- a/scripts/victoryroad2.asm +++ b/scripts/victoryroad2.asm @@ -77,10 +77,10 @@ VictoryRoad2TextPointers: ; 5181b (14:581b)  	dw VictoryRoad2Text4  	dw VictoryRoad2Text5  	dw VictoryRoad2Text6 -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText  	dw BoulderText  	dw BoulderText  	dw BoulderText diff --git a/scripts/victoryroad3.asm b/scripts/victoryroad3.asm index 20b3df85..9aeb1d18 100755 --- a/scripts/victoryroad3.asm +++ b/scripts/victoryroad3.asm @@ -83,8 +83,8 @@ VictoryRoad3TextPointers: ; 44a24 (11:4a24)  	dw VictoryRoad3Text2  	dw VictoryRoad3Text3  	dw VictoryRoad3Text4 -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText  	dw BoulderText  	dw BoulderText  	dw BoulderText diff --git a/scripts/viridiancity.asm b/scripts/viridiancity.asm index 05f5f495..c358e961 100755 --- a/scripts/viridiancity.asm +++ b/scripts/viridiancity.asm @@ -32,7 +32,7 @@ ViridianCityScript_1900b: ; 1900b (6:500b)  	cp $20  	ret nz  	ld a, $e -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	xor a  	ld [hJoyHeld], a @@ -52,7 +52,7 @@ ViridianCityScript_1903d: ; 1903d (6:503d)  	cp $13  	ret nz  	ld a, $5 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	xor a  	ld [hJoyHeld], a @@ -98,7 +98,7 @@ ViridianCityScript2: ; 1908f (6:508f)  	xor a  	ld [wJoyIgnore], a  	ld a, $f -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	xor a  	ld [W_BATTLETYPE], a diff --git a/scripts/viridianforest.asm b/scripts/viridianforest.asm index 124d3184..554c2125 100755 --- a/scripts/viridianforest.asm +++ b/scripts/viridianforest.asm @@ -17,9 +17,9 @@ ViridianForestTextPointers: ; 61126 (18:5126)  	dw ViridianForestText2  	dw ViridianForestText3  	dw ViridianForestText4 -	dw Predef5CText -	dw Predef5CText -	dw Predef5CText +	dw PickUpItemText +	dw PickUpItemText +	dw PickUpItemText  	dw ViridianForestText8  	dw ViridianForestText9  	dw ViridianForestText10 diff --git a/scripts/viridiangym.asm b/scripts/viridiangym.asm index 9e5e0e5f..9a0ce855 100755 --- a/scripts/viridiangym.asm +++ b/scripts/viridiangym.asm @@ -140,7 +140,7 @@ ViridianGymScript3: ; 74988 (1d:4988)  	ld [wJoyIgnore], a  ViridianGymScript3_74995: ; 74995 (1d:4995)  	ld a, $c -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd751  	set 1, [hl] @@ -148,14 +148,14 @@ ViridianGymScript3_74995: ; 74995 (1d:4995)  	call GiveItem  	jr nc, .BagFull  	ld a, $d -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wd751  	set 0, [hl]  	jr .asm_749be  .BagFull  	ld a, $e -	ld [H_DOWNARROWBLINKCNT2], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  .asm_749be  	ld hl, W_OBTAINEDBADGES @@ -190,7 +190,7 @@ ViridianGymTextPointers: ; 749ec (1d:49ec)  	dw ViridianGymText8  	dw ViridianGymText9  	dw ViridianGymText10 -	dw Predef5CText +	dw PickUpItemText  	dw ViridianGymText12  	dw ViridianGymText13  	dw ViridianGymText14 diff --git a/scripts/viridianmart.asm b/scripts/viridianmart.asm index 9725e275..b6621684 100755 --- a/scripts/viridianmart.asm +++ b/scripts/viridianmart.asm @@ -28,7 +28,7 @@ ViridianMartScriptPointers: ; 1d495 (7:5495)  ViridianMartScript0: ; 1d49b (7:549b)  	call UpdateSprites  	ld a, $4 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld hl, wSimulatedJoypadStatesEnd  	ld de, RLEMovement1d4bb @@ -51,7 +51,7 @@ ViridianMartScript1: ; 1d4c0 (7:54c0)  	ret nz  	call Delay3  	ld a, $5 -	ld [$ff8c], a +	ld [hSpriteIndexOrTextID], a  	call DisplayTextID  	ld bc, (OAKS_PARCEL << 8) + 1  	call GiveItem @@ -2087,7 +2087,7 @@ _ColosseumVersionText::  ENDC  _Char00Text:: ; 8a696 (22:6696) -	TX_NUM $FF8C,1,2 +	TX_NUM hSpriteIndexOrTextID,1,2  	text " ERROR."  	done @@ -634,6 +634,11 @@ wOverrideSimulatedJoypadStatesMask:: ; cd3b  	ds 1 +wWhichBadge:: ; cd3d + +wMuseumPriceTemp:: ; cd3d +; 3-byte BCD number +  wTitleMonSpecies:: ; cd3d  wPlayerCharacterOAMTile:: ; cd3d @@ -1891,58 +1896,98 @@ W_MAPCONNECTIONS:: ; d370  W_MAPCONN1PTR:: ; d371  	ds 1 -wd372:: ds 1 ; some connection stuff, too bothered to label it -wd373:: ds 1 -wd374:: ds 1 -wd375:: ds 1 -wd376:: ds 1 -wd377:: ds 1 -wd378:: ds 1 -wd379:: ds 1 -wd37a:: ds 1 -wd37b:: ds 1 +wNorthConnectionStripSrc:: ; d372 +	ds 2 + +wNorthConnectionStripDest:: ; d374 +	ds 2 + +wNorthConnectionStripWidth:: ; d376 +	ds 1 + +wNorthConnectedMapWidth:: ; d377 +	ds 1 + +wNorthConnectedMapYAlignment:: ; d378 +	ds 1 + +wNorthConnectedMapXAlignment:: ; d379 +	ds 1 + +wNorthConnectedMapViewPointer:: ; d37a +	ds 2  W_MAPCONN2PTR:: ; d37c  	ds 1 -wd37d:: ds 1 -wd37e:: ds 1 -wd37f:: ds 1 -wd380:: ds 1 -wd381:: ds 1 -wd382:: ds 1 -wd383:: ds 1 -wd384:: ds 1 -wd385:: ds 1 -wd386:: ds 1 +wSouthConnectionStripSrc:: ; d37d +	ds 2 + +wSouthConnectionStripDest:: ; d37f: +	ds 2 + +wSouthConnectionStripWidth:: ; d381 +	ds 1 + +wSouthConnectedMapWidth:: ; d382 +	ds 1 + +wSouthConnectedMapYAlignment:: ; d383 +	ds 1 + +wSouthConnectedMapXAlignment:: ; d384 +	ds 1 + +wSouthConnectedMapViewPointer:: ; d385 +	ds 2  W_MAPCONN3PTR:: ; d387  	ds 1 -wd388:: ds 1 -wd389:: ds 1 -wd38a:: ds 1 -wd38b:: ds 1 -wd38c:: ds 1 -wd38d:: ds 1 -wd38e:: ds 1 -wd38f:: ds 1 -wd390:: ds 1 -wd391:: ds 1 +wWestConnectionStripSrc:: ; d388 +	ds 2 + +wWestConnectionStripDest:: ; d38a +	ds 2 + +wWestConnectionStripHeight:: ; d38c +	ds 1 + +wWestConnectedMapWidth:: ; d38d +	ds 1 + +wWestConnectedMapYAlignment:: ; d38e +	ds 1 + +wWestConnectedMapXAlignment:: ; d38f +	ds 1 + +wWestConnectedMapViewPointer:: ; d390 +	ds 2  W_MAPCONN4PTR:: ; d392  	ds 1 -wd393:: ds 1 -wd394:: ds 1 -wd395:: ds 1 -wd396:: ds 1 -wd397:: ds 1 -wd398:: ds 1 -wd399:: ds 1 -wd39a:: ds 1 -wd39b:: ds 1 -wd39c:: ds 1 +wEastConnectionStripSrc:: ; d393 +	ds 2 + +wEastConnectionStripDest:: ; d395 +	ds 2 + +wEastConnectionStripHeight:: ; d397 +	ds 1 + +wEastConnectedMapWidth:: ; d398 +	ds 1 + +wEastConnectedMapYAlignment:: ; d399 +	ds 1 + +wEastConnectedMapXAlignment:: ; d39a +	ds 1 + +wEastConnectedMapViewPointer:: ; d39b +	ds 2  W_SPRITESET:: ; d39d  ; sprite set for the current map (11 sprite picture ID's) | 
