diff --git a/src/pipelines/sprite.ts b/src/pipelines/sprite.ts index 541d51e1ac2..5eac3f69e24 100644 --- a/src/pipelines/sprite.ts +++ b/src/pipelines/sprite.ts @@ -16,8 +16,8 @@ varying vec2 outPosition; varying float outTintEffect; varying vec4 outTint; -uniform bool hasShadow; -uniform bool yCenter; +uniform int hasShadow; +uniform int yCenter; uniform float vCutoff; uniform vec2 relPosition; uniform vec2 size; @@ -55,13 +55,13 @@ void main() /* Apply tone */ color.rgb += tone.rgb * (color.a / 255.0); - if (hasShadow) { + if (hasShadow == 1) { float width = size.x - (yOffset / 2.0); float spriteX = ((floor(outPosition.x / 6.0) - relPosition.x) / width) + 0.5; float spriteY = ((floor(outPosition.y / 6.0) - relPosition.y) / size.y); - if (yCenter) { + if (yCenter == 1) { spriteY += 0.5; } else { spriteY += 1.0; @@ -133,8 +133,8 @@ export default class SpritePipeline extends Phaser.Renderer.WebGL.Pipelines.Mult } onPreRender(): void { - this.setBoolean('hasShadow', false); - this.setBoolean('yCenter', false); + this.set1i('hasShadow', 0); + this.set1i('yCenter', 0); this.set2f('relPosition', 0, 0); this.set2f('size', 0, 0); this.set1f('yOffset', 0); @@ -154,8 +154,8 @@ export default class SpritePipeline extends Phaser.Renderer.WebGL.Pipelines.Mult ? [ sprite.parentContainer.x, sprite.parentContainer.y ] : [ sprite.x, sprite.y ]; position[0] += -(sprite.width - sprite.frame.width) / 2 + sprite.frame.x; - this.setBoolean('hasShadow', hasShadow); - this.setBoolean('yCenter', sprite.originY === 0.5); + this.set1i('hasShadow', hasShadow ? 1 : 0); + this.set1i('yCenter', sprite.originY === 0.5 ? 1 : 0); this.set2f('relPosition', position[0], position[1]); this.set2f('size', sprite.frame.width, sprite.height); this.set1f('yOffset', sprite.height - sprite.frame.height); diff --git a/src/pokemon.ts b/src/pokemon.ts index 08a4ab6161a..cace690733d 100644 --- a/src/pokemon.ts +++ b/src/pokemon.ts @@ -157,7 +157,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { const ret = this.scene.add.sprite(0, 0, `pkmn__${this.isPlayer() ? 'back__' : ''}sub`); ret.setOrigin(0.5, 1); ret.setPipeline(this.scene.spritePipeline, { tone: [ 0.0, 0.0, 0.0, 0.0 ], hasShadow: !!hasShadow }); - ret.preFX.add return ret; };