2018-01-24 08:17:05 -08:00
|
|
|
; HealMachineAnim.Jumptable indexes
|
2018-01-17 21:57:06 -08:00
|
|
|
const_def
|
|
|
|
const HEALMACHINESTATE_LOADGFX
|
|
|
|
const HEALMACHINESTATE_PCLOADBALLS
|
|
|
|
const HEALMACHINESTATE_HOFLOADBALLS
|
|
|
|
const HEALMACHINESTATE_PLAYMUSIC
|
|
|
|
const HEALMACHINESTATE_HOFPLAYSFX
|
|
|
|
const HEALMACHINESTATE_FINISH
|
|
|
|
|
2018-01-24 08:17:05 -08:00
|
|
|
HealMachineAnim: ; 12324
|
2015-11-11 13:11:08 -08:00
|
|
|
; If you have no Pokemon, don't change the buffer. This can lead to some glitchy effects if you have no Pokemon.
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wPartyCount]
|
2015-11-11 13:11:08 -08:00
|
|
|
and a
|
|
|
|
ret z
|
2018-01-23 14:39:09 -08:00
|
|
|
; The location of the healing machine relative to the player is stored in wScriptVar.
|
2015-11-11 13:11:08 -08:00
|
|
|
; 0: Up and left (Pokemon Center)
|
|
|
|
; 1: Left (Elm's Lab)
|
|
|
|
; 2: Up (Hall of Fame)
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wScriptVar]
|
|
|
|
ld [wBuffer1], a
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [rOBP1]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wBuffer2], a
|
2015-11-11 13:11:08 -08:00
|
|
|
call .DoJumptableFunctions
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBuffer2]
|
2015-12-09 08:38:40 -08:00
|
|
|
call DmgToCgbObjPal1
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
|
|
|
; 1233e
|
|
|
|
|
|
|
|
.DoJumptableFunctions: ; 1233e
|
|
|
|
xor a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wBuffer3], a
|
2015-11-11 13:11:08 -08:00
|
|
|
.jumpable_loop
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBuffer1]
|
2015-11-11 13:11:08 -08:00
|
|
|
ld e, a
|
|
|
|
ld d, 0
|
|
|
|
ld hl, .Pointers
|
|
|
|
add hl, de
|
2016-05-04 08:46:23 -07:00
|
|
|
add hl, de
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBuffer3]
|
2015-11-11 13:11:08 -08:00
|
|
|
ld e, a
|
|
|
|
inc a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wBuffer3], a
|
2015-11-11 13:11:08 -08:00
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
2018-01-17 21:57:06 -08:00
|
|
|
cp HEALMACHINESTATE_FINISH
|
2015-11-11 13:11:08 -08:00
|
|
|
jr z, .finish
|
|
|
|
ld hl, .Jumptable
|
|
|
|
rst JumpTable
|
|
|
|
jr .jumpable_loop
|
|
|
|
|
|
|
|
.finish
|
|
|
|
ret
|
|
|
|
; 12365
|
|
|
|
|
|
|
|
.Pointers: ; 12365
|
2018-01-11 22:40:20 -08:00
|
|
|
; entries correspond to HEALMACHINE_* constants
|
2015-11-11 13:11:08 -08:00
|
|
|
dw .Pokecenter
|
|
|
|
dw .ElmLab
|
|
|
|
dw .HallOfFame
|
|
|
|
; 1236b
|
|
|
|
|
2018-01-17 21:57:06 -08:00
|
|
|
healmachineanimseq: MACRO
|
|
|
|
rept _NARG
|
|
|
|
db HEALMACHINESTATE_\1
|
|
|
|
shift
|
|
|
|
endr
|
|
|
|
ENDM
|
|
|
|
|
2015-11-11 13:11:08 -08:00
|
|
|
.Pokecenter: ; 1236b
|
2018-01-17 21:57:06 -08:00
|
|
|
healmachineanimseq LOADGFX, PCLOADBALLS, PLAYMUSIC, FINISH
|
2015-11-11 13:11:08 -08:00
|
|
|
.ElmLab: ; 1236f
|
2018-01-17 21:57:06 -08:00
|
|
|
healmachineanimseq LOADGFX, PCLOADBALLS, PLAYMUSIC, FINISH
|
2015-11-11 13:11:08 -08:00
|
|
|
.HallOfFame: ; 12373
|
2018-01-17 21:57:06 -08:00
|
|
|
healmachineanimseq LOADGFX, HOFLOADBALLS, HOFPLAYSFX, FINISH
|
2015-11-11 13:11:08 -08:00
|
|
|
; 12377
|
|
|
|
|
|
|
|
.Jumptable: ; 12377
|
2018-01-17 21:57:06 -08:00
|
|
|
; entries correspond to HEALMACHINESTATE_* constants
|
2015-11-11 13:11:08 -08:00
|
|
|
dw .LoadGFX
|
|
|
|
dw .PC_LoadBallsOntoMachine
|
|
|
|
dw .HOF_LoadBallsOntoMachine
|
|
|
|
dw .PlayHealMusic
|
|
|
|
dw .HOF_PlaySFX
|
|
|
|
dw .dummy_5 ; never encountered
|
|
|
|
; 12383
|
|
|
|
|
|
|
|
.LoadGFX: ; 12383
|
|
|
|
call .LoadPalettes
|
|
|
|
ld de, .HealMachineGFX
|
2017-12-28 04:32:33 -08:00
|
|
|
ld hl, vTiles0 tile $7c
|
2018-01-10 10:47:57 -08:00
|
|
|
lb bc, BANK(.HealMachineGFX), 2
|
2015-11-11 13:11:08 -08:00
|
|
|
call Request2bpp
|
|
|
|
ret
|
|
|
|
; 12393
|
|
|
|
|
|
|
|
.PC_LoadBallsOntoMachine: ; 12393
|
2018-01-30 11:52:46 -08:00
|
|
|
ld hl, wVirtualOAMSprite32
|
2016-01-10 14:44:09 -08:00
|
|
|
ld de, .PC_ElmsLab_OAM
|
2015-11-11 13:11:08 -08:00
|
|
|
call .PlaceHealingMachineTile
|
|
|
|
call .PlaceHealingMachineTile
|
|
|
|
jr .LoadBallsOntoMachine
|
|
|
|
|
|
|
|
.HOF_LoadBallsOntoMachine: ; 123a1
|
2018-01-30 11:52:46 -08:00
|
|
|
ld hl, wVirtualOAMSprite32
|
2016-01-10 14:44:09 -08:00
|
|
|
ld de, .HOF_OAM
|
2015-11-11 13:11:08 -08:00
|
|
|
|
|
|
|
.LoadBallsOntoMachine: ; 123a7
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wPartyCount]
|
2015-11-11 13:11:08 -08:00
|
|
|
ld b, a
|
|
|
|
.party_loop
|
|
|
|
call .PlaceHealingMachineTile
|
|
|
|
push de
|
|
|
|
ld de, SFX_SECOND_PART_OF_ITEMFINDER
|
|
|
|
call PlaySFX
|
|
|
|
pop de
|
|
|
|
ld c, 30
|
|
|
|
call DelayFrames
|
|
|
|
dec b
|
|
|
|
jr nz, .party_loop
|
|
|
|
ret
|
|
|
|
; 123bf
|
|
|
|
|
|
|
|
.PlayHealMusic: ; 123bf
|
|
|
|
ld de, MUSIC_HEAL
|
|
|
|
call PlayMusic
|
|
|
|
jp .FlashPalettes8Times
|
|
|
|
; 123c8
|
|
|
|
|
|
|
|
.HOF_PlaySFX: ; 123c8
|
|
|
|
ld de, SFX_GAME_FREAK_LOGO_GS
|
|
|
|
call PlaySFX
|
|
|
|
call .FlashPalettes8Times
|
|
|
|
call WaitSFX
|
|
|
|
ld de, SFX_BOOT_PC
|
|
|
|
call PlaySFX
|
|
|
|
ret
|
|
|
|
; 123db
|
|
|
|
|
2016-04-10 12:01:49 -07:00
|
|
|
.dummy_5 ; 123db
|
2015-11-11 13:11:08 -08:00
|
|
|
ret
|
|
|
|
; 123dc
|
|
|
|
|
2016-01-10 14:44:09 -08:00
|
|
|
.PC_ElmsLab_OAM: ; 123dc
|
2017-12-26 17:33:41 -08:00
|
|
|
dsprite 4, 0, 4, 2, $7c, PAL_OW_TREE | OBP_NUM
|
|
|
|
dsprite 4, 0, 4, 6, $7c, PAL_OW_TREE | OBP_NUM
|
|
|
|
dsprite 4, 6, 4, 0, $7d, PAL_OW_TREE | OBP_NUM
|
|
|
|
dsprite 4, 6, 5, 0, $7d, PAL_OW_TREE | OBP_NUM | X_FLIP
|
|
|
|
dsprite 5, 3, 4, 0, $7d, PAL_OW_TREE | OBP_NUM
|
|
|
|
dsprite 5, 3, 5, 0, $7d, PAL_OW_TREE | OBP_NUM | X_FLIP
|
|
|
|
dsprite 6, 0, 4, 0, $7d, PAL_OW_TREE | OBP_NUM
|
|
|
|
dsprite 6, 0, 5, 0, $7d, PAL_OW_TREE | OBP_NUM | X_FLIP
|
2015-11-11 13:11:08 -08:00
|
|
|
; 123fc
|
|
|
|
|
|
|
|
.HealMachineGFX: ; 123fc
|
2017-12-10 21:17:39 -08:00
|
|
|
INCBIN "gfx/overworld/heal_machine.2bpp"
|
2015-11-11 13:11:08 -08:00
|
|
|
; 1241c
|
|
|
|
|
2016-01-10 14:44:09 -08:00
|
|
|
.HOF_OAM: ; 1241c
|
2017-12-26 17:33:41 -08:00
|
|
|
dsprite 7, 4, 10, 1, $7d, PAL_OW_TREE | OBP_NUM
|
|
|
|
dsprite 7, 4, 10, 6, $7d, PAL_OW_TREE | OBP_NUM
|
|
|
|
dsprite 7, 3, 9, 5, $7d, PAL_OW_TREE | OBP_NUM
|
|
|
|
dsprite 7, 3, 11, 2, $7d, PAL_OW_TREE | OBP_NUM
|
|
|
|
dsprite 7, 1, 9, 1, $7d, PAL_OW_TREE | OBP_NUM
|
|
|
|
dsprite 7, 1, 11, 5, $7d, PAL_OW_TREE | OBP_NUM
|
2015-11-11 13:11:08 -08:00
|
|
|
; 12434
|
|
|
|
|
|
|
|
.LoadPalettes: ; 12434
|
|
|
|
call IsCGB
|
|
|
|
jr nz, .cgb
|
|
|
|
ld a, %11100000
|
|
|
|
ld [rOBP1], a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.cgb
|
|
|
|
ld hl, .palettes
|
2018-01-01 06:08:21 -08:00
|
|
|
ld de, wOBPals2 palette PAL_OW_TREE
|
2017-12-26 17:33:41 -08:00
|
|
|
ld bc, 1 palettes
|
2018-01-04 11:53:50 -08:00
|
|
|
ld a, BANK(wOBPals2)
|
2015-11-11 13:11:08 -08:00
|
|
|
call FarCopyWRAM
|
|
|
|
ld a, $1
|
|
|
|
ld [hCGBPalUpdate], a
|
|
|
|
ret
|
|
|
|
; 12451
|
|
|
|
|
2016-04-10 12:01:49 -07:00
|
|
|
.palettes ; 12451
|
2018-01-12 11:54:00 -08:00
|
|
|
INCLUDE "gfx/overworld/heal_machine.pal"
|
2015-11-11 13:11:08 -08:00
|
|
|
; 12459
|
|
|
|
|
|
|
|
.FlashPalettes8Times: ; 12459
|
2018-01-12 11:54:00 -08:00
|
|
|
ld c, 8
|
2015-11-11 13:11:08 -08:00
|
|
|
.palette_loop
|
|
|
|
push bc
|
|
|
|
call .FlashPalettes
|
|
|
|
ld c, 10
|
|
|
|
call DelayFrames
|
|
|
|
pop bc
|
|
|
|
dec c
|
|
|
|
jr nz, .palette_loop
|
|
|
|
ret
|
|
|
|
; 12469
|
|
|
|
|
|
|
|
.FlashPalettes: ; 12469
|
|
|
|
call IsCGB
|
|
|
|
jr nz, .go
|
|
|
|
ld a, [rOBP1]
|
|
|
|
xor %00101000
|
|
|
|
ld [rOBP1], a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.go
|
|
|
|
ld a, [rSVBK]
|
|
|
|
push af
|
2018-01-03 16:12:45 -08:00
|
|
|
ld a, BANK(wOBPals2)
|
2015-11-11 13:11:08 -08:00
|
|
|
ld [rSVBK], a
|
|
|
|
|
2018-01-01 06:08:21 -08:00
|
|
|
ld hl, wOBPals2 palette PAL_OW_TREE
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld e, a
|
|
|
|
ld a, [hli]
|
|
|
|
ld d, a
|
|
|
|
push de
|
|
|
|
ld c, $3
|
|
|
|
.palette_loop_2
|
|
|
|
ld a, [hli]
|
|
|
|
ld e, a
|
|
|
|
ld a, [hld]
|
|
|
|
ld d, a
|
|
|
|
dec hl
|
|
|
|
ld a, d
|
|
|
|
ld [hld], a
|
|
|
|
ld a, e
|
|
|
|
ld [hli], a
|
|
|
|
inc hl
|
2016-05-10 09:31:49 -07:00
|
|
|
inc hl
|
|
|
|
inc hl
|
2015-11-11 13:11:08 -08:00
|
|
|
dec c
|
|
|
|
jr nz, .palette_loop_2
|
|
|
|
pop de
|
|
|
|
dec hl
|
|
|
|
ld a, d
|
|
|
|
ld [hld], a
|
|
|
|
ld a, e
|
|
|
|
ld [hl], a
|
|
|
|
|
|
|
|
pop af
|
|
|
|
ld [rSVBK], a
|
|
|
|
ld a, $1
|
|
|
|
ld [hCGBPalUpdate], a
|
|
|
|
ret
|
|
|
|
; 124a3
|
|
|
|
|
|
|
|
.PlaceHealingMachineTile: ; 124a3
|
|
|
|
push bc
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wBuffer1]
|
2016-01-10 14:44:09 -08:00
|
|
|
bcpixel 2, 4
|
2018-01-17 21:57:06 -08:00
|
|
|
cp HEALMACHINE_ELMS_LAB
|
2015-11-11 13:11:08 -08:00
|
|
|
jr z, .okay
|
2016-01-10 14:44:09 -08:00
|
|
|
bcpixel 0, 0
|
2015-11-11 13:11:08 -08:00
|
|
|
|
|
|
|
.okay
|
|
|
|
ld a, [de]
|
|
|
|
add c
|
|
|
|
inc de
|
2018-01-10 10:47:57 -08:00
|
|
|
ld [hli], a ; y
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [de]
|
|
|
|
add b
|
|
|
|
inc de
|
2018-01-10 10:47:57 -08:00
|
|
|
ld [hli], a ; x
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [de]
|
|
|
|
inc de
|
2018-01-10 10:47:57 -08:00
|
|
|
ld [hli], a ; tile id
|
2015-11-11 13:11:08 -08:00
|
|
|
ld a, [de]
|
|
|
|
inc de
|
2018-01-10 10:47:57 -08:00
|
|
|
ld [hli], a ; attributes
|
2015-11-11 13:11:08 -08:00
|
|
|
pop bc
|
|
|
|
ret
|
|
|
|
; 124c1
|