Nuclide
Software Development Kit for id Technology
NSClientSpectator.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 SPECFL_ORIGIN,
20 SPECFL_VELOCITY,
21 SPECFL_TARGET,
22 SPECFL_MODE,
23 SPECFL_FLAGS,
24 SPECFL_TYPE,
25} NSClientSpectatorFlags_t;
26
27typedef enum
28{
29 SPECMODE_DEATHCAM,
30 SPECMODE_LOCKEDCHASE,
31 SPECMODE_THIRDPERSON,
32 SPECMODE_FREE,
33 SPECMODE_FIRSTPERSON,
34 SPECMODE_FREEOVERVIEW,
35 SPECMODE_CHASEOVERVIEW
36} NSClientSpectatorMode_t;
37
38#ifdef CLIENT
39string g_specmodes[] = {
40 "Death Cam",
41 "Locked Chase Cam",
42 "Free Chase Cam",
43 "Free Look",
44 "First Person",
45 "Free Overview",
46 "Chase Overview"
47};
48#endif
49
51{
52 SPECFLAG_BUTTON_RELEASED,
53};
54
67class
69{
70public:
71 void NSClientSpectator(void);
72
73 /* overrides */
74 virtual void ProcessInput(void);
75 virtual void PreFrame(void);
76 virtual void PostFrame(void);
77 virtual bool IsFakeSpectator(void);
78 virtual bool IsRealSpectator(void);
79 virtual bool IsDead(void);
80 virtual bool IsPlayer(void);
81 virtual void SharedInputFrame(void);
82
84 virtual void InputNext(void);
86 virtual void InputPrevious(void);
88 virtual void InputMode(void);
89
92 virtual void WarpToTarget(void);
93
95 virtual void SpectatorTrackPlayer(void);
96
97#ifdef CLIENT
98 virtual void ClientInputFrame(void);
99 virtual void ReceiveEntity(float,float);
100 virtual float predraw(void);
101#endif
102
103#ifdef SERVER
104 virtual void Save(float);
105 virtual void Restore(string,string);
106 virtual void EvaluateEntity(void);
107 virtual float SendEntity(entity,float);
108 virtual void ServerInputFrame(void);
109
110 nonvirtual void SpectatorDeathcam(NSRenderableEntity, NSEntity, float);
111#endif
112
113private:
114 PREDICTED_FLOAT(spec_ent)
115 PREDICTED_FLOAT(spec_flags)
116 NSClientSpectatorMode_t spec_mode; NSClientSpectatorMode_t spec_mode_net;
117 float m_flDeathCam;
118 float m_flLastSpecTargetChange;
119 vector spec_org;
120 int sequence;
121};
122
123#ifdef CLIENT
124void Spectator_ReadEntity(float new);
125#endif
This entity class represents every spectator client.
Definition: NSClientSpectator.h:69
virtual void ReceiveEntity(float, float)
Client: Handles network updates from the server for the associated entity.
virtual void ClientInputFrame(void)
Client: Called on the client to give a chance to override input_* variables before networking them ta...
virtual float predraw(void)
This entity class is the lowest client/player class.
Definition: NSClient.h:26
NSEntity is the lowest of the user-accessible entity class.
Definition: NSEntity.h:54
This entity represents any NSEntity with advanced rendering properties.
Definition: NSRenderableEntity.h:94
typedef enumflags
Defines the valid alignment flags for text fields.
Definition: font.h:37