From 29a1bea94366dff3aee79a8a17cbb2d70ff8c6f2 Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Tue, 22 Nov 2022 22:37:07 -0800 Subject: [PATCH] Misc consistency cleanups --- src/client/entry.qc | 3 +- src/client/event.qc | 2 + src/gs-entbase/shared/ambient_generic.qc | 10 +-- src/gs-entbase/shared/env_bubbles.qc | 8 +- src/gs-entbase/shared/env_fog_controller.qc | 18 ++--- src/gs-entbase/shared/env_sprite.qc | 4 +- src/gs-entbase/shared/func_vehicle.qc | 2 +- src/gs-entbase/shared/prop_rope.qc | 8 +- .../shared/prop_vehicle_driveable.qc | 2 +- src/server/NSGameRules.qc | 11 +++ src/shared/NSClientPlayer.h | 38 +++++----- src/shared/NSClientSpectator.h | 4 +- src/shared/NSEntity.h | 30 ++++---- src/shared/NSPhysicsEntity.h | 2 +- src/shared/NSRenderableEntity.h | 24 +++--- src/shared/NSVehicle.h | 8 +- src/shared/defs.h | 26 +++---- src/shared/events.h | 1 + src/xr/NSXRInput.h | 75 +++++++++++-------- src/xr/NSXRInput.qc | 18 +++-- src/xr/NSXRSpace.h | 48 ++++++------ src/xr/NSXRSpace.qc | 16 ++-- 22 files changed, 198 insertions(+), 160 deletions(-) diff --git a/src/client/entry.qc b/src/client/entry.qc index 94f6bcd9..b37d1484 100644 --- a/src/client/entry.qc +++ b/src/client/entry.qc @@ -578,7 +578,8 @@ CSQC_Ent_Remove(void) /* we don't want to call Destroy, as that's delayed by a frame... so we need to call this ourselves */ - me.OnRemoveEntity(); + if (me.OnRemoveEntity) + me.OnRemoveEntity(); /* frees one slot the engine won't free for us */ if (me.skeletonindex) diff --git a/src/client/event.qc b/src/client/event.qc index b8ff24bb..984fc93f 100644 --- a/src/client/event.qc +++ b/src/client/event.qc @@ -31,6 +31,8 @@ Event_Parse(float type) iDmgFlags = readint(); CSQC_Parse_Damage_New(vecDmgPos, iDmgTake, iDmgFlags); break; + case EV_HITNOTIFY: + break; case EV_INTERMISSION: int cam; vector pos, ang; diff --git a/src/gs-entbase/shared/ambient_generic.qc b/src/gs-entbase/shared/ambient_generic.qc index 8064368e..7f12ba76 100644 --- a/src/gs-entbase/shared/ambient_generic.qc +++ b/src/gs-entbase/shared/ambient_generic.qc @@ -63,11 +63,11 @@ enumflags class ambient_generic:NSTalkMonster { /* networked attributes */ - PREDICTED_STRING(m_strActivePath); - PREDICTED_FLOAT(m_flVolume); - PREDICTED_FLOAT(m_flRadius); - PREDICTED_FLOAT(m_flPitch); - PREDICTED_BOOL(m_bLoops); + PREDICTED_STRING(m_strActivePath) + PREDICTED_FLOAT(m_flVolume) + PREDICTED_FLOAT(m_flRadius) + PREDICTED_FLOAT(m_flPitch) + PREDICTED_BOOL(m_bLoops) bool m_bToggle; /* spawn values */ diff --git a/src/gs-entbase/shared/env_bubbles.qc b/src/gs-entbase/shared/env_bubbles.qc index 592a84c5..7c83e3c5 100644 --- a/src/gs-entbase/shared/env_bubbles.qc +++ b/src/gs-entbase/shared/env_bubbles.qc @@ -58,10 +58,10 @@ enumflags class env_bubbles:NSPointTrigger { - PREDICTED_INT(m_iDensity); - PREDICTED_FLOAT(m_flFrequency); - PREDICTED_FLOAT(m_flCurrent); - PREDICTED_BOOL(m_bEnabled); + PREDICTED_INT(m_iDensity) + PREDICTED_FLOAT(m_flFrequency) + PREDICTED_FLOAT(m_flCurrent) + PREDICTED_BOOL(m_bEnabled) /* spawn values */ int m_iSpawnDensity; diff --git a/src/gs-entbase/shared/env_fog_controller.qc b/src/gs-entbase/shared/env_fog_controller.qc index b6b35d2b..0266d64c 100644 --- a/src/gs-entbase/shared/env_fog_controller.qc +++ b/src/gs-entbase/shared/env_fog_controller.qc @@ -67,15 +67,15 @@ class env_fog_controller:NSPointTrigger { /* networked attributes */ - PREDICTED_INT(m_iFogActive); - PREDICTED_INT(m_iFogBlend); - PREDICTED_FLOAT(m_flFogStart); - PREDICTED_FLOAT(m_flFogEnd); - PREDICTED_FLOAT(m_flFogMaxDensity); - PREDICTED_FLOAT(m_flFogFarZ); - PREDICTED_VECTOR(m_vecFogColor); - PREDICTED_VECTOR(m_vecFogColor2); - PREDICTED_VECTOR(m_vecFogDir); + PREDICTED_INT(m_iFogActive) + PREDICTED_INT(m_iFogBlend) + PREDICTED_FLOAT(m_flFogStart) + PREDICTED_FLOAT(m_flFogEnd) + PREDICTED_FLOAT(m_flFogMaxDensity) + PREDICTED_FLOAT(m_flFogFarZ) + PREDICTED_VECTOR(m_vecFogColor) + PREDICTED_VECTOR(m_vecFogColor2) + PREDICTED_VECTOR(m_vecFogDir) void(void) env_fog_controller; diff --git a/src/gs-entbase/shared/env_sprite.qc b/src/gs-entbase/shared/env_sprite.qc index 9bf98190..0cf19c25 100644 --- a/src/gs-entbase/shared/env_sprite.qc +++ b/src/gs-entbase/shared/env_sprite.qc @@ -65,8 +65,8 @@ class env_sprite:NSRenderableEntity int m_iToggled; float m_flEffects; - PREDICTED_STRING(m_strMaterial); - PREDICTED_FLOAT(m_flFramerate); + PREDICTED_STRING(m_strMaterial) + PREDICTED_FLOAT(m_flFramerate) #ifdef CLIENT int m_iMaxFrame; diff --git a/src/gs-entbase/shared/func_vehicle.qc b/src/gs-entbase/shared/func_vehicle.qc index e6d25c08..ddd82cdf 100644 --- a/src/gs-entbase/shared/func_vehicle.qc +++ b/src/gs-entbase/shared/func_vehicle.qc @@ -125,7 +125,7 @@ func_vehicle:NSVehicle float m_flWidth; float m_flLength; - PREDICTED_FLOAT(m_flTurn); + PREDICTED_FLOAT(m_flTurn) void(void) func_vehicle; virtual void(void) Spawned; diff --git a/src/gs-entbase/shared/prop_rope.qc b/src/gs-entbase/shared/prop_rope.qc index 6fafe340..987a0b6a 100644 --- a/src/gs-entbase/shared/prop_rope.qc +++ b/src/gs-entbase/shared/prop_rope.qc @@ -54,10 +54,10 @@ var int autocvar_rope_maxsegments = -1; class prop_rope:NSEntity { string m_strShader; - PREDICTED_FLOAT(m_flSag); - PREDICTED_FLOAT(m_flSwingFactor); - PREDICTED_INT(m_iSegments); - PREDICTED_VECTOR(m_vecTarget); + PREDICTED_FLOAT(m_flSag) + PREDICTED_FLOAT(m_flSwingFactor) + PREDICTED_INT(m_iSegments) + PREDICTED_VECTOR(m_vecTarget) void(void) prop_rope; diff --git a/src/gs-entbase/shared/prop_vehicle_driveable.qc b/src/gs-entbase/shared/prop_vehicle_driveable.qc index 04f30f96..71bbe373 100644 --- a/src/gs-entbase/shared/prop_vehicle_driveable.qc +++ b/src/gs-entbase/shared/prop_vehicle_driveable.qc @@ -92,7 +92,7 @@ class prop_vehicle_driveable:NSVehicle prop_vehicle_driveable_wheel m_wlBR; vector m_vecControlMins; vector m_vecControlMaxs; - PREDICTED_FLOAT(m_flTurn); + PREDICTED_FLOAT(m_flTurn) float m_flBRWheelAxel; float m_flBLWheelAxel; diff --git a/src/server/NSGameRules.qc b/src/server/NSGameRules.qc index a136a5f2..1868125e 100644 --- a/src/server/NSGameRules.qc +++ b/src/server/NSGameRules.qc @@ -342,6 +342,17 @@ NSGameRules::DamageApply(entity t, entity c, float dmg, int w, damageType_t type multicast([0,0,0], MULTICAST_ONE_R); } + /* only hit notify on clients */ + if ((g_dmg_eTarget.flags & FL_CLIENT) || (g_dmg_eTarget.flags & FL_MONSTER)) { + /* server-side hitnotify */ + if ((g_dmg_eAttacker.flags & FL_CLIENT) && (g_dmg_eTarget != g_dmg_eAttacker)) { + WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET); + WriteByte(MSG_MULTICAST, EV_HITNOTIFY); + msg_entity = c; + multicast([0,0,0], MULTICAST_ONE); + } + } + /* they died */ if (eTarget.GetHealth() <= 0) { if (eTarget.flags & FL_CLIENT) { diff --git a/src/shared/NSClientPlayer.h b/src/shared/NSClientPlayer.h index ef5b62e7..a67e6ee4 100644 --- a/src/shared/NSClientPlayer.h +++ b/src/shared/NSClientPlayer.h @@ -23,32 +23,32 @@ class NSClientPlayer:NSClientSpectator { #ifdef SERVER - PREDICTED_INT_N(weaponframe); + PREDICTED_INT_N(weaponframe) #else - PREDICTED_INT(weaponframe); - PREDICTED_FLOAT(vehicle_entnum); + PREDICTED_INT(weaponframe) + PREDICTED_FLOAT(vehicle_entnum) #endif - PREDICTED_FLOAT(health); - PREDICTED_FLOAT(armor); + PREDICTED_FLOAT(health) + PREDICTED_FLOAT(armor) - PREDICTED_FLOAT_N(colormap); - PREDICTED_FLOAT_N(gflags); - PREDICTED_FLOAT(viewzoom); - PREDICTED_VECTOR_N(view_ofs); - PREDICTED_VECTOR(v_angle); - PREDICTED_FLOAT_N(pmove_flags); + PREDICTED_FLOAT_N(colormap) + PREDICTED_FLOAT_N(gflags) + PREDICTED_FLOAT(viewzoom) + PREDICTED_VECTOR_N(view_ofs) + PREDICTED_VECTOR(v_angle) + PREDICTED_FLOAT_N(pmove_flags) - PREDICTED_FLOAT(w_attack_next); - PREDICTED_FLOAT(w_idle_next); - PREDICTED_FLOAT(teleport_time); - PREDICTED_FLOAT(weapontime); - PREDICTED_VECTOR(punchangle); + PREDICTED_FLOAT(w_attack_next) + PREDICTED_FLOAT(w_idle_next) + PREDICTED_FLOAT(teleport_time) + PREDICTED_FLOAT(weapontime) + PREDICTED_VECTOR(punchangle) /* We can't use the default .items field, because FTE will assume * effects of some bits. Such as invisibility, quad, etc. * also, modders probably want 32 bits for items. */ - PREDICTED_INT(g_items); - PREDICTED_FLOAT(activeweapon); + PREDICTED_INT(g_items) + PREDICTED_FLOAT(activeweapon) #ifdef NEW_INVENTORY NSWeapon m_weapons[MAX_WEAPONS]; @@ -56,7 +56,7 @@ NSClientPlayer:NSClientSpectator #endif /* vehicle info */ - PREDICTED_ENT(vehicle); + PREDICTED_ENT(vehicle) /* these are NOT networked */ int a_ammo1; diff --git a/src/shared/NSClientSpectator.h b/src/shared/NSClientSpectator.h index 1ffdb1da..03e5264c 100644 --- a/src/shared/NSClientSpectator.h +++ b/src/shared/NSClientSpectator.h @@ -49,8 +49,8 @@ of type NSClientSpectator. class NSClientSpectator:NSClient { private: - PREDICTED_FLOAT(spec_ent); - PREDICTED_FLOAT(spec_flags); + PREDICTED_FLOAT(spec_ent) + PREDICTED_FLOAT(spec_flags) NSClientSpectatorMode_t spec_mode; NSClientSpectatorMode_t spec_mode_net; vector spec_org; diff --git a/src/shared/NSEntity.h b/src/shared/NSEntity.h index dc798cc3..10bcb525 100644 --- a/src/shared/NSEntity.h +++ b/src/shared/NSEntity.h @@ -60,25 +60,25 @@ private: string m_oldModel; /**< contains the model that the entity spawned with */ float m_oldSolid; /**< contains the collision type the entity spawned with */ - PREDICTED_VECTOR_N(origin); - PREDICTED_VECTOR_N(angles); - PREDICTED_FLOAT_N(modelindex); - PREDICTED_VECTOR_N(size); - PREDICTED_VECTOR_N(mins); - PREDICTED_VECTOR_N(maxs); - PREDICTED_FLOAT_N(solid); - PREDICTED_FLOAT_N(movetype); - PREDICTED_FLOAT_N(scale); - PREDICTED_FLOAT_N(flags); - PREDICTED_VECTOR_N(velocity); - PREDICTED_VECTOR_N(avelocity); + PREDICTED_VECTOR_N(origin) + PREDICTED_VECTOR_N(angles) + PREDICTED_FLOAT_N(modelindex) + PREDICTED_VECTOR_N(size) + PREDICTED_VECTOR_N(mins) + PREDICTED_VECTOR_N(maxs) + PREDICTED_FLOAT_N(solid) + PREDICTED_FLOAT_N(movetype) + PREDICTED_FLOAT_N(scale) + PREDICTED_FLOAT_N(flags) + PREDICTED_VECTOR_N(velocity) + PREDICTED_VECTOR_N(avelocity) #ifdef SERVER string m_parent; string m_parent_attachment; - PREDICTED_FLOAT_N(frame); - PREDICTED_FLOAT_N(skin); - PREDICTED_FLOAT_N(effects); + PREDICTED_FLOAT_N(frame) + PREDICTED_FLOAT_N(skin) + PREDICTED_FLOAT_N(effects) #endif public: diff --git a/src/shared/NSPhysicsEntity.h b/src/shared/NSPhysicsEntity.h index 5c9352eb..cefb5280 100644 --- a/src/shared/NSPhysicsEntity.h +++ b/src/shared/NSPhysicsEntity.h @@ -67,7 +67,7 @@ private: virtual void _TouchThink(void); #ifdef SERVER - PREDICTED_VECTOR(m_vecNetAngles); + PREDICTED_VECTOR(m_vecNetAngles) #endif public: diff --git a/src/shared/NSRenderableEntity.h b/src/shared/NSRenderableEntity.h index 78a23c92..46634b28 100644 --- a/src/shared/NSRenderableEntity.h +++ b/src/shared/NSRenderableEntity.h @@ -93,19 +93,19 @@ class NSRenderableEntity:NSEntity { private: /* new */ - PREDICTED_FLOAT(m_flBoneControl1); - PREDICTED_FLOAT(m_flBoneControl2); - PREDICTED_FLOAT(m_flBoneControl3); - PREDICTED_FLOAT(m_flBoneControl4); - PREDICTED_FLOAT(m_flBoneControl5); - PREDICTED_INT(m_iBody); - PREDICTED_FLOAT_N(colormap); - PREDICTED_VECTOR_N(glowmod); + PREDICTED_FLOAT(m_flBoneControl1) + PREDICTED_FLOAT(m_flBoneControl2) + PREDICTED_FLOAT(m_flBoneControl3) + PREDICTED_FLOAT(m_flBoneControl4) + PREDICTED_FLOAT(m_flBoneControl5) + PREDICTED_INT(m_iBody) + PREDICTED_FLOAT_N(colormap) + PREDICTED_VECTOR_N(glowmod) - PREDICTED_FLOAT(m_iRenderFX); - PREDICTED_FLOAT(m_iRenderMode); - PREDICTED_FLOAT(m_flRenderAmt); - PREDICTED_VECTOR(m_vecRenderColor); + PREDICTED_FLOAT(m_iRenderFX) + PREDICTED_FLOAT(m_iRenderMode) + PREDICTED_FLOAT(m_flRenderAmt) + PREDICTED_VECTOR(m_vecRenderColor) /* model events */ float m_flBaseTime; diff --git a/src/shared/NSVehicle.h b/src/shared/NSVehicle.h index 18a9d39d..85d642d2 100644 --- a/src/shared/NSVehicle.h +++ b/src/shared/NSVehicle.h @@ -28,12 +28,12 @@ private: vector m_vecExitPos; /* FIXME: Aren't those already defined in parent classes? */ - PREDICTED_VECTOR_N(angles); - PREDICTED_VECTOR_N(origin); - PREDICTED_VECTOR_N(velocity); + PREDICTED_VECTOR_N(angles) + PREDICTED_VECTOR_N(origin) + PREDICTED_VECTOR_N(velocity) #ifdef CLIENT - PREDICTED_FLOAT(driver_entnum); + PREDICTED_FLOAT(driver_entnum) #endif public: diff --git a/src/shared/defs.h b/src/shared/defs.h index a39b5af5..674480af 100644 --- a/src/shared/defs.h +++ b/src/shared/defs.h @@ -15,21 +15,21 @@ */ /* networking helpers */ -#define PREDICTED_INT(x) int x; int x ##_net -#define PREDICTED_FLOAT(x) float x; float x ##_net -#define PREDICTED_VECTOR(x) vector x; vector x ##_net -#define PREDICTED_ENT(x) entity x; entity x ##_net -#define PREDICTED_STRING(x) string x; string x ##_net -#define PREDICTED_BOOL(x) bool x; bool x ##_net +#define PREDICTED_INT(x) int x; int x ##_net; +#define PREDICTED_FLOAT(x) float x; float x ##_net; +#define PREDICTED_VECTOR(x) vector x; vector x ##_net; +#define PREDICTED_ENT(x) entity x; entity x ##_net; +#define PREDICTED_STRING(x) string x; string x ##_net; +#define PREDICTED_BOOL(x) bool x; bool x ##_net; -#define PREDICTED_INT_N(x) int x ##_net -#define PREDICTED_FLOAT_N(x) float x ##_net -#define PREDICTED_VECTOR_N(x) vector x ##_net -#define PREDICTED_STRING_N(x) string x ##_net +#define PREDICTED_INT_N(x) int x ##_net; +#define PREDICTED_FLOAT_N(x) float x ##_net; +#define PREDICTED_VECTOR_N(x) vector x ##_net; +#define PREDICTED_STRING_N(x) string x ##_net; -#define ROLL_BACK(x) x = x ##_net -#define SAVE_STATE(x) x ##_net = x -#define SAVE_STATE_FIELD(x, y) x ##_net[y] = x[y] +#define ROLL_BACK(x) x = x ##_net; +#define SAVE_STATE(x) x ##_net = x; +#define SAVE_STATE_FIELD(x, y) x ##_net[y] = x[y]; #define ATTR_CHANGED(x) (x ##_net != x) #define VEC_CHANGED(x,y) (x ##_net[y] != x[y]) diff --git a/src/shared/events.h b/src/shared/events.h index 1ab702f1..6b742ed0 100644 --- a/src/shared/events.h +++ b/src/shared/events.h @@ -26,6 +26,7 @@ enum EV_WEAPON_RELOAD, EV_WEAPON_PICKUP, EV_DAMAGE, + EV_HITNOTIFY, EV_ANGLE, EV_IMPACT, EV_GIBHUMAN, diff --git a/src/xr/NSXRInput.h b/src/xr/NSXRInput.h index 8c6ae06e..47c3f7c1 100644 --- a/src/xr/NSXRInput.h +++ b/src/xr/NSXRInput.h @@ -47,46 +47,55 @@ these inputs as well. Each input has the ability to have a NSWeapon reference tied to it. That way you can dual (or even triple) wield them. */ -class -NSXRInput -{ -private: +class NSXRInput { + public: + void NSXRInput( void ); + + /** Sets the NSXRInput type. */ + virtual void SetType( xrinput_t ); + + /** Sets which NSXRSpace this input belongs to. */ + virtual void SetParentSpace( NSXRSpace ); + + /** Returns the world space position of this NSXRInput. */ + virtual vector GetOrigin( void ); + + /** Returns the direction this NSXRInput is facing. */ + virtual vector GetAngles( void ); + + /** Returns the current velocity of this NSXRInput. */ + virtual vector GetVelocity( void ); + + /** Returns the rotational movement of this NSXRInput. */ + virtual vector GetAngularVelocity( void ); + + /** Returns the status of the NSXRInput. */ + virtual unsigned int GetStatus( void ); + + /** Returns the weapon this NSXRInput is wielding. */ + virtual unsigned int GetWeapon( void ); + + /** Returns the type of NSXRInput, check xrinput_t for details. */ + virtual xrinput_t GetType( void ); + + /** Returns if this NSXRInput is available/active. */ + virtual bool IsAvailable( void ); + + /** Run every single input event. */ + virtual void InputFrame( void ); + + /** Debug function that can be called every single frame. */ + virtual void PrintInfo( void ); + + private: /** Reference to the space we belong to */ NSXRSpace m_xrSpace; vector m_vecOrigin; vector m_vecAngles; - vector m_vecVelocity; + vector m_vecVelocity; vector m_vecAVelocity; unsigned int m_iStatus; unsigned int m_iWeapon; xrinput_t m_inputType; - -public: - void NSXRInput(void); - - /** Sets the NSXRInput type. */ - virtual void SetType(xrinput_t); - /** Sets which NSXRSpace this input belongs to. */ - virtual void SetParentSpace(NSXRSpace); - /** Returns the world space position of this NSXRInput. */ - virtual vector GetOrigin(void); - /** Returns the direction this NSXRInput is facing. */ - virtual vector GetAngles(void); - /** Returns the current velocity of this NSXRInput. */ - virtual vector GetVelocity(void); - /** Returns the rotational movement of this NSXRInput. */ - virtual vector GetAngularVelocity(void); - /** Returns the status of the NSXRInput. */ - virtual unsigned int GetStatus(void); - /** Returns the weapon this NSXRInput is wielding. */ - virtual unsigned int GetWeapon(void); - /** Returns the type of NSXRInput, check xrinput_t for details. */ - virtual xrinput_t GetType(void); - /** Returns if this NSXRInput is available/active. */ - virtual bool IsAvailable(void); - /** Run every single input event. */ - virtual void InputFrame(void); - /** Debug function that can be called every single frame. */ - virtual void PrintInfo(void); }; diff --git a/src/xr/NSXRInput.qc b/src/xr/NSXRInput.qc index 6dac630f..8da73b61 100644 --- a/src/xr/NSXRInput.qc +++ b/src/xr/NSXRInput.qc @@ -14,6 +14,19 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +void +NSXRInput::NSXRInput(void) +{ + m_xrSpace = __NULL__; + m_vecOrigin = [0.0f, 0.0f, 0.0f]; + m_vecAngles = [0.0f, 0.0f, 0.0f]; + m_vecVelocity = [0.0f, 0.0f, 0.0f]; + m_vecAVelocity = [0.0f, 0.0f, 0.0f]; + m_iStatus = 0i; + m_iWeapon = 0i; + m_inputType = XR_INPUT_UNKNOWN; +} + vector NSXRInput::GetOrigin(void) { @@ -158,8 +171,3 @@ NSXRInput::PrintInfo(void) crossprint(sprintf("%s o: %v a: %v v:%v va:%v s:%i w:%i\n", deviceType, GetOrigin(), GetAngles(), GetVelocity(), GetAngularVelocity(), GetStatus(), GetWeapon())); } - -void -NSXRInput::NSXRInput(void) -{ -} diff --git a/src/xr/NSXRSpace.h b/src/xr/NSXRSpace.h index 21d2db1b..ba3bbab1 100644 --- a/src/xr/NSXRSpace.h +++ b/src/xr/NSXRSpace.h @@ -18,32 +18,34 @@ It's used to handle room to world translation for VR, for example. */ -class -NSXRSpace -{ +class NSXRSpace { +public: + void NSXRSpace( void ); + + /** Sets the placement of the space in the 3D world. */ + virtual void SetOrigin( vector ); + + /** Sets the direction offset of the space in the 3D world. */ + virtual void SetAngles( vector ); + + /** Get the forward facing direction in a normalized vector. */ + virtual vector GetForward( void ); + + /** Get the right facing direction in a normalized vector. */ + virtual vector GetRight( void ); + + /** Get the up facing direction in a normalized vector. */ + virtual vector GetUp( void ); + + /** Takes a room-space position and translates it into world position. */ + virtual vector RoomToWorldOrigin( vector ); + + /** Takes a room-space angle and translates it into world angles. */ + virtual vector RoomToWorldAngles( vector ); + private: vector m_vecForward; vector m_vecRight; vector m_vecUp; vector m_vecOrigin; - -public: - void NSXRSpace(void); - - /** Sets the placement of the space in the 3D world. */ - virtual void SetOrigin(vector); - /** Sets the direction offset of the space in the 3D world. */ - virtual void SetAngles(vector); - - /** Get the forward facing direction in a normalized vector. */ - virtual vector GetForward(void); - /** Get the right facing direction in a normalized vector. */ - virtual vector GetRight(void); - /** Get the up facing direction in a normalized vector. */ - virtual vector GetUp(void); - - /** Takes a room-space position and translates it into world position. */ - virtual vector RoomToWorldOrigin(vector); - /** Takes a room-space angle and translates it into world angles. */ - virtual vector RoomToWorldAngles(vector); }; diff --git a/src/xr/NSXRSpace.qc b/src/xr/NSXRSpace.qc index 010d18a2..9c84a501 100644 --- a/src/xr/NSXRSpace.qc +++ b/src/xr/NSXRSpace.qc @@ -14,6 +14,15 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +void +NSXRSpace::NSXRSpace(void) +{ + m_vecForward = + m_vecRight = + m_vecUp = + m_vecOrigin = [0.0f, 0.0f, 0.0f]; +} + vector NSXRSpace::GetForward(void) { @@ -64,9 +73,4 @@ NSXRSpace::SetAngles(vector vecAngles) m_vecForward = v_forward; m_vecRight = v_right; m_vecUp = v_up; -} - -void -NSXRSpace::NSXRSpace(void) -{ -} +} \ No newline at end of file