Disable mset for now

This commit is contained in:
dylan 2023-05-14 13:54:52 -07:00
parent 7b04080e9e
commit a6d093d728
4 changed files with 15 additions and 10 deletions

View File

@ -127,12 +127,13 @@ const faux = {
} }
return getMapSheet(mapSheet).get(x, y)[1]; return getMapSheet(mapSheet).get(x, y)[1];
}, },
mset: (mapSheet: number, x: number, y: number, sprSheet: number, spr: number) => { // Temporarily removing mset, since it would overwrite static cart data
if (x < 0 || x >= 64 || y < 0 || y >= 64) { // mset: (mapSheet: number, x: number, y: number, sprSheet: number, spr: number) => {
return; // if (x < 0 || x >= 64 || y < 0 || y >= 64) {
} // return;
getMapSheet(mapSheet).set(x, y, [sprSheet, spr]); // }
}, // getMapSheet(mapSheet).set(x, y, [sprSheet, spr]);
// },
// Input // Input
[CHAR.UP]: K.ARROW_UP, [CHAR.UP]: K.ARROW_UP,
[CHAR.DOWN]: K.ARROW_DOWN, [CHAR.DOWN]: K.ARROW_DOWN,

View File

@ -2,7 +2,8 @@ import { path } from "./deps.ts";
import initialCart from "./initialCart.json" assert { type: "json" }; import initialCart from "./initialCart.json" assert { type: "json" };
import { Sheet } from "./sheet.ts"; import { Sheet } from "./sheet.ts";
let cart = initialCart as Array<Sheet>; let staticCart = initialCart as Array<Sheet>;
let cart: Array<Sheet> = JSON.parse(JSON.stringify(staticCart));
const virtualPathToRealPath = (virtualFname: string) => { const virtualPathToRealPath = (virtualFname: string) => {
const realPath = path.join(".", "carts", ...virtualFname.split("/")); const realPath = path.join(".", "carts", ...virtualFname.split("/"));
@ -14,7 +15,9 @@ export const saveCart = async (fname: string) => {
} }
export const loadCart = async (fname: string) => { export const loadCart = async (fname: string) => {
cart = JSON.parse(await Deno.readTextFile(virtualPathToRealPath(fname+".fx"))); const json = await Deno.readTextFile(virtualPathToRealPath(fname+".fx"));
staticCart = JSON.parse(json);
cart = JSON.parse(json);
} }
export const getCart = () => { export const getCart = () => {

View File

@ -51,7 +51,7 @@ And math symbols:
- `mgetsht(mapSheet: number, x: number, y: number)` returns the sheet number of the sprite at tile (x,y) in the given map - `mgetsht(mapSheet: number, x: number, y: number)` returns the sheet number of the sprite at tile (x,y) in the given map
- `mgetspr(mapSheet: number, x: number, y: number)` returns the sprite number within it's sheet of the sprite at tile (x,y) in the given map - `mgetspr(mapSheet: number, x: number, y: number)` returns the sprite number within it's sheet of the sprite at tile (x,y) in the given map
- `mset(mapSheet: number, x: number, y: number, sprSheet: number, spr: number)` sets the sprite at tile (x,y) in the given map to the given sprite of the given spritesheet. - `mset(mapSheet: number, x: number, y: number, sprSheet: number, spr: number)` sets the sprite at tile (x,y) in the given map to the given sprite of the given spritesheet. **(THIS FUNCTION IS TEMPORARILY UNAVAILABLE.)**
### Input ### Input

View File

@ -18,7 +18,7 @@ export type Sheet = {
} }
export type SheetType = Sheet["sheet_type"]; export type SheetType = Sheet["sheet_type"];
export const getSheet = (n: number) => { export const getSheet = (n: number): Sheet => {
return getCart()[n]; return getCart()[n];
} }
@ -51,5 +51,6 @@ export const getMapSheet = (sheet: number) => {
if (sheet_type !== "map") { if (sheet_type !== "map") {
throw "Trying to use a non-map sheet as a map." throw "Trying to use a non-map sheet as a map."
} }
sheet_type
return LinearGrid(value, 64); return LinearGrid(value, 64);
} }