Skip to content

Commit

Permalink
Add parts of the Safari Zone entrance script from Yellow.
Browse files Browse the repository at this point in the history
  • Loading branch information
iimarckus committed Oct 18, 2014
1 parent 2e376fe commit a36e090
Show file tree
Hide file tree
Showing 4 changed files with 410 additions and 105 deletions.
257 changes: 257 additions & 0 deletions scripts/safarizoneentrance-yellow.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
.xf1f77
ld hl,.ForJust500Text
call PrintText
ld a,$13
ld [wd125],a
call DisplayTextBoxID
call YesNoChoice
ld a,[wCurrentMenuItem]
and a
jp nz,.PleaseComeAgain
ld hl,$d346 ; yellow d346
ld a,[hli]
or [hl]
inc hl
or [hl]
jr nz,.xf1f9f
.xf1f98
call .xf20ce
jr c,.CantPayWalkDown
jr .xf1ff2

.xf1f9f
xor a
ld [$ff9f],a
ld a,$05
ld [$ffa0],a
ld a,$00
ld [$ffa1],a
call HasEnoughMoney
jr nc,.success
ld hl,.NotEnoughMoneyText
call PrintText
call .xf2077
jr c,.CantPayWalkDown
jr .xf1ff2

.success
xor a
ld [wSubtrahend],a
ld a,$05
ld [wSubtrahend+1],a
ld a,$00
ld [wSubtrahend+2],a
ld hl,wTrainerFacingDirection
ld de,wPlayerMoney + 2
ld c,3
predef SubBCDPredef
ld a,$b2
call $3736
call $373e
ld a,$13
ld [wd125],a
call DisplayTextBoxID
ld hl,.MakePaymentText
call PrintText
ld a,30
ld hl,(502 / $100) << 8 | (502 % $100)
.xf1ff2
ld [W_NUMSAFARIBALLS],a
ld a,h
ld [wSafariSteps],a
ld a,l
ld [wSafariSteps + 1],a
ld a,$40
ld c,3
call SafariZoneEntranceAutoWalk
ld hl,wd790
set 7,[hl]
res 6,[hl]
ld a,3
ld [W_SAFARIZONEENTRANCECURSCRIPT],a
jr .done

.PleaseComeAgain
ld hl,.PleaseComeAgainText
call PrintText
.CantPayWalkDown
ld a,$80
ld c,1
call SafariZoneEntranceAutoWalk
ld a,4
ld [W_SAFARIZONEENTRANCECURSCRIPT],a
.done
ret

.ForJust500Text
TX_FAR SafariZoneEntranceText_9e6e4
db "@"

.MakePaymentText
TX_FAR SafariZoneEntranceText_9e747
db $b
TX_FAR _SafariZoneEntranceText_75360
db "@"

.PleaseComeAgainText
TX_FAR _SafariZoneEntranceText_75365
db "@"

.NotEnoughMoneyText
TX_FAR _SafariZoneEntranceText_7536a
db "@"

.SafariZoneEntranceText2
ld hl,.FirstTimeQuestionText
call PrintText
call YesNoChoice
ld a,[wCurrentMenuItem]
and a
ld hl,.RegularText
jr nz,.Explanation
ld hl,.ExplanationText
.Explanation
call PrintText
ret

.FirstTimeQuestionText
TX_FAR _SafariZoneEntranceText_753e6
db "@"

.ExplanationText
TX_FAR _SafariZoneEntranceText_753eb
db "@"

.RegularText
TX_FAR _SafariZoneEntranceText_753f0
db "@"

SafariZoneEntranceAutoWalk:
push af
ld b,0
ld a,c
ld [wSimulatedJoypadStatesIndex],a
ld hl,wSimulatedJoypadStatesEnd
pop af
call FillMemory
jp StartSimulatingJoypadStates

.xf2077
ld hl,$d346
ld de,$ff9f
ld bc,3
call $1b
xor a
ld [$ffa2],a
ld [$ffa3],a
ld a,$17
ld [$ffa4],a
ld a,$d
call $3eb4
ld a,[$ffa4]
call .xf211e
pop af
ld hl,$d346
xor a
ld bc,3
call $166e
ld hl,.OhAllRightText
call $3c46
ld a,$13
ld a,[$d124]
call $3010
ld hl,.CantGive30BallsText
call PrintText
pop af
inc a
jr z,.xf20bd
cp $1d
jr c,.xf20bf
.xf20bd
ld a,$1d
.xf20bf
ld hl,$1f6
and a
ret

.OhAllRightText
TX_FAR _SafariZoneLowCostText1
db "@"

.CantGive30BallsText
TX_FAR _SafariZoneLowCostText2
db "@"

.xf20ce
ld hl,$d70c
ld a,[hl]
push af
inc [hl]
ld e,a
ld d,0
ld hl,.lowcosttextpointers
add hl,de
add hl,de
ld a,[hli]
ld h,[hl]
ld l,a
call PrintText
pop af
cp 3
jr z,.next
scf
ret

.next
ld hl,.xf20f6
call $3c46
ld a,1
ld hl,$01f6
and a
ret

.xf20f6
TX_FAR _SafariZoneLowCostText3
db $b
TX_FAR _SafariZoneLowCostText4
db "@"

.lowcosttextpointers
dw .xf210a
dw .xf210f
dw .xf2114
dw .xf2119
dw .xf2119

.xf210a
TX_FAR _SafariZoneLowCostText5
db "@"

.xf210f
TX_FAR _SafariZoneLowCostText6
db "@"

.xf2114
TX_FAR _SafariZoneLowCostText7
db "@"

.xf2119
TX_FAR _SafariZoneLowCostText8
db "@"

.xf211e
push hl
ld c,a
and $f
ld l,a
ld h,0
ld a,c
and $f0
swap a
ld bc,$a
call $3a74
ld a,l
pop hl
ret

.xf2133
Loading

0 comments on commit a36e090

Please sign in to comment.