From c955c8d353f63c07cc4ac71160e4a13061192c8a Mon Sep 17 00:00:00 2001 From: Pokeglitch Date: Thu, 14 Jun 2018 21:46:09 -0400 Subject: Disassembled teleport --- engine/events/overworld.asm | 106 ++++++++++++++++++++++++++++++++++++++++++++ engine/items/inventory.asm | 6 ++- 2 files changed, 110 insertions(+), 2 deletions(-) create mode 100755 engine/events/overworld.asm (limited to 'engine') diff --git a/engine/events/overworld.asm b/engine/events/overworld.asm new file mode 100755 index 0000000..76e6b91 --- /dev/null +++ b/engine/events/overworld.asm @@ -0,0 +1,106 @@ +INCLUDE "constants.asm" + +SECTION "TeleportFunction", ROMX[$52db], BANK[$03] + +TeleportFunction: ; 03:52db + xor a + ld [wFieldMoveScriptID], a +.loop + ld a, [wFieldMoveScriptID] + bit 7, a + jr nz, .finish + ld hl, .JumpTable + call CallJumptable + jr .loop +.finish + and $7f + ld [wFieldMoveSucceeded], a + ret + +.JumpTable + dw .TryTeleport + dw .DoTeleport + dw .FailTeleport + dw .CheckIfSpawnPoint + +.TryTeleport: ; 03:52fc + call GetMapEnvironment + cp TOWN + jr z, .success + cp ROUTE + jr z, .success + ld a, $02 + ld [wFieldMoveScriptID], a + ret +.success + ld a, $03 + ld [wFieldMoveScriptID], a + ret + +.CheckIfSpawnPoint ; 03:5313 + ld a, [wLastSpawnMapGroup] + ld d, a + ld a, [wLastSpawnMapNumber] + ld e, a + ld hl, IsSpawnPoint + ld a, BANK(IsSpawnPoint) + call FarCall_hl + jr c, .not_spawn + ld hl, .Text_CantFindDestination + call MenuTextBoxBackup + ld a, $80 + ld [wFieldMoveScriptID], a + ret +.not_spawn + ld a, c + ld [wDebugWarpSelection], a + ld a, $01 + ld [wFieldMoveScriptID], a + ret + +.Text_CantFindDestination: + db "" + db "とびさきが みつかりません" + db "" + +.DoTeleport: ; 03:534b + ldh a, [hROMBank] + ld hl, .TeleportScript + call QueueScript + ld a, $8f + ld [wFieldMoveScriptID], a + ret + +.FailTeleport: ; 03:5359 + ld hl, .Text_CantUseHere + call MenuTextBoxBackup + ld a, $80 + ld [wFieldMoveScriptID], a + scf + ret + +.Text_CantUseHere: + db "" + db "ここでは つかえません!" + db "" + +.TeleportScript: ; 03:5375 + call RefreshScreen + ld hl, .Text_ReturnToLastMonCenter + call MenuTextBox + ld c, 60 + call DelayFrames + call CloseWindow + call Function1fea + ld a, MAPSETUP_TELEPORT + ldh [hMapEntryMethod], a + ld hl, Functionfcc24 + ld a, BANK(Functionfcc24) + jp FarCall_hl + +.Text_ReturnToLastMonCenter: + db "" + db "さいごに たちよった" + db "" + db "#センターにもどります" + db "" \ No newline at end of file diff --git a/engine/items/inventory.asm b/engine/items/inventory.asm index a95f2ac..5927f6d 100755 --- a/engine/items/inventory.asm +++ b/engine/items/inventory.asm @@ -596,7 +596,8 @@ GetNumberedTMHM: ; 03:4D1A SECTION "_CheckTossableItem", ROMX[$53AD], BANK[$03] -; Return 1 in wItemAttributeParamBuffer and carry if wCurItem can't be removed from the bag. +; Return 1 in wItemAttributeParamBuffer and +; carry if wCurItem can't be removed from the bag. _CheckTossableItem: ; 03:53AD ld a, ITEMATTR_PERMISSIONS call GetItemAttr @@ -605,7 +606,8 @@ _CheckTossableItem: ; 03:53AD and a ret -; Return 1 in wItemAttributeParamBuffer and carry if wCurItem can't be selected. +; Return 1 in wItemAttributeParamBuffer +; and carry if wCurItem can't be selected. CheckSelectableItem: ; 03:53B8 ld a, ITEMATTR_PERMISSIONS call GetItemAttr -- cgit v1.2.3