mid-kid baa0dc5a96 Organize the engine/ directory
This is an informed attempt at reorganizing the engine/ directory by
creating categorized subdirectories, in order to make it easier to
navigate and find things.

The directories created are as follows:
* engine/game: Contains all "minigames", things like the unown puzzle
and slot machine.
* engine/gfx: Contains all handling of graphics. From loading palettes
to playing animations.
* engine/link: Contains all multiplayer functionality.
* engine/menu: Contains all generic/misc. menus and menu code.
Other, more specialized menus are in their own subdirectories (pokedex,
pokegear, party menu, etc).
* engine/overworld: Contains all handling of the overworld. From loading
and connecting maps to wild encounters and the scripting engine.
* engine/pokegear: In the same vein as engine/pokedex, except it could
use some more splitting up.
* engine/pokemon: Contains everything related to manipulating pokemon
data. From the pokemon storage system to evolution and mail.
* engine/printer: Contains everything related to printing things as well
as the printer communication.
* engine/title: Contains intro sequences, title screens and credits.
2018-03-13 13:21:40 +01:00

111 lines
1.3 KiB
NASM
Executable File

HealParty: ; c658
xor a
ld [wCurPartyMon], a
ld hl, wPartySpecies
.loop
ld a, [hli]
cp -1
jr z, .done
cp EGG
jr z, .next
push hl
call HealPartyMon
pop hl
.next
ld a, [wCurPartyMon]
inc a
ld [wCurPartyMon], a
jr .loop
.done
ret
HealPartyMon: ; c677
ld a, MON_SPECIES
call GetPartyParamLocation
ld d, h
ld e, l
ld hl, MON_STATUS
add hl, de
xor a
ld [hli], a
ld [hl], a
ld hl, MON_MAXHP
add hl, de
; bc = MON_HP
ld b, h
ld c, l
dec bc
dec bc
ld a, [hli]
ld [bc], a
inc bc
ld a, [hl]
ld [bc], a
farcall RestoreAllPP
ret
ComputeHPBarPixels: ; c699
; e = bc * (6 * 8) / de
ld a, b
or c
jr z, .zero
push hl
xor a
ld [hMultiplicand + 0], a
ld a, b
ld [hMultiplicand + 1], a
ld a, c
ld [hMultiplicand + 2], a
ld a, 6 * 8
ld [hMultiplier], a
call Multiply
; We need de to be under 256 because hDivisor is only 1 byte.
ld a, d
and a
jr z, .divide
; divide de and hProduct by 4
srl d
rr e
srl d
rr e
ld a, [hProduct + 2]
ld b, a
ld a, [hProduct + 3]
srl b
rr a
srl b
rr a
ld [hDividend + 3], a
ld a, b
ld [hDividend + 2], a
.divide
ld a, e
ld [hDivisor], a
ld b, 4
call Divide
ld a, [hQuotient + 2]
ld e, a
pop hl
and a
ret nz
ld e, 1
ret
.zero
ld e, 0
ret
AnimateHPBar: ; c6e0
call WaitBGMap
call _AnimateHPBar
call WaitBGMap
ret