Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Estranged: Act I #713

Merged
merged 3 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions src/SourceEngine/Scenes_EstrangedActI.ts
Original file line number Diff line number Diff line change
@@ -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 };
8 changes: 7 additions & 1 deletion src/SourceEngine/VMT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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<Blob> {
Expand Down