From 16c6696dd5d786eafca0beb855b55c00b25b01f4 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Sat, 9 Dec 2017 13:52:14 -0500 Subject: [PATCH] Start organizing WRAM - Use db and dw when they're more meaningful than ds 1/2 - Use unions to group related labels --- audio/engine.asm | 38 ++-- engine/credits.asm | 2 +- engine/init_gender.asm | 4 +- engine/intro_menu.asm | 20 +-- engine/map_setup.asm | 4 +- engine/specials.asm | 4 +- engine/timeset.asm | 4 +- event/halloffame.asm | 8 +- home/audio.asm | 4 +- misc/mobile_12.asm | 4 +- misc/mobile_45_sprite_engine.asm | 20 +-- misc/mobile_5f.asm | 12 +- misc/mobile_menu.asm | 4 +- wram.asm | 290 ++++++++++++++----------------- 14 files changed, 195 insertions(+), 223 deletions(-) diff --git a/audio/engine.asm b/audio/engine.asm index 7bb5b5c4e..c99fe324c 100644 --- a/audio/engine.asm +++ b/audio/engine.asm @@ -60,15 +60,15 @@ _MapSetup_Sound_Off:: ; e8000 MusicFadeRestart: ; e803d ; restart but keep the music id to fade in to - ld a, [MusicFadeIDHi] + ld a, [MusicFadeID + 1] push af - ld a, [MusicFadeIDLo] + ld a, [MusicFadeID] push af call _MapSetup_Sound_Off pop af - ld [MusicFadeIDLo], a + ld [MusicFadeID], a pop af - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a ret ; e8051 @@ -654,11 +654,11 @@ FadeMusic: ; e8358 ; restart sound call MusicFadeRestart ; get new song id - ld a, [MusicFadeIDLo] + ld a, [MusicFadeID] and a jr z, .quit ; this assumes there are fewer than 256 songs! ld e, a - ld a, [MusicFadeIDHi] + ld a, [MusicFadeID + 1] ld d, a ; load new song call _PlayMusic @@ -679,9 +679,9 @@ FadeMusic: ; e8358 xor a ld [Volume], a ; get new song id - ld a, [MusicFadeIDLo] + ld a, [MusicFadeID] ld e, a - ld a, [MusicFadeIDHi] + ld a, [MusicFadeID + 1] ld d, a ; load new song call _PlayMusic @@ -1364,9 +1364,9 @@ GetNoiseSample: ; e86c5 add hl, de ; load sample pointer into NoiseSampleAddress ld a, [hli] - ld [NoiseSampleAddressLo], a + ld [NoiseSampleAddress], a ld a, [hl] - ld [NoiseSampleAddressHi], a + ld [NoiseSampleAddress + 1], a ; clear ???? xor a ld [wNoiseSampleDelay], a @@ -2160,9 +2160,9 @@ Music_RestartChannel: ; e8a08 ld hl, Channel1MusicID - Channel1 add hl, bc ld a, [hli] - ld [MusicIDLo], a + ld [MusicID], a ld a, [hl] - ld [MusicIDHi], a + ld [MusicID + 1], a ; update music bank ld hl, Channel1MusicBank - Channel1 add hl, bc @@ -2437,7 +2437,7 @@ _PlayMusic:: ; e8b30 ld hl, MusicID ld [hl], e ; song number inc hl - ld [hl], d ; MusicIDHi (always $) + ld [hl], d ; (always 0) ld hl, Music add hl, de ; three add hl, de ; byte @@ -2466,8 +2466,8 @@ _PlayMusic:: ; e8b30 ld [Channel2JumpCondition], a ld [Channel3JumpCondition], a ld [Channel4JumpCondition], a - ld [NoiseSampleAddressLo], a - ld [NoiseSampleAddressHi], a + ld [NoiseSampleAddress], a + ld [NoiseSampleAddress + 1], a ld [wNoiseSampleDelay], a ld [MusicNoiseSampleSet], a call MusicOn @@ -2647,8 +2647,8 @@ _PlaySFX:: ; e8c04 ld a, $80 ld [rNR44], a ; restart sound (freq hi = 0) xor a - ld [NoiseSampleAddressLo], a - ld [NoiseSampleAddressHi], a + ld [NoiseSampleAddress], a + ld [NoiseSampleAddress + 1], a .chscleared ; start reading sfx header for # chs ld hl, MusicID @@ -2825,9 +2825,9 @@ LoadChannel: ; e8d1b ; load music id ld hl, Channel1MusicID - Channel1 add hl, bc - ld a, [MusicIDLo] + ld a, [MusicID] ld [hli], a - ld a, [MusicIDHi] + ld a, [MusicID + 1] ld [hl], a ; load music bank ld hl, Channel1MusicBank - Channel1 diff --git a/engine/credits.asm b/engine/credits.asm index 1888ef27d..3442d4f16 100644 --- a/engine/credits.asm +++ b/engine/credits.asm @@ -491,7 +491,7 @@ ParseCredits: ; 1099aa ld a, MUSIC_POST_CREDITS % $100 ld [MusicFadeID], a ld a, MUSIC_POST_CREDITS / $100 - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a ret .get diff --git a/engine/init_gender.asm b/engine/init_gender.asm index ff5babdf9..3ae856029 100755 --- a/engine/init_gender.asm +++ b/engine/init_gender.asm @@ -68,9 +68,9 @@ InitGenderScreen: ; 48e14 (12:4e14) ld a, $10 ld [MusicFade], a ld a, MUSIC_NONE - ld [MusicFadeIDLo], a + ld [MusicFadeID], a ld a, $0 - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a ld c, 8 call DelayFrames call ClearBGPalettes diff --git a/engine/intro_menu.asm b/engine/intro_menu.asm index 8e3c90204..2da478ede 100755 --- a/engine/intro_menu.asm +++ b/engine/intro_menu.asm @@ -375,9 +375,9 @@ Continue: ; 5d65 ld a, $8 ld [MusicFade], a ld a, MUSIC_NONE % $100 - ld [MusicFadeIDLo], a + ld [MusicFadeID], a ld a, MUSIC_NONE / $100 - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a call ClearBGPalettes call Continue_MobileAdapterMenu call CloseWindow @@ -429,9 +429,9 @@ Continue_MobileAdapterMenu: ; 5df0 ld a, 5 ld [MusicFade], a ld a, MUSIC_MOBILE_ADAPTER_MENU % $100 - ld [MusicFadeIDLo], a + ld [MusicFadeID], a ld a, MUSIC_MOBILE_ADAPTER_MENU / $100 - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a ld c, 20 call DelayFrames ld c, $1 @@ -440,9 +440,9 @@ Continue_MobileAdapterMenu: ; 5df0 ld a, 8 ld [MusicFade], a ld a, MUSIC_NONE % $100 - ld [MusicFadeIDLo], a + ld [MusicFadeID], a ld a, MUSIC_NONE / $100 - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a ld c, 35 call DelayFrames ret @@ -859,9 +859,9 @@ ShrinkPlayer: ; 610f ld [MusicFade], a ld de, MUSIC_NONE ld a, e - ld [MusicFadeIDLo], a + ld [MusicFadeID], a ld a, d - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a ld de, SFX_ESCAPE_ROPE call PlaySFX @@ -1282,8 +1282,8 @@ TitleScreenMain: ; 6304 ; Fade out the title screen music xor a - ld [MusicFadeIDLo], a - ld [MusicFadeIDHi], a + ld [MusicFadeID], a + ld [MusicFadeID + 1], a ld hl, MusicFade ld [hl], 8 ; 1 second diff --git a/engine/map_setup.asm b/engine/map_setup.asm index dc013ffdd..5de4f30da 100644 --- a/engine/map_setup.asm +++ b/engine/map_setup.asm @@ -414,9 +414,9 @@ RetainOldPalettes: ; 1556d RotatePalettesRightMapAndMusic: ; 15574 ld e, 0 - ld a, [MusicFadeIDLo] + ld a, [MusicFadeID] ld d, 0 - ld a, [MusicFadeIDHi] + ld a, [MusicFadeID + 1] ld a, $4 ld [MusicFade], a call RotateThreePalettesRight diff --git a/engine/specials.asm b/engine/specials.asm index 6baca2697..e88112286 100644 --- a/engine/specials.asm +++ b/engine/specials.asm @@ -618,9 +618,9 @@ SpecialGameboyCheck: ; c478 Special_FadeOutMusic: ; c48f ld a, MUSIC_NONE % $100 - ld [MusicFadeIDLo], a + ld [MusicFadeID], a ld a, MUSIC_NONE / $100 - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a ld a, $2 ld [MusicFade], a ret diff --git a/engine/timeset.asm b/engine/timeset.asm index d560ae817..77ee5a0dd 100755 --- a/engine/timeset.asm +++ b/engine/timeset.asm @@ -10,9 +10,9 @@ InitClock: ; 90672 (24:4672) ld a, $10 ld [MusicFade], a ld a, MUSIC_NONE % $100 - ld [MusicFadeIDLo], a + ld [MusicFadeID], a ld a, MUSIC_NONE / $100 - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a ld c, 8 call DelayFrames call RotateFourPalettesLeft diff --git a/event/halloffame.asm b/event/halloffame.asm index e1870b8ac..5e0a20378 100755 --- a/event/halloffame.asm +++ b/event/halloffame.asm @@ -37,9 +37,9 @@ HallOfFame:: ; 0x8640e RedCredits:: ; 86455 ld a, MUSIC_NONE % $100 - ld [MusicFadeIDLo], a + ld [MusicFadeID], a ld a, MUSIC_NONE / $100 - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a ld a, 10 ld [MusicFade], a callba FadeOutPalettes @@ -60,9 +60,9 @@ RedCredits:: ; 86455 HallOfFame_FadeOutMusic: ; 8648e ld a, MUSIC_NONE % $100 - ld [MusicFadeIDLo], a + ld [MusicFadeID], a ld a, MUSIC_NONE / $100 - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a ld a, 10 ld [MusicFade], a callba FadeOutPalettes diff --git a/home/audio.asm b/home/audio.asm index fbbce72de..98e1fc40c 100644 --- a/home/audio.asm +++ b/home/audio.asm @@ -348,9 +348,9 @@ FadeToMapMusic:: ; 3cbc ld a, 8 ld [MusicFade], a ld a, e - ld [MusicFadeIDLo], a + ld [MusicFadeID], a ld a, d - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a ld a, e ld [wMapMusic], a diff --git a/misc/mobile_12.asm b/misc/mobile_12.asm index 69a5551a7..ea1e25bb8 100755 --- a/misc/mobile_12.asm +++ b/misc/mobile_12.asm @@ -40,9 +40,9 @@ InitMobileProfile: ; 4802f (12:402f) ld a, $5 ld [MusicFade], a ld a, MUSIC_MOBILE_ADAPTER_MENU % $100 - ld [MusicFadeIDLo], a + ld [MusicFadeID], a ld a, MUSIC_MOBILE_ADAPTER_MENU / $100 - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a ld c, 20 call DelayFrames ld b, $1 diff --git a/misc/mobile_45_sprite_engine.asm b/misc/mobile_45_sprite_engine.asm index 57c45e43c..a85e7fce4 100755 --- a/misc/mobile_45_sprite_engine.asm +++ b/misc/mobile_45_sprite_engine.asm @@ -496,9 +496,9 @@ Function1161d5: ; 1161d5 ld [MusicFade], a ld de, MUSIC_MOBILE_ADAPTER ld a, e - ld [MusicFadeIDLo], a + ld [MusicFadeID], a ld a, d - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a ld a, [$c319] inc a ld [$c319], a @@ -680,9 +680,9 @@ Function11636e: ; 11636e ld a, $8 ld [MusicFade], a ld a, [wMapMusic] - ld [MusicFadeIDLo], a + ld [MusicFadeID], a xor a - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a xor a ld [$c319], a ld [wc30d], a @@ -728,18 +728,18 @@ Function1163c0: ; 1163c0 ld a, $8 ld [MusicFade], a ld a, [wMapMusic] - ld [MusicFadeIDLo], a + ld [MusicFadeID], a xor a - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a jr .asm_116439 .asm_11642a ld a, $8 ld [MusicFade], a ld a, $0 - ld [MusicFadeIDLo], a + ld [MusicFadeID], a ld a, $0 - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a .asm_116439 xor a @@ -757,9 +757,9 @@ Function116441: ; 116441 ld a, $8 ld [MusicFade], a ld a, [wMapMusic] - ld [MusicFadeIDLo], a + ld [MusicFadeID], a xor a - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a xor a ld [$c319], a ld [wc30d], a diff --git a/misc/mobile_5f.asm b/misc/mobile_5f.asm index 061b1357f..816e23394 100644 --- a/misc/mobile_5f.asm +++ b/misc/mobile_5f.asm @@ -559,9 +559,9 @@ Function17d2ce: ; 17d2ce ld de, MUSIC_MOBILE_CENTER ld a, e ld [wMapMusic], a - ld [MusicFadeIDLo], a + ld [MusicFadeID], a ld a, d - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a call PlayMusic call ReturnToMapFromSubmenu call CloseSubmenu @@ -4728,9 +4728,9 @@ Function17f5e4: ; 17f5e4 ld [MusicFade], a ld de, MUSIC_NONE ld a, e - ld [MusicFadeIDLo], a + ld [MusicFadeID], a ld a, d - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a ld a, " " hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT @@ -5274,9 +5274,9 @@ Function17ff23: ; 17ff23 ld a, $8 ld [MusicFade], a ld a, [wMapMusic] - ld [MusicFadeIDLo], a + ld [MusicFadeID], a xor a - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a ld hl, wc303 set 7, [hl] ret diff --git a/misc/mobile_menu.asm b/misc/mobile_menu.asm index 518ad9a25..1bee0cced 100755 --- a/misc/mobile_menu.asm +++ b/misc/mobile_menu.asm @@ -856,9 +856,9 @@ Function4a6c5: ; 4a6c5 (12:66c5) ld a, $5 ld [MusicFade], a ld a, e - ld [MusicFadeIDLo], a + ld [MusicFadeID], a ld a, d - ld [MusicFadeIDHi], a + ld [MusicFadeID + 1], a ld c, 22 call DelayFrames ret diff --git a/wram.asm b/wram.asm index 6a505a21f..c577d5519 100644 --- a/wram.asm +++ b/wram.asm @@ -2,7 +2,9 @@ INCLUDE "includes.asm" INCLUDE "macros/wram.asm" INCLUDE "vram.asm" + SECTION "Stack", WRAM0 + wc000:: StackBottom:: ds $100 - 1 @@ -12,10 +14,11 @@ StackTop:: SECTION "Audio RAM", WRAM0 + wMusic:: -MusicPlaying:: ; c100 + ; nonzero if playing - ds 1 +MusicPlaying:: db ; c100 Channels:: Channel1:: channel_struct Channel1 ; c101 @@ -30,16 +33,15 @@ Channel7:: channel_struct Channel7 ; c22d Channel8:: channel_struct Channel8 ; c25f ds 1 ; c291 -wCurTrackDuty:: ds 1 -wCurTrackIntensity:: ds 1 -wCurTrackFrequency:: dw -wc296:: ds 1 ; BCD value, dummied out -wCurNoteDuration:: ds 1 ; used in MusicE0 and LoadNote -CurMusicByte:: ; c298 - ds 1 -CurChannel:: ; c299 - ds 1 +wCurTrackDuty:: db +wCurTrackIntensity:: db +wCurTrackFrequency:: dw +wc296:: db ; BCD value, dummied out +wCurNoteDuration:: db ; used in MusicE0 and LoadNote + +CurMusicByte:: db ; c298 +CurChannel:: db ; c299 Volume:: ; c29a ; corresponds to $ff24 ; Channel control / ON-OFF / Volume (R/W) @@ -47,12 +49,12 @@ Volume:: ; c29a ; bit 6-4 - SO2 output level (volume) (# 0-7) ; bit 3 - Vin->SO1 ON/OFF ; bit 2-0 - SO1 output level (volume) (# 0-7) - ds 1 + db SoundOutput:: ; c29b ; corresponds to $ff25 ; bit 4-7: ch1-4 so2 on/off ; bit 0-3: ch1-4 so1 on/off - ds 1 + db SoundInput:: ; c29c ; corresponds to $ff26 ; bit 7: global on/off @@ -60,80 +62,69 @@ SoundInput:: ; c29c ; bit 1: ch2 on/off ; bit 2: ch3 on/off ; bit 3: ch4 on/off - ds 1 + db + +MusicID:: dw ; c29d +MusicBank:: db ; c29f +NoiseSampleAddress:: dw ; c2a0 +wNoiseSampleDelay:: db ; c2a2 + ds 1 ; c2a3 +MusicNoiseSampleSet:: db ; c2a4 +SFXNoiseSampleSet:: db ; c2a5 -MusicID:: -MusicIDLo:: ; c29d - ds 1 -MusicIDHi:: ; c29e - ds 1 -MusicBank:: ; c29f - ds 1 -NoiseSampleAddress:: -NoiseSampleAddressLo:: ; c2a0 - ds 1 -NoiseSampleAddressHi:: ; c2a1 - ds 1 -wNoiseSampleDelay:: ; noise delay? ; c2a2 - ds 1 -; c2a3 - ds 1 -MusicNoiseSampleSet:: ; c2a4 - ds 1 -SFXNoiseSampleSet:: ; c2a5 - ds 1 Danger:: ; c2a6 ; bit 7: on/off ; bit 4: pitch ; bit 0-3: counter - ds 1 + db + MusicFade:: ; c2a7 ; fades volume over x frames ; bit 7: fade in/out ; bit 0-5: number of frames for each volume level ; $00 = none (default) - ds 1 -MusicFadeCount:: ; c2a8 - ds 1 -MusicFadeID:: -wc2a9:: -MusicFadeIDLo:: ; c2a9 - ds 1 -wc2aa:: -MusicFadeIDHi:: ; c2aa - ds 1 + db +MusicFadeCount:: db ; c2a8 +MusicFadeID:: dw ; c2a9 + ds 5 -CryPitch:: ; c2b0 - ds 2 -CryLength:: ; c2b2 - ds 2 -LastVolume:: ; c2b4 - ds 1 -wc2b5:: ds 1 + +CryPitch:: dw ; c2b0 +CryLength:: dw ; c2b2 + +LastVolume:: db ; c2b4 +wc2b5:: db ; c2b5 + SFXPriority:: ; c2b6 ; if nonzero, turn off music when playing sfx + db + ds 1 - ds 1 -Channel1JumpCondition:: ds 1 -Channel2JumpCondition:: ds 1 -Channel3JumpCondition:: ds 1 -Channel4JumpCondition:: ds 1 -wStereoPanningMask:: ds 1 ; c2bc + +Channel1JumpCondition:: db +Channel2JumpCondition:: db +Channel3JumpCondition:: db +Channel4JumpCondition:: db + +wStereoPanningMask:: db ; c2bc + CryTracks:: ; c2bd ; plays only in left or right track depending on what side the monster is on ; both tracks active outside of battle - ds 1 -wSFXDuration:: ds 1 + db + +wSFXDuration:: db CurSFX:: ; c2bf ; id of sfx currently playing - ds 1 + db ChannelsEnd:: -wMapMusic:: ; c2c0 - ds 1 -wDontPlayMapMusicOnReload:: ds 1 +wMapMusic:: db ; c2c0 + +wDontPlayMapMusicOnReload:: db wMusicEnd:: + SECTION "WRAM", WRAM0 wLZAddress:: dw ; c2c2 @@ -141,69 +132,62 @@ wLZBank:: db ; c2c4 ds 1 -wBoxAlignment:: ds 1 -InputType:: ; c2c7 - ds 1 -AutoInputAddress:: ; c2c8 - ds 2 -AutoInputBank:: ; c2ca - ds 1 -AutoInputLength:: ; c2cb - ds 1 +wBoxAlignment:: db -wMonStatusFlags:: ds 1 -wGameLogicPaused:: ds 1 ; c2cd -wSpriteUpdatesEnabled:: ds 1 -wc2cf:: ds 1 -wMapTimeOfDay:: ds 1 +InputType:: db ; c2c7 +AutoInputAddress:: dw ; c2c8 +AutoInputBank:: db ; c2ca +AutoInputLength:: db ; c2cb + +wMonStatusFlags:: db +wGameLogicPaused:: db ; c2cd +wSpriteUpdatesEnabled:: db +wc2cf:: db +wMapTimeOfDay:: db ds 3 -wPrinterConnectionOpen:: ds 1 -wPrinterOpcode:: ds 1 -wLastDexEntry:: ds 1 -wDisableTextAcceleration:: ds 1 -wPreviousLandmark:: ds 1 -wCurrentLandmark:: ds 1 -wLandmarkSignTimer:: ds 2 +wPrinterConnectionOpen:: db +wPrinterOpcode:: db +wLastDexEntry:: db +wDisableTextAcceleration:: db +wPreviousLandmark:: db +wCurrentLandmark:: db +wLandmarkSignTimer:: dw wLinkMode:: ; c2dc ; 0 not in link battle ; 1 link battle ; 4 mobile battle - ds 1 + db -ScriptVar:: ; c2dd - ds 1 +ScriptVar:: db ; c2dd -wPlayerNextMovement:: ds 1 -wPlayerMovement:: ds 1 +wPlayerNextMovement:: db +wPlayerMovement:: db ds 2 wc2e2:: -wMovementPerson:: ds 1 +wMovementPerson:: db wMovementDataPointer:: ds 3 ; dba wc2e6:: ds 4 -wMovementByteWasControlSwitch:: ds 1 -wMovementPointer:: ds 2 ; c2eb +wMovementByteWasControlSwitch:: db +wMovementPointer:: dw ; c2eb + ds 3 -wTempObjectCopyMapObjectIndex:: ds 1 ; c2f0 -wTempObjectCopySprite:: ds 1 ; c2f1 -wTempObjectCopySpriteVTile:: ds 1 ; c2f2 -wTempObjectCopyPalette:: ds 1 ; c2f3 -wTempObjectCopyMovement:: ds 1 ; c2f4 -wTempObjectCopyRange:: ds 1 ; c2f5 -wTempObjectCopyX:: ds 1 ; c2f6 -wTempObjectCopyY:: ds 1 ; c2f7 -wTempObjectCopyRadius:: ds 1 ; c2f8 +wTempObjectCopyMapObjectIndex:: db ; c2f0 +wTempObjectCopySprite:: db ; c2f1 +wTempObjectCopySpriteVTile:: db ; c2f2 +wTempObjectCopyPalette:: db ; c2f3 +wTempObjectCopyMovement:: db ; c2f4 +wTempObjectCopyRange:: db ; c2f5 +wTempObjectCopyX:: db ; c2f6 +wTempObjectCopyY:: db ; c2f7 +wTempObjectCopyRadius:: db ; c2f8 ds 1 -TileDown:: ; c2fa - ds 1 -TileUp:: ; c2fb - ds 1 -TileLeft:: ; c2fc - ds 1 -TileRight:: ; c2fd - ds 1 +TileDown:: db ; c2fa +TileUp:: db ; c2fb +TileLeft:: db ; c2fc +TileRight:: db ; c2fd TilePermissions:: ; c2fe ; set if tile behavior prevents @@ -212,19 +196,36 @@ TilePermissions:: ; c2fe ; bit 2: up ; bit 1: left ; bit 0: right - ds 1 + db ds 1 + SECTION "wSpriteAnims", WRAM0 -; wc300 - wc313 is a 10x2 dictionary. -; keys: taken from third column of SpriteAnimSeqData -; values: VTiles UNION +; wSpriteAnimDict is a 10x2 dictionary +; keys: taken from third column of SpriteAnimSeqData +; values: VTiles wSpriteAnimDict:: ds 10 * 2 +wSpriteAnimationStructs:: +; field 0: index +; fields 1-3: loaded from SpriteAnimSeqData +SpriteAnim1:: sprite_anim_struct SpriteAnim1 +SpriteAnim2:: sprite_anim_struct SpriteAnim2 +SpriteAnim3:: sprite_anim_struct SpriteAnim3 +SpriteAnim4:: sprite_anim_struct SpriteAnim4 +SpriteAnim5:: sprite_anim_struct SpriteAnim5 +SpriteAnim6:: sprite_anim_struct SpriteAnim6 +SpriteAnim7:: sprite_anim_struct SpriteAnim7 +SpriteAnim8:: sprite_anim_struct SpriteAnim8 +SpriteAnim9:: sprite_anim_struct SpriteAnim9 +SpriteAnim10:: sprite_anim_struct SpriteAnim10 +wSpriteAnimationStructsEnd:: + NEXTU +; mobile data wc300:: ds 1 wc301:: ds 1 wc302:: ds 1 @@ -244,62 +245,32 @@ wc310:: ds 1 wc311:: ds 1 wc312:: ds 1 wc313:: ds 1 +wc314:: ds 152 +wc3ac:: ds 8 ENDU -wSpriteAnimationStructs:: -; Field 0: Index -; Fields 1-3: Loaded from SpriteAnimSeqData -wc314:: -SpriteAnim1:: sprite_anim_struct SpriteAnim1 -wc324:: -SpriteAnim2:: sprite_anim_struct SpriteAnim2 -wc334:: -SpriteAnim3:: sprite_anim_struct SpriteAnim3 -wc344:: -SpriteAnim4:: sprite_anim_struct SpriteAnim4 -wc354:: -SpriteAnim5:: sprite_anim_struct SpriteAnim5 -wc364:: -SpriteAnim6:: sprite_anim_struct SpriteAnim6 -wc374:: -SpriteAnim7:: sprite_anim_struct SpriteAnim7 -wc384:: -SpriteAnim8:: sprite_anim_struct SpriteAnim8 -wc394:: -SpriteAnim9:: sprite_anim_struct SpriteAnim9 -wc3a4:: +wSpriteAnimCount:: db +wCurrSpriteOAMAddr:: db -UNION -SpriteAnim10:: sprite_anim_struct SpriteAnim10 -wSpriteAnimationStructsEnd:: -NEXTU - ds 8 -wc3ac:: ds 8 ; c3ac -ENDU +CurIcon:: db ; c3b6 -wSpriteAnimCount:: ds 1 -wCurrSpriteOAMAddr:: ds 1 - -CurIcon:: ; c3b6 - ds 1 - - -wCurIconTile:: ds 1 +wCurIconTile:: db wSpriteAnimAddrBackup:: wSpriteAnimIDBuffer:: wCurrSpriteAddSubFlags:: - ds 2 -wCurrAnimVTile:: ds 1 -wCurrAnimXCoord:: ds 1 -wCurrAnimYCoord:: ds 1 -wCurrAnimXOffset:: ds 1 -wCurrAnimYOffset:: ds 1 -wGlobalAnimYOffset:: ds 1 -wGlobalAnimXOffset:: ds 1 + dw +wCurrAnimVTile:: db +wCurrAnimXCoord:: db +wCurrAnimYCoord:: db +wCurrAnimXOffset:: db +wCurrAnimYOffset:: db +wGlobalAnimYOffset:: db +wGlobalAnimXOffset:: db wSpriteAnimsEnd:: ds 11 +; mobile data wc3cc:: ds 1 wc3cd:: ds 31 wc3ec:: ds 1 @@ -352,6 +323,7 @@ TileMapEnd:: SECTION "Battle", WRAM0 + UNION wc608:: wOddEgg:: party_struct OddEgg