diff options
Diffstat (limited to 'engine/pokemon')
-rw-r--r-- | engine/pokemon/correct_nick_errors.asm | 53 | ||||
-rw-r--r-- | engine/pokemon/learn.asm | 220 |
2 files changed, 273 insertions, 0 deletions
diff --git a/engine/pokemon/correct_nick_errors.asm b/engine/pokemon/correct_nick_errors.asm new file mode 100644 index 00000000..c7b6ff39 --- /dev/null +++ b/engine/pokemon/correct_nick_errors.asm @@ -0,0 +1,53 @@ +CorrectNickErrors:: ; 677e (1:677e) + push bc + push de + ld b, MON_NAME_LENGTH +.checkchar + ld a, [de] + cp "@" + jr z, .done + ld hl, .textcommands + dec hl +.loop + inc hl + ld a, [hl] + cp $ff + jr z, .next + ld a, [de] + cp [hl] + inc hl + jr c, .loop + cp [hl] + jr nc, .loop + ld a, "?" + ld [de], a + jr .loop + +.next + inc de + dec b + jr nz, .checkchar + pop de + push de + ld a, "?" + ld [de], a + inc de + ld a, "@" + ld [de], a +.done + pop de + pop bc + ret + +.textcommands +; table defining which characters are actually text commands +; format: + ; ≥ < + db "<START>", $04 + 1 + db "<PLAY_G>", $18 + 1 + db $1d, "%" + 1 + db $35, "<GREEN>" + 1 + db "<ENEMY>", "<ENEMY>" + 1 + db $49, "<TM>" + 1 + db "<ROCKET>", "┘" + 1 + db -1 ; end
\ No newline at end of file diff --git a/engine/pokemon/learn.asm b/engine/pokemon/learn.asm new file mode 100644 index 00000000..b28f754b --- /dev/null +++ b/engine/pokemon/learn.asm @@ -0,0 +1,220 @@ +LearnMove: + call LoadTilemapToTempTilemap + ld a, [wCurPartyMon] + ld hl, wPartyMon1Nickname + call GetNick + ld hl, wStringBuffer1 + ld de, wMonOrItemNameBuffer + ld bc, $b + call CopyBytes +.loop + ld hl, wPartyMon1Moves + ld bc, $30 + ld a, [wCurPartyMon] + call AddNTimes + ld d, h + ld e, l + ld b, $4 +.asm_660f + ld a, [hl] + and a + jr z, .asm_6643 + inc hl + dec b + jr nz, .asm_660f + push de + call .AlreadyHaveFourMoves + pop de + jp c, .ConfirmStopLearning + push hl + push de + ld [wd151], a + ld b, a + ld a, [wBattleMode] + and a + jr z, .asm_6638 + ld a, [wcbd3] + cp b + jr nz, .asm_6638 + xor a + ld [wcbd3], a + ld [wcb53], a +.asm_6638 + call GetMoveName + ld hl, Text_1_2_and_Poof + call PrintText + pop de + pop hl +.asm_6643 + ld a, [wPutativeTMHMMove] + ld [hl], a + ld bc, $15 + add hl, bc + push hl + push de + dec a + ld hl, Moves + MOVE_PP ; $5b03 + ld bc, $7 + call AddNTimes + ld a, BANK(Moves) + call GetFarByte + pop de + pop hl + ld [hl], a + ld a, [wBattleMode] + and a + jp z, .LearnedMove + ld a, [wCurPartyMon] + ld b, a + ld a, [wCurBattleMon] + cp b + jp nz, .LearnedMove + ld a, [wPlayerSubStatus5] + bit 3, a + jp nz, .LearnedMove + ld h, d + ld l, e + ld de, wBattleMonMoves + ld bc, $4 + call CopyBytes + ld bc, $11 + add hl, bc + ld de, wBattleMonPP + ld bc, $4 + call CopyBytes + jp .LearnedMove + +.ConfirmStopLearning: ; 6694 (1:6694) + ld hl, Text_StopLearning + call PrintText + call YesNoBox + jp c, .loop + ld hl, Text_DidNotLearn + call PrintText + ld b, $0 + ret + +.LearnedMove: ; 66a9 (1:66a9) + ld hl, Text_LearnedMove + call PrintText + ld b, $1 + ret + +.AlreadyHaveFourMoves: ; 66b2 (1:66b2) + push hl + ld hl, Text_TryingToLearn + call PrintText + call YesNoBox + pop hl + ret c + ld bc, -4 + add hl, bc + push hl + ld de, wListMoves_MoveIndicesBuffer + ld bc, $4 + call CopyBytes + pop hl +.asm_66cd + push hl + ld hl, Text_ForgetWhich + call PrintText + hlcoord 5, 2 + ld b, $8 + ld c, $d + call Textbox + hlcoord 7, 4 + ld a, $28 + ld [wBuffer1], a + predef ListMoves + ld a, $4 + ld [w2DMenuCursorInitY], a + ld a, $6 + ld [w2DMenuCursorInitX], a + ld a, [wNumMoves] + inc a + ld [w2DMenuNumRows], a + ld a, $1 + ld [w2DMenuNumCols], a + ld [wMenuCursorY], a + ld [wcee1], a + ld a, $3 + ld [wMenuJoypadFilter], a + ld a, $20 + ld [w2DMenuFlags1], a + xor a + ld [w2DMenuFlags2], a + ld a, $20 + ld [w2DMenuCursorOffsets], a + call StaticMenuJoypad + push af + call SafeLoadTempTilemapToTilemap + pop af + pop hl + bit 1, a + jr nz, .asm_6748 + push hl + ld a, [wMenuCursorY] + dec a + ld c, a + ld b, $0 + add hl, bc + ld a, [hl] + push af + push bc + call IsHMMove + pop bc + pop de + ld a, d + jr c, .asm_673f + pop hl + add hl, bc + and a + ret + +.asm_673f + ld hl, Text_CantForgetHM + call PrintText + pop hl + jr .asm_66cd + +.asm_6748 + scf + ret + +Text_LearnedMove: + text_far Text_LearnedMove_ + db "@" + +Text_ForgetWhich: + text_far Text_ForgetWhich_ + db "@" + +Text_StopLearning: + text_far Text_StopLearning_ + db "@" + +Text_DidNotLearn: + text_far Text_DidNotLearn_ + db "@" + +Text_TryingToLearn: + text_far Text_TryingToLearn_ + db "@" + +Text_1_2_and_Poof: + text_far Text_1_2_and_Poof_ + text_asm + push de + ld de, SFX_SWITCH_POKEMON + call PlaySFX + pop de + ld hl, .PoofForgot + ret + +.PoofForgot: + text_far Text_PoofForgot_ + db "@" + +Text_CantForgetHM: + text_far Text_CantForgetHM_ + db "@" |