summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xevent/overworld.asm334
-rw-r--r--home/map.asm30
-rwxr-xr-xmacros/wram.asm6
-rw-r--r--main.asm35
-rw-r--r--wram.asm9
5 files changed, 389 insertions, 25 deletions
diff --git a/event/overworld.asm b/event/overworld.asm
index 6f0eb121..c44ca0d8 100755
--- a/event/overworld.asm
+++ b/event/overworld.asm
@@ -288,7 +288,7 @@ WhirlpoolBlockPointers:
.johto
db $07, $36, $00
db -1
-
+
FlashFunction:
call CheckUseFlash
and $7f
@@ -712,9 +712,337 @@ Text_AskUseWaterfall:
db "@"
EscapeRopeFunction:
+ call FieldMoveBufferReset
+ ld a, $1
+ jr asm_cbaa
+
+DigFunction:
+ call FieldMoveBufferReset
+ ld a, $2
+asm_cbaa
+ ld [wBuffer2], a
+.asm_cbad
+ ld hl, .Jumptable
+ call DoFieldMoveAction
+ jr nc, .asm_cbad
+ and $7f
+ ld [wFieldMoveSucceeded], a
+ ret
+
+.Jumptable:
+ dw TryEscapeFromDungeon
+ dw EscapeFromDungeon
+ dw FailToEscapeFromDungeon
+
+TryEscapeFromDungeon:
+ call GetMapPermission
+ cp CAVE
+ jr z, .asm_cbcf
+ cp DUNGEON
+ jr z, .asm_cbcf
+.asm_cbcc
+ ld a, $2
+ ret
+
+.asm_cbcf
+ ld hl, wDigWarpNumber
+ ld a, [hli]
+ and a
+ jr z, .asm_cbcc
+ ld a, [hli]
+ and a
+ jr z, .asm_cbcc
+ ld a, [hl]
+ and a
+ jr z, .asm_cbcc
+ ld a, $1
+ ret
+
+EscapeFromDungeon:
+ ld hl, wDigWarpNumber
+ ld de, wLastWarpNumber
+ ld bc, $3
+ call CopyBytes
+ call FieldMoveGetPartyNick
+ ld a, [wBuffer2]
+ cp $2
+ jr nz, .asm_cc00
+ ld hl, UsedDigScript
+ call QueueScript
+ ld a, $81
+ ret
+
+.asm_cc00
+ ld hl, UsedEscapeRopeScript
+ call QueueScript
+ ld a, $81
+ ret
+
+FailToEscapeFromDungeon:
+ ld a, [wBuffer2]
+ cp $2
+ jr nz, .asm_cc1c
+ ld hl, Text_CantUseDigEscapeRopeHere ; $4c29
+ call MenuTextBox
+ call WaitPressAorB_BlinkCursor
+ call CloseWindow
+.asm_cc1c
+ ld a, $80
+ ret
+
+Text_UsedDig: ; cc1f
+ text_jump Text_UsedDig_
+ db "@"
+
+Text_UsedEscapeRope:
+ text_jump Text_UsedEscapeRope_
+ db "@"
+
+Text_CantUseDigEscapeRopeHere:
+ text_jump Text_CantUseDigEscapeRopeHere_
+ db "@"
+
+UsedEscapeRopeScript: ; cc2e reloadmappart
+ reloadmappart
+ special UpdateTimePals
+ writetext Text_UsedEscapeRope ; cc24
+ jump ContinueDigEscapeRopeScript
+
+UsedDigScript:
+ reloadmappart
+ special UpdateTimePals
+ writetext Text_UsedDig
+ContinueDigEscapeRopeScript:
+ waitbutton
+ closetext
+ playsound SFX_WARP_TO
+ applymovement PLAYER, DigOutMovementData
+ farscall AbortBugCatchingContest
+ special WarpToSpawnPoint
+ writecode VAR_MOVEMENT, PLAYER_NORMAL
+ newloadmap MAPSETUP_DOOR
+ playsound SFX_WARP_FROM
+ applymovement PLAYER, DigReturnMovementData
+ end
+
+DigOutMovementData:
+ step_dig 32
+ hide_person
+ step_end
+
+DigReturnMovementData:
+ show_person
+ return_dig 32
+ step_end
+
+ call FieldMoveBufferReset
+.asm_cc67
+ ld hl, .Jumptable
+ call DoFieldMoveAction
+ jr nc, .asm_cc67
+ and $7f
+ ld [wFieldMoveSucceeded], a
+ ret
+
+.Jumptable:
+ dw TryTeleport
+ dw DoTeleport
+ dw FailTeleport
+
+TryTeleport:
+ call GetMapPermission
+ call CheckOutdoorMap
+ jr z, .asm_cc85
+ jr .asm_cc9c
+
+.asm_cc85
+ ld a, [wd9fb]
+ ld d, a
+ ld a, [wd9fc]
+ ld e, a
+ ld a, $5
+ ld hl, $5465
+ rst FarCall
+ jr nc, .asm_cc9c
+ ld a, c
+ ld [wceec], a
+ ld a, $1
+ ret
+
+.asm_cc9c
+ ld a, $2
+ ret
+
+DoTeleport:
+ call FieldMoveGetPartyNick
+ ld hl, TeleportScript
+ call QueueScript
+ ld a, $81
+ ret
+
+FailTeleport:
+ ld hl, Text_CantUseTeleportHere
+ call MenuTextBoxBackup
+ ld a, $80
+ ret
+
+Text_ReturnToLastMonCenter:
+ text_jump Text_ReturnToLastMonCenter_
+ db "@"
+
+Text_CantUseTeleportHere:
+ text_jump Text_CantUseTeleportHere_
+ db "@"
+
+TeleportScript: ; ccbe
+ reloadmappart
+ special UpdateTimePals
+ writetext Text_ReturnToLastMonCenter
+ pause 60
+ reloadmappart
+ closetext
+ playsound SFX_WARP_TO
+ applymovement PLAYER, TeleportFromMovementData
+ farscall AbortBugCatchingContest
+ special WarpToSpawnPoint
+ writecode VAR_MOVEMENT, PLAYER_NORMAL
+ newloadmap MAPSETUP_TELEPORT
+ playsound SFX_WARP_FROM
+ applymovement PLAYER, TeleportToMovementData
+ end
+
+TeleportFromMovementData: ; cce4
+ teleport_from
+ step_end
+
+TeleportToMovementData:
+ teleport_to
+ step_end
+
+StrengthFunction:
+ call Functionccf1
+ and $7f
+ ld [wFieldMoveSucceeded], a
+ ret
+
+Functionccf1: ; ccf1 (3:4cf1)
+ ld de, ENGINE_PLAINBADGE
+ call FieldMoveBadgeCheck
+ jr c, asm_cd09
+ jr asm_cd0c
+
+ ld hl, Text_AlreadyUsingStrength
+ call MenuTextBoxBackup
+ ld a, $80
+ ret
+
+Text_AlreadyUsingStrength:
+ text_jump Text_AlreadyUsingStrength_
+ db "@"
+
+asm_cd09
+ ld a, $80
+ ret
+
+asm_cd0c
+ ld hl, Script_StrengthFromMenu
+ call QueueScript
+ ld a, $81
+ ret
+
+GetStrengthUserSpeciesAndSetFlag:
+ SetFlag ENGINE_STRENGTH_ACTIVE
+ ld a, [wd005]
+ ld e, a
+ ld d, $0
+ ld hl, wPartySpecies
+ add hl, de
+ ld a, [hl]
+ ld [wBuffer6], a
+ call FieldMoveGetPartyNick
+ ret
+
+Script_StrengthFromMenu: ; cd2c
+ reloadmappart
+ special UpdateTimePals
+Script_UsedStrength:
+ callasm GetStrengthUserSpeciesAndSetFlag
+ writetext Text_UsedStrength
+ copybytetovar wBuffer6
+ cry 0
+ pause 3
+ writetext Text_AllowedToMoveBoulders
+ closetext
+ end
+
+Text_UsedStrength: ; cd44
+ text_jump Text_UsedStrength_
+ db "@"
+
+Text_AllowedToMoveBoulders:
+ text_jump Text_AllowedToMoveBoulders_
+ db "@"
+
+AskStrengthScript: ; cd4e
+ callasm TryStrengthOW
+ iffalse .ask
+ if_equal 1, .not_able
+ jump .already_active
+
+.not_able
+ jumptext Text_MonMayBeAbleToMove
+
+.already_active
+ jumptext Text_BouldersMayNowBeMoved
+
+.ask
+ opentext
+ writetext Text_AskStrength
+ yesorno
+ iftrue Script_UsedStrength
+ closetext
+ end
+
+Text_AskStrength:
+ text_jump Text_AskStrength_
+ db "@"
+
+Text_BouldersMayNowBeMoved:
+ text_jump Text_BouldersMayNowBeMoved_
+ db "@"
+
+Text_MonMayBeAbleToMove:
+ text_jump Text_MonMayBeAbleToMove_
+ db "@"
+
+TryStrengthOW:
+ ld d, STRENGTH
+ call FieldMovePartyCheck
+ jr c, .asm_cd95
+ ld de, ENGINE_PLAINBADGE
+ call FieldMoveEngineFlagCheck
+ jr c, .asm_cd95
+ CheckFlagHL ENGINE_STRENGTH_ACTIVE
+ jr z, .asm_cd99
+ ld a, $2
+ jr .asm_cd9c
+
+.asm_cd95
+ ld a, $1
+ jr .asm_cd9c
+
+.asm_cd99
+ xor a
+ jr .asm_cd9c
+
+.asm_cd9c
+ ld [wScriptVar], a
+ ret
+
+WhirlpoolFunction: ; cda0
IF DEF(GOLD)
- dr $cb9e, $d1e2
+ dr $cda0, $d1e2
ENDC
IF DEF(SILVER)
- dr $cb9c, $d1e0
+ dr $cd9e, $d1e0
ENDC
diff --git a/home/map.asm b/home/map.asm
index a4bfebae..ac9fe360 100644
--- a/home/map.asm
+++ b/home/map.asm
@@ -593,11 +593,11 @@ Function230f:: ; 230f (0:230f)
ld a, [hli]
.asm_232b
pop bc
- ld [wd043], a
+ ld [wLastWarpNumber], a
ld a, [hli]
- ld [wd044], a
+ ld [wLastMapGroup], a
ld a, [hli]
- ld [wd045], a
+ ld [wLastMapNumber], a
ld a, c
ld [wd046], a
ld a, [wMapGroup]
@@ -610,11 +610,11 @@ Function230f:: ; 230f (0:230f)
Function2349::
call Function2362
call Function239b
- ld a, [wd043]
+ ld a, [wLastWarpNumber]
ld [wd9ff], a
- ld a, [wd044]
+ ld a, [wLastMapGroup]
ld [wMapGroup], a
- ld a, [wd045]
+ ld a, [wLastMapNumber]
ld [wMapNumber], a
ret
@@ -622,9 +622,9 @@ Function2362:: ; 2362 (0:2362)
call GetMapPermission
call CheckOutdoorMap
ret nz
- ld a, [wd044]
+ ld a, [wLastMapGroup]
ld b, a
- ld a, [wd045]
+ ld a, [wLastMapNumber]
ld c, a
call GetAnyMapPermission
call CheckIndoorMap
@@ -639,27 +639,27 @@ Function2362:: ; 2362 (0:2362)
ret z
.asm_2388
ld a, [wd046]
- ld [wd9f2], a
+ ld [wDigWarpNumber], a
ld a, [wd047]
- ld [wd9f3], a
+ ld [wDigMapGroup], a
ld a, [wd048]
- ld [wd9f4], a
+ ld [wDigMapNumber], a
ret
Function239b:: ; 239b (0:239b)
call GetMapPermission
call CheckOutdoorMap
ret nz
- ld a, [wd044]
+ ld a, [wLastMapGroup]
ld b, a
- ld a, [wd045]
+ ld a, [wLastMapNumber]
ld c, a
call GetAnyMapPermission
call CheckIndoorMap
ret nz
- ld a, [wd044]
+ ld a, [wLastMapGroup]
ld b, a
- ld a, [wd045]
+ ld a, [wLastMapNumber]
ld c, a
call GetAnyMapTileset
ld a, c
diff --git a/macros/wram.asm b/macros/wram.asm
index 1a44f0f1..3837bf51 100755
--- a/macros/wram.asm
+++ b/macros/wram.asm
@@ -372,3 +372,9 @@ battle_bg_effect: MACRO
\1_02:: ds 1
\1_03:: ds 1
endm
+
+warp_struct: MACRO
+\1WarpNumber:: ds 1
+\1MapGroup:: ds 1
+\1MapNumber:: ds 1
+ENDM
diff --git a/main.asm b/main.asm
index 36104fda..e4966647 100644
--- a/main.asm
+++ b/main.asm
@@ -1385,7 +1385,40 @@ Text_CantDoWaterfall_::
dr $194064, $194080
Text_AskUseWaterfall_::
- dr $194080, $195610
+ dr $194080, $19409f
+
+Text_UsedDig_::
+ dr $19409f, $1940ae
+
+Text_UsedEscapeRope_::
+ dr $1940ae, $1940c6
+
+Text_CantUseDigEscapeRopeHere_::
+ dr $1940c6, $1940db
+
+Text_ReturnToLastMonCenter_::
+ dr $1940db, $1940fc
+
+Text_CantUseTeleportHere_::
+ dr $1940fc, $194112
+
+Text_AlreadyUsingStrength_::
+ dr $194112, $194135
+
+Text_UsedStrength_::
+ dr $194135, $194149
+
+Text_AllowedToMoveBoulders_::
+ dr $194149, $194161
+
+Text_AskStrength_::
+ dr $194161, $194199
+
+Text_BouldersMayNowBeMoved_::
+ dr $194199, $1941b5
+
+Text_MonMayBeAbleToMove_::
+ dr $1941b5, $195610
ClockTimeUnknownText_:: ; 195610
dr $195610, $195624
diff --git a/wram.asm b/wram.asm
index e36f4b23..4fe3a3b9 100644
--- a/wram.asm
+++ b/wram.asm
@@ -2419,9 +2419,8 @@ wLinkMode:: ds 1 ; d042
; 0 not in link battle
; 1 link battle
-wd043:: ds 1 ; d043
-wd044:: ds 1 ; d044
-wd045:: ds 1 ; d045
+ warp_struct wLast ; d043
+
wd046:: ds 1 ; d046
wd047:: ds 1 ; d047
wd048:: ds 1 ; d048
@@ -3573,9 +3572,7 @@ wd9ed:: ds 1 ; d9ed
wMapData::
wVisitedSpawns:: ds 4 ; flag_array NUM_SPAWNS ; d9ee
-wd9f2:: ds 1 ; d9f2
-wd9f3:: ds 1 ; d9f3
-wd9f4:: ds 1 ; d9f4
+ warp_struct wDig ; d9f2
wd9f5:: ds 1 ; d9f5
wd9f6:: ds 1 ; d9f6
wd9f7:: ds 1 ; d9f7