From 74f86d7501ad76ec51081c6aca93001968b689a1 Mon Sep 17 00:00:00 2001 From: entrpntr Date: Fri, 5 Jun 2020 18:25:20 -0400 Subject: Extract title graphics and add options_menu.asm. --- engine/menus/options_menu.asm | 565 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 565 insertions(+) create mode 100644 engine/menus/options_menu.asm (limited to 'engine') diff --git a/engine/menus/options_menu.asm b/engine/menus/options_menu.asm new file mode 100644 index 00000000..d0a6afc5 --- /dev/null +++ b/engine/menus/options_menu.asm @@ -0,0 +1,565 @@ +; GetOptionPointer.Pointers indexes + const_def + const OPT_TEXT_SPEED ; 0 + const OPT_BATTLE_SCENE ; 1 + const OPT_BATTLE_STYLE ; 2 + const OPT_SOUND ; 3 + const OPT_PRINT ; 4 + const OPT_MENU_ACCOUNT ; 5 + const OPT_FRAME ; 6 + const OPT_CANCEL ; 7 +NUM_OPTIONS EQU const_value ; 8 + +_OptionsMenu: + ld hl, hInMenu + ld a, [hl] + push af + ld [hl], TRUE + call ClearBGPalettes + hlcoord 0, 0 + ld b, SCREEN_HEIGHT - 2 + ld c, SCREEN_WIDTH - 2 + call Textbox + hlcoord 2, 2 + ld de, StringOptions + call PlaceString + xor a + ld [wJumptableIndex], a + +; display the settings of each option when the menu is opened + ld c, NUM_OPTIONS - 2 ; omit frame type, the last option +.print_text_loop + push bc + xor a + ldh [hJoyLast], a + call GetOptionPointer + pop bc + ld hl, wJumptableIndex + inc [hl] + dec c + jr nz, .print_text_loop + call UpdateFrame ; display the frame type + + xor a + ld [wJumptableIndex], a + inc a + ldh [hBGMapMode], a + call WaitBGMap + ld b, SCGB_DIPLOMA + call GetSGBLayout + call SetPalettes + +.joypad_loop + call JoyTextDelay + ldh a, [hJoyPressed] + and START | B_BUTTON + jr nz, .ExitOptions + call OptionsControl + jr c, .dpad + call GetOptionPointer + jr c, .ExitOptions + +.dpad + call Options_UpdateCursorPosition + ld c, 3 + call DelayFrames + jr .joypad_loop + +.ExitOptions: + pop af + ldh [hInMenu], a + ret + +StringOptions: + db "TEXT SPEED" + db " :" + db "BATTLE SCENE" + db " :" + db "BATTLE STYLE" + db " :" + db "SOUND" + db " :" + db "PRINT" + db " :" + db "MENU ACCOUNT" + db " :" + db "FRAME" + db " :TYPE" + db "CANCEL@" + +GetOptionPointer: + ld a, [wJumptableIndex] + ld e, a + ld d, 0 + ld hl, .Pointers + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp hl + +.Pointers: +; entries correspond to OPT_* constants + dw Options_TextSpeed + dw Options_BattleScene + dw Options_BattleStyle + dw Options_Sound + dw Options_Print + dw Options_MenuAccount + dw Options_Frame + dw Options_Cancel + + const_def + const OPT_TEXT_SPEED_FAST ; 0 + const OPT_TEXT_SPEED_MED ; 1 + const OPT_TEXT_SPEED_SLOW ; 2 + +Options_TextSpeed: + call GetTextSpeed + ldh a, [hJoyPressed] + bit D_LEFT_F, a + jr nz, .LeftPressed + bit D_RIGHT_F, a + jr z, .NonePressed + ld a, c ; right pressed + cp OPT_TEXT_SPEED_SLOW + jr c, .Increase + ld c, OPT_TEXT_SPEED_FAST - 1 + +.Increase: + inc c + ld a, e + jr .Save + +.LeftPressed: + ld a, c + and a + jr nz, .Decrease + ld c, OPT_TEXT_SPEED_SLOW + 1 + +.Decrease: + dec c + ld a, d + +.Save: + ld b, a + ld a, [wOptions] + and $f0 + or b + ld [wOptions], a + +.NonePressed: + ld b, 0 + ld hl, .Strings + add hl, bc + add hl, bc + ld e, [hl] + inc hl + ld d, [hl] + hlcoord 11, 3 + call PlaceString + and a + ret + +.Strings: +; entries correspond to OPT_TEXT_SPEED_* constants + dw .Fast + dw .Mid + dw .Slow + +.Fast: db "FAST@" +.Mid: db "MID @" +.Slow: db "SLOW@" + +GetTextSpeed: +; converts TEXT_DELAY_* value in a to OPT_TEXT_SPEED_* value in c, +; with previous/next TEXT_DELAY_* values in d/e + ld a, [wOptions] + and TEXT_DELAY_MASK + cp TEXT_DELAY_SLOW + jr z, .slow + cp TEXT_DELAY_FAST + jr z, .fast + ; none of the above + ld c, OPT_TEXT_SPEED_MED + lb de, TEXT_DELAY_FAST, TEXT_DELAY_SLOW + ret + +.slow + ld c, OPT_TEXT_SPEED_SLOW + lb de, TEXT_DELAY_MED, TEXT_DELAY_FAST + ret + +.fast + ld c, OPT_TEXT_SPEED_FAST + lb de, TEXT_DELAY_SLOW, TEXT_DELAY_MED + ret + +Options_BattleScene: + ld hl, wOptions + ldh a, [hJoyPressed] + bit D_LEFT_F, a + jr nz, .LeftPressed + bit D_RIGHT_F, a + jr z, .NonePressed + bit BATTLE_SCENE, [hl] + jr nz, .ToggleOn + jr .ToggleOff + +.LeftPressed: + bit BATTLE_SCENE, [hl] + jr z, .ToggleOff + jr .ToggleOn + +.NonePressed: + bit BATTLE_SCENE, [hl] + jr z, .ToggleOn + jr .ToggleOff + +.ToggleOn: + res BATTLE_SCENE, [hl] + ld de, .On + jr .Display + +.ToggleOff: + set BATTLE_SCENE, [hl] + ld de, .Off + +.Display: + hlcoord 11, 5 + call PlaceString + and a + ret + +.On: db "ON @" +.Off: db "OFF@" + +Options_BattleStyle: + ld hl, wOptions + ldh a, [hJoyPressed] + bit D_LEFT_F, a + jr nz, .LeftPressed + bit D_RIGHT_F, a + jr z, .NonePressed + bit BATTLE_SHIFT, [hl] + jr nz, .ToggleShift + jr .ToggleSet + +.LeftPressed: + bit BATTLE_SHIFT, [hl] + jr z, .ToggleSet + jr .ToggleShift + +.NonePressed: + bit BATTLE_SHIFT, [hl] + jr nz, .ToggleSet + +.ToggleShift: + res BATTLE_SHIFT, [hl] + ld de, .Shift + jr .Display + +.ToggleSet: + set BATTLE_SHIFT, [hl] + ld de, .Set + +.Display: + hlcoord 11, 7 + call PlaceString + and a + ret + +.Shift: db "SHIFT@" +.Set: db "SET @" + +Options_Sound: + ld hl, wOptions + ldh a, [hJoyPressed] + bit D_LEFT_F, a + jr nz, .LeftPressed + bit D_RIGHT_F, a + jr z, .NonePressed + bit STEREO, [hl] + jr nz, .SetMono + jr .SetStereo + +.LeftPressed: + bit STEREO, [hl] + jr z, .SetStereo + jr .SetMono + +.NonePressed: + bit STEREO, [hl] + jr nz, .ToggleStereo + jr .ToggleMono + +.SetMono: + res STEREO, [hl] + call RestartMapMusic + +.ToggleMono: + ld de, .Mono + jr .Display + +.SetStereo: + set STEREO, [hl] + call RestartMapMusic + +.ToggleStereo: + ld de, .Stereo + +.Display: + hlcoord 11, 9 + call PlaceString + and a + ret + +.Mono: db "MONO @" +.Stereo: db "STEREO@" + + const_def + const OPT_PRINT_LIGHTEST ; 0 + const OPT_PRINT_LIGHTER ; 1 + const OPT_PRINT_NORMAL ; 2 + const OPT_PRINT_DARKER ; 3 + const OPT_PRINT_DARKEST ; 4 + +Options_Print: + call GetPrinterSetting + ldh a, [hJoyPressed] + bit D_LEFT_F, a + jr nz, .LeftPressed + bit D_RIGHT_F, a + jr z, .NonePressed + ld a, c + cp OPT_PRINT_DARKEST + jr c, .Increase + ld c, OPT_PRINT_LIGHTEST - 1 + +.Increase: + inc c + ld a, e + jr .Save + +.LeftPressed: + ld a, c + and a + jr nz, .Decrease + ld c, OPT_PRINT_DARKEST + 1 + +.Decrease: + dec c + ld a, d + +.Save: + ld b, a + ld [wGBPrinterBrightness], a + +.NonePressed: + ld b, 0 + ld hl, .Strings + add hl, bc + add hl, bc + ld e, [hl] + inc hl + ld d, [hl] + hlcoord 11, 11 + call PlaceString + and a + ret + +.Strings: +; entries correspond to OPT_PRINT_* constants + dw .Lightest + dw .Lighter + dw .Normal + dw .Darker + dw .Darkest + +.Lightest: db "LIGHTEST@" +.Lighter: db "LIGHTER @" +.Normal: db "NORMAL @" +.Darker: db "DARKER @" +.Darkest: db "DARKEST @" + +GetPrinterSetting: +; converts GBPRINTER_* value in a to OPT_PRINT_* value in c, +; with previous/next GBPRINTER_* values in d/e + ld a, [wGBPrinterBrightness] + and a + jr z, .IsLightest + cp GBPRINTER_LIGHTER + jr z, .IsLight + cp GBPRINTER_DARKER + jr z, .IsDark + cp GBPRINTER_DARKEST + jr z, .IsDarkest + ; none of the above + ld c, OPT_PRINT_NORMAL + lb de, GBPRINTER_LIGHTER, GBPRINTER_DARKER + ret + +.IsLightest: + ld c, OPT_PRINT_LIGHTEST + lb de, GBPRINTER_DARKEST, GBPRINTER_LIGHTER + ret + +.IsLight: + ld c, OPT_PRINT_LIGHTER + lb de, GBPRINTER_LIGHTEST, GBPRINTER_NORMAL + ret + +.IsDark: + ld c, OPT_PRINT_DARKER + lb de, GBPRINTER_NORMAL, GBPRINTER_DARKEST + ret + +.IsDarkest: + ld c, OPT_PRINT_DARKEST + lb de, GBPRINTER_DARKER, GBPRINTER_LIGHTEST + ret + +Options_MenuAccount: + ld hl, wOptions2 + ldh a, [hJoyPressed] + bit D_LEFT_F, a + jr nz, .LeftPressed + bit D_RIGHT_F, a + jr z, .NonePressed + bit MENU_ACCOUNT, [hl] + jr nz, .ToggleOff + jr .ToggleOn + +.LeftPressed: + bit MENU_ACCOUNT, [hl] + jr z, .ToggleOn + jr .ToggleOff + +.NonePressed: + bit MENU_ACCOUNT, [hl] + jr nz, .ToggleOn + +.ToggleOff: + res MENU_ACCOUNT, [hl] + ld de, .Off + jr .Display + +.ToggleOn: + set MENU_ACCOUNT, [hl] + ld de, .On + +.Display: + hlcoord 11, 13 + call PlaceString + and a + ret + +.Off: db "OFF@" +.On: db "ON @" + +Options_Frame: + ld hl, wTextboxFrame + ldh a, [hJoyPressed] + bit D_LEFT_F, a + jr nz, .LeftPressed + bit D_RIGHT_F, a + jr nz, .RightPressed + and a + ret + +.RightPressed: + ld a, [hl] + inc a + jr .Save + +.LeftPressed: + ld a, [hl] + dec a + +.Save: + maskbits NUM_FRAMES + ld [hl], a +UpdateFrame: + ld a, [wTextboxFrame] + hlcoord 16, 15 ; where on the screen the number is drawn + add "1" + ld [hl], a + call LoadFontsExtra + and a + ret + +Options_Cancel: + ldh a, [hJoyPressed] + and A_BUTTON + jr nz, .Exit + and a + ret + +.Exit: + scf + ret + +OptionsControl: + ld hl, wJumptableIndex + ldh a, [hJoyLast] + cp D_DOWN + jr z, .DownPressed + cp D_UP + jr z, .UpPressed + and a + ret + +.DownPressed: + ld a, [hl] + cp OPT_CANCEL ; maximum option index + jr nz, .CheckMenuAccount + ld [hl], OPT_TEXT_SPEED ; first option + scf + ret + +.CheckMenuAccount: ; I have no idea why this exists... + cp OPT_MENU_ACCOUNT + jr nz, .Increase + ld [hl], OPT_MENU_ACCOUNT + +.Increase: + inc [hl] + scf + ret + +.UpPressed: + ld a, [hl] + +; Another thing where I'm not sure why it exists + cp OPT_FRAME + jr nz, .NotFrame + ld [hl], OPT_MENU_ACCOUNT + scf + ret + +.NotFrame: + and a ; OPT_TEXT_SPEED, minimum option index + jr nz, .Decrease + ld [hl], NUM_OPTIONS ; decrements to OPT_CANCEL, maximum option index + +.Decrease: + dec [hl] + scf + ret + +Options_UpdateCursorPosition: + hlcoord 1, 1 + ld de, SCREEN_WIDTH + ld c, SCREEN_HEIGHT - 2 +.loop + ld [hl], " " + add hl, de + dec c + jr nz, .loop + hlcoord 1, 2 + ld bc, 2 * SCREEN_WIDTH + ld a, [wJumptableIndex] + call AddNTimes + ld [hl], "▶" + ret -- cgit v1.2.3 From fe03203e22fc252eeb962a04d8f7235fd3792a2c Mon Sep 17 00:00:00 2001 From: entrpntr Date: Fri, 5 Jun 2020 19:23:26 -0400 Subject: Preliminary commit that builds. --- engine/gfx/color.asm | 2 +- engine/movie/gs_intro.asm | 553 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 554 insertions(+), 1 deletion(-) create mode 100644 engine/movie/gs_intro.asm (limited to 'engine') diff --git a/engine/gfx/color.asm b/engine/gfx/color.asm index 37b1d7ba..f806a0c8 100644 --- a/engine/gfx/color.asm +++ b/engine/gfx/color.asm @@ -141,7 +141,7 @@ SGB_ApplyPartyMenuHPPals: ld [hl], e ret -Unreferenced_Function9102: +Function9102: call CheckCGB ret z ; CGB only diff --git a/engine/movie/gs_intro.asm b/engine/movie/gs_intro.asm new file mode 100644 index 00000000..f6c691a1 --- /dev/null +++ b/engine/movie/gs_intro.asm @@ -0,0 +1,553 @@ +IF DEF(_GOLD) +BANK39_OFFSET EQU 0 +ELIF DEF(_SILVER) +BANK39_OFFSET EQU $1b8 +ENDC + +GoldSilverIntro: + call .InitRAMAddrs +.loop + call .JoypadLoop + jr nc, .loop + ret + +.InitRAMAddrs: + farcall ClearSpriteAnims + xor a + ld [wIntroJumptableIndex], a + ldh [hBGMapMode], a + ret + +.JoypadLoop: + call JoyTextDelay + ldh a, [hJoyLast] + and BUTTONS + jr nz, .finish + ld a, [wIntroJumptableIndex] + bit 7, a + jr nz, .finish + farcall PlaySpriteAnimations + call IntroSceneJumper + call DelayFrame + and a + ret + +.finish + callfar ClearSpriteAnims + call ClearSprites + call DelayFrame + xor a + ldh [hSCX], a + ldh [hSCY], a + ldh [hLCDCPointer], a + ldh [hLYOverrideStart], a + ldh [hLYOverrideEnd], a + ld a, %11100100 + call DmgToCgbBGPals + depixel 28, 28, 4, 4 + call DmgToCgbObjPals + scf + ret + +IntroSceneJumper: + ld a, [wIntroJumptableIndex] + ld e, a + ld d, 0 + ld hl, IntroScenes + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp hl + +IntroScenes: + dw IntroScene1 + dw IntroScene2 + dw IntroScene3 + dw IntroScene4 + dw IntroScene5 + dw IntroScene6 + dw IntroScene7 + dw IntroScene8 + dw IntroScene9 + dw IntroScene10 + dw IntroScene11 + dw IntroScene12 + dw IntroScene13 + dw IntroScene14 + dw IntroScene15 + dw IntroScene16 + dw IntroScene17 + +IntroScene1: + call ClearBGPalettes + call ClearTilemap + ld hl, wIntroJumptableIndex + inc [hl] + call DisableLCD + xor a + ldh [hBGMapMode], a + callfar ClearSpriteAnims + ld a, 1 + ldh [rVBK], a + hlbgcoord 0, 0, vBGMap2 + lb bc, 4, 0 + xor a + call ByteFill + ld a, 0 + ldh [rVBK], a + call Functione54dd + ld de, vTiles2 tile $00 + ld hl, GFX_e54e8 + call Decompress + ld a, LOW(GFX_e5bc8) + ld [wcb15 + 0], a + ld a, HIGH(GFX_e5bc8) + ld [wcb15 + 1], a + hlbgcoord 0, 0, vBGMap2 + ld a, l + ld [wcb11 + 0], a + ld a, h + ld [wcb11 + 1], a + ld de, GFX_e5ab8 + ld a, e + ld [wcb13 + 0], a + ld a, d + ld [wcb13 + 1], a + call Functione5498 + ld de, vTiles0 tile $00 + ld hl, GFX_e5cd8 + call Decompress + ld hl, wSpriteAnimDict + ld a, 0 + ld [hli], a + ld a, 0 + ld [hli], a + xor a + ldh [hSCY], a + ld [wGlobalAnimYOffset], a + ld [wGlobalAnimXOffset], a + ld a, $58 + ldh [hSCX], a + xor a ; LOW(vTiles0 tile $00) + ld [wcb17 + 1], a + ld a, HIGH(vTiles0 tile $00) + ld [wcb17 + 0], a + ld a, $42 + ldh [hLCDCPointer], a + call Functione5095 + xor a + ld [wcb19], a + call EnableLCD + call DelayFrame + ld b, SCGB_GS_INTRO + ld c, 0 + call GetSGBLayout + ld a, %11100100 + call DmgToCgbBGPals + depixel 28, 28 + call DmgToCgbObjPals + call Functione4f5a + ld de, MUSIC_GS_OPENING + call PlayMusic + ret + +IntroScene2: + call Functione50af + ld hl, wcb17 + ld a, [hl] + and a + jr z, .asm_e4df5 + dec [hl] + call Functione4ef0 + ret + +.asm_e4df5: + ld [hl], $10 + ld hl, wIntroJumptableIndex + inc [hl] + +IntroScene3: + call Functione4e90 + call Functione4e67 + ret nc + call Functione54dd + ld hl, hSCY + inc [hl] + ld hl, wIntroJumptableIndex + inc [hl] + +IntroScene4: + ld a, [wcb19] + and a + jr nz, .asm_e4e25 + ld hl, wcb18 + inc [hl] + ld a, [hl] + and $0f + jr nz, .asm_e4e21 + ld hl, hSCX + dec [hl] + dec [hl] + +.asm_e4e21: + call Functione4fde + ret + +.asm_e4e25: + ld hl, wIntroJumptableIndex + inc [hl] + xor a + ld [wcb17], a + +IntroScene5: + ld hl, wcb17 + ld a, [hl] + inc [hl] + swap a + and $0f + ld e, a + ld d, 0 + ld hl, .pals + add hl, de + ld a, [hl] + cp -1 + jr z, .asm_e4e4e + call DmgToCgbBGPals + call Functione4fde + ld hl, hSCX + dec [hl] + dec [hl] + ret + +.asm_e4e4e + ld hl, wIntroJumptableIndex + inc [hl] + ret + +.pals + db %11100100, %11100100, %10010000, %01000000, %00000000 + db -1 + +IntroScene17: + ld c, 64 +.loop + call DelayFrame + dec c + jr nz, .loop + ld hl, wIntroJumptableIndex + set 7, [hl] + ret + +Functione4e67: + ld hl, wcb18 + inc [hl] + ld a, [hl] + and $03 + jr nz, .asm_e4e74 + ld hl, hSCX + dec [hl] + +.asm_e4e74 + and $01 + jr nz, .asm_e4e8c + ld hl, wGlobalAnimYOffset + inc [hl] + ld hl, hSCY + ld a, [hl] + dec [hl] + and $0f + call z, Functione4f87 + ld a, [wcb17] + and a + jr z, .asm_e4e8e + +.asm_e4e8c + and a + ret + +.asm_e4e8e + scf + ret + +Functione4e90: + ld a, [wcb17] + ld e, a + ld d, 0 + ld hl, .dw + add hl, de + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a + jp hl + +.dw + dw Functione4eca + dw Functione4eca + dw Functione4eca + dw Functione4ec1 + dw Functione4eca + dw Functione4eca + dw Functione4ece + dw Functione4ece + dw Functione4ece + dw Functione4ed5 + dw Functione4ee8 + dw Functione4eec + dw Functione4eec + dw Functione4eec + dw Functione4eec + dw Functione4eec + dw Functione4eec + +Functione4ec1: + call Functione4f6f + depixel 28, 28, 4, 4 + call DmgToCgbObjPals +; fall through +Functione4eca: + call Functione4fde + ret + +Functione4ece: + call Functione4f19 + call Functione4fde + ret + +Functione4ed5: + ld hl, wcb18 + ld a, [hl] + and $1f + jr z, .asm_e4ee1 + call Functione4f19 + ret + +.asm_e4ee1 + callfar Function9102 + ret + +Functione4ee8: + xor a + ldh [hLCDCPointer], a + ret + +Functione4eec: + call Functione50af + ret + +Functione4ef0: + ld hl, wcb17 + ld a, [hl] + and $0f + ret nz + ld a, [hl] + and $70 + swap a + ld e, a + ld d, 0 + ld hl, .pixels + add hl, de + add hl, de + ld e, [hl] + inc hl + ld d, [hl] + ld a, SPRITE_ANIM_INDEX_GS_INTRO_BUBBLE + call InitSpriteAnimStruct + ret + +.pixels + db 6 * 8, 14 * 8 + 4 + db 14 * 8, 18 * 8 + 4 + db 10 * 8, 16 * 8 + 4 + db 12 * 8, 15 * 8 + db 4 * 8, 13 * 8 + db 8 * 8, 17 * 8 + +Functione4f19: + depixel 8, 7, 0, 7 + ldh a, [hSGB] + and a + jr z, .asm_e4f24 + depixel 4, 3, 0, 7 + +.asm_e4f24 + ld hl, wcb18 + ld a, [hl] + and e + ret nz + ld a, [hl] + and d + jr nz, .asm_e4f41 + depixel 29, 28 + call Functione4f54 + depixel 26, 0 + call Functione4f54 + depixel 0, 24 + call Functione4f54 + ret + +.asm_e4f41 + depixel 28, 30 + call Functione4f54 + depixel 31, 24 + call Functione4f54 + depixel 2, 28 + call Functione4f54 + ret + +Functione4f54: + ld a, SPRITE_ANIM_INDEX_GS_INTRO_MAGIKARP + call InitSpriteAnimStruct + ret + +Functione4f5a: + depixel 18, 7 + call Functione4f69 + depixel 14, 10 + call Functione4f69 + depixel 16, 15 + +Functione4f69: + ld a, SPRITE_ANIM_INDEX_GS_INTRO_SHELLDER + call InitSpriteAnimStruct + ret + +Functione4f6f: + ld a, [wcb18] + and $1f + ret nz + depixel 16, 24 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_LAPRAS_2 + call InitSpriteAnimStruct + ret + +; unused? +Functione4f7e: + depixel 2, 0 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_LAPRAS + call InitSpriteAnimStruct + ret + +Functione4f87: + push hl + push de + ld a, [wcb13 + 0] + ld e, a + ld a, [wcb13 + 1] + ld d, a + ld hl, -$10 + add hl, de + ld a, l + ld e, l + ld [wcb13 + 0], a + ld a, h + ld d, h + ld [wcb13 + 1], a + hlcoord 0, 0 + ld c, $10 + +.loop + call Functione54ae + dec c + jr nz, .loop + ld a, [wcb11 + 0] + ld e, a + ld a, [wcb11 + 1] + ld d, a + ld hl, hCurSpriteYCoord + add hl, de + ld a, l + ld [wcb11 + 0], a + ld [wRequested2bppDest + 0], a + ld a, h + and $fb + or $08 + ld [wcb11 + 1], a + ld [wRequested2bppDest + 1], a + ld a, LOW(wTilemap) + ld [wRequested2bppSource + 0], a + ld a, HIGH(wTilemap) + ld [wRequested2bppSource + 1], a + ld a, 4 + ld [wRequested2bppSize], a + ld hl, wcb17 + dec [hl] + pop de + pop hl + ret + +Functione4fde: + ld hl, wcb18 + ld a, [hl] + and $03 + cp $03 + ret z + ld a, [wRequested2bppSize] + and a + ret nz + ld a, [hl] + and $30 + swap a + ld l, a + ld h, 0 +rept 5 + add hl, hl +endr + ld de, GFX_e5015 + add hl, de + ld a, l + ld [wRequested2bppSource + 0], a + ld a, h + ld [wRequested2bppSource + 1], a + ld a, LOW(vBGMap0 tile $1e) + ld [wRequested2bppDest + 0], a + ld a, HIGH(vBGMap0 tile $1e) + ld [wRequested2bppDest + 1], a + ld a, 2 + ld [wRequested2bppSize], a + ret + +GFX_e5015: + dr ($e5015 - BANK39_OFFSET), ($e5095 - BANK39_OFFSET) +Functione5095: + dr ($e5095 - BANK39_OFFSET), ($e50af - BANK39_OFFSET) +Functione50af: + dr ($e50af - BANK39_OFFSET), ($e50d8 - BANK39_OFFSET) +IntroScene6: + dr ($e50d8 - BANK39_OFFSET), ($e5156 - BANK39_OFFSET) +IntroScene7: + dr ($e5156 - BANK39_OFFSET), ($e517b - BANK39_OFFSET) +IntroScene8: + dr ($e517b - BANK39_OFFSET), ($e519a - BANK39_OFFSET) +IntroScene9: + dr ($e519a - BANK39_OFFSET), ($e5209 - BANK39_OFFSET) +IntroScene10: + dr ($e5209 - BANK39_OFFSET), ($e529f - BANK39_OFFSET) +IntroScene11: + dr ($e529f - BANK39_OFFSET), ($e52bb - BANK39_OFFSET) +IntroScene12: + dr ($e52bb - BANK39_OFFSET), ($e52e8 - BANK39_OFFSET) +IntroScene13: + dr ($e52e8 - BANK39_OFFSET), ($e5300 - BANK39_OFFSET) +IntroScene14: + dr ($e5300 - BANK39_OFFSET), ($e5321 - BANK39_OFFSET) +IntroScene15: + dr ($e5321 - BANK39_OFFSET), ($e5336 - BANK39_OFFSET) +IntroScene16: + dr ($e5336 - BANK39_OFFSET), ($e5498 - BANK39_OFFSET) +Functione5498: + dr ($e5498 - BANK39_OFFSET), ($e54ae - BANK39_OFFSET) +Functione54ae: + dr ($e54ae - BANK39_OFFSET), ($e54dd - BANK39_OFFSET) +Functione54dd: + dr ($e54dd - BANK39_OFFSET), ($e54e8 - BANK39_OFFSET) +GFX_e54e8: + dr ($e54e8 - BANK39_OFFSET), ($e5ab8 - BANK39_OFFSET) +GFX_e5ab8: + dr ($e5ab8 - BANK39_OFFSET), ($e5bc8 - BANK39_OFFSET) +GFX_e5bc8: + dr ($e5bc8 - BANK39_OFFSET), ($e5cd8 - BANK39_OFFSET) +GFX_e5cd8: + dr ($e5cd8 - BANK39_OFFSET), ($e7678 - BANK39_OFFSET) -- cgit v1.2.3 From 07183b5d2c1aa712da707d54e16deb65780be9e4 Mon Sep 17 00:00:00 2001 From: entrpntr Date: Fri, 5 Jun 2020 21:39:46 -0400 Subject: A bit more progress. --- engine/gfx/color.asm | 2 +- engine/movie/gs_intro.asm | 615 ++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 599 insertions(+), 18 deletions(-) (limited to 'engine') diff --git a/engine/gfx/color.asm b/engine/gfx/color.asm index f806a0c8..714c76f8 100644 --- a/engine/gfx/color.asm +++ b/engine/gfx/color.asm @@ -172,7 +172,7 @@ Function9102: RGB 08, 16, 28 RGB 00, 00, 00 -Unreferenced_Function9136: +Function9136: call CheckCGB ret nz ldh a, [hSGB] diff --git a/engine/movie/gs_intro.asm b/engine/movie/gs_intro.asm index f6c691a1..4cace4d7 100644 --- a/engine/movie/gs_intro.asm +++ b/engine/movie/gs_intro.asm @@ -511,38 +511,605 @@ endr GFX_e5015: dr ($e5015 - BANK39_OFFSET), ($e5095 - BANK39_OFFSET) + Functione5095: - dr ($e5095 - BANK39_OFFSET), ($e50af - BANK39_OFFSET) + ld bc, $c7a0 ; ? + ld a, $90 ; ? + ld de, $0400 ; ? + +.loop + push af + push de + farcall BattleAnim_Sine_e + ld a, e + ld [bc], a + inc bc + pop de + inc e + pop af + dec a + jr nz, .loop + ret + Functione50af: - dr ($e50af - BANK39_OFFSET), ($e50d8 - BANK39_OFFSET) + ld bc, $c700 ; ? + ld e, $10 ; ? + +.loop1 + ldh a, [hSCY] + ld [bc], a + inc bc + dec e + jr nz, .loop1 + + ld hl, $c7a0 ; ? + ld de, $c7a1 ; ? + ld a, [hl] + push af + ld a, $80 ; ? + +.loop2 + push af + ld a, [de] + inc de + ld [hli], a + push hl + ld hl, hSCY + add [hl] + ld [bc], a + inc bc + pop hl + pop af + dec a + jr nz, .loop2 + pop af + ld [hl], a + ret + IntroScene6: - dr ($e50d8 - BANK39_OFFSET), ($e5156 - BANK39_OFFSET) + ld hl, wIntroJumptableIndex + inc [hl] + call DisableLCD + callfar ClearSpriteAnims + call Functione54dd + ld de, vTiles2 + ld hl, GFX_e6058 + call Decompress + ld a, LOW(GFX_e6338) + ld [wcb15 + 0], a + ld a, HIGH(GFX_e6338) + ld [wcb15 + 1], a + ld hl, vBGMap0 + ld a, l + ld [wcb11 + 0], a + ld a, h + ld [wcb11 + 1], a + ld de, GFX_e6238 + ld a, e + ld [wcb13 + 0], a + ld a, d + ld [wcb13 + 1], a + call Functione5498 + ld de, vTiles0 + ld hl, GFX_e63a8 + call Decompress + ld hl, $c508 ; ? + ld a, $01 + ld [hli], a + ld a, $00 + ld [hli], a + xor a + ldh [hSCY], a + ld [wGlobalAnimYOffset], a + ld a, $60 + ldh [hSCX], a + ld a, $a0 + ld [wGlobalAnimXOffset], a + xor a + ld [wcb18], a + call EnableLCD + ld b, SCGB_GS_INTRO + ld c, 1 + call GetSGBLayout + ld a, %11100100 + call DmgToCgbBGPals + depixel 28, 28, 4, 4 + call DmgToCgbObjPals + call Functione51ef + xor a + ld [wcb19], a + ret + IntroScene7: - dr ($e5156 - BANK39_OFFSET), ($e517b - BANK39_OFFSET) + call Functione51cc + ld hl, wcb18 + ld a, [hl] + inc [hl] + and $03 + ret z + ld hl, hSCX + ld a, [hl] + and a + jr z, .asm_e516e + dec [hl] + ld hl, wGlobalAnimXOffset + inc [hl] + ret + +.asm_e516e + ld a, -1 + ld [wcb17], a + call Functione51f8 + ld hl, wIntroJumptableIndex + inc [hl] + ret + IntroScene8: - dr ($e517b - BANK39_OFFSET), ($e519a - BANK39_OFFSET) + ld hl, wcb17 + ld a, [hl] + and a + jr z, .asm_e518b + dec [hl] + call Functione51cc + ld hl, wcb18 + inc [hl] + ret + +.asm_e518b: + xor a + ld [wcb17], a + ld hl, wIntroJumptableIndex + inc [hl] + callfar Function9136 + ret + IntroScene9: - dr ($e519a - BANK39_OFFSET), ($e5209 - BANK39_OFFSET) + ld hl, wcb17 + ld a, [hl] + inc [hl] + srl a + srl a + srl a + ld e, a + ld d, 0 + ld hl, .pals + add hl, de + ld a, [hl] + cp -1 + jr z, .done + call DmgToCgbBGPals + ld hl, hSCY + inc [hl] + ld hl, wGlobalAnimYOffset + dec [hl] + ret + +.done + ld hl, wIntroJumptableIndex + inc [hl] + ret + +.pals + db %11100100, %11100100, %11100100, %11100100 + db %11100100, %10010000, %01000000, %00000000 + db -1 + + ret ; unused + +Functione51cc: + ld a, [wcb19] + and a + ret nz + ld hl, wcb18 + ld a, [hl] + and $3f + ret nz + ld a, [hl] + and $7f + jr z, .asm_e51e6 + depixel 11, 6, 4, 0 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_NOTE + call InitSpriteAnimStruct + ret + +.asm_e51e6: + depixel 10, 6, 4, 0 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_INVISIBLE_NOTE + call InitSpriteAnimStruct + ret + +Functione51ef: + depixel 14, 6 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_JIGGLYPUFF + call InitSpriteAnimStruct + ret + +Functione51f8: + depixel 14, 24 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_PIKACHU + call InitSpriteAnimStruct + depixel 14, 24 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_PIKACHU_TAIL + call InitSpriteAnimStruct + ret + IntroScene10: - dr ($e5209 - BANK39_OFFSET), ($e529f - BANK39_OFFSET) + ld hl, wIntroJumptableIndex + inc [hl] + call DisableLCD + callfar ClearSpriteAnims + call Functione54dd + call Functione5361 + ld de, vTiles2 + ld hl, GFX_e6908 + call Decompress + ld de, vTiles1 + ld hl, GFX_e6e48 + call Decompress + ld de, vTiles0 + ld hl, GFX_e71c8 + ld bc, vTiles1 - vTiles0 + call Decompress + ld c, CHIKORITA + ld de, vTiles0 tile $10 + farcall Function1587f + ld c, CYNDAQUIL + ld de, vTiles0 tile $29 + farcall Function1587f + ld c, TOTODILE + ld de, vTiles0 tile $42 + farcall Function1587f + ld hl, $c508 ; ? + ld a, $01 + ld [hli], a + ld a, $00 + ld [hli], a + call EnableLCD + ld a, LOW(vTiles0) + call Functione5422 + ld a, HIGH(vTiles0) + ldh [hSCY], a + xor a + ldh [hSCX], a + ld [wGlobalAnimYOffset], a + ld [wGlobalAnimXOffset], a + xor a + ld [wcb18], a + ld b, SCGB_GS_INTRO + ld c, $02 + call GetSGBLayout + ld a, %00111111 + call DmgToCgbBGPals + lb de, %11111111, %11111111 + call DmgToCgbObjPals + ld de, MUSIC_NONE + call PlayMusic + call DelayFrame + ld de, MUSIC_GS_OPENING_2 + call PlayMusic + ret + IntroScene11: - dr ($e529f - BANK39_OFFSET), ($e52bb - BANK39_OFFSET) + ld hl, wcb18 + ld a, [hl] + inc [hl] + and $01 + ret z + call Functione5376 + ld hl, hSCY + ld a, [hl] + and a + jr z, .asm_e52b3 + inc [hl] + ret + +.asm_e52b3 + ld hl, wIntroJumptableIndex + inc [hl] + xor a + ld [wcb17], a +; fall through IntroScene12: - dr ($e52bb - BANK39_OFFSET), ($e52e8 - BANK39_OFFSET) + ld hl, wcb17 + ld a, [hl] + inc [hl] + srl a + srl a + and $03 + ld e, a + ld d, 0 + ld hl, .pals + add hl, de + ld a, [hl] + and a + jr z, .asm_e52da + call DmgToCgbBGPals + ld e, a + ld d, a + call DmgToCgbObjPals + ret + +.asm_e52da + ld hl, wIntroJumptableIndex + inc [hl] + ld a, $80 ; ? + ld [wcb17], a + ret + +.pals + db %01101010, %10100101, %11100100, %00000000 + IntroScene13: - dr ($e52e8 - BANK39_OFFSET), ($e5300 - BANK39_OFFSET) + ld hl, wcb17 + ld a, [hl] + and a + jr z, .asm_e52f1 + dec [hl] + ret + +.asm_e52f1 + ld hl, wIntroJumptableIndex + inc [hl] + ld a, $01 + call Functione5422 + ld a, $04 + ld [wcb17], a + ret + IntroScene14: - dr ($e5300 - BANK39_OFFSET), ($e5321 - BANK39_OFFSET) + ld hl, wcb17 + ld a, [hl] + and a + jr z, .asm_e5309 + dec [hl] + ret + +.asm_e5309 + ld hl, wIntroJumptableIndex + inc [hl] + ld a, $02 + call Functione5422 + ld a, $40 + ld [wcb17], a + xor a + ld [wcb18], a + ld de, SFX_GS_INTRO_CHARIZARD_FIREBALL + call PlaySFX +; fall through IntroScene15: - dr ($e5321 - BANK39_OFFSET), ($e5336 - BANK39_OFFSET) + call Functione5473 + ld hl, wcb17 + ld a, [hl] + and a + jr z, .asm_e532d + dec [hl] + ret + +.asm_e532d: + ld hl, wIntroJumptableIndex + inc [hl] + xor a + ld [wcb17], a + ret + IntroScene16: - dr ($e5336 - BANK39_OFFSET), ($e5498 - BANK39_OFFSET) + call Functione5473 + ld hl, wcb17 + ld a, [hl] + inc [hl] + swap a + and $07 + ld e, a + ld d, 0 + ld hl, .pals + add hl, de + ld a, [hl] + cp -1 + jr z, .asm_e5357 + call DmgToCgbBGPals + ld e, a + ld d, a + call DmgToCgbObjPals + ret + +.asm_e5357: + ld hl, wIntroJumptableIndex + inc [hl] + ret + +.pals + db %11100100, %10010000, %01000000, %00000000 + db -1 + +Functione5361: + hlcoord 0, 0 + ld bc, wTilemapEnd - wTilemap + xor a + call ByteFill + ld hl, vBGMap0 + ld bc, vBGMap1 - vBGMap0 + xor a + call ByteFill + ret + +Functione5376: + ldh a, [hSCY] + ld c, a + ld hl, .unknown_e538b + +.asm_e537c: + ld a, [hli] + cp -1 + ret z + cp c + jr z, .asm_e5387 + inc hl + inc hl + jr .asm_e537c + +.asm_e5387: + ld a, [hli] + ld h, [hl] + ld l, a + jp hl + +.unknown_e538b + dr ($e538b - BANK39_OFFSET), ($e5422 - BANK39_OFFSET) + +Functione5422: + push af + hlcoord 0, 6 + ld c, $a0 + xor a +.loop1 + ld [hli], a + dec c + jr nz, .loop1 + + pop af + ld e, a + ld d, 0 + ld hl, .unknown_e5464 +rept 5 + add hl, de +endr + ld e, [hl] + inc hl + ld c, [hl] + inc hl + ld b, [hl] + inc hl + ld a, [hli] + ld h, [hl] + ld l, a + ld a, e + +.loop2_outer + push bc + push hl +.loop2_inner + ld [hli], a + inc a + dec c + jr nz, .loop2_inner + pop hl + ld bc, $0014 + add hl, bc + pop bc + dec b + jr nz, .loop2_outer + + ld a, $1 + ldh [hBGMapMode], a + call DelayFrame + call DelayFrame + call DelayFrame + xor a + ldh [hBGMapMode], a + ret + +.unknown_e5464 + db $00, $08, $08, $22, $c4 + db $40, $09, $08, $21, $c4 + db $88, $09, $08, $20, $c4 + +Functione5473: + ld hl, wcb18 + ld a, [hl] + inc [hl] + and $03 + ret nz + depixel 12, 10, 4, 4 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_FIREBALL + call InitSpriteAnimStruct + ld hl, hSCX + dec [hl] + ld hl, wGlobalAnimXOffset + inc [hl] + ret + +Functione548c: + ld bc, $0800 +.loop + ld a, [de] + inc de + ld [hli], a + dec bc + ld a, c + or b + jr nz, .loop + ret + Functione5498: - dr ($e5498 - BANK39_OFFSET), ($e54ae - BANK39_OFFSET) + ld b, $10 +.loop_outer + push hl + ld c, $10 +.loop_inner + call Functione54ae + dec c + jr nz, .loop_inner + pop hl + push bc + ld bc, $0040 + add hl, bc + pop bc + dec b + jr nz, .loop_outer + ret + Functione54ae: - dr ($e54ae - BANK39_OFFSET), ($e54dd - BANK39_OFFSET) + push bc + push de + push hl + push hl + push hl + ld a, [de] + ld l, a + ld h, $00 + ld a, [wcb15 + 0] + ld e, a + ld a, [wcb15 + 1] + ld d, a + add hl, hl + add hl, hl + add hl, de + ld e, l + ld d, h + pop hl + ld a, [de] + inc de + ld [hli], a + ld a, [de] + inc de + ld [hli], a + pop hl + ld bc, $0020 + add hl, bc + ld a, [de] + inc de + ld [hli], a + ld a, [de] + inc de + ld [hli], a + pop hl + inc hl + inc hl + pop de + inc de + pop bc + ret + Functione54dd: - dr ($e54dd - BANK39_OFFSET), ($e54e8 - BANK39_OFFSET) + ld hl, $c700 ; ? + xor a + ld c, $a0 +.loop + ld [hli], a + dec c + jr nz, .loop + ret + GFX_e54e8: dr ($e54e8 - BANK39_OFFSET), ($e5ab8 - BANK39_OFFSET) GFX_e5ab8: @@ -550,4 +1117,18 @@ GFX_e5ab8: GFX_e5bc8: dr ($e5bc8 - BANK39_OFFSET), ($e5cd8 - BANK39_OFFSET) GFX_e5cd8: - dr ($e5cd8 - BANK39_OFFSET), ($e7678 - BANK39_OFFSET) + dr ($e5cd8 - BANK39_OFFSET), ($e6058 - BANK39_OFFSET) +GFX_e6058: + dr ($e6058 - BANK39_OFFSET), ($e6238 - BANK39_OFFSET) +GFX_e6238: + dr ($e6238 - BANK39_OFFSET), ($e6338 - BANK39_OFFSET) +GFX_e6338: + dr ($e6338 - BANK39_OFFSET), ($e63a8 - BANK39_OFFSET) +GFX_e63a8: + dr ($e63a8 - BANK39_OFFSET), ($e6908 - BANK39_OFFSET) +GFX_e6908: + dr ($e6908 - BANK39_OFFSET), ($e6e48 - BANK39_OFFSET) +GFX_e6e48: + dr ($e6e48 - BANK39_OFFSET), ($e71c8 - BANK39_OFFSET) +GFX_e71c8: + dr ($e71c8 - BANK39_OFFSET), ($e7678 - BANK39_OFFSET) -- cgit v1.2.3 From 11f01dbcd8013d24750d10874d12bc0c534ac7e9 Mon Sep 17 00:00:00 2001 From: entrpntr Date: Wed, 10 Jun 2020 11:03:58 -0400 Subject: Slowly getting there. --- engine/gfx/color.asm | 2 +- engine/gfx/load_pics.asm | 2 +- engine/gfx/sprite_anims.asm | 10 +- engine/movie/gs_intro.asm | 538 ++++++++++++++++++++++++++------------------ 4 files changed, 322 insertions(+), 230 deletions(-) (limited to 'engine') diff --git a/engine/gfx/color.asm b/engine/gfx/color.asm index 714c76f8..0db1ee27 100644 --- a/engine/gfx/color.asm +++ b/engine/gfx/color.asm @@ -211,7 +211,7 @@ Unreferenced_Function915e: call GetPredefPal jp LoadHLPaletteIntoDE -Unreferenced_Function9178: +Function9178: call CheckCGB jr nz, .cgb ldh a, [hSGB] diff --git a/engine/gfx/load_pics.asm b/engine/gfx/load_pics.asm index c9ee98b7..aac168db 100644 --- a/engine/gfx/load_pics.asm +++ b/engine/gfx/load_pics.asm @@ -216,7 +216,7 @@ FixPicBank: db $1f, $2e db -1 -Function1587f: +GSIntroGetMonFrontpic: ld a, c push de ld hl, PokemonPicPointers diff --git a/engine/gfx/sprite_anims.asm b/engine/gfx/sprite_anims.asm index a6e717e8..e9d63d44 100644 --- a/engine/gfx/sprite_anims.asm +++ b/engine/gfx/sprite_anims.asm @@ -309,8 +309,8 @@ DoAnimFrame: .asm_8d602 call DeinitializeSprite - ld a, $1 - ld [wBattleMonLevel], a + ld a, 1 + ld [wcb19], a ret .Function8d60b @@ -392,7 +392,7 @@ DoAnimFrame: dw .Function8d680 .Function8d673 - ld a, [wBattleMonLevel] + ld a, [wcb19] and a ret z call .IncrementJumptableIndex @@ -479,7 +479,7 @@ DoAnimFrame: .asm_8d6e9 ld a, 1 - ld [wBattleMonLevel], a + ld [wcb19], a call .IncrementJumptableIndex ret @@ -562,7 +562,7 @@ DoAnimFrame: jr z, .asm_8d761 dec [hl] dec [hl] - ld a, [wBattleMonLevel] + ld a, [wcb19] and a ret nz dec [hl] diff --git a/engine/movie/gs_intro.asm b/engine/movie/gs_intro.asm index 4cace4d7..86f53317 100644 --- a/engine/movie/gs_intro.asm +++ b/engine/movie/gs_intro.asm @@ -1,17 +1,11 @@ -IF DEF(_GOLD) -BANK39_OFFSET EQU 0 -ELIF DEF(_SILVER) -BANK39_OFFSET EQU $1b8 -ENDC - GoldSilverIntro: - call .InitRAMAddrs + call .Init .loop call .JoypadLoop jr nc, .loop ret -.InitRAMAddrs: +.Init: farcall ClearSpriteAnims xor a ld [wIntroJumptableIndex], a @@ -50,18 +44,9 @@ GoldSilverIntro: ret IntroSceneJumper: - ld a, [wIntroJumptableIndex] - ld e, a - ld d, 0 - ld hl, IntroScenes - add hl, de - add hl, de - ld a, [hli] - ld h, [hl] - ld l, a - jp hl + jumptable .IntroScenes, wIntroJumptableIndex -IntroScenes: +.IntroScenes: dw IntroScene1 dw IntroScene2 dw IntroScene3 @@ -81,10 +66,11 @@ IntroScenes: dw IntroScene17 IntroScene1: +; Set up water cutscene (Shellders/Magikarp/Lapras) call ClearBGPalettes call ClearTilemap ld hl, wIntroJumptableIndex - inc [hl] + inc [hl] ; only run once call DisableLCD xor a ldh [hBGMapMode], a @@ -97,27 +83,27 @@ IntroScene1: call ByteFill ld a, 0 ldh [rVBK], a - call Functione54dd + call Intro_ResetLYOverrides ld de, vTiles2 tile $00 - ld hl, GFX_e54e8 + ld hl, GSIntroWaterGFX1 call Decompress - ld a, LOW(GFX_e5bc8) - ld [wcb15 + 0], a - ld a, HIGH(GFX_e5bc8) - ld [wcb15 + 1], a + ld a, LOW(GSIntroWaterMeta) + ld [wIntroTilesPointer + 0], a + ld a, HIGH(GSIntroWaterMeta) + ld [wIntroTilesPointer + 1], a hlbgcoord 0, 0, vBGMap2 ld a, l - ld [wcb11 + 0], a + ld [wIntroBGMapPointer + 0], a ld a, h - ld [wcb11 + 1], a - ld de, GFX_e5ab8 + ld [wIntroBGMapPointer + 1], a + ld de, GSIntroWaterTilemap + 15 tiles ld a, e - ld [wcb13 + 0], a + ld [wIntroTilemapPointer + 0], a ld a, d - ld [wcb13 + 1], a + ld [wIntroTilemapPointer + 1], a call Functione5498 ld de, vTiles0 tile $00 - ld hl, GFX_e5cd8 + ld hl, GSIntroWaterGFX2 call Decompress ld hl, wSpriteAnimDict ld a, 0 @@ -130,10 +116,10 @@ IntroScene1: ld [wGlobalAnimXOffset], a ld a, $58 ldh [hSCX], a - xor a ; LOW(vTiles0 tile $00) - ld [wcb17 + 1], a - ld a, HIGH(vTiles0 tile $00) - ld [wcb17 + 0], a + xor a + ld [wIntroSceneFrameCounter2], a + ld a, $80 + ld [wIntroSceneFrameCounter1], a ld a, $42 ldh [hLCDCPointer], a call Functione5095 @@ -148,19 +134,20 @@ IntroScene1: call DmgToCgbBGPals depixel 28, 28 call DmgToCgbObjPals - call Functione4f5a + call InitShellders ld de, MUSIC_GS_OPENING call PlayMusic ret IntroScene2: +; shellders underwater call Functione50af - ld hl, wcb17 + ld hl, wIntroSceneFrameCounter1 ld a, [hl] and a jr z, .asm_e4df5 dec [hl] - call Functione4ef0 + call InitBubble ret .asm_e4df5: @@ -169,20 +156,23 @@ IntroScene2: inc [hl] IntroScene3: +; rise towards the surface call Functione4e90 call Functione4e67 ret nc - call Functione54dd +.next + call Intro_ResetLYOverrides ld hl, hSCY inc [hl] ld hl, wIntroJumptableIndex inc [hl] IntroScene4: +; at surface, Lapras surfs to left of screen ld a, [wcb19] and a - jr nz, .asm_e4e25 - ld hl, wcb18 + jr nz, .next + ld hl, wIntroSceneFrameCounter2 inc [hl] ld a, [hl] and $0f @@ -191,18 +181,19 @@ IntroScene4: dec [hl] dec [hl] -.asm_e4e21: +.asm_e4e21 call Functione4fde ret -.asm_e4e25: +.next ld hl, wIntroJumptableIndex inc [hl] xor a - ld [wcb17], a + ld [wIntroSceneFrameCounter1], a IntroScene5: - ld hl, wcb17 +; fade out + ld hl, wIntroSceneFrameCounter1 ld a, [hl] inc [hl] swap a @@ -213,7 +204,7 @@ IntroScene5: add hl, de ld a, [hl] cp -1 - jr z, .asm_e4e4e + jr z, .next call DmgToCgbBGPals call Functione4fde ld hl, hSCX @@ -221,7 +212,7 @@ IntroScene5: dec [hl] ret -.asm_e4e4e +.next ld hl, wIntroJumptableIndex inc [hl] ret @@ -231,6 +222,7 @@ IntroScene5: db -1 IntroScene17: +; delay a bit before leading into the title screen ld c, 64 .loop call DelayFrame @@ -241,7 +233,7 @@ IntroScene17: ret Functione4e67: - ld hl, wcb18 + ld hl, wIntroSceneFrameCounter2 inc [hl] ld a, [hl] and $03 @@ -259,7 +251,7 @@ Functione4e67: dec [hl] and $0f call z, Functione4f87 - ld a, [wcb17] + ld a, [wIntroSceneFrameCounter1] and a jr z, .asm_e4e8e @@ -272,16 +264,7 @@ Functione4e67: ret Functione4e90: - ld a, [wcb17] - ld e, a - ld d, 0 - ld hl, .dw - add hl, de - add hl, de - ld a, [hli] - ld h, [hl] - ld l, a - jp hl + jumptable .dw, wIntroSceneFrameCounter1 .dw dw Functione4eca @@ -303,7 +286,7 @@ Functione4e90: dw Functione4eec Functione4ec1: - call Functione4f6f + call InitLapras depixel 28, 28, 4, 4 call DmgToCgbObjPals ; fall through @@ -312,16 +295,16 @@ Functione4eca: ret Functione4ece: - call Functione4f19 + call InitMagikarps call Functione4fde ret Functione4ed5: - ld hl, wcb18 + ld hl, wIntroSceneFrameCounter2 ld a, [hl] - and $1f + and %00011111 jr z, .asm_e4ee1 - call Functione4f19 + call InitMagikarps ret .asm_e4ee1 @@ -337,8 +320,8 @@ Functione4eec: call Functione50af ret -Functione4ef0: - ld hl, wcb17 +InitBubble: + ld hl, wIntroSceneFrameCounter1 ld a, [hl] and $0f ret nz @@ -365,15 +348,15 @@ Functione4ef0: db 4 * 8, 13 * 8 db 8 * 8, 17 * 8 -Functione4f19: +InitMagikarps: depixel 8, 7, 0, 7 ldh a, [hSGB] and a - jr z, .asm_e4f24 + jr z, .ok depixel 4, 3, 0, 7 -.asm_e4f24 - ld hl, wcb18 +.ok + ld hl, wIntroSceneFrameCounter2 ld a, [hl] and e ret nz @@ -381,50 +364,49 @@ Functione4f19: and d jr nz, .asm_e4f41 depixel 29, 28 - call Functione4f54 + call .InitAnim depixel 26, 0 - call Functione4f54 + call .InitAnim depixel 0, 24 - call Functione4f54 + call .InitAnim ret .asm_e4f41 depixel 28, 30 - call Functione4f54 + call .InitAnim depixel 31, 24 - call Functione4f54 + call .InitAnim depixel 2, 28 - call Functione4f54 + call .InitAnim ret -Functione4f54: +.InitAnim: ld a, SPRITE_ANIM_INDEX_GS_INTRO_MAGIKARP call InitSpriteAnimStruct ret -Functione4f5a: +InitShellders: depixel 18, 7 - call Functione4f69 + call .InitAnim depixel 14, 10 - call Functione4f69 + call .InitAnim depixel 16, 15 -Functione4f69: +.InitAnim: ld a, SPRITE_ANIM_INDEX_GS_INTRO_SHELLDER call InitSpriteAnimStruct ret -Functione4f6f: - ld a, [wcb18] - and $1f +InitLapras: + ld a, [wIntroSceneFrameCounter2] + and %00011111 ret nz depixel 16, 24 ld a, SPRITE_ANIM_INDEX_GS_INTRO_LAPRAS_2 call InitSpriteAnimStruct ret -; unused? -Functione4f7e: +UnusedInitLapras: depixel 2, 0 ld a, SPRITE_ANIM_INDEX_GS_INTRO_LAPRAS call InitSpriteAnimStruct @@ -433,18 +415,18 @@ Functione4f7e: Functione4f87: push hl push de - ld a, [wcb13 + 0] + ld a, [wIntroTilemapPointer + 0] ld e, a - ld a, [wcb13 + 1] + ld a, [wIntroTilemapPointer + 1] ld d, a ld hl, -$10 add hl, de ld a, l ld e, l - ld [wcb13 + 0], a + ld [wIntroTilemapPointer + 0], a ld a, h ld d, h - ld [wcb13 + 1], a + ld [wIntroTilemapPointer + 1], a hlcoord 0, 0 ld c, $10 @@ -452,19 +434,19 @@ Functione4f87: call Functione54ae dec c jr nz, .loop - ld a, [wcb11 + 0] + ld a, [wIntroBGMapPointer + 0] ld e, a - ld a, [wcb11 + 1] + ld a, [wIntroBGMapPointer + 1] ld d, a ld hl, hCurSpriteYCoord add hl, de ld a, l - ld [wcb11 + 0], a + ld [wIntroBGMapPointer + 0], a ld [wRequested2bppDest + 0], a ld a, h and $fb or $08 - ld [wcb11 + 1], a + ld [wIntroBGMapPointer + 1], a ld [wRequested2bppDest + 1], a ld a, LOW(wTilemap) ld [wRequested2bppSource + 0], a @@ -472,14 +454,14 @@ Functione4f87: ld [wRequested2bppSource + 1], a ld a, 4 ld [wRequested2bppSize], a - ld hl, wcb17 + ld hl, wIntroSceneFrameCounter1 dec [hl] pop de pop hl ret Functione4fde: - ld hl, wcb18 + ld hl, wIntroSceneFrameCounter2 ld a, [hl] and $03 cp $03 @@ -495,7 +477,7 @@ Functione4fde: rept 5 add hl, hl endr - ld de, GFX_e5015 + ld de, .data_e5015 add hl, de ld a, l ld [wRequested2bppSource + 0], a @@ -509,13 +491,24 @@ endr ld [wRequested2bppSize], a ret -GFX_e5015: - dr ($e5015 - BANK39_OFFSET), ($e5095 - BANK39_OFFSET) +.data_e5015 +rept 8 + db $70, $71, $72, $73 +endr +rept 8 + db $74, $75, $76, $77 +endr +rept 8 + db $78, $79, $7a, $7b +endr +rept 8 + db $7c, $7d, $7e, $7f +endr Functione5095: - ld bc, $c7a0 ; ? - ld a, $90 ; ? - ld de, $0400 ; ? + ld bc, wLYOverrides2 + ld a, wLYOverrides2End - wLYOverrides2 + ld de, vBGMap1 - vBGMap0 .loop push af @@ -532,8 +525,8 @@ Functione5095: ret Functione50af: - ld bc, $c700 ; ? - ld e, $10 ; ? + ld bc, wLYOverrides + ld e, $10 .loop1 ldh a, [hSCY] @@ -542,11 +535,11 @@ Functione50af: dec e jr nz, .loop1 - ld hl, $c7a0 ; ? - ld de, $c7a1 ; ? + ld hl, wLYOverrides2 + ld de, wLYOverrides2 + 1 ld a, [hl] push af - ld a, $80 ; ? + ld a, $80 .loop2 push af @@ -567,33 +560,34 @@ Functione50af: ret IntroScene6: +; Set up grass cutscene (Pikachu/Jigglypuff) ld hl, wIntroJumptableIndex inc [hl] call DisableLCD callfar ClearSpriteAnims - call Functione54dd + call Intro_ResetLYOverrides ld de, vTiles2 - ld hl, GFX_e6058 + ld hl, GSIntroGrassGFX1 call Decompress - ld a, LOW(GFX_e6338) - ld [wcb15 + 0], a - ld a, HIGH(GFX_e6338) - ld [wcb15 + 1], a + ld a, LOW(GSIntroGrassMeta) + ld [wIntroTilesPointer + 0], a + ld a, HIGH(GSIntroGrassMeta) + ld [wIntroTilesPointer + 1], a ld hl, vBGMap0 ld a, l - ld [wcb11 + 0], a + ld [wIntroBGMapPointer + 0], a ld a, h - ld [wcb11 + 1], a - ld de, GFX_e6238 + ld [wIntroBGMapPointer + 1], a + ld de, GSIntroGrassTilemap ld a, e - ld [wcb13 + 0], a + ld [wIntroTilemapPointer + 0], a ld a, d - ld [wcb13 + 1], a + ld [wIntroTilemapPointer + 1], a call Functione5498 ld de, vTiles0 - ld hl, GFX_e63a8 + ld hl, GSIntroGrassGFX2 call Decompress - ld hl, $c508 ; ? + ld hl, wSpriteAnimDict ld a, $01 ld [hli], a ld a, $00 @@ -606,7 +600,7 @@ IntroScene6: ld a, $a0 ld [wGlobalAnimXOffset], a xor a - ld [wcb18], a + ld [wIntroSceneFrameCounter2], a call EnableLCD ld b, SCGB_GS_INTRO ld c, 1 @@ -615,14 +609,15 @@ IntroScene6: call DmgToCgbBGPals depixel 28, 28, 4, 4 call DmgToCgbObjPals - call Functione51ef + call InitJigglypuffAnim xor a ld [wcb19], a ret IntroScene7: - call Functione51cc - ld hl, wcb18 +; scroll left to Jigglypuff + call InitNoteAnim + ld hl, wIntroSceneFrameCounter2 ld a, [hl] inc [hl] and $03 @@ -630,41 +625,43 @@ IntroScene7: ld hl, hSCX ld a, [hl] and a - jr z, .asm_e516e + jr z, .next dec [hl] ld hl, wGlobalAnimXOffset inc [hl] ret -.asm_e516e +.next ld a, -1 - ld [wcb17], a - call Functione51f8 + ld [wIntroSceneFrameCounter1], a + call InitPikachuAnim ld hl, wIntroJumptableIndex inc [hl] ret IntroScene8: - ld hl, wcb17 +; stop scrolling, Pikachu attacks + ld hl, wIntroSceneFrameCounter1 ld a, [hl] and a - jr z, .asm_e518b + jr z, .next dec [hl] - call Functione51cc - ld hl, wcb18 + call InitNoteAnim + ld hl, wIntroSceneFrameCounter2 inc [hl] ret -.asm_e518b: +.next xor a - ld [wcb17], a + ld [wIntroSceneFrameCounter1], a ld hl, wIntroJumptableIndex inc [hl] callfar Function9136 ret IntroScene9: - ld hl, wcb17 +; scroll down and fade out + ld hl, wIntroSceneFrameCounter1 ld a, [hl] inc [hl] srl a @@ -696,35 +693,35 @@ IntroScene9: ret ; unused -Functione51cc: +InitNoteAnim: ld a, [wcb19] and a ret nz - ld hl, wcb18 + ld hl, wIntroSceneFrameCounter2 ld a, [hl] - and $3f + and %00111111 ret nz ld a, [hl] - and $7f - jr z, .asm_e51e6 + and %01111111 + jr z, .invisible depixel 11, 6, 4, 0 ld a, SPRITE_ANIM_INDEX_GS_INTRO_NOTE call InitSpriteAnimStruct ret -.asm_e51e6: +.invisible depixel 10, 6, 4, 0 ld a, SPRITE_ANIM_INDEX_GS_INTRO_INVISIBLE_NOTE call InitSpriteAnimStruct ret -Functione51ef: +InitJigglypuffAnim: depixel 14, 6 ld a, SPRITE_ANIM_INDEX_GS_INTRO_JIGGLYPUFF call InitSpriteAnimStruct ret -Functione51f8: +InitPikachuAnim: depixel 14, 24 ld a, SPRITE_ANIM_INDEX_GS_INTRO_PIKACHU call InitSpriteAnimStruct @@ -734,47 +731,48 @@ Functione51f8: ret IntroScene10: +; Set up fireball cutscene (Charizard, Johto starters) ld hl, wIntroJumptableIndex inc [hl] call DisableLCD callfar ClearSpriteAnims - call Functione54dd + call Intro_ResetLYOverrides call Functione5361 ld de, vTiles2 - ld hl, GFX_e6908 + ld hl, GSIntroCharizardGFX1 call Decompress ld de, vTiles1 - ld hl, GFX_e6e48 + ld hl, GSIntroCharizardGFX2 call Decompress ld de, vTiles0 - ld hl, GFX_e71c8 + ld hl, GSIntroCharizardGFX3 ld bc, vTiles1 - vTiles0 call Decompress ld c, CHIKORITA ld de, vTiles0 tile $10 - farcall Function1587f + farcall GSIntroGetMonFrontpic ld c, CYNDAQUIL ld de, vTiles0 tile $29 - farcall Function1587f + farcall GSIntroGetMonFrontpic ld c, TOTODILE ld de, vTiles0 tile $42 - farcall Function1587f - ld hl, $c508 ; ? + farcall GSIntroGetMonFrontpic + ld hl, wSpriteAnimDict ld a, $01 ld [hli], a ld a, $00 ld [hli], a call EnableLCD - ld a, LOW(vTiles0) + ld a, 0 call Functione5422 - ld a, HIGH(vTiles0) + ld a, $80 ldh [hSCY], a xor a ldh [hSCX], a ld [wGlobalAnimYOffset], a ld [wGlobalAnimXOffset], a xor a - ld [wcb18], a + ld [wIntroSceneFrameCounter2], a ld b, SCGB_GS_INTRO ld c, $02 call GetSGBLayout @@ -790,111 +788,115 @@ IntroScene10: ret IntroScene11: - ld hl, wcb18 +; scroll up to Charizard silhoutte, flash Johto starters + ld hl, wIntroSceneFrameCounter2 ld a, [hl] inc [hl] and $01 ret z - call Functione5376 + call CheckSCYEvents ld hl, hSCY ld a, [hl] and a - jr z, .asm_e52b3 + jr z, .done_scrolling inc [hl] ret -.asm_e52b3 +.done_scrolling ld hl, wIntroJumptableIndex inc [hl] xor a - ld [wcb17], a -; fall through + ld [wIntroSceneFrameCounter1], a IntroScene12: - ld hl, wcb17 +; load Charizard palettes + ld hl, wIntroSceneFrameCounter1 ld a, [hl] inc [hl] srl a srl a - and $03 + and %11 ld e, a ld d, 0 ld hl, .pals add hl, de ld a, [hl] and a - jr z, .asm_e52da + jr z, .next call DmgToCgbBGPals ld e, a ld d, a call DmgToCgbObjPals ret -.asm_e52da +.next ld hl, wIntroJumptableIndex inc [hl] - ld a, $80 ; ? - ld [wcb17], a + ld a, $80 + ld [wIntroSceneFrameCounter1], a ret .pals db %01101010, %10100101, %11100100, %00000000 IntroScene13: - ld hl, wcb17 +; Charizard mouth closed + ld hl, wIntroSceneFrameCounter1 ld a, [hl] and a - jr z, .asm_e52f1 + jr z, .next dec [hl] ret -.asm_e52f1 +.next ld hl, wIntroJumptableIndex inc [hl] ld a, $01 call Functione5422 ld a, $04 - ld [wcb17], a + ld [wIntroSceneFrameCounter1], a ret IntroScene14: - ld hl, wcb17 +; Charizard mouth open + ld hl, wIntroSceneFrameCounter1 ld a, [hl] and a - jr z, .asm_e5309 + jr z, .next dec [hl] ret -.asm_e5309 +.next ld hl, wIntroJumptableIndex inc [hl] ld a, $02 call Functione5422 ld a, $40 - ld [wcb17], a + ld [wIntroSceneFrameCounter1], a xor a - ld [wcb18], a + ld [wIntroSceneFrameCounter2], a ld de, SFX_GS_INTRO_CHARIZARD_FIREBALL call PlaySFX -; fall through IntroScene15: +; Charizard mouth wide open / fireball starts call Functione5473 - ld hl, wcb17 + ld hl, wIntroSceneFrameCounter1 ld a, [hl] and a - jr z, .asm_e532d + jr z, .next dec [hl] ret -.asm_e532d: +.next ld hl, wIntroJumptableIndex inc [hl] xor a - ld [wcb17], a + ld [wIntroSceneFrameCounter1], a ret IntroScene16: +; continue fireball / fade out palettes call Functione5473 - ld hl, wcb17 + ld hl, wIntroSceneFrameCounter1 ld a, [hl] inc [hl] swap a @@ -932,29 +934,105 @@ Functione5361: call ByteFill ret -Functione5376: +CheckSCYEvents: ldh a, [hSCY] ld c, a - ld hl, .unknown_e538b + ld hl, .scy_jumptable -.asm_e537c: +.asm_e537c ld a, [hli] cp -1 ret z cp c - jr z, .asm_e5387 + jr z, .value_found inc hl inc hl jr .asm_e537c -.asm_e5387: +.value_found ld a, [hli] ld h, [hl] ld l, a jp hl -.unknown_e538b - dr ($e538b - BANK39_OFFSET), ($e5422 - BANK39_OFFSET) +.scy_jumptable + dbw $86, Functione53f7 + dbw $87, ChikoritaAppears + dbw $88, Functione53e0 + dbw $98, Functione53eb + dbw $99, Functione5400 + dbw $af, CyndaquilAppears + dbw $b0, Functione53e0 + dbw $c0, Functione53eb + dbw $c1, Functione5409 + dbw $d7, TotodileAppears + dbw $d8, Functione53e0 + dbw $e8, Functione53eb + dbw $e9, Functione5412 + db -1 + +ChikoritaAppears: + ld de, SFX_GS_INTRO_POKEMON_APPEARS + call PlaySFX + depixel 22, 1 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_CHIKORITA + call InitSpriteAnimStruct + ret + +CyndaquilAppears: + ld de, SFX_GS_INTRO_POKEMON_APPEARS + call PlaySFX + depixel 22, 20 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_CYNDAQUIL + call InitSpriteAnimStruct + ret + +TotodileAppears: + ld de, SFX_GS_INTRO_POKEMON_APPEARS + call PlaySFX + depixel 22, 1 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_TOTODILE + call InitSpriteAnimStruct + ret + +Functione53e0: + depixel 28, 28, 4, 4 + call DmgToCgbObjPals + xor a + call DmgToCgbBGPals + ret + +Functione53eb: + depixel 31, 31, 7, 7 + call DmgToCgbObjPals + ld a, %00111111 + call DmgToCgbBGPals + ret + +Functione53f7: + ld c, CHIKORITA + farcall Function9178 + ret + +Functione5400: + ld c, CYNDAQUIL + farcall Function9178 + ret + +Functione5409: + ld c, TOTODILE + farcall Function9178 + ret + +Functione5412: + ldh a, [hCGB] + and a + ld c, CYNDAQUIL + jr nz, .got_mon + ld c, CHARIZARD +.got_mon + farcall Function9178 + ret Functione5422: push af @@ -969,7 +1047,7 @@ Functione5422: pop af ld e, a ld d, 0 - ld hl, .unknown_e5464 + ld hl, .data_e5464 rept 5 add hl, de endr @@ -993,7 +1071,7 @@ endr dec c jr nz, .loop2_inner pop hl - ld bc, $0014 + ld bc, SCREEN_WIDTH add hl, bc pop bc dec b @@ -1008,13 +1086,17 @@ endr ldh [hBGMapMode], a ret -.unknown_e5464 - db $00, $08, $08, $22, $c4 - db $40, $09, $08, $21, $c4 - db $88, $09, $08, $20, $c4 +.data_e5464 +; tile id, width, height, tilemap addr? + db $00, 8, 8 + dwcoord 10, 6 + db $40, 9, 8 + dwcoord 9, 6 + db $88, 9, 8 + dwcoord 8, 6 Functione5473: - ld hl, wcb18 + ld hl, wIntroSceneFrameCounter2 ld a, [hl] inc [hl] and $03 @@ -1067,9 +1149,9 @@ Functione54ae: ld a, [de] ld l, a ld h, $00 - ld a, [wcb15 + 0] + ld a, [wIntroTilesPointer + 0] ld e, a - ld a, [wcb15 + 1] + ld a, [wIntroTilesPointer + 1] ld d, a add hl, hl add hl, hl @@ -1100,35 +1182,45 @@ Functione54ae: pop bc ret -Functione54dd: - ld hl, $c700 ; ? +Intro_ResetLYOverrides: + ld hl, wLYOverrides xor a - ld c, $a0 + ld c, wLYOverrides2 - wLYOverrides .loop ld [hli], a dec c jr nz, .loop ret -GFX_e54e8: - dr ($e54e8 - BANK39_OFFSET), ($e5ab8 - BANK39_OFFSET) -GFX_e5ab8: - dr ($e5ab8 - BANK39_OFFSET), ($e5bc8 - BANK39_OFFSET) -GFX_e5bc8: - dr ($e5bc8 - BANK39_OFFSET), ($e5cd8 - BANK39_OFFSET) -GFX_e5cd8: - dr ($e5cd8 - BANK39_OFFSET), ($e6058 - BANK39_OFFSET) -GFX_e6058: - dr ($e6058 - BANK39_OFFSET), ($e6238 - BANK39_OFFSET) -GFX_e6238: - dr ($e6238 - BANK39_OFFSET), ($e6338 - BANK39_OFFSET) -GFX_e6338: - dr ($e6338 - BANK39_OFFSET), ($e63a8 - BANK39_OFFSET) -GFX_e63a8: - dr ($e63a8 - BANK39_OFFSET), ($e6908 - BANK39_OFFSET) -GFX_e6908: - dr ($e6908 - BANK39_OFFSET), ($e6e48 - BANK39_OFFSET) -GFX_e6e48: - dr ($e6e48 - BANK39_OFFSET), ($e71c8 - BANK39_OFFSET) -GFX_e71c8: - dr ($e71c8 - BANK39_OFFSET), ($e7678 - BANK39_OFFSET) +GSIntroWaterGFX1: +INCBIN "gfx/intro/water1.2bpp.lz" + +GSIntroWaterTilemap: +INCBIN "gfx/intro/water.tilemap" + +GSIntroWaterMeta: +INCBIN "gfx/intro/water.bin" + +GSIntroWaterGFX2: +INCBIN "gfx/intro/water2.2bpp.lz" + +GSIntroGrassGFX1: +INCBIN "gfx/intro/grass1.2bpp.lz" + +GSIntroGrassTilemap: +INCBIN "gfx/intro/grass.tilemap" + +GSIntroGrassMeta: +INCBIN "gfx/intro/grass.bin" + +GSIntroGrassGFX2: +INCBIN "gfx/intro/grass2.2bpp.lz" + +GSIntroCharizardGFX1: +INCBIN "gfx/intro/charizard1.2bpp.lz" + +GSIntroCharizardGFX2: +INCBIN "gfx/intro/charizard2.2bpp.lz" + +GSIntroCharizardGFX3: +INCBIN "gfx/intro/charizard3.2bpp.lz" -- cgit v1.2.3 From 80b52ec275bd7f82ddc8c94c5728be59392810ca Mon Sep 17 00:00:00 2001 From: entrpntr Date: Wed, 10 Jun 2020 18:59:52 -0400 Subject: Finish adding/improving labels for now. --- engine/gfx/load_pics.asm | 2 +- engine/gfx/sprite_anims.asm | 6 +- engine/movie/gs_intro.asm | 288 ++++++++++++++++++++++++-------------------- 3 files changed, 164 insertions(+), 132 deletions(-) (limited to 'engine') diff --git a/engine/gfx/load_pics.asm b/engine/gfx/load_pics.asm index aac168db..8b9f4f6a 100644 --- a/engine/gfx/load_pics.asm +++ b/engine/gfx/load_pics.asm @@ -216,7 +216,7 @@ FixPicBank: db $1f, $2e db -1 -GSIntroGetMonFrontpic: +Intro_GetMonFrontpic: ld a, c push de ld hl, PokemonPicPointers diff --git a/engine/gfx/sprite_anims.asm b/engine/gfx/sprite_anims.asm index e9d63d44..d288cd17 100644 --- a/engine/gfx/sprite_anims.asm +++ b/engine/gfx/sprite_anims.asm @@ -20,8 +20,8 @@ DoAnimFrame: dw .GSIntroBubble dw .GSIntroShellder dw .GSIntroMagikarp + dw .UnusedLapras dw .GSIntroLapras - dw .GSIntroLapras2 dw .GSIntroNote dw .GSIntroJigglypuff dw .GSIntroPikachu @@ -227,7 +227,7 @@ DoAnimFrame: call DeinitializeSprite ret -.GSIntroLapras +.UnusedLapras ld hl, SPRITEANIMSTRUCT_XCOORD add hl, bc ld a, [hl] @@ -251,7 +251,7 @@ DoAnimFrame: call DeinitializeSprite ret -.GSIntroLapras2 +.GSIntroLapras call .AnonymousJumptable jp hl diff --git a/engine/movie/gs_intro.asm b/engine/movie/gs_intro.asm index 86f53317..9ef08929 100644 --- a/engine/movie/gs_intro.asm +++ b/engine/movie/gs_intro.asm @@ -1,8 +1,8 @@ GoldSilverIntro: call .Init -.loop - call .JoypadLoop - jr nc, .loop +.Loop: + call .Joypad + jr nc, .Loop ret .Init: @@ -12,21 +12,23 @@ GoldSilverIntro: ldh [hBGMapMode], a ret -.JoypadLoop: +.Joypad: call JoyTextDelay ldh a, [hJoyLast] and BUTTONS - jr nz, .finish + jr nz, .Finish + ld a, [wIntroJumptableIndex] bit 7, a - jr nz, .finish + jr nz, .Finish + farcall PlaySpriteAnimations call IntroSceneJumper call DelayFrame and a ret -.finish +.Finish: callfar ClearSpriteAnims call ClearSprites call DelayFrame @@ -72,6 +74,7 @@ IntroScene1: ld hl, wIntroJumptableIndex inc [hl] ; only run once call DisableLCD + xor a ldh [hBGMapMode], a callfar ClearSpriteAnims @@ -79,31 +82,33 @@ IntroScene1: ldh [rVBK], a hlbgcoord 0, 0, vBGMap2 lb bc, 4, 0 + xor a call ByteFill ld a, 0 ldh [rVBK], a call Intro_ResetLYOverrides ld de, vTiles2 tile $00 - ld hl, GSIntroWaterGFX1 + ld hl, Intro_WaterGFX1 call Decompress - ld a, LOW(GSIntroWaterMeta) + ld a, LOW(Intro_WaterMeta) ld [wIntroTilesPointer + 0], a - ld a, HIGH(GSIntroWaterMeta) + ld a, HIGH(Intro_WaterMeta) ld [wIntroTilesPointer + 1], a hlbgcoord 0, 0, vBGMap2 ld a, l ld [wIntroBGMapPointer + 0], a ld a, h ld [wIntroBGMapPointer + 1], a - ld de, GSIntroWaterTilemap + 15 tiles + ld de, Intro_WaterTilemap + 15 tiles ld a, e ld [wIntroTilemapPointer + 0], a ld a, d ld [wIntroTilemapPointer + 1], a - call Functione5498 + call Intro_DrawBackground + ld de, vTiles0 tile $00 - ld hl, GSIntroWaterGFX2 + ld hl, Intro_WaterGFX2 call Decompress ld hl, wSpriteAnimDict ld a, 0 @@ -123,6 +128,7 @@ IntroScene1: ld a, $42 ldh [hLCDCPointer], a call Functione5095 + xor a ld [wcb19], a call EnableLCD @@ -134,7 +140,7 @@ IntroScene1: call DmgToCgbBGPals depixel 28, 28 call DmgToCgbObjPals - call InitShellders + call Intro_InitShellders ld de, MUSIC_GS_OPENING call PlayMusic ret @@ -145,12 +151,12 @@ IntroScene2: ld hl, wIntroSceneFrameCounter1 ld a, [hl] and a - jr z, .asm_e4df5 + jr z, .skip_intro dec [hl] - call InitBubble + call Intro_InitBubble ret -.asm_e4df5: +.skip_intro ld [hl], $10 ld hl, wIntroJumptableIndex inc [hl] @@ -160,7 +166,7 @@ IntroScene3: call Functione4e90 call Functione4e67 ret nc -.next +; next scene if carry flag is set call Intro_ResetLYOverrides ld hl, hSCY inc [hl] @@ -168,14 +174,14 @@ IntroScene3: inc [hl] IntroScene4: -; at surface, Lapras surfs to left of screen +; at surface; Lapras surfs to left of screen ld a, [wcb19] and a jr nz, .next ld hl, wIntroSceneFrameCounter2 inc [hl] ld a, [hl] - and $0f + and $f jr nz, .asm_e4e21 ld hl, hSCX dec [hl] @@ -197,10 +203,10 @@ IntroScene5: ld a, [hl] inc [hl] swap a - and $0f + and $f ld e, a ld d, 0 - ld hl, .pals + ld hl, .palettes add hl, de ld a, [hl] cp -1 @@ -217,7 +223,7 @@ IntroScene5: inc [hl] ret -.pals +.palettes db %11100100, %11100100, %10010000, %01000000, %00000000 db -1 @@ -236,21 +242,21 @@ Functione4e67: ld hl, wIntroSceneFrameCounter2 inc [hl] ld a, [hl] - and $03 + and 3 jr nz, .asm_e4e74 ld hl, hSCX dec [hl] .asm_e4e74 - and $01 + and 1 jr nz, .asm_e4e8c ld hl, wGlobalAnimYOffset inc [hl] ld hl, hSCY ld a, [hl] dec [hl] - and $0f - call z, Functione4f87 + and $f + call z, Intro_UpdateTilemapAndBGMap ld a, [wIntroSceneFrameCounter1] and a jr z, .asm_e4e8e @@ -286,16 +292,17 @@ Functione4e90: dw Functione4eec Functione4ec1: - call InitLapras + call Intro_InitLapras depixel 28, 28, 4, 4 call DmgToCgbObjPals ; fall through + Functione4eca: call Functione4fde ret Functione4ece: - call InitMagikarps + call Intro_InitMagikarps call Functione4fde ret @@ -304,7 +311,7 @@ Functione4ed5: ld a, [hl] and %00011111 jr z, .asm_e4ee1 - call InitMagikarps + call Intro_InitMagikarps ret .asm_e4ee1 @@ -320,17 +327,17 @@ Functione4eec: call Functione50af ret -InitBubble: +Intro_InitBubble: ld hl, wIntroSceneFrameCounter1 ld a, [hl] - and $0f + and $f ret nz ld a, [hl] and $70 swap a ld e, a ld d, 0 - ld hl, .pixels + ld hl, .pixel_table add hl, de add hl, de ld e, [hl] @@ -340,7 +347,7 @@ InitBubble: call InitSpriteAnimStruct ret -.pixels +.pixel_table db 6 * 8, 14 * 8 + 4 db 14 * 8, 18 * 8 + 4 db 10 * 8, 16 * 8 + 4 @@ -348,7 +355,7 @@ InitBubble: db 4 * 8, 13 * 8 db 8 * 8, 17 * 8 -InitMagikarps: +Intro_InitMagikarps: depixel 8, 7, 0, 7 ldh a, [hSGB] and a @@ -385,7 +392,7 @@ InitMagikarps: call InitSpriteAnimStruct ret -InitShellders: +Intro_InitShellders: depixel 18, 7 call .InitAnim depixel 14, 10 @@ -397,24 +404,26 @@ InitShellders: call InitSpriteAnimStruct ret -InitLapras: +Intro_InitLapras: ld a, [wIntroSceneFrameCounter2] and %00011111 ret nz depixel 16, 24 - ld a, SPRITE_ANIM_INDEX_GS_INTRO_LAPRAS_2 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_LAPRAS call InitSpriteAnimStruct ret -UnusedInitLapras: +Intro_UnusedInitLapras: depixel 2, 0 - ld a, SPRITE_ANIM_INDEX_GS_INTRO_LAPRAS + ld a, SPRITE_ANIM_INDEX_UNUSED_LAPRAS call InitSpriteAnimStruct ret -Functione4f87: +Intro_UpdateTilemapAndBGMap: +; add new tiles to top as water scene scrolls up to surface push hl push de + ld a, [wIntroTilemapPointer + 0] ld e, a ld a, [wIntroTilemapPointer + 1] @@ -428,12 +437,13 @@ Functione4f87: ld d, h ld [wIntroTilemapPointer + 1], a hlcoord 0, 0 - ld c, $10 + ld c, BG_MAP_WIDTH / 2 .loop call Functione54ae dec c jr nz, .loop + ld a, [wIntroBGMapPointer + 0] ld e, a ld a, [wIntroBGMapPointer + 1] @@ -444,8 +454,8 @@ Functione4f87: ld [wIntroBGMapPointer + 0], a ld [wRequested2bppDest + 0], a ld a, h - and $fb - or $08 + and %11111011 + or %00001000 ld [wIntroBGMapPointer + 1], a ld [wRequested2bppDest + 1], a ld a, LOW(wTilemap) @@ -456,15 +466,17 @@ Functione4f87: ld [wRequested2bppSize], a ld hl, wIntroSceneFrameCounter1 dec [hl] + pop de pop hl ret Functione4fde: +; something to do with water scene sprite anims? ld hl, wIntroSceneFrameCounter2 ld a, [hl] - and $03 - cp $03 + and 3 + cp 3 ret z ld a, [wRequested2bppSize] and a @@ -555,6 +567,7 @@ Functione50af: pop af dec a jr nz, .loop2 + pop af ld [hl], a ret @@ -562,35 +575,37 @@ Functione50af: IntroScene6: ; Set up grass cutscene (Pikachu/Jigglypuff) ld hl, wIntroJumptableIndex - inc [hl] + inc [hl] ; only run once call DisableLCD callfar ClearSpriteAnims call Intro_ResetLYOverrides + ld de, vTiles2 - ld hl, GSIntroGrassGFX1 + ld hl, Intro_GrassGFX1 call Decompress - ld a, LOW(GSIntroGrassMeta) + ld a, LOW(Intro_GrassMeta) ld [wIntroTilesPointer + 0], a - ld a, HIGH(GSIntroGrassMeta) + ld a, HIGH(Intro_GrassMeta) ld [wIntroTilesPointer + 1], a ld hl, vBGMap0 ld a, l ld [wIntroBGMapPointer + 0], a ld a, h ld [wIntroBGMapPointer + 1], a - ld de, GSIntroGrassTilemap + ld de, Intro_GrassTilemap ld a, e ld [wIntroTilemapPointer + 0], a ld a, d ld [wIntroTilemapPointer + 1], a - call Functione5498 + call Intro_DrawBackground + ld de, vTiles0 - ld hl, GSIntroGrassGFX2 + ld hl, Intro_GrassGFX2 call Decompress ld hl, wSpriteAnimDict - ld a, $01 + ld a, 1 ld [hli], a - ld a, $00 + ld a, 0 ld [hli], a xor a ldh [hSCY], a @@ -599,6 +614,7 @@ IntroScene6: ldh [hSCX], a ld a, $a0 ld [wGlobalAnimXOffset], a + xor a ld [wIntroSceneFrameCounter2], a call EnableLCD @@ -609,18 +625,18 @@ IntroScene6: call DmgToCgbBGPals depixel 28, 28, 4, 4 call DmgToCgbObjPals - call InitJigglypuffAnim + call Intro_InitJigglypuff xor a ld [wcb19], a ret IntroScene7: ; scroll left to Jigglypuff - call InitNoteAnim + call Intro_InitNote ld hl, wIntroSceneFrameCounter2 ld a, [hl] inc [hl] - and $03 + and 3 ret z ld hl, hSCX ld a, [hl] @@ -634,7 +650,7 @@ IntroScene7: .next ld a, -1 ld [wIntroSceneFrameCounter1], a - call InitPikachuAnim + call Intro_InitPikachu ld hl, wIntroJumptableIndex inc [hl] ret @@ -646,7 +662,7 @@ IntroScene8: and a jr z, .next dec [hl] - call InitNoteAnim + call Intro_InitNote ld hl, wIntroSceneFrameCounter2 inc [hl] ret @@ -669,7 +685,7 @@ IntroScene9: srl a ld e, a ld d, 0 - ld hl, .pals + ld hl, .palettes add hl, de ld a, [hl] cp -1 @@ -686,14 +702,14 @@ IntroScene9: inc [hl] ret -.pals +.palettes db %11100100, %11100100, %11100100, %11100100 db %11100100, %10010000, %01000000, %00000000 db -1 ret ; unused -InitNoteAnim: +Intro_InitNote: ld a, [wcb19] and a ret nz @@ -715,13 +731,13 @@ InitNoteAnim: call InitSpriteAnimStruct ret -InitJigglypuffAnim: +Intro_InitJigglypuff: depixel 14, 6 ld a, SPRITE_ANIM_INDEX_GS_INTRO_JIGGLYPUFF call InitSpriteAnimStruct ret -InitPikachuAnim: +Intro_InitPikachu: depixel 14, 24 ld a, SPRITE_ANIM_INDEX_GS_INTRO_PIKACHU call InitSpriteAnimStruct @@ -733,48 +749,53 @@ InitPikachuAnim: IntroScene10: ; Set up fireball cutscene (Charizard, Johto starters) ld hl, wIntroJumptableIndex - inc [hl] + inc [hl] ; only run once call DisableLCD callfar ClearSpriteAnims call Intro_ResetLYOverrides - call Functione5361 + call Intro_BlankTilemapAndBGMap + ld de, vTiles2 - ld hl, GSIntroCharizardGFX1 + ld hl, Intro_FireGFX1 call Decompress ld de, vTiles1 - ld hl, GSIntroCharizardGFX2 + ld hl, Intro_FireGFX2 call Decompress ld de, vTiles0 - ld hl, GSIntroCharizardGFX3 + ld hl, Intro_FireGFX3 ld bc, vTiles1 - vTiles0 call Decompress + ld c, CHIKORITA ld de, vTiles0 tile $10 - farcall GSIntroGetMonFrontpic + farcall Intro_GetMonFrontpic ld c, CYNDAQUIL ld de, vTiles0 tile $29 - farcall GSIntroGetMonFrontpic + farcall Intro_GetMonFrontpic ld c, TOTODILE ld de, vTiles0 tile $42 - farcall GSIntroGetMonFrontpic + farcall Intro_GetMonFrontpic + ld hl, wSpriteAnimDict - ld a, $01 + ld a, 1 ld [hli], a - ld a, $00 + ld a, 0 ld [hli], a call EnableLCD ld a, 0 call Functione5422 + ld a, $80 ldh [hSCY], a xor a ldh [hSCX], a ld [wGlobalAnimYOffset], a ld [wGlobalAnimXOffset], a + xor a ld [wIntroSceneFrameCounter2], a ld b, SCGB_GS_INTRO - ld c, $02 + ld c, 2 call GetSGBLayout ld a, %00111111 call DmgToCgbBGPals @@ -792,21 +813,23 @@ IntroScene11: ld hl, wIntroSceneFrameCounter2 ld a, [hl] inc [hl] - and $01 + and 1 ret z - call CheckSCYEvents + call Intro_CheckSCYEvent ld hl, hSCY ld a, [hl] and a - jr z, .done_scrolling + jr z, .next inc [hl] ret -.done_scrolling +.next ld hl, wIntroJumptableIndex inc [hl] xor a ld [wIntroSceneFrameCounter1], a +; fall through + IntroScene12: ; load Charizard palettes ld hl, wIntroSceneFrameCounter1 @@ -814,10 +837,10 @@ IntroScene12: inc [hl] srl a srl a - and %11 + and 3 ld e, a ld d, 0 - ld hl, .pals + ld hl, .palettes add hl, de ld a, [hl] and a @@ -835,7 +858,7 @@ IntroScene12: ld [wIntroSceneFrameCounter1], a ret -.pals +.palettes db %01101010, %10100101, %11100100, %00000000 IntroScene13: @@ -850,9 +873,9 @@ IntroScene13: .next ld hl, wIntroJumptableIndex inc [hl] - ld a, $01 + ld a, 1 call Functione5422 - ld a, $04 + ld a, 4 ld [wIntroSceneFrameCounter1], a ret @@ -868,14 +891,16 @@ IntroScene14: .next ld hl, wIntroJumptableIndex inc [hl] - ld a, $02 + ld a, 2 call Functione5422 - ld a, $40 + ld a, 64 ld [wIntroSceneFrameCounter1], a xor a ld [wIntroSceneFrameCounter2], a ld de, SFX_GS_INTRO_CHARIZARD_FIREBALL call PlaySFX +; fall through + IntroScene15: ; Charizard mouth wide open / fireball starts call Functione5473 @@ -900,30 +925,30 @@ IntroScene16: ld a, [hl] inc [hl] swap a - and $07 + and 7 ld e, a ld d, 0 - ld hl, .pals + ld hl, .palettes add hl, de ld a, [hl] cp -1 - jr z, .asm_e5357 + jr z, .next call DmgToCgbBGPals ld e, a ld d, a call DmgToCgbObjPals ret -.asm_e5357: +.next ld hl, wIntroJumptableIndex inc [hl] ret -.pals +.palettes db %11100100, %10010000, %01000000, %00000000 db -1 -Functione5361: +Intro_BlankTilemapAndBGMap: hlcoord 0, 0 ld bc, wTilemapEnd - wTilemap xor a @@ -934,12 +959,12 @@ Functione5361: call ByteFill ret -CheckSCYEvents: +Intro_CheckSCYEvent: ldh a, [hSCY] ld c, a ld hl, .scy_jumptable -.asm_e537c +.loop ld a, [hli] cp -1 ret z @@ -947,7 +972,7 @@ CheckSCYEvents: jr z, .value_found inc hl inc hl - jr .asm_e537c + jr .loop .value_found ld a, [hli] @@ -957,21 +982,21 @@ CheckSCYEvents: .scy_jumptable dbw $86, Functione53f7 - dbw $87, ChikoritaAppears + dbw $87, Intro_ChikoritaAppears dbw $88, Functione53e0 dbw $98, Functione53eb dbw $99, Functione5400 - dbw $af, CyndaquilAppears + dbw $af, Intro_CyndaquilAppears dbw $b0, Functione53e0 dbw $c0, Functione53eb dbw $c1, Functione5409 - dbw $d7, TotodileAppears + dbw $d7, Intro_TotodileAppears dbw $d8, Functione53e0 dbw $e8, Functione53eb dbw $e9, Functione5412 db -1 -ChikoritaAppears: +Intro_ChikoritaAppears: ld de, SFX_GS_INTRO_POKEMON_APPEARS call PlaySFX depixel 22, 1 @@ -979,7 +1004,7 @@ ChikoritaAppears: call InitSpriteAnimStruct ret -CyndaquilAppears: +Intro_CyndaquilAppears: ld de, SFX_GS_INTRO_POKEMON_APPEARS call PlaySFX depixel 22, 20 @@ -987,7 +1012,7 @@ CyndaquilAppears: call InitSpriteAnimStruct ret -TotodileAppears: +Intro_TotodileAppears: ld de, SFX_GS_INTRO_POKEMON_APPEARS call PlaySFX depixel 22, 1 @@ -1070,6 +1095,7 @@ endr inc a dec c jr nz, .loop2_inner + pop hl ld bc, SCREEN_WIDTH add hl, bc @@ -1077,7 +1103,7 @@ endr dec b jr nz, .loop2_outer - ld a, $1 + ld a, 1 ldh [hBGMapMode], a call DelayFrame call DelayFrame @@ -1087,7 +1113,7 @@ endr ret .data_e5464 -; tile id, width, height, tilemap addr? +; vtile offset, width, height, x, y? db $00, 8, 8 dwcoord 10, 6 db $40, 9, 8 @@ -1099,7 +1125,7 @@ Functione5473: ld hl, wIntroSceneFrameCounter2 ld a, [hl] inc [hl] - and $03 + and 3 ret nz depixel 12, 10, 4, 4 ld a, SPRITE_ANIM_INDEX_GS_INTRO_FIREBALL @@ -1110,8 +1136,8 @@ Functione5473: inc [hl] ret -Functione548c: - ld bc, $0800 +Unreferenced_Functione548c: + ld bc, vTiles1 - vTiles0 .loop ld a, [de] inc de @@ -1122,33 +1148,38 @@ Functione548c: jr nz, .loop ret -Functione5498: - ld b, $10 -.loop_outer +Intro_DrawBackground: + ld b, BG_MAP_WIDTH / 2 + +.outer_loop push hl - ld c, $10 -.loop_inner + ld c, BG_MAP_HEIGHT / 2 +.inner_loop call Functione54ae dec c - jr nz, .loop_inner + jr nz, .inner_loop + pop hl push bc - ld bc, $0040 + ld bc, 2 * BG_MAP_WIDTH add hl, bc pop bc dec b - jr nz, .loop_outer + jr nz, .outer_loop + ret Functione54ae: +; load tile data into a 2x2 section of the bgmap or tilemap push bc push de push hl push hl push hl + ld a, [de] ld l, a - ld h, $00 + ld h, 0 ld a, [wIntroTilesPointer + 0] ld e, a ld a, [wIntroTilesPointer + 1] @@ -1166,7 +1197,7 @@ Functione54ae: inc de ld [hli], a pop hl - ld bc, $0020 + ld bc, BG_MAP_WIDTH add hl, bc ld a, [de] inc de @@ -1174,6 +1205,7 @@ Functione54ae: ld a, [de] inc de ld [hli], a + pop hl inc hl inc hl @@ -1192,35 +1224,35 @@ Intro_ResetLYOverrides: jr nz, .loop ret -GSIntroWaterGFX1: +Intro_WaterGFX1: INCBIN "gfx/intro/water1.2bpp.lz" -GSIntroWaterTilemap: +Intro_WaterTilemap: INCBIN "gfx/intro/water.tilemap" -GSIntroWaterMeta: +Intro_WaterMeta: INCBIN "gfx/intro/water.bin" -GSIntroWaterGFX2: +Intro_WaterGFX2: INCBIN "gfx/intro/water2.2bpp.lz" -GSIntroGrassGFX1: +Intro_GrassGFX1: INCBIN "gfx/intro/grass1.2bpp.lz" -GSIntroGrassTilemap: +Intro_GrassTilemap: INCBIN "gfx/intro/grass.tilemap" -GSIntroGrassMeta: +Intro_GrassMeta: INCBIN "gfx/intro/grass.bin" -GSIntroGrassGFX2: +Intro_GrassGFX2: INCBIN "gfx/intro/grass2.2bpp.lz" -GSIntroCharizardGFX1: +Intro_FireGFX1: INCBIN "gfx/intro/charizard1.2bpp.lz" -GSIntroCharizardGFX2: +Intro_FireGFX2: INCBIN "gfx/intro/charizard2.2bpp.lz" -GSIntroCharizardGFX3: +Intro_FireGFX3: INCBIN "gfx/intro/charizard3.2bpp.lz" -- cgit v1.2.3 From a1c33b58a89c29ef52e3bc9399be1491dbd1d33d Mon Sep 17 00:00:00 2001 From: entrpntr Date: Wed, 10 Jun 2020 19:49:54 -0400 Subject: More cleanup. --- engine/gfx/sprite_anims.asm | 2 +- engine/movie/gamefreak_presents.asm | 35 ++++------------ engine/movie/gs_intro.asm | 83 +++++++++++++++++++------------------ 3 files changed, 52 insertions(+), 68 deletions(-) (limited to 'engine') diff --git a/engine/gfx/sprite_anims.asm b/engine/gfx/sprite_anims.asm index d288cd17..b32a3d27 100644 --- a/engine/gfx/sprite_anims.asm +++ b/engine/gfx/sprite_anims.asm @@ -997,7 +997,7 @@ ENDC .asm_8d968 ld a, 1 - ld [wce64], a + ld [wIntroSceneFrameCounter], a call DeinitializeSprite ret diff --git a/engine/movie/gamefreak_presents.asm b/engine/movie/gamefreak_presents.asm index f4c2c5cc..69e34588 100644 --- a/engine/movie/gamefreak_presents.asm +++ b/engine/movie/gamefreak_presents.asm @@ -27,7 +27,7 @@ Copyright_GFPresents: call .GetGFLogoGFX .loop - call GFPresents_PlayFrame + call .PlayFrame jr nc, .loop ; high bits of wJumptableIndex are recycled for some flags @@ -78,7 +78,7 @@ Copyright_GFPresents: call DmgToCgbObjPals ret -GFPresents_PlayFrame: +.PlayFrame: ; Play one frame of GFPresents sequence. ; Return carry when the sequence completes or is canceled. @@ -95,7 +95,7 @@ GFPresents_PlayFrame: farcall PlaySpriteAnimations - call GFPresents_HandleFrame + call GFPresentsJumper call DelayFrame ; ensure carry is cleared @@ -118,19 +118,8 @@ GFPresents_PlayFrame: scf ret -GFPresents_HandleFrame: -; Dispatch to the current scene handler - - ld a, [wJumptableIndex] - ld e, a - ld d, 0 - ld hl, .scenes - add hl, de - add hl, de - ld a, [hli] - ld h, [hl] - ld l, a - jp hl +GFPresentsJumper: + jumptable .scenes, wJumptableIndex .scenes dw GFPresents_Star @@ -145,15 +134,13 @@ GFPresents_NextScene: inc [hl] ret -; unused? -Functione4a8d: +Unreferenced_Functione4a8d: ld c, 64 call DelayFrames call GFPresents_NextScene ret GFPresents_Star: - ; tell GFPresents_PlaceLogo we haven't finished yet xor a ld [wIntroSceneFrameCounter], a @@ -162,8 +149,7 @@ GFPresents_Star: ld a, SPRITE_ANIM_INDEX_GS_INTRO_STAR call InitSpriteAnimStruct - ; TODO set some flag in the struct? - ld hl, $c + ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld [hl], $80 @@ -177,7 +163,7 @@ 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? + ; this counter is set in DoAnimFrame.GSIntroStar in engine/gfx/sprite_anims.asm ld a, [wIntroSceneFrameCounter] and a ret z @@ -194,7 +180,6 @@ GFPresents_PlaceLogo: ret GFPresents_LogoSparkles: - ld hl, wIntroSceneTimer ld a, [hl] and a @@ -210,7 +195,7 @@ GFPresents_LogoSparkles: ret .done - ; set (unused?) timer for GFPresents_PlacePresents + ; set timer for GFPresents_PlacePresents ld [hl], $80 call GFPresents_NextScene ret @@ -286,8 +271,6 @@ GFPresents_UpdateLogoPal: 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? ; run only every second frame ld d, a diff --git a/engine/movie/gs_intro.asm b/engine/movie/gs_intro.asm index 9ef08929..a031ccfa 100644 --- a/engine/movie/gs_intro.asm +++ b/engine/movie/gs_intro.asm @@ -1,7 +1,7 @@ GoldSilverIntro: call .Init .Loop: - call .Joypad + call .PlayFrame jr nc, .Loop ret @@ -12,7 +12,7 @@ GoldSilverIntro: ldh [hBGMapMode], a ret -.Joypad: +.PlayFrame: call JoyTextDelay ldh a, [hJoyLast] and BUTTONS @@ -46,9 +46,9 @@ GoldSilverIntro: ret IntroSceneJumper: - jumptable .IntroScenes, wIntroJumptableIndex + jumptable .scenes, wIntroJumptableIndex -.IntroScenes: +.scenes dw IntroScene1 dw IntroScene2 dw IntroScene3 @@ -122,9 +122,9 @@ IntroScene1: ld a, $58 ldh [hSCX], a xor a - ld [wIntroSceneFrameCounter2], a + ld [wIntroFrameCounter2], a ld a, $80 - ld [wIntroSceneFrameCounter1], a + ld [wIntroFrameCounter1], a ld a, $42 ldh [hLCDCPointer], a call Functione5095 @@ -148,7 +148,7 @@ IntroScene1: IntroScene2: ; shellders underwater call Functione50af - ld hl, wIntroSceneFrameCounter1 + ld hl, wIntroFrameCounter1 ld a, [hl] and a jr z, .skip_intro @@ -178,7 +178,7 @@ IntroScene4: ld a, [wcb19] and a jr nz, .next - ld hl, wIntroSceneFrameCounter2 + ld hl, wIntroFrameCounter2 inc [hl] ld a, [hl] and $f @@ -195,11 +195,11 @@ IntroScene4: ld hl, wIntroJumptableIndex inc [hl] xor a - ld [wIntroSceneFrameCounter1], a + ld [wIntroFrameCounter1], a IntroScene5: ; fade out - ld hl, wIntroSceneFrameCounter1 + ld hl, wIntroFrameCounter1 ld a, [hl] inc [hl] swap a @@ -234,12 +234,13 @@ IntroScene17: call DelayFrame dec c jr nz, .loop +; set done flag ld hl, wIntroJumptableIndex set 7, [hl] ret Functione4e67: - ld hl, wIntroSceneFrameCounter2 + ld hl, wIntroFrameCounter2 inc [hl] ld a, [hl] and 3 @@ -257,7 +258,7 @@ Functione4e67: dec [hl] and $f call z, Intro_UpdateTilemapAndBGMap - ld a, [wIntroSceneFrameCounter1] + ld a, [wIntroFrameCounter1] and a jr z, .asm_e4e8e @@ -270,7 +271,7 @@ Functione4e67: ret Functione4e90: - jumptable .dw, wIntroSceneFrameCounter1 + jumptable .dw, wIntroFrameCounter1 .dw dw Functione4eca @@ -307,7 +308,7 @@ Functione4ece: ret Functione4ed5: - ld hl, wIntroSceneFrameCounter2 + ld hl, wIntroFrameCounter2 ld a, [hl] and %00011111 jr z, .asm_e4ee1 @@ -328,7 +329,7 @@ Functione4eec: ret Intro_InitBubble: - ld hl, wIntroSceneFrameCounter1 + ld hl, wIntroFrameCounter1 ld a, [hl] and $f ret nz @@ -363,7 +364,7 @@ Intro_InitMagikarps: depixel 4, 3, 0, 7 .ok - ld hl, wIntroSceneFrameCounter2 + ld hl, wIntroFrameCounter2 ld a, [hl] and e ret nz @@ -405,7 +406,7 @@ Intro_InitShellders: ret Intro_InitLapras: - ld a, [wIntroSceneFrameCounter2] + ld a, [wIntroFrameCounter2] and %00011111 ret nz depixel 16, 24 @@ -464,7 +465,7 @@ Intro_UpdateTilemapAndBGMap: ld [wRequested2bppSource + 1], a ld a, 4 ld [wRequested2bppSize], a - ld hl, wIntroSceneFrameCounter1 + ld hl, wIntroFrameCounter1 dec [hl] pop de @@ -473,7 +474,7 @@ Intro_UpdateTilemapAndBGMap: Functione4fde: ; something to do with water scene sprite anims? - ld hl, wIntroSceneFrameCounter2 + ld hl, wIntroFrameCounter2 ld a, [hl] and 3 cp 3 @@ -616,7 +617,7 @@ IntroScene6: ld [wGlobalAnimXOffset], a xor a - ld [wIntroSceneFrameCounter2], a + ld [wIntroFrameCounter2], a call EnableLCD ld b, SCGB_GS_INTRO ld c, 1 @@ -633,7 +634,7 @@ IntroScene6: IntroScene7: ; scroll left to Jigglypuff call Intro_InitNote - ld hl, wIntroSceneFrameCounter2 + ld hl, wIntroFrameCounter2 ld a, [hl] inc [hl] and 3 @@ -649,7 +650,7 @@ IntroScene7: .next ld a, -1 - ld [wIntroSceneFrameCounter1], a + ld [wIntroFrameCounter1], a call Intro_InitPikachu ld hl, wIntroJumptableIndex inc [hl] @@ -657,19 +658,19 @@ IntroScene7: IntroScene8: ; stop scrolling, Pikachu attacks - ld hl, wIntroSceneFrameCounter1 + ld hl, wIntroFrameCounter1 ld a, [hl] and a jr z, .next dec [hl] call Intro_InitNote - ld hl, wIntroSceneFrameCounter2 + ld hl, wIntroFrameCounter2 inc [hl] ret .next xor a - ld [wIntroSceneFrameCounter1], a + ld [wIntroFrameCounter1], a ld hl, wIntroJumptableIndex inc [hl] callfar Function9136 @@ -677,7 +678,7 @@ IntroScene8: IntroScene9: ; scroll down and fade out - ld hl, wIntroSceneFrameCounter1 + ld hl, wIntroFrameCounter1 ld a, [hl] inc [hl] srl a @@ -713,7 +714,7 @@ Intro_InitNote: ld a, [wcb19] and a ret nz - ld hl, wIntroSceneFrameCounter2 + ld hl, wIntroFrameCounter2 ld a, [hl] and %00111111 ret nz @@ -793,7 +794,7 @@ IntroScene10: ld [wGlobalAnimXOffset], a xor a - ld [wIntroSceneFrameCounter2], a + ld [wIntroFrameCounter2], a ld b, SCGB_GS_INTRO ld c, 2 call GetSGBLayout @@ -810,7 +811,7 @@ IntroScene10: IntroScene11: ; scroll up to Charizard silhoutte, flash Johto starters - ld hl, wIntroSceneFrameCounter2 + ld hl, wIntroFrameCounter2 ld a, [hl] inc [hl] and 1 @@ -827,12 +828,12 @@ IntroScene11: ld hl, wIntroJumptableIndex inc [hl] xor a - ld [wIntroSceneFrameCounter1], a + ld [wIntroFrameCounter1], a ; fall through IntroScene12: ; load Charizard palettes - ld hl, wIntroSceneFrameCounter1 + ld hl, wIntroFrameCounter1 ld a, [hl] inc [hl] srl a @@ -855,7 +856,7 @@ IntroScene12: ld hl, wIntroJumptableIndex inc [hl] ld a, $80 - ld [wIntroSceneFrameCounter1], a + ld [wIntroFrameCounter1], a ret .palettes @@ -863,7 +864,7 @@ IntroScene12: IntroScene13: ; Charizard mouth closed - ld hl, wIntroSceneFrameCounter1 + ld hl, wIntroFrameCounter1 ld a, [hl] and a jr z, .next @@ -876,12 +877,12 @@ IntroScene13: ld a, 1 call Functione5422 ld a, 4 - ld [wIntroSceneFrameCounter1], a + ld [wIntroFrameCounter1], a ret IntroScene14: ; Charizard mouth open - ld hl, wIntroSceneFrameCounter1 + ld hl, wIntroFrameCounter1 ld a, [hl] and a jr z, .next @@ -894,9 +895,9 @@ IntroScene14: ld a, 2 call Functione5422 ld a, 64 - ld [wIntroSceneFrameCounter1], a + ld [wIntroFrameCounter1], a xor a - ld [wIntroSceneFrameCounter2], a + ld [wIntroFrameCounter2], a ld de, SFX_GS_INTRO_CHARIZARD_FIREBALL call PlaySFX ; fall through @@ -904,7 +905,7 @@ IntroScene14: IntroScene15: ; Charizard mouth wide open / fireball starts call Functione5473 - ld hl, wIntroSceneFrameCounter1 + ld hl, wIntroFrameCounter1 ld a, [hl] and a jr z, .next @@ -915,13 +916,13 @@ IntroScene15: ld hl, wIntroJumptableIndex inc [hl] xor a - ld [wIntroSceneFrameCounter1], a + ld [wIntroFrameCounter1], a ret IntroScene16: ; continue fireball / fade out palettes call Functione5473 - ld hl, wIntroSceneFrameCounter1 + ld hl, wIntroFrameCounter1 ld a, [hl] inc [hl] swap a @@ -1122,7 +1123,7 @@ endr dwcoord 8, 6 Functione5473: - ld hl, wIntroSceneFrameCounter2 + ld hl, wIntroFrameCounter2 ld a, [hl] inc [hl] and 3 -- cgit v1.2.3 From 48a9f3aa75f65cd756b8f08290bd290e676cd1a4 Mon Sep 17 00:00:00 2001 From: entrpntr Date: Wed, 10 Jun 2020 20:42:04 -0400 Subject: Combine gamefreak_presents.asm and gs_intro.asm. --- engine/movie/gamefreak_presents.asm | 346 -------- engine/movie/gold_silver_intro.asm | 1607 +++++++++++++++++++++++++++++++++++ engine/movie/gs_intro.asm | 1259 --------------------------- 3 files changed, 1607 insertions(+), 1605 deletions(-) delete mode 100644 engine/movie/gamefreak_presents.asm create mode 100644 engine/movie/gold_silver_intro.asm delete mode 100644 engine/movie/gs_intro.asm (limited to 'engine') diff --git a/engine/movie/gamefreak_presents.asm b/engine/movie/gamefreak_presents.asm deleted file mode 100644 index 69e34588..00000000 --- a/engine/movie/gamefreak_presents.asm +++ /dev/null @@ -1,346 +0,0 @@ -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 .GetGFLogoGFX - -.loop - call .PlayFrame - jr nc, .loop - - ; high bits of wJumptableIndex are recycled for some flags - ; this was set if user canceled by pressing a button - ld a, [wJumptableIndex] - bit 6, a - jr nz, .canceled - - ; clear carry flag from GFPresents_PlayFrame - and a - ret - -.canceled - scf - ret - -.GetGFLogoGFX: -; Load gfx and initialize variables - - ld de, GFPresentsGFX1 - ld hl, vTiles1 - lb bc, BANK(GFPresentsGFX1), 28 - call Get1bpp - - ld de, GFPresentsGFX2 - ld hl, vTiles1 tile 28 - lb bc, BANK(GFPresentsGFX2), 5 - call Request2bpp - - farcall ClearSpriteAnims - - ld hl, wSpriteAnimDict - ld a, 6 - ld [hli], a - ld a, $8d - ld [hl], a - xor a - ld [wJumptableIndex], 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 - -.PlayFrame: -; Play one frame of GFPresents sequence. -; Return carry when the sequence completes or is canceled. - - call JoyTextDelay - ldh a, [hJoyLast] - and BUTTONS - jr nz, .pressed_button - - ; high bits of wJumptableIndex are recycled for some flags - ; this is set when the sequence finished - ld a, [wJumptableIndex] - bit 7, a - jr nz, .finish - - farcall PlaySpriteAnimations - - call GFPresentsJumper - call DelayFrame - - ; ensure carry is cleared - and a - ret - -.pressed_button - ; high bits of wJumptableIndex are recycled for some flags - ld hl, wJumptableIndex - set 6, [hl] - -.finish - callfar ClearSpriteAnims - call ClearTilemap - call ClearSprites - - ld c, 16 - call DelayFrames - - scf - ret - -GFPresentsJumper: - jumptable .scenes, wJumptableIndex - -.scenes - dw GFPresents_Star - dw GFPresents_PlaceLogo - dw GFPresents_LogoSparkles - dw GFPresents_PlacePresents - dw GFPresents_WaitForTimer - dw GFPresents_SetDoneFlag - -GFPresents_NextScene: - ld hl, wJumptableIndex - inc [hl] - ret - -Unreferenced_Functione4a8d: - ld c, 64 - call DelayFrames - call GFPresents_NextScene - ret - -GFPresents_Star: - ; tell GFPresents_PlaceLogo we haven't finished yet - xor a - ld [wIntroSceneFrameCounter], a - - depixel 10, 11, 4, 0 - ld a, SPRITE_ANIM_INDEX_GS_INTRO_STAR - call InitSpriteAnimStruct - - ld hl, SPRITEANIMSTRUCT_0C - add hl, bc - ld [hl], $80 - - ld de, SFX_GAME_FREAK_LOGO_GS - call PlaySFX - - call GFPresents_NextScene - ret - -GFPresents_PlaceLogo: -; Draw the Game Freak logo (may be initially invisible due to palette) - - ; wait until the star animation completed - ; this counter is set in DoAnimFrame.GSIntroStar in engine/gfx/sprite_anims.asm - ld a, [wIntroSceneFrameCounter] - and a - ret z - - depixel 10, 11, 4, 0 - ld a, SPRITE_ANIM_INDEX_GAMEFREAK_LOGO - call InitSpriteAnimStruct - - call GFPresents_NextScene - - ; set timer for GFPresents_LogoSparkles - ld a, $80 - ld [wIntroSceneTimer], a - ret - -GFPresents_LogoSparkles: - ld hl, wIntroSceneTimer - ld a, [hl] - and a - jr z, .done - dec [hl] - - ; add first text when timer passes half - cp $3f - call z, GFPresents_PlaceGameFreak - - ; add sparkles continuously - call GFPresents_Sparkle - ret - -.done - ; set timer for GFPresents_PlacePresents - ld [hl], $80 - call GFPresents_NextScene - ret - -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 -.end - db "@" - -GFPresents_PlacePresents: - hlcoord 7, 13 - ld de, .presents - call PlaceString - - call GFPresents_NextScene - - ; set timer for GFPresents_WaitForTimer - ld a, $80 - ld [wIntroSceneTimer], a - ret - -.presents - db $87, $88, $89, $8a, $8b, $8c -.end - db "@" - -GFPresents_SetDoneFlag: -; Tell GFPresents_PlayFrame and TitleScreenFrame that we're finished. - - ld hl, wJumptableIndex - set 7, [hl] - ret - -GFPresents_WaitForTimer: - ld hl, wIntroSceneTimer - ld a, [hl] - and a - jr z, .done - dec [hl] - ret -.done - call GFPresents_NextScene - ret - -GFPresents_UpdateLogoPal: -; called from 23:5928 -; OBP1 was initialized at end of GFPresents_Init - - ; once we reached the final state, leave it alone - ldh a, [rOBP1] - cp %10010000 - ret z - - ; wait 16 frames before next change - ld a, [wIntroSceneTimer] - and $f - ret nz - - ; rotate OBP1 by one color slot (2 bits) - ; DMG: logo is white, then light gray, then dark gray - ; CGB: logo is white, then yellow - ldh a, [rOBP1] - rrca - rrca - call DmgToCgbObjPal1 - ret - -GFPresents_Sparkle: -; Initialize and configure a sparkle sprite. - - ; run only every second frame - ld d, a - and 1 - ret nz - - ; shift over so our index is still changing by 1 each time - ld a, d - srl a - - ; set up a new sparkle sprite - push af - depixel 11, 11 - ld a, SPRITE_ANIM_INDEX_GS_INTRO_SPARKLE - call InitSpriteAnimStruct - pop af - - ; take the bottom 4 bits of a as an index into - ; sparkle_vectors (16 entries) - and %00001111 - ld e, a - ld d, 0 - ld hl, .sparkle_vectors - add hl, de - add hl, de - - ; set the angle and distance for this sprite - ; bc+$b <- hl (angle), bc+$c <- 0, bc+$d <- hl+1 (distance) - ld e, l - ld d, h - ld hl, $b - add hl, bc - ld a, [de] - ld [hl], a - inc de - ld hl, $c - add hl, bc - ld [hl], 0 - inc hl - ld a, [de] - ld [hl], a - - ret - -.sparkle_vectors - ; values control final position of each sparkle - ; position is automatically animated along the vector - ; each entry emits two sparkles in opposite directions - ; angle (6 bits) and distance (tiles?) - db $00, $03 - db $08, $04 - db $04, $03 - db $0c, $02 - db $10, $02 - db $18, $03 - db $14, $04 - db $1c, $03 - db $20, $02 - db $28, $02 - db $24, $03 - db $2c, $04 - db $30, $04 - db $38, $03 - db $34, $02 - db $3c, $04 - -GFPresentsGFX1: -INCBIN "gfx/intro/gamefreak_presents.1bpp" -INCBIN "gfx/intro/gamefreak_logo.1bpp" - -GFPresentsGFX2: -INCBIN "gfx/intro/logo_star.2bpp" -INCBIN "gfx/intro/logo_sparkle.2bpp" diff --git a/engine/movie/gold_silver_intro.asm b/engine/movie/gold_silver_intro.asm new file mode 100644 index 00000000..3455b136 --- /dev/null +++ b/engine/movie/gold_silver_intro.asm @@ -0,0 +1,1607 @@ +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 .GetGFLogoGFX + +.loop + call .PlayFrame + jr nc, .loop + + ; high bits of wJumptableIndex are recycled for some flags + ; this was set if user canceled by pressing a button + ld a, [wJumptableIndex] + bit 6, a + jr nz, .canceled + + ; clear carry flag from GFPresents_PlayFrame + and a + ret + +.canceled + scf + ret + +.GetGFLogoGFX: +; Load gfx and initialize variables + + ld de, GFPresentsGFX1 + ld hl, vTiles1 + lb bc, BANK(GFPresentsGFX1), 28 + call Get1bpp + + ld de, GFPresentsGFX2 + ld hl, vTiles1 tile 28 + lb bc, BANK(GFPresentsGFX2), 5 + call Request2bpp + + farcall ClearSpriteAnims + + ld hl, wSpriteAnimDict + ld a, 6 + ld [hli], a + ld a, $8d + ld [hl], a + xor a + ld [wJumptableIndex], 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 + +.PlayFrame: +; Play one frame of GFPresents sequence. +; Return carry when the sequence completes or is canceled. + + call JoyTextDelay + ldh a, [hJoyLast] + and BUTTONS + jr nz, .pressed_button + + ; high bits of wJumptableIndex are recycled for some flags + ; this is set when the sequence finished + ld a, [wJumptableIndex] + bit 7, a + jr nz, .finish + + farcall PlaySpriteAnimations + + call GFPresentsJumper + call DelayFrame + + ; ensure carry is cleared + and a + ret + +.pressed_button + ; high bits of wJumptableIndex are recycled for some flags + ld hl, wJumptableIndex + set 6, [hl] + +.finish + callfar ClearSpriteAnims + call ClearTilemap + call ClearSprites + + ld c, 16 + call DelayFrames + + scf + ret + +GFPresentsJumper: + jumptable .scenes, wJumptableIndex + +.scenes + dw GFPresents_Star + dw GFPresents_PlaceLogo + dw GFPresents_LogoSparkles + dw GFPresents_PlacePresents + dw GFPresents_WaitForTimer + dw GFPresents_SetDoneFlag + +GFPresents_NextScene: + ld hl, wJumptableIndex + inc [hl] + ret + +Unreferenced_Functione4a8d: + ld c, 64 + call DelayFrames + call GFPresents_NextScene + ret + +GFPresents_Star: + ; tell GFPresents_PlaceLogo we haven't finished yet + xor a + ld [wIntroSceneFrameCounter], a + + depixel 10, 11, 4, 0 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_STAR + call InitSpriteAnimStruct + + ld hl, SPRITEANIMSTRUCT_0C + add hl, bc + ld [hl], $80 + + ld de, SFX_GAME_FREAK_LOGO_GS + call PlaySFX + + call GFPresents_NextScene + ret + +GFPresents_PlaceLogo: +; Draw the Game Freak logo (may be initially invisible due to palette) + + ; wait until the star animation completed + ; this counter is set in DoAnimFrame.GSIntroStar in engine/gfx/sprite_anims.asm + ld a, [wIntroSceneFrameCounter] + and a + ret z + + depixel 10, 11, 4, 0 + ld a, SPRITE_ANIM_INDEX_GAMEFREAK_LOGO + call InitSpriteAnimStruct + + call GFPresents_NextScene + + ; set timer for GFPresents_LogoSparkles + ld a, $80 + ld [wIntroSceneTimer], a + ret + +GFPresents_LogoSparkles: + ld hl, wIntroSceneTimer + ld a, [hl] + and a + jr z, .done + dec [hl] + + ; add first text when timer passes half + cp $3f + call z, GFPresents_PlaceGameFreak + + ; add sparkles continuously + call GFPresents_Sparkle + ret + +.done + ; set timer for GFPresents_PlacePresents + ld [hl], $80 + call GFPresents_NextScene + ret + +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 +.end + db "@" + +GFPresents_PlacePresents: + hlcoord 7, 13 + ld de, .presents + call PlaceString + + call GFPresents_NextScene + + ; set timer for GFPresents_WaitForTimer + ld a, $80 + ld [wIntroSceneTimer], a + ret + +.presents + db $87, $88, $89, $8a, $8b, $8c +.end + db "@" + +GFPresents_SetDoneFlag: +; Tell GFPresents_PlayFrame and TitleScreenFrame that we're finished. + + ld hl, wJumptableIndex + set 7, [hl] + ret + +GFPresents_WaitForTimer: + ld hl, wIntroSceneTimer + ld a, [hl] + and a + jr z, .done + dec [hl] + ret +.done + call GFPresents_NextScene + ret + +GFPresents_UpdateLogoPal: +; called from 23:5928 +; OBP1 was initialized at end of GFPresents_Init + + ; once we reached the final state, leave it alone + ldh a, [rOBP1] + cp %10010000 + ret z + + ; wait 16 frames before next change + ld a, [wIntroSceneTimer] + and $f + ret nz + + ; rotate OBP1 by one color slot (2 bits) + ; DMG: logo is white, then light gray, then dark gray + ; CGB: logo is white, then yellow + ldh a, [rOBP1] + rrca + rrca + call DmgToCgbObjPal1 + ret + +GFPresents_Sparkle: +; Initialize and configure a sparkle sprite. + + ; run only every second frame + ld d, a + and 1 + ret nz + + ; shift over so our index is still changing by 1 each time + ld a, d + srl a + + ; set up a new sparkle sprite + push af + depixel 11, 11 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_SPARKLE + call InitSpriteAnimStruct + pop af + + ; take the bottom 4 bits of a as an index into + ; sparkle_vectors (16 entries) + and %00001111 + ld e, a + ld d, 0 + ld hl, .sparkle_vectors + add hl, de + add hl, de + + ; set the angle and distance for this sprite + ; bc+$b <- hl (angle), bc+$c <- 0, bc+$d <- hl+1 (distance) + ld e, l + ld d, h + ld hl, $b + add hl, bc + ld a, [de] + ld [hl], a + inc de + ld hl, $c + add hl, bc + ld [hl], 0 + inc hl + ld a, [de] + ld [hl], a + + ret + +.sparkle_vectors + ; values control final position of each sparkle + ; position is automatically animated along the vector + ; each entry emits two sparkles in opposite directions + ; angle (6 bits) and distance (tiles?) + db $00, $03 + db $08, $04 + db $04, $03 + db $0c, $02 + db $10, $02 + db $18, $03 + db $14, $04 + db $1c, $03 + db $20, $02 + db $28, $02 + db $24, $03 + db $2c, $04 + db $30, $04 + db $38, $03 + db $34, $02 + db $3c, $04 + +GFPresentsGFX1: +INCBIN "gfx/intro/gamefreak_presents.1bpp" +INCBIN "gfx/intro/gamefreak_logo.1bpp" + +GFPresentsGFX2: +INCBIN "gfx/intro/logo_star.2bpp" +INCBIN "gfx/intro/logo_sparkle.2bpp" + + +GoldSilverIntro: + call .Init +.Loop: + call .PlayFrame + jr nc, .Loop + ret + +.Init: + farcall ClearSpriteAnims + xor a + ld [wIntroJumptableIndex], a + ldh [hBGMapMode], a + ret + +.PlayFrame: + call JoyTextDelay + ldh a, [hJoyLast] + and BUTTONS + jr nz, .Finish + + ld a, [wIntroJumptableIndex] + bit 7, a + jr nz, .Finish + + farcall PlaySpriteAnimations + call IntroSceneJumper + call DelayFrame + and a + ret + +.Finish: + callfar ClearSpriteAnims + call ClearSprites + call DelayFrame + xor a + ldh [hSCX], a + ldh [hSCY], a + ldh [hLCDCPointer], a + ldh [hLYOverrideStart], a + ldh [hLYOverrideEnd], a + ld a, %11100100 + call DmgToCgbBGPals + depixel 28, 28, 4, 4 + call DmgToCgbObjPals + scf + ret + +IntroSceneJumper: + jumptable .scenes, wIntroJumptableIndex + +.scenes + dw IntroScene1 + dw IntroScene2 + dw IntroScene3 + dw IntroScene4 + dw IntroScene5 + dw IntroScene6 + dw IntroScene7 + dw IntroScene8 + dw IntroScene9 + dw IntroScene10 + dw IntroScene11 + dw IntroScene12 + dw IntroScene13 + dw IntroScene14 + dw IntroScene15 + dw IntroScene16 + dw IntroScene17 + +IntroScene1: +; Set up water cutscene (Shellders/Magikarp/Lapras) + call ClearBGPalettes + call ClearTilemap + ld hl, wIntroJumptableIndex + inc [hl] ; only run once + call DisableLCD + + xor a + ldh [hBGMapMode], a + callfar ClearSpriteAnims + ld a, 1 + ldh [rVBK], a + hlbgcoord 0, 0, vBGMap2 + lb bc, 4, 0 + + xor a + call ByteFill + ld a, 0 + ldh [rVBK], a + call Intro_ResetLYOverrides + ld de, vTiles2 tile $00 + ld hl, Intro_WaterGFX1 + call Decompress + ld a, LOW(Intro_WaterMeta) + ld [wIntroTilesPointer + 0], a + ld a, HIGH(Intro_WaterMeta) + ld [wIntroTilesPointer + 1], a + hlbgcoord 0, 0, vBGMap2 + ld a, l + ld [wIntroBGMapPointer + 0], a + ld a, h + ld [wIntroBGMapPointer + 1], a + ld de, Intro_WaterTilemap + 15 tiles + ld a, e + ld [wIntroTilemapPointer + 0], a + ld a, d + ld [wIntroTilemapPointer + 1], a + call Intro_DrawBackground + + ld de, vTiles0 tile $00 + ld hl, Intro_WaterGFX2 + call Decompress + ld hl, wSpriteAnimDict + ld a, 0 + ld [hli], a + ld a, 0 + ld [hli], a + xor a + ldh [hSCY], a + ld [wGlobalAnimYOffset], a + ld [wGlobalAnimXOffset], a + ld a, $58 + ldh [hSCX], a + xor a + ld [wIntroFrameCounter2], a + ld a, $80 + ld [wIntroFrameCounter1], a + ld a, $42 + ldh [hLCDCPointer], a + call Functione5095 + + xor a + ld [wcb19], a + call EnableLCD + call DelayFrame + ld b, SCGB_GS_INTRO + ld c, 0 + call GetSGBLayout + ld a, %11100100 + call DmgToCgbBGPals + depixel 28, 28 + call DmgToCgbObjPals + call Intro_InitShellders + ld de, MUSIC_GS_OPENING + call PlayMusic + ret + +IntroScene2: +; shellders underwater + call Functione50af + ld hl, wIntroFrameCounter1 + ld a, [hl] + and a + jr z, .skip_intro + dec [hl] + call Intro_InitBubble + ret + +.skip_intro + ld [hl], $10 + ld hl, wIntroJumptableIndex + inc [hl] + +IntroScene3: +; rise towards the surface + call Functione4e90 + call Functione4e67 + ret nc +; next scene if carry flag is set + call Intro_ResetLYOverrides + ld hl, hSCY + inc [hl] + ld hl, wIntroJumptableIndex + inc [hl] + +IntroScene4: +; at surface; Lapras surfs to left of screen + ld a, [wcb19] + and a + jr nz, .next + ld hl, wIntroFrameCounter2 + inc [hl] + ld a, [hl] + and $f + jr nz, .asm_e4e21 + ld hl, hSCX + dec [hl] + dec [hl] + +.asm_e4e21 + call Functione4fde + ret + +.next + ld hl, wIntroJumptableIndex + inc [hl] + xor a + ld [wIntroFrameCounter1], a + +IntroScene5: +; fade out + ld hl, wIntroFrameCounter1 + ld a, [hl] + inc [hl] + swap a + and $f + ld e, a + ld d, 0 + ld hl, .palettes + add hl, de + ld a, [hl] + cp -1 + jr z, .next + call DmgToCgbBGPals + call Functione4fde + ld hl, hSCX + dec [hl] + dec [hl] + ret + +.next + ld hl, wIntroJumptableIndex + inc [hl] + ret + +.palettes + db %11100100, %11100100, %10010000, %01000000, %00000000 + db -1 + +IntroScene17: +; delay a bit before leading into the title screen + ld c, 64 +.loop + call DelayFrame + dec c + jr nz, .loop +; set done flag + ld hl, wIntroJumptableIndex + set 7, [hl] + ret + +Functione4e67: + ld hl, wIntroFrameCounter2 + inc [hl] + ld a, [hl] + and 3 + jr nz, .asm_e4e74 + ld hl, hSCX + dec [hl] + +.asm_e4e74 + and 1 + jr nz, .asm_e4e8c + ld hl, wGlobalAnimYOffset + inc [hl] + ld hl, hSCY + ld a, [hl] + dec [hl] + and $f + call z, Intro_UpdateTilemapAndBGMap + ld a, [wIntroFrameCounter1] + and a + jr z, .asm_e4e8e + +.asm_e4e8c + and a + ret + +.asm_e4e8e + scf + ret + +Functione4e90: + jumptable .dw, wIntroFrameCounter1 + +.dw + dw Functione4eca + dw Functione4eca + dw Functione4eca + dw Functione4ec1 + dw Functione4eca + dw Functione4eca + dw Functione4ece + dw Functione4ece + dw Functione4ece + dw Functione4ed5 + dw Functione4ee8 + dw Functione4eec + dw Functione4eec + dw Functione4eec + dw Functione4eec + dw Functione4eec + dw Functione4eec + +Functione4ec1: + call Intro_InitLapras + depixel 28, 28, 4, 4 + call DmgToCgbObjPals +; fall through + +Functione4eca: + call Functione4fde + ret + +Functione4ece: + call Intro_InitMagikarps + call Functione4fde + ret + +Functione4ed5: + ld hl, wIntroFrameCounter2 + ld a, [hl] + and %00011111 + jr z, .asm_e4ee1 + call Intro_InitMagikarps + ret + +.asm_e4ee1 + callfar Function9102 + ret + +Functione4ee8: + xor a + ldh [hLCDCPointer], a + ret + +Functione4eec: + call Functione50af + ret + +Intro_InitBubble: + ld hl, wIntroFrameCounter1 + ld a, [hl] + and $f + ret nz + ld a, [hl] + and $70 + swap a + ld e, a + ld d, 0 + ld hl, .pixel_table + add hl, de + add hl, de + ld e, [hl] + inc hl + ld d, [hl] + ld a, SPRITE_ANIM_INDEX_GS_INTRO_BUBBLE + call InitSpriteAnimStruct + ret + +.pixel_table + db 6 * 8, 14 * 8 + 4 + db 14 * 8, 18 * 8 + 4 + db 10 * 8, 16 * 8 + 4 + db 12 * 8, 15 * 8 + db 4 * 8, 13 * 8 + db 8 * 8, 17 * 8 + +Intro_InitMagikarps: + depixel 8, 7, 0, 7 + ldh a, [hSGB] + and a + jr z, .ok + depixel 4, 3, 0, 7 + +.ok + ld hl, wIntroFrameCounter2 + ld a, [hl] + and e + ret nz + ld a, [hl] + and d + jr nz, .asm_e4f41 + depixel 29, 28 + call .InitAnim + depixel 26, 0 + call .InitAnim + depixel 0, 24 + call .InitAnim + ret + +.asm_e4f41 + depixel 28, 30 + call .InitAnim + depixel 31, 24 + call .InitAnim + depixel 2, 28 + call .InitAnim + ret + +.InitAnim: + ld a, SPRITE_ANIM_INDEX_GS_INTRO_MAGIKARP + call InitSpriteAnimStruct + ret + +Intro_InitShellders: + depixel 18, 7 + call .InitAnim + depixel 14, 10 + call .InitAnim + depixel 16, 15 + +.InitAnim: + ld a, SPRITE_ANIM_INDEX_GS_INTRO_SHELLDER + call InitSpriteAnimStruct + ret + +Intro_InitLapras: + ld a, [wIntroFrameCounter2] + and %00011111 + ret nz + depixel 16, 24 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_LAPRAS + call InitSpriteAnimStruct + ret + +Intro_UnusedInitLapras: + depixel 2, 0 + ld a, SPRITE_ANIM_INDEX_UNUSED_LAPRAS + call InitSpriteAnimStruct + ret + +Intro_UpdateTilemapAndBGMap: +; add new tiles to top as water scene scrolls up to surface + push hl + push de + + ld a, [wIntroTilemapPointer + 0] + ld e, a + ld a, [wIntroTilemapPointer + 1] + ld d, a + ld hl, -$10 + add hl, de + ld a, l + ld e, l + ld [wIntroTilemapPointer + 0], a + ld a, h + ld d, h + ld [wIntroTilemapPointer + 1], a + hlcoord 0, 0 + ld c, BG_MAP_WIDTH / 2 + +.loop + call Functione54ae + dec c + jr nz, .loop + + ld a, [wIntroBGMapPointer + 0] + ld e, a + ld a, [wIntroBGMapPointer + 1] + ld d, a + ld hl, hCurSpriteYCoord + add hl, de + ld a, l + ld [wIntroBGMapPointer + 0], a + ld [wRequested2bppDest + 0], a + ld a, h + and %11111011 + or %00001000 + ld [wIntroBGMapPointer + 1], a + ld [wRequested2bppDest + 1], a + ld a, LOW(wTilemap) + ld [wRequested2bppSource + 0], a + ld a, HIGH(wTilemap) + ld [wRequested2bppSource + 1], a + ld a, 4 + ld [wRequested2bppSize], a + ld hl, wIntroFrameCounter1 + dec [hl] + + pop de + pop hl + ret + +Functione4fde: +; something to do with water scene sprite anims? + ld hl, wIntroFrameCounter2 + ld a, [hl] + and 3 + cp 3 + ret z + ld a, [wRequested2bppSize] + and a + ret nz + ld a, [hl] + and $30 + swap a + ld l, a + ld h, 0 +rept 5 + add hl, hl +endr + ld de, .data_e5015 + add hl, de + ld a, l + ld [wRequested2bppSource + 0], a + ld a, h + ld [wRequested2bppSource + 1], a + ld a, LOW(vBGMap0 tile $1e) + ld [wRequested2bppDest + 0], a + ld a, HIGH(vBGMap0 tile $1e) + ld [wRequested2bppDest + 1], a + ld a, 2 + ld [wRequested2bppSize], a + ret + +.data_e5015 +rept 8 + db $70, $71, $72, $73 +endr +rept 8 + db $74, $75, $76, $77 +endr +rept 8 + db $78, $79, $7a, $7b +endr +rept 8 + db $7c, $7d, $7e, $7f +endr + +Functione5095: + ld bc, wLYOverrides2 + ld a, wLYOverrides2End - wLYOverrides2 + ld de, vBGMap1 - vBGMap0 + +.loop + push af + push de + farcall BattleAnim_Sine_e + ld a, e + ld [bc], a + inc bc + pop de + inc e + pop af + dec a + jr nz, .loop + ret + +Functione50af: + ld bc, wLYOverrides + ld e, $10 + +.loop1 + ldh a, [hSCY] + ld [bc], a + inc bc + dec e + jr nz, .loop1 + + ld hl, wLYOverrides2 + ld de, wLYOverrides2 + 1 + ld a, [hl] + push af + ld a, $80 + +.loop2 + push af + ld a, [de] + inc de + ld [hli], a + push hl + ld hl, hSCY + add [hl] + ld [bc], a + inc bc + pop hl + pop af + dec a + jr nz, .loop2 + + pop af + ld [hl], a + ret + +IntroScene6: +; Set up grass cutscene (Pikachu/Jigglypuff) + ld hl, wIntroJumptableIndex + inc [hl] ; only run once + call DisableLCD + callfar ClearSpriteAnims + call Intro_ResetLYOverrides + + ld de, vTiles2 + ld hl, Intro_GrassGFX1 + call Decompress + ld a, LOW(Intro_GrassMeta) + ld [wIntroTilesPointer + 0], a + ld a, HIGH(Intro_GrassMeta) + ld [wIntroTilesPointer + 1], a + ld hl, vBGMap0 + ld a, l + ld [wIntroBGMapPointer + 0], a + ld a, h + ld [wIntroBGMapPointer + 1], a + ld de, Intro_GrassTilemap + ld a, e + ld [wIntroTilemapPointer + 0], a + ld a, d + ld [wIntroTilemapPointer + 1], a + call Intro_DrawBackground + + ld de, vTiles0 + ld hl, Intro_GrassGFX2 + call Decompress + ld hl, wSpriteAnimDict + ld a, 1 + ld [hli], a + ld a, 0 + ld [hli], a + xor a + ldh [hSCY], a + ld [wGlobalAnimYOffset], a + ld a, $60 + ldh [hSCX], a + ld a, $a0 + ld [wGlobalAnimXOffset], a + + xor a + ld [wIntroFrameCounter2], a + call EnableLCD + ld b, SCGB_GS_INTRO + ld c, 1 + call GetSGBLayout + ld a, %11100100 + call DmgToCgbBGPals + depixel 28, 28, 4, 4 + call DmgToCgbObjPals + call Intro_InitJigglypuff + xor a + ld [wcb19], a + ret + +IntroScene7: +; scroll left to Jigglypuff + call Intro_InitNote + ld hl, wIntroFrameCounter2 + ld a, [hl] + inc [hl] + and 3 + ret z + ld hl, hSCX + ld a, [hl] + and a + jr z, .next + dec [hl] + ld hl, wGlobalAnimXOffset + inc [hl] + ret + +.next + ld a, -1 + ld [wIntroFrameCounter1], a + call Intro_InitPikachu + ld hl, wIntroJumptableIndex + inc [hl] + ret + +IntroScene8: +; stop scrolling, Pikachu attacks + ld hl, wIntroFrameCounter1 + ld a, [hl] + and a + jr z, .next + dec [hl] + call Intro_InitNote + ld hl, wIntroFrameCounter2 + inc [hl] + ret + +.next + xor a + ld [wIntroFrameCounter1], a + ld hl, wIntroJumptableIndex + inc [hl] + callfar Function9136 + ret + +IntroScene9: +; scroll down and fade out + ld hl, wIntroFrameCounter1 + ld a, [hl] + inc [hl] + srl a + srl a + srl a + ld e, a + ld d, 0 + ld hl, .palettes + add hl, de + ld a, [hl] + cp -1 + jr z, .done + call DmgToCgbBGPals + ld hl, hSCY + inc [hl] + ld hl, wGlobalAnimYOffset + dec [hl] + ret + +.done + ld hl, wIntroJumptableIndex + inc [hl] + ret + +.palettes + db %11100100, %11100100, %11100100, %11100100 + db %11100100, %10010000, %01000000, %00000000 + db -1 + + ret ; unused + +Intro_InitNote: + ld a, [wcb19] + and a + ret nz + ld hl, wIntroFrameCounter2 + ld a, [hl] + and %00111111 + ret nz + ld a, [hl] + and %01111111 + jr z, .invisible + depixel 11, 6, 4, 0 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_NOTE + call InitSpriteAnimStruct + ret + +.invisible + depixel 10, 6, 4, 0 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_INVISIBLE_NOTE + call InitSpriteAnimStruct + ret + +Intro_InitJigglypuff: + depixel 14, 6 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_JIGGLYPUFF + call InitSpriteAnimStruct + ret + +Intro_InitPikachu: + depixel 14, 24 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_PIKACHU + call InitSpriteAnimStruct + depixel 14, 24 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_PIKACHU_TAIL + call InitSpriteAnimStruct + ret + +IntroScene10: +; Set up fireball cutscene (Charizard, Johto starters) + ld hl, wIntroJumptableIndex + inc [hl] ; only run once + call DisableLCD + callfar ClearSpriteAnims + call Intro_ResetLYOverrides + call Intro_BlankTilemapAndBGMap + + ld de, vTiles2 + ld hl, Intro_FireGFX1 + call Decompress + ld de, vTiles1 + ld hl, Intro_FireGFX2 + call Decompress + ld de, vTiles0 + ld hl, Intro_FireGFX3 + ld bc, vTiles1 - vTiles0 + call Decompress + + ld c, CHIKORITA + ld de, vTiles0 tile $10 + farcall Intro_GetMonFrontpic + ld c, CYNDAQUIL + ld de, vTiles0 tile $29 + farcall Intro_GetMonFrontpic + ld c, TOTODILE + ld de, vTiles0 tile $42 + farcall Intro_GetMonFrontpic + + ld hl, wSpriteAnimDict + ld a, 1 + ld [hli], a + ld a, 0 + ld [hli], a + call EnableLCD + ld a, 0 + call Functione5422 + + ld a, $80 + ldh [hSCY], a + xor a + ldh [hSCX], a + ld [wGlobalAnimYOffset], a + ld [wGlobalAnimXOffset], a + + xor a + ld [wIntroFrameCounter2], a + ld b, SCGB_GS_INTRO + ld c, 2 + call GetSGBLayout + ld a, %00111111 + call DmgToCgbBGPals + lb de, %11111111, %11111111 + call DmgToCgbObjPals + ld de, MUSIC_NONE + call PlayMusic + call DelayFrame + ld de, MUSIC_GS_OPENING_2 + call PlayMusic + ret + +IntroScene11: +; scroll up to Charizard silhoutte, flash Johto starters + ld hl, wIntroFrameCounter2 + ld a, [hl] + inc [hl] + and 1 + ret z + call Intro_CheckSCYEvent + ld hl, hSCY + ld a, [hl] + and a + jr z, .next + inc [hl] + ret + +.next + ld hl, wIntroJumptableIndex + inc [hl] + xor a + ld [wIntroFrameCounter1], a +; fall through + +IntroScene12: +; load Charizard palettes + ld hl, wIntroFrameCounter1 + ld a, [hl] + inc [hl] + srl a + srl a + and 3 + ld e, a + ld d, 0 + ld hl, .palettes + add hl, de + ld a, [hl] + and a + jr z, .next + call DmgToCgbBGPals + ld e, a + ld d, a + call DmgToCgbObjPals + ret + +.next + ld hl, wIntroJumptableIndex + inc [hl] + ld a, $80 + ld [wIntroFrameCounter1], a + ret + +.palettes + db %01101010, %10100101, %11100100, %00000000 + +IntroScene13: +; Charizard mouth closed + ld hl, wIntroFrameCounter1 + ld a, [hl] + and a + jr z, .next + dec [hl] + ret + +.next + ld hl, wIntroJumptableIndex + inc [hl] + ld a, 1 + call Functione5422 + ld a, 4 + ld [wIntroFrameCounter1], a + ret + +IntroScene14: +; Charizard mouth open + ld hl, wIntroFrameCounter1 + ld a, [hl] + and a + jr z, .next + dec [hl] + ret + +.next + ld hl, wIntroJumptableIndex + inc [hl] + ld a, 2 + call Functione5422 + ld a, 64 + ld [wIntroFrameCounter1], a + xor a + ld [wIntroFrameCounter2], a + ld de, SFX_GS_INTRO_CHARIZARD_FIREBALL + call PlaySFX +; fall through + +IntroScene15: +; Charizard mouth wide open / fireball starts + call Functione5473 + ld hl, wIntroFrameCounter1 + ld a, [hl] + and a + jr z, .next + dec [hl] + ret + +.next + ld hl, wIntroJumptableIndex + inc [hl] + xor a + ld [wIntroFrameCounter1], a + ret + +IntroScene16: +; continue fireball / fade out palettes + call Functione5473 + ld hl, wIntroFrameCounter1 + ld a, [hl] + inc [hl] + swap a + and 7 + ld e, a + ld d, 0 + ld hl, .palettes + add hl, de + ld a, [hl] + cp -1 + jr z, .next + call DmgToCgbBGPals + ld e, a + ld d, a + call DmgToCgbObjPals + ret + +.next + ld hl, wIntroJumptableIndex + inc [hl] + ret + +.palettes + db %11100100, %10010000, %01000000, %00000000 + db -1 + +Intro_BlankTilemapAndBGMap: + hlcoord 0, 0 + ld bc, wTilemapEnd - wTilemap + xor a + call ByteFill + ld hl, vBGMap0 + ld bc, vBGMap1 - vBGMap0 + xor a + call ByteFill + ret + +Intro_CheckSCYEvent: + ldh a, [hSCY] + ld c, a + ld hl, .scy_jumptable + +.loop + ld a, [hli] + cp -1 + ret z + cp c + jr z, .value_found + inc hl + inc hl + jr .loop + +.value_found + ld a, [hli] + ld h, [hl] + ld l, a + jp hl + +.scy_jumptable + dbw $86, Functione53f7 + dbw $87, Intro_ChikoritaAppears + dbw $88, Functione53e0 + dbw $98, Functione53eb + dbw $99, Functione5400 + dbw $af, Intro_CyndaquilAppears + dbw $b0, Functione53e0 + dbw $c0, Functione53eb + dbw $c1, Functione5409 + dbw $d7, Intro_TotodileAppears + dbw $d8, Functione53e0 + dbw $e8, Functione53eb + dbw $e9, Functione5412 + db -1 + +Intro_ChikoritaAppears: + ld de, SFX_GS_INTRO_POKEMON_APPEARS + call PlaySFX + depixel 22, 1 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_CHIKORITA + call InitSpriteAnimStruct + ret + +Intro_CyndaquilAppears: + ld de, SFX_GS_INTRO_POKEMON_APPEARS + call PlaySFX + depixel 22, 20 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_CYNDAQUIL + call InitSpriteAnimStruct + ret + +Intro_TotodileAppears: + ld de, SFX_GS_INTRO_POKEMON_APPEARS + call PlaySFX + depixel 22, 1 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_TOTODILE + call InitSpriteAnimStruct + ret + +Functione53e0: + depixel 28, 28, 4, 4 + call DmgToCgbObjPals + xor a + call DmgToCgbBGPals + ret + +Functione53eb: + depixel 31, 31, 7, 7 + call DmgToCgbObjPals + ld a, %00111111 + call DmgToCgbBGPals + ret + +Functione53f7: + ld c, CHIKORITA + farcall Function9178 + ret + +Functione5400: + ld c, CYNDAQUIL + farcall Function9178 + ret + +Functione5409: + ld c, TOTODILE + farcall Function9178 + ret + +Functione5412: + ldh a, [hCGB] + and a + ld c, CYNDAQUIL + jr nz, .got_mon + ld c, CHARIZARD +.got_mon + farcall Function9178 + ret + +Functione5422: + push af + hlcoord 0, 6 + ld c, $a0 + xor a +.loop1 + ld [hli], a + dec c + jr nz, .loop1 + + pop af + ld e, a + ld d, 0 + ld hl, .data_e5464 +rept 5 + add hl, de +endr + ld e, [hl] + inc hl + ld c, [hl] + inc hl + ld b, [hl] + inc hl + ld a, [hli] + ld h, [hl] + ld l, a + ld a, e + +.loop2_outer + push bc + push hl +.loop2_inner + ld [hli], a + inc a + dec c + jr nz, .loop2_inner + + pop hl + ld bc, SCREEN_WIDTH + add hl, bc + pop bc + dec b + jr nz, .loop2_outer + + ld a, 1 + ldh [hBGMapMode], a + call DelayFrame + call DelayFrame + call DelayFrame + xor a + ldh [hBGMapMode], a + ret + +.data_e5464 +; vtile offset, width, height, x, y? + db $00, 8, 8 + dwcoord 10, 6 + db $40, 9, 8 + dwcoord 9, 6 + db $88, 9, 8 + dwcoord 8, 6 + +Functione5473: + ld hl, wIntroFrameCounter2 + ld a, [hl] + inc [hl] + and 3 + ret nz + depixel 12, 10, 4, 4 + ld a, SPRITE_ANIM_INDEX_GS_INTRO_FIREBALL + call InitSpriteAnimStruct + ld hl, hSCX + dec [hl] + ld hl, wGlobalAnimXOffset + inc [hl] + ret + +Unreferenced_Functione548c: + ld bc, vTiles1 - vTiles0 +.loop + ld a, [de] + inc de + ld [hli], a + dec bc + ld a, c + or b + jr nz, .loop + ret + +Intro_DrawBackground: + ld b, BG_MAP_WIDTH / 2 + +.outer_loop + push hl + ld c, BG_MAP_HEIGHT / 2 +.inner_loop + call Functione54ae + dec c + jr nz, .inner_loop + + pop hl + push bc + ld bc, 2 * BG_MAP_WIDTH + add hl, bc + pop bc + dec b + jr nz, .outer_loop + + ret + +Functione54ae: +; load tile data into a 2x2 section of the bgmap or tilemap + push bc + push de + push hl + push hl + push hl + + ld a, [de] + ld l, a + ld h, 0 + ld a, [wIntroTilesPointer + 0] + ld e, a + ld a, [wIntroTilesPointer + 1] + ld d, a + add hl, hl + add hl, hl + add hl, de + ld e, l + ld d, h + pop hl + ld a, [de] + inc de + ld [hli], a + ld a, [de] + inc de + ld [hli], a + pop hl + ld bc, BG_MAP_WIDTH + add hl, bc + ld a, [de] + inc de + ld [hli], a + ld a, [de] + inc de + ld [hli], a + + pop hl + inc hl + inc hl + pop de + inc de + pop bc + ret + +Intro_ResetLYOverrides: + ld hl, wLYOverrides + xor a + ld c, wLYOverrides2 - wLYOverrides +.loop + ld [hli], a + dec c + jr nz, .loop + ret + +Intro_WaterGFX1: +INCBIN "gfx/intro/water1.2bpp.lz" + +Intro_WaterTilemap: +INCBIN "gfx/intro/water.tilemap" + +Intro_WaterMeta: +INCBIN "gfx/intro/water.bin" + +Intro_WaterGFX2: +INCBIN "gfx/intro/water2.2bpp.lz" + +Intro_GrassGFX1: +INCBIN "gfx/intro/grass1.2bpp.lz" + +Intro_GrassTilemap: +INCBIN "gfx/intro/grass.tilemap" + +Intro_GrassMeta: +INCBIN "gfx/intro/grass.bin" + +Intro_GrassGFX2: +INCBIN "gfx/intro/grass2.2bpp.lz" + +Intro_FireGFX1: +INCBIN "gfx/intro/charizard1.2bpp.lz" + +Intro_FireGFX2: +INCBIN "gfx/intro/charizard2.2bpp.lz" + +Intro_FireGFX3: +INCBIN "gfx/intro/charizard3.2bpp.lz" diff --git a/engine/movie/gs_intro.asm b/engine/movie/gs_intro.asm deleted file mode 100644 index a031ccfa..00000000 --- a/engine/movie/gs_intro.asm +++ /dev/null @@ -1,1259 +0,0 @@ -GoldSilverIntro: - call .Init -.Loop: - call .PlayFrame - jr nc, .Loop - ret - -.Init: - farcall ClearSpriteAnims - xor a - ld [wIntroJumptableIndex], a - ldh [hBGMapMode], a - ret - -.PlayFrame: - call JoyTextDelay - ldh a, [hJoyLast] - and BUTTONS - jr nz, .Finish - - ld a, [wIntroJumptableIndex] - bit 7, a - jr nz, .Finish - - farcall PlaySpriteAnimations - call IntroSceneJumper - call DelayFrame - and a - ret - -.Finish: - callfar ClearSpriteAnims - call ClearSprites - call DelayFrame - xor a - ldh [hSCX], a - ldh [hSCY], a - ldh [hLCDCPointer], a - ldh [hLYOverrideStart], a - ldh [hLYOverrideEnd], a - ld a, %11100100 - call DmgToCgbBGPals - depixel 28, 28, 4, 4 - call DmgToCgbObjPals - scf - ret - -IntroSceneJumper: - jumptable .scenes, wIntroJumptableIndex - -.scenes - dw IntroScene1 - dw IntroScene2 - dw IntroScene3 - dw IntroScene4 - dw IntroScene5 - dw IntroScene6 - dw IntroScene7 - dw IntroScene8 - dw IntroScene9 - dw IntroScene10 - dw IntroScene11 - dw IntroScene12 - dw IntroScene13 - dw IntroScene14 - dw IntroScene15 - dw IntroScene16 - dw IntroScene17 - -IntroScene1: -; Set up water cutscene (Shellders/Magikarp/Lapras) - call ClearBGPalettes - call ClearTilemap - ld hl, wIntroJumptableIndex - inc [hl] ; only run once - call DisableLCD - - xor a - ldh [hBGMapMode], a - callfar ClearSpriteAnims - ld a, 1 - ldh [rVBK], a - hlbgcoord 0, 0, vBGMap2 - lb bc, 4, 0 - - xor a - call ByteFill - ld a, 0 - ldh [rVBK], a - call Intro_ResetLYOverrides - ld de, vTiles2 tile $00 - ld hl, Intro_WaterGFX1 - call Decompress - ld a, LOW(Intro_WaterMeta) - ld [wIntroTilesPointer + 0], a - ld a, HIGH(Intro_WaterMeta) - ld [wIntroTilesPointer + 1], a - hlbgcoord 0, 0, vBGMap2 - ld a, l - ld [wIntroBGMapPointer + 0], a - ld a, h - ld [wIntroBGMapPointer + 1], a - ld de, Intro_WaterTilemap + 15 tiles - ld a, e - ld [wIntroTilemapPointer + 0], a - ld a, d - ld [wIntroTilemapPointer + 1], a - call Intro_DrawBackground - - ld de, vTiles0 tile $00 - ld hl, Intro_WaterGFX2 - call Decompress - ld hl, wSpriteAnimDict - ld a, 0 - ld [hli], a - ld a, 0 - ld [hli], a - xor a - ldh [hSCY], a - ld [wGlobalAnimYOffset], a - ld [wGlobalAnimXOffset], a - ld a, $58 - ldh [hSCX], a - xor a - ld [wIntroFrameCounter2], a - ld a, $80 - ld [wIntroFrameCounter1], a - ld a, $42 - ldh [hLCDCPointer], a - call Functione5095 - - xor a - ld [wcb19], a - call EnableLCD - call DelayFrame - ld b, SCGB_GS_INTRO - ld c, 0 - call GetSGBLayout - ld a, %11100100 - call DmgToCgbBGPals - depixel 28, 28 - call DmgToCgbObjPals - call Intro_InitShellders - ld de, MUSIC_GS_OPENING - call PlayMusic - ret - -IntroScene2: -; shellders underwater - call Functione50af - ld hl, wIntroFrameCounter1 - ld a, [hl] - and a - jr z, .skip_intro - dec [hl] - call Intro_InitBubble - ret - -.skip_intro - ld [hl], $10 - ld hl, wIntroJumptableIndex - inc [hl] - -IntroScene3: -; rise towards the surface - call Functione4e90 - call Functione4e67 - ret nc -; next scene if carry flag is set - call Intro_ResetLYOverrides - ld hl, hSCY - inc [hl] - ld hl, wIntroJumptableIndex - inc [hl] - -IntroScene4: -; at surface; Lapras surfs to left of screen - ld a, [wcb19] - and a - jr nz, .next - ld hl, wIntroFrameCounter2 - inc [hl] - ld a, [hl] - and $f - jr nz, .asm_e4e21 - ld hl, hSCX - dec [hl] - dec [hl] - -.asm_e4e21 - call Functione4fde - ret - -.next - ld hl, wIntroJumptableIndex - inc [hl] - xor a - ld [wIntroFrameCounter1], a - -IntroScene5: -; fade out - ld hl, wIntroFrameCounter1 - ld a, [hl] - inc [hl] - swap a - and $f - ld e, a - ld d, 0 - ld hl, .palettes - add hl, de - ld a, [hl] - cp -1 - jr z, .next - call DmgToCgbBGPals - call Functione4fde - ld hl, hSCX - dec [hl] - dec [hl] - ret - -.next - ld hl, wIntroJumptableIndex - inc [hl] - ret - -.palettes - db %11100100, %11100100, %10010000, %01000000, %00000000 - db -1 - -IntroScene17: -; delay a bit before leading into the title screen - ld c, 64 -.loop - call DelayFrame - dec c - jr nz, .loop -; set done flag - ld hl, wIntroJumptableIndex - set 7, [hl] - ret - -Functione4e67: - ld hl, wIntroFrameCounter2 - inc [hl] - ld a, [hl] - and 3 - jr nz, .asm_e4e74 - ld hl, hSCX - dec [hl] - -.asm_e4e74 - and 1 - jr nz, .asm_e4e8c - ld hl, wGlobalAnimYOffset - inc [hl] - ld hl, hSCY - ld a, [hl] - dec [hl] - and $f - call z, Intro_UpdateTilemapAndBGMap - ld a, [wIntroFrameCounter1] - and a - jr z, .asm_e4e8e - -.asm_e4e8c - and a - ret - -.asm_e4e8e - scf - ret - -Functione4e90: - jumptable .dw, wIntroFrameCounter1 - -.dw - dw Functione4eca - dw Functione4eca - dw Functione4eca - dw Functione4ec1 - dw Functione4eca - dw Functione4eca - dw Functione4ece - dw Functione4ece - dw Functione4ece - dw Functione4ed5 - dw Functione4ee8 - dw Functione4eec - dw Functione4eec - dw Functione4eec - dw Functione4eec - dw Functione4eec - dw Functione4eec - -Functione4ec1: - call Intro_InitLapras - depixel 28, 28, 4, 4 - call DmgToCgbObjPals -; fall through - -Functione4eca: - call Functione4fde - ret - -Functione4ece: - call Intro_InitMagikarps - call Functione4fde - ret - -Functione4ed5: - ld hl, wIntroFrameCounter2 - ld a, [hl] - and %00011111 - jr z, .asm_e4ee1 - call Intro_InitMagikarps - ret - -.asm_e4ee1 - callfar Function9102 - ret - -Functione4ee8: - xor a - ldh [hLCDCPointer], a - ret - -Functione4eec: - call Functione50af - ret - -Intro_InitBubble: - ld hl, wIntroFrameCounter1 - ld a, [hl] - and $f - ret nz - ld a, [hl] - and $70 - swap a - ld e, a - ld d, 0 - ld hl, .pixel_table - add hl, de - add hl, de - ld e, [hl] - inc hl - ld d, [hl] - ld a, SPRITE_ANIM_INDEX_GS_INTRO_BUBBLE - call InitSpriteAnimStruct - ret - -.pixel_table - db 6 * 8, 14 * 8 + 4 - db 14 * 8, 18 * 8 + 4 - db 10 * 8, 16 * 8 + 4 - db 12 * 8, 15 * 8 - db 4 * 8, 13 * 8 - db 8 * 8, 17 * 8 - -Intro_InitMagikarps: - depixel 8, 7, 0, 7 - ldh a, [hSGB] - and a - jr z, .ok - depixel 4, 3, 0, 7 - -.ok - ld hl, wIntroFrameCounter2 - ld a, [hl] - and e - ret nz - ld a, [hl] - and d - jr nz, .asm_e4f41 - depixel 29, 28 - call .InitAnim - depixel 26, 0 - call .InitAnim - depixel 0, 24 - call .InitAnim - ret - -.asm_e4f41 - depixel 28, 30 - call .InitAnim - depixel 31, 24 - call .InitAnim - depixel 2, 28 - call .InitAnim - ret - -.InitAnim: - ld a, SPRITE_ANIM_INDEX_GS_INTRO_MAGIKARP - call InitSpriteAnimStruct - ret - -Intro_InitShellders: - depixel 18, 7 - call .InitAnim - depixel 14, 10 - call .InitAnim - depixel 16, 15 - -.InitAnim: - ld a, SPRITE_ANIM_INDEX_GS_INTRO_SHELLDER - call InitSpriteAnimStruct - ret - -Intro_InitLapras: - ld a, [wIntroFrameCounter2] - and %00011111 - ret nz - depixel 16, 24 - ld a, SPRITE_ANIM_INDEX_GS_INTRO_LAPRAS - call InitSpriteAnimStruct - ret - -Intro_UnusedInitLapras: - depixel 2, 0 - ld a, SPRITE_ANIM_INDEX_UNUSED_LAPRAS - call InitSpriteAnimStruct - ret - -Intro_UpdateTilemapAndBGMap: -; add new tiles to top as water scene scrolls up to surface - push hl - push de - - ld a, [wIntroTilemapPointer + 0] - ld e, a - ld a, [wIntroTilemapPointer + 1] - ld d, a - ld hl, -$10 - add hl, de - ld a, l - ld e, l - ld [wIntroTilemapPointer + 0], a - ld a, h - ld d, h - ld [wIntroTilemapPointer + 1], a - hlcoord 0, 0 - ld c, BG_MAP_WIDTH / 2 - -.loop - call Functione54ae - dec c - jr nz, .loop - - ld a, [wIntroBGMapPointer + 0] - ld e, a - ld a, [wIntroBGMapPointer + 1] - ld d, a - ld hl, hCurSpriteYCoord - add hl, de - ld a, l - ld [wIntroBGMapPointer + 0], a - ld [wRequested2bppDest + 0], a - ld a, h - and %11111011 - or %00001000 - ld [wIntroBGMapPointer + 1], a - ld [wRequested2bppDest + 1], a - ld a, LOW(wTilemap) - ld [wRequested2bppSource + 0], a - ld a, HIGH(wTilemap) - ld [wRequested2bppSource + 1], a - ld a, 4 - ld [wRequested2bppSize], a - ld hl, wIntroFrameCounter1 - dec [hl] - - pop de - pop hl - ret - -Functione4fde: -; something to do with water scene sprite anims? - ld hl, wIntroFrameCounter2 - ld a, [hl] - and 3 - cp 3 - ret z - ld a, [wRequested2bppSize] - and a - ret nz - ld a, [hl] - and $30 - swap a - ld l, a - ld h, 0 -rept 5 - add hl, hl -endr - ld de, .data_e5015 - add hl, de - ld a, l - ld [wRequested2bppSource + 0], a - ld a, h - ld [wRequested2bppSource + 1], a - ld a, LOW(vBGMap0 tile $1e) - ld [wRequested2bppDest + 0], a - ld a, HIGH(vBGMap0 tile $1e) - ld [wRequested2bppDest + 1], a - ld a, 2 - ld [wRequested2bppSize], a - ret - -.data_e5015 -rept 8 - db $70, $71, $72, $73 -endr -rept 8 - db $74, $75, $76, $77 -endr -rept 8 - db $78, $79, $7a, $7b -endr -rept 8 - db $7c, $7d, $7e, $7f -endr - -Functione5095: - ld bc, wLYOverrides2 - ld a, wLYOverrides2End - wLYOverrides2 - ld de, vBGMap1 - vBGMap0 - -.loop - push af - push de - farcall BattleAnim_Sine_e - ld a, e - ld [bc], a - inc bc - pop de - inc e - pop af - dec a - jr nz, .loop - ret - -Functione50af: - ld bc, wLYOverrides - ld e, $10 - -.loop1 - ldh a, [hSCY] - ld [bc], a - inc bc - dec e - jr nz, .loop1 - - ld hl, wLYOverrides2 - ld de, wLYOverrides2 + 1 - ld a, [hl] - push af - ld a, $80 - -.loop2 - push af - ld a, [de] - inc de - ld [hli], a - push hl - ld hl, hSCY - add [hl] - ld [bc], a - inc bc - pop hl - pop af - dec a - jr nz, .loop2 - - pop af - ld [hl], a - ret - -IntroScene6: -; Set up grass cutscene (Pikachu/Jigglypuff) - ld hl, wIntroJumptableIndex - inc [hl] ; only run once - call DisableLCD - callfar ClearSpriteAnims - call Intro_ResetLYOverrides - - ld de, vTiles2 - ld hl, Intro_GrassGFX1 - call Decompress - ld a, LOW(Intro_GrassMeta) - ld [wIntroTilesPointer + 0], a - ld a, HIGH(Intro_GrassMeta) - ld [wIntroTilesPointer + 1], a - ld hl, vBGMap0 - ld a, l - ld [wIntroBGMapPointer + 0], a - ld a, h - ld [wIntroBGMapPointer + 1], a - ld de, Intro_GrassTilemap - ld a, e - ld [wIntroTilemapPointer + 0], a - ld a, d - ld [wIntroTilemapPointer + 1], a - call Intro_DrawBackground - - ld de, vTiles0 - ld hl, Intro_GrassGFX2 - call Decompress - ld hl, wSpriteAnimDict - ld a, 1 - ld [hli], a - ld a, 0 - ld [hli], a - xor a - ldh [hSCY], a - ld [wGlobalAnimYOffset], a - ld a, $60 - ldh [hSCX], a - ld a, $a0 - ld [wGlobalAnimXOffset], a - - xor a - ld [wIntroFrameCounter2], a - call EnableLCD - ld b, SCGB_GS_INTRO - ld c, 1 - call GetSGBLayout - ld a, %11100100 - call DmgToCgbBGPals - depixel 28, 28, 4, 4 - call DmgToCgbObjPals - call Intro_InitJigglypuff - xor a - ld [wcb19], a - ret - -IntroScene7: -; scroll left to Jigglypuff - call Intro_InitNote - ld hl, wIntroFrameCounter2 - ld a, [hl] - inc [hl] - and 3 - ret z - ld hl, hSCX - ld a, [hl] - and a - jr z, .next - dec [hl] - ld hl, wGlobalAnimXOffset - inc [hl] - ret - -.next - ld a, -1 - ld [wIntroFrameCounter1], a - call Intro_InitPikachu - ld hl, wIntroJumptableIndex - inc [hl] - ret - -IntroScene8: -; stop scrolling, Pikachu attacks - ld hl, wIntroFrameCounter1 - ld a, [hl] - and a - jr z, .next - dec [hl] - call Intro_InitNote - ld hl, wIntroFrameCounter2 - inc [hl] - ret - -.next - xor a - ld [wIntroFrameCounter1], a - ld hl, wIntroJumptableIndex - inc [hl] - callfar Function9136 - ret - -IntroScene9: -; scroll down and fade out - ld hl, wIntroFrameCounter1 - ld a, [hl] - inc [hl] - srl a - srl a - srl a - ld e, a - ld d, 0 - ld hl, .palettes - add hl, de - ld a, [hl] - cp -1 - jr z, .done - call DmgToCgbBGPals - ld hl, hSCY - inc [hl] - ld hl, wGlobalAnimYOffset - dec [hl] - ret - -.done - ld hl, wIntroJumptableIndex - inc [hl] - ret - -.palettes - db %11100100, %11100100, %11100100, %11100100 - db %11100100, %10010000, %01000000, %00000000 - db -1 - - ret ; unused - -Intro_InitNote: - ld a, [wcb19] - and a - ret nz - ld hl, wIntroFrameCounter2 - ld a, [hl] - and %00111111 - ret nz - ld a, [hl] - and %01111111 - jr z, .invisible - depixel 11, 6, 4, 0 - ld a, SPRITE_ANIM_INDEX_GS_INTRO_NOTE - call InitSpriteAnimStruct - ret - -.invisible - depixel 10, 6, 4, 0 - ld a, SPRITE_ANIM_INDEX_GS_INTRO_INVISIBLE_NOTE - call InitSpriteAnimStruct - ret - -Intro_InitJigglypuff: - depixel 14, 6 - ld a, SPRITE_ANIM_INDEX_GS_INTRO_JIGGLYPUFF - call InitSpriteAnimStruct - ret - -Intro_InitPikachu: - depixel 14, 24 - ld a, SPRITE_ANIM_INDEX_GS_INTRO_PIKACHU - call InitSpriteAnimStruct - depixel 14, 24 - ld a, SPRITE_ANIM_INDEX_GS_INTRO_PIKACHU_TAIL - call InitSpriteAnimStruct - ret - -IntroScene10: -; Set up fireball cutscene (Charizard, Johto starters) - ld hl, wIntroJumptableIndex - inc [hl] ; only run once - call DisableLCD - callfar ClearSpriteAnims - call Intro_ResetLYOverrides - call Intro_BlankTilemapAndBGMap - - ld de, vTiles2 - ld hl, Intro_FireGFX1 - call Decompress - ld de, vTiles1 - ld hl, Intro_FireGFX2 - call Decompress - ld de, vTiles0 - ld hl, Intro_FireGFX3 - ld bc, vTiles1 - vTiles0 - call Decompress - - ld c, CHIKORITA - ld de, vTiles0 tile $10 - farcall Intro_GetMonFrontpic - ld c, CYNDAQUIL - ld de, vTiles0 tile $29 - farcall Intro_GetMonFrontpic - ld c, TOTODILE - ld de, vTiles0 tile $42 - farcall Intro_GetMonFrontpic - - ld hl, wSpriteAnimDict - ld a, 1 - ld [hli], a - ld a, 0 - ld [hli], a - call EnableLCD - ld a, 0 - call Functione5422 - - ld a, $80 - ldh [hSCY], a - xor a - ldh [hSCX], a - ld [wGlobalAnimYOffset], a - ld [wGlobalAnimXOffset], a - - xor a - ld [wIntroFrameCounter2], a - ld b, SCGB_GS_INTRO - ld c, 2 - call GetSGBLayout - ld a, %00111111 - call DmgToCgbBGPals - lb de, %11111111, %11111111 - call DmgToCgbObjPals - ld de, MUSIC_NONE - call PlayMusic - call DelayFrame - ld de, MUSIC_GS_OPENING_2 - call PlayMusic - ret - -IntroScene11: -; scroll up to Charizard silhoutte, flash Johto starters - ld hl, wIntroFrameCounter2 - ld a, [hl] - inc [hl] - and 1 - ret z - call Intro_CheckSCYEvent - ld hl, hSCY - ld a, [hl] - and a - jr z, .next - inc [hl] - ret - -.next - ld hl, wIntroJumptableIndex - inc [hl] - xor a - ld [wIntroFrameCounter1], a -; fall through - -IntroScene12: -; load Charizard palettes - ld hl, wIntroFrameCounter1 - ld a, [hl] - inc [hl] - srl a - srl a - and 3 - ld e, a - ld d, 0 - ld hl, .palettes - add hl, de - ld a, [hl] - and a - jr z, .next - call DmgToCgbBGPals - ld e, a - ld d, a - call DmgToCgbObjPals - ret - -.next - ld hl, wIntroJumptableIndex - inc [hl] - ld a, $80 - ld [wIntroFrameCounter1], a - ret - -.palettes - db %01101010, %10100101, %11100100, %00000000 - -IntroScene13: -; Charizard mouth closed - ld hl, wIntroFrameCounter1 - ld a, [hl] - and a - jr z, .next - dec [hl] - ret - -.next - ld hl, wIntroJumptableIndex - inc [hl] - ld a, 1 - call Functione5422 - ld a, 4 - ld [wIntroFrameCounter1], a - ret - -IntroScene14: -; Charizard mouth open - ld hl, wIntroFrameCounter1 - ld a, [hl] - and a - jr z, .next - dec [hl] - ret - -.next - ld hl, wIntroJumptableIndex - inc [hl] - ld a, 2 - call Functione5422 - ld a, 64 - ld [wIntroFrameCounter1], a - xor a - ld [wIntroFrameCounter2], a - ld de, SFX_GS_INTRO_CHARIZARD_FIREBALL - call PlaySFX -; fall through - -IntroScene15: -; Charizard mouth wide open / fireball starts - call Functione5473 - ld hl, wIntroFrameCounter1 - ld a, [hl] - and a - jr z, .next - dec [hl] - ret - -.next - ld hl, wIntroJumptableIndex - inc [hl] - xor a - ld [wIntroFrameCounter1], a - ret - -IntroScene16: -; continue fireball / fade out palettes - call Functione5473 - ld hl, wIntroFrameCounter1 - ld a, [hl] - inc [hl] - swap a - and 7 - ld e, a - ld d, 0 - ld hl, .palettes - add hl, de - ld a, [hl] - cp -1 - jr z, .next - call DmgToCgbBGPals - ld e, a - ld d, a - call DmgToCgbObjPals - ret - -.next - ld hl, wIntroJumptableIndex - inc [hl] - ret - -.palettes - db %11100100, %10010000, %01000000, %00000000 - db -1 - -Intro_BlankTilemapAndBGMap: - hlcoord 0, 0 - ld bc, wTilemapEnd - wTilemap - xor a - call ByteFill - ld hl, vBGMap0 - ld bc, vBGMap1 - vBGMap0 - xor a - call ByteFill - ret - -Intro_CheckSCYEvent: - ldh a, [hSCY] - ld c, a - ld hl, .scy_jumptable - -.loop - ld a, [hli] - cp -1 - ret z - cp c - jr z, .value_found - inc hl - inc hl - jr .loop - -.value_found - ld a, [hli] - ld h, [hl] - ld l, a - jp hl - -.scy_jumptable - dbw $86, Functione53f7 - dbw $87, Intro_ChikoritaAppears - dbw $88, Functione53e0 - dbw $98, Functione53eb - dbw $99, Functione5400 - dbw $af, Intro_CyndaquilAppears - dbw $b0, Functione53e0 - dbw $c0, Functione53eb - dbw $c1, Functione5409 - dbw $d7, Intro_TotodileAppears - dbw $d8, Functione53e0 - dbw $e8, Functione53eb - dbw $e9, Functione5412 - db -1 - -Intro_ChikoritaAppears: - ld de, SFX_GS_INTRO_POKEMON_APPEARS - call PlaySFX - depixel 22, 1 - ld a, SPRITE_ANIM_INDEX_GS_INTRO_CHIKORITA - call InitSpriteAnimStruct - ret - -Intro_CyndaquilAppears: - ld de, SFX_GS_INTRO_POKEMON_APPEARS - call PlaySFX - depixel 22, 20 - ld a, SPRITE_ANIM_INDEX_GS_INTRO_CYNDAQUIL - call InitSpriteAnimStruct - ret - -Intro_TotodileAppears: - ld de, SFX_GS_INTRO_POKEMON_APPEARS - call PlaySFX - depixel 22, 1 - ld a, SPRITE_ANIM_INDEX_GS_INTRO_TOTODILE - call InitSpriteAnimStruct - ret - -Functione53e0: - depixel 28, 28, 4, 4 - call DmgToCgbObjPals - xor a - call DmgToCgbBGPals - ret - -Functione53eb: - depixel 31, 31, 7, 7 - call DmgToCgbObjPals - ld a, %00111111 - call DmgToCgbBGPals - ret - -Functione53f7: - ld c, CHIKORITA - farcall Function9178 - ret - -Functione5400: - ld c, CYNDAQUIL - farcall Function9178 - ret - -Functione5409: - ld c, TOTODILE - farcall Function9178 - ret - -Functione5412: - ldh a, [hCGB] - and a - ld c, CYNDAQUIL - jr nz, .got_mon - ld c, CHARIZARD -.got_mon - farcall Function9178 - ret - -Functione5422: - push af - hlcoord 0, 6 - ld c, $a0 - xor a -.loop1 - ld [hli], a - dec c - jr nz, .loop1 - - pop af - ld e, a - ld d, 0 - ld hl, .data_e5464 -rept 5 - add hl, de -endr - ld e, [hl] - inc hl - ld c, [hl] - inc hl - ld b, [hl] - inc hl - ld a, [hli] - ld h, [hl] - ld l, a - ld a, e - -.loop2_outer - push bc - push hl -.loop2_inner - ld [hli], a - inc a - dec c - jr nz, .loop2_inner - - pop hl - ld bc, SCREEN_WIDTH - add hl, bc - pop bc - dec b - jr nz, .loop2_outer - - ld a, 1 - ldh [hBGMapMode], a - call DelayFrame - call DelayFrame - call DelayFrame - xor a - ldh [hBGMapMode], a - ret - -.data_e5464 -; vtile offset, width, height, x, y? - db $00, 8, 8 - dwcoord 10, 6 - db $40, 9, 8 - dwcoord 9, 6 - db $88, 9, 8 - dwcoord 8, 6 - -Functione5473: - ld hl, wIntroFrameCounter2 - ld a, [hl] - inc [hl] - and 3 - ret nz - depixel 12, 10, 4, 4 - ld a, SPRITE_ANIM_INDEX_GS_INTRO_FIREBALL - call InitSpriteAnimStruct - ld hl, hSCX - dec [hl] - ld hl, wGlobalAnimXOffset - inc [hl] - ret - -Unreferenced_Functione548c: - ld bc, vTiles1 - vTiles0 -.loop - ld a, [de] - inc de - ld [hli], a - dec bc - ld a, c - or b - jr nz, .loop - ret - -Intro_DrawBackground: - ld b, BG_MAP_WIDTH / 2 - -.outer_loop - push hl - ld c, BG_MAP_HEIGHT / 2 -.inner_loop - call Functione54ae - dec c - jr nz, .inner_loop - - pop hl - push bc - ld bc, 2 * BG_MAP_WIDTH - add hl, bc - pop bc - dec b - jr nz, .outer_loop - - ret - -Functione54ae: -; load tile data into a 2x2 section of the bgmap or tilemap - push bc - push de - push hl - push hl - push hl - - ld a, [de] - ld l, a - ld h, 0 - ld a, [wIntroTilesPointer + 0] - ld e, a - ld a, [wIntroTilesPointer + 1] - ld d, a - add hl, hl - add hl, hl - add hl, de - ld e, l - ld d, h - pop hl - ld a, [de] - inc de - ld [hli], a - ld a, [de] - inc de - ld [hli], a - pop hl - ld bc, BG_MAP_WIDTH - add hl, bc - ld a, [de] - inc de - ld [hli], a - ld a, [de] - inc de - ld [hli], a - - pop hl - inc hl - inc hl - pop de - inc de - pop bc - ret - -Intro_ResetLYOverrides: - ld hl, wLYOverrides - xor a - ld c, wLYOverrides2 - wLYOverrides -.loop - ld [hli], a - dec c - jr nz, .loop - ret - -Intro_WaterGFX1: -INCBIN "gfx/intro/water1.2bpp.lz" - -Intro_WaterTilemap: -INCBIN "gfx/intro/water.tilemap" - -Intro_WaterMeta: -INCBIN "gfx/intro/water.bin" - -Intro_WaterGFX2: -INCBIN "gfx/intro/water2.2bpp.lz" - -Intro_GrassGFX1: -INCBIN "gfx/intro/grass1.2bpp.lz" - -Intro_GrassTilemap: -INCBIN "gfx/intro/grass.tilemap" - -Intro_GrassMeta: -INCBIN "gfx/intro/grass.bin" - -Intro_GrassGFX2: -INCBIN "gfx/intro/grass2.2bpp.lz" - -Intro_FireGFX1: -INCBIN "gfx/intro/charizard1.2bpp.lz" - -Intro_FireGFX2: -INCBIN "gfx/intro/charizard2.2bpp.lz" - -Intro_FireGFX3: -INCBIN "gfx/intro/charizard3.2bpp.lz" -- cgit v1.2.3 From 09a82aec6fbe333862211398d073b0f707269c3b Mon Sep 17 00:00:00 2001 From: entrpntr Date: Wed, 10 Jun 2020 22:18:52 -0400 Subject: Use hlbgcoord 0, 0 in a few places. --- engine/battle/battle_transition.asm | 2 +- engine/movie/gold_silver_intro.asm | 4 ++-- engine/movie/title.asm | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'engine') diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index 4de4d347..ad4b359c 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -84,7 +84,7 @@ ConvertTrainerBattlePokeballTilesTo2bpp: jr nz, .loop ld de, wDecompressScratch - ld hl, vBGMap2 + hlbgcoord 0, 0, vBGMap2 ld b, BANK(@) ld c, $28 call Request2bpp diff --git a/engine/movie/gold_silver_intro.asm b/engine/movie/gold_silver_intro.asm index 3455b136..631efa4a 100644 --- a/engine/movie/gold_silver_intro.asm +++ b/engine/movie/gold_silver_intro.asm @@ -936,7 +936,7 @@ IntroScene6: ld [wIntroTilesPointer + 0], a ld a, HIGH(Intro_GrassMeta) ld [wIntroTilesPointer + 1], a - ld hl, vBGMap0 + hlbgcoord 0, 0 ld a, l ld [wIntroBGMapPointer + 0], a ld a, h @@ -1302,7 +1302,7 @@ Intro_BlankTilemapAndBGMap: ld bc, wTilemapEnd - wTilemap xor a call ByteFill - ld hl, vBGMap0 + hlbgcoord 0, 0 ld bc, vBGMap1 - vBGMap0 xor a call ByteFill diff --git a/engine/movie/title.asm b/engine/movie/title.asm index 0ba2720a..263629fc 100644 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -147,7 +147,7 @@ FillTitleScreenPals: ld bc, 18 * BG_MAP_WIDTH xor a call ByteFill - ld hl, vBGMap2 + hlbgcoord 0, 0, vBGMap2 lb bc, 7, SCREEN_WIDTH ld a, 1 call DrawTitleGraphic -- cgit v1.2.3 From ceffef935f34059842adc11a13e2a7fbceb35a49 Mon Sep 17 00:00:00 2001 From: entrpntr Date: Thu, 11 Jun 2020 14:05:08 -0400 Subject: Address review comments, plus a few more labels/cleanups. --- engine/gfx/color.asm | 2 +- engine/movie/gold_silver_intro.asm | 99 +++++++++++++++++++------------------- 2 files changed, 50 insertions(+), 51 deletions(-) (limited to 'engine') diff --git a/engine/gfx/color.asm b/engine/gfx/color.asm index 0db1ee27..d7998019 100644 --- a/engine/gfx/color.asm +++ b/engine/gfx/color.asm @@ -211,7 +211,7 @@ Unreferenced_Function915e: call GetPredefPal jp LoadHLPaletteIntoDE -Function9178: +Intro_LoadMonPalette: call CheckCGB jr nz, .cgb ldh a, [hSGB] diff --git a/engine/movie/gold_silver_intro.asm b/engine/movie/gold_silver_intro.asm index 631efa4a..adcb97c3 100644 --- a/engine/movie/gold_silver_intro.asm +++ b/engine/movie/gold_silver_intro.asm @@ -30,13 +30,13 @@ Copyright_GFPresents: call .PlayFrame jr nc, .loop - ; high bits of wJumptableIndex are recycled for some flags - ; this was set if user canceled by pressing a button +; high bits of wJumptableIndex are recycled for some flags +; this was set if user canceled by pressing a button ld a, [wJumptableIndex] bit 6, a jr nz, .canceled - ; clear carry flag from GFPresents_PlayFrame +; clear carry flag from GFPresents_PlayFrame and a ret @@ -87,8 +87,8 @@ Copyright_GFPresents: and BUTTONS jr nz, .pressed_button - ; high bits of wJumptableIndex are recycled for some flags - ; this is set when the sequence finished +; high bits of wJumptableIndex are recycled for some flags +; this is set when the sequence finished ld a, [wJumptableIndex] bit 7, a jr nz, .finish @@ -98,12 +98,12 @@ Copyright_GFPresents: call GFPresentsJumper call DelayFrame - ; ensure carry is cleared +; ensure carry is cleared and a ret .pressed_button - ; high bits of wJumptableIndex are recycled for some flags +; high bits of wJumptableIndex are recycled for some flags ld hl, wJumptableIndex set 6, [hl] @@ -141,7 +141,7 @@ Unreferenced_Functione4a8d: ret GFPresents_Star: - ; tell GFPresents_PlaceLogo we haven't finished yet +; tell GFPresents_PlaceLogo we haven't finished yet xor a ld [wIntroSceneFrameCounter], a @@ -162,8 +162,8 @@ GFPresents_Star: GFPresents_PlaceLogo: ; Draw the Game Freak logo (may be initially invisible due to palette) - ; wait until the star animation completed - ; this counter is set in DoAnimFrame.GSIntroStar in engine/gfx/sprite_anims.asm +; wait until the star animation completed +; this counter is set in DoAnimFrame.GSIntroStar in engine/gfx/sprite_anims.asm ld a, [wIntroSceneFrameCounter] and a ret z @@ -174,7 +174,7 @@ GFPresents_PlaceLogo: call GFPresents_NextScene - ; set timer for GFPresents_LogoSparkles +; set timer for GFPresents_LogoSparkles ld a, $80 ld [wIntroSceneTimer], a ret @@ -186,16 +186,16 @@ GFPresents_LogoSparkles: jr z, .done dec [hl] - ; add first text when timer passes half +; add first text when timer passes half cp $3f call z, GFPresents_PlaceGameFreak - ; add sparkles continuously +; add sparkles continuously call GFPresents_Sparkle ret .done - ; set timer for GFPresents_PlacePresents +; set timer for GFPresents_PlacePresents ld [hl], $80 call GFPresents_NextScene ret @@ -208,7 +208,6 @@ GFPresents_PlaceGameFreak: .game_freak db $80, $81, $82, $83, $8d, $84, $85, $83, $81, $86 -.end db "@" GFPresents_PlacePresents: @@ -218,14 +217,13 @@ GFPresents_PlacePresents: call GFPresents_NextScene - ; set timer for GFPresents_WaitForTimer +; set timer for GFPresents_WaitForTimer ld a, $80 ld [wIntroSceneTimer], a ret .presents db $87, $88, $89, $8a, $8b, $8c -.end db "@" GFPresents_SetDoneFlag: @@ -247,22 +245,22 @@ GFPresents_WaitForTimer: ret GFPresents_UpdateLogoPal: -; called from 23:5928 +; called from DoAnimFrame.GameFreakLogo ; OBP1 was initialized at end of GFPresents_Init - ; once we reached the final state, leave it alone +; once we reached the final state, leave it alone ldh a, [rOBP1] cp %10010000 ret z - ; wait 16 frames before next change +; wait 16 frames before next change ld a, [wIntroSceneTimer] and $f ret nz - ; rotate OBP1 by one color slot (2 bits) - ; DMG: logo is white, then light gray, then dark gray - ; CGB: logo is white, then yellow +; rotate OBP1 by one color slot (2 bits) +; DMG: logo is white, then light gray, then dark gray +; CGB: logo is white, then yellow ldh a, [rOBP1] rrca rrca @@ -272,24 +270,24 @@ GFPresents_UpdateLogoPal: GFPresents_Sparkle: ; Initialize and configure a sparkle sprite. - ; run only every second frame +; run only every second frame ld d, a and 1 ret nz - ; shift over so our index is still changing by 1 each time +; shift over so our index is still changing by 1 each time ld a, d srl a - ; set up a new sparkle sprite +; set up a new sparkle sprite push af depixel 11, 11 ld a, SPRITE_ANIM_INDEX_GS_INTRO_SPARKLE call InitSpriteAnimStruct pop af - ; take the bottom 4 bits of a as an index into - ; sparkle_vectors (16 entries) +; take the bottom 4 bits of a as an index into +; sparkle_vectors (16 entries) and %00001111 ld e, a ld d, 0 @@ -297,29 +295,29 @@ GFPresents_Sparkle: add hl, de add hl, de - ; set the angle and distance for this sprite - ; bc+$b <- hl (angle), bc+$c <- 0, bc+$d <- hl+1 (distance) +; set the angle and distance for this sprite +; bc+$b <- hl (angle), bc+$c <- 0, bc+$d <- hl+1 (distance) ld e, l ld d, h - ld hl, $b + ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX add hl, bc ld a, [de] ld [hl], a inc de - ld hl, $c + ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld [hl], 0 - inc hl + inc hl ; SPRITEANIMSTRUCT_0D ld a, [de] ld [hl], a ret .sparkle_vectors - ; values control final position of each sparkle - ; position is automatically animated along the vector - ; each entry emits two sparkles in opposite directions - ; angle (6 bits) and distance (tiles?) +; values control final position of each sparkle +; position is automatically animated along the vector +; each entry emits two sparkles in opposite directions +; angle (6 bits) and distance (tiles?) db $00, $03 db $08, $04 db $04, $03 @@ -366,6 +364,7 @@ GoldSilverIntro: and BUTTONS jr nz, .Finish +; check done flag ld a, [wIntroJumptableIndex] bit 7, a jr nz, .Finish @@ -1038,7 +1037,7 @@ IntroScene9: add hl, de ld a, [hl] cp -1 - jr z, .done + jr z, .next call DmgToCgbBGPals ld hl, hSCY inc [hl] @@ -1046,7 +1045,7 @@ IntroScene9: dec [hl] ret -.done +.next ld hl, wIntroJumptableIndex inc [hl] ret @@ -1330,15 +1329,15 @@ Intro_CheckSCYEvent: jp hl .scy_jumptable - dbw $86, Functione53f7 + dbw $86, Intro_LoadChikoritaPalette dbw $87, Intro_ChikoritaAppears dbw $88, Functione53e0 dbw $98, Functione53eb - dbw $99, Functione5400 + dbw $99, Intro_LoadCyndaquilPalette dbw $af, Intro_CyndaquilAppears dbw $b0, Functione53e0 dbw $c0, Functione53eb - dbw $c1, Functione5409 + dbw $c1, Intro_LoadTotodilePalette dbw $d7, Intro_TotodileAppears dbw $d8, Functione53e0 dbw $e8, Functione53eb @@ -1383,19 +1382,19 @@ Functione53eb: call DmgToCgbBGPals ret -Functione53f7: +Intro_LoadChikoritaPalette: ld c, CHIKORITA - farcall Function9178 + farcall Intro_LoadMonPalette ret -Functione5400: +Intro_LoadCyndaquilPalette: ld c, CYNDAQUIL - farcall Function9178 + farcall Intro_LoadMonPalette ret -Functione5409: +Intro_LoadTotodilePalette: ld c, TOTODILE - farcall Function9178 + farcall Intro_LoadMonPalette ret Functione5412: @@ -1405,7 +1404,7 @@ Functione5412: jr nz, .got_mon ld c, CHARIZARD .got_mon - farcall Function9178 + farcall Intro_LoadMonPalette ret Functione5422: @@ -1462,7 +1461,7 @@ endr ret .data_e5464 -; vtile offset, width, height, x, y? +; vtile offset, width, height, x, y db $00, 8, 8 dwcoord 10, 6 db $40, 9, 8 -- cgit v1.2.3 From 308f586dcce414e42cc0eac47195134e240f7c24 Mon Sep 17 00:00:00 2001 From: entrpntr Date: Thu, 11 Jun 2020 15:14:46 -0400 Subject: Improve angle/distance comment as noted in review. --- engine/movie/gold_silver_intro.asm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'engine') diff --git a/engine/movie/gold_silver_intro.asm b/engine/movie/gold_silver_intro.asm index adcb97c3..7195e7dc 100644 --- a/engine/movie/gold_silver_intro.asm +++ b/engine/movie/gold_silver_intro.asm @@ -296,21 +296,19 @@ GFPresents_Sparkle: add hl, de ; set the angle and distance for this sprite -; bc+$b <- hl (angle), bc+$c <- 0, bc+$d <- hl+1 (distance) ld e, l ld d, h ld hl, SPRITEANIMSTRUCT_JUMPTABLE_INDEX add hl, bc ld a, [de] - ld [hl], a + ld [hl], a ; angle inc de ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld [hl], 0 inc hl ; SPRITEANIMSTRUCT_0D ld a, [de] - ld [hl], a - + ld [hl], a ; distance ret .sparkle_vectors -- cgit v1.2.3 From 0c0f9b42bc1426f2dcdff9f9016bb3fa946b4d49 Mon Sep 17 00:00:00 2001 From: entrpntr Date: Fri, 12 Jun 2020 00:33:21 -0400 Subject: Revert gold title trail 2bpp change, add comment to title.asm instead. --- engine/movie/title.asm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/movie/title.asm b/engine/movie/title.asm index 263629fc..e3d93b3d 100644 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -40,7 +40,10 @@ TitleScreen: ld a, BANK(TitleScreenGFX4) call FarDecompress -; Decompress Ho-Oh/Lugia sparkle +; Ho-Oh/Lugia title trail. +; This should only copy 4 tiles; there are 4 extra whitespace tiles in Gold +; before Ho-Oh gfx, but Silver reads the first 64 bytes of the compressed +; Lugia gfx and writes them to VRAM (but never displays them on screen). ld hl, TitleScreenGFX3 ld de, vTiles1 tile $78 ld bc, 8 tiles -- cgit v1.2.3