mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-09-16 18:30:50 +12:00
Gen 5 Repel system
Also used in PureRGB. Gives the player the option to use another Repel after the last one runs out. I had to remove some debug features in order to fit it in, but it won't have an effect on the regular game. Hopefully.
This commit is contained in:
parent
2d24f19ba6
commit
f675c1ad9b
|
@ -39,6 +39,7 @@ PredefPointers::
|
||||||
add_predef LearnMoveFromLevelUp
|
add_predef LearnMoveFromLevelUp
|
||||||
add_predef LearnMove
|
add_predef LearnMove
|
||||||
add_predef GetQuantityOfItemInBag
|
add_predef GetQuantityOfItemInBag
|
||||||
|
add_predef GetIndexOfItemInBag
|
||||||
add_predef CheckForHiddenObjectOrBookshelfOrCardKeyDoor, $03 ; home bank
|
add_predef CheckForHiddenObjectOrBookshelfOrCardKeyDoor, $03 ; home bank
|
||||||
add_predef GiveItem, $03 ; home bank
|
add_predef GiveItem, $03 ; home bank
|
||||||
add_predef ChangeBGPalColor0_4Frames
|
add_predef ChangeBGPalColor0_4Frames
|
||||||
|
|
|
@ -20,6 +20,10 @@ _PlayerBlackedOutText::
|
||||||
_RepelWoreOffText::
|
_RepelWoreOffText::
|
||||||
text "REPEL's effect"
|
text "REPEL's effect"
|
||||||
line "wore off."
|
line "wore off."
|
||||||
|
prompt
|
||||||
|
|
||||||
|
_RepelUseAnotherText::
|
||||||
|
text "Use another?"
|
||||||
done
|
done
|
||||||
|
|
||||||
_PokemartBuyingGreetingText::
|
_PokemartBuyingGreetingText::
|
||||||
|
|
|
@ -16,3 +16,23 @@ GetQuantityOfItemInBag:
|
||||||
.notInBag
|
.notInBag
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ret
|
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
|
||||||
|
|
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
|
|
@ -51,14 +51,4 @@ EndNPCMovementScript::
|
||||||
farjp _EndNPCMovementScript
|
farjp _EndNPCMovementScript
|
||||||
|
|
||||||
DebugPressedOrHeldB::
|
DebugPressedOrHeldB::
|
||||||
IF DEF(_DEBUG)
|
|
||||||
ld a, [wd732]
|
|
||||||
bit 1, a
|
|
||||||
ret z
|
|
||||||
ldh a, [hJoyHeld]
|
|
||||||
bit BIT_B_BUTTON, a
|
|
||||||
ret nz
|
|
||||||
ldh a, [hJoyPressed]
|
|
||||||
bit BIT_B_BUTTON, a
|
|
||||||
ENDC
|
|
||||||
ret
|
ret
|
||||||
|
|
|
@ -200,6 +200,7 @@ DisplayPlayerBlackedOutText::
|
||||||
DisplayRepelWoreOffText::
|
DisplayRepelWoreOffText::
|
||||||
ld hl, RepelWoreOffText
|
ld hl, RepelWoreOffText
|
||||||
call PrintText
|
call PrintText
|
||||||
|
callfar UseAnotherRepel
|
||||||
jp AfterDisplayingTextID
|
jp AfterDisplayingTextID
|
||||||
|
|
||||||
RepelWoreOffText::
|
RepelWoreOffText::
|
||||||
|
|
|
@ -127,10 +127,6 @@ TalkToTrainer::
|
||||||
|
|
||||||
; checks if any trainers are seeing the player and wanting to fight
|
; checks if any trainers are seeing the player and wanting to fight
|
||||||
CheckFightingMapTrainers::
|
CheckFightingMapTrainers::
|
||||||
IF DEF(_DEBUG)
|
|
||||||
call DebugPressedOrHeldB
|
|
||||||
jr nz, .trainerNotEngaging
|
|
||||||
ENDC
|
|
||||||
call CheckForEngagingTrainers
|
call CheckForEngagingTrainers
|
||||||
ld a, [wSpriteIndex]
|
ld a, [wSpriteIndex]
|
||||||
cp $ff
|
cp $ff
|
||||||
|
|
1
main.asm
1
main.asm
|
@ -346,6 +346,7 @@ SECTION "Itemfinder 2", ROMX
|
||||||
INCLUDE "engine/items/itemfinder.asm"
|
INCLUDE "engine/items/itemfinder.asm"
|
||||||
INCLUDE "engine/menus/league_pc.asm"
|
INCLUDE "engine/menus/league_pc.asm"
|
||||||
INCLUDE "engine/events/hidden_items.asm"
|
INCLUDE "engine/events/hidden_items.asm"
|
||||||
|
INCLUDE "engine/overworld/use_another_repel.asm"
|
||||||
|
|
||||||
SECTION "bank1E", ROMX
|
SECTION "bank1E", ROMX
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue