pokecrystal-board/engine/events/move_deleter.asm

151 lines
2.1 KiB
NASM
Raw Normal View History

MoveDeletion:
ld hl, .DeleterIntroText
2015-02-11 13:20:22 -08:00
call PrintText
call YesNoBox
jr c, .declined
ld hl, .DeleterAskWhichMonText
2015-02-11 13:20:22 -08:00
call PrintText
2017-12-24 09:47:30 -08:00
farcall SelectMonFromParty
jr c, .declined
2018-01-23 14:39:09 -08:00
ld a, [wCurPartySpecies]
2015-02-11 13:20:22 -08:00
cp EGG
jr z, .egg
2018-01-23 14:39:09 -08:00
ld a, [wCurPartyMon]
ld hl, wPartyMon1Moves + 1
ld bc, PARTYMON_STRUCT_LENGTH
2015-02-11 13:20:22 -08:00
call AddNTimes
ld a, [hl]
and a
jr z, .onlyonemove
ld hl, .DeleterAskWhichMoveText
2015-02-11 13:20:22 -08:00
call PrintText
call LoadStandardMenuHeader
2017-12-24 09:47:30 -08:00
farcall ChooseMoveToDelete
2015-02-11 13:20:22 -08:00
push af
2015-12-18 17:07:09 -08:00
call ReturnToMapWithSpeechTextbox
2015-02-11 13:20:22 -08:00
pop af
jr c, .declined
2015-12-15 15:59:49 -08:00
ld a, [wMenuCursorY]
2015-02-11 13:20:22 -08:00
push af
2018-07-29 13:04:38 -07:00
ld a, [wCurSpecies]
ld [wNamedObjectIndexBuffer], a
2015-02-11 13:20:22 -08:00
call GetMoveName
ld hl, .AskDeleteMoveText
2015-02-11 13:20:22 -08:00
call PrintText
call YesNoBox
pop bc
jr c, .declined
call .DeleteMove
2015-02-11 13:20:22 -08:00
call WaitSFX
ld de, SFX_MOVE_DELETED
call PlaySFX
call WaitSFX
ld hl, .DeleterForgotMoveText
2015-02-11 13:20:22 -08:00
call PrintText
ret
.egg
ld hl, .MailEggText
2015-02-11 13:20:22 -08:00
call PrintText
ret
.declined
ld hl, .DeleterNoComeAgainText
2015-02-11 13:20:22 -08:00
call PrintText
ret
.onlyonemove
ld hl, .MoveKnowsOneText
2015-02-11 13:20:22 -08:00
call PrintText
ret
.MoveKnowsOneText:
text_far _MoveKnowsOneText
text_end
2015-02-11 13:20:22 -08:00
.AskDeleteMoveText:
text_far _AskDeleteMoveText
text_end
2015-02-11 13:20:22 -08:00
.DeleterForgotMoveText:
text_far _DeleterForgotMoveText
text_end
2015-02-11 13:20:22 -08:00
.MailEggText:
text_far _DeleterEggText
text_end
2015-02-11 13:20:22 -08:00
.DeleterNoComeAgainText:
text_far _DeleterNoComeAgainText
text_end
2015-02-11 13:20:22 -08:00
.DeleterAskWhichMoveText:
text_far _DeleterAskWhichMoveText
text_end
2015-02-11 13:20:22 -08:00
.DeleterIntroText:
text_far _DeleterIntroText
text_end
2015-02-11 13:20:22 -08:00
.DeleterAskWhichMonText:
text_far _DeleterAskWhichMonText
text_end
2015-02-11 13:20:22 -08:00
2018-06-24 07:09:41 -07:00
.DeleteMove:
2015-02-11 13:20:22 -08:00
ld a, b
push bc
dec a
ld c, a
ld b, 0
2018-01-23 14:39:09 -08:00
ld hl, wPartyMon1Moves
2015-02-11 13:20:22 -08:00
add hl, bc
2018-01-23 14:39:09 -08:00
ld a, [wCurPartyMon]
ld bc, PARTYMON_STRUCT_LENGTH
2015-02-11 13:20:22 -08:00
call AddNTimes
pop bc
push bc
inc b
.loop
2015-02-11 13:20:22 -08:00
ld a, b
cp NUM_MOVES + 1
jr z, .okay
2015-02-11 13:20:22 -08:00
inc hl
ld a, [hld]
ld [hl], a
inc hl
inc b
jr .loop
2015-02-11 13:20:22 -08:00
.okay
2015-02-11 13:20:22 -08:00
xor a
ld [hl], a
pop bc
ld a, b
push bc
dec a
ld c, a
ld b, 0
2018-01-23 14:39:09 -08:00
ld hl, wPartyMon1PP
2015-02-11 13:20:22 -08:00
add hl, bc
2018-01-23 14:39:09 -08:00
ld a, [wCurPartyMon]
ld bc, PARTYMON_STRUCT_LENGTH
2015-02-11 13:20:22 -08:00
call AddNTimes
pop bc
inc b
.loop2
2015-02-11 13:20:22 -08:00
ld a, b
cp NUM_MOVES + 1
jr z, .done
2015-02-11 13:20:22 -08:00
inc hl
ld a, [hld]
ld [hl], a
inc hl
inc b
jr .loop2
2015-02-11 13:20:22 -08:00
.done
2015-02-11 13:20:22 -08:00
xor a
ld [hl], a
ret