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
|
|
|
*/
|
2018-12-30 17:00:38 -08:00
|
|
|
|
2022-12-13 17:52:20 -08:00
|
|
|
/*!QUAKED func_wall (0 .5 .8) ?
|
|
|
|
# OVERVIEW
|
2021-07-14 02:49:30 -07:00
|
|
|
Brush that lets light to pass through it.
|
|
|
|
|
2022-12-13 17:52:20 -08:00
|
|
|
# KEYS
|
|
|
|
- "targetname" : Name
|
2019-09-06 20:37:06 -07:00
|
|
|
|
2022-12-13 17:52:20 -08:00
|
|
|
# NOTES
|
2019-09-06 20:37:06 -07:00
|
|
|
On idTech 2 BSPs, it will change texture variants when triggered.
|
2020-10-25 04:38:41 -07:00
|
|
|
|
2022-12-13 17:52:20 -08:00
|
|
|
# TRIVIA
|
2020-10-25 04:38:41 -07:00
|
|
|
This entity was introduced in Quake (1996).
|
2019-09-06 20:37:06 -07:00
|
|
|
*/
|
2021-04-10 00:35:06 -07:00
|
|
|
class
|
2021-10-19 16:18:36 -07:00
|
|
|
func_wall:NSRenderableEntity
|
2018-12-30 17:00:38 -08:00
|
|
|
{
|
2022-12-06 15:04:07 -08:00
|
|
|
public:
|
|
|
|
void func_wall(void);
|
2020-09-18 05:57:52 -07:00
|
|
|
|
2021-04-10 00:35:06 -07:00
|
|
|
#ifdef SERVER
|
2022-12-06 15:04:07 -08:00
|
|
|
virtual void Respawn(void);
|
|
|
|
virtual float SendEntity(entity,float);
|
2022-12-14 16:51:16 -08:00
|
|
|
virtual void Trigger(entity, triggermode_t);
|
2021-04-10 00:35:06 -07:00
|
|
|
#else
|
2022-12-06 15:04:07 -08:00
|
|
|
virtual void Init(void);
|
2021-04-10 00:35:06 -07:00
|
|
|
#endif
|
2018-12-30 17:00:38 -08:00
|
|
|
};
|
|
|
|
|
2021-04-10 00:35:06 -07:00
|
|
|
#ifdef SERVER
|
|
|
|
/* we're overriding SendEntity so that we don't network func_walls
|
|
|
|
* without a targetname. They'll never experience gameplay changes
|
|
|
|
* and therefore can be handled fully client-side */
|
|
|
|
float
|
|
|
|
func_wall::SendEntity(entity pvsent, float fl)
|
|
|
|
{
|
2022-08-05 19:54:34 -07:00
|
|
|
/* if we have a target name, act norm */
|
|
|
|
if ((GetRenderMode() != RM_NORMAL) || (targetname))
|
2021-10-19 16:18:36 -07:00
|
|
|
return super::SendEntity(pvsent, fl);
|
2021-04-10 00:35:06 -07:00
|
|
|
else
|
2021-05-10 02:33:31 -07:00
|
|
|
return (0);
|
2021-04-10 00:35:06 -07:00
|
|
|
}
|
|
|
|
|
2020-08-07 05:07:38 -07:00
|
|
|
void
|
2022-12-14 16:51:16 -08:00
|
|
|
func_wall::Trigger(entity act, triggermode_t state)
|
2020-08-07 05:07:38 -07:00
|
|
|
{
|
|
|
|
switch (state) {
|
|
|
|
case TRIG_OFF:
|
2020-09-10 05:57:40 -07:00
|
|
|
SetFrame(0);
|
2020-08-07 05:07:38 -07:00
|
|
|
break;
|
|
|
|
case TRIG_ON:
|
2020-09-10 05:57:40 -07:00
|
|
|
SetFrame(1);
|
2020-08-07 05:07:38 -07:00
|
|
|
break;
|
|
|
|
default:
|
2020-09-10 05:57:40 -07:00
|
|
|
SetFrame(1 - frame);
|
2020-08-07 05:07:38 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-18 05:57:52 -07:00
|
|
|
void
|
|
|
|
func_wall::Respawn(void)
|
|
|
|
{
|
|
|
|
/* reset the visual parameters */
|
2021-10-19 16:18:36 -07:00
|
|
|
super::Respawn();
|
2020-09-18 05:57:52 -07:00
|
|
|
|
|
|
|
/* func_wall specifics */
|
|
|
|
SetMovetype(MOVETYPE_PUSH);
|
|
|
|
SetSolid(SOLID_BSP);
|
2021-09-16 08:34:56 -07:00
|
|
|
SetModel(GetSpawnModel());
|
|
|
|
SetOrigin(GetSpawnOrigin());
|
2020-09-18 05:57:52 -07:00
|
|
|
SetFrame(0);
|
2022-01-03 00:23:20 -08:00
|
|
|
ClearAngles();
|
2020-09-18 05:57:52 -07:00
|
|
|
}
|
2021-04-10 00:35:06 -07:00
|
|
|
#else
|
|
|
|
void
|
|
|
|
func_wall::Init(void)
|
|
|
|
{
|
2021-10-19 16:18:36 -07:00
|
|
|
super::Init();
|
2021-04-10 00:35:06 -07:00
|
|
|
|
|
|
|
/* this entity is being controlled by the server, remove it */
|
2022-08-05 19:54:34 -07:00
|
|
|
if ((GetRenderMode() != RM_NORMAL) && (targetname)) {
|
2022-01-10 13:17:36 -08:00
|
|
|
Destroy();
|
2021-04-10 00:35:06 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
precache_model(model);
|
2022-08-05 21:15:19 -07:00
|
|
|
SetModel(model);
|
|
|
|
SetOrigin(origin);
|
|
|
|
SetAngles([0,0,0]);
|
|
|
|
SetMovetype(MOVETYPE_NONE);
|
2022-08-11 14:18:28 -07:00
|
|
|
SetSolid(SOLID_BSP);
|
2021-08-07 22:47:20 -07:00
|
|
|
|
2021-05-16 14:08:08 -07:00
|
|
|
MakeStatic();
|
2021-04-10 00:35:06 -07:00
|
|
|
}
|
|
|
|
#endif
|
2020-09-18 05:57:52 -07:00
|
|
|
|
2020-08-07 05:07:38 -07:00
|
|
|
void
|
|
|
|
func_wall::func_wall(void)
|
2018-12-30 17:00:38 -08:00
|
|
|
{
|
2022-08-05 19:54:34 -07:00
|
|
|
#ifdef CLIENT
|
|
|
|
isCSQC = true;
|
|
|
|
#endif
|
2018-12-30 17:00:38 -08:00
|
|
|
}
|