diff --git a/audio/engine.asm b/audio/engine.asm index a23b00fb2..6b0fe1a63 100644 --- a/audio/engine.asm +++ b/audio/engine.asm @@ -1669,8 +1669,8 @@ MusicF9: ; sets some flag ; seems to be unused ; params: 0 - ld a, 1 - ld [wc2b5], a + ld a, TRUE + ld [wUnusedMusicF9Flag], a ret MusicE2: @@ -2345,7 +2345,7 @@ _PlayMusic:: dec a jr nz, .loop xor a - ld [wc2b5], a + ld [wUnusedMusicF9Flag], a ld [wChannel1JumpCondition], a ld [wChannel2JumpCondition], a ld [wChannel3JumpCondition], a diff --git a/docs/event_commands.md b/docs/event_commands.md index 0a114154f..c06d5c587 100644 --- a/docs/event_commands.md +++ b/docs/event_commands.md @@ -263,7 +263,9 @@ If item_id = `USE_SCRIPT_VAR`, then it uses `[wScriptVar]` i ## `$49`: `closetext` -## `$4A`: loadbytec2cf byte +## `$4A`: writeunusedbytebuffer byte + +[wUnusedScriptByteBuffer] = byte ## `$4B`: farwritetext text_pointer diff --git a/engine/link/link.asm b/engine/link/link.asm index b51567c31..3550c2b20 100644 --- a/engine/link/link.asm +++ b/engine/link/link.asm @@ -585,7 +585,7 @@ FixDataForLinkTransfer: ld [hli], a dec b jr nz, .loop3 - ld hl, wTimeCapsulePartyMon1 - 1 + 6 + ld hl, wTimeCapsulePartyMon1 - 1 + PARTY_LENGTH ld de, wc612 lb bc, 0, 0 .loop4 diff --git a/engine/overworld/map_objects.asm b/engine/overworld/map_objects.asm index 26152625d..cf532fea6 100644 --- a/engine/overworld/map_objects.asm +++ b/engine/overworld/map_objects.asm @@ -1836,7 +1836,7 @@ Function5000: ; unscripted? ret GetMovementByte: - ld hl, wMovementDataPointer + ld hl, wMovementDataBank call _GetMovementByte ret diff --git a/engine/overworld/scripting.asm b/engine/overworld/scripting.asm index 4f6c6568e..ee6e15b51 100644 --- a/engine/overworld/scripting.asm +++ b/engine/overworld/scripting.asm @@ -137,7 +137,7 @@ ScriptCommandTable: dw Script_opentext ; 47 dw Script_refreshscreen ; 48 dw Script_closetext ; 49 - dw Script_loadbytec2cf ; 4a + dw Script_writeunusedbytebuffer ; 4a dw Script_farwritetext ; 4b dw Script_writetext ; 4c dw Script_repeattext ; 4d @@ -2636,12 +2636,12 @@ Script_refreshscreen: call GetScriptByte ret -Script_loadbytec2cf: +Script_writeunusedbytebuffer: ; script command 0x4a ; parameters: byte call GetScriptByte - ld [wc2cf], a + ld [wUnusedScriptByteBuffer], a ret db closetext_command ; unused diff --git a/engine/overworld/warp_connection.asm b/engine/overworld/warp_connection.asm index 2630ad913..2b36d1e42 100644 --- a/engine/overworld/warp_connection.asm +++ b/engine/overworld/warp_connection.asm @@ -1,6 +1,6 @@ HandleNewMap: - call ClearUnusedC7E8 + call ClearUnusedMapBuffer call ResetMapBufferEventFlags call ResetFlashIfOutOfCave call GetCurrentMapSceneID diff --git a/engine/pokemon/breeding.asm b/engine/pokemon/breeding.asm index 2598ddd3e..66d227ce5 100644 --- a/engine/pokemon/breeding.asm +++ b/engine/pokemon/breeding.asm @@ -254,7 +254,7 @@ HatchEggs: ld [wCurSpecies], a call GetPokemonName xor a - ld [wd26b], a + ld [wUnusedEggHatchFlag], a call GetBaseData ld a, [wCurPartyMon] ld hl, wPartyMon1 @@ -325,8 +325,8 @@ HatchEggs: pop de jr c, .nonickname - ld a, $1 - ld [wd26b], a + ld a, TRUE + ld [wUnusedEggHatchFlag], a xor a ld [wMonType], a push de diff --git a/home/audio.asm b/home/audio.asm index 803c6e07d..779c2267d 100644 --- a/home/audio.asm +++ b/home/audio.asm @@ -479,7 +479,7 @@ Unreferenced_Function3d9f:: xor a ld [wVirtualOAMSprite38Attributes], a ld [wVirtualOAMSprite39Attributes], a - ld a, [wc296] + ld a, [wUnusedBCDNumber] cp 100 jr nc, .max add 1 diff --git a/home/map.asm b/home/map.asm index b85599de8..659e5688d 100644 --- a/home/map.asm +++ b/home/map.asm @@ -1,8 +1,8 @@ ; Functions dealing with rendering and interacting with maps. -ClearUnusedC7E8:: - ld hl, wUnusedC7E8 - ld bc, wUnusedC7E8End - wUnusedC7E8 +ClearUnusedMapBuffer:: + ld hl, wUnusedMapBuffer + ld bc, wUnusedMapBufferEnd - wUnusedMapBuffer ld a, 0 call ByteFill ret diff --git a/home/map_objects.asm b/home/map_objects.asm index 4cc28b07d..162bfbc5c 100644 --- a/home/map_objects.asm +++ b/home/map_objects.asm @@ -395,11 +395,11 @@ LoadMovementDataPointer:: ; Load the movement data pointer for object a. ld [wMovementObject], a ldh a, [hROMBank] - ld [wMovementDataPointer], a + ld [wMovementDataBank], a ld a, l - ld [wMovementDataPointer + 1], a + ld [wMovementDataAddress], a ld a, h - ld [wMovementDataPointer + 2], a + ld [wMovementDataAddress + 1], a ld a, [wMovementObject] call CheckObjectVisibility ret c diff --git a/macros/legacy.asm b/macros/legacy.asm index 0f70f4d43..ff20c5235 100644 --- a/macros/legacy.asm +++ b/macros/legacy.asm @@ -112,6 +112,7 @@ givepokeitem EQUS "givepokemail" checkpokeitem EQUS "checkpokemail" passtoengine EQUS "autoinput" verbosegiveitem2 EQUS "verbosegiveitemvar" +loadbytec2cf EQUS "writeunusedbytebuffer" ; macros/scripts/maps.asm diff --git a/macros/scripts/events.asm b/macros/scripts/events.asm index 16b02446b..95cf1ecff 100644 --- a/macros/scripts/events.asm +++ b/macros/scripts/events.asm @@ -489,9 +489,9 @@ closetext: MACRO db closetext_command ENDM - enum loadbytec2cf_command ; $4a -loadbytec2cf: MACRO - db loadbytec2cf_command + enum writeunusedbytebuffer_command ; $4a +writeunusedbytebuffer: MACRO + db writeunusedbytebuffer_command db \1 ; byte ENDM diff --git a/wram.asm b/wram.asm index 61036d24f..daa27f66f 100644 --- a/wram.asm +++ b/wram.asm @@ -39,7 +39,7 @@ wChannel8:: channel_struct wChannel8 ; c25f wCurTrackDuty:: db wCurTrackIntensity:: db wCurTrackFrequency:: dw -wc296:: db ; BCD value, dummied out +wUnusedBCDNumber:: db ; BCD value, dummied out wCurNoteDuration:: db ; used in MusicE0 and LoadNote wCurMusicByte:: db ; c298 @@ -95,7 +95,7 @@ wCryPitch:: dw ; c2b0 wCryLength:: dw ; c2b2 wLastVolume:: db ; c2b4 -wc2b5:: db ; c2b5 +wUnusedMusicF9Flag:: db ; c2b5 wSFXPriority:: ; c2b6 ; if nonzero, turn off music when playing sfx @@ -145,7 +145,7 @@ wDebugFlags:: db wGameLogicPaused:: db ; c2cd wSpriteUpdatesEnabled:: db -wc2cf:: db ; ???? +wUnusedScriptByteBuffer:: db wMapTimeOfDay:: db @@ -171,7 +171,8 @@ wPlayerMovement:: db wc2e2:: wMovementObject:: db -wMovementDataPointer:: ds 3 ; dba +wMovementDataBank:: db +wMovementDataAddress:: dw wc2e6:: ds 4 wMovementByteWasControlSwitch:: db wMovementPointer:: dw ; c2eb @@ -909,8 +910,10 @@ ENDU ; c7e8 ENDU ; c7e8 -wUnusedC7E8:: ds 24 -wUnusedC7E8End:: +; This was a buffer for map-related pointers in the 1997 G/S prototype. +; See wMapBuffer in pokegold-spaceworld's wram.asm. +wUnusedMapBuffer:: ds 24 +wUnusedMapBufferEnd:: SECTION "Overworld Map", WRAM0 @@ -954,7 +957,7 @@ wPrinterTileMapBuffer:: ds SCREEN_HEIGHT * SCREEN_WIDTH ; ca90 wPrinterTileMapBufferEnd:: wPrinterStatus:: db ; cbf8 ds 1 -wcbfa:: ds 1 +wcbfa:: db wGBPrinterSettings:: db ds 16 wGameboyPrinterRAMEnd:: @@ -2259,22 +2262,23 @@ wTimeOfDay:: db ; d269 SECTION "Enemy Party", WRAMX UNION ; d26b -wd26b:: wPokedexShowPointerAddr:: dw wPokedexShowPointerBank:: db ds 3 -wd271:: ds 5 +wd271:: dw ; mobile + +NEXTU ; d26b +wUnusedEggHatchFlag:: db NEXTU ; d26b ; enemy party wOTPlayerName:: ds NAME_LENGTH ; d26b -ENDU ; d276 - wOTPlayerID:: dw ; d276 ds 8 wOTPartyCount:: db ; d280 wOTPartySpecies:: ds PARTY_LENGTH ; d281 wOTPartyEnd:: db ; older code doesn't check PartyCount +ENDU ; d276 UNION ; d288 ; ot party mons @@ -2309,10 +2313,10 @@ wDudeBallsEnd:: db ; d2af wDudeBagEnd:: ENDU ; d430 -wd430:: +wd430:: ; mobile wBattleAction:: db ; d430 -wd431:: db +wd431:: db ; mobile wMapStatus:: db ; d432 wMapEventStatus:: db ; d433 @@ -2778,8 +2782,10 @@ wKenjiBreakTimer:: ds 2 ; Kenji wYanmaMapGroup:: db ; dc5a wYanmaMapNumber:: db wPlayerMonSelection:: ds 3 -wdc5f:: ds 1 -wdc60:: ds 19 +wdc5f:: db +wdc60:: db + + ds 18 wStepCount:: db ; dc73 wPoisonStepCount:: db ; dc74