mirror of
https://github.com/ad044/lainTSX.git
synced 2024-10-22 23:19:06 +00:00
fixes
This commit is contained in:
parent
c988b07196
commit
b0d29e4fa1
8 changed files with 33 additions and 24 deletions
|
@ -23,13 +23,13 @@ const HUD = memo(() => {
|
||||||
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 protocolLinesToggled = useStore((state) => state.protocolLinesToggled);
|
const protocolLinesEnabled = useStore((state) => state.protocolLinesEnabled);
|
||||||
const prevData = usePrevious({
|
const prevData = usePrevious({
|
||||||
siteRotY,
|
siteRotY,
|
||||||
activeLevel,
|
activeLevel,
|
||||||
subscene,
|
subscene,
|
||||||
scene,
|
scene,
|
||||||
protocolLinesToggled,
|
protocolLinesEnabled,
|
||||||
});
|
});
|
||||||
|
|
||||||
const longHudRef = useRef<THREE.Object3D>();
|
const longHudRef = useRef<THREE.Object3D>();
|
||||||
|
@ -78,7 +78,7 @@ const HUD = memo(() => {
|
||||||
nodeTitleRef.current!.scale.x = -Math.abs(nodeTitleRef.current!.scale.x);
|
nodeTitleRef.current!.scale.x = -Math.abs(nodeTitleRef.current!.scale.x);
|
||||||
nodeTitleRef.current!.position.x = 0.2;
|
nodeTitleRef.current!.position.x = 0.2;
|
||||||
|
|
||||||
if (protocolLinesToggled) {
|
if (protocolLinesEnabled) {
|
||||||
protocolLineTitleRefs.current.forEach((ref) => {
|
protocolLineTitleRefs.current.forEach((ref) => {
|
||||||
ref.current!.scale.x = -Math.abs(ref.current!.scale.x);
|
ref.current!.scale.x = -Math.abs(ref.current!.scale.x);
|
||||||
ref.current!.position.x = 0.2;
|
ref.current!.position.x = 0.2;
|
||||||
|
@ -93,7 +93,7 @@ const HUD = memo(() => {
|
||||||
nodeTitleRef.current!.scale.x = Math.abs(nodeTitleRef.current!.scale.x);
|
nodeTitleRef.current!.scale.x = Math.abs(nodeTitleRef.current!.scale.x);
|
||||||
nodeTitleRef.current!.position.x = -0.2;
|
nodeTitleRef.current!.position.x = -0.2;
|
||||||
|
|
||||||
if (protocolLinesToggled) {
|
if (protocolLinesEnabled) {
|
||||||
protocolLineTitleRefs.current.forEach((ref) => {
|
protocolLineTitleRefs.current.forEach((ref) => {
|
||||||
ref.current!.scale.x = Math.abs(ref.current!.scale.x);
|
ref.current!.scale.x = Math.abs(ref.current!.scale.x);
|
||||||
ref.current!.position.x = -0.2;
|
ref.current!.position.x = -0.2;
|
||||||
|
@ -138,7 +138,7 @@ const HUD = memo(() => {
|
||||||
!(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
|
protocolLinesEnabled !== prevData?.protocolLinesEnabled
|
||||||
) {
|
) {
|
||||||
// set to final pos instantly
|
// set to final pos instantly
|
||||||
setPos(hud, "position");
|
setPos(hud, "position");
|
||||||
|
@ -176,11 +176,11 @@ const HUD = memo(() => {
|
||||||
prevData?.scene,
|
prevData?.scene,
|
||||||
prevData?.siteRotY,
|
prevData?.siteRotY,
|
||||||
prevData?.subscene,
|
prevData?.subscene,
|
||||||
prevData?.protocolLinesToggled,
|
prevData?.protocolLinesEnabled,
|
||||||
scene,
|
scene,
|
||||||
siteRotY,
|
siteRotY,
|
||||||
subscene,
|
subscene,
|
||||||
protocolLinesToggled,
|
protocolLinesEnabled,
|
||||||
activeNode.matrixIndices,
|
activeNode.matrixIndices,
|
||||||
activeNode.node_name,
|
activeNode.node_name,
|
||||||
]);
|
]);
|
||||||
|
@ -221,7 +221,7 @@ const HUD = memo(() => {
|
||||||
<group ref={nodeTitleRef} scale={[0.016, 0.03, 0.016]}>
|
<group ref={nodeTitleRef} scale={[0.016, 0.03, 0.016]}>
|
||||||
<GreenTextRenderer textToRender={activeNode.title.split("")} />
|
<GreenTextRenderer textToRender={activeNode.title.split("")} />
|
||||||
</group>
|
</group>
|
||||||
{protocolLinesToggled && (
|
{protocolLinesEnabled && (
|
||||||
<>
|
<>
|
||||||
<group ref={protocolLine1Ref}>
|
<group ref={protocolLine1Ref}>
|
||||||
<mesh scale={[0.5, 0.06, 1]} renderOrder={2}>
|
<mesh scale={[0.5, 0.06, 1]} renderOrder={2}>
|
||||||
|
|
|
@ -70,10 +70,9 @@ const Pause = () => {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (subscene === "pause") {
|
if (subscene === "pause") {
|
||||||
let timers: ReturnType<typeof setTimeout>[] = [];
|
setTimeout(() => setVisible(true), 4400);
|
||||||
timers.push(setTimeout(() => setVisible(true), 4400));
|
setTimeout(() => setFinished(true), 7300);
|
||||||
timers.push(setTimeout(() => setFinished(true), 7300));
|
setTimeout(() => setInputCooldown(1000), 7600);
|
||||||
timers.push(setTimeout(() => setInputCooldown(1000), 7600));
|
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
setExit(true);
|
setExit(true);
|
||||||
|
@ -89,10 +88,6 @@ const Pause = () => {
|
||||||
setFinished(false);
|
setFinished(false);
|
||||||
setExit(false);
|
setExit(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const timer of timers) {
|
|
||||||
clearTimeout(timer);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}, [setInputCooldown, subscene]);
|
}, [setInputCooldown, subscene]);
|
||||||
|
|
|
@ -409,6 +409,7 @@ export const loadGame = (calculatedState: {
|
||||||
promptVisible: false,
|
promptVisible: false,
|
||||||
activePromptComponent: "no",
|
activePromptComponent: "no",
|
||||||
activePauseComponent: "change",
|
activePauseComponent: "change",
|
||||||
|
protocolLinesEnabled: false,
|
||||||
},
|
},
|
||||||
delay: 1200,
|
delay: 1200,
|
||||||
},
|
},
|
||||||
|
@ -440,6 +441,7 @@ export const changeSite = (calculatedState: {
|
||||||
promptVisible: false,
|
promptVisible: false,
|
||||||
activePromptComponent: "no",
|
activePromptComponent: "no",
|
||||||
mainSubscene: "site",
|
mainSubscene: "site",
|
||||||
|
protocolLinesEnabled: false,
|
||||||
// load state
|
// load state
|
||||||
activeSite: calculatedState.newActiveSite,
|
activeSite: calculatedState.newActiveSite,
|
||||||
activeNode: calculatedState.newActiveNode,
|
activeNode: calculatedState.newActiveNode,
|
||||||
|
@ -723,6 +725,7 @@ export const exitUserAuthorization = {
|
||||||
audio: [{ sfx: [audio.sound29] }],
|
audio: [{ sfx: [audio.sound29] }],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// todo reset state
|
||||||
export const startNewGame = {
|
export const startNewGame = {
|
||||||
state: [
|
state: [
|
||||||
{ mutation: { currentScene: "main", intro: true, inputCooldown: -1 } },
|
{ mutation: { currentScene: "main", intro: true, inputCooldown: -1 } },
|
||||||
|
@ -816,12 +819,12 @@ export const playLainIdleAnim = (calculatedState: {
|
||||||
});
|
});
|
||||||
|
|
||||||
export const setProtocolLines = (calculatedState: {
|
export const setProtocolLines = (calculatedState: {
|
||||||
protocolLinesToggled: boolean;
|
protocolLinesEnabled: boolean;
|
||||||
}) => ({
|
}) => ({
|
||||||
state: [
|
state: [
|
||||||
{
|
{
|
||||||
mutation: {
|
mutation: {
|
||||||
protocolLinesToggled: calculatedState.protocolLinesToggled,
|
protocolLinesEnabled: calculatedState.protocolLinesEnabled,
|
||||||
inputCooldown: 0,
|
inputCooldown: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -60,7 +60,7 @@ const handleMainSceneInput = (
|
||||||
siteSaveState,
|
siteSaveState,
|
||||||
wordNotFound,
|
wordNotFound,
|
||||||
canLainMove,
|
canLainMove,
|
||||||
protocolLinesToggled,
|
protocolLinesEnabled,
|
||||||
cameraTiltValue,
|
cameraTiltValue,
|
||||||
lastCameraTiltValue,
|
lastCameraTiltValue,
|
||||||
} = mainSceneContext;
|
} = mainSceneContext;
|
||||||
|
@ -260,7 +260,7 @@ const handleMainSceneInput = (
|
||||||
isNodeVisible(activeNode, gameProgress)
|
isNodeVisible(activeNode, gameProgress)
|
||||||
) {
|
) {
|
||||||
return setProtocolLines({
|
return setProtocolLines({
|
||||||
protocolLinesToggled: !protocolLinesToggled,
|
protocolLinesEnabled: !protocolLinesEnabled,
|
||||||
});
|
});
|
||||||
} else return resetInputCooldown;
|
} else return resetInputCooldown;
|
||||||
case "R2":
|
case "R2":
|
||||||
|
|
|
@ -44,6 +44,11 @@ const Notes = () => {
|
||||||
Browsers require user permission to autoplay audio. If you're
|
Browsers require user permission to autoplay audio. If you're
|
||||||
not hearing any sound effects, just click somewhere around the
|
not hearing any sound effects, just click somewhere around the
|
||||||
page.
|
page.
|
||||||
|
<br /> <br />
|
||||||
|
We've also had an issue where the player left the game idle for
|
||||||
|
30~ mins, and the browser's autoplay permissions reset. Again,
|
||||||
|
if this happens to you, just click around the page and it'll get
|
||||||
|
fixed.
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { useFrame } from "react-three-fiber";
|
||||||
import { useStore } from "../store";
|
import { useStore } from "../store";
|
||||||
import createAudioAnalyser from "../utils/createAudioAnalyser";
|
import createAudioAnalyser from "../utils/createAudioAnalyser";
|
||||||
import EndSelectionScreen from "../components/EndScene/EndSelectionScreen";
|
import EndSelectionScreen from "../components/EndScene/EndSelectionScreen";
|
||||||
|
import introSpeechVtt from "../static/media/webvtt/Xa0001.vtt";
|
||||||
import introSpeech from "../static/media/audio/LAIN21.XA[31].mp4";
|
import introSpeech from "../static/media/audio/LAIN21.XA[31].mp4";
|
||||||
import outroSpeech from "../static/media/audio/LAIN21.XA[16].mp4";
|
import outroSpeech from "../static/media/audio/LAIN21.XA[16].mp4";
|
||||||
import LainSpeak from "../components/LainSpeak";
|
import LainSpeak from "../components/LainSpeak";
|
||||||
|
@ -52,6 +53,7 @@ const EndScene = () => {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const mediaElement = document.getElementById("media") as HTMLMediaElement;
|
const mediaElement = document.getElementById("media") as HTMLMediaElement;
|
||||||
|
const trackElement = document.getElementById("track") as HTMLMediaElement;
|
||||||
|
|
||||||
if (mediaElement) {
|
if (mediaElement) {
|
||||||
const playMedia = async (idx: number) => {
|
const playMedia = async (idx: number) => {
|
||||||
|
@ -63,6 +65,7 @@ const EndScene = () => {
|
||||||
|
|
||||||
await sleep(3800);
|
await sleep(3800);
|
||||||
mediaElement.src = introSpeech;
|
mediaElement.src = introSpeech;
|
||||||
|
trackElement.src = introSpeechVtt;
|
||||||
|
|
||||||
mediaElement.load();
|
mediaElement.load();
|
||||||
mediaElement.play();
|
mediaElement.play();
|
||||||
|
@ -100,6 +103,9 @@ const EndScene = () => {
|
||||||
playMedia(0);
|
playMedia(0);
|
||||||
mediaElement.addEventListener("ended", () => {
|
mediaElement.addEventListener("ended", () => {
|
||||||
playedMediaCountRef.current++;
|
playedMediaCountRef.current++;
|
||||||
|
if (playedMediaCountRef.current === 1) {
|
||||||
|
trackElement.removeAttribute("src");
|
||||||
|
}
|
||||||
if (playedMediaCountRef.current <= playerNameVoices.length + 1)
|
if (playedMediaCountRef.current <= playerNameVoices.length + 1)
|
||||||
playMedia(playedMediaCountRef.current);
|
playMedia(playedMediaCountRef.current);
|
||||||
});
|
});
|
||||||
|
|
|
@ -46,7 +46,7 @@ type State = {
|
||||||
activeNodeRot: number[];
|
activeNodeRot: number[];
|
||||||
activeNodeAttributes: NodeAttributes;
|
activeNodeAttributes: NodeAttributes;
|
||||||
|
|
||||||
protocolLinesToggled: boolean;
|
protocolLinesEnabled: boolean;
|
||||||
|
|
||||||
lainMoveState: string;
|
lainMoveState: string;
|
||||||
canLainMove: boolean;
|
canLainMove: boolean;
|
||||||
|
@ -145,7 +145,7 @@ export const useStore = create(
|
||||||
canLainMove: true,
|
canLainMove: true,
|
||||||
|
|
||||||
// extra node data display
|
// extra node data display
|
||||||
protocolLinesToggled: false,
|
protocolLinesEnabled: false,
|
||||||
|
|
||||||
// camera tilt
|
// camera tilt
|
||||||
lastCameraTiltValue: -0.08,
|
lastCameraTiltValue: -0.08,
|
||||||
|
@ -377,7 +377,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,
|
protocolLinesEnabled: state.protocolLinesEnabled,
|
||||||
cameraTiltValue: state.cameraTiltValue,
|
cameraTiltValue: state.cameraTiltValue,
|
||||||
lastCameraTiltValue: state.lastCameraTiltValue,
|
lastCameraTiltValue: state.lastCameraTiltValue,
|
||||||
};
|
};
|
||||||
|
|
|
@ -114,7 +114,7 @@ export interface MainSceneContext extends PromptContext {
|
||||||
wordNotFound: boolean;
|
wordNotFound: boolean;
|
||||||
siteSaveState: SiteSaveState;
|
siteSaveState: SiteSaveState;
|
||||||
canLainMove: boolean;
|
canLainMove: boolean;
|
||||||
protocolLinesToggled: boolean;
|
protocolLinesEnabled: boolean;
|
||||||
cameraTiltValue: number;
|
cameraTiltValue: number;
|
||||||
lastCameraTiltValue: number;
|
lastCameraTiltValue: number;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue