From 32f9d974bb0aee4c6c2832c9211653df84711df7 Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Fri, 17 Nov 2023 18:54:46 -0800 Subject: [PATCH] New commands: listClientSoundDef, listServerSoundDef Merge various trigger fields from Source entities into NSTrigger Rename default player related sounds to the Source Engine style for more parity with Half-Life 2 and later games Various player physics code fixes, such as being unable to jump higher when pushing against solids and faster noclip speed --- src/client/cmd.qc | 8 ++ src/client/entry.qc | 13 +-- src/gs-entbase/server/info_hint.qc | 6 - src/gs-entbase/server/logic_relay.qc | 44 -------- src/gs-entbase/server/logic_timer.qc | 18 --- src/gs-entbase/server/prop_physics.qc | 2 +- src/gs-entbase/server/trigger_multiple.qc | 53 +++++---- src/gs-entbase/server/trigger_once.qc | 64 +++++------ src/gs-entbase/server/trigger_playerfreeze.qc | 2 +- src/gs-entbase/server/trigger_relay.qc | 18 ++- src/gs-entbase/server/trigger_transition.qc | 13 ++- src/gs-entbase/shared/env_funnel.qc | 6 +- src/gs-entbase/shared/info_waypoint.qc | 10 +- src/server/entry.qc | 14 ++- src/shared/NSBrushTrigger.qc | 4 + src/shared/NSClientPlayer.qc | 45 +++----- src/shared/NSMonster.h | 2 +- src/shared/NSPointTrigger.qc | 4 + src/shared/NSSpraylogo.qc | 2 +- src/shared/NSTrigger.h | 6 + src/shared/NSTrigger.qc | 28 +++++ src/shared/player_pmove.qc | 74 +++++++------ src/shared/pmove_custom.qc | 104 ++++++++++-------- src/shared/sound.h | 2 + src/shared/sound.qc | 15 +++ 25 files changed, 284 insertions(+), 273 deletions(-) diff --git a/src/client/cmd.qc b/src/client/cmd.qc index e7d7eead..985bf310 100644 --- a/src/client/cmd.qc +++ b/src/client/cmd.qc @@ -265,6 +265,12 @@ Cmd_Parse(string sCMD) case "listParticles": CMD_ListParticles(); break; + case "listClientSoundDef": + Sound_DebugList(); + break; + case "listServerSoundDef": + localcmd("sv listSoundDef\n"); + break; case "cleardecals": CMD_Cleardecals(); break; @@ -446,6 +452,8 @@ Cmd_Init(void) registercommand("listSounds"); registercommand("listParticles"); registercommand("listTitles"); + registercommand("listClientSoundDef"); + registercommand("listServerSoundDef"); registercommand("cleardecals"); registercommand("testLight"); diff --git a/src/client/entry.qc b/src/client/entry.qc index a5b3e77e..3bdeb482 100644 --- a/src/client/entry.qc +++ b/src/client/entry.qc @@ -58,13 +58,6 @@ CSQC_Init(float apilevel, string enginename, float engineversion) PropData_Init(); DecalGroups_Init(); - precache_sound("common/wpn_hudon.wav"); - precache_sound("common/wpn_hudoff.wav"); - precache_sound("common/wpn_moveselect.wav"); - precache_sound("common/wpn_select.wav"); - - precache_sound("common/null.wav"); - /* VGUI */ VGUI_Init(); @@ -88,6 +81,12 @@ CSQC_Init(float apilevel, string enginename, float engineversion) WorldSpawn_Init(); + Sound_Precache("Player.DenyWeaponSelection"); + Sound_Precache("Player.WeaponSelected"); + Sound_Precache("Player.WeaponSelectionMoveSlot"); + Sound_Precache("Player.WeaponSelectionOpen"); + Sound_Precache("Player.WeaponSelectionClose"); + /* end msg */ print("Client game initialized.\n"); diff --git a/src/gs-entbase/server/info_hint.qc b/src/gs-entbase/server/info_hint.qc index 1f7c9926..67ff2d92 100644 --- a/src/gs-entbase/server/info_hint.qc +++ b/src/gs-entbase/server/info_hint.qc @@ -152,7 +152,6 @@ private: hinttype_t m_hintType; string m_strHintActivity; float m_flNodeFOV; - bool m_bStartDisabled; string m_strHintGroup; ignorefacing_t m_ignoreFacing; aistate_t m_minState; @@ -165,7 +164,6 @@ info_hint::info_hint(void) m_hintType = HINT_NONE; m_strHintActivity = __NULL__; m_flNodeFOV = 360; - m_bStartDisabled = false; m_strHintGroup = __NULL__; m_ignoreFacing = IGNORE_DEFAULT; m_minState = AISTATE_IDLE; @@ -179,7 +177,6 @@ info_hint::Save(float handle) SaveFloat(handle, "m_hintType", m_hintType); SaveString(handle, "m_strHintActivity", m_strHintActivity); SaveFloat(handle, "m_flNodeFOV", m_flNodeFOV); - SaveBool(handle, "m_bStartDisabled", m_bStartDisabled); SaveString(handle, "m_strHintGroup", m_strHintGroup); SaveFloat(handle, "m_ignoreFacing", m_ignoreFacing); SaveFloat(handle, "m_minState", m_minState); @@ -199,9 +196,6 @@ info_hint::Restore(string strKey, string strValue) case "m_flNodeFOV": m_flNodeFOV = ReadFloat(strValue); break; - case "m_bStartDisabled": - m_bStartDisabled = ReadFloat(strValue); - break; case "m_strHintGroup": m_strHintGroup = ReadString(strValue); break; diff --git a/src/gs-entbase/server/logic_relay.qc b/src/gs-entbase/server/logic_relay.qc index 65c91e69..fece077c 100644 --- a/src/gs-entbase/server/logic_relay.qc +++ b/src/gs-entbase/server/logic_relay.qc @@ -59,73 +59,32 @@ public: virtual void Respawn(void); virtual void SpawnKey(string, string); virtual void Input(entity, string, string); - virtual void Save(float); - virtual void Restore(string, string); - -private: - bool m_bStartDisabled; - bool m_bEnabled; }; void logic_relay::logic_relay(void) { - m_bStartDisabled = false; } void logic_relay::Respawn(void) { InitPointTrigger(); - m_bEnabled = (m_bStartDisabled) ? false : true; } void logic_relay::SpawnKey(string keyName, string setValue) { switch (keyName) { - case "StartDisabled": - m_bStartDisabled = ReadBool(setValue); - break; default: super::SpawnKey(keyName, setValue); } } -void -logic_relay::Save(float handle) -{ - super::Save(handle); - - SaveBool(handle, "m_bStartDisabled", m_bStartDisabled); - SaveBool(handle, "m_bEnabled", m_bEnabled); -} - -void -logic_relay::Restore(string strKey, string strValue) -{ - switch (strKey) { - case "m_bStartDisabled": - m_bStartDisabled = ReadBool(strValue); - break; - case "m_bEnabled": - m_bEnabled = ReadBool(strValue); - break; - default: - super::Restore(strKey, strValue); - } -} - void logic_relay::Input(entity activatorEntity, string inputName, string dataField) { switch (inputName) { - case "Enable": - m_bEnabled = true; - break; - case "Disable": - m_bEnabled = false; - break; case "Trigger": if (m_bEnabled == true) { /* if we don't allow fast retrigger... */ @@ -143,9 +102,6 @@ logic_relay::Input(entity activatorEntity, string inputName, string dataField) } } break; - case "Toggle": - m_bEnabled = (m_bEnabled) ? false : true; - break; /* TODO: complete this mess */ case "CancelPending": break; diff --git a/src/gs-entbase/server/logic_timer.qc b/src/gs-entbase/server/logic_timer.qc index 16ed89e8..a6ff41a9 100644 --- a/src/gs-entbase/server/logic_timer.qc +++ b/src/gs-entbase/server/logic_timer.qc @@ -74,13 +74,11 @@ private: float m_flRandMins; float m_flRandMaxs; float m_flRefireTime; - bool m_bStartDisabled; bool m_bOscillator; string m_strOnTimer; string m_strOnTimerHigh; string m_strOnTimerLow; - bool m_bEnabled; entity m_eActivator; }; @@ -91,9 +89,7 @@ logic_timer::logic_timer(void) m_flRandMins = 0.0f; m_flRandMaxs = 1.0f; m_flRefireTime = 0.0; - m_bStartDisabled = false; m_bOscillator = false; - m_bEnabled = true; m_eActivator = this; m_strOnTimer = m_strOnTimerHigh = m_strOnTimerLow = __NULL__; } @@ -114,9 +110,6 @@ logic_timer::SpawnKey(string keyName, string setValue) case "RefireTime": m_flRefireTime = ReadFloat(setValue); break; - case "StartDisabled": - m_bStartDisabled = ReadBool(setValue); - break; /* I/O related */ case "OnTimer": m_strOnTimer = PrepareOutput(m_strOnTimer, setValue); @@ -167,12 +160,10 @@ logic_timer::Save(float handle) SaveFloat(handle, "m_flRandMins", m_flRandMins); SaveFloat(handle, "m_flRandMaxs", m_flRandMaxs); SaveFloat(handle, "m_flRefireTime", m_flRefireTime); - SaveBool(handle, "m_bStartDisabled", m_bStartDisabled); SaveString(handle, "m_strOnTimer", m_strOnTimer); SaveString(handle, "m_strOnTimerHigh", m_strOnTimerHigh); SaveString(handle, "m_strOnTimerLow", m_strOnTimerLow); SaveBool(handle, "m_bOscillator", m_bOscillator); - SaveBool(handle, "m_bEnabled", m_bEnabled); SaveEntity(handle, "m_eActivator", m_eActivator); } @@ -192,9 +183,6 @@ logic_timer::Restore(string strKey, string strValue) case "m_flRefireTime": m_flRefireTime = ReadFloat(strValue); break; - case "m_bStartDisabled": - m_bStartDisabled = ReadBool(strValue); - break; case "m_strOnTimer": m_strOnTimer = ReadString(strValue); break; @@ -207,9 +195,6 @@ logic_timer::Restore(string strKey, string strValue) case "m_bOscillator": m_bOscillator = ReadBool(strValue); break; - case "m_bEnabled": - m_bEnabled = ReadBool(strValue); - break; case "m_eActivator": m_eActivator = ReadEntity(strValue); break; @@ -242,9 +227,6 @@ logic_timer::Input(entity activatorEntity, string inputName, string dataField) m_bEnabled = true; TimerSetup(); /* reset timer */ break; - case "Disable": - m_bEnabled = false; - break; case "Toggle": m_bEnabled = (m_bEnabled) ? false : true; diff --git a/src/gs-entbase/server/prop_physics.qc b/src/gs-entbase/server/prop_physics.qc index a7342876..20b3fad5 100644 --- a/src/gs-entbase/server/prop_physics.qc +++ b/src/gs-entbase/server/prop_physics.qc @@ -88,7 +88,7 @@ prop_physics::Respawn(void) if (HasSpawnFlags(PHYSPROPSFL_PHYSDEVICE)) Sleep(); - //Sleep(); + Sleep(); } #else class diff --git a/src/gs-entbase/server/trigger_multiple.qc b/src/gs-entbase/server/trigger_multiple.qc index 79e13896..bb1883e9 100644 --- a/src/gs-entbase/server/trigger_multiple.qc +++ b/src/gs-entbase/server/trigger_multiple.qc @@ -21,7 +21,7 @@ enumflags TM_PUSHABLES }; -/*!QUAKED trigger_multiple (.5 .5 .5) ? TM_MONSTERS TM_NOCLIENTS TM_PUSHABLES +/*!QUAKED trigger_multiple (.5 .5 .5) ? CLIENTS NPCS PUSHABLES PHYSICS FRIENDLIES CLIENTSINVEHICLES EVERYTHING x x CLIENTSNOTINVEHICLES DEBRIS NPCSINVEHICLES NOBOTS # OVERVIEW A trigger volume which works more than once. @@ -31,16 +31,40 @@ A trigger volume which works more than once. - "killtarget" : Target to kill when triggered. - "delay" : Delay until target is triggered. - "wait" : Time until this entity can trigger again +- "StartDisabled" : Entity will have to be enabled in order to work when set to 1. + +# INPUTS +- "Enable" : Enable the entity. +- "Disable" : Disable the entity. +- "Toggle" : Toggles between enabled/disabled states. # OUTPUTS - "OnStartTouch": Triggered when something starts touching this volume - "OnEndTouchAll": Triggered when nothing touched the entity no more # SPAWNFLAGS +- TF_CLIENTS (1) : Clients can touch it. +- TF_NPCS (2) : NPCs can touch it. +- TF_PUSHABLE (4) : Pushables can touch it. +- TF_PHYSICS (8) : NSPhysicsEntity based classes can touch it. +- TF_FRIENDLIES (16) : Friendly NPCs can touch it. +- TF_CLIENTSINVEHICLES (32) : Clients within vehicles can touch it. +- TF_EVERYTHING (64) : Everything can touch it. +- TF_CLIENTSNOTINVEHICLES (512) : Clients outside vehicles can touch it. +- TF_DEBRIS (1024) : Debris can touch it. +- TF_NPCSINVEHICLES (2048) : NPCs in vehicles can touch it. +- TF_NOBOTS (4096) : Bots are never allowed to touch it. + +# SPAWNFLAGS (LEGACY) +These work when 'StartDisabled' is not set in the entity definition. + - TM_MONSTERS (1) : Allow NPCs to activate this entity. - TM_NOCLIENTS (2) : Don't allow players to activate this entity. - TM_PUSHABLES (4) : Allow func_pushables to trigger this entity. +# NOTES +If you want an entity like this that can only be used once, see trigger_once. + # TRIVIA This entity was introduced in Quake (1996). */ @@ -61,9 +85,6 @@ public: private: float m_flWait; - bool m_bStartDisabled; - bool m_bIsModern; - bool m_bEnabled; /* Input/Output */ string m_strOnStartTouch; @@ -80,8 +101,6 @@ trigger_multiple::trigger_multiple(void) m_strOnStartTouch = m_strOnEndTouchAll = m_strOnTrigger = __NULL__; - m_bIsModern = false; - m_bEnabled = true; } void @@ -89,9 +108,6 @@ trigger_multiple::Save(float handle) { super::Save(handle); SaveFloat(handle, "m_flWait", m_flWait); - SaveBool(handle, "m_bStartDisabled", m_bStartDisabled); - SaveBool(handle, "m_bIsModern", m_bIsModern); - SaveBool(handle, "m_bEnabled", m_bEnabled); SaveString(handle, "m_strOnStartTouch", m_strOnStartTouch); SaveString(handle, "m_strOnEndTouchAll", m_strOnEndTouchAll); SaveString(handle, "m_strOnTrigger", m_strOnTrigger); @@ -104,15 +120,6 @@ trigger_multiple::Restore(string strKey, string strValue) case "m_flWait": m_flWait = ReadFloat(strValue); break; - case "m_bStartDisabled": - m_bStartDisabled = ReadBool(strValue); - break; - case "m_bIsModern": - m_bIsModern = ReadBool(strValue); - break; - case "m_bEnabled": - m_bEnabled = ReadBool(strValue); - break; case "m_strOnStartTouch": m_strOnStartTouch = ReadString(strValue); break; @@ -170,22 +177,12 @@ void trigger_multiple::Respawn(void) { InitBrushTrigger(); - m_bEnabled = (m_bStartDisabled) ? false : true; } void trigger_multiple::Input(entity entityActivator, string inputName, string dataField) { switch (inputName) { - case "Enable": - m_bEnabled = true; - break; - case "Disable": - m_bEnabled = false; - break; - case "Toggle": - m_bEnabled = (m_bEnabled) ? false : true; - break; case "TouchTest": Touch(entityActivator); break; diff --git a/src/gs-entbase/server/trigger_once.qc b/src/gs-entbase/server/trigger_once.qc index 7166c265..61c78793 100644 --- a/src/gs-entbase/server/trigger_once.qc +++ b/src/gs-entbase/server/trigger_once.qc @@ -21,7 +21,7 @@ enumflags TO_PUSHABLES }; -/*!QUAKED trigger_once (.5 .5 .5) ? TO_MONSTERS TO_NOCLIENTS TO_PUSHABLES +/*!QUAKED trigger_once (.5 .5 .5) ? CLIENTS NPCS PUSHABLES PHYSICS FRIENDLIES CLIENTSINVEHICLES EVERYTHING x x CLIENTSNOTINVEHICLES DEBRIS NPCSINVEHICLES NOBOTS # OVERVIEW A trigger volume which works only once. @@ -30,11 +30,35 @@ A trigger volume which works only once. - "target" : Target when triggered. - "killtarget" : Target to kill when triggered. - "delay" : Delay until target is triggered. +- "StartDisabled" : Entity will have to be enabled in order to work when set to 1. + +# INPUTS +- "Enable" : Enable the entity. +- "Disable" : Disable the entity. +- "Toggle" : Toggles between enabled/disabled states. # SPAWNFLAGS -- TO_MONSTERS (1) : Allow NPCs to activate this entity. -- TO_NOCLIENTS (2) : Don't allow players to activate this entity. -- TO_PUSHABLES (4) : Allow func_pushables to trigger this entity. +- TF_CLIENTS (1) : Clients can touch it. +- TF_NPCS (2) : NPCs can touch it. +- TF_PUSHABLE (4) : Pushables can touch it. +- TF_PHYSICS (8) : NSPhysicsEntity based classes can touch it. +- TF_FRIENDLIES (16) : Friendly NPCs can touch it. +- TF_CLIENTSINVEHICLES (32) : Clients within vehicles can touch it. +- TF_EVERYTHING (64) : Everything can touch it. +- TF_CLIENTSNOTINVEHICLES (512) : Clients outside vehicles can touch it. +- TF_DEBRIS (1024) : Debris can touch it. +- TF_NPCSINVEHICLES (2048) : NPCs in vehicles can touch it. +- TF_NOBOTS (4096) : Bots are never allowed to touch it. + +# SPAWNFLAGS (LEGACY) +These work when 'StartDisabled' is not set in the entity definition. + +- TM_MONSTERS (1) : Allow NPCs to activate this entity. +- TM_NOCLIENTS (2) : Don't allow players to activate this entity. +- TM_PUSHABLES (4) : Allow func_pushables to trigger this entity. + +# NOTES +If you want an entity like this that can be used more than once, see trigger_multiple. # TRIVIA This entity was introduced in Quake (1996). @@ -55,11 +79,8 @@ public: virtual void Input(entity, string, string); private: - bool m_bStartDisabled; - bool m_bEnabled; string m_strOnStartTouch; string m_strOnTrigger; - bool m_bIsModern; }; void @@ -67,9 +88,6 @@ trigger_once::trigger_once(void) { m_strOnStartTouch = m_strOnTrigger = __NULL__; - m_bIsModern = false; - m_bStartDisabled = false; - m_bEnabled = true; } void @@ -88,39 +106,26 @@ trigger_once::Respawn(void) { InitBrushTrigger(); m_iValue = 0; - m_bEnabled = (m_bStartDisabled) ? false : true; } void trigger_once::Save(float handle) { super::Save(handle); - SaveBool(handle, "m_bStartDisabled", m_bStartDisabled); - SaveBool(handle, "m_bEnabled", m_bEnabled); SaveString(handle, "m_strOnStartTouch", m_strOnStartTouch); SaveString(handle, "m_strOnTrigger", m_strOnTrigger); - SaveBool(handle, "m_bIsModern", m_bIsModern); } void trigger_once::Restore(string strKey, string strValue) { switch (strKey) { - case "m_bStartDisabled": - m_bStartDisabled = ReadBool(strValue); - break; - case "m_bEnabled": - m_bEnabled = ReadBool(strValue); - break; case "m_strOnStartTouch": m_strOnStartTouch = ReadString(strValue); break; case "m_strOnTrigger": m_strOnTrigger = ReadString(strValue); break; - case "m_bIsModern": - m_bIsModern = ReadBool(strValue); - break; default: super::Restore(strKey, strValue); } @@ -130,10 +135,6 @@ void trigger_once::SpawnKey(string strKey, string strValue) { switch (strKey) { - case "StartDisabled": - m_bStartDisabled = ReadBool(strValue); - m_bIsModern = true; - break; case "OnStartTouch": m_strOnStartTouch = PrepareOutput(m_strOnStartTouch, strValue); break; @@ -150,15 +151,6 @@ void trigger_once::Input(entity entityActivator, string inputName, string dataField) { switch (inputName) { - case "Enable": - m_bEnabled = true; - break; - case "Disable": - m_bEnabled = false; - break; - case "Toggle": - m_bEnabled = (m_bEnabled) ? false : true; - break; case "StartTouch": StartTouch(entityActivator); break; diff --git a/src/gs-entbase/server/trigger_playerfreeze.qc b/src/gs-entbase/server/trigger_playerfreeze.qc index a9bc8c38..2ff39201 100644 --- a/src/gs-entbase/server/trigger_playerfreeze.qc +++ b/src/gs-entbase/server/trigger_playerfreeze.qc @@ -21,7 +21,7 @@ Freezing a player means they're unable to move, they can still look around. # KEYS - "targetname" : Name -- "killtarget" : Target to kill when triggered. +- "killtarget" : Target to remove when triggered. # NOTES Ideas: Add ability to supress looking around, firing weapons, using items diff --git a/src/gs-entbase/server/trigger_relay.qc b/src/gs-entbase/server/trigger_relay.qc index 8bd02c41..43a7a609 100644 --- a/src/gs-entbase/server/trigger_relay.qc +++ b/src/gs-entbase/server/trigger_relay.qc @@ -21,18 +21,26 @@ enumflags /*!QUAKED trigger_relay (.5 .5 .5) ? TRLY_ONCE # OVERVIEW -This is an inbetween trigger that forces a desired output state +This is an in-between trigger that forces a desired output state instead of toggling e.g. a door open. # KEYS - "targetname" : Name -- "target" : Target when triggered. -- "killtarget" : Target to kill when triggered. -- "delay" : Delay til the target is triggered. +- "target" : Target to trigger. - "triggerstate" : Desired state of the triggered entity. +- "delay" : Delay til the target is triggered, in seconds. +- "killtarget" : Target to remove when triggered. # SPAWNFLAGS -- TRLY_ONCE (1) : Will be removed upon triggering its targets. +- TRLY_ONCE (1) : When set, this entity will be removed upon triggering its targets. + +# NOTES +The `triggerstate` key can be one of three things: +- 0: Off +- 1: On +- 2: Toggle + +Where 'off' will close entities like func_door, and 'on' will open them. # TRIVIA This entity was introduced in Quake (1996). diff --git a/src/gs-entbase/server/trigger_transition.qc b/src/gs-entbase/server/trigger_transition.qc index fdd128c1..e067b811 100644 --- a/src/gs-entbase/server/trigger_transition.qc +++ b/src/gs-entbase/server/trigger_transition.qc @@ -16,21 +16,30 @@ /*!QUAKED trigger_transition (.5 .5 .5) ? # OVERVIEW -Currently unused. This is meant for defining level transition regions. +Defines level transition regions. All entities touching this volume would carry across to the next level. # KEYS - "targetname" : Name +# NOTES +In order for this entity to work, you have to assign a working info_landmark entity to your trigger_changelevel, and give this entity the same targetname as said landmark. + +If you don't assign a transition, no entities will carry over currently. This is not accurate to vanilla behaviour in Half-Life but should mirror what Source does. +In Half-Life, everything as part of the current PVS seems to carry over. This is probably not what you want to ever do, especially in large outdoor maps. + # TRIVIA This entity was introduced in Half-Life (1998). */ class trigger_transition:NSBrushTrigger { +public: void trigger_transition(void); - + + /* overrides */ virtual void Respawn(void); + nonvirtual void SaveTransition(void); nonvirtual NSEntity FindCarrierEntity(string); nonvirtual void LoadTransition(void); diff --git a/src/gs-entbase/shared/env_funnel.qc b/src/gs-entbase/shared/env_funnel.qc index 56bc7f02..304d603a 100644 --- a/src/gs-entbase/shared/env_funnel.qc +++ b/src/gs-entbase/shared/env_funnel.qc @@ -33,11 +33,13 @@ enumflags enumflags { FUNNEL_REVERSE, + FUNNEL_REPEATABLE }; -/*!QUAKED env_funnel (1 .5 0) (-8 -8 -8) (8 8 8) REVERSE +/*!QUAKED env_funnel (1 .5 0) (-8 -8 -8) (8 8 8) REVERSE REPEATABLE # OVERVIEW -Controllable beam effect, akin to lightning. Also known as env_lightning. +An effect that when triggered, will create lots of glowing orbs that funnel into +the position of this entity. # KEYS - "targetname" : Name diff --git a/src/gs-entbase/shared/info_waypoint.qc b/src/gs-entbase/shared/info_waypoint.qc index 68cb967c..a6f52eb7 100644 --- a/src/gs-entbase/shared/info_waypoint.qc +++ b/src/gs-entbase/shared/info_waypoint.qc @@ -35,8 +35,9 @@ by players. - "Text" : A localised string to display next to it. # INPUTS -- "Enable" : Enables the entity. -- "Disable" : Disables the entity. +- "Enable" : Enable the entity. +- "Disable" : Disable the entity. +- "Toggle" : Toggles between enabled/disabled states. # TRIVIA This entity was introduced in Obsidian Conflict (2006). @@ -74,7 +75,6 @@ info_waypoint::info_waypoint(void) { m_strIcon = m_strText = __NULL__; - m_bEnabled = false; } #ifdef SERVER @@ -99,7 +99,6 @@ info_waypoint::Save(float handle) super::Save(handle); SaveString(handle, "m_strIcon", m_strIcon); SaveString(handle, "m_strText", m_strText); - SaveBool(handle, "m_bEnabled", m_bEnabled); } void @@ -112,9 +111,6 @@ info_waypoint::Restore(string strKey, string strValue) case "m_strText": m_strText = ReadString(strValue); break; - case "m_bEnabled": - m_bEnabled = ReadBool(strValue); - break; default: super::Restore(strKey, strValue); } diff --git a/src/server/entry.qc b/src/server/entry.qc index 3a8ee3ea..3fc93e4b 100644 --- a/src/server/entry.qc +++ b/src/server/entry.qc @@ -394,11 +394,9 @@ initents(void) PMove_Init(); /** compat... */ - precache_sound("misc/null.wav"); - precache_sound("common/null.wav"); - Sound_Precache("player.GaspLight"); - Sound_Precache("player.GaspHeavy"); + Sound_Precache("Player.GaspLight"); + Sound_Precache("Player.GaspHeavy"); Sound_Precache("player.WaterEnter"); Sound_Precache("player.WaterExit"); Sound_Precache("Player.Death"); @@ -407,9 +405,12 @@ initents(void) Sound_Precache("Player.Swim"); Sound_Precache("Player.DenyWeaonSelection"); Sound_Precache("Player.WeaponSelected"); + Sound_Precache("Player.FallDamage"); + Sound_Precache("Player.LightFall"); + Sound_Precache("Player.FallGib"); Sound_Precache("damage_bullet.hit"); - Sound_Precache("player.spraylogo"); + Sound_Precache("SprayCan.Paint"); Sound_Precache("step_ladder.left"); Sound_Precache("step_ladder.right"); @@ -558,6 +559,9 @@ ConsoleCmd(string cmd) Way_Cmd(); break; #endif + case "listSoundDef": + Sound_DebugList(); + break; default: return (0); } diff --git a/src/shared/NSBrushTrigger.qc b/src/shared/NSBrushTrigger.qc index 9c5d13d5..867a72eb 100644 --- a/src/shared/NSBrushTrigger.qc +++ b/src/shared/NSBrushTrigger.qc @@ -35,4 +35,8 @@ NSBrushTrigger::InitBrushTrigger(void) SetModel(GetSpawnModel()); SetMovetype(MOVETYPE_NONE); SetSolid(SOLID_BSPTRIGGER); + +#ifdef SERVER + m_bEnabled = (m_bStartDisabled) ? false : true; +#endif } diff --git a/src/shared/NSClientPlayer.qc b/src/shared/NSClientPlayer.qc index d53f3751..2eda53ac 100644 --- a/src/shared/NSClientPlayer.qc +++ b/src/shared/NSClientPlayer.qc @@ -303,20 +303,13 @@ NSClientPlayer::predraw(void) if (entnum == player_localentnum) g_view.SetDrawLocalPlayer(true); - /* sucks we can't draw a shadow on this thing, maybe in the future when FTEQW allows it */ - if (p_model) { - if (p_model.GetRenderMode() != RM_DONTRENDER) - addentity(p_model); - } } else { /* we're doing first person stuff */ /* flags that the model appear in mirrors only */ renderflags |= RF_EXTERNALMODEL; - - /* ditto */ p_model.renderflags |= RF_EXTERNALMODEL; /* give mods a chance to de-render attachments */ - UpdatePlayerAttachments(false); + UpdatePlayerAttachments(true); Weapons_PreDraw((player)this, false); /* this is here just to make sure our view hides us if it's the local player */ @@ -324,6 +317,16 @@ NSClientPlayer::predraw(void) g_view.SetDrawLocalPlayer(false); } + if (p_model) { + p_model.entnum = entnum; + p_model.drawmask = 0; + + if (p_model.GetRenderMode() != RM_DONTRENDER) + addentity(p_model); + + p_model.entnum = 0; + } + /* this needs to be called absolutely last */ /* we're calling this so that the shadow can still be drawn */ if (GetRenderMode() != RM_DONTRENDER) @@ -1162,10 +1165,10 @@ NSClientPlayer::InputUse_Down(void) /* Some entities want to support Use spamming */ if (HasFlags(FL_USE_RELEASED) == false) { - sound(this, CHAN_ITEM, "common/wpn_select.wav", 0.25, ATTN_IDLE); + StartSoundDef("Player.WeaponSelected", CHAN_ITEM, false); } } else { - sound(this, CHAN_ITEM, "common/wpn_denyselect.wav", 0.25, ATTN_IDLE); + StartSoundDef("Player.DenyWeaponSelection", CHAN_ITEM, false); flags &= ~FL_USE_RELEASED; } } @@ -1208,27 +1211,15 @@ NSClientPlayer::Footsteps_Update(void) return; if (waterlevel == 1) { - if (step) - StartSoundDef("step_slosh.left", CHAN_BODY, true); - else - StartSoundDef("step_slosh.right", CHAN_BODY, true); - - step_time = time + 0.35f; + StartSoundDef("Player.Wade", CHAN_BODY, true); + step_time = time + 2.0f; return; } else if (waterlevel == 2) { - if (step) - StartSoundDef("step_wade.left", CHAN_BODY, true); - else - StartSoundDef("step_wade.right", CHAN_BODY, true); - - step_time = time + 1.0f; + StartSoundDef("Player.Wade", CHAN_BODY, true); + step_time = time + 2.0f; return; } else if (waterlevel == 3) { - if (step) - StartSoundDef("step_swim.left", CHAN_BODY, true); - else - StartSoundDef("step_swim.right", CHAN_BODY, true); - + StartSoundDef("Player.Swim", CHAN_BODY, true); step_time = time + 2.0f; return; } else { diff --git a/src/shared/NSMonster.h b/src/shared/NSMonster.h index af639c60..aabc5eae 100644 --- a/src/shared/NSMonster.h +++ b/src/shared/NSMonster.h @@ -148,7 +148,7 @@ typedef enumflags MSF_RESERVED2, MSF_IGNOREPLAYER, MSF_WAITFORSCRIPT, - MSF_PREDISASTER, + MSF_RESERVED3, MSF_FADECORPSE, MSF_MULTIPLAYER, MSF_FALLING, diff --git a/src/shared/NSPointTrigger.qc b/src/shared/NSPointTrigger.qc index 65351b4c..784f9033 100644 --- a/src/shared/NSPointTrigger.qc +++ b/src/shared/NSPointTrigger.qc @@ -19,6 +19,10 @@ NSPointTrigger::InitPointTrigger(void) { SetSize(VEC_HULL_MIN, VEC_HULL_MAX); SetSolid(SOLID_TRIGGER); + +#ifdef SERVER + m_bEnabled = (m_bStartDisabled) ? false : true; +#endif } diff --git a/src/shared/NSSpraylogo.qc b/src/shared/NSSpraylogo.qc index ff75f305..75a9fb4e 100644 --- a/src/shared/NSSpraylogo.qc +++ b/src/shared/NSSpraylogo.qc @@ -170,6 +170,6 @@ CSEv_Spraylogo(void) spray.SendEntity = Spray_SendEntity; spray.SendFlags = 1; - Sound_Play(self, CHAN_VOICE, "player.spraylogo"); + Sound_Play(self, CHAN_VOICE, "SprayCan.Paint"); } #endif diff --git a/src/shared/NSTrigger.h b/src/shared/NSTrigger.h index 0fecaa4c..b1cb7058 100644 --- a/src/shared/NSTrigger.h +++ b/src/shared/NSTrigger.h @@ -55,6 +55,8 @@ enumflags TOUCHFILTER_FRIENDLIES, TOUCHFILTER_CLIENTSINVEHICLES, TOUCHFILTER_EVERYTHING, + TOUCHFILTER_PADDING1, + TOUCHFILTER_PADDING2, TOUCHFILTER_CLIENTSNOTINVEHICLES, TOUCHFILTER_DEBRIS, TOUCHFILTER_NPCSINVEHICLES, @@ -154,6 +156,10 @@ private: int m_iUseType; int m_iValue; + bool m_bEnabled; + bool m_bStartDisabled; + bool m_bIsModern; + float team_no; /* legacy trigger architecture */ diff --git a/src/shared/NSTrigger.qc b/src/shared/NSTrigger.qc index aadb012a..054f1596 100644 --- a/src/shared/NSTrigger.qc +++ b/src/shared/NSTrigger.qc @@ -30,6 +30,9 @@ NSTrigger::NSTrigger(void) team = 0; m_iValue = 0i; m_flDelay = 0.0f; + m_bStartDisabled = false; + m_bEnabled = true; + m_bIsModern = false; #endif } @@ -236,6 +239,9 @@ NSTrigger::Save(float handle) SaveInt(handle, "m_iValue", m_iValue); SaveFloat(handle, "m_flDelay", m_flDelay); SaveString(handle, "m_strGlobalName", m_strGlobalName); + SaveBool(handle, "m_bStartDisabled", m_bStartDisabled); + SaveBool(handle, "m_bEnabled", m_bEnabled); + SaveBool(handle, "m_bIsModern", m_bIsModern); } void NSTrigger::Restore(string strKey, string strValue) @@ -271,6 +277,15 @@ NSTrigger::Restore(string strKey, string strValue) case "m_strGlobalName": m_strGlobalName = ReadString(strValue); break; + case "m_bStartDisabled": + m_bStartDisabled = ReadBool(strValue); + break; + case "m_bEnabled": + m_bEnabled = ReadBool(strValue); + break; + case "m_bIsModern": + m_bIsModern = ReadBool(strValue); + break; default: super::Restore(strKey, strValue); } @@ -283,6 +298,15 @@ NSTrigger::Input(entity eAct, string strInput, string strData) case "Trigger": Trigger(eAct, TRIG_TOGGLE); break; + case "Enable": + m_bEnabled = true; + break; + case "Disable": + m_bEnabled = false; + break; + case "Toggle": + m_bEnabled = (m_bEnabled) ? false : true; + break; default: super:: Input(eAct, strInput, strData); } @@ -333,6 +357,10 @@ NSTrigger::SpawnKey(string strKey, string strValue) case "globalname": m_strGlobalName = ReadString(strValue); break; + case "StartDisabled": + m_bStartDisabled = ReadBool(strValue); + m_bIsModern = true; + break; #endif default: super::SpawnKey(strKey, strValue); diff --git a/src/shared/player_pmove.qc b/src/shared/player_pmove.qc index 25a51585..c76cab46 100644 --- a/src/shared/player_pmove.qc +++ b/src/shared/player_pmove.qc @@ -81,9 +81,9 @@ NSClientPlayer::Physics_Fall(float flDownforce) } Damage_Apply(this, world, fFallDamage, 0, DMG_FALL | DMG_SKIP_ARMOR); - Sound_Play(this, CHAN_VOICE, "player.fall"); + StartSoundDef("Player.FallDamage", CHAN_VOICE, true); } else if (flDownforce >= PHY_FALL_DISTANCE) { - Sound_Play(this, CHAN_VOICE, "player.lightfall"); + StartSoundDef("Player.LightFall", CHAN_VOICE, true); } #endif } @@ -135,6 +135,9 @@ NSClientPlayer::Physics_Crouch(void) void NSClientPlayer::Physics_Jump(void) { + if (GetMovetype() != MOVETYPE_WALK) + return; + /* we're underwater... */ if (WaterLevel() >= 2) { /* different water contents allow for different speeds */ @@ -241,7 +244,6 @@ NSClientPlayer::Physics_WaterMove(void) return; } -#ifdef SERVER if (WaterLevel() > 0) { if (watertype == CONTENT_LAVA) { if (m_flPainTime < time) { @@ -255,14 +257,13 @@ NSClientPlayer::Physics_WaterMove(void) } } } -#endif /* we've just exited water */ if (WaterLevel() != 3) { if (m_flUnderwaterTime < time) { - Sound_Play(this, CHAN_BODY, "player.gaspheavy"); + StartSoundDef("Player.GaspHeavy", CHAN_BODY, true); } else if (m_flUnderwaterTime < time + 9) { - Sound_Play(this, CHAN_BODY, "player.gasplight"); + StartSoundDef("Player.GaspLight", CHAN_BODY, true); } m_flUnderwaterTime = time + 12; } else if (m_flUnderwaterTime < time) { @@ -279,7 +280,7 @@ NSClientPlayer::Physics_WaterMove(void) if (!WaterLevel()){ if (GetFlags() & FL_INWATER) { #ifdef SERVER - Sound_Play(this, CHAN_BODY, "player.waterexit"); + StartSoundDef("Player.WaterExit", CHAN_BODY, true); #endif RemoveFlags(FL_INWATER); } @@ -288,7 +289,7 @@ NSClientPlayer::Physics_WaterMove(void) if (!(GetFlags() & FL_INWATER)) { #ifdef SERVER - Sound_Play(this, CHAN_BODY, "player.waterenter"); + StartSoundDef("Player.WaterEnter", CHAN_BODY, true); m_flPainTime = 0; #endif AddFlags(FL_INWATER); @@ -303,53 +304,54 @@ NSClientPlayer::Physics_WaterMove(void) float NSClientPlayer::Physics_MaxSpeed(void) { - float maxspeed = serverkeyfloat("phy_maxspeed"); - float desiredspeed = (GetFlags() & FL_CROUCHING) ? PMOVE_STEP_WALKSPEED : maxspeed; - return min(desiredspeed, maxspeed); + float maxValue = serverkeyfloat("phy_maxspeed"); + float wishSpeed = (GetFlags() & FL_CROUCHING) ? PMOVE_STEP_WALKSPEED : maxValue; + return min(wishSpeed, maxValue); } void NSClientPlayer::Physics_InputPreMove(void) { - NSVehicle veh = (NSVehicle)vehicle; - bool canmove = true; + NSVehicle currentVehicle = (NSVehicle)vehicle; + bool canMove = true; /* when pressing the 'use' button, we also walk slower for precision */ if (input_buttons & INPUT_BUTTON5) { input_movevalues *= 0.25; } - bool flying = ((GetMovetype() == MOVETYPE_NOCLIP) || (GetMovetype() == MOVETYPE_FLY)); - - if (flying == true) { - /* move camera up (noclip, fly) when holding jump */ - if (input_buttons & INPUT_BUTTON2) { - input_movevalues[2] = 240; - } - /* move camera down (noclip, fly) when holding crouching */ - if (input_buttons & INPUT_BUTTON8) { - input_movevalues[2] = -240; - } + /* find all the valid ways to freeze a player... */ + if (currentVehicle) { + if (currentVehicle.PreventPlayerMovement() == true) + canMove = false; } - /* find all the valid ways to freeze a player... */ - if (veh) - if (veh.PreventPlayerMovement() == true) - canmove = false; - - if (flags & FL_FROZEN || movetype == MOVETYPE_NONE) - canmove = false; + if (flags & FL_FROZEN || movetype == MOVETYPE_NONE) { + canMove = false; + } /* freeze in place */ - if (canmove == false) { + if (canMove == false) { input_movevalues = [0,0,0]; input_buttons &= ~INPUT_BUTTON2; } + /* clamp movement values to max speed */ + { + float wishSpeed = vlen(input_movevalues); + + if (wishSpeed > maxspeed) { + wishSpeed = maxspeed; + } + + input_movevalues = normalize(input_movevalues) * wishSpeed; + } + /* suppress crouching in vehicles */ - if (veh) - if (veh.CanDriverCrouch() == false) + if (currentVehicle) { + if (currentVehicle.CanDriverCrouch() == false) input_buttons &= ~INPUT_BUTTON8; + } } /* timers get processed here after physics are run */ @@ -379,7 +381,7 @@ NSClientPlayer::Physics_Run(void) { float flFallVel = (flags & FL_ONGROUND) ? 0 : -velocity[2]; float flBaseVel = basevelocity[2]; - bool onGround = (flags & FL_ONGROUND) ? true : false; + bool wasOnGround = (flags & FL_ONGROUND) ? true : false; saved_input_movevalues = input_movevalues; saved_input_buttons = input_buttons; @@ -417,7 +419,7 @@ NSClientPlayer::Physics_Run(void) Physics_CheckJump(FALSE); - if (onGround == false && (flags & FL_ONGROUND)) { + if (wasOnGround == false && (flags & FL_ONGROUND)) { if (waterlevel != 0) { flFallVel = 0; } diff --git a/src/shared/pmove_custom.qc b/src/shared/pmove_custom.qc index 6ba7beca..40c80c7d 100644 --- a/src/shared/pmove_custom.qc +++ b/src/shared/pmove_custom.qc @@ -47,6 +47,7 @@ PMoveCustom_StartFrame(void) PMoveCustom_UpdateVar("phy_maxspeed", "pm_maxspeed"); PMoveCustom_UpdateVar("phy_noclipspeed", "pm_noclipspeed"); PMoveCustom_UpdateVar("phy_noclipaccelerate", "pm_noclipaccelerate"); + PMoveCustom_UpdateVar("phy_nospeedcap", "pm_nospeedcap"); } #endif @@ -82,6 +83,9 @@ PMoveCustom_Categorize(void) bool inladder = false; vector testPos; + if (self.movetype == MOVETYPE_NOCLIP) + return; + tracebox(self.origin, self.mins, self.maxs, self.origin - [0,0,1], MOVE_NORMAL, self); if (!trace_startsolid) { @@ -97,6 +101,7 @@ PMoveCustom_Categorize(void) } } else { self.groundentity = __NULL__; + self.flags |= FL_ONGROUND; } self.flags &= ~FL_WATERJUMP; @@ -198,7 +203,7 @@ PMoveCustom_AccelWater(float move_time, float premove) wish_speed = vlen(vecWishVel); - if (wish_speed > self.maxspeed) { + if (serverkeyfloat("phy_nospeedcap") == 0 && wish_speed > self.maxspeed) { wish_speed = self.maxspeed; } @@ -258,11 +263,17 @@ PMoveCustom_AccelFriction(float move_time, float premove, vector wish_dir, float float flFriction; vector vecTemp; +#ifdef SERVER /* too finicky with monsters between the various game settings */ if (self.flags & FL_MONSTER) { - self.velocity = wish_dir * wish_speed; - return; + NSMonster checkMe = (NSMonster)self; + + if (checkMe.IsOnRoute() == true && checkMe.HasFlags(FL_ONGROUND) == true) { + self.velocity = wish_dir * wish_speed; + return; + } } +#endif flApplyFriction = serverkeyfloat("phy_friction"); @@ -305,7 +316,12 @@ PMoveCustom_AccelFriction(float move_time, float premove, vector wish_dir, float if (flFriction < 0) { self.velocity = [0,0,0]; } else { - self.velocity = self.velocity * flFriction; + self.velocity[0] = self.velocity[0] * flFriction; + self.velocity[1] = self.velocity[1] * flFriction; + + /* don't apply friction to horizontal movement... or else jumps get clamped */ + if (self.flags & FL_JUMPRELEASED) + self.velocity[2] = self.velocity[2] * flFriction; } } @@ -332,33 +348,14 @@ PMoveCustom_AccelNoclip(float move_time, float premove, vector wish_dir, float w } /* apply friction */ - if (self.velocity[0] || self.velocity[1]) { + if (vlen(self.velocity)) { vecTemp = self.velocity; - vecTemp[2] = 0; flFriction = vlen(vecTemp); - /* Next few lines of code assumes self is using player's hull, however it could be a monster - who use differen hull size, therefore it is invalid, so we probably better of using mins/maxs, - on the other hand edge friction is probably not that important. */ - - // if the leading edge is over a dropoff, increase friction - vecTemp = self.origin + normalize(vecTemp) * 16 + [0,0,1] * self.mins[2]; - traceline(vecTemp, vecTemp + [0,0,-34], TRUE, self); - - // apply friction - if (trace_fraction == 1.0) { - if (flFriction < serverkeyfloat("phy_stopspeed")) { - flFriction = 1 - move_time * (serverkeyfloat("phy_stopspeed") / flFriction) * flApplyFriction * serverkeyfloat("phy_edgefriction"); - } else { - flFriction = 1 - move_time * flApplyFriction * serverkeyfloat("phy_edgefriction"); - } + if (flFriction < serverkeyfloat("phy_stopspeed")) { + flFriction = 1 - move_time * (serverkeyfloat("phy_stopspeed") / flFriction) * flApplyFriction; } else { - if (flFriction < serverkeyfloat("phy_stopspeed")) { - flFriction = 1 - move_time * (serverkeyfloat("phy_stopspeed") / flFriction) * flApplyFriction; - } else { - - flFriction = 1 - move_time * flApplyFriction; - } + flFriction = 1 - move_time * flApplyFriction; } if (flFriction < 0) { @@ -424,7 +421,9 @@ PMoveCustom_Acceleration(float move_time, float premove) return; } } else { - vecWishVel = v_forward * input_movevalues[0] + v_right * input_movevalues[1]; + vecWishVel = v_forward * input_movevalues[0]; + vecWishVel += v_right * input_movevalues[1]; + vecWishVel += v_up * input_movevalues[2]; wish_dir = normalize(vecWishVel); wish_speed = serverkeyfloat("phy_noclipspeed"); PMoveCustom_AccelNoclip(move_time, premove, wish_dir, wish_speed); @@ -450,21 +449,16 @@ PMoveCustom_Acceleration(float move_time, float premove) wish_dir = normalize(vecWishVel); wish_speed = vlen(vecWishVel); - if (wish_speed > self.maxspeed) { + if (serverkeyfloat("phy_nospeedcap") == 0 && wish_speed > self.maxspeed) { wish_speed = self.maxspeed; } - if (self.movetype == MOVETYPE_NOCLIP) { - self.flags &= ~FL_ONGROUND; - self.velocity = wish_dir * wish_speed; + if (self.flags & FL_ONLADDER) { + PMoveCustom_AccelLadder(move_time, premove, wish_dir, wish_speed); + } else if (self.flags & FL_ONGROUND) { + PMoveCustom_AccelFriction(move_time, premove, wish_dir, wish_speed); } else { - if (self.flags & FL_ONLADDER) { - PMoveCustom_AccelLadder(move_time, premove, wish_dir, wish_speed); - } else if (self.flags & FL_ONGROUND) { - PMoveCustom_AccelFriction(move_time, premove, wish_dir, wish_speed); - } else { - PMoveCustom_AccelGravity(move_time, premove, wish_dir, wish_speed); - } + PMoveCustom_AccelGravity(move_time, premove, wish_dir, wish_speed); } } @@ -600,10 +594,11 @@ PMoveCustom_Move(void) break; } + /* there's something in the way, so let's try to bounce off of it, or step up */ saved_plane = trace_plane_normal; move_time -= move_time * trace_fraction; - if (move_time) { + if (move_time > 0.0) { /* step up if we can */ trace_endpos = self.origin; @@ -622,7 +617,7 @@ PMoveCustom_Move(void) dest = trace_endpos + (self.velocity * move_time); dest += (self.basevelocity * move_time); dest[2] = trace_endpos[2]; /*only horizontally*/ - + /* clear base-velocity */ self.basevelocity = [0,0,0]; @@ -630,7 +625,7 @@ PMoveCustom_Move(void) tracebox(trace_endpos, self.mins, self.maxs, dest, MOVE_NORMAL, self); /* if we got anywhere, make this raised-step move count */ - if (trace_fraction == 1.0f) { + if (trace_fraction >= 1.0f) { float fwfrac = trace_fraction; vector fwplane = trace_plane_normal; @@ -641,10 +636,12 @@ PMoveCustom_Move(void) if (trace_fraction < 1.0 && trace_plane_normal[2] > 0.7f) { move_time -= move_time * fwfrac; + /* bounce off the ceiling */ if (roof_fraction < 1) { PMoveCustom_Rebound(roof_plane_normal); } + if (trace_fraction < 1) { PMoveCustom_Rebound(trace_plane_normal); } else if (fwfrac < 1) { @@ -710,6 +707,20 @@ PMoveCustom_RunPlayerPhysics(entity target) if (self.maxspeed <= 0) self.maxspeed = 240; + + bool flying = ((target.movetype == MOVETYPE_NOCLIP) || (target.movetype == MOVETYPE_FLY)); + + if (flying == true) { + /* move camera up (noclip, fly) when holding jump */ + if (input_buttons & INPUT_BUTTON2) { + input_movevalues[2] = 240; + } + /* move camera down (noclip, fly) when holding crouching */ + if (input_buttons & INPUT_BUTTON8) { + input_movevalues[2] = -240; + } + } + #ifdef CUSTOMPLAYERPHYSICS /* call accelerate before and after the actual move, * with half the move each time. this reduces framerate dependence. @@ -726,8 +737,9 @@ PMoveCustom_RunPlayerPhysics(entity target) self.angles[0] *= -0.333; #ifdef CUSTOMPLAYERPHYSICS - /* activate any SOLID_TRIGGER entities */ - touchtriggers(); + /* activate any SOLID_TRIGGER entities, when not in noclip anyway */ + if (self.movetype != MOVETYPE_NOCLIP) + touchtriggers(); #endif setorigin(self, self.origin); @@ -747,7 +759,7 @@ PMoveCustom_RunCrouchPhysics(entity target) } else { // If we aren't holding down duck anymore and 'attempt' to stand up, prevent it if (target.flags & FL_CROUCHING) { - if (PMove_IsStuck(target, [0,0,36], PHY_HULL_MIN, PHY_HULL_MAX) == FALSE) { + if (PMove_IsStuck(target, [0,0,36], PHY_HULL_MIN, PHY_HULL_MAX) == false) { target.flags &= ~FL_CROUCHING; iFixCrouch = TRUE; } @@ -764,7 +776,7 @@ PMoveCustom_RunCrouchPhysics(entity target) if (iFixCrouch && PMove_IsStuck(target, [0,0,0], PHY_HULL_MIN, PHY_HULL_MAX)) { for (int i = 0; i < 36; i++) { target.origin[2] += 1; - if (PMove_IsStuck(target, [0,0,0], target.mins, target.maxs) == FALSE) { + if (PMove_IsStuck(target, [0,0,0], target.mins, target.maxs) == false) { break; } } diff --git a/src/shared/sound.h b/src/shared/sound.h index 536972d8..282a5568 100644 --- a/src/shared/sound.h +++ b/src/shared/sound.h @@ -99,3 +99,5 @@ int Sound_GetID(string sndDef); /** Server-side only: Play a sentences.txt entry on a given entity. */ void Sound_Speak(entity targetEntity, string sentencesEntry); #endif + +void Sound_DebugList(); \ No newline at end of file diff --git a/src/shared/sound.qc b/src/shared/sound.qc index c3c74e1d..9ac54a70 100644 --- a/src/shared/sound.qc +++ b/src/shared/sound.qc @@ -67,6 +67,8 @@ Sound_Init(void) SoundSource_Init(); precache_sound("misc/missing.wav"); + precache_sound("misc/null.wav"); + precache_sound("common/null.wav"); print("SoundDef initialized.\n"); } @@ -459,6 +461,7 @@ Sound_Precache(string shader) print("^1no soundDef found for "); print(shader); print("\n"); + g_sounds_count--; search_end(sh); return -1; @@ -943,3 +946,15 @@ SoundSource_Init(void) } fclose(manifestFile); } + + +/** Called by listSoundDef */ +void +Sound_DebugList(void) +{ + for (int i = 0; i < g_sounds_count; i++) { + print(sprintf("%i: %s (%i samples)\n", i, g_sounds[i].name, g_sounds[i].sample_count)); + } + + print(sprintf("\t%i total soundDef loaded\n", g_sounds_count)); +} \ No newline at end of file