diff options
Diffstat (limited to 'engine')
| -rw-r--r-- | engine/battle/battle_transitions.asm | 76 | ||||
| -rw-r--r-- | engine/battle/draw_hud_pokeball_gfx.asm | 36 | ||||
| -rwxr-xr-x | engine/menu/main_menu.asm | 2 | ||||
| -rwxr-xr-x | engine/overworld/hidden_items.asm | 4 | ||||
| -rwxr-xr-x | engine/overworld/trainers.asm | 2 | 
5 files changed, 63 insertions, 57 deletions
| diff --git a/engine/battle/battle_transitions.asm b/engine/battle/battle_transitions.asm index 4f605b52..056c55ea 100644 --- a/engine/battle/battle_transitions.asm +++ b/engine/battle/battle_transitions.asm @@ -1,5 +1,5 @@  BattleTransition: ; 7096d (1c:496d) -	ld a, $1 +	ld a, 1  	ld [H_AUTOBGTRANSFERENABLED], a  	call Delay3  	xor a @@ -7,10 +7,13 @@ BattleTransition: ; 7096d (1c:496d)  	dec a  	ld [wUpdateSpritesEnabled], a  	call DelayFrame + +; Determine which OAM block is being used by the enemy trainer sprite (if there +; is one).  	ld hl, wSpriteStateData1 + 2 -	ld a, [H_DOWNARROWBLINKCNT2] +	ld a, [hSpriteIndexOrTextID] ; enemy trainer sprite index (0 if wild battle)  	ld c, a -	ld b, $0 +	ld b, 0  	ld de, $10  .loop1  	ld a, [hl] @@ -21,13 +24,15 @@ BattleTransition: ; 7096d (1c:496d)  	add hl, de  	dec c  	jr nz, .loop1 + +; Clear OAM except for the blocks used by the player and enemy trainer sprites.  	ld hl, wOAMBuffer + $10 -	ld c, $9 +	ld c, 9  .loop2  	ld a, b  	swap a  	cp l -	jr z, .skip2 +	jr z, .skip2 ; skip clearing the block if the enemy trainer is using it  	push hl  	push bc  	ld bc, $10 @@ -40,9 +45,10 @@ BattleTransition: ; 7096d (1c:496d)  	add hl, de  	dec c  	jr nz, .loop2 +  	call Delay3  	call LoadBattleTransitionTile -	ld bc, $0 +	ld bc, 0  	ld a, [wLinkState]  	cp LINK_STATE_BATTLING  	jr z, .linkBattle @@ -103,7 +109,7 @@ GetBattleTransitionID_CompareLevels: ; 709ef (1c:49ef)  	sub e  	jr nc, .highLevelEnemy  	res 1, c -	ld a, $1 +	ld a, 1  	ld [wBattleTransitionSpiralDirection], a  	ret  .highLevelEnemy @@ -229,10 +235,10 @@ BattleTransition_Spiral: ; 70a72 (1c:4a72)  	ret  BattleTransition_InwardSpiral: ; 70aaa (1c:4aaa) -	ld a, $7 -	ld [wWhichTrade], a +	ld a, 7 +	ld [wInwardSpiralUpdateScreenCounter], a  	coord hl, 0, 0 -	ld c, $11 +	ld c, SCREEN_HEIGHT - 1  	ld de, SCREEN_WIDTH  	call BattleTransition_InwardSpiral_  	inc c @@ -242,7 +248,7 @@ BattleTransition_InwardSpiral: ; 70aaa (1c:4aaa)  	call BattleTransition_InwardSpiral_  .skip  	inc c -	ld de, $1 +	ld de, 1  	call BattleTransition_InwardSpiral_  	dec c  	dec c @@ -264,13 +270,13 @@ BattleTransition_InwardSpiral_: ; 70ae0 (1c:4ae0)  	ld [hl], $ff  	add hl, de  	push bc -	ld a, [wWhichTrade] +	ld a, [wInwardSpiralUpdateScreenCounter]  	dec a  	jr nz, .skip  	call BattleTransition_TransferDelay3 -	ld a, $7 +	ld a, 7  .skip -	ld [wWhichTrade], a +	ld [wInwardSpiralUpdateScreenCounter], a  	pop bc  	dec c  	jr nz, .loop @@ -385,7 +391,7 @@ BattleTransition_Shrink: ; 70b7f (1c:4b7f)  	call BattleTransition_CopyTiles2  	coord hl, 11, 0  	coord de, 10, 0 -	ld bc, $2 +	ld bc, 2  	call BattleTransition_CopyTiles2  	ld a, $1  	ld [H_AUTOBGTRANSFERENABLED], a @@ -419,7 +425,7 @@ BattleTransition_Split: ; 70bca (1c:4bca)  	call BattleTransition_CopyTiles2  	coord hl, 1, 0  	coord de, 0, 0 -	ld bc, $2 +	ld bc, 2  	call BattleTransition_CopyTiles2  	call BattleTransition_TransferDelay3  	call Delay3 @@ -432,10 +438,10 @@ BattleTransition_Split: ; 70bca (1c:4bca)  BattleTransition_CopyTiles1: ; 70c12 (1c:4c12)  	ld a, c -	ld [wWhichTrade], a +	ld [wBattleTransitionCopyTilesOffset], a  	ld a, b -	ld [wTrainerEngageDistance], a -	ld c, $8 +	ld [wBattleTransitionCopyTilesOffset + 1], a +	ld c, 8  .loop1  	push bc  	push hl @@ -444,9 +450,9 @@ BattleTransition_CopyTiles1: ; 70c12 (1c:4c12)  	call CopyData  	pop hl  	pop de -	ld a, [wWhichTrade] +	ld a, [wBattleTransitionCopyTilesOffset]  	ld c, a -	ld a, [wTrainerEngageDistance] +	ld a, [wBattleTransitionCopyTilesOffset + 1]  	ld b, a  	add hl, bc  	pop bc @@ -464,9 +470,9 @@ BattleTransition_CopyTiles1: ; 70c12 (1c:4c12)  BattleTransition_CopyTiles2: ; 70c3f (1c:4c3f)  	ld a, c -	ld [wWhichTrade], a +	ld [wBattleTransitionCopyTilesOffset], a  	ld a, b -	ld [wTrainerEngageDistance], a +	ld [wBattleTransitionCopyTilesOffset + 1], a  	ld c, SCREEN_HEIGHT / 2  .loop1  	push bc @@ -492,9 +498,9 @@ BattleTransition_CopyTiles2: ; 70c3f (1c:4c3f)  	jr nz, .loop2  	pop hl  	pop de -	ld a, [wWhichTrade] +	ld a, [wBattleTransitionCopyTilesOffset]  	ld c, a -	ld a, [wTrainerEngageDistance] +	ld a, [wBattleTransitionCopyTilesOffset + 1]  	ld b, a  	add hl, bc  	pop bc @@ -590,11 +596,11 @@ BattleTransition_HorizontalStripes_: ; 70cd8 (1c:4cd8)  ; by animating each half circle one at a time  BattleTransition_Circle: ; 70ce4 (1c:4ce4)  	call BattleTransition_FlashScreen -	ld bc, SCREEN_WIDTH / 2 +	lb bc, 0, SCREEN_WIDTH / 2  	ld hl, BattleTransition_HalfCircle1  	call BattleTransition_Circle_Sub1  	ld c, SCREEN_WIDTH / 2 -	ld b, $1 +	ld b, 1  	ld hl, BattleTransition_HalfCircle2  	call BattleTransition_Circle_Sub1  	jp BattleTransition_BlackScreen @@ -612,7 +618,7 @@ BattleTransition_Circle_Sub1: ; 70d06 (1c:4d06)  	ld a, b  	call BattleTransition_Circle_Sub2  	pop hl -	ld bc, $0005 +	ld bc, 5  	add hl, bc  	call BattleTransition_TransferDelay3  	pop bc @@ -621,7 +627,7 @@ BattleTransition_Circle_Sub1: ; 70d06 (1c:4d06)  	ret  BattleTransition_TransferDelay3: ; 70d19 (1c:4d19) -	ld a, $1 +	ld a, 1  	ld [H_AUTOBGTRANSFERENABLED], a  	call Delay3  	xor a @@ -647,7 +653,7 @@ BattleTransition_DoubleCircle: ; 70d24 (1c:4d24)  	ld a, $1  	call BattleTransition_Circle_Sub2  	pop hl -	ld bc, $5 +	ld bc, 5  	add hl, bc  	ld e, l  	ld d, h @@ -660,9 +666,9 @@ BattleTransition_DoubleCircle: ; 70d24 (1c:4d24)  	jp BattleTransition_BlackScreen  BattleTransition_Circle_Sub2: ; 70d50 (1c:4d50) -	ld [wWhichTrade], a +	ld [wBattleTransitionCircleScreenQuadrantY], a  	ld a, [hli] -	ld [wTrainerEngageDistance], a +	ld [wBattleTransitionCircleScreenQuadrantX], a  	ld a, [hli]  	ld e, a  	ld a, [hli] @@ -761,7 +767,7 @@ BattleTransition_Circle_Sub3: ; 70dc5 (1c:4dc5)  	inc de  .loop1  	ld [hl], $ff -	ld a, [wTrainerEngageDistance] +	ld a, [wBattleTransitionCircleScreenQuadrantX]  	and a  	jr z, .skip1  	inc hl @@ -772,7 +778,7 @@ BattleTransition_Circle_Sub3: ; 70dc5 (1c:4dc5)  	dec c  	jr nz, .loop1  	pop hl -	ld a, [wWhichTrade] +	ld a, [wBattleTransitionCircleScreenQuadrantY]  	and a  	ld bc, SCREEN_WIDTH  	jr z, .skip3 @@ -787,7 +793,7 @@ BattleTransition_Circle_Sub3: ; 70dc5 (1c:4dc5)  	jr z, BattleTransition_Circle_Sub3  	ld c, a  .loop2 -	ld a, [wTrainerEngageDistance] +	ld a, [wBattleTransitionCircleScreenQuadrantX]  	and a  	jr z, .skip4  	dec hl diff --git a/engine/battle/draw_hud_pokeball_gfx.asm b/engine/battle/draw_hud_pokeball_gfx.asm index e9be0da5..1e229b1c 100644 --- a/engine/battle/draw_hud_pokeball_gfx.asm +++ b/engine/battle/draw_hud_pokeball_gfx.asm @@ -6,7 +6,7 @@ DrawAllPokeballs: ; 3a849 (e:6849)  	ret z ; return if wild pokémon  	jp SetupEnemyPartyPokeballs -DrawEnemyPokeballs: ; 0x3a857 +DrawEnemyPokeballs: ; 3a857 (e:6857)  	call LoadPartyPokeballGfx  	jp SetupEnemyPartyPokeballs @@ -25,8 +25,8 @@ SetupOwnPartyPokeballs: ; 3a869 (e:6869)  	ld hl, W_BASECOORDX  	ld [hli], a  	ld [hl], a -	ld a, $8 -	ld [wTrainerEngageDistance], a +	ld a, 8 +	ld [wHUDPokeballGfxOffsetX], a  	ld hl, wOAMBuffer  	jp WritePokeballOAMData @@ -39,8 +39,8 @@ SetupEnemyPartyPokeballs: ; 3a887 (e:6887)  	ld a, $48  	ld [hli], a  	ld [hl], $20 -	ld a, $f8 -	ld [wTrainerEngageDistance], a +	ld a, -8 +	ld [wHUDPokeballGfxOffsetX], a  	ld hl, wOAMBuffer + PARTY_LENGTH * 4  	jp WritePokeballOAMData @@ -90,8 +90,8 @@ PickPokeball: ; 3a8c2 (e:68c2)  .done  	ld a, b  	ld [de], a -	ld bc, $0028 ; rest of mon struct -	add hl, bc +	ld bc, wPartyMon2 - wPartyMon1Status +	add hl, bc ; next mon struct  	ret  WritePokeballOAMData: ; 3a8e1 (e:68e1) @@ -108,7 +108,7 @@ WritePokeballOAMData: ; 3a8e1 (e:68e1)  	ld [hli], a  	ld a, [W_BASECOORDX]  	ld b, a -	ld a, [wTrainerEngageDistance] +	ld a, [wHUDPokeballGfxOffsetX]  	add b  	ld [W_BASECOORDX], a  	inc de @@ -118,11 +118,11 @@ WritePokeballOAMData: ; 3a8e1 (e:68e1)  PlacePlayerHUDTiles: ; 3a902 (e:6902)  	ld hl, PlayerBattleHUDGraphicsTiles -	ld de, wTrainerFacingDirection +	ld de, wHUDGraphicsTiles  	ld bc, $3  	call CopyData  	coord hl, 18, 10 -	ld de, rIE +	ld de, -1  	jr PlaceHUDTiles  PlayerBattleHUDGraphicsTiles: ; 3a916 (e:6916) @@ -133,7 +133,7 @@ PlayerBattleHUDGraphicsTiles: ; 3a916 (e:6916)  PlaceEnemyHUDTiles: ; 3a919 (e:6919)  	ld hl, EnemyBattleHUDGraphicsTiles -	ld de, wTrainerFacingDirection +	ld de, wHUDGraphicsTiles  	ld bc, $3  	call CopyData  	coord hl, 1, 2 @@ -150,16 +150,16 @@ PlaceHUDTiles: ; 3a930 (e:6930)  	ld [hl], $73  	ld bc, SCREEN_WIDTH  	add hl, bc -	ld a, [wTrainerScreenY] +	ld a, [wHUDGraphicsTiles + 1] ; leftmost tile  	ld [hl], a -	ld a, $8 -.asm_3a93c +	ld a, 8 +.loop  	add hl, de  	ld [hl], $76  	dec a -	jr nz, .asm_3a93c +	jr nz, .loop  	add hl, de -	ld a, [wTrainerScreenX] +	ld a, [wHUDGraphicsTiles + 2] ; rightmost tile  	ld [hl], a  	ret @@ -172,8 +172,8 @@ SetupPlayerAndEnemyPokeballs: ; 3a948 (e:6948)  	ld a, $50  	ld [hli], a  	ld [hl], $40 -	ld a, $8 -	ld [wTrainerEngageDistance], a +	ld a, 8 +	ld [wHUDPokeballGfxOffsetX], a  	ld hl, wOAMBuffer  	call WritePokeballOAMData  	ld hl, wEnemyMons diff --git a/engine/menu/main_menu.asm b/engine/menu/main_menu.asm index 3ed2f443..a46abf2a 100755 --- a/engine/menu/main_menu.asm +++ b/engine/menu/main_menu.asm @@ -455,7 +455,7 @@ DisplayOptionMenu: ; 5e8a (1:5e8a)  	ld [wLastMenuItem],a  	inc a  	ld [wLetterPrintingDelayFlags],a -	ld [wTrainerScreenY],a +	ld [wUnusedCD40],a  	ld a,3 ; text speed cursor Y coordinate  	ld [wTopMenuItemY],a  	call SetCursorPositionsFromOptions diff --git a/engine/overworld/hidden_items.asm b/engine/overworld/hidden_items.asm index fc69afc1..1203dd2a 100755 --- a/engine/overworld/hidden_items.asm +++ b/engine/overworld/hidden_items.asm @@ -29,7 +29,7 @@ FoundHiddenItemText: ; 7675b (1d:675b)  	call GiveItem  	jr nc, .BagFull  	ld hl, wObtainedHiddenItemsFlags -	ld a, [wTrainerScreenX] +	ld a, [wHiddenItemOrCoinsIndex]  	ld c, a  	ld b, FLAG_SET  	predef FlagActionPredef @@ -100,7 +100,7 @@ HiddenCoins: ; 76799 (1d:6799)  	ld c, $2  	predef AddBCDPredef  	ld hl, wObtainedHiddenCoinsFlags -	ld a, [wTrainerScreenX] +	ld a, [wHiddenItemOrCoinsIndex]  	ld c, a  	ld b, FLAG_SET  	predef FlagActionPredef diff --git a/engine/overworld/trainers.asm b/engine/overworld/trainers.asm index 2b08997b..a983881d 100755 --- a/engine/overworld/trainers.asm +++ b/engine/overworld/trainers.asm @@ -256,7 +256,7 @@ ReadTrainerScreenPosition: ; 5698e (15:698e)  ; a: distance player to sprite  CheckSpriteCanSeePlayer: ; 569af (15:69af)  	ld b, a -	ld a, [wTrainerEngageDistance]  ; sprite line of sight (engage distance) +	ld a, [wTrainerEngageDistance] ; how far the trainer can see  	cp b  	jr nc, .checkIfLinedUp  	jr .notInLine         ; player too far away | 
