From 1620d405c6054cf6673521e3ca4fa3d487b9db76 Mon Sep 17 00:00:00 2001 From: Major Cooke Date: Sat, 26 Oct 2024 21:50:18 -0500 Subject: [PATCH] Added OrthographicCamera actor. Arguments are: - 0: Offset. This pushes the camera further away, going behind the camera. Default is 1.0 (converted to negative - the value cannot go lower than that). --- wadsrc/static/mapinfo/common.txt | 1 + wadsrc/static/zscript/actors/shared/camera.zs | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/wadsrc/static/mapinfo/common.txt b/wadsrc/static/mapinfo/common.txt index f079ee6e6e..d61578102c 100644 --- a/wadsrc/static/mapinfo/common.txt +++ b/wadsrc/static/mapinfo/common.txt @@ -78,6 +78,7 @@ DoomEdNums 9081 = SkyPicker 9082 = SectorSilencer 9083 = SkyCamCompat + 9084 = OrthographicCamera 9200 = Decal 9300 = "$PolyAnchor" 9301 = "$PolySpawn" diff --git a/wadsrc/static/zscript/actors/shared/camera.zs b/wadsrc/static/zscript/actors/shared/camera.zs index 463ad61784..40972fa82d 100644 --- a/wadsrc/static/zscript/actors/shared/camera.zs +++ b/wadsrc/static/zscript/actors/shared/camera.zs @@ -212,3 +212,35 @@ class SpectatorCamera : Actor } } } + +Class OrthographicCamera : Actor +{ + Default + { + +NOBLOCKMAP + +NOINTERACTION + CameraHeight 0; + RenderStyle "None"; + } + + override void PostBeginPlay() + { + Super.PostBeginPlay(); + UpdateViewPos(); + } + + override void Tick() + { + if (current != args[0]) + UpdateViewPos(); + + Super.Tick(); + } + + private int current; + private void UpdateViewPos() + { + current = args[0]; + SetViewPos((-abs(max(1.0, double(current))), 0, 0), VPSF_ORTHOGRAPHIC|VPSF_ALLOWOUTOFBOUNDS); + } +}