From 895627a641175bafc76e517b9f3ae7c07658aafe Mon Sep 17 00:00:00 2001 From: Eliot Partridge Date: Sat, 21 Sep 2019 22:46:16 -0500 Subject: [PATCH] Archive update v0.54.0 --- LICENSE_ART.txt | 2 ++ README.md | 9 +++++++++ assets/images/logo-pt-small.png | 3 +++ package.json | 2 +- src/ts/client/credits.ts | 2 ++ src/ts/client/draw.ts | 1 + src/ts/client/game.ts | 4 ++-- src/ts/client/webgl.ts | 4 ++-- src/ts/common/interfaces.ts | 1 + src/ts/common/pony.ts | 1 + src/ts/components/shared/action-bar/action-bar.pug | 2 +- src/ts/components/shared/action-bar/action-bar.ts | 14 ++++++++++++++ .../shared/actions-modal/actions-modal.ts | 6 ++++++ .../shared/visit-pt-button/visit-pt-button.pug | 2 +- src/ts/graphics/contextSpriteBatch.ts | 4 +++- src/ts/graphics/paletteSpriteBatch.ts | 7 ++++++- src/ts/graphics/shaders/palette-layers.glsl | 5 ++++- src/ts/graphics/webgl/frameBuffer.ts | 9 +++------ 18 files changed, 62 insertions(+), 16 deletions(-) create mode 100644 assets/images/logo-pt-small.png diff --git a/LICENSE_ART.txt b/LICENSE_ART.txt index 501a290..0389bee 100644 --- a/LICENSE_ART.txt +++ b/LICENSE_ART.txt @@ -30,6 +30,8 @@ creator(s): SC (https://0somecunt0.tumblr.com/tagged/sfw) SailorDolpin (https://vk.com/id324582699) Deeraw (https://www.deviantart.com/deerdraw, https://twitter.com/TheOnlyDeeraw) + Aviivix + SnowFl8keAnge1 Pony Town's art assets are released under the CC BY-NC 4.0 non-commercial license. diff --git a/README.md b/README.md index d1fea5b..3ecee72 100644 --- a/README.md +++ b/README.md @@ -276,6 +276,15 @@ Tools are accessible at `/tools/` (only available in dev mode or when ## Changelog +### Pony.Town v0.54.0 +- Added a separate logo file for Visit Pony Town button +- Fixed users not being able to close actions menu in some cases +- Fixed torch flames having wrong outlines in some cases +- Fixed lights sometimes popping up through ponies +- Fixed lights being visible through pony eyeshadows +- Fixed lights of held items flickering for some users +- Updated credits + ### Pony.Town v0.53.2 - Added changes from Pony.Town update v0.53.2 (https://pony.town/about) - Updated readme with further instructions on updating server and adding assets diff --git a/assets/images/logo-pt-small.png b/assets/images/logo-pt-small.png new file mode 100644 index 0000000..96f6148 --- /dev/null +++ b/assets/images/logo-pt-small.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:38d1a38b3692eeaf1eefe0a99ae61c474ba0a228c40e468cdf43c4806b04130d +size 319 diff --git a/package.json b/package.json index caa6184..5500a3e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pony-town", - "version": "0.53.2", + "version": "0.54.0", "description": "A game of ponies building a town", "main": "pony-town.js", "scripts": { diff --git a/src/ts/client/credits.ts b/src/ts/client/credits.ts index f51c229..1d2c0b2 100644 --- a/src/ts/client/credits.ts +++ b/src/ts/client/credits.ts @@ -74,6 +74,8 @@ export const CONTRIBUTORS: Contributors[] = [ { name: 'SC', links: ['https://0somecunt0.tumblr.com/tagged/sfw'] }, { name: 'SailorDolpin', links: ['https://vk.com/id324582699'] }, { name: 'Deeraw', links: ['https://www.deviantart.com/deerdraw', 'https://twitter.com/TheOnlyDeeraw'] }, + { name: 'Aviivix' }, + { name: 'SnowFl8keAnge1' }, ], }, ]; diff --git a/src/ts/client/draw.ts b/src/ts/client/draw.ts index 9435d89..89bb8fe 100644 --- a/src/ts/client/draw.ts +++ b/src/ts/client/draw.ts @@ -27,6 +27,7 @@ function drawEntities(batch: PaletteSpriteBatch, entities: Entity[], camera: Cam batch.depth = depth; if (entity.type === PONY_TYPE) { + batch.depth = -batch.depth; drawPonyEntity(batch, entity as Pony, options); entitiesDrawn++; } else if (entity.draw !== undefined) { diff --git a/src/ts/client/game.ts b/src/ts/client/game.ts index cd35197..b762e01 100644 --- a/src/ts/client/game.ts +++ b/src/ts/client/game.ts @@ -1738,8 +1738,8 @@ export class PonyTownGame implements Game { } else { disposeFrameBuffer(gl, frameBuffer); disposeFrameBuffer(gl, frameBuffer2); - createFrameBuffer(gl, frameBuffer, width, height, false, useDepthBuffer, null); - createFrameBuffer(gl, frameBuffer2, width, height, false, false, frameBuffer.depthStencilRenderbuffer); + createFrameBuffer(gl, frameBuffer, width, height, useDepthBuffer, null); + createFrameBuffer(gl, frameBuffer2, width, height, false, frameBuffer.depthStencilRenderbuffer); } } } diff --git a/src/ts/client/webgl.ts b/src/ts/client/webgl.ts index 564ff2c..85202c0 100644 --- a/src/ts/client/webgl.ts +++ b/src/ts/client/webgl.ts @@ -66,8 +66,8 @@ export function initWebGLResources(gl: WebGLRenderingContext, paletteManager: Pa gl.disable(gl.DITHER); try { - createFrameBuffer(gl, frameBuffer, camera.w, camera.h, false, true, null); - createFrameBuffer(gl, frameBuffer2, camera.w, camera.h, true, false, frameBuffer.depthStencilRenderbuffer); + createFrameBuffer(gl, frameBuffer, camera.w, camera.h, true, null); + createFrameBuffer(gl, frameBuffer2, camera.w, camera.h, false, frameBuffer.depthStencilRenderbuffer); } catch (e) { DEVELOPMENT && console.warn(e); failedFBO = true; diff --git a/src/ts/common/interfaces.ts b/src/ts/common/interfaces.ts index 71a5f9f..ed2368b 100644 --- a/src/ts/common/interfaces.ts +++ b/src/ts/common/interfaces.ts @@ -128,6 +128,7 @@ export interface PaletteSpriteBatch extends SpriteBatchCommons { sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number ): void; drawSprite(sprite: Sprite, color: number, palette: Palette | undefined, x: number, y: number): void; + patchBatchDepth(batch: Batch): void; } export function isPaletteSpriteBatch(batch: SpriteBatch | PaletteSpriteBatch): batch is PaletteSpriteBatch { diff --git a/src/ts/common/pony.ts b/src/ts/common/pony.ts index 13c0cbf..6aa266e 100644 --- a/src/ts/common/pony.ts +++ b/src/ts/common/pony.ts @@ -260,6 +260,7 @@ export function drawPonyEntity(batch: PaletteSpriteBatch, pony: Pony, drawOption } if (pony.batch !== undefined) { + batch.patchBatchDepth(pony.batch); batch.drawBatch(pony.batch); } else if (pony.palettePonyInfo !== undefined) { let swimming = false; diff --git a/src/ts/components/shared/action-bar/action-bar.pug b/src/ts/components/shared/action-bar/action-bar.pug index a03f988..a3a1ff7 100644 --- a/src/ts/components/shared/action-bar/action-bar.pug +++ b/src/ts/components/shared/action-bar/action-bar.pug @@ -1,5 +1,5 @@ ng-template(#actionsModal) - actions-modal((close)="closeActions()" [focusTrap]="true" (keydown)="$event.stopPropagation()") + actions-modal((close)="closeActions()" (notify)="actionsModalNotify()" (keydown)="$event.stopPropagation()") .action-bar( [class.has-scroller]="hasScroller" [class.is-mobile]="mobile" [class.is-blurred]="blurred" diff --git a/src/ts/components/shared/action-bar/action-bar.ts b/src/ts/components/shared/action-bar/action-bar.ts index f110988..3231b09 100644 --- a/src/ts/components/shared/action-bar/action-bar.ts +++ b/src/ts/components/shared/action-bar/action-bar.ts @@ -23,6 +23,7 @@ export class ActionBar { shortcuts = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=']; private modalRef?: BsModalRef; private _editable = false; + private isWaitingForActionsModal = false; constructor(private game: PonyTownGame, private settings: SettingsService, private modalService: BsModalService) { } @Input() get editable() { @@ -74,19 +75,32 @@ export class ActionBar { } } openActions() { + if (this.isWaitingForActionsModal) { + return; + } + if (this.modalRef) { this.closeActions(); } else { + this.isWaitingForActionsModal = true; this.modalRef = this.modalService.show(this.actionsModal, { ignoreBackdropClick: true }); } } closeActions() { + if (this.isWaitingForActionsModal) { + return; + } + if (this.modalRef) { + this.isWaitingForActionsModal = true; this.modalRef.hide(); this.modalRef = undefined; } } + actionsModalNotify() { + this.isWaitingForActionsModal = false; + } private updateFreeSlots() { const actions = this.actions; diff --git a/src/ts/components/shared/actions-modal/actions-modal.ts b/src/ts/components/shared/actions-modal/actions-modal.ts index c151994..71cc9a9 100644 --- a/src/ts/components/shared/actions-modal/actions-modal.ts +++ b/src/ts/components/shared/actions-modal/actions-modal.ts @@ -35,6 +35,7 @@ export class ActionsModal implements OnInit, OnDestroy { readonly devIcon = faCogs; readonly dev = BETA; @Output() close = new EventEmitter(); + @Output() notify = new EventEmitter(); actions = createButtionActionActions(); commands = createButtonCommandActions(); emoteAction = expressionButtonAction(createExpression(Eye.Neutral, Eye.Neutral, Muzzle.Smile)); @@ -83,12 +84,17 @@ export class ActionsModal implements OnInit, OnDestroy { if (BETA) { this.entityActions = getEntityNames().map(name => entityButtonAction(name)); } + + // not using timeout here causes some event ordering issues on mobile devices, and the modal stucks being open + // in case it still happens on some devices (unlikely), would make sense to increse the delay + setTimeout(() => this.notify.emit(), 250); } ngOnDestroy() { document.body.classList.remove('actions-modal-opened'); this.game.editingActions = false; clearInterval(this.interval); this.subscription && this.subscription.unsubscribe(); + this.notify.emit(); } ok() { this.close.emit(); diff --git a/src/ts/components/shared/visit-pt-button/visit-pt-button.pug b/src/ts/components/shared/visit-pt-button/visit-pt-button.pug index 75ea6b9..a2be8c5 100644 --- a/src/ts/components/shared/visit-pt-button/visit-pt-button.pug +++ b/src/ts/components/shared/visit-pt-button/visit-pt-button.pug @@ -2,7 +2,7 @@ a.btn.btn-lg.btn-pt.btn-outline-primary.btn-block.mb-2( *ngIf="enableVisitPTButton" (mouseenter)="pony.select()" (mouseout)="pony.reset()" [href]="ptLink" target="_blank" rel="noopener noreferrer") .pt-logo - img.pixelart.logo(revSrc="images/logo-small.png") + img.pixelart.logo(revSrc="images/logo-pt-small.png") | {{'Visit Pony Town main server!'}} .visit-pt-pony visit-pt-pony(#pony [scale]="2") diff --git a/src/ts/graphics/contextSpriteBatch.ts b/src/ts/graphics/contextSpriteBatch.ts index 59330b9..d5e7bd3 100644 --- a/src/ts/graphics/contextSpriteBatch.ts +++ b/src/ts/graphics/contextSpriteBatch.ts @@ -1,4 +1,4 @@ -import { PaletteSpriteBatch, Sprite, Palette, SpriteBatch, SpriteSheet, Matrix2D } from '../common/interfaces'; +import { PaletteSpriteBatch, Sprite, Palette, SpriteBatch, SpriteSheet, Matrix2D, Batch } from '../common/interfaces'; import { createCanvas } from '../client/canvasUtils'; import { colorToRGBA, getR, getG, getB, getAlpha } from '../common/color'; import { BaseStateBatch } from './baseStateBatch'; @@ -140,6 +140,8 @@ export class ContextSpriteBatch extends BaseStateBatch implements PaletteSpriteB } flush() { } + patchBatchDepth(_batch : Batch) { + } } const min = Math.min; diff --git a/src/ts/graphics/paletteSpriteBatch.ts b/src/ts/graphics/paletteSpriteBatch.ts index 8ec427a..64dd55d 100644 --- a/src/ts/graphics/paletteSpriteBatch.ts +++ b/src/ts/graphics/paletteSpriteBatch.ts @@ -1,4 +1,4 @@ -import { Sprite, Palette, PaletteSpriteBatch as IPaletteSpriteBatch, Matrix2D } from '../common/interfaces'; +import { Sprite, Palette, PaletteSpriteBatch as IPaletteSpriteBatch, Matrix2D, Batch } from '../common/interfaces'; import { BaseSpriteBatch, getColorFloat } from './baseSpriteBatch'; import { colorFromRGBA, colorToFloat } from '../common/color'; import { createSprite } from '../client/spriteUtils'; @@ -237,4 +237,9 @@ export class PaletteSpriteBatch extends BaseSpriteBatch implements IPaletteSprit } } } + patchBatchDepth(batch: Batch) { + for (let i = 0; i < batch.length; i += 9) { + batch[i + 2] = this.depth; + } + } } diff --git a/src/ts/graphics/shaders/palette-layers.glsl b/src/ts/graphics/shaders/palette-layers.glsl index 9c97173..52a13b2 100644 --- a/src/ts/graphics/shaders/palette-layers.glsl +++ b/src/ts/graphics/shaders/palette-layers.glsl @@ -23,7 +23,10 @@ void main() { vColor1 = vertexColor1; float depth = position.z; #ifdef DEPTH_BUFFERED - if (vColor.a < 0.975) { + if (depth < 0.0) { + depth = -depth; + } + else if (vColor.a < 0.975) { depth = 0.0; } #endif diff --git a/src/ts/graphics/webgl/frameBuffer.ts b/src/ts/graphics/webgl/frameBuffer.ts index fde9691..47f0520 100644 --- a/src/ts/graphics/webgl/frameBuffer.ts +++ b/src/ts/graphics/webgl/frameBuffer.ts @@ -10,7 +10,7 @@ export interface FrameBuffer { } export function createFrameBuffer( - gl: WebGLRenderingContext, target: FrameBuffer, width: number, height: number, useLinearMagnify: boolean, + gl: WebGLRenderingContext, target: FrameBuffer, width: number, height: number, createDepthStencil: boolean, depthStencilRenderbuffer: WebGLRenderbuffer | null ) { const handle = gl.createFramebuffer(); @@ -18,7 +18,7 @@ export function createFrameBuffer( throw new Error('Failed to create frame buffer'); } - const resources = createFrameBufferResources(gl, width, height, createDepthStencil, useLinearMagnify); + const resources = createFrameBufferResources(gl, width, height, createDepthStencil); target.handle = handle; target.colorTexture = resources.colorTexture; target.depthStencilRenderbuffer = resources.depthStencilRenderbuffer; @@ -77,15 +77,12 @@ function bindFrameBufferAttachments(gl: WebGLRenderingContext, { colorTexture, d } function createFrameBufferResources( - gl: WebGLRenderingContext, width: number, height: number, createDepthBuffer: boolean, useLinearMagnify: boolean + gl: WebGLRenderingContext, width: number, height: number, createDepthBuffer: boolean ) { const colorTexture = createEmptyTexture(gl, false, width, height, gl.RGB); if (!colorTexture) { throw new Error('Failed to create frame buffer\'s color texture'); } - if (useLinearMagnify) { - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); - } let depthStencilRenderbuffer: WebGLRenderbuffer | null = null; if (createDepthBuffer) {