mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-24 14:06:16 -04:00
Build 29085573
This commit is contained in:
parent
a386c5f3d2
commit
66952cb1ca
6 changed files with 30 additions and 29 deletions
|
@ -1,5 +1,5 @@
|
|||
// The version of the cache.
|
||||
const VERSION = "29084606";
|
||||
const VERSION = "29085573";
|
||||
|
||||
// The name of the cache
|
||||
const CACHE_NAME = `breakout-71-${VERSION}`;
|
||||
|
|
|
@ -1 +1 @@
|
|||
"29084606"
|
||||
"29085573"
|
||||
|
|
|
@ -55,9 +55,9 @@ export function getHaloScale() {
|
|||
return 16 * (isOptionOn("precise_lighting") ? 1 : 2);
|
||||
}
|
||||
|
||||
let framesCounter=0
|
||||
let framesCounter = 0;
|
||||
export function render(gameState: GameState) {
|
||||
framesCounter++
|
||||
framesCounter++;
|
||||
startWork("render:init");
|
||||
const level = currentLevelInfo(gameState);
|
||||
|
||||
|
@ -111,15 +111,18 @@ export function render(gameState: GameState) {
|
|||
"";
|
||||
// Clear
|
||||
if (!isOptionOn("basic") && level.svg && level.color === "#000000") {
|
||||
// TODO only if many coins on screen
|
||||
const skipN = isOptionOn('probabilistic_lighting') && liveCount(gameState.coins)> 150? 3 : 0
|
||||
const shouldSkip = index=> skipN ? (framesCounter + index) % (skipN+1) !==0 : false
|
||||
const skipN =
|
||||
isOptionOn("probabilistic_lighting") && liveCount(gameState.coins) > 150
|
||||
? 3
|
||||
: 0;
|
||||
const shouldSkip = (index) =>
|
||||
skipN ? (framesCounter + index) % (skipN + 1) !== 0 : false;
|
||||
|
||||
const haloScale = getHaloScale();
|
||||
startWork("render:halo:clear");
|
||||
|
||||
haloCanvasCtx.globalCompositeOperation = "source-over";
|
||||
haloCanvasCtx.globalAlpha = skipN ? 0.1:0.99
|
||||
haloCanvasCtx.globalAlpha = skipN ? 0.1 : 0.99;
|
||||
haloCanvasCtx.fillStyle = level.color;
|
||||
haloCanvasCtx.fillRect(0, 0, width / haloScale, height / haloScale);
|
||||
|
||||
|
@ -128,8 +131,8 @@ export function render(gameState: GameState) {
|
|||
haloCanvasCtx.globalAlpha =
|
||||
0.1 + (0.5 * 10) / (liveCount(gameState.coins) + 10);
|
||||
startWork("render:halo:coins");
|
||||
forEachLiveOne(gameState.coins, (coin,index) => {
|
||||
if(shouldSkip(index)) return
|
||||
forEachLiveOne(gameState.coins, (coin, index) => {
|
||||
if (shouldSkip(index)) return;
|
||||
const color = getCoinRenderColor(gameState, coin);
|
||||
drawFuzzyBall(
|
||||
haloCanvasCtx,
|
||||
|
@ -141,8 +144,8 @@ export function render(gameState: GameState) {
|
|||
});
|
||||
|
||||
startWork("render:halo:balls");
|
||||
gameState.balls.forEach((ball,index) => {
|
||||
if(shouldSkip(index)) return
|
||||
gameState.balls.forEach((ball, index) => {
|
||||
if (shouldSkip(index)) return;
|
||||
haloCanvasCtx.globalAlpha = 0.3 * (1 - ballTransparency(ball, gameState));
|
||||
drawFuzzyBall(
|
||||
haloCanvasCtx,
|
||||
|
@ -157,7 +160,7 @@ export function render(gameState: GameState) {
|
|||
haloCanvasCtx.globalAlpha = 0.05;
|
||||
gameState.bricks.forEach((color, index) => {
|
||||
if (!color) return;
|
||||
if(shouldSkip(index)) return
|
||||
if (shouldSkip(index)) return;
|
||||
const x = brickCenterX(gameState, index),
|
||||
y = brickCenterY(gameState, index);
|
||||
drawFuzzyBall(
|
||||
|
@ -172,8 +175,8 @@ export function render(gameState: GameState) {
|
|||
|
||||
startWork("render:halo:particles");
|
||||
haloCanvasCtx.globalCompositeOperation = "screen";
|
||||
forEachLiveOne(gameState.particles, (flash,index) => {
|
||||
if(shouldSkip(index)) return
|
||||
forEachLiveOne(gameState.particles, (flash, index) => {
|
||||
if (shouldSkip(index)) return;
|
||||
const { x, y, time, color, size, duration } = flash;
|
||||
const elapsed = gameState.levelTime - time;
|
||||
haloCanvasCtx.globalAlpha =
|
||||
|
@ -577,17 +580,16 @@ export function render(gameState: GameState) {
|
|||
) {
|
||||
ctx.imageSmoothingEnabled = isOptionOn("smooth_lighting") || false;
|
||||
|
||||
if(isOptionOn('probabilistic_lighting')) {
|
||||
ctx.globalAlpha = 1;
|
||||
ctx.globalCompositeOperation = "soft-light";
|
||||
}else{
|
||||
|
||||
if (isOptionOn("probabilistic_lighting")) {
|
||||
ctx.globalAlpha = 1;
|
||||
ctx.globalCompositeOperation = "soft-light";
|
||||
} else {
|
||||
haloCanvasCtx.fillStyle = "#FFFFFF";
|
||||
haloCanvasCtx.globalAlpha = 0.25;
|
||||
haloCanvasCtx.globalCompositeOperation = "screen";
|
||||
haloCanvasCtx.fillRect(0, 0, haloCanvas.width, haloCanvas.height);
|
||||
ctx.globalAlpha = 1;
|
||||
ctx.globalCompositeOperation = "overlay";
|
||||
ctx.globalCompositeOperation = "overlay";
|
||||
}
|
||||
|
||||
ctx.drawImage(haloCanvas, 0, 0, width, height);
|
||||
|
@ -968,7 +970,7 @@ export function drawFuzzyBall(
|
|||
x: number,
|
||||
y: number,
|
||||
) {
|
||||
width=Math.max(width,2)
|
||||
width = Math.max(width, 2);
|
||||
const key = "fuzzy-circle" + color + "_" + width;
|
||||
if (!color?.startsWith("#")) debugger;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue