2019-08-31 19:18:15 -07:00
|
|
|
/*
|
2021-07-03 03:42:33 -07:00
|
|
|
* Copyright (c) 2016-2021 Marco Hladik <marco@icculus.org>
|
2019-08-31 19:18:15 -07:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
|
|
|
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
2019-03-14 12:13:02 -07:00
|
|
|
|
2021-07-03 03:42:33 -07:00
|
|
|
/*QUAKED worldspawn (0 0 0) ?
|
2021-07-14 02:49:30 -07:00
|
|
|
Only used for the world.
|
|
|
|
|
|
|
|
-------- KEYS --------
|
2021-07-17 12:04:34 -07:00
|
|
|
"message" : Full name of the map.
|
|
|
|
"author" : Author of the map.
|
|
|
|
"chaptertitle" : Titles entry to display when entering the level.
|
|
|
|
"sounds" : CD track to play.
|
|
|
|
"_fog" : Fog in the playable area. Format: (density red green blue alpha depthbias)
|
|
|
|
"_skyroomfog" : Fog in the skybox area. Format: (density red green blue alpha depthbias)
|
|
|
|
"skyname" : Which skybox to use. (e.g. textures/skies/sundown)
|
|
|
|
"ambientsound" : Sound shader to play in the background (looping) for when other env_soundscape entities are NOT active.
|
|
|
|
"hdr_iris_minvalue" : Minimum HDR brightness adjustment. Default is "0.0".
|
|
|
|
"hdr_iris_maxvalue" : Maximum HDR brightness adjustment. Default is "2.0".
|
|
|
|
"hdr_iris_multiplier" : HDR effect multiplier. Default is "1.0".
|
|
|
|
"hdr_iris_fade_up" : HDR iris fade up speed. Default is "0.1".
|
|
|
|
"hdr_iris_fade_down" : HDR iris fade down speed. Default is "0.5".
|
|
|
|
|
|
|
|
-------- NOTES --------
|
|
|
|
A map must only have one worldspawn entity.
|
|
|
|
Every game can have varying key definitions for the worldspawn entity.
|
|
|
|
It's also not affected by "killtarget".
|
2021-07-03 03:42:33 -07:00
|
|
|
|
2021-07-14 02:49:30 -07:00
|
|
|
-------- TRIVIA --------
|
|
|
|
This entity was introduced in Quake (1996).
|
2021-07-03 03:42:33 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef CLIENT
|
2020-03-08 01:59:46 -08:00
|
|
|
/* High Dynamic Range - Iris Adaption */
|
|
|
|
var float g_flHDRIrisMinValue = 0.0;
|
2020-03-29 02:21:26 -07:00
|
|
|
var float g_flHDRIrisMaxValue = 2.0;
|
|
|
|
var float g_flHDRIrisMultiplier = 1.0;
|
2020-03-08 01:59:46 -08:00
|
|
|
var float g_flHDRIrisFadeUp = 0.1;
|
|
|
|
var float g_flHDRIrisFadeDown = 0.5;
|
2020-11-30 03:32:41 -08:00
|
|
|
var int g_iHDREnabled = 0;
|
2020-03-08 01:59:46 -08:00
|
|
|
|
2021-10-19 16:18:36 -07:00
|
|
|
class worldspawn:NSEntity
|
2019-03-14 12:13:02 -07:00
|
|
|
{
|
2021-10-19 16:18:36 -07:00
|
|
|
void(void) worldspawn;
|
|
|
|
|
2019-03-14 12:13:02 -07:00
|
|
|
virtual void(string, string) SpawnKey;
|
2020-04-12 06:50:42 -07:00
|
|
|
virtual void(void) Initialized;
|
2019-03-14 12:13:02 -07:00
|
|
|
};
|
|
|
|
|
2021-10-19 16:18:36 -07:00
|
|
|
void
|
|
|
|
worldspawn::Initialized(void)
|
2019-03-14 12:13:02 -07:00
|
|
|
{
|
2020-04-12 06:50:42 -07:00
|
|
|
g_vecSunDir = [90,0];
|
2020-11-30 03:32:41 -08:00
|
|
|
|
|
|
|
if (g_iHDREnabled)
|
|
|
|
cvar_set("r_hdr_irisadaptation", "1");
|
|
|
|
else
|
|
|
|
cvar_set("r_hdr_irisadaptation", "0");
|
|
|
|
|
|
|
|
cvar_set("r_hdr_irisadaptation_minvalue", ftos(g_flHDRIrisMinValue));
|
|
|
|
cvar_set("r_hdr_irisadaptation_maxvalue", ftos(g_flHDRIrisMaxValue));
|
|
|
|
cvar_set("r_hdr_irisadaptation_multiplier", ftos(g_flHDRIrisMultiplier));
|
|
|
|
cvar_set("r_hdr_irisadaptation_fade_up", ftos(g_flHDRIrisFadeUp));
|
|
|
|
cvar_set("r_hdr_irisadaptation_fade_down", ftos(g_flHDRIrisFadeDown));
|
|
|
|
|
2019-03-14 12:13:02 -07:00
|
|
|
remove(this);
|
|
|
|
}
|
|
|
|
|
2021-10-19 16:18:36 -07:00
|
|
|
void
|
|
|
|
worldspawn::SpawnKey(string strField, string strKey)
|
2019-03-14 12:13:02 -07:00
|
|
|
{
|
|
|
|
switch (strField) {
|
2020-03-26 15:07:13 -07:00
|
|
|
case "chaptertitle":
|
2021-01-02 12:22:56 -08:00
|
|
|
GameMessage_Setup(strKey, 0);
|
2020-03-26 15:07:13 -07:00
|
|
|
break;
|
2020-03-08 01:59:46 -08:00
|
|
|
case "ambientsound":
|
|
|
|
if (g_ambientsound) {
|
2019-03-14 12:13:02 -07:00
|
|
|
break;
|
2020-03-08 01:59:46 -08:00
|
|
|
}
|
|
|
|
g_ambientsound = spawn(env_soundscape);
|
|
|
|
g_ambientsound.m_iShader = Sound_Precache(strKey);
|
|
|
|
break;
|
2020-04-29 20:58:17 -07:00
|
|
|
#ifdef HHDEATH
|
|
|
|
case "_bgm":
|
|
|
|
localcmd(sprintf("music sound/bgm/%s.mp3\n", strKey));
|
|
|
|
break;
|
|
|
|
#endif
|
2020-03-08 01:59:46 -08:00
|
|
|
case "hdr_iris_minvalue":
|
|
|
|
g_flHDRIrisMinValue = stof(strKey);
|
2020-11-30 03:32:41 -08:00
|
|
|
g_iHDREnabled = 1;
|
2020-03-08 01:59:46 -08:00
|
|
|
break;
|
|
|
|
case "hdr_iris_maxvalue":
|
|
|
|
g_flHDRIrisMaxValue = stof(strKey);
|
2020-11-30 03:32:41 -08:00
|
|
|
g_iHDREnabled = 1;
|
2020-03-08 01:59:46 -08:00
|
|
|
break;
|
|
|
|
case "hdr_iris_multiplier":
|
|
|
|
g_flHDRIrisMultiplier = stof(strKey);
|
2020-11-30 03:32:41 -08:00
|
|
|
g_iHDREnabled = 1;
|
2020-03-08 01:59:46 -08:00
|
|
|
break;
|
|
|
|
case "hdr_iris_fade_up":
|
|
|
|
g_flHDRIrisFadeUp = stof(strKey);
|
2020-11-30 03:32:41 -08:00
|
|
|
g_iHDREnabled = 1;
|
2020-03-08 01:59:46 -08:00
|
|
|
break;
|
|
|
|
case "hdr_iris_fade_down":
|
|
|
|
g_flHDRIrisFadeDown = stof(strKey);
|
2020-11-30 03:32:41 -08:00
|
|
|
g_iHDREnabled = 1;
|
2020-03-08 01:59:46 -08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2019-03-14 12:13:02 -07:00
|
|
|
}
|
|
|
|
}
|
2021-10-19 16:18:36 -07:00
|
|
|
|
|
|
|
void
|
|
|
|
worldspawn::worldspawn(void)
|
|
|
|
{
|
|
|
|
super::NSEntity();
|
|
|
|
}
|
2021-07-03 03:42:33 -07:00
|
|
|
#endif
|