Skip to content

Commit

Permalink
Estranged: Act I (#713)
Browse files Browse the repository at this point in the history
* Adds Estranged: Act I

* Moves Estranged: Act I to the experimental section.

* Estranged Act 1: Mark as hidden

---------

Co-authored-by: Jasper St. Pierre <[email protected]>
  • Loading branch information
alanedwardes and magcius authored Oct 25, 2024
1 parent 9d84c00 commit 6b56671
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
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

0 comments on commit 6b56671

Please sign in to comment.