pokeyellow/engine/overworld/emotion_bubbles.asm
luckytyphlosion 043e932765 engine/trade.asm, trade2.asm, intro.asm, overworld/emotion_bubbles.asm
Also document Func_1681 (GetFarByte) and fix Missingno's dex entry
2015-12-23 15:40:59 -05:00

75 lines
1.5 KiB
NASM
Executable File

EmotionBubble: ; 4116f (10:516f)
ld a, [wWhichEmotionBubble]
and $f
swap a
ld c, a
ld b, $0
ld hl, EmotionBubbles
add hl, bc ; each emotion bubble is 16 bytes, so calculate the offset directly instead of with a pointer table
add hl, bc
add hl, bc
add hl, bc
ld e, l
ld d, h
ld hl, vChars1 + $780
lb bc, BANK(EmotionBubbles), $04
call CopyVideoData
ld a, [wUpdateSpritesEnabled]
push af
ld a, $ff
ld [wUpdateSpritesEnabled], a
ld a, [wd736]
bit 6, a ; are the last 4 OAM entries reserved for a shadow or fishing rod?
ld hl, wOAMBuffer + 4 * 35 + $3 ; $8f
ld de, wOAMBuffer + 4 * 39 + $3 ; $9f
jr z, .next
ld hl, wOAMBuffer + 4 * 31 + $3 ; $7f
ld de, wOAMBuffer + 4 * 35 + $3 ; $8f
; Copy OAM data 16 bytes forward to make room for emotion bubble OAM data at the
; start of the OAM buffer.
.next
ld bc, $90
.loop
ld a, [hl]
ld [de], a
dec hl
dec de
dec bc
ld a, c
or b
jr nz, .loop
; get the screen coordinates of the sprite the bubble is to be displayed above
ld hl, wSpriteStateData1 + 4
ld a, [wEmotionBubbleSpriteIndex]
swap a
ld c, a
ld b, 0
add hl, bc
ld a, [hli]
ld b, a
inc hl
ld a, [hl]
add $8
ld c, a
ld de, EmotionBubblesOAM
xor a
call WriteOAMBlock
ld c, 60
call DelayFrames
pop af
ld [wUpdateSpritesEnabled], a
call DelayFrame
call UpdateSprites
ret
; jp UpdateSprites
EmotionBubblesOAM: ; 411dd (5:51dd)
db $F8,$00,$F9,$00
db $FA,$00,$FB,$00
EmotionBubbles: ; 411e5 (10:51e5)
INCBIN "gfx/emotion_bubbles.2bpp"