2018-06-24 14:09:41 +00:00
|
|
|
BattleStart_TrainerHuds:
|
2015-12-13 19:15:16 +00:00
|
|
|
ld a, $e4
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rOBP0], a
|
2015-12-13 19:15:16 +00:00
|
|
|
call LoadBallIconGFX
|
|
|
|
call ShowPlayerMonsRemaining
|
|
|
|
ld a, [wBattleMode]
|
|
|
|
dec a
|
|
|
|
ret z
|
|
|
|
jp ShowOTTrainerMonsRemaining
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
EnemySwitch_TrainerHud:
|
2015-12-13 19:15:16 +00:00
|
|
|
ld a, $e4
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rOBP0], a
|
2015-12-13 19:15:16 +00:00
|
|
|
call LoadBallIconGFX
|
|
|
|
jp ShowOTTrainerMonsRemaining
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ShowPlayerMonsRemaining:
|
2015-12-13 19:15:16 +00:00
|
|
|
call DrawPlayerPartyIconHUDBorder
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wPartyMon1HP
|
|
|
|
ld de, wPartyCount
|
2015-12-13 19:15:16 +00:00
|
|
|
call StageBallTilesData
|
|
|
|
; ldpixel wPlaceBallsX, 12, 12
|
|
|
|
ld a, 12 * 8
|
|
|
|
ld hl, wPlaceBallsX
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
|
|
|
ld a, 8
|
|
|
|
ld [wPlaceBallsDirection], a
|
2018-01-30 19:52:46 +00:00
|
|
|
ld hl, wVirtualOAMSprite00
|
2015-12-13 19:15:16 +00:00
|
|
|
jp LoadTrainerHudOAM
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
ShowOTTrainerMonsRemaining:
|
2015-12-13 19:15:16 +00:00
|
|
|
call DrawEnemyHUDBorder
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wOTPartyMon1HP
|
|
|
|
ld de, wOTPartyCount
|
2015-12-13 19:15:16 +00:00
|
|
|
call StageBallTilesData
|
|
|
|
; ldpixel wPlaceBallsX, 9, 4
|
|
|
|
ld hl, wPlaceBallsX
|
|
|
|
ld a, 9 * 8
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], 4 * 8
|
|
|
|
ld a, -8
|
|
|
|
ld [wPlaceBallsDirection], a
|
2018-01-30 19:52:46 +00:00
|
|
|
ld hl, wVirtualOAMSprite00 + PARTY_LENGTH * SPRITEOAMSTRUCT_LENGTH
|
2015-12-13 19:15:16 +00:00
|
|
|
jp LoadTrainerHudOAM
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
StageBallTilesData:
|
2015-12-13 19:15:16 +00:00
|
|
|
ld a, [de]
|
|
|
|
push af
|
2020-11-04 00:53:07 +00:00
|
|
|
ld de, wBattleHUDTiles
|
2015-12-13 19:15:16 +00:00
|
|
|
ld c, PARTY_LENGTH
|
|
|
|
ld a, $34 ; empty slot
|
|
|
|
.loop1
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec c
|
|
|
|
jr nz, .loop1
|
|
|
|
pop af
|
2020-11-04 00:53:07 +00:00
|
|
|
|
|
|
|
ld de, wBattleHUDTiles
|
2015-12-13 19:15:16 +00:00
|
|
|
.loop2
|
|
|
|
push af
|
|
|
|
call .GetHUDTile
|
|
|
|
inc de
|
|
|
|
pop af
|
|
|
|
dec a
|
|
|
|
jr nz, .loop2
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.GetHUDTile:
|
2015-12-13 19:15:16 +00:00
|
|
|
ld a, [hli]
|
|
|
|
and a
|
|
|
|
jr nz, .got_hp
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
ld b, $33 ; fainted
|
|
|
|
jr z, .fainted
|
|
|
|
|
|
|
|
.got_hp
|
|
|
|
dec hl
|
2016-05-10 16:31:49 +00:00
|
|
|
dec hl
|
|
|
|
dec hl
|
2015-12-13 19:15:16 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
ld b, $32 ; statused
|
|
|
|
jr nz, .load
|
|
|
|
dec b ; normal
|
|
|
|
jr .load
|
|
|
|
|
|
|
|
.fainted
|
|
|
|
dec hl
|
2016-05-10 16:31:49 +00:00
|
|
|
dec hl
|
|
|
|
dec hl
|
2015-12-13 19:15:16 +00:00
|
|
|
|
|
|
|
.load
|
|
|
|
ld a, b
|
|
|
|
ld [de], a
|
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH + MON_HP - MON_STATUS
|
|
|
|
add hl, bc
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DrawPlayerHUDBorder:
|
2015-12-13 19:15:16 +00:00
|
|
|
ld hl, .tiles
|
|
|
|
ld de, wTrainerHUDTiles
|
2018-07-29 05:09:12 +00:00
|
|
|
ld bc, .tiles_end - .tiles
|
2015-12-13 19:15:16 +00:00
|
|
|
call CopyBytes
|
|
|
|
hlcoord 18, 10
|
|
|
|
ld de, -1 ; start on right
|
|
|
|
jr PlaceHUDBorderTiles
|
|
|
|
|
|
|
|
.tiles
|
|
|
|
db $73 ; right side
|
|
|
|
db $77 ; bottom right
|
|
|
|
db $6f ; bottom left
|
|
|
|
db $76 ; bottom side
|
2018-07-29 05:09:12 +00:00
|
|
|
.tiles_end
|
2015-12-13 19:15:16 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DrawPlayerPartyIconHUDBorder:
|
2015-12-13 19:15:16 +00:00
|
|
|
ld hl, .tiles
|
|
|
|
ld de, wTrainerHUDTiles
|
2018-07-29 05:09:12 +00:00
|
|
|
ld bc, .tiles_end - .tiles
|
2015-12-13 19:15:16 +00:00
|
|
|
call CopyBytes
|
|
|
|
hlcoord 18, 10
|
|
|
|
ld de, -1 ; start on right
|
|
|
|
jr PlaceHUDBorderTiles
|
|
|
|
|
|
|
|
.tiles
|
|
|
|
db $73 ; right side
|
|
|
|
db $5c ; bottom right
|
|
|
|
db $6f ; bottom left
|
|
|
|
db $76 ; bottom side
|
2018-07-29 05:09:12 +00:00
|
|
|
.tiles_end
|
2015-12-13 19:15:16 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
DrawEnemyHUDBorder:
|
2015-12-13 19:15:16 +00:00
|
|
|
ld hl, .tiles
|
|
|
|
ld de, wTrainerHUDTiles
|
2018-07-29 05:09:12 +00:00
|
|
|
ld bc, .tiles_end - .tiles
|
2015-12-13 19:15:16 +00:00
|
|
|
call CopyBytes
|
|
|
|
hlcoord 1, 2
|
|
|
|
ld de, 1 ; start on left
|
|
|
|
call PlaceHUDBorderTiles
|
|
|
|
ld a, [wBattleMode]
|
|
|
|
dec a
|
|
|
|
ret nz
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wTempEnemyMonSpecies]
|
2015-12-13 19:15:16 +00:00
|
|
|
dec a
|
|
|
|
call CheckCaughtMon
|
|
|
|
ret z
|
|
|
|
hlcoord 1, 1
|
|
|
|
ld [hl], $5d
|
|
|
|
ret
|
|
|
|
|
|
|
|
.tiles
|
|
|
|
db $6d ; left side
|
|
|
|
db $74 ; bottom left
|
|
|
|
db $78 ; bottom right
|
|
|
|
db $76 ; bottom side
|
2018-07-29 05:09:12 +00:00
|
|
|
.tiles_end
|
2015-12-13 19:15:16 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
PlaceHUDBorderTiles:
|
2018-07-29 05:40:23 +00:00
|
|
|
ld a, [wTrainerHUDTiles + 0]
|
2015-12-13 19:15:16 +00:00
|
|
|
ld [hl], a
|
|
|
|
ld bc, SCREEN_WIDTH
|
|
|
|
add hl, bc
|
2018-07-29 05:40:23 +00:00
|
|
|
ld a, [wTrainerHUDTiles + 1]
|
2015-12-13 19:15:16 +00:00
|
|
|
ld [hl], a
|
2018-07-29 05:09:12 +00:00
|
|
|
ld b, 8
|
2015-12-13 19:15:16 +00:00
|
|
|
.loop
|
|
|
|
add hl, de
|
2018-07-29 05:40:23 +00:00
|
|
|
ld a, [wTrainerHUDTiles + 3]
|
2015-12-13 19:15:16 +00:00
|
|
|
ld [hl], a
|
|
|
|
dec b
|
|
|
|
jr nz, .loop
|
|
|
|
add hl, de
|
2018-07-29 05:40:23 +00:00
|
|
|
ld a, [wTrainerHUDTiles + 2]
|
2015-12-13 19:15:16 +00:00
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
LinkBattle_TrainerHuds:
|
2015-12-13 19:15:16 +00:00
|
|
|
call LoadBallIconGFX
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wPartyMon1HP
|
|
|
|
ld de, wPartyCount
|
2015-12-13 19:15:16 +00:00
|
|
|
call StageBallTilesData
|
|
|
|
ld hl, wPlaceBallsX
|
|
|
|
ld a, 10 * 8
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], 8 * 8
|
2018-07-29 05:09:12 +00:00
|
|
|
ld a, 8
|
2015-12-13 19:15:16 +00:00
|
|
|
ld [wPlaceBallsDirection], a
|
2018-01-30 19:52:46 +00:00
|
|
|
ld hl, wVirtualOAMSprite00
|
2015-12-13 19:15:16 +00:00
|
|
|
call LoadTrainerHudOAM
|
|
|
|
|
2018-01-23 22:39:09 +00:00
|
|
|
ld hl, wOTPartyMon1HP
|
|
|
|
ld de, wOTPartyCount
|
2015-12-13 19:15:16 +00:00
|
|
|
call StageBallTilesData
|
|
|
|
ld hl, wPlaceBallsX
|
|
|
|
ld a, 10 * 8
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], 13 * 8
|
2018-01-30 19:52:46 +00:00
|
|
|
ld hl, wVirtualOAMSprite00 + PARTY_LENGTH * SPRITEOAMSTRUCT_LENGTH
|
2015-12-13 19:15:16 +00:00
|
|
|
jp LoadTrainerHudOAM
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
LoadTrainerHudOAM:
|
2020-11-04 00:53:07 +00:00
|
|
|
ld de, wBattleHUDTiles
|
2015-12-13 19:15:16 +00:00
|
|
|
ld c, PARTY_LENGTH
|
|
|
|
.loop
|
|
|
|
ld a, [wPlaceBallsY]
|
2018-01-10 18:47:57 +00:00
|
|
|
ld [hli], a ; y
|
2015-12-13 19:15:16 +00:00
|
|
|
ld a, [wPlaceBallsX]
|
2018-01-10 18:47:57 +00:00
|
|
|
ld [hli], a ; x
|
2015-12-13 19:15:16 +00:00
|
|
|
ld a, [de]
|
2018-01-10 18:47:57 +00:00
|
|
|
ld [hli], a ; tile id
|
|
|
|
ld a, PAL_BATTLE_OB_YELLOW
|
|
|
|
ld [hli], a ; attributes
|
2015-12-13 19:15:16 +00:00
|
|
|
ld a, [wPlaceBallsX]
|
|
|
|
ld b, a
|
|
|
|
ld a, [wPlaceBallsDirection]
|
|
|
|
add b
|
|
|
|
ld [wPlaceBallsX], a
|
|
|
|
inc de
|
|
|
|
dec c
|
|
|
|
jr nz, .loop
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
LoadBallIconGFX:
|
2015-12-13 19:15:16 +00:00
|
|
|
ld de, .gfx
|
2017-12-28 12:32:33 +00:00
|
|
|
ld hl, vTiles0 tile $31
|
2015-12-13 19:15:16 +00:00
|
|
|
lb bc, BANK(LoadBallIconGFX), 4
|
2020-05-18 15:59:48 +00:00
|
|
|
call Get2bppViaHDMA
|
2015-12-13 19:15:16 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.gfx
|
2015-12-13 19:15:16 +00:00
|
|
|
INCBIN "gfx/battle/balls.2bpp"
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
_ShowLinkBattleParticipants:
|
2015-12-13 19:15:16 +00:00
|
|
|
call ClearBGPalettes
|
|
|
|
call LoadFontsExtra
|
|
|
|
hlcoord 2, 3
|
|
|
|
ld b, 9
|
|
|
|
ld c, 14
|
2019-04-08 12:15:10 +00:00
|
|
|
call Textbox
|
2015-12-13 19:15:16 +00:00
|
|
|
hlcoord 4, 5
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wPlayerName
|
2015-12-13 19:15:16 +00:00
|
|
|
call PlaceString
|
|
|
|
hlcoord 4, 10
|
2018-01-23 22:39:09 +00:00
|
|
|
ld de, wOTPlayerName
|
2015-12-13 19:15:16 +00:00
|
|
|
call PlaceString
|
|
|
|
hlcoord 9, 8
|
2017-12-09 17:24:50 +00:00
|
|
|
ld a, "<BOLD_V>"
|
2015-12-13 19:15:16 +00:00
|
|
|
ld [hli], a
|
2017-12-09 17:24:50 +00:00
|
|
|
ld [hl], "<BOLD_S>"
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall LinkBattle_TrainerHuds ; no need to farcall
|
2016-06-06 22:23:00 +00:00
|
|
|
ld b, SCGB_DIPLOMA
|
2015-12-13 19:15:16 +00:00
|
|
|
call GetSGBLayout
|
|
|
|
call SetPalettes
|
|
|
|
ld a, $e4
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rOBP0], a
|
2015-12-13 19:15:16 +00:00
|
|
|
ret
|