diff options
author | libjet <libj3t@gmail.com> | 2020-02-19 20:08:53 +0000 |
---|---|---|
committer | libjet <libj3t@gmail.com> | 2020-02-19 20:08:53 +0000 |
commit | 20950e734d57acf65f2d4156a03b3bde9af75bd8 (patch) | |
tree | 85f267a824cf1be7ec5b20ea9c25bebb1da82a32 /home.asm | |
parent | 80c1fcee10440ac1de77119ea5119cd28bdf42b5 (diff) |
Add home/trainers.asm
Diffstat (limited to 'home.asm')
-rw-r--r-- | home.asm | 218 |
1 files changed, 1 insertions, 217 deletions
@@ -259,223 +259,7 @@ INCLUDE "home/pokedex_flags.asm" INCLUDE "home/names.asm" INCLUDE "home/scrolling_menu.asm" INCLUDE "home/stone_queue.asm" - -CheckTrainerBattle2:: - ldh a, [hROMBank] - push af - call SwitchToMapScriptsBank - call CheckTrainerBattle - pop bc - ld a, b - rst Bankswitch - ret - -CheckTrainerBattle:: ; 3851 (0:3851) - ld a, $2 - ld de, wMap2Object -.asm_3856 - push af - push de - ld hl, $1 - add hl, de - ld a, [hl] - and a - jr z, .asm_389b - ld hl, $8 - add hl, de - ld a, [hl] - and $f - cp $2 - jr nz, .asm_389b - ld hl, MBC3SRamEnable - add hl, de - ld a, [hl] - cp $ff - jr z, .asm_389b - call GetObjectStruct - call FacingPlayerDistance_bc - jr nc, .asm_389b - ld hl, $9 - add hl, de - ld a, [hl] - cp b - jr c, .asm_389b - push bc - push de - ld hl, $a - add hl, de - ld a, [hli] - ld h, [hl] - ld l, a - ld e, [hl] - inc hl - ld d, [hl] - ld b, $2 - call EventFlagAction - ld a, c - pop de - pop bc - and a - jr z, .asm_38aa -.asm_389b - pop de - ld hl, $10 - add hl, de - ld d, h - ld e, l - pop af - inc a - cp $10 - jr nz, .asm_3856 - xor a - ret - -.asm_38aa - pop de - pop af - ldh [hLastTalked], a - ld a, b - ld [wcf2a], a - ld a, c - ld [wcf2b], a - jr continue_trainer_function - -TalkToTrainer:: - ld a, $1 - ld [wcf2a], a - ld a, $ff - ld [wcf2b], a -continue_trainer_function - call GetMapScriptHeaderBank - ld [wcf29], a - ldh a, [hLastTalked] - call GetMapObject - ld hl, $a - add hl, bc - ld a, [wcf29] - call GetFarHalfword - ld de, wcf2c - ld bc, $d - ld a, [wcf29] - call FarCopyBytes - xor a - ld [wcf38], a - scf - ret - -FacingPlayerDistance_bc:: ; 38e9 (0:38e9) - push de - call FacingPlayerDistance - ld b, d - ld c, e - pop de - ret - -FacingPlayerDistance:: ; 38f1 (0:38f1) - ld hl, $10 - add hl, bc - ld d, [hl] - ld hl, $11 - add hl, bc - ld e, [hl] - ld a, [wPlayerStandingMapX] - cp d - jr z, .asm_3909 - ld a, [wPlayerStandingMapY] - cp e - jr z, .asm_391d - and a - ret - -.asm_3909 - ld a, [wPlayerStandingMapY] - sub e - jr z, .asm_3937 - jr nc, .asm_3918 - cpl - inc a - ld d, a - ld e, $4 - jr .asm_392f - -.asm_3918 - ld d, a - ld e, $0 - jr .asm_392f - -.asm_391d - ld a, [wPlayerStandingMapX] - sub d - jr z, .asm_3937 - jr nc, .asm_392c - cpl - inc a - ld d, a - ld e, $8 - jr .asm_392f - -.asm_392c - ld d, a - ld e, $c -.asm_392f - call GetSpriteDirection - cp e - jr nz, .asm_3937 - scf - ret - -.asm_3937 - and a - ret - -CheckTrainerFlag:: - push bc - ld hl, $1 - add hl, bc - ld a, [hl] - call GetMapObject - ld hl, $a - add hl, bc - ld a, [hli] - ld h, [hl] - ld l, a - call GetMapScriptHeaderBank - call GetFarHalfword - ld d, h - ld e, l - push de - ld b, $2 - call EventFlagAction - pop de - ld a, c - and a - pop bc - ret - -PrintWinLossText:: - ld a, [wBattleType] - cp $1 - jr which_battle_end_text - -PrintWinText:: - ld hl, wWinTextPointer - jr continue_battle_end_text - -which_battle_end_text - ld a, [wBattleResult] - ld hl, wWinTextPointer - and a - jr z, continue_battle_end_text - ld hl, wLossTextPointer -continue_battle_end_text - ld a, [hli] - ld h, [hl] - ld l, a - call GetMapScriptHeaderBank - call FarPrintText - call WaitBGMap - call WaitPressAorB_BlinkCursor - ret +INCLUDE "home/trainers.asm" DrawBattleHPBar:: push hl |