removed unused processesseessess
This commit is contained in:
parent
348f355eb2
commit
4fdc567e08
158 changed files with 1317 additions and 3351 deletions
|
|
@ -9,7 +9,7 @@
|
|||
if (worldRef.selected === tarinai || tarinai.favorite) return true;
|
||||
if ((tarinai.hurtTimer || 0) > 0.04 || (tarinai.eatTimer || 0) > 0.02 || (tarinai.pokeFlashTimer || 0) > 0.03) return true;
|
||||
if ((tarinai.focusPulseTimer || 0) > 0.04 || tarinai.state === "cursor_friend" || tarinai.state === "cursor_enemy") return true;
|
||||
const tier = window.TarinaiPerf?.renderQualityTier?.() || "high";
|
||||
const tier = window.TarinaiPerf.renderQualityTier() || "high";
|
||||
if (tier === "low") return false;
|
||||
if (tier === "mid") {
|
||||
const p = worldRef.pointer;
|
||||
|
|
@ -27,14 +27,8 @@
|
|||
this.preloadSunbathSprites?.();
|
||||
const ids = this.sunbathSpriteCandidates ? this.sunbathSpriteCandidates() : ["sunbath_1", "sunbath_2", "sunbath_3"];
|
||||
const candidates = (Array.isArray(ids) && ids.length ? ids : ["sunbath_1", "sunbath_2", "sunbath_3"]).filter(id => String(id || "").startsWith("sunbath"));
|
||||
const ready = (id) => typeof isImageReady === "function"
|
||||
? isImageReady(id)
|
||||
: !!(typeof images !== "undefined" && images?.get?.(id)?.complete && (images?.get?.(id)?.naturalWidth || images?.get?.(id)?.width));
|
||||
const imageFor = (id) => {
|
||||
if (!id) return null;
|
||||
if (typeof getRenderableImage === "function") return getRenderableImage(id, "");
|
||||
return (typeof images !== "undefined" ? images.get?.(id) : globalThis.TarinaiAssets?.images?.get?.(id)) || null;
|
||||
};
|
||||
const ready = (id) => isImageReady(id);
|
||||
const imageFor = (id) => id ? getRenderableImage(id, "") : null;
|
||||
|
||||
let requested = this.sunbathSpriteId ? this.sunbathSpriteId() : this.normalizeSunbathSpriteId?.(this.sunbathSpriteVariant);
|
||||
if (!requested || !candidates.includes(requested)) requested = candidates[0] || "sunbath_1";
|
||||
|
|
@ -54,14 +48,10 @@
|
|||
} else {
|
||||
const fallbackId = this._lastNonSunbathSpriteId || this.goodMode || this.type || "smile";
|
||||
renderSprite = fallbackId;
|
||||
img = typeof getRenderableImage === "function"
|
||||
? getRenderableImage(fallbackId, "smile")
|
||||
: (typeof images !== "undefined" ? (images.get?.(fallbackId) || images.get?.("smile")) : null);
|
||||
img = getRenderableImage(fallbackId, "smile");
|
||||
if (!img) {
|
||||
renderSprite = "smile";
|
||||
img = typeof getRenderableImage === "function"
|
||||
? getRenderableImage("smile", "smile")
|
||||
: (typeof images !== "undefined" ? images.get?.("smile") : null);
|
||||
img = getRenderableImage("smile", "smile");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -157,17 +147,14 @@
|
|||
const sunbathSprite = String(sprite || "").startsWith("sunbath");
|
||||
const sunbathCandidates = sunbathSprite && this.sunbathSpriteCandidates ? this.sunbathSpriteCandidates() : [];
|
||||
if (sunbathSprite) {
|
||||
for (const id of sunbathCandidates) {
|
||||
if (typeof ensureImage === "function") ensureImage(id);
|
||||
else if (globalThis.TarinaiAssets?.ensureImage) globalThis.TarinaiAssets.ensureImage(id);
|
||||
}
|
||||
for (const id of sunbathCandidates) ensureImage(id);
|
||||
}
|
||||
const spriteFallback = "smile";
|
||||
let renderSprite = sprite;
|
||||
let img = typeof getRenderableImage === "function" ? getRenderableImage(sprite, spriteFallback) : (images.get(sprite) || images.get(spriteFallback) || images.get(this.type));
|
||||
let img = getRenderableImage(sprite, spriteFallback);
|
||||
if (sunbathSprite) {
|
||||
const ready = (id) => typeof isImageReady === "function" ? isImageReady(id) : !!(images?.get?.(id)?.complete || images?.get?.(id)?.naturalWidth || images?.get?.(id)?.width);
|
||||
const imageFor = (id) => (typeof images !== "undefined" ? images.get?.(id) : globalThis.TarinaiAssets?.images?.get?.(id)) || null;
|
||||
const ready = (id) => isImageReady(id);
|
||||
const imageFor = (id) => images.get(id) || null;
|
||||
if (ready(sprite)) {
|
||||
this._lastRenderableSunbathSpriteId = sprite;
|
||||
} else {
|
||||
|
|
@ -184,7 +171,7 @@
|
|||
renderSprite = this._lastRenderableSunbathSpriteId;
|
||||
img = imageFor(this._lastRenderableSunbathSpriteId);
|
||||
}
|
||||
if (!img) img = typeof getRenderableImage === "function" ? getRenderableImage("smile", "smile") : (images.get("smile") || images.get(this.type));
|
||||
if (!img) img = getRenderableImage("smile", "smile");
|
||||
}
|
||||
const metrics = getImageMetrics(renderSprite) || getImageMetrics(sprite) || getImageMetrics(this.type) || getImageMetrics("smile");
|
||||
const w = metrics?.w || 512;
|
||||
|
|
@ -435,13 +422,13 @@
|
|||
const dh = drawH / squish;
|
||||
const brightness = clamp(0.82 + lightState.light * 0.30 + lightState.dawnStrength * 0.08 + lightState.goldenStrength * 0.06 + lightState.noonStrength * 0.04, 0.80, 1.17);
|
||||
const saturation = clamp(0.86 + lightState.light * 0.22 + lightState.goldenStrength * 0.10 - lightState.nightStrength * 0.04, 0.82, 1.14);
|
||||
const renderScale = typeof SPRITE_CACHE_SCALE === "number" ? SPRITE_CACHE_SCALE : 2.0;
|
||||
const renderScale = SPRITE_CACHE_SCALE;
|
||||
const cacheW = Math.max(1, Math.round((dw * renderScale) / 8) * 8);
|
||||
const cacheH = Math.max(1, Math.round((dh * renderScale) / 8) * 8);
|
||||
if (img) {
|
||||
let spriteCacheKey = renderSprite || sprite;
|
||||
try {
|
||||
if (typeof images !== "undefined" && images.get?.(renderSprite || sprite) !== img) {
|
||||
if (images.get(renderSprite || sprite) !== img) {
|
||||
let fallbackId = "fallback";
|
||||
for (const [imageId, imageObj] of images) {
|
||||
if (imageObj === img) { fallbackId = imageId; break; }
|
||||
|
|
@ -451,7 +438,7 @@
|
|||
} catch (err) {
|
||||
spriteCacheKey = renderSprite || sprite;
|
||||
}
|
||||
const spriteCanvas = typeof getCachedSpriteCanvas === "function" ? getCachedSpriteCanvas(spriteCacheKey, img, cacheW, cacheH) : img;
|
||||
const spriteCanvas = getCachedSpriteCanvas(spriteCacheKey, img, cacheW, cacheH);
|
||||
ctx.drawImage(spriteCanvas, -dw / 2, -dh / 2, dw, dh);
|
||||
} else {
|
||||
ctx.save();
|
||||
|
|
@ -464,7 +451,7 @@
|
|||
ctx.stroke();
|
||||
ctx.restore();
|
||||
}
|
||||
if (img && (this.zunchiStain || 0) > 3 && typeof getCachedStainOverlayCanvas === "function") {
|
||||
if (img && (this.zunchiStain || 0) > 3) {
|
||||
const stainCanvas = getCachedStainOverlayCanvas(renderSprite || sprite, img, cacheW, cacheH, clamp((this.zunchiStain || 0) / 100, 0, 1), this.zunchiStainSeed || 0.5);
|
||||
if (stainCanvas) {
|
||||
ctx.save();
|
||||
|
|
@ -474,7 +461,7 @@
|
|||
}
|
||||
}
|
||||
if (String(sprite || "").startsWith("zunchi_slave")) {
|
||||
const zImg = typeof getRenderableImage === "function" ? getRenderableImage("zunchi", "zunchi") : (images && images.get ? images.get("zunchi") : null);
|
||||
const zImg = getRenderableImage("zunchi", "zunchi");
|
||||
if (zImg) {
|
||||
ctx.save();
|
||||
ctx.shadowColor = "rgba(46, 36, 24, 0.28)";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue