pokecrystal/engine/events/prof_oaks_pc.asm

194 lines
2.5 KiB
NASM
Raw Normal View History

ProfOaksPC:
2016-01-10 22:44:09 +00:00
ld hl, OakPCText1
call MenuTextBox
call YesNoBox
jr c, .shutdown
call ProfOaksPCBoot ; player chose "yes"?
2016-01-10 22:44:09 +00:00
.shutdown
ld hl, OakPCText4
call PrintText
call JoyWaitAorB
call ExitMenu
ret
ProfOaksPCBoot:
2016-01-10 22:44:09 +00:00
ld hl, OakPCText2
call PrintText
call Rate
call PlaySFX ; sfx loaded by previous Rate function call
call JoyWaitAorB
call WaitSFX
ret
ProfOaksPCRating:
2016-01-10 22:44:09 +00:00
call Rate
push de
ld de, MUSIC_NONE
call PlayMusic
pop de
call PlaySFX
call JoyWaitAorB
call WaitSFX
ret
Rate:
2016-01-10 22:44:09 +00:00
; calculate Seen/Owned
2018-01-23 22:39:09 +00:00
ld hl, wPokedexSeen
ld b, wEndPokedexSeen - wPokedexSeen
2016-01-10 22:44:09 +00:00
call CountSetBits
ld [wd002], a
2018-01-23 22:39:09 +00:00
ld hl, wPokedexCaught
ld b, wEndPokedexCaught - wPokedexCaught
2016-01-10 22:44:09 +00:00
call CountSetBits
ld [wd003], a
; print appropriate rating
call .UpdateRatingBuffers
ld hl, OakPCText3
call PrintText
call JoyWaitAorB
ld a, [wd003]
ld hl, OakRatings
call FindOakRating
push de
call PrintText
pop de
ret
.UpdateRatingBuffers:
2018-01-23 22:39:09 +00:00
ld hl, wStringBuffer3
2016-01-10 22:44:09 +00:00
ld de, wd002
call .UpdateRatingBuffer
2018-01-23 22:39:09 +00:00
ld hl, wStringBuffer4
2016-01-10 22:44:09 +00:00
ld de, wd003
call .UpdateRatingBuffer
ret
.UpdateRatingBuffer:
2016-01-10 22:44:09 +00:00
push hl
ld a, "@"
ld bc, ITEM_NAME_LENGTH
call ByteFill
pop hl
lb bc, PRINTNUM_RIGHTALIGN | 1, 3
call PrintNum
ret
FindOakRating:
2016-01-10 22:44:09 +00:00
; return sound effect in de
; return text pointer in hl
nop
ld c, a
.loop
ld a, [hli]
cp c
jr nc, .match
rept 4
inc hl
endr
jr .loop
.match
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ld h, [hl]
ld l, a
ret
2018-01-26 03:19:24 +00:00
INCLUDE "data/events/pokedex_ratings.asm"
2016-01-10 22:44:09 +00:00
OakPCText1:
text_far _OakPCText1
2016-01-10 22:44:09 +00:00
db "@"
OakPCText2:
text_far _OakPCText2
2016-01-10 22:44:09 +00:00
db "@"
OakPCText3:
text_far _OakPCText3
2016-01-10 22:44:09 +00:00
db "@"
OakRating01:
text_far _OakRating01
2016-01-10 22:44:09 +00:00
db "@"
OakRating02:
text_far _OakRating02
2016-01-10 22:44:09 +00:00
db "@"
OakRating03:
text_far _OakRating03
2016-01-10 22:44:09 +00:00
db "@"
OakRating04:
text_far _OakRating04
2016-01-10 22:44:09 +00:00
db "@"
OakRating05:
text_far _OakRating05
2016-01-10 22:44:09 +00:00
db "@"
OakRating06:
text_far _OakRating06
2016-01-10 22:44:09 +00:00
db "@"
OakRating07:
text_far _OakRating07
2016-01-10 22:44:09 +00:00
db "@"
OakRating08:
text_far _OakRating08
2016-01-10 22:44:09 +00:00
db "@"
OakRating09:
text_far _OakRating09
2016-01-10 22:44:09 +00:00
db "@"
OakRating10:
text_far _OakRating10
2016-01-10 22:44:09 +00:00
db "@"
OakRating11:
text_far _OakRating11
2016-01-10 22:44:09 +00:00
db "@"
OakRating12:
text_far _OakRating12
2016-01-10 22:44:09 +00:00
db "@"
OakRating13:
text_far _OakRating13
2016-01-10 22:44:09 +00:00
db "@"
OakRating14:
text_far _OakRating14
2016-01-10 22:44:09 +00:00
db "@"
OakRating15:
text_far _OakRating15
2016-01-10 22:44:09 +00:00
db "@"
OakRating16:
text_far _OakRating16
2016-01-10 22:44:09 +00:00
db "@"
OakRating17:
text_far _OakRating17
2016-01-10 22:44:09 +00:00
db "@"
OakRating18:
text_far _OakRating18
2016-01-10 22:44:09 +00:00
db "@"
OakRating19:
text_far _OakRating19
2016-01-10 22:44:09 +00:00
db "@"
OakPCText4:
text_far _OakPCText4
2016-01-10 22:44:09 +00:00
db "@"