mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-09-16 02:13:23 +12:00

Thanks to Frrf for helping me fix the broken code I initially sent in. This commit refines the mode so that the Oak Lab cutscene is finished and the party picking process is all concrete. Also, given Surge is a fight, the S.S. Anne Pikachu rival can have Raichu, surely... Also, the UnusedNames files were, in fact, needed...otherwise, the item names get all corrupted. Probably left some code behind. So we officially have a new funky mode!
100 lines
1.5 KiB
NASM
100 lines
1.5 KiB
NASM
NamePointers::
|
|
; entries correspond to *_NAME constants
|
|
dw MonsterNames
|
|
dw MoveNames
|
|
dw UnusedBadgeNames
|
|
dw ItemNames
|
|
dw wPartyMonOT ; player's OT names list
|
|
dw wEnemyMonOT ; enemy's OT names list
|
|
dw TrainerNames
|
|
|
|
GetName::
|
|
; arguments:
|
|
; [wd0b5] = which name
|
|
; [wNameListType] = which list
|
|
; [wPredefBank] = bank of list
|
|
;
|
|
; returns pointer to name in de
|
|
ld a, [wd0b5]
|
|
ld [wd11e], a
|
|
|
|
push bc ; this fixes some frustrating bollocks - PvK
|
|
ld b, a
|
|
ld a, [wNameListType]
|
|
cp ITEM_NAME
|
|
ld a, b
|
|
pop bc
|
|
jr nz, .notMachine
|
|
cp HM01
|
|
jp nc, GetMachineName
|
|
.notMachine
|
|
ldh a, [hLoadedROMBank]
|
|
push af
|
|
push hl
|
|
push bc
|
|
push de
|
|
ld a, [wNameListType]
|
|
dec a
|
|
jr nz, .otherEntries
|
|
; 1 = MONSTER_NAME
|
|
call GetMonName
|
|
ld hl, NAME_LENGTH
|
|
add hl, de
|
|
ld e, l
|
|
ld d, h
|
|
jr .gotPtr
|
|
.otherEntries
|
|
; 2-7 = other names
|
|
ld a, [wPredefBank]
|
|
ldh [hLoadedROMBank], a
|
|
ld [MBC1RomBank], a
|
|
ld a, [wNameListType]
|
|
dec a
|
|
add a
|
|
ld d, 0
|
|
ld e, a
|
|
jr nc, .skip
|
|
inc d
|
|
.skip
|
|
ld hl, NamePointers
|
|
add hl, de
|
|
ld a, [hli]
|
|
ldh [hSwapTemp + 1], a
|
|
ld a, [hl]
|
|
ldh [hSwapTemp], a
|
|
ldh a, [hSwapTemp]
|
|
ld h, a
|
|
ldh a, [hSwapTemp + 1]
|
|
ld l, a
|
|
ld a, [wd0b5]
|
|
ld b, a ; wanted entry
|
|
ld c, 0 ; entry counter
|
|
.nextName
|
|
ld d, h
|
|
ld e, l
|
|
.nextChar
|
|
ld a, [hli]
|
|
cp "@"
|
|
jr nz, .nextChar
|
|
inc c
|
|
ld a, b
|
|
cp c
|
|
jr nz, .nextName
|
|
ld h, d
|
|
ld l, e
|
|
ld de, wcd6d
|
|
ld bc, NAME_BUFFER_LENGTH
|
|
call CopyData
|
|
.gotPtr
|
|
ld a, e
|
|
ld [wUnusedCF8D], a
|
|
ld a, d
|
|
ld [wUnusedCF8D + 1], a
|
|
pop de
|
|
pop bc
|
|
pop hl
|
|
pop af
|
|
ldh [hLoadedROMBank], a
|
|
ld [MBC1RomBank], a
|
|
ret
|