diff options
-rw-r--r-- | constants/sprite_anim_constants.asm | 3 | ||||
-rw-r--r-- | engine/movie/gamefreak_presents.asm | 73 | ||||
-rw-r--r-- | engine/movie/title.asm | 2 | ||||
-rwxr-xr-x | engine/overworld/player_movement.asm | 2 | ||||
-rwxr-xr-x | home/print_num.asm | 126 |
5 files changed, 97 insertions, 109 deletions
diff --git a/constants/sprite_anim_constants.asm b/constants/sprite_anim_constants.asm index 04c01743..1df8c368 100644 --- a/constants/sprite_anim_constants.asm +++ b/constants/sprite_anim_constants.asm @@ -23,6 +23,9 @@ NUM_SPRITE_ANIM_STRUCTS EQU 10 ; see wSpriteAnimationStructs SPRITE_ANIM_INDEX_PARTY_MON EQU $00 SPRITE_ANIM_INDEX_GS_TITLE_TRAIL EQU $0f SPRITE_ANIM_INDEX_NAMING_SCREEN_CURSOR EQU $14 +SPRITE_ANIM_INDEX_GAMEFREAK_LOGO EQU $15 +SPRITE_ANIM_INDEX_GS_INTRO_STAR EQU $16 +SPRITE_ANIM_INDEX_GS_INTRO_SPARKLE EQU $17 SPRITE_ANIM_INDEX_SLOTS_GOLEM EQU $18 SPRITE_ANIM_INDEX_SLOTS_CHANSEY EQU $19 SPRITE_ANIM_INDEX_SLOTS_EGG EQU $1a diff --git a/engine/movie/gamefreak_presents.asm b/engine/movie/gamefreak_presents.asm index 2676c9f6..f4c2c5cc 100644 --- a/engine/movie/gamefreak_presents.asm +++ b/engine/movie/gamefreak_presents.asm @@ -1,41 +1,30 @@ -Copyright_GFPresents: ; e49a8 (39:49a8) +Copyright_GFPresents: ; Play the copyright screen and GameFreak Presents sequence. ; Return carry if user cancels animation by pressing a button. call ClearBGPalettes call ClearTilemap - ld a, HIGH(vBGMap0) ldh [hBGMapAddress + 1], a xor a ; LOW(vBGMap0) ldh [hBGMapAddress], a - ldh [hJoyDown], a ldh [hSCX], a ldh [hSCY], a - ld a, SCREEN_HEIGHT_PX ldh [hWY], a - call WaitBGMap - ld b, SCGB_GAMEFREAK_LOGO call GetSGBLayout - call SetPalettes - ld c, 10 call DelayFrames - callfar Copyright - call WaitBGMap - ld c, 100 call DelayFrames - call ClearTilemap - call GFPresents_Init + call .GetGFLogoGFX .loop call GFPresents_PlayFrame @@ -55,7 +44,7 @@ Copyright_GFPresents: ; e49a8 (39:49a8) scf ret -GFPresents_Init: ; e49f3 (39:49f3) +.GetGFLogoGFX: ; Load gfx and initialize variables ld de, GFPresentsGFX1 @@ -75,25 +64,21 @@ GFPresents_Init: ; e49f3 (39:49f3) ld [hli], a ld a, $8d ld [hl], a - xor a ld [wJumptableIndex], a - ld [$ce64], a + ld [wIntroSceneFrameCounter], a ld [wIntroSceneTimer], a ldh [hSCX], a ldh [hSCY], a - ld a, 1 ldh [hBGMapMode], a - ld a, SCREEN_HEIGHT_PX ldh [hWY], a - lb de, %00100100, %11111000 call DmgToCgbObjPals ret -GFPresents_PlayFrame: ; e4a37 (39:4a37) +GFPresents_PlayFrame: ; Play one frame of GFPresents sequence. ; Return carry when the sequence completes or is canceled. @@ -133,7 +118,7 @@ GFPresents_PlayFrame: ; e4a37 (39:4a37) scf ret -GFPresents_HandleFrame: ; e4a6d (39:4a6d) +GFPresents_HandleFrame: ; Dispatch to the current scene handler ld a, [wJumptableIndex] @@ -155,26 +140,26 @@ GFPresents_HandleFrame: ; e4a6d (39:4a6d) dw GFPresents_WaitForTimer dw GFPresents_SetDoneFlag -GFPresents_NextScene: ; e4a88 (39:4a88) +GFPresents_NextScene: ld hl, wJumptableIndex inc [hl] ret ; unused? -Func_e4a8d: ; e4a8d (39:4a8d) +Functione4a8d: ld c, 64 call DelayFrames call GFPresents_NextScene ret -GFPresents_Star: ; e4a96 (39:4a96) +GFPresents_Star: ; tell GFPresents_PlaceLogo we haven't finished yet xor a - ld [$ce64], a + ld [wIntroSceneFrameCounter], a depixel 10, 11, 4, 0 - ld a, $16 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_STAR call InitSpriteAnimStruct ; TODO set some flag in the struct? @@ -188,17 +173,17 @@ GFPresents_Star: ; e4a96 (39:4a96) call GFPresents_NextScene ret -GFPresents_PlaceLogo: ; e4ab2 (39:4ab2) +GFPresents_PlaceLogo: ; Draw the Game Freak logo (may be initially invisible due to palette) ; wait until the star animation completed ; TODO this is cleared above, but when is it set? - ld a, [$ce64] + ld a, [wIntroSceneFrameCounter] and a ret z depixel 10, 11, 4, 0 - ld a, $15 + ld a, SPRITE_ANIM_INDEX_GAMEFREAK_LOGO call InitSpriteAnimStruct call GFPresents_NextScene @@ -208,7 +193,7 @@ GFPresents_PlaceLogo: ; e4ab2 (39:4ab2) ld [wIntroSceneTimer], a ret -GFPresents_LogoSparkles: ; e4ac8 (39:4ac8) +GFPresents_LogoSparkles: ld hl, wIntroSceneTimer ld a, [hl] @@ -230,16 +215,18 @@ GFPresents_LogoSparkles: ; e4ac8 (39:4ac8) call GFPresents_NextScene ret -GFPresents_PlaceGameFreak: ; e4adf (39:4adf) +GFPresents_PlaceGameFreak: hlcoord 5, 12 ld de, .game_freak call PlaceString ret .game_freak - db $80, $81, $82, $83, $8d, $84, $85, $83, $81, $86, "@" + db $80, $81, $82, $83, $8d, $84, $85, $83, $81, $86 +.end + db "@" -GFPresents_PlacePresents: ; e4af4 (39:4af4) +GFPresents_PlacePresents: hlcoord 7, 13 ld de, .presents call PlaceString @@ -252,18 +239,18 @@ GFPresents_PlacePresents: ; e4af4 (39:4af4) ret .presents - db $87, $88, $89, $8a, $8b, $8c, "@" + db $87, $88, $89, $8a, $8b, $8c +.end + db "@" -GFPresents_SetDoneFlag: ; e4b0d (39:4b0d) -; Tell GFPresents_PlayFrame and TitleScreenFrame (01:63da) that we're finished. +GFPresents_SetDoneFlag: +; Tell GFPresents_PlayFrame and TitleScreenFrame that we're finished. ld hl, wJumptableIndex set 7, [hl] ret -GFPresents_WaitForTimer: ; e4b13 (39:4b13) -; Wait for the timer to elapse - +GFPresents_WaitForTimer: ld hl, wIntroSceneTimer ld a, [hl] and a @@ -274,8 +261,8 @@ GFPresents_WaitForTimer: ; e4b13 (39:4b13) call GFPresents_NextScene ret -GFPresents_UpdateLogoPal: ; e4b20 (39:4b20) -; called from 29:5928 +GFPresents_UpdateLogoPal: +; called from 23:5928 ; OBP1 was initialized at end of GFPresents_Init ; once we reached the final state, leave it alone @@ -297,7 +284,7 @@ GFPresents_UpdateLogoPal: ; e4b20 (39:4b20) call DmgToCgbObjPal1 ret -GFPresents_Sparkle: ; e4b33 (39:4b33) +GFPresents_Sparkle: ; Initialize and configure a sparkle sprite. ; TODO unclear how this relates to the actual screen display, ; seems to be called more times than there are visible sparkles? @@ -314,7 +301,7 @@ GFPresents_Sparkle: ; e4b33 (39:4b33) ; set up a new sparkle sprite push af depixel 11, 11 - ld a, $17 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_SPARKLE call InitSpriteAnimStruct pop af diff --git a/engine/movie/title.asm b/engine/movie/title.asm index 93345798..0545b8f1 100644 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -55,7 +55,7 @@ TitleScreen: ld [hli], a ; wIntroSceneFrameCounter ld [hli], a ; wTitleScreenTimer ld [hl], a ; wTitleScreenTimer + 1 - ld de, $6058 + depixel 12, 11 ld a, SPRITE_ANIM_INDEX_GS_INTRO_HO_OH call InitSpriteAnimStruct ld hl, wSpriteAnim1 diff --git a/engine/overworld/player_movement.asm b/engine/overworld/player_movement.asm index bdf23ec4..6747c0ef 100755 --- a/engine/overworld/player_movement.asm +++ b/engine/overworld/player_movement.asm @@ -394,7 +394,7 @@ DoPlayerMovement:: .CheckWarp: ; Bug: Since no case is made for STANDING here, it will check -; [.edgewarps + $ff]. This resolves to $3e at $8035a. +; [.edgewarps + $ff]. This resolves to $3e at $1035a. ; This causes wWalkingIntoEdgeWarp to be nonzero when standing on tile $3e, ; making bumps silent. diff --git a/home/print_num.asm b/home/print_num.asm index d37ebe1d..5bea7696 100755 --- a/home/print_num.asm +++ b/home/print_num.asm @@ -25,39 +25,38 @@ PrintNum:: .main xor a - ldh [$ffb5], a - ldh [$ffb6], a - ldh [$ffb7], a + ldh [hPrintNumBuffer + 0], a + ldh [hPrintNumBuffer + 1], a + ldh [hPrintNumBuffer + 2], a ld a, b and $f cp 1 jr z, .byte cp 2 jr z, .word - ; maximum 3 bytes .long ld a, [de] - ldh [$ffb6], a + ldh [hPrintNumBuffer + 1], a inc de ld a, [de] - ldh [$ffb7], a + ldh [hPrintNumBuffer + 2], a inc de ld a, [de] - ldh [$ffb8], a + ldh [hPrintNumBuffer + 3], a jr .start .word ld a, [de] - ldh [$ffb7], a + ldh [hPrintNumBuffer + 2], a inc de ld a, [de] - ldh [$ffb8], a + ldh [hPrintNumBuffer + 3], a jr .start .byte ld a, [de] - ldh [$ffb8], a + ldh [hPrintNumBuffer + 3], a .start push de @@ -84,51 +83,51 @@ PrintNum:: .seven ld a, HIGH(1000000 >> 8) - ldh [$ffb9], a + ldh [hPrintNumBuffer + 4], a ld a, HIGH(1000000) ; mid - ldh [$ffba], a + ldh [hPrintNumBuffer + 5], a ld a, LOW(1000000) - ldh [$ffbb], a + ldh [hPrintNumBuffer + 6], a call .PrintDigit call .AdvancePointer .six ld a, HIGH(100000 >> 8) - ldh [$ffb9], a + ldh [hPrintNumBuffer + 4], a ld a, HIGH(100000) ; mid - ldh [$ffba], a + ldh [hPrintNumBuffer + 5], a ld a, LOW(100000) - ldh [$ffbb], a + ldh [hPrintNumBuffer + 6], a call .PrintDigit call .AdvancePointer .five xor a ; HIGH(10000 >> 8) - ldh [$ffb9], a + ldh [hPrintNumBuffer + 4], a ld a, HIGH(10000) ; mid - ldh [$ffba], a + ldh [hPrintNumBuffer + 5], a ld a, LOW(10000) - ldh [$ffbb], a + ldh [hPrintNumBuffer + 6], a call .PrintDigit call .AdvancePointer .four xor a ; HIGH(1000 >> 8) - ldh [$ffb9], a + ldh [hPrintNumBuffer + 4], a ld a, HIGH(1000) ; mid - ldh [$ffba], a + ldh [hPrintNumBuffer + 5], a ld a, LOW(1000) - ldh [$ffbb], a + ldh [hPrintNumBuffer + 6], a call .PrintDigit call .AdvancePointer .three xor a ; HIGH(100 >> 8) - ldh [$ffb9], a + ldh [hPrintNumBuffer + 4], a xor a ; HIGH(100) ; mid - ldh [$ffba], a + ldh [hPrintNumBuffer + 5], a ld a, LOW(100) - ldh [$ffbb], a + ldh [hPrintNumBuffer + 6], a call .PrintDigit call .AdvancePointer @@ -136,22 +135,21 @@ PrintNum:: dec e jr nz, .two_skip ld a, "0" - ldh [$ffb5], a - + ldh [hPrintNumBuffer + 0], a .two_skip - ld c, 0 - ldh a, [$ffb8] + ld c, 0 + ldh a, [hPrintNumBuffer + 3] .mod_10 cp 10 jr c, .modded_10 sub 10 inc c jr .mod_10 - .modded_10 + ld b, a - ldh a, [$ffb5] + ldh a, [hPrintNumBuffer + 0] or c jr nz, .money call .PrintLeadingZero @@ -164,12 +162,12 @@ PrintNum:: add c ld [hl], a pop af - ldh [$ffb5], a + ldh [hPrintNumBuffer + 0], a inc e dec e jr nz, .money_leading_zero inc hl - ld [hl], $e8 + ld [hl], "." .money_leading_zero call .AdvancePointer @@ -184,7 +182,7 @@ PrintNum:: .PrintYen: push af - ldh a, [$ffb5] + ldh a, [hPrintNumBuffer + 0] and a jr nz, .stop bit 5, d @@ -201,68 +199,68 @@ PrintNum:: dec e jr nz, .ok ld a, "0" - ldh [$ffb5], a + ldh [hPrintNumBuffer + 0], a .ok ld c, 0 .loop - ldh a, [$ffb9] + ldh a, [hPrintNumBuffer + 4] ld b, a - ldh a, [$ffb6] - ldh [$ffbc], a + ldh a, [hPrintNumBuffer + 1] + ldh [hPrintNumBuffer + 7], a cp b jr c, .skip1 sub b - ldh [$ffb6], a - ldh a, [$ffba] + ldh [hPrintNumBuffer + 1], a + ldh a, [hPrintNumBuffer + 5] ld b, a - ldh a, [$ffb7] - ldh [$ffbd], a + ldh a, [hPrintNumBuffer + 2] + ldh [hPrintNumBuffer + 8], a cp b jr nc, .skip2 - ldh a, [$ffb6] + ldh a, [hPrintNumBuffer + 1] or 0 jr z, .skip3 dec a - ldh [$ffb6], a - ldh a, [$ffb7] + ldh [hPrintNumBuffer + 1], a + ldh a, [hPrintNumBuffer + 2] .skip2 sub b - ldh [$ffb7], a - ldh a, [$ffbb] + ldh [hPrintNumBuffer + 2], a + ldh a, [hPrintNumBuffer + 6] ld b, a - ldh a, [$ffb8] - ldh [$ffbe], a + ldh a, [hPrintNumBuffer + 3] + ldh [hPrintNumBuffer + 9], a cp b jr nc, .skip4 - ldh a, [$ffb7] + ldh a, [hPrintNumBuffer + 2] and a jr nz, .skip5 - ldh a, [$ffb6] + ldh a, [hPrintNumBuffer + 1] and a jr z, .skip6 dec a - ldh [$ffb6], a + ldh [hPrintNumBuffer + 1], a xor a .skip5 dec a - ldh [$ffb7], a - ldh a, [$ffb8] + ldh [hPrintNumBuffer + 2], a + ldh a, [hPrintNumBuffer + 3] .skip4 sub b - ldh [$ffb8], a + ldh [hPrintNumBuffer + 3], a inc c jr .loop .skip6 - ldh a, [$ffbd] - ldh [$ffb7], a + ldh a, [hPrintNumBuffer + 8] + ldh [hPrintNumBuffer + 2], a .skip3 - ldh a, [$ffbc] - ldh [$ffb6], a + ldh a, [hPrintNumBuffer + 7] + ldh [hPrintNumBuffer + 1], a .skip1 - ldh a, [$ffb5] + ldh a, [hPrintNumBuffer + 0] or c jr z, .PrintLeadingZero - ldh a, [$ffb5] + ldh a, [hPrintNumBuffer + 0] and a jr nz, .done bit 5, d @@ -274,12 +272,12 @@ PrintNum:: ld a, "0" add c ld [hl], a - ldh [$ffb5], a + ldh [hPrintNumBuffer + 0], a inc e dec e ret nz inc hl - ld [hl], $e8 + ld [hl], "." ret .PrintLeadingZero: @@ -296,7 +294,7 @@ PrintNum:: jr nz, .inc bit 6, d ; left alignment or right alignment? jr z, .inc - ldh a, [$ffb5] + ldh a, [hPrintNumBuffer + 0] and a ret z .inc |