Merge branch 'archive' into archive-update-v0.54.0

This commit is contained in:
Eliot Partridge
2019-09-21 22:48:14 -05:00
18 changed files with 62 additions and 16 deletions
+2
View File
@@ -127,6 +127,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' },
],
},
];
+1
View File
@@ -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) {
+2 -2
View File
@@ -1740,8 +1740,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);
}
}
}
+2 -2
View File
@@ -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;
+1
View File
@@ -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 {
+1
View File
@@ -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;
@@ -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"
@@ -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;
@@ -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();
@@ -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")
+3 -1
View File
@@ -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;
+6 -1
View File
@@ -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;
}
}
}
+4 -1
View File
@@ -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
+3 -6
View File
@@ -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) {