Add default config

It'll be copied to `config.js` if that file doesn't exist.
SHOULD NOT BE EDITED!
This commit is contained in:
Lordmau5 2020-05-21 15:16:28 +02:00
parent c6be5491d4
commit 25cde2a22e
4 changed files with 87 additions and 47 deletions

2
.gitignore vendored
View File

@ -1,5 +1,7 @@
# Custom # Custom
config.js
character_character_data.bin character_character_data.bin
character_model_model_data.bin
# ---> Node # ---> Node
# Logs # Logs

Binary file not shown.

View File

@ -3,7 +3,7 @@
// 0 = Everyone is one model (singleModel) // 0 = Everyone is one model (singleModel)
// 1 = Everyone has a random model from a list (randomModels) // 1 = Everyone has a random model from a list (randomModels)
// 2 = Everyone is a completely random model // 2 = Everyone is a completely random model
const mode = 0; const mode = 2;
// Should we try to make sure models are replaced // Should we try to make sure models are replaced
// with another one of the same "type"? (2nd byte) // with another one of the same "type"? (2nd byte)
@ -12,12 +12,29 @@ const sameType = false;
// Singular model to replace when mode is 0 // Singular model to replace when mode is 0
// //
// Example: [0x71, 0x08] for Kiryu // Example: [0x71, 0x08] for Kiryu
// const singleModel = [0x71, 0x08];
const singleModel = [0x71, 0x08]; const singleModel = [0x71, 0x08];
// List of models to choose randomly from when mode is 1 // List of models to choose randomly from when mode is 1
const randomModels = [ const randomModels = [
[0x71, 0x08], [0x71, 0x08],
[0x72, 0x08], [0x72, 0x08],
[0x81, 0x08],
[0x75, 0x08],
[0x7d, 0x08],
[0x77, 0x08],
[0x7b, 0x08],
[0x7a, 0x08],
[0x78, 0x08],
[0x79, 0x08],
[0x73, 0x08],
[0x7f, 0x08],
[0x7e, 0x08],
[0x7c, 0x08],
[0x82, 0x08],
[0x76, 0x08],
[0x80, 0x08],
[0x83, 0x08],
]; ];
// List of base models to exclude from modifications // List of base models to exclude from modifications
@ -25,10 +42,7 @@ const randomModels = [
// //
// Example: If Kiryu's base model is found it will never be changed // Example: If Kiryu's base model is found it will never be changed
// That means Kiryu can't be set to Daigo, but Daigo can still be set to Kiryu // That means Kiryu can't be set to Daigo, but Daigo can still be set to Kiryu
const excludedModels = [ const excludedModels = [];
[0xb6, 0x08],
[0xb3, 0x08],
];
// Blacklist to prevent models from appearing // Blacklist to prevent models from appearing
// Can also act as a whitelist so *only* those models will appear // Can also act as a whitelist so *only* those models will appear

View File

@ -3,6 +3,11 @@
const fs = require("fs"); const fs = require("fs");
const _ = require("underscore"); const _ = require("underscore");
const { allTypes, shuffledModels } = require("./models"); const { allTypes, shuffledModels } = require("./models");
if (!fs.existsSync("config.js")) {
fs.writeFileSync("config.js", fs.readFileSync("config.default.js"));
}
const { const {
mode, mode,
sameType, sameType,
@ -31,24 +36,25 @@ function isModelExcluded(fb, sb) {
// Check if a model is blacklisted // Check if a model is blacklisted
function isModelBlacklisted(fb, sb) { function isModelBlacklisted(fb, sb) {
for (let i = 0; i < blacklistedModels.length; i++) { for (let i = 0; i < blacklist.models.length; i++) {
const model = blacklistedModels[i]; const model = blacklist.models[i];
if ( if (
(model[0] === fb && model[1] === -1) || (model[0] === fb && model[1] === -1) ||
(model[0] === -1 && model[1] === sb) (model[0] === -1 && model[1] === sb)
) { ) {
return blacklist.isWhitelist;
} else if (model[0] === fb && model[1] === sb) {
return blacklist.isWhitelist;
}
}
return !blacklist.isWhitelist; return !blacklist.isWhitelist;
} else if (model[0] === fb && model[1] === sb) {
return !blacklist.isWhitelist;
}
}
return blacklist.isWhitelist;
} }
function replaceModels() { function replaceModels(doReplace = true) {
const data = fs.readFileSync("character_character_data.bin.orig"); const data = fs.readFileSync("character_character_data.bin.orig");
if (doReplace) {
// Magic // Magic
if (mode === 0) { if (mode === 0) {
for (let i = 0x16194; i < 0x18ea8; i += 4) { for (let i = 0x16194; i < 0x18ea8; i += 4) {
@ -88,10 +94,28 @@ function replaceModels() {
data[i + 1] = type; data[i + 1] = type;
} }
} }
// ----- // -----
}
fs.writeFileSync("character_character_data.bin", data); fs.writeFileSync("character_character_data.bin", data);
} }
// TODO: Create a reverse-lookup map of some sort to fit the proper model height with other models?
// Only does scaling, so not that needed apparently...
function replaceHeights(doReplace = true) {
const data = fs.readFileSync("character_model_model_data.bin.orig");
if (doReplace) {
// Magic
for (let i = 0x23220; i < 0x24910; i += 2) {
data[i] = 0xb9;
data[i + 1] = 0x00;
}
// -----
}
fs.writeFileSync("character_model_model_data.bin", data);
}
replaceModels(); replaceModels();
replaceHeights(false);