Nuclide
Software Development Kit for id Technology (BETA)
Spectator.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} ncSpectatorFlags_t;
26
27
28
29#ifdef CLIENT
30string g_specmodes[] = {
31 "Death Cam",
32 "Locked Chase Cam",
33 "Free Chase Cam",
34 "Free Look",
35 "First Person",
36 "Free Overview",
37 "Chase Overview"
38};
39#endif
40
42{
43 SPECFLAG_BUTTON_RELEASED,
44};
45
58class
60{
61public:
62 void ncSpectator(void);
63
64 /* overrides */
65 virtual void ProcessInput(void);
66 virtual void PreFrame(void);
67 virtual void PostFrame(void);
68 virtual bool IsFakeSpectator(void);
69 virtual bool IsRealSpectator(void);
70 virtual bool IsDead(void);
71 virtual bool IsPlayer(void);
72 virtual void SharedInputFrame(void);
73
75 virtual void InputNext(void);
77 virtual void InputPrevious(void);
79 virtual void InputMode(void);
81 nonvirtual void Unspectate(void);
82 virtual void OnRemoveEntity(void);
83 virtual void Respawn(void);
84
87 virtual void WarpToTarget(void);
88
90 virtual void SpectatorTrackPlayer(void);
91
92#ifdef CLIENT
93 virtual void ClientInputFrame(void);
94 virtual void ReceiveEntity(float,float);
95 virtual float predraw(void);
96#endif
97
98#ifdef SERVER
99 virtual void Save(float);
100 virtual void Restore(string,string);
101 virtual void EvaluateEntity(void);
102 virtual float SendEntity(entity,float);
103 virtual void ServerInputFrame(void);
104
105 nonvirtual void SpectatorDeathcam(ncRenderableEntity, ncEntity, float);
106#endif
107
108private:
109 NETWORKED_FLOAT(m_spectatingEntity)
110 NETWORKED_FLOAT(m_spectatingFlags)
111 ncSpectatorMode_t m_spectatingMode; ncSpectatorMode_t m_spectatingMode_net;
112 float m_flDeathCam;
113 float m_flLastSpecTargetChange;
114 vector spec_org;
115 int sequence;
116};
117
118#ifdef CLIENT
119void Spectator_ReadEntity(float new);
120#endif
This entity class is the lowest client/player class.
Definition: Client.h:34
ncEntity is the lowest of the user-accessible entity class.
Definition: Entity.h:75
This entity represents any ncEntity with advanced rendering properties.
Definition: RenderableEntity.h:94
This entity class represents every spectator client.
Definition: Spectator.h:60
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)
virtual void ReceiveEntity(float, float)
Client: Handles network updates from the server for the associated entity.
typedef enumflags
Defines the valid alignment flags for text fields.
Definition: font.h:37