Add toggle for fusion palette swaps

pull/16/head
Flashfyre 2024-03-05 21:54:26 -05:00
parent 9ee254a18a
commit 50b9bf10a7
3 changed files with 22 additions and 11 deletions

View File

@ -98,6 +98,7 @@ export default class BattleScene extends Phaser.Scene {
public enableTutorials: boolean = true; public enableTutorials: boolean = true;
public windowType: integer = 1; public windowType: integer = 1;
public experimentalSprites: boolean = false; public experimentalSprites: boolean = false;
public fusionPaletteSwaps: boolean = true;
public enableTouchControls: boolean = false; public enableTouchControls: boolean = false;
public enableVibration: boolean = false; public enableVibration: boolean = false;
public finalWave: integer = 200; public finalWave: integer = 200;

View File

@ -1,3 +1,4 @@
import BattleScene from "../battle-scene";
import Pokemon from "../field/pokemon"; import Pokemon from "../field/pokemon";
import Trainer from "../field/trainer"; import Trainer from "../field/trainer";
import FieldSpritePipeline from "./field-sprite"; import FieldSpritePipeline from "./field-sprite";
@ -335,8 +336,6 @@ export default class SpritePipeline extends FieldSpritePipeline {
const teraColor = data['teraColor'] as integer[] ?? [ 0, 0, 0 ]; const teraColor = data['teraColor'] as integer[] ?? [ 0, 0, 0 ];
const hasShadow = data['hasShadow'] as boolean; const hasShadow = data['hasShadow'] as boolean;
const ignoreOverride = data['ignoreOverride'] as boolean; const ignoreOverride = data['ignoreOverride'] as boolean;
const spriteColors = (ignoreOverride && data['spriteColorsBase']) || data['spriteColors'] || [] as number[][];
const fusionSpriteColors = (ignoreOverride && data['fusionSpriteColorsBase']) || data['fusionSpriteColors'] || [] as number[][];
const isEntityObj = sprite.parentContainer instanceof Pokemon || sprite.parentContainer instanceof Trainer; const isEntityObj = sprite.parentContainer instanceof Pokemon || sprite.parentContainer instanceof Trainer;
const field = isEntityObj ? sprite.parentContainer.parentContainer : sprite.parentContainer; const field = isEntityObj ? sprite.parentContainer.parentContainer : sprite.parentContainer;
@ -362,6 +361,10 @@ export default class SpritePipeline extends FieldSpritePipeline {
this.set1f('yOffset', sprite.height - sprite.frame.height * (isEntityObj ? sprite.parentContainer.scale : sprite.scale)); this.set1f('yOffset', sprite.height - sprite.frame.height * (isEntityObj ? sprite.parentContainer.scale : sprite.scale));
this.set4fv('tone', tone); this.set4fv('tone', tone);
this.bindTexture(this.game.textures.get('tera').source[0].glTexture, 1); this.bindTexture(this.game.textures.get('tera').source[0].glTexture, 1);
if ((gameObject.scene as BattleScene).fusionPaletteSwaps) {
const spriteColors = (ignoreOverride && data['spriteColorsBase']) || data['spriteColors'] || [] as number[][];
const fusionSpriteColors = (ignoreOverride && data['fusionSpriteColorsBase']) || data['fusionSpriteColors'] || [] as number[][];
const emptyColors = [ 0, 0, 0, 0 ]; const emptyColors = [ 0, 0, 0, 0 ];
const flatSpriteColors: integer[] = []; const flatSpriteColors: integer[] = [];
const flatFusionSpriteColors: integer[] = []; const flatFusionSpriteColors: integer[] = [];
@ -373,6 +376,7 @@ export default class SpritePipeline extends FieldSpritePipeline {
this.set4iv(`spriteColors`, flatSpriteColors.flat()); this.set4iv(`spriteColors`, flatSpriteColors.flat());
this.set4iv(`fusionSpriteColors`, flatFusionSpriteColors.flat()); this.set4iv(`fusionSpriteColors`, flatFusionSpriteColors.flat());
} }
}
batchQuad(gameObject: Phaser.GameObjects.GameObject, x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, batchQuad(gameObject: Phaser.GameObjects.GameObject, x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number,
u0: number, v0: number, u1: number, v1: number, tintTL: number, tintTR: number, tintBL: number, tintBR: number, tintEffect: number | boolean, u0: number, v0: number, u1: number, v1: number, tintTL: number, tintTR: number, tintBL: number, tintBR: number, tintEffect: number | boolean,

View File

@ -12,6 +12,7 @@ export enum Setting {
Window_Type = "WINDOW_TYPE", Window_Type = "WINDOW_TYPE",
Tutorials = "TUTORIALS", Tutorials = "TUTORIALS",
Sprite_Set = "SPRITE_SET", Sprite_Set = "SPRITE_SET",
Fusion_Palette_Swaps = "FUSION_PALETTE_SWAPS",
Player_Gender = "PLAYER_GENDER", Player_Gender = "PLAYER_GENDER",
Touch_Controls = "TOUCH_CONTROLS", Touch_Controls = "TOUCH_CONTROLS",
Vibration = "VIBRATION" Vibration = "VIBRATION"
@ -35,6 +36,7 @@ export const settingOptions: SettingOptions = {
[Setting.Window_Type]: new Array(4).fill(null).map((_, i) => (i + 1).toString()), [Setting.Window_Type]: new Array(4).fill(null).map((_, i) => (i + 1).toString()),
[Setting.Tutorials]: [ 'Off', 'On' ], [Setting.Tutorials]: [ 'Off', 'On' ],
[Setting.Sprite_Set]: [ 'Consistent', 'Prioritize Animation' ], [Setting.Sprite_Set]: [ 'Consistent', 'Prioritize Animation' ],
[Setting.Fusion_Palette_Swaps]: [ 'Off', 'On' ],
[Setting.Player_Gender]: [ 'Boy', 'Girl' ], [Setting.Player_Gender]: [ 'Boy', 'Girl' ],
[Setting.Touch_Controls]: [ 'Auto', 'Disabled' ], [Setting.Touch_Controls]: [ 'Auto', 'Disabled' ],
[Setting.Vibration]: [ 'Auto', 'Disabled' ] [Setting.Vibration]: [ 'Auto', 'Disabled' ]
@ -50,6 +52,7 @@ export const settingDefaults: SettingDefaults = {
[Setting.Window_Type]: 0, [Setting.Window_Type]: 0,
[Setting.Tutorials]: 1, [Setting.Tutorials]: 1,
[Setting.Sprite_Set]: 0, [Setting.Sprite_Set]: 0,
[Setting.Fusion_Palette_Swaps]: 1,
[Setting.Player_Gender]: 0, [Setting.Player_Gender]: 0,
[Setting.Touch_Controls]: 0, [Setting.Touch_Controls]: 0,
[Setting.Vibration]: 0 [Setting.Vibration]: 0
@ -89,6 +92,9 @@ export function setSetting(scene: BattleScene, setting: Setting, value: integer)
if (value) if (value)
scene.initExpSprites(); scene.initExpSprites();
break; break;
case Setting.Fusion_Palette_Swaps:
scene.fusionPaletteSwaps = !!value;
break;
case Setting.Player_Gender: case Setting.Player_Gender:
if (scene.gameData) { if (scene.gameData) {
const female = settingOptions[setting][value] === 'Girl'; const female = settingOptions[setting][value] === 'Girl';