diff --git a/src/FullScreenPokemon.ts b/src/FullScreenPokemon.ts index 5cbecf19..cce09342 100644 --- a/src/FullScreenPokemon.ts +++ b/src/FullScreenPokemon.ts @@ -16,6 +16,7 @@ import { Collisions } from "./components/Collisions"; import { Constants } from "./components/Constants"; import { Cutscenes } from "./components/Cutscenes"; import { Cycling } from "./components/Cycling"; +import { Death } from "./components/Death"; import { Equations } from "./components/Equations"; import { Evolution } from "./components/Evolution"; import { Experience } from "./components/Experience"; @@ -168,6 +169,12 @@ export class FullScreenPokemon extends EightBittr { @component(Cycling) public readonly cycling: Cycling; + /** + * Removes Things from the game. + */ + @component(Death) + public readonly death: Death; + /** * Common equations. */ diff --git a/src/components/Death.ts b/src/components/Death.ts new file mode 100644 index 00000000..39b34e3f --- /dev/null +++ b/src/components/Death.ts @@ -0,0 +1,19 @@ +import { Death as EightBittrDeath } from "eightbittr"; + +import { FullScreenPokemon } from "../FullScreenPokemon"; + +import { IThing } from "./Things"; + +/** + * Removes Things from the game. + */ +export class Death extends EightBittrDeath { + /** + * Generically kills all Things. + */ + public killAll() { + this.eightBitter.groupHolder.callOnAll((thing: IThing) => { + this.killNormal(thing); + }) + } +} diff --git a/src/components/Gameplay.ts b/src/components/Gameplay.ts index 058e2978..ec371071 100644 --- a/src/components/Gameplay.ts +++ b/src/components/Gameplay.ts @@ -60,10 +60,7 @@ export class Gameplay extends EightBittrG */ public startIntro(): void { this.eightBitter.saves.clearSavedData(); - this.eightBitter.scenePlayer.startCutscene("Intro", { - disablePauseMenu: true, - }); - + this.eightBitter.scenePlayer.startCutscene("Intro"); this.eightBitter.modAttacher.fireEvent(this.eightBitter.mods.eventNames.onGameStartIntro); } diff --git a/src/components/Graphics.ts b/src/components/Graphics.ts index 247d2a00..72a37d91 100644 --- a/src/components/Graphics.ts +++ b/src/components/Graphics.ts @@ -1,6 +1,6 @@ import { component } from "babyioc"; import { Graphics as EightBittrGraphics } from "eightbittr"; -import { IPalette } from "pixelrendr"; +import { IPalette, IFilterContainer } from "pixelrendr"; import { FullScreenPokemon } from "../FullScreenPokemon"; @@ -11,6 +11,19 @@ import { graphicsLibrary } from "./graphics/GraphicsLibrary"; * Changes the visual appearance of Things. */ export class Graphics extends EightBittrGraphics { + /** + * Filters that may be used by sprites in the library. + */ + public readonly filters: IFilterContainer = { + BlackAndWhite: [ + "palette", + { + "3": "2", + "4": "2", + }, + ], + }; + /** * What class name should indicate a Thing is to be flipped verticallu. */ diff --git a/src/components/animations/Fading.ts b/src/components/animations/Fading.ts index 4e9cdc86..c483e65d 100644 --- a/src/components/animations/Fading.ts +++ b/src/components/animations/Fading.ts @@ -44,26 +44,26 @@ export class Fading extends GeneralCompon * @param onCompletion A callback for when the attribute reaches the goal. * @returns The in-progress TimeEvent, if started. */ - public animateFadeAttribute( - thing: IThing, - attribute: string, + public animateFadeAttribute( + thing: TThing, + attribute: keyof TThing, change: number, goal: number, speed: number, onCompletion?: (thing: IThing) => void): ITimeEvent | undefined { - (thing as any)[attribute] += change; + (thing[attribute] as number) += change; if (change > 0) { - if ((thing as any)[attribute] >= goal) { - (thing as any)[attribute] = goal; + if (thing[attribute] >= goal) { + (thing[attribute] as number) = goal; if (typeof onCompletion === "function") { onCompletion(thing); } return undefined; } } else { - if ((thing as any)[attribute] <= goal) { - (thing as any)[attribute] = goal; + if (thing[attribute] <= goal) { + (thing[attribute] as number) = goal; if (typeof onCompletion === "function") { onCompletion(thing); } diff --git a/src/components/cutscenes/IntroCutscene.ts b/src/components/cutscenes/IntroCutscene.ts index 1fa214ff..a1e7197c 100644 --- a/src/components/cutscenes/IntroCutscene.ts +++ b/src/components/cutscenes/IntroCutscene.ts @@ -5,52 +5,82 @@ import { IKeyboardResultsMenu } from "../menus/Keyboards"; import { IPlayer, IThing } from "../Things"; /** - * Intro cutscene routines. + * Cutscene for the beginning of the game introduction. */ export class IntroCutscene extends GeneralComponent { /** - * Cutscene for the beginning of the game introduction. - * - * @param settings Settings used for the cutscene. + * Starts the beginning of the game introduction. */ - public async FadeIn(settings: any): Promise { - const oak: IThing = this.eightBitter.objectMaker.make(this.eightBitter.things.names.oakPortrait, { - opacity: 0, - }); - - settings.oak = oak; + public readonly start = () => { + this.eightBitter.maps.setMap("Blank", "White"); + this.eightBitter.menuGrapher.deleteActiveMenu(); this.eightBitter.audioPlayer.play(this.eightBitter.audio.names.introduction, { alias: this.eightBitter.audio.aliases.theme, loop: true, }); - this.eightBitter.modAttacher.fireEvent(this.eightBitter.mods.eventNames.onIntroFadeIn, oak); + const oakShady = this.eightBitter.objectMaker.make( + this.eightBitter.things.names.oakPortrait, + { opacity: 0, }, + ); - this.eightBitter.maps.setMap("Blank", "White"); - this.eightBitter.menuGrapher.deleteActiveMenu(); + this.eightBitter.graphics.classes.addClass(oakShady, "shady"); + this.eightBitter.things.add(oakShady); + this.eightBitter.physics.setMidX(oakShady, this.eightBitter.mapScreener.middleX | 0); + this.eightBitter.physics.setMidY(oakShady, this.eightBitter.mapScreener.middleY | 0); - this.eightBitter.things.add(oak); - this.eightBitter.physics.setMidX(oak, this.eightBitter.mapScreener.middleX | 0); - this.eightBitter.physics.setMidY(oak, this.eightBitter.mapScreener.middleY | 0); + this.eightBitter.modAttacher.fireEvent(this.eightBitter.mods.eventNames.onIntroFadeIn, oakShady); this.eightBitter.timeHandler.addEvent( - (): void => { + () => { this.eightBitter.animations.fading.animateFadeAttribute( - oak, + oakShady, "opacity", - 0.15, + 0.25, 1, 14, - this.eightBitter.scenePlayer.bindRoutine("FirstDialog")); + () => this.fadeInNonShady(oakShady), + ); }, - 70); + 32); } /** - * Cutscene for Oak's introduction. + * Fades the grayscale Oak on top of the black-and-white ("shady") Oak. + * + * @param oakShady Black-and-white Oak visualized on the screen. */ - public FirstDialog(): void { + private fadeInNonShady(oakShady: IThing) { + const oak = this.eightBitter.objectMaker.make( + this.eightBitter.things.names.oakPortrait, + { opacity: 0, }, + ); + + this.eightBitter.things.add(oak, oakShady.left, oakShady.top); + + this.eightBitter.animations.fading.animateFadeAttribute( + oak, + "opacity", + 0.25, + 1, + 14, + () => { + this.eightBitter.death.killNormal(oakShady); + + this.eightBitter.timeHandler.addEvent( + () => { + this.firstDialog(); + }, + 32); + }, + ); + } + + /** + * Adds Oak's first bit of dialog to the screen. + */ + private firstDialog(): void { this.eightBitter.menuGrapher.createMenu("GeneralText"); this.eightBitter.menuGrapher.addMenuDialog( "GeneralText", @@ -58,16 +88,16 @@ export class IntroCutscene extends Genera "Hello there! \n Welcome to the world of %POKEMON%!", "My name is OAK! People call me the %POKEMON% PROF!", ], - this.eightBitter.scenePlayer.bindRoutine("FirstDialogFade"), + () => this.firstDialogFade(), ); this.eightBitter.menuGrapher.setActiveMenu("GeneralText"); } /** - * Cutscene for Oak's introduction exit. + * Fades Oak out after his first dialog. */ - public FirstDialogFade(): void { - const blank: IThing = this.eightBitter.objectMaker.make(this.eightBitter.things.names.whiteSquare, { + private firstDialogFade(): void { + const blank = this.eightBitter.objectMaker.make(this.eightBitter.things.names.whiteSquare, { width: this.eightBitter.mapScreener.width, height: this.eightBitter.mapScreener.height, opacity: 0, @@ -78,28 +108,27 @@ export class IntroCutscene extends Genera this.eightBitter.timeHandler.addEvent( (): void => { this.eightBitter.animations.fading.animateFadeAttribute( - blank, - "opacity", - 0.15, - 1, - 7, - this.eightBitter.scenePlayer.bindRoutine("PokemonExpo")); + blank, + "opacity", + 0.15, + 1, + 7, + () => this.pokemonExpo(), + ); }, 35); } /** - * Cutscene for transitioning Nidorino onto the screen. + * Fades in the Nidorino Pokemon onto the screen. */ - public PokemonExpo(): void { - const pokemon: IThing = this.eightBitter.objectMaker.make(this.eightBitter.things.names.nidorinoFront, { + private pokemonExpo(): void { + const pokemon = this.eightBitter.objectMaker.make(this.eightBitter.things.names.nidorinoFront, { flipHoriz: true, opacity: 0.01, }); - this.eightBitter.groupHolder.callOnAll((thing: IThing): void => { - this.eightBitter.death.killNormal(thing); - }); + this.eightBitter.death.killAll(); this.eightBitter.things.add( pokemon, @@ -114,13 +143,14 @@ export class IntroCutscene extends Genera -8, this.eightBitter.mapScreener.middleX | 0, 1, - this.eightBitter.scenePlayer.bindRoutine("PokemonExplanation")); + () => this.pokemonExplanation(), + ); } /** - * Cutscene for showing an explanation of the Pokemon world. + * Adds a dialog explaining how Pokemon work. */ - public PokemonExplanation(): void { + private pokemonExplanation(): void { this.eightBitter.menuGrapher.createMenu("GeneralText"); this.eightBitter.menuGrapher.addMenuDialog( "GeneralText", @@ -130,28 +160,22 @@ export class IntroCutscene extends Genera "Myself...", "I study %POKEMON% as a profession.", ], - this.eightBitter.scenePlayer.bindRoutine("PlayerAppear"), + () => this.playerAppear(), ); this.eightBitter.menuGrapher.setActiveMenu("GeneralText"); } /** - * Cutscene showing the player. - * - * @param settings Settings used for the cutscene. + * Fades in the first Player visualization onto the screen. */ - public PlayerAppear(settings: any): void { + private playerAppear(): void { const middleX: number = this.eightBitter.mapScreener.middleX | 0; - const player: IPlayer = this.eightBitter.objectMaker.make(this.eightBitter.things.names.playerPortrait, { + const player = this.eightBitter.objectMaker.make(this.eightBitter.things.names.playerPortrait, { flipHoriz: true, opacity: 0.01, }); - settings.player = player; - - this.eightBitter.groupHolder.callOnAll((thing: IThing): void => { - this.eightBitter.death.killNormal(thing); - }); + this.eightBitter.death.killAll(); this.eightBitter.things.add(player, this.eightBitter.mapScreener.middleX + 96, 0); this.eightBitter.physics.setMidY(player, this.eightBitter.mapScreener.middleY); @@ -162,43 +186,45 @@ export class IntroCutscene extends Genera -8, middleX - player.width / 2, 1, - this.eightBitter.scenePlayer.bindRoutine("PlayerName")); + () => this.playerName(), + ); } /** - * Cutscene asking the player to enter his/her name. + * Asks the player to enter their name. */ - public PlayerName(): void { + private playerName(): void { this.eightBitter.menuGrapher.createMenu("GeneralText"); this.eightBitter.menuGrapher.addMenuDialog( "GeneralText", [ "First, what is your name?", ], - this.eightBitter.scenePlayer.bindRoutine("PlayerSlide")); + () => this.playerSlide(), + ); this.eightBitter.menuGrapher.setActiveMenu("GeneralText"); } /** - * Cutscene for sliding the player over to show the naming options. - * - * @param settings Settings used for the cutscene. + * Slides the player over to show name options. */ - public PlayerSlide(settings: any): void { + private playerSlide(): void { + const player = this.eightBitter.groupHolder.getThing("player")!; this.eightBitter.animations.sliding.slideHorizontally( - settings.player, + player, 4, (this.eightBitter.mapScreener.middleX + 56) | 0, 1, - this.eightBitter.scenePlayer.bindRoutine("PlayerNameOptions")); + () => this.playerNameOptions(), + ); } /** - * Cutscene for showing the player naming option menu. + * Creates the player name options menu. */ - public PlayerNameOptions(): void { - const fromMenu: () => void = this.eightBitter.scenePlayer.bindRoutine("PlayerNameFromMenu"); - const fromKeyboard: () => void = this.eightBitter.scenePlayer.bindRoutine("PlayerNameFromKeyboard"); + private playerNameOptions(): void { + const fromMenu = () => this.playerNameFromMenu(); + const fromKeyboard = () => this.playerNameFromKeyboard(); this.eightBitter.menuGrapher.createMenu("NameOptions"); this.eightBitter.menuGrapher.addMenuList("NameOptions", { @@ -227,49 +253,49 @@ export class IntroCutscene extends Genera } /** - * Cutscene for the player selecting Blue, Gary, or John. - * - * @param settings Settings used for the cutscene. + * Handles the player selecting a prefabricated menu option. */ - public PlayerNameFromMenu(settings: any): void { - settings.name = this.eightBitter.menuGrapher.getMenuSelectedOption("NameOptions").text; + private playerNameFromMenu(): void { + const name = this.eightBitter.menuGrapher.getMenuSelectedOption("NameOptions").text as string[]; + const player = this.eightBitter.groupHolder.getThing("player")!; this.eightBitter.menuGrapher.deleteMenu("NameOptions"); this.eightBitter.animations.sliding.slideHorizontally( - settings.player, + player, -4, this.eightBitter.mapScreener.middleX | 0, 1, - this.eightBitter.scenePlayer.bindRoutine("PlayerNameConfirm")); + () => this.playerNameConfirm(name), + ); } /** - * Cutscene for the player choosing to customize a new name. - * - * @param settings Settings used for the cutscene. + * Handles the player having entered their own name from the keyboard. */ - public PlayerNameFromKeyboard(settings: any): void { - settings.name = (this.eightBitter.menuGrapher.getMenu("KeyboardResult") as IKeyboardResultsMenu).completeValue; + private playerNameFromKeyboard(): void { + const name = (this.eightBitter.menuGrapher.getMenu("KeyboardResult") as IKeyboardResultsMenu).completeValue; + const player = this.eightBitter.groupHolder.getThing("player")!; this.eightBitter.menuGrapher.deleteMenu("Keyboard"); this.eightBitter.menuGrapher.deleteMenu("NameOptions"); this.eightBitter.animations.sliding.slideHorizontally( - settings.player, + player, -4, this.eightBitter.mapScreener.middleX | 0, 1, - this.eightBitter.scenePlayer.bindRoutine("PlayerNameConfirm")); + () => this.playerNameConfirm(name), + ); } /** - * Cutscene confirming the player's name. + * Confirms the name chosen for the player. * - * @param settings Settings used for the cutscene. + * @param name Name chosen for the player. */ - public PlayerNameConfirm(settings: any): void { - this.eightBitter.itemsHolder.setItem(this.eightBitter.storage.names.name, settings.name); + private playerNameConfirm(name: string[]): void { + this.eightBitter.itemsHolder.setItem(this.eightBitter.storage.names.name, name); this.eightBitter.menuGrapher.createMenu("GeneralText", { finishAutomatically: true, @@ -279,18 +305,19 @@ export class IntroCutscene extends Genera [ [ "Right! So your name is ".split(""), - settings.name, + name, "!".split(""), ], ], - this.eightBitter.scenePlayer.bindRoutine("PlayerNameComplete")); + () => this.playerNameComplete(), + ); } /** - * Cutscene fading the player out. + * Fades the player out from the screen after choosing a name. */ - public PlayerNameComplete(): void { - const blank: IThing = this.eightBitter.objectMaker.make(this.eightBitter.things.names.whiteSquare, { + private playerNameComplete(): void { + const blank = this.eightBitter.objectMaker.make(this.eightBitter.things.names.whiteSquare, { width: this.eightBitter.mapScreener.width, height: this.eightBitter.mapScreener.height, opacity: 0, @@ -306,7 +333,8 @@ export class IntroCutscene extends Genera 0.2, 1, 7, - this.eightBitter.scenePlayer.bindRoutine("RivalAppear")); + () => this.rivalAppear(), + ); }, 35); } @@ -316,16 +344,12 @@ export class IntroCutscene extends Genera * * @param settings Settings used for the cutscene. */ - public RivalAppear(settings: any): void { - const rival: IThing = this.eightBitter.objectMaker.make(this.eightBitter.things.names.rivalPortrait, { + private rivalAppear(): void { + const rival = this.eightBitter.objectMaker.make(this.eightBitter.things.names.rivalPortrait, { opacity: 0, }); - settings.rival = rival; - - this.eightBitter.groupHolder.callOnAll((thing: IThing): void => { - this.eightBitter.death.killNormal(thing); - }); + this.eightBitter.death.killAll(); this.eightBitter.things.add(rival, 0, 0); this.eightBitter.physics.setMidX(rival, this.eightBitter.mapScreener.middleX | 0); @@ -336,13 +360,16 @@ export class IntroCutscene extends Genera 0.1, 1, 1, - this.eightBitter.scenePlayer.bindRoutine("RivalName")); + () => this.rivalName(rival), + ); } /** * Cutscene introducing the rival. + * + * @param rival Rival Thing visualized on the screen. */ - public RivalName(): void { + private rivalName(rival: IThing): void { this.eightBitter.menuGrapher.createMenu("GeneralText"); this.eightBitter.menuGrapher.addMenuDialog( "GeneralText", @@ -350,7 +377,7 @@ export class IntroCutscene extends Genera "This is my grand-son. He's been your rival since you were a baby.", "...Erm, what is his name again?", ], - this.eightBitter.scenePlayer.bindRoutine("RivalSlide"), + () => this.rivalSlide(rival), ); this.eightBitter.menuGrapher.setActiveMenu("GeneralText"); } @@ -358,23 +385,26 @@ export class IntroCutscene extends Genera /** * Cutscene for sliding the rival over to show the rival naming options. * - * @param settings Settings used for the cutscene. + * @param rival Rival Thing visualized on the screen. */ - public RivalSlide(settings: any): void { + private rivalSlide(rival: IThing): void { this.eightBitter.animations.sliding.slideHorizontally( - settings.rival, + rival, 4, (this.eightBitter.mapScreener.middleX + 56) | 0, 1, - this.eightBitter.scenePlayer.bindRoutine("RivalNameOptions")); + () => this.rivalNameOptions(rival), + ); } /** * Cutscene for showing the rival naming option menu. + * + * @param rival Rival Thing visualized on the screen. */ - public RivalNameOptions(): void { - const fromMenu: () => void = this.eightBitter.scenePlayer.bindRoutine("RivalNameFromMenu"); - const fromKeyboard: () => void = this.eightBitter.scenePlayer.bindRoutine("RivalNameFromKeyboard"); + private rivalNameOptions(rival: IThing): void { + const fromMenu = () => this.rivalNameFromMenu(rival); + const fromKeyboard = () => this.rivalNameFromKeyboard(rival); this.eightBitter.menuGrapher.createMenu("NameOptions"); this.eightBitter.menuGrapher.addMenuList("NameOptions", { @@ -405,65 +435,68 @@ export class IntroCutscene extends Genera /** * Cutscene for choosing to name the rival Red, Ash, or Jack. * - * @param settings Settings used for the cutscene. + * @param rival Rival Thing visualized on the screen. */ - public RivalNameFromMenu(settings: any): void { - settings.name = this.eightBitter.menuGrapher.getMenuSelectedOption("NameOptions").text; + private rivalNameFromMenu(rival: IThing): void { + const name = this.eightBitter.menuGrapher.getMenuSelectedOption("NameOptions").text as string[]; this.eightBitter.menuGrapher.deleteMenu("NameOptions"); this.eightBitter.animations.sliding.slideHorizontally( - settings.rival, + rival, -4, this.eightBitter.mapScreener.middleX | 0, 1, - this.eightBitter.scenePlayer.bindRoutine("RivalNameConfirm")); + () => this.rivalNameConfirm(name), + ); } /** * Cutscene for choosing to customize the rival's name. * - * @param settings Settings used for the cutscene. + * @param rival Rival Thing visualized on the screen. */ - public RivalNameFromKeyboard(settings: any): void { - settings.name = (this.eightBitter.menuGrapher.getMenu("KeyboardResult") as IKeyboardResultsMenu).completeValue; + private rivalNameFromKeyboard(rival: IThing): void { + const name = (this.eightBitter.menuGrapher.getMenu("KeyboardResult") as IKeyboardResultsMenu).completeValue; this.eightBitter.menuGrapher.deleteMenu("Keyboard"); this.eightBitter.menuGrapher.deleteMenu("NameOptions"); this.eightBitter.animations.sliding.slideHorizontally( - settings.rival, + rival, -4, this.eightBitter.mapScreener.middleX | 0, 1, - this.eightBitter.scenePlayer.bindRoutine("RivalNameConfirm")); + () => this.rivalNameConfirm(name), + ); } /** - * Cutscene for confirming the rival's name. + * Confirms the name chosen for the rival. * - * @param settings Settings used for the cutscene. + * @param name Name chosen for the rival. */ - public RivalNameConfirm(settings: any): void { - this.eightBitter.itemsHolder.setItem(this.eightBitter.storage.names.nameRival, settings.name); + private rivalNameConfirm(name: string[]): void { + this.eightBitter.itemsHolder.setItem(this.eightBitter.storage.names.nameRival, name); this.eightBitter.menuGrapher.createMenu("GeneralText"); this.eightBitter.menuGrapher.addMenuDialog( "GeneralText", [ [ - "That's right! I remember now! His name is ", settings.name, "!", + "That's right! I remember now! His name is ", name, "!", ], ], - this.eightBitter.scenePlayer.bindRoutine("RivalNameComplete")); + () => this.rivalNameComplete(), + ); this.eightBitter.menuGrapher.setActiveMenu("GeneralText"); } /** * Cutscene fading the rival out. */ - public RivalNameComplete(): void { - const blank: IThing = this.eightBitter.objectMaker.make(this.eightBitter.things.names.whiteSquare, { + private rivalNameComplete(): void { + const blank = this.eightBitter.objectMaker.make(this.eightBitter.things.names.whiteSquare, { width: this.eightBitter.mapScreener.width, height: this.eightBitter.mapScreener.height, opacity: 0, @@ -479,27 +512,22 @@ export class IntroCutscene extends Genera 0.2, 1, 7, - this.eightBitter.scenePlayer.bindRoutine("LastDialogAppear")); + () => this.lastDialogAppear(), + ); }, 35); } /** * Cutscene for fading the player in. - * - * @param settings Settings used for the cutscene. */ - public LastDialogAppear(settings: any): void { - const portrait: IThing = this.eightBitter.objectMaker.make(this.eightBitter.things.names.playerPortrait, { + private lastDialogAppear(): void { + const portrait = this.eightBitter.objectMaker.make(this.eightBitter.things.names.playerPortrait, { flipHoriz: true, opacity: 0, }); - settings.portrait = portrait; - - this.eightBitter.groupHolder.callOnAll((thing: IThing): void => { - this.eightBitter.death.killNormal(thing); - }); + this.eightBitter.death.killAll(); this.eightBitter.things.add(portrait, 0, 0); this.eightBitter.physics.setMidX(portrait, this.eightBitter.mapScreener.middleX | 0); @@ -511,13 +539,16 @@ export class IntroCutscene extends Genera 0.1, 1, 1, - this.eightBitter.scenePlayer.bindRoutine("LastDialog")); + () => this.lastDialog(portrait), + ); } /** * Cutscene for the last part of the introduction. + * + * @param portrait Portrait of the player visualized on the screen. */ - public LastDialog(): void { + private lastDialog(portrait: IThing): void { this.eightBitter.menuGrapher.createMenu("GeneralText"); this.eightBitter.menuGrapher.addMenuDialog( "GeneralText", @@ -526,26 +557,27 @@ export class IntroCutscene extends Genera "Your very own %POKEMON% legend is about to unfold!", "A world of dreams and adventures with %POKEMON% awaits! Let's go!", ], - this.eightBitter.scenePlayer.bindRoutine("ShrinkPlayer")); + () => this.shrinkPlayer(portrait), + ); this.eightBitter.menuGrapher.setActiveMenu("GeneralText"); } /** * Cutscene for shrinking the player. * - * @param settings Settings used for the cutscene. + * @param portrait Portrait of the player visualized on the screen. */ - public ShrinkPlayer(settings: any): void { - const silhouetteLarge: IThing = this.eightBitter.objectMaker.make(this.eightBitter.things.names.playerSilhouetteLarge); - const silhouetteSmall: IThing = this.eightBitter.objectMaker.make(this.eightBitter.things.names.playerSilhouetteSmall); - const player: IPlayer = this.eightBitter.objectMaker.make(this.eightBitter.things.names.player); + private shrinkPlayer(portrait: IThing): void { + const silhouetteLarge = this.eightBitter.objectMaker.make(this.eightBitter.things.names.playerSilhouetteLarge); + const silhouetteSmall = this.eightBitter.objectMaker.make(this.eightBitter.things.names.playerSilhouetteSmall); + const player = this.eightBitter.objectMaker.make(this.eightBitter.things.names.player); const timeDelay = 49; this.eightBitter.timeHandler.addEvent( (): void => { this.eightBitter.things.add(silhouetteLarge); - this.eightBitter.physics.setMidObj(silhouetteLarge, settings.portrait); - this.eightBitter.death.killNormal(settings.portrait); + this.eightBitter.physics.setMidObj(silhouetteLarge, portrait); + this.eightBitter.death.killNormal(portrait); }, timeDelay); @@ -566,15 +598,15 @@ export class IntroCutscene extends Genera timeDelay * 3); this.eightBitter.timeHandler.addEvent( - this.eightBitter.scenePlayer.bindRoutine("FadeOut"), + () => this.fadeOut(), timeDelay); } /** * Cutscene for completing the introduction and fading it out. */ - public FadeOut(): void { - const blank: IThing = this.eightBitter.objectMaker.make(this.eightBitter.things.names.whiteSquare, { + private fadeOut(): void { + const blank = this.eightBitter.objectMaker.make(this.eightBitter.things.names.whiteSquare, { width: this.eightBitter.mapScreener.width, height: this.eightBitter.mapScreener.height, opacity: 0, @@ -590,15 +622,16 @@ export class IntroCutscene extends Genera 0.2, 1, 7, - this.eightBitter.scenePlayer.bindRoutine("Finish")); + () => this.finish(), + ); }, 35); } /** - * Cutscene showing the player in his bedroom. + * Cutscene showing the player in theirbedroom. */ - public Finish(): void { + private finish(): void { delete this.eightBitter.mapScreener.cutscene; this.eightBitter.menuGrapher.deleteActiveMenu(); diff --git a/src/components/graphics/GraphicsLibrary.ts b/src/components/graphics/GraphicsLibrary.ts index 153d3bb3..6610aa25 100644 --- a/src/components/graphics/GraphicsLibrary.ts +++ b/src/components/graphics/GraphicsLibrary.ts @@ -532,7 +532,10 @@ export const graphicsLibrary = { PlayerPortrait: "p[1,2,3,4]x012,31113x018,3113332211x014,31x36,22221x012,133311332322223x010,1333100133232221x09,133310330123232223x08,133310330132323221x09,33331001333232321x09,13333110000x35,1x010,333x08,23331x010,1x08,22x15,x09,1x05,222211331003x08,1x25,111330100201x09,x15,333220100301x011,12223202200101x012,1x28,0011x014,1322312001x017,113222111x015,313311131321x012,312133312201323x010,12221131222013211x08,1222300x15,3331001x06,100230003x17,0010300001000010003x15,00001010003x05,1000x16,00030003001220230000x16,00030001032231310003x15,30001000101230021000x16,00001000030110221300x16,00001200010012221033x16,00001220010001313100x16,3333x25,1x05,133111031110000122211x06,13311110031111311121x06,1313331x36,1111221x07,113331x36,1003111x08,1x310,1011331x07,3133331133331133111x07,x36,1x35,1123331x07,133331013333101033x08,13333101333310011x09,1232310132321x013,13233101232333x012,32333300123231x011,123231000132331x011,133331000123231x011,133331000133331x05,", PlayerSilhouetteSmall: "p[0,1,2]x05,2222x08,22111122x05,2x18,200002x18,20002x110,2002x110,2002x110,20002x18,200002x18,2x05,2x16,2x05,22x16,220002x110,2002x110,202x112,22112x16,21120222x16,22200002x16,2x05,2x18,2000021112211120000211122111200021112002111200211120021112000222000022200", PlayerSilhouetteLarge: "p[0,1,2]x09,2222x016,22111122x013,2x18,2x012,2x18,2x011,2x110,2x010,2x110,2x010,2x110,2x010,2x110,2x010,2x110,2x011,2x18,2x012,2x18,2x013,22111122x015,211112x014,22x16,22x011,2x110,2x09,2x112,2x07,2x114,2x06,2x114,2x05,21112x18,21112000021122x18,221120002111202x16,2021112002112022x16,220211200211202x18,2021120211112x110,211112211122x110,2211120x25,x110,x25,x06,211112211112x09,2x15,22x15,2x08,2x15,22x15,2x08,2x15,22x15,2x08,21111200211112x07,2x15,2002x15,2x06,2x15,2002x15,2x06,2111120000211112x07,21112000021112x08,2112x06,2112x06,221112x06,2111220002x16,200002x16,2002x16,200002x16,2000x26,x06,x26,00", - OakPortrait: "p[0,1,2,3,4]x07,240002x022,211222122224x018,2x110,224x012,44411133x19,2x012,23313333x18,34x012,23342241124224312x011,433433132121112132x012,232311132x15,212x013,223113x17,232x013,422214141112222x013,41122243232222412x012,21214121122141412x012,21214421112431412x013,2241142x16,22x015,2211331113112x017,21322221414x019,234111242x019,22241114222x016,22311x25,1212x013,223311222311121122x010,2222311x27,1114124x08,211122122x15,21141114x07,2221112111x25,4441112x06,2244x27,4444244x15,4x05,2124242112x45,21141114200004112212112x46,211141412000021122121222244442114112120004x26,x15,3244421141121140021111211112224444214111211204x15,231111244222214111211202x15,222111222112141111211202x16,22232x15,23411112111202x15,x25,x15,23x15,2111200x25,3322x16,23x15,23112000021122122211222x16,2332x05,2x15,24222242x16,2332x05,2x15,22211222111144232x05,41441112442244221141112x06,21114112442444421141112x06,21114112442444421141112x06,21114112422444421141112x06,21114112444244421141112x06,21114112442024421141112x06,24114112442024421141142x06,21444112442024421144412x06,2x15,2443202442x16,2x07,221112433202442111122x09,x25,43200024x26,x010,244443320002x46,2x010,2444333200024443332x010,2444433200024332242x09,2422244442002x47,2x08,x28,420233x26,4x08,231112112000222311122x08,2x35,22x05,23333112x09,x25,x08,x26,", + OakPortrait: { + normal: "p[0,1,2,3,4]x07,240002x022,211222122224x018,2x110,224x012,44411133x19,2x012,23313333x18,34x012,23342241124224312x011,433433132121112132x012,232311132x15,212x013,223113x17,232x013,422214141112222x013,41122243232222412x012,21214121122141412x012,21214421112431412x013,2241142x16,22x015,2211331113112x017,21322221414x019,234111242x019,22241114222x016,22311x25,1212x013,223311222311121122x010,2222311x27,1114124x08,211122122x15,21141114x07,2221112111x25,4441112x06,2244x27,4444244x15,4x05,2124242112x45,21141114200004112212112x46,211141412000021122121222244442114112120004x26,x15,3244421141121140021111211112224444214111211204x15,231111244222214111211202x15,222111222112141111211202x16,22232x15,23411112111202x15,x25,x15,23x15,2111200x25,3322x16,23x15,23112000021122122211222x16,2332x05,2x15,24222242x16,2332x05,2x15,22211222111144232x05,41441112442244221141112x06,21114112442444421141112x06,21114112442444421141112x06,21114112422444421141112x06,21114112444244421141112x06,21114112442024421141112x06,24114112442024421141142x06,21444112442024421144412x06,2x15,2443202442x16,2x07,221112433202442111122x09,x25,43200024x26,x010,244443320002x46,2x010,2444333200024443332x010,2444433200024332242x09,2422244442002x47,2x08,x28,420233x26,4x08,231112112000222311122x08,2x35,22x05,23333112x09,x25,x08,x26,", + shady: ["filter", ["Scenery", "OakPortrait", "normal"], "BlackAndWhite"], + }, RivalPortrait: "p[0,1,2,3,4]x07,224x027,2424x026,2442x026,24424x020,4222x45,2024x014,22x410,2332x011,42x412,33332x09,24422x48,x37,4x07,202212x49,x36,2x011,2x45,2444243424442x09,2x45,244423242122442x07,x46,224423332212144424x05,24444232442333221412444420002x45,2232423323323112422000022244213224342123232222x08,242213123331121121112x08,2420231233311212214112x08,2002x38,123321112x011,2x36,23112223112x012,243322311211122212x013,24333241111233114x014,224211222123112x011,2222331221112233114x08,2232333312x15,323112x07,2133342224x16,3233114x06,24343333112211113343332x07,2323311121121122423332x07,212111121441220002222x07,4x17,214412x015,214x16,21122x015,212x17,2232x014,4112x18,32x015,2112333x26,x016,23332221411112x014,433321141144442x014,223322221141112x015,42244422144442x015,21244424x26,x015,212x410,2x016,4244422x47,x015,x46,22x45,2x015,2x45,20x45,2x015,24444200244442x015,23434200243432x015,233442000333444x014,434444000234342x013,2343420000243442x013,2444420000234342x013,x46,x05,44442x013,224222x05,22422x012,2112112x05,212112x011,2112112x05,212112x010,2422422x06,2242242x09,2444112x07,214442x08,2111122x09,21112x09,2222x012,222", BlainePortrait: "p[0,1,2,3,4]000233x16,2x06,333x16,4x05,2x35,x15,400002x36,11112000024x37,2220004132x35,2431200233223432232320023244222442232000224423244242x05,3224332212x06,2334333112x06,242111142x08,43344412x08,2x35,4x010,2333124x09,42442220000", BrockPortrait: "p[0,1,2,3,4]004x211,4004x213,0x25,4224x211,43233324x27,4x38,4222422x310,224024243111334242022333241142333220433222332223340043133311333134033211112x15,233232x110,23202241142241142200004x18,4x06,32x16,23x08,221122", @@ -1010,6 +1013,7 @@ export const graphicsLibrary = { outline: "p[0,2]11000101001001010001100101010011000", }, CharArrowBottom: "p[0,2]x114,0x15,000111x05,1000", + CharArrowDown: "p[0,2]x114,0x15,000111x05,1000", CharArrowLeft: "p[0,2]00011001110x19,011110011100011", HalfArrowLeft: "p[0,2]x06,110000111100x114,", HalfArrowRight: "p[0,2]11x06,11110000x16,00x18,", diff --git a/src/creators/createMenuGrapher.ts b/src/creators/createMenuGrapher.ts index f7012b93..5ece447f 100644 --- a/src/creators/createMenuGrapher.ts +++ b/src/creators/createMenuGrapher.ts @@ -30,6 +30,7 @@ export const createMenuGrapher = (fsp: FullScreenPokemon): MenuGraphr => "'": "Apostrophe", "�": "eFancy", }, + dialogScrollDistance: 8, eightBitter: fsp, replacements: { "PLAYER": (): string[] => @@ -147,7 +148,7 @@ export const createMenuGrapher = (fsp: FullScreenPokemon): MenuGraphr => }, ignoreB: true, textPaddingRight: 12, - }, + } as IMenuSchema, "Option": { childrenSchemas: [ { @@ -202,7 +203,7 @@ export const createMenuGrapher = (fsp: FullScreenPokemon): MenuGraphr => }, }, textColumnWidth: 144, - }, + } as IMenuSchema, "OptionBattleStyle": { ...optionSubMenuBase, childrenSchemas: [ @@ -241,7 +242,7 @@ export const createMenuGrapher = (fsp: FullScreenPokemon): MenuGraphr => preserveArrow: optionPreserveArrow, textXOffset: 32, textYOffset: 0, - }, + } as IMenuSchema, "OptionTextSpeed": { ...optionSubMenuBase, childrenSchemas: [ @@ -2158,7 +2159,7 @@ export const createMenuGrapher = (fsp: FullScreenPokemon): MenuGraphr => top: 36, }, }, - }], + }], container: "Battle", hidden: true, } as IMenuSchema, diff --git a/src/creators/createScenePlayer.ts b/src/creators/createScenePlayer.ts index d386017f..8932b96b 100644 --- a/src/creators/createScenePlayer.ts +++ b/src/creators/createScenePlayer.ts @@ -22,7 +22,7 @@ export const createScenePlayer = (fsp: FullScreenPokemon): ScenePlayr => routines: fsp.cutscenes.elderTraining, }, Intro: { - firstRoutine: "FadeIn", + firstRoutine: "start", routines: fsp.cutscenes.intro, }, OakIntro: {