mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-02-20 22:28:41 +13:00
Merge branch 'mistress' into renewables
This commit is contained in:
commit
6d4920da06
29 changed files with 577 additions and 70 deletions
|
|
@ -39,9 +39,18 @@ DisplayDiploma::
|
|||
hlcoord 10, 4
|
||||
ld de, wPlayerName
|
||||
call PlaceString
|
||||
ld a, [wPlayerSex]
|
||||
and a ; are you playing as Red
|
||||
jr z, .red ; if yes, Red appears on the diploma
|
||||
jr nz, .green ; if no, Green replaces him
|
||||
.green
|
||||
farcall DrawFPlayerCharacter
|
||||
jr .skip
|
||||
.red
|
||||
farcall DrawPlayerCharacter
|
||||
.skip
|
||||
|
||||
; Move the player 33 pixels right and set the priority bit so he appears
|
||||
; Move the player 33 pixels right and set the priority bit so they appear
|
||||
; behind the background layer.
|
||||
ld hl, wShadowOAMSprite00XCoord
|
||||
lb bc, $80, $28
|
||||
|
|
|
|||
|
|
@ -16,3 +16,23 @@ GetQuantityOfItemInBag:
|
|||
.notInBag
|
||||
ld b, 0
|
||||
ret
|
||||
|
||||
GetIndexOfItemInBag:
|
||||
; In: b = item ID
|
||||
; Out: b = index of item in bag (FF if not)
|
||||
call GetPredefRegisters
|
||||
ld hl, wBagItems - 1
|
||||
ld c, -1
|
||||
.loop
|
||||
inc c
|
||||
inc hl
|
||||
ld a, [hli]
|
||||
cp $ff
|
||||
jr z, .notInBag
|
||||
cp b
|
||||
jr nz, .loop
|
||||
ld b, c
|
||||
ret
|
||||
.notInBag
|
||||
ld b, a
|
||||
ret
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ ItemUsePtrTable:
|
|||
dw ItemUseBall ; POKE_BALL
|
||||
dw ItemUseTownMap ; TOWN_MAP
|
||||
dw ItemUseBicycle ; BICYCLE
|
||||
dw ItemUseSurfboard ; out-of-battle Surf effect
|
||||
dw ItemUseLapras ; POCKET_LAPRAS
|
||||
dw ItemUseBall ; SAFARI_BALL
|
||||
dw ItemUsePokedex ; POKEDEX
|
||||
dw ItemUseEvoStone ; MOON_STONE
|
||||
|
|
@ -759,12 +759,17 @@ ItemUseBicycle:
|
|||
jp PrintText
|
||||
|
||||
; used for Surf out-of-battle effect
|
||||
ItemUseSurfboard:
|
||||
ItemUseLapras:
|
||||
ld a, [wWalkBikeSurfState]
|
||||
ld [wWalkBikeSurfStateCopy], a
|
||||
cp 2 ; is the player already surfing?
|
||||
jr z, .tryToStopSurfing
|
||||
.tryToSurf
|
||||
farcall IsSurfingAllowed
|
||||
ld hl, wd728
|
||||
bit 1, [hl]
|
||||
res 1, [hl]
|
||||
jp z, .no
|
||||
call IsNextTileShoreOrWater
|
||||
jp c, SurfingAttemptFailed
|
||||
ld hl, TilePairCollisionsWater
|
||||
|
|
@ -837,6 +842,10 @@ ItemUseSurfboard:
|
|||
inc a
|
||||
ld [wSimulatedJoypadStatesIndex], a
|
||||
ret
|
||||
.no
|
||||
ld a, 1
|
||||
and a
|
||||
ret
|
||||
|
||||
SurfingGotOnText:
|
||||
text_far _SurfingGotOnText
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ ItemDescriptionPointers:
|
|||
text_end
|
||||
text_far _BicycleDescription
|
||||
text_end
|
||||
text_far _UnusedItemDescription
|
||||
text_far _PocketLaprasDescription
|
||||
text_end
|
||||
text_far _SafariBallDescription
|
||||
text_end
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ StartMenu_Pokemon::
|
|||
bit 1, [hl]
|
||||
res 1, [hl]
|
||||
jp z, .loop
|
||||
ld a, SURFBOARD
|
||||
ld a, POCKET_LAPRAS
|
||||
ld [wcf91], a
|
||||
ld [wPseudoItemID], a
|
||||
call UseItem
|
||||
|
|
@ -331,6 +331,7 @@ StartMenu_Item::
|
|||
ld a, [wBagSavedMenuItem]
|
||||
ld [wCurrentMenuItem], a
|
||||
call DisplayListMenuID
|
||||
jp nz, .sortItems
|
||||
ld a, [wCurrentMenuItem]
|
||||
ld [wBagSavedMenuItem], a
|
||||
jr nc, .choseItem
|
||||
|
|
@ -451,6 +452,9 @@ StartMenu_Item::
|
|||
.infoItem
|
||||
farcall DisplayItemDescription
|
||||
jp ItemMenuLoop
|
||||
.sortItems
|
||||
farcall SortItems
|
||||
jp ItemMenuLoop
|
||||
|
||||
CannotUseItemsHereText:
|
||||
text_far _CannotUseItemsHereText
|
||||
|
|
|
|||
|
|
@ -147,3 +147,264 @@ HandleItemListSwapping::
|
|||
pop de
|
||||
pop hl
|
||||
jp DisplayListMenuIDLoop
|
||||
|
||||
SortItems::
|
||||
push hl
|
||||
push bc
|
||||
ld hl, SortItemsText ; Display the text to ask to sort
|
||||
call PrintText
|
||||
call YesNoChoice
|
||||
ld a, [wCurrentMenuItem]
|
||||
and a
|
||||
jp z, .beginSorting ; If yes
|
||||
jr .done
|
||||
.finishedSwapping
|
||||
ld a, [hSwapTemp] ; If not 0, then a swap of items did occur
|
||||
cp 0
|
||||
jr z, .nothingSorted
|
||||
ld hl, SortComplete
|
||||
jr .printResultText
|
||||
.nothingSorted
|
||||
ld hl, NothingToSort
|
||||
.printResultText
|
||||
call PrintText
|
||||
.done
|
||||
xor a ; Zeroes a
|
||||
pop bc
|
||||
pop hl
|
||||
ret
|
||||
.beginSorting
|
||||
xor a
|
||||
ld [hSwapTemp], a ; 1 if something in the bag got sorted
|
||||
ld de, 0
|
||||
ld hl, ItemSortList
|
||||
ld b, [hl] ; This is the first item to check for
|
||||
ld hl, wBagItems
|
||||
ld c, 0 ; Relative to wBagItems, this is where we'd like to begin swapping
|
||||
.loopCurrItemInBag
|
||||
ld a, [hl] ; Load the value of hl to a (which is an item number) and Increments to the quantity
|
||||
cp -1 ; See if the item number is $ff, which is 'cancel'
|
||||
jr z, .findNextItem ; If it is cancel, then move onto the next item
|
||||
cp b
|
||||
jr z, .hasItem ; If it's not b, then go to the next item in the bag
|
||||
inc hl ; increments past the quantity to the next item to check
|
||||
inc hl
|
||||
jr .loopCurrItemInBag
|
||||
.findNextItem
|
||||
ld d, 0
|
||||
inc e
|
||||
ld hl, ItemSortList
|
||||
add hl, de
|
||||
ld b, [hl]
|
||||
ld hl, wBagItems ; Resets hl to start at the beginning of the bag
|
||||
ld a, b
|
||||
cp -1 ; Check if we got through all of the items, to the last one
|
||||
jr z, .finishedSwapping
|
||||
jr .loopCurrItemInBag
|
||||
.hasItem ; c contains where to swap to relative to the start of wBagItems
|
||||
; hl contains where the item to swap is absolute.
|
||||
; b contains the item ID
|
||||
push de
|
||||
ld d, h
|
||||
ld e, l
|
||||
ld hl, wBagItems
|
||||
ld a, b
|
||||
ld b, 0
|
||||
add hl, bc ; hl now holds where we'd like to swap to
|
||||
ld b, a
|
||||
ld a, [de]
|
||||
cp [hl]
|
||||
jr z, .cont ; If they're the same item
|
||||
ld a, 1
|
||||
ld [hSwapTemp], a
|
||||
ld a, [hl]
|
||||
ld [hSwapItemID],a ; [hSwapItemID] = second item ID
|
||||
inc hl
|
||||
ld a,[hld]
|
||||
ld [hSwapItemQuantity],a ; [hSwapItemQuantity] = second item quantity
|
||||
ld a,[de]
|
||||
ld [hli],a ; put first item ID in second item slot
|
||||
inc de
|
||||
ld a,[de]
|
||||
ld [hl],a ; put first item quantity in second item slot
|
||||
ld a,[hSwapItemQuantity]
|
||||
ld [de],a ; put second item quantity in first item slot
|
||||
dec de
|
||||
ld a,[hSwapItemID]
|
||||
ld [de],a ; put second item ID in first item slot
|
||||
.cont
|
||||
inc c
|
||||
inc c
|
||||
ld h, d
|
||||
ld l, e
|
||||
pop de
|
||||
jr .findNextItem
|
||||
|
||||
SortItemsText::
|
||||
text_far _SortItemsText
|
||||
db "@"
|
||||
|
||||
SortComplete::
|
||||
text_far _SortComplete
|
||||
db "@"
|
||||
|
||||
NothingToSort::
|
||||
text_far _NothingToSort
|
||||
db "@"
|
||||
|
||||
ItemSortList::
|
||||
; Used Key Items
|
||||
db BICYCLE
|
||||
db SUPER_ROD
|
||||
db POCKET_LAPRAS
|
||||
db ITEMFINDER
|
||||
db TOWN_MAP
|
||||
db MYSTERY_BOX
|
||||
; Balls
|
||||
db POKE_BALL
|
||||
db GREAT_BALL
|
||||
db ULTRA_BALL
|
||||
db SAFARI_BALL
|
||||
db MASTER_BALL
|
||||
; Common Items
|
||||
db REPEL
|
||||
db SUPER_REPEL
|
||||
db MAX_REPEL
|
||||
db ESCAPE_ROPE
|
||||
db POKE_DOLL
|
||||
; Health
|
||||
db POTION
|
||||
db SUPER_POTION
|
||||
db HYPER_POTION
|
||||
db MAX_POTION
|
||||
db FULL_RESTORE
|
||||
db FRESH_WATER
|
||||
db SODA_POP
|
||||
db LEMONADE
|
||||
; Revival
|
||||
db REVIVE
|
||||
db MAX_REVIVE
|
||||
; Status
|
||||
db ANTIDOTE
|
||||
db BURN_HEAL
|
||||
db ICE_HEAL
|
||||
db AWAKENING
|
||||
db PARLYZ_HEAL
|
||||
db FULL_HEAL
|
||||
db POKE_FLUTE
|
||||
; PP
|
||||
db ETHER
|
||||
db MAX_ETHER
|
||||
db ELIXER
|
||||
db MAX_ELIXER
|
||||
; Battle Raises
|
||||
db X_ACCURACY
|
||||
db X_ATTACK
|
||||
db X_DEFEND
|
||||
db X_SPEED
|
||||
db X_SPECIAL
|
||||
db GUARD_SPEC
|
||||
db DIRE_HIT
|
||||
; Permanent Raises
|
||||
db RARE_CANDY
|
||||
db HP_UP
|
||||
db PROTEIN
|
||||
db IRON
|
||||
db CARBOS
|
||||
db CALCIUM
|
||||
db PP_UP
|
||||
; Evolution Items
|
||||
db LEAF_STONE
|
||||
db FIRE_STONE
|
||||
db THUNDER_STONE
|
||||
db WATER_STONE
|
||||
db MOON_STONE
|
||||
db HEART_STONE
|
||||
db POISON_STONE
|
||||
db ICE_STONE
|
||||
db METAL_COAT
|
||||
db UP_GRADE
|
||||
db DUBIOUS_DISC
|
||||
db BLK_AUGURITE
|
||||
db PROTECTOR
|
||||
db CANDY_JAR
|
||||
; Other Non-Key Items
|
||||
db DOME_FOSSIL
|
||||
db HELIX_FOSSIL
|
||||
db WING_FOSSIL
|
||||
db OLD_AMBER
|
||||
db NUGGET
|
||||
db BOTTLE_CAP
|
||||
; Key Items With No Use
|
||||
db COIN_CASE
|
||||
db SILPHLETTER
|
||||
db S_S_TICKET
|
||||
db OLD_SEA_MAP
|
||||
db CITRINE_PASS
|
||||
db SECRET_KEY
|
||||
db BIKE_VOUCHER
|
||||
db CARD_KEY
|
||||
db GOLD_TEETH
|
||||
db OAKS_PARCEL
|
||||
db LIFT_KEY
|
||||
db SILPH_SCOPE
|
||||
db TEA
|
||||
db EXP_ALL
|
||||
; TMs
|
||||
db TM01
|
||||
db TM01 + 1
|
||||
db TM01 + 2
|
||||
db TM01 + 3
|
||||
db TM01 + 4
|
||||
db TM01 + 5
|
||||
db TM01 + 6
|
||||
db TM01 + 7
|
||||
db TM01 + 8
|
||||
db TM01 + 9
|
||||
db TM01 + 10
|
||||
db TM01 + 11
|
||||
db TM01 + 12
|
||||
db TM01 + 13
|
||||
db TM01 + 14
|
||||
db TM01 + 15
|
||||
db TM01 + 16
|
||||
db TM01 + 17
|
||||
db TM01 + 18
|
||||
db TM01 + 19
|
||||
db TM01 + 20
|
||||
db TM01 + 21
|
||||
db TM01 + 22
|
||||
db TM01 + 23
|
||||
db TM01 + 24
|
||||
db TM01 + 25
|
||||
db TM01 + 26
|
||||
db TM01 + 27
|
||||
db TM01 + 28
|
||||
db TM01 + 29
|
||||
db TM01 + 30
|
||||
db TM01 + 31
|
||||
db TM01 + 32
|
||||
db TM01 + 33
|
||||
db TM01 + 34
|
||||
db TM01 + 35
|
||||
db TM01 + 36
|
||||
db TM01 + 37
|
||||
db TM01 + 38
|
||||
db TM01 + 39
|
||||
db TM01 + 40
|
||||
db TM01 + 41
|
||||
db TM01 + 42
|
||||
db TM01 + 43
|
||||
db TM01 + 44
|
||||
db TM01 + 45
|
||||
db TM01 + 46
|
||||
db TM01 + 47
|
||||
db TM01 + 48
|
||||
db TM01 + 49
|
||||
; HMs
|
||||
db HM01
|
||||
db HM01 + 1
|
||||
db HM01 + 2
|
||||
db HM01 + 3
|
||||
db HM01 + 4
|
||||
db -1 ; end
|
||||
|
|
|
|||
|
|
@ -91,8 +91,15 @@ DisplayTitleScreen:
|
|||
inc a
|
||||
dec b
|
||||
jr nz, .pokemonLogoLastTileRowLoop
|
||||
|
||||
call Random
|
||||
ldh a, [hRandomAdd]
|
||||
cp 129
|
||||
jr c, .male
|
||||
call DrawFPlayerCharacter
|
||||
jr .playerskip
|
||||
.male
|
||||
call DrawPlayerCharacter
|
||||
.playerskip
|
||||
|
||||
; put a pokeball in the player's hand
|
||||
ld hl, wShadowOAMSprite10
|
||||
|
|
@ -119,11 +126,19 @@ DisplayTitleScreen:
|
|||
call SaveScreenTilesToBuffer2
|
||||
call LoadScreenTilesFromBuffer2
|
||||
call EnableLCD
|
||||
|
||||
call Random
|
||||
ldh a, [hRandomSub]
|
||||
cp 129
|
||||
jr c, .notshocks
|
||||
ld a, SANDY_SHOCKS
|
||||
ld [wTitleMonSpecies], a
|
||||
call LoadTitleMonSprite
|
||||
jr .skip
|
||||
.notshocks
|
||||
ld a, SCREAM_TAIL
|
||||
ld [wTitleMonSpecies], a
|
||||
call LoadTitleMonSprite
|
||||
|
||||
.skip
|
||||
ld a, HIGH(vBGMap0 + $300)
|
||||
call TitleScreenCopyTileMapToVRAM
|
||||
call SaveScreenTilesToBuffer1
|
||||
|
|
@ -347,6 +362,43 @@ DrawPlayerCharacter:
|
|||
jr nz, .loop
|
||||
ret
|
||||
|
||||
DrawFPlayerCharacter:
|
||||
ld hl, FPlayerCharacterTitleGraphics
|
||||
ld de, vSprites
|
||||
ld bc, FPlayerCharacterTitleGraphicsEnd - FPlayerCharacterTitleGraphics
|
||||
ld a, BANK(FPlayerCharacterTitleGraphics)
|
||||
call FarCopyData2
|
||||
call ClearSprites
|
||||
xor a
|
||||
ld [wFPlayerCharacterOAMTile], a
|
||||
ld hl, wShadowOAM
|
||||
lb de, $60, $5a
|
||||
ld b, 7
|
||||
.loop2
|
||||
push de
|
||||
ld c, 5
|
||||
.innerLoop2
|
||||
ld a, d
|
||||
ld [hli], a ; Y
|
||||
ld a, e
|
||||
ld [hli], a ; X
|
||||
add 8
|
||||
ld e, a
|
||||
ld a, [wFPlayerCharacterOAMTile]
|
||||
ld [hli], a ; tile
|
||||
inc a
|
||||
ld [wFPlayerCharacterOAMTile], a
|
||||
inc hl
|
||||
dec c
|
||||
jr nz, .innerLoop2
|
||||
pop de
|
||||
ld a, 8
|
||||
add d
|
||||
ld d, a
|
||||
dec b
|
||||
jr nz, .loop2
|
||||
ret
|
||||
|
||||
ClearBothBGMaps:
|
||||
ld hl, vBGMap0
|
||||
ld bc, $400 * 2
|
||||
|
|
@ -387,15 +439,15 @@ CopyrightTextString:
|
|||
|
||||
INCLUDE "data/pokemon/title_mons.asm"
|
||||
|
||||
; prints version text (red, blue)
|
||||
; prints version text
|
||||
PrintGameVersionOnTitleScreen:
|
||||
hlcoord 7, 8
|
||||
hlcoord 6, 8
|
||||
ld de, VersionOnTitleScreenText
|
||||
jp PlaceString
|
||||
|
||||
; these point to special tiles specifically loaded for that purpose and are not usual text
|
||||
VersionOnTitleScreenText:
|
||||
db $61,$62,$63,$64,$65,$66,$67,$68,"@" ; "Blue Version"
|
||||
db $61,$62,$63,$64,$65,$66,$67,$68,"@"
|
||||
|
||||
DebugNewGamePlayerName:
|
||||
db "NINTEN@"
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ TrySurf:
|
|||
and a
|
||||
jr nz, .no2
|
||||
call GetPartyMonName2
|
||||
ld a, SURFBOARD
|
||||
ld a, POCKET_LAPRAS
|
||||
ld [wcf91], a
|
||||
ld [wPseudoItemID], a
|
||||
call UseItem
|
||||
|
|
|
|||
41
engine/overworld/use_another_repel.asm
Normal file
41
engine/overworld/use_another_repel.asm
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
UseAnotherRepel::
|
||||
ld b, REPEL
|
||||
push bc
|
||||
call IsItemInBag
|
||||
pop bc
|
||||
jr nz, .checkUse
|
||||
ld b, SUPER_REPEL
|
||||
push bc
|
||||
call IsItemInBag
|
||||
pop bc
|
||||
jr nz, .checkUse
|
||||
ld b, MAX_REPEL
|
||||
push bc
|
||||
call IsItemInBag
|
||||
pop bc
|
||||
jr nz, .checkUse
|
||||
jr .done
|
||||
.checkUse
|
||||
push bc
|
||||
ld hl, RepelUseAnotherText
|
||||
call PrintText
|
||||
call YesNoChoice
|
||||
pop bc
|
||||
ld a, [wCurrentMenuItem]
|
||||
and a
|
||||
jr nz, .done
|
||||
ld a, b
|
||||
ld [wcf91], a ;load item to be used
|
||||
ld [wd11e], a ;load item so its name can be grabbed
|
||||
predef GetIndexOfItemInBag
|
||||
ld a, b
|
||||
ld [wWhichPokemon], a ; load item index to be deleted when used
|
||||
call GetItemName ;get the item name into de register
|
||||
call CopyToStringBuffer ; copy name from de to wcf4b so it shows up in text
|
||||
call UseItem ;use the item
|
||||
.done
|
||||
ret
|
||||
|
||||
RepelUseAnotherText:
|
||||
text_far _RepelUseAnotherText
|
||||
text_end
|
||||
Loading…
Add table
Add a link
Reference in a new issue