2019-08-31 19:18:15 -07:00
|
|
|
/*
|
2022-07-07 09:10:14 -07:00
|
|
|
* Copyright (c) 2016-2022 Vera Visions LLC.
|
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.
|
2022-07-07 09:10:14 -07:00
|
|
|
*/
|
2019-03-14 12:13:02 -07:00
|
|
|
|
2021-07-03 03:42:33 -07:00
|
|
|
#ifdef CLIENT
|
2020-03-08 01:59:46 -08:00
|
|
|
/* High Dynamic Range - Iris Adaption */
|
2022-05-04 17:22:43 -07:00
|
|
|
var float g_flHDRIrisMinValue = 1.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
|
|
|
|
2022-12-13 17:52:20 -08:00
|
|
|
/*!QUAKED worldspawn (0 0 0) ?
|
|
|
|
# OVERVIEW
|
|
|
|
Only used for the world.
|
|
|
|
|
|
|
|
# KEYS
|
2023-03-13 01:29:18 -07:00
|
|
|
- "message" : Full title of the map. (e.g. "Barbie's Domain")
|
2022-12-13 17:52:20 -08:00
|
|
|
- "author" : Author of the map.
|
2023-03-13 01:29:18 -07:00
|
|
|
- "chaptertitle" : Titles.txt entry to display when entering the level.
|
|
|
|
- "sounds" : CD track to play. Numerical value. Most likely starts at '2'.
|
2022-12-13 17:52:20 -08:00
|
|
|
- "_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)
|
2023-03-13 01:29:18 -07:00
|
|
|
- "skyname" : Which skybox to use. (e.g. "textures/skies/sundown")
|
2022-12-13 17:52:20 -08:00
|
|
|
- "ambientsound" : Sound shader to play in the background (looping) for when other env_soundscape entities are NOT active.
|
|
|
|
- "startdark" : Starts the level with a fade in similar to using an env_fade, which lasts for nine seconds.
|
|
|
|
- "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".
|
|
|
|
|
|
|
|
# TRIVIA
|
|
|
|
This entity was introduced in Quake (1996).
|
|
|
|
*/
|
2021-10-19 16:18:36 -07:00
|
|
|
class worldspawn:NSEntity
|
2019-03-14 12:13:02 -07:00
|
|
|
{
|
2022-12-06 15:04:07 -08:00
|
|
|
public:
|
|
|
|
void worldspawn(void);
|
|
|
|
|
|
|
|
virtual void SpawnKey(string,string);
|
|
|
|
virtual void Spawned(void);
|
2019-03-14 12:13:02 -07:00
|
|
|
};
|
|
|
|
|
2023-03-13 01:29:18 -07:00
|
|
|
void
|
|
|
|
worldspawn::worldspawn(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-10-19 16:18:36 -07:00
|
|
|
void
|
2022-06-01 17:38:52 -07:00
|
|
|
worldspawn::Spawned(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
|
|
|
|
2023-03-13 01:29:18 -07:00
|
|
|
super::Spawned();
|
|
|
|
|
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));
|
2023-03-17 11:35:27 -07:00
|
|
|
|
|
|
|
Destroy();
|
2019-03-14 12:13:02 -07:00
|
|
|
}
|
|
|
|
|
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) {
|
2022-01-02 21:04:55 -08:00
|
|
|
case "startdark":
|
2022-01-03 00:23:20 -08:00
|
|
|
if (stof(strKey) == 1)
|
|
|
|
Fade_StartDark();
|
2022-01-02 21:04:55 -08:00
|
|
|
break;
|
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
|
|
|
}
|
|
|
|
}
|
2022-07-07 09:10:14 -07:00
|
|
|
#endif
|