Name the UpdateEnemyHUD predef.

Also start using hp palette constants.
This commit is contained in:
yenatch 2014-06-16 22:52:59 -07:00
parent 8639fcd29b
commit 541a9c7347
9 changed files with 99 additions and 95 deletions

View File

@ -522,7 +522,7 @@ Function38385: ; 38385 (e:4385)
Function38387: ; 38387 Function38387: ; 38387
call UpdateEnemyMonInParty call UpdateEnemyMonInParty
callba Function3e036 callba UpdateEnemyHUD
ld a, $1 ld a, $1
ld [hBGMapMode], a ld [hBGMapMode], a
ld hl, $c6e6 ld hl, $c6e6

View File

@ -2099,7 +2099,7 @@ Function3cd55: ; 3cd55
ld hl, BattleMonHP ld hl, BattleMonHP
ld a, [hli] ld a, [hli]
or [hl] or [hl]
call nz, Function3df48 call nz, UpdatePlayerHUD
ld a, $1 ld a, $1
ld [hBGMapMode], a ld [hBGMapMode], a
@ -2460,7 +2460,6 @@ Function3cfa4: ; 3cfa4
cp BATTLETYPE_CANLOSE cp BATTLETYPE_CANLOSE
jr nz, .asm_3cfe8 jr nz, .asm_3cfe8
predef Functionc658 predef Functionc658
.asm_3cfe8 .asm_3cfe8
ld a, [$c2cc] ld a, [$c2cc]
bit 0, a bit 0, a
@ -3737,7 +3736,7 @@ Function3d7c7: ; 3d7c7
call Function37b6 call Function37b6
.asm_3d82c .asm_3d82c
call Function3e036 call UpdateEnemyHUD
ld a, $1 ld a, $1
ld [hBGMapMode], a ld [hBGMapMode], a
ret ret
@ -4231,7 +4230,7 @@ Function3db5f: ; 3db5f
call Function37b6 call Function37b6
.asm_3dbd6 .asm_3dbd6
call Function3df48 call UpdatePlayerHUD
ld a, $1 ld a, $1
ld [hBGMapMode], a ld [hBGMapMode], a
ret ret
@ -4278,13 +4277,13 @@ BreakAttraction: ; 3dc18
SpikesDamage: ; 3dc23 SpikesDamage: ; 3dc23
ld hl, PlayerScreens ld hl, PlayerScreens
ld de, BattleMonType ld de, BattleMonType
ld bc, Function3df48 ld bc, UpdatePlayerHUD
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr z, .ok jr z, .ok
ld hl, EnemyScreens ld hl, EnemyScreens
ld de, EnemyMonType ld de, EnemyMonType
ld bc, Function3e036 ld bc, UpdateEnemyHUD
.ok .ok
bit SCREENS_SPIKES, [hl] bit SCREENS_SPIKES, [hl]
@ -4758,7 +4757,7 @@ Function3df2c: ; 3df2c
ld hl, PlayerHPPal ld hl, PlayerHPPal
call SetHPPal call SetHPPal
call CheckDanger call CheckDanger
call Function3e043 call DrawEnemyHUD
ld hl, EnemyHPPal ld hl, EnemyHPPal
call SetHPPal call SetHPPal
pop bc pop bc
@ -4769,7 +4768,7 @@ Function3df2c: ; 3df2c
Function3df48:: ; 3df48 UpdatePlayerHUD:: ; 3df48
push hl push hl
push de push de
push bc push bc
@ -4799,7 +4798,7 @@ DrawPlayerHUD: ; 3df58
; HP bar ; HP bar
hlcoord 10, 9 hlcoord 10, 9
ld b, OTPARTYMON ld b, 1
xor a xor a
ld [MonType], a ld [MonType], a
predef DrawPlayerHP predef DrawPlayerHP
@ -4834,7 +4833,7 @@ CheckDanger: ; 3df9e
and a and a
jr nz, .done jr nz, .done
ld a, [PlayerHPPal] ld a, [PlayerHPPal]
cp $2 cp HP_RED
jr z, .danger jr z, .danger
.no_danger .no_danger
@ -4913,25 +4912,28 @@ PrintPlayerHUD: ; 3dfbf
jp PrintLevel jp PrintLevel
; 3e036 ; 3e036
Function3e036:: ; 3e036 UpdateEnemyHUD:: ; 3e036
push hl push hl
push de push de
push bc push bc
call Function3e043 call DrawEnemyHUD
call Function3e127 call UpdateEnemyHPPal
pop bc pop bc
pop de pop de
pop hl pop hl
ret ret
; 3e043 ; 3e043
Function3e043: ; 3e043 DrawEnemyHUD: ; 3e043
xor a xor a
ld [hBGMapMode], a ld [hBGMapMode], a
hlcoord 1, 0 hlcoord 1, 0
lb bc, 4, 11 lb bc, 4, 11
call ClearBox call ClearBox
callba Function2c0c5 callba Function2c0c5
ld a, [TempEnemyMonSpecies] ld a, [TempEnemyMonSpecies]
ld [CurSpecies], a ld [CurSpecies], a
ld [CurPartySpecies], a ld [CurPartySpecies], a
@ -4943,18 +4945,20 @@ Function3e043: ; 3e043
ld h, b ld h, b
ld l, c ld l, c
dec hl dec hl
ld hl, EnemyMonDVs ld hl, EnemyMonDVs
ld de, TempMonDVs ld de, TempMonDVs
ld a, [EnemySubStatus5] ld a, [EnemySubStatus5]
bit SUBSTATUS_TRANSFORMED, a bit SUBSTATUS_TRANSFORMED, a
jr z, .asm_3e080 jr z, .ok
ld hl, $c6f2 ld hl, $c6f2
.asm_3e080 .ok
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a
inc de inc de
ld a, [hl] ld a, [hl]
ld [de], a ld [de], a
ld a, $3 ld a, $3
ld [MonType], a ld [MonType], a
callab GetGender callab GetGender
@ -4967,6 +4971,7 @@ Function3e043: ; 3e043
.asm_3e09a .asm_3e09a
hlcoord 9, 1 hlcoord 9, 1
ld [hl], a ld [hl], a
hlcoord 6, 1 hlcoord 6, 1
push af push af
push hl push hl
@ -4976,16 +4981,15 @@ Function3e043: ; 3e043
pop bc pop bc
jr nz, .asm_3e0be jr nz, .asm_3e0be
ld a, b ld a, b
cp $7f cp " "
jr nz, .asm_3e0b5 jr nz, .asm_3e0b5
dec hl dec hl
.asm_3e0b5 .asm_3e0b5
ld a, [EnemyMonLevel] ld a, [EnemyMonLevel]
ld [TempMonLevel], a ld [TempMonLevel], a
call PrintLevel call PrintLevel
.asm_3e0be .asm_3e0be
ld hl, EnemyMonHP ld hl, EnemyMonHP
ld a, [hli] ld a, [hli]
ld [$ffb5], a ld [$ffb5], a
@ -4997,8 +5001,8 @@ Function3e043: ; 3e043
ld e, a ld e, a
ld d, HP_BAR_LENGTH ld d, HP_BAR_LENGTH
jp .asm_3e11a jp .asm_3e11a
.asm_3e0d1 .asm_3e0d1
xor a xor a
ld [hMultiplicand], a ld [hMultiplicand], a
ld a, HP_BAR_LENGTH_PX ld a, HP_BAR_LENGTH_PX
@ -5042,16 +5046,17 @@ Function3e043: ; 3e043
ld a, HP_BAR_LENGTH ld a, HP_BAR_LENGTH
ld d, a ld d, a
ld c, a ld c, a
.asm_3e11a .asm_3e11a
xor a xor a
ld [$d10a], a ld [$d10a], a
hlcoord 2, 2 hlcoord 2, 2
ld b, $0 ld b, 0
call DrawHPBar call DrawHPBar
ret ret
; 3e127 ; 3e127
Function3e127: ; 3e127 UpdateEnemyHPPal: ; 3e127
ld hl, EnemyHPPal ld hl, EnemyHPPal
call Function3e12e call Function3e12e
ret ret
@ -5074,6 +5079,7 @@ Function3e139: ; 3e139
xor a xor a
ld [hBGMapMode], a ld [hBGMapMode], a
call Function30bf call Function30bf
ld a, [BattleType] ld a, [BattleType]
cp $2 cp $2
jr z, .asm_3e156 jr z, .asm_3e156
@ -5083,20 +5089,21 @@ Function3e139: ; 3e139
call UpdateBattleHuds call UpdateBattleHuds
call EmptyBattleTextBox call EmptyBattleTextBox
call Function309d call Function309d
.asm_3e156 .asm_3e156
ld a, [BattleType] ld a, [BattleType]
cp $6 cp $6
jr nz, .asm_3e165 jr nz, .asm_3e165
callba Function24f13 callba Function24f13
jr .asm_3e175 jr .asm_3e175
.asm_3e165 .asm_3e165
ld a, [InputType] ld a, [InputType]
or a or a
jr z, .asm_3e171 jr z, .asm_3e171
callba Function1de294 callba Function1de294
.asm_3e171 .asm_3e171
call Function3e19b call Function3e19b
ret c ret c
@ -5126,6 +5133,7 @@ Function3e192: ; 3e192
Function3e19b: ; 3e19b Function3e19b: ; 3e19b
call Function3d2f1 call Function3d2f1
jr z, .asm_3e1a8 jr z, .asm_3e1a8
callba LoadBattleMenuDataHeader callba LoadBattleMenuDataHeader
and a and a
ret ret
@ -5135,15 +5143,16 @@ Function3e19b: ; 3e19b
ld a, [$cd2b] ld a, [$cd2b]
and a and a
ret z ret z
ld hl, $cd2a ld hl, $cd2a
bit 4, [hl] bit 4, [hl]
jr nz, .asm_3e1c5 jr nz, .asm_3e1c5
ld hl, BattleText_0x81863 ld hl, BattleText_0x81863
call StdBattleTextBox call StdBattleTextBox
ld c, $3c ld c, 60
call DelayFrames call DelayFrames
.asm_3e1c5 .asm_3e1c5
scf scf
ret ret
; 3e1c7 ; 3e1c7
@ -7578,7 +7587,7 @@ Function3ee3b: ; 3ee3b
call Function3ecab call Function3ecab
callab Function3ec2c callab Function3ec2c
callab BadgeStatBoosts callab BadgeStatBoosts
callab Function3df48 callab UpdatePlayerHUD
call EmptyBattleTextBox call EmptyBattleTextBox
call Function309d call Function309d
ld a, $1 ld a, $1
@ -8394,7 +8403,7 @@ Function3f4dd: ; 3f4dd
call ClearSprites call ClearSprites
ld a, [IsInBattle] ld a, [IsInBattle]
cp $1 cp $1
call z, Function3e036 call z, UpdateEnemyHUD
ld a, $1 ld a, $1
ld [hBGMapMode], a ld [hBGMapMode], a
ret ret

View File

@ -180,7 +180,7 @@ CheckPlayerTurn:
call StdBattleTextBox call StdBattleTextBox
call CantMove call CantMove
call UpdateBattleMonInParty call UpdateBattleMonInParty
ld hl, Function3df48 ld hl, UpdatePlayerHUD
call CallBattleCore call CallBattleCore
ld a, $1 ld a, $1
ld [$ffd4], a ld [$ffd4], a
@ -428,7 +428,7 @@ CheckEnemyTurn: ; 3421f
call StdBattleTextBox call StdBattleTextBox
call CantMove call CantMove
call UpdateEnemyMonInParty call UpdateEnemyMonInParty
ld hl, Function3e036 ld hl, UpdateEnemyHUD
call CallBattleCore call CallBattleCore
ld a, $1 ld a, $1
ld [$ffd4], a ld [$ffd4], a
@ -663,7 +663,7 @@ HitConfusion: ; 343a5
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
call z, PlayFXAnimID call z, PlayFXAnimID
ld hl, Function3df48 ld hl, UpdatePlayerHUD
call CallBattleCore call CallBattleCore
ld a, $1 ld a, $1
ld [$ffd4], a ld [$ffd4], a
@ -9131,7 +9131,7 @@ BattleCommand1a: ; 37380
call Function37ed5 call Function37ed5
ret nc ret nc
callba DrawPlayerHUD callba DrawPlayerHUD
callba Function3e043 callba DrawEnemyHUD
call WaitBGMap call WaitBGMap
jp RefreshBattleHuds jp RefreshBattleHuds
; 373c9 ; 373c9

View File

@ -15,6 +15,10 @@ PARTY_OT_NAME EQU 5
ENEMY_OT_NAME EQU 6 ENEMY_OT_NAME EQU 6
TRAINER_NAME EQU 7 TRAINER_NAME EQU 7
; hp
HP_GREEN EQU 0
HP_YELLOW EQU 1
HP_RED EQU 2
; boxes ; boxes
MONS_PER_BOX EQU 20 MONS_PER_BOX EQU 20

View File

@ -775,7 +775,7 @@ SetHPPal:: ; 334e
GetHPPal:: ; 3353 GetHPPal:: ; 3353
; Get palette for hp bar pixel length e in d. ; Get palette for hp bar pixel length e in d.
ld d, 0 ; green ld d, HP_GREEN
ld a, e ld a, e
cp 24 cp 24
ret nc ret nc

View File

@ -130,8 +130,8 @@ RefreshBattleHuds:: ; 39c9
; 39d4 ; 39d4
UpdateBattleHuds:: ; 39d4 UpdateBattleHuds:: ; 39d4
callba Function3df48 callba UpdatePlayerHUD
callba Function3e036 callba UpdateEnemyHUD
ret ret
; 39e1 ; 39e1

View File

@ -3193,7 +3193,7 @@ Functionf8b9: ; f8b9
ld [$cfa9], a ld [$cfa9], a
ld [MonType], a ld [MonType], a
ld c, NUM_MOVES ld c, NUM_MOVES
.asm_f8ce .loop
ld a, [hli] ld a, [hli]
and a and a
ret z ret z
@ -3214,30 +3214,36 @@ Functionf8b9: ; f8b9
inc [hl] inc [hl]
pop hl pop hl
dec c dec c
jr nz, .asm_f8ce jr nz, .loop
ret ret
; f8ec ; f8ec
Functionf8ec: ; f8ec Functionf8ec: ; f8ec
ld a, [StringBuffer1] ld a, [StringBuffer1 + 0]
push af push af
ld a, [$d074] ld a, [StringBuffer1 + 1]
push af push af
ld a, [MonType] ld a, [MonType]
and a and a
ld hl, PartyMon1Moves ld hl, PartyMon1Moves
ld bc, PartyMon2 - PartyMon1 ld bc, PartyMon2 - PartyMon1
jr z, .asm_f91a jr z, .asm_f91a
ld hl, OTPartyMon1Moves ld hl, OTPartyMon1Moves
dec a dec a
jr z, .asm_f91a jr z, .asm_f91a
ld hl, TempMonMoves ld hl, TempMonMoves
dec a dec a
jr z, .asm_f915 jr z, .asm_f915
ld hl, TempMonMoves ld hl, TempMonMoves
dec a dec a
jr z, .asm_f915 jr z, .asm_f915
ld hl, BattleMonMoves ld hl, BattleMonMoves
.asm_f915 .asm_f915
@ -3250,6 +3256,7 @@ Functionf8ec: ; f8ec
.asm_f91d .asm_f91d
ld a, [hl] ld a, [hl]
dec a dec a
push hl push hl
ld hl, Moves + MOVE_PP ld hl, Moves + MOVE_PP
ld bc, MOVE_LENGTH ld bc, MOVE_LENGTH
@ -3260,18 +3267,19 @@ Functionf8ec: ; f8ec
ld de, StringBuffer1 ld de, StringBuffer1
ld [de], a ld [de], a
pop hl pop hl
push bc push bc
ld bc, PartyMon1PP - PartyMon1Moves ld bc, PartyMon1PP - PartyMon1Moves
ld a, [MonType] ld a, [MonType]
cp WILDMON cp WILDMON
jr nz, .asm_f942 jr nz, .asm_f942
ld bc, EnemyMonPP - EnemyMonMoves ld bc, EnemyMonPP - EnemyMonMoves
.asm_f942 .asm_f942
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
and $c0 and $c0
pop bc pop bc
or b or b
ld hl, $d074 ld hl, $d074
ld [hl], a ld [hl], a
@ -3282,10 +3290,11 @@ Functionf8ec: ; f8ec
ld a, [hl] ld a, [hl]
and $3f and $3f
ld [$d265], a ld [$d265], a
pop af pop af
ld [$d074], a ld [StringBuffer1 + 1], a
pop af pop af
ld [StringBuffer1], a ld [StringBuffer1 + 0], a
ret ret
; f963 ; f963

View File

@ -6823,7 +6823,8 @@ Function746e: ; 746e
jp CopyBytes jp CopyBytes
; 747a ; 747a
Function747a: ; 747a Predef1: ; 747a
; not used
ret ret
; 747b ; 747b
@ -6837,11 +6838,11 @@ Function8000: ; 8000
call WhiteBGMap call WhiteBGMap
call ClearSprites call ClearSprites
ld hl, TileMap ld hl, TileMap
ld bc, $0168 ld bc, TileMapEnd - TileMap
ld a, " " ld a, " "
call ByteFill call ByteFill
ld hl, AttrMap ld hl, AttrMap
ld bc, $0168 ld bc, AttrMapEnd - AttrMap
ld a, $7 ld a, $7
call ByteFill call ByteFill
call Function3200 call Function3200
@ -7754,7 +7755,7 @@ PredefPointers:: ; 856b
; address, bank ; address, bank
add_predef LearnMove ; $0 add_predef LearnMove ; $0
add_predef Function747a add_predef Predef1
add_predef Functionc658 add_predef Functionc658
add_predef FlagPredef add_predef FlagPredef
add_predef Functionc699 add_predef Functionc699
@ -7771,10 +7772,10 @@ PredefPointers:: ; 856b
add_predef GetTMHMMove add_predef GetTMHMMove
add_predef Function28eef ; $ 10 add_predef Function28eef ; $ 10
add_predef PrintMoveDesc add_predef PrintMoveDesc
add_predef Function3df48 ; UpdatePlayerHUD add_predef UpdatePlayerHUD
add_predef FillBox add_predef FillBox
add_predef Function3d873 add_predef Function3d873
add_predef Function3e036 ; UpdateEnemyHUD add_predef UpdateEnemyHUD
add_predef StartBattle add_predef StartBattle
add_predef FillInExpBar add_predef FillInExpBar
add_predef Function3f43d ; $18 add_predef Function3f43d ; $18
@ -8827,17 +8828,18 @@ Functionc658: ; c658
; c677 ; c677
Functionc677: ; c677 Functionc677: ; c677
ld a, $0 ld a, PartyMon1Species - PartyMon1
call GetPartyParamLocation call GetPartyParamLocation
ld d, h ld d, h
ld e, l ld e, l
ld hl, $0020 ld hl, PartyMon1Status - PartyMon1Species
add hl, de add hl, de
xor a xor a
ld [hli], a ld [hli], a
ld [hl], a ld [hl], a
ld hl, $0024 ld hl, PartyMon1MaxHP - PartyMon1Species
add hl, de add hl, de
; bc = PartyMon1HP - PartyMon1Species
ld b, h ld b, h
ld c, l ld c, l
dec bc dec bc
@ -59703,48 +59705,27 @@ Strings50a42: ; 50a42
dw OTName dw OTName
dw OTName dw OTName
.Youngster .Youngster db "たんパン@"
db "たんパン@" .BugCatcher db "むしとり@"
.BugCatcher .Lass db "ミニスカ@"
db "むしとり@" .JrTrainerM db "ボーイ@"
.Lass .JrTrainerF db "ガール@"
db "ミニスカ@" .Pokemaniac db "マニア@"
.JrTrainerM .SuperNerd db "りかけい@"
db "ボーイ@" .Burglar db "どろぼう@"
.JrTrainerF .Engineer db "ォヤジ@"
db "ガール@" .Jack db "ジャック@"
.Pokemaniac .Swimmer db "かいパン@"
db "マニア@" .Beauty db "おねえさん@"
.SuperNerd .Rocker db "グループ@"
db "りかけい@" .Juggler db "ジャグラー@"
.Burglar .Blackbelt db "からて@"
db "どろぼう@" .ProfOak db "ォーキド@"
.Engineer .Chief db "チーフ@"
db "ォヤジ@" .Scientist db "けんきゅういん@"
.Jack .Rocket db "だんいん@"
db "ジャック@" .CooltrainerM db "エりート♂@"
.Swimmer .CooltrainerF db "エりート♀@"
db "かいパン@"
.Beauty
db "おねえさん@"
.Rocker
db "グループ@"
.Juggler
db "ジャグラー@"
.Blackbelt
db "からて@"
.ProfOak
db "ォーキド@"
.Chief
db "チーフ@"
.Scientist
db "けんきゅういん@"
.Rocket
db "だんいん@"
.CooltrainerM
db "エりート♂@"
.CooltrainerF
db "エりート♀@"
; 50b0a ; 50b0a
@ -116510,7 +116491,7 @@ Function178000:
callba DrawPlayerHUD callba DrawPlayerHUD
ld hl, PlayerHPPal ; $cd99 ld hl, PlayerHPPal ; $cd99
call SetHPPal call SetHPPal
callba Function3e043 callba DrawEnemyHUD
ld hl, EnemyHPPal ; $cd9a ld hl, EnemyHPPal ; $cd9a
call SetHPPal call SetHPPal
callba Function3ee27 callba Function3ee27

View File

@ -694,6 +694,7 @@ AttrMap:: ; cdd9
; bit 3: vram bank ; bit 3: vram bank
; bit 0-2: palette id ; bit 0-2: palette id
ds SCREEN_WIDTH * SCREEN_HEIGHT ds SCREEN_WIDTH * SCREEN_HEIGHT
AttrMapEnd::
ds 30 ds 30