Talk to Use Cut. Strength and Surf

This commit is contained in:
emaskyesmogon 2022-09-07 17:09:12 -06:00
parent 141e7c2de8
commit fe4dc821fd
9 changed files with 220 additions and 24 deletions

View file

@ -109,3 +109,4 @@ PredefPointers::
add_predef DrawHP2 add_predef DrawHP2
add_predef DisplayElevatorFloorMenu add_predef DisplayElevatorFloorMenu
add_predef OaksAideScript add_predef OaksAideScript
add_predef TryFieldMove

View file

@ -1788,3 +1788,19 @@ _TextIDErrorText::
_ContCharText:: _ContCharText::
text "<_CONT>@" text "<_CONT>@"
text_end text_end
_PromptToSurfText::
text "The water is calm."
line "Would you like to"
cont "SURF?"
done
_ExplainCutText::
text "This tree can be"
line "CUT!"
done
_PromptToCutText::
text "Would you like to"
line "use CUT?"
done

View file

@ -9,7 +9,7 @@ HiddenItems:
predef FlagActionPredef predef FlagActionPredef
ld a, c ld a, c
and a and a
ret nz jr nz, .nope
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
ld a, 1 ld a, 1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld [wDoNotWaitForButtonPressAfterDisplayingText], a
@ -17,6 +17,9 @@ HiddenItems:
ld [wd11e], a ld [wd11e], a
call GetItemName call GetItemName
tx_pre_jump FoundHiddenItemText tx_pre_jump FoundHiddenItemText
.nope
predef TryFieldMove
ret
INCLUDE "data/events/hidden_item_coords.asm" INCLUDE "data/events/hidden_item_coords.asm"

View file

@ -37,6 +37,7 @@ UsedCut:
call GBPalWhiteOutWithDelay3 call GBPalWhiteOutWithDelay3
call ClearSprites call ClearSprites
call RestoreScreenTilesAndReloadTilePatterns call RestoreScreenTilesAndReloadTilePatterns
call ReloadMapData
ld a, SCREEN_HEIGHT_PX ld a, SCREEN_HEIGHT_PX
ldh [hWY], a ldh [hWY], a
call Delay3 call Delay3
@ -46,6 +47,9 @@ UsedCut:
call Delay3 call Delay3
xor a xor a
ldh [hWY], a ldh [hWY], a
; fall through
Cut2::
ld hl, UsedCutText ld hl, UsedCutText
call PrintText call PrintText
call LoadScreenTilesFromBuffer2 call LoadScreenTilesFromBuffer2

View file

@ -0,0 +1,171 @@
TryFieldMove:: ; predef
call GetPredefRegisters
call TrySurf
ret z
call TryCut
ret
TrySurf:
ld a, [wWalkBikeSurfState]
cp 2 ; is the player already surfing?
jr z, .no
callfar IsNextTileShoreOrWater
jr c, .no
ld hl, TilePairCollisionsWater
call CheckForTilePairCollisions2
jr c, .no
ld d, SURF
call HasPartyMove
jr nz, .no
ld a, [wObtainedBadges]
bit 4, a ; SOUL BADGE
jr z, .no
callfar IsSurfingAllowed
ld hl, wd728
bit 1, [hl]
res 1, [hl]
jr z, .no
call InitializeFieldMoveTextBox
ld hl, PromptToSurfText
call PrintText
call YesNoChoice
ld a, [wCurrentMenuItem]
and a
jr nz, .no2
call GetPartyMonName2
ld a, SURFBOARD
ld [wcf91], a
ld [wPseudoItemID], a
call UseItem
.yes2
call CloseFieldMoveTextBox
.yes
xor a
ret
.no2
call CloseFieldMoveTextBox
.no
ld a, 1
and a
ret
TryCut:
call IsCutTile
jr nc, TrySurf.no
call InitializeFieldMoveTextBox
ld hl, ExplainCutText
call PrintText
call ManualTextScroll
ld d, CUT
call HasPartyMove
jr nz, TrySurf.no2
ld a, [wObtainedBadges]
bit 1, a ; CASCADE BADGE
jr z, TrySurf.no2
ld hl, PromptToCutText
call PrintText
call YesNoChoice
ld a, [wCurrentMenuItem]
and a
jr nz, TrySurf.no2
call GetPartyMonName2
callfar Cut2
call CloseFieldMoveTextBox
jr TrySurf.yes2
IsCutTile:
; partial copy from UsedCut
ld a, [wCurMapTileset]
and a ; OVERWORLD
jr z, .overworld
cp GYM
jr nz, .no
ld a, [wTileInFrontOfPlayer]
cp $50 ; gym cut tree
jr nz, .no
jr .yes
.overworld
ld a, [wTileInFrontOfPlayer]
cp $3d ; cut tree
jr nz, .no
.yes
scf
ret
.no
and a
ret
HasPartyMove::
; Return z (optional: in wWhichTrade) if a PartyMon has move d.
; Updates wWhichPokemon.
push bc
push de
push hl
ld a, [wPartyCount]
and a
jr z, .no
ld b, a
ld c, 0
ld hl, wPartyMons + (wPartyMon1Moves - wPartyMon1)
.loop
ld e, NUM_MOVES
.check_move
ld a, [hli]
cp d
jr z, .yes
dec e
jr nz, .check_move
ld a, wPartyMon2 - wPartyMon1 - NUM_MOVES
add l
ld l, a
adc h
sub l
ld h, a
inc c
ld a, c
cp b
jr c, .loop
jr .no
.yes
ld a, c
ld [wWhichPokemon], a
xor a ; probably redundant
ld [wWhichTrade], a
jr .done
.no
ld a, 1
and a
ld [wWhichTrade], a
.done
pop hl
pop de
pop bc
ret
InitializeFieldMoveTextBox:
call EnableAutoTextBoxDrawing
ld a, 1 ; not 0
ld [hSpriteIndexOrTextID], a
callfar DisplayTextIDInit
ret
CloseFieldMoveTextBox:
ld a,[hLoadedROMBank]
push af
jp CloseTextDisplay
PromptToSurfText:
text_far _PromptToSurfText
text_end
ExplainCutText:
text_far _ExplainCutText
text_end
PromptToCutText:
text_far _PromptToCutText
text_end

View file

@ -94,7 +94,9 @@ OverworldLoopLessDelay::
call IsSpriteOrSignInFrontOfPlayer call IsSpriteOrSignInFrontOfPlayer
ldh a, [hSpriteIndexOrTextID] ldh a, [hSpriteIndexOrTextID]
and a and a
jp z, OverworldLoop jr nz, .displayDialogue
predef TryFieldMove
jp OverworldLoop
.displayDialogue .displayDialogue
predef GetTileAndCoordsInFrontOfPlayer predef GetTileAndCoordsInFrontOfPlayer
call UpdateSprites call UpdateSprites

View file

@ -15,7 +15,24 @@ GroundRoseText::
BoulderText:: BoulderText::
text_far _BoulderText text_far _BoulderText
text_end text_asm
ld a, [wObtainedBadges]
bit 3, a ; RAINBOW BADGE
jr z, .done
ld d, STRENGTH
callfar HasPartyMove
ld a, [wWhichTrade]
and a
jr nz, .done
ld a, [wWhichPokemon]
push af
call ManualTextScroll
pop af
ld [wWhichPokemon], a
call GetPartyMonName2
predef PrintStrengthTxt
.done
jp TextScriptEnd
MartSignText:: MartSignText::
text_far _MartSignText text_far _MartSignText

View file

@ -83,16 +83,6 @@ DrawHPBar::
LoadMonData:: LoadMonData::
jpfar LoadMonData_ jpfar LoadMonData_
OverwritewMoves::
; Write c to [wMoves + b]. Unused.
ld hl, wMoves
ld e, b
ld d, 0
add hl, de
ld a, c
ld [hl], a
ret
LoadFlippedFrontSpriteByMonIndex:: LoadFlippedFrontSpriteByMonIndex::
ld a, 1 ld a, 1
ld [wSpriteFlipped], a ld [wSpriteFlipped], a
@ -360,15 +350,6 @@ PrintLevelCommon::
ld b, LEFT_ALIGN | 1 ; 1 byte ld b, LEFT_ALIGN | 1 ; 1 byte
jp PrintNumber jp PrintNumber
GetwMoves::
; Unused. Returns the move at index a from wMoves in a
ld hl, wMoves
ld c, a
ld b, 0
add hl, bc
ld a, [hl]
ret
; copies the base stat data of a pokemon to wMonHeader ; copies the base stat data of a pokemon to wMonHeader
; INPUT: ; INPUT:
; [wd0b5] = pokemon ID ; [wd0b5] = pokemon ID

View file

@ -325,6 +325,7 @@ INCLUDE "engine/gfx/mon_icons.asm"
INCLUDE "engine/events/in_game_trades.asm" INCLUDE "engine/events/in_game_trades.asm"
INCLUDE "engine/gfx/palettes.asm" INCLUDE "engine/gfx/palettes.asm"
INCLUDE "engine/menus/save.asm" INCLUDE "engine/menus/save.asm"
INCLUDE "engine/overworld/field_moves.asm"
SECTION "Itemfinder 1", ROMX SECTION "Itemfinder 1", ROMX
@ -350,10 +351,10 @@ SECTION "bank1E", ROMX
INCLUDE "engine/battle/animations.asm" INCLUDE "engine/battle/animations.asm"
INCLUDE "engine/overworld/cut2.asm" INCLUDE "engine/overworld/cut2.asm"
INCLUDE "engine/overworld/dust_smoke.asm" INCLUDE "engine/overworld/dust_smoke.asm"
INCLUDE "gfx/fishing.asm"
INCLUDE "data/moves/animations.asm" INCLUDE "data/moves/animations.asm"
INCLUDE "data/battle_anims/subanimations.asm" INCLUDE "data/battle_anims/subanimations.asm"
INCLUDE "data/battle_anims/frame_blocks.asm" INCLUDE "data/battle_anims/frame_blocks.asm"
INCLUDE "engine/movie/evolution.asm" INCLUDE "engine/movie/evolution.asm"
INCLUDE "engine/overworld/elevator.asm"
INCLUDE "engine/items/tm_prices.asm" INCLUDE "engine/items/tm_prices.asm"
INCLUDE "engine/overworld/elevator.asm"
INCLUDE "gfx/fishing.asm"