Merge pull request #126 from DrippingYellow/changes

Finish decompiling Banks $5, $e, and $23
This commit is contained in:
Rangi 2026-01-07 22:24:15 -05:00 committed by GitHub
commit 10c095bdc0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
71 changed files with 4789 additions and 758 deletions

View File

@ -42,7 +42,7 @@ DEF EFFECTIVENESS_MASK EQU %01111111
const SP_DEFENSE
const ACCURACY
const EVASION
const ABILITY ; used for BattleCommand_Curse
const_skip ; The ABILITY text doesn't exist yet, nor does the effect that would use it.
DEF NUM_LEVEL_STATS EQU const_value
; move struct members (see data/moves/moves.asm)
@ -241,11 +241,11 @@ DEF ALL_STATUS EQU (1 << PSN) | (1 << BRN) | (1 << FRZ) | (1 << PAR) | SLP
const BATTLEACTION_STRUGGLE
const BATTLEACTION_FORFEIT
; wBattleResult
; wBattleEnded
const_def
const DRAW
const LOSE
const WIN
const LOSE
const DRAW
DEF BATTLERESULT_BOX_FULL EQU 7
DEF BATTLERESULT_BITMASK EQU (1 << BATTLERESULT_BOX_FULL)

View File

@ -267,9 +267,21 @@ DEF NUM_HMS = const_value - ITEM_HM01
DEF NUM_TM_HM = NUM_TMS + NUM_HMS
; leftovers from pokered
DEF ITEM_X_ATTACK_RED EQU $41
DEF ITEM_ETHER_RED EQU $50
DEF ITEM_MAX_ETHER_RED EQU $51
DEF ITEM_ELIXER_RED EQU $52
DEF ITEM_HM01_RED EQU $c4
DEF ITEM_TM01_RED EQU $c9
DEF ITEM_FULL_RESTORE_RED EQU $10
DEF ITEM_MAX_POTION_RED EQU $11
DEF ITEM_HYPER_POTION_RED EQU $12
DEF ITEM_SUPER_POTION_RED EQU $13
DEF ITEM_POTION_RED EQU $14
DEF ITEM_X_ACCURACY_RED EQU $2E
DEF ITEM_FULL_HEAL_RED EQU $34
DEF ITEM_GUARD_SPEC_RED EQU $37
DEF ITEM_DIRE_HIT_RED EQU $3a
DEF ITEM_X_ATTACK_RED EQU $41
DEF ITEM_X_DEFEND_RED EQU $42
DEF ITEM_X_SPEED_RED EQU $43
DEF ITEM_X_SPECIAL_RED EQU $44
DEF ITEM_ETHER_RED EQU $50
DEF ITEM_MAX_ETHER_RED EQU $51
DEF ITEM_ELIXER_RED EQU $52
DEF ITEM_HM01_RED EQU $c4
DEF ITEM_TM01_RED EQU $c9

View File

@ -43,6 +43,7 @@ DEF CANT_TOSS EQU 1 << CANT_TOSS_F
DEF NUM_POCKETS EQU const_value
DEF MAX_ITEMS EQU 20
DEF MAX_BALLS EQU 10
DEF MAX_KEY_ITEMS EQU 20
DEF MAX_PC_ITEMS EQU 50

View File

@ -32,7 +32,7 @@ DEF OBJECT_JUMPTABLE_INDEX rb ; 1d
DEF OBJECT_1E rb ; 1e
DEF OBJECT_JUMP_HEIGHT rb ; 1f
DEF OBJECT_RANGE rb ; 20
DEF OBJECT_21 rb ; 21
DEF OBJECT_SIGHT_RANGE rb ; 21
rb_skip 6
DEF OBJECT_LENGTH EQU _RS
DEF NUM_OBJECT_STRUCTS EQU 10
@ -151,11 +151,10 @@ DEF MAPOBJECT_MOVEMENT rb ; 4
DEF MAPOBJECT_RADIUS rb ; 5
DEF MAPOBJECT_HOUR rb ; 6
DEF MAPOBJECT_TIMEOFDAY rb ; 7
DEF MAPOBJECT_PALETTE rb ; 8
DEF MAPOBJECT_SIGHT_RANGE rb ; 9
DEF MAPOBJECT_SCRIPT_POINTER rw ; a
DEF MAPOBJECT_EVENT_FLAG rw
rb_skip 2
DEF MAPOBJECT_TYPE rb ; 8, set to anything but 0 to skip trainer checks
rb_skip 2
DEF MAPOBJECT_SIGHT_RANGE rb ; b
rb_skip 4
DEF MAPOBJECT_LENGTH EQU _RS
DEF NUM_OBJECTS EQU 16
DEF PLAYER_OBJECT EQU 0

View File

@ -1,5 +1,15 @@
; serial
; wLinkMode
const_def
const LINK_NULL ; 0
const LINK_TIMECAPSULE ; 1
const LINK_TRADECENTER ; 2
const LINK_COLOSSEUM ; 3
; hSerialReceive high nybbles
DEF SERIAL_TRADECENTER EQU $60
DEF SERIAL_BATTLE EQU $70
; serial
DEF ESTABLISH_CONNECTION_WITH_INTERNAL_CLOCK EQU $01
DEF ESTABLISH_CONNECTION_WITH_EXTERNAL_CLOCK EQU $02
@ -15,3 +25,6 @@ DEF SERIAL_NO_DATA_BYTE EQU $FE
; signals the end of one part of a patch list (there are two parts) for player/enemy party data
DEF SERIAL_PATCH_LIST_PART_TERMINATOR EQU $FF
; timeout duration after exchanging a byte
DEF SERIAL_LINK_BYTE_TIMEOUT EQU $5000

View File

@ -6,7 +6,7 @@ DEF MON_NAME_LENGTH EQU 6
DEF TYPE_NAME_LENGTH EQU 5
DEF MOVE_NAME_LENGTH EQU 8
DEF ITEM_NAME_LENGTH EQU 11
DEF TRAINER_CLASS_NAME_LENGTH EQU 13 ; English
DEF TRAINER_CLASS_NAME_LENGTH EQU 11
; GetName types (see home/names.asm)
const_def 1

View File

@ -87,9 +87,9 @@ ENDM
trainerclass TRAINER_FISHER ; 25
trainerclass TRAINER_SWIMMER_F ; 26
trainerclass TRAINER_SWIMMER_M ; 26
trainerclass TRAINER_SWIMMER_M ; 27
trainerclass TRAINER_SWIMMER_F ; 27
trainerclass TRAINER_SAILOR ; 28

View File

@ -1,12 +1,12 @@
; TrainerClassAttributes struct members (see data/trainers/attributes.asm)
const_def
const TRNATTR_ITEM1 ; 0
const TRNATTR_ITEM2 ; 1
const TRNATTR_SPRITEPOINTER1 ; 0
const TRNATTR_SPRITEPOINTER2 ; 1
const TRNATTR_BASEMONEY ; 2
const TRNATTR_AI_MOVE_WEIGHTS ; 3
const TRNATTR_AI2 ; 4
const TRNATTR_AI_ITEM_SWITCH ; 5
const TRNATTR_AI4 ; 6
const TRNATTR_AI3 ; 5
const TRNATTR_UNKNOWN ; 6
DEF NUM_TRAINER_ATTRIBUTES EQU const_value
; TRNATTR_AI_MOVE_WEIGHTS bit flags (wEnemyTrainerAIFlags)
@ -22,29 +22,8 @@ DEF const_value = 0
shift_const AI_OPPORTUNIST
shift_const AI_AGGRESSIVE
shift_const AI_CAUTIOUS
shift_const AI_STATUS
shift_const AI_RISKY
shift_const AI_10
shift_const AI_11
shift_const AI_12
shift_const AI_13
shift_const AI_14
shift_const AI_15
; TRNATTR_AI_ITEM_SWITCH bit flags
DEF CONTEXT_USE_F EQU 6
DEF UNKNOWN_USE_F EQU 5
DEF ALWAYS_USE_F EQU 4
DEF SWITCH_SOMETIMES_F EQU 2
DEF SWITCH_RARELY_F EQU 1
DEF SWITCH_OFTEN_F EQU 0
DEF CONTEXT_USE EQU 1 << CONTEXT_USE_F
DEF UNKNOWN_USE EQU 1 << UNKNOWN_USE_F
DEF ALWAYS_USE EQU 1 << ALWAYS_USE_F
DEF SWITCH_SOMETIMES EQU 1 << SWITCH_SOMETIMES_F
DEF SWITCH_RARELY EQU 1 << SWITCH_RARELY_F
DEF SWITCH_OFTEN EQU 1 << SWITCH_OFTEN_F
DEF VALID_TRAINER_AI EQU const_value
DEF MAX_TRAINER_AI EQU 24
; TrainerTypes indexes (see engine/battle/read_trainer_party.asm)
const_def

View File

@ -120,6 +120,16 @@ DEF PLAYER_SURF_PIKA EQU 8
const DEBUG_BATTLE_F
const DEBUG_FIELD_F
const CONTINUED_F
const SAVE_FILE_EXISTS_F ; Set but not read anywhere.
const_skip 2
const UNK_DEBUG_FLAG_6_F ; Only set in Unreferenced_CheckInlineTrainers, not read anywhere
const SKIP_MAP_SCRIPT_F
; wSaveFileFlags::
const_def
const SAVED_FILE_F
const NEW_FILE_F
const ANOTHER_FILE_EXISTS_F
; wJumptableIndex::
DEF JUMPTABLE_INDEX_MASK EQU %01111111
@ -149,3 +159,24 @@ const BATTLEANIM_STOP_F ; 0
const BATTLEANIM_IN_SUBROUTINE_F ; 1
const BATTLEANIM_IN_LOOP_F ; 2
const BATTLEANIM_KEEPSPRITES_F ; 3
; wOverworldFlags::
const_def 6
const OVERWORLD_DISABLE_MAP_CONNECTIONS_F
const OVERWORLD_PAUSE_MAP_PROCESSES_F
; wMapStatus::
const_def
const MAPSTATUS_MAIN
const MAPSTATUS_EVENT_RUNNING
const MAPSTATUS_02
const MAPSTATUS_START_WILD_BATTLE
const MAPSTATUS_RETURN_TO_MAIN
const MAPSTATUS_05
const MAPSTATUS_06
const MAPSTATUS_07
const MAPSTATUS_START_TRAINER_BATTLE
const MAPSTATUS_DEBUG_MAP_VIEWER
const MAPSTATUS_UNUSED
const MAPSTATUS_EXIT_BATTLE
const MAPSTATUS_RETURN_FROM_BATTLE

View File

@ -0,0 +1,38 @@
; AI_SMART encourages these moves with Encore.
; BUG: Includes mostly status moves, but has a few attacking moves that seem
; to have been included in lieu of another status move by mistake.
; Also, the list cuts off rather early, not including most of the new status moves.
; None of these issues were fixed for the final game.
EncoreMoves:
db MOVE_SWORDS_DANCE
db MOVE_WHIRLWIND
db MOVE_LEER
db MOVE_ROAR
db MOVE_DISABLE
db MOVE_MIST
db MOVE_LEECH_SEED
db MOVE_GROWTH
db MOVE_POISONPOWDER
db MOVE_STRING_SHOT
db MOVE_MEDITATE
db MOVE_AGILITY
db MOVE_TELEPORT
db MOVE_SCREECH
db MOVE_HAZE
db MOVE_FOCUS_ENERGY
db MOVE_DREAM_EATER
db MOVE_POISON_GAS
db MOVE_SPLASH
db MOVE_SHARPEN
db MOVE_CONVERSION
db MOVE_SUPER_FANG
db MOVE_SUBSTITUTE
db MOVE_TRIPLE_KICK ; Likely intended to be Sketch
db MOVE_SPIDER_WEB
db MOVE_MIND_READER
db MOVE_FLAME_WHEEL ; Likely intended to be Nightmare
db MOVE_COIN_HURL ; Most likely intended to be Conversion2
db MOVE_COTTON_SPORE
db MOVE_POWDER_SNOW ; Likely intended to be either Spite or Protect
db -1 ; end

View File

@ -0,0 +1,9 @@
; AI_AGGRESSIVE does not discourage these moves
; even if a stronger one is available.
RecklessMoves:
db EFFECT_SELFDESTRUCT
db EFFECT_RAMPAGE
db EFFECT_MULTI_HIT
db EFFECT_DOUBLE_HIT
db -1 ; end

View File

@ -0,0 +1,17 @@
; AI_CAUTIOUS discourages these moves after the first turn.
ResidualMoves:
db MOVE_MIST
db MOVE_LEECH_SEED
db MOVE_POISONPOWDER
db MOVE_STUN_SPORE
db MOVE_THUNDER_WAVE
db MOVE_MIMIC ; Not present in the final game
db MOVE_FOCUS_ENERGY
db MOVE_BIDE
db MOVE_POISON_GAS
db MOVE_TRANSFORM
db MOVE_CONVERSION
db MOVE_SUBSTITUTE
; MOVE_SPIKES is not present in the proto.
db -1 ; end

View File

@ -0,0 +1,41 @@
; AI_OPPORTUNIST discourages these moves
; when the player's HP is low.
; BUG: Contains Flame Wheel, ostensibly an attacking move.
; It was presumably intended to be Nightmare, the move occupying the previous slot.
; Also, the list does not include any other new moves, despite the addition of more stall-enabling
; moves such as Protect and Encore. Both oddities still exist in the final game.
StallMoves:
db MOVE_SWORDS_DANCE
db MOVE_TAIL_WHIP
db MOVE_LEER
db MOVE_GROWL
db MOVE_DISABLE
db MOVE_MIST
db MOVE_COUNTER
db MOVE_LEECH_SEED
db MOVE_GROWTH
db MOVE_STRING_SHOT
db MOVE_MEDITATE
db MOVE_AGILITY
db MOVE_RAGE
db MOVE_MIMIC
db MOVE_SCREECH
db MOVE_HARDEN
db MOVE_WITHDRAW
db MOVE_DEFENSE_CURL
db MOVE_BARRIER
db MOVE_LIGHT_SCREEN
db MOVE_HAZE
db MOVE_REFLECT
db MOVE_FOCUS_ENERGY
db MOVE_BIDE
db MOVE_AMNESIA
db MOVE_TRANSFORM
db MOVE_SPLASH
db MOVE_ACID_ARMOR
db MOVE_SHARPEN
db MOVE_CONVERSION
db MOVE_SUBSTITUTE
db MOVE_FLAME_WHEEL
db -1 ; end

View File

@ -0,0 +1,23 @@
; AI_SMART knows these moves are usable all-around.
; Note the lack of Gen II moves... this was not changed for the final game.
UsefulMoves:
db MOVE_DOUBLE_EDGE
db MOVE_SING
db MOVE_FLAMETHROWER
db MOVE_HYDRO_PUMP
db MOVE_SURF
db MOVE_ICE_BEAM
db MOVE_BLIZZARD
db MOVE_HYPER_BEAM
db MOVE_SLEEP_POWDER
db MOVE_THUNDERBOLT
db MOVE_THUNDER
db MOVE_EARTHQUAKE
db MOVE_TOXIC
db MOVE_PSYCHIC
db MOVE_HYPNOSIS
db MOVE_RECOVER
db MOVE_FIRE_BLAST
db MOVE_SOFTBOILED
db MOVE_SUPER_FANG
db -1

View File

@ -81,18 +81,18 @@ GiveItemPredef::
add_predef ChangeBGPalColor0_4Frames
add_predef PredefShakeScreenVertically
add_predef PredefShakeScreenHorizontally
add_predef Function145b8
add_predef Function146dc
add_predef Function145de
add_predef SavePokemonData
add_predef TryLoadPokemonData
add_predef Dummy_SaveBox
add_predef ExecuteBGEffects ; 48
add_predef Function1457a
add_predef Function143e0
add_predef SaveOptionsAndGameData
add_predef SaveMenu
add_predef CheckSGB
add_predef LoadSGBLayout
add_predef Pokedex_GetArea
add_predef DoBattleTransition
add_predef Function8c9c6
add_predef Function8c940 ; 50
add_predef LeaveMapAnim_Old
add_predef EnterMapAnim_Old ; 50
add_predef PlayBattleAnim
add_predef Functioncc000
add_predef Functioncc000_2

View File

@ -805,6 +805,7 @@ GerugeMemberFGroup::
SECTION "data/trainers/parties.asm@Trainer Parties 48 TEMPORARY", ROMX
SportsmanGroup::
; TODO: This guy clearly ain't named "Shigeki", he's "Tetsuji". Add a trainer constant accordingly
; SPORTSMAN_SHIGEKI
db "てつじ@", TRAINERTYPE_ITEM_MOVES
db 9, DEX_DONPHAN, ITEM_NONE, MOVE_TACKLE, MOVE_DEFENSE_CURL, MOVE_NONE, MOVE_NONE

View File

@ -2,7 +2,6 @@ INCLUDE "constants.asm"
SECTION "engine/battle_anims/functions.asm", ROMX
; TODO: Uncomment the asserts once we have all the framesets labelled
DoBattleAnimFrame:
ld hl, BATTLEANIMSTRUCT_FUNCTION
@ -4083,7 +4082,8 @@ BattleAnimFunction_RainSandstorm:
ld hl, BATTLEANIMSTRUCT_JUMPTABLE_INDEX
add hl, bc
ld [hl], a
; Seems to make some kind of assert-worthy assumption... investigate after decompiling the framesets.
assert BATTLE_ANIM_FRAMESET_RAIN_1 + 1 == BATTLE_ANIM_FRAMESET_RAIN_2 \
&& BATTLE_ANIM_FRAMESET_RAIN_2 + 1 == BATTLE_ANIM_FRAMESET_RAIN_3
ld hl, BATTLEANIMSTRUCT_FRAMESET_ID
add hl, bc
inc [hl]

View File

@ -73,7 +73,7 @@ DebugMenuItems:
DebugMenuOptionField::
ld hl, wDebugFlags
set DEBUG_FIELD_F, [hl] ; set debug mode
jp StartNewGame
jp NewGame
DebugMenuOptionFight::
ld hl, wDebugFlags
@ -138,17 +138,17 @@ SetDemoEventFlags:
ld hl, wd41b
set 2, [hl] ; chose a starter
ld a, 1
ld [wd29a], a
ld [wPlayerHouse2FCurScript], a
ld a, 1
ld [wd29b], a
ld [wPlayerHouse1FCurScript], a
ld a, 6
ld [wd29c], a
ld [wSilentHillCurScript], a
ld a, 18
ld [wd29d], a
ld [wSilentHillLabFrontCurScript], a
ld a, 6
ld [wd29e], a
ld [wSilentHillLabBackCurScript], a
ld a, 2
ld [wd2a0], a
ld [wSilentHillHouseCurScript], a
ret
SECTION "engine/menu/debug_menu.asm@Sound Test", ROMX

View File

@ -35,8 +35,8 @@ FieldDebug_OpenMapViewer:
done
.MapViewScript:
ld a, 9
call WriteIntod637
ld a, MAPSTATUS_DEBUG_MAP_VIEWER
call SetMapStatus
xor a
ldh [hJoypadSum], a
ld a, DEBUGMAPVIEWER_INIT
@ -55,14 +55,14 @@ DebugMapViewer::
call GetJoypad
call .do_jumptable
jr c, .continue
call Function2c4a
call HandleMapObjects
jr nc, .loop
callfar CheckObjectEnteringVisibleRange
jr .loop
.continue
ld a, 4
call WriteIntod637
ld a, MAPSTATUS_RETURN_TO_MAIN
call SetMapStatus
pop bc
ld a, b
ld [wd153], a
@ -72,7 +72,7 @@ DebugMapViewer::
.do_jumptable
ld a, [wDebugFlags]
bit 1, a
bit DEBUG_FIELD_F, a
ret z
ldh a, [hDebugMapViewerJumptable]
and a
@ -361,7 +361,7 @@ DebugMapViewer_LoadCursorSprite:
SECTION "engine/debug/field/map_viewer.inc@DisplayBGEventDetails", ROMX
DisplayBGEventDetails:
call GetSignpost
call GetBGEvent
ret nc
call .Functionfd0cc
call RefreshScreen
@ -384,7 +384,7 @@ DisplayBGEventDetails:
ld [wHPBarOldHP], a
ld a, b
ld [wReplacementBlock], a
ld a, [wCurrMapSignCount]
ld a, [wCurMapBGEventCount]
sub c
inc a
ld [wHPBarNewHP], a

View File

@ -54,7 +54,7 @@ DoTeleportAnimation:
set SCRIPTED_MOVEMENT_STATE_F, [hl]
.loop
call Function2c4a
call HandleMapObjects
ld a, [wStateFlags]
bit SCRIPTED_MOVEMENT_STATE_F, a
jr nz, .loop

View File

@ -1,10 +1,10 @@
INCLUDE "constants.asm"
SECTION "engine/dumps/bank03.asm@Functionc9c1", ROMX
SECTION "engine/dumps/bank03.asm@CheckTrainerBattle", ROMX
_Functionc9c1:
_CheckTrainerBattle:
xor a
ld bc, $0020 ; presumably size of wCurrMapInlineTrainers
ld bc, NUM_OBJECTS * 2
ld hl, wCurrMapInlineTrainers
call ByteFill
ld de, wMap2Object
@ -12,10 +12,10 @@ _Functionc9c1:
.loop
push af
push de
ld hl, MAPOBJECT_PALETTE
ld hl, MAPOBJECT_TYPE
add hl, de
ld a, [hl]
cp 0
cp 0 ; 1 or greater == not a trainer
jr nz, .skip
ld hl, MAPOBJECT_OBJECT_STRUCT_ID

200
engine/dumps/bank05.asm Normal file
View File

@ -0,0 +1,200 @@
INCLUDE "constants.asm"
SECTION "engine/dumps/bank05.asm", ROMX
; Early duplicate of PlayerHouse2FRadioText, which is present in the map's bank in the final game.
; Uses the long "ポケモン" and "⋯⋯⋯⋯" instead of their shortcuts, and lacks the final sentence.
_Unreferenced_PokemonNewsScript::
ld hl, .DuplicatePokemonNewsText
call OpenTextbox
ret
.DuplicatePokemonNewsText
text "<PLAYER>は"
line "ラジオのスイッチを おした!"
para "ジェイ オー ピー エム"
line "こちらは"
cont "ポケモン ほうそうきょく です"
para "ポケモンニュースを おおくりします"
para "⋯⋯ ポケモンの せかいてきな"
line "けんきゅうしゃ オーキドはかせが"
cont "カントーから すがたを けしました"
cont "あらたな けんきゅうの ばしょを"
cont "もとめて いどうした との"
cont "みかたも ありますが"
cont "なんらかの じけんに まきこまれた"
cont "かのうせいも あり"
cont "かんけいしゃは とても"
cont "しんぱい しています"
para "⋯⋯⋯⋯いじょう"
line "ポケモンニュースでした"
para "⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯"
done
_PokemonBooksScript::
ld hl, .PokemonBooksText
call OpenTextbox
ret
; "Crammed full of POKéMON books!" flavor text
.PokemonBooksText:
text "ポケモンえほんが そろってる!"
done
_PlayerHouse1FFridgeScript::
ld hl, .PlayerHouse1FFridgeText
call OpenTextbox
ret
; Player's empty fridge flavor text
.PlayerHouse1FFridgeText:
text "なかは<⋯⋯>"
line "ほとんど からっぽだ<⋯⋯>"
done
_SilentHillHouseStoveScript::
ld hl, .SilentHillHouseStoveText
call OpenTextbox
ret
; Player's stove
.SilentHillHouseStoveText:
text "ガスコンロの ひは きえている"
line "あんぜん だいいち!"
done
_SilentHillHouseSinkScript::
ld hl, .SilentHillHouseSinkText
call OpenTextbox
ret
.SilentHillHouseSinkText:
text "ピカピカの ながしだい!"
line "こんやの メニューは なんだろう?"
done
_PokecenterSignScript::
ld hl, .PokecenterSignText
call OpenTextbox
ret
.PokecenterSignText:
text "ポケモンの たいりょく かいふく!"
line "ポケモンセンター"
done
_RivalHouseWindowScript::
ld hl, .RivalHouseWindowText
call OpenTextbox
ret
.RivalHouseWindowText:
text "まどが よごれているぞ?"
done
; Various scenes from the Pokemon anime that play on the player and rival's TVs
_SilentHillHouseTVScript::
ld a, [wTimeOfDay]
and a
jr nz, .not_day
ld hl, .SilentHillHouseTVDayText
jr .done
.not_day
dec a
jr nz, .not_night
ld hl, .SilentHillHouseTVNightText
jr .done
.not_night
ld hl, .SilentHillHouseTVMorningText
.done
call OpenTextbox
ret
; Scene from "Pokémon: I Choose You!"
.SilentHillHouseTVDayText:
text "ピカチュウが オニスズメと"
line "たたかっている<⋯⋯>"
cont "サトシが なみだ ぐんでいる<⋯⋯>"
cont "#アニメだ!"
done
; Scene from "Primeape Goes Bananas"
.SilentHillHouseTVNightText:
text "オコリザルが あばれている<⋯⋯>"
cont "サトシが にげまわってる!<⋯⋯>"
cont "#アニメだ!"
done
; Scene from "Bulbasaur's Mysterious Garden"
.SilentHillHouseTVMorningText:
text "フシギダネが すねている<⋯⋯>"
cont "サトシが こまっている<⋯⋯>"
cont "#アニメだ!"
done
Unreferenced_CheckInlineTrainers:
ld a, [wDebugFlags]
set UNK_DEBUG_FLAG_6_F, a ; Should probably be "bit UNK_DEBUG_FLAG_6_F, a"?
ret nz
xor a
ldh [hSeenTrainerDistance], a
ldh [hSeenTrainerDirection], a
ld a, FOLLOWER + 1
ldh [hSeenTrainerObject], a
ld hl, wCurrMapInlineTrainers + (2 * FOLLOWER_OBJECT_INDEX) ; Skip wReservedObjectStruct and the player's struct
ld de, 2 ; Length of wCurrMapInlineTrainers entries
ld b, NUM_OBJECTS - FOLLOWER_OBJECT_INDEX
.loop
ld a, [hl]
and a
jr nz, .found
add hl, de
ldh a, [hSeenTrainerObject]
inc a
ldh [hSeenTrainerObject], a
dec b
jr nz, .loop
ret
.found
ldh [hSeenTrainerDistance], a
inc hl
ld a, [hl]
ldh [hSeenTrainerDirection], a
ld hl, wDebugFlags
set UNK_DEBUG_FLAG_6_F, [hl]
ret
Unreferenced_TestTrainerWalkToPlayer:
ld hl, wJoypadFlags
set 6, [hl]
ldh a, [hSeenTrainerObject]
call FreezeAllOtherObjects
ldh a, [hSeenTrainerObject]
ld hl, .MovementData
ldh a, [hSeenTrainerDistance]
dec a
ld e, a
ld d, 0
add hl, de
call LoadMovementDataPointer
ld hl, wOverworldFlags
set OVERWORLD_PAUSE_MAP_PROCESSES_F, [hl]
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
.MovementData:
big_step LEFT
big_step LEFT
big_step LEFT
step_end
Bank05_FillerStart::

View File

@ -43,7 +43,7 @@ DoEnemyTurn:
and a
ret nz
ld hl, wcaba
ld hl, wEnemyTurnsTaken
inc [hl]
call UpdateMoveData
@ -5791,8 +5791,8 @@ BattleCommand_TryEscape:
call CallFromBank0F
xor a
ld [wNumHits], a
inc a ; LOSE
ld [wBattleResult], a
inc a ; TRUE
ld [wBattleEnded], a
ld a, [wPlayerMoveStruct]
jr .run_away
@ -5845,8 +5845,8 @@ BattleCommand_TryEscape:
call CallFromBank0F
xor a
ld [wNumHits], a
inc a
ld [wBattleResult], a
inc a ; TRUE
ld [wBattleEnded], a
ld a, [wEnemyMoveStruct]
jr .run_away

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@ StartBattle:
ld a, [wLinkMode]
and a
jr z, .asm_3c02e
ldh a, [hLinkPlayerNumber]
ldh a, [hSerialConnectionStatus]
cp 2
jr z, .asm_3c03f
.asm_3c02e
@ -92,7 +92,7 @@ StartBattle:
ld a, [wLinkMode]
and a
jr z, .to_battle
ldh a, [hLinkPlayerNumber]
ldh a, [hSerialConnectionStatus]
cp 2
jr nz, .to_battle
call EnemySwitch
@ -147,13 +147,13 @@ SafariZonePAText:
asm_3c132:
call ReloadTilesFromBuffer
ld a, 2
ld [wcd5d], a
ld [wBattleResult], a
ld a, [wLinkMode]
and a
ld hl, WildPokemonFledText
jr z, asm_3c14a
xor a
ld [wcd5d], a
ld [wBattleResult], a
ld hl, EnemyPokemonFledText
asm_3c14a:
@ -178,7 +178,7 @@ EnemyPokemonFledText:
asm_3c183:
call UpdateBattleMonInParty
ldh a, [hLinkPlayerNumber]
ldh a, [hSerialConnectionStatus]
cp 1
jr z, asm_3c1a9
call sub_3c492
@ -231,7 +231,7 @@ asm_3c1c4:
asm_3c200:
call DisplayBattleMenu
ret c
ld a, [wBattleResult]
ld a, [wBattleEnded]
and a
ret nz
ld hl, wPlayerSubStatus5
@ -328,7 +328,7 @@ asm_3c285:
ld [wCurPlayerSelectedMove], a
asm_3c2bb:
callfar Function38220
callfar AI_Switch
ld a, 1
ldh [hBattleTurn], a
call SpikesDamage
@ -394,7 +394,7 @@ asm_3c339:
jp asm_3c3c7
asm_3c347:
ldh a, [hLinkPlayerNumber]
ldh a, [hSerialConnectionStatus]
cp 2
jr z, asm_3c35d
call BattleRandom
@ -424,7 +424,7 @@ asm_3c36d:
jr asm_3c3c7
asm_3c37f:
ldh a, [hLinkPlayerNumber]
ldh a, [hSerialConnectionStatus]
cp 2
jr z, asm_3c38f
call BattleRandom
@ -443,7 +443,7 @@ sub_3c399:
dec a
jr nz, asm_3c3b6
ld a, [wDebugFlags]
bit 0, a
bit DEBUG_BATTLE_F, a
jr nz, asm_3c3b6
ld a, [wEnemySubStatus5]
bit 7, a
@ -469,11 +469,11 @@ sub_3c3b8:
asm_3c3c7:
ld a, 1
ldh [hBattleTurn], a
callfar Function38000
callfar AI_SwitchOrTryItem
jr c, asm_3c3eb
callfar DoEnemyTurn
call sub_3c473
ld a, [wBattleResult]
ld a, [wBattleEnded]
and a
ret nz
call sub_3c492
@ -485,7 +485,7 @@ asm_3c3eb:
call DrawHUDsAndHPBars
callfar DoPlayerTurn
call sub_3c473
ld a, [wBattleResult]
ld a, [wBattleEnded]
and a
ret nz
call sub_3c48d
@ -501,7 +501,7 @@ asm_3c3eb:
asm_3c41d:
callfar DoPlayerTurn
call sub_3c473
ld a, [wBattleResult]
ld a, [wBattleEnded]
and a
ret nz
call sub_3c48d
@ -511,11 +511,11 @@ asm_3c41d:
call DrawHUDsAndHPBars
ld a, 1
ldh [hBattleTurn], a
callfar Function38000
callfar AI_SwitchOrTryItem
jr c, asm_3c460
callfar DoEnemyTurn
call sub_3c473
ld a, [wBattleResult]
ld a, [wBattleEnded]
and a
ret nz
call sub_3c492
@ -748,7 +748,7 @@ SandstormHitsText:
prompt
sub_3c61e:
ldh a, [hLinkPlayerNumber]
ldh a, [hSerialConnectionStatus]
cp 1
jr z, asm_3c632
xor a
@ -1248,7 +1248,7 @@ asm_3c94d:
call PrintEmptyString
call BackUpTilesToBuffer
xor a
ld [wcd5d], a
ld [wBattleResult], a
ld b, $4b
call Function32c8
push af
@ -1315,7 +1315,7 @@ sub_3c9c2:
ld hl, wEnemyHPPal
ld e, $30
call UpdateHPPal
callfar Function3834e
callfar EnemySwitch_TrainerHud
ld a, [wLinkMode]
and a
jr z, asm_3c9e4
@ -1334,7 +1334,7 @@ asm_3c9e4:
xor a
ld [wEnemyMoveStruct], a
ld [wFieldMoveSucceeded], a
ld [wcaba], a
ld [wEnemyTurnsTaken], a
inc a
ret
@ -1347,12 +1347,12 @@ asm_3c9fd:
ld b, $b
asm_3ca0a:
ld a, [wca22]
ld a, [wTrainerClass]
cp $2b
jr nz, asm_3ca18
ld b, 0
ld hl, wDebugFlags
set 1, [hl]
set DEBUG_FIELD_F, [hl]
asm_3ca18:
ld a, [wLinkMode]
@ -1420,7 +1420,7 @@ GotMoneyForWinningText:
prompt
BattleText_EnemyWasDefeated:
text_from_ram wca2b
text_from_ram wOTClassName
text "の @"
text_from_ram wStringBuffer1
text_start
@ -1504,7 +1504,7 @@ asm_3cb56:
ld de, $c37d
call sub_3ccef
ld a, 1
ld [wcd5d], a
ld [wBattleResult], a
ld a, [wcad5]
and a
ret z
@ -1654,7 +1654,7 @@ OutOfUsableMonsText:
prompt
Data3ccdd:
text_from_ram wca2b
text_from_ram wOTClassName
text "との"
line "しょうぶに まけた!"
prompt
@ -2152,7 +2152,7 @@ EnemySendOutFirstMon:
; This makes the game halt the script early and throw up an error handler,
; due to reading the start of the following 'text' line as a <NULL> character.
TrainerAboutToUseText:
text_from_ram wca2b
text_from_ram wOTClassName
text "の @"
text_from_ram wStringBuffer1
text "は"
@ -2165,7 +2165,7 @@ TrainerAboutToUseText:
done
TrainerSentOutText:
text_from_ram wca2b
text_from_ram wOTClassName
text "の @"
text_from_ram wStringBuffer1
text "は"
@ -2356,7 +2356,7 @@ TryRunningFromBattle:
jr z, .play_sound
dec a
.play_sound
ld [wcd5d], a
ld [wBattleResult], a
push de
ld de, SFX_RUN
call WaitPlaySFX
@ -2651,7 +2651,7 @@ UpdateBattleMonInParty:
jp CopyBytes
sub_3d40b:
ldh a, [hLinkPlayerNumber]
ldh a, [hSerialConnectionStatus]
cp 1
jr z, asm_3d418
call sub_3d41f
@ -2785,7 +2785,7 @@ RecoveredWithItemText:
prompt
sub_3d50b:
ldh a, [hLinkPlayerNumber]
ldh a, [hSerialConnectionStatus]
cp 1
jr z, asm_3d518
call sub_3d51f
@ -3193,7 +3193,7 @@ BattleMenu_Pack:
xor a
ld [wWildMon], a
ld a, 2
ld [wcd5d], a
ld [wBattleResult], a
call ClearWindowData
call SetPalettes
scf
@ -3616,7 +3616,7 @@ MoveSelectionScreen::
.battle_player_moves
ld a, [wDebugFlags]
bit 0, a
bit DEBUG_BATTLE_F, a
jr nz, .interpret_joypad
call MoveInfoBox
@ -4138,8 +4138,8 @@ asm_3df26:
dec a
jr z, asm_3df3f
ld a, 1
ld [wca22], a
callfar Function384d4
ld [wTrainerClass], a
callfar AIChooseMove
jr asm_3df6b
asm_3df3f:
@ -6100,7 +6100,7 @@ _InitBattleCommon:
cp 1
call z, UpdateEnemyHUD
call StartBattle
call sub_3f13e
call ExitBattle
pop af
ld [wTextboxFlags], a
pop af
@ -6111,10 +6111,10 @@ _InitBattleCommon:
ret
sub_3ef9a:
ld [wca22], a
callfar LoadTrainerClass
callfar Function38f45
ld a, [wca22]
ld [wTrainerClass], a
callfar GetTrainerAttributes
callfar ReadTrainerParty
ld a, [wTrainerClass]
cp 9
jr nz, asm_3efb8
xor a
@ -6145,7 +6145,7 @@ sub_3efdb:
ld de, vFrontPic
call LoadMonFrontSprite
xor a
ld [wca22], a
ld [wTrainerClass], a
ldh [hGraphicStartTile], a
ld hl, $c2ac
ld bc, $0707
@ -6153,9 +6153,9 @@ sub_3efdb:
ret
sub_3f003:
ld a, [wca23]
ld a, [wEnemyTrainerGraphicsPointer]
ld e, a
ld a, [wca24]
ld a, [wEnemyTrainerGraphicsPointer + 1]
ld d, a
ld a, $12
call UncompressSpriteFromDE
@ -6321,7 +6321,7 @@ Data3f0d0:
InitBattleVariables:
xor a
ld [wFieldMoveSucceeded], a
ld [wcd5d], a
ld [wBattleResult], a
ld hl, wcd3c
ld [hli], a
ld [hli], a
@ -6332,9 +6332,9 @@ InitBattleVariables:
ld [wBattleMonSpecies], a
ld [wBattleParticipantsNotFainted], a
ld [wCurBattleMon], a
ld [wBattleResult], a
ld [wBattleEnded], a
ld [wTimeOfDayPal], a
ld [wcaba], a
ld [wEnemyTurnsTaken], a
ld hl, wPlayerHPPal
ld [hli], a
ld [hl], a
@ -6365,24 +6365,25 @@ InitBattleVariables:
.return
ret
sub_3f13e:
ExitBattle:
call IsLinkBattle
jr nz, asm_3f148
call sub_3f1f3
jr asm_3f151
jr nz, .HandleEndOfBattle
call ShowLinkBattleParticipantsAfterEnd
jr .CheckEvolution
asm_3f148:
ld a, [wcd5d]
.HandleEndOfBattle
ld a, [wBattleResult]
and a
jr nz, asm_3f15a
call sub_3f19e
jr nz, .CleanUpBattleRAM
; WIN
call CheckPayDay
asm_3f151:
.CheckEvolution
xor a
ld [wForceEvolution], a
predef EvolveAfterBattle
asm_3f15a:
.CleanUpBattleRAM:
xor a
ld [wLowHealthAlarmBuffer], a
ld [wBattleMode], a
@ -6392,7 +6393,7 @@ asm_3f15a:
ld [wOtherTrainerClass], a
ld [wce38], a
ld [wce39], a
ld [wBattleResult], a
ld [wBattleEnded], a
ld hl, wcd3c
ld [hli], a
ld [hli], a
@ -6400,14 +6401,15 @@ asm_3f15a:
ld [hl], a
ld [wMenuScrollPosition], a
ld hl, wPlayerSubStatus1
ld b, $18
.clear
ld b, wEnemyFuryCutterCount - wPlayerSubStatus1
.loop
ld [hli], a
dec b
jr nz, .clear
jr nz, .loop
ld hl, wd4a7
set 0, [hl]
call WaitSFX
ld a, $e3
ldh [rLCDC], a
ld hl, wd14f
@ -6415,19 +6417,21 @@ asm_3f15a:
call ClearPalettes
ret
sub_3f19e:
CheckPayDay:
ld hl, wPayDayMoney
ld a, [hli]
or [hl]
inc hl
or [hl]
ret z
ld a, [wBattleMonItem]
ld b, a
callfar GetItemHeldEffect
ld a, b
cp $4c
cp HELD_AMULET_COIN
jr nz, AddBattleMoneyToAccount
ld hl, wPayDayMoney + 2
sla [hl]
dec hl
@ -6435,6 +6439,7 @@ sub_3f19e:
dec hl
rl [hl]
jr nc, AddBattleMoneyToAccount
ld a, $ff
ld [hli], a
ld [hli], a
@ -6464,27 +6469,27 @@ BattleText_PlayerPickedUpPayDayMoney:
line "ひろった!"
prompt
sub_3f1f3:
ShowLinkBattleParticipantsAfterEnd:
ld a, [wCurOTMon]
ld hl, wOTPartyMon1Status
ld bc, $30
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
ld a, [wEnemyMonStatus]
ld [hl], a
call ClearTileMap
call sub_3f60c
ld a, [wcd5d]
cp 1
call _ShowLinkBattleParticipants
ld a, [wBattleResult]
cp LOSE
ld de, WonAgainstText
jr c, .print_text
jr c, .store_result
ld de, LostAgainstText
jr z, .print_text
jr z, .store_result
ld de, TiedAgainstText
.print_text
ld hl, $c346
.store_result
hlcoord 6, 8
call PlaceString
ld c, $c8
ld c, 200
call DelayFrames
ret
@ -6711,7 +6716,7 @@ BattleStartMessage:
.PlaceBattleStartText:
push hl
callfar Function38340
callfar BattleStart_TrainerHuds
pop hl
call PrintText
ret
@ -6731,7 +6736,7 @@ HookedPokemonAttackedText:
prompt
WantsToBattleText:
text_from_ram wca2b
text_from_ram wOTClassName
text "の @"
text_from_ram wStringBuffer1
text "が"
@ -6741,7 +6746,7 @@ WantsToBattleText:
ShowLinkBattleParticipants:
call IsLinkBattle
jr nz, .ok
call sub_3f60c
call _ShowLinkBattleParticipants
call ClearTileMap
.ok
call DelayFrame
@ -6758,22 +6763,22 @@ ShowLinkBattleParticipants:
ldh [hMapAnims], a
ret
sub_3f60c:
_ShowLinkBattleParticipants:
call LoadFontExtra
ld hl, $c2f3
hlcoord 3, 4
ld b, 7
ld c, $c
ld c, 12
call DrawTextBox
ld hl, $c31c
hlcoord 4, 6
ld de, wPlayerName
call PlaceString
ld hl, $c36c
ld de, wd8fe
hlcoord 4, 10
ld de, wOTPlayerName
call PlaceString
ld hl, $c349
ld a, $69
hlcoord 9, 8
ld a, ""
ld [hli], a
ld [hl], $6a
ld [hl], ""
callfar LinkBattle_TrainerHuds
ld c, 150
jp DelayFrames

View File

@ -157,7 +157,7 @@ GetTrainerClassName_Old::
; Seemingly unreferenced.
; Loads a name to wStringBuffer1 from a partial list of Trainer classes leftover from Red/Green.
ld hl, .name_table
ld a, [wca22]
ld a, [wTrainerClass]
dec a
ld c, a
ld b, 0
@ -176,18 +176,18 @@ GetTrainerClassName_Old::
ret
.name_table:
dw .youngster, .bug_catcher, .lass, wca2b
dw .youngster, .bug_catcher, .lass, wOTClassName
dw .jr_trainer_male, .jr_trainer_female, .pokemaniac, .super_nerd
dw wca2b, wca2b, .burglar, .engineer
dw .jack, wca2b, .swimmer, wca2b
dw wca2b, .beauty, wca2b, .rocker
dw .juggler, wca2b, wca2b, .blackbelt
dw wca2b, .prof_oak, .chief, .scientist
dw wca2b, .rocket, .cooltrainer_male, .cooltrainer_female
dw wca2b, wca2b, wca2b, wca2b
dw wca2b, wca2b, wca2b, wca2b
dw wca2b, wca2b, wca2b, wca2b
dw wca2b, wca2b, wca2b
dw wOTClassName, wOTClassName, .burglar, .engineer
dw .jack, wOTClassName, .swimmer, wOTClassName
dw wOTClassName, .beauty, wOTClassName, .rocker
dw .juggler, wOTClassName, wOTClassName, .blackbelt
dw wOTClassName, .prof_oak, .chief, .scientist
dw wOTClassName, .rocket, .cooltrainer_male, .cooltrainer_female
dw wOTClassName, wOTClassName, wOTClassName, wOTClassName
dw wOTClassName, wOTClassName, wOTClassName, wOTClassName
dw wOTClassName, wOTClassName, wOTClassName, wOTClassName
dw wOTClassName, wOTClassName, wOTClassName
.youngster

View File

@ -61,7 +61,7 @@ RestoreOverworldMapTiles::
call CloseSRAM
call UpdateSprites
call WaitBGMap
ld a, 144
ld a, SCREEN_HEIGHT_PX
ldh [hWY], a
call DelayFrame
@ -71,3 +71,487 @@ RestoreOverworldMapTiles::
ld b, SGB_MAP_PALS
call GetSGBLayout
ret
SECTION "engine/dumps/bank23.asm@EnterMapAnim_Old", ROMX
; A bunch of old animation functions from Generation I.
; Basically non-functional because RAM has moved around so much since then.
; Certain lines of code were removed here, presumably so that it would actually compile.
; TODO: Make this less messy by including old variables in wram.asm.
; Shouldn't be too much of a priority since it's... you know, not used. Or functional.
EnterMapAnim_Old::
call InitFacingDirectionList_Old
ld a, $ec
ld [wReservedObjectFlags], a ; wSpritePlayerStateData1YPixels in pokered
call WaitBGMap
push hl
call GBFadeInFromWhite
pop hl
call PlayerSpinWhileMovingDown_Old
call FishingAnim_Old ; was IsPlayerStandingOnWarpPadOrHole
ld a, b
and a
jr nz, .done
; if the player is not standing on a warp pad or hole
ld hl, wBattleMenuRows ; originally wPlayerSpinInPlaceAnimFrameDelay
xor a
ld [hli], a ; wPlayerSpinInPlaceAnimFrameDelay
inc a
ld [hli], a ; wPlayerSpinInPlaceAnimFrameDelayDelta
ld a, $8
ld [hli], a ; wPlayerSpinInPlaceAnimFrameDelayEndValue
ld [hl], $ff ; wPlayerSpinInPlaceAnimSoundID
ld hl, $cc45 ; originally wFacingDirectionList
call PlayerSpinInPlace_Old
.done
jp RestoreFacingDirectionAndYScreenPos_Old
; Unreferenced
.dungeonWarpAnimation
ld c, 50
call DelayFrames
call PlayerSpinWhileMovingDown_Old
jr .done
; Also unreferenced
.flyAnimation
pop hl
ld de, PidgeySpriteGFX
ld hl, vNPCSprites
lb bc, BANK(PidgeySpriteGFX), $c
call Request2bpp
call LoadBirdSpriteGraphics_Old
ld hl, wBattleMenuRows ; Originally wFlyAnimUsingCoordList
xor a ; is using coord list
ld [hli], a ; wFlyAnimUsingCoordList
ld a, 12
ld [hli], a ; wFlyAnimCounter
ld [hl], $8 ; wFlyAnimBirdSpriteImageIndex (facing right)
ld de, FlyAnimationEnterScreenCoords_Old
call DoFlyAnimation_Old
call RedrawPlayerSprite
jr .done
FlyAnimationEnterScreenCoords_Old:
; y, x pairs
; This was the sequence of screen coordinates used by the overworld
; Fly animation when the player is entering a map.
db $05, $98
db $0F, $90
db $18, $88
db $20, $80
db $27, $78
db $2D, $70
db $32, $68
db $36, $60
db $39, $58
db $3B, $50
db $3C, $48
db $3C, $40
PlayerSpinWhileMovingDown_Old:
ld hl, wBattleMenuRows ; originally wPlayerSpinWhileMovingUpOrDownAnimDeltaY
ld a, $10
ld [hli], a ; wPlayerSpinWhileMovingUpOrDownAnimDeltaY
ld a, $3c
ld [hli], a ; wPlayerSpinWhileMovingUpOrDownAnimMaxY
call GetPlayerTeleportAnimFrameDelay_Old
ld [hl], a ; wPlayerSpinWhileMovingUpOrDownAnimFrameDelay
jp PlayerSpinWhileMovingUpOrDown_Old
LeaveMapAnim_Old:
call InitFacingDirectionList_Old
call FishingAnim_Old ; originally IsPlayerStandingOnWarpPadOrHole
ld a, b
and a
jr z, .playerNotStandingOnWarpPadOrHole
dec a
jp nz, LeaveMapThroughHoleAnim_Old
.spinWhileMovingUp
ld hl, wBattleMenuRows ; originally wPlayerSpinWhileMovingUpOrDownAnimDeltaY
ld a, -$10
ld [hli], a ; wPlayerSpinWhileMovingUpOrDownAnimDeltaY
ld a, $ec
ld [hli], a ; wPlayerSpinWhileMovingUpOrDownAnimMaxY
call GetPlayerTeleportAnimFrameDelay_Old
ld [hl], a ; wPlayerSpinWhileMovingUpOrDownAnimFrameDelay
call PlayerSpinWhileMovingUpOrDown_Old
call FishingAnim_Old ; originally IsPlayerStandingOnWarpPadOrHole
ld a, b
dec a
jr z, .playerStandingOnWarpPad
; if not standing on a warp pad, there is an extra delay
ld c, 10
call DelayFrames
.playerStandingOnWarpPad
call GBFadeOutToWhite
jp RestoreFacingDirectionAndYScreenPos_Old
.playerNotStandingOnWarpPadOrHole
ld hl, wBattleMenuRows ; originally wPlayerSpinInPlaceAnimFrameDelay
ld a, 16
ld [hli], a ; wPlayerSpinInPlaceAnimFrameDelay
ld a, -1
ld [hli], a ; wPlayerSpinInPlaceAnimFrameDelayDelta
xor a
ld [hli], a ; wPlayerSpinInPlaceAnimFrameDelayEndValue
ld [hl], SFX_TELEPORT_EXIT_2 ; wPlayerSpinInPlaceAnimSoundID
ld hl, $cc45 ; originally wFacingDirectionList
call PlayerSpinInPlace_Old
jr .spinWhileMovingUp
; Also unreferenced
.flyAnimation
call LoadBirdSpriteGraphics_Old
ld hl, wBattleMenuRows ; originally wFlyAnimUsingCoordList
ld a, $ff ; is not using coord list (flap in place)
ld [hli], a ; wFlyAnimUsingCoordList
ld a, 8
ld [hli], a ; wFlyAnimCounter
ld [hl], $c ; wFlyAnimBirdSpriteImageIndex
call DoFlyAnimation_Old
ld hl, wBattleMenuRows ; wFlyAnimUsingCoordList
xor a ; is using coord list
ld [hli], a ; wFlyAnimUsingCoordList
ld a, $c
ld [hli], a ; wFlyAnimCounter
ld [hl], $c ; wFlyAnimBirdSpriteImageIndex (facing right)
ld de, FlyAnimationScreenCoords1_Old
call DoFlyAnimation_Old
ld c, 40
call DelayFrames
ld hl, wBattleMenuColumns ; originally wFlyAnimCounter
ld a, 11
ld [hli], a ; wFlyAnimCounter
ld [hl], $8 ; wFlyAnimBirdSpriteImageIndex (facing left)
ld de, FlyAnimationScreenCoords2_Old
call DoFlyAnimation_Old
call GBFadeOutToWhite
jp RestoreFacingDirectionAndYScreenPos_Old
FlyAnimationScreenCoords1_Old:
; y, x pairs
; This is the sequence of screen coordinates used by the first part
; of the Fly overworld animation.
db $3C, $48
db $3C, $50
db $3B, $58
db $3A, $60
db $39, $68
db $37, $70
db $37, $78
db $33, $80
db $30, $88
db $2D, $90
db $2A, $98
db $27, $A0
FlyAnimationScreenCoords2_Old:
; y, x pairs
; This is the sequence of screen coordinates used by the second part
; of the Fly overworld animation.
db $1A, $90
db $19, $80
db $17, $70
db $15, $60
db $12, $50
db $0F, $40
db $0C, $30
db $09, $20
db $05, $10
db $00, $00
db $F0, $00
LeaveMapThroughHoleAnim_Old:
ld a, [wShadowOAMSprite00TileID]
ld [wShadowOAMSprite02TileID], a
ld a, [wShadowOAMSprite01TileID]
ld [wShadowOAMSprite03TileID], a
ld a, $a0
ld [wShadowOAMSprite00YCoord], a
ld [wShadowOAMSprite01YCoord], a
ld c, 2
call DelayFrames
; hide upper half of player's sprite
ld a, $a0
ld [wShadowOAMSprite02YCoord], a
ld [wShadowOAMSprite03YCoord], a
call GBFadeOutToWhite
jp RestoreFacingDirectionAndYScreenPos_Old
DoFlyAnimation_Old:
ld a, [wTrainerHUDTiles] ; originally wFlyAnimBirdSpriteImageIndex
xor $1 ; make the bird flap its wings
ld [wTrainerHUDTiles], a
ld [wReservedObjectSpriteTile], a ; originally wSpritePlayerStateData1ImageIndex
ld c, 3
call DelayFrames
ld a, [wBattleMenuRows] ; wFlyAnimUsingCoordList
cp $ff
jr z, .skipCopyingCoords ; if the bird is flapping its wings in place
ld hl, wReservedObjectFlags ; originally wSpritePlayerStateData1YPixels
ld a, [de]
inc de
ld [hli], a ; y
inc hl
ld a, [de]
inc de
ld [hl], a ; x
.skipCopyingCoords
ld a, [wBattleMenuColumns] ; wFlyAnimCounter
dec a
ld [wBattleMenuColumns], a
jr nz, DoFlyAnimation_Old
ret
LoadBirdSpriteGraphics_Old:
ld de, PidgeySpriteGFX
ld hl, vNPCSprites
lb bc, BANK(PidgeySpriteGFX), 12
call Request2bpp
ld de, PidgeySpriteGFX tile 12
ld hl, vNPCSprites2
lb bc, BANK(PidgeySpriteGFX), 12
jp Request2bpp
InitFacingDirectionList_Old:
ld a, [wReservedObjectSpriteTile] ; originally wSpritePlayerStateData1ImageIndex
ld [$cc4d], a ; originally wSavedPlayerFacingDirection
ld a, [wReservedObjectFlags] ; originally wSpritePlayerStateData1YPixels
ld [$cc4c], a ; originally wSavedPlayerScreenY
ld hl, .PlayerSpinningFacingOrder
ld de, $cc45 ; originally wFacingDirectionList
ld bc, 4
call CopyBytes
ld a, [wReservedObjectSpriteTile]
ld hl, $cc45
; find the place in the list that matches the current facing direction
.loop
cp [hl]
inc hl
jr nz, .loop
dec hl
ret
.PlayerSpinningFacingOrder:
; The order of the direction the player's sprite is facing when teleporting
; away. Creates a spinning effect.
db OW_DOWN, OW_LEFT, OW_UP, OW_RIGHT
SpinPlayerSprite_Old:
; copy the current value from the list into the sprite data and rotate the list
ld a, [hl]
ld [wReservedObjectSpriteTile], a ; originally wSpritePlayerStateData1ImageIndex
push hl
ld hl, $cc45 ; wFacingDirectionList
ld de, $cc44 ; wFacingDirectionList - 1
ld bc, 4
call CopyBytes
ld a, [$cc44]
ld [$cc48], a ; wFacingDirectionList + 3
pop hl
ret
PlayerSpinInPlace_Old:
call SpinPlayerSprite_Old
ld a, [wBattleMenuRows] ; originally wPlayerSpinInPlaceAnimFrameDelay
ld c, a
and $3
jr nz, .skipPlayingSound
.skipPlayingSound
ld a, [wBattleMenuColumns] ; wPlayerSpinInPlaceAnimFrameDelayDelta
add c
ld [wBattleMenuRows], a ; wPlayerSpinInPlaceAnimFrameDelay
ld c, a
ld a, [wTrainerHUDTiles] ; wPlayerSpinInPlaceAnimFrameDelayEndValue
cp c
ret z
call DelayFrames
jr PlayerSpinInPlace_Old
PlayerSpinWhileMovingUpOrDown_Old:
call SpinPlayerSprite_Old
ld a, [wBattleMenuRows] ; wPlayerSpinWhileMovingUpOrDownAnimDeltaY
ld c, a
ld a, [wReservedObjectFlags] ; wSpritePlayerStateData1YPixels
add c
ld [wReservedObjectFlags], a ; wSpritePlayerStateData1YPixels
ld c, a
ld a, [wBattleMenuColumns] ; wPlayerSpinWhileMovingUpOrDownAnimMaxY
cp c
ret z
ld a, [wTrainerHUDTiles] ; wPlayerSpinWhileMovingUpOrDownAnimFrameDelay
ld c, a
call DelayFrames
jr PlayerSpinWhileMovingUpOrDown_Old
RestoreFacingDirectionAndYScreenPos_Old:
ld a, [$cc4c] ; wSavedPlayerScreenY
ld [wReservedObjectFlags], a ; wSpritePlayerStateData1YPixels
ld a, [$cc4d] ; wSavedPlayerFacingDirection
ld [wReservedObjectSpriteTile], a ; wSpritePlayerStateData1ImageIndex
ret
; if SGB, 2 frames, else 3 frames
GetPlayerTeleportAnimFrameDelay_Old:
ld a, [wSGB]
xor $1
inc a
inc a
ret
FishingAnim_Old:
ld c, 10
call DelayFrames
ld hl, wMovementFlags_Old
set 6, [hl] ; BIT_LEDGE_OR_FISHING
ld de, GoldSpriteGFX
ld hl, vNPCSprites tile $00
lb bc, BANK(GoldSpriteGFX), 12
call Request2bpp
ld a, 4
ld hl, RedFishingTiles
call $4c4d ; LoadAnimSpriteGfx_Old
ld a, [wReservedObjectSpriteTile] ; originally wSpritePlayerStateData1ImageIndex
ld c, a
ld b, $0
ld hl, FishingRodOAM
add hl, bc
ld de, wShadowOAMSprite39
ld bc, $4
call CopyBytes
ld c, 100
call DelayFrames
ld a, [wRodResponse_Old]
and a
ld hl, NoNibbleText
jr z, .done
cp 2
ld hl, NothingHereText
jr z, .done
; there was a bite
; shake the player's sprite vertically
ld b, 10
.loop
ld hl, wReservedObjectFlags ; wSpritePlayerStateData1YPixels
call .ShakePlayerSprite
ld hl, wShadowOAMSprite39
call .ShakePlayerSprite
ld c, 3
call DelayFrames
dec b
jr nz, .loop
; If the player is facing up, hide the fishing rod so it doesn't overlap with
; the exclamation bubble that will be shown next.
ld a, [wReservedObjectSpriteTile] ; wSpritePlayerStateData1ImageIndex
cp OW_UP
jr nz, .skipHidingFishingRod
ld a, $a0
ld [wShadowOAMSprite39YCoord], a
.skipHidingFishingRod
ld hl, $cc4c ; wEmotionBubbleSpriteIndex
xor a
ld [hli], a ; player's sprite
ld [hl], a ; EXCLAMATION_BUBBLE
; There's no predef for displaying emotion bubbles in this build, so this amounts to nothing
; If the player is facing up, unhide the fishing rod.
ld a, [wReservedObjectSpriteTile] ; wSpritePlayerStateData1ImageIndex
cp OW_UP
jr nz, .skipUnhidingFishingRod
ld a, $44
ld [wShadowOAMSprite39YCoord], a
.skipUnhidingFishingRod
ld hl, ItsABiteText
.done
call PrintText
ld hl, wMovementFlags_Old
res 6, [hl] ; BIT_LEDGE_OR_FISHING
call RedrawPlayerSprite
call LoadFont
ret
.ShakePlayerSprite
ld a, [hl]
xor $1
ld [hl], a
ret
NoNibbleText:
text "つれないなー<⋯⋯>"
prompt
NothingHereText:
text "なにも いない みたい<⋯⋯>"
prompt
ItsABiteText:
text "おっ!"
line "ひいてる ひいてる!"
prompt
FishingRodOAM:
; specifies how the fishing rod should be drawn on the screen
dbsprite 9, 11, 4, 3, $fd, 0 ; down
dbsprite 9, 8, 4, 4, $fd, 0 ; up
dbsprite 8, 10, 0, 0, $fe, 0 ; left
dbsprite 11, 10, 0, 0, $fe, X_FLIP ; right
MACRO fishing_gfx
dw \1
db \2
db $32 ; should've been BANK(\1)
dw vNPCSprites tile \3
ENDM
RedFishingTiles:
fishing_gfx RedFishingTilesFront, 2, $02
fishing_gfx RedFishingTilesBack, 2, $06
fishing_gfx RedFishingTilesSide, 2, $0a
fishing_gfx RedFishingRodTiles, 3, $fd
LoadAnimSpriteGfx_Old:
; Load animated sprite tile patterns into VRAM during V-blank. hl is the address
; of an array of structures that contain arguments for CopyVideoData and a is
; the number of structures in the array.
ld bc, $0
.loop
push af
push bc
push hl
add hl, bc
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
ld a, [hli]
ld c, a
ld a, [hli]
ld b, a
ld a, [hli]
ld h, [hl]
ld l, a
call Request2bpp
pop hl
pop bc
ld a, $6
add c
ld c, a
pop af
dec a
jr nz, .loop
ret
RedFishingTilesFront: INCBIN "gfx/overworld/red_fish_front.2bpp"
RedFishingTilesBack: INCBIN "gfx/overworld/red_fish_back.2bpp"
RedFishingTilesSide: INCBIN "gfx/overworld/red_fish_side.2bpp"
RedFishingRodTiles: INCBIN "gfx/overworld/fishing_rod.2bpp"

View File

@ -151,10 +151,6 @@ _Breeder::
jp PrintText
.CheckBreedmonCompatibility:
; Assumes that wBreedMonGenders has already been set from opening the Breeder menu with 1 or fewer Pokémon.
; If you open the breeder after saving and resetting the game while they have two Pokémon
; (assuming the BreedMons GET saved at this point in development),
; then this check will fail until you change out the BreedMons again.
ld a, [wBreedMonGenders]
ld b, a
srl b

View File

@ -14,7 +14,7 @@ PokemonCenterPC:
; Also used for player's PC (both in debug and in demo mode)
ld a, [wDebugFlags]
bit 1, a
bit DEBUG_FIELD_F, a
jp z, PC_Demo
call PC_PlayBootSound
@ -25,7 +25,7 @@ PokemonCenterPC:
ld hl, .TurnOnText
call MenuTextBoxBackup
ld hl, wDebugFlags
bit 1, [hl]
bit DEBUG_FIELD_F, [hl]
jr nz, .DisplayMenu
ld hl, .NotConnectedText
call MenuTextBoxBackup
@ -263,7 +263,7 @@ PlayerWithdrawItemMenu:
jr c, .done
.Withdraw:
ld hl, wUnknownListLengthd1ea
ld hl, wNumPCItems
ld a, [wItemIndex]
call TossItem
ld hl, wNumBagItems
@ -277,7 +277,7 @@ PlayerWithdrawItemMenu:
.PackFull:
ld hl, .NoRoomWithdrawText
call MenuTextBoxBackup
ld hl, wUnknownListLengthd1ea
ld hl, wNumPCItems
call ReceiveItem
ret
@ -311,7 +311,7 @@ PlayerTossItemMenu:
.loop
call PCItemsJoypad
jr c, .quit
ld de, wUnknownListLengthd1ea
ld de, wNumPCItems
callfar TryTossItem
jr .loop
.quit
@ -427,7 +427,7 @@ PlayerDepositItemMenu:
ld hl, wNumBagItems
ld a, [wItemIndex]
call TossItem
ld hl, wUnknownListLengthd1ea
ld hl, wNumPCItems
call ReceiveItem
jr nc, .NoRoomInPC
predef LoadItemData
@ -507,7 +507,23 @@ PCItemsJoypad:
db SCROLLINGMENU_ENABLE_SELECT | SCROLLINGMENU_ENABLE_FUNCTION3 | SCROLLINGMENU_ENABLE_RIGHT | SCROLLINGMENU_ENABLE_LEFT
db 4, 8 ; rows, columns
db SCROLLINGMENU_ITEMS_QUANTITY ; type
dbw 0, wUnknownListLengthd1ea
dbw 0, wNumPCItems
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
dba UpdateItemDescription
; Leftover menu data for a Gen I-styled deposit menu (with the addition of the item's description)
.UnusedDepositMenuHeader:
db MENU_BACKUP_TILES
menu_coords 4, 1, 19, 10
dw .UnusedDepositMenuData
db 1 ; default selection
.UnusedDepositMenuData:
db SCROLLINGMENU_ENABLE_SELECT | SCROLLINGMENU_ENABLE_FUNCTION3 | SCROLLINGMENU_ENABLE_RIGHT | SCROLLINGMENU_ENABLE_LEFT
db 4, 8 ; rows, columns
db SCROLLINGMENU_ITEMS_QUANTITY ; type
dbw 0, wItems
dba PlaceMenuItemName
dba PlaceMenuItemQuantity
dba UpdateItemDescription

View File

@ -398,7 +398,7 @@ PikachuMiniGame_RunFrame:
ldh [hSCX], a
ldh [hSCY], a
ld a, 144
ld a, SCREEN_HEIGHT_PX
ldh [hWY], a
scf
ret

View File

@ -1611,8 +1611,8 @@ PokeDollEffect:
dec a ; WILD_BATTLE?
jp nz, IsntTheTimeMessage
ld a, LOSE
ld [wBattleResult], a
ld a, TRUE
ld [wBattleEnded], a
jp UseItemText
GuardSpecEffect:
@ -1764,8 +1764,8 @@ ENDM
.PlayedTheFlute:
text "<PLAYER>は"
line "#のふえを ふいてみた!@"
; BUG: No text_asm.
ld b, 8
text_waitbutton
start_asm
ld a, [wBattleMode]
and a
jr nz, .battle

419
engine/menu/empty_sram.asm Normal file
View File

@ -0,0 +1,419 @@
INCLUDE "constants.asm"
SECTION "engine/menu/empty_sram.asm", ROMX
Checksum::
push de
xor a
ld d, a
.loop
ld a, [hli]
add d
ld d, a
dec bc
ld a, b
or c
jr nz, .loop
ld a, d
cpl
pop de
ret
EmptyAllSRAMBanks::
ld a, 0
call .EmptyBank
call InitOptions
ld a, 1
call .EmptyBank
ld a, 2
call .EmptyBank
ld a, 3
call .EmptyBank
call CloseSRAM
ret
.EmptyBank:
call OpenSRAM
ld hl, SRAM_Begin
ld bc, SRAM_End - SRAM_Begin
ld a, $ff
call ByteFill
ret
SaveMenu::
call PrintSaveScreenText
ld hl, WouldYouLikeToSaveTheGameText
call SaveTheGame_yesorno
and a
jr nz, .done
call VerifyChecksum
ld hl, wSaveFileFlags
bit NEW_FILE_F, [hl]
res NEW_FILE_F, [hl]
jr nz, .next
bit ANOTHER_FILE_EXISTS_F, [hl]
res ANOTHER_FILE_EXISTS_F, [hl]
jr nz, .another_save_file
ld hl, AlreadyASaveFileText
call SaveTheGame_yesorno
and a
jr nz, .done
jr .next
.another_save_file:
ld hl, AnotherSaveFileText
call SaveTheGame_yesorno
and a
jr nz, .done
.next
ld hl, wSaveFileFlags
set 0, [hl]
ld hl, wDebugFlags
set SAVE_FILE_EXISTS_F, [hl]
call SaveOptionsAndGameData
call SavePokemonData
call Dummy_SaveBox
ld c, 32
call DelayFrames
ld hl, SavedTheGameText
call MenuTextBox
ld de, SFX_SAVE
call WaitPlaySFX
call WaitSFX
ld c, 30
call DelayFrames
call ExitMenu
.done
call ExitMenu
ret
SaveTheGame_yesorno:
call MenuTextBox
lb bc, 0, 7
call PlaceYesNoBox
ld a, [wMenuCursorY]
dec a
call CloseWindow
ret
WouldYouLikeToSaveTheGameText:
text "ここまでの かつやくを"
line "#レポートに かきこみますか?"
done
SavedTheGameText:
text "<PLAYER>は"
line "レポートに しっかり かきのこした!"
done
AlreadyASaveFileText:
text "まえに かかれた レポートが"
line "きえて しまいますが"
cont "うえから かいても いいですか?"
done
AnotherSaveFileText:
text "まえに かかれた レポート が"
line "こんかいと ちがう もの ですが"
cont "うえから かいても いいですか?"
done
VerifyChecksum::
ld a, BANK(sChecksum)
call OpenSRAM
ld a, [sChecksum + 2]
ldh [hChecksum], a
cp $ff
jr nz, .file_exists
ld hl, wSaveFileFlags
set NEW_FILE_F, [hl]
jr .done
.file_exists
ld a, BANK(sGameData)
call OpenSRAM
ld hl, sGameData
ld bc, sGameDataEnd - sGameData
call Checksum
ld b, a
ldh a, [hChecksum]
cp b
jr z, .done
ld hl, wSaveFileFlags
set ANOTHER_FILE_EXISTS_F, [hl]
.done
call CloseSRAM
ret
PrintSaveScreenText::
xor a
ldh [hBGMapMode], a
ld hl, .MenuHeader
call LoadMenuHeader
call MenuBox
call PlaceVerticalMenuItems
farcall PrintSaveScreenNumbers
call LoadFontExtra
call UpdateSprites
ld a, 1
ldh [hBGMapMode], a
ld c, 20
call DelayFrames
ret
.MenuHeader:
db MENU_BACKUP_TILES
menu_coords 5, 0, 19, 9
dw .MenuData
db 1
.MenuData:
db STATICMENU_PLACE_TITLE
db 4
db "しゅじんこう <PLAYER>@"
db "もっているバッジ    こ@"
db "#ずかん    ひき@"
db "プレイじかん@"
db 6
db "テスト@" ; "TEST"
SaveOptionsAndGameData::
ld a, BANK(sOptions)
call OpenSRAM
ld hl, wOptions
ld de, sOptions
ld bc, wGameDataEnd - wOptions
call CopyBytes
ld hl, wGameData2
ld de, sGameData2
ld bc, wGameData2End - wGameData2
call CopyBytes
ld a, BANK(sChecksum)
call OpenSRAM
ld hl, wGameData
ld bc, wGameDataEnd - wGameData
call Checksum
ld [sChecksum + 2], a
ld hl, wGameData2
ld bc, wGameData2End - wGameData2
call Checksum
ld [sChecksum + 1], a
call CloseSRAM
ret
SavePokemonData::
ld a, BANK(sPokemonData)
call OpenSRAM
ld hl, wPokemonData
ld de, sPokemonData
ld bc, wPokemonDataEnd - wPokemonData
call CopyBytes
ld a, BANK(sChecksum)
call OpenSRAM
ld hl, wPokemonData
ld bc, wPokemonDataEnd - wPokemonData
call Checksum
ld [sChecksum], a
call CloseSRAM
ret
; Dummied out with a ret, but it seemingly works.
Dummy_SaveBox::
ret
ld a, [wCurBox]
ldh [hTempCurBox], a
call .SaveBox
ret
.SaveBox:
ldh a, [hTempCurBox]
dec a
push af
cp NUM_BOXES / 2
ld a, BANK("Boxes 6-10")
jr nc, .next
ld a, BANK("Boxes 1-5")
.next
call OpenSRAM
pop af
add a
ld d, 0
ld e, a
ld hl, .BoxAddresses
add hl, de
ld a, [hli]
ld d, [hl]
ld e, a
ld hl, wBox
ld bc, wBoxEnd - wBox
call CopyBytes
call CloseSRAM
ret
.BoxAddresses:
for n, 1, NUM_BOXES + 1
dw sBox{d:n}
endr
; Note that unlike the release versions of Red & Green or Gold & Silver, there's nothing to stop you from loading
; a corrupted file. The message will be displayed, but otherwise the game continues as normal.
TryLoadSaveFile::
call ClearTileMap
call LoadFont
call LoadFontExtra
call TryLoadSaveData
jr c, .corrupt
call TryLoadPokemonData
jr c, .corrupt
ret
.corrupt
ld hl, wOptions
push hl
set NO_TEXT_SCROLL_F, [hl]
ld hl, .SaveFileCorruptedText
call PrintText
ld c, 100
call DelayFrames
pop hl
res NO_TEXT_SCROLL_F, [hl]
ret
.SaveFileCorruptedText:
text "レポートの ないようが"
line "こわれています!!"
prompt
TryLoadSaveData:
call CheckSaveFileChecksum
jr nz, .corrupt
ld a, BANK(sGameData)
call OpenSRAM
ld hl, sGameData
ld de, wGameData
ld bc, wGameDataEnd - wGameData
call CopyBytes
ld hl, sGameData2
ld de, wGameData2
ld bc, wGameData2End - wGameData2
call CopyBytes
jr .done
.corrupt
scf
.done
call CloseSRAM
ret
CheckSaveFileChecksum:
ld a, BANK(sChecksum)
call OpenSRAM
ld a, [sChecksum + 2]
ldh [hChecksum], a
ld a, [sChecksum + 1]
ldh [hChecksum + 1], a
ld a, [sChecksum + 0]
ldh [hChecksum + 2], a
ld a, BANK(sGameData)
call OpenSRAM
ld hl, sGameData
ld bc, wGameDataEnd - wGameData
call Checksum
ld b, a
ldh a, [hChecksum]
cp b
jr nz, .corrupt
ld hl, sGameData2
ld bc, wGameData2End - wGameData2
call Checksum
ld b, a
ldh a, [hChecksum + 1]
cp b
jr nz, .corrupt
ld a, BANK(sPokemonData)
call OpenSRAM
ld hl, sPokemonData
ld bc, wPokemonDataEnd - wPokemonData
call Checksum
ld b, a
ldh a, [hChecksum + 2]
cp b
.corrupt
push af
call CloseSRAM
pop af
ret
TryLoadPokemonData:
ld a, BANK(sChecksum)
call OpenSRAM
ld a, [sChecksum]
ldh [hChecksum + 2], a
ld a, BANK(sPokemonData)
call OpenSRAM
ld hl, sPokemonData
ld bc, wPokemonDataEnd - wPokemonData
call Checksum
ld b, a
ldh a, [hChecksum + 2]
cp b
jr nz, .corrupt
ld hl, sPokemonData
ld de, wPokemonData
ld bc, wPokemonDataEnd - wPokemonData
call CopyBytes
jr .done
.corrupt
scf
.done
call CloseSRAM
ret
; Unreferenced
ret
MACRO map_buffer_pointers
db GROUP_\1, MAP_\1
dw \2, \3, \4
ENDM
; TODO: Rename to something more fitting, and actually label the flag ram addresses.
UnknownMapBufferPointers:
map_buffer_pointers PLAYER_HOUSE_2F, wPlayerHouse2FCurScript, PlayerHouse2FScriptPointers, wd39a
;db $01, $09, $9A, $D2, $95, $41, $9A, $D3
db $01, $08, $9B, $D2, $A6, $40, $9B, $D3 ; PLAYER_HOUSE_1F
db $01, $04, $9C, $D2, $7E, $76, $9C, $D3 ; SILENT_HILL
db $01, $0C, $9D, $D2, $C6, $4B, $9D, $D3 ; SILENT_HILL_LAB_FRONT
db $01, $0D, $9E, $D2, $73, $5C, $9E, $D3 ; SILENT_HILL_LAB_BACK
db $01, $0A, $9F, $D2, $8C, $46, $9F, $D3 ; SILENT_HILL_POKECENTER
db $01, $0B, $A0, $D2, $43, $48, $A0, $D3 ; SILENT_HILL_HOUSE
db $01, $01, $A1, $D2, $A2, $7B, $A1, $D3 ; ROUTE1P1
db $01, $02, $A2, $D2, $72, $7C, $A2, $D3 ; ROUTE1P2
db $01, $05, $A3, $D2, $6B, $40, $A3, $D3 ; ROUTE1_GATE_1F
db $01, $06, $A4, $D2, $29, $41, $A4, $D3 ; ROUTE1_GATE_2F
db $01, $0F, $A5, $D2, $55, $56, $A5, $D3 ; SHIZUKANA_OKA
db $02, $11, $A6, $D2, $8F, $47, $A6, $D3 ; OLD_CITY_POKECENTER_2F
db -1
OverworldLoop_ReturnFromBattle:
ld a, MAPSTATUS_MAIN
call SetMapStatus
ret

View File

@ -57,7 +57,7 @@ InitializeNewGameWRAM:
call .InitList
ld hl, wNumKeyItems
call .InitList
ld hl, wUnknownListLengthd1ea
ld hl, wNumPCItems
call .InitList
xor a
@ -76,7 +76,7 @@ endc
ld a, LOW(START_MONEY)
ld [wMoney + 2], a
ld hl, wUnknownListLengthd1ea
ld hl, wNumPCItems
ld a, ITEM_REPEL
ld [wCurItem], a
ld a, 1
@ -121,10 +121,10 @@ LoadOptions:
ret
; Copies the contents of wDebugFlags - wce66 to... themselves.
; Presumably, the debug flags were originally saved to the save file (evidenced by SRAM being opened and closed),
; Presumably, the debug flags were originally read from the save file (evidenced by SRAM being opened and closed),
; but the source address was dummied out.
Dummy_LoadDebugFlags:
ld a, BANK(s0_a600)
ld a, BANK(sOptions)
call OpenSRAM
ld hl, wDebugFlags
ld a, [hli]
@ -181,10 +181,10 @@ MainMenuHeader:
db 1 ; default option
.MenuData:
db $80
db STATICMENU_CURSOR
db 0 ; items
dw MainMenuItems
db $8a, $1f
dw PlaceMenuStrings
dw .Strings
.Strings:
@ -195,10 +195,10 @@ MainMenuHeader:
db "じかんセット@"
MainMenuJumptable:
dw MainMenuOptionContinue
dw StartNewGame
dw Continue
dw NewGame
dw MenuCallSettings
dw StartNewGame
dw NewGame
dw MainMenuOptionSetTime
MainMenuItems:
@ -233,9 +233,9 @@ MainMenuOptionSetTime::
callfar SetTime
ret
MainMenuOptionContinue::
callfar Function14624
call DisplayContinueGameInfo
Continue::
callfar TryLoadSaveFile
call DisplaySaveInfoOnContinue
.loop
call ClearJoypad
call GetJoypad
@ -251,7 +251,7 @@ MainMenuOptionContinue::
ld hl, wDebugFlags
res DEBUG_FIELD_F, [hl]
set CONTINUED_F, [hl]
set 3, [hl]
set SAVE_FILE_EXISTS_F, [hl]
ldh a, [hJoyState]
bit SELECT_F, a
jr z, .skip
@ -259,16 +259,16 @@ MainMenuOptionContinue::
.skip
call ClearBGPalettes
call ClearTileMap
ld c, $0A
ld c, 10
call DelayFrames
jp OverworldStart
DisplayContinueGameInfo::
DisplaySaveInfoOnContinue::
xor a
ldh [hBGMapMode], a
hlcoord 4, 7
ld b, $08
ld c, $0D
ld b, 8
ld c, 13
call DrawTextBox
hlcoord 5, 9
ld de, PlayerInfoText
@ -284,38 +284,38 @@ DisplayContinueGameInfo::
call PrintPlayTime
ld a, $01
ldh [hBGMapMode], a
ld c, $1E
ld c, 30
call DelayFrames
ret
PrintNumBadges::
push hl
ld hl, wJohtoBadges
ld b, $01 ; only Johto Badges
ld b, 1 ; only Johto Badges
call CountSetBits
pop hl
ld de, wNumSetBits
ld bc, $0102 ; flags and constants for this? 1 byte source, 2 digit display
lb bc, 1, 2
jp PrintNumber
PrintNumOwnedMons::
push hl
ld hl, wPokedexCaught
ld b, $20 ; flag_array NUM_POKEMON?
ld b, (NUM_POKEMON + 7) / 8 ; flag_array NUM_POKEMON
call CountSetBits
pop hl
ld de, wNumSetBits
ld bc, $0103 ; 1 byte, 3 digit
lb bc, 1, 3
jp PrintNumber
PrintPlayTime::
ld de, hRTCHours
ld bc, $0103 ; 1 byte, 3 digit
lb bc, 1, 3
call PrintNumber
ld [hl], ''
inc hl
ld de, hRTCMinutes
ld bc, $8102 ; PRINTNUM_LEADINGZEROS, 1 byte, 2 digit
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
jp PrintNumber
PlayerInfoText:
@ -325,7 +325,7 @@ PlayerInfoText:
next "プレイじかん"
text_end
StartNewGame::
NewGame::
ld de, MUSIC_NONE
call PlayMusic
ld de, MUSIC_OAK_INTRO

View File

@ -189,7 +189,7 @@ StartMenu_Reset:
ret
StartMenu_Save:
predef Function143e0
predef SaveMenu
call UpdateSprites
ld a, 0
ret
@ -976,7 +976,7 @@ PartyCheckLessThanTwo:
PartyHeldItem:
callfar FreezeMonIcons
ld hl, .HoldItemMenu
ld hl, GiveTakeItemMenuData
call LoadMenuHeader
call VerticalMenu
jp c, .close
@ -1021,7 +1021,7 @@ PartyHeldItem:
jr z, .NoItem
ld [wce37], a
call GetItemName
ld hl, ItemPrompt6753
ld hl, PokemonAskSwapItemText
call MenuTextBox
call YesNoBox
call ExitMenu
@ -1036,11 +1036,11 @@ PartyHeldItem:
ld [wce37], a
ld a, b
ld [wCurItem], a
call PartyRecieveItem
call ReceiveItemFromPokemon
jp nc, .GiveItem
ld a, [wce37]
ld [wCurItem], a
ld hl, ItemWasEquippedText
ld hl, PokemonSwapItemText
call MenuTextBoxBackup
jr .CheckMail
@ -1049,7 +1049,7 @@ PartyHeldItem:
ld [wItemQuantity], a
ld hl, wNumBagItems
call TossItem
ld hl, ItemPrompt66FA
ld hl, PokemonHoldItemText
call MenuTextBoxBackup
.CheckMail
call GetPartyItemOffset
@ -1063,13 +1063,13 @@ PartyHeldItem:
.GiveItem
ld a, [wce37]
ld [wCurItem], a
call PartyRecieveItem
ld hl, PartyItemRecieveBagFullText
call ReceiveItemFromPokemon
ld hl, ItemStorageFullText
call MenuTextBoxBackup
jr .ExitGiveItem
.CantGive
ld hl, .CantBeEquippedText
ld hl, ItemCantHeldText
call MenuTextBoxBackup
.ExitGiveItem
call ClearPalettes
@ -1084,58 +1084,56 @@ PartyHeldItem:
and a
jr z, .NoItemToRecieve
ld [wCurItem], a
call PartyRecieveItem
call ReceiveItemFromPokemon
jr nc, .jump2
call GetPartyItemOffset
ld a, [hl]
ld [wce37], a
ld [hl], 0
ld [wNamedObjectIndexBuffer], a
ld [hl], ITEM_NONE
call GetItemName
ld hl, ItemPrompt673D
ld hl, PokemonTookItemText
call MenuTextBoxBackup
jr .escape
.NoItemToRecieve
ld hl, PartyNoItemToRecieveText
ld hl, PokemonNotHoldingText
call MenuTextBoxBackup
jr .escape
.jump2
ld hl, PartyItemRecieveBagFullText
ld hl, ItemStorageFullText
call MenuTextBoxBackup
.escape
ret
.HoldItemMenu ; verticalmenu
GiveTakeItemMenuData:
db STATICMENU_NO_TOP_SPACING | STATICMENU_PLACE_TITLE
menu_coords 4, 4, $e, 9
dw .HoldItemMenuText
db 1
dw .Items
db 1 ; default option
.HoldItemMenuText
db $80
db 2
.Items:
db STATICMENU_CURSOR ; flags
db 2 ; # items
db "そうびを する@"
db "そうびを はずす@"
.CantBeEquippedText
ItemCantHeldText:
text_from_ram wStringBuffer1
text "を そうびすることは"
line "できません"
prompt
ItemWasEquippedText:
PokemonSwapItemText:
text_from_ram wMonOrItemNameBuffer
text "は そうび していた"
line "@"
text_from_ram wStringBuffer1
text "を はずして"
para "@"
text_from_ram wStringBuffer2
text "を そうびした!"
prompt
ItemPrompt66FA:
PokemonHoldItemText:
text_from_ram wMonOrItemNameBuffer
text "は @"
text_from_ram wStringBuffer2
@ -1143,18 +1141,18 @@ ItemPrompt66FA:
line "そうびした!"
prompt
PartyNoItemToRecieveText:
PokemonNotHoldingText:
text_from_ram wMonOrItemNameBuffer
text "は なにも"
line "そうび していません!"
prompt
PartyItemRecieveBagFullText:
ItemStorageFullText:
text "どうぐが いっぱいで"
line "そうびを はずせません!"
prompt
ItemPrompt673D:
PokemonTookItemText:
text_from_ram wMonOrItemNameBuffer
text "から @"
text_from_ram wStringBuffer1
@ -1162,7 +1160,7 @@ ItemPrompt673D:
line "はずしました!"
prompt
ItemPrompt6753:
PokemonAskSwapItemText:
text_from_ram wMonOrItemNameBuffer
text "は @"
text_from_ram wStringBuffer1
@ -1180,7 +1178,7 @@ GetPartyItemOffset:
pop af
ret
PartyRecieveItem:
ReceiveItemFromPokemon:
ld a, 1
ld [wItemQuantity], a
ld hl, wNumBagItems

View File

@ -99,29 +99,29 @@ IntroCleanup::
ld de, ShrinkPic1
lb bc, BANK(ShrinkPic1), $00
call IntroDisplayPicCenteredOrUpperRight
ld c, $04
ld c, 4
call DelayFrames
ld de, ShrinkPic2
lb bc, BANK(ShrinkPic2), $00
call IntroDisplayPicCenteredOrUpperRight
ld c, $14
ld c, 20
call DelayFrames
hlcoord 6, 5
ld b, $07
ld c, $07
ld b, 7
ld c, 7
call ClearBox
ld c, $14
ld c, 20
call DelayFrames
call LoadStartingSprites
call LoadFontExtra
ld c, $32
ld c, 50
call DelayFrames
call GBFadeOutToWhite
call ClearTileMap
call Function0502
ld a, $00
ld [wd638], a
ld [wd637], a
ld a, MAPSTATUS_MAIN
ld [wLastMapStatus], a
ld [wMapStatus], a
OverworldStart::
call SetUpGameEntry
@ -130,7 +130,7 @@ OverworldStart::
call z, SpawnPlayer
ld hl, wd4a9
set 0, [hl]
jp Function2a85
jp OverworldLoop
SetUpGameEntry::
ld a, $04

View File

@ -540,7 +540,7 @@ SRAMClearMenu::
cp $01
jp z, Init
callfar InitAllSRAMBanks
callfar EmptyAllSRAMBanks
jp Init
SRAMClear_Message::

View File

@ -87,7 +87,7 @@ CheckFacingObject:
ld bc, wPlayerSprite
ld a, PLAYER_OBJECT_INDEX
ldh [hMapObjectIndex], a
call _CheckObjectCollision
call IsNPCAtCoord
ret nc
ld hl, OBJECT_WALKING
add hl, bc
@ -107,13 +107,13 @@ WillObjectBumpIntoSomeoneElse:
ld hl, OBJECT_MAP_Y
add hl, bc
ld e, [hl]
jr _CheckObjectCollision
jr IsNPCAtCoord
IsObjectFacingSomeoneElse:
ldh a, [hMapObjectIndex]
call GetObjectStruct
call .GetFacingCoords
call _CheckObjectCollision
call IsNPCAtCoord
ret
.GetFacingCoords
ld hl, OBJECT_MAP_X
@ -148,7 +148,7 @@ IsObjectFacingSomeoneElse:
; returns the carry flag if a sprite is at coords d, e
; will not collide with sprite index stored in hEventCollisionException
_CheckObjectCollision:
IsNPCAtCoord:
ld bc, wObjectStructs
xor a
.loop
@ -158,22 +158,25 @@ _CheckObjectCollision:
ld a, [hl]
and a
jr z, .next
ld hl, OBJECT_MAP_X
add hl, bc
ld a, [hl]
cp d
jr nz, .check_last_position
jr nz, .check_current_coords
ld hl, OBJECT_MAP_Y
add hl, bc
ld a, [hl]
cp e
jr nz, .check_last_position
jr nz, .check_current_coords
ldh a, [hEventCollisionException]
ld l, a
ldh a, [hObjectStructIndex]
cp l
jr nz, .collision
.check_last_position
jr nz, .yes
.check_current_coords
ld hl, OBJECT_LAST_MAP_X
add hl, bc
ld a, [hl]
@ -188,7 +191,8 @@ _CheckObjectCollision:
ld l, a
ldh a, [hObjectStructIndex]
cp l
jr nz, .collision
jr nz, .yes
.next
ld hl, OBJECT_LENGTH
add hl, bc
@ -201,7 +205,7 @@ _CheckObjectCollision:
and a
ret
.collision
.yes
scf
ret

View File

@ -1040,7 +1040,7 @@ CheckObjectCollision::
ld a, [wPlayerMapY]
add e
ld e, a
callfar _CheckObjectCollision
callfar IsNPCAtCoord
ret nc
jp CheckCompanionObjectCollision

View File

@ -280,10 +280,10 @@ CopyMapObjectToObjectStruct::
ld a, [hl]
call CopyMapObject_Radius
ld hl, MAPOBJECT_SCRIPT_POINTER + 1
ld hl, MAPOBJECT_SIGHT_RANGE
add hl, bc
ld a, [hl]
ld hl, OBJECT_21
ld hl, OBJECT_SIGHT_RANGE
add hl, de
ld [hl], a
and a

View File

@ -2,8 +2,7 @@ INCLUDE "constants.asm"
SECTION "engine/overworld/player_step.asm", ROMX
; TODO: How does this differ from _HandlePlayerStep, aside from where it's called from?
_HandlePlayerStep_Limited:
_HandlePlayerStep:
ld a, [wPlayerStepFlags]
and a
ret z
@ -28,11 +27,11 @@ _HandlePlayerStep_Limited:
ldh a, [hOverworldFlashlightEffect]
and a
jr nz, .update_overworld_map
call UpdateOverworldMap_Old
call UpdateOverworldMap
jr HandlePlayerStep_Finish
.update_overworld_map
call UpdateOverworldMap
call UpdateOverworldMap_Flashlight
jr HandlePlayerStep_Finish
.update_player_coords
@ -172,7 +171,7 @@ HandlePlayerStep::
.Jumptable:
dw RefreshTiles
dw Functionc9c1
dw CheckTrainerBattle
dw BufferScreen
dw .fail
dw .fail
@ -186,11 +185,11 @@ HandlePlayerStep::
.fail
ret
Functionc9c1:
callfar _Functionc9c1
CheckTrainerBattle:
callfar _CheckTrainerBattle
ret
UpdateOverworldMap_Old:
UpdateOverworldMap:
ld a, [wPlayerStepDirection]
and a ; DOWN
jr z, .step_down
@ -348,7 +347,8 @@ ScrollOverworldMapRight:
inc [hl]
ret
_HandlePlayerStep:
; Duplicate of _HandlePlayerStep that only gets run when wMapStatus is 10
_HandlePlayerStep_Unused::
ld a, [wPlayerStepFlags]
and a
ret z
@ -363,14 +363,14 @@ _HandlePlayerStep:
.update_overworld_map
ld a, 4
ld [wHandlePlayerStep], a
call UpdateOverworldMap
call UpdateOverworldMap_Flashlight
jp HandlePlayerStep_Finish
.update_player_coords
call UpdatePlayerCoords
jp HandlePlayerStep_Finish
UpdateOverworldMap:
UpdateOverworldMap_Flashlight:
ld a, [wPlayerStepDirection]
and a
jr z, .step_down

View File

@ -18,7 +18,7 @@ AskName_Old:
call GetPokemonName
; Test for being in debug field mode that doesn't go anywhere... maybe the name screen was skipped in debug mode?
ld a, [wDebugFlags]
bit 1, a
bit DEBUG_FIELD_F, a
pop hl
push hl
ld hl, AskGiveNickname_Old

View File

@ -268,10 +268,6 @@ SECTION "gfx.asm@Bank C Tilesets Common", ROMX
CommonExteriorTilesGFX:
INCBIN "gfx/tilesets/common.2bpp"
SECTION "gfx.asm@PokeBalls GFX", ROMX
PokeBallsGFX:: INCBIN "gfx/misc/poke_balls.2bpp"
SECTION "gfx.asm@Pokedex GFX", ROMX
PokedexButtonsGFX::
INCBIN "gfx/pokedex/buttons.2bpp"

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 B

View File

@ -91,10 +91,10 @@ Init:
ldh [rWX], a
ld a, $ff
ldh [hLinkPlayerNumber], a
ld h, HIGH($9800)
ldh [hSerialConnectionStatus], a
ld h, HIGH(vBGMap0)
call BlankBGMap
ld h, HIGH($9C00)
ld h, HIGH(vBGMap1)
call BlankBGMap
ld a, LCDC_DEFAULT
ldh [rLCDC], a
@ -104,7 +104,7 @@ Init:
predef CheckSGB
ld a, $1F
ldh [rIE], a
ld a, HIGH($9C00)
ld a, HIGH(vBGMap1)
ldh [hBGMapAddress + 1], a
xor a
ldh [hBGMapAddress], a

View File

@ -26,14 +26,12 @@ RunMapScript::
pop hl
ret
; TODO: is this used?
WriteIntod637::
SetMapStatus::
push af
; TODO: figure out what variables are concerned here
ld a, [wd637]
ld [wd638], a
ld a, [wMapStatus]
ld [wLastMapStatus], a
pop af
ld [wd637], a
ld [wMapStatus], a
ret
ClearMapBuffer::
@ -68,7 +66,7 @@ SetUpMapBuffer::
ld de, wMapScriptNumberLocation
call GetMapScriptNumber ; Read map script from pointed location
call CopyWord ; Copy map script pointer
ld de, wUnknownMapPointer
ld de, wMapScriptPointerLocation
call CopyWord
.done
@ -770,7 +768,7 @@ CopyAndReadHeaders::
inc hl
inc hl
call ReadWarps
call ReadSigns
call ReadBGEvents
ret
GetMapConnections::
@ -841,13 +839,13 @@ ReadWarps::
ret
ReadSigns::
ReadBGEvents::
ld a, [hli]
ld [wCurrMapSignCount], a
ld [wCurMapBGEventCount], a
and a
ret z
ld c, a
ld de, wCurrMapSigns
ld de, wCurrMapBGEvents
.next
ld b, 4
.copy
@ -955,7 +953,8 @@ InitObjectMasks::
ld bc, NUM_OBJECTS - 2
ld a, $ff
call ByteFill
ld hl, wUnknownMapPointer
ld hl, wMapScriptPointerLocation
ld e, [hl]
inc hl
ld d, [hl]
@ -1540,19 +1539,19 @@ FillEastConnectionStrip::
jr nz, .loop
ret
Function2a85::
.asm_2a85:
OverworldLoop::
.loop
call LoadMap
call Function2a8d
jr .asm_2a85
call _OverworldLoop
jr .loop
Function2a8d::
_OverworldLoop::
push hl
push de
push bc
push af
ld a, [wd637]
ld a, [wMapStatus]
and $f
add a
ld e, a
@ -1579,22 +1578,29 @@ Function2a8d::
pop hl
ret
.Pointers:
dbbw $00, $55, Function2ae5
dbbw $00, $55, Function2b52
dbbw $00, $55, Function2b77
dbbw $0e, $33, Function3904
dbbw $00, $55, Function2b39
dbbw $0e, $33, Function391f
dbbw $00, $33, Function2b78
dbbw $00, $33, Function2b78
dbbw $0e, $33, Function3904
dbbw $00, $55, Function2b79
dbbw $00, $55, Function2b87
dbbw $0e, $33, Function3920
dbbw $05, $33, Function14777
; TODO: Maybe make these a macro?
; Byte 1: Bank
; Byte 2: Unused?
; Bytes 3-4: Pointer to function
Function2ae5::
; Battle-related functions are run in bank $0e, even though they're in bank $f now.
; This doesn't change anything in practice because we still call a predef to go to that bank.
.Pointers:
dbbw $00, $55, OverworldLoop_Main
dbbw $00, $55, OverworldLoop_EventRunning
dbbw $00, $55, OverworldLoop_02
dbbw $0e, $33, OverworldLoop_StartBattle
dbbw $00, $55, OverworldLoop_ReturnToMain
dbbw $0e, $33, OverworldLoop_05
dbbw $00, $33, OverworldLoop_06
dbbw $00, $33, OverworldLoop_07
dbbw $0e, $33, OverworldLoop_StartBattle
dbbw $00, $55, OverworldLoop_DebugMapViewer
dbbw $00, $55, OverworldLoop_Unused
dbbw $0e, $33, OverworldLoop_ExitBattle
dbbw BANK(OverworldLoop_ReturnFromBattle), $33, OverworldLoop_ReturnFromBattle
OverworldLoop_Main::
.loop:
ld hl, wJoypadFlags
set 4, [hl]
@ -1605,96 +1611,109 @@ Function2ae5::
res 4, [hl]
res 6, [hl]
call GetJoypad
call Function2be5
ld hl, wc5ed
bit 7, [hl]
res 7, [hl]
call RunMapTextSubroutine
ld hl, wOverworldFlags
bit OVERWORLD_PAUSE_MAP_PROCESSES_F, [hl]
res OVERWORLD_PAUSE_MAP_PROCESSES_F, [hl]
ret nz
call TestWildBattleStart
ret nz
call OverworldStartButtonCheck
ret nz
callfar OverworldMovementCheck
ldh a, [hMapEntryMethod]
and a
ret nz
call Function2c4a
call HandleMapObjects
jr nc, .loop
farcall CheckObjectEnteringVisibleRange
ld a, [wc5ed]
bit 6, a
ld a, [wOverworldFlags]
bit OVERWORLD_DISABLE_MAP_CONNECTIONS_F, a
jr nz, .loop
call CheckMovingOffEdgeOfMap
ret c
call WarpCheck
ret c
jr .loop
Function2b39::
OverworldLoop_ReturnToMain::
ld hl, wJoypadFlags
res 4, [hl]
res 6, [hl]
ld hl, wDebugFlags
res 6, [hl]
res 7, [hl]
res UNK_DEBUG_FLAG_6_F, [hl]
res SKIP_MAP_SCRIPT_F, [hl]
ld hl, wStateFlags
res SCRIPTED_MOVEMENT_STATE_F, [hl]
ld a, $0
call WriteIntod637
ld a, MAPSTATUS_MAIN
call SetMapStatus
ret
Function2b52::
.asm_2b52:
OverworldLoop_EventRunning::
.loop
call UpdateTime
ld a, [wStateFlags]
bit SCRIPTED_MOVEMENT_STATE_F, a
jr z, Function2b39
jr z, OverworldLoop_ReturnToMain
ldh a, [hMapEntryMethod]
and a
ret nz
call Function2c4a
jr nc, .asm_2b52
call HandleMapObjects
jr nc, .loop
farcall CheckObjectEnteringVisibleRange
call CheckMovingOffEdgeOfMap
ret c
call WarpCheck
ret c
jr .asm_2b52
jr .loop
Function2b77::
OverworldLoop_02::
ret
Function2b78::
OverworldLoop_06::
OverworldLoop_07::
ret
Function2b79::
OverworldLoop_DebugMapViewer::
callfar DebugMapViewer
ld a, $4
call WriteIntod637
ld a, MAPSTATUS_RETURN_TO_MAIN
call SetMapStatus
ret
Function2b87::
.asm_2b87:
; A pared-down version of the standard overworld loop.
; TODO: Figure out how this actually works.
OverworldLoop_Unused::
.loop
call UpdateTime
call GetJoypad
call OverworldStartButtonCheck
ret nz
callfar OverworldMovementCheck
call Function2ba8
jr nc, .asm_2b87
call .HandleMapObjects
jr nc, .loop
farcall CheckObjectEnteringVisibleRange
jr .asm_2b87
jr .loop
Function2ba8::
.HandleMapObjects:
.loop2
ldh a, [hROMBank]
push af
ld a, BANK(HandleNPCStep)
call Bankswitch
call HandleNPCStep
call LoadMinorObjectGFX
ld a, BANK(_HandlePlayerStep)
ld a, BANK(_HandlePlayerStep_Unused)
call Bankswitch
call _HandlePlayerStep
call _HandlePlayerStep_Unused
ld a, BANK(InitSprites)
call Bankswitch
call InitSprites
@ -1710,13 +1729,13 @@ Function2ba8::
bit PLAYERSTEP_CONTINUE_F, a
ret z
bit PLAYERSTEP_STOP_F, a
jr z, Function2ba8
jr z, .loop2
scf
ret
Function2be5:: ; TODO
RunMapTextSubroutine::
ld a, [wDebugFlags]
bit 7, a
bit SKIP_MAP_SCRIPT_F, a
ret nz
ld a, [wMapGroup]
ld b, a

View File

@ -37,11 +37,10 @@ CheckStartmenuSelectHook:
dec a
ret
Function2c4a:
; copy of Function2ba8
; calling _HandlePlayerStep_Limited instead of _HandlePlayerStep
; Runs the code for all map objects that move, and stays in a loop as long as the player is moving.
HandleMapObjects::
.loop
call Function2c5a
call .HandleMapObjects
and a
ld a, [wPlayerStepFlags]
bit PLAYERSTEP_CONTINUE_F, a
@ -51,16 +50,16 @@ Function2c4a:
scf
ret
Function2c5a:
.HandleMapObjects:
ldh a, [hROMBank]
push af
ld a, BANK(HandleNPCStep)
call Bankswitch
call HandleNPCStep
call LoadMinorObjectGFX
ld a, BANK(_HandlePlayerStep_Limited)
ld a, BANK(_HandlePlayerStep)
call Bankswitch
call _HandlePlayerStep_Limited
call _HandlePlayerStep
ld a, BANK(InitSprites)
call Bankswitch
call InitSprites
@ -77,7 +76,7 @@ UpdateAndTransferToolgear:
call DelayFrame
call UpdateToolgear
ld hl, wToolgearFlags
set 2, [hl] ; ; transfer toolgear to window
set 2, [hl] ; transfer toolgear to window
call DelayFrame
ret

View File

@ -2,49 +2,59 @@ INCLUDE "constants.asm"
SECTION "home/serial.asm", ROM0
; The serial interrupt.
Serial::
push af
push bc
push de
push hl
ldh a, [hLinkPlayerNumber]
ldh a, [hSerialConnectionStatus]
inc a
jr z, .init_player_number
jr z, .establish_connection
ldh a, [rSB]
ldh [hSerialReceive], a
ldh a, [hSerialSend]
ldh [rSB], a
ldh a, [hLinkPlayerNumber]
ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr z, .done
jr z, .player2
ld a, 1 << rSC_ON
ldh [rSC], a
jr .done
jr .player2
.init_player_number
.establish_connection
ldh a, [rSB]
ldh [hSerialReceive], a
ldh [hLinkPlayerNumber], a
ldh [hSerialConnectionStatus], a
cp USING_INTERNAL_CLOCK
jr z, .master
jr z, ._player2
xor a
ldh [rSB], a
ld a, 3
ldh [rDIV], a
.wait
.delay_loop
ldh a, [rDIV]
bit 7, a
jr nz, .wait
jr nz, .delay_loop ; wait until rDIV has incremented from 3 to $80 or more
ld a, 1 << rSC_ON
ldh [rSC], a
jr .done
.master
jr .player2
._player2
xor a
ldh [rSB], a
.done
.player2
ld a, TRUE
ldh [hSerialReceived], a
ldh [hSerialReceivedNewData], a
ld a, SERIAL_NO_DATA_BYTE
ldh [hSerialSend], a
pop hl
@ -53,8 +63,9 @@ Serial::
pop af
reti
; Send bc bytes from hl, receive bc bytes to de.
Serial_ExchangeBytes::
ld a, $1
ld a, TRUE
ldh [hSerialIgnoringInitialData], a
.loop
ld a, [hl]
@ -63,10 +74,12 @@ Serial_ExchangeBytes::
push bc
ld b, a
inc hl
ld a, $30
ld a, 48
.wait
dec a
jr nz, .wait
ldh a, [hSerialIgnoringInitialData]
and a
ld a, b
@ -75,7 +88,7 @@ Serial_ExchangeBytes::
dec hl
cp SERIAL_PREAMBLE_BYTE
jr nz, .loop
xor a
xor a ; FALSE
ldh [hSerialIgnoringInitialData], a
jr .loop
@ -89,25 +102,25 @@ Serial_ExchangeBytes::
ret
Serial_ExchangeByte::
.loop
.timeout_loop
xor a
ldh [hSerialReceived], a
ldh a, [hLinkPlayerNumber]
ldh [hSerialReceivedNewData], a
ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr nz, .not_player_2
ld a, (1 << rSC_ON) | 1
ldh [rSC], a
.not_player_2
.loop2
ldh a, [hSerialReceived]
.loop
ldh a, [hSerialReceivedNewData]
and a
jr nz, .reset_ffca
ldh a, [hLinkPlayerNumber]
cp $1
jr nz, .not_player_1_or_wLinkTimeoutFrames_zero
jr nz, .await_new_data
ldh a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
jr nz, .not_player_1_or_timed_out
call CheckwLinkTimeoutFramesNonzero
jr z, .not_player_1_or_wLinkTimeoutFrames_zero
call .delay_15_cycles
jr z, .not_player_1_or_timed_out
call .ShortDelay
push hl
ld hl, wLinkTimeoutFrames + 1
inc [hl]
@ -118,50 +131,51 @@ Serial_ExchangeByte::
.no_rollover_up
pop hl
call CheckwLinkTimeoutFramesNonzero
jr nz, .loop2
jr nz, .loop
jp SerialDisconnected
.not_player_1_or_wLinkTimeoutFrames_zero
.not_player_1_or_timed_out
ldh a, [rIE]
and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
cp 1 << SERIAL
jr nz, .loop2
ld a, [wcb58]
jr nz, .loop
ld a, [wLinkByteTimeout]
dec a
ld [wcb58], a
jr nz, .loop2
ld a, [wcb58 + 1]
ld [wLinkByteTimeout], a
jr nz, .loop
ld a, [wLinkByteTimeout + 1]
dec a
ld [wcb58 + 1], a
jr nz, .loop2
ldh a, [hLinkPlayerNumber]
ld [wLinkByteTimeout + 1], a
jr nz, .loop
ldh a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
jr z, .reset_ffca
jr z, .await_new_data
ld a, 255
.delay_255_cycles
.long_delay_loop
dec a
jr nz, .delay_255_cycles
jr nz, .long_delay_loop
.reset_ffca
.await_new_data
xor a
ldh [hSerialReceived], a
ldh [hSerialReceivedNewData], a
ldh a, [rIE]
and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
sub 1 << SERIAL
jr nz, .rIE_not_equal_8
jr nz, .non_serial_interrupts_enabled
; LOW($5000)
ld [wcb58], a
ld a, HIGH($5000)
ld [wcb58 + 1], a
assert LOW(SERIAL_LINK_BYTE_TIMEOUT) == 0
; LOW(SERIAL_LINK_BYTE_TIMEOUT)
ld [wLinkByteTimeout], a
ld a, HIGH(SERIAL_LINK_BYTE_TIMEOUT)
ld [wLinkByteTimeout + 1], a
.rIE_not_equal_8
.non_serial_interrupts_enabled
ldh a, [hSerialReceive]
cp SERIAL_NO_DATA_BYTE
ret nz
call CheckwLinkTimeoutFramesNonzero
jr z, .linkTimeoutFrames_zero
jr z, .timed_out
push hl
ld hl, wLinkTimeoutFrames + 1
ld a, [hl]
@ -176,7 +190,7 @@ Serial_ExchangeByte::
call CheckwLinkTimeoutFramesNonzero
jr z, SerialDisconnected
.linkTimeoutFrames_zero
.timed_out
ldh a, [rIE]
and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
cp 1 << SERIAL
@ -185,16 +199,16 @@ Serial_ExchangeByte::
ld a, [hl]
ldh [hSerialSend], a
call DelayFrame
jp .loop
jp .timeout_loop
.delay_15_cycles:
.ShortDelay:
ld a, 15
.delay_cycles
dec a
jr nz, .delay_cycles
ret
CheckwLinkTimeoutFramesNonzero:
CheckwLinkTimeoutFramesNonzero::
push hl
ld hl, wLinkTimeoutFrames
ld a, [hli]
@ -202,7 +216,9 @@ CheckwLinkTimeoutFramesNonzero:
pop hl
ret
SerialDisconnected:
; This sets wLinkTimeoutFrames to $ffff, since
; a is always 0 when it is called.
SerialDisconnected::
dec a
ld [wLinkTimeoutFrames], a
ld [wLinkTimeoutFrames + 1], a
@ -211,12 +227,12 @@ SerialDisconnected:
; This is used to exchange the button press and selected menu item on the link menu.
; The data is sent thrice and read twice to increase reliability.
Serial_ExchangeLinkMenuSelection::
ld hl, wPlayerLinkAction
ld de, wOtherPlayerLinkMode
ld hl, wLinkPlayerSyncBuffer
ld de, wLinkReceivedSyncBuffer
ld c, 2
ld a, TRUE
ldh [hSerialIgnoringInitialData], a
.asm_0730
.exchange
call DelayFrame
ld a, [hl]
ldh [hSerialSend], a
@ -227,12 +243,12 @@ Serial_ExchangeLinkMenuSelection::
and a
ld a, FALSE
ldh [hSerialIgnoringInitialData], a
jr nz, .asm_0730
jr nz, .exchange
ld a, b
ld [de], a
inc de
dec c
jr nz, .asm_0730
jr nz, .exchange
ret
Serial_PrintWaitingTextAndSyncAndExchangeNybble::
@ -288,18 +304,18 @@ WaitLinkTransfer::
LinkTransfer::
push bc
ld b, $60
ld b, SERIAL_TRADECENTER
ld a, [wLinkMode]
cp $2
jr c, .asm_07ac
ld b, $70
cp LINK_TRADECENTER
jr c, .got_high_nybble
ld b, SERIAL_BATTLE
.asm_07ac
.got_high_nybble
call .Receive
ld a, [wPlayerLinkAction]
add b
ldh [hSerialSend], a
ldh a, [hLinkPlayerNumber]
ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr nz, .player_1
ld a, (1 << rSC_ON) | 1
@ -327,14 +343,15 @@ LinkDataReceived::
; Let the other system know that the data has been received.
xor a
ldh [hSerialSend], a
ldh a, [hLinkPlayerNumber]
ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
ret nz
ld a, (1 << rSC_ON) | 1
ldh [rSC], a
ret
Unreferenced_Function7e6::
; Unreferenced in the final game, but used here.
SetBitsForTimeCapsuleRequestIfNotLinked::
ld a, [wLinkMode]
and a
ret nz

View File

@ -37,7 +37,7 @@ CallMapTextSubroutine::
ret
Function3055::
ldh a, [hFFEA]
ldh a, [hLastTalked]
ld b, a
.Loop:
ld a, [hli]
@ -81,7 +81,7 @@ PrintTextboxDebugNumbers::
ld a, [wTalkingTargetType]
bit 0, a
jr z, .CheckSign
ld de, hFFEA
ld de, hLastTalked
jr .PrintNum
.CheckSign:
@ -107,7 +107,7 @@ QueueMapTextSubroutine::
bit A_BUTTON_F, a
jp z, xor_a ; if we didn't press a
call GetFacingPersonText
jp nc, Function30e8 ; if not talking to a person
jp nc, .CheckBGEvent ; if not talking to a person
ld d, $0
ld e, a
ld a, [wDebugFlags]
@ -130,8 +130,8 @@ QueueMapTextSubroutine::
call xor_a_dec_a
ret
Function30e8::
call GetFacingSignpost
.CheckBGEvent:
call CheckFacingBGEvent
jp nc, xor_a ; if not facing person or sign
ld a, e
ldh [hFFEB], a
@ -247,7 +247,7 @@ TurnNPCTalkingTo::
add hl, bc
ld a, [hl]
sub 02
ldh [hFFEA], a
ldh [hLastTalked], a
ret
Function31C3::
@ -261,7 +261,7 @@ CheckInlineTrainer::
call GetObjectStruct
call GetInlineMapObject
jr nc, .Escape
ld hl, MAPOBJECT_SCRIPT_POINTER + 1
ld hl, MAPOBJECT_SIGHT_RANGE
add hl, de
ld a, [hl]
cp b

View File

@ -354,43 +354,48 @@ GetBlockLocation::
add hl, bc
ret
GetFacingSignpost::
CheckFacingBGEvent::
call GetFacingTileCoord
; Load facing into b.
ld b, a
GetSignpost::
; Convert the coordinates at de to within-boundaries coordinates.
GetBGEvent::
ld a, d
sub $4
sub 4
ld d, a
ld a, e
sub $4
sub 4
ld e, a
ld a, [wCurrMapSignCount]
; If there are no BG events, we don't need to be here.
ld a, [wCurMapBGEventCount]
and a
ret z
; Checks to see if you are facing a BG event. If so, sets carry.
ld c, a
ld hl, wCurrMapSigns
.asm_2f32:
ld hl, wCurrMapBGEvents
.loop
ld a, [hli]
cp e
jr nz, .asm_2f3e
jr nz, .y_next
ld a, [hli]
cp d
jr nz, .asm_2f3f
jr nz, .x_next
ld a, [hli]
cp b ; useless comparison
jr .asm_2f46
jr .set_carry
.asm_2f3e:
.y_next
inc hl
.asm_2f3f:
.x_next
inc hl
inc hl
dec c
jr nz, .asm_2f32
jr nz, .loop
xor a
ret
.asm_2f46:
.set_carry
scf
ret

View File

@ -17,10 +17,12 @@ endr
SECTION "home/unknown.asm@Unknown functions", ROM0
_1FF4::
ld a, BANK(s0_a600)
; Init the options with values of $00 because EmptyAllSRAMBanks sets them to $FF, and that's no good!
; Final game gets around this by filling the entirety of SRAM banks with $00, which this demo probably should've done.
InitOptions::
ld a, BANK(sOptions)
call OpenSRAM
ld hl, s0_a600 ; TODO: label this.
ld hl, sOptions ; TODO: label this.
ld bc, 7
xor a
call ByteFill

View File

@ -2,46 +2,46 @@ INCLUDE "constants.asm"
SECTION "home/unknown_388f.asm", ROM0
Function388f::
EmptyFunction388f::
ret
Function3890::
farcall Function14cac
Unreferenced_PokemonNewsScript::
farcall _Unreferenced_PokemonNewsScript
ret
Function3899::
farcall Function14dac
PokemonBooksScript::
farcall _PokemonBooksScript
ret
Function38a2::
farcall Function14dc4
PlayerHouse1FFridgeScript::
farcall _PlayerHouse1FFridgeScript
ret
Function38ab::
farcall Function14ddd
SilentHillHouseStoveScript::
farcall _SilentHillHouseStoveScript
ret
Function38b4::
farcall Function14e00
SilentHillHouseSinkScript::
farcall _SilentHillHouseSinkScript
ret
Function38bd::
farcall Function14e5f
SilentHillHouseTVScript::
farcall _SilentHillHouseTVScript
ret
Function38c6::
farcall Function14e27
PokecenterSignScript::
farcall _PokecenterSignScript
ret
Function38cf::
farcall Function14e4a
RivalHouseWindowScript::
farcall _RivalHouseWindowScript
ret
Function38d8::
ld hl, wc5ed
InitTrainerBattle::
ld hl, wOverworldFlags
set 7, [hl]
ld a, $8
ld [wd637], a
ld a, MAPSTATUS_START_TRAINER_BATTLE
ld [wMapStatus], a
ret
TestWildBattleStart::
@ -54,12 +54,12 @@ TestWildBattleStart::
ld a, [wBattleMode]
and a
ret z ; if no battle, return
ld a, $3
call WriteIntod637
ld a, MAPSTATUS_START_WILD_BATTLE
call SetMapStatus
call xor_a_dec_a
ret
Function3904::
OverworldLoop_StartBattle::
predef Function3ef19
ld a, $f3
ldh [hMapEntryMethod], a
@ -68,22 +68,22 @@ Function3904::
ld hl, wJoypadFlags
set 4, [hl]
set 6, [hl]
ld a, $b
call WriteIntod637
ld a, MAPSTATUS_EXIT_BATTLE
call SetMapStatus
ret
Function391f::
OverworldLoop_05::
ret
Function3920::
ld a, [wcd5d]
cp $1
jr z, .asm_392d
ld a, $4
call WriteIntod637
OverworldLoop_ExitBattle::
ld a, [wBattleResult]
cp LOSE
jr z, .DemoGameOver
ld a, MAPSTATUS_RETURN_TO_MAIN
call SetMapStatus
ret
.asm_392d:
.DemoGameOver:
ld hl, wJoypadFlags
res 4, [hl]
ld hl, .text

View File

@ -146,7 +146,7 @@ ROMX $03
"engine/overworld/spawn_points.asm"
"data/maps/spawn_points.asm"
"data/tileset_headers.asm"
"engine/dumps/bank03.asm@Functionc9c1"
"engine/dumps/bank03.asm@CheckTrainerBattle"
"engine/items/inventory.asm@Inventory"
"engine/smallflag.asm"
"engine/pokemon/health.asm@HealParty"
@ -188,8 +188,9 @@ ROMX $05
"engine/sprites/sprites.asm@RefreshSprites"
"data/maps/sprite_sets.asm"
"data/overworld_sprites.asm"
org $477d
"engine/menu/empty_sram.asm"
"engine/events/pokecenter_pc.asm"
"engine/dumps/bank05.asm"
ROMX $06
org $4000
@ -270,12 +271,10 @@ ROMX $0d
ROMX $0e
org $4000
org $4391
"engine/dumps/bank0e.asm"
org $4494
"gfx.asm@PokeBalls GFX"
org $4d90
"data/trainers/class_names.asm"
"engine/dumps/bank0e.asm@ReadTrainerParty"
org $5110
"data/trainers/parties.asm@Trainer Parties"
@ -390,6 +389,8 @@ ROMX $23
"engine/dumps/bank23.asm@RestoreOverworldMapTiles"
org $44be
"engine/battle/battle_transitions.asm"
org $4940
"engine/dumps/bank23.asm@EnterMapAnim_Old"
org $4cfd
"engine/dumps/bank23.asm@ClearSpriteAnims"
org $60cc
@ -1010,7 +1011,12 @@ SRAM 0
org $b800
"SRAM Window Stack"
SRAM 1
"Save Pokemon Data"
SRAM $02
"Boxes 1-5"
SRAM $03
"Boxes 6-10"
org $bffd
"Checksum"

View File

@ -95,6 +95,10 @@ MACRO? dd ; four-byte (big-endian)
dx 4, \1
ENDM
MACRO? littledt ; three-byte (little-endian)
db low(\1), high(\1), low((\1) >> 16)
ENDM
MACRO? bigdw ; big-endian word
dx 2, \1
ENDM

View File

@ -136,8 +136,6 @@ ENDM
MACRO channel_struct
; TODO: CH1 isn't at C101, please rebase all of these
; Addreses are Channel1 (c101).
\1MusicID:: dw
\1MusicBank:: db
\1Flags1:: db ; 0:on/off 1:subroutine 3:sfx 4:noise 5:rest
@ -160,7 +158,7 @@ MACRO channel_struct
\1LoopCount:: db
\1Tempo:: dw
\1Tracks:: db ; hi:left lo:right
\1SFXDutyLoop:: ds 1
\1SFXDutyLoop:: ds 1
\1VibratoDelayCount:: db ; initialized by \1VibratoDelay
\1VibratoDelay:: db ; number of frames a note plays until vibrato starts
\1VibratoExtent:: db
@ -313,11 +311,10 @@ MACRO map_object
\1ObjectRadius:: db
\1ObjectHour:: db
\1ObjectTimeOfDay:: db
\1ObjectPalette:: db ; ...Questionable. Needs investigation
\1ObjectSightRange:: db
\1ObjectScript:: dw
\1ObjectEventFlag:: dw
\1ObjectType:: db
ds 2
\1ObjectSightRange:: db
ds 4
ENDM
MACRO minor_object

View File

@ -3,7 +3,7 @@ SECTION "HRAM", HRAM
hOAMDMA::
ds 10
ds 3 ; TODO
hChecksum:: ds 3
hRTCHours:: db
hRTCMinutes:: db
@ -62,9 +62,9 @@ hJoypadState2:: db
UNION
hFFA7:: db
hFFA8:: db
hFFA9:: db
hSeenTrainerDistance:: db
hSeenTrainerDirection:: db
hSeenTrainerObject:: db
NEXTU
@ -113,6 +113,10 @@ NEXTU
hPokedexTempWeight:: dw
NEXTU
hTempCurBox:: db
ENDU
UNION
@ -188,20 +192,11 @@ hLYOverrideEnd:: db
ds 1 ; TODO
hSerialReceived::
db
hLinkPlayerNumber::
db
hSerialIgnoringInitialData::
db
hSerialSend::
db
hSerialReceive::
db
hSerialReceivedNewData:: db
hSerialConnectionStatus:: db
hSerialIgnoringInitialData:: db
hSerialSend:: db
hSerialReceive:: db
hSCX:: db
@ -267,7 +262,7 @@ hMapAnims::
hTileAnimFrame::
db
hFFEA::
hLastTalked::
db
hFFEB:: db

View File

@ -12,12 +12,19 @@ ENDU
SECTION "Unknown, bank 0", SRAM
UNION
sOptions:: ds 4
NEXTU
s0_a600:: ds 7 ; TODO: properly label this and figure out exact size
ENDU
sOptions:: ds 7
ds 1
; TODO: Replace the big ds blocks with proper RAM ranges when rgbds stops throwing errors.
sGameData:: ds $7d2 ; wGameDataEnd - wGameData
sGameDataEnd::
sGameData2:: ds $71 ; wGameData2End - wGameData2
sGameData2End::
SECTION "Save Pokemon Data", SRAM
sPokemonData:: ds $3d9 ; wPokemonDataEnd - wPokemonData
SECTION "SRAM Window Stack", SRAM
@ -49,3 +56,6 @@ SECTION "Boxes 6-10", SRAM
; All 10 boxes fit exactly within 2 SRAM banks
assert box_n == NUM_BOXES, \
"boxes: Expected {d:NUM_BOXES} total boxes, got {d:box_n}"
SECTION "Checksum", SRAM
sChecksum:: ds 3

View File

@ -297,9 +297,10 @@ SECTION "Map Buffer", WRAM0
wMapBuffer::
wMapScriptNumber:: db
wMapScriptNumberLocation:: dw
wUnknownMapPointer:: dw ; TODO
wMapScriptPointerLocation:: dw ; TODO
; setting bit 7 seems to disable overworld updates and player control?
wc5ed:: db
; setting bit 6 disables map connections
wOverworldFlags:: db
ds 18
wMapBufferEnd::
@ -458,6 +459,7 @@ wBattleAnimTempXOffset:: db
wBattleAnimTempYOffset:: db
wBattleAnimTempFrameOAMFlags:: db
wBattleAnimTempPalette:: db
wBattleAnimEnd::
NEXTU
wBattleAnimGFXTempTileID::
@ -466,8 +468,8 @@ wBattlePicResizeTempPointer:: dw
ENDU
ds $32
wBattleAnimEnd::
ds 50
wActualBattleAnimEnd::
ds $1a3 ; TODO
@ -479,8 +481,11 @@ wEnemyMonNickname:: ds 6
wBattleMonNickname:: ds 6
UNION
; battle mon
wBattleMon:: battle_struct wBattleMon
NEXTU
; intro water/grass/fire cutscene data
ds 14
wIntroJumptableIndex:: db
wIntroBGMapPointer:: ds 2
@ -490,12 +495,13 @@ wIntroFrameCounter1:: ds 1
wIntroFrameCounter2:: ds 1
wIntroSpriteStateFlag:: ds 1
ENDU
wca22:: ds 1
wca23:: ds 1
wca24:: ds 1
ds 6
wca2b:: ds 1
ds 10
wTrainerClass:: db
wEnemyTrainerGraphicsPointer:: dw
ds 2
wEnemyTrainerBaseReward:: db
ds 3
wOTClassName:: ds TRAINER_CLASS_NAME_LENGTH
wCurOTMon:: db
wBattleParticipantsNotFainted::
@ -619,7 +625,9 @@ wEnemyEvaLevel:: db
ds 1
wForceEvolution:: db
wcaba:: ds 1
wAILayer2Encouragement::
wEnemyTurnsTaken:: ds 1
ds 1
@ -631,6 +639,8 @@ wPlayerDebugSelectedMove:: ds 1
wMoveSelectionMenuType:: ds 1
; TODO: Replace these with just wCurPlayer/EnemyMove
; and replace the original wCurPlayerMove/wCurEnemyMove with wLastPlayer/EnemyCounterMove
wCurPlayerSelectedMove:: db
wCurEnemySelectedMove:: db
@ -718,15 +728,20 @@ wRedrawFlashlightWidthHeight:: db
ENDU
SECTION "CB56", WRAM0[$CB4C]
UNION
wOtherPlayerLinkMode:: db
wOtherPlayerLinkAction:: db
ds 3 ; TODO
wPlayerLinkAction:: db
ds 4 ; TODO
NEXTU
wLinkReceivedSyncBuffer:: ds 5
wLinkPlayerSyncBuffer:: ds 5
ENDU
wLinkTimeoutFrames:: dw
wcb58:: ds 2
wLinkByteTimeout:: dw
wMonType:: db
wSelectedItem::
@ -1113,9 +1128,12 @@ wBattlePlayerAction:: db
wStateFlags:: db
ds 3 ; TODO
wcd5d:: db
db
ds 3
wBattleResult:: db
ds 1
wChosenStarter:: db
wcd60:: db
@ -1228,7 +1246,7 @@ wcdc6:: db
wcdc7:: db
wcdc8:: db
ds 1
wcdca:: db
wEnemyItemUsed:: db
NEXTU
; battle HUD
@ -1239,6 +1257,10 @@ NEXTU
wFinalCatchRate:: db
wThrownBallWobbleCount:: db
NEXTU
; move AI
wEnemyAIMoveScores:: ds NUM_MOVES
NEXTU
; evolution data
wEvolutionOldSpecies:: db
@ -1265,7 +1287,7 @@ wOtherTrainerClass:: ds 1
wBattleType:: db
wce04:: ds 1
wOtherTrainerID:: ds 1
wBattleResult:: ds 1
wBattleEnded:: ds 1
wMonHeader::
@ -1402,9 +1424,11 @@ wOptions::
; bit 7: battle scene off/on
db
; A buffer for sOptions that is used to check if a save file exists.
; Only checks the bottom bit, for whatever reason.
wSaveFileExists:: db
; Used as a buffer for sOptions to check if a save file exists.
; Only checks the bottom bit (since all valid text speeds have that bit set).
wSaveFileExists::
wSaveFileFlags:: db
wActiveFrame:: db
@ -1421,19 +1445,14 @@ wce64:: ds 1
wce65:: ds 1
wce66:: ds 1
wGameData::
wPlayerName:: ds 6
wMomsName:: ds 6
SECTION "CE73", WRAM0[$CE73]
UNION
wPlayerID:: dw
NEXTU
wce73: ds 1
wce74: ds 1
ENDU
wce75: ds 1
ds 1
wObjectFollow_Leader::
db
@ -1502,21 +1521,12 @@ wTimeOfDayPalset:: db
wCurTimeOfDay:: db
SECTION "D15B", WRAM0[$D15B]
wCoins:: db
wd15c:: db
ds 1
wCoins:: dw
wMoney:: ds 3
;wd15d:: db
;wd15e:: db
;wd15f:: db
SECTION "D163", WRAM0[$D163]
ds 3
wBadges::
wJohtoBadges::
@ -1528,23 +1538,19 @@ wTMsHMs:: ds NUM_TM_HM
wItems::
wNumBagItems:: db
SECTION "D1C8", WRAM0[$D1C8]
wBagItems:: ds MAX_ITEMS * 2 + 1
wNumKeyItems:: db
wKeyItems:: db
SECTION "D1DE", WRAM0[$D1DE]
wKeyItems:: ds MAX_KEY_ITEMS + 1
wNumBallItems:: db
wBallQuantities:: db
wBallQuantities:: ds MAX_BALLS + 1
ds 10
wNumPCItems:: db
wPCItems:: ds MAX_PC_ITEMS * 2 + 1
wUnknownListLengthd1ea:: db
wUnknownListd1eb:: db
ds 6
SECTION "Rival's Name", WRAM0[$D256]
wRegisteredItem:: db
wRegisteredItemQuantity:: db
wRivalName:: ds 6
@ -1561,18 +1567,26 @@ wd266:: db
;The starting house's map script number is stored at d29a. Others are probably nearby.
SECTION "D29A", WRAM0[$D29A]
wd29a:: db
wd29b:: db
wd29c:: db
wd29d:: db
wd29e:: db
db
wd2a0:: db
wPlayerHouse2FCurScript:: db
wPlayerHouse1FCurScript:: db
wSilentHillCurScript:: db
wSilentHillLabFrontCurScript:: db
wSilentHillLabBackCurScript:: db
wSilentHillPokecenterCurScript:: db
wSilentHillHouseCurScript:: db
wRoute1P1CurScript:: db
wRoute1P2CurScript:: db
wRoute1Gate1FCurScript:: db
wRoute1Gate2FCurScript:: db
wShizukanaOkaCurScript:: db
wd2a6:: db
SECTION "D35F", WRAM0[$D35F]
wd35f:: db
SECTION "D39D", WRAM0[$D39D]
SECTION "D39D", WRAM0[$D39A]
wd39a:: db
wd39b:: db
wd39c:: db
wd39d:: db
SECTION "D3A5", WRAM0[$D3A5]
@ -1612,6 +1626,8 @@ wJoypadFlags:: db
; ||\------ don't wait for keypress to close text box
; |\------- joypad sync mtx
; \-------- joypad disabled
ds 1
wMovementFlags_Old:: db
SECTION "wDigWarpNumber", WRAM0[$D4B2]
@ -1641,10 +1657,10 @@ REPT 32 ; TODO: confirm this
ENDR
wCurrMapSignCount::
wCurMapBGEventCount::
db
wCurrMapSigns::
wCurrMapBGEvents::
REPT 16 ; TODO: confirm this
ds 4
ENDR
@ -1653,15 +1669,21 @@ wCurrMapObjectCount::
db
wCurrMapInlineTrainers::
REPT 32 ; TODO: confirm this
REPT NUM_OBJECTS
ds 2 ; inline trainers. each pair of bytes is direction, distance
ENDR
ds 32
SECTION "D637", WRAM0[$D637]
wd637:: db ;OW battle state? $3 wild battle, $8 is trainer battle $4 is left battle, $B is load overworld? $0 is in overworld
wd638:: db ;wd637's last written-to value
wMapStatus:: db ;OW battle state? $3 wild battle, $8 is trainer battle $4 is left battle, $B is load overworld? $0 is in overworld
wLastMapStatus:: db ;wMapStatus's last written-to value
wGameDataEnd::
; Sort of redundant to separate data like this when they're right next to each other.
wGameData2::
ds 9
SECTION "Used sprites", WRAM0[$D642]
wUnusedAddOutdoorSpritesReturnValue:: db
wBGMapAnchor::
dw
@ -1743,6 +1765,8 @@ wTilesetAnim::
ds 2 ; TODO
wTilesetEnd::
wGameData2End::
wPokemonData::
wPartyCount:: db
wPartySpecies:: ds PARTY_LENGTH
@ -1804,10 +1828,11 @@ wBreedMon2:: box_struct wBreedMon2
; Uses the last two bits to keep track of your breeder mons' genders.
; Bit clear = male, bit set = female
wBreedMonGenders:: db
wd8fe:: ds 1
wOTPlayerName:: ds PLAYER_NAME_LENGTH
SECTION "D913", WRAM0[$D913]
wOTPartyData::
wOTPartyCount:: db
wOTPartySpecies:: ds PARTY_LENGTH
wOTPartySpeciesEnd:: db
@ -1838,6 +1863,8 @@ endr
wOTPartyDataEnd::
ENDU
wPokemonDataEnd::
wBox:: box wBox
SECTION "Stack Bottom", WRAM0

View File

@ -3,7 +3,7 @@ INCLUDE "constants.asm"
SECTION "scripts/OldCityPokecenter2F.asm", ROMX
OldCityPokecenter2F_ScriptLoader:
call Unreferenced_Function7e6
call SetBitsForTimeCapsuleRequestIfNotLinked
ld hl, OldCityPokecenter2FScriptPointers
call RunMapScript
call WriteBackMapScriptNumber

View File

@ -3,7 +3,7 @@ INCLUDE "constants.asm"
SECTION "scripts/OldCityPokecenterTimeMachine.asm", ROMX
OldCityPokecenterTimeMachine_ScriptLoader:
call Unreferenced_Function7e6
call SetBitsForTimeCapsuleRequestIfNotLinked
ld hl, OldCityPokecenterTimeMachineScriptPointers
call RunMapScript
call WriteBackMapScriptNumber

View File

@ -34,11 +34,11 @@ PlayerHouse1FScript2:
ret
PlayerHouse1FSignPointers:
dw Function38ab
dw Function38b4
dw Function38a2
dw Function38bd
dw Function3899
dw SilentHillHouseStoveScript
dw SilentHillHouseSinkScript
dw PlayerHouse1FFridgeScript
dw SilentHillHouseTVScript
dw PokemonBooksScript
PlayerHouse1F_TextPointers::
dw PlayerHouse1FNPCText1

View File

@ -28,10 +28,10 @@ PlayerHouse2FNPCIDs2:
db $FF
PlayerHouse2FSignPointers:
dw Function3899
dw PokemonBooksScript
dw PlayerHouse2FRadioText
dw PlayerHouse2FComputerText
dw Function3899
dw PokemonBooksScript
dw PlayerHouse2FN64Text
PlayerHouse2FScript1:
@ -66,15 +66,15 @@ PlayerHouse2PositionCheck:
PlayerHouse2FMovePlayer:
ld a, 0
ld hl, Movement
ld hl, .Movement
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
Movement:
.Movement:
step DOWN
slow_step DOWN
step_end

View File

@ -59,14 +59,14 @@ Route1P2Text2:
call OpenTextbox
ld hl, $D3A2
set 1, [hl]
ld a, $3C
ld a, TRAINER_KIMONO_GIRL
ld [wOtherTrainerClass], a
ld a, $02
ld a, KIMONO_GIRL_KOUME
ld [wOtherTrainerID], a
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, $08
ld [wd637], a
ld a, MAPSTATUS_START_TRAINER_BATTLE
ld [wMapStatus], a
ret
.Text2Jump

View File

@ -56,7 +56,7 @@ ShizukanaOkaTrainer2:
ld [wOtherTrainerClass], a
ld a, SCHOOLBOY_TETSUYA
ld [wOtherTrainerID], a
call Function38d8
call InitTrainerBattle
ret
.Trainer2Won ;Already won
ld hl, ShizukanaOkaTrainer2WonString
@ -75,7 +75,7 @@ ShizukanaOkaTrainer3:
ld [wOtherTrainerClass], a
ld a, BUG_CATCHER_BOY_JUNICHI
ld [wOtherTrainerID], a
call Function38d8
call InitTrainerBattle
ret
.Trainer3Won ;Already won
ld hl, ShizukanaOkaTrainer3WonString
@ -94,7 +94,7 @@ ShizukanaOkaTrainer4:
ld [wOtherTrainerClass], a
ld a, FIREBREATHER_AKITO
ld [wOtherTrainerID], a
call Function38d8
call InitTrainerBattle
ret
.Trainer4Won ;Already won
ld hl, ShizukanaOkaTrainer4WonString
@ -113,7 +113,7 @@ ShizukanaOkaTrainer5:
ld [wOtherTrainerClass], a
ld a, BEAUTY_MEGUMI
ld [wOtherTrainerID], a
call Function38d8
call InitTrainerBattle
ret
.Trainer5Won ;Already won
ld hl, ShizukanaOkaTrainer5WonString
@ -132,7 +132,7 @@ ShizukanaOkaTrainer6:
ld [wOtherTrainerClass], a
ld a, BUG_CATCHER_BOY_SOUSUKE
ld [wOtherTrainerID], a
call Function38d8
call InitTrainerBattle
ret
.Trainer6Won ;Already won
ld hl, ShizukanaOkaTrainer6WonString

View File

@ -67,12 +67,12 @@ SilentHillScript1:
ld a, 02
ld hl, SilentHillMovement1
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 1
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillMovement1:
@ -97,10 +97,10 @@ SilentHillScript2:
ld a, 2
ld hl, SilentHillMovement2
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ld a, 2
ld [wMapScriptNumber], a
ret
@ -150,10 +150,10 @@ SilentHillScript4:
.skip
ld a, 03
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ld a, 4
ld [wMapScriptNumber], a
ret
@ -168,7 +168,7 @@ Function776a:
ld hl, wd41a
set 7, [hl]
ld a, 1
ld hl, wd29d
ld hl, wSilentHillLabFrontCurScript
ld [hl], a
ret
@ -216,10 +216,10 @@ SilentHillScript5:
.skip
ld a, 3
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ld a, 5
ld [wMapScriptNumber], a
ret
@ -275,7 +275,7 @@ SilentHillScript6:
bit 2, [hl]
ret z
ld a, $12
ld [wd29d], a
ld [wSilentHillLabFrontCurScript], a
ld a, 6
ld [wMapScriptNumber], a
ret
@ -317,10 +317,10 @@ LabClosed:
ld a, 0
ld hl, SilentHillMovement7
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillTextString1:
@ -333,7 +333,7 @@ SilentHillMovement7:
SilentHillSignPointers::
dw SilentHillPlayerHouseText
dw Function38c6
dw PokecenterSignScript
dw SilentHillSignText1
dw SilentHillLabText
dw SilentHillRivalHouseText

View File

@ -45,11 +45,11 @@ SilentHillHouseNPCIDs2:
SilentHillHouseTextPointers2::
dw SilentHillHouseNPCText1
dw Function38bd
dw Function3899
dw Function38b4
dw Function38ab
dw Function38cf
dw SilentHillHouseTVScript
dw PokemonBooksScript
dw SilentHillHouseSinkScript
dw SilentHillHouseStoveScript
dw RivalHouseWindowScript
SilentHillHouseNPCText1:
ld hl, wd41a

View File

@ -50,12 +50,12 @@ SilentHillLabBackScript1:
call LoadMovementDataPointer
ld hl, wd41b
set 1, [hl]
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 1
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillLabBackMovement1:
@ -65,7 +65,7 @@ SilentHillLabBackMovement1:
step_end
SilentHillLabBackScript2:
ld hl, wc5ed
ld hl, wOverworldFlags
set 6, [hl]
call Function20f8
ld a, 3
@ -103,12 +103,12 @@ SilentHillLabBackRivalChoosePokemon:
ld l, a
ld a, 3
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 4
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillLabBackMovementPointers:
@ -138,7 +138,7 @@ SilentHillLabBackScript5:
SilentHillLabBackScript6:
call Function20f8
ld hl, wc5ed
ld hl, wOverworldFlags
res 6, [hl]
ld a, 6
ld[wMapScriptNumber], a
@ -220,11 +220,11 @@ ConfirmPokemonSelection:
ld hl, wd41b
set 2, [hl]
ld a, 1
ld [wd29b], a
ld [wPlayerHouse1FCurScript], a
ld a, 1
ld [wd29a], a
ld [wPlayerHouse2FCurScript], a
ld a, 1
ld [wd2a0], a
ld [wSilentHillHouseCurScript], a
ld hl, SilentHillLabBackTextString8
call PrintText
ld hl, wJoypadFlags
@ -309,7 +309,7 @@ SilentHillLabBackFunc4:
ld hl, wd41b
bit 2, [hl]
jr nz, .bigjump
ldh a, [hFFEA]
ldh a, [hLastTalked]
sub 2
ld [wChosenStarter], a
ld d, 0
@ -363,8 +363,8 @@ SilentHillLabBackTextString15:
done
SilentHillLabBackTextPointers2:
dw Function3899
dw Function3899
dw Function3899
dw Function3899
dw PokemonBooksScript
dw PokemonBooksScript
dw PokemonBooksScript
dw PokemonBooksScript
dw MapDefaultText

View File

@ -169,10 +169,10 @@ SilentHillLabFrontMoveDown:
ld a, 0
ld hl, SilentHillLabFrontMovement1
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
call xor_a
ret
@ -196,12 +196,12 @@ SilentHillLabFrontScript3:
ld hl, SilentHillLabFrontMovement2
ld a, 6
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 3
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillLabFrontMovement2:
@ -258,12 +258,12 @@ SilentHillLabFrontScript5:
ld a, 2
ld hl, SilentHillLabFrontMovement3
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 5
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillLabFrontMovement3:
@ -279,12 +279,12 @@ SilentHillLabFrontScript6:
ld a, 4
ld hl, SilentHillLabFrontMovement4
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 6
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillLabFrontMovement4:
@ -303,12 +303,12 @@ SilentHillLabFrontScript7:
ld a, 0
ld hl, SilentHillLabFrontMovement5
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 7
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillLabFrontMovement5:
@ -330,12 +330,12 @@ SilentHillLabFrontScript8:
ld a, 0
ld hl, SilentHillLabFrontMovement6
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 8
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillLabFrontMovement6:
@ -356,12 +356,12 @@ SilentHillLabFrontScript9:
ld a, 5
ld hl, SilentHillLabFrontMovement7
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 9
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillLabFrontMovement7:
@ -394,12 +394,12 @@ SilentHillLabFrontScript10:
ld a, 3
ld hl, SilentHillLabFrontMovement8
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, $0A
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillLabFrontMovement8:
@ -458,12 +458,12 @@ SilentHillLabFrontRivalMovePokemon:
pop hl
ld a, 5
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, $0C
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
call xor_a
ret
@ -488,10 +488,10 @@ SilentHillLabFrontScript13:
ld hl, SilentHillLabFrontTextString17
call OpenTextbox
call GetLabPokemon
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, 8
ld [wd637], a
ld a, MAPSTATUS_START_TRAINER_BATTLE
ld [wMapStatus], a
ld a, $0D
ld [wMapScriptNumber], a
call InitObjectMasks
@ -524,7 +524,7 @@ LabPokemon:
SilentHillLabFrontScript14:
ld hl, SilentHillLabFrontTextString19
ld a, [wcd5d]
ld a, [wBattleResult]
and a
jr nz, .skip
ld hl, SilentHillLabFrontTextString18
@ -537,12 +537,12 @@ SilentHillLabFrontScript14:
ld a, 5
ld hl, SilentHillLabFrontMovement11
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, $0E
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
ret
SilentHillLabFrontMovement11:
@ -589,12 +589,12 @@ SilentHillLabFrontMoveRivalLeave:
pop hl
ld a, 8
call LoadMovementDataPointer
ld hl, wc5ed
ld hl, wOverworldFlags
set 7, [hl]
ld a, $10
ld [wMapScriptNumber], a
ld a, 1
call WriteIntod637
ld a, MAPSTATUS_EVENT_RUNNING
call SetMapStatus
call xor_a
ret
@ -640,18 +640,18 @@ SilentHillLabFrontScript19:
SilentHillLabFrontTextPointers2:
dw SilentHillLabFrontText1
dw SilentHillLabFrontText2
dw Function3899
dw Function3899
dw Function3899
dw Function3899
dw Function3899
dw Function3899
dw Function3899
dw Function3899
dw Function3899
dw Function3899
dw Function3899
dw Function3899
dw PokemonBooksScript
dw PokemonBooksScript
dw PokemonBooksScript
dw PokemonBooksScript
dw PokemonBooksScript
dw PokemonBooksScript
dw PokemonBooksScript
dw PokemonBooksScript
dw PokemonBooksScript
dw PokemonBooksScript
dw PokemonBooksScript
dw PokemonBooksScript
dw SilentHillLabFrontText3
SilentHillLabFrontText1:

View File

@ -1,29 +1,4 @@
05:43B6 InitAllSRAMBanks
05:43E0 Function143e0
05:451B PrintSaveScreenText
05:457A Function1457a
05:45B8 Function145b8
05:45DE Function145de
05:4624 Function14624
05:46DC Function146dc
; Structure:
; byte Map group ($ff = end)
; byte Map ID
; ptr Copied to c5e9, also byte pointed to written at wMapScriptNumber
; ptr Copied to c5eb
; word Unknown (2 bytes)
05:470E UnknownMapBufferPointers
05:4777 Function14777
05:4C94 Data14c94
05:4CAC Function14cac
05:4DAC Function14dac
05:4DC4 Function14dc4
05:4DDD Function14ddd
05:4E00 Function14e00
05:4E5F Function14e5f
05:4E27 Function14e27
05:4E4A Function14e4a
; Link cable-related functions.
; all these probably print text
0A:4000 Function28000
0A:4C98 LinkTextboxAtHL
@ -33,28 +8,11 @@
0A:5A1F Function29a1f ; prints text
0A:5ABF Function29abf ; prints text
0E:4B78 LoadTrainerClassName
;0E:4BA0 LoadTrainerClassName.got_name
0E:4BA9 LoadTrainerClass
0E:4000 Function38000
0E:4220 Function38220
0E:4340 Function38340
0E:434E Function3834e
;0E:43CD DrawPlayerHUDBorder
;0E:43FD DrawEnemyHUDBorder
;0E:4415 PlaceHUDBorderTiles
;0E:4431 LinkBattle_TrainerHuds
0E:44D4 Function384d4
0E:4F45 Function38f45
0E:50E9 Battle_GetTrainerName
23:4940 Function8c940
23:49C6 Function8c9c6
23:4b6d FishingAnim_Old
;23:4940 EnterMapAnim_Old
;23:49C6 Function8c9c6
;23:4b6d FishingAnim_Old
38:48A2 PokerMinigame
38:5AE3 FifteenPuzzleMinigame
38:4E5F Cursor_AnimateCursor
38:4EA8 Cursor_InterpretJoypad
@ -62,6 +20,8 @@
; Poker Cursor AnimSeq Function
38:5054 Functione1054
38:5AE3 FifteenPuzzleMinigame
;3F:40E9 InGameDebugMenu
;3F:4E3E Functionfce3e
3F:5B66 Functionfdb66
@ -71,5 +31,6 @@
; Filler. TODO: Determine the position of all filler and preferably extract it to binary files.
0B:786F Bank0b_FillerStart
0e:59bc Bank0e_FillerStart
14:7274 Bank14_FillerStart