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
call UpdateEnemyMonInParty
callba Function3e036
callba UpdateEnemyHUD
ld a, $1
ld [hBGMapMode], a
ld hl, $c6e6

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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