Nuclide
Software Development Kit for id Tech
NSPortal.h
Go to the documentation of this file.
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#ifdef CLIENT
93 vector m_vecTargetPos;
94 vector m_vecTargetN;
95 vector m_vecTargetS;
96 vector m_vecTargetT;
97 float m_flSize;
98#endif
99
100#ifdef SERVER
101 int m_iPortalValue;
102#endif
103
104 int m_brushNum;
105};
106
107#ifdef CLIENT
108#define READENTITY_PORTAL(field, changedflag) {\
109 if (flChanged & changedflag) {\
110 field = (NSPortal)findfloat(world, ::entnum, readentitynum());\
111 PRINTFLAG(changedflag); \
112 }\
113}
114#endif
115
116#define SOLID_PORTAL 21
117
119.float impulse; //used as the radius for the solid_portal csg subtraction
float portalnum
Definition: NSPortal.h:118
bool isPortal
Definition: NSPortal.h:120
float impulse
Definition: NSPortal.h:119
typedef enumflags
Definition: NSPortal.h:18
NSEntity is the lowest of the user-accessible entity class.
Definition: NSEntity.h:54
Definition: NSPortal.h:38
#define NETWORKED_FLOAT(x)
Definition: defs.h:21
#define NETWORKED_VECTOR(x)
Definition: defs.h:22
#define NETWORKED_BOOL(x)
Definition: defs.h:25