From 6d91be2bb4b7d098ab9ab1387bbe40b93e86651a Mon Sep 17 00:00:00 2001
From: "Jasper St. Pierre" <jstpierre@mecheye.net>
Date: Fri, 22 Nov 2024 19:11:45 -0800
Subject: [PATCH] Half Life 2: Upgrade to 2024 edition

Improved HDR and other things.
---
 src/SourceEngine/Scenes_FileDrops.ts          |  4 ----
 src/SourceEngine/Scenes_HalfLife2.ts          | 14 +++++++-------
 src/SourceEngine/Scenes_HalfLife2Ep1.ts       | 14 ++++++++------
 src/SourceEngine/Scenes_HalfLife2Ep2.ts       | 17 ++++++++++-------
 src/SourceEngine/Scenes_HalfLife2LostCoast.ts | 14 ++++++++------
 5 files changed, 33 insertions(+), 30 deletions(-)

diff --git a/src/SourceEngine/Scenes_FileDrops.ts b/src/SourceEngine/Scenes_FileDrops.ts
index 9ac5bdfab..6d890de8b 100644
--- a/src/SourceEngine/Scenes_FileDrops.ts
+++ b/src/SourceEngine/Scenes_FileDrops.ts
@@ -10,7 +10,6 @@ export async function createKitchenSinkSourceFilesytem(dataFetcher: DataFetcher)
     const filesystem = new SourceFileSystem(dataFetcher);
     // Mount all the things!
     await Promise.all([
-        // filesystem.createVPKMount(`CounterStrikeGO/pak01`),
         filesystem.createVPKMount(`CounterStrikeSource/cstrike_pak`),
         filesystem.createVPKMount(`TeamFortress2/tf/tf2_textures`),
         filesystem.createVPKMount(`TeamFortress2/tf/tf2_misc`),
@@ -19,9 +18,6 @@ export async function createKitchenSinkSourceFilesytem(dataFetcher: DataFetcher)
         filesystem.createVPKMount(`Portal2/portal2_dlc2/pak01`),
         filesystem.createVPKMount(`Portal/portal_pak`),
         filesystem.createVPKMount(`GarrysMod/garrysmod`),
-        // filesystem.createGMAMount(`GarrysMod/YukiTheater/base-content.gma`),
-        // filesystem.createGMAMount(`GarrysMod/YukiTheater/social-content.gma`),
-        // filesystem.createGMAMount(`GarrysMod/YukiTheater/content.gma`),
         filesystem.createVPKMount(`HalfLife2Ep1/ep1_pak`),
         filesystem.createVPKMount(`HalfLife2Ep2/ep2_pak`),
         filesystem.createVPKMount(`HalfLife2DM/hl2mp_pak`),
diff --git a/src/SourceEngine/Scenes_HalfLife2.ts b/src/SourceEngine/Scenes_HalfLife2.ts
index 0f616f0e4..691ee2caa 100644
--- a/src/SourceEngine/Scenes_HalfLife2.ts
+++ b/src/SourceEngine/Scenes_HalfLife2.ts
@@ -1,30 +1,30 @@
-
 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 pathRoot = `HalfLife2_2024`;
+const pathHL2 = `${pathRoot}/hl2`;
+
 class HalfLife2SceneDesc 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 = await context.dataShare.ensureObject(`${pathHL2}/SourceFileSystem`, async () => {
             const filesystem = new SourceFileSystem(context.dataFetcher);
             await Promise.all([
-                filesystem.createVPKMount(`${pathBase}/hl2_textures`),
-                filesystem.createVPKMount(`${pathBase}/hl2_misc`),
+                filesystem.createVPKMount(`${pathHL2}/hl2_textures`),
+                filesystem.createVPKMount(`${pathHL2}/hl2_misc`),
             ]);
             return filesystem;
         });
 
         const loadContext = new SourceLoadContext(filesystem);
-        return createScene(context, loadContext, this.id, `${pathBase}/maps/${this.id}.bsp`);
+        return createScene(context, loadContext, this.id, `${pathHL2}/maps/${this.id}.bsp`);
     }
 }
 
-const pathBase = `HalfLife2`;
-
 const id = 'HalfLife2';
 const name = 'Half-Life 2';
 // https://developer.valvesoftware.com/wiki/Half-Life_2_map_reference
diff --git a/src/SourceEngine/Scenes_HalfLife2Ep1.ts b/src/SourceEngine/Scenes_HalfLife2Ep1.ts
index 9d9c30970..9545ec1ee 100644
--- a/src/SourceEngine/Scenes_HalfLife2Ep1.ts
+++ b/src/SourceEngine/Scenes_HalfLife2Ep1.ts
@@ -4,25 +4,27 @@ import { SceneContext, SceneDesc, SceneGroup } from "../SceneBase.js";
 import { SourceFileSystem, SourceLoadContext } from "./Main.js";
 import { createScene } from "./Scenes.js";
 
-const pathBase = `HalfLife2Ep1`;
+const pathRoot = `HalfLife2_2024`;
+const pathHL2 = `${pathRoot}/hl2`;
+const pathEp1 = `${pathRoot}/episodic`;
 
 class HalfLife2Ep1SceneDesc 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 = await context.dataShare.ensureObject(`${pathEp1}/SourceFileSystem`, async () => {
             const filesystem = new SourceFileSystem(context.dataFetcher);
             await Promise.all([
-                filesystem.createVPKMount(`${pathBase}/ep1_pak`),
-                filesystem.createVPKMount(`HalfLife2/hl2_textures`),
-                filesystem.createVPKMount(`HalfLife2/hl2_misc`),
+                filesystem.createVPKMount(`${pathEp1}/ep1_pak`),
+                filesystem.createVPKMount(`${pathHL2}/hl2_textures`),
+                filesystem.createVPKMount(`${pathHL2}/hl2_misc`),
             ]);
             return filesystem;
         });
 
         const loadContext = new SourceLoadContext(filesystem);
-        return createScene(context, loadContext, this.id, `${pathBase}/maps/${this.id}.bsp`);
+        return createScene(context, loadContext, this.id, `${pathEp1}/maps/${this.id}.bsp`);
     }
 }
 
diff --git a/src/SourceEngine/Scenes_HalfLife2Ep2.ts b/src/SourceEngine/Scenes_HalfLife2Ep2.ts
index 6c00b9372..f4ba15fff 100644
--- a/src/SourceEngine/Scenes_HalfLife2Ep2.ts
+++ b/src/SourceEngine/Scenes_HalfLife2Ep2.ts
@@ -4,26 +4,29 @@ import { SceneContext, SceneDesc, SceneGroup } from "../SceneBase.js";
 import { SourceFileSystem, SourceLoadContext } from "./Main.js";
 import { createScene } from "./Scenes.js";
 
-const pathBase = `HalfLife2Ep2`;
+const pathRoot = `HalfLife2_2024`;
+const pathHL2 = `${pathRoot}/hl2`;
+const pathEp1 = `${pathRoot}/episodic`;
+const pathEp2 = `${pathRoot}/ep2`;
 
 class HalfLife2Ep2SceneDesc 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 = await context.dataShare.ensureObject(`${pathEp2}/SourceFileSystem`, async () => {
             const filesystem = new SourceFileSystem(context.dataFetcher);
             await Promise.all([
-                filesystem.createVPKMount(`HalfLife2Ep2/ep2_pak`),
-                filesystem.createVPKMount(`HalfLife2Ep1/ep1_pak`),
-                filesystem.createVPKMount(`HalfLife2/hl2_textures`),
-                filesystem.createVPKMount(`HalfLife2/hl2_misc`),
+                filesystem.createVPKMount(`${pathEp2}/ep2_pak`),
+                filesystem.createVPKMount(`${pathEp1}/ep1_pak`),
+                filesystem.createVPKMount(`${pathHL2}/hl2_textures`),
+                filesystem.createVPKMount(`${pathHL2}/hl2_misc`),
             ]);
             return filesystem;
         });
 
         const loadContext = new SourceLoadContext(filesystem);
-        return createScene(context, loadContext, this.id, `${pathBase}/maps/${this.id}.bsp`);
+        return createScene(context, loadContext, this.id, `${pathEp2}/maps/${this.id}.bsp`);
     }
 }
 
diff --git a/src/SourceEngine/Scenes_HalfLife2LostCoast.ts b/src/SourceEngine/Scenes_HalfLife2LostCoast.ts
index d709535a2..a7b1b4553 100644
--- a/src/SourceEngine/Scenes_HalfLife2LostCoast.ts
+++ b/src/SourceEngine/Scenes_HalfLife2LostCoast.ts
@@ -4,25 +4,27 @@ import { SceneContext, SceneDesc, SceneGroup } from "../SceneBase.js";
 import { SourceFileSystem, SourceLoadContext } from "./Main.js";
 import { createScene } from "./Scenes.js";
 
-const pathBase = `HalfLife2LostCoast`;
+const pathRoot = `HalfLife2_2024`;
+const pathHL2 = `${pathRoot}/hl2`;
+const pathLostCoast = `${pathRoot}/lostcoast`;
 
 class HalfLife2LostCoastSceneDesc 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 = await context.dataShare.ensureObject(`${pathLostCoast}/SourceFileSystem`, async () => {
             const filesystem = new SourceFileSystem(context.dataFetcher);
             await Promise.all([
-                filesystem.createVPKMount(`${pathBase}/lostcoast_pak`),
-                filesystem.createVPKMount(`HalfLife2/hl2_textures`),
-                filesystem.createVPKMount(`HalfLife2/hl2_misc`),
+                filesystem.createVPKMount(`${pathLostCoast}/lostcoast_pak`),
+                filesystem.createVPKMount(`${pathHL2}/hl2_textures`),
+                filesystem.createVPKMount(`${pathHL2}/hl2_misc`),
             ]);
             return filesystem;
         });
 
         const loadContext = new SourceLoadContext(filesystem);
-        return createScene(context, loadContext, this.id, `${pathBase}/maps/${this.id}.bsp`);
+        return createScene(context, loadContext, this.id, `${pathLostCoast}/maps/${this.id}.bsp`);
     }
 }