Nylilsa / nylilsa.github.io

3 stars 0 forks source link

ECLmap and truthmap for current code #8

Closed Nylilsa closed 12 months ago

Nylilsa commented 2 years ago

like in priw's site, use some kind of eclmap/trueclmap that does regex magic to a page for consistent function names

also pls decide to whether use truth or thecl

Nylilsa commented 1 year ago

idea:

make a json file for each game that goes as follows:

{
    "Instructions": {
        "501": {
            "Name": "setHitbox",
            "Parameters": {
                "w": "float",
                "h": "float"
            },
            "Description": "Sets caller's hitbox width to $1 and height to $2."
        },
        "525": {
            "Name": "enmKillAll",
            "Parameters": {},
            "Description": "Kills all other enemies (unless they have a flag that prevents that set)."
        }
    },
    "Globals": {
        "-9959": {
            "Name": "DIFF",
            "Description": "Difficulty (E=0, N=1, H=2, L=3, EX=4, O=5).",
            "Type": "int"
        },
        "-9998": {
            "Name": "RANDRAD",
            "Description": "Random float from -pi to pi.",
            "Type": "float"
        }
    }
}

Here's some code I stole that I could use for the params part:


function getOpcodeTip(expr) {
    let opcode = getOpcodeByName(expr);
    if (opcode == null) return "";
    let args = "";
    let desc = opcode.description;
    for (let i=0; i<opcode.args.length; i++) {
        if (i > 0) args += ", ";
        args += ARGTYPES[opcode.args[i]] + " " + opcode.argnames[i];
        desc = desc.replace("%"+(i+1), "`"+opcode.argnames[i]+"`");
    }
    return `**${opcode.number} - ${opcode.name}(${args})**[br][hr]${desc}`;
}```

Basically I need to write some code like [ecl=501, type=Instructions] and the text is replaced by ``setHitbox`` with a tooltip if you hover over it :)
but when you run the script make sure the json is fetched once and not 10012031913 times
Nylilsa commented 12 months ago

Added as of https://github.com/Nylilsa/nylilsa.github.io/commit/b88a9974190e448f87b8807ace195a1e743c84b7