Nuclide
Software Development Kit for id Tech
NSClientSpectator.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 SPECFL_ORIGIN,
20 SPECFL_VELOCITY,
21 SPECFL_TARGET,
22 SPECFL_MODE,
23 SPECFL_FLAGS,
24 SPECFL_TYPE,
25} NSClientSpectatorFlags_t;
26
27typedef enum
28{
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
66{
67private:
68 PREDICTED_FLOAT(spec_ent)
69 PREDICTED_FLOAT(spec_flags)
70 NSClientSpectatorMode_t spec_mode; NSClientSpectatorMode_t spec_mode_net;
71 float m_flDeathCam;
72 float m_flLastSpecTargetChange;
73
74 vector spec_org;
75
76 int sequence;
77
78public:
79 void NSClientSpectator(void);
80
81 /* overrides */
82 virtual void ProcessInput(void);
83 virtual void PreFrame(void);
84 virtual void PostFrame(void);
85 virtual bool IsFakeSpectator(void);
86 virtual bool IsRealSpectator(void);
87 virtual bool IsDead(void);
88 virtual bool IsPlayer(void);
89 virtual void SharedInputFrame(void);
90
92 virtual void InputNext(void);
94 virtual void InputPrevious(void);
96 virtual void InputMode(void);
97
100 virtual void WarpToTarget(void);
101
103 virtual void SpectatorTrackPlayer(void);
104
105#ifdef CLIENT
106 virtual void ClientInputFrame(void);
107 virtual void ReceiveEntity(float,float);
108 virtual float predraw(void);
109#endif
110
111#ifdef SERVER
112 virtual void Save(float);
113 virtual void Restore(string,string);
114 virtual void EvaluateEntity(void);
115 virtual float SendEntity(entity,float);
116 virtual void ServerInputFrame(void);
117
118 nonvirtual void SpectatorDeathcam(NSRenderableEntity, NSEntity, float);
119#endif
120};
121
122#ifdef CLIENT
123void Spectator_ReadEntity(float new);
124#endif
void Spectator_ReadEntity(float new)
Definition: NSClientSpectator.qc:547
string g_specmodes[]
Definition: NSClientSpectator.h:39
NSClientSpectatorMode_t
Definition: NSClientSpectator.h:28
@ SPECMODE_LOCKEDCHASE
Definition: NSClientSpectator.h:30
@ SPECMODE_FREE
Definition: NSClientSpectator.h:32
@ SPECMODE_FREEOVERVIEW
Definition: NSClientSpectator.h:34
@ SPECMODE_DEATHCAM
Definition: NSClientSpectator.h:29
@ SPECMODE_THIRDPERSON
Definition: NSClientSpectator.h:31
@ SPECMODE_FIRSTPERSON
Definition: NSClientSpectator.h:33
@ SPECMODE_CHASEOVERVIEW
Definition: NSClientSpectator.h:35
typedef enumflags
Definition: NSClientSpectator.h:18
This entity class represents every spectator client.
Definition: NSClientSpectator.h:66
virtual void ReceiveEntity(float, float)
Client: Handles network updates from the server for the associated entity.
virtual void InputMode(void)
Call to change the spectating mode.
Definition: NSClientSpectator.qc:401
virtual bool IsRealSpectator(void)
Returns if we're a 'real' spectator.
Definition: NSClientSpectator.qc:42
virtual void InputPrevious(void)
Call to spectate the previous player target.
Definition: NSClientSpectator.qc:321
virtual bool IsDead(void)
Returns if we're considered 'dead'.
Definition: NSClientSpectator.qc:48
virtual void ProcessInput(void)
Called within the class to deal with the final input handling of the client.
Definition: NSClientSpectator.qc:66
virtual void ServerInputFrame(void)
Server: This is where the input* variables arrive after sending them out from the client (see ClientI...
Definition: NSClientSpectator.qc:140
virtual bool IsFakeSpectator(void)
Returns if we're a 'fake' spectator.
Definition: NSClientSpectator.qc:60
virtual void ClientInputFrame(void)
Client: Called on the client to give a chance to override input_* variables before networking them ta...
virtual void SharedInputFrame(void)
Like ClientInputFrame and ServerInputFrame, but run on both client and server at the same time.
Definition: NSClientSpectator.qc:90
virtual void SpectatorTrackPlayer(void)
Called every frame to track with our target player.
Definition: NSClientSpectator.qc:476
virtual void PreFrame(void)
Run once, every frame, before physics are run on the player.
Definition: NSClientSpectator.qc:436
virtual void WarpToTarget(void)
Re-teleport to the target we're spectating.
Definition: NSClientSpectator.qc:82
virtual void PostFrame(void)
Run once, every frame, after physics are run on the player.
Definition: NSClientSpectator.qc:534
nonvirtual void SpectatorDeathcam(NSRenderableEntity, NSEntity, float)
Definition: NSClientSpectator.qc:525
virtual void EvaluateEntity(void)
Run each tic after physics are run to determine if we need to send updates over the network.
Definition: NSClientSpectator.qc:511
void NSClientSpectator(void)
Definition: NSClientSpectator.qc:18
virtual bool IsPlayer(void)
Returns if we're a player.
Definition: NSClientSpectator.qc:54
virtual void Restore(string, string)
Similar to ::SpawnKey but for save-game fields.
Definition: NSClientSpectator.qc:32
virtual float SendEntity(entity, float)
Called by the engine whenever we need to send a client an update about this entity.
Definition: NSClientSpectator.qc:109
virtual void InputNext(void)
Call to spectate the next spectating target.
Definition: NSClientSpectator.qc:244
virtual void Save(float)
Handles saving a copy of this entity to a given filehandle.
Definition: NSClientSpectator.qc:26
virtual float predraw(void)
This entity class is the lowest client/player class.
Definition: NSClient.h:24
NSEntity is the lowest of the user-accessible entity class.
Definition: NSEntity.h:52
This entity represents any NSEntity with advanced rendering properties.
Definition: NSRenderableEntity.h:91
vector(vector) normalize
entity() spawn
#define PREDICTED_FLOAT(x)
Definition: defs.h:31