Nuclide
Software Development Kit for id Technology (BETA)
Portal.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
36#warning Needs documentation
37class
39{
40 void ncPortal(void);
41
42 nonvirtual void _PortalUpdated(void);
43 nonvirtual vector _OriginTransform(vector);
44 nonvirtual vector _DirectionTransform(vector);
45
47 virtual vector camera_transform(vector, vector);
48
49#ifdef SERVER
50 virtual void Save(float);
51 virtual void Restore(string,string);
52
53 virtual void EvaluateEntity(void);
54 virtual float SendEntity(entity, float);
55
56 virtual void PortalWasClosed(void);
57 virtual void PortalWasOpened(void);
58
60 nonvirtual void SetPortalID(int);
62 nonvirtual bool PortalLinkTo(ncPortal, bool);
64 nonvirtual void PortalAutoLink(bool);
66 nonvirtual void PortalClose(void);
68 nonvirtual void SetPortalModel(string);
69#endif
70#ifdef CLIENT
71 virtual void ReceiveEntity(float, float);
72 virtual float predraw(void);
73#endif
74
75private:
76 ncPortal m_ePortalTarget;
77 ncPortal m_ePortalTarget_net;
78 NETWORKED_VECTOR(m_vecTargetPos)
79 NETWORKED_VECTOR(m_vecTargetAngle)
80 NETWORKED_BOOL(m_bEnabled)
81 NETWORKED_FLOAT(m_flPortalModel)
82
83 vector m_vecPortalPos;
84 vector m_vecPortalN;
85 vector m_vecPortalS;
86 vector m_vecPortalT;
87
88 bool m_bWasEnabled;
89
91 nonvirtual void TransportEntity(ncEntity);
92
93 vector m_vecTargetPos;
94 vector m_vecTargetN;
95 vector m_vecTargetS;
96 vector m_vecTargetT;
97
98#ifdef CLIENT
99 float m_flSize;
100#endif
101
102#ifdef SERVER
103 int m_iPortalValue;
104#endif
105
106 int m_brushNum;
107};
108
109#ifdef CLIENT
110#define READENTITY_PORTAL(field, changedflag) {\
111 if (flChanged & changedflag) {\
112 field = (ncPortal)findfloat(world, ::entnum, readentitynum());\
113 PRINTFLAG(changedflag); \
114 }\
115}
116#endif
117
118#define SOLID_PORTAL 21
119
120.float portalnum;
121.float impulse; //used as the radius for the solid_portal csg subtraction
122.bool isPortal;
ncEntity is the lowest of the user-accessible entity class.
Definition: Entity.h:75
Definition: Portal.h:39
typedef enumflags
Defines the valid alignment flags for text fields.
Definition: font.h:37