From 753fc61a538e9e733297b12ae8762de098a077ec Mon Sep 17 00:00:00 2001 From: Ian Date: Wed, 23 Nov 2022 09:27:48 -0500 Subject: [PATCH] Client: Add a check if the client is being ran in a web browser. Will allow for certain features to be hidden/displayed specified to the web client. --- source/client/defs/custom.qc | 2 ++ source/client/main.qc | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/source/client/defs/custom.qc b/source/client/defs/custom.qc index 592bda3..3932ab9 100644 --- a/source/client/defs/custom.qc +++ b/source/client/defs/custom.qc @@ -196,6 +196,8 @@ float screen_height_169[MAX_169]; float screen_width_219[MAX_219]; float screen_height_219[MAX_219]; +int platform_is_web; + //controller buttons /* diff --git a/source/client/main.qc b/source/client/main.qc index 9ad56e8..8c82c27 100644 --- a/source/client/main.qc +++ b/source/client/main.qc @@ -70,6 +70,12 @@ noref void(float apiver, string enginename, float enginever) CSQC_Init = registercommand("showscores"); cvar_set("sv_cheats", ftos(1)); + + // Runtime check if we're running this in WebASM/WebGL. + if (cvar_string("sys_platform") == "Web") + platform_is_web = true; + else + platform_is_web = false; //print("CSQC Started\n"); dummy = spawn();