Nuclide
Software Development Kit for id Tech
NSVehicle.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016-2024 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
18void
19_NSVehicle_Log(string className, string functionName, float edictNum, string warnMessage)
20{
22 printf("^9%f ^2%s (%d) ^7: %s\n", time, functionName, edictNum, warnMessage);
23 else
24 printf("^2%s (%d) ^7: %s\n", functionName, edictNum, warnMessage);
25}
26#define NSVehicle_Log(...) if (autocvar_vehicle_developer == true) _NSVehicle_Log(classname, __FUNC__, num_for_edict(this), sprintf(__VA_ARGS__))
27
30{
31private:
32 int m_iVehicleFlags;
33 int m_iMoveButtons;
34 vector m_vecMoveValues;
35 NSEntity m_eDriver;
36 NSEntity m_eDriver_net;
37 NSEntity m_eDriverLast;
38 vector m_vecPlayerPos;
39 vector m_vecExitPos;
40
41 /* FIXME: Aren't those already defined in parent classes? */
44 PREDICTED_VECTOR_N(velocity)
45
46#ifdef CLIENT
47 PREDICTED_FLOAT(driver_entnum)
48#endif
49
50public:
51 void NSVehicle(void);
52
53#ifdef CLIENT
54 virtual void DriverRelink(void);
55 virtual bool IsLocalDriver(void);
56 virtual void PredictPreFrame(void);
57 virtual void PredictPostFrame(void);
58 virtual void ReceiveEntity(float,float);
59 virtual void UpdateView(void);
60 virtual bool HideViewWeapon(void);
61 virtual bool HideCrosshair(void);
62 virtual bool HidePlayermodel(void);
63#endif
64
65#ifdef SERVER
66 nonvirtual vector GetExitPos(void);
67 virtual void EvaluateEntity(void);
68 virtual float SendEntity(entity,float);
69 virtual void Save(float);
70 virtual void Restore(string,string);
71#endif
72
73 nonvirtual entity GetDriver(void);
74 virtual void PlayerUpdateFlags(void);
75 virtual void PlayerAlign(void);
76 virtual void PlayerEnter(NSClientPlayer);
77 virtual void PlayerLeave(NSClientPlayer);
78 virtual void PlayerInput(void);
79 virtual float DriverAnimation(void);
80
81 virtual bool CanDriverCrouch(void);
82 virtual bool PreventPlayerMovement(void);
83 virtual bool PreventPlayerFire(void);
84};
85
87{
88 VEHFL_CHANGED_ORIGIN,
89 VEHFL_CHANGED_ANGLES,
90 VEHFL_CHANGED_MODELINDEX,
91 VEHFL_CHANGED_SOLID,
92 VEHFL_CHANGED_MOVETYPE,
93 VEHFL_CHANGED_SIZE,
94 VEHFL_CHANGED_VELOCITY,
95 VEHFL_CHANGED_DRIVER
96};
97
99{
100 VHF_FROZEN,
101 VHF_NOATTACK
102};
var bool autocvar_vehicle_developer
Definition: NSVehicle.h:17
void _NSVehicle_Log(string className, string functionName, float edictNum, string warnMessage)
Definition: NSVehicle.h:19
enumflags
Definition: NSVehicle.h:87
This entity class represents every player client.
Definition: NSClientPlayer.h:26
NSEntity is the lowest of the user-accessible entity class.
Definition: NSEntity.h:52
This entity represents an NSRenderableEntity with interactive surface properties.
Definition: NSSurfacePropEntity.h:49
This entity class represents vehicles that are predicted across the network.
Definition: NSVehicle.h:30
virtual void ReceiveEntity(float, float)
Client: Handles network updates from the server for the associated entity.
Definition: NSVehicle.qc:176
virtual void Save(float)
Handles saving a copy of this entity to a given filehandle.
Definition: NSVehicle.qc:31
virtual float DriverAnimation(void)
Definition: NSVehicle.qc:93
virtual void PlayerEnter(NSClientPlayer)
Definition: NSVehicle.qc:424
void NSVehicle(void)
Definition: NSVehicle.qc:18
virtual void PlayerLeave(NSClientPlayer)
Definition: NSVehicle.qc:449
virtual void PlayerUpdateFlags(void)
Definition: NSVehicle.qc:396
virtual void PredictPostFrame(void)
Definition: NSVehicle.qc:163
virtual bool CanDriverCrouch(void)
Definition: NSVehicle.qc:75
virtual float SendEntity(entity, float)
Called by the engine whenever we need to send a client an update about this entity.
virtual bool HideCrosshair(void)
Definition: NSVehicle.qc:111
virtual void Restore(string, string)
Similar to ::SpawnKey but for save-game fields.
Definition: NSVehicle.qc:44
nonvirtual vector GetExitPos(void)
virtual void EvaluateEntity(void)
Run each tic after physics are run to determine if we need to send updates over the network.
virtual bool IsLocalDriver(void)
Definition: NSVehicle.qc:134
virtual bool PreventPlayerFire(void)
Definition: NSVehicle.qc:87
virtual void DriverRelink(void)
Definition: NSVehicle.qc:122
virtual void PredictPreFrame(void)
Definition: NSVehicle.qc:150
virtual bool HidePlayermodel(void)
Definition: NSVehicle.qc:116
virtual void PlayerAlign(void)
Definition: NSVehicle.qc:406
virtual void UpdateView(void)
Definition: NSVehicle.qc:145
virtual bool PreventPlayerMovement(void)
Definition: NSVehicle.qc:81
nonvirtual entity GetDriver(void)
Definition: NSVehicle.qc:99
virtual bool HideViewWeapon(void)
Definition: NSVehicle.qc:106
virtual void PlayerInput(void)
Definition: NSVehicle.qc:390
float time
Definition: fteextensions.qc:509
vector(vector) normalize
entity() spawn
#define printf(...)
Definition: global.h:20
var bool autocvar_g_developerTimestamps
Definition: global.h:18
#define PREDICTED_FLOAT(x)
Definition: defs.h:31
#define PREDICTED_VECTOR_N(x)
Definition: defs.h:39
noref vector angles
Definition: ui_3dview.qc:18
noref vector origin
Definition: ui_3dview.qc:17