implemented L1, R1 and SQUARE button functionality

This commit is contained in:
ad044 2021-03-19 15:35:46 +04:00
parent f9c5a7ce69
commit c2d5337168
14 changed files with 3955 additions and 165 deletions

View file

@ -1,4 +1,4 @@
import React, { memo, useEffect, useRef } from "react"; import React, { createRef, memo, useEffect, useRef } from "react";
import { useFrame, useLoader } from "react-three-fiber"; import { useFrame, useLoader } from "react-three-fiber";
import * as THREE from "three"; import * as THREE from "three";
import bigHud from "../../static/sprites/main/big_hud.png"; import bigHud from "../../static/sprites/main/big_hud.png";
@ -11,6 +11,8 @@ import usePrevious from "../../hooks/usePrevious";
import { getNodeHud } from "../../helpers/node-helpers"; import { getNodeHud } from "../../helpers/node-helpers";
import { HUDData } from "../../types/types"; import { HUDData } from "../../types/types";
// the hud is an imperative mess. unfortunately this seems to perform by far the best out of all the approaches i've tried.
const HUD = memo(() => { const HUD = memo(() => {
const activeRef = useRef(true); const activeRef = useRef(true);
const currentHudRef = useRef( const currentHudRef = useRef(
@ -19,20 +21,36 @@ const HUD = memo(() => {
const activeNodeMatrixIndices = useStore( const activeNodeMatrixIndices = useStore(
(state) => state.activeNode.matrixIndices (state) => state.activeNode.matrixIndices
); );
const activeNode = useStore((state) => state.activeNode);
const siteRotY = useStore((state) => state.siteRot[1]); const siteRotY = useStore((state) => state.siteRot[1]);
const activeLevel = useStore((state) => state.activeLevel); const activeLevel = useStore((state) => state.activeLevel);
const subscene = useStore((state) => state.mainSubscene); const subscene = useStore((state) => state.mainSubscene);
const scene = useStore((state) => state.currentScene); const scene = useStore((state) => state.currentScene);
const prevData = usePrevious({ siteRotY, activeLevel, subscene, scene }); const protocolLinesToggled = useStore((state) => state.protocolLinesToggled);
const prevData = usePrevious({
siteRotY,
activeLevel,
subscene,
scene,
protocolLinesToggled,
});
const longHudRef = useRef<THREE.Object3D>();
const boringHudRef = useRef<THREE.Object3D>();
const bigHudRef = useRef<THREE.Object3D>();
const nodeTitleRef = useRef<THREE.Object3D>();
const protocolLine1Ref = useRef<THREE.Object3D>();
const protocolLine2Ref = useRef<THREE.Object3D>();
const protocolLine3Ref = useRef<THREE.Object3D>();
const protocolLineTitleRefs = useRef([
useRef<THREE.Object3D>(),
useRef<THREE.Object3D>(),
useRef<THREE.Object3D>(),
]);
// this part is imperative because it performs a lot better than having a toggleable spring.
useFrame(() => { useFrame(() => {
if ( if (longHudRef.current && bigHudRef.current && boringHudRef.current) {
longHudRef.current &&
bigHudRef.current &&
boringHudRef.current &&
greenTextRef.current
) {
const hud = currentHudRef.current; const hud = currentHudRef.current;
longHudRef.current.position.x = lerp( longHudRef.current.position.x = lerp(
@ -52,13 +70,6 @@ const HUD = memo(() => {
activeRef.current ? hud.big.position[0] : hud.big.initial_position[0], activeRef.current ? hud.big.position[0] : hud.big.initial_position[0],
0.12 0.12
); );
greenTextRef.current.position.x = lerp(
greenTextRef.current.position.x,
activeRef.current
? hud.medium_text.position[0]
: hud.medium_text.initial_position[0],
0.12
);
} }
}); });
@ -67,12 +78,30 @@ const HUD = memo(() => {
longHudRef.current!.scale.x = -Math.abs(longHudRef.current!.scale.x); longHudRef.current!.scale.x = -Math.abs(longHudRef.current!.scale.x);
boringHudRef.current!.scale.x = -Math.abs(boringHudRef.current!.scale.x); boringHudRef.current!.scale.x = -Math.abs(boringHudRef.current!.scale.x);
bigHudRef.current!.scale.x = -Math.abs(bigHudRef.current!.scale.x); bigHudRef.current!.scale.x = -Math.abs(bigHudRef.current!.scale.x);
nodeTitleRef.current!.scale.x = -Math.abs(nodeTitleRef.current!.scale.x);
nodeTitleRef.current!.position.x = 0.2;
if (protocolLinesToggled) {
protocolLineTitleRefs.current.forEach((ref) => {
ref.current!.scale.x = -Math.abs(ref.current!.scale.x);
ref.current!.position.x = 0.2;
});
}
}; };
const unMirror = () => { const unMirror = () => {
longHudRef.current!.scale.x = Math.abs(longHudRef.current!.scale.x); longHudRef.current!.scale.x = Math.abs(longHudRef.current!.scale.x);
boringHudRef.current!.scale.x = Math.abs(boringHudRef.current!.scale.x); boringHudRef.current!.scale.x = Math.abs(boringHudRef.current!.scale.x);
bigHudRef.current!.scale.x = Math.abs(bigHudRef.current!.scale.x); bigHudRef.current!.scale.x = Math.abs(bigHudRef.current!.scale.x);
nodeTitleRef.current!.scale.x = Math.abs(nodeTitleRef.current!.scale.x);
nodeTitleRef.current!.position.x = -0.2;
if (protocolLinesToggled) {
protocolLineTitleRefs.current.forEach((ref) => {
ref.current!.scale.x = Math.abs(ref.current!.scale.x);
ref.current!.position.x = -0.2;
});
}
}; };
const setPos = (hud: HUDData, pos: string) => { const setPos = (hud: HUDData, pos: string) => {
@ -89,13 +118,21 @@ const HUD = memo(() => {
bigHudRef.current!.position.set( bigHudRef.current!.position.set(
...(hud.big[pos as keyof typeof hud.big] as [number, number, number]) ...(hud.big[pos as keyof typeof hud.big] as [number, number, number])
); );
greenTextRef.current!.position.set( if (
...(hud.medium_text[pos as keyof typeof hud.medium_text] as [ protocolLine1Ref.current &&
number, protocolLine2Ref.current &&
number, protocolLine3Ref.current
number ) {
]) protocolLine1Ref.current.position.set(
...(hud.big.protocol_line_positions[0] as [number, number, number])
); );
protocolLine2Ref.current.position.set(
...(hud.big.protocol_line_positions[1] as [number, number, number])
);
protocolLine3Ref.current.position.set(
...(hud.big.protocol_line_positions[2] as [number, number, number])
);
}
}; };
if (activeRef.current !== undefined) { if (activeRef.current !== undefined) {
@ -103,7 +140,8 @@ const HUD = memo(() => {
if ( if (
!(scene === "main" && prevData?.scene === "main") || !(scene === "main" && prevData?.scene === "main") ||
(subscene === "site" && prevData?.subscene === "pause") || (subscene === "site" && prevData?.subscene === "pause") ||
subscene === "pause" subscene === "pause" ||
protocolLinesToggled !== prevData?.protocolLinesToggled
) { ) {
// set to final pos instantly // set to final pos instantly
setPos(hud, "position"); setPos(hud, "position");
@ -142,28 +180,19 @@ const HUD = memo(() => {
prevData?.scene, prevData?.scene,
prevData?.siteRotY, prevData?.siteRotY,
prevData?.subscene, prevData?.subscene,
prevData?.protocolLinesToggled,
scene, scene,
siteRotY, siteRotY,
subscene, subscene,
protocolLinesToggled,
]); ]);
const longHudRef = useRef<THREE.Object3D>();
const boringHudRef = useRef<THREE.Object3D>();
const bigHudRef = useRef<THREE.Object3D>();
const greenTextRef = useRef<THREE.Object3D>();
const longHudTex = useLoader(THREE.TextureLoader, longHud); const longHudTex = useLoader(THREE.TextureLoader, longHud);
const boringHudTex = useLoader(THREE.TextureLoader, boringHud); const boringHudTex = useLoader(THREE.TextureLoader, boringHud);
const bigHudTex = useLoader(THREE.TextureLoader, bigHud); const bigHudTex = useLoader(THREE.TextureLoader, bigHud);
return ( return (
<group position={[0, 0, 10]}> <group position={[0, 0, 10]}>
<mesh <mesh scale={[1, 0.03, 1]} renderOrder={2} ref={longHudRef}>
scale={[1, 0.03, 1]}
renderOrder={2}
ref={longHudRef}
position-z={-8.6}
>
<planeBufferGeometry attach="geometry" /> <planeBufferGeometry attach="geometry" />
<meshBasicMaterial <meshBasicMaterial
attach="material" attach="material"
@ -172,12 +201,7 @@ const HUD = memo(() => {
depthTest={false} depthTest={false}
/> />
</mesh> </mesh>
<mesh <mesh scale={[1, 0.03, 1]} renderOrder={2} ref={boringHudRef}>
scale={[1, 0.03, 1]}
renderOrder={2}
ref={boringHudRef}
position-z={-8.6}
>
<planeBufferGeometry attach="geometry" /> <planeBufferGeometry attach="geometry" />
<meshBasicMaterial <meshBasicMaterial
attach="material" attach="material"
@ -186,12 +210,8 @@ const HUD = memo(() => {
depthTest={false} depthTest={false}
/> />
</mesh> </mesh>
<mesh <group ref={bigHudRef}>
scale={[0.5, 0.06, 1]} <mesh scale={[0.5, 0.06, 1]} renderOrder={2}>
renderOrder={2}
ref={bigHudRef}
position-z={-8.6}
>
<planeBufferGeometry attach="geometry" /> <planeBufferGeometry attach="geometry" />
<meshBasicMaterial <meshBasicMaterial
attach="material" attach="material"
@ -200,8 +220,71 @@ const HUD = memo(() => {
depthTest={false} depthTest={false}
/> />
</mesh> </mesh>
<group position-z={-8.7} scale={[0.02, 0.035, 0.02]} ref={greenTextRef}> <group ref={nodeTitleRef} scale={[0.016, 0.03, 0.016]}>
<GreenTextRenderer /> <GreenTextRenderer textToRender={activeNode.title.split("")} />
</group>
{protocolLinesToggled && (
<>
<group ref={protocolLine1Ref}>
<mesh scale={[0.5, 0.06, 1]} renderOrder={2}>
<planeBufferGeometry attach="geometry" />
<meshBasicMaterial
attach="material"
map={bigHudTex}
transparent={true}
depthTest={false}
/>
</mesh>
<group
scale={[0.016, 0.03, 0.016]}
ref={protocolLineTitleRefs.current[0]}
>
<GreenTextRenderer
textToRender={activeNode.protocol_lines["1"].split("")}
/>
</group>
</group>
<group ref={protocolLine2Ref}>
<mesh scale={[0.5, 0.06, 1]} renderOrder={2}>
<planeBufferGeometry attach="geometry" />
<meshBasicMaterial
attach="material"
map={bigHudTex}
transparent={true}
depthTest={false}
/>
</mesh>
<group
scale={[0.016, 0.03, 0.016]}
ref={protocolLineTitleRefs.current[1]}
>
<GreenTextRenderer
textToRender={activeNode.protocol_lines["2"].split("")}
/>
</group>
</group>
<group ref={protocolLine3Ref}>
<mesh scale={[0.5, 0.06, 1]} renderOrder={2}>
<planeBufferGeometry attach="geometry" />
<meshBasicMaterial
attach="material"
map={bigHudTex}
transparent={true}
depthTest={false}
/>
</mesh>
<group
scale={[0.016, 0.03, 0.016]}
ref={protocolLineTitleRefs.current[2]}
>
<GreenTextRenderer
textToRender={activeNode.protocol_lines["3"].split("")}
/>
</group>
</group>
</>
)}
</group> </group>
</group> </group>
); );

View file

@ -22,10 +22,7 @@ const AudioVisualizer = memo(() => {
const frequencyData = audioAnalyser.getFrequencyData(); const frequencyData = audioAnalyser.getFrequencyData();
columnRefs.forEach((refArray, idx) => { columnRefs.forEach((refArray, idx) => {
const ref1 = refArray[0]; const [ref1, ref2, ref3, ref4] = [...refArray];
const ref2 = refArray[1];
const ref3 = refArray[2];
const ref4 = refArray[3];
const currentFrequency = frequencyData[16 * idx]; const currentFrequency = frequencyData[16 * idx];

View file

@ -4,16 +4,8 @@ import greenFont from "../../static/sprites/fonts/white_and_green_texture.png";
import medium_font_json from "../../resources/fonts/medium_font.json"; import medium_font_json from "../../resources/fonts/medium_font.json";
import { a } from "@react-spring/three"; import { a } from "@react-spring/three";
import React, { memo, useMemo } from "react"; import React, { memo, useMemo } from "react";
import { useStore } from "../../store";
const GreenTextRenderer = memo(() => {
const textToRender = useStore((state) =>
(state.currentScene === "main"
? state.activeNode.title
: state.activeNode.node_name
).split("")
);
const GreenTextRenderer = memo((props: { textToRender: string[] }) => {
const colorTexture = useLoader(THREE.TextureLoader, greenFont); const colorTexture = useLoader(THREE.TextureLoader, greenFont);
const getLineYOffset = (letter: string) => { const getLineYOffset = (letter: string) => {
@ -69,7 +61,7 @@ const GreenTextRenderer = memo(() => {
return geometry; return geometry;
}; };
return textToRender.map((letter, idx) => { return props.textToRender.map((letter, idx) => {
const letterData = const letterData =
medium_font_json.glyphs[letter as keyof typeof medium_font_json.glyphs]; medium_font_json.glyphs[letter as keyof typeof medium_font_json.glyphs];
const geom = getGeom(letter, letterData); const geom = getGeom(letter, letterData);
@ -92,7 +84,7 @@ const GreenTextRenderer = memo(() => {
</a.mesh> </a.mesh>
); );
}); });
}, [colorTexture, textToRender]); }, [colorTexture, props.textToRender]);
return <>{text}</>; return <>{text}</>;
}); });

View file

@ -243,7 +243,6 @@ export const pauseGame = (calculatedState: { siteRot: number[] }) => ({
{ {
mutation: { mutation: {
lainMoveState: "rip_middle_ring", lainMoveState: "rip_middle_ring",
pauseExitAnimation: false,
mainSubscene: "pause", mainSubscene: "pause",
inputCooldown: -1, inputCooldown: -1,
}, },
@ -785,6 +784,19 @@ export const playLainIdleAnim = (calculatedState: {
], ],
}); });
export const setProtocolLines = (calculatedState: {
protocolLinesToggled: boolean;
}) => ({
state: [
{
mutation: {
protocolLinesToggled: calculatedState.protocolLinesToggled,
inputCooldown: 0,
},
},
],
});
export const resetInputCooldown = { export const resetInputCooldown = {
state: [{ mutation: { inputCooldown: 0 } }], state: [{ mutation: { inputCooldown: 0 } }],
}; };

View file

@ -2,6 +2,7 @@ import {
findNode, findNode,
getNodeById, getNodeById,
isNodeVisible, isNodeVisible,
moveHorizontalAndFindNode,
nodeToScene, nodeToScene,
unknownNodeTemplate, unknownNodeTemplate,
} from "../../helpers/node-helpers"; } from "../../helpers/node-helpers";
@ -28,6 +29,7 @@ import {
ripNode, ripNode,
saveGame, saveGame,
selectLevel, selectLevel,
setProtocolLines,
showAbout, showAbout,
showPermissionDenied, showPermissionDenied,
siteMoveHorizontal, siteMoveHorizontal,
@ -56,6 +58,7 @@ const handleMainSceneInput = (
siteSaveState, siteSaveState,
wordNotFound, wordNotFound,
canLainMove, canLainMove,
protocolLinesToggled,
} = mainSceneContext; } = mainSceneContext;
if (promptVisible) { if (promptVisible) {
@ -176,7 +179,6 @@ const handleMainSceneInput = (
if (nodeData.didMove) { if (nodeData.didMove) {
if (!canLainMove) return resetInputCooldown; if (!canLainMove) return resetInputCooldown;
return siteMoveVertical({ return siteMoveVertical({
lainMoveAnimation: lainMoveAnimation, lainMoveAnimation: lainMoveAnimation,
activeLevel: newLevel, activeLevel: newLevel,
@ -208,6 +210,46 @@ const handleMainSceneInput = (
case "TRIANGLE": case "TRIANGLE":
if (!canLainMove) return resetInputCooldown; if (!canLainMove) return resetInputCooldown;
return pauseGame({ siteRot: [Math.PI / 2, siteRotY, 0] }); return pauseGame({ siteRot: [Math.PI / 2, siteRotY, 0] });
case "L1":
case "R1":
const direction = keyPress === "L1" ? "left" : "right";
const nodeData = moveHorizontalAndFindNode(
activeNode,
direction,
level,
activeSite,
gameProgress
);
if (!nodeData) return resetInputCooldown;
const lainMoveAnimation = `move_${direction}`;
const newSiteRot = [
0,
direction === "left"
? siteRotY + Math.PI / 4
: siteRotY - Math.PI / 4,
0,
];
const newNode = {
...(nodeData.node !== "unknown"
? getNodeById(nodeData.node, activeSite)
: unknownNodeTemplate),
matrixIndices: nodeData.matrixIndices,
};
if (!canLainMove) return resetInputCooldown;
return siteMoveHorizontal({
lainMoveAnimation: lainMoveAnimation,
siteRot: newSiteRot,
activeNode: newNode,
});
case "SQUARE":
return setProtocolLines({
protocolLinesToggled: !protocolLinesToggled,
});
} }
break; break;
case "level_selection": case "level_selection":
@ -223,7 +265,6 @@ const handleMainSceneInput = (
break; break;
case "CROSS": case "CROSS":
return exitLevelSelection; return exitLevelSelection;
case "CIRCLE": case "CIRCLE":
if (!canLainMove) return resetInputCooldown; if (!canLainMove) return resetInputCooldown;

View file

@ -183,6 +183,66 @@ const move = (direction: string, [matrix, level]: [number, number]) => {
return [matrix, level]; return [matrix, level];
}; };
export const moveHorizontalAndFindNode = (
startingPoint: NodeData,
direction: string,
level: number,
activeSite: ActiveSite,
gameProgress: GameProgress
) => {
const funcs: {
[key: string]: ([row, col]: [number, number]) => Generator<number[], void>;
} = {
left: ([r]: [number, number]) => nextPos_right([r, -1]),
right: ([r]: [number, number]) => nextPos_left([r, 4]),
};
if (startingPoint.matrixIndices) {
const nextPos = funcs[direction];
let { matrixIdx, colIdx, rowIdx } = { ...startingPoint.matrixIndices };
[matrixIdx] = move(direction, [matrixIdx, level]);
const nodes = getVisibleNodesMatrix(
matrixIdx,
level,
activeSite,
gameProgress
);
for (const [r, c] of nextPos([rowIdx, colIdx])) {
const node = nodes[r][c];
if (node)
return {
node,
matrixIndices: {
matrixIdx,
rowIdx: r,
colIdx: c,
},
didMove: true,
};
}
const nodeId = startingPoint.id;
if (nodeId === "") {
return {
node: "unknown",
matrixIndices: {
matrixIdx,
rowIdx: rowIdx,
colIdx: colIdx,
},
didMove: true,
};
}
}
};
export const findNode = ( export const findNode = (
startingPoint: NodeData, startingPoint: NodeData,
direction: string, direction: string,
@ -302,6 +362,11 @@ export const unknownNodeTemplate = {
"2": "", "2": "",
"3": "", "3": "",
}, },
protocol_lines: {
"1": "",
"2": "",
"3": "",
},
}; };
export const nodeToScene = (node: NodeData) => { export const nodeToScene = (node: NodeData) => {

View file

@ -81,6 +81,7 @@
"&": [80, 104, 8, 8, 0], "&": [80, 104, 8, 8, 0],
"?": [88, 104, 8, 8, 0], "?": [88, 104, 8, 8, 0],
"/": [96, 104, 8, 9, 0], "/": [96, 104, 8, 9, 0],
" ": [0, 0, 0, 0, 0, 0] " ": [0, 0, 0, 0, 0, 0],
"_": [0, 0, 0, 0, 0, 0]
} }
} }

View file

@ -11,13 +11,14 @@
}, },
"big": { "big": {
"position": [0.36, 0.13, -8.6], "position": [0.36, 0.13, -8.6],
"initial_position": [1.36, 0.13, -8.6] "initial_position": [1.36, 0.13, -8.6],
"protocol_line_positions": [
[-0.03, -0.06, 0],
[-0.06, -0.12, 0],
[-0.09, -0.18, 0]
]
}, },
"big_text": [-0.35, 0.23, -8.7], "big_text": [-0.35, 0.23, -8.7]
"medium_text": {
"position": [0.18, 0.16, -8.7],
"initial_position": [1.18, 0.16, -8.7]
}
}, },
"fg_hud_2": { "fg_hud_2": {
"mirrored": 0, "mirrored": 0,
@ -31,13 +32,14 @@
}, },
"big": { "big": {
"position": [0.35, -0.12, -8.6], "position": [0.35, -0.12, -8.6],
"initial_position": [1.35, -0.12, -8.6] "initial_position": [1.35, -0.12, -8.6],
"protocol_line_positions": [
[-0.03, -0.06, 0],
[-0.06, -0.12, 0],
[-0.09, -0.18, 0]
]
}, },
"big_text": [-0.35, -0.05, -8.7], "big_text": [-0.35, -0.05, -8.7]
"medium_text": {
"position": [0.18, -0.13, -8.7],
"initial_position": [1.18, -0.13, -8.7]
}
}, },
"fg_hud_3": { "fg_hud_3": {
"mirrored": 0, "mirrored": 0,
@ -51,13 +53,14 @@
}, },
"big": { "big": {
"position": [0.3, -0.28, -8.6], "position": [0.3, -0.28, -8.6],
"initial_position": [1.3, -0.28, -8.6] "initial_position": [1.3, -0.28, -8.6],
"protocol_line_positions": [
[0.03, 0.06, 0],
[0.06, 0.12, 0],
[0.09, 0.18, 0]
]
}, },
"big_text": [-0.35, -0.32, -8.7], "big_text": [-0.35, -0.32, -8.7]
"medium_text": {
"position": [0.12, -0.32, -8.7],
"initial_position": [1.12, -0.32, -8.7]
}
}, },
"fg_hud_4": { "fg_hud_4": {
"mirrored": 1, "mirrored": 1,
@ -71,13 +74,14 @@
}, },
"big": { "big": {
"position": [-0.35, 0.155, -8.6], "position": [-0.35, 0.155, -8.6],
"initial_position": [-1.35, 0.155, -8.6] "initial_position": [-1.35, 0.155, -8.6],
"protocol_line_positions": [
[-0.03, -0.06, 0],
[-0.06, -0.12, 0],
[-0.09, -0.18, 0]
]
}, },
"big_text": [0.45, 0.265, -8.7], "big_text": [0.45, 0.265, -8.7]
"medium_text": {
"position": [-0.65, 0.18, -8.7],
"initial_position": [-1.65, 0.18, -8.7]
}
}, },
"fg_hud_5": { "fg_hud_5": {
"mirrored": 1, "mirrored": 1,
@ -91,13 +95,14 @@
}, },
"big": { "big": {
"position": [-0.35, -0.12, -8.6], "position": [-0.35, -0.12, -8.6],
"initial_position": [-1.35, -0.12, -8.6] "initial_position": [-1.35, -0.12, -8.6],
"protocol_line_positions": [
[-0.03, -0.06, 0],
[-0.06, -0.12, 0],
[-0.09, -0.18, 0]
]
}, },
"big_text": [0.45, -0.05, -8.7], "big_text": [0.45, -0.05, -8.7]
"medium_text": {
"position": [-0.65, -0.13, -8.7],
"initial_position": [-1.65, -0.13, -8.7]
}
}, },
"fg_hud_6": { "fg_hud_6": {
"mirrored": 1, "mirrored": 1,
@ -111,13 +116,14 @@
}, },
"big": { "big": {
"position": [-0.25, -0.28, -8.6], "position": [-0.25, -0.28, -8.6],
"initial_position": [-1.25, -0.28, -8.6] "initial_position": [-1.25, -0.28, -8.6],
"protocol_line_positions": [
[0.03, 0.06, 0],
[0.06, 0.12, 0],
[0.09, 0.18, 0]
]
}, },
"big_text": [0.45, -0.32, -8.7], "big_text": [0.45, -0.32, -8.7]
"medium_text": {
"position": [-0.55, -0.32, -8.7],
"initial_position": [-1.55, -0.32, -8.7]
}
}, },
"bg_hud_1": { "bg_hud_1": {
"mirrored": 0, "mirrored": 0,
@ -131,13 +137,14 @@
}, },
"big": { "big": {
"position": [0.3, 0.015, -8.6], "position": [0.3, 0.015, -8.6],
"initial_position": [1.3, 0.015, -8.6] "initial_position": [1.3, 0.015, -8.6],
"protocol_line_positions": [
[-0.03, -0.06, 0],
[-0.06, -0.12, 0],
[-0.09, -0.18, 0]
]
}, },
"big_text": [-0.15, 0.1, -8.7], "big_text": [-0.15, 0.1, -8.7]
"medium_text": {
"position": [0.1, 0.02, -8.7],
"initial_position": [1.1, 0.02, -8.7]
}
}, },
"bg_hud_2": { "bg_hud_2": {
"mirrored": 0, "mirrored": 0,
@ -151,13 +158,14 @@
}, },
"big": { "big": {
"position": [0.3, -0.1, -8.6], "position": [0.3, -0.1, -8.6],
"initial_position": [1.35, -0.1, -8.6] "initial_position": [1.35, -0.1, -8.6],
"protocol_line_positions": [
[-0.03, -0.06, 0],
[-0.06, -0.12, 0],
[-0.09, -0.18, 0]
]
}, },
"big_text": [-0.15, -0.03, -8.7], "big_text": [-0.15, -0.03, -8.7]
"medium_text": {
"position": [0.18, -0.13, -8.7],
"initial_position": [1.18, -0.13, -8.7]
}
}, },
"bg_hud_3": { "bg_hud_3": {
"mirrored": 0, "mirrored": 0,
@ -171,13 +179,14 @@
}, },
"big": { "big": {
"position": [0.3, -0.22, -8.6], "position": [0.3, -0.22, -8.6],
"initial_position": [1.35, -0.22, -8.6] "initial_position": [1.35, -0.22, -8.6],
"protocol_line_positions": [
[-0.03, -0.06, 0],
[-0.06, -0.12, 0],
[-0.09, -0.18, 0]
]
}, },
"big_text": [-0.15, -0.17, -8.7], "big_text": [-0.15, -0.17, -8.7]
"medium_text": {
"position": [0.18, -0.25, -8.7],
"initial_position": [1.18, -0.25, -8.7]
}
}, },
"bg_hud_4": { "bg_hud_4": {
"mirrored": 1, "mirrored": 1,
@ -191,13 +200,14 @@
}, },
"big": { "big": {
"position": [-0.35, 0.015, -8.6], "position": [-0.35, 0.015, -8.6],
"initial_position": [-1.35, 0.015, -8.6] "initial_position": [-1.35, 0.015, -8.6],
"protocol_line_positions": [
[-0.03, -0.06, 0],
[-0.06, -0.12, 0],
[-0.09, -0.18, 0]
]
}, },
"big_text": [0.2, 0.1, -8.7], "big_text": [0.2, 0.1, -8.7]
"medium_text": {
"position": [-0.65, 0.02, -8.7],
"initial_position": [-1.65, 0.02, -8.7]
}
}, },
"bg_hud_5": { "bg_hud_5": {
"mirrored": 1, "mirrored": 1,
@ -211,13 +221,14 @@
}, },
"big": { "big": {
"position": [-0.35, -0.1, -8.6], "position": [-0.35, -0.1, -8.6],
"initial_position": [-1.35, -0.1, -8.6] "initial_position": [-1.35, -0.1, -8.6],
"protocol_line_positions": [
[-0.03, -0.06, 0],
[-0.06, -0.12, 0],
[-0.09, -0.18, 0]
]
}, },
"big_text": [0.2, -0.03, -8.7], "big_text": [0.2, -0.03, -8.7]
"medium_text": {
"position": [-0.65, -0.11, -8.7],
"initial_position": [-1.65, -0.11, -8.7]
}
}, },
"bg_hud_6": { "bg_hud_6": {
"mirrored": 1, "mirrored": 1,
@ -231,12 +242,13 @@
}, },
"big": { "big": {
"position": [-0.25, -0.22, -8.6], "position": [-0.25, -0.22, -8.6],
"initial_position": [-1.25, -0.22, -8.6] "initial_position": [-1.25, -0.22, -8.6],
"protocol_line_positions": [
[0.03, 0.06, 0],
[0.06, 0.12, 0],
[0.09, 0.18, 0]
]
}, },
"big_text": [0.2, -0.17, -8.7], "big_text": [0.2, -0.17, -8.7]
"medium_text": {
"position": [-0.53, -0.25, -8.7],
"initial_position": [-1.53, -0.25, -8.7]
}
} }
} }

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -132,7 +132,7 @@ const MediaScene = () => {
<NodeNameContainer /> <NodeNameContainer />
</group> </group>
<group scale={[0.06, 0.12, 0]} position={[0.8, 1.37, 0]}> <group scale={[0.06, 0.12, 0]} position={[0.8, 1.37, 0]}>
<GreenTextRenderer /> <GreenTextRenderer textToRender={activeNode.node_name.split("")} />
</group> </group>
<MediaYellowTextAnimator /> <MediaYellowTextAnimator />

View file

@ -47,6 +47,8 @@ type State = {
activeNodeRot: number[]; activeNodeRot: number[];
activeNodeAttributes: NodeAttributes; activeNodeAttributes: NodeAttributes;
protocolLinesToggled: boolean;
lainMoveState: string; lainMoveState: string;
canLainMove: boolean; canLainMove: boolean;
@ -63,7 +65,6 @@ type State = {
endSceneSelectionVisible: boolean; endSceneSelectionVisible: boolean;
activePauseComponent: PauseComponent; activePauseComponent: PauseComponent;
pauseExitAnimation: boolean;
showingAbout: boolean; showingAbout: boolean;
permissionDenied: boolean; permissionDenied: boolean;
@ -141,6 +142,9 @@ export const useStore = create(
lainMoveState: "standing", lainMoveState: "standing",
canLainMove: true, canLainMove: true,
// extra node data display
protocolLinesToggled: false,
// site // site
activeSite: "a", activeSite: "a",
siteRot: [0, 0, 0], siteRot: [0, 0, 0],
@ -363,6 +367,7 @@ export const getMainSceneContext = (): MainSceneContext => {
siteSaveState: state.siteSaveState, siteSaveState: state.siteSaveState,
wordNotFound: state.wordNotFound, wordNotFound: state.wordNotFound,
canLainMove: state.canLainMove, canLainMove: state.canLainMove,
protocolLinesToggled: state.protocolLinesToggled,
}; };
}; };

View file

@ -57,6 +57,11 @@ export type NodeData = {
unlocked_by: string; unlocked_by: string;
upgrade_requirement: number; upgrade_requirement: number;
words: { 1: string; 2: string; 3: string }; words: { 1: string; 2: string; 3: string };
protocol_lines: {
1: string;
2: string;
3: string;
};
matrixIndices?: NodeMatrixIndices; matrixIndices?: NodeMatrixIndices;
is_viewed?: number; is_viewed?: number;
}; };
@ -109,6 +114,7 @@ export interface MainSceneContext extends PromptContext {
wordNotFound: boolean; wordNotFound: boolean;
siteSaveState: SiteSaveState; siteSaveState: SiteSaveState;
canLainMove: boolean; canLainMove: boolean;
protocolLinesToggled: boolean;
} }
export type SsknSceneContext = { export type SsknSceneContext = {
@ -186,12 +192,9 @@ export type HUDData = {
big: { big: {
position: number[]; position: number[];
initial_position: number[]; initial_position: number[];
protocol_line_positions: number[][];
}; };
big_text: number[]; big_text: number[];
medium_text: {
position: number[];
initial_position: number[];
};
}; };
export type UserSaveState = { export type UserSaveState = {

View file

@ -1,16 +1,20 @@
const getKeyPress = (key: string) => { const getKeyPress = (key: string) => {
if (["X", "Z", "D", "E", "V"].includes(key)) key = key.toLowerCase(); if (["X", "Z", "D", "E", "V", "T", "W", "R"].includes(key))
key = key.toLowerCase();
const keyCodeAssocs = { const keyCodeAssocs = {
ArrowDown: "DOWN", // down arrow ArrowDown: "DOWN",
ArrowLeft: "LEFT", // left arrow ArrowLeft: "LEFT",
ArrowUp: "UP", // up arrow ArrowUp: "UP",
ArrowRight: "RIGHT", // right arrow ArrowRight: "RIGHT",
x: "CIRCLE", // x key x: "CIRCLE",
z: "CROSS", // z key z: "CROSS",
d: "TRIANGLE", // d key d: "TRIANGLE",
e: "L2", // e key s: "SQUARE",
v: "START", // v key e: "L2",
v: "START",
w: "L1",
r: "R1",
}; };
return keyCodeAssocs[key as keyof typeof keyCodeAssocs]; return keyCodeAssocs[key as keyof typeof keyCodeAssocs];
}; };