removed unused processesseessess
This commit is contained in:
parent
348f355eb2
commit
4fdc567e08
158 changed files with 1317 additions and 3351 deletions
|
|
@ -12,6 +12,10 @@
|
|||
BINARY_SCHEMA_VERSION,
|
||||
FIELD_IDS,
|
||||
GROUND_IDS,
|
||||
MOOD_IDS,
|
||||
LEGACY_MOOD_IDS,
|
||||
canonicalMoodId,
|
||||
enumIndex,
|
||||
ITEM_TYPE_IDS,
|
||||
STRUCTURE_TYPE_IDS,
|
||||
SERVING_FOOD_TYPE_IDS,
|
||||
|
|
@ -249,15 +253,7 @@
|
|||
return bytes;
|
||||
}
|
||||
|
||||
function writeFixed(writer, arr = [], count = 0, signed = true) {
|
||||
for (let i = 0; i < count; i++) signed ? writer.s(arr[i] || 0) : writer.u(arr[i] || 0);
|
||||
}
|
||||
function readFixed(reader, count = 0, signed = true) {
|
||||
const out = [];
|
||||
for (let i = 0; i < count; i++) out.push(signed ? reader.s() : reader.u());
|
||||
return out;
|
||||
}
|
||||
function writeFixedPacked(writer, arr = [], count = 0, bits = 8, step = 1) {
|
||||
function writeFixedPacked(writer, arr = [], count = 0, bits = 8, step = 1) {
|
||||
writeQuantizedBitFields(writer, arr, count, bits, step);
|
||||
}
|
||||
function readFixedPacked(reader, count = 0, bits = 8, step = 1) {
|
||||
|
|
@ -298,57 +294,8 @@
|
|||
return out;
|
||||
}
|
||||
|
||||
function generatedNameCode(value = "") {
|
||||
const name = String(value || "");
|
||||
if (!name.startsWith("\u306f")) return -1;
|
||||
const stop = name.endsWith("\u3063");
|
||||
const core = name.slice(1, stop ? -1 : undefined);
|
||||
if (core.length > 6) return -1;
|
||||
let bits = 0;
|
||||
for (let i = 0; i < core.length; i++) {
|
||||
const ch = core.charAt(i);
|
||||
if (ch !== "\u3046" && ch !== "\u3045") return -1;
|
||||
if (ch === "\u3045") bits |= (1 << i);
|
||||
}
|
||||
return core.length | (stop ? 8 : 0) | (bits << 4);
|
||||
}
|
||||
function nameFromGeneratedCode(code = 0) {
|
||||
const middleLen = code & 7;
|
||||
const stop = !!(code & 8);
|
||||
const bits = code >> 4;
|
||||
let name = "\u306f";
|
||||
for (let i = 0; i < middleLen; i++) name += (bits & (1 << i)) ? "\u3045" : "\u3046";
|
||||
if (stop) name += "\u3063";
|
||||
return name;
|
||||
}
|
||||
function writeName(writer, value = "") {
|
||||
const code = generatedNameCode(value);
|
||||
if (code >= 0) {
|
||||
writer.u(code + 1);
|
||||
return;
|
||||
}
|
||||
writer.u(0);
|
||||
writer.str(value || "");
|
||||
}
|
||||
function readName(reader) {
|
||||
const code = reader.u();
|
||||
if (code > 0) return nameFromGeneratedCode(code - 1);
|
||||
return reader.str();
|
||||
}
|
||||
function valuesDiffer(a, b) { return (Number(a) || 0) !== (Number(b) || 0); }
|
||||
function writeFixedDiff(writer, base = [], current = [], count = 0, signed = false) {
|
||||
let mask = 0;
|
||||
for (let i = 0; i < count; i++) if (valuesDiffer(current?.[i], base?.[i])) mask |= (1 << i);
|
||||
writer.u(mask);
|
||||
for (let i = 0; i < count; i++) if (mask & (1 << i)) signed ? writer.s(current[i] || 0) : writer.u(current[i] || 0);
|
||||
}
|
||||
function readFixedDiff(reader, base = [], count = 0, signed = false) {
|
||||
const out = Array.from({ length: count }, (_, i) => base?.[i] || 0);
|
||||
const mask = reader.u();
|
||||
for (let i = 0; i < count; i++) if (mask & (1 << i)) out[i] = signed ? reader.s() : reader.u();
|
||||
return out;
|
||||
}
|
||||
function writeTimers(writer, timers = []) {
|
||||
function valuesDiffer(a, b) { return (Number(a) || 0) !== (Number(b) || 0); }
|
||||
function writeTimers(writer, timers = []) {
|
||||
const defaults = [0, 0, 0, 0, 0, 0, 0, 0, 100];
|
||||
let mask = 0;
|
||||
for (let i = 0; i < defaults.length; i++) if (valuesDiffer(timers?.[i], defaults[i])) mask |= (1 << i);
|
||||
|
|
@ -407,7 +354,7 @@
|
|||
function seedPersonalityArray(seed = "", flags = 0) {
|
||||
// \u305a\u3093\u3061\u3069\u308c\u3044\u306f\u8a95\u751f\u6642\u6027\u683c\u3082\u5168\u8ef8 -1 \u306a\u306e\u3067\u3001\u5dee\u5206\u57fa\u6e96\u30820\u56fa\u5b9a\u306b\u3059\u308b\u3002
|
||||
if ((Number(flags) || 0) & (1 << 5)) return [0, 0, 0, 0];
|
||||
return global.TarinaiSeedFactory?.personalityArray?.(seed) || [100, 100, 100, 100];
|
||||
return global.TarinaiSeedFactory.personalityArray(seed) || [100, 100, 100, 100];
|
||||
}
|
||||
|
||||
function writeTarinai(writer, row = [], coordState = null) {
|
||||
|
|
@ -618,10 +565,14 @@
|
|||
function decodeBinarySnapshot(bytes) {
|
||||
const reader = new BinaryReader(bytes);
|
||||
const schema = reader.b();
|
||||
if (schema !== BINARY_SCHEMA_VERSION) throw new Error("unsupported binary save schema");
|
||||
if (schema !== BINARY_SCHEMA_VERSION && schema !== 15) throw new Error("unsupported binary save schema");
|
||||
const snapshotVersion = reader.u();
|
||||
if (snapshotVersion !== Snapshot.version) throw new Error("unsupported binary save version");
|
||||
if (snapshotVersion !== Snapshot.version && snapshotVersion !== 11) throw new Error("unsupported binary save version");
|
||||
const w = readWorld(reader);
|
||||
if (schema === 15) {
|
||||
const legacyMood = LEGACY_MOOD_IDS?.[Number(w[2]) | 0] || "relaxed";
|
||||
w[2] = enumIndex(MOOD_IDS, canonicalMoodId?.(legacyMood) || "relaxed");
|
||||
}
|
||||
const tCount = reader.u();
|
||||
const t = [];
|
||||
const tarCoordState = { x: 0, y: 0 };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue