mirror of
https://github.com/pret/pokered.git
synced 2024-10-22 22:55:31 +00:00
Thoroughly document debug code (#410)
This commit is contained in:
parent
d001ced41b
commit
f46db37d50
18 changed files with 128 additions and 109 deletions
|
@ -13,7 +13,7 @@
|
||||||
const POKE_BALL ; $04
|
const POKE_BALL ; $04
|
||||||
const TOWN_MAP ; $05
|
const TOWN_MAP ; $05
|
||||||
const BICYCLE ; $06
|
const BICYCLE ; $06
|
||||||
const SURFBOARD ; $07 buggy?
|
const SURFBOARD ; $07
|
||||||
const SAFARI_BALL ; $08
|
const SAFARI_BALL ; $08
|
||||||
const POKEDEX ; $09
|
const POKEDEX ; $09
|
||||||
const MOON_STONE ; $0A
|
const MOON_STONE ; $0A
|
||||||
|
|
|
@ -16,3 +16,6 @@ DEF TEXT_DELAY_SLOW EQU %101 ; 5
|
||||||
const_def 6
|
const_def 6
|
||||||
const BIT_BATTLE_SHIFT ; 6
|
const BIT_BATTLE_SHIFT ; 6
|
||||||
const BIT_BATTLE_ANIMATION ; 7
|
const BIT_BATTLE_ANIMATION ; 7
|
||||||
|
|
||||||
|
; wd732 flags
|
||||||
|
DEF BIT_DEBUG_MODE EQU 1
|
||||||
|
|
|
@ -44,15 +44,15 @@ MACRO special_warp_spec
|
||||||
db \4
|
db \4
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
FirstMapSpec:
|
NewGameWarp:
|
||||||
special_warp_spec REDS_HOUSE_2F, 3, 6, REDS_HOUSE_2
|
special_warp_spec REDS_HOUSE_2F, 3, 6, REDS_HOUSE_2
|
||||||
TradeCenterSpec1:
|
TradeCenterPlayerWarp:
|
||||||
special_warp_spec TRADE_CENTER, 3, 4, CLUB
|
special_warp_spec TRADE_CENTER, 3, 4, CLUB
|
||||||
TradeCenterSpec2:
|
TradeCenterFriendWarp:
|
||||||
special_warp_spec TRADE_CENTER, 6, 4, CLUB
|
special_warp_spec TRADE_CENTER, 6, 4, CLUB
|
||||||
ColosseumSpec1:
|
ColosseumPlayerWarp:
|
||||||
special_warp_spec COLOSSEUM, 3, 4, CLUB
|
special_warp_spec COLOSSEUM, 3, 4, CLUB
|
||||||
ColosseumSpec2:
|
ColosseumFriendWarp:
|
||||||
special_warp_spec COLOSSEUM, 6, 4, CLUB
|
special_warp_spec COLOSSEUM, 6, 4, CLUB
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2493,9 +2493,9 @@ MoveSelectionMenu:
|
||||||
; so it is necessary to put the di ei block to not cause tearing
|
; so it is necessary to put the di ei block to not cause tearing
|
||||||
call TextBoxBorder
|
call TextBoxBorder
|
||||||
hlcoord 4, 12
|
hlcoord 4, 12
|
||||||
ld [hl], $7a
|
ld [hl], "─"
|
||||||
hlcoord 10, 12
|
hlcoord 10, 12
|
||||||
ld [hl], $7e
|
ld [hl], "┘"
|
||||||
ei
|
ei
|
||||||
hlcoord 6, 13
|
hlcoord 6, 13
|
||||||
call .writemoves
|
call .writemoves
|
||||||
|
@ -2557,11 +2557,12 @@ MoveSelectionMenu:
|
||||||
ld a, [wLinkState]
|
ld a, [wLinkState]
|
||||||
cp LINK_STATE_BATTLING
|
cp LINK_STATE_BATTLING
|
||||||
jr z, .matchedkeyspicked
|
jr z, .matchedkeyspicked
|
||||||
|
; Disable left, right, and START buttons in regular battles.
|
||||||
ld a, [wFlags_D733]
|
ld a, [wFlags_D733]
|
||||||
bit BIT_TEST_BATTLE, a
|
bit BIT_TEST_BATTLE, a
|
||||||
ld b, D_UP | D_DOWN | A_BUTTON | B_BUTTON | SELECT
|
ld b, D_UP | D_DOWN | A_BUTTON | B_BUTTON | SELECT
|
||||||
jr z, .matchedkeyspicked
|
jr z, .matchedkeyspicked
|
||||||
ld b, $ff
|
ld b, D_UP | D_DOWN | D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON | SELECT | START
|
||||||
.matchedkeyspicked
|
.matchedkeyspicked
|
||||||
ld a, b
|
ld a, b
|
||||||
ld [hli], a ; wMenuWatchedKeys
|
ld [hli], a ; wMenuWatchedKeys
|
||||||
|
@ -2585,8 +2586,12 @@ SelectMenuItem:
|
||||||
call PlaceString
|
call PlaceString
|
||||||
jr .select
|
jr .select
|
||||||
.battleselect
|
.battleselect
|
||||||
|
; Hide move swap cursor in TestBattle.
|
||||||
ld a, [wFlags_D733]
|
ld a, [wFlags_D733]
|
||||||
bit BIT_TEST_BATTLE, a
|
bit BIT_TEST_BATTLE, a
|
||||||
|
; This causes PrintMenuItem to not run in TestBattle.
|
||||||
|
; MoveSelectionMenu still draws part of its window, an issue
|
||||||
|
; which did not seem to exist in the Japanese versions.
|
||||||
jr nz, .select
|
jr nz, .select
|
||||||
call PrintMenuItem
|
call PrintMenuItem
|
||||||
ld a, [wMenuItemToSwap]
|
ld a, [wMenuItemToSwap]
|
||||||
|
@ -2648,8 +2653,9 @@ SelectMenuItem:
|
||||||
jr z, .disabled
|
jr z, .disabled
|
||||||
ld a, [wPlayerBattleStatus3]
|
ld a, [wPlayerBattleStatus3]
|
||||||
bit 3, a ; transformed
|
bit 3, a ; transformed
|
||||||
jr nz, .dummy ; game freak derp
|
jr nz, .transformedMoveSelected
|
||||||
.dummy
|
.transformedMoveSelected ; pointless
|
||||||
|
; Allow moves copied by Transform to be used.
|
||||||
ld a, [wCurrentMenuItem]
|
ld a, [wCurrentMenuItem]
|
||||||
ld hl, wBattleMonMoves
|
ld hl, wBattleMonMoves
|
||||||
ld c, a
|
ld c, a
|
||||||
|
@ -6085,6 +6091,7 @@ GetCurrentMove:
|
||||||
jr .selected
|
jr .selected
|
||||||
.player
|
.player
|
||||||
ld de, wPlayerMoveNum
|
ld de, wPlayerMoveNum
|
||||||
|
; Apply InitBattleVariables to TestBattle.
|
||||||
ld a, [wFlags_D733]
|
ld a, [wFlags_D733]
|
||||||
bit BIT_TEST_BATTLE, a
|
bit BIT_TEST_BATTLE, a
|
||||||
ld a, [wTestBattlePlayerSelectedMove]
|
ld a, [wTestBattlePlayerSelectedMove]
|
||||||
|
@ -6768,12 +6775,12 @@ InitOpponent:
|
||||||
|
|
||||||
DetermineWildOpponent:
|
DetermineWildOpponent:
|
||||||
ld a, [wd732]
|
ld a, [wd732]
|
||||||
bit 1, a
|
bit BIT_DEBUG_MODE, a
|
||||||
jr z, .notDebug
|
jr z, .notDebugMode
|
||||||
ldh a, [hJoyHeld]
|
ldh a, [hJoyHeld]
|
||||||
bit BIT_B_BUTTON, a
|
bit BIT_B_BUTTON, a ; disable wild encounters
|
||||||
ret nz
|
ret nz
|
||||||
.notDebug
|
.notDebugMode
|
||||||
ld a, [wNumberOfNoRandomBattleStepsLeft]
|
ld a, [wNumberOfNoRandomBattleStepsLeft]
|
||||||
and a
|
and a
|
||||||
ret nz
|
ret nz
|
||||||
|
|
|
@ -20,7 +20,7 @@ InitBattleVariables:
|
||||||
ld [hli], a ; wPlayerHPBarColor
|
ld [hli], a ; wPlayerHPBarColor
|
||||||
ld [hl], a ; wEnemyHPBarColor
|
ld [hl], a ; wEnemyHPBarColor
|
||||||
ld hl, wCanEvolveFlags
|
ld hl, wCanEvolveFlags
|
||||||
ld b, $3c
|
ld b, wMiscBattleDataEnd - wMiscBattleData
|
||||||
.loop
|
.loop
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
dec b
|
dec b
|
||||||
|
|
|
@ -56,7 +56,7 @@ IF DEF(_DEBUG)
|
||||||
|
|
||||||
; DEBUG
|
; DEBUG
|
||||||
ld hl, wd732
|
ld hl, wd732
|
||||||
set 1, [hl]
|
set BIT_DEBUG_MODE, [hl]
|
||||||
jp StartNewGameDebug
|
jp StartNewGameDebug
|
||||||
|
|
||||||
DebugBattlePlayerName:
|
DebugBattlePlayerName:
|
||||||
|
@ -72,18 +72,23 @@ ELSE
|
||||||
ret
|
ret
|
||||||
ENDC
|
ENDC
|
||||||
|
|
||||||
TestBattle:
|
TestBattle: ; unreferenced except in _DEBUG
|
||||||
.loop
|
.loop
|
||||||
call GBPalNormal
|
call GBPalNormal
|
||||||
|
|
||||||
; Don't mess around
|
; Don't mess around with obedience.
|
||||||
; with obedience.
|
|
||||||
ld a, 1 << BIT_EARTHBADGE
|
ld a, 1 << BIT_EARTHBADGE
|
||||||
ld [wObtainedBadges], a
|
ld [wObtainedBadges], a
|
||||||
|
|
||||||
ld hl, wFlags_D733
|
ld hl, wFlags_D733
|
||||||
set BIT_TEST_BATTLE, [hl]
|
set BIT_TEST_BATTLE, [hl]
|
||||||
|
|
||||||
|
; wNumBagItems and wBagItems are not initialized here,
|
||||||
|
; and their garbage values happen to act as if EXP_ALL
|
||||||
|
; is in the bag at the end of the test battle.
|
||||||
|
; pokeyellow fixes this by initializing them with a
|
||||||
|
; list of items.
|
||||||
|
|
||||||
; Reset the party.
|
; Reset the party.
|
||||||
ld hl, wPartyCount
|
ld hl, wPartyCount
|
||||||
xor a
|
xor a
|
||||||
|
@ -91,8 +96,7 @@ TestBattle:
|
||||||
dec a
|
dec a
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
|
|
||||||
; Give the player a
|
; Give the player a level 20 Rhydon.
|
||||||
; level 20 Rhydon.
|
|
||||||
ld a, RHYDON
|
ld a, RHYDON
|
||||||
ld [wcf91], a
|
ld [wcf91], a
|
||||||
ld a, 20
|
ld a, 20
|
||||||
|
@ -102,15 +106,14 @@ TestBattle:
|
||||||
ld [wCurMap], a
|
ld [wCurMap], a
|
||||||
call AddPartyMon
|
call AddPartyMon
|
||||||
|
|
||||||
; Fight against a
|
; Fight against a level 20 Rhydon.
|
||||||
; level 20 Rhydon.
|
|
||||||
ld a, RHYDON
|
ld a, RHYDON
|
||||||
ld [wCurOpponent], a
|
ld [wCurOpponent], a
|
||||||
|
|
||||||
predef InitOpponent
|
predef InitOpponent
|
||||||
|
|
||||||
; When the battle ends,
|
; When the battle ends, do it all again.
|
||||||
; do it all again.
|
; There are some graphical quirks in SGB mode.
|
||||||
ld a, 1
|
ld a, 1
|
||||||
ld [wUpdateSpritesEnabled], a
|
ld [wUpdateSpritesEnabled], a
|
||||||
ldh [hAutoBGTransferEnabled], a
|
ldh [hAutoBGTransferEnabled], a
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
; This function is a debugging feature to give the player Tsunekazu Ishihara's
|
SetDebugNewGameParty: ; unreferenced except in _DEBUG
|
||||||
; favorite Pokemon. This is indicated by the overpowered Exeggutor, which
|
ld de, DebugNewGameParty
|
||||||
; Ishihara (president of Creatures Inc.) said was his favorite Pokemon in an ABC
|
|
||||||
; interview on February 8, 2000.
|
|
||||||
; "Exeggutor is my favorite. That's because I was always using this character
|
|
||||||
; while I was debugging the program."
|
|
||||||
; http://www.ign.com/articles/2000/02/09/abc-news-pokamon-chat-transcript
|
|
||||||
|
|
||||||
SetIshiharaTeam:
|
|
||||||
ld de, IshiharaTeam
|
|
||||||
.loop
|
.loop
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
cp -1
|
cp -1
|
||||||
|
@ -20,7 +12,11 @@ SetIshiharaTeam:
|
||||||
call AddPartyMon
|
call AddPartyMon
|
||||||
jr .loop
|
jr .loop
|
||||||
|
|
||||||
IshiharaTeam:
|
DebugNewGameParty: ; unreferenced except in _DEBUG
|
||||||
|
; Exeggutor is the only debug party member shared with Red, Green, and Japanese Blue.
|
||||||
|
; "Tsunekazu Ishihara: Exeggutor is my favorite. That's because I was
|
||||||
|
; always using this character while I was debugging the program."
|
||||||
|
; From https://web.archive.org/web/20000607152840/http://pocket.ign.com/news/14973.html
|
||||||
db EXEGGUTOR, 90
|
db EXEGGUTOR, 90
|
||||||
IF DEF(_DEBUG)
|
IF DEF(_DEBUG)
|
||||||
db MEW, 5
|
db MEW, 5
|
||||||
|
@ -35,13 +31,13 @@ IF DEF(_DEBUG)
|
||||||
ENDC
|
ENDC
|
||||||
db -1 ; end
|
db -1 ; end
|
||||||
|
|
||||||
DebugStart:
|
PrepareNewGameDebug: ; dummy except in _DEBUG
|
||||||
IF DEF(_DEBUG)
|
IF DEF(_DEBUG)
|
||||||
xor a ; PLAYER_PARTY_DATA
|
xor a ; PLAYER_PARTY_DATA
|
||||||
ld [wMonDataLocation], a
|
ld [wMonDataLocation], a
|
||||||
|
|
||||||
; Fly anywhere.
|
; Fly anywhere.
|
||||||
dec a ; $ff
|
dec a ; $ff (all bits)
|
||||||
ld [wTownVisitedFlag], a
|
ld [wTownVisitedFlag], a
|
||||||
ld [wTownVisitedFlag + 1], a
|
ld [wTownVisitedFlag + 1], a
|
||||||
|
|
||||||
|
@ -49,7 +45,7 @@ IF DEF(_DEBUG)
|
||||||
ld a, ~(1 << BIT_EARTHBADGE)
|
ld a, ~(1 << BIT_EARTHBADGE)
|
||||||
ld [wObtainedBadges], a
|
ld [wObtainedBadges], a
|
||||||
|
|
||||||
call SetIshiharaTeam
|
call SetDebugNewGameParty
|
||||||
|
|
||||||
; Exeggutor gets four HM moves.
|
; Exeggutor gets four HM moves.
|
||||||
ld hl, wPartyMon1Moves
|
ld hl, wPartyMon1Moves
|
||||||
|
|
|
@ -121,7 +121,7 @@ MainMenu:
|
||||||
ld [wDestinationMap], a
|
ld [wDestinationMap], a
|
||||||
ld hl, wd732
|
ld hl, wd732
|
||||||
set 2, [hl] ; fly warp or dungeon warp
|
set 2, [hl] ; fly warp or dungeon warp
|
||||||
call SpecialWarpIn
|
call PrepareForSpecialWarp
|
||||||
jp SpecialEnterMap
|
jp SpecialEnterMap
|
||||||
|
|
||||||
InitOptions:
|
InitOptions:
|
||||||
|
@ -268,10 +268,10 @@ LinkMenu:
|
||||||
ld c, 50
|
ld c, 50
|
||||||
call DelayFrames
|
call DelayFrames
|
||||||
ld hl, wd732
|
ld hl, wd732
|
||||||
res 1, [hl]
|
res BIT_DEBUG_MODE, [hl]
|
||||||
ld a, [wDefaultMap]
|
ld a, [wDefaultMap]
|
||||||
ld [wDestinationMap], a
|
ld [wDestinationMap], a
|
||||||
call SpecialWarpIn
|
call PrepareForSpecialWarp
|
||||||
ld c, 20
|
ld c, 20
|
||||||
call DelayFrames
|
call DelayFrames
|
||||||
xor a
|
xor a
|
||||||
|
@ -308,7 +308,12 @@ LinkCanceledText:
|
||||||
|
|
||||||
StartNewGame:
|
StartNewGame:
|
||||||
ld hl, wd732
|
ld hl, wd732
|
||||||
res 1, [hl]
|
; Ensure debug mode is not used when
|
||||||
|
; starting a regular new game.
|
||||||
|
; Debug mode persists in saved games for
|
||||||
|
; both debug and non-debug builds, and is
|
||||||
|
; only reset here by the main menu.
|
||||||
|
res BIT_DEBUG_MODE, [hl]
|
||||||
; fallthrough
|
; fallthrough
|
||||||
StartNewGameDebug:
|
StartNewGameDebug:
|
||||||
call OakSpeech
|
call OakSpeech
|
||||||
|
|
|
@ -3,6 +3,11 @@ PrepareOakSpeech:
|
||||||
push af
|
push af
|
||||||
ld a, [wOptions]
|
ld a, [wOptions]
|
||||||
push af
|
push af
|
||||||
|
; Retrieve BIT_DEBUG_MODE set in DebugMenu for StartNewGameDebug.
|
||||||
|
; BUG: StartNewGame carries over bit 5 from previous save files,
|
||||||
|
; which causes CheckForceBikeOrSurf to not return.
|
||||||
|
; To fix this in debug builds, reset bit 5 here or in StartNewGame.
|
||||||
|
; In non-debug builds, the instructions can be removed.
|
||||||
ld a, [wd732]
|
ld a, [wd732]
|
||||||
push af
|
push af
|
||||||
ld hl, wPlayerName
|
ld hl, wPlayerName
|
||||||
|
@ -24,6 +29,7 @@ PrepareOakSpeech:
|
||||||
call z, InitOptions
|
call z, InitOptions
|
||||||
; These debug names are used for StartNewGameDebug.
|
; These debug names are used for StartNewGameDebug.
|
||||||
; TestBattle uses the debug names from DebugMenu.
|
; TestBattle uses the debug names from DebugMenu.
|
||||||
|
; A variant of this process is performed in PrepareTitleScreen.
|
||||||
ld hl, DebugNewGamePlayerName
|
ld hl, DebugNewGamePlayerName
|
||||||
ld de, wPlayerName
|
ld de, wPlayerName
|
||||||
ld bc, NAME_LENGTH
|
ld bc, NAME_LENGTH
|
||||||
|
@ -49,15 +55,15 @@ OakSpeech:
|
||||||
ld [wcf91], a
|
ld [wcf91], a
|
||||||
ld a, 1
|
ld a, 1
|
||||||
ld [wItemQuantity], a
|
ld [wItemQuantity], a
|
||||||
call AddItemToInventory ; give one potion
|
call AddItemToInventory
|
||||||
ld a, [wDefaultMap]
|
ld a, [wDefaultMap]
|
||||||
ld [wDestinationMap], a
|
ld [wDestinationMap], a
|
||||||
call SpecialWarpIn
|
call PrepareForSpecialWarp
|
||||||
xor a
|
xor a
|
||||||
ldh [hTileAnimations], a
|
ldh [hTileAnimations], a
|
||||||
ld a, [wd732]
|
ld a, [wd732]
|
||||||
bit 1, a ; possibly a debug mode bit
|
bit BIT_DEBUG_MODE, a
|
||||||
jp nz, .skipChoosingNames
|
jp nz, .skipSpeech
|
||||||
ld de, ProfOakPic
|
ld de, ProfOakPic
|
||||||
lb bc, BANK(ProfOakPic), $00
|
lb bc, BANK(ProfOakPic), $00
|
||||||
call IntroDisplayPicCenteredOrUpperRight
|
call IntroDisplayPicCenteredOrUpperRight
|
||||||
|
@ -93,7 +99,7 @@ OakSpeech:
|
||||||
ld hl, IntroduceRivalText
|
ld hl, IntroduceRivalText
|
||||||
call PrintText
|
call PrintText
|
||||||
call ChooseRivalName
|
call ChooseRivalName
|
||||||
.skipChoosingNames
|
.skipSpeech
|
||||||
call GBFadeOutToWhite
|
call GBFadeOutToWhite
|
||||||
call ClearScreen
|
call ClearScreen
|
||||||
ld de, RedPicFront
|
ld de, RedPicFront
|
||||||
|
@ -159,6 +165,7 @@ OakSpeechText1:
|
||||||
text_end
|
text_end
|
||||||
OakSpeechText2:
|
OakSpeechText2:
|
||||||
text_far _OakSpeechText2A
|
text_far _OakSpeechText2A
|
||||||
|
; BUG: The cry played does not match the sprite displayed.
|
||||||
sound_cry_nidorina
|
sound_cry_nidorina
|
||||||
text_far _OakSpeechText2B
|
text_far _OakSpeechText2B
|
||||||
text_end
|
text_end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
CopyDebugName:
|
CopyDebugName: ; unused
|
||||||
ld bc, NAME_LENGTH
|
ld bc, NAME_LENGTH
|
||||||
jp CopyData
|
jp CopyData
|
||||||
|
|
||||||
|
@ -42,10 +42,10 @@ DisplayTitleScreen:
|
||||||
ld bc, 5 tiles
|
ld bc, 5 tiles
|
||||||
ld a, BANK(NintendoCopyrightLogoGraphics)
|
ld a, BANK(NintendoCopyrightLogoGraphics)
|
||||||
call FarCopyData2
|
call FarCopyData2
|
||||||
ld hl, GamefreakLogoGraphics
|
ld hl, GameFreakLogoGraphics
|
||||||
ld de, vTitleLogo2 tile (16 + 5)
|
ld de, vTitleLogo2 tile (16 + 5)
|
||||||
ld bc, 9 tiles
|
ld bc, 9 tiles
|
||||||
ld a, BANK(GamefreakLogoGraphics)
|
ld a, BANK(GameFreakLogoGraphics)
|
||||||
call FarCopyData2
|
call FarCopyData2
|
||||||
ld hl, PokemonLogoGraphics
|
ld hl, PokemonLogoGraphics
|
||||||
ld de, vTitleLogo
|
ld de, vTitleLogo
|
||||||
|
@ -378,7 +378,7 @@ LoadCopyrightAndTextBoxTiles:
|
||||||
LoadCopyrightTiles:
|
LoadCopyrightTiles:
|
||||||
ld de, NintendoCopyrightLogoGraphics
|
ld de, NintendoCopyrightLogoGraphics
|
||||||
ld hl, vChars2 tile $60
|
ld hl, vChars2 tile $60
|
||||||
lb bc, BANK(NintendoCopyrightLogoGraphics), (GamefreakLogoGraphicsEnd - NintendoCopyrightLogoGraphics) / $10
|
lb bc, BANK(NintendoCopyrightLogoGraphics), (GameFreakLogoGraphicsEnd - NintendoCopyrightLogoGraphics) / $10
|
||||||
call CopyVideoData
|
call CopyVideoData
|
||||||
hlcoord 2, 7
|
hlcoord 2, 7
|
||||||
ld de, CopyrightTextString
|
ld de, CopyrightTextString
|
||||||
|
|
|
@ -1,60 +1,60 @@
|
||||||
SpecialWarpIn::
|
PrepareForSpecialWarp::
|
||||||
call LoadSpecialWarpData
|
call LoadSpecialWarpData
|
||||||
predef LoadTilesetHeader
|
predef LoadTilesetHeader
|
||||||
ld hl, wd732
|
ld hl, wd732
|
||||||
bit 2, [hl] ; dungeon warp or fly warp?
|
bit 2, [hl] ; dungeon warp or fly warp?
|
||||||
res 2, [hl]
|
res 2, [hl]
|
||||||
jr z, .next
|
jr z, .debugNewGameWarp
|
||||||
; if dungeon warp or fly warp
|
|
||||||
ld a, [wDestinationMap]
|
ld a, [wDestinationMap]
|
||||||
jr .next2
|
jr .next
|
||||||
|
.debugNewGameWarp
|
||||||
|
bit BIT_DEBUG_MODE, [hl]
|
||||||
|
jr z, .setNewGameMatWarp ; apply to StartNewGameDebug only
|
||||||
|
call PrepareNewGameDebug
|
||||||
|
.setNewGameMatWarp
|
||||||
|
; This is called by OakSpeech during StartNewGame and
|
||||||
|
; loads the first warp event for the specified map index.
|
||||||
|
ld a, PALLET_TOWN
|
||||||
.next
|
.next
|
||||||
bit 1, [hl]
|
|
||||||
jr z, .next3
|
|
||||||
call DebugStart
|
|
||||||
.next3
|
|
||||||
ld a, 0
|
|
||||||
.next2
|
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, [wd72d]
|
ld a, [wd72d]
|
||||||
and a
|
and a
|
||||||
jr nz, .next4
|
jr nz, .next2
|
||||||
ld a, b
|
ld a, b
|
||||||
.next4
|
.next2
|
||||||
ld hl, wd732
|
ld hl, wd732
|
||||||
bit 4, [hl] ; dungeon warp?
|
bit 4, [hl] ; dungeon warp
|
||||||
ret nz
|
ret nz
|
||||||
; if not dungeon warp
|
|
||||||
ld [wLastMap], a
|
ld [wLastMap], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; gets the map ID, tile block map view pointer, tileset, and coordinates
|
|
||||||
LoadSpecialWarpData:
|
LoadSpecialWarpData:
|
||||||
ld a, [wd72d]
|
ld a, [wd72d]
|
||||||
cp TRADE_CENTER
|
cp TRADE_CENTER
|
||||||
jr nz, .notTradeCenter
|
jr nz, .notTradeCenter
|
||||||
ld hl, TradeCenterSpec1
|
ld hl, TradeCenterPlayerWarp
|
||||||
ldh a, [hSerialConnectionStatus]
|
ldh a, [hSerialConnectionStatus]
|
||||||
cp USING_INTERNAL_CLOCK ; which gameboy is clocking determines who is on the left and who is on the right
|
cp USING_INTERNAL_CLOCK
|
||||||
jr z, .copyWarpData
|
jr z, .copyWarpData
|
||||||
ld hl, TradeCenterSpec2
|
ld hl, TradeCenterFriendWarp
|
||||||
jr .copyWarpData
|
jr .copyWarpData
|
||||||
.notTradeCenter
|
.notTradeCenter
|
||||||
cp COLOSSEUM
|
cp COLOSSEUM
|
||||||
jr nz, .notColosseum
|
jr nz, .notColosseum
|
||||||
ld hl, ColosseumSpec1
|
ld hl, ColosseumPlayerWarp
|
||||||
ldh a, [hSerialConnectionStatus]
|
ldh a, [hSerialConnectionStatus]
|
||||||
cp USING_INTERNAL_CLOCK
|
cp USING_INTERNAL_CLOCK
|
||||||
jr z, .copyWarpData
|
jr z, .copyWarpData
|
||||||
ld hl, ColosseumSpec2
|
ld hl, ColosseumFriendWarp
|
||||||
jr .copyWarpData
|
jr .copyWarpData
|
||||||
.notColosseum
|
.notColosseum
|
||||||
ld a, [wd732]
|
ld a, [wd732]
|
||||||
bit 1, a
|
bit BIT_DEBUG_MODE, a
|
||||||
jr nz, .notFirstMap
|
; warp to wLastMap (PALLET_TOWN) for StartNewGameDebug
|
||||||
|
jr nz, .notNewGameWarp
|
||||||
bit 2, a
|
bit 2, a
|
||||||
jr nz, .notFirstMap
|
jr nz, .notNewGameWarp
|
||||||
ld hl, FirstMapSpec
|
ld hl, NewGameWarp
|
||||||
.copyWarpData
|
.copyWarpData
|
||||||
ld de, wCurMap
|
ld de, wCurMap
|
||||||
ld c, $7
|
ld c, $7
|
||||||
|
@ -68,18 +68,17 @@ LoadSpecialWarpData:
|
||||||
ld [wCurMapTileset], a
|
ld [wCurMapTileset], a
|
||||||
xor a
|
xor a
|
||||||
jr .done
|
jr .done
|
||||||
.notFirstMap
|
.notNewGameWarp
|
||||||
ld a, [wLastMap] ; this value is overwritten before it's ever read
|
ld a, [wLastMap] ; this value is overwritten before it's ever read
|
||||||
ld hl, wd732
|
ld hl, wd732
|
||||||
bit 4, [hl] ; used dungeon warp (jumped down hole/waterfall)?
|
bit 4, [hl] ; dungeon warp
|
||||||
jr nz, .usedDunegonWarp
|
jr nz, .usedDungeonWarp
|
||||||
bit 6, [hl] ; return to last pokemon center (or player's house)?
|
bit 6, [hl] ; blacked out
|
||||||
res 6, [hl]
|
res 6, [hl]
|
||||||
jr z, .otherDestination
|
jr z, .otherDestination
|
||||||
; return to last pokemon center or player's house
|
|
||||||
ld a, [wLastBlackoutMap]
|
ld a, [wLastBlackoutMap]
|
||||||
jr .usedFlyWarp
|
jr .usedFlyWarp
|
||||||
.usedDunegonWarp
|
.usedDungeonWarp
|
||||||
ld hl, wd72d
|
ld hl, wd72d
|
||||||
res 4, [hl]
|
res 4, [hl]
|
||||||
ld a, [wDungeonWarpDestinationMap]
|
ld a, [wDungeonWarpDestinationMap]
|
||||||
|
@ -142,7 +141,7 @@ LoadSpecialWarpData:
|
||||||
.done
|
.done
|
||||||
ld [wYOffsetSinceLastSpecialWarp], a
|
ld [wYOffsetSinceLastSpecialWarp], a
|
||||||
ld [wXOffsetSinceLastSpecialWarp], a
|
ld [wXOffsetSinceLastSpecialWarp], a
|
||||||
ld a, $ff ; the player's coordinates have already been updated using a special warp, so don't use any of the normal warps
|
ld a, -1 ; exclude normal warps
|
||||||
ld [wDestinationWarpID], a
|
ld [wDestinationWarpID], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,8 @@ BattleHudTiles3End:
|
||||||
|
|
||||||
NintendoCopyrightLogoGraphics: INCBIN "gfx/splash/copyright.2bpp"
|
NintendoCopyrightLogoGraphics: INCBIN "gfx/splash/copyright.2bpp"
|
||||||
|
|
||||||
GamefreakLogoGraphics: INCBIN "gfx/title/gamefreak_inc.2bpp"
|
GameFreakLogoGraphics: INCBIN "gfx/title/gamefreak_inc.2bpp"
|
||||||
GamefreakLogoGraphicsEnd:
|
GameFreakLogoGraphicsEnd:
|
||||||
|
|
||||||
TextBoxGraphics:: INCBIN "gfx/font/font_extra.2bpp"
|
TextBoxGraphics:: INCBIN "gfx/font/font_extra.2bpp"
|
||||||
TextBoxGraphicsEnd::
|
TextBoxGraphicsEnd::
|
||||||
|
|
|
@ -50,10 +50,12 @@ RunNPCMovementScript::
|
||||||
EndNPCMovementScript::
|
EndNPCMovementScript::
|
||||||
farjp _EndNPCMovementScript
|
farjp _EndNPCMovementScript
|
||||||
|
|
||||||
DebugPressedOrHeldB::
|
DebugPressedOrHeldB:: ; dummy except in _DEBUG
|
||||||
|
; This is used to skip Trainer battles, the
|
||||||
|
; Safari Game step counter, and some NPC scripts.
|
||||||
IF DEF(_DEBUG)
|
IF DEF(_DEBUG)
|
||||||
ld a, [wd732]
|
ld a, [wd732]
|
||||||
bit 1, a
|
bit BIT_DEBUG_MODE, a
|
||||||
ret z
|
ret z
|
||||||
ldh a, [hJoyHeld]
|
ldh a, [hJoyHeld]
|
||||||
bit BIT_B_BUTTON, a
|
bit BIT_B_BUTTON, a
|
||||||
|
|
|
@ -117,7 +117,7 @@ OverworldLoopLessDelay::
|
||||||
predef LoadSAV
|
predef LoadSAV
|
||||||
ld a, [wCurMap]
|
ld a, [wCurMap]
|
||||||
ld [wDestinationMap], a
|
ld [wDestinationMap], a
|
||||||
call SpecialWarpIn
|
call PrepareForSpecialWarp
|
||||||
ld a, [wCurMap]
|
ld a, [wCurMap]
|
||||||
call SwitchToMapRomBank ; switch to the ROM bank of the current map
|
call SwitchToMapRomBank ; switch to the ROM bank of the current map
|
||||||
ld hl, wCurMapTileset
|
ld hl, wCurMapTileset
|
||||||
|
@ -762,11 +762,11 @@ HandleBlackOut::
|
||||||
call StopMusic
|
call StopMusic
|
||||||
ld hl, wd72e
|
ld hl, wd72e
|
||||||
res 5, [hl]
|
res 5, [hl]
|
||||||
ld a, BANK(ResetStatusAndHalveMoneyOnBlackout) ; also BANK(SpecialWarpIn) and BANK(SpecialEnterMap)
|
ld a, BANK(ResetStatusAndHalveMoneyOnBlackout) ; also BANK(PrepareForSpecialWarp) and BANK(SpecialEnterMap)
|
||||||
ldh [hLoadedROMBank], a
|
ldh [hLoadedROMBank], a
|
||||||
ld [MBC1RomBank], a
|
ld [MBC1RomBank], a
|
||||||
call ResetStatusAndHalveMoneyOnBlackout
|
call ResetStatusAndHalveMoneyOnBlackout
|
||||||
call SpecialWarpIn
|
call PrepareForSpecialWarp
|
||||||
call PlayDefaultMusicFadeOutCurrent
|
call PlayDefaultMusicFadeOutCurrent
|
||||||
jp SpecialEnterMap
|
jp SpecialEnterMap
|
||||||
|
|
||||||
|
@ -793,10 +793,10 @@ HandleFlyWarpOrDungeonWarp::
|
||||||
set 2, [hl] ; fly warp or dungeon warp
|
set 2, [hl] ; fly warp or dungeon warp
|
||||||
res 5, [hl] ; forced to ride bike
|
res 5, [hl] ; forced to ride bike
|
||||||
call LeaveMapAnim
|
call LeaveMapAnim
|
||||||
ld a, BANK(SpecialWarpIn)
|
ld a, BANK(PrepareForSpecialWarp)
|
||||||
ldh [hLoadedROMBank], a
|
ldh [hLoadedROMBank], a
|
||||||
ld [MBC1RomBank], a
|
ld [MBC1RomBank], a
|
||||||
call SpecialWarpIn
|
call PrepareForSpecialWarp
|
||||||
jp SpecialEnterMap
|
jp SpecialEnterMap
|
||||||
|
|
||||||
LeaveMapAnim::
|
LeaveMapAnim::
|
||||||
|
|
|
@ -111,10 +111,14 @@ NextChar::
|
||||||
inc de
|
inc de
|
||||||
jp PlaceNextChar
|
jp PlaceNextChar
|
||||||
|
|
||||||
NullChar::
|
NullChar:: ; unused
|
||||||
ld b, h
|
ld b, h
|
||||||
ld c, l
|
ld c, l
|
||||||
pop hl
|
pop hl
|
||||||
|
; A "<NULL>" character in a printed string
|
||||||
|
; displays an error message with the current value
|
||||||
|
; of hSpriteIndexOrTextID in decimal format.
|
||||||
|
; This is a debugging leftover.
|
||||||
ld de, TextIDErrorText
|
ld de, TextIDErrorText
|
||||||
dec de
|
dec de
|
||||||
ret
|
ret
|
||||||
|
|
|
@ -135,7 +135,9 @@ ENDC
|
||||||
ld a, [wSpriteIndex]
|
ld a, [wSpriteIndex]
|
||||||
cp $ff
|
cp $ff
|
||||||
jr nz, .trainerEngaging
|
jr nz, .trainerEngaging
|
||||||
|
IF DEF(_DEBUG)
|
||||||
.trainerNotEngaging
|
.trainerNotEngaging
|
||||||
|
ENDC
|
||||||
xor a
|
xor a
|
||||||
ld [wSpriteIndex], a
|
ld [wSpriteIndex], a
|
||||||
ld [wTrainerHeaderFlagBit], a
|
ld [wTrainerHeaderFlagBit], a
|
||||||
|
|
19
ram/wram.asm
19
ram/wram.asm
|
@ -420,6 +420,7 @@ wAddedToParty::
|
||||||
; The purpose of these flags is to track which mons levelled up during the
|
; The purpose of these flags is to track which mons levelled up during the
|
||||||
; current battle at the end of the battle when evolution occurs.
|
; current battle at the end of the battle when evolution occurs.
|
||||||
; Other methods of evolution simply set it by calling TryEvolvingMon.
|
; Other methods of evolution simply set it by calling TryEvolvingMon.
|
||||||
|
wMiscBattleData::
|
||||||
wCanEvolveFlags:: db
|
wCanEvolveFlags:: db
|
||||||
|
|
||||||
wForceEvolution:: db
|
wForceEvolution:: db
|
||||||
|
@ -433,8 +434,7 @@ wAILayer2Encouragement:: db
|
||||||
wPlayerSubstituteHP:: db
|
wPlayerSubstituteHP:: db
|
||||||
wEnemySubstituteHP:: db
|
wEnemySubstituteHP:: db
|
||||||
|
|
||||||
; The player's selected move during a test battle.
|
; used for TestBattle (unused in non-debug builds)
|
||||||
; InitBattleVariables sets it to the move Pound.
|
|
||||||
wTestBattlePlayerSelectedMove:: db
|
wTestBattlePlayerSelectedMove:: db
|
||||||
|
|
||||||
ds 1
|
ds 1
|
||||||
|
@ -502,6 +502,7 @@ wEnemyNumHits:: ; db
|
||||||
wEnemyBideAccumulatedDamage:: dw
|
wEnemyBideAccumulatedDamage:: dw
|
||||||
|
|
||||||
ds 8
|
ds 8
|
||||||
|
wMiscBattleDataEnd::
|
||||||
ENDU
|
ENDU
|
||||||
|
|
||||||
; This union spans 39 bytes.
|
; This union spans 39 bytes.
|
||||||
|
@ -2155,17 +2156,7 @@ wd730:: db
|
||||||
ds 1
|
ds 1
|
||||||
|
|
||||||
; bit 0: play time being counted
|
; bit 0: play time being counted
|
||||||
; bit 1: remnant of debug mode; only set by the debug build.
|
; bit 1: debug mode (unused and incomplete in non-debug builds)
|
||||||
; if it is set:
|
|
||||||
; 1. skips most of Prof. Oak's speech, and uses NINTEN as the player's name and SONY as the rival's name
|
|
||||||
; 2. does not have the player start in floor two of the player's house (instead sending them to [wLastMap])
|
|
||||||
; 3. allows wild battles to be avoided by holding down B
|
|
||||||
; furthermore, in the debug build:
|
|
||||||
; 4. allows trainers to be avoided by holding down B
|
|
||||||
; 5. skips Safari Zone step counter by holding down B
|
|
||||||
; 6. skips the NPC who blocks Route 3 before beating Brock by holding down B
|
|
||||||
; 7. skips Cerulean City rival battle by holding down B
|
|
||||||
; 8. skips Pokémon Tower rival battle by holding down B
|
|
||||||
; bit 2: the target warp is a fly warp (bit 3 set or blacked out) or a dungeon warp (bit 4 set)
|
; bit 2: the target warp is a fly warp (bit 3 set or blacked out) or a dungeon warp (bit 4 set)
|
||||||
; bit 3: used warp pad, escape rope, dig, teleport, or fly, so the target warp is a "fly warp"
|
; bit 3: used warp pad, escape rope, dig, teleport, or fly, so the target warp is a "fly warp"
|
||||||
; bit 4: jumped into hole (Pokemon Mansion, Seafoam Islands, Victory Road) or went down waterfall (Seafoam Islands), so the target warp is a "dungeon warp"
|
; bit 4: jumped into hole (Pokemon Mansion, Seafoam Islands, Victory Road) or went down waterfall (Seafoam Islands), so the target warp is a "dungeon warp"
|
||||||
|
@ -2173,7 +2164,7 @@ wd730:: db
|
||||||
; bit 6: map destination is [wLastBlackoutMap] (usually the last used pokemon center, but could be the player's house)
|
; bit 6: map destination is [wLastBlackoutMap] (usually the last used pokemon center, but could be the player's house)
|
||||||
wd732:: db
|
wd732:: db
|
||||||
|
|
||||||
; bit 0: running a test battle
|
; bit 0: running a test battle (unused in non-debug builds)
|
||||||
; bit 1: prevent music from changing when entering new map
|
; bit 1: prevent music from changing when entering new map
|
||||||
; bit 2: skip the joypad check in CheckWarpsNoCollision (used for the forced warp down the waterfall in the Seafoam Islands)
|
; bit 2: skip the joypad check in CheckWarpsNoCollision (used for the forced warp down the waterfall in the Seafoam Islands)
|
||||||
; bit 3: trainer wants to battle
|
; bit 3: trainer wants to battle
|
||||||
|
|
|
@ -32,7 +32,7 @@ HallOfFameResetEventsAndSaveScript:
|
||||||
ld hl, wFlags_D733
|
ld hl, wFlags_D733
|
||||||
res 1, [hl]
|
res 1, [hl]
|
||||||
inc hl
|
inc hl
|
||||||
set 0, [hl]
|
set BIT_TEST_BATTLE, [hl] ; debug, unused?
|
||||||
xor a ; SCRIPT_*_DEFAULT
|
xor a ; SCRIPT_*_DEFAULT
|
||||||
ld hl, wLoreleisRoomCurScript
|
ld hl, wLoreleisRoomCurScript
|
||||||
ld [hli], a ; wLoreleisRoomCurScript
|
ld [hli], a ; wLoreleisRoomCurScript
|
||||||
|
|
Loading…
Reference in a new issue