From 6c5277854bde34d95aeed32c8334fe872ed9d40a Mon Sep 17 00:00:00 2001 From: Wlowscha <54003515+Wlowscha@users.noreply.github.com> Date: Mon, 28 Jul 2025 22:31:41 +0200 Subject: [PATCH] Removed unused scale parameter from InfoOverlay s --- .../encounters/bug-type-superfan-encounter.ts | 4 +-- src/ui/fight-ui-handler.ts | 4 +-- src/ui/modifier-select-ui-handler.ts | 4 +-- src/ui/move-info-overlay.ts | 24 +++++++-------- src/ui/party-ui-handler.ts | 5 +--- src/ui/pokedex-info-overlay.ts | 29 +++++++++---------- src/ui/pokedex-page-ui-handler.ts | 7 ++--- src/ui/starter-select-ui-handler.ts | 4 +-- 8 files changed, 31 insertions(+), 50 deletions(-) diff --git a/src/data/mystery-encounters/encounters/bug-type-superfan-encounter.ts b/src/data/mystery-encounters/encounters/bug-type-superfan-encounter.ts index d60ebe690ac..5badac0fe3e 100644 --- a/src/data/mystery-encounters/encounters/bug-type-superfan-encounter.ts +++ b/src/data/mystery-encounters/encounters/bug-type-superfan-encounter.ts @@ -715,14 +715,12 @@ function doBugTypeMoveTutor(): Promise { const moveOptions = globalScene.currentBattle.mysteryEncounter!.misc.moveTutorOptions; await showEncounterDialogue(`${namespace}:battle_won`, `${namespace}:speaker`); - const overlayScale = 1; const moveInfoOverlay = new MoveInfoOverlay({ delayVisibility: false, - scale: overlayScale, onSide: true, right: true, x: 1, - y: -MoveInfoOverlay.getHeight(overlayScale, true) - 1, + y: -MoveInfoOverlay.getHeight(true) - 1, width: globalScene.game.canvas.width / 6 - 2, }); globalScene.ui.add(moveInfoOverlay); diff --git a/src/ui/fight-ui-handler.ts b/src/ui/fight-ui-handler.ts index 42f8cba5df4..52640d03de9 100644 --- a/src/ui/fight-ui-handler.ts +++ b/src/ui/fight-ui-handler.ts @@ -105,14 +105,12 @@ export class FightUiHandler extends UiHandler implements InfoToggle { ]); // prepare move overlay - const overlayScale = 1; this.moveInfoOverlay = new MoveInfoOverlay({ delayVisibility: true, - scale: overlayScale, onSide: true, right: true, x: 0, - y: -MoveInfoOverlay.getHeight(overlayScale, true), + y: -MoveInfoOverlay.getHeight(true), width: globalScene.game.canvas.width / 6 + 4, hideEffectBox: true, hideBg: true, diff --git a/src/ui/modifier-select-ui-handler.ts b/src/ui/modifier-select-ui-handler.ts index 50d88738d32..98cf7c8d246 100644 --- a/src/ui/modifier-select-ui-handler.ts +++ b/src/ui/modifier-select-ui-handler.ts @@ -146,14 +146,12 @@ export class ModifierSelectUiHandler extends AwaitableUiHandler { this.continueButtonContainer.add(continueButtonText); // prepare move overlay - const overlayScale = 1; this.moveInfoOverlay = new MoveInfoOverlay({ delayVisibility: true, - scale: overlayScale, onSide: true, right: true, x: 1, - y: -MoveInfoOverlay.getHeight(overlayScale, true) - 1, + y: -MoveInfoOverlay.getHeight(true) - 1, width: globalScene.game.canvas.width / 6 - 2, }); ui.add(this.moveInfoOverlay); diff --git a/src/ui/move-info-overlay.ts b/src/ui/move-info-overlay.ts index f8632eb244e..0c589d8bfe4 100644 --- a/src/ui/move-info-overlay.ts +++ b/src/ui/move-info-overlay.ts @@ -11,16 +11,15 @@ import i18next from "i18next"; export interface MoveInfoOverlaySettings { delayVisibility?: boolean; // if true, showing the overlay will only set it to active and populate the fields and the handler using this field has to manually call setVisible later. - scale?: number; // scale the box? A scale of 0.5 is recommended top?: boolean; // should the effect box be on top? right?: boolean; // should the effect box be on the right? onSide?: boolean; // should the effect be on the side? ignores top argument if true //location and width of the component; unaffected by scaling x?: number; y?: number; - /** Default is always half the screen, regardless of scale */ + // Default width is half the screen width?: number; - /** Determines whether to display the small secondary box */ + // Determines whether to display the small secondary box hideEffectBox?: boolean; hideBg?: boolean; } @@ -54,12 +53,11 @@ export class MoveInfoOverlay extends Phaser.GameObjects.Container implements Inf options.top = false; } super(globalScene, options?.x, options?.y); - const scale = options?.scale || 1; // set up the scale - this.setScale(scale); + this.setScale(1); this.options = options || {}; // prepare the description box - const width = (options?.width || MoveInfoOverlay.getWidth(scale)) / scale; // divide by scale as we always want this to be half a window wide + const width = options?.width || MoveInfoOverlay.getWidth(); // we always want this to be half a window wide this.descBg = addWindow( options?.onSide && !options?.right ? EFF_WIDTH : 0, options?.top ? EFF_HEIGHT : 0, @@ -97,10 +95,10 @@ export class MoveInfoOverlay extends Phaser.GameObjects.Container implements Inf const moveDescriptionTextMaskRect = globalScene.make.graphics(); moveDescriptionTextMaskRect.fillStyle(0xff0000); moveDescriptionTextMaskRect.fillRect( - maskPointOrigin.x + ((options?.onSide && !options?.right ? EFF_WIDTH : 0) + BORDER) * scale, - maskPointOrigin.y + ((options?.top ? EFF_HEIGHT : 0) + BORDER - 2) * scale, - width - ((options?.onSide ? EFF_WIDTH : 0) - BORDER * 2) * scale, - (DESC_HEIGHT - (BORDER - 2) * 2) * scale, + maskPointOrigin.x + ((options?.onSide && !options?.right ? EFF_WIDTH : 0) + BORDER), + maskPointOrigin.y + ((options?.top ? EFF_HEIGHT : 0) + BORDER - 2), + width - ((options?.onSide ? EFF_WIDTH : 0) - BORDER * 2), + DESC_HEIGHT - (BORDER - 2) * 2, ); moveDescriptionTextMaskRect.setScale(6); const moveDescriptionTextMask = this.createGeometryMask(moveDescriptionTextMaskRect); @@ -233,12 +231,12 @@ export class MoveInfoOverlay extends Phaser.GameObjects.Container implements Inf } // width of this element - static getWidth(_scale: number): number { + static getWidth(): number { return globalScene.game.canvas.width / GLOBAL_SCALE / 2; } // height of this element - static getHeight(scale: number, onSide?: boolean): number { - return (onSide ? Math.max(EFF_HEIGHT, DESC_HEIGHT) : EFF_HEIGHT + DESC_HEIGHT) * scale; + static getHeight(onSide?: boolean): number { + return onSide ? Math.max(EFF_HEIGHT, DESC_HEIGHT) : EFF_HEIGHT + DESC_HEIGHT; } } diff --git a/src/ui/party-ui-handler.ts b/src/ui/party-ui-handler.ts index 915cc76fd73..2068740c10a 100644 --- a/src/ui/party-ui-handler.ts +++ b/src/ui/party-ui-handler.ts @@ -308,13 +308,10 @@ export class PartyUiHandler extends MessageUiHandler { this.iconAnimHandler = new PokemonIconAnimHandler(); this.iconAnimHandler.setup(); - // prepare move overlay. in case it appears to be too big, set the overlayScale to .5 - const overlayScale = 1; this.moveInfoOverlay = new MoveInfoOverlay({ - scale: overlayScale, top: true, x: 1, - y: -MoveInfoOverlay.getHeight(overlayScale) - 1, + y: -MoveInfoOverlay.getHeight() - 1, width: globalScene.game.canvas.width / 12 - 30, }); ui.add(this.moveInfoOverlay); diff --git a/src/ui/pokedex-info-overlay.ts b/src/ui/pokedex-info-overlay.ts index 0f2f5fa3dde..36346d071af 100644 --- a/src/ui/pokedex-info-overlay.ts +++ b/src/ui/pokedex-info-overlay.ts @@ -7,7 +7,6 @@ import { fixedInt } from "#utils/common"; export interface PokedexInfoOverlaySettings { delayVisibility?: boolean; // if true, showing the overlay will only set it to active and populate the fields and the handler using this field has to manually call setVisible later. - scale?: number; // scale the box? A scale of 0.5 is recommended //location and width of the component; unaffected by scaling x?: number; y?: number; @@ -36,17 +35,15 @@ export class PokedexInfoOverlay extends Phaser.GameObjects.Container implements private maskPointOriginX: number; private maskPointOriginY: number; - public scale: number; public width: number; constructor(options?: PokedexInfoOverlaySettings) { super(globalScene, options?.x, options?.y); - this.scale = options?.scale || 1; // set up the scale - this.setScale(this.scale); + this.setScale(1); this.options = options || {}; // prepare the description box - this.width = (options?.width || PokedexInfoOverlay.getWidth(this.scale)) / this.scale; // divide by scale as we always want this to be half a window wide + this.width = options?.width || PokedexInfoOverlay.getWidth(); // we always want this to be half a window wide this.descBg = addWindow(0, 0, this.width, DESC_HEIGHT); this.descBg.setOrigin(0, 0); this.add(this.descBg); @@ -70,10 +67,10 @@ export class PokedexInfoOverlay extends Phaser.GameObjects.Container implements this.textMaskRect = globalScene.make.graphics(); this.textMaskRect.fillStyle(0xff0000); this.textMaskRect.fillRect( - this.maskPointOriginX + BORDER * this.scale, - this.maskPointOriginY + (BORDER - 2) * this.scale, - this.width - BORDER * 2 * this.scale, - (DESC_HEIGHT - (BORDER - 2) * 2) * this.scale, + this.maskPointOriginX + BORDER, + this.maskPointOriginY + (BORDER - 2), + this.width - BORDER * 2, + DESC_HEIGHT - (BORDER - 2) * 2, ); this.textMaskRect.setScale(6); const textMask = this.createGeometryMask(this.textMaskRect); @@ -111,10 +108,10 @@ export class PokedexInfoOverlay extends Phaser.GameObjects.Container implements this.textMaskRect.clear(); this.textMaskRect.fillStyle(0xff0000); this.textMaskRect.fillRect( - this.maskPointOriginX + BORDER * this.scale, - this.maskPointOriginY + (BORDER - 2) * this.scale + (48 - newHeight), - this.width - BORDER * 2 * this.scale, - (newHeight - (BORDER - 2) * 2) * this.scale, + this.maskPointOriginX + BORDER, + this.maskPointOriginY + (BORDER - 2) + (48 - newHeight), + this.width - BORDER * 2, + newHeight - (BORDER - 2) * 2, ); const updatedMask = this.createGeometryMask(this.textMaskRect); this.desc.setMask(updatedMask); @@ -167,12 +164,12 @@ export class PokedexInfoOverlay extends Phaser.GameObjects.Container implements } // width of this element - static getWidth(_scale: number): number { + static getWidth(): number { return globalScene.game.canvas.width / GLOBAL_SCALE / 2; } // height of this element - static getHeight(scale: number, _onSide?: boolean): number { - return DESC_HEIGHT * scale; + static getHeight(): number { + return DESC_HEIGHT; } } diff --git a/src/ui/pokedex-page-ui-handler.ts b/src/ui/pokedex-page-ui-handler.ts index 49ce5b64d9f..380e0564c02 100644 --- a/src/ui/pokedex-page-ui-handler.ts +++ b/src/ui/pokedex-page-ui-handler.ts @@ -682,19 +682,16 @@ export class PokedexPageUiHandler extends MessageUiHandler { this.menuContainer.bringToTop(this.baseStatsOverlay); // add the info overlay last to be the top most ui element and prevent the IVs from overlaying this - const overlayScale = 1; this.moveInfoOverlay = new MoveInfoOverlay({ - scale: overlayScale, top: true, x: 1, - y: globalScene.game.canvas.height / 6 - MoveInfoOverlay.getHeight(overlayScale) - 29, + y: globalScene.game.canvas.height / 6 - MoveInfoOverlay.getHeight() - 29, }); this.starterSelectContainer.add(this.moveInfoOverlay); this.infoOverlay = new PokedexInfoOverlay({ - scale: overlayScale, x: 1, - y: globalScene.game.canvas.height / 6 - PokedexInfoOverlay.getHeight(overlayScale) - 29, + y: globalScene.game.canvas.height / 6 - PokedexInfoOverlay.getHeight() - 29, }); this.starterSelectContainer.add(this.infoOverlay); diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index e8f9b5e1c38..388e7162663 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -1184,12 +1184,10 @@ export class StarterSelectUiHandler extends MessageUiHandler { this.starterSelectContainer.add(this.statsContainer); // add the info overlay last to be the top most ui element and prevent the IVs from overlaying this - const overlayScale = 1; this.moveInfoOverlay = new MoveInfoOverlay({ - scale: overlayScale, top: true, x: 1, - y: globalScene.game.canvas.height / 6 - MoveInfoOverlay.getHeight(overlayScale) - 29, + y: globalScene.game.canvas.height / 6 - MoveInfoOverlay.getHeight() - 29, }); this.starterSelectContainer.add(this.moveInfoOverlay);