Skip to content

Instantly share code, notes, and snippets.

View snuffyDev's full-sized avatar
😮‍💨
nice

snuffy snuffyDev

😮‍💨
nice
View GitHub Profile
// adapted from: https://github.com/vpoupet/wolfenstein/blob/master/js/files.js
class GameData {
private declare VSWAP: DataView;
private declare MAPHEAD: ArrayBuffer;
private declare GAMEMAPS: ArrayBuffer;
private declare wallTexturesOffset: number;
private declare plane0: Uint16Array;
private declare plane1: Uint16Array;
private declare plane2: boolean[][];
/* eslint-disable @typescript-eslint/no-inferrable-types */
import { SessionListService } from "$stores/list/sessionList";
import { tweened } from "svelte/motion";
import { sort, type PlayerFormats } from "./parsers/player";
import { isAppleMobileDevice } from "./utils/browserDetection";
import { browser } from "$app/environment";
import type { UserSettings } from "$stores/settings";
import { get, writable } from "svelte/store";
import { settings, type ISessionListProvider } from "./stores";
import { groupSession, type ConnectionState } from "./stores/sessions";
import {CurrentLevel} from '../../routes/editor/components/Level.svelte';
import type { Position, Position2D } from "$lib/types/position";
import { writable } from "svelte/store";
export const PlayerState = _playerState();
export type ButtonsPressed = {
w: boolean;
a: boolean;
s: boolean;
import type { Position } from '$lib/types/position';
import { writable } from 'svelte/store';
export const PlayerState = _playerState();
export type ButtonsPressed = {
forward: boolean;
backward: boolean;
strafeLeft: boolean;
strafeRight: boolean;
turnLeft: boolean;
<script lang="ts">
import Door from '$lib/components/Door.svelte';
import Guard from '$lib/components/Guard/Guard.svelte';
import Player from '$lib/components/Player.svelte';
import Wall from '$lib/components/Wall.svelte';
import { PlayerState } from '$lib/stores/player';
import type { Position } from '$lib/types/position';
import type { World } from '$lib/utils/map';
import { objectKeys } from '$lib/utils/object';
import { getDistanceFromPoints } from '$lib/utils/position';
/**
* PromisePool limits the number of concurrent executions for any given task.
*
* @example
* ```ts
* import { PromisePool, InlineThread } from 'nanothreads';
*
* const handle = new InlineThread({
* task: (a, b) => a * b
* });
<svelte:options accessors={true} />
<script context="module" lang="ts">
export const DIRECTION_MAP: Record<string, number> = {
front: 180,
left: 90,
back: 0,
right: 270
};
/**
* TODO: clean this module up massively.
*
* - Use class instead of func impl (...?)
*
*/
import type { Artist, ArtistInfo, Item, Song, Subtitle, Thumbnail } from "$lib/types";
import { Logger, addToQueue, getSrc, notify, seededShuffle, type ResponseBody } from "$lib/utils";
import { Mutex } from "$lib/utils/sync";
import { splice } from "$lib/utils/collections/array";
<svelte:options
immutable={true}
accessors={true}
/>
<script
context="module"
lang="ts"
>
import { currentTrack, queuePosition } from "$lib/stores/list";
type MixListAppendOp = [op: "append" | "set", data: ISessionListProvider["mix"]];
class ListService implements ISessionListService {
private $: Writable<ISessionListProvider>;
private state: ISessionListProvider = {
clickTrackingParams: "",
continuation: "",
currentMixId: "",
currentMixType: null,
visitorData: "",