Add option to disable move animations

This commit is contained in:
Flashfyre 2024-04-09 15:06:47 -04:00
parent c9eff345cf
commit b892a8b40e
3 changed files with 42 additions and 31 deletions

View File

@ -119,6 +119,7 @@ export default class BattleScene extends SceneBase {
public uiTheme: UiTheme = UiTheme.DEFAULT; public uiTheme: UiTheme = UiTheme.DEFAULT;
public windowType: integer = 0; public windowType: integer = 0;
public experimentalSprites: boolean = false; public experimentalSprites: boolean = false;
public moveAnimations: boolean = true;
public fusionPaletteSwaps: boolean = true; public fusionPaletteSwaps: boolean = true;
public enableTouchControls: boolean = false; public enableTouchControls: boolean = false;
public enableVibration: boolean = false; public enableVibration: boolean = false;

View File

@ -722,6 +722,41 @@ export abstract class BattleAnim {
const userSprite = user.getSprite(); const userSprite = user.getSprite();
const targetSprite = target.getSprite(); const targetSprite = target.getSprite();
const spriteCache: SpriteCache = {
[AnimFrameTarget.GRAPHIC]: [],
[AnimFrameTarget.USER]: [],
[AnimFrameTarget.TARGET]: []
};
const spritePriorities: integer[] = [];
const cleanUpAndComplete = () => {
userSprite.setPosition(0, 0);
userSprite.setScale(1);
userSprite.setAlpha(1);
userSprite.pipelineData['tone'] = [ 0.0, 0.0, 0.0, 0.0 ];
userSprite.setAngle(0);
targetSprite.setPosition(0, 0);
targetSprite.setScale(1);
targetSprite.setAlpha(1);
targetSprite.pipelineData['tone'] = [ 0.0, 0.0, 0.0, 0.0 ];
targetSprite.setAngle(0);
if (!this.isHideUser())
userSprite.setVisible(true);
if (!this.isHideTarget() && (targetSprite !== userSprite || !this.isHideUser()))
targetSprite.setVisible(true);
for (let ms of Object.values(spriteCache).flat()) {
if (ms)
ms.destroy();
}
if (this.bgSprite)
this.bgSprite.destroy();
if (callback)
callback();
};
if (!scene.moveAnimations)
return cleanUpAndComplete();
const anim = this.getAnim(); const anim = this.getAnim();
const userInitialX = user.x; const userInitialX = user.x;
@ -735,13 +770,6 @@ export abstract class BattleAnim {
let r = anim.frames.length; let r = anim.frames.length;
let f = 0; let f = 0;
const spriteCache: SpriteCache = {
[AnimFrameTarget.GRAPHIC]: [],
[AnimFrameTarget.USER]: [],
[AnimFrameTarget.TARGET]: []
};
const spritePriorities: integer[] = [];
scene.tweens.addCounter({ scene.tweens.addCounter({
duration: Utils.getFrameMs(3), duration: Utils.getFrameMs(3),
repeat: anim.frames.length, repeat: anim.frames.length,
@ -880,30 +908,6 @@ export abstract class BattleAnim {
r--; r--;
}, },
onComplete: () => { onComplete: () => {
const cleanUpAndComplete = () => {
userSprite.setPosition(0, 0);
userSprite.setScale(1);
userSprite.setAlpha(1);
userSprite.pipelineData['tone'] = [ 0.0, 0.0, 0.0, 0.0 ];
userSprite.setAngle(0);
targetSprite.setPosition(0, 0);
targetSprite.setScale(1);
targetSprite.setAlpha(1);
targetSprite.pipelineData['tone'] = [ 0.0, 0.0, 0.0, 0.0 ];
targetSprite.setAngle(0);
if (!this.isHideUser())
userSprite.setVisible(true);
if (!this.isHideTarget() && (targetSprite !== userSprite || !this.isHideUser()))
targetSprite.setVisible(true);
for (let ms of Object.values(spriteCache).flat()) {
if (ms)
ms.destroy();
}
if (this.bgSprite)
this.bgSprite.destroy();
if (callback)
callback();
};
for (let ms of Object.values(spriteCache).flat()) { for (let ms of Object.values(spriteCache).flat()) {
if (ms && !ms.getData('locked')) if (ms && !ms.getData('locked'))
ms.destroy(); ms.destroy();

View File

@ -14,6 +14,7 @@ export enum Setting {
Tutorials = "TUTORIALS", Tutorials = "TUTORIALS",
Enable_Retries = "ENABLE_RETRIES", Enable_Retries = "ENABLE_RETRIES",
Sprite_Set = "SPRITE_SET", Sprite_Set = "SPRITE_SET",
Move_Animations = "MOVE_ANIMATIONS",
Show_Stats_on_Level_Up = "SHOW_LEVEL_UP_STATS", Show_Stats_on_Level_Up = "SHOW_LEVEL_UP_STATS",
Fusion_Palette_Swaps = "FUSION_PALETTE_SWAPS", Fusion_Palette_Swaps = "FUSION_PALETTE_SWAPS",
Player_Gender = "PLAYER_GENDER", Player_Gender = "PLAYER_GENDER",
@ -40,6 +41,7 @@ export const settingOptions: SettingOptions = {
[Setting.Tutorials]: [ 'Off', 'On' ], [Setting.Tutorials]: [ 'Off', 'On' ],
[Setting.Enable_Retries]: [ 'Off', 'On' ], [Setting.Enable_Retries]: [ 'Off', 'On' ],
[Setting.Sprite_Set]: [ 'Consistent', 'Prioritize Animation' ], [Setting.Sprite_Set]: [ 'Consistent', 'Prioritize Animation' ],
[Setting.Move_Animations]: [ 'Off', 'On' ],
[Setting.Show_Stats_on_Level_Up]: [ 'Off', 'On' ], [Setting.Show_Stats_on_Level_Up]: [ 'Off', 'On' ],
[Setting.Fusion_Palette_Swaps]: [ 'Off', 'On' ], [Setting.Fusion_Palette_Swaps]: [ 'Off', 'On' ],
[Setting.Player_Gender]: [ 'Boy', 'Girl' ], [Setting.Player_Gender]: [ 'Boy', 'Girl' ],
@ -58,6 +60,7 @@ export const settingDefaults: SettingDefaults = {
[Setting.Tutorials]: 1, [Setting.Tutorials]: 1,
[Setting.Enable_Retries]: 0, [Setting.Enable_Retries]: 0,
[Setting.Sprite_Set]: 0, [Setting.Sprite_Set]: 0,
[Setting.Move_Animations]: 1,
[Setting.Show_Stats_on_Level_Up]: 1, [Setting.Show_Stats_on_Level_Up]: 1,
[Setting.Fusion_Palette_Swaps]: 1, [Setting.Fusion_Palette_Swaps]: 1,
[Setting.Player_Gender]: 0, [Setting.Player_Gender]: 0,
@ -104,6 +107,9 @@ export function setSetting(scene: BattleScene, setting: Setting, value: integer)
if (value) if (value)
scene.initExpSprites(); scene.initExpSprites();
break; break;
case Setting.Move_Animations:
scene.moveAnimations = settingOptions[setting][value] === 'On';
break;
case Setting.Show_Stats_on_Level_Up: case Setting.Show_Stats_on_Level_Up:
scene.showLevelUpStats = settingOptions[setting][value] === 'On'; scene.showLevelUpStats = settingOptions[setting][value] === 'On';
break; break;