Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/engine/overworld/emotion_bubbles.asm
1271 views
1
EmotionBubble:
2
ld a, [wWhichEmotionBubble]
3
ld c, a
4
ld b, 0
5
ld hl, EmotionBubblesPointerTable
6
add hl, bc
7
add hl, bc
8
ld e, [hl]
9
inc hl
10
ld d, [hl]
11
ld hl, vChars1 tile $78
12
lb bc, BANK(EmotionBubbles), 4
13
call CopyVideoData
14
ld a, [wUpdateSpritesEnabled]
15
push af
16
ld a, $ff
17
ld [wUpdateSpritesEnabled], a
18
ld a, [wMovementFlags]
19
bit BIT_LEDGE_OR_FISHING, a ; are the last 4 OAM entries reserved for a shadow or fishing rod?
20
ld hl, wShadowOAMSprite35Attributes
21
ld de, wShadowOAMSprite39Attributes
22
jr z, .next
23
ld hl, wShadowOAMSprite31Attributes
24
ld de, wShadowOAMSprite35Attributes
25
26
; Copy OAM data 16 bytes forward to make room for emotion bubble OAM data at the
27
; start of the OAM buffer.
28
.next
29
ld bc, $90
30
.loop
31
ld a, [hl]
32
ld [de], a
33
dec hl
34
dec de
35
dec bc
36
ld a, c
37
or b
38
jr nz, .loop
39
40
; get the screen coordinates of the sprite the bubble is to be displayed above
41
ld hl, wSpritePlayerStateData1YPixels
42
ld a, [wEmotionBubbleSpriteIndex]
43
swap a
44
ld c, a
45
ld b, 0
46
add hl, bc
47
ld a, [hli]
48
ld b, a
49
inc hl
50
ld a, [hl]
51
add $8
52
ld c, a
53
54
ld de, EmotionBubblesOAMBlock
55
xor a
56
call WriteOAMBlock
57
ld c, 60
58
call DelayFrames
59
pop af
60
ld [wUpdateSpritesEnabled], a
61
call DelayFrame
62
jp UpdateSprites
63
64
EmotionBubblesPointerTable:
65
; entries correspond to *_BUBBLE constants
66
dw ShockEmote
67
dw QuestionEmote
68
dw HappyEmote
69
70
EmotionBubblesOAMBlock:
71
; tile ID, attributes
72
db $f8, 0
73
db $f9, 0
74
db $fa, 0
75
db $fb, 0
76
77
EmotionBubbles:
78
ShockEmote: INCBIN "gfx/emotes/shock.2bpp"
79
QuestionEmote: INCBIN "gfx/emotes/question.2bpp"
80
HappyEmote: INCBIN "gfx/emotes/happy.2bpp"
81
82