pokecrystal-board/engine/events/poke_seer.asm

409 lines
5.7 KiB
NASM
Raw Normal View History

2015-11-23 13:04:53 -08:00
const_def
const SEER_INTRO
const SEER_CANT_TELL
const SEER_MET_AT
const SEER_TIME_LEVEL
const SEER_TRADED
const SEER_CANCEL
const SEER_EGG
const SEER_LEVEL_ONLY
const_def
const SEERACTION_MET
const SEERACTION_TRADED
const SEERACTION_CANT_TELL_1
const SEERACTION_CANT_TELL_2
const SEERACTION_LEVEL_ONLY
2018-06-24 07:09:41 -07:00
PokeSeer:
ld a, SEER_INTRO
call PrintSeerText
call JoyWaitAorB
2018-01-11 09:00:01 -08:00
ld b, PARTY_LENGTH
2017-12-24 09:47:30 -08:00
farcall SelectMonFromParty
jr c, .cancel
2018-01-23 14:39:09 -08:00
ld a, [wCurPartySpecies]
cp EGG
jr z, .egg
call IsAPokemon
jr c, .no_mon
call ReadCaughtData
call SeerAction
ret
.cancel
ld a, SEER_CANCEL
call PrintSeerText
ret
.no_mon
ret
.egg
ld a, SEER_EGG
call PrintSeerText
ret
2018-06-24 07:09:41 -07:00
SeerAction:
2015-11-23 13:04:53 -08:00
ld a, [wSeerAction]
ld hl, SeerActions
rst JumpTable
ret
2018-06-24 07:09:41 -07:00
SeerActions:
dw SeerAction0
dw SeerAction1
dw SeerAction2
dw SeerAction3
dw SeerAction4
2018-06-24 07:09:41 -07:00
SeerAction0:
ld a, SEER_MET_AT
call PrintSeerText
ld a, SEER_TIME_LEVEL
call PrintSeerText
call SeerAdvice
ret
2018-06-24 07:09:41 -07:00
SeerAction1:
call GetCaughtOT
ld a, SEER_TRADED
call PrintSeerText
ld a, SEER_TIME_LEVEL
call PrintSeerText
call SeerAdvice
ret
2018-06-24 07:09:41 -07:00
SeerAction2:
ld a, SEER_CANT_TELL
call PrintSeerText
ret
2018-06-24 07:09:41 -07:00
SeerAction3:
ld a, SEER_CANT_TELL
call PrintSeerText
ret
2018-06-24 07:09:41 -07:00
SeerAction4:
ld a, SEER_LEVEL_ONLY
call PrintSeerText
call SeerAdvice
ret
2018-06-24 07:09:41 -07:00
ReadCaughtData:
ld a, MON_CAUGHTDATA
call GetPartyParamLocation
ld a, [hli]
2015-11-23 13:04:53 -08:00
ld [wSeerCaughtData], a
ld a, [hld]
2015-11-23 13:04:53 -08:00
ld [wSeerCaughtGender], a
or [hl]
2015-11-23 13:04:53 -08:00
jr z, .error
2015-11-23 13:04:53 -08:00
ld a, SEERACTION_TRADED
ld [wSeerAction], a
ld a, MON_ID
call GetPartyParamLocation
2018-01-23 14:39:09 -08:00
ld a, [wPlayerID]
cp [hl]
2015-11-23 13:04:53 -08:00
jr nz, .traded
inc hl
2018-01-23 14:39:09 -08:00
ld a, [wPlayerID + 1]
2015-11-23 13:04:53 -08:00
; cp [hl]
jr nz, .traded
2015-11-23 13:04:53 -08:00
ld a, SEERACTION_MET
ld [wSeerAction], a
2015-11-23 13:04:53 -08:00
.traded
call GetCaughtLevel
call GetCaughtOT
call GetCaughtName
call GetCaughtTime
call GetCaughtLocation
and a
ret
2015-11-23 13:04:53 -08:00
.error
ld a, SEERACTION_CANT_TELL_1
ld [wSeerAction], a
ret
2018-06-24 07:09:41 -07:00
GetCaughtName:
2018-01-23 14:39:09 -08:00
ld a, [wCurPartyMon]
ld hl, wPartyMonNicknames
2018-01-20 09:25:55 -08:00
ld bc, MON_NAME_LENGTH
call AddNTimes
2015-11-23 13:04:53 -08:00
ld de, wSeerNickname
2018-01-20 09:25:55 -08:00
ld bc, MON_NAME_LENGTH
call CopyBytes
ret
2018-06-24 07:09:41 -07:00
GetCaughtLevel:
ld a, "@"
2015-11-23 13:04:53 -08:00
ld hl, wSeerCaughtLevelString
ld bc, 4
call ByteFill
; caught level
2018-01-11 09:00:01 -08:00
; Limited to between 1 and 63 since it's a 6-bit quantity.
2015-11-23 13:04:53 -08:00
ld a, [wSeerCaughtData]
2018-01-11 09:00:01 -08:00
and CAUGHT_LEVEL_MASK
jr z, .unknown
2018-01-11 09:00:01 -08:00
cp CAUGHT_EGG_LEVEL ; egg marker value
jr nz, .print
2016-02-11 19:53:00 -08:00
ld a, EGG_LEVEL ; egg hatch level
.print
2015-11-23 13:04:53 -08:00
ld [wSeerCaughtLevel], a
ld hl, wSeerCaughtLevelString
ld de, wSeerCaughtLevel
2019-11-03 17:17:04 -08:00
lb bc, PRINTNUM_LEFTALIGN | 1, 3
call PrintNum
ret
.unknown
2015-11-23 13:04:53 -08:00
ld de, wSeerCaughtLevelString
ld hl, .unknown_level
ld bc, 4
call CopyBytes
ret
2018-06-24 07:09:41 -07:00
.unknown_level
db "???@"
2018-06-24 07:09:41 -07:00
GetCaughtTime:
2015-11-23 13:04:53 -08:00
ld a, [wSeerCaughtData]
2018-01-11 09:00:01 -08:00
and CAUGHT_TIME_MASK
jr z, .none
rlca
rlca
dec a
ld hl, .times
call GetNthString
ld d, h
ld e, l
2015-11-23 13:04:53 -08:00
ld hl, wSeerTimeOfDay
call CopyName2
and a
ret
.none
2015-11-23 13:04:53 -08:00
ld de, wSeerTimeOfDay
call UnknownCaughtData
ret
2018-06-24 07:09:41 -07:00
.times
db "Morning@"
db "Day@"
db "Night@"
2018-06-24 07:09:41 -07:00
UnknownCaughtData:
ld hl, .unknown
2015-11-23 13:04:53 -08:00
ld bc, NAME_LENGTH
call CopyBytes
ret
2018-06-24 07:09:41 -07:00
.unknown
db "Unknown@"
2018-06-24 07:09:41 -07:00
GetCaughtLocation:
2015-11-23 13:04:53 -08:00
ld a, [wSeerCaughtGender]
2018-01-11 09:00:01 -08:00
and CAUGHT_LOCATION_MASK
2015-11-23 13:04:53 -08:00
jr z, .Unknown
cp LANDMARK_EVENT
2015-11-23 13:04:53 -08:00
jr z, .event
cp LANDMARK_GIFT
2015-11-23 13:04:53 -08:00
jr z, .fail
ld e, a
2017-12-24 09:47:30 -08:00
farcall GetLandmarkName
2018-01-23 14:39:09 -08:00
ld hl, wStringBuffer1
2015-11-23 13:04:53 -08:00
ld de, wSeerCaughtLocation
ld bc, 17
call CopyBytes
and a
ret
.Unknown:
2015-11-23 13:04:53 -08:00
ld de, wSeerCaughtLocation
jp UnknownCaughtData
2015-11-23 13:04:53 -08:00
.event
ld a, SEERACTION_LEVEL_ONLY
ld [wSeerAction], a
scf
ret
2015-11-23 13:04:53 -08:00
.fail
ld a, SEERACTION_CANT_TELL_2
ld [wSeerAction], a
scf
ret
2018-06-24 07:09:41 -07:00
GetCaughtOT:
2018-01-23 14:39:09 -08:00
ld a, [wCurPartyMon]
ld hl, wPartyMonOT
ld bc, NAME_LENGTH
call AddNTimes
2015-11-23 13:04:53 -08:00
ld de, wSeerOTName
ld bc, NAME_LENGTH
call CopyBytes
2015-11-23 13:04:53 -08:00
; this routine is useless in Western localizations
ld hl, .male
2015-11-23 13:04:53 -08:00
ld a, [wSeerCaughtGender]
bit 7, a
2015-11-23 13:04:53 -08:00
jr z, .got_grammar
ld hl, .female
2015-11-23 13:04:53 -08:00
.got_grammar
ld de, wSeerOTNameGrammar
ld a, "@"
ld [de], a
ret
2018-06-24 07:09:41 -07:00
.male
db "@"
2018-06-24 07:09:41 -07:00
.female
db "@"
2018-06-24 07:09:41 -07:00
PrintSeerText:
ld e, a
ld d, 0
ld hl, SeerTexts
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
call PrintText
ret
2018-06-24 07:09:41 -07:00
SeerTexts:
dw SeerSeeAllText
dw SeerCantTellAThingText
dw SeerNameLocationText
dw SeerTimeLevelText
dw SeerTradeText
dw SeerDoNothingText
dw SeerEggText
dw SeerNoLocationText
SeerSeeAllText:
text_far _SeerSeeAllText
text_end
SeerCantTellAThingText:
text_far _SeerCantTellAThingText
text_end
SeerNameLocationText:
text_far _SeerNameLocationText
text_end
SeerTimeLevelText:
text_far _SeerTimeLevelText
text_end
SeerTradeText:
text_far _SeerTradeText
text_end
SeerNoLocationText:
text_far _SeerNoLocationText
text_end
SeerEggText:
text_far _SeerEggText
text_end
SeerDoNothingText:
text_far _SeerDoNothingText
text_end
2018-06-24 07:09:41 -07:00
SeerAdvice:
ld a, MON_LEVEL
call GetPartyParamLocation
2015-11-23 13:04:53 -08:00
ld a, [wSeerCaughtLevel]
ld c, a
ld a, [hl]
sub c
ld c, a
ld hl, SeerAdviceTexts
ld de, 3
.next
cp [hl]
jr c, .print
jr z, .print
add hl, de
jr .next
.print
inc hl
ld a, [hli]
ld h, [hl]
ld l, a
call PrintText
ret
2018-06-24 07:09:41 -07:00
SeerAdviceTexts:
; level, text
dbw 9, SeerMoreCareText
dbw 29, SeerMoreConfidentText
dbw 59, SeerMuchStrengthText
dbw 89, SeerMightyText
dbw 100, SeerImpressedText
dbw 255, SeerMoreCareText
SeerMoreCareText:
text_far _SeerMoreCareText
text_end
SeerMoreConfidentText:
text_far _SeerMoreConfidentText
text_end
SeerMuchStrengthText:
text_far _SeerMuchStrengthText
text_end
SeerMightyText:
text_far _SeerMightyText
text_end
SeerImpressedText:
text_far _SeerImpressedText
text_end
2018-06-24 07:09:41 -07:00
GetCaughtGender:
ld hl, MON_CAUGHTGENDER
add hl, bc
ld a, [hl]
2018-01-11 09:00:01 -08:00
and CAUGHT_LOCATION_MASK
jr z, .genderless
cp LANDMARK_EVENT
jr z, .genderless
ld a, [hl]
2018-01-11 09:00:01 -08:00
and CAUGHT_GENDER_MASK
jr nz, .male
2018-01-11 09:00:01 -08:00
ld c, CAUGHT_BY_GIRL
ret
.male
2018-01-11 09:00:01 -08:00
ld c, CAUGHT_BY_BOY
ret
.genderless
2018-01-11 09:00:01 -08:00
ld c, CAUGHT_BY_UNKNOWN
ret