summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpikalaxalt <PikalaxALT@gmail.com>2016-06-01 22:00:46 -0400
committerpikalaxalt <PikalaxALT@gmail.com>2016-06-01 22:00:46 -0400
commita2befe3463baee7a9e935b5d0caef3744f7371f3 (patch)
tree02b443f945b06393dfae94d20644e461c638dd74
parent14ef52bdd8202d9d595811a0ac8b6f1dbd2b8a6f (diff)
Remaining maps in Fuchsia
-rwxr-xr-xdata/mapObjects/fuchsiagym.asm2
-rw-r--r--data/map_header_banks.asm8
-rw-r--r--data/map_header_pointers.asm8
-rw-r--r--engine/bank3c.asm3
-rwxr-xr-xmain.asm22
-rwxr-xr-xscripts/safarizoneentrance.asm118
-rwxr-xr-xscripts/safarizoneentrance2.asm251
7 files changed, 296 insertions, 116 deletions
diff --git a/data/mapObjects/fuchsiagym.asm b/data/mapObjects/fuchsiagym.asm
index ded17031..c7fc3799 100755
--- a/data/mapObjects/fuchsiagym.asm
+++ b/data/mapObjects/fuchsiagym.asm
@@ -8,7 +8,7 @@ FuchsiaGymObject: ; 0x75658 (size=82)
db $0 ; signs
db $8 ; objects
- object SPRITE_BLACKBELT, $4, $a, STAY, DOWN, $1, OPP_KOGA, $1
+ object SPRITE_LAPRAS_GIVER, $4, $a, STAY, DOWN, $1, OPP_KOGA, $1
object SPRITE_ROCKER, $8, $d, STAY, DOWN, $2, OPP_JUGGLER, $7
object SPRITE_ROCKER, $7, $8, STAY, RIGHT, $3, OPP_JUGGLER, $3
object SPRITE_ROCKER, $1, $c, STAY, DOWN, $4, OPP_JUGGLER, $8
diff --git a/data/map_header_banks.asm b/data/map_header_banks.asm
index 83716936..4ae6db8a 100644
--- a/data/map_header_banks.asm
+++ b/data/map_header_banks.asm
@@ -155,10 +155,10 @@ MapHeaderBanks:: ; fc3e4 (3f:43e4)
db BANK(FuchsiaMart_h)
db BANK(FuchsiaHouse1_h)
db BANK(FuchsiaPokecenter_h)
- db $1d ; db BANK(FuchsiaHouse2_h)
- db $1d ; db BANK(SafariZoneEntrance_h)
- db $1d ; db BANK(FuchsiaGym_h)
- db $1d ; db BANK(FuchsiaMeetingRoom_h)
+ db BANK(FuchsiaHouse2_h)
+ db BANK(SafariZoneEntrance_h)
+ db BANK(FuchsiaGym_h)
+ db BANK(FuchsiaMeetingRoom_h)
db $11 ; db BANK(SeafoamIslands2_h)
db $11 ; db BANK(SeafoamIslands3_h)
db $11 ; db BANK(SeafoamIslands4_h)
diff --git a/data/map_header_pointers.asm b/data/map_header_pointers.asm
index 866ccb8a..f1ca177b 100644
--- a/data/map_header_pointers.asm
+++ b/data/map_header_pointers.asm
@@ -155,10 +155,10 @@ MapHeaderPointers:: ; fc1f2 (3f:41f2)
dw FuchsiaMart_h
dw FuchsiaHouse1_h
dw FuchsiaPokecenter_h
- dw $4902 ; dw FuchsiaHouse2_h
- dw $4a1a ; dw SafariZoneEntrance_h
- dw $4bd9 ; dw FuchsiaGym_h
- dw $4e7f ; dw FuchsiaMeetingRoom_h
+ dw FuchsiaHouse2_h
+ dw SafariZoneEntrance_h
+ dw FuchsiaGym_h
+ dw FuchsiaMeetingRoom_h
dw $6578 ; dw SeafoamIslands2_h
dw $66b4 ; dw SeafoamIslands3_h ;id=160
dw $67f0 ; dw SeafoamIslands4_h
diff --git a/engine/bank3c.asm b/engine/bank3c.asm
index 907960be..b44b7f18 100644
--- a/engine/bank3c.asm
+++ b/engine/bank3c.asm
@@ -385,7 +385,8 @@ PikachuMovementData_f1f2c:
db $3f
INCLUDE "scripts/celadondiner2.asm"
- dr $f1f77, $f218c
+INCLUDE "scripts/safarizoneentrance2.asm"
+ dr $f2133, $f218c
INCLUDE "scripts/mtmoonpokecenter2.asm"
diff --git a/main.asm b/main.asm
index 4ccc007e..bcc972eb 100755
--- a/main.asm
+++ b/main.asm
@@ -1619,7 +1619,27 @@ INCLUDE "data/mapObjects/fuchsiahouse1.asm"
INCLUDE "data/mapHeaders/fuchsiapokecenter.asm"
INCLUDE "scripts/fuchsiapokecenter.asm"
INCLUDE "data/mapObjects/fuchsiapokecenter.asm"
- dr $74902,$757a0
+
+INCLUDE "data/mapHeaders/fuchsiahouse2.asm"
+INCLUDE "scripts/fuchsiahouse2.asm"
+INCLUDE "data/mapObjects/fuchsiahouse2.asm"
+FuchsiaHouse2Blocks: INCBIN "maps/fuchsiahouse2.blk"
+
+INCLUDE "data/mapHeaders/safarizoneentrance.asm"
+INCLUDE "data/mapObjects/safarizoneentrance.asm"
+SafariZoneEntranceBlocks: INCBIN "maps/safarizoneentrance.blk"
+INCLUDE "scripts/safarizoneentrance.asm"
+
+INCLUDE "data/mapHeaders/fuchsiagym.asm"
+INCLUDE "scripts/fuchsiagym.asm"
+INCLUDE "data/mapObjects/fuchsiagym.asm"
+FuchsiaGymBlocks: INCBIN "maps/fuchsiagym.blk"
+
+INCLUDE "data/mapHeaders/fuchsiameetingroom.asm"
+INCLUDE "scripts/fuchsiameetingroom.asm"
+INCLUDE "data/mapObjects/fuchsiameetingroom.asm"
+FuchsiaMeetingRoomBlocks: INCBIN "maps/fuchsiameetingroom.blk"
+ dr $74ee6,$757a0
INCLUDE "data/mapHeaders/gary.asm"
INCLUDE "scripts/gary.asm"
diff --git a/scripts/safarizoneentrance.asm b/scripts/safarizoneentrance.asm
index a0a0ffda..df80f4e1 100755
--- a/scripts/safarizoneentrance.asm
+++ b/scripts/safarizoneentrance.asm
@@ -2,7 +2,8 @@ SafariZoneEntranceScript: ; 751cd (1d:51cd)
call EnableAutoTextBoxDrawing
ld hl, SafariZoneEntranceScriptPointers
ld a, [wSafariZoneEntranceCurScript]
- jp JumpTable
+ call JumpTable
+ ret
SafariZoneEntranceScriptPointers: ; 751d9 (1d:51d9)
dw .SafariZoneEntranceScript0
@@ -43,8 +44,8 @@ SafariZoneEntranceScriptPointers: ; 751d9 (1d:51d9)
ret
.CoordsData_75221: ; 75221 (1d:5221)
- db $02,$03
- db $02,$04
+ db $02, $03
+ db $02, $04
db $FF
.SafariZoneEntranceScript1
@@ -85,6 +86,8 @@ SafariZoneEntranceScriptPointers: ; 751d9 (1d:51d9)
call DisplayTextID
xor a
ld [wNumSafariBalls], a
+ ld [wSafariSteps], a
+ ld [wSafariSteps], a ; ?????
ld a, D_DOWN
ld c, $3
call SafariZoneEntranceAutoWalk
@@ -117,10 +120,10 @@ SafariZoneEntranceScriptPointers: ; 751d9 (1d:51d9)
SafariZoneEntranceAutoWalk:
push af
- ld b,0
- ld a,c
- ld [wSimulatedJoypadStatesIndex],a
- ld hl,wSimulatedJoypadStatesEnd
+ ld b, 0
+ ld a, c
+ ld [wSimulatedJoypadStatesIndex], a
+ ld hl, wSimulatedJoypadStatesEnd
pop af
call FillMemory
jp StartSimulatingJoypadStates
@@ -143,89 +146,15 @@ SafariZoneEntranceTextPointers: ; 752b9 (1d:52b9)
db "@"
.SafariZoneEntranceText4
- TX_FAR SafariZoneEntranceText_9e6e4
TX_ASM
- ld a, MONEY_BOX
- ld [wTextBoxID],a
- call DisplayTextBoxID
- call YesNoChoice
- ld a,[wCurrentMenuItem]
- and a
- jp nz,.PleaseComeAgain
- xor a
- ld [hMoney],a
- ld a,$05
- ld [hMoney + 1],a
- ld a,$00
- ld [hMoney + 2],a
- call HasEnoughMoney
- jr nc,.success
- ld hl,.NotEnoughMoneyText
- call PrintText
- jr .CantPayWalkDown
-
-.success
- xor a
- ld [wPriceTemp],a
- ld a,$05
- ld [wPriceTemp + 1],a
- ld a,$00
- ld [wPriceTemp + 2],a
- ld hl,wPriceTemp + 2
- ld de,wPlayerMoney + 2
- ld c,3
- predef SubBCDPredef
- ld a,MONEY_BOX
- ld [wTextBoxID],a
- call DisplayTextBoxID
- ld hl,.MakePaymentText
- call PrintText
- ld a,30
- ld [wNumSafariBalls],a
- ld a,502 / $100
- ld [wSafariSteps],a
- ld a, 502 % $100
- ld [wSafariSteps + 1],a
- ld a,D_UP
- ld c,3
- call SafariZoneEntranceAutoWalk
- SetEvent EVENT_IN_SAFARI_ZONE
- ResetEventReuseHL EVENT_SAFARI_GAME_OVER
- ld a,3
- ld [wSafariZoneEntranceCurScript],a
- jr .done
-
-.PleaseComeAgain
- ld hl,.PleaseComeAgainText
- call PrintText
-.CantPayWalkDown
- ld a,D_DOWN
- ld c,1
- call SafariZoneEntranceAutoWalk
- ld a,4
- ld [wSafariZoneEntranceCurScript],a
-.done
+ callab Func_f1f77
jp TextScriptEnd
-.MakePaymentText
- TX_FAR SafariZoneEntranceText_9e747
- db $b
- TX_FAR _SafariZoneEntranceText_75360
- db "@"
-
-.PleaseComeAgainText
- TX_FAR _SafariZoneEntranceText_75365
- db "@"
-
-.NotEnoughMoneyText
- TX_FAR _SafariZoneEntranceText_7536a
- db "@"
-
.SafariZoneEntranceText5
TX_FAR SafariZoneEntranceText_9e814
TX_ASM
call YesNoChoice
- ld a,[wCurrentMenuItem]
+ ld a, [wCurrentMenuItem]
and a
jr nz, .asm_7539c
ld hl, .SafariZoneEntranceText_753bb
@@ -268,26 +197,5 @@ SafariZoneEntranceTextPointers: ; 752b9 (1d:52b9)
.SafariZoneEntranceText2
TX_ASM
- ld hl,.FirstTimeQuestionText
- call PrintText
- call YesNoChoice
- ld a,[wCurrentMenuItem]
- and a
- ld hl,.RegularText
- jr nz,.Explanation
- ld hl,.ExplanationText
-.Explanation
- call PrintText
+ callab Func_f203e
jp TextScriptEnd
-
-.FirstTimeQuestionText
- TX_FAR _SafariZoneEntranceText_753e6
- db "@"
-
-.ExplanationText
- TX_FAR _SafariZoneEntranceText_753eb
- db "@"
-
-.RegularText
- TX_FAR _SafariZoneEntranceText_753f0
- db "@"
diff --git a/scripts/safarizoneentrance2.asm b/scripts/safarizoneentrance2.asm
new file mode 100755
index 00000000..0eb50790
--- /dev/null
+++ b/scripts/safarizoneentrance2.asm
@@ -0,0 +1,251 @@
+Func_f1f77:
+ ld hl, .WelcomeText
+ call PrintText
+ ld a, MONEY_BOX
+ ld [wTextBoxID], a
+ call DisplayTextBoxID
+ call YesNoChoice
+ ld a, [wCurrentMenuItem]
+ and a
+ jp nz, .declined
+ ld hl, wPlayerMoney
+ ld a, [hli]
+ or [hl]
+ inc hl
+ or [hl]
+ jr nz, .has_positive_balance
+ call SafariZoneEntranceGetLowCostAdmissionText
+ jr c, .deny_entry
+ jr .poor_mans_discount
+
+.has_positive_balance
+ xor a
+ ld [hMoney], a
+ ld a, $5
+ ld [hMoney + 1], a
+ ld a, $0
+ ld [hMoney + 2], a
+ call HasEnoughMoney
+ jr nc, .has_enough_money
+ ld hl, .NotEnoughMoneyText
+ call PrintText
+ call SafariZoneEntranceCalculateLowCostAdmission
+ jr c, .deny_entry
+ jr .poor_mans_discount
+
+.has_enough_money
+ xor a
+ ld [wPriceTemp + 0], a
+ ld a, $5
+ ld [wPriceTemp + 1], a
+ ld a, $0
+ ld [wPriceTemp + 2], a
+ ld hl, wTrainerInfoTextBoxNextRowOffset
+ ld de, wPlayerMoney + 2
+ ld c, 3
+ predef SubBCDPredef
+ ld a, SFX_PURCHASE
+ call PlaySoundWaitForCurrent
+ call WaitForSoundToFinish
+ ld a, MONEY_BOX
+ ld [wTextBoxID], a
+ call DisplayTextBoxID
+ ld hl, .MakePaymentText
+ call PrintText
+ ld a, 30
+ ld hl, 502
+.poor_mans_discount
+ ld [wNumSafariBalls], a
+ ld a, h
+ ld [wSafariSteps], a
+ ld a, l
+ ld [wSafariSteps + 1], a
+ ld a, D_UP
+ ld c, 3
+ call SafariZoneEntranceStartSimulatiingJoypadStates
+ SetEvent EVENT_IN_SAFARI_ZONE
+ ResetEventReuseHL EVENT_SAFARI_GAME_OVER
+ ld a, $3
+ ld [wSafariZoneEntranceCurScript], a
+ jr .asm_f2024
+.declined:
+ ld hl, .PleaseComeAgainText
+ call PrintText
+.deny_entry
+ ld a, D_DOWN
+ ld c, 1
+ call SafariZoneEntranceStartSimulatiingJoypadStates
+ ld a, $4
+ ld [wSafariZoneEntranceCurScript], a
+.asm_f2024
+ ret
+
+.WelcomeText
+ TX_FAR SafariZoneEntranceText_9e6e4
+ db "@"
+
+.MakePaymentText
+ TX_FAR SafariZoneEntranceText_9e747
+ TX_SFX_ITEM
+ TX_FAR _SafariZoneEntranceText_75360
+ db "@"
+
+.PleaseComeAgainText
+ TX_FAR _SafariZoneEntranceText_75365
+ db "@"
+
+.NotEnoughMoneyText
+ TX_FAR _SafariZoneEntranceText_7536a
+ db "@"
+
+Func_f203e:
+ 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 "@"
+
+SafariZoneEntranceStartSimulatiingJoypadStates:
+ push af
+ ld b, $0
+ ld a, c
+ ld [wSimulatedJoypadStatesIndex], a
+ ld hl, wParentMenuItem
+ pop af
+ call FillMemory
+ jp StartSimulatingJoypadStates
+
+SafariZoneEntranceCalculateLowCostAdmission:
+ ld hl, wPlayerMoney
+ ld de, hMoney
+ ld bc, $3
+ call CopyData
+ xor a
+ ld [hDivideBCDDivisor], a
+ ld [hDivideBCDDivisor + 1], a
+ ld a, 23
+ ld [hDivideBCDDivisor + 2], a
+ predef DivideBCDPredef3
+ ld a, [hDivideBCDQuotient + 2]
+ call SafariZoneEntranceConvertBCDtoNumber
+ push af
+ ld hl, wPlayerMoney
+ xor a
+ ld bc, $3
+ call FillMemory
+ ld hl, SafariZoneEntranceText_f20c4
+ call PrintText_NoCreatingTextBox
+ ld a, MONEY_BOX
+ ld [wTextBoxID], a
+ call DisplayTextBoxID
+ ld hl, SafariZoneEntranceText_f20c9
+ call PrintText
+ pop af
+ inc a
+ jr z, .max_balls
+ cp 29
+ jr c, .load_balls
+.max_balls
+ ld a, 29
+.load_balls
+ ld hl, 502
+ and a
+ ret
+
+SafariZoneEntranceText_f20c4:
+ TX_FAR _SafariZoneLowCostText1
+ db "@"
+
+SafariZoneEntranceText_f20c9:
+ TX_FAR _SafariZoneLowCostText2
+ db "@"
+
+SafariZoneEntranceGetLowCostAdmissionText:
+ ld hl, wSafariSteps
+ ld a, [hl]
+ push af
+ inc [hl]
+ ld e, a
+ ld d, $0
+ ld hl, Pointers_f2100
+ add hl, de
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ call PrintText
+ pop af
+ cp $3
+ jr z, .give_one_ball
+ scf
+ ret
+
+.give_one_ball
+ ld hl, SafariZoneEntranceText_f20f6
+ call PrintText_NoCreatingTextBox
+ ld a, $1
+ ld hl, 502
+ and a
+ ret
+
+SafariZoneEntranceText_f20f6:
+ TX_FAR _SafariZoneLowCostText3
+ TX_SFX_ITEM
+ TX_FAR _SafariZoneLowCostText4
+ db "@"
+
+Pointers_f2100:
+ dw SafariZoneEntranceText_f210a
+ dw SafariZoneEntranceText_f210f
+ dw SafariZoneEntranceText_f2114
+ dw SafariZoneEntranceText_f2119
+ dw SafariZoneEntranceText_f2119
+
+SafariZoneEntranceText_f210a:
+ TX_FAR _SafariZoneLowCostText5
+ db "@"
+
+SafariZoneEntranceText_f210f:
+ TX_FAR _SafariZoneLowCostText6
+ db "@"
+
+SafariZoneEntranceText_f2114:
+ TX_FAR _SafariZoneLowCostText7
+ db "@"
+
+SafariZoneEntranceText_f2119:
+ TX_FAR _SafariZoneLowCostText8
+ db "@"
+
+SafariZoneEntranceConvertBCDtoNumber:
+ push hl
+ ld c, a
+ and $f
+ ld l, a
+ ld h, $0
+ ld a, c
+ and $f0
+ swap a
+ ld bc, 10
+ call AddNTimes
+ ld a, l
+ pop hl
+ ret