From 4d835e773faf089d5fb3d869538416851a3ced85 Mon Sep 17 00:00:00 2001 From: Jayden Kohlman <2236351+JKohlman@users.noreply.github.com> Date: Wed, 11 May 2022 14:40:15 -0600 Subject: [PATCH 1/6] Added submerged cam locations --- src/common/AmongusMap.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/common/AmongusMap.ts b/src/common/AmongusMap.ts index e9697fb60..04ee295f7 100644 --- a/src/common/AmongusMap.ts +++ b/src/common/AmongusMap.ts @@ -24,6 +24,16 @@ export enum CameraLocation { NONE, } +export enum SubmergedCamLocation { + LowerHall, + Electrical, + LowerLobby, + UpperHall, + Central, + Comms, + UpperLobby +} + export interface CamerasMap { [cameraLoc: number]: Vector2; } @@ -68,7 +78,15 @@ export const AmongUsMaps: { [key in MapType]: AmongUsMap } = { }, }, [MapType.SUBMERGED]: { - cameras: {}, + cameras: { + [SubmergedCamLocation.LowerHall]: {x: -2.69, y: -28.45}, + [SubmergedCamLocation.Electrical]: { x: 8.74, y: -24.58}, + [SubmergedCamLocation.LowerLobby]: { x: 8.03, y: -38.03}, + [SubmergedCamLocation.UpperHall]: { x: -10.46, y: 19.67 }, + [SubmergedCamLocation.Central]: { x: 3.22, y: 24.07}, + [SubmergedCamLocation.Comms]: { x: 10, y: 23.48}, + [SubmergedCamLocation.UpperLobby]: { x: 7.09, y: 10.28}, + }, }, [MapType.UNKNOWN]: defaultMap, }; From 79ace8c21b999e2911b50ac43bf622115912f09a Mon Sep 17 00:00:00 2001 From: Jayden Kohlman <2236351+JKohlman@users.noreply.github.com> Date: Wed, 11 May 2022 19:52:50 -0600 Subject: [PATCH 2/6] I think cams should all work? --- src/common/AmongUsState.ts | 4 ++-- src/common/AmongusMap.ts | 9 +++++---- src/main/GameReader.ts | 11 +++++++++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/common/AmongUsState.ts b/src/common/AmongUsState.ts index 6c71e0050..e243a4138 100644 --- a/src/common/AmongUsState.ts +++ b/src/common/AmongUsState.ts @@ -1,4 +1,4 @@ -import { CameraLocation, MapType } from './AmongusMap'; +import { MapType } from './AmongusMap'; import { ModsType } from './Mods'; export interface AmongUsState { @@ -11,7 +11,7 @@ export interface AmongUsState { clientId: number; hostId: number; comsSabotaged: boolean; - currentCamera: CameraLocation; + currentCamera: number; map: MapType; lightRadius: number; lightRadiusChanged: boolean; diff --git a/src/common/AmongusMap.ts b/src/common/AmongusMap.ts index 04ee295f7..3d1ac443b 100644 --- a/src/common/AmongusMap.ts +++ b/src/common/AmongusMap.ts @@ -21,17 +21,18 @@ export enum CameraLocation { SouthWest, // CARGO BAY NorthWest, // MEETING ROOM Skeld, - NONE, + NONE = -1, } -export enum SubmergedCamLocation { - LowerHall, +export enum SubmergedCamLocation { + NONE = -1, + LowerHall = 10, Electrical, LowerLobby, UpperHall, Central, Comms, - UpperLobby + UpperLobby, } export interface CamerasMap { diff --git a/src/main/GameReader.ts b/src/main/GameReader.ts index bad93b918..61621a6d3 100644 --- a/src/main/GameReader.ts +++ b/src/main/GameReader.ts @@ -18,7 +18,7 @@ import { IpcOverlayMessages, IpcRendererMessages } from '../common/ipc-messages' import { GameState, AmongUsState, Player } from '../common/AmongUsState'; import { fetchOffsetLookup, fetchOffsetsJson, IOffsets, IOffsetsLookup } from './offsetStore'; import Errors from '../common/Errors'; -import { CameraLocation, MapType } from '../common/AmongusMap'; +import { CameraLocation, MapType, SubmergedCamLocation } from '../common/AmongusMap'; import { GenerateAvatars, numberToColorHex } from './avatarGenerator'; import { RainbowColorId } from '../renderer/cosmetics'; import { platform } from 'os'; @@ -224,7 +224,7 @@ export default class GameReader { this.isLocalGame = lobbyCodeInt === 32; // is local game let lightRadius = 1; let comsSabotaged = false; - let currentCamera = CameraLocation.NONE; + let currentCamera: number = CameraLocation.NONE; let map = MapType.UNKNOWN; let maxPlayers = 10; const closedDoors: number[] = []; @@ -311,6 +311,7 @@ export default class GameReader { const minigamePtr = this.readMemory('ptr', this.gameAssembly.modBaseAddr, this.offsets!.miniGame); const minigameCachePtr = this.readMemory('ptr', minigamePtr, this.offsets!.objectCachePtr); if (minigameCachePtr && minigameCachePtr !== 0 && localPlayer) { + console.log("In cams minigame?"); if (map === MapType.POLUS || map === MapType.AIRSHIP) { const currentCameraId = this.readMemory( 'uint32', @@ -338,6 +339,12 @@ export default class GameReader { currentCamera = CameraLocation.Skeld; } } + } else if (map === MapType.SUBMERGED) { + const currentCameraId = SubmergedCamLocation.NONE; // TODO: Read from memory + const currentCamDisabled = true; // TODO: Read from memory + if (!currentCamDisabled) { + currentCamera = currentCameraId as SubmergedCamLocation; + } } } if (map !== MapType.MIRA_HQ) { From 9b6935a520f77ab88a2631f04ed4c9c28a37a4fc Mon Sep 17 00:00:00 2001 From: Jayden Kohlman <2236351+JKohlman@users.noreply.github.com> Date: Wed, 11 May 2022 19:54:03 -0600 Subject: [PATCH 3/6] Swapped from default on to default off --- src/main/GameReader.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/GameReader.ts b/src/main/GameReader.ts index 61621a6d3..e62bfd6f9 100644 --- a/src/main/GameReader.ts +++ b/src/main/GameReader.ts @@ -341,8 +341,8 @@ export default class GameReader { } } else if (map === MapType.SUBMERGED) { const currentCameraId = SubmergedCamLocation.NONE; // TODO: Read from memory - const currentCamDisabled = true; // TODO: Read from memory - if (!currentCamDisabled) { + const currentCamEnabled = false; // TODO: Read from memory + if (currentCamEnabled) { currentCamera = currentCameraId as SubmergedCamLocation; } } From c415cbecc21702c06ac1df8a0fedc66dff078de9 Mon Sep 17 00:00:00 2001 From: Jayden Kohlman <2236351+JKohlman@users.noreply.github.com> Date: Wed, 11 May 2022 20:04:03 -0600 Subject: [PATCH 4/6] Added offset to submerged cams --- src/common/AmongusMap.ts | 1 + src/main/GameReader.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/AmongusMap.ts b/src/common/AmongusMap.ts index 3d1ac443b..2ce40c905 100644 --- a/src/common/AmongusMap.ts +++ b/src/common/AmongusMap.ts @@ -26,6 +26,7 @@ export enum CameraLocation { export enum SubmergedCamLocation { NONE = -1, + START = 10, LowerHall = 10, Electrical, LowerLobby, diff --git a/src/main/GameReader.ts b/src/main/GameReader.ts index e62bfd6f9..65266269b 100644 --- a/src/main/GameReader.ts +++ b/src/main/GameReader.ts @@ -343,7 +343,7 @@ export default class GameReader { const currentCameraId = SubmergedCamLocation.NONE; // TODO: Read from memory const currentCamEnabled = false; // TODO: Read from memory if (currentCamEnabled) { - currentCamera = currentCameraId as SubmergedCamLocation; + currentCamera = (currentCameraId + SubmergedCamLocation.START) as SubmergedCamLocation; } } } From 2b6b35170af2de87eaadab9d1732f602233732cf Mon Sep 17 00:00:00 2001 From: Jayden Kohlman <2236351+JKohlman@users.noreply.github.com> Date: Wed, 11 May 2022 20:16:20 -0600 Subject: [PATCH 5/6] Added more verbose comments --- src/main/GameReader.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/GameReader.ts b/src/main/GameReader.ts index 65266269b..fdd4186a9 100644 --- a/src/main/GameReader.ts +++ b/src/main/GameReader.ts @@ -340,8 +340,12 @@ export default class GameReader { } } } else if (map === MapType.SUBMERGED) { - const currentCameraId = SubmergedCamLocation.NONE; // TODO: Read from memory - const currentCamEnabled = false; // TODO: Read from memory + const currentCameraId = SubmergedCamLocation.NONE; + // TODO: Read from memory + // Probably from SubmarineSurvillanceMinigame.SelectedCam int + const currentCamEnabled = false; + // TODO: Read from memory based off of currentCameraId + // Probably from SubmarineSecuritySabotageSystem.FixedCams List if (currentCamEnabled) { currentCamera = (currentCameraId + SubmergedCamLocation.START) as SubmergedCamLocation; } From 180a42ae17a55aa72ba21a6af6a47a4be9de39d6 Mon Sep 17 00:00:00 2001 From: Jayden Kohlman <2236351+JKohlman@users.noreply.github.com> Date: Wed, 11 May 2022 20:22:05 -0600 Subject: [PATCH 6/6] Removed extra print --- src/main/GameReader.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/GameReader.ts b/src/main/GameReader.ts index fdd4186a9..9ffada51d 100644 --- a/src/main/GameReader.ts +++ b/src/main/GameReader.ts @@ -311,7 +311,6 @@ export default class GameReader { const minigamePtr = this.readMemory('ptr', this.gameAssembly.modBaseAddr, this.offsets!.miniGame); const minigameCachePtr = this.readMemory('ptr', minigamePtr, this.offsets!.objectCachePtr); if (minigameCachePtr && minigameCachePtr !== 0 && localPlayer) { - console.log("In cams minigame?"); if (map === MapType.POLUS || map === MapType.AIRSHIP) { const currentCameraId = this.readMemory( 'uint32',