Nuclide
Software Development Kit for id Technology
NSPortal.h
1/*
2 * Copyright (c) 2016-2022 Vera Visions LLC.
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
13 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
14 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*/
16
17typedef enumflags
18{
19 PORTALFL_CHANGED_ORIGIN_X,
20 PORTALFL_CHANGED_ORIGIN_Y,
21 PORTALFL_CHANGED_ORIGIN_Z,
22 PORTALFL_CHANGED_ANGLES_X,
23 PORTALFL_CHANGED_ANGLES_Y,
24 PORTALFL_CHANGED_ANGLES_Z,
25 PORTALFL_CHANGED_TARG_ENTITY,
26 PORTALFL_CHANGED_TARG_ORIGIN_X,
27 PORTALFL_CHANGED_TARG_ORIGIN_Y,
28 PORTALFL_CHANGED_TARG_ORIGIN_Z,
29 PORTALFL_CHANGED_TARG_ANGLES_X,
30 PORTALFL_CHANGED_TARG_ANGLES_Y,
31 PORTALFL_CHANGED_TARG_ANGLES_Z,
32 PORTALFL_CHANGED_ENABLED,
33 PORTALFL_CHANGED_MODELINDEX
34} nsportal_changed_t;
35
36class
38{
39 void NSPortal(void);
40
41 nonvirtual void _PortalUpdated(void);
42 nonvirtual vector _OriginTransform(vector);
43 nonvirtual vector _DirectionTransform(vector);
44
46 virtual vector camera_transform(vector, vector);
47
48#ifdef SERVER
49 virtual void Save(float);
50 virtual void Restore(string,string);
51
52 virtual void EvaluateEntity(void);
53 virtual float SendEntity(entity, float);
54
55 virtual void PortalWasClosed(void);
56 virtual void PortalWasOpened(void);
57
59 nonvirtual void SetPortalID(int);
61 nonvirtual bool PortalLinkTo(NSPortal, bool);
63 nonvirtual void PortalAutoLink(bool);
65 nonvirtual void PortalClose(void);
67 nonvirtual void SetPortalModel(string);
68#endif
69#ifdef CLIENT
70 virtual void ReceiveEntity(float, float);
71 virtual float predraw(void);
72#endif
73
74private:
75 NSPortal m_ePortalTarget;
76 NSPortal m_ePortalTarget_net;
77 NETWORKED_VECTOR(m_vecTargetPos)
78 NETWORKED_VECTOR(m_vecTargetAngle)
79 NETWORKED_BOOL(m_bEnabled)
80 NETWORKED_FLOAT(m_flPortalModel)
81
82 vector m_vecPortalPos;
83 vector m_vecPortalN;
84 vector m_vecPortalS;
85 vector m_vecPortalT;
86
87 bool m_bWasEnabled;
88
90 nonvirtual void TransportEntity(NSEntity);
91
92 vector m_vecTargetPos;
93 vector m_vecTargetN;
94 vector m_vecTargetS;
95 vector m_vecTargetT;
96
97#ifdef CLIENT
98 float m_flSize;
99#endif
100
101#ifdef SERVER
102 int m_iPortalValue;
103#endif
104
105 int m_brushNum;
106};
107
108#ifdef CLIENT
109#define READENTITY_PORTAL(field, changedflag) {\
110 if (flChanged & changedflag) {\
111 field = (NSPortal)findfloat(world, ::entnum, readentitynum());\
112 PRINTFLAG(changedflag); \
113 }\
114}
115#endif
116
117#define SOLID_PORTAL 21
118
119.float portalnum;
120.float impulse; //used as the radius for the solid_portal csg subtraction
121.bool isPortal;
NSEntity is the lowest of the user-accessible entity class.
Definition: NSEntity.h:54
Definition: NSPortal.h:38
typedef enumflags
Defines the valid alignment flags for text fields.
Definition: font.h:37