diff --git a/src/SourceEngine/Scenes_EstrangedActI.ts b/src/SourceEngine/Scenes_EstrangedActI.ts new file mode 100644 index 000000000..11e740b29 --- /dev/null +++ b/src/SourceEngine/Scenes_EstrangedActI.ts @@ -0,0 +1,42 @@ + +import { GfxDevice } from "../gfx/platform/GfxPlatform.js"; +import { SceneContext, SceneDesc, SceneGroup } from "../SceneBase.js"; +import { SourceFileSystem, SourceLoadContext } from "./Main.js"; +import { createScene } from "./Scenes.js"; + +const pathBase = `EstrangedActI`; + +class EstrangedActISceneDesc implements SceneDesc { + constructor(public id: string, public name: string = id) { + } + + public async createScene(device: GfxDevice, context: SceneContext) { + const filesystem = await context.dataShare.ensureObject(`${pathBase}/SourceFileSystem`, async () => { + const filesystem = new SourceFileSystem(context.dataFetcher); + await Promise.all([ + filesystem.createVPKMount(`EstrangedActI/estranged_pack`), + ]); + return filesystem; + }); + + const loadContext = new SourceLoadContext(filesystem); + return createScene(context, loadContext, this.id, `${pathBase}/maps/${this.id}.bsp`); + } +} + +const id = 'EstrangedActI'; +const name = 'Estranged: Act I'; +const sceneDescs = [ + new EstrangedActISceneDesc("menu_loading"), + new EstrangedActISceneDesc("sp01thebeginning"), + new EstrangedActISceneDesc("sp02theforest"), + new EstrangedActISceneDesc("sp04thetunnel"), + new EstrangedActISceneDesc("sp05thesewers"), + new EstrangedActISceneDesc("sp07theoutleta"), + new EstrangedActISceneDesc("sp07theoutletb"), + new EstrangedActISceneDesc("sp08theincline"), + new EstrangedActISceneDesc("sp09thebase"), + new EstrangedActISceneDesc("sp10thewarehouse"), +]; + +export const sceneGroup: SceneGroup = { id, name, sceneDescs, hidden: true }; diff --git a/src/SourceEngine/VMT.ts b/src/SourceEngine/VMT.ts index 316ff409c..e584a0336 100644 --- a/src/SourceEngine/VMT.ts +++ b/src/SourceEngine/VMT.ts @@ -46,7 +46,8 @@ export class ValveKeyValueParser { } private skipcomment2(): boolean { - if (this.chew() === '/') { + let tok = this.chew(); + if (tok === '/') { const ch = this.chew(true); if (ch === '/') { while (this.chew(true) !== '\n') @@ -58,6 +59,11 @@ export class ValveKeyValueParser { } else { throw "whoops"; } + } + else if (tok === '#') { + while (this.chew(true) !== '\n') + ; + return false; } else { this.spit(); return false; diff --git a/src/main.ts b/src/main.ts index bdbcffdf6..c61ec006a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -91,6 +91,7 @@ import * as Scenes_HalfLife from './GoldSrc/Scenes_HalfLife.js'; import * as Scenes_SuperMonkeyBall from './SuperMonkeyBall/Scenes_SuperMonkeyBall.js'; import * as Scenes_DragonQuest8 from './DragonQuest8/scenes.js'; import * as Scenes_Morrowind from './Morrowind/Scenes.js'; +import * as Scenes_EstrangedActI from './SourceEngine/Scenes_EstrangedActI.js'; import { DroppedFileSceneDesc, traverseFileSystemDataTransfer } from './Scenes_FileDrops.js'; @@ -218,6 +219,7 @@ const sceneGroups: (string | SceneGroup)[] = [ Scenes_Left4Dead2.sceneGroup, Scenes_NeoTokyo.sceneGroup, Scenes_Morrowind.sceneGroup, + Scenes_EstrangedActI.sceneGroup, ]; function convertCanvasToPNG(canvas: HTMLCanvasElement): Promise {